text stringlengths 0 1.05M | meta dict |
|---|---|
# Approximations to Poisson upper and lower limits
# presently only for 1-sigma confidence limits
# from Gehrels 1986.
# Could extend to general CI using Ebeling 2003/4 (astro-ph/0301285),
# which builds from Gehrels 1986.
import numpy as N
def upper_limit_1_sigma(n):
return (n+1.0)*(1.0 - 1.0/(9.0*(n+1.0)) + 1.0... | {
"repo_name": "bamford/astrobamf",
"path": "poisson.py",
"copies": "1",
"size": "1134",
"license": "mit",
"hash": 2309365434581297000,
"line_mean": 28.0769230769,
"line_max": 77,
"alpha_frac": 0.4920634921,
"autogenerated": false,
"ratio": 2.032258064516129,
"config_test": false,
"has_no_keyw... |
#!/apps/admin/tools.x86_64/python/2.7.3/bin/python
# Takes a path to a file, opens the file, parses the data into chunks, looks for duplicates, and prints those to a file.
#
#
#
import os
import sys
import sets
import argparse
from glob import glob
ap = argparse.ArgumentParser()
ap.add_argument("--files","-f",dest="fi... | {
"repo_name": "ixela/torque-duplicate-jobs",
"path": "find_duplicate_jobs.py",
"copies": "1",
"size": "2493",
"license": "mit",
"hash": -788278667127020700,
"line_mean": 30.5569620253,
"line_max": 178,
"alpha_frac": 0.6915363016,
"autogenerated": false,
"ratio": 3.3918367346938774,
"config_test... |
#!/apps/base/python3/bin/python3
'''Command line interface to the datastream and datastreamdiff review modules.
Provides a command line interface to the functionality inside of the
datastream and datastreamdiff modules, which writes the resulting json string
to the user's ncreview_web directory.
'''
import os
import ... | {
"repo_name": "CesiumLifeJacket/overwatch",
"path": "dummy_project/ncreview.py",
"copies": "1",
"size": "10643",
"license": "mit",
"hash": 7615076391447453000,
"line_mean": 36.3438596491,
"line_max": 124,
"alpha_frac": 0.633843841,
"autogenerated": false,
"ratio": 3.595608108108108,
"config_tes... |
# app/science.py
import os
import pandas as pd
import numpy as np
import random
import math
import itertools
from sklearn import svm
from flask import current_app
from app.data import db, query_to_list
from app.sensors.models import Experiment, Sensor
"""
Support vector machines (SVMs) are a set of supervised learn... | {
"repo_name": "ChristopherGS/sensor_readings",
"path": "app/science2.py",
"copies": "1",
"size": "9830",
"license": "bsd-3-clause",
"hash": 16390232753508896,
"line_mean": 31.8762541806,
"line_max": 179,
"alpha_frac": 0.6232960326,
"autogenerated": false,
"ratio": 3.012565124118909,
"config_tes... |
# app/science.py
import os
import pandas as pd
import numpy as np
import random
import math
from sklearn import svm
"""
Support vector machines (SVMs) are a set of supervised learning methods
used for classification, regression and outliers detection.
"""
_basedir = os.path.abspath(os.path.dirname(__file__))
UPLOA... | {
"repo_name": "ChristopherGS/sensor_readings",
"path": "app/science.py",
"copies": "1",
"size": "5247",
"license": "bsd-3-clause",
"hash": 2338509595643790300,
"line_mean": 25.3668341709,
"line_max": 109,
"alpha_frac": 0.6167333715,
"autogenerated": false,
"ratio": 3.4339005235602094,
"config_t... |
app_scope = scope.Scope()
app_scope['db_password'] = 'foobar'
app_scope['user'] = 'anon'
nested_user_scope = scope.Scope()
def handle_user():
current_scope = scope.get_current_scope()
# now inside a user session we might want
# to store some user data
current_scope['user'] = 'admin'
# and we stil... | {
"repo_name": "FlorianLudwig/scope",
"path": "doc/examples/nested.py",
"copies": "1",
"size": "1056",
"license": "apache-2.0",
"hash": -6705785039128514000,
"line_mean": 25.425,
"line_max": 70,
"alpha_frac": 0.6126893939,
"autogenerated": false,
"ratio": 3.6288659793814433,
"config_test": false... |
# app/scraper.py
import json
import logging
import urllib2
from datetime import datetime
from bs4 import BeautifulSoup
# from ufc.models import Fighter, Opponent
# from models import University, Course
# import processor
UNIVERSITY_URL = 'http://www.york.ac.uk/study/undergraduate/courses/all?level=postgraduate&q... | {
"repo_name": "ChristopherGS/1_app",
"path": "app/scraper.py",
"copies": "1",
"size": "2772",
"license": "bsd-3-clause",
"hash": 650274953189152600,
"line_mean": 36.9863013699,
"line_max": 135,
"alpha_frac": 0.6219336219,
"autogenerated": false,
"ratio": 3.681274900398406,
"config_test": false,... |
# app/seguimientos/forms.py
# coding: utf-8
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, HiddenField
from wtforms import DateField, SelectField
from wtforms.validators import DataRequired
from wtforms.widgets import TextArea
class SeguimientoForm(FlaskForm):
"""
Formulario pa... | {
"repo_name": "originaltebas/chmembers",
"path": "app/seguimientos/forms.py",
"copies": "1",
"size": "1228",
"license": "mit",
"hash": -5576548330953486000,
"line_mean": 28.2380952381,
"line_max": 64,
"alpha_frac": 0.5806188925,
"autogenerated": false,
"ratio": 3.7099697885196377,
"config_test"... |
# app/seguimientos/views.py
# coding: utf-8
from flask import flash, jsonify
from flask import redirect, render_template, url_for, request
from flask_login import current_user, login_required
from app.seguimientos import seguimientos
from app.seguimientos.forms import SeguimientoForm, ConsultaSegForm
from app import ... | {
"repo_name": "originaltebas/chmembers",
"path": "app/seguimientos/views.py",
"copies": "1",
"size": "7695",
"license": "mit",
"hash": 8449344635153801000,
"line_mean": 32.025751073,
"line_max": 79,
"alpha_frac": 0.5420402859,
"autogenerated": false,
"ratio": 3.4383378016085793,
"config_test": ... |
# app/server/__init__.py
#################
#### imports ####
#################
import os
from flask import Flask, render_template
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_debugtoolbar import DebugToolbarExtension
from flask_bootstrap import Bootstrap
from flask_sqlalchemy impo... | {
"repo_name": "samuelhwilliams/cryptracker-web",
"path": "app/server/__init__.py",
"copies": "1",
"size": "1883",
"license": "mit",
"hash": -7563355987272359000,
"line_mean": 19.6923076923,
"line_max": 79,
"alpha_frac": 0.6383430696,
"autogenerated": false,
"ratio": 3.684931506849315,
"config_t... |
# app/server/models.py
import enum
import datetime
from sqlalchemy import UniqueConstraint
from app.server import app, db, bcrypt
class User(db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
email = db.Column(db.String(255), unique=True, index=True, n... | {
"repo_name": "samuelhwilliams/cryptracker-web",
"path": "app/server/models.py",
"copies": "1",
"size": "4335",
"license": "mit",
"hash": 7975792705621883000,
"line_mean": 33.9596774194,
"line_max": 108,
"alpha_frac": 0.6620530565,
"autogenerated": false,
"ratio": 3.5737840065952184,
"config_te... |
# app/server/user/forms.py
from flask_login import current_user
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, DateTimeField, DecimalField, SelectField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import DataRequired, Email, Length, EqualTo, Optio... | {
"repo_name": "samuelhwilliams/cryptracker-web",
"path": "app/server/user/forms.py",
"copies": "1",
"size": "3054",
"license": "mit",
"hash": 176408980378696800,
"line_mean": 40.2702702703,
"line_max": 159,
"alpha_frac": 0.6299934512,
"autogenerated": false,
"ratio": 4.627272727272727,
"config_... |
# app/server/user/views.py
from flask import render_template, Blueprint, url_for, redirect, flash, request, abort
from flask_login import login_user, logout_user, login_required, current_user
from app.server import bcrypt, db
from app.server.models import User, Account, Transaction, Currency
from app.server.user.form... | {
"repo_name": "samuelhwilliams/cryptracker-web",
"path": "app/server/user/views.py",
"copies": "1",
"size": "4239",
"license": "mit",
"hash": 4774044470634473000,
"line_mean": 35.2307692308,
"line_max": 131,
"alpha_frac": 0.6109931588,
"autogenerated": false,
"ratio": 4.018009478672986,
"config... |
# AppSettings class - holds app settings for whatever app you desire.
#
# by Eron Hennessey
#
# for now, we use cPickle to store settings.
import os
import sys
import cPickle
class AppSettings:
"""Holds app settings and can also load and save them."""
def __init__(self, app_name):
"""Initialize the Ap... | {
"repo_name": "Abstrys/pyoculus",
"path": "abstrys/app_settings.py",
"copies": "1",
"size": "2282",
"license": "bsd-3-clause",
"hash": -5229093944531909000,
"line_mean": 31.1408450704,
"line_max": 78,
"alpha_frac": 0.5902716915,
"autogenerated": false,
"ratio": 4.17948717948718,
"config_test": ... |
"""App settings for Sana project.
This file contains the application configuration variables and should be
renamed to
local_settings.py
prior to filling in values. Once updated, enter the following from the mds
installation directory:
$> ./manage.py syncdb
This will require root privileges... | {
"repo_name": "dekatzenel/team-k",
"path": "mds/local_settings.py",
"copies": "2",
"size": "3799",
"license": "bsd-3-clause",
"hash": -1738444109961600000,
"line_mean": 27.3507462687,
"line_max": 94,
"alpha_frac": 0.6112134772,
"autogenerated": false,
"ratio": 3.329535495179667,
"config_test": ... |
"""apps/forms.py: """
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, \
TextField, TextAreaField, HiddenField
from wtforms.validators import DataRequired, InputRequired
from wtforms.validators import ValidationError
def bad_chars(form, string_field):
for c in r";'`":
if ... | {
"repo_name": "mckinziebrandon/DeepChatModels",
"path": "webpage/deepchat/main/forms.py",
"copies": "1",
"size": "1172",
"license": "mit",
"hash": -1041254498351788700,
"line_mean": 27.5853658537,
"line_max": 65,
"alpha_frac": 0.6672354949,
"autogenerated": false,
"ratio": 4.2773722627737225,
"... |
#!/apps/jasmin/jaspy/miniconda_envs/jaspy3.7/m3-4.6.14/envs/jaspy3.7-m3-4.6.14-r20200606/bin/python3
import os
import sys
import epr
import pandas as pd
import numpy as np
from src.ggf.detectors import ATXDetector, SLSDetector
import src.utils as utils
import src.config.filepaths as fp
def merge_hotspot_dataframes(... | {
"repo_name": "dabillox/kcl-globalgasflaring",
"path": "src/scripts/batch/flares.py",
"copies": "1",
"size": "5506",
"license": "mit",
"hash": -8415630570330784000,
"line_mean": 38.0496453901,
"line_max": 108,
"alpha_frac": 0.4673083908,
"autogenerated": false,
"ratio": 4.102831594634873,
"conf... |
"""apps module for the django_xmlrpc package
Authors::
Julien Fache
Credit must go to Brendan W. McAdams <brendan.mcadams@thewintergrp.com>, who
posted the original SimpleXMLRPCDispatcher to the Django wiki:
http://code.djangoproject.com/wiki/XML-RPC
New BSD License
===============
Copyright (c) 2007, Graham Bin... | {
"repo_name": "Fantomas42/django-xmlrpc",
"path": "django_xmlrpc/apps.py",
"copies": "1",
"size": "2110",
"license": "bsd-3-clause",
"hash": 3734042660691816400,
"line_mean": 41.2,
"line_max": 79,
"alpha_frac": 0.771563981,
"autogenerated": false,
"ratio": 4.5085470085470085,
"config_test": fal... |
"""
@author: mazhicheng
@file: cnblogs_spider.py
@time: 2017/8/9 14:35
"""
from scrapy.selector import Selector
from scrapy.spiders import CrawlSpider, Rule
from scrapy.utils.response import get_base_url
from scrapy.linkextractors import LinkExtractor
from cnblogs.items import *
class CnblogsSpider(CrawlSpider):
#... | {
"repo_name": "mazcheng/snippets",
"path": "spider/cnblogs/cnblogs/spiders/cnblogs_spider.py",
"copies": "2",
"size": "1517",
"license": "apache-2.0",
"hash": 1955075751307937000,
"line_mean": 28.1730769231,
"line_max": 73,
"alpha_frac": 0.686882004,
"autogenerated": false,
"ratio": 2.91170825335... |
"""
@author: mazhicheng
@file: cnnvd_spider.py
@time: 2017/8/16 18:21
"""
import re
import logging
from scrapy.selector import Selector
from scrapy.spiders import CrawlSpider, Rule
from scrapy.utils.response import get_base_url
from scrapy.linkextractors import LinkExtractor
from scrapy import Request
from cnnvd.item... | {
"repo_name": "mazcheng/snippets",
"path": "spider/cnnvd/cnnvd/spiders/cnnvd_spider.py",
"copies": "1",
"size": "7357",
"license": "apache-2.0",
"hash": -7421649497902887000,
"line_mean": 44.4534161491,
"line_max": 126,
"alpha_frac": 0.6647533142,
"autogenerated": false,
"ratio": 2.58825610187477... |
"""
@author: mazhicheng
@file: csdn_spider.py
@time: 2017/8/10 11:14
"""
import json
from scrapy.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.utils.response import get_base_url
from scrapy.linkextractors import LinkExtractor
from scrapy import Request, FormRequest
from csdn.items ... | {
"repo_name": "mazcheng/snippets",
"path": "spider/csdn/csdn/spiders/csdn_spider.py",
"copies": "1",
"size": "5623",
"license": "apache-2.0",
"hash": 6991924750987031000,
"line_mean": 34.5949367089,
"line_max": 139,
"alpha_frac": 0.6475191179,
"autogenerated": false,
"ratio": 2.838465421504291,
... |
"""App specific middleware"""
# Django imports
from django.views.defaults import page_not_found
from django.http import HttpResponseNotFound, HttpResponseForbidden, HttpResponseServerError
from django.template import loader
# Sekizai imports
from sekizai.context import SekizaiContext as Context
# app imports
from oweb.... | {
"repo_name": "Mischback/django-oweb",
"path": "oweb/middleware.py",
"copies": "1",
"size": "1486",
"license": "mit",
"hash": -6205983053936320000,
"line_mean": 40.2777777778,
"line_max": 131,
"alpha_frac": 0.6520861373,
"autogenerated": false,
"ratio": 4.747603833865814,
"config_test": false,
... |
import pygame, sys
from pygame.locals import *
import imp
class App():
def __init__(self, fona):
self.fona = fona
#Important Variables and constants
self.open_apps = False
self.pixel = 0
self.SPEED = 2
self.opened = False
self.close_apps = False
self... | {
"repo_name": "spadgenske/TYOS",
"path": "src/apps.py",
"copies": "1",
"size": "5394",
"license": "mit",
"hash": 5761531692080604000,
"line_mean": 33.5769230769,
"line_max": 133,
"alpha_frac": 0.4959213941,
"autogenerated": false,
"ratio": 3.7641311933007677,
"config_test": false,
"has_no_key... |
#!/apps/python-2.7/bin/python
# -*- coding: utf-8 -*-
import os
import os.path
import glob
import sys
from apiclient.discovery import build
from apiclient.errors import HttpError
import httplib2
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client import tools... | {
"repo_name": "yteraoka/googleapps-directory-tools",
"path": "groupman.py",
"copies": "1",
"size": "10706",
"license": "apache-2.0",
"hash": 7967581683090992000,
"line_mean": 34.3333333333,
"line_max": 104,
"alpha_frac": 0.5077526621,
"autogenerated": false,
"ratio": 3.999252895031752,
"config_... |
## appsterdam twitter data
## usage: we open a csv file with names of companies or phenomenon that are
## of interest to the amsterdam tech community. these subjects are
## searched on twitter. the tweets will give us a new list of users and
## hashtags. these will be searched again and... | {
"repo_name": "InnoViz/innoviz-frontend",
"path": "app/data miner scripts/TWITTER GRAPH/twitter_miner.py",
"copies": "1",
"size": "6330",
"license": "mit",
"hash": -6059324430615256000,
"line_mean": 41.4899328859,
"line_max": 122,
"alpha_frac": 0.6551342812,
"autogenerated": false,
"ratio": 3.438... |
## appsterdam website data
## usage: call this script followed by a text file
## the script will then create a .csv file with all bigrams and their weight in the file
## the cript is aimed at showing info from the appsterdam member profiles
## example calls:
## $ python getBigram.py example.txt
#... | {
"repo_name": "InnoViz/innoviz-frontend",
"path": "app/data miner scripts/MEETUP DESCRIPTIONS/getBigram.py",
"copies": "1",
"size": "4003",
"license": "mit",
"hash": 1509050209851694800,
"line_mean": 36.4205607477,
"line_max": 201,
"alpha_frac": 0.6655008743,
"autogenerated": false,
"ratio": 2.94... |
#apps.twiiter.com/app
#dev.twitter.com/overview/api
#dev.twiiter.com/rest/tools/console
import jason
from os import path
from tweepy import OAuthHandler,Stream,API
from tweepy.streaming import StreaemListener
from sqlalchmey.orm.exc import NoResultFound
from database.database import session, Tweet, Hashtag, User
C... | {
"repo_name": "deepak223098/Data_Science_Python",
"path": "save_tweets.py",
"copies": "1",
"size": "2215",
"license": "bsd-3-clause",
"hash": 1407042142139546000,
"line_mean": 33.0769230769,
"line_max": 71,
"alpha_frac": 0.6081264108,
"autogenerated": false,
"ratio": 3.41820987654321,
"config_t... |
#apps.twiiter.com/app
#dev.twitter.com/overview/api
#dev.twiiter.com/rest/tools/console
import jason
from tweepy import OAuthHandler,Stream,API
from tweepy.streaming import StreaemListener
Consumer_Key = '8cHXrID1ZvQ6utL8lh8kWHOYJ'
Consumer_Secret = 'nCSeqQtsleaXG4PktUSMOkuXtJT49jydtxIdh3zzJIQLI19cxX'
Access_Token = ... | {
"repo_name": "deepak223098/Data_Science_Python",
"path": "twitter_data_access.py",
"copies": "1",
"size": "1807",
"license": "bsd-3-clause",
"hash": 2231767341651695900,
"line_mean": 36.6458333333,
"line_max": 96,
"alpha_frac": 0.5733259546,
"autogenerated": false,
"ratio": 3.5155642023346303,
... |
#!/apps/well/python/2.7.8/bin/python
"""
Usage: hlmm_chr.py
This script fits heteroskedastic linear models or heteroskedastic linear mixed models to a sequence of genetic variants
contained in a .bed file. You need to specify the genotypes.bed file, which also has genotypes.bim and genotypes.fam in
the same directory,... | {
"repo_name": "AlexTISYoung/hlmm",
"path": "bin/hlmm_chr.py",
"copies": "1",
"size": "17791",
"license": "mit",
"hash": -4963762059286151000,
"line_mean": 45.5759162304,
"line_max": 204,
"alpha_frac": 0.6055308864,
"autogenerated": false,
"ratio": 3.1741302408563783,
"config_test": true,
"has... |
#app = symplectic
from datetime import datetime
import urllib
from xml.etree.ElementTree import ElementTree, Element, SubElement, XML
from xml.parsers.expat import ExpatError
import urllib2
import os
from publications.models import (
Publication, BibliographicRecord, BiblioURL, Authored
)
SYMP... | {
"repo_name": "evildmp/arkestra-publications",
"path": "symplectic/models.py",
"copies": "1",
"size": "32335",
"license": "bsd-2-clause",
"hash": 2402671223687271400,
"line_mean": 34.6194790487,
"line_max": 79,
"alpha_frac": 0.6295036338,
"autogenerated": false,
"ratio": 3.956803720019579,
"con... |
# app/tests/test_config.py
import unittest
from flask import current_app
from flask_testing import TestCase
from app import app
class TestDevelopmentConfig(TestCase):
def create_app(self):
app.config.from_object('app.config.DevelopmentConfig')
return app
def test_app_is_development(self)... | {
"repo_name": "7anshuai/flask-todo",
"path": "app/tests/test_config.py",
"copies": "1",
"size": "1571",
"license": "mit",
"hash": -5438790479054222000,
"line_mean": 28.0925925926,
"line_max": 66,
"alpha_frac": 0.6677275621,
"autogenerated": false,
"ratio": 3.636574074074074,
"config_test": true... |
import time
import os
import pygame
from pygame.locals import *
class Toolbar():
def __init__(self, fona):
self.UPDATE_TIME = 30
self.DEAD = 30
#Setup fona
self.fona = fona
#Define colors
self.WHITE = (255,255,255)
self.BLACK = (0,0,0)
sel... | {
"repo_name": "spadgenske/TYOS",
"path": "src/toolbar.py",
"copies": "1",
"size": "4521",
"license": "mit",
"hash": -4413084621565965300,
"line_mean": 28.940397351,
"line_max": 95,
"alpha_frac": 0.5275381553,
"autogenerated": false,
"ratio": 3.491119691119691,
"config_test": false,
"has_no_ke... |
"""App trace events.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import enum # pylint: disable=wrong-import-order
import logging
from .. import _events
_LOGGER = logging.getLogger(__name__)
cla... | {
"repo_name": "Morgan-Stanley/treadmill",
"path": "lib/python/treadmill/trace/app/events.py",
"copies": "2",
"size": "18675",
"license": "apache-2.0",
"hash": 5909132291452893000,
"line_mean": 26.9565868263,
"line_max": 79,
"alpha_frac": 0.5544846051,
"autogenerated": false,
"ratio": 4.4687724335... |
"""app 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": "marcopuccio/pocs",
"path": "python/drf-gs/app/app/urls.py",
"copies": "1",
"size": "1073",
"license": "mit",
"hash": -2749578524721797600,
"line_mean": 33.6129032258,
"line_max": 82,
"alpha_frac": 0.7110904007,
"autogenerated": false,
"ratio": 3.5296052631578947,
"config_test": f... |
"""app 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": "Hackatong2017Geriatricos/backend",
"path": "app/urls.py",
"copies": "1",
"size": "1127",
"license": "apache-2.0",
"hash": -7068995877040204000,
"line_mean": 33.1515151515,
"line_max": 82,
"alpha_frac": 0.7125110914,
"autogenerated": false,
"ratio": 3.521875,
"config_test": false,... |
"""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-based v... | {
"repo_name": "October-66/Traveler-Pal",
"path": "traveler_pal/app/urls.py",
"copies": "1",
"size": "3651",
"license": "mit",
"hash": -3892179055834035000,
"line_mean": 41.9529411765,
"line_max": 117,
"alpha_frac": 0.6778964667,
"autogenerated": false,
"ratio": 3.2598214285714286,
"config_test"... |
"""app 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 v... | {
"repo_name": "tonnie17/Bookmarker",
"path": "bookmarker/bookmarker/urls.py",
"copies": "1",
"size": "1989",
"license": "mit",
"hash": 8771301216892135000,
"line_mean": 44.2045454545,
"line_max": 88,
"alpha_frac": 0.7239819005,
"autogenerated": false,
"ratio": 3.3769100169779285,
"config_test":... |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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-based vie... | {
"repo_name": "y-tsutsu/mondja",
"path": "app/urls.py",
"copies": "1",
"size": "1066",
"license": "bsd-3-clause",
"hash": 704016649391363000,
"line_mean": 28.6111111111,
"line_max": 77,
"alpha_frac": 0.6547842402,
"autogenerated": false,
"ratio": 3.4498381877022655,
"config_test": false,
"has... |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/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-based vie... | {
"repo_name": "otto-torino/django-baton",
"path": "testapp/app/app/urls.py",
"copies": "1",
"size": "1450",
"license": "mit",
"hash": 6651242364689964000,
"line_mean": 35.25,
"line_max": 77,
"alpha_frac": 0.6772413793,
"autogenerated": false,
"ratio": 3.6340852130325816,
"config_test": false,
... |
#app/urls.py
from django.conf.urls import url
from django.conf.urls import patterns, include
from . import views
from app import views
from django.conf.urls import url, patterns, include
#from app.api import UsuarioResource
#usuario_resource=UsuarioResource()
#from .views import RegistrarUsuario, RedirigirUsuario
... | {
"repo_name": "bogdananas/proyectoIV-modulo2",
"path": "app/urls.py",
"copies": "1",
"size": "1085",
"license": "mit",
"hash": -4481251202425780000,
"line_mean": 34.0322580645,
"line_max": 87,
"alpha_frac": 0.666359447,
"autogenerated": false,
"ratio": 2.9324324324324325,
"config_test": false,
... |
# app/users/views.py
#################### Imports ####################
from flask import render_template, Blueprint, request, redirect, url_for, flash
from sqlalchemy.exc import IntegrityError
from .forms import RegisterForm
from app import db
from app.models import User
#################### Config ###############... | {
"repo_name": "weldon0405/weldon-blog",
"path": "app/users/views.py",
"copies": "1",
"size": "1340",
"license": "mit",
"hash": 1541331423795959000,
"line_mean": 32.5,
"line_max": 131,
"alpha_frac": 0.5805970149,
"autogenerated": false,
"ratio": 4.2271293375394325,
"config_test": false,
"has_n... |
"""app/utils
utils
The helper classes and functions here exist to reduce large repetitive code
blocks throughout the project. They may contain functions or classes from
module but do not change the parameters of the class
Modules
-------
templates utilities for localization templates
"""
from itertools import re... | {
"repo_name": "CodeForPhilly/chime",
"path": "src/chime_dash/app/utils/__init__.py",
"copies": "1",
"size": "5511",
"license": "mit",
"hash": 8063376096094657000,
"line_mean": 29.4254143646,
"line_max": 86,
"alpha_frac": 0.6039585981,
"autogenerated": false,
"ratio": 3.94201861130995,
"config_t... |
"""AppVeyor Build
This file is used to build and distribute the safety binary on appveyor. Take
a look at the corresponding appveyor.yml as well.
"""
import os
import subprocess
import sys
from collections import OrderedDict
class environment:
WIN = "win"
LINUX = "linux"
MACOS = "macos"
def __init... | {
"repo_name": "pyupio/safety",
"path": "appveyor.py",
"copies": "1",
"size": "4119",
"license": "mit",
"hash": -3246465745565662000,
"line_mean": 30.9302325581,
"line_max": 79,
"alpha_frac": 0.5518329692,
"autogenerated": false,
"ratio": 3.9191246431969553,
"config_test": true,
"has_no_keywor... |
from contextlib import closing
import os
import subprocess
import tempfile
import yaml
_POWERSHELL_ONLY_ERROR = ("""appveyor-container-runner only works with """
"""powershell commands.""")
def main():
"""Runs the appveyor.yml script."""
with open("appveyor.yml", "r") as yaml_file... | {
"repo_name": "smspillaz/appveyor-container-runner",
"path": "appveyorcontainerrunner/runner.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -5167724052448867000,
"line_mean": 29.4385964912,
"line_max": 74,
"alpha_frac": 0.4933717579,
"autogenerated": false,
"ratio": 4.5300261096605... |
"""App view decorators."""
from functools import wraps
from flask import (
abort,
request,
)
def require_headers(headers=[]):
"""Check for required headers in a view.
@require_headers(headers=['X-Foo'])
def view():
pass
"""
def outer(func, *args, **kwargs):
@wraps(func)
... | {
"repo_name": "christabor/jinja2_template_pack",
"path": "flask_extras/decorators.py",
"copies": "2",
"size": "4116",
"license": "mit",
"hash": -8965912037198929000,
"line_mean": 29.2647058824,
"line_max": 77,
"alpha_frac": 0.4679300292,
"autogenerated": false,
"ratio": 4.478781284004352,
"conf... |
# app/views/admin.py
from flask import flash, current_app, Flask, render_template, request, redirect, url_for, Blueprint
from .forms import AdminUserForm, AdminRoleForm
from ..models import *
# This is the view that shows the admin dashboard.
admin = Blueprint('admin', __name__, url_prefix='/admin')
@admin.route('... | {
"repo_name": "jacobsky/shopping-aggregator",
"path": "shopping-aggregator/app/views/admin.py",
"copies": "1",
"size": "1726",
"license": "apache-2.0",
"hash": 1032525592355368600,
"line_mean": 31.5660377358,
"line_max": 112,
"alpha_frac": 0.7201622248,
"autogenerated": false,
"ratio": 3.28136882... |
"""App views."""
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from django.http import HttpResponse
from game_app.models import GameModel
from game_app.clean_files import config_section_map, change_settings
from game_app.forms import GameForm, UploadForm
def home_view(request):... | {
"repo_name": "flegald/Gameini",
"path": "gameini/game_app/views.py",
"copies": "1",
"size": "1534",
"license": "mpl-2.0",
"hash": 286430785679483620,
"line_mean": 34.6744186047,
"line_max": 95,
"alpha_frac": 0.6799217731,
"autogenerated": false,
"ratio": 3.797029702970297,
"config_test": false... |
# app.views.py
#
# Views for dynamic content
import logging, urllib
from django.shortcuts import render
from yacon.models.pages import Page, PageType, Block
logger = logging.getLogger(__name__)
# ============================================================================
NEWS_PAGE_TYPE = None
# =================... | {
"repo_name": "cltrudeau/django-yacon",
"path": "extras/sample_site/app/views.py",
"copies": "1",
"size": "1338",
"license": "mit",
"hash": -5604780758358374000,
"line_mean": 28.7333333333,
"line_max": 80,
"alpha_frac": 0.5119581465,
"autogenerated": false,
"ratio": 4.316129032258065,
"config_t... |
"""App-wide DB definitions
"""
# Ben Peters (bencpeters@gmail.com)
import json
from datetime import datetime
from sqlalchemy.types import TypeDecorator, VARCHAR
from sqlalchemy.orm import sessionmaker, scoped_session, relationship
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy... | {
"repo_name": "bencpeters/home-controls",
"path": "home_controller/db.py",
"copies": "1",
"size": "4910",
"license": "mit",
"hash": -8556316691214224000,
"line_mean": 28.4011976048,
"line_max": 85,
"alpha_frac": 0.6099796334,
"autogenerated": false,
"ratio": 4.383928571428571,
"config_test": fa... |
"""A predictor that uses KDE to classify instances."""
import numpy
import sklearn.base
import sklearn.neighbors
import sklearn.utils.multiclass
import sklearn.utils.validation
class KDEClassifier(sklearn.base.BaseEstimator, sklearn.base.ClassifierMixin):
"""A classifier using kernel density estimation to classi... | {
"repo_name": "chengsoonong/acton",
"path": "acton/kde_predictor.py",
"copies": "1",
"size": "3519",
"license": "bsd-3-clause",
"hash": 3447067531607300600,
"line_mean": 31.2844036697,
"line_max": 80,
"alpha_frac": 0.6027280477,
"autogenerated": false,
"ratio": 4.174377224199288,
"config_test":... |
"""A preference manager for all mayavi related preferences.
The idea behind this module is that it lets the mayavi
library/application use the same preferences by managing them no matter
if mayavi is used as an application (via envisage3) or as a library.
The preferences helpers are divided into different categories ... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/preferences/preference_manager.py",
"copies": "5",
"size": "4651",
"license": "bsd-3-clause",
"hash": -4791921345028933000,
"line_mean": 35.0542635659,
"line_max": 80,
"alpha_frac": 0.5452590841,
"autogenerated": false,
"ratio": 5.1563192904... |
"""A preprocessor that extracts all of the outputs from the
notebook file. The extracted outputs are returned in the 'resources' dictionary.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from binascii import a2b_base64
import sys
import os
from mimetypes imp... | {
"repo_name": "ammarkhann/FinalSeniorCode",
"path": "lib/python2.7/site-packages/nbconvert/preprocessors/extractoutput.py",
"copies": "8",
"size": "4365",
"license": "mit",
"hash": 2131991370487359700,
"line_mean": 39.0458715596,
"line_max": 83,
"alpha_frac": 0.5541809851,
"autogenerated": false,
... |
"""A pre-specified hook to reorder test functions and its building blocks."""
import re
# Default regular expressions match varying paths - for example the unit tests re matches:
# tests/unit/...
# test_unit.py
# app/tests/unit/....
# tests/test_unit
# unit
# But won't match (e.g.):
# some_unit
# abc_test_unit
DEFAUL... | {
"repo_name": "not-raspberry/pytest_reorder",
"path": "pytest_reorder/reorder.py",
"copies": "1",
"size": "4241",
"license": "mit",
"hash": -9166820939986367000,
"line_mean": 38.2685185185,
"line_max": 100,
"alpha_frac": 0.6722471115,
"autogenerated": false,
"ratio": 4.04675572519084,
"config_t... |
"""A pre-trained implimentation of VGG16 with weights trained on ImageNet.
NOTE: It's not a great idea to use tf.constant to take in large arrays that will
not change, better to use a non-trainable variable.
https://stackoverflow.com/questions/41150741/in-tensorflow-what-is-the-difference-between-a-constant-and-a-non-... | {
"repo_name": "mathandy/Classifiers2LearnWith",
"path": "experiments/vgg16_pre-trained/vgg16_pre-trained-alt.py",
"copies": "1",
"size": "7715",
"license": "mit",
"hash": -1447211170855051800,
"line_mean": 40.7027027027,
"line_max": 129,
"alpha_frac": 0.5935191186,
"autogenerated": false,
"ratio"... |
'''A pretty printer for Runa CFG nodes.
This module implements another CFG walker, which spits out a string
represenation of the given CFG object. This is intended as a debugging aid
during compiler development, and can be invoked using the compiler driver's
`show` command (parametrized with the last pass to run befor... | {
"repo_name": "djc/runa",
"path": "runac/pretty.py",
"copies": "1",
"size": "5902",
"license": "mit",
"hash": 3103162756587728000,
"line_mean": 19.4221453287,
"line_max": 75,
"alpha_frac": 0.6262283972,
"autogenerated": false,
"ratio": 2.6863905325443787,
"config_test": false,
"has_no_keyword... |
#** apricot.R = 1 **#
def build(basefile, outfile, rs, vs, rm, e):
currentdir = os.getcwd()
tmpfile = "apricot.tmp.{}".format(e)
b = "{}/{}".format(currentdir, basefile)
t = "{}/{}".format(currentdir, tmpfile)
shutil.copy(b, t)
# outputファイルを生成
fl = open(outfile, 'w')
# メイン処理
f = ope... | {
"repo_name": "daiz713/Universe",
"path": "beta/build.py",
"copies": "1",
"size": "3508",
"license": "mit",
"hash": 1000598568892304500,
"line_mean": 33.5353535354,
"line_max": 96,
"alpha_frac": 0.4148624927,
"autogenerated": false,
"ratio": 3.1736304549675025,
"config_test": false,
"has_no_k... |
# AprilTags Example
#
# This example shows the power of the OpenMV Cam to detect April Tags
# on the OpenMV Cam M7. The M4 versions cannot detect April Tags.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resoluti... | {
"repo_name": "kwagyeman/openmv",
"path": "scripts/examples/Arduino/Portenta-H7/26-April-Tags/find_apriltags.py",
"copies": "2",
"size": "2546",
"license": "mit",
"hash": 2251345702936042500,
"line_mean": 44.4642857143,
"line_max": 105,
"alpha_frac": 0.7054202671,
"autogenerated": false,
"ratio":... |
# AprilTags Max Res Example
#
# This example shows the power of the OpenMV Cam to detect April Tags
# on the OpenMV Cam M7. The M4 versions cannot detect April Tags.
import sensor, image, time, math, omv
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # we run out of memory if t... | {
"repo_name": "kwagyeman/openmv",
"path": "scripts/examples/Arduino/Portenta-H7/26-April-Tags/find_apriltags_max_res.py",
"copies": "2",
"size": "2795",
"license": "mit",
"hash": -6554370241799320000,
"line_mean": 45.5833333333,
"line_max": 105,
"alpha_frac": 0.7076923077,
"autogenerated": false,
... |
# AprilTags Pixy I2C Emulation Script
#
# This script allows your OpenMV Cam to transmit AprilTag detection data like
# a Pixy (CMUcam5) tracking colors in I2C mode. This script allows you to
# easily replace a Pixy (CMUcam5) color tracking sensor with an OpenMV Cam
# AprilTag tracking sensor. Note that this only runs ... | {
"repo_name": "kwagyeman/openmv",
"path": "scripts/examples/OpenMV/17-Pixy-Emulation/apriltags_pixy_i2c_emulation.py",
"copies": "5",
"size": "7365",
"license": "mit",
"hash": 3275424195161561600,
"line_mean": 29.0612244898,
"line_max": 103,
"alpha_frac": 0.6027155465,
"autogenerated": false,
"ra... |
# AprilTags Pixy SPI Emulation Script
#
# This script allows your OpenMV Cam to transmit AprilTag detection data like
# a Pixy (CMUcam5) tracking colors in SPI mode. This script allows you to
# easily replace a Pixy (CMUcam5) color tracking sensor with an OpenMV Cam
# AprilTag tracking sensor. Note that this only runs ... | {
"repo_name": "openmv/openmv",
"path": "scripts/examples/Arduino/Portenta-H7/17-Pixy-Emulation/apriltags_pixy_spi_emulation.py",
"copies": "5",
"size": "7644",
"license": "mit",
"hash": -6072259555726542000,
"line_mean": 29.2134387352,
"line_max": 103,
"alpha_frac": 0.6085818943,
"autogenerated": f... |
# AprilTags Pixy UART Emulation Script
#
# This script allows your OpenMV Cam to transmit AprilTag detection data like
# a Pixy (CMUcam5) tracking colors in UART mode. This script allows you to
# easily replace a Pixy (CMUcam5) color tracking sensor with an OpenMV Cam
# AprilTag tracking sensor. Note that this only run... | {
"repo_name": "kwagyeman/openmv",
"path": "scripts/examples/Arduino/Portenta-H7/17-Pixy-Emulation/apriltags_pixy_uart_emulation.py",
"copies": "5",
"size": "6591",
"license": "mit",
"hash": -3672161168331681000,
"line_mean": 28.0352422907,
"line_max": 103,
"alpha_frac": 0.6094674556,
"autogenerated... |
#A priority queue is common implemented with a heap
"""
Basic operations:
1. insert_with_priority
2. pull_highest_priority_item
3. peek
Difference between heap and priority queue:
1. Heap is ONE implementation of a priority queue, and it's tree-based.
2. Priority Queue is an abstract data structure... | {
"repo_name": "armsky/Algorithms",
"path": "Data Structure/priorityQueue.py",
"copies": "1",
"size": "2385",
"license": "apache-2.0",
"hash": -3157268401486982700,
"line_mean": 22.1553398058,
"line_max": 89,
"alpha_frac": 0.572327044,
"autogenerated": false,
"ratio": 3.3310055865921786,
"config... |
# A problematic SOC problem from CVXPY's tests.
import El
El.Initialize()
orders = El.DistMultiVec(El.iTag)
firstInds = El.DistMultiVec(El.iTag)
labels = El.DistMultiVec(El.iTag)
orders.Resize(21,1)
firstInds.Resize(21,1)
labels.Resize(21,1)
for c in xrange(7):
for i in xrange(3):
orders.Set(3*c+i,0,3)
firs... | {
"repo_name": "justusc/Elemental",
"path": "examples/interface/SOCAtom.py",
"copies": "1",
"size": "1966",
"license": "bsd-3-clause",
"hash": -8457385428055271000,
"line_mean": 21.8604651163,
"line_max": 61,
"alpha_frac": 0.6312309257,
"autogenerated": false,
"ratio": 2.0564853556485354,
"confi... |
# A problematic SOC problem from CVXPY's tests.
import El
El.Initialize()
orders = El.DistMultiVec(El.iTag)
firstInds = El.DistMultiVec(El.iTag)
orders.Resize(21,1)
firstInds.Resize(21,1)
for c in xrange(7):
for i in xrange(3):
orders.Set(3*c+i,0,3)
firstInds.Set(3*c+i,0,3*c)
h = El.DistMultiVec(El.dTag)
E... | {
"repo_name": "birm/Elemental",
"path": "examples/interface/SOCAtom.py",
"copies": "1",
"size": "1879",
"license": "bsd-3-clause",
"hash": 3789601035910219000,
"line_mean": 21.6385542169,
"line_max": 54,
"alpha_frac": 0.6279936136,
"autogenerated": false,
"ratio": 2.0513100436681224,
"config_te... |
# A problematic SOC problem from CVXPY's tests.
import El
orders = El.DistMultiVec(El.iTag)
firstInds = El.DistMultiVec(El.iTag)
orders.Resize(21,1)
firstInds.Resize(21,1)
for c in xrange(7):
for i in xrange(3):
orders.Set(3*c+i,0,3)
firstInds.Set(3*c+i,0,3*c)
h = El.DistMultiVec(El.dTag)
El.Zeros( h, 21, ... | {
"repo_name": "mcopik/Elemental",
"path": "examples/interface/SOCAtom.py",
"copies": "2",
"size": "2271",
"license": "bsd-3-clause",
"hash": 6212352500490264000,
"line_mean": 26.6951219512,
"line_max": 54,
"alpha_frac": 0.6556583003,
"autogenerated": false,
"ratio": 2.2134502923976607,
"config_... |
# A problem that helps us determine how to scale inequality constrained
# optimization problems
import Optizelle
import numpy
import sys
# Define a simple objective where
#
# f(x) = 0.5 || x - c ||^2
#
class MyObj(Optizelle.ScalarValuedFunction):
# Grab the center of the objective
def __init__(self, c):
... | {
"repo_name": "OptimoJoe/Optizelle",
"path": "src/examples/inequality_scaling/inequality_scaling.py",
"copies": "1",
"size": "2440",
"license": "bsd-2-clause",
"hash": 7245537966458875000,
"line_mean": 22.6893203883,
"line_max": 76,
"alpha_frac": 0.6717213115,
"autogenerated": false,
"ratio": 2.7... |
"""A process monitoring tool."""
import heapq
import itertools
import logging
import time
def generate_intervals(clock):
"""Generate a sequence of time intervals.
Each time ``next()`` is called, the generator yields the time interval
since the last value was requested."""
old = clock()
while Tru... | {
"repo_name": "AndreLouisCaron/spectator",
"path": "spectator/__init__.py",
"copies": "1",
"size": "3993",
"license": "bsd-2-clause",
"hash": -8731470144121904000,
"line_mean": 32.275,
"line_max": 79,
"alpha_frac": 0.6133233158,
"autogenerated": false,
"ratio": 4.4614525139664805,
"config_test"... |
"""A processor for sending shots to an Autodesk IFFFS server (Stone FS) via
Wiretap.
@author Brendan Holt
@date May 2014
@defgroup modFnWiretapShotProcessor FnWiretapShotProcessor
@{
"""
import os.path
import hiero.core
from hiero.exporters.FnShotProcessor import ShotProcessor, ShotProcessorPreset
import hiero.ui
fr... | {
"repo_name": "CBSDigital/Hiero-Wiretap",
"path": "plugins/FnWiretapShotProcessor.py",
"copies": "1",
"size": "13979",
"license": "bsd-3-clause",
"hash": 6283784788254564000,
"line_mean": 39.9941348974,
"line_max": 123,
"alpha_frac": 0.5928177981,
"autogenerated": false,
"ratio": 4.63956189844009... |
"""A processor to convert the description file into a datapackage."""
import json
import logging
import arrow
import yaml
from parser import ParserError
from slugify import slugify
from datapackage_pipelines.wrapper import spew, ingest
from common.config import SOURCE_FILE, SOURCE_DATAPACKAGE_FILE, JSON_FORMAT
from da... | {
"repo_name": "Victordeleon/os-data-importers",
"path": "eu-structural-funds/common/processors/read_description.py",
"copies": "1",
"size": "2788",
"license": "mit",
"hash": -817485862679533700,
"line_mean": 29.3043478261,
"line_max": 79,
"alpha_frac": 0.6631994261,
"autogenerated": false,
"ratio... |
"""A processor to inject categories values into the data."""
from datapackage_pipelines.wrapper import ingest, spew
from common.row_processor import process
def inject_categories(row, **category_tables):
"""Inject categories values into the data.
Constants are taken from the following places (in order of ove... | {
"repo_name": "Victordeleon/os-data-importers",
"path": "eu-structural-funds/common/processors/add_categories.py",
"copies": "1",
"size": "1290",
"license": "mit",
"hash": -2969534193247457300,
"line_mean": 29,
"line_max": 73,
"alpha_frac": 0.6224806202,
"autogenerated": false,
"ratio": 4.6071428... |
"""A processor to inject constant values into the data."""
from datapackage_pipelines.wrapper import ingest, spew
from common.row_processor import process
def inject_constants(row, **constants):
"""Inject constant values into the data.
Constants are taken from the following places (in order of override):
... | {
"repo_name": "Victordeleon/os-data-importers",
"path": "eu-structural-funds/common/processors/add_constants.py",
"copies": "1",
"size": "1193",
"license": "mit",
"hash": -813487515100932700,
"line_mean": 27.4047619048,
"line_max": 73,
"alpha_frac": 0.6186085499,
"autogenerated": false,
"ratio": ... |
"""A processor to map values."""
from logging import warning
from common.utilities import process
from datapackage_pipelines.wrapper import ingest, spew
def map_aliases(row, lookup_tables):
"""Map aliases using the lookup tables provided in the specs."""
for key, lookup in lookup_tables.items():
if ... | {
"repo_name": "Victordeleon/os-data-importers",
"path": "eu-structural-funds/common/processors/map_values.py",
"copies": "1",
"size": "1135",
"license": "mit",
"hash": 4418022603545033700,
"line_mean": 27.375,
"line_max": 77,
"alpha_frac": 0.6070484581,
"autogenerated": false,
"ratio": 4.29924242... |
"""A processor to stream data from files."""
import os
import json
import cchardet as chardet
from tabulator import Stream
from logging import warning, info
from datapackage_pipelines.wrapper import ingest, spew
from petl import look, fromdicts
from common.config import LOG_SAMPLE_SIZE
from common.utilities import fo... | {
"repo_name": "Victordeleon/os-data-importers",
"path": "eu-structural-funds/common/processors/stream_from_path.py",
"copies": "1",
"size": "5351",
"license": "mit",
"hash": 8960390727331111000,
"line_mean": 30.6627218935,
"line_max": 79,
"alpha_frac": 0.6314707531,
"autogenerated": false,
"ratio... |
"""A program card."""
from csrv.model import actions
from csrv.model import events
from csrv.model.cards import card_base
from csrv.model import game_object
from csrv.model import modifiers
from csrv.model import parameters
from csrv.model import timing_phases
from csrv.model.cards import card_info
class Program(car... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/cards/program.py",
"copies": "1",
"size": "1810",
"license": "apache-2.0",
"hash": 7477273404108826000,
"line_mean": 26.8461538462,
"line_max": 78,
"alpha_frac": 0.7287292818,
"autogenerated": false,
"ratio": 3.5009671179883948,
"config... |
# A program made by Shane (Shaggs) Rees to use PDW's email function into python.
""" To get Started
Options -> SMTP / email settings
Setting set to all messages
SMTP Host 127.0.0.1
Port 8826
To can be set as anything
From can be set as anything
Mail options select
Address, Time, Date, Bitrate, Message
Notification s... | {
"repo_name": "davidmckenzie/pagermon",
"path": "client/pdw2pagermon.py",
"copies": "1",
"size": "1798",
"license": "unlicense",
"hash": -7543912581026589000,
"line_mean": 26.2424242424,
"line_max": 89,
"alpha_frac": 0.680756396,
"autogenerated": false,
"ratio": 2.966996699669967,
"config_test"... |
"""A programmatic compiler of static assets."""
from __future__ import unicode_literals
import abc
from django.utils import six
from optimizations.assetcache import StaticAsset
class AssetCompilerPluginRegistrationError(Exception):
"""An error occured while registering asset compiler plugins."""
class A... | {
"repo_name": "etianen/django-optimizations",
"path": "src/optimizations/assetcompiler.py",
"copies": "1",
"size": "2397",
"license": "bsd-3-clause",
"hash": -2061890371834176500,
"line_mean": 32.3055555556,
"line_max": 135,
"alpha_frac": 0.6637463496,
"autogenerated": false,
"ratio": 4.891836734... |
# A program that computes the the area in feet of three (3) rooms
# their must be four function to compute the area
# Written by Adrian Anderson Programmer, 11/27/17
store = []
def feet_to_yards(yard):
answer = yard * 1/3
return answer
def area_of_room(length, width, height):
return 2 * height * (l... | {
"repo_name": "biggapoww/Python-CIS-5",
"path": "computing_carpet.py",
"copies": "1",
"size": "1032",
"license": "mit",
"hash": -8258527748024722000,
"line_mean": 24.1707317073,
"line_max": 81,
"alpha_frac": 0.5843023256,
"autogenerated": false,
"ratio": 3.2555205047318614,
"config_test": false... |
# A program that has a list of six colors and chooses one by random. The user can then has three chances to quess the right color. After the third attepmt the program outputs "Nope. The color I was thinking of was..."
import random
# this is the function that will execute the program
def program():
# These are the ... | {
"repo_name": "starnes/Python",
"path": "guessnameclass.py",
"copies": "1",
"size": "1452",
"license": "mit",
"hash": 844623943014182800,
"line_mean": 29.25,
"line_max": 217,
"alpha_frac": 0.6095041322,
"autogenerated": false,
"ratio": 3.4004683840749412,
"config_test": false,
"has_no_keyword... |
"""A program that implements classifying data by primitive algorythms."""
from classifier import Classifier
from onerule import OneRuleClassifier
# The constant that defines the count of
# data to be passed while training classifier
MAX_SELECTOR = 2
def main():
"""Main program method."""
data = read_from_fi... | {
"repo_name": "cleac/univ-datamine",
"path": "lab1/main.py",
"copies": "1",
"size": "1367",
"license": "mit",
"hash": -1097262508513632100,
"line_mean": 26.34,
"line_max": 73,
"alpha_frac": 0.5786393563,
"autogenerated": false,
"ratio": 4.219135802469136,
"config_test": false,
"has_no_keyword... |
"""A program that implements classifying data by primitive algorythms."""
from classifier import Classifier
# The constant that defines the count of
# data to be passed while training classifier
MAX_SELECTOR = 2
def main():
"""Main program method."""
data = read_from_file(name='iris.data')
training_dat... | {
"repo_name": "cleac/univ-datamine",
"path": "lab2/main.py",
"copies": "1",
"size": "1221",
"license": "mit",
"hash": -5373161933638116000,
"line_mean": 26.1333333333,
"line_max": 73,
"alpha_frac": 0.5593775594,
"autogenerated": false,
"ratio": 4.181506849315069,
"config_test": false,
"has_no... |
""" A program that stores and updates a counter using a Python pickle file"""
from os.path import exists
import sys
from pickle import dump, load
def update_counter(file_name, reset=False):
""" Updates a counter stored in the file 'file_name'
A new counter will be created and initialized to 1 if none exists or if... | {
"repo_name": "nshlapo/SoftwareDesignFall15",
"path": "toolbox/pickling/counter.py",
"copies": "1",
"size": "1300",
"license": "mit",
"hash": 8534215024426564000,
"line_mean": 21.0508474576,
"line_max": 77,
"alpha_frac": 0.6684615385,
"autogenerated": false,
"ratio": 3.0878859857482186,
"config... |
#A program that takes two given numbers and returns their LCM
# -Shriram Krishnamachari 7/19/16
from collections import Counter as mset
def smallestFactor(n):
for i in range(2, n+1):
if n % i == 0:
return i
def factorize(number):
factor = list()
if number == 1:
factor.appen... | {
"repo_name": "TheArcMagician/Number-theory",
"path": "leastcommonmultiple.py",
"copies": "1",
"size": "1119",
"license": "mit",
"hash": -312735640968435000,
"line_mean": 20.1320754717,
"line_max": 69,
"alpha_frac": 0.5987488829,
"autogenerated": false,
"ratio": 3.4643962848297214,
"config_test... |
# a program to calculate fractals
import itertools
import numpy
import pyglet
import pyglet.graphics
import julia
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return "(%d, %d)" % (self.x, self.y)
def clear(self):
self.... | {
"repo_name": "asgordon96/Julia-Set",
"path": "fractals_new.py",
"copies": "1",
"size": "5368",
"license": "mit",
"hash": -3536276131188730400,
"line_mean": 28.8277777778,
"line_max": 137,
"alpha_frac": 0.5806631893,
"autogenerated": false,
"ratio": 3.003917179630666,
"config_test": false,
"h... |
#A program to generate a series of random sentences from a text file using Markov chains
#by Grace Newman, written for CS 111 (Intro to CS), completed March 1, 2013
from random import randrange
class sentenceGenerator:
def __init__(self): #initialize an instance as empty list of start words and empty dictionary o... | {
"repo_name": "ganewman42/CodeSamples",
"path": "CarletonCourses/RandomSentence.py",
"copies": "1",
"size": "3832",
"license": "mit",
"hash": -8370381973086177000,
"line_mean": 52.2222222222,
"line_max": 204,
"alpha_frac": 0.6787578288,
"autogenerated": false,
"ratio": 4.215621562156215,
"confi... |
"""A program to
1. Make an api call to instragram to get photos from a geographic location
2. Attempt to detect faces in the images
3. Store the metadata in sqlite3
Example call from command line is:
python face.py -l 40.7359 -g -73.9903086 -m [CURRENT TIMESTAMP] -t [TIME STAMP OF HOW FAR BACK YOU WANT TO GO] -c [Y... | {
"repo_name": "andrewjtimmons/selfieexpression",
"path": "face.py",
"copies": "1",
"size": "20276",
"license": "mit",
"hash": 8533627074403147000,
"line_mean": 40.8082474227,
"line_max": 267,
"alpha_frac": 0.6820378773,
"autogenerated": false,
"ratio": 3.170602032838155,
"config_test": false,
... |
## A program to play Blackjack
## By BlueHat GURU
## Written in Python 3.4.1
# Assumption: players already know how to play blackjack, and do not require educating.
# This is just defining a deck of cards, returning it as a list in numerical_suit order.
card_values = ('ace', 'two', 'three', 'four', 'five', 'six'... | {
"repo_name": "BlueHat-GURU/python-blackjack",
"path": "blackjacktwod.py",
"copies": "1",
"size": "11579",
"license": "mit",
"hash": 7946796325190315000,
"line_mean": 34.6276923077,
"line_max": 159,
"alpha_frac": 0.6480697815,
"autogenerated": false,
"ratio": 3.681717011128776,
"config_test": f... |
## A program to play Blackjack
## By BlueHat GURU
## Written in Python 3.4.1
""" Assumption: players already know how to play blackjack,
and do not require educating."""
"""This is just defining a deck of cards,
returning it as a list in numerical_suit order."""
card_values = ('ace', 'two', 'three', 'four', 'fiv... | {
"repo_name": "BlueHat-GURU/python-blackjack",
"path": "blackjackfoura.py",
"copies": "1",
"size": "15763",
"license": "mit",
"hash": -6274417034087758000,
"line_mean": 33.1930585683,
"line_max": 79,
"alpha_frac": 0.6249444903,
"autogenerated": false,
"ratio": 3.9182202336564753,
"config_test":... |
# a program to prin the mothly averages
import numpy as np
from xlrd import open_workbook
import datetime
import sys
date_start_epoch=datetime.datetime(1899,12,30)
def compute_averages(file_name,cdate,c1,c2,c3):
# variables
#####################################
#file_name="TSB001.xlsx"
sheet_index=0
column_... | {
"repo_name": "tbs1980/Retrofit",
"path": "source/monthly_average.py",
"copies": "1",
"size": "3287",
"license": "mpl-2.0",
"hash": -5589163391501690000,
"line_mean": 23.3481481481,
"line_max": 121,
"alpha_frac": 0.6206267113,
"autogenerated": false,
"ratio": 2.368155619596542,
"config_test": f... |
# a program to prin the mothly averages
import numpy as np
from xlrd import open_workbook
import datetime
import sys
date_start_epoch=datetime.datetime(1899,12,30) #starting epoch of the date in excel
def get_threasholds(month,room):
winter = [10,11,12,1,2,3,4]
summer = [5,6,7,8,9]
thr_max = 22.
thr_min = 2... | {
"repo_name": "tbs1980/Retrofit",
"path": "source/comparison_to_cibse.py",
"copies": "1",
"size": "5772",
"license": "mpl-2.0",
"hash": -3090377895400213500,
"line_mean": 28.6,
"line_max": 171,
"alpha_frac": 0.6055093555,
"autogenerated": false,
"ratio": 2.888888888888889,
"config_test": false,... |
"""A program to update /etc/hosts from our defintions"""
from __future__ import print_function
import os
import sys
def parse_line(line):
parts = line.split()
ip, names = parts[0], parts[1:]
return ip, names
def format_line(ip, names):
if names is None:
return str(ip)
names = sorted(list... | {
"repo_name": "jalanb/jab",
"path": "src/python/update_hosts.py",
"copies": "2",
"size": "2813",
"license": "mit",
"hash": 95230832230858140,
"line_mean": 24.1160714286,
"line_max": 70,
"alpha_frac": 0.5801635265,
"autogenerated": false,
"ratio": 3.3289940828402367,
"config_test": false,
"has... |
"""A program used for sending emails through Automation."""
# standard library
import argparse
import base64
import json
# third party
import mysql.connector
import requests
# first party
import delphi.operations.secrets as secrets
#Functions to encode and decode messages
def encode(x):
return 'b64|%s'%(base64.b... | {
"repo_name": "cmu-delphi/operations",
"path": "src/emailer.py",
"copies": "1",
"size": "5035",
"license": "mit",
"hash": -1152282444913702900,
"line_mean": 33.2517006803,
"line_max": 217,
"alpha_frac": 0.6365441907,
"autogenerated": false,
"ratio": 3.330026455026455,
"config_test": false,
"h... |
# A program written to calculate the income tax
# of individual who make a current amount of money
# during the year
# Written by Adrian Anderson Programmer, 9/11/17
tax_dic = {0 : 0, 0.1 : 30000.01, 0.2 : 50000, 0.3 : 100000, 0.35 : 200000, 0.4 : 250000}
tax_rate = [0, 0.1, 0.2, 0.3, 0.35, 0.4]
income_gap = [0, 3000... | {
"repo_name": "biggapoww/Python-CIS-5",
"path": "tax_calculator.py",
"copies": "1",
"size": "1124",
"license": "mit",
"hash": 6229057931187547000,
"line_mean": 35.2580645161,
"line_max": 96,
"alpha_frac": 0.6138790036,
"autogenerated": false,
"ratio": 2.802992518703242,
"config_test": false,
... |
"""A progress reporter inspired from the logging modules"""
from __future__ import absolute_import, unicode_literals
import os
import time
from contextlib import contextmanager
from datetime import datetime
import py
class Verbosity(object):
DEBUG = 2
INFO = 1
DEFAULT = 0
QUIET = -1
EXTRA_QUIET ... | {
"repo_name": "tox-dev/tox",
"path": "src/tox/reporter.py",
"copies": "2",
"size": "4617",
"license": "mit",
"hash": 3633896165006017500,
"line_mean": 28.4076433121,
"line_max": 79,
"alpha_frac": 0.6170673598,
"autogenerated": false,
"ratio": 3.4871601208459215,
"config_test": false,
"has_no_... |
"""A proof assistant, or interactive theorem prover. This implements the
sequent calculus, including maintaining proof state such as context (the set
of symbols to the left of the turnstile) and goals.
Actually, I think the sequent calculus is implemented in MatchAndSubstitute's
try_rule(), along with some rules. Hm... | {
"repo_name": "martincmartin/MathematiciansAssistant",
"path": "ProofSystem.py",
"copies": "1",
"size": "11232",
"license": "apache-2.0",
"hash": 8800322451541661000,
"line_mean": 35.5863192182,
"line_max": 86,
"alpha_frac": 0.6030092593,
"autogenerated": false,
"ratio": 4.017167381974249,
"con... |
# A proof of concept ARP spoofer by Erethon
# Please check README.md and LICENSE files.
# The purpose of this script is stricly educational. It's a proof of concept
# and I haven't really tested it, so I don't know if it will work.
# Once again this is to be used for educational purposes only, I am in no way
# responsi... | {
"repo_name": "Erethon/ArPois.py",
"path": "arpois.py",
"copies": "1",
"size": "2239",
"license": "mit",
"hash": -2107293771276831000,
"line_mean": 29.6712328767,
"line_max": 79,
"alpha_frac": 0.6248325145,
"autogenerated": false,
"ratio": 2.859514687100894,
"config_test": false,
"has_no_keyw... |
# A proof of concept to show how to replace a fictitious keyword "repeat"
def transform_source_code(text):
'''Replaces instances of
repeat n:
where "n" is an integer, by
for VAR_i in range(n):
where VAR_i is a string that does not appear elsewhere
in the code sample. This co... | {
"repo_name": "aroberge/python_experiments",
"path": "version1/repeat_keyword.py",
"copies": "3",
"size": "2597",
"license": "cc0-1.0",
"hash": -6889070124189562000,
"line_mean": 28.5113636364,
"line_max": 73,
"alpha_frac": 0.5271467077,
"autogenerated": false,
"ratio": 4.215909090909091,
"conf... |
"""A proto buffer based logging system for minitaur experiments.
The logging system records the time since reset, base position, orientation,
angular velocity and motor information (joint angle, speed, and torque) into a
proto buffer. See minitaur_logging.proto for more details. The episode_proto is
updated per time s... | {
"repo_name": "MTASZTAKI/ApertusVR",
"path": "plugins/physics/bulletPhysics/3rdParty/bullet3/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_logging.py",
"copies": "2",
"size": "5395",
"license": "mit",
"hash": 3146372956271149000,
"line_mean": 36.7272727273,
"line_max": 91,
"alpha_frac": ... |
"""a prototype multiobjective opt under uncertainty algorithm
"""
import os
import numpy as np
import pandas as pd
import pyemu
from .ensemble_method import EnsembleMethod
class ParetoObjFunc(object):
"""multiobjective function calculator."""
def __init__(self, pst, obj_function_dict, logger):
self... | {
"repo_name": "jtwhite79/pyemu",
"path": "pyemu/prototypes/moouu.py",
"copies": "1",
"size": "36825",
"license": "bsd-3-clause",
"hash": 6117156897981551000,
"line_mean": 37.2796257796,
"line_max": 112,
"alpha_frac": 0.5164154786,
"autogenerated": false,
"ratio": 3.8347391440174947,
"config_tes... |
"""Aproximate joint diagonalization algorithm."""
import numpy as np
def rjd(X, eps=1e-8, n_iter_max=1000):
"""Approximate joint diagonalization based on jacobi angle.
This is a direct implementation of the Cardoso AJD algorithm [1] used in
JADE. The code is a translation of the matlab code provided in t... | {
"repo_name": "alexandrebarachant/decoding-brain-challenge-2016",
"path": "models/pyriemann/utils/ajd.py",
"copies": "1",
"size": "8379",
"license": "bsd-3-clause",
"hash": -7548331173395832000,
"line_mean": 28.5035211268,
"line_max": 78,
"alpha_frac": 0.4985081752,
"autogenerated": false,
"ratio... |
# A proxy class that wraps around another object, but
# exposes its public attributes
class Proxy:
def __init__(self, obj):
self._obj = obj
# Delegate attribute lookup to internal obj
def __getattr__(self, name):
print('getattr:', name)
return getattr(self._obj, name)
# Delega... | {
"repo_name": "tuanavu/python-cookbook-3rd",
"path": "src/8/delegation_and_proxies/example2.py",
"copies": "2",
"size": "1185",
"license": "mit",
"hash": -3156999075640508400,
"line_mean": 25.3333333333,
"line_max": 53,
"alpha_frac": 0.5282700422,
"autogenerated": false,
"ratio": 3.89802631578947... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.