repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
django-nonrel/django-nonrel | django/utils/termcolors.py | 417 | 6885 | """
termcolors.py
"""
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'underscore': '4', 'blink': '5', 'rever... | bsd-3-clause | 18d9e8732a5514ec9791d5bffa91b5af | 33.772727 | 89 | 0.525054 | 3.68576 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/databrowse/sites.py | 329 | 5628 | from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class DatabrowsePlugi... | bsd-3-clause | df8bcd140149f360b41a48efe25be08e | 36.771812 | 130 | 0.636816 | 4.066474 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/gis/tests/geo3d/models.py | 404 | 1835 | from django.contrib.gis.db import models
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __unicode__(self):
return self.name
class Interstate2D(models.Model):
name = models.CharField(max_length=30)
l... | bsd-3-clause | 13737ee5a16105f034085870bc2a9ddb | 25.594203 | 52 | 0.679019 | 3.528846 | false | false | false | false |
django-nonrel/django-nonrel | django/template/debug.py | 232 | 3797 | from django.conf import settings
from django.template.base import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError
from django.utils.encoding import force_unicode
from django.utils.html import escape
from django.utils.safestring import SafeData, EscapeData
from django.utils.formats import localize
cl... | bsd-3-clause | a0ec82e6a08f968e75cf82e76f413732 | 36.22549 | 104 | 0.62049 | 4.07841 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/forms/localflavor/ro.py | 50 | 5203 | # -*- coding: utf-8 -*-
from django.contrib.localflavor.ro.forms import (ROCIFField, ROCNPField,
ROCountyField, ROCountySelect, ROIBANField, ROPhoneNumberField,
ROPostalCodeField)
from utils import LocalFlavorTestCase
class ROLocalFlavorTests(LocalFlavorTestCase):
def test_ROCountySelect(self):
f... | bsd-3-clause | d8a01e8ca8d49fe041bb60331ff24a83 | 36.15 | 87 | 0.627187 | 3.090315 | false | true | false | false |
django-nonrel/django-nonrel | django/core/management/commands/shell.py | 5 | 3164 | import os
from django.core.management.base import NoArgsCommand
from optparse import make_option
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--plain', action='store_true', dest='plain',
help='Tells Django to use plain Python, not IPython.'),
)
... | bsd-3-clause | 3bd324495db29420e5cc58df17d59357 | 37.120482 | 92 | 0.565107 | 4.99842 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/comments/views/moderation.py | 5 | 5002 | from django import template
from django.conf import settings
from django.shortcuts import get_object_or_404, render_to_response
from django.contrib.auth.decorators import login_required, permission_required
from utils import next_redirect, confirmation_view
from django.contrib import comments
from django.contrib.commen... | bsd-3-clause | ef47a729565fab0db3b07550e28f79dd | 30.2625 | 95 | 0.654538 | 3.969841 | false | false | false | false |
django-nonrel/django-nonrel | django/test/testcases.py | 157 | 24882 | import re
import sys
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.signals import request_started
from django.core.urlresolvers import clear_url_cache... | bsd-3-clause | 70a90e08a8f1058f2c34edb2f856e0c2 | 38.308057 | 116 | 0.580701 | 4.435294 | false | true | false | false |
django-nonrel/django-nonrel | django/contrib/gis/db/backends/postgis/models.py | 403 | 1970 | """
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from the PostGIS. See the PostGIS
documentation at Ch. 4.2.2.
... | bsd-3-clause | 2481211257ad125d589d3c31e450be30 | 28.848485 | 70 | 0.642132 | 3.78119 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/gis/maps/google/__init__.py | 604 | 2648 | """
This module houses the GoogleMap object, used for generating
the needed javascript to embed Google Maps in a Web page.
Google(R) is a registered trademark of Google, Inc. of Mountain View, California.
Example:
* In the view:
return render_to_response('template.html', {'google' : GoogleMap(key="... | bsd-3-clause | 0dac93eaf5ca74ead1c91216299c9a50 | 42.409836 | 126 | 0.672205 | 3.657459 | false | false | false | false |
django-nonrel/django-nonrel | django/utils/crypto.py | 245 | 1443 | """
Django's standard crypto functions and utilities.
"""
import hmac
from django.conf import settings
from django.utils.hashcompat import sha_constructor, sha_hmac
def salted_hmac(key_salt, value, secret=None):
"""
Returns the HMAC-SHA1 of 'value', using a key generated from key_salt and a
secret (which... | bsd-3-clause | 71537f085fd6f92fb5d3bb500112b742 | 31.066667 | 80 | 0.679141 | 3.837766 | false | false | false | false |
django-nonrel/django-nonrel | tests/regressiontests/forms/tests/media.py | 51 | 46165 | # -*- coding: utf-8 -*-
from django.conf import settings
from django.forms import TextInput, Media, TextInput, CharField, Form, MultiWidget
from django.utils.unittest import TestCase
class FormsMediaTestCase(TestCase):
# Tests for the media handling on widgets and forms
def setUp(self):
super(FormsMed... | bsd-3-clause | 7f8e26b84eaf05f201a67fc6be57fdeb | 49.179348 | 173 | 0.570584 | 3.59121 | false | false | false | false |
django-nonrel/django-nonrel | django/core/management/commands/syncdb.py | 161 | 8141 | from optparse import make_option
import sys
from django.conf import settings
from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
from django.db import connections, router, transaction,... | bsd-3-clause | 2a9b8150a951fbaa3f55f8bab7eb2268 | 48.640244 | 121 | 0.567744 | 4.73865 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/admindocs/views.py | 296 | 15504 | from django import template, templatetags
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.shortcuts import render_to_response
from django.core.exceptions import ImproperlyConfigur... | bsd-3-clause | 7abe1056b16a196a96f447250e4ae036 | 39.062016 | 180 | 0.597072 | 3.92407 | false | false | false | false |
django-nonrel/django-nonrel | django/contrib/gis/db/backends/postgis/creation.py | 308 | 2845 | from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_opts = 'GIST_GEOMETRY_OPS'
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for ... | bsd-3-clause | 45833da96f8cc9a905dc27e39c7d3aca | 46.416667 | 93 | 0.491388 | 4.376923 | false | false | false | false |
django-nonrel/django-nonrel | django/conf/locale/en_GB/formats.py | 234 | 2048 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'N j, Y' # 'Oct. 25, 2006'
TIME_FORMAT = 'P' ... | bsd-3-clause | c5056c6317d0c7ba4fb09f227fa0fd1e | 45.545455 | 79 | 0.434082 | 2.836565 | false | false | true | false |
django-nonrel/django-nonrel | django/test/_doctest.py | 152 | 100621 | # This is a slightly modified version of the doctest.py that shipped with Python 2.4
# It incorporates changes that have been submitted to the Python ticket tracker
# as ticket #1521051. These changes allow for a DoctestRunner and Doctest base
# class to be specified when constructing a DoctestSuite.
# Module doctest.... | bsd-3-clause | 19bb416d515e0d642c233f6c1e36dd43 | 36.363906 | 84 | 0.571382 | 4.450878 | false | true | false | false |
django-nonrel/django-nonrel | django/contrib/contenttypes/management.py | 315 | 2458 | from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any model
... | bsd-3-clause | 338f81a32d2746dcdd6f91091f263f82 | 39.966667 | 112 | 0.620016 | 4.042763 | false | false | false | false |
django-nonrel/django-nonrel | docs/_ext/literals_to_xrefs.py | 143 | 4814 | """
Runs through a reST file looking for old-style literals, and helps replace them
with new-style references.
"""
import re
import sys
import shelve
refre = re.compile(r'``([^`\s]+?)``')
ROLES = (
'attr',
'class',
"djadmin",
'data',
'exc',
'file',
'func',
'lookup',
'meth',
'm... | bsd-3-clause | be649f56d629c0b28094dd58df090378 | 27.157895 | 93 | 0.524096 | 3.534508 | false | false | false | false |
batiste/django-page-cms | pages/management/commands/pages_demo.py | 1 | 2856 | from django.core.management.base import BaseCommand, CommandError
from pages.models import Page
from pages.tests.testcase import new_page
from django.contrib.auth import get_user_model
lorem = """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque tempus tellus enim, quis tempus dui pretium non.
Cras e... | bsd-3-clause | f99b9c2a4a56a8583cb746466f689538 | 44.333333 | 106 | 0.59944 | 3.412186 | false | false | false | false |
django-nonrel/django-nonrel | tests/modeltests/files/tests.py | 48 | 4113 | import shutil
import sys
from django.core.cache import cache
from django.core.files.base import ContentFile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from models import Storage, temp_storage, temp_storage_location
if sys.version_info >= (2, 5):
from tests_25 im... | bsd-3-clause | c447953a4ed5e0e9ae9669015a342fae | 38.171429 | 100 | 0.637977 | 3.898578 | false | true | false | false |
django-nonrel/django-nonrel | django/db/models/fields/files.py | 156 | 16228 | import datetime
import os
import django.utils.copycompat as copy
from django.conf import settings
from django.db.models.fields import Field
from django.core.files.base import File, ContentFile
from django.core.files.storage import default_storage
from django.core.files.images import ImageFile, get_image_dimensions
fr... | bsd-3-clause | 57adf6777ee2693a9107413f2c1d3f05 | 39.773869 | 107 | 0.645243 | 4.315957 | false | false | false | false |
aparo/pyes | performance/utils.py | 6 | 1454 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import os
from django.contrib.webdesign.lorem_ipsum import words as li_words
import shelve
import codecs
def get_names():
"""
Return a list of names.
"""
return [n.strip() for n in codecs.open(os.path.join("data", "names.txt"),"rb",'utf8').re... | bsd-3-clause | 488197886360ae8a801bb6ec404563b3 | 27.509804 | 102 | 0.611417 | 3.581281 | false | false | false | false |
mne-tools/mne-python | mne/preprocessing/nirs/_optical_density.py | 8 | 1719 | # Authors: Robert Luke <mail@robertluke.net>
# Eric Larson <larson.eric.d@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
import numpy as np
from ...io import BaseRaw
from ...io.constants import FIFF
from ...utils import _validate_type, warn, verbose
from ..ni... | bsd-3-clause | 0e24ba865745c6c60d7e84b4100b5341 | 30.254545 | 78 | 0.610239 | 3.363992 | false | false | false | false |
mne-tools/mne-python | tutorials/time-freq/20_sensors_time_frequency.py | 2 | 7731 | # -*- coding: utf-8 -*-
"""
.. _tut-sensors-time-freq:
============================================
Frequency and time-frequency sensor analysis
============================================
The objective is to show you how to explore the spectral content
of your data (frequency and time-frequency). Here we'll work on... | bsd-3-clause | 41291cd9dd11c6119a86ee6d60944fb4 | 35.45283 | 79 | 0.668866 | 3.054545 | false | false | false | false |
mne-tools/mne-python | mne/io/kit/coreg.py | 5 | 7386 | """Coordinate Point Extractor for KIT system."""
# Author: Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD-3-Clause
from collections import OrderedDict
from os import SEEK_CUR, path as op
import pickle
import re
import numpy as np
from .constants import KIT, FIFF
from .._digitization import _make_dig_points
fr... | bsd-3-clause | 34f0caf27648fab15f6005e6317cf8ff | 33.839623 | 79 | 0.559572 | 3.310623 | false | false | false | false |
mne-tools/mne-python | mne/commands/mne_coreg.py | 8 | 3851 | #!/usr/bin/env python
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Open the coregistration GUI.
Examples
--------
.. code-block:: console
$ mne coreg
"""
import os.path as op
import mne
def run():
"""Run command."""
from mne.commands.utils import get_optparser, _add_verbose_flag
... | bsd-3-clause | e267bdc859117abe3edd8f5ee473058e | 38.295918 | 79 | 0.576474 | 4.131974 | false | false | false | false |
mne-tools/mne-python | examples/time_frequency/source_label_time_frequency.py | 11 | 3703 | # -*- coding: utf-8 -*-
"""
.. _ex-source-space-power-phase-locking:
=========================================================
Compute power and phase lock in label of the source space
=========================================================
Compute time-frequency maps of power and phase lock in the source space.
Th... | bsd-3-clause | af9eb78f0eb0ef2d62a14668afa89abb | 33.607477 | 79 | 0.611396 | 3.342058 | false | false | false | false |
mne-tools/mne-python | mne/viz/misc.py | 5 | 53706 | # -*- coding: utf-8 -*-
"""Functions to make simple plots with M/EEG data."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini... | bsd-3-clause | 8a77dcbbed9a7a15381f7fa6a5763634 | 36.417422 | 79 | 0.557586 | 3.634112 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/window/mouse.py | 7 | 2508 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | d957a3f4ce86b8e8d1d2fdce37c4aee7 | 36.432836 | 78 | 0.672249 | 4.462633 | false | false | false | false |
mattpap/sympy-polys | sympy/solvers/solvers.py | 1 | 28681 | """ This module contain solvers for all kinds of equations:
- algebraic, use solve()
- recurrence, use rsolve()
- differential, use dsolve()
- transcendental, use tsolve()
- nonlinear (numerically), use nsolve()
(you will need a good starting point)
"""
from sympy.core.sympify import s... | bsd-3-clause | 931301688252a7f296baa826c9c25a91 | 34.102815 | 105 | 0.552948 | 3.938341 | false | false | false | false |
mattpap/sympy-polys | examples/intermediate/mplot3d.py | 6 | 1197 | #!/usr/bin/env python
"""Matplotlib 3D plotting example
Demonstrates plotting with matplotlib.
"""
from sympy import Basic, sin, Symbol
from sample import sample
def mplot3d(f, var1, var2, show=True):
"""
Plot a 3d function using matplotlib/Tk.
"""
import warnings
warnings.filterwarnings("ignore... | bsd-3-clause | 59969c55749c4adfd975d41297d3adec | 22.470588 | 71 | 0.57477 | 2.803279 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/__init__.py | 5 | 12300 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | 212d08d062d3f389f2f8efe8b2fc1ca2 | 32.884298 | 80 | 0.616016 | 3.82939 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/text/formats/html.py | 5 | 13147 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | 3af061642ce2f271676adbc52a44e8fd | 35.118132 | 79 | 0.531224 | 3.953985 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/font/base.py | 5 | 14445 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | 62be8de6ae9df0f71212d7e8e3e05d9e | 31.680995 | 79 | 0.598131 | 4.070161 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/gl/glu_info.py | 7 | 5690 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | b2f6ca23e5ea76e187c13fa4d6ef12cb | 34.5625 | 78 | 0.647276 | 4.287867 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/app/carbon.py | 7 | 5804 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | 862dcb6004b12f18ae79f3c74799551c | 39.305556 | 80 | 0.592695 | 4.509713 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/media/drivers/openal/lib_openal.py | 5 | 27903 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | 2677964b8e1a835152c2148e1a173b3c | 41.6 | 131 | 0.740422 | 2.579074 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/__init__.py | 10 | 1047 | """Thirdparty Packages for internal use.
"""
import sys
import os
def import_thirdparty(lib):
"""
Imports a thirdparty package "lib" by setting all paths correctly.
At the moment, there is only the "pyglet" library, so we just put
pyglet to sys.path temporarily, then import "lib" and then restore the... | bsd-3-clause | 964f5c7cc2e5d251c445798775bb5050 | 28.083333 | 80 | 0.588348 | 3.892193 | false | false | false | false |
mattpap/sympy-polys | sympy/polys/tests/test_polyclasses.py | 2 | 15621 | """Tests for OO layer of several polynomial representations. """
from sympy.polys.polyclasses import (
GFP, init_normal_GFP,
DUP, init_normal_DUP,
DMP, init_normal_DMP,
SDP, init_normal_SDP,
DMF, init_normal_DMF,
ANP, init_normal_ANP,
)
from sympy.polys.algebratools import ZZ, QQ
from sympy.po... | bsd-3-clause | 3caa51fbb2aca76a52e69a99b421c545 | 21.28388 | 80 | 0.454388 | 2.419235 | false | false | false | false |
mattpap/sympy-polys | sympy/plotting/plot_camera.py | 9 | 3674 | from pyglet.gl import *
from plot_rotation import get_spherical_rotatation
from util import get_model_matrix
from util import screen_to_model, model_to_screen
from util import vec_subs
class PlotCamera(object):
min_dist = 0.05
max_dist = 500.0
min_ortho_dist = 100.0
max_ortho_dist = 10000.0
_def... | bsd-3-clause | fb58b21f5089e5c6cbc2f103abc91a40 | 29.363636 | 98 | 0.557431 | 3.228471 | false | false | false | false |
mattpap/sympy-polys | sympy/assumptions/tests/test_assumptions_2.py | 3 | 2174 | """rename this to test_assumptions.py when the old assumptions system is deleted"""
from sympy.core import symbols
from sympy.assumptions import Assume, global_assumptions
from sympy.assumptions.assume import eliminate_assume
from sympy.printing import pretty
def test_assume():
x = symbols('x')
assump = Assume... | bsd-3-clause | b9c2433af80612fca72a592165be9c9b | 37.821429 | 83 | 0.657774 | 3.264264 | false | true | false | false |
mattpap/sympy-polys | sympy/core/tests/test_arit.py | 3 | 29690 | from sympy import Symbol, sin, cos, exp, O, sqrt, Rational, Real, re, pi, \
sympify, sqrt, Add, Mul, Pow, I, log
from sympy.utilities.pytest import XFAIL
x = Symbol('x')
y = Symbol('y')
z = Symbol('z')
def test_bug1():
assert re(x) != x
x.series(x,0,1)
assert re(x) != x
a = Symbol("a")
b = Symbol... | bsd-3-clause | cb2b22778d75c2bbd1b2cac150b04321 | 26.618605 | 125 | 0.548265 | 2.745769 | false | false | false | false |
mattpap/sympy-polys | sympy/thirdparty/pyglet/pyglet/gl/glext_arb.py | 7 | 529031 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | bsd-3-clause | c91b812bbc736a638257f66871af4522 | 55.586908 | 269 | 0.757107 | 2.581848 | false | false | false | false |
mattpap/sympy-polys | sympy/core/tests/test_functions.py | 1 | 10986 | from sympy import Lambda, Symbol, Function, WildFunction, Derivative, sqrt, \
log, exp, Rational, Real, sign, Basic, sin, cos, diff, I, re, im, \
oo, zoo, nan, E, expand, pi, raises, O, Sum
from sympy.utilities.pytest import XFAIL
from sympy.abc import x, y
from sympy.core.function import PoleError
de... | bsd-3-clause | f2cb20485d53a370d82c74b08b020bdb | 30.210227 | 105 | 0.533588 | 2.476555 | false | true | false | false |
wtforms/wtforms | tests/test_widgets.py | 1 | 8398 | import pytest
from markupsafe import Markup
from wtforms.widgets.core import CheckboxInput
from wtforms.widgets.core import FileInput
from wtforms.widgets.core import HiddenInput
from wtforms.widgets.core import html_params
from wtforms.widgets.core import Input
from wtforms.widgets.core import ListWidget
from wtforms... | bsd-3-clause | 74e324cecbf4d86b3f5eb6424578e8ae | 34.73617 | 88 | 0.576447 | 3.632353 | false | true | false | false |
fredrik-johansson/mpmath | mpmath/libmp/libmpf.py | 1 | 45021 | """
Low-level functions for arbitrary-precision floating-point arithmetic.
"""
__docformat__ = 'plaintext'
import math
from bisect import bisect
import sys
# Importing random is slow
#from random import getrandbits
getrandbits = None
from .backend import (MPZ, MPZ_TYPE, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE,
B... | bsd-3-clause | 77f41804e845fdcd144fbc62a30d3014 | 30.839463 | 84 | 0.528353 | 3.526357 | false | false | false | false |
desihub/desisim | py/desisim/scripts/quickspectra.py | 1 | 19534 | from __future__ import absolute_import, division, print_function
import sys, os
import argparse
import time
import numpy as np
import astropy.table
import astropy.time
import astropy.units as u
import astropy.io.fits as pyfits
import desisim.specsim
import desisim.simexp
import desisim.obs
import desisim.io
import de... | bsd-3-clause | 909df042763fd3826673ea85f96a6c7a | 42.408889 | 266 | 0.618818 | 3.63153 | false | false | false | false |
metoppv/improver | improver/regrid/grid.py | 3 | 16102 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | bsd-3-clause | 0cdf44168a3942ff91d37a48fe4135b0 | 32.476091 | 88 | 0.649174 | 3.462796 | false | false | false | false |
metoppv/improver | improver_tests/acceptance/test_feels_like_temp.py | 3 | 2563 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | bsd-3-clause | 9cb9169a9ec1f312ecab4b9fd28c4ab2 | 37.833333 | 79 | 0.691377 | 3.949153 | false | true | false | false |
metoppv/improver | improver/cli/neighbour_finding.py | 3 | 9856 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... | bsd-3-clause | 1ff782ff2e97ef73f12d124b8b290576 | 40.586498 | 81 | 0.654322 | 4.292683 | false | false | false | false |
metoppv/improver | doc/source/conf.py | 3 | 13226 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | bsd-3-clause | bf1b9056d92e41dde3b90dfea8f76ba4 | 30.267139 | 83 | 0.696507 | 3.663712 | false | false | false | false |
metoppv/improver | improver_tests/acceptance/test_weighted_blending.py | 3 | 16754 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | bsd-3-clause | b07ec7838409f9a9e5fb489edbadd5a0 | 27.590444 | 79 | 0.568521 | 3.290259 | false | true | false | false |
bread-and-pepper/django-userena | userena/middleware.py | 12 | 1228 | from django.utils import translation
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from userena import settings as userena_settings
from userena.compat import SiteProfileNotAvailable
from userena.utils import get_user_profile
class UserenaLocaleMiddleware(object):
"""
... | bsd-3-clause | 8c8e6981d9e11c9386b35c8a3789cb9b | 37.375 | 88 | 0.645765 | 5.032787 | false | false | false | false |
bread-and-pepper/django-userena | userena/backends.py | 5 | 1771 | import django.core.validators
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
class UserenaAuthenticationBackend(ModelBackend):
"""
Custom backend because the user must be able to supply a ``email`` or
``username`` to the login form.
"""
def au... | bsd-3-clause | a4afd68a3ee31a270221cd27b293f659 | 34.42 | 79 | 0.637493 | 4.760753 | false | false | false | false |
bread-and-pepper/django-userena | userena/utils.py | 4 | 6483 | from django.conf import settings
from django.utils.encoding import smart_bytes
from django.utils.functional import allow_lazy
from django.utils.http import urlencode
from django.utils.six import text_type
from django.utils.text import Truncator
from userena import settings as userena_settings
from userena.compat impor... | bsd-3-clause | bb0acf704cac49c7237d28e55268504b | 32.076531 | 90 | 0.658954 | 4.103165 | false | false | false | false |
bread-and-pepper/django-userena | userena/tests/tests_utils.py | 6 | 3258 | import sys, re, six
from django.test import TestCase
from django.conf import settings
from django.contrib.auth import get_user_model
from django.utils.six.moves.urllib_parse import urlparse, parse_qs
from userena.utils import (get_gravatar, signin_redirect, get_profile_model,
get_protocol, ... | bsd-3-clause | 5fae2b07fd3fee16ab6e4a7587a2b8a7 | 34.413043 | 78 | 0.609576 | 3.878571 | false | true | false | false |
pvlib/pvlib-python | docs/examples/iv-modeling/plot_singlediode.py | 3 | 4250 | """
Calculating a module's IV curves
================================
Examples of modeling IV curves using a single-diode circuit equivalent model.
"""
# %%
# Calculating a module IV curve for certain operating conditions is a two-step
# process. Multiple methods exist for both parts of the process. Here we use
# t... | bsd-3-clause | ab65f6de83f934c853a5e86e1f34aad1 | 28.72028 | 94 | 0.626824 | 2.825798 | false | false | false | false |
pytorch/vision | references/detection/group_by_aspect_ratio.py | 1 | 7143 | import bisect
import copy
import math
from collections import defaultdict
from itertools import chain, repeat
import numpy as np
import torch
import torch.utils.data
import torchvision
from PIL import Image
from torch.utils.data.sampler import BatchSampler, Sampler
from torch.utils.model_zoo import tqdm
def _repeat_... | bsd-3-clause | bb391a395047258be81d86b435f9183d | 35.443878 | 117 | 0.642867 | 3.8096 | false | false | false | false |
pytorch/vision | .circleci/unittest/linux/scripts/run-clang-format.py | 2 | 10667 | #!/usr/bin/env python
"""
MIT License
Copyright (c) 2017 Guillaume Papin
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,... | bsd-3-clause | 8875c6a942426de8bc8c6079b568130b | 31.226586 | 113 | 0.622106 | 3.949278 | false | false | false | false |
pytorch/vision | references/depth/stereo/train.py | 1 | 33426 | import argparse
import os
import warnings
from pathlib import Path
from typing import List, Union
import numpy as np
import torch
import torch.distributed as dist
import torchvision.models.optical_flow
import torchvision.prototype.models.depth.stereo
import utils
import vizualization
from parsing import make_dataset,... | bsd-3-clause | 14dba50a8d2ac5bf038bde41c497c8c3 | 41.418782 | 167 | 0.641088 | 3.845163 | false | false | false | false |
pytorch/vision | torchvision/prototype/datasets/_api.py | 1 | 1763 | import pathlib
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
from torchvision.prototype.datasets import home
from torchvision.prototype.datasets.utils import Dataset
from torchvision.prototype.utils._internal import add_suggestion
T = TypeVar("T")
D = TypeVar("D", bound=Type[Dataset])
... | bsd-3-clause | 25d234f805333e58c656072cc9b644ba | 26.123077 | 111 | 0.613159 | 3.642562 | false | false | false | false |
pytorch/vision | torchvision/datasets/sun397.py | 1 | 2748 | from pathlib import Path
from typing import Any, Callable, Optional, Tuple
import PIL.Image
from .utils import download_and_extract_archive
from .vision import VisionDataset
class SUN397(VisionDataset):
"""`The SUN397 Data Set <https://vision.princeton.edu/projects/2010/SUN/>`_.
The SUN397 or Scene UNderst... | bsd-3-clause | 70d6f56f46dd121e916b9bea0d864b72 | 35.157895 | 115 | 0.633916 | 3.774725 | false | false | false | false |
pytorch/vision | test/test_datasets_samplers.py | 1 | 3785 | import pytest
import torch
from common_utils import assert_equal, get_list_of_videos
from torchvision import io
from torchvision.datasets.samplers import DistributedSampler, RandomClipSampler, UniformClipSampler
from torchvision.datasets.video_utils import VideoClips
@pytest.mark.skipif(not io.video._av_available(), ... | bsd-3-clause | dc38f668d6bea90a7c3c036b8d9b3292 | 43.011628 | 99 | 0.628005 | 3.440909 | false | true | false | false |
pytorch/vision | test/test_architecture_ops.py | 1 | 1275 | import unittest
import pytest
import torch
from torchvision.models.maxvit import SwapAxes, WindowDepartition, WindowPartition
class MaxvitTester(unittest.TestCase):
def test_maxvit_window_partition(self):
input_shape = (1, 3, 224, 224)
partition_size = 7
n_partitions = input_shape[3] // ... | bsd-3-clause | 46e7b8c17f4bf1e5618b41e1cf83afbe | 26.717391 | 82 | 0.621961 | 3.455285 | false | true | false | false |
pytorch/vision | torchvision/datasets/omniglot.py | 1 | 4091 | from os.path import join
from typing import Any, Callable, List, Optional, Tuple
from PIL import Image
from .utils import check_integrity, download_and_extract_archive, list_dir, list_files
from .vision import VisionDataset
class Omniglot(VisionDataset):
"""`Omniglot <https://github.com/brendenlake/omniglot>`_ ... | bsd-3-clause | 2aa22d94a90f05f550fdeab351ced9b2 | 39.107843 | 106 | 0.635297 | 3.93744 | false | false | false | false |
pytorch/vision | torchvision/ops/_register_onnx_ops.py | 1 | 4157 | import sys
import warnings
import torch
_onnx_opset_version_11 = 11
_onnx_opset_version_16 = 16
base_onnx_opset_version = _onnx_opset_version_11
def _register_custom_op():
from torch.onnx.symbolic_helper import parse_args
from torch.onnx.symbolic_opset11 import select, squeeze, unsqueeze
from torch.onnx... | bsd-3-clause | 54daf5d4984231ceae02d9c01b776ad4 | 43.698925 | 118 | 0.622564 | 3.24259 | false | false | false | false |
pytorch/vision | torchvision/models/detection/rpn.py | 1 | 15735 | from typing import Dict, List, Optional, Tuple
import torch
from torch import nn, Tensor
from torch.nn import functional as F
from torchvision.ops import boxes as box_ops, Conv2dNormActivation
from . import _utils as det_utils
# Import AnchorGenerator to keep compatibility.
from .anchor_utils import AnchorGenerator ... | bsd-3-clause | 8852d38f148c15f92933f506caff50ac | 39.658915 | 117 | 0.607372 | 3.762554 | false | false | false | false |
pytorch/vision | torchvision/models/detection/anchor_utils.py | 1 | 11858 | import math
from typing import List, Optional
import torch
from torch import nn, Tensor
from .image_list import ImageList
class AnchorGenerator(nn.Module):
"""
Module that generates anchors for a set of feature maps and
image sizes.
The module support computing anchors at multiple sizes and aspect ... | bsd-3-clause | f2566e71a5835594fbd9cab6400222d6 | 43.246269 | 119 | 0.590993 | 3.598786 | false | false | false | false |
pytorch/vision | test/test_prototype_datasets_utils.py | 1 | 10326 | import gzip
import pathlib
import sys
import numpy as np
import pytest
import torch
from datasets_utils import make_fake_flo_file, make_tar
from torchdata.datapipes.iter import FileOpener, TarArchiveLoader
from torchvision.datasets._optical_flow import _read_flo as read_flo_ref
from torchvision.datasets.utils import _... | bsd-3-clause | 3c6cc8c5de959e13b992b269a79a165d | 33.192053 | 117 | 0.624056 | 3.932216 | false | true | false | false |
pytorch/vision | torchvision/models/quantization/resnet.py | 1 | 18400 | from functools import partial
from typing import Any, List, Optional, Type, Union
import torch
import torch.nn as nn
from torch import Tensor
from torchvision.models.resnet import (
BasicBlock,
Bottleneck,
ResNet,
ResNet18_Weights,
ResNet50_Weights,
ResNeXt101_32X8D_Weights,
ResNeXt101_64X4... | bsd-3-clause | dd195079e21ac887c1721a1fcc8917f6 | 35.947791 | 165 | 0.629022 | 3.389206 | false | false | false | false |
pytorch/vision | torchvision/prototype/features/_mask.py | 1 | 4657 | from __future__ import annotations
from typing import Any, List, Optional, Tuple, Union
import torch
from torchvision.transforms import InterpolationMode
from ._feature import _Feature, FillTypeJIT
class Mask(_Feature):
@classmethod
def _wrap(cls, tensor: torch.Tensor) -> Mask:
return tensor.as_sub... | bsd-3-clause | a0fae8c3e7c2521b13fe974d51bcdf44 | 32.503597 | 116 | 0.60919 | 3.728583 | false | false | false | false |
automl/auto-sklearn | autosklearn/pipeline/components/data_preprocessing/rescaling/__init__.py | 1 | 3397 | from typing import Dict, Optional
import os
from collections import OrderedDict
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import CategoricalHyperparameter
from sklearn.base import BaseEstimator
from autosklearn.askl_typing import FEAT_TYPE_TYPE
from autosklearn.p... | bsd-3-clause | 9460340caf23d12c8e2019b17206b986 | 35.138298 | 107 | 0.678834 | 4.366324 | false | true | false | false |
mozilla/kitsune | kitsune/kpi/tests/test_surveygizmo_utils.py | 1 | 3646 | from datetime import datetime
from unittest.mock import patch
from kitsune.kpi.surveygizmo_utils import (
add_email_to_campaign,
get_email_addresses,
get_exit_survey_results,
)
from kitsune.sumo.tests import TestCase
class GetEmailAddressesTests(TestCase):
@patch("kitsune.kpi.surveygizmo_utils.reques... | bsd-3-clause | 3ade033e5eb62c48792290034d8b6064 | 34.745098 | 95 | 0.626166 | 3.344954 | false | true | false | false |
mozilla/kitsune | kitsune/kpi/models.py | 1 | 3930 | from django.db.models import CharField, DateField, ForeignKey, PositiveIntegerField, CASCADE
from kitsune.sumo.models import ModelBase
VISITORS_METRIC_CODE = "general keymetrics:visitors"
L10N_METRIC_CODE = "general l10n:coverage"
SUPPORT_FORUM_CONTRIBUTORS_METRIC_CODE = "general supportforum:contributors"
KB_ENUS_C... | bsd-3-clause | c892293255a579f6b4a297e1a6b7d19d | 35.728972 | 95 | 0.711959 | 3.534173 | false | false | false | false |
mozilla/kitsune | kitsune/questions/badges.py | 1 | 1181 | from django.db.models.signals import post_save
from kitsune.questions.models import Answer
# Yo ******! These are year-agnostic badge templates which code uses
# to get-or-create the actual Badge instances. These strings should
# not be l10n-ized here--the badge title and description strings get
# l10n-ized elsewhere... | bsd-3-clause | 93a1b50f8d43c94bda203baf2e4129e0 | 30.918919 | 83 | 0.685859 | 3.656347 | false | false | false | false |
mozilla/kitsune | kitsune/kbforums/urls.py | 1 | 2181 | from django.conf import settings
from django.urls import re_path
from kitsune.flagit import views as flagit_views
from kitsune.kbforums import views
from kitsune.kbforums.feeds import PostsFeed, ThreadsFeed
from kitsune.kbforums.models import Post
from kitsune.sumo.views import handle404
if settings.DISABLE_FEEDS:
... | bsd-3-clause | bd97a152b8b2857f3fb94a4d72891c83 | 38.654545 | 98 | 0.634113 | 3.004132 | false | false | true | false |
mozilla/kitsune | kitsune/search/fields.py | 1 | 1617 | from functools import partial
from django.conf import settings
from elasticsearch_dsl.field import Keyword
from elasticsearch_dsl.field import Object as DSLObject
from elasticsearch_dsl.field import Text
from kitsune.search.es7_utils import es_analyzer_for_locale
SUPPORTED_LANGUAGES = list(settings.SUMO_LANGUAGES)
#... | bsd-3-clause | e479f70e3a66268c990c1b58c8f72008 | 33.404255 | 84 | 0.699443 | 3.934307 | false | false | false | false |
mozilla/kitsune | kitsune/upload/storage.py | 1 | 1281 | import hashlib
import itertools
import os
import time
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from storages.backends.s3boto3 import S3Boto3Storage
DjangoStorage = S3Boto3Storage if settings.AWS_ACCESS_KEY_ID else FileSystemStorage
class RenameFileStorage(DjangoStor... | bsd-3-clause | 40a418f3350a5faf4402fdf970b5dfc8 | 34.583333 | 89 | 0.676034 | 3.670487 | false | false | false | false |
mozilla/kitsune | kitsune/journal/models.py | 1 | 1300 | from datetime import datetime
from django.db import models
RECORD_INFO = "info"
RECORD_ERROR = "error"
class RecordManager(models.Manager):
def log(self, level, src, msg, **kwargs):
msg = msg.format(**kwargs).encode("utf-8")
return Record.objects.create(level=RECORD_INFO, src=src, msg=msg)
... | bsd-3-clause | 02a475bdca3360890cba9d2d4c7bebde | 27.888889 | 80 | 0.650769 | 3.542234 | false | false | false | false |
mozilla/kitsune | kitsune/wiki/diff.py | 1 | 1779 | import difflib
class BetterHtmlDiff(difflib.HtmlDiff):
"""Modified version of HtmlDiff.
* Replaces nowrap="nowrap" hard-coded style with a class
* Only replaces every other consecutive space with a to allow for
line wrapping.
For producing HTML side by side comparison with change highli... | bsd-3-clause | 6de14504f426f8e30903582c9e6c19cd | 37.673913 | 96 | 0.633502 | 4.266187 | false | false | false | false |
mozilla/kitsune | kitsune/kbforums/tests/test_views.py | 1 | 6805 | from kitsune.kbforums.events import NewPostEvent, NewThreadEvent
from kitsune.kbforums.models import Thread
from kitsune.kbforums.tests import KBForumTestCase, ThreadFactory
from kitsune.sumo.tests import get, post
from kitsune.users.tests import UserFactory, add_permission
from kitsune.wiki.tests import ApprovedRevisi... | bsd-3-clause | 88ba7f045f22813877eb701edd315965 | 37.446328 | 99 | 0.623071 | 3.751378 | false | true | false | false |
mozilla/kitsune | kitsune/customercare/migrations/0001_initial.py | 1 | 2658 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import kitsune.search.models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
... | bsd-3-clause | 2888b9d596fc681bbb2d2476b1de6e4d | 41.870968 | 152 | 0.559819 | 4.489865 | false | false | false | false |
flask-restful/flask-restful | flask_restful/__init__.py | 1 | 27859 | from __future__ import absolute_import
from functools import wraps, partial
from flask import request, url_for, current_app
from flask import abort as original_flask_abort
from flask import make_response as original_flask_make_response
from flask.views import MethodView
from flask.signals import got_request_exception
f... | bsd-3-clause | bd2573593fdc898cdec7dc2f811dee3d | 37.909218 | 129 | 0.613231 | 4.452453 | false | false | false | false |
mozilla/kitsune | kitsune/products/tests/__init__.py | 1 | 1578 | # -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
import factory
import factory.fuzzy
import factory.django
from kitsune.products.models import Product, Topic, Version
from kitsune.sumo.tests import FuzzyUnicode
class ProductFactory(factory.django.DjangoModelFactory):
class Meta:
... | bsd-3-clause | e689ea708795d0424298bb2816d80bac | 29.346154 | 76 | 0.718631 | 3.839416 | false | false | false | false |
mozilla/kitsune | kitsune/questions/tests/test_feeds.py | 1 | 4558 | from datetime import datetime, timedelta
from django.core.cache import cache
from pyquery import PyQuery as pq
from kitsune.products.tests import ProductFactory, TopicFactory
from kitsune.questions.feeds import QuestionsFeed, TaggedQuestionsFeed
from kitsune.questions.models import Question
from kitsune.questions.tes... | bsd-3-clause | f43f9dc1a9ec7785e8abf33a609df575 | 43.252427 | 98 | 0.654892 | 3.760726 | false | true | false | false |
mozilla/kitsune | kitsune/wiki/events.py | 1 | 14820 | import difflib
import logging
from bleach import clean
from django.conf import settings
from django.contrib.sites.models import Site
from django.urls import reverse as django_reverse
from django.utils.translation import gettext_lazy as _lazy
from django.utils.translation import ugettext as _
from wikimarkup.parser imp... | bsd-3-clause | 3f8313d49d76c77452aabb0057bfb80d | 34.625 | 99 | 0.603509 | 4.109817 | false | false | false | false |
mozilla/kitsune | kitsune/flagit/migrations/0001_initial.py | 1 | 2059 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0001_init... | bsd-3-clause | 25a2e83ce9909f6e571886bcaefc21f9 | 49.219512 | 294 | 0.603691 | 4.210634 | false | false | false | false |
mozilla/kitsune | kitsune/kpi/api.py | 1 | 15594 | from collections import defaultdict
from datetime import date, timedelta
from operator import itemgetter
from django.conf import settings
from django.core.cache import cache
from django.db import connections, router
from django.db.models import Count, F
import django_filters
from django_filters.rest_framework import ... | bsd-3-clause | 9e92692610072995c03e8452a373cd62 | 31.352697 | 96 | 0.602796 | 3.727055 | false | false | false | false |
mozilla/kitsune | kitsune/wiki/badges.py | 1 | 1631 | from django.conf import settings
from django.db.models.signals import post_save
from kitsune.wiki.models import Revision
# Yo ******! These are year-agnostic badge templates which code uses
# to get-or-create the actual Badge instances. These strings should
# not be l10n-ized here--the badge title and description str... | bsd-3-clause | 9aea6f577e81d544c8b1bf6a4ae474d1 | 30.365385 | 71 | 0.664623 | 3.568928 | false | false | false | false |
web2py/pydal | pydal/dialects/teradata.py | 1 | 3400 | from .._compat import basestring
from ..adapters.teradata import Teradata
from . import dialects, sqltype_for
from .base import SQLDialect
@dialects.register_for(Teradata)
class TeradataDialect(SQLDialect):
@sqltype_for("integer")
def type_integer(self):
return "INT"
@sqltype_for("text")
def ... | bsd-3-clause | 3620446674fbcbd161b1dde5e3f07445 | 24.954198 | 77 | 0.531471 | 3.667745 | false | false | false | false |
web2py/pydal | pydal/tools/tags.py | 1 | 1946 | import datetime
import functools
from .. import Field
from ..validators import *
class Tags:
def __init__(self, table, name="default"):
self.table = table
db = table._db
self.tag_table = db.define_table(
table._tablename + "_tag_" + name,
Field("tagpath"),
... | bsd-3-clause | d2710f3d15125f91e01f124175e5ef0e | 30.901639 | 83 | 0.517986 | 3.685606 | false | false | false | false |
web2py/pydal | pydal/adapters/sap.py | 1 | 1460 | import re
from .._compat import integer_types, long
from . import adapters
from .base import SQLAdapter
@adapters.register_for("sapdb")
class SAPDB(SQLAdapter):
dbengine = "sapdb"
drivers = ("sapdb",)
REGEX_URI = (
"^(?P<user>[^:@]+)(:(?P<password>[^@]*))?"
r"@(?P<host>[^:/]+|\[[^\]]+\])... | bsd-3-clause | 39f672f0ac1f6c902a1353a7452cb7a1 | 31.444444 | 85 | 0.574658 | 3.451537 | false | false | false | false |
openstates/billy | billy/models/utils.py | 4 | 4335 | import collections
from django.core import urlresolvers
def mongoid_2_url(abbr, _id):
letter = _id[2]
viewname = {
'B': 'bill',
'C': 'committee',
'V': 'vote',
'L': 'legislator_noslug',
}[letter]
return urlresolvers.reverse(viewname, args=[abbr, _id])
## {{{ http://co... | bsd-3-clause | 57a522aa2968a4c30d97f8f5f641033b | 26.09375 | 78 | 0.551788 | 3.863636 | false | false | false | false |
numpy/numpy | numpy/fft/tests/test_helper.py | 20 | 6148 | """Test functions for fftpack.helper module
Copied from fftpack.helper by Pearu Peterson, October 2005
"""
import numpy as np
from numpy.testing import assert_array_almost_equal
from numpy import fft, pi
class TestFFTShift:
def test_definition(self):
x = [0, 1, 2, 3, 4, -4, -3, -2, -1]
y = [-4,... | bsd-3-clause | c366c6abce439214112f20a7b6b56f9f | 35.814371 | 106 | 0.530416 | 3.217164 | false | true | false | false |
numpy/numpy | numpy/linalg/lapack_lite/make_lite.py | 12 | 12214 | #!/usr/bin/env python2.7
# WARNING! This a Python 2 script. Read README.rst for rationale.
"""
Usage: make_lite.py <wrapped_routines_file> <lapack_dir>
Typical invocation:
make_lite.py wrapped_routines /tmp/lapack-3.x.x
Requires the following to be on the path:
* f2c
* patch
"""
import sys
import os
import re... | bsd-3-clause | ef5d00ff5bc19cb4934ddce8d6e0085d | 30.317949 | 88 | 0.590552 | 3.613609 | false | false | false | false |
numpy/numpy | numpy/polynomial/tests/test_hermite.py | 24 | 18577 | """Tests for hermite module.
"""
from functools import reduce
import numpy as np
import numpy.polynomial.hermite as herm
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
assert_almost_equal, assert_raises, assert_equal, assert_,
)
H0 = np.array([1])
H1 = np.array([0, 2])
H2 = np.ar... | bsd-3-clause | 29bd1090b96d47479a6e518aa3a01a88 | 32.472072 | 78 | 0.511331 | 2.854487 | false | true | false | false |
numpy/numpy | numpy/lib/histograms.py | 2 | 37698 | """
Histogram-related functions
"""
import contextlib
import functools
import operator
import warnings
import numpy as np
from numpy.core import overrides
__all__ = ['histogram', 'histogramdd', 'histogram_bin_edges']
array_function_dispatch = functools.partial(
overrides.array_function_dispatch, module='numpy')
... | bsd-3-clause | 4a14341aff1849a2ff5dc4136c15e95b | 34.231776 | 104 | 0.60104 | 3.865669 | false | false | false | false |
numpy/numpy | numpy/core/overrides.py | 7 | 8306 | """Implementation of __array_function__ overrides from NEP-18."""
import collections
import functools
import os
from numpy.core._multiarray_umath import (
add_docstring, implement_array_function, _get_implementing_args)
from numpy.compat._inspect import getargspec
ARRAY_FUNCTION_ENABLED = bool(
int(os.enviro... | bsd-3-clause | 138b84d23e00c70eb90eb04885e42146 | 36.080357 | 79 | 0.636769 | 4.938169 | false | false | false | false |
numpy/numpy | doc/postprocess.py | 18 | 1328 | #!/usr/bin/env python3
"""
Post-processes HTML and Latex files output by Sphinx.
"""
import io
def main():
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('mode', help='file mode', choices=('html', 'tex'))
parser.add_argument('file', nargs='+', help='input fil... | bsd-3-clause | dacb470f8c2068a447c5dea67ffabb89 | 26.102041 | 74 | 0.561747 | 3.827089 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.