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 |
|---|---|---|---|---|---|
import json
import os
import shutil
import datetime
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
try:
import subprocess32 as subprocess
except ImportError:
import subprocess
try:
from os import scandir, walk
except ImportError:
from scandir import s... | dougbenjamin/panda-harvester | pandaharvester/harvestermessenger/shared_file_messenger.py | Python | apache-2.0 | 35,562 |
from builtins import str
from sqlalchemy import func, sql
from sqlalchemy.orm import validates
from .base import FileLinkMixin, ApiResource
from pmg import db
class Post(ApiResource, db.Model):
__tablename__ = "post"
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String, nullable=Fal... | Code4SA/pmg-cms-2 | pmg/models/posts.py | Python | apache-2.0 | 2,048 |
# Copyright 2013 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/appengine_xblock_runtime | appengine_xblock_runtime/store.py | Python | apache-2.0 | 4,101 |
# Copyright 2018 Politecnico di Torino
#
# 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... | shield-h2020/dare-sec-topo | cybertop/vnsfo.py | Python | apache-2.0 | 1,650 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from ggrc import db
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import validates
from .categorization import Categorization
from .mixins import deferred, Base, Hierarch... | NejcZupec/ggrc-core | src/ggrc/models/category.py | Python | apache-2.0 | 1,823 |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.cbook as cbook
# load up some sample financial data
datafile = cbook.get_sample_data('goog.npy')
r = np.load(datafile).view(np.recarray)
# create two subplots with the shared x and y axes
fig, (ax1, ax2) = plt.subplots(1,2, sharex=True, sharey=True... | leesavide/pythonista-docs | Documentation/matplotlib/users/recipes-4.py | Python | apache-2.0 | 653 |
import requests
import math
import re
from bs4 import BeautifulSoup
ROOT_URL = "http://nces.ed.gov/collegenavigator"
INDEX_URL = ROOT_URL + "?s=all&l=93&ct=1&ic=1&an=5&ax=50"
PAGINATION_DIV_ID = "ctl00_cphCollegeNavBody_ucResultsMain_divMsg"
def get_num_pages(pagination):
"""Returns the total number of pages given p... | vivhou/Python-coursework-files | final project data analysis/webscraping scripts/public_school_tuition_data.py | Python | artistic-2.0 | 2,976 |
from rest_framework import (
serializers,
viewsets,
)
from rest_framework.decorators import api_view
from rest_framework.response import Response
from .models import Author, Book
class BookSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Book
fields = (
... | rockymeza/django-local-requests | tests/views.py | Python | bsd-2-clause | 1,217 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
"""Client GUI to control youBot robot."""
import Tkinter as tk
import ttk
import tkMessageBox
import rospyoubot
from math import radians, degrees
class MainApplication(ttk.Frame):
u"""Основное окно приложения."""
def __init__(self, parent, *args, **kwargs):
... | kirillmorozov/youbot_control | scripts/client_gui.py | Python | bsd-2-clause | 32,532 |
# Scraper for Pennsylvania Supreme Court
# CourtID: pasup
# Court Short Name: pasup
# Author: Andrei Chelaru
# Reviewer: mlr
# Date created: 21 July 2014
from juriscraper.opinions.united_states.state import pa
import re
class Site(pa.Site):
def __init__(self):
super(Site, self).__init__()
self.c... | brianwc/juriscraper | opinions/united_states/state/pasuperct.py | Python | bsd-2-clause | 590 |
from flask_assets import Bundle
common_css = Bundle(
'css/vendor/bootstrap.min.css',
'css/vendor/helper.css',
'selectize/dist/css/selectize.bootstrap3.css',
# 'css/main.css',
filters='cssmin',
output='public/css/common.css'
)
common_js = Bundle(
'js/vendor/jquery.min.js',
'js/vendor/bo... | ahmadpriatama/Flask-Simple-Ecommerce | appname/assets.py | Python | bsd-2-clause | 490 |
#!/usr/local/bin/python3
"""
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain th... | opnsense/core | src/opnsense/scripts/filter/list_tables.py | Python | bsd-2-clause | 1,992 |
#!/usr/bin/env python
import os, sys
import re
import pickle
import numpy as np
import copy
from scipy import interpolate
import scipy.sparse
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib import pyplot as plt
import matplotlib
from matplotlib import pyplot as plt
############################
cl... | bdilday/nflMarkov | nflMarkov.py | Python | bsd-2-clause | 59,379 |
#whitespace-length codec
def enc(fn):
f = open(fn, "rb")
r = f.read()
f.close()
s = []
for c in r:
s += [ " " * (ord(c) + 1)] # +1 to avoid stupid extra lines by outlook
w = open(fn + ".enc", "wt")
w.write("\n".join(s))
w.close()
def dec(fn):
f = open(fn, "... | angea/corkami | misc/challenges/codecs/whitespace.py | Python | bsd-2-clause | 495 |
import matplotlib
from kid_readout.roach import baseband
matplotlib.use('agg')
import numpy as np
import time
import sys
from kid_readout.utils import data_file,sweeps
from kid_readout.analysis.resonator.legacy_resonator import fit_best_resonator
ri = baseband.RoachBaseband()
ri.initialize()
#ri.set_fft_gain(6)
#f0s... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/old_scripts/highq_power_sweep_downstairs.py | Python | bsd-2-clause | 6,148 |
from copy import deepcopy
import h5py
import numpy as np
import pytest
import six
from ...util.functions import virtual_file
from .. import (CartesianGrid,
CylindricalPolarGrid,
SphericalPolarGrid,
AMRGrid,
OctreeGrid)
ALL_GRID_TYPES = ['car', 'sph', 'c... | hyperion-rt/hyperion | hyperion/grid/tests/test_io.py | Python | bsd-2-clause | 6,744 |
import json
from plugins import gateway_speaker
from plugins.magnet import MAGNET_STORE_KEY
DOOR_SENSOR_SID = '158d0001837ec2'
def run(store, conn, cursor):
"""Play sound on the Gateway when somebody opens the door"""
p = store.pubsub(ignore_subscribe_messages=True)
p.subscribe(MAGNET_STORE_KEY)
fo... | aluminiumgeek/goodbye-mihome | apps/sound_when_door_is_open.py | Python | bsd-2-clause | 608 |
""" Web runtime based on a common browser
Opens browser via webbrowser module.
"""
import webbrowser
from . import logger
from .common import BaseRuntime
BROWSER_MAP = {'chrome': ['google-chrome', 'chrome',
'chromium-browser', 'chromium'],
'chromium': ['chromium-browser', ... | JohnLunzer/flexx | flexx/webruntime/browser.py | Python | bsd-2-clause | 2,780 |
"""
Generates some prediction plots for the Herschel I paper.
:author: Sami-Matias Niemi
:contact: sammy@sammyniemi.com
:version: 0.5
"""
import matplotlib
matplotlib.use('PS')
#matplotlib.use('Agg')
matplotlib.rc('text', usetex=True)
matplotlib.rcParams['font.size'] = 17
matplotlib.rc('xtick', labelsize=14)
matplotl... | sniemi/SamPy | herschel/plotmergers3.py | Python | bsd-2-clause | 24,711 |
# Django settings for tests project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'tests/da... | wodo/django-ct | tests/settings.py | Python | bsd-2-clause | 5,129 |
#!/usr/bin/env python
# Calder Phillips-Grafflin - WPI/ARC Lab
import rospy
import math
import tf
from tf.transformations import *
from visualization_msgs.msg import *
from geometry_msgs.msg import *
class RobotMarkerPublisher:
def __init__(self, root_frame, rate):
self.root_frame = root_frame
... | WPI-ARC/deformable_planners | deformable_astar/src/deformable_astar/robot_marker_debug_pub.py | Python | bsd-2-clause | 2,259 |
#!/usr/bin/python3
from lib.Element import *
from lib.Page import *
from lib.Site import *
import random
import shutil
import pprint
random.seed()
def makeChoice():
print( '\nSelect a lib to check: ' )
print( ' (1) Element.py' )
print( ' (2) Page.py' )
print( ' (3) Site.py' )
print( ' (e) Exit test.py' )... | ayypot/dillys-place | test.py | Python | bsd-2-clause | 3,208 |
'''
test minimum program size with different optimizations
'''
from pyavrutils import AvrGcc
from entrypoint2 import entrypoint
cc = AvrGcc()
code = 'int main(){}'
def test():
print ' compiler option:', ' '.join(cc.options_generated())
cc.build(code)
print ' program size =', cc.size().program_byte... | ponty/pyavrutils | pyavrutils/examples/simple.py | Python | bsd-2-clause | 589 |
# In this example, we duplicate the Rosenbrock example while demonstrating
# some of the more advanced API features such as custom vector spaces,
# messaging objects, and restarts.
import Optizelle
import sys
import copy
import array
import math
import functools
#---VectorSpace0---
# Defines the vector space used for... | OptimoJoe/Optizelle | src/examples/rosenbrock_advanced_api/rosenbrock_advanced_api.py | Python | bsd-2-clause | 6,736 |
# -*- coding: UTF-8 -*-
from collections import defaultdict
from decimal import Decimal
from django import forms
from django import http
from django.conf import settings
from django.conf.urls import url, patterns
from django.contrib import admin
from django.core import urlresolvers
from django.db.models import Q
from d... | barrachri/epcon | p3/admin.py | Python | bsd-2-clause | 27,045 |
"""SCons.Tool.ifl
Tool-specific initialization for the Intel Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 200... | kerwinxu/barcodeManager | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/ifl.py | Python | bsd-2-clause | 2,880 |
from JumpScale import j
import JumpScale.grid.gevent
import JumpScale.baselib.key_value_store
import JumpScale.baselib.serializers
from .ZDaemonFactory import ZDaemonFactory
j.base.loader.makeAvailable(j, 'core')
j.core.zdaemon = ZDaemonFactory()
j.base.loader.makeAvailable(j, 'servers')
j.servers.zdaemon = ZDaemon... | Jumpscale/jumpscale6_core | lib/JumpScale/grid/zdaemon/__init__.py | Python | bsd-2-clause | 330 |
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.conf import settings
from mc2.controllers.base.views import ControllerCreateView, ControllerEditView
from mc2.views import HomepageView
from mc2.organizations.models import Organization
from mc2.organizations.utils import ac... | praekeltfoundation/mc2-freebasics | freebasics/views.py | Python | bsd-2-clause | 2,964 |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
def dist(a, b=None):
if b is None:
# assume 'a' is a pair
assert len(a) == 2
b = a[1]
a = a[0]
ax, ay = a
bx, by = b
return np.sqrt((ax -... | oliverlee/antlia | python/antlia/dtc.py | Python | bsd-2-clause | 2,572 |
from ..backends import Backend
from ..errors import CLEError
import logging
import os
l = logging.getLogger("cle.blob")
__all__ = ('Blob',)
class Blob(Backend):
"""
Representation of a binary blob, i.e. an executable in an unknown file format.
"""
def __init__(self, path, custom_arch=None, custom_of... | chubbymaggie/cle | cle/backends/blob.py | Python | bsd-2-clause | 2,119 |
"""
@package mi.dataset.driver.ctdpf_ckl.mmp_cds.driver
@file marine-integrations/mi/dataset/driver/ctdpf_ckl/mmp_cds/driver.py
@author Mark Worden
@brief Driver for the CtdpfCklMmpCds
Release notes:
initial release
"""
__author__ = 'Mark Worden'
__license__ = 'Apache 2.0'
from mi.core.log import get_logger
log = g... | ooici/marine-integrations | mi/dataset/driver/ctdpf_ckl/mmp_cds/driver.py | Python | bsd-2-clause | 2,429 |
__author__ = 'mworden'
from mi.core.log import get_logger
log = get_logger()
from mi.idk.config import Config
import unittest
import os
from mi.dataset.driver.ctdmo_ghqr.sio.ctdmo_ghqr_sio_co_recovered_driver import parse
from mi.dataset.dataset_driver import ParticleDataHandler
class SampleTest(unittest.TestCas... | JeffRoy/mi-dataset | mi/dataset/driver/ctdmo_ghqr/sio/test/test_ctdmo_ghqr_sio_co_recovered_driver.py | Python | bsd-2-clause | 1,101 |
import unittest
from sdklib.compat import cookies
from sdklib.http.session import Cookie
class TestSession(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.cookie = Cookie({"Set-Cookie": "chips=ahoy; vienna=finger"})
def test_as_cookie_header_value(self):
res = self.cookie.as_c... | ivanprjcts/sdklib | tests/test_session.py | Python | bsd-2-clause | 1,479 |
"""
Defines task classes that can compile, link etc..
Task can depend upon one another.
These task are wrappers around the functions provided in the buildfunctions
module
"""
from .tasks import Task, TaskError, register_task
from ..utils.reporting import HtmlReportGenerator, DummyReportGenerator
from .. import api
fr... | windelbouwman/ppci-mirror | ppci/build/buildtasks.py | Python | bsd-2-clause | 7,591 |
import os
import shutil
import logging
import csv
from dateutil import parser
from django.dispatch import receiver
from hs_core.signals import pre_create_resource, pre_add_files_to_resource, \
pre_delete_file_from_resource, post_add_files_to_resource, post_create_resource, \
pre_metadata_element_create, pre_m... | hydroshare/hydroshare | hs_app_timeseries/receivers.py | Python | bsd-3-clause | 16,631 |
"""
WSGI config for wagtailsaleor project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wagtailsaleor.settings")
from d... | mirumee/wagtail-saleor | wagtailsaleor/wagtailsaleor/wsgi.py | Python | bsd-3-clause | 401 |
from m5.params import *
from m5.SimObject import SimObject
from Controller import RubyController
class DMA_Controller(RubyController):
type = 'DMA_Controller'
dma_sequencer = Param.DMASequencer("")
request_latency = Param.Int(6, "")
| silkyar/570_Big_Little | build/ARM/mem/protocol/DMA_Controller.py | Python | bsd-3-clause | 246 |
# -*- coding: utf-8 -*-
"""
celery.backends.base
~~~~~~~~~~~~~~~~~~~~
Result backend base classes.
- :class:`BaseBackend` defines the interface.
- :class:`KeyValueStoreBackend` is a common base class
using K/V semantics like _get and _put.
"""
from __future__ import absolute_import
import... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/celery/backends/base.py | Python | bsd-3-clause | 19,323 |
def extractStealtranslationHomeBlog(item):
'''
Parser for 'stealtranslation.home.blog'
'''
return None | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractStealtranslationHomeBlog.py | Python | bsd-3-clause | 108 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBioMed source tree.
"""
This ... | gadsbyfly/PyBioMed | PyBioMed/PyProtein/PyProteinAAIndex.py | Python | bsd-3-clause | 9,731 |
# Copyright (c) 2015,Vienna University of Technology,
# Department of Geodesy and Geoinformation
# All rights reserved.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND F... | TUW-GEO/SMDC-performance | smdc_perftests/datasets/ascat.py | Python | bsd-3-clause | 9,343 |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""Full text search query against the shopping search API"""
import pprint
from apiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
DEVELOPER_KEY = 'AIzaSyACZJW4JwcWwz5taR2gjIMNQrtgDLfILPc'
def main():
"""... | MapofLife/MOL | earthengine/google-api-python-client/samples/searchforshopping/fulltextsearch.py | Python | bsd-3-clause | 1,222 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-11 06:20
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | SalesforceFoundation/mrbelvedereci | metaci/notification/migrations/0001_initial.py | Python | bsd-3-clause | 3,530 |
'''
SuffixTree - A Ternary Search Trie
Author: Tim Henderson
Contact: tim.tadh@hackthology.com or timothy.henderson@case.edu
This File: Tests for the SuffixTree.
Copyright (c) 2010, Tim Henderson
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provi... | timtadh/tst | tst/t_suffix.py | Python | bsd-3-clause | 11,460 |
import inspect
from IPython.utils.traitlets import (
Any,
CInt,
CBool,
CFloat,
Dict,
Tuple,
link,
)
from IPython.html.widgets import Widget
from IPython.html.widgets.widget_selection import _Selection
from .widgets import Tangle
__all__ = ["Tangle", "tangle"]
function = type(lambda: 0)... | bollwyvl/ipytangle | ipytangle/__init__.py | Python | bsd-3-clause | 5,335 |
# Copyright the Karmabot authors and contributors.
# All rights reserved. See AUTHORS.
#
# This file is part of 'karmabot' and is distributed under the BSD license.
# See LICENSE for more details.
# dedicated to LC
from json import JSONDecoder
from urllib import urlencode
from urllib2 import urlopen
from karmabot.co... | chromakode/karmabot | karmabot/extensions/lmgtfy.py | Python | bsd-3-clause | 2,423 |
# -*- coding: utf-8 -*-
import mimetypes
import os
from datetime import datetime, timedelta
from urlparse import urljoin
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import encoding
import jingo
import test_utils
from mock import Mock, patch
from nos... | clouserw/olympia | apps/amo/tests/test_helpers.py | Python | bsd-3-clause | 15,825 |
"""Code for CLI base"""
import logging
import pathlib
import click
import coloredlogs
import yaml
from flask.cli import FlaskGroup, with_appcontext
# General, logging
from scout import __version__
from scout.commands.convert import convert
from scout.commands.delete import delete
from scout.commands.download import d... | Clinical-Genomics/scout | scout/commands/base.py | Python | bsd-3-clause | 4,404 |
import numpy as np
import pytest
from pandas import DataFrame, NaT, compat, date_range
import pandas.util.testing as tm
@pytest.fixture
def float_frame():
"""
Fixture for DataFrame of floats with index of unique strings
Columns are ['A', 'B', 'C', 'D'].
"""
return DataFrame(tm.getSeriesData())
... | MJuddBooth/pandas | pandas/tests/frame/conftest.py | Python | bsd-3-clause | 4,171 |
# -*- coding: utf-8 -*-
'''Public section, including homepage and signup.'''
from flask import (
Blueprint, request, render_template, flash, url_for,
redirect, session
)
from flask.ext.login import login_user, login_required, logout_user
from clearstate.extensions import login_manager
from clearstate.user.mode... | sharoonthomas/clearstate | clearstate/public/views.py | Python | bsd-3-clause | 2,490 |
# -*- coding: utf-8 -
#
# This file is part of socketpool.
# See the NOTICE for more information.
import eventlet
from eventlet.green import select
from eventlet.green import socket
from eventlet import queue
from socketpool.pool import ConnectionPool
sleep = eventlet.sleep
Socket = socket.socket
Select = select.sel... | emidln/django_roa | env/lib/python2.7/site-packages/socketpool/backend_eventlet.py | Python | bsd-3-clause | 1,213 |
from __future__ import print_function
from BinPy import *
print ('Usage of IC 4002:\n')
ic = IC_4002()
print ('\nThe Pin configuration is:\n')
input = {2: 0, 3: 0, 4: 0, 5: 0, 7: 0, 9: 1, 10: 1, 11: 1, 12: 1, 14: 1}
print (input)
print ('\nPin initinalization\n')
print ('\nPowering up the IC - using -- ic.setIC({14: 1,... | coder006/BinPy | BinPy/examples/ic/Series_4000/IC4002.py | Python | bsd-3-clause | 1,102 |
from tests.utils import should_throw
from tests.utils.registry import register
from wallace.config import App, get_app, get_connection
from wallace.config import GetApp, GetDBConn, GetParameter
from wallace.errors import ConfigError
@register
def test_get_app():
app = App()
class Test(object):
app =... | csira/wallace | tests/cases/config/decos.py | Python | bsd-3-clause | 1,193 |
# -*- coding: utf8 -*-
from mock import patch, MagicMock
from default import with_context, Test
from pybossa.model.task_run import TaskRun
from factories import TaskRunFactory
from sqlalchemy import event
from libcrowds_statistics import event_listeners
class TestEventListener(Test):
def setUp(self):
se... | LibCrowds/libcrowds-statistics | tests/test_event_listeners.py | Python | bsd-3-clause | 1,768 |
import os
import json
import click
def generate_graph(similarity_file, threshold=85):
edges = dict()
hosts_used = set()
with open(similarity_file, 'r') as json_file:
scores = json.load(json_file)
score_dict = {s['similarity']: (s['path1'], s['path2']) for s in scores}
for score, paths i... | matiskay/html-cluster | html_cluster/commands/make_graph.py | Python | bsd-3-clause | 1,507 |
"""
The configuration files are searched for in the following order:
1. Local directory
2. Users home directory
3. Users app directory
4. System app directory
The file searched for is called .credrc for 1. and 2., and without the dot
for 3. and 4.. If none are found, it will use the default configurati... | Tehnix/cred-server | cred/config.py | Python | bsd-3-clause | 2,169 |
#!/usr/bin/python2.4
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for grit.gather.tr_html'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.di... | paul99/clank | tools/grit/grit/gather/tr_html_unittest.py | Python | bsd-3-clause | 17,175 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vispy: gallery 30
# -----------------------------------------------------------------------------
# Copyright (c) 2015, California Institute of Technology.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ----------------------------------------... | stargaser/spscviz | spscinspector.py | Python | bsd-3-clause | 15,570 |
from django import template
register = template.Library()
@register.filter
def value(value, key):
return value[key]
| niekas/Hack4LT | src/hack4lt/templatetags/utils.py | Python | bsd-3-clause | 123 |
"""Defines GLWidgetPlugin, GLMultiViewportProgram, and CachedGLObject, which
are used by the core visualization module. They may be useful for writing
your own GLPluginInterface classes, too.
"""
from glinterface import GLPluginInterface
from glprogram import GLProgram,GLPluginProgram
import math
from OpenGL.GL impo... | krishauser/Klampt | Python/python2_version/klampt/vis/glcommon.py | Python | bsd-3-clause | 15,541 |
from __future__ import print_function
from permstruct import RuleSet
from .functions import populate_rule_set
from permstruct.dag import DAG
from permuta.misc import ProgressBar
import sys
def exhaustive(settings):
for k,v in enumerate(settings.sets):
settings.logger.log(repr(tuple([k,v.description if v ... | PermutaTriangle/PermStruct | permstruct/exhaustive.py | Python | bsd-3-clause | 1,013 |
# The contents of this file are automatically written by
# tools/generate_schema_wrapper.py. Do not modify directly.
from . import core
import pandas as pd
from altair.utils.schemapi import Undefined
from altair.utils import parse_shorthand
class FieldChannelMixin(object):
def to_dict(self, validate=True, ignore... | altair-viz/altair | altair/vegalite/v3/schema/channels.py | Python | bsd-3-clause | 263,403 |
from django.contrib.admin.widgets import AdminFileWidget
from django.utils.safestring import mark_safe
class AdminImagePreviewWidget(AdminFileWidget):
"""
An admin widget that shows a preview of currently selected image.
"""
def __init__(self, attrs=None, storage=None):
super(AdminImagePrevie... | madisona/django-image-helper | image_helper/widgets.py | Python | bsd-3-clause | 858 |
from app_loader import app_loader
urlpatterns = app_loader.urlpatterns
| michaelkuty/python-app-loader | tests/testapp1/urls.py | Python | bsd-3-clause | 73 |
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, 'home.djhtml', {}) | bharling/django-gevent-socketio | django_socketio_tests/views.py | Python | bsd-3-clause | 127 |
"""The pyvalid is the Python validation tool for checking a function's input parameters
and return values.
Purposes of the pyvalid package:
#. Provide an ability to validate a user input (such as usernames, phone numbers,
emails, dates and times, etc) and minimize the amount of code required for the
implementat... | uzumaxy/pyvalid | pyvalid/__init__.py | Python | bsd-3-clause | 1,170 |
"""
Testing Recursive feature elimination
"""
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_equal
from scipy import sparse
from sklearn.feature_selection.rfe import RFE, RFECV
from sklearn.datasets import load_iris
from sklear... | Eric89GXL/scikit-learn | sklearn/feature_selection/tests/test_rfe.py | Python | bsd-3-clause | 3,356 |
from fanstatic import Library, Resource
import js.jquery
import js.jqueryui
library = Library('dynatree', 'resources')
dynatree_css = Resource(library, 'src/skin-vista/ui.dynatree.css')
dynatree = Resource(library, 'src/jquery.dynatree.js',
minified='src/jquery.dynatree.min.js',
depends=[dynatree_css,... | lugensa/js.dynatree | js/dynatree/__init__.py | Python | bsd-3-clause | 362 |
"""
Organizations.
"""
from __future__ import absolute_import
from . import base
from . import links
class Org(links.LinkedResource):
def __repr__(self):
return "<Org: %s>" % self.name
class OrgManager(base.Manager):
resource_class = Org
def all(self):
"""
Get a list of ... | jacobian-archive/python-storymarket | storymarket/orgs.py | Python | bsd-3-clause | 658 |
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | koparasy/faultinjection-gem5 | src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py | Python | bsd-3-clause | 3,156 |
"""
A Tkinter based backend for piddle.
Perry A. Stoll
Created: February 15, 1999
Requires PIL for rotated string support.
Known Problems:
- Doesn't handle the interactive commands yet.
- PIL based canvas inherits lack of underlining strings from piddlePIL
You can find the latest version ... | rvianello/rdkit | rdkit/sping/TK/pidTK.py | Python | bsd-3-clause | 16,537 |
from django.utils.timezone import now, timedelta
from django.test import TestCase
from django.contrib.auth.models import User
from todo_lists.models import (
ToDoList,
ToDoContext,
ToDo,
ToDoAlert,
)
class ToDoModelsTestCase(TestCase):
def setUp(self):
user1 = User(username="user1", first_... | pawartur/django-todo-lists | todo_lists/tests/model_tests.py | Python | bsd-3-clause | 3,581 |
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "NNO"
addresses_name = "2021-03-25T13:58:54.180597/Democracy_Club__06May2021.CSV"
stations_name = "2021-03-25T13:58:54.180597/Democracy_Club__06May2021.CSV"
... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_north_norfolk.py | Python | bsd-3-clause | 1,890 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def myConcat(L):
ret=str()
for x in L:
ret+=x
return ret
list=['I ', 'have ', 'a ', 'pen.']
print myConcat(list)
| RyodoTanaka/Coding_The_Matrix | python/chap_1/1.7.7.py | Python | bsd-3-clause | 181 |
"""
This is used to make star field backgrounds.
"""
import sys, random, pygame, glob, fnmatch
from pygame.locals import *
# star colors
# spectral type R G B
SPECTRA = { 'O': (225,225,255), \
'B': (225,255,255), \
'A': (255,255,255), \
'F': (255,255,225), \
'G': (255,255,200), \
'K': (25... | bobgeis/LookOutSpacePirates | starMaker.py | Python | bsd-3-clause | 1,541 |
# coding: utf-8
"""
Helpful utilities.
"""
__all__ = [
"ROOT_DEFAULT", "typed", "make_list", "multi_match", "flatten", "to_root_latex",
"join_root_selection", "join_numexpr_selection", "class_id", "args_to_kwargs", "DotAccessProxy",
]
import os
import functools
import types
import re
import fnmatch
import ... | riga/order | order/util.py | Python | bsd-3-clause | 11,655 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import time
from metrics import smoothness
from telemetry.page import page_measurement
class StatsCollector(object):
def __init__(self, timeline):
... | mogoweb/chromium-crosswalk | tools/perf/measurements/rasterize_and_record.py | Python | bsd-3-clause | 7,809 |
# -*- coding: utf-8 -*-
"""
##########
# Fields #
##########
Each Field class does some sort of validation. Each Field has a clean() method,
which either raises django.forms.ValidationError or returns the "clean"
data -- usually a Unicode object, but, in some rare cases, a list.
Each Field's __init__() takes at least... | digimarc/django | tests/forms_tests/tests/test_fields.py | Python | bsd-3-clause | 83,991 |
import sys
import bottle
import commands
import datetime
from bottle import route, send_file, template
start_time = datetime.datetime.now()
@route('/')
def index():
bottle.TEMPLATES.clear() # For rapid development
return template("index", start_time = start_time)
@route('/framework/:id#[0-9-]*#')
def framewor... | benh/twesos | src/webui/master/webui.py | Python | bsd-3-clause | 1,208 |
import fnmatch
from django.db import models
from django.utils.translation import gettext_lazy as _
from admin_sso import settings
class AssignmentManager(models.Manager):
def for_email(self, email):
try:
username, domain = email.split("@")
except (AttributeError, TypeError, ValueErro... | matthiask/django-admin-sso | admin_sso/models.py | Python | bsd-3-clause | 1,936 |
import os
from importlib import import_module
import numpy
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import transaction
from netCDF4 import Dataset
from rasterio.dtypes import is_ndarray
from shapely.geometry import shape
from trefoil.netcdf.crs import set_... | consbio/ncdjango | ncdjango/geoprocessing/utils.py | Python | bsd-3-clause | 6,036 |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil import types
from coremltools.converters.mil.mil.types import bui... | apple/coremltools | coremltools/converters/mil/mil/var.py | Python | bsd-3-clause | 8,592 |
import hashlib
import os
import zipfile
from base64 import b64decode, b64encode
from django.db import transaction
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.exceptions import ObjectDoesNotExist
from django.utils.encoding import force_bytes, force... | psiinon/addons-server | src/olympia/lib/crypto/signing.py | Python | bsd-3-clause | 9,286 |
#!/usr/bin/env python
"""This module has tests for the pvl decoder functions."""
# Copyright 2019-2021, Ross A. Beyer (rbeyer@seti.org)
#
# 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
#
# ... | planetarypy/pvl | tests/test_decoder.py | Python | bsd-3-clause | 10,166 |
from numpy.testing import *
import numpy.lib.utils as utils
from numpy.lib import deprecate
from StringIO import StringIO
def test_lookfor():
out = StringIO()
utils.lookfor('eigenvalue', module='numpy', output=out,
import_modules=False)
out = out.getvalue()
assert_('numpy.linalg.eig'... | mbalasso/mynumpy | numpy/lib/tests/test_utils.py | Python | bsd-3-clause | 1,046 |
#!/usr/bin/env python
"""Generate AMBA AHB specifications for given number of masters.
Translated and adapted from Perl original distributed with Anzu.
https://www.iaik.tugraz.at/content/research/opensource/anzu/#download
"""
import argparse
import math
from omega.logic.syntax import conj
def build_state_str(sta... | johnyf/gr1experiments | examples/jcss12/amba_generator.py | Python | bsd-3-clause | 15,381 |
"""
Procedure for unit-testing with images:
1. Run unit tests at least once; this initializes a git clone of
vispy/test-data in config['test_data_path']. This path is
`~/.vispy/test-data` unless the config variable has been modified.
2. Run individual test scripts with the --vispy-audit flag:
$ pyth... | sh4wn/vispy | vispy/testing/image_tester.py | Python | bsd-3-clause | 16,960 |
import pyglet
import pyglet.media as media
import numpy as np
import sys, os
import motmot.FlyMovieFormat.FlyMovieFormat as fmf_mod
from optparse import OptionParser
def get_frame(source):
ts = source.get_next_video_timestamp()
im = source.get_next_video_frame()
if im is None:
return None, None
... | slivingston/flymovieformat | motmot/FlyMovieFormat/ffmpeg2fmf.py | Python | bsd-3-clause | 1,625 |
# coding=utf-8
"""
WSGI config for Gestión IES project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``... | pkom/gestionies | config/wsgi.py | Python | bsd-3-clause | 1,468 |
#!/usr/bin/env python
#
# Copyright 2013 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... | flgiordano/netcash | +/google-cloud-sdk/lib/googlecloudsdk/gcloud_main.py | Python | bsd-3-clause | 7,025 |
#!/usr/bin/env python
import os
import json
from argparse import ArgumentParser
from datetime import datetime
import time
import numpy as np
from tools import diff_last, cost_val, load_kind
def year_to_ms(y):
"""converts years to milliseconds."""
x = datetime(y, 1, 1)
x = time.mktime(x.timetuple()) * 10... | cyclus/cyc3d | data_to_json.py | Python | bsd-3-clause | 912 |
from .operations import (
AddOperation,
CopyOperation,
MoveOperation,
RemoveOperation,
ReplaceOperation,
TestOperation
)
from .exceptions import PatchException
class Patch(object):
"""
JSON Patch defines a JSON document structure for expressing a
sequence of operations to apply to ... | CptLemming/django-json-patch | json_patch/patch.py | Python | bsd-3-clause | 1,626 |
"""
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------... | almarklein/bokeh | bokeh/charts/_chart_options.py | Python | bsd-3-clause | 2,278 |
# Always prefer setuptools over distutils
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'VERSION')) as f:
__version__ = f.read().strip()
with open(os.path.join(here, 'requirements.txt')) as f:
required = f.read().spli... | betatim/osf-cli | setup.py | Python | bsd-3-clause | 2,524 |
from apps.api.serializers import base
from apps.api.models import Publisher
class PublisherListSerializer(base.BasePropertiesListSerializer):
resource = 'publisher'
class Meta(object):
model = Publisher
fields = base.LIST_FIELDS
class PublisherSerializer(base.BasePropertiesDetailSerializer)... | MihaZelnik/meepleAPI | meeple/apps/api/serializers/publisher.py | Python | bsd-3-clause | 435 |
# coding: utf-8
from __future__ import print_function
import logging
import math
import numpy as np
def generate_points(n, min_x=-5, min_y=-5, max_x=5, max_y=5):
return [(np.random.uniform(min_x, max_x), np.random.uniform(min_y, max_y))
for x in range(n)]
def dist(a, b):
""" euclidean distance... | GianlucaBortoli/enhanced-clustering | src/kmeans.py | Python | bsd-3-clause | 2,388 |
from random import choice
from django import template
from django_sockjs_server.lib.config import SockJSServerSettings
from django_sockjs_server.lib.token import Token
register = template.Library()
@register.simple_tag(name='sockjs_auth_token')
def sockjs_auth_token(room_name, unq_id=None):
token = Token()
if... | alfss/django-sockjs-server | django_sockjs_server/templatetags/sockjs_server_tags.py | Python | bsd-3-clause | 580 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/db/versions/v0_3_1/persistence/__init__.py | Python | bsd-3-clause | 2,007 |
from __future__ import unicode_literals
from django.contrib.auth.models import (
AbstractBaseUser, BaseUserManager, PermissionsMixin)
from django.db import models
from django.forms.models import model_to_dict
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from djang... | car3oon/saleor | saleor/userprofile/models.py | Python | bsd-3-clause | 5,495 |
# Django settings for example project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', ... | mattrobenolt/django-casscache | example/example/settings.py | Python | bsd-3-clause | 5,718 |