code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' file accompa...
boto/s3transfer
tests/unit/test_subscribers.py
Python
apache-2.0
3,197
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack Foundation # 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.apach...
plumgrid/plumgrid-nova
nova/api/openstack/compute/contrib/os_tenant_networks.py
Python
apache-2.0
7,948
""" Uname - ``uname -a`` command output =================================== The ``Uname`` class reads the output of the ``uname -a`` command and interprets it. It also does a number of handy extra things, like deriving the RHEL release from the kernel version. Uname objects can also be compared by their kernel versi...
PaulWay/insights-core
insights/parsers/uname.py
Python
apache-2.0
19,809
from django import forms, template from django.forms.formsets import all_valid from django.forms.models import modelform_factory, inlineformset_factory from django.forms.models import BaseInlineFormSet from django.contrib.contenttypes.models import ContentType from django.contrib.admin import widgets from django.contri...
Shrews/PyGerrit
webapp/django/contrib/admin/options.py
Python
apache-2.0
34,944
# Copyright 2021 The Matrix.org Foundation C.I.C. # # 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 a...
matrix-org/synapse
synapse/handlers/federation_event.py
Python
apache-2.0
78,447
# Written by Sam Deans. # Twitter/GitHub: @sdeans0 # Licensed under the Apache License, Version 2.0 (see below) # This program is for turning matching type Moodle questions to Cloze type questions in # Moodle xml format. # Run it from the command line by importing the moduleand running the # matchToCloze.main('file...
SDeans0/Moodle
matchToCloze.py
Python
apache-2.0
7,517
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import os from pants.backend.jvm.subsystems.resolve_subsystem import JvmResolveSubsystem...
twitter/pants
tests/python/pants_test/jvm/jvm_task_test_base.py
Python
apache-2.0
2,419
""" taskmaster.controller ~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ import cPickle as pickle import gevent import sys from gevent_zeromq import zmq from gevent.queue import Queue, Empty from os import path, unlink, rename from taskmaster.util im...
alex/taskmaster
src/taskmaster/server.py
Python
apache-2.0
6,026
import sys import os import os.path import glob from optparse import OptionParser #------------------------------------------------------------------------------- # the main function # cd bin_VS2010 # ctest -C Release # cd Testing # python ../../elastix/Testing/elx_get_checksum_list.py -l elastix_run* # cd .. # cmake ...
SuperElastix/elastix
Testing/elx_get_checksum_list.py
Python
apache-2.0
2,114
# Copyright 2020 Nokia. # # 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...
nuagenetworks/nuage-openstack-horizon
nuage_horizon/dashboards/project/gateways/urls.py
Python
apache-2.0
1,078
import datetime import itertools import query import utils from exc import InvalidTimeRangeError from exc import NoSamplesError from log import logging from reading import Reading logger = logging.getLogger('usage.meter') def _cmp_sample(a, b): """Compare two samples. First compare the resource ids. Compar...
absalon-james/usage
usage/meter.py
Python
apache-2.0
4,874
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
jamielennox/django-openstack-auth-websso
openstack_auth_websso/plugin.py
Python
apache-2.0
2,014
from flask import render_template from app import app @app.route('/') @app.route('/mainpage') def slpage(): return render_template('mainpage.html') @app.errorhandler(404) def page_not_found(error): return render_template('page_not_found.html'), 404
jvahala/brew-thing
app/views.py
Python
apache-2.0
274
# Copyright 2011 VMware, 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 ...
chitr/neutron
neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
Python
apache-2.0
89,243
from flask import Blueprint from ..models import Permission main = Blueprint('main', __name__) from . import view, errors # 让所有模版都可以访问Permission类 @main.app_context_processor def inject_permission(): return dict(Permission=Permission)
Ivicel/flasky
app/main/__init__.py
Python
apache-2.0
259
#! /usr/bin/env python import envoy import boto import requests import os import sys import time import random import string from oauthlib.oauth2 import MobileApplicationClient from requests_oauthlib import OAuth2Session from boto.s3.connection import Location from boto.s3.lifecycle import Lifecycle, Transition, Rule ...
Kickflip/python-kickflip
kickflip/kickflip.py
Python
apache-2.0
9,824
import os import json import numpy as np from sklearn.externals import joblib from scripts.features.post import Post from scripts.features.post_feature import PostFeature import scripts.features.length_extractor as lext import scripts.features.charactor_extractor as cext import scripts.features.structure_extractor as s...
chakki-works/elephant_sense
elephant_sense/evaluator.py
Python
apache-2.0
2,383
# -*- coding: utf-8 -*- from setuptools import setup, find_packages requires = [ 'regex', 'six', 'clldutils>=1.7.3', ] tests_require = [ 'mock', ] testing_extras = tests_require + [ 'nose', 'coverage', ] def read(fname): with open(fname) as fp: content = fp.read() return co...
xrotwang/segments
setup.py
Python
apache-2.0
1,483
"""Copyright 2009 Chris Davis 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 dist...
carlosalberto/carbon-fork
lib/carbon/writer.py
Python
apache-2.0
5,226
__author__ = 'amentis' from RxAPI.RxGUI import Color, RxGUIObject class Border(RxGUIObject): """ Drawable border for any drawable RxGUIObject. """ def __init__(self, name, color=None, style="solid", width="1px"): """ @param name: str name of the REXI object @param color: Color ...
amentis/Rexi
RxAPI/RxGUI/Border.py
Python
apache-2.0
1,108
# -*- coding: utf-8 -*- from sphinx.builders.html import JSONHTMLBuilder from sphinx.util import jsonimpl class DeconstJSONImpl: """ Enhance the default JSON encoder by adding additional keys. """ def dump(self, obj, fp, *args, **kwargs): self._enhance(obj) return jsonimpl.dump(obj, ...
smashwilson/deconst-preparer-sphinx
deconstrst/builder.py
Python
apache-2.0
1,067
#!/usr/bin/env python # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
wikimedia/integration-zuul
tests/test_daemon.py
Python
apache-2.0
2,085
#!/usr/bin/python # -*- coding:utf8 -*- import os import tensorflow as tf from keras import layers from keras.applications.imagenet_utils import _obtain_input_shape from keras.backend.tensorflow_backend import set_session from keras.engine.topology import get_source_inputs from keras.layers import * from keras.models ...
GloryDream/generative_style_transfer
Project/generative_style_transfer/models/generative_model_v2.py
Python
apache-2.0
8,266
import random CHOICES = {1: 'Rock', 2: 'Paper', 3: 'Scissors'} RESULTS = [[0, -1, 1], [1, 0, -1], [-1, 1, 0]] def ask(): while True: s = input('Let\'s play the game:\n\t1. Rock\n\t2. Paper\n\t3. Scissors?\nWhat you choose?: ') if s.isdigit(): c = int(s) if not (1 <= c <= 3)...
zhaoshengshi/practicepython-exercise
exercise/8.py
Python
apache-2.0
1,238
"""Support for Xiaomi Miio.""" from datetime import timedelta import logging from miio.gateway import GatewayException from homeassistant import config_entries, core from homeassistant.const import CONF_HOST, CONF_TOKEN from homeassistant.helpers import device_registry as dr from homeassistant.helpers.update_coordina...
turbokongen/home-assistant
homeassistant/components/xiaomi_miio/__init__.py
Python
apache-2.0
3,934
# # This source file is part of the EdgeDB open source project. # # Copyright 2018-present MagicStack Inc. and the EdgeDB authors. # # 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...
edgedb/edgedb
edb/server/compiler/__init__.py
Python
apache-2.0
1,345
# Copyright 2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group 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 # # Un...
sony/nnabla
python/src/nnabla/backward_function/tanh_shrink.py
Python
apache-2.0
1,106
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2016 Twitter. 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...
lucperkins/heron
heron/instance/src/python/utils/metrics/metrics_helper.py
Python
apache-2.0
17,523
import sqlite3 import urllib import re from urllib.request import urlopen from bs4 import BeautifulSoup from phyllo.phyllo_logger import logger # Note: The original ordering of chapters and verses was extremely complex. # As a result, chapters are the bold headers and subsections are each p tag. # Case 1: Sec...
oudalab/phyllo
phyllo/extractors/asconiusDB.py
Python
apache-2.0
2,970
#!/usr/bin/env python # # Copyright 2015 Martin Cochran # # 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 la...
martincochran/score-minion
list_id_bimap.py
Python
apache-2.0
4,643
__source__ = 'https://leetcode.com/problems/binary-tree-cameras/' # Time: O(N) # Space: O(H) # # Description: Leetcode # 968. Binary Tree Cameras # # Given a binary tree, we install cameras on the nodes of the tree. # # Each camera at a node can monitor its parent, itself, and its immediate children. # # Calculate the...
JulyKikuAkita/PythonPrac
cs15211/BinaryTreeCameras.py
Python
apache-2.0
4,264
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-09 23:22 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('player', '0002_auto_20160505_0350'), ] operations = [ migrations.RenameField( ...
betonreddit/betonreddit
betonreddit/player/migrations/0003_auto_20160509_2322.py
Python
apache-2.0
427
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # 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...
googleapis/python-bigquery-datatransfer
samples/generated_samples/bigquerydatatransfer_v1_generated_data_transfer_service_get_data_source_sync.py
Python
apache-2.0
1,542
# Universidade de Aveiro - Physics Department # 2016/2017 Project - Andre Calatre, 73207 # "Simulation of an epidemic" - 25/3/2017 # The following code has been based on: # Forest Fire Model from http://scipython.com/blog/the-forest-fire-model/ import numpy as np import matplotlib.pyplot as plt from matplotlib import...
calatre/epidemics_network
models/other/ep2.py
Python
apache-2.0
3,929
#Author : Yogendra Sharma #Date : 28/06/2017 # Get a Host Name from given IP Address #importing python socket module import socket IP = "127.0.0.1" # get host name from IP address host_name = socket.gethostbyaddr(IP) print("IP {0} is resolved as Host Name {1}".format(IP ,host_name[0]))
Yogendra0Sharma/Python-Network-Programming
Module 1 Basic Socket API/Exercise_3.py
Python
apache-2.0
291
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 OpenStack LLC. # 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/...
genius1611/Keystone
keystone/backends/sqlalchemy/api/role.py
Python
apache-2.0
8,044
# -*- coding: utf-8 -*- from .pathmap import ( clean_path, _check_ancestors, _resolve_path, resolve_paths, resolve_by_method ) from .utils import ( _extract_match ) from .tree import Tree __version__ = '0.1.5'
codecov/pathmap
pathmap/__init__.py
Python
apache-2.0
238
import numpy as np from scipy.optimize import check_grad ## Two-layer NN with ReLU # Two-layer NN, with 200 units per layer with ReLu ai = max(0,oi) # X - (W01) - Layer1 - (W12) - Layer2 - (W23) - Output # ((D+1)*nh) + ((nh+1)*nh) + ((nh+1)*K) nh = 200 def getAvgGradient(w, X, y, L, K): [N,D] = X.shape W01,...
jihunhamm/Crowd-ML
client/python/loss_nndemo1.py
Python
apache-2.0
3,849
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # 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.apac...
Dev-Cloud-Platform/Dev-Cloud
dev_cloud/cc1/src/cm/utils/threads/image.py
Python
apache-2.0
8,639
# # Copyright 2018 Analytics Zoo Authors. # # 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...
intel-analytics/analytics-zoo
pyzoo/test/zoo/chronos/data/utils/test_roll.py
Python
apache-2.0
3,826
# Copyright 2015 Sean Vig # # 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, sof...
flacjacket/pywayland
pywayland/scanner/method.py
Python
apache-2.0
4,257
#!/usr/bin/env python from optparse import OptionParser, SUPPRESS_HELP import os, glob, subprocess, sys, math, shutil import imm_cluster, util ############################################################ # scimm.py # # Sequence Clustering with Interpolated Markov Models # # Author: David Kelley #######################...
davek44/Scimm
bin/scimm.py
Python
artistic-2.0
9,432
#!/usr/bin/env python2.7 # __BEGIN_LICENSE__ # # Copyright (C) 2010-2012 Stanford University. # All rights reserved. # # __END_LICENSE__ # rectify.py # # Usage: rectify.py <lightfield_image.{tif,png,etc}> [--pixels-per-lenslet <ppl>] # # This script simply applies a rectification from a # campixel_to_camlens.warp fil...
sophie63/FlyLFM
stanford_lfanalyze_v0.4/lfrectify.py
Python
bsd-2-clause
3,622
# coding: utf-8 from optparse import make_option from django.core.management.base import BaseCommand from twiggy_goodies.django import LogMixin from allmychanges.vcs_extractor import choose_version_extractor class Command(LogMixin, BaseCommand): help = u"""Command to test VCS log extractors' second step — versio...
AllMyChanges/allmychanges.com
allmychanges/management/commands/dev_extract_version.py
Python
bsd-2-clause
846
import re def get_subset(a, keys): return dict((k, a[k]) for k in keys if k in a) def find(array, properties): keys = properties.keys() for a in array: dict_a = a if hasattr(a, '__dict__'): dict_a = a.__dict__ subset = get_subset(dict_a, keys) if subset == pro...
cameronmaske/skipper
skipper/utils.py
Python
bsd-2-clause
1,012
class Fault(Exception): def __init__(self, msg, code=None, *args, **kwargs): super(Fault, self).__init__(*[msg] + list(args), **kwargs) self.code = code
dstufft/xmlrpc2
xmlrpc2/exceptions.py
Python
bsd-2-clause
175
# a generator for a PE with maximum number of section # 199 sections confirmed working SEC_NUMB = 199 SECTIONS_VSTART = 0x02000 f = open("max_sec.asm", "wt") f.write("""; PE file with a maximum of sections %include '..\..\consts.asm' FILEALIGN equ 200h SECTIONALIGN equ 1000h org IMAGEBASE istruc I...
angea/corkami
wip/MakePE/examples/PE/max_sec.py
Python
bsd-2-clause
3,885
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('flood_mapper', '0003_data_migration_20141201_0218'), ] operations = [ migrations.AlterField( model_name='floodst...
kartoza/jakarta-flood-maps
django_project/flood_mapper/migrations/0004_auto_20141216_1042.py
Python
bsd-2-clause
665
import angr import claripy import os test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') def test_i386(): p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False) arg1 = claripy.BVS('arg1', 20*8) s = p.factory.en...
angr/angr
tests/test_strcasecmp.py
Python
bsd-2-clause
780
"""Print a GO term's lower-level hierarchy.""" __copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang. All rights reserved." __author__ = "DV Klopfenstein" import sys # pylint: disable=too-many-instance-attributes,too-few-public-methods class WrHierPrt(object): """Print the hierarchy of a set of obje...
tanghaibao/goatools
goatools/rpt/write_hierarchy_base.py
Python
bsd-2-clause
5,169
# -*- coding: UTF-8 -*- # Copyright 2012-2013 Luc Saffre # License: BSD (see file COPYING for details) """ Writes screenshots to <project_dir>/media/cache/screenshots """ # from future import standard_library # standard_library.install_aliases() from builtins import str import logging logger = logging.getLogger(__nam...
khchine5/lino
lino/management/commands/makescreenshots.py
Python
bsd-2-clause
8,696
from __future__ import print_function import sys, os, math import numpy as np from numpy import float32, int32, uint8, dtype # Load PyGreentea # Relative path to where PyGreentea resides pygt_path = '../..' sys.path.append(pygt_path) import pygreentea.pygreentea as pygt import caffe from caffe import layers as L from...
naibaf7/PyGreentea
examples/VD2D3D/mknet_vd2d3d.py
Python
bsd-2-clause
1,991
from se34euca.lib.EucaUITestLib_Base import * import time class EucaUITestLib_Security_Group(EucaUITestLib_Base): def test_ui_gotopage_security_groups(self): print print "Started Test: GotoPage Security Groups" self.click_element_by_id("euca-logo") print print "Test: Receiv...
eucalyptus/se34euca
3.3.1/se34euca/se34euca/lib/EucaUITestLib_Security_Group.py
Python
bsd-2-clause
7,211
import elasticsearch es = elasticsearch.Elasticsearch() index_name = "my_index" type_name = "my_type" if es.indices.exists(index_name): es.indices.delete(index_name) es.indices.create(index_name) es.cluster.health(wait_for_status="yellow") es.indices.put_mapping(index=index_name, doc_type=type_name, body={type...
aparo/elasticsearch-cookbook-third-edition
chapter_16/mapping_management.py
Python
bsd-2-clause
1,158
# coding=utf-8 from __future__ import absolute_import import os import sys sys.path.append(os.path.join( os.path.dirname(os.path.basename(__file__)), ".." )) sys.path.append(os.path.dirname(__file__)) from collections import OrderedDict import codecs import json import hashlib # Ity Imports import Ity from ...
uwgraphics/Ubiqu-Ity
Ity/celery_tasks.py
Python
bsd-2-clause
12,033
import nose from nose.plugins.attrib import attr import logging import colorguard import os bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries')) @attr(speed='slow') def test_cromu_00070_caching(): # Test exploitation of CROMU_00070 given an input which causes a leak. Th...
mechaphish/colorguard
tests/test_cromu70_caching.py
Python
bsd-2-clause
1,245
from easyprocess import EasyProcess from entrypoint2 import entrypoint from pyvirtualdisplay.display import Display def extract_version(txt): """This function tries to extract the version from the help text""" words = txt.replace(",", " ").split() version = None for x in reversed(words): if le...
ponty/eagexp
eagexp/version.py
Python
bsd-2-clause
775
import sys if sys.version_info[0] == 2: from urlparse import urljoin string_types = basestring, else: from urllib.parse import urljoin string_types = str, def atoi(string, default=0): if (isinstance(string, int)): return string try: return int(string) except (TypeError, ...
ZipFile/papi.py
papi/helpers.py
Python
bsd-2-clause
356
############################################### # RabbitMQ in Action # Chapter 10 - RabbitMQ ping (HTTP API) check. ############################################### # # # Author: Jason J. W. Williams # (C)2011 ############################################### import sys, json, httplib, urllib, base64, socket #(apic.0)...
rabbitinaction/sourcecode
python/chapter-10/api_ping_check.py
Python
bsd-2-clause
1,459
""" Overlay Message Widget ---------------------- A Widget to display a temporary dismissable message over another widget. """ import sys import enum import functools import operator from collections import namedtuple from PyQt4.QtGui import ( QIcon, QHBoxLayout, QPushButton, QLabel, QSizePolicy, QStyle, QA...
qPCR4vir/orange3
Orange/widgets/utils/overlay.py
Python
bsd-2-clause
20,056
#!/usr/bin/env python """ @package mi.dataset.parser.test.test_mopak_o_dcl @file marine-integrations/mi/dataset/parser/test/test_mopak_o_dcl.py @author Emily Hahn @brief Test code for a mopak_o_dcl data parser """ import ntplib import struct import os from datetime import datetime import time from nose.pl...
ooici/marine-integrations
mi/dataset/parser/test/test_mopak_o_dcl.py
Python
bsd-2-clause
28,907
""" A symbol table object to hold types for the parser. """ from __future__ import absolute_import, division, print_function __all__ = ['TypeSymbolTable', 'sym'] import ctypes from . import coretypes as ct _is_64bit = (ctypes.sizeof(ctypes.c_void_p) == 8) def _complex(tp): """Simple temporary type constructor...
talumbau/datashape
datashape/type_symbol_table.py
Python
bsd-2-clause
4,644
############################################################################### # # 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_image51.py
Python
bsd-2-clause
978
from stacker.blueprints.base import Blueprint from troposphere import ( GetAtt, Output, Ref, Sub, iam, ) from awacs.aws import Policy from awacs.helpers.trust import ( get_default_assumerole_policy, get_lambda_assumerole_policy ) class Roles(Blueprint): VARIABLES = { "Ec2Role...
remind101/stacker_blueprints
stacker_blueprints/iam_roles.py
Python
bsd-2-clause
2,834
# Write Python code to print out how far light travels # in centimeters in one nanosecond. Use the variables # defined below. speed_of_light = 299792458 # meters per second meter = 100 # one meter is 100 centimeters nanosecond = 1.0/1000000000 # one billionth of a second print speed_of_light...
ezralalonde/cloaked-octo-sansa
01/qu/02.py
Python
bsd-2-clause
342
from surveygizmo.api import base class SurveyPage(base.Resource): resource_fmt_str = 'survey/%(survey_id)s/surveypage/%(page_id)s' resource_id_keys = ['survey_id', 'page_id'] def list(self, survey_id, **kwargs): kwargs.update({'survey_id': survey_id, }) return super(SurveyPage, self).lis...
ITNG/SurveyGizmo
surveygizmo/api/surveypage.py
Python
bsd-3-clause
1,235
#!/usr/local/bin/python # coding: UTF-8 # released under bsd licence # see LICENCE file or http://www.opensource.org/licenses/bsd-license.php for details # Institute of Applied Simulation (ZHAW) # Author Thomas Niederberger from mlscripts.text.utilities import * from mlscripts.text.word_desc import WordDesc ...
IAS-ZHAW/machine_learning_scripts
mlscripts/text/word_dict.py
Python
bsd-3-clause
1,906
""" SARIMAX Model Author: Chad Fulton License: Simplified-BSD """ from __future__ import division, absolute_import, print_function from statsmodels.compat.python import long from warnings import warn import numpy as np import pandas as pd from .kalman_filter import KalmanFilter from .mlemodel import MLEModel, MLERes...
bert9bert/statsmodels
statsmodels/tsa/statespace/sarimax.py
Python
bsd-3-clause
82,327
from datetime import timedelta from django.conf import settings from django.utils import timezone from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse from django.contrib.auth.decorators import user_passes_test from django.utils.importlib import import_module from djangae.core.pa...
potatolondon/centaur
views.py
Python
bsd-3-clause
4,150
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 0);
antoinecarme/pyaf
tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_30/ar_/test_artificial_1024_Anscombe_Lag1Trend_30__0.py
Python
bsd-3-clause
264
import os import sys try: import cPickle as _pickle except ImportError: import pickle as _pickle if sys.version_info[0] == 2: bytes = str pathjoin = os.path.join pathexists = os.path.exists expanduser = os.path.expanduser abspath = os.path.abspath dirname = os.path.dirname def pickle(value): return ...
gmflanagan/waterboy
waterboy/utils.py
Python
bsd-3-clause
941
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # Copyright (c) 2014, Roboterclub Aachen e.V. # All rights reserved. # # The file is part of the xpcc library and is released under the 3-clause BSD # license. See the file `LICENSE` for the full license governing this code. # ----------------------------------------------...
dergraaf/xpcc
tools/device_files/device_identifier.py
Python
bsd-3-clause
8,632
import sqlite3 def main(): conn = sqlite3.connect("../database") cursor = conn.cursor() # I claim this gives the current score. Another formulation is # select trackid, score, max(scoreid) from scores group by trackid; # cursor.execute("""select trackid, score from scores # gro...
erbridge/NQr
src/export.py
Python
bsd-3-clause
834
import itertools from collections import defaultdict from django.contrib.auth.models import User from django.core.management import BaseCommand from corehq.apps.es import FormES from corehq.apps.users.dbaccessors import ( get_all_user_id_username_pairs_by_domain, ) from corehq.apps.users.models import CommCareUse...
dimagi/commcare-hq
corehq/apps/cleanup/management/commands/delete_duplicate_users.py
Python
bsd-3-clause
4,468
from unittest.mock import MagicMock, Mock import pytest from saleor.product.models import ( Attribute, AttributeValue, Product, ProductType) from saleor.product.tasks import _update_variants_names from saleor.product.utils.attributes import ( generate_name_from_values, get_attributes_display_map, get_name...
UITools/saleor
tests/test_product_attributes.py
Python
bsd-3-clause
3,339
from TASSELpy.utils.helper import make_sig from TASSELpy.utils.Overloading import javaOverload, javaConstructorOverload, javaGenericOverload from TASSELpy.java.util.Queue import Queue from TASSELpy.java.lang.Object import Object from TASSELpy.java.util.Iterator import Iterator java_imports = {'Deque':'java/lang/Deque'...
er432/TASSELpy
TASSELpy/java/util/Deque.py
Python
bsd-3-clause
11,930
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Album' db.create_table(u'chet_album', ( (u'id...
matthiask/django-chet
chet/south_migrations/0001_initial.py
Python
bsd-3-clause
4,095
from plone.app.dexterity.behaviors.metadata import ICategorization from plone.behavior.interfaces import IBehavior from stubydoo import double from stubydoo import stub from tn.plonebehavior.template import AssociatedTemplateCompilation from tn.plonebehavior.template import interfaces from tn.plonebehavior.template imp...
tecnologiaenegocios/tn.plonebehavior.template
src/tn/plonebehavior/template/tests/test_template.py
Python
bsd-3-clause
14,717
from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponse, Http404 from django.template import RequestContext from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from models import Story from places.models import Place from places.views import InOtherPl...
MAPC/masshealth
datastories/views.py
Python
bsd-3-clause
2,304
from django.utils.translation import ugettext as _ from memoized import memoized from corehq.apps.locations.permissions import location_safe from .users import EmwfUtils, ExpandedMobileWorkerFilter class CaseListFilterUtils(EmwfUtils): def sharing_group_tuple(self, g): return ("sg__%s" % g['_id'], '%s...
dimagi/commcare-hq
corehq/apps/reports/filters/case_list.py
Python
bsd-3-clause
3,153
"""Setup script of zinnia-twitter""" from setuptools import setup from setuptools import find_packages import zinnia_twitter setup( name='zinnia-twitter', version=zinnia_twitter.__version__, description='Twitter plugin for django-blog-zinnia', long_description=open('README.rst').read(), keywords...
django-blog-zinnia/zinnia-twitter
setup.py
Python
bsd-3-clause
1,097
#======================================================================= __version__ = '''0.0.01''' __sub_version__ = '''20070108034250''' __copyright__ = '''(c) Alex A. Naanou 2003''' #----------------------------------------------------------------------- import pli.pattern.mixin.mapping as mapping #-----------...
flynx/pli
pli/persistance/sql/shelve.py
Python
bsd-3-clause
2,359
from django.urls import path from wagtail.contrib.forms.views import ( DeleteSubmissionsView, FormPagesListView, get_submissions_list_view) app_name = 'wagtailforms' urlpatterns = [ path('', FormPagesListView.as_view(), name='index'), path('submissions/<int:page_id>/', get_submissions_list_view, name='lis...
takeflight/wagtail
wagtail/contrib/forms/urls.py
Python
bsd-3-clause
445
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pcapcffi ---------------------------------- Tests for `pcapcffi` module. """ import pytest import pcapcffi from pcapcffi.wrappers import PcapError def test_findalldevs(): devs = pcapcffi.wrappers.pcap_findalldevs() assert devs def test_pcap(): p...
GertBurger/pcapcffi
tests/test_pcapcffi.py
Python
bsd-3-clause
542
#!/usr/bin/env python """ refguide_check.py [OPTIONS] [-- ARGS] Check for a Scipy submodule whether the objects in its __all__ dict correspond to the objects included in the reference guide. Example of usage:: $ python refguide_check.py optimize Note that this is a helper script to be able to check if things ar...
e-q/scipy
tools/refguide_check.py
Python
bsd-3-clause
32,497
from django import forms from .models import Location from .widgets import CoordinatesWidget class LocationForm(forms.ModelForm): class Meta: model = Location fields = '__all__' widgets = { 'coordinates': CoordinatesWidget(), }
mishbahr/djangocms-gmaps
djangocms_gmaps/forms.py
Python
bsd-3-clause
280
#+ # # This file is part of h5py, a low-level Python interface to the HDF5 library. # # Copyright (C) 2008 Andrew Collette # http://h5py.alfven.org # License: BSD (See LICENSE.txt for full license) # # $Date$ # #- from h5py import tests from h5py import * class TestBasic(tests.HTest): def setUp(self): ...
qsnake/h5py
h5py/tests/low/test_h5r.py
Python
bsd-3-clause
1,721
from edge import DummyEdgeEnd from simulation_event import AbstractSimulationEvent from stats import TripStats class AbstractAntMove(AbstractSimulationEvent): def __init__(self, ant, origin, destination, end_time, pheromone_to_drop, trip_stats): self.ant = ant self.origin = origin self.dest...
ppolewicz/ant-colony
antcolony/ant_move.py
Python
bsd-3-clause
3,648
from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db import connection from django.db.models import Prefetch from django.db.models.query import get_prefetcher from django.test import TestCase, override_se...
52ai/django-ccsds
tests/prefetch_related/tests.py
Python
bsd-3-clause
51,773
from couchdbkit import ResourceNotFound from toggle.models import Toggle from toggle.shortcuts import update_toggle_cache, parse_toggle def move_toggles(from_toggle_id, to_toggle_id): """ Moves all enabled items from one toggle to another. """ try: from_toggle = Toggle.get(from_toggle_id) ...
qedsoftware/commcare-hq
corehq/apps/toggle_ui/migration_helpers.py
Python
bsd-3-clause
868
import markdown from django.shortcuts import render_to_response, get_object_or_404, HttpResponse, HttpResponseRedirect, Http404 from django.template import RequestContext from django.contrib.auth.decorators import login_required from django.contrib import messages from django.views.decorators.csrf import csrf_exempt ...
Kami/munin_exchange
munin_exchange/apps/core/views.py
Python
bsd-3-clause
1,990
""" Functions for creating XML output. """ import logging import string from xml_signing import get_signature_xml from xml_templates import AUTHN_REQUEST def _get_authnrequest_xml(template, parameters, signed=False): # Reset signature. params = {} params.update(parameters) params['AUTHN_REQUEST_SIGNATU...
unomena/django-saml2-sp
saml2sp/xml_render.py
Python
bsd-3-clause
899
import subprocess class CmdArgument(object): _PREFIX = None _KEY = None def __init__(self, value): self._value = value @property def value(self): return self._value @property def prefix(self): return self._PREFIX @property def key(self): return s...
oopsno/arena
src/arena/cmd.py
Python
bsd-3-clause
1,864
""" Models for representing top-level plot objects. """ from __future__ import absolute_import from six import string_types from ..enums import Location from ..mixins import LineProps, TextProps from ..plot_object import PlotObject from ..properties import Bool, Int, String, Color, Enum, Auto, Instance, Either, List...
birdsarah/bokeh
bokeh/models/plots.py
Python
bsd-3-clause
15,281
"""Form classes.""" from .errors import ValidationError from .meta import FormBuilder from .types import FormType, ListType, SetType, DictType from .utils import Struct class Form(object): """A form.""" __metaclass__ = FormBuilder @classmethod def from_obj(cls, obj): """ Return a form...
WiFast/bearform
bearform/form.py
Python
bsd-3-clause
5,451
#!/usr/bin/env python # -*- coding: utf-8 -*- # # gnpy documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autoge...
Telecominfraproject/Physical_Simulation_Environment
docs/conf.py
Python
bsd-3-clause
8,356
# -*- coding:utf-8 -*- ''' Created on 2013-3-6 @author: corleone 统计标准 ''' from scrapy.spider import BaseSpider class Tjbz_Spider(BaseSpider): name = "nbsc" url = "http://www.stats.gov.cn/tjbz/" start_urls = [ "http://www.stats.gov.cn/tjbz/", # 2002-12-31 ]
535521469/crawler_sth
scrapy/nbsc/spiders/tjbz_spider.py
Python
bsd-3-clause
311
from __future__ import unicode_literals from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.comments.models import Comment from django.utils.translation import ugettext_lazy as _, ungettext from django.contrib.comments import get_model from django.contrib.comments.views....
gminds/rapidnewsng
django/contrib/comments/admin.py
Python
bsd-3-clause
3,681
import matplotlib.pyplot as plt def plot_birds(simulation, plot_velocity=False): width = simulation.configuration.location.width height = simulation.configuration.location.height pop = simulation.get_population() plt.figure(figsize=[12, 12]) plt.scatter(pop.x, pop.y, color=pop.color) if plot_...
ihmeuw/vivarium
src/vivarium/examples/boids/visualization.py
Python
bsd-3-clause
500
import numpy as np def Initial_diag(dim): conv=np.diag(np.random.rand(dim)) return conv def Convergence(matrix): delta=(np.abs(matrix).max(axis=0)).max(axis=0) return delta def Train(trainingset,label): (imagenum,dim)=trainingset.shape #Each column vector stands for a image. dataset=np.transpose(trainingset) ...
cherishing78/BSVer
Yintest/noloop.py
Python
bsd-3-clause
3,693