text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import print_function
import unittest
from lunisolar import ChineseDate
class LunarDateTestCases(unittest.TestCase):
def setUp(self):
self.moon_landing = ChineseDate.from_gregorian(1969, 7, 20)
self.july_fourth = ChineseDate.from_chinese(2009, 5, 12, True)
def test_construction... | {
"content_hash": "21d51ca9697de892a753f595817c7e74",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 41.71111111111111,
"alnum_prop": 0.6672882258923815,
"repo_name": "yen223/lunisolar",
"id": "fc98b6afe8d53d179f0d7102ff54ee941a1c2eb8",
"size": "3754... |
class Pure:
def __init__(self):
pass
@staticmethod
def filter(node):
new_node = node.copy(lambda x: x.pure())
return new_node.before([]).after([]) | {
"content_hash": "f3b62ed96dc113a11e504d6e88f9c9f3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 48,
"avg_line_length": 22.875,
"alnum_prop": 0.546448087431694,
"repo_name": "diNard/Saw",
"id": "87e6218cd053e35c12ae547672ef25b914732b27",
"size": "183",
"binary": false... |
class Prime:
"""Provides methods to obtain prime numbers and use them."""
def __init__(self):
pass
# Cache for already calculated prime numbers
cache = [2, 3]
@staticmethod
def get_prime(index):
"""
Returns the prime number at the given index. The index starts with 0.
... | {
"content_hash": "b6638753e86b7e6d4784549859fd86ad",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 107,
"avg_line_length": 29.487179487179485,
"alnum_prop": 0.5134782608695653,
"repo_name": "Koopakiller/School",
"id": "88adb7d1671e57627ab3c6c79b68273701b78d76",
"size": "... |
from __future__ import absolute_import
from sqlalchemy.orm import joinedload, subqueryload_all
from changes.api.base import APIView
from changes.models import Job, JobPhase, JobStep
class JobPhaseIndexAPIView(APIView):
def get(self, job_id):
job = Job.query.options(
subqueryload_all(Job.phas... | {
"content_hash": "cd3239b0d60985063a6c9fef4891998f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 87,
"avg_line_length": 36.75757575757576,
"alnum_prop": 0.6240725474031328,
"repo_name": "bowlofstew/changes",
"id": "8e3e655f62e2b010ec19f1d73054f0e709d3648b",
"size": "12... |
import collections
import StringIO
TupleToken = collections.namedtuple('Token', ['value'])
class Token(TupleToken):
def __repr__(self):
return "{0}(value={1})".format(type(self).__name__, self.value)
TupleNoValueToken = collections.namedtuple('Token', [])
class NoValueToken(TupleNoValueToken):
value... | {
"content_hash": "a81927e0e295757900d226e4647c76e5",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 131,
"avg_line_length": 28,
"alnum_prop": 0.543563579277865,
"repo_name": "hakril/PythonForWindows",
"id": "b8429424972f435619b8bb3316040eeb982dc202",
"size": "7644",
"b... |
import collections
import datetime
import hashlib
import logging
import re
import socket
import time
import xmlrpclib
import redis
import requests
from celery.task import task
from django.conf import settings
from django.db import transaction
from django.utils.timezone import now
from crate.pypi.utils.lock import L... | {
"content_hash": "ff906354491a89bd83ce0b010939f8bd",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 139,
"avg_line_length": 35.82017543859649,
"alnum_prop": 0.6090363658626179,
"repo_name": "crateio/crate.pypi",
"id": "821a7c2e990ec5d1f349dce2e9dab7a0b8296d0d",
"size": "... |
import numpy as np
from filter import movingaverage
def gentrends(x, window=1/3.0, charts=True):
"""
Returns a Pandas dataframe with support and resistance lines.
:param x: One-dimensional data set
:param window: How long the trendlines should be. If window < 1, then it
will be take... | {
"content_hash": "c23105567f5370dd7761b000641085b6",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 79,
"avg_line_length": 32.926530612244896,
"alnum_prop": 0.563530432626751,
"repo_name": "fraka6/trading-with-python",
"id": "f7265a0b69f2307625509d7efc09f1872f2f80c4",
"s... |
import logging
import uuid
from functools import partial
from itertools import (
count,
dropwhile,
)
from pgshovel.replication.validation import TRANSACTION_START_EVENT_TYPES
from pgshovel.utilities.protobuf import get_oneof_value
logger = logging.getLogger(__name__)
class FormattedBatchIdentifier(object):... | {
"content_hash": "455e93658913daeb9165ab9c1d87ccf7",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 99,
"avg_line_length": 27.925,
"alnum_prop": 0.6374216651745748,
"repo_name": "disqus/pgshovel",
"id": "817b8cf0e0f80ce1ad73765c5ae3ff447f1b094e",
"size": "2234",
"binary... |
from .scatter_type import ScatterPlotType, NScannedNPlotType
from .scatter_type import DocsExaminedPlotType, DurationLineType
from .event_type import EventPlotType, RSStatePlotType
from .range_type import RangePlotType
from .histogram_type import HistogramPlotType
from .connchurn_type import ConnectionChurnPlotType
| {
"content_hash": "35013c29696758c9bc228f411d2ae663",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 64,
"avg_line_length": 52.833333333333336,
"alnum_prop": 0.8675078864353313,
"repo_name": "rueckstiess/mtools",
"id": "5acaaf7c3cbec1b9fdd4808394364d543967feee",
"size": "31... |
import os
from qrl.core.ChainManager import ChainManager
from qrl.core.GenesisBlock import GenesisBlock
from qrl.core.State import State
from pyqryptonight.pyqryptonight import PoWHelper, StringToUInt256, UInt256ToString
def main():
persistent_state = State()
chain_manager = ChainManager(state=persistent_sta... | {
"content_hash": "5c59c2547e5dbbe42f84d7225fb6f043",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 98,
"avg_line_length": 35.765957446808514,
"alnum_prop": 0.570493753718025,
"repo_name": "theQRL/QRL",
"id": "140ead4f7a0cd4cbbde332a01b33244744567286",
"size": "1681",
"... |
__author__ = 'greghines'
import numpy as np
import matplotlib.pyplot as plt
import csv
import sys
import os
import pymongo
client = pymongo.MongoClient()
db = client['plankton_2015-01-01']
classification_collection = db["plankton_classifications"]
subject_collection = db["plankton_subjects"]
user_collection = db["plan... | {
"content_hash": "5c530873b69b24dac7c88993247a57ee",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 99,
"avg_line_length": 31.029411764705884,
"alnum_prop": 0.7023696682464455,
"repo_name": "zooniverse/aggregation",
"id": "8c03b3d0e576d77c6b185e09f096f8fa249ada40",
"size"... |
'''
Multipoint communication service protocol (T.125)
'''
import logging
import ptypes
from ptypes import *
from protocol import gcc, ber, per
ptypes.setbyteorder(ptypes.config.byteorder.bigendian)
### MCS protocol data (BER Encoding)
class Protocol(ber.Protocol.copy(recurse=True)):
pass
class Element(ber.Eleme... | {
"content_hash": "a9ccadcea6e8ffe3a47123c4304b2c74",
"timestamp": "",
"source": "github",
"line_count": 523,
"max_line_length": 208,
"avg_line_length": 30.261950286806883,
"alnum_prop": 0.5764832248688949,
"repo_name": "arizvisa/syringe",
"id": "7ee3664aedebf1ca2130d0b66ad01ac5bb12ad6e",
"size": "1... |
import csv
import re
import os
from os.path import join
from datetime import datetime
# app
import database
class CSVMongo(object):
def __init__(self, date_format=None, **kwargs):
self.date_format = date_format
def _has_pattern_date(self, value,
dt_pattern=r"[\d]{4}-[\d]{2}-[\d]{2} [\d... | {
"content_hash": "6af9f850b0ddb7c18350cafa7dc2c33e",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 82,
"avg_line_length": 32.126666666666665,
"alnum_prop": 0.5470014525835235,
"repo_name": "horacioibrahim/spekdump",
"id": "8fd2dfb06f8835957684cea45ef3cfbe190d9349",
"siz... |
import sys
from vulkan import *
from PySide2 import (QtGui, QtCore)
validationLayers = [
'VK_LAYER_LUNARG_standard_validation'
]
deviceExtensions = [
VK_KHR_SWAPCHAIN_EXTENSION_NAME
]
enableValidationLayers = True
class InstanceProcAddr(object):
T = None
def __init__(self, func):
self.__f... | {
"content_hash": "8da123089ce7466083c049a2442ffb72",
"timestamp": "",
"source": "github",
"line_count": 623,
"max_line_length": 133,
"avg_line_length": 32.93258426966292,
"alnum_prop": 0.6342545206414193,
"repo_name": "mackst/vulkan-tutorial",
"id": "00983060c6542186304d58608fb931bd3e0e4070",
"size... |
from django.conf.urls import url
from .views import TrackingView
urlpatterns = [
url(r'^$', TrackingView.as_view(), name='tracker'),
]
| {
"content_hash": "622a87724de96774e191811a739c1fd7",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 55,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.7,
"repo_name": "alex20465/open-scriptorium",
"id": "4ee87fdee137a3fff9a174dbdd0ca7ea7069461d",
"size": "167",
"... |
import random
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_shuffle(self):
"""
Make sure shuffled sequence does not lose elements.
"""
random.shuffle(self.seq)
self.seq.sort()
self.assert... | {
"content_hash": "f166cc1bd9f2779b1662b57972f67865",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 78,
"avg_line_length": 23.77777777777778,
"alnum_prop": 0.6339563862928349,
"repo_name": "alexisbellido/programming-in-python",
"id": "8914b5991a29780c75a650019cfc45ea3f58ca3... |
"""3-tier example."""
import patterns.threetier as tiers
class DataTier(tiers.DataTier):
"""Data tier."""
def __init__(self, dictionary):
"""Initialize with dictionary."""
self.dictionary = dictionary
def store(self, key, data):
"""Store some data."""
self.dictionary[k... | {
"content_hash": "fbffbfb2c5cbc6706621de883ddb84aa",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 57,
"avg_line_length": 20.923076923076923,
"alnum_prop": 0.5873161764705882,
"repo_name": "jmanuel1/patterns",
"id": "237bd5a335c6fd5a2c7bb74b3a914d555d6914d3",
"size": "10... |
import os
import random
import base64
from errno import ECONNRESET
from socket import error as SocketError
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse # NOQA
from circuits.web.headers import Headers
from circuits.protocols.http import HTTP
from circuits.core.handl... | {
"content_hash": "a8662c469b0d248e1e82f8e3f8575397",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 38.45522388059702,
"alnum_prop": 0.6312827479138367,
"repo_name": "nizox/circuits",
"id": "2078f398656bcdba83ea5c3134dfe3d342afdd32",
"size": "5153"... |
from sklearn.metrics import coverage_error, accuracy_score
from sklearn.metrics import label_ranking_loss
from sklearn.metrics import label_ranking_average_precision_score
from sklearn.metrics import hamming_loss
from sklearn import metrics
from collections import Counter
import math
import numpy as np
def patk(predi... | {
"content_hash": "50472ba03662df3eaf8a76987400d065",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 120,
"avg_line_length": 40.485915492957744,
"alnum_prop": 0.6376761175856671,
"repo_name": "yashchandak/GNN",
"id": "9a33d4b7a4f55c3436369caac5d2c27bad30367a",
"size": "57... |
"""MQTT gateway module."""
import logging
import time
import uuid
import json
import asyncio
from tornado.ioloop import PeriodicCallback
from gmqtt import Client as MQTTClient
from pyaiot.gateway.common import Node, GatewayBase
logger = logging.getLogger("pyaiot.gw.mqtt")
MQTT_HOST = 'localhost'
MQTT_PORT = 1886... | {
"content_hash": "517003719aa6036baaf04e3599d83b8c",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 76,
"avg_line_length": 35.975903614457835,
"alnum_prop": 0.6026456798392499,
"repo_name": "pyaiot/pyaiot",
"id": "4631cd250a366aa54d6aa5b3b7af86c9594edd13",
"size": "7515"... |
from __future__ import print_function
from PIL import VERSION, PILLOW_VERSION, _plugins
import warnings
class _imaging_not_installed:
# module placeholder
def __getattr__(self, id):
raise ImportError("The _imaging C module is not installed")
try:
# give Tk a chance to set up the environment, in ... | {
"content_hash": "68cb85cec464d79dfb55603c64ba7fa1",
"timestamp": "",
"source": "github",
"line_count": 2260,
"max_line_length": 105,
"avg_line_length": 33.15486725663717,
"alnum_prop": 0.5632857333511277,
"repo_name": "SurfasJones/icecream-info",
"id": "18d2c8267cf188f761771d645cb0294de3165439",
"... |
"""Remove the contents of the file system on a MicroPython device.
Usage:
microcleanfs PORT [options]
Options:
-f --force Remove ALL files from filesystem w/o preserving excludes
"""
import traceback
from typing import List
import sys
import time
from ampy.files import Files
from ampy.pyboard impor... | {
"content_hash": "7bd119e0073e164bf6413518feb3f7db",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 26.015625,
"alnum_prop": 0.6132132132132132,
"repo_name": "vlasovskikh/intellij-micropython",
"id": "f661ea621bc0c34189ad03d44029648bbaf9823c",
"size... |
"""Pibooth base states.
"""
import traceback
from pibooth.utils import LOGGER, BlockConsoleHandler
class StateMachine(object):
def __init__(self, plugins_manager, configuration, application, window):
self.states = set()
self.failsafe_state = None
self.active_state = None
# Share... | {
"content_hash": "bf7e171dd67e5658339fcc3c2d8a0fae",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 90,
"avg_line_length": 35.7,
"alnum_prop": 0.5719887955182072,
"repo_name": "werdeil/pibooth",
"id": "2e5c420c20d68778a5464209e06dfb2a389e6137",
"size": "3595",
"binary"... |
from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_does_partial_html_entity_encoding(team):
text = linkify_text("& < > ' \"", team)
assert text == "& < > ' \""
def test_linkifytext_names_with_paranthesis(team):
text = li... | {
"content_hash": "8c8f377dda61ac230d94d693f487d16a",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 87,
"avg_line_length": 30.40740740740741,
"alnum_prop": 0.6674786845310596,
"repo_name": "rawdigits/wee-slack",
"id": "60bf92354cddae25e3c8a6619809bef6379b2a46",
"size": "... |
from config import Config
import tensorflow as tf
import functools
from util.model import Model, conv2d
def get_model(name):
name = functools.partial('{}-{}'.format, name)
self_pos = tf.placeholder(Config.dtype, Config.data_shape, name='self_pos')
self_ability = tf.placeholder(Config.dtype, Config.data_... | {
"content_hash": "e9aa383ef8e047c5279d3eb96e757fd9",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 109,
"avg_line_length": 35.484848484848484,
"alnum_prop": 0.6323654995730145,
"repo_name": "milkpku/BetaElephant",
"id": "ff490f714e1ed199bf56f972f293df504eb65f52",
"size":... |
from numpy import inf, hstack, invert
from pyface.confirmation_dialog import confirm
from pyface.constant import YES
# ============= enthought library imports =======================
from traits.api import Bool, List
from pychron.core.helpers.iterfuncs import groupby_group_id
from pychron.core.progress import progres... | {
"content_hash": "7795a5e0ac22a9352d1eb12733b8594d",
"timestamp": "",
"source": "github",
"line_count": 578,
"max_line_length": 112,
"avg_line_length": 34.62975778546713,
"alnum_prop": 0.5564548361310951,
"repo_name": "NMGRL/pychron",
"id": "d5caf8753d96e2e8f4cc33e8dcf830dbfc00651a",
"size": "20750... |
from platformio.platforms.base import BasePlatform
class AtmelsamPlatform(BasePlatform):
"""
Atmel | SMART offers Flash- based ARM products based on the ARM
Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB
to 2MB of Flash including a rich peripheral and feature mix.
http://www... | {
"content_hash": "8fbc56f65d8abef56b3d3f1570018d9f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 71,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.5621890547263682,
"repo_name": "TimJay/platformio",
"id": "e11d98a431a4d3f6f5bb10a02f9d3f8c538de9dd",
"size": "87... |
"""
pymc3.blocking
Classes for working with subsets of parameters.
"""
import numpy as np
import collections
__all__ = ['ArrayOrdering', 'DictToArrayBijection', 'DictToVarBijection']
VarMap = collections.namedtuple('VarMap', 'var, slc, shp')
# TODO Classes and methods need to be fully documented.
class ArrayOrder... | {
"content_hash": "8ae8220a77d212277f17ca7b874cf27d",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 92,
"avg_line_length": 21.19327731092437,
"alnum_prop": 0.5329103885804917,
"repo_name": "MCGallaspy/pymc3",
"id": "8283789c1db9073fff60d4a00e25cf1db6ed3189",
"size": "252... |
"""
Scheduler queues
"""
import marshal
import pickle
from os import PathLike
from pathlib import Path
from typing import Union
from queuelib import queue
from scrapy.utils.deprecate import create_deprecated_class
from scrapy.utils.request import request_from_dict
def _with_mkdir(queue_class):
class Directori... | {
"content_hash": "7742b8d60dd18b25fa2c4674216f8827",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 105,
"avg_line_length": 32.47027027027027,
"alnum_prop": 0.6717163309472283,
"repo_name": "scrapy/scrapy",
"id": "2fa84fc008f1dd720e5d238993a194396f18986a",
"size": "6007"... |
"""
This file was automatically generated.
"""
import six
class users(object):
def __init__(self, zap):
self.zap = zap
def users_list(self, contextid=None):
params = {}
if contextid is not None:
params['contextId'] = contextid
return six.next(six.itervalues(self.... | {
"content_hash": "767a306234143db87e3b59ad769aedc3",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 188,
"avg_line_length": 52.44897959183673,
"alnum_prop": 0.6805447470817121,
"repo_name": "Woolworths/zap-api-python",
"id": "658fd53f9cb2ffdeb26c24283c163b32d86acfdf",
"si... |
def main():
'''
ansible oc module for version
'''
module = AnsibleModule(
argument_spec=dict(
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
version=dict(default=True, type='bool'),
state=dict(default='list', type='str',
... | {
"content_hash": "534e4dc31da2cdd84db547e57d6c037e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 94,
"avg_line_length": 30.548387096774192,
"alnum_prop": 0.587117212249208,
"repo_name": "andrewklau/openshift-tools",
"id": "1695b1898856120767453607828f494d407fd3bd",
"si... |
import json
from abc import ABCMeta, abstractmethod
import numpy as np
from pychemia.utils.computing import deep_unicode
from numbers import Integral, Real
class PyChemiaJsonable(object):
"""
Abstract base class specifying how to convert objects from/to dictionaries.
PyChemiaJsonable objects must implemen... | {
"content_hash": "d92af01ce6b8e0208252a2294f36daef",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 93,
"avg_line_length": 28.558139534883722,
"alnum_prop": 0.6054560260586319,
"repo_name": "MaterialsDiscovery/PyChemia",
"id": "acedf80d032e2059dbdb29b615f0a97930d58019",
"... |
import re
class WSGITeamMiddleware():
def __init__(self, application):
self.app = application
def __call__(self, environ, start_repsonse):
m = re.match(r"(/teams/([\w-]+))(.*)", environ["PATH_INFO"])
if m:
environ["SCRIPT_NAME"] = m.group(1)
environ["PATH_INFO... | {
"content_hash": "35d0e4e4fef081968d01c95c6e611563",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 68,
"avg_line_length": 28.8,
"alnum_prop": 0.5486111111111112,
"repo_name": "pinax/pinax-teams",
"id": "43567d75cc6b9b08af322c186eaa85628c37edd0",
"size": "518",
"binary"... |
from msrest.serialization import Model
class CaptureDescription(Model):
"""Properties to configure capture description for eventhub.
:param enabled: A value that indicates whether capture description is
enabled.
:type enabled: bool
:param encoding: Enumerates the possible values for the encoding... | {
"content_hash": "ab33d4b51e064b23a28d5e0d11557368",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 122,
"avg_line_length": 44.891304347826086,
"alnum_prop": 0.6799031476997579,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "db8c8e2aca756cacca6e50d4b96157899327f785",
... |
from swgpy.object import *
def create(kernel):
result = Ship()
result.template = "object/ship/shared_freighterlight_tier4.iff"
result.attribute_template_id = -1
result.stfName("","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "168e062add3d1e773ebb3aed12c98e97",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 64,
"avg_line_length": 20.923076923076923,
"alnum_prop": 0.6727941176470589,
"repo_name": "obi-two/Rebelion",
"id": "cf94417c4653540c0cdcc8d7551d9c3943dfaa61",
"size": "417... |
import datetime
from django.db import models
from django.utils import timezone
# vsak model je svoja tabela v bazi
# ta ma 3 stolpce, question, pub_date, id
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
... | {
"content_hash": "e96dead6327ebd782c48613366b4adaa",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 94,
"avg_line_length": 31.129032258064516,
"alnum_prop": 0.7098445595854922,
"repo_name": "Irrialite/YouTune",
"id": "7568e70d30a1b08d22003089bef036b7d20c0c55",
"size": "96... |
"""Helpers class for accessing system information."""
from __future__ import unicode_literals
import os
import subprocess
import time
import uuid
def ReadDMI(name):
"""Reads a DMI value from the /sys filesystem.
Args:
name (str): the name of the DMI value to read.
Returns:
str: the DMI value, or Non... | {
"content_hash": "d7012efe4ab8c67ae6634a4b1a74f92d",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 77,
"avg_line_length": 22.408695652173915,
"alnum_prop": 0.653861078773768,
"repo_name": "google/GiftStick",
"id": "b51c7f64b76c69472a82fce9e6989ee41c64d90b",
"size": "317... |
"""This module provides an interface to cutadapt with a set of commonly
used adapters for trimming
"""
from bipy.utils import flatten_options, append_stem, flatten, which
import subprocess
import os
from bcbio.utils import safe_makedir, file_exists
import sh
import yaml
import bcbio.provenance.do as do
# adapter sequ... | {
"content_hash": "0ff5a444f9184bfeb13f283808fbf3de",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 77,
"avg_line_length": 40.70503597122302,
"alnum_prop": 0.6101095793566631,
"repo_name": "roryk/bipy",
"id": "92684cbcce719786619a9a32150916b47201686a",
"size": "5658",
... |
"""
Interface Vistrails - TreeLayoutLW to align version trees.
Originally written by Lauro D. Lins.
"""
from __future__ import division
from tree_layout import TreeLW, NodeLW, TreeLayoutLW
from vistrails.core.data_structures.point import Point
########################################################################... | {
"content_hash": "7003f13b340efa8046e4568ec8395d06",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 86,
"avg_line_length": 32.02923976608187,
"alnum_prop": 0.5316779258718276,
"repo_name": "hjanime/VisTrails",
"id": "cdd1edbb696d3a37ceed2e2e0d03cd162c1d8575",
"size": "73... |
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('report', '0003_auto_20151015_1921'),
]
operations = [
migrations.AlterField(
model_name='report',
name='client',
field=m... | {
"content_hash": "54956c16ed7da86ac7abaca3c4591b8b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 104,
"avg_line_length": 30.622222222222224,
"alnum_prop": 0.5355587808417998,
"repo_name": "KlubJagiellonski/pola-backend",
"id": "93eb50267cf1c1fa8c76a70d1372dc57ef8f7b53",
... |
'''
Example code for adaptive filtering and thresholding.
'''
import re
import os
# OpenCV
import numpy as np
import cv2
# Histogram and plotting
import matplotlib.pyplot as plt
import matplotlib as mpl
# ----------------------------------------------------------------
def screenshot_filename(title):
'''Get th... | {
"content_hash": "89c14ac5c95bf52a2f2613ab415aaaab",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 118,
"avg_line_length": 37.682758620689654,
"alnum_prop": 0.6052342606149341,
"repo_name": "mjul/making-the-computer-see-ndc-2014",
"id": "dbfe49ba39a99307dcbc51332b635009e7... |
from cherrypy.test import test
test.prefer_parent_path()
import cherrypy
script_names = ["", "/path/to/myapp"]
def setup_server():
# Set up site
cherrypy.config.update({
'environment': 'test_suite',
'tools.proxy.on': True,
'tools.proxy.base': 'www.mydomain.test',
... | {
"content_hash": "0d787ef3bcb8e28f29cff7eaa3e2c0d1",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 85,
"avg_line_length": 37.553030303030305,
"alnum_prop": 0.5021182166633045,
"repo_name": "cread/ec2id",
"id": "410058433f15be55121182c374e6532eaa199f6e",
"size": "4957",
... |
from testtools import matchers
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import test
CONF = config.CONF
class VolumesGetTestJSON(base.BaseV2ComputeTest):
@classmethod
def resource_setup(cls):
super(VolumesGetTestJSON, c... | {
"content_hash": "9157bee948b51e5c4925c8edbfcdb746",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 79,
"avg_line_length": 42.01724137931034,
"alnum_prop": 0.567090685268773,
"repo_name": "afaheem88/tempest_neutron",
"id": "d4414273b50e56d4b10776192d651b283bd0263d",
"size... |
import numpy as np
def calculate_weights(labels, num_classes):
'''
Calculate class balancing weights for unary potentials
Parameters
----------
labels: numpy array
Array with ground truth labels
num_classes: numpy array
Number of classes in the dataset
Returns
-----... | {
"content_hash": "26fa8c51109c9de012e49131fbdfb8dd",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 85,
"avg_line_length": 25.788235294117648,
"alnum_prop": 0.5948905109489051,
"repo_name": "Vaan5/piecewisecrf",
"id": "2e062889b369b3030a08e8394422df69fed6a12b",
"size": "2... |
import collections
import os
import re
import time
import sys
import click
from netCDF4 import Dataset
import numpy as np
import numpy.ma as ma
import osr
import rasterio
import pdb
from .. import geotools
from .. import utils
def adbc_conv(ss):
m = re.match(r'(\d+)(ad)_pop.zip', ss, re.IGNORECASE)
if m:
y ... | {
"content_hash": "7a3165e994d7528b1f20c0157094fbbd",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 35.932203389830505,
"alnum_prop": 0.6047169811320755,
"repo_name": "ricardog/raster-project",
"id": "ad56f5dea09cc34df48635d76efc6acf6b4c78dc",
"siz... |
import functools
import logging
import os
import subprocess
import lockfile
from oslotest import base as test_base
from six import moves
from six.moves.urllib import parse
import sqlalchemy
import sqlalchemy.exc
from oslo.db.openstack.common.gettextutils import _LE
from oslo.db.sqlalchemy import utils
LOG = logging.... | {
"content_hash": "b10eb40d0b92f48ed6c1e75806a6e3d4",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 79,
"avg_line_length": 41.047430830039524,
"alnum_prop": 0.5506018295618681,
"repo_name": "vikt0rs/oslo.db",
"id": "661b0a7e6bbe60f51666fab90a655d69364e279a",
"size": "110... |
"""Support for Genius Hub sensor devices."""
from datetime import timedelta
from typing import Any, Dict
from homeassistant.const import DEVICE_CLASS_BATTERY
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
import homeassistant.util.dt as dt_util
from . import DOMAIN, GeniusDevice, GeniusEntity
... | {
"content_hash": "2ed501f879ab7ab0e1ac4a9961273f4b",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 88,
"avg_line_length": 29.803418803418804,
"alnum_prop": 0.6013765414396329,
"repo_name": "qedi-r/home-assistant",
"id": "bd73c700e65471862dba7a486589c283e5bd5b65",
"size"... |
from .cartridges import NromCartridge
from .rom_file import RomFile
class CartridgeFactory:
cartridge_map = {
0: NromCartridge,
}
@classmethod
def create(cls, filename):
rom_file = RomFile.load(filename)
return cls.cartridge_map[rom_file.header.mapper](rom_file)
| {
"content_hash": "13458b409a985aabcd7627ed4d24d32f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 66,
"avg_line_length": 21.928571428571427,
"alnum_prop": 0.6775244299674267,
"repo_name": "Hexadorsimal/pynes",
"id": "d8682331d31e6986253e9253f42750334561bd20",
"size": "3... |
pytest_plugins = "pytester",
def test_passing_expect(testdir):
testdir.makepyfile(
"""
def test_func(expect):
expect(1 == 1)
""")
result = testdir.runpytest()
assert '1 passed' in result.stdout.str()
def test_failing_expect(testdir):
testdir.makepyfile(
"""... | {
"content_hash": "78e0f6be58f00bc443f25cd811d524c9",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 57,
"avg_line_length": 27.23728813559322,
"alnum_prop": 0.568139390168015,
"repo_name": "okken/pytest-expect",
"id": "330b093842932e70782d746b520dccde163b0d86",
"size": "16... |
"""Support for custom shell commands to turn a switch on/off."""
import logging
import subprocess
import voluptuous as vol
from homeassistant.components.switch import (
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
SwitchEntity,
)
from homeassistant.const import (
CONF_COMMAND_OFF,
CONF_COMMAND_ON,
CONF_... | {
"content_hash": "4c8fb643d6465a01d81a57efba6a814a",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 87,
"avg_line_length": 30.341176470588234,
"alnum_prop": 0.6033346258239628,
"repo_name": "mKeRix/home-assistant",
"id": "7f62970b63997fe316523a348c345a8945690db1",
"size"... |
import argparse
from datetime import date
from modules.scrape_edgar_index import EDGAR_INDEX
from modules.scrape_edgar_forms import EDGAR_INDEX_FORMS
from generic.generic_meta_enrich import GENERIC_META_ENRICH
from generic.logger import LOGGER
from enrich_modules.compute_symbology import TO_SYMBOLOGY
def main():
... | {
"content_hash": "76f30ce5ea6922ff9bb71d592bb37fc2",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 72,
"avg_line_length": 35.78021978021978,
"alnum_prop": 0.4781941031941032,
"repo_name": "gophronesis/ernest",
"id": "5e39ceabd22ea3248ce5835e8a544d3bd2148308",
"size": "32... |
import struct
from shockabsorber.model.sections import Section, SectionMap
from shockabsorber.loader.util import SeqBuffer
def create_section_map(f, loader_context):
return find_and_read_section(f, "mmap", loader_context)
def find_and_read_section(f, tag_to_find, loader_context):
while True:
xheader =... | {
"content_hash": "ed3d02abda957ce5b2e9b7137d3966f8",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 98,
"avg_line_length": 35.95384615384615,
"alnum_prop": 0.5614035087719298,
"repo_name": "Brian151/OpenShockwave",
"id": "f1597155ff0f57bde7300f0d83332e0f777e8ca9",
"size":... |
"""Aid in submitting information to MusicBrainz.
This plugin allows the user to print track information in a format that is
parseable by the MusicBrainz track parser [1]. Programmatic submitting is not
implemented by MusicBrainz yet.
[1] http://wiki.musicbrainz.org/History:How_To_Parse_Track_Listings
"""
from __futu... | {
"content_hash": "9f50abcc7ddbb88ec9dd76cbf58be3d5",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.6533333333333333,
"repo_name": "artemutin/beets",
"id": "58b357dd3375ce8cefcad921693b0f355ec4d607",
"size": "2188... |
from django.core.management.base import BaseCommand, CommandError
from data_collection.models import *
from extraction.models import FirmTrainingSet
from django.conf import settings
from nanospider import Spider
from mlscrape import PageClassifier, ElementClassifier
import os, json
class Command(BaseCommand):
he... | {
"content_hash": "595c156e7f64bcbb0a7bd839c7c13ebf",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 130,
"avg_line_length": 38.82802547770701,
"alnum_prop": 0.5680774278215223,
"repo_name": "sunlightlabs/hanuman",
"id": "59b41b07a8e82e3b4d58692c3015a752b6f1b866",
"size":... |
from inputs.bibleIn import BibleInput
from inputs.tldrnewsIn import TLDRNewsInput
from inputs.weatherIn import WUnderGroundInput as WeatherIn
from processors.bibleProc import BibleProc
from processors.tldrnewsProc import TLDRNewsProc
from processors.weatherProc import WeatherProc
from outputs import textOut
from outp... | {
"content_hash": "2f1f7004e076766d43874b5f5b9dd827",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 29.2,
"alnum_prop": 0.769406392694064,
"repo_name": "Narcolapser/Little-News-Processor",
"id": "19f6db097304e0f7b7aee7c3ee4c59a37ab87f32",
"size": "8... |
"""spielberg_proj URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | {
"content_hash": "cfe55bcfaa9b0dbbfc26f92d969e677e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 79,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.7012987012987013,
"repo_name": "carlmjohnson/spielberg",
"id": "76fa7ee98b5fbf48fee0b228f9b9225f7fd77d81",
"size"... |
"""
Display service status for Icinga2.
Configuration parameters:
base_url: the base url to the icinga-web2 services list (default '')
ca: (default True)
cache_timeout: how often the data should be updated (default 60)
disable_acknowledge: enable or disable counting of acknowledged
service prob... | {
"content_hash": "0aff54af12f46ad8ae66d664a13e62ce",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 80,
"avg_line_length": 32.23376623376623,
"alnum_prop": 0.6273166800966962,
"repo_name": "alexoneill/py3status",
"id": "cd95a9ca58366c5b2ac1e23df5d7035fd5c41239",
"size": "... |
"""Test Motor by testing that Synchro, a fake PyMongo implementation built on
top of Motor, passes the same unittests as PyMongo.
This program monkey-patches sys.modules, so run it alone, rather than as part
of a larger test suite.
"""
import importlib
import importlib.abc
import importlib.machinery
import sys
impor... | {
"content_hash": "7ca64064a3291c8bf39922d6f28c0293",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 118,
"avg_line_length": 36.0606936416185,
"alnum_prop": 0.661296786086399,
"repo_name": "mongodb/motor",
"id": "3b241d90a12dc6051df516d2033300a60e48dd48",
"size": "13056",... |
def orderBy(sortlist, orderby=[], desc=[]):
'''orderBy(sortlist, orderby, desc) >> List
sortlist: list to be sorted
orderby: list of field indexes
desc: list of field indexes that are to be sorted descending'''
orderby.reverse()
for i in orderby:
sortlist.sort(lambda x, y: cmp(*[(x... | {
"content_hash": "bb2e857052bd98f43a1303845612e230",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 81,
"avg_line_length": 42.111111111111114,
"alnum_prop": 0.6174142480211082,
"repo_name": "ActiveState/code",
"id": "561688e52db1786827c1a51d92db38d5ee3d5e7a",
"size": "379"... |
"""Tests for the histogram plugin summary generation functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorboard.plugins.histogram import metadata
from tensorboard.plugins.histogram import summa... | {
"content_hash": "b0b428d3a52c5f12aad31f70c3572878",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 42.44776119402985,
"alnum_prop": 0.6404711673699015,
"repo_name": "ioeric/tensorboard",
"id": "39f1f51351a89a1c28ba63e796415c0a3377732e",
"size": "6... |
from __future__ import absolute_import
from . import restcall
from . import cbLogs
def registerUser(system, authenticatedUser, email, password):
newUserCredentials = {
"email": email,
"password": password
}
cbLogs.info("Registering", email + "...")
url = authenticatedUser.url
# we ... | {
"content_hash": "3a411ebeda1e88ed9e13df2a61c4d486",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 188,
"avg_line_length": 39.78481012658228,
"alnum_prop": 0.6264715240216354,
"repo_name": "ClearBlade/Python-API",
"id": "0cfe55b5a0d937b1f52da65d4de119b7c3c6deb9",
"size":... |
from scrapy.item import Item, Field
class Kanji(Item):
"""Single kanji item"""
character = Field()
| {
"content_hash": "be87820bd591037ed689c784ca4e89ec",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 35,
"avg_line_length": 21.6,
"alnum_prop": 0.6666666666666666,
"repo_name": "Xifax/suzu-web",
"id": "c1573a12cfb23aa9cd8c16bc6af356fb5e455fd7",
"size": "241",
"binary": fa... |
import json
import os
import subprocess
from time import sleep
import boto3
from boto3 import Session
def main():
print("Getting InstanceTypes from all regions")
regions = []
regions.extend(Session().get_available_regions("ec2"))
regions.extend(Session().get_available_regions("ec2", partition_name="... | {
"content_hash": "7e7a3f9e22aeabf066949d192340676b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 87,
"avg_line_length": 31.77777777777778,
"alnum_prop": 0.6025641025641025,
"repo_name": "william-richard/moto",
"id": "d8f0b41882d759bdf1d20f445193de5dfbc269c6",
"size": "... |
"""Test configs for fully_connected."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow.compat.v1 as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils imp... | {
"content_hash": "822688ddd16d5e78000471a9373c0f22",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 80,
"avg_line_length": 30.90625,
"alnum_prop": 0.5561172901921132,
"repo_name": "sarvex/tensorflow",
"id": "141bfef6516ff2d9d44fa7ef9ee39ee7455239ac",
"size": "5634",
"b... |
""" An MDI top-level application window. """
from __future__ import absolute_import
# Major package imports.
import wx
# Enthought library imports.
from traits.api import Bool, Instance, Int, Tuple
# Local imports.
from .application_window import ApplicationWindow
from .image_resource import ImageResource
try:
... | {
"content_hash": "54782c5b93903dc1d71a116ffb9b2e74",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 79,
"avg_line_length": 31.028901734104046,
"alnum_prop": 0.5458271236959762,
"repo_name": "geggo/pyface",
"id": "dee57a0b1867a7f39ac55f34c4b0d0488e618cec",
"size": "6008",... |
"""
This module contains generic utilities and configuration information for use
by the other submodules of the `pySMART` package.
"""
# Python built-ins
import ctypes
import os
import platform
from subprocess import Popen, PIPE
import warnings
# Configuration definitions
_min_smartctl_ver = {
'Windows' : {
... | {
"content_hash": "7031bf05b952eec8dcbf61893b3b7916",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 79,
"avg_line_length": 31.089655172413792,
"alnum_prop": 0.5849600709849158,
"repo_name": "Hellowlol/HTPC-Manager",
"id": "47eba61b122540795d18bf798e8bbfc16f0b84ba",
"size... |
from unittest import mock
from oslo_config import cfg
from oslo_log import log
from watcher.common import clients
from watcher.common import exception
from watcher.decision_engine.datasources import grafana
from watcher.tests import base
import requests
CONF = cfg.CONF
LOG = log.getLogger(__name__)
@mock.patch.ob... | {
"content_hash": "064e35518c8a3162c6241b4f01f738a2",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 79,
"avg_line_length": 39.31095406360424,
"alnum_prop": 0.5697078651685393,
"repo_name": "stackforge/watcher",
"id": "1e716d7420b28e4a5bcbe7ed78c342057be38017",
"size": "1... |
import random
import bz2
import numpy
from numpy import array, where, concatenate
from numpy import kron, ones, sqrt, sum
from os.path import exists
from esvm.mldata import convert
try:
import arff
have_arff = True
except ImportError:
have_arff = False
def create_dataset():
"""Read the file with firs... | {
"content_hash": "7c7ca3becaa8260ef7ba1bed263ca037",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 110,
"avg_line_length": 33.19444444444444,
"alnum_prop": 0.6099372384937238,
"repo_name": "shogun-toolbox/shogun",
"id": "78322522e6b0163d72f263513003773cbd51edaf",
"size"... |
from django.db.models.query_utils import DeferredAttribute
from .compat import get_local_field_names
class DeferredManager(object):
def __init__(self, instance, model, deferred_attrs):
self.instance = instance
self.model = model
self.deferred_attrs = deferred_attrs
self.is_loaded =... | {
"content_hash": "93ad2a338c3f05751478ec89e25de71e",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 103,
"avg_line_length": 40.146341463414636,
"alnum_prop": 0.6359356014580801,
"repo_name": "team23/django_deferred_polymorph",
"id": "280488b56bc53dbc682866388e2a6b7b3574f0f... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
class HM1ThenClausePart1CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HM1ThenClausePart1CompleteLHS.
"""
# Flag this instance as compiled now
... | {
"content_hash": "dc73b396e1edbac2bea12b6f68c4a07b",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 120,
"avg_line_length": 48.28813559322034,
"alnum_prop": 0.5182520182520183,
"repo_name": "levilucio/SyVOLT",
"id": "9452d993622d6163cec99d6f469f0d01fb5b05b2",
"size": "11... |
n = input()
nums = list(map(int, input().split()))
print(sum(nums)) | {
"content_hash": "b180ed5252c8b4ea5b2734cc13cd0926",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 38,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6268656716417911,
"repo_name": "osamadel/Hacker-Rank",
"id": "3ea0f0cf39c21a8bf234d4adad5ea4e8b04d3ae4",
"size": "... |
"""
# BEGIN CLASSIC_STRATEGY_TESTS
>>> joe = Customer('John Doe', 0) # <1>
>>> ann = Customer('Ann Smith', 1100)
>>> cart = [LineItem('banana', 4, .5), # <2>
... LineItem('apple', 10, 1.5),
... LineItem('watermellon', 5, 5.0)]
>>> Order(joe, cart, FidelityPromo()) # <3>
<... | {
"content_hash": "7e1bc50d92b69c0b95181deaea2e63e4",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 76,
"avg_line_length": 29.601941747572816,
"alnum_prop": 0.5903574942604133,
"repo_name": "pythonprobr/oscon2014",
"id": "47d534c7fff60089bf4b9deff0c818394ed0e54f",
"size"... |
from django.contrib import admin
from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from .models import Band
class AdminActionsTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.superuser = User.o... | {
"content_hash": "d7b75bed870ce4f07c1e651889bb083b",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 117,
"avg_line_length": 37.76923076923077,
"alnum_prop": 0.5832253286428439,
"repo_name": "ar4s/django",
"id": "b61641c0c91db04411a332859891e5333eb6abf2",
"size": "5401",
... |
""" This module returns stats about the DynamoDB table """
from datetime import datetime, timedelta
from boto.exception import JSONResponseError, BotoServerError
from retrying import retry
from dynamic_dynamodb.aws import dynamodb
from dynamic_dynamodb.log_handler import LOGGER as logger
from dynamic_dynamodb.aws.clo... | {
"content_hash": "d0c91a9d059f647428811701c071633f",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 79,
"avg_line_length": 33.80371352785146,
"alnum_prop": 0.6377903327055869,
"repo_name": "acquiachrisnagy/dynamic-dynamodb",
"id": "ce87f5778e6a41b7d17a13bf76a97eaec080001a"... |
"""Timestamp utilities."""
from __future__ import absolute_import
import datetime
class Timestamp(object):
"""Represents a Unix second timestamp with microsecond granularity.
Can be treated in common timestamp arithmetic operations as a numeric type.
Internally stores a time interval as an int of microsecon... | {
"content_hash": "30d3dcbc3bf4d3d7f0eb61b5dda47556",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 28.942105263157895,
"alnum_prop": 0.6763047826877614,
"repo_name": "vikkyrk/incubator-beam",
"id": "8b2ccda1f16837e6f4774a73359f222d1fb050e1",
"size... |
import unittest
import numpy as np
import paddle.fluid.core as core
from paddle.fluid.op import Operator
from op_test import OpTest
import paddle
import paddle.fluid as fluid
import numpy
from paddle.fluid.framework import _test_eager_guard
def calculate_momentum_by_numpy(
param,
grad,
mu,
velocity,
... | {
"content_hash": "5c7ecff916f1ac1c6f24941854152fdc",
"timestamp": "",
"source": "github",
"line_count": 1058,
"max_line_length": 80,
"avg_line_length": 34.51984877126654,
"alnum_prop": 0.5599364766442144,
"repo_name": "luotao1/Paddle",
"id": "fd9b8b88016bd749815fc4de252e1820a7e8126f",
"size": "3713... |
"""The Post class."""
from __future__ import unicode_literals, print_function, absolute_import
import io
from collections import defaultdict
import datetime
import hashlib
import json
import os
import re
import string
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin # NO... | {
"content_hash": "2df88ae6a0a837458067c8f4685029b4",
"timestamp": "",
"source": "github",
"line_count": 1189,
"max_line_length": 159,
"avg_line_length": 39.52649285113541,
"alnum_prop": 0.5781220077877312,
"repo_name": "x1101/nikola",
"id": "9364dc05fa69048c34658a454aa39d3cc7a7a39e",
"size": "48141... |
import tornado.web
from handlers.base import BaseHandler
class ErrorHandler(tornado.web.ErrorHandler, BaseHandler):
"""
Generic error handler
"""
pass
| {
"content_hash": "09f4415b14160c2e3649ec33716133a6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 58,
"avg_line_length": 18.77777777777778,
"alnum_prop": 0.7218934911242604,
"repo_name": "Lepthy/glowing-journey",
"id": "4c6264c60264cc49bb5ef015526357b2d3b68c9a",
"size": ... |
"""C_8_email
Revision ID: c9c1ca205749
Revises: daf5f84ca180
Create Date: 2016-01-07 11:24:10.202218
"""
# revision identifiers, used by Alembic.
revision = 'c9c1ca205749'
down_revision = 'daf5f84ca180'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | {
"content_hash": "c7b23201ab5769f80e9b3896d52a4c16",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 83,
"avg_line_length": 29.1,
"alnum_prop": 0.6655211912943871,
"repo_name": "menghao2015/MyBlog",
"id": "e699b566f435086c7204cd9ef16f40b9ea4fec73",
"size": "873",
"binary... |
from django.core.urlresolvers import reverse
from django.http import HttpRequest # noqa
from django.test.utils import override_settings # noqa
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
INDEX_URL = reverse('horizon:project:access_and_s... | {
"content_hash": "6eeac9ec66a0fee46a008224547cc248",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 79,
"avg_line_length": 44.10569105691057,
"alnum_prop": 0.6387096774193548,
"repo_name": "yangleo/cloud-github",
"id": "bbad063738d0728520e0e5d2a4ec1c0c52e2de95",
"size": ... |
from keystone.common import dependency
from keystone.common import sql
from keystone import exception
from keystone.identity.mapping_backends import mapping as identity_mapping
from keystone.identity.mapping_backends.sql import Mapping
from keystone.identity.backends import sql as model
try: from oslo_log import log
ex... | {
"content_hash": "ac41dfda4486abac28f36362eb120e93",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 97,
"avg_line_length": 44.35294117647059,
"alnum_prop": 0.581343943412909,
"repo_name": "telefonicaid/fiware-keystone-spassword",
"id": "01d9fb7da70b7c14948c9f039ad9f4dceb763... |
import sys
import datetime
from pymongo.errors import OperationFailure
sys.path[0:0] = [""]
try:
import unittest2 as unittest
except ImportError:
import unittest
import pymongo
from bson.tz_util import utc
from mongoengine import (
connect, register_connection,
Document, DateTimeField
)
from mongoen... | {
"content_hash": "8337a453ae21440157e7c31bc7b1c5db",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 115,
"avg_line_length": 36.25974025974026,
"alnum_prop": 0.643505253104107,
"repo_name": "9nix00/mongoengine",
"id": "4a02696af67c0b1d84ce803e477116de3e38af46",
"size": "8... |
import os
from typing import Callable, Dict, List, Tuple
_vars = {}
_var_hooks = {}
_VAR_DEFAULT_VAL = False
def _run_var_hooks(key: str, run_global_hooks: bool=False):
""" Run all of the update hooks for the specified variable """
if run_global_hooks:
hook_key = ""
else:
hook_key = key... | {
"content_hash": "a7d1bf67150c7e89d85329bbe70f4ca5",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 66,
"avg_line_length": 23.319444444444443,
"alnum_prop": 0.5783204288266826,
"repo_name": "zstuartp/AstroReduce",
"id": "2f0d750ba303c7fa4a737f976927e25b74f129f5",
"size": ... |
import socket
import cPickle
filename = 'cached_lookups'
cached_lookups = {}
def load():
global cached_lookups
try:
cached_lookups = cPickle.load(open(filename))
except:
cached_lookups = {}
print 'loaded DNS lookups:', len(cached_lookups)
def gethostbyaddr(addr):
try:
retu... | {
"content_hash": "6af888fc026a60a3e5ff30dd97639b6b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 68,
"avg_line_length": 26.25925925925926,
"alnum_prop": 0.610719322990127,
"repo_name": "rauljim/power-pcap-analyzer",
"id": "6b3b5f9aded587d25116af59826ea12fd4bb3908",
"si... |
"""
Module containing utilities for NDFrame.sample() and .GroupBy.sample()
"""
from __future__ import annotations
import numpy as np
from pandas._libs import lib
from pandas._typing import FrameOrSeries
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCSeries,
)
def preprocess_weights(obj: FrameOrS... | {
"content_hash": "a51412b2b6d8588536185d7f2554f1a2",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 86,
"avg_line_length": 30.631944444444443,
"alnum_prop": 0.5923826796644752,
"repo_name": "gfyoung/pandas",
"id": "e4bad22e8e43cadbf1c02bf6a51c0aaa74f7504e",
"size": "4411... |
import ibmsecurity.utilities.tools
import logging
from ibmsecurity.utilities import tools
logger = logging.getLogger(__name__)
module_uri = "/isam/felb/configuration/services"
requires_modules = None
requires_version = None
requires_model = "Appliance"
def add(isamAppliance, service_name, address, active, port, we... | {
"content_hash": "9800550a1e5248896807299248a2673e",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 164,
"avg_line_length": 38.1875,
"alnum_prop": 0.5839607201309329,
"repo_name": "IBM-Security/ibmsecurity",
"id": "0b2203524a72487114261e03890801b808e93e0c",
"size": "6110... |
import re
import sys
import urllib
from django.db import models
from django.db.models import Q
from django.conf import settings
from django.core import exceptions
from mint.django_rest.rbuilder import errors
from mint.django_rest.rbuilder.modellib import XObjIdModel, type_map
from mint.jobstatus import FINISHED
from... | {
"content_hash": "2d913d63b8cc0d27cc23b3b91d4f8e99",
"timestamp": "",
"source": "github",
"line_count": 747,
"max_line_length": 110,
"avg_line_length": 34.77510040160642,
"alnum_prop": 0.5859414097085883,
"repo_name": "sassoftware/mint",
"id": "f625cf434a51951002ac2335085b2ac219054e12",
"size": "26... |
import os
import init_multiprocessing # import before numpy
import numpy as np
import time
from multiprocessing import Pool, cpu_count, current_process
from analysis_basin_plotting import plot_proj_timeseries, plot_basin_occupancy_timeseries, plot_basin_step
from singlecell_class import Cell
from singlecell_constants... | {
"content_hash": "76e05383ff7bb4cdbc1c16ef40334bd0",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 202,
"avg_line_length": 49.65365025466893,
"alnum_prop": 0.6024413595021542,
"repo_name": "mattsmart/biomodels",
"id": "49d1268fd00b35e17a70e8af1e724d317676381b",
"size": ... |
import cv2
import numpy as np
import os
import sys
import time
#from uploadToGDrive import main_upload
#import uploadToGDrive
def readimage(filename):
print filename
image = cv2.imread(filename, cv2.IMREAD_GRAYSCALE) # reading image
if image is None:
print 'Can not find the image!'
... | {
"content_hash": "7fd8c6f463081ce0ed5db9b6a7afe5ff",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 100,
"avg_line_length": 40.2,
"alnum_prop": 0.527363184079602,
"repo_name": "DBMSRmutl/meterOCR",
"id": "272d369341e8c6f9a6b7394ae88dfc48b3f95629",
"size": "5829",
"bina... |
import os
import numpy as np
import pytest
from pymt.printers.nc.ugrid import (
NetcdfRectilinearField,
NetcdfStructuredField,
NetcdfUnstructuredField,
)
def new_rectilinear(**kwds):
from pymt.grids import RectilinearField
ndims = kwds.pop("ndims", 1)
shape = np.random.randint(3, 101 + 1, n... | {
"content_hash": "84fca234f808360e29275944d3f06273",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 27.022222222222222,
"alnum_prop": 0.665296052631579,
"repo_name": "csdms/coupling",
"id": "de2764de5c46867ee1ee2afc76a84b5a21e6ae2f",
"size": "1216",... |
"""
Contains player and NPC-classes.
"""
import os
import numpy as np
import pygame
import logging
from Placeable import Placeable
from Item import Item
from Text import TextDialog
from FindPath import Maze
DEFAULT_HEALTH = 100
DEFAULT_FEAR = 75
DEFAULT_HATE = 25
class Person(Placeable):
"""
Base class for a... | {
"content_hash": "614eb33031c1bb8fcf81e892e272b098",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 85,
"avg_line_length": 30.19496855345912,
"alnum_prop": 0.5135388460737347,
"repo_name": "benedicteb/outcast",
"id": "124f442b2c1ca5cb67b3e78f9d001a40f21772aa",
"size": "9... |
from __future__ import absolute_import
from django.conf import settings
import logging
def _module_logger_helper(glob):
logger_path = '.'.join([settings.SURROUND_ROOT_LOGGER_NAME, glob['__name__']])
logger = logging.getLogger(logger_path)
entities = {}
entities['logger'] = logger
for level in ['... | {
"content_hash": "f2421b8686b817a08a98ffef9f0ea1c1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 82,
"avg_line_length": 26.782608695652176,
"alnum_prop": 0.6801948051948052,
"repo_name": "sniegu/django-surround",
"id": "6f2ad5a5ba2252cfb36a2a69ed5ed0007694d99a",
"size"... |
from ansible.callbacks import AggregateStats
class CustomAggregateStats(AggregateStats):
"""
Holds stats about per-host activity during playbook runs.
"""
def __init__(self):
super(CustomAggregateStats, self).__init__()
self.results = {}
def compute(self, runner_results, setup=Fals... | {
"content_hash": "ca23d807eff85643a6fd0b6547f989e8",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 106,
"avg_line_length": 36.08571428571429,
"alnum_prop": 0.5835312747426762,
"repo_name": "Tech-Twnel/python-webhooks",
"id": "e781d5092159df93dc0684c2a11fa88587b4310b",
"s... |
"""Helpers for overriding numpy functions.
We override numpy functions in `~astropy.units.Quantity.__array_function__`.
In this module, the numpy functions are split in four groups, each of
which has an associated `set` or `dict`:
1. SUBCLASS_SAFE_FUNCTIONS (set), if the numpy implementation
supports Quantity; we ... | {
"content_hash": "a230ae8c825bba156bb1706f512aedb7",
"timestamp": "",
"source": "github",
"line_count": 1043,
"max_line_length": 82,
"avg_line_length": 33.350910834132314,
"alnum_prop": 0.6367974701739255,
"repo_name": "dhomeier/astropy",
"id": "c035a7bf34beab763b160796dafc1db68530ea98",
"size": "3... |
import maya.cmds as cmds
class mirrorSelectedShapes(object):
def __init__(self):
self.sculpt_shape = sculpt_shape = ""
self.base_shape = base_shape = ""
self.cur_shapes = []
def main(self,*args):
self.cur_shapes = cmds.ls(sl=True,fl=True)
if len(self.cur_shapes)>0:
... | {
"content_hash": "7d3e96d5b70e93cc0d077c99bed94c45",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 139,
"avg_line_length": 50.42857142857143,
"alnum_prop": 0.5599622285174694,
"repo_name": "aaronfang/personal_scripts",
"id": "ddced5427588abd0e23fbb05a44ccd4115f4628b",
"... |
def extractfgiLaNTranslations(item):
"""
# 'fgiLaN translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'kimi no na wa' in item['tags']:
return buildReleaseMessageWithType(item, 'kimi no na... | {
"content_hash": "79977b351a5509608549aa536e99ba65",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 159,
"avg_line_length": 53.083333333333336,
"alnum_prop": 0.7362637362637363,
"repo_name": "fake-name/ReadableWebProxy",
"id": "c2c8f69ff2b0dc123b9043c546e37657c29bc5d6",
"... |
"""
Created on Fri Aug 29 12:07:20 2014
@author: ecksjoh
"""
from pptx import Presentation
from pptx.util import Inches, Px
img_path = 'monty-truth.png'
prs = Presentation()
blank_slide_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_slide_layout)
left = top = Inches(1)
pic = slide... | {
"content_hash": "4679eaaa6b2d502e603d0a5ef59a674d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 21.625,
"alnum_prop": 0.6782273603082851,
"repo_name": "DocBO/mubosym",
"id": "d605131028a4aaeaa9c805054c5ff697ab85b4ab",
"size": "544",
"binary": ... |
from exceptions import CommandError, ParameterError, UnexpectedUserExit
from CommandLineUI import CommandLineUI
from MenuUI import MenuUI
import os
clear = lambda: os.system('clear') # little hack because I hate writing. clear() can be used anywhere to clear the current console. Works even in IDE consoles
clas... | {
"content_hash": "9b73bac04f2462f005f72fa70f734499",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 158,
"avg_line_length": 46.65151515151515,
"alnum_prop": 0.6027931146476129,
"repo_name": "Zephyrrus/ubb",
"id": "84d5cf63782a0b17369a7a564630053ef3a36510",
"size": "3079",... |
from __future__ import print_function
import numpy as np
np.random.seed(1234) # for reproducibility?
# specifying the gpu to use
# import theano.sandbox.cuda
# theano.sandbox.cuda.use('gpu1')
import theano
import theano.tensor as T
import binary_net
import lasagne
import lasagne.objectives as LO
... | {
"content_hash": "90243516ac95862d71e3cedc56b785bd",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 208,
"avg_line_length": 32.722943722943725,
"alnum_prop": 0.5140230189178463,
"repo_name": "matthijsvk/multimodalSR",
"id": "fff68b2690738ecd5fbc4f1c4918eb669b743481",
"si... |
"""253. Meeting Rooms II
https://leetcode.com/problems/meeting-rooms-ii/
Given an array of meeting time intervals intervals where
intervals[i] = [start_i, end_i], return the minimum number
of conference rooms required.
Example 1:
Input: intervals = [[0,30],[5,10],[15,20]]
Output: 2
Example 2:
Input: intervals = [[... | {
"content_hash": "222af29c6084d1a75c2da253d9190480",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 67,
"avg_line_length": 25.974358974358974,
"alnum_prop": 0.5567620927936822,
"repo_name": "isudox/leetcode-solution",
"id": "e2a07b7519bdae7f2212dfc695e09c79c30969f1",
"siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.