text stringlengths 0 1.05M | meta dict |
|---|---|
"""Basic functionality of all model parts."""
from abc import ABCMeta
from contextlib import contextmanager
from typing import Any, Callable, Dict, List, Set, Tuple
import tensorflow as tf
from neuralmonkey.dataset import Dataset
from neuralmonkey.logging import log
from neuralmonkey import tf_utils
# pylint: disab... | {
"repo_name": "juliakreutzer/bandit-neuralmonkey",
"path": "neuralmonkey/model/model_part.py",
"copies": "1",
"size": "4222",
"license": "bsd-3-clause",
"hash": -3635268740285573000,
"line_mean": 34.4789915966,
"line_max": 79,
"alpha_frac": 0.5866887731,
"autogenerated": false,
"ratio": 4.3615702... |
"""Basic functionality of all model parts."""
from abc import ABCMeta
from contextlib import contextmanager
from typing import Any, Dict, Optional
import tensorflow as tf
from neuralmonkey.dataset import Dataset
from neuralmonkey.logging import log
# pylint: disable=invalid-name
FeedDict = Dict[tf.Tensor, Any]
# py... | {
"repo_name": "bastings/neuralmonkey",
"path": "neuralmonkey/model/model_part.py",
"copies": "1",
"size": "2608",
"license": "bsd-3-clause",
"hash": -887530049690765700,
"line_mean": 33.7733333333,
"line_max": 79,
"alpha_frac": 0.611196319,
"autogenerated": false,
"ratio": 4.303630363036303,
"c... |
"""Basic functionality to work with plugins/backends/configuring classes by names"""
import os
import sys
import pkgutil
import inspect
def load_all_modules_from_dir(dirname):
"""Import all python modules from dirname and return list of them"""
module_list = []
package_name = '.'.join(os.path.split(dirnam... | {
"repo_name": "ilblackdragon/pymisc",
"path": "pymisc/modules.py",
"copies": "1",
"size": "3459",
"license": "mit",
"hash": -4983422147205738000,
"line_mean": 39.6941176471,
"line_max": 97,
"alpha_frac": 0.6652211622,
"autogenerated": false,
"ratio": 3.7844638949671774,
"config_test": true,
"... |
"""Basic functional stuff, I guess.
"""
import logging
import os
LOG = logging.getLogger(__name__)
def getIpdModelFilename(ipdModel, majorityChem, paramsPath):
"""
ipdModel: str
majorityChem: str
"""
# In order of precedence they are:
# 1. Explicit path passed to --ipdModel
# 2. In-order ... | {
"repo_name": "PacificBiosciences/kineticsTools",
"path": "kineticsTools/loader.py",
"copies": "1",
"size": "2120",
"license": "bsd-3-clause",
"hash": 7159932774569841000,
"line_mean": 33.1935483871,
"line_max": 92,
"alpha_frac": 0.6627358491,
"autogenerated": false,
"ratio": 3.297045101088647,
... |
""" Basic functions for manipulating 2d arrays
"""
from __future__ import division, absolute_import, print_function
__all__ = ['diag', 'diagflat', 'eye', 'fliplr', 'flipud', 'rot90', 'tri',
'triu', 'tril', 'vander', 'histogram2d', 'mask_indices',
'tril_indices', 'tril_indices_from', 'triu_indice... | {
"repo_name": "immerrr/numpy",
"path": "numpy/lib/twodim_base.py",
"copies": "1",
"size": "26858",
"license": "bsd-3-clause",
"hash": 7814775077966104000,
"line_mean": 25.858,
"line_max": 78,
"alpha_frac": 0.5372328543,
"autogenerated": false,
"ratio": 3.4170483460559797,
"config_test": false,
... |
""" Basic functions for manipulating 2d arrays
"""
from __future__ import division, absolute_import, print_function
__all__ = ['diag', 'diagflat', 'eye', 'fliplr', 'flipud', 'rot90', 'tri', 'triu',
'tril', 'vander', 'histogram2d', 'mask_indices',
'tril_indices', 'tril_indices_from', 'triu_indice... | {
"repo_name": "josecolella/PLD",
"path": "bin/osx/treasurehunters.app/Contents/Resources/lib/python3.4/numpy/lib/twodim_base.py",
"copies": "9",
"size": "24965",
"license": "mit",
"hash": -6236173100511177000,
"line_mean": 25.8729817008,
"line_max": 84,
"alpha_frac": 0.536230723,
"autogenerated": f... |
""" Basic functions for manipulating 2d arrays
"""
from __future__ import division, absolute_import, print_function
from numpy.core.numeric import (
absolute, asanyarray, arange, zeros, greater_equal, multiply, ones,
asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal,
)
from numpy.c... | {
"repo_name": "dwillmer/numpy",
"path": "numpy/lib/twodim_base.py",
"copies": "5",
"size": "25838",
"license": "bsd-3-clause",
"hash": -2665182265172214000,
"line_mean": 26.0838574423,
"line_max": 78,
"alpha_frac": 0.540173388,
"autogenerated": false,
"ratio": 3.415465961665565,
"config_test": ... |
""" Basic functions for manipulating 2d arrays
"""
from __future__ import division, absolute_import, print_function
from numpy.core.numeric import (
asanyarray, arange, zeros, greater_equal, multiply, ones, asarray,
where, int8, int16, int32, int64, empty, promote_types, diagonal,
)
from numpy.core import... | {
"repo_name": "jlcarmic/producthunt_simulator",
"path": "venv/lib/python2.7/site-packages/numpy/lib/twodim_base.py",
"copies": "83",
"size": "26903",
"license": "mit",
"hash": 2544102904984248000,
"line_mean": 25.7159880834,
"line_max": 78,
"alpha_frac": 0.5378210608,
"autogenerated": false,
"rat... |
""" Basic functions for manipulating 2d arrays
"""
from __future__ import division, absolute_import, print_function
import functools
from numpy.core.numeric import (
absolute, asanyarray, arange, zeros, greater_equal, multiply, ones,
asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal,
... | {
"repo_name": "ryfeus/lambda-packs",
"path": "pytorch/source/numpy/lib/twodim_base.py",
"copies": "2",
"size": "27339",
"license": "mit",
"hash": 1568318359509451000,
"line_mean": 26.2844311377,
"line_max": 79,
"alpha_frac": 0.5523245181,
"autogenerated": false,
"ratio": 3.4462372368586913,
"co... |
""" Basic functions for manipulating 2d arrays
"""
import functools
from numpy.core.numeric import (
asanyarray, arange, zeros, greater_equal, multiply, ones,
asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal,
nonzero, indices
)
from numpy.core.overrides import set_array_functi... | {
"repo_name": "anntzer/numpy",
"path": "numpy/lib/twodim_base.py",
"copies": "2",
"size": "28598",
"license": "bsd-3-clause",
"hash": -7660218548334086000,
"line_mean": 26.1585944919,
"line_max": 79,
"alpha_frac": 0.5552486188,
"autogenerated": false,
"ratio": 3.4360206656253753,
"config_test":... |
""" Basic functions for manipulating 2d arrays
"""
__all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu',
'tril','vander','histogram2d','mask_indices',
'tril_indices','tril_indices_from','triu_indices','triu_indices_from',
]
from numpy.core.numeric import asanyarr... | {
"repo_name": "ewmoore/numpy",
"path": "numpy/lib/twodim_base.py",
"copies": "2",
"size": "23674",
"license": "bsd-3-clause",
"hash": 5703357953660752000,
"line_mean": 25.5403587444,
"line_max": 81,
"alpha_frac": 0.5349328377,
"autogenerated": false,
"ratio": 3.427537281019256,
"config_test": f... |
""" Basic functions for manipulating 2d arrays
"""
__all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu',
'tril','vander','histogram2d']
from numpy.core.numeric import asanyarray, equal, subtract, arange, \
zeros, arange, greater_equal, multiply, ones, asarray
def fliplr(m):
... | {
"repo_name": "houseind/robothon",
"path": "GlyphProofer/dist/GlyphProofer.app/Contents/Resources/lib/python2.6/numpy/lib/twodim_base.py",
"copies": "1",
"size": "13814",
"license": "mit",
"hash": 6630285972989484000,
"line_mean": 24.8689138577,
"line_max": 81,
"alpha_frac": 0.515853482,
"autogener... |
# basic functions for visualization of clustering, state estimation, lineage
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
def visualize_poisson_w(w, labels, filename, method='pca', figsize=(18,10), title='', **scatter_options):
"""
Saves a scatter plot of a visualization of W, the res... | {
"repo_name": "yjzhang/uncurl_python",
"path": "uncurl/vis.py",
"copies": "1",
"size": "2344",
"license": "mit",
"hash": 746178538956673400,
"line_mean": 39.4137931034,
"line_max": 164,
"alpha_frac": 0.5976962457,
"autogenerated": false,
"ratio": 3.5950920245398774,
"config_test": false,
"has... |
#basic glut setup learned from here:
#http://www.java2s.com/Open-Source/Python/Game-2D-3D/PyOpenGL/PyOpenGL-Demo-3.0.1b1/PyOpenGL-Demo/NeHe/lesson2.py.htm
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import sys
#helper modules
import glutil
from vector import Vec
#OpenCL code
import car... | {
"repo_name": "cjld/adventures_in_opencl",
"path": "experiments/chaotic_artist/main.py",
"copies": "5",
"size": "6482",
"license": "mit",
"hash": 8562048364408157000,
"line_mean": 26.2352941176,
"line_max": 117,
"alpha_frac": 0.5509102129,
"autogenerated": false,
"ratio": 3.2671370967741935,
"c... |
"""Basic Graphical User Interface Components
"""
import os
import collections
import functools
import inspect
from PyQt4 import QtGui, QtCore
CONFIG = {'font': QtGui.QFont(),
'translator': QtCore.QTranslator(),
'locale': 'default'}
def with_app(func):
"""Intended to be used as a decorator to ... | {
"repo_name": "aroberge/qt_py",
"path": "experiment/bguic.py",
"copies": "1",
"size": "8223",
"license": "mit",
"hash": 2770018799415057000,
"line_mean": 33.6962025316,
"line_max": 79,
"alpha_frac": 0.5915116138,
"autogenerated": false,
"ratio": 4.27613104524181,
"config_test": true,
"has_no_... |
"""Basic graphic representing an image.
---NODOC---
TODO:
- a solution to the rotation problem (jaggy edges if they were the surface borders)
- why can't we move rotate earlier?
- use subsurface for crop transform (but requires rect to be within surface)
- GraphicView probably doesn't work if in different manager... | {
"repo_name": "ikn/pygame-template",
"path": "game/engine/gfx/graphic.py",
"copies": "1",
"size": "54367",
"license": "bsd-3-clause",
"hash": 2865249005357930000,
"line_mean": 32.4978434997,
"line_max": 125,
"alpha_frac": 0.5546563173,
"autogenerated": false,
"ratio": 3.889747442226515,
"config... |
"""Basic graph implementation"""
# Copyright (c) 2017 Aubrey Barnard. This is free software released
# under the MIT license. See LICENSE for details.
import collections
class Graph:
def __init__(
self,
node_store=None,
edge_store=None,
weight_store=None,
... | {
"repo_name": "afbarnard/barnapy",
"path": "barnapy/graph.py",
"copies": "1",
"size": "7867",
"license": "mit",
"hash": 1580757605126628900,
"line_mean": 27.2985611511,
"line_max": 72,
"alpha_frac": 0.5735350197,
"autogenerated": false,
"ratio": 3.848825831702544,
"config_test": false,
"has_n... |
# basic graph using dictionary
# http://kam.mff.cuni.cz/~kuba/ka/reprezentace_grafu.pdf
# https://en.wikipedia.org/wiki/Dijkstra's_algorithm
import sys
import queue # pouzijeme priority queue
INFINITY = sys.maxsize
class Edge:
def __init__(self, input, output, distance):
self.input = input
self... | {
"repo_name": "uai/VZI",
"path": "05/py/graph.py",
"copies": "1",
"size": "3837",
"license": "bsd-3-clause",
"hash": 6612384789883055000,
"line_mean": 22.98125,
"line_max": 83,
"alpha_frac": 0.5663278603,
"autogenerated": false,
"ratio": 3.0993537964458806,
"config_test": false,
"has_no_keywo... |
""" Basic helper things. """
import os, string, shlex, subprocess
from stdout import log, error
def bool_of_string(s):
""" Converts a string to a bool, raises a ``ValueError`` in case of
failure. """
if s in [ "1", "t", "T", "true", "True" ]: return True
elif s in [ "0", "f", "F", "false", "False"]: r... | {
"repo_name": "kind2-mc/testeas",
"path": "src/lib.py",
"copies": "1",
"size": "2638",
"license": "apache-2.0",
"hash": -4553755129230841000,
"line_mean": 31.1829268293,
"line_max": 75,
"alpha_frac": 0.5742987111,
"autogenerated": false,
"ratio": 3.5267379679144386,
"config_test": false,
"has... |
# Basic HTML skeleton
html = '''
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{0[title]}</title>
{0[includes]}
</head>
<body>
{0[content]}
</body>
</html>
'''
# Favicon skeleton
favicon = '<link type="image/x-icon" rel="shortcut icon" href="{}" />'
# CSS include skeleton
css =... | {
"repo_name": "seecurity/klausuromat",
"path": "klausuromat/html.py",
"copies": "2",
"size": "2439",
"license": "mit",
"hash": 2596076816027908600,
"line_mean": 24.9468085106,
"line_max": 120,
"alpha_frac": 0.5727757278,
"autogenerated": false,
"ratio": 3.9402261712439417,
"config_test": false,... |
"""Basic HTTP abstractions and functionality"""
from base64 import b64encode
from collections.abc import Mapping
from functools import partial
from itertools import chain
from operator import attrgetter, methodcaller
__all__ = [
"Request",
"Response",
"header_adder",
"prefix_adder",
"basic_auth",
... | {
"repo_name": "ariebovenberg/snug",
"path": "src/snug/http.py",
"copies": "2",
"size": "5541",
"license": "mit",
"hash": -546137201603192700,
"line_mean": 24.4174311927,
"line_max": 74,
"alpha_frac": 0.5838296336,
"autogenerated": false,
"ratio": 4.038629737609329,
"config_test": false,
"has_... |
# basic idea of the questionnaire is to provide the first pass of representing
# the survey
# todo:
# - Survey needs a function to proffer the survey and get a response. This response
# should be returned as a some kind of collection of data containing the actual responses,
# the question ids (since they might be... | {
"repo_name": "SurveyMan/SMPy",
"path": "evaluation/objects.py",
"copies": "1",
"size": "5771",
"license": "apache-2.0",
"hash": 634668240294724700,
"line_mean": 30.3641304348,
"line_max": 155,
"alpha_frac": 0.549124935,
"autogenerated": false,
"ratio": 3.8447701532311793,
"config_test": false,... |
# Basic ideas of the Principal Component Analysis (PCA)
The principal component analysis deals with the problem of fitting a
low-dimensional affine subspace $S$ of dimension $d$ much smaller than
the total dimension $D$ of the problem at hand (our data
set). Mathematically it can be formulated as a statistical problem... | {
"repo_name": "CompPhysics/MachineLearning",
"path": "doc/LectureNotes/_build/jupyter_execute/chapter8.py",
"copies": "1",
"size": "35065",
"license": "cc0-1.0",
"hash": 1279516794857812000,
"line_mean": 43.3109987358,
"line_max": 503,
"alpha_frac": 0.7183086536,
"autogenerated": false,
"ratio": ... |
"""Basic implementation of a card."""
from csrv.model import actions
from csrv.model import events
from csrv.model import game_object
from csrv.model import modifiers
from csrv.model import timing_phases
from csrv.model.cards import installable_card
from csrv.model.cards import card_info
class Agenda(installable_car... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/cards/agenda.py",
"copies": "1",
"size": "2187",
"license": "apache-2.0",
"hash": 8268738294290006000,
"line_mean": 27.4025974026,
"line_max": 80,
"alpha_frac": 0.7325102881,
"autogenerated": false,
"ratio": 3.401244167962675,
"config_t... |
"""Basic implementation of a card."""
from csrv.model import game_object
from csrv.model import events
from csrv.model.cards import registry
from csrv.model.cards import card_info
class CardMeta(type):
"""A metaclass to register every known card."""
def __new__(mcs, name, bases, new_attrs):
for attr, values ... | {
"repo_name": "mrroach/CentralServer",
"path": "csrv/model/cards/card_base.py",
"copies": "1",
"size": "8944",
"license": "apache-2.0",
"hash": 3900038810340185000,
"line_mean": 25.9397590361,
"line_max": 80,
"alpha_frac": 0.6673747764,
"autogenerated": false,
"ratio": 3.287026828371922,
"confi... |
''' Basic implementation of locator for use on computers
that don't have OpenCL.'''
import numpy
from numpy import float32, abs, maximum, minimum
from math import pi, radians
class Locator(object):
def __init__( self, north, east, length, size, sigma ):
north = numpy.linspace(north-length/2., north+lengt... | {
"repo_name": "cuauv/software",
"path": "locator/locator_numpy.py",
"copies": "1",
"size": "4056",
"license": "bsd-3-clause",
"hash": 2959586221397047300,
"line_mean": 36.5555555556,
"line_max": 120,
"alpha_frac": 0.6163708087,
"autogenerated": false,
"ratio": 3.5672823218997363,
"config_test":... |
"""Basic import and mixin classes."""
import datetime
from sqlalchemy.ext.declarative import declarative_base, \
as_declarative
from sqlalchemy.orm import relationship, backref, \
collections
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.hybrid import hybrid_property
from sq... | {
"repo_name": "DanceCats/CoreCat",
"path": "corecat/models/_sqlalchemy.py",
"copies": "1",
"size": "2618",
"license": "mit",
"hash": -5793398749635926000,
"line_mean": 30.5421686747,
"line_max": 79,
"alpha_frac": 0.5805958747,
"autogenerated": false,
"ratio": 4.560975609756097,
"config_test": f... |
#basic imports
import sys, os, copy
import numpy as np
import datetime as dt
import pandas as pd
#import libraries for file checking
from os.path import isfile, join, isdir
#importing json (data are mostly in JSON)
import json
def Load_Datasets(FileAddress_movies,FileAddress_credits):
##input: location of files
... | {
"repo_name": "mdeff/ntds_2017",
"path": "projects/reports/movie_network/python/Load_Datasets.py",
"copies": "1",
"size": "6638",
"license": "mit",
"hash": 3454266203590676500,
"line_mean": 37.8245614035,
"line_max": 123,
"alpha_frac": 0.6223260018,
"autogenerated": false,
"ratio": 4.310389610389... |
""" basic inference routines """
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
from pandas._typing import ArrayLike
is_bool = lib.is_bool
is_integer = lib.is_integer
is_float = lib.is_float
is_complex = lib.is_complex
... | {
"repo_name": "datapythonista/pandas",
"path": "pandas/core/dtypes/inference.py",
"copies": "3",
"size": "9194",
"license": "bsd-3-clause",
"hash": -8226575379507777000,
"line_mean": 19.3858093126,
"line_max": 78,
"alpha_frac": 0.5637372199,
"autogenerated": false,
"ratio": 3.838830897703549,
"... |
""" basic inference routines """
from collections import abc
from numbers import Number
import re
from typing import Pattern
import numpy as np
from pandas._libs import lib
is_bool = lib.is_bool
is_integer = lib.is_integer
is_float = lib.is_float
is_complex = lib.is_complex
is_scalar = lib.is_scalar
is_decimal... | {
"repo_name": "gfyoung/pandas",
"path": "pandas/core/dtypes/inference.py",
"copies": "2",
"size": "8558",
"license": "bsd-3-clause",
"hash": -5905885333207729000,
"line_mean": 19.2796208531,
"line_max": 78,
"alpha_frac": 0.5606450105,
"autogenerated": false,
"ratio": 3.8222420723537294,
"config... |
""" basic inference routines """
from numbers import Number
import re
import numpy as np
from pandas._libs import lib
from pandas.compat import (
PY2, Set, re_type, string_and_binary_types, string_types, text_type)
from pandas import compat
is_bool = lib.is_bool
is_integer = lib.is_integer
is_float = lib.is_... | {
"repo_name": "MJuddBooth/pandas",
"path": "pandas/core/dtypes/inference.py",
"copies": "1",
"size": "10249",
"license": "bsd-3-clause",
"hash": 3118788372494055400,
"line_mean": 19.5390781563,
"line_max": 79,
"alpha_frac": 0.5628841838,
"autogenerated": false,
"ratio": 3.8142910308894677,
"con... |
""" basic inference routines """
import collections
import re
import numpy as np
from collections import Iterable
from numbers import Number
from pandas.compat import (PY2, string_types, text_type,
string_and_binary_types)
from pandas._libs import lib
is_bool = lib.is_bool
is_integer = lib... | {
"repo_name": "ryfeus/lambda-packs",
"path": "Pandas_numpy/source/pandas/core/dtypes/inference.py",
"copies": "4",
"size": "8415",
"license": "mit",
"hash": -1377727128094181400,
"line_mean": 18.7535211268,
"line_max": 79,
"alpha_frac": 0.5591206179,
"autogenerated": false,
"ratio": 3.87788018433... |
""" basic inference routines """
import collections
import re
import numpy as np
from numbers import Number
from pandas.compat import (PY2, string_types, text_type,
string_and_binary_types)
from pandas._libs import lib
is_bool = lib.is_bool
is_integer = lib.is_integer
is_float = lib.is_fl... | {
"repo_name": "mbayon/TFG-MachineLearning",
"path": "venv/lib/python3.6/site-packages/pandas/core/dtypes/inference.py",
"copies": "8",
"size": "8381",
"license": "mit",
"hash": 8192291379940573000,
"line_mean": 18.72,
"line_max": 79,
"alpha_frac": 0.5570934256,
"autogenerated": false,
"ratio": 3.... |
""" basic inference routines """
import re
import numpy as np
from numbers import Number
from pandas import compat
from pandas.compat import (PY2, string_types, text_type,
string_and_binary_types, re_type)
from pandas._libs import lib
is_bool = lib.is_bool
is_integer = lib.is_integer
is_f... | {
"repo_name": "cython-testbed/pandas",
"path": "pandas/core/dtypes/inference.py",
"copies": "1",
"size": "9777",
"license": "bsd-3-clause",
"hash": -3301160981811556400,
"line_mean": 19.2842323651,
"line_max": 79,
"alpha_frac": 0.5599877263,
"autogenerated": false,
"ratio": 3.8087261394624075,
... |
"""Basic information of networks."""
from collections import namedtuple
from datetime import datetime
Network = namedtuple("Network", "name, channels, starttime, url")
""" An object containing information of a network.
.. py:attribute:: name
Network name.
.. py:attribute:: channels
Number of channels the ne... | {
"repo_name": "seisman/HinetPy",
"path": "HinetPy/header.py",
"copies": "1",
"size": "14806",
"license": "mit",
"hash": 7125514480921263000,
"line_mean": 23.8840336134,
"line_max": 72,
"alpha_frac": 0.6039443469,
"autogenerated": false,
"ratio": 2.6576916173038954,
"config_test": false,
"has_... |
# basic interface a node has
class NodeBase:
def getOutput(self):
raise Exception("NodeBase: need to implement getOutput")
def getState(self):
raise Exception("NodeBase: need to implement getState")
class VariableBase:
def setVariable(self):
raise Exception("VariableBase: need to ... | {
"repo_name": "cjackie/JensorFlow",
"path": "proto/flow.py",
"copies": "1",
"size": "3202",
"license": "apache-2.0",
"hash": -7726072437457040000,
"line_mean": 22.2028985507,
"line_max": 70,
"alpha_frac": 0.4728294816,
"autogenerated": false,
"ratio": 4.246684350132626,
"config_test": false,
... |
""" Basic I/O handling in python.
"""
# For script arguments.
import sys
import os
# For random dates.
from random import randint
from datetime import datetime, timedelta
def random_date():
"""Generate a random date.
"""
# Randomized date into the past.
now = datetime.now()
delta = timedelta(day... | {
"repo_name": "jeremyosborne/python",
"path": "datatypes/files.py",
"copies": "1",
"size": "1555",
"license": "mit",
"hash": 8629528947771765000,
"line_mean": 26.7678571429,
"line_max": 72,
"alpha_frac": 0.5704180064,
"autogenerated": false,
"ratio": 4.060052219321149,
"config_test": false,
"... |
""" Basic io operations. See conf_log_ for the semantics of the
log level. """
from flags import log_lvl
def new_line(lvl=2):
""" Prints a new line. """
log( "", lvl )
def log(line, lvl=2):
""" Prints a line if `lvl` is greater than the log level. """
if log_lvl() >= lvl:
print("{}".format(li... | {
"repo_name": "kind2-mc/testeas",
"path": "src/stdout.py",
"copies": "1",
"size": "1712",
"license": "apache-2.0",
"hash": 2174933863582558700,
"line_mean": 25.765625,
"line_max": 69,
"alpha_frac": 0.5642523364,
"autogenerated": false,
"ratio": 3.2796934865900385,
"config_test": false,
"has_n... |
"""Basic Layer of Neural Network
This module describes a base layer of neural network (not including ConvNet)
It can be base of:
+ Identity layer
+ Tanh layer
+ Sigmoid layer
+ ReLU layer
+ Softmax layer
"""
import theano.tensor as T;
import scae_destin.util as util;
class Layer(object):
"""Abstract layer for... | {
"repo_name": "Linaf/Convae-Destin",
"path": "scae_destin/layer.py",
"copies": "3",
"size": "3066",
"license": "apache-2.0",
"hash": 8878708439274812000,
"line_mean": 24.7731092437,
"line_max": 94,
"alpha_frac": 0.4928245271,
"autogenerated": false,
"ratio": 4.342776203966006,
"config_test": fa... |
# Basic LDA Enricher class
from math import sqrt
import math
import scipy.stats as s
import array as a
from scipy.optimize import fminbound
from scipy.special import gammaln as gamln
from numpy import log, pi, log10, e, log1p, exp
import numpy as np
from .MultiSiteCommon import MultiSiteCommon
from .MixtureEstimatio... | {
"repo_name": "PacificBiosciences/kineticsTools",
"path": "kineticsTools/BasicLdaEnricher.py",
"copies": "1",
"size": "2762",
"license": "bsd-3-clause",
"hash": -1623746900966288000,
"line_mean": 35.8266666667,
"line_max": 126,
"alpha_frac": 0.5981173063,
"autogenerated": false,
"ratio": 3.356014... |
# Basic libraries
import httplib
import mimetypes
import urlparse
import uuid
import json
import logging
import urllib
import urllib2
# Read configuration file
import ConfigParser
# Send images
from PIL import Image
# Telegram Helper functions
import TelegramHelpers as Telegram
# Google App Engine
from google.appen... | {
"repo_name": "JSidrach/pozo-bot",
"path": "TelegramHelpers.py",
"copies": "1",
"size": "4680",
"license": "mit",
"hash": 6123968415075864000,
"line_mean": 29.5882352941,
"line_max": 128,
"alpha_frac": 0.6256410256,
"autogenerated": false,
"ratio": 3.556231003039514,
"config_test": true,
"has... |
# Basic libraries
import numpy as np
import tensorflow as tf
tf.reset_default_graph()
tf.set_random_seed(2016)
np.random.seed(2016)
# LSTM-autoencoder
from LSTMAutoencoder import *
# Constants
batch_num = 128
hidden_num = 12
step_num = 8
elem_num = 1
iteration = 10000
# placeholder list
p_input = tf.placeholder(tf.... | {
"repo_name": "iwyoo/LSTM-autoencoder",
"path": "test.py",
"copies": "1",
"size": "1597",
"license": "mit",
"hash": -5977155531970845000,
"line_mean": 32.2708333333,
"line_max": 95,
"alpha_frac": 0.6211646838,
"autogenerated": false,
"ratio": 2.9906367041198503,
"config_test": false,
"has_no_... |
# Basic libraries
import random
import json
import re
import urllib
import urllib2
import logging
# Google App Engine
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
# Constants
# Help command
HELP_COMMAND = ('The almighty @PozoBot!\n\nCommands available:\n' \
'/help - F... | {
"repo_name": "JSidrach/pozo-bot",
"path": "Pozo.py",
"copies": "1",
"size": "2973",
"license": "mit",
"hash": -389442236940624300,
"line_mean": 31.3152173913,
"line_max": 122,
"alpha_frac": 0.6569122099,
"autogenerated": false,
"ratio": 3.3899657924743445,
"config_test": false,
"has_no_keywo... |
# basic library
import os
import shutil
import math
import time
import h5py
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
from pathlib import Path
from functools import partial
# deepmachine
import keras
import tensorflow as tf
import deepmachine as dm
from deepmachine.utils.machine import multi_... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/Recognition.py",
"copies": "1",
"size": "4013",
"license": "mit",
"hash": 7890401361579792000,
"line_mean": 27.0629370629,
"line_max": 132,
"alpha_frac": 0.5706454024,
"autogenerated": false,
"ratio": 3.54818744473916... |
# basic library
import os
import shutil
import math
import time
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
from menpo.shape import ColouredTriMesh
from menpo.image import Image
from menpo.transform import Homogeneous, Scale, Translation
from menpo3d.rasterize import rasterize_mesh
from menpo3d.... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/UVMeshAE.py",
"copies": "1",
"size": "7002",
"license": "mit",
"hash": 1371793187295476000,
"line_mean": 37.6850828729,
"line_max": 159,
"alpha_frac": 0.5871179663,
"autogenerated": false,
"ratio": 3.527455919395466,
... |
# basic library
import os
import shutil
import math
import time
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
from pathlib import Path
from functools import partial
from menpo3d.unwrap import optimal_cylindrical_unwrap
# deepmachine
import keras
import tensorflow as tf
import deepmachine as dm
#... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/FaceUVAutoEncoder.py",
"copies": "1",
"size": "6849",
"license": "mit",
"hash": -6807046161332159000,
"line_mean": 39.0584795322,
"line_max": 146,
"alpha_frac": 0.5675281063,
"autogenerated": false,
"ratio": 3.4590909... |
# basic library
import os
import shutil
import math
import time
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
from pathlib import Path
from functools import partial
# deepmachine
import keras
import tensorflow as tf
import deepmachine as dm
# flag definitions
from deepmachine.flags import FLAGS
... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/DenseRegFace.py",
"copies": "1",
"size": "2471",
"license": "mit",
"hash": 1186398729633329200,
"line_mean": 29.5061728395,
"line_max": 105,
"alpha_frac": 0.607446378,
"autogenerated": false,
"ratio": 3.62848751835535... |
# basic library
import os
import shutil
import math
import time
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
import h5py
import pandas as pd
import datetime
from menpo.shape import ColouredTriMesh, PointCloud
from menpo.image import Image
from menpo.transform import Homogeneous
from menpo3d.rast... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/estimator_mesh_ae.py",
"copies": "1",
"size": "17414",
"license": "mit",
"hash": -2049709996669736200,
"line_mean": 35.8160676533,
"line_max": 144,
"alpha_frac": 0.5768347307,
"autogenerated": false,
"ratio": 3.576504... |
# basic library
import os
import shutil
import math
import time
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
import h5py
import pandas as pd
from menpo.shape import ColouredTriMesh, PointCloud
from menpo.image import Image
from menpo.transform import Homogeneous
from menpo3d.rasterize import ras... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/keras_3DMM.py",
"copies": "1",
"size": "10073",
"license": "mit",
"hash": -45038328118060690,
"line_mean": 33.3788395904,
"line_max": 129,
"alpha_frac": 0.6097488335,
"autogenerated": false,
"ratio": 3.291830065359477... |
# basic library
import os
import shutil
import math
import time
import menpo.io as mio
import menpo3d.io as m3io
import numpy as np
import h5py
from menpo.shape import ColouredTriMesh
from menpo.transform import Homogeneous
from menpo3d.rasterize import rasterize_mesh
from pathlib import Path
from functools import par... | {
"repo_name": "yuxiang-zhou/deepmachine",
"path": "deepmachine/contrib/training/CoMA.py",
"copies": "1",
"size": "11891",
"license": "mit",
"hash": -8844431487886182000,
"line_mean": 35.4754601227,
"line_max": 157,
"alpha_frac": 0.5643764191,
"autogenerated": false,
"ratio": 3.5326797385620914,
... |
#Basic Library of Functions
#To Identify Various Chords and Strums
#Using openCV
import cv2
import numpy as np
import play
neck_len=500
neck_top=0
neck_bottom=500
#(post_fix_num,note)
#Notes making each chords in Standard Guitar Tuning
strums = {
'A': [(3,7),(2,4),(3,0),(2,7),(1,0),(1,7)],
'C... | {
"repo_name": "SyntaxError2013/Unbreakables",
"path": "lib.py",
"copies": "1",
"size": "4966",
"license": "mit",
"hash": -6565159471303704000,
"line_mean": 22.5841584158,
"line_max": 83,
"alpha_frac": 0.6010873943,
"autogenerated": false,
"ratio": 2.469418199900547,
"config_test": false,
"has... |
# basiclibrary.py
#
# imports everything you want to make a game
from textadv.core.rulesystem import NotHandled, AbortAction, ActionHandled, MultipleResults, FinishWith
from textadv.gamesystem.utilities import *
from textadv.gamesystem.relations import *
from textadv.gamesystem.gamecontexts import ActorContext, execut... | {
"repo_name": "kmill/textadv",
"path": "textadv/basicsetup.py",
"copies": "1",
"size": "1916",
"license": "mit",
"hash": -3576496208745107500,
"line_mean": 38.9166666667,
"line_max": 140,
"alpha_frac": 0.7369519833,
"autogenerated": false,
"ratio": 3.4963503649635035,
"config_test": false,
"h... |
# basiclibrary.py
#
# This is the basic library for how the world works.
from textadv.core.patterns import VarPattern, BasicPattern, PNot, PEquals, PIn
from textadv.core.rulesystem import handler_requires, ActionHandled, MultipleResults, NotHandled, AbortAction, make_rule_decorator
from textadv.gamesystem.relations im... | {
"repo_name": "kmill/textadv",
"path": "textadv/gameworld/basiclibrary.py",
"copies": "1",
"size": "3447",
"license": "mit",
"hash": -5956844132192148000,
"line_mean": 34.1734693878,
"line_max": 191,
"alpha_frac": 0.7525384392,
"autogenerated": false,
"ratio": 3.460843373493976,
"config_test": ... |
'''Basic, limited Panasonic protocol, suitable for some Panasonic displays, will be expaned over time.'''
# taken from page 18:
# - https://bizpartner.panasonic.net/public/system/files/files/fields/field_file/psd/2014/11/20/lf6_lf60u_manual_en_1416462484.pdf
# - https://panasonic.biz/cns/prodisplays/support/commandlis... | {
"repo_name": "museumvictoria/nodel-recipes",
"path": "Panasonic Display/Mk1/script.py",
"copies": "1",
"size": "13464",
"license": "mit",
"hash": 947778570813660800,
"line_mean": 31.2877697842,
"line_max": 166,
"alpha_frac": 0.617721331,
"autogenerated": false,
"ratio": 3.273522975929978,
"con... |
"""Basic linear algebra library streamlined for dynamics applications
"""
import warnings
from math import sqrt, acos, sin, cos
from pyglet import gl
def raw(*args):
return (gl.GLfloat * len(args))(*args)
def frange(start, inc, end=None):
if end is None:
end = inc
inc = 1.
n = int((end - start) / inc + 1.)
... | {
"repo_name": "Tythos/hypyr",
"path": "linal.py",
"copies": "1",
"size": "8361",
"license": "mit",
"hash": -5396886140024204000,
"line_mean": 26.9632107023,
"line_max": 119,
"alpha_frac": 0.5641669657,
"autogenerated": false,
"ratio": 2.362531788640859,
"config_test": false,
"has_no_keywords"... |
"""Basic Linear Algebra utility functions implemented as gufuncs,
broadcasting
This file contains the wrappers for several basic linear algebra
functions as gufuncs. The underlying implementation is BLAS based.
- inner1d: inner product (dot product) over the inner dimension,
broadcasting
- dotc1d: inner product by... | {
"repo_name": "ContinuumIO/gulinalg",
"path": "gulinalg/gufunc_general.py",
"copies": "1",
"size": "8077",
"license": "bsd-2-clause",
"hash": -2264455132689830400,
"line_mean": 21.3739612188,
"line_max": 78,
"alpha_frac": 0.570385044,
"autogenerated": false,
"ratio": 3.686444545869466,
"config_... |
"""Basic linear combinations that implicitly generate variables."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def linear(args, output_size, bias, bias_start=0.0, scope=None):
"""Linear map: sum_i(args[i] * W[i]), where W[i]... | {
"repo_name": "brodyh/tensorflow",
"path": "tensorflow/models/rnn/linear.py",
"copies": "5",
"size": "1807",
"license": "apache-2.0",
"hash": -2724496021808940500,
"line_mean": 33.0943396226,
"line_max": 80,
"alpha_frac": 0.6563364693,
"autogenerated": false,
"ratio": 3.5782178217821783,
"confi... |
"""Basic linear combinations that implicitly generate variables."""
import tensorflow as tf
def linear(args, output_size, bias, bias_start=0.0, scope=None):
"""Linear map: sum_i(args[i] * W[i]), where W[i] is a variable.
Args:
args: a 2D Tensor or a list of 2D, batch x n, Tensors.
output_size: int, seco... | {
"repo_name": "liyu1990/tensorflow",
"path": "tensorflow/models/rnn/linear.py",
"copies": "5",
"size": "1697",
"license": "apache-2.0",
"hash": 9120011800579375000,
"line_mean": 33.6326530612,
"line_max": 80,
"alpha_frac": 0.6499705362,
"autogenerated": false,
"ratio": 3.5427974947807934,
"conf... |
"""Basic linear factorizations needed by the solver."""
from __future__ import division, print_function, absolute_import
from scipy.sparse import (bmat, csc_matrix, eye, issparse)
from scipy.sparse.linalg import LinearOperator
import scipy.linalg
import scipy.sparse.linalg
try:
from sksparse.cholmod import cholesk... | {
"repo_name": "jor-/scipy",
"path": "scipy/optimize/_trustregion_constr/projections.py",
"copies": "15",
"size": "13166",
"license": "bsd-3-clause",
"hash": 4716904763021025000,
"line_mean": 31.4285714286,
"line_max": 80,
"alpha_frac": 0.5303053319,
"autogenerated": false,
"ratio": 3.435803757828... |
"""Basic linear factorizations needed by the solver."""
from scipy.sparse import (bmat, csc_matrix, eye, issparse)
from scipy.sparse.linalg import LinearOperator
import scipy.linalg
import scipy.sparse.linalg
try:
from sksparse.cholmod import cholesky_AAt
sksparse_available = True
except ImportError:
impor... | {
"repo_name": "anntzer/scipy",
"path": "scipy/optimize/_trustregion_constr/projections.py",
"copies": "22",
"size": "13105",
"license": "bsd-3-clause",
"hash": -7847605868956272000,
"line_mean": 31.3580246914,
"line_max": 80,
"alpha_frac": 0.5290347196,
"autogenerated": false,
"ratio": 3.43152657... |
# Basic Link List Implementation
class Node(object):
def __init__(self,val):
self.val = val
self.next = None
class LinkList(object):
def __init__(self):
self.head = None
def add_node_front(self,val):
"""
Add node at the front of the lsit.
"""
new_no... | {
"repo_name": "bkpathak/Programs-Collections",
"path": "python/LinkList/link_list_basic.py",
"copies": "2",
"size": "2339",
"license": "mit",
"hash": 4451417402544869400,
"line_mean": 23.6210526316,
"line_max": 49,
"alpha_frac": 0.5215904233,
"autogenerated": false,
"ratio": 3.7665056360708533,
... |
"""Basic LISP parser
We use library items, so we get " strings, float, int, and hex
atoms, as well as lists. Note: Lisp doesn't seem to
use "," for seperating atoms in lists? I don't really
remember it well enough to recall, but seems to match the
samples I see.
Note: Original grammar was from a sample in the YAPPS... | {
"repo_name": "alexus37/AugmentedRealityChess",
"path": "pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/simpleparse/examples/lisp.py",
"copies": "1",
"size": "1802",
"license": "mit",
"hash": -1788774122380908300,
"line_mean": 26.7230769231,
"line_max": 70,
"alpha... |
"""Basic listener commands."""
import logging
from typing import TYPE_CHECKING, Any, Dict, List, Union
from django.conf import settings
from django.db import transaction
from django.db.models import Sum
from django.db.models.functions import Coalesce
from django.urls import reverse
from django.utils.timezone import no... | {
"repo_name": "genialis/resolwe",
"path": "resolwe/flow/managers/listener/basic_commands_plugin.py",
"copies": "1",
"size": "19095",
"license": "apache-2.0",
"hash": -4007655389981761500,
"line_mean": 39.4555084746,
"line_max": 103,
"alpha_frac": 0.5850222571,
"autogenerated": false,
"ratio": 4.5... |
# Basic list exercises
# Fill in the code for the functions below. main() is already set up
# to call the functions with a few different inputs,
# printing 'OK' when each function is correct.
# The starter code for each function includes a 'return'
# which is just a placeholder for your code.
# It's ok if you do not co... | {
"repo_name": "morfioce/basic-python3",
"path": "2 Lists/solution/list1.py",
"copies": "1",
"size": "2955",
"license": "mit",
"hash": 7567984177744528000,
"line_mean": 30.7741935484,
"line_max": 79,
"alpha_frac": 0.5945854484,
"autogenerated": false,
"ratio": 2.969849246231156,
"config_test": t... |
"""Basic listing module that treadmill_list and REST API can use"""
from __future__ import absolute_import
import fnmatch
import logging
try:
import cPickle as pickle
except ImportError:
import pickle
from enum import Enum
from . import zknamespace as z
_LOGGER = logging.getLogger(__name__)
class StateE... | {
"repo_name": "toenuff/treadmill",
"path": "lib/python/treadmill/state.py",
"copies": "1",
"size": "4719",
"license": "apache-2.0",
"hash": -1391293892966424600,
"line_mean": 28.679245283,
"line_max": 78,
"alpha_frac": 0.5524475524,
"autogenerated": false,
"ratio": 4.3694444444444445,
"config_t... |
"""Basic listing module that treadmill_list and REST API can use.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import fnmatch
import logging
try:
import cPickle as pickle # pylint: disable=wrong-import-or... | {
"repo_name": "Morgan-Stanley/treadmill",
"path": "lib/python/treadmill/state.py",
"copies": "2",
"size": "4926",
"license": "apache-2.0",
"hash": -5833772087692241000,
"line_mean": 28.6746987952,
"line_max": 78,
"alpha_frac": 0.5613073488,
"autogenerated": false,
"ratio": 4.340088105726872,
"c... |
"""Basic listing module that treadmill_list and REST API can use"""
import fnmatch
import logging
try:
import pickle as pickle
except ImportError:
import pickle
from enum import Enum
from . import zknamespace as z
_LOGGER = logging.getLogger(__name__)
class StateEnum(Enum):
# pylint: disable=W0232
... | {
"repo_name": "keithhendry/treadmill",
"path": "treadmill/state.py",
"copies": "3",
"size": "4666",
"license": "apache-2.0",
"hash": -1204114599869963000,
"line_mean": 28.3459119497,
"line_max": 78,
"alpha_frac": 0.5512216031,
"autogenerated": false,
"ratio": 4.373008434864105,
"config_test": f... |
""" Basic logging configuration utilities.
Allows logging to std.stdout at the console and logging to a file.
"""
# python 2.7
from __future__ import absolute_import, unicode_literals, print_function
# builtins
import logging
import sys
from logging.handlers import RotatingFileHandler
from os import path
# custom
... | {
"repo_name": "nueverest/BlowDryCSS",
"path": "blowdrycss/log.py",
"copies": "1",
"size": "2046",
"license": "mit",
"hash": 8258640340556466000,
"line_mean": 33.1,
"line_max": 100,
"alpha_frac": 0.6402737048,
"autogenerated": false,
"ratio": 4.4094827586206895,
"config_test": false,
"has_no_k... |
"""Basic logging functionality.
Supports logging to stdout, syslog and file.
"""
from typing import Optional, Any, cast
import os
import os.path
import logging
import logging.handlers
from irisett import errors
# Yes yes, globals are ugly.
logger = None
def configure_logging(logtype: str, logfilename: Optional[s... | {
"repo_name": "beebyte/irisett",
"path": "irisett/log.py",
"copies": "1",
"size": "2550",
"license": "mit",
"hash": -7514117291011839000,
"line_mean": 29,
"line_max": 95,
"alpha_frac": 0.622745098,
"autogenerated": false,
"ratio": 3.7666174298375186,
"config_test": false,
"has_no_keywords": f... |
"""Basic math / linear algebra routines. Defines the following AD functions:
================= ============= ===================================
Function Derivative Notes
================= ============= ===================================
exp 1
log 1
sqrt ... | {
"repo_name": "krishauser/Klampt",
"path": "Python/klampt/math/autodiff/math_ad.py",
"copies": "1",
"size": "15169",
"license": "bsd-3-clause",
"hash": -325551842538487800,
"line_mean": 28.454368932,
"line_max": 132,
"alpha_frac": 0.54149911,
"autogenerated": false,
"ratio": 3.276949665154461,
... |
""" BASIC MCPROXY COMMANDS """
from modules import Command, Hook, colors
from conf import settings
import re
#----------------- Commands ------------------
class Help(Command):
"""
syntax: help [command] [EXTRA]
If command is empty, will list all commands. change page with %(metachar)shelp [1|2|...]
"... | {
"repo_name": "twoolie/Minecraft-Tools",
"path": "src/minecraft/modules/base.py",
"copies": "1",
"size": "2725",
"license": "mit",
"hash": -8145864968878506000,
"line_mean": 35.8243243243,
"line_max": 95,
"alpha_frac": 0.5269724771,
"autogenerated": false,
"ratio": 4.395161290322581,
"config_te... |
""" BASIC MCPROXY COMMANDS """
from modules import Command, Hook
class DumpPackets(Command):
"""
syntax: dumpPackets [on|off]
If no on|off state is specified the packet dumping state will be toggled
"""
alias = "dump" # optional alias
def run(self, *args):
if args[0]:
s... | {
"repo_name": "gm-stack/mcproxy",
"path": "src/modules/base.py",
"copies": "1",
"size": "2203",
"license": "mit",
"hash": -200374453928892800,
"line_mean": 33.9682539683,
"line_max": 83,
"alpha_frac": 0.5587834771,
"autogenerated": false,
"ratio": 4.388446215139442,
"config_test": false,
"has... |
"""Basic message consumer example"""
import functools
import logging
import pika
from pika.exchange_type import ExchangeType
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=logging.I... | {
"repo_name": "pika/pika",
"path": "examples/consume.py",
"copies": "1",
"size": "1682",
"license": "bsd-3-clause",
"hash": -4972946999669487000,
"line_mean": 31.3461538462,
"line_max": 92,
"alpha_frac": 0.6819262782,
"autogenerated": false,
"ratio": 3.8140589569161,
"config_test": false,
"ha... |
"""Basic message consumer example"""
import functools
import logging
import pika
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
def on_message(cha... | {
"repo_name": "vitaly-krugl/pika",
"path": "examples/consume.py",
"copies": "1",
"size": "1589",
"license": "bsd-3-clause",
"hash": 2829984708614373000,
"line_mean": 35.1136363636,
"line_max": 94,
"alpha_frac": 0.6488357458,
"autogenerated": false,
"ratio": 3.982456140350877,
"config_test": fal... |
""" Basic message container classes
Copyright (c) 2014 Kenn Takara
See LICENSE for details
"""
import collections
class BasicMessage(collections.MutableMapping):
""" A BasicMessage is just a collection of (ID, VALUE) pairs.
All IDs are converted into strings, this allows users of the
B... | {
"repo_name": "kennt/fixtest",
"path": "fixtest/base/message.py",
"copies": "1",
"size": "1573",
"license": "mit",
"hash": 8435159082596131000,
"line_mean": 28.1296296296,
"line_max": 71,
"alpha_frac": 0.5950413223,
"autogenerated": false,
"ratio": 4.393854748603352,
"config_test": false,
"ha... |
"""Basic messages protocol and design guide.
Messages are presented via JSON strings for sending through network
and via standard dict objects for local dispatching.
Messages in Bachata can be of two types:
1. Data messages
2. Transport messages
Data messages
-------------
Data messages are generic messages with ... | {
"repo_name": "05bit/bachata",
"path": "bachata/proto.py",
"copies": "1",
"size": "4777",
"license": "apache-2.0",
"hash": -4028386329902991000,
"line_mean": 34.125,
"line_max": 78,
"alpha_frac": 0.579861838,
"autogenerated": false,
"ratio": 4.257575757575758,
"config_test": false,
"has_no_ke... |
""" Basic methods for spatial filtering
Spatial filtering means to combine information from mostly similar sensors,
distributed in space.
The main principle is to define a linear filter in a training phase,
which tries to combine the sensor information to erase noise
and compress the relevant information.
"""
import ... | {
"repo_name": "pyspace/pyspace",
"path": "pySPACE/missions/nodes/spatial_filtering/spatial_filtering.py",
"copies": "2",
"size": "4470",
"license": "bsd-3-clause",
"hash": -8351407705905156000,
"line_mean": 39.6363636364,
"line_max": 99,
"alpha_frac": 0.6402684564,
"autogenerated": false,
"ratio"... |
"""Basic methods for trigonometric polynomials."""
import numpy as np
fft_form_default='r' # real input data
class Grid():
@staticmethod
def get_ZNl(N, fft_form=fft_form_default):
r"""
it produces index set ZNl=\underline{\set{Z}}^d_N :
ZNl[i][j]\in\set{Z} : -N[i]/2 <= ZNl[i] < N[i]... | {
"repo_name": "vondrejc/FFTHomPy",
"path": "ffthompy/trigpol.py",
"copies": "1",
"size": "6420",
"license": "mit",
"hash": 5767683956700167000,
"line_mean": 27.6607142857,
"line_max": 77,
"alpha_frac": 0.5152647975,
"autogenerated": false,
"ratio": 2.9261622607110302,
"config_test": false,
"h... |
"""Basic Model Interface (BMI) for the Diffusion model."""
import numpy as np
from basic_modeling_interface import Bmi
from .diffusion import Diffusion
class BmiDiffusion(Bmi):
"""BMI for the Diffusion model."""
_name = 'Diffusion model'
_input_var_names = ('plate_surface__temperature',)
_output_va... | {
"repo_name": "csdms/bmi-live-2017",
"path": ".totally-hidden-directory/bmi_diffusion.py",
"copies": "1",
"size": "7347",
"license": "mit",
"hash": -7073072437615353000,
"line_mean": 23.7373737374,
"line_max": 73,
"alpha_frac": 0.5019735947,
"autogenerated": false,
"ratio": 4.162606232294618,
"... |
"""Basic model
Revision ID: 76f2b3e733ab
Revises: None
Create Date: 2016-05-31 12:41:27.971197
"""
# revision identifiers, used by Alembic.
revision = '76f2b3e733ab'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto g... | {
"repo_name": "Limpan/bytardag",
"path": "web/migrations/versions/76f2b3e733ab_basic_model.py",
"copies": "1",
"size": "4018",
"license": "mit",
"hash": 4066836092504847400,
"line_mean": 38.7821782178,
"line_max": 91,
"alpha_frac": 0.6515679443,
"autogenerated": false,
"ratio": 3.3427620632279536... |
""" Basic models, such as user profile """
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class AccountHolder(models.Model):
user = models.ForeignKey(User, unique=True)
phone_number = models.CharField(max_length=11)
def __unicode__(self):
return self.phone_nu... | {
"repo_name": "TomWerner/sms_finance_tracker",
"path": "base/models.py",
"copies": "1",
"size": "1160",
"license": "bsd-3-clause",
"hash": 1390770111487092200,
"line_mean": 34.1818181818,
"line_max": 98,
"alpha_frac": 0.7396551724,
"autogenerated": false,
"ratio": 3.32378223495702,
"config_test... |
""" Basic models, such as user profile """
from django.db import models
from django.contrib.auth.models import User
class UrlQRCode(models.Model):
url = models.URLField()
qr_image = models.ImageField(
upload_to="qr_codes/url/",
height_field="qr_image_height",
width_field="qr_image_widt... | {
"repo_name": "hernangigena/corredor_django",
"path": "base/models.py",
"copies": "1",
"size": "1297",
"license": "bsd-3-clause",
"hash": 8017650065724841000,
"line_mean": 29.1627906977,
"line_max": 88,
"alpha_frac": 0.6746337702,
"autogenerated": false,
"ratio": 3.6535211267605634,
"config_tes... |
""" Basic models, such as user profile """
from django.db import models
class Language(models.Model):
name = models.CharField(max_length=40, null=False)
learn_url = models.URLField(null=True, blank=True)
@staticmethod
def all():
return [l.name for l in Language.objects.order_by('name')]
de... | {
"repo_name": "sloria/wtfhack",
"path": "wtfhack/base/models.py",
"copies": "1",
"size": "1148",
"license": "bsd-3-clause",
"hash": 5057387598964438000,
"line_mean": 31.8,
"line_max": 76,
"alpha_frac": 0.618466899,
"autogenerated": false,
"ratio": 3.8653198653198655,
"config_test": false,
"ha... |
""" Basic models, such as user profile """
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import (
AutoSlugField, CreationDateTimeField, ModificationDateTimeField,
)
try:
from django.utils.timezone import now as datetime_now
assert da... | {
"repo_name": "oskarm91/sis",
"path": "apps/base/models.py",
"copies": "1",
"size": "3495",
"license": "bsd-3-clause",
"hash": 2023146627545649700,
"line_mean": 33.2745098039,
"line_max": 118,
"alpha_frac": 0.6806866953,
"autogenerated": false,
"ratio": 4.277845777233782,
"config_test": false,
... |
# basic module browser.
# usage:
# >>> import browser
# >>> browser.Browse()
# or
# >>> browser.Browse(your_module)
import __main__
import string
import win32ui
from pywin.mfc import dialog
import hierlist
from types import *
special_names = [ '__doc__', '__name__', '__self__' ]
#
# HierList items
clas... | {
"repo_name": "nvoron23/arangodb",
"path": "3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/pythonwin/pywin/tools/browser.py",
"copies": "17",
"size": "11466",
"license": "apache-2.0",
"hash": 6193539945659067000,
"line_mean": 25.7897196262,
"line_max": 113,
"alpha_frac": 0.6670155242,
"... |
# basic module browser.
# usage:
# >>> import browser
# >>> browser.Browse()
# or
# >>> browser.Browse(your_module)
import sys
import types
import __main__
import win32ui
from pywin.mfc import dialog
from . import hierlist
special_names = [ '__doc__', '__name__', '__self__' ]
#
# HierList items
class HLIPythonObjec... | {
"repo_name": "Microsoft/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/pythonwin/pywin/tools/browser.py",
"copies": "7",
"size": "11790",
"license": "apache-2.0",
"hash": 3515546304949487000,
"line_mean": 26.0412844037,
"line_max": 113,
"alpha_frac": 0.6657336726,
"autog... |
# basic module browser.
# usage:
# >>> import browser
# >>> browser.Browse()
# or
# >>> browser.Browse(your_module)
import __main__
import string
import win32ui
from pywin.mfc import dialog
import hierlist
from types import *
special_names = [ '__doc__', '__name__', '__self__' ]
#
# ... | {
"repo_name": "Southpaw-TACTIC/Team",
"path": "src/python/Lib/site-packages/pythonwin/pywin/tools/browser.py",
"copies": "1",
"size": "11894",
"license": "epl-1.0",
"hash": -6278000675882294000,
"line_mean": 25.7897196262,
"line_max": 113,
"alpha_frac": 0.643013284,
"autogenerated": false,
"ratio... |
# basic module browser.
# usage:
# >>> import browser
# >>> browser.Browse()
# or
# >>> browser.Browse(your_module)
import sys
import types
import __main__
import win32ui
from pywin.mfc import dialog
import hierlist
special_names = [ '__doc__', '__name__', '__self__' ]
#
# HierList items
class HL... | {
"repo_name": "zhanqxun/cv_fish",
"path": "pythonwin/pywin/tools/browser.py",
"copies": "4",
"size": "12232",
"license": "apache-2.0",
"hash": 7460229572782231000,
"line_mean": 26.0550458716,
"line_max": 113,
"alpha_frac": 0.6424133421,
"autogenerated": false,
"ratio": 3.1156393275598573,
"conf... |
"""Basic morphology operations that create new encodings."""
import numpy as np
from . import encoding as enc
from . import ops
from ..constants import log_time
from .. import util
try:
from scipy.ndimage import morphology as _m
except BaseException as E:
# scipy is a soft dependency
from ..exceptions i... | {
"repo_name": "dajusc/trimesh",
"path": "trimesh/voxel/morphology.py",
"copies": "2",
"size": "5543",
"license": "mit",
"hash": 5580685748151511000,
"line_mean": 28.0209424084,
"line_max": 154,
"alpha_frac": 0.6575861447,
"autogenerated": false,
"ratio": 3.868108862526169,
"config_test": false,... |
# Basic motor driver for the pendulum drawing robot.
# Import the rpi gpio module
import RPi.GPIO as GPIO
from time import sleep
# Define motor pins
M1EN = 25
M1A = 23
M1B = 24
M2EN = 22
M2A = 27
M2B = 17
M_OFF = (0, 0)
M_FOR = (1, 0)
M_REV = (0, 1)
M_LOC = (1, 1)
# Start swtich pin
SPIN = 18
# Initalize the GPIO... | {
"repo_name": "KEClaytor/pendrawlum",
"path": "motor.py",
"copies": "1",
"size": "3660",
"license": "mit",
"hash": -3547191506510667300,
"line_mean": 25.9117647059,
"line_max": 77,
"alpha_frac": 0.6035519126,
"autogenerated": false,
"ratio": 3.0860033726812817,
"config_test": false,
"has_no_k... |
"""Basic MUD server module for creating text-based Multi-User Dungeon
(MUD) games.
Contains one class, MudServer, which can be instantiated to start a
server running then used to send and receive messages from players.
author: Mark Frimston - mfrimston@gmail.com
"""
import socket
import select
import time
import sy... | {
"repo_name": "nerdyLawman/mud-board",
"path": "mudserver.py",
"copies": "1",
"size": "16500",
"license": "mit",
"hash": -4384207484426589700,
"line_mean": 39.1459854015,
"line_max": 79,
"alpha_frac": 0.594,
"autogenerated": false,
"ratio": 4.44264943457189,
"config_test": false,
"has_no_keyw... |
"""Basic network definition.
"""
# standard imports
from typing import Tuple, Any, Union, List, Iterator, Iterable, Container
from collections import OrderedDict
import functools
import operator
import logging
import importlib
# third party imports
import numpy as np
# toolbox imports
from ..base import Extendable
f... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/network/network.py",
"copies": "1",
"size": "48270",
"license": "mit",
"hash": 2353652341738964500,
"line_mean": 34.9411764706,
"line_max": 96,
"alpha_frac": 0.5810768816,
"autogenerated": false,
"ratio": 4.400893508388038,
"config_test": false,
... |
"""Basic Network packet types.
Defines and Implements Basic Network packet types , such as Ethertnet and LLDP.
"""
# System imports
from copy import deepcopy
from enum import IntEnum
# Local source tree imports
from pyof.foundation.base import GenericStruct
from pyof.foundation.basic_types import (
BinaryData, F... | {
"repo_name": "kytos/python-openflow",
"path": "pyof/foundation/network_types.py",
"copies": "1",
"size": "27921",
"license": "mit",
"hash": 4098704256833754000,
"line_mean": 34.2537878788,
"line_max": 94,
"alpha_frac": 0.6019125389,
"autogenerated": false,
"ratio": 3.9847295561581277,
"config_... |
"""Basic Network packet types.
Defines and Implements Basic Network packet types , such as Ethertnet and LLDP.
"""
# System imports
from enum import IntEnum
# Local source tree imports
from pyof.foundation.base import GenericStruct
from pyof.foundation.basic_types import (
BinaryData, HWAddress, IPAddress, UBInt... | {
"repo_name": "cemsbr/python-openflow",
"path": "pyof/foundation/network_types.py",
"copies": "1",
"size": "23305",
"license": "mit",
"hash": -15733829675993764,
"line_mean": 34.2571860817,
"line_max": 94,
"alpha_frac": 0.6020596439,
"autogenerated": false,
"ratio": 3.9735720375106562,
"config_... |
""" Basic neural network training class."""
import os, sys
import time
import numpy as np
import tensorflow as tf
from learning.loss import reg_l2
class BaseLearner:
def __init__(self, params, model, model_iw=None, model_name_postfix=''):
"""Initialize the BaseLeaner class.
params: required pa... | {
"repo_name": "googleinterns/intern2020_cocal",
"path": "uncertainty/learning/base.py",
"copies": "1",
"size": "9148",
"license": "apache-2.0",
"hash": -468885581094723600,
"line_mean": 36.4918032787,
"line_max": 146,
"alpha_frac": 0.5431788369,
"autogenerated": false,
"ratio": 3.7522559474979493... |
# basic number game
import random
# rules
# you must enter the integer
# for win this game, you must hit the secret number within 3 chances
print("Basic rules:")
print("You only have 3 chances to guess the number")
print("You can type the integer between 1-10 only")
print("You can choose play again when you lose")
pri... | {
"repo_name": "hrahadiant/mini_py_project",
"path": "basic_number_game_v0.py",
"copies": "1",
"size": "1543",
"license": "apache-2.0",
"hash": -2485010881475866600,
"line_mean": 23.8870967742,
"line_max": 91,
"alpha_frac": 0.6163318211,
"autogenerated": false,
"ratio": 3.7634146341463413,
"conf... |
# Basic OBJ file viewer. needs objloader from:
# http://www.pygame.org/wiki/OBJFileLoader
# LMB + move: rotate
# RMB + move: pan
# Scroll wheel: zoom in/out
import sys, pygame
from pygame.locals import *
from pygame.constants import *
from OpenGL.GL import *
from OpenGL.GLU import *
# IMPORT OBJECT LOADER
from objloa... | {
"repo_name": "alexus37/AugmentedRealityChess",
"path": "pythonAnimations/pyOpenGLChess/objViewer.py",
"copies": "2",
"size": "2126",
"license": "mit",
"hash": 1207131412160423400,
"line_mean": 25.9240506329,
"line_max": 77,
"alpha_frac": 0.6015992474,
"autogenerated": false,
"ratio": 2.888586956... |
"""Basic Octet Encoding Rules (OER) codec.
"""
import binascii
from copy import copy
import struct
from operator import attrgetter
import datetime
from ..parser import EXTENSION_MARKER
from . import BaseType
from . import EncodeError
from . import DecodeError
from . import OutOfDataError
from . import format_or
from... | {
"repo_name": "eerimoq/asn1tools",
"path": "asn1tools/codecs/oer.py",
"copies": "1",
"size": "47742",
"license": "mit",
"hash": 2835732248593728500,
"line_mean": 30.617218543,
"line_max": 84,
"alpha_frac": 0.5236688869,
"autogenerated": false,
"ratio": 4.3115686805743705,
"config_test": false,
... |
"""Basic Octet Encoding Rules (OER) C source code codec generator.
"""
from operator import itemgetter
import bitstruct
import textwrap
from .utils import ENCODER_AND_DECODER_STRUCTS
from .utils import Generator
from .utils import camel_to_snake_case
from .utils import is_user_type
from .utils import indent_lines
fr... | {
"repo_name": "eerimoq/asn1tools",
"path": "asn1tools/source/c/oer.py",
"copies": "1",
"size": "42685",
"license": "mit",
"hash": -681431592173646600,
"line_mean": 38.3047882136,
"line_max": 90,
"alpha_frac": 0.4742649643,
"autogenerated": false,
"ratio": 4.242620017890865,
"config_test": false... |
# basic of simple calculator app
# you only calculate between two numbers
# the operation list are : +, -, *, /, and %
# the ">" for adding a new number
# set the global variable for store the current total
subtotal = 0
total = 0
# error handling for input
def error_handling(int_type, float_type1, float_type2):
#... | {
"repo_name": "hrahadiant/mini_py_project",
"path": "basic_calculator.py",
"copies": "1",
"size": "2947",
"license": "apache-2.0",
"hash": 8221385496724169000,
"line_mean": 24.6260869565,
"line_max": 100,
"alpha_frac": 0.6586359009,
"autogenerated": false,
"ratio": 3.7493638676844783,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.