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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class FundamentalPipeline(object):
def process_item(self, item, spider):
return item
| sp500/stock | fundamental/fundamental/pipelines.py | Python | apache-2.0 | 291 |
s = \
"""7b: neg-int
7c: not-int
7d: neg-long
7e: not-long
7f: neg-float
80: neg-double
81: int-to-long
82: int-to-float
83: int-to-double
84: long-to-int
85: long-to-float
86: long-to-double
87: float-to-int
88: float-to-long
89: float-to-double
8a: double-to-int
8b: double-to-long
8c: double-to-float
8d: int-to-byte... | wangziqi2013/Android-Dalvik-Analysis | doc/generate_7b_8f.py | Python | apache-2.0 | 1,736 |
"""
Copyright 2010 Sami Dalouche
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 ... | pymager/pymager | pymager/web/_derivedresource.py | Python | apache-2.0 | 2,955 |
# Copyright 2015, Pinterest, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | pinterest/pinball | pinball/ui/utils.py | Python | apache-2.0 | 2,834 |
import re
import urllib2
import json
from distutils.version import LooseVersion
import datetime
import os
import requests
import time
from uuid import UUID
GITHUB_TAGS = "https://api.github.com/repos/apache/cassandra/git/refs/tags"
GITHUB_BRANCHES = "https://api.github.com/repos/apache/cassandra/branches"
KNOWN_SERIE... | mambocab/cstar_perf | regression_suites/util.py | Python | apache-2.0 | 8,896 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | rajalokan/nova | nova/policies/fixed_ips.py | Python | apache-2.0 | 925 |
# Copyright 2015 cybojenix <anthonydking@slimroms.net>
#
# 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 ... | CyboLabs/XdaPy | XdaPy/entry/forums.py | Python | apache-2.0 | 2,357 |
import wdl.parser
import wdl.util
from wdl.types import *
from wdl.values import *
import os
import json
import re
import inspect
class WdlBindingException(Exception): pass
class TaskNotFoundException(Exception): pass
class WdlValueException(Exception): pass
class EvalException(Exception): pass
def scope_hierarchy(sc... | broadinstitute/pywdl | wdl/binding.py | Python | apache-2.0 | 28,103 |
import tensorflow as tf
v1 = tf.Variable(0, dtype=tf.float32) # 定义一个变量,初始值为0
step = tf.Variable(0, trainable=False) # step为迭代轮数变量,控制衰减率
ema = tf.train.ExponentialMovingAverage(0.99, step) # 初始设定衰减率为0.99
maintain_averages_op = ema.apply([v1]) # 更新列表中的变量
with tf.Session() as sess:
init_op = tf.global_variables_i... | Asurada2015/TFAPI_translation | Training/Moving Averages/tf_train_ExponentialMovingAverage.py | Python | apache-2.0 | 1,401 |
import numpy as np
import random
from ray.rllib.utils import try_import_tf
tf = try_import_tf()
def seed(np_seed=0, random_seed=0, tf_seed=0):
np.random.seed(np_seed)
random.seed(random_seed)
tf.set_random_seed(tf_seed)
| stephanie-wang/ray | rllib/utils/seed.py | Python | apache-2.0 | 235 |
"""
Helpers for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/integrations/zha/
"""
import collections
import logging
import zigpy.types
from homeassistant.core import callback
from .const import (
ATTR_NAME,
CLUSTER_TYPE_IN,
... | leppa/home-assistant | homeassistant/components/zha/core/helpers.py | Python | apache-2.0 | 5,173 |
# -*- test-case-name: txweb2.dav.test.test_put -*-
##
# Copyright (c) 2005-2017 Apple Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includin... | macosforge/ccs-calendarserver | txweb2/dav/method/put.py | Python | apache-2.0 | 3,841 |
#!/usr/bin/env python
#coding=utf-8
'''
Override configurations.
'''
configs = {
'db': {
'host': '127.0.0.1'
}
} | shuchangwen/awesome-python-webapp | www/config_override.py | Python | apache-2.0 | 130 |
"""Defines utility functions for executing commands on the command line."""
import logging
import subprocess
import re
from util.exceptions import UnbalancedBrackets
logger = logging.getLogger(__name__)
class CommandError(Exception):
def __init__(self, msg, returncode=None):
super(CommandError, self).__i... | ngageoint/scale | scale/util/command.py | Python | apache-2.0 | 2,852 |
from aiida import load_dbenv
load_dbenv()
from aiida.orm import Code, DataFactory, load_node
StructureData = DataFactory('structure')
ParameterData = DataFactory('parameter')
import numpy as np
import os
codename = 'phono3py@boston-lab'
code = Code.get_from_string(codename)
###############
# Nitrogen structure
a = ... | yw-fang/readingnotes | abinitio/aiida/aiida_plugins_notes_examples/aiida-phonopy/FANG-examples/n/plugin/launch_phono3py_n-boston.py | Python | apache-2.0 | 3,189 |
'''
A worker used for testing how other components handle background tasks.
This worker has 2 methods: one that sleeps but doesn't provide progress,
and another that sleeps and provides update events every 1 second.
This also serves as a good template for copy/paste when creating a new worker.
'''
import math
import... | TeamHG-Memex/hgprofiler | lib/worker/sleep.py | Python | apache-2.0 | 1,072 |
#
# 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
# ... | steveb/heat | heat/tests/test_properties.py | Python | apache-2.0 | 74,955 |
# Generated by Django 2.1.8 on 2019-04-12 01:18
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
import django.utils.timezone
import gwells.db_comments.model_mixins
import submissions.data_migrations
class Migration(migrations.Migration):
initial = True
depend... | bcgov/gwells | app/backend/submissions/migrations/0001_initial.py | Python | apache-2.0 | 1,712 |
# -*- coding: utf-8; -*-
import sys
from Tkinter import*
import os
import symbols
import draft_gui
import calc
import get_conf
import get_object
import param_edit
import select_clone
import trace
import trace_object
import save_file
import undo_redo
import to_dxf
import to_svg
import from_dxf
import from_svg
import... | VVS1864/SAMoCAD | src/core.py | Python | apache-2.0 | 89,765 |
#-----------------------------------------------------------------------
#
# Loader-specific SYS extensions
#
#-----------------------------------------------------------------------
from asm import *
# Peek into the ROM's symbol table
videoY = symbol('videoY')
sysArgs = symbol('sysArgs0')
vPC = symbol('vPC')
... | kervinck/gigatron-rom | Apps/Loader/SYS_Loader_v2.py | Python | bsd-2-clause | 5,211 |
# a script to rename files by changing their names in a TC checksum list
#Ange Albertini 2013
import sys
import hashlib
import glob
fn = sys.argv[1]
with open(fn, "r") as s:
r = s.readlines()
sums = {}
for s in r:
s = s.strip()
sha1, file = s[:40], s[40 + 2:]
file = file[file.rfind("... | angea/corkami | misc/python/ren_sum.py | Python | bsd-2-clause | 891 |
import argparse
from random import *
import math
from geo2d.geometry import *
import itertools
from tkinter import *
import time
from intervalset import AngularIntervalSet,odd
import sys,traceback
from collections import namedtuple
def random_color():
return "#%02x%02x%02x" % (randrange(0,255),randrange(0,255),ran... | FGCSchool-Math-Club/fgcs-math-club-2014 | critters.py | Python | bsd-2-clause | 33,180 |
import libcontext, bee
from bee.segments import *
from libcontext.socketclasses import *
from libcontext.pluginclasses import *
class become(bee.worker):
"""The become trigger fires every tick if its input has just become True"""
inp = antenna("pull", "bool")
b_inp = buffer("pull", "bool")
connect(i... | agoose77/hivesystem | sparta/triggers/become.py | Python | bsd-2-clause | 1,276 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lexicon', '0083_cognateclass_loanEventTimeDepth'),
]
operations = [
migrations.RemoveField(
model_name='cognateclasslist'... | lingdb/CoBL-public | ielex/lexicon/migrations/0084_auto_20160713_1522.py | Python | bsd-2-clause | 922 |
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from tensorflow import convert_to_tensor as to_T
from util.cnn import fc_layer as fc, conv_relu_layer as conv_relu
def _get_lstm_cell(num_layers, lstm_dim, apply_dropout):
if isinstance(lstm_dim, list): # Different layers h... | ronghanghu/n2nmn | models_shapes/nmn3_netgen_att.py | Python | bsd-2-clause | 14,699 |
"""
Tests for secure configuration
"""
from ConfigParser import ConfigParser
from unittest import TestCase
import logging
import re
import subprocess
import os
# Don't freak out about regular expression in string (for grep)
# pylint: disable=W1401
SSH_PORT = 22
class SecureConfig(TestCase):
"""
Test to ensu... | amplifylitco/asiaq | tests/unit/test_secure_config.py | Python | bsd-2-clause | 4,350 |
'''
Test Battery for the SQL3 CSV Import
Created on Sep 18, 2013
@author: marcelo, carlos@xt6.us
@changelog:
'''
import unittest
import sys
import uuid
from cm2c.commons.gen.utils import get_tmp_fn
from cm2c.csvimport.sql3load import sql3load
#--
class Test(unittest.TestCase):
def setUp(self):
#sys.std... | carlosm3011/cm2c-python-lib | test/test_sql3load_p1.py | Python | bsd-2-clause | 2,886 |
"""
This is the default settings module.
The values of any variables that might differ between deploys of the package should either be None or should be
calculated at runtime. This file is under version control so it must work across all deploys. All of the tests should
pass or be skipped with no local settings overri... | ColumbiaCMB/kid_readout | kid_readout/settings/_default.py | Python | bsd-2-clause | 1,635 |
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
import 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 'Page.created'
db.add_column(u'pages_page', 'created'... | eRestin/MezzGIS | mezzanine/pages/migrations/0014_auto__add_field_page_created__add_field_page_updated.py | Python | bsd-2-clause | 6,196 |
#!/usr/bin/env python
import urlparse
from flup.server.fcgi import WSGIServer
import connections
import httplog
import get_next_lines
######################################################################
######################################################################
## ... | guidoreina/gsniffer | html/dispatch.py | Python | bsd-2-clause | 3,532 |
from django.contrib import admin
from models import Click
class ClickAdmin(admin.ModelAdmin):
list_display = ('content_object', 'content_type', 'referer', 'user', 'date')
list_display_links = ('content_object',)
list_filter = ('date', 'referer','user')
admin.site.register(Click, ClickAdmin)
| anscii/django-goto-track | goto_track/admin.py | Python | bsd-2-clause | 306 |
import numpy as np
from collections import deque
# Build a 2D grid from an unlabeled set of lenslet centers. This
# method is ad-hoc, but seems to work fairly reliably.
#
# Here we iterate over the putative matches, looking for pixels that
# at within 2 pixels of the EXPECTED_LENSLET_SIZE. This seems to be a
# very ... | sophie63/FlyLFM | stanford_lfanalyze_v0.4/lflib/calibration/grid.py | Python | bsd-2-clause | 6,790 |
"""Minimal class for planetary ellipsoids"""
from math import sqrt
class Ellipsoid:
"""
generate reference ellipsoid parameters
https://en.wikibooks.org/wiki/PROJ.4#Spheroid
https://nssdc.gsfc.nasa.gov/planetary/factsheet/index.html
as everywhere else in this program, distance units are METERS
... | scienceopen/pymap3d | src/pymap3d/ellipsoid.py | Python | bsd-2-clause | 2,581 |
import os
import logging
from django.conf import settings
from django.contrib.gis.db import models
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.template.defaultfilters import slugify
from django.utils.translation import get_language, ugettext_lazy ... | johan--/Geotrek | geotrek/trekking/models.py | Python | bsd-2-clause | 29,407 |
import re
import base64
from anillo.http.responses import Response
class HttpBasicAuthBackend:
def __init__(self, auth_func):
self.auth_regex = re.compile(r"^Basic: (.*)$")
self.auth_func = auth_func
def parse(self, request):
authorization = request.headers.get("Authorization", None)... | jespino/anillo-auth | anillo_auth/backends/http_auth.py | Python | bsd-2-clause | 998 |
from django.db import models
class Stub(models.Model):
"""
A stub model for testing check_migrations.
Has an incomplete set of migrations: the `age field is missing.
"""
name = models.CharField(max_length=255)
age = models.IntegerField()
| incuna/incuna-test-utils | tests/partial_migrations/models.py | Python | bsd-2-clause | 265 |
from ailment.expression import Load, Const
from .base import PeepholeOptimizationExprBase
class ConstantDereferences(PeepholeOptimizationExprBase):
"""
Dereferences constant memory loads from read-only memory regions.
"""
__slots__ = ()
name = "Dereference constant references"
expr_classes ... | angr/angr | angr/analyses/decompiler/peephole_optimizations/constant_derefs.py | Python | bsd-2-clause | 967 |
# -*- coding: UTF-8 -*-
# Copyright 2017-2020 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.db import models
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from lino.api import dd, rt
from lino import mixins
from lin... | lino-framework/xl | lino_xl/lib/trends/models.py | Python | bsd-2-clause | 3,415 |
import os
from unittest import TestCase
from nose.tools import istest
from envparser import Parser
class ParserTest(TestCase):
def setUp(self):
self.basefile = os.path.abspath(os.path.join(os.path.dirname(__file__), 'fixtures', 'base.cfg'))
@istest
def gets_string_from_configuration(self):
... | diogobaeder/envparser | tests/test_parser.py | Python | bsd-2-clause | 2,599 |
# coding:utf-8
from __future__ import unicode_literals
from django.views.generic import DetailView, CreateView, ListView, UpdateView
from django.http.response import HttpResponse
from django.utils import timezone
from django.http import HttpResponse
import datetime
import ujson
import json
from app.myblog.models impor... | bluedazzle/django-angularjs-blog | app/blog_lab/cbv/views.py | Python | bsd-2-clause | 2,594 |
import glob
import hashlib
import json
import os
from ..core import private
from ..interface import Plugin
from ..descriptors import Link, OwnerName
class BaseDataStore(Plugin):
pass
def iswritable(directory):
"""
Check if `directory` is writable.
Examples
--------
.. Run the code below i... | tkf/compapp | src/compapp/plugins/datastores.py | Python | bsd-2-clause | 7,725 |
#from interface.services.icontainer_agent import ContainerAgentClient
#from pyon.ion.endpoint import ProcessRPCClient
from ion.services.sa.test.helpers import any_old
from pyon.util.containers import DotDict
from pyon.util.int_test import IonIntegrationTestCase
from interface.services.sa.iinstrument_management_servi... | ooici/coi-services | ion/services/sa/test/test_find_related_resources.py | Python | bsd-2-clause | 13,097 |
# -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
import re
from .utils import normalize_whitespace
class Paragraph(object):
"""Object representing one block of text in HTML."""
def __init__(self, path):
self.dom_path = p... | pombredanne/jusText | justext/paragraph.py | Python | bsd-2-clause | 1,660 |
# -*- coding: utf-8 -*-
import 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 'Video.torrentDone'
db.add_column('portal_video', 'torrentDone',
self.g... | LambdaCast/LambdaCast | portal/migrations/0013_auto__add_field_video_torrentDone.py | Python | bsd-2-clause | 10,677 |
import ast
import tokenize
import io
import collections
import itertools
def rewrite_imports_in_module(source, top_level_names, depth):
source_lines = source.splitlines(True)
line_endings = list(_find_line_endings(source))
def _find_line_ending(position):
for line_ending in line_endings:
... | mwilliamson/python-vendorize | vendorize/import_rewrite.py | Python | bsd-2-clause | 4,390 |
# Copyright 2008-2015 Luc Saffre
# License: BSD (see file COPYING for details)
"""Choicelists for `lino_xl.lib.finan`.
"""
from lino.api import dd, _
# class VoucherStates(dd.Workflow):
# """The list of possible states for a voucher."""
# @classmethod
# def get_editable_states(cls):
# return [o... | khchine5/xl | lino_xl/lib/finan/choicelists.py | Python | bsd-2-clause | 792 |
# -*- coding: utf-8 -*-
from wtforms import Form, TextField, PasswordField, validators
class LoginForm(Form):
username = TextField('Username', [validators.Required()])
password = PasswordField('Password', [validators.Required()])
| fretscha/casimodo | forms.py | Python | bsd-2-clause | 240 |
import os
import sys
import subprocess
import multiprocessing
def command(args):
(arg, output_folder) = args
path, name = os.path.split(arg)
output_prefix = path.replace('/','_')
name, ext = os.path.splitext(name)
all_points = os.path.join(output_folder, '%s-%s-all-points.mat' % (output_prefix, name))
sco... | sameeptandon/sail-car-log | process/honda-label/LabelSingle.py | Python | bsd-2-clause | 1,210 |
import pytest
import osmium as o
def test_list_types():
ml = o.index.map_types()
assert isinstance(ml, list)
assert ml
@pytest.fixture
def table():
return o.index.create_map("flex_mem")
def test_set_get(table):
table.set(4, o.osm.Location(3.4, -5.6))
l = table.get(4)
assert l.lon == pyte... | osmcode/pyosmium | test/test_index.py | Python | bsd-2-clause | 849 |
import os
from alembic import config
from alembic import command
import pytest
from discode_server import app as app_
from discode_server import db as dbapi
@pytest.fixture(scope='function')
def app():
os.environ['DISCODE_CONFIG'] = 'discode_server/config/test.py'
command.upgrade(config.Config('alembic.ini'... | d0ugal/discode-server | discode_server/tests/conftest.py | Python | bsd-2-clause | 688 |
"""
WSGI config for etd_drop 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", "etd_drop.settings")
#Attempt to set... | MetaArchive/etd-drop | etd_drop/wsgi.py | Python | bsd-3-clause | 603 |
MaximalStaticDimension = 6
BuildFast = False
if BuildFast:
MaximalStaticDimension = 1
dims = ['Eigen::Dynamic']
dimTags = ['D']
for i in range(1, MaximalStaticDimension + 1):
dims.append(str(i))
dimTags.append(str(i))
#types = ['char','short','int','long','unsigned char', 'unsigned short', 'unsigned ... | ethz-asl/Schweizer-Messer | numpy_eigen/src/generator_config.py | Python | bsd-3-clause | 714 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
from django.views.generic import DetailView, FormView, TemplateView
from dynamic_forms.actions import action_registry
from dynamic... | uhuramedia/django-dynamic-forms | dynamic_forms/views.py | Python | bsd-3-clause | 4,771 |
from .oll import oll
VERSION = (0, 2, 1)
__version__ = "0.2.1"
__all__ = ["oll"]
| ikegami-yukino/oll-python | oll/__init__.py | Python | bsd-3-clause | 82 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('titles', '0002_auto_20141013_2232'),
('character', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | vivyly/fancastic_17 | fancastic_17/role/migrations/0001_initial.py | Python | bsd-3-clause | 1,171 |
# -*- coding: utf-8 -*-
import wx
from datetime import datetime
import db
_sMedFont = None
def MedFont():
global _sMedFont
if not _sMedFont:
_sMedFont = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
return _sMedFont
_sBigFont = None
def BigFont():
global _sBigFont
if not _sBigFont:
_sBigFont =... | arthurljones/bikechurch-signin-python | src/ui.py | Python | bsd-3-clause | 3,409 |
import logging
import numpy as np
from golem import DataSet
from golem.nodes import FeatMap, BaseNode
from ..utils import spectrogram, sliding_window
class TFC(BaseNode):
def __init__(self, nfft, win_step):
def tfc(x):
return np.dstack([spectrogram(x[:, ci], nfft, win_step)
for ci in range(x.shape... | breuderink/psychic | psychic/nodes/timefreq.py | Python | bsd-3-clause | 1,303 |
import json
import logging
import os
import socket
import StringIO
from time import time
import django
from django.conf import settings
from django.contrib.sites.models import Site
from django.http import (HttpResponsePermanentRedirect, HttpResponseRedirect,
HttpResponse, Http404)
from django.... | dbbhattacharya/kitsune | kitsune/sumo/views.py | Python | bsd-3-clause | 10,010 |
import unittest
from testlib import testutil, PygrTestProgram
import ConfigParser, sys, os, string
from pygr.mapping import Collection
import pygr.Data
try:
import hashlib
except ImportError:
import md5 as hashlib
config = ConfigParser.ConfigParser({'testOutputBaseDir' : '.', 'smallSampleKey': ''})
config.re... | ctb/pygr | tests/annotation_dm2_megatest.py | Python | bsd-3-clause | 29,345 |
"""
The I_min measure as proposed by Williams & Beer.
"""
import numpy as np
from ..pid import BasePID
__all__ = (
'PID_WB',
)
def s_i(d, source, target, target_value):
"""
Compute the specific mutual information I(source : target=target_value)
Parameters
----------
d : Distribution
... | dit/dit | dit/pid/measures/imin.py | Python | bsd-3-clause | 1,798 |
from django.contrib.sitemaps import Sitemap
from models import Post, Category, Series
class PostSitemap(Sitemap):
"""
Post sitemap
"""
def items(self):
return Post.published.all()
def lastmod(self, obj):
return obj.last_modified
class CategorySitemap(Sitemap):
"""
Cate... | davisd/django-blogyall | blog/sitemaps.py | Python | bsd-3-clause | 586 |
# -*- coding: utf8 -*-
from datetime import date, datetime, time
import isodate
from django.forms.widgets import Input
__all__ = 'ISO8601DateInput', 'ISO8601DatetimeInput', 'ISO8601TimeInput'
class ISO8601DateInput(Input):
input_type = 'text'
def __init__(self, attrs=None, format="%Y-%m-%d", yeardigits=4... | k0001/django-iso8601 | django_iso8601/widgets.py | Python | bsd-3-clause | 1,423 |
# -*- coding: utf-8 -*-
"""
© Copyright 2014-2015, by Serge Domkowski.
.. note::
This code includes a few modifications to rules in the FIQL draft.
The rule defined for ``Comparison`` has been modifed to deal with an
inconsistency in the draft documentation. The change fixes an issue where
the string... | sergedomk/fiql_parser | fiql_parser/__init__.py | Python | bsd-3-clause | 1,209 |
###############################################################################
# KingPotential.py: Potential of a King profile
###############################################################################
import numpy
from ..util import conversion
from .Force import Force
from .interpSphericalPotential import inte... | jobovy/galpy | galpy/potential/KingPotential.py | Python | bsd-3-clause | 2,587 |
from xml.dom.minidom import parseString
from xml.etree.ElementTree import tostring, SubElement, Element
from datetime import datetime
from dateutil.parser import parse
from api import XeroPrivateClient, XeroException
from api import XERO_BASE_URL, XERO_API_URL
import urllib
class XeroException404(XeroException):
p... | jaydlawrence/XeroPy | XeroPy/__init__.py | Python | bsd-3-clause | 9,848 |
"""
============================
Estimating Integration Error
============================
Objectives
----------
* Explain purpose of integration error
* Demonstrate integration error calculation procedure with PySPLIT
* Demonstrate another ``TrajectoryGroup``, ``Trajectory`` workflow tool
Intro
-----
Total traject... | mscross/pysplit | docs/examples/integration_error.py | Python | bsd-3-clause | 3,580 |
# -*- coding: utf-8 -*-
from django.test import SimpleTestCase
from corehq.apps.app_manager.exceptions import CaseXPathValidationError
from corehq.apps.app_manager.xpath import (
dot_interpolate,
UserCaseXPath,
interpolate_xpath,
)
class RegexTest(SimpleTestCase):
def test_regex(self):
replac... | qedsoftware/commcare-hq | corehq/apps/app_manager/tests/test_suite_regex.py | Python | bsd-3-clause | 2,212 |
"""
Look-ahead routines to find end character.
+------------------------------------------------------+------------------------+
| Function | Description |
+======================================================+========================+
| :py:func:`~matlab2cpp.tr... | jonathf/matlab2cpp | src/matlab2cpp/tree/findend.py | Python | bsd-3-clause | 10,363 |
import abc
import pathlib
import settings
import urllib.parse
def duplicate_path_fragments(url, dup_max=3):
path = urllib.parse.urlparse(url).path
parts = pathlib.Path(path).parts
segments = {}
for chunk in parts:
if not chunk in segments:
segments[chunk] = 0
segments[chunk] += 1
return any([tmp >= dup_ma... | fake-name/ReadableWebProxy | RawArchiver/ModuleBase.py | Python | bsd-3-clause | 2,588 |
import fipy
gmsh_text_box = '''
// Define the square that acts as the system boundary.
dx = %(dx)g;
Lx = %(Lx)g;
Ly = %(Ly)g;
p_n_w = newp; Point(p_n_w) = {-Lx / 2.0, Ly / 2.0, 0, dx};
p_n_e = newp; Point(p_n_e) = {Lx / 2.0, Ly / 2.0, 0, dx};
p_s_e = newp; Point(p_s_e) = {Lx / 2.0, -Ly / 2.0, 0, dx};
p_s_w = newp; P... | eddiejessup/ahoy | ahoy/mesh.py | Python | bsd-3-clause | 2,234 |
from bokeh.io import save
from bokeh.layouts import row
from bokeh.plotting import figure
def make_figure(output_backend):
p = figure(plot_width=400,
plot_height=400,
output_backend=output_backend,
title="Backend: %s" % output_backend)
p.circle(x=[1, 2, 3], y=[1, ... | ericmjl/bokeh | examples/integration/glyphs/frame_clipping_multi_backend.py | Python | bsd-3-clause | 593 |
# Copyright (c) 2014 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.
"""
This script is intended for use as a GYP_GENERATOR. It takes as input (by way of
the generator flag config_path) the path of a json file that dictates the file... | ryfx/gyp | pylib/gyp/generator/analyzer.py | Python | bsd-3-clause | 22,381 |
from datetime import datetime
from django.db import transaction
from django.http import Http404
from django.utils.translation import gettext_lazy as _
from corehq import toggles
from corehq.apps.registry.models import DataRegistry, RegistryInvitation, RegistryGrant, RegistryAuditLog
from corehq.apps.registry.signals ... | dimagi/commcare-hq | corehq/apps/registry/utils.py | Python | bsd-3-clause | 9,875 |
from distutils.core import setup
setup(name='scrapy-elasticsearch-bulk-item-exporter',
version='0.1',
license='Apache License, Version 2.0',
description='An extension of Scrapys JsonLinesItemExporter that exports to elasticsearch bulk format.',
author='Florian Gilcher',
author_email='flori... | skade/scrapy-elasticsearch-bulk-item-exporter | setup.py | Python | bsd-3-clause | 872 |
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['bwi_local'],
package_dir={'': 'src'})
setup(**setup_args)
| utexas-bwi/bwi_lab | bwi_local/setup.py | Python | bsd-3-clause | 307 |
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 = "MovingAverage", cycle_length = 12, transform = "RelativeDifference", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_12/ar_/test_artificial_1024_RelativeDifference_MovingAverage_12__100.py | Python | bsd-3-clause | 280 |
def iter_ngram(seq, max_order, min_order=None, sent_start=None, sent_end=None):
if min_order > max_order:
raise ValueError("min_order > max_order (%d > %d)" % (min_order, max_order))
if min_order is None:
min_order = max_order
orders = range(min_order, max_order+1)
it = iter(seq)
... | honzas83/kitchen | kitchen/utils.py | Python | bsd-3-clause | 1,451 |
import unittest
import numpy
import scipy.sparse
from pylearn2.testing.skip import skip_if_no_data
import pylearn2.datasets.utlc as utlc
def test_ule():
skip_if_no_data()
# Test loading of transfer data
train, valid, test, transfer = utlc.load_ndarray_dataset("ule", normalize=True, transfer=True)
ass... | KennethPierce/pylearnk | pylearn2/datasets/tests/test_utlc.py | Python | bsd-3-clause | 2,547 |
#-*- coding: utf-8 -*-
from nose.tools import raises
from pybonita import BonitaServer
from pybonita.tests import TestWithMockedServer, build_dumb_bonita_error_body,\
build_bonita_process_definition_xml
from pybonita.process import BonitaProcess
class TestGetProcess(TestWithMockedServer):
@classmethod
d... | julozi/pybonita | pybonita/tests/unit/process/test_process.py | Python | bsd-3-clause | 1,722 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# DOCS
# =============================================================================
"""Integration with Jupyter notebook
"""
# ===========================================================... | toros-astro/corral | corral/libs/notebook_extension.py | Python | bsd-3-clause | 526 |
"""
Usage:
# Instantiate with API host, username, and password:
>>> gc = GoodsCloudAPIClient(host="http://app.goodscloud.com", user="test@test.com", pwd="mypass")
# Then, do requests as follows:
>>> orders = gc.get(
>>> "internal/order",
>>> q=dict(filters=[dict(name="channel_id", op="eq", val=16)]), results_... | goodscloud/goodscloud-python | goodscloud_api_client/client.py | Python | bsd-3-clause | 7,983 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..minc import Dump
def test_Dump_inputs():
input_map = dict(annotations_brief=dict(argstr='-b %s',
xor=('annotations_brief', 'annotations_full'),
),
annotations_full=dict(argstr='-f %s',
xor=('annota... | mick-d/nipype | nipype/interfaces/minc/tests/test_auto_Dump.py | Python | bsd-3-clause | 1,765 |
import collections
from sympy import (
Abs, E, Float, I, Integer, Max, Min, N, Poly, Pow, PurePoly, Rational,
S, Symbol, cos, exp, oo, pi, signsimp, simplify, sin, sqrt, symbols,
sympify, trigsimp, sstr)
from sympy.matrices.matrices import (ShapeError, MatrixError,
NonSquareMatrixError, DeferredVector)... | Sumith1896/sympy | sympy/matrices/tests/test_matrices.py | Python | bsd-3-clause | 73,441 |
try:
from django.utils import timezone as datetime
except ImportError:
from datetime import datetime
from django.contrib.auth.models import Group
from django.contrib.sites.models import Site
from django.db import models
from waffle.compat import User
class Flag(models.Model):
"""A feature flag.
Fla... | TwigWorld/django-waffle | waffle/models.py | Python | bsd-3-clause | 4,814 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__doc__ = """Code by Benjamin S. Murphy
bscott.murphy@gmail.com
Dependencies:
numpy
scipy (scipy.optimize.minimize())
Functions:
_adjust_for_anisotropy(X, y... | basaks/PyKrige | pykrige/core.py | Python | bsd-3-clause | 20,431 |
#!/usr/bin/env python2.7
# NOTE THIS NEEDS 2.6 as parser breaks with 2.5 :-)
import warnings
warnings.simplefilter("ignore",DeprecationWarning)
import os, sys, re, urllib2, string, socket
import htmlentitydefs
import mechanize
import html5lib
from html5lib import treebuilders
import lxml.html, lxml.etree
from lxml.css... | OAButton/tricorder | plugins/python/sciencedirect.py | Python | bsd-3-clause | 7,168 |
# -*- coding: utf-8 -*-
''':class:`blade` mathing operations.'''
from math import fsum
from itertools import tee
from operator import truediv
from collections import deque, namedtuple
from stuf.six import next
from stuf.iterable import count
from stuf.collects import Counter
from .xslice import xslicer
Count = name... | lcrees/blade | blade/xmath.py | Python | bsd-3-clause | 3,615 |
"""Audit Services Classes."""
import logging
from .audit_records import AuditRecords
logging.debug("In the audit_services __init__.py file.")
__all__ = ["AuditRecords"]
| daxm/fmcapi | fmcapi/api_objects/audit_services/__init__.py | Python | bsd-3-clause | 172 |
# Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import RedirectView
admin.autodiscover()
urlpatterns = pa... | jmosky12/huxley | huxley/urls.py | Python | bsd-3-clause | 648 |
# Packet structure:
# 00 - 0011 0000 - Range
# 01 - 0011 0000 - Digit 4
# 02 - 0011 0000 - Digit 3
# 03 - 0011 0000 - Digit 2
# 04 - 0011 0000 - Digit 1
# 05 - 0011 0000 - Digit 0
# 06 - 0011 1011 - Function
# 07 - 0011 0000 - Status
# 08 - 0011 0000 - Option1
# 09 - 0011 0000 - Option2
# 10 - 0011 1010 - Option3
# 11 ... | g5pw/Miscellaneous | ReadMeter.py | Python | bsd-3-clause | 2,005 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-28 03:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('metadata', '0006_tag'),
]
operations = [
migrations.AddField(
m... | alphageek-xyz/site | metadata/migrations/0007_link_tags.py | Python | bsd-3-clause | 441 |
import os
import tempfile
import sys
from ..py30compat import unittest
from ..test_backend import BackendBasicTests
from ..util import random_string
from keyring.backends import file
class FileKeyringTests(BackendBasicTests):
def setUp(self):
super(FileKeyringTests, self).setUp()
self.keyring =... | robinson96/GRAPE | keyring/keyring/tests/backends/test_file.py | Python | bsd-3-clause | 1,593 |
# coding: utf-8
# PYTHON IMPORTS
import os, re
from types import MethodType
# DJANGO IMPORTS
from django.shortcuts import render_to_response, HttpResponse
from django.template import RequestContext as Context
from django.http import HttpResponseRedirect, HttpResponseBadRequest, Http404
from django.contrib.admin.views... | klueska/django-filebrowser | filebrowser/sites.py | Python | bsd-3-clause | 21,588 |
from django.forms import ValidationError
from cyder.cydns.domain.models import Domain
from cyder.cydns.views import CydnsCreateView
from cyder.cydns.views import CydnsDeleteView
from cyder.cydns.views import CydnsDetailView
from cyder.cydns.views import CydnsListView
from cyder.cydns.views import CydnsUpdateView
| ngokevin/cyder | cyder/cydns/nameserver/views.py | Python | bsd-3-clause | 315 |
#!/usr/bin/env python
##
## Copyright 2016 SRI International
## See COPYING file distributed along with the package for the copyright and license terms.
##
"""
Neuroradiology Findings
Script to sync and generate reports on findings from radiology readings
Examples
========
- Findings and Findings Date is empty bef... | abonil91/ncanda-data-integration | scripts/xnat/neurorad_findings.py | Python | bsd-3-clause | 11,460 |
r"""
Laplace equation with Dirichlet boundary conditions given by a sine function
and constants.
Find :math:`t` such that:
.. math::
\int_{\Omega} c \nabla s \cdot \nabla t
= 0
\;, \quad \forall s \;.
This example demonstrates how to use a hierarchical basis approximation - it
uses the fifth order Lobatt... | lokik/sfepy | examples/diffusion/sinbc.py | Python | bsd-3-clause | 3,897 |
import os
use_gpu = os.environ.get('USE_GPU', 'no')
assert use_gpu in ['auto', 'yes', 'no'], "environment variable USE_GPU, should be one of 'auto', 'yes', 'no'."
if use_gpu == 'auto':
try:
import cudamat as cm
use_gpu = 'yes'
except:
print 'Failed to import cudamat. Using eigenmat. No GPU will be used.... | kobiso/ControlledDropout | deepnet/choose_matrix_library.py | Python | bsd-3-clause | 503 |
import os
import windows
import windows.generated_def as gdef
from windows.debug import symbols
import argparse
parser = argparse.ArgumentParser(prog=__file__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--dbghelp', help='The path of DBG help to use (default use env:PFW_DBGHELP_PATH)'... | hakril/PythonForWindows | samples/debug/symbols/virtsymdemo.py | Python | bsd-3-clause | 2,138 |
# -*- coding: utf-8 -*-
# __author__ = chenchiyuan
from __future__ import division, unicode_literals, print_function
from models import Commodity, CommodityDay, CommodityInventory, CommodityProduct
from django.contrib import admin
class CommodityDayAdmin(admin.ModelAdmin):
pass
class CommodityPrivilegeAdmin(ad... | chenchiyuan/hawaii | hawaii/apps/commodity/admin.py | Python | bsd-3-clause | 1,226 |
"""
sentry.views.base
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from sentry.conf import settings
from sentry.utils import InstanceManager
__all__ = ('View',)
class View(object):
verbose_name = None
verbose_name_... | Kronuz/django-sentry | sentry/views/base.py | Python | bsd-3-clause | 489 |