text stringlengths 0 1.05M | meta dict |
|---|---|
"""A context manager to preserve global variables over IPython-parallel.
See the PreserveVars class.
"""
from IPython.parallel import interactive
_base_store_name = '_preservevars_store'
@interactive
def _enter (base_store_name, data):
# get variable to store in (can't be in data)
store_name = base_store_n... | {
"repo_name": "cedadev/ipython_project",
"path": "preservevars.py",
"copies": "1",
"size": "2142",
"license": "bsd-3-clause",
"hash": -1399388692580263200,
"line_mean": 23.9186046512,
"line_max": 77,
"alpha_frac": 0.5994397759,
"autogenerated": false,
"ratio": 3.558139534883721,
"config_test": ... |
""" A context where other parts share global state.
"""
import logging
import struct
from ...common import CompilerError
from ...arch.arch_info import Endianness
from ... import ir
from .nodes.types import BasicType
from .nodes import types, expressions
from .utils import required_padding
from .eval import ConstantE... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/lang/c/context.py",
"copies": "1",
"size": "10785",
"license": "bsd-2-clause",
"hash": 5998108085792696000,
"line_mean": 37.3807829181,
"line_max": 81,
"alpha_frac": 0.5712563746,
"autogenerated": false,
"ratio": 4.063677467972871,
"confi... |
# A continuacion el algoritmo de corte minimo
# dado un grafo
# La implementacion de este algoritmo fue desarrollada por Raul Bernardo
# Rodas Herrera, el 20 de Septiembre del ano 2013.
# Se importan las librerias correspondientes
# Libreria para el manejo de grafos.
# Para obtener valores aleatorios
import random
... | {
"repo_name": "BRodas/k-cut",
"path": "lib_python/Min_Cut_Kargers.py",
"copies": "1",
"size": "8073",
"license": "mit",
"hash": -6986822691029362000,
"line_mean": 38,
"line_max": 79,
"alpha_frac": 0.6055989099,
"autogenerated": false,
"ratio": 3.0464150943396224,
"config_test": false,
"has_no... |
#A continuación se muestra el código que se uso para obtener los mapas HSV
#y HSL. También se muestra el código para obtener el Histogram of oriented
#gradients, Histograma para Local binary patterns y un histograma de la
#imagen en escala de gris. Sin embargo, aunque no esta documentado,
#se obtuvo en pruebas q... | {
"repo_name": "a-bacilio/Codigo-de-tesis-descarte",
"path": "obtener_descriptores.py",
"copies": "1",
"size": "5970",
"license": "mit",
"hash": -3389036735799320000,
"line_mean": 39.6783216783,
"line_max": 80,
"alpha_frac": 0.4796911715,
"autogenerated": false,
"ratio": 2.5836947094535994,
"con... |
"""A contour component. This component wraps around the
tvtk.ContourFilter and provides convenient options to either
automatically generate a specified number of contours between a given
minimum and maximum value or explicitly specify the contours. This
component may be used for any input data. The component also pr... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/components/contour.py",
"copies": "3",
"size": "12760",
"license": "bsd-3-clause",
"hash": -7955994203910183000,
"line_mean": 36.7514792899,
"line_max": 82,
"alpha_frac": 0.5257053292,
"autogenerated": false,
"ratio": 4.3833734111989004,
"config_t... |
"""A contour grid plane module. This module lets one take a slice of
input grid data and view contours of the data. The module only works
for structured points, rectilinear grid and structured grid input.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2006, Enthought, Inc.
# License: ... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/modules/contour_grid_plane.py",
"copies": "3",
"size": "6426",
"license": "bsd-3-clause",
"hash": -4767929185870938000,
"line_mean": 36.1445086705,
"line_max": 74,
"alpha_frac": 0.5577342048,
"autogenerated": false,
"ratio": 4.49370629370629... |
"""A controller for watering a plant.
This acts a both a source (current output state) and a sink (receives sensor
data to act on).
"""
import atexit
import logging
from threading import Lock, Timer
from RPi import GPIO
from sensor_feed.sensor import SleepingSensor
from sensor_feed.sink import Sink
LOGGER = logging... | {
"repo_name": "dmkent/sensor-feed",
"path": "sensor_feed/plant_control.py",
"copies": "1",
"size": "2050",
"license": "mit",
"hash": -6450536561402441000,
"line_mean": 25.9736842105,
"line_max": 76,
"alpha_frac": 0.6117073171,
"autogenerated": false,
"ratio": 3.7545787545787546,
"config_test": ... |
"""A convenience class for a GTK 3 system tray indicator."""
from pkg_resources import resource_filename
import gi
gi.require_version('Gtk', '3.0') # noqa
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf
class Indicator:
"""This class defines a standard GTK3 system tray indicator.
... | {
"repo_name": "SpotlightKid/jack-select",
"path": "jackselect/indicator.py",
"copies": "1",
"size": "3938",
"license": "mit",
"hash": 3091213283380261400,
"line_mean": 31.5454545455,
"line_max": 94,
"alpha_frac": 0.5977653631,
"autogenerated": false,
"ratio": 3.910625620655412,
"config_test": f... |
""" a convenience layer for creating data in the core and debugging it """
import collections
from decorator import decorator
from gatesym import core
class Node(object):
""" a point in the network of gates """
def __init__(self, name):
self.name = name
self.outputs = []
self.input... | {
"repo_name": "tolomea/gatesym",
"path": "gatesym/gates.py",
"copies": "1",
"size": "7919",
"license": "mit",
"hash": -425313775395992770,
"line_mean": 26.9823321555,
"line_max": 119,
"alpha_frac": 0.5724207602,
"autogenerated": false,
"ratio": 4.046499744506899,
"config_test": false,
"has_no... |
"""A convenience which constructs expression trees from an easy-to-read syntax
Use this unless you have a compelling reason not to; it performs some
optimizations that would be tedious to do when constructing an expression tree
by hand.
"""
from collections import Mapping
from inspect import isfunction, ismethod
fro... | {
"repo_name": "smurfix/parsimonious",
"path": "parsimonious/grammar.py",
"copies": "1",
"size": "19455",
"license": "mit",
"hash": 6409841884774660000,
"line_mean": 38.1448692153,
"line_max": 94,
"alpha_frac": 0.6156772038,
"autogenerated": false,
"ratio": 4.197411003236246,
"config_test": fals... |
"""A convenient API to access the GPIO pins of the Raspberry Pi.
"""
import subprocess
from quick2wire.board_revision import revision
from quick2wire.selector import EDGE
def gpio_admin(subcommand, pin, pull=None):
if pull:
subprocess.check_call(["gpio-admin", subcommand, str(pin), pull])
else:
... | {
"repo_name": "FuelCellUAV/FC_datalogger",
"path": "quick2wire/quick2wire/gpio.py",
"copies": "1",
"size": "7683",
"license": "cc0-1.0",
"hash": 6397126853528005000,
"line_mean": 25.4931034483,
"line_max": 96,
"alpha_frac": 0.5540804373,
"autogenerated": false,
"ratio": 3.7441520467836256,
"con... |
'''A convenient class for parsing HTML pages.'''
from __future__ import unicode_literals
from HTMLParser import HTMLParser
import logging
import re
from RSSvk.core import Error
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
class HTMLPageParser(HTMLParser):
'''A convenient class for parsing HTML... | {
"repo_name": "Densvin/RSSVK",
"path": "vkfeed/tools/html_parser.py",
"copies": "1",
"size": "8733",
"license": "bsd-2-clause",
"hash": -295135026531479500,
"line_mean": 26.5488958991,
"line_max": 128,
"alpha_frac": 0.5151723348,
"autogenerated": false,
"ratio": 4.0262793914246195,
"config_test... |
'''A convenient class for parsing HTML pages.'''
from __future__ import unicode_literals
from HTMLParser import HTMLParser
import logging
import re
from vkfeed.core import Error
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
class HTMLPageParser(HTMLParser):
'''A convenient class for parsing HTM... | {
"repo_name": "SapronovMaxim/vkfeed_JIT",
"path": "vkfeed/tools/html_parser.py",
"copies": "16",
"size": "8734",
"license": "bsd-2-clause",
"hash": 7842032908226018000,
"line_mean": 26.5520504732,
"line_max": 128,
"alpha_frac": 0.5152278452,
"autogenerated": false,
"ratio": 4.024884792626728,
"... |
""" A convenient plotting container
In this package implements :class:`Plotter`, which is a simple container to
dictionary like structure (e.g. :class:`dict`, :class:`np.recarray`,
:class:`pandas.DataFrame`). It allows the user to plot directly using keys of
the data and also allows rapid group plotting routines (grou... | {
"repo_name": "mfouesneau/ezdata",
"path": "ezdata/plotter.py",
"copies": "1",
"size": "62725",
"license": "mit",
"hash": 588978340670407300,
"line_mean": 31.8059623431,
"line_max": 83,
"alpha_frac": 0.5305540056,
"autogenerated": false,
"ratio": 4.126101828706749,
"config_test": false,
"has_... |
"""A conversion module for googletrans"""
import json
import re
def build_params(query, src, dest, token, override):
params = {
'client': 'webapp',
'sl': src,
'tl': dest,
'hl': dest,
'dt': ['at', 'bd', 'ex', 'ld', 'md', 'qca', 'rw', 'rm', 'ss', 't'],
'ie': 'UTF-8',
... | {
"repo_name": "ssut/py-googletrans",
"path": "googletrans/utils.py",
"copies": "1",
"size": "1945",
"license": "mit",
"hash": -610993380705895800,
"line_mean": 23.6202531646,
"line_max": 82,
"alpha_frac": 0.5172236504,
"autogenerated": false,
"ratio": 3.52994555353902,
"config_test": false,
"... |
'''A conversion of Jon Skeet's LINQ Mandelbrot from LINQ to asq.
The original can be found at
http://msmvps.com/blogs/jon_skeet/archive/2008/02/26/visualising-the-mandelbrot-set-with-linq-yet-again.aspx
'''
import colorsys
#import Image
from asq.initiators import integers, query
def generate(start, func):
val... | {
"repo_name": "rob-smallshire/asq",
"path": "asq/examples/mandelbrot.py",
"copies": "6",
"size": "1711",
"license": "mit",
"hash": -6501810235767690000,
"line_mean": 27.5166666667,
"line_max": 114,
"alpha_frac": 0.5680888369,
"autogenerated": false,
"ratio": 3.1394495412844035,
"config_test": f... |
"""A convolutional neural network for MNIST classification.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
# Import data
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
FLAGS = None
def ... | {
"repo_name": "mengli/MachineLearning",
"path": "mnist/mnist_conv.py",
"copies": "2",
"size": "2937",
"license": "apache-2.0",
"hash": -8654154573835021000,
"line_mean": 28.9693877551,
"line_max": 89,
"alpha_frac": 0.6540687777,
"autogenerated": false,
"ratio": 2.8105263157894735,
"config_test"... |
# a convolution layer with a following pooling layer
import numpy as np
from sigmoid import sigmoid
from sigmoid import sigmoid_d
from flatten_poolingLayer_output import flatten_poolingLayer_output
import conv2d
from FullyConnectedLayer import FullyConnectedLayer
class ConvPoolingLayer(object):
def __init__(self... | {
"repo_name": "metorm/DeepLearningTutorial",
"path": "ConvPoolingLayer.py",
"copies": "1",
"size": "7214",
"license": "mit",
"hash": -884299500220966300,
"line_mean": 45.5419354839,
"line_max": 117,
"alpha_frac": 0.5547546437,
"autogenerated": false,
"ratio": 3.5155945419103314,
"config_test": ... |
"""A copy of Django 1.3.0's stock loaddata.py, adapted so that, instead of
loading any data, it returns the tables referenced by a set of fixtures so we
can truncate them (and no others) quickly after we're finished with them."""
import gzip
import os
import zipfile
from django.conf import settings
from django.core im... | {
"repo_name": "jbalogh/test-utils",
"path": "test_utils/fixture_tables.py",
"copies": "1",
"size": "6601",
"license": "bsd-3-clause",
"hash": 6228623059351823000,
"line_mean": 40,
"line_max": 103,
"alpha_frac": 0.5106802,
"autogenerated": false,
"ratio": 4.658433309809457,
"config_test": false,... |
'''A Coral wrapper for the MAFFT command line multiple sequence aligner.'''
import coral
import os
import shutil
import subprocess
import tempfile
def MAFFT(sequences, gap_open=1.53, gap_extension=0.0, retree=2):
'''A Coral wrapper for the MAFFT command line multiple sequence aligner.
:param sequences: A lis... | {
"repo_name": "klavinslab/coral",
"path": "coral/analysis/_sequencing/mafft.py",
"copies": "1",
"size": "1898",
"license": "mit",
"hash": 2487104441286565400,
"line_mean": 33.5090909091,
"line_max": 77,
"alpha_frac": 0.5990516333,
"autogenerated": false,
"ratio": 3.9707112970711296,
"config_tes... |
# Acorn 2.0: Cocoa Butter
# Booleans are treated as integers
# Allow hex
#Number meta class
class N():
def __init__(self,n):
try:
self.n = float(n)
if(self.n.is_integer()):
self.n = int(n)
except:
self.n = int(n,16)
def N(self):
retur... | {
"repo_name": "mita4829/Acorn",
"path": "src/Foundation.py",
"copies": "1",
"size": "10840",
"license": "mit",
"hash": -1489787082479614700,
"line_mean": 21.8691983122,
"line_max": 88,
"alpha_frac": 0.4964944649,
"autogenerated": false,
"ratio": 3.1311380704794916,
"config_test": false,
"has_... |
#Acorn 2.0: Cocoa Butter
#No direct access to stack and heap. Stack data structure with dictionaries for lexical scoping. More efficent usage of dense dictionaries in python3.6+
#String concats
#No direct stepping access to raw values
#Logical operators with short-cir effect
from sys import exit
import Foundation
impo... | {
"repo_name": "mita4829/Acorn",
"path": "src/Parser.py",
"copies": "1",
"size": "18526",
"license": "mit",
"hash": 6776410100933722000,
"line_mean": 33.1808118081,
"line_max": 220,
"alpha_frac": 0.570819389,
"autogenerated": false,
"ratio": 3.4351937697014647,
"config_test": false,
"has_no_ke... |
#Acorn v1.0
from sys import exit
import Foundation
import Memory
def case(expr,typep):
return isinstance(expr,typep)
def isValue(expr):
return isinstance(expr,Foundation.N) or isinstance(expr,Foundation.B) or isinstance(expr,Foundation.S) or isinstance(expr,Foundation.Null) or isinstance(expr,Foundation.Fun... | {
"repo_name": "mita4829/Acorn",
"path": "Acorn 1.1.1 Deprecated/Parser_1.1.1_Deprecated.py",
"copies": "1",
"size": "13076",
"license": "mit",
"hash": -2060690735918574800,
"line_mean": 34.5326086957,
"line_max": 220,
"alpha_frac": 0.5744876109,
"autogenerated": false,
"ratio": 3.4052083333333334... |
"""A Couchbase CLI subcommand"""
import getpass
import inspect
import ipaddress
import json
import os
import platform
import random
import re
import string
import subprocess
import sys
import urllib.parse
import tempfile
import time
from typing import Optional, List, Any, Dict
from argparse import ArgumentError, Arg... | {
"repo_name": "couchbase/couchbase-cli",
"path": "cbmgr.py",
"copies": "1",
"size": "266393",
"license": "apache-2.0",
"hash": 2712867302306999300,
"line_mean": 46.9469042477,
"line_max": 124,
"alpha_frac": 0.5824026908,
"autogenerated": false,
"ratio": 4.188832630983081,
"config_test": false,
... |
""" A countdown in a 16x2 LCD.
It is possible to pause or reset the countdown using buttons.
When the countdown ends buzzes continuously.
Requires:
- Adafruit_CharLCD (https://github.com/adafruit/Adafruit_Python_CharLCD)
Hardware:
- 16x2 LCD (8 digital pins)
- Buzzer (1 digital pin)
- 2x buttons (1 digital pin each)
... | {
"repo_name": "lamenezes/pingo-py",
"path": "pingo/examples/lcd16x2_countdown.py",
"copies": "1",
"size": "2575",
"license": "mit",
"hash": -5359123334487941000,
"line_mean": 22.4090909091,
"line_max": 81,
"alpha_frac": 0.6027184466,
"autogenerated": false,
"ratio": 3.040141676505313,
"config_t... |
#a count with metadata writing func
#count_saxs( 'Silica 1 fr x .1 exp, mbs 0.1x0.6, bds 15x15, prekin .1x.08', 1, .1, .1, new_pos=True)
#RE(count_saxs( 'Silica 1 fr x .1 exp, mbs 0.1x0.6, bds 15x15, prekin .1x.08', 1, .1, .1, new_pos=True))
#RE(go_to_sleep())
#RE(count_saxs( 'AuNP_2DSheet',1,.5,None,new_pos=True))... | {
"repo_name": "NSLS-II-CHX/ipython_ophyd",
"path": "startup/36-commisionning.py",
"copies": "2",
"size": "9808",
"license": "bsd-2-clause",
"hash": -2947831119223505000,
"line_mean": 30.3354632588,
"line_max": 104,
"alpha_frac": 0.5935970636,
"autogenerated": false,
"ratio": 2.5084398976982096,
... |
# A couple models for Haystack to test with.
import datetime
from django.db import models
class MockTag(models.Model):
name = models.CharField(max_length=32)
class MockModel(models.Model):
author = models.CharField(max_length=255)
foo = models.CharField(max_length=255, blank=True)
pub_date = models.... | {
"repo_name": "Architizer/django-haystack",
"path": "tests/core/models.py",
"copies": "11",
"size": "2013",
"license": "bsd-3-clause",
"hash": 1865665442344864300,
"line_mean": 25.4868421053,
"line_max": 83,
"alpha_frac": 0.7044212618,
"autogenerated": false,
"ratio": 3.741635687732342,
"config... |
# A couple of classes to assist with resolution calculations - these
# are for calculating resolution (d, s) for either distance / beam /
# wavelength / position or h, k, l, / unit cell.
import logging
import math
import os
import tempfile
from xia2.Wrappers.CCP4.Pointless import Pointless
from xia2.Modules.Scaler.r... | {
"repo_name": "xia2/xia2",
"path": "src/xia2/Experts/ResolutionExperts.py",
"copies": "1",
"size": "2396",
"license": "bsd-3-clause",
"hash": -3575424192972167700,
"line_mean": 22.0384615385,
"line_max": 77,
"alpha_frac": 0.5550918197,
"autogenerated": false,
"ratio": 3.608433734939759,
"config... |
"""A couple of point pens to filter contours in various ways."""
from fontTools.pens.basePen import AbstractPen, BasePen
from robofab.pens.pointPen import AbstractPointPen
from robofab.objects.objectsRF import RGlyph as _RGlyph
from robofab.objects.objectsBase import _interpolatePt
import math
#
# threshold filter... | {
"repo_name": "moyogo/robofab",
"path": "Lib/robofab/pens/filterPen.py",
"copies": "9",
"size": "12103",
"license": "bsd-3-clause",
"hash": -7695697370394359000,
"line_mean": 28.7395577396,
"line_max": 101,
"alpha_frac": 0.6945385442,
"autogenerated": false,
"ratio": 2.841079812206573,
"config_... |
"""A couple of point pens which return the glyph as a list of basic values."""
from robofab.pens.pointPen import AbstractPointPen
class DigestPointPen(AbstractPointPen):
"""Calculate a digest of all points
AND coordinates
AND components
in a glyph.
"""
def __init__(self, ignoreSmoothAndName=False):
self... | {
"repo_name": "moyogo/robofab",
"path": "Lib/robofab/pens/digestPen.py",
"copies": "9",
"size": "2328",
"license": "bsd-3-clause",
"hash": -7576792175359058000,
"line_mean": 20.9716981132,
"line_max": 78,
"alpha_frac": 0.6894329897,
"autogenerated": false,
"ratio": 3.0273081924577374,
"config_t... |
# A couple of samples using SHBrowseForFolder
import sys, os
from win32com.shell import shell, shellcon
import win32gui
# A callback procedure - called by SHBrowseForFolder
def BrowseCallbackProc(hwnd, msg, lp, data):
if msg== shellcon.BFFM_INITIALIZED:
win32gui.SendMessage(hwnd, shellcon.BFFM_SETSELECTIO... | {
"repo_name": "PopCap/GameIdea",
"path": "Engine/Source/ThirdParty/HTML5/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32comext/shell/demos/browse_for_folder.py",
"copies": "47",
"size": "1661",
"license": "bsd-2-clause",
"hash": 221064668351675100,
"line_mean": 40.525,
"line_max": 76,
"alpha... |
# A couple of samples using SHBrowseForFolder
import sys, os
from win32com.shell import shell, shellcon
import win32gui
# A callback procedure - called by SHBrowseForFolder
def BrowseCallbackProc(hwnd, msg, lp, data):
if msg== shellcon.BFFM_INITIALIZED:
win32gui.SendMessage(hwnd, shellcon.BFFM_SE... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32comext/shell/demos/browse_for_folder.py",
"copies": "4",
"size": "1701",
"license": "bsd-3-clause",
"hash": 5427967116793838000,
"line_mean": 40.525,
"line_max": 76,
"alpha_frac": 0.5590828924,
"autogenerated": false,
"ratio": ... |
""" A couple of simple tools I'm using everywhere. """
import os
import inspect
import sys
def isNumber(n):
try:
dummy = float(n)
return True
except ValueError:
return False
def good_path(filename, remove=os.path.sep+"core"):
"""This will return the path to related filename"""
return os.path.join(os.path.d... | {
"repo_name": "gdubost1/shaderman",
"path": "core/utils.py",
"copies": "4",
"size": "2780",
"license": "bsd-3-clause",
"hash": -3956236393747229000,
"line_mean": 22.974137931,
"line_max": 102,
"alpha_frac": 0.5071942446,
"autogenerated": false,
"ratio": 2.857142857142857,
"config_test": false,
... |
# a couple of support functions which
# help with generating Python source.
# XXX This module provides a similar, but subtly different, functionality
# XXX several times over, which used to be scattered over four modules.
# XXX We should try to generalize and single out one approach to dynamic
# XXX code compilation.
... | {
"repo_name": "oblique-labs/pyVM",
"path": "rpython/tool/sourcetools.py",
"copies": "2",
"size": "10132",
"license": "mit",
"hash": -2238182091290716200,
"line_mean": 33.2297297297,
"line_max": 85,
"alpha_frac": 0.5724437426,
"autogenerated": false,
"ratio": 3.942412451361868,
"config_test": fa... |
"""Acoustic Brainz Genre dataset
.. admonition:: Dataset Info
:class: dropdown
The AcousticBrainz Genre Dataset consists of four datasets of genre annotations and music features extracted from audio
suited for evaluation of hierarchical multi-label genre classification systems.
Description about the ... | {
"repo_name": "mir-dataset-loaders/mirdata",
"path": "mirdata/datasets/acousticbrainz_genre.py",
"copies": "1",
"size": "22548",
"license": "bsd-3-clause",
"hash": 1166161674245937200,
"line_mean": 42.1089866157,
"line_max": 184,
"alpha_frac": 0.6630000887,
"autogenerated": false,
"ratio": 3.7702... |
"""ACP Inheritance Settings Class"""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
from .accesspolicies import AccessPolicies
import logging
class InheritanceSettings(APIClassTemplate):
"""The InheritanceSettings Object in the FMC."""
VALID_JSON_DATA = []
VALID_FOR_KWARGS = VALID_JSON_... | {
"repo_name": "daxm/fmcapi",
"path": "fmcapi/api_objects/policy_services/inheritancesettings.py",
"copies": "1",
"size": "4743",
"license": "bsd-3-clause",
"hash": 492906868235054850,
"line_mean": 36.944,
"line_max": 115,
"alpha_frac": 0.5989879823,
"autogenerated": false,
"ratio": 3.985714285714... |
#Acq_IncClk.py
# C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk\Acq-IntClk.c
import ctypes
import numpy
from time import time, strftime
nidaq = ctypes.windll.nicaiu # load the DLL
#########################
### Setting parameters
# Voltage limit: record between... | {
"repo_name": "UltracoldAtomsLab/labhardware",
"path": "projects/voltrecord/voltrecord.py",
"copies": "2",
"size": "2911",
"license": "mit",
"hash": -6959669874879218000,
"line_mean": 32.4712643678,
"line_max": 119,
"alpha_frac": 0.6310546204,
"autogenerated": false,
"ratio": 3.1710239651416123,
... |
"""Acquia API task queue resource."""
import logging
import re
import requests_cache
import time
from datetime import datetime
from datetime import timedelta
from acapi import exceptions
from acapi.resources.acquiaresource import AcquiaResource
LOGGER = logging.getLogger("acapi.resources.task")
class Task(AcquiaR... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/task.py",
"copies": "1",
"size": "3398",
"license": "mit",
"hash": -4467947417074981000,
"line_mean": 23.6231884058,
"line_max": 86,
"alpha_frac": 0.5288404944,
"autogenerated": false,
"ratio": 4.453473132372215,
"config_test... |
""" Acquia Cloud API client. """
import os
import requests_cache
import acapi.exceptions
from acapi.resources.site import Site
from acapi.resources.sitelist import SiteList
from acapi.resources.user import User
class Client(object):
"""A Client for accessing the Acquia Cloud API."""
def __init__(
s... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/client.py",
"copies": "1",
"size": "2839",
"license": "mit",
"hash": -8803530759376947000,
"line_mean": 24.5765765766,
"line_max": 75,
"alpha_frac": 0.5435012328,
"autogenerated": false,
"ratio": 4.499207606973059,
"config_test": false... |
""" Acquia Cloud API database list resource. """
import re
from acapi.resources.acquialist import AcquiaList
from acapi.resources.database import Database
class DatabaseList(AcquiaList):
"""Dictionary of Acquia Cloud API database resources keyed by name."""
def __init__(self, base_uri, auth, *args, **kwarg... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/databaselist.py",
"copies": "1",
"size": "2067",
"license": "mit",
"hash": 2929313313696006000,
"line_mean": 26.1973684211,
"line_max": 76,
"alpha_frac": 0.5374939526,
"autogenerated": false,
"ratio": 3.9371428571428573,
"con... |
""" Acquia Cloud API data resource. """
import json
import logging
import backoff
import requests
import requests_cache
import time
from acapi.version import __version__
from platform import python_version
from pprint import pformat
LOGGER = logging.getLogger("acapi.resources.acquiadata")
class AcquiaData(object)... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/acquiadata.py",
"copies": "1",
"size": "5136",
"license": "mit",
"hash": 7489766803480367000,
"line_mean": 26.0315789474,
"line_max": 91,
"alpha_frac": 0.5401090343,
"autogenerated": false,
"ratio": 4.509218612818262,
"config... |
"""Acquia Cloud API domain resource. """
import re
from acapi.resources.acquiaresource import AcquiaResource
class Domain(AcquiaResource):
"""Domain record associated with an environment."""
valid_keys = ["name"]
def cache_purge(self):
"""Purge the varnish cache for the domain.
Return... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/domain.py",
"copies": "1",
"size": "2027",
"license": "mit",
"hash": 4152364273745519000,
"line_mean": 27.1527777778,
"line_max": 83,
"alpha_frac": 0.5589541194,
"autogenerated": false,
"ratio": 4.062124248496994,
"config_tes... |
""" Acquia Cloud API Environment resource. """
import re
from acapi.resources.acquiaresource import AcquiaResource
from acapi.resources.database import Database
from acapi.resources.databaselist import DatabaseList
from acapi.resources.domain import Domain
from acapi.resources.domainlist import DomainList
from acapi.... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/environment.py",
"copies": "1",
"size": "4455",
"license": "mit",
"hash": 5134587949477459000,
"line_mean": 24.7514450867,
"line_max": 74,
"alpha_frac": 0.5611672278,
"autogenerated": false,
"ratio": 4.5552147239263805,
"conf... |
"""Acquia Cloud API Exceptions."""
from pprint import pformat
class AcquiaCloudException(Exception):
"""Generic Acquia Cloud API Exception.
All ACAPI exceptions should extend this class.
"""
pass
class AcquiaCloudNoDataException(AcquiaCloudException):
"""No data found exception."""
pass
... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/exceptions.py",
"copies": "1",
"size": "1228",
"license": "mit",
"hash": 2601470133261799000,
"line_mean": 22.1698113208,
"line_max": 72,
"alpha_frac": 0.6229641694,
"autogenerated": false,
"ratio": 4.531365313653136,
"config_test": fa... |
"""Acquia Cloud API server list resource."""
from acapi.resources.acquialist import AcquiaList
from acapi.resources.environment import Environment
class EnvironmentList(AcquiaList):
"""Dict of Acquia Cloud API Environment resources keyed by short name."""
def __init__(self, base_uri, auth, *args, **kwargs):... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/environmentlist.py",
"copies": "1",
"size": "1383",
"license": "mit",
"hash": 5596327021361080000,
"line_mean": 28.4255319149,
"line_max": 78,
"alpha_frac": 0.5668835864,
"autogenerated": false,
"ratio": 4.1656626506024095,
"... |
"""Acquia Cloud API server list resource. """
from acapi.resources.acquialist import AcquiaList
from acapi.resources.server import Server
class ServerList(AcquiaList):
"""Dict of Acquia Cloud API Server resources keyed by hostname."""
def __init__(self, base_uri, auth, *args, **kwargs):
"""Construct... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/serverlist.py",
"copies": "1",
"size": "1358",
"license": "mit",
"hash": -1563295469358689500,
"line_mean": 27.8936170213,
"line_max": 78,
"alpha_frac": 0.558910162,
"autogenerated": false,
"ratio": 4.115151515151515,
"config... |
"""Acquia Cloud API site resource. """
from acapi.resources.acquiaresource import AcquiaResource
from acapi.resources.environment import Environment
from acapi.resources.environmentlist import EnvironmentList
from acapi.resources.task import Task
from acapi.resources.tasklist import TaskList
class Site(AcquiaResourc... | {
"repo_name": "skwashd/python-acquia-cloud",
"path": "acapi/resources/site.py",
"copies": "1",
"size": "2467",
"license": "mit",
"hash": 2889276708821521400,
"line_mean": 23.67,
"line_max": 65,
"alpha_frac": 0.5460072963,
"autogenerated": false,
"ratio": 4.619850187265918,
"config_test": false,... |
"""Acquires and associates a public IP to an account."""
from baseCmd import *
from baseResponse import *
class associateIpAddressCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""the account to associate with this IP address"""
self.account = None
self... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/associateIpAddress.py",
"copies": "1",
"size": "7220",
"license": "apache-2.0",
"hash": -5275564047006220000,
"line_mean": 42.4939759036,
"line_max": 142,
"alpha_frac": 0.6048476454,
"autogenerated": false,
"ratio": 4.2395... |
## Acquried from: https://gist.github.com/jasdumas/53b0cbfbb8af3e435dafb833357fd67f
try:
from html import escape
except ImportError:
from cgi import escape
import os
from string import Template
import sys
import platform
import socket
from datetime import datetime
output_template = Template('''<!DOCTYPE html... | {
"repo_name": "jasdumas/jasdumas.github.io",
"path": "tech-short-papers/system_info.py",
"copies": "1",
"size": "8636",
"license": "mit",
"hash": -3477928878366998000,
"line_mean": 34.6859504132,
"line_max": 119,
"alpha_frac": 0.6088466883,
"autogenerated": false,
"ratio": 3.7032590051457976,
"... |
"""" A crawler for the data-science-jobs.com website. """
from logging import getLogger
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
from joby.items import JobLoader, Job
from joby.utilities import Parser
log = getLogger(__name__)
class DataScienceJobsSpider(CrawlSp... | {
"repo_name": "cyberbikepunk/job-spiders",
"path": "joby/spiders/data_science_jobs.py",
"copies": "1",
"size": "5815",
"license": "mit",
"hash": -245468572191009100,
"line_mean": 33.6130952381,
"line_max": 75,
"alpha_frac": 0.588650043,
"autogenerated": false,
"ratio": 3.7686325340246274,
"conf... |
# acrobot
# import trajectory class and necessary dependencies
from pytrajectory import ControlSystem
import numpy as np
from sympy import cos, sin
# define the function that returns the vectorfield
def f(x,u):
x1, x2, x3, x4 = x
u1, = u
m = 1.0 # masses of the rods [m1 = m2 = m]
l = ... | {
"repo_name": "akunze3/pytrajectory",
"path": "examples/ex5_Acrobot.py",
"copies": "1",
"size": "2711",
"license": "bsd-3-clause",
"hash": -122370026243211490,
"line_mean": 24.3364485981,
"line_max": 97,
"alpha_frac": 0.5713758761,
"autogenerated": false,
"ratio": 2.63715953307393,
"config_test... |
# Acronym generator:
# Random Access Memory : RAM
# ask for a string
# user_input = input("Enter words to convert to an acronym: ")
#
# # convert the string to uppercase and a list
# user_input = user_input.upper().split()
#
# # cycle through the list
# for word in user_input:
# # print the 1st letter of the word ... | {
"repo_name": "J-kaizen/kaizen",
"path": "python/LTP/string_functions.py",
"copies": "1",
"size": "2440",
"license": "mit",
"hash": -1651561455093729000,
"line_mean": 20.0344827586,
"line_max": 70,
"alpha_frac": 0.5668032787,
"autogenerated": false,
"ratio": 3.873015873015873,
"config_test": fa... |
""" A crude alarm clock for the raspberry pi """
import datetime
import time
class AlarmManager:
def __init__(self):
self.alarms = [] # TODO import alarms from persistence storage
def check_alarms(self):
for alarm in self.alarms:
alarm.check()
class Alarm:
def __init__(self... | {
"repo_name": "khominhvi/PiAlarmClock",
"path": "alarm/alarm.py",
"copies": "1",
"size": "1146",
"license": "mit",
"hash": 8682174935578678000,
"line_mean": 23.9130434783,
"line_max": 86,
"alpha_frac": 0.592495637,
"autogenerated": false,
"ratio": 3.638095238095238,
"config_test": false,
"has... |
"""A crude script for clearing out cached profiles. It has mutated a lot, so treat it as a scratchpad and tweak it
as needed. Perhaps we'll ultimately figure out some patterns and we can make it more robust.
You must set environment variables for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to be able to make chang... | {
"repo_name": "censusreporter/censusreporter",
"path": "cache_clearer.py",
"copies": "1",
"size": "6345",
"license": "mit",
"hash": 3915384947824329000,
"line_mean": 34.4469273743,
"line_max": 157,
"alpha_frac": 0.6427107959,
"autogenerated": false,
"ratio": 3.3342091434576986,
"config_test": f... |
"""ACS5-based analysis
"""
import argparse
import json
import matplotlib.pyplot as plt
import pandas as pd
parser = argparse.ArgumentParser(__doc__)
parser.add_argument("join", help="Business/county join file")
parser.add_argument("reviews", help="Yelp review file")
parser.add_argument("census", help="ACS 5-year data... | {
"repo_name": "DistrictDataLabs/03-censusables",
"path": "censusables/fivey.py",
"copies": "1",
"size": "3631",
"license": "apache-2.0",
"hash": -6740168412251856000,
"line_mean": 32.6203703704,
"line_max": 78,
"alpha_frac": 0.6736436243,
"autogenerated": false,
"ratio": 2.610352264557872,
"con... |
"""acserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | {
"repo_name": "PeteTheAutomator/ACServerManager",
"path": "acserver/urls.py",
"copies": "1",
"size": "1483",
"license": "mit",
"hash": -5065840832467387000,
"line_mean": 43.9393939394,
"line_max": 141,
"alpha_frac": 0.7113958193,
"autogenerated": false,
"ratio": 3.4488372093023254,
"config_test... |
"""ACSE service provider"""
import logging
from typing import TYPE_CHECKING, Optional, Dict, List, cast, Tuple
from pydicom.uid import UID
from pynetdicom import evt, _config
from pynetdicom._globals import APPLICATION_CONTEXT_NAME
from pynetdicom.pdu_primitives import (
A_ASSOCIATE,
A_RELEASE,
A_ABORT,
... | {
"repo_name": "scaramallion/pynetdicom",
"path": "pynetdicom/acse.py",
"copies": "1",
"size": "32783",
"license": "mit",
"hash": -2744636837796871700,
"line_mean": 35.6700223714,
"line_max": 79,
"alpha_frac": 0.5588262209,
"autogenerated": false,
"ratio": 4.3158241179568195,
"config_test": fals... |
"""ACSE service provider"""
import logging
from pynetdicom import evt
from pynetdicom._globals import APPLICATION_CONTEXT_NAME
from pynetdicom.pdu_primitives import (
A_ASSOCIATE, A_RELEASE, A_ABORT, A_P_ABORT,
AsynchronousOperationsWindowNegotiation,
SOPClassCommonExtendedNegotiation,
SOPClassExtende... | {
"repo_name": "scaramallion/pynetdicom3",
"path": "pynetdicom/acse.py",
"copies": "1",
"size": "30789",
"license": "mit",
"hash": -7199124405799586000,
"line_mean": 35.6535714286,
"line_max": 80,
"alpha_frac": 0.5554905973,
"autogenerated": false,
"ratio": 4.351187111362352,
"config_test": fals... |
# acsn2hugo.py -- Convert ACSN entities network to HUGO genes network
#
# jean-daniel.granet@mines-paristech.fr
import sys
import argparse
def main():
# get arguments :
parser = argparse.ArgumentParser(description='Convert ACSN entities network to HUGO genes network')
parser.add_argument('acsn_network_fn... | {
"repo_name": "chagaz/sfan",
"path": "code/acsn2hugo.py",
"copies": "1",
"size": "3033",
"license": "mit",
"hash": 5090370973253340000,
"line_mean": 56.2264150943,
"line_max": 149,
"alpha_frac": 0.6458951533,
"autogenerated": false,
"ratio": 3.4505119453924915,
"config_test": false,
"has_no_k... |
'''acs.py - azurerm functions for the Azure Container Service'''
import json
from .restfns import do_delete, do_get, do_put
from .settings import get_rm_endpoint, ACS_API
def create_container_service(access_token, subscription_id, resource_group, service_name, \
agent_count, agent_vm_size, agent_dns, master_dns, ... | {
"repo_name": "gbowerman/azurerm",
"path": "azurerm/acs.py",
"copies": "1",
"size": "6324",
"license": "mit",
"hash": 3764736169637026000,
"line_mean": 40.6052631579,
"line_max": 97,
"alpha_frac": 0.6225490196,
"autogenerated": false,
"ratio": 4.313778990450205,
"config_test": false,
"has_no_... |
"""ACSTOOLS regression test helpers."""
import os
import pytest
from ci_watson.artifactory_helpers import get_bigdata
from ci_watson.hst_helpers import raw_from_asn, ref_from_image, download_crds
from astropy.io import fits
from astropy.io.fits import FITSDiff
__all__ = ['calref_from_image', 'BaseACSTOOLS']
def c... | {
"repo_name": "jhunkeler/acstools",
"path": "acstools/tests/helpers.py",
"copies": "1",
"size": "7731",
"license": "bsd-3-clause",
"hash": 7093138072615524000,
"line_mean": 34.4633027523,
"line_max": 79,
"alpha_frac": 0.5600827836,
"autogenerated": false,
"ratio": 3.900605449041372,
"config_tes... |
TICK_MOVE = 0.01
TICK_ROTATE = 0.002
GPS_TIME = 1.0
SONAR_TIME = 0.1
FIELD_TIME = 0.1
### Map constants ###
MAP_GOAL = 4 # coding MAP_GOAL
MAP_START_POSITION = 3
SQUARE_SIDE = 1.0
MAP_WALL = 1 # coding MAP_WALL
MAP_WHITE = 0 # coding MAP_WHITE
MAP_SPECIAL_DIRECTION = 11 # coding [MAP_SPECIAL_DIRECTION, DIRECTION]
DI... | {
"repo_name": "uj-robotics/Krakrobot2014Qualifications",
"path": "defines.py",
"copies": "1",
"size": "1698",
"license": "mit",
"hash": -2153198698796782600,
"line_mean": 28.7894736842,
"line_max": 141,
"alpha_frac": 0.6454652532,
"autogenerated": false,
"ratio": 2.769983686786297,
"config_test... |
"""Action Base Classes to do actions on to db."""
class ConnectionAction:
"""Base class for using the session to execute action."""
def __init__(self, connection):
"""Initialise connection."""
self.connection = connection
@property
def session(self):
"""Session of the connecti... | {
"repo_name": "tariqdaouda/pyArango",
"path": "pyArango/action.py",
"copies": "1",
"size": "2392",
"license": "apache-2.0",
"hash": -8419510888283253000,
"line_mean": 30.8933333333,
"line_max": 73,
"alpha_frac": 0.5823578595,
"autogenerated": false,
"ratio": 3.8149920255183414,
"config_test": f... |
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from main_application import Site
import settings
def autodiscover():
"""
Auto-discover INSTALLED_APPS admin.py modules and fail silently ... | {
"repo_name": "jAlpedrinha/DeclRY",
"path": "declry/__init__.py",
"copies": "1",
"size": "1632",
"license": "bsd-3-clause",
"hash": -1028576474429234600,
"line_mean": 33.0208333333,
"line_max": 76,
"alpha_frac": 0.7475490196,
"autogenerated": false,
"ratio": 3.6839729119638824,
"config_test": f... |
"""Action class and helper functions."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
import sys
from schevo.lib import optimize
from schevo.base import Entity, Extent, View
from schevo.introspect import commontype, isselectionmethod
from schevo.label import label
DEFAULT_T_METHODS = ['clo... | {
"repo_name": "Schevo/schevogtk",
"path": "schevogtk2/action.py",
"copies": "1",
"size": "5499",
"license": "mit",
"hash": 4450006716803458000,
"line_mean": 30.0677966102,
"line_max": 79,
"alpha_frac": 0.5811965812,
"autogenerated": false,
"ratio": 4.119101123595506,
"config_test": false,
"ha... |
ACTION_CREATE = 0
ACTION_VIEW = 1
ACTION_UPDATE = 2
ACTION_DELETE = 3
ACTIONS = {
ACTION_CREATE: 'Create',
ACTION_VIEW: 'View',
ACTION_UPDATE: 'Update',
ACTION_DELETE: 'Delete',
}
STATIC = 'st'
DYNAMIC = 'dy'
LEVEL_GUEST = 0
LEVEL_USER = 1
LEVEL_ADMIN = 2
LEVELS = {
LEVEL_GUEST: 'Guest',
LEV... | {
"repo_name": "murrown/cyder",
"path": "cyder/base/constants.py",
"copies": "1",
"size": "3613",
"license": "bsd-3-clause",
"hash": 1569970905253723100,
"line_mean": 34.4215686275,
"line_max": 79,
"alpha_frac": 0.6460005536,
"autogenerated": false,
"ratio": 3.1335646140503037,
"config_test": fa... |
"""action_feedback model."""
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from apps.widgets.smartgrid.models import Action
from apps.managers.challenge_mgr import challenge_mgr
from apps.admin.admin import challenge_designer_site, challenge_manager_site, de... | {
"repo_name": "vijayanandau/KnowledgeShare",
"path": "makahiki/apps/widgets/ReturnAnswer/models.py",
"copies": "1",
"size": "1320",
"license": "mit",
"hash": -5163270401571447000,
"line_mean": 40.25,
"line_max": 92,
"alpha_frac": 0.6946969697,
"autogenerated": false,
"ratio": 4.036697247706422,
... |
"""Action functions to be taken in response to events."""
import re
# pylint: disable-msg=W0613
def call_notification(modem, message):
"""Execute when someone is calling."""
print('Someone is calling')
def null_action(modem, message):
"""Take no action."""
pass
def rssi_update(modem, message):
"... | {
"repo_name": "oozie/pyhumod",
"path": "humod/actions.py",
"copies": "1",
"size": "2285",
"license": "bsd-3-clause",
"hash": 4282779385101633500,
"line_mean": 37.7288135593,
"line_max": 78,
"alpha_frac": 0.5693654267,
"autogenerated": false,
"ratio": 3.178025034770515,
"config_test": false,
"... |
"""Action Geneator API.
From information about theorem prover's state, generate a set of possible
actions to take in the prover.
"""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import collections
import numpy as np
import scipy... | {
"repo_name": "tensorflow/deepmath",
"path": "deepmath/deephol/action_generator.py",
"copies": "1",
"size": "14678",
"license": "apache-2.0",
"hash": -7636460593149942000,
"line_mean": 39.3241758242,
"line_max": 79,
"alpha_frac": 0.6625562066,
"autogenerated": false,
"ratio": 3.4463489081944116,
... |
ACTION_IDENTIFIER = "_ACTION"
KEY_IDENTIFIER = "_KEY"
# - Action Types:
LOAD_URL_ACTION = "load_url"
CLICK_ACTION = "click"
CLICK_ELEMENT_WITH_OFFSET_ACTION = "click_element_with_offset"
HOVER_ACTION = "hover"
SCROLL_AN_ELEMENT_ACTION = "scroll_an_element"
REFRESH_ACTION = "refresh"
ENTER_TEXT_ACTION = "enter_text"
SE... | {
"repo_name": "meltmedia/the-ark",
"path": "the_ark/resources/action_constants.py",
"copies": "1",
"size": "1786",
"license": "apache-2.0",
"hash": -1829212935552600300,
"line_mean": 30.350877193,
"line_max": 80,
"alpha_frac": 0.7250839866,
"autogenerated": false,
"ratio": 2.790625,
"config_tes... |
__actionname__ = 'bats eyelashes :lips:'
from sys import argv
from Character import Character, get_data
from dice import d6, check
import private
import slacker
def main(argv):
slack = slacker.Slacker(private.sixthWorld)
charactername = argv[0]
difficulty = argv[1]
channelname = argv[2]
modif... | {
"repo_name": "jtrip/slackrun",
"path": "charm.py",
"copies": "1",
"size": "1542",
"license": "bsd-2-clause",
"hash": -1953781138456815900,
"line_mean": 24.2786885246,
"line_max": 148,
"alpha_frac": 0.5648508431,
"autogenerated": false,
"ratio": 3.5944055944055946,
"config_test": false,
"has_... |
'''Action'''
from src.constants import Constants as C
import sys
import logging as log
class Action(object):
'''Action'''
def __init__(self, server, node):
'''Init '''
self.server = server
self.node = node
self.actions = None
def get_pending(self):
'''Get Pendin... | {
"repo_name": "CloudWorkers/cloudworker",
"path": "node/src/action.py",
"copies": "1",
"size": "1863",
"license": "apache-2.0",
"hash": -5341945600510341000,
"line_mean": 24.875,
"line_max": 80,
"alpha_frac": 0.5877616747,
"autogenerated": false,
"ratio": 4.0588235294117645,
"config_test": fals... |
"""Action"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import skimage.transform
from scipy.misc import imread, imresize
from PIL import Image
class Action:
def __init__(self):
super(Action, self).__init__()
# sets ... | {
"repo_name": "MegaShow/college-programming",
"path": "Homework/Principles of Artificial Neural Networks/Week 15 Image Caption/src/action.py",
"copies": "1",
"size": "7605",
"license": "mit",
"hash": 1808548475207819800,
"line_mean": 35.9174757282,
"line_max": 123,
"alpha_frac": 0.5662064431,
"auto... |
"""Action Preparation:
Functions to prepare a source code fragment to be sticked into the
lexical analyzer. This includes the following:
-- pattern matches:
(optional) line and column counting based on the character
content of the lexeme. Many times, the character or line
number ... | {
"repo_name": "coderjames/pascal",
"path": "quex-0.63.1/quex/output/cpp/action_preparation.py",
"copies": "1",
"size": "12720",
"license": "bsd-2-clause",
"hash": 1869354137626608000,
"line_mean": 42.8620689655,
"line_max": 122,
"alpha_frac": 0.6286163522,
"autogenerated": false,
"ratio": 3.79814... |
# action.py
# ---------
from game import *
class Action(object):
'''
An Action object would basically be used to formalize moves
defined by a paticular piece and it's new position.
It will be used to determine whether an action is feasable in terms of
collisions etc. or not and whether an action involves a ca... | {
"repo_name": "AhanM/ChessAI",
"path": "action.py",
"copies": "1",
"size": "1274",
"license": "mit",
"hash": 7276196274153970000,
"line_mean": 25.0204081633,
"line_max": 76,
"alpha_frac": 0.7064364207,
"autogenerated": false,
"ratio": 3.192982456140351,
"config_test": false,
"has_no_keywords"... |
"""Actions defined for Java Web Applications that are installed into
Tomcat.
"""
import os
import os.path
import urllib
import fixup_python_path
from engage.drivers.action import *
from engage.drivers.action import _check_file_exists
import engage.utils.http as httputils
import engage.utils.log_setup
logger = engage.... | {
"repo_name": "quaddra/engage",
"path": "python_pkg/engage/drivers/genforma/tomcat_utils.py",
"copies": "1",
"size": "16336",
"license": "apache-2.0",
"hash": -3056628846791111700,
"line_mean": 38.2692307692,
"line_max": 172,
"alpha_frac": 0.5528893242,
"autogenerated": false,
"ratio": 3.81503970... |
""" Action set for the Oracl plugin
"""
# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and
# University Hospital Center and University of Lausanne (UNIL-CHUV)
#
# Modified BSD License
# Enthought library imports
from envisage.ui.action.api import Action, Group, Menu, ToolBar
from envisage.... | {
"repo_name": "LTS5/connectomeviewer",
"path": "cviewer/plugins/codeoracle/oracle_action_set.py",
"copies": "1",
"size": "4159",
"license": "bsd-3-clause",
"hash": 1327801376618059800,
"line_mean": 31.7480314961,
"line_max": 80,
"alpha_frac": 0.6301995672,
"autogenerated": false,
"ratio": 3.50674... |
"""Actions for aws_cdn plugin"""
from __future__ import absolute_import, division, print_function, with_statement, unicode_literals
# Module for generating hashes for files that match a glob, and putting that
# hash in redis to allow us to generate cache-busting URLs later
import os
import oz
import oz.redis
import ... | {
"repo_name": "dailymuse/oz",
"path": "oz/aws_cdn/actions.py",
"copies": "1",
"size": "1493",
"license": "bsd-3-clause",
"hash": 5309358225404943000,
"line_mean": 30.7659574468,
"line_max": 101,
"alpha_frac": 0.6222371065,
"autogenerated": false,
"ratio": 3.7989821882951653,
"config_test": fals... |
"""Actions for the help menu """
# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and
# University Hospital Center and University of Lausanne (UNIL-CHUV)
#
# Modified BSD License
# Enthought library imports
from pyface.action.api import Action
from traitsui.api import auto_close_message
from ... | {
"repo_name": "LTS5/connectomeviewer",
"path": "cviewer/action/help.py",
"copies": "1",
"size": "3301",
"license": "bsd-3-clause",
"hash": 3500136555899027000,
"line_mean": 36.5113636364,
"line_max": 103,
"alpha_frac": 0.518024841,
"autogenerated": false,
"ratio": 4.610335195530726,
"config_tes... |
"""Actions for the help menu.
"""
# Authors: Gael Varoquaux <gael.varoquaux[at]normalesup.org>
# Prabhu Ramachandran
# Copyright (c) 2007-2008, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
from os import path
import os
import sys
from os.path import join, dirname
# Enthought library imp... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/action/help.py",
"copies": "3",
"size": "3424",
"license": "bsd-3-clause",
"hash": 4324595490206150000,
"line_mean": 31.6095238095,
"line_max": 79,
"alpha_frac": 0.5286214953,
"autogenerated": false,
"ratio": 4.36734693877551,
"config_test": false... |
# Actions implemented:
# Income
# Foreign Aid
# Coup
# Duke
# Captain
# Contessa
# Assassin
# Ambassador
# Hardcoded value
# ForceCoupCoins
from core.errors import *
from core.game import GameState
ForceCoupCoins = 10
class Action:
name = ""
description = ""
blocks = []
hasTarget =... | {
"repo_name": "MrValdez/Coup",
"path": "core/action.py",
"copies": "1",
"size": "5100",
"license": "mit",
"hash": 2853695046839659500,
"line_mean": 27.813559322,
"line_max": 109,
"alpha_frac": 0.5690196078,
"autogenerated": false,
"ratio": 4.153094462540716,
"config_test": false,
"has_no_keyw... |
Actions = []
States = {}
Observations = {}
ObservationGenerators = {}
class Action:
def __init__(self):
Actions.append(self)
def __hash__(cls):
return cls.__name__
__hash__ = classmethod(__hash__)
def __str__(cls):
return cls.__name__
__str__ = classmethod(__str__)
def a... | {
"repo_name": "ronaldahmed/SLAM-for-ugv",
"path": "neural-navigation-with-lstm/MARCO/POMDP/MakePOMDP.py",
"copies": "2",
"size": "3504",
"license": "mit",
"hash": -5906448197699598000,
"line_mean": 34.3939393939,
"line_max": 94,
"alpha_frac": 0.6247146119,
"autogenerated": false,
"ratio": 3.89333... |
# actions.py
from .exceptions import ParseException
from .util import col
def matchOnlyAtCol(n):
"""Helper method for defining parse actions that require matching at
a specific column in the input text.
"""
def verifyCol(strg, locn, toks):
if col(locn, strg) != n:
raise ParseExce... | {
"repo_name": "InsightSoftwareConsortium/ITKExamples",
"path": "Utilities/SphinxExtensions/pyparsing/actions.py",
"copies": "1",
"size": "5511",
"license": "apache-2.0",
"hash": 5097759077399753000,
"line_mean": 31.8035714286,
"line_max": 120,
"alpha_frac": 0.6007984032,
"autogenerated": false,
"... |
# actions.py
from pyparsing.exceptions import ParseException
from pyparsing.util import col
def matchOnlyAtCol(n):
"""Helper method for defining parse actions that require matching at
a specific column in the input text.
"""
def verifyCol(strg, locn, toks):
if col(locn, strg) != n:
... | {
"repo_name": "chadmv/cmt",
"path": "scripts/pyparsing/actions.py",
"copies": "1",
"size": "5529",
"license": "mit",
"hash": -5790417384529129000,
"line_mean": 31.9107142857,
"line_max": 120,
"alpha_frac": 0.6020980286,
"autogenerated": false,
"ratio": 3.9719827586206895,
"config_test": false,
... |
"""Actions that can be performed on the data.
An action receives a mongodb cursor and argparse args."""
from __future__ import unicode_literals, print_function
from . import PPMongoError
from . import analyze as analyzing
from . import printing
def pprint(cursor, args):
"Pretty-print the documents"
for i, ... | {
"repo_name": "anossov/ppmongo",
"path": "ppmongo/actions.py",
"copies": "1",
"size": "1172",
"license": "bsd-2-clause",
"hash": 7127665520776027000,
"line_mean": 23.9361702128,
"line_max": 62,
"alpha_frac": 0.6220136519,
"autogenerated": false,
"ratio": 4.156028368794326,
"config_test": false,... |
"""Actions to run at server startup.
"""
from django.db import connection
from django.db import transaction
from south.migration import Migrations
from south.models import MigrationHistory
def run():
"""Call this from manage.py or tests.
"""
_add_custom_mult_agg_function()
# TODO: This breaks test_p... | {
"repo_name": "woodymit/millstone",
"path": "genome_designer/main/startup.py",
"copies": "1",
"size": "1948",
"license": "mit",
"hash": 7501458258816659000,
"line_mean": 31.4666666667,
"line_max": 78,
"alpha_frac": 0.5959958932,
"autogenerated": false,
"ratio": 4.016494845360825,
"config_test":... |
"""Actions to run at server startup.
"""
from django.db import connection
from django.db import transaction
def run():
"""Call this from manage.py or tests.
"""
_add_custom_mult_agg_function()
def _add_custom_mult_agg_function():
"""Make sure the Postgresql database has a custom function array_agg_... | {
"repo_name": "woodymit/millstone_accidental_source",
"path": "genome_designer/main/startup.py",
"copies": "1",
"size": "1068",
"license": "mit",
"hash": 2299502963721795300,
"line_mean": 27.8648648649,
"line_max": 78,
"alpha_frac": 0.5767790262,
"autogenerated": false,
"ratio": 3.800711743772242... |
"""Actions to run at server startup.
"""
import subprocess
import sys
from django.db import connection
from django.db import transaction
from south.migration import Migrations
from south.models import MigrationHistory
def run():
"""Call this from manage.py or tests.
"""
_add_custom_mult_agg_function()
... | {
"repo_name": "churchlab/millstone",
"path": "genome_designer/main/startup.py",
"copies": "1",
"size": "2343",
"license": "mit",
"hash": 1517269235994348500,
"line_mean": 29.0384615385,
"line_max": 78,
"alpha_frac": 0.6022193769,
"autogenerated": false,
"ratio": 4.110526315789474,
"config_test"... |
"""Actions to save and load a MayaVi2 visualization file.
"""
# Author: Prabhu Ramachandran <prabhu@enthought.com>
# Copyright (c) 2005-2015, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
import sys
from os.path import isfile
# Enthought library imports.
from pyface.api import FileDialog, OK
from... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/action/save_load.py",
"copies": "1",
"size": "4529",
"license": "bsd-3-clause",
"hash": 5728941892957500000,
"line_mean": 36.7416666667,
"line_max": 79,
"alpha_frac": 0.4524177523,
"autogenerated": false,
"ratio": 5.083052749719417,
"config_test":... |
"""Actions to save and load a MayaVi2 visualization file.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
import sys
from os.path import isfile
# Enthought library imports.
from pyface.api import FileDialog, OK
from pyf... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/action/save_load.py",
"copies": "2",
"size": "4447",
"license": "bsd-3-clause",
"hash": -2376420760774065700,
"line_mean": 36.3697478992,
"line_max": 79,
"alpha_frac": 0.4535642006,
"autogenerated": false,
"ratio": 5.07648401826484,
"confi... |
"""Actions to start various filters.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
from pyface.action.api import Action
from traits.api import Instance
from mayavi.plugins.script import get_imayavi
from mayavi.core.registry import registry
f... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/action/filters.py",
"copies": "2",
"size": "2410",
"license": "bsd-3-clause",
"hash": -322979925196029200,
"line_mean": 32.9436619718,
"line_max": 79,
"alpha_frac": 0.5390041494,
"autogenerated": false,
"ratio": 4.679611650485437,
"config_test": f... |
"""Actions to start various filters.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
import new
from pyface.action.api import Action
from traits.api import Instance
from mayavi.plugins.script import get_imayavi
from mayavi.core.registry impor... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/action/filters.py",
"copies": "2",
"size": "2251",
"license": "bsd-3-clause",
"hash": -6005527612318811000,
"line_mean": 32.1029411765,
"line_max": 79,
"alpha_frac": 0.5353176366,
"autogenerated": false,
"ratio": 4.748945147679325,
"config_test": ... |
"""Actions to start various modules.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
import new
# Local imports.
from mayavi.core.registry import registry
from mayavi.core.metadata import ModuleMetadata
from mayavi.core.pipeline_info import P... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/action/modules.py",
"copies": "2",
"size": "2530",
"license": "bsd-3-clause",
"hash": 353088184930345200,
"line_mean": 35.1428571429,
"line_max": 79,
"alpha_frac": 0.5059288538,
"autogenerated": false,
"ratio": 5.184426229508197,
"config_test": fa... |
"""Actions to start various modules.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2015, Enthought, Inc.
# License: BSD Style.
# Local imports.
from mayavi.core.registry import registry
from mayavi.core.metadata import ModuleMetadata
from mayavi.core.pipeline_info import PipelineInfo
... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/action/modules.py",
"copies": "2",
"size": "2525",
"license": "bsd-3-clause",
"hash": -9163397943547308000,
"line_mean": 36.6865671642,
"line_max": 79,
"alpha_frac": 0.5053465347,
"autogenerated": false,
"ratio": 5.184804928131417,
"config_test": ... |
"""actions to use
"""
import sftoolbox.utils
import os
import sys
import uuid
import imp
import sftoolbox
class Action(object):
"""base implmentation of an action
"""
json_type = 'action'
def __init__(self, project):
"""construct the action
"""
project.add(self)
self... | {
"repo_name": "svenfraeys/sftoolbox",
"path": "sftoolbox/actions.py",
"copies": "1",
"size": "5759",
"license": "mit",
"hash": -1954336834356285200,
"line_mean": 24.9414414414,
"line_max": 76,
"alpha_frac": 0.5879492968,
"autogenerated": false,
"ratio": 4.047083626141954,
"config_test": false,
... |
"""Actions triggered on various signals.
"""
import web
from . import account, signals
from .sendmail import sendmail_with_template
from .models import Activity
def record_activity(name, info):
user = account.get_current_user()
Activity.new(name, user, info)
@signals.trainer_signup.connect
def activity_traine... | {
"repo_name": "anandology/broadgauge",
"path": "broadgauge/actions.py",
"copies": "2",
"size": "2447",
"license": "bsd-3-clause",
"hash": -1327422437383426800,
"line_mean": 29.6,
"line_max": 69,
"alpha_frac": 0.701675521,
"autogenerated": false,
"ratio": 3.5007153075822606,
"config_test": false... |
# actionsystem.py
#
# A bunch of rule tables for handling what to do with actions in the
# game. These are assumed to be used in a player context.
from textadv.core.patterns import BasicPattern
from textadv.core.rulesystem import ActivityTable, RuleTable, AbortAction, make_rule_decorator
from textadv.gamesystem.utili... | {
"repo_name": "kmill/textadv",
"path": "textadv/gamesystem/actionsystem.py",
"copies": "1",
"size": "11480",
"license": "mit",
"hash": 2496144328583574500,
"line_mean": 43.6692607004,
"line_max": 107,
"alpha_frac": 0.6232578397,
"autogenerated": false,
"ratio": 3.8536421617992613,
"config_test"... |
"""Activate and deactivate a wmt-exe environment."""
from __future__ import print_function
import sys
import os
from ..env import WmtEnvironment
_ACTIVATE_SCRIPT = """
# This file must be used with "source wmt-activate" *from bash*
# you cannot run it directly
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
has... | {
"repo_name": "csdms/wmt-exe",
"path": "wmtexe/cmd/activate.py",
"copies": "1",
"size": "3415",
"license": "mit",
"hash": -8818463121232699000,
"line_mean": 22.3904109589,
"line_max": 77,
"alpha_frac": 0.5991215227,
"autogenerated": false,
"ratio": 3.4918200408997957,
"config_test": false,
"h... |
"""Activate coverage at python startup if appropriate.
The python site initialisation will ensure that anything we import
will be removed and not visible at the end of python startup. However
we minimise all work by putting these init actions in this separate
module and only importing what is needed when needed.
For... | {
"repo_name": "pytest-dev/pytest-cov",
"path": "src/pytest_cov/embed.py",
"copies": "1",
"size": "3983",
"license": "mit",
"hash": -518753904982576260,
"line_mean": 27.45,
"line_max": 117,
"alpha_frac": 0.6590509666,
"autogenerated": false,
"ratio": 4.007042253521127,
"config_test": true,
"ha... |
# Activate Python venv for the script - uncomment to run script on commandline
activate_this_file = "/path/to/bin/activate_this.py"
execfile(activate_this_file, dict(__file__ = activate_this_file))
import cx_Oracle
import argparse
import sys
import csv
from tqdm import tqdm
sys.path.insert(0, '/path/to/gwas_data_sour... | {
"repo_name": "EBISPOT/goci",
"path": "goci-python-scripts/gwas-event-data-curation/baseline_metrics_data.py",
"copies": "1",
"size": "11558",
"license": "apache-2.0",
"hash": -5458130713786899000,
"line_mean": 35.8089171975,
"line_max": 145,
"alpha_frac": 0.585308877,
"autogenerated": false,
"ra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.