code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from urllib import quote
from django.test import Client
from questionnaire.forms.assign_question import AssignQuestionForm
from questionnaire.models import Questionnaire, Section, SubSection, Question, Region, QuestionGroup
from questionnaire.models.skip_rule import SkipQuestion
from questionnaire.tests.base_test imp... | eJRF/ejrf | questionnaire/tests/views/test_assign_questions_view.py | Python | bsd-3-clause | 13,049 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
from __future__ import with_... | jcfr/mystic | setup.py | Python | bsd-3-clause | 12,858 |
#!/usr/bin/env python3
import os
print("root prints out directories only from what you specified")
print("dirs prints out sub-directories from root")
print("files prints out all files from root and directories")
print("*" * 20)
'''
for root, dirs, files in os.walk("/var/log"):
print('Root: '.format(root))
pr... | talapus/Ophidian | Academia/Filesystem/demo_os_walk.py | Python | bsd-3-clause | 483 |
_current_event = None
def get_current_event():
global _current_event
if not _current_event:
from sked.models import Event
_current_event = Event.objects.current()
return _current_event | sunlightlabs/tcamp | tcamp/sked/utils.py | Python | bsd-3-clause | 218 |
"""
WSGI config for django_tornado 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", "django_tornado.settings")
from... | vane/django_tornado | django_tornado/wsgi.py | Python | bsd-3-clause | 403 |
"""Set up logging"""
from vb2py import vbclasses
from vb2py import logger # For logging output and debugging
_vb_debug_log = logger.getLogger("vb2PyApp")
vbclasses.Debug._logger = _vb_debug_log
| mvz/vb2py | vb2py/vbdebug.py | Python | bsd-3-clause | 199 |
import sys
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from ...utils import get_indices, create_indices, rebuild_indices, delete_indices
try:
raw_input
except NameError:
raw_input = input
class Unbuffered(object):
def __init__(self, stream):
... | jaddison/django-simple-elasticsearch | simple_elasticsearch/management/commands/es_manage.py | Python | bsd-3-clause | 4,680 |
# -*- test-case-name: go.vumitools.tests.test_contact -*-
from uuid import uuid4
from datetime import datetime
from twisted.internet.defer import returnValue
from vumi.persist.model import Model, Manager
from vumi.persist.fields import (
Unicode, ManyToMany, ForeignKey, Timestamp, Dynamic)
from go.vumitools.acco... | praekelt/vumi-go | go/vumitools/contact/models.py | Python | bsd-3-clause | 16,310 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | davidsminor/gaffer | python/GafferImageTest/ImagePlugTest.py | Python | bsd-3-clause | 5,013 |
# django-offline-messages Test Settings
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'offline_messages',
'tests'
)
ROOT_URLCONF = ''
COVERAGE_AD... | themotleyfool/django-offline-messages | tests/settings.py | Python | bsd-3-clause | 361 |
from corehq.apps.users.models import DomainMembershipError
from django import template
from django.template.loader import render_to_string
from corehq.tabs.config import MENU_TABS
from corehq.tabs.exceptions import TabClassError, TabClassErrorSummary
from corehq.tabs.extension_points import uitab_classes
from corehq.t... | dimagi/commcare-hq | corehq/tabs/templatetags/menu_tags.py | Python | bsd-3-clause | 4,847 |
from mock import Mock
from nose import SkipTest
from nose.tools import eq_
import amo
import mkt.site.models
from amo.tests import app_factory, TestCase
from mkt.site import models as context
from mkt.site.models import manual_order
from mkt.webapps.models import Webapp
def test_ordering():
"""Given a specific s... | ngokevin/zamboni | mkt/site/tests/test_models.py | Python | bsd-3-clause | 4,443 |
#! /usr/bin/env python
# EPTOOLS Python Interface
# Test of quadrature implementation of EP updates. Laplace transformation
# and adaptive quadrature.
#
# Potential: Laplace. We compare the exact implementation with two
# different adaptive quadrature variants.
import numpy as np
import apbsint as abt
# Helper funct... | mseeger/apbsint | python/test/potentials/test_epup_quad_laplace.py | Python | bsd-3-clause | 4,711 |
"""
Scrapy - a web crawling and web scraping framework written for Python
"""
__all__ = ['__version__', 'version_info', 'twisted_version',
'Spider', 'Request', 'FormRequest', 'Selector', 'Item', 'Field']
# Scrapy version
import pkgutil
__version__ = pkgutil.get_data(__package__, 'VERSION').decode('ascii').... | eLRuLL/scrapy | scrapy/__init__.py | Python | bsd-3-clause | 1,151 |
from django.utils.functional import LazyObject
__version__ = '1.2.1'
default_app_config = 'constance.apps.ConstanceConfig'
class LazyConfig(LazyObject):
def _setup(self):
from .base import Config
self._wrapped = Config()
config = LazyConfig()
| pombredanne/django-constance | constance/__init__.py | Python | bsd-3-clause | 268 |
"""
reviewview.py
Contains administrative views for working with reviews.
"""
from admin_helpers import *
from flask import flash
from flask.ext.admin.actions import action
from flask.ext.admin.contrib.sqla import ModelView
from wtforms import IntegerField, validators
import remedy.rad.reviewservice
from remedy.rad.... | AllieDeford/radremedy | remedy/admin_views/reviewview.py | Python | bsd-3-clause | 4,932 |
import datetime
from django.contrib.auth import get_user_model
import factory
from .. import models
class UserFactory(factory.Factory):
class Meta:
model = get_user_model()
first_name = 'John'
last_name = 'Doe'
email = 'test@test.com'
class EventCountryFactory(factory.Factory):
class ... | hotsyk/conferencio | conferencio/event/tests/factories.py | Python | bsd-3-clause | 1,534 |
import json
from random import shuffle
from typing import Dict, List
import graphene
import pytest
from graphql_relay import from_global_id
from saleor.graphql.menu.mutations import NavigationType
from saleor.menu.models import MenuItem, Menu
from tests.api.utils import get_graphql_content
from .utils import assert_... | UITools/saleor | tests/api/test_menu.py | Python | bsd-3-clause | 20,972 |
#from __future__ import print_function
import ast
import os
import sys
import codecs
import subprocess
from fnmatch import fnmatchcase
from distutils.util import convert_path
from setuptools import setup, find_packages
def find_version(*parts):
try:
version_py = os.path.join(os.path.dirname(__file__), 'dj... | dalou/django-extended | setup.py | Python | bsd-3-clause | 2,148 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.form_processor.models import CaseTransaction
from corehq.sql_db.operations import RawSQLMigration, HqRunSQL
migrator = RawSQLMigration(('corehq', 'sql_accessors', 'sql_templates'), {
'TRANSACTION_TYPE_FOR... | qedsoftware/commcare-hq | corehq/sql_accessors/migrations/0025_update_get_ledger_values_for_cases.py | Python | bsd-3-clause | 703 |
# -*- coding: utf-8 -*-
""" Vented box enclosure """
import numpy as np
from . import air
class VentedBox(object):
""" Model a vented box loudspeaker enclosure """
def __init__(self, Vab, fb, Ql):
self._Vab = Vab
#: Acoustic compliance of box :math:`C_{ab}`
#:
#: .. note:: Do ... | Psirus/altay | altai/lib/vented_box.py | Python | bsd-3-clause | 1,632 |
# Copyright (c) 2014,Vienna University of Technology,
# Department of Geodesy and Geoinformation
# 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... | christophreimer/pytesmo | pytesmo/time_series/plotting.py | Python | bsd-3-clause | 6,133 |
# proxy module
from pyface.api import *
| enthought/etsproxy | enthought/pyface/api.py | Python | bsd-3-clause | 40 |
# -*- coding: utf-8 -*-
from django import VERSION
from django.db.models import F
from django.db.models.fields import FieldDoesNotExist
from django.db.models.query_utils import Q
from django.db.models.sql.constants import QUERY_TERMS
from django.db.models.sql.query import Query
from moneyed import Money
from .._compa... | rescale/django-money | djmoney/models/managers.py | Python | bsd-3-clause | 9,316 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..minc import Voliso
def test_Voliso_inputs():
input_map = dict(args=dict(argstr='%s',
),
avgstep=dict(argstr='--avgstep',
),
clobber=dict(argstr='--clobber',
usedefault=True,
),
environ=... | mick-d/nipype | nipype/interfaces/minc/tests/test_auto_Voliso.py | Python | bsd-3-clause | 1,379 |
from __future__ import print_function, division
import decimal
import fractions
import math
import re as regex
from collections import defaultdict
from .containers import Tuple
from .sympify import converter, sympify, _sympify, SympifyError
from .singleton import S, Singleton
from .expr import Expr, AtomicExpr
from .... | antepsis/anteplahmacun | sympy/core/numbers.py | Python | bsd-3-clause | 106,958 |
from django.conf.urls import patterns, url
from views import (AlbumListView, ImageListView, UpdateImage, UpdateAlbum, CreateImage, CreateAlbum, DeleteImage, \
DeleteAlbum, ImageView, AlbumList)
urlpatterns = patterns('imagestore.views',
url(r'^$', AlbumListView.as_view(), nam... | goldhand/art-portfolio | art-portfolio/imagestore/urls.py | Python | bsd-3-clause | 1,663 |
import glob
import math
import os
import sys
import warnings
from decimal import Decimal
import numpy as np
import pandas as pd
import pytest
from packaging.version import parse as parse_version
import dask
import dask.dataframe as dd
import dask.multiprocessing
from dask.blockwise import Blockwise, optimize_blockwis... | jakirkham/dask | dask/dataframe/io/tests/test_parquet.py | Python | bsd-3-clause | 129,660 |
# -*- coding:utf-8 -*-
from yepes.apps import apps
AbstractConfiguration = apps.get_class('thumbnails.abstract_models', 'AbstractConfiguration')
AbstractSource = apps.get_class('thumbnails.abstract_models', 'AbstractSource')
AbstractThumbnail = apps.get_class('thumbnails.abstract_models', 'AbstractThumbnail')
class... | samuelmaudo/yepes | yepes/contrib/thumbnails/models.py | Python | bsd-3-clause | 455 |
#!/usr/bin/env python
import sys
import importlib
import math
Unit = object()
World = object()
class IdrisError(Exception):
pass
def _idris_error(msg):
raise IdrisError(msg)
def _idris_pymodule(name):
return importlib.import_module(name)
def _idris_call(f, args):
return f(*list(args))
def _idris_foreach(... | nickgeoca/idris-py | examples/np.py | Python | bsd-3-clause | 80,549 |
# """
# ..
# >>> from djangorestframework.parsers import FormParser
# >>> from djangorestframework.compat import RequestFactory
# >>> from djangorestframework.views import View
# >>> from StringIO import StringIO
# >>> from urllib import urlencode
# >>> req = RequestFactory().get('/')
# >>> ... | seanfisk/buzzword-bingo-server | djangorestframework/tests/parsers.py | Python | bsd-3-clause | 7,768 |
import base64
import logging
from urllib import urlencode
from dateutil.tz import tzutc
import httplib2
from sharpy.exceptions import AccessDenied
from sharpy.exceptions import BadRequest
from sharpy.exceptions import CheddarError
from sharpy.exceptions import CheddarFailure
from sharpy.exceptions import NaughtyGatewa... | smartfile/sharpy | sharpy/client.py | Python | bsd-3-clause | 5,190 |
#!/usr/bin/env python
#-*- coding: utf-8 -*
import argparse
from lib.Parser import Parser
from lib.Vectorizer import Vectorizer
# 引数設定
parser = argparse.ArgumentParser()
parser.add_argument('menu')
parser.add_argument('in_path')
parser.add_argument('out_path', nargs='?')
def get_input():
pos = []
neg = []
... | smrmkt/sample_mecab_word2vec | corpus.py | Python | bsd-3-clause | 1,144 |
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test autotest_evaluator module."""
from __future__ import print_function
import os
from chromite.cros_bisect import autotest... | endlessm/chromium-browser | third_party/chromite/cros_bisect/autotest_evaluator_unittest.py | Python | bsd-3-clause | 24,070 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from sphinx_celery import conf
globals().update(conf.build_config(
'kombu', __file__,
project='Kombu',
version_dev='4.3',
version_stable='4.2',
canonical_url='http://docs.kombu.me',
webdomain='kombu.me',
githu... | pexip/os-kombu | docs/conf.py | Python | bsd-3-clause | 924 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | meghana0507/grpc-java-poll | lib/netty/protobuf/python/google/protobuf/internal/api_implementation.py | Python | bsd-3-clause | 4,621 |
from django.forms import CharField, ValidationError
from django.forms.fields import EMPTY_VALUES
import re, string
class TinyMCEField(CharField):
def clean(self, value):
"Validates max_length and min_length. Returns a Unicode object."
if value in EMPTY_VALUES:
return u''
... | saebyn/django-classifieds | classifieds/forms/fields.py | Python | bsd-3-clause | 1,278 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
u"""
===============================
Shimehari.session
~~~~~~~~~~~~~~~~~
セッション管理
===============================
"""
from datetime import datetime
from werkzeug.contrib.securecookie import SecureCookie
from werkzeug.contrib.sessions import SessionStore as Sessi... | glassesfactory/Shimehari | shimehari/session.py | Python | bsd-3-clause | 8,917 |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, Table, select
from sqlalchemy.types import Integer, PickleType, DateTime, Unicode
from webtools.database import Base
from webtools.utils import timezone
from .base import BaseSessionEngine
session = Table("webtools_session", Base.metadata,
Column("id", Inte... | niwinz/tornado-webtools | webtools/session/backend/database.py | Python | bsd-3-clause | 1,894 |
import json
from django.core.urlresolvers import reverse
from nose.tools import eq_, ok_
import mkt
from mkt.api.tests import BaseAPI
from mkt.api.tests.test_oauth import RestOAuth
from mkt.site.fixtures import fixture
from mkt.site.tests import ESTestCase, app_factory
from mkt.tvplace.serializers import (TVAppSeria... | washort/zamboni | mkt/tvplace/tests/test_views.py | Python | bsd-3-clause | 2,926 |
import factory
from councils.tests.factories import CouncilFactory
from pollingstations.models import PollingStation, PollingDistrict
class PollingStationFactory(factory.django.DjangoModelFactory):
class Meta:
model = PollingStation
council = factory.SubFactory(CouncilFactory)
internal_council_i... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/pollingstations/tests/factories.py | Python | bsd-3-clause | 591 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... | WalkingMachine/sara_behaviors | sara_flexbe_behaviors/src/sara_flexbe_behaviors/init_sequence_sm.py | Python | bsd-3-clause | 2,331 |
# Copyright (c) 2010 by California Institute of Technology
# Copyright (c) 2012 by Delft University of Technology
# 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... | murrayrm/python-control | control/frdata.py | Python | bsd-3-clause | 26,326 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module contains some variables settings for COCO.
These variables are used for producing figures and tables
in rungeneric1, -2, and -many.
For setting variables dynamically see config.py, where some
of the variables here and some
"""
import numpy as np
test... | PyQuake/earthquakemodels | code/cocobbob/coco/code-postprocessing/cocopp/genericsettings.py | Python | bsd-3-clause | 16,876 |
import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from django.cor... | aino/django-pagebase | pagebase/templatetags/pagebase_admin_list.py | Python | bsd-3-clause | 13,615 |
from __future__ import division
import itertools
from enum import Enum
import numpy as np
import amnet
from amnet.util import Relation
import z3
################################################################################
# Classes and routines related to Multiplexing Programming with AMNs
######################... | ipapusha/amnet | amnet/opt.py | Python | bsd-3-clause | 13,435 |
#!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
"""
Post GitHub Issues
------------------
Take the stdout and stderr passed to the catch_output_email and create an issue
on GitHub that uses a tag corresponding to the s... | nicholsn/ncanda-data-integration | scripts/crond/post_github_issues.py | Python | bsd-3-clause | 7,944 |
#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list ... | stephenlienharrell/roster-dns-management | roster-core/roster_core/db_access.py | Python | bsd-3-clause | 41,336 |
#-*- coding: utf8
from __future__ import division, print_function
__all__ = ['parser']
| flaviovdf/phoenix | phoenix/basic_io/__init__.py | Python | bsd-3-clause | 88 |
import graphene
from graphene_django import DjangoObjectType
from graphene_django.debug import DjangoDebug
from pontoon.api.util import get_fields
from pontoon.base.models import (
Project as ProjectModel,
Locale as LocaleModel,
ProjectLocale as ProjectLocaleModel
)
class Stats(graphene.AbstractType):
... | mastizada/pontoon | pontoon/api/schema.py | Python | bsd-3-clause | 3,806 |
"""
Paver for setting up basic geo web stack
"""
from paver.easy import *
try:
import eventlet.util
eventlet.util.wrap_socket_with_coroutine_socket()
except ImportError:
info("Socket not overridden")
from functools import wraps, update_wrapper
from paver.setuputils import setup
from paver.tasks import Task... | whitmo/loaf | pavement.py | Python | bsd-3-clause | 18,820 |
__author__ = 'kernel-72'
from mongoengine import InvalidQueryError, NotUniqueError
from tastypie.authentication import MultiAuthentication, Authentication, SessionAuthentication
from tastypie.authorization import Authorization
from tastypie.bundle import Bundle
from tastypie.exceptions import BadRequest, NotFound
from... | kernel72/tastypie-mongoengine-resource | tastypieMongoengineResource.py | Python | bsd-3-clause | 4,975 |
from django.contrib import admin
from xformmanager.models import *
class FormDefModelAdmin(admin.ModelAdmin):
list_display = ('id','uploaded_by', 'domain', 'form_display_name','form_name', 'submit_time',)
list_filter = ["domain"]
class MetaDataModelAdmin(admin.ModelAdmin):
list_display = ( 'fo... | commtrack/temp-aquatest | apps/xformmanager/admin.py | Python | bsd-3-clause | 817 |
#!/usr/bin/env python
# Copyright 2014 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.
# Modifications Copyright 2017 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "Licens... | youtube/cobalt | cobalt/tools/gyp_to_gn.py | Python | bsd-3-clause | 28,277 |
#coding: utf-8
import sys
sys.path.append("/opt/UD2/lib/afslib")
import afslib
vos = afslib.VolumeServer()
# for vol in vos.volumes:
# print vol
print vos
print "Fileservers : %s " % str(vos.fileserv)
testvol = ("testvolume", "urz-mars.urz.unibas.ch", "/vicepa")
vos.create(testvol)
import os
print(os.po... | spahan/unixdmoain | lib/afslib/tests/vos.py | Python | bsd-3-clause | 376 |
def extractMyTranslations(item):
"""
Parser for 'My Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=fr... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractMyTranslations.py | Python | bsd-3-clause | 355 |
# Usage: fab <instance> <options> <action>
# e.g. fab devel deploy
# In case of "No settings_XXX present" ImportError, try setting
# "PYTHONPATH" environment variable value to current directory,
# i.e. "PYTHONPATH=. fab ch deploy"
#
# Instances: live (default)
#
# Options:
# * email: se... | lucasvo/fabfile-template | fabfile.py | Python | bsd-3-clause | 13,486 |
from __future__ import absolute_import, print_function, division
import theano
import numpy as N
from theano import tensor as T
from theano.tensor import nnet as NN
from six.moves import xrange
from theano.compile import module as M
class RegressionLayer(M.Module):
def __init__(self, input = None, target = None, r... | JazzeYoung/VeryDeepAutoEncoder | benchmark/regression/regression.py | Python | bsd-3-clause | 5,237 |
# 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.
import logging
import unittest
from infra_libs.logs import logs
class InfraFilterTest(unittest.TestCase):
def test_infrafilter_adds_correct_fields(self)... | nicko96/Chrome-Infra | infra_libs/logs/test/logs_test.py | Python | bsd-3-clause | 1,197 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainWindow.ui'
#
# Created: Fri Sep 25 14:24:01 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_mainWindow(object):
def setupU... | JeffHoogland/mtg-totals | Qt/ui_mainWindow.py | Python | bsd-3-clause | 13,255 |
from .base import *
DEBUG = True
EMAIL_BACKEND = 'nr.sendmailemailbackend.EmailBackend' | shafiquejamal/socialassistanceregistry | nr/nr/settings/testinserver.py | Python | bsd-3-clause | 88 |
'''
Simple parser that extracts a webpage's content and hyperlinks.
'''
import urllib2
import re
class Parser():
def __init__(self):
pass
def parse(self, url):
f = urllib2.urlopen(url)
text = f.read() # get page's contents.
#use re.findall to get all the links
... | nyu-dl/WebNav | simple_parser.py | Python | bsd-3-clause | 399 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import sys
import signal
import argparse
import numpy as np
np.set_printoptions(precision=3, suppress=True)
np.set_printoptions(formatter={'float': '{: 0.3f}'.format})
# see: http://stackoverflow.com/questions/2891790/pretty-printing-of-num... | decabyte/vehicle_core | scripts/pilot_cli.py | Python | bsd-3-clause | 5,387 |
from icash import *
from jflow.utils.observer import lazyvalue
class singlecash(icash):
'''
Simple cash flow.
Date, currency and dummy implementation
'''
def __init__(self, date = None, dummy = False, ccy = None):
self.__date = date
if self.__date == None:
... | lsbardel/flow | flow/finance/cashflow/cash.py | Python | bsd-3-clause | 1,829 |
#!/usr/bin/env python
#
# Copyright (c) 2007-2009 Corey Goldberg (corey@goldb.org)
# License: GNU GPLv3
#
#
# This file is part of Pylot.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | Xavierwei/porsche_lemans | web/api/performance/util/pylot_win_recorder.py | Python | mit | 1,833 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import posixpath
import time
from collections import OrderedDict
... | mvidalgarcia/indico | indico/modules/events/registration/models/registrations.py | Python | mit | 22,495 |
import glob
import logging
import os
import shutil
from threading import Thread, Lock
class ClientFiles:
"""Processes the clients files to be moved etc"""
def __init__(self, settings, clients):
self.settings = settings
self.clients = clients
# Logging
self._logger = logging.... | Codex-/Octo-SFTP | OctoSFTP/file.py | Python | mit | 4,433 |
# This file is part of beets.
# Copyright 2011, Adrian Sampson.
#
# 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, including
# without limitation the rights to use, copy, ... | mclearc/beets | test/test_mediafile_basic.py | Python | mit | 12,027 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import os
from logging import getLogger
from flexget import plugin
from flexget.event import event
from flexget.utils import requests
from flexget.utils.soup import get_so... | LynxyssCZ/Flexget | flexget/plugins/output/utorrent.py | Python | mit | 6,154 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_01_01_preview/operations/__init__.py | Python | mit | 640 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/packet_capture_result_paged.py | Python | mit | 987 |
# encoding: 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 model 'DesignerTextPromptQuestion'
db.create_table('smartgrid_design_designertextpromptquestion',... | jtakayama/makahiki-draft | makahiki/apps/widgets/smartgrid_design/migrations/0001_initial.py | Python | mit | 15,933 |
#!/usr/bin/python
import json
import requests
import os
import argparse
import types
RACKHD_URL = 'http://localhost:8080'
class RackhdInventory(object):
def __init__(self, nodeids):
self._inventory = {}
for nodeid in nodeids:
self._load_inventory_data(nodeid)
inventory = {}
... | abtreece/ansible | contrib/inventory/rackhd.py | Python | mit | 2,357 |
"""
Unit tests for the part model database migrations
"""
from django_test_migrations.contrib.unittest_case import MigratorTestCase
from InvenTree import helpers
class TestForwardMigrations(MigratorTestCase):
"""
Test entire schema migration sequence for the part app
"""
migrate_from = ('part', hel... | inventree/InvenTree | InvenTree/part/test_migrations.py | Python | mit | 1,487 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('inventory', '0005_remove_distribution_validation_extension'),
]
operations = [
migrations.RenameField(
model_nam... | opennorth/inventory | inventory/migrations/0006_auto_20150217_2002.py | Python | mit | 1,132 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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, including without limitation the rights
# to use, copy, modify, merge, publ... | sidzan/netforce | netforce_mfg/netforce_mfg/models/bom.py | Python | mit | 3,042 |
#!/usr/bin/env python
#
# GrovePi Example for using the Grove - I2C ADC(http://www.seeedstudio.com/depot/Grove-I2C-ADC-p-1580.html)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? Ask o... | penoud/GrovePi | Software/Python/grove_i2c_adc/i2c_adc_example.py | Python | mit | 1,840 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import copy
import glob
import json
import os
import unittest
from pymatgen import Molecule
from pymatgen.io.qchem import QcTask, QcInput, QcOutput
from pymatgen.util.t... | aykol/pymatgen | pymatgen/io/tests/test_qchem.py | Python | mit | 81,842 |
import pkgutil
from collections import OrderedDict
import dedupe.variables
import dedupe.variables.base as base
from dedupe.variables.base import MissingDataType
from dedupe.variables.interaction import InteractionType
for _, module, _ in pkgutil.iter_modules(dedupe.variables.__path__,
... | nmiranda/dedupe | dedupe/datamodel.py | Python | mit | 4,180 |
"""Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions a... | ericlink/adms-server | playframework-dist/play-1.1/python/Lib/distutils/sysconfig.py | Python | mit | 19,643 |
# -*- encoding: utf8 -*-
import os
brown = os.path.join(os.path.dirname(__file__), 'english-brown.txt')
cmudict = os.path.join(os.path.dirname(__file__), 'english-cmudict.dx1')
| jacksonllee/lxa5 | linguistica/datasets/__init__.py | Python | mit | 179 |
"""
Smart Symbols.
pymdownx.smartsymbols
Really simple plugin to add support for:
copyright, trademark, and registered symbols
plus/minus, not equal, arrows via:
copyright = `(c)`
trademark = `(tm)`
registered = `(r)`
plus/minus = `+/-`
care/of = `c/o`
fractions = `1/2` etc.
... | facelessuser/sublime-markdown-popups | st3/mdpopups/pymdownx/smartsymbols.py | Python | mit | 5,483 |
from setuptools import setup, find_packages
exec(open('omniture/version.py').read())
setup(name='omniture',
description='A wrapper for the Adobe Analytics (Omniture and SiteCatalyst) web analytics API.',
long_description=open('README.md').read(),
author='Stijn Debrouwere',
author_email='stijn@s... | kristofvanmoffaert/python-omniture | setup.py | Python | mit | 1,204 |
# # Licensed under an MIT open source license - see LICENSE
# from __future__ import print_function, absolute_import, division
# import pytest
# import warnings
# from ..statistics import Mahalanobis, Mahalanobis_Distance
# from ..statistics.stats_warnings import TurbuStatTestingWarning
# from ._testing_data import d... | e-koch/TurbuStat | turbustat/tests/test_mahalanobis.py | Python | mit | 1,382 |
"""
The following functions provide a set of utilities for working with `Dependent`
and collections of `Dependent`.
* :func:`~revscoring.dependencies.solve` provides basic dependency solving
* :func:`~revscoring.dependencies.expand` provides minimal expansion of
dependency trees
* :func:`~revscoring.dependencies.dig... | wiki-ai/revscoring | revscoring/dependencies/functions.py | Python | mit | 10,779 |
"""
Math functions.
"""
from __future__ import absolute_import, division
import fractions
__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright 2013, The Materials Virtual Lab'
__version__ = '0.1'
__maintainer__ = 'Shyue Ping Ong'
__email__ = 'ongsp@ucsd.edu'
__date__ = '8/6/14'
def gcd(*numbers):
"""
Re... | yanikou19/monty | monty/fractions.py | Python | mit | 879 |
# -*- coding: utf-8 -*-
"""
二叉树节点类
"""
import sys
class BinTNode(object):
def __init__(self, dat, left=None, right=None):
self.data = dat
self.left = left
self.right = right
def count_BinTNode(t):
"""统计二叉树的节点
@t 一颗二叉树"""
if t is None:
return 0
else:
return 1... | basicworld/py_structure | chap6_haffman/bin_tnode.py | Python | mit | 3,231 |
__all__ = ['VectorMath','InteractionObjects','Keybindings','Robot','Coroutines','Test_Callbacks'] | DemonSheep/LeapMotionUserInterfaceAssets | lib/__init__.py | Python | mit | 97 |
# coding=utf-8
"""
The Collector class is a base class for all metric collectors.
"""
import os
import socket
import platform
import logging
import configobj
import traceback
import time
from diamond.metric import Metric
# Detect the architecture of the system and set the counters for MAX_VALUES
# appropriately. Ot... | datafiniti/Diamond | src/diamond/collector.py | Python | mit | 13,380 |
# -*- coding: utf-8 -*-
from time import sleep
from threading import Thread
class Poller(Thread):
def __init__(self, gui, delay=5):
if delay < 1:
delay = 1
self.gui = gui
self.delay = delay
self.is_running = True
self.counter = 0
super(Poller, self).__i... | socketubs/pyhn | pyhn/poller.py | Python | mit | 568 |
from mycli.packages.tabulate import tabulate
from textwrap import dedent
def test_dont_strip_leading_whitespace():
data = [[' abc']]
headers = ['xyz']
tbl, _ = tabulate(data, headers, tablefmt='psql')
assert tbl == dedent('''
+---------+
| xyz |
|---------|
| ... | spencervillars/AutoSchema | tests/test_tabulate.py | Python | mit | 360 |
'''
Report tool
===========
This tool is a helper for users. It can be used to dump information
for help during the debugging process.
'''
import os
import sys
from time import ctime
from configparser import ConfigParser
from io import StringIO
import kivy
report = []
report_dict = {} # One key value pair for eac... | andnovar/kivy | kivy/tools/report.py | Python | mit | 5,809 |
from django.conf.urls import url
from .views import (
global_search_views,
)
# Global search URLs
urlpatterns = [
url(
r'^$',
global_search_views['GlobalSearchListAPIView'].as_view(),
name='global_search_list'
),
]
| nkoech/trialscompendium | trialscompendium/search/api/urls.py | Python | mit | 252 |
"""
__authors__ = Yash, Will, Peter
__description__ = Global variables for the Python files (largely for
doing organization) for segmentation
"""
# ------------------------------ Directory variables -----------------------------
INPUT_DIR = "app/segment/audio"
OUTPUT_DIR = "app/segment/output"
# ----------------... | yashpatel5400/synalyze | app/segment/settings.py | Python | mit | 420 |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum.util import base_units_list
from electrum.i18n import languages
from electrum.gui.kivy.i18n import _
from electrum.plugin import run_hook
from electrum import coinchooser
fr... | cryptapus/electrum | electrum/gui/kivy/uix/dialogs/settings.py | Python | mit | 9,722 |
#!/bin/sh
#
# A script for turning a generic Ubuntu system into a master for
# SCons development.
import getopt
import sys
from Command import CommandRunner, Usage
INITIAL_PACKAGES = [
'subversion',
]
INSTALL_PACKAGES = [
'wget',
]
PYTHON_PACKAGES = [
'g++',
'gcc',
'make',
'zlib1g-dev',
]
... | EmanueleCannizzaro/scons | bin/scons_dev_master.py | Python | mit | 5,698 |
from __future__ import unicode_literals, division, absolute_import
from flexget.utils.soup import get_soup
class TestHtml5Lib(object):
config = 'tasks: {}'
def test_parse_broken(self, execute_task):
s = """<html>
<head><title>Foo</title>
<body>
<p class=foo><b>Some Text</b>
<p><em>Some Other Text</e... | antivirtel/Flexget | tests/test_html5lib.py | Python | mit | 689 |
#
# Currently we don't do multi-lingual support
#
# See router.example.py for language customization hints
#
# To INSTALL: copy this file to youe base web2py installation:
# ./web2py/routes.py
# Then restart your server deployment ( web2py, apache w/mod_wsgi )
#
routers = dict(
BASE = dict(default_application... | tsunam/dotd_parser | routes.production-mode.py | Python | mit | 339 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/crafted/capacitor/shared_basic_capacitor.iff"
result.attribute... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/crafted/capacitor/shared_basic_capacitor.py | Python | mit | 472 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/attachment/weapon/shared_xwing_weapon1_neg_s01_1.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/attachment/weapon/shared_xwing_weapon1_neg_s01_1.py | Python | mit | 471 |