text stringlengths 4 1.02M | meta dict |
|---|---|
import collections
from oslo_log import log as logging
import six
LOG = logging.getLogger(__name__)
DATABASE_POLICY_TYPE = 'database'
NONRECURSIVE_POLICY_TYPE = 'nonrecursive'
ACTION_POLICY_TYPE = 'action'
MATERIALIZED_POLICY_TYPE = 'materialized'
DELTA_POLICY_TYPE = 'delta'
class Tracer(object):
def __init__(... | {
"content_hash": "09116f36dbcef90cdbb0574c3733c8b8",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 78,
"avg_line_length": 28.682692307692307,
"alnum_prop": 0.5283271873952397,
"repo_name": "ekcs/congress",
"id": "9102b03639eebbfb3f9124a3d60ef6bfc7ccce48",
"size": "6597"... |
from steve.util import scrapevideo, html_to_markdown
from process import process
from main.models import Episode
class Get_vimeo(process):
ready_state = None
def process_ep(self, ep):
if self.options.verbose: print(ep.id, ep.name)
meta = scrapevideo(ep.host_url)
# print ep.host_url... | {
"content_hash": "947717d857890feb4e2682051e85076a",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 65,
"avg_line_length": 23.825,
"alnum_prop": 0.5645330535152151,
"repo_name": "xfxf/veyepar",
"id": "9e3d177462f6085ce8715609035f986f3359307c",
"size": "1115",
"binary": ... |
import unittest
from beer_song import song, verse
class BeerTest(unittest.TestCase):
def test_a_verse(self):
self.assertEqual(
verse(8),
"8 bottles of beer on the wall, 8 bottles of beer.\n"
"Take one down and pass it around, "
"7 bottles of beer on the wal... | {
"content_hash": "221d3470c4462465f6564fe3cc43ae53",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 35.36619718309859,
"alnum_prop": 0.5380326563122262,
"repo_name": "rootulp/xpython",
"id": "858b72960defb588ab6de26119b5cfac95b900de",
"size": "2511"... |
import matplotlib.pyplot as plt
import warnings
import random
fontsizes = [8, 16, 24, 32]
def example_plot(ax):
ax.plot([1, 2])
ax.set_xlabel('x-label', fontsize=random.choice(fontsizes))
ax.set_ylabel('y-label', fontsize=random.choice(fontsizes))
ax.set_title('Title', fontsize=random.choice(fontsize... | {
"content_hash": "17505dd6da78a8c1086b1575dfb220ea",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 63,
"avg_line_length": 22.36283185840708,
"alnum_prop": 0.6968737633557578,
"repo_name": "bundgus/python-playground",
"id": "88a5c37dc7b982eb1567d9a014de679e8c9bf047",
"si... |
r"""A lightweight JSON library used by the Scalyr agent to read JSON configuration
files and to serialize some parts of the server requests.
This library is used instead of python's default json library because
it supports some custom Scalyr extensions (chiefly it allows for comments
in the JSON).
The classes exporte... | {
"content_hash": "aa6db56ac94392ed58976eed3052f154",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 106,
"avg_line_length": 36.791666666666664,
"alnum_prop": 0.7344280860702151,
"repo_name": "scalyr/scalyr-agent-2",
"id": "c5c9685f33002ed8c41f3a548a8a41de83890bc0",
"size"... |
from django.conf.urls.defaults import patterns # noqa
from django.conf.urls.defaults import url # noqa
from openstack_dashboard.dashboards.settings.password import views
urlpatterns = patterns('',
url(r'^$', views.PasswordView.as_view(), name='index'))
| {
"content_hash": "5ec9fb8caadaae21ded8473379158024",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 66,
"avg_line_length": 32.75,
"alnum_prop": 0.7519083969465649,
"repo_name": "kaiweifan/horizon",
"id": "1cc32f48b44239d2824e54eb2c65f3b662f75362",
"size": "925",
"binary"... |
import sys
import pyvips
# import logging
# logging.basicConfig(level = logging.DEBUG)
# pyvips.cache_set_trace(True)
a = pyvips.Image.new_from_file(sys.argv[1])
profile = a.get("icc-profile-data")
with open('x.icm', 'w') as f:
f.write(profile)
| {
"content_hash": "bdec7e5fb587d0a5475b184095291379",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 44,
"avg_line_length": 18.142857142857142,
"alnum_prop": 0.6968503937007874,
"repo_name": "jcupitt/pyvips",
"id": "7b3dced0af8a3abfe0fdb9f7d367ce670bb323bf",
"size": "273",... |
"""
Verify src files in YAML are images and not too big
"""
from __future__ import print_function, unicode_literals
from PIL import Image # pip install pillow
import argparse
import glob
import os
import re
import sys
import tempfile
import wget # pip install wget
import yaml # pip install pyyaml
DISALLOWED_CHARS_R... | {
"content_hash": "05381a741567c9316ac83e559b4cce0e",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 78,
"avg_line_length": 31.19047619047619,
"alnum_prop": 0.5614927905004241,
"repo_name": "bchalls/emojipacks",
"id": "c42de5af1bce8c9723adf860f6697a6823300326",
"size": "5... |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | {
"content_hash": "630056bfe545314fedb6bed1af589b5b",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 169,
"avg_line_length": 39.94535519125683,
"alnum_prop": 0.5662106703146375,
"repo_name": "plaid/plaid-python",
"id": "f26884d131185db4f0e161b96a8753196cf846bf",
"size": "... |
from .rest_api import RestSFMC
from .fuel_api import FuelSFMC
| {
"content_hash": "668526fc4d820c62403061ed9ec6f22d",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 30,
"avg_line_length": 31,
"alnum_prop": 0.8064516129032258,
"repo_name": "lexual/rocket-fuel-sdk",
"id": "51f7c4f8b22a1ffdf5dcf6caa50dc66d154a2d09",
"size": "62",
"binary... |
import os
import re
import webapp2
import uuid
from perf_insights import trace_info
import third_party.cloudstorage as gcs
default_retry_params = gcs.RetryParams(initial_delay=0.2,
max_delay=5.0,
backoff_factor=2,
... | {
"content_hash": "122ceb46a48aea058cefbdf8fb3ebad5",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 80,
"avg_line_length": 35.9622641509434,
"alnum_prop": 0.5912906610703043,
"repo_name": "zeptonaut/catapult",
"id": "1cd601a1841693d40131c352f10ce56848370572",
"size": "207... |
import tests.appserver
from tests.web import *
import random
import string
class TestCase(WebTestCase):
@classmethod
def setup_class(cls):
super(TestCase, cls).setup_class()
cls._appserver = tests.appserver.AppServer(*tests.appserver.AppServer.fetch_config('default_appserver'))
cls._appserver.start()... | {
"content_hash": "9601174e7498ee903df680fdd9049b87",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 108,
"avg_line_length": 23.892857142857142,
"alnum_prop": 0.6905829596412556,
"repo_name": "happz/settlers",
"id": "2435cdc8fb2482283bc42cc2c9ece56872ec9e23",
"size": "669"... |
r"""TELNET negotiation filter
This code was adapted from the telnetlib library included with Python 2.7,
and is being used under the PSF License agreement included below.
All changes to the original telnetlib code are copyright (c) 2019 R Pickett,
and licensed under the same terms.
==================================... | {
"content_hash": "00b0dd3636c756255633b80fba0ddaa5",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 160,
"avg_line_length": 40.74858757062147,
"alnum_prop": 0.6035355285961872,
"repo_name": "emersonrp/wxpymoo",
"id": "26d425b3293f4c6d4ab7b08d3241b6474e5a90d1",
"size": "1... |
import re
class ReadLogWriteReport(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
def execute(self):
logFileName = 'log.txt'
totals = self.getTotalDroppedPacketsByIp(logFileName)
self.writeDroppedPacketsReport(totals)
... | {
"content_hash": "3abd378230c77e9dadd090c1321feb65",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 30.37313432835821,
"alnum_prop": 0.5125307125307126,
"repo_name": "shadoobie/dbench",
"id": "2e1978713b6f7c85315b2fa3486af7f7f00e41f6",
"size": "2035... |
from __future__ import unicode_literals
from ios_code_generator.utils import to_mixed_case, to_camel_case
__author__ = 'banxi'
def test_to_mixed_case(): # noqa
assert to_mixed_case('user') == 'user'
assert to_mixed_case('User') == 'user'
assert to_mixed_case('userStory') == 'userStory'
assert to_mi... | {
"content_hash": "7ec45b8ae4c739f9a91ba5bc8511c674",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 65,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.647984267453294,
"repo_name": "banxi1988/iOSCodeGenerator",
"id": "ea2705b281728a3d9e76f33e4b0a96bef596d052",
"si... |
import jagpdf
import jag.testlib as testlib
import os
import sys
def test_main(argv=None):
#raw_input('.......')
if argv==None:
argv=sys.argv
out_file = os.path.abspath(os.path.join(argv[1], 'pattern-nonstd-op.pdf'))
cfg = testlib.test_config()
doc = jagpdf.create_stream(testlib.FileStreamO... | {
"content_hash": "f75ac81198ed668b296dafff8101f6c3",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 30.11111111111111,
"alnum_prop": 0.5996309963099631,
"repo_name": "jgresula/jagpdf",
"id": "41439ea55dc23dce14d3a06da706b25ac08a7a63",
"size": "1813"... |
from array import array
import socket
import time
try:
from struct import calcsize, pack_into
except ImportError:
from ustruct import calcsize, pack_into
# Objective:
# Monitor the Geiger counter count every second
# Be able to provide:
# - count each second for the last 300 seconds
# - count each minute for t... | {
"content_hash": "33a1ed3bb3bb6d071a1f2bcc84f54ce2",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 80,
"avg_line_length": 31.634146341463413,
"alnum_prop": 0.5510794140323825,
"repo_name": "pramasoul/ESP-geiger",
"id": "3e36cb8824fac67766a87757fb9f82ac656ef6b2",
"size":... |
"""
Decomposition of the circuit constraint in Google CP Solver.
Cf Global constraint catalog:
http://www.emn.fr/x-info/sdemasse/gccat/Ccircuit.html
Solution of n=4:
x: [2, 0, 3, 1]
x: [3, 0, 1, 2]
x: [1, 3, 0, 2]
x: [3, 2, 0, 1]
x: [1, 2, 3, 0]
x: [2, 3, 1, 0]
The 'orbit' method that is used... | {
"content_hash": "95cb6abbce83030c434746d418da7912",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 76,
"avg_line_length": 21.76271186440678,
"alnum_prop": 0.6273364485981309,
"repo_name": "google/or-tools",
"id": "d1680b770e791223e641445add85d6564a1a99d3",
"size": "3168... |
"""Base classes / Design
The design is that there are three components fitting together in this project:
- Trials - a list of documents including at least sub-documents:
['spec'] - the specification of hyper-parameters for a job
['result'] - the result of Domain.evaluate(). Typically includes:
['statu... | {
"content_hash": "c2974421673f69dcdd8b2b3529511dcc",
"timestamp": "",
"source": "github",
"line_count": 908,
"max_line_length": 82,
"avg_line_length": 35.107929515418505,
"alnum_prop": 0.5658134136395006,
"repo_name": "w1kke/hyperopt",
"id": "859542133aaa1d09b356189189146140600e0f26",
"size": "3187... |
import json
from django.test import TestCase
from django.test.client import RequestFactory
from djangular.views.crud import NgCRUDView
from djangular.views.mixins import JSONResponseMixin
from server.models import DummyModel, DummyModel2, SimpleModel, M2MModel
class CRUDTestViewWithM2M(JSONResponseMixin, NgCRUDView... | {
"content_hash": "e6d6ea1c96e711842b5e792614c1e818",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 111,
"avg_line_length": 42.63157894736842,
"alnum_prop": 0.6176543209876543,
"repo_name": "vaniakov/django-angular",
"id": "5c78d79f272ea9c294fe9a2f69c970d40489b287",
"siz... |
'''
Windows Only.
Generic WMI check. This check allows you to specify particular metrics that you
want from WMI in your configuration. Check wmi_check.yaml.example in your conf.d
directory for more details on configuration.
'''
# project
from checks import AgentCheck
# 3rd party
import wmi
UP_METRIC = 'Up'
SEARCH_WI... | {
"content_hash": "4331446e467806665dcad672e1992666",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 98,
"avg_line_length": 40.885245901639344,
"alnum_prop": 0.5212510024057738,
"repo_name": "JohnLZeller/dd-agent",
"id": "44a709dc7f168ceafd9ea9091ae993d1f065fbd8",
"size":... |
from datetime import datetime
from django.db import models
class Item(models.Model):
title = models.CharField("Title", max_length=50, blank=False)
content = models.TextField("Description", blank=False)
source = models.URLField("Source", blank=True)
related = models.ManyToManyField("self", blank=True)
... | {
"content_hash": "68edb79ca061f0c53201aa6b185dad4b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 33.61538461538461,
"alnum_prop": 0.7116704805491991,
"repo_name": "n2o/labbook",
"id": "c6c4f985b3a9c90c6dad3d126d9d9ca1de5a45b7",
"size": "437",
"... |
"""
Determinantal Point Process
===========================
This a pure Python port of the Matlab code of Alex Kulesza.
The port was done using the fabulous SMOP package with alterations to ensure
it only used scipy/numpy packages. As such various line comments referencing
the original `*.m` file is retained in this... | {
"content_hash": "4693db5147fd6c4f53ca808550f31ee3",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 152,
"avg_line_length": 34.32457786116323,
"alnum_prop": 0.5584039355015031,
"repo_name": "chappers/sklearn-recipes",
"id": "1183ed5bae260a404d848079e2718c4d17a021ea",
"si... |
from wagtail.wagtailcore import blocks
class StructBlockWithStyle(blocks.StructBlock):
css_style = blocks.CharBlock(required=False)
class Meta:
form_template = 'common/block_forms/structblock_with_style.html'
| {
"content_hash": "858638587202b0f675bfb4125c604111",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 72,
"avg_line_length": 28.5,
"alnum_prop": 0.7587719298245614,
"repo_name": "baylee-d/cos.io",
"id": "46349c04d168f0f1ffc308ca2302115d31d324c9",
"size": "228",
"binary": f... |
'''
Cylinder mesh generator
FIXME: UV coords!
'''
from ..core import *
#-------------------------------------------------------------------------------
def generate(vertexLayout, baseRadius, topRadius, length, numSlices, numStacks) :
'''
Generate cylinder model
'''
dgLogger.debug('generators.cylinder'... | {
"content_hash": "8e30f1d58d50b2b36495d0b5cc7464a3",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 84,
"avg_line_length": 34.20161290322581,
"alnum_prop": 0.601273284602688,
"repo_name": "floooh/drahtgitter",
"id": "aa3122def409ee4b80c782618e4cae7694f656f0",
"size": "42... |
"""
This module is intended to match crystal structures against known crystallographic "prototype"
structures.
In this module, the AflowPrototypeMatcher uses the AFLOW LIBRARY OF CRYSTALLOGRAPHIC PROTOTYPES.
If using this particular class, please cite their publication appropriately:
Mehl, M. J., Hicks, D., Toher, C.... | {
"content_hash": "a0484cc0536890293f281a460afa6da0",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 97,
"avg_line_length": 37.31481481481482,
"alnum_prop": 0.6285359801488833,
"repo_name": "mbkumar/pymatgen",
"id": "fb68b908b151d908bcf34224016e5deb828d9c68",
"size": "414... |
import os
import socket
import unittest
import mock
import utils.misc
class MockedSocket1():
def __init__(self, a, b):
print a, b
pass
def connect(self, dest):
pass
def getsockname(self):
return ['1.2.3.4']
class MockedSocket2():
def __init__(self, a, b):
... | {
"content_hash": "74aa7a753806071ef7b7cfc1305ebf99",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 33.2108843537415,
"alnum_prop": 0.5718967636214666,
"repo_name": "canturkisci/agentless-system-crawler",
"id": "66864ba47773a6c006b35e2a95690601bee7ae... |
"""The test for light device automation."""
from unittest.mock import patch
import pytest
from homeassistant.components import device_automation
import homeassistant.components.automation as automation
from homeassistant.components.websocket_api.const import TYPE_RESULT
from homeassistant.const import CONF_PLATFORM, ... | {
"content_hash": "73821362a5f0f3105c6792eb56808fbd",
"timestamp": "",
"source": "github",
"line_count": 884,
"max_line_length": 117,
"avg_line_length": 34.27036199095023,
"alnum_prop": 0.5600264069978544,
"repo_name": "aronsky/home-assistant",
"id": "563611b99adb4a76221a8826e11550bf57b56b4d",
"size... |
from collections import OrderedDict
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from elonomics.models import Player, Game
import re
... | {
"content_hash": "45048c25fd69bbe03d406f04913c48e1",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 152,
"avg_line_length": 33.95145631067961,
"alnum_prop": 0.6345438947669431,
"repo_name": "rjoleary/elonomics",
"id": "a4d08cee4417b9506bed308919a39eb54e5cea9d",
"size": "... |
import gtk
import gtk.gdk
from envxdot import EnvironmentDotWindow
from ARM import *
import NodeDialogFactory
class EnvironmentModelViewer(EnvironmentDotWindow):
def __init__(self,environmentName,dp):
EnvironmentDotWindow.__init__(self,environmentName,dp)
self.dbProxy = dp
self.environment = self.dbProxy... | {
"content_hash": "44a8af34f8112250f184903028c5961d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 85,
"avg_line_length": 31.244897959183675,
"alnum_prop": 0.7243631613324625,
"repo_name": "RobinQuetin/CAIRIS-web",
"id": "eff7ccebe5cc1a3bd5e7b14f849a9a6c130f7b82",
"size"... |
from google.cloud import aiplatform_v1beta1
async def sample_export_feature_values():
# Create a client
client = aiplatform_v1beta1.FeaturestoreServiceAsyncClient()
# Initialize request argument(s)
destination = aiplatform_v1beta1.FeatureValueDestination()
destination.bigquery_destination.output_... | {
"content_hash": "98f0baf020fecce654033ff599879cb5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 93,
"avg_line_length": 31.612903225806452,
"alnum_prop": 0.736734693877551,
"repo_name": "googleapis/python-aiplatform",
"id": "3fb556691658c81d3cd8feeca3fbeb08b310816f",
"... |
import config as cfg
from sequencePlayer import SequencePlayer
from neopixel import Adafruit_NeoPixel
class NeopixelSequencePlayer(SequencePlayer):
def __init__(self):
super().__init__()
self.strip = Adafruit_NeoPixel(
cfg.LED_COUNT,
cfg.LED_DATA_PIN,
cfg.LED_F... | {
"content_hash": "0a0f11a8eec606478debb2f88db6f272",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 59,
"avg_line_length": 28.03448275862069,
"alnum_prop": 0.5817958179581796,
"repo_name": "vinhui/chistmastree",
"id": "a7383c860561bc887df57f8c4760c0201bd84980",
"size": "8... |
import uuid
from datetime import datetime
from cqlengine import columns
from cqlengine import models
class Event(models.Model):
"""
Analytic Event
"""
__keyspace__ = 'ans'
__table_name__ = 'events'
# unique identifier for this event
id = columns.UUID(primary_key=True, default=uuid.uuid4)... | {
"content_hash": "61185d52a869d400f01bc0942752e8d6",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 69,
"avg_line_length": 28.6,
"alnum_prop": 0.6818181818181818,
"repo_name": "hkhamm/cqlengine_test",
"id": "23f431e0b24c3e836d3a1a0e819d0c04befeb256",
"size": "858",
"bin... |
from __future__ import absolute_import, division, print_function, with_statement
| {
"content_hash": "d8840ff6b5b0d6cc9cecc06f484b3fa1",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 80,
"avg_line_length": 81,
"alnum_prop": 0.7901234567901234,
"repo_name": "tao12345666333/app-turbo",
"id": "cbf964c8b83c83551cc2f1987d69417e6edc2a9e",
"size": "81",
"bina... |
"""
Tests for L{twisted.test.iosim}.
"""
from __future__ import absolute_import, division
from twisted.test.iosim import FakeTransport
from twisted.trial.unittest import TestCase
class FakeTransportTests(TestCase):
"""
Tests for L{FakeTransport}.
"""
def test_connectionSerial(self):
"""
... | {
"content_hash": "db2ea8f1393e97e1faf0203a1403d41b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 25.473684210526315,
"alnum_prop": 0.6198347107438017,
"repo_name": "Tokyo-Buffalo/tokyosouth",
"id": "cf44d24dbefec8dba0fad30bfc5d4d0956597c74",
"siz... |
import sys
import os.path
# Import the relevant PTS classes and modules
from pts.eagle.galaxy import Snapshot
# -----------------------------------------------------------------
# parse the arguments
if not len(sys.argv) in (2,3): raise ValueError("This script expects one or two command-line arguments")
snapshotname... | {
"content_hash": "9684769b2ba0d46b6d3f7f7ec9719bc9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 104,
"avg_line_length": 33.90909090909091,
"alnum_prop": 0.613047363717605,
"repo_name": "Stargrazer82301/CAAPR",
"id": "36d2e18e296ac4491644fb83932b7ce883448185",
"size": ... |
import tables as tb
import pandas as pd
import sys
class AffmatCleaner(object):
"""docstring for AffmatCleaner"""
def __init__(self, handle, segment):
super(AffmatCleaner, self).__init__()
self.handle = handle
self.accession_strains = None
self.segment = segment
... | {
"content_hash": "b62c71b266d85f272ad74531b744aeb5",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 169,
"avg_line_length": 33.30612244897959,
"alnum_prop": 0.5674019607843137,
"repo_name": "ericmjl/influenza-reassortment-detector",
"id": "65fce994874b38457940bef1116674c839... |
from glumpy import gloo
transform_1 = gloo.Snippet("""
uniform float scale;
float forward(float x) { return scale*x; }
float inverse(float x) { return scale*x; }
""")
transform_2 = gloo.Snippet("""
uniform float scale;
float forward(float x) { return scale*x; }
float inverse(float x) { return scale*x; }
""")
transfo... | {
"content_hash": "5746d009f19719972249c78dfca555ec",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 77,
"avg_line_length": 25.270588235294117,
"alnum_prop": 0.6410614525139665,
"repo_name": "duyuan11/glumpy",
"id": "3ca31218ccaa77dc59a2c7fcd1f3a22a80841e7c",
"size": "2461... |
"""Pipeline, the top-level Beam object.
A pipeline holds a DAG of data transforms. Conceptually the nodes of the DAG
are transforms (:class:`~apache_beam.transforms.ptransform.PTransform` objects)
and the edges are values (mostly :class:`~apache_beam.pvalue.PCollection`
objects). The transforms take as inputs one or m... | {
"content_hash": "86236379448e8303078b4fedbec77e61",
"timestamp": "",
"source": "github",
"line_count": 1059,
"max_line_length": 120,
"avg_line_length": 41.24834749763928,
"alnum_prop": 0.6653999359003708,
"repo_name": "RyanSkraba/beam",
"id": "d4c94c4675f6c7ffed310d1e8e67ee4aa9d35c49",
"size": "44... |
from mpinterfaces.mat2d.friction.startup import run_gamma_calculations, \
run_normal_force_calculations | {
"content_hash": "f30da7506722868a9b04aa2c675674a0",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 73,
"avg_line_length": 53.5,
"alnum_prop": 0.822429906542056,
"repo_name": "joshgabriel/MPInterfaces",
"id": "9d546a4f960c236bd0b606df53441e45bf4cb5f2",
"size": "107",
"bi... |
from wagtail.contrib.redirects.models import Redirect
from wagtail.permission_policies import ModelPermissionPolicy
permission_policy = ModelPermissionPolicy(Redirect)
| {
"content_hash": "2372a5ef5e625f10323804473bf5e358",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 61,
"avg_line_length": 42.25,
"alnum_prop": 0.8757396449704142,
"repo_name": "rsalmaso/wagtail",
"id": "9f232643c014b7e81281a8dea4c648a609f58a67",
"size": "169",
"binary":... |
"""Functional tests for slice op."""
import numpy as np
from tensorflow.python.eager import backprop
from tensorflow.python.eager import def_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
from tensorflow.p... | {
"content_hash": "e2b1b3014fdd51dba97937a2a5d2295a",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 80,
"avg_line_length": 37.6597510373444,
"alnum_prop": 0.6046716615249008,
"repo_name": "tensorflow/tensorflow-experimental_link_static_libraries_once",
"id": "a5ee51dba75b3... |
"""
Nova authentication management
"""
import os
import shutil
import string # pylint: disable=W0402
import tempfile
import uuid
import zipfile
from nova import context
from nova import crypto
from nova import db
from nova import exception
from nova import flags
from nova import log as logging
from nova import utils... | {
"content_hash": "32eb2b4e954f5416df260be1a8d96d82",
"timestamp": "",
"source": "github",
"line_count": 802,
"max_line_length": 79,
"avg_line_length": 37.49002493765586,
"alnum_prop": 0.5576545714570792,
"repo_name": "termie/nova-migration-demo",
"id": "07235a2a79afe8b810d3e8591d570fd83e7da1f6",
"s... |
from typing import Dict, Union
from sqlalchemy import and_
from lockfile import LockFile
import json
import pypandoc
import re
import os
import shutil
import git
import sys
import traceback
import datetime
import time
import random
import string
import pyparsing as pp
import dateutil.parser
from typing import Callable... | {
"content_hash": "10db0a673c9b7d9c28ed5d91d6567bb1",
"timestamp": "",
"source": "github",
"line_count": 891,
"max_line_length": 116,
"avg_line_length": 31.97979797979798,
"alnum_prop": 0.5629255281813715,
"repo_name": "fi-ksi/web-backend",
"id": "d9a577284afba44450c4585e19dfc620c4fce4e2",
"size": "... |
"""AppAssure 5 REST API"""
from appassure.api import AppAssureAPI
class INightlyJobsManagement(AppAssureAPI):
"""Full documentation online at
http://docs.appassure.com/display/AA50D/INightlyJobsManagement
"""
def cancelNightlyJobs(self):
"""Cancels all nightly jobs execution."""
retur... | {
"content_hash": "3f1b46951074e313d8e0eae8ec316879",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 72,
"avg_line_length": 38.083333333333336,
"alnum_prop": 0.6398249452954048,
"repo_name": "rshipp/python-appassure",
"id": "747aae4ced94b51d14764a0d801cc6290c8b3577",
"size... |
"""
mailme.services.feed
~~~~~~~~~~~~~~~~~~~~
Add support for:
* Opml
* RSS / Atom
* Basically everything that `feedparser` supports.
"""
import time
import socket
import hashlib
from datetime import datetime, timedelta
import listparser
import requests
import feedparser
import pytz
from r... | {
"content_hash": "811ec7a0a4a36965fef9b03c12e08b4c",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 92,
"avg_line_length": 33.58444444444444,
"alnum_prop": 0.581155296764375,
"repo_name": "mailme/mailme.io",
"id": "c440dc6707694b23685cd5e1557124fc746df934",
"size": "1513... |
"""
Cascade Project deletion to Release
Revision ID: 29d87a24d79e
Revises: c0682028c857
Create Date: 2018-03-09 22:37:21.343619
"""
from alembic import op
revision = "29d87a24d79e"
down_revision = "c0682028c857"
def upgrade():
op.drop_constraint("releases_name_fkey", "releases", type_="foreignkey")
op.cre... | {
"content_hash": "845d15a99499b4fc58e94f503f30c9f4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 20.210526315789473,
"alnum_prop": 0.59375,
"repo_name": "dstufft/warehouse",
"id": "462d34df8f2c99f09b08a26720094cdf62b55d61",
"size": "1308",
"bin... |
import multiprocessing, logging # Fix atexit bug
from setuptools import setup, find_packages
def readme():
try:
return open('README.rst').read()
except:
pass
return ''
setup(
name='s3peat',
# Make sure to also update the version in s3peat/__init__.py
version='1.0.... | {
"content_hash": "97ad8372fd1423cbc5a56cbae476be02",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 68,
"avg_line_length": 24.789473684210527,
"alnum_prop": 0.5010615711252654,
"repo_name": "shakefu/s3peat",
"id": "a0a52e86efabe52972ab200441862534e13e66bc",
"size": "942",... |
import unittest
import numpy as np
import paddle
from paddle.fluid import core
from paddle.fluid.contrib.sparsity.asp import ASPHelper
class MyLayer(paddle.nn.Layer):
def __init__(self):
super().__init__()
self.conv1 = paddle.nn.Conv2D(
in_channels=3, out_channels=2, kernel_size=3, p... | {
"content_hash": "cadb18f2cc98ff6c57e60dc8686fed8b",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 75,
"avg_line_length": 29.728070175438596,
"alnum_prop": 0.5644732959575096,
"repo_name": "PaddlePaddle/Paddle",
"id": "13282e0222c87fb1be89485908a6820b11d38db1",
"size": ... |
import datetime
import iso8601
from django.template.defaultfilters import register
from django.template.defaultfilters import timesince
from django.utils.safestring import mark_safe
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
@register.filter
def replace_underscores(str... | {
"content_hash": "fcc76d114d83c8a1724d25109f3e2f7f",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 70,
"avg_line_length": 28.693877551020407,
"alnum_prop": 0.689900426742532,
"repo_name": "ChameleonCloud/horizon",
"id": "3fcb29c19ae5ffa25cf3bab852180ec97419a700",
"size":... |
import os
from tests.base_case import ChatBotTestCase
from chatterbot.trainers import ChatterBotCorpusTrainer
class ChatterBotCorpusTrainingTestCase(ChatBotTestCase):
def setUp(self):
super(ChatterBotCorpusTrainingTestCase, self).setUp()
self.chatbot.set_trainer(ChatterBotCorpusTrainer)
def ... | {
"content_hash": "ec40f622b22bdd892f2a017b6316aa0c",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 91,
"avg_line_length": 35.55555555555556,
"alnum_prop": 0.690234375,
"repo_name": "Gustavo6046/ChatterBot",
"id": "5e2d08f4b32c024a5d283d96f2f777d260cdd53d",
"size": "2560"... |
"""
Created on Tue Apr 09 09:45:06 2013
@author: Juergen Hasch, python@elbonia.de
Distributed under the terms of the BSD License.
"""
"""
Tornado websocket server
Store cell text under unique id in dict
*This is a proof of concept only*
TODO:
- multiple connects
- persistent storage
""" ... | {
"content_hash": "bebce9082058122eb8f315756efd11f3",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 86,
"avg_line_length": 28.630434782608695,
"alnum_prop": 0.49316628701594534,
"repo_name": "andyneff/IPython-notebook-extensions",
"id": "e9c828f7b41d4674c864e81d6ac207f709ae... |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import platform
extra = True
if platform.system() == 'Linux':
libraries = ["maxwellsdk"]
extra_compile_args=['-D_LINUX']
extra_link_args=['-Llib']
elif platform.system() == 'Darwin': # OS x
... | {
"content_hash": "4d89819eb8b674014386482ae58c7a8c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 80,
"avg_line_length": 30.75609756097561,
"alnum_prop": 0.6209357652656622,
"repo_name": "martijnberger/cython-maxwell",
"id": "b4f06bd92af443916671738560a2130e954a9a93",
"... |
from django.db import models
from django.utils.translation import ugettext as _
from django.core.validators import RegexValidator
from sanitizer.models import SanitizedCharField
from config.settings import SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES
from apps.account.models import Account
class Page(models.M... | {
"content_hash": "24cc8ab409440805957cdf0120127ec0",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 112,
"avg_line_length": 41.74285714285714,
"alnum_prop": 0.5742642026009582,
"repo_name": "F483/bikesurf.org",
"id": "098afaf2bb5f570bc449f79bd3372b1e2bc3af33",
"size": "16... |
from django.utils.translation import ugettext as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from models import CheckoutPlugin, ProductPlugin
class CheckoutPlugin(CMSPluginBase):
model = CheckoutPlugin
module = _('stripe shop')
name = _("Checkout")
render_templ... | {
"content_hash": "6e0c7b7ec485e63076b5213622b416a2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 56,
"avg_line_length": 28.21951219512195,
"alnum_prop": 0.6568712186689715,
"repo_name": "Lionardo/aldryn-stripe-shop",
"id": "1528f38d1748ebee62cd98e9d67847785f6bf30c",
"s... |
""" Testing array coords
"""
import numpy as np
from nose.tools import assert_true, assert_false, \
assert_equal, assert_raises
from numpy.testing import assert_array_equal, assert_array_almost_equal
from nipy.testing import parametric
from nipy.core.api import Affine
import nipy.core.reference.array_coords... | {
"content_hash": "265e116b64c31b616309f128aa5f9e12",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 72,
"avg_line_length": 35.24175824175824,
"alnum_prop": 0.5291549734954787,
"repo_name": "yarikoptic/NiPy-OLD",
"id": "4fffac8a7fc985122f669c2a84f3f240e8faaaa1",
"size": "3... |
import base64
import io
import json
import os
import subprocess
import sys
BASEDIR = os.path.expanduser('~/git/aur-pkgbuilds')
def commitaur(msg):
with open('.SRCINFO', 'wb') as fh:
fh.write(subprocess.check_output(['makepkg', '--printsrcinfo']))
subprocess.check_call(['git', 'add', '.'])
subproc... | {
"content_hash": "89079639685949ee1ae2cd73d769998d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 98,
"avg_line_length": 28.57777777777778,
"alnum_prop": 0.6469673405909798,
"repo_name": "Kwpolska/cheqlist",
"id": "607f20b09f4d87c27029c8ef0947cb6971bc2ceb",
"size": "298... |
'''Train the model.'''
| {
"content_hash": "85a5bf9e9cd4bbb6a515e0de27009183",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 22,
"avg_line_length": 23,
"alnum_prop": 0.5652173913043478,
"repo_name": "cavestruz/StrongCNN",
"id": "c0e2a3a25b2f60581b5e06a5a9b7b89f426abf70",
"size": "23",
"binary": ... |
""" a text adventure game
"""
import sys
from random import randint, random
from random import choice as randchoice
from collections import defaultdict
from copy import copy
from utils import Loop, Container, TextInput, first, sjoin, nl, space
from board import StackableBoard, Loc, BaseTile
commands = dict(a="l... | {
"content_hash": "ed8bb4a83a89a07adcb84542c67ee085",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 110,
"avg_line_length": 28.570342205323193,
"alnum_prop": 0.5489752462070802,
"repo_name": "pythonbyexample/PBE",
"id": "9cf496264282c2f234d25d1d46734ac2afa85a97",
"size":... |
"""
Created on Tue Feb 16 13:41:19 2016
Simple Lofted Wing between airconics primitive classes using the AddSurfaceLoft
airconics tool
@author: pchambers
"""
if __name__ == "__main__":
import airconics
import airconics.AirCONICStools as act
# Initialise the display
from OCC.Display.SimpleGui import in... | {
"content_hash": "8880c15e13184cdb97059c1dd10212a5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 88,
"avg_line_length": 36.55882352941177,
"alnum_prop": 0.6395816572807723,
"repo_name": "p-chambers/occ_airconics",
"id": "a61b5a37775a1fe70f85618e2ab890f9053a8583",
"size... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('campaign', '0004_newsletter_from_email'),
('fluentcms_emailtemplates', '__first__'),
]
operations = [
migrations.AlterField(
mod... | {
"content_hash": "861c15206ed8c3d66c86ff1a1808924a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 106,
"avg_line_length": 26.26086956521739,
"alnum_prop": 0.5993377483443708,
"repo_name": "bashu/fluentcms-campaign",
"id": "62505ac3f6103ab145a35a0aa13d73c7a0903e3e",
"siz... |
from django.db import models
from individuals.models import Individual
class Variant(models.Model):
individual = models.ForeignKey(Individual, on_delete=models.CASCADE)
index = models.TextField(db_index=True)#ex. 1-2387623-G-T
pos_index = models.TextField(db_index=True)#ex. 1-326754756
#First save a... | {
"content_hash": "a3e4a52d7244c74213308f5826a4045e",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 114,
"avg_line_length": 63.28846153846154,
"alnum_prop": 0.7342752962625342,
"repo_name": "raonyguimaraes/mendelmd",
"id": "b5738cb6a0a789893a4b5cb18f60b5156ba912b6",
"siz... |
from django.apps import AppConfig
class BooksConfig(AppConfig):
name = 'books'
verbose_name = '書籍管理'
| {
"content_hash": "8eb17f75c4d6414976bd17a46e31c81d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 33,
"avg_line_length": 18.5,
"alnum_prop": 0.7027027027027027,
"repo_name": "djangogirlstaipei/eshop",
"id": "30a7697d75ee47b8efc0f592eaae425d667000b3",
"size": "119",
"bi... |
import re
from migrate.changeset import UniqueConstraint
import sqlalchemy
from sqlalchemy import Boolean
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy.engine import reflection
from sqlalchemy.ext.compiler import compiles
from sqlalchemy import func
from sqlalchemy import Index
f... | {
"content_hash": "f208620b702a7e8e1b20cee8702688e7",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 79,
"avg_line_length": 37.767151767151766,
"alnum_prop": 0.6178575360563691,
"repo_name": "kickstandproject/payload",
"id": "e5bc72681e5a5b23d1ed0b763993b5dfa6ba6337",
"si... |
import unittest
from ..validators import Validate
class TestValidate(unittest.TestCase):
def setUp(self):
self.validate = Validate(lambda x: x == 0, "must be 0")
def test_it_returns_false_when_validation_fails(self):
self.assertFalse(self.validate(1))
def test_it_returns_true_when_validation_is_ok(sel... | {
"content_hash": "a56c9493daf59364d90f26e77f06c997",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 59,
"avg_line_length": 26.36842105263158,
"alnum_prop": 0.7145708582834331,
"repo_name": "mlackman/pyavali",
"id": "f99c9628c8003856fb57592ebff37b9a93c30da8",
"size": "501"... |
from . import comparison, pythagorean, rotation, vector | {
"content_hash": "dffcccfc7bfbda69b32150f83b7f4589",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 55,
"avg_line_length": 55,
"alnum_prop": 0.8181818181818182,
"repo_name": "tea2code/gamemath",
"id": "9a5429ab97e8124e74334d0d0c326e8c38ca4040",
"size": "55",
"binary": fa... |
from __future__ import print_function
from __future__ import division
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.model_selection import H2OModelSelectionEstimator
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
# test to find out why maxr is sl... | {
"content_hash": "bbfdfa0c74f7206500fe676f65cd41c5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 142,
"avg_line_length": 46.97142857142857,
"alnum_prop": 0.6496350364963503,
"repo_name": "h2oai/h2o-3",
"id": "ce8309a3e16db93138d4ab71050b3303d9479811",
"size": "1644",
... |
"""
#Downloaded from http://code.activestate.com/recipes/576918/
#Created by Michael Fogleman
#Short URL Generator
"""
#DEFAULT_ALPHABET = 'JedR8LNFY2j6MrhkBSADUyfP5amuH9xQCX4VqbgpsGtnW7vc3TwKE'
#DEFAULT_BLOCK_SIZE = 22
DEFAULT_ALPHABET = 'ed82j6rh1kyfo5almu9x4iqzbgpstn7vc3w'
DEFAULT_BLOCK_SIZE = 18
class UrlEncoder... | {
"content_hash": "04c352824bf1f27a38ea32e8977c924d",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 81,
"avg_line_length": 30.305882352941175,
"alnum_prop": 0.5683229813664596,
"repo_name": "benosteen/RDFDatabank",
"id": "d46e946580d001305235ac0349db77ef7e5d7d55",
"size":... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "8a44fa66acb44c018422fe0f8a5bf3f0",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 72,
"avg_line_length": 26.876923076923077,
"alnum_prop": 0.723526044647968,
"repo_name": "arenadata/ambari",
"id": "a5121b85f48e6897259037991979f83023c93c4c",
"size": "1769... |
import ftplib
import socket
import itertools
from yapsy.IPlugin import IPlugin
from time_functions import SpeedBenchmark
class FTP(IPlugin):
time_benchmark = SpeedBenchmark()
list_usrnames = []
list_passwds = []
pass_found = 0
def get_usernames(self, file_path):
try:
self.list... | {
"content_hash": "e10a1559b1bf5746bb03b4789eccdfe8",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 120,
"avg_line_length": 38.62162162162162,
"alnum_prop": 0.5339398180545836,
"repo_name": "Plasticoo/NNBruteforcer",
"id": "6995c416c186a202a77fbc24c5019bf885fc7257",
"size... |
from aql.util_types.aql_list_types import toSequence
__all__ = (
'Builder', 'FileBuilder'
)
import os
import errno
from aql.util_types import FilePath
from aql.utils import simpleObjectSignature, simplifyValue, executeCommand, eventDebug, groupPathsByDir, groupItems, relativeJoin, relativeJoinList
from aql.values ... | {
"content_hash": "fd3fb27cd9472d4ea0b67b8ceb60b792",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 147,
"avg_line_length": 29.64241164241164,
"alnum_prop": 0.48674428391078695,
"repo_name": "menify/sandbox",
"id": "2810cfcbc35170566a59016db32fd48b11cbb446",
"size": "154... |
'''
Created on Oct 9, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from tkinter import *
try:
from tkinter.ttk import *
except ImportError:
from ttk import *
from arelle.CntlrWinTooltip import ToolTip
import os
class ViewTree:
def __init__(self, ... | {
"content_hash": "38db1899e0ba5c60ed88b09047a75b67",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 142,
"avg_line_length": 49.984415584415586,
"alnum_prop": 0.592756183745583,
"repo_name": "sternshus/Arelle",
"id": "b7df014853ddc6f25cfce8889c6273fc12278412",
"size": "19... |
from flask import Blueprint, render_template, current_app, Response
from application.database import global_db
from application.helpers import requires_auth
from core.monitoring.models import SENSOR_CLASS_MAP
sensor_heatmap_pages = Blueprint('sensor_heatmap', __name__
, template_folder='templates', static_folder='st... | {
"content_hash": "8f312a346d736ef07563a484d91ba607",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 29.757575757575758,
"alnum_prop": 0.7219959266802444,
"repo_name": "srcc-msu/job_statistics",
"id": "9b0f1a13712825631df7188e15d8e692b672191c",
"size... |
"""Utilities for iotop/top style profiling for android."""
import collections
import json
import os
import subprocess
import sys
import urllib
import constants
import io_stats_parser
class DeviceStatsMonitor(object):
"""Class for collecting device stats such as IO/CPU usage.
Args:
adb: Instance of Androi... | {
"content_hash": "d18d9de19ddc5795adae522975971a99",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 80,
"avg_line_length": 36.6875,
"alnum_prop": 0.5750790946702361,
"repo_name": "keishi/chromium",
"id": "79225028baf7c19ac51276b956181e1ab8eb33da",
"size": "4276",
"bina... |
"""
Google OpenID and OAuth support
OAuth works straightforward using anonymous configurations, username
is generated by requesting email to the not documented, googleapis.com
service. Registered applications can define settings GOOGLE_CONSUMER_KEY
and GOOGLE_CONSUMER_SECRET and they will be used in the auth process.
... | {
"content_hash": "fae1c259afd4db36114f920fe157ef30",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 79,
"avg_line_length": 37.51372549019608,
"alnum_prop": 0.6660045996236672,
"repo_name": "makinacorpus/django-social-auth",
"id": "295a3db5e4247d7735ef8c7643d736c791aa126b",... |
from juriscraper.opinions.united_states.federal_special import cit
import time
from datetime import date
from lxml import html
class Site(cit.Site):
def __init__(self):
super(Site, self).__init__()
self.url = 'http://www.cit.uscourts.gov/SlipOpinions/SlipOps-2010.html'
self.court_id = sel... | {
"content_hash": "6a4440c1f1520f61c091424c1ffafa5a",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 85,
"avg_line_length": 36.986301369863014,
"alnum_prop": 0.5348148148148149,
"repo_name": "brianwc/juriscraper",
"id": "f0f6d30c49661b90176518560608fc97cc5db778",
"size": "... |
import sys
import unittest
import maya.cmds as cmds
import pymel.core as pm
import pymel.core.uitypes as ui
import pymel.core.windows as windows
class TestMenu(unittest.TestCase):
def setUp(self):
cmds.setParent(None, menu=1)
self.win = cmds.window()
def tearDown(self):
cmds.deleteUI(se... | {
"content_hash": "d513e2d8f0549a64c93cc5331a7fe276",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 79,
"avg_line_length": 34.36666666666667,
"alnum_prop": 0.6217264791464597,
"repo_name": "CountZer0/PipelineConstructionSet",
"id": "e1ea9ebd4cd81794008813fee36ceab72ae72173"... |
"""Regression test for issue #51."""
import unittest
import os.path
from xml.etree import ElementTree as ET
from statik.generator import generate
class TestStaticPagesFromProjectDynamicContext(unittest.TestCase):
def test_issue(self):
test_path = os.path.dirname(os.path.realpath(__file__))
outp... | {
"content_hash": "97b3d81b81efb7aca7222fc7f7375a03",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 87,
"avg_line_length": 36.80434782608695,
"alnum_prop": 0.6196101594802126,
"repo_name": "thanethomson/statik",
"id": "50c41cee084684043be1851b0c88c7f4c165f18b",
"size": "1... |
from django.core.management.base import BaseCommand, CommandError
from conference import models
from collections import defaultdict
from optparse import make_option
class Command(BaseCommand):
"""
"""
option_list = BaseCommand.option_list + (
make_option('--by-ticket',
action='store_tr... | {
"content_hash": "b028524eef1662e062bb8a8f26e96aa5",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 128,
"avg_line_length": 39.29530201342282,
"alnum_prop": 0.40478223740392827,
"repo_name": "EuroPython/epcon",
"id": "944da163a191be0e343a97e765dd28f6ca37e661",
"size": "5... |
import pygame
import sys
from pygame.locals import *
from variables import *
from Player import *
from Card import *
from create_board import *
from create_game_options import *
from create_player_info import *
from handle_mouse_event import *
from update_game_dice import *
from handle_game import *
# roll dice and ... | {
"content_hash": "baec2d104fab21a3e305a0357225b128",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 121,
"avg_line_length": 26.292134831460675,
"alnum_prop": 0.6425213675213676,
"repo_name": "idnaninitesh/monopoly_python",
"id": "e8f4f87cf87274425a39e023a46c54c845d85add",
... |
import shlex, subprocess
from StringIO import StringIO
from django.db import models
from django.db.models.fields import IPAddressField
import paramiko
from paramiko.rsakey import RSAKey
from expedient.clearinghouse.aggregate.models import Aggregate
from expedient.clearinghouse.resources.models import Resource, Sliver
f... | {
"content_hash": "f1ff4b26d7f7d34b5e3672eb39ef6197",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 78,
"avg_line_length": 35.85140562248996,
"alnum_prop": 0.5735409432060042,
"repo_name": "dana-i2cat/felix",
"id": "4442c7cdcfc7b4f4455287ef3e1423e0b342cbf3",
"size": "892... |
import argparse
from flask import Flask, render_template
import app_config
from render_utils import make_context, urlencode_filter
import static
app = Flask(app_config.PROJECT_NAME)
app.jinja_env.filters['urlencode'] = urlencode_filter
# Example application views
@app.route('/')
def index():
"""
Example vie... | {
"content_hash": "f38a05bba605eb4c5383f84172cd7fd5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 69,
"avg_line_length": 24.64,
"alnum_prop": 0.6704545454545454,
"repo_name": "nprapps/visits",
"id": "cd46d0cab0ec0ab0f39e923f1e342b710573ea3c",
"size": "1255",
"binary":... |
import pytest
def test_list_field_no_field():
""" Assert that raises error if a ListField is given without a type, for instance: ListField() """
from graphene_mongodb.fields.special_fields import list_field
from mongoengine import ListField
with pytest.raises(Exception) as e_info:
list_field(... | {
"content_hash": "05aaad4f7ee80b8c057ae3abb7602b5c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 110,
"avg_line_length": 42.53846153846154,
"alnum_prop": 0.6473779385171791,
"repo_name": "joaovitorsilvestre/graphene-mongo",
"id": "9d72a74856c999504d83c2cc1f45ae48fbd8e1c0... |
""" QiBuild """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from qidoc.test.conftest import TestDocWorkTree
def test_convert_from_qi2(qidoc_action):
""" Test Convert From Qi 2 """
qidoc_action.add_test_project("qidoc2/with_src")
qid... | {
"content_hash": "6eb29a4bb8cf473869df0d171cc6fd82",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 52,
"avg_line_length": 31,
"alnum_prop": 0.7050691244239631,
"repo_name": "aldebaran/qibuild",
"id": "3fcfd06b91a4c49233eec97be179db50f983f293",
"size": "631",
"binary": ... |
import ast
from sys import version_info
from pyflakes import messages as m, checker
from pyflakes.test.harness import TestCase, skipIf, skip
class Test(TestCase):
def test_undefined(self):
self.flakes('bar', m.UndefinedName)
def test_definedInListComp(self):
self.flakes('[a for a in range(10... | {
"content_hash": "d41547043135198fde70a3dc0f7bb11f",
"timestamp": "",
"source": "github",
"line_count": 871,
"max_line_length": 87,
"avg_line_length": 29.62686567164179,
"alnum_prop": 0.5185041658593296,
"repo_name": "sonntagsgesicht/regtest",
"id": "e0e628dc296649f6391d5a5f503c9f53e712514c",
"size... |
from django.http import HttpResponse
from django.utils import unittest
from django.test.client import Client
from postleware import PostResponseCachebusterMiddleware
class PostResponseMiddleware(unittest.TestCase):
def setUp(self):
self.client = Client()
def test_header_added_when_necessary(self):
... | {
"content_hash": "fe0ffe47f079e465482c7c94f8b08cc5",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 39.025,
"alnum_prop": 0.6860986547085202,
"repo_name": "thurloat/django-postleware",
"id": "f082e268965011ef766791aca3fd9a01d4ef2343",
"size": "1561"... |
"""
Test for the automatic completion text editor.
"""
import unittest, sys
from PyQt4 import QtCore, QtGui
from datafinder.core.search_restriction import SearchRestrictionParser
from datafinder.gui.user.dialogs.search_dialog.search_query_editor import SearchQueryEditor, SearchQueryAnalyzer
__version__ = "$Revis... | {
"content_hash": "9b3852523352d29c61e1f2e1a461540e",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 129,
"avg_line_length": 47.35616438356164,
"alnum_prop": 0.689470639282615,
"repo_name": "DLR-SC/DataFinder",
"id": "cc4713fa8c9b2a35b248abc9b57450b114f69d36",
"size": "86... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace SeriesNamer.tvdb
{
public class Series
{
private readonly string seriesid;
private readonly string name;
public Series(string id, string name)
{
this.s... | {
"content_hash": "78f65325c296cc4b6144b7489b56b762",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 94,
"avg_line_length": 25.686046511627907,
"alnum_prop": 0.504753282028067,
"repo_name": "madeso/prettygood",
"id": "e47cc8c3386407b70daa42f15e668e1d5fa6c9df",
"size": "221... |
from pyon import loads, dumps
__all__ = ['Node', 'Leaf', 'resolverName']
def resolverName(name):
"""
Return new function for creation
of node or leaf with a given tag name
or return existing one from the cache.
"""
def func(value=None, tag=name):
if value is None:
... | {
"content_hash": "4c1c7b5309cdefcfa84d24b8d983176e",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 64,
"avg_line_length": 24.584158415841586,
"alnum_prop": 0.5058397100281917,
"repo_name": "intellimath/pyon",
"id": "220dadb7810385f0575741826fd530023dccf81d",
"size": "24... |
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
os.path.split(parent_dir)[1] == 'pygame')
if not is_pygame_pkg:
sys.... | {
"content_hash": "1406dd4d1d86a83c56606c7c1477577d",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 83,
"avg_line_length": 35.19457013574661,
"alnum_prop": 0.5371560812548213,
"repo_name": "JRock007/boxxy",
"id": "c79c4db08cd8e876c600ad45c2acde6181f0a145",
"size": "7860"... |
import getpass
import json
import requests
import util
import auth
import compose
from service import Service
from backup import Backup
from organization import Organization
from execute import execute
def login(username, password, cloud, endpoint):
if not username:
username = raw_input('Username: ')
... | {
"content_hash": "dfada720e15202170af836252eb767d7",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 109,
"avg_line_length": 29.105263157894736,
"alnum_prop": 0.6767631103074141,
"repo_name": "someus/alauda-CLI",
"id": "2c950cb0c5f1273c91c6c5e5e268eb64009b0d05",
"size": "... |
u"""
.. module:: organizations
"""
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.shortcuts import render
from django.utils.text im... | {
"content_hash": "d34c1a5b4ee183e309244e6563a51b33",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 31.745192307692307,
"alnum_prop": 0.5673178858094805,
"repo_name": "nbbn/volontulo",
"id": "a93d86b4f50cad0d2a7038282d17d4419fc98d97",
"size": "6642... |
"""
Factorial digit sum
Computes the sum of the digits of nbr!
Konstantinos Ameranis 10.9.2013
"""
def factorial( n ):
if n == 1:
return 1
return n * factorial( n - 1 )
nbr = input("Enter the number: ")
nbr = factorial(nbr)
summ = 0
while nbr:
summ += nbr % 10
nbr /= 10
print summ
| {
"content_hash": "630725590c6fd736162ae7d6ea0db146",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 38,
"avg_line_length": 17.11111111111111,
"alnum_prop": 0.6136363636363636,
"repo_name": "kameranis/Project_Euler",
"id": "b7daa521dbaf13701256a0cb2a59a9d0f030f586",
"size"... |
"""Fail if the C extension module doesn't exist.
Only really intended to be used by internal build scripts.
"""
import sys
sys.path[0:0] = [""]
import bson
import pymongo
if not pymongo.has_c() or not bson.has_c():
sys.exit("could not load C extensions")
| {
"content_hash": "72e4d729d68e1fecc69fec12b6f05092",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 58,
"avg_line_length": 20.23076923076923,
"alnum_prop": 0.6996197718631179,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "628e23f1f599555a88a6c21ce15bcba5f1f36ea4",
"size":... |
"""Test runner for COT.commands doctest tests."""
import logging
from logging import NullHandler
from doctest import DocTestSuite
from unittest import TestSuite
logging.getLogger('COT').addHandler(NullHandler())
def load_tests(*_):
"""Load doctests as unittest test suite.
For the parameters, see :mod:`uni... | {
"content_hash": "a3d38f90101ca6a9dfa51c3a61867aaa",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 76,
"avg_line_length": 29.59090909090909,
"alnum_prop": 0.7373271889400922,
"repo_name": "glennmatthews/cot",
"id": "f2fccd58fd2f81616cad0e8291e968c54b99baf2",
"size": "138... |
from __future__ import unicode_literals
from django.db import migrations
def convert_lines_data(apps, schema_editor):
CartLine = apps.get_model('cart', 'CartLine')
# Iterate over all cart lines, due to wrong JSONField None handling
for line in CartLine.objects.all():
if line.data is None:
... | {
"content_hash": "fd193b81f55b22482a9a9c82de7d869d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 25,
"alnum_prop": 0.6417391304347826,
"repo_name": "itbabu/saleor",
"id": "7b0c33e2e53e39fd40a651581f82521d11687aae",
"size": "648",
"binary": fals... |
import os
from urlparse import urljoin, urlparse
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.admin.options import ModelAdmin
from django.contrib.staticfiles import finders
from django.core.exceptions import PermissionDenied
from django.co... | {
"content_hash": "0a972d6f8fb5ab35b4188a51072c4b2f",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 79,
"avg_line_length": 38.130434782608695,
"alnum_prop": 0.6637685290763968,
"repo_name": "stbarnabas/mezzanine",
"id": "325e26b078085302faeb87ffaed9d84ed9554123",
"size":... |
import pytest
from saltfactories.utils import random_string
import salt.utils.files
import salt.utils.platform
import salt.utils.stringutils
from tests.support.case import ModuleCase
from tests.support.helpers import runs_on
from tests.support.unit import skipIf
if not salt.utils.platform.is_windows():
import grp... | {
"content_hash": "56d6b3b46d763cec04deceeb9c425207",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 88,
"avg_line_length": 36.70124481327801,
"alnum_prop": 0.5843979649519503,
"repo_name": "saltstack/salt",
"id": "8cf368e1555e09e976d0728ad0cbe1dc3d904955",
"size": "8845"... |
from polltaskclient.http import HTTPClient
from polltaskclient.openstack.common import utils
from polltaskclient.v1.device import DeviceManager
from polltaskclient.v1.storage import StorageManager
from polltaskclient import Logger as LOG
class Client(object):
def __init__(self, endpoint, *args, **kwargs):
... | {
"content_hash": "dbc495d125a3fccf56d5a2197988c697",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 85,
"avg_line_length": 41.75,
"alnum_prop": 0.7170658682634731,
"repo_name": "xuweiliang/Codelibrary",
"id": "d5099b79a613b1d18e5ce804e6c89bc5aa425624",
"size": "668",
"b... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(verbose_name='ID', serialize... | {
"content_hash": "b79435114fdd7bde28b62e8f85e91e74",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 114,
"avg_line_length": 34.32432432432432,
"alnum_prop": 0.5346456692913386,
"repo_name": "CorbanU/corban-shopify",
"id": "d24c01c880aaba185d22768864de6e4c0d4d129a",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.