text stringlengths 0 1.05M | meta dict |
|---|---|
"""Basic tools for building a Riak manager."""
import json
from riak import RiakClient
from vumi.persist.model import VumiRiakError
def _to_unicode(text, encoding='utf-8'):
# If we already have unicode or `None`, there's nothing to do.
if isinstance(text, (unicode, type(None))):
return text
# I... | {
"repo_name": "vishwaprakashmishra/xmatrix",
"path": "vumi/persist/riak_base.py",
"copies": "3",
"size": "6645",
"license": "bsd-3-clause",
"hash": -4864649678686775000,
"line_mean": 28.4026548673,
"line_max": 79,
"alpha_frac": 0.6224228743,
"autogenerated": false,
"ratio": 3.9065255731922397,
... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from __future__ import print_function, division
from sympy.core import igcd
from sympy import oo
from sympy.polys.monomials import monomial_min, monomial_div
from sympy.polys.orderings import monomial_key
from sympy.core.compatibility import... | {
"repo_name": "Arafatk/sympy",
"path": "sympy/polys/densebasic.py",
"copies": "92",
"size": "36015",
"license": "bsd-3-clause",
"hash": -417864396992419840,
"line_mean": 18.1162420382,
"line_max": 82,
"alpha_frac": 0.4689434958,
"autogenerated": false,
"ratio": 3.0188600167644593,
"config_test"... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from __future__ import print_function, division
from sympy.core import igcd
from sympy.polys.monomials import monomial_min, monomial_div
from sympy.polys.orderings import monomial_key
from sympy.core.compatibility import xrange
import rando... | {
"repo_name": "kmacinnis/sympy",
"path": "sympy/polys/densebasic.py",
"copies": "3",
"size": "35731",
"license": "bsd-3-clause",
"hash": -7474091169933457000,
"line_mean": 18.0972741849,
"line_max": 82,
"alpha_frac": 0.4690324928,
"autogenerated": false,
"ratio": 3.0152742616033756,
"config_tes... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from __future__ import print_function, division
from sympy import oo
from sympy.core import igcd
from sympy.core.compatibility import range
from sympy.polys.monomials import monomial_min, monomial_div
from sympy.polys.orderings import monomia... | {
"repo_name": "kaushik94/sympy",
"path": "sympy/polys/densebasic.py",
"copies": "6",
"size": "36004",
"license": "bsd-3-clause",
"hash": -5956378988794351000,
"line_mean": 18.1205523101,
"line_max": 82,
"alpha_frac": 0.4690034441,
"autogenerated": false,
"ratio": 3.019709804579384,
"config_test... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from sympy.core import igcd, ilcm
from sympy.polys.monomialtools import (
monomial_key, monomial_min, monomial_div
)
from sympy.polys.distributedpolys import sdp_sort
from sympy.utilities import cythonized
import random
def poly_LC(f,... | {
"repo_name": "Cuuuurzel/KiPyCalc",
"path": "sympy_old/polys/densebasic.py",
"copies": "2",
"size": "35995",
"license": "mit",
"hash": -5361872507161173000,
"line_mean": 19.0977107761,
"line_max": 82,
"alpha_frac": 0.4835393805,
"autogenerated": false,
"ratio": 2.9093921758810217,
"config_test"... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from sympy.core import igcd
from sympy.polys.monomialtools import (
monomial_key, monomial_min, monomial_div
)
from sympy.polys.distributedpolys import sdp_sort
from sympy.utilities import cythonized
import random
def poly_LC(f, K):
... | {
"repo_name": "flacjacket/sympy",
"path": "sympy/polys/densebasic.py",
"copies": "2",
"size": "36472",
"license": "bsd-3-clause",
"hash": -5067795405739468000,
"line_mean": 18.6614555256,
"line_max": 82,
"alpha_frac": 0.4762557578,
"autogenerated": false,
"ratio": 2.9567896230239157,
"config_te... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from sympy.utilities import any, all
from sympy.core import igcd, ilcm
from sympy.polys.monomialtools import (
monomial_key, monomial_min, monomial_div
)
from sympy.polys.groebnertools import sdp_sort
from sympy.utilities import cythoni... | {
"repo_name": "pernici/sympy",
"path": "sympy/polys/densebasic.py",
"copies": "1",
"size": "34966",
"license": "bsd-3-clause",
"hash": 2040946530592139300,
"line_mean": 19.0838598507,
"line_max": 82,
"alpha_frac": 0.4820682949,
"autogenerated": false,
"ratio": 2.9068085460138,
"config_test": fa... |
"""Basic tools for dense recursive polynomials in `K[x]` or `K[X]`. """
from sympy.utilities import any, all
from sympy.core import igcd, ilcm
from sympy.polys.monomialtools import (
monomial_min, monomial_div
)
from sympy.utilities import cythonized
def poly_LC(f, K):
"""Returns leading coefficient of `f`.... | {
"repo_name": "mattpap/sympy-polys",
"path": "sympy/polys/densebasic.py",
"copies": "3",
"size": "19724",
"license": "bsd-3-clause",
"hash": 4159580961546091500,
"line_mean": 20.770419426,
"line_max": 80,
"alpha_frac": 0.4893023727,
"autogenerated": false,
"ratio": 2.7874505370265688,
"config_t... |
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``."""
import functools
import math
import random
from ..core import oo
from .monomials import Monomial
def dmp_LC(f, K):
"""
Return leading coefficient of ``f``.
Examples
========
>>> R, x = ring('x', ZZ)
>>> R.dmp_LC(x*... | {
"repo_name": "skirpichev/omg",
"path": "diofant/polys/densebasic.py",
"copies": "1",
"size": "16727",
"license": "bsd-3-clause",
"hash": 4311043627061884000,
"line_mean": 17.0442286947,
"line_max": 81,
"alpha_frac": 0.4189633527,
"autogenerated": false,
"ratio": 2.8341240257539817,
"config_tes... |
"""Basic tools for managing disk usage in the Docker VM
Usage:
disk inspect
disk cleanup_containers
disk cleanup_images
disk backup <destination>
disk restore <source>
Commands:
inspect Prints VM disk usage information
cleanup_containers Cleans docker containers that have exited
cleanup_i... | {
"repo_name": "gamechanger/dusty",
"path": "dusty/cli/disk.py",
"copies": "1",
"size": "1549",
"license": "mit",
"hash": 1560982664895772700,
"line_mean": 35.023255814,
"line_max": 115,
"alpha_frac": 0.6623628147,
"autogenerated": false,
"ratio": 4.267217630853994,
"config_test": false,
"has_... |
""" Basic Torch layers. """
import inspect
import numpy as np
import torch
import torch.nn as nn
from ..utils import get_shape, get_num_channels, get_num_dims, safe_eval
class Flatten(nn.Module):
""" A module which reshapes inputs into 2-dimension (batch_items, features). """
def forward(self, x):
... | {
"repo_name": "analysiscenter/dataset",
"path": "batchflow/models/torch/layers/core.py",
"copies": "1",
"size": "6454",
"license": "apache-2.0",
"hash": 8826703956551038000,
"line_mean": 35.4632768362,
"line_max": 107,
"alpha_frac": 0.5952897428,
"autogenerated": false,
"ratio": 4.232131147540984... |
"""Basic tree interface and behavior."""
from itertools import chain
from treepace.utils import EqualityMixin, IPythonDotMixin, ReprMixin
class TreeBase(EqualityMixin, ReprMixin, IPythonDotMixin):
"""An abstract class containing the interface and implementation common
for both a tree and a subtree."""
... | {
"repo_name": "sulir/treepace",
"path": "treepace/base.py",
"copies": "1",
"size": "2406",
"license": "mit",
"hash": 124864170272956830,
"line_mean": 36.0153846154,
"line_max": 79,
"alpha_frac": 0.56400665,
"autogenerated": false,
"ratio": 4.870445344129554,
"config_test": false,
"has_no_keyw... |
"""Basic tree utilities and methods.
Class `CausalTree` is the base estimator for the Orthogonal Random Forest, whereas
class `Node` represents the core unit of the `CausalTree` class.
"""
import numpy as np
from sklearn.model_selection import train_test_split
from residualizer import dml, second_order_dml
class ... | {
"repo_name": "microsoft/EconML",
"path": "prototypes/orthogonal_forests/causal_tree.py",
"copies": "1",
"size": "7784",
"license": "mit",
"hash": 4748338646616546000,
"line_mean": 43.7356321839,
"line_max": 250,
"alpha_frac": 0.5673175745,
"autogenerated": false,
"ratio": 3.7333333333333334,
"... |
"""Basic trello client"""
import requests
class TrelloClientException(Exception):
"""An exception to throw for trello errors"""
def __init__(self, response):
self.response = response
msg = 'API answered with {} status_code'.format(response.status_code)
super(TrelloClientException, sel... | {
"repo_name": "cogniteev/docido-pull-crawler-trello",
"path": "dpc_trello/trello.py",
"copies": "1",
"size": "3072",
"license": "apache-2.0",
"hash": 3131203218630826500,
"line_mean": 29.4158415842,
"line_max": 77,
"alpha_frac": 0.5631510417,
"autogenerated": false,
"ratio": 4.2139917695473255,
... |
"""Basic twisted protocols converted to synchronous mode"""
import sys
from twisted.internet.protocol import Protocol as twistedProtocol
from twisted.internet.error import ConnectionDone
from twisted.internet.protocol import Factory, ClientFactory
from twisted.internet import main
from twisted.python import failure
fr... | {
"repo_name": "Cue/eventlet",
"path": "eventlet/twistedutil/protocol.py",
"copies": "15",
"size": "13149",
"license": "mit",
"hash": -3622637977338113500,
"line_mean": 30.7608695652,
"line_max": 94,
"alpha_frac": 0.6095520572,
"autogenerated": false,
"ratio": 4.399130143860823,
"config_test": f... |
# Basic type analysis:
a = 2
b = '3'
d = {a:b}
c = ord(b[2].lower()[0])
print c
# Name errors:
c *= e
# Nested-type manipulation:
d = {1:[1], 3:[4]}
d[1].append(2)
l = [range(i) for i in xrange(5)]
l.append([-1])
l2 = [k[0] for k in l]
l2.append(1)
# Argument-type checking, based on inferred types
l2.append('')
... | {
"repo_name": "kmod/icbd",
"path": "demos/demo_compact.py",
"copies": "1",
"size": "1186",
"license": "mit",
"hash": 8759332578058447000,
"line_mean": 10.2952380952,
"line_max": 49,
"alpha_frac": 0.5042158516,
"autogenerated": false,
"ratio": 2.330058939096267,
"config_test": false,
"has_no_k... |
"""Basic types for building a reconstruction."""
from opensfm import pygeometry
from opensfm import pymap
from opensfm.geo import TopocentricConverter
class ShotMesh(object):
"""Triangular mesh of points visible in a shot
Attributes:
vertices: (list of vectors) mesh vertices
faces: (list of t... | {
"repo_name": "mapillary/OpenSfM",
"path": "opensfm/types.py",
"copies": "1",
"size": "8416",
"license": "bsd-2-clause",
"hash": -8238376756285209000,
"line_mean": 30.6390977444,
"line_max": 83,
"alpha_frac": 0.6122861217,
"autogenerated": false,
"ratio": 3.4805624483043838,
"config_test": fals... |
"""Basic types for building a reconstruction."""
import numpy as np
import cv2
class Pose(object):
"""Defines the pose parameters of a camera.
The extrinsic parameters are defined by a 3x1 rotation vector which
maps the camera rotation respect to the origin frame (rotation) and
a 3x1 translation vec... | {
"repo_name": "edgarriba/OpenSfM",
"path": "opensfm/types.py",
"copies": "1",
"size": "11636",
"license": "bsd-2-clause",
"hash": -2870490695703502300,
"line_mean": 29.3020833333,
"line_max": 74,
"alpha_frac": 0.5838776212,
"autogenerated": false,
"ratio": 3.806346090938829,
"config_test": fals... |
"""Basic types used in structures and messages."""
# System imports
import struct
from copy import deepcopy
# Local source tree imports
from pyof.foundation import exceptions
from pyof.foundation.base import GenericStruct, GenericType
# Third-party imports
__all__ = ('BinaryData', 'Char', 'ConstantTypeList', 'Fixed... | {
"repo_name": "cemsbr/python-openflow",
"path": "pyof/foundation/basic_types.py",
"copies": "1",
"size": "23232",
"license": "mit",
"hash": -2614547062201631000,
"line_mean": 29.0932642487,
"line_max": 79,
"alpha_frac": 0.5531594353,
"autogenerated": false,
"ratio": 4.424300133307941,
"config_t... |
"""Basic UNC read tests."""
import numpy as np
import pytest
from fixtures import pdt2, pdt2_byte, pdt2_signed_int, t13d
def test_title(pdt2):
assert pdt2.title == 'Name: Anonymous; ID: Anonymous ID; Series: 301; Sequence: <unknown>'
def test_maxmin(pdt2):
assert pdt2.valid_maxmin is True
assert pdt2.m... | {
"repo_name": "jstutters/PyUNC",
"path": "tests/test_read.py",
"copies": "1",
"size": "1602",
"license": "mit",
"hash": -7905063806759422000,
"line_mean": 27.1052631579,
"line_max": 94,
"alpha_frac": 0.6598002497,
"autogenerated": false,
"ratio": 2.652317880794702,
"config_test": true,
"has_n... |
"""Basic unit tests for openmc.deplete.Operator instantiation
Modifies and resets environment variable OPENMC_CROSS_SECTIONS
to a custom file with new depletion_chain node
"""
from os import environ
from unittest import mock
from pathlib import Path
import pytest
from openmc.deplete.abc import TransportOperator
from... | {
"repo_name": "nelsonag/openmc",
"path": "tests/unit_tests/test_deplete_operator.py",
"copies": "8",
"size": "2602",
"license": "mit",
"hash": 9016287751069668000,
"line_mean": 28.2359550562,
"line_max": 77,
"alpha_frac": 0.6491160646,
"autogenerated": false,
"ratio": 3.4509283819628647,
"confi... |
"""Basic unittests for the server resource control operations."""
from __future__ import absolute_import
from functools import partial
from six.moves import http_client
from django.test import Client, TransactionTestCase
from rotest.api.test_control.middleware import SESSIONS
from rotest.management.models import Dem... | {
"repo_name": "gregoil/rotest",
"path": "tests/api/resource_control/test_cleanup_user.py",
"copies": "1",
"size": "2017",
"license": "mit",
"hash": -123390669576588340,
"line_mean": 35.0178571429,
"line_max": 71,
"alpha_frac": 0.6588993555,
"autogenerated": false,
"ratio": 4.432967032967033,
"c... |
"""basic 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-base... | {
"repo_name": "forever-Agriculture/lyrics_site",
"path": "src/basic/urls.py",
"copies": "1",
"size": "2193",
"license": "bsd-3-clause",
"hash": 129294391721863360,
"line_mean": 44.6875,
"line_max": 106,
"alpha_frac": 0.6771545828,
"autogenerated": false,
"ratio": 3.317700453857791,
"config_test... |
basic_url = "/?length=1&comment0=test+comment&func0=KEY&skey0%5B%5D=CTRL&skey0%5B%5D=ALT&skeyValue0=i&Window0=ahk_exe+chrome.exe&Program0=chrome.exe&option0=ActivateOrOpen"
basic_hotstring_url = (
"/?indexes=0&comment0=&func0=STRING&skeyValue0=btw&input0=by+the+way&option0=Replace"
)
public_examples = [
"/?le... | {
"repo_name": "mshafer1/AHK-generator",
"path": "__tests__/test_data.py",
"copies": "1",
"size": "7927",
"license": "mit",
"hash": 8924907847727345000,
"line_mean": 96.8641975309,
"line_max": 917,
"alpha_frac": 0.7020310332,
"autogenerated": false,
"ratio": 2.228563396120326,
"config_test": tru... |
#Basic UserBot used to respond when im offline
#Feel free to use, make sure you give credit. :)
#Created by Sanjay
#Discord.py Library
import discord
from discord.ext import commands
import random
import logging
logging.basicConfig(level=logging.INFO) #Logs command prompt
#Basic Bot Info
description = '... | {
"repo_name": "Sanjay-B/Sanjay-DiscordBot",
"path": "SanjayBot/Bot.py",
"copies": "1",
"size": "2591",
"license": "mit",
"hash": -8926236135338717000,
"line_mean": 20.5304347826,
"line_max": 244,
"alpha_frac": 0.6703975299,
"autogenerated": false,
"ratio": 3.4182058047493404,
"config_test": fal... |
basic_user = dict()
basic_user['passphrase'] = "tree weekend ceiling awkward universe pyramid glimpse raven pair lounge grant grief"
basic_user['username'] = "Royal Defensive Solenodon"
basic_user['public_key'] = "0x042e0309b5f6bedee93a1b984af08f89a101aff62d01ddd0a1c8f4a1d4db3b91e648c914019d09de9f07dd" \
... | {
"repo_name": "status-im/status-react",
"path": "test/appium/tests/users.py",
"copies": "1",
"size": "27323",
"license": "mpl-2.0",
"hash": 1669922134805529000,
"line_mean": 69.4097938144,
"line_max": 129,
"alpha_frac": 0.7481972254,
"autogenerated": false,
"ratio": 2.59908667110646,
"config_te... |
"""Basic User Forms"""
from django import forms
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
class UserCreationForm(forms.ModelForm):
"""
A form for creating new users.
Includes all the required fields, plus a repeated password.
"""
error_... | {
"repo_name": "codetigerco/django-base-project",
"path": "app/apps/users/forms.py",
"copies": "1",
"size": "2433",
"license": "mit",
"hash": 5891532674305261000,
"line_mean": 32.3287671233,
"line_max": 75,
"alpha_frac": 0.6124126593,
"autogenerated": false,
"ratio": 4.590566037735849,
"config_t... |
# Basic Username and Password Authentication
import os
import base64
from Crypto.Protocol.KDF import PBKDF2
from auth_core.errors import AuthenticationError
from auth_core.internal.entities import AuthUserMethodEntity
from auth_core.internal.entities import AuthUserEntity
from auth_core.appengine_tools import get_res... | {
"repo_name": "digibodies/auth_core",
"path": "auth_core/providers/basic.py",
"copies": "1",
"size": "3338",
"license": "mit",
"hash": 6085971184538637000,
"line_mean": 26.5950413223,
"line_max": 100,
"alpha_frac": 0.6650689035,
"autogenerated": false,
"ratio": 3.513684210526316,
"config_test":... |
"""Basic utilities for common scripting tasks.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import logging
import time
LOG_LEVELS = (logging.NOTSET, logging.INFO, logging.DEBUG, logging.WARNING,
logging.ERROR, logging.CRITICAL)
def setup_logging(filename=None, verbose=False, level=-1,
... | {
"repo_name": "sdaxen/python_utilities",
"path": "python_utilities/scripting.py",
"copies": "1",
"size": "2291",
"license": "mit",
"hash": 8674667660471968000,
"line_mean": 34.2461538462,
"line_max": 76,
"alpha_frac": 0.6359668267,
"autogenerated": false,
"ratio": 4.180656934306569,
"config_tes... |
"""Basic utilities for pytorch code"""
from random import getrandbits
import tensorflow as tf
import torch
from torch.autograd import Variable
# https://gist.github.com/kingspp/3ec7d9958c13b94310c1a365759aa3f4
# Pyfunc Gradient Function
def _py_func_with_gradient(func, inp, Tout, stateful=True, name=None,
... | {
"repo_name": "carlini/cleverhans",
"path": "cleverhans/utils_pytorch.py",
"copies": "1",
"size": "2819",
"license": "mit",
"hash": 4908063382035603000,
"line_mean": 31.0340909091,
"line_max": 74,
"alpha_frac": 0.6438453352,
"autogenerated": false,
"ratio": 3.351961950059453,
"config_test": fal... |
"""Basic utilities for pytorch code"""
import warnings
from random import getrandbits
import numpy as np
import tensorflow as tf
import torch
from torch.autograd import Variable
# https://gist.github.com/kingspp/3ec7d9958c13b94310c1a365759aa3f4
# Pyfunc Gradient Function
def _py_func_with_gradient(func, inp, Tout, ... | {
"repo_name": "cleverhans-lab/cleverhans",
"path": "cleverhans_v3.1.0/cleverhans/utils_pytorch.py",
"copies": "1",
"size": "3105",
"license": "mit",
"hash": -3762451188022867000,
"line_mean": 31.0103092784,
"line_max": 86,
"alpha_frac": 0.6264090177,
"autogenerated": false,
"ratio": 3.46540178571... |
""" Basic utility functions for python-tidegates.
This contains basic file I/O, coversion, and spatial analysis functions
to support the python-tidegates library. In most cases, these functions
are simply wrappers around their ``arcpy`` counter parts. This was done
so that in the future, these functions could be repla... | {
"repo_name": "Geosyntec/python-tidegates",
"path": "tidegates/utils.py",
"copies": "1",
"size": "36819",
"license": "bsd-3-clause",
"hash": 8801695094315054000,
"line_mean": 27.2354294479,
"line_max": 113,
"alpha_frac": 0.6223960455,
"autogenerated": false,
"ratio": 4.006856023506367,
"config_... |
"""Basic variable types."""
import functools
from ..variable import Variable
class List(Variable):
"""List of things."""
class _ListAttributes:
def __init__(self, item_class):
self._item_class = item_class
self.list_attributes = {
"count": (String, List.count)... | {
"repo_name": "javitonino/tosh",
"path": "tosh/vars/basic.py",
"copies": "1",
"size": "2982",
"license": "bsd-3-clause",
"hash": -3333659871043072500,
"line_mean": 27.4,
"line_max": 107,
"alpha_frac": 0.571093226,
"autogenerated": false,
"ratio": 4.26,
"config_test": false,
"has_no_keywords":... |
# Takes the given file and tag as argument,
# and saves a copy to run dir/VC with incremental number and tag
# Input: c:/dir1/dir2/file.py "tag"
# Saved Output: c:/dir1/dir2/VC/file_0001_tag.py
# Can add extra argument as follows -v to increment first number of series.
# files example (notepad++ F5): python c:\users... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578592_Offline_VersiControl_online/recipe-578592.py",
"copies": "1",
"size": "3520",
"license": "mit",
"hash": -2384078643216485400,
"line_mean": 30.1504424779,
"line_max": 148,
"alpha_frac": 0.5860795455,
"autogenerated": false,
"ratio": ... |
"""Basic ways to send emails."""
import mimetypes
import os
from base64 import b64encode
from email.header import decode_header
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from ..utils import chunks
from .base import MessageModel, Model, Mode... | {
"repo_name": "Stranger6667/postmarker",
"path": "src/postmarker/models/emails.py",
"copies": "1",
"size": "17898",
"license": "mit",
"hash": -1944696896275470300,
"line_mean": 31.0752688172,
"line_max": 119,
"alpha_frac": 0.5814057437,
"autogenerated": false,
"ratio": 4.2807940684046875,
"conf... |
"""Basic webapp for editing tensors."""
import os.path
import argparse
import shutil
import base64
import PIL
from flask import Flask, render_template, url_for, request
from tensor import TensorManager
from utils import HERE
STATIC = os.path.join(HERE, "static")
app = Flask(__name__)
AUDIT_LOG_FNAME = "audit.log"... | {
"repo_name": "JIC-Image-Analysis/leaf-cell-polarisation-tensors",
"path": "scripts/webapp.py",
"copies": "1",
"size": "4495",
"license": "mit",
"hash": -6725262052931231000,
"line_mean": 29.5782312925,
"line_max": 115,
"alpha_frac": 0.6066740823,
"autogenerated": false,
"ratio": 3.46836419753086... |
""" Basic web interface. """
import urllib
import lib.csp
import lib.http
import lib.utils
import lib.webinterface
from settings import WEBINTERFACE_URI
style = '%(autocsp)s/static/style.css'
@lib.webinterface.csp({'style-src': [style]})
@lib.webinterface.path('/')
def index(req):
""" Displays the index websi... | {
"repo_name": "qll/autoCSP",
"path": "autocsp/webinterface/core.py",
"copies": "1",
"size": "4987",
"license": "mit",
"hash": 3960780992491095600,
"line_mean": 39.5447154472,
"line_max": 80,
"alpha_frac": 0.5849207941,
"autogenerated": false,
"ratio": 3.7133283693224124,
"config_test": false,
... |
"""Basic widgets and various utility functions.
"""
###########
# Imports #
###########
import pygame
from .const import *
from . import widget
from .errors import PguError
#############
# Functions #
#############
# Turns a descriptive string or a tuple into a pygame color
def parse_color(desc):
if (is_color(... | {
"repo_name": "ftuyama/TEEG",
"path": "pgu/gui/basic.py",
"copies": "2",
"size": "5397",
"license": "mit",
"hash": 1574993493486523400,
"line_mean": 28.9833333333,
"line_max": 91,
"alpha_frac": 0.5845840282,
"autogenerated": false,
"ratio": 3.863278453829635,
"config_test": false,
"has_no_key... |
"""Basic widgets and various utility functions.
"""
###########
# Imports #
###########
import pygame
from .const import *
from . import widget
from .errors import PguError
#############
# Functions #
#############
# Turns a descriptive string or a tuple into a pygame color
def parse_color(desc):
if (is_color... | {
"repo_name": "ProfMobius/ThinLauncher",
"path": "pgu/gui/basic.py",
"copies": "1",
"size": "5408",
"license": "apache-2.0",
"hash": 7793900255120331000,
"line_mean": 28.5519125683,
"line_max": 91,
"alpha_frac": 0.5833949704,
"autogenerated": false,
"ratio": 3.811134601832276,
"config_test": fa... |
""" Basic wiki using webpy 0.3 """
import web
import model
import markdown
### Url mappings
urls = (
'/', 'Index',
'/new', 'New',
'/edit/(\d+)', 'Edit',
'/delete/(\d+)', 'Delete',
'/(.*)', 'Page',
)
### Templates
t_globals = {
'datestr': web.datestr,
'markdown': markdown.markdown,
}
rend... | {
"repo_name": "urmyfaith/notes_web_py",
"path": "basic/wiki/wiki.py",
"copies": "1",
"size": "2914",
"license": "apache-2.0",
"hash": -1356219537951365000,
"line_mean": 23.4957983193,
"line_max": 76,
"alpha_frac": 0.547700755,
"autogenerated": false,
"ratio": 3.5278450363196128,
"config_test": ... |
"""Basic word2vec example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
import os
import random
import zipfile
import numpy as np
from six.moves import urllib
from six.moves import xrange # pylint: disable=redefined-bu... | {
"repo_name": "infilect/ml-course1",
"path": "deep-learning-tensorflow/week3/word2vec/script/word2vec_basic.py",
"copies": "2",
"size": "8907",
"license": "mit",
"hash": 3351222668591675000,
"line_mean": 34.7710843373,
"line_max": 85,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 3... |
# Basic workflow engine.
# FIXME: This might become ugly and might require redesigning
from clienty.models import Client, OwnCompany
def workflow_processor(request):
"""
Processor which takes care of the workflow.
Currently is very simple and returns a dict with some useful keys.
"""
tabs_list... | {
"repo_name": "prabhu/invoicy",
"path": "invoicy/common/utils/context_processors.py",
"copies": "1",
"size": "1344",
"license": "bsd-3-clause",
"hash": 1240872114739411200,
"line_mean": 34.3947368421,
"line_max": 83,
"alpha_frac": 0.5848214286,
"autogenerated": false,
"ratio": 4.122699386503068,
... |
# basic_wsgi_pdf_server.py
# Basic WSGI PDF server in Python.
# Adapted from:
# http://www.reddit.com/r/Python/comments/1eboql/python_website_tuts_that_dont_use_django/c9z3qyz
from PDFWriter import PDFWriter
from wsgiref.simple_server import make_server
host = 'localhost'
port = 8888
def app(environ, start_response... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578798_A_basic_WSGI_PDF_server/recipe-578798.py",
"copies": "1",
"size": "1333",
"license": "mit",
"hash": -8048248867980720000,
"line_mean": 27.9782608696,
"line_max": 97,
"alpha_frac": 0.6384096024,
"autogenerated": false,
"ratio": 3.267... |
# Import system modules
import sys, string, os, win32com.client
from urllib import urlretrieve
# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1") # Create the geoprocessor object
gp.CheckOutExtension("spatial") # Check out the req... | {
"repo_name": "scw/global-threats-model",
"path": "Basins/basinBuild.py",
"copies": "1",
"size": "3284",
"license": "apache-2.0",
"hash": -5526974529400361000,
"line_mean": 33.6956521739,
"line_max": 99,
"alpha_frac": 0.6641291108,
"autogenerated": false,
"ratio": 2.9854545454545454,
"config_te... |
# basinBump.py
# Rebuilds an elevation model with breaks (increase elevation), burns (decrease elevation)
# and drains (assign nodata locations). These forcings allow an accurate hydrological
# deliniation for the elevation surface. Also allows changes in the
#
# Author: scw <walbridge@nceas.ucsb.edu>
# Date: 3... | {
"repo_name": "scw/global-threats-model",
"path": "Basins/basinBump.py",
"copies": "1",
"size": "4786",
"license": "apache-2.0",
"hash": 5294776984701522000,
"line_mean": 33.7164179104,
"line_max": 105,
"alpha_frac": 0.5865022984,
"autogenerated": false,
"ratio": 2.904126213592233,
"config_test... |
# Import system modules
import sys, string, os
# Create the geoprocessor object
try:
import arcgisscripting
gp = arcgisscripting.create()
except:
import win32com.client
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
# Geoprocessor configuration
gp.CheckOutExtension(... | {
"repo_name": "scw/global-threats-model",
"path": "Basins/basinPours.py",
"copies": "1",
"size": "2415",
"license": "apache-2.0",
"hash": 8851062036922395000,
"line_mean": 31.0821917808,
"line_max": 120,
"alpha_frac": 0.6451345756,
"autogenerated": false,
"ratio": 3.088235294117647,
"config_tes... |
# basis classes for ccsnmultivar
from sklearn.decomposition import FastICA, SparsePCA, DictionaryLearning
import numpy as np
class PCA(object):
"""
Performs SVD: Y = USV^\dagger
PCA has 4 methods:
- fit(waveforms)
update class instance with pca fit, done via svd
- fit_transform()
... | {
"repo_name": "bwengals/ccsnmultivar",
"path": "ccsnmultivar/basis.py",
"copies": "1",
"size": "10375",
"license": "mit",
"hash": -2263022823153678600,
"line_mean": 32.3601286174,
"line_max": 96,
"alpha_frac": 0.5529638554,
"autogenerated": false,
"ratio": 4.301409618573798,
"config_test": fals... |
"""Basis class for all KNX/IP bodies."""
from __future__ import annotations
from abc import ABC, abstractmethod
import logging
from typing import TYPE_CHECKING, ClassVar, cast
from .error_code import ErrorCode
from .knxip_enum import KNXIPServiceType
if TYPE_CHECKING:
from xknx.xknx import XKNX
logger = logging... | {
"repo_name": "XKNX/xknx",
"path": "xknx/knxip/body.py",
"copies": "1",
"size": "1179",
"license": "mit",
"hash": -1483400822609146000,
"line_mean": 24.6304347826,
"line_max": 75,
"alpha_frac": 0.6539440204,
"autogenerated": false,
"ratio": 3.4473684210526314,
"config_test": false,
"has_no_ke... |
"""Basis vector search strategies."""
class Strategy:
"""A base class for basis vector search strategies."""
phil_help = None
phil_scope = None
def __init__(self, max_cell, params=None, *args, **kwargs):
"""Construct the strategy.
Args:
max_cell (float): An estimate of ... | {
"repo_name": "dials/dials",
"path": "algorithms/indexing/basis_vector_search/strategy.py",
"copies": "1",
"size": "1077",
"license": "bsd-3-clause",
"hash": 1843951595191567400,
"line_mean": 30.6764705882,
"line_max": 88,
"alpha_frac": 0.6118848654,
"autogenerated": false,
"ratio": 4.45041322314... |
# basketball.py
# NBA Player Statistics Workshop for the
# Georgetown University Data Science Certificate Program
# 09/19/2015
# by Ben Benfort and Rebecca Bilbro
"""
Welcome!
The NBA Player Statistics Workshop:
Given a dataset of NBA players performance and salary in 2014, use Python to
load the dataset and comp... | {
"repo_name": "georgetown-analytics/nba",
"path": "basketball.py",
"copies": "1",
"size": "9332",
"license": "mit",
"hash": -2759191377668119000,
"line_mean": 27.8024691358,
"line_max": 195,
"alpha_frac": 0.6687741106,
"autogenerated": false,
"ratio": 3.9914456800684346,
"config_test": false,
... |
#Basketball
import bs
import bsUtils
import math
import random
# This game is played with the same rules as the classic American sport, Bombsquad style!
# Featuring: a hoop, fouls, foul shots, jump-balls, three-pointers, a referee, and two teams ready to duke it out.
# Dedicated to - David
def bsGetAPIVersi... | {
"repo_name": "Mrmaxmeier/BombSquad-Community-Mod-Manager",
"path": "mods/Basketball.py",
"copies": "1",
"size": "19339",
"license": "unlicense",
"hash": 8725644954171575000,
"line_mean": 44.6,
"line_max": 153,
"alpha_frac": 0.5193133047,
"autogenerated": false,
"ratio": 3.8257171117705244,
"co... |
""" BasketEvaluator analyses co-occurrences to get the similarity """
import evaluator
import pickle
import os
from log import LOGGER
def analyse_baskets(baskets):
""" This function analyse the co-occurrance of baskets """
item_counts = {}
item_cooccurrence = {}
total_count = 0
for basket in basket... | {
"repo_name": "StackResys/Stack-Resys",
"path": "src/evaluation/basket_analysis.py",
"copies": "1",
"size": "2931",
"license": "bsd-3-clause",
"hash": 4438805904776238600,
"line_mean": 34.743902439,
"line_max": 75,
"alpha_frac": 0.5895598772,
"autogenerated": false,
"ratio": 3.9184491978609626,
... |
"""bastasks constants are here
"""
from enum import Enum
from os import getpid
from socket import gethostname
BASHTASKS = 'bashtasks'
TASK_RESPONSES_POOL = 'bashtasks:pool:responses'
TASK_REQUESTS_POOL = 'bashtasks:pool:requests'
RESPONSES = 'responses'
REQUESTS = 'requests'
class Destination(Enum):
responses_p... | {
"repo_name": "javierarilos/bashtasks",
"path": "src/bashtasks/constants.py",
"copies": "1",
"size": "1168",
"license": "apache-2.0",
"hash": -5078807422286484000,
"line_mean": 30.5675675676,
"line_max": 86,
"alpha_frac": 0.6284246575,
"autogenerated": false,
"ratio": 4.156583629893238,
"config... |
"""Bastionification utility.
A bastion (for another object -- the 'original') is an object that has
the same methods as the original but does not give access to its
instance variables. Bastions have a number of uses, but the most
obvious one is to provide code executing in restricted mode with a
safe interface to an ... | {
"repo_name": "OS2World/APP-INTERNET-torpak_2",
"path": "Lib/Bastion.py",
"copies": "3",
"size": "5619",
"license": "mit",
"hash": 3524700695287147500,
"line_mean": 30.7457627119,
"line_max": 74,
"alpha_frac": 0.6424630717,
"autogenerated": false,
"ratio": 4.071739130434783,
"config_test": true... |
# Bastion Stack
#
# This stack configures our bastion host(s).
# http://en.wikipedia.org/wiki/Bastion_host
#
# These hosts are the only SSH entrypoint into the VPC. To SSH to a host inside
# the VPC you must first SSH to a bastion host, and then SSH from that host to
# another inside the VPC.
from troposphere import R... | {
"repo_name": "EnTeQuAk/stacker",
"path": "stacker/blueprints/bastion.py",
"copies": "2",
"size": "4214",
"license": "bsd-2-clause",
"hash": 3836770634676303400,
"line_mean": 40.3137254902,
"line_max": 79,
"alpha_frac": 0.5211200759,
"autogenerated": false,
"ratio": 4.412565445026178,
"config_t... |
'''bataille navale
. les bateaux doivent être espacé d'une case.
. taille maxi est de (26, 26)
. pour plus de bateaux definir differents noms comme:
NAVIRES = {'porteavion1':5,
'porteavion2':4
'croiseur': 3,
'corvette':2,
'sousmarin1':1,
's... | {
"repo_name": "nirinA/scripts_python",
"path": "bataille_navale.py",
"copies": "1",
"size": "9585",
"license": "unlicense",
"hash": 7935112251854718000,
"line_mean": 36.1828793774,
"line_max": 123,
"alpha_frac": 0.4715362076,
"autogenerated": false,
"ratio": 3.5924812030075186,
"config_test": f... |
''' Batch Calculator setup script '''
from setuptools import setup
APP = "batchcalc/zbc.py"
AUTHOR = "Lukasz Mentel"
AUTHOR_EMAIL = "lmmentel@gmail.com"
DESCRIPTION = "Script for calculating batch composition of zeoliteis"
LICENSE = open('LICENSE.txt').read()
NAME = "batchcalc"
URL = "https://bitbucket.org/lukaszment... | {
"repo_name": "lmmentel/batchcalculator",
"path": "setup.py",
"copies": "1",
"size": "1213",
"license": "mit",
"hash": 5784888541179721000,
"line_mean": 21.8867924528,
"line_max": 69,
"alpha_frac": 0.5869744435,
"autogenerated": false,
"ratio": 3.5159420289855072,
"config_test": false,
"has_n... |
# Batch change notification preferences
import requests
import json
params = {}
# Dict of all notifications to change
notifications = {
"on":["new_file_added"],
"off":["grade_weight_changed"]
}
def get_students(courses, params):
# Gets all student IDs from a course
course_and_student_list = []
sisids = []
... | {
"repo_name": "jasongwartz/CanvasHelper",
"path": "code/canvashelper/notifications.py",
"copies": "1",
"size": "2269",
"license": "mit",
"hash": 6876605722356688000,
"line_mean": 29.6621621622,
"line_max": 99,
"alpha_frac": 0.6928162186,
"autogenerated": false,
"ratio": 3.0456375838926175,
"con... |
"""Batch CLI provide a simple API to manage batch process via CLI.
The API can be used when one or more tasks need to be executed
providing output messages to the user.
It is also possible to request input to the user.
Author: siasi@cisco.com
Date: December 2013
"""
class TaskEngine():
"""The Task Engine is able... | {
"repo_name": "siasi/batchcli",
"path": "batchcli/batchcli.py",
"copies": "1",
"size": "10053",
"license": "bsd-3-clause",
"hash": 6676972620344258000,
"line_mean": 30.5141065831,
"line_max": 98,
"alpha_frac": 0.5827116284,
"autogenerated": false,
"ratio": 4.335058214747736,
"config_test": fals... |
""" Batched Gumbel SoftMax
Adapt it to sequence modeling.
Paper:
CATEGORICAL REPARAMETERIZATION WITH GUMBEL-SOFTMAX
https://arxiv.org/abs/1611.01144
The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables
https://arxiv.org/abs/1611.00712
Code:
https://github.com/ericjang/... | {
"repo_name": "tokestermw/text-gan-tensorflow",
"path": "distributions.py",
"copies": "1",
"size": "2645",
"license": "mit",
"hash": 5210981906375471000,
"line_mean": 33.3506493506,
"line_max": 115,
"alpha_frac": 0.6926275992,
"autogenerated": false,
"ratio": 3.4756898817345596,
"config_test": ... |
#batch_effect_remove.py
from Betsy.protocol_utils import Parameter
import normalize_file
PRETTY_NAME = "Remove batch effects."
COMMON = 'Common Parameters'
NORMALIZE = 'Normalize Parameters'
OPTIONAL = 'Optional Parameters'
ILLUMINA = 'Illumina Normalize Parameters'
CLASS_NEIGHBORS = 'Class Neighbor Parameters'
CATEGOR... | {
"repo_name": "jefftc/changlab",
"path": "Betsy/attic/protocols/batch_effect_remove.py",
"copies": "1",
"size": "15031",
"license": "mit",
"hash": 3691765984072206000,
"line_mean": 45.8255451713,
"line_max": 85,
"alpha_frac": 0.5091477613,
"autogenerated": false,
"ratio": 4.303177784139708,
"co... |
'''Batching with gevent'''
import sys
from six import reraise
if 'threading' in sys.modules:
del sys.modules['threading']
from gevent import monkey
monkey.patch_all()
from gevent.pool import Pool
class Proxy(object):
'''A proxy that will run a function on a new connection in a gevent pool'''
def __init__... | {
"repo_name": "seomoz/s3po",
"path": "s3po/batch.py",
"copies": "1",
"size": "2138",
"license": "mit",
"hash": -2283300322514831000,
"line_mean": 29.5428571429,
"line_max": 79,
"alpha_frac": 0.6169317119,
"autogenerated": false,
"ratio": 4.1353965183752415,
"config_test": false,
"has_no_keywo... |
""" Batch loader of PTB data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from collections import Counter
from contextlib import contextmanager
import numpy as np
import tensorflow as tf
# -- local imports
from utils import maybe_save, st... | {
"repo_name": "tokestermw/text-gan-tensorflow",
"path": "data_loader.py",
"copies": "1",
"size": "4780",
"license": "mit",
"hash": 565826208284818050,
"line_mean": 29.641025641,
"line_max": 128,
"alpha_frac": 0.620292887,
"autogenerated": false,
"ratio": 3.481427530954115,
"config_test": false,... |
#
# This script is intended for use at the command line for headless operation of
# ImageJ/Fiji. To use this script, enter the following command:
#
# ./ImageJ-macosx --headless /path/to/script/batch_merge_channels.py img_directory first_letter_of_colors
#
# Replace ./ImageJ-macosx with your platform's ImageJ launcher.
... | {
"repo_name": "deniclab/pyto_seg_slurm",
"path": "preprocessing/batch_merge_channels.py",
"copies": "1",
"size": "9916",
"license": "mit",
"hash": 7089769590273922000,
"line_mean": 34.797833935,
"line_max": 105,
"alpha_frac": 0.6609519968,
"autogenerated": false,
"ratio": 3.1771867991028517,
"c... |
"""Batch Normalization for TensorFlow.
Parag K. Mital, Jan 2016.
"""
import tensorflow as tf
from tensorflow.python import control_flow_ops
def batch_norm(x, phase_train, name='bn', decay=0.99, reuse=None, affine=True):
"""
Batch normalization on convolutional maps.
from: https://stackoverflow.com/questi... | {
"repo_name": "dariox2/CADL",
"path": "session-4/libs/batch_norm.py",
"copies": "6",
"size": "2360",
"license": "apache-2.0",
"hash": -212658302508457900,
"line_mean": 35.3076923077,
"line_max": 79,
"alpha_frac": 0.5508474576,
"autogenerated": false,
"ratio": 3.8815789473684212,
"config_test": ... |
"""Batch Normalization for TensorFlow.
Parag K. Mital, Jan 2016.
"""
import tensorflow as tf
from tensorflow.python import control_flow_ops
def batch_norm(x, phase_train, name='bn', decay=0.9, reuse=None,
affine=True):
"""
Batch normalization on convolutional maps.
from: https://stackoverf... | {
"repo_name": "dariox2/CADL",
"path": "session-5/libs/batch_norm.py",
"copies": "2",
"size": "2273",
"license": "apache-2.0",
"hash": -1261399721939072300,
"line_mean": 35.0793650794,
"line_max": 79,
"alpha_frac": 0.552133744,
"autogenerated": false,
"ratio": 4.023008849557522,
"config_test": f... |
"""Batch Normalization for TensorFlow.
Parag K. Mital, Jan 2016.
"""
import tensorflow as tf
from tensorflow.python import control_flow_ops
def batch_norm(x, phase_train, scope='bn', affine=True):
"""
Batch normalization on convolutional maps.
from: https://stackoverflow.com/questions/33949786/how-could... | {
"repo_name": "hpssjellis/deeplearnjs-javascript-examples",
"path": "Unordered-tensorflow-examples/tensorflow-tutorials/libs/batch_norm.py",
"copies": "2",
"size": "1948",
"license": "mit",
"hash": 8737466995088575000,
"line_mean": 29.9206349206,
"line_max": 75,
"alpha_frac": 0.5657084189,
"autogen... |
"""Batch Normalization for TensorFlow.
Parag K. Mital, Jan 2016.
"""
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
def batch_norm(x, phase_train, name='bn', decay=0.99, reuse=None, affine=True):
"""
Batch normalization on convolutional maps.
from: https://stackoverflow.com/qu... | {
"repo_name": "alvaroing12/CADL",
"path": "session-4/libs/batch_norm.py",
"copies": "11",
"size": "2364",
"license": "apache-2.0",
"hash": -2318096027573014000,
"line_mean": 35.3692307692,
"line_max": 79,
"alpha_frac": 0.5511844332,
"autogenerated": false,
"ratio": 3.875409836065574,
"config_te... |
"""Batch Normalization for TensorFlow.
Parag K. Mital, Jan 2016.
"""
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
def batch_norm(x, phase_train, name='bn', decay=0.9, reuse=None,
affine=True):
"""
Batch normalization on convolutional maps.
from: https://stacko... | {
"repo_name": "niazangels/CADL",
"path": "session-5/libs/batch_norm.py",
"copies": "5",
"size": "2277",
"license": "apache-2.0",
"hash": -7858950753528225000,
"line_mean": 35.1428571429,
"line_max": 79,
"alpha_frac": 0.5524813351,
"autogenerated": false,
"ratio": 4.015873015873016,
"config_test... |
"""Batch Normalization for TensorFlow.
Parag K. Mital, Jan 2016.
"""
import tensorflow as tf
def batch_norm(x, phase_train, scope='bn', affine=True):
"""
Batch normalization on convolutional maps.
from: https://stackoverflow.com/questions/33949786/how-could-i-
use-batch-normalization-in-tensorflow
... | {
"repo_name": "apoorva-sharma/deep-frame-interpolation",
"path": "tensorflow_tutorials-master/python/libs/batch_norm.py",
"copies": "2",
"size": "1891",
"license": "mit",
"hash": 125418842906446240,
"line_mean": 29.5,
"line_max": 75,
"alpha_frac": 0.5552617663,
"autogenerated": false,
"ratio": 3.... |
## Batch Perception、Ho-Kashyap、Batch Relaxation with Margin、Single-sample Relaxation with Margin
import numpy as np
import matplotlib.pyplot as plt
import time
Y1 = np.array([[1, 0.1, 1.1], [1, 6.8, 7.1], [1, -3.5, -4.1], [1, 2.0, 2.7], [1, 4.1, 2.8], [1, 3.1, 5.0], [1, -0.8, -1.3], [1, 0.9, 1.2], [1, 5.0, 6.4], [1, ... | {
"repo_name": "Determined22/Assignments-PatternRecognition-2016Fall",
"path": "Ho-Kashyap.py",
"copies": "1",
"size": "7337",
"license": "mit",
"hash": 6381989130337360000,
"line_mean": 39.9161676647,
"line_max": 182,
"alpha_frac": 0.5193911898,
"autogenerated": false,
"ratio": 2.0348421679571174... |
"""Batch processing of the audio files."""
from audiorename.audiofile import do_job_on_audiofile
from audiorename.audiofile import mb_track_listing
from phrydy import MediaFile
import os
import phrydy
class Batch(object):
"""This class first sorts all files and then walks through all files. At
this process i... | {
"repo_name": "Josef-Friedrich/audiorename",
"path": "audiorename/batch.py",
"copies": "1",
"size": "4023",
"license": "mit",
"hash": 7326713929579518000,
"line_mean": 31.4435483871,
"line_max": 78,
"alpha_frac": 0.5620183942,
"autogenerated": false,
"ratio": 4.3165236051502145,
"config_test": ... |
# batch process
import time
import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import traceback
import logging
import sys
import urllib
sys.path.insert(0, '/opt/librarygadget/venv/lib/python2.7/site-packages')
from django.db.models import Q
from librarybot... | {
"repo_name": "bluestemscott/librarygadget",
"path": "librarygadget/librarybot/batch.py",
"copies": "1",
"size": "7845",
"license": "mit",
"hash": -2949299341143922000,
"line_mean": 39.9518716578,
"line_max": 144,
"alpha_frac": 0.6189929892,
"autogenerated": false,
"ratio": 3.3800086169754415,
... |
# batch.py
# ALS 2017/05/29
import numpy as np
import astropy.table as at
from astropy.io import ascii
import os
import sys
import shutil
import copy
import multiprocessing as mtp
from .. import obsobj
from .. import tabtools
from . import mtp_tools
class Batch(object):
def __init__(self, survey, obj_naming_sys='sd... | {
"repo_name": "aileisun/bubbleimg",
"path": "bubbleimg/batch/batch.py",
"copies": "1",
"size": "20854",
"license": "mit",
"hash": 7926361192116188000,
"line_mean": 29.57771261,
"line_max": 193,
"alpha_frac": 0.6608804066,
"autogenerated": false,
"ratio": 2.9928243398392653,
"config_test": false... |
# batch video downloader from multiple sources
# Jose Rivera - January 2016
import os
import argparse
from subprocess import call
parser = argparse.ArgumentParser(description="Uses youtube-dl to download a list of videos specified in a text file")
parser.add_argument('-o', '--output', dest='output_path', help='Output... | {
"repo_name": "jmrr/video_downloader",
"path": "video_downloader.py",
"copies": "1",
"size": "2087",
"license": "mit",
"hash": 4033900721485992000,
"line_mean": 39.1346153846,
"line_max": 117,
"alpha_frac": 0.6339242932,
"autogenerated": false,
"ratio": 3.519392917369309,
"config_test": false,
... |
#batgen.py
from os import path
from shenv import _utils, shell
import sys
import string
def printall(iterable, file):
for line in iterable:
assert line.find('\r') == -1
assert line.find('\n') == -1
print(line,file=file)
def main(argv):
exedir, exefile = path.split(pa... | {
"repo_name": "josharnold52/shenv",
"path": "shenv/batgen.py",
"copies": "1",
"size": "1126",
"license": "bsd-2-clause",
"hash": 7704303364348037000,
"line_mean": 24.8095238095,
"line_max": 89,
"alpha_frac": 0.5719360568,
"autogenerated": false,
"ratio": 3.608974358974359,
"config_test": false,... |
# Batman will look for the hostages on a given building by jumping from one
# window to another using his grapnel gun. Batman's goal is to jump to the
# window where the hostages are located in order to disarm the bombs.
# Unfortunately he has a limited number of jumps before the bombs go off...
# Before each jum... | {
"repo_name": "Pouf/CodingCompetition",
"path": "CG/medium_shadows-of-the-knight-episode-1.py",
"copies": "1",
"size": "1400",
"license": "mit",
"hash": 7572994324423338000,
"line_mean": 33,
"line_max": 76,
"alpha_frac": 0.6357142857,
"autogenerated": false,
"ratio": 3.0434782608695654,
"config... |
# batteries included
import os
import subprocess
import time
# ansible
from ansible import utils
from ansible.module_utils._text import to_native
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
class AnsCapError(Exception):
def __init__(self, msg):
self.msg = ms... | {
"repo_name": "sean-abbott/ansible_helper_libs_role",
"path": "action_plugins/anscap.py",
"copies": "1",
"size": "1793",
"license": "bsd-3-clause",
"hash": 8086932081759459000,
"line_mean": 28.8833333333,
"line_max": 83,
"alpha_frac": 0.5850529838,
"autogenerated": false,
"ratio": 4.0022321428571... |
## batteries
import sys, os
import time
import cPickle as pickle
from functools import partial
## 3rd party
from docopt import docopt
import numpy as np
import scipy.stats as stats
import dill
from pathos.multiprocessing import ProcessingPool
## Application
import Utils
# functions
def kde_intersect(x, **kwargs):
... | {
"repo_name": "nick-youngblut/SIPSim",
"path": "SIPSim/BD_Shift.py",
"copies": "1",
"size": "6625",
"license": "mit",
"hash": 6130167165775004000,
"line_mean": 25.8218623482,
"line_max": 83,
"alpha_frac": 0.5467169811,
"autogenerated": false,
"ratio": 3.514588859416446,
"config_test": false,
... |
"""Battery Charge and Range Support for the Nissan Leaf."""
import logging
from homeassistant.components.nissan_leaf import (
DATA_BATTERY, DATA_CHARGING, DATA_LEAF, DATA_RANGE_AC, DATA_RANGE_AC_OFF,
LeafEntity)
from homeassistant.const import DEVICE_CLASS_BATTERY
from homeassistant.helpers.icon import icon_fo... | {
"repo_name": "nugget/home-assistant",
"path": "homeassistant/components/nissan_leaf/sensor.py",
"copies": "2",
"size": "3261",
"license": "apache-2.0",
"hash": -4563546394106466300,
"line_mean": 27.8584070796,
"line_max": 77,
"alpha_frac": 0.6234283962,
"autogenerated": false,
"ratio": 3.7612456... |
"""Battery Charge and Range Support for the Nissan Leaf."""
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util.distance import LENGTH_KILOMETERS, L... | {
"repo_name": "sander76/home-assistant",
"path": "homeassistant/components/nissan_leaf/sensor.py",
"copies": "5",
"size": "3269",
"license": "apache-2.0",
"hash": -6883431944498506000,
"line_mean": 27.6754385965,
"line_max": 85,
"alpha_frac": 0.6384215356,
"autogenerated": false,
"ratio": 3.74885... |
"""Battery Charge and Range Support for the Nissan Leaf."""
import logging
from homeassistant.const import DEVICE_CLASS_BATTERY
from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util.distance import LENGTH_KILOMETERS, LENGTH_MILES
from homeassistant.util.unit_system import IMPERIAL_SYSTE... | {
"repo_name": "jamespcole/home-assistant",
"path": "homeassistant/components/nissan_leaf/sensor.py",
"copies": "1",
"size": "3227",
"license": "apache-2.0",
"hash": 330083039883583100,
"line_mean": 27.3070175439,
"line_max": 77,
"alpha_frac": 0.6197706848,
"autogenerated": false,
"ratio": 3.74796... |
"""Battery Charge and Range Support for the Nissan Leaf."""
import logging
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util.distance import LENGTH_KILOMETERS, LENGTH_MILES
from homeassistant.util.unit_system import IM... | {
"repo_name": "GenericStudent/home-assistant",
"path": "homeassistant/components/nissan_leaf/sensor.py",
"copies": "10",
"size": "3184",
"license": "apache-2.0",
"hash": 4742481483933702000,
"line_mean": 27.1769911504,
"line_max": 85,
"alpha_frac": 0.6319095477,
"autogenerated": false,
"ratio": 3... |
"""Battery Charge and Range Support for the Nissan Leaf."""
import logging
from homeassistant.const import DEVICE_CLASS_BATTERY, UNIT_PERCENTAGE
from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util.distance import LENGTH_KILOMETERS, LENGTH_MILES
from homeassistant.util.unit_system impo... | {
"repo_name": "nkgilley/home-assistant",
"path": "homeassistant/components/nissan_leaf/sensor.py",
"copies": "6",
"size": "3194",
"license": "apache-2.0",
"hash": 1574025924691271200,
"line_mean": 27.2654867257,
"line_max": 85,
"alpha_frac": 0.6324358172,
"autogenerated": false,
"ratio": 3.705336... |
''' Battery discipline for CADRE '''
import numpy as np
from openmdao.core.component import Component
import KS
import rk4
# Allow non-standard variable names for scientific calc
# pylint: disable-msg=C0103
#Constants
sigma = 1e-10
eta = 0.99
Cp = 2900.0*0.001*3600.0
IR = 0.9
T0 = 293.0
alpha = np.log(1/1.1**5)
... | {
"repo_name": "hschilling/CADRE-1",
"path": "src/CADRE/battery.py",
"copies": "1",
"size": "8692",
"license": "apache-2.0",
"hash": -5736571910330797000,
"line_mean": 29.8226950355,
"line_max": 81,
"alpha_frac": 0.5077082375,
"autogenerated": false,
"ratio": 3.059486096444914,
"config_test": fa... |
"""Battery included Authentication models and Backends.
This extension requires the :mod:`lux.extensions.rest` module.
It provides models for Users, Groups and Permissions.
If you need something different you can use this extension as a guide on
how to write authentication backends and models in lux.
"""
from pulsar.u... | {
"repo_name": "quantmind/lux",
"path": "lux/ext/auth/__init__.py",
"copies": "1",
"size": "3803",
"license": "bsd-3-clause",
"hash": -7897451670932164000,
"line_mean": 33.5727272727,
"line_max": 79,
"alpha_frac": 0.6258217197,
"autogenerated": false,
"ratio": 4.442757009345795,
"config_test": f... |
''' Battery runner classes and Report classes '''
class BatteryRunner(object):
def __init__(self, checks):
self._checks = checks
def check_only(self, obj):
reports = []
for check in self._checks:
reports.append(check(obj, False))
return reports
def check_fix(s... | {
"repo_name": "yarikoptic/NiPy-OLD",
"path": "nipy/io/imageformats/batteryrunners.py",
"copies": "1",
"size": "3877",
"license": "bsd-3-clause",
"hash": 8750638024831303000,
"line_mean": 27.9328358209,
"line_max": 70,
"alpha_frac": 0.5236007222,
"autogenerated": false,
"ratio": 4.466589861751152,... |
"""Battery Upgrade: Use the final version of electric_car.py from this section.
Add a method to the Battery class called upgrade_battery(). This method
should check the battery size and set the capacity to 85 if it isn’t already.
Make an electric car with a default battery size, call get_range() once, and
then call get... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ene-Jun-2018/Juan Sleiman/Tarea 2(PyCrashCourse.9-6,9-9)/BatteryCar.py",
"copies": "1",
"size": "3352",
"license": "mit",
"hash": 5954071780586838000,
"line_mean": 34.2421052632,
"line_max": 79,
"alpha_frac": 0.6356033453,
"autogenerated": false,
"ra... |
""" Battery Upgrade: Use the final version of electric_car.py from this section.
Add a method to the Battery class called upgrade_battery(). This method
should check the battery size and set the capacity to 85 if it isn’t already.
Make an electric car with a default battery size, call get_range() once, and
then call ge... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ene-Jun-2019/Karla Berlanga/Practica 1/battery_upgrade.py",
"copies": "1",
"size": "2563",
"license": "mit",
"hash": -3326733351000429000,
"line_mean": 34.5416666667,
"line_max": 80,
"alpha_frac": 0.6365767878,
"autogenerated": false,
"ratio": 3.5690... |
# battleCommands.py
# all player battle commands
import cInfo, Globals
import random
def checkIfPlayerAlive(playerAvatar, attackingMob):
'''
check the player's hp. If it is below zero, then run death routines
'''
if playerAvatar.kind.hp <= 0:
for mob in Globals.CLIENT_DATA[playerAvatar.clientDataID].battleRoom... | {
"repo_name": "buckets1337/MotherMUD",
"path": "battleCommands.py",
"copies": "1",
"size": "5888",
"license": "apache-2.0",
"hash": 6786840832064864000,
"line_mean": 36.2658227848,
"line_max": 200,
"alpha_frac": 0.7280910326,
"autogenerated": false,
"ratio": 2.987316083206494,
"config_test": fa... |
# battle.py
import os
import random
import character
rules_file = os.getcwd() + os.sep + 'data' + os.sep + 'battle.rules'
class BattleRules(object):
"""
Manages the parsing of rules for a battle by reading the .rules file
"""
def __init__(self, rules_file):
self.rules_file = rules_file
... | {
"repo_name": "acutesoftware/virtual-AI-simulator",
"path": "vais/battle.py",
"copies": "1",
"size": "8509",
"license": "mit",
"hash": 3266552381320942600,
"line_mean": 40.1111111111,
"line_max": 156,
"alpha_frac": 0.5289693266,
"autogenerated": false,
"ratio": 3.225549658832449,
"config_test":... |
# Battleship AI
import os
import sys
import random
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
#np.random.seed(0)
BLANK = '.'
HIT = 'h'
MISS = 'm'
w = 10
h = 10
ships = [2, 3, 3, 4, 5]
ships_left = [2, 3, 3, 4, 5]
board = [[BLANK for x in range(w)] for y in range(h)]
class bcolor... | {
"repo_name": "mananshah99/game-ai",
"path": "battleship-hm.py",
"copies": "1",
"size": "8326",
"license": "mit",
"hash": 1774999331212186000,
"line_mean": 26.9395973154,
"line_max": 137,
"alpha_frac": 0.4861878453,
"autogenerated": false,
"ratio": 3.2460038986354776,
"config_test": false,
"h... |
# battleship game built while I was learning python.
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
print "Let's play Battleship!"
print_board(board)
def random_row(board):
return randint(0, len(boa... | {
"repo_name": "akshaynagpal/python_snippets",
"path": "code snippets/battleship.py",
"copies": "1",
"size": "1214",
"license": "mit",
"hash": 4930398682344177000,
"line_mean": 24.2916666667,
"line_max": 80,
"alpha_frac": 0.5930807249,
"autogenerated": false,
"ratio": 3.228723404255319,
"config_... |
"""BattleShipGame 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')
C... | {
"repo_name": "wallravit/BattleshipGameAPI",
"path": "BattleShipGame/BattleShipGame/urls.py",
"copies": "1",
"size": "1675",
"license": "apache-2.0",
"hash": 2346343386172780000,
"line_mean": 37.0681818182,
"line_max": 93,
"alpha_frac": 0.72,
"autogenerated": false,
"ratio": 3.6732456140350878,
... |
#Battleship idea from CodeAcademy implemented in CodeSkupltor
#Global calls
import random, simplegui
board1 = []
board2 = []
ship = []
n = "10"
c_size = 600
message = "Welcome to Battleship!"
ds = '--'
used_space = []
# Helper Functions to create the objects placed in the canvase
def create_board1():
### !!!This ... | {
"repo_name": "bpraggastis/My-Battleship",
"path": "battleship_codeskupt.py",
"copies": "1",
"size": "8139",
"license": "mit",
"hash": -3760394972052981000,
"line_mean": 28.1720430108,
"line_max": 144,
"alpha_frac": 0.5388868411,
"autogenerated": false,
"ratio": 3.209384858044164,
"config_test"... |
# Battleship.py
# Siharde oussama
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
print "Let's play Battleship!"
print_board(board)
def random_row(board):
return randint(0, len(board) - 1)
def random_col(board):
return randi... | {
"repo_name": "OussamaSiharde/CodeMaker",
"path": "Battleship.py",
"copies": "1",
"size": "1075",
"license": "mit",
"hash": 2287222503401506600,
"line_mean": 26.5641025641,
"line_max": 72,
"alpha_frac": 0.6930232558,
"autogenerated": false,
"ratio": 2.7777777777777777,
"config_test": false,
"... |
""" Battleships competition with multiple entries. """
from game import GameRunner, Player
from Queue import Queue
from threading import Thread
class Entry(object):
""" Represents an entry in the competition. """
def __init__(self, ai_id, ai):
self.id = ai_id
self.ai = ai
self._result... | {
"repo_name": "southampton-code-dojo/battleships",
"path": "server/competition.py",
"copies": "1",
"size": "3290",
"license": "mit",
"hash": 3867200064075240000,
"line_mean": 29.1834862385,
"line_max": 84,
"alpha_frac": 0.5285714286,
"autogenerated": false,
"ratio": 3.5956284153005464,
"config_... |
""" Battleships game components. """
from copy import copy
# Useful constants
HORIZONTAL = 0
VERTICAL = 1
# Use a 10x10 board
BOARD_SIZE = 10
# Just used for formatting output
SHIP_NAMES = {
1: "Submarine",
2: "Destroyer",
3: "Cruiser",
4: "Battleship",
5: "Aircraft Carrier"
}
# Default Ships av... | {
"repo_name": "southampton-code-dojo/battleships",
"path": "server/game.py",
"copies": "1",
"size": "7401",
"license": "mit",
"hash": 2816808321188556000,
"line_mean": 27.4692307692,
"line_max": 105,
"alpha_frac": 0.5410079719,
"autogenerated": false,
"ratio": 3.897314375987362,
"config_test": ... |
################# Battles ####################
class battle:
def __init__(self,player,enemy,screen):
self.player=player
self.enemy=enemy
self.screen=screen
self.screenMessage=""
self.curMenu=battleMenu("dialog",["bananaHammock"])
screen.curBattle=self
for i... | {
"repo_name": "mgavrin/Punkemon",
"path": "Battles.py",
"copies": "1",
"size": "28672",
"license": "mit",
"hash": -6734619191777406000,
"line_mean": 48.180102916,
"line_max": 171,
"alpha_frac": 0.5770089286,
"autogenerated": false,
"ratio": 3.966247060450961,
"config_test": false,
"has_no_key... |
ba_type1_subtypes = ["BA", "BR", "LAPC", "SETL", "SAVL", "NOP"]
def dump_rcp(instr):
subtype = (instr >> 9) & 0x3;
return ["RCP", "RSQ", "LOG", "EXP"][subtype]
def dump_min(instr):
subtype = (instr >> 9) & 0x1;
return ["MIN", "MAX"][subtype]
def dump_ba(instr):
type1 = (instr >> 20) & 0x3;
type1_subtype = (ins... | {
"repo_name": "zhuowei/SGX5Dec",
"path": "nams.py",
"copies": "1",
"size": "1139",
"license": "bsd-2-clause",
"hash": 4582900051063077000,
"line_mean": 31.5714285714,
"line_max": 95,
"alpha_frac": 0.5776997366,
"autogenerated": false,
"ratio": 2.2073643410852712,
"config_test": false,
"has_no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.