text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import print_function, division
from collections import defaultdict
from .basic import Basic
from .compatibility import cmp_to_key, reduce, is_sequence, range
from .logic import _fuzzy_group, fuzzy_or, fuzzy_not, fuzzy_and
from .singleton import S
from .operations import AssocOp
from .cache import cac... | {
"content_hash": "bc350d292127e607bcb78588da5ef47a",
"timestamp": "",
"source": "github",
"line_count": 987,
"max_line_length": 79,
"avg_line_length": 33.13373860182371,
"alnum_prop": 0.4821270219857505,
"repo_name": "Arafatk/sympy",
"id": "a1fe26f05d444239f8c491eaedc3d26e1d239941",
"size": "32703"... |
from __future__ import print_function, unicode_literals
from time import time
from raspiutil.sensors import LPS331
NAME = "pressure.lps331"
if __name__ == '__main__':
lps = LPS331(1, 0x5d)
try:
lps.open()
# Print current pressure
print("{0}\t{1:.2f}\t{2:.0f}".format(NAME, lps.pressur... | {
"content_hash": "d70a71b79f324e4a8e7aec4bdf972278",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 22.8125,
"alnum_prop": 0.6027397260273972,
"repo_name": "ymyzk/mackerel-plugins",
"id": "948d499188ed156d1ab43d2d5a5780453b03f02c",
"size": "412",
... |
""" Package to be compiled. """
def runtest():
import nose
nose.run("package", "package")
| {
"content_hash": "207382dcdc5b3d7963ff9750683a0397",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 34,
"avg_line_length": 19.8,
"alnum_prop": 0.6060606060606061,
"repo_name": "kayhayen/Nuitka",
"id": "a7a379c3c279ea28374b1adf9113750f01ddaaa3",
"size": "994",
"binary": f... |
from itertools import groupby
from datetime import datetime, timedelta
import re
from dexter.app import app
from flask import request, make_response, jsonify, session
from flask.ext.mako import render_template
from flask.ext.security import roles_accepted, current_user, login_required
from sqlalchemy.sql import func, ... | {
"content_hash": "4fe7e1324508656ac138349575968f76",
"timestamp": "",
"source": "github",
"line_count": 616,
"max_line_length": 140,
"avg_line_length": 34.90422077922078,
"alnum_prop": 0.5949025626715037,
"repo_name": "Code4SA/mma-dexter",
"id": "494d9e043574d6b3eb7de522630e52cd5285dfec",
"size": "... |
import datetime
from sheets import Registrant, Registrations
DATE_FORMAT = "%m/%d/%Y"
def test_rows_returns_registrants(registrations: Registrations, test_registrants):
"""rows() should return a list of Registrant objects"""
all_registrations = registrations.rows()
assert isinstance(all_registrations, l... | {
"content_hash": "0a3bf52d997506da6d2faf4bd1c5a0ac",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 84,
"avg_line_length": 35.285714285714285,
"alnum_prop": 0.7272267206477733,
"repo_name": "looker/sdk-examples",
"id": "9b3ffa750c6f8b6d83e7ad37b32364b3ab39dcde",
"size": "... |
import os
import sys
import time
from stve.log import LOG as L
from stve.script import StveTestCase
class TestCase(StveTestCase):
def __init__(self, *args, **kwargs):
super(TestCase, self).__init__(*args, **kwargs)
@classmethod
def setUpClass(cls):
L.info("*** Start TestCase : %s *** "... | {
"content_hash": "f68436ad15549cc9810b055593b1f109",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 62,
"avg_line_length": 23.772727272727273,
"alnum_prop": 0.5984703632887189,
"repo_name": "TE-ToshiakiTanaka/stve",
"id": "b21f63395d1f1396273e7d1899896c9118e17b14",
"size"... |
from pychron.hardware.core.communicators.communicator import Communicator
from pychron.hardware.core.communicators.visa import resource_manager
class GpibCommunicator(Communicator):
"""
uses PyVisa as main interface to GPIB. currently (8/27/14) need to use a 32bit python version.
The NI488.2 frame... | {
"content_hash": "94a8decbf7f747709705d6b6cc96e049",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 110,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.5054755043227666,
"repo_name": "UManPychron/pychron",
"id": "c5235dc0c1704a9c832a794f731a5b072cb5401d",
"size":... |
import hmac
import json
import time
from typing import TYPE_CHECKING
import thor
from thor.http import get_header
from redbot.formatter import slack
from redbot.resource import HttpResource
from redbot.resource.fetch import RedHttpClient
from redbot.webui.ratelimit import ratelimiter
from redbot.webui.saved_tests imp... | {
"content_hash": "47a4e2e4501079085fb77f5a895858ff",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 88,
"avg_line_length": 31.776923076923076,
"alnum_prop": 0.6025175502299686,
"repo_name": "mnot/redbot",
"id": "70bf9f1bcd0a294327d026716ffd281a9b0d802c",
"size": "4131",
... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/crafted/weapon/shared_quick_shot_upgrade_mk3.iff"
result.attribute_template_id = 8
result.stfName("space_crafting_n","quick_shot_upgrade_mk3")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ##... | {
"content_hash": "9a1daf45b3fe829dd48b76d4ce919002",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 90,
"avg_line_length": 26.076923076923077,
"alnum_prop": 0.7109144542772862,
"repo_name": "anhstudios/swganh",
"id": "d8a3b636b338589907e9eaa11a2a555f7f930249",
"size": "48... |
import os
import shutil
import tempfile
import pytest
from . import helpers
from . import run
from . import refactor
def pytest_addoption(parser):
parser.addoption(
"--integration-case-dir",
default=os.path.join(helpers.test_dir, 'completion'),
help="Directory in which integration test c... | {
"content_hash": "407bd03557cc8b10a101bbf59dda1fce",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 77,
"avg_line_length": 32.35353535353536,
"alnum_prop": 0.6397127692788012,
"repo_name": "stevenbaker/dotfiles",
"id": "df0ecd1d217e4948a619a8e1a16332cb9a2cecd3",
"size": "... |
"""Support for tracking Tesla cars."""
import logging
from homeassistant.helpers.event import async_track_utc_time_change
from homeassistant.util import slugify
from . import DOMAIN as TESLA_DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_scanner(hass, config, async_see, discovery_info=None):
... | {
"content_hash": "c95012dcb6a4de16fdeae55d2c0f9be8",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 86,
"avg_line_length": 34.4,
"alnum_prop": 0.6085271317829457,
"repo_name": "leppa/home-assistant",
"id": "c205cc587eba4e4b453249665926821fa7a68b7c",
"size": "1548",
"bin... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# URL Config
ROOT_URLCONF = 'urls'
# Database connections
# For MySQL
#DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'curo',
# 'USER': 'username',
# 'PASSWORD': 'password',
# 'HOST': 'hostname',
# 'PORT':... | {
"content_hash": "d0a29add8c2b01804382632ea10f0801",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 47,
"avg_line_length": 18.520833333333332,
"alnum_prop": 0.5849268841394826,
"repo_name": "reggna/Curo",
"id": "001e4d47d352e3eaab0e87627bde90e498be26f2",
"size": "941",
... |
"""Test different accessory types: Switches."""
from datetime import timedelta
import pytest
from homeassistant.components.homekit.const import (
ATTR_VALUE,
TYPE_FAUCET,
TYPE_SHOWER,
TYPE_SPRINKLER,
TYPE_VALVE,
)
from homeassistant.components.homekit.type_switches import Outlet, Switch, Valve
fro... | {
"content_hash": "bc07603f02fda5ce638a03061300e01b",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 84,
"avg_line_length": 34.475806451612904,
"alnum_prop": 0.675906432748538,
"repo_name": "qedi-r/home-assistant",
"id": "aee61ccf2e783ec99ea8820f33fcd2faa5d1353b",
"size":... |
import numpy as np
import pandas as pd
from qstrader.signals.signal import Signal
class VolatilitySignal(Signal):
"""
Indicator class to calculate lookback-period daily
volatility of returns, which is then annualised.
If the number of available returns is less than the
lookback parameter the vol... | {
"content_hash": "81e6a788e9230daae9e2aef431664f62",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 67,
"avg_line_length": 26.2020202020202,
"alnum_prop": 0.5462606013878181,
"repo_name": "mhallsmoore/qstrader",
"id": "b47a8613abb26fa5c9117d4a235f7b59898431b9",
"size": "2... |
"""
Fast Lomb-Scargle Algorithm, following Press & Rybicki 1989
"""
from __future__ import print_function, division
__all__ = ['LombScargleFast']
import warnings
import numpy as np
from .lomb_scargle import LombScargle
# Precomputed factorials
FACTORIALS = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800]
... | {
"content_hash": "4332cf2c3067ed11d063bf926f623079",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 80,
"avg_line_length": 36.486666666666665,
"alnum_prop": 0.580059686948048,
"repo_name": "astroML/gatspy",
"id": "5ae1175d47bbe58760a9fed7bda246c5cd75c883",
"size": "16419... |
"""
Manage loggers for the api.
"""
import logging, logging.handlers, time
import api
from bson import json_util
from flask import request, has_request_context
from flask import logging as flask_logging
from sys import stdout
from datetime import datetime
critical_error_timeout = 600
log = logging.getLogger(__name... | {
"content_hash": "e869ff779f33cfbf8d826449a56fbcc6",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 89,
"avg_line_length": 27.182539682539684,
"alnum_prop": 0.5497810218978102,
"repo_name": "stuyCTF/stuyCTF-Platform",
"id": "985113bc147b5956ca228f5ac70f3f7e41af1a19",
"si... |
import datetime
from nose.tools import assert_almost_equal, assert_equal
from .tidal_model import calculate_amplitude, to_hours, Constituent
def test_calculate_amplitude():
test_data = [
(-0.0873440613, 0, 187, 45, 0.088),
(0.0235169771, 2.5, 187, 45, 0.088),
]
for expected, time, phase,... | {
"content_hash": "541cbb5d53dbbec7e319399ee85bed4c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 67,
"avg_line_length": 27.8125,
"alnum_prop": 0.5932584269662922,
"repo_name": "sealevelresearch/tide-predictor",
"id": "3c972942d7ed4caad6f51ec4df05765915ec35b2",
"size": ... |
'''
Created on Oct 15, 2015
@author: wirkert
'''
import numpy as np
from pandas import DataFrame
import pandas as pd
class AbstractBatch(object):
"""summarizes a batch of simulated mc spectra"""
def __init__(self):
self._nr_layers = 0 # internally keeps track of number of layers
my_index =... | {
"content_hash": "e087c5c86af4679b1d015f21efe221f8",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 80,
"avg_line_length": 38.394666666666666,
"alnum_prop": 0.5533407417696903,
"repo_name": "iwegner/MITK",
"id": "2706262dc6d9eebd8a457bf6bf01df75474ea13a",
"size": "14398"... |
import os
import sys
import re
sys.path.append(os.getcwd())
import argparse
import json
def main():
# Parse arguments to identify the path to the accuracy logs from
# the accuracy and performance runs
parser = argparse.ArgumentParser()
parser.add_argument(
"--unique_sample", "-u",
he... | {
"content_hash": "d795f50f963f32d0c1bdea1adece48c5",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 121,
"avg_line_length": 34.1865671641791,
"alnum_prop": 0.5518445754202139,
"repo_name": "mlperf/inference_results_v0.5",
"id": "8a505f7e21b99a23de08c2cf7d6f9956f776a657",
... |
from reportlab.lib.pagesizes import letter
from reportlab.lib import colors
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
class SimplePdf(object):
"""
SimplePdf helps to put your content into a... | {
"content_hash": "f13eccf70391dfaf88a49de4ae1faac9",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 96,
"avg_line_length": 33.639240506329116,
"alnum_prop": 0.6101599247412982,
"repo_name": "roksela/super-simple-pdf",
"id": "fe51671dcca8c5a4c5f73a7b1ed0c210b84d8be1",
"si... |
import sys
import string
import os
import math
# This function prints usage information
def printHelp ():
print "Usage: " + sys.argv[0] + " [-html] rankcurve1 [rankcurve2 [... rankcurveN]]"
print
print " rankcurve1 ... rankcurveN - name of the rank curve file(s) from csuRankCurve"
print
print "By... | {
"content_hash": "75c819ab41d2f09fa9b95794ce62938d",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 92,
"avg_line_length": 28.494880546075084,
"alnum_prop": 0.5508444125044916,
"repo_name": "phillipstanleymarbell/sunflower-simulator",
"id": "642feef620a500977c0eb97dee99cfb... |
"""
This file tests provides functionality to test that notebooks run without
warning or exception.
"""
import io
import logging
import os
import shutil
import time
from nbconvert.preprocessors import ExecutePreprocessor
import nbformat
IPYTHON_VERSION = 4 # Pin to ipython version 4.
TIME_OUT = 15*60 # Max... | {
"content_hash": "10a63c093219d246c3d3c593e0b88666",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 110,
"avg_line_length": 40.16831683168317,
"alnum_prop": 0.6255854079368992,
"repo_name": "eric-haibin-lin/mxnet",
"id": "9ee11db428b57713dcdebb8671a750b90faef63b",
"size"... |
from __future__ import absolute_import
import voeventparse as vp
import datetime
from copy import copy
ivorn_base = 'voevent.4pisky.org'
test_trigger_substream = 'TEST-TRIGGER'
test_response_substream = 'TEST-RESPONSE'
alarrm_request_substream = 'ALARRM-REQUEST'
datetime_format_short = '%y%m%d-%H%M.%S'
def create_s... | {
"content_hash": "caf641439b5cb7af87381a1d3f196227",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 90,
"avg_line_length": 34.28735632183908,
"alnum_prop": 0.631914180355347,
"repo_name": "timstaley/pysovo",
"id": "b3d73179a1a372bba5ea89021ac156cd60ddd5ba",
"size": "2983"... |
from social_flask.strategy import FlaskTemplateStrategy, FlaskStrategy
| {
"content_hash": "00a213dd3bab18cec0098e2228219532",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 70,
"avg_line_length": 71,
"alnum_prop": 0.8873239436619719,
"repo_name": "rsalmaso/python-social-auth",
"id": "cc9d2e6ed5e56b4e249603be58ae64e97f300795",
"size": "71",
"b... |
from subdaap.provider import Provider
from subdaap.database import Database
from subdaap.connection import Connection
from subdaap.state import State
from subdaap import cache, config, webserver
from daapserver import DaapServer
from apscheduler.schedulers.gevent import GeventScheduler
import resource
import logging... | {
"content_hash": "2f792d2b90b8d351da1844bccdd11227",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 79,
"avg_line_length": 31.41368078175896,
"alnum_prop": 0.5648071339693074,
"repo_name": "ties/SubDaap",
"id": "ac249661b4e36d5f3fe7a6818f145a0e19ab512e",
"size": "9644",
... |
"""Pretty-print tabular data."""
from collections import namedtuple
from platform import python_version_tuple
import re
if python_version_tuple()[0] < "3":
from itertools import izip_longest
from functools import partial
_none_type = type(None)
_int_type = int
_float_type = float
_text_type... | {
"content_hash": "05d523bb7681787f0a76e9a82fb227a4",
"timestamp": "",
"source": "github",
"line_count": 847,
"max_line_length": 197,
"avg_line_length": 34.17355371900826,
"alnum_prop": 0.5345655553636207,
"repo_name": "vitchyr/rlkit",
"id": "33ecf0426b96a2796578f40a225ebc54f4db5a09",
"size": "28995... |
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.grating_coupler_elliptical import grating_coupler_elliptical
from gdsfactory.types import ComponentSpec
@gf.cell
def grating_coupler_array(
grating_coupler: ComponentSpec = grating_coupler_elliptical,
pitch: float = ... | {
"content_hash": "7bd9e68119d36bd30a4f273e6d5bcc63",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 87,
"avg_line_length": 26.28205128205128,
"alnum_prop": 0.6390243902439025,
"repo_name": "gdsfactory/gdsfactory",
"id": "a1ac39f7ab6124fe9815983806857b4d4b42fc66",
"size": ... |
""" Myproxy client. Demo on how to use myproxylib.py """
import os
import sys
from myproxylib import MyProxy, UserCredential
__version__ = '0.1'
class MyProxyClient(object):
def __init__(self, host, port=7512, certfile=None, keyfile=None, debug=False):
"""
host -- hostname of MyProxy serve... | {
"content_hash": "cce1ea7dfee3781daa378b5ba98873d3",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 108,
"avg_line_length": 41.64670658682635,
"alnum_prop": 0.5897915168943206,
"repo_name": "placiflury/gridmonitor-sft",
"id": "85b56b95d1012ecaf278eddb179c635e9b7b0063",
"... |
from __future__ import division, with_statement # confidence high
import glob
import os
import sys
import numpy as np
from ..extern.six import BytesIO
import pyfits as fits
from ..verify import VerifyError
from . import PyfitsTestCase
from .util import ignore_warnings
from nose.tools import assert_raises
from war... | {
"content_hash": "cdc00e8b19cb9fd7c4bb505eff955def",
"timestamp": "",
"source": "github",
"line_count": 786,
"max_line_length": 80,
"avg_line_length": 36.48346055979644,
"alnum_prop": 0.5555865532152322,
"repo_name": "spacetelescope/PyFITS",
"id": "a4de1361788ec0119e04ac81e89268ec11d0a879",
"size":... |
from atpbar import atpbar
##__________________________________________________________________||
class ReaderComposite:
"""A composite of event readers"
This class is a composite in the composite pattern.
Examples of event readers are instances of `Summarizer` and this
class.
When `event()` is ... | {
"content_hash": "3dce2ef0dac7c5a3e30421232493cc18",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 70,
"avg_line_length": 27.446153846153845,
"alnum_prop": 0.5022421524663677,
"repo_name": "alphatwirl/alphatwirl",
"id": "9727d1d97213b9157dc27d98822d2cb5c1d224f6",
"size":... |
"""Generate the quadrature abscissas and weights in Fejer quadrature."""
import numpy
import chaospy
from .hypercube import hypercube_quadrature
from .clenshaw_curtis import clenshaw_curtis_simple
def fejer_2(order, domain=(0, 1), growth=False, segments=1):
"""
Generate the quadrature abscissas and weights i... | {
"content_hash": "411770ecd6703aac5ac6ec6869c7fcb0",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 87,
"avg_line_length": 37.12,
"alnum_prop": 0.6537356321839081,
"repo_name": "jonathf/chaospy",
"id": "2be56d22965ac99e2d86185b65e006f30d6a334e",
"size": "2811",
"binary"... |
matrix_input = input("Matice (čísla odděluj mezerou, řádky čárkou):").split(",")
permutation = list( map( int, input("Permutace (čísla odděluj mezerou):").split(" ") ) )
# Pouze zpracuje zadanou matici tak, aby s ní mohl python pracovat
matrix = []
for m in matrix_input:
matrix.append( list(map(int, m.split(" ") )... | {
"content_hash": "10bc6e122c39326ddad37484fa550b21",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 88,
"avg_line_length": 24.78723404255319,
"alnum_prop": 0.5896995708154507,
"repo_name": "malja/cvut-python",
"id": "dbec6bd5a4f5406d8b4c803512b79e13e23acdeb",
"size": "152... |
import time
import unittest
from datetime import datetime as dt
from unittest import mock
from unittest.mock import ANY, call
from watchtower import CloudWatchLogHandler
from airflow.models import DAG, DagRun, TaskInstance
from airflow.operators.empty import EmptyOperator
from airflow.providers.amazon.aws.hooks.logs ... | {
"content_hash": "6b7415b3fbb2b93786ce9c92774d204e",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 107,
"avg_line_length": 40.38755980861244,
"alnum_prop": 0.5969671839829405,
"repo_name": "lyft/incubator-airflow",
"id": "dbd2ae28d5ad77000b276dfa6ca475372ebd161e",
"size... |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project fold... | {
"content_hash": "eff18729b9cab61b1d55378019aad6eb",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 100,
"avg_line_length": 29.548042704626333,
"alnum_prop": 0.6864988558352403,
"repo_name": "hamole/pbl8",
"id": "9bb159752a58226ab0484dd4628fe335b6e5da04",
"size": "8303",... |
from mock import patch
from pip.vcs.git import Git
from tests.test_pip import (reset_env, run_pip,
_create_test_package)
def test_get_tag_revs_should_return_tag_name_and_commit_pair():
env = reset_env()
version_pkg_path = _create_test_package(env)
env.run('git', 'tag', '0.1', c... | {
"content_hash": "ee516e63e6384e15cb1dbfd1b24e565f",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 77,
"avg_line_length": 38.38961038961039,
"alnum_prop": 0.5937077131258457,
"repo_name": "jbenet/heroku-buildpack-python",
"id": "0b3abab2e1331de3de7e2d51ade45042e2b6d794",
... |
"""
Find the kth smallest element in linear time using divide and conquer.
Recall we can do this trivially in O(nlogn) time. Sort the list and
access kth element in constant time.
This is a divide and conquer algorithm that can find a solution in O(n) time.
For more information of this algorithm:
https://web.stanford... | {
"content_hash": "d4d0419a22d7112dd1f5d2d38ae1d506",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 82,
"avg_line_length": 27,
"alnum_prop": 0.6142450142450142,
"repo_name": "TheAlgorithms/Python",
"id": "666ad1a39b8a1290529987fe7555ff437743c7ba",
"size": "1755",
"binar... |
import sys
import traceback
from optparse import make_option
from django_extensions.compat import importlib, list_apps
from django_extensions.management.email_notifications import \
EmailNotificationCommand
from django_extensions.management.utils import signalcommand
def vararg_callback(option, opt_str, opt_valu... | {
"content_hash": "a9dffeef849a23a17b20d3594528939b",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 100,
"avg_line_length": 38.232142857142854,
"alnum_prop": 0.5084851315584618,
"repo_name": "jpadilla/django-extensions",
"id": "b094504fefb6d82051c7aec08a6cd9798667bdef",
... |
from superset.db_engine_specs.firebolt import FireboltEngineSpec
from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec
class TestFireboltDbEngineSpec(TestDbEngineSpec):
def test_convert_dttm(self):
dttm = self.get_dttm()
test_cases = {
"DATE": "CAST('2019-01-0... | {
"content_hash": "559cf7e38c92c84a8e19f174de596c26",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 79,
"avg_line_length": 38.21739130434783,
"alnum_prop": 0.6291240045506257,
"repo_name": "zhouyao1994/incubator-superset",
"id": "793b32970bddb85db0426d1f816774c2e75bb02f",
... |
from artefact.utils.consume_parser import ConsumeParser
import re
import json
class Line(ConsumeParser):
# This char is §, the 'Section' character
split_char = '§'
rules = [
(r'^(?P<cookie_id>-?\d*)' + split_char, False),
(r'^(?P<site_id>\d+)' + split_char, False),
(r'^(... | {
"content_hash": "02d1c2ec72f36b8a2d4ad2622789f5e6",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 143,
"avg_line_length": 41.50819672131148,
"alnum_prop": 0.5434439178515008,
"repo_name": "artefactory/artefact.connectors",
"id": "eac5dc480e96156a1d61819af48b783daf3fd2e5",... |
from django.core import management
from django.core.management.validation import (
ModelErrorCollection, validate_model_signals
)
from django.db.models.signals import post_init
from django.test import TestCase
from django.utils import six
class OnPostInit(object):
def __call__(self, **kwargs):
pass
... | {
"content_hash": "cb50f8501e385be290f3814763d3a7a5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 37.36734693877551,
"alnum_prop": 0.6220644456581104,
"repo_name": "Beeblio/django",
"id": "225656e4cbb55a04c999ab2d4d9a24b7f1e196e4",
"size": "1831",... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import numpy as np
import tensorflow as tf
flags = tf.flags
FLAGS = tf.app.flags.FLAGS
LSTMTuple = collections.namedtuple('LSTMTuple', ['c', 'h'])
def cell_depth(num):
num /= 2
val = n... | {
"content_hash": "d2ebd38944ab10f33354cd3985a55377",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 101,
"avg_line_length": 37.64900662251656,
"alnum_prop": 0.5892700087950747,
"repo_name": "jiaphuan/models",
"id": "6add7ffa4e0d69da56d2bba7d9da3875b5c4dd3b",
"size": "637... |
from twisted.application import service
from DeviceService import DeviceService
from ControlService import ControlService
from Config import Config
from DB import DB
class MainService(service.MultiService):
def __init__(self):
service.MultiService.__init__(self)
self.config = Config.getconf()
... | {
"content_hash": "de6102ba5c89834d8c5f1c85f33861cd",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 115,
"avg_line_length": 31.228571428571428,
"alnum_prop": 0.5913388228118329,
"repo_name": "tsnik/SkyNet",
"id": "6e647d625131fa7bacebbff05e8c33bdb8299185",
"size": "3279"... |
from __future__ import print_function
_version = "0.3.2"
_usage="""
ShowFeats [optional args] <filenames>
if "-" is provided as a filename, data will be read from stdin (the console)
"""
_welcomeMessage="This is ShowFeats version %s"%(_version)
import math
#set up the logger:
from rdkit import RDLogger as l... | {
"content_hash": "b8a74d37101ed4de13c8700300977039",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 112,
"avg_line_length": 34.17329545454545,
"alnum_prop": 0.6117715520824674,
"repo_name": "AlexanderSavelyev/rdkit",
"id": "6cc6a2b029a52916fb72a72c77ecf8239f331597",
"siz... |
"""
User Account templatetags
"""
from coffin import template
from django.template import RequestContext
from jinja2 import contextfunction, Markup
from treeio.core.rendering import render_to_string
register = template.Library()
@contextfunction
def account_notification_count(context):
"Account notification count... | {
"content_hash": "ee9a6202c64e270b91751e11d98b9f73",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 93,
"avg_line_length": 32.611111111111114,
"alnum_prop": 0.6547416240772288,
"repo_name": "rogeriofalcone/treeio",
"id": "f4a96a5d8928c0119fd979edc285d1ac2e31efda",
"size":... |
class CommandError(Exception):
def __init__(self, keyword):
self.value = "Command '%s' Not Found" % keyword
def __str__(self):
return repr(self.value)
| {
"content_hash": "94fe6a0a7ea2900b10c7ab19e05bc86e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 32.4,
"alnum_prop": 0.6481481481481481,
"repo_name": "freefood89/untitled",
"id": "dce69c450e716b948558f2a0c499870d92be5ab6",
"size": "162",
"binary... |
"""Checks WebKit style for JSON files."""
import json
import re
class JSONChecker(object):
"""Processes JSON lines for checking style."""
categories = set(('json/syntax', ))
def __init__(self, _, handle_style_error):
self._handle_style_error = handle_style_error
self._handle_style_error... | {
"content_hash": "cd7f9743238e6f6a7ac02ad612dfad41",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 31.225806451612904,
"alnum_prop": 0.59400826446281,
"repo_name": "ric2b/Vivaldi-browser",
"id": "41dccabb907381d175fd3483a6eaf5ee73395fa5",
"size": "... |
import mock
from oslo.serialization import jsonutils
from nova import exception
from nova import objects
from nova.pci import pci_stats as pci
from nova.pci import pci_whitelist
from nova import test
from nova.tests.pci import pci_fakes
fake_pci_1 = {
'compute_node_id': 1,
'address': '0000:00:00.1',
'prod... | {
"content_hash": "6d7e2ef21a843f8aa5b9c85869a2f6c3",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 40.833333333333336,
"alnum_prop": 0.567444120505345,
"repo_name": "angdraug/nova",
"id": "2f830c6cfa18e26e357a9fb3fc4543711e95ff31",
"size": "10930"... |
from django.test import TestCase, LiveServerTestCase
from django.test import Client
import datetime
import time
# from django.utils import timezone
from django.contrib.auth.models import User
from registration.models import RegistrationProfile
from django.core.urlresolvers import reverse
from selenium import webdrive... | {
"content_hash": "cf504d8535f18e66bfa22db1c3096eb7",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 88,
"avg_line_length": 36.1,
"alnum_prop": 0.6394630300447475,
"repo_name": "alibulota/Package_Installer",
"id": "22b5e0e20d856f4b2649fd6619d4312b7b121683",
"size": "4693"... |
from google import pubsub_v1
async def sample_list_topic_snapshots():
# Create a client
client = pubsub_v1.PublisherAsyncClient()
# Initialize request argument(s)
request = pubsub_v1.ListTopicSnapshotsRequest(
topic="topic_value",
)
# Make the request
page_result = client.list_to... | {
"content_hash": "62d274ba125ded993836afc1b739cbba",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 62,
"avg_line_length": 25.25,
"alnum_prop": 0.7049504950495049,
"repo_name": "googleapis/python-pubsub",
"id": "85b983f5d0e85c3772b293b490c179a839b14e3d",
"size": "1895",
... |
"""
A listening logging server for MiStaMover. This logs to a file (only).
The main object instantiated in the calling code is LoggerServer,
which listens for messages on a port and logs them. The classes
SingleFileLogger and MultiFileLogger are helpers that actually
log these to the relevant files.
"""
import os
#... | {
"content_hash": "37557e4955a64dbde4b3fe7da03adf4b",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 98,
"avg_line_length": 31.8944099378882,
"alnum_prop": 0.6001947419668938,
"repo_name": "cedadev/mistamover",
"id": "fb7d5951b74b58fc40239ead744391d02b8e6efe",
"size": "53... |
"""Python wrappers for Datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import functools
import sys
import threading
import warnings
import weakref
import numpy as np
import six
from six.moves import queue as Queue # pylint: disable=... | {
"content_hash": "cbf8daf8c89dfe3aec4dc24f4d9adbe8",
"timestamp": "",
"source": "github",
"line_count": 4553,
"max_line_length": 116,
"avg_line_length": 39.71535251482539,
"alnum_prop": 0.6619143476529664,
"repo_name": "renyi533/tensorflow",
"id": "c7b2257c5106fbfc2b7753aa0cfa997e91e5f069",
"size":... |
from collections import OrderedDict
import pytest
from pandas.util._validators import validate_bool_kwarg, validate_kwargs
_fname = "func"
def test_bad_kwarg():
good_arg = "f"
bad_arg = good_arg + "o"
compat_args = OrderedDict()
compat_args[good_arg] = "foo"
compat_args[bad_arg + "o"] = "bar"
... | {
"content_hash": "3401b866a106e12f06c4a5956f445567",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 73,
"avg_line_length": 28.3943661971831,
"alnum_prop": 0.6200396825396826,
"repo_name": "GuessWhoSamFoo/pandas",
"id": "f36818ddfc9a80585b458ddcf5dd8de67053e15b",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/armor/kashyyykian_ceremonial/shared_armor_kashyyykian_ceremonial_bracer_r.iff"
result.attribute_template_id = 0
result.stfName("wearables_name","armor_kashyyykian_ceremonial_bracer_r")
#### BEGIN ... | {
"content_hash": "9b71d6b7635a2b329e39fd2761ca49f9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 124,
"avg_line_length": 29.692307692307693,
"alnum_prop": 0.7409326424870466,
"repo_name": "obi-two/Rebelion",
"id": "16d1638f92b1c5632a23a5634027e6f2d0cdacc2",
"size": "53... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import iteritems
import base64
import json
import ... | {
"content_hash": "b5c427ecab165309890b2f859011f009",
"timestamp": "",
"source": "github",
"line_count": 734,
"max_line_length": 80,
"avg_line_length": 35.68119891008175,
"alnum_prop": 0.6709812905689194,
"repo_name": "sunchuanleihit/vimrc",
"id": "254ce200786d975c804765dd221b4e8f78c9d87f",
"size": ... |
__version__ = (0, 9, 3)
import sys, os
import re
import types
import time
import urllib
import json
import string
import base64
import requests
# intra-package imports
from .config import PROTOCOL, SERVER, WS_API_VERSION, WEB_SERVICE, RALLY_REST_HEADERS
from .config import USER_NAME, PASSWORD
from .config imp... | {
"content_hash": "54583f42a17d851beb2fea4fa4474c96",
"timestamp": "",
"source": "github",
"line_count": 1475,
"max_line_length": 129,
"avg_line_length": 45.18779661016949,
"alnum_prop": 0.5897647482446138,
"repo_name": "ktan2020/legacy-automation",
"id": "ef2ccb5c45c37e99f87700db843d49e58f690ebd",
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from builtins import open
from pants.util.contextutil import temporary_file
from pants_test.task_test_base import TaskTestBase
from pants.contrib.go.targets.go_binary import GoBinary
from pants.contrib.go.tasks.go_go import ... | {
"content_hash": "bef6e10db52d271daa416f3462f28af1",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 90,
"avg_line_length": 36.72222222222222,
"alnum_prop": 0.6550680786686838,
"repo_name": "twitter/pants",
"id": "fb3df4b7d4f2e847ad7ac72921e94ed99cdc4b02",
"size": "3452",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import
from tensorflow.contrib.periodic_resample.python.ops import gen_periodic_resample_op
from tensorflow.contrib.periodic_resample.python.ops.gen_periodic_resample_op import periodi... | {
"content_hash": "82e5f2bb9ea2ea9b163fe79a4347da35",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 102,
"avg_line_length": 38.666666666666664,
"alnum_prop": 0.8051724137931034,
"repo_name": "ryfeus/lambda-packs",
"id": "348623d8f8d0c2ed60f559eca281343722038100",
"size": ... |
import sys
import socket
import string
import os
import traceback
try:
import irc.bot
except ImportError:
raise ImportError("Requires irclib; pip install irc")
from giotto.controllers import GiottoController
from giotto.exceptions import ProgramNotFound
from giotto.utils import parse_kwargs
irc_execution_snip... | {
"content_hash": "d423af164ecfefae4b97981dbc2b16db",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 99,
"avg_line_length": 30.322916666666668,
"alnum_prop": 0.5985915492957746,
"repo_name": "priestc/giotto",
"id": "829c1344fa433205f9637c9932658846ee3ab223",
"size": "5822... |
"""Consume and serialize all of the data from a running TensorBoard instance.
This program connects to a live TensorBoard backend at given port, and saves
all of the data to local disk JSON in a predictable format.
This makes it easy to mock out the TensorBoard backend so that the frontend
may be tested in isolation.... | {
"content_hash": "909cae0d72029ef3ce042ada83d3027b",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 79,
"avg_line_length": 32.57286432160804,
"alnum_prop": 0.6541190990435051,
"repo_name": "wenwei202/terngrad",
"id": "fd9fd39486c07097ccb88408f78d163ee471d0fe",
"size": "7... |
from importlib.metadata import version
from packaging.version import parse
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"sphinx_autodoc_typehints",
"sphinx_tabs.tabs",
]
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
project = ... | {
"content_hash": "02868ba232dca51dd2f9e4fb50e5cae9",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 22.872340425531913,
"alnum_prop": 0.6716279069767442,
"repo_name": "asphalt-framework/asphalt-web",
"id": "89d3c242984701013458bc74e83e2ef4d86c570e",
... |
'''
Copyright 2009, The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ap... | {
"content_hash": "7a1adbef146d383861e173dbf8d8a4d2",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 135,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6339446242358864,
"repo_name": "markmckenna/dotfiles",
"id": "e435e5de32fce7f4b55f0a24b60d65df4c5975af",
"size"... |
from .device import Device
from .pathpoints import BasePathpoint, pathpoint_from_functions | {
"content_hash": "927befbea6ea37e6901bb23e01d3153a",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 63,
"avg_line_length": 45,
"alnum_prop": 0.8555555555555555,
"repo_name": "smok-serwis/longshot-python",
"id": "a17af38258e9bb8fb4c1624c0ff2f07e1536bccd",
"size": "92",
"b... |
"""
Cement core argument module.
"""
from ..core import backend, exc, interface, handler
Log = backend.minimal_logger(__name__)
def argument_validator(klass, obj):
"""Validates a handler implementation against the IArgument interface."""
members = [
'_setup',
'parse',
'parsed_args',
... | {
"content_hash": "4fefb6213c98764b042563e360fa5152",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 79,
"avg_line_length": 28.13821138211382,
"alnum_prop": 0.540306269864201,
"repo_name": "derks/cement",
"id": "87faa000d164f7112fe4caee5a8df5e014f16ae5",
"size": "3461",
... |
"""$_memeq, $_strlen, $_streq, $_regex"""
import gdb
import re
class _MemEq(gdb.Function):
"""$_memeq - compare bytes of memory
Usage:
$_memeq(a, b, len)
Returns:
True if len bytes at a and b compare equally.
"""
def __init__(self):
super(_MemEq, self).__init__("_memeq")
def invoke(self, a, b, lengt... | {
"content_hash": "7dee5d7c7aa0e9b8fb6ba7fbc62ee3f0",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 69,
"avg_line_length": 21.17391304347826,
"alnum_prop": 0.6319301848049281,
"repo_name": "trfiladelfo/tdk",
"id": "9e2ed79a449ab8d61367cbab0c66738d876a1c19",
"size": "2684"... |
"""
Interface for setting up and creating a model in Tensorflow.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import tensorflow as tf
from tensorflow.python.framework import ops
# Local imports
import tf_data
import utils as digits
f... | {
"content_hash": "66e3770f6a1cceff89fea38305120d33",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 115,
"avg_line_length": 42.848874598070736,
"alnum_prop": 0.5800690379708839,
"repo_name": "ethantang95/DIGITS",
"id": "a19df6309fa574f93139cb02c8c010f96e2d54ea",
"size": ... |
import collections
import functools
import logging
import os
import re
import cloudstorage as gcs
import jinja2
import webapp2
import yaml
from google.appengine.api import urlfetch
from google.appengine.api import memcache
from webapp2_extras import sessions
import filters as jinja_filters
PROW_JOBS = yaml.load(op... | {
"content_hash": "8ea9c8181ae7f8b08156b96289de42ad",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 98,
"avg_line_length": 33.17567567567568,
"alnum_prop": 0.6411405295315682,
"repo_name": "piosz/test-infra",
"id": "3b5d27fbaba7dfce23d8170e4899f789ca8e21d5",
"size": "549... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import hashlib
import os
import shutil
import textwrap
import threading
from collections import defaultdict
from textwrap import dedent
from pants.backend.jvm.subsyst... | {
"content_hash": "73a9ad04fdbace38a2aa2542ee95ea6a",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 100,
"avg_line_length": 46.25705329153605,
"alnum_prop": 0.6368934670642451,
"repo_name": "peiyuwang/pants",
"id": "f9804b4c65a7224d2a546dbdcb8bac1a466ffa64",
"size": "149... |
import constants.create_data_set_constants as const
import tensorflow as tf
class Cifar10Reader:
@staticmethod
def _convert_from_binary(
example_bytes):
"""
- Casts the label to tf.int32.
- Reshapes the image.
:param example_bytes: Example in bytes from the Cifar1... | {
"content_hash": "1ba5d3e3308a608a01fe9c1af56cddf9",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 78,
"avg_line_length": 25.76875,
"alnum_prop": 0.48071792384186274,
"repo_name": "dani-i/bachelor-project",
"id": "cd0d2e6555a96cf21f7f59252a8194f7a81d63e8",
"size": "4123... |
"""
Volume driver for IBM FlashSystem storage systems with iSCSI protocol.
Limitations:
1. Cinder driver only works when open_access_enabled=off.
"""
import random
import threading
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import six
from cinder import exceptio... | {
"content_hash": "ba68b35ab5580142f86b49955e0a2976",
"timestamp": "",
"source": "github",
"line_count": 398,
"max_line_length": 78,
"avg_line_length": 38.027638190954775,
"alnum_prop": 0.5571853320118929,
"repo_name": "Datera/cinder",
"id": "d11837adf66a3fcd58c13b66845e414a533021d9",
"size": "15763... |
"""Kraken - objects.Constraints.ScaleConstraint module.
Classes:
ScaleConstraint - Scale Constraint.
"""
from constraint import Constraint
class ScaleConstraint(Constraint):
"""Scale Constraint."""
def __init__(self, name, metaData=None):
super(ScaleConstraint, self).__init__(name, metaData=metaDa... | {
"content_hash": "2fec9c186fdc04ab861545ae6c80c3f7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 70,
"avg_line_length": 21.6,
"alnum_prop": 0.7160493827160493,
"repo_name": "oculusstorystudio/kraken",
"id": "e5db7cb92ef27a18a843e2e93cd565de37f419eb",
"size": "324",
"... |
import numpy as np
import pytest
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import Gaussian2DKernel
from astropy.nddata import NDData
def test_basic_nddata():
arr = np.zeros((11, 11))
arr[5, 5] = 1
ndd = NDData(arr)
test_kernel = Gaussian2DKernel(... | {
"content_hash": "450a956f9d1fd9b7726b05802cdfe1d4",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 88,
"avg_line_length": 32.892857142857146,
"alnum_prop": 0.6096634093376765,
"repo_name": "lpsinger/astropy",
"id": "6e2585ab26d6eb79d15dd1ebfda400f9c8222445",
"size": "190... |
import os
import sys, getopt
from pwd import getpwuid
import logging
class terminalColors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def find_owner(filename):
# Para un d... | {
"content_hash": "abf5f9265e6e447b2344f8ab6f0066a3",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 134,
"avg_line_length": 33.37623762376238,
"alnum_prop": 0.6449124888757045,
"repo_name": "miguelfito/mikeTools",
"id": "6ae1a0d50bdf2c5fb70881fa48f4a49ac4c915c8",
"size":... |
'''Manager for predicates.
Created on Jun 15, 2013
@author: Cam Moore
'''
import sys
import inspect
from apps.managers.challenge_mgr.models import RoundSetting, GameInfo
from apps.widgets.smartgrid_library.models import LibraryEvent, LibraryAction
from apps.widgets.smartgrid_design.models import DesignerLevel, Design... | {
"content_hash": "a521c58994c507fb2a240dd8b4e742a0",
"timestamp": "",
"source": "github",
"line_count": 379,
"max_line_length": 99,
"avg_line_length": 39.58575197889182,
"alnum_prop": 0.6596014130507232,
"repo_name": "yongwen/makahiki",
"id": "b7244c6d3990c0d19e88ef158816b0e536c1f9bc",
"size": "150... |
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models import NOT_PROVIDED
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s"
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
sql_alter_column_... | {
"content_hash": "bd1c624e7ec2cfc9649c2b8298777c80",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 94,
"avg_line_length": 44.91216216216216,
"alnum_prop": 0.6252444711900105,
"repo_name": "theo-l/django",
"id": "71b021f7c5140bd11276a06ccf8531ac05f9691d",
"size": "6647",... |
from __future__ import print_function
DESCRIPTION = """
Runs all the examples for testing purposes and reports successes and failures
to stderr. An example is marked successful if the running thread does not
throw an exception, for threaded examples, such as plotting, one needs to
check the stderr messages as well.
"... | {
"content_hash": "bf0282a4e240494628e57fb3ed411efa",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 84,
"avg_line_length": 28.00414937759336,
"alnum_prop": 0.6246851385390428,
"repo_name": "chaffra/sympy",
"id": "a228a3503ab1cf6a1f0258246035d42791875c42",
"size": "6771",... |
import codecs
import os
import re
import sys
from setuptools import setup, find_packages, Extension
from distutils.errors import (CCompilerError, DistutilsExecError,
DistutilsPlatformError)
from distutils.command.build_ext import build_ext
from setuptools.command.test import test as TestCo... | {
"content_hash": "d6305f563e78ddc138781e4be39eea65",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 88,
"avg_line_length": 29.341463414634145,
"alnum_prop": 0.6098642283180936,
"repo_name": "danielnelson/aiohttp",
"id": "924aeb3e3271aea0cb773459f4485512f95d5a11",
"size":... |
""" Config for the overall application """
from django.apps.config import AppConfig
class DjCoreConfig(AppConfig):
name = label = 'dj_core'
| {
"content_hash": "2ee6bb52364e0ebdfec532d3cee4e84b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 42,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.726027397260274,
"repo_name": "ionata/dj-core",
"id": "217ffa0339c5c15f64fbdaa7bad131f0ed00100e",
"size": "146",
... |
import os
import sys
if sys.platform == 'wn32':
pybabel = 'flask\\Scripts\\pybabel'
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
print "usage: tr_init <language-code>"
sys.exit(1)
os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app')
os.system(pybabel + ' init -i... | {
"content_hash": "65ffa73e82a9fb4a816a669d894172c1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 33.25,
"alnum_prop": 0.6716791979949874,
"repo_name": "VagrantApe/flaskMicroblog",
"id": "9833d65ec0945cce0ae5bc7645b3d6f70645fa8e",
"size": "418",
... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0006_auto_20160522_0727'),
]
operations = [
migrations.RenameField(
model_name='post',
old_name='tag_id',
new_nam... | {
"content_hash": "f15122e25f29a8162f056abdcfaeffea",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 43,
"avg_line_length": 19.22222222222222,
"alnum_prop": 0.5578034682080925,
"repo_name": "porimol/django-blog",
"id": "9956d1d45638e049243781d79b80ef62a7c941ee",
"size": "4... |
__author__="Jaimiey Sears, updated by Alex Schendel and Alex Reinemann, 2018"
__copyright__="October 26, 2015"
__version__= 0.50
import queue
import threading
import socket
#from mpl_toolkits.mplot3d import Axes3D
#from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
from LidarCommands.utility ... | {
"content_hash": "3bde787993c8d64ad54a606532f4fe86",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 119,
"avg_line_length": 35.44210526315789,
"alnum_prop": 0.5358875358875359,
"repo_name": "MarsRobotics/Experiments",
"id": "b86e05e1a6c30d650963247eabf5ed8ca8d8a11e",
"si... |
from netforce.model import Model, fields
class ContactCateg(Model):
_name = "contact.categ"
_string = "Contact Category"
_key = ["code"]
_name_field = "name"
_fields = {
"name": fields.Char("Category Name", required=True, search=True),
"code": fields.Char("Category Code", search=Tr... | {
"content_hash": "ee5f3ae18f7f627fdc5048997e08e053",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.5484210526315789,
"repo_name": "anastue/netforce",
"id": "502774508e58cc486d58d493cf71f2d24ba21a14",
"size": "205... |
"""Test config flow."""
from unittest.mock import Mock, patch
from homeassistant.components.hassio.handler import HassioAPIError
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.setup import async_setup_component
async def test_hassio_discovery_startup(hass, aioclient_mock, hassio_client)... | {
"content_hash": "2e0bbc6ba96cc40f7f1bcb0d0c8b5950",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 82,
"avg_line_length": 32.66863905325444,
"alnum_prop": 0.45716355732657127,
"repo_name": "partofthething/home-assistant",
"id": "c23ee40de6ef003d64483da9b5ad361c9d6b670e",
... |
from django.db.models.base import ModelBase
class CheckConstraintMetaClass(ModelBase):
def __new__(cls, name, bases, attrs):
model = super(CheckConstraintMetaClass, cls).__new__(cls, name, bases, attrs)
for (constraint_name, constraint_obj) in model._meta.constraints:
constraint_obj.val... | {
"content_hash": "9824d8909762109733e1eca2c8ee784f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 85,
"avg_line_length": 40.111111111111114,
"alnum_prop": 0.6869806094182825,
"repo_name": "theju/django-check-constraints",
"id": "5a35bc2e7f0133c5aee855f69dfb8274f176b1d2",
... |
from nose.tools import * # flake8: noqa
from datetime import datetime
from api.base.settings.defaults import API_BASE
from api_tests import utils as test_utils
from tests.base import ApiTestCase
from tests.factories import ProjectFactory, AuthUserFactory, CommentFactory
class TestCommentReportsView(ApiTestCase):
... | {
"content_hash": "a29a6a7b155b0067998028f1bb1976d5",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 135,
"avg_line_length": 47.9906191369606,
"alnum_prop": 0.6255131162281559,
"repo_name": "brandonPurvis/osf.io",
"id": "de0e895588ae78237cbb403175740a0d47ed1f8c",
"size": ... |
import re
import tempfile
import codecs
import os
from warnings import warn
# Standard packages in Python 2/3 compatibility mode.
from .compatibility import StringIO
from .compatibility import defaultdict
from .compatibility import namedtuple
from .compatibility import force_unicode
from .compatibility import num_typ... | {
"content_hash": "b7c652483a75ab574044f757c8aaac68",
"timestamp": "",
"source": "github",
"line_count": 6478,
"max_line_length": 79,
"avg_line_length": 33.67057733868478,
"alnum_prop": 0.5219422514418801,
"repo_name": "jkyeung/XlsxWriter",
"id": "89c0f792ddc064249f158002361064d30677c81b",
"size": "... |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundEr... | {
"content_hash": "7475867bb91fe5615a19e9dc355503c4",
"timestamp": "",
"source": "github",
"line_count": 787,
"max_line_length": 206,
"avg_line_length": 47.326556543837356,
"alnum_prop": 0.6418675830961714,
"repo_name": "Azure/azure-sdk-for-python",
"id": "dccb98b1fcd4f136d27a771c8713ac4fbe465bb4",
... |
"""Unit tests to cover the common module."""
import unittest
import warnings
import fake_filesystem
import fake_tempfile
import mock
import suds
import yaml
import googleads.common
import googleads.errors
class CommonTest(unittest.TestCase):
"""Tests for the googleads.common module."""
# A dictionary with al... | {
"content_hash": "873f0f42e06ea364fcaf4715a5fff642",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 80,
"avg_line_length": 45.806338028169016,
"alnum_prop": 0.6151894842032439,
"repo_name": "richardfergie/googleads-python-lib",
"id": "06cc0393fe9aed50aa44eb10a21e0ca1447867... |
"""Provides the web interface for a set of alerts and their graphs."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
from google.appengine.ext import ndb
from dashboard import alerts
from dashboard import chart_handler
from dashboard import u... | {
"content_hash": "198a8c7e0541e015c4d5a6b51e4f6257",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 78,
"avg_line_length": 32.17972350230415,
"alnum_prop": 0.6932550479736503,
"repo_name": "endlessm/chromium-browser",
"id": "51b9365bc19d408ce1c3bb53e23f4649f39b65df",
"si... |
import json
import select
from systemd import journal
## JsonReader modifies the standard journal.Reader class
## so that the entries returned by the _Python_ journal.Reader
## can be (trivially) converted into JSON.
##
class JsonReader(journal.Reader):
def _convert_field(self, key, value):
if isinstanc... | {
"content_hash": "1ea51782723ea304c3e3631044a46bc2",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 69,
"avg_line_length": 23.7027027027027,
"alnum_prop": 0.6339794754846066,
"repo_name": "egustafson/sandbox",
"id": "a8ee4a3751296796fd7e549b257b966492b11d12",
"size": "109... |
"""
Several basic tests for hierarchical clustering procedures
"""
# Authors: Vincent Michel, 2010, Gael Varoquaux 2012,
# Matteo Visconti di Oleggio Castello 2014
# License: BSD 3 clause
import itertools
from tempfile import mkdtemp
import shutil
import pytest
from functools import partial
import numpy as n... | {
"content_hash": "2300c98d35eb69934e5558233ed7f5a9",
"timestamp": "",
"source": "github",
"line_count": 913,
"max_line_length": 88,
"avg_line_length": 35.96276013143483,
"alnum_prop": 0.6391240786989096,
"repo_name": "anntzer/scikit-learn",
"id": "b8a478d444873b8211d9e3c9d2a8283fae739321",
"size": ... |
'''Utilities for validation system.'''
# cpennello 2014-08-21 From cr.util.
def kooljoin(word, seq):
'''Comma-join sequence of strings, inserting word before the final
sequence element if there are more than two elements. Omit commas and
uses only the word to join the sequence elements if there are fewer
than... | {
"content_hash": "3fa61b98b8d49f0317fc4b517e419ad7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 31.733333333333334,
"alnum_prop": 0.6722689075630253,
"repo_name": "crunchyroll/pyvalid",
"id": "3bc7fbdbc49e5a91c29c847238acc0c1fe18b4ca",
"size": "... |
from quantum.tests.unit.linuxbridge import test_linuxbridge_plugin
from quantum.tests.unit.openvswitch import test_agent_scheduler
class LbAgentSchedulerTestCase(
test_agent_scheduler.OvsAgentSchedulerTestCase):
plugin_str = test_linuxbridge_plugin.PLUGIN_NAME
class LbL3AgentNotifierTestCase(
test_agent... | {
"content_hash": "82bdbfcfe105c426f9a619abfa80ce49",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 66,
"avg_line_length": 32.88235294117647,
"alnum_prop": 0.817531305903399,
"repo_name": "linvictor88/vse-lbaas-driver",
"id": "4506f60688276d9b5bd23ca64918ede70d5b55a6",
"s... |
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: f5bigip_sys_db
short_description: BIG-IP sys db module
description:
- Displays or modifies bigdb database entries.
version_added: "2.4"
author:
- "Eric Jacob (@erjac7... | {
"content_hash": "fff5ab0b4df012971286a6ba283da1b7",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 110,
"avg_line_length": 25.46153846153846,
"alnum_prop": 0.629154078549849,
"repo_name": "erjac77/ansible-module-f5bigip",
"id": "3ce22d43c2d2deb0afeb03b4fe119f80b1a622f8",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import h5py
import json
import os
import imageio
import sys
import cityscapesscripts.evaluation.instances2dict_with_polygons as cs
import detectron.util... | {
"content_hash": "51f7d0400d4ec25cbe8242ea11894b21",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 80,
"avg_line_length": 37.58910891089109,
"alnum_prop": 0.49861714737258,
"repo_name": "facebookresearch/Detectron",
"id": "3583eca1aef66f37dbc9621ff006cde5885233f2",
"siz... |
from itertools import chain
import xadmin
from django import forms
from django.db.models import ManyToManyField
from django.forms.utils import flatatt
from django.template import loader
from django.utils.encoding import force_text
from django.utils.html import escape, conditional_escape
from django.utils.safestring im... | {
"content_hash": "7a2473b044c3843ca018b5eca5119e32",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 119,
"avg_line_length": 39.03669724770642,
"alnum_prop": 0.6072855464159812,
"repo_name": "LennonChin/Django-Practices",
"id": "38e0c917da19e774344e5265b4132751658cb62c",
... |
import cherrypy
from girder.models.setting import Setting
from girder.settings import SettingKey
from pytest_girder.assertions import assertStatusOk
from pytest_girder.utils import getResponseBody
from girder.utility.webroot import WebrootBase
def testEscapeJavascript():
# Don't escape alphanumeric characters
... | {
"content_hash": "63548012fda91e381f0928b76eae2b2d",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 84,
"avg_line_length": 37.294117647058826,
"alnum_prop": 0.7233438485804417,
"repo_name": "jbeezley/girder",
"id": "3cd0af908b0a70a7bdd8a9017ed38bc5aad8761c",
"size": "3194... |
import logging
from django.conf import settings
from django_rq import job
from webhooks.senders.base import Senderable
from ..models import WebhookTarget
# For use with custom user models, this lets you define the owner field on a model
WEBHOOK_OWNER_FIELD = getattr(settings, "WEBHOOK_OWNER_FIELD", "username")
# L... | {
"content_hash": "2793c364630659956f3443222912753e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 108,
"avg_line_length": 31.96590909090909,
"alnum_prop": 0.6910771418414504,
"repo_name": "pydanny/dj-webhooks",
"id": "15823ee1a010ed0be306a3d5c9b893280dd4a6c7",
"size": "... |
'''
@author Fabio Zadrozny
'''
import sys
import os
try:
import __builtin__ #@UnusedImport
BUILTIN_MOD = '__builtin__'
except ImportError:
BUILTIN_MOD = 'builtins'
if sys.platform.find('java') == -1:
HAS_WX = False
import unittest
try:
import _pydev_imports_tipper
except:
... | {
"content_hash": "4e3c85d5377219c7d83cfe2ed4a20a6c",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 135,
"avg_line_length": 34.222727272727276,
"alnum_prop": 0.48638597423296587,
"repo_name": "liangazhou/django-rdp",
"id": "830cb49dfec15c0efa8cd1e537ad259ed04898f5",
"siz... |
import yaml
import json
import requests
import sys
import webbrowser
from fastscore.suite import Connect
from os.path import expanduser
from ..colors import tcol
from requests_oauthlib import OAuth2Session
from oauthlib.oauth2.rfc6749.clients import WebApplicationClient
from os import environ
if sys.version_info >= (... | {
"content_hash": "13476c330c12bbb59e39bdb3c367bbb8",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 233,
"avg_line_length": 41.33510638297872,
"alnum_prop": 0.6454767726161369,
"repo_name": "opendatagroup/fastscore-cli",
"id": "77921b8d7716274e660a79f467ca6a464581877d",
... |
import asyncio
import unittest
from unittest import mock
from aiohttp import CIMultiDict
from aiohttp.web import (
MsgType, Request, WebSocketResponse, HTTPMethodNotAllowed, HTTPBadRequest)
from aiohttp.protocol import RawRequestMessage, HttpVersion11
from aiohttp import errors, websocket
class TestWebWebSocket(u... | {
"content_hash": "5674d01bc60d46b06c793fc6565f334e",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 79,
"avg_line_length": 33.61576354679803,
"alnum_prop": 0.5914419695193435,
"repo_name": "noodle-learns-programming/aiohttp",
"id": "bc8a7fb11a06e45e5652fb1941fb59b73e133cc3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.