text stringlengths 0 1.05M | meta dict |
|---|---|
# awl.tests.test_commands.py
import os
from unittest import mock
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management import call_command, CommandError
from django.test import TestCase, override_settings
from context_temp import temp_directory
from waelstow import c... | {
"repo_name": "cltrudeau/django-awl",
"path": "awl/tests/test_commands.py",
"copies": "1",
"size": "3152",
"license": "mit",
"hash": 858699383758700500,
"line_mean": 34.8181818182,
"line_max": 78,
"alpha_frac": 0.5935913706,
"autogenerated": false,
"ratio": 3.944931163954944,
"config_test": tru... |
# awl.tests.test_decorators.py
import json
from django.test import TestCase
from django.http import Http404
from awl.decorators import post_required, json_post_required
from awl.waelsteng import FakeRequest
from logthing.utils import silence_logging
# =================================================================... | {
"repo_name": "cltrudeau/django-awl",
"path": "awl/tests/test_decorators.py",
"copies": "1",
"size": "2140",
"license": "mit",
"hash": 2906029003360464400,
"line_mean": 25.0975609756,
"line_max": 78,
"alpha_frac": 0.5869158879,
"autogenerated": false,
"ratio": 4.1233140655105975,
"config_test":... |
# awl.tests.test_models.py
from django.test import TestCase
from awl.models import Counter, Lock, Choices, QuerySetChain
from awl.utils import refetch
# ============================================================================
class ModelsTest(TestCase):
def test_counter(self):
count = Counter.objects... | {
"repo_name": "cltrudeau/django-awl",
"path": "awl/tests/test_models.py",
"copies": "1",
"size": "2311",
"license": "mit",
"hash": -3749828789788604400,
"line_mean": 31.0972222222,
"line_max": 78,
"alpha_frac": 0.5789701428,
"autogenerated": false,
"ratio": 3.923599320882852,
"config_test": tru... |
# awl.tests.test_tags.py
from django.template import Context, Template, TemplateSyntaxError
from django.test import TestCase
# ============================================================================
class TagTests(TestCase):
def test_getitem(self):
t = """
{% load awltags %}
... | {
"repo_name": "cltrudeau/django-awl",
"path": "awl/tests/test_tags.py",
"copies": "1",
"size": "3222",
"license": "mit",
"hash": -8698514844755571000,
"line_mean": 25.1951219512,
"line_max": 78,
"alpha_frac": 0.4671011794,
"autogenerated": false,
"ratio": 4.622668579626973,
"config_test": true,... |
# awl.utils.py
import django
from django.shortcuts import render
from django.template.loader import render_to_string
# =============================================================================
# Template Methods
# =============================================================================
def render_page(reque... | {
"repo_name": "cltrudeau/django-awl",
"path": "awl/utils.py",
"copies": "1",
"size": "6331",
"license": "mit",
"hash": -3260311376043815000,
"line_mean": 30.3415841584,
"line_max": 79,
"alpha_frac": 0.5569420313,
"autogenerated": false,
"ratio": 4.614431486880466,
"config_test": false,
"has_n... |
# A WORDGAME: HANGMAN
# STEP-1
# IS THE WORD GUESSED
def isWordGuessed(secretWord, lettersGuessed):
'''
secretWord: string, the word the user is guessing
lettersGuessed: list, what letters have been guessed so far
returns: boolean, True if all the letters of secretWord are in lettersGuessed;
Fal... | {
"repo_name": "iharsh234/MIT6.00x",
"path": "pset3-HANGMAN.py",
"copies": "1",
"size": "2900",
"license": "mit",
"hash": 1446708034525411000,
"line_mean": 29.5263157895,
"line_max": 104,
"alpha_frac": 0.6206896552,
"autogenerated": false,
"ratio": 3.7131882202304736,
"config_test": false,
"ha... |
""" A workbench. """
# Standard library imports.
import cPickle
import logging
import os
# Enthought library imports.
from enthought.etsconfig.api import ETSConfig
from enthought.pyface.api import NO
from enthought.traits.api import Bool, Callable, Event, HasTraits, implements
from enthought.traits.api import Instan... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/workbench.py",
"copies": "1",
"size": "13796",
"license": "bsd-3-clause",
"hash": -2213739650121388000,
"line_mean": 31.5377358491,
"line_max": 79,
"alpha_frac": 0.5742244129,
"autogenerated": false,
"ratio": 4.6326393552719... |
""" A workbench. """
# Standard library imports.
import cPickle
import logging
import os
# Enthought library imports.
from traits.etsconfig.api import ETSConfig
from pyface.api import NO
from traits.api import Bool, Callable, Event, HasTraits, provides
from traits.api import Instance, List, Unicode, Vetoable
from tr... | {
"repo_name": "pankajp/pyface",
"path": "pyface/workbench/workbench.py",
"copies": "2",
"size": "13741",
"license": "bsd-3-clause",
"hash": -1534057292314621400,
"line_mean": 31.5616113744,
"line_max": 79,
"alpha_frac": 0.5731751692,
"autogenerated": false,
"ratio": 4.645368492224476,
"config_t... |
""" A workbench window. """
# Standard library imports.
import logging
# Enthought library imports.
from enthought.pyface.api import ApplicationWindow, GUI
from enthought.traits.api import Callable, Constant, Delegate, Event, Instance
from enthought.traits.api import List, Str, Tuple, Unicode, Vetoable
from enthough... | {
"repo_name": "enthought/traitsgui",
"path": "enthought/pyface/workbench/workbench_window.py",
"copies": "1",
"size": "26889",
"license": "bsd-3-clause",
"hash": -1022087749600358400,
"line_mean": 28.4512595838,
"line_max": 79,
"alpha_frac": 0.5727249061,
"autogenerated": false,
"ratio": 4.386460... |
""" A workbench window. """
# Standard library imports.
import logging
# Enthought library imports.
from pyface.api import ApplicationWindow, GUI
from traits.api import Callable, Constant, Delegate, Event, Instance
from traits.api import List, Str, Tuple, Unicode, Vetoable
from traits.api import on_trait_change, pro... | {
"repo_name": "geggo/pyface",
"path": "pyface/workbench/workbench_window.py",
"copies": "1",
"size": "27525",
"license": "bsd-3-clause",
"hash": -6666478199119675000,
"line_mean": 28.5967741935,
"line_max": 80,
"alpha_frac": 0.5725340599,
"autogenerated": false,
"ratio": 4.383659818442427,
"con... |
# a worker factory class
# the worker has input "bind" (taking a tuple containing the bindantenna parameters)
# "pause"/"resume" (to control the eventmatcher taking keyboard/mouse events; the eventmatcher also checks that the bound hive has not been stopped)
# "stop" (taking a bindname), which ends the event dispatchi... | {
"repo_name": "agoose77/hivesystem",
"path": "bee/bind.py",
"copies": "1",
"size": "17026",
"license": "bsd-2-clause",
"hash": -3884199419341260000,
"line_mean": 34.7710084034,
"line_max": 148,
"alpha_frac": 0.5418183954,
"autogenerated": false,
"ratio": 4.334521384928717,
"config_test": false,... |
'''A worker that forks child processes'''
import os
import multiprocessing
import signal
from six import string_types
# Internal imports
from . import Worker
from qless import logger, util
from .serial import SerialWorker
try:
NUM_CPUS = multiprocessing.cpu_count()
except NotImplementedError:
NUM_CPUS = 1
... | {
"repo_name": "seomoz/qless-py",
"path": "qless/workers/forking.py",
"copies": "1",
"size": "4526",
"license": "mit",
"hash": 8261605187094205000,
"line_mean": 38.0172413793,
"line_max": 79,
"alpha_frac": 0.5399911622,
"autogenerated": false,
"ratio": 4.381413359148112,
"config_test": false,
... |
'''A worker that serially pops and complete jobs'''
import os
import time
from . import Worker
class SerialWorker(Worker):
'''A worker that just does serial work'''
def __init__(self, *args, **kwargs):
Worker.__init__(self, *args, **kwargs)
# The jid that we're working on at the moment
... | {
"repo_name": "seomoz/qless-py",
"path": "qless/workers/serial.py",
"copies": "1",
"size": "1417",
"license": "mit",
"hash": -6194362399200396000,
"line_mean": 31.9534883721,
"line_max": 80,
"alpha_frac": 0.5081157375,
"autogenerated": false,
"ratio": 4.36,
"config_test": false,
"has_no_keywo... |
""" A workflow that allows the user to explicitly specify the execution
order. This workflow serves as the immediate base class for the two most
important workflows: Dataflow and CyclicWorkflow."""
import sys
from StringIO import StringIO
from math import isnan
from types import NoneType
import networkx as nx
# pylin... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/sequentialflow.py",
"copies": "1",
"size": "54120",
"license": "mit",
"hash": 566789968887704060,
"line_mean": 37.5744832502,
"line_max": 88,
"alpha_frac": 0.5135624538,
"autogenerat... |
""" A workflow that contains cyclic graphs. Note that a special solver is
required to converge this workflow in order to execute it. """
import networkx as nx
from networkx.algorithms.components import strongly_connected_components
from numpy import ndarray, hstack, array, empty, arange, ones
from openmdao.main.array_h... | {
"repo_name": "DailyActie/Surrogate-Model",
"path": "01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/cyclicflow.py",
"copies": "1",
"size": "17577",
"license": "mit",
"hash": -4866855873278774000,
"line_mean": 38.7669683258,
"line_max": 126,
"alpha_frac": 0.5218182853,
"autogenerate... |
"""a work in progress"""
import datetime
from glob import glob
from json import dumps
from subprocess import call
import csv
from django.core.management.base import BaseCommand, CommandError
from disclosures.models import *
from disclosures.scripts import ipeds, prep_ipeds_csv
from django.conf import settings
DUMP =... | {
"repo_name": "ascott1/college-costs",
"path": "paying_for_college/management/commands/update_schools.py",
"copies": "1",
"size": "3242",
"license": "cc0-1.0",
"hash": -5079159984162549000,
"line_mean": 44.0277777778,
"line_max": 79,
"alpha_frac": 0.4734731647,
"autogenerated": false,
"ratio": 4.... |
"""a work in progress"""
import datetime
from glob import glob
from json import dumps
from subprocess import call
import csv
from django.core.management.base import BaseCommand, CommandError
from paying_for_college.models import *
# from paying_for_college.disclosures.scripts import ipeds, prep_ipeds_csv
from django.c... | {
"repo_name": "mistergone/college-costs",
"path": "paying_for_college/management/commands/update_schools.py",
"copies": "1",
"size": "3338",
"license": "cc0-1.0",
"hash": -5734028414267162000,
"line_mean": 42.3506493506,
"line_max": 80,
"alpha_frac": 0.4640503295,
"autogenerated": false,
"ratio":... |
"""A work in progress, that does not yet agree with JPL Horizons.
See https://github.com/brandon-rhodes/python-skyfield/issues/11
"""
from math import sin, cos
import math
from . import constants
# class to represent a point in the IC reference frame
class ICRCoordinates:
def __init__(self, x, y, z):
sel... | {
"repo_name": "ozialien/python-skyfield",
"path": "skyfield/keplerianlib.py",
"copies": "1",
"size": "4493",
"license": "mit",
"hash": 6911615577849703000,
"line_mean": 29.9862068966,
"line_max": 82,
"alpha_frac": 0.5635432896,
"autogenerated": false,
"ratio": 3.054384772263766,
"config_test": ... |
"""A wrapper around DBAPI-compliant databases to support iteration
and generator expression syntax for requests, instead of SQL
To get an iterator, initialize a connection to the database, then
set the cursor attribute of the query class to its cursor
Create an instance of Table for the tables you want to use
Then y... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/442447_Generator_expressions_database/recipe-442447.py",
"copies": "1",
"size": "11312",
"license": "mit",
"hash": -698589182922652800,
"line_mean": 35.4903225806,
"line_max": 88,
"alpha_frac": 0.5675388967,
"autogenerated": false,
"ratio"... |
"""A wrapper around DBAPI-compliant databases to support iteration
and list comprehension syntax for requests, instead of SQL
To get an iterator, initialize a connection to the database, then
tbl = Table(connection,table_name)
returns an iterator that yields records (instances of the generic
class Record) whose attr... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/440653_List_comprehensions_database/recipe-440653.py",
"copies": "1",
"size": "2335",
"license": "mit",
"hash": 4595656524586180000,
"line_mean": 30.5540540541,
"line_max": 70,
"alpha_frac": 0.6107066381,
"autogenerated": false,
"ratio": 4... |
"""A wrapper around FFMPEG to output audio files."""
from os.path import expanduser, basename, isfile, isdir, join
from threading import Thread
from itertools import chain
from PIL import Image
from tqdm import tqdm
import http.client
import subprocess
import functools
import operator
import platform
import tempfile
im... | {
"repo_name": "milkey-mouse/swood",
"path": "swood/ffmpeg.py",
"copies": "1",
"size": "24148",
"license": "mit",
"hash": 4667370112180842000,
"line_mean": 39.6531986532,
"line_max": 154,
"alpha_frac": 0.4916763293,
"autogenerated": false,
"ratio": 4.420281896393923,
"config_test": false,
"has... |
"""A wrapper around netCDF4 to make its objects serialisable.
Objects in this module should work the same as the corresponding ones in
in netCDF4. The only differences are (should be):
* Objects have some extra attributes which can't then be used as netCDF4
attributes (these are all '_'-prefixed).
* Some return... | {
"repo_name": "cedadev/ipython_project",
"path": "nc_ipython/nc_ipython/ncserialisable.py",
"copies": "1",
"size": "14895",
"license": "bsd-3-clause",
"hash": 2302732165469176800,
"line_mean": 31.1727861771,
"line_max": 79,
"alpha_frac": 0.6139644176,
"autogenerated": false,
"ratio": 4.0897858319... |
# A wrapper around Python streams
#
# Rationale:
# * Cannot always seek backwards on a stream, which the parser needs
# * I got tired of checking for EOF after every single read instead of
# letting an exception handler take care of it. The idea here is,
# if I forget to check for EOF, I want an exception... | {
"repo_name": "furrykef/yapscheme",
"path": "yapscheme/MyStream.py",
"copies": "1",
"size": "1387",
"license": "mit",
"hash": 2013214387379039200,
"line_mean": 26.8958333333,
"line_max": 71,
"alpha_frac": 0.5839942322,
"autogenerated": false,
"ratio": 4.008670520231214,
"config_test": false,
... |
"""A wrapper around requests that records all requests made with it.
Supports get, put, post, delete and request
all calls return an instance of HarvesterResponse
"""
from __future__ import absolute_import
import json
import time
import logging
import functools
from datetime import datetime
import furl
import... | {
"repo_name": "icereval/scrapi",
"path": "scrapi/requests.py",
"copies": "1",
"size": "3907",
"license": "apache-2.0",
"hash": 5394089912384210000,
"line_mean": 29.0538461538,
"line_max": 109,
"alpha_frac": 0.6826209368,
"autogenerated": false,
"ratio": 4.019547325102881,
"config_test": false,
... |
# A wrapper around scipy.spatial's kdtree to make it look like
# the python rtree / spatialindex implementation
from scipy.spatial import KDTree
class RtreeKDTree(object):
""" wrap scipy KDTree spatial index to look as much like Rtree class
as possible
"""
def __init__(self,stream,interleaved=False):... | {
"repo_name": "rustychris/stompy",
"path": "stompy/spatial/kdtree_spatialindex.py",
"copies": "1",
"size": "2380",
"license": "mit",
"hash": 3406964203861511000,
"line_mean": 33,
"line_max": 95,
"alpha_frac": 0.5798319328,
"autogenerated": false,
"ratio": 3.7362637362637363,
"config_test": fals... |
"""A wrapper around ``shotgun_api3`` to allow for parallel requests.
The standard Shotgun API uses a connection object that serialized requests.
Therefore, efficient usage in a multi-threaded environment is tricker than it
could be. Ergo, this module was concieved.
:class:`ShotgunPool` is a connection pool that creat... | {
"repo_name": "westernx/sgsession",
"path": "sgsession/pool.py",
"copies": "1",
"size": "3839",
"license": "bsd-3-clause",
"hash": -3305320466625931000,
"line_mean": 28.7596899225,
"line_max": 94,
"alpha_frac": 0.6509507684,
"autogenerated": false,
"ratio": 4.163774403470716,
"config_test": fal... |
"""A wrapper around some baisc matplotlib functionality to ease plotting.
See:
https://github.com/knstmrd/SanePlot
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__fil... | {
"repo_name": "knstmrd/SanePlot",
"path": "setup.py",
"copies": "1",
"size": "3677",
"license": "mpl-2.0",
"hash": 4829954399500653000,
"line_mean": 35.78,
"line_max": 94,
"alpha_frac": 0.6807179766,
"autogenerated": false,
"ratio": 4.0719822812846065,
"config_test": false,
"has_no_keywords":... |
"""A wrapper around SQLite for dlex and dlexd state
See DLEXDB class docstring for usage.
"""
import sqlite3
import json
from typing import Dict, Any, List # pylint: disable=unused-import
from typing import Tuple, Union # pylint: disable=unused-import
def _defs_sql_to_json(rows):
# type: (List[Tuple[int, str, s... | {
"repo_name": "sagelywizard/dlex",
"path": "db.py",
"copies": "1",
"size": "7698",
"license": "apache-2.0",
"hash": 247266512220759330,
"line_mean": 32.3246753247,
"line_max": 79,
"alpha_frac": 0.5267601975,
"autogenerated": false,
"ratio": 4.28857938718663,
"config_test": false,
"has_no_keyw... |
# A wrapper around the (optional) built-in class dbm, supporting keys
# and values of almost any type instead of just string.
# (Actually, this works only for keys and values that can be read back
# correctly after being converted to a string.)
class Dbm:
def __init__(self, filename, mode, perm):
import ... | {
"repo_name": "OS2World/APP-INTERNET-torpak_2",
"path": "Demo/classes/Dbm.py",
"copies": "1",
"size": "1546",
"license": "mit",
"hash": -3150377019778238500,
"line_mean": 22.4242424242,
"line_max": 70,
"alpha_frac": 0.4773609314,
"autogenerated": false,
"ratio": 3.8267326732673266,
"config_test... |
# A wrapper around the (optional) built-in class dbm, supporting keys
# and values of almost any type instead of just string.
# (Actually, this works only for keys and values that can be read back
# correctly after being converted to a string.)
class Dbm:
def __init__(self, filename, mode, perm):
... | {
"repo_name": "hwu25/AppPkg",
"path": "Applications/Python/Python-2.7.2/Demo/classes/Dbm.py",
"copies": "6",
"size": "1640",
"license": "bsd-2-clause",
"hash": 2629028449509821400,
"line_mean": 22.8484848485,
"line_max": 70,
"alpha_frac": 0.4682926829,
"autogenerated": false,
"ratio": 3.990267639... |
"""A wrapper around the PX-Web API.
As implementations and versions vary, this is best used as a base class,
for more specific scrapers to extend.
If used directly, an API endpoint must be set:
scraper = PXWeb(base_url="http://api.example.com/")
# ...or:
scraper = PXWeb()
scraper.base_url = "http://ap... | {
"repo_name": "jplusplus/statscraper",
"path": "statscraper/scrapers/PXWebScraper.py",
"copies": "1",
"size": "3664",
"license": "mit",
"hash": 8709023973254740000,
"line_mean": 33.5660377358,
"line_max": 84,
"alpha_frac": 0.5477620087,
"autogenerated": false,
"ratio": 4.163636363636364,
"confi... |
"""A wrapper around the SCB API."""
from .PXWebScraper import PXWeb, Dimension
class SCB(PXWeb):
"""The SCB API uses PXWeb. We just hardcode the url."""
base_url = 'http://api.scb.se/OV0104/v1/doris/sv/ssd'
COUNTIES = [
"01", "03", "04", "05", "06", "07", "08", "09", "10", "12", "13",
"14... | {
"repo_name": "jplusplus/statscraper",
"path": "statscraper/scrapers/SCBScraper.py",
"copies": "1",
"size": "3926",
"license": "mit",
"hash": -1552168169614894600,
"line_mean": 55.0714285714,
"line_max": 79,
"alpha_frac": 0.476433121,
"autogenerated": false,
"ratio": 2.535529715762274,
"config_... |
'''A wrapper class for scheduled optimizer '''
import numpy as np
class ScheduledOptim():
'''A simple wrapper class for learning rate scheduling'''
def __init__(self, optimizer, lr_mul, d_model, n_warmup_steps):
self._optimizer = optimizer
self.lr_mul = lr_mul
self.d_model = d_model
... | {
"repo_name": "jadore801120/attention-is-all-you-need-pytorch",
"path": "transformer/Optim.py",
"copies": "1",
"size": "1135",
"license": "mit",
"hash": 9193471434167963000,
"line_mean": 27.375,
"line_max": 93,
"alpha_frac": 0.5929515419,
"autogenerated": false,
"ratio": 3.503086419753086,
"con... |
"""A wrapper class for the football-data API"""
import os
import requests
class APIWrapper(object):
def __init__(self, base_url=None, auth_token=None):
if base_url:
self.base_url = base_url
else:
self.base_url = "http://api.football-data.org/v1"
if auth_token:
... | {
"repo_name": "conormag94/pyscores",
"path": "pyscores/api_wrapper.py",
"copies": "1",
"size": "4830",
"license": "mit",
"hash": -905967356118287900,
"line_mean": 32.5416666667,
"line_max": 87,
"alpha_frac": 0.5886128364,
"autogenerated": false,
"ratio": 3.888888888888889,
"config_test": false,... |
""" a wrapper class for the statuspage.io api"""
import logging
import requests
PRIVATE_API_URL = 'https://api.statuspage.io/v2/pages/'
class StatusPageApiError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return repr(self.msg)
class StatusPagePage(object):
... | {
"repo_name": "srgrn/pystatuspage",
"path": "pystatuspage/_api.py",
"copies": "1",
"size": "6219",
"license": "bsd-2-clause",
"hash": -6088709322594692000,
"line_mean": 41.8896551724,
"line_max": 225,
"alpha_frac": 0.6200353755,
"autogenerated": false,
"ratio": 3.94106463878327,
"config_test": ... |
"""A wrapper for an RNN cell that encodes context."""
import tensorflow as tf
import math
from collections import namedtuple
from tensorflow.contrib.rnn import RNNCell, LSTMStateTuple
class ContextState(namedtuple("ContextState", ("cell_state", "time"))):
def clone(self, **kwargs):
return super()._replac... | {
"repo_name": "crestonbunch/neural-namer",
"path": "modeler/context.py",
"copies": "1",
"size": "2802",
"license": "mit",
"hash": 2218118914803244000,
"line_mean": 36.36,
"line_max": 78,
"alpha_frac": 0.5735189151,
"autogenerated": false,
"ratio": 4.2778625954198475,
"config_test": false,
"ha... |
# A wrapper for easily accessing the LUCID data API and fetching data
try:
import urllib2 as urllib
except ImportError:
# For Python 3+
import urllib.request as urllib
import numpy as np
import json
BASE_PATH = "http://starserver.thelangton.org.uk/lucid-data-browser/api/"
def get_data_files(run = None):
stream =... | {
"repo_name": "calhewitt/lucid-utils",
"path": "lucid_utils/data_api.py",
"copies": "2",
"size": "2072",
"license": "mit",
"hash": -5406944757712055000,
"line_mean": 29.9253731343,
"line_max": 86,
"alpha_frac": 0.6858108108,
"autogenerated": false,
"ratio": 3.0470588235294116,
"config_test": fa... |
"""A wrapper for git that makes using git in python through pygit2 easiergit_helpers
repo is of type pygit2.Repository
"""
import os
import pygit2
class GitException(Exception):
def __init__(self, message):
self.message = message
def clone_or_update_repo(github_repo, account, target_path):
if no... | {
"repo_name": "AnalysisBots/runtime",
"path": "scripts/git_wrapper.py",
"copies": "1",
"size": "1713",
"license": "mit",
"hash": -1900145230637523500,
"line_mean": 29.0526315789,
"line_max": 84,
"alpha_frac": 0.6491535318,
"autogenerated": false,
"ratio": 3.8236607142857144,
"config_test": fals... |
'''A wrapper for netCDF4.Dataset and MFnetCDF4.Dataset
possible uses include:
with an input of a string:
nc = pyroms.Dataset(file) # returns netCDF4.Dataset object based on file
nc = pyroms.MFDataset(file) # returns MFnetCDF4.Dataset object based on file (with wildcard chars)
with an input of a list of files:
... | {
"repo_name": "simion1232006/pyroms",
"path": "pyroms/Dataset.py",
"copies": "1",
"size": "2990",
"license": "bsd-3-clause",
"hash": 2828466856321724400,
"line_mean": 35.9259259259,
"line_max": 105,
"alpha_frac": 0.6401337793,
"autogenerated": false,
"ratio": 3.8780804150453956,
"config_test": ... |
"""A wrapper for NumPy functions"""
import numpy as np
import math
epsilon = 1e-7 # An arbitrary small distance -- use for floating comparison
pi = math.pi
def vector(*components):
return np.array(components)
norm = np.linalg.norm
dot = np.dot
cross = np.cross
abs = np.vectorize(math.fabs)
# wrap index lookups in... | {
"repo_name": "cwclemens/pytracer",
"path": "vecmath.py",
"copies": "1",
"size": "1248",
"license": "mit",
"hash": -4802751760536355000,
"line_mean": 23.4705882353,
"line_max": 75,
"alpha_frac": 0.6121794872,
"autogenerated": false,
"ratio": 3.0217917675544794,
"config_test": false,
"has_no_k... |
"""A wrapper for pybullet to manage different clients."""
from __future__ import absolute_import
from __future__ import division
import functools
import inspect
import pybullet
class BulletClient(object):
"""A wrapper for pybullet to manage different clients."""
def __init__(self, connection_mode=None):
"""C... | {
"repo_name": "MadManRises/Madgine",
"path": "shared/bullet3-2.89/examples/pybullet/gym/pybullet_utils/bullet_client.py",
"copies": "1",
"size": "1844",
"license": "mit",
"hash": 6645515908688744000,
"line_mean": 30.7931034483,
"line_max": 78,
"alpha_frac": 0.6513015184,
"autogenerated": false,
"... |
""" A wrapper for the WinSparkle project
"""
from ctypes import cdll, c_char_p, c_wchar_p, c_int16, c_int64, CFUNCTYPE
import os
import sys
import platform
# this python is 64bit or 32bit? Need to know to choose the right library to load
architecture, _ = platform.architecture()
if architecture == "64bit":
LIB_FO... | {
"repo_name": "dyer234/pywinsparkle",
"path": "pywinsparkle/pywinsparkle.py",
"copies": "1",
"size": "16162",
"license": "mit",
"hash": 5611624952703331000,
"line_mean": 36.3256351039,
"line_max": 86,
"alpha_frac": 0.718104195,
"autogenerated": false,
"ratio": 3.7507542353214203,
"config_test":... |
"""A wrapper for the Yahoo! Finance YQL api."""
import sys, httplib, urllib
try: import simplejson as json
except ImportError: import json
PUBLIC_API_URL = 'http://query.yahooapis.com/v1/public/yql'
DATATABLES_URL = 'store://datatables.org/alltableswithkeys'
HISTORICAL_URL = 'http://ichart.finance.yahoo.com/table.cs... | {
"repo_name": "pettersoderlund/fondout",
"path": "script/StockScraper-master/stockretriever.py",
"copies": "1",
"size": "4933",
"license": "bsd-3-clause",
"hash": -8402656506400337000,
"line_mean": 28.3630952381,
"line_max": 85,
"alpha_frac": 0.6667342388,
"autogenerated": false,
"ratio": 3.25181... |
"""A wrapper for using Python to interact with a Lego Mindstorms EV3.
Prerequisites:
Make sure your sdp includes an SP (serial port):
% sdptool browse local
...
Service Name: Serial Port
Service Description: COM Port
If not:
% sdptool add SP
Then:
% hcitool scan
... | {
"repo_name": "inductivekickback/ev3",
"path": "ev3/ev3.py",
"copies": "1",
"size": "6246",
"license": "mit",
"hash": -4740151312329437000,
"line_mean": 32.0476190476,
"line_max": 80,
"alpha_frac": 0.5422670509,
"autogenerated": false,
"ratio": 4.439232409381663,
"config_test": false,
"has_no... |
"""A wrapper for various shell based functions found in the os & shutil modules."""
import os
import shutil
import platform
import tarfile
import hashlib
import sys
__author__ = 'PencilShavings'
__version__ = '0.0.9'
def system():
kernel = platform.system()
if kernel == 'Linux':
return 'Linux'
elif kernel == '... | {
"repo_name": "PencilShavings/python-osutil",
"path": "osutil.py",
"copies": "1",
"size": "5292",
"license": "mit",
"hash": 6167087796794487000,
"line_mean": 17.0614334471,
"line_max": 94,
"alpha_frac": 0.630952381,
"autogenerated": false,
"ratio": 2.8044515103338634,
"config_test": false,
"h... |
"""A wrapper for wit.ai's Duckling.
See:
https://github.com/wit-ai/duckling
"""
from setuptools import setup
setup(
name='duckling',
version='1.8.0',
description='A wrapper for wit.ai\'s Duckling',
url='https://github.com/FraBle/python-duckling',
author='Frank Blechschmidt',
author_email='fr... | {
"repo_name": "FraBle/python-duckling",
"path": "setup.py",
"copies": "1",
"size": "1731",
"license": "apache-2.0",
"hash": -577209976741231000,
"line_mean": 29.9107142857,
"line_max": 61,
"alpha_frac": 0.5713460427,
"autogenerated": false,
"ratio": 3.4345238095238093,
"config_test": false,
"... |
"""A wrapper 'hub' for the Litter-Robot API and base entity for common attributes."""
from datetime import time, timedelta
import logging
from types import MethodType
from typing import Any, Optional
import pylitterbot
from pylitterbot.exceptions import LitterRobotException, LitterRobotLoginException
from homeassista... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/components/litterrobot/hub.py",
"copies": "1",
"size": "3931",
"license": "mit",
"hash": -295975371711986700,
"line_mean": 31.4876033058,
"line_max": 94,
"alpha_frac": 0.6283388451,
"autogenerated": false,
"ratio": 4.1730360934... |
"""A wrapper 'hub' for the Litter-Robot API and base entity for common attributes."""
from __future__ import annotations
from datetime import time, timedelta
import logging
from types import MethodType
from typing import Any
import pylitterbot
from pylitterbot.exceptions import LitterRobotException, LitterRobotLoginE... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/components/litterrobot/hub.py",
"copies": "3",
"size": "4015",
"license": "mit",
"hash": 1225663196652504800,
"line_mean": 30.8650793651,
"line_max": 94,
"alpha_frac": 0.6196762142,
"autogenerated": false,
"ratio": 4.191022964509... |
"""A wrapper 'hub' for the Litter-Robot API."""
from datetime import timedelta
import logging
from pylitterbot import Account
from pylitterbot.exceptions import LitterRobotException, LitterRobotLoginException
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
fro... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/litterrobot/hub.py",
"copies": "2",
"size": "1881",
"license": "apache-2.0",
"hash": 3735812257483934700,
"line_mean": 31.4310344828,
"line_max": 82,
"alpha_frac": 0.6289207868,
"autogenerated": false,
"ratio": 4.354... |
"""A wrapper of the ciphers module.
Provides higher-level functions to do en/decryption with RSA key or password.
The encrypted data contains it's own metadata format.
"""
import base64 as b64
import struct
from enum import IntEnum
from Crypto import Random
import ciphers
import time
import version
class Type(IntEnum... | {
"repo_name": "tingtingths/cipherhelper",
"path": "helper.py",
"copies": "1",
"size": "5729",
"license": "mit",
"hash": -541658362040553800,
"line_mean": 35.0314465409,
"line_max": 94,
"alpha_frac": 0.625589108,
"autogenerated": false,
"ratio": 3.1357416529830324,
"config_test": false,
"has_n... |
"""A wrapper of the motif discovery tool GLAM2."""
import os
from subprocess import PIPE, Popen
import commands
from utilities import MotifWrapper, MuscleAlignWrapper
from Bio.Alphabet import IUPAC
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class Glam2(MotifWrapper):
"... | {
"repo_name": "fabriziocosta/pyMotif",
"path": "glam2_wrapper.py",
"copies": "1",
"size": "11744",
"license": "mit",
"hash": -7864925974869934000,
"line_mean": 33.4398826979,
"line_max": 114,
"alpha_frac": 0.5442779292,
"autogenerated": false,
"ratio": 3.831647634584013,
"config_test": false,
... |
"""A wrapper of the motif discovery tool MEME."""
import os
from subprocess import PIPE, Popen
from Bio import motifs
from utilities import MotifWrapper
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class Meme(MotifWrapper):
"""
Wrapper for MEME 4.11.0.
Usage: mem... | {
"repo_name": "fabriziocosta/pyMotif",
"path": "meme_wrapper.py",
"copies": "1",
"size": "13586",
"license": "mit",
"hash": -6643268100453979000,
"line_mean": 31.1182033097,
"line_max": 79,
"alpha_frac": 0.5131753275,
"autogenerated": false,
"ratio": 3.849815811844715,
"config_test": false,
"... |
""" A wrapper to get the needed preferences application wide """
# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and
# University Hospital Center and University of Lausanne (UNIL-CHUV)
#
# Modified BSD License
# Standard library imports
from os.path import join
import pkg_resources
# Enthou... | {
"repo_name": "LTS5/connectomeviewer",
"path": "cviewer/plugins/ui/preference_manager.py",
"copies": "1",
"size": "4244",
"license": "bsd-3-clause",
"hash": -4901541246680778000,
"line_mean": 36.5575221239,
"line_max": 87,
"alpha_frac": 0.5226201697,
"autogenerated": false,
"ratio": 5.12560386473... |
# A wrapper to serialize data read from/written to leveldb in json
import leveldb
import json
class JsonLevelDB(object):
def __init__(self, filename, **kwargs):
self._filename = filename
self._db = leveldb.LevelDB(self._filename, **kwargs)
def Get(self, key, verify_checksums = False, fill_... | {
"repo_name": "postfix/pLSH-HDC",
"path": "jsonleveldb.py",
"copies": "2",
"size": "1472",
"license": "mit",
"hash": 637655657867066500,
"line_mean": 34.0476190476,
"line_max": 143,
"alpha_frac": 0.6216032609,
"autogenerated": false,
"ratio": 3.496437054631829,
"config_test": false,
"has_no_k... |
"""A wrapper to use IOCTL_SCSI_PASS_THROUGH_DIRECT"""
from comtypes import GUID
from ctypes import *
from ctypes.wintypes import *
import string
import sys
from win32file import *
from . import *
from .. import *
IOCTL_SCSI_PASS_THROUGH_DIRECT = 0x4d014
IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2d1080
SCSI_IOCTL_DATA_OUT... | {
"repo_name": "ma1co/Sony-PMCA-RE",
"path": "pmca/usb/driver/windows/msc.py",
"copies": "1",
"size": "7748",
"license": "mit",
"hash": -6787411947013366000,
"line_mean": 32.9824561404,
"line_max": 177,
"alpha_frac": 0.7368353123,
"autogenerated": false,
"ratio": 3.1406566680178356,
"config_test... |
"""A wrapper to use libusb. Default on linux, on Windows you have to install a generic driver for your camera"""
import sys
import usb.core
import usb.util
from . import *
class _UsbContext(object):
def __init__(self, name, classType, driverClass):
self.name = 'libusb-%s' % name
self.classType = classType
sel... | {
"repo_name": "ma1co/Sony-PMCA-RE",
"path": "pmca/usb/driver/generic/libusb.py",
"copies": "1",
"size": "1935",
"license": "mit",
"hash": -8503516193124949000,
"line_mean": 23.4936708861,
"line_max": 112,
"alpha_frac": 0.7023255814,
"autogenerated": false,
"ratio": 3.2796610169491527,
"config_t... |
"""A wrapper to use the Windows Portable Device Api (WPD)"""
import comtypes
from comtypes import GUID
from comtypes.automation import *
from comtypes.client import *
from ctypes import *
from . import *
from .. import *
# Create and import the python comtypes wrapper for the needed DLLs
comtypes.client._generate.__... | {
"repo_name": "ma1co/Sony-PMCA-RE",
"path": "pmca/usb/driver/windows/wpd.py",
"copies": "1",
"size": "6904",
"license": "mit",
"hash": 8520401993981031000,
"line_mean": 35.3368421053,
"line_max": 135,
"alpha_frac": 0.7555040556,
"autogenerated": false,
"ratio": 3.0440917107583774,
"config_test"... |
AWS_ACCESS_KEY_ID = None
AWS_SECRET_ACCESS_KEY = None
AWS_STORAGE_BUCKET_NAME = None
DB_PASSWORD = None
GAUGES_SITE_ID = None
GOOGLE_ANALYTICS_PROPERTY_ID = None
INTERCOM_APP_ID = None
DROPBOX_APP_KEY = None
DROPBOX_APP_SECRET = None
TWITTER_APP_KEY = None
TWITTER_APP_SECRET = None
FACEBOOK_APP_KEY = None
FACEBOOK_APP_... | {
"repo_name": "hobson/totalgood",
"path": "totalgood/envs/keys_and_passwords.py",
"copies": "1",
"size": "1147",
"license": "mit",
"hash": -1811492752965442600,
"line_mean": 27.675,
"line_max": 99,
"alpha_frac": 0.7367044464,
"autogenerated": false,
"ratio": 2.8964646464646466,
"config_test": f... |
"""AWS Adapter marker implementations."""
from ...abstract_osid.osid import sessions as abc_osid_sessions
class OsidSession(abc_osid_sessions.OsidSession):
"""The ``OsidSession`` is the top level interface for all OSID sessions.
An ``OsidSession`` is created through its corresponding
``OsidManager``. A n... | {
"repo_name": "mitsei/dlkit",
"path": "dlkit/aws_adapter/osid/sessions.py",
"copies": "1",
"size": "7356",
"license": "mit",
"hash": -6605634281866170000,
"line_mean": 37.9206349206,
"line_max": 94,
"alpha_frac": 0.6661228929,
"autogenerated": false,
"ratio": 4.697318007662835,
"config_test": f... |
"""AWS Adapter marker implementations."""
# pylint: disable=no-init
# most markers will not be initted
# pylint: disable=too-few-public-methods
# they are markers
from ...abstract_osid.osid import markers as abc_osid_markers
from ..types import FILESYSTEM_ASSET_CONTENT_RECORD_TYPE
class OsidPrimitive(abc_osid_... | {
"repo_name": "mitsei/dlkit",
"path": "dlkit/filesystem_adapter/osid/markers.py",
"copies": "1",
"size": "16630",
"license": "mit",
"hash": 3230356095216234500,
"line_mean": 36.454954955,
"line_max": 86,
"alpha_frac": 0.6604329525,
"autogenerated": false,
"ratio": 4.480064655172414,
"config_tes... |
"""AWS Adapter osid manager implementations."""
from ...abstract_osid.osid import managers as abc_osid_managers
from ..osid import markers as osid_markers
from ..primitives import Id
from ..osid.osid_errors import NullArgument, IllegalState, NotFound
class OsidProfile(abc_osid_managers.OsidProfile, osid_markers.Sour... | {
"repo_name": "mitsei/dlkit",
"path": "dlkit/filesystem_adapter/osid/managers.py",
"copies": "1",
"size": "15376",
"license": "mit",
"hash": 1987523817574096100,
"line_mean": 38.9376623377,
"line_max": 100,
"alpha_frac": 0.6564125911,
"autogenerated": false,
"ratio": 4.559905100830368,
"config_... |
"""AWS Adapter osid objects implementations."""
# pylint: disable=too-many-ancestors
# number of ancestors defined in spec
from ...abstract_osid.osid import objects as abc_osid_objects
from ..osid import markers as osid_markers
from .osid_errors import OperationFailed, IllegalState
class OsidObject(abc_osid_obje... | {
"repo_name": "mitsei/dlkit",
"path": "dlkit/filesystem_adapter/osid/objects.py",
"copies": "1",
"size": "32187",
"license": "mit",
"hash": 7261947109238465000,
"line_mean": 37.9201934704,
"line_max": 86,
"alpha_frac": 0.6641190543,
"autogenerated": false,
"ratio": 4.4586507826568775,
"config_t... |
# awsauth.py for Interoute Object Storage
# See the repo: https://github.com/Interoute/object-storage-api
#
# Source for this file: https://pypi.python.org/pypi/requests-aws/0.1.8
# See also: https://github.com/tax/python-requests-aws
#
# This code provides a class S3Auth to generate authorisation data which can be use... | {
"repo_name": "Interoute/object-storage-api",
"path": "awsauth.py",
"copies": "1",
"size": "7625",
"license": "apache-2.0",
"hash": -5941602141055508000,
"line_mean": 36.9353233831,
"line_max": 94,
"alpha_frac": 0.5980327869,
"autogenerated": false,
"ratio": 4.139522258414766,
"config_test": fa... |
""" AWS backed File and FileMap implementations. """
try:
from collections import abc as collections
except ImportError:
import collections
import os
import re
import boto3
import botocore
from . import furifile
from . import utils
# pylint: disable=too-few-public-methods
class S3File(furifile.RemoteFile):
... | {
"repo_name": "amancevice/furi",
"path": "furi/aws.py",
"copies": "1",
"size": "4931",
"license": "mit",
"hash": -1394551844628239000,
"line_mean": 31.4407894737,
"line_max": 79,
"alpha_frac": 0.5576962077,
"autogenerated": false,
"ratio": 4.098919368246052,
"config_test": false,
"has_no_keyw... |
"""AWS Cloud Provider for bcbiovm."""
# pylint: disable=no-self-use
import os
from bcbio.distributed import objectstore
from bcbiovm import log as logging
from bcbiovm.common import objects
from bcbiovm.common import constant
from bcbiovm.common import utils as common_utils
from bcbiovm.provider import base
from bcb... | {
"repo_name": "alexandrucoman/bcbio-nextgen-vm",
"path": "bcbiovm/provider/aws/aws_provider.py",
"copies": "1",
"size": "11389",
"license": "mit",
"hash": 1468679760924634400,
"line_mean": 40.7179487179,
"line_max": 78,
"alpha_frac": 0.6166476425,
"autogenerated": false,
"ratio": 4.15656934306569... |
'''aws cromwell runner'''
import os
import json
import tempfile
import logging
import yaml
import utils.pipeline
def filter_list(alist, blist):
'''remove blist from alist'''
return list(set(alist)-set(blist))
def get_cwl_steps(cwlwf):
'''get cwl steps names'''
cwl = dict()
with open(cwlwf, 'r') a... | {
"repo_name": "uc-cdis/cwl",
"path": "genomel/aws/utils/runner.py",
"copies": "1",
"size": "15387",
"license": "apache-2.0",
"hash": 2256280260928682500,
"line_mean": 41.6232686981,
"line_max": 96,
"alpha_frac": 0.5685968675,
"autogenerated": false,
"ratio": 3.6145172656800564,
"config_test": f... |
"""AWS Data collected from imdaws.com
"""
import sys
import scraperwiki
import lxml.html
import datetime
utils = scraperwiki.utils.swimport("utils")
utils.save.unique_keys = ['station_name', 'date', 'time_gmt_']
@utils.cache
def get_data(date):
print "Processing", date
# getting by hour because Scrperwiki i... | {
"repo_name": "sramana/scraperwiki-scripts",
"path": "weather_aws_data.py",
"copies": "1",
"size": "1095",
"license": "unlicense",
"hash": -5280033841705037000,
"line_mean": 27.8157894737,
"line_max": 107,
"alpha_frac": 0.6273972603,
"autogenerated": false,
"ratio": 3.2882882882882885,
"config_... |
import time
import logging
import json
import datetime
from boto import sns, sqs
import pytz
VALID_RESOURCE_STATES = ['UPDATE_COMPLETE', 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS']
class Notifier(object):
def __init__(self, sns_region='eu-west-1'):
self.logger = logging.getLogger(__name__)
self.sns_c... | {
"repo_name": "ImmobilienScout24/aws-deployment-notifier",
"path": "src/main/python/dnot/__init__.py",
"copies": "1",
"size": "4567",
"license": "apache-2.0",
"hash": 3866188515564869000,
"line_mean": 42.9134615385,
"line_max": 119,
"alpha_frac": 0.6152835559,
"autogenerated": false,
"ratio": 4.0... |
# AWS Documentation: https://goo.gl/0wpSJm
import json
import os
import re
import time
import requests
from datetime import datetime
dt_now = datetime.utcnow().strftime('%Y%m%d-%H%M%S')
def create_snapshot(endpoint):
print('Creating snapshot...')
requests.put('https://{0}/_snapshot/weblogs-index-backups/{1}... | {
"repo_name": "jpdoria/aws_eis",
"path": "aws_eis_lambda/aws_eis_lambda.py",
"copies": "1",
"size": "2409",
"license": "mit",
"hash": -8608597325103967000,
"line_mean": 29.4936708861,
"line_max": 79,
"alpha_frac": 0.5931921959,
"autogenerated": false,
"ratio": 3.628012048192771,
"config_test": ... |
"""AWS Elasticsearch Service.
Blueprint to configure AWS Elasticsearch service.
Example::
- name: elasticsearch
class_path: stacker_blueprints.elasticsearch.Domain
variables:
Roles:
- ${empireMinion::IAMRole}
InternalZoneId: ${vpc::InternalZoneId}
InternalZoneName: $... | {
"repo_name": "remind101/stacker_blueprints",
"path": "stacker_blueprints/elasticsearch.py",
"copies": "1",
"size": "6543",
"license": "bsd-2-clause",
"hash": 2862464455883480600,
"line_mean": 30.7621359223,
"line_max": 79,
"alpha_frac": 0.5153599266,
"autogenerated": false,
"ratio": 4.6012658227... |
''' a wsgi adaptor for webi application '''
from wsgiref.util import FileWrapper
status_codes = {
200: 'OK',
403: 'Forbidden',
}
def webi_2_wsgi_status(status):
'''
given an integer status code used by webi, return wsgi compatible status code with description
>>> webi_2_wsgi_status(200)
'200 OK'
'''
... | {
"repo_name": "web-i/ripplet",
"path": "ripple/adaptors/wsgi.py",
"copies": "1",
"size": "1425",
"license": "mit",
"hash": 7208136913303009000,
"line_mean": 29.3191489362,
"line_max": 96,
"alpha_frac": 0.6435087719,
"autogenerated": false,
"ratio": 3.635204081632653,
"config_test": false,
"ha... |
"""A WSGI and HTTP server for use **during development only**. This
server is convenient to use, but is not designed to be particularly
stable, secure, or efficient. Use a dedicate WSGI server and HTTP
server when deploying to production.
It provides features like interactive debugging and code reloading. Use
``run_si... | {
"repo_name": "pallets/werkzeug",
"path": "src/werkzeug/serving.py",
"copies": "1",
"size": "38030",
"license": "bsd-3-clause",
"hash": -5587584559985675000,
"line_mean": 34.2455977757,
"line_max": 88,
"alpha_frac": 0.5810938733,
"autogenerated": false,
"ratio": 4.132348147343258,
"config_test"... |
"""A WSGI application that offers Basic Auth capabilities.
.. warning::
This is an early version of this module. It has no tests, limited
documentation, and is subject to major changes.
.. warning::
This is HTTP Basic Auth, so the password will be transmitted in the
clear. You definitely should be u... | {
"repo_name": "gholt/python-brim",
"path": "brim/wsgi_basic_auth.py",
"copies": "1",
"size": "10730",
"license": "apache-2.0",
"hash": -4709829022503458000,
"line_mean": 42.9754098361,
"line_max": 78,
"alpha_frac": 0.518639329,
"autogenerated": false,
"ratio": 4.593321917808219,
"config_test": ... |
"""AWS Helper Classes"""
import logging
import os
import time
import uuid
from collections import defaultdict
import boto3
import botocore
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Dict, List, Optional, Tuple # noqa
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Setup s... | {
"repo_name": "loads/ardere",
"path": "ardere/aws.py",
"copies": "1",
"size": "28405",
"license": "mpl-2.0",
"hash": 745430926913055600,
"line_mean": 36.8229027963,
"line_max": 108,
"alpha_frac": 0.5531420525,
"autogenerated": false,
"ratio": 4.006346967559944,
"config_test": true,
"has_no_ke... |
"""aws_helper.py:
Helper functions are here.
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2017-, Dilawar Singh"
__version__ = "1.0.0"
__maintainer__ = "Dilawar Singh"
__email__ = "dilawars@ncbs.res.in"
__status__ = "Development"
import date... | {
"repo_name": "dilawar/ncbs-minion",
"path": "aws_helper.py",
"copies": "2",
"size": "5586",
"license": "mit",
"hash": 2552418859765698000,
"line_mean": 35.9933774834,
"line_max": 84,
"alpha_frac": 0.5332975295,
"autogenerated": false,
"ratio": 3.852413793103448,
"config_test": false,
"has_no... |
"""AWS Image Creation, Management, Testing"""
import json
from copy import deepcopy
from typing import Tuple
import boto3
import botocore.exceptions
import pkg_resources
import yaml
from pkg_resources import resource_string
from retrying import retry
import gen
import gen.build_deploy.util as util
import pkgpanda.ut... | {
"repo_name": "mesosphere-mergebot/mergebot-test-dcos",
"path": "gen/build_deploy/aws.py",
"copies": "2",
"size": "22800",
"license": "apache-2.0",
"hash": -6475790627022130000,
"line_mean": 36.8737541528,
"line_max": 319,
"alpha_frac": 0.6005263158,
"autogenerated": false,
"ratio": 3.44984112573... |
"""AWS Image Creation, Management, Testing"""
import json
import logging
from copy import deepcopy
from typing import Tuple
import botocore.exceptions
import pkg_resources
import yaml
from pkg_resources import resource_string
from retrying import retry
import gen
import gen.build_deploy.util as util
import pkgpanda.... | {
"repo_name": "branden/dcos",
"path": "gen/build_deploy/aws.py",
"copies": "1",
"size": "22966",
"license": "apache-2.0",
"hash": -3969699470007410000,
"line_mean": 35.6869009585,
"line_max": 319,
"alpha_frac": 0.5928328834,
"autogenerated": false,
"ratio": 3.561172274771282,
"config_test": tru... |
"""AWS Image Creation, Management, Testing"""
import json
import logging
from copy import deepcopy
from typing import Tuple
import botocore.exceptions
import yaml
from pkg_resources import resource_string
from retrying import retry
import gen
import gen.build_deploy.util as util
import pkgpanda.util
import release
i... | {
"repo_name": "BenWhitehead/dcos",
"path": "gen/build_deploy/aws.py",
"copies": "1",
"size": "23140",
"license": "apache-2.0",
"hash": 5975089708114767000,
"line_mean": 36.5649350649,
"line_max": 319,
"alpha_frac": 0.6031114952,
"autogenerated": false,
"ratio": 3.593167701863354,
"config_test":... |
"""AWS Lambda functions for EBS Volume Snapshots"""
import boto3
import logging
from datetime import tzinfo, timedelta, datetime
DEFAULT_DAYS_TO_KEEP = 30
logger = logging.getLogger()
logger.setLevel(logging.INFO)
class UTC(tzinfo):
"""
A `tzinfo' derived class for representing UTC.
Necessary for getti... | {
"repo_name": "markbreedlove/lambda-snapshots",
"path": "snapshots.py",
"copies": "1",
"size": "3654",
"license": "mit",
"hash": 6533876719387007000,
"line_mean": 32.5229357798,
"line_max": 79,
"alpha_frac": 0.6152162014,
"autogenerated": false,
"ratio": 3.6871846619576187,
"config_test": false... |
""" AWS Lambda handler that process S3 object notifications """
import json
import os
import posixpath
import boto3
def handle_s3_event(event, context):
"""Handle S3 object notification"""
from pypicloud.cache import get_cache_impl
from pypicloud.dateutil import utcnow
from pypicloud.storage.s3 impor... | {
"repo_name": "stevearc/pypicloud",
"path": "pypicloud/_lambda_handler.py",
"copies": "1",
"size": "1932",
"license": "mit",
"hash": -6868488462786316000,
"line_mean": 37.64,
"line_max": 78,
"alpha_frac": 0.615942029,
"autogenerated": false,
"ratio": 4.093220338983051,
"config_test": false,
"... |
""" AWS Lambda handler that process S3 object notifications """
import json
import os
import posixpath
import boto3
def handle_s3_event(event, context):
""" Handle S3 object notification """
from pypicloud.cache import get_cache_impl
from pypicloud.storage.s3 import S3Storage
from pypicloud.util impo... | {
"repo_name": "mathcamp/pypicloud",
"path": "pypicloud/_lambda_handler.py",
"copies": "1",
"size": "1934",
"license": "mit",
"hash": 7700530140769043000,
"line_mean": 37.68,
"line_max": 78,
"alpha_frac": 0.6153050672,
"autogenerated": false,
"ratio": 4.0974576271186445,
"config_test": false,
... |
"""AWS or Alexa related helper functions"""
import boto3
from boto3.dynamodb.conditions import Key
def launch_response():
"""Response when no specific stop is defined"""
text_item = {"type": "PlainText",
"text": "Welcome to Helsinki buses. " +
"We can tell you departu... | {
"repo_name": "timokoola/hslbot",
"path": "alexarequests.py",
"copies": "2",
"size": "3803",
"license": "apache-2.0",
"hash": -7347906132388456000,
"line_mean": 36.2843137255,
"line_max": 82,
"alpha_frac": 0.5345779648,
"autogenerated": false,
"ratio": 4.416957026713124,
"config_test": false,
... |
import datetime
import json
import sys
import time
import boto3
import botocore.exceptions
import os
import random
import yaml
def select_random_region():
with open("./cloudformation/supported_regions.yml") as f:
region_list = yaml.load(f).get('supported_regions')
# our prod-ish stuff is in west... | {
"repo_name": "cf-platform-eng/aws-pcf-quickstart",
"path": "ci/create-stack.py",
"copies": "1",
"size": "5159",
"license": "apache-2.0",
"hash": 8518368256027242000,
"line_mean": 36.9338235294,
"line_max": 99,
"alpha_frac": 0.6456677651,
"autogenerated": false,
"ratio": 3.9053747161241485,
"co... |
import json
import os
import re
import sys
import jinja2
import yaml
ami_mapping_dir = "../ami-mapping"
opsman_tile_dir = "../opsman-tile"
versioned_file_name = ""
for file_name in os.listdir(ami_mapping_dir):
if re.match(r'ami-mapping-.*\.json', file_name):
versioned_file_name = file_name
if versioned_... | {
"repo_name": "cf-platform-eng/aws-pcf-quickstart",
"path": "ci/instantiate-quickstart-template.py",
"copies": "1",
"size": "2437",
"license": "apache-2.0",
"hash": -5234792564615145000,
"line_mean": 33.323943662,
"line_max": 80,
"alpha_frac": 0.7209684038,
"autogenerated": false,
"ratio": 3.3706... |
import json
import sys
import time
import boto3
import os
aws_access_key_id = os.environ['AWS_ACCESS_KEY_ID']
aws_secret_access_key = os.environ['AWS_SECRET_ACCESS_KEY']
def describe_stack_status(cloudformation_client, stack_id):
describe_response = cloudformation_client.describe_stacks(StackName=stack_id)
... | {
"repo_name": "cf-platform-eng/aws-pcf-quickstart",
"path": "ci/delete-stack.py",
"copies": "1",
"size": "2162",
"license": "apache-2.0",
"hash": -3843652997242284500,
"line_mean": 32.78125,
"line_max": 95,
"alpha_frac": 0.7363552266,
"autogenerated": false,
"ratio": 3.4536741214057507,
"config... |
import sys
import boto3
import botocore
import botocore.exceptions
import os
def delete_bucket(bucket_name: str, region: str, key: str, secret: str):
print("Deleting bucket {}".format(bucket_name))
s3_client = boto3.client(
service_name='s3',
region_name=region,
aws_access_key_id=key... | {
"repo_name": "cf-platform-eng/aws-pcf-quickstart",
"path": "ci/delete-buckets.py",
"copies": "1",
"size": "3121",
"license": "apache-2.0",
"hash": -6445192769572049000,
"line_mean": 32.9239130435,
"line_max": 80,
"alpha_frac": 0.6167894905,
"autogenerated": false,
"ratio": 3.862623762376238,
"... |
"""AWS platform for notify component."""
import asyncio
import base64
import json
import logging
from homeassistant.components.notify import (
ATTR_TARGET,
ATTR_TITLE,
ATTR_TITLE_DEFAULT,
BaseNotificationService,
)
from homeassistant.const import CONF_PLATFORM, CONF_NAME
from homeassistant.helpers.json... | {
"repo_name": "jabesq/home-assistant",
"path": "homeassistant/components/aws/notify.py",
"copies": "2",
"size": "7516",
"license": "apache-2.0",
"hash": 7850519560808114000,
"line_mean": 30.1867219917,
"line_max": 76,
"alpha_frac": 0.5794305482,
"autogenerated": false,
"ratio": 4.331988472622478,... |
"""AWS platform for notify component."""
import asyncio
import base64
import json
import logging
import aiobotocore
from homeassistant.components.notify import (
ATTR_TARGET,
ATTR_TITLE,
ATTR_TITLE_DEFAULT,
BaseNotificationService,
)
from homeassistant.const import (
CONF_NAME,
CONF_PLATFORM,
... | {
"repo_name": "w1ll1am23/home-assistant",
"path": "homeassistant/components/aws/notify.py",
"copies": "3",
"size": "7190",
"license": "apache-2.0",
"hash": 3971905923341906400,
"line_mean": 30.1255411255,
"line_max": 83,
"alpha_frac": 0.5808066759,
"autogenerated": false,
"ratio": 4.3235117257967... |
""" AWS Related models and responses """
import re
import os
import time
import shutil
import hashlib
import datetime
import lxml.etree
XMLNS = "http://s3.amazonaws.com/doc/2006-03-01/"
def t(tag, text, **attrs):
""" Shorthand for creating an XML element with the provided text """
element = lxml.etree.Elemen... | {
"repo_name": "irccloud/ms3",
"path": "ms3/commands.py",
"copies": "1",
"size": "13025",
"license": "mit",
"hash": 2391537866031172600,
"line_mean": 28.9425287356,
"line_max": 98,
"alpha_frac": 0.5505566219,
"autogenerated": false,
"ratio": 3.847858197932053,
"config_test": false,
"has_no_key... |
"""AWS s3 access"""
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from boto.exception import S3CopyError, S3ResponseError
import tempfile
import pickle
import os
from ut.util.importing import get_environment_variable
# import ut.serialize.utils as serialize_utils
# use case. I need to check a... | {
"repo_name": "thorwhalen/ut",
"path": "serialize/s3.py",
"copies": "1",
"size": "14830",
"license": "mit",
"hash": -8559969234259822000,
"line_mean": 42.2390670554,
"line_max": 124,
"alpha_frac": 0.615037087,
"autogenerated": false,
"ratio": 3.905715038188043,
"config_test": false,
"has_no_k... |
"""AWS S3 Interface used by tests."""
import boto3
import botocore
from botocore.exceptions import ClientError
import json
class S3Interface():
"""Interface to the AWS S3 database."""
def __init__(self, aws_access_key_id, aws_secret_access_key, s3_region_name,
deployment_prefix):
"""... | {
"repo_name": "tisnik/fabric8-analytics-common",
"path": "integration-tests/features/src/s3interface.py",
"copies": "1",
"size": "6078",
"license": "apache-2.0",
"hash": 7004244373596643000,
"line_mean": 42.1063829787,
"line_max": 95,
"alpha_frac": 0.582757486,
"autogenerated": false,
"ratio": 4.... |
"""AWS S3 Interface used by tests."""
import boto3
import botocore
import json
class S3Interface():
"""Interface to the AWS S3 database."""
def __init__(self, aws_access_key_id, aws_secret_access_key, s3_region_name,
deployment_prefix):
"""Create a new interface to the AWS S3.
... | {
"repo_name": "jpopelka/fabric8-analytics-common",
"path": "perf-tests/src/s3interface.py",
"copies": "1",
"size": "5605",
"license": "apache-2.0",
"hash": 1285498360326841300,
"line_mean": 43.84,
"line_max": 95,
"alpha_frac": 0.5752007136,
"autogenerated": false,
"ratio": 4.476837060702875,
"c... |
"""AWS S3 Interface used by tests."""
import boto3
import botocore
from botocore.exceptions import ClientError
import json
from s3configuration import S3Configuration
class S3Interface():
"""Interface to the AWS S3 database."""
def __init__(self, s3configuration):
"""Create a new interface to the A... | {
"repo_name": "jpopelka/fabric8-analytics-common",
"path": "db-integrity-tests/src/s3interface.py",
"copies": "1",
"size": "9425",
"license": "apache-2.0",
"hash": 3345476655626147000,
"line_mean": 44.3125,
"line_max": 100,
"alpha_frac": 0.610928382,
"autogenerated": false,
"ratio": 4.29972627737... |
"""AWS S3 Interface used by tests."""
import boto3
import botocore
from botocore.exceptions import ClientError
import json
class S3Interface():
"""Interface to the AWS S3 database."""
def __init__(self, aws_access_key_id, aws_secret_access_key, s3_region_name,
deployment_prefix):
""... | {
"repo_name": "tisnik/fabric8-analytics-common",
"path": "perf-tests/src/s3interface.py",
"copies": "1",
"size": "5797",
"license": "apache-2.0",
"hash": -1840763732120817000,
"line_mean": 43.2519083969,
"line_max": 95,
"alpha_frac": 0.5797826462,
"autogenerated": false,
"ratio": 4.49031758326878... |
"""AWS Secret Backend"""
import logging
import aomi.exceptions
import aomi.model.resource
from aomi.vault import is_mounted
from aomi.model.resource import Secret, Resource
from aomi.helpers import hard_path, merge_dicts
from aomi.template import load_vars, render, load_var_file
from aomi.validation import sanitize_mou... | {
"repo_name": "otakup0pe/aomi",
"path": "aomi/model/aws.py",
"copies": "1",
"size": "4574",
"license": "mit",
"hash": -2564775816436339700,
"line_mean": 29.4933333333,
"line_max": 76,
"alpha_frac": 0.5428508964,
"autogenerated": false,
"ratio": 3.624405705229794,
"config_test": false,
"has_no... |
# AWS Settings:
# Important:
# If you change any of the AWS_S3_BUCKET_AUTH or AWS_S3_MAX_AGE_SECONDS settings, you will need to run below command
# before the changes will be applied to existing media files.
# ./manage.py s3_sync_meta path.to.your.storage
# The region to connect to when storing files.
AWS_REGION = "a... | {
"repo_name": "ftkghost/SuperSaver",
"path": "supersaver/supersaver/ext_service_settings.py",
"copies": "1",
"size": "2169",
"license": "bsd-2-clause",
"hash": -3988946830963683000,
"line_mean": 45.085106383,
"line_max": 117,
"alpha_frac": 0.7565819861,
"autogenerated": false,
"ratio": 3.54918032... |
"""AWS Shell application.
Main entry point to the AWS Shell.
"""
from __future__ import unicode_literals
import os
import subprocess
import logging
import sys
from prompt_toolkit.document import Document
from prompt_toolkit.shortcuts import create_eventloop
from prompt_toolkit.buffer import Buffer
from prompt_toolki... | {
"repo_name": "awslabs/aws-shell",
"path": "awsshell/app.py",
"copies": "1",
"size": "18544",
"license": "apache-2.0",
"hash": -3081053262297531400,
"line_mean": 35.21875,
"line_max": 79,
"alpha_frac": 0.5984685073,
"autogenerated": false,
"ratio": 4.316573556797021,
"config_test": true,
"has... |
"""AWS SQS interface.
This AWS SQS client interface is implemented using Boto3 - AWS SDK for Python.
Boto3 SQS Documentation:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html
"""
# pylint: disable=g-import-not-at-top
import sys
from typing import Any, Dict
from absl import flags
imp... | {
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"path": "perfkitbenchmarker/data/messaging_service/aws_sqs_client.py",
"copies": "1",
"size": "2331",
"license": "apache-2.0",
"hash": 3783335992205285000,
"line_mean": 33.7910447761,
"line_max": 103,
"alpha_frac": 0.7288717289,
"autogenerated... |
""" AWS SQS poller """
import os
current_dir = os.path.dirname(os.path.realpath(__file__))
parent_dir = os.path.join(current_dir, "..")
import sys
sys.path.append(parent_dir)
import boto.sqs
from boto.sqs.message import RawMessage
from boto.exception import SQSError
from lib import logger
class AwsSqsPoller(object)... | {
"repo_name": "jasaw/build-light",
"path": "pollers/aws_sqs_poller.py",
"copies": "1",
"size": "1845",
"license": "mit",
"hash": 4115142370857100300,
"line_mean": 35.1764705882,
"line_max": 112,
"alpha_frac": 0.6097560976,
"autogenerated": false,
"ratio": 3.4485981308411215,
"config_test": fals... |
import inspect, sys
def extractExceptionsFromModule2Dicitonary(modulename, baseclass):
result = {}
for name, obj in inspect.getmembers(sys.modules[modulename]):
if inspect.isclass(obj) and issubclass(obj, baseclass):
result[name] = obj
return result
class UserInputException(Exception)... | {
"repo_name": "sanyi/awsutils",
"path": "awsutils/exceptions/aws.py",
"copies": "1",
"size": "2019",
"license": "mit",
"hash": 658560754421750100,
"line_mean": 30.5625,
"line_max": 75,
"alpha_frac": 0.6631996038,
"autogenerated": false,
"ratio": 4.062374245472837,
"config_test": false,
"has_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.