text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | {
"content_hash": "cd65f69583cdfcdd3f1c2a12cfc3e8fb",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 91,
"avg_line_length": 25.84,
"alnum_prop": 0.6814241486068111,
"repo_name": "evrom/django-example-for-class",
"id": "a25455e1b5a6ba168a7c882be4cdf83408aeed4b",
"size": "3... |
from nyawc.helpers.URLHelper import URLHelper
class Request(object):
"""The Request class contains details that were used to request the specified URL.
Attributes:
METHOD_OPTIONS (str): A request method that can be used to request the URL.
METHOD_GET (str): A request method that can be used to... | {
"content_hash": "06d3f54c33eb9cb46158f4f040f65094",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 136,
"avg_line_length": 44.45070422535211,
"alnum_prop": 0.641318124207858,
"repo_name": "tijme/not-your-average-web-crawler",
"id": "11e19fc4b89e3cc723e7002a230fc885b1edddf7... |
from flask import Flask, render_template
import socketio
# set this to 'threading', 'eventlet', or 'gevent'
async_mode = 'eventlet'
sio = socketio.Server(async_mode=async_mode)
app = Flask(__name__)
app.wsgi_app = socketio.Middleware(sio, app.wsgi_app)
@app.route('/')
def index():
return render_template('laten... | {
"content_hash": "aaabad439d23a27b8d113afca45d1abe",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 27.02173913043478,
"alnum_prop": 0.5969428801287209,
"repo_name": "bharling/python-socketio",
"id": "191a069b4510b6aff0112d171fc4d69cc4868acd",
"size... |
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericForeignKey
from django.db import models
from ._utils import *
from ..models import RelatedContent
from ..models import RelatedType
def generate_model():
one, two = generate_fake_articles(2)
t = R... | {
"content_hash": "cc4ed737bfc8839521da0b4c896807c4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 29.875,
"alnum_prop": 0.6673640167364017,
"repo_name": "texastribune/armstrong.apps.related_content",
"id": "f8268d71c54e8305f95c6b13a54b0e8b6d932f8c",... |
import logging
import os
import pysam
import subprocess
class AnnotationError(Exception):
pass
def ensureIndexed(bedPath, preset="bed", trySorting=True):
if not bedPath.endswith(".gz"):
if not os.path.exists(bedPath+".gz"):
logging.info("bgzf compressing {}".format(bedPath))
p... | {
"content_hash": "c5bbf300ec0568772bd870978bc64634",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 117,
"avg_line_length": 42.51020408163265,
"alnum_prop": 0.6341814690350456,
"repo_name": "gatoravi/svviz",
"id": "4b46f407929304802f7d622fa4d0e6e355d74c9f",
"size": "2083"... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
class ListSinceBlockTest (BitcoinTestFramework):
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 4
def run_test (self):
'''
... | {
"content_hash": "bc34ab464801dc082a10a60bc33bad49",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 84,
"avg_line_length": 31.493333333333332,
"alnum_prop": 0.5779000846740051,
"repo_name": "zcoinofficial/zcoin",
"id": "2ac15cbbba9265354ed207ca01ac462583feffce",
"size": "... |
from __future__ import annotations # isort:skip
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
import gc
import logging
import sys
# Bokeh import... | {
"content_hash": "3b4a041c40c80e652c1aee27bc100101",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 143,
"avg_line_length": 26.924242424242426,
"alnum_prop": 0.44682048396173324,
"repo_name": "bokeh/bokeh",
"id": "fa5b0898d128e5884097a9c02631453d763440c9",
"size": "4058"... |
import grpc
import demo_pb2
import demo_pb2_grpc
# from opencensus.trace.tracer import Tracer
# from opencensus.trace.exporters import stackdriver_exporter
# from opencensus.trace.ext.grpc import client_interceptor
# try:
# exporter = stackdriver_exporter.StackdriverExporter()
# tracer = Tracer(exporter=expo... | {
"content_hash": "c10b54f65ce4eaf4bd285182ef446897",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 107,
"avg_line_length": 33.5625,
"alnum_prop": 0.7243947858472998,
"repo_name": "census-ecosystem/opencensus-microservices-demo",
"id": "e4e591fa647ced1d228bd42e83fd564299c49... |
"""
Physics engines for top-down or platformers.
"""
# pylint: disable=too-many-arguments, too-many-locals, too-few-public-methods
from arcade.geometry import check_for_collision_with_list
from arcade.geometry import check_for_collision
from arcade.sprite import Sprite
from arcade.sprite import SpriteList
class Phys... | {
"content_hash": "dc93108477e7f9d15feed5cd8aa467c4",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 78,
"avg_line_length": 38.966981132075475,
"alnum_prop": 0.5068393656942258,
"repo_name": "mikemhenry/arcade",
"id": "3be8e4db43369f8ce9dc4d45e0eedc74b35a1058",
"size": "8... |
from __future__ import division
import time
import numpy as np
import AuxiliaryClass as AUX
np.set_printoptions(threshold = np.nan, linewidth=2000, suppress=True)
TimeModel=True #Activates timing the model
def Multi_Country(S,I,sigma):
#NOTE:To run the model, simply run the Multi_Country function with your cho... | {
"content_hash": "81330d034769871d4a37d9f2b7724cd4",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 119,
"avg_line_length": 42.079470198675494,
"alnum_prop": 0.6639911866540762,
"repo_name": "OpenSourcePolicyCenter/multi-country",
"id": "554976ca0560dc360f3b81d5e8c11481adb... |
"""
test_import_schema_config tests the nagios config formatter
copyright: 2015, (c) sproutsocial.com
author: Nicholas Flink <[email protected]>
"""
# This script requires the following packages to be installed:
# mock==1.0.1
# PyYAML==3.11
import import_schema_config
import logging
import os
import ... | {
"content_hash": "d1b31cfb4dab2556a45e064d2e0a8266",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 114,
"avg_line_length": 40,
"alnum_prop": 0.6068840579710145,
"repo_name": "sproutsocial/mysql_permissions",
"id": "bb59e46e55561debb79da36077aacdf162286473",
"size": "2806... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Group
from actstream.models import Action
from actstream.tests.base import LTE
class GFKManagerTestCase(TestCase):
def setUp(self):
... | {
"content_hash": "dc2fd0fc698ad454078d240516a23654",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 43.876288659793815,
"alnum_prop": 0.5946898496240601,
"repo_name": "justquick/django-activity-stream",
"id": "da8194fed946e1e3018bac91b6ca23ac3d6dbe55"... |
'''
Code for downloading and processing KITTI data (Geiger et al. 2013, http://www.cvlibs.net/datasets/kitti/)
Code borrowed from PredNet (Lotter et al. 2017, https://arxiv.org/abs/1605.08104)
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
imp... | {
"content_hash": "36d099cde3e83e78e801399b7456f6f9",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 140,
"avg_line_length": 38.540983606557376,
"alnum_prop": 0.5765631646108039,
"repo_name": "AutonomyLab/deep_intent",
"id": "43ce3fc22396f2527e841a14187797abf24a24ad",
"si... |
"""Some common multiprocessing tools for doing interpolation experiments.
These tools are specifically used to replace long running for-loops.
In particular, it executes a for-loop for a few iterations and stashes the
result into a file. In the case of `managed_multiprocessing_loop_to_numpy` data
is saved into a long ... | {
"content_hash": "7c5aa6d2ae2c719da0336416c041ebb4",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 80,
"avg_line_length": 34.903225806451616,
"alnum_prop": 0.7019408502772643,
"repo_name": "google-research/policy-learning-landscape",
"id": "1daad5a991ca4f20a450bf14b17456c... |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'portal.views.home', name='home'),
# url(r'^portal/', include('portal.foo.urls')),
# Un... | {
"content_hash": "e341fd0d5d8d15faeba3d9750a813239",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 32.705882352941174,
"alnum_prop": 0.6762589928057554,
"repo_name": "rajatguptarg/portal",
"id": "d91f67cee328d30e2da7480bd4f07e8e9f300edb",
"size": "... |
from wtforms import Form, StringField, TextAreaField, FloatField, SelectField
class ProjectForm(Form):
# The region where the project applies
region = SelectField('Region',
choices=[('', ''), ('Kosovo', 'Kosovo'), ('Montenegro', 'Montenegro'), ('Serbia', 'Serbia')])
# Name of the project.
nam... | {
"content_hash": "0aab0734e69450ebb3109dc80666733d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 101,
"avg_line_length": 30.82758620689655,
"alnum_prop": 0.616331096196868,
"repo_name": "opendatakosovo/relate-with-it",
"id": "84b70cb236fd81a86851147621b2e98e87fe84d0",
... |
import os
import sys
from . import compat
from .config.data import DJANGO_VERSION_MATRIX, CMS_VERSION_MATRIX, VERSION_MATRIX
def query_yes_no(question, default=None): # pragma: no cover
"""
Ask a yes/no question via `raw_input()` and return their answer.
:param question: A string that is presented to t... | {
"content_hash": "5fa81063c3664d0b21725dbe4f7c0e26",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 109,
"avg_line_length": 31.67676767676768,
"alnum_prop": 0.5956632653061225,
"repo_name": "divio/djangocms-installer",
"id": "1f23b7be51cdbf9df75ca960b19517cbb32c4061",
"si... |
from collections import defaultdict
import inspect
from django.contrib.contenttypes.models import ContentType
from django.db.models import Manager, Model
from django.db.models.query import QuerySet
class EntityConfig(object):
"""
Defines the configuration for a mirrored entity.
"""
# The "watching" c... | {
"content_hash": "f6f0608c2d1ba668bce0d711b3fa16dc",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 116,
"avg_line_length": 35.821917808219176,
"alnum_prop": 0.6552581261950287,
"repo_name": "wesleykendall/django-entity",
"id": "03ff3e7b80edb868ee3c3049355c4a613657a74f",
... |
"""
Simple dynamodb health check.
"""
def check_health(graph):
# TODO: Is there a basic service health check to perform here akin to 'SELECT 1;' ?
pass
| {
"content_hash": "601759e07c1364c7f12a2dbd9d8ed38e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 87,
"avg_line_length": 18.11111111111111,
"alnum_prop": 0.6687116564417178,
"repo_name": "globality-corp/microcosm-dynamodb",
"id": "29529b880d8b9c9ce60d34278094fcbc1dfb495d",... |
from pyresttest import resttest
from pyresttest.benchmarks import Benchmark
from pyresttest.binding import Context
from pyresttest.contenthandling import ContentHandler
from pyresttest.generators import factory_generate_ids
import cProfile
test = Benchmark()
test.warmup_runs = 0
test.benchmark_runs = 1000
test.raw_me... | {
"content_hash": "80f3cd2c31ff5e94df236348b5461bad",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 89,
"avg_line_length": 33.97142857142857,
"alnum_prop": 0.7325483599663583,
"repo_name": "netjunki/pyresttest",
"id": "dc2f3eb27e31bf772fcf0b77c522f0f571e9abe2",
"size": "1... |
import json
import os
import subprocess
import tempfile
import unittest
PLOVR_JAR = "plovr-81ed862.jar"
def find_docs_dir():
cwd = os.path.dirname(os.path.realpath(__file__))
prev_cwd = None
while cwd != prev_cwd:
if os.path.exists(os.path.join(cwd, "docs", PLOVR_JAR)):
return os.pat... | {
"content_hash": "588c237c60c534fb3be10e230b64393d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 86,
"avg_line_length": 28.927272727272726,
"alnum_prop": 0.6071653048397234,
"repo_name": "JoelMarcey/buck",
"id": "e421d786ad63ee61d154e33396db10dc3e5ee53e",
"size": "2212... |
from python_speech_features import mfcc
from python_speech_features import delta
from python_speech_features import logfbank
import scipy.io.wavfile as wav
import csv
import numpy as np
class SnoreClassifier:
def __init__(self):
self.KNN_THRESHOLD = 90
self.NUM_SNORES = 132 #135 a... | {
"content_hash": "4caea52f530c2dbacacdc155d01a467f",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 136,
"avg_line_length": 39.792,
"alnum_prop": 0.43546441495778043,
"repo_name": "atorresdi/IoTSeminar2017_SleepMonitoring",
"id": "858f6430aa3654c0e8434c194c2de454a0715e94",... |
"""The tests the cover command line platform."""
import os
import tempfile
from unittest import mock
import pytest
from homeassistant.components.cover import DOMAIN
import homeassistant.components.cover.command_line as cmd_rs
from homeassistant.const import (
ATTR_ENTITY_ID, SERVICE_CLOSE_COVER, SERVICE_OPEN_COVE... | {
"content_hash": "a6c5d55293ff7b0e9faba969998c5ad9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 33.946666666666665,
"alnum_prop": 0.5989787902592302,
"repo_name": "tinloaf/home-assistant",
"id": "0e03539d58c19621a0c9e0e08a4ba9aae2410bf1",
"size"... |
"""
Volume driver test for Tintri storage.
"""
import mock
from oslo_utils import units
from cinder import context
from cinder import exception
from cinder import test
from cinder.tests.unit import fake_snapshot
from cinder.tests.unit import fake_volume
from cinder.volume.drivers.tintri import TClient
from cinder.vo... | {
"content_hash": "e4debdaac7f1a8f216a376282a47b044",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 78,
"avg_line_length": 43.56,
"alnum_prop": 0.6205489235792266,
"repo_name": "JioCloud/cinder",
"id": "2921d3beff55bc9554b50ea313d76f25dafa6a4a",
"size": "10426",
"binar... |
from oslo_serialization import jsonutils
import requests
from cinder.tests.functional import functional_helpers
class TestHealthCheckMiddleware(functional_helpers._FunctionalTestBase):
def test_healthcheck(self):
# We verify that we return a HTTP200 when calling api_get
url = 'http://%s:%s/healt... | {
"content_hash": "f32d12eb60943d8ca468eee6faf05f47",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 77,
"avg_line_length": 34.88235294117647,
"alnum_prop": 0.6711635750421585,
"repo_name": "openstack/cinder",
"id": "7e7d2cb7c9ac22e5b2d91d657566aff8a8c08ee5",
"size": "1279... |
import logging
import xpybutil
from .base import Widget
from barython.hooks.xorg import WindowHook
logger = logging.getLogger("barython")
class ActiveWindowWidget(Widget):
"""
Requires python-mpd2
"""
#: list of atom names to catch
_atom_names = ("_NET_ACTIVE_WINDOW", "WM_NAME")
@property
... | {
"content_hash": "cc28382319d4e03782efd043c2fa59d8",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 29.30952380952381,
"alnum_prop": 0.6108854589764419,
"repo_name": "Anthony25/barython",
"id": "e01438edfa54f7d9a607d0f9cd4443a7027e329a",
"size": "12... |
import sys
import cStringIO
import py
from rpython.tool.udir import udir
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import CompilationError
from rpython.tool.gcc_cache import (
cache_file_path, build_executable_cache, try_compile_cache)
localudir = udir.join... | {
"content_hash": "1de6f0dd3bf12d027d573cf7bb2ea185",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 77,
"avg_line_length": 33.37894736842105,
"alnum_prop": 0.6285083569851782,
"repo_name": "jptomo/rpython-lang-scheme",
"id": "818352ac4f34c11f862027e2c89ad2dfec0d3968",
"si... |
"""
Модуль с преднастроенными панелями-гридами
"""
from __future__ import absolute_import
from itertools import chain
import json
from itertools import chain
from m3.actions.urls import get_url
from m3_ext.ui import containers
from m3_ext.ui import controls
from m3_ext.ui import menus
from m3_ext.ui import misc
from... | {
"content_hash": "685932b9c1a561043da5c25833dea4c2",
"timestamp": "",
"source": "github",
"line_count": 698,
"max_line_length": 94,
"avg_line_length": 34.86819484240688,
"alnum_prop": 0.555592078231572,
"repo_name": "barsgroup/m3-ext",
"id": "c5a623dac66c58af45602990b16b531bd122dfe3",
"size": "2730... |
from .iterable import iterable
from itertools import islice
from collections import deque
from strict_functions import strict_globals
@strict_globals(iterable=iterable, islice=islice, deque=deque)
def all_subslices(itr):
""" generates every possible slice that can be generated from an iterable """
assert iter... | {
"content_hash": "044019a3a7db52409c7600a377a551d2",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 104,
"avg_line_length": 32.416666666666664,
"alnum_prop": 0.6915167095115681,
"repo_name": "CodyKochmann/generators",
"id": "e8f1bc3e4eab201d0b93bee7d5bd3b5d2619209c",
"siz... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from threading import Lock
from redis import Redis
from .base import BaseBackend
lock = Lock()
class RedisBackend(BaseBackend):
def __init__(self, host='localhost', port=6379, db=0, *args, **kw):
... | {
"content_hash": "ef7d55ad2dcf0140f5b82db6c0f5d7a1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 27.79310344827586,
"alnum_prop": 0.5905707196029777,
"repo_name": "storborg/gimlet",
"id": "5f982ba8d3ae17a3169584dd1bf3373b35524791",
"size": "806",... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from weekly.models import Event, StdEvent
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
import datetime
from django.contrib.auth.models import User
def ... | {
"content_hash": "3f70b2475cd44b93b47b38ca6887fdaf",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 83,
"avg_line_length": 46.875,
"alnum_prop": 0.7586666666666667,
"repo_name": "lhirdman/planner",
"id": "712b812da0b5cb10dbd246aa79dbad106ca799a9",
"size": "750",
"binary... |
from AnkiHubLibs import webbrowser
import sys
sys.path.append("./AnkiHubLibs")
from AnkiHubLibs import AnkiHub
AnkiHubServer = AnkiHub.AnkiHubServer
configFileName = AnkiHub.configFileName
cookieFileName = AnkiHub.cookieFileName
from urllib2 import Request, urlopen, URLError, HTTPError
from pprint import pprint
import... | {
"content_hash": "3072373af3941e10be8fcc1837709fc3",
"timestamp": "",
"source": "github",
"line_count": 815,
"max_line_length": 481,
"avg_line_length": 34.20368098159509,
"alnum_prop": 0.6346678146075477,
"repo_name": "CSE-437/AnkiPlugin",
"id": "ff2621975cb941ab992dc26166ee03fb74ff40b6",
"size": "... |
from __future__ import print_function
import sys
from command import Command
from collections import defaultdict
from git_command import git
from progress import Progress
class Abandon(Command):
common = True
helpSummary = "Permanently abandon a development branch"
helpUsage = """
%prog [--all | <branchname>] [<... | {
"content_hash": "e54a88cbf9d825cb6dc291dfc0bbe8bd",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 29.42168674698795,
"alnum_prop": 0.583947583947584,
"repo_name": "dodocat/git-repo",
"id": "6f78da746e8e304d2928d98bd2923c58b732044c",
"size": "3045"... |
import unittest
import mock
from ._testing import _make_credentials
class TestRow(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.bigtable.row import Row
return Row
def _make_one(self, *args, **kwargs):
return self._get_target_class()(*args, **kwarg... | {
"content_hash": "3762aedba3ba7a8190bc6902628d0c2c",
"timestamp": "",
"source": "github",
"line_count": 814,
"max_line_length": 88,
"avg_line_length": 33.22727272727273,
"alnum_prop": 0.5925980700262506,
"repo_name": "dhermes/gcloud-python",
"id": "b4aaefb862f83318ebe151927468706fe6863c77",
"size":... |
"""Blink IDL Intermediate Representation (IR) classes.
Classes are primarily constructors, which build an IdlDefinitions object
(and various contained objects) from an AST (produced by blink_idl_parser).
IR stores typedefs and they are resolved by the code generator.
Typedef resolution uses some auxiliary classes an... | {
"content_hash": "06993623da8561c8afe561ae216a90ca",
"timestamp": "",
"source": "github",
"line_count": 994,
"max_line_length": 158,
"avg_line_length": 40.23541247484909,
"alnum_prop": 0.5843376506475971,
"repo_name": "CTSRD-SOAAP/chromium-42.0.2311.135",
"id": "693e1114beb288fa294f4ab36ca6aef9f97bf2... |
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import sys
from functools import partial
import tests.modules.vim as vim_module
from tests.modules.lib import Pl
from tests.modules import TestCase
class TestVim(TestCase):
def test_single_tab(self):
pl = Pl()
sing... | {
"content_hash": "6342512177f84b3a429e0af2b0a7bc82",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 111,
"avg_line_length": 24.02857142857143,
"alnum_prop": 0.7217598097502973,
"repo_name": "codeprimate/arid",
"id": "74ace8d78e8e7b4b6c4829b0042e9e96a03a9f05",
"size": "871... |
"""
Converts lcov line coverage output to Cobertura-compatible XML for CI
"""
import re
import sys
import os
import time
import subprocess
from xml.dom import minidom
from optparse import OptionParser
from distutils.spawn import find_executable
CPPFILT = "c++filt"
HAVE_CPPFILT = False
if find_executable(CPPFILT) is... | {
"content_hash": "9b2bcfc058a1e17f3ba68aaa837a2aa3",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 111,
"avg_line_length": 41.94074074074074,
"alnum_prop": 0.5177793476981043,
"repo_name": "DavidAntliff/AwaLWM2M",
"id": "75949f29d6670b76faeadb705480219976236a54",
"size"... |
import sys
import time
import pstats
import cProfile
import timeit
sys.path.insert(0, '.')
import vcfnp
def profile():
a = vcfnp.info(sys.argv[1], count=int(sys.argv[2]))
prof_fn = 'profile/tmp.prof'
cmd = 'profile()'
cProfile.runctx(cmd, globals(), locals(), prof_fn)
s = pstats.Stats(prof_fn)
s.strip_dirs().... | {
"content_hash": "86db0c1de3090687b0ae3dbfbfa8ea35",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 112,
"avg_line_length": 20.347826086956523,
"alnum_prop": 0.6901709401709402,
"repo_name": "kyleabeauchamp/vcfnp",
"id": "395cf7e843f2a52f233c296022dc5a2c1cb889ba",
"size":... |
import numpy as np
import pandas as pd
from bokeh import mpl
from bokeh.plotting import output_file, show
ts = pd.Series(np.random.randn(1000),
index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
p = ts.plot()
output_file("series.html")
show(mpl.to_bokeh())
| {
"content_hash": "670b9833088e52bdbebfc6f7a1c6ccdf",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 19.333333333333332,
"alnum_prop": 0.6793103448275862,
"repo_name": "carlvlewis/bokeh",
"id": "f918f9b91e330fb735e335ed2832c8e12d52b501",
"size": "290... |
import logging
import os
SRC_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
# ============================================================================
# a flask settings
# http://flask.pocoo.org/docs/config/#configuring-from-files
# ============================================================... | {
"content_hash": "8b576284e9e3e46edd6f89b1b9a24219",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 78,
"avg_line_length": 30.363636363636363,
"alnum_prop": 0.6613023952095808,
"repo_name": "maxtortime/flask-social-blueprint",
"id": "325eadf9a3885360c6a92e9d455cd4965c063a35... |
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('all')
desktop_file_location = "/root/.local/share/applications/rubymine-2017.2.desktop"
def test_desktop_file_exists(File):
f = File(desktop_file_location)
as... | {
"content_hash": "939be51e2461645c7583728b0279d41c",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 81,
"avg_line_length": 24.91176470588235,
"alnum_prop": 0.7213695395513577,
"repo_name": "henriklynggaard/ansible-role-rubymine",
"id": "30bef98e146f9b5e6f26055a28f420b6d6fc7... |
from os.path import realpath
from mininet.util import errFail, errRun
from mininet.log import debug, info
import sys
# Utility functions for unmounting a tree
# Real path of OSHI's dir
MNRUNDIR = realpath( '/var/run/mn' )
# Take the mounted points of the root machine
def mountPoints():
"Return list of mounted fi... | {
"content_hash": "229888691f39259b46c3edf0224ed2cc",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 64,
"avg_line_length": 30.209302325581394,
"alnum_prop": 0.6096997690531177,
"repo_name": "netgroup/Dreamer-Management-Scripts",
"id": "3fb44af00165c64369f408a8396f9b8ab8c5e7... |
"""Support for Jewish Calendar binary sensors."""
from __future__ import annotations
import datetime as dt
from datetime import datetime
from typing import cast
import hdate
from hdate.zmanim import Zmanim
from homeassistant.components.binary_sensor import (
BinarySensorEntity,
BinarySensorEntityDescription,... | {
"content_hash": "105651048ff05bb350e45ed5a99d2c86",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 87,
"avg_line_length": 33.91346153846154,
"alnum_prop": 0.652112276722427,
"repo_name": "jawilson/home-assistant",
"id": "f239dfc31b68f60afd34a7a071a42b996e59635f",
"size"... |
import dataclasses
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Iterable, List, Mapping, Optional, Tuple
from pants.backend.python.subsystems.python_native_code import PythonNativeCode
from pants.backend.python.util_rules import pex_environment
from pants.backend.python.util_... | {
"content_hash": "46420f4b401008110f42ea383983608c",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 100,
"avg_line_length": 37.2962962962963,
"alnum_prop": 0.6725776705915733,
"repo_name": "jsirois/pants",
"id": "e5111c2087244c46964137736169c1c04e1e213c",
"size": "7181",... |
from usage.domain_cache import get_domain_name
from usage.log import logging
logger = logging.getLogger('usage.licensing.common')
INDENTSIZE = 4
MAXLINESIZE = 79
FILL = {0: ' ', 1: ' '}
class Licenser(object):
"""Base licenser class with common functionality."""
def __init__(self, project_id_field='Projec... | {
"content_hash": "9cbc7744735b822cc430a1e9c411fe0f",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 76,
"avg_line_length": 28.818930041152264,
"alnum_prop": 0.5447665286305869,
"repo_name": "absalon-james/usage",
"id": "bfcced1d3e52c62a05251ff7fc721ff305213c6e",
"size": ... |
from ingenico.connect.sdk.data_object import DataObject
class CaptureStatusOutput(DataObject):
__status_code = None
@property
def status_code(self):
"""
| Numeric status code of the legacy API. It is returned to ease the migration from the legacy APIs to Worldline Connect. You should not... | {
"content_hash": "c9916a3df39a08dab17f2f2d42dc6b33",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 359,
"avg_line_length": 37.25806451612903,
"alnum_prop": 0.677056277056277,
"repo_name": "Ingenico-ePayments/connect-sdk-python3",
"id": "43b29fe99b5483d7f341b0912cdc2aa7b978... |
import uuid
from mistralclient.api import client as mistral
from oslo_config import cfg
import retrying
from st2common.query.base import Querier
from st2common.constants import action as action_constants
from st2common import log as logging
from st2common.services import action as action_service
from st2common.util i... | {
"content_hash": "c164b239619d37dafc2cb5533b3215b5",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 96,
"avg_line_length": 39.5253164556962,
"alnum_prop": 0.6302642113690953,
"repo_name": "peak6/st2",
"id": "5b97d3d5d3b021db3416565365f254c9aef1e5d7",
"size": "6245",
"b... |
import errno
import json
import os
import random
import re
import shutil
import string
import socket
import platform
import subprocess
import time
import uuid
import os.path
from googleapiclient.errors import HttpError
from subprocess import Popen, PIPE
from urllib.parse import quote_plus
import requests
from google... | {
"content_hash": "04dbfee45d4e62d5275ac0b587e6d21c",
"timestamp": "",
"source": "github",
"line_count": 980,
"max_line_length": 100,
"avg_line_length": 43.67755102040816,
"alnum_prop": 0.6038454350060742,
"repo_name": "r39132/airflow",
"id": "2f2217482cc24e4dd24371fd7bb7c84c686c3e50",
"size": "4361... |
import sys
def dec_to_bin(input_string):
return bin(int(input_string))[2:]
if __name__ == '__main__':
inputfile = sys.argv[1]
with open(inputfile, 'r') as f:
for line in f:
if line:
print dec_to_bin(line.strip())
| {
"content_hash": "f68e87744ef9422a579a925f665bcec6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 46,
"avg_line_length": 20.384615384615383,
"alnum_prop": 0.5320754716981132,
"repo_name": "MikeDelaney/CodeEval",
"id": "433991fa626346491813f3e3d66ea58bface9141",
"size": ... |
import sys
import aetros
if __name__ == '__main__':
sys.exit(aetros.main()) | {
"content_hash": "b03cd9ebc3d588efeb6c44d58196e937",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 27,
"avg_line_length": 16,
"alnum_prop": 0.6,
"repo_name": "aetros/aetros-cli",
"id": "6eeffea1df8739182f48402d1f66997b5524c492",
"size": "80",
"binary": false,
"copies"... |
from optparse import OptionParser
import os
import networkx as nx
import sys
'''
Author:Oana Ursu
'''
def main():
parser=OptionParser()
parser.add_option('--input',dest='input',help='Input')
parser.add_option('--input_type',dest='input_type',help='Input type. Can be phen or DE')
parser.add_option('--PP... | {
"content_hash": "b09717bcd543688ee873f0c926def91a",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 249,
"avg_line_length": 38.61594202898551,
"alnum_prop": 0.5586413961343591,
"repo_name": "oursu/Gem_code",
"id": "74129053b7297d5d35d59cc4d181d9fd71b127f1",
"size": "5329... |
"""Functionality related with filters in a PyTables file."""
from __future__ import absolute_import
# Imports
# =======
import warnings
import numpy
from . import utilsextension, blosc_compressor_list, blosc_compcode_to_compname
from .exceptions import FiltersWarning
import six
# Public variables
# ================... | {
"content_hash": "634ebba92a9461d39da52fc9b07ab92d",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 111,
"avg_line_length": 35.66921119592875,
"alnum_prop": 0.5840348123840776,
"repo_name": "jennolsen84/PyTables",
"id": "6530fbd24a25a096084e0087629134c44323917c",
"size":... |
import MySQLdb as mdb
import sqlite3
import psycopg2
from MonQL.Inspect._utils import *
import traceback
class _SqlBase(db_comm):
_con=None
def __init__(self, con_sets):
self._con_sets = con_sets
self._setup_types()
self._con_cur()
self.db_name = con_sets.get('dbname', None... | {
"content_hash": "c942a7bf22162c03031df5d0237d4cd5",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 101,
"avg_line_length": 31.301435406698566,
"alnum_prop": 0.530265973708346,
"repo_name": "samuelcolvin/MonQL",
"id": "6083dde5a1c55b48b4025b8071c431f5e0ad9718",
"size": "... |
import argparse
import atexit
import copy
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import warnings
try:
import django
except ImportError as e:
raise RuntimeError(
'Django module not found, reference tests/README.rst for instructions.'
) from e
else:
fro... | {
"content_hash": "556adb36755f70e2cb3f6e73101bd1b5",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 113,
"avg_line_length": 38.068062827225134,
"alnum_prop": 0.6413148122679136,
"repo_name": "simonw/django",
"id": "1282538a6d04370584b896a62af99939fe6bc931",
"size": "2183... |
from __future__ import print_function, division
import logging
import sys
import numpy as np
import sklearn.linear_model
from .yatsm import YATSM
from ..accel import try_jit
from ..errors import TSLengthException
from ..masking import smooth_mask, multitemp_mask
from ..regression.diagnostics import rmse
# Setup
lo... | {
"content_hash": "8083ba7a20f75f47babf97267b735cd6",
"timestamp": "",
"source": "github",
"line_count": 587,
"max_line_length": 79,
"avg_line_length": 38.051107325383306,
"alnum_prop": 0.5544412607449857,
"repo_name": "ceholden/yatsm",
"id": "8d328f98380473a9f58c6253f0d543d548194102",
"size": "2233... |
"""
Push/pop stack of buffer names. The top buffer of the stack is the one that
currently has the focus.
Note that the stack can contain `None` values. This means that none of the
buffers has the focus.
"""
from __future__ import unicode_literals
from six import string_types
from prompt_toolkit.enums import DEFAULT_B... | {
"content_hash": "5c32e86d1680b731162061b607c879de",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 75,
"avg_line_length": 25.55,
"alnum_prop": 0.6086105675146771,
"repo_name": "niklasf/python-prompt-toolkit",
"id": "1bb167d03964e3d854d661e6ae16dfc20e9a20c0",
"size": "153... |
"""
`RumCore`.
Licensed under MIT
Copyright (c) 2013 - 2015 Isaac Muse <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the ... | {
"content_hash": "b654c56e4923bafabf6f9773ece914f7",
"timestamp": "",
"source": "github",
"line_count": 1602,
"max_line_length": 119,
"avg_line_length": 35.51622971285892,
"alnum_prop": 0.5140165562331933,
"repo_name": "facelessuser/Rummage",
"id": "23bd1389c2464f437f7dad473bd2aa1eb04835a4",
"size"... |
"""
tables
~~~~~~~~~~~~~~
Process Tables (add default 'left' alignment and inline styles)
"""
from flask.ext.markdown import Extension
from markdown.extensions.tables import TableProcessor, etree
class BSTableProcessor(TableProcessor):
""" Process Tables in a Bootstrap compatible way """
def _build_row(self, r... | {
"content_hash": "80eb3d8450e93ec32d05731d78fc478e",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 64,
"avg_line_length": 27.94736842105263,
"alnum_prop": 0.6704331450094162,
"repo_name": "kazeeki/proposer",
"id": "9a97bc1e6078b478d59cdd1e90b7a579c4c393b9",
"size": "1086... |
from django.utils.translation import ugettext as _
from django.utils.text import truncate_words
from django.utils import simplejson
from django.db import models
from django import forms
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.core.urlresolvers import reverse
from django.utils.safestri... | {
"content_hash": "bd0c833a63fb696d59b022feb1fc79e1",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 186,
"avg_line_length": 42.774193548387096,
"alnum_prop": 0.6167043740573153,
"repo_name": "ionelmc/django-filer",
"id": "dc7c9cc40369b269c4499484ca3227f97ab65f3a",
"size"... |
import numpy as np
from galry import *
from galry.galryplot import GalryPlot
"""
%load_ext ipynbgalry
from IPython.display import display
from galry.galryplot import GalryPlot
a = GalryPlot()
display(a)
"""
# Python handler
def get_json(plot=None):
"""This function takes the displayed object and returns a JSON st... | {
"content_hash": "bf9844eae42762f6b5c06ca0d1e306a7",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 80,
"avg_line_length": 28.44736842105263,
"alnum_prop": 0.6845513413506013,
"repo_name": "rossant/galry",
"id": "8d2042ad536ba633d6a0acd436325e9bbe25ddfc",
"size": "1081",
... |
import json
import unittest
from ddt import ddt, data, unpack
from django.test import TestCase, Client
from django.test.utils import override_settings
from django.urls import reverse
from django.contrib.auth.models import User
from django.utils import timezone
from django.http.response import HttpResponseNotFound
from... | {
"content_hash": "75cf69286e962db3253b816c725729e9",
"timestamp": "",
"source": "github",
"line_count": 2203,
"max_line_length": 190,
"avg_line_length": 36.021788470267815,
"alnum_prop": 0.5690685014365643,
"repo_name": "cjlee112/socraticqs2",
"id": "32f4130022e2e3c50e5e55d5a859fe6095a298a1",
"size... |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
ext_modules = [Extension("explicit_cython2", ["explicit_cython2.pyx"])]
setup(
name = 'Explicit method using Cython',
cmdclass = {'build_ext': build_ext},
include_dirs = [np.get_i... | {
"content_hash": "3ccc2bfd116573c858441005135ce4a2",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 22.37037037037037,
"alnum_prop": 0.6754966887417219,
"repo_name": "pewen/transferencia_calor",
"id": "4eed74da5b8b5f5471cbef55a180af1e328e1f9d",
"siz... |
from __future__ import absolute_import
import sys
from nose import SkipTest
from billiard.compat import _winapi
from .utils import Case
WIN32_CONSTANTS = {
'ERROR_ALREADY_EXISTS',
'ERROR_PIPE_BUSY',
'ERROR_PIPE_CONNECTED',
'ERROR_SEM_TIMEOUT',
'ERROR_MORE_DATA',
'ERROR_BROKEN_PIPE',
'ER... | {
"content_hash": "395001d8eb4706021024acb0c6c3b376",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 57,
"avg_line_length": 22.40506329113924,
"alnum_prop": 0.6293785310734463,
"repo_name": "jakirkham/billiard",
"id": "aad9bc6b35e750a4286953d170d8ab8c9f19a993",
"size": "17... |
from south.db import db
from django.db import models
from ietf.ietfworkflows.models import *
class Migration:
def forwards(self, orm):
# Adding model 'StreamedID'
db.create_table('ietfworkflows_streamedid', (
('id', orm['ietfworkflows.streamedid:id']),
('draft'... | {
"content_hash": "e17c5b7dc8230f8979475be25281cb4e",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 209,
"avg_line_length": 79.4375,
"alnum_prop": 0.5581916116927919,
"repo_name": "mcr/ietfdb",
"id": "1e3de388c4f8d5047e6fbfadf11d5e8920a26781",
"size": "16524",
"binary"... |
from django.conf import settings
import logging
from config_uplus import *
from xpay_context import Context
logger = logging.getLogger(__name__)
class XPayClient(object):
def __init__(self, is_test=True):
"""Initialize xpay client.
Args:
home_dir: (string) Path... | {
"content_hash": "3e6f22e17127dcb0fc5943cb54ea1a1f",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 119,
"avg_line_length": 34.45454545454545,
"alnum_prop": 0.5482037751167039,
"repo_name": "MyMusicTaste/django-oscar-uplus",
"id": "c71c09de60b3bf93b1fee185b714890144df4a99"... |
"""
ERP+
"""
__author__ = 'CVTek dev'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "CVTek dev"
__status__ = "Development"
__model_name__ = 'gap_opiniao.GAPOpiniao'
import auth, base_models
from orm import *
from form import *
try:
from my_gap_senha import GAPSenha
except:
from gap_senha import GAPSenha... | {
"content_hash": "0fc1c79b17f6f9f97a6bc7719ad884a6",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 324,
"avg_line_length": 42.94814814814815,
"alnum_prop": 0.5660572611245257,
"repo_name": "IdeaSolutionsOnline/ERP4R",
"id": "795064cafbb90517119789c162454bb23529d561",
"s... |
"""
sy.exception
------------
:synopsis: Exceptions used by the library
.. moduleauthor: Paul Diaconescu <[email protected]>
"""
class Error(Exception):
''' Base exception for the sy '''
def __init__(self, msg):
self.msg = msg
Exception.__init__(self)
def __unicode__(self):
return ... | {
"content_hash": "ed558bf3d91f9f02ecdf758f7661681d",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 63,
"avg_line_length": 17.92,
"alnum_prop": 0.5290178571428571,
"repo_name": "afajl/sy",
"id": "8a5b5fef3f94e96a231bf298aefb143e8bd67ed3",
"size": "448",
"binary": false,... |
"""
Database models.
"""
from django.db import models
class FlagonParams(models.Model):
"""
Parameters for a feature.
"""
key = models.CharField(max_length=255)
value = models.TextField()
type = models.CharField(
max_length=30,
choices=(('bool', 'bool'), ('int', 'int'), ('str',... | {
"content_hash": "037869e7c52967e1272c9fcce638d348",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 71,
"avg_line_length": 23.8,
"alnum_prop": 0.5978391356542617,
"repo_name": "pombredanne/flagon",
"id": "ab4ba651e85039388b645316d89ec170cdbd02f8",
"size": "1950",
"binar... |
"""
FormPost Middleware
Translates a browser form post into a regular Swift object PUT.
The format of the form is::
<form action="<swift-url>" method="POST"
enctype="multipart/form-data">
<input type="hidden" name="redirect" value="<redirect-url>" />
<input type="hidden" name="max_file_size... | {
"content_hash": "9a12036d66d572e5d0f04280807f7c2a",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 79,
"avg_line_length": 37.190677966101696,
"alnum_prop": 0.5804944741939159,
"repo_name": "JioCloud/swift",
"id": "a76fcde4116c9543459d1a7ac5cc7462ef640b43",
"size": "1814... |
import pickle as pkl
from mxnet.ndarray import NDArray
import mxnet as mx
from mxnet.test_utils import *
from common import random_seed
from mxnet.base import mx_real_t
from numpy.testing import assert_allclose
import numpy.random as rnd
import numpy as np
import scipy.sparse as spsp
from common import assertRaises, ... | {
"content_hash": "f0d0d98f9a5166525e59ff29b9c8e674",
"timestamp": "",
"source": "github",
"line_count": 1024,
"max_line_length": 119,
"avg_line_length": 39.572265625,
"alnum_prop": 0.587508020334633,
"repo_name": "tlby/mxnet",
"id": "6a338ec3b1b9adc3a60663b74dd17aafbdeba676",
"size": "41308",
"bi... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
float_or_none,
get_element_by_class,
get_element_by_id,
unified_strdate,
)
class FreesoundIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?freesound\.org/people/[^/]+/sounds/(?P<id>[^/]+... | {
"content_hash": "6282bda2c2cbd83e400a6b5ca945ce8d",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 87,
"avg_line_length": 31.59493670886076,
"alnum_prop": 0.5384615384615384,
"repo_name": "aboutsajjad/Bridge",
"id": "138b6bc58cf9aa282c8afc3b6498ba84884197fc",
"size": "24... |
'''
Author: Bu Kun
E-mail: [email protected]
CopyRight: http://www.yunsuan.org
'''
import time
import tornado.escape
import config
import peewee
import datetime
# from torlite.model.core_tab import CabWiki2Catalog
from torlite.core import tools
from torlite.model.core_tab import CabWiki
class MWiki():
def __init_... | {
"content_hash": "423ee49e160770908085cea332526bd8",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 117,
"avg_line_length": 31.904191616766468,
"alnum_prop": 0.5762012012012012,
"repo_name": "Geoion/TorCMS",
"id": "cfd7e6d454a7088756a6b92ef4b019e83dfb2a85",
"size": "5351... |
"""blackjack project. test"""
import blackjack
card = blackjack.Card()
assert card.value == 1
deck = blackjack.Deck()
assert len(deck.cards) == 52
cstack = blackjack.CardStack(2)
assert len(cstack.stack) == 104
cstack.draw()
assert len(cstack.stack) == 103
hand = blackjack.Hand()
hand.update_cards(card)
assert ha... | {
"content_hash": "a677b41301004b9bdd2c94ea348450c0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 59,
"avg_line_length": 22.04,
"alnum_prop": 0.7150635208711433,
"repo_name": "ayine17/Final-project",
"id": "d7500b5a28bd23a381e6e70fccea3e003af6301f",
"size": "597",
"bi... |
from __future__ import print_function
from distutils.sysconfig import get_python_lib
import json
import socket
import os
import gzip
import shutil
from urllib import urlopen
from contextlib import closing
import subprocess
from progressbar import ProgressBar, ETA, Percentage, RotatingMarker, Bar
import re
from datetime... | {
"content_hash": "601abc7557adf902b32cdc56a5c03070",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 85,
"avg_line_length": 29.53012048192771,
"alnum_prop": 0.6034271725826194,
"repo_name": "ecolell/uniprotkbserver",
"id": "b8ed978b0288e2b8aa43a491cd776447153159aa",
"size... |
import math
days = 60
daily_rets = 0.001
daily_rf = 0.0002
std_daily = 0.001
k = math.sqrt(252)
def sharpe_daily(daily_rets, daily_rf, std_daily):
"""
Sharpe ration: square root of 252 days (frequency of sampling)
multiplied by mean of daily returns minus daily risk free returns
divided by std deviat... | {
"content_hash": "8f36204d18c5e8fa33ccb571a724f8b7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 73,
"avg_line_length": 28.041666666666668,
"alnum_prop": 0.6775631500742942,
"repo_name": "dmytroKarataiev/MachineLearning",
"id": "6e0dbdd0db9141ee6b82b88d820d71e57af14d5d",... |
from platform import python_version
from setuptools import setup
def readme():
with open('README.md') as readme_file:
return readme_file.read()
setup(
name='comment_parser',
version='1.2.4',
description='Parse comments from various source files.',
classifiers=[
'Development Status :: 5... | {
"content_hash": "b727c1b5df654081142dd42a3dd57e18",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 60,
"avg_line_length": 30.4375,
"alnum_prop": 0.6560574948665298,
"repo_name": "jeanralphaviles/comment_parser",
"id": "cee137dedf328b4c12513099b93b4378d8baf754",
"size": "... |
"""py.test for modeleditor"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from itertools import product
import os
import warnings
import pytest
from six import StringIO
from six import string_types
from eppy imp... | {
"content_hash": "de5c49b94fe33b96bae7c88a92abff83",
"timestamp": "",
"source": "github",
"line_count": 617,
"max_line_length": 112,
"avg_line_length": 34.43760129659643,
"alnum_prop": 0.5908791415662651,
"repo_name": "jamiebull1/eppy",
"id": "d39098807cc2335f7bb0a5807bff1b516e7a6367",
"size": "215... |
target = 17
data = list(range(100))
def binary_search(target, data):
index = int(len(data)/2)
print(target, index, data)
if target == data[index]:
last = "hello {0}".format(target)
return last
elif target > data[index]:
binary_search(target, data[index + 1:])
elif target < d... | {
"content_hash": "b88a535f3a150bdc05b576992b1a7f67",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 47,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.5956989247311828,
"repo_name": "SELO77/seloPython",
"id": "4e4a7cea8571da895a06d14b243728cad5b52a81",
"size": "46... |
'''BrightSign UDP Node'''
### Libraries required by this Node
import socket
### Parameters used by this Node
param_ipAddress = Parameter('{"title":"IP Address","desc":"The IP address","schema":{"type":"string"}}')
PORT = 1010
### Functions used by this Node
def send_udp_string(msg):
#open socket
sock = socke... | {
"content_hash": "cbf3db22859972ec0eea198308a644d2",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 108,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.6519893899204244,
"repo_name": "museumsvictoria/nodel-recipes",
"id": "f3fe97c308edaa4564f03295565d0f8e55b93d93",
... |
from .common import *
class Application(QApplication):
def __init__(self, **kwargs):
super(Application, self).__init__(sys.argv)
self.setStyleSheet(app_skin)
self.app_state_path = kwargs.get(
"app_state_path",
os.path.join(app_dir, "{}.appstate".forma... | {
"content_hash": "9ff5c83f50711a79a3ff19de6165df11",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 85,
"avg_line_length": 35.583333333333336,
"alnum_prop": 0.5456674473067916,
"repo_name": "martastain/pyqt-bootstrap",
"id": "b7c6b021c60fce737397426a9f528608f794f92b",
"si... |
import sys, json, numpy as np # must ensure that whatever this script relies on is installed on all cluster machines that could run this
def main():
lines = ''
for ln in sys.stdin.readlines(): lines += ln
inp = json.loads(lines)
arr = np.array(inp)
res = np.sum(arr)
print res
if __name__ == '_... | {
"content_hash": "0443ea2ef300707f1fde11affd6620f6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 136,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6323529411764706,
"repo_name": "leviathanindustries/noddy",
"id": "d87dd7bcfdf2c525f55f579b21a69fe7cab9022b",
"s... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_ith_shirt_formal_02.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resul... | {
"content_hash": "92e1d0d4283931b2538a1fe3c708e50c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 92,
"avg_line_length": 24.692307692307693,
"alnum_prop": 0.7009345794392523,
"repo_name": "anhstudios/swganh",
"id": "30c1f09c119b790ce0c55ef337a212172e11d6fe",
"size": "46... |
"""Everything in this module is taken from the excellent trio project.
Having the public path in .__module__ attributes is important for:
- exception names in printed tracebacks
- ~sphinx :show-inheritance:~
- deprecation warnings
- pickle
- probably other stuff
"""
import os
def fixup_module_metadata(namespace):
... | {
"content_hash": "39296a5a046d2b6bc856bb1efd3ef11d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 38.422222222222224,
"alnum_prop": 0.6182764603817236,
"repo_name": "carpedm20/fbchat",
"id": "f3e16189e425945ef907a62239c94ab487930e11",
"size": "172... |
from email.utils import formataddr
from email_from_template import send_mail
from django import forms
from django.conf import settings
class ContactForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()
subject = forms.CharField()
message = forms.CharField()
def save(self):
... | {
"content_hash": "315d6b6197f1fc2615edef29dbf639c7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 43,
"avg_line_length": 25.083333333333332,
"alnum_prop": 0.6013289036544851,
"repo_name": "takeyourmeds/takeyourmeds-web",
"id": "7afefd734cc2ed494eb6c6e52e7340ef23212656",
... |
import sys
import time
import unittest
import pyev
from whizzer.defer import Deferred, CancelledError, AlreadyCalledError, TimeoutError
from common import loop
def throw_always(result):
raise Exception("success")
def one_always(result):
return 1
def add(a, b):
return a+b
class TestDeferred(unittest.T... | {
"content_hash": "8cdeb2f7f1a884b765346e1fe8da85ef",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 100,
"avg_line_length": 33.827586206896555,
"alnum_prop": 0.6579001019367992,
"repo_name": "bfrog/whizzer",
"id": "cb9b02365ab11bbf99489ad4f70a5754993aafb2",
"size": "6047... |
import doctest
import unittest
import pytest
from babel import core, Locale
from babel.core import default_locale, Locale
def test_locale_provides_access_to_cldr_locale_data():
locale = Locale('en', 'US')
assert u'English (United States)' == locale.display_name
assert u'.' == locale.number_symbols['decim... | {
"content_hash": "82d40f195ad099cfd03cb337d2f69849",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 79,
"avg_line_length": 37.2203947368421,
"alnum_prop": 0.5818824569155988,
"repo_name": "srisankethu/babel",
"id": "54cf37dde5352361a806e07396ef561e4f4a412a",
"size": "118... |
import logging
import sys
import os
from textwrap import dedent
import requests
from tambo import Transport
import chacractl
from chacractl.util import retry
logger = logging.getLogger(__name__)
class Project(object):
_help = dedent("""
Handle projects on a remote chacra instance.
Creating a new proje... | {
"content_hash": "5e1bcbd32f1574d197d98899d6d33b7e",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 77,
"avg_line_length": 31.80952380952381,
"alnum_prop": 0.5739520958083832,
"repo_name": "ceph/chacractl",
"id": "4bc134b7b26d45d1ad6ac9f7b3fe53706f3969fc",
"size": "3340"... |
from re import compile
import pytest
from nerodia.elements.html_elements import HTMLElement
from nerodia.locators.text_area.selector_builder import SelectorBuilder
ATTRIBUTES = HTMLElement.ATTRIBUTES
@pytest.fixture
def builder(browser_mock):
yield SelectorBuilder(ATTRIBUTES, browser_mock)
class TestBuild(ob... | {
"content_hash": "d07cca179996b387a21b5f0804f36515",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 89,
"avg_line_length": 33.275862068965516,
"alnum_prop": 0.633160621761658,
"repo_name": "lmtierney/watir-snake",
"id": "fd5f4d5bc5c3cfb8970c08471d87b6b5063e686e",
"size": ... |
import time
from mod_pywebsocket import stream
from mod_pywebsocket.handshake.hybi import compute_accept
def web_socket_do_extra_handshake(request):
# This simulates a broken server that sends a WebSocket frame before the
# handshake, and more frames afterwards. It is important that if this
# happens the... | {
"content_hash": "a04d658ed8f328729b3453a86f9b74f0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 102,
"avg_line_length": 39.63333333333333,
"alnum_prop": 0.6980656013456686,
"repo_name": "Xperia-Nicki/android_platform_sony_nicki",
"id": "b3eb961e80ebcedccf1b3b9c5c7a69c10... |
import sys
from zope.interface import implements
from pyramid.interfaces import IAuthenticationPolicy
from pyramid.authentication import CallbackAuthenticationPolicy, \
AuthTktAuthenticationPolicy
from pyvac.models import DBSession, User
class AuthBasicAuthenticationPolicy(CallbackAuthenticationPolicy):
... | {
"content_hash": "8744c39102f34a32d7754600ce738f84",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 31.876404494382022,
"alnum_prop": 0.6112090236164963,
"repo_name": "doyousoft/pyvac",
"id": "def2bf24638294b285b2425b79c375e0f1891cf7",
"size": "2860... |
import mock
import six
from nova import objects
from nova.scheduler.filters import type_filter
from nova import test
from nova.tests.unit.scheduler import fakes
from nova.tests import uuidsentinel as uuids
class TestTypeFilter(test.NoDBTestCase):
def test_type_filter(self):
with mock.patch.object(type_... | {
"content_hash": "76336678b75e71335dd87fa46b0ffd63",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 78,
"avg_line_length": 45.02325581395349,
"alnum_prop": 0.6539256198347108,
"repo_name": "jianghuaw/nova",
"id": "5180dc4c59f6a2dfb9a8a1ac11f548f08fa31f4c",
"size": "6381"... |
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class ExtendedStatusSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-extended-status"
... | {
"content_hash": "49f1f6ae7c02c7eeb61cef2767366d23",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 38.255319148936174,
"alnum_prop": 0.6101223581757509,
"repo_name": "takeshineshiro/nova",
"id": "09d48051bb5a828bb363fbe99c3f413c84f4de37",
"size": "... |
"""
discord.ext.commands
~~~~~~~~~~~~~~~~~~~~~
An extension module to facilitate creation of bot commands.
:copyright: (c) 2015-present Rapptz
:license: MIT, see LICENSE for more details.
"""
from .bot import *
from .cog import *
from .context import *
from .converter import *
from .cooldowns import *
from .core imp... | {
"content_hash": "dba949e496f65445e0b581fd819e6750",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 59,
"avg_line_length": 20.80952380952381,
"alnum_prop": 0.6979405034324943,
"repo_name": "Rapptz/discord.py",
"id": "08dab54d343844e2cd4a27b43ec235974c6fd995",
"size": "437... |
from unittest import TestCase
class NeoTestCase(TestCase):
pass
| {
"content_hash": "c0d4560d3bcb73a8c6b657a562dad3a1",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 29,
"avg_line_length": 11.833333333333334,
"alnum_prop": 0.7605633802816901,
"repo_name": "localhuman/neo-python",
"id": "16d840afe42e30d2e76058f4c1aa5d165d3e67ce",
"size": ... |
import igt_base_template
class APNTemplate(igt_base_template.BaseTemplate):
def __init__(self):
igt_base_template.BaseTemplate.__init__(self)
| {
"content_hash": "4678e7e88f825520725300d9317b274f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 53,
"avg_line_length": 27,
"alnum_prop": 0.6790123456790124,
"repo_name": "cainli/appLog",
"id": "4af9ef3273740931940130e40ac1ba740c3d0288",
"size": "162",
"binary": false... |
"""config.py
Configuration
"""
import ConfigParser
cp = ConfigParser.ConfigParser()
cp.read('config/config.ini')
# database configuration
db_user = cp.get('database', 'user')
db_password = cp.get('database', 'password')
db_address = cp.get('database', 'address')
db_name = cp.get('database', 'name')
... | {
"content_hash": "83b7c90fac19990d0ada81158978d38e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 80,
"avg_line_length": 24.946666666666665,
"alnum_prop": 0.6424371993586317,
"repo_name": "DeeUnderscore/bmr_statbot",
"id": "8a377c585b17b40ec821d6198bbe2c164e6825e7",
"si... |
import argparse
import functools
import sys
import os
import json
import torch
from program_synthesis.karel import arguments
from program_synthesis.karel import dataset
from program_synthesis.karel import models
from program_synthesis.karel.dataset import executor
from program_synthesis.common.tools import saver
from... | {
"content_hash": "234fa97d6346f7dad686fa283cc5d6c8",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 83,
"avg_line_length": 33.21153846153846,
"alnum_prop": 0.6965836711059641,
"repo_name": "nearai/program_synthesis",
"id": "aaf9c371d896c43b190400469dfd2fb8c87a490e",
"size... |
import itertools
import glob
import math
import unittest
import sift_util
import sift_descriptors_pb2
import tempfile
class TestSiftUtilFunctions(unittest.TestCase):
def test_read_parameters(self):
extraction_parameters = \
sift_util.get_extraction_parameters('test_data/seminar.sift')
... | {
"content_hash": "57ee312576b0455286d2ab0cacc956c2",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 132,
"avg_line_length": 53.30967741935484,
"alnum_prop": 0.6553309935858647,
"repo_name": "sanchom/sjm",
"id": "e6756d4c7799f06997f6e43284af26f7da40986d",
"size": "9578",
... |
from lampost.di.resource import Injected, module_inject
from lampost.db.exceptions import DataError
from lampost.editor.editor import Editor
from lampmud.comm.broadcast import BroadcastMap, Broadcast, broadcast_types
mud_actions = Injected('mud_actions')
module_inject(__name__)
class SocialsEditor(Editor):
def _... | {
"content_hash": "a4ebd1c51deac9461bb308ede009503f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 119,
"avg_line_length": 32.02857142857143,
"alnum_prop": 0.6636931311329171,
"repo_name": "genzgd/Lampost-Mud",
"id": "d2374d322e4f51f85cafe77e18b5f77e5dfd570f",
"size": "1... |
import sublime
import sublime_plugin
import re
import mmap
import contextlib
import os
from ..utils import *
class FindUseCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
symbol = view.substr(view.word(view.sel()[0]))
if re.match(r"\w", symbol) is None:
... | {
"content_hash": "6ea21975690e19448c5e0303c4577505",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 85,
"avg_line_length": 29.275862068965516,
"alnum_prop": 0.6230859835100118,
"repo_name": "sergeylunev/sublimated-symfony",
"id": "8468d7a541ec1d78336e6e9343c2ed68dfa7be35",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.