code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from __future__ import unicode_literals
import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb_deprecated
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError, DynamoDBValidationError
from boto.exception import DynamoDBR... | william-richard/moto | tests/test_dynamodb/test_dynamodb_table_with_range_key.py | Python | apache-2.0 | 13,935 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.minigame.MazeBase
from panda3d.core import VBase3
from direct.showbase.RandomNumGen import RandomNumGen
class MazeBase:
def __init__(self, model, mazeData, cellWidth, parent = None):
if parent is None:
parent = render
... | DedMemez/ODS-August-2017 | minigame/MazeBase.py | Python | apache-2.0 | 5,752 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | shadowmint/nwidget | lib/cocos2d-0.5.5/cocos/gl_framebuffer_object.py | Python | apache-2.0 | 3,430 |
import ujson
from mock import patch, MagicMock
from typing import Dict, Optional, Text
from zerver.models import Message
from zerver.lib.webhooks.git import COMMITS_LIMIT
from zerver.lib.test_classes import WebhookTestCase
class GithubWebhookTest(WebhookTestCase):
STREAM_NAME = 'github'
URL_TEMPLATE = "/api/v... | verma-varsha/zulip | zerver/webhooks/github_webhook/tests.py | Python | apache-2.0 | 22,570 |
# -*- coding: utf-8 -*-
from ..common import get_module_class
class Parser(object):
@staticmethod
def get(parser_name):
clazz = get_module_class(parser_name, __name__)
return clazz()
def loads(self, content):
return content
def dumps(self, content):
return content
... | DataCanvasIO/pyDataCanvas | datacanvas/dataset/parser/parser.py | Python | apache-2.0 | 435 |
# -*- coding: utf-8 -*-
# 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... | openstack/python-congressclient | doc/source/conf.py | Python | apache-2.0 | 3,547 |
# Copyright 2015 NEC Corporation. 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 ... | masayukig/tempest | tempest/lib/services/identity/v3/token_client.py | Python | apache-2.0 | 8,017 |
#!encoding=utf-8
'''
Created on 2015年6月20日
@author: miaoyafei
'''
import jsonpickle as jspk
class Info(object):
'''
状态监控
'''
def __init__(self):
self.id = 0 #监控id
self.group = 0 #所在组
self.up_time = '0000-00-00 00:00:00' #更新时间
self.state_info = '' #状态信息
def get_value(... | stockminer/storm | base/monitor.py | Python | apache-2.0 | 923 |
#! /usr/bin/python
from twisted.spread import pb
from twisted.internet import reactor
def main():
factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8800, factory)
d = factory.getRootObject()
d.addCallbacks(got_obj)
reactor.run()
def got_obj(obj):
# change "broken" into "broken2" ... | hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/doc/core/howto/listings/pb/exc_client.py | Python | apache-2.0 | 810 |
#!/usr/bin/python
#
# bitehist.py Block I/O size histogram.
# For Linux, uses BCC, eBPF. Embedded C.
#
# Written as a basic example of using histograms to show a distribution.
#
# A Ctrl-C will print the gathered histogram then exit.
#
# Copyright (c) 2015 Brendan Gregg.
# Licensed under the Apache License, Version 2.... | mcaleavya/bcc | examples/tracing/bitehist.py | Python | apache-2.0 | 1,187 |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from dj... | digitalocean/netbox | netbox/dcim/models/device_components.py | Python | apache-2.0 | 27,423 |
# 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... | sxjscience/tvm | tests/python/relay/test_op_level1.py | Python | apache-2.0 | 18,600 |
#
# Copyright 2016 Quantopian, 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 law or agreed to in wr... | magne-max/zipline-ja | zipline/data/dispatch_bar_reader.py | Python | apache-2.0 | 4,415 |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import codecs
import json
import logging
import re
import os
import os.path
from collections import OrderedDict
from StringIO import StringIO
# Django
from django.conf import settings
from django.db import models, connection
from django.core.exception... | snahelou/awx | awx/main/models/unified_jobs.py | Python | apache-2.0 | 42,104 |
# -*- coding: utf-8 -*-
"""This module defines functions generally useful in scikit-ci."""
import os
from .constants import SERVICES, SERVICES_ENV_VAR
def current_service():
for service, env_var in SERVICES_ENV_VAR.items():
if os.environ.get(env_var, 'false').lower() == 'true':
return servi... | scikit-build/scikit-ci | ci/utils.py | Python | apache-2.0 | 1,327 |
from tests.subscriptions import Subscription_tests
from tests.messaging import Event_publisher_tests
from tests.callbacks import Callback_tests
from tests.shortcut_subscriptions import Decorator_tests
import unittest
import logging
def configure_logger():
handler = logging.FileHandler('log.txt')
formatter = l... | nevtum/Echopoint | tests/testrunner.py | Python | apache-2.0 | 569 |
from tile_view import *
from table import *
from game_state import *
from circ_button import *
class TableView:
GREY = (100,100,100)
BLACK = (0,0,0)
WHITE = (255,255,255)
BGCOLOR = (60,60,100)
TILE_COLOR = (90, 255, 90)
TILE_RADIUS = 30
TABLE_POS = (245, 90)
# table : Table
# pl1,... | lipk/pyzertz | pyzertz/table_view.py | Python | apache-2.0 | 3,483 |
#!/usr/bin/env python
import sys
import os
from os.path import abspath, join, dirname
from subprocess import list2cmdline
from distutils.core import setup
from distutils.command.install_scripts import install_scripts
try:
import setuptools # use setuptools when available
except ImportError:
pass
CURDIR = ... | snyderr/robotframework | setup.py | Python | apache-2.0 | 4,132 |
# ---Libraries---
# Standard library
import os
import sys
import math
# Third-party libraries
import cv2
import numpy as np
import scipy.ndimage as ndimage
# Private libraries
import compute_OBIFs
import color_BIFs
sys.path.append(os.path.abspath("../"))
import utils
template_png='algorithms/inputFields/template.pn... | avicorp/firstLook | src/algorithms/check_input_fields.py | Python | apache-2.0 | 11,258 |
# Copyright 2017 Google 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
#
# Unless required by applicable law or... | google/tmppy | _py2tmp/utils/__init__.py | Python | apache-2.0 | 784 |
"""The tests for the Jewish calendar sensors."""
from datetime import timedelta
from datetime import datetime as dt
import pytest
import homeassistant.util.dt as dt_util
from homeassistant.setup import async_setup_component
from homeassistant.components import jewish_calendar
from tests.common import async_fire_time_... | joopert/home-assistant | tests/components/jewish_calendar/test_sensor.py | Python | apache-2.0 | 19,613 |
# Copyright (c) 2012 NTT DOCOMO, 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
#
# Unless requ... | JimJiangX/BoneDragon | example/tests/db/base.py | Python | apache-2.0 | 912 |
# Copyright (c) 2016 Red Hat, 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
#
# Unless require... | phenoxim/cinder | cinder/tests/unit/api/v3/test_workers.py | Python | apache-2.0 | 8,104 |
#! -*- coding: utf-8 -*-
import copy
from six import with_metaclass
from bson.objectid import ObjectId
from pymongo import MongoClient
from pymongo import ReturnDocument
from apis.settings import Config
pyclient = MongoClient(Config.MONGO_MASTER_URL)
class ObjectModel(object):
def __init__(self, *args, **kwar... | gusibi/Metis | apis/models/model.py | Python | apache-2.0 | 4,308 |
#
# Copyright (c) SAS Institute 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 law or agreed to in w... | sassoftware/conary | conary_test/libtest/utiltest.py | Python | apache-2.0 | 43,933 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
i... | kubevirt/client-python | test/test_v1alpha1_persistent_volume_claim.py | Python | apache-2.0 | 1,015 |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
#allous you to chose browser from terminal
if browser == "firefox":
self... | TerekhovaKate/Python_training | fixture/application.py | Python | apache-2.0 | 1,143 |
#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# Un... | PUNCH-Cyber/stoq | stoq/cli.py | Python | apache-2.0 | 10,981 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 Julien LE CLEACH
#
# 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 Lic... | julien6387/supvisors | supvisors/supvisorsmapper.py | Python | apache-2.0 | 12,501 |
"""Support for Tesla cars."""
import asyncio
from collections import defaultdict
from datetime import timedelta
import logging
import async_timeout
from teslajsonpy import Controller as TeslaAPI, TeslaException
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const im... | titilambert/home-assistant | homeassistant/components/tesla/__init__.py | Python | apache-2.0 | 10,590 |
# -*- coding: utf-8 -*-
from marshmallow import Schema, fields, post_load
class Shape(object):
def __init__(self, color):
self.color = color
def __eq__(self, other):
return self.__dict__ == other.__dict__
class ShapeSchema(Schema):
color = fields.Str(allow_none=True)
class Triangle(Sh... | pombredanne/marshmallow-polyfield | tests/shapes.py | Python | apache-2.0 | 2,889 |
"""
Kernel which places a prior over periodic functions.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# global imports
import numpy as np
# local imports
from ._real import RealKernel
from ._distances import diff, sqdist
from ..util... | mwhoffman/pygp | pygp/kernels/periodic.py | Python | bsd-2-clause | 2,641 |
"""Leetcode 695. Max Area of Island
Medium
URL: https://leetcode.com/problems/max-area-of-island/
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's
(representing land) connected 4-directionally (horizontal or vertical.)
You may assume all four edges of the grid are surrounded by water.
Find... | bowen0701/algorithms_data_structures | lc0695_max_area_of_island.py | Python | bsd-2-clause | 4,625 |
"""
Compute design and response by calling R subprocess.
"""
import os
import subprocess
import pandas as pd
my_dir = os.path.dirname(__file__)
R_dir = os.path.join(my_dir, "R_code")
DR_module = os.path.join(R_dir, "design_and_response.R")
R_template = r"""
source('{module}')
meta.data <- read.table('{meta_file}'... | AaronWatters/inferelator_strawman | inferelator_strawman/design_response_R.py | Python | bsd-2-clause | 3,334 |
import argparse
import logging
import sys
from argparse import ArgumentParser
from importlib import import_module
from os import path
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
class CipherNameError(NameError):
pass
class CipherValueError(ValueError):
pass
def import_cipher_module(cipher_name, module_name=... | shakirjames/crypto | ciphers/utils.py | Python | bsd-2-clause | 1,893 |
#!/usr/bin/python
import string,datetime,sys,argparse,os,stat
import afs
from afs.util.AfsConfig import parseDefaultConfig
from afs.util.afsutil import parseHumanWriteableSize
from afs.service.VolService import VolService
from afs.model.Volume import Volume
from afs.lla.VolumeLLA import VolumeLLA
from afs.lla.VLDbLLA ... | openafs-contrib/afspy | examples/nukeVol.py | Python | bsd-2-clause | 1,510 |
from .base import ApiBase
import requests
class Search(ApiBase):
__module__ = 'trello'
def __init__(self, apikey, token=None):
self._apikey = apikey
self._token = token
def get(self, query, idBoards=None, idOrganizations=None, idCards=None, modelTypes=None, board_fields=None, bo... | tghw/trello-py | trello/search.py | Python | bsd-2-clause | 1,739 |
#!/usr/bin/env python2
import unittest
from pyvap import Store, UnsolvableError
from pyvap.constraints import NumUnique
import pyvap.types
class TestBasics(unittest.TestCase):
def setUp(self):
self.store = Store()
self.a = self.store.IntVar('a')
self.b = self.store.IntVar('b')
self.c = self.store.IntVar('c')... | dolkow/PyVaP | tests/n_unique.py | Python | bsd-2-clause | 4,938 |
import random
from ...mock.mock_abstract_device import MockAbstractDevice
from ..voltagesource230 import voltageSource230
"""
Mock Sample ABC1234
"""
class MockvoltageSource230(MockAbstractDevice, voltageSource230):
"""
Mock interface for the Sample ABC1234.
"""
def __init__(self, *args, **kwargs):
self.mock... | ghwatson/SpanishAcquisitionIQC | spacq/devices/keithley/mock/mock_voltagesource230.py | Python | bsd-2-clause | 1,017 |
import sys
import os
import json
from jsonschema import validate
def load_json(path):
with open(path) as fp:
return json.load(fp)
def load_json_suite(path):
schema = test_schema()
suite = load_json(path)
try:
validate(suite, schema)
except Exception as e:
print('{} is no... | kylef/jsonschema-test | jsonschema_test/__init__.py | Python | bsd-2-clause | 3,350 |
from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse
from django.http import Http404
from modeltree.tree import MODELTREE_DEFAULT_ALIAS, trees
from restlib2.params import Parametizer, IntParam, StrParam
from avocado.export import BaseExporter, registry as exporters
from avocado.query... | chop-dbhi/serrano | serrano/resources/exporter.py | Python | bsd-2-clause | 3,758 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_chart_line05.py | Python | bsd-2-clause | 1,358 |
# -*- coding: utf-8 -*-
class Fixtures(object):
def make_fixtures(self):
"""
Create users, attach them to organizations.
Create test client app, add test
resource, action and message.
"""
| hasgeek/lastuser | tests/unit/lastuser_oauth/providers/fixtures.py | Python | bsd-2-clause | 234 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
import unittest
from datetime import datetime
from ...worksheet import Worksheet
class TestConvertDateTime(unittest.TestCase):
"""
Test t... | jkyeung/XlsxWriter | xlsxwriter/test/worksheet/test_date_time_01.py | Python | bsd-2-clause | 7,088 |
from time import time
from networks.inetwork import INetwork
from dispatcher.dispatcher import Dispatcher
from commands.command import Command
from state.state import State
from colors.color import Color
from buzzer.buzzer_pattern import BuzzerPattern
DefaultCommand = Command(
duration=1,
color=Color.no_change... | Gleamo/gleamo-device | scheduler/scheduler.py | Python | bsd-2-clause | 2,501 |
from django.utils.encoding import iri_to_uri
from urlparse import urljoin
def utility(request):
"""
Add some useful niceties to the context
"""
base_uri = "%s://%s" % (request.is_secure() and 'https' or 'http',
request.get_host())
return dict(
site_base_uri=... | iivvoo/two.ol | two/ol/context_processors.py | Python | bsd-2-clause | 419 |
from __future__ import absolute_import, print_function
import logging
from datetime import time
from managers.models import Manager
from workshift.models import Semester, WorkshiftPool, WorkshiftType, \
RegularWorkshift
from workshift.utils import get_year_season, get_semester_start_end, \
make_manager_work... | knagra/farnsworth | workshift/fill.py | Python | bsd-2-clause | 12,986 |
from . import cartan_decompose
from . import stabilizers
from . import noncommgraph
| dstahlke/qitensor | qitensor/experimental/__init__.py | Python | bsd-2-clause | 84 |
# Copyright 2009-2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | Juniper/euca2ools | euca2ools/commands/iam/getuserpolicy.py | Python | bsd-2-clause | 2,581 |
import competition_utilities as cu
import numpy as np
import features
from sklearn.ensemble import RandomForestClassifier
from sklearn.naive_bayes import *
import sys
from sklearn.neighbors import KNeighborsClassifier
probs_file = sys.argv[1]
submission_file = sys.argv[2]
train_file = "train-sample.csv"
full_train_fil... | alessandro-sena/slearning-stackoverflow | fix_probs.py | Python | bsd-2-clause | 965 |
"""
사이트 관리 도구 어드민 페이지 설정.
"""
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin
from .models import Category, GroupServicePermission, Service, TopBanner
class CategoryAdmin(TranslationAdmin):
"""
:class:`Category` 모델에 대한 커스텀 어드민.
`django-modeltranlation` 에서 제공하는 :clas... | hangpark/kaistusc | apps/manager/admin.py | Python | bsd-2-clause | 1,268 |
from JumpScale import j
import JumpScale.baselib.redis
import JumpScale.grid.jumpscripts
class CmdRouter(object):
def __init__(self, path=None):
j.core.jumpscripts.load(path)
def route(self,organization,actor,name,**args):
pass
| Jumpscale/jumpscale6_core | lib/JumpScale/baselib/cmdrouter/CmdRouter.py | Python | bsd-2-clause | 264 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Automatic Batch processing for GP models
========================================
Requires:
* TensorFlow
* GPFlow
* Pandas
* GeoPandas
* Numpy
* shapely
"""
__author__ = "Juan Escamilla Mólgora"
__copyright__ = "Copyright 2017, JEM"
__lic... | molgor/spystats | HEC_runs/fit_fia_sppn.py | Python | bsd-2-clause | 4,595 |
import threading
# lock for each project or domain
# treat it as a singleton
# all file operation should be in lock region
class Locker(object):
_lock = {}
def acquire(self, name):
# create lock if it is not there
if name not in self._lock:
self._lock[name] = threading.Lock()
... | svebk/DeepSentiBank_memex | cu_image_search/www/manager/locker.py | Python | bsd-2-clause | 868 |
import numpy as np
from matplotlib import pyplot as plt
from pylab import rcParams
from matplotlib.ticker import ScalarFormatter
from subprocess import call
fs = 8
order = np.array([])
nsteps = np.array([])
error = np.array([])
# load SDC data
file = open('conv-data.txt', 'r')
while True:
line = file.readline... | danielru/pySDC | playgrounds/deprecated/acoustic_1d_imex/ploterrorconstants.py | Python | bsd-2-clause | 3,326 |
try:
import sys,re,os,subprocess,smtplib
from optparse import OptionParser
except Exception,e:
exit(100)
options=None
args=None
try:
usage = "usage: sendcrashreport.py -f /Library/Logs/CrashReports/MyFile.crash [-c /tmp/myvile]"
parser=OptionParser(usage=usage)
parser.add_option("-f",dest="file",help="the core d... | wave2future/gdkit | python/sendcrashreport.py | Python | bsd-2-clause | 1,814 |
import os
from gzip import GzipFile
from io import BytesIO
import numpy as np
from .tools import download_with_progress_bar
from . import get_data_home
DATA_URL = ('https://github.com/astroML/astroML-data/raw/main/datasets/'
'ADR3.dat.gz')
ARCHIVE_FILE = 'moving_objects.npy'
ADR4_dtype = [('moID', 'a6')... | astroML/astroML | astroML/datasets/moving_objects.py | Python | bsd-2-clause | 4,948 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.make
~~~~~~~~~~~~~~~~~~~~
Lexers for Makefiles and similar.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, \
... | uncled1023/pygments | Pygments/pygments-lib/pygments/lexers/make.py | Python | bsd-2-clause | 7,332 |
import urllib
from django.conf import settings
import urllib2
from corehq.apps.sms.mixin import SMSBackend
from dimagi.ext.couchdbkit import *
from corehq.apps.mach.forms import MachBackendForm
MACH_URL = "http://smsgw.a2p.mme.syniverse.com/sms.php"
class MachBackend(SMSBackend):
account_id = StringProperty()
... | puttarajubr/commcare-hq | corehq/apps/mach/api.py | Python | bsd-3-clause | 1,569 |
#CybOX -> OVAL Translator
#Generates valid OVAL 5.7 XML output from CybOX v2.1 XML
#Supports Windows files, registry keys, and processes
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import cybox_to_oval_processor as cybox2oval
import sys
#Print the usage... | CybOXProject/cybox-to-oval | cybox_to_oval.py | Python | bsd-3-clause | 1,436 |
from gen import *
from dataset import *
# TETROMINO
tetromino_gen = lambda w, h: TwoGroups("tetrisi/tetriso/tetrist/tetrisl/tetrisj/tetriss/tetrisz",
1010, w, h,
n1 = 1, n2 = 2, rot = True, task = 1)
tetromino = lambda w, h: BugPlacer(tet... | breuleux/bugland | bugland/premade.py | Python | bsd-3-clause | 796 |
import re
import os
import csv
import time
import logging
import logging.config
from os.path import join
import scrapelib
path = '/home/thom/sunlight/python-opencivicdata/opencivicdata/division-ids/identifiers/country-us'
class Checker(scrapelib.Scraper):
OUTFILE = 'domains.csv'
SCRAPELIB_RPM = 10
SCRA... | datamade/python-legistar-scraper | scripts/guessdomains.py | Python | bsd-3-clause | 4,242 |
from .main import PGCli
import sql.parse
import sql.connection
import logging
_logger = logging.getLogger(__name__)
def load_ipython_extension(ipython):
"""This is called via the ipython command '%load_ext pgcli.magic'"""
# first, load the sql magic if it isn't already loaded
if not ipython.find_line_ma... | dbcli/pgcli | pgcli/magic.py | Python | bsd-3-clause | 2,270 |
from .. import QMessageBoxPatched as QMessageBox
from ....qt import get_qapp
from ....external.qt import QtGui
def test_main():
app = get_qapp()
w = QMessageBox(QMessageBox.Critical, "Error", "An error occurred")
w.setDetailedText("Spam")
w.select_all()
w.copy_detailed()
assert app.clipboar... | JudoWill/glue | glue/utils/qt/tests/test_qmessagebox_widget.py | Python | bsd-3-clause | 357 |
# DO NOT IMPORT THIS BEFORE django.configure() has been run!
import os
from django.conf import settings
DATABASES = getattr(settings, 'DBBACKUP_DATABASES', list(settings.DATABASES.keys()))
BACKUP_DIRECTORY = getattr(settings, 'DBBACKUP_BACKUP_DIRECTORY', os.getcwd())
# Days to keep backups
CLEANUP_KEEP = getattr(se... | BloodyD/django-dbbackup | dbbackup/settings.py | Python | bsd-3-clause | 2,525 |
from django.conf.urls import url, include
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .customer.urls import urlpatterns as customer_urls
from .order.urls import urlpatterns as order_urls
from .payments.urls import urlpatterns as payments_urls
from .product.urls import... | car3oon/saleor | saleor/dashboard/urls.py | Python | bsd-3-clause | 1,052 |
"""Top-level presubmit script for Cobalt."""
import imp
# TODO(uzhilinsky): Temporarily use Steel's PRESUBMIT checks until Cobalt can
# transition to use the canned checks from depot_tools.
steel_presubmit_checks = imp.load_source(
'steel_presubmit_checks', '../tools/repo-hooks/steel_presubmit_checks.py')
CPPLIN... | youtube/cobalt | third_party/v8/PRESUBMIT.py | Python | bsd-3-clause | 1,880 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 30, transform = "Fisher", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Fisher/trend_PolyTrend/cycle_30/ar_/test_artificial_32_Fisher_PolyTrend_30__100.py | Python | bsd-3-clause | 262 |
class Solution:
def get_stm(self, p:str) -> dict:
start = {}
idx = 0
l = len(p)
curr_state = start
while idx < l:
ch = p[idx]
if ch in curr_state:
next_state = {}
curr_state[''] = next_state
elif idx+1 < l an... | y-usuzumi/survive-the-course | leetcode/10.Regular_Expression_Matching/main.py | Python | bsd-3-clause | 2,097 |
class NoResultsException(Exception):
def __init__(self):
Exception("No Results.")
class RelationalOperator(object):
def __init__(self, parent):
self.parent = parent
def GenSql(self, sqlBuilder):
"""
Main external interface for SQL generation.
The client co... | alcides/rdflib | rdflib/sparql/sql/RelationalOperators.py | Python | bsd-3-clause | 4,107 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-socket-server
------------
Tests for `django-socket-server` models module.
"""
import os
import shutil
from django.test import TestCase
from socket_server import models
class TestSocket_server(TestCase):
def setUp(self):
pass
def tes... | CptLemming/django-socket-server | tests/test_models.py | Python | bsd-3-clause | 390 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2016--, Evguenia Kopylova, Jad Kanbar, SevenBridges dev team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software... | ekopylova/tcga-1 | python_scripts/cgc_create_tcga_workflow_task.py | Python | bsd-3-clause | 20,620 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Run the BOLD reference+mask workflow"""
import os
def get_parser():
"""Build parser object."""
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter, RawDescriptionH... | poldracklab/niworkflows | niworkflows/cli/boldref.py | Python | bsd-3-clause | 2,183 |
from __future__ import absolute_import, print_function, division
from itertools import product
import time
import unittest
from nose.plugins.skip import SkipTest
import numpy
from six.moves import xrange
try:
import scipy.sparse as sp
import scipy.sparse
from scipy.sparse import csr_matrix
except ImportErr... | JazzeYoung/VeryDeepAutoEncoder | theano/sparse/tests/test_basic.py | Python | bsd-3-clause | 119,627 |
# -*- coding: utf-8 -*-
import unittest
from collections import OrderedDict
from datetime import datetime
from six import BytesIO, StringIO
from eduid_common.api.testing import EduidAPITestCase
from eduid_webapp.letter_proofing import pdf
from eduid_webapp.letter_proofing.app import init_letter_proofing_app
from e... | SUNET/eduid-webapp | src/eduid_webapp/letter_proofing/tests/test_pdf.py | Python | bsd-3-clause | 6,870 |
"""
This module will test particular commands/job in full stack, i.e. with
running buildmaster, slave and friends.
"""
from djangosanetesting.cases import HttpTestCase
import os
from shutil import rmtree
from tempfile import mkdtemp
from time import sleep
from datetime import datetime, timedelta
from subprocess import... | centrumholdings/cthulhubot | tests/example_project/tests/test_particular_commands.py | Python | bsd-3-clause | 2,216 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'boar.accounts.views.accounts', name='accounts'),
url(r'^signout/$', 'boar.accounts.views.signout', name='accounts_signout'),
url(r'^settings/$', 'boar.accounts.views.settings_form', name='accounts_settings'),
url(r'^mailing-... | boar/boar | boar/accounts/urls.py | Python | bsd-3-clause | 562 |
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
from captcha import client
class ReCaptcha(forms.widgets.Widget):
if getattr(settings, "RECAPTCHA_NOCAPTCHA", False):
recaptcha_response_name = 'g-recaptcha-response'
re... | Elec/django-recaptcha | captcha/widgets.py | Python | bsd-3-clause | 1,285 |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
url(r'^$', 'recollect.views.home', name='home'),
url(r'^albums$', 'recollect.views.albums', name='albums'),
url(r'^album/(?P<album_slug>[A-z0-9-]+)$', 'recollect.views.album', name='album'),
)
| richbs/django-record-collector | recollect/urls.py | Python | bsd-3-clause | 275 |
#!/usr/bin/env python
# encoding=utf8
__author__ = 'wcong'
import sys
from twisted.internet import reactor
from ants.node import node
from ants import settings
from conf import settings as project_settings
import logging
import argparse
'''
what we do
start the node
let the node do what he need to do
'''
parser = ar... | wcong/ants | ants/bootstrap/bootstrap.py | Python | bsd-3-clause | 1,189 |
from django import forms
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class FeedbackEditorFileWidget(forms.ClearableFileInput):
"""
Clearable file widget.
Can be made un-clearable (for required fields) using the
``clearable`` argument for ``__init_... | devilry/devilry-django | devilry/devilry_gradingsystem/widgets/filewidget.py | Python | bsd-3-clause | 973 |
#!/usr/bin/env python
cubes_by_four = [x**3 for x in range(1,11) if (x**3) % 4 == 0]
print cubes_by_four
| talapus/Ophidian | Academia/ListComprehensions/cubes_by_four.py | Python | bsd-3-clause | 107 |
import hashlib
import mock
import uuid
from django.test import TestCase
from ..models import Commander
class CommanderTestCase(TestCase):
def test_generate_token(self):
with mock.patch.object(uuid, 'uuid4', return_value='a_test'):
cmdr = Commander(
name='Branch'
)... | toastdriven/eliteracing | cmdrs/tests/test_models.py | Python | bsd-3-clause | 666 |
import copy
from django.db import router
from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
def ensure_default_manager(sender, **kwargs):
"""
Ensures that a Model subclass contains a d... | riklaunim/django-custom-multisite | django/db/models/manager.py | Python | bsd-3-clause | 8,241 |
import io
import pytest
from starlette.datastructures import (
URL,
CommaSeparatedStrings,
FormData,
Headers,
MultiDict,
MutableHeaders,
QueryParams,
UploadFile,
)
def test_url():
u = URL("https://example.org:123/path/to/somewhere?abc=123#anchor")
assert u.scheme == "https"
... | encode/starlette | tests/test_datastructures.py | Python | bsd-3-clause | 13,462 |
IMPORTS = [
'java.io.DataInputStream',
'java.io.DataOutputStream',
'java.util.Vector',
'scala.collection.JavaConversions._'
]
# class name -> (owner type, comment, {name -> bit})
ACCESS_FLAGS = {
'ClassAccessFlags': (
'ClassInfo',
'see tab... | pattyshack/abc | src/jvm_bytecode/gen_access_flags.py | Python | bsd-3-clause | 5,371 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import gzip
import sys
from io import StringIO
from urllib.request import build_opener
from astropy.io import fits
__all__ = ['chunk_report', 'chunk_read']
def chunk_report(bytes_so_far, chunk_size, total_size):
if total_size > 0:
percent =... | ceb8/astroquery | astroquery/utils/progressbar.py | Python | bsd-3-clause | 1,948 |
import operator
import numpy as np
import pytest
from pandas.compat.numpy import _np_version_under1p20
import pandas as pd
import pandas._testing as tm
from pandas.core import ops
from pandas.core.arrays.sparse import SparseArray, SparseDtype
@pytest.fixture(params=["integer", "block"])
def kind(request):
"""k... | jreback/pandas | pandas/tests/arrays/sparse/test_arithmetics.py | Python | bsd-3-clause | 20,217 |
#!/usr/bin/python
import getopt, sys
import dpkt,socket
def usage():
print "dpkt_merge_pcap [-l input_pcap_file_list] [-o output_pcap_file]"
def main():
input_pcap_file_list="/dev/stdin"
output_pcap_file="/dev/stdout"
try:
opts, args = getopt.getopt(sys.argv[1:], "hl:o:", ["help", "input_pca... | t-umeno/dpkt_merge_pcap | dpkt_merge_pcap.py | Python | bsd-3-clause | 1,539 |
"""
Query response format
"""
from mysqlproxy import column_types
from mysqlproxy.types import *
from mysqlproxy.packet import Packet, EOFPacket, OKPacket, ERRPacket, OutgoingPacketChain
from mysqlproxy import status_flags
from mysqlproxy.binary_protocol import generate_binary_field_info
# in particular, ColumnDefinit... | spigwitmer/mysqlproxy | mysqlproxy/query_response.py | Python | bsd-3-clause | 7,865 |
from django import forms
from django.conf import settings
from django.contrib.admin.helpers import normalize_fieldsets, AdminReadonlyField, AdminField
from django.contrib.admin.templatetags.admin_static import static
from django.utils.safestring import mark_safe
class AdminForm(object):
def __init__(self, form, fi... | joke2k/django-options | django_options/formset.py | Python | bsd-3-clause | 4,546 |
from setuptools import setup, find_packages
setup(
name='rapidsms-xforms',
version=__import__('rapidsms_xforms').__version__,
license="BSD",
install_requires = [
"django>=1.3",
"rapidsms==0.9.6a",
"django-uni-form==0.8.0",
"django-eav==0.9.2",
"python-digest==1.... | unicefuganda/edtrac | edtrac_project/rapidsms_xforms_src/setup.py | Python | bsd-3-clause | 1,235 |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 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... | stormi/tsunami | src/secondaires/navigation/commandes/matelot/renommer.py | Python | bsd-3-clause | 3,241 |
from __future__ import absolute_import, division, print_function
class _slice(object):
""" A hashable slice object
>>> _slice(0, 10, None)
0:10
"""
def __init__(self, start, stop, step):
self.start = start
self.stop = stop
self.step = step
def __hash__(self):
r... | mrocklin/blaze | blaze/expr/utils.py | Python | bsd-3-clause | 1,782 |
import unittest
from datetime import datetime, timedelta, tzinfo
from lxml import etree
from soapfish import xsd
# TODO: Change import on update to iso8601 > 0.1.11 (fixed in 031688e)
from iso8601.iso8601 import FixedOffset, UTC # isort:skip
class DatetimeTest(unittest.TestCase):
def test_rendering(self):
... | iurisilvio/soapfish | tests/xsd/xsd_datetime_test.py | Python | bsd-3-clause | 2,625 |
from django.shortcuts import get_object_or_404
from django.views.generic import DetailView, ListView
from braces.views import OrderableListMixin
from .models import Post, Tag
ORDER_FIELD = {'title': 'title'}
class PermissionMixin(object):
def get_queryset(self, *args, **kwargs):
qs = super(PermissionMix... | ad-m/pru | pru/blog/views.py | Python | bsd-3-clause | 1,186 |
from nose.tools import eq_
from django.test import TestCase
from us_ignite.hubs import forms
class TestHubRequestForm(TestCase):
def test_form_fields_are_not_sensitive(self):
form = forms.HubRequestForm()
eq_(sorted(form.fields.keys()),
sorted(['name', 'website', 'summary', 'descrip... | us-ignite/us_ignite | us_ignite/hubs/tests/forms_tests.py | Python | bsd-3-clause | 2,096 |
from models import City, Country
import factory
class CityFactory(factory.DjangoModelFactory):
remote_id = factory.Sequence(lambda n: n + 1)
class Meta:
model = City
class CountryFactory(factory.DjangoModelFactory):
remote_id = factory.Sequence(lambda n: n + 1)
class Meta:
model = ... | ramusus/django-vkontakte-places | vkontakte_places/factories.py | Python | bsd-3-clause | 328 |
import datetime
from distutils.version import LooseVersion
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.utils.functional import cached_property
from django.utils.version import get_complete_version, get_major_version
# A version of django.utils.version... | xavierdutreilh/djangoproject.com | releases/models.py | Python | bsd-3-clause | 9,309 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | python/GafferTest/UndoTest.py | Python | bsd-3-clause | 5,828 |