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 |
|---|---|---|---|---|---|
"""Provide the WikiPage class."""
from ...const import API_PATH
from ...util.cache import cachedproperty
from ..listing.generator import ListingGenerator
from .base import RedditBase
from .redditor import Redditor
class WikiPage(RedditBase):
"""An individual WikiPage object.
**Typical Attributes**
This ... | leviroth/praw | praw/models/reddit/wikipage.py | Python | bsd-2-clause | 8,763 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, First Party Software
# 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 the above copyright notice,
# t... | filipp/Servo | servo/forms/product.py | Python | bsd-2-clause | 7,202 |
from unittest import TestCase
class TestImports(TestCase):
_multiprocess_can_split_ = True
def test_coeff2header_import(self):
import sk_dsp_comm.coeff2header
def test_coeff2header_from(self):
from sk_dsp_comm import coeff2header
def test_digitalcom_import(self):
import sk_d... | mwickert/scikit-dsp-comm | sk_dsp_comm/test/test_imports.py | Python | bsd-2-clause | 1,438 |
import django, os
from djcelery_transactions import task
from django.test import TransactionTestCase
if django.VERSION < (1,7):
from django.core.cache import cache
else:
from django.core.cache import caches
cache = caches['default']
if django.VERSION >= (1,6):
from django.db.transaction import atomic
e... | roverdotcom/django-celery-transactions | tests/test/tests.py | Python | bsd-2-clause | 2,324 |
# -*- coding: utf-8 -*-
#
# sample documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 16 21:22:43 2012.
#
# 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
# autogenerated file.
#
# All ... | ubaumgar/OKR | docs/conf.py | Python | bsd-2-clause | 7,670 |
# -*- coding: utf-8 -*-
from icalendar.tests import unittest
import datetime
import icalendar
import os
import pytz
class TestEncoding(unittest.TestCase):
def test_create_from_ical(self):
directory = os.path.dirname(__file__)
with open(os.path.join(directory, 'encoding.ics'), 'rb') as fp:
... | geier/icalendar | src/icalendar/tests/test_encoding.py | Python | bsd-2-clause | 3,224 |
#THIS IS /helicopter_providence/middletown_3_29_11/site1_planes/boxm2_site1_1/boxm2_create_scene.py
from boxm2WriteSceneXML import *
import optparse
from xml.etree.ElementTree import ElementTree
import os, sys
#Parse inputs
parser = optparse.OptionParser(description='Create BOXM2 xml file');
parser.add_opt... | mirestrepo/voxels-at-lems | super3d/boxm2_create_scene.py | Python | bsd-2-clause | 1,566 |
import sys
import struct
ULL_BYTES = struct.calcsize('!Q')
SHORT_BYTES = struct.calcsize('!h')
INDEX_HEADER = 'IDX'
def search(dbfile, prefix):
"""Returns all words having a given prefix using a dbfile."""
idx = Index.from_file(dbfile)
for letter in prefix:
if letter not in idx.nodes:
... | mstepniowski/simpledb | search.py | Python | bsd-2-clause | 2,080 |
# -*- coding: utf-8 -*-
"""
CSS themes to include in the HTML formatter.
"""
class BasicTheme(object):
stylesheet_text = """
body {
font-size:0;
color:#fff;
margin:0;
padding:0
}
.behave,td,th {
font:400 11px "Lucida Grande",Helvetica,sans-serif;
background:#fff;
color:#000
}
.behave... | kymbert/behave | behave/formatter/css.py | Python | bsd-2-clause | 5,025 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-12-11 04:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0024_auto_20181210_2022'),
]
operations = [
migrations.AddField(
... | wodo/WebTool3 | webtool/server/migrations/0025_instruction_special.py | Python | bsd-2-clause | 519 |
"""
Bulk walk Agent MIB (SNMPv2c)
+++++++++++++++++++++++++++++
Perform SNMP GETBULK operation with the following options:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* for OID in tuple form
* with non-repeaters=0 and max-repeaters=25
This script performs similar to the ... | etingof/pysnmp | examples/v1arch/asyncore/manager/cmdgen/getbulk-pull-whole-mib.py | Python | bsd-2-clause | 3,865 |
# fname_info.py
'''
fname.py module wraps the cfname class, which is used to simplify the task
of dealing with filenames.
'''
from __future__ import print_function
import os.path
class cfname_info(object):
'''
An instance of cfname_info class is used to represent a single filename.
After ... | michaelmurdock/mmlib | fname_info.py | Python | bsd-2-clause | 11,171 |
import math
import sys
import re
valuePattern = re.compile('= (.+)$')
def extractValue(line):
match = re.search(valuePattern, line)
if match:
return float.fromhex(match.group(1))
else:
return "ERROR"
intervalPattern = re.compile('= \[(.*?), (.*?)\]')
def extractInterval(line):
match = re.search(interv... | jacekburys/csmith | programs/validate.py | Python | bsd-2-clause | 1,157 |
#!/usr/bin/env python
"""
Convert the HTML table ``data/airlines.html`` into airline obects.
Table taken from http://en.wikipedia.org/wiki/Airline_codes-All
"""
import os
import sys
scripts_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.abspath(os.path.join(scripts_path, "..")))
os.envi... | stephenmcd/ratemyflight | ratemyflight/scripts/convert_airlines.py | Python | bsd-2-clause | 1,370 |
import dragonfly
import dragonfly.pandahive
import bee
from bee import connect
import math, functools
from panda3d.core import NodePath
import dragonfly.scene.unbound
import dragonfly.std
import dragonfly.io
# ## random matrix generator
from random import random
def random_matrix_generator():
while 1:
... | agoose77/hivesystem | manual/movingpanda/panda-5.py | Python | bsd-2-clause | 3,673 |
from spacerogue.gameutil import cat
from spacerogue.props import weapon_props
class Item(object):
'''Generic item, does nothing'''
def __init__(self, name):
self.name = name
class Weapon(Item):
'''Equippable weapon'''
def __init__(self, name):
Item.__init__(self, name)
self.properties = weapon_props[self.na... | kaashif/spacerogue | spacerogue/items.py | Python | bsd-2-clause | 760 |
import csv
from django.db import transaction
from django import forms
from django.forms.forms import NON_FIELD_ERRORS
from django.utils import six
from django.utils.translation import ugettext_lazy as _
class CSVImportError(Exception):
pass
class ImportCSVForm(forms.Form):
csv_file = forms.FileField(requir... | fusionbox/django-importcsvadmin | importcsvadmin/forms.py | Python | bsd-2-clause | 3,694 |
import math
from common.string import strip_accents
from difflib import get_close_matches
class SpellChecker():
def __init__(self, allWords):
self.allWords = {x for x in allWords if x}
def checkWords(self, words):
if words and words[0]:
suggestions = {x:self.check(x) for x in words}
suggestions = {k:v for... | havrlant/fca-search | src/retrieval/spell_checker.py | Python | bsd-2-clause | 823 |
# IronPython
import clr
clr.AddReferenceToFileAndPath(r"D:\Program Files\BIOVIA\BIOVIA Draw 2018\lib\MDL.Draw.Foundation.dll")
from MDL.Draw.StructureConversion import StructureConverter
sc = StructureConverter()
import common
import urllib
import urllib2
import json
class MyAromaticSmilesWriter(common... | nextmovesoftware/smilesreading | scripts/BIOVIADraw.py | Python | bsd-2-clause | 1,200 |
# -*- 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 field 'Exemplar.out_reason'
db.add_column(u'polybookexchange_exe... | PolyLAN/polybookexchange | polybookexchange/migrations/0002_auto__add_field_exemplar_out_reason__add_field_exemplar_money_given_da.py | Python | bsd-2-clause | 7,600 |
from setuptools import setup
setup(
name="pystor",
version="0.9.1",
author="Ethronsoft",
author_email='dev@ethronsoft.com',
zip_safe=False,
packages=["ethronsoft", "ethronsoft.pystor"],
license=open("LICENSE.txt").read(),
include_package_data=True,
keywords="nosql document store se... | ethronsoft/stor | bindings/python/setup.py | Python | bsd-2-clause | 737 |
# Demo application for brukva
# In order to use:
# 1. $ python app.py
# 2. Open in your browser that supports websockets: http://localhost:8888/
# You should see text that says "Connected..."
# 3. $ curl http://localhost:8888/msg -d 'message=Hello!'
# You should see 'Hello!' in your browser
import brukva
im... | procool/mygw | dist/brukva/demos/websockets/app.py | Python | bsd-2-clause | 1,650 |
#!/usr/bin/env python
""" fs_setup.py - set up directories for freesurfer analysis
"""
## Copyright 2011, Russell Poldrack. 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... | poldrack/openfmri | pipeline/fs_setup.py | Python | bsd-2-clause | 2,291 |
#!/usr/bin/env python
# coding:utf-8
import errno
import socket
import ssl
import urlparse
import OpenSSL
NetWorkIOError = (socket.error, ssl.SSLError, OpenSSL.SSL.Error, OSError)
from proxy import xlog
import simple_http_client
import simple_http_server
from cert_util import CertUtil
from config import config
imp... | hexlism/xx_net | gae_proxy/local/proxy_handler.py | Python | bsd-2-clause | 14,990 |
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2009-09-19
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://... | hsoft/musicguru | qt/ignore_box.py | Python | bsd-3-clause | 1,816 |
#!/usr/bin/python3
# A simple program to test TCP throughput, by sending 1GiB data.
import socket, sys, time
def report(name : str, total_bytes : int, elapsed_seconds : float):
mbps = total_bytes / 1e6 / elapsed_seconds
print('%s transferred %.3fMB in %.3fs, throughput %.3fMB/s %.3fMbits/s' %
(na... | chenshuo/recipes | python/throughput.py | Python | bsd-3-clause | 7,242 |
"""
This module is used with VM_publisher_test.py to test
APMQ/pika. Execute
python VM_publisher_test.py
in one shell and
execute
python VM_publisher_test.py
in another shell.
The publisher publishes p*1, p*2, p*3, ... , p*num_steps on a stream
with global name 'sequence'. Currently num_steps is set to 10 and p ... | AssembleSoftware/IoTPy | examples/distributed_examples/example_2_subscriber.py | Python | bsd-3-clause | 2,279 |
# ------------------------------------------------------------------------------
# OCCAM
#
# Copyright © 2011-2012, SRI International
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redis... | Wajihulhassan/SelfContainedPrevirt | tools/occam/occam/targets/interface.py | Python | bsd-3-clause | 5,659 |
from pdb import Pdb # pragma: nocoverage
morepath_pdb = Pdb(
skip=["reg.*", "inspect", "repoze.lru"]
) # pragma: nocoverage
def set_trace(*args, **kw): # pragma: nocoverage
"""Set pdb trace as in ``import pdb; pdb.set_trace``, ignores ``reg``.
Use ``from morepath import pdbsupport; pdbsupport.set_tr... | morepath/morepath | morepath/pdbsupport.py | Python | bsd-3-clause | 465 |
"""
byceps.services.shop.article.dbmodels.article
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from datetime import datetime
from decimal import Decimal
from typing import Optional
from sqlalchemy.ext.hybrid import... | homeworkprod/byceps | byceps/services/shop/article/dbmodels/article.py | Python | bsd-3-clause | 3,124 |
# -*- coding: utf-8 -*-
"""
djadmin2's permission handling. The permission classes have the same API as
the permission handling classes of the django-rest-framework. That way, we can
reuse them in the admin's REST API.
The permission checks take place in callables that follow the following
interface:
* They get passe... | andrewsmedina/django-admin2 | djadmin2/permissions.py | Python | bsd-3-clause | 15,152 |
import contextlib
from datetime import datetime
import io
import os
from pathlib import Path
import dateutil.parser
import numpy as np
import pytest
from pandas.errors import EmptyDataError
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def dirpath(datapa... | pandas-dev/pandas | pandas/tests/io/sas/test_sas7bdat.py | Python | bsd-3-clause | 12,142 |
# Licensed under a 3-clause BSD style license - see LICENSES
import math
import numpy as np
import pytest
from astropy import units as u
from numpy.testing import assert_allclose, assert_almost_equal
import sncosmo
def test_abmagsystem():
magsys = sncosmo.ABMagSystem()
m = magsys.band_flux_to_mag(1.0, 'bes... | kbarbary/sncosmo | sncosmo/tests/test_magsystems.py | Python | bsd-3-clause | 2,223 |
# encoding: UTF-8
#
# Copyright (c) 2015-2016 Facility for Rare Isotope Beams
#
"""
Physics Applications
"""
try:
from phantasy_apps import *
except ImportError:
print("Package 'python-phantasy-apps' is required.")
| archman/phantasy | phantasy/apps/__init__.py | Python | bsd-3-clause | 225 |
#!/usr/bin/env python
from codecs import open
from setuptools import find_packages, setup
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='blanc-basic-pages',
version='0.3.7',
description='Blanc Basic Pages for Django',
long_description=readme,
url='https://github.... | blancltd/blanc-basic-pages | setup.py | Python | bsd-3-clause | 1,204 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bankaccounts', '0001_initial'),
('banktransactiontags', '0001_initial'),
]
... | ychab/mymoney | mymoney/apps/banktransactions/migrations/0001_initial.py | Python | bsd-3-clause | 2,559 |
# A very basic settings file that allows Sphinx to build
# the docs (this is becuase autodoc is used).
import os
import sys
sys.path.insert(0, os.getcwd())
sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
SITE_ID = 303
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {"default": {
"NAME": ":memory:",
"... | mazelife/django-scaffold | docs/settings.py | Python | bsd-3-clause | 698 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2012, Jean-Rémy Bancel <jean-remy.bancel@telecom-paristech.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:
# * Redistributions o... | JRBANCEL/Chromagnon | chromagnonHistory.py | Python | bsd-3-clause | 6,714 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
from fmrb.dubins_traffic import gen_worldsdf, RoadNetwork
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('FILE', type=str, help='road network description file')
args = parser.... | fmrchallenge/fmrbenchmark | domains/dubins_traffic/dub_sim/src/genroad.py | Python | bsd-3-clause | 434 |
'''
Comparison of basis data against authoritative sources
'''
from ..api import get_basis
from ..misc import compact_elements
from ..sort import sort_shells, sort_potentials
from ..lut import element_sym_from_Z
from .. import manip
from ..readers import read_formatted_basis_file
from .compare import _reldiff
def _p... | MOLSSI-BSE/basis_set_exchange | basis_set_exchange/curate/compare_report.py | Python | bsd-3-clause | 9,376 |
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
| logston/ipy.io | docker/jupyter_notebook_config.py | Python | bsd-3-clause | 77 |
#! /usr/bin/python
# -*- mode: python -*-
from contextlib import contextmanager
import glob
import itertools
import logbook
import os
import re
import stat
import shutil
import subprocess
import tempfile
from raven import Client
from rq_queues import default_queue, retry_queue
from sentry_dsn import SENTRY_DSN
sentry ... | vmalloc/devdocs | webapp/builder.py | Python | bsd-3-clause | 8,012 |
from data_importers.ems_importers import BaseHalaroseCsvImporter
FAL_ADMINAREAS = (
"Bo'ness",
"Bonnybridge",
"Denny",
"Falkirk Ward 1",
"Falkirk Ward 2",
"Falkirk Ward 3",
"Falkirk Ward 4",
"Falkirk Ward 5",
"Falkirk Ward 6",
"Falkirk Ward 7",
"Falkirk Ward 8",
"Falkirk... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_falkirk.py | Python | bsd-3-clause | 1,748 |
from sequence import *
from wait_actions import *
from keypress_actions import *
from sequence_step import *
| javihernandez/accerciser-mirror | macaroon/macaroon/playback/__init__.py | Python | bsd-3-clause | 109 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-09 03:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('songs', '0012_song_download_url'),
]
operations = [
... | zaneswafford/songaday_searcher | songs/migrations/0013_auto_20170309_0356.py | Python | bsd-3-clause | 956 |
import collections
from django import forms
from django.forms.fields import MultiValueField, CharField
from django.forms.utils import flatatt
from django.forms.widgets import (
CheckboxInput,
Input,
RadioChoiceInput,
RadioSelect,
RadioFieldRenderer,
TextInput,
MultiWidget,
Widget,
)
from... | qedsoftware/commcare-hq | corehq/apps/style/forms/widgets.py | Python | bsd-3-clause | 10,116 |
#-------------------------------------------------------------------------------
#Name: rptest
#Purpose: test module for refprop and multiRP
#
#Author: Thelen, B.J.
# thelen_ben@yahoo.com
#-------------------------------------------------------------------------------... | BenThelen/python-refprop | python2.7/rptest.py | Python | bsd-3-clause | 21,437 |
# -*- coding: utf-8 -*-
from django.conf.urls import url, patterns, include
from rest_framework.routers import DefaultRouter
from coffeecups.views import TakeView, ThrowView, CupPolicyView
router = DefaultRouter()
router.register(r'takes', TakeView)
router.register(r'throws', ThrowView)
router.register(r'policies', C... | J1bz/ecoloscore | coffeecups/urls.py | Python | bsd-3-clause | 406 |
import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="modals.urls",
INSTALLED_APPS=[
"... | publica-io/django-publica-modals | runtests.py | Python | bsd-3-clause | 1,244 |
# -*- coding: utf-8 -*-
#from django.contrib import admin
| AdrianRibao/notifintime | notifintime/admin.py | Python | bsd-3-clause | 58 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 7, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_LinearTrend/cycle_7/ar_/test_artificial_128_RelativeDifference_LinearTrend_7__20.py | Python | bsd-3-clause | 275 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingMedian'] , ['Seasonal_DayOfMonth'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_MovingMedian_Seasonal_DayOfMonth_SVR.py | Python | bsd-3-clause | 160 |
from __future__ import absolute_import, print_function
import click
import sys
from sentry.runner.decorators import configuration
def _get_field(field_name):
from sentry.models import User
return User._meta.get_field(field_name)
def _get_email():
from django.core.exceptions import ValidationError
... | beeftornado/sentry | src/sentry/runner/commands/createuser.py | Python | bsd-3-clause | 3,480 |
#!/usr/bin/python
# Copyright 2015 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.
"""Gets information about one commit from gitiles.
Example usage:
./fetch_revision_info.py 343b531d31 chromium
./fetch_revision_info.p... | eunchong/build | scripts/slave/recipe_modules/auto_bisect/resources/fetch_revision_info.py | Python | bsd-3-clause | 1,529 |
#!flask/bin/python
from flask.ext.mail import Message
from app import app, mail
from config import ADMINS
msg = Message('test subject', sender = ADMINS[0], recipients = ADMINS)
msg.body = 'text body'
msg.html = '<b>HTML</b> body'
with app.app_context():
mail.send(msg)
| trudikampfschaf/flask-microblog | mail.py | Python | bsd-3-clause | 273 |
"""Generate a schema wrapper from a schema"""
import copy
import os
import sys
import json
from os.path import abspath, join, dirname
import textwrap
from urllib import request
import m2r
# import schemapi from here
sys.path.insert(0, abspath(dirname(__file__)))
from schemapi import codegen
from schemapi.codegen imp... | ellisonbg/altair | tools/generate_schema_wrapper.py | Python | bsd-3-clause | 18,648 |
import os
import pytest
@pytest.mark.asyncio
@pytest.mark.parametrize("static", [{"/static": os.path.join(os.path.dirname(__file__), "static")}])
def test_static_miss(response):
assert response.status == 200
assert (yield from response.text()) == "Hello world"
@pytest.mark.asyncio
@pytest.mark.parametrize("... | gogobook/aiohttp-wsgi | tests/test_static.py | Python | bsd-3-clause | 819 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure function-level linking setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32... | Jet-Streaming/gyp | test/win/gyptest-cl-function-level-linking.py | Python | bsd-3-clause | 1,647 |
"""
>>> from blaze import *
>>> accounts = symbol('accounts', 'var * {name: string, amount: int}')
>>> deadbeats = accounts[accounts['amount'] < 0]['name']
>>> from sqlalchemy import Table, Column, MetaData, Integer, String
>>> t = Table('accounts', MetaData(),
... Column('name', String, primary_key = True... | maxalbert/blaze | blaze/compute/sql.py | Python | bsd-3-clause | 28,997 |
import codecs
import sys
import setuptools
def read_requirements_file(req_name):
requirements = []
try:
with codecs.open(req_name, encoding='utf-8') as req_file:
for req_line in req_file:
if '#' in req_line:
req_line = req_line[0:req_line.find('#')].str... | sprockets/sprockets.mixins.redis | setup.py | Python | bsd-3-clause | 2,498 |
import unittest
import numpy as np
from ..pointpattern import PointPattern
from pysal.lib.common import RTOL
class TestPointPattern(unittest.TestCase):
def setUp(self):
self.points = [[66.22, 32.54], [22.52, 22.39], [31.01, 81.21],
[9.47, 31.02], [30.78, 60.10], [75.21, 58.93],
... | lixun910/pysal | pysal/explore/pointpats/tests/test_pointpattern.py | Python | bsd-3-clause | 4,565 |
import datetime
import logging
import hashlib
import random
import sys
import pymongo
import scrapelib
from .mongolog import MongoHandler
from .storage import engines
from celery.execute import send_task
class Kernel(object):
""" oyster's workhorse, handles tracking """
def __init__(self, mongo_host='local... | jamesturk/oyster | oyster/core.py | Python | bsd-3-clause | 10,992 |
# 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.
from telemetry import tab_test_case
from telemetry import user_agent
class UserAgentTest(tab_test_case.TabTestCase):
def CustomizeBrowserOptions(self... | nacl-webkit/chrome_deps | tools/telemetry/telemetry/user_agent_unittest.py | Python | bsd-3-clause | 539 |
from __future__ import absolute_import
import mock
import pytz
import pytest
from datetime import datetime, timedelta
from django.conf import settings
from django.utils import timezone
from hashlib import md5
from sentry import options
from sentry.api.issue_search import convert_query_values, IssueSearchVisitor, pars... | mvaled/sentry | tests/snuba/search/test_backend.py | Python | bsd-3-clause | 53,904 |
class CollectData():
"""每小时数据收集类
利用微博高级搜索功能,按关键字搜集一定时间范围内的微博。
大体思路:构造URL,爬取网页,然后解析网页中的微博ID。后续利用微博API进行数据入库。本程序只负责收集微博的ID。
登陆新浪微博,进入高级搜索,输入关键字”空气污染“,选择”实时“,时间为”2013-07-02-2:2013-07-09-2“,地区为”北京“,之后发送请求会发现地址栏变为如下:
http://s.weibo.com/wb/%25E7%25A9%25BA%25E6%25B0%2594%25E6%25B1%25A1%25E6%259F%2593&xsort=time®ion=cu... | osDanielLee/SelfThinkingRobot | AchieveData/CollectData.py | Python | bsd-3-clause | 8,610 |
#!/usr/bin/env python
#
# Problem definition:
# A-R Hedar and M Fukushima, "Derivative-Free Filter Simulated Annealing
# Method for Constrained Continuous Global Optimization", Journal of
# Global Optimization, 35(4), 521-549 (2006).
#
# Original Matlab code written by A. Hedar (Nov. 23, 2005)
# http://www-optima.amp.... | jcfr/mystic | examples2/g09.py | Python | bsd-3-clause | 1,961 |
#
# ImageViewGtk.py -- classes for the display of FITS files in Gtk widgets
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
import sys, os
from ginga.gtkw import gtks... | sosey/ginga | ginga/gtkw/ImageViewGtk.py | Python | bsd-3-clause | 19,183 |
def extractXvvCpuMybluehostMe(item):
'''
Parser for 'xvv.cpu.mybluehost.me'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous'... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractXvvCpuMybluehostMe.py | Python | bsd-3-clause | 553 |
# -*- coding: utf-8 -*-
import sys
import json
import time
import uuid
import socket
import getpass
import argparse
import datetime
import platform
import socklusion
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 8888
DEFAULT_PATH = '/v1/on_import'
TIMEOUT = 5.0
INSTANCE_ID = uuid.uuid4()
IS_64BIT = sys.maxsize > 2 ** 3... | paypal/support | examples/python_analytics/client/collect.py | Python | bsd-3-clause | 2,659 |
import unittest
from efront import repo
from mock import Mock
class TestTarget(unittest.TestCase):
def setUp(self):
self.target = repo.Target("myTarget")
self.target.root_names = ["git", "svn"]
def test_print_svn(self):
self.target.add("svn")
self.assertEqual(str(s... | sbergot/python | efront/test/testTarget.py | Python | bsd-3-clause | 696 |
__all__ = [
'SgAssetCreatedFilter',
'SgHumanUserCreatedFilter',
'SgPlaylistCreatedFilter',
'SgProjectCreatedFilter',
'SgProjectFilter',
'SgPublishedFileCreatedFilter',
'SgSequenceCreatedFilter',
'SgShotCreatedFilter',
'SgTaskCreatedFilter',
'SgVersionCreatedFilter'
]
# This module imports
import S... | ndunsworth/python-shotgunorm | ShotgunORM/SgEventFilters.py | Python | bsd-3-clause | 2,856 |
import os
from django.conf import settings
import yaafelib as yf
import wave
import contextlib
from celery import task
from sepal.datasets.models import *
from sepal.datasets.utils import filter_by_key, find_dict_by_item
@task()
def handle_uploaded_file(f):
'''Saves an uploaded data source to MEDIA_ROOT/data_so... | sloria/sepal | sepal/datasets/tasks.py | Python | bsd-3-clause | 8,545 |
# -*- coding: utf-8 -*-
from django import forms
from django.apps import apps
from django.contrib.auth import get_user_model, get_permission_codename
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core... | czpython/django-cms | cms/admin/forms.py | Python | bsd-3-clause | 48,437 |
from diofant import (Derivative, Function, Integral, bell, besselj, cos, exp,
legendre, oo, symbols)
from diofant.printing.conventions import requires_partial, split_super_sub
__all__ = ()
def test_super_sub():
assert split_super_sub('beta_13_2') == ('beta', [], ['13', '2'])
assert spli... | skirpichev/omg | diofant/tests/printing/test_conventions.py | Python | bsd-3-clause | 3,727 |
from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(geography=True)
objects = models.GeoManager()
def __str__(self):
return... | ericholscher/django | django/contrib/gis/tests/geogapp/models.py | Python | bsd-3-clause | 876 |
# -*- coding: utf-8 -*-
from cms.models import Page
from cms.test_utils.util.context_managers import (UserLoginContext,
SettingsOverride)
from django.conf import settings
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.sites.models import Site
from django.core.exceptions import Object... | foobacca/django-cms | cms/test_utils/testcases.py | Python | bsd-3-clause | 12,223 |
import json
import boto3
from featuretools.entityset.deserialize import \
description_to_entityset as deserialize_es
from featuretools.feature_base.feature_base import (
AggregationFeature,
DirectFeature,
Feature,
FeatureBase,
FeatureOutputSlice,
GroupByTransformFeature,
IdentityFeatur... | Featuretools/featuretools | featuretools/feature_base/features_deserializer.py | Python | bsd-3-clause | 5,124 |
"""Auto-generated file, do not edit by hand. VC metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_VC = PhoneMetadata(id='VC', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='9\\d{2}', possible_number_pattern='\\d{... | vicky2135/lucious | oscar/lib/python2.7/site-packages/phonenumbers/shortdata/region_VC.py | Python | bsd-3-clause | 810 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('plans', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DataSource',
fields=[
... | DocDir/docdir | plans/migrations/0002_auto_20150722_0003.py | Python | bsd-3-clause | 3,284 |
#!/usr/bin/python
import sqlite3, os, string, hashlib
from Crypto.Random import random
###################################################
#
# Default values for the config
#
###################################################
# Staging Key is set up via environmental variable
# or via command line. By setting RAND... | rvazarkar/Empire | setup/setup_database.py | Python | bsd-3-clause | 5,322 |
"""
Here we test our output parsing and matching implementation, not HTTPie itself.
"""
from httpie.models import ELAPSED_TIME_LABEL
from httpie.output.writer import MESSAGE_SEPARATOR
from ...utils import CRLF
from . import assert_output_does_not_match, assert_output_matches, Expect
def test_assert_output_matches_he... | PKRoma/httpie | tests/utils/matching/test_matching.py | Python | bsd-3-clause | 5,827 |
# -*- 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):
# Changing field 'FormDefinitionField.help_text'
db.alter_column('form_d... | MagicSolutions/django-form-designer | form_designer/migrations/0010_auto__chg_field_formdefinitionfield_help_text.py | Python | bsd-3-clause | 10,400 |
# import pycountry as pycountry
from django.conf import settings
from django.http import HttpResponseRedirect, Http404
from django.utils import translation
from django.views.generic import TemplateView
from devilry.devilry_account.crapps.account import utils
from devilry.devilry_account.models import User
class Lang... | devilry/devilry-django | devilry/devilry_account/crapps/account/select_language.py | Python | bsd-3-clause | 2,654 |
"""
A Spawner for JupyterHub that runs each user's server in a separate docker container
"""
import os
import string
from textwrap import dedent
from concurrent.futures import ThreadPoolExecutor
from pprint import pformat
import docker
from docker.errors import APIError
from docker.utils import kwargs_from_env
from t... | Fokko/dockerspawner | dockerspawner/dockerspawner.py | Python | bsd-3-clause | 18,677 |
# -*- coding: utf-8 -*-
import os
import importlib
import pkgutil
def load_urls(urls=None, attr='urls'):
if urls is None:
urls = list()
# pkg_name = os.path.dirname(__file__)
pkg_path = os.path.abspath(os.path.dirname(__file__))
pkg_name = os.path.basename(pkg_path)
for _, name, ispkg in... | Damnever/Chat-Room | handlers/__init__.py | Python | bsd-3-clause | 535 |
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2013 snowy.in
import uuid
import hashlib
import Image
import StringIO
import time
import json
import re
import urllib2
import tornado.web
import lib.jsonp
import pprint
from base import *
from lib.variables import *
from form.topic import *
from lib.variables import ... | sllt/snowy | handler/notification.py | Python | bsd-3-clause | 1,557 |
#!/usr/bin/env python3
def count_consonants(string):
""" Function which returns the count of
all consonants in the string \"string\" """
consonants = "bcdfghjklmnpqrstvwxz"
counter = 0
if string:
for ch in string.lower():
if ch in consonants:
counter += 1
... | sevgo/Programming101 | week1/warmups/count_consonants.py | Python | bsd-3-clause | 468 |
#
# TESTS
#
from nose.tools import assert_true, assert_equal, assert_raises
from mixedges import Edges, EdgeKeys, EdgeData, EdgeItems
class BaseEdgeTests(object):
def setup_edges(self):
self.edlist = [{1:"one"}, {1:"two"}, {1:"three"}, {1:"four"}]
ed1, ed2, ed3, ed4 = self.edlist
Ge = se... | hagberg/nx3k | test_edges.py | Python | bsd-3-clause | 4,105 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.middleware.csrf import CsrfViewMiddleware
from django.middleware.csrf import _sanitize_token as sanitize_csrf_token
if DJANGO_VERSION < (1, 10):
from django.middleware.csrf import _get_new_csrf_... | samuelmaudo/yepes | yepes/middleware/csrf_token.py | Python | bsd-3-clause | 1,653 |
import psycopg2
import gardendb
import gardendb.postgres
with open('.dbconfig') as f:
conn = psycopg2.connect(f.read())
ThisIsACucumber= gardendb.cucumber('ThisIsACucumber', 'a b c')
pool = gardendb.postgres.dummy_pool(conn)
my_garden = gardendb.postgres.PgGarden('my_garden', pool)
import random
test = T... | nejstastnejsistene/gardendb | pg_test.py | Python | bsd-3-clause | 1,750 |
import sys
import random, string
import os
numberOfEmailsToGenerate = sys.argv[1]
try:
int(numberOfEmailsToGenerate)
print('Generating a CSV with ' + numberOfEmailsToGenerate + ' random emails')
print('This make take some time if the CSV is large ...')
except:
sys.exit('Please pass a number as the fir... | karuppiah7890/Mail-for-Good | utility/generateEmailCsv.py | Python | bsd-3-clause | 664 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | nuagenetworks/vspk-python | vspk/v6/nutestsuite.py | Python | bsd-3-clause | 12,813 |
from datetime import datetime, timedelta
from suds import client, wsse
import time
from .utils import recursive_asdict, load_class
class Locations(object):
"""Convenience class to communicate with the PostNL SOAP API"""
def __init__(self, settings):
self.settings = settings
security = wsse.S... | maerteijn/python-postnl-locations | postnl/locations/client.py | Python | bsd-3-clause | 3,143 |
import unittest
from spglib import get_symmetry
class TestGetSymmetry(unittest.TestCase):
def setUp(self):
lattice = [[4, 0, 0], [0, 4, 0], [0, 0, 4]]
positions = [[0, 0, 0], [0.5, 0.5, 0.5]]
numbers = [1, 1]
magmoms = [0, 0]
self._cell = (lattice, positions, numbers, magm... | jochym/spglib | python/test/test_collinear_spin.py | Python | bsd-3-clause | 1,322 |
# -*- coding: utf-8 -*-
"""Bloggin app actions for admin."""
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from blogging.models import Post
# Post Actions
def make_published(modeladmin, request, queryset):
"""Mark the given posts as published."""
count... | jibaku/blogging | blogging/actions.py | Python | bsd-3-clause | 2,706 |
# Copyright (c) 2017, 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 import __version__ as ct_version
from coremltools.models import _METADATA_VERSION, _MET... | apple/coremltools | coremltools/converters/sklearn/_converter.py | Python | bsd-3-clause | 5,804 |
# -*- coding: utf-8 -*-
"""Librería para parsear entradas y salidas de Karel en XML."""
import xml.etree.ElementTree as ET
import sys
def load():
"""Regresa (input, output, nombre de caso) para la ejecución actual"""
with open('data.in', 'r') as data_in:
return KarelInput(data_in.read()), KarelOutput(sys.stdin.re... | rendon/omegaup | stuff/libkarel.py | Python | bsd-3-clause | 5,548 |
"""LU decomposition functions."""
from __future__ import division, print_function, absolute_import
from warnings import warn
from numpy import asarray, asarray_chkfinite
# Local imports
from .misc import _datacopied, LinAlgWarning
from .lapack import get_lapack_funcs
from .flinalg import get_flinalg_funcs
__all__ ... | jor-/scipy | scipy/linalg/decomp_lu.py | Python | bsd-3-clause | 6,757 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from views import CatalogListView
urlpatterns = patterns('',
url(r'^$', CatalogListView.as_view(), name="list"),
)
| zenweasel/pybuilder-djangoexample | pyb_django/catalog/urls.py | Python | bsd-3-clause | 253 |
"""
sentry.testutils
~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import base64
import time
from sentry.conf import settings
from sentry.utils import json
from sentry.utils.auth im... | simmetria/sentry | src/sentry/testutils.py | Python | bsd-3-clause | 5,319 |