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
cleverhans-lab/cleverhans
cleverhans/devtools/list_files.py
2
2157
"""Code for listing files that belong to the library.""" import os import cleverhans def list_files(suffix=""): """ Returns a list of all files in CleverHans with the given suffix. Parameters ---------- suffix : str Returns ------- file_list : list A list of all files in Cle...
mit
7df4b7fe39fc4d5b5c12112d4d5b5caa
27.012987
81
0.589708
3.810954
false
false
false
false
cleverhans-lab/cleverhans
cleverhans_v3.1.0/cleverhans/utils_tf.py
1
32235
"""Utility functions for writing TensorFlow code""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging import math import os import time import warnings import numpy as np import six from six.moves import ...
mit
1b59a8c790682869c4ebd4ead0a669b5
34.697674
88
0.61669
3.805785
false
false
false
false
cleverhans-lab/cleverhans
cleverhans_v3.1.0/examples/RL-attack/train.py
1
15594
import argparse import gym import numpy as np import os import tensorflow as tf import tempfile import time import json import random import rlattack.common.tf_util as U from rlattack import logger from rlattack import deepq from rlattack.deepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer from rlattack....
mit
7f6e355a8bfd7784bcc9ff9e03e33f39
34.848276
88
0.542773
4.035714
false
false
false
false
alkaline-ml/pmdarima
pmdarima/utils/metaestimators.py
2
3457
# -*- coding: utf-8 -*- # # Author: Taylor Smith <taylor.smith@alkaline-ml.com> # # Metaestimators for the ARIMA class. These classes are derived from the # sklearn metaestimators, but adapted for more specific use with pmdarima. from operator import attrgetter from functools import update_wrapper __all__ = [ 'if...
mit
954de5efff0ed2e06eb236095fdcf3cd
34.27551
79
0.637836
4.364899
false
false
false
false
alkaline-ml/pmdarima
pmdarima/preprocessing/exog/base.py
2
3245
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import abc from ..base import BaseTransformer class BaseExogTransformer(BaseTransformer, metaclass=abc.ABCMeta): """A base class for exogenous array transformers""" def _check_y_X(self, y, X, null_allowed=False): """Check the endog and ...
mit
cb89a54cb19e5352bb3816c4a93450fc
33.892473
79
0.605547
4.214286
false
false
false
false
alkaline-ml/pmdarima
pmdarima/arima/_validation.py
2
5090
# -*- coding: utf-8 -*- """ Arg validation for auto-arima calls. This allows us to test validation more directly without having to fit numerous combinations of models. """ import numpy as np import warnings from sklearn import metrics from pmdarima.warnings import ModelFitWarning # The valid information criteria VA...
mit
18c62c51838bb8cde71a68c921cf8ae6
32.051948
79
0.623183
4.072
false
false
false
false
eandersson/amqpstorm
amqpstorm/channel0.py
1
7724
"""AMQPStorm Connection.Channel0.""" import logging import platform from pamqp import specification from pamqp.heartbeat import Heartbeat from amqpstorm import __version__ from amqpstorm.base import LOCALE from amqpstorm.base import MAX_CHANNELS from amqpstorm.base import MAX_FRAME_SIZE from amqpstorm.base import St...
mit
373573236e5e0407ac501664ba935089
31.317992
78
0.573019
4.195546
false
false
false
false
eandersson/amqpstorm
docs/conf.py
1
11963
# -*- coding: utf-8 -*- # # amqpstorm documentation build configuration file, created by # sphinx-quickstart on Sun Apr 10 16:25:24 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
mit
6d2c5209e80bf1ab6c9d0dec90607d91
30.901333
79
0.703502
3.639489
false
true
false
false
kivy/kivy
kivy/uix/behaviors/__init__.py
9
3531
''' Behaviors ========= .. versionadded:: 1.8.0 Behavior mixin classes ---------------------- This module implements behaviors that can be `mixed in <https://en.wikipedia.org/wiki/Mixin>`_ with existing base widgets. The idea behind these classes is to encapsulate properties and events associated with certain types ...
mit
380ca948622ac61895bc7cbb8df6d16b
36.168421
78
0.744265
3.967416
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/urllib3/contrib/ntlmpool.py
711
4741
# urllib3/contrib/ntlmpool.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ NTLM authenticating pool, contributed by erikcederstran Issue #10, see: http://co...
mit
045fe24cedffaae86fc71c7e42b33ef1
38.508333
77
0.563805
4.233036
false
false
false
false
kivy/kivy
kivy/animation.py
4
25321
''' Animation ========= :class:`Animation` and :class:`AnimationTransition` are used to animate :class:`~kivy.uix.widget.Widget` properties. You must specify at least a property name and target value. To use an Animation, follow these steps: * Setup an Animation object * Use the Animation object on a Widget ...
mit
51de0df72c0746bca8fdd475b2369ba3
29.433894
79
0.553967
3.918446
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/day_of.py
1
1476
import webapp2 from template import template from messages import Message from social_import import Post from mentor import MentorRequest class DayOfHandler(webapp2.RequestHandler): def get(self, tab='info'): params = {} params['bigboard'] = self.request.get('bigboard') if tab == 'info': feed = [] for...
mit
599413e28dd7db896e84fc9742fb0758
34.142857
125
0.665312
3.075
false
false
false
false
kivy/kivy
doc/sources/sphinxext/autodoc.py
73
1130
# -*- coding: utf-8 -*- from sphinx.ext.autodoc import Documenter, ClassDocumenter from sphinx.ext.autodoc import setup as core_setup from sphinx.locale import _ class KivyClassDocumenter(ClassDocumenter): def add_directive_header(self, sig): if self.doc_as_attr: self.directivetype = 'attribut...
mit
6c1b3b270ff3f0b524c8e26dfe344ae5
36.666667
75
0.527434
3.896552
false
false
false
false
kivy/kivy
kivy/input/providers/__init__.py
21
1936
# pylint: disable=W0611 ''' Providers ========= ''' import os from kivy.utils import platform as core_platform from kivy.logger import Logger from kivy.setupconfig import USE_SDL2 import kivy.input.providers.tuio import kivy.input.providers.mouse platform = core_platform if platform == 'win' or 'KIVY_DOC' in os.e...
mit
9794919ef0cfa1ee1072134a09e4fa95
27.470588
79
0.664773
3.639098
false
false
true
false
kivy/kivy
kivy/modules/screen.py
4
7476
'''Screen ====== This module changes some environment and configuration variables to match the density / dpi / screensize of a specific device. To see a list of the available screenid's, just run:: python main.py -m screen To simulate a medium-density screen such as the Motorola Droid 2:: python main.py -m...
mit
a61477d83168c11ef9f567149b1d7bab
39.852459
79
0.583333
2.80315
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/urllib3/connectionpool.py
76
25347
# urllib3/connectionpool.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import errno import logging from socket import error as SocketError, timeout as SocketT...
mit
27dad6268678a78002a3c018b558e4be
36.220264
86
0.588275
4.617781
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/oauthlib/oauth2/rfc6749/clients/backend_application.py
85
2498
# -*- coding: utf-8 -*- """ oauthlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming and providing OAuth 2.0 RFC6749. """ from __future__ import absolute_import, unicode_literals from .base import Client from ..parameters import prepare_token_request from ...
mit
a4e66644d0853ff545c38ba23c91821c
39.95082
77
0.679744
4.509025
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/charade/hebrewprober.py
208
13642
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Shy Shalom # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reser...
mit
235917645a36b46090995a8524ed3c27
46.204947
79
0.670723
3.951912
false
false
false
false
kivy/kivy
kivy/uix/slider.py
4
13394
""" Slider ====== .. image:: images/slider.jpg The :class:`Slider` widget looks like a scrollbar. It supports horizontal and vertical orientations, min/max values and a default value. To create a slider from -100 to 100 starting from 25:: from kivy.uix.slider import Slider s = Slider(min=-100, max=100, valu...
mit
356a60569731f30cdaae04d3f38219f6
30.814727
79
0.603927
4.058788
false
false
false
false
kivy/kivy
examples/frameworks/twisted/echo_server_app.py
13
1202
# install_twisted_rector must be called before importing and using the reactor from kivy.support import install_twisted_reactor install_twisted_reactor() from twisted.internet import reactor from twisted.internet import protocol class EchoServer(protocol.Protocol): def dataReceived(self, data): response...
mit
f175ab65677dd26966c79fb6be0ea740
23.530612
78
0.638935
3.840256
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests_oauthlib/compliance_fixes/facebook.py
89
1119
from json import dumps try: from urlparse import parse_qsl except ImportError: from urllib.parse import parse_qsl from oauthlib.common import to_unicode def facebook_compliance_fix(session): def _compliance_fix(r): # if Facebook claims to be sending us json, let's trust them. if 'applica...
mit
a9b579692a211138daa89c3d12d1b8b8
32.909091
86
0.635389
3.858621
false
false
false
false
kivy/kivy
kivy/core/__init__.py
4
9877
''' Core Abstraction ================ This module defines the abstraction layers for our core providers and their implementations. For further information, please refer to :ref:`architecture` and the :ref:`providers` section of the documentation. In most cases, you shouldn't directly use a library that's already cove...
mit
09849afcbc4706b91175093b9388ccfc
38.987854
80
0.58702
4.309337
false
false
false
false
kivy/kivy
kivy/tools/stub-gl-debug.py
4
13294
# flake8: noqa from __future__ import print_function a = '''cdef void glActiveTexture (cgl.GLenum texture) cdef void glAttachShader (cgl.GLuint program, cgl.GLuint shader) cdef void glBindAttribLocation (cgl.GLuint program, cgl.GLuint index, cgl.GLchar* name) cdef void glBindBuffer (cgl.GLenum target, cgl.GLu...
mit
5afcf2c0199385d232565f40f5b70356
65.139303
212
0.746051
2.972719
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/updateSchema.py
1
1673
import logging from google.appengine.ext import deferred from google.appengine.ext import ndb from registration import Hacker import reimbursement BATCH_SIZE = 100 # ideal batch size may vary based on entity size. def updateSchema(cursor=None, num_updated=0): to_put = [] hackers, next_curs, more = Hacker.qu...
mit
adf076bccf5c44794ad937a31d3094ad
30.566038
89
0.62104
3.726058
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/twilio/rest/resources/call_feedback.py
47
2977
from . import ( ListResource, InstanceResource, transform_params, ) class CallFeedback(InstanceResource): def __init__(self, parent): self.parent = parent super(CallFeedback, self).__init__( parent, None, ) class CallFeedbackFactory(ListResource): ...
mit
20bb733b408c50ac8201f6851a14fbe0
26.564815
74
0.614713
4.443284
false
false
false
false
kivy/kivy
kivy/geometry.py
5
3792
''' Geometry utilities ================== This module contains some helper functions for geometric calculations. ''' __all__ = ('circumcircle', 'minimum_bounding_circle') from kivy.vector import Vector def circumcircle(a, b, c): ''' Computes the circumcircle of a triangle defined by a, b, c. See: http:...
mit
9e972846111987f5698bae5e42b8e8df
30.338843
76
0.548787
3.20541
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/oauthlib/oauth2/rfc6749/clients/base.py
37
20354
# -*- coding: utf-8 -*- """ oauthlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming OAuth 2.0 RFC6749. """ from __future__ import absolute_import, unicode_literals import time from oauthlib.common import generate_token from oauthlib.oauth2.rfc6749 import...
mit
e0d1f37e13707cd4a0e25fb9b326efdc
40.538776
107
0.647735
4.479313
false
false
false
false
kivy/kivy
examples/gestures/gesture_board.py
1
2833
from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.graphics import Color, Ellipse, Line from kivy.gesture import Gesture, GestureDatabase from my_gestures import cross, circle, check, square def simplegesture(name, point_list): """ A simple helper function """ g = Gestur...
mit
12c1c0903ee478f7c161bdd6d7473d8a
28.821053
76
0.569714
3.712975
false
false
false
false
kivy/kivy
examples/keyboard/main.py
5
7597
""" Custom Keyboards ================ This demo shows how to create and display custom keyboards on screen. Note that the new "input_type" property of the TextInput means that this is rarely needed. We provide this demo for the sake of completeness. """ # Author: Zen-CODE from kivy.app import App from kivy.lang import...
mit
8faf1a4cb6ebf68a6c817470047e7ef6
32.615044
78
0.55206
4.155908
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/cssutils/css/csscomment.py
10
2834
"""CSSComment is not defined in DOM Level 2 at all but a cssutils defined class only. Implements CSSRule which is also extended for a CSSComment rule type. """ __all__ = ['CSSComment'] __docformat__ = 'restructuredtext' __version__ = '$Id$' import cssrule import cssutils import xml.dom class CSSComment(cssrule.CSSRu...
mit
45e7391c8a16b8b83de32592dffc25ab
31.574713
77
0.577276
4.236173
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/cssutils/tests/test_codec.py
3
15343
"""Testcases for cssutils.codec""" import codecs import unittest import sys PY2x = sys.version_info < (3,0) if PY2x: import StringIO iostream = StringIO.StringIO else: import io iostream = io.BytesIO from cssutils import codec try: codecs.lookup("utf-32") except LookupError: haveutf32 = Fal...
mit
ea461feeea64df064dc170bd582b2fdd
43.862573
127
0.58398
3.680259
false
false
false
false
kivy/kivy
kivy/core/video/video_ffmpeg.py
4
2692
''' FFmpeg video abstraction ======================== .. versionadded:: 1.0.8 This abstraction requires ffmpeg python extensions. We have made a special extension that is used for the android platform but can also be used on x86 platforms. The project is available at:: http://github.com/tito/ffmpeg-android The ...
mit
39c09956c99cc3dc6c46d5a31876cb5b
24.396226
77
0.572065
4.091185
false
false
false
false
kivy/kivy
examples/canvas/circle.py
21
2155
''' Circle Example ============== This example exercises circle (ellipse) drawing. You should see sliders at the top of the screen with the Kivy logo below it. The sliders control the angle start and stop and the height and width scales. There is a button to reset the sliders. The logo used for the circle's background...
mit
2f3dea453661ff8076d72832f0ed8218
24.654762
78
0.481206
4.233792
false
false
false
false
kivy/kivy
examples/widgets/codeinput.py
21
7046
from kivy.app import App from kivy.extras.highlight import KivyLexer from kivy.uix.spinner import Spinner, SpinnerOption from kivy.uix.boxlayout import BoxLayout from kivy.uix.codeinput import CodeInput from kivy.uix.behaviors import EmacsBehavior from kivy.uix.popup import Popup from kivy.properties import ListPropert...
mit
6396c06f4aacadc56257e7bd2ff13613
30.315556
79
0.580329
3.843972
false
false
false
false
kivy/kivy
kivy/uix/modalview.py
2
10750
""" ModalView ========= .. versionadded:: 1.4.0 The :class:`ModalView` widget is used to create modal views. By default, the view will cover the whole "main" window. Remember that the default size of a Widget is size_hint=(1, 1). If you don't want your view to be fullscreen, either use size hints with values lower t...
mit
55d062b70854f9f21d8cdcc4b78b1fa9
30.710914
79
0.633581
3.848908
false
false
false
false
kivy/kivy
kivy/app.py
1
42538
''' Application =========== The :class:`App` class is the base for creating Kivy applications. Think of it as your main entry point into the Kivy run loop. In most cases, you subclass this class and make your own app. You create an instance of your specific app class and then, when you are ready to start the applicati...
mit
d92953a18eddf800ce2fbf83b5d932a8
34.068425
79
0.625723
4.274746
false
true
false
false
kivy/kivy
examples/miscellaneous/shapedwindow.py
11
2550
from kivy.config import Config Config.set('graphics', 'shaped', 1) from kivy.resources import resource_find default_shape = Config.get('kivy', 'window_shape') alpha_shape = resource_find('data/logo/kivy-icon-512.png') from kivy.app import App from kivy.lang import Builder from kivy.core.window import Window from kivy...
mit
ef217907fc91887710b862da08a47312
25.020408
59
0.560392
3.766617
false
false
false
false
kivy/kivy
kivy/core/image/__init__.py
1
32041
''' Image ===== Core classes for loading images and converting them to a :class:`~kivy.graphics.texture.Texture`. The raw image data can be keep in memory for further access. .. versionchanged:: 1.11.0 Add support for argb and abgr image data In-memory image loading ----------------------- .. versionadded:: 1....
mit
e689daf26cb7ec2c7e3cdfa0365bbe67
30.977046
79
0.541775
4.209828
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/slimit/visitors/ecmavisitor.py
9
12757
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
mit
44bcd2b386c7b0caf1f317d7df5fdc9c
31.133501
79
0.519401
3.836692
false
false
false
false
kivy/kivy
kivy/tools/gles_compat/subset_gles.py
12
4834
''' Common GLES Subset Extraction Script ==================================== In Kivy, our goal is to use OpenGL ES 2.0 (GLES2) for all drawing on all platforms. The problem is that GLES2 is not a proper subset of any OpenGL Desktop (GL) version prior to version 4.1. However, to keep all our dr...
mit
99c92334646033ff532c6aabcac97012
37.672
79
0.602193
4.100085
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/urllib3/filepost.py
147
2511
# urllib3/filepost.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import codecs import mimetypes from uuid import uuid4 from io import BytesIO from .packages ...
mit
907691b0aa85dc3b273dc7bedca6acdb
23.861386
85
0.64317
3.851227
false
false
false
false
kivy/kivy
kivy/core/clipboard/__init__.py
6
4556
''' Clipboard ========= Core class for accessing the Clipboard. If we are not able to access the system clipboard, a fake one will be used. Usage example: .. code-block:: kv #:import Clipboard kivy.core.clipboard.Clipboard Button: on_release: self.text = Clipboard.paste() Cl...
mit
087423d1b4b422747535c9c9d0fae014
28.019108
78
0.59065
3.841484
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/urllib3/connection.py
89
3386
# urllib3/connection.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import socket from socket import timeout as SocketTimeout try: # Python 3 from http.cli...
mit
6fb09f627364e8e4ef3e6032a24af111
30.64486
78
0.617247
4.44357
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/oauthlib/oauth2/rfc6749/__init__.py
99
1728
# -*- coding: utf-8 -*- """ oauthlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming and providing OAuth 2.0 RFC6749. """ from __future__ import absolute_import, unicode_literals import functools import logging from .errors import TemporarilyUnavailableEr...
mit
7d197e2a5754470ede296e1cc406e12c
25.181818
73
0.601273
4.396947
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/ply/yacc.py
462
128492
# ----------------------------------------------------------------------------- # ply: yacc.py # # Copyright (C) 2001-2011, # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
mit
dfeed359d68cb0707b23a11749d6f3f6
38.222222
176
0.464472
4.74578
false
false
false
false
kivy/kivy
kivy/core/spelling/spelling_enchant.py
4
1507
''' Enchant Spelling ================ Implementation spelling backend based on enchant. .. warning:: pyenchant doesn't have dedicated build anymore for Windows/x64. See https://github.com/kivy/kivy/issues/5816 for more information ''' import enchant from kivy.core.spelling import SpellingBase, NoSuchL...
mit
87b332cb09fc1eefa76521abb3dee222
29.14
79
0.64499
4.14011
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/hackerFiles.py
1
2750
import webapp2 from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers import urllib import json import logging import hacker_page import operator #Todo: shouldn't be called this. class ChangeHandler(blobstore_handlers.BlobstoreUploadHandler): def post(self, secret, ke...
mit
45ff476c3b44007bf29a1bc05d752a01
30.976744
111
0.656
3.782669
false
false
false
false
kivy/kivy
kivy/input/postproc/retaintouch.py
80
3224
''' Retain Touch ============ Reuse touch to counter lost finger behavior ''' __all__ = ('InputPostprocRetainTouch', ) from kivy.config import Config from kivy.vector import Vector import time class InputPostprocRetainTouch(object): ''' InputPostprocRetainTouch is a post-processor to delay the 'up' event o...
mit
b7266c5ccd06c1dea025312eb12cde39
33.666667
78
0.509305
4.826347
false
true
false
false
kivy/kivy
examples/widgets/compound_selection.py
21
3036
from kivy.uix.gridlayout import GridLayout from kivy.uix.button import Button from kivy.uix.behaviors import CompoundSelectionBehavior from kivy.uix.behaviors import FocusBehavior from kivy.app import runTouchApp class SelectableGrid(FocusBehavior, CompoundSelectionBehavior, GridLayout): def __init__(self, **kwa...
mit
4ebd3aff39cf52b192a276640c36d2bf
35.578313
79
0.614625
3.852792
false
false
false
false
kivy/kivy
examples/canvas/lines.py
5
10144
''' Line (SmoothLine) Experiment ============================ This demonstrates the experimental and unfinished SmoothLine feature for fast line drawing. You should see a multi-segment path at the top of the screen, and sliders and buttons along the bottom. You can click to add new points to the segment, change the tr...
mit
a9455366a21dd9dd9ae314a0661f1bb2
33.27027
79
0.451203
4.42197
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests_oauthlib/oauth1_session.py
6
16132
from __future__ import unicode_literals try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse import logging from oauthlib.common import add_params_to_uri from oauthlib.common import urldecode as _urldecode from oauthlib.oauth1 import ( SIGNATURE_HMAC, SIGNATURE_RSA, SI...
mit
56b8b55d6f438b6d2b4f566cf47fa99c
42.48248
145
0.623915
4.237457
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/cssutils/helper.py
4
3982
"""cssutils helper TEST """ __docformat__ = 'restructuredtext' __version__ = '$Id: errorhandler.py 1234 2008-05-22 20:26:12Z cthedot $' import os import re import sys import urllib class Deprecated(object): """This is a decorator which can be used to mark functions as deprecated. It will result in...
mit
e324ab58e56905c1041591c8665984ba
27.065693
74
0.510799
3.62
false
false
false
false
kivy/kivy
kivy/effects/kinetic.py
3
5778
''' Kinetic effect ============== .. versionadded:: 1.7.0 The :class:`KineticEffect` is the base class that is used to compute the velocity out of a movement. When the movement is finished, the effect will compute the position of the movement according to the velocity, and reduce the velocity with a friction. The mov...
mit
738b5304b235175928ef411b5fc8f647
28.937824
78
0.626168
3.862299
false
false
false
false
kivy/kivy
kivy/uix/recycleboxlayout.py
21
6178
""" RecycleBoxLayout ================ .. versionadded:: 1.10.0 .. warning:: This module is highly experimental, its API may change in the future and the documentation is not complete at this time. The RecycleBoxLayout is designed to provide a :class:`~kivy.uix.boxlayout.BoxLayout` type layout when used with ...
mit
bd3cd1cfd23d2fcf025eb1fcf2748187
32.759563
79
0.46439
3.78786
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/urllib3/__init__.py
649
1701
# urllib3/__init__.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ urllib3 - Thread-safe connection pooling and re-using. """ __author__ = 'Andrey Petrov (a...
mit
d3165d298047502c3746f4b39bf746aa
28.327586
84
0.715461
3.901376
false
false
false
false
kivy/kivy
kivy/tools/pep8checker/pep8kivy.py
4
3343
import sys from os import walk from os.path import isdir, join, normpath import pep8 pep8_ignores = ( 'E125', # continuation line does not # distinguish itself from next logical line 'E126', # continuation line over-indented for hanging indent 'E127', # continuation line over-indented for...
mit
68e2fb39ac4e2ff7f97bc3128c937800
29.669725
79
0.535746
4.375654
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/packages/charade/utf8prober.py
207
2728
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. ...
mit
e6f7668111be1277c540b6e71f0f4837
33.894737
69
0.615469
4.337043
false
false
false
false
kivy/kivy
kivy/core/video/video_gstplayer.py
5
4006
''' Video Gstplayer =============== .. versionadded:: 1.8.0 Implementation of a VideoBase with Kivy :class:`~kivy.lib.gstplayer.GstPlayer` This player is the preferred player, using Gstreamer 1.0, working on both Python 2 and 3. ''' try: from kivy.lib.gstplayer import GstPlayer, get_gst_version except ImportErro...
mit
820b6726918fe8c864d18282b2a5ac09
27.614286
78
0.603844
3.811608
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/raffle.py
1
1032
import webapp2 from template import template from social_import import Post import random import datetime from google.appengine.ext import ndb class RaffleHandler(webapp2.RequestHandler): def get(self): self.response.write(template("raffle.html", {"service": self.request.get('service')})) def post(self): servi...
mit
8d85d3b79ac9bab82cd3206298c16758
32.290323
88
0.700581
3.071429
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/htmlmin/main.py
1
7729
""" Copyright (c) 2013, Dave Mankoff All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the fol...
mit
e0e291a7a7a8dc651614f2cf0bdb498b
40.778378
80
0.711476
4.313058
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/slimit/ast.py
9
10841
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
mit
808191e1ff020efbfd8c2faf86046f41
25.122892
79
0.619777
4.177649
false
false
false
false
kivy/kivy
examples/miscellaneous/shapecollisions.py
13
13863
# This is a simple demo for advanced collisions and mesh creation from a set # of points. Its purpose is only to give an idea on how to make complex stuff. # Check garden.collider for better performance. from math import cos, sin, pi, sqrt from random import random, randint from itertools import combinations from ki...
mit
4cc14ef623e23fbb6f88bfcf092f5b6e
33.919395
79
0.56842
3.421273
false
false
false
false
hackatbrown/2015.hackatbrown.org
hack-at-brown-2015/requests/api.py
638
4333
# -*- coding: utf-8 -*- """ requests.api ~~~~~~~~~~~~ This module implements the Requests API. :copyright: (c) 2012 by Kenneth Reitz. :license: Apache2, see LICENSE for more details. """ from . import sessions def request(method, url, **kwargs): """Constructs and sends a :class:`Request <Request>`. Retur...
mit
27fb2eac722656259a3485cd33586038
35.108333
136
0.667898
3.896583
false
false
false
false
andymccurdy/redis-py
benchmarks/basic_operations.py
4
4867
import time from argparse import ArgumentParser from functools import wraps import redis def parse_args(): parser = ArgumentParser() parser.add_argument( "-n", type=int, help="Total number of requests (default 100000)", default=100000 ) parser.add_argument( "-P", type=int, ...
mit
71ffcc3b00edcafde96f741b8f33de98
24.217617
88
0.570372
3.23819
false
false
false
false
andymccurdy/redis-py
tests/test_graph_utils/test_node.py
4
2021
import pytest from redis.commands.graph import node @pytest.fixture def fixture(): no_args = node.Node() no_props = node.Node(node_id=1, alias="alias", label="l") props_only = node.Node(properties={"a": "a", "b": 10}) no_label = node.Node(node_id=1, alias="alias", properties={"a": "a"}) multi_lab...
mit
bc97541947654f6e55e9315330b55c4c
37.865385
78
0.617021
2.838483
false
true
false
false
andymccurdy/redis-py
tests/test_sentinel.py
2
7104
import socket import pytest import redis.sentinel from redis import exceptions from redis.sentinel import ( MasterNotFoundError, Sentinel, SentinelConnectionPool, SlaveNotFoundError, ) @pytest.fixture(scope="module") def master_ip(master_host): yield socket.gethostbyname(master_host[0]) class ...
mit
1e4ff325993c21e5de1ba5246a01b67c
29.358974
87
0.662866
3.513353
false
true
false
false
andymccurdy/redis-py
redis/commands/search/querystring.py
2
7503
def tags(*t): """ Indicate that the values should be matched to a tag field ### Parameters - **t**: Tags to search for """ if not t: raise ValueError("At least one tag must be specified") return TagValue(*t) def between(a, b, inclusive_min=True, inclusive_max=True): """ I...
mit
6800760a23f09d2acc6b13fd58e61faa
22.894904
85
0.562175
3.78557
false
false
false
false
andymccurdy/redis-py
redis/commands/json/commands.py
1
13920
import os from json import JSONDecodeError, loads from typing import Dict, List, Optional, Union from deprecated import deprecated from redis.exceptions import DataError from ._util import JsonType from .decoders import decode_dict_keys from .path import Path class JSONCommands: """json commands.""" def a...
mit
0562824fe64e596f09f22059f74baafd
34.876289
88
0.574066
3.926657
false
false
false
false
andymccurdy/redis-py
tests/test_connection_pool.py
2
29948
import os import re import time from threading import Thread from unittest import mock import pytest import redis from redis.connection import ssl_available, to_bool from .conftest import _get_client, skip_if_redis_enterprise, skip_if_server_version_lt from .test_pubsub import wait_for_message class DummyConnectio...
mit
1c52d0095607fd1eaa249ccb3ccc623f
36.67044
88
0.59787
4.024728
false
true
false
false
gratipay/gratipay.com
gratipay/models/exchange_route.py
1
4865
from __future__ import absolute_import, division, print_function, unicode_literals import braintree from postgres.orm import Model class ExchangeRoute(Model): typname = "exchange_routes" def __eq__(self, other): if not isinstance(other, ExchangeRoute): return False return self.i...
mit
6557ba485f44d162effdfdd13a762059
34.772059
94
0.563823
4.339875
false
false
false
false
gratipay/gratipay.com
gratipay/utils/history.py
1
7917
"""Helpers to fetch logs of payments made to/from a participant. Data is fetched from 3 tables: `transfers`, `payments` and `exchanges`. For details on what these tables represent, see :ref:`db-schema`. """ from datetime import datetime from decimal import Decimal from aspen import Response from psycopg2 import Inte...
mit
16837836d5b09b17db1894df1b3fc6b8
34.662162
99
0.524946
4.293384
false
false
false
false
gratipay/gratipay.com
tests/py/test_team_sidebar.py
1
1998
from __future__ import absolute_import, division, print_function, unicode_literals from gratipay.testing import Harness class Tests(Harness): def setUp(self): self.admin = self.make_participant('admin', is_admin=True) self.picard = self.make_participant('picard') self.bob = self.make_par...
mit
d2407d77aa16f161e99a1db226c0434d
40.625
91
0.676176
3.450777
false
true
false
false
msikma/pokesprite
scripts/check_data.py
1
1118
#!/usr/bin/env python3 import sys import json from glob import glob from os.path import relpath, abspath, dirname from pathlib import Path BASE_DIR = str(Path(dirname(abspath(__file__))).parent) def get_json_files(base): '''Returns a list of all JSON files in the /data/ directory''' files = glob(f'{base}/data/**...
mit
ef61fbf3f68061966dddfd25df453d7c
23.304348
85
0.661002
3.408537
false
false
false
false
snare/voltron
voltron/plugins/api/registers.py
1
2328
import voltron import logging from voltron.api import * log = logging.getLogger('api') class APIRegistersRequest(APIRequest): """ API state request. { "type": "request", "request": "registers", "data": { "target_id": 0, "thread_id": 123456, ...
mit
5e82a9a3fd6750baf08170f1e43ff3d6
26.714286
123
0.524485
4.279412
false
false
false
false
sdispater/orator
orator/schema/builder.py
1
3617
# -*- coding: utf-8 -*- from contextlib import contextmanager from .blueprint import Blueprint class SchemaBuilder(object): def __init__(self, connection): """ :param connection: The schema connection :type connection: orator.connections.Connection """ self._connection = c...
mit
3e3db6258acffb35f26a936ee50f55c8
22.038217
87
0.560133
4.62532
false
false
false
false
sdispater/orator
orator/dbal/platforms/mysql_platform.py
1
9489
# -*- coding: utf-8 -*- from .platform import Platform from .keywords.mysql_keywords import MySQLKeywords from ..identifier import Identifier class MySQLPlatform(Platform): LENGTH_LIMIT_TINYTEXT = 255 LENGTH_LIMIT_TEXT = 65535 LENGTH_LIMIT_MEDIUMTEXT = 16777215 LENGTH_LIMIT_TINYBLOB = 255 LENGT...
mit
64261b4267b5d273c039818e4685519c
30.949495
107
0.550848
3.958698
false
false
false
false
sdispater/orator
orator/schema/grammars/postgres_grammar.py
1
7103
# -*- coding: utf-8 -*- from .grammar import SchemaGrammar from ..blueprint import Blueprint from ...query.expression import QueryExpression from ...support.fluent import Fluent class PostgresSchemaGrammar(SchemaGrammar): _modifiers = ["increment", "nullable", "default"] _serials = [ "big_integer",...
mit
b752a56bfe6b68a50c5a8d4fc9a9979d
27.412
86
0.591581
3.970375
false
false
false
false
sdispater/orator
orator/dbal/platforms/platform.py
1
21672
# -*- coding: utf-8 -*- from collections import OrderedDict from ..index import Index from ..table import Table from ..identifier import Identifier from ..exceptions import DBALException from ...utils import basestring class Platform(object): _keywords = None CREATE_INDEXES = 1 CREATE_FOREIGNKEYS = 2 ...
mit
b65fa1b66b467d15768704ecb2459718
29.395512
98
0.568568
4.267822
false
false
false
false
sdispater/orator
orator/commands/seeds/seed_command.py
1
1923
# -*- coding: utf-8 -*- import importlib import inflection import os from cleo import InputOption from orator import DatabaseManager from .base_command import BaseCommand from ...utils import load_module class SeedCommand(BaseCommand): """ Seed the database with records. db:seed {--d|database= :...
mit
323e452d7087dc78e51b69e1b2854aed
24.302632
80
0.571503
3.916497
false
false
false
false
sdispater/orator
orator/query/processors/mysql_processor.py
1
1790
# -*- coding: utf-8 -*- from .processor import QueryProcessor class MySQLQueryProcessor(QueryProcessor): def process_insert_get_id(self, query, sql, values, sequence=None): """ Process an "insert get ID" query. :param query: A QueryBuilder instance :type query: QueryBuilder ...
mit
3929819c92361c7e35cedc109d557c1f
27.870968
84
0.556983
4.613402
false
false
false
false
sdispater/orator
orator/utils/url.py
1
7566
# -*- coding: utf-8 -*- # engine/url.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Provides the :class:`~sqlalchemy.engine.url.URL` class whi...
mit
c98c71018f54defc27cf54d768be3809
29.508065
87
0.555644
4.145753
false
false
false
false
sdispater/orator
orator/orm/relations/relation.py
1
5956
# -*- coding: utf-8 -*- from contextlib import contextmanager from ...query.expression import QueryExpression from ..collection import Collection from ..builder import Builder class Relation(object): _constraints = True def __init__(self, query, parent): """ :param query: A Builder instance...
mit
e540ee5c71dc0edf42cbd391196471b4
22.919679
87
0.551209
4.578017
false
false
false
false
terrencepreilly/darglint
bin/bnf_to_cnf/tests/test_node.py
1
5041
from unittest import ( TestCase, ) from bnf_to_cnf.node import ( Node, NodeType, ) from bnf_to_cnf.parser import ( Parser, ) from utils import ( random_string, ) MAX_REPS = 100 class NodeTest(TestCase): def test_str(self): node = Node( NodeType.GRAMMAR, child...
mit
13cffd62549f74f8f66a2e630d94c250
28.828402
70
0.323349
5.588692
false
true
false
false
ui/django-post_office
post_office/tasks.py
1
1534
""" Only define the tasks and handler if we can import celery. This allows the module to be imported in environments without Celery, for example by other task queue systems such as Huey, which use the same pattern of auto-discovering tasks in "tasks" submodules. """ import datetime from django.utils.timezone import no...
mit
96c46f8588f78c53b2e3a725cf01c1c6
32.304348
99
0.678198
4.074468
false
false
false
false
terrencepreilly/darglint
darglint/parse/google.py
1
5411
import inspect from typing import ( List, ) from functools import ( reduce, ) from ..custom_assert import Assert from ..token import ( Token, TokenType, KEYWORDS, ) from .cyk import ( parse as cyk_parse, ) from ..node import ( CykNode, ) from .combinator import ( parser_combinator, ) f...
mit
8fed88de075d0f5ffb87684cf61b6bc9
26.328283
78
0.593236
3.972834
false
false
false
false
terrencepreilly/darglint
bin/bnf_to_cnf/bnf_to_cnf/parser.py
1
2656
from lark import ( Lark, Tree, ) from .node import ( Node, NodeType, ) class Parser(object): grammar = r''' start: grammar grammar: imports? external_imports? name? start_expression? production+ production: annotations? symbol _OPER expression _OPER: "::=" ...
mit
2005b80665f48e84ac315e9bd1fda763
24.04717
98
0.484746
4.041096
false
false
false
false
terrencepreilly/darglint
darglint/lex.py
1
6882
"""Defines a function for lexing a comment, `lex`.""" from typing import ( Iterator, List, Optional, ) from .custom_assert import Assert from .peaker import Peaker from .token import Token, TokenType from .config import ( get_config, ) # These convenience functions take an optional string # because th...
mit
151fa2efa99d52889be9942bc13a523f
27.438017
76
0.585876
3.795918
false
false
false
false
terrencepreilly/darglint
darglint/node.py
1
6729
from collections import ( deque, ) from typing import ( Any, Iterator, Optional, List, Tuple, ) from .token import ( Token, TokenType, ) WHITESPACE = {TokenType.INDENT, TokenType.NEWLINE} # A best guess at the maximum height of a docstring tree, # for use in recursion bounds checking...
mit
93b4e9bf3097118443d2f379e4bdd6a3
30.009217
114
0.52192
4.184701
false
false
false
false
ui/django-post_office
post_office/validators.py
1
1365
from django.core.exceptions import ValidationError from django.core.validators import validate_email from django.template import Template, TemplateSyntaxError, TemplateDoesNotExist from django.utils.encoding import force_str def validate_email_with_name(value): """ Validate email address. Both "Recipient...
mit
2f3223741bda3111626fe1430b4d69cc
28.042553
80
0.666667
4.50495
false
false
false
false
has2k1/plotnine
plotnine/stats/smoothers.py
1
15679
import warnings from contextlib import suppress import numpy as np import pandas as pd import scipy.stats as stats import statsmodels.api as sm import statsmodels.formula.api as smf from patsy import dmatrices from ..exceptions import PlotnineError, PlotnineWarning from ..utils import get_valid_kwargs smlowess = sm....
mit
fe6e2665f3c4277103df806bc7dbbbfa
27.098566
79
0.576376
3.659897
false
false
false
false
psd-tools/psd-tools
tests/psd_tools/utils.py
2
1629
from __future__ import absolute_import, unicode_literals import logging import fnmatch import os import tempfile from psd_tools.utils import trimmed_repr logging.basicConfig(level=logging.DEBUG) # Use maccyrillic encoding. CYRILLIC_FILES = { 'layer_mask_data.psb', 'layer_mask_data.psd', 'layer_params.psb'...
mit
624b88f1f3654de326522ac529e402a7
25.274194
71
0.648864
3.169261
false
false
false
false
psd-tools/psd-tools
src/psd_tools/psd/patterns.py
2
7229
""" Patterns structure. """ from __future__ import absolute_import, unicode_literals import attr import io import logging from psd_tools.compression import compress, decompress from psd_tools.constants import ColorMode, Compression from psd_tools.psd.base import BaseElement, ListElement from psd_tools.validators impor...
mit
4ea22450e9c4f13a351678f012468252
28.267206
78
0.585005
3.663964
false
false
false
false
psd-tools/psd-tools
src/psd_tools/composite/vector.py
1
15508
import logging from typing import Tuple import numpy as np from psd_tools.api.numpy_io import EXPECTED_CHANNELS, get_pattern from psd_tools.constants import Tag from psd_tools.terminology import Enum, Key, Klass, Type from scipy import interpolate logger = logging.getLogger(__name__) def _get_color(desc) -> Tuple[...
mit
a6505c3e784426745258cdc07c364a6d
31.039256
79
0.564261
3.274974
false
false
false
false
rsheftel/pandas_market_calendars
pandas_market_calendars/calendar_utils.py
1
11132
""" Utilities to use with market_calendars """ import itertools import warnings import pandas as pd import numpy as np def merge_schedules(schedules, how='outer'): """ Given a list of schedules will return a merged schedule. The merge method (how) will either return the superset of any datetime when any s...
mit
3ad10739d05412b15562dee6fa28fc5e
48.475556
115
0.641574
4.247234
false
false
false
false
reanahub/reana-client
reana_client/printer.py
1
1833
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2021 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """reana-client output print configuration.""" import click from reana_client.config import ...
mit
cc456bcb9a99d4cd6e532148aeaa7b07
28.564516
83
0.559738
3.445489
false
false
false
false
nerevu/riko
riko/modules/typecast.py
1
4059
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.modules.typecast ~~~~~~~~~~~~~~~~~~~~~ Provides functions for casting fields into specific types. Examples: basic usage:: >>> from riko.modules.typecast import pipe >>> >>> conf = {'type': 'date'} >>> next(pipe({'content':...
mit
2086de5dd289a3db79444ccd73a78212
29.75
79
0.573787
3.884211
false
false
false
false
nerevu/riko
riko/modules/timeout.py
1
6570
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.modules.timeout ~~~~~~~~~~~~~~~~~~~~ Provides functions for returning items from a stream until a certain amount of time has passed. Contrast this with the truncate module, which also limits the number of items, but returns items based on a count. Examples: ...
mit
c8b81e293fe2ef11caa48b1ec43364ad
30.137441
79
0.554033
4.385848
false
false
false
false
nerevu/riko
riko/bado/util.py
1
2503
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.bado.util ~~~~~~~~~~~~~~ Provides functions for creating asynchronous riko pipes Examples: basic usage:: >>> from riko import get_path >>> from riko.bado.util import xml2etree """ from os import environ from sys import executable from fun...
mit
91fb39d6abea65cec02105c714975924
26.505495
76
0.672393
3.941732
false
false
false
false
nerevu/riko
riko/utils.py
1
16899
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.utils ~~~~~~~~~~~~~~ Provides utility classes and functions """ import re import sys import itertools as it import fcntl from math import isnan from functools import partial, wraps from operator import itemgetter from os import O_NONBLOCK, path as p from io i...
mit
6d6f1a742eeb7f7d80900931a4cf2112
28.036082
82
0.569797
3.90187
false
false
false
false
nerevu/riko
riko/bado/sux.py
1
21031
# -*- test-case-name: twisted.web.test.test_xml -*- # # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ *S*mall, *U*ncomplicated *X*ML. This is a very simple implementation of XML/HTML as a network protocol. It is not at all clever. Its main features are that it does not: - support nam...
mit
9caec64927a2a07dd616607a9b317160
30.483533
80
0.559412
4.037435
false
false
false
false