text stringlengths 0 1.05M | meta dict |
|---|---|
__all__ = ['Uniform']
class Uniform:
'''
A uniform is a global GLSL variable declared with the "uniform" storage qualifier.
These act as parameters that the user of a shader program can pass to that program.
In ModernGL, Uniforms can be accessed using :py:meth:`Program.__getitem__`
... | {
"repo_name": "cprogrammer1994/ModernGL",
"path": "moderngl/program_members/uniform.py",
"copies": "1",
"size": "6211",
"license": "mit",
"hash": -2388784603019592700,
"line_mean": 33.893258427,
"line_max": 91,
"alpha_frac": 0.2680727741,
"autogenerated": false,
"ratio": 5.386816999132697,
"con... |
__all__ = ['unravel_index',
'mgrid',
'ogrid',
'r_', 'c_', 's_',
'index_exp', 'ix_',
'ndenumerate','ndindex',
'fill_diagonal','diag_indices','diag_indices_from']
import sys
import numpy.core.numeric as _nx
from numpy.core.numeric import ( asarray, Scalar... | {
"repo_name": "plaes/numpy",
"path": "numpy/lib/index_tricks.py",
"copies": "2",
"size": "26790",
"license": "bsd-3-clause",
"hash": -6568486314197036000,
"line_mean": 28.7666666667,
"line_max": 80,
"alpha_frac": 0.5323628219,
"autogenerated": false,
"ratio": 3.7515754096064975,
"config_test": ... |
__all__ = ['unravel_index',
'mgrid',
'ogrid',
'r_', 'c_', 's_',
'index_exp', 'ix_',
'ndenumerate','ndindex']
import sys
import numpy.core.numeric as _nx
from numpy.core.numeric import asarray, ScalarType, array, dtype
from numpy.core.numerictypes import find_commo... | {
"repo_name": "houseind/robothon",
"path": "GlyphProofer/dist/GlyphProofer.app/Contents/Resources/lib/python2.6/numpy/lib/index_tricks.py",
"copies": "1",
"size": "14839",
"license": "mit",
"hash": 5153041969742579000,
"line_mean": 29.0993914807,
"line_max": 80,
"alpha_frac": 0.4986858953,
"autogen... |
__all__ = ['unsigned_volume','signed_volume']
from scipy import sqrt,inner,shape,asarray
from scipy.misc import factorial
from scipy.linalg import det
def unsigned_volume(pts):
"""Unsigned volume of a simplex
Computes the unsigned volume of an M-simplex embedded in N-dimensional
space. The poin... | {
"repo_name": "DongliangGao/pydec",
"path": "pydec/math/volume.py",
"copies": "6",
"size": "2450",
"license": "bsd-3-clause",
"hash": -7365131900998904000,
"line_mean": 21.4770642202,
"line_max": 75,
"alpha_frac": 0.5326530612,
"autogenerated": false,
"ratio": 3.555878084179971,
"config_test": ... |
__all__ = ('UpdatedPermissionChecksMixin',)
class UpdatedPermissionChecksMixin(object):
"""
Updated permission checks mixin.
"""
def check_permissions(self, request):
"""
Check if the request should be permitted.
Raises an appropriate exception if the request is not permitted.
... | {
"repo_name": "barseghyanartur/rest_condition",
"path": "rest_condition/mixins.py",
"copies": "1",
"size": "1420",
"license": "mit",
"hash": 8450159942854077000,
"line_mean": 39.5714285714,
"line_max": 75,
"alpha_frac": 0.5683098592,
"autogenerated": false,
"ratio": 4.982456140350878,
"config_t... |
"""All uploaded files are directly send back to the client."""
from werkzeug.serving import run_simple
from werkzeug.wrappers import Request
from werkzeug.wrappers import Response
from werkzeug.wsgi import wrap_file
def view_file(req):
if "uploaded_file" not in req.files:
return Response("no file uploaded... | {
"repo_name": "pallets/werkzeug",
"path": "examples/upload.py",
"copies": "1",
"size": "1081",
"license": "bsd-3-clause",
"hash": 807087454680502400,
"line_mean": 27.4473684211,
"line_max": 83,
"alpha_frac": 0.6419981499,
"autogenerated": false,
"ratio": 3.8469750889679717,
"config_test": false... |
__all__ = ('UrlDispatcher', 'UrlMappingMatchInfo',
'Route', 'PlainRoute', 'DynamicRoute', 'StaticRoute')
import abc
import asyncio
import collections
import mimetypes
import re
import os
import inspect
from urllib.parse import urlencode
from . import hdrs
from .abc import AbstractRouter, AbstractMatchInfo
... | {
"repo_name": "lfblogs/aio2py",
"path": "aio2py/required/aiohttp/web_urldispatcher.py",
"copies": "1",
"size": "12462",
"license": "apache-2.0",
"hash": -730965548044607500,
"line_mean": 29.7703703704,
"line_max": 79,
"alpha_frac": 0.5656395442,
"autogenerated": false,
"ratio": 4.1875,
"config_... |
__all__ = ('UrlDispatcher', 'UrlMappingMatchInfo',
'Route', 'PlainRoute', 'DynamicRoute', 'StaticRoute')
import abc
import asyncio
import collections
import mimetypes
import re
import os
import inspect
from urllib.parse import urlencode, unquote
from . import hdrs
from .abc import AbstractRouter, Abstrac... | {
"repo_name": "morgan-del/aiohttp",
"path": "aiohttp/web_urldispatcher.py",
"copies": "3",
"size": "13345",
"license": "apache-2.0",
"hash": -1940640657349346600,
"line_mean": 30.1072261072,
"line_max": 79,
"alpha_frac": 0.5659797677,
"autogenerated": false,
"ratio": 4.224438113327002,
"config_... |
"""All URLs for the extension."""
from django.conf.urls import include, url
from rest_framework.urlpatterns import format_suffix_patterns
from geokey_airquality import views
exportpatterns = [
url(r'^admin/airquality/export/(?P<file>[\w-]+)$',
views.AQExportView.as_view(),
name='export'),
]
da... | {
"repo_name": "ExCiteS/geokey-airquality",
"path": "geokey_airquality/urls.py",
"copies": "1",
"size": "2455",
"license": "mit",
"hash": -3789967503000551400,
"line_mean": 28.578313253,
"line_max": 70,
"alpha_frac": 0.5401221996,
"autogenerated": false,
"ratio": 3.6478454680534917,
"config_test... |
"""All URLs for the extension."""
from django.conf.urls import url
from .views import (
IndexPage,
AllDataImportsPage,
AddDataImportPage,
SingleDataImportPage,
DataImportCreateCategoryPage,
DataImportAssignFieldsPage,
DataImportAllDataFeaturesPage,
RemoveDataImportPage
)
urlpatterns ... | {
"repo_name": "ExCiteS/geokey-dataimports",
"path": "geokey_dataimports/urls.py",
"copies": "1",
"size": "1868",
"license": "mit",
"hash": 843526413075476400,
"line_mean": 29.1290322581,
"line_max": 67,
"alpha_frac": 0.5695931478,
"autogenerated": false,
"ratio": 3.5854126679462572,
"config_tes... |
"""All URLs for the extension."""
from django.conf.urls import url
from .views import (
IndexPage,
AllWebResourcesPage,
AddWebResourcePage,
SingleWebResourcePage,
RemoveWebResourcePage,
ReorderWebResourcesAjax,
UpdateWebResourceAjax,
AllWebResourcesAPI,
SingleWebResourceAPI
)
url... | {
"repo_name": "ExCiteS/geokey-webresources",
"path": "geokey_webresources/urls.py",
"copies": "1",
"size": "2129",
"license": "mit",
"hash": 7454576996403766000,
"line_mean": 26.6493506494,
"line_max": 60,
"alpha_frac": 0.5232503523,
"autogenerated": false,
"ratio": 3.7026086956521738,
"config_... |
__all__ = ['UserItemRecommender']
try:
from recsys.datamodel.data import Data
from recsys.algorithm.factorize import SVDNeighbourhood
except ImportError:
pass
from .backend import Backend
K = 100
MIN_VALUES = 2
N = 10
class Recommender(Backend):
def load(self, dataset, write=None):
self._m... | {
"repo_name": "norbert/fickle",
"path": "fickle/recommenders.py",
"copies": "1",
"size": "1886",
"license": "mit",
"hash": -9009157113959560000,
"line_mean": 23.1794871795,
"line_max": 71,
"alpha_frac": 0.5646871686,
"autogenerated": false,
"ratio": 3.9538784067085953,
"config_test": false,
"... |
"""
Main entry point for the allusive-editor
"""
##########################################################################
## Imports
##########################################################################
import Tkinter as tk
from .colors import *
from .widgets import *
########################################... | {
"repo_name": "bbengfort/allusive-editor",
"path": "allusive/app.py",
"copies": "1",
"size": "2127",
"license": "mit",
"hash": -8406025251716671000,
"line_mean": 27.36,
"line_max": 74,
"alpha_frac": 0.5016455101,
"autogenerated": false,
"ratio": 4.005649717514125,
"config_test": true,
"has_no... |
"""
Defines colors and color functions for use in the App
"""
##########################################################################
## Colors
##########################################################################
WHITE = "#FFFFFF"
# Dark Greys
DARK_WOODS = "#190508"
TWILIGHT = "#2A2C31"
DEPTHS =... | {
"repo_name": "bbengfort/allusive-editor",
"path": "allusive/colors.py",
"copies": "1",
"size": "1095",
"license": "mit",
"hash": 1741915596246103300,
"line_mean": 22.2978723404,
"line_max": 74,
"alpha_frac": 0.4657534247,
"autogenerated": false,
"ratio": 3.308157099697885,
"config_test": false... |
"""All utils for the WeGovNow extension."""
from django.utils.text import slugify
from django.contrib.sites.models import Site
from allauth.socialaccount.adapter import get_adapter
from allauth_uwum.views import UWUMAdapter, UWUMView
from geokey.users.models import User
def get_uwum_view(request):
"""Get the U... | {
"repo_name": "ExCiteS/geokey-wegovnow",
"path": "geokey_wegovnow/utils.py",
"copies": "1",
"size": "2156",
"license": "mit",
"hash": 9097837286405053000,
"line_mean": 28.5342465753,
"line_max": 79,
"alpha_frac": 0.6910946197,
"autogenerated": false,
"ratio": 3.92,
"config_test": false,
"has_... |
__all__ = ["validate", "customtype"]
__author__ = "Carl Bordum Hansen"
__license__ = "MIT"
import collections.abc
import reprlib
# Open questions:
# how should sets be handled?
# should we handle collections.abc.MappingView?
def _make_typeerror(structure, data):
error_msg = "%s is of type %s, expected... | {
"repo_name": "Zaab1t/datatyping",
"path": "datatyping/datatyping.py",
"copies": "1",
"size": "3739",
"license": "mit",
"hash": -2047387864788691200,
"line_mean": 30.4201680672,
"line_max": 87,
"alpha_frac": 0.5530890612,
"autogenerated": false,
"ratio": 4.007502679528403,
"config_test": false,... |
"""All validators for the WeGovNow extension."""
from oauth2_provider.oauth2_validators import OAuth2Validator
from allauth.socialaccount.models import SocialAccount
from geokey_wegovnow.utils import get_uwum_view, sign_up_uwum_user
class UWUMOAuth2Validator(OAuth2Validator):
"""UWUM OAuth2 validator."""
d... | {
"repo_name": "ExCiteS/geokey-wegovnow",
"path": "geokey_wegovnow/validators.py",
"copies": "1",
"size": "1831",
"license": "mit",
"hash": -4116874235767886000,
"line_mean": 37.1458333333,
"line_max": 79,
"alpha_frac": 0.6198798471,
"autogenerated": false,
"ratio": 4.189931350114416,
"config_te... |
"""All valid types for Research, Resources and Models."""
from enum import Enum
class ResearchTypes(Enum):
"""This class contains all types of valid researches.
It's used to check against the names in `research_data.yml`, to validate types in requests
and to guarantee database string integrity.
"""
... | {
"repo_name": "Nukesor/spacesurvival",
"path": "server/data/types.py",
"copies": "1",
"size": "1056",
"license": "mit",
"hash": -4760405113571016000,
"line_mean": 27.5405405405,
"line_max": 94,
"alpha_frac": 0.7064393939,
"autogenerated": false,
"ratio": 3.8823529411764706,
"config_test": false... |
__all__ = ('VerificationManager', 'verify_user', 'verify_group')
from pypushover import BaseManager, base_url, send
verify_url = base_url + "/users/validate.json"
class VerificationManager(BaseManager):
def __init__(self, app_token):
super(VerificationManager, self).__init__(app_token)
def verify_u... | {
"repo_name": "KronosKoderS/py_pushover",
"path": "pypushover/verification.py",
"copies": "2",
"size": "1478",
"license": "mit",
"hash": -5655506966091031000,
"line_mean": 22.8387096774,
"line_max": 102,
"alpha_frac": 0.6041948579,
"autogenerated": false,
"ratio": 3.71356783919598,
"config_test... |
__all__ = ["__version__", "Client"]
__version__ = "0.1.0"
import collections
import json
import memcache
class Client(object):
__slots__ = ["connection"]
def __init__(self, host="127.0.0.1", port=11222):
self.connection = memcache.Client(["%s:%s" % (host, port)])
def get_user_variants(self, ex... | {
"repo_name": "brettlangdon/golab-python",
"path": "golab.py",
"copies": "1",
"size": "2785",
"license": "mit",
"hash": -2377516700649848000,
"line_mean": 30.2921348315,
"line_max": 80,
"alpha_frac": 0.5666068223,
"autogenerated": false,
"ratio": 3.7282463186077646,
"config_test": false,
"has... |
__all__ = ['__version__', 'get_version']
default_app_config = 'djangobb_forum.apps.ForumConfig'
version_info = (0, 0, 1, 'a', 0)
# format: ('major', 'minor', 'micro', 'releaselevel', 'serial')
# __version__ format compatible with distutils2.version.NormalizedVersion
def get_version():
"Returns the version as a ... | {
"repo_name": "aldenjenkins/foobargamingwebsite",
"path": "djangobb_forum/__init__.py",
"copies": "3",
"size": "1217",
"license": "bsd-3-clause",
"hash": 6144643921433578000,
"line_mean": 32.8055555556,
"line_max": 73,
"alpha_frac": 0.5160230074,
"autogenerated": false,
"ratio": 3.600591715976331... |
__all__ = ['__version__', 'get_version']
version_info = (0, 0, 1, 'a', 0)
# format: ('major', 'minor', 'micro', 'releaselevel', 'serial')
# __version__ format compatible with distutils2.version.NormalizedVersion
def get_version():
"Returns the version as a human-format string."
version = '%d.%d.%d' % (versio... | {
"repo_name": "tjvr/s2forums",
"path": "djangobb_forum/__init__.py",
"copies": "10",
"size": "1161",
"license": "bsd-3-clause",
"hash": -8238102689583147000,
"line_mean": 33.1470588235,
"line_max": 73,
"alpha_frac": 0.5030146425,
"autogenerated": false,
"ratio": 3.650943396226415,
"config_test"... |
__all__ = ['view_as_blocks', 'view_as_windows']
import numpy as np
from numpy.lib.stride_tricks import as_strided
from warnings import warn
def view_as_blocks(arr_in, block_shape):
"""Block view of the input n-dimensional array (using re-striding).
Blocks are non-overlapping views of the input array.
P... | {
"repo_name": "SamHames/scikit-image",
"path": "skimage/util/shape.py",
"copies": "1",
"size": "7866",
"license": "bsd-3-clause",
"hash": -7651879159536467000,
"line_mean": 30.464,
"line_max": 78,
"alpha_frac": 0.5199593186,
"autogenerated": false,
"ratio": 3.342966425839354,
"config_test": fal... |
__all__ = ['view_as_blocks', 'view_as_windows']
import numpy as np
from numpy.lib.stride_tricks import as_strided
def view_as_blocks(arr_in, block_shape):
"""Block view of the input n-dimensional array (using re-striding).
Blocks are non-overlapping views of the input array.
Parameters
----------
... | {
"repo_name": "davehouse/image_diff",
"path": "skssim/shape.py",
"copies": "3",
"size": "7095",
"license": "mit",
"hash": -7262163780960584000,
"line_mean": 29.5818965517,
"line_max": 78,
"alpha_frac": 0.5133192389,
"autogenerated": false,
"ratio": 3.2650713299585825,
"config_test": false,
"h... |
"""All views are here."""
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.shortcuts import get_object_or_404, redirect
from django.core.urlresolvers import reverse_lazy
from django.views.generic import DetailVie... | {
"repo_name": "kpi-web-guild/django-girls-blog-DrEdi",
"path": "main/views.py",
"copies": "1",
"size": "4052",
"license": "mit",
"hash": 1474302079513974500,
"line_mean": 29.2388059701,
"line_max": 107,
"alpha_frac": 0.6473346496,
"autogenerated": false,
"ratio": 3.8517110266159698,
"config_tes... |
"""All views for the extension."""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import CreateView, FormView, TemplateView
from django.shortcuts import redirect
from django.db.models import BooleanField, Q, Case, When
from django... | {
"repo_name": "ExCiteS/geokey-webresources",
"path": "geokey_webresources/views.py",
"copies": "1",
"size": "18103",
"license": "mit",
"hash": -3148523232075520500,
"line_mean": 28.823723229,
"line_max": 79,
"alpha_frac": 0.5449373032,
"autogenerated": false,
"ratio": 4.92732716385411,
"config_... |
"""All views for the extension."""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import collections
import operator
import csv
import StringIO
from django.conf import settings
from django.core import mail
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from ... | {
"repo_name": "ExCiteS/geokey-airquality",
"path": "geokey_airquality/views.py",
"copies": "1",
"size": "38591",
"license": "mit",
"hash": 846304943661054600,
"line_mean": 31.6765453006,
"line_max": 115,
"alpha_frac": 0.5113109274,
"autogenerated": false,
"ratio": 5.251190638182066,
"config_tes... |
"""All views for the extension."""
# -*- coding: utf-8 -*-
import json
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.views.generic import CreateView, FormView, TemplateView
from django.shortcuts import redirect
from django.db.models import IntegerField, ... | {
"repo_name": "ExCiteS/geokey-dataimports",
"path": "geokey_dataimports/views.py",
"copies": "1",
"size": "27162",
"license": "mit",
"hash": -7592450608590207000,
"line_mean": 32.1648351648,
"line_max": 95,
"alpha_frac": 0.510234887,
"autogenerated": false,
"ratio": 5.234534592407015,
"config_t... |
"""All views for the WeGovNow extension."""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from requests import get
from django.shortcuts import redirect
from django.views.generic import TemplateView
from rest_framework import status
from rest_framework.renderers import JSONRenderer
from rest_frame... | {
"repo_name": "ExCiteS/geokey-wegovnow",
"path": "geokey_wegovnow/views.py",
"copies": "1",
"size": "2701",
"license": "mit",
"hash": -1332115923388867600,
"line_mean": 31.5421686747,
"line_max": 67,
"alpha_frac": 0.6131062569,
"autogenerated": false,
"ratio": 4.155384615384615,
"config_test": ... |
"""All views of the UWUM provider."""
from requests import get, post
from django.core.urlresolvers import reverse
from allauth.utils import build_absolute_uri
from allauth.socialaccount import app_settings
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2View,
OAuth2LoginVi... | {
"repo_name": "ExCiteS/django-allauth-uwum",
"path": "allauth_uwum/views.py",
"copies": "1",
"size": "3469",
"license": "mit",
"hash": -603584964514477000,
"line_mean": 32.0380952381,
"line_max": 79,
"alpha_frac": 0.6650331508,
"autogenerated": false,
"ratio": 3.6943556975505856,
"config_test":... |
# All views todo with votes + profiles.
from voting.models import Vote
from voting.views import vote_on_object
from voting.managers import possible_votes, votes
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
... | {
"repo_name": "spreeker/democracygame",
"path": "democracy/profiles/views/votes.py",
"copies": "1",
"size": "6300",
"license": "bsd-3-clause",
"hash": 7677325183784965000,
"line_mean": 37.1818181818,
"line_max": 103,
"alpha_frac": 0.6385714286,
"autogenerated": false,
"ratio": 3.5333707234997194,... |
__all__ = ("VirtualHeap",
"SizedVirtualHeap")
import os
import sys
import subprocess
import random
import string
import tempfile
from six.moves import xrange
from pyoram.util._virtual_heap_helper import lib as _clib
from pyoram.util.misc import log2floor
numerals = ''.join([c for c in string.printable \
... | {
"repo_name": "ghackebeil/PyORAM",
"path": "src/pyoram/util/virtual_heap.py",
"copies": "1",
"size": "14663",
"license": "mit",
"hash": 7233506078890795000,
"line_mean": 32.2494331066,
"line_max": 79,
"alpha_frac": 0.5202209643,
"autogenerated": false,
"ratio": 3.7367482161060144,
"config_test"... |
__all__ = ['Visdata','SersicSource','GaussSource','PointSource','SIELens','ExternalShear',
'read_visdata','concatvis','bin_visibilities']
import numpy as np
import os
import astropy.constants as co
import warnings
from .utils import cart2pol,pol2cart
c = co.c.value # speed of light, in m/s
G = co.G.value ... | {
"repo_name": "jspilker/visilens",
"path": "visilens/class_utils.py",
"copies": "1",
"size": "32136",
"license": "mit",
"hash": -1973722716337958700,
"line_mean": 43.4481327801,
"line_max": 112,
"alpha_frac": 0.5588125467,
"autogenerated": false,
"ratio": 3.8075829383886255,
"config_test": fals... |
__all__ = ['visible', 'cacheable', 'callable_find_by', 'property_find_by']
def cacheable_decorator(lookup):
def func(self):
if not hasattr(self, '_elements_cache'):
self._elements_cache = {} # {callable_id: element(s)}
cache = self._elements_cache
key = id(lookup)
if ke... | {
"repo_name": "imsardine/learning",
"path": "selenium/pageobject_support.py",
"copies": "1",
"size": "2447",
"license": "mit",
"hash": -6286568557057962000,
"line_mean": 41.1896551724,
"line_max": 123,
"alpha_frac": 0.6317940335,
"autogenerated": false,
"ratio": 3.853543307086614,
"config_test"... |
__all__ = ['VisualizationFrame']
import numpy as np
from sympy import Dummy, lambdify
from sympy.matrices.expressions import Identity
from sympy.physics.mechanics import Point, ReferenceFrame
from .shapes import Shape
class VisualizationFrame(object):
"""
A VisualizationFrame represents an object that you w... | {
"repo_name": "jcrist/pydy",
"path": "pydy/viz/visualization_frame.py",
"copies": "1",
"size": "13231",
"license": "bsd-3-clause",
"hash": 6582109941948204000,
"line_mean": 34.9538043478,
"line_max": 82,
"alpha_frac": 0.5954198473,
"autogenerated": false,
"ratio": 4.779985549132948,
"config_tes... |
__all__ = ['VisualizationFrame']
import sys
if sys.version_info < (3, 0):
from collections import Iterator
else:
from collections.abc import Iterator
import numpy as np
from sympy import Dummy, lambdify
from sympy.matrices.expressions import Identity
from sympy.physics.mechanics import Point, ReferenceFrame
f... | {
"repo_name": "oliverlee/pydy",
"path": "pydy/viz/visualization_frame.py",
"copies": "1",
"size": "15358",
"license": "bsd-3-clause",
"hash": 5979355711289667000,
"line_mean": 35.9182692308,
"line_max": 84,
"alpha_frac": 0.5886834223,
"autogenerated": false,
"ratio": 4.787406483790524,
"config_... |
__all__ = [ "voxellise",
"shrinkDisk" ]
import image
import _irtk
import numpy as np
def voxellise( points, triangles, header=None, pixelSize=[1,1,1,1] ):
points = np.array( points, dtype='float64' )
triangles = np.array( triangles, dtype='int32' )
if header is None:
pixelSize = n... | {
"repo_name": "BioMedIA/IRTK",
"path": "wrapping/cython/irtk/vtk2irtk.py",
"copies": "5",
"size": "1551",
"license": "apache-2.0",
"hash": -1237808093245144000,
"line_mean": 32.7173913043,
"line_max": 69,
"alpha_frac": 0.4932301741,
"autogenerated": false,
"ratio": 3.321199143468951,
"config_te... |
__all__ = ['vseval', 'Env', 'UnboundVar', 'GLOBAL_ENV']
from collections import namedtuple
class LispException(Exception):
pass
class UnboundVar(LispException):
pass
compound_procedure = namedtuple('compound_procedure', 'params, body, env')
def vseval(exp, env):
# properly tail recursive
while Tr... | {
"repo_name": "nalssee/SICP",
"path": "vanilla_scheme/vseval.py",
"copies": "1",
"size": "5325",
"license": "mit",
"hash": 5173525863171278000,
"line_mean": 27.1746031746,
"line_max": 90,
"alpha_frac": 0.5162441315,
"autogenerated": false,
"ratio": 3.619986403806934,
"config_test": false,
"ha... |
"""All walls, roads, etc goes here."""
# coding=utf-8
from PyQt5.QtWidgets import QGraphicsRectItem
from PyQt5.QtCore import QRectF, Qt
from PyQt5.QtGui import QImage, QPen
class Object(QGraphicsRectItem):
def __init__(self, x=0, y=0, width=100, height=100):
super().__init__(x, y, width, height)
... | {
"repo_name": "Shurup228/start2k17",
"path": "objects/map_elements.py",
"copies": "1",
"size": "2139",
"license": "mit",
"hash": -2865377750924771000,
"line_mean": 26.4230769231,
"line_max": 62,
"alpha_frac": 0.5960729313,
"autogenerated": false,
"ratio": 3.5590682196339434,
"config_test": fals... |
__all__ = ['watchers',
<!--(for g in groups)-->
'$!g['groupname']!$',
<!--(end)-->
]
for module in __all__:
__import__("shm.{0}".format(module))
from shm.base import auv_var_lib
_init = auv_var_lib.shm_init
_init.argtypes = []
_init()
class ShmEvalError(Exception):
pass
def... | {
"repo_name": "cuauv/software",
"path": "libshm/templates/init.py",
"copies": "1",
"size": "1074",
"license": "bsd-3-clause",
"hash": -1130039313483525100,
"line_mean": 21.375,
"line_max": 85,
"alpha_frac": 0.5512104283,
"autogenerated": false,
"ratio": 3.2059701492537314,
"config_test": false,... |
__all__ = ['Waterspout', 'App']
import os
import inspect
import tornado.web
import tornado.options
from jinja2 import Environment, FileSystemLoader
from .config import Config
from .utils import get_root_path
from tornado.options import define, options
define('config', default='', help='path to the config file', t... | {
"repo_name": "whtsky/Waterspout",
"path": "waterspout/app.py",
"copies": "1",
"size": "10052",
"license": "mit",
"hash": -2126149274333388500,
"line_mean": 29.1861861862,
"line_max": 77,
"alpha_frac": 0.5575009948,
"autogenerated": false,
"ratio": 4.299401197604791,
"config_test": true,
"has... |
__all__ = ["w_autocomplete",
]
# @todo Their are performance issues need to profile and find out in which functions are the bottlenecks
# Selenium WebDriver
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
#from selenium.webdriver.common.keys import Keys
from gl... | {
"repo_name": "flavour/iscram",
"path": "modules/tests/core/widgets.py",
"copies": "1",
"size": "2989",
"license": "mit",
"hash": -765098672739011500,
"line_mean": 35.0120481928,
"line_max": 104,
"alpha_frac": 0.5152224824,
"autogenerated": false,
"ratio": 4.515105740181269,
"config_test": fals... |
__all__ = ["WebhookNotifier"]
from freight import http
from freight.models import App, Task, User
from .base import Notifier, generate_event_title
def stringify_date(date):
return date.isoformat() + "Z" if date else None
class WebhookNotifier(Notifier):
def get_options(self):
return {"url": {"requ... | {
"repo_name": "getsentry/freight",
"path": "freight/notifiers/webhook.py",
"copies": "1",
"size": "1596",
"license": "apache-2.0",
"hash": -6516808958275180000,
"line_mean": 32.25,
"line_max": 76,
"alpha_frac": 0.563283208,
"autogenerated": false,
"ratio": 3.790973871733967,
"config_test": fals... |
__all__ = ["WebServer"]
from json import dumps as json_encode
from os.path import dirname, join as path_join
from typing import Any, Dict, Mapping, Optional, Sequence, Set, Tuple, Type, Union
from mako.template import Template # type: ignore
from werkzeug.datastructures import Headers
from werkzeug.exceptions import... | {
"repo_name": "k4cg/nichtparasoup",
"path": "nichtparasoup/webserver/__init__.py",
"copies": "1",
"size": "5829",
"license": "mit",
"hash": 8435001186827339000,
"line_mean": 39.2,
"line_max": 116,
"alpha_frac": 0.6150283067,
"autogenerated": false,
"ratio": 4.053546592489569,
"config_test": fal... |
__all__ = ('WebSocketResponse', 'MsgType')
import asyncio
import warnings
from . import hdrs
from .errors import HttpProcessingError, ClientDisconnectedError
from .websocket import do_handshake, Message, WebSocketError
from .websocket_client import MsgType, closedMessage
from .web_exceptions import (
HTTPBadReque... | {
"repo_name": "lfblogs/aio2py",
"path": "aio2py/required/aiohttp/web_ws.py",
"copies": "1",
"size": "8999",
"license": "apache-2.0",
"hash": 5304132861120272000,
"line_mean": 32.8308270677,
"line_max": 79,
"alpha_frac": 0.5369485498,
"autogenerated": false,
"ratio": 4.814874264312467,
"config_t... |
__all__ = ["WebViewImpl"]
from base.log import VLOG
from base.bind import Bind
from web_view import WebView
from status import *
from ui_events import *
from js import *
from geolocation_override_manager import GeolocationOverrideManager
from debugger_tracker import DebuggerTracker
from javascript_dialog_manager impo... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "browser/web_view_impl.py",
"copies": "1",
"size": "17244",
"license": "bsd-3-clause",
"hash": -239428404352996160,
"line_mean": 34.701863354,
"line_max": 130,
"alpha_frac": 0.6850498724,
"autogenerated": false,
"ratio": 3.6580398... |
__all__ = ["WebView"]
from status import *
class WebView(object):
def __init__(self, sid=""):
self.sid = sid
#verridden from WebView:
def GetId(self):
return self.sid
def WasCrashed(self):
return False
def ConnectIfNecessary(self):
return Status(kOk)
def HandleReceivedEvents(self):
... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "browser/web_view.py",
"copies": "1",
"size": "1902",
"license": "bsd-3-clause",
"hash": -1669664053449043000,
"line_mean": 21.9156626506,
"line_max": 86,
"alpha_frac": 0.683491062,
"autogenerated": false,
"ratio": 3.6647398843930... |
# all weights in g/mol
CO2 = 44.01
CH4 = 16.04
N2O = 44.013
CF4 = 88.0043
C2F6 = 138.01
C3F8 = 188.02
C4F10 = 238.028
C5F12 = 288.036
C6F14 = 338.041845
C7F16 = 388.051
C8F18 = 438.06
C_C4F8 = 200.03
HFC23 = 70.01
HFC32 = 52.02... | {
"repo_name": "OMS-NetZero/FAIR",
"path": "fair/constants/molwt.py",
"copies": "1",
"size": "1592",
"license": "apache-2.0",
"hash": -6132232311129671000,
"line_mean": 23.1212121212,
"line_max": 79,
"alpha_frac": 0.523241206,
"autogenerated": false,
"ratio": 2.180821917808219,
"config_test": fa... |
__all__ = ('WidgetManager')
import string
from copy import deepcopy
from kivy.core.window import Window
from pocketthrone.entities.event import *
from pocketthrone.entities.enum import WidgetState, WidgetAction, GameState, CoordinateAxis
from pocketthrone.entities.tilemap import TileMap, GridTranslation
from pocketth... | {
"repo_name": "herrschr/prey-game",
"path": "pocketthrone/managers/widgetmanager.py",
"copies": "2",
"size": "8768",
"license": "bsd-2-clause",
"hash": -5655741766288327000,
"line_mean": 29.5505226481,
"line_max": 103,
"alpha_frac": 0.6856751825,
"autogenerated": false,
"ratio": 3.080815179198875... |
"""All widgets in the kivy-grid-cells package"""
from contextlib import contextmanager
import logging
from kivy.properties import (
NumericProperty,
ListProperty,
BooleanProperty,
)
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.widget import Widget
import numpy as np
from .constants im... | {
"repo_name": "ukch/kivy-grid-cells",
"path": "kivy_grid_cells/widgets.py",
"copies": "1",
"size": "11933",
"license": "mit",
"hash": -866096381541386500,
"line_mean": 30.5687830688,
"line_max": 78,
"alpha_frac": 0.5513282494,
"autogenerated": false,
"ratio": 3.9137422105608395,
"config_test": ... |
"""All widgets in the kivy-grid-cells package"""
from __future__ import division
import functools
from hashlib import md5
from itertools import product
import logging
import os
import numpy as np
from kivy.base import EventLoop
from kivy.graphics import Color, Rectangle
from kivy.properties import (
AliasProper... | {
"repo_name": "ukch/kivy-p2life",
"path": "kivy_p2life/widgets.py",
"copies": "1",
"size": "23185",
"license": "mit",
"hash": 3071015695181904000,
"line_mean": 32.6502177068,
"line_max": 102,
"alpha_frac": 0.5707569549,
"autogenerated": false,
"ratio": 3.582354758961681,
"config_test": false,
... |
"""All widgets related to editing channels are here."""
from PyQt4 import QtGui, QtCore
from ..ramps import Channel
from CommonWidgets import QMultipleSpinBoxEdit, QNamedPushButton
import rampage.format as fmt
class QEditChannelInfoDialog(QtGui.QDialog):
"""Dialog to edit channel info.
This dialog is called... | {
"repo_name": "shreyaspotnis/rampage",
"path": "rampage/widgets/ChannelWidgets.py",
"copies": "1",
"size": "14000",
"license": "mit",
"hash": 1379721710928499700,
"line_mean": 38.2156862745,
"line_max": 84,
"alpha_frac": 0.5808571429,
"autogenerated": false,
"ratio": 3.7273695420660276,
"config... |
__all__ = ["wikify"]
def wikify(model_ref):
def decorator(func):
def inner(request, *args, **kwargs):
# Import lazily, so we don't import views directly, saves us some
# trouble, e.g. https://bitbucket.org/kumar303/fudge/issue/17/module-import-order-influences-whether
fr... | {
"repo_name": "cburgmer/django-wikify",
"path": "src/wikify/__init__.py",
"copies": "1",
"size": "2022",
"license": "bsd-3-clause",
"hash": 1263410663518853000,
"line_mean": 40.2653061224,
"line_max": 112,
"alpha_frac": 0.512363996,
"autogenerated": false,
"ratio": 4.605922551252847,
"config_te... |
# All windows write only unicode to the terminal -
# that's what blessings does, so we match it.
from __future__ import unicode_literals
import locale
import logging
import re
import sys
import blessings
from .formatstring import fmtstr
from .formatstringarray import FSArray
from .termhelpers import Cbreak
logger ... | {
"repo_name": "MarkWh1te/xueqiu_predict",
"path": "python3_env/lib/python3.4/site-packages/curtsies/window.py",
"copies": "3",
"size": "19889",
"license": "mit",
"hash": 2192117401964297200,
"line_mean": 37.6945525292,
"line_max": 84,
"alpha_frac": 0.5605611142,
"autogenerated": false,
"ratio": 4... |
# All windows write only unicode to the terminal -
# that's what blessings does, so we match it.
from typing import (
Optional,
Text,
IO,
Dict,
Generic,
TypeVar,
Type,
Tuple,
Callable,
Any,
ByteString,
cast,
TextIO,
Union,
List,
)
from types import Traceback... | {
"repo_name": "sebastinas/curtsies",
"path": "curtsies/window.py",
"copies": "1",
"size": "21894",
"license": "mit",
"hash": 8332311390666606000,
"line_mean": 36.618556701,
"line_max": 105,
"alpha_frac": 0.5570475929,
"autogenerated": false,
"ratio": 4.011359472334188,
"config_test": false,
"... |
__all__ = [ "word_to_number" ]
units = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': 9,
'ten': 10,
'eleven': 11,
'twelve': 12,
'thirteen': 13,
'fourteen': 14,
'fifteen': 15,
'sixteen': 16... | {
"repo_name": "mlaco/mathcessor",
"path": "lib/mathcessor/numbers.py",
"copies": "1",
"size": "1683",
"license": "mit",
"hash": -4758599633314502000,
"line_mean": 21.1447368421,
"line_max": 64,
"alpha_frac": 0.5478312537,
"autogenerated": false,
"ratio": 3.3392857142857144,
"config_test": false... |
# All work taken and adapted from https://github.com/lukaszbanasiak/yahoo-finance
from datetime import datetime, timedelta
import pytz
try:
from http.client import HTTPConnection
except ImportError:
from httplib import HTTPConnection
try:
from urllib.parse import urlencode
except ImportError:
from url... | {
"repo_name": "eric-chahin/finance_terminal_dashboard",
"path": "finance.py",
"copies": "1",
"size": "10406",
"license": "apache-2.0",
"hash": -4345730616649269000,
"line_mean": 30.1556886228,
"line_max": 123,
"alpha_frac": 0.5827407265,
"autogenerated": false,
"ratio": 3.5418652144315863,
"con... |
__all__=['writemarkdown','putlogo','print_abscissavalue','figsize']
from IPython.display import display,Markdown
from IPython.core.getipython import get_ipython
import matplotlib.pyplot as plt
import sastool
import numpy as np
import pkg_resources
from scipy.misc import imread
credo_logo = imread(pkg_resources.resourc... | {
"repo_name": "awacha/credolib",
"path": "credolib/utils.py",
"copies": "1",
"size": "2186",
"license": "bsd-3-clause",
"hash": -2977584823737724000,
"line_mean": 36.6896551724,
"line_max": 90,
"alpha_frac": 0.6299176578,
"autogenerated": false,
"ratio": 3.2052785923753664,
"config_test": false... |
__all__ = ['write_mol2']
def write_mol2(filename, traj):
"""Output a Trajectory as a TRIPOS mol2 file.
Parameters
----------
filename : str
Path of the output file.
"""
atoms = list(traj.top.atoms)
xyz = traj.xyz[0]
bonds = list(traj.top.bonds)
with open(filename, 'w') ... | {
"repo_name": "Jonestj1/mbuild",
"path": "mbuild/formats/mol2.py",
"copies": "1",
"size": "1375",
"license": "mit",
"hash": -6047402242403095000,
"line_mean": 33.375,
"line_max": 105,
"alpha_frac": 0.5272727273,
"autogenerated": false,
"ratio": 2.789046653144016,
"config_test": false,
"has_no... |
__all__ = ['writer']
import docutils.core as dc
import docutils.writers
from docutils import nodes
from docutils.writers.latex2e import (Writer, LaTeXTranslator,
PreambleCmds)
from .rstmath import mathEnv
from . import code_block
from options import options
try:
from colle... | {
"repo_name": "ScienceStacks/JViz",
"path": "scipy_proceedings/publisher/writer/__init__.py",
"copies": "3",
"size": "17040",
"license": "apache-2.0",
"hash": -1550142796647500500,
"line_mean": 35.0253699789,
"line_max": 128,
"alpha_frac": 0.5641431925,
"autogenerated": false,
"ratio": 4.12690724... |
__all__ = ["write_story", "write_chapter", "write_zip"]
from zipfile import ZipFile
import codecs
import html
import json
import os
import tarfile
import tempfile
HTML_TEMPLATE = """\
<!DOCTYPE html>
<html>
<head>
<title>%s</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta charset="UT... | {
"repo_name": "sexypants/chyoa-scraper",
"path": "chyoa/serial.py",
"copies": "1",
"size": "3724",
"license": "mit",
"hash": -1789131175695059700,
"line_mean": 23.6622516556,
"line_max": 109,
"alpha_frac": 0.6114393126,
"autogenerated": false,
"ratio": 3.2186689714779604,
"config_test": false,
... |
__all__ = ['W', 'WSP']
__author__ = "Sergio J. Rey <srey@asu.edu> "
import pysal
from pysal.common import ROD
import math
import numpy as np
import scipy.sparse
import gc
from pysal.weights import util
class W(object):
"""
Spatial weights
Parameters
----------
neighbors : dictionary
... | {
"repo_name": "AlanZatarain/pysal",
"path": "pysal/weights/weights.py",
"copies": "5",
"size": "26309",
"license": "bsd-3-clause",
"hash": 5641957238633307000,
"line_mean": 26.810782241,
"line_max": 137,
"alpha_frac": 0.465810179,
"autogenerated": false,
"ratio": 3.6064427690198766,
"config_tes... |
__all__ = ["XwalkImpl"]
from xwalk import Xwalk
from status import *
from devtools_http_client import WebViewsInfo
from devtools_http_client import WebViewInfo
from web_view_impl import WebViewImpl
from base.log import VLOG
class XwalkImpl(Xwalk):
def __init__(self, client, devtools_event_listeners, port_reservati... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "browser/xwalk_impl.py",
"copies": "1",
"size": "3122",
"license": "bsd-3-clause",
"hash": 300599243435553400,
"line_mean": 28.1775700935,
"line_max": 79,
"alpha_frac": 0.6604740551,
"autogenerated": false,
"ratio": 3.503928170594... |
__all__ = ["YamlReaderError", "yaml_load"]
__version__ = "3.0.1"
from yaml import MarkedYAMLError, safe_load, safe_dump
import glob
import os
import logging
class NoDefault(object):
def __str__(self):
return "No default data"
NO_DEFAULT = NoDefault()
class YamlReaderError(Exception):
pass
def dat... | {
"repo_name": "pombredanne/yamlreader",
"path": "src/yamlreader.py",
"copies": "1",
"size": "5353",
"license": "apache-2.0",
"hash": -2794685030680740400,
"line_mean": 36.4335664336,
"line_max": 138,
"alpha_frac": 0.5791145152,
"autogenerated": false,
"ratio": 4.0614567526555385,
"config_test":... |
import sys,os
sys.path.append(your_djangoproject_home)
os.environ['DJANGO_SETTINGS_MODULE'] ='mysite.settings'
from sweetspot.models import Locations, Signs
Signs.objects.all().delete()
Locations.objects.all().delete()
import csv
dataReader = csv.reader(open(csv_filepathname), delimiter=',')
for row in dataReader:
... | {
"repo_name": "psiCode/shoutserver",
"path": "mysite/sweetspot/dataImport.py",
"copies": "1",
"size": "1530",
"license": "bsd-2-clause",
"hash": -6989562442786302000,
"line_mean": 33.7727272727,
"line_max": 81,
"alpha_frac": 0.7091503268,
"autogenerated": false,
"ratio": 3.3260869565217392,
"co... |
__all__ = ["ZeroInflatedPoisson", "ZeroInflatedGeneralizedPoisson",
"ZeroInflatedNegativeBinomialP"]
import warnings
import numpy as np
import statsmodels.base.model as base
import statsmodels.base.wrapper as wrap
import statsmodels.regression.linear_model as lm
from statsmodels.discrete.discrete_model impo... | {
"repo_name": "jseabold/statsmodels",
"path": "statsmodels/discrete/count_model.py",
"copies": "4",
"size": "31310",
"license": "bsd-3-clause",
"hash": -7951373604745448000,
"line_mean": 37.4171779141,
"line_max": 98,
"alpha_frac": 0.5762056851,
"autogenerated": false,
"ratio": 3.717202896830108,... |
__all__ = ["zeroSR1"]
import numpy as np
import scipy.linalg
import datetime
def zeroSR1(fcnGrad, h, prox, options):
"""
ZEROSR1 Solves smooth + nonsmooth/constrained optimization problems
xk,nit, stepSizes = zeroSR1(fcnGrad, h, prox_h, opts)
This uses the zero-memory SR1 method (quasi-Newton) to solve:
min_x ... | {
"repo_name": "aasensio/pyzeroSR1",
"path": "pyzeroSR1/zeroSR1.py",
"copies": "1",
"size": "6583",
"license": "mit",
"hash": 7341081257128205000,
"line_mean": 29.7663551402,
"line_max": 132,
"alpha_frac": 0.6041318548,
"autogenerated": false,
"ratio": 2.6935351882160394,
"config_test": false,
... |
# Almost complete solution to Advent of Code 2017 Problem 9.
from mini_parse import exact, Grammar, string_grammar, one_char, none_char, always, foldl
parser = Grammar(string_grammar)
parser.main = parser.garbage | exact('{').and_second(
parser.main.join(parser.comma).optional([])).and_first(exact('}'))
parser.c... | {
"repo_name": "dan-simon/mini-parse",
"path": "stream_processing.py",
"copies": "1",
"size": "1951",
"license": "mit",
"hash": -3091177606665218600,
"line_mean": 32.6379310345,
"line_max": 94,
"alpha_frac": 0.6253203485,
"autogenerated": false,
"ratio": 2.8607038123167157,
"config_test": false,... |
#Almost equilateral triangles
#Problem 94
#It is easily proved that no equilateral triangle exists with integral length
#sides and integral area. However, the almost equilateral triangle 5-5-6 has an
# area of 12 square units.
#
#We shall define an almost equilateral triangle to be a triangle for which two
#sides are e... | {
"repo_name": "feliposz/project-euler-solutions",
"path": "python/euler94.py",
"copies": "1",
"size": "1836",
"license": "mit",
"hash": 2353011293944688000,
"line_mean": 26.8181818182,
"line_max": 86,
"alpha_frac": 0.5217864924,
"autogenerated": false,
"ratio": 3.06,
"config_test": false,
"ha... |
"""A local settings template.
Be careful changing this file as it will affect all development users.
"""
import fnmatch
# * imports should really never be used. Given this is passing settings around,
# this particular setup is getting a special pass.
from default import *
# local settings
DEBUG = True
TEMPLATE_DEBU... | {
"repo_name": "iamkelroy/CS673_G1_T3_BUGTRACKER",
"path": "issue_tracker/settings/local.py",
"copies": "1",
"size": "1159",
"license": "mit",
"hash": 3294472964532480500,
"line_mean": 24.1956521739,
"line_max": 79,
"alpha_frac": 0.6289905091,
"autogenerated": false,
"ratio": 4.0524475524475525,
... |
"""A local settings template."""
import fnmatch
# * imports should really never be used. Given this is passing settings around,
# this particular setup is getting a special pass.
from default import *
def _CheckLocalNetwork(addresses):
"""Check whether the current IP matches the addresses provided.
Args:
... | {
"repo_name": "iamkelroy/CS673_G1_T3_BUGTRACKER",
"path": "issue_tracker/settings/local_template.py",
"copies": "1",
"size": "1123",
"license": "mit",
"hash": 1883811751080711200,
"line_mean": 23.4130434783,
"line_max": 79,
"alpha_frac": 0.659839715,
"autogenerated": false,
"ratio": 4.11355311355... |
""" A location-aware script to manage ringer volume """
__author__ = 'Marco Bonifacio <bonifacio.marco@gmail.com>'
__license__ = 'MIT License'
import android
import time
# Parameters
SSID = {'bonix-lan': 'casa',
'ZENIT SECURED WPA': 'lavoro'}
RINGER = {'casa': 5,
'lavoro': 2,
'sconosciuto... | {
"repo_name": "mbonix/yapr",
"path": "android/PyLocale.py",
"copies": "1",
"size": "2023",
"license": "mit",
"hash": 3825181656120846300,
"line_mean": 27.1111111111,
"line_max": 65,
"alpha_frac": 0.5872466634,
"autogenerated": false,
"ratio": 3.5060658578856154,
"config_test": false,
"has_no_... |
"""A "Location" is a collecion of responses from geocoding services, each one a
distinct attempt to either find a string address given a point (reverse geocode)
or an attempt to find a point that best matches a string address (forward
geocode). A Location is a collection, because fundamentally *ErrorGeoPy* is
oriented ... | {
"repo_name": "alpha-beta-soup/errorgeopy",
"path": "errorgeopy/location.py",
"copies": "1",
"size": "8754",
"license": "mit",
"hash": -9085602439079721000,
"line_mean": 29.2906574394,
"line_max": 160,
"alpha_frac": 0.6320539182,
"autogenerated": false,
"ratio": 4.251578436134046,
"config_test"... |
"""A location is a place within the game board that has a row and column
Locations are used to reference different board elements"""
def make_location(row, column):
"""This method creates a location with a given row and column"""
return (row, column)
def get_row(location):
"""Gets the row of a l... | {
"repo_name": "nicholas-maltbie/Medina",
"path": "Location.py",
"copies": "1",
"size": "2990",
"license": "mit",
"hash": -5143512161455073000,
"line_mean": 45.4603174603,
"line_max": 93,
"alpha_frac": 0.6618729097,
"autogenerated": false,
"ratio": 3.705080545229244,
"config_test": false,
"has... |
"""A location is the representation of a given point on a glove."""
import json
class Location(object):
"""A representation of a given point on a globe."""
def __init__(self, x_coord, y_coord):
self._x_coord = x_coord
self._y_coord = y_coord
self._plant = 0
@property
def x(se... | {
"repo_name": "neoinsanity/existenz",
"path": "existenz/location.py",
"copies": "1",
"size": "1198",
"license": "apache-2.0",
"hash": 3001780642927884300,
"line_mean": 23.4489795918,
"line_max": 74,
"alpha_frac": 0.5634390651,
"autogenerated": false,
"ratio": 3.8274760383386583,
"config_test": ... |
"""A logger. Because apparently the default one isn't good enough."""
from collections import defaultdict
import datetime
DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%M:%S%z"
DEFAULT_FORMAT = "[{datetime}] {level}: {message}"
DEFAULT_LEVEL = "INFO"
NEWLINE = '\n'
LEVELS = {"NOTSET": 00,
"DEBUG": 10,
... | {
"repo_name": "MrJohz/K-Eight",
"path": "tools/log.py",
"copies": "1",
"size": "4401",
"license": "bsd-2-clause",
"hash": 6447473397821390000,
"line_mean": 32.6030534351,
"line_max": 76,
"alpha_frac": 0.5655532833,
"autogenerated": false,
"ratio": 3.81038961038961,
"config_test": false,
"has_... |
""" a ``logging`` Formatter that escapes newline chars to avoid CRLF log injection (CWE-93)
Defines the class ``AntiCrlfFormatter``
"""
from __future__ import unicode_literals
import logging
import warnings
from anticrlf.types import SubstitutionMap
class LogFormatter(logging.Formatter):
"""logging Formatter t... | {
"repo_name": "darrenpmeyer/logging-formatter-anticrlf",
"path": "anticrlf/__init__.py",
"copies": "1",
"size": "2553",
"license": "bsd-2-clause",
"hash": 5895916451900739000,
"line_mean": 36.5441176471,
"line_max": 114,
"alpha_frac": 0.6529573051,
"autogenerated": false,
"ratio": 4.1990131578947... |
"""A logging module for use with elsapy.
Additional resources:
* https://github.com/ElsevierDev/elsapy
* https://dev.elsevier.com
* https://api.elsevier.com"""
import time, logging
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
## Following adapted from... | {
"repo_name": "ElsevierDev/elsapy",
"path": "elsapy/log_util.py",
"copies": "1",
"size": "1504",
"license": "bsd-3-clause",
"hash": 7153691644284171000,
"line_mean": 34.7317073171,
"line_max": 89,
"alpha_frac": 0.673537234,
"autogenerated": false,
"ratio": 3.926892950391645,
"config_test": fals... |
""" a login and sign up tab widget"""
from PyQt5.QtWidgets import QTabWidget, QFormLayout, QLineEdit, QPushButton, QWidget
class LoginSignup(QTabWidget):
def __init__(self, width, hight, parent=None):
super(LoginSignup, self).__init__(parent)
# set width and hight
self.width = width
... | {
"repo_name": "whuang001/cts",
"path": "gui/LoginSignup.py",
"copies": "1",
"size": "1721",
"license": "mit",
"hash": -3055161290917496300,
"line_mean": 29.1929824561,
"line_max": 84,
"alpha_frac": 0.6147588611,
"autogenerated": false,
"ratio": 3.607966457023061,
"config_test": false,
"has_no... |
"""A login frame."""
import application, wx
from simpleconf.dialogs.wx import SimpleConfWxDialog
from config import config
from gmusicapi.exceptions import AlreadyLoggedIn
class LoginFrame(SimpleConfWxDialog):
def __init__(self, callback):
self.callback = callback
super(LoginFrame, self).__init__(confi... | {
"repo_name": "chrisnorman7/gmp3",
"path": "gui/login_frame.py",
"copies": "1",
"size": "1264",
"license": "mpl-2.0",
"hash": 6006298768973509000,
"line_mean": 30.4102564103,
"line_max": 81,
"alpha_frac": 0.6764240506,
"autogenerated": false,
"ratio": 3.632183908045977,
"config_test": false,
... |
# A lot of failures in these tests on Mac OS X.
# Byte order related?
import os, sys, unittest
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
class CFunctions(unittest.TestCase):
_dll = CDLL(_ctypes_test.__file__)
def S(self):
return c_longlong.in_dll(self._dll, "last_t... | {
"repo_name": "slozier/ironpython2",
"path": "Src/StdLib/Lib/ctypes/test/test_cfuncs.py",
"copies": "2",
"size": "7962",
"license": "apache-2.0",
"hash": 6299011925261424000,
"line_mean": 36.2056074766,
"line_max": 136,
"alpha_frac": 0.6070082894,
"autogenerated": false,
"ratio": 3.08365608055770... |
# A lot of failures in these tests on Mac OS X.
# Byte order related?
import unittest
from ctypes import *
import _ctypes_test
class CFunctions(unittest.TestCase):
_dll = CDLL(_ctypes_test.__file__)
def S(self):
return c_longlong.in_dll(self._dll, "last_tf_arg_s").value
def U(self):
retu... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-3.0/Lib/ctypes/test/test_cfuncs.py",
"copies": "53",
"size": "7861",
"license": "mit",
"hash": 2983729085066756000,
"line_mean": 36.2559241706,
"line_max": 92,
"alpha_frac": 0.6123902811,
"autogenerated": fal... |
# A lot of failures in these tests on Mac OS X.
# Byte order related?
import unittest
from ctypes import *
import _ctypes_test
class CFunctions(unittest.TestCase):
_dll = CDLL(_ctypes_test.__file__)
def S(self):
return c_longlong.in_dll(self._dll, "last_tf_arg_s").value
def U(self):... | {
"repo_name": "babyliynfg/cross",
"path": "tools/project-creator/Python2.6.6/Lib/ctypes/test/test_cfuncs.py",
"copies": "1",
"size": "8072",
"license": "mit",
"hash": -1015857975819339800,
"line_mean": 36.2559241706,
"line_max": 92,
"alpha_frac": 0.596382557,
"autogenerated": false,
"ratio": 3.26... |
"""A lot of logic to parse out what is the registry, the image, and the tag"""
import re
class Repository:
"""Container class for holding image repository information.
These values are provided by you in the constructor
repo.domain --- the domain name of the registry the image is held in
repo.port ... | {
"repo_name": "PetroDE/control",
"path": "control/repository.py",
"copies": "1",
"size": "3567",
"license": "mit",
"hash": 4986103093417899000,
"line_mean": 37.7717391304,
"line_max": 84,
"alpha_frac": 0.579758901,
"autogenerated": false,
"ratio": 4.21133412042503,
"config_test": false,
"has_... |
# a lot of stuff is copied over from savitar1, but we still need to port more of it
import numpy as np
from scipy.special import expit as sigmoid
from collections import namedtuple
import munkres
from scipy.spatial.distance import cdist
import pycocotools.mask as cocomask
from cv2 import remap, INTER_NEAREST
TrackEle... | {
"repo_name": "VisualComputingInstitute/TrackR-CNN",
"path": "forwarding/tracking/Util_tracking.py",
"copies": "1",
"size": "19326",
"license": "mit",
"hash": -3424239823979874300,
"line_mean": 49.328125,
"line_max": 122,
"alpha_frac": 0.6244437545,
"autogenerated": false,
"ratio": 3.190688459633... |
# A lot of the expressions and terminology come
# from Hu et al. 2015 and Cowan & Agol 2011, whom I
# would like to thank.
#
# Written by Tiffany Jansen
# Columbia University Astronomy
# Last updated April 2017
#
# For any questions about the code,
# please contact Tiffany at jansent@astro.columbia.edu
#
# For any ... | {
"repo_name": "tcjansen/phasecurve_model",
"path": "forward_model.py",
"copies": "1",
"size": "16492",
"license": "mit",
"hash": 86861062405145780,
"line_mean": 30.7764932563,
"line_max": 94,
"alpha_frac": 0.6465559059,
"autogenerated": false,
"ratio": 2.644219977553311,
"config_test": false,
... |
# A lot of this code come from http://docs.sympy.org/dev/_modules/sympy/parsing/mathematica.html
# http://sympy.org/en/index.html
from .mathematicaYacc import mathematicaParser
from .mathematicaLex import mathematicaLexer
from .calchasPreprocessing import calchasToSympy
from .latexPreprocessing import isLatex
from .la... | {
"repo_name": "iScienceLuvr/PPP-CAS",
"path": "ppp_cas/parser.py",
"copies": "1",
"size": "1073",
"license": "mit",
"hash": -6537421588664015000,
"line_mean": 29.6571428571,
"line_max": 96,
"alpha_frac": 0.6533084809,
"autogenerated": false,
"ratio": 3.4837662337662336,
"config_test": false,
... |
# A lot of this code come from https://github.com/sympy/sympy_gamma/blob/master/app/logic/logic.py
# http://www.sympygamma.com/
import sys
import queue
import collections
from sympy import latex
from sympy.parsing.sympy_parser import stringify_expr, eval_expr, standard_transformations
from .parser import Parser
from ... | {
"repo_name": "iScienceLuvr/PPP-CAS",
"path": "ppp_cas/evaluator.py",
"copies": "1",
"size": "1198",
"license": "mit",
"hash": 8495906587013659000,
"line_mean": 26.2272727273,
"line_max": 106,
"alpha_frac": 0.6861435726,
"autogenerated": false,
"ratio": 3.83974358974359,
"config_test": false,
... |
# A lot of this code come from https://github.com/sympy/sympy_gamma/blob/master/app/logic/logic.py
# http://www.sympygamma.com/
from sympy import latex
from sympy.parsing.sympy_parser import stringify_expr, eval_expr, standard_transformations
from .parser import Parser
PREEXEC = """from sympy import *"""
def evalua... | {
"repo_name": "ProjetPP/PPP-CAS",
"path": "ppp_cas/evaluator.py",
"copies": "1",
"size": "1319",
"license": "mit",
"hash": -8167058103365730000,
"line_mean": 30.4047619048,
"line_max": 98,
"alpha_frac": 0.6959818044,
"autogenerated": false,
"ratio": 3.913946587537092,
"config_test": false,
"h... |
# A lot of this code exists to deal w/ the broken ECS connect_to_region
# function, and will be removed once this pull request is accepted:
# https://github.com/boto/boto/pull/3143
import logging
logger = logging.getLogger(__name__)
from boto.regioninfo import get_regions
from boto.ec2containerservice.layer1 import... | {
"repo_name": "federicobaldo/stacker",
"path": "stacker/hooks/ecs.py",
"copies": "2",
"size": "1284",
"license": "bsd-2-clause",
"hash": 412234270778504100,
"line_mean": 28.8604651163,
"line_max": 73,
"alpha_frac": 0.6884735202,
"autogenerated": false,
"ratio": 4.196078431372549,
"config_test":... |
# a lot of this code is mostly from django.contrib.auth.forms
from woodstock.models import Participant, Invitee, Salutation
from woodstock import settings
from woodstock.fields import EventPartsChoiceField, EventPartsMultipleChoiceField
from pennyblack import send_newsletter
from django import forms
from django.contr... | {
"repo_name": "allink/woodstock",
"path": "woodstock/forms.py",
"copies": "1",
"size": "9421",
"license": "bsd-3-clause",
"hash": 2910563610756769300,
"line_mean": 40.8711111111,
"line_max": 154,
"alpha_frac": 0.6582103811,
"autogenerated": false,
"ratio": 4.245606128886886,
"config_test": fals... |
"""Alpenhorn client interface for operations on `ArchiveAcq`s."""
import re
import sys
import click
import peewee as pw
import alpenhorn.acquisition as ac
import alpenhorn.archive as ar
import alpenhorn.storage as st
from .connect_db import config_connect
RE_LOCK_FILE = re.compile(r"^\..*\.lock$")
@click.group(c... | {
"repo_name": "radiocosmology/alpenhorn",
"path": "alpenhorn/client/acq.py",
"copies": "1",
"size": "6420",
"license": "mit",
"hash": 8116609060596728000,
"line_mean": 27.281938326,
"line_max": 135,
"alpha_frac": 0.5809968847,
"autogenerated": false,
"ratio": 3.7369033760186263,
"config_test": ... |
"""Alpenhorn client interface for operations on `StorageGroup`s."""
import click
import peewee as pw
import alpenhorn.storage as st
from .connect_db import config_connect
@click.group(context_settings={"help_option_names": ["-h", "--help"]})
def cli():
"""Commands operating on storage groups. Use to create, mo... | {
"repo_name": "radiocosmology/alpenhorn",
"path": "alpenhorn/client/group.py",
"copies": "1",
"size": "2419",
"license": "mit",
"hash": -3725861690557179400,
"line_mean": 27.4588235294,
"line_max": 87,
"alpha_frac": 0.6138900372,
"autogenerated": false,
"ratio": 3.7620528771384136,
"config_test... |
"""Alpenhorn client interface for operations on `StorageNode`s."""
import os
import re
import sys
from collections import defaultdict
import click
import peewee as pw
import alpenhorn.acquisition as ac
import alpenhorn.archive as ar
import alpenhorn.storage as st
import alpenhorn.util as util
from alpenhorn import d... | {
"repo_name": "radiocosmology/alpenhorn",
"path": "alpenhorn/client/node.py",
"copies": "1",
"size": "33061",
"license": "mit",
"hash": 7336091609572130000,
"line_mean": 31.99500998,
"line_max": 116,
"alpha_frac": 0.546898158,
"autogenerated": false,
"ratio": 3.97893850042123,
"config_test": fa... |
"""Alpenhorn client interface for operations on transport disks."""
import os
import subprocess
import time
import click
import peewee as pw
import alpenhorn.storage as st
from . import node
from .connect_db import config_connect
# A few utility routines for dealing with filesystems
MAX_E2LABEL_LEN = 16
@click.g... | {
"repo_name": "radiocosmology/alpenhorn",
"path": "alpenhorn/client/transport.py",
"copies": "1",
"size": "8015",
"license": "mit",
"hash": -886649455953580000,
"line_mean": 28.5756457565,
"line_max": 89,
"alpha_frac": 0.5459762944,
"autogenerated": false,
"ratio": 3.9599802371541504,
"config_t... |
"""Alpenhorn client interface."""
import datetime
import os
import sys
import click
import peewee as pw
from ch_util import data_index as di
from ch_util import ephemeris
@click.group()
def cli():
"""Client interface for alpenhorn. Use to request transfers, mount drives,
check status etc."""
@cli.command(... | {
"repo_name": "radiocosmology/alpenhorn",
"path": "alpenhorn/legacy/client.py",
"copies": "1",
"size": "32643",
"license": "mit",
"hash": -4714294905706121000,
"line_mean": 30.6614936954,
"line_max": 116,
"alpha_frac": 0.579297246,
"autogenerated": false,
"ratio": 3.8475954738330977,
"config_te... |
"""Alpenhorn service."""
import logging
import sys
import click
from . import auto_import, config, db, extensions, logger, storage, update, util
log = logging.getLogger(__name__)
# Register Hook to Log Exception
# ==============================
def log_exception(*args):
log.error("Fatal error!", exc_info=ar... | {
"repo_name": "radiocosmology/alpenhorn",
"path": "alpenhorn/service.py",
"copies": "1",
"size": "1912",
"license": "mit",
"hash": 8931734148231685000,
"line_mean": 24.1578947368,
"line_max": 80,
"alpha_frac": 0.664748954,
"autogenerated": false,
"ratio": 3.991649269311065,
"config_test": true,... |
alpha = ['A','B','C','D','E','F','G','H','I','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
def get_key():
k = raw_input().upper()
key = []
for char in k:
if char in alpha and char not in key: # add the character to the matrix if it's valid and not already in the matrix
key.append(char)
... | {
"repo_name": "akshitac8/Course-work",
"path": "Crytography/playfair_cipher.py",
"copies": "1",
"size": "4650",
"license": "apache-2.0",
"hash": 8971951797469037000,
"line_mean": 29.0133333333,
"line_max": 127,
"alpha_frac": 0.5903225806,
"autogenerated": false,
"ratio": 2.7744630071599046,
"co... |
ALPHABET = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q',
'R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7',
'8','9']
MORSE = ['.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-',
'.-..','--','-.','---','.--.','--.-','.-.','...','... | {
"repo_name": "JuBzzz/dailyprogrammer-challenges",
"path": "easy/challenge #7/morse_translator.py",
"copies": "1",
"size": "1683",
"license": "mit",
"hash": 3079106707886350300,
"line_mean": 29.6181818182,
"line_max": 80,
"alpha_frac": 0.3784907903,
"autogenerated": false,
"ratio": 3.406882591093... |
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
def to_bin_repr(s):
"""
Represent each character of a string into a binary number.
The result will be in a form of a joint strings
"aa" -> "11000011100001"
:param s: The input string
:return: A binary array
"""
... | {
"repo_name": "harrytodorov/py_base64",
"path": "base64.py",
"copies": "1",
"size": "3419",
"license": "mit",
"hash": -2695778515986879000,
"line_mean": 35.3829787234,
"line_max": 385,
"alpha_frac": 0.6493126645,
"autogenerated": false,
"ratio": 2.9964943032427693,
"config_test": true,
"has_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.