text stringlengths 0 1.05M | meta dict |
|---|---|
# Aravind Kumar - aravind@arvizard.com
import maya.cmds as cmds
def main():
"""
This function switches between stereo cameras in the scene. The requirement is that the cameras be grouped or named with the words left, right, _lt or _rt.
The zoom and pan attributes are also replicated.
"""
panel = ... | {
"repo_name": "arvizard1/vfxTools",
"path": "vizTools/stereoSwitch.py",
"copies": "1",
"size": "2227",
"license": "mit",
"hash": 7034216715824322000,
"line_mean": 46.4042553191,
"line_max": 159,
"alpha_frac": 0.620116749,
"autogenerated": false,
"ratio": 3.603559870550162,
"config_test": false,... |
# Aravind Kumar - aravind@arvizard.com
import maya.cmds as cmds
def main(change_by=0):
"""
This function shifts animation of selected
objects based on the number of frames
by the user.
:param change_by: The offset value for shifting animation
:return: None
"""
selected_objects = cmds... | {
"repo_name": "arvizard1/vfxTools",
"path": "vizTools/shiftAnimation.py",
"copies": "1",
"size": "1118",
"license": "mit",
"hash": -2322583077349957000,
"line_mean": 30.9714285714,
"line_max": 85,
"alpha_frac": 0.5805008945,
"autogenerated": false,
"ratio": 4.125461254612546,
"config_test": fal... |
"""
Command to train red/blue classifiers from the command line.
"""
##########################################################################
## Imports
##########################################################################
import numpy as np
from datetime import datetime
from arbiter.models import Estimator,... | {
"repo_name": "DistrictDataLabs/partisan-discourse",
"path": "arbiter/management/commands/train.py",
"copies": "1",
"size": "9715",
"license": "apache-2.0",
"hash": -6369423229458772000,
"line_mean": 36.0801526718,
"line_max": 93,
"alpha_frac": 0.5615028307,
"autogenerated": false,
"ratio": 4.886... |
"""
Model definitions for the arbiter app.
"""
##########################################################################
## Imports
##########################################################################
from django.db import models
from model_utils import Choices
from partisan.utils import nullable
from model_u... | {
"repo_name": "DistrictDataLabs/partisan-discourse",
"path": "arbiter/models.py",
"copies": "1",
"size": "3479",
"license": "apache-2.0",
"hash": -3879845800791368000,
"line_mean": 35.2395833333,
"line_max": 106,
"alpha_frac": 0.5763150331,
"autogenerated": false,
"ratio": 4.0642523364485985,
"... |
""" Arbitrage tools
Tools for determining the
"""
import os
from decimal import Decimal
import pandas as pd
# Removed as it complicates the bot on server deploys (?)
# import seaborn as sns
# sns.set_context(font_scale=1.1)
KRAKEN_API_KEY = os.environ.get('KRAKEN_API_KEY')
KRAKEN_PRIVATE_KEY = os.environ.get('KRAK... | {
"repo_name": "jr-minnaar/bitrader",
"path": "bitrader/arbitrage_tools.py",
"copies": "1",
"size": "13425",
"license": "mit",
"hash": 6002935298190810000,
"line_mean": 31.1172248804,
"line_max": 146,
"alpha_frac": 0.5777281192,
"autogenerated": false,
"ratio": 3.2537566650508967,
"config_test":... |
# Arbitrary allocations in target memory.
# This module should be included by the module that 'owns' the allocation only.
# Global scratchpad memory. This is the address of the biggest safest area of
# read-write-execute RAM we can guesstimate about. This is provided as a
# default location for the backdoor commands ... | {
"repo_name": "scanlime/coastermelt",
"path": "backdoor/target_memory.py",
"copies": "1",
"size": "1196",
"license": "mit",
"hash": 1923228530781052200,
"line_mean": 30.4736842105,
"line_max": 79,
"alpha_frac": 0.7617056856,
"autogenerated": false,
"ratio": 3.1556728232189974,
"config_test": fa... |
"""Arbitrary expressions evaluated as an AST."""
from operator import and_
from operator import not_
from operator import or_
from operator import xor
# Abstract base classes for nodes.
class BaseNode(object):
"""Abstract base class for permission nodes."""
# Unary operators.
def __invert__(self):
... | {
"repo_name": "counsyl/baya",
"path": "baya/membership.py",
"copies": "1",
"size": "6826",
"license": "mit",
"hash": 6787221984090379000,
"line_mean": 29.6098654709,
"line_max": 79,
"alpha_frac": 0.5890711984,
"autogenerated": false,
"ratio": 4.205791743684535,
"config_test": false,
"has_no_k... |
'''arbitrary recursions copy registry
'''
from __future__ import with_statement
from __future__ import absolute_import
from collections import defaultdict
from .func import identity, noop, compose
from .ctxsingleton import CtxSingleton
from .multimethod import MultiMethod, defmethod
from .atypes import as_optimized_... | {
"repo_name": "matthagy/Jamenson",
"path": "jamenson/runtime/copy.py",
"copies": "1",
"size": "2756",
"license": "apache-2.0",
"hash": 612613344360404900,
"line_mean": 24.5185185185,
"line_max": 90,
"alpha_frac": 0.6407837446,
"autogenerated": false,
"ratio": 3.3982737361282367,
"config_test": ... |
'''arbitrary recursions data structure tear down
'''
from __future__ import with_statement
from __future__ import absolute_import
from collections import defaultdict
from .func import identity, noop, compose
from .ctxsingleton import CtxSingleton
from .multimethod import MultiMethod, defmethod
from .atypes import an... | {
"repo_name": "matthagy/Jamenson",
"path": "jamenson/runtime/delete.py",
"copies": "1",
"size": "2184",
"license": "apache-2.0",
"hash": -1533946602976344800,
"line_mean": 24.6941176471,
"line_max": 78,
"alpha_frac": 0.6785714286,
"autogenerated": false,
"ratio": 3.562805872756933,
"config_test... |
"""Arcam component."""
import asyncio
import logging
from arcam.fmj import ConnectionFailed
from arcam.fmj.client import Client
import async_timeout
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
import homeassistant.helpers.config_validation as... | {
"repo_name": "balloob/home-assistant",
"path": "homeassistant/components/arcam_fmj/__init__.py",
"copies": "12",
"size": "3292",
"license": "apache-2.0",
"hash": 3082602372841238000,
"line_mean": 27.6260869565,
"line_max": 88,
"alpha_frac": 0.6534021871,
"autogenerated": false,
"ratio": 3.990303... |
"""Arcam component."""
import logging
import asyncio
import voluptuous as vol
import async_timeout
from arcam.fmj.client import Client
from arcam.fmj import ConnectionFailed
from homeassistant import config_entries
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import HomeAssis... | {
"repo_name": "jabesq/home-assistant",
"path": "homeassistant/components/arcam_fmj/__init__.py",
"copies": "1",
"size": "4619",
"license": "apache-2.0",
"hash": -8597610681772405000,
"line_mean": 25.2443181818,
"line_max": 77,
"alpha_frac": 0.5875730678,
"autogenerated": false,
"ratio": 3.9277210... |
"""Arcam media player."""
import logging
from typing import Optional
from arcam.fmj import DecodeMode2CH, DecodeModeMCH, IncomingAudioFormat, SourceCodes
from arcam.fmj.state import State
from homeassistant import config_entries
from homeassistant.components.media_player import MediaPlayerDevice
from homeassistant.co... | {
"repo_name": "postlund/home-assistant",
"path": "homeassistant/components/arcam_fmj/media_player.py",
"copies": "3",
"size": "9529",
"license": "apache-2.0",
"hash": 6663209923765150000,
"line_mean": 28.32,
"line_max": 88,
"alpha_frac": 0.5797040613,
"autogenerated": false,
"ratio": 4.1215397923... |
"""Arcam media player."""
import logging
from arcam.fmj import DecodeMode2CH, DecodeModeMCH, IncomingAudioFormat, SourceCodes
from arcam.fmj.state import State
from homeassistant import config_entries
from homeassistant.components.media_player import BrowseMedia, MediaPlayerEntity
from homeassistant.components.media_... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/arcam_fmj/media_player.py",
"copies": "2",
"size": "11804",
"license": "apache-2.0",
"hash": -5845491601942128000,
"line_mean": 28.1456790123,
"line_max": 93,
"alpha_frac": 0.560149102,
"autogenerated": false,
"ratio... |
import sys, os, re
import numpy as np
import hashlib
import datetime as dt
try: from collections import OrderedDict
except ImportError:
try: from ordereddict import OrderedDict
except ImportError:
print "Require OrderedDict, https://pypi.python.org/pypi/ordereddict"
raise
import netcdf_builder... | {
"repo_name": "KimberleyOpie/common-tools",
"path": "formats_to_nc/arcasciigrid_to_flt.py",
"copies": "1",
"size": "9782",
"license": "apache-2.0",
"hash": -3643298465307606500,
"line_mean": 34.8315018315,
"line_max": 102,
"alpha_frac": 0.6287057861,
"autogenerated": false,
"ratio": 3.55063520871... |
#arc consistency implementation with backtracking
from sys import stdout
from util import Queue as queue
import copy
def solve(string):
variables = stringToVariables(string)
assignment = {k:v[0] for k,v in variables.items() if len(v)==1 }
prettyPrint(backtrackingSearch(variables, assignment))
def initial... | {
"repo_name": "lucasosouza/berkeleyAI",
"path": "project1b/sudokuALG3.py",
"copies": "1",
"size": "4071",
"license": "mit",
"hash": -1677333620628000500,
"line_mean": 36.0654205607,
"line_max": 345,
"alpha_frac": 0.7121100467,
"autogenerated": false,
"ratio": 3.4210084033613444,
"config_test": ... |
import sys, os, re
import numpy as np
import hashlib
import datetime as dt
try: from collections import OrderedDict
except ImportError:
try: from ordereddict import OrderedDict
except ImportError:
print "Require OrderedDict, https://pypi.python.org/pypi/ordereddict"
raise
import netcdf_builder ... | {
"repo_name": "KimberleyOpie/common-tools",
"path": "formats_to_nc/arcfltgrid_to_nc.py",
"copies": "1",
"size": "13347",
"license": "apache-2.0",
"hash": -5666187221671238000,
"line_mean": 37.5751445087,
"line_max": 239,
"alpha_frac": 0.657600959,
"autogenerated": false,
"ratio": 3.50683131897004... |
ARCGIS=False
try:
import arcpy
ARCGIS=True
except:
ARCGIS=False
import os
from osgeo import ogr
from osgeo import osr
import shutil
import tempfile
import logging
class Toolbox(object):
"""Some nasty ArcGIS class
"""
def __init__(self):
"""Define the toolbox (the name of the toolbox is... | {
"repo_name": "datastory/Data-Tools-for-ArcGIS",
"path": "Service Geometry Downloader.py",
"copies": "2",
"size": "10287",
"license": "mit",
"hash": 1727112618717945300,
"line_mean": 28.3076923077,
"line_max": 107,
"alpha_frac": 0.6360454943,
"autogenerated": false,
"ratio": 3.744812522752093,
... |
"""ArcGIS Geoprocessing module for Scanweb data
"""
from __future__ import print_function, unicode_literals, absolute_import, division
import os.path
import re
import arcpy
from .. import get_scanweb
from ... import _DEFAULT_ACCESS_CODE
from ...gp import TABLE_DEFS_DICT_DICT
WEATHER_READINGS_TABLE_NAME = "ScanwebWeat... | {
"repo_name": "WSDOT-GIS/wsdot-traffic-gp",
"path": "wsdottraffic/scanweb/gp/__init__.py",
"copies": "1",
"size": "6946",
"license": "unlicense",
"hash": 8132495767387268000,
"line_mean": 39.8588235294,
"line_max": 112,
"alpha_frac": 0.5948747481,
"autogenerated": false,
"ratio": 4.00576701268742... |
""" ArcGIS python toolboxes for ``propagator``.
This contains Classes compatible with ArcGIS python toolbox
infrastructure.
(c) Geosyntec Consultants, 2015.
Released under the BSD 3-clause license (see LICENSE file for more info)
Written by Paul Hobson (phobson@geosyntec.com)
"""
from functools import partial
fr... | {
"repo_name": "gcfang/python-propagator",
"path": "propagator/toolbox.py",
"copies": "2",
"size": "22047",
"license": "bsd-3-clause",
"hash": 6078687056194891000,
"line_mean": 33.3411214953,
"line_max": 104,
"alpha_frac": 0.5993559214,
"autogenerated": false,
"ratio": 4.177150435771125,
"config... |
""" ArcGIS python toolboxes for python-tidegates.
This contains Classes compatible with ArcGIS python toolbox
infrastructure.
(c) Geosyntec Consultants, 2015.
Released under the BSD 3-clause license (see LICENSE file for more info)
Written by Paul Hobson (phobson@geosyntec.com)
"""
import os
from textwrap import... | {
"repo_name": "Geosyntec/python-tidegates",
"path": "tidegates/toolbox.py",
"copies": "1",
"size": "28613",
"license": "bsd-3-clause",
"hash": 6415376307750490000,
"line_mean": 30.3739035088,
"line_max": 108,
"alpha_frac": 0.5479327578,
"autogenerated": false,
"ratio": 4.538144329896907,
"confi... |
#ArcGIS Server 10.1 service editor
#view your service properties at: http://[your server URL]/arcgis/admin/services/
#put a ?f=json at the end of a service name to see the json properties -
#the JSON is what is being edited here
#Loops through the services in a particular folder and edits the
#listSupportedCRS property... | {
"repo_name": "usgin/AddEPSG3857PrjArcServer",
"path": "AddEPSG3857Projection101.py",
"copies": "1",
"size": "7623",
"license": "mit",
"hash": -6994348278446689000,
"line_mean": 39.3333333333,
"line_max": 137,
"alpha_frac": 0.5697232061,
"autogenerated": false,
"ratio": 4.797356828193832,
"conf... |
archers = {4, 5, 24, 39, 474, 492}
arows = {54, 97, 245, 246, 315, 316, 317,
318, 319, 320, 321, 322, 328, 360, 363,
364, 367, 372, 375, 378, 381, 385, 466,
470, 471, 475, 476, 477, 478, 485, 503,
504, 505, 507, 509, 510, 511, 512, 514,
516, 517, 518, 519, 521, 522, 523, 524,
525, 537, 538, 540,... | {
"repo_name": "dderevjanik/agescx",
"path": "agescx/groups/groups.py",
"copies": "1",
"size": "4493",
"license": "mit",
"hash": -7677254699939410000,
"line_mean": 43.4851485149,
"line_max": 54,
"alpha_frac": 0.5464055197,
"autogenerated": false,
"ratio": 1.8894028595458368,
"config_test": false... |
#arch -i386 python
import Skype4Py
import time
import re
import os
import glob
import sys
# import all the reponse classes from the reponses folder
os.chdir("responses")
sys.path.append(os.getcwd())
response_modules = [n[:-3] for n in glob.glob("*.py") if n[0] != '_']
#print response_modules
module_dict = {}
for mo... | {
"repo_name": "james-huang/sk_skype_bot",
"path": "SKSkypeBot.py",
"copies": "1",
"size": "2276",
"license": "mit",
"hash": -6642915616393689000,
"line_mean": 26.756097561,
"line_max": 99,
"alpha_frac": 0.6234622144,
"autogenerated": false,
"ratio": 3.347058823529412,
"config_test": false,
"h... |
# architect.py -- the source code to diagram designer/editor
import sys, re, dia, shelve
from pprint import pprint
def create_block_group(block_list):
grp = []
conn_dict = {}
# create block group
x = 100
y = 0
for block in block_list:
# pprint(block)
object_type = dia.get_... | {
"repo_name": "liunx/MachineLearn",
"path": "dia/architect.py",
"copies": "1",
"size": "3466",
"license": "mit",
"hash": 7192325591859079000,
"line_mean": 29.6725663717,
"line_max": 124,
"alpha_frac": 0.5877091748,
"autogenerated": false,
"ratio": 3.452191235059761,
"config_test": false,
"has... |
""" Architecture description for web assembly """
from .. import ir
from ..arch.arch import VirtualMachineArchitecture
from ..arch.stack import FramePointerLocation
from ..arch.registers import Register, RegisterClass
from ..arch.arch_info import ArchInfo, TypeInfo
# Define 'registers' that are actually wasm local v... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/wasm/arch.py",
"copies": "1",
"size": "1792",
"license": "bsd-2-clause",
"hash": 3159779105112243700,
"line_mean": 26.1515151515,
"line_max": 70,
"alpha_frac": 0.5725446429,
"autogenerated": false,
"ratio": 3.4863813229571985,
"config_tes... |
""" Architecture information carriers.
This module contains classes with information about a specific target.
The information present:
- endianness
- type sizes and alignment
- int size for the machine
"""
import enum
from .. import ir
class Endianness(enum.Enum):
""" Define endianness as little or big """
... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/arch/arch_info.py",
"copies": "1",
"size": "2234",
"license": "bsd-2-clause",
"hash": 3542890067626368000,
"line_mean": 28.012987013,
"line_max": 79,
"alpha_frac": 0.6145926589,
"autogenerated": false,
"ratio": 4.296153846153846,
"config_... |
## Architecture
# Take in inputs from the screen and preprocess them
# Pass them into an NN
# Update the weights of the NN using gradient descent
# weights['1'] - Matrix that holds weights of pixels passing into hidden layer. Dimensions: [200 x 80 x 80] -> [200 x 6400]
# weights['2'] - Matrix that holds weights of hid... | {
"repo_name": "Froskekongen/oslodatascience-rl",
"path": "pavlo/me_pong.py",
"copies": "1",
"size": "9857",
"license": "mit",
"hash": -2455530471388638700,
"line_mean": 43.0044642857,
"line_max": 154,
"alpha_frac": 0.6828649691,
"autogenerated": false,
"ratio": 3.7224320241691844,
"config_test"... |
"""Archive and extract tars."""
import logging
import tarfile
from pypyr.errors import KeyNotInContextError
# logger means the log level will be set correctly
logger = logging.getLogger(__name__)
def run_step(context):
"""Archive and/or extract tars with or without compression.
Args:
context: dictio... | {
"repo_name": "pypyr/pypyr-cli",
"path": "pypyr/steps/tar.py",
"copies": "1",
"size": "5642",
"license": "apache-2.0",
"hash": -4867263574476197000,
"line_mean": 30.6966292135,
"line_max": 79,
"alpha_frac": 0.5937610776,
"autogenerated": false,
"ratio": 4.163837638376384,
"config_test": false,
... |
"""Archive a road conditions plot every 5 minutes.
Called from RUN_5MIN.sh
"""
import datetime
import os
import sys
import subprocess
import tempfile
from pyiem.util import utc, logger
import pytz
import requests
LOG = logger()
def do(now):
"""Run for a given timestamp."""
fn = now.strftime(
"/meso... | {
"repo_name": "akrherz/iem",
"path": "scripts/roads/archive_roadsplot.py",
"copies": "1",
"size": "1523",
"license": "mit",
"hash": -4381844053349975000,
"line_mean": 24.813559322,
"line_max": 79,
"alpha_frac": 0.609980302,
"autogenerated": false,
"ratio": 3.0039447731755424,
"config_test": fal... |
""" ArchiveBot wpull 2.x plugin (replaces 1.x hooks)
This module implements the integration layer between ArchiveBot and wpull. In
particular, it handles ignore settings, settings changes, dashboard reporting,
and aborts.
"""
# The ArchiveBot plugin will be split across multiple modules, but
# sys.path for plugins d... | {
"repo_name": "falconkirtaran/ArchiveBot",
"path": "pipeline/archive_bot_plugin.py",
"copies": "3",
"size": "10056",
"license": "mit",
"hash": -6516339720512217000,
"line_mean": 32.0789473684,
"line_max": 96,
"alpha_frac": 0.6134645982,
"autogenerated": false,
"ratio": 4.09113100081367,
"config... |
# archivebox init
# archivebox add
import os
import subprocess
from pathlib import Path
import json, shutil
import sqlite3
from archivebox.config import OUTPUT_PERMISSIONS
from .fixtures import *
def test_init(tmp_path, process):
assert "Initializing a new ArchiveBox" in process.stdout.decode("utf-8")
def ... | {
"repo_name": "pirate/bookmark-archiver",
"path": "tests/test_init.py",
"copies": "1",
"size": "7971",
"license": "mit",
"hash": 7180298746655652000,
"line_mean": 44.2897727273,
"line_max": 132,
"alpha_frac": 0.663153933,
"autogenerated": false,
"ratio": 3.3948040885860307,
"config_test": true,... |
""" Archived flu data
http://webarchive.nationalarchives.gov.uk/20130107105354/http://www.dh.gov.uk/en/Publicationsandstatistics/Statistics/Performancedataandstatistics/DailySituationReports/index.htm
"""
import collections
import calendar
import datetime
import re
import urllib
from lxml.html import fromstring, tostr... | {
"repo_name": "nhsengland/publish-o-matic",
"path": "datasets/nhse_stats/topics/archived_flu.py",
"copies": "1",
"size": "1941",
"license": "mit",
"hash": 6561314126686701000,
"line_mean": 36.3461538462,
"line_max": 187,
"alpha_frac": 0.7181865018,
"autogenerated": false,
"ratio": 3.6416510318949... |
# Archived method for visualizing functional load
#import igraph as ig
class FLGraph:
# Plots a graph based on the results of functional load calculation
# by taking a list of the phonemes that were calculated, which will be the graph's vertices,
# and a list of functional load values, which will be th... | {
"repo_name": "PhonologicalCorpusTools/CorpusTools",
"path": "corpustools/gui/graph.py",
"copies": "1",
"size": "1773",
"license": "bsd-3-clause",
"hash": -5017766390830916000,
"line_mean": 44.4615384615,
"line_max": 104,
"alpha_frac": 0.6283135928,
"autogenerated": false,
"ratio": 3.879649890590... |
""" Archive manager.
Create or update an archive. Or extract object files from the archive.
"""
import argparse
from .base import base_parser, LogSetup
from .. import api
from ..binutils.objectfile import get_object
from ..binutils.archive import get_archive
parser = argparse.ArgumentParser(
formatter_class=arg... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/cli/archive.py",
"copies": "1",
"size": "1602",
"license": "bsd-2-clause",
"hash": -3235839845664914400,
"line_mean": 29.2264150943,
"line_max": 76,
"alpha_frac": 0.6485642946,
"autogenerated": false,
"ratio": 3.936117936117936,
"config_t... |
"""Archive one or more alerts."""
from baseCmd import *
from baseResponse import *
class archiveAlertsCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""end date range to archive alerts (including) this date (use format "yyyy-MM-dd" or the new format "yyyy-MM-ddThh:mm:... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/archiveAlerts.py",
"copies": "1",
"size": "1196",
"license": "apache-2.0",
"hash": -7168970963380534000,
"line_mean": 32.2222222222,
"line_max": 136,
"alpha_frac": 0.5986622074,
"autogenerated": false,
"ratio": 3.833333333... |
"""Archive one or more events."""
from baseCmd import *
from baseResponse import *
class archiveEventsCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""end date range to archive events (including) this date (use format "yyyy-MM-dd" or the new format "yyyy-MM-ddThh:mm:... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/archiveEvents.py",
"copies": "1",
"size": "1196",
"license": "apache-2.0",
"hash": 5079152821762764000,
"line_mean": 32.2222222222,
"line_max": 136,
"alpha_frac": 0.5986622074,
"autogenerated": false,
"ratio": 3.8580645161... |
"""Archive processor test suite."""
import collections.abc
import itertools
import pathlib
import pytest
import holocron
from holocron._processors import archive
@pytest.fixture(scope="function")
def testapp():
return holocron.Application({"url": "https://yoda.ua"})
def test_item(testapp):
"""Archive pro... | {
"repo_name": "ikalnytskyi/holocron",
"path": "tests/_processors/test_archive.py",
"copies": "1",
"size": "5430",
"license": "bsd-3-clause",
"hash": 3443619822366047000,
"line_mean": 27.7301587302,
"line_max": 79,
"alpha_frac": 0.4767955801,
"autogenerated": false,
"ratio": 4.031180400890869,
"... |
# archive.py
import struct
class Archive(object):
NODE_NULL = 0
NODE_BOOLEAN = 1
NODE_INT8 = 2
NODE_UINT8 = 3
NODE_INT16 = 4
NODE_UINT16 = 5
NODE_INT32 = 6
NODE_UINT32 = 7
NODE_INT64 = 8
NODE_UINT64 = 9
NODE_FLOAT = 10
NODE_DOUBLE = 11
NODE_STRING = 12
NODE_ARR... | {
"repo_name": "willcassella/SinGE",
"path": "Tools/SinGED/archive.py",
"copies": "1",
"size": "7678",
"license": "mit",
"hash": 3437826083158689000,
"line_mean": 31.2605042017,
"line_max": 104,
"alpha_frac": 0.6056264652,
"autogenerated": false,
"ratio": 3.574487895716946,
"config_test": false,... |
ARCHIVER_INITIATED = 'INITIATED'
ARCHIVER_FAILURE = 'FAILURE'
ARCHIVER_SUCCESS = 'SUCCESS'
ARCHIVER_SENT = 'SENT'
ARCHIVER_PENDING = 'ARCHIVING'
ARCHIVER_CHECKING = 'CHECKING'
ARCHIVER_SENDING = 'SENDING'
ARCHIVER_NETWORK_ERROR = 'NETWORK_ERROR'
ARCHIVER_SIZE_EXCEEDED = 'SIZE_EXCEEDED'
ARCHIVER_FILE_NOT_FOUND = 'FILE... | {
"repo_name": "aaxelb/osf.io",
"path": "website/archiver/__init__.py",
"copies": "6",
"size": "2176",
"license": "apache-2.0",
"hash": -1600871273440980500,
"line_mean": 26.2,
"line_max": 85,
"alpha_frac": 0.6148897059,
"autogenerated": false,
"ratio": 3.426771653543307,
"config_test": false,
... |
"""Archive the NWS WaWA map.
https://mesonet.agron.iastate.edu/timemachine/#59.0
"""
import subprocess
import tempfile
import os
from pyiem.util import exponential_backoff, logger, utc
import requests
LOG = logger()
SRC = "https://forecast.weather.gov/wwamap/png/US.png"
def main():
"""Go Main Go."""
utcnow... | {
"repo_name": "akrherz/iem",
"path": "scripts/cache/nws_wawa_archive.py",
"copies": "1",
"size": "1089",
"license": "mit",
"hash": 1046885741890760300,
"line_mean": 24.9285714286,
"line_max": 73,
"alpha_frac": 0.6051423324,
"autogenerated": false,
"ratio": 3.1203438395415475,
"config_test": fal... |
# Archivo con funciones de control para SAGE
import datetime
# Las Tuplas de cada puesto deben tener los horarios de inicio y de cierre para que
# pueda funcionar [(7:00,7:00), (19:00,19:00)]
# Suponiendo que cada estacionamiento tiene una estructura "matricial" lista de listas
# donde si m es una matriz, m[i,j] las... | {
"repo_name": "Sealos/SAGE",
"path": "src/SAGE/estacionamientos/controller.py",
"copies": "1",
"size": "4488",
"license": "mit",
"hash": -174221339331046050,
"line_mean": 37.6465517241,
"line_max": 121,
"alpha_frac": 0.7381217934,
"autogenerated": false,
"ratio": 2.4891726818434203,
"config_tes... |
# ARCHIVO DONDE SE HACEN TODAS LAS OPERACIONES Y SE CREA UN MENÚ
# Se importan las clases a usar
from agencia import Agencia
from vendedor import Vendedor
from cliente import Cliente
from automovil import Automovil
from camion import Camion
from motocicleta import Motocicleta
# Se declara la agencia donde se realizan... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ago-Dic-2017/Cuauhtémoc Martínez/Practica1/main.py",
"copies": "2",
"size": "30579",
"license": "mit",
"hash": 1218829685314259700,
"line_mean": 50.2516778523,
"line_max": 150,
"alpha_frac": 0.5196097689,
"autogenerated": false,
"ratio": 2.9867996479... |
archivo = open("lista.txt","a")
from imports import *
class Main:
def __init__(self,ancho = 800,alto = 600,tit = "grafiCAR"):
self.ventana = Ventana(ancho,alto,tit)
self.fondo = Fondo(ancho,alto)
self.pista = Pista()
self.auto = Auto(color ='rojo',pista = self.pista,posx = 400,posy ... | {
"repo_name": "bsubercaseaux/dcc",
"path": "Modelación y Computación Gráfica/graficaAutos/main.py",
"copies": "1",
"size": "4188",
"license": "mit",
"hash": -8667539528363265000,
"line_mean": 43.5531914894,
"line_max": 126,
"alpha_frac": 0.5475167144,
"autogenerated": false,
"ratio": 3.3665594855... |
"""archvyrt domain module"""
# stdlib
import logging
# 3rd-party
import libvirt
# archvyrt
from archvyrt.libvirt import LibvirtDomain
from archvyrt.libvirt import LibvirtDisk
from archvyrt.libvirt import LibvirtNetwork
from archvyrt.libvirt import LibvirtRng
LOG = logging.getLogger(__name__)
class Domain:
"""
... | {
"repo_name": "andrekeller/archvyrt",
"path": "archvyrt/domain.py",
"copies": "1",
"size": "5271",
"license": "mit",
"hash": -721414896864102300,
"line_mean": 25.223880597,
"line_max": 77,
"alpha_frac": 0.5249478277,
"autogenerated": false,
"ratio": 4.345424567188788,
"config_test": false,
"h... |
"""archvyrt libvirt device module"""
import xml.etree.ElementTree as ElementTree
import xml.dom.minidom
class LibvirtXml:
"""Libvirt device"""
def __init__(self):
self._xml = ElementTree.Element('root')
@staticmethod
def format_xml(et_xml):
"""
Return a pretty formatted XML
... | {
"repo_name": "andrekeller/archvyrt",
"path": "archvyrt/libvirt/xml.py",
"copies": "1",
"size": "1210",
"license": "mit",
"hash": -8244610049041430000,
"line_mean": 24.2083333333,
"line_max": 79,
"alpha_frac": 0.5760330579,
"autogenerated": false,
"ratio": 4.531835205992509,
"config_test": fals... |
"""archvyrt libvirt disk module"""
# stdlib
import logging
import re
import xml.etree.ElementTree as ElementTree
# 3rd-party
import libvirt
# archvyrt
from .xml import LibvirtXml
LOG = logging.getLogger(__name__)
class LibvirtDisk(LibvirtXml):
"""
LibVirt Disk device object.
"""
def __init__(self, ... | {
"repo_name": "andrekeller/archvyrt",
"path": "archvyrt/libvirt/disk.py",
"copies": "1",
"size": "4635",
"license": "mit",
"hash": 5141158112735128000,
"line_mean": 29.4934210526,
"line_max": 80,
"alpha_frac": 0.5816612729,
"autogenerated": false,
"ratio": 4.28373382624769,
"config_test": false... |
"""archvyrt libvirt domain module"""
# stdlib
import logging
import xml.etree.ElementTree as ElementTree
# archvyrt
from .xml import LibvirtXml
LOG = logging.getLogger(__name__)
class LibvirtDomain(LibvirtXml):
"""
Libvirt Domain object
"""
def __init__(self, name):
"""
Initialize d... | {
"repo_name": "andrekeller/archvyrt",
"path": "archvyrt/libvirt/domain.py",
"copies": "1",
"size": "10140",
"license": "mit",
"hash": -7416143646161850000,
"line_mean": 33.6075085324,
"line_max": 74,
"alpha_frac": 0.6039447732,
"autogenerated": false,
"ratio": 4.184894758563764,
"config_test": ... |
"""archvyrt libvirt network module"""
# stdlib
import ipaddress
import logging
import xml.etree.ElementTree as ElementTree
# archvyrt
from .xml import LibvirtXml
LOG = logging.getLogger(__name__)
class LibvirtNetwork(LibvirtXml):
"""
Libvirt Network device object
"""
def __init__(self, name, **kwar... | {
"repo_name": "andrekeller/archvyrt",
"path": "archvyrt/libvirt/network.py",
"copies": "1",
"size": "6212",
"license": "mit",
"hash": -1522431048245795600,
"line_mean": 29.9054726368,
"line_max": 97,
"alpha_frac": 0.546522859,
"autogenerated": false,
"ratio": 4.28118538938663,
"config_test": tr... |
"""archvyrt setup module"""
from pathlib import Path
import re
from setuptools import setup, find_packages
def find_version(source_file):
"""read __version__ from source file"""
with open(source_file) as version_file:
version_match = re.search(r"^__version__\s*=\s* ['\"]([^'\"]*)['\"]",
... | {
"repo_name": "andrekeller/archvyrt",
"path": "setup.py",
"copies": "1",
"size": "1280",
"license": "mit",
"hash": -7701418998391370000,
"line_mean": 27.4444444444,
"line_max": 77,
"alpha_frac": 0.58828125,
"autogenerated": false,
"ratio": 3.902439024390244,
"config_test": false,
"has_no_keyw... |
import time
from reqs.twisted.internet import reactor
from core.constants import *
from core.decorators import *
from core.plugins import ProtocolPlugin
class BlockTrackerPlugin(ProtocolPlugin):
commands = {
"checkblock": "commandCheckBlock",
"checkplayer": "commandCheckPlayer",
"restorep... | {
"repo_name": "TheArchives/Nexus",
"path": "core/plugins/blocktracker.py",
"copies": "1",
"size": "7910",
"license": "bsd-2-clause",
"hash": 5917905945966233000,
"line_mean": 42.9444444444,
"line_max": 218,
"alpha_frac": 0.5524652339,
"autogenerated": false,
"ratio": 4.019308943089431,
"config_... |
"""arc_net URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"repo_name": "rsunder10/PopularityBased-SearchEngine",
"path": "arc_net/arc_net/urls.py",
"copies": "1",
"size": "1106",
"license": "mit",
"hash": 1553591569808762600,
"line_mean": 37.1379310345,
"line_max": 82,
"alpha_frac": 0.7224231465,
"autogenerated": false,
"ratio": 3.5562700964630225,
"... |
"""arco
Revision ID: 014
Revises: 013
Create Date: 2014-05-27 22:32:33.767037
"""
# revision identifiers, used by Alembic.
revision = '015'
down_revision = '014'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('arco',
sa.Column('id', sa.Integer, primary_key=True),
... | {
"repo_name": "tzulberti/entrenamiento-arqueria",
"path": "alembic/versions/015_arco.py",
"copies": "1",
"size": "1795",
"license": "mit",
"hash": -8416695667464776000,
"line_mean": 34.9,
"line_max": 113,
"alpha_frac": 0.6640668524,
"autogenerated": false,
"ratio": 2.9718543046357615,
"config_t... |
"""arco recurvado
Revision ID: 015
Revises: 015
Create Date: 2014-05-27 22:36:06.936698
"""
# revision identifiers, used by Alembic.
revision = '016'
down_revision = '015'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('arco_recurvado',
sa.Column('id', sa.Integer, sa.For... | {
"repo_name": "tzulberti/entrenamiento-arqueria",
"path": "alembic/versions/016_arco_recurvado.py",
"copies": "1",
"size": "1902",
"license": "mit",
"hash": 8549167772033783000,
"line_mean": 39.4680851064,
"line_max": 91,
"alpha_frac": 0.6456361725,
"autogenerated": false,
"ratio": 2.908256880733... |
"""Arcrest is a Python binding to the ArcGIS REST Server API, similar to the
JavaScript or Flex API in program structure as well as in the way it
interfaces with ArcGIS servers.
Getting Started with Arcrest
============================
A simple example of connecting to a server:
>>> ... | {
"repo_name": "Esri/arcpy-server-util-rest",
"path": "arcrest/__init__.py",
"copies": "1",
"size": "2974",
"license": "apache-2.0",
"hash": 1107823540656010100,
"line_mean": 43.0606060606,
"line_max": 228,
"alpha_frac": 0.668796234,
"autogenerated": false,
"ratio": 3.387243735763098,
"config_te... |
""" Arc-specific Vector provider helpers.
"""
from operator import add
from ..Core import KnownUnknown
from ..py3_compat import reduce
geometry_types = {
'Point': 'esriGeometryPoint',
'LineString': 'esriGeometryPolyline',
'Polygon': 'esriGeometryPolygon',
'MultiPoint': 'esriGeometryMultipoint',
'... | {
"repo_name": "TileStache/TileStache",
"path": "TileStache/Vector/Arc.py",
"copies": "1",
"size": "6091",
"license": "bsd-3-clause",
"hash": -4641867942046351000,
"line_mean": 38.0448717949,
"line_max": 116,
"alpha_frac": 0.6383188311,
"autogenerated": false,
"ratio": 3.653869226154769,
"config... |
""" Arc-specific Vector provider helpers.
"""
from operator import add
from ..Core import KnownUnknown
geometry_types = {
'Point': 'esriGeometryPoint',
'LineString': 'esriGeometryPolyline',
'Polygon': 'esriGeometryPolygon',
'MultiPoint': 'esriGeometryMultipoint',
'MultiLineString': 'esriGeometryPo... | {
"repo_name": "Billups/TileStache",
"path": "TileStache/Vector/Arc.py",
"copies": "2",
"size": "6130",
"license": "bsd-3-clause",
"hash": -6593072711286386000,
"line_mean": 38.8051948052,
"line_max": 116,
"alpha_frac": 0.6301794454,
"autogenerated": false,
"ratio": 3.699456849728425,
"config_te... |
""" Arc-specific Vector provider helpers.
"""
from operator import add
from TileStache.Core import KnownUnknown
geometry_types = {
'Point': 'esriGeometryPoint',
'LineString': 'esriGeometryPolyline',
'Polygon': 'esriGeometryPolygon',
'MultiPoint': 'esriGeometryMultipoint',
'MultiLineString': 'esriG... | {
"repo_name": "robpvn/Vector-Tile-Research",
"path": "TileStache/Vector/Arc.py",
"copies": "13",
"size": "6139",
"license": "bsd-3-clause",
"hash": 7968451868734726000,
"line_mean": 38.8636363636,
"line_max": 116,
"alpha_frac": 0.6308845089,
"autogenerated": false,
"ratio": 3.695966285370259,
"... |
#ArcSwath
#NB 08/2014
import arcpy as ap
import pythonaddins
import math
import numpy as np
import os as os
import numpy.ma as ma
import csv
from subprocess import Popen, PIPE
try:
import matplotlib.pyplot as plt
Matplotlibexists=True
except ImportError:
print ("NO mathplotlib module found. Plot can only... | {
"repo_name": "HUGG/ArcSwath",
"path": "Install/ArcSwath_addin.py",
"copies": "1",
"size": "19717",
"license": "mit",
"hash": -2680452891958736000,
"line_mean": 36.2741020794,
"line_max": 157,
"alpha_frac": 0.5259927981,
"autogenerated": false,
"ratio": 3.8027000964320155,
"config_test": false,... |
"""Arcyd - daemon to watch git repos, create and land reviews automatically.
Intended to make it easy for large teams to start using Differential without
individual contributors needing to install and configure Arcanist.
Individual contributors are still free to use Arcanist if they wish, Arcyd
provides a zero-config... | {
"repo_name": "valhallasw/phabricator-tools",
"path": "py/abd/abdcmd_arcyd.py",
"copies": "1",
"size": "5265",
"license": "apache-2.0",
"hash": -2177470798054003200,
"line_mean": 33.1883116883,
"line_max": 79,
"alpha_frac": 0.6554605888,
"autogenerated": false,
"ratio": 3.507661558960693,
"conf... |
"""Arcyd operations that can be scheduled with phlsys_scheduleunreliables."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdi_operation
#
# Public Classes:
# Sleep
# .do
# RefreshCach... | {
"repo_name": "valhallasw/phabricator-tools",
"path": "py/abd/abdi_operation.py",
"copies": "1",
"size": "4255",
"license": "apache-2.0",
"hash": 5974392326095310000,
"line_mean": 28.3448275862,
"line_max": 79,
"alpha_frac": 0.5673325499,
"autogenerated": false,
"ratio": 4.107142857142857,
"con... |
"""Arcyd-specific interactions with the filesystem."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_fs
#
# Public Classes:
# Error
# Layout
# .phabricator_config
# .repohost_con... | {
"repo_name": "valhallasw/phabricator-tools",
"path": "py/abd/abdt_fs.py",
"copies": "1",
"size": "15117",
"license": "apache-2.0",
"hash": 8660821039225938000,
"line_mean": 29.4778225806,
"line_max": 79,
"alpha_frac": 0.6275716081,
"autogenerated": false,
"ratio": 3.783979974968711,
"config_te... |
# Arda Mavi
import numpy as np
from os import listdir
from skimage import io
from scipy.misc import imresize
from keras.preprocessing.image import array_to_img, img_to_array, load_img
def get_img(data_path):
# Getting image array from path:
img_size = 64
img = io.imread(data_path)
img = imresize(img, ... | {
"repo_name": "ardamavi/Dog-Cat-Classifier",
"path": "get_dataset.py",
"copies": "1",
"size": "1900",
"license": "apache-2.0",
"hash": 2631299432122438700,
"line_mean": 34.8490566038,
"line_max": 81,
"alpha_frac": 0.5684210526,
"autogenerated": false,
"ratio": 3.4234234234234235,
"config_test":... |
# Arda Mavi
import os
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D
def save_model(model):
if not os.path.exists('Data/Model/'):
os.makedirs('Data/Model/')
model_json = model.to_json()
with open("Data/Model/model.json", "w") ... | {
"repo_name": "ardamavi/Dog-Cat-Classifier",
"path": "get_model.py",
"copies": "1",
"size": "1283",
"license": "apache-2.0",
"hash": -1184265861308370700,
"line_mean": 25.7291666667,
"line_max": 94,
"alpha_frac": 0.6492595479,
"autogenerated": false,
"ratio": 3.1600985221674875,
"config_test": ... |
# Ard_to_py.py
# Interface between Arduino and Python
# <Chad Hobbs>
import serial
from graphics import *
def createwin(): # Build the basic window and greet the user
win = GraphWin("Arduino Interface",400,400)
win.setCoords(0,0,100,100)
win.setBackground("White")
greet = Text(Point(50,90),... | {
"repo_name": "itsallvoodoo/random",
"path": "Arduino-Python-Interface/Ard_to_py.py",
"copies": "1",
"size": "2129",
"license": "apache-2.0",
"hash": 7293727885710677000,
"line_mean": 24.9493670886,
"line_max": 73,
"alpha_frac": 0.576326914,
"autogenerated": false,
"ratio": 3.0855072463768116,
... |
#Arduino connection, Adafruit16C connection and Servo test script
#
from time import sleep
port = "COM4"
arduino = Runtime.start("arduino","Arduino")
arduino.connect(port)
adaFruit16c = Runtime.createAndStart("AdaFruit16C","Adafruit16CServoDriver");
adaFruit16c.setController("arduino","1","0x40");
adaFruit16c.setPWM... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "home/CheekyMonkey/arduino-servo test script.py",
"copies": "1",
"size": "1576",
"license": "apache-2.0",
"hash": 6507070467604140000,
"line_mean": 20.0133333333,
"line_max": 77,
"alpha_frac": 0.7100253807,
"autogenerated": false,
"ratio": 2.53376205... |
"""Arduino-like library for Python on BeagleBone"""
import time
HIGH = "HIGH"
LOW = "LOW"
OUTPUT = "OUTPUT"
INPUT = "INPUT"
pinList = [] # needed for unexport()
startTime = time.time() # needed for millis()
digitalPinDef = {
"P8.3": 38,
"P8.4": 39,
"P8.5": 34,
"P8.6": 35,
"P8.7": 66,
"P8.8": 67... | {
"repo_name": "mrichardson23/mrBBIO",
"path": "mrbbio.py",
"copies": "2",
"size": "7656",
"license": "apache-2.0",
"hash": 6397321419360216000,
"line_mean": 27.7819548872,
"line_max": 138,
"alpha_frac": 0.5902560084,
"autogenerated": false,
"ratio": 2.212077434267553,
"config_test": false,
"h... |
try:
PORT = '/dev/ttyACM0'
board = pyfirmata.Arduino(PORT)
except:
PORT = raw_input("Enter full Arduino device location (ie: 'dev/ttyUSB0' etc): ")
board = pyfirmata.Arduino(PORT)
### SET PIN NUMBER ###
pin = int(raw_input('Enter Arduino digital pin number used: '))
def program():
### DELAY FACTORS ###
delay... | {
"repo_name": "joshkouri/morse",
"path": "morse.py",
"copies": "1",
"size": "3706",
"license": "mit",
"hash": -8937228539966866000,
"line_mean": 28.8870967742,
"line_max": 122,
"alpha_frac": 0.5936319482,
"autogenerated": false,
"ratio": 3.2942222222222224,
"config_test": false,
"has_no_keywo... |
import serial
import os
import time
def timestamp():
strtime = time.ctime().split()
strtime = strtime[3]
return "["+strtime+"]"
def cleanSerialData(data):
data = data.decode('utf-8')
data = data.rstrip("\n")
data = data.rstrip("\r")
return data
if(__name__ == "__main__"):
while(1):
tr... | {
"repo_name": "snehalgupta/Intelliwater",
"path": "arduino.py",
"copies": "1",
"size": "3336",
"license": "apache-2.0",
"hash": 8205386344215470000,
"line_mean": 20.5405405405,
"line_max": 63,
"alpha_frac": 0.5317745803,
"autogenerated": false,
"ratio": 2.9865711727842434,
"config_test": false,... |
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM3")
arduino.setSampleRate(30000)
readAnalogPin = 0
arduino.analogReadPollingStart(readAnalogPin)
arduino.addListener("publishPin", "python", "input")
pid = Runtime.createAndStart("pid","PID")
pid.setMode(1)
#set the range of the "correction"
... | {
"repo_name": "DarkRebel/myrobotlab",
"path": "src/resource/Python/examples/PID.temperatureControl.py",
"copies": "6",
"size": "1240",
"license": "apache-2.0",
"hash": -5027350029327452000,
"line_mean": 28.5238095238,
"line_max": 162,
"alpha_frac": 0.7693548387,
"autogenerated": false,
"ratio": 2... |
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM3")
# arduino.setSampleRate(30000)
readAnalogPin = 0
arduino.arduino.enablePin(readAnalogPin)
arduino.addListener("publishPin", "python", "input")
pid = Runtime.createAndStart("pid","Pid")
pid.setMode(1)
#set the range of the "correction"
pid... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "service/PID2.py",
"copies": "2",
"size": "1237",
"license": "apache-2.0",
"hash": 360294456449370100,
"line_mean": 28.4523809524,
"line_max": 162,
"alpha_frac": 0.7663702506,
"autogenerated": false,
"ratio": 2.9664268585131897,
"config_test": fals... |
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM9")
mouth = Runtime.create("mouth","Speech")
s8 = Runtime.createAndStart("s8","Servo")
s9 = Runtime.createAndStart("s9","Servo")
s10 = Runtime.createAndStart("s10","Servo")
s11 = Runtime.createAndStart("s11","Servo")
s13 = Runtime.createAndSt... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "home/AdolphSmith/AmbyByeBye.py",
"copies": "2",
"size": "3745",
"license": "apache-2.0",
"hash": 5931850001320249000,
"line_mean": 20.9005847953,
"line_max": 59,
"alpha_frac": 0.6929238985,
"autogenerated": false,
"ratio": 2.336244541484716,
"conf... |
arduino = Runtime.createAndStart("arduino","Arduino")
joystick = runtime.createAndStart("joystick","Joystick")
hand = Runtime.createAndStart("hand","Servo")
arduino.connect("COM3", 57600, 8, 1, 0)
sleep(4)
arduino.attach(hand.getName() , 2)
b = 100
print b
hand.moveTo(b)
def x():
global b
x = msg_joystick_X... | {
"repo_name": "mecax/pyrobotlab",
"path": "toSort/Joystick.robotHand.py",
"copies": "5",
"size": "1117",
"license": "apache-2.0",
"hash": 3949608159274851300,
"line_mean": 27.641025641,
"line_max": 105,
"alpha_frac": 0.6392121755,
"autogenerated": false,
"ratio": 3.1114206128133706,
"config_tes... |
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM5")
# arduino.setSampleRate(30000)
readAnalogPin = 0
arduino.enablePin(readAnalogPin)
arduino.addListener("publishPin", "python", "input")
pid = Runtime.start("pid","Pid")
#set Kp, kd, ki kp = gain, how strong it react kd = how f... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "service/Pid.py",
"copies": "2",
"size": "1266",
"license": "apache-2.0",
"hash": -8677735712170527000,
"line_mean": 26.7727272727,
"line_max": 162,
"alpha_frac": 0.7259083728,
"autogenerated": false,
"ratio": 2.99290780141844,
"config_test": false... |
# Arduino-Windows2x.py
#
# DEMO Arduino Diecimila Board and below, serial access, using standard
# Python and Windows 32 bit installs.
#
# This is an experimental idea only to test the Arduino Diecimila
# development board under Python 2.2.x to 2.6.x; (assume Python 2.6.x).
# (It is assumed that the Python install... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577648_Arduino_DiecimilBoard_Access_Inside_Windows_32/recipe-577648.py",
"copies": "1",
"size": "2370",
"license": "mit",
"hash": 8820548762363327000,
"line_mean": 16.5555555556,
"line_max": 82,
"alpha_frac": 0.6679324895,
"autogenerated": f... |
"""ArduPET is an office automation implementation. It is originally designed to
be use at the Tutorial Education Program (PET in pt-BR, hence the name) to turn
lamps on and off and unlock the door, while also checking the statuses.
Routes:
GET /lamp -- lists all lamps statuses
GET /lamp/<id> -- get the status of the l... | {
"repo_name": "ranisalt/ardupet",
"path": "ardupet.py",
"copies": "1",
"size": "1998",
"license": "mit",
"hash": -5813107089365314000,
"line_mean": 26.75,
"line_max": 79,
"alpha_frac": 0.6391391391,
"autogenerated": false,
"ratio": 2.9382352941176473,
"config_test": false,
"has_no_keywords": ... |
# AREA API Serializer #
from django.utils import timezone
from django.core.urlresolvers import reverse
from rest_framework import serializers
from rest_framework import pagination
from area.models import Region, Location, LocationDirectory, LocationType
from item.serializers import ItemSerializer
class Regio... | {
"repo_name": "ngr/sm_00",
"path": "area/serializers.py",
"copies": "1",
"size": "3422",
"license": "mit",
"hash": 6279190598414505000,
"line_mean": 33.2783505155,
"line_max": 117,
"alpha_frac": 0.6361776739,
"autogenerated": false,
"ratio": 4.188494492044064,
"config_test": false,
"has_no_ke... |
# SET methods #
# FIXME Use this for debugging only now!
def set_name(self, name=''):
""" Set a new name of Region. """
self.name = name
def set_owner(self, owner):
""" Change owner of Region. """
self.owner = owner
class LocationType(models.Model):
""" This... | {
"repo_name": "ngr/sm_00",
"path": "area/models.py",
"copies": "1",
"size": "6119",
"license": "mit",
"hash": 5042660296678238000,
"line_mean": 32.2554347826,
"line_max": 99,
"alpha_frac": 0.6108841314,
"autogenerated": false,
"ratio": 4.211286992429456,
"config_test": false,
"has_no_keywords... |
# A reaction to: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/552751
from webob import Request, Response
from webob import exc
from simplejson import loads, dumps
import traceback
import sys
class JsonRpcApp(object):
"""
Serve the given object via json-rpc (http://json-rpc.org/)
"""
def __i... | {
"repo_name": "bratsche/Neutron-Drive",
"path": "google_appengine/lib/webob_1_1_1/docs/jsonrpc-example-code/jsonrpc.py",
"copies": "5",
"size": "5970",
"license": "bsd-3-clause",
"hash": -4050960155617656000,
"line_mean": 29.932642487,
"line_max": 79,
"alpha_frac": 0.5301507538,
"autogenerated": fa... |
# A read-eval-print-loop for MCEdit.
# Created to allow programmers to quickly experiment with code without worrying
# about destroying their world thanks to MCEdit supplying the ability to quickly
# view and undo changes.
# If there are any issues or enhancement requests please submit a bug report at:
# https://gith... | {
"repo_name": "qqii/mcedit-filters",
"path": "REPL.py",
"copies": "1",
"size": "7564",
"license": "mit",
"hash": 3883925688409963000,
"line_mean": 28.546875,
"line_max": 90,
"alpha_frac": 0.5609465891,
"autogenerated": false,
"ratio": 4.16061606160616,
"config_test": false,
"has_no_keywords":... |
'''A Read-Eval-Print-Loop with "help" support'''
import sys
import traceback
class InteractiveInterpreter:
'''A simple interpreter with built-in help'''
def __init__(self, evaluate=None, parse=None, global_env=None):
self.evaluate = evaluate
self.parse = parse
self.global_env = globa... | {
"repo_name": "aroberge/lispy-experiments",
"path": "src/repl.py",
"copies": "1",
"size": "4603",
"license": "cc0-1.0",
"hash": 669378691597672100,
"line_mean": 34.1374045802,
"line_max": 82,
"alpha_frac": 0.4799044102,
"autogenerated": false,
"ratio": 4.305893358278765,
"config_test": false,
... |
"""A readline()-style interface to the parts of a multipart message.
The MultiFile class makes each part of a multipart message "feel" like
an ordinary file, as long as you use fp.readline(). Allows recursive
use, for nested multipart messages. Probably best used together
with module mimetools.
Suggested use:
real... | {
"repo_name": "MalloyPower/parsing-python",
"path": "front-end/testsuite-python-lib/Python-2.2/Lib/multifile.py",
"copies": "1",
"size": "5241",
"license": "mit",
"hash": 1361403083506459600,
"line_mean": 28.9485714286,
"line_max": 76,
"alpha_frac": 0.5310055333,
"autogenerated": false,
"ratio": ... |
"""A readline()-style interface to the parts of a multipart message.
The MultiFile class makes each part of a multipart message "feel" like
an ordinary file, as long as you use fp.readline(). Allows recursive
use, for nested multipart messages. Probably best used together
with module mimetools.
Suggested use... | {
"repo_name": "MattDevo/edk2",
"path": "AppPkg/Applications/Python/Python-2.7.2/Lib/multifile.py",
"copies": "67",
"size": "4982",
"license": "bsd-2-clause",
"hash": -6837340273322319000,
"line_mean": 28.7530864198,
"line_max": 76,
"alpha_frac": 0.530710558,
"autogenerated": false,
"ratio": 4.107... |
"""Area drawing algorithm"""
import itertools
from gfxlcd.drawing.pixel import Pixel
from PIL import Image
class Area(Pixel):
"""Area drawing algorithm"""
def __init__(self, driver):
self.driver = driver
Pixel.__init__(self, driver)
def init(self):
"""additional initialization"""
... | {
"repo_name": "bkosciow/gfxlcd",
"path": "gfxlcd/drawing/area.py",
"copies": "1",
"size": "6634",
"license": "mit",
"hash": 6985469976448931000,
"line_mean": 34.1005291005,
"line_max": 84,
"alpha_frac": 0.4678926741,
"autogenerated": false,
"ratio": 3.8280438545874205,
"config_test": false,
"... |
"""Area driver """
from gfxlcd.abstract.driver import Driver
class AreaDriver(Driver):
"""Null communication driver"""
def __init__(self, width, height):
self.height = height
self.width = width
self.buffer = [[0] * self.height for x in range(self.width)]
self.area = {
... | {
"repo_name": "bkosciow/gfxlcd",
"path": "gfxlcd/driver/null/area_driver.py",
"copies": "1",
"size": "1253",
"license": "mit",
"hash": 1117461018700747800,
"line_mean": 24.06,
"line_max": 70,
"alpha_frac": 0.4820430966,
"autogenerated": false,
"ratio": 3.5698005698005697,
"config_test": false,
... |
"""A really dump pusher 'clone', for use in testing and running locally."""
import argparse
import collections
import json
import logging
import SimpleHTTPServer
import SocketServer
import sys
import threading
import time
import SimpleWebSocketServer
HTTP_PORT = 8101
WEBSOCKET_PORT = 8102
LOGFMT = '%(asctime)s %(leve... | {
"repo_name": "tomwilkie/awesomation",
"path": "src/pi/simple_pusher.py",
"copies": "1",
"size": "4124",
"license": "mit",
"hash": -5561247637940887000,
"line_mean": 28.6690647482,
"line_max": 75,
"alpha_frac": 0.6741028128,
"autogenerated": false,
"ratio": 3.9053030303030303,
"config_test": fa... |
"""A really simple 'Hello, World' webapp to test snakeweb."""
from wsgiref.simple_server import make_server
from snakeguice import create_injector
from snakeguice.modules import Module
from snakeguice.extras import snakeweb
class HWController(object):
def index(self, request):
return snakeweb.Response('... | {
"repo_name": "dstanek/snake-guice",
"path": "examples/snakeweb/simple_hello_world.py",
"copies": "2",
"size": "1051",
"license": "mit",
"hash": -3842863588822469000,
"line_mean": 28.1944444444,
"line_max": 75,
"alpha_frac": 0.6593720266,
"autogenerated": false,
"ratio": 3.687719298245614,
"con... |
""" A really simple internal message bus for PubTal.
Copyright (c) 2004 Colin Stewart (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code ... | {
"repo_name": "owlfish/pubtal",
"path": "devtools/MessageBusWithFilter.py",
"copies": "1",
"size": "3420",
"license": "bsd-3-clause",
"hash": 2307706419101166000,
"line_mean": 44.0131578947,
"line_max": 122,
"alpha_frac": 0.7529239766,
"autogenerated": false,
"ratio": 3.944636678200692,
"config... |
# A really simple rotating logger
import time
class Logger(object):
DEBUG = 10
INFO = 20
WARNING = 30
WARN = WARNING
ERROR = 40
def __init__(self, outputfile, max_len, level=INFO,
interactive=False):
# Specify a logfile, the max length of the file before rotating,
... | {
"repo_name": "mpi-sws-rse/thingflow-python",
"path": "micropython/logger.py",
"copies": "2",
"size": "2948",
"license": "apache-2.0",
"hash": -9000560593428604000,
"line_mean": 27.9019607843,
"line_max": 79,
"alpha_frac": 0.5576662144,
"autogenerated": false,
"ratio": 3.9359145527369828,
"conf... |
"""A really simple url shortener for App Engine."""
from google.appengine.api import users
from snakeguice import inject
from snakeguice.config import Config
from mako.template import Template
import webob
import interfaces
class ShortsController(object):
@inject(auth_service=interfaces.AuthService,
... | {
"repo_name": "dstanek/shorts",
"path": "controllers.py",
"copies": "1",
"size": "1641",
"license": "mit",
"hash": 5685440687697836000,
"line_mean": 35.4666666667,
"line_max": 77,
"alpha_frac": 0.6660572821,
"autogenerated": false,
"ratio": 4.041871921182266,
"config_test": false,
"has_no_key... |
"""Area/message template importer for CAPCollector project.
Imports area/messages template files to corresponding SQL tables.
File names must end with .xml.
An area template is a single CAP <area> block.
A message template is a single CAP <alert> block with a single <info> block;
<area> blocks are ignored.
Run
$ pyth... | {
"repo_name": "CAPTools/CAPCollector",
"path": "core/management/commands/import_templates.py",
"copies": "2",
"size": "2354",
"license": "bsd-3-clause",
"hash": 5003252010830021000,
"line_mean": 33.115942029,
"line_max": 80,
"alpha_frac": 0.707306712,
"autogenerated": false,
"ratio": 3.8653530377... |
"""A reanalysis of Rosenbluth measurements of the proton form factors
(main analysis routine)
Copyright (c) Alexander Gramolin, 2016
https://github.com/gramolin/rosenbluth/
"""
import numpy as np
import pandas as pd
import radcorr as rc
# Overall normalization uncertainties of the cross sections (%):
nor... | {
"repo_name": "gramolin/rosenbluth",
"path": "reanalysis.py",
"copies": "1",
"size": "5884",
"license": "mit",
"hash": 5746635078529386000,
"line_mean": 37.9668874172,
"line_max": 132,
"alpha_frac": 0.6169272604,
"autogenerated": false,
"ratio": 2.5560382276281493,
"config_test": false,
"has_... |
"""A reanalysis of Rosenbluth measurements of the proton form factors
(script to make Figure 1)
Copyright (c) Alexander Gramolin, 2016
https://github.com/gramolin/rosenbluth/
"""
import numpy as np
import pandas as pd
import radcorr as rc
import matplotlib.pyplot as plt
# Some settings for the figure:
pl... | {
"repo_name": "gramolin/rosenbluth",
"path": "fig1.py",
"copies": "1",
"size": "2079",
"license": "mit",
"hash": 7955526139429504000,
"line_mean": 35.4736842105,
"line_max": 120,
"alpha_frac": 0.6921596922,
"autogenerated": false,
"ratio": 2.5078407720144753,
"config_test": false,
"has_no_key... |
"""A reanalysis of Rosenbluth measurements of the proton form factors
(script to make Figure 2)
Copyright (c) Alexander Gramolin, 2016
https://github.com/gramolin/rosenbluth/
"""
import numpy as np
import pandas as pd
import radcorr as rc
import matplotlib.pyplot as plt
# Some settings for the figure:
pl... | {
"repo_name": "gramolin/rosenbluth",
"path": "fig2.py",
"copies": "1",
"size": "9148",
"license": "mit",
"hash": -4822253677351526000,
"line_mean": 37.4369747899,
"line_max": 192,
"alpha_frac": 0.6165282029,
"autogenerated": false,
"ratio": 2.349858720780889,
"config_test": false,
"has_no_key... |
"""Area of a Rectangular Room"""
import tkcomponents
CONVERSION_FACTOR = 0.09290304
#pylint: disable=no-member
def area_of_rectangle(prompt, units):
"""Separate calculations from output.
prompt - a function that takes a message
to prompt the user and returns a number
units - either 'feet' or 'meters... | {
"repo_name": "brad-h/expy",
"path": "ExPy/ExPy/module07.py",
"copies": "1",
"size": "6830",
"license": "mit",
"hash": 1346294664807402000,
"line_mean": 31.2169811321,
"line_max": 96,
"alpha_frac": 0.6162518302,
"autogenerated": false,
"ratio": 3.9988290398126463,
"config_test": false,
"has_n... |
""" areaSelect.py"""
import pygame
import dinosInSpace
import scroller56
import os
import dataStorage56
import spriteBasic
import infoGraphic56
import sector
import groupMods56
import gfx56
import screenWipe
import fpsSwitch
import soundFx56
import sparkleTrail
# ||||||||||||||||||||||||||||||||||||||||||||||||||||||... | {
"repo_name": "sabajt/Dinos-In-Space",
"path": "areaSelect.py",
"copies": "1",
"size": "61305",
"license": "mit",
"hash": 790700624899668200,
"line_mean": 44.0440852314,
"line_max": 594,
"alpha_frac": 0.5464970231,
"autogenerated": false,
"ratio": 3.269425630633033,
"config_test": false,
"has... |
""" AreaServer supplies a tiny image server for use with TileStache providers
that implement renderArea() (http://tilestache.org/doc/#custom-providers).
The built-in Mapnik provider (http://tilestache.org/doc/#mapnik-provider)
is one example.
There are no tiles here, just a quick & dirty way of getting... | {
"repo_name": "TileStache/TileStache",
"path": "TileStache/Goodies/AreaServer.py",
"copies": "1",
"size": "3832",
"license": "bsd-3-clause",
"hash": -6199680684828739000,
"line_mean": 41.1098901099,
"line_max": 124,
"alpha_frac": 0.6393528184,
"autogenerated": false,
"ratio": 4.187978142076503,
... |
# AREA Views #
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import generics
from rest_framework import permissions
from area.models import Region, Location, LocationDirectory
from area.serializers import RegionSerializer, Re... | {
"repo_name": "ngr/sm_00",
"path": "area/views.py",
"copies": "1",
"size": "5847",
"license": "mit",
"hash": 2998464170895763500,
"line_mean": 38.2416107383,
"line_max": 144,
"alpha_frac": 0.638276039,
"autogenerated": false,
"ratio": 4.511574074074074,
"config_test": false,
"has_no_keywords"... |
# A recursive descent parser that implements an integer calculator
# with variables and conditional statements.
#
# This parser implements exactly the same grammar as
# rd_parser_ebnf, but it evaluates expressions using a different
# technique. Instead of recursively evaluating them following the
# EBNF grammar, it u... | {
"repo_name": "evandrix/Splat",
"path": "doc/parser/rd_parser_infix_expr.py",
"copies": "1",
"size": "13588",
"license": "mit",
"hash": 8896937764137831000,
"line_mean": 32.6336633663,
"line_max": 81,
"alpha_frac": 0.4853547248,
"autogenerated": false,
"ratio": 4.1873651771956855,
"config_test"... |
# A recursive descent parser that implements an integer calculator
# with variables and conditional statements.
#
# This parser implements exactly the same grammar as
# rd_parser_ebnf, but it evaluates expressions using a different
# technique. Instead of recursively evaluating them following the
# EBNF grammar, it use... | {
"repo_name": "eliben/code-for-blog",
"path": "2009/py_rd_parser_example/rd_parser_infix_expr.py",
"copies": "1",
"size": "13290",
"license": "unlicense",
"hash": 6218698606599477000,
"line_mean": 32.1421446384,
"line_max": 81,
"alpha_frac": 0.4962377728,
"autogenerated": false,
"ratio": 4.104385... |
# A recursive descent parser that implements an integer calculator
# with variables and conditional statements.
# The grammar is LL(1), suitable for predictive parsing.
#
# EBNF:
#
# <stmt> : <assign_stmt>
# | <if_stmt>
# | <cmp_expr>
#
# <assign_stmt> : set <id> = <cmp_expr>
#
## Not... | {
"repo_name": "eliben/code-for-blog",
"path": "2009/py_rd_parser_example/rd_parser_ebnf.py",
"copies": "1",
"size": "13524",
"license": "unlicense",
"hash": 5532351703273447000,
"line_mean": 28.5929978118,
"line_max": 68,
"alpha_frac": 0.4549689441,
"autogenerated": false,
"ratio": 3.747298420615... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.