text stringlengths 0 1.05M | meta dict |
|---|---|
"Amazon S3 cache backend for Django"
# Copyright (c) 2012,2017 Alexander Todorov <atodorov@MrSenko.com>
#
# Taken directly from django.core.cache.backends.filebased.FileBasedCache
# and adapted for S3.
import time
import hashlib
try:
import cPickle as pickle
except ImportError:
import pickle
from storages.b... | {
"repo_name": "atodorov/django-s3-cache",
"path": "s3cache/__init__.py",
"copies": "1",
"size": "7246",
"license": "mit",
"hash": -5435891792446109000,
"line_mean": 32.3917050691,
"line_max": 130,
"alpha_frac": 0.6018492962,
"autogenerated": false,
"ratio": 4.005527915975677,
"config_test": fal... |
from Utils import getTreeFromXml, unicodise, deunicodise
from logging import debug, info, warning, error
try:
import xml.etree.ElementTree as ET
except ImportError:
import elementtree.ElementTree as ET
class S3Exception(Exception):
def __init__(self, message = ""):
self.message = unicodise(messag... | {
"repo_name": "zhm/s3_cmd_bin",
"path": "resources/S3/Exceptions.py",
"copies": "2",
"size": "2643",
"license": "mit",
"hash": 540107724287981900,
"line_mean": 29.0340909091,
"line_max": 94,
"alpha_frac": 0.5936435868,
"autogenerated": false,
"ratio": 3.717299578059072,
"config_test": false,
... |
class BidirMap(object):
def __init__(self, **map):
self.k2v = {}
self.v2k = {}
for key in map:
self.__setitem__(key, map[key])
def __setitem__(self, key, value):
if self.v2k.has_key(value):
if self.v2k[value] != key:
raise KeyError("Value... | {
"repo_name": "zhm/s3_cmd_bin",
"path": "resources/S3/BidirMap.py",
"copies": "15",
"size": "1069",
"license": "mit",
"hash": -3241551106960371000,
"line_mean": 24.4523809524,
"line_max": 107,
"alpha_frac": 0.5341440599,
"autogenerated": false,
"ratio": 3.0895953757225434,
"config_test": false,... |
from BidirMap import BidirMap
class SortedDictIterator(object):
def __init__(self, sorted_dict, keys):
self.sorted_dict = sorted_dict
self.keys = keys
def next(self):
try:
return self.keys.pop(0)
except IndexError:
raise StopIteration
class SortedDict(... | {
"repo_name": "zhm/s3_cmd_bin",
"path": "resources/S3/SortedDict.py",
"copies": "2",
"size": "1943",
"license": "mit",
"hash": 770040982106448900,
"line_mean": 29.8412698413,
"line_max": 84,
"alpha_frac": 0.5337107566,
"autogenerated": false,
"ratio": 3.488330341113106,
"config_test": false,
... |
import logging
from logging import debug, info, warning, error
import re
import os
import sys
import Progress
from SortedDict import SortedDict
import httplib
try:
import json
except ImportError, e:
pass
class Config(object):
_instance = None
_parsed_files = []
_doc = {}
access_key = ""
se... | {
"repo_name": "sharethis-github/OpenSource",
"path": "s3cmd/S3/Config.py",
"copies": "1",
"size": "11894",
"license": "apache-2.0",
"hash": -1110948396675206700,
"line_mean": 37.1217948718,
"line_max": 145,
"alpha_frac": 0.5311081217,
"autogenerated": false,
"ratio": 3.9176548089591567,
"config... |
import logging
from logging import debug, info, warning, error
import re
import Progress
from SortedDict import SortedDict
class Config(object):
_instance = None
_parsed_files = []
_doc = {}
access_key = ""
secret_key = ""
host_base = "s3.amazonaws.com"
host_bucket = "%(bucket)s.s3.amazona... | {
"repo_name": "sauloal/linuxscripts",
"path": "bin/S3/Config.py",
"copies": "1",
"size": "7379",
"license": "mit",
"hash": -4074002161360082400,
"line_mean": 36.0804020101,
"line_max": 145,
"alpha_frac": 0.5491258978,
"autogenerated": false,
"ratio": 3.8094992256066083,
"config_test": true,
"... |
import os
import re
import sys
from BidirMap import BidirMap
from logging import debug
import S3
from Utils import unicodise, check_bucket_name_dns_conformity
class S3Uri(object):
type = None
_subclasses = None
def __new__(self, string):
if not self._subclasses:
## Generate a list of ... | {
"repo_name": "sauloal/linuxscripts",
"path": "bin/S3/S3Uri.py",
"copies": "1",
"size": "6461",
"license": "mit",
"hash": -8172718895785608000,
"line_mean": 28.502283105,
"line_max": 82,
"alpha_frac": 0.5367590156,
"autogenerated": false,
"ratio": 3.6074818537130096,
"config_test": false,
"ha... |
import sys
import datetime
import time
import Utils
class Progress(object):
_stdout = sys.stdout
_last_display = 0
def __init__(self, labels, total_size):
self._stdout = sys.stdout
self.new_file(labels, total_size)
def new_file(self, labels, total_size):
self.labels = labels
... | {
"repo_name": "sharethis-github/OpenSource",
"path": "s3cmd/S3/Progress.py",
"copies": "2",
"size": "6561",
"license": "apache-2.0",
"hash": 2064344200967371300,
"line_mean": 36.9248554913,
"line_max": 122,
"alpha_frac": 0.582837982,
"autogenerated": false,
"ratio": 3.649054505005562,
"config_t... |
import sys
import datetime
import Utils
class Progress(object):
_stdout = sys.stdout
def __init__(self, labels, total_size):
self._stdout = sys.stdout
self.new_file(labels, total_size)
def new_file(self, labels, total_size):
self.labels = labels
self.total_size = total_si... | {
"repo_name": "sauloal/linuxscripts",
"path": "bin/S3/Progress.py",
"copies": "2",
"size": "6017",
"license": "mit",
"hash": -5955952245465880000,
"line_mean": 37.5705128205,
"line_max": 122,
"alpha_frac": 0.5826823999,
"autogenerated": false,
"ratio": 3.5922388059701493,
"config_test": false,
... |
import sys
import os, os.path
import time
import httplib
import logging
import mimetypes
import re
from logging import debug, info, warning, error
from stat import ST_SIZE
try:
from hashlib import md5
except ImportError:
from md5 import md5
from Utils import *
from SortedDict import SortedDict
from AccessLog... | {
"repo_name": "zhm/s3_cmd_bin",
"path": "resources/S3/S3.py",
"copies": "1",
"size": "37631",
"license": "mit",
"hash": 6132634345604718000,
"line_mean": 41.617214043,
"line_max": 139,
"alpha_frac": 0.5663150062,
"autogenerated": false,
"ratio": 4.078799046173857,
"config_test": true,
"has_no... |
import os
from stat import ST_SIZE
from logging import debug, info, warning, error
from Utils import getTextFromXml, formatSize, unicodise
from Exceptions import S3UploadError
class MultiPartUpload(object):
MIN_CHUNK_SIZE_MB = 5 # 5MB
MAX_CHUNK_SIZE_MB = 5120 # 5GB
MAX_FILE_SIZE = 42949672960 # ... | {
"repo_name": "zhm/s3_cmd_bin",
"path": "resources/S3/MultiPart.py",
"copies": "1",
"size": "4721",
"license": "mit",
"hash": -2180814987962205400,
"line_mean": 40.7787610619,
"line_max": 133,
"alpha_frac": 0.6077102309,
"autogenerated": false,
"ratio": 3.5928462709284625,
"config_test": false,... |
import os
import sys
from stat import ST_SIZE
from logging import debug, info, warning, error
from Utils import getTextFromXml, getTreeFromXml, formatSize, unicodise, calculateChecksum, parseNodes
from Exceptions import S3UploadError
from collections import defaultdict
class MultiPartUpload(object):
MIN_CHUNK_SI... | {
"repo_name": "sharethis-github/OpenSource",
"path": "s3cmd/S3/MultiPart.py",
"copies": "2",
"size": "9057",
"license": "apache-2.0",
"hash": 2138174443335985400,
"line_mean": 44.285,
"line_max": 227,
"alpha_frac": 0.5672960141,
"autogenerated": false,
"ratio": 3.77375,
"config_test": true,
"... |
"""Amazon Simple Storage Service (S3) datastore.
.. note::
**Installation**: Use of this module requires the open source boto_
package.
.. _boto: http://code.google.com/p/boto/
"""
from cloud_browser.cloud import boto_base as base
from cloud_browser.common import requires
####################################... | {
"repo_name": "UrbanDaddy/django-cloud-browser",
"path": "cloud_browser/cloud/aws.py",
"copies": "1",
"size": "1739",
"license": "mit",
"hash": -9186907538104080000,
"line_mean": 28.4745762712,
"line_max": 79,
"alpha_frac": 0.5399654974,
"autogenerated": false,
"ratio": 4.662198391420912,
"conf... |
"""Amazon Simple Storage Service (S3) datastore.
.. note::
**Installation**: Use of this module requires the open source boto_
package.
.. _boto: http://code.google.com/p/boto/
"""
from warnings import warn
from cloud_browser.cloud import boto_base as base
from cloud_browser.common import requires
warn(
... | {
"repo_name": "ryan-roemer/django-cloud-browser",
"path": "cloud_browser/cloud/aws.py",
"copies": "1",
"size": "1881",
"license": "mit",
"hash": -149895951638638300,
"line_mean": 26.6617647059,
"line_max": 79,
"alpha_frac": 0.5544922913,
"autogenerated": false,
"ratio": 4.644444444444445,
"conf... |
"""Amazon Simple Storage Service (S3) datastore.
.. note::
**Installation**: Use of this module requires the open source boto_
package.
.. _boto: http://code.google.com/p/boto/
"""
import base64
import datetime
import hashlib
import hmac
import json
from cloud_browser.cloud import boto_base as base
from clou... | {
"repo_name": "lantip/aws-filemanager",
"path": "cloud_browser/cloud/aws.py",
"copies": "1",
"size": "4505",
"license": "mit",
"hash": -7474136084076831000,
"line_mean": 32.6194029851,
"line_max": 79,
"alpha_frac": 0.5327413984,
"autogenerated": false,
"ratio": 4.491525423728813,
"config_test":... |
"""Amazon Simple Storage Service (S3) Driver."""
import logging
from typing import Any, Dict, Iterable, List, TYPE_CHECKING # noqa: F401
from urllib.parse import quote, urljoin
import boto3
from botocore.exceptions import ClientError, ParamValidationError, WaiterError
from inflection import camelize, underscore
from... | {
"repo_name": "scottwernervt/cloudstorage",
"path": "src/cloudstorage/drivers/amazon.py",
"copies": "1",
"size": "21466",
"license": "mit",
"hash": -7361190719946671000,
"line_mean": 33.0190174326,
"line_max": 87,
"alpha_frac": 0.5910276717,
"autogenerated": false,
"ratio": 4.0833174814533,
"co... |
"""Amazon SQS Connection."""
from vine import transform
from kombu.asynchronous.aws.connection import AsyncAWSQueryConnection
from .ext import boto3
from .message import AsyncMessage
from .queue import AsyncQueue
__all__ = ('AsyncSQSConnection',)
class AsyncSQSConnection(AsyncAWSQueryConnection):
"""Async SQ... | {
"repo_name": "celery/kombu",
"path": "kombu/asynchronous/aws/sqs/connection.py",
"copies": "1",
"size": "6831",
"license": "bsd-3-clause",
"hash": -4421437971180060700,
"line_mean": 34.3937823834,
"line_max": 78,
"alpha_frac": 0.5701947006,
"autogenerated": false,
"ratio": 4.331642358909321,
"... |
"""Amazon SQS queue implementation."""
from vine import transform
from .message import AsyncMessage
_all__ = ['AsyncQueue']
def list_first(rs):
"""Get the first item in a list, or None if list empty."""
return rs[0] if len(rs) == 1 else None
class AsyncQueue():
"""Async SQS Queue."""
def __init_... | {
"repo_name": "ZoranPavlovic/kombu",
"path": "kombu/asynchronous/aws/sqs/queue.py",
"copies": "2",
"size": "4368",
"license": "bsd-3-clause",
"hash": 3516732837316888000,
"line_mean": 33.125,
"line_max": 78,
"alpha_frac": 0.6220238095,
"autogenerated": false,
"ratio": 4.156041864890581,
"config... |
"""Amazon SQS Transport.
Amazon SQS transport module for Kombu. This package implements an AMQP-like
interface on top of Amazons SQS service, with the goal of being optimized for
high performance and reliability.
The default settings for this module are focused now on high performance in
task queue situations where ... | {
"repo_name": "pexip/os-kombu",
"path": "kombu/transport/SQS.py",
"copies": "1",
"size": "19129",
"license": "bsd-3-clause",
"hash": 5350279294612438000,
"line_mean": 35.6455938697,
"line_max": 79,
"alpha_frac": 0.6048930943,
"autogenerated": false,
"ratio": 4.137789314298075,
"config_test": fa... |
'''Amazon Web Services helpers'''
from django.conf import settings
from M2Crypto import EVP
import base64
import boto.cloudfront
import boto.cloudfront.object
import boto.s3.bucket
import boto.s3.connection
import boto.s3.key
import facade
import logging
import os
import time
import urllib
import urlparse
try:
im... | {
"repo_name": "AmericanResearchInstitute/poweru-server",
"path": "vod_aws/awsutils.py",
"copies": "1",
"size": "9217",
"license": "bsd-3-clause",
"hash": -1412536849895908600,
"line_mean": 38.2212765957,
"line_max": 118,
"alpha_frac": 0.5946620375,
"autogenerated": false,
"ratio": 4.2416014726185... |
# AMBIGUITY = 0
def _create_list_from(value, clazz):
result = []
if isinstance(value, list):
for data in value:
new_entry = clazz(data)
result.append(new_entry)
else:
new_entry = clazz(value)
result.append(new_entry)
return result
def _get_qualified_n... | {
"repo_name": "marquesarthur/BugAnalysisRecommender",
"path": "patterny/patterny/data/bug.py",
"copies": "1",
"size": "10155",
"license": "mit",
"hash": -2704607627721126400,
"line_mean": 26.2252010724,
"line_max": 159,
"alpha_frac": 0.5634662728,
"autogenerated": false,
"ratio": 4.05227454110135... |
"""Ambry command extension for remote libraries
Commands inlcude:
"""
# Copyright (c) 2015 Civic Knowledge. This file is licensed under the terms of
# the Revised BSD License, included in this distribution as LICENSE.txt
__all__ = ['command_name', 'make_parser', 'run_command']
command_name = 'remote'
from ambry... | {
"repo_name": "CivicKnowledge/ambry-admin",
"path": "ambry_admin/remote.py",
"copies": "1",
"size": "6524",
"license": "bsd-3-clause",
"hash": -5524076725090972000,
"line_mean": 29.6338028169,
"line_max": 132,
"alpha_frac": 0.6362660944,
"autogenerated": false,
"ratio": 3.5865860362836726,
"con... |
""" Ambry Web Client
Copyright (c) 2015 Civic Knowledge. This file is licensed under the terms of
the Revised BSD License, included in this distribution as LICENSE.txt
"""
from collections import OrderedDict, Mapping
import requests
from six import iterkeys
# http://pypi.python.org/pypi/layered-yaml-attrdict-con... | {
"repo_name": "CivicKnowledge/ambry-client",
"path": "ambry_client/__init__.py",
"copies": "1",
"size": "10477",
"license": "bsd-2-clause",
"hash": -1852897045241049000,
"line_mean": 26.0051546392,
"line_max": 108,
"alpha_frac": 0.5505392765,
"autogenerated": false,
"ratio": 4.0003818251240935,
... |
# AMDG
from datetime import datetime
import locale
locale.setlocale(locale.LC_ALL, '')
class Operators(object):
operators = ('+', '-')
@staticmethod
def valid(op):
return op in Operators.operators
class ColumnPositions(object):
AMOUNT = 0
CATEGORY = 1
DESCRIPTION = 2
VENDOR = 3
... | {
"repo_name": "pilliq/balance",
"path": "balance/entry.py",
"copies": "1",
"size": "3910",
"license": "mit",
"hash": -7062560903028059000,
"line_mean": 25.4189189189,
"line_max": 77,
"alpha_frac": 0.5557544757,
"autogenerated": false,
"ratio": 4.2685589519650655,
"config_test": false,
"has_no... |
# AMDG
from entry import Entry
COMMENT_STR='#'
class BasicLoader(object):
def __init__(self, filename):
self.filename = filename
pass
def load(self, return_errors=False):
entries = []
errors = []
with open(self.filename, 'r') as f:
for i, line in enumerate... | {
"repo_name": "pilliq/balance",
"path": "balance/loaders.py",
"copies": "1",
"size": "1827",
"license": "mit",
"hash": -1789382149879327200,
"line_mean": 30.5,
"line_max": 66,
"alpha_frac": 0.4553913519,
"autogenerated": false,
"ratio": 4.7952755905511815,
"config_test": false,
"has_no_keywor... |
# AMDG
import logging
from balance_book import BalanceBook
from itertools import islice
class RepayBook(object):
"""
RepayBook keeps track of entries that have been and need to be repaid to
other people. It keeps these two types of entries in separate BalanceBooks.
When both types of entries are comb... | {
"repo_name": "pilliq/balance",
"path": "balance/repay_book.py",
"copies": "1",
"size": "3259",
"license": "mit",
"hash": 4639831805036486000,
"line_mean": 32.5979381443,
"line_max": 159,
"alpha_frac": 0.5250076711,
"autogenerated": false,
"ratio": 4.125316455696202,
"config_test": false,
"ha... |
# AMDG
import logging
class BalanceBook(object):
def __init__(self, entries):
self.logger = logging.getLogger(type(self).__name__)
self._entries = self._group_by_eid(entries)
def _group_by_eid(self, entries):
eids = {}
for e in entries:
eids[e.eid] = e
retu... | {
"repo_name": "pilliq/balance",
"path": "balance/balance_book.py",
"copies": "1",
"size": "1406",
"license": "mit",
"hash": -2696497883610881500,
"line_mean": 25.037037037,
"line_max": 71,
"alpha_frac": 0.512802276,
"autogenerated": false,
"ratio": 4.197014925373134,
"config_test": false,
"ha... |
# AMDG
import unittest
from balance import (
BasicAnalyzer,
BasicLoader,
BalanceBook,
RepayLoader,
RepayBook
)
from base_test import BaseTest
class BasicAnalyzerTests(BaseTest, unittest.TestCase):
def setUp(self):
self.loader = BasicLoader('tests/data/basic_analyzer')
self.bboo... | {
"repo_name": "pilliq/balance",
"path": "tests/test_analyzers.py",
"copies": "1",
"size": "1088",
"license": "mit",
"hash": -3314672420058923500,
"line_mean": 29.2222222222,
"line_max": 63,
"alpha_frac": 0.6626838235,
"autogenerated": false,
"ratio": 3.5324675324675323,
"config_test": true,
"... |
# AMDG
import unittest
from datetime import datetime
from balance import BasicLoader, RepayLoader
from base_test import BaseTest
class LoaderTests(BaseTest, unittest.TestCase):
def test_basic_loader(self):
loader = BasicLoader('tests/data/basic_loader')
entries, errors = loader.load(return_errors=... | {
"repo_name": "pilliq/balance",
"path": "tests/test_loaders.py",
"copies": "1",
"size": "1764",
"license": "mit",
"hash": -1669557820197150700,
"line_mean": 42.0243902439,
"line_max": 83,
"alpha_frac": 0.6541950113,
"autogenerated": false,
"ratio": 3.876923076923077,
"config_test": true,
"has... |
# A measure performed and recorded on an individual state
import collections
import yaml
import importlib
import functools
import funtool.analysis
import funtool.state_collection
import funtool.logger
import funtool.lib.config_parse
import funtool.lib.general
import datetime
StateMeasure = collections.namedtuple('S... | {
"repo_name": "pjanis/funtool",
"path": "funtool/state_measure.py",
"copies": "2",
"size": "8334",
"license": "mit",
"hash": -4782947655590415000,
"line_mean": 53.4705882353,
"line_max": 157,
"alpha_frac": 0.7426205904,
"autogenerated": false,
"ratio": 4.478237506716819,
"config_test": false,
... |
# A measure performed and recorded on an individual state
import collections
import yaml
import importlib
import functools
import funtool.state_collection
import funtool.analysis
import funtool.logger
import funtool.lib.config_parse
GroupMeasure = collections.namedtuple('GroupMeasure',['name','measure_module','meas... | {
"repo_name": "ActiveLearningLab/funtool",
"path": "funtool/group_measure.py",
"copies": "2",
"size": "3861",
"license": "mit",
"hash": -7889376942432989000,
"line_mean": 54.9565217391,
"line_max": 165,
"alpha_frac": 0.7275317275,
"autogenerated": false,
"ratio": 4.580071174377224,
"config_test... |
# A measure performed and recorded on an individual state
import collections
import yaml
import importlib
import functools
import measure.analysis
StateMeasure = collections.namedtuple('StateMeasure',['measure_module','measure_function','state_selectors','group_selectors','parameters'])
# A StateMeasure is used wit... | {
"repo_name": "pjanis/funtool-development",
"path": "measure/measure/state_measure.py",
"copies": "1",
"size": "3371",
"license": "mit",
"hash": 2851232545256262000,
"line_mean": 47.1571428571,
"line_max": 140,
"alpha_frac": 0.7517057253,
"autogenerated": false,
"ratio": 4.294267515923567,
"con... |
"""A mechanism to load header files in separate processes using the `multiprocessing` module """
import logging
import os
from multiprocessing import Pool
from multiprocessing.pool import AsyncResult
from typing import Sequence, List, Optional, Tuple
from PyQt5 import QtCore
from sastool.io.credo_cct import Header
lo... | {
"repo_name": "awacha/cct",
"path": "cct/processinggui/project/headerloader.py",
"copies": "1",
"size": "3394",
"license": "bsd-3-clause",
"hash": -1299650249425349600,
"line_mean": 34.3541666667,
"line_max": 120,
"alpha_frac": 0.6340601061,
"autogenerated": false,
"ratio": 3.8263810597519727,
... |
"""A medical image analysis pipeline.
The pipeline is used for brain tissue segmentation using a decision forest classifier.
"""
import argparse
import datetime
import os
import sys
import timeit
import SimpleITK as sitk
import numpy as np
from tensorflow.python.platform import app
from sklearn.mixture import Gaussia... | {
"repo_name": "mrunibe/MIALab",
"path": "bin/main_GMM.py",
"copies": "1",
"size": "9906",
"license": "apache-2.0",
"hash": 724993540823667300,
"line_mean": 41.5150214592,
"line_max": 147,
"alpha_frac": 0.6143751262,
"autogenerated": false,
"ratio": 4.149979053204859,
"config_test": true,
"has... |
"""A medical image analysis pipeline.
The pipeline is used for brain tissue segmentation using a decision forest classifier.
"""
import argparse
import datetime
import os
import sys
import timeit
import SimpleITK as sitk
import numpy as np
from tensorflow.python.platform import app
sys.path.insert(0, os.path.join(... | {
"repo_name": "mrunibe/MIALab",
"path": "bin/feature_evaluation.py",
"copies": "1",
"size": "10024",
"license": "apache-2.0",
"hash": 2291180572795907600,
"line_mean": 41.2953586498,
"line_max": 147,
"alpha_frac": 0.6192138867,
"autogenerated": false,
"ratio": 4.033802816901408,
"config_test": ... |
"""A medical image analysis pipeline.
The pipeline is used for brain tissue segmentation using a decision forest classifier.
"""
import argparse
import datetime
import os
import sys
import numpy as np
from tensorflow.python.platform import app
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns... | {
"repo_name": "mrunibe/MIALab",
"path": "bin/scatter_plot.py",
"copies": "1",
"size": "5751",
"license": "apache-2.0",
"hash": 1799847076156905500,
"line_mean": 39.7872340426,
"line_max": 147,
"alpha_frac": 0.618675013,
"autogenerated": false,
"ratio": 3.6818181818181817,
"config_test": false,
... |
# amee.py
#
# A simple Python interface to the AMEE API, designed to work on Google App Engine as
# well as standard Python installs. Does not expose the entire API, though the
# AMEE.request method can be used to make arbitrary API calls, and it should be easy
# to extend if necessary.
#
# Example usage:
#
# a = ame... | {
"repo_name": "robinhouston/AMEE-Python-interface",
"path": "amee.py",
"copies": "1",
"size": "10881",
"license": "mit",
"hash": 2877871821242734600,
"line_mean": 33.875,
"line_max": 113,
"alpha_frac": 0.658946788,
"autogenerated": false,
"ratio": 3.77157712305026,
"config_test": false,
"has_... |
'A menagerie of children.'
from __future__ import unicode_literals, division
from collections import namedtuple
from datetime import datetime
import fcntl
from heapq import heappop, heappush
import os
from select import select
from select import error as SelectError
from signal import signal, SIGHUP, SIGCHLD, SIGINT,... | {
"repo_name": "doptio/heywood",
"path": "src/heywood/manager.py",
"copies": "1",
"size": "7353",
"license": "mit",
"hash": -451419628205296800,
"line_mean": 28.6491935484,
"line_max": 78,
"alpha_frac": 0.5699714402,
"autogenerated": false,
"ratio": 3.929983965793693,
"config_test": false,
"ha... |
"""A merge sort which accepts an array as input and recursively
splits an array in half and sorts and combines them.
"""
"""https://en.wikipedia.org/wiki/Merge_sort """
def merge(arr: list[int]) -> list[int]:
"""Return a sorted array.
>>> merge([10,9,8,7,6,5,4,3,2,1])
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
... | {
"repo_name": "TheAlgorithms/Python",
"path": "sorts/recursive_mergesort_array.py",
"copies": "1",
"size": "2195",
"license": "mit",
"hash": 2812399672507918300,
"line_mean": 33.296875,
"line_max": 74,
"alpha_frac": 0.5325740319,
"autogenerated": false,
"ratio": 3.512,
"config_test": false,
"... |
# American Community Survey 5-Year Data
# https://www.census.gov/data/developers/data-sets/acs-5year.2016.html
#
# Notes:
# - Examples: http://api.census.gov/data/2016/acs/acs5/examples.html
# - Places: https://www.census.gov/content/dam/Census/data/developers/understandingplace.pdf
#
# Fact Finder:
# - Home: http:/... | {
"repo_name": "OpenDataPolicingNC/Traffic-Stops",
"path": "tsdata/acs.py",
"copies": "1",
"size": "5696",
"license": "mit",
"hash": 508224846142748300,
"line_mean": 35.2802547771,
"line_max": 140,
"alpha_frac": 0.6318469101,
"autogenerated": false,
"ratio": 3.1057797164667393,
"config_test": fa... |
# American Magnetics, Inc. (AMI) One Axis magnet with PCS_SN14768
import time
import logging
import numpy as np
# from scipy.optimize import brent
# from math import gcd
# from qcodes import Instrument
from qcodes.utils import validators as vals
# from qcodes.instrument.parameter import ManualParameter
from pycqed.ana... | {
"repo_name": "DiCarloLab-Delft/PycQED_py3",
"path": "pycqed/instrument_drivers/meta_instrument/AMI_Magnet_PCS_SN14768.py",
"copies": "1",
"size": "29547",
"license": "mit",
"hash": -4690453351410722000,
"line_mean": 40.4403927069,
"line_max": 105,
"alpha_frac": 0.5708870613,
"autogenerated": false... |
# American Magnetics, Inc. (AMI) Two Axis magnet with two PCS, SN14769
import time
import logging
import numpy as np
# from scipy.optimize import brent
# from math import gcd
# from qcodes import Instrument
from qcodes.utils import validators as vals
# from qcodes.instrument.parameter import ManualParameter
from pycqe... | {
"repo_name": "DiCarloLab-Delft/PycQED_py3",
"path": "pycqed/instrument_drivers/meta_instrument/AMI_Two_Axis_Magnet_with_PCS_SN14769.py",
"copies": "1",
"size": "38699",
"license": "mit",
"hash": 7486693195230117000,
"line_mean": 47.6779874214,
"line_max": 110,
"alpha_frac": 0.5567585726,
"autogene... |
"""American National Election Survey 1996"""
from numpy import log
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
http://www.electionstudies.org/
The American National Election Studies.
"""
DESCRSHORT = """This d... | {
"repo_name": "jseabold/statsmodels",
"path": "statsmodels/datasets/anes96/data.py",
"copies": "4",
"size": "3931",
"license": "bsd-3-clause",
"hash": 5258582150516469000,
"line_mean": 30.448,
"line_max": 91,
"alpha_frac": 0.5108114983,
"autogenerated": false,
"ratio": 3.719016083254494,
"confi... |
"""American National Election Survey 1996"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
http://www.electionstudies.org/
The American National Election Studies.
"""
DESCRSHORT = """This data is a subset of the American National Election Stud... | {
"repo_name": "yl565/statsmodels",
"path": "statsmodels/datasets/anes96/data.py",
"copies": "5",
"size": "4239",
"license": "bsd-3-clause",
"hash": 7992474584893189000,
"line_mean": 32.6428571429,
"line_max": 92,
"alpha_frac": 0.4949280491,
"autogenerated": false,
"ratio": 3.791592128801431,
"c... |
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total number of ways to decode it.
For example,
Given encoded message "12", it could be decoded as "AB" (1 2) or "L" (12).
The number o... | {
"repo_name": "UmassJin/Leetcode",
"path": "Array/Decode_Ways.py",
"copies": "1",
"size": "2233",
"license": "mit",
"hash": 2531218380236446000,
"line_mean": 30.7384615385,
"line_max": 94,
"alpha_frac": 0.5007270965,
"autogenerated": false,
"ratio": 2.4016298020954596,
"config_test": false,
"... |
# A message containing letters from A-Z is being encoded to numbers using the following mapping:
# 'A' -> 1
# 'B' -> 2
# ...
# 'Z' -> 26
# Given an encoded message containing digits, determine the total number of ways to decode it.
# For example,
# Given encoded message "12", it could be decoded as "AB" (1 2) or "L... | {
"repo_name": "lijunxyz/leetcode_practice",
"path": "decode_ways_medium/Solution1.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": -7180221604527209000,
"line_mean": 29.8055555556,
"line_max": 126,
"alpha_frac": 0.5798016231,
"autogenerated": false,
"ratio": 3.0135869565217392,
"co... |
# A message containing letters from A-Z is being encoded to numbers using the following mapping way:
# 'A' -> 1
# 'B' -> 2
# ...
# 'Z' -> 26
# Beyond that, now the encoded string can also contain the character '*', which can be treated as one of the numbers from 1 to 9.
# Given the encoded message containing digits a... | {
"repo_name": "youhusky/Facebook_Prepare",
"path": "639. Decode Ways II.py",
"copies": "1",
"size": "2651",
"license": "mit",
"hash": 8211960633136565000,
"line_mean": 31.7407407407,
"line_max": 129,
"alpha_frac": 0.4024896266,
"autogenerated": false,
"ratio": 3.3856960408684547,
"config_test":... |
"""A meta-component that allows a component to be optionally enabled
or disabled. This component is mostly for illustration and is not
used anywhere. This is because it is usually much easier to simply
add a trait in the module to enable/disable a particular component.
"""
# Author: Prabhu Ramachandran <prabhu_r@use... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/components/optional.py",
"copies": "3",
"size": "4594",
"license": "bsd-3-clause",
"hash": 5689203636817179000,
"line_mean": 33.2835820896,
"line_max": 76,
"alpha_frac": 0.53330431,
"autogenerated": false,
"ratio": 4.8872340425531915,
"con... |
#a method for ranking sites in an alignment according to GC bias, for filtering purposes. Inspired by the Munoz-Gomez et al. (2018) zed score for amino acid data
from Bio import SeqIO, AlignIO
import sys, operator
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy im... | {
"repo_name": "Tancata/phylo",
"path": "rank_taxa_by_nuc_compo.py",
"copies": "1",
"size": "3109",
"license": "mit",
"hash": 685849526514646400,
"line_mean": 28.8942307692,
"line_max": 161,
"alpha_frac": 0.6063042779,
"autogenerated": false,
"ratio": 2.7933513027852652,
"config_test": false,
... |
"""a method for the construction of minimum-redundancy codes. Huffman"""
from bit_array import BitArray
from huffman_trie import HuffmanTrie
from collections import defaultdict, Counter
from heapq import heappush, heappop, heapify
class HuffmanCode(object):
"""allows object encoding and decoding"""
def __in... | {
"repo_name": "in3rtial/huffman",
"path": "src/huffman_code.py",
"copies": "2",
"size": "2456",
"license": "cc0-1.0",
"hash": 4573689844093772000,
"line_mean": 33.1111111111,
"line_max": 75,
"alpha_frac": 0.5899837134,
"autogenerated": false,
"ratio": 3.8922345483359746,
"config_test": false,
... |
"""A method of accessing what information about CLTK Core contributors."""
from collections import defaultdict
from collections import OrderedDict
import importlib.machinery
import os
from cltk.utils.cltk_logger import logger
__author__ = 'Kyle P. Johnson <kyle@kyle-p-johnson.com>'
__license__ = 'MIT License. See LI... | {
"repo_name": "coderbhupendra/cltk",
"path": "cltk/utils/contributors.py",
"copies": "2",
"size": "3773",
"license": "mit",
"hash": 5908221647329385000,
"line_mean": 33.3,
"line_max": 92,
"alpha_frac": 0.5759342698,
"autogenerated": false,
"ratio": 4.206243032329989,
"config_test": false,
"ha... |
"""A method to get the best hostname for this machine"""
import socket
def besthostname():
"""A method to get the best hostname for this machine"""
#
# First find our preferred network interface address
#
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(('google.com',... | {
"repo_name": "cwi-dis/igor",
"path": "igor/besthostname.py",
"copies": "1",
"size": "1275",
"license": "mit",
"hash": -901017262561389800,
"line_mean": 24,
"line_max": 72,
"alpha_frac": 0.5835294118,
"autogenerated": false,
"ratio": 4.022082018927445,
"config_test": false,
"has_no_keywords":... |
"""A metric counter for time series monitoring."""
import sched
import socket
import sys
import threading
import time
DEFAULT_PUT_FORMAT = 'opentsdb'
try:
import collectors.lib
DEFAULT_PUT_FORMAT = 'tcollector'
except ImportError:
pass
PUT_FORMATS = {
'opentsdb': 'put %(name)s %(timestamp)s %(value)s... | {
"repo_name": "oozie/metriccounter",
"path": "metriccounter.py",
"copies": "1",
"size": "6512",
"license": "mit",
"hash": 9010494658037804000,
"line_mean": 29.1481481481,
"line_max": 79,
"alpha_frac": 0.5710995086,
"autogenerated": false,
"ratio": 3.918170878459687,
"config_test": false,
"has... |
############ A METTRE AILLEURS ?
import django
from rest_framework import serializers
from django_apogee.serializers import InsAdmEtpInitialSerializer, IndividuSerializer
from duck_examen.models import RattachementCentreExamen, ExamCenter
from django_apogee.models import Adresse, InsAdmEtp
class RattachementCentreExa... | {
"repo_name": "iedparis8/duck_examen",
"path": "serializers.py",
"copies": "1",
"size": "2427",
"license": "mit",
"hash": -7852563082680614000,
"line_mean": 36.3384615385,
"line_max": 113,
"alpha_frac": 0.6258755665,
"autogenerated": false,
"ratio": 3.7395993836671804,
"config_test": false,
"... |
from pr_services import exceptions
from pr_services.rpc.service import ServiceManagers
from pyamf.remoting.gateway.django import DjangoGateway
import facade
## Exposes methods to amf
class amf_svc:
def __init__(self):
self._svc_managers = ServiceManagers(facade.managers)
def gateway(self):
re... | {
"repo_name": "AmericanResearchInstitute/poweru-server",
"path": "pr_services/rpc/amf.py",
"copies": "1",
"size": "1058",
"license": "bsd-3-clause",
"hash": -7050463171385874000,
"line_mean": 32.0625,
"line_max": 77,
"alpha_frac": 0.6786389414,
"autogenerated": false,
"ratio": 3.712280701754386,
... |
# AMG8833 Overlay Demo
#
# This example shows off how to overlay a heatmap onto your OpenMV Cam's
# live video output from the main camera.
import sensor, image, time, fir, lcd
ALT_OVERLAY = False # Set to True to allocate a second ir image.
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sen... | {
"repo_name": "iabdalkader/openmv",
"path": "scripts/examples/12-Thermopile-Shield/AMG8833_overlay_lcd.py",
"copies": "1",
"size": "1696",
"license": "mit",
"hash": -2269184966376177000,
"line_mean": 27.7457627119,
"line_max": 94,
"alpha_frac": 0.6544811321,
"autogenerated": false,
"ratio": 3.007... |
# AMG8833 Overlay Demo
#
# This example shows off how to overlay a heatmap onto your OpenMV Cam's
# live video output from the main camera.
import sensor, image, time, fir
ALT_OVERLAY = False # Set to True to allocate a second ir image.
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.Q... | {
"repo_name": "iabdalkader/openmv",
"path": "scripts/examples/12-Thermopile-Shield/AMG8833_overlay.py",
"copies": "1",
"size": "1641",
"license": "mit",
"hash": 3960024774352406500,
"line_mean": 28.8363636364,
"line_max": 94,
"alpha_frac": 0.6556977453,
"autogenerated": false,
"ratio": 3.04452690... |
"Amharic config with language-specific information."
from pynini import *
from pynini.lib import byte
from config import utils
GRAPHEMES = union("'", "-",
"ሀ", "ሁ", "ሂ", "ሃ", "ሄ", "ህ", "ሆ",
"ለ", "ሉ", "ሊ", "ላ", "ሌ", "ል", "ሎ", "ሏ",
"ሐ", "ሑ", "ሒ", "ሓ", "ሔ", "ሕ", "ሖ",... | {
"repo_name": "googleinterns/text-norm-for-low-resource-languages",
"path": "config/am.py",
"copies": "1",
"size": "6266",
"license": "apache-2.0",
"hash": 4836265200953778000,
"line_mean": 40.8787878788,
"line_max": 299,
"alpha_frac": 0.3058972504,
"autogenerated": false,
"ratio": 2.134362934362... |
"""Amicable numbers
Let d(n) be defined as the sum of proper divisors of n (numbers less
than n which divide evenly into n).
If d(a) = b and d(b) = a, where a != b, then a and b are an amicable pair and
each of a and b are called amicable numbers.
For example, the proper divisors of 220 are
1, 2, 4, 5, 10, 11, 20... | {
"repo_name": "yhlam/project-euler",
"path": "project_euler/p021.py",
"copies": "1",
"size": "1233",
"license": "mit",
"hash": 2947249521326490600,
"line_mean": 23.66,
"line_max": 77,
"alpha_frac": 0.5296025953,
"autogenerated": false,
"ratio": 3.236220472440945,
"config_test": false,
"has_no... |
# Amicable numbers
# Problem 21
# Let d(n) be defined as the sum of proper divisors of n (numbers less than n
# which divide evenly into n).
# If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair
# and each of a and b are called amicable numbers.
#
# For example, the proper divisors of 220 are 1, 2,... | {
"repo_name": "YangLuGitHub/Euler",
"path": "src/scripts/Problem21.py",
"copies": "1",
"size": "2988",
"license": "mit",
"hash": -5981601729641464000,
"line_mean": 36.325,
"line_max": 106,
"alpha_frac": 0.6430006698,
"autogenerated": false,
"ratio": 3.460023174971031,
"config_test": false,
"h... |
# amicable pair
#
# 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110 = d(220) = 284.
# 1, 2, 4, 71, 142; so d(284) = 220.
#
# amicable pair
# (220, 284)
#
# takes some number n > 0 and finds all the amicable pairs below that number n
#
# 0 < n
# n = 4
#
# (220, 284),
# (1184, 1210),
# (2620, 2924),
# (5020, 5564),
#... | {
"repo_name": "honghaoz/CrackingTheCodingInterview",
"path": "My Questions/AmicablePair.py",
"copies": "1",
"size": "1164",
"license": "mit",
"hash": 7745386416717603000,
"line_mean": 19.8035714286,
"line_max": 78,
"alpha_frac": 0.5764604811,
"autogenerated": false,
"ratio": 2.4149377593360994,
... |
"""AMICI HDF5 I/O tests"""
import os
import random
import amici
import pytest
def _modify_solver_attrs(solver):
# change to non-default values
for attr in dir(solver):
if not attr.startswith('set'):
continue
val = getattr(solver, attr.replace('set', 'get'))()
if isinsta... | {
"repo_name": "FFroehlich/AMICI",
"path": "python/tests/test_hdf5.py",
"copies": "3",
"size": "1832",
"license": "bsd-2-clause",
"hash": 8905633227255195000,
"line_mean": 26.7575757576,
"line_max": 72,
"alpha_frac": 0.6102620087,
"autogenerated": false,
"ratio": 3.816666666666667,
"config_test"... |
"""AMICI model package setup"""
import os
import sys
from typing import List
from amici import amici_path, hdf5_enabled, compiledWithOpenMP
from amici.custom_commands import (set_compiler_specific_extension_options,
compile_parallel)
from amici.setuptools import (get_blas_config,
... | {
"repo_name": "AMICI-developer/AMICI",
"path": "python/amici/setup.template.py",
"copies": "2",
"size": "5471",
"license": "bsd-2-clause",
"hash": 6584032925617524000,
"line_mean": 30.0852272727,
"line_max": 79,
"alpha_frac": 0.6207274721,
"autogenerated": false,
"ratio": 3.5969756738987506,
"c... |
"""A microservice acting as a source of info on all SpaceX flights to date. This content is not endorsed by SpaceX
and should not be treated as official information. This is a personal project only.
See:
https://github.com/KieranWynn/spacex-manifest
"""
from setuptools import setup
setup(
name='spacex_manifest',
... | {
"repo_name": "KieranWynn/spacex-manifest",
"path": "setup.py",
"copies": "1",
"size": "2834",
"license": "mit",
"hash": -3773636072257485000,
"line_mean": 35.3333333333,
"line_max": 130,
"alpha_frac": 0.6965419901,
"autogenerated": false,
"ratio": 3.9525801952580197,
"config_test": true,
"ha... |
'''A microservice for running lights on a launchpad mini midi device.'''
#The one's for you and me, living out our dream
#And we're right where we should be.
#With my arms open wide, I look to the sky
#And all I want to see is a sky full of lighters. A sky full of lighteerssss
#def lighter is a vague idea for LED base... | {
"repo_name": "MrTomWhite/literal-dj-sona",
"path": "py/lighter.py",
"copies": "1",
"size": "3052",
"license": "mit",
"hash": 6710203671888826000,
"line_mean": 29.52,
"line_max": 117,
"alpha_frac": 0.6749672346,
"autogenerated": false,
"ratio": 3.1659751037344397,
"config_test": false,
"has_n... |
"""A middleware class for player login checking and tracking."""
import re
import datetime
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.player_mgr.models imp... | {
"repo_name": "csdl/makahiki",
"path": "makahiki/apps/managers/player_mgr/middleware.py",
"copies": "2",
"size": "4314",
"license": "mit",
"hash": 1473557169892802300,
"line_mean": 34.0731707317,
"line_max": 79,
"alpha_frac": 0.6133518776,
"autogenerated": false,
"ratio": 4.584484590860787,
"co... |
"""A middleware class for player login checking and tracking."""
import re
import datetime
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from apps.managers.challenge_mgr import challenge_mgr
class LoginMiddleware(object):
"""This middleware does the following checks an... | {
"repo_name": "MakahikiKTUH/makahiki-ktuh",
"path": "makahiki/apps/managers/player_mgr/middleware.py",
"copies": "7",
"size": "3807",
"license": "mit",
"hash": -7137554595269649000,
"line_mean": 33.9266055046,
"line_max": 81,
"alpha_frac": 0.6151825584,
"autogenerated": false,
"ratio": 4.52675386... |
"""A middleware class to support logging of interactions with logged in users."""
import traceback
#import datetime
from django.core.signals import got_request_exception
from django.dispatch.dispatcher import receiver
import re
# Filter out requests to media and site_media.
from apps.managers.log_mgr import log_mgr
... | {
"repo_name": "justinslee/Wai-Not-Makahiki",
"path": "makahiki/apps/managers/log_mgr/middleware.py",
"copies": "9",
"size": "1464",
"license": "mit",
"hash": 7505056811377571000,
"line_mean": 32.2727272727,
"line_max": 91,
"alpha_frac": 0.6823770492,
"autogenerated": false,
"ratio": 3.91443850267... |
# A middleware for parsing GET and POST params.
import re
from pump.util import codec
# Middleware to parse GET and POST params. Adds the following keys to the
# request:
#
# - get_params
# - post_params
# - params
#
# You can specify an encoding to decode the URL-encoded params with. If not
# specified, us... | {
"repo_name": "adeel/pump",
"path": "pump/middleware/params.py",
"copies": "1",
"size": "2586",
"license": "mit",
"hash": -3181945033776847400,
"line_mean": 29.0697674419,
"line_max": 78,
"alpha_frac": 0.6589327146,
"autogenerated": false,
"ratio": 3.4664879356568363,
"config_test": false,
"h... |
# A middleware for parsing nested params, like
# {"a[b]": 'c'} => {'a': {'b': 'c'}}.
import re
from itertools import chain
def wrap_nested_params(app, options={}):
def wrapped_app(req):
# You can specify a custom key parsing function with the key_parser option.
key_parser = options.get('key_parser', p... | {
"repo_name": "adeel/pump",
"path": "pump/middleware/nested_params.py",
"copies": "1",
"size": "2005",
"license": "mit",
"hash": -4757630451724661000,
"line_mean": 29.3939393939,
"line_max": 79,
"alpha_frac": 0.5506234414,
"autogenerated": false,
"ratio": 2.884892086330935,
"config_test": false... |
# A middleware that adds cookie support.
from Cookie import SimpleCookie as Cookie
from pump.util import codec
# Adds a "cookies" key to the request, which contains a dictionary containing
# any cookies sent by the client. If any new values are found in the
# dictionary after your app is called, the new cookies are ... | {
"repo_name": "adeel/pump",
"path": "pump/middleware/cookies.py",
"copies": "1",
"size": "2285",
"license": "mit",
"hash": 3206476676818734600,
"line_mean": 34.1538461538,
"line_max": 79,
"alpha_frac": 0.6831509847,
"autogenerated": false,
"ratio": 3.7956810631229234,
"config_test": false,
"h... |
# A middleware that implements cookie-based sessions using Beaker.
import beaker.middleware
from pump.util import wsgi
# Adds a "session" key to the request. Takes the following options:
#
# - store:
# One of "memory", "database", "file", "cookie", "dbm", "memcached",
# or "google". Defaults to "memo... | {
"repo_name": "adeel/pump",
"path": "pump/middleware/session.py",
"copies": "1",
"size": "4189",
"license": "mit",
"hash": 1491062508756447500,
"line_mean": 39.6796116505,
"line_max": 78,
"alpha_frac": 0.6304607305,
"autogenerated": false,
"ratio": 3.6713409290096406,
"config_test": false,
"h... |
''' a middleware to serve static files from a configured directory'''
__all__ = ['static']
import os
import urllib.parse
from .file import file
def forbidden():
return 403, {'Content-Type': 'text/html'}, '<html><body><h2>Forbidden</h2></body></html>'
def success(file):
return 200, {}, file
def static(public_di... | {
"repo_name": "web-i/ripplet",
"path": "ripple/middlewares/static.py",
"copies": "1",
"size": "1071",
"license": "mit",
"hash": -4976499714170884000,
"line_mean": 27.9459459459,
"line_max": 91,
"alpha_frac": 0.6181139122,
"autogenerated": false,
"ratio": 3.6804123711340204,
"config_test": false... |
# AMIGA_HW.py
#
# DEMO Python code to switch the AMIGAs audio filter ON and OFF on the fly.
# It also changes the video mode to PAL or NTSC if required.
# (C)2007-2012, B.Walker, G0LCU. Now issued as Public Domain, you may do
# with it as you please.
#
# Written in such a way that almost anyone can understand how it wo... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578255_AMIGAHeads_Only_Poking_HW_Memory_Address/recipe-578255.py",
"copies": "1",
"size": "5191",
"license": "mit",
"hash": -5574228363311314000,
"line_mean": 42.5630252101,
"line_max": 155,
"alpha_frac": 0.5933641975,
"autogenerated": false... |
# AMIGA_Peek_Mem.py
#
# DEMO code to show how to peek/read a single BYTE from any address for the
# Classic AMIGA A1200(HD), E-UAE and WinUAE. Although the code only does BYTE
# depth it is easily possible to add, WORD length, (I've already done so).
# (Soon there will be a demo to poke/write to a memory or HW address ... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/578189_AMIGAHeads_Only_Peeking_Memory_Address_Classic/recipe-578189.py",
"copies": "1",
"size": "9818",
"license": "mit",
"hash": 484000610933758850,
"line_mean": 45.5428571429,
"line_max": 157,
"alpha_frac": 0.6685082873,
"autogenerated": f... |
#a mimic joint can act as a gear between two joints
#you can control the gear ratio in magnitude and sign (>0 reverses direction)
import pybullet as p
import time
p.connect(p.GUI)
p.loadURDF("plane.urdf", 0, 0, -2)
wheelA = p.loadURDF("differential/diff_ring.urdf", [0, 0, 0])
for i in range(p.getNumJoints(wheelA)):
... | {
"repo_name": "MadManRises/Madgine",
"path": "shared/bullet3-2.89/examples/pybullet/examples/mimicJointConstraint.py",
"copies": "2",
"size": "1638",
"license": "mit",
"hash": 5318097543519920000,
"line_mean": 33.8510638298,
"line_max": 83,
"alpha_frac": 0.5122100122,
"autogenerated": false,
"rat... |
"""A Min heap is a complete binary tree [CBT] (implemented using array)
in which each node has a value smaller than its sub-trees"""
from math import ceil
class MinHeap:
def __init__(self, arr=None):
self.heap = []
self.heap_size = 0
if arr is not None:
self.create_min_heap(ar... | {
"repo_name": "anubhavshrimal/Data_Structures_Algorithms_In_Python",
"path": "Heaps/MinHeap.py",
"copies": "1",
"size": "3372",
"license": "mit",
"hash": 852777912426217100,
"line_mean": 30.8113207547,
"line_max": 103,
"alpha_frac": 0.5771055753,
"autogenerated": false,
"ratio": 3.862542955326460... |
""" A mini API framework.
"""
from __future__ import unicode_literals
import json
import re
from django.conf import settings
from django.contrib.gis.measure import D
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse, Http404, HttpResponseForbidden, HttpResponseBadRequest
from ... | {
"repo_name": "opencorato/represent-boundaries",
"path": "boundaries/base_views.py",
"copies": "2",
"size": "18246",
"license": "mit",
"hash": 7543582215020585000,
"line_mean": 36.2367346939,
"line_max": 151,
"alpha_frac": 0.5976104352,
"autogenerated": false,
"ratio": 4.327798861480076,
"confi... |
""" A minimal application using the Qt console-style Jupyter frontend.
This is not a complete console app, as subprocess will not be able to receive
input, there is no real readline support, among other limitations.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD Licens... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/qtconsole/qtconsoleapp.py",
"copies": "1",
"size": "16819",
"license": "mit",
"hash": 2770537533948160500,
"line_mean": 35.4837310195,
"line_max": 96,
"alpha_frac": 0.6084190499,
"autogenerated": false,
"ratio": 4.241... |
""" A minimal application using the ZMQ-based terminal IPython frontend.
This is not a complete console app, as subprocess will not be able to receive
input, there is no real readline support, among other limitations.
Authors:
* Min RK
* Paul Ivanov
"""
#------------------------------------------------------------... | {
"repo_name": "sodafree/backend",
"path": "build/ipython/build/lib.linux-i686-2.7/IPython/frontend/terminal/console/app.py",
"copies": "3",
"size": "5217",
"license": "bsd-3-clause",
"hash": 1332183983444967700,
"line_mean": 32.8766233766,
"line_max": 92,
"alpha_frac": 0.609929078,
"autogenerated":... |
"""A minimal example to lint playbook for undefined variables"""
# pylint: disable=W0603,W0613
# TODO: Add tests.
import inspect
import multiprocessing
import os
import sys
from ansible.cli.playbook import PlaybookCLI # pylint: disable=E0611,F0401
from ansible.errors import AnsibleUndefinedVariable
from ansible.pl... | {
"repo_name": "host-anshu/simpleInterceptor",
"path": "example/lint_pbook/lint.py",
"copies": "1",
"size": "3760",
"license": "mit",
"hash": 4068460928338356700,
"line_mean": 30.8644067797,
"line_max": 96,
"alpha_frac": 0.6478723404,
"autogenerated": false,
"ratio": 3.9085239085239087,
"config_... |
"""A minimal, full screen text editor.
"""
import re
from Tkinter import *
from textarea import TextArea
from tkSimpleDialog import askstring
from tkFileDialog import asksaveasfilename, askopenfilename
from tkMessageBox import askokcancel
import os_sniffer
class MinimalEdit(Tk):
"""The minimaled... | {
"repo_name": "jeremyosborne/python",
"path": "general/minimaledit/minimaledit.py",
"copies": "1",
"size": "6007",
"license": "mit",
"hash": 4360021962408174000,
"line_mean": 33.9700598802,
"line_max": 102,
"alpha_frac": 0.562676877,
"autogenerated": false,
"ratio": 4.148480662983426,
"config_t... |
"""A minimalistic FTP util. A shell client for Python ftplib
getwelcome - Return the welcome message sent by the server in reply to the initial connection. (This message sometimes
contains disclaimers or help information that may be relevant to the user.)
connect [host=''] [port=0] [timeout=None] - Connect to the giv... | {
"repo_name": "litvinchuck/python-scripts",
"path": "ftp.py",
"copies": "2",
"size": "5795",
"license": "mit",
"hash": 7338775312013232000,
"line_mean": 40.6474820144,
"line_max": 119,
"alpha_frac": 0.7004664018,
"autogenerated": false,
"ratio": 4.253490080822925,
"config_test": false,
"has_n... |
""" A minimal jsonschema validator.
Supports only a tiny subset of jsonschema.
"""
from croniter import croniter
from pytz import all_timezones
class ValidationError(Exception):
pass
def validate(obj, schema, obj_name="value"):
if schema.get("type") == "string":
if not isinstance(obj, str):
... | {
"repo_name": "healthchecks/healthchecks",
"path": "hc/lib/jsonschema.py",
"copies": "2",
"size": "2662",
"license": "bsd-3-clause",
"hash": 2121037052741972000,
"line_mean": 35.9722222222,
"line_max": 85,
"alpha_frac": 0.5694966191,
"autogenerated": false,
"ratio": 4.245614035087719,
"config_t... |
# a (minimal) python script to make a (24BPP) PNG out of RGB data
# only with standard dependencies
# Ange Albertini BSD Licence 2015
import struct, sys, zlib, binascii
DEPTH8 = 8
MODE_TRUECOLOR = 2
COMPRESSION_DEFLATE = 0
NO_FILTER = 0
NO_INTERLACING = 0
rawfilename, width, height = sys.argv[1:4]
width, height = i... | {
"repo_name": "angea/corkami",
"path": "misc/python/rgb2png.py",
"copies": "1",
"size": "1367",
"license": "bsd-2-clause",
"hash": -5463465958753986000,
"line_mean": 26.34,
"line_max": 78,
"alpha_frac": 0.6181419166,
"autogenerated": false,
"ratio": 3.1790697674418604,
"config_test": false,
"... |
"""A minimal SExpression parser for terms, goals, and theorems from HOL Light.
Assumes SExpressions of the form '(word1 word1 (word1) () (() ()))'.
That is, spaces and parantheses are treated as separators, bare words are
accepted as SExpressions, and nodes can have 0 children. The expression above
has 5 children: 'wo... | {
"repo_name": "tensorflow/deepmath",
"path": "deepmath/deephol/utilities/sexpression_parser.py",
"copies": "1",
"size": "3443",
"license": "apache-2.0",
"hash": 2436482763530975000,
"line_mean": 30.8796296296,
"line_max": 80,
"alpha_frac": 0.6148707523,
"autogenerated": false,
"ratio": 3.36230468... |
"""A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.
Don't import directly from third-party code; use the `locale` module instead!
"""
import sys
import _locale
if sys.platform.startswith("win"):
def getpreferredencoding(do_setlocale=... | {
"repo_name": "huguesv/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/_bootlocale.py",
"copies": "40",
"size": "1801",
"license": "apache-2.0",
"hash": 6849969450716602000,
"line_mean": 38.152173913,
"line_max": 77,
"alpha_frac": 0.588006663,
"autogenerated": false,
"ratio": 4.318944... |
# A minimal text editor.
#
# To be done:
# - Update viewrect after resize
# - Handle horizontal scrollbar correctly
# - Functionality: find, etc.
from Carbon.Menu import DrawMenuBar
from FrameWork import *
from Carbon import Win
from Carbon import Qd
from Carbon import TE
from Carbon import Scrap
import os
import macf... | {
"repo_name": "TathagataChakraborti/resource-conflicts",
"path": "PLANROB-2015/seq-sat-lama/Python-2.5.2/Mac/Demo/textedit/ped.py",
"copies": "39",
"size": "10512",
"license": "mit",
"hash": -319992567368376400,
"line_mean": 28.2813370474,
"line_max": 94,
"alpha_frac": 0.5244482496,
"autogenerated"... |
# A minimal text editor using MLTE. Based on wed.py.
#
# To be done:
# - Functionality: find, etc.
from Menu import DrawMenuBar
from FrameWork import *
from Carbon import Win
from Carbon import Ctl
from Carbon import Qd
from Carbon import Res
from Carbon import Scrap
import os
from Carbon import MacTextEditor
from Car... | {
"repo_name": "kjc88/sl4a",
"path": "python/src/Mac/Demo/mlte/mlted.py",
"copies": "39",
"size": "11096",
"license": "apache-2.0",
"hash": 7996692490143777000,
"line_mean": 28.6684491979,
"line_max": 114,
"alpha_frac": 0.5373107426,
"autogenerated": false,
"ratio": 3.6778256546237986,
"config_t... |
# a minimal tracking script - this will start all peer
# services and attach everything appropriately
# change parameters depending on your pan eyeY, pins and
# Arduino details
# all commented code is not necessary but allows custom
# options
port = "COM8"
eyeXPin = 3
eyeYPin = 6
headXPin = 10
headYPin = 9
eyes = ... | {
"repo_name": "MyRobotLab/pyrobotlab",
"path": "home/Alessandruino/InMoov.Alessandruino.py",
"copies": "1",
"size": "2463",
"license": "apache-2.0",
"hash": -1408929468548347600,
"line_mean": 29.8,
"line_max": 124,
"alpha_frac": 0.7149817296,
"autogenerated": false,
"ratio": 2.8606271777003482,
... |
# a minimal tracking script - this will start all peer
# services and attach everything appropriately
# change parameters depending on your pan tilt, pins and
# Arduino details
# all commented code is not necessary but allows custom
# options
port = "COM12"
xServoPin = 13
yServoPin = 12
#select the pin where to start... | {
"repo_name": "DarkRebel/myrobotlab",
"path": "src/resource/Python/examples/Tracking.PIRTriggered.borsaci06.py",
"copies": "4",
"size": "2143",
"license": "apache-2.0",
"hash": -6971620421257550000,
"line_mean": 28.3698630137,
"line_max": 100,
"alpha_frac": 0.7512832478,
"autogenerated": false,
"... |
# A minimal version of the ItemServer that uses the BlockChain.info JSON api
# https://blockchain.info/api/json_rpc_api
from jsonrpc import ServiceProxy
class ItemClient():
def __init__(self, wallet, password, second_password):
self.second_password = second_password
self.btc = ServiceProxy(
'https:/... | {
"repo_name": "thandal/passe-partout",
"path": "pp/pp_item_client_blockchain.py",
"copies": "1",
"size": "1119",
"license": "mit",
"hash": 2322956003138069500,
"line_mean": 33.96875,
"line_max": 76,
"alpha_frac": 0.6997319035,
"autogenerated": false,
"ratio": 3.443076923076923,
"config_test": f... |
#A minimum example illustrating how to use a
#Gaussian Processes for binary classification
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from sklearn.preprocessing import normalize
n = 1000
def stochProcess(x, a, b):
return np.exp(a*x) * np.cos(b*x)
def fx(processes, x):
sam... | {
"repo_name": "KHP-Informatics/sleepsight-analytics",
"path": "scarp.py",
"copies": "1",
"size": "1058",
"license": "apache-2.0",
"hash": 947072383408660600,
"line_mean": 19.3461538462,
"line_max": 72,
"alpha_frac": 0.6559546314,
"autogenerated": false,
"ratio": 2.5617433414043584,
"config_test... |
"""A minimum implementation of the actor model.
An actor is basically a daemon thread processing messages from a queue,
and a message is composed of a method and its arguments (you can think
of it as a single-threaded executor).
By default the queue size is infinite, but you may specify a finite
queue size, which is ... | {
"repo_name": "clchiou/garage",
"path": "py/garage/garage/threads/actors.py",
"copies": "1",
"size": "20805",
"license": "mit",
"hash": -4660248809034923000,
"line_mean": 32.3413461538,
"line_max": 78,
"alpha_frac": 0.6026916607,
"autogenerated": false,
"ratio": 4.093860684769775,
"config_test"... |
## a mini PDB parser which provides all the functionality we need
import string, sys, os
import Common
## generic PDBError exception, never used directly
class PDBError(Exception):
pass
class ResidueNumberError(PDBError):
def __init__(self, number):
self.number = number
def __str__(self):
... | {
"repo_name": "dakoner/PDB",
"path": "__init__.py",
"copies": "1",
"size": "9591",
"license": "apache-2.0",
"hash": -6740440898929897000,
"line_mean": 32.0724137931,
"line_max": 301,
"alpha_frac": 0.5373787926,
"autogenerated": false,
"ratio": 3.822638501394978,
"config_test": false,
"has_no_... |
# Amino acid properties from https://www.ncbi.nlm.nih.gov/pubmed/15895431
# TODO: Missing ['C'][12] - set to zero
# TODO: Missing ['P'][14] - set to zero
# Add selenocysteine
hydrophobic_props = {
'A': (7.3, -0.368, 0.67, 297, 0, 0, 0.1, 1, 0.5, -0.1, -2.89, 25, 5.1, 0.87, 1.94, 0.89, -1.52, 0.3),
'C': (-9.2... | {
"repo_name": "massie/notebooks",
"path": "aa_props.py",
"copies": "2",
"size": "6634",
"license": "apache-2.0",
"hash": -2248640615891661300,
"line_mean": 82.9746835443,
"line_max": 114,
"alpha_frac": 0.4526680736,
"autogenerated": false,
"ratio": 1.6070736434108528,
"config_test": false,
"h... |
# Ami_Square_Wave.py
#
# DEMO to generate an audio tone from one of the classic AMIGA audio
# channels, in this case a square wave. Almost any waveform is possible
# and the Left Mouse Button is used to STOP this DEMO.
#
# MINIMUM Requirements Are:-
# 68EC020 CPU and 2MB RAM total, example, a standard A1200(HD),
# WinU... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/577971_AMIGAHeads_Only_Generating_Audio_Signal_Text/recipe-577971.py",
"copies": "1",
"size": "6451",
"license": "mit",
"hash": -383967958270615000,
"line_mean": 39.6772151899,
"line_max": 119,
"alpha_frac": 0.6450910222,
"autogenerated": fa... |
''' A mixin class for building mixed models '''
import numpy as np
from scipy.linalg import inv
from scipy.sparse import issparse
from scipy.sparse.linalg import inv as spinv
class MixedModelMixin(object):
"Mixin class for populations to implement mixed model functions"
def __getmatrix(self, mtype):
... | {
"repo_name": "jameshicks/pydigree",
"path": "pydigree/stats/mixedmodel/mixin.py",
"copies": "1",
"size": "2823",
"license": "apache-2.0",
"hash": 5200402038018341000,
"line_mean": 34.2875,
"line_max": 79,
"alpha_frac": 0.6110520723,
"autogenerated": false,
"ratio": 4.383540372670807,
"config_t... |
"""A mix of `bib.evensen2009ensemble` and `bib.sakov2008implications`.
.. note::
Since there is no noise, and the system is stable,
the rmse's from this HMM go to zero as `T` goes to infinity.
Thus, benchmarks largely depend on the initial error,
and so these absolute rmse values are not so useful
... | {
"repo_name": "nansencenter/DAPPER",
"path": "dapper/mods/LA/evensen2009.py",
"copies": "1",
"size": "1559",
"license": "mit",
"hash": -8807714321585998000,
"line_mean": 25.4237288136,
"line_max": 74,
"alpha_frac": 0.6626042335,
"autogenerated": false,
"ratio": 2.664957264957265,
"config_test":... |
# Ammianus writes in prose. Things will be a little different from Statius
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# functions are mostly made by Sarah Otts
def add_to_database(verse_entries, db):
logger.info("... | {
"repo_name": "oudalab/phyllo",
"path": "phyllo/extractors/ammianusDB.py",
"copies": "1",
"size": "7041",
"license": "apache-2.0",
"hash": 8362915272768862000,
"line_mean": 35.1076923077,
"line_max": 119,
"alpha_frac": 0.5544666951,
"autogenerated": false,
"ratio": 3.729343220338983,
"config_te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.