text stringlengths 0 1.05M | meta dict |
|---|---|
# BlockStore: a helper class that keeps a map of blocks and implements
# helper functions for responding to getheaders and getdata,
# and for constructing a getheaders message
#
from mininode import CBlock, CBlockHeader, CBlockLocator, CTransaction, msg_block, msg_headers, msg_tx
import sys
im... | {
"repo_name": "litecoinz-project/litecoinz",
"path": "qa/rpc-tests/test_framework/blockstore.py",
"copies": "2",
"size": "4201",
"license": "mit",
"hash": 656634468072498800,
"line_mean": 31.3153846154,
"line_max": 102,
"alpha_frac": 0.5689121638,
"autogenerated": false,
"ratio": 4.10654936461388... |
# blockstore: a helper class that keeps a map of blocks and implements
# helper functions for responding to getheaders and getdata,
# and for constructing a getheaders message
#
from mininode import *
import dbm
class blockstore(object):
def __init__(self, datadir):
self.blockdb = ... | {
"repo_name": "moorecoin/MooreCoinMiningAlgorithm",
"path": "qa/rpc-tests/test_framework/blockstore.py",
"copies": "1",
"size": "4096",
"license": "mit",
"hash": 1206755365384665000,
"line_mean": 31.2519685039,
"line_max": 77,
"alpha_frac": 0.5615234375,
"autogenerated": false,
"ratio": 4.1083249... |
# BlockStore: a helper class that keeps a map of blocks and implements
# helper functions for responding to getheaders and getdata,
# and for constructing a getheaders message
#
from mininode import *
import dbm
class BlockStore(object):
def __init__(self, datadir):
self.blockDB = ... | {
"repo_name": "wastholm/bitcoin",
"path": "qa/rpc-tests/test_framework/blockstore.py",
"copies": "95",
"size": "4447",
"license": "mit",
"hash": -1135633327747715500,
"line_mean": 31.2246376812,
"line_max": 77,
"alpha_frac": 0.5664492917,
"autogenerated": false,
"ratio": 4.121408711770157,
"con... |
"""BlocksWorld domain, stacking of blocks to form a tower."""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
from built... | {
"repo_name": "rlpy/rlpy",
"path": "rlpy/Domains/BlocksWorld.py",
"copies": "1",
"size": "9535",
"license": "bsd-3-clause",
"hash": -7335342165435674000,
"line_mean": 36.6877470356,
"line_max": 125,
"alpha_frac": 0.5660199266,
"autogenerated": false,
"ratio": 3.5738380809595203,
"config_test": ... |
"""BlocksWorld domain, stacking of blocks to form a tower."""
from .Domain import Domain
from rlpy.Tools import id2vec, vec2id, findElemArray1D
from rlpy.Tools import nchoosek, factorial, findElemArray2D, plt, FONTSIZE
import numpy as np
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
__credits__ = ["A... | {
"repo_name": "MDPvis/rlpy",
"path": "rlpy/Domains/BlocksWorld.py",
"copies": "4",
"size": "9124",
"license": "bsd-3-clause",
"hash": -8792643293909470000,
"line_mean": 36.7024793388,
"line_max": 125,
"alpha_frac": 0.5583077598,
"autogenerated": false,
"ratio": 3.5433009708737866,
"config_test"... |
BLOCK_TABLE_COLUMNS = {
"height": "INTEGER PRIMARY KEY",
"timestamp": "TIMESTAMP",
"txVolume": "NUMERIC",
"txCount": "INTEGER",
"generatedCoins": "NUMERIC",
"fees": "NUMERIC",
"difficulty": "NUMERIC",
}
class IStorage(object):
def getBlockHeight(self):
return 0
def storeBlock(self, block):
return
clas... | {
"repo_name": "whateverpal/coinmetrics-tools",
"path": "coincrawler/blocks/storage.py",
"copies": "1",
"size": "1329",
"license": "mit",
"hash": 1017737404195609100,
"line_mean": 27.2765957447,
"line_max": 132,
"alpha_frac": 0.6764484575,
"autogenerated": false,
"ratio": 3.134433962264151,
"con... |
'''BlockText, used to parse text with variable etc.
:copyright: 2015, Jeroen van der Heijden (Transceptor Technology)
'''
import re
from .constants import VAR_DOTS
class BlockText:
RE_VAR = re.compile('@([{VAR_DOTS}]+)(!?)'.format(VAR_DOTS=VAR_DOTS),
re.UNICODE)
def __init__(self, ... | {
"repo_name": "transceptor-technology/trender",
"path": "trender/block_text.py",
"copies": "1",
"size": "1588",
"license": "mit",
"hash": -3713339057923147000,
"line_mean": 31.4081632653,
"line_max": 76,
"alpha_frac": 0.5780856423,
"autogenerated": false,
"ratio": 4.020253164556962,
"config_tes... |
'''Block, the work horse for TRender.
:copyright: 2015, Jeroen van der Heijden (Transceptor Technology)
'''
from .block_text import BlockText
from .block_if import BlockIf
from .block_for import BlockFor
from .block_macro import BlockMacro
from .block_block import BlockBlock
from .block_paste import BlockPaste
from .... | {
"repo_name": "transceptor-technology/trender",
"path": "trender/block.py",
"copies": "1",
"size": "3958",
"license": "mit",
"hash": 7429978404491604000,
"line_mean": 30.664,
"line_max": 73,
"alpha_frac": 0.5368873168,
"autogenerated": false,
"ratio": 4.613053613053613,
"config_test": false,
... |
from mininode import *
from script import CScript, OP_TRUE, OP_CHECKSIG
# Create a block (with regtest difficulty)
def create_block(hashprev, coinbase, nTime=None):
block = CBlock()
if nTime is None:
import time
block.nTime = int(time.time()+600)
else:
block.nTime = nTime
block... | {
"repo_name": "accraze/bitcoin",
"path": "qa/rpc-tests/test_framework/blocktools.py",
"copies": "3",
"size": "2257",
"license": "mit",
"hash": 2322494159783441400,
"line_mean": 32.6865671642,
"line_max": 74,
"alpha_frac": 0.6765618077,
"autogenerated": false,
"ratio": 3.4510703363914375,
"confi... |
from .mininode import *
from .script import CScript, OP_TRUE, OP_CHECKSIG
# Create a block (with regtest difficulty)
def create_block(hashprev, coinbase, nTime=None):
block = CBlock()
if nTime is None:
import time
block.nTime = int(time.time()+600)
else:
block.nTime = nTime
blo... | {
"repo_name": "jimmykiselak/lbrycrd",
"path": "qa/rpc-tests/test_framework/blocktools.py",
"copies": "5",
"size": "2260",
"license": "mit",
"hash": -7560527939308859000,
"line_mean": 32.7313432836,
"line_max": 74,
"alpha_frac": 0.6761061947,
"autogenerated": false,
"ratio": 3.4346504559270516,
... |
from mininode import *
from script import CScript, OP_TRUE, OP_CHECKSIG
# Create a block (with regtest difficulty)
def create_block(hashprev, coinbase, nTime=None):
block = CBlock()
if nTime is None:
import time
block.nTime = int(time.time()+600)
else:
block.nTime = nTime
block... | {
"repo_name": "dragosbdi/bitcredit-2.0",
"path": "qa/rpc-tests/test_framework/blocktools.py",
"copies": "1",
"size": "2259",
"license": "mit",
"hash": -3342734585578012000,
"line_mean": 32.7164179104,
"line_max": 74,
"alpha_frac": 0.6768481629,
"autogenerated": false,
"ratio": 3.448854961832061,
... |
# blocktools.py - utilities for manipulating blocks and transactions
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from mininode import CBlock, CTransaction, CTxIn, CTxOut, COutPoint
from script import CScript, OP_0, OP_... | {
"repo_name": "litecoinz-project/litecoinz",
"path": "qa/rpc-tests/test_framework/blocktools.py",
"copies": "1",
"size": "2692",
"license": "mit",
"hash": 5909946532159944,
"line_mean": 33.5128205128,
"line_max": 78,
"alpha_frac": 0.6515601783,
"autogenerated": false,
"ratio": 3.2472858866103738,... |
# blocktools.py - utilities for manipulating blocks and transactions
#
# distributed under the mit/x11 software license, see the accompanying
# file copying or http://www.opensource.org/licenses/mit-license.php.
#
from mininode import *
from script import cscript, cscriptop
# create a block (with regtest difficulty)
... | {
"repo_name": "moorecoin/MooreCoinMiningAlgorithm",
"path": "qa/rpc-tests/test_framework/blocktools.py",
"copies": "1",
"size": "2057",
"license": "mit",
"hash": -8837943869576395000,
"line_mean": 30.6461538462,
"line_max": 84,
"alpha_frac": 0.6771998055,
"autogenerated": false,
"ratio": 3.457142... |
# blocktools.py - utilities for manipulating blocks and transactions
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from mininode import *
from script import CScript, CScriptOp
# Create a block (with regtest difficulty)
... | {
"repo_name": "40thoughts/Coin-QualCoin",
"path": "qa/rpc-tests/test_framework/blocktools.py",
"copies": "5",
"size": "2232",
"license": "mit",
"hash": 2256281057569599500,
"line_mean": 30.8857142857,
"line_max": 84,
"alpha_frac": 0.6787634409,
"autogenerated": false,
"ratio": 3.4766355140186915,... |
# blocktwin.py 26/08/2014 D.J.Whale
#
# An algorithm for turning a twitter handle into a minecraft block
# type.
#
# @MartinOHanlon has been pretty systematic in working out all the
# extraData values on all platforms, however if there are any missing
# we don't want to have to re-sequence this list. To protect again... | {
"repo_name": "whaleygeek/mcpi-blocktwin",
"path": "blocktwin.py",
"copies": "1",
"size": "2735",
"license": "mit",
"hash": -8976153714298919000,
"line_mean": 28.4086021505,
"line_max": 69,
"alpha_frac": 0.6943327239,
"autogenerated": false,
"ratio": 3.435929648241206,
"config_test": false,
"... |
# Bloco de notas
option = 0
notas = [0] * 100
#--------------------------------------------------------------------
# Cria o menu principal
def menu():
print("Informe a opcao desejada\n")
print("1: Cadastrar nova nota")
print("2: Buscar nota")
print("3: Apagar nota")
print("4: Total de notas")
p... | {
"repo_name": "GlauberGoncalves/Python",
"path": "Bloco de Notas/notas.py",
"copies": "1",
"size": "2725",
"license": "mit",
"hash": -8770407912909923000,
"line_mean": 29.9659090909,
"line_max": 72,
"alpha_frac": 0.3682085169,
"autogenerated": false,
"ratio": 3.9478260869565216,
"config_test": ... |
"""blog01 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"repo_name": "bosichong/17python.com",
"path": "Django/blog01/blog01/urls.py",
"copies": "1",
"size": "1256",
"license": "apache-2.0",
"hash": -174651617603766750,
"line_mean": 37.3225806452,
"line_max": 85,
"alpha_frac": 0.6902356902,
"autogenerated": false,
"ratio": 3.101827676240209,
"confi... |
"""blogadmin URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | {
"repo_name": "kyunooh/JellyBlog",
"path": "blogadmin/urls.py",
"copies": "1",
"size": "1434",
"license": "apache-2.0",
"hash": -7056659113350365000,
"line_mean": 29.3913043478,
"line_max": 77,
"alpha_frac": 0.7045779685,
"autogenerated": false,
"ratio": 3.12751677852349,
"config_test": false,
... |
"""blog_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "Satchitananda/django-simple-blog",
"path": "blog_app/urls.py",
"copies": "1",
"size": "1201",
"license": "mit",
"hash": 3605670576553503000,
"line_mean": 41.8928571429,
"line_max": 81,
"alpha_frac": 0.670274771,
"autogenerated": false,
"ratio": 3.2635869565217392,
"config_test": ... |
"""BlogApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"repo_name": "disrupticons/django-blog",
"path": "BlogApp/urls.py",
"copies": "1",
"size": "1490",
"license": "mit",
"hash": -6524911973756714000,
"line_mean": 38.2105263158,
"line_max": 77,
"alpha_frac": 0.7,
"autogenerated": false,
"ratio": 3.5141509433962264,
"config_test": false,
"has_no... |
"""blog_cms URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "pycircle/blog_django",
"path": "src/blog_cms/urls.py",
"copies": "1",
"size": "1185",
"license": "mit",
"hash": 5702451080224518000,
"line_mean": 39.8620689655,
"line_max": 111,
"alpha_frac": 0.7223628692,
"autogenerated": false,
"ratio": 3.623853211009174,
"config_test": false,
... |
"""blog_django URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | {
"repo_name": "marthaurion/blog_django",
"path": "blog_django/urls.py",
"copies": "1",
"size": "2862",
"license": "mit",
"hash": 5656907280253817000,
"line_mean": 43.734375,
"line_max": 127,
"alpha_frac": 0.7040531097,
"autogenerated": false,
"ratio": 3.6273764258555135,
"config_test": false,
... |
# blog.forms
# DJANGO
from django import forms
# CRISPY
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (
Layout,
Field,
Fieldset,
Button,
ButtonHolder,
Submit,
Div,
HTML
)
# BLOG
from .models import BlogItem, Theme
class BlogItemForm(forms.ModelForm):
... | {
"repo_name": "valuesandvalue/valuesandvalue",
"path": "vavs_project/blog/forms.py",
"copies": "1",
"size": "2921",
"license": "mit",
"hash": -9130997865531184000,
"line_mean": 33.3647058824,
"line_max": 86,
"alpha_frac": 0.5333789798,
"autogenerated": false,
"ratio": 4.1315417256011315,
"confi... |
"""Blogger to Zinnia command module
Based on Elijah Rutschman's code"""
import sys
from getpass import getpass
from datetime import datetime
from optparse import make_option
from django.conf import settings
from django.utils import timezone
from django.utils.encoding import smart_str
from django.contrib.sites.models i... | {
"repo_name": "westinedu/newertrends",
"path": "zinnia/management/commands/blogger2zinnia.py",
"copies": "2",
"size": "9696",
"license": "bsd-3-clause",
"hash": -4943784512382811000,
"line_mean": 36.2923076923,
"line_max": 79,
"alpha_frac": 0.5767326733,
"autogenerated": false,
"ratio": 4.2119895... |
"""Blogger to Zinnia command module
Based on Elijah Rutschman's code"""
import sys
from getpass import getpass
from datetime import datetime
from optparse import make_option
from django.utils.encoding import smart_str
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.... | {
"repo_name": "jfdsmit/django-blog-zinnia",
"path": "zinnia/management/commands/blogger2zinnia.py",
"copies": "1",
"size": "9496",
"license": "bsd-3-clause",
"hash": 624601284514024400,
"line_mean": 36.3858267717,
"line_max": 79,
"alpha_frac": 0.5739258635,
"autogenerated": false,
"ratio": 4.2279... |
"""Blogger to Zinnia command module"""
# based on wp2zinnia.py
import sys
from datetime import datetime
from optparse import make_option
from gdata import service as gdata_service
from django.utils.html import strip_tags
from django.db.utils import IntegrityError
from django.utils.encoding import smart_str
from djan... | {
"repo_name": "elijahr/blogger2zinnia",
"path": "blogger2zinnia.py",
"copies": "1",
"size": "9633",
"license": "bsd-3-clause",
"hash": -8606921226663290000,
"line_mean": 36.9251968504,
"line_max": 104,
"alpha_frac": 0.5853835773,
"autogenerated": false,
"ratio": 4.173743500866551,
"config_test"... |
"""blogger URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "rocity/blogger",
"path": "blogger/urls.py",
"copies": "1",
"size": "1277",
"license": "mit",
"hash": 1676067695337430000,
"line_mean": 35.4857142857,
"line_max": 91,
"alpha_frac": 0.7110415035,
"autogenerated": false,
"ratio": 3.4986301369863013,
"config_test": false,
"has_no_k... |
"""Blogger v2 GData API OAuth drop-in.
Blogger API docs:
https://developers.google.com/blogger/docs/2.0/developers_guide_protocol
Python GData API docs:
http://gdata-python-client.googlecode.com/hg/pydocs/gdata.blogger.data.html
Uses google-api-python-client to auth via OAuth 2. This describes how to get
gdata-pytho... | {
"repo_name": "kylewm/oauth-dropins",
"path": "blogger_v2.py",
"copies": "1",
"size": "7667",
"license": "unlicense",
"hash": 3005171969362424000,
"line_mean": 33.536036036,
"line_max": 102,
"alpha_frac": 0.6764053737,
"autogenerated": false,
"ratio": 3.8488955823293174,
"config_test": false,
... |
"""blogghar URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "v1k45/blogghar",
"path": "blogghar/urls.py",
"copies": "1",
"size": "1270",
"license": "mit",
"hash": 848520504010550700,
"line_mean": 39.9677419355,
"line_max": 88,
"alpha_frac": 0.6976377953,
"autogenerated": false,
"ratio": 3.5376044568245124,
"config_test": false,
"has_no_k... |
"""Blogging module for bottle.py, using Redis as data store."""
import os
import logging
from math import ceil
from pprint import pformat
import bottle
from bottle import BaseTemplate, Jinja2Template
from bottle import jinja2_template as template
import redis
import arrow
from faker import Factory
from slugify import ... | {
"repo_name": "dangayle/Redis-Blog",
"path": "blog/index.py",
"copies": "2",
"size": "4486",
"license": "mit",
"hash": -6910669236343748000,
"line_mean": 26.3536585366,
"line_max": 88,
"alpha_frac": 0.6310744539,
"autogenerated": false,
"ratio": 3.3131462333825703,
"config_test": false,
"has_... |
# blog.management.commands.blogging
# DJANGO
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand, CommandError
# BLOG
from blog.models import BlogCategory, Theme
class Command(BaseCommand):
help = 'Commands for managing blog.'
... | {
"repo_name": "valuesandvalue/valuesandvalue",
"path": "vavs_project/blog/management/commands/blogging.py",
"copies": "1",
"size": "1447",
"license": "mit",
"hash": -3187704131709692000,
"line_mean": 27.94,
"line_max": 73,
"alpha_frac": 0.5362819627,
"autogenerated": false,
"ratio": 4.30654761904... |
"""Blog models."""
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.conf import settings
from django.utils.timezone import now
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
... | {
"repo_name": "gilmrjc/djangopress",
"path": "djangopress/blog/models.py",
"copies": "1",
"size": "2627",
"license": "mit",
"hash": 1510226872158018300,
"line_mean": 33.5657894737,
"line_max": 70,
"alpha_frac": 0.5481537876,
"autogenerated": false,
"ratio": 4.616871704745167,
"config_test": fal... |
"""Blog models."""
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.conf import settings
from django.db import models
from arpegio.core.models import ContentMixin, Timestampable
from .managers import PostManager
class Post(ContentMixin, # pylint: disable=model-missin... | {
"repo_name": "arpegio-dj/arpegio",
"path": "arpegio/blog/models.py",
"copies": "1",
"size": "1334",
"license": "bsd-3-clause",
"hash": 6158952328589942000,
"line_mean": 31.5365853659,
"line_max": 67,
"alpha_frac": 0.5442278861,
"autogenerated": false,
"ratio": 4.680701754385965,
"config_test":... |
"""
Models for our blog pages
"""
##########################################################################
## Imports
##########################################################################
from django.db import models
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, Page... | {
"repo_name": "bbengfort/bengfort.com",
"path": "blog/models.py",
"copies": "1",
"size": "6718",
"license": "apache-2.0",
"hash": 24405752448036480,
"line_mean": 29.9585253456,
"line_max": 92,
"alpha_frac": 0.5963084251,
"autogenerated": false,
"ratio": 4.284438775510204,
"config_test": false,
... |
# blog.models
# DJANGO
from django.db import models
# MARKDOWN
import markdown
# TAGGIT
from taggit.managers import TaggableManager
############
# UTILS
############
def _raw_to_html(raw):
"""Converts raw markdown to HTML."""
return markdown.markdown(raw, safe_mode='escape')
############
# CLASSES
########... | {
"repo_name": "valuesandvalue/valuesandvalue",
"path": "vavs_project/blog/models.py",
"copies": "1",
"size": "2631",
"license": "mit",
"hash": -8873754411111054000,
"line_mean": 26.6947368421,
"line_max": 69,
"alpha_frac": 0.5902698594,
"autogenerated": false,
"ratio": 3.9035608308605343,
"conf... |
"""Blog post controller."""
from slugify import slugify
from flask import (
current_app,
redirect,
url_for,
render_template,
flash,
request,
abort,
Blueprint
)
from flask_login import login_required, current_user
from yapper.lib.decorators import profile
from ..user.decorators import p... | {
"repo_name": "brijeshb42/yapper",
"path": "yapper/blueprints/blog/controllers.py",
"copies": "1",
"size": "3740",
"license": "mit",
"hash": -5674024889663937000,
"line_mean": 25.524822695,
"line_max": 74,
"alpha_frac": 0.6085561497,
"autogenerated": false,
"ratio": 3.5517568850902186,
"config_... |
# blog.py - controller
# -*- coding: utf-8 -*-
# imports
from flask import Flask, render_template, request, session, \
flash, redirect, url_for, g
import sqlite3
from functools import wraps
# configuration
DATABASE = 'blog.db'
USERNAME = 'admin'
PASSWORD = 'test'
SECRET_KEY = u'zbu#<)sA6qp<=Swr!§h?qCVs5'
app = F... | {
"repo_name": "mjochum64/flask-blog",
"path": "blog.py",
"copies": "1",
"size": "2302",
"license": "mit",
"hash": -5949677750554455000,
"line_mean": 27.7625,
"line_max": 71,
"alpha_frac": 0.6088657106,
"autogenerated": false,
"ratio": 3.5841121495327104,
"config_test": true,
"has_no_keywords"... |
# blog.py - controller
from functools import wraps
from flask import Flask, render_template, request, session, \
flash, redirect, url_for, g
import sqlite3
import os
#config
DATABASE = 'blog.db'
USERNAME = 'admin'
PASSWORD = 'admin'
SECRET_KEY = "hard_to_guess"
app = Flask(__name__)
# pulls in app configuration by ... | {
"repo_name": "r2k0/flask-apps",
"path": "blog/blog.py",
"copies": "1",
"size": "1683",
"license": "mit",
"hash": 5473931498633244000,
"line_mean": 25.7142857143,
"line_max": 67,
"alpha_frac": 0.6232917409,
"autogenerated": false,
"ratio": 3.7820224719101123,
"config_test": true,
"has_no_keyw... |
# blog/rpc/metaweblog.py
# Carson Gee
# 2010 July 16
# http://carsongee.com
#
# Adapted from http://www.allyourpixel.com/post/metaweblog-38-django/
#
# Modifications made:
# Added proper authentication and authorization.
# Added newMediaObject implementation
# Made the getCategories call right. The returned st... | {
"repo_name": "nicholasstudt/django-blog",
"path": "blog/rpc/metaweblog.py",
"copies": "1",
"size": "13272",
"license": "bsd-3-clause",
"hash": 199987761644042880,
"line_mean": 27.358974359,
"line_max": 104,
"alpha_frac": 0.6152802893,
"autogenerated": false,
"ratio": 3.880701754385965,
"config... |
# blog/rpc/xmlrpc.py
# Carson Gee
# 2010 July 13
# http://carsongee.com
#
# based on Greg Abbas' adaptation of Amit Upadhyay's xmlrpc implementation
# http://www.allyourpixel.com/site_media/src/xmlrpc.py.txt
# http://nerdierthanthou.nfshost.com/2005/09/xmlrpc-support-for-django.html
#
# My modifications include:
#
# ... | {
"repo_name": "nicholasstudt/django-blog",
"path": "blog/rpc/xmlrpc.py",
"copies": "1",
"size": "5882",
"license": "bsd-3-clause",
"hash": 7505215388909040000,
"line_mean": 33.6,
"line_max": 101,
"alpha_frac": 0.6014960898,
"autogenerated": false,
"ratio": 4.321822189566495,
"config_test": fals... |
"""blogsite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... | {
"repo_name": "ch1huizong/dj",
"path": "blogsite/blogsite/urls.py",
"copies": "1",
"size": "1061",
"license": "unlicense",
"hash": 265922498987218700,
"line_mean": 33.2258064516,
"line_max": 77,
"alpha_frac": 0.7031102733,
"autogenerated": false,
"ratio": 3.7097902097902096,
"config_test": fals... |
"""blogs URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | {
"repo_name": "Spazzy757/Blog",
"path": "blogs/urls.py",
"copies": "1",
"size": "1103",
"license": "mit",
"hash": 5963786555602664000,
"line_mean": 37.0344827586,
"line_max": 79,
"alpha_frac": 0.7017225748,
"autogenerated": false,
"ratio": 3.4685534591194966,
"config_test": false,
"has_no_key... |
# blog.templatetags.blog_tags
# DJANGO
from django import template
from django.template.defaultfilters import stringfilter
from django.template.loader import render_to_string
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
# PREPARATION
register = template.Library()
###... | {
"repo_name": "valuesandvalue/valuesandvalue",
"path": "vavs_project/blog/templatetags/blog_tags.py",
"copies": "1",
"size": "3649",
"license": "mit",
"hash": -3243420097189096400,
"line_mean": 36.618556701,
"line_max": 91,
"alpha_frac": 0.5900246643,
"autogenerated": false,
"ratio": 3.8249475890... |
"""blogアプリで主に使用するフィルタ・タグ
by_the_timeタグ
人に優しい表現で、文字列を返す(n時間前)
<span class="badge badge-danger badge-pill">{% by_the_time recomment.created_at %}</span>
のようにして使います。
url_replaceタグ
キーワード検索をした際等の、他GETパラメータと?page=のページングを両立させる場合に使います。
<a href="?{% url_replace request 'page' page_obj.previous_page_number %}" aria-label="Pre... | {
"repo_name": "naritotakizawa/django-torina-blog",
"path": "blog/templatetags/blogfilter/__init__.py",
"copies": "1",
"size": "2060",
"license": "mit",
"hash": 4194115001791497000,
"line_mean": 24.935483871,
"line_max": 96,
"alpha_frac": 0.6927860697,
"autogenerated": false,
"ratio": 2.1583892617... |
"""blogフィルター内で呼び出される、特殊構文を評価するための仕組みを提供するモジュール"""
import html as html_module
import re
from blog.models import Image
class DefaultConverter:
"""[filter name]text[end]を適切なHTMLに変換するクラス
linebreaksbrで作られた改行(<br />)を利用しています。
テンプレートにて、{{ post.text | linebreaksbr | blog }} のような形になっていることを確認してください。
"""
sp... | {
"repo_name": "naritotakizawa/django-torina-blog",
"path": "blog/templatetags/blogfilter/filters.py",
"copies": "1",
"size": "5947",
"license": "mit",
"hash": 3679795017895798300,
"line_mean": 34.5874125874,
"line_max": 115,
"alpha_frac": 0.5268225585,
"autogenerated": false,
"ratio": 2.678421052... |
"""blogular URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "amaozhao/blogular",
"path": "blogular/urls.py",
"copies": "1",
"size": "1142",
"license": "bsd-3-clause",
"hash": -5025192882157316000,
"line_mean": 41.2962962963,
"line_max": 77,
"alpha_frac": 0.6987740806,
"autogenerated": false,
"ratio": 3.481707317073171,
"config_test": false... |
"""blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | {
"repo_name": "BumagniyPacket/django-blog-example",
"path": "web/blog/urls.py",
"copies": "1",
"size": "1101",
"license": "apache-2.0",
"hash": -1972413106048025900,
"line_mean": 38.3214285714,
"line_max": 82,
"alpha_frac": 0.7129881926,
"autogenerated": false,
"ratio": 3.6217105263157894,
"con... |
"""blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | {
"repo_name": "Imyukehan/DjangoBlog",
"path": "blog/urls.py",
"copies": "1",
"size": "1132",
"license": "mit",
"hash": -4968973069730604000,
"line_mean": 39.4285714286,
"line_max": 79,
"alpha_frac": 0.6590106007,
"autogenerated": false,
"ratio": 3.3294117647058825,
"config_test": false,
"has_... |
"""blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"repo_name": "wwj718/django-react-blog",
"path": "src/core/urls.py",
"copies": "1",
"size": "1087",
"license": "mit",
"hash": 4513704565182908000,
"line_mean": 32.96875,
"line_max": 80,
"alpha_frac": 0.6899724011,
"autogenerated": false,
"ratio": 3.483974358974359,
"config_test": false,
"has... |
"""blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"repo_name": "tyagow/AdvancingTheBlog",
"path": "src/blog/urls.py",
"copies": "1",
"size": "1450",
"license": "mit",
"hash": 8882833589184774000,
"line_mean": 36.2051282051,
"line_max": 82,
"alpha_frac": 0.6979310345,
"autogenerated": false,
"ratio": 3.580246913580247,
"config_test": false,
... |
"""Blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"repo_name": "vinitraj10/Django-React-Blog",
"path": "Backend/config/urls.py",
"copies": "1",
"size": "1110",
"license": "apache-2.0",
"hash": -4443992698000123400,
"line_mean": 37.275862069,
"line_max": 79,
"alpha_frac": 0.6837837838,
"autogenerated": false,
"ratio": 3.3944954128440368,
"conf... |
"""blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | {
"repo_name": "iharsh234/eElectronics",
"path": "blog/urls.py",
"copies": "1",
"size": "1540",
"license": "mit",
"hash": 8000523382049906000,
"line_mean": 38.5789473684,
"line_max": 82,
"alpha_frac": 0.6785714286,
"autogenerated": false,
"ratio": 3.5981308411214954,
"config_test": false,
"has... |
# blog.views
# DJANGO
from django.contrib import messages
from django.db.models import Max
from django.db.models import Q
from django.shortcuts import get_object_or_404
from django.views.generic.base import TemplateView
from django.views.generic import (
ArchiveIndexView,
CreateView,
UpdateView,
Deta... | {
"repo_name": "valuesandvalue/valuesandvalue",
"path": "vavs_project/blog/views.py",
"copies": "1",
"size": "4618",
"license": "mit",
"hash": 4653879814431560000,
"line_mean": 31.5211267606,
"line_max": 95,
"alpha_frac": 0.6437851884,
"autogenerated": false,
"ratio": 3.9776055124892333,
"config... |
""" Blood Alcohol Calculator """
import decimal
ALCOHOL_DISTRIBUTION_RATIO = {
'M': decimal.Decimal('0.73'),
'F': decimal.Decimal('0.66')
}
def ex17():
""" Prompt for alcohol consumed, sex, weight, and hours since last drink
Display the Blood Alcohol Content level
"""
while True:
try... | {
"repo_name": "brad-h/expy",
"path": "ExPy/ExPy/module17.py",
"copies": "1",
"size": "1288",
"license": "mit",
"hash": -1900849652001358300,
"line_mean": 28.2727272727,
"line_max": 97,
"alpha_frac": 0.5714285714,
"autogenerated": false,
"ratio": 3.926829268292683,
"config_test": false,
"has_n... |
#bloom filter probabilistic data structure
#Yang.Yu
#
import sys
sys.path.append('../..')
import math
import hashlib
from B.BitArray import bitarray
class BloomFilter(object):
FILE_FMT = b'<dQQQQ'
def __init__(self, capacity, error_rate=0.001):
"""Implements a space-efficient probabilistic data str... | {
"repo_name": "NiuXWolf/Introduction-to-Algorithms",
"path": "B/BloomFilter/bloom.py",
"copies": "1",
"size": "6917",
"license": "mit",
"hash": -5649942063254226000,
"line_mean": 35.4052631579,
"line_max": 83,
"alpha_frac": 0.5739482435,
"autogenerated": false,
"ratio": 3.8427777777777776,
"con... |
""" BloomFilter, python implementation
License: MIT
Author: Tyler Barrus (barrust@gmail.com)
"""
import math
import os
from abc import abstractmethod
from binascii import hexlify, unhexlify
from numbers import Number
from struct import Struct, calcsize, pack, unpack
from ..exceptions import InitializationErro... | {
"repo_name": "barrust/pyprobables",
"path": "probables/blooms/basebloom.py",
"copies": "1",
"size": "13921",
"license": "mit",
"hash": 1391863375464109600,
"line_mean": 33.1200980392,
"line_max": 102,
"alpha_frac": 0.5604482437,
"autogenerated": false,
"ratio": 3.912591343451377,
"config_test"... |
""" BloomFilter, python implementation
License: MIT
Author: Tyler Barrus (barrust@gmail.com)
URL: https://github.com/barrust/bloom
"""
import mmap
import os
from shutil import copyfile
from struct import calcsize, pack, unpack
from ..exceptions import InitializationError, NotSupportedError
from ..utilitie... | {
"repo_name": "barrust/pyprobables",
"path": "probables/blooms/bloom.py",
"copies": "1",
"size": "16858",
"license": "mit",
"hash": 1149602934788059400,
"line_mean": 35.9692982456,
"line_max": 110,
"alpha_frac": 0.5747419623,
"autogenerated": false,
"ratio": 4.170707570509649,
"config_test": fa... |
""" BloomFilter, python implementation
License: MIT
Author: Tyler Barrus (barrust@gmail.com)
URL: https://github.com/barrust/pyprobables
"""
import os
from struct import calcsize, pack, unpack
from ..exceptions import RotatingBloomFilterError
from ..utilities import is_valid_file
from .bloom import BloomF... | {
"repo_name": "barrust/pyprobables",
"path": "probables/blooms/expandingbloom.py",
"copies": "1",
"size": "11467",
"license": "mit",
"hash": -831887472772350200,
"line_mean": 34.9467084639,
"line_max": 80,
"alpha_frac": 0.5507979419,
"autogenerated": false,
"ratio": 4.229804500184434,
"config_t... |
# blowcake by sne11ius
# http://robotgame.org/viewrobot/3666
import rg, sys
class Robot:
def get_center(self):
centers = [(9, 4), (14, 9), (9, 14), (4, 9)]
# centers = [(9, 4), (9, 14)]
min_distance = sys.maxint
center = centers[0]
for c in centers:
dist = ... | {
"repo_name": "andrewgailey/robogen",
"path": "robogen/rgkit/backup bots/blowcake.py",
"copies": "1",
"size": "2003",
"license": "unlicense",
"hash": -623980120972980200,
"line_mean": 32.3833333333,
"line_max": 68,
"alpha_frac": 0.4987518722,
"autogenerated": false,
"ratio": 3.779245283018868,
... |
### BlowUpGraph.py
### Shaun Harker
### 2018-03-25
### MIT LICENSE
from pychomp import *
import datetime
import operator
import functools
from itertools import product
from math import log2
from DSGRN._dsgrn import *
class BlowupGraph:
def complex(self):
return self.dc
def diagram(self):
... | {
"repo_name": "shaunharker/DSGRN",
"path": "src/DSGRN/BlowupGraph.py",
"copies": "2",
"size": "29413",
"license": "mit",
"hash": 2538227614819266000,
"line_mean": 49.2786324786,
"line_max": 283,
"alpha_frac": 0.477951926,
"autogenerated": false,
"ratio": 3.5531529354916644,
"config_test": false... |
'''blox/attributes.py
Defines how Blox handles the setting of and definition of attributes
Copyright (C) 2015 Timothy Edmund Crosley
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 rest... | {
"repo_name": "timothycrosley/blox",
"path": "blox/attributes.py",
"copies": "1",
"size": "10634",
"license": "mit",
"hash": -2230189613477371100,
"line_mean": 34.095709571,
"line_max": 130,
"alpha_frac": 0.6239420726,
"autogenerated": false,
"ratio": 3.9783015338570893,
"config_test": false,
... |
'''blox/base.py
The base for all blox
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to u... | {
"repo_name": "timothycrosley/blox",
"path": "blox/base.py",
"copies": "1",
"size": "18618",
"license": "mit",
"hash": -471953491936168400,
"line_mean": 35.7944664032,
"line_max": 119,
"alpha_frac": 0.5854549361,
"autogenerated": false,
"ratio": 4.202708803611738,
"config_test": false,
"has_n... |
'''blox/builder.py
The Node Building Factory provides a mechanism for building any element the factory has knowledge of
simply by defining their names (as a string) and their main attributes.
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of th... | {
"repo_name": "timothycrosley/blox",
"path": "blox/builder.py",
"copies": "1",
"size": "3293",
"license": "mit",
"hash": 1152873426887877400,
"line_mean": 41.7662337662,
"line_max": 117,
"alpha_frac": 0.6954145156,
"autogenerated": false,
"ratio": 4.332894736842105,
"config_test": false,
"has... |
'''blox/compile.py
Creates an optimized programattically generated template from an html file
Copyright (C) 2015 Timothy Edmund Crosley
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 r... | {
"repo_name": "timothycrosley/blox",
"path": "blox/compile.py",
"copies": "1",
"size": "6903",
"license": "mit",
"hash": -4202336165208034000,
"line_mean": 40.8363636364,
"line_max": 116,
"alpha_frac": 0.626828915,
"autogenerated": false,
"ratio": 3.9199318568994888,
"config_test": false,
"ha... |
'''blox/dom.py
Defines the basic HTML DOM elements as blox
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limit... | {
"repo_name": "timothycrosley/blox",
"path": "blox/dom.py",
"copies": "1",
"size": "23929",
"license": "mit",
"hash": 5650895423646631000,
"line_mean": 21.3010251631,
"line_max": 112,
"alpha_frac": 0.6230933177,
"autogenerated": false,
"ratio": 3.8335469400833064,
"config_test": false,
"has_n... |
'''blox/text.py
Defines the basic Text rendering blox
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation... | {
"repo_name": "timothycrosley/blox",
"path": "blox/text.py",
"copies": "1",
"size": "2580",
"license": "mit",
"hash": 8049727188757933000,
"line_mean": 30.0843373494,
"line_max": 112,
"alpha_frac": 0.6751937984,
"autogenerated": false,
"ratio": 4.141252006420546,
"config_test": false,
"has_no... |
# BLS383 curve constants
from constants import *
SHA = 'sha256' # hash type to use with this curve
EFS = 48 # Elliptic curve Field Size in bytes
CurveType = WEIERSTRASS
SexticTwist = M_TYPE
SignOfX = POSITIVEX
PairingFriendly = BLS
x = 0x10008000001001200
if SignOfX == NEGATIVEX:
p = (x**6 + 2 * x**5 - 2 *... | {
"repo_name": "miracl/amcl",
"path": "version3/python/bls383.py",
"copies": "2",
"size": "1395",
"license": "apache-2.0",
"hash": -1881289243526222600,
"line_mean": 33.875,
"line_max": 104,
"alpha_frac": 0.8121863799,
"autogenerated": false,
"ratio": 1.9348127600554785,
"config_test": false,
... |
# BLS wrapper
import pyfits
import numpy
import scipy
import scipy.ndimage.filters
import pylab as p
from math import *
import bls
import filter
from numpy.random import normal
import atpy
import medium_filter
print 'Dan rocks! x2'
gap_days = 0.02043365 # long cadence
#ascii_DIR = '/Users/angusr/angusr/data2/SAMSI/... | {
"repo_name": "dfm/python-bls",
"path": "ruth_bls2.py",
"copies": "1",
"size": "13325",
"license": "mit",
"hash": -5902229125650286000,
"line_mean": 31.4209245742,
"line_max": 92,
"alpha_frac": 0.5377110694,
"autogenerated": false,
"ratio": 2.9176702430479526,
"config_test": false,
"has_no_ke... |
"""BlueprintCourses API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class BlueprintCoursesAPI(BaseCanvasAPI):
"""BlueprintCourses API V... | {
"repo_name": "tylerclair/py3canvas",
"path": "py3canvas/apis/blueprint_courses.py",
"copies": "1",
"size": "27909",
"license": "mit",
"hash": 7486438613109982000,
"line_mean": 38.5311614731,
"line_max": 217,
"alpha_frac": 0.6397219535,
"autogenerated": false,
"ratio": 4.267431192660551,
"confi... |
"""Blueprint file reading/parsing operations."""
import json
import re
import os.path
import csv
import buildconfig
import xls
import xlsx
from grid import Grid, GridLayer
from errors import FileError, ParametersError
def read_csv_file(filename):
"""
Reads a CSV document at filename, str... | {
"repo_name": "Modified-MW-DF/modified-MDF",
"path": "MWDF Project/MasterworkDwarfFortress/Utilities/Quickfort/src/qfconvert/filereader.py",
"copies": "3",
"size": "9168",
"license": "mit",
"hash": 8238143238789304000,
"line_mean": 28.357615894,
"line_max": 78,
"alpha_frac": 0.5541012216,
"autogene... |
"""Blueprint for connecting to Twitch API."""
from flask_dance.consumer import OAuth2ConsumerBlueprint
from flask_dance.consumer.requests import OAuth2Session
from functools import partial
from flask.globals import LocalProxy, _lookup_app_object
import os
from flask import _app_ctx_stack as stack
__maintainer__ = "... | {
"repo_name": "singingwolfboy/flask-dance",
"path": "flask_dance/contrib/twitch.py",
"copies": "1",
"size": "4308",
"license": "mit",
"hash": 3686338404760006700,
"line_mean": 37.8108108108,
"line_max": 129,
"alpha_frac": 0.6657381616,
"autogenerated": false,
"ratio": 3.7822651448639157,
"confi... |
"""Blueprint models."""
import asyncio
import logging
import pathlib
import shutil
from typing import Any, Dict, List, Optional, Union
from awesomeversion import AwesomeVersion
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant import loader
from homeassistant.const import (
... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/components/blueprint/models.py",
"copies": "2",
"size": "11233",
"license": "mit",
"hash": 3853986531273075000,
"line_mean": 31.5594202899,
"line_max": 92,
"alpha_frac": 0.6017982729,
"autogenerated": false,
"ratio": 4.37933723... |
"""Blueprint module associated with REST authentication endpoints."""
import flask
import flask_restful as rest
import flask_bcrypt as bcrypt
from flask import g
from flask import request
from flask_httpauth import HTTPBasicAuth
from functools import wraps
from wonk import err
from wonk.models.users import User
class... | {
"repo_name": "beylsp/wonk-server",
"path": "wonk/resources/v1/auth.py",
"copies": "1",
"size": "1356",
"license": "mit",
"hash": 2695897250606837000,
"line_mean": 26.6734693878,
"line_max": 72,
"alpha_frac": 0.657079646,
"autogenerated": false,
"ratio": 4.072072072072072,
"config_test": false,... |
"""Blueprint representing raw template module."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import hashlib
import json
import os
import sys
from jinja2 import Template
from ..util import parse_cloudformation_template
from ..exceptions import InvalidC... | {
"repo_name": "remind101/stacker",
"path": "stacker/blueprints/raw.py",
"copies": "1",
"size": "7383",
"license": "bsd-2-clause",
"hash": 6645219491489583000,
"line_mean": 32.2567567568,
"line_max": 113,
"alpha_frac": 0.6151970744,
"autogenerated": false,
"ratio": 4.76630083925113,
"config_test... |
"""blueprints.py
Routines for decoding, inspecting, manipulating, and re-encoding Factorio
blueprints.
"""
import base64
import collections
import json
import zlib
class EncodedBlob(object):
"""one Factorio json->gzip->base64 encoded blob"""
def __init__(self, data=None, version_byte=None):
self.dat... | {
"repo_name": "ericmburgess/python-factorio",
"path": "sources/factorio/blueprints.py",
"copies": "1",
"size": "5175",
"license": "mit",
"hash": 5420752987824376000,
"line_mean": 33.9662162162,
"line_max": 81,
"alpha_frac": 0.6179710145,
"autogenerated": false,
"ratio": 4.087677725118484,
"conf... |
blueprints = []
models = []
import action
models.extend(action.models)
blueprints.extend(action.blueprints)
import interaction
models.extend(interaction.models)
blueprints.extend(interaction.blueprints)
import menu
models.extend(menu.models)
blueprints.extend(menu.blueprints)
import operator
models.... | {
"repo_name": "scheunemann/KASPAR",
"path": "kasparGUI/Web/api/modules/__init__.py",
"copies": "1",
"size": "1411",
"license": "mit",
"hash": 4702474354669044000,
"line_mean": 19.7076923077,
"line_max": 41,
"alpha_frac": 0.7434443657,
"autogenerated": false,
"ratio": 3.536340852130326,
"config_... |
# Bluesoxx Halloween Game
import time # module we can use to make game pause
###########
# DISPLAY #
###########
#
# This is a function we can use to write messages to the screen, for the player to see.
# We could just use print() and sleep() all over our code, but this way is less
# repetitive in terms of ty... | {
"repo_name": "BlueSoxx/bluesoxx.github.io",
"path": "code/game.py",
"copies": "1",
"size": "4564",
"license": "mit",
"hash": -2182178495068671700,
"line_mean": 46.5416666667,
"line_max": 120,
"alpha_frac": 0.713190184,
"autogenerated": false,
"ratio": 3.731807031888798,
"config_test": false,
... |
""" BluesteelLayout Controller file """
from django.core.paginator import Paginator
from app.logic.bluesteel.models.BluesteelLayoutModel import BluesteelLayoutEntry
from app.logic.bluesteel.models.BluesteelProjectModel import BluesteelProjectEntry
from app.logic.bluesteel.controllers.BluesteelProjectController import ... | {
"repo_name": "imvu/bluesteel",
"path": "app/logic/bluesteel/controllers/BluesteelLayoutController.py",
"copies": "1",
"size": "2843",
"license": "mit",
"hash": 8383872221447897000,
"line_mean": 36.4078947368,
"line_max": 97,
"alpha_frac": 0.664790714,
"autogenerated": false,
"ratio": 4.120289855... |
""" BlueSteelLayout model """
from django.db import models
from app.logic.bluesteel.models.BluesteelProjectModel import BluesteelProjectEntry
class BluesteelLayoutEntry(models.Model):
""" BlueSteel Layout """
name = models.CharField(default='', max_length=50)
active = models.BooleanField(default=False)
... | {
"repo_name": "imvu/bluesteel",
"path": "app/logic/bluesteel/models/BluesteelLayoutModel.py",
"copies": "1",
"size": "1828",
"license": "mit",
"hash": -4253997499526755300,
"line_mean": 34.1538461538,
"line_max": 96,
"alpha_frac": 0.6345733042,
"autogenerated": false,
"ratio": 3.7613168724279835,... |
""" BluesteelProject Controller file """
from django.core.paginator import Paginator
from app.logic.httpcommon import pag
from app.logic.bluesteel.models.BluesteelProjectModel import BluesteelProjectEntry
from app.logic.gitrepo.models.GitProjectModel import GitProjectEntry
from app.logic.gitrepo.controllers.GitControl... | {
"repo_name": "imvu/bluesteel",
"path": "app/logic/bluesteel/controllers/BluesteelProjectController.py",
"copies": "1",
"size": "6065",
"license": "mit",
"hash": -1322974424755437000,
"line_mean": 41.1180555556,
"line_max": 106,
"alpha_frac": 0.6755152514,
"autogenerated": false,
"ratio": 4.14275... |
""" Bluesteel Project Manager tests """
from django.test import TestCase
from app.logic.bluesteel.models.BluesteelLayoutModel import BluesteelLayoutEntry
from app.logic.bluesteel.models.BluesteelProjectModel import BluesteelProjectEntry
from app.logic.bluesteel.controllers.BluesteelProjectController import BluesteelPr... | {
"repo_name": "imvu/bluesteel",
"path": "app/logic/bluesteel/tests/tests_controller_BluesteelProjectController.py",
"copies": "1",
"size": "6155",
"license": "mit",
"hash": 1278301595353182200,
"line_mean": 58.1826923077,
"line_max": 140,
"alpha_frac": 0.7093419984,
"autogenerated": false,
"ratio... |
""" BlueSteelProject model """
from django.db import models
from django.db.models import signals
from django.dispatch.dispatcher import receiver
from app.logic.commandrepo.models.CommandGroupModel import CommandGroupEntry
from app.logic.gitrepo.controllers.GitController import GitController
class BluesteelProjectEntr... | {
"repo_name": "imvu/bluesteel",
"path": "app/logic/bluesteel/models/BluesteelProjectModel.py",
"copies": "1",
"size": "2573",
"license": "mit",
"hash": -8146207727433216000,
"line_mean": 41.8833333333,
"line_max": 110,
"alpha_frac": 0.689856199,
"autogenerated": false,
"ratio": 3.8402985074626868... |
""" Bluesteel Project tests """
from django.test import TestCase
from django.utils import timezone
from app.logic.bluesteel.models.BluesteelLayoutModel import BluesteelLayoutEntry
from app.logic.bluesteel.models.BluesteelProjectModel import BluesteelProjectEntry
from app.logic.gitrepo.models.GitProjectModel import Git... | {
"repo_name": "imvu/bluesteel",
"path": "app/logic/bluesteel/tests/tests_BluesteelProjectModel.py",
"copies": "1",
"size": "4234",
"license": "mit",
"hash": -8773385144241294000,
"line_mean": 40.1067961165,
"line_max": 242,
"alpha_frac": 0.6820973075,
"autogenerated": false,
"ratio": 3.7502214348... |
""" Bluesteel views functions """
from app.logic.bluesteel.models.BluesteelLayoutModel import BluesteelLayoutEntry
from app.logic.bluesteel.models.BluesteelProjectModel import BluesteelProjectEntry
from app.presenter.views.helpers import ViewUrlGenerator
from app.logic.httpcommon import res
def add_project_feed_url(r... | {
"repo_name": "imvu/bluesteel",
"path": "app/presenter/views/json/ViewJsonBluesteel.py",
"copies": "1",
"size": "2668",
"license": "mit",
"hash": -881817011304937000,
"line_mean": 36.0555555556,
"line_max": 115,
"alpha_frac": 0.6825337331,
"autogenerated": false,
"ratio": 3.595687331536388,
"co... |
__author__ = 'Murray Ireland'
# Load library functions
import time, os
# Make dummy monitor
os.environ['SDL_VIDEODRIVER'] = 'dummy'
import pygame
# Initialise
def Init():
pygame.init()
pygame.display.init()
pygame.display.set_mode((1, 1))
pygame.joystick.init()
# Number of joysticks available
... | {
"repo_name": "murrayireland/Rover-Code",
"path": "tests/RasPiRobot/BluetoothController.py",
"copies": "2",
"size": "1695",
"license": "mit",
"hash": 391777164405440000,
"line_mean": 25.0769230769,
"line_max": 48,
"alpha_frac": 0.6395280236,
"autogenerated": false,
"ratio": 3.076225045372051,
"... |
# Bluetooth light server
# B8:E8:56:25:C8:BF - tracer
# 00:11:22:98:76:54 - FeelTheSound
# 00:02:72:CB:C9:33 - FeelTheSound-2
#
# sudo hciconfig hci0 piscan
# /usr/bin/bluetooth-agent 0000 &
# sdptool add --channel=3 SP
import sys;
from FTSBluetoothComm import FTSBluetoothComm;
serverId = 0;
if(len(sys.argv) > 1):
... | {
"repo_name": "mprinc/FeelTheSound",
"path": "src/bts.py",
"copies": "1",
"size": "1599",
"license": "cc0-1.0",
"hash": -8059151657780734000,
"line_mean": 20.3333333333,
"line_max": 78,
"alpha_frac": 0.6572858036,
"autogenerated": false,
"ratio": 2.595779220779221,
"config_test": false,
"has_... |
# Bluetooth mode for PiRadio
# This mode enables the Bluetooth adaptor and displays metadata for the
# currently playing item.
#
# There is no option to pair devices at the moment. This may be added in later
# releases.
from subprocess import check_output
from threading import Thread
from time import sleep
import dbu... | {
"repo_name": "elParaguayo/PiRadio",
"path": "modes/bluetooth.py",
"copies": "1",
"size": "4531",
"license": "mit",
"hash": -2767877203639720000,
"line_mean": 29.4093959732,
"line_max": 80,
"alpha_frac": 0.5784595012,
"autogenerated": false,
"ratio": 4.331739961759082,
"config_test": false,
"... |
"""Bluetooth motion tracker module.
Copyright 2017 Mark Mitterdorfer
Class to read from a Bluetooth MPU6050 device.
Obtain acceleration, angular velocity, angle and temperature
"""
import threading
import struct
import bluetooth
class MotionTracker(object):
"""Class to track movement from MPU6050 Bluetooth devi... | {
"repo_name": "fundiZX48/pymotiontracker",
"path": "src/motiontracker.py",
"copies": "1",
"size": "5835",
"license": "mit",
"hash": 1756208912513624000,
"line_mean": 36.4038461538,
"line_max": 92,
"alpha_frac": 0.5011139674,
"autogenerated": false,
"ratio": 3.496105452366687,
"config_test": fal... |
import decode_beacon
import bluetooth._bluetooth as bluez
import struct
OGF_LE_CTL = 0x08
OCF_LE_SET_SCAN_ENABLE = 0x000C
try:
# Open the bluetooth device
sock = bluez.hci_open_dev(0)
print "BLE scan started"
except:
# Failed to open
sock = None
print "Failed to open BLE device."
if sock:
# We have d... | {
"repo_name": "xorbit/py-decode-beacon",
"path": "bluez_scan.py",
"copies": "1",
"size": "1186",
"license": "mit",
"hash": 6588319130637375000,
"line_mean": 27.2380952381,
"line_max": 71,
"alpha_frac": 0.7099494098,
"autogenerated": false,
"ratio": 2.784037558685446,
"config_test": false,
"ha... |
# BLVC Googlenet, model from the paper:
# "Going Deeper with Convolutions"
# Original source:
# https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet
# License: unrestricted use
# Download pretrained weights from:
# https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/blvc_googlenet.pkl
from lasagne... | {
"repo_name": "diogo149/Recipes",
"path": "modelzoo/googlenet.py",
"copies": "9",
"size": "4654",
"license": "mit",
"hash": 8475904192586513000,
"line_mean": 45.54,
"line_max": 81,
"alpha_frac": 0.5358831113,
"autogenerated": false,
"ratio": 3.397080291970803,
"config_test": false,
"has_no_ke... |
# BM25 implementation
import json
import math
import operator
from collections import defaultdict, OrderedDict, Counter
import sys
# index_file = 'index_json_dump.txt'
number_of_tokens_file = "number_of_tokens_json_dump"
# queries_file = 'queries.txt'
result_file = 'result.txt'
# load index and number of tokens
numb... | {
"repo_name": "utkjad/Information_Retrieval",
"path": "simple_search_engine/bm25.py",
"copies": "2",
"size": "2059",
"license": "mit",
"hash": -362222494181369860,
"line_mean": 26.8378378378,
"line_max": 99,
"alpha_frac": 0.6372025255,
"autogenerated": false,
"ratio": 2.7199471598414795,
"confi... |
# bmh.py
#
# An implementation of Boyer-Moore-Horspool string searching.
#
# This code is Public Domain.
# see: http://code.activestate.com/recipes/117223-boyer-moore-horspool-string-searching/
#
def BoyerMooreHorspool(pattern, text):
m = len(pattern)
n = len(text)
print '------------------------------... | {
"repo_name": "pabagan/Code-Library",
"path": "analisis-de-algoritmos/algoritmos/string_search-Boyer-Moore-Horspool.py",
"copies": "2",
"size": "2560",
"license": "mit",
"hash": -7134452964674030000,
"line_mean": 28.7674418605,
"line_max": 110,
"alpha_frac": 0.418359375,
"autogenerated": false,
"... |
""" BMI Calculator """
from tkinter import HORIZONTAL
import rx
import tkcomponents
def calculate_bmi(weight, height):
""" Given weight (pounds), height (inches)
Return BMI
"""
return (weight / (height * height)) * 703.
def bmi_recommendation(bmi):
"""Given a BMI, return a pair
(bool - True i... | {
"repo_name": "brad-h/expy",
"path": "ExPy/ExPy/module19.py",
"copies": "1",
"size": "2984",
"license": "mit",
"hash": -2107166513314412300,
"line_mean": 31.7912087912,
"line_max": 95,
"alpha_frac": 0.6276809651,
"autogenerated": false,
"ratio": 3.481913652275379,
"config_test": false,
"has_n... |
bmp_magic_a = 'BM'
jpg_magic_a = '\xFF\xD8\xFF\xE0'
jpg_magic_z = '\xFF\xD9'
def main():
welcome()
while True:
main_menu()
if main_query() == 1:
workspace()
else:
print
break
def welcome():
print
print ' Welcome to'
print 'FILE EXTRACTOR... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/456375_File_Extractor/recipe-456375.py",
"copies": "2",
"size": "5140",
"license": "mit",
"hash": 2685777591305945600,
"line_mean": 27.087431694,
"line_max": 68,
"alpha_frac": 0.4871595331,
"autogenerated": false,
"ratio": 3.94474290099769... |
"""bMud functions."""
beep = chr(7)
functions = dict() # All the loaded functions.
from twisted.internet import reactor
from wxgoodies import keys
from inspect import getdoc
from time import time
from datetime import timedelta
import logging, application, command_parser, os, os.path, triggers, config, wx,... | {
"repo_name": "chrisnorman7/mmc2",
"path": "functions.py",
"copies": "1",
"size": "5299",
"license": "mpl-2.0",
"hash": 6461257249204183000,
"line_mean": 24.3631840796,
"line_max": 128,
"alpha_frac": 0.6831477637,
"autogenerated": false,
"ratio": 3.8040201005025125,
"config_test": true,
"has_... |
##### bmutils.py
# This module provides a wrapper to the bmapi client which may (or
# may not) report the API data in a more user-friendly form.
import bmapi
import os
import json
SkillName = {
'+': 'Auxiliary',
'B': 'Berserk',
'b': 'Boom',
'c': 'Chance',
'D': 'Doppelganger',
'F': 'Fire',
'f': 'Focus',
... | {
"repo_name": "dwvanstone/buttonmen",
"path": "tools/api-client/python/lib/bmutils.py",
"copies": "1",
"size": "4545",
"license": "bsd-3-clause",
"hash": 3527516590813607000,
"line_mean": 31.2340425532,
"line_max": 81,
"alpha_frac": 0.6121012101,
"autogenerated": false,
"ratio": 3.337004405286343... |
bnone = [(9 * 18, 3 * 18), (10 * 18, 3 * 18), (11 * 18, 3 * 18)]
bleft = [(0, 0), (0, 18), (0, 2 * 18)]
bright = [(72, 0), (72, 18), (72, 18 * 2)]
bup = [(18, 0), (18 * 2, 0), (18 * 3, 0)]
bdown = [(18, 2 * 18), (18 * 2, 2 * 18), (18 * 3, 2 * 18)]
bcenter = [(18, 18), (2 * 18, 18), (3 * 18, 18)]
bleftstick = [(9 * 18, ... | {
"repo_name": "Berserker66/omnitool",
"path": "omnitool/blend.py",
"copies": "2",
"size": "2294",
"license": "mit",
"hash": -360879358579380740,
"line_mean": 25.9882352941,
"line_max": 68,
"alpha_frac": 0.4319965126,
"autogenerated": false,
"ratio": 2.273538156590684,
"config_test": false,
"h... |
''' bnpy module __init__ file
'''
import data
import distr
import util
import suffstats
import allocmodel
import obsmodel
from HModel import HModel
import ioutil
load_model = ioutil.ModelReader.load_model
save_model = ioutil.ModelWriter.save_model
import init
import learnalg
import Run
from Run import run
import o... | {
"repo_name": "daeilkim/refinery",
"path": "refinery/bnpy/bnpy-dev/bnpy/__init__.py",
"copies": "1",
"size": "2170",
"license": "mit",
"hash": 2274339005432844300,
"line_mean": 31.3880597015,
"line_max": 96,
"alpha_frac": 0.5847926267,
"autogenerated": false,
"ratio": 3.807017543859649,
"config... |
"""BN sample
"""
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# X = tf.placeholder(tf.float32)
X = tf.placeholder_with_default([[[1.]]], shape=[1,1,1], name="X")
fc_mean, fc_var = tf.nn.moments(X,axes=[0],) #Calculate mean and variance
shift = tf.Variable(tf.zeros([1]))
scale = tf.Varia... | {
"repo_name": "KarateJB/Python.Practice",
"path": "src/TensorFlow/venv/Lab/Tutorials/Sample/BN.py",
"copies": "1",
"size": "1590",
"license": "mit",
"hash": 5307776535570401000,
"line_mean": 30.8,
"line_max": 94,
"alpha_frac": 0.6471698113,
"autogenerated": false,
"ratio": 2.864864864864865,
"c... |
#Boa:Dialog:AboutDialog
import wx
def create(parent):
return AboutDialog(parent)
[wxID_ABOUTDIALOG, wxID_ABOUTDIALOGOK_BUTTON, wxID_ABOUTDIALOGSTATICTEXT2,
wxID_ABOUTDIALOGSTATICTEXT3, wxID_ABOUTDIALOGSTATICTEXT4,
wxID_ABOUTDIALOGTEXTCTRL1,
] = [wx.NewId() for _init_ctrls in range(6)]
class Abo... | {
"repo_name": "parsiya/malwareadventure",
"path": "PAWS/AboutDialog.py",
"copies": "1",
"size": "2872",
"license": "mit",
"hash": 5770158405099774000,
"line_mean": 42.1846153846,
"line_max": 80,
"alpha_frac": 0.6155988858,
"autogenerated": false,
"ratio": 3.1149674620390457,
"config_test": fals... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.