repo_name stringlengths 5 92 | path stringlengths 4 221 | copies stringclasses 19
values | size stringlengths 4 6 | content stringlengths 766 896k | license stringclasses 15
values | hash int64 -9,223,277,421,539,062,000 9,223,102,107B | line_mean float64 6.51 99.9 | line_max int64 32 997 | alpha_frac float64 0.25 0.96 | autogenerated bool 1
class | ratio float64 1.5 13.6 | config_test bool 2
classes | has_no_keywords bool 2
classes | few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Ripley6811/TAIMAU | src/frames/po/prodselectf.py | 1 | 12013 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tix
import tkMessageBox
from utils import settings
from utils import calendar_tixradiobutton as date_picker
from utils.symbols import U_TOOLS, U_TRUCK
def main(_):
"""List products for creating orders.
Enter prices and order amounts and save as a multiple... | gpl-2.0 | -777,012,589,930,521,900 | 36.557994 | 95 | 0.523662 | false | 3.562593 | false | false | false |
UoMCS/syllabus-visualisation | add_initial_data.py | 1 | 5971 | #!/usr/bin/python
from __future__ import print_function
import sys
import os
import glob
import itertools
import argparse
from flask import Flask
import openpyxl
import requests
from server.app import app
from server.models import *
from server.api import get_categories
# Expected spreadsheet headers
HEADERS = [('... | mit | 251,148,890,609,220,740 | 30.930481 | 96 | 0.577123 | false | 4.012769 | false | false | false |
Alignak-monitoring-contrib/alignak-webui | alignak_webui/plugins/grafana/grafana.py | 1 | 1479 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Frederic Mohier, frederic.mohier@alignak.net
#
# This file is part of (WebUI).
#
# (WebUI) is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software F... | agpl-3.0 | -8,554,429,625,518,574,000 | 28 | 77 | 0.677485 | false | 3.688279 | false | false | false |
thombashi/pingparsing | pingparsing/_cmd_maker.py | 1 | 7021 | import abc
import math
from typing import List, Optional
import humanreadable as hr
from subprocrunner.typing import Command
from typepy import Integer
from ._typing import PingAddOpts
DEFAULT_DEADLINE = 3
class PingCmdMaker(metaclass=abc.ABCMeta):
def __init__(
self,
count: Optional[int] = No... | mit | -7,431,909,046,708,519,000 | 25.79771 | 87 | 0.572995 | false | 3.924539 | false | false | false |
sammyt/p3 | tests/p3_select_all_vows.py | 1 | 3512 | from p3 import P3
from pyvows import Vows, expect
import lxml
from lxml.etree import ElementBase
from lxml.html import builder as E
from lxml.html import fromstring, tostring
from lxml.cssselect import CSSSelector
@Vows.batch
class SelectionSelectAll(Vows.Context):
class SelectBody(Vows.Context):
"""se... | mit | -8,578,119,077,014,492,000 | 26.661417 | 62 | 0.50541 | false | 3.526104 | false | false | false |
hickerson/bbn | fable/fable_sources/libtbx/lzw.py | 1 | 25535 | """
A stream friendly, simple compression library, built around
iterators. See L{compress} and L{decompress} for the easiest way to
get started.
After the TIFF implementation of LZW, as described at
U{http://www.fileformat.info/format/tiff/corion-lzw.htm}
In an even-nuttier-shell, lzw compresses input bytes with int... | mit | 1,155,717,195,959,556,600 | 29.728039 | 336 | 0.590601 | false | 3.771787 | false | false | false |
nicupavel/wifi | wifi/scan.py | 1 | 5377 | from __future__ import division
import re
import textwrap
import wifi.subprocess_compat as subprocess
from wifi.utils import db2dbm
from wifi.exceptions import InterfaceError
class Cell(object):
"""
Presents a Python interface to the output of iwlist.
"""
def __init__(self):
self.bitrates =... | bsd-2-clause | 2,011,359,066,396,564,200 | 29.551136 | 103 | 0.539706 | false | 4.033758 | false | false | false |
piotrb5e3/ComfyMS-backend | posts/tests/test_views/test_unpublish.py | 1 | 1710 | from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework_jwt import utils
from posts.models import Post
from posts.tests.factory import create_post
class TestPost(APITestCase):
unpu... | apache-2.0 | -7,291,558,331,520,212,000 | 32.529412 | 77 | 0.693567 | false | 3.592437 | true | false | false |
titienmiami/mmc.repository | plugin.video.tvalacarta/servers/modovideo.py | 1 | 2571 | # -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para modovideo
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re, urlparse, urllib, urllib2
import os
from ... | gpl-2.0 | 8,743,703,862,752,684,000 | 33.756757 | 154 | 0.60949 | false | 3.25443 | false | false | false |
rockho-team/shuup-shipping-table | shuup_shipping_table_tests/settings.py | 1 | 3686 | # -*- coding: utf-8 -*-
import os
import tempfile
SECRET_KEY = "x"
INSTALLED_APPS = (
# django
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.staticfiles',
# shuup themes
'shuup.th... | agpl-3.0 | 7,859,239,709,768,708,000 | 26.303704 | 75 | 0.639718 | false | 3.387868 | false | false | false |
tomik/akimot | other/tagui/board_widget.py | 1 | 6768 | from PyQt4 import QtGui
from PyQt4 import QtCore
import sys
sys.path.append('..')
from aei import board
ANIMATE_ONE = 0.2
DIRECTIONS = {'n' : -8, 'w' : -1, 'e' : 1, 's': 8}
MAX_MOVE_INTERVAL = 1500
STEP_INTERVAL = 300
ERROR = -1
BSIDE = 8
BSIZE = 64
COL_EMPTY = 2
COLORS = ['Gold', 'Silver', '']
PIECE_EMPTY_STR... | gpl-3.0 | -2,530,082,398,558,692,000 | 33.886598 | 116 | 0.566785 | false | 3.319274 | false | false | false |
kch8qx/osf.io | website/project/views/contributor.py | 1 | 27505 | # -*- coding: utf-8 -*-
import httplib as http
from flask import request
from modularodm.exceptions import ValidationError, ValidationValueError
from framework import forms
from framework import status
from framework.auth import cas
from framework.auth import User, get_user
from framework.auth.core import generate_c... | apache-2.0 | -4,826,059,229,403,738,000 | 37.148405 | 120 | 0.641702 | false | 4.096664 | false | false | false |
DailyActie/Surrogate-Model | 01-codes/numpy-master/numpy/polynomial/polynomial.py | 1 | 52763 | """
Objects for dealing with polynomials.
This module provides a number of objects (mostly functions) useful for
dealing with polynomials, including a `Polynomial` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with polynomial objects is in
the do... | mit | 7,113,472,882,553,631,000 | 31.055286 | 79 | 0.592044 | false | 3.491695 | false | false | false |
BGCECSE2015/CADO | PYTHON/Extraction/WorkUnstructuredGrid/Ugrid_to_Python.py | 1 | 2002 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
print "Start"
from vtk import *
from vtk.util.numpy_support import vtk_to_numpy
import itertools as it
import cPickle
import getopt,sys
import numpy as np
# The source file: INPUT
print "Starting the Input reading"
try:
opts, args = getopt.getopt(sys.argv[1:], "ho:v", ... | bsd-3-clause | 2,013,413,984,805,884,000 | 23.716049 | 88 | 0.686813 | false | 2.847795 | false | false | false |
ajyoon/brown | tests/test_models/test_beat.py | 1 | 3692 | import unittest
from fractions import Fraction
import pytest
from brown.models.beat import Beat
class TestBeat(unittest.TestCase):
def test_init_from_numerator_denominator(self):
dur = Beat(1, 4)
assert(dur.numerator == 1)
assert(dur.denominator == 4)
def test_init_from_existing_be... | gpl-3.0 | -2,079,806,630,731,497,200 | 30.827586 | 71 | 0.555796 | false | 2.790627 | true | false | false |
edx/edxanalytics | src/util/playback.py | 1 | 1385 | import logging, logging.handlers
import sys
logging.handlers.HTTPHandler('','',method='GET')
logger = logging.getLogger('simple_example')
# http_handler = logging.handlers.HTTPHandler('127.0.0.1:9022', '/event', method='GET')
http_handler = logging.handlers.HTTPHandler('127.0.0.1:9999', '/httpevent', method='GET')
... | agpl-3.0 | 3,481,797,778,094,698,000 | 25.634615 | 90 | 0.651264 | false | 3.105381 | false | false | false |
m-housh/asyncio-utils | tests/test_asyncio_utils.py | 1 | 3526 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_asyncio_utils
----------------------------------
Tests for ``asyncio_utils`` module.
"""
import pytest
import collections
from asyncio_utils import *
pytestmark = pytest.mark.asyncio
async def test_aiter():
async def gen():
yield 1
async fo... | mit | -1,500,201,346,956,063,200 | 20.5 | 67 | 0.596143 | false | 3.301498 | true | false | false |
WeblateOrg/weblate | weblate/accounts/notifications.py | 1 | 25871 | #
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | gpl-3.0 | 4,587,541,232,653,189,600 | 31.294632 | 88 | 0.613847 | false | 4.35122 | false | false | false |
aerkalov/booktype-scrolls | scripts/replace/replace_in_chapter.py | 1 | 2053 | #!/usr/bin/env python
# This file is part of booktype-scrolls.
# Copyright (c) 2012 Aleksandar Erkalovic <aleksandar.erkalovic@sourcefabric.org>
#
# Booktype is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundati... | agpl-3.0 | 7,463,137,194,421,476,000 | 34.396552 | 116 | 0.6868 | false | 3.773897 | false | false | false |
faturita/ShinkeyBot | NeoCortex/PILServer.py | 1 | 1155 | import io
import socket
import struct
from PIL import Image
# Start a socket listening for connections on 0.0.0.0:8000 (0.0.0.0 means
# all interfaces)
server_socket = socket.socket()
server_socket.bind(('0.0.0.0', 8000))
server_socket.listen(0)
# Accept a single connection and make a file-like object out of it
conne... | mit | 2,706,392,689,272,737,300 | 32 | 82 | 0.648485 | false | 3.737864 | false | false | false |
IljaKosynkin/ResourcesManager | ResourceManager/scripts/MappingParser.py | 1 | 3815 | import re
classes_reg = re.compile(r'(.+?)(<?->)(.+)')
variable_reg = re.compile(r'(.+?)(,.+?)?(<?->)([^,]+)(,.+)?')
class_reg = re.compile(r'(class|struct)([^:{]+?)(:[^{]+?){([^}]+?)}', re.DOTALL)
class_var_reg = re.compile(r'(let|var)([^:=]+?)(:[^=]+)(=.+?)?')
class Direction:
ONE_WAY = 0
TWO_WAY = 1
... | apache-2.0 | -6,775,840,383,661,861,000 | 32.173913 | 107 | 0.473132 | false | 4.243604 | false | false | false |
jeffcharles/Open-Source-at-Laurier-Website | wluopensource/osl_comments/moderation.py | 1 | 1725 | from django.contrib import comments
from django.contrib.comments.moderation import CommentModerator, Moderator
from django.core.exceptions import ObjectDoesNotExist
from osl_comments import signals
from osl_comments.models import CommentsBannedFromIpAddress
class OslCommentModerator(CommentModerator):
email_notif... | bsd-3-clause | -8,850,779,001,417,020,000 | 34.204082 | 76 | 0.636522 | false | 4.503916 | false | false | false |
MayankGo/ec2-api | ec2api/api/common.py | 1 | 14867 | # Copyright 2014
# The Cloudscaling Group, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | apache-2.0 | -8,390,567,758,202,169,000 | 31.389978 | 77 | 0.552499 | false | 3.790668 | false | false | false |
bretttegart/treadmill | tests/services/network_service_test.py | 1 | 25230 | """Unit test for network_service - Treadmill Network configuration service.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
# Disable W0611: Unused import
i... | apache-2.0 | -3,160,640,449,361,704,000 | 35.724891 | 79 | 0.548553 | false | 3.50514 | true | false | false |
anderspetersson/django-bigbrother | bigbrother/graphs.py | 1 | 1117 | from bigbrother.core import get_module_by_slug
from bigbrother.models import ModuleStat
from django.db.models import Avg
from datetime import datetime, timedelta
import qsstats
class Graph():
stopdate = datetime.utcnow()
showpoints = False
def get_graph_data(self, slug, *args, **kwargs):
module =... | mit | 7,771,129,545,592,402,000 | 24.386364 | 95 | 0.683975 | false | 3.580128 | false | false | false |
openstack/python-designateclient | designateclient/tests/test_utils.py | 1 | 2478 | # Copyright (c) 2015 Thales Services SAS
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | apache-2.0 | -5,595,013,377,408,899,000 | 38.967742 | 76 | 0.679984 | false | 3.671111 | true | false | false |
mugwizaleon/PCRasterMapstacks | pcrastermapstackvisualisation.py | 1 | 17920 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
PcrasterMapstackVisualisation
A QGIS plugin
PCRaster Mapstack visualisation
-------------------
begin : 2014-06-28
copy... | apache-2.0 | 5,158,709,821,810,723,000 | 43.246914 | 161 | 0.577846 | false | 3.916084 | false | false | false |
ruzette/project-euler-solutions | old/src/pythagoras.py | 1 | 1204 | '''
Project Euler Problem 9
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a**2 + b**2 = c**2
For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
Link : https://projecteuler.net/problem=... | gpl-2.0 | -2,547,885,850,957,645,000 | 15.736111 | 78 | 0.601329 | false | 2.669623 | false | false | false |
dangoldin/bots | database.py | 1 | 1126 | #!/usr/bin/python
import sqlite3
class Database:
def __init__(self):
self.connect()
def connect(self):
self.conn = sqlite3.connect('lifebot.db')
def get_cursor(self):
# A bit weird for now but trying to figure out SQLite
try:
return self.conn.cursor()
... | mit | 1,900,277,455,134,007,600 | 23.478261 | 61 | 0.53286 | false | 3.869416 | false | false | false |
dmkent/cattrack | cattrack/settings.py | 1 | 4095 | """
Django settings for cattrack project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import date... | mit | 7,996,530,891,419,315,000 | 25.771242 | 91 | 0.691087 | false | 3.485106 | false | false | false |
sashs/Ropper | ropper/ropchain/arch/ropchainx86.py | 1 | 45777 | # coding=utf-8
# Copyright 2018 Sascha Schirra
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following di... | bsd-3-clause | -8,215,692,454,169,640,000 | 39.049869 | 220 | 0.565306 | false | 3.829109 | false | false | false |
christian-oudard/htmltreediff | setup.py | 1 | 1156 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
try:
from setuptools import setup, find_packages, Command
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command
long_description = codecs.open("README.rst", "r", "utf-8... | bsd-3-clause | -528,279,789,836,163,200 | 28.641026 | 66 | 0.635813 | false | 3.892256 | false | false | false |
gem/oq-hazardlib | openquake/hazardlib/source/multi.py | 1 | 4887 | # The Hazard Library
# Copyright (C) 2012-2017 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#... | agpl-3.0 | 5,867,925,651,573,469,000 | 41.868421 | 80 | 0.646 | false | 3.710706 | false | false | false |
RedHatSatellite/sat6_disconnected_tools | check_sync.py | 1 | 5114 | #!/usr/bin/python
#title :check_sync.py
#description :Checks Satellite 6 repository sync status
#URL :https://github.com/RedHatSatellite/sat6_disconnected_tools
#author :Geoff Gatward <ggatward@redhat.com>
#notes :This script is NOT SUPPORTED by Red Hat Global Support Servic... | gpl-3.0 | -8,045,071,100,679,079,000 | 37.742424 | 107 | 0.58291 | false | 4.147607 | false | false | false |
crazyskateface/LC | chat/migrations/0002_auto__add_field_comments_datetime.py | 1 | 4344 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Comments.datetime'
db.add_column(u'chat_comments', 'datet... | mit | 3,995,369,740,722,434,000 | 62.897059 | 195 | 0.560543 | false | 3.681356 | false | false | false |
testvidya11/ejrf | questionnaire/views/questions.py | 1 | 2642 | from django.contrib import messages
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseRedirect
from django.views.generic import ListView, CreateView, DeleteView
from questionnaire.forms.questions import QuestionForm
from questionnaire.models import Question, Questionnaire
... | bsd-3-clause | -4,488,295,597,814,953,000 | 40.296875 | 120 | 0.681681 | false | 4.154088 | false | false | false |
stephan-hof/pyrocksdb | setup.py | 1 | 1112 | from setuptools import setup
from setuptools import find_packages
from distutils.extension import Extension
try:
from Cython.Build import cythonize
except ImportError:
def cythonize(extensions): return extensions
sources = ['rocksdb/_rocksdb.cpp']
else:
sources = ['rocksdb/_rocksdb.pyx']
mod1 = Extens... | bsd-3-clause | -5,846,450,579,172,682,000 | 22.166667 | 51 | 0.61241 | false | 3.518987 | false | false | false |
coblo/pyiscclib | src/iscclib/base.py | 1 | 6592 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from future.builtins import int, object
import re
import six
import unicodedata
import random
from abc import ABCMeta
from bitstring import BitArray
class Component(object):
"""Base class for all ISCC identifier components"""... | bsd-2-clause | -1,785,738,772,418,968,800 | 29.09589 | 101 | 0.565468 | false | 3.97767 | false | false | false |
rosshamish/classtime | classtime/brain/local_db/stdlocaldb.py | 1 | 4950 |
from classtime.logging import logging
logging = logging.getLogger(__name__) #pylint: disable=C0103
from classtime.core import db
from classtime.models import Term, Schedule, Course, Section
class StandardLocalDatabase(object):
"""A single institution's view of the local database
Uses a stack-based accessor ... | mit | 7,401,892,997,875,430,000 | 30.132075 | 93 | 0.599596 | false | 4.537122 | false | false | false |
umlfri/umlfri2 | umlfri2/application/tablist.py | 1 | 4454 | from umlfri2.application.events.solution import CloseSolutionEvent
from .events.model import DiagramDeletedEvent
from .events.tabs import OpenTabEvent, ChangedCurrentTabEvent, ClosedTabEvent
from .tab import Tab
class TabList:
def __init__(self, application):
self.__tabs = []
self.__application = ... | gpl-3.0 | -7,465,691,265,426,691,000 | 34.632 | 100 | 0.584868 | false | 4.282692 | false | false | false |
Loodoor/UrWorld-Alpha-3.x | src/compressor.py | 1 | 2667 | import pickle
import re
from itertools import groupby
class RLECompress:
def __init__(self, file):
self.file = file
def verifier(self, objet):
if isinstance(objet, list):
return all(map(lambda elt: isinstance(elt, list), objet))
return False
def dump(self, objet):
... | gpl-2.0 | 1,628,458,951,564,252,000 | 24.409524 | 69 | 0.468691 | false | 4.010526 | false | false | false |
agx/libvirt-sandbox-debian | libvirt-sandbox/image/cli.py | 1 | 9075 | #!/usr/bin/python -Es
# -*- coding: utf-8 -*-
# Authors: Daniel P. Berrange <berrange@redhat.com>
# Eren Yagdiran <erenyagdiran@gmail.com>
#
# Copyright (C) 2013-2015 Red Hat, Inc.
# Copyright (C) 2015 Universitat Politècnica de Catalunya.
#
# This program is free software; you can redistribute it and/or modif... | lgpl-2.1 | -2,818,622,284,454,972,400 | 31.407143 | 91 | 0.60778 | false | 3.86786 | false | false | false |
moreati/revelation | epiphany/test/test_opcode_factory.py | 1 | 12799 | from opcode_factory import *
import pytest
def test_arith32_immediate():
# 0bdddnnnxxiiiiiiiidddnnniii0011011 ADD
instr = 0b00000000010101010010000100011011
assert add32_immediate(rd=1, rn=0, imm=0b01010101010) == instr
# 0bdddnnnxxiiiiiiiidddnnniii0111011 SUB
instr = 0b000000000101010... | bsd-3-clause | -7,091,504,160,489,410,000 | 37.667674 | 87 | 0.703258 | false | 2.834145 | true | false | false |
nilp0inter/data-is-fun | dataisfun/util/table_maker.py | 1 | 7772 | #!/usr/bin/env python
#
# Copyright (C) 2011 Roberto A. Martinez Perez
#
# This file is part of data-is-fun.
#
# data-is-fun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | gpl-3.0 | -6,467,875,412,102,633,000 | 37.098039 | 132 | 0.558929 | false | 3.630079 | false | false | false |
joccing/geoguru | classes/country.py | 1 | 2531 |
"""
This is a system to query statistics for a country by approximate name match.
Author: Tay Joc Cing
Date: 10 Mar 2015
Version: 0.1
"""
class Country:
"""
This is a class to capture statistics for a country
>>> from country import Country
>>> c = Country("Singapore", {"Population":5000000, "Den... | mit | 2,255,561,135,565,796,900 | 26.51087 | 100 | 0.563809 | false | 3.985827 | false | false | false |
ssuarez6/lyra | single_variable_eq/python/multiple_root.py | 1 | 1385 | from astropy.table import Table
import parser, decimal, plot
c = raw_input("Absolute(a) or Relative(r) error?\n>")
abs_error = False
if c is 'a':
abs_error = True
fn = raw_input("\nType the function:\n>f(x) = ")
fn_p = raw_input("\nType the differential of the function:\n>f'(x) = ")
fn_p_p = raw_input("\nType the ... | gpl-2.0 | 5,931,702,118,150,126,000 | 30.477273 | 88 | 0.597112 | false | 2.509058 | false | false | false |
fedora-infra/python-fedora | fedora/urlutils.py | 1 | 3429 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Red Hat, Inc.
# This file is part of python-fedora
#
# python-fedora is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, ... | lgpl-2.1 | -2,795,770,200,159,095,000 | 37.1 | 78 | 0.621172 | false | 4.222906 | false | false | false |
redapple/js2xml | tests/test_syntax.py | 1 | 6887 | import js2xml
from nose.tools import *
def test_syntax():
jscode_snippets = [
# strings
r"""
"test";
""",
r"""
"test\
multiline";
""",
# numbers
"3.14;",
"-12;",
"3.45e2;",
"0377;",
"0xFF;"
#... | mit | 9,180,512,179,735,242,000 | 20.061162 | 85 | 0.311747 | false | 4.158816 | true | false | false |
caleblogemann/MyProjects | TeX/texmf/tex/latex/sagetex/makestatic.py | 1 | 2565 | #!/usr/bin/env python
##
## This is file `makestatic.py',
## generated with the docstrip utility.
##
## The original source files were:
##
## scripts.dtx (with options: `staticscript')
##
## This is a generated file. It is part of the SageTeX package.
##
## Copyright (C) 2008--2015 by Dan Drake <dr.dan.drake@gmail.c... | mit | 6,655,804,548,877,355,000 | 31.0625 | 186 | 0.699025 | false | 3.344198 | false | false | false |
myarjunar/inasafe | safe/utilities/keyword_io.py | 1 | 22390 | # coding=utf-8
"""Keyword IO implementation."""
import logging
from ast import literal_eval
from datetime import datetime
from PyQt4.QtCore import QObject
from PyQt4.QtCore import QUrl, QDateTime
from qgis.core import QgsMapLayer
from safe.definitions.utilities import definition
from safe import messaging as m
fro... | gpl-3.0 | 1,370,593,998,021,988,000 | 36.254576 | 79 | 0.525949 | false | 4.657791 | false | false | false |
bellettif/MultimodePIF | PythonWksp/multiPIF/OSM/native/network_tools.py | 1 | 6544 | '''
Created on Jan 5, 2015
@author: Francois Belletti
'''
import numpy as np
from OSM.misc.geoTools import computeDist
#
# Need to change that distance
#
def l2_dist(node_1, node_2):
lat_1 = float(node_1.get('lat'))
lon_1 = float(node_1.get('lon'))
lat_2 = float(node_2.get('lat'))
lon_2 = float(n... | gpl-2.0 | -770,346,969,659,895,000 | 34.570652 | 92 | 0.541106 | false | 3.686761 | false | false | false |
jvantuyl/exim_ses_transport | setup.py | 1 | 1915 | """
setuptools installer for exim_ses_transport
"""
# Copyright 2011, Jayson Vantuyl <jvantuyl@gmail.com>
#
# This file is part of exim_ses_transport.
#
# exim_ses_transport is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free S... | lgpl-3.0 | -5,263,435,409,964,474,000 | 39.744681 | 112 | 0.731593 | false | 3.27911 | false | false | false |
leture/sorl-thumbnail | sorl/thumbnail/engines/convert_engine.py | 1 | 5931 | from __future__ import unicode_literals, with_statement
import re
import os
import subprocess
from django.utils.encoding import smart_str
from django.core.files.temp import NamedTemporaryFile
from sorl.thumbnail.base import EXTENSIONS
from sorl.thumbnail.compat import b
from sorl.thumbnail.conf import settings
from s... | bsd-3-clause | -3,817,632,963,750,182,000 | 33.684211 | 86 | 0.544933 | false | 4.188559 | false | false | false |
ArthurChiao/code-snippets | python/command-line-chess/Piece.py | 1 | 1991 | from Coordinate import Coordinate as C
from Move import Move
WHITE = True
BLACK = False
X = 0
Y = 1
class Piece:
def __init__(self, board, side, position, movesMade=0):
self.board = board
self.side = side
self.position = position
self.movesMade = 0
def __str__(self):
... | mit | -7,932,084,885,449,304,000 | 32.745763 | 80 | 0.525866 | false | 3.966135 | false | false | false |
jmchilton/lwr | lwr/managers/queued_cli.py | 1 | 2771 | """
LWR job manager that uses a CLI interface to a job queue (e.g. Torque's qsub,
qstat, etc...).
"""
from .base.external import ExternalBaseManager
from .util.external import parse_external_id
from .util.cli import CliInterface, split_params
from .util.job_script import job_script
from logging import getLogger
log =... | apache-2.0 | -5,064,412,559,986,054,000 | 44.42623 | 100 | 0.666546 | false | 3.641261 | false | false | false |
Sakaki/pyniconico | nico_tools/nicovideo_dl.py | 1 | 8551 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from urllib import parse
import os
from nico_tools import nico_xml_parser
from nico_tools.nicowalker import NicoWalker
from nico_tools.mylist_items import GetMyListItems
from nico_tools.mylist import MyList
from progressbar import ProgressBar, Percentage, Bar, ETA
import s... | lgpl-3.0 | -3,729,398,876,914,949,600 | 38.790816 | 107 | 0.537505 | false | 3.220066 | false | false | false |
Pulgama/supriya | etc/pending_ugens/TGrains.py | 1 | 8796 | import collections
from supriya.enums import CalculationRate
from supriya.ugens.MultiOutUGen import MultiOutUGen
class TGrains(MultiOutUGen):
"""
::
>>> tgrains = supriya.ugens.TGrains.ar(
... amp=0.1,
... buffer_id=0,
... center_pos=0,
... channel_cou... | mit | 4,294,441,497,532,689,400 | 23.501393 | 64 | 0.403479 | false | 3.98009 | false | false | false |
adviti/melange | app/soc/views/helper/url.py | 1 | 1660 | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 | 1,164,587,603,535,884,300 | 26.666667 | 74 | 0.672892 | false | 3.577586 | false | false | false |
geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/net/data/verify_certificate_chain_unittest/generate-expired-target.py | 5 | 1324 | #!/usr/bin/python
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Certificate chain with 1 intermediate, where the target is expired (violates
validity.notAfter). Verification is expected to fail.""... | gpl-3.0 | 8,163,013,571,503,341,000 | 35.777778 | 79 | 0.747734 | false | 3.511936 | false | true | false |
johnewart/django-ldap-wizard | django_ldap_wizard/views.py | 1 | 2059 | from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext, Template, Context, loader
from django.utils.safestring import mark_safe
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.conf import settings
from django.contrib.auth import auth... | bsd-3-clause | 2,899,133,696,738,876,000 | 34.5 | 135 | 0.626032 | false | 4.227926 | false | false | false |
PauliusLabanauskis/AlgorithmsDataStructures | algo_pathfinding/main.py | 1 | 1083 | from graph_input import read_graph
def choose_node(reachable, explored):
for node in reachable:
if node not in explored:
return node
def find_path(start_node, goal_node, graph):
reachable = [start_node]
explored = set()
previous = {start_node: None}
while len(reachable) > 0:
... | unlicense | 4,045,211,619,959,959,000 | 28.297297 | 51 | 0.590951 | false | 3.696246 | false | false | false |
lemonad/methodiki | methodiki/methods/forms.py | 1 | 1932 | # -*- coding: utf-8 -*-
from django.forms import ModelForm, TextInput
from django.utils.translation import ugettext_lazy as _
from markitup.widgets import MarkItUpWidget
from taggit.forms import TagWidget
from common.forms import ModelFormRequestUser
from models import Method, MethodBonus
class MethodForm(ModelFormR... | mit | 521,258,909,401,425,000 | 35.45283 | 74 | 0.552795 | false | 4.441379 | false | false | false |
anthonyfok/frescobaldi | frescobaldi_app/gadgets/drag.py | 1 | 4442 | # This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2011 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | gpl-2.0 | -7,891,103,354,302,992,000 | 34.253968 | 81 | 0.652634 | false | 3.927498 | false | false | false |
milankl/swm | calc/misc/Re_hist_calc_bs_old.py | 1 | 4307 | ## HISTOGRAM COMPUTATIONS FOR REYNOLDS AND ROSSBY NUMBERS
from __future__ import print_function
# path
import os
path = '/home/mkloewer/python/swm/'
#path = os.path.dirname(os.getcwd()) + '/' # on level above
os.chdir(path) # change working directory
import time as tictoc
import numpy a... | gpl-3.0 | 5,122,311,992,360,908,000 | 27.523179 | 100 | 0.574878 | false | 2.533529 | false | false | false |
paramecio/pastafari | scripts/monit/debian_wheezy/alive.py | 1 | 4720 | #!/usr/bin/python3 -u
# A script for install alive script
import subprocess
import argparse
import re
import os
import shutil
import pwd
from subprocess import call
parser = argparse.ArgumentParser(description='A script for install alive script and cron')
parser.add_argument('--url', help='The url where notify tha... | gpl-2.0 | 6,790,356,266,525,873,000 | 33.962963 | 239 | 0.60911 | false | 3.157191 | false | false | false |
pnecchi/Thesis | Code/Prototype/critic.py | 1 | 2591 | ################################################################################
# Description: Module containing various critic implementations
# Author: Pierpaolo Necchi
# Email: pierpaolo.necchi@gmail.com
# Date: dom 05 giu 2016 18:24:01 CEST
########################################################... | mit | -4,194,413,793,386,329,000 | 24.653465 | 80 | 0.526052 | false | 4.728102 | false | false | false |
andjimrio/LTN | Application/service/item_services.py | 1 | 5173 | from collections import Counter
from django.utils import timezone
from django.shortcuts import get_object_or_404
from Application.models import Item, UserProfile, Section, Status
from Application.utilities.python_utilities import floor_log
from Application.service.profile_services import get_profile, get_keywords_by_... | mit | -247,588,790,225,376,540 | 33.039474 | 117 | 0.641794 | false | 3.589868 | false | false | false |
bykof/billomapy | billomapy/resources.py | 1 | 4081 | """
KEY and DATA_KEYS FOR THE API
"""
PROPERTY_VALUES = '-property-values'
PROPERTY_VALUE = '-property-value'
TAGS = '-tags'
TAG = '-tag'
ITEMS = '-items'
ITEM = '-item'
COMMENTS = '-comments'
COMMENT = '-comment'
PAYMENTS = '-payments'
PAYMENT = '-payment'
EMAIL_RECEIVERS = '-email-receivers'
EMAIL_RECEIVER = '-... | apache-2.0 | -6,912,875,700,097,215,000 | 19.611111 | 55 | 0.735359 | false | 2.636305 | false | false | false |
pcrews/rannsaka | test_files/2volumes_basic.py | 1 | 3456 | import os
import random
import time
import json
from locust import HttpLocust, TaskSet, task
from lib.baseTaskSet import baseTaskSet
# TODO - make these config-driven
from lib.openstack.keystone import get_auth_token
from lib.openstack.cinder import list_volumes
from lib.openstack.cinder import list_volumes_detail
f... | apache-2.0 | -4,197,645,863,638,664,000 | 29.052174 | 88 | 0.567998 | false | 3.696257 | false | false | false |
quantumlib/Cirq | examples/quantum_fourier_transform.py | 1 | 2702 | """
Creates and simulates a circuit for Quantum Fourier Transform(QFT)
on a 4 qubit system.
In this example we demonstrate Fourier Transform on
(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) vector. To do the same, we prepare
the input state of the qubits as |0000>.
=== EXAMPLE OUTPUT ===
Circuit:
(0, 0): ─H───@^0.5───×───H──────... | apache-2.0 | -501,834,738,332,291,460 | 28.605263 | 79 | 0.480889 | false | 2.300613 | false | false | false |
lucywyman/slides | source/source/conf.py | 1 | 9886 | # -*- coding: utf-8 -*-
#
# slides documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 1 21:05:39 2015.
#
# 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.
#
# Al... | mit | -2,277,928,140,607,679,200 | 29.990596 | 79 | 0.698867 | false | 3.64797 | true | false | false |
QuantScientist/Deep-Learning-Boot-Camp | Kaggle-PyTorch/PyTorch-Ensembler/nnmodels/simplenet.py | 1 | 3522 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import math
use_gpu = torch.cuda.is_available()
# class SimpleNet(nn.Module):
# def __init__(self, num_classes=1, n_dim=3):
# sup... | mit | -797,179,292,493,046,100 | 29.102564 | 87 | 0.561897 | false | 2.894002 | false | false | false |
showerst/openstates | openstates/ma/bills.py | 1 | 5391 | import re
import time
import itertools
from datetime import datetime
import lxml.html
from billy.scrape.bills import BillScraper, Bill
from .actions import Categorizer
class MABillScraper(BillScraper):
jurisdiction = 'ma'
categorizer = Categorizer()
def __init__(self, *args, **kwargs):
super(M... | gpl-3.0 | -5,255,152,788,165,051,000 | 38.065217 | 97 | 0.515674 | false | 3.875629 | false | false | false |
vetu11/piloco | telegram/inlinequeryresultcontact.py | 1 | 3739 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | gpl-3.0 | -2,659,378,203,046,759,000 | 39.204301 | 99 | 0.651511 | false | 4.282932 | false | false | false |
failys/CAIRIS | cairis/test/test_TraceAPI.py | 1 | 4597 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | apache-2.0 | 1,405,920,786,759,605,500 | 36.991736 | 190 | 0.694583 | false | 3.405185 | true | false | false |
hs634/algorithms | python/test.py | 1 | 1435 | #
# inputs outputs
# single sin
# simple sim
# solution so
# a a
#
class Node:
def __init__(self, val):
self.val = val
self.children = [0] * 26
self.is_end = False
self.word_count = 1
def get_unique_prefixes(words):
root = Node(0)
root.word_count += 1
... | mit | -2,184,815,566,675,535,400 | 19.5 | 65 | 0.502439 | false | 3.344988 | false | false | false |
pacoqueen/ginn | extra/patches/upgrade_db_etiquetas_norma13.py | 1 | 8959 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Crea los campos y actualiza los productos para las nuevas etiquetas de la
norma del 1 de julio de 2013.
"""
import os, sys
sys.path.insert(0, (os.path.join(os.path.abspath(os.path.dirname(__file__)),
"..", "..", "ginn")))
os.chdir(os.path.join(os... | gpl-2.0 | 4,343,040,480,813,969,000 | 46.989189 | 357 | 0.615116 | false | 2.805942 | false | false | false |
saram-kon/beepmusic | midi_to_beep/midi_to_beep.py | 1 | 8039 | #! python
# COPYRIGHT: BALTHASAR SCHLOTMANN 2017
# LICENSED UNDER THE GNU GENERAL PUBLIC LICENSE VERSION 3
import sys
import notedict as nd
filename = sys.argv[1]
# from here: https://github.com/bspaans/python-mingus/blob/master/mingus/midi/midi_file_in.py
def parse_varbyte_as_int( array, i):
"""Read a variable l... | gpl-3.0 | -7,332,480,733,141,676,000 | 19.989556 | 136 | 0.568603 | false | 2.475824 | false | false | false |
abetkin/django-qfilter | qfilters/exotic_types.py | 1 | 5664 | # -*- coding: utf-8 -*-
from itertools import groupby
from functools import reduce
from . import QuerySetFilter, ValuesDictFilter
from .utils import CallablesList
class QuerysetIterationHook(QuerySetFilter):
def __init__(self, hook_function):
self.hook_function = hook_function
def __and__(... | mit | 5,493,379,134,751,327,000 | 38.333333 | 95 | 0.549788 | false | 4.567742 | false | false | false |
levkar/odoo-addons | stock_remit/wizard/stock_print_remit.py | 1 | 2063 | # -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class stock_print_remit(osv.osv_memory):
_name = 'stock.print_remit'
_description = "Print Remit"
_columns = {
'remit_number': fields.char('Remit Number'),
}
def default_get(self, cr, uid, fields, context=None):
res = su... | agpl-3.0 | -6,010,823,284,556,998,000 | 31.746032 | 78 | 0.593311 | false | 3.764599 | false | false | false |
Robpol86/coveralls-multi-ci | tests/test_git_stats_detached.py | 1 | 2466 | import subprocess
from coveralls_multi_ci import git_stats
def test_master(repo_dir, hashes):
hex_sha = hashes['master']
assert 0 == subprocess.check_call(['git', 'checkout', '-qf', hex_sha], cwd=repo_dir)
actual = git_stats(repo_dir)
expected = dict(
branch='master',
remotes=[dict(n... | mit | -6,090,221,263,133,441,000 | 28.710843 | 88 | 0.553528 | false | 3.53802 | false | false | false |
zenodo/invenio | invenio/modules/deposit/types/simplerecord.py | 1 | 3085 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | gpl-2.0 | -24,379,396,801,336,468 | 35.72619 | 98 | 0.667099 | false | 4.243466 | false | false | false |
uclouvain/osis | ddd/logic/application/use_case/read/get_attributions_about_to_expire_service.py | 1 | 3140 | ##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | agpl-3.0 | -4,942,348,289,365,536,000 | 52.20339 | 112 | 0.745142 | false | 4.103268 | false | false | false |
sebrandon1/nova | nova/tests/unit/api/openstack/compute/test_flavorextradata.py | 1 | 3374 | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 | -4,678,552,957,418,151,000 | 37.781609 | 78 | 0.576763 | false | 3.639698 | true | false | false |
riolet/rioauth | provider/pages/login_github.py | 1 | 4700 | import web
import oauthlib.oauth2.rfc6749
import constants
import common
import base
import logging
import pprint
from models import oauth_consumer
class Login(base.Page):
def __init__(self):
base.Page.__init__(self, "Riolet Login")
self.redirect_uri = unicode(constants.config.get('github', 'redir... | gpl-3.0 | -5,499,552,348,842,626,000 | 42.119266 | 169 | 0.59766 | false | 4.207699 | true | false | false |
selam/retopy | run.py | 1 | 4143 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Timu EREN
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | apache-2.0 | 7,731,218,416,699,945,000 | 28.805755 | 117 | 0.633599 | false | 4.143 | false | false | false |
seiji56/rmaze-2016 | logic_code/last_ver/phys/movement.py | 1 | 6199 | import herkulex
import time
import thread
import RPi.GPIO as gpio
import sensory as sn
herkulex.connect("/dev/ttyAMA0", 115200)
FR = herkulex.servo(0xfd)
FL = herkulex.servo(16)
BR = herkulex.servo(10)
BL = herkulex.servo(20)
DROP = herkulex.servo(50)
ALL = herkulex.servo(0xfe)
ALL.torque_on()
def align(to... | gpl-3.0 | 6,822,648,541,186,779,000 | 28.519048 | 88 | 0.490563 | false | 3.119779 | false | false | false |
buckket/twtxt | twtxt/helper.py | 1 | 5887 | """
twtxt.helper
~~~~~~~~~~~~
This module implements various helper for use in twtxt.
:copyright: (c) 2016-2017 by buckket.
:license: MIT, see LICENSE for more details.
"""
import shlex
import subprocess
import sys
import textwrap
import click
import pkg_resources
from twtxt.mentions import for... | mit | 3,330,599,727,563,518,500 | 31.787709 | 111 | 0.622934 | false | 3.714557 | false | false | false |
euphorie/Euphorie | src/euphorie/client/tests/test_functional_country.py | 1 | 2524 | # coding=utf-8
from euphorie.client.tests.utils import addSurvey
from euphorie.client.tests.utils import registerUserInClient
from euphorie.content.tests.utils import BASIC_SURVEY
from euphorie.testing import EuphorieFunctionalTestCase
import urllib
class CountryFunctionalTests(EuphorieFunctionalTestCase):
def t... | gpl-2.0 | -2,004,303,997,983,281,400 | 44.071429 | 86 | 0.603011 | false | 3.853435 | true | false | false |
tsnoam/python-telegram-bot | tests/test_update.py | 1 | 2618 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | gpl-3.0 | 2,410,395,597,240,658,000 | 34.863014 | 77 | 0.60084 | false | 3.978723 | true | false | false |
alexlib/Qt-Python-Binding-Examples | windows/custom_win_flags.py | 1 | 1096 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
demo template
Tested environment:
Mac OS X 10.6.8
"""
import sys
try:
from PySide import QtCore
from PySide import QtGui
except ImportError:
from PyQt4 import QtCore
from PyQt4 import QtGui
class SheetWin(QtGui.QWidget):
def __init__(self,... | bsd-3-clause | 3,303,483,538,088,207,000 | 18.245614 | 46 | 0.57573 | false | 3.41433 | false | false | false |
ContinuumIO/dask | dask/cache.py | 2 | 2000 | from .callbacks import Callback
from timeit import default_timer
from numbers import Number
import sys
overhead = sys.getsizeof(1.23) * 4 + sys.getsizeof(()) * 4
class Cache(Callback):
""" Use cache for computation
Examples
--------
>>> cache = Cache(1e9) # doctest: +SKIP
The cache ca... | bsd-3-clause | 5,867,186,618,734,456,000 | 29.769231 | 87 | 0.572 | false | 3.824092 | false | false | false |
codecakes/random_games | single_linkedlist.py | 1 | 8155 | ## Singly Linked List
## Each Node is relatively Head to the next node it refers to.
## The Linked List can be broken down into:
## Nodes.
"""
Single Linked List can:
- Insert at Head, Tail, Inbetween
- Delete at Head, Tail, Inbetween
- Add another LinkedList to Existing
"""
class LinkedNode(object):
... | mit | 8,933,424,772,247,574,000 | 25.917492 | 79 | 0.527406 | false | 3.705134 | false | false | false |
googlefonts/fontbakery | Lib/fontbakery/reporters/__init__.py | 1 | 4250 | """
Separation of Concerns Disclaimer:
While created specifically for checking fonts and font-families this
module has no domain knowledge about fonts. It can be used for any kind
of (document) checking. Please keep it so. It will be valuable for other
domains as well.
Domain specific knowledge should be encoded only i... | apache-2.0 | 3,269,233,457,621,858,000 | 31.442748 | 86 | 0.567294 | false | 4.408714 | false | false | false |
sventech/YAK-server | test_project/test_app/tests/test_social.py | 1 | 10812 | from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from test_project.test_app.models import Post
from test_project.test_app.tests.factories import UserFactory, PostFactory, CommentFactory... | mit | 1,084,889,553,242,041,300 | 46.213974 | 120 | 0.654458 | false | 3.728276 | true | false | false |
blueshed/blueshed-py | src/blueshed/handlers/basic_auth.py | 1 | 1716 | '''
Created on 30 Jan 2014
@author: peterb
'''
import base64
import logging
class BasicAuthMixin(object):
"""
BasicAuthMixin
"""
def _request_auth(self, realm):
if self._headers_written: raise Exception('headers have already been written')
self.set_status(401)
... | mit | -6,292,737,734,026,273,000 | 29.642857 | 86 | 0.578089 | false | 4.600536 | false | false | false |
victor-rene/kivy-gamelib | stickman/bone.py | 1 | 2072 | import math
from kivy.graphics.context_instructions import PopMatrix, PushMatrix, Rotate
from kivy.properties import NumericProperty
from kivy.uix.image import Image
class Bone(Image):
angle = NumericProperty()
def __init__(self, **kw):
super(Bone, self).__init__(**kw)
self.name = kw['name'] if 'name' ... | mit | -4,379,856,465,922,003,000 | 28.197183 | 87 | 0.629826 | false | 3.283677 | false | false | false |
zsjohny/jumpserver | apps/assets/serializers/asset.py | 1 | 6406 | # -*- coding: utf-8 -*-
#
from rest_framework import serializers
from django.db.models import Prefetch, F
from django.utils.translation import ugettext_lazy as _
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from common.serializers import AdaptedBulkListSerializer
from ..models import Asset, Node... | gpl-2.0 | 9,099,904,642,541,609,000 | 33.695652 | 82 | 0.602287 | false | 4.017621 | false | false | false |
lmazuel/azure-sdk-for-python | azure-mgmt-commerce/azure/mgmt/commerce/models/recurring_charge.py | 1 | 1457 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit | -3,596,932,056,541,768,000 | 34.536585 | 76 | 0.599176 | false | 4.260234 | false | false | false |
js850/PyGMIN | examples/gui/NewLJ.py | 1 | 3256 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'NewLJ.ui'
#
# Created: Thu May 10 03:10:06 2012
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribute... | gpl-3.0 | -8,122,948,593,237,993,000 | 53.266667 | 156 | 0.722052 | false | 3.786047 | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.