text stringlengths 0 1.05M | meta dict |
|---|---|
# B8:E8:56:25:C8:BF - tracer
# 00:11:22:98:76:54 - FeelTheSound
# sudo hciconfig hci0 piscan
# /usr/bin/bluetooth-agent 0000 &
# sdptool add --channel=3 SP
import bluetooth;
# isL2CAP = True;
isL2CAP = False;
protocol = None;
server_sock = None;
port = None;
if(isL2CAP):
protocol = bluetooth.L2CAP;
server_sock=bl... | {
"repo_name": "mprinc/FeelTheSound",
"path": "src/old_bts.py",
"copies": "1",
"size": "1445",
"license": "cc0-1.0",
"hash": -4518259161173602000,
"line_mean": 24.8214285714,
"line_max": 77,
"alpha_frac": 0.7065743945,
"autogenerated": false,
"ratio": 2.8727634194831015,
"config_test": false,
... |
"""babar3 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-base... | {
"repo_name": "Babaritech/babar3",
"path": "back/babar3/urls.py",
"copies": "1",
"size": "1880",
"license": "mit",
"hash": -1394991115126507000,
"line_mean": 32.5714285714,
"line_max": 79,
"alpha_frac": 0.6808510638,
"autogenerated": false,
"ratio": 3.5877862595419847,
"config_test": false,
"... |
# babelizer.py - API for simple access to babelfish.altavista.com.
# Requires python 2.0 or better.
# From: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/64937
# Modified by Steven Bird to work with current babelfish
#
# See it in use at http://babel.MrFeinberg.com/
"""API for simple access to... | {
"repo_name": "tadgh/ArgoRevisit",
"path": "third_party/nltk/misc/babelfish.py",
"copies": "5",
"size": "6895",
"license": "apache-2.0",
"hash": 5086421759377018000,
"line_mean": 32.9655172414,
"line_max": 98,
"alpha_frac": 0.5823060189,
"autogenerated": false,
"ratio": 3.9947856315179604,
"con... |
# babelizer.py - API for simple access to babelfish.altavista.com.
# Requires python 2.0 or better.
#
# See it in use at http://babel.MrFeinberg.com/
"""API for simple access to babelfish.altavista.com.
Summary:
import babelizer
print ' '.join(babelizer.available_languages)
print babeliz... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/64937_babelizer__API_simple_access/recipe-64937.py",
"copies": "1",
"size": "4981",
"license": "mit",
"hash": 5270935848614970000,
"line_mean": 31.135483871,
"line_max": 83,
"alpha_frac": 0.6406344108,
"autogenerated": false,
"ratio": 3.71... |
babel = None
try:
import babel
except ImportError:
pass
import six
from sqlalchemy import types
from sqlalchemy_utils.exceptions import ImproperlyConfigured
from sqlalchemy_utils.primitives import WeekDay, WeekDays
from .scalar_coercible import ScalarCoercible
from .bit import BitType
class WeekDaysType(types... | {
"repo_name": "tonyseek/sqlalchemy-utils",
"path": "sqlalchemy_utils/types/weekdays.py",
"copies": "1",
"size": "2179",
"license": "bsd-3-clause",
"hash": -5848749010588587000,
"line_mean": 25.2530120482,
"line_max": 75,
"alpha_frac": 0.6512161542,
"autogenerated": false,
"ratio": 4.2475633528265... |
babel = None
try:
import babel
except ImportError:
pass
import six
from sqlalchemy import types
from sqlalchemy_utils.exceptions import ImproperlyConfigured
from sqlalchemy_utils.primitives import WeekDay, WeekDays
from .bit import BitType
from .scalar_coercible import ScalarCoercible
class WeekDaysType(typ... | {
"repo_name": "cheungpat/sqlalchemy-utils",
"path": "sqlalchemy_utils/types/weekdays.py",
"copies": "1",
"size": "2181",
"license": "bsd-3-clause",
"hash": -1372327947193272300,
"line_mean": 24.6588235294,
"line_max": 75,
"alpha_frac": 0.6506189821,
"autogenerated": false,
"ratio": 4.234951456310... |
"""**Bachata** is a chat server toolkit on top of `asyncio`_ and `Tornado`_.
.. _Tornado: http://www.tornadoweb.org/en/stable/
.. _asyncio: https://docs.python.org/3.4/library/asyncio.html
Overview
--------
- Requires Python 3.3+
- Requires Tornado running on asyncio event loop
- Implements simple messages queue on ... | {
"repo_name": "05bit/bachata",
"path": "setup.py",
"copies": "1",
"size": "1453",
"license": "apache-2.0",
"hash": 7181815831401405000,
"line_mean": 27.4901960784,
"line_max": 82,
"alpha_frac": 0.6200963524,
"autogenerated": false,
"ratio": 3.7545219638242893,
"config_test": false,
"has_no_ke... |
"""back_autonomo 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')
Cl... | {
"repo_name": "SurielRuano/backend-autonomo",
"path": "back_autonomo/urls.py",
"copies": "1",
"size": "1349",
"license": "mit",
"hash": -7225685714149823000,
"line_mean": 36.4722222222,
"line_max": 79,
"alpha_frac": 0.6893995552,
"autogenerated": false,
"ratio": 3.568783068783069,
"config_test"... |
''' Backend access class. '''
from biothings.utils.es import ESIndexer
from biothings import config as btconfig
from elasticsearch.exceptions import NotFoundError
# Generic base backend
class DocBackendBase(object):
name = 'Undefined'
def prepare(self):
'''if needed, add extra preparation steps here.'... | {
"repo_name": "SuLab/biothings.api",
"path": "biothings/utils/backend.py",
"copies": "1",
"size": "10616",
"license": "apache-2.0",
"hash": 9216069539767648000,
"line_mean": 33.0256410256,
"line_max": 140,
"alpha_frac": 0.5957045968,
"autogenerated": false,
"ratio": 3.8631732168850075,
"config_... |
''' Backend access class. '''
from functools import partial
from elasticsearch.exceptions import NotFoundError, TransportError
from biothings.utils.es import ESIndexer
from biothings import config as btconfig
# Generic base backend
class DocBackendBase(object):
name = 'Undefined'
def prepare(self):
... | {
"repo_name": "biothings/biothings.api",
"path": "biothings/utils/backend.py",
"copies": "1",
"size": "11778",
"license": "apache-2.0",
"hash": -3867247848875057000,
"line_mean": 33.8461538462,
"line_max": 140,
"alpha_frac": 0.5989132281,
"autogenerated": false,
"ratio": 3.8987090367428006,
"co... |
"""Backend agnostic array operations.
"""
import itertools
import numpy
from autoray import do, reshape, transpose, dag, infer_backend
from ..core import njit
from ..linalg.base_linalg import norm_fro_dense
def asarray(array):
if isinstance(array, numpy.matrix) or not hasattr(array, 'shape'):
return num... | {
"repo_name": "jcmgray/quijy",
"path": "quimb/tensor/array_ops.py",
"copies": "1",
"size": "11490",
"license": "mit",
"hash": 5845810244091775000,
"line_mean": 23.4989339019,
"line_max": 79,
"alpha_frac": 0.5502175805,
"autogenerated": false,
"ratio": 3.620037807183365,
"config_test": false,
... |
"""Backend agnostic functions for solving matrices either fully or partially.
"""
import functools
import warnings
import numpy as np
import scipy.linalg as sla
import scipy.sparse.linalg as spla
from ..utils import raise_cant_find_library_function
from ..core import qarray, dag, issparse, isdense, vdot, ldmul
from .... | {
"repo_name": "jcmgray/quijy",
"path": "quimb/linalg/base_linalg.py",
"copies": "1",
"size": "20822",
"license": "mit",
"hash": -6110207019277110000,
"line_mean": 29.8931750742,
"line_max": 79,
"alpha_frac": 0.5653635578,
"autogenerated": false,
"ratio": 3.6319553462410603,
"config_test": false... |
## backend/back.py
# Backend Implementation Class
# UCF Senior Design Project - Blue Agave
# Application written by Erik Kantrowitz for Agri-Starts
##!!## SSH: pi@127.0.0.1 blue agave ##!!##
# these imports are for controlling the GPIO pins and pwm
import RPi.GPIO as GPIO
import wiringpi
from time import sleep
... | {
"repo_name": "ucftissueculture/Integration",
"path": "backend/Recovered/back.py",
"copies": "1",
"size": "2483",
"license": "mit",
"hash": -6673452434818486000,
"line_mean": 31.2467532468,
"line_max": 69,
"alpha_frac": 0.6367297624,
"autogenerated": false,
"ratio": 3.4107142857142856,
"config_... |
"""Backend based on Theano.
This backend is a simplified version of the Keras backend.
"""
#%%
import numpy as np
import theano
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from natural_bm.backend.common import epsilon, set_epsilon, floatx, set_floatx, cast_to... | {
"repo_name": "alexhunterlang/natural_bm",
"path": "natural_bm/backend/theano_backend.py",
"copies": "1",
"size": "15636",
"license": "mit",
"hash": -3694855679599804400,
"line_mean": 25.6825938567,
"line_max": 112,
"alpha_frac": 0.623561013,
"autogenerated": false,
"ratio": 3.466193748614498,
... |
"""Back-end code to support the Prereg Challenge initiative
Keeping the code together in this file should make it easier to remove the
features added to the OSF specifically to support this initiative in the future.
Other resources that are a part of the Prereg Challenge:
* website/static/js/pages/prereg-landing-pag... | {
"repo_name": "caneruguz/osf.io",
"path": "website/prereg/views.py",
"copies": "7",
"size": "2361",
"license": "apache-2.0",
"hash": -9032900836950579000,
"line_mean": 34.7727272727,
"line_max": 90,
"alpha_frac": 0.6200762389,
"autogenerated": false,
"ratio": 3.9415692821368946,
"config_test": ... |
"""Backend for distributed parameter evaluation."""
import os
import shutil
from psyrun.backend.base import Backend, JobSourceFile
from psyrun.jobs import Job, JobChain, JobArray
from psyrun.pspace import dict_concat, missing, Param
from psyrun.mapper import map_pspace_hdd_backed
from psyrun.store import DefaultStore... | {
"repo_name": "jgosmann/psyrun",
"path": "psyrun/backend/distribute.py",
"copies": "1",
"size": "13606",
"license": "mit",
"hash": 7696877936742457000,
"line_mean": 34.4322916667,
"line_max": 79,
"alpha_frac": 0.5780537998,
"autogenerated": false,
"ratio": 4.021874076263671,
"config_test": fals... |
"""Backend for icatdump and icatingest.
This module provides the base classes DumpFileReader and
DumpFileWriter that define the API and the logic for reading and
writing ICAT data files. The actual work is done in file format
specific modules that should provide subclasses that must implement
the abstract methods.
D... | {
"repo_name": "icatproject/python-icat",
"path": "icat/dumpfile.py",
"copies": "1",
"size": "15195",
"license": "apache-2.0",
"hash": -6358430588917285000,
"line_mean": 39.092348285,
"line_max": 74,
"alpha_frac": 0.6374465285,
"autogenerated": false,
"ratio": 4.418435591741785,
"config_test": f... |
"""Backend for logintokens authentication.
"""
from django.contrib.auth import get_user_model
from logintokens.tokens import default_token_generator
USER = get_user_model()
class EmailOnlyAuthenticationBackend:
"""Authenticates by consuming a provided login token.
"""
token_generator = default_token_... | {
"repo_name": "randomic/aniauth-tdd",
"path": "logintokens/backends.py",
"copies": "1",
"size": "1477",
"license": "mit",
"hash": -4864984722825649000,
"line_mean": 30.4255319149,
"line_max": 79,
"alpha_frac": 0.5917400135,
"autogenerated": false,
"ratio": 4.530674846625767,
"config_test": fals... |
"""Backend for python-rtmidi:
http://pypi.python.org/pypi/python-rtmidi/
"""
from __future__ import absolute_import
import threading
import rtmidi
from .. import ports
from ..messages import Message
from ._parser_queue import ParserQueue
from .rtmidi_utils import expand_alsa_port_name
def _get_api_lookup():
api... | {
"repo_name": "olemb/mido",
"path": "mido/backends/rtmidi.py",
"copies": "1",
"size": "5412",
"license": "mit",
"hash": -7026286535584990000,
"line_mean": 25.5294117647,
"line_max": 76,
"alpha_frac": 0.5788987435,
"autogenerated": false,
"ratio": 3.6444444444444444,
"config_test": false,
"has... |
"""Backend for rtmidi-python:
https://pypi.python.org/pypi/rtmidi-python
To use this backend copy (or link) it to somewhere in your Python path
and call:
mido.set_backend('mido.backends.rtmidi_python')
or set shell variable $MIDO_BACKEND to mido.backends.rtmidi_python
TODO:
* add support for APIs.
* active_s... | {
"repo_name": "olemb/mido",
"path": "mido/backends/rtmidi_python.py",
"copies": "1",
"size": "3860",
"license": "mit",
"hash": 3849882961293432300,
"line_mean": 27.5925925926,
"line_max": 70,
"alpha_frac": 0.5774611399,
"autogenerated": false,
"ratio": 3.979381443298969,
"config_test": false,
... |
"""Backend for running ELAPS:Mat jobs locally."""
import os
import subprocess
import threading
class Backend(object):
"""Backend to run ELAPS:Mat jobs locally in the background."""
name = "local"
def __init__(self):
"""Initialize the backend."""
self.jobs = {}
self.scripts = {}... | {
"repo_name": "HPAC/ELAPS",
"path": "elaps/backends/local.py",
"copies": "2",
"size": "1836",
"license": "bsd-3-clause",
"hash": -7324753196515043000,
"line_mean": 25.6086956522,
"line_max": 66,
"alpha_frac": 0.5190631808,
"autogenerated": false,
"ratio": 3.956896551724138,
"config_test": false... |
"""Backend for running ELAPS:Mat jobs through LSF."""
import subprocess
import re
class Backend(object):
"""Backend to run ELAPS:Mat jobs through an LSF scheduler."""
name = "lsf"
def __init__(self, header="#!/bin/bash -l\n#BSUB -o /dev/null\n"):
"""Initialize the backend."""
self.jobs... | {
"repo_name": "elmar-peise/ELAPS",
"path": "elaps/backends/lsf.py",
"copies": "2",
"size": "1315",
"license": "bsd-3-clause",
"hash": 8441669482691155000,
"line_mean": 30.3095238095,
"line_max": 76,
"alpha_frac": 0.5315589354,
"autogenerated": false,
"ratio": 3.822674418604651,
"config_test": f... |
"""Backend for running Experiments through LoadLeveler."""
import os
import subprocess
import re
class Backend(object):
"""Backend to run ELAPS:Mat jobs through a LoadLeveler scheduler."""
name = "loadleveler"
def __init__(self, header="#!/bin/bash\n#@ comment=\"ELAPS Experiment\"\n"):
"""Init... | {
"repo_name": "HPAC/ELAPS",
"path": "elaps/backends/loadleveler.py",
"copies": "2",
"size": "1561",
"license": "bsd-3-clause",
"hash": 1906203951095118800,
"line_mean": 31.5208333333,
"line_max": 80,
"alpha_frac": 0.5470852018,
"autogenerated": false,
"ratio": 3.912280701754386,
"config_test": ... |
""" Backend functionality for communicating with Route 53 and updating DNS """
from route53_dyndns.app import app
import boto3
class Route53Exception(Exception):
pass
def get_client(): # pragma: no cover
""" Helper function to get an authenticated Route 53 client """
AWS_ACCESS_KEY = app.config['AWS... | {
"repo_name": "dsanders11/route53-dyndns-service",
"path": "route53_dyndns/route53.py",
"copies": "1",
"size": "2787",
"license": "mit",
"hash": -3147596150928274400,
"line_mean": 30.3146067416,
"line_max": 79,
"alpha_frac": 0.5536419089,
"autogenerated": false,
"ratio": 4.53170731707317,
"conf... |
# Backend Implementation Class #
# UCF Senior Design Project - Blue Agave #
# Application written by Erik Kantrowitz for Agri-Starts #
# Control GPIO pins
# M1 | S0 | S1 | S2 | S3 | S4 |
# | 12 | 07 | 11 | 13 | 15 | 16 | Board Val
# | 18... | {
"repo_name": "ucftissueculture/Integration",
"path": "backend/back.py",
"copies": "1",
"size": "6174",
"license": "mit",
"hash": 8280143083818152000,
"line_mean": 30.824742268,
"line_max": 71,
"alpha_frac": 0.5696469064,
"autogenerated": false,
"ratio": 3.4453125,
"config_test": false,
"has_... |
import sys
import telegram
import urllib2
import cv2
from time import sleep
fromBotDir = 'images_from_bot'
toBotDir = 'images_to_bot'
botName = 'demo5dbot'
botToken = 'XXXXXX' #Create bot with 'BotFather' from Telegram
baseUrl = 'https://api.telegram.org/bot%s' % botToken
longPoolingTimeoutSec = 60
cascadeFile = '... | {
"repo_name": "davidkh1/telegram_bot_face_detection",
"path": "online_face_detection_demo.py",
"copies": "1",
"size": "4675",
"license": "apache-2.0",
"hash": 6928497253348822000,
"line_mean": 32.1560283688,
"line_max": 135,
"alpha_frac": 0.6372192513,
"autogenerated": false,
"ratio": 3.475836431... |
"""Backend independent widgets."""
from __future__ import division, print_function
from functools import wraps, partial
import numpy as np
from matplotlib.patches import Circle, Rectangle
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.widgets import Widget, AxesWidget
from matplotlib.colorbar im... | {
"repo_name": "mrterry/yoink",
"path": "yoink/widgets.py",
"copies": "1",
"size": "22114",
"license": "bsd-3-clause",
"hash": -7373019880200067000,
"line_mean": 28.2513227513,
"line_max": 79,
"alpha_frac": 0.5439992765,
"autogenerated": false,
"ratio": 3.697993311036789,
"config_test": false,
... |
# Backend loading
# Based on the Django cache framework and wagtailsearch
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
try:
from importlib import import_module
except ImportError:
# for Python 2.6, fall back on django.utils.importlib (deprecated... | {
"repo_name": "helenwarren/pied-wagtail",
"path": "wagtail/wagtailimages/backends/__init__.py",
"copies": "3",
"size": "2661",
"license": "bsd-3-clause",
"hash": -7932590253033031000,
"line_mean": 33.1153846154,
"line_max": 110,
"alpha_frac": 0.6625328824,
"autogenerated": false,
"ratio": 3.96572... |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
from importlib import import_module
from django.utils import six
import sys
from django.conf import settings
from base import InvalidSearchBackendError
... | {
"repo_name": "suziesparkle/wagtail",
"path": "wagtail/wagtailsearch/backends/__init__.py",
"copies": "3",
"size": "2402",
"license": "bsd-3-clause",
"hash": 2399492162391949000,
"line_mean": 32.3611111111,
"line_max": 110,
"alpha_frac": 0.6532056619,
"autogenerated": false,
"ratio": 4.0369747899... |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
import sys
from importlib import import_module
import warnings
from django.utils import six
from django.utils.module_loading import import_string
from ... | {
"repo_name": "kurtw/wagtail",
"path": "wagtail/wagtailsearch/backends/__init__.py",
"copies": "2",
"size": "4347",
"license": "bsd-3-clause",
"hash": -3054980361881913300,
"line_mean": 30.9632352941,
"line_max": 113,
"alpha_frac": 0.6811594203,
"autogenerated": false,
"ratio": 4.128205128205129,... |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
import sys
import six
from importlib import import_module
from django.utils.module_loading import import_string
from django.core.exceptions import Impr... | {
"repo_name": "ayarshabeer/wagtail",
"path": "wagtail/wagtailsearch/backends/__init__.py",
"copies": "21",
"size": "2746",
"license": "bsd-3-clause",
"hash": -8118903348713164000,
"line_mean": 30.2045454545,
"line_max": 110,
"alpha_frac": 0.6573197378,
"autogenerated": false,
"ratio": 4.211656441... |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
from django.utils.module_loading import import_string
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
class ... | {
"repo_name": "stevenewey/wagtail",
"path": "wagtail/wagtailsearch/backends/__init__.py",
"copies": "2",
"size": "1963",
"license": "bsd-3-clause",
"hash": 6931887934287281000,
"line_mean": 30.6612903226,
"line_max": 110,
"alpha_frac": 0.654100866,
"autogenerated": false,
"ratio": 4.1326315789473... |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
try:
from importlib import import_module
except ImportError:
# for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7)... | {
"repo_name": "helenwarren/pied-wagtail",
"path": "wagtail/wagtailsearch/backends/__init__.py",
"copies": "3",
"size": "2573",
"license": "bsd-3-clause",
"hash": -4560640408050195000,
"line_mean": 32.4155844156,
"line_max": 110,
"alpha_frac": 0.6583754372,
"autogenerated": false,
"ratio": 4.02660... |
## backend/mc2.py
# this is a test file it is a clone of mc.py but using
# the backend.py for function and initialization
# and a few more things I want to test out
import signal
import time
import sys
#custom made backend functions class (that probably won't work)
from back import Back
back = Back()
pins = [17, 27, ... | {
"repo_name": "ucftissueculture/Integration",
"path": "backend/Recovered/mc2.py",
"copies": "1",
"size": "1298",
"license": "mit",
"hash": -668348301020117200,
"line_mean": 26.0416666667,
"line_max": 83,
"alpha_frac": 0.6486902928,
"autogenerated": false,
"ratio": 3.6666666666666665,
"config_te... |
"""Backend operations of Kapre.
This module summarizes operations and functions that are used in Kapre layers.
Attributes:
_CH_FIRST_STR (str): 'channels_first', a pre-defined string.
_CH_LAST_STR (str): 'channels_last', a pre-defined string.
_CH_DEFAULT_STR (str): 'default', a pre-defined string.
"""
fr... | {
"repo_name": "keunwoochoi/kapre",
"path": "kapre/backend.py",
"copies": "1",
"size": "9661",
"license": "mit",
"hash": 104376839541066320,
"line_mean": 37.4820717131,
"line_max": 120,
"alpha_frac": 0.6338130241,
"autogenerated": false,
"ratio": 3.4263923377084073,
"config_test": false,
"has_... |
# backend.py - compile LaTeX file to PDF, optionally open in viewer
import os
import platform
import subprocess
from . import tools
__all__ = ['compile']
PLATFORM = platform.system().lower()
def apply(f, *args, **kwargs):
return f(*args, **kwargs)
def no_compile(filename, *, view=False):
raise NotImplem... | {
"repo_name": "xflr6/dmengine",
"path": "dmengine/reporting/backend.py",
"copies": "1",
"size": "2567",
"license": "mit",
"hash": 458301090772577000,
"line_mean": 26.3085106383,
"line_max": 94,
"alpha_frac": 0.6567978185,
"autogenerated": false,
"ratio": 3.825633383010432,
"config_test": false,... |
# backend.py - compile LaTeX to PDF, optionally open in viewer, count PDF pages
import errno
import os
import platform
import re
import subprocess
from . import tools
__all__ = ['compile', 'Npages']
PLATFORM = platform.system().lower()
OPTS = {'latexmk': ['-silent'],
'texify': ['--batch', '--verbose', '--q... | {
"repo_name": "xflr6/latexpages",
"path": "latexpages/backend.py",
"copies": "1",
"size": "6235",
"license": "mit",
"hash": 4036679082944839000,
"line_mean": 31.3056994819,
"line_max": 79,
"alpha_frac": 0.5531676022,
"autogenerated": false,
"ratio": 4.201482479784366,
"config_test": false,
"h... |
"""backend.py
This library defines the backend used by the application webservice, `app.py`.
The Watson/Core methods contained here are wrappers of `event_insight_lib.py` methods."""
# Redistributables.
import json
import os
import random
import itertools
import requests
# My own libraries.
import event_insight_lib... | {
"repo_name": "ResidentMario/py-events",
"path": "backend.py",
"copies": "2",
"size": "5533",
"license": "apache-2.0",
"hash": 9067637508621947000,
"line_mean": 39.9925925926,
"line_max": 133,
"alpha_frac": 0.7303452015,
"autogenerated": false,
"ratio": 3.6281967213114754,
"config_test": false,... |
# backend.py - talk to the sheets and drive api with google-api-client-python
"""Thin wrappers around apiclient method calls."""
import apiclient
__all__ = ['build_service', 'iterfiles', 'spreadsheet', 'values']
SERVICES = {'sheets': {'serviceName': 'sheets', 'version': 'v4'},
'drive': {'serviceName': '... | {
"repo_name": "xflr6/gsheets",
"path": "gsheets/backend.py",
"copies": "1",
"size": "2673",
"license": "mit",
"hash": -6993792986488284000,
"line_mean": 32.835443038,
"line_max": 100,
"alpha_frac": 0.6090534979,
"autogenerated": false,
"ratio": 3.948301329394387,
"config_test": false,
"has_no... |
"""Backend server of Ladders, exposing a JSON api."""
import collections
import logging
import os
import sqlite3
import zlib
from typing import Any, DefaultDict, Iterable, List
import flask # type:ignore
import oauth2client.client
import oauth2client.crypt
from ranking import Ranking
app = flask.Flask... | {
"repo_name": "lrem/ladders",
"path": "api.py",
"copies": "1",
"size": "14832",
"license": "mit",
"hash": -3030711508122193000,
"line_mean": 38.1951219512,
"line_max": 97,
"alpha_frac": 0.5551510248,
"autogenerated": false,
"ratio": 3.8655199374511335,
"config_test": false,
"has_no_keywords":... |
"""Backend service for the JavaScript app.
Handles Datastore model and JSON calls from the browser.
Also includes environment information call.
"""
import datetime
import json
import logging
import os
import webapp2
from google.appengine.api import memcache
from google.appengine.api import users
from google.appengi... | {
"repo_name": "hsavit1/Quantum-Computing-Playground",
"path": "app.py",
"copies": "3",
"size": "10523",
"license": "apache-2.0",
"hash": -645461298886355800,
"line_mean": 30.2255192878,
"line_max": 78,
"alpha_frac": 0.6397415186,
"autogenerated": false,
"ratio": 3.750178189593728,
"config_test"... |
"""Backends for traces
Available backends
------------------
1. NumPy array (pymc3.backends.NDArray)
2. Text files (pymc3.backends.Text)
3. SQLite (pymc3.backends.SQLite)
The NDArray backend holds the entire trace in memory, whereas the Text
and SQLite backends store the values while sampling.
Selecting a backend
-... | {
"repo_name": "springcoil/pymc3",
"path": "pymc3/backends/__init__.py",
"copies": "1",
"size": "4432",
"license": "apache-2.0",
"hash": 6886340161057735000,
"line_mean": 34.1746031746,
"line_max": 72,
"alpha_frac": 0.7179602888,
"autogenerated": false,
"ratio": 4.157598499061914,
"config_test":... |
"""Backends for traces
Available backends
------------------
1. NumPy array (pymc.backends.NDArray)
2. Text files (pymc.backends.Text)
3. SQLite (pymc.backends.SQLite)
The NumPy arrays and text files both hold the entire trace in memory,
whereas SQLite commits the trace to the database while sampling.
Selecting a b... | {
"repo_name": "kyleam/pymc3",
"path": "pymc/backends/__init__.py",
"copies": "2",
"size": "4192",
"license": "apache-2.0",
"hash": -6104171492735864000,
"line_mean": 34.2268907563,
"line_max": 72,
"alpha_frac": 0.7220896947,
"autogenerated": false,
"ratio": 4.138203356367226,
"config_test": fal... |
"""Backend supporting Amazon SQS"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import uuid
from messaging.backends.backend import MessagingBackend
from util.aws import AWSCredentials, S... | {
"repo_name": "ngageoint/scale",
"path": "scale/messaging/backends/sqs.py",
"copies": "1",
"size": "1953",
"license": "apache-2.0",
"hash": -4891156184266237000,
"line_mean": 37.2941176471,
"line_max": 102,
"alpha_frac": 0.650281618,
"autogenerated": false,
"ratio": 4.209051724137931,
"config_t... |
"""Backend supporting AMQP 0.9.1, specifically targeting RabbitMQ message broker"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import Queue
import logging
from contextlib import closing
from kombu import Connecti... | {
"repo_name": "ngageoint/scale",
"path": "scale/messaging/backends/amqp.py",
"copies": "1",
"size": "2250",
"license": "apache-2.0",
"hash": -3913689458027331000,
"line_mean": 37.7931034483,
"line_max": 86,
"alpha_frac": 0.6208888889,
"autogenerated": false,
"ratio": 4.48207171314741,
"config_t... |
""" Backend that defers to another server for access control """
from .base import IAccessBackend
class RemoteAccessBackend(IAccessBackend):
"""
This backend allows you to defer all user auth and permissions to a remote
server. It requires the ``requests`` package.
"""
def __init__(self, reques... | {
"repo_name": "stevearc/pypicloud",
"path": "pypicloud/access/remote.py",
"copies": "1",
"size": "3585",
"license": "mit",
"hash": 4268196324061730000,
"line_mean": 34.85,
"line_max": 86,
"alpha_frac": 0.6047419805,
"autogenerated": false,
"ratio": 4.207746478873239,
"config_test": false,
"ha... |
""" Backend that defers to another server for access control """
import json
from json import JSONDecodeError
import boto3
from botocore.exceptions import ClientError
from pypicloud.util import get_settings
from .base_json import IMutableJsonAccessBackend
class AWSSecretsManagerAccessBackend(IMutableJsonAccessBack... | {
"repo_name": "stevearc/pypicloud",
"path": "pypicloud/access/aws_secrets_manager.py",
"copies": "1",
"size": "3127",
"license": "mit",
"hash": 3593349271111295000,
"line_mean": 32.623655914,
"line_max": 82,
"alpha_frac": 0.586504637,
"autogenerated": false,
"ratio": 4.202956989247312,
"config_... |
""" Backend that reads access control rules from config file """
import logging
from collections import defaultdict
from pyramid.security import Everyone, Authenticated
from pyramid.settings import aslist, asbool
from .base import IAccessBackend
LOG = logging.getLogger(__name__)
class ConfigAccessBackend(IAccessBa... | {
"repo_name": "johnswanson/pypicloud",
"path": "pypicloud/access/config.py",
"copies": "3",
"size": "6926",
"license": "mit",
"hash": -6879528576437791000,
"line_mean": 34.5179487179,
"line_max": 76,
"alpha_frac": 0.5308980653,
"autogenerated": false,
"ratio": 4.488658457550227,
"config_test": ... |
'''Backend to allow email login.
From Djangosnippets:
http://djangosnippets.org/snippets/1001/
Classes:
EmailOrUsernameModelBackend: Allow users to login with email or username.
'''
from django.contrib.auth.models import User
class EmailOrUsernameModelBackend(object):
'''Allows users to login with username... | {
"repo_name": "nathangeffen/tbonline-old",
"path": "tbonlineproject/accounts/backends.py",
"copies": "2",
"size": "1050",
"license": "mit",
"hash": -6027845577441562000,
"line_mean": 25.9230769231,
"line_max": 77,
"alpha_frac": 0.6266666667,
"autogenerated": false,
"ratio": 4.356846473029045,
"... |
"""Backend unit testing for the FLL Pit Display."""
import unittest
import os
from coverage import coverage
from fllipit import APP, Team
from api import rankTeams
class BasicTestCase(unittest.TestCase):
"""Basic test case."""
def test_bestScore(self):
# Three scores entered
team1... | {
"repo_name": "rtfoley/fllipit",
"path": "app-test.py",
"copies": "1",
"size": "3089",
"license": "mit",
"hash": 4540879400042773500,
"line_mean": 33.7191011236,
"line_max": 108,
"alpha_frac": 0.6426027841,
"autogenerated": false,
"ratio": 3.625586854460094,
"config_test": true,
"has_no_keywo... |
"""backend 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-ba... | {
"repo_name": "raymestalez/django-react-blog",
"path": "backend/backend/urls.py",
"copies": "1",
"size": "1510",
"license": "mit",
"hash": -2882713163526739000,
"line_mean": 38.7368421053,
"line_max": 79,
"alpha_frac": 0.6821192053,
"autogenerated": false,
"ratio": 3.561320754716981,
"config_te... |
"""backend 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": "Afonasev/Blog",
"path": "backend/urls.py",
"copies": "1",
"size": "1106",
"license": "mit",
"hash": 2463922171921333000,
"line_mean": 32.5151515152,
"line_max": 79,
"alpha_frac": 0.7025316456,
"autogenerated": false,
"ratio": 3.6744186046511627,
"config_test": false,
"has_no_ke... |
"""backend 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": "spiralsyzygy/django-drf-base-app",
"path": "backend/urls.py",
"copies": "1",
"size": "1396",
"license": "mit",
"hash": 6275964704980608000,
"line_mean": 44.0322580645,
"line_max": 106,
"alpha_frac": 0.6934097421,
"autogenerated": false,
"ratio": 3.438423645320197,
"config_test": ... |
"""back-end 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": "molleolson/studentkompassen",
"path": "studentkompassen/urls.py",
"copies": "1",
"size": "1456",
"license": "mit",
"hash": -1865812316975457500,
"line_mean": 39.4444444444,
"line_max": 83,
"alpha_frac": 0.7046703297,
"autogenerated": false,
"ratio": 3.393939393939394,
"config_tes... |
"""backend 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-based... | {
"repo_name": "mmlado/animal_pairing",
"path": "backend/backend/urls.py",
"copies": "1",
"size": "1053",
"license": "apache-2.0",
"hash": 3719584305971193300,
"line_mean": 35.3103448276,
"line_max": 84,
"alpha_frac": 0.7160493827,
"autogenerated": false,
"ratio": 3.65625,
"config_test": false,
... |
"""backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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... | {
"repo_name": "delitamakanda/BukkakeGramNew",
"path": "backend/urls.py",
"copies": "1",
"size": "1437",
"license": "mit",
"hash": 7981271246326496000,
"line_mean": 40.0571428571,
"line_max": 84,
"alpha_frac": 0.7188587335,
"autogenerated": false,
"ratio": 3.6564885496183206,
"config_test": fals... |
"""backend 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')
Cla... | {
"repo_name": "distrochooser/distrochooser",
"path": "backend/backend/urls.py",
"copies": "2",
"size": "2030",
"license": "mpl-2.0",
"hash": 4743075356861353000,
"line_mean": 46.3333333333,
"line_max": 199,
"alpha_frac": 0.6733990148,
"autogenerated": false,
"ratio": 3.5489510489510487,
"config... |
"""backengo 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": "upeu-jul-20161-epis-ads2/MedicFast",
"path": "demo/urls.py",
"copies": "1",
"size": "2165",
"license": "bsd-3-clause",
"hash": -298135868299444100,
"line_mean": 34.4918032787,
"line_max": 91,
"alpha_frac": 0.6729792148,
"autogenerated": false,
"ratio": 3.372274143302181,
"config_... |
"""Backfill external ID column
Revision ID: 1080
Revises: 1070
Create Date: 2017-12-05 15:00:00.00000
"""
from alembic import op
import json
import random
import sqlalchemy as sa
from sqlalchemy.sql import text
# revision identifiers, used by Alembic.
revision = '1080'
down_revision = '1070'
DIRECT_AWARD_AUDIT_TYPE... | {
"repo_name": "alphagov/digitalmarketplace-api",
"path": "migrations/versions/1080_backfill_external_ids.py",
"copies": "1",
"size": "3801",
"license": "mit",
"hash": -5332585364727029000,
"line_mean": 42.1931818182,
"line_max": 118,
"alpha_frac": 0.6564062089,
"autogenerated": false,
"ratio": 3.... |
"""backfill_job_updated
Revision ID: 890ddf764ed7
Revises: bfe3af4f7eae
Create Date: 2017-11-15 15:29:56.970335
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "890ddf764ed7"
down_revision = "bfe3af4f7eae"
branch_labels = ()
depends_on = None
Job = sa.Table(
... | {
"repo_name": "getsentry/zeus",
"path": "zeus/migrations/890ddf764ed7_backfill_job_updated.py",
"copies": "1",
"size": "1071",
"license": "apache-2.0",
"hash": 2301415032235601200,
"line_mean": 24.5,
"line_max": 86,
"alpha_frac": 0.6526610644,
"autogenerated": false,
"ratio": 3.25531914893617,
... |
"""backfill signature_summary_os 28 days
Revision ID: 16b2bee7db72
Revises: 4afd4e13281d
Create Date: 2015-09-02 13:53:13.505082
"""
import datetime
# revision identifiers, used by Alembic.
revision = '16b2bee7db72'
down_revision = '4afd4e13281d'
from alembic import op
def upgrade():
# We only ever, at most, ... | {
"repo_name": "Serg09/socorro",
"path": "alembic/versions/16b2bee7db72_backfill_signature_summary_os_28_days.py",
"copies": "8",
"size": "1126",
"license": "mpl-2.0",
"hash": -6448803549285374000,
"line_mean": 22.9574468085,
"line_max": 65,
"alpha_frac": 0.5150976909,
"autogenerated": false,
"rat... |
"""Backfills tables to populate GitHub's repo ID."""
import rethinkdb as r
import db.plugins
import db.util
r_conn = db.util.r_conn
def backfill_github_plugin_repos():
"""Adds the 'repo_id' field from the repo_data field if available."""
r.table('plugin_github_repos').update({
'repo_id': r.row['rep... | {
"repo_name": "jonafato/vim-awesome",
"path": "db/migrations/backfill_github_repo_id.py",
"copies": "5",
"size": "1326",
"license": "mit",
"hash": -254012502465485000,
"line_mean": 27.2127659574,
"line_max": 78,
"alpha_frac": 0.6003016591,
"autogenerated": false,
"ratio": 3.444155844155844,
"co... |
"""backfill_testcase_rollup
Revision ID: 495c51627ec0
Revises: d05e8a773f11
Create Date: 2020-05-21 11:17:19.041610
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "495c51627ec0"
down_revision = "d05e8a773f11"
branch_labels = ()
depends_on = None
def upgrade(... | {
"repo_name": "getsentry/zeus",
"path": "zeus/migrations/495c51627ec0_backfill_testcase_rollup.py",
"copies": "1",
"size": "1476",
"license": "apache-2.0",
"hash": 1394417908015218700,
"line_mean": 27.9411764706,
"line_max": 129,
"alpha_frac": 0.6050135501,
"autogenerated": false,
"ratio": 3.0943... |
# background(0.8)
background(None)
import math
debug = 0
r30 = math.radians( 30)
c30 = math.cos( r30 )
# the reptile consists of 3 different segments; each used twice
seg1 = (
( 0.0, 0.0),
( 2.2, 2.2),
( 4.0, 2.2),
( 6.3, -0.5),
( 5.0, -3.0),
( 5.8, -3.8),
( 7.5, -3.7),
( 7.8, -3.... | {
"repo_name": "karstenw/nodebox-pyobjc",
"path": "examples/Escher/reptiles.py",
"copies": "1",
"size": "7694",
"license": "mit",
"hash": -3243024554041913000,
"line_mean": 21.4314868805,
"line_max": 86,
"alpha_frac": 0.4442422667,
"autogenerated": false,
"ratio": 2.7478571428571428,
"config_tes... |
# background(0.8)
background(None)
# size(1440,900)
import math
import pprint
debug = 1
r30 = math.radians( 30)
c30 = math.cos( r30 )
# the reptile consists of 3 different segments; each used twice
seg1 = (
( 0.0, 0.0),
( 2.2, 2.2),
( 4.0, 2.2),
( 6.3, -0.5),
( 5.0, -3.0),
( 5.8, -3.8),
... | {
"repo_name": "karstenw/nodebox1-snippets",
"path": "escher/escher-reptiles.py",
"copies": "1",
"size": "7899",
"license": "bsd-2-clause",
"hash": 8008832973228856000,
"line_mean": 21.5685714286,
"line_max": 86,
"alpha_frac": 0.4471452083,
"autogenerated": false,
"ratio": 2.757068062827225,
"co... |
# background(0.8)
size(400, 400)
background(None)
import math
debug = 0
r30 = math.radians( 30)
c30 = math.cos( r30 )
# the reptile consists of 3 different segments; each used twice
seg1 = (
( 0.0, 0.0),
( 2.2, 2.2),
( 4.0, 2.2),
( 6.3, -0.5),
( 5.0, -3.0),
( 5.8, -3.8),
( 7.5, -3.7),... | {
"repo_name": "karstenw/nodebox-pyobjc",
"path": "examples/Escher/reptiles_single.py",
"copies": "1",
"size": "7936",
"license": "mit",
"hash": 299960212260326100,
"line_mean": 21.5482954545,
"line_max": 86,
"alpha_frac": 0.4470766129,
"autogenerated": false,
"ratio": 2.7412780656303974,
"confi... |
## background color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.bg = 'qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #888888, stop:1 #505050)'
## Bottom border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.border.bottom = '... | {
"repo_name": "mifix/dotfiles",
"path": "qutebrowser/config.d/colors.py",
"copies": "1",
"size": "9290",
"license": "mit",
"hash": 1089467143383507800,
"line_mean": 27.4097859327,
"line_max": 126,
"alpha_frac": 0.7269106566,
"autogenerated": false,
"ratio": 3.1122278056951425,
"config_test": fa... |
"""Background image 2nd order polynomial correction
This example extends the tilt correction ('background_tilt.py') to
a second order polynomial correction for samples that exhibit
more sophisticated phase aberrations. The phase background correction
is computed from a ten pixel wide frame around the image.
The phase ... | {
"repo_name": "RI-imaging/qpimage",
"path": "examples/background_poly2o.py",
"copies": "1",
"size": "1994",
"license": "mit",
"hash": -4413910876369221600,
"line_mean": 30.15625,
"line_max": 69,
"alpha_frac": 0.6805416249,
"autogenerated": false,
"ratio": 3.081916537867079,
"config_test": false... |
background_image_filename = 'sushiplate.jpg'
mouse_image_filename = 'fugu.png'
import pygame
from pygame.locals import * # Import some basic functions and constants.
from sys import exit # To exit the program.
pygame.init() # Initialize pygame. Prepare to use hard drives.
screen = pygame.display.set_mode((640,480)... | {
"repo_name": "fsbd1285228/PythonCodes",
"path": "PythonStarter/Pygame/HelloWorld.py",
"copies": "1",
"size": "1096",
"license": "mit",
"hash": -2679317230080293000,
"line_mean": 36.8275862069,
"line_max": 90,
"alpha_frac": 0.7253649635,
"autogenerated": false,
"ratio": 3.271641791044776,
"conf... |
background_image_filename = 'sushiplate.jpg'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
background = pygame.image.load(background_image_filename).convert()
x, y = 0, 0
move_x, move_y = 0, 0
while True:
for eve... | {
"repo_name": "PythonProgramming/Beginning-Game-Development-with-Python-and-Pygame",
"path": "Chapter 3/3-3.py",
"copies": "3",
"size": "1211",
"license": "mit",
"hash": -2455453246722214000,
"line_mean": 24.2291666667,
"line_max": 68,
"alpha_frac": 0.4500412882,
"autogenerated": false,
"ratio": ... |
"""Background image offset correction
This example illustrates the different background offset
correction methods implemented in qpimage. The phase image
data contains two gaussian noise distributions for which
these methods yield different background phase offsets.
"""
import matplotlib.pylab as plt
import numpy as n... | {
"repo_name": "RI-imaging/qpimage",
"path": "examples/background_offset.py",
"copies": "1",
"size": "2398",
"license": "mit",
"hash": -2963885056104023600,
"line_mean": 32.7746478873,
"line_max": 74,
"alpha_frac": 0.701000834,
"autogenerated": false,
"ratio": 2.903147699757869,
"config_test": f... |
"""Background image tilt correction
This example illustrates background tilt correction with qpimage.
In contrast to the 'simple_phase.py' example, the known background data
is not given to the :class:`qpimage.QPImage <qpimage.core.QPImage>`
class. In this particular example, the background tilt correction
achieves an... | {
"repo_name": "RI-imaging/qpimage",
"path": "examples/background_tilt.py",
"copies": "1",
"size": "1746",
"license": "mit",
"hash": -5578508152576514000,
"line_mean": 32.5769230769,
"line_max": 71,
"alpha_frac": 0.6895761741,
"autogenerated": false,
"ratio": 2.9443507588532882,
"config_test": f... |
# Background Materials
## The MSPA Software Survey was collected in December 2016.
## Data from the survey were used to inform data science curriculum planning.
## These data are provided in the comma-delimited text file <mspa-survey-data.csv>.
## The survey was conducted online using Survey Monkey.
## A printed fo... | {
"repo_name": "sgranitz/northwestern",
"path": "predict422/survey_data_eda.py",
"copies": "2",
"size": "8383",
"license": "mit",
"hash": 1547859599027364000,
"line_mean": 36.2577777778,
"line_max": 89,
"alpha_frac": 0.6656328283,
"autogenerated": false,
"ratio": 3.199618320610687,
"config_test"... |
background( None )
size(1100,900)
import pprint
pp = pprint.pprint
import math
"""Eschers squarelimit in Python."""
# scale factor for next smaller picture
smaller = 1 / math.sqrt(2)
# global counter
no_of_pictures = 0
# debug options
# draw a rectangle around picture
dbg_frame = False
# draw a circle around p... | {
"repo_name": "karstenw/nodebox1-snippets",
"path": "escher/squarelimit.py",
"copies": "1",
"size": "13707",
"license": "bsd-2-clause",
"hash": 2724794451963396600,
"line_mean": 23.0052539405,
"line_max": 93,
"alpha_frac": 0.5104691034,
"autogenerated": false,
"ratio": 3.4613636363636364,
"conf... |
background( None )
size(1100,900)
"""Create a Escher squarelimit drawing."""
import math
# scale factor for next smaller picture
smaller = 1 / math.sqrt(2)
# global counter
no_of_pictures = 0
# unused
types = {
1: "line",
2: "linesegments",
3: "curvesegments"}
# debug options
# draw a rectangle aro... | {
"repo_name": "karstenw/nodebox-pyobjc",
"path": "examples/Escher/squarelimit.py",
"copies": "1",
"size": "13740",
"license": "mit",
"hash": 3344795829856366000,
"line_mean": 22.93728223,
"line_max": 93,
"alpha_frac": 0.5105531295,
"autogenerated": false,
"ratio": 3.4557344064386317,
"config_te... |
"""Background subtraction local plugin for Ginga (Qt)."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# STDLIB
import json
import os
import warnings
# THIRD-PARTY
import numpy as np
from astropy.utils.misc import JsonCustomEncoder
# GINGA
from ginga im... | {
"repo_name": "stscieisenhamer/stginga",
"path": "stginga/plugins/BackgroundSub.py",
"copies": "1",
"size": "29792",
"license": "bsd-3-clause",
"hash": 7092582844252662000,
"line_mean": 32.625282167,
"line_max": 352,
"alpha_frac": 0.5632720193,
"autogenerated": false,
"ratio": 3.716566866267465,
... |
# Background Subtraction:
# Subtracts a background image from a foreground image once.
import cv2
import numpy as np
from . import print_image
from . import plot_image
from . import fatal_error
def background_subtraction(background_image, foreground_image, device, debug=None):
"""Creates a binary image from a ba... | {
"repo_name": "AntonSax/plantcv",
"path": "plantcv/background_subtraction.py",
"copies": "2",
"size": "3087",
"license": "mit",
"hash": -3893111703526367000,
"line_mean": 42.4788732394,
"line_max": 114,
"alpha_frac": 0.6818918043,
"autogenerated": false,
"ratio": 4.01953125,
"config_test": fals... |
# Background Subtraction:
# Subtracts a background image from a foreground image once.
import os
import cv2
import numpy as np
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
from plantcv.plantcv import fatal_error
from plantcv.plantcv import params
def background_subtraction(backgroun... | {
"repo_name": "stiphyMT/plantcv",
"path": "plantcv/plantcv/background_subtraction.py",
"copies": "2",
"size": "2810",
"license": "mit",
"hash": -321360163253468700,
"line_mean": 41.5757575758,
"line_max": 114,
"alpha_frac": 0.7017793594,
"autogenerated": false,
"ratio": 3.8651994497936726,
"con... |
#background worker to do jobs
import getopt
import os
import sys
import time
import threading
from multiprocessing import Process
from .constants import *
from .loggingHelper import *
from .jobManager import JobManager
from .workerJob import WorkerJob
from .feedProcessor import *
from .linkProcessor import *
from . im... | {
"repo_name": "adityabansal/newsAroundMe",
"path": "newsApp/worker.py",
"copies": "1",
"size": "4488",
"license": "mit",
"hash": 9063504018463181000,
"line_mean": 34.626984127,
"line_max": 94,
"alpha_frac": 0.627228164,
"autogenerated": false,
"ratio": 3.699917559769167,
"config_test": false,
... |
"""Backing implementation for InstallRequirement's various constructors
The idea here is that these formed a major chunk of InstallRequirement's size
so, moving them and support code dedicated to them outside of that class
helps creates for better understandability for the rest of the code.
These are meant to be used... | {
"repo_name": "pradyunsg/pip",
"path": "src/pip/_internal/req/constructors.py",
"copies": "3",
"size": "16242",
"license": "mit",
"hash": 694144638282803700,
"line_mean": 32.4197530864,
"line_max": 80,
"alpha_frac": 0.6038665189,
"autogenerated": false,
"ratio": 3.927932285368803,
"config_test"... |
# backlog/models.py
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from datetime import date, timedelta
from django.db import IntegrityError
class UserStory(models.Model):
"""
UserStory Model class: User stories are objects that are
sa... | {
"repo_name": "anawagner/projecthuddle",
"path": "backlog/models.py",
"copies": "1",
"size": "7214",
"license": "mit",
"hash": -8718170229902664000,
"line_mean": 34.8955223881,
"line_max": 93,
"alpha_frac": 0.5920432492,
"autogenerated": false,
"ratio": 3.9399235390497,
"config_test": false,
... |
"""backlogr 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": "anoncb1754/backlogr_py",
"path": "backlogr/backlogr/urls.py",
"copies": "1",
"size": "3275",
"license": "unlicense",
"hash": -1425885452604855300,
"line_mean": 31.75,
"line_max": 115,
"alpha_frac": 0.6506870229,
"autogenerated": false,
"ratio": 3.3658787255909557,
"config_test": ... |
# backlog/views.py
from django.shortcuts import render, render_to_response, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy, reverse
fr... | {
"repo_name": "anawagner/projecthuddle",
"path": "backlog/views.py",
"copies": "1",
"size": "5723",
"license": "mit",
"hash": 7474227698520553000,
"line_mean": 35,
"line_max": 85,
"alpha_frac": 0.6887995806,
"autogenerated": false,
"ratio": 3.971547536433033,
"config_test": false,
"has_no_key... |
"""backoffice 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... | {
"repo_name": "rcarmo/android-signage-server",
"path": "backoffice/urls.py",
"copies": "1",
"size": "1237",
"license": "mit",
"hash": 5280025354306289000,
"line_mean": 43.2142857143,
"line_max": 233,
"alpha_frac": 0.6750202102,
"autogenerated": false,
"ratio": 3.039312039312039,
"config_test": ... |
"""Backpopulate API tests"""
from datetime import datetime, timezone
import pytest
from channels import backpopulate_api
from channels.constants import (
LINK_TYPE_SELF,
LINK_TYPE_LINK,
EXTENDED_POST_TYPE_ARTICLE,
VALID_EXTENDED_POST_TYPES,
DELETED_COMMENT_OR_POST_TEXT,
)
from channels.factories.m... | {
"repo_name": "mitodl/open-discussions",
"path": "channels/backpopulate_api_test.py",
"copies": "1",
"size": "7438",
"license": "bsd-3-clause",
"hash": -2248482535047120600,
"line_mean": 27.3893129771,
"line_max": 85,
"alpha_frac": 0.5590212423,
"autogenerated": false,
"ratio": 3.99677592692101,
... |
"""Backport assertLogs from Python 3.4."""
import collections
import logging
_LoggingWatcher = collections.namedtuple("_LoggingWatcher",
["records", "output"])
class _BaseTestCaseContext(object):
def __init__(self, test_case):
self.test_case = test_case
def... | {
"repo_name": "wujuguang/motor",
"path": "test/assert_logs_backport.py",
"copies": "2",
"size": "2672",
"license": "apache-2.0",
"hash": -7567408020846982000,
"line_mean": 32.8227848101,
"line_max": 70,
"alpha_frac": 0.628742515,
"autogenerated": false,
"ratio": 4.168486739469579,
"config_test"... |
# backported from https://github.com/python/cpython/blob/2.7/Lib/inspect.py
import sys
from inspect import ismethod, getargspec
def getcallargs(func, *positional, **named):
"""Get the mapping of arguments to values.
A dict is returned, with keys the function argument names (including the
names of the * ... | {
"repo_name": "mogproject/mog-commons-python",
"path": "src/mog_commons/backported/inspect2.py",
"copies": "1",
"size": "3983",
"license": "apache-2.0",
"hash": 8346760148952990000,
"line_mean": 38.0490196078,
"line_max": 83,
"alpha_frac": 0.5520964097,
"autogenerated": false,
"ratio": 4.23273113... |
from collections import MutableMapping
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
def recursive_repr(fillvalue='...'):
'Decorator to make a repr function return fillvalue for a recursive call'
def decorating_function(user_function):
repr_running = se... | {
"repo_name": "shoyer/h5netcdf",
"path": "h5netcdf/_chainmap.py",
"copies": "1",
"size": "4624",
"license": "bsd-3-clause",
"hash": -7028920716419863000,
"line_mean": 32.0285714286,
"line_max": 97,
"alpha_frac": 0.5858564014,
"autogenerated": false,
"ratio": 4.165765765765766,
"config_test": fa... |
# Backport from Python 3, from
# http://code.activestate.com/recipes/578078-py26-and-py30-backport-of-python-33s-lru-cache/.
from collections import namedtuple
from functools import update_wrapper
from threading import RLock
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
class _Hashe... | {
"repo_name": "gdb/pyseidon",
"path": "pyseidon/client/lru_cache.py",
"copies": "1",
"size": "6868",
"license": "mit",
"hash": -1892523571077843500,
"line_mean": 40.125748503,
"line_max": 95,
"alpha_frac": 0.5216948165,
"autogenerated": false,
"ratio": 4.557398805573988,
"config_test": false,
... |
# Back-port functools.lru_cache to Python 2 (and <= 3.2)
# {{{ http://code.activestate.com/recipes/578078/ (r6)
from collections import namedtuple
from functools import update_wrapper
from threading import RLock
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
class _HashedSeq(list):
... | {
"repo_name": "scalyr/scalyr-agent-2",
"path": "scalyr_agent/third_party_python2/glob2/compat.py",
"copies": "13",
"size": "6859",
"license": "apache-2.0",
"hash": 1923860552627956000,
"line_mean": 40.0778443114,
"line_max": 95,
"alpha_frac": 0.5199008602,
"autogenerated": false,
"ratio": 4.56657... |
"""Backporting of the ``yield from`` semantic from Python 3.x.
If you want to nest generators in Python 3.x, you can use the ``yield from``
keywords. This allows you to automatically iterate over sub-generators and
transparently pass exceptions and return values from the top level caller
to the lowest generator.
.. c... | {
"repo_name": "Nurdok/yieldfrom",
"path": "yieldfrom.py",
"copies": "1",
"size": "12059",
"license": "mit",
"hash": 2674426703284926500,
"line_mean": 32.4972222222,
"line_max": 79,
"alpha_frac": 0.4220084584,
"autogenerated": false,
"ratio": 5.536730945821855,
"config_test": false,
"has_no_ke... |
"""backport module"""
import os
import shutil
import re
class Backport:
"""A simple class for transforming Python source files.
"""
DEFAULT_PATH = "."
PYTHON_EXTENSION = "py"
BACKUP_EXTENSION = "orig"
REPLACEMENTS = {}
IGNORE = (__file__,)
def __init__(self, path=DEFAULT_PATH, file... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577788_Simple_Class_Transforming_PythSource/recipe-577788.py",
"copies": "1",
"size": "2930",
"license": "mit",
"hash": 6809616440040706000,
"line_mean": 28.595959596,
"line_max": 68,
"alpha_frac": 0.5385665529,
"autogenerated": false,
"ra... |
"""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
from thespian.system.utilis import thesplog
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be impo... | {
"repo_name": "godaddy/Thespian",
"path": "thespian/importlib.py",
"copies": "2",
"size": "1454",
"license": "mit",
"hash": -4553053430774370000,
"line_mean": 33.619047619,
"line_max": 79,
"alpha_frac": 0.6086657497,
"autogenerated": false,
"ratio": 4.263929618768328,
"config_test": false,
"h... |
"""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex... | {
"repo_name": "ojii/sandlib",
"path": "lib/lib-python/2.7/importlib/__init__.py",
"copies": "456",
"size": "1327",
"license": "bsd-3-clause",
"hash": 8607384532238540000,
"line_mean": 33.9210526316,
"line_max": 79,
"alpha_frac": 0.6088922381,
"autogenerated": false,
"ratio": 4.423333333333333,
... |
""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'... | {
"repo_name": "pesaply/sarafu",
"path": "__init__.py",
"copies": "2",
"size": "1326",
"license": "mit",
"hash": -1410076189770688300,
"line_mean": 33.8947368421,
"line_max": 79,
"alpha_frac": 0.6093514329,
"autogenerated": false,
"ratio": 4.42,
"config_test": false,
"has_no_keywords": false,
... |
"""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex... | {
"repo_name": "predakanga/plugin.video.catchuptv.au.ninemsn",
"path": "resources/lib/importlib.py",
"copies": "1",
"size": "1326",
"license": "mit",
"hash": -2994115617474184000,
"line_mean": 33.9210526316,
"line_max": 79,
"alpha_frac": 0.6093514329,
"autogenerated": false,
"ratio": 4.43478260869... |
"""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rinde... | {
"repo_name": "FrancoisRheaultUS/dipy",
"path": "dipy/utils/_importlib.py",
"copies": "9",
"size": "1328",
"license": "bsd-3-clause",
"hash": -6193508124048166000,
"line_mean": 33.0512820513,
"line_max": 79,
"alpha_frac": 0.6076807229,
"autogenerated": false,
"ratio": 4.411960132890365,
"config... |
"""Backport of importlib.import_module from 3.x."""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, ... | {
"repo_name": "google/google-ctf",
"path": "third_party/edk2/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py",
"copies": "63",
"size": "1365",
"license": "apache-2.0",
"hash": -8491769309917597000,
"line_mean": 33.9210526316,
"line_max": 79,
"alpha_frac": 0.5919413919,
"autogener... |
'''Backport of inspect.getcallargs'''
# Standard Library
import inspect
import sys
def getcallargs(func, *positional, **named):
"""Get the mapping of arguments to values.
A dict is returned, with keys the function argument names (including the
names of the * and ** arguments, if any), and values the respe... | {
"repo_name": "brolewis/zkcelery",
"path": "zkcelery/backports.py",
"copies": "1",
"size": "3853",
"license": "bsd-3-clause",
"hash": -4004995720786636300,
"line_mean": 39.1354166667,
"line_max": 79,
"alpha_frac": 0.5559304438,
"autogenerated": false,
"ratio": 4.234065934065934,
"config_test": ... |
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident as _get_ident
try:
from _abcoll import KeysView, ValuesView, ItemsView
except ImportError:
pass
class OrderedDict(dict):
'Dictionary that remembers insertion order'
# An inherited dict maps ... | {
"repo_name": "Yukinoshita47/Yuki-Chan-The-Auto-Pentest",
"path": "Module/dirsearch/thirdparty/requests/packages/urllib3/packages/ordered_dict.py",
"copies": "1",
"size": "8938",
"license": "mit",
"hash": -4523713705154865000,
"line_mean": 33.5096525097,
"line_max": 87,
"alpha_frac": 0.5487804878,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.