text stringlengths 4 1.02M | meta dict |
|---|---|
"""DocstringChecker is used to check python doc string's style."""
import astroid
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from collections import defaultdict
import re
def register(linter):
"""Register checkers."""
linter.register_checker(DocstringChecker(linte... | {
"content_hash": "4c008303a9a20133f6fe70d1e3f0b5fb",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 79,
"avg_line_length": 28.11764705882353,
"alnum_prop": 0.511655708308428,
"repo_name": "luotao1/Paddle",
"id": "8deeff77348f476e7e5d29216ae0de298beba212",
"size": "10650"... |
"""Test the collection module."""
import json
import os
import re
import sys
sys.path[0:0] = [""]
from bson.py3compat import iteritems
from pymongo.command_cursor import CommandCursor
from pymongo.cursor import Cursor
from pymongo.results import _WriteResult
from test import unittest, client_context, IntegrationTes... | {
"content_hash": "a3c721300ec9de685d09ea45d0073231",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 36.903703703703705,
"alnum_prop": 0.5590124448012846,
"repo_name": "raghuvam/fusepy",
"id": "ecffe4339b41cbe56c2cbd7ac2ce5ec951ad5702",
"size": "555... |
from __future__ import unicode_literals
import datetime
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import *
from django.http import QueryDict
from django.template import Template, Context
from django.test import TestCase
from django.test.utils import str_prefix
from django.utils.d... | {
"content_hash": "8087d54c51de48a79ff8132fd73eb805",
"timestamp": "",
"source": "github",
"line_count": 1795,
"max_line_length": 519,
"avg_line_length": 60.68356545961003,
"alnum_prop": 0.6239132630110074,
"repo_name": "pygeek/django",
"id": "a8a28ba8060e834bcf28875f12afabe607986b12",
"size": "1090... |
from django.db import models
from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django.utils import timezone
class List(models.Model):
name = models.CharField(max_length=200)
color = models.CharField(max_length=10)
created = models.DateTimeField(auto_now_add=True, def... | {
"content_hash": "330b7b98220c0230793c5695f2af6640",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 72,
"avg_line_length": 31.125,
"alnum_prop": 0.7449799196787149,
"repo_name": "gregwym/djangoProjectStructure",
"id": "71cab9a90371a98acf4d8545b6d67bc4f4779f00",
"size": "9... |
"""
@title: El Coladero
@description: Aplicación web para detectar y corregir vulnerabilidades
@author: Enrique Martín Martín
@email: emartinm@ucm.es
"""
from bottle import run, template, get, post, request
import sqlite3
@get('/show_all_questions')
def show_all_questions():
conn = sqlite3.connect("database.db")... | {
"content_hash": "bb42607533d48fd66cb9c504e86a5a47",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 84,
"avg_line_length": 29.525252525252526,
"alnum_prop": 0.6130687649674992,
"repo_name": "ferreiro/Python-course",
"id": "fb65b89a230e503fc381492388451a188982ff1b",
"size"... |
'''
Testing RemindmeRepository model.
Objectives:
- ensure a consistent interface is maintained
'''
import unittest
from remindme.Remindme import Remindme
from remindme.RemindmeRepository import RemindmeRepository
class Test_RemindmeRepository_Model(unittest.TestCase):
'''Tests against the RemindmeRepository m... | {
"content_hash": "fa8d5590adf97fad4071993af37aaa6a",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 87,
"avg_line_length": 45.9051724137931,
"alnum_prop": 0.6570892018779343,
"repo_name": "GochoMugo/remindme",
"id": "75cc4d2767db5ee977b01b02f7755cace92570dd",
"size": "53... |
"""The tests for the hassio component."""
import os
import pytest
from homeassistant.auth.const import GROUP_ID_ADMIN
from homeassistant.components import frontend
from homeassistant.components.hassio import STORAGE_KEY
from homeassistant.setup import async_setup_component
from tests.async_mock import patch
MOCK_EN... | {
"content_hash": "9a03f61dd5b89217c8178b2f4fae8b02",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 88,
"avg_line_length": 37.23529411764706,
"alnum_prop": 0.6225908372827804,
"repo_name": "tchellomello/home-assistant",
"id": "56792295fec3ebaafb2d3ba9e74d7906019771e7",
"... |
import unittest
import paddle
from paddle.distributed.fleet import auto
from paddle.fluid import program_guard
from paddle.fluid.backward import append_backward
paddle.enable_static()
def make_program_dp2():
main_program = paddle.fluid.Program()
start_program = paddle.fluid.Program()
with paddle.static.... | {
"content_hash": "3af65d73706294923f240fc684bcbf33",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 80,
"avg_line_length": 40.09090909090909,
"alnum_prop": 0.5913832199546485,
"repo_name": "PaddlePaddle/Paddle",
"id": "969bab0a69f194cc5c8a7d7e5a6a21c54f46a3bc",
"size": "... |
"""
Plexer
-----
Plexer is a simple lexer (tokenizer) for Python.
License: MIT
How to...?
````````````
-----
Print all #include statements in a C/C++ file?
-----
from plexer import TYPE, tokenize_lines
lines = tokenize_lines('#include "foo.h"\nint val = 42;\n')
for line in lines:
first_token =... | {
"content_hash": "59dfec1f11ad7ab7369d6008d517a4c3",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 74,
"avg_line_length": 22.87323943661972,
"alnum_prop": 0.6120689655172413,
"repo_name": "shawnpresser/plexer",
"id": "1fab9372315ea3a27ca6dacaa096ddbcba080513",
"size": "1... |
import logging
import config
import time
from multiprocessing import Process, Queue
from detect import *
from process import _runner
def process_queue():
"""Process inter-process messages.
Process the inter-process :py:class:`multiprocessing.Queue`
objects, which receive messages from the spawned pr... | {
"content_hash": "af2f8cfb21335b1ee5dcd45e02affbd6",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 151,
"avg_line_length": 40.91509433962264,
"alnum_prop": 0.5438090846207055,
"repo_name": "alberthdev/pyradmon",
"id": "8042cc7e7488a31a11a3aadf5eed6b8e5964c07f",
"size": ... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "9c4a7e7556fad21dea4c608b66f231b4",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 80,
"avg_line_length": 32.528,
"alnum_prop": 0.7089276930644368,
"repo_name": "Gloobywerts/Newspaper",
"id": "26f854d85af3947ec1da796a77587192d339bbb7",
"size": "8554",
... |
import os,sys,re,socket,datetime,time
OVERWRITE = True
# define source and target
SOURCE_SERVER = "t3serv017.mit.edu"
TARGET_SERVER = "xrootd18.cmsaf.mit.edu"
#---
SOURCE = "/data/submit/cms"
#SOURCE = "root://%s/"%(SOURCE_SERVER)
TARGET = "root://%s/"%(TARGET_SERVER)
#------------------------------------------------... | {
"content_hash": "7235e9318cae62047900863f2f31ef47",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 100,
"avg_line_length": 30.316129032258065,
"alnum_prop": 0.5218131517344116,
"repo_name": "cpausmit/FiBS",
"id": "dcacda001148129c45fb8111d59eebe14cc6e073",
"size": "5111... |
"""
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http:#www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, s... | {
"content_hash": "07f8af7b06162a25456fd2bcd5c3afc8",
"timestamp": "",
"source": "github",
"line_count": 682,
"max_line_length": 108,
"avg_line_length": 31.513196480938415,
"alnum_prop": 0.6314442583286805,
"repo_name": "minghuascode/pyj",
"id": "bcd4317f9cba91cba96711243f1be702078dc05d",
"size": "2... |
from personal_classifier import PersonalClassifier
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from sklearn import svm
class SupportVectorMachine(PersonalClassifier):
def __init__(self, data_set, labels):
super(SupportVectorMachine, self).__init__(data_set, l... | {
"content_hash": "59b9ae193d0894c67d5f7608980152b6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 68,
"avg_line_length": 25.95,
"alnum_prop": 0.6859344894026975,
"repo_name": "BavoGoosens/Gaiter",
"id": "113d12de5daef1c894be473a17f2fc77dce17d42",
"size": "519",
"binar... |
from unittest import mock
from django.utils import timezone
from freezegun import freeze_time
from rest_framework import test
from waldur_mastermind.common.utils import parse_datetime
from waldur_mastermind.invoices import models as invoices_models
from waldur_mastermind.marketplace import callbacks
from waldur_maste... | {
"content_hash": "84c1898d3283ba0336a79c8d6fdf4456",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 99,
"avg_line_length": 38.70454545454545,
"alnum_prop": 0.6414562536699941,
"repo_name": "opennode/waldur-mastermind",
"id": "7fcbc5467b9124e3372a5d5562db7a63053bf8a6",
"s... |
"""The test for switch device automation."""
from datetime import timedelta
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.switch import DOMAIN
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry
fro... | {
"content_hash": "b52b91a1c8772fcccff5aabfe3de73d8",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 87,
"avg_line_length": 34.76724137931034,
"alnum_prop": 0.4764443342424994,
"repo_name": "Teagan42/home-assistant",
"id": "73d12d0a7296e6ac04be8db4e926f406b3fb6059",
"size... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
from collections import namedtuple
import json
import logging
import... | {
"content_hash": "abbc72e39e386a98eeec8e37056cdb16",
"timestamp": "",
"source": "github",
"line_count": 1398,
"max_line_length": 100,
"avg_line_length": 41.31974248927039,
"alnum_prop": 0.5845061888686921,
"repo_name": "projectatomic/osbs-client",
"id": "a98320ac80c1a243f647b53e9bb1bc1ecd728c3c",
"... |
"""Sparse Dtype"""
from __future__ import annotations
import re
from typing import (
TYPE_CHECKING,
Any,
)
import warnings
import numpy as np
from pandas._typing import (
Dtype,
DtypeObj,
type_t,
)
from pandas.errors import PerformanceWarning
from pandas.core.dtypes.base import (
ExtensionDt... | {
"content_hash": "5accdf4e8a645ae0e4eeda3d53e7a028",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 86,
"avg_line_length": 30.71212121212121,
"alnum_prop": 0.5473606314750863,
"repo_name": "jorisvandenbossche/pandas",
"id": "915e13bc3bbb2042b5ecf1b99deee5d05b4be8cb",
"si... |
from setuptools import setup, find_packages
import dbdriver
setup(
name='dbdriver',
version=dbdriver.__version__,
packages=find_packages(),
author="Asteroide",
author_email="asteroide__AT__domtombox.net",
description="An API server",
long_description=open('README.md').read(),
# ... | {
"content_hash": "bd6d3be4e5c940c6bffb13a5b56d7608",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 82,
"avg_line_length": 22.6046511627907,
"alnum_prop": 0.6018518518518519,
"repo_name": "asteroide/immo_spider",
"id": "106761af3334e28572592bdbb6c32dd472de641a",
"size": "... |
import threading
import os
from collections import OrderedDict
from .pgcompleter import PGCompleter
class CompletionRefresher:
refreshers = OrderedDict()
def __init__(self):
self._completer_thread = None
self._restart_refresh = threading.Event()
def refresh(self, executor, special, cal... | {
"content_hash": "910226622debea17054dc698132dd29a",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 88,
"avg_line_length": 34.42483660130719,
"alnum_prop": 0.6394531991646099,
"repo_name": "dbcli/pgcli",
"id": "1039d51599f40b02bdf84cb3282330a09aa71225",
"size": "5267",
... |
from math import pi as PI
from module import Klass
def class_decorator(cls):
cls.__call__ = lambda self: print('Cabbage!')
return cls
@class_decorator
class Class(Klass):
@property
def property(self):
temp, ellipsis = self._property
return {temp} if temp%0x12f2 else set()
@property.setter
def property(s... | {
"content_hash": "164b0db4087716413b548ab2816dedd3",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 68,
"avg_line_length": 21.128205128205128,
"alnum_prop": 0.6104368932038835,
"repo_name": "hrsetyono/theme_pacific",
"id": "6a00bf7a74c744b7b4909d1f31418eec4c28033c",
"size... |
from hanlp.datasets.parsing.loaders._ctb_utils import make_ctb
_CTB8_HOME = 'https://wakespace.lib.wfu.edu/bitstream/handle/10339/39379/LDC2013T21.tgz#data/'
CTB8_CWS_TRAIN = _CTB8_HOME + 'tasks/cws/train.txt'
'''Training set for ctb8 Chinese word segmentation.'''
CTB8_CWS_DEV = _CTB8_HOME + 'tasks/cws/dev.txt'
'''De... | {
"content_hash": "005a5ef4a7ac0f6ba530a72b0a03eba6",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 94,
"avg_line_length": 48.375,
"alnum_prop": 0.7266149870801034,
"repo_name": "hankcs/HanLP",
"id": "048e7b9241254f4e70ceab23cf50f3ede096972b",
"size": "2001",
"binary": ... |
"""Writes a build_config file.
The build_config file for a target is a json file containing information about
how to build that target based on the target's dependencies. This includes
things like: the javac classpath, the list of android resources dependencies,
etc. It also includes the information needed to create t... | {
"content_hash": "306d755964b4de2fa5d4e894ff6faa51",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 80,
"avg_line_length": 38.90571428571429,
"alnum_prop": 0.6868620107218918,
"repo_name": "chinmaygarde/mojo",
"id": "8507a95d0b982808d5ca08eb12a6a86aa0a55d73",
"size": "13... |
"""
yappi.py
Yet Another Python Profiler
Sumer Cip 2014
"""
import os
import sys
import _yappi
import pickle
import threading
try:
from thread import get_ident # Python 2
except ImportError:
from threading import get_ident # Python 3
class YappiError(Exception): pass
__all__ = ['start', 'stop',... | {
"content_hash": "46b245015c51fde46c709ad87c2f6a50",
"timestamp": "",
"source": "github",
"line_count": 988,
"max_line_length": 172,
"avg_line_length": 34.75506072874494,
"alnum_prop": 0.5729512493447493,
"repo_name": "yousong/yappi",
"id": "6176a23df84fcd3de5037b552435c65dba5ae95f",
"size": "34338... |
import logging
import logging.config
import threading
import time
import math
from ambercommon.common import runtime
import os
from amberdriver.tools import config
import collision_avoidance_logic as logic
__author__ = 'paoolo'
pwd = os.path.dirname(os.path.abspath(__file__))
logging.config.fileConfig('%s/collisio... | {
"content_hash": "c37bc3e3f0083d53dca194f4ef205078",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 114,
"avg_line_length": 35.554098360655736,
"alnum_prop": 0.5462928808557728,
"repo_name": "showmen15/testEEE",
"id": "d61e13990144ca28bf4884a86628c23c9cb00f98",
"size": "... |
import math, random
from panda3d.core import Vec3, Quat, GeomVertexFormat, TextureStage, GeoMipTerrain, PNMImage
from terrain.bakery.bakery import Tile, parseFile, loadTex
from terrain import collisionUtil
import meshManager
class GroundFactory(meshManager.MeshFactory):
def __init__(self,path,heightScale... | {
"content_hash": "8b9e2eac609633fea6c11be6560f8ed2",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 115,
"avg_line_length": 38.77710843373494,
"alnum_prop": 0.5403138107814199,
"repo_name": "Craig-Macomber/Panda3D-Terrain-System",
"id": "efe696bd217d2a127680b8b2a30b746d06c... |
"""
Created on Sun Sep 10 14:37:53 2017
@author: dmare
"""
import classification | {
"content_hash": "f40d6fa83e01513f81891efe725ce4dc",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 35,
"avg_line_length": 14.333333333333334,
"alnum_prop": 0.6744186046511628,
"repo_name": "ceroytres/cat_nets",
"id": "7f9a88c5a268ba6c3587d9bdaa9028754b326c7d",
"size": "11... |
from urllib import parse as urlparse
from oslo_utils import strutils
import webob
from nova.api.openstack.api_version_request \
import MAX_PROXY_API_SUPPORT_VERSION
from nova.api.openstack.api_version_request \
import MIN_WITHOUT_PROXY_API_SUPPORT_VERSION
from nova.api.openstack.compute.schemas import quota_s... | {
"content_hash": "81e44cf2d3394f0203bbf51ec60c6edd",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 79,
"avg_line_length": 41.87313432835821,
"alnum_prop": 0.597932632329353,
"repo_name": "klmitch/nova",
"id": "d955e1b1560199317f3d0bcb20007889752d7ced",
"size": "11858",
... |
"""
This module allows importing AbstractBaseUser even when django.contrib.auth is
not in INSTALLED_APPS.
"""
import unicodedata
from django.contrib.auth import password_validation
from django.contrib.auth.hashers import (
check_password, is_password_usable, make_password,
)
from django.db import models
from djang... | {
"content_hash": "b2049f6b250301afa652886f03bba1fe",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 97,
"avg_line_length": 33.05555555555556,
"alnum_prop": 0.6273109243697479,
"repo_name": "theo-l/django",
"id": "bb51cfbcc9a93fcc96c8362855e9ccac75bb77e7",
"size": "4760",... |
from django.views.generic.list import ListView
from django.views.generic.edit import UpdateView, DeleteView
from django.views.generic import FormView
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.excep... | {
"content_hash": "70dec90a35ca2a9e612820d5606b649c",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 81,
"avg_line_length": 34.4625,
"alnum_prop": 0.6420021762785637,
"repo_name": "cidadania/ecidadania-ng",
"id": "80f38d26fe326d58fce131cb6986622e662b7cdb",
"size": "6176",... |
import logging
from singleton import Singleton
class ColorizedStreamHandler(logging.StreamHandler):
color_map = {
'red': 1,
'green': 2,
'yellow': 3,
'white': 7,
}
level_map = {
logging.DEBUG: ('white', True),
logging.INFO: ('green', False),
logging... | {
"content_hash": "14d0857c9455f6c93b3400d0990b3d76",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 102,
"avg_line_length": 28.549295774647888,
"alnum_prop": 0.5663542180562408,
"repo_name": "yaise/snix",
"id": "3ac5fbde492d2bb25e23fa5ab180590cc17e9614",
"size": "2049",
... |
"""
Legend of a chart.
"""
from __future__ import absolute_import, print_function, unicode_literals
from ..enum.chart import XL_LEGEND_POSITION
from ..text.text import Font
from ..util import lazyproperty
class Legend(object):
"""
Represents the legend in a chart. A chart can have at most one legend.
""... | {
"content_hash": "0398d20bb65df89965cc9480995a304d",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 77,
"avg_line_length": 31.825,
"alnum_prop": 0.631578947368421,
"repo_name": "ryfeus/lambda-packs",
"id": "fe13bf32165bd664874dd368bebfa51e2531d510",
"size": "2565",
"bin... |
"""
Tests for group API.
"""
from unittest import mock
import ddt
from cinder import context
from cinder import exception
import cinder.group
from cinder import objects
from cinder.objects import fields
from cinder.policies import group_snapshots as g_snap_policies
from cinder import quota
from cinder.tests.unit impo... | {
"content_hash": "e5fed07f1055ef654be67ca75c268f77",
"timestamp": "",
"source": "github",
"line_count": 930,
"max_line_length": 79,
"avg_line_length": 46.2247311827957,
"alnum_prop": 0.5517225336714043,
"repo_name": "openstack/cinder",
"id": "10dbd4f3414222b0e4cb11bc701f0dfc97c28f35",
"size": "4362... |
import sys
import os
import time
import random
import tempfile
import argparse
import Menu
class PopQ(object):
resource_prefix = '/tmp/'
temp_file = "popresource.txt"
def _create_nonexisting_resourcefile(self, resource_file_path):
if not os.path.isfile(resource_file_path):
open(resour... | {
"content_hash": "8072fd3f39d3e1816d72b24cb8e57a95",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 99,
"avg_line_length": 32.80869565217391,
"alnum_prop": 0.5534057778955738,
"repo_name": "ulvgard/PopQ",
"id": "154ea613bce78464656f9dc3184c5850ec9236d8",
"size": "3796",
... |
from webev.response import Response
class View(object):
http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']
def __init__(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)
def dispatch(self, request, start_response, **kw... | {
"content_hash": "702a4245a4c6774b2ccb99fe0a2c84aa",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 93,
"avg_line_length": 35.1578947368421,
"alnum_prop": 0.6107784431137725,
"repo_name": "Korkki/web.ev",
"id": "fbb25644fbaf9aa08ae28df555b71895d8beb4c1",
"size": "668",
... |
import getopt
import io
import pdb
import sys
from atom import TRUE, FALSE
from env import Environment
from error import Error
from fun import Function, Lambda, Closure
from lisp import Lisp
from reader import Reader
NAME = 'eLisp'
VERSION = 'v0.1'
PROMPT = '>>> '
DEPTH_MARK = '.'
class Elisp(Lisp):
def __init__(... | {
"content_hash": "b66af589cfd8effea785e36c267e830d",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 88,
"avg_line_length": 28.206572769953052,
"alnum_prop": 0.49816910785619173,
"repo_name": "ASMlover/study",
"id": "286cd7d83bb31d330f0df7928f17d12d9cf40fd1",
"size": "740... |
"""
Utility module containing methods commonly used throughout the Python framework.
"""
# NOTE we still import these from __future__ here because many machines still running
# python 2.X need to use this file (for example the plugin installer)
from __future__ import division, print_function, absolute_import
# *****... | {
"content_hash": "2d6ff15f67c762d22c80e6806792fea2",
"timestamp": "",
"source": "github",
"line_count": 1040,
"max_line_length": 214,
"avg_line_length": 36.50865384615385,
"alnum_prop": 0.6708103979562274,
"repo_name": "joshua-cogliati-inl/raven",
"id": "c4b6416044d4dfa11396f6bef7a8fd6351fd7a17",
"... |
import binascii
import logging.handlers
import mimetypes
import os
import platform
import random
import re
import socket
import string
import subprocess
import sys
import base58
import requests
import simplejson as json
from urllib2 import urlopen
from appdirs import user_data_dir
from datetime import datetime
from de... | {
"content_hash": "2882ca960743585848496a1d0e6a618a",
"timestamp": "",
"source": "github",
"line_count": 2802,
"max_line_length": 144,
"avg_line_length": 38.258386866523914,
"alnum_prop": 0.5637873134328358,
"repo_name": "DaveA50/lbry",
"id": "05a654b3a3119aa5671cc791a3f026ebcabf2af8",
"size": "1072... |
import bdd_grpc_util
import endorser_util
import bdd_test_util
import bootstrap_util
import orderer_util
import time
class ChannelCreationInfo:
'Used to store the information needed to construct Config TX for orderer broadcast to create a new channel'
def __init__(self, channelId, channelCreationPolicyName, si... | {
"content_hash": "94f3b5c89452df051947d45d0c534eb6",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 213,
"avg_line_length": 61.17454545454545,
"alnum_prop": 0.7889199310467812,
"repo_name": "masterDev1985/fabric",
"id": "d1b0e767857e65708ee14770cebc8f39bfb43a09",
"size":... |
"""
Compatibility Support for Python 2.6 and earlier
"""
import sys
try:
from urllib.parse import splittag
except ImportError:
from urllib import splittag
def strip_fragment(url):
"""
In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
later was patched to disregard the fragment... | {
"content_hash": "bc13d4aea2d675dd09ee43879b29e821",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 73,
"avg_line_length": 22.304347826086957,
"alnum_prop": 0.6803118908382066,
"repo_name": "letouriste001/SmartForest_2.0",
"id": "7c60c90ea598b81dba73660a9a2484bfa47d5674",
... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('release', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ContentCategory',
... | {
"content_hash": "fb6ec5baa86356a40958c34501540853",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 134,
"avg_line_length": 40.20253164556962,
"alnum_prop": 0.547544080604534,
"repo_name": "puiterwijk/product-definition-center",
"id": "b786c31310715a53e488494c543e8650977b3f... |
from django.contrib import admin
from .models import *
# Register your models here.
class LevelAdmin(admin.ModelAdmin):
list_display = ('name',)
admin.site.register(Level, LevelAdmin)
# class EnDefinitionInline(admin.StackedInline):
# model = EnDefinition
# fields = ('pos', 'defn',)
# show_change_li... | {
"content_hash": "5d6e6e28577daefff0587aa26efd4f6a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 48,
"avg_line_length": 24.576923076923077,
"alnum_prop": 0.701095461658842,
"repo_name": "HideMode/ShanBay",
"id": "0d88b8e2ebe0347799375c3d373e12aff3965919",
"size": "639"... |
"""
XX. Model inheritance
Model inheritance exists in two varieties:
- abstract base classes which are a way of specifying common
information inherited by the subclasses. They don't exist as a separate
model.
- non-abstract base classes (the default), which are models in their own
right with ... | {
"content_hash": "f99aa00a870af7e77444a7bac94c751f",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 89,
"avg_line_length": 23.046875,
"alnum_prop": 0.6858757062146893,
"repo_name": "rogerhu/django",
"id": "7f5702da59be245b8b7b720429bd96efcf867d59",
"size": "4425",
"bin... |
try:
from django.conf.urls import url, patterns, include
except ImportError:
from django.conf.urls.defaults import *
try:
from django.shortcuts import render
except ImportError:
from django.views.generic.simple import direct_to_template as render
urlpatterns = patterns('',
url(r'^yandex/', include... | {
"content_hash": "a368ffacf0443a65fb478f37c8fa477e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 75,
"avg_line_length": 30.071428571428573,
"alnum_prop": 0.7149643705463183,
"repo_name": "kmike/yandex-maps",
"id": "ec377b8a3f6c4b2ccb9dccd0f4b5ad63925e1dcf",
"size": "42... |
import numpy as np
from sklearn_pmml.convert.test.jpmml_test import JPMMLClassificationTest, JPMMLRegressionTest, TARGET_NAME, TARGET
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn_pmml.convert import TransformationContext, pmml_row, ModelMode, Schema
from sklearn_pmml.convert.fea... | {
"content_hash": "6a50edeb7ba2e5c8543f0b78eb362fcf",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 114,
"avg_line_length": 34.588235294117645,
"alnum_prop": 0.5593537414965987,
"repo_name": "alex-pirozhenko/sklearn-pmml",
"id": "b116850cd9a46353c5657d9b5781abbb3c652889",
... |
from pymongo import MongoClient
from flask import Flask, request, jsonify
DB_COUNT = 32
dbs = {}
DBNAME = "replay"
COLLECTION = "data"
def _hash(hash_str):
s = 0
for i in range(1, len(hash_str)+1):
c = ord(hash_str[i-1])
s = s + c * i
return (s % DB_COUNT) + 1
def _get_collection(replay_i... | {
"content_hash": "af9237a117d533acfe2c17ff8d629e90",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 52,
"avg_line_length": 21.25,
"alnum_prop": 0.5927601809954751,
"repo_name": "spin6lock/web_replay",
"id": "25252edbcfbde3b28447eb6192904e21c3682272",
"size": "1120",
"bi... |
from __future__ import print_function
# the following is a hack to get the baseclient to import whether we're in a
# package or not. This makes pep8 unhappy hence the annotations.
try:
# baseclient and this client are in a package
from .baseclient import BaseClient as _BaseClient # @UnusedImport
except ImportE... | {
"content_hash": "c964b49bed0d137229fd7bf11632ae3e",
"timestamp": "",
"source": "github",
"line_count": 1018,
"max_line_length": 115,
"avg_line_length": 60.73084479371316,
"alnum_prop": 0.6285584886128365,
"repo_name": "kbaseIncubator/catalog",
"id": "eb70ac29ca5e0728868dee6dd0fd543a0ed95324",
"siz... |
import dateutil.parser
from datetime import date
from .. import constants
class ProfileDescriptor(object):
# this is a python descriptor that allows for
# dynamic updating of profile data
def __init__(self, id):
self.id = id
def __get__(self, instance, owner):
if hasattr(self, 'value'... | {
"content_hash": "63eb6943b2ad63deb59ff04eb3813fc4",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 35.276315789473685,
"alnum_prop": 0.6307348004475942,
"repo_name": "ckjoshi9/Auto-Mate-for-Tinder",
"id": "4f87b696d5990c1db19903cf8c474a278ef4c1a7",
... |
"""Utilities to get a password and/or the current user name.
getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.
GetPassWarning - This UserWarning is issued when getpass() cannot prevent
echoing of the passw... | {
"content_hash": "b888a4758ef31c374342b292e5d705f6",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 81,
"avg_line_length": 32.18333333333333,
"alnum_prop": 0.5877783531848783,
"repo_name": "timm/timmnix",
"id": "53c38b8897569140f8bd35e73b1e2677a47351a0",
"size": "5793",
... |
import itertools
import py
from rpython.rlib.objectmodel import r_dict, compute_identity_hash, specialize
from rpython.rlib.rarithmetic import intmask
from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib.objectmodel import we_are_translated
from rpython.jit.metainterp import resoperation
from rpython.r... | {
"content_hash": "abdf060fe8484741cc89c789e5eb33f5",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 90,
"avg_line_length": 35.80555555555556,
"alnum_prop": 0.5456943366951125,
"repo_name": "jptomo/rpython-lang-scheme",
"id": "c434fb63d511023edc733b6331349c6d00d0a3c1",
"s... |
import requests
import datetime
import json
class Publisher(object):
def set_publisher_local(self, id_sensor, value, contextServer):
headers = {'Authorization':'token %s' % "878559b6d7baf6fcede17397fc390c5b9d7cbb77"}
#print("---------------"+id_sensor+"------------------------")
date_now... | {
"content_hash": "280025fa3d31c16805cb07444619813c",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 105,
"avg_line_length": 43.25423728813559,
"alnum_prop": 0.6105015673981191,
"repo_name": "hubertokf/lupsEdgeServer",
"id": "0551fd6d7a435ec4d387e4c9859f8c31f40dfc78",
"siz... |
"""
Tests for L{twisted.cred._digest} and the associated bits in
L{twisted.cred.credentials}.
"""
from zope.interface.verify import verifyObject
from twisted.trial.unittest import TestCase
from twisted.python.hashlib import md5, sha1
from twisted.internet.address import IPv4Address
from twisted.cred.error import Login... | {
"content_hash": "24e14f0233ce06402adcd5e6bbb8bbb7",
"timestamp": "",
"source": "github",
"line_count": 668,
"max_line_length": 83,
"avg_line_length": 35.01047904191617,
"alnum_prop": 0.5958866036687048,
"repo_name": "biddisco/VTK",
"id": "41368a02eb3433985c06b0f74cf50472ad17c85e",
"size": "23460",... |
import unittest
from libpytunes import Library
import os
class TestLibrary(unittest.TestCase):
def setUp(self):
self.it_library = Library(os.path.join(os.path.dirname(__file__), "Test Library.xml"))
def test_songs(self):
for id, song in self.it_library.songs.items():
assert(hasat... | {
"content_hash": "826d791b48b7f8b869e68c9d1f504bce",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 94,
"avg_line_length": 27.52,
"alnum_prop": 0.625,
"repo_name": "liamks/pyitunes",
"id": "c3244306ec43b992e930c1d3e3f8441095ffc0db",
"size": "688",
"binary": false,
"co... |
import django_filters.rest_framework
from rest_framework import filters
from rest_framework import permissions, renderers, viewsets
from cbe.human_resources.models import IdentificationType, Identification, Staff, Timesheet, TimesheetEntry
from cbe.human_resources.serializers import IdentificationTypeSerializer, Ident... | {
"content_hash": "e6772eb38fb38126955e3bb76d93e152",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 162,
"avg_line_length": 40.21212121212121,
"alnum_prop": 0.7980406932931424,
"repo_name": "Semprini/cbe",
"id": "049b2a6ead007f9e1c367238cfc2e0670a8739a7",
"size": "1327",
... |
"""Add missing foreign keys
Revision ID: 2e5352a0ad4d
Revises: 2a16083502f3
Create Date: 2015-08-20 12:43:09.110427
"""
# revision identifiers, used by Alembic.
revision = '2e5352a0ad4d'
down_revision = '2a16083502f3'
from alembic import op
from sqlalchemy.engine import reflection
from neutron.db import migration
... | {
"content_hash": "b8e92a70970714acdb4196103c3cb779",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 63,
"avg_line_length": 24.413793103448278,
"alnum_prop": 0.748587570621469,
"repo_name": "klmitch/neutron",
"id": "4961514dd627e3d9631f324c5feb3398b0dba4e4",
"size": "1316"... |
from setuptools import setup, find_packages
setup(name='wallaby-app-inspector',
version='0.1.27',
url='https://github.com/FreshXOpenSource/wallaby-app-inspector',
author='FreshX GbR',
author_email='wallaby@freshx.de',
license='BSD',
description='IDE for wallaby.',
long_descrip... | {
"content_hash": "18195a982c7c7c033d87b616eb068429",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 39.333333333333336,
"alnum_prop": 0.6025423728813559,
"repo_name": "FreshXOpenSource/wallaby-app-inspector",
"id": "32fe507dabfb28640cead86424e1a94d621... |
import unittest
import os
import sys
from axelrod import DeterministicCache, TitForTat, Defector, Random
class TestDeterministicCache(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.test_key = (TitForTat, Defector)
cls.test_value = [('C', 'D'), ('D', 'D'), ('D', 'D')]
cls.te... | {
"content_hash": "ca2d103d54792ae1a97ea7b4ece8b1f3",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 249,
"avg_line_length": 42.80681818181818,
"alnum_prop": 0.6493230687549775,
"repo_name": "marcharper/Axelrod",
"id": "4340bf641b142a69d4febc1911b416db2680de89",
"size": "3... |
"""Test event helpers."""
# pylint: disable=protected-access,too-many-public-methods
# pylint: disable=too-few-public-methods
import asyncio
import unittest
from datetime import datetime, timedelta
from astral import Astral
from homeassistant.bootstrap import setup_component
import homeassistant.core as ha
from homea... | {
"content_hash": "d6f81d7ca332f4b9c39a48c93bd23727",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 79,
"avg_line_length": 33.87410926365796,
"alnum_prop": 0.6000280485239464,
"repo_name": "hexxter/home-assistant",
"id": "89c97434f8dc0219b022714fd8496579f5356a0c",
"size"... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field comments on 'Question'
db.delete_table(db.shorten_name(u'catalog_q... | {
"content_hash": "32a4722277fa8358541349f6b13a819e",
"timestamp": "",
"source": "github",
"line_count": 872,
"max_line_length": 229,
"avg_line_length": 87.77522935779817,
"alnum_prop": 0.5450744708649072,
"repo_name": "Makeystreet/makeystreet",
"id": "d94537685b929c1f774b15a80c3157e067d0d608",
"siz... |
"""A module containing optimization routines."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.opt.python.training.drop_stale_gradient_optimizer import *
from tensorflow.contrib.opt.python.training... | {
"content_hash": "69d2b88fad1d0bf92f88ef1d14dcd139",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 82,
"avg_line_length": 43.03846153846154,
"alnum_prop": 0.7292225201072386,
"repo_name": "mortada/tensorflow",
"id": "be12f934a46358a0ce519de65ad663811bc8618b",
"size": "18... |
from __future__ import division
import math
class Vector(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __iter__(self):
return iter((self.x, self.y))
def __getitem__(self, key):
return (self.x, self.y)[key]
def __eq__(self, other):
return tuple... | {
"content_hash": "8c023e985861e2ca2da47a7870de3f1e",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 81,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.5507914245642156,
"repo_name": "gogobook/wagtail",
"id": "e264e30818c232e00021a74b21bd085b7376ad74",
"size": "49... |
from __future__ import print_function
import sys
from PIL import Image
try:
from PIL import _imagingcms
except ImportError as ex:
# Allow error import for doc purposes, but error out when accessing
# anything in core.
from _util import deferred_error
_imagingcms = deferred_error(ex)
from PIL._util ... | {
"content_hash": "c65b5054660ecd4581be0d391c1eac67",
"timestamp": "",
"source": "github",
"line_count": 956,
"max_line_length": 93,
"avg_line_length": 38.49058577405858,
"alnum_prop": 0.6587765306954372,
"repo_name": "tequa/ammisoft",
"id": "40fb1ad0a68f9407374e9a5d51d03a8066909418",
"size": "37186... |
"""A very simple example demonstrating Sijax and the Flask-Sijax extension."""
import os, sys
path = os.path.join('.', os.path.dirname(__file__), '../')
sys.path.append(path)
from flask import Flask, g, render_template
import flask_sijax
app = Flask(__name__)
# The path where you want the extension to create the ... | {
"content_hash": "ecf8ca86f9831581a35ae41e95accf78",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 98,
"avg_line_length": 37.58181818181818,
"alnum_prop": 0.6855345911949685,
"repo_name": "spantaleev/flask-sijax",
"id": "b62b57d8f99c61d85af5e41ea29baeeb120ce8ee",
"size":... |
from django.db import models
from django.contrib import admin
import httplib
import json
import logging
import datetime
from django.utils.timezone import utc
from howlcore import core
from howlcore.exceptions import SensorReadError
from mongodb.models import Mongodb
DEVICE_TYPE = core.DeviceType.SENSOR
logger = logg... | {
"content_hash": "e167c682c283aa0aea05e3b578facfac",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 111,
"avg_line_length": 37.7625,
"alnum_prop": 0.6044356173452499,
"repo_name": "volzotan/django-howl",
"id": "5b47ac0c09024e88f382a105256713a475fea019",
"size": "3021",
... |
from .phpcpd_handler import PHPCPDHandler
from .php_lint_handler import PHPLintHandler
from .php_fixer_handler import PHPFixerHandler
__all__ = ['PHPCPDHandler', 'PHPLintHandler', 'PHPFixerHandler']
| {
"content_hash": "5d9b28c073d4121f01d0d963b3e34438",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 64,
"avg_line_length": 33.5,
"alnum_prop": 0.7910447761194029,
"repo_name": "prisis/sublime-text-packages",
"id": "887dd1765c38fbd2ada45c818a695ff97bd22b20",
"size": "330",
... |
from django.forms import ModelForm
import models
class PassageForm(ModelForm):
class Meta:
model = models.Passage
exclude = ['created_time']
class CommentForm(ModelForm):
class Meta:
model = models.Comment
exclude = ['created_time'] | {
"content_hash": "dae820e55b7d5fa3660dcd33c962a33a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 34,
"avg_line_length": 18.571428571428573,
"alnum_prop": 0.7,
"repo_name": "hfercc/mese2014",
"id": "e94a7878fb4dfdeee94921eea47471bc3042ba87",
"size": "260",
"binary": f... |
import os
import glob
import logging
import unittest
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
try:
from bs4 import BeautifulSoup as _BeautifulSoup
class BeautifulSoup(_BeautifulSoup):
def prettify(self):
if self.html: self.html.unwrap()
if self.body: sel... | {
"content_hash": "40a87daeec773adeb2463667c2f9f2f6",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 126,
"avg_line_length": 34.35787321063395,
"alnum_prop": 0.637223974763407,
"repo_name": "camptocamp/formalchemy",
"id": "c0b257651ff7250fabb22e1c3e68d72ddf58122e",
"size"... |
import sys
import pickle
import operator
import re
import codecs
from .stop_words import StopWords
if int(sys.version_info[0]) < 3:
try:
reload(sys)
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
except NameError:
pass
# pr... | {
"content_hash": "87449ac105bcb949fdcd128e3b4a68b1",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 149,
"avg_line_length": 39.786802030456855,
"alnum_prop": 0.5192651186527175,
"repo_name": "DrSkippy/Simple-n-grams",
"id": "6d55a29150056f7d8c14fa4c96a8ab9c927ad429",
"si... |
"""
Summary class improves extraction.Extracted by providing
incremental load mechanism, and especially image validation.
But the main difference is that it performs the requests.
Extraction is performed gradually by parsing the HTML <head>
tag first, applying specific head extraction techniques, and
goes on to the <... | {
"content_hash": "80b018ab3dc8960f4127edb5fad7b66c",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 89,
"avg_line_length": 36.05573770491803,
"alnum_prop": 0.5653360007274711,
"repo_name": "svven/summary",
"id": "0e693f83c190ef8c2714ad8a1e57d3660e224b7f",
"size": "10997"... |
"""SHA-1 cryptographic hash algorithm.
SHA-1_ produces the 160 bit digest of a message.
>>> from Crypto.Hash import SHA1
>>>
>>> h = SHA1.new()
>>> h.update(b'Hello')
>>> print h.hexdigest()
*SHA* stands for Secure Hash Algorithm.
This algorithm is not considered secure. Do not use it for new de... | {
"content_hash": "27e2d4e70210e25e62b5d2d59ecaae2e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 107,
"avg_line_length": 31.46969696969697,
"alnum_prop": 0.5609051516610496,
"repo_name": "quoclieu/codebrew17-starving",
"id": "cd741df1d2c6eccc69924623ae618318d9d08e73",
... |
import pytest
import json
import os.path
import jsonpickle
from fixture.application import Application
from fixture.db import DBFixture
from fixture.orm import ORMFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os... | {
"content_hash": "4f15bb115e1657b1454f23434b956d1c",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 140,
"avg_line_length": 29.987179487179485,
"alnum_prop": 0.6866182129115006,
"repo_name": "tinytoon1/python",
"id": "9a3c6d869e3a91ac2b04bfd9c0ac1bc8de0f1fd5",
"size": "23... |
from distutils.core import setup
__version__ = "0.1"
setup(name="twisted_hang",
version=__version__,
description="Figure out if the main thread is hanging, and if so, what's causing it to hang.",
author="Geoff Greer",
license="MIT",
url="https://github.com/ggreer/twisted_hang",
dow... | {
"content_hash": "5925ac3b1b099c37d32da78a45e34338",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 100,
"avg_line_length": 32,
"alnum_prop": 0.6432291666666666,
"repo_name": "ggreer/twisted_hang",
"id": "a05b275af79159e9f966afa07a3abdd0bab3fd48",
"size": "407",
"binary... |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy, mse... | {
"content_hash": "c35958b73dce0ce9ae0ae4031af326d8",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 93,
"avg_line_length": 23.10810810810811,
"alnum_prop": 0.6210526315789474,
"repo_name": "JackKelly/neuralnilm_prototype",
"id": "d0a6b265f141b113c389ccc91ac13a33bba311b9",
... |
from django.apps import AppConfig
class CommonConfig(AppConfig):
name = 'mozillians.common'
label = 'common'
def ready(self):
import mozillians.common.signals # noqa
| {
"content_hash": "c52c31ee0905d920d99406838764b45e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 21,
"alnum_prop": 0.6931216931216931,
"repo_name": "fxa90id/mozillians",
"id": "c9f5ae59bd02d4629efa7a3c513997685ee36100",
"size": "189",
"binary": ... |
"""
Custom Sphinx directives
========================
"""
import os
from docutils import statemachine
from docutils.parsers.rst import Directive, directives
class MiniGallery(Directive):
"""
Custom directive to insert a mini-gallery
The required argument is one or more fully qualified names of objects,... | {
"content_hash": "6ef391d1e948b12872da14c7f6404a70",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 38.41772151898734,
"alnum_prop": 0.6042833607907743,
"repo_name": "Eric89GXL/sphinx-gallery",
"id": "ca81cb6f05407334a13a0d3bf03d1eef8a37aa70",
"size... |
import os
# PATH CONFIGURATION
PROJECT_DIR = os.path.dirname(os.path.dirname(__file__))
PUBLIC_DIR = os.path.join(PROJECT_DIR, 'public')
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'plugin_manager.core.wsgi.application'
# END PATH CONFIGURATION
# DEBUG CONFIGURATION
D... | {
"content_hash": "e3e56f74c4a67abde75a7e19f3e3b113",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 79,
"avg_line_length": 27.247386759581882,
"alnum_prop": 0.708312020460358,
"repo_name": "ahharu/plugin-manager",
"id": "e8f7092cbc550106e707fb7513ffe4cca7a4f1ad",
"size":... |
import time
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Slices import Slice, Slices
from PLC.Auth import Auth
from PLC.Methods.UpdateSlice import UpdateSlice
class SliceRenew(UpdateSlice):
"""
Deprecated. See UpdateSlice.
"""
status = "d... | {
"content_hash": "a76cca89db4b1f4db491c2911d9c9592",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 69,
"avg_line_length": 21.87878787878788,
"alnum_prop": 0.646814404432133,
"repo_name": "dreibh/planetlab-lxc-plcapi",
"id": "531c4a7df9bdecb69676f5581976b7e6171f05e0",
"si... |
import gunicorn
gunicorn.SERVER_SOFTWARE = 'Microsoft-IIS/6.0'
| {
"content_hash": "122f9922838ff36b4ed11a19c5335864",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 46,
"avg_line_length": 31.5,
"alnum_prop": 0.7936507936507936,
"repo_name": "andreif/stasher",
"id": "edbd35894a777e02b060838b63ece0b323172abd",
"size": "63",
"binary": fa... |
try: from collections import Counter
except: from Counter import Counter # For Python < 2.7
import traceback
import wordList
import anagram
import random
import math
import re
# Allows channel members to play an acronym-based word game.
# !jumble [min [max]] -- starts a new round, optionally setting the min and max le... | {
"content_hash": "e89e579012c4f9feadd510404cdda312",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 99,
"avg_line_length": 40.054263565891475,
"alnum_prop": 0.6148635571898587,
"repo_name": "iogf/candocabot",
"id": "818849cd359b60a6497658d67df9cb1b17cdba86",
"size": "516... |
import unittest
from flask import Flask
from blueprints import app
class BlueprintsTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
def test_index(self):
rv = app.test_client().get('/')
self.assertIn('<h1>Index</h1>', rv.data)
def test_admin_index(self... | {
"content_hash": "4ff1f62e9959ca11e5675cd56d6ec7b7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 54,
"avg_line_length": 21.5,
"alnum_prop": 0.6067653276955602,
"repo_name": "devbreeze/python",
"id": "92b4a8bc7d9f79deef9136c485c970279bd12351",
"size": "473",
"binary":... |
import tests.exog.test_random_exogenous as testrandexog
testrandexog.test_random_exogenous( 8,160); | {
"content_hash": "3f1adb4c85a2f38bd432949a3efc19f0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 55,
"avg_line_length": 25.25,
"alnum_prop": 0.8217821782178217,
"repo_name": "antoinecarme/pyaf",
"id": "abbb121f7cfb14ce8b9d00d05af731692008ef6c",
"size": "101",
"binary"... |
from __future__ import absolute_import
import asyncio
from thriftpy2.thrift import TType
from thriftpy2.protocol.exc import TProtocolException
from thriftpy2.protocol.binary import (
VERSION_MASK,
VERSION_1,
TYPE_MASK,
unpack_i8,
unpack_i16,
unpack_i32,
unpack_i64,
unpack_double,
... | {
"content_hash": "f75c1383a0fb87b18ac693bb499e58bb",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 79,
"avg_line_length": 28.76306620209059,
"alnum_prop": 0.579648697758934,
"repo_name": "cloudera/hue",
"id": "fa5e3a7eb6f83962ea29063f626484cf584fbc05",
"size": "8280",
... |
import sys
architectures = set((s.upper() for s in sys.argv[1:]))
histogram = {}
for uops in range(100):
histogram[uops] = []
for line in sys.stdin:
F = line.split()
arch = F[0]
uops = int(F[1])
instr = ' '.join(F[2:])
if arch not in architectures:
continue
histogram[uops].app... | {
"content_hash": "b5e8da8b04d990a405ee5bafed6d6ed9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 54,
"avg_line_length": 20.78048780487805,
"alnum_prop": 0.5610328638497653,
"repo_name": "WojciechMula/toys",
"id": "492c449c6d2a7773bd3fd3fdb17b112794f444aa",
"size": "852... |
__all__ = [
'image',
'enums',
'types',
'draw',
]
import ctypes
import atexit
for dll_name in ('libMagickCore.so', 'libMagick.so', 'CORE_RL_magick_.dll'):
try:
lib = ctypes.CDLL(dll_name)
except OSError:
pass
else:
break
else:
raise RuntimeError("Can't find i... | {
"content_hash": "424cd98ddfa233b6aacfb0c71e94c37f",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 19.84375,
"alnum_prop": 0.662992125984252,
"repo_name": "tailhook/magickpy",
"id": "85828ea5d207b575ca91339a9e74917f5ba8a35f",
"size": "635",
"bina... |
from __future__ import unicode_literals
import deepnlp
deepnlp.download(module='pos',name='en') # download the POS pretrained models from github if installed from pip
from deepnlp import pos_tagger
tagger = pos_tagger.load_model(name = 'en') # Loading English model, lang code 'en'
#Segme... | {
"content_hash": "bd31b376f2a7d6173508b79ff4c6e8b4",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 131,
"avg_line_length": 22.444444444444443,
"alnum_prop": 0.6402640264026402,
"repo_name": "rockingdingo/deepnlp",
"id": "04f2a999ac9ea474e9b984f1469b5a0df95029e3",
"size":... |
import numbers
import warnings
from collections import Counter
import numpy as np
import numpy.ma as ma
from scipy import sparse as sp
from ..base import BaseEstimator, TransformerMixin
from ..utils._param_validation import StrOptions
from ..utils.fixes import _mode
from ..utils.sparsefuncs import _get_median
from ..... | {
"content_hash": "1eaef1b2b89d8e7002d8130f7b2b1a10",
"timestamp": "",
"source": "github",
"line_count": 1037,
"max_line_length": 88,
"avg_line_length": 36.80038572806172,
"alnum_prop": 0.5697290498401552,
"repo_name": "AlexandreAbraham/scikit-learn",
"id": "225ae249b2107d248ca4127b5d5b8e1bf8e05797",
... |
import os
import sys
import shlex
from subprocess import PIPE
from process import spawn
from .error import AnaGondaError, GoGetError
class AnaGondaContext(object):
"""Every anaGonda context must inherit from this class
"""
def __init__(self, env_ctx, go_get_url):
self.__go_get_url = go_get_url
... | {
"content_hash": "b516da42dee80ef0e04494e72f1217a0",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 65,
"avg_line_length": 27.087912087912088,
"alnum_prop": 0.5160243407707911,
"repo_name": "danalec/dotfiles",
"id": "9e04ea9bd191f988cdadfb29f866ccc23f135ba1",
"size": "260... |
"""Resource definitions for cloud platform apis."""
import enum
BASE_URL = 'https://cloudresourcemanager.googleapis.com/v1beta1/'
class Collections(enum.Enum):
"""Collections for all supported apis."""
ORGANIZATIONS = (
'organizations',
'organizations/{organizationsId}',
{},
[u'organiz... | {
"content_hash": "f8b1f7f2a48dcf95388d4bffe51f83ec",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 65,
"avg_line_length": 21.413793103448278,
"alnum_prop": 0.6344605475040258,
"repo_name": "KaranToor/MA450",
"id": "344226a667a90dba9d83febbad36a2a73cb45df6",
"size": "1216... |
"""Implementation of gcloud genomics callsets update.
"""
from googlecloudsdk.api_lib.genomics import genomics_util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import log
class Update(base.UpdateCommand):
"""Updates a call set name.
"""
@staticmethod
def Args(parser):
"""Register f... | {
"content_hash": "ea7be0d7d3d3530ea3df6e2cda5a1746",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 31.32075471698113,
"alnum_prop": 0.6295180722891566,
"repo_name": "KaranToor/MA450",
"id": "6ecd92143a3d39d06db5e25c1731bbd37e6a63b5",
"size": "2256"... |
"""Unittests for Popup Forms functionality"""
from unittest import skip
from django import test, forms
from django.conf.urls.defaults import patterns, url
from django.http import HttpResponse
from django.shortcuts import render
import popup_forms
from django.core.urlresolvers import reverse
try:
from django.tes... | {
"content_hash": "39f8fc0832d8d649722090db32d0608c",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 85,
"avg_line_length": 36.154545454545456,
"alnum_prop": 0.6401810409856676,
"repo_name": "joinourtalents/django-popup-forms",
"id": "ffc8bfc8606a8125d158fb8d3e15bb235913261... |
from app import app, cfg, error, engine, create_session, abort
from common import types_handler
from sqlalchemy import exc, Table, MetaData
from sqlalchemy.orm import mapper
from simplejson import dumps as sdumps
import json
log = app.logger
def all_warehouse():
''' scan warehouse table '''
result = None
... | {
"content_hash": "26f79f60e00cdf8b907a2a19013eef42",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 100,
"avg_line_length": 32.31707317073171,
"alnum_prop": 0.6064150943396226,
"repo_name": "monchitos82/shop2",
"id": "bcaa4347d0e4309e03c43ecb21c82d278b034a72",
"size": "26... |
"""
Support for displaying collected data over SNMP.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.snmp/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.helpers.entity import Entity
from homeassistan... | {
"content_hash": "e22f8531bc9f01f464a51ced5479f6af",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 33.59701492537314,
"alnum_prop": 0.609729009329187,
"repo_name": "deisi/home-assistant",
"id": "59730624a114e52e96f770b37816cd077a40eb8d",
"size": "... |
import os
import re
from flask import request
import psycopg2
from sqlalchemy import create_engine, types
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.pool import NullPool
from sqlalchemy.ext.declarative import declarative_base
from psycopg2.extensions import adapt, register_adapter, AsIs
en... | {
"content_hash": "d82d9060bca4ec0dded69b882ac2ae1e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 67,
"avg_line_length": 38.3125,
"alnum_prop": 0.7177814029363785,
"repo_name": "apanella/ContiguousBuildings",
"id": "01248cb5bd6c5e448ec3e13934c27d637d21eedc",
"size": "61... |
import unittest
from cStringIO import StringIO
from csvkit.convert import fixed
class TestFixed(unittest.TestCase):
def test_fixed(self):
with open('examples/testfixed', 'r') as f:
with open('examples/testfixed_schema.csv', 'r') as schema:
output = fixed.fixed2csv(f, schema)
... | {
"content_hash": "f364a5a5e8a94b780cc464b67b3eff6a",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 88,
"avg_line_length": 36.75824175824176,
"alnum_prop": 0.5907324364723467,
"repo_name": "moradology/csvkit",
"id": "4ff91c2d5f5a28421009ee1d31ab62a3c1c883d0",
"size": "334... |
"""Plugin utilities."""
import logging
import os
import socket
import zope.component
from certbot import interfaces
from certbot import util
try:
import psutil
USE_PSUTIL = True
except ImportError:
USE_PSUTIL = False
logger = logging.getLogger(__name__)
RENEWER_EXTRA_MSG = (
" For automated renewal... | {
"content_hash": "5d91d41d9e32226a7a570f455a07abcc",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 78,
"avg_line_length": 34.19871794871795,
"alnum_prop": 0.6118088097469541,
"repo_name": "jtl999/certbot",
"id": "b97ca1afd9423f9fe36ab27b30ab5a37cebee7fe",
"size": "5335"... |
import re
import pyparsing as pp
# Entry class responsible for replacing all mentions of the technology for #0#/#1#
class TechRemover:
def __init__(self, code, technology, alwaysTrue, file, log):
self.code = code
self.tech = technology
self.log = log
self.alwaysTrue = alwaysTru... | {
"content_hash": "4b65b5879ac919c97fa0d9ed50f0c187",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 199,
"avg_line_length": 42.965870307167236,
"alnum_prop": 0.5505600127095083,
"repo_name": "VHonzik/VBSTechRemoval",
"id": "45335d236b6287b6620009498f388f997e99c05a",
"siz... |
"""This module contains a collection of utilities/common code
that will be used by all integration tests that validate the
spiders service.
"""
from cloudfeaster_services.spiders import __api_version__
from ..integration_tests import IntegrationTestCase
from ..integration_tests import IntegrationTestEnv
from ..integra... | {
"content_hash": "b10edfbe1995f207097e7ed1a9a85d5f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 82,
"avg_line_length": 27.65,
"alnum_prop": 0.6998191681735986,
"repo_name": "simonsdave/cloudfeaster-services",
"id": "ba05871d3d009a4a41662b317d0b245a83d50f34",
"size": "... |
import os
import urllib2
import datetime
from sauron import logger
from sauron.metrics import Metric, MetricException
class PingMetric(Metric):
def reconfig(self, url, **kwargs):
'''parameters: url, [ post={}, timeout=30 ]'''
Metric.reconfig(self, **kwargs)
self.url = url
def values(self):
star... | {
"content_hash": "2e69de79e2a4818ca4fae49dc3aa4072",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 65,
"avg_line_length": 28.166666666666668,
"alnum_prop": 0.6520710059171597,
"repo_name": "johnny-die-tulpe/illuminati",
"id": "86a470d196747b891da7b4e8e3e027ae5918b50b",
"... |
"""Tasklib cmd interface
Exit Codes:
ended successfully - 0
running - 1
valid but failed - 2
unexpected error - 3
notfound such task - 4
"""
import argparse
import sys
import textwrap
import yaml
from tasklib import agent
from tasklib import config
from tasklib import logger
from tasklib import task
from tasklib imp... | {
"content_hash": "75d49318ba1565f0ff5820725fab48bf",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 77,
"avg_line_length": 29.686274509803923,
"alnum_prop": 0.619220607661823,
"repo_name": "andrei4ka/fuel-web-redhat",
"id": "bb0cce283c3cc8b3886a8805262af1f331b40695",
"si... |
"""Tests for the GogoGate2 component."""
from unittest.mock import MagicMock, patch
from ismartgate import GogoGate2Api, ISmartGateApi
from ismartgate.common import ApiError
from ismartgate.const import GogoGate2ApiErrorCode
from homeassistant import config_entries
from homeassistant.components import dhcp, zeroconf
... | {
"content_hash": "fb1afe2306b763d687fac8a9ff476b25",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 88,
"avg_line_length": 33.20890410958904,
"alnum_prop": 0.6164793235021141,
"repo_name": "mezz64/home-assistant",
"id": "cbe40a2b9cbdc5831fd1d79f3f9ae3ece920cb8a",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.