code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from .interface import CLI
__version__ = "0.1.0"
__all__ = ('interface', 'tasks', 'utils', 's3', 'vagrant', 'virtualbox')
| neuroticnerd/boxbox | boxbox/__init__.py | Python | bsd-3-clause | 125 |
# test_field.py
#
# Copyright 2017 Daniel Mende <mail@c0decafe.de>
#
# 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 th... | ernw/dizzy | dizzy/tests/test_field.py | Python | bsd-3-clause | 3,596 |
"""
Interactive Crossfilter
=======================
This example shows a multi-panel view of the same data, where you can interactively
select a portion of the data in any of the panels to highlight that portion in any
of the other panels.
"""
# category: interactive charts
import altair as alt
from vega_datasets impor... | jakevdp/altair | altair/examples/interactive_layered_crossfilter.py | Python | bsd-3-clause | 1,136 |
'''
The tests in this package are to ensure the proper resultant dtypes of
set operations.
'''
import itertools as it
import numpy as np
import pytest
from pandas.core.dtypes.common import is_dtype_equal
import pandas as pd
from pandas import Int64Index, RangeIndex
from pandas.tests.indexes.conftest import indices_l... | cbertinato/pandas | pandas/tests/indexes/test_setops.py | Python | bsd-3-clause | 2,362 |
from flask import url_for
from flask_sqlalchemy import BaseQuery
def test_create_av_scan(client, monkeypatch, malware_sample):
monkeypatch.setattr(BaseQuery, 'first_or_404', lambda x: True)
rv = client.post(url_for('api.add_av_scan'),
json={'files': [malware_sample._asdict()]})
assert... | certeu/do-portal | tests/test_av.py | Python | bsd-3-clause | 343 |
"""
Simple entity system: any renderable Object can have
a number of Components attached.
"""
import math
import algebra
class Object:
"""
This is a generic object: the player, a monster, an item, the stairs...
It's always represented by a character on screen.
"""
def __init__(self, pos, char, nam... | Naburimannu/libtcodpy-tutorial | components.py | Python | bsd-3-clause | 4,487 |
#
# PgHelp.py -- web application threading help routines.
#
# 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 tornado.web
import tornado.websocket
import tornado.tem... | rupak0577/ginga | ginga/web/pgw/PgHelp.py | Python | bsd-3-clause | 6,284 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from framework import api_select
def create_jobs(api_type):
api = api_select.api(__file__, api_type)
api.flow_job()
api.job('passwd_args', exec_time=0.5, max_fails=0, e... | lhupfeldt/jenkinsflow | demo/jobs/hide_password_jobs.py | Python | bsd-3-clause | 545 |
import abc
class PluginTypeBase(object):
""" Baseclass for plugin types.
This needs to be derived from in order for plugin types to
be accepted by plugz.
"""
__metaclass__ = abc.ABCMeta
plugintype = None
@staticmethod
def is_valid_file(file):
""" Accept or reject files as va... | mistermatti/plugz | plugz/plugz.py | Python | bsd-3-clause | 373 |
import numpy as np
from . import evaluate
from skimage import color
from matplotlib import cm, pyplot as plt
import itertools as it
from math import ceil
###########################
# VISUALIZATION FUNCTIONS #
###########################
def imshow_grey(im, axis=None):
"""Show a segmentation using a gray colormap... | jni/gala | gala/viz.py | Python | bsd-3-clause | 19,050 |
from RPi import GPIO
from w1thermsensor import W1ThermSensor
import energenie
from datetime import datetime, timedelta
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
class Chef(object):
"""
Provides an implementation of temperature moderation for use in sous vide
cooking with the ... | bennuttall/chef-hat | chef_hat/chef_hat.py | Python | bsd-3-clause | 12,834 |
#! /usr/bin/env python
from zplot import *
# populate zplot table from data file
t = table('verticalbars.data')
# create the postscript file we'll use as our canvas
canvas = svg('verticalbars.svg')
# on the x-axis, we want categories, not numbers. Thus, we
# determine the number of categories by checking the max
#... | z-plot/z-plot | examples/basics-svg/verticalbars.py | Python | bsd-3-clause | 2,343 |
try:
from boxe_clock.apps.android_app import BoxingApp
except ImportError:
from boxe_clock.apps.generic_app import BoxingApp
def main():
BoxingApp().run()
if __name__ == "__main__":
main()
| zedr/boxing-clock | src/main.py | Python | bsd-3-clause | 209 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import requests
from bs4 import BeautifulSoup
import re
import six
from libulb.tools import Slug
class Course:
def __init__(self, slug, year, infos):
self.slug = slug
self.year = year
self._fill(infos)
... | C4ptainCrunch/libulb | libulb/catalog/course.py | Python | bsd-3-clause | 3,809 |
"""
"Flash" messaging support.
A "flash" message is a message displayed on a web page that is removed next
request.
"""
__all__ = ['add_message', 'get_messages', 'get_flash',
'flash_middleware_factory']
import itertools
import webob
from wsgiapptools import cookies
ENVIRON_KEY = 'wsgiapptools.flash'
C... | ish/wsgiapptools | wsgiapptools/flash.py | Python | bsd-3-clause | 3,252 |
import components
def AclContentCacheTest ():
"""ACL content cache test"""
ctx = components.Context (['a', 'b', 'c', 'd', 'cc', 'f'],\
['ip_a', 'ip_b', 'ip_c', 'ip_d', 'ip_cc', 'ip_f'])
net = components.Network (ctx)
a = components.EndHost(ctx.a, net, ctx)
b = componen... | apanda/modeling | tests/examples/AclContentCacheTest.py | Python | bsd-3-clause | 1,990 |
import numpy as np
import pytest
import pandas as pd
from pandas import Timedelta
import pandas._testing as tm
from pandas.core import nanops
from pandas.core.arrays import TimedeltaArray
class TestTimedeltaArrayConstructor:
def test_only_1dim_accepted(self):
# GH#25282
arr = np.array([0, 1, 2, 3... | jreback/pandas | pandas/tests/arrays/test_timedeltas.py | Python | bsd-3-clause | 12,380 |
from __future__ import unicode_literals
import difflib
from django import template
register = template.Library()
@register.simple_tag
def diff_table(a, b, line_split="\n"):
differ = difflib.HtmlDiff(wrapcolumn=80)
try:
return differ.make_table(a.split(line_split), b.split(line_split))
except Att... | emergence/django-simple-history | simple_history/templatetags/simple_history_compare.py | Python | bsd-3-clause | 1,074 |
import unittest
import openmesh
import numpy as np
class TriMeshCirculatorFaceVertex(unittest.TestCase):
def setUp(self):
self.mesh = openmesh.TriMesh()
# Add some vertices
self.vhandle = []
self.vhandle.append(self.mesh.add_vertex(np.array([0, 1, 0])))
self.vhandle.appe... | TinyTinni/OF_Plugin-PyMesh | openmesh-python/tests/test_trimesh_circulator_face_vertex.py | Python | bsd-3-clause | 1,723 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from certproxy.certproxy import run
if __name__ == '__main__':
run()
| geneanet/certproxy | main.py | Python | bsd-3-clause | 118 |
# -*- coding: utf-8 -*-
"""
Display X selection.
Configuration parameters:
cache_timeout: refresh interval for this module (default 0.5)
command: the clipboard command to run (default 'xsel -o')
format: display format for this module (default '{selection}')
max_size: strip the selection to this value (... | docwalter/py3status | py3status/modules/xsel.py | Python | bsd-3-clause | 1,642 |
# -*- coding: utf-8 -*-
# This coding header is significant for tests, as the debug view is parsing
# files to search for such a header to decode the source file content
from __future__ import absolute_import, unicode_literals
import inspect
import os
import sys
from django.conf import settings
from django.core impor... | blaze33/django | tests/regressiontests/views/tests/debug.py | Python | bsd-3-clause | 22,564 |
# -*- coding: utf-8 -*-
import os
import logging
from wtforms import TextField, validators
from trytond.pool import PoolMeta, Pool
from trytond.modules.nereid.party import AddressForm
from trytond.config import config
from nereid import request, current_app, current_user
from trytond.modules.nereid_checkout.i18n impo... | fulfilio/nereid-webshop | party.py | Python | bsd-3-clause | 3,061 |
# -*- coding: utf-8 -*-
"""
Package of failing integer functions.
"""
from metaopt.objective.integer.failing.f import f as f
from metaopt.objective.integer.failing.g import f as g
FUNCTIONS_FAILING = [f, g]
| cigroup-ol/metaopt | metaopt/objective/integer/failing/__init__.py | Python | bsd-3-clause | 209 |
from utile import pretty_xml, xml_to_dict, element_to_dict
from testsuite.support import etree, TestCase
import unittest
XML_DATA = "<html><body><h1>test1</h1><h2>test2</h2></body></html>"
XML_PRETTY = """\
<html>
<body>
<h1>test1</h1>
<h2>test2</h2>
</body>
</html>
"""
XML_DICT = {'body': {'h2': 'test2',... | marwano/utile | testsuite/test_xml.py | Python | bsd-3-clause | 709 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import simplejson as json
import tweepy
import bitly
import urllib2
import sqlite3
from local_settings import TwitterKey, BitlyKey
logging.basicConfig(filename='log.txt', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
def run():
... | chrishan/twitter-bot | twitter-bot/twitter-bot.py | Python | bsd-3-clause | 2,563 |
import mykde
class ActionPackage(mykde.ActionPackage):
author = 'Victor Varvaryuk <victor.varvariuc@gmail.com>'
version = 2
description = """
TODO:
xnview - unpack to ~/apps/ and create .desktop file in Graphics category
clip2net
galaxy icons libreoffice, enter key behavior in calc
"""
| warvariuc/mykde | packages/__init__.py | Python | bsd-3-clause | 301 |
"""
2.3.4: If `x` is not an object or function, fulfill `promise` with `x`
https://github.com/promises-aplus/promises-tests/blob/2.1.1/lib/tests/2.3.4.js
"""
from test.promises.helpers import generate_fulfilled_test_case, generate_rejected_test_case
dummy = {'dummy': 'dummy'}
sentinel = {'sentinel': 'sentinel'}
def ... | MeerkatLabs/sleekpromises | test/promises/test_2_3_4.py | Python | bsd-3-clause | 7,323 |
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 = "PolyTrend", cycle_length = 30, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_PolyTrend/cycle_30/ar_12/test_artificial_128_Logit_PolyTrend_30_12_0.py | Python | bsd-3-clause | 261 |
import datetime
import importlib
import os
from urlparse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.http import HttpResponse, Http404
from django.shortcuts import render
import jingo
import jinja2
import newrelic.agent
import waffle
f... | andymckay/zamboni | mkt/commonplace/views.py | Python | bsd-3-clause | 4,032 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import random
from django.conf import settings
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Page
from wagtail.wagtailimages.models import get_image_model
from privagal.gallery.factories import Gal... | ychab/privagal | privagal/core/management/commands/genfactories.py | Python | bsd-3-clause | 1,893 |
import Logger
import os
# The following five lines of code MUST ABSOLUTELY appear in this order. DO NOT MOVE OR CHANGE THE FOLLOWING FOUR LINES OF CODE.
# Logger.initPins() Should never be called by the user. It should only be called when this script is automatically run.
Logger.init() # Initialzie the Logger Pytho... | UCHIC/WaterMonitor | Current_Designs/Computational_Datalogger/Software/template.py | Python | bsd-3-clause | 1,582 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 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.
"""Unit tests for cros_mark_as_stable.py."""
from __future__ import print_function
import os
import sys
import mock
from c... | endlessm/chromium-browser | third_party/chromite/scripts/cros_mark_as_stable_unittest.py | Python | bsd-3-clause | 16,033 |
"""
Classes that define how vector spaces are formatted
Most of our models can be viewed as linearly transforming
one vector space to another. These classes define how the
vector spaces should be represented as theano/numpy
variables.
For example, the VectorSpace class just represents a
vector space with a vector, an... | KennethPierce/pylearnk | pylearn2/space/__init__.py | Python | bsd-3-clause | 85,589 |
from plata.payment.modules import cod
from django.shortcuts import redirect
from feincms.content.application.models import app_reverse
class CodPaymentProcessor(cod.PaymentProcessor):
def redirect(self, url_name):
return redirect(app_reverse(url_name,
'simpleshop.urls')) | sbaechler/simpleshop | simpleshop/payment_modules.py | Python | bsd-3-clause | 320 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_permission_codename, get_user_model
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse, NoReverseMatch... | czpython/django-cms | cms/cms_toolbars.py | Python | bsd-3-clause | 32,747 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from templatesadmin import TemplatesAdminException
from templatesadmin.edithooks import TemplatesAdminHook
import subprocess
import os, sys
class GitCommitHook(TemplatesAdminHook):
'''
Commit to git after saving
'''
@cla... | GrandComicsDatabase/django-templatesadmin | templatesadmin/edithooks/gitcommit.py | Python | bsd-3-clause | 2,280 |
#!/usr/bin/env python2.7
# Standard Library
import argparse
import collections
import os
import re
import xml.etree.cElementTree
# Third Party
import imdb
import imdb.helpers
import mediawiki
import sqlalchemy
import sqlalchemy.ext.declarative
import sqlalchemy.ext.hybrid
import sqlalchemy.orm
CANON = {'"Star Trek" (... | brolewis/oracle_of_kirk | oracle.py | Python | bsd-3-clause | 12,551 |
"""
Core model handling routines.
"""
from __future__ import print_function
__all__ = [
"list_models", "load_model", "load_model_info",
"build_model", "precompile_dlls", "reparameterize",
]
import os
from os.path import basename, join as joinpath
from glob import glob
import re
import copy
import numpy a... | SasView/sasmodels | sasmodels/core.py | Python | bsd-3-clause | 21,256 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, Willow Garage, Inc.
# 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... | 130s/bloom | bloom/config.py | Python | bsd-3-clause | 12,185 |
import os, sys; sys.path.append(os.path.join("..", "..", ".."))
from pattern.web import Flickr, extension
from pattern.web import RELEVANCY, LATEST, INTERESTING # Image sort order.
from pattern.web import SMALL, MEDIUM, LARGE # Image size.
# This example downloads an image from Flickr (http://flickr.com).
#... | agermanidis/Pattern | examples/01-web/05-flickr.py | Python | bsd-3-clause | 1,296 |
from common import filt, mix, pack
class Downconverter:
def __init__(self, num_chs, L_b, h, D=1, ph=0, w=0):
self._mixr = mix.Mixer(L_b, ph=ph, w=w)
self._filtr = filt.FIR(num_chs, L_b, h, D=D)
self._pkr = pack.Packer(L_b)
def push(self, x):
packed = self._pkr.push(x)
... | cuauv/software | hydrocode/modules/common/downconv.py | Python | bsd-3-clause | 545 |
# Copyright (C) 2012 Google Inc. All rights reserved.
# Copyright (C) 2012 Zoltan Horvath, Adobe Systems Incorporated. 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 ... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftest.py | Python | bsd-3-clause | 12,942 |
## @package onedeefive
#
# @brief The main executable package for 1D5
#
# This package holds the main executable section of the program.
# It is basically an interactive console that can be run with i/o redirection
# from specified script files.
#
import sys
import re
import LangDef
from Script import Script,setOut... | wingerjc/onedeefive | src/python/onedeefive.py | Python | bsd-3-clause | 3,580 |
from __future__ import absolute_import, print_function
from ._version import get_versions
import os
try:
from .__conda_version__ import conda_version
__version__ = conda_version.replace("'","")
del conda_version
except ImportError:
__version__ = get_versions()['version']
del get_versions
_notebook... | sahat/bokeh | bokeh/__init__.py | Python | bsd-3-clause | 8,912 |
from django.core.management.base import BaseCommand
from webserver.codemanagement.models import TeamClient
import os
import re
import tempfile
import subprocess
class Command(BaseCommand):
help = 'Attempts to update all repositories by pulling from bases'
def handle(self, *args, **options):
# A lis... | siggame/webserver | webserver/codemanagement/management/commands/update_repos.py | Python | bsd-3-clause | 4,248 |
import gevent
import urllib
import urlparse
from geventwebsocket import WebSocketError
from gevent.queue import Empty
class BaseTransport(object):
"""Base class for all transports. Mostly wraps handler class functions."""
def __init__(self, handler, config, **kwargs):
"""Base transport class.
... | chrisfranklin/badasschat | badasschat/socketio/transports.py | Python | bsd-3-clause | 11,277 |
from django.conf.urls.defaults import patterns, url
urlpatterns = ()
| praekelt/jmbo-janrain | janrain/urls.py | Python | bsd-3-clause | 70 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
class UtilsTests(TestCase):
"""docstring for UtilsTests"""
def setUp(self):
self.username = 'theskumar'
self.email = 'theskumar@example.com'
def test_foo(self):
self.assertEqual('foo'... | theskumar/django-unsubscribe | unsubscribe/tests/test_utils.py | Python | bsd-3-clause | 329 |
# coding=utf-8
import matplotlib.pyplot as plt
import numpy as np
import pytest
from ..classes import Simulation, PeriodicTestGrid, NonperiodicTestGrid
from ..visualization.time_snapshots import FieldPlot, CurrentPlot
@pytest.fixture(params=(64, 128, 256, 512))
def _NG(request):
return request.param
@pytest.fi... | StanczakDominik/PythonPIC | pythonpic/tests/test_FieldSolver.py | Python | bsd-3-clause | 9,551 |
import random
import unittest
import six
import os
import sys
import pyrtl
import pyrtl.corecircuits
import pyrtl.helperfuncs
from pyrtl.rtllib import testingutils as utils
# ---------------------------------------------------------------
class TestWireVectorList(unittest.TestCase):
def setUp(self):
pas... | UCSBarchlab/PyRTL | tests/test_helperfuncs.py | Python | bsd-3-clause | 47,619 |
# -*- coding: utf-8 -*-
from django.db import models
from django import forms
from django.utils.text import capfirst
from ..forms import PriceField as PriceFormField, PriceInput
class PriceField(models.DecimalField):
"""
A text field made to accept hexadecimal color value (#FFFFFF)
with a color picker w... | dalou/django-extended | django_extended/fields/price.py | Python | bsd-3-clause | 873 |
from decimal import Decimal
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import AreaField
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
from django.core.exceptions import FieldError
from django.db.models i... | yephper/django | django/contrib/gis/db/models/functions.py | Python | bsd-3-clause | 16,825 |
try:
try:
from idlelib.WidgetRedirector import WidgetRedirector
except ImportError:
# Renamed in Python 3.6 (see http://bugs.python.org/issue24225)
from idlelib.redirector import WidgetRedirector
except ImportError:
import platform
import sys
if platform.linux_distribution()[... | pybee/tkreadonly | tkreadonly.py | Python | bsd-3-clause | 11,439 |
from django.template import Library, Node, Variable, VariableDoesNotExist
from django.core.urlresolvers import reverse
from job_board.views import job_list_by_tag
register = Library()
def do_populate_tags(parser,token):
"""
render a list of tags, with it's link.
the token is tag.
Arguments:
- `pa... | jpartogi/django-job-board | job_board/templatetags/tag_list.py | Python | bsd-3-clause | 1,058 |
import random
import re
from datetime import datetime, timedelta
from string import letters
from django.contrib.auth.models import User
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ValidationError
from djan... | anushbmx/kitsune | kitsune/users/api.py | Python | bsd-3-clause | 16,254 |
import logging
from pybar.analysis.analyze_raw_data import AnalyzeRawData
from pybar.fei4.register_utils import invert_pixel_mask
from pybar.fei4_run_base import Fei4RunBase
from pybar.fei4.register_utils import scan_loop
from pybar.run_manager import RunManager
class ThresholdScan(Fei4RunBase):
'''Sta... | SiLab-Bonn/pyBAR | pybar/scans/scan_threshold.py | Python | bsd-3-clause | 4,996 |
#!/usr/bin/python2.4
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for grit.format.policy_templates.writers.admx_writer."""
import os
import sys
import unittest
from xml.dom import ... | paul99/clank | tools/grit/grit/format/policy_templates/writers/xml_writer_base_unittest.py | Python | bsd-3-clause | 1,025 |
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 = 30, transform = "Fisher", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Fisher/trend_LinearTrend/cycle_30/ar_12/test_artificial_128_Fisher_LinearTrend_30_12_20.py | Python | bsd-3-clause | 265 |
import re
from urllib import urlencode
from urllib2 import urlopen
from corehq.apps.sms.mixin import SMSBackend
from corehq.apps.sms.forms import BackendForm
from corehq.apps.reminders.forms import RecordListField
from django.forms.fields import *
from django.core.exceptions import ValidationError
from couchdbkit.ext.d... | SEL-Columbia/commcare-hq | corehq/apps/sms/backend/http_api.py | Python | bsd-3-clause | 4,882 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple input/output related functionality that is not
part of a larger framework or standard.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...extern import ... | AustereCuriosity/astropy | astropy/io/misc/pickle_helpers.py | Python | bsd-3-clause | 3,779 |
from cStringIO import StringIO
from couchdbkit import ResourceNotFound
from datetime import datetime, timedelta
from django.template.defaultfilters import yesno
from django.utils.translation import ugettext as _
from corehq.apps.fixtures.exceptions import FixtureDownloadError
from corehq.apps.fixtures.models import F... | qedsoftware/commcare-hq | corehq/apps/fixtures/download.py | Python | bsd-3-clause | 13,120 |
from functools import wraps
import sys
import logging
from django.db.models.fields import AutoField
from django.db.models.sql import aggregates as sqlaggregates
from django.db.models.sql.constants import LOOKUP_SEP, MULTI, SINGLE
from django.db.models.sql.where import AND, OR
from django.db.utils import DatabaseError,... | potatolondon/djangoappengine-1-4 | db/compiler.py | Python | bsd-3-clause | 22,103 |
import functools
import random
from collections import defaultdict
from mpmath.libmp.libintmath import ifac
from ..core import Basic, Tuple, sympify
from ..core.compatibility import as_int, is_sequence
from ..matrices import zeros
from ..polys import lcm
from ..utilities import flatten, has_dups, has_variety
from ..u... | diofant/diofant | diofant/combinatorics/permutations.py | Python | bsd-3-clause | 72,579 |
import os
import sys
import pytest
from .conftest import Process, AphorismsToXMLException
file_path = os.path.realpath(__file__)
path = os.path.dirname(file_path)
sys.path.append(path)
path_testdata = os.path.join(path, 'test_files') + os.sep
# examples = os.path.join(path, '..', 'Examples', 'TextFiles') + os.sep
te... | gruel/AphorismToTEI | tests/test_aphorism_to_xml.py | Python | bsd-3-clause | 5,663 |
import requests
from bs4 import BeautifulSoup
def get_page_contents(url):
request = requests.get(url)
return request.text
| mrawcliffe/gouda3 | gouda/utils/web.py | Python | mit | 132 |
"""The tests for the generic_thermostat."""
import asyncio
import datetime
import pytz
import unittest
from unittest import mock
import homeassistant.core as ha
from homeassistant.core import callback
from homeassistant.setup import setup_component, async_setup_component
from homeassistant.const import (
ATTR_UNIT... | stefan-jonasson/home-assistant | tests/components/climate/test_generic_thermostat.py | Python | mit | 31,078 |
# -*- coding: utf-8 -*-
"""
Contains classes to handle images related things
# Requires PIL
"""
from hyde.plugin import Plugin
import re
import Image
class ImageSizerPlugin(Plugin):
"""
Each HTML page is modified to add width and height for images if
they are not already specified.
"""
def __in... | Valloric/hyde | hyde/ext/plugins/images.py | Python | mit | 5,652 |
from django.apps import AppConfig
class NotificationsConfig(AppConfig):
name = 'toucan.notifications'
| mcallistersean/b2-issue-tracker | toucan/notifications/apps.py | Python | mit | 108 |
# Andrew Erlichson
# MongoDB, Inc.
# M101P - Copyright 2015, All Rights Reserved
import pymongo
import datetime
import sys
# establish a connection to the database
connection = pymongo.MongoClient("mongodb://localhost")
# removes one student
def remove_student(student_id):
# get a handle to the schoo... | onyb/mooca | MongoDB_University/M101P_MongoDB_for_Developers/Chapter_2_CRUD/pymongo_removing_data/remove_student_data.py | Python | mit | 1,002 |
#!/usr/bin/python3
def maxXor(l, r):
"""
Max Xor
"""
i = l
max_so_far = 0
while(l <= i and i <= r):
j = l
while(l <= j and j <= r):
tmp = i ^ j
if max_so_far < tmp:
max_so_far = tmp
j += 1
i += 1
return max_so_... | Sunhick/hacker_rank | Algorithms/Bit Manipulation/Maximizing-Xor.py | Python | mit | 418 |
#!/usr/bin/env python3
#
# pacman_conf.py
#
# Based on pyalpm code Copyright (C) 2011 Rémy Oudompheng <remy@archlinux.org>
# Copyright © 2013-2015 DSGos
#
# This file is part of DSGos_Installer.
#
# DSGos_Installer is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | DecisionSystemsGroup/DSGos | airootfs/usr/share/DSGos-Installer/DSGos_Installer/pacman/pacman_conf.py | Python | mit | 7,754 |
import py
from rpython.jit.metainterp import compile
from rpython.jit.metainterp.history import (TargetToken, JitCellToken,
TreeLoop, Const)
from rpython.jit.metainterp.optimizeopt.util import equaloplists
from rpython.jit.metainterp.optimizeopt.vector import (Pack,
NotAProfitableLoop, VectorizingOptim... | oblique-labs/pyVM | rpython/jit/metainterp/optimizeopt/test/test_guard.py | Python | mit | 12,148 |
# Copyright (c) 2017 Microsoft Corporation.
#
# 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, publis... | village-people/flying-pig | malmopy/visualization/visualizer.py | Python | mit | 4,199 |
# sql/sqltypes.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""SQL specific types.
"""
import codecs
import datetime as dt
import decimal
imp... | monetate/sqlalchemy | lib/sqlalchemy/sql/sqltypes.py | Python | mit | 111,751 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Thomas Scholtes.
#
# 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 ... | kelvinhammond/beets | test/test_keyfinder.py | Python | mit | 2,610 |
from dbpedia_api import DbpediaApi
from libx import UnicodeReader, UtilSyntax
import json
import os
#UtilLinkDbpedia.linkDbpedia("DERI galway","organisation")
#UtilLinkDbpedia.linkDbpedia("Linkoping University","organisation")
#UtilLinkDbpedia.linkDbpedia("MIT CSAIL","organisation")
#UtilLinkDbpedia.linkDbpedia("Univer... | mr-justin/open-conference-data | iswc-metadata/src/todo/task_link_dbpedia.py | Python | mit | 3,427 |
dimensions(8,2)
wall((0, 2), (8, 2))
wall((1, 1.5),(1.5, 1.5))
wall((2, 1.6),(2.8, 1.6))
wall((3.1, 1.4),(3.5, 1.4))
initialRobotLoc(1.0, 1.0)
| Cynary/distro6.01 | arch/6.01Soft/lib601-F13-4/soar/worlds/oneDdiff.py | Python | mit | 148 |
#### 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/gambling/table/shared_table_base.iff"
result.attribute_template_id ... | anhstudios/swganh | data/scripts/templates/object/tangible/gambling/table/shared_table_base.py | Python | mit | 450 |
from django.conf.urls import url
from django.views.generic import RedirectView
from pyconcz_2017.speakers.views import speakers_list, schedule, talk_detail
urlpatterns = [
url('^$', RedirectView.as_view(pattern_name='speakers_list'), {'type': 'talks'}),
url('^(?P<type>(talks|workshops))/$', speakers_list, nam... | benabraham/cz.pycon.org-2017 | pyconcz_2017/speakers/urls.py | Python | mit | 500 |
#### 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 = Creature()
result.template = "object/mobile/shared_mynock.iff"
result.attribute_template_id = 9
result.stfName("... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_mynock.py | Python | mit | 426 |
from flask_security import UserMixin
from app import config
from app.models.Role import Role
db = config.db
class User(db.Document, UserMixin):
email = db.StringField(max_length=255)
password = db.StringField(max_length=512)
active = db.BooleanField(default=True)
last_login_at = db.StringField(max_le... | alanudg/SmartCheckIn | app/models/User.py | Python | mit | 638 |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import PaypalProvider
class PaypalTests(OAuth2TestsMixin, TestCase):
provider_id = PaypalProvider.id
def get_mocked_response(self):
return MockedResponse(
200,
... | rsalmaso/django-allauth | allauth/socialaccount/providers/paypal/tests.py | Python | mit | 613 |
# -*- coding: utf-8 -*-
ISO_CODES = {
"AF": "Afghanistan",
"AX": "Åland",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
"AR": "Argentina",
"AM": "Armenia",
... | futurecolors/django-geoip | django_geoip/management/iso3166_1.py | Python | mit | 6,017 |
'''
Audio
=====
The :class:`Audio` is used for recording audio.
Default path for recording is set in platform implementation.
.. note::
On Android the `RECORD_AUDIO`, `WAKE_LOCK` permissions are needed.
Simple Examples
---------------
To get the file path::
>>> audio.file_path
'/sdcard/testrecorde... | johnbolia/plyer | plyer/facades/audio.py | Python | mit | 1,873 |
import platform
import pip
from django import get_version
from django.shortcuts import render
def home(request):
"""
renders the deployment server details on the screen.
:param request: The django formatted HttpRequest
:return: renders context c with the demo template.
"""
c = dict(python_ver... | Kesel/django | demo/views.py | Python | mit | 459 |
from FindPathsPlugin import FindPathsPlugin
import tulipplugins
class FindPaths0(FindPathsPlugin):
""" Tulip plugin algorithm which searches for 1-hop paths """
def __init__(self, context):
FindPathsPlugin.__init__(self, context, 0)
# The line below does the magic to register the plugin to the plugin... | visdesignlab/TulipPaths | FindPaths0.py | Python | mit | 500 |
import re
import sublime
from ..versions import version_exclude_prerelease
def filter_releases(package, settings, releases):
"""
Returns all releases in the list of releases that are compatible with
the current platform and version of Sublime Text
:param package:
The name of the package
... | herove/dotfiles | sublime/Packages/Package Control/package_control/providers/release_selector.py | Python | mit | 2,521 |
import unittest
from biicode.common.edition.hive import Hive
from biicode.common.model.blob import Blob
from biicode.common.exception import BiiException
from biicode.common.edition import changevalidator
from biicode.common.edition.processors.processor_changes import ProcessorChanges
from biicode.common.conf import BI... | franramirez688/common | test/edition/changevalidator_test.py | Python | mit | 2,188 |
import json
import click
class Echo(object):
@staticmethod
def info(message, **kwargs):
click.echo(click.style(message, fg='green'), **kwargs)
@staticmethod
def error(message, **kwargs):
click.echo(click.style(message, fg='red'), **kwargs)
@staticmethod
def warn(message, **kw... | kcwikizh/kcwiki-scripts | lib/common/utils.py | Python | mit | 1,455 |
#Copyright (C) 2011 by Julia Boortz and Joseph Lynch
#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, p... | Benjamin-Marks/mit-tab | mittab/libs/data_import/import_judges.py | Python | mit | 4,446 |
#### 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/components/armor/shared_arm_mandal_enhanced_heavy_composite.iff... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/components/armor/shared_arm_mandal_enhanced_heavy_composite.py | Python | mit | 514 |
def pbj_while(slices):
output = ''
while (slices > 0):
slices = slices - 2
if slices >= 2:
output += 'I am making a sandwich! I have bread for {0} more sandwiches.\n'.format(slices / 2)
elif slices < 2:
output += 'I am making a sandwich! But, this is my last sandw... | hannahkwarren/CLaG-Sp2016 | code-exercises-etc/section_xx_-misc/4-2.py | Python | mit | 419 |
"""Definitions for the `RProcess` class."""
from math import isnan
import numpy as np
from astrocats.catalog.source import SOURCE
from mosfit.constants import C_CGS, DAY_CGS, IPI, KM_CGS, M_SUN_CGS
from mosfit.modules.engines.engine import Engine
from scipy.interpolate import RegularGridInterpolator
# Important: Onl... | guillochon/FriendlyFit | mosfit/modules/engines/rprocess.py | Python | mit | 3,010 |
#!/usr/bin/env python
# This illustrates how to use SoCo plugins
# an example plugin is provided in soco.plugins.example.ExamplePlugin
import time
from soco import SoCo
from soco.plugins import SoCoPlugin
def main():
speakers = [speaker.ip_address for speaker in SoCo.discover()]
if not speakers:
p... | petteraas/SoCo | examples/plugins/socoplugins.py | Python | mit | 1,032 |
from tornado import gen
from tornado import web
from tornado import ioloop
import uuid
import os
import pickle
from lib.database.users import user_insert
from lib.database.users import get_user
from lib.database.users import get_user_from_email
from lib.database.reservations import create_ticket_reservation
from lib.... | wannabeCitizen/quantifiedSelf | app/user_auth.py | Python | mit | 6,825 |
#### 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 = Creature()
result.template = "object/mobile/shared_tanc_mite_hue.iff"
result.attribute_template_id = 9
result.st... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_tanc_mite_hue.py | Python | mit | 582 |
#### 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 = Creature()
result.template = "object/mobile/shared_dressed_deathstar_debris_cultist_hum_m_02.iff"
result.attribut... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_deathstar_debris_cultist_hum_m_02.py | Python | mit | 464 |
class A(list):
def my_append(self, a):
self.append(a)
a = A()
print a
a.append(5)
print a
a.my_append(6)
print a
a.remove(5)
print a
| chrivers/pyjaco | tests/list/subclass.py | Python | mit | 147 |
from mafan import download_data
if __name__ == '__main__':
confirm = input(
"You are about to download all dictionary files. Could be up to 50MB in total. Are you sure?\n (y/n) ")
if confirm == 'y' or confirm == 'yes':
download_data.download_traditional_word_list()
| hermanschaaf/mafan | bin/mafan_download.py | Python | mit | 291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.