text stringlengths 4 1.02M | meta dict |
|---|---|
import io
import json
import pytest
from ansible_inventory_hacks.filters import instance_filter
@pytest.fixture
def output(sampledata):
return instance_filter.filter_json(sampledata['ec2']['inventory'])
@pytest.fixture
def fake_stdin(sampledata):
return io.BytesIO(json.dumps(sampledata['ec2']['inventory']... | {
"content_hash": "e5fcbe7f8efbb890892b1f3c836ab0a7",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 70,
"avg_line_length": 21.95744680851064,
"alnum_prop": 0.6346899224806202,
"repo_name": "meatballhat/ansible-inventory-hacks",
"id": "4268ee8bb7a0d5d83d98466ae53f204e699777f... |
"""
Model optimisation.
@author Yann Carbonne / modified by Aurelien Galicher
Use of hyperopt module to optimise a XGBoost model.
Great tutorial: http://conference.scipy.org/proceedings/scipy2013/pdfs/bergstra_hyperopt.pdf
Store each predictions in folder hyperopt_preds/
"""
from preprocessing import load_preprocessin... | {
"content_hash": "595045397f5c2d2306f8791e346cdd28",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 122,
"avg_line_length": 39.166666666666664,
"alnum_prop": 0.6271685761047463,
"repo_name": "AurelienGalicher/DStoolkit",
"id": "20e4dce94eebf5276ee5bdcf787383f6b707816a",
"... |
from .. import db
from werkzeug.security import generate_password_hash, check_password_hash
import random, string
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String, unique=True)
first_name = db.Column(db.String)
last_name = db.Column(db.String)
... | {
"content_hash": "ab230e8f9f7bbc7c47756ef0df7fbd82",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 73,
"avg_line_length": 25.366197183098592,
"alnum_prop": 0.7207107162687396,
"repo_name": "mereckaj/CS4098-Group-E",
"id": "605c5bde631d9df58636f77a8c22330b864023e4",
"size... |
import pymongo
from .model_base import Model
from girder import logprint
from girder.exceptions import ValidationException
from girder.settings import SettingDefault
from girder.utility import setting_utilities
from girder.utility._cache import cache
class Setting(Model):
"""
This model represents server-wid... | {
"content_hash": "4962bcf2d85903aaf0526ecac612f4d4",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 84,
"avg_line_length": 34.98101265822785,
"alnum_prop": 0.5657680477655147,
"repo_name": "Kitware/girder",
"id": "c5d0bbf49bf592621fb206962c819a8bad4c65d5",
"size": "5551"... |
from sqlalchemy import Column, DateTime, Float, String, text
from sqlalchemy.ext.declarative import declarative_base
from copy import deepcopy, copy
Base = declarative_base()
metadata = Base.metadata
class Host(Base):
__tablename__ = 'host'
entityId = Column(String(64), primary_key=True, nullable=False)
... | {
"content_hash": "8622e2e971edc8d480c2dfb034ee90d9",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 138,
"avg_line_length": 48.144578313253014,
"alnum_prop": 0.688938938938939,
"repo_name": "attybro/FIWARELab-monitoringAPI",
"id": "b41d8276f17767ddfb57ecfcc24a1249e7f1e90c",... |
"""Support for Xiaomi Miio."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
import logging
import async_timeout
from miio import (
AirFresh,
AirHumidifier,
AirHumidifierMiot,
AirHumidifierMjjsq,
AirPurifier,
AirPurifierMB4,
AirPurifier... | {
"content_hash": "cf5d1c28a62a80e7361ca370e0dffdae",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 109,
"avg_line_length": 31.255364806866954,
"alnum_prop": 0.6488843117061449,
"repo_name": "aronsky/home-assistant",
"id": "de5baf69683ab5fbcf6cab5dd78e151f8b6e1595",
"siz... |
class MetaMixin(object):
"""Safe way to store meta information related to class object.
We are storing information in class object instead of the instance.
Information is stored in dict that is initialized only once during the
load of module, it means that all subclasses of this class will point to
... | {
"content_hash": "8ca4a4e41aa18f7c9404066645ea6274",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 77,
"avg_line_length": 31.61111111111111,
"alnum_prop": 0.5216168717047451,
"repo_name": "eonpatapon/rally",
"id": "36727ccc3d5999210e04e907cde02977a7dea780",
"size": "3476... |
"""Flock platform for notify component."""
import asyncio
import logging
import async_timeout
import voluptuous as vol
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.com... | {
"content_hash": "c3e1b7df5b373e81d907bad5b7e22e0d",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 34.26315789473684,
"alnum_prop": 0.65284178187404,
"repo_name": "MartinHjelmare/home-assistant",
"id": "384bf26599ad221ebd78322af3e670dcdd6db374",
"s... |
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@app.errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500 | {
"content_hash": "c6b420853801fb2abe6e179fa3bd1fde",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 23.5,
"alnum_prop": 0.7180851063829787,
"repo_name": "Walk-ContryRoad/Lemon",
"id": "76eab7f5da586905254b346499098622d8ccbbaa",
"size": "188",
"bina... |
"""Helpers to easily generate properly formatted remarkup."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlcon_remarkup
#
# Public Functions:
# code_block
# dict_to_table
# encased
# ... | {
"content_hash": "1cf04b0d6ce69587535f544f616aa622",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 79,
"avg_line_length": 26.11,
"alnum_prop": 0.5683646112600537,
"repo_name": "aevri/phabricator-tools",
"id": "d2b7659cdece92e705fda761bedb94c9edef51d6",
"size": "5222",
... |
from copy import copy
import warnings
import pytz
import pandas as pd
import numpy as np
from datetime import datetime
from itertools import groupby, chain
from six.moves import filter
from six import (
exec_,
iteritems,
string_types,
)
from operator import attrgetter
from zipline.errors import (
Or... | {
"content_hash": "8efbd86ca936ca7ded9d29e80abf8bb4",
"timestamp": "",
"source": "github",
"line_count": 1221,
"max_line_length": 98,
"avg_line_length": 36.202293202293205,
"alnum_prop": 0.5786258851209194,
"repo_name": "euri10/zipline",
"id": "43aea515e8f814557cc681ffad446eec905e5386",
"size": "447... |
"""
tests.components.automation.test_mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests mqtt automation.
"""
import unittest
import homeassistant.core as ha
import homeassistant.components.automation as automation
from tests.common import mock_mqtt_component, fire_mqtt_message
class TestAutomationMQTT(unittest.TestCa... | {
"content_hash": "66572faf0174179ca50c6831df2e172f",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 73,
"avg_line_length": 32.10569105691057,
"alnum_prop": 0.5148138769308686,
"repo_name": "pottzer/home-assistant",
"id": "516eda539472c0686e275fe7bc9e27688c27e52e",
"size"... |
"""Utilities for OAuth.
Utilities for making it easier to work with OAuth 2.0
credentials.
"""
__author__ = '[email protected] (Joe Gregorio)'
import pickle
import threading
from client import Storage as BaseStorage
class Storage(BaseStorage):
"""Store and retrieve a single credential to and from a file."""... | {
"content_hash": "9f97bc4542d3222e80e350756381780c",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 66,
"avg_line_length": 21.72,
"alnum_prop": 0.6528545119705341,
"repo_name": "karalan/google-tasks-porter",
"id": "9a52ee44495f84ea7ea21a2f49f58bb03fcd93cb",
"size": "1667"... |
"""Python vCloud API Interface Test - Memchange
Desired behaviour:
We begin by getting the memory settings on a VM.
We then shutdown the machine remotely, and wait for this process to finish.
We then change the memory settings and wait for a signal that the change has completed.
We then activate the machine again.
We... | {
"content_hash": "e01c883de02ac139673e2cb928d1f007",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 87,
"avg_line_length": 30.470588235294116,
"alnum_prop": 0.6959459459459459,
"repo_name": "bmcollier/vctools",
"id": "a08ce3713885ecb41a8853d678e86991e2eef821",
"size": "10... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import tensorflow as tf
class ImageRecognizer:
def __init__(self, path, graph, labels, input_layer_name, output_layer_name, num_top_predictions):
self.path = path
... | {
"content_hash": "3f2af123792c16d693bbcf100ca33f52",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 102,
"avg_line_length": 38.47540983606557,
"alnum_prop": 0.6365573072006817,
"repo_name": "mmiranda96/chilaiquil-api",
"id": "ec61f97332b9a51a18339475055ca310e1a2ab25",
"si... |
import argparse
import string
import Image, ImageOps
import logging
import urllib
import csv
import time
import calendar
from datetime import datetime
from urlparse import urlparse
# Main ########################################################################
if __name__ == '__main__':
parser = argparse.ArgumentPa... | {
"content_hash": "81ca6ec6e52018ec221a55abd1ed69da",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 98,
"avg_line_length": 45.280701754385966,
"alnum_prop": 0.644711352189074,
"repo_name": "obujor/PalMaS",
"id": "9932862a8865b6d8271f062a4ef9367a97b98da2",
"size": "2604",
... |
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.lib import exceptions as lib_exc
from tempest import test
CONF = config.CONF
class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest):
@classmethod
def skip_checks(cls):
super(... | {
"content_hash": "98585a67703ad128363b564f71692e3c",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 78,
"avg_line_length": 41.132075471698116,
"alnum_prop": 0.6495412844036698,
"repo_name": "Tesora/tesora-tempest",
"id": "1f5bb0de7c1b1f3bcf7dab4116f07ea44e7993d7",
"size":... |
from __future__ import print_function
from time import sleep
from boto.ec2 import autoscale
from boto import exception
from paaws.config import Config, attributes
from paaws.userdata import Userdata
from paaws import iam
from paaws import subnets
from paaws import securitygroups
from paaws.sns import get_sns_topic_ar... | {
"content_hash": "c3593c40b1cbe36dcec4a54d59b366f8",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 128,
"avg_line_length": 37.28611111111111,
"alnum_prop": 0.5907025255159055,
"repo_name": "phspagiari/paaws",
"id": "b4cace18735093640be88d94577833d9d51dc695",
"size": "13... |
from unittest import TestCase
try:
from unittest import SkipTest
except:
from unittest2 import SkipTest
from random import randint
from threading import Thread
from socket import socket, AF_INET, SOCK_STREAM
from subprocess import Popen,PIPE,STDOUT
import sys, os, string, subprocess
from proton import Connection, T... | {
"content_hash": "ab64ca17560c78d58f975df511bb0940",
"timestamp": "",
"source": "github",
"line_count": 548,
"max_line_length": 104,
"avg_line_length": 33.14598540145985,
"alnum_prop": 0.5914996696762828,
"repo_name": "Azure/qpid-proton",
"id": "c819d4ed13f729ea809e61e8a779bb849b2e5d05",
"size": "1... |
import socket
import os
## \brief Maximum number of bytes to read from a socket in one go
BUF_SIZE = 4096
## \brief Maximum length of the contents of a TLV object
LEN_MAX = 65536
# Error codes
ERR_OK = 0
ERR_SOCK_CREATE = 1
SOCK_ERR_BIND = 2
SOCK_ERR_ACCEPT = 3
ERR_REMOVE_PATH = 4
ERR_SOCK_READ = 5
ERR_SOCK_WRITE = 6... | {
"content_hash": "eb4d8671f6e26cf06847dd08ffd3a417",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 119,
"avg_line_length": 37.13133640552996,
"alnum_prop": 0.5929878994725412,
"repo_name": "rmsk2/Das-grosse-Quiz",
"id": "adacc3e650cdf1f679f1479de82d8be900c6f0bd",
"size"... |
"""
Example DAG demonstrating setting up inter-DAG dependencies using ExternalTaskSensor and
ExternalTaskMarker.
In this example, child_task1 in example_external_task_marker_child depends on parent_task in
example_external_task_marker_parent. When parent_task is cleared with 'Recursive' selected,
the presence of Exter... | {
"content_hash": "7473bcde381c9a78f311bbd980b41503",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 97,
"avg_line_length": 35.60606060606061,
"alnum_prop": 0.7459574468085106,
"repo_name": "danielvdende/incubator-airflow",
"id": "733b7327566338dabc1dd53494f4d3db7d9686e0",
... |
"""Control switches."""
from datetime import timedelta
import logging
from typing import Any
from ProgettiHWSW.relay import Relay
import async_timeout
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeass... | {
"content_hash": "b52cf4dff2e7bc753052ddf5c248b9ab",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 81,
"avg_line_length": 29.869565217391305,
"alnum_prop": 0.6528384279475983,
"repo_name": "mezz64/home-assistant",
"id": "0aab943e3858f4e64380dc9991ab2ebe2f9c07e4",
"size":... |
import sys
import inspect
from py4j.protocol import Py4JJavaError
__all__ = []
def _exception_message(excp):
"""Return the message from an exception as either a str or unicode object. Supports both
Python 2 and Python 3.
>>> msg = "Exception message"
>>> excp = Exception(msg)
>>> msg == _except... | {
"content_hash": "05d81ca180e2b08cf4a0da3fb69e7d36",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 97,
"avg_line_length": 29.62,
"alnum_prop": 0.6347062795408508,
"repo_name": "joseph-torres/spark",
"id": "49afc13640332dc538eaeadfe85c91335c92cc7d",
"size": "2291",
"bin... |
from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import jira_notifier
import queue
from tests import base
def alarm():
return {'tenantId': '0',
'alarmId': '0',
'alarmDefinitionId': 0,
'alarmName': 'test... | {
"content_hash": "1b4f045bcacb078f1010aa27639ec2c6",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 97,
"avg_line_length": 45.55652173913043,
"alnum_prop": 0.5499141057453713,
"repo_name": "openstack/monasca-notification",
"id": "a0750f036008664bb9405536fc477a6bcf27c873",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Todo',
fields=[
('id', models.AutoField(auto_create... | {
"content_hash": "9d49ffc4fe360c2f1b7d544011ae1cde",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 24.545454545454547,
"alnum_prop": 0.5666666666666667,
"repo_name": "eswar2016/drf-redux",
"id": "d54dd21e86b9e30460a7beb2037698fa9f60d0b7",
"size": ... |
import django
from django import forms
from django.conf.urls import url
from django.contrib import admin
# from django.core.urlresolvers import reverse
from django.http.response import JsonResponse
from filer import settings as filer_settings
from ..models import File, Image
from ..utils import file_is_image_by_name
... | {
"content_hash": "4881cb5508f18904dca08d49fa17d345",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 76,
"avg_line_length": 29.270114942528735,
"alnum_prop": 0.49970547810720595,
"repo_name": "rouxcode/django-filer-addons",
"id": "34eaac2092a0af36f3f9463101677c5fac8db7ed",
... |
'''
Created on Oct 19, 2015
@author: wirkert
'''
import unittest
import numpy as np
import mc.camera as cam
class TestCamera(unittest.TestCase):
def setUp(self):
# setup a imaging system that does almost nothing
# (camera with 8 bands, each the same
# and just taking all the wavelengths... | {
"content_hash": "71154149bdf93a5bef7de38789680658",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 84,
"avg_line_length": 45.586666666666666,
"alnum_prop": 0.5598128107633811,
"repo_name": "swirkert/ipcai2016",
"id": "b930bccdcef5bbb4ee8ee95fd1d5b3cef280c403",
"size": "3... |
from micropython import const
# Bluetooth Status/Error Codes
# Vendor-specific error codes
# Error codes defined by ST related to BlueNRG stack
# The command cannot be executed due to the current state of the device.
BLE_STATUS_FAILED = const(0x41)
# Some parameters are invalid.
BLE_STATUS_INVALID_PARAMS = const(0x... | {
"content_hash": "a16a48456888750ef7d26e8028850f54",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 78,
"avg_line_length": 36.57142857142857,
"alnum_prop": 0.7743389423076923,
"repo_name": "dmazzella/uble",
"id": "5cc7fdfd2399b2d2bcc13792fdddd3be11bd096b",
"size": "3376",... |
from base64 import b64decode
from flask import Response, Blueprint, abort, request
from analyticpi import app
from analyticpi.db import database
from analyticpi.models import PageView
from analyticpi.views import tracking_view
# 1 pixel GIF, base64-encoded.
BEACON = b64decode(
'R0lGODlhAQABAIAAANvf7wAAACH5BAEAAA... | {
"content_hash": "35bb2ff4f81de861fbd5c27d4dbab225",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 96,
"avg_line_length": 28.8,
"alnum_prop": 0.6814236111111112,
"repo_name": "analyticpi/analyticpi",
"id": "5c82101f442469a2c15247cf800bfa5e9f37c0ba",
"size": "1152",
"bi... |
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
# Undeclared XML namespace
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
# <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xml="http://www.w3.org/XML/19... | {
"content_hash": "45eaab8cd03ab0768b35a6047cbbb1cc",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 142,
"avg_line_length": 36.357142857142854,
"alnum_prop": 0.7177472167648985,
"repo_name": "jonfoster/pyxb-upstream-mirror",
"id": "55e0b16783992ecf025e66917237967e814ee989",... |
from core.domain import exp_domain
from core.domain import stats_domain
from core.tests import test_utils
import feconf
import utils
class ExplorationStatsTests(test_utils.GenericTestBase):
"""Tests the ExplorationStats domain object."""
def _get_exploration_stats_from_dict(self, exploration_stats_dict):
... | {
"content_hash": "7aa070bd3fb7294edfdffd99fb722805",
"timestamp": "",
"source": "github",
"line_count": 682,
"max_line_length": 80,
"avg_line_length": 41.57184750733138,
"alnum_prop": 0.5945259593679458,
"repo_name": "himanshu-dixit/oppia",
"id": "4053a2829ee2d18ad293c7e787bdde66a60ed840",
"size": ... |
def MainWork():
# Open a MySQL connection
try:
dh = dbhandler.MySQLhandler()
except dbhandler.DBException, e:
WriteLog('',str(e))
sys.exit(1)
# Loop over fits files on command line
for file in sys.argv[1:]:
# If file does not exist, do not go further
if not os.path.exists(file):
... | {
"content_hash": "d1bedbddf185db8af2e4374447a261aa",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 80,
"avg_line_length": 23.758333333333333,
"alnum_prop": 0.6439845668186601,
"repo_name": "sniemi/SamPy",
"id": "d526b6dc5f30d4fecf5dcba945b1d1397781cb12",
"size": "2930",... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import BaseUserManager
from django.core.validators import validate_email
from django.core.exceptions import ValidationError, ObjectDoesNotExist
import re
from django.db import OperationalError
from build... | {
"content_hash": "f5eff228656f63decde2bcaf31ba8045",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 94,
"avg_line_length": 30.914893617021278,
"alnum_prop": 0.557639366827254,
"repo_name": "buildbuild/buildbuild",
"id": "8f6725a315a22006ae6b66e7e4b2744f65e0d773",
"size":... |
import os
from collections import namedtuple
from collections.abc import Sequence
from urllib.parse import urlparse, urlunparse
import ipaddress
import markdown
from mkdocs import utils, theme, plugins
from mkdocs.config.base import Config, ValidationError
class BaseConfigOption:
def __init__(self):
sel... | {
"content_hash": "dd06ba3608ed13dbeb076aaaf914a27e",
"timestamp": "",
"source": "github",
"line_count": 684,
"max_line_length": 104,
"avg_line_length": 34.9546783625731,
"alnum_prop": 0.5855117319837718,
"repo_name": "waylan/mkdocs",
"id": "858fe7ce4c1ebe06fa66c0468c9cd5842a8b5602",
"size": "23909"... |
import numpy as np
from math import pi, log
import pylab
from scipy import fft, ifft
from scipy.optimize import curve_fit
i = 10000
x = np.linspace(0, 3.5 * pi, i)
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 *
np.random.randn(i))
def _datacheck_peakdetect(x_axis, y_axis):
if x_axis is... | {
"content_hash": "7788f30841188de46059cb643224fd2d",
"timestamp": "",
"source": "github",
"line_count": 733,
"max_line_length": 78,
"avg_line_length": 38.551159618008185,
"alnum_prop": 0.590947696227617,
"repo_name": "zhuww/planetclient",
"id": "d7cf46924b07222b7003f9407b2d2e768704df8f",
"size": "2... |
"""Handler for the image of the sdk API."""
import json
from zvmconnector import connector
from zvmsdk import config
from zvmsdk import log
from zvmsdk import utils
from zvmsdk.sdkwsgi.handlers import tokens
from zvmsdk.sdkwsgi.schemas import image
from zvmsdk.sdkwsgi import util
from zvmsdk.sdkwsgi import validation
... | {
"content_hash": "c52eb5446337cf6006a83f4d2e0b1389",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 79,
"avg_line_length": 29.35151515151515,
"alnum_prop": 0.6411315300433615,
"repo_name": "mfcloud/python-zvm-sdk",
"id": "1657210ca59ae9a2c3272f2ab42d58a62a708bd6",
"size"... |
import struct
import png
class FormatError(Exception):
pass
class Profile:
"""An International Color Consortium Profile (ICC Profile)."""
def __init__(self):
self.rawtagtable = None
self.rawtagdict = {}
self.d = dict()
def fromFile(self, inp, name='<unknown>'):
# Se... | {
"content_hash": "19eed4964c476b16cb02d8d66085b676",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 155,
"avg_line_length": 30.106299212598426,
"alnum_prop": 0.5544658035831045,
"repo_name": "mnaberez/pypng",
"id": "a56ffc498636aa79cf9eeb643612c553bc80e4fc",
"size": "160... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.codegen.antlr.java.antlr_gen import AntlrGen
from pants.base.deprecated import deprecated_module
deprecated_module('1.5.0dev0', 'Use pants.backend... | {
"content_hash": "034e82b36232904cb538e2358439cc6e",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 93,
"avg_line_length": 37.1,
"alnum_prop": 0.7466307277628033,
"repo_name": "mateor/pants",
"id": "88341323fc0b2933de36a8d322982b86589a320b",
"size": "518",
"binary": fal... |
import argparse
import os
import sys
import httplib2
from oslo_serialization import jsonutils as json
from six import moves
from six.moves.urllib import parse as urlparse
from tempest import clients
from tempest.common import credentials
from tempest import config
CONF = config.CONF
CONF_PARSER = None
def _get_co... | {
"content_hash": "debe44ce8e2692a760ff45b6309f4169",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 79,
"avg_line_length": 38.498614958448755,
"alnum_prop": 0.5848323499784142,
"repo_name": "tonyli71/tempest",
"id": "6d53b598a5c238d3edc17882851b4bf1ab268c62",
"size": "14... |
from __future__ import print_function
import os
import json
import subprocess
import signal
from nxtools.common import decode_if_py3, string_types
from nxtools.misc import indent
from nxtools.logging import *
from nxtools.files import FileObject
__all__ = ["ffprobe"]
def ffprobe(input_file, verbose=False):
"""R... | {
"content_hash": "9b33e2eb45149bbc1b9a1e8d1a1ed95e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 99,
"avg_line_length": 31.235294117647058,
"alnum_prop": 0.6151914626490897,
"repo_name": "martastain/nxtools",
"id": "42449f181e82e6548a8cf8574d168f523875e0f4",
"size": "2... |
from django.contrib import admin
from .models import Order, OrderItem, OrderStateChange
class OrderItemInline(admin.TabularInline): # noqa
model = OrderItem
class OrderStateChangeInline(admin.TabularInline): # noqa
model = OrderStateChange
class OrderAdmin(admin.ModelAdmin): # noqa
list_fields = ('... | {
"content_hash": "19b32e273f6061be6a05641fe70a760a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 58,
"avg_line_length": 22.523809523809526,
"alnum_prop": 0.7293868921775899,
"repo_name": "chaosdorf/chaospizza",
"id": "428de3a668bc1950394d3024e4e4b0de5bf58e33",
"size": ... |
import os
import sys
import tarfile
import logging
from uuid import uuid4
from functools import wraps
from StringIO import StringIO
from datetime import datetime
from contextlib import contextmanager
from mock import patch
import cloudify.utils
import cloudify.exceptions
from cloudify import ctx as op_ctx
from cloudi... | {
"content_hash": "6a523a8c0ff7da161211c436dc3baa1a",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 79,
"avg_line_length": 25.407821229050278,
"alnum_prop": 0.6244503078276166,
"repo_name": "codilime/cloudify-cli",
"id": "3090de074d9f2a9b2096afa555d34548b1397ee3",
"size"... |
"""
Example of using MathApp Circle class.
"""
from ggame.point import Point
from ggame.circle import Circle
from ggame.mathapp import MathApp
# P1 is the center of the circle
P1 = Point((0.5, 1))
# P2 is on the perimeter
P2 = Point((1.3, 1))
# define a circle from center and perimeter points
C = Circle(P1, P2)
# allo... | {
"content_hash": "228216df05e5688b20558151931680f9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 65,
"avg_line_length": 24.41176470588235,
"alnum_prop": 0.727710843373494,
"repo_name": "BrythonServer/ggame",
"id": "2e694943d0f6f2090107472c3e024fbaff621ead",
"size": "41... |
from OSMHandler.Checker import Check
from Downloader.Defaults import OSM_MARKING_VERSION
import numpy
import os.path
print "imported Marker.py, inside DB requiring section."
stopfile = '/home/ekmek/Desktop/Project II/stop_dir/stop.txt'
# global variable - we can reuse Marker
ConnHandler = None
def Mark(Segments, rad... | {
"content_hash": "7dd04e575bf146c04edf22e6267a2389",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 145,
"avg_line_length": 31.890173410404625,
"alnum_prop": 0.6697480514772521,
"repo_name": "previtus/MGR-Project-Code",
"id": "80a6d7a380859f1e49c9e8c09eee5b12a7ebf0bc",
"... |
from oslo_config import cfg
from oslo_log import log
from neutron._i18n import _
from nuage_neutron.plugins.common import constants
LOG = log.getLogger(__name__)
underlay_routing_choices = [constants.NUAGE_UNDERLAY_SNAT,
constants.NUAGE_UNDERLAY_ROUTE,
constan... | {
"content_hash": "77653ad0bb03a26bb35e9ef99abc02df",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 79,
"avg_line_length": 44.49193548387097,
"alnum_prop": 0.6083016131955773,
"repo_name": "nuagenetworks/nuage-openstack-neutron",
"id": "f98079aa8be5cb53b49221da8837736037e9... |
"""Contains implementations for each ported operation in NumPy.
Attributes:
decoder_ (TYPE): Description
encoder_ (TYPE): Description
norm_factor_id_ (int): Unique IDs given to norm factor literals
"""
from encoders import *
from weld.weldobject import *
encoder_ = NumPyEncoder()
decoder_ = NumPyDecoder()... | {
"content_hash": "f719da942a47cd2c5eedbc6268d3989a",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 85,
"avg_line_length": 28.847058823529412,
"alnum_prop": 0.547716150081566,
"repo_name": "sppalkia/weld",
"id": "01f349e0ef56465fdfea5d1951701002c52fee57",
"size": "4904",... |
import socket
def Get_local_ip():
"""
Returns the actual ip of the local machine.
This code figures out what source address would be used if some traffic
were to be sent out to some well known address on the Internet. In this
case, a Google DNS server is used, but the specific address does not
matter much. ... | {
"content_hash": "12f010d1e1448ec718ead368723c7de7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 30.90909090909091,
"alnum_prop": 0.6779411764705883,
"repo_name": "lj2007331/lnmp",
"id": "80cd99fabd40f4c4ece7e249a40f6d045654fe0e",
"size": "702",
... |
from __future__ import absolute_import, division, print_function
from itertools import chain
import numpy as np
import torch
from odin.utils import as_tuple
class SequentialNetwork(torch.nn.Sequential):
def __init__(self, *args):
args = list(chain(*[as_tuple(a) for a in args]))
super().__init__(*args)
... | {
"content_hash": "d6945c1b9c907e958f21ad18cb9eab24",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 64,
"avg_line_length": 20.791666666666668,
"alnum_prop": 0.6933867735470942,
"repo_name": "imito/odin",
"id": "6eca22eba08f522fb1cb07da684e8e8c2bbd2667",
"size": "499",
"... |
from cms.api import get_page_draft
from cms.toolbar_pool import toolbar_pool
from cms.toolbar_base import CMSToolbar
from cms.utils import get_cms_setting
from cms.utils.permissions import has_page_change_permission
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugette... | {
"content_hash": "4786f6c1a1983c07e8724ef784547699",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 76,
"avg_line_length": 42.535714285714285,
"alnum_prop": 0.5885810243492863,
"repo_name": "MjAbuz/foundation",
"id": "71f05726793fa3f17f84622c2fdc4b1adae30d42",
"size": "23... |
from pytimeseries.transformer import *
from pytimeseries.extras import *
from pytimeseries.base_model import *
from pytimeseries.AR import *
from pytimeseries.HoltWinters import *
| {
"content_hash": "8e46616e85a18aa5f3082ea121c1f956",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 36.2,
"alnum_prop": 0.8232044198895028,
"repo_name": "jdvelasq/pytimeseries",
"id": "e7bc917dd01ff36db5ab134f05fbe4f8c2389d3c",
"size": "181",
"bina... |
# Hey this is a very long commented line just to trigger pylint's line-too-long message. It is just above a dummy function with a very long code line.
def dummy_function():
print("What a beautiful dummy function with such a very long line inside that it should trigger pylint's line-too-long message ")
# Hey ... | {
"content_hash": "ef82ca8260d6e42eef2e5f33d294f319",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 150,
"avg_line_length": 73.5,
"alnum_prop": 0.7528344671201814,
"repo_name": "ekwoodrich/python-dvrip",
"id": "21cb756551aaf4ffd532b8517ecd15d4d8aecf54",
"size": "492",
"b... |
from test.assert_json import assert_json
from topcoder.spam_checker import solution
def test_spam_checker ():
assert_json('spam_checker', solution)
| {
"content_hash": "817bb3c9df32d383e7d4459bbde6edf3",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 45,
"avg_line_length": 31.6,
"alnum_prop": 0.7468354430379747,
"repo_name": "erichaase/topcoder-python",
"id": "c64324860c09ad6beb242f48b93116fa1a2ef2c5",
"size": "158",
"... |
import argparse
import logging
import shlex
import typing
import unittest
from os import linesep
from os import path
from os.path import exists
from shutil import rmtree
from tempfile import mkdtemp
import pytest
import apache_beam as beam
from apache_beam import Impulse
from apache_beam import Map
from apache_beam i... | {
"content_hash": "9286d78816e852f9eba752f8467b7b58",
"timestamp": "",
"source": "github",
"line_count": 442,
"max_line_length": 80,
"avg_line_length": 36.2579185520362,
"alnum_prop": 0.6484462748034444,
"repo_name": "axbaretto/beam",
"id": "cb6345e77efc6e8dcb7fe81128672efe38af9386",
"size": "16831"... |
'''
error.py - Exception classes for the protobuf package.
This package contains exception classes mapped to the rpc.proto file.
Authors: Martin Norbury ([email protected])
Eric Saunders ([email protected])
Jan Dittberner ([email protected])
May 2009, Nov 2010
'''
# Module imports
from protob... | {
"content_hash": "737cf42636da048c861dba4fc73dca35",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 76,
"avg_line_length": 28.300970873786408,
"alnum_prop": 0.6716981132075471,
"repo_name": "chiiph/protobuf-socket-rpc",
"id": "7321e59c7d5123488f3b30842c99eb626f7a7330",
"... |
'''
This is the GNU Radio II_K7 module. Place your Python package
description here (python/__init__.py).
'''
# import swig generated symbols into the II_K7 namespace
try:
# this might fail if the module is python-only
from II_K7_swig import *
except ImportError:
pass
# import any pure python here
#
| {
"content_hash": "f9300057003c9c9f766a5b1fb91121ef",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 21.785714285714285,
"alnum_prop": 0.7311475409836066,
"repo_name": "Innovative-DSP/gr-II_K7",
"id": "a19199032315692af114b84cd77f4dc2ec686047",
"size... |
from bambou import NURESTFetcher
class NUDSCPRemarkingPoliciesFetcher(NURESTFetcher):
""" Represents a NUDSCPRemarkingPolicies fetcher
Notes:
This fetcher enables to fetch NUDSCPRemarkingPolicy objects.
See:
bambou.NURESTFetcher
"""
@classmethod
def managed_c... | {
"content_hash": "8d8211af61c4e331f47c9f2eb3cdf1c0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 23,
"alnum_prop": 0.648695652173913,
"repo_name": "nuagenetworks/vspk-python",
"id": "431c50500fc246353f0487219bd0b31f50ed0e52",
"size": "2186",
"b... |
"""Indexes on updated_at
Revision ID: cd51533c624
Revises: 1afd15b0581f
Create Date: 2014-09-12 23:01:22.542186
"""
# revision identifiers, used by Alembic.
revision = 'cd51533c624'
down_revision = '1afd15b0581f'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_index('ix_risk_assessment... | {
"content_hash": "e3d7189a3b2f5c8e08789145d4ea4621",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 103,
"avg_line_length": 22.136363636363637,
"alnum_prop": 0.7371663244353183,
"repo_name": "vladan-m/ggrc-core",
"id": "c0f269a167c4f32d81f932e8942a60c56d2d2631",
"size": "... |
import csv
import time
from datetime import datetime
from amazon.api import AmazonAPI
AMAZON_ACCESS_KEY = 'your_access_key'
AMAZON_SECRET_KEY = 'your_secret_key'
AMAZON_ASSOC_TAG = 'your_tag'
PRODUCT_ATTRIBUTES = [
'asin', 'author', 'binding', 'brand', 'browse_nodes', 'ean', 'edition',
'editorial_review', 'e... | {
"content_hash": "43b9489261b6bd1ebecf50197d2e860e",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 119,
"avg_line_length": 40.15555555555556,
"alnum_prop": 0.5617044825677919,
"repo_name": "yuantw/DataCollecting",
"id": "ecfd668dfde19c1b58edf957bc47dea24214630a",
"size":... |
'''
Conventions
-----------
* Unless otherwise specified, the response is always a JSON object
* A successful response is always a dictionary with the following keys: \
'status', 'count', 'data' (in this order). Example:
.. code:: Javascript
{
"status": "success",
"count": "1",
"data": ["AnImpo... | {
"content_hash": "ed7147951361b49610a0ec7a87fc9dc3",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 75,
"avg_line_length": 27.086142322097377,
"alnum_prop": 0.598174778761062,
"repo_name": "NasaAppChallenge/birdseye-server",
"id": "5adb1b515811f6ea326993c3c12d133673f65e9e"... |
from __future__ import absolute_import
import datetime
import six
from ..base import Model
from ..fields import Field, ReadOnlyField, ListField
class OwnerReference(Model):
apiVersion = Field(six.text_type)
blockOwnerDeletion = Field(bool)
controller = Field(bool)
kind = Field(six.text_type)
na... | {
"content_hash": "bccb6574102509e55403dec7a6ff19fa",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 56,
"avg_line_length": 27.38235294117647,
"alnum_prop": 0.7137486573576799,
"repo_name": "fiaas/k8s",
"id": "e658458c2aa1b6f1fa34633d8c1fd824bbd49716",
"size": "2493",
"b... |
from django.conf.urls.defaults import patterns, include, url
from tastypie.api import Api
from monlog.log.api.api import LogResource
from monlog.log.api.api import LogCollectionResource
from monlog.log.api.api import ExpectationCollectionResource
log_resource = LogResource()
log_collection = LogCollectionResource()
ex... | {
"content_hash": "14c2366c035c3aa6d255c2de085a5bfc",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 70,
"avg_line_length": 39.93333333333333,
"alnum_prop": 0.7746243739565943,
"repo_name": "monlog/monlog",
"id": "b8d6eed1af31eca7bf49e489b3dd987af06c32e1",
"size": "599",
... |
from setuptools import setup
setup(
name='sphinx-nameko-theme',
version='0.0.3',
author='onefinestay',
author_email='[email protected]',
description='Sphinx Nameko Theme',
url='https://github.com/onefinestay/sphinx-nameko-theme',
license='MIT',
classifiers=[
'Intended ... | {
"content_hash": "56dd3e7b301a41c2dcd0f19f464d74f4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 61,
"avg_line_length": 29.862068965517242,
"alnum_prop": 0.6073903002309469,
"repo_name": "onefinestay/sphinx-nameko-theme",
"id": "8d972dc4665ae9753aae330e95fe60f6b7376dbd",... |
from setuptools import setup, find_packages
import os
version = '0.1.0'
setup(name='django_drole',
version=version,
description="Django Drole: Zope/Plone inspired roles/permissions",
long_description=open("README.md").read(),
classifiers=[
"Programming Language :: Python",
],
... | {
"content_hash": "2a13e721b61ee8bb0f5c326e59aa470a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 24.35483870967742,
"alnum_prop": 0.5788079470198676,
"repo_name": "iivvoo/django_drole",
"id": "7579478c502afab947dfe41f8b68c9ef9a31cb9c",
"size": "7... |
"""
Martin O'Hanlon
www.stuffaboutcode.com
Pygame radar
Attribution:
Some radar code - http://simpson.edu/computer-science/
Circle on line equation - http://codereview.stackexchange.com/questions/86421/line-segment-to-circle-collision-algorithm
"""
import pygame
import math
import threading
BLACK = (0, 0, 0)
GREE... | {
"content_hash": "ad5cd59162bf7c6085920753d2a71c05",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 120,
"avg_line_length": 31.23856209150327,
"alnum_prop": 0.5287163929281306,
"repo_name": "martinohanlon/PiAwareRadar",
"id": "337c3e8111d707c9d45f6ae3ee7def947ca71cf6",
"... |
"""Tests the Turbinia processor."""
import os
import unittest
import mock
import six
from libcloudforensics.providers.gcp.internal.compute import GoogleComputeDisk
from dftimewolf.lib import state
from dftimewolf.lib import errors
# The easiest way to load our test Turbinia config is to add an environment
# variable... | {
"content_hash": "fb9e79ecb793859ed1aee40362fab075",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 96,
"avg_line_length": 39.937777777777775,
"alnum_prop": 0.6847874471399955,
"repo_name": "log2timeline/dftimewolf",
"id": "38bed1f69dd7772bef9fce246c48a02cfa077c6d",
"siz... |
import webkitpy.thirdparty.unittest2 as unittest
from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
from webkitpy.common.host_mock import MockHost
from webkitpy.common.webkit_finder import WebKitFinder
class BaselineOptimizerTest(unittest.TestCase):
def test_move_baselines(self):
ho... | {
"content_hash": "cb88344e3582654f9ffb81405a7d1a60",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 145,
"avg_line_length": 36.90909090909091,
"alnum_prop": 0.5668308702791461,
"repo_name": "lordmos/blink",
"id": "881d112706cd75d1804ec2ebc1b7e4c523136baf",
"size": "7617"... |
from poultry import readline_dir
def test_readline_dir(tweet_collection_dir):
"""Read a tweet collection directory.
:param str input_dir: the patht to the directory
:return: an iterable of Tweet objects
"""
tweets = list(readline_dir(tweet_collection_dir))
t1, t2, t3 = tweets
assert t... | {
"content_hash": "514ed674be0e182881bf0835290091e5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 23.61111111111111,
"alnum_prop": 0.6964705882352941,
"repo_name": "dimazest/poultry",
"id": "c0c17f50674f99a06cd9353be1483840b67d0927",
"size": "425"... |
from chat import app
from flask.ext.mongoengine import MongoEngine
from pymongo import MongoClient
# client = MongoClient('localhost', 27017)
# db = MongoEngine(app)
| {
"content_hash": "11fc4ed534a71b0045c4a80518c87dc0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 45,
"avg_line_length": 27.833333333333332,
"alnum_prop": 0.7904191616766467,
"repo_name": "fengsp/chat",
"id": "4fd99ff2932b223a1192faddedc4109740c4c152",
"size": "167",
"... |
from django.test import TestCase
from push_notifications.api.rest_framework import (
APNSDeviceSerializer, GCMDeviceSerializer, ValidationError
)
GCM_DRF_INVALID_HEX_ERROR = {"device_id": [u"Device ID is not a valid hex number"]}
GCM_DRF_OUT_OF_RANGE_ERROR = {"device_id": [u"Device ID is out of range"]}
class APN... | {
"content_hash": "6322d8ba196b26c7270725fb16ea6816",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 89,
"avg_line_length": 32.29545454545455,
"alnum_prop": 0.7112362186253812,
"repo_name": "jleclanche/django-push-notifications",
"id": "5844ea8bc5e17eb3297c629357dc018be8138... |
"""Archive manipulation library for the Docker rules."""
import os
from StringIO import StringIO
import tarfile
class SimpleArFile(object):
"""A simple AR file reader.
This enable to read AR file (System V variant) as described
in https://en.wikipedia.org/wiki/Ar_(Unix).
The standard usage of this class is... | {
"content_hash": "766b74fa1798d0f1be66d9327507dc4a",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 79,
"avg_line_length": 33.05524861878453,
"alnum_prop": 0.6224302189537022,
"repo_name": "charlieaustin/bazel",
"id": "0f9c4288578f999a5dd5c933d956169c6aa19dc5",
"size": "... |
from datasketch.hyperloglog import HyperLogLog, HyperLogLogPlusPlus
from datasketch.minhash import MinHash
from datasketch.b_bit_minhash import bBitMinHash
from datasketch.lsh import MinHashLSH
from datasketch.inverted_index import InvertedIndex
from datasketch.weighted_minhash import WeightedMinHash, WeightedMinHashGe... | {
"content_hash": "4907b6bb0affa2a91e1182f6197c7ba0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 81,
"avg_line_length": 43.46153846153846,
"alnum_prop": 0.8831858407079646,
"repo_name": "arbazkhan002/datasketch",
"id": "6607870f5bb35fd381c774221dada144d20b04b0",
"size"... |
from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal
from toontown.hood import Place
from direct.showbase import DirectObject
from direct.fsm import StateData
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.... | {
"content_hash": "1ac5ab08b48b0284329a7b604d77f4a2",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 143,
"avg_line_length": 39.353591160220994,
"alnum_prop": 0.6528148252140952,
"repo_name": "linktlh/Toontown-journey",
"id": "ae6e27f39dec92352b8afe899690eca81e239154",
"s... |
"""Test module for starting the broker."""
import os
import sys
from tempfile import mkdtemp
from shutil import rmtree
from subprocess import Popen, PIPE
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from aquilon.config import Config
class TestBrokerStart(unittest.TestCase... | {
"content_hash": "72638570f6de43a198a3b08d92ce823b",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 88,
"avg_line_length": 40.68648648648649,
"alnum_prop": 0.5354058721934369,
"repo_name": "guillaume-philippon/aquilon",
"id": "afd233cf5b218a92f4ed6e3dab642dc7bca021b1",
"... |
import asyncio
import base64
import datetime
import re
import uuid
from contextlib import contextmanager
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
from unittest import mock, skipUnless
from urllib import parse
import aioapns
import orjson
import responses
from django.conf import settings
fro... | {
"content_hash": "d5c551150e0a769826241198160ae203",
"timestamp": "",
"source": "github",
"line_count": 2730,
"max_line_length": 188,
"avg_line_length": 43.37032967032967,
"alnum_prop": 0.5877315225378164,
"repo_name": "rht/zulip",
"id": "b8ea3699ce67ff4356e1e97e35751ac1e199f99c",
"size": "118403",... |
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from django.utils.six.moves import http_client
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_model()
def add_permissions(user, permissions):
"""
... | {
"content_hash": "ca9757f029d514e2a2e30ddffa8591e3",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 78,
"avg_line_length": 34.08571428571429,
"alnum_prop": 0.6267113718915899,
"repo_name": "eddiep1101/django-oscar",
"id": "955fd78346912da2c40c69e1c7226cfc51352766",
"size... |
from django.conf import settings
from django.http import HttpResponse,HttpResponseRedirect
from django.utils.importlib import import_module
from django.template import Context
from django.template.loader import get_template
from django.shortcuts import get_object_or_404, render_to_response
from django.views.generic.sim... | {
"content_hash": "7193591f33da54345b7fc3ac6468edef",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 67,
"avg_line_length": 34.1764705882353,
"alnum_prop": 0.7564543889845095,
"repo_name": "westinedu/wrgroups",
"id": "3932327c903ae322b8bcb9ad4d8408947f8dd9e2",
"size": "116... |
from datetime import datetime
from couchdbkit import ResourceNotFound
from django.contrib import messages
from django.core.exceptions import SuspiciousOperation
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseBadRequest, Http404
from django.utils.decorators import ... | {
"content_hash": "62b6da2cf9b199354c852cbdc825294e",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 111,
"avg_line_length": 34.355932203389834,
"alnum_prop": 0.6429452392698569,
"repo_name": "gmimano/commcaretest",
"id": "544d5bab54bda45dedd203162d8d3041cd41e564",
"size"... |
import ipaddr
from enums import ServiceProtocol
class InterfaceACL:
def __init__(self, interface_name=None, acl_direction=None, acl_name=None):
self.acl_name = acl_name
self.acl_direction = acl_direction
self.interface_name =interface_name
self.entries_post_intra_acl_filtering = Non... | {
"content_hash": "cfb0e7408185754a24c30c195a7c57a6",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 273,
"avg_line_length": 34.13025210084034,
"alnum_prop": 0.6185522590176044,
"repo_name": "dinesharanathunga/firewallconfigdecryptor",
"id": "9f7a27f0b05be857335243306386ca6... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('wikiapi.config')
app.config.from_pyfile('application.cfg', silent=True)
db = SQLAlchemy(app)
from wikiapi import views, models
db.create_all() | {
"content_hash": "bb19bbfb8690992a2258522ddce61b9e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 54,
"avg_line_length": 26,
"alnum_prop": 0.7762237762237763,
"repo_name": "Evgenus/wiki-rest-json-api-test",
"id": "bc3e60bbd1a2d51631f65d8c6968ac804b019c1b",
"size": "286"... |
"""
Slovenian specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
import datetime
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import CharField, Select, ChoiceField
from django.utils.translation import uget... | {
"content_hash": "4b80fa8ee8a564ad2414637c873afe03",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 86,
"avg_line_length": 27.711764705882352,
"alnum_prop": 0.5773721078327319,
"repo_name": "yakky/django-localflavor",
"id": "fc15ed8dc3f8f894afaff7b72d9d79b6268f4463",
"si... |
"""
lassie.filters.generic
~~~~~~~~~~~~~~~~~~~~~~
This module contains data about generic type content to help Lassie filter for content.
"""
from ..compat import str
import re
GENERIC_MAPS = {
'meta': {
'generic': {
'pattern': re.compile(r"^(description|keywords|title)", re.I),
... | {
"content_hash": "f2b1f87249e89f3e3cf77538606bc8cc",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 87,
"avg_line_length": 21.058823529411764,
"alnum_prop": 0.42178770949720673,
"repo_name": "jpadilla/lassie",
"id": "07a979f1a2aa0fb9022bd509d29d243ef3081f77",
"size": "741... |
{
"name": "Kubik CRM Customer User Linked",
"summary": "Add customer linked user to kubik contacts",
"version": "9.0.1.1.0",
"category": "Customer Relationship Management",
"website": "http://vileo.co.id",
"author": "Suhendar",
"contributors": [
'Suhendar',
],
"license": "AGP... | {
"content_hash": "3ceb8d46159d030063a6f24a24b3051e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 60,
"avg_line_length": 23.82608695652174,
"alnum_prop": 0.541970802919708,
"repo_name": "vileopratama/vitech",
"id": "73e51b88b76f38458cc4d37d948b26727191424f",
"size": "54... |
"""
:module: watchdog.observers.inotify
:synopsis: ``inotify(7)`` based emitter implementation.
:author: Sebastien Martini <[email protected]>
:author: Luke McCarthy <[email protected]>
:author: [email protected] (Yesudeep Mangalapilly)
:author: Tim Cuthbertson <[email protected]>
:platforms: Linux 2.6.13+.
.. A... | {
"content_hash": "804bde6473350fd048665fff28c6754e",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 84,
"avg_line_length": 37.57142857142857,
"alnum_prop": 0.6506653992395437,
"repo_name": "piagarwal11/GDriveLinuxClient",
"id": "65fa7d51cd8cad94742a9f9875ad4d40ef20f10e",
... |
"""cifar100_n dataset."""
from tensorflow_datasets import testing
from tensorflow_datasets.image_classification.cifar100_n import cifar100_n
class Cifar100NTest(testing.DatasetBuilderTestCase):
"""Tests for cifar100_n dataset."""
DATASET_CLASS = cifar100_n.Cifar100N
SPLITS = {
'train': 10, # Number of f... | {
"content_hash": "4fde5081a7a52361146dc5caa2933e3b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 25.941176470588236,
"alnum_prop": 0.6961451247165533,
"repo_name": "tensorflow/datasets",
"id": "8f2627b66c7f5f8f2fce99a04fd40820f3aa6960",
"size": "... |
from django.test import TestCase
from mozdns.address_record.models import AddressRecord
from mozdns.cname.models import CNAME
from mozdns.txt.models import TXT
from mozdns.mx.models import MX
from mozdns.srv.models import SRV
from mozdns.domain.models import Domain
from mozdns.nameserver.models import Nameserver
from ... | {
"content_hash": "972966d0ab35aef161fccca1b25342cb",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 79,
"avg_line_length": 39.32394366197183,
"alnum_prop": 0.6169412607449857,
"repo_name": "rtucker-mozilla/inventory",
"id": "c72dbb8b3acb24741bdb4bfc078c83b16556797d",
"si... |
"""Support for Sky Hub."""
from __future__ import annotations
import logging
from pyskyqhub.skyq_hub import SkyQHub
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA as PARENT_PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.const import CONF_HOST
... | {
"content_hash": "5de4c36b93211420d77fae3517f2d8e5",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 85,
"avg_line_length": 29.9375,
"alnum_prop": 0.6609603340292276,
"repo_name": "rohitranjan1991/home-assistant",
"id": "731baddcdb497007ce702a134758cdc00de54c29",
"size": "... |
import csv
import six
from copy import deepcopy
if six.PY3:
from io import StringIO
else:
from StringIO import StringIO
from .base import BaseSmartCSVTestCase
from .config import COLUMNS_1, IPHONE_DATA, IPAD_DATA, VALID_TEMPLATE_STR
import smartcsv
class ValidCSVWithHeaderTestCase(BaseSmartCSVTestCase):
... | {
"content_hash": "223248e928378ae7a7ba5d50d7f99b9b",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 85,
"avg_line_length": 33.26996197718631,
"alnum_prop": 0.624,
"repo_name": "santiagobasulto/smartcsv",
"id": "0515a04249880de37cdca32759382eaa37c50424",
"size": "8750",
... |
import HTMLParser
import os
import re
from nltk import word_tokenize
html_parser = HTMLParser.HTMLParser()
# this is the path of the folder that will contain the tweet files
tweets_folder = os.path.join("D:", os.sep, "Documents", "PycharmProjects",
"easy_group_classifier", "text_fi... | {
"content_hash": "ce82c53646ffb949e37879a17b2597fa",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 74,
"avg_line_length": 30.692307692307693,
"alnum_prop": 0.5753272069061542,
"repo_name": "jluukvg/text-classifier",
"id": "209ba912fd5f13e33d23ff3299ee4657e87c64e9",
"siz... |
from mock import MagicMock
from django.utils import six
from django.test import TestCase
from django import template
from django.contrib.auth.models import User, Group, Permission
from django.core.urlresolvers import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from wagtail.tests.utils import... | {
"content_hash": "e68edd762ffb0bf856a9a1cae3c20d80",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 181,
"avg_line_length": 33.92372881355932,
"alnum_prop": 0.6380214838870847,
"repo_name": "lojack/wagtail",
"id": "48a31ae89c651aa413a606f4bab7aaecf247a2c9",
"size": "1601... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "50b42bc77bb0d3d1f85ae3851ad7b552",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 122,
"avg_line_length": 28.622448979591837,
"alnum_prop": 0.689126559714795,
"repo_name": "mahabs/nitro",
"id": "fdb1a7805e0260cee4050504533cf17a403f26f0",
"size": "3419",
... |
from channels import Group
from channels.test import ChannelTestCase, WSClient, apply_routes
#TODO: use apply_routes here, these tests are wrong.
from msn import consumer
class MSNConsumerTest(ChannelTestCase):
def test_ws_connect(self):
client = WSClient()
default = 'turnex'
# Inject... | {
"content_hash": "cc41eae5b9a70ab815a4f06e7c09bd1d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 87,
"avg_line_length": 39.333333333333336,
"alnum_prop": 0.5783898305084746,
"repo_name": "mleger45/turnex",
"id": "07fa66880af7f5c9537fb497b5824900827deba6",
"size": "1441... |
from __future__ import unicode_literals
import frappe
import time
from frappe import _, msgprint
from frappe.utils import flt, cstr, now, get_datetime_str, file_lock
from frappe.utils.background_jobs import enqueue
from frappe.model.base_document import BaseDocument, get_controller
from frappe.model.naming import set_n... | {
"content_hash": "26f333a68d41b16daa51c95cdafe1e7f",
"timestamp": "",
"source": "github",
"line_count": 1047,
"max_line_length": 125,
"avg_line_length": 31.12320916905444,
"alnum_prop": 0.6848953538329344,
"repo_name": "elba7r/frameworking",
"id": "0f385626818f22a58859f713e91b1bfd0c14aa94",
"size":... |
import sys
import hashlib
import struct
import base64
# Python 3.6+, the SHA3 is available in hashlib natively. Else this requires
# the pysha3 package (pip install pysha3).
if sys.version_info < (3, 6):
import sha3
# Test vector to make sure the right sha3 version will be used. pysha3 < 1.0
# used the old... | {
"content_hash": "d7443c99765217a970af85081580aa95",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 83,
"avg_line_length": 38.950819672131146,
"alnum_prop": 0.6813973063973064,
"repo_name": "hexxcointakeover/hexxcoin",
"id": "af0b81f8ded0087779ce1da908f65a35ce71bc17",
"si... |
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from oscar.core.loading import get_model, get_class
from oscar.test import factories
from oscar.test.testcases import WebTestCase
from decimal import Decimal as D
Order = get_model('order', 'Order')
UserAddress = get_model('address', ... | {
"content_hash": "a9451e12d51c364afc31abdc70848d44",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 76,
"avg_line_length": 40.13157894736842,
"alnum_prop": 0.6487431693989071,
"repo_name": "arbrandes/django-oscar-vat_moss",
"id": "bdf51135c8efbfbfdd84ad14021f12e46087aed9",... |
import pandoc
pandoc.core.PANDOC_PATH = '/usr/local/bin/pandoc'
doc = pandoc.Document()
doc.markdown = open('README.md').read()
f = open('README.rst', 'w+')
f.write(doc.rst)
f.close()
| {
"content_hash": "b7a7f192327e01018095539e05e6adaf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 49,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.6774193548387096,
"repo_name": "tsantor/python-lorem-pixel",
"id": "46cd9643f78415f23137ccedb81eb463f24fedeb",
"si... |
from django.core.management import call_command
from django.core.management.commands.migrate import Command as MigrateCommand
from django_cassandra_engine.utils import get_engine_from_db_alias
class Command(MigrateCommand):
def handle(self, *args, **options):
engine = get_engine_from_db_alias(options['d... | {
"content_hash": "a5959025c88c9488675d48109bea6632",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 38.77777777777778,
"alnum_prop": 0.666189111747851,
"repo_name": "TargetHolding/django-cassandra-engine",
"id": "ba525d41430dc2f09e822faa9ac65256c17765... |
"""Generated client library for cloudresourcemanager version v1beta1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.cloudresourcemanager.v1beta1 import cloudresourcemanager_v1beta1_messages as messages
class Cloudreso... | {
"content_hash": "6e040ec56cfb808be2cb4d9793381cca",
"timestamp": "",
"source": "github",
"line_count": 565,
"max_line_length": 124,
"avg_line_length": 40.14513274336283,
"alnum_prop": 0.701040472621462,
"repo_name": "KaranToor/MA450",
"id": "092962d382d9a83f254a394eff1682029b7e39b9",
"size": "2268... |
"""
Interface with command line GULP.
http://projects.ivec.org
WARNING: you need to have GULP installed on your system.
"""
__author__ = "Bharat Medasani, Wenhao Sun"
__copyright__ = "Copyright 2013, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Bharat Medasani"
__email__ = "[email protected],wenhao@mi... | {
"content_hash": "4e9430715122f555dc986d0c70f447f8",
"timestamp": "",
"source": "github",
"line_count": 902,
"max_line_length": 120,
"avg_line_length": 30.284922394678492,
"alnum_prop": 0.49247721199253214,
"repo_name": "gVallverdu/pymatgen",
"id": "58c3d42ad20b399f4a8b4319dce4b516153bc97b",
"size"... |
"""Large tests for metric_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.contrib.metrics.python.ops import metric_ops
from tensorflow.python.framew... | {
"content_hash": "fe0a6d3bc163788aa35eda2baf9716ff",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 36.46153846153846,
"alnum_prop": 0.7146624472573839,
"repo_name": "jart/tensorflow",
"id": "7acfc383eb9a659a600752cf57b4978daa8a07bc",
"size": "2585"... |
from mock import Mock
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import LogisticRegression
def test_multiclass_logloss():
from ..metrics import multiclass_logloss
act = np.array([[0, 1, 0], [1, 0, 0], [0, 0, 1]])
pred = np.array([[0.2, 0.7, 0.1], [0... | {
"content_hash": "ea84d4784a76b036ef3a90c66cba9ffa",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 78,
"avg_line_length": 29.29824561403509,
"alnum_prop": 0.6395209580838324,
"repo_name": "dnouri/nolearn",
"id": "e78f9531e85bd553553cf2b29895983f03ae067d",
"size": "1670",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.