text stringlengths 0 1.05M | meta dict |
|---|---|
"Ordered dictionary"
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'
# A... | {
"repo_name": "sadmansk/servo",
"path": "tests/wpt/web-platform-tests/tools/third_party/funcsigs/funcsigs/odict.py",
"copies": "48",
"size": "8924",
"license": "mpl-2.0",
"hash": 7541287956512465000,
"line_mean": 33.1915708812,
"line_max": 87,
"alpha_frac": 0.5482967279,
"autogenerated": false,
"... |
"Ordered dictionary"
try:
from thread import get_ident as _get_ident
except ImportError:
try:
from dummy_thread import get_ident as _get_ident
except ImportError:
# Ensure that this module is still importable under Pythhon3 to avoid
# crashing code-inspecting tools like nose.
... | {
"repo_name": "zhenv5/scikit-learn",
"path": "sklearn/externals/odict.py",
"copies": "63",
"size": "9149",
"license": "bsd-3-clause",
"hash": 3728186546192653000,
"line_mean": 33.3947368421,
"line_max": 87,
"alpha_frac": 0.5513170838,
"autogenerated": false,
"ratio": 3.9882301656495205,
"config... |
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": "la0rg/Genum",
"path": "GenumCore/vendor/urllib3/packages/ordered_dict.py",
"copies": "4",
"size": "8919",
"license": "mit",
"hash": -4012058674232064000,
"line_mean": 33.3038461538,
"line_max": 87,
"alpha_frac": 0.5496131853,
"autogenerated": false,
"ratio": 3.9745989304812834,
"... |
try:
from thread import get_ident as _get_ident
except ImportError:
try:
from dummy_thread import get_ident as _get_ident
except ImportError:
from threading import get_ident as _get_ident
try:
from _abcoll import KeysView, ValuesView, ItemsView
except ImportError:
pass
class Order... | {
"repo_name": "jaredks/rumps",
"path": "rumps/packages/ordereddict.py",
"copies": "2",
"size": "9022",
"license": "bsd-3-clause",
"hash": 694670036204861600,
"line_mean": 33.4351145038,
"line_max": 87,
"alpha_frac": 0.5492130348,
"autogenerated": false,
"ratio": 3.9885057471264367,
"config_test... |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
from operator import itemgetter
from heapq import nlargest
from itertools import repeat
from six.moves import filter
from six import PY2, PY3
try:
from thread i... | {
"repo_name": "mdshw5/fastqp",
"path": "fastqp/backports/__init__.py",
"copies": "1",
"size": "13648",
"license": "mit",
"hash": 8074433893990741000,
"line_mean": 33.2080200501,
"line_max": 87,
"alpha_frac": 0.554073857,
"autogenerated": false,
"ratio": 4.183936235438382,
"config_test": false,
... |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
# http://code.activestate.com/recipes/576693/
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident as _ge... | {
"repo_name": "ohmu/poni",
"path": "poni/orddict.py",
"copies": "1",
"size": "9046",
"license": "apache-2.0",
"hash": -8002411713038816000,
"line_mean": 33.6590038314,
"line_max": 87,
"alpha_frac": 0.5485297369,
"autogenerated": false,
"ratio": 3.9658044717229286,
"config_test": false,
"has_n... |
#Author: Raymond Hettinger
#License: MIT License
#http://code.activestate.com/recipes/576693/ revision 9, downloaded 2012-03-28
from .python import iterkeys, iteritems
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident as _get_ident
try:
from _abcoll imp... | {
"repo_name": "gef756/statsmodels",
"path": "statsmodels/compat/ordereddict.py",
"copies": "33",
"size": "8996",
"license": "bsd-3-clause",
"hash": -9017335468777748000,
"line_mean": 33.3358778626,
"line_max": 87,
"alpha_frac": 0.5506891952,
"autogenerated": false,
"ratio": 3.9805309734513274,
... |
#Author: Raymond Hettinger
#License: MIT License
#http://code.activestate.com/recipes/576693/ revision 9, downloaded 2012-03-28
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
exc... | {
"repo_name": "bavardage/statsmodels",
"path": "statsmodels/compatnp/ordereddict.py",
"copies": "4",
"size": "8951",
"license": "bsd-3-clause",
"hash": -7789953414433411000,
"line_mean": 33.1641221374,
"line_max": 87,
"alpha_frac": 0.5488772204,
"autogenerated": false,
"ratio": 3.972924988903684,... |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
# Copied verbatim from http://code.activestate.com/recipes/576693/
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread i... | {
"repo_name": "spuriousdata/logrok",
"path": "logrok/compat/OrderedDict.py",
"copies": "1",
"size": "8890",
"license": "mit",
"hash": 3349309645031072300,
"line_mean": 33.1923076923,
"line_max": 87,
"alpha_frac": 0.5472440945,
"autogenerated": false,
"ratio": 3.9829749103942653,
"config_test": ... |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
# MIT-licensed from:
# http://code.activestate.com/recipes/576693/
# http://docs.python.org/2/library/collections.html#ordereddict-objects
try:
from thread im... | {
"repo_name": "kkuunnddaannkk/vispy",
"path": "vispy/ext/_bundled/ordereddict.py",
"copies": "21",
"size": "9002",
"license": "bsd-3-clause",
"hash": 1615515962663703300,
"line_mean": 32.7153558052,
"line_max": 87,
"alpha_frac": 0.5474339036,
"autogenerated": false,
"ratio": 3.9761484098939928,
... |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
try:
from thread import get_ident as _get_ident... | {
"repo_name": "develersrl/rooms",
"path": "editor/misc/odict.py",
"copies": "1",
"size": "9816",
"license": "mit",
"hash": -6477038168140754000,
"line_mean": 36.041509434,
"line_max": 91,
"alpha_frac": 0.4981662592,
"autogenerated": false,
"ratio": 4.382142857142857,
"config_test": false,
"ha... |
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
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... | {
"repo_name": "lintzc/gpdb",
"path": "src/test/tinc/ext/qautils/ordereddict.py",
"copies": "21",
"size": "8823",
"license": "apache-2.0",
"hash": 4101573683805737000,
"line_mean": 33.0656370656,
"line_max": 87,
"alpha_frac": 0.5453927236,
"autogenerated": false,
"ratio": 3.9923076923076923,
"co... |
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 inherit... | {
"repo_name": "rogerscristo/BotFWD",
"path": "env/lib/python3.6/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/ordered_dict.py",
"copies": "14",
"size": "9194",
"license": "mit",
"hash": -3156375467595982300,
"line_mean": 33.4980694981,
"line_max": 87,
"alpha_frac": 0.533173809,
"autoge... |
"""Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6,
2.7 and pypy. Passes Python2.7's test suite and incorporates all the
latest updates.
http://code.activestate.com/recipes/576693/ (r9)"""
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident... | {
"repo_name": "quaddra/provision",
"path": "provision/ordered_dict.py",
"copies": "1",
"size": "8876",
"license": "apache-2.0",
"hash": -8143347357105027000,
"line_mean": 32.8778625954,
"line_max": 87,
"alpha_frac": 0.5463046417,
"autogenerated": false,
"ratio": 3.978484984311968,
"config_test"... |
"""Backport of OrderedDict for Python 2.6.
Source: http://code.activestate.com/recipes/576693/
"""
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
cl... | {
"repo_name": "Yegorov/http-prompt",
"path": "http_prompt/ordereddict.py",
"copies": "1",
"size": "8807",
"license": "mit",
"hash": -253355278694333470,
"line_mean": 32.4866920152,
"line_max": 80,
"alpha_frac": 0.5416146247,
"autogenerated": false,
"ratio": 4.001363016810541,
"config_test": fal... |
"""Backport of selected helper functions from django.utils.timezone"""
import pytz
from django.conf import settings
# Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted prov... | {
"repo_name": "denverfoundation/storybase",
"path": "apps/storybase/utils/timezone.py",
"copies": "1",
"size": "3611",
"license": "mit",
"hash": -2100389849903356200,
"line_mean": 37.8279569892,
"line_max": 82,
"alpha_frac": 0.7280531709,
"autogenerated": false,
"ratio": 4.4415744157441575,
"co... |
# Backport of selectors.py from Python 3.5+ to support Python < 3.4
# Also has the behavior specified in PEP 475 which is to retry syscalls
# in the case of an EINTR error. This module is required because selectors34
# does not follow this behavior and instead returns that no dile descriptor
# events have occurred rath... | {
"repo_name": "thonkify/thonkify",
"path": "src/lib/telegram/vendor/urllib3/urllib3/util/selectors.py",
"copies": "2",
"size": "18840",
"license": "mit",
"hash": -1726366100447456000,
"line_mean": 34.6818181818,
"line_max": 85,
"alpha_frac": 0.5468683652,
"autogenerated": false,
"ratio": 4.447592... |
# Backport of selectors.py from Python 3.5+ to support Python < 3.4
# Also has the behavior specified in PEP 475 which is to retry syscalls
# in the case of an EINTR error. This module is required because selectors34
# does not follow this behavior and instead returns that no dile descriptor
# events have occurred ... | {
"repo_name": "ncos/lisa",
"path": "src/lisa_drive/scripts/venv/lib/python3.5/site-packages/pip-10.0.1-py3.5.egg/pip/_vendor/urllib3/util/selectors.py",
"copies": "5",
"size": "21728",
"license": "mit",
"hash": -370892482353297100,
"line_mean": 35.3975903614,
"line_max": 89,
"alpha_frac": 0.529777245... |
"""Backport of shutil.which from Python 3.5
The function is included unmodified from Python stdlib 3.5.1,
and is (C) Python
"""
import os
import sys
__version__ = '3.5.1'
def backport_which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""Given a command, mode, and a PATH string, return the path which
conforms t... | {
"repo_name": "jason-kane/PyYapf",
"path": "backports/shutil_which.py",
"copies": "1",
"size": "2588",
"license": "apache-2.0",
"hash": -752389842407376000,
"line_mean": 32.6233766234,
"line_max": 80,
"alpha_frac": 0.6182380216,
"autogenerated": false,
"ratio": 3.868460388639761,
"config_test":... |
# Backport of the match_hostname logic from python 3.5, with small
# changes to support IP address matching on python 2.6, 2.7, 3.3, and 3.4.
import re
import sys
try:
# Python 3.3+, or the ipaddress module from pypi.
from ipaddress import ip_address
except ImportError:
ip_address = lambda address: None
... | {
"repo_name": "naparuba/kunai",
"path": "data/global-configuration/packs/mongodb/collectors/pymongo/ssl_match_hostname.py",
"copies": "21",
"size": "4688",
"license": "mit",
"hash": 1537955165270300700,
"line_mean": 33.7259259259,
"line_max": 78,
"alpha_frac": 0.6115614334,
"autogenerated": false,
... |
# Backport of the match_hostname logic introduced in python 3.2
# http://svn.python.org/projects/python/branches/release32-maint/Lib/ssl.py
import re
class CertificateError(ValueError):
pass
def _dnsname_to_pat(dn, max_wildcards=1):
pats = []
for frag in dn.split(r'.'):
if frag.count('*') > max... | {
"repo_name": "blynch/CloudMemeBackend",
"path": "pymongo/ssl_match_hostname.py",
"copies": "16",
"size": "2592",
"license": "apache-2.0",
"hash": -3743945338330319000,
"line_mean": 36.5652173913,
"line_max": 78,
"alpha_frac": 0.5767746914,
"autogenerated": false,
"ratio": 4.242225859247136,
"c... |
# Backport of the weakrefset module for Python 2.5 and 2.6
# Licencend under New BSD License, code from http://code.google.com/p/weakrefset/
from __future__ import with_statement
from _weakref import ref
__all__ = ['WeakSet']
__version__ = '1.0.0'
class _IterationGuard(object):
# This context manager registe... | {
"repo_name": "saintdragon2/python-3-lecture-2015",
"path": "civil_mid_mid/pymunk-4.0.0/pymunk/weakrefset.py",
"copies": "4",
"size": "6365",
"license": "mit",
"hash": -7316824586138384000,
"line_mean": 28.4722222222,
"line_max": 81,
"alpha_frac": 0.5627651218,
"autogenerated": false,
"ratio": 4.... |
"""Backport Python3 unittest.TestCase to absl when running Python 2.7."""
from __future__ import absolute_import
import contextlib
import sys
import unittest
import warnings
import six
# pylint: disable=invalid-name
if six.PY2:
_subtest_msg_sentinel = object()
class _ShouldStop(Exception):
"""The test sho... | {
"repo_name": "google/material-design-icons",
"path": "update/venv/lib/python3.9/site-packages/absl/third_party/unittest3_backport/case.py",
"copies": "5",
"size": "9495",
"license": "apache-2.0",
"hash": 5408006207591542000,
"line_mean": 33.7802197802,
"line_max": 80,
"alpha_frac": 0.61716693,
"au... |
"""Backports and compatible methods."""
# get_model(app_name, model_name)
# Retrieves Django model class given the app and model name
try:
# Django 1.8 and later
from django.apps import apps
get_model = apps.get_model
except ImportError: # pragma: nocover
from django.db.models.loading import get_model... | {
"repo_name": "jwhitlock/drf-cached-instances",
"path": "drf_cached_instances/compat.py",
"copies": "1",
"size": "1929",
"license": "mpl-2.0",
"hash": 894809951054243500,
"line_mean": 29.619047619,
"line_max": 79,
"alpha_frac": 0.5463970969,
"autogenerated": false,
"ratio": 3.559040590405904,
"... |
# Copyright (c) 2014-2018 Jason R. Coombs
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publis... | {
"repo_name": "orbingol/NURBS-Python",
"path": "geomdl/functools_lru_cache.py",
"copies": "1",
"size": "8538",
"license": "mit",
"hash": -2920501915539453000,
"line_mean": 40.0480769231,
"line_max": 95,
"alpha_frac": 0.5664089951,
"autogenerated": false,
"ratio": 4.546325878594249,
"config_test... |
# Backports https://github.com/sphinx-doc/sphinx/pull/8983/, which adds autodoc
# support for return annotations on property getters.
import re
from typing import Tuple, Optional, List
import docutils.nodes
import docutils.parsers.rst.directives
import sphinx.addnodes
import sphinx.domains
import sphinx.domains.pytho... | {
"repo_name": "google/tensorstore",
"path": "docs/tensorstore_sphinx_material/sphinx_material/autodoc_property_type.py",
"copies": "1",
"size": "3232",
"license": "apache-2.0",
"hash": -1232407173494021000,
"line_mean": 33.0210526316,
"line_max": 82,
"alpha_frac": 0.6627475248,
"autogenerated": fal... |
"""Backports the TemporaryDirectoy class for Python 2.7.
Source: https://stackoverflow.com/a/19299884
"""
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
class TemporaryDirectory(object):
"""Create and return a temporary direct... | {
"repo_name": "csadorf/signac",
"path": "tests/tempdir.py",
"copies": "1",
"size": "3319",
"license": "bsd-3-clause",
"hash": -6204851258689340000,
"line_mean": 31.5392156863,
"line_max": 77,
"alpha_frac": 0.5754745405,
"autogenerated": false,
"ratio": 4.338562091503268,
"config_test": false,
... |
# back propagation algorithm
from numpy import *
def back_propagation(y, A, MEGA_THETA, xi):
# assume y, A, xi are 1-D column vectors (row-less)
# assume MEGA_THETA is 2-D array
# define useful constants
L = size(xi)
a = A[-xi[-1]:][:, newaxis]
delta = a - y[:, newaxis]
DIM = shape(MEGA_THETA)
DELTA = zero... | {
"repo_name": "rupertsmall/machine-learning",
"path": "Neural-Networks/RLU_back_propagation.py",
"copies": "1",
"size": "1750",
"license": "mit",
"hash": -4724056762084002000,
"line_mean": 29.1724137931,
"line_max": 77,
"alpha_frac": 0.6405714286,
"autogenerated": false,
"ratio": 2.47875354107648... |
# Backpropagation alternatives module.
# ===================================
# Third-party modules
import numpy as np
def SGD(layers, weights, activation_function, activation_derivative,
training_samples, labels, feedforward, cost, learning_rate,
epochs, ret_error, tolerance, display):
"""Trains ... | {
"repo_name": "tulians/aml",
"path": "src/training_methods/backpropagation.py",
"copies": "1",
"size": "2902",
"license": "mit",
"hash": -4729438502595574000,
"line_mean": 36.6883116883,
"line_max": 73,
"alpha_frac": 0.577532736,
"autogenerated": false,
"ratio": 4.350824587706147,
"config_test"... |
"""Backpropagation methods used in the examples"""
import matplotlib.pylab as plt
import numpy as np
import os
import sys
import nrefocus
import odtbrain as odt
import radontea as rt
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))+"/../meep_tomo")
from meep_tomo import extract, common, postproc
def b... | {
"repo_name": "RI-imaging/FDTD_sinogram",
"path": "examples/ex_bpg.py",
"copies": "1",
"size": "8916",
"license": "bsd-3-clause",
"hash": 337718847048839230,
"line_mean": 32.0222222222,
"line_max": 85,
"alpha_frac": 0.5140197398,
"autogenerated": false,
"ratio": 4.080549199084668,
"config_test"... |
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
import urllib2
from bs4 import BeautifulSoup
random.seed(0)
# calculate a random number where: a <= rand < b
def rand(a,... | {
"repo_name": "kirmani/classie.io",
"path": "NeuralNetwork.py",
"copies": "2",
"size": "5314",
"license": "mit",
"hash": 4750884314225191000,
"line_mean": 29.7225433526,
"line_max": 135,
"alpha_frac": 0.5267218668,
"autogenerated": false,
"ratio": 3.4528914879792074,
"config_test": false,
"ha... |
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
random.seed(0)
# calculate a random number where: a <= rand < b
def rand(a, b):
return (b-a)*random.random() + a
# Ma... | {
"repo_name": "Anmol-Singh-Jaggi/Machine-Learning",
"path": "Docs/nn-xor.py",
"copies": "1",
"size": "4916",
"license": "mit",
"hash": 6475808948634509000,
"line_mean": 27.2528735632,
"line_max": 75,
"alpha_frac": 0.5152563059,
"autogenerated": false,
"ratio": 3.3648186173853527,
"config_test":... |
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
random.seed(0)
# calculate a random number where: a <= rand < b
def rand(a, b):
return (b-a)*random.random() + a
# M... | {
"repo_name": "urandu/machine-learning-assignments",
"path": "codes/bnn.py",
"copies": "1",
"size": "4853",
"license": "apache-2.0",
"hash": 3854548455798911500,
"line_mean": 27.8869047619,
"line_max": 75,
"alpha_frac": 0.5106119926,
"autogenerated": false,
"ratio": 3.356154910096819,
"config_t... |
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
#random.seed(0)
# calculate a random number where: a <= rand < b
def rand(a, b):
return (b-a)*random.random() + a
# ... | {
"repo_name": "joshishungry/artificial_intel",
"path": "assignments/lab5/bpnn.py",
"copies": "1",
"size": "4756",
"license": "apache-2.0",
"hash": -1832325224735647000,
"line_mean": 26.9764705882,
"line_max": 75,
"alpha_frac": 0.513666947,
"autogenerated": false,
"ratio": 3.3706591070163006,
"c... |
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
# ภาษาไทย โดย วรรณพงษ์ ภัททิยไพบูลย์ https://python3.wannaphong.com
# อ่านบทความ https://python3.wannaphong.com/2016/04/เริ่มต้น-neural-networks-กับ-python.html
imp... | {
"repo_name": "wannaphongcom/code-python3-blog",
"path": "ai/bpnn.py",
"copies": "1",
"size": "5427",
"license": "mit",
"hash": -4820692033124689000,
"line_mean": 27.9597701149,
"line_max": 92,
"alpha_frac": 0.5149831316,
"autogenerated": false,
"ratio": 2.444929645803008,
"config_test": false,... |
# Back-Propagation Neural Networks
#
# Yang Liu <gloolar@gmail.com>
import numpy as np
import scipy as sp
np.random.seed(0)
# sigmoid function for neurons
def sigmoid(x):
return sp.tanh(x)
# derivative of sigmoid function, in terms of the output (i.e. y)
def dsigmoid(y):
return 1.0 - y**2
class NNet:... | {
"repo_name": "herrkaefer/nnet",
"path": "nnet.py",
"copies": "1",
"size": "4537",
"license": "unlicense",
"hash": 1907407906427357700,
"line_mean": 25.0747126437,
"line_max": 103,
"alpha_frac": 0.494379546,
"autogenerated": false,
"ratio": 3.2063604240282686,
"config_test": false,
"has_no_ke... |
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
random.seed(0)
# calculate a random number where: a <= rand < b
def rand(a, b):
return (b-a)*random.rand... | {
"repo_name": "jorgebg/tictactoe",
"path": "bpnn.py",
"copies": "1",
"size": "5023",
"license": "mit",
"hash": 4751694457991971000,
"line_mean": 27.3742690058,
"line_max": 75,
"alpha_frac": 0.4933306789,
"autogenerated": false,
"ratio": 3.4498626373626373,
"config_test": false,
"has_no_keywor... |
# Back Propagation
#############################################################################################
# This python function shows how to implement back propagation in regression and classification models.
# Regression Example:
# - We will create sample data as follows: x-data: 100 random samples from a n... | {
"repo_name": "benjaminoh1/tensorflowcookbook",
"path": "Chapter 02/back_propagation.py",
"copies": "1",
"size": "5454",
"license": "mit",
"hash": -7194843823056831000,
"line_mean": 39.3643410853,
"line_max": 194,
"alpha_frac": 0.5729927007,
"autogenerated": false,
"ratio": 2.926363125351321,
"... |
# backprop.py
# to implement backprob for the simple features
# c.f. https://github.com/mnielsen/neural-networks-and-deep-learning/blob/master/code/network.py
"""
from armor.learning import backprop as bp
reload(bp)
NN = bp.Network()
NN()
"""
########################
# imports
import numpy as np
################... | {
"repo_name": "yaukwankiu/armor",
"path": "learning/backprop.py",
"copies": "1",
"size": "2556",
"license": "cc0-1.0",
"hash": -8399905107938251000,
"line_mean": 24.8181818182,
"line_max": 96,
"alpha_frac": 0.5285602504,
"autogenerated": false,
"ratio": 3.515818431911967,
"config_test": false,
... |
"""Backrefs package."""
# (major, minor, micro, release type, pre-release build, post-release build)
version_info = (1, 0, 0, 'final', 0, 1)
def _version():
"""
Get the version (PEP 440).
Version structure
(major, minor, micro, release type, pre-release build, post-release build)
Release nam... | {
"repo_name": "shriker/sublime",
"path": "Packages/backrefs/st3/backrefs/__init__.py",
"copies": "2",
"size": "1438",
"license": "mit",
"hash": -1980895292568310500,
"line_mean": 36.8421052632,
"line_max": 102,
"alpha_frac": 0.6488178025,
"autogenerated": false,
"ratio": 3.4987834549878345,
"co... |
"""Backrefs package."""
# (major, minor, micro, release type, pre-release build, post-release build)
version_info = (3, 5, 0, 'final', 0, 0)
def _version():
"""
Get the version (PEP 440).
Version structure
(major, minor, micro, release type, pre-release build, post-release build)
Release nam... | {
"repo_name": "Jackysonglanlan/devops",
"path": "IDEs/sublime/shared-pkgs/Packages/backrefs/st3/backrefs/__init__.py",
"copies": "3",
"size": "1439",
"license": "mit",
"hash": 7415547964198755000,
"line_mean": 35.8974358974,
"line_max": 102,
"alpha_frac": 0.6483669215,
"autogenerated": false,
"ra... |
BACKSLASH = '\\'
class MiniString(object):
"""
Create a representation of a string object
:param str string: The string to minify
"""
def __init__(self, string, quote="'"):
self._s = string
self.safe_mode = False
self.quote = quote
def __str__(self):
"""
... | {
"repo_name": "listyque/TACTIC-Handler",
"path": "thlib/side/python_minifier/ministring.py",
"copies": "1",
"size": "4227",
"license": "epl-1.0",
"hash": 4030928520396559000,
"line_mean": 23.1542857143,
"line_max": 75,
"alpha_frac": 0.3875088715,
"autogenerated": false,
"ratio": 4.256797583081571... |
factor_types = None
factor_top_counts = [5,10,20]
minimum_sample_sizes = [10,30,100,200]
factor_thresholds = [0.01,0.03,0.8,1.0,1.2]
minimum_asset_pct = 0.5
### LOAD CONFIGURATION ###
# Load Configuration File #
try:
with open('config.json') as config_file:
config = json.load(config_file)
except:
p... | {
"repo_name": "deanjohnr/macrotrendfollow",
"path": "backtest_factors.py",
"copies": "1",
"size": "8014",
"license": "mit",
"hash": 644302821285269100,
"line_mean": 39.075,
"line_max": 179,
"alpha_frac": 0.6417519341,
"autogenerated": false,
"ratio": 3.6131650135256987,
"config_test": true,
"... |
"""Back to the basics with this one. Gets the current status of games,
sends messages to the channel if there are changes to the score, and
sends messages to users who requested updates if there are changes to
the status.
Runs every five minutes. If all the games are over, will quit after it checks once; otherwise, it... | {
"repo_name": "rankinr/FootballBot",
"path": "updaters/new_parser.py",
"copies": "1",
"size": "15783",
"license": "cc0-1.0",
"hash": -1558407213985316400,
"line_mean": 53.615916955,
"line_max": 468,
"alpha_frac": 0.6365709941,
"autogenerated": false,
"ratio": 2.7244950802692904,
"config_test": ... |
# Backtracking Approach
class Solution:
def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
s = sum(nums)
if s % k != 0:
return False
target = s//k
seen = [False] * len(nums)
# k in the num of buckets remaining to fill.
return self.canPartiti... | {
"repo_name": "saisankargochhayat/algo_quest",
"path": "leetcode/698. Partition to K Equal Sum Subsets/soln.py",
"copies": "1",
"size": "1395",
"license": "apache-2.0",
"hash": 5486199456756224000,
"line_mean": 41.2727272727,
"line_max": 99,
"alpha_frac": 0.5612903226,
"autogenerated": false,
"ra... |
#Backtracking solution
# class Solution(object):
# def letterCombinations(self, digits):
# """
# :type digits: str
# :rtype: List[str]
# """
# if not len(digits):
# return []
# charsArray = ["", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]... | {
"repo_name": "darkpeach/AlgorithmCoding",
"path": "_017_LetterCombinationsOfAPhoneNumber.py",
"copies": "1",
"size": "1335",
"license": "epl-1.0",
"hash": 8281557212365312000,
"line_mean": 28.0434782609,
"line_max": 89,
"alpha_frac": 0.4344569288,
"autogenerated": false,
"ratio": 3.6980609418282... |
""" Backtracking solution to N-Queens problem. """
__author__ = "Caleb Madrigal"
__date__ = "2015-02-19"
import numpy as np
def right_to_left_diagonals_valid(board):
""" Returns True if there is no more than 1 "1" in each right-to-left diagonal; else False.
The algorithm works like this:
Matrix with i... | {
"repo_name": "calebmadrigal/algorithms-in-python",
"path": "nqueens.py",
"copies": "1",
"size": "3956",
"license": "mit",
"hash": -7027899534798892000,
"line_mean": 31.9666666667,
"line_max": 98,
"alpha_frac": 0.5894843276,
"autogenerated": false,
"ratio": 3.296666666666667,
"config_test": fal... |
import sys
import os
import time
import subprocess
import logging
import argparse
from . import util
from . import endpoint
def send_snapshot(snapshot, dest_endpoint, parent=None, clones=None,
no_progress=False):
"""
Sends snapshot to destination endpoint, using given parent and clones.
... | {
"repo_name": "efficiosoft/btrfs-backup",
"path": "btrfs_backup/__main__.py",
"copies": "2",
"size": "23622",
"license": "mit",
"hash": -6833110040491819000,
"line_mean": 45.9622266402,
"line_max": 80,
"alpha_frac": 0.5765811532,
"autogenerated": false,
"ratio": 4.593039082247715,
"config_test"... |
"""Backup Elasticsearch documents to a datastore. Currently, only S3 is
supported.
"""
import os
import json
import shutil
import logging
import datetime
import tempfile
import boto3
from elasticsearch import helpers
from . import util
from .. import error
__all__ = ['s3']
logger = logging.getLogger(__name__)
now =... | {
"repo_name": "Receiptful/elastic-companion",
"path": "companion/api/backup.py",
"copies": "1",
"size": "5601",
"license": "mit",
"hash": 1094595586488944100,
"line_mean": 32.7409638554,
"line_max": 80,
"alpha_frac": 0.5963220853,
"autogenerated": false,
"ratio": 3.7947154471544717,
"config_tes... |
"""Backup methods and utilities"""
import couchdb
import logging
import os
import re
import sys
import shutil
import subprocess as sp
import time
from datetime import datetime
from taca.utils.config import CONFIG
from taca.utils import filesystem, misc
logger = logging.getLogger(__name__)
class run_vars(object):
... | {
"repo_name": "kate-v-stepanova/TACA",
"path": "taca/backup/backup.py",
"copies": "1",
"size": "18146",
"license": "mit",
"hash": -2098759620235115000,
"line_mean": 52.8456973294,
"line_max": 167,
"alpha_frac": 0.5466769536,
"autogenerated": false,
"ratio": 3.974156811213316,
"config_test": tru... |
# backupsites.py
"""
Backup Sites
This script will backup all site collections in the specified web application.
Usage:
ipy backupsites.py --url http://myserver --destination \\\\network\share
Arguments:
--url - web application url
--destination - location backups will be saved to
[--overwr... | {
"repo_name": "glenc/sp.py",
"path": "src/backupsites.py",
"copies": "1",
"size": "1673",
"license": "bsd-3-clause",
"hash": 6607660931225935000,
"line_mean": 22.6029411765,
"line_max": 93,
"alpha_frac": 0.6491332935,
"autogenerated": false,
"ratio": 3.393509127789047,
"config_test": false,
"... |
'''backup_to_zip.py
PURPOSE: This script asks the user for a directory to create a backup ZIP file
that is then stored in another directory. This is geared to save a
copy said files in the Desktop version of cloud-based storage, such as
OneDrive, Google Drive, Box, Dropbox, or otherwise... | {
"repo_name": "Nicholas-Taliceo/backup-to-zip",
"path": "backup_to_zip.py",
"copies": "1",
"size": "3483",
"license": "apache-2.0",
"hash": -8110488986697868000,
"line_mean": 35.0531914894,
"line_max": 80,
"alpha_frac": 0.6086706862,
"autogenerated": false,
"ratio": 4.2475609756097565,
"config_... |
'''backup_to_zip_sched.py
PURPOSE: This script asks the user for a directory to create a backup ZIP file
that is then stored in another directory. This is geared to save a
copy said files in the Desktop version of cloud-based storage, such as
OneDrive, Google Drive, Box, Dropbox, or oth... | {
"repo_name": "Nicholas-Taliceo/backup-to-zip",
"path": "backup_to_zip_sched.py",
"copies": "1",
"size": "3970",
"license": "apache-2.0",
"hash": 2879702667653389300,
"line_mean": 35.8095238095,
"line_max": 80,
"alpha_frac": 0.5831234257,
"autogenerated": false,
"ratio": 4.348302300109529,
"con... |
"""back URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"repo_name": "istinspring/grablab",
"path": "back/back/urls.py",
"copies": "1",
"size": "1228",
"license": "mit",
"hash": 5586431106843812000,
"line_mean": 35.1176470588,
"line_max": 77,
"alpha_frac": 0.6872964169,
"autogenerated": false,
"ratio": 3.601173020527859,
"config_test": false,
"ha... |
#Backward compatibility for 2.7
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import flask
import celery
from flask_wkhtmltopdf import Wkhtmltopdf
import os
class WkhtmltopdfTests(unittest.TestCase):
def setUp(self):
app = flask.Flask(_... | {
"repo_name": "chris-griffin/flask-wkhtmltopdf",
"path": "tests/test_wkhtmltopdf.py",
"copies": "1",
"size": "2055",
"license": "mit",
"hash": -1398189430282121700,
"line_mean": 29.6153846154,
"line_max": 115,
"alpha_frac": 0.6170316302,
"autogenerated": false,
"ratio": 3.483050847457627,
"conf... |
"""Backward compatibility layer with older version of six.
This is used to avoid virtualenv requring a version of six newer than what
the system may have.
"""
from __future__ import absolute_import
from six import PY2, PY3, binary_type, text_type
try:
from six import ensure_text
except ImportError:
def ensu... | {
"repo_name": "pypa/virtualenv",
"path": "src/virtualenv/util/six.py",
"copies": "5",
"size": "1463",
"license": "mit",
"hash": -740478855454440700,
"line_mean": 28.26,
"line_max": 74,
"alpha_frac": 0.5584415584,
"autogenerated": false,
"ratio": 3.7512820512820513,
"config_test": false,
"has_... |
"""Backward compatible behaviour with primary key 'Id' and upper-case field names"""
import datetime
from salesforce import models
from salesforce.models import SalesforceModel
class User(SalesforceModel):
Username = models.CharField(max_length=80)
Email = models.CharField(max_length=100)
class Lead(Salesf... | {
"repo_name": "hynekcer/django-salesforce",
"path": "tests/test_compatibility/models.py",
"copies": "2",
"size": "1930",
"license": "mit",
"hash": -3904477019679361000,
"line_mean": 35.4150943396,
"line_max": 117,
"alpha_frac": 0.7279792746,
"autogenerated": false,
"ratio": 3.541284403669725,
"... |
# Backward compatible module for RandomArray
__all__ = ['ArgumentError','F','beta','binomial','chi_square', 'exponential',
'gamma', 'get_seed', 'mean_var_test', 'multinomial',
'multivariate_normal', 'negative_binomial', 'noncentral_F',
'noncentral_chi_square', 'normal', 'permutation', ... | {
"repo_name": "lthurlow/Network-Grapher",
"path": "proj/external/numpy-1.7.0/numpy/oldnumeric/random_array.py",
"copies": "13",
"size": "11451",
"license": "mit",
"hash": 1923119424235896000,
"line_mean": 42.0488721805,
"line_max": 267,
"alpha_frac": 0.6318225482,
"autogenerated": false,
"ratio":... |
"""Backward compatible with arrayfns from Numeric
"""
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask', 'histogram', 'index_sort',
'interp', 'nz', 'reverse', 'span', 'to_corners', 'zmin_zmax']
import numpy as nx
from numpy import asarray
class error(Exception):
pass
def array_se... | {
"repo_name": "houseind/robothon",
"path": "GlyphProofer/dist/GlyphProofer.app/Contents/Resources/lib/python2.6/numpy/oldnumeric/arrayfns.py",
"copies": "2",
"size": "2515",
"license": "mit",
"hash": -5142801292312078000,
"line_mean": 25.1979166667,
"line_max": 98,
"alpha_frac": 0.5888667992,
"auto... |
"""Backward compatible with arrayfns from Numeric
"""
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask',
'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span',
'to_corners', 'zmin_zmax']
import numpy as np
from numpy import asarray
class error(Exception):
pass
d... | {
"repo_name": "dwf/numpy",
"path": "numpy/oldnumeric/arrayfns.py",
"copies": "13",
"size": "2532",
"license": "bsd-3-clause",
"hash": -7645373089843975000,
"line_mean": 25.1030927835,
"line_max": 80,
"alpha_frac": 0.5860979463,
"autogenerated": false,
"ratio": 3.0142857142857142,
"config_test":... |
"""Backward compatible with arrayfns from Numeric.
"""
from __future__ import division, absolute_import, print_function
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask',
'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span',
'to_corners', 'zmin_zmax']
import numpy a... | {
"repo_name": "openstack-hyper-v-python/numpy",
"path": "numpy/oldnumeric/arrayfns.py",
"copies": "13",
"size": "2605",
"license": "bsd-3-clause",
"hash": -7486627940848528000,
"line_mean": 25.3131313131,
"line_max": 80,
"alpha_frac": 0.5892514395,
"autogenerated": false,
"ratio": 3.0432242990654... |
"""Backward difference contrast encoding"""
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from patsy.contrasts import Diff
import numpy as np
from category_encoders.ordinal import OrdinalEncoder
import category_encoders.utils as util
__author__ = 'willmcginnis'
class BackwardDifferenc... | {
"repo_name": "scikit-learn-contrib/categorical-encoding",
"path": "category_encoders/backward_difference.py",
"copies": "2",
"size": "10266",
"license": "bsd-3-clause",
"hash": 3746955610863067000,
"line_mean": 33.8,
"line_max": 126,
"alpha_frac": 0.5975063316,
"autogenerated": false,
"ratio": 4... |
""" **backward_difference_formulas.py** implements some BDF's for time discretization. """
import fenics
def apply_backward_euler(Delta_t, u):
""" Apply the backward Euler (fully implicit, first order) time discretization method. """
u_t = (u[0] - u[1])/Delta_t
return u_t
def apply_bdf2(Del... | {
"repo_name": "geo-fluid-dynamics/phaseflow-fenics",
"path": "phaseflow/backward_difference_formulas.py",
"copies": "1",
"size": "1858",
"license": "mit",
"hash": 3495698040171803000,
"line_mean": 36.18,
"line_max": 112,
"alpha_frac": 0.6130247578,
"autogenerated": false,
"ratio": 3.5662188099808... |
# Backwards compatability for django < 1.10.x
try:
from django.urls import set_script_prefix, clear_script_prefix
except ImportError:
from django.core.urlresolvers import set_script_prefix, clear_script_prefix
from rest_framework.test import APITestCase
from rest_framework.routers import DefaultRouter
from d... | {
"repo_name": "AltSchool/dynamic-rest",
"path": "tests/test_router.py",
"copies": "1",
"size": "2972",
"license": "mit",
"hash": -2674074828642659300,
"line_mean": 29.6391752577,
"line_max": 79,
"alpha_frac": 0.5770524899,
"autogenerated": false,
"ratio": 4.221590909090909,
"config_test": true,... |
"""Backwards compatibility - we use contextlib.nested to support Python 2.6,
but it's removed in Python 3.2."""
# TODO : Remove this once we drop support for Python 2.6, and use
# "with a, b:" instead.
import sys
from contextlib import contextmanager
@contextmanager
def nested(*managers):
"""Combine multiple co... | {
"repo_name": "noslenfa/tdjangorest",
"path": "uw/lib/python2.7/site-packages/IPython/utils/nested_context.py",
"copies": "2",
"size": "1502",
"license": "apache-2.0",
"hash": -7701928731388209000,
"line_mean": 29.04,
"line_max": 78,
"alpha_frac": 0.5912117177,
"autogenerated": false,
"ratio": 4.... |
# Bacon Ipsum for Django
#
# Inspired by django.contrib.webdesign
# and Pete Nelson's http://baconipsum.com/ source code at https://github.com/petenelson/bacon-ipsum/
# built by rhfung at http://www.yetihq.com/
#
# March 2013
# MIT license
from __future__ import unicode_literals
from bacon.bacon_ipsum import words, p... | {
"repo_name": "yeti/django-bacon-ipsum",
"path": "django-bacon-ipsum/templatetags/bacondesign.py",
"copies": "1",
"size": "2261",
"license": "mit",
"hash": -388744447155794200,
"line_mean": 29.5540540541,
"line_max": 100,
"alpha_frac": 0.6050420168,
"autogenerated": false,
"ratio": 3.652665589660... |
import copy
import random
import sys
def floatrange(start, stop, n_intervals):
diff = stop - start
for i in xrange(n_intervals+1):
yield start + (i*diff)/n_intervals
ALL_CODONS = ["IncA", "IncX" , "LoadA", "LoadX", "LoadY", "AddYtoA", "MoveAtoY", "MoveAtoX", "BranchXZero", "BranchXNotZero", "Return"... | {
"repo_name": "stefanoborini/creatures",
"path": "bacteria.py",
"copies": "1",
"size": "9276",
"license": "bsd-3-clause",
"hash": -1573414726186183400,
"line_mean": 36.7073170732,
"line_max": 222,
"alpha_frac": 0.5778352738,
"autogenerated": false,
"ratio": 3.6620607974733517,
"config_test": fa... |
'''Bacula configuration database stuff: common routines, etc'''
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import logging
logger = logging.getLogger(__name__)
import MySQLdb as db
import MySQLdb.cursors
import os
import sys
import bacula_tools
class Bacula_Config(object):
'''... | {
"repo_name": "BrianGallew/bacula_configuration",
"path": "bacula_tools/bacula_config.py",
"copies": "1",
"size": "4390",
"license": "bsd-3-clause",
"hash": -5779410167163663000,
"line_mean": 42.4653465347,
"line_max": 100,
"alpha_frac": 0.632118451,
"autogenerated": false,
"ratio": 4.02752293577... |
"""bac URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"repo_name": "arc-bitspilani/main-website",
"path": "bac/urls.py",
"copies": "1",
"size": "1095",
"license": "apache-2.0",
"hash": 355150307757155200,
"line_mean": 36.7586206897,
"line_max": 86,
"alpha_frac": 0.7232876712,
"autogenerated": false,
"ratio": 3.5901639344262297,
"config_test": fal... |
# bad argument list samples
class A:
def foo(self, x, y):
pass
# no self, but so what
def bar(one, two):
pass
a = A()
a.foo(1,2)
a.bar(<warning descr="Parameter 'two' unfilled">)</warning>;
def f1():
pass
f1()
f1(<warning descr="Unexpected argument">1</warning>)
f1(<warning descr=... | {
"repo_name": "goodwinnk/intellij-community",
"path": "python/testData/inspections/PyArgumentListInspection/badarglist.py",
"copies": "47",
"size": "1286",
"license": "apache-2.0",
"hash": -3361418192291915000,
"line_mean": 22.3818181818,
"line_max": 145,
"alpha_frac": 0.6423017107,
"autogenerated"... |
# Bad Case-----------------------------------------------
class MyView(object):
def __init__(self, request):
self.request = request
def index(self):
s = SomeService()
result = s.some_method(**self.request.params)
return render('index.html', dict(result=result))
# Good Case---... | {
"repo_name": "yhoshino11/pytest_example",
"path": "refactoring_example.py",
"copies": "1",
"size": "1212",
"license": "mit",
"hash": -2565074980416028700,
"line_mean": 25.347826087,
"line_max": 66,
"alpha_frac": 0.5825082508,
"autogenerated": false,
"ratio": 4.094594594594595,
"config_test": t... |
# baddies.py
from random import randint
from sprite import *
from baddy import *
from loadMap import *
import pygame
class Baddies(pygame.sprite.Group):
def __init__(self):
pygame.sprite.Group.__init__(self)
def generateBaddies(self, char, map):
noBaddies = map.copy()
playerSprite = pygame.sprite.Sprite()
... | {
"repo_name": "pkbigmarsh/PerceptiveInternHackathon",
"path": "src/baddies.py",
"copies": "1",
"size": "1090",
"license": "mit",
"hash": 2264131489373914600,
"line_mean": 23.7727272727,
"line_max": 111,
"alpha_frac": 0.6779816514,
"autogenerated": false,
"ratio": 2.802056555269923,
"config_test... |
#baddy.py
import pygame
from sprite import *
from random import randint
from constants import *
from loadMap import *
from baddies import *
class Baddy(Sprite):
def __init__(self, filepath):
Sprite.__init__(self, filepath)
self.health = 10
self.speed = randint(1,5)
# self.direct = [0,0]
self.direct = gen... | {
"repo_name": "pkbigmarsh/PerceptiveInternHackathon",
"path": "src/baddy.py",
"copies": "1",
"size": "1651",
"license": "mit",
"hash": -939248859891961200,
"line_mean": 21.0266666667,
"line_max": 61,
"alpha_frac": 0.6365838886,
"autogenerated": false,
"ratio": 2.6715210355987056,
"config_test":... |
"""badge model."""
from django.db import models
from datetime import datetime
from django.conf import settings
from apps.managers.player_mgr.models import Profile
from apps.widgets.notifications.models import UserNotification
from apps.utils.utils import media_file_path
_MEDIA_LOCATION = "badges"
"""location for uplo... | {
"repo_name": "jtakayama/ics691-setupbooster",
"path": "makahiki/apps/widgets/badges/models.py",
"copies": "9",
"size": "3530",
"license": "mit",
"hash": 870697525229883600,
"line_mean": 38.6629213483,
"line_max": 99,
"alpha_frac": 0.5640226629,
"autogenerated": false,
"ratio": 4.247894103489771,... |
"""Badges for inclusion in markdown docs, etc.
.. seealso:: http://shields.io/
"""
from urllib.parse import urlencode, quote
__all__ = ['Colors', 'badge']
class Colors(object):
"""
Colors available for shields.io badges.
"""
brightgreen = 'brightgreen'
green = 'green'
yellowgreen = 'yellowgr... | {
"repo_name": "clld/clldutils",
"path": "src/clldutils/badge.py",
"copies": "1",
"size": "1243",
"license": "apache-2.0",
"hash": 7328115480136854000,
"line_mean": 31.7105263158,
"line_max": 85,
"alpha_frac": 0.6251005632,
"autogenerated": false,
"ratio": 3.443213296398892,
"config_test": false... |
"""badges module"""
from django.core.exceptions import ObjectDoesNotExist
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.player_mgr.models import Profile
from apps.utils import utils
from apps.widgets.badges.models import BadgeAward, Badge
from apps.managers.cache_mgr import cache_mgr
def ge... | {
"repo_name": "MakahikiKTUH/makahiki-ktuh",
"path": "makahiki/apps/widgets/badges/badges.py",
"copies": "6",
"size": "1591",
"license": "mit",
"hash": 6142225025674895000,
"line_mean": 32.8510638298,
"line_max": 99,
"alpha_frac": 0.7008170962,
"autogenerated": false,
"ratio": 3.6407322654462244,
... |
"""badges module"""
from django.core.exceptions import ObjectDoesNotExist
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.player_mgr.models import Profile
from apps.widgets.badges.models import BadgeAward, Badge
from apps.managers.cache_mgr import cache_mgr
from apps.managers.predicate_mgr impo... | {
"repo_name": "csdl/makahiki",
"path": "makahiki/apps/widgets/badges/badges.py",
"copies": "3",
"size": "1696",
"license": "mit",
"hash": -8973514612617066000,
"line_mean": 34.3333333333,
"line_max": 94,
"alpha_frac": 0.6745283019,
"autogenerated": false,
"ratio": 3.7857142857142856,
"config_te... |
"""Badly named module that contains the driving code for the rendering."""
from pydoctor.templatewriter.util import link, templatefile
from pydoctor.templatewriter import DOCTYPE, pages, summary
from pydoctor import model
from twisted.web.template import flattenString
import os, shutil
def flattenToFile(fobj, page... | {
"repo_name": "chevah/pydoctor",
"path": "pydoctor/templatewriter/writer.py",
"copies": "3",
"size": "3158",
"license": "isc",
"hash": 670445216034219100,
"line_mean": 34.0888888889,
"line_max": 91,
"alpha_frac": 0.5807473084,
"autogenerated": false,
"ratio": 3.8094089264173703,
"config_test": ... |
"""bad URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"repo_name": "beneboy/catdb",
"path": "bad/bad/urls.py",
"copies": "1",
"size": "1069",
"license": "mit",
"hash": 669895501999477000,
"line_mean": 37.1785714286,
"line_max": 79,
"alpha_frac": 0.6735266604,
"autogenerated": false,
"ratio": 3.1533923303834808,
"config_test": false,
"has_no_key... |
"""Bag class definitions."""
import heapq
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from collections.abc import Collection, Hashable, Set
from operator import itemgetter
from ._util import deprecated
__all__ = (
'Bag',
'BagView',
'CountsView',
'UniqueElementsView',
'bag',
'froz... | {
"repo_name": "mlenzen/collections-extended",
"path": "collections_extended/bags.py",
"copies": "1",
"size": "14131",
"license": "apache-2.0",
"hash": -64542772219998900,
"line_mean": 22.9915110357,
"line_max": 78,
"alpha_frac": 0.6539523034,
"autogenerated": false,
"ratio": 3.107080035180299,
... |
"""Bag distance measure"""
from __future__ import division
import collections
from py_stringmatching import utils
from py_stringmatching.similarity_measure.sequence_similarity_measure import \
SequenceSimilarityMeasure
class BagDistance(SequenceSimilarityMeasure):... | {
"repo_name": "Anson-Doan/py_stringmatching",
"path": "py_stringmatching/similarity_measure/bag_distance.py",
"copies": "1",
"size": "3084",
"license": "bsd-3-clause",
"hash": -7122188260936904000,
"line_mean": 27.8224299065,
"line_max": 79,
"alpha_frac": 0.5304798962,
"autogenerated": false,
"ra... |
# Baggging decision trees in 2d
# Based on https://github.com/ageron/handson-ml2/blob/master/06_decision_trees.ipynb
import numpy as np
import matplotlib.pyplot as plt
import os
from sklearn.metrics import accuracy_score
from sklearn.ensemble import BaggingClassifier
from sklearn.tree import DecisionTreeClassifier... | {
"repo_name": "probml/pyprobml",
"path": "scripts/bagging_trees.py",
"copies": "1",
"size": "2349",
"license": "mit",
"hash": -8654908086395623000,
"line_mean": 34.0597014925,
"line_max": 91,
"alpha_frac": 0.6722009366,
"autogenerated": false,
"ratio": 2.6815068493150687,
"config_test": true,
... |
# Bagging - building an ensemble of classifiers from bootstrap samples
'''
To see bagging in action, let's create a more complex classification problem using
the Wine dataset. Here, we will only consider the Wine classes 2 and 3, and we
select two features: Alcohol and Hue.'''
import numpy as np
import pandas as pd
df_... | {
"repo_name": "wei-Z/Python-Machine-Learning",
"path": "self_practice/Chapter 7 Combining Different Models for Ensemble Learning part II.py",
"copies": "1",
"size": "5293",
"license": "mit",
"hash": -8229646250112102000,
"line_mean": 47.5596330275,
"line_max": 110,
"alpha_frac": 0.6565274891,
"auto... |
"""Bagging meta-estimator."""
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
from __future__ import division
import itertools
import numbers
from abc import ABCMeta, abstractmethod
from warnings import warn
import numpy as np
from ..externals.six.moves import zip
from .base import BaseEnsembl... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/scikit-learn-master/sklearn/ensemble/bagging.py",
"copies": "1",
"size": "36407",
"license": "mit",
"hash": -5531188745879607000,
"line_mean": 37.122513089,
"line_max": 79,
"alpha_frac": 0.5887604032,
"autogenerated": false,
"ratio": 4... |
"""Bagging meta-estimator."""
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
from __future__ import division
import itertools
import numbers
import numpy as np
from abc import ABCMeta, abstractmethod
from warnings import warn
from .base import BaseEnsemble, _partition_estimators
from ..base im... | {
"repo_name": "vortex-ape/scikit-learn",
"path": "sklearn/ensemble/bagging.py",
"copies": "2",
"size": "38911",
"license": "bsd-3-clause",
"hash": -6389898405248627000,
"line_mean": 37.4496047431,
"line_max": 79,
"alpha_frac": 0.5923774768,
"autogenerated": false,
"ratio": 4.436324250370539,
"c... |
"""Bagging meta-estimator."""
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
from __future__ import division
import itertools
import numbers
import numpy as np
from warnings import warn
from abc import ABCMeta, abstractmethod, ABC
from ..base import ClassifierMixin, RegressorMixin
from joblib ... | {
"repo_name": "psarka/uplift",
"path": "uplift/ensemble/bagging.py",
"copies": "1",
"size": "36682",
"license": "bsd-3-clause",
"hash": 25184197973508970,
"line_mean": 37.3301985371,
"line_max": 85,
"alpha_frac": 0.585927703,
"autogenerated": false,
"ratio": 4.400431861804223,
"config_test": fa... |
"""Bagging meta-estimator."""
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
import itertools
import numbers
import numpy as np
from abc import ABCMeta, abstractmethod
from warnings import warn
from joblib import Parallel, delayed
from ._base import BaseEnsemble, _partition_estimators
from ..... | {
"repo_name": "bnaul/scikit-learn",
"path": "sklearn/ensemble/_bagging.py",
"copies": "2",
"size": "41032",
"license": "bsd-3-clause",
"hash": 8500778180944928000,
"line_mean": 37.1338289963,
"line_max": 79,
"alpha_frac": 0.5902953792,
"autogenerated": false,
"ratio": 4.449360225547603,
"config... |
"""Bagging meta-estimator."""
# https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/ensemble/bagging.py
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
from __future__ import division
import itertools
import numbers
import numpy as np
from abc import ABCMeta, abstractmethod
from ins... | {
"repo_name": "madjelan/CostSensitiveClassification",
"path": "costcla/models/bagging.py",
"copies": "1",
"size": "24794",
"license": "bsd-3-clause",
"hash": 4019526067555656000,
"line_mean": 39.6459016393,
"line_max": 130,
"alpha_frac": 0.609623296,
"autogenerated": false,
"ratio": 4.19810362343... |
"""Bagging meta-estimator."""
# https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/ensemble/bagging.py
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
import itertools
import numbers
import numpy as np
from abc import ABCMeta, abstractmethod
from inspect import getargspec
from sk... | {
"repo_name": "albahnsen/CostSensitiveClassification",
"path": "costcla/models/bagging.py",
"copies": "1",
"size": "24765",
"license": "bsd-3-clause",
"hash": -8067260059038999000,
"line_mean": 39.5983606557,
"line_max": 130,
"alpha_frac": 0.6093680598,
"autogenerated": false,
"ratio": 4.19888097... |
#bagging to make it better
import pandas as pd
import numpy as np
from ggplot import *
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import cross_val_score
from sklearn.metrics import auc_score
train = pd.read_csv('/Users/... | {
"repo_name": "JessicaGarson/MovieSentiment",
"path": "baggedmovies.py",
"copies": "1",
"size": "1258",
"license": "unlicense",
"hash": 7681214538378216000,
"line_mean": 26.3695652174,
"line_max": 79,
"alpha_frac": 0.7241653418,
"autogenerated": false,
"ratio": 3.1608040201005023,
"config_test"... |
"""bagile 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": "bodzio528/bagile",
"path": "bagile/urls.py",
"copies": "1",
"size": "1510",
"license": "mit",
"hash": 3226918541917955000,
"line_mean": 38.7368421053,
"line_max": 84,
"alpha_frac": 0.7046357616,
"autogenerated": false,
"ratio": 3.552941176470588,
"config_test": false,
"has_no_k... |
"""Bag/multiset class for convenient tallying of hashable objects.
This recipe was added to the collections module in Python 2.7. It has been modified here so that it runs on Python 2.5 or later. See the online docs at: http://docs.python.org/dev/library/collections.html#counter-objects
See: http://code.activestate.c... | {
"repo_name": "emanuele/PyCoverTree",
"path": "covertree/recipe_576611_1.py",
"copies": "1",
"size": "6718",
"license": "bsd-3-clause",
"hash": 6425243993652140000,
"line_mean": 32.9292929293,
"line_max": 220,
"alpha_frac": 0.5461446859,
"autogenerated": false,
"ratio": 4.2384858044164035,
"con... |
# bag of words
import os
import random
import cv2
folder = "/Users/rinatahmetov/Downloads/101_ObjectCategories"
def get_files_in_folder(dir_path):
training_names = os.listdir(dir_path)
# Get all the path to the images and save them in a list
# image_paths and the corresponding label in image_paths
im... | {
"repo_name": "tz3/ml_homework",
"path": "source/main/trainer.py",
"copies": "1",
"size": "3081",
"license": "mit",
"hash": 7257725583938043000,
"line_mean": 32.5,
"line_max": 96,
"alpha_frac": 0.6595261279,
"autogenerated": false,
"ratio": 3.2397476340694005,
"config_test": false,
"has_no_ke... |
# bagofwords.py
#
# The BagOfWords class implements individual volumes as ordered
# lists of features.
#
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
def all_nonalphanumeric(astring):
nonalphanum = True
for character in astring:
if character.isalpha() or character.isdigi... | {
"repo_name": "tedunderwood/GenreProject",
"path": "python/utilities/bagofwords.py",
"copies": "2",
"size": "6770",
"license": "mit",
"hash": 8457993113088729000,
"line_mean": 28.5545851528,
"line_max": 82,
"alpha_frac": 0.7254728132,
"autogenerated": false,
"ratio": 3.6762629005975014,
"config... |
# Baillie–PSW primality test
# Source: http://codegolf.stackexchange.com/questions/10701/fastest-code-to-find-the-next-prime
# primes less than 212
small_primes = set([
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
127, 131, 137... | {
"repo_name": "justinh5/CipherBox",
"path": "Arithmetic/Numbers/Primality/PrimeTest.py",
"copies": "1",
"size": "4092",
"license": "mit",
"hash": 1237812149612064500,
"line_mean": 22.5057471264,
"line_max": 95,
"alpha_frac": 0.4464547677,
"autogenerated": false,
"ratio": 2.8052126200274348,
"co... |
# BAKE UDIM TILES
#
# ====================================================================================================================
# Description: Bake out multiple tiles using Batch Bake (Mental Ray).
#
# ===========================================================================================================... | {
"repo_name": "aaronfang/personal_scripts",
"path": "af_scripts/tmp/batchBakeUDIM.py",
"copies": "2",
"size": "5523",
"license": "mit",
"hash": 2018350081033074700,
"line_mean": 35.3421052632,
"line_max": 120,
"alpha_frac": 0.618323375,
"autogenerated": false,
"ratio": 3.2738589211618256,
"conf... |
balance = 2
#show a menu for check balance, deposit, and withdraw
print "ATM Simulation 1.0"
print "1. Check balance"
print "2. Deposit"
print "3. Withdraw"
print "4. Exit"
#collect user input for his/her choice
print "Please enter the number of your choice:"
userChoice = int(raw_input())
#depending on ... | {
"repo_name": "jordantdavis/CourseProblemSolvingWithComputers",
"path": "InClassExamples/ATM.py",
"copies": "1",
"size": "1187",
"license": "mit",
"hash": -5912305597974246000,
"line_mean": 24.4222222222,
"line_max": 67,
"alpha_frac": 0.6579612468,
"autogenerated": false,
"ratio": 3.4809384164222... |
# balanced AVL tree
from bst import *
class AVLNode(Node):
def __init__(self, key):
Node.__init__(self, key)
self.height = 0
def getheight(node):
return node.height if (node and isinstance(node, AVLNode)) else -1
class AVLTree(BinarySearchTree):
def leftrotate(self, x):
"""cha... | {
"repo_name": "dimakuv/python-algos",
"path": "tree/avl.py",
"copies": "1",
"size": "3272",
"license": "mit",
"hash": -1349194596643438800,
"line_mean": 29.5887850467,
"line_max": 92,
"alpha_frac": 0.5406479218,
"autogenerated": false,
"ratio": 3.6274944567627494,
"config_test": false,
"has_n... |
# Balanced Binary Tree
#
# Given a binary tree, determine if it is height-balanced.
#
# For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
debug = True
debug = False
# from CommonClasses import * ... | {
"repo_name": "54lihaoxin/leetcode_python",
"path": "src/BalancedBinaryTree/solution.py",
"copies": "1",
"size": "1471",
"license": "apache-2.0",
"hash": -7083796787648884000,
"line_mean": 28.6875,
"line_max": 159,
"alpha_frac": 0.5927940177,
"autogenerated": false,
"ratio": 4.214899713467049,
... |
# balanced Red-Black (RB) tree
# NOTE: RB trees are surprisingly hard to wrap your head around, and I personally
# dislike them, thus no attempts to make the following code look nice
# for reuse of left & right rotates, inherit RB from AVL trees
from avl import *
class Color:
Black = 0
Red = 1
class RB... | {
"repo_name": "dimakuv/python-algos",
"path": "tree/rb.py",
"copies": "1",
"size": "8813",
"license": "mit",
"hash": -1465037046120688600,
"line_mean": 39.0636363636,
"line_max": 100,
"alpha_frac": 0.5075456712,
"autogenerated": false,
"ratio": 4.670376258611553,
"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.