text stringlengths 4 1.02M | meta dict |
|---|---|
import codecs
import sys
import typing as t
import warnings
# We do not trust traditional unixes.
has_likely_buggy_unicode_filesystem = (
sys.platform.startswith("linux") or "bsd" in sys.platform
)
def _is_ascii_encoding(encoding: t.Optional[str]) -> bool:
"""Given an encoding this figures out if the encodin... | {
"content_hash": "18aaac949a0f23a147b7474364a5b856",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 82,
"avg_line_length": 35.56363636363636,
"alnum_prop": 0.696319018404908,
"repo_name": "fkazimierczak/werkzeug",
"id": "36a3d12e9766571588ea34379117ccb5ee8a3b27",
"size": ... |
import time
from collections import OrderedDict
from threading import RLock
from mdstudio.util.exception import MDStudioException
class CacheDict(OrderedDict):
lock = RLock()
def __init__(self, max_age_seconds):
super(CacheDict, self).__init__(self)
self.max_age = max_age_seconds
if... | {
"content_hash": "61addcd4bf5ec52c8992d552d0f427ae",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 26.705882352941178,
"alnum_prop": 0.5,
"repo_name": "MD-Studio/MDStudio",
"id": "78c69f3166e16b52b442c645a6280e94d2fd175f",
"size": "2031",
"binary... |
from enum import Enum
class TextOperationStatusCodes(Enum):
not_started = "Not Started"
running = "Running"
failed = "Failed"
succeeded = "Succeeded"
class ComputerVisionErrorCodes(Enum):
invalid_image_url = "InvalidImageUrl"
invalid_image_format = "InvalidImageFormat"
invalid_image_si... | {
"content_hash": "2fab2032bd950505b8c52cee5f37b2b6",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 62,
"avg_line_length": 19.95098039215686,
"alnum_prop": 0.6122850122850123,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "81f543b7151b70aa234ef0048fca255407417f12",... |
from dtools import MapReduce
import sys
"""
Join relationship in Simple Python MapReduce Framework
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: document id
# value: text of the document
order_id = record[1]
# table line ite... | {
"content_hash": "2198c72bb35406d895fd47f1b6ef362c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 54,
"avg_line_length": 23.153846153846153,
"alnum_prop": 0.5448504983388704,
"repo_name": "houssemFat/MeeM-Dev",
"id": "ef25602cf13f2054dd94a9eabfde537a1ded414d",
"size": "... |
import json
import requests
from django_parse_push.settings import APPLICATION_ID, REST_API_KEY
class ApiClient(object):
api_url = "https://api.parse.com"
api_version = "1"
def __init__(self, application_id, rest_api_key):
self.application_id = application_id
self.rest_api_key = rest_api_... | {
"content_hash": "87cd3a82ed705a3c87876109186a77e5",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 95,
"avg_line_length": 30.57777777777778,
"alnum_prop": 0.5545058139534884,
"repo_name": "gkmngrgn/django-parse-push",
"id": "13c53a6fc71557c20ca196bd74ac58d9e188dd9f",
"si... |
"""Family module for Vikidia."""
#
# (C) Pywikibot team, 2010-2016
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
from pywikibot import family
class Family(family.SubdomainFamily):
"""Family class for Vikidia."""
name = '... | {
"content_hash": "0ffc11b7a609a39e2212e26ef8a07d66",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 67,
"avg_line_length": 22.75,
"alnum_prop": 0.6216640502354788,
"repo_name": "npdoty/pywikibot",
"id": "f3d4aa32b6df3287a878b42703fdaf21ad355eee",
"size": "661",
"binary"... |
import os
from speckenv import env
from speckenv_django import django_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATABASES = {
"default": django_database_url(
env("DATABASE_URL", default="postgres://127.0.0.1:5432/zivinetz")
)
}
DEFAULT_AUTO_FIELD = "django.db.models.AutoFiel... | {
"content_hash": "cad25cfc69edb83a129c58789de10d31",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 73,
"avg_line_length": 29.544117647058822,
"alnum_prop": 0.6436037829766053,
"repo_name": "matthiask/zivinetz",
"id": "e97ec6ed7db5b7525196e7ff85190f76d74de5cd",
"size": "2... |
"""Test class for IloPower module."""
import mock
from oslo.utils import importutils
from oslo_config import cfg
from ironic.common import boot_devices
from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
fro... | {
"content_hash": "a8ec7ab9dedabe670e9e823d83ea4272",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 79,
"avg_line_length": 45.373056994818654,
"alnum_prop": 0.6133379011076853,
"repo_name": "ramineni/myironic",
"id": "3614b689f350d302ac10cdb7af4ea18e63688a46",
"size": "9... |
import glob
import logging
import os
import pyauto_functional # Must be imported before pyauto
import pyauto
class ThemesTest(pyauto.PyUITest):
"""TestCase for Themes."""
def Debug(self):
"""Test method for experimentation.
This method will not run automatically.
"""
while True:
raw_inpu... | {
"content_hash": "2118581db083c29f3c6a3dcf9ce988cc",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 79,
"avg_line_length": 31.757575757575758,
"alnum_prop": 0.6479007633587787,
"repo_name": "gavinp/chromium",
"id": "2c81200c521c58d36cc01fffca5bdb03da056bff",
"size": "438... |
import _plotly_utils.basevalidators
class BordercolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="bordercolorsrc", parent_name="violin.hoverlabel", **kwargs
):
super(BordercolorsrcValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "beec9c2324a45f09a7a34ef645685234",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 85,
"avg_line_length": 34.5,
"alnum_prop": 0.6107660455486542,
"repo_name": "plotly/python-api",
"id": "1b513782c3a3937cb03e0bb6483186c91af22f9a",
"size": "483",
"binary"... |
from __future__ import absolute_import, division, print_function, \
with_statement
import os
import sys
import hashlib
import logging
import binascii
import struct
import base64
import time
import random
import hmac
import hashlib
import string
from shadowsocks import common
from shadowsocks.obfsplugin import pla... | {
"content_hash": "79414beaff5cc4865c5286ecf88f5799",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 230,
"avg_line_length": 43.71102661596958,
"alnum_prop": 0.5565414057063326,
"repo_name": "82604716/shadowsicks",
"id": "b845a9ac6233b5bfcc4eceb8f93f30f2e9719bf2",
"size":... |
"""A simple template system that compiles templates to Python code.
Basic usage looks like::
t = template.Template("<html>{{ myvalue }}</html>")
print t.generate(myvalue="XXX")
Loader is a class that loads templates from a root directory and caches
the compiled templates::
loader = template.Loader("/hom... | {
"content_hash": "6f40a23ad251ce96fac2c2bd8c2500ff",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 79,
"avg_line_length": 35.04710144927536,
"alnum_prop": 0.564630069954168,
"repo_name": "shirk3y/cyclone",
"id": "8d8bc9852e38732b937c8f5ac5f21416acacd80e",
"size": "29661... |
"""
Download API.
"""
# Standard library imports
from collections import deque
import json
import os
import sys
# Third part imports
from qtpy.QtCore import QByteArray, QObject, QTimer, QThread, QUrl, Signal
from qtpy.QtNetwork import QNetworkAccessManager, QNetworkRequest
import requests
# Local imports
from conda_... | {
"content_hash": "bd5f44b10be542e2064bffb8fe513907",
"timestamp": "",
"source": "github",
"line_count": 520,
"max_line_length": 78,
"avg_line_length": 29.573076923076922,
"alnum_prop": 0.5518923136948888,
"repo_name": "martindurant/conda-manager",
"id": "0c75f5a17429bb06c1bc0f632f22c01e17e81560",
"... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from random import randrange
from h2o.frame import H2OFrame
from h2o.utils.typechecks import assert_is_type
import numpy as np
def h2o_H2OFrame_ifelse():
"""
Python API test: h2o.frame.H2O... | {
"content_hash": "9858081bb5ca35f3db88060a28e2c552",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 119,
"avg_line_length": 30.17241379310345,
"alnum_prop": 0.7097142857142857,
"repo_name": "h2oai/h2o-3",
"id": "d4510289dbd462a0d4fba726a8927f61f4e80514",
"size": "875",
... |
import pytest
from copy import deepcopy
from minette import Topic, Priority
def test_init():
topic = Topic()
assert topic.name == ""
assert topic.status == ""
assert topic.is_new is False
assert topic.keep_on is False
assert topic.previous is None
assert topic.priority == Priority.Normal... | {
"content_hash": "84fc1c952215042365aa7440c29b16e6",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 44,
"avg_line_length": 22.607142857142858,
"alnum_prop": 0.669826224328594,
"repo_name": "uezo/minette-python",
"id": "5f92c03290ddee12b4c71fcbf8e53653a07276f1",
"size": "6... |
import enum
import logging
from .base_option import BaseOption, BaseContainerOption
from .float_option import FloatOption
from .int_option import IntOption
from .string_option import StringOption
from nativeconfig.exceptions import DeserializationError, ValidationError
LOG = logging.getLogger('nativeconfig')
class... | {
"content_hash": "cf340eb8f81a24dd9f95cece4a345ede",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 129,
"avg_line_length": 36.73728813559322,
"alnum_prop": 0.6235294117647059,
"repo_name": "GreatFruitOmsk/nativeconfig",
"id": "f67f9c7367dcb09e5f81a9fe73698ee591fdc820",
... |
from .. import Analysis, AnalysesHub
class Decompiler(Analysis):
def __init__(self, func, cfg=None, optimization_passes=None, sp_tracker_track_memory=True):
self.func = func
self._cfg = cfg
self._optimization_passes = optimization_passes
self._sp_tracker_track_memory = sp_tracker_t... | {
"content_hash": "9744a74d256294ecbf2863b5c0045e99",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 111,
"avg_line_length": 34.357142857142854,
"alnum_prop": 0.6077616077616078,
"repo_name": "schieb/angr",
"id": "042f22b48d137a316f74d8197777b4660b8cc3cc",
"size": "1444",
... |
from smart.interfaces.gtk.packageview import GtkPackageView
from smart.interfaces.gtk import getPixbuf
from smart.util.strtools import sizeToStr
from smart.report import Report
from smart import *
import gobject, gtk
class GtkChanges(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
self.... | {
"content_hash": "48a6553423a1ad5f759929ff2b77bc5f",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 79,
"avg_line_length": 36.8743961352657,
"alnum_prop": 0.4974453032883532,
"repo_name": "blackPantherOS/packagemanagement",
"id": "16c6151823bce0e770e6b2278979834d2b47aa2d",... |
class LoaderResult:
ERROR_NOT_FOUND = "not_found"
ERROR_UPSTREAM = "upstream"
ERROR_TIMEOUT = "timeout"
def __init__(self, buffer=None, successful=True, error=None, metadata=None):
"""
:param buffer: The media buffer
:param successful: True when the media has been loaded.
... | {
"content_hash": "4de7431d9d73af2ceb8f572c95e45594",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 80,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.5933908045977011,
"repo_name": "scorphus/thumbor",
"id": "d2eed95cb893aeff8203882fc9ea83b0d88afa62",
"size": "949"... |
import os
import json
''' dotfile is a class for managing the local dotfile storage
saves a file called, '.fu' to your home directory
the file is format a json file
{
result : Last Search Result
last : Last Copied command
history : History of used commands
}
the entire dot file ... | {
"content_hash": "14f8bd06234547e22b02b56e47e162b2",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 106,
"avg_line_length": 24.690721649484537,
"alnum_prop": 0.6004175365344467,
"repo_name": "samirahmed/fu",
"id": "92b8fe75861c379793855b8e921a16db21a652a2",
"size": "2395"... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: purefb_ds
version_added: '2.8'
short_description: Configure ... | {
"content_hash": "a612a139ed4d67c4b1516d6b9ee6093b",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 120,
"avg_line_length": 35.037974683544306,
"alnum_prop": 0.6382466281310212,
"repo_name": "SergeyCherepanov/ansible",
"id": "797eee70d9fa30c18adf5d0ce52bee595e0c0d73",
"s... |
from . import core, utils
import cgt
import ctypes, os.path as osp, hashlib, numpy as np, sys, subprocess, string, os, time, traceback, cPickle
from collections import defaultdict, namedtuple
from StringIO import StringIO
import logging
def function(inputs, outputs, dbg=None, updates=None, givens=None):
assert isi... | {
"content_hash": "42f0b3cde4633a93d03120f231182686",
"timestamp": "",
"source": "github",
"line_count": 896,
"max_line_length": 167,
"avg_line_length": 40.130580357142854,
"alnum_prop": 0.5845315237644965,
"repo_name": "codeAshu/cgt",
"id": "0e2f3ebc654ac99fb22bd58ed01c19aba66bed8a",
"size": "35957... |
import re
import sys
import time
if sys.version_info < (3,):
range = xrange
class Tailer(object):
"""\
Implements tailing and heading functionality like GNU tail and head
commands.
"""
line_terminators = ('\r\n', '\n', '\r')
def __init__(self, file, read_size=1024, end=False):
sel... | {
"content_hash": "223249da1e27c94660682f05a92b72c0",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 104,
"avg_line_length": 28.18831168831169,
"alnum_prop": 0.5065653075328266,
"repo_name": "pybuilder/pybuilder",
"id": "1f8c1e162638ac5991fc63d8e36a62eddf1cc0d0",
"size": ... |
"""
@copyright: 2016
@author: Steve Malenfant http://github.com/smalenfant
@author: Hank Beatty http://github.com/hbeatty
@organization: Cox Communications Inc. - Advanced Network Platforms
@license: Apache-2.0
"""
# -*- coding: utf-8 -*-
#
# This file is part of traffic-control-python.
#
# Copyright 2016 Cox Communi... | {
"content_hash": "aa8d25e66857226ca11ec294566fe51d",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 110,
"avg_line_length": 31.651315789473685,
"alnum_prop": 0.5512367491166078,
"repo_name": "hbeatty/traffic-control-python",
"id": "c967f4a2ea554a2e8ab80bd478131a337d4d2db4"... |
from __future__ import absolute_import
import six
from rest_framework.response import Response
from rest_framework import serializers, status
from django.conf import settings
from django.utils import timezone
from django.core.cache import cache as default_cache
from sentry.utils import json
from sentry.models impor... | {
"content_hash": "5527f8b0e08d89bf300da5062e9a14d6",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 90,
"avg_line_length": 34.05494505494506,
"alnum_prop": 0.5992255566311714,
"repo_name": "looker/sentry",
"id": "c6ec437a131858ab685f0ac7f156f83b60e7e7db",
"size": "6198",... |
import unittest
from unittest import TestCase
from app.dojo import *
from app.rooms import *
class TestPerson(TestCase):
def test_person_type_is_fellow(self):
fellow1 = Fellow(2, 'ray atuhe')
self.assertEqual(fellow1.person_type, 'fellow')
def test_person_type_is_staff(self):
staff1 = ... | {
"content_hash": "9817b8a7c359b072cf53420accc498db",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 30.615384615384617,
"alnum_prop": 0.6884422110552764,
"repo_name": "atuhe/RoomAllocator",
"id": "c10d1ab6882474b2e85072375d54be212786a9ca",
"size": "... |
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(ext_modules=cythonize("geometry_cy.pyx"),
include_dirs=[numpy.get_include()])
# hack to copy build extension into this directory so we can use it without
# setting paths.
import glob
import shutil
for src in glob.glob("build/... | {
"content_hash": "016e6a1dade62f6f7dcbe11ebdb7d7cd",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 27.384615384615383,
"alnum_prop": 0.7387640449438202,
"repo_name": "thehackerwithin/berkeley",
"id": "00a9020404c121204a1977541cd9ba342044cb2e",
"siz... |
from .message import Message
from .connection import Connection
class Mail(object):
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
"""
Initializes your mail settings from app.config
Can be used to set up Mail at conf... | {
"content_hash": "6f00920778a0e7ab36d31e23b4f19f7a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 73,
"avg_line_length": 27.678571428571427,
"alnum_prop": 0.5980645161290322,
"repo_name": "plaes/flask-sendmail",
"id": "2bed78ddac889bd63d1448e72c50e0c1e43efaa3",
"size": ... |
import time
import hashlib
def checksign(paras, appSecret):
m = hashlib.md5()
origin = ''
if not 'appKey' in paras:
raise Exception('No appKey.')
if not 'appSecret' in paras:
paras['appSecret'] = appSecret
for one in sorted(paras.items(), key=lambda x: x[0]):
if one[0] == 's... | {
"content_hash": "120d8cec98972f34b92622a352890044",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 57,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.5591836734693878,
"repo_name": "listen-lavender/pholcus",
"id": "26fdafd79de6d2baebe8dec6ecf992549049d644",
"size... |
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from base64 import b64encode
import tinify
from tinify import Client, AccountError, ClientError, ConnectionError, ServerError
import requests
import pytest
from helper import *
try:
from unittest.mock import patch
exce... | {
"content_hash": "62b9c766ba757fe9c3acfa6ce5840ec5",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 120,
"avg_line_length": 44.85279187817259,
"alnum_prop": 0.6806247170665459,
"repo_name": "tinify/tinify-python",
"id": "ec291657e502f7b25e0385bc61031676650b45ad",
"size":... |
import os
from flask.helpers import send_from_directory
from trytond.model import ModelSQL, fields
from trytond.pool import Pool, PoolMeta
from nereid import current_app, route, render_template, request, jsonify, \
template_filter
from flask_babel import Locale, get_locale, format_currency
from trytond.pyson impor... | {
"content_hash": "4de653acad5c863340fefa1cafc16299",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 82,
"avg_line_length": 27.345132743362832,
"alnum_prop": 0.5982200647249191,
"repo_name": "sharoonthomas/nereid-webshop",
"id": "9c901c7b742e5c9ffd26a7d840527b50e182583c",
... |
from subprocess import Popen, PIPE
from plyer.facades import UniqueID
from plyer.utils import whereis_exe
from os import environ
class OSXUniqueID(UniqueID):
def _get_uid(self):
old_lang = environ.get('LANG')
environ['LANG'] = 'C'
ioreg_process = Popen(["ioreg", "-l"], stdout=PIPE)
... | {
"content_hash": "af8cc068b84168bed28863ae002c463d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 25.25,
"alnum_prop": 0.6101485148514851,
"repo_name": "cleett/plyer",
"id": "51ba169cdc17319e0808bf6e511b987fd590332a",
"size": "808",
"binary": fa... |
import sys
import pymongo
import json
print "import crawled json file into mongodb 'newspapers' database."
if len(sys.argv) < 3:
print "input as [collection] [json_file]"
exit(1)
connection = pymongo.Connection("localhost", 27017)
news_database = connection.newspapers
news_collection = news_database[sys.argv... | {
"content_hash": "0d54e44575fd2b2caa3b5b3e945a92d1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 68,
"avg_line_length": 23.653846153846153,
"alnum_prop": 0.697560975609756,
"repo_name": "ShiZhan/newspapers",
"id": "aecaf9c70f27dece7ad8643f148116c774aa8ab5",
"size": "63... |
import galena
@galena.Component
class Health(object):
health = 1
@galena.Component
class Velocity(object):
required_components = (Health,)
speed = 10
direction = 180
@galena.Component
class Shield(object):
required_components = (Health, Velocity)
value = 10
| {
"content_hash": "aff4b3506fddaa0df0e787bedcb82a1a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 44,
"avg_line_length": 13.80952380952381,
"alnum_prop": 0.6862068965517242,
"repo_name": "Remolten/galena",
"id": "1efa3ebbc330d79d684826b87f49dc11f57f1fb5",
"size": "290",... |
from app.card import Card
class TestSingleCard:
"""Unique and consistent playing cards. All valid cards have a length of 2; one for the rank and the other for the suit."""
def test_ace_of_spades(self):
assert str(Card("A", "s")) == "As"
def test_four_of_hearts(self):
assert str(Card("4", ... | {
"content_hash": "ed2072bcdc7792047776370ef83e44ae",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 178,
"avg_line_length": 36.52439024390244,
"alnum_prop": 0.5385642737896494,
"repo_name": "jdcald13/Winning_Texas_Holdem_Strategy",
"id": "e3599418706ad17b7bb1f7b113f55f23a27... |
if __name__ == '__main__':
from setuptools import setup, Feature, Extension
setup(
name='jitpy',
description='A library to embed PyPy in CPython.',
long_description="""
jitpy
=====
A library that let's you embed PyPy into CPython.
Please see the `Documentation <http://jitpy.readthedocs.org/>`_.
Contac... | {
"content_hash": "be27461010251dc4c905913baca04455",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 64,
"avg_line_length": 20.676470588235293,
"alnum_prop": 0.6102418207681366,
"repo_name": "tempbottle/jitpy",
"id": "a0a5fa92ea9506964503215ebb1d03ea08599e19",
"size": "703... |
from credentials import QiNiuACCESS_KEY, QiNiuSECRET_KEY
import qiniu.conf
import qiniu.io
import sys
import qiniu.rs
import qiniu.io
import qiniu.rsf
def uploadToQiNiu(bucketName,fileName):
'''
this function support override of existing file
'''
qiniu.conf.ACCESS_KEY = QiNiuACCESS_KEY
qiniu.conf.SECRET_KEY = ... | {
"content_hash": "88e0bb62d992aba2ea7a1df506758392",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 82,
"avg_line_length": 22.763636363636362,
"alnum_prop": 0.7028753993610224,
"repo_name": "paulshi/qiniu",
"id": "e2c9f3ce0e098d95c6983d6f7f3a9a2f08056cd6",
"size": "1252",... |
"""
SDA: A Simulated Dual Annealing global optimization algorithm
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.optimize import OptimizeResult
from scipy.optimize import minimize
from scipy.special import gammaln
from scipy._lib._util import check_random_state
__al... | {
"content_hash": "09ecae134d757731552535c05fb70f83",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 79,
"avg_line_length": 41.02051282051282,
"alnum_prop": 0.562820352544068,
"repo_name": "sgubianpm/pygensa",
"id": "55a8534d55ec633155e893a449786cc0b716f0c1",
"size": "241... |
"""Benchmark for KPL implementation of weighted embedding column with varying-length inputs."""
from tensorflow.python import keras
from tensorflow.python.compat import v2_compat
from tensorflow.python.eager.def_function import function as tf_function
from tensorflow.python.feature_column import feature_column_v2 as f... | {
"content_hash": "988c9e16519fca611af7d41b52ec5727",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 101,
"avg_line_length": 37.67567567567568,
"alnum_prop": 0.71987087517934,
"repo_name": "frreiss/tensorflow-fred",
"id": "0dd4415273eca230ebe818137717e6d1fe5d1277",
"size":... |
import factory
from poznaj.points.tests.factories import PointFactory
from poznaj.stories.tests.factories import StoryFactory
class ImageFactory(factory.django.DjangoModelFactory):
title = factory.Sequence(lambda n: 'image-{}'.format(n))
image_file = factory.django.ImageField()
copyright = factory.LazyAtt... | {
"content_hash": "1ecf443127fda0a9a16f4b8db3fa7e58",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 60,
"avg_line_length": 34.42857142857143,
"alnum_prop": 0.7489626556016598,
"repo_name": "KlubJagiellonski/poznaj-app-backend",
"id": "2cd1fcfc6e2a0d9f0303f3d3a359ef3ad98f637... |
from django.db import models
class Post(models.Model):
body = models.TextField()
title = models.CharField(max_length=50)
publication_date = models.DateTimeField(auto_now_add=True)
enable_comments = models.BooleanField(default=True)
def __unicode__(self):
return self.title
class Comment(mo... | {
"content_hash": "2d97d9606442ea075b8566c6139600a7",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 72,
"avg_line_length": 29.85,
"alnum_prop": 0.6800670016750419,
"repo_name": "Lukasa/minimalog",
"id": "74ccff28e7d44c13c7bfa04bc0a01e700aa1f763",
"size": "597",
"binary"... |
"""Unit test cases for CSR1000V platform."""
from COT.platforms.cisco_csr1000v import CSR1000V
from COT.data_validation import (
ValueUnsupportedError, ValueTooLowError, ValueTooHighError
)
from COT.platforms.tests import PlatformTests
class TestCSR1000V(PlatformTests.PlatformTest):
"""Test cases for Cisco C... | {
"content_hash": "222f79fee16d1fbb9cb355085ceab214",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 42.32941176470588,
"alnum_prop": 0.6206225680933852,
"repo_name": "glennmatthews/cot",
"id": "8c82a7c40f410326e819f13b888a19f9d670ad09",
"size": "431... |
import unittest
from trello_plugin.trello import TrelloAPI
from maskgen.maskgen_loader import MaskGenLoader
class TestToolSet(unittest.TestCase):
def test_aproject(self):
api = TrelloAPI(MaskGenLoader())
api.update_status_to_card('JournalQA','testlist','123','test 123\n test 4567', ['to be remove... | {
"content_hash": "58646eb625022745ed335385829a0171",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 126,
"avg_line_length": 29.58823529411765,
"alnum_prop": 0.68389662027833,
"repo_name": "rwgdrummer/maskgen",
"id": "6759a63ad9ff38e1c011493c36c56fcbf0dde987",
"size": "503... |
"""
This module defines the `Quantity` object, which represents a number with some
associated units. `Quantity` objects support operations like ordinary numbers,
but will deal with unit conversions internally.
"""
# Standard library
import re
import numbers
from fractions import Fraction
import warnings
import numpy... | {
"content_hash": "e445ccd10793a3109580eb616f4559af",
"timestamp": "",
"source": "github",
"line_count": 1906,
"max_line_length": 106,
"avg_line_length": 39.09443861490031,
"alnum_prop": 0.5834608261534745,
"repo_name": "aleksandr-bakanov/astropy",
"id": "e2f3158db442d1139094c08e35bb4da155f0145b",
"... |
import nibabel as nb
import numpy as np
from nipype.pipeline import engine as pe
from fmriprep.interfaces.maths import Clip
def test_Clip(tmp_path):
in_file = str(tmp_path / "input.nii")
data = np.array([[[-1., 1.], [-2., 2.]]])
nb.Nifti1Image(data, np.eye(4)).to_filename(in_file)
threshold = pe.Node... | {
"content_hash": "4de694ab1c426f5542e4b3d70f46e713",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 94,
"avg_line_length": 31.58823529411765,
"alnum_prop": 0.6045934202358784,
"repo_name": "oesteban/fmriprep",
"id": "d0ca703b2f3971e58e275104157a346b4133c342",
"size": "161... |
import os
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext
from setuptools import Extension
import sys
class CMakeBuild(build_ext):
"""
Runs cmake and make install instead of a traditional C/C++ extension build.
"""
def run(self):
build_dir = os.pa... | {
"content_hash": "e1e11a37ef1b7e3306806fbe2bc38e93",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 101,
"avg_line_length": 37.89473684210526,
"alnum_prop": 0.6368055555555555,
"repo_name": "TimDettmers/dlearndb",
"id": "887ae57fbd6eb2e7a1b4bc12cdeaecc7572bc455",
"size": ... |
"""
Copyright (c) 2017-2022, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
"""
from atom.api import (
Bool,
Enum,
Float,
ForwardTyped,
Int,
Str,
Typed,
Property,
se... | {
"content_hash": "514d76431f02f30fbe34f05aa9ef8e4c",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 79,
"avg_line_length": 26.734513274336283,
"alnum_prop": 0.56835484938762,
"repo_name": "codelv/enaml-native",
"id": "50391d849e1df7a7ee65145fd5ad5c425b830b5b",
"size": "6... |
from findex_gui.web import app
from furl import furl
from werkzeug.routing import BaseConverter
from findex_common.static_variables import SearchParameters
class SearchUrlConverter(BaseConverter):
"""
The URL Converter for parsing search arguments.
Example: /search/die%20hard&cats=[movies]&type=[files]&si... | {
"content_hash": "ca555307c76f9fe27097047c4303ff36",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 76,
"avg_line_length": 26.68,
"alnum_prop": 0.49025487256371814,
"repo_name": "skftn/findex-gui",
"id": "b36cf96bf5bd3430028bd40d163dc65fdb18f78f",
"size": "1334",
"binar... |
"""Helper functions and test harnesses for source implementations.
This module contains helper functions and test harnesses for checking
correctness of source (a subclass of ``iobase.BoundedSource``) and range
tracker (a subclass of``iobase.RangeTracker``) implementations.
Contains a few lightweight utilities (e.g. r... | {
"content_hash": "a3b78117e3b0da040620cd3d18ecd3e8",
"timestamp": "",
"source": "github",
"line_count": 654,
"max_line_length": 80,
"avg_line_length": 39.11467889908257,
"alnum_prop": 0.683319651303702,
"repo_name": "RyanSkraba/beam",
"id": "72917860d3c75af17e6b932bf4c43b90cdd91449",
"size": "26366... |
import algorithms
import metrics
import itertools
class RectNode(object):
__slots__ = ('walkable', 'neighbor_gen', '_move_cost', 'pos',
'default_walkable', '_heuristic',
'_came_from', '_h', '_g') # set by algorithms.astar
def __init__(self, pos,
move_cost=1, walkable=None, default... | {
"content_hash": "fcaa29455292f8a7119f3fb425851542",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 79,
"avg_line_length": 37.95454545454545,
"alnum_prop": 0.5836327345309381,
"repo_name": "mattiasbergstrom/python-pathfinding",
"id": "e7268925cad58a7c0dcd6d13e4511668e404cdb... |
from test_schematic_base import TestSchematicBase
from unittest.mock import patch
from werkzeug.datastructures import OrderedMultiDict
import os
import pytest
class TestSchematicDownload(TestSchematicBase):
def setup(self):
TestSchematicBase.setup(self)
self.downloads_dir = self.app.config["SCHEMATIC_DOWNL... | {
"content_hash": "4ceb7e862189d75660a105756ae0adf4",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 111,
"avg_line_length": 38.19,
"alnum_prop": 0.7161560617962818,
"repo_name": "Frumple/mrt-file-server",
"id": "f819a26f0bd7c1031e7b6a0b206f62c9d7e9e42a",
"size": "3819",
... |
import os
import sys
import django
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings")
django.setup()
from django.contrib.auth.models import User # noqa: E402
from museum_site.models import * # noqa: E402
def main():
... | {
"content_hash": "916e47bff04ce7dd842e69fd768b2147",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 76,
"avg_line_length": 24.40625,
"alnum_prop": 0.5973111395646606,
"repo_name": "DrDos0016/z2",
"id": "abed96f5488cea689200371b8a03d4acd5b4b6d6",
"size": "1562",
"binary"... |
from abc import ABCMeta, abstractmethod
import sys
if sys.version >= '3':
xrange = range
from pyspark import SparkContext
from pyspark.sql import DataFrame
from pyspark.ml import Estimator, Transformer, Model
from pyspark.ml.param import Params
from pyspark.ml.util import _jvm
from pyspark.ml.common import inherit... | {
"content_hash": "deb2e5b6a85df0e36f76c3978a16e14c",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 98,
"avg_line_length": 36.39938080495356,
"alnum_prop": 0.6064472229310198,
"repo_name": "alunarbeach/spark",
"id": "0f846fbc5b5ef32930b3501fd62de0d50b7f8237",
"size": "12... |
from __future__ import absolute_import
import os
import pwd
import six
import sys
import copy
import traceback
import collections
from oslo_config import cfg
from st2common import log as logging
from st2common.models.base import DictSerializableClassMixin
from st2common.util.shell import quote_unix
from st2common.con... | {
"content_hash": "f117e0845f8409c6bb973abda9e18378",
"timestamp": "",
"source": "github",
"line_count": 595,
"max_line_length": 99,
"avg_line_length": 31.445378151260503,
"alnum_prop": 0.5661143773383217,
"repo_name": "StackStorm/st2",
"id": "77a110394dca6546a55cbb202ab6b0064ec63a16",
"size": "1940... |
from Excitation import Excitation
class ExcitationRain(Excitation):
"""
Rain on the roof excitation
"""
pass
| {
"content_hash": "8ddd81f8303998d77e8d06bfc9c072e1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 33,
"avg_line_length": 18,
"alnum_prop": 0.6825396825396826,
"repo_name": "python-acoustics/Sea",
"id": "21c866c7dd9d4abf100dfb5d7266ab9e2d430d43",
"size": "126",
"binary"... |
from mongrel2 import config
from mongrel2.config import args
import mongrel2.config.commands
from uuid import uuid4
from mongrel2.config import model
import getpass
import sys
import os
import signal
from sqlite3 import OperationalError
def try_reading(reader):
try:
cmd = reader.readline()
return ... | {
"content_hash": "2e04576fbc852aacb45fec5bc3d78c80",
"timestamp": "",
"source": "github",
"line_count": 509,
"max_line_length": 99,
"avg_line_length": 29.25147347740668,
"alnum_prop": 0.5945328766203237,
"repo_name": "duaneg/mongrel2",
"id": "a663175f7f23fe585b06976f7abb5da22c5f9cde",
"size": "1488... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Organization.name'... | {
"content_hash": "df5a052833a3201731fe2c8b02b8b182",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 208,
"avg_line_length": 72.09473684210526,
"alnum_prop": 0.5830048182216382,
"repo_name": "aptivate/django-organizations",
"id": "6c35daff9b0e711da4918727eaabd7358fabf958",
... |
"""Determine new partition divisions using approximate percentiles.
We use a custom algorithm to calculate approximate, evenly-distributed
percentiles of arbitrarily-ordered data for any dtype in a distributed
fashion with one pass over the data. This is used to determine new
partition divisions when changing the ind... | {
"content_hash": "39392fb02e894aa93a8217d545e90745",
"timestamp": "",
"source": "github",
"line_count": 505,
"max_line_length": 88,
"avg_line_length": 39.3029702970297,
"alnum_prop": 0.6730652962515115,
"repo_name": "jakirkham/dask",
"id": "128493b5dd69f72663061daf52b945db12faa394",
"size": "19848"... |
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from genericm2m.models import RelatedObjectsDescriptor
class RelatedBeverage(models.Model):
food = models.ForeignKey('Food')
beverage = models.ForeignKey('... | {
"content_hash": "fd7bf03f890ce53d7c858baa4aed627d",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 85,
"avg_line_length": 27.02777777777778,
"alnum_prop": 0.6927029804727647,
"repo_name": "wd5/jangr",
"id": "9ed3bc28c10debc4bb4a0fcb4a3d69e227f70a12",
"size": "1946",
"b... |
try:
import unittest2 as unittest
except ImportError:
import unittest
import numpy as np
from sigops import Signal
class TestSignalDict(unittest.TestCase):
def test_assert_named_signals(self):
Signal(np.array(0.))
Signal.assert_named_signals = True
with self.assertRaises(AssertionE... | {
"content_hash": "ba0d357c2d29fa732d228f9c78d5ba54",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 62,
"avg_line_length": 24.61904761904762,
"alnum_prop": 0.6595744680851063,
"repo_name": "jaberg/sigops",
"id": "6b18f040c720838b66c5461240c4c83616a32c66",
"size": "517",
... |
__author__ = "Rafael S. Guimarães e João Paulo de Brito Gonçalves"
import socket
import struct
from server.ClientP2P import ClientP2P
class ServerP2P(object):
"""
Class Server P2P - Work 01
"""
def __init__(self, node):
self.__HOST = ""
self.__PORT = 12345
# Cria o Socket UDP... | {
"content_hash": "2ed1e4afefe47a4623abfdb8482de4be",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 119,
"avg_line_length": 43.60424028268551,
"alnum_prop": 0.5103727714748785,
"repo_name": "rafaelsilvag/PyChord",
"id": "624a51fd34e6e7f05a2c96d34ae516a2c3ef1107",
"size":... |
# -*- coding: utf-8 -*-
#==============================================================================
# A simple twitter client capable of persisting data to a DB
# Usage: python client.py --config=config.json
# To persist to a database a valid connection string is needed.
# Also, create a proper Tweets table. Chec... | {
"content_hash": "6f9549d0bb67800224dcff9328c9f083",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 123,
"avg_line_length": 37.932,
"alnum_prop": 0.5329537066329221,
"repo_name": "brakmic/TwitterClient",
"id": "9e0f26739408a9c0156f74b0679b909158cbcca8",
"size": "9485",
... |
import os
import sys
import django
from django.conf import settings
from django.core.management import call_command
def runtests():
if not settings.configured:
# Choose database for settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | {
"content_hash": "822488e47d6fa5d87d44db91d200922f",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 90,
"avg_line_length": 29.24561403508772,
"alnum_prop": 0.50749850029994,
"repo_name": "marctc/django-modeltranslation",
"id": "08e133a4661f791a73dde867981271ec8bca7a17",
"... |
from django.db import models
from datetime import datetime
class JudgeResult(models.Model):
sid = models.IntegerField()
pid = models.IntegerField()
username = models.CharField(max_length=50)
result = models.CharField(max_length=50)
time = models.IntegerField()
memory = models.IntegerField()
... | {
"content_hash": "2a005a8d7d0824fc645f2c4c4be23ce2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 96,
"avg_line_length": 38.6875,
"alnum_prop": 0.7011308562197092,
"repo_name": "ISeaTeL/ISeaTeL_Cup_Site",
"id": "1e217e9cd182d2b999f3cb6d69cbef156b629386",
"size": "619",
... |
from django.contrib import admin
# Register your models here.
| {
"content_hash": "77df2557ca40b4d929e88eab50d206db",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 32,
"avg_line_length": 21,
"alnum_prop": 0.7936507936507936,
"repo_name": "wevote/WebAppPublic",
"id": "87f7238f57a72928d210846f76b4bd2762bbca78",
"size": "153",
"binary":... |
from django import forms
from .models import Job
from django.contrib.auth.models import User
class JobForm(forms.ModelForm):
class Meta:
model = Job
exclude = ('author',)
| {
"content_hash": "419e132c243039dd0930adca4c04aab8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 19.4,
"alnum_prop": 0.6855670103092784,
"repo_name": "academichero/jobs",
"id": "d9211f4ac4553e6b34d1f0963e743ddad30340fa",
"size": "194",
"binary"... |
"""
Step implementations for block content containers
"""
from behave import given, then, when
from docx import Document
from docx.table import Table
from helpers import test_docx
# given ===================================================
@given('a document containing a table')
def given_a_document_containing_a_... | {
"content_hash": "5a654c579c0f1f869ac7e8881aba754c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 66,
"avg_line_length": 24.45098039215686,
"alnum_prop": 0.6287089013632718,
"repo_name": "tanyunshi/python-docx",
"id": "1eee70cd2a200caa3cd6097c870bec485fef0d2c",
"size": ... |
import os, re, csv, time
import itertools
import argparse
import cv2
import numpy as np
from progress_bar import printProgressBar
oshapeX = 640
oshapeY = 240
shapeX = 320
shapeY = 120
reverse = [0,2,1,3]
# def image_autocontrast(image):
# # img_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# # minVal, maxVa... | {
"content_hash": "40e2c20c094cece3f7a523957d7fb981",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 95,
"avg_line_length": 33.51912568306011,
"alnum_prop": 0.5730355396152592,
"repo_name": "LiuVII/Self-driving-RC-car",
"id": "486ad648685c4b6115462864ed48d14886494af4",
"s... |
from openerp.osv import fields, osv
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'property_stock_customer': fields.property(
type='many2one',
relation='stock.location',
string="Customer Location",
help="This stock location will be used, inste... | {
"content_hash": "a09199ce591ec63bd86673f0b67e3760",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 150,
"avg_line_length": 44.875,
"alnum_prop": 0.6518105849582173,
"repo_name": "vileopratama/vitech",
"id": "917c5de1ce9c1c386d845696e7091f234c99218b",
"size": "818",
"bi... |
from __future__ import absolute_import, division, print_function
import os
import numpy as np
from dynd import nd
import datashape
from . import DDesc, Capabilities
from .dynd_data_descriptor import DyND_DDesc
from .stream_data_descriptor import Stream_DDesc
from ..optional_packages import tables_is_here
if tables_is... | {
"content_hash": "12ab748f164598754343f98e4c85ae66",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 74,
"avg_line_length": 35.31654676258993,
"alnum_prop": 0.575677327357914,
"repo_name": "FrancescAlted/blaze",
"id": "e75b096f538bc500600e77e86b3e2ec6dcabbec3",
"size": "4... |
import pytest
from flask import url_for
from comport.department.models import Extractor, Department
from bs4 import BeautifulSoup
from comport.data.models import OfficerInvolvedShootingBPD, UseOfForceIncidentBPD, CitizenComplaintBPD
from comport.data.models import OfficerInvolvedShootingIMPD, UseOfForceIncidentIMPD, Ci... | {
"content_hash": "cd64a3900aa5a9bc91364bc4ad0426a8",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 127,
"avg_line_length": 58.806666666666665,
"alnum_prop": 0.6943657181725428,
"repo_name": "codeforamerica/comport",
"id": "29c7213ffb5fd899b34fe1ff43cb3ccb484c312c",
"siz... |
import os
import pyinotify
class EventHandler(pyinotify.ProcessEvent):
"""事件处理"""
def process_IN_CREATE(self, event):
print "Create file: %s " % os.path.join(event.path,event.name)
def process_IN_DELETE(self, event):
print "Delete file: %s " % os.path.join(event.path,event.name)
def process_I... | {
"content_hash": "585e2d59de9202f182c3937a9d9cc6b0",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 71,
"avg_line_length": 28.0625,
"alnum_prop": 0.6748329621380846,
"repo_name": "lanbaba/ossync",
"id": "0da80608caa4b9d5e9cdd34c51c7bfe970e28f62",
"size": "921",
"binary"... |
"""
generate_twitter_scoreboard.py
Use data in config.yml to generate follower-count information for a set of Twitter screennames,
and output to a JSON file
Created by Sanders Kleinfeld on Sun Feb 16 15:46:00 EST 2014
Copyright (c) 2014 Sanders Kleinfeld. All rights reserved.
"""
import json
import os
import twitter... | {
"content_hash": "a3a22b1b0ccb51750ade4efaffe36d88",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 164,
"avg_line_length": 37.583333333333336,
"alnum_prop": 0.6762749445676275,
"repo_name": "sandersk/twitter-follower-scoreboard",
"id": "0806cffcd98b046ca0f6e1adc8733438a365... |
from app.util.conf.slave_config_loader import SlaveConfigLoader
from app.util.conf.configuration import Configuration
from test.framework.base_unit_test_case import BaseUnitTestCase
class TestSlaveConfigLoader(BaseUnitTestCase):
def test_configure_default_sets_protocol_scheme_to_http(self):
mock_config_f... | {
"content_hash": "c61c37d09baa6b5f10e4c8c6ca136323",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 117,
"avg_line_length": 57.59090909090909,
"alnum_prop": 0.6227308602999211,
"repo_name": "box/ClusterRunner",
"id": "d530dc94896ab139d9622bc812abcde4fe18aaff",
"size": "25... |
"""Reliable UDP implementation using Twisted."""
import collections
from google.protobuf import message
from twisted.internet import protocol
from txrudp import packet
class ConnectionMultiplexer(
protocol.DatagramProtocol,
collections.MutableMapping
):
"""
Multiplexes many virtual connections ove... | {
"content_hash": "d8597107f7c1d03bda6986e37ad95e30",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 76,
"avg_line_length": 33.771028037383175,
"alnum_prop": 0.5804621558046216,
"repo_name": "OpenBazaar/txrudp",
"id": "7f688a2383bad8cdf31c80ddab0624393e4a1eec",
"size": "7... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class project_configuration(osv.osv_memory):
_name = 'project.config.settings'
_inherit = 'res.config.settings'
_columns = {
'module_sale_service': fields.boolean('Generate tasks from sale orders',
help='This fea... | {
"content_hash": "f249ffab46a3fa634bfdfc84ad42ac02",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 131,
"avg_line_length": 62.50877192982456,
"alnum_prop": 0.6550659556553466,
"repo_name": "cristianquaglio/odoo",
"id": "52bcf2cd36c8c37be47b23233aa160414302ec72",
"size": ... |
from __future__ import unicode_literals
from datetime import datetime
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.utils.text import slugify
from gzip import GzipFile
from tempfile import NamedTemporaryFile
from optparse import make_option
from remote_... | {
"content_hash": "e205e064b11cfd0cf59fce9ebb537951",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 82,
"avg_line_length": 32.523809523809526,
"alnum_prop": 0.6544655929721815,
"repo_name": "gizmag/remote-fixtures",
"id": "272061f56bb4a780d1d722f8d72625a71783091d",
"size"... |
import json
from slackclient import SlackClient
from geowatchutil.client.base import GeoWatchClientWebHook
class GeoWatchClientSlack(GeoWatchClientWebHook):
# Private
url_api = "https://slack.com/api"
def check_topic_exists(self, channel, timeout=5, verbose=True):
exists = False
self.... | {
"content_hash": "35269083ef9ab23799db5f8989c7b24b",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 102,
"avg_line_length": 32.6793893129771,
"alnum_prop": 0.5545433309974305,
"repo_name": "pjdufour/geowatch-util",
"id": "b92b8558feef789f0524fab240c9cf90c3567d69",
"size"... |
import pyfwk
from pyfi.entity.entity.db import EntityDB
# ------------------------------INDICES-MODEL-----------------------------#
class IndicesModel(pyfwk.Model):
model = None
dbase = None
table = None
columns = None
@staticmethod
def instance():
if not IndicesModel.model:
... | {
"content_hash": "e136ba09b23e5486587343ed9f98daba",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 75,
"avg_line_length": 24.676470588235293,
"alnum_prop": 0.4958283671036949,
"repo_name": "rlinguri/pyfi",
"id": "fb7af305c60f18fc6fa6e5e459b96ae62d1e7e27",
"size": "862",
... |
import hashlib
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.forms import ValidationError
from django.test.utils import override_settings
from dateutil.tz import tzutc
from mock import patch
from nose.tools import eq_, ok_
from lib.crypto.packaged import Signin... | {
"content_hash": "6355f279f0ad2f67c412a6a5e067e511",
"timestamp": "",
"source": "github",
"line_count": 631,
"max_line_length": 79,
"avg_line_length": 40.502377179080824,
"alnum_prop": 0.6262080838909105,
"repo_name": "shahbaz17/zamboni",
"id": "7e424ee268c528c94793c7ec8258622ac2fd8ef5",
"size": "2... |
"""
Functions for common plots
"""
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from .constants import LOG_SIZES
def _plot_svsize_density(log_svsize, ax, label=None,
linestyle='-', color='k'):
"""
Helper function to plot svsize.
... | {
"content_hash": "b7458e7a0553dae5c0f965d83cc181a0",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 79,
"avg_line_length": 30.85810810810811,
"alnum_prop": 0.5733523100503612,
"repo_name": "msto/svplot",
"id": "ccae6136df4023ea9cb1124f9333a5ad4108f942",
"size": "9267",
... |
import mock
from rally.benchmark.scenarios.ceilometer import meters
from tests.unit import test
class CeilometerMetersTestCase(test.TestCase):
def test_list_meters(self):
scenario = meters.CeilometerMeters()
scenario._list_meters = mock.MagicMock()
scenario.list_meters()
scenario.... | {
"content_hash": "43270a861ed8652a3508d8a58ccf23d1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 55,
"avg_line_length": 29.916666666666668,
"alnum_prop": 0.7270194986072424,
"repo_name": "pandeyop/rally",
"id": "37fa8c37c05fad3527e6511d8d190e6db533fa61",
"size": "957",... |
"""
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
import os.path as op
import nibabel as nb
import numpy as np
from .... | {
"content_hash": "631e0623bf213ddc76122862cd3c162d",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 87,
"avg_line_length": 32.20134228187919,
"alnum_prop": 0.5776365152146727,
"repo_name": "FCP-INDI/nipype",
"id": "143f239e6ce8e88c5d327ee4106499f720991ced",
"size": "9642... |
"""Class advice.
This module was adapted from 'protocols.advice', part of the Python
Enterprise Application Kit (PEAK). Please notify the PEAK authors
(pje@telecommunity.com and tsarna@sarna.org) if bugs are found or
Zope-specific changes are required, so that the PEAK version of this module
can be kept in sync... | {
"content_hash": "b6e4a56e33b075419f1af93fde6ade6e",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 79,
"avg_line_length": 36.803108808290155,
"alnum_prop": 0.6476136843587217,
"repo_name": "hlzz/dotfiles",
"id": "ccc103d8fcf304bf84ac3bb0e709f136f2accf2b",
"size": "7752"... |
"""Model representing MAAS node/machine resource."""
import logging
import drydock_provisioner.error as errors
import drydock_provisioner.drivers.node.maasdriver.models.base as model_base
import drydock_provisioner.drivers.node.maasdriver.models.interface as maas_interface
import drydock_provisioner.drivers.node.maasd... | {
"content_hash": "ee2a89e3a1b24014654450b5e2edbd2e",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 108,
"avg_line_length": 36.31578947368421,
"alnum_prop": 0.5527313266443701,
"repo_name": "att-comdev/drydock",
"id": "d8177ecce1e7b21eb384dd22cf028e08b8607dea",
"size": "... |
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
class RunTest(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys
import subprocess... | {
"content_hash": "d9d4eb86d84147bc60582c91b947fa4e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 84,
"avg_line_length": 29.56923076923077,
"alnum_prop": 0.6071800208116546,
"repo_name": "mikr/whatstyle",
"id": "0979ee541607e00090285edbd6c0fa365a513151",
"size": "1945",... |
encoding="UTF-8"
topN=3
ifFullText=1
ifPinYin=1
ifJianPin=1
ifMergeSampleText=1
FileInput="data/sample.input"
FileOutput="data/release/sample.suggidx"
FileOutputItemSet="data/release/sample.suggidx.itemset"
FileTag2tid="data/sample.tag2tid"
FilePrefix2tid="data/sample.prefix2tid"
| {
"content_hash": "649e6d4b9702a3578ae18d059801f2d0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 19,
"alnum_prop": 0.8175438596491228,
"repo_name": "MingdaMingda/TO050001-TinySuggestion",
"id": "73c481c78d8d986084409ed8eba59d4112a99987",
"size": ... |
__version__ = 1.8
from .ABVD import ABVDatabase, Downloader, Parser, Record
from .ABVD import DeadLanguageError, InvalidLanguageError
| {
"content_hash": "14cbe114733d3dc8ad56c3f40aaf8f9a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 57,
"avg_line_length": 27.2,
"alnum_prop": 0.7867647058823529,
"repo_name": "SimonGreenhill/ABVDGet",
"id": "3f69d9d108a46889fae27619a695c1f99fbb184d",
"size": "136",
"bin... |
import pytest
from hatchling.version.source.code import CodeSource
def test_no_path(isolation):
source = CodeSource(str(isolation), {})
with pytest.raises(ValueError, match='option `path` must be specified'):
source.get_version_data()
def test_path_not_string(isolation):
source = CodeSource(st... | {
"content_hash": "f6639821cc68992d22a567eec396fd04",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 80,
"avg_line_length": 28.98701298701299,
"alnum_prop": 0.6093189964157706,
"repo_name": "ofek/hatch",
"id": "9e0ebd7143eb6540518e6728107b14d3a97bad3d",
"size": "2232",
"... |
class Queue(object):
"""
Composed of two lists:
- `_front`
- `_back` -- backwards
"""
def __init__(self, elems):
self._front = elems
self._back = []
def unshift(self, elem):
self._back.append(elem)
def _flip(self):
if len(self._front) != 0... | {
"content_hash": "26b1573c48c113e0523adc3bf92d6626",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 25.8,
"alnum_prop": 0.4883720930232558,
"repo_name": "mattfenwick/DataStructures",
"id": "b5a51452ebb863970b482f1d294d4ca1e2f24e67",
"size": "776",
... |
"""This bot will move pages out of redirected categories.
The bot will look for categories that are marked with a category redirect
template, take the first parameter of the template as the target of the
redirect, and move all pages and subcategories of the category there. It
also changes hard redirects into soft redi... | {
"content_hash": "6abdc15fa777ab6975cdf1b775c7648e",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 84,
"avg_line_length": 43.19166666666667,
"alnum_prop": 0.49546594636311014,
"repo_name": "magul/pywikibot-core",
"id": "db7543dc65fa3e43a26e0fee3b74bd49039a511b",
"size":... |
"""Support for the Netatmo binary sensors."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import CONF_TIMEOUT
from homeassistant.helpers import config_validation as cv
from . import CameraData, NETATMO_... | {
"content_hash": "fbfe72c5123f06e01ee34b9bdd51551b",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 77,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.5771878072763028,
"repo_name": "MartinHjelmare/home-assistant",
"id": "f282faf82c87aa19131ebbbf5721477c0948a875",
... |
import unittest
from dblite.query import SQLBuilder
class SQLBuilderTest(unittest.TestCase):
def test_wrong_params(self):
self.assertEqual(SQLBuilder('test', params='').select(), 'SELECT rowid,* FROM test;')
self.assertEqual(SQLBuilder('test', params=None).select(), 'SELECT rowid,* FROM ... | {
"content_hash": "da3959f3899d1ed00d058cb43d23e9b1",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 95,
"avg_line_length": 36.783018867924525,
"alnum_prop": 0.5314183123877917,
"repo_name": "ownport/scrapy-dblite",
"id": "35beb94697540c58b1e3278754c67559e50bccb4",
"size"... |
from . import AWSObject
from . import AWSProperty
from .validators import boolean
from .validators import double
class CostTypes(AWSProperty):
props = {
'IncludeCredit': (boolean, False),
'IncludeDiscount': (boolean, False),
'IncludeOtherSubscription': (boolean, False),
'IncludeRec... | {
"content_hash": "aa5f9e0f67c5370e9c5546cbad04278d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 53,
"avg_line_length": 25.5375,
"alnum_prop": 0.5976505139500734,
"repo_name": "ikben/troposphere",
"id": "402224fc833f5cfcb89aee925e8cdf78484b8a85",
"size": "2255",
"bin... |
"""Library for testing DistributionStrategy descendants."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.eager import backprop
from tensorflow.python.eager import context
from tensorf... | {
"content_hash": "a43c5b5449437b38f57da71d051e1cee",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 79,
"avg_line_length": 37.50925925925926,
"alnum_prop": 0.6584793878054801,
"repo_name": "ZhangXinNan/tensorflow",
"id": "371b97ba96a826194a6469ba63e485fc67639585",
"size"... |
"""
:module: mom.os.path
:synopsis: Directory walking, listing, and path sanitizing functions.
Functions
---------
.. autofunction:: get_dir_walker
.. autofunction:: walk
.. autofunction:: listdir
.. autofunction:: list_directories
.. autofunction:: list_files
.. autofunction:: absolute_path
.. autofunction:: real_abs... | {
"content_hash": "39b73306f3943819f1307114fff0e2ae",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 80,
"avg_line_length": 28.306451612903224,
"alnum_prop": 0.6628679962013295,
"repo_name": "gorakhargosh/mom",
"id": "d892a7ddb56d44b1d49fc25665decbc2d2d56e1a",
"size": "59... |
from requests.auth import HTTPBasicAuth
import requests
class PostRequestFactory():
"""
An Encapsulation for building GET/PUT/POST Post requests
"""
def get(self):
raise NotImplementedError('`get()` must be implemented.')
def post(self):
raise NotImplementedError('`post()` must b... | {
"content_hash": "ceb23db8aa1d2d6856e4d6265b281cb9",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 106,
"avg_line_length": 34.93877551020408,
"alnum_prop": 0.6352219626168224,
"repo_name": "Roshack/cmput410-project",
"id": "282bf22f802a56c18bbf028537b089ef102176cc",
"siz... |
import random
import boto3
from moto.events import mock_events
from botocore.exceptions import ClientError
from nose.tools import assert_raises
RULES = [
{'Name': 'test1', 'ScheduleExpression': 'rate(5 minutes)'},
{'Name': 'test2', 'ScheduleExpression': 'rate(1 minute)'},
{'Name': 'test3', 'EventPattern... | {
"content_hash": "6c23dd015cd9989b780819ec12e6b0c2",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 95,
"avg_line_length": 28.807692307692307,
"alnum_prop": 0.6253337783711616,
"repo_name": "dbfr3qs/moto",
"id": "e839bde5b1f76df2a9510489a9fcb49e82d01b7a",
"size": "5992",... |
import random
from panoptes.pocs.dome import AbstractDome
class Dome(AbstractDome):
"""Simulator for a Dome controller."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._state = 'disconnected'
@property
def is_open(self):
return self._state == '... | {
"content_hash": "f463c6759af036d4703ec9269c2efdbf",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 70,
"avg_line_length": 23.69047619047619,
"alnum_prop": 0.5809045226130654,
"repo_name": "panoptes/POCS",
"id": "91a9bc1ac7b67d4bf6d96a56ef8eebf8c2e2c2d6",
"size": "995",
... |
from src.base.test_cases import TestCases
class UglyNumTestCases(TestCases):
def __init__(self):
super(UglyNumTestCases, self).__init__()
self.__add_test_case__('Test 1', 10, 12)
self.__add_test_case__('Test 2', 20, 36) | {
"content_hash": "334843878d1c5757480e6c170ff2037c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 48,
"avg_line_length": 31.125,
"alnum_prop": 0.6144578313253012,
"repo_name": "hychrisli/PyAlgorithms",
"id": "b9acd334661bc416cce8d23c66747be2a8e37478",
"size": "249",
"b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.