text stringlengths 0 1.05M | meta dict |
|---|---|
"""An enumerated type :class:`Direction` whose elements are the four cardinal directions:
``NORTH``, ``SOUTH``, ``EAST``, and ``WEST``.
A :class:`Direction` knows what :class:`Direction` is to the left, the right, or opposite itself
using the methods :func:`left`, :func:`right`, and :func:`opposite`.
Usage::
... | {
"repo_name": "sredmond/acmpy",
"path": "campy/util/direction.py",
"copies": "1",
"size": "1253",
"license": "mit",
"hash": 4175504047089450500,
"line_mean": 29.325,
"line_max": 96,
"alpha_frac": 0.584197925,
"autogenerated": false,
"ratio": 3.6744868035190614,
"config_test": false,
"has_no_k... |
"""An Env holds the environment context that a pod is running in."""
import time
from protorpc import messages
from grow.common import urls
class Name(object):
DEV = 'dev'
class EnvConfig(messages.Message):
host = messages.StringField(1)
scheme = messages.StringField(2)
port = messages.IntegerField... | {
"repo_name": "grow/pygrow",
"path": "grow/pods/env.py",
"copies": "2",
"size": "1705",
"license": "mit",
"hash": 5168747951569636000,
"line_mean": 21.7333333333,
"line_max": 70,
"alpha_frac": 0.5964809384,
"autogenerated": false,
"ratio": 3.9559164733178656,
"config_test": true,
"has_no_keyw... |
""" A nested hash-map/dictionary object for Python """
import collections
try:
basestring
except NameError:
basestring = str
__author__ = "Nick Stanisha <github.com/nickstanisha>"
__version__ = "0.1"
__all__ = ['NestedDict', 'leaf_values', 'nested_keys', 'to_nested_dict']
def _dfs_generator(dictionary):
... | {
"repo_name": "nickstanisha/nesteddict",
"path": "nesteddict.py",
"copies": "1",
"size": "7539",
"license": "mit",
"hash": 7077487431594029000,
"line_mean": 33.2681818182,
"line_max": 135,
"alpha_frac": 0.531768139,
"autogenerated": false,
"ratio": 3.9846723044397465,
"config_test": false,
"h... |
"""An estimator that learns to ensemble.
Copyright 2018 The AdaNet Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Un... | {
"repo_name": "tensorflow/adanet",
"path": "adanet/autoensemble/estimator.py",
"copies": "1",
"size": "17628",
"license": "apache-2.0",
"hash": -3537677981760136700,
"line_mean": 41.5797101449,
"line_max": 95,
"alpha_frac": 0.6358066712,
"autogenerated": false,
"ratio": 4.173295454545454,
"conf... |
"""An Ethereum client simulator that provides instant results and quick
feedback during development involving smart contracts.
https://github.com/ConsenSys/eth-testrpc
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
from testrpc import __version__
here = path.abspath(path.... | {
"repo_name": "Firescar96/eth-testrpc",
"path": "setup.py",
"copies": "2",
"size": "1429",
"license": "mit",
"hash": -5830539315146508000,
"line_mean": 30.0652173913,
"line_max": 79,
"alpha_frac": 0.6417074878,
"autogenerated": false,
"ratio": 4.014044943820225,
"config_test": true,
"has_no_k... |
"""An Ethereum client simulator that provides instant results and quick
feedback during development involving smart contracts.
https://github.com/pipermerriam/eth-testrpc
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(... | {
"repo_name": "ConsenSys/eth-testrpc",
"path": "setup.py",
"copies": "3",
"size": "1640",
"license": "mit",
"hash": 6005074619318827000,
"line_mean": 29.9433962264,
"line_max": 79,
"alpha_frac": 0.6085365854,
"autogenerated": false,
"ratio": 3.5964912280701755,
"config_test": true,
"has_no_ke... |
"""A NetworkRegularizer that targets inference latency."""
from typing import List, Optional, Type
from morph_net.framework import batch_norm_source_op_handler
from morph_net.framework import conv2d_transpose_source_op_handler as conv2d_transpose_handler
from morph_net.framework import conv_source_op_handler as conv_... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/network_regularizers/latency_regularizer.py",
"copies": "1",
"size": "11194",
"license": "apache-2.0",
"hash": 7609016438589566000,
"line_mean": 41.241509434,
"line_max": 94,
"alpha_frac": 0.6931391817,
"autogenerated": false,
"ratio":... |
"""A NetworkRegularizer that targets the number of FLOPs."""
from __future__ import absolute_import
from __future__ import division
# [internal] enable type annotations
from __future__ import print_function
from typing import List, Optional, Type
from morph_net.framework import batch_norm_source_op_handler
from morph... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/network_regularizers/flop_regularizer.py",
"copies": "1",
"size": "7684",
"license": "apache-2.0",
"hash": -4737877778328226000,
"line_mean": 39.0208333333,
"line_max": 94,
"alpha_frac": 0.7048412285,
"autogenerated": false,
"ratio": 4... |
"""A NetworkRegularizer that targets the number of weights in the model."""
from __future__ import absolute_import
from __future__ import division
# [internal] enable type annotations
from __future__ import print_function
from typing import List, Optional, Text, Type
from morph_net.framework import batch_norm_source_... | {
"repo_name": "google-research/morph-net",
"path": "morph_net/network_regularizers/model_size_regularizer.py",
"copies": "1",
"size": "7932",
"license": "apache-2.0",
"hash": 4083665041272447000,
"line_mean": 40.3125,
"line_max": 94,
"alpha_frac": 0.7081442259,
"autogenerated": false,
"ratio": 4.... |
"""A network socket data source."""
import logging
import socket
from .base import DataSourceError
from .socket import SocketDataSource
LOG = logging.getLogger(__name__)
class NetworkDataSource(SocketDataSource):
"""A data source reading from a network socket, as implemented
in the openxc-vehicle-simulato... | {
"repo_name": "openxc/openxc-python",
"path": "openxc/sources/network.py",
"copies": "1",
"size": "1472",
"license": "bsd-3-clause",
"hash": -8358752840784691000,
"line_mean": 34.0476190476,
"line_max": 90,
"alpha_frac": 0.640625,
"autogenerated": false,
"ratio": 4.380952380952381,
"config_test... |
""" A neural chatbot using sequence to sequence model with
attentional decoder.
This is based on Google Translate Tensorflow model
https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/
"""
from __future__ import division
from __future__ import print_function
import argparse
import os
import ran... | {
"repo_name": "JackJiang1989/Wechat_Bot",
"path": "chatbot/chatbot.py",
"copies": "1",
"size": "11546",
"license": "mit",
"hash": 3097117237450880000,
"line_mean": 44.1015625,
"line_max": 116,
"alpha_frac": 0.5996015936,
"autogenerated": false,
"ratio": 3.89935832489024,
"config_test": true,
... |
""" A Neural Network Module
Written by: Hayg Astourian
Last Modified: 9/15/2013 """
import math
import numpy as np
def logistic(val):
""" The logistic function to be used as a limiter """
return 1 / (1 + math.exp(-val))
class Layer(object):
""" A class to represent layers in the neural network "... | {
"repo_name": "copacetic/nn",
"path": "nn.py",
"copies": "1",
"size": "2575",
"license": "mit",
"hash": 8807891319045363000,
"line_mean": 41.9166666667,
"line_max": 80,
"alpha_frac": 0.6240776699,
"autogenerated": false,
"ratio": 4.05511811023622,
"config_test": false,
"has_no_keywords": fals... |
""" A neural network trainer with various options: rmsprop, nerterov, momentum etc.
This trainer is used for multiple types of neural nets: dbns and cnns and it is designed
to be adaptable to other types of networks as well.
"""
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import numpy as np... | {
"repo_name": "mihaelacr/pydeeplearn",
"path": "code/lib/batchtrainer.py",
"copies": "1",
"size": "14670",
"license": "bsd-3-clause",
"hash": 8395465300915853000,
"line_mean": 37.6052631579,
"line_max": 131,
"alpha_frac": 0.6777096115,
"autogenerated": false,
"ratio": 4.17948717948718,
"config_... |
"""A neuron model based on a biologically inspired neuronal architecture."""
import logging
from math import pi, exp, log
import random
from collections import namedtuple, OrderedDict
from threading import Thread
import numpy as np
import cv2
from matplotlib.pyplot import figure, plot, axis, show, subplots_adjust, ti... | {
"repo_name": "napratin/nap",
"path": "nap/neuron.py",
"copies": "1",
"size": "33717",
"license": "mit",
"hash": -2421335344178411000,
"line_mean": 53.5582524272,
"line_max": 284,
"alpha_frac": 0.702553608,
"autogenerated": false,
"ratio": 3.510724698042482,
"config_test": false,
"has_no_keyw... |
""" An event dispatcher that goes right into the model storage. """
from status_app.models import EventBucket, RawEvent
from django.db.models import Count
from datetime import timedelta
def dispatch(source, event_type, timestamp, value, private_detail, host):
# XXX - assuming event_type is coming in as RawEvent.<... | {
"repo_name": "vegitron/status-app",
"path": "status_app/dispatcher/model.py",
"copies": "1",
"size": "3923",
"license": "apache-2.0",
"hash": 1121295613793619100,
"line_mean": 41.6413043478,
"line_max": 100,
"alpha_frac": 0.5602854958,
"autogenerated": false,
"ratio": 4.368596881959911,
"confi... |
"""An event handler, which stores events and passes Pygame events to them."""
import pygame as pg
from ..conf import conf
from . import inputs
from .evts import BaseEvent, Event
from . import conffile
class EventHandler (object):
"""Handles events.
EventHandler(scheduler)
:arg scheduler: :class:`sched.Schedul... | {
"repo_name": "ikn/pygame-template",
"path": "game/engine/evt/handler.py",
"copies": "1",
"size": "21298",
"license": "bsd-3-clause",
"hash": 7589461671924645000,
"line_mean": 35.9116117851,
"line_max": 136,
"alpha_frac": 0.5200018781,
"autogenerated": false,
"ratio": 4.434311888403081,
"config... |
"""An event loop.
This event loop should handle both asynchronous App Engine RPC objects
(specifically urlfetch, memcache and datastore RPC objects) and arbitrary
callback functions with an optional time delay.
Normally, event loops are singleton objects, though there is no
enforcement of this requirement.
The API h... | {
"repo_name": "adviti/melange",
"path": "thirdparty/google_appengine/google/appengine/ext/ndb/eventloop.py",
"copies": "1",
"size": "7479",
"license": "apache-2.0",
"hash": -6365087279443564000,
"line_mean": 27.5458015267,
"line_max": 80,
"alpha_frac": 0.6264206445,
"autogenerated": false,
"ratio... |
#An event passed between objects
#FIXME class method to register event type IDs
#FIXME self.TypeID per type
class TEvent(object):
self.TypeIDs = {"C6ACD4DAEE9A4030B58088D901CBB37F": TEventSynthetic,
"832E5EC291334D2193A9D51D90ADAFEA": TEVentCreateActor,
"": TEventActorCreated... | {
"repo_name": "Dymaxion00/octotrike",
"path": "TEvent.py",
"copies": "1",
"size": "4304",
"license": "mit",
"hash": 596323240850011300,
"line_mean": 41.6138613861,
"line_max": 82,
"alpha_frac": 0.6751858736,
"autogenerated": false,
"ratio": 3.3235521235521235,
"config_test": false,
"has_no_ke... |
"""A New API for simplifying logical operations and comparisons of arrays.
>>> from napi import *
>>> exec(nsource)
>>> neval
<function __main__.neval>
:func:`.neval` function that behaves similar to :func:`eval` handles
chained comparisons and logical operations of arrays delicately:
>>> a = arange(8)
>>> neval('2 ... | {
"repo_name": "abakan/napi",
"path": "napi/__init__.py",
"copies": "1",
"size": "1200",
"license": "mit",
"hash": -5530927830338021000,
"line_mean": 22.5294117647,
"line_max": 78,
"alpha_frac": 0.6275,
"autogenerated": false,
"ratio": 3.287671232876712,
"config_test": false,
"has_no_keywords"... |
import re
import logging
import sys
from procgame.game import Mode
from procgame.game.advancedmode import AdvancedMode
class RgbShowPlayer(AdvancedMode):
def __init__(self, game, priority=3):
super(RgbShowPlayer, self).__init__(game, priority, mode_type=AdvancedMode.System)
self.logger = logging.... | {
"repo_name": "mjocean/PyProcGameHD-SkeletonGame",
"path": "procgame/modes/rgbshow.py",
"copies": "1",
"size": "15845",
"license": "mit",
"hash": -1689324641747687400,
"line_mean": 36.9090909091,
"line_max": 134,
"alpha_frac": 0.505080467,
"autogenerated": false,
"ratio": 3.9972250252270434,
"c... |
'''An example application that uses ddp_asyncio's MeteorFilesUploader to upload a file to an instance of Meteor-Files' demo application (https://github.com/VeliovGroup/Meteor-Files-Demos)'''
import asyncio
import sys
import logging
logger = logging.getLogger('websockets')
logger.setLevel(logging.INFO)
logger.addHandl... | {
"repo_name": "hunternet93/ddp_asyncio",
"path": "example_upload_file.py",
"copies": "1",
"size": "1245",
"license": "mit",
"hash": -3758121675330581000,
"line_mean": 31.7631578947,
"line_max": 190,
"alpha_frac": 0.6546184739,
"autogenerated": false,
"ratio": 3.772727272727273,
"config_test": f... |
'''An example application that uses ddp_asyncio to retrieve all public to-do lists from Meteor's reference Todos application (https://github.com/meteor/todos)'''
import asyncio
import sys
from ddp_asyncio import DDPClient
class TodoRetriever:
def __init__(self, address):
self.client = DDPClient(address)
... | {
"repo_name": "hunternet93/ddp_asyncio",
"path": "example_retrieve_todos.py",
"copies": "1",
"size": "1144",
"license": "mit",
"hash": 7021850546298954000,
"line_mean": 31.6857142857,
"line_max": 161,
"alpha_frac": 0.5839160839,
"autogenerated": false,
"ratio": 3.7880794701986753,
"config_test"... |
'''An example application that uses ddp_asyncio to watch all public to-do lists from Meteor's reference Todos application (https://github.com/meteor/todos)'''
import asyncio
import sys
from ddp_asyncio import DDPClient
class TodoWatcher:
def __init__(self, address):
self.client = DDPClient(address)
... | {
"repo_name": "hunternet93/ddp_asyncio",
"path": "example_watch_todos.py",
"copies": "1",
"size": "3159",
"license": "mit",
"hash": -1807840557446850600,
"line_mean": 35.3103448276,
"line_max": 158,
"alpha_frac": 0.5163026274,
"autogenerated": false,
"ratio": 4.375346260387811,
"config_test": f... |
"""An example application using Confuse for configuration."""
from __future__ import division, absolute_import, print_function
import confuse
import argparse
template = {
'library': confuse.Filename(),
'import_write': confuse.OneOf([bool, 'ask', 'skip']),
'ignore': confuse.StrSeq(),
'plugins': list,
... | {
"repo_name": "sampsyo/confuse",
"path": "example/__init__.py",
"copies": "2",
"size": "1825",
"license": "mit",
"hash": 6392642925575807000,
"line_mean": 30.4655172414,
"line_max": 79,
"alpha_frac": 0.6076712329,
"autogenerated": false,
"ratio": 4.185779816513762,
"config_test": true,
"has_n... |
"""An example demomstrating a derived StatusMsg class.
Created by nomuus <"".join(["adus@um.ex", "te@rn.um"]).replace(".", "").replace("@", "") + "@" + "nomuus.com">
This will print specially formatted file path status messages
using an overridden StatusMsg.format() virtual method.
"""
__version__ = "1.0"
__copyrig... | {
"repo_name": "nomuus/statusmsg",
"path": "example_pathstatus.py",
"copies": "1",
"size": "4228",
"license": "bsd-3-clause",
"hash": 7617839338237230000,
"line_mean": 34.2416666667,
"line_max": 110,
"alpha_frac": 0.5910596026,
"autogenerated": false,
"ratio": 4.042065009560229,
"config_test": f... |
"""An example file showing how to make a geometry.
This particular example creates a 3x3 geometry, with 8 regular pins and one
Gd-157 2 wt-percent enriched. All pins are segmented.
"""
from collections import OrderedDict
import math
import numpy as np
import openmc
def density_to_mat(dens_dict):
"""Generates ... | {
"repo_name": "johnnyliu27/openmc",
"path": "tests/regression_tests/deplete/example_geometry.py",
"copies": "2",
"size": "12328",
"license": "mit",
"hash": -644931347556570400,
"line_mean": 31.6137566138,
"line_max": 93,
"alpha_frac": 0.5804672291,
"autogenerated": false,
"ratio": 3.0598163315959... |
"""An example flask application demonstrating server-sent events."""
from hashlib import sha1
from shutil import rmtree
from stat import S_ISREG, ST_CTIME, ST_MODE
import json
import os
import time
from PIL import Image, ImageFile
from gevent.event import AsyncResult
from gevent.queue import Empty, Queue
from gevent.... | {
"repo_name": "bboe/flask-image-uploader",
"path": "app.py",
"copies": "1",
"size": "8779",
"license": "bsd-2-clause",
"hash": 9099749923990132000,
"line_mean": 29.8035087719,
"line_max": 117,
"alpha_frac": 0.6122565212,
"autogenerated": false,
"ratio": 3.555690562980964,
"config_test": false,
... |
#An example for the Kaplan-Meier estimator
from __future__ import print_function
from statsmodels.compat.python import lrange
import statsmodels.api as sm
import matplotlib.pyplot as plt
import numpy as np
from statsmodels.sandbox.survival2 import KaplanMeier
#Getting the strike data as an array
dta = sm.datasets.stri... | {
"repo_name": "bsipocz/statsmodels",
"path": "statsmodels/sandbox/examples/ex_kaplan_meier.py",
"copies": "33",
"size": "2838",
"license": "bsd-3-clause",
"hash": 1557644463796147700,
"line_mean": 21.8870967742,
"line_max": 79,
"alpha_frac": 0.7043692741,
"autogenerated": false,
"ratio": 2.679886... |
# An example from scipy cookbook demonstrating the use of numpy arrays in vtk
import numpy as np
import vtk
def main():
colors = vtk.vtkNamedColors()
# We begin by creating the data we want to render.
# For this tutorial, we create a 3D-image containing three overlaping cubes.
# This data can of cou... | {
"repo_name": "lorensen/VTKExamples",
"path": "src/Python/Utilities/VTKWithNumpy.py",
"copies": "1",
"size": "4643",
"license": "apache-2.0",
"hash": 3401967594837281300,
"line_mean": 44.5196078431,
"line_max": 119,
"alpha_frac": 0.722808529,
"autogenerated": false,
"ratio": 3.843543046357616,
... |
# An example from scipy cookbook demonstrating the use of numpy arrys in vtk
import vtk
from numpy import *
filename = "stagbeetle832x832x494.dat"
nx = 832
ny = 832
nz = 494
data = fromfile(filename, dtype=uint16)
# We begin by creating the data we want to render.
# For this tutorial, we create a 3D-image contain... | {
"repo_name": "egaburov/volren",
"path": "render.py",
"copies": "1",
"size": "4943",
"license": "apache-2.0",
"hash": 4156212151614553000,
"line_mean": 44.7685185185,
"line_max": 141,
"alpha_frac": 0.7776653854,
"autogenerated": false,
"ratio": 3.471207865168539,
"config_test": false,
"has_no... |
""" An example highlighting the difference between DMD and streaming DMD
Streaming DMD is a modification of the "standard" DMD procedure that
produces *APPROXIMATIONS* of the DMD modes and eigenvalues. The benefit
of this procedure is that it can be applied to data sets with large
(in theory, infinite... | {
"repo_name": "cwrowley/dmdtools",
"path": "python/scripts/streaming_dmd_example.py",
"copies": "1",
"size": "3073",
"license": "bsd-3-clause",
"hash": -8083911567896038000,
"line_mean": 26.6846846847,
"line_max": 76,
"alpha_frac": 0.5942076147,
"autogenerated": false,
"ratio": 3.0246062992125986... |
""" An example highlighting the difference between TLS-DMD and DMD
TLS-DMD is a total least squares variant of DMD, which can produce
superior results when the data provided to the method are noisy.
This example is meant to highlight the difference between the two
methods on a simple problem where the ... | {
"repo_name": "cwrowley/dmdtools",
"path": "python/scripts/total_dmd_example.py",
"copies": "1",
"size": "2465",
"license": "bsd-3-clause",
"hash": -7980647217084054000,
"line_mean": 32.7671232877,
"line_max": 78,
"alpha_frac": 0.6292089249,
"autogenerated": false,
"ratio": 2.980652962515115,
"... |
"""An example how to use the Jsp Evaluator
"""
from jspeval import JspEvaluator
from jspmodel import JspModel
from jspsolution import JspSolution
def example_func():
"""Demonstrates the usage of JspEval, JspModel and JspSolution.
"""
# instanciate a model
model = JspModel("xml/example.xml")
# cre... | {
"repo_name": "mYstar/JSPEval",
"path": "example.py",
"copies": "1",
"size": "1477",
"license": "apache-2.0",
"hash": 900085857904064500,
"line_mean": 31.1086956522,
"line_max": 71,
"alpha_frac": 0.7000677048,
"autogenerated": false,
"ratio": 3.9177718832891246,
"config_test": false,
"has_no_... |
"""An example implementation of a Gaussian noise model."""
from functools import partial
import numpy as np
import scipy.stats as ss
import elfi
def Gauss(mu, sigma, n_obs=50, batch_size=1, random_state=None):
"""Sample the Gaussian distribution.
Parameters
----------
mu : float, array_like
si... | {
"repo_name": "lintusj1/elfi",
"path": "elfi/examples/gauss.py",
"copies": "1",
"size": "2003",
"license": "bsd-3-clause",
"hash": -5291244375266691000,
"line_mean": 26.0675675676,
"line_max": 93,
"alpha_frac": 0.627558662,
"autogenerated": false,
"ratio": 3.256910569105691,
"config_test": fals... |
"""An example implementation of the bivariate g-and-k model."""
from functools import partial
import numpy as np
import scipy.stats as ss
import elfi
EPS = np.finfo(float).eps
def GNK(a, b, g, k, c=0.8, n_obs=50, batch_size=1, random_state=None):
"""Sample the univariate g-and-k distribution.
References
... | {
"repo_name": "lintusj1/elfi",
"path": "elfi/examples/gnk.py",
"copies": "1",
"size": "6376",
"license": "bsd-3-clause",
"hash": -2257393796004886800,
"line_mean": 24.1023622047,
"line_max": 77,
"alpha_frac": 0.5908092848,
"autogenerated": false,
"ratio": 3.105698977106673,
"config_test": false... |
"""An example implementation of the univariate g-and-k model."""
from functools import partial
import numpy as np
import scipy.stats as ss
import elfi
from elfi.examples.gnk import euclidean_multidim, ss_octile, ss_order, ss_robust
EPS = np.finfo(float).eps
def BiGNK(a1, a2, b1, b2, g1, g2, k1, k2, rho, c=.8, n_o... | {
"repo_name": "lintusj1/elfi",
"path": "elfi/examples/bignk.py",
"copies": "1",
"size": "5779",
"license": "bsd-3-clause",
"hash": -7229852703802814000,
"line_mean": 34.0242424242,
"line_max": 80,
"alpha_frac": 0.5957778162,
"autogenerated": false,
"ratio": 3.072301967038809,
"config_test": fal... |
#An example input file for multimesa.py
#run command is python multimesa.py example3.py
#Location to write out folders too
output_folder="output/"
# if set to 1 we number the folders otherwise use the _name value
folder_num=1
#Defaults assume varaibles are linearly looped and that the name of varaible is the mesa ... | {
"repo_name": "rjfarmer/multimesa",
"path": "example3.py",
"copies": "1",
"size": "2602",
"license": "isc",
"hash": -4043533106600896500,
"line_mean": 26.1041666667,
"line_max": 93,
"alpha_frac": 0.7194465796,
"autogenerated": false,
"ratio": 2.7160751565762005,
"config_test": false,
"has_no_... |
'''An example module demonstrating the implementation of a processor'''
import ctypes
import math
class DummyProcessor:
'''An example processor that simply changes the viewport color'''
def __init__(self):
'''Construct a DummyProcessor with a buffer for drawing into'''
self.value = 0
... | {
"repo_name": "Kupoman/BlenderRealtimeEngineAddon",
"path": "brte/processors/dummy.py",
"copies": "1",
"size": "1033",
"license": "mit",
"hash": 3682803634215855600,
"line_mean": 27.6944444444,
"line_max": 81,
"alpha_frac": 0.6214908035,
"autogenerated": false,
"ratio": 4.233606557377049,
"conf... |
"""An example module to show autodoc style.
Contains an example constant, :class:`Storage` class for storing objects and
helper function :func:`store_integers` for storing only integers.
"""
import datetime
#: Example integer constant.
INT_CONSTANT = 1
#: Example integer constant.
STR_CONSTANT = 'string'
class ... | {
"repo_name": "espdev/sphinx-fancy-theme",
"path": "docs/source/example.py",
"copies": "1",
"size": "2446",
"license": "mit",
"hash": -834757733094383200,
"line_mean": 26.4831460674,
"line_max": 79,
"alpha_frac": 0.5993458708,
"autogenerated": false,
"ratio": 3.9136,
"config_test": false,
"ha... |
#An example of a class
#$ header class Shape(public)
#$ header method __init__(Shape, double, double)
#$ header method area(Shape) results(double)
#$ header method perimeter(Shape) results(double)
#$ header method describe(Shape,str)
#$ header method authorName(Shape,str)
#$ header method scaleSize(Shape, double)
clas... | {
"repo_name": "ratnania/pyccel",
"path": "tests/codegen/scripts/classes_4.py",
"copies": "2",
"size": "1292",
"license": "mit",
"hash": -6345758568791810000,
"line_mean": 24.84,
"line_max": 77,
"alpha_frac": 0.6602167183,
"autogenerated": false,
"ratio": 3.530054644808743,
"config_test": false,... |
"""An example of Appium running on Sauce using Sauce Connect to access a local webserver.
This test assumes SAUCE_USERNAME and SAUCE_ACCESS_KEY are environment variables
set to your Sauce Labs username and access key.
You'll also need Sauce-Connect.jar in this test directory so we can start it to enable
a tunnel betw... | {
"repo_name": "eric-stanley/sample-code",
"path": "sample-code/examples/python/sauce_connect.py",
"copies": "1",
"size": "4833",
"license": "apache-2.0",
"hash": -772900010694041000,
"line_mean": 35.3383458647,
"line_max": 175,
"alpha_frac": 0.6263190565,
"autogenerated": false,
"ratio": 3.987623... |
"""An example of Appium running on Sauce, with a webview.
This test assumes SAUCE_USERNAME and SAUCE_ACCESS_KEY are environment variables
set to your Sauce Labs username and access key."""
from random import randint
from appium import webdriver
from appium import SauceTestCase, on_platforms
from time import sleep
fr... | {
"repo_name": "Dyazvinsky/sample-code",
"path": "sample-code/examples/python/ios_sauce_webview.py",
"copies": "33",
"size": "1251",
"license": "apache-2.0",
"hash": -6241592564409913000,
"line_mean": 28.7857142857,
"line_max": 102,
"alpha_frac": 0.6690647482,
"autogenerated": false,
"ratio": 3.30... |
"""An example of a proposed NLP pipeline system. Goals are to allow for:
1. default NLP pipeline for any given language
2. users to override default pipeline
3. users to choose alternative code (classes/methods/functions) w/in the CLTK
4. users to use their own custom code (inheriting or replacing those... | {
"repo_name": "diyclassics/cltk",
"path": "scripts/pipeline_example.py",
"copies": "4",
"size": "5512",
"license": "mit",
"hash": -5976075389355729000,
"line_mean": 35.7583892617,
"line_max": 196,
"alpha_frac": 0.6027022092,
"autogenerated": false,
"ratio": 3.9346264367816093,
"config_test": fa... |
"""An example of a very simple space, the real numbers."""
import odl
class Reals(odl.set.LinearSpace):
"""The real numbers."""
def __init__(self):
super(Reals, self).__init__(field=odl.RealNumbers())
def _inner(self, x1, x2):
return x1.__val__ * x2.__val__
def _lincomb(self, a, x1... | {
"repo_name": "odlgroup/odl",
"path": "examples/space/simple_r.py",
"copies": "2",
"size": "1083",
"license": "mpl-2.0",
"hash": -6421456323615906000,
"line_mean": 19.4339622642,
"line_max": 60,
"alpha_frac": 0.541089566,
"autogenerated": false,
"ratio": 3.0083333333333333,
"config_test": false... |
"""An example of a very simple space, the space rn.
Including some benchmarks with an optimized version.
"""
import numpy as np
import odl
from odl.space.base_tensors import TensorSpace, Tensor
from odl.util.testutils import timer
class SimpleRn(TensorSpace):
"""The real space R^n, non-optimized implmentation."... | {
"repo_name": "kohr-h/odl",
"path": "examples/space/simple_rn.py",
"copies": "2",
"size": "4104",
"license": "mpl-2.0",
"hash": 1320289686038083300,
"line_mean": 28.5251798561,
"line_max": 78,
"alpha_frac": 0.5840643275,
"autogenerated": false,
"ratio": 3.152073732718894,
"config_test": false,
... |
# An example of embedding CEF browser in wxPython on Linux.
# Important:
# On Linux importing the cefpython module must be
# the very first in your application. This is because CEF makes
# a global tcmalloc hook for memory allocation/deallocation.
# See Issue 73 that is to provide CEF builds with tcmalloc ... | {
"repo_name": "RazorFlow/metarefresh_braces",
"path": "braces-cefpython/myapp.py",
"copies": "1",
"size": "21093",
"license": "mit",
"hash": 4363906180957723600,
"line_mean": 38.0611111111,
"line_max": 84,
"alpha_frac": 0.5969752999,
"autogenerated": false,
"ratio": 4.148898505114083,
"config_t... |
# An example of embedding CEF Python in PySide application.
import os, sys
import argparse
libcef_dll = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'libcef.dll')
if os.path.exists(libcef_dll):
# Import a local module
if (2,7) <= sys.version_info < (2,8):
import cefpython_p... | {
"repo_name": "Hiestaa/py-vid-tagger",
"path": "main.py",
"copies": "1",
"size": "9443",
"license": "mit",
"hash": -4350070762163971600,
"line_mean": 35.6215139442,
"line_max": 89,
"alpha_frac": 0.6118818172,
"autogenerated": false,
"ratio": 3.981028667790894,
"config_test": false,
"has_no_ke... |
# An example of flipping feature polygons right side up.
import datetime
import logging
import sys
import fiona
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
def signed_area(coords):
"""Return the signed area enclosed by a ring using the linear time
algorithm at http://www.cgafaq.info/wiki/Pol... | {
"repo_name": "perrygeo/Fiona",
"path": "examples/orient-ccw.py",
"copies": "7",
"size": "2082",
"license": "bsd-3-clause",
"hash": 3467933461332513300,
"line_mean": 31.0307692308,
"line_max": 74,
"alpha_frac": 0.5398655139,
"autogenerated": false,
"ratio": 4.042718446601942,
"config_test": fal... |
"""An example of how to generate a 2D structured points dataset
using numpy arrays. Also shown is a way to visualize this data with
the mayavi2 application.
The script can be run like so::
$ mayavi2 -x structured_points2d.py
Alternatively, it can be run as::
$ python structured_points2d.py
"""
# Author: Prabh... | {
"repo_name": "liulion/mayavi",
"path": "docs/source/mayavi/auto/structured_points2d.py",
"copies": "10",
"size": "1902",
"license": "bsd-3-clause",
"hash": 8284907790192792000,
"line_mean": 30.7,
"line_max": 70,
"alpha_frac": 0.6929547844,
"autogenerated": false,
"ratio": 3.1180327868852458,
"... |
"""An example of how to generate a 3D structured points dataset
using numpy arrays. Also shown is a way to visualize this data with
the mayavi2 application.
The script can be run like so::
$ mayavi2 -x structured_points3d.py
Alternatively, it can be run as::
$ python structured_points3d.py
"""
# Author: Prabh... | {
"repo_name": "liulion/mayavi",
"path": "docs/source/mayavi/auto/structured_points3d.py",
"copies": "2",
"size": "2210",
"license": "bsd-3-clause",
"hash": 2801453399149719600,
"line_mean": 31.0289855072,
"line_max": 70,
"alpha_frac": 0.6954751131,
"autogenerated": false,
"ratio": 3.0822873082287... |
# An example of how to generate a feed by hand.
import datetime
import PyRSS2Gen
rss = PyRSS2Gen.RSS2(
title = "Andrew's PyRSS2Gen feed",
link = "http://www.dalkescientific.com/Python/PyRSS2Gen.html",
description = "The latest news about PyRSS2Gen, a "
"Python library for generating RSS2... | {
"repo_name": "antonsotin/vkfeedtrue",
"path": "PyRSS2Gen/example.py",
"copies": "18",
"size": "1526",
"license": "bsd-2-clause",
"hash": -1672468069548763600,
"line_mean": 42.6,
"line_max": 76,
"alpha_frac": 0.6002621232,
"autogenerated": false,
"ratio": 3.436936936936937,
"config_test": false... |
"""An example of how to generate a structured grid dataset using
numpy arrays. Also shown is a way to visualize this data with
the mayavi2 application.
The script can be run like so::
$ mayavi2 -x structured_grid.py
Alternatively, it can be run as::
$ python structured_grid.py
"""
# Authors: Eric Jones <eri... | {
"repo_name": "alexandreleroux/mayavi",
"path": "examples/mayavi/advanced_visualization/structured_grid.py",
"copies": "10",
"size": "4027",
"license": "bsd-3-clause",
"hash": 8676657216079601000,
"line_mean": 32.0081967213,
"line_max": 71,
"alpha_frac": 0.6342190216,
"autogenerated": false,
"rat... |
# An example of how to publish a simple wsgi app under isapi_wsgi and serve
# from IIS root.
# Using the ISAPISimpleHandler which will create a new instance for each incoming
# request.
#
# Executing this script (or any server config script) will install the extension
# into your web server and will create a "loa... | {
"repo_name": "Coder-666/isapi-wsgi",
"path": "examples/demo_serve_from_root.py",
"copies": "5",
"size": "2117",
"license": "mit",
"hash": -7027218211287635000,
"line_mean": 38.7115384615,
"line_max": 86,
"alpha_frac": 0.6424185168,
"autogenerated": false,
"ratio": 3.9422718808193666,
"config_t... |
# An example of how to publish a simple wsgi app under isapi_wsgi using
# the ISAPISimpleHandler which will create a new instance for each incoming
# request.
#
# Executing this script (or any server config script) will install the extension
# into your web server and will create a "loader" DLL _demo.dll in the
... | {
"repo_name": "jbmohler/isapi-wsgi",
"path": "examples/demo.py",
"copies": "5",
"size": "2069",
"license": "mit",
"hash": -6094352626424980000,
"line_mean": 39.38,
"line_max": 81,
"alpha_frac": 0.6462058966,
"autogenerated": false,
"ratio": 3.925996204933586,
"config_test": false,
"has_no_key... |
# An example of how to publish a simple wsgi app under isapi_wsgi using
# the ISAPIThreadPoolHandler.
#
# Executing this script (or any server config script) will install the extension
# into your web server and will create a "loader" DLL _demo_use_threadpool.dll in the
# current directory. As the server executes... | {
"repo_name": "ig0774/isapi_wsgi",
"path": "examples/demo_use_threadpool.py",
"copies": "5",
"size": "2158",
"license": "mit",
"hash": 3027736841573711000,
"line_mean": 39.5,
"line_max": 92,
"alpha_frac": 0.6515291937,
"autogenerated": false,
"ratio": 3.9094202898550723,
"config_test": false,
... |
""" An example of how to use Chaco to render a visual Traits UI editor.
This particular editor allows the user to set two endpoints of an
interval.
"""
from __future__ import with_statement
from traits.etsconfig.api import ETSConfig
if ETSConfig.toolkit == 'wx':
from traitsui.wx.editor import Editor
else:
from... | {
"repo_name": "burnpanck/chaco",
"path": "examples/demo/chaco_trait_editor.py",
"copies": "2",
"size": "5689",
"license": "bsd-3-clause",
"hash": -8374991004959807000,
"line_mean": 30.6055555556,
"line_max": 76,
"alpha_frac": 0.5972930216,
"autogenerated": false,
"ratio": 3.9370242214532873,
"c... |
""" An example of how to use Chaco to render a visual Traits UI editor.
This particular editor allows the user to set two endpoints of an
interval.
"""
# FIXME: WX-only, and broken even there.
from __future__ import with_statement
# Force WX
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'wx'
from t... | {
"repo_name": "ContinuumIO/chaco",
"path": "examples/demo/chaco_trait_editor.py",
"copies": "1",
"size": "5558",
"license": "bsd-3-clause",
"hash": 7176221466003894000,
"line_mean": 30.0502793296,
"line_max": 76,
"alpha_frac": 0.5975170925,
"autogenerated": false,
"ratio": 3.9168428470754053,
"... |
"""An example of how to use IPython1 for plotting remote parallel data
The two files plotting_frontend.ipy and plotting_backend.py go together.
This file (plotting_backend.py) performs the actual computation. For this
example, the computation just generates a set of random numbers that
look like a distribution of p... | {
"repo_name": "FrankBian/kuma",
"path": "vendor/packages/ipython/docs/examples/kernel/plotting_backend.py",
"copies": "7",
"size": "1755",
"license": "mpl-2.0",
"hash": -1478196287361361000,
"line_mean": 29.8070175439,
"line_max": 76,
"alpha_frac": 0.7373219373,
"autogenerated": false,
"ratio": 3... |
"""An example of how to use IPython1 for plotting remote parallel data
The two files plotting_frontend.ipy and plotting_backend.py go together.
To run this example, first start the IPython controller and 4
engines::
ipcluster -n 4
Then start ipython in pylab mode::
ipython -pylab
Then a simple "run pl... | {
"repo_name": "yongshengwang/hue",
"path": "build/env/lib/python2.7/site-packages/ipython-0.10-py2.7.egg/share/doc/ipython/examples/kernel/plotting_frontend.py",
"copies": "7",
"size": "1263",
"license": "apache-2.0",
"hash": -1897673326489506300,
"line_mean": 23.3076923077,
"line_max": 76,
"alpha_fr... |
"""An example of how to use IPython for plotting remote parallel data
The two files plotting_frontend.py and plotting_backend.py go together.
This file (plotting_backend.py) performs the actual computation. For this
example, the computation just generates a set of random numbers that
look like a distribution of part... | {
"repo_name": "sodafree/backend",
"path": "build/ipython/docs/examples/parallel/plotting/plotting_backend.py",
"copies": "2",
"size": "1801",
"license": "bsd-3-clause",
"hash": -4032771477058994700,
"line_mean": 30.0517241379,
"line_max": 79,
"alpha_frac": 0.7373681288,
"autogenerated": false,
"r... |
__author__ = "richard 'ragmondo' green"
import sys
# Change this to point to where you have a copy of the bitcoinj.jar
sys.path.append(r"/path/to/bitcoinj-0.12-SNAPSHOT-bundled.jar")
# This is the address to forward all payments to. Change this (unless you want to send me some testnet coins)
my_address_text = "mzEj... | {
"repo_name": "MintcoinCommunity/mintcoinj",
"path": "examples/src/main/python/forwarding.py",
"copies": "9",
"size": "3230",
"license": "apache-2.0",
"hash": 8755904454196364000,
"line_mean": 33.7419354839,
"line_max": 139,
"alpha_frac": 0.6671826625,
"autogenerated": false,
"ratio": 3.488120950... |
__author__ = "richard 'ragmondo' green"
import sys
# Change this to point to where you have a copy of the bitcoinj.jar
sys.path.append(r"/path/to/bitcoinj-core-0.12-bundled.jar")
# This is the address to forward all payments to. Change this (unless you want to send me some testnet coins)
my_address_text = "mzEjmna1... | {
"repo_name": "TheBlueMatt/bitcoinj",
"path": "examples/src/main/python/forwarding.py",
"copies": "39",
"size": "3090",
"license": "apache-2.0",
"hash": -4638894622181718000,
"line_mean": 33.3333333333,
"line_max": 139,
"alpha_frac": 0.671197411,
"autogenerated": false,
"ratio": 3.460246360582307... |
__author__ = "richard 'ragmondo' green"
import sys
# Change this to point to where you have a copy of the nubitsj.jar
sys.path.append(r"/path/to/nubitsj-0.12-bundled.jar")
# This is the address to forward all payments to. Change this (unless you want to send me some testnet coins)
my_address_text = "mzEjmna15T7DXj4... | {
"repo_name": "Cybnate/NuBitsj",
"path": "examples/src/main/python/forwarding.py",
"copies": "1",
"size": "3141",
"license": "apache-2.0",
"hash": 976026814925577600,
"line_mean": 33.9111111111,
"line_max": 134,
"alpha_frac": 0.6758993951,
"autogenerated": false,
"ratio": 3.3883495145631066,
"c... |
__author__ = "richard 'ragmondo' green"
import sys
# Change this to point to where you have a copy of the peercoinj.jar
sys.path.append(r"/path/to/peercoinj-0.12-SNAPSHOT-bundled.jar")
# This is the address to forward all payments to. Change this (unless you want to send me some testnet coins)
my_address_text = "mz... | {
"repo_name": "kris-davison/capricoinj",
"path": "examples/src/main/python/forwarding.py",
"copies": "4",
"size": "3301",
"license": "apache-2.0",
"hash": -8037531077932004000,
"line_mean": 34.5053763441,
"line_max": 139,
"alpha_frac": 0.6731293547,
"autogenerated": false,
"ratio": 3.449320794148... |
__author__ = "richard 'ragmondo' green"
import sys
# Change this to point to where you have a copy of the spreadcoinj.jar
sys.path.append(r"/path/to/spreadcoinj-0.12-SNAPSHOT-bundled.jar")
# This is the address to forward all payments to. Change this (unless you want to send me some testnet coins)
my_address_text =... | {
"repo_name": "bitbandi/spreadcoinj",
"path": "examples/src/main/python/forwarding.py",
"copies": "1",
"size": "3247",
"license": "apache-2.0",
"hash": 2440612911168078000,
"line_mean": 33.9247311828,
"line_max": 139,
"alpha_frac": 0.6689251617,
"autogenerated": false,
"ratio": 3.4839055793991416... |
""" An example of how to use the entity system. """
# Matthew Westbrook
#
# An example that demonstrates how to use the entity system.
#
# * The first task is to define your entity systems and components.
# * Then initialize the world and add the entity systems to the world.
# * Construct entities and add their c... | {
"repo_name": "horrorvacui/ent-system",
"path": "examples/example.py",
"copies": "1",
"size": "2683",
"license": "mit",
"hash": 7644690501424263000,
"line_mean": 27.8494623656,
"line_max": 77,
"alpha_frac": 0.6515095043,
"autogenerated": false,
"ratio": 4.251980982567353,
"config_test": false,
... |
# An example of how you can do a wallet in Viper.
# Warning: NOT AUDITED. Do not use to store substantial quantities of funds.
# A list of the owners addresses (there are a maximum of 5 owners)
owners: address[5]
# The number of owners required to approve a transaction
threshold: num
# The number of transactions that ... | {
"repo_name": "NedYork/viper",
"path": "examples/wallet/wallet.v.py",
"copies": "1",
"size": "2617",
"license": "mit",
"hash": 2932888019952374300,
"line_mean": 51.34,
"line_max": 169,
"alpha_frac": 0.6962170424,
"autogenerated": false,
"ratio": 3.837243401759531,
"config_test": false,
"has_n... |
"""An example of implementing a centralized critic with ObservationFunction.
The advantage of this approach is that it's very simple and you don't have to
change the algorithm at all -- just use callbacks and a custom model.
However, it is a bit less principled in that you have to change the agent
observation spaces t... | {
"repo_name": "ray-project/ray",
"path": "rllib/examples/centralized_critic_2.py",
"copies": "1",
"size": "4674",
"license": "apache-2.0",
"hash": 1351273073586770700,
"line_mean": 32.8695652174,
"line_max": 78,
"alpha_frac": 0.6315789474,
"autogenerated": false,
"ratio": 3.7243027888446214,
"c... |
"""An example of multi-worker training with Keras model using Strategy API."""
from __future__ import absolute_import, division, print_function
import argparse
import json
import os
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow.keras import layers, models
from tensorflow.keras import opt... | {
"repo_name": "polyaxon/polyaxon",
"path": "examples/in_cluster/kubeflow/tfjob/run.py",
"copies": "1",
"size": "5644",
"license": "apache-2.0",
"hash": -5029606623364384000,
"line_mean": 28.0927835052,
"line_max": 105,
"alpha_frac": 0.6286321758,
"autogenerated": false,
"ratio": 3.722955145118733... |
"An example of predicting a music genre from a custom audio file"
import librosa
import logging
import sys
import numpy as np
from keras.models import model_from_json
from GenreFeatureData import (
GenreFeatureData,
) # local python class with Audio feature extraction and genre list
# set logging level
logging.g... | {
"repo_name": "ruohoruotsi/LSTM-Music-Genre-Classification",
"path": "predict_example.py",
"copies": "1",
"size": "2122",
"license": "mit",
"hash": 8330477576746012000,
"line_mean": 36.8928571429,
"line_max": 85,
"alpha_frac": 0.7026390198,
"autogenerated": false,
"ratio": 3.300155520995334,
"c... |
"""An example of the ListModel."""
from pythonicqt.Qt import QtCore, QtGui
from pythonicqt import ListModel
from pythonicqt.examples import ExampleBase
class ExampleListModel(ExampleBase):
"""This Widget demonstrates the ListModel functionality.
You can interactwith a model that behaves like a
Python list ... | {
"repo_name": "Digirolamo/pythonicqt",
"path": "pythonicqt/examples/listmodel_example.py",
"copies": "1",
"size": "1396",
"license": "mit",
"hash": -2980144958761504300,
"line_mean": 36.7567567568,
"line_max": 80,
"alpha_frac": 0.6618911175,
"autogenerated": false,
"ratio": 3.742627345844504,
"... |
## An example of the simple Schnorr sigma protocol
## to prove that one knows x, such that h = g^x for
## a public generator h and g.
from petlib.bn import Bn
from petlib.ec import EcGroup, EcPt
from hashlib import sha256
def challenge(elements):
"""Packages a challenge in a bijective way"""
elem = [len(ele... | {
"repo_name": "gdanezis/petlib",
"path": "examples/zkp.py",
"copies": "1",
"size": "1694",
"license": "bsd-2-clause",
"hash": -1140757912120717600,
"line_mean": 24.6666666667,
"line_max": 63,
"alpha_frac": 0.554309327,
"autogenerated": false,
"ratio": 2.786184210526316,
"config_test": false,
... |
"""An example of training A3C against OpenAI Gym Envs.
This script is an example of training a A3C agent against OpenAI Gym envs.
Both discrete and continuous action spaces are supported.
To solve CartPole-v0, run:
python train_a3c_gym.py 8 --env CartPole-v0
To solve InvertedPendulum-v1, run:
python train_a3... | {
"repo_name": "toslunar/chainerrl",
"path": "examples/gym/train_a3c_gym.py",
"copies": "1",
"size": "8242",
"license": "mit",
"hash": -7026018327212045000,
"line_mean": 38.2476190476,
"line_max": 94,
"alpha_frac": 0.6493569522,
"autogenerated": false,
"ratio": 3.4100124120810924,
"config_test":... |
"""An example of training A3C against OpenAI Gym Envs.
This script is an example of training a PCL agent against OpenAI Gym envs.
Both discrete and continuous action spaces are supported.
To solve CartPole-v0, run:
python train_a3c_gym.py 8 --env CartPole-v0
To solve InvertedPendulum-v1, run:
python train_a3... | {
"repo_name": "hmightypirate/guided-backprop-chainerrl",
"path": "examples/mygym/train_a3c_gym.py",
"copies": "1",
"size": "6636",
"license": "apache-2.0",
"hash": -8408779957788209000,
"line_mean": 34.6774193548,
"line_max": 94,
"alpha_frac": 0.6511452682,
"autogenerated": false,
"ratio": 3.4383... |
"""An example of training Categorical DQN against OpenAI Gym Envs.
This script is an example of training an IQN agent against OpenAI
Gym envs. Only discrete spaces are supported.
To solve CartPole-v0, run:
python train_categorical_dqn_gym.py --env CartPole-v0
"""
from __future__ import print_function
from __futur... | {
"repo_name": "toslunar/chainerrl",
"path": "examples/gym/train_iqn_gym.py",
"copies": "1",
"size": "5827",
"license": "mit",
"hash": -5829898203047046000,
"line_mean": 35.8797468354,
"line_max": 75,
"alpha_frac": 0.6414964819,
"autogenerated": false,
"ratio": 3.5902649414664203,
"config_test":... |
"""An example of training DQN against OpenAI Gym Envs.
This script is an example of training a DQN agent against OpenAI Gym envs.
Both discrete and continuous action spaces are supported. For continuous action
spaces, A NAF (Normalized Advantage Function) is used to approximate Q-values.
To solve CartPole-v0, run:
... | {
"repo_name": "toslunar/chainerrl",
"path": "examples/gym/train_dqn_gym.py",
"copies": "1",
"size": "7961",
"license": "mit",
"hash": 1923436568514541600,
"line_mean": 39.8256410256,
"line_max": 79,
"alpha_frac": 0.6524305992,
"autogenerated": false,
"ratio": 3.5779775280898876,
"config_test": ... |
"""An example of training PPO against OpenAI Gym Envs.
This script is an example of training a PPO agent against OpenAI Gym envs.
Both discrete and continuous action spaces are supported.
To solve CartPole-v0, run:
python train_ppo_gym.py --env CartPole-v0
"""
from __future__ import division
from __future__ impor... | {
"repo_name": "toslunar/chainerrl",
"path": "examples/mujoco/train_ppo_batch_gym.py",
"copies": "1",
"size": "8073",
"license": "mit",
"hash": 7375016043823864000,
"line_mean": 37.0801886792,
"line_max": 91,
"alpha_frac": 0.6288864115,
"autogenerated": false,
"ratio": 3.684618895481515,
"config... |
'''An example of using :class:`AreaDetector`'''
import time
import config
from ophyd import SimDetector
from ophyd import (ImagePlugin, TIFFPlugin, ProcessPlugin, OverlayPlugin,
Component as Cpt)
logger = config.logger
class MyDetector(SimDetector):
image1 = Cpt(ImagePlugin, 'image1:')
... | {
"repo_name": "dchabot/ophyd",
"path": "examples/areadetector.py",
"copies": "3",
"size": "1836",
"license": "bsd-3-clause",
"hash": 7953465430392761000,
"line_mean": 27.6875,
"line_max": 73,
"alpha_frac": 0.6797385621,
"autogenerated": false,
"ratio": 2.6608695652173915,
"config_test": false,
... |
"""An example of using sum-product loopy belief propagation to reason about
faces and their parts in an image."""
import sys
sys.path.append("..")
import numpy as np
import pylab
from graph import BpGraph
from nodesLib import VarNodes
from nodesLib import NoisyOrNodes
from nodesLib import CatNodes
import matplotlib.... | {
"repo_name": "jeroen-chua/factorflow",
"path": "examples/example_face.py",
"copies": "1",
"size": "6929",
"license": "mit",
"hash": 2305337049538094600,
"line_mean": 35.277486911,
"line_max": 91,
"alpha_frac": 0.5732428922,
"autogenerated": false,
"ratio": 3.31055900621118,
"config_test": fals... |
"""An example of using the internal DB-API module without any Django."""
# Adds the relative path for the MS SQL Server backend to Python's import path.
# We do this so we can run this module from a checkout for demo purposes
# without having to install it.
def _hack_backend_path():
import os, sys
backend_pat... | {
"repo_name": "theoriginalgri/django-mssql",
"path": "extras/samples/nodjango.py",
"copies": "1",
"size": "1654",
"license": "mit",
"hash": -4848877497085948000,
"line_mean": 29.2075471698,
"line_max": 123,
"alpha_frac": 0.6650544135,
"autogenerated": false,
"ratio": 3.4244306418219463,
"config... |
""" An example of using this library to calculate related artists
from the last.fm dataset. More details can be found
at http://www.benfrederickson.com/matrix-factorization/
This code will automically download a HDF5 version of the dataset from
GitHub when it is first run. The original dataset can also be found at
htt... | {
"repo_name": "benfred/implicit",
"path": "examples/lastfm.py",
"copies": "1",
"size": "6412",
"license": "mit",
"hash": -2531186803664295400,
"line_mean": 33.1063829787,
"line_max": 99,
"alpha_frac": 0.664691204,
"autogenerated": false,
"ratio": 3.586129753914989,
"config_test": false,
"has_... |
"""An example of wrapping manual tqdm updates for urllib reporthook.
# urllib.urlretrieve documentation
> If present, the hook function will be called once
> on establishment of the network connection and once after each block read
> thereafter. The hook will be passed three arguments; a count of blocks
> transferred ... | {
"repo_name": "lrq3000/tqdm",
"path": "examples/tqdm_wget.py",
"copies": "2",
"size": "1942",
"license": "mit",
"hash": 5515203176879914000,
"line_mean": 28.8769230769,
"line_max": 77,
"alpha_frac": 0.6168898043,
"autogenerated": false,
"ratio": 3.3891797556719023,
"config_test": false,
"has_... |
"""An example program that uses the elsapy module"""
from elsapy.elsclient import ElsClient
from elsapy.elsprofile import ElsAuthor, ElsAffil
from elsapy.elsdoc import FullDoc, AbsDoc
from elsapy.elssearch import ElsSearch
import json
## Load configuration
con_file = open("config.json")
config = json.lo... | {
"repo_name": "ElsevierDev/elsapy",
"path": "exampleProg.py",
"copies": "1",
"size": "3608",
"license": "bsd-3-clause",
"hash": 1416001645934588700,
"line_mean": 32.0566037736,
"line_max": 91,
"alpha_frac": 0.6751662971,
"autogenerated": false,
"ratio": 3.0969957081545063,
"config_test": false,... |
# An example script showing the functionality of the TinCanPython Library
import uuid
from resources import lrs_properties
from tincan import (
RemoteLRS,
Statement,
Agent,
Verb,
Activity,
Context,
LanguageMap,
ActivityDefinition,
StateDocument,
)
# construct an LRS
print "constr... | {
"repo_name": "jpablo128/TinCanPython",
"path": "examples/example_script.py",
"copies": "2",
"size": "3687",
"license": "apache-2.0",
"hash": -8697472152876557000,
"line_mean": 24.9647887324,
"line_max": 100,
"alpha_frac": 0.7138595064,
"autogenerated": false,
"ratio": 3.716733870967742,
"confi... |
# An example script showing the functionality of the TinCanPython Library
import uuid
from test.resources import lrs_properties
from tincan import (
RemoteLRS,
Statement,
Agent,
Verb,
Activity,
Context,
LanguageMap,
ActivityDefinition,
StateDocument,
)
# construct an LRS
print("c... | {
"repo_name": "RusticiSoftware/TinCanPython",
"path": "examples/example_script.py",
"copies": "1",
"size": "3718",
"license": "apache-2.0",
"hash": 5229279536557394000,
"line_mean": 25.1830985915,
"line_max": 100,
"alpha_frac": 0.7089833244,
"autogenerated": false,
"ratio": 3.7404426559356136,
... |
# An example script to generate calfits from pointing/cable calibration txt files,
# modified from the example script on the pyuvdata github.
from pyuvdata import UVCal
import numpy as np
# Time array is in JD and calculated at the center of the time sample, and the corresponding pointing number.
# Best to reference... | {
"repo_name": "miguelfmorales/FHD",
"path": "instrument_config/obsolete/pyuvdata_calfits_from_txt.py",
"copies": "2",
"size": "5245",
"license": "bsd-2-clause",
"hash": 9022491926787726000,
"line_mean": 34.6802721088,
"line_max": 233,
"alpha_frac": 0.7044804576,
"autogenerated": false,
"ratio": 2... |
"""An example server using a WSGI application with the CherryPy web server."""
import os
import optparse
import logging
import sys
import cherrypy
import amfast
from amfast.remoting.wsgi_channel import WsgiChannelSet, WsgiChannel
class App(object):
"""Base web app."""
@cherrypy.expose
def index(self):
... | {
"repo_name": "limscoder/amfast",
"path": "examples/messaging/python/cp_wsgi_server.py",
"copies": "1",
"size": "2159",
"license": "mit",
"hash": 3496894416358253600,
"line_mean": 30.2898550725,
"line_max": 78,
"alpha_frac": 0.6452061139,
"autogenerated": false,
"ratio": 3.754782608695652,
"con... |
"""An example server using the CherryPy web framework."""
import os
import optparse
from wsgiref import simple_server
import amfast
from amfast.remoting.channel import ChannelSet
from amfast.remoting.wsgi_channel import WsgiChannel
from amfast.remoting.pyamf_endpoint import PyAmfEndpoint
import utils
class App(objec... | {
"repo_name": "limscoder/amfast",
"path": "examples/pyamf/python/wsgi_server.py",
"copies": "1",
"size": "1797",
"license": "mit",
"hash": 3336666866539049500,
"line_mean": 32.9056603774,
"line_max": 74,
"alpha_frac": 0.6505286589,
"autogenerated": false,
"ratio": 3.7752100840336134,
"config_te... |
"""An example server using the CherryPy web framework."""
import os
import optparse
from wsgiref import simple_server
import amfast
from amfast.remoting.wsgi_channel import WsgiChannelSet, WsgiChannel
import utils
if __name__ == '__main__':
usage = """usage: %s [options]""" % __file__
parser = optparse.Option... | {
"repo_name": "limscoder/amfast",
"path": "examples/hello_world/python/wsgi_server.py",
"copies": "1",
"size": "1209",
"license": "mit",
"hash": 1566378933520295000,
"line_mean": 30.8157894737,
"line_max": 74,
"alpha_frac": 0.6650124069,
"autogenerated": false,
"ratio": 3.6859756097560976,
"con... |
"""An example server using the CherryPy web framework."""
import os
import optparse
import logging
import sys
import cherrypy
import amfast
from amfast.remoting.cherrypy_channel import CherryPyChannel, CherryPyChannelSet
class App(CherryPyChannelSet):
"""Base web app."""
@cherrypy.expose
def index(self)... | {
"repo_name": "limscoder/amfast",
"path": "examples/messaging/python/cp_server.py",
"copies": "1",
"size": "2090",
"license": "mit",
"hash": -6907731681666073000,
"line_mean": 29.2898550725,
"line_max": 80,
"alpha_frac": 0.6464114833,
"autogenerated": false,
"ratio": 3.8419117647058822,
"config... |
"""An example server using the CherryPy web framework."""
import os
import optparse
import cherrypy
import amfast
from amfast.remoting.channel import ChannelSet
from amfast.remoting.wsgi_channel import WsgiChannel
from amfast.remoting.pyamf_endpoint import PyAmfEndpoint
import utils
class App(object):
"""Base w... | {
"repo_name": "limscoder/amfast",
"path": "examples/pyamf/python/cp_server.py",
"copies": "1",
"size": "1652",
"license": "mit",
"hash": 2637910705783713000,
"line_mean": 28.5,
"line_max": 78,
"alpha_frac": 0.6283292978,
"autogenerated": false,
"ratio": 3.599128540305011,
"config_test": false,
... |
"""An example server using the CherryPy web framework."""
import os
import optparse
import cherrypy
import amfast
from amfast.remoting.cherrypy_channel import CherryPyChannelSet, CherryPyChannel
import utils
class App(CherryPyChannelSet):
"""Base web app."""
@cherrypy.expose
def index(self):
rai... | {
"repo_name": "limscoder/amfast",
"path": "examples/addressbook/python/cp_server.py",
"copies": "1",
"size": "1498",
"license": "mit",
"hash": 4141970166072879600,
"line_mean": 27.8076923077,
"line_max": 80,
"alpha_frac": 0.6181575434,
"autogenerated": false,
"ratio": 3.6805896805896805,
"confi... |
"""An example server using the CherryPy web framework.
This example uses a WsgiChannel, grafted onto the CherryPy tree.
To run the example execute the command:
python cp_wsgi_server.py
"""
import os
import optparse
import logging
import sys
import cherrypy
import amfast
from amfast.remoting.channel import Chann... | {
"repo_name": "limscoder/amfast",
"path": "examples/streaming/python/cp_wsgi_server.py",
"copies": "1",
"size": "1888",
"license": "mit",
"hash": -1332228876717665800,
"line_mean": 28.0461538462,
"line_max": 78,
"alpha_frac": 0.6451271186,
"autogenerated": false,
"ratio": 3.7238658777120315,
"c... |
"""An example server using the CherryPy web framework.
To run the example execute the command:
python cp_server.py
"""
import os
import optparse
import logging
import sys
import cherrypy
import amfast
from amfast.remoting.cherrypy_channel import CherryPyChannelSet, StreamingCherryPyChannel
class App(CherryPyCha... | {
"repo_name": "limscoder/amfast",
"path": "examples/streaming/python/cp_server.py",
"copies": "1",
"size": "1741",
"license": "mit",
"hash": 9037741573736894000,
"line_mean": 27.5409836066,
"line_max": 89,
"alpha_frac": 0.6392877657,
"autogenerated": false,
"ratio": 3.752155172413793,
"config_t... |
"""An example server using WSGI."""
import os
import optparse
from wsgiref import simple_server
import amfast
from amfast.remoting.channel import ChannelSet
from amfast.remoting.wsgi_channel import WsgiChannel
import utils
class App(object):
def __init__(self):
self.channel_set = ChannelSet()
rpc_... | {
"repo_name": "limscoder/amfast",
"path": "examples/addressbook/python/wsgi_server.py",
"copies": "1",
"size": "1691",
"license": "mit",
"hash": 3523165894783595500,
"line_mean": 32.1568627451,
"line_max": 74,
"alpha_frac": 0.638083974,
"autogenerated": false,
"ratio": 3.791479820627803,
"confi... |
""" An example showing how to use DEAP optimization (http://pythonhosted.org/deap/).
DEAP can be combined with *pypet* to keep track of all the data and the full trajectory
of points created by a genetic algorithm.
Note that *pypet* adds quite some overhead to the optimization algorithm.
Using *pypet* in combination ... | {
"repo_name": "nigroup/pypet",
"path": "examples/example_20_using_deap_manual_runs.py",
"copies": "2",
"size": "6723",
"license": "bsd-3-clause",
"hash": -6079670687043612000,
"line_mean": 33.306122449,
"line_max": 94,
"alpha_frac": 0.6450989142,
"autogenerated": false,
"ratio": 3.637987012987013... |
# An example showing how to use sensor data, here with the SenseHAT (or SenseHAT emulator)
# Refer to RaspberryPi forums Teaching and learning resources : https://www.raspberrypi.org/forums/viewtopic.php?f=49&t=202386 for some talk using it.
# compass added for show, but commented as it will not work if just enabled
f... | {
"repo_name": "lawsie/guizero",
"path": "examples/sensehat_read_data.py",
"copies": "1",
"size": "4080",
"license": "bsd-3-clause",
"hash": -3316168253024331000,
"line_mean": 35.4107142857,
"line_max": 150,
"alpha_frac": 0.6343795978,
"autogenerated": false,
"ratio": 2.667102681491171,
"config_... |
""" An example showing moveable shapes. """
# Enthought library imports.
from enable.api import Container, Window
from enable.example_support import DemoFrame, demo_main
# Local imports
from box import Box
from circle import Circle
class MyFrame(DemoFrame):
""" The top-level frame. """
# 'DemoFrame' interfa... | {
"repo_name": "tommy-u/enable",
"path": "examples/enable/shapes/run.py",
"copies": "1",
"size": "1812",
"license": "bsd-3-clause",
"hash": 5092299413806449000,
"line_mean": 26.0447761194,
"line_max": 79,
"alpha_frac": 0.4668874172,
"autogenerated": false,
"ratio": 4.408759124087592,
"config_tes... |
""" An example simulation for a Hawk-Dove game using two-population discrete time replicator dynamics.
"""
## This is hackery to make this run from where it is. Do not do this.
import os
import sys
path = os.path.realpath(__file__)
sys.path.insert(0, os.path.abspath(os.sep.join([path, "..", "..", "src"])))
## End ha... | {
"repo_name": "gsmcwhirter/simulations",
"path": "examples/two_population_hd.py",
"copies": "1",
"size": "2497",
"license": "mit",
"hash": -9192509709340824000,
"line_mean": 22.780952381,
"line_max": 102,
"alpha_frac": 0.663195835,
"autogenerated": false,
"ratio": 3.536827195467422,
"config_tes... |
""" An example simulation for a Prisoner's Dilemma using one-population discrete time replicator dynamics.
"""
## This is hackery to make this run from where it is. Do not do this.
import os
import sys
path = os.path.realpath(__file__)
sys.path.insert(0, os.path.abspath(os.sep.join([path, "..", "..", "src"])))
## En... | {
"repo_name": "gsmcwhirter/simulations",
"path": "examples/one_population_pd.py",
"copies": "1",
"size": "2494",
"license": "mit",
"hash": 7719338379207879000,
"line_mean": 22.7523809524,
"line_max": 106,
"alpha_frac": 0.6704089816,
"autogenerated": false,
"ratio": 3.5577746077032812,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.