text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Module where wpadmin dashboard classes are defined.
"""
# DJANGO IMPORTS
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django import forms
# WPADMIN IMPORTS
from wpadmin.dashboard import modules
from wpadmin.dashboard.utils import get_admin_site_name
c... | {
"content_hash": "f68913c8f6db508db947889a6cabf81f",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 32.357894736842105,
"alnum_prop": 0.5517241379310345,
"repo_name": "nwaxiomatic/django-wpadmin",
"id": "7b7d26d420a22edbcbb33f78f7afef194e235f10",
"... |
"""
Kay test views.
:Copyright: (c) 2009 Takashi Matsuo <tmatsuo@candit.jp> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from werkzeug import (
unescape, redirect, Response,
)
from google.appengine.ext.ndb import context
from kay.utils import (
local, render_to_response, url_for,
)
from ... | {
"content_hash": "68fd23f5580175447ad43b64f468ac8a",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 76,
"avg_line_length": 20.125,
"alnum_prop": 0.7251552795031055,
"repo_name": "yosukesuzuki/kay-template",
"id": "bfa4ee0a30e08b68ac4de17c2fcc609d3270ff6a",
"size": "1313",... |
"""Popup calendar widget module."""
import time
from gi.repository import (
GObject,
Gdk,
Gtk,
)
class InvalidDate(Exception):
"""Invalid date custom exception class.
:param str date: the invalid date string to put in the message
"""
def __init__(self, date):
"""Set exception ... | {
"content_hash": "63a3045954e5edb025777a9802752a00",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 78,
"avg_line_length": 32.64026402640264,
"alnum_prop": 0.560262891809909,
"repo_name": "jcollado/datagrid-gtk3",
"id": "12b88cc82d29ddb1ff6d5756009b5204870dd35c",
"size":... |
"""
History Handler
"""
from base import BaseHandler
from views import history_tpl as tpl
from models import *
__author__ = "Luke Southam <luke@devthe.com>"
__copyright__ = "Copyright 2012, DEVTHE.COM LIMITED"
__license__ = "The BSD 3-Clause License"
__status__ = "Development"
class Handler(BaseHandler):
def get... | {
"content_hash": "f699d14e2603c81122632e0887ddea20",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 29.083333333333332,
"alnum_prop": 0.6318051575931232,
"repo_name": "o4dev/PythonicWiki",
"id": "acf15ed33487e9dec3e1a455debf432a7101fcf5",
"size": "2... |
from paillier import *
class Voter(object):
def __init__(self, name, voterID):
self.name = name
self.voterID = voterID
self.voted = False
priv, pub = generate_keypair(128)
self.private_key = priv
self.public_key = pub
def __repr__(self):
return 'Voter(\... | {
"content_hash": "c42c57b36f87c3f792f0c583a46b6fb0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 86,
"avg_line_length": 27.294117647058822,
"alnum_prop": 0.5668103448275862,
"repo_name": "kelleyb/CryptoProject",
"id": "24260e9be3b7b9cb484d8a0dc4070420a1777f0b",
"size":... |
import scrapy
from lfcs_scraping.items import PersonItem
import re
class CurrentLfcs(scrapy.Spider):
name = "currentlfcs"
#allowed_domains = ["http://wcms.inf.ed.ac.uk/"]
start_urls = [
#"http://web.archive.org/web/20110319001651/http://wcms.inf.ed.ac.uk/lfcs/people"
"http://wcms.in... | {
"content_hash": "d133f40e7cb06981864f082ae27c5da5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 106,
"avg_line_length": 34.82857142857143,
"alnum_prop": 0.4946677604593929,
"repo_name": "AWilcke/LFCS-History",
"id": "e60cd418db6502e3e11938391bc58e3086fef1df",
"size": ... |
"""
Renaming domains testcases
List of tested functions :
--------------------------
- [renameDomain] function
Test cases :
------------
- Nominal cases
- Renaming errors
- Special cases
"""
import os
from Util.PfwUnitTestLib import PfwTestCase
from Util import ACTLogging
log=ACTLogging.Logger()
# T... | {
"content_hash": "2fe364dd6d1014009e9319506ca4fe0b",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 130,
"avg_line_length": 43.14983713355049,
"alnum_prop": 0.5726579602928965,
"repo_name": "dawagner/parameter-framework",
"id": "2ee54148e875149324607adf8c174719e2ecca67",
... |
"""Reader for a single worksheet."""
# Python stdlib imports
try:
from xml.etree.cElementTree import iterparse
except ImportError:
from xml.etree.ElementTree import iterparse
from itertools import ifilter
from StringIO import StringIO
# package imports
from openpyxl.cell import Cell, coordinate_from_string
fr... | {
"content_hash": "e497afd3cc31a48f1907a06b1c2e96a9",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 97,
"avg_line_length": 29.021978021978022,
"alnum_prop": 0.6262779250283983,
"repo_name": "chronossc/openpyxl",
"id": "dd96ac896b8a2cef0a2d6ff07d7b5aa94d00338f",
"size": "3... |
"""
Table of command codes is in Section 4.1, page 58.
"""
import re
from decimal import Decimal
def parse_command(s):
if s[0] == '%':
# Extended commands, identify by first 3 chars
code = s[1:3]
cls = extended_commands[code]
return cls.from_string(s)
else:
# For normal... | {
"content_hash": "5d78b3bc6591678d24f4efcfcefad319",
"timestamp": "",
"source": "github",
"line_count": 485,
"max_line_length": 77,
"avg_line_length": 24.17938144329897,
"alnum_prop": 0.5774707938944317,
"repo_name": "storborg/regerberate",
"id": "a28d01245c67f4a2728d6e6dd3be13973604f44d",
"size": ... |
from automlk.dataset import get_dataset_list
from automlk.store import get_key_store, set_key_store, exists_key_store
"""
update results with pct and cv
"""
missing = []
for dt in get_dataset_list():
res = get_key_store('dataset:%s:rounds' % dt.dataset_id)
flag = False
if res is not None:
for r ... | {
"content_hash": "3e538105e4e6ecfa9ede3adbdf9dfc10",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 72,
"avg_line_length": 30.855072463768117,
"alnum_prop": 0.42743071864725224,
"repo_name": "pierre-chaville/automlk",
"id": "3657408b63803ca24a2f038247417b4d58fd5203",
"siz... |
from bomb_defusal.view.module import Module
from bomb_defusal.view.utils.helper import load_model
class Port(Module):
def __init__(self, model):
"""
Initializes a new instance of the :class:`Port` class.
:param bomb_defusal.modules.Port model: Model of the port module
"""
... | {
"content_hash": "673d631038febb0faf96e93406578c9b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 33.9375,
"alnum_prop": 0.6243093922651933,
"repo_name": "leupibr/BombDefusal",
"id": "23ecab21d69ee67dfb4a82e2a459e19bcf17e1ef",
"size": "543",
"bi... |
import pytest
import sys
import time
import cPickle as pickle
from test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
from aerospike.exception import *
except:
print "Please install aerospike python client."
sys.exit(1)
class SomeClass(object):
pass
class TestDro... | {
"content_hash": "35a24c5124f92c269a1a5e310be1a972",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 89,
"avg_line_length": 28.773809523809526,
"alnum_prop": 0.5639222176251552,
"repo_name": "arthurprs/aerospike-client-python",
"id": "1970d9461659337d7fa14cf147dd4d70ed27e59... |
import copy
from itertools import chain
from django import forms
from django.contrib.postgres.validators import (
ArrayMaxLengthValidator, ArrayMinLengthValidator,
)
from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy a... | {
"content_hash": "776892e13aae9616ea6df3c659f91bfe",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 101,
"avg_line_length": 35.301507537688444,
"alnum_prop": 0.5639857651245551,
"repo_name": "twz915/django",
"id": "9a9e871a438dbf85231a4a5eb27b4803560ddfec",
"size": "7025... |
from stagecraft.apps.datasets.models.data_group import DataGroup
from stagecraft.apps.datasets.models.data_set import DataSet
from stagecraft.apps.datasets.models.data_set import generate_data_set_name
from stagecraft.apps.datasets.models.data_type import DataType
from stagecraft.apps.datasets.models.oauth_user import ... | {
"content_hash": "d6f306bc90be44e7d2b3e1d8487beeed",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 75,
"avg_line_length": 66,
"alnum_prop": 0.8545454545454545,
"repo_name": "alphagov/stagecraft",
"id": "2105dc6d511c2541f9bbb3a69e5746c30cdfbe2a",
"size": "330",
"binary":... |
from __future__ import absolute_import, unicode_literals
from django.apps import AppConfig
class TXMoneyRatesConfig(AppConfig):
name = 'txmoney.rates'
label = 'txmoney'
verbose_name = "TXMoney Rates"
def ready(self):
pass
| {
"content_hash": "9ed239f83a6622dd383429a929b11dd5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.692,
"repo_name": "txerpa/dj-txmoney",
"id": "fe8ed5d3a3c4bf5d89a49fe9ae8fb36fa2ba6908",
"size": "265",
"binary... |
import collections
import hashlib
import json
from github import MainClass
import six
from stackalytics.openstack.common import log as logging
from stackalytics.processor import normalizer
from stackalytics.processor import record_processor
from stackalytics.processor import utils
from stackalytics.processor import v... | {
"content_hash": "2dd3ca97075cd32acb270c9b72f40ee4",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 34.90865384615385,
"alnum_prop": 0.6344856080429693,
"repo_name": "knewstadt/stackalytics",
"id": "79212e0d23921ea9b7175b2c5f7d228a16fff084",
"size"... |
import pytest
import tensorflow as tf
import numpy as np
from tfs.dataset.skdata import *
from tfs.data_processor import StandardScaler,MinMaxScaler,Normalizer
@pytest.fixture
def data():
return MakeBlobs(test_percent=0.3,n_samples=100)
class TestSKlearnProcessor:
def test_standard_scaler(self,data):
p = Sta... | {
"content_hash": "6f8fc9f5fa7756077d71b3b3c848e5d6",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 69,
"avg_line_length": 26.19047619047619,
"alnum_prop": 0.7081818181818181,
"repo_name": "crackhopper/TFS-toolbox",
"id": "ca42d54dc7a02ba45e55f3ee16aff9277c356021",
"size"... |
from __future__ import division, print_function, absolute_import
import warnings
import threading
from . import sigtools
from scipy._lib.six import callable
from scipy._lib._version import NumpyVersion
from scipy import linalg
from scipy.fftpack import (fft, ifft, ifftshift, fft2, ifft2, fftn,
... | {
"content_hash": "13d5f4ed078af68397eef0911cb64791",
"timestamp": "",
"source": "github",
"line_count": 2670,
"max_line_length": 92,
"avg_line_length": 32.77378277153558,
"alnum_prop": 0.5587616849130346,
"repo_name": "trankmichael/scipy",
"id": "d8605f606386fbc89385d41093c5bbebc5da4909",
"size": "... |
'''
Created on May 30, 2013
@author: vieglais
TODO:
Command line:
d1cache [options] [operation]
operation:
update
purge
summary
serve
'''
import os
import logging
import datetime
import time
import yaml
import shutil
import threading
import Queue
from collections import deque
from sqlalchemy import creat... | {
"content_hash": "efa2be81fcb75beb6ca34e0381bdc7fa",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 95,
"avg_line_length": 32.66216216216216,
"alnum_prop": 0.6084283941131272,
"repo_name": "vdave/d1_local_cache",
"id": "e1ad7b3544fa20643704e417c997236f1c80a85c",
"size": ... |
from weaver.compat import execfile
from weaver.logger import D_SCRIPT, debug, fatal
from weaver.nest import Nest
from weaver.options import Options
from weaver.util import Container
from weaver.script import Script
from weaver.script import ABSTRACTIONS
from weaver.script import DATASETS
from weaver.script ... | {
"content_hash": "199d7933dff94a38fa5dc6c0d5bdb0fc",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 98,
"avg_line_length": 43.26923076923077,
"alnum_prop": 0.62,
"repo_name": "FAANG/faang-methylation",
"id": "b98e9d073245154b55449ce0d788ec373e852836",
"size": "5170",
"... |
import os
import urlparse
from unipath import FSPath as Path
from django.core.exceptions import ImproperlyConfigured
PROJECT_DIR = Path(__file__).absolute().ancestor(3)
def get_env_variable(var_name):
""" Get the environment variable or return an exception """
try:
return os.environ[var_name]
ex... | {
"content_hash": "73187ac5c0b4ead5b0c0c11ef4733163",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 81,
"avg_line_length": 27.492957746478872,
"alnum_prop": 0.6644467213114754,
"repo_name": "Teino1978-Corp/Teino1978-Corp-gistio",
"id": "d40c03cca26f95b457d99b48d42f203ad91c... |
import sys
sys.path.append('gen-py')
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TCompactProtocol
from ping import Ping
def bench(n):
transport = TSocket.TSocket('127.0.0.1', 9090)
tranport = TTransport.TFramedTransport(transport)
protocol = T... | {
"content_hash": "e9f4903f213e925eb75990141b00ca3a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 58,
"avg_line_length": 21.96969696969697,
"alnum_prop": 0.6579310344827586,
"repo_name": "decimalbell/muduo-thrift",
"id": "3a97169398222cba0bf93e37440ac96d133bf6d1",
"size... |
from django.contrib import admin
from wrecks.models import Wreck
from wrecks.models import WreckType
class WreckAdmin(admin.ModelAdmin):
list_display = ('name', 'year_sunk', 'depth_meters', 'location')
list_filter = ('source', 'wreck_type')
admin.site.register(Wreck, WreckAdmin)
admin.site.register(WreckType... | {
"content_hash": "8532cc8f002ec42912687c974a544049",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 68,
"avg_line_length": 29.181818181818183,
"alnum_prop": 0.7507788161993769,
"repo_name": "greencoder/shipwrecksproject",
"id": "4e550165632d5deb921ee42b9dfe90e59ea23d94",
... |
import logging; logger = logging.getLogger("morse." + __name__)
import morse.core.robot
import PhysicsConstraints
class HummerClass(morse.core.robot.MorseRobotClass):
""" Class definition for the Hummer.
Sub class of Morse_Object. """
def __init__(self, obj, parent=None):
""" Constructor meth... | {
"content_hash": "42bd9e77c92dbbc509ebd1053e204da1",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 137,
"avg_line_length": 36.883597883597886,
"alnum_prop": 0.6349160809066131,
"repo_name": "Arkapravo/morse-0.6",
"id": "5cd81e69fba112f0ee6d55c4b5995c8ae5663061",
"size":... |
from moksha.api.widgets.live import LiveWidget
class HelloWorldWidget(LiveWidget):
topic = "helloworld"
template = """
<b>Hello World Widget</b>
<form onsubmit="return send_msg()">
<input name="text" id="text"/>
</form>
<ul id="data"/>
<script>
... | {
"content_hash": "2a40f83a6bd482276d2e0ee8400136f4",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 26.434782608695652,
"alnum_prop": 0.46875,
"repo_name": "ralphbean/moksha",
"id": "d77e9749fda80d08bfb075d22bab1ca2c583b5b2",
"size": "608",
"binar... |
from msrest.paging import Paged
class OperationPaged(Paged):
"""
A paging container for iterating over a list of :class:`Operation <azure.mgmt.eventgrid.models.Operation>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', '... | {
"content_hash": "c3d46c81e6007cdaf905a0c4e6b8775a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 117,
"avg_line_length": 28.3125,
"alnum_prop": 0.5982339955849889,
"repo_name": "samedder/azure-cli",
"id": "2c253a55d5ac3ecf89e1c10ddc640b82326a105a",
"size": "1142",
"b... |
"""
This module provides utility classes for string operations.
"""
import re
from fractions import Fraction
SUBSCRIPT_UNICODE = {
"0": "₀",
"1": "₁",
"2": "₂",
"3": "₃",
"4": "₄",
"5": "₅",
"6": "₆",
"7": "₇",
"8": "₈",
"9": "₉",
}
SUPERSCRIPT_UNICODE = {
"0": "⁰",
"1... | {
"content_hash": "3219267eaf4151152137dea6690124d6",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 118,
"avg_line_length": 32.36,
"alnum_prop": 0.5914345960881262,
"repo_name": "gmatteo/pymatgen",
"id": "07ba7c0509e0bc010ebad834c6cc9c05d4330c31",
"size": "13913",
"bin... |
import os
import pytest
import tarfile
from bs4 import BeautifulSoup
from copy import deepcopy
from six import BytesIO
from dlkit.abstract_osid.osid import errors
from dlkit.json_.osid.objects import OsidObject
from dlkit.records.repository.edx.utilities import *
from ... import utilities
PROJECT_PATH = os.path.dir... | {
"content_hash": "755b38404d4660275ca6c56a18cc0540",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 110,
"avg_line_length": 40.572649572649574,
"alnum_prop": 0.6191278702338319,
"repo_name": "mitsei/dlkit",
"id": "b51be66476e2688ac2a84016f90e2a572c760c2e",
"size": "4747"... |
import types
import importlib
FUNC_FULL_DISPLAY=False
class Param(object):
def __init__(self,**kwargs):
self.__dict__ = kwargs
def print_str(self):
info = []
for n in self.print_names:
value = self.__dict__[n]
if isinstance(value,types.FunctionType):
if FUNC_FULL_DISPLAY:
... | {
"content_hash": "d05bd350c799c76b0a2fb6c357133a94",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 80,
"avg_line_length": 25.438356164383563,
"alnum_prop": 0.5740441572428648,
"repo_name": "crackhopper/TFS-toolbox",
"id": "d71fa5af2423ff25eb8c7d6ab683b74bca7239ee",
"size... |
from django.conf.urls import patterns, url
from home import views
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index')
)
| {
"content_hash": "35eb8fee9bbd3575c5d1426319c48cd2",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 20.75,
"alnum_prop": 0.6385542168674698,
"repo_name": "ritashugisha/ASUEvents",
"id": "a9736b85ff625b35c4579dc0663f4db9bfaedd5d",
"size": "166",
"bi... |
tests=[
("testExecs/testTransforms.exe","",{}),
("testExecs/testGrid.exe","",{}),
]
longTests=[]
if __name__=='__main__':
import sys
from rdkit import TestRunner
failed,tests = TestRunner.RunScript('test_list.py',0,1)
sys.exit(len(failed))
| {
"content_hash": "4e3f4a85a6c6db531582b770a83ca66a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 57,
"avg_line_length": 18.285714285714285,
"alnum_prop": 0.6328125,
"repo_name": "adalke/rdkit",
"id": "d6487ed0b23dc13b33fb077a125b4821f137bfbc",
"size": "257",
"binary"... |
import os
import logging
import copy
import time
from datetime import timedelta
from ignite.engine import Events, Engine, EventEnum
from ignite.handlers import Timer
from ignite.contrib.handlers import ProgressBar
from ignite.metrics import RunningAverage
from torch.utils.tensorboard import SummaryWriter
import torch
... | {
"content_hash": "26c130c93a12d121c6bf0e80d019da1a",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 91,
"avg_line_length": 37.42816901408451,
"alnum_prop": 0.6270790998720553,
"repo_name": "interactiveaudiolab/nussl",
"id": "cb90e005e4a0591510accb0ac3868959326f791a",
"si... |
import os
import re
import sys
import copy
import zlib
import time
import shlex
import shutil
import fnmatch
import tarfile
import argparse
import platform
import datetime
import tempfile
import posixpath
import subprocess
from build.common import *
from build.config import *
from build.build import *
def die (msg):
... | {
"content_hash": "81da52f782dde46ec53b8b0d3395aa62",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 148,
"avg_line_length": 33.458984375,
"alnum_prop": 0.7032864397875197,
"repo_name": "geekboxzone/mmallow_external_deqp",
"id": "cf3f48923539b109cd5c6d3ff41176aaac2c6a68",
... |
from unittest import mock
from oslo_policy import policy as base_policy
from oslo_utils import uuidutils
from neutron import policy
from neutron.tests.unit.conf.policies import test_base as base
class SecurityGroupAPITestCase(base.PolicyBaseTestCase):
def setUp(self):
super(SecurityGroupAPITestCase, se... | {
"content_hash": "325510f29224682f7415b82e7c42f08c",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 79,
"avg_line_length": 35.150159744408946,
"alnum_prop": 0.639338302126886,
"repo_name": "openstack/neutron",
"id": "cdb11c653016d7ab6257083dd462330bbef460db",
"size": "11... |
from __future__ import annotations
import json
from datetime import timedelta as td
from unittest.mock import patch
from django.core import mail
from django.utils.timezone import now
from hc.api.models import Channel, Check, Notification
from hc.test import BaseTestCase
class NotifyWhatsAppTestCase(BaseTestCase):
... | {
"content_hash": "b1b09099ded00a59632c04d310313645",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 83,
"avg_line_length": 32.577777777777776,
"alnum_prop": 0.6480218281036835,
"repo_name": "healthchecks/healthchecks",
"id": "caca72a8908eb9d59df4722f80a2801f4d046089",
"si... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib import layers
from tensorflow.contrib.framework.python.ops import arg_scope
from tensorflow.contrib.layers.python.layers import layers as layers_lib
from tensorflow.contrib.layers.python... | {
"content_hash": "8197ce33367af1258918f2607a6c2a8e",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 87,
"avg_line_length": 45.79120879120879,
"alnum_prop": 0.6193904487640989,
"repo_name": "Aaron-Zhao123/nn_library",
"id": "f9e63af23f7835218b4d78fe695bf308ebb8c6d6",
"size... |
from __future__ import absolute_import
import collections
import functools
import logging
import warnings
from ._collections import RecentlyUsedContainer
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from .connectionpool import port_by_scheme
from .exceptions import (
HTTPWarning,
Locati... | {
"content_hash": "9d20ac3e35d6b2bacf5e0108d8edfb9d",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 92,
"avg_line_length": 36.073584905660375,
"alnum_prop": 0.6205868507767143,
"repo_name": "gregbdunn/aws-ec2rescue-linux",
"id": "a0e5b974b900da80ee975bbdcabde9e11b36b8d2",
... |
"""
This module contains a Salesforce Hook which allows you to connect to your Salesforce instance,
retrieve data from it, and write that data to a file for other uses.
.. note:: this hook also relies on the simple_salesforce package:
https://github.com/simple-salesforce/simple-salesforce
"""
import logging
impo... | {
"content_hash": "a0cab73062f3554763418403ed0f50ce",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 110,
"avg_line_length": 44.255208333333336,
"alnum_prop": 0.6299870542544428,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "97c2697b452cc586504d271f2865b36b4ead33a4",
... |
__all__ = ['BaseResolver', 'Resolver']
from error import *
from nodes import *
import re
class ResolverError(YAMLError):
pass
class BaseResolver(object):
DEFAULT_SCALAR_TAG = u'tag:yaml.org,2002:str'
DEFAULT_SEQUENCE_TAG = u'tag:yaml.org,2002:seq'
DEFAULT_MAPPING_TAG = u'tag:yaml.org,2002:map'
... | {
"content_hash": "336360f2e9c512fdc435bf9e574d24bc",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 82,
"avg_line_length": 40.228699551569505,
"alnum_prop": 0.5292609519563036,
"repo_name": "KaranToor/MA450",
"id": "1d6ee2e8fafc10a93e420fb09a64ddd08159e701",
"size": "899... |
"""
PyValitron
~~~~~~
Python Inputs Validation Library
:copyright: (c) 2016 by Clivern (hello@clivern.com).
:license: MIT, see LICENSE for more details.
"""
from .validator import Validator
from .sanitizer import Sanitizer
from .utils import Utils
from .exceptions import PyValitronError
class Form... | {
"content_hash": "38dc8ebc01d41c9808aec91249727b68",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 149,
"avg_line_length": 37.210191082802545,
"alnum_prop": 0.562307428962684,
"repo_name": "Clivern/PyValitron",
"id": "1220bea091af8f4559d8b51b76d7fd1fbc91c087",
"size": "... |
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Codec:
def serialize(self, root):
"""
Encodes a tree to a single string.
:type root: TreeNode
:rtype: str
"""
def doit(node):
... | {
"content_hash": "d4f629152612cea062bb43616ca4bfd5",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 60,
"avg_line_length": 24.53846153846154,
"alnum_prop": 0.4992163009404389,
"repo_name": "rx2130/Leetcode",
"id": "3fd33492e1df680754307d2098a7f37997bf00a3",
"size": "1313"... |
import chstrings
import config
import unittest
import mock
class CHStringsTest(unittest.TestCase):
@classmethod
def add_smoke_test(cls, cfg):
def test(self):
# We just want to see if this will blow up. Use the fallback
# lang_tag across all tests.
lang_tag = cfg.la... | {
"content_hash": "745f7d2a498c125d53fa087c0dfa10b8",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 79,
"avg_line_length": 39.88135593220339,
"alnum_prop": 0.6060348491287718,
"repo_name": "eggpi/citationhunt",
"id": "1fcd8aae6acab413894b68bcd1a3bbcd9121c311",
"size": "23... |
from django.db import models
from django.utils.translation import ugettext_lazy as _, get_language
from django.contrib.auth.models import User, Group
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from parler.models import TranslatableModel, TranslatedFields
from model_ut... | {
"content_hash": "0910f2456b31417e444f364bf07333cb",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 109,
"avg_line_length": 30.305084745762713,
"alnum_prop": 0.6038404175988069,
"repo_name": "allink/allink-apps",
"id": "052968f9af71e16fbcbb5b986f5709b231f4caed",
"size": ... |
from django.shortcuts import render
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from wagtail.wagtailcore.models import Page
from wagtail.wagtailsearch.models import Query
import requests
try:
# Wagtail >= 1.1
from wagtail.contrib.wagtailsearchpromotions.models import SearchPromoti... | {
"content_hash": "20031b22d737ad507086ced9b97bc619",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 333,
"avg_line_length": 37.91228070175438,
"alnum_prop": 0.6881073577047663,
"repo_name": "igauravsehrawat/child-voice",
"id": "a72cb35def1a3623a9639f511dd1318ebfaab4a9",
"... |
import pytest
from pook import MockEngine, Engine
from pook.interceptors import BaseInterceptor
class Interceptor(BaseInterceptor):
def activate(self):
self.active = True
def disable(self):
self.active = False
@pytest.fixture
def engine():
return MockEngine(Engine())
def test_mock_eng... | {
"content_hash": "06fe99ab3dd0e6f73eccdd5b87fe77a0",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 58,
"avg_line_length": 24.215686274509803,
"alnum_prop": 0.725506072874494,
"repo_name": "h2non/pook",
"id": "19943649caa2fa426ae09405dfbed67b2639cdd8",
"size": "1260",
"... |
from datetime import date
from dateutil.relativedelta import relativedelta as rd
from holidays.constants import JAN, MAR, MAY, JUN, NOV, DEC, SAT, SUN
from holidays.holiday_base import HolidayBase
from holidays.utils import islamic_to_gre
OBSERVED_SUFFIX = " (Observed)"
class Azerbaijan(HolidayBase):
# https://... | {
"content_hash": "4e50978fe100802408d0740c7790e9d3",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 70,
"avg_line_length": 32.135416666666664,
"alnum_prop": 0.5918962722852512,
"repo_name": "ryanss/holidays.py",
"id": "0dba4bbc83d43023b199fae3bb94fab3e67df966",
"size": "3... |
import uuid
import time
import base64
import odict
import hashlib
import hmac
import json
from db_interface import (
verify_timestamp, verify_nonce, accepted_hash_method,
get_key_and_id_for_qr_login
)
from constants import API_SECRET
# common functions used by the QRAccess SDK
def auth(customer_id, secret_k... | {
"content_hash": "717f8e3d0e200294bdc12747ed0ba402",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 106,
"avg_line_length": 37.583333333333336,
"alnum_prop": 0.6215248166467678,
"repo_name": "drivefast/pycipherwallet",
"id": "478b10abb64fe033601fd7f1a8c414aa94a10776",
"s... |
import contextlib
import os
import tempfile
from cinder import db
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder import test
from cinder.tests.image import fake as fake_image
from cinder.tests.test_volume import DriverTestCase
f... | {
"content_hash": "4e7899aba36c9df662d74638522b8dbb",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 79,
"avg_line_length": 35.774566473988436,
"alnum_prop": 0.5737598965907255,
"repo_name": "NewpTone/stacklab-cinder",
"id": "4ce9cfa973766322d3a9b1dbcc03f240974ec2e1",
"si... |
'''
Welcome to another python 3 basics video, in this video we will carryon with
functions. In the last video you were shown a very basic function, without
any parameters
In this video, lets include a parameter, and give this function more...
functionality.
'''
# changed name to simple math, to better describe our ... | {
"content_hash": "4970dbb8bf283a483235a3a832cab9cd",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 23.82894736842105,
"alnum_prop": 0.7261181667586969,
"repo_name": "PythonProgramming/Python-3-basics-series",
"id": "abf5d5fd72825544c01c38c82ae3d4ba81... |
from textwrap import dedent, wrap
try:
import ConfigParser as configparser
except ImportError:
import configparser
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
import markdown
class Email(object):
"""Created and send emails."""
def title(self, titl... | {
"content_hash": "431c93960a5b756a4bdac0b3b6153cd6",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 79,
"avg_line_length": 28.32,
"alnum_prop": 0.5840395480225988,
"repo_name": "jidn/lds-temple-recommend-notice",
"id": "4dd85a09a34b6e8199caad14d66f46d715828e67",
"size": ... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'securestdb.db', # Or path... | {
"content_hash": "2753244ec89984c8eb0c8aaaadd23f46",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 925,
"avg_line_length": 39.9496855345912,
"alnum_prop": 0.7169395465994962,
"repo_name": "dash1291/rest-security",
"id": "6418011de45224399d0b535e44d29db2706eb640",
"size"... |
"""Utilities to read values from a bytearray."""
import struct
def _ParseULeb128(data, offset):
"""Returns a tuple of (uleb128 value, number of bytes occupied).
From DWARF3 spec: http://dwarfstd.org/doc/Dwarf3.pdf
Args:
data: bytearray containing unsigned LEB128.
offset: Location of the unsigned LEB1... | {
"content_hash": "8f8f968c36f667daf4e4cf631316bd85",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 132,
"avg_line_length": 27.32450331125828,
"alnum_prop": 0.614396509936985,
"repo_name": "chromium/chromium",
"id": "ce7f7faa4b571228cb5ddd38e6f2eba09609b631",
"size": "42... |
"""Test the numpy pickler as a replacement of the standard pickler."""
import copy
import os
import random
import re
import io
import sys
import warnings
import gzip
import zlib
import bz2
import pickle
import socket
from contextlib import closing
import mmap
from pathlib import Path
try:
import lzma
except Impor... | {
"content_hash": "36c7a9688d3b42c58091510d5eac7fa4",
"timestamp": "",
"source": "github",
"line_count": 1158,
"max_line_length": 79,
"avg_line_length": 36.57772020725388,
"alnum_prop": 0.6261302736265553,
"repo_name": "joblib/joblib",
"id": "c9d1d5bdb33ac1b17109ae7902c682be79fc160d",
"size": "42357... |
"""
Tools for working with objects
This module re-implements several STL threading objects in a lightweight
fashion, portable across python versions.
"""
from threading import Lock, ThreadError
from collections import deque
import time
import ast
import operator
try:
from thread import error as thread_error
except... | {
"content_hash": "33ecd649e4004fe72e67d1429ff9234c",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 120,
"avg_line_length": 30.2987012987013,
"alnum_prop": 0.5172881840262895,
"repo_name": "maxfischer2781/cpy2py",
"id": "7c6f073f1033f66ac27a9575ff12bb24f3584598",
"size":... |
"""
Helper methods to deal with images.
This is essentially a copy from nova.virt.images.py
Some slight modifications, but at some point
we should look at maybe pushing this up to Oslo
"""
import contextlib
import os
import tempfile
from oslo.config import cfg
from cinder import exception
from cinder.i18n import _... | {
"content_hash": "6dbf62201e7cbe4eccd872a4c3b4a3d7",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 79,
"avg_line_length": 38.5024154589372,
"alnum_prop": 0.5866373902132999,
"repo_name": "nash-x/hws",
"id": "361e36fc1a02bef50a57a2da4daaca92dd946181",
"size": "16714",
... |
from __future__ import annotations
import os
import sys
from pathlib import Path
import click
from airflow_breeze.params.build_ci_params import BuildCiParams
from airflow_breeze.params.shell_params import ShellParams
from airflow_breeze.utils.ci_group import ci_group
from airflow_breeze.utils.click_utils import Bree... | {
"content_hash": "72dcf3776c71bb38db0673fba6bbe308",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 110,
"avg_line_length": 36.61178509532063,
"alnum_prop": 0.6256568047337278,
"repo_name": "cfei18/incubator-airflow",
"id": "6cba47a6ef950742af35d09ce5dd84e5053c51c7",
"si... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
from collections import defaultdict
from . import Command
from ..benchmarks import Benchmarks
from ..machine import iter_machine_files
from ..results import iter_results_for_machine, iter_results_for... | {
"content_hash": "10f3241390af367031bedef2b1195e7d",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 105,
"avg_line_length": 36.01880877742947,
"alnum_prop": 0.5380330722367276,
"repo_name": "qwhelan/asv",
"id": "4007e3f39cb917dc2fb1bf9741b71e6d2bfd64df",
"size": "11579",... |
import schunk
import serial
import argparse
import sys
import os
def arg_options():
''' init options '''
parser = argparse.ArgumentParser(
description='''
A simple program which checks if all software
requirements are fulfilled. ''')
parser.add_argument(
'--config... | {
"content_hash": "226c48af9d904e6177694382b3d100e2",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 74,
"avg_line_length": 22.783132530120483,
"alnum_prop": 0.562665256478054,
"repo_name": "spatialaudio/panorama",
"id": "f1e2325cd18608e7c5dd34020ebe64fca33cbca2",
"size": ... |
"""
Utility methods for working with WSGI servers redux
"""
import sys
import netaddr
from oslo import i18n
import six
import webob.dec
import webob.exc
from neutron.common import exceptions
from neutron.i18n import _LE, _LI
from neutron.openstack.common import log as logging
from neutron.openstack.common import pol... | {
"content_hash": "d0c104beac254c7a644d2e9c81e11405",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 78,
"avg_line_length": 38.10588235294118,
"alnum_prop": 0.6167026860142019,
"repo_name": "leeseulstack/openstack",
"id": "ab5618ab856821a775093de3d27eacfd91729a40",
"size"... |
"""
https://leetcode.com/problems/maximum-difference-between-node-and-ancestor/
https://leetcode.com/submissions/detail/226688002/
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from common.list_to_... | {
"content_hash": "0de09775a6ec17634bdeb344b0f437b3",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 75,
"avg_line_length": 25.75,
"alnum_prop": 0.549663928304705,
"repo_name": "vivaxy/algorithms",
"id": "bfb3d9c5510e45906c9580089566df87d4eeea29",
"size": "1339",
"binary... |
import csv
import datetime
import random
import time as Time
f = open('data.csv', 'w').close()
while True:
csvfile = open('data.csv', 'a', newline='')
csvwriter = csv.writer(csvfile, dialect='excel')
for portNum in range(1,9):
date = datetime.datetime.now().date().isoformat()
time =... | {
"content_hash": "7bfa4d2c2bd574e86678dcfcc6f67da4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 57,
"avg_line_length": 28.36842105263158,
"alnum_prop": 0.6178107606679035,
"repo_name": "jlmart88/mobilechargingmetrics",
"id": "93481e6eb8ca35c4e34d351b894e0d06432b837f",
... |
from .color import Color
from .number import Number
from .length import Length
_converters = {
"fill": Color,
"fill-opacity": Number,
"stroke": Color,
"stroke-opacity": Number,
"opacity": Number,
"stroke-width": Length,
# "stroke-miterlimit": Nu... | {
"content_hash": "28c542d43f179d96b0f91f4ea96886de",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 27.03846153846154,
"alnum_prop": 0.49431009957325744,
"repo_name": "duyuan11/glumpy",
"id": "360e34dd1d9d7a6d39e9cf5e3a4d22c1718ee0fc",
"size": "1705... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLX import _types as _cs
# End users want this...
from OpenGL.raw.GLX._types import *
from OpenGL.raw.GLX import _errors
from OpenGL.constant import Constant as _C
import ctype... | {
"content_hash": "95be881e36be4462439c5a16adee5e56",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 122,
"avg_line_length": 39.375,
"alnum_prop": 0.7571428571428571,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "b5a6b565abfc7162d8e7b247450c5b96082ddba8",
"size": "... |
import wasp as ws
class Nest(object):
def __init__(self):
self.colony = {}
def hatch(self, meta_data):
"""DESC: generate a new wasp"""
hatchling = ws.Wasp(meta_data)
self.assimilate(hatchling)
hatchling.get_peers()
def assimilate(self, hatchling):
# TODO:... | {
"content_hash": "c4aadbdb76bb82bdae9ffb587abfb2aa",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 66,
"avg_line_length": 28.103448275862068,
"alnum_prop": 0.6061349693251534,
"repo_name": "j-crowe/wasp",
"id": "638b6a58f1b9c7f1e37ef5ebea41d2680b85e13d",
"size": "815",
... |
"""
Testing clustering algorithms in Clusterpy
** All the following tests take considerable time to complete **
"""
from unittest import TestCase, skip
from nose.plugins.attrib import attr
import clusterpy
from numpy.random import seed as make_static_random
from clusterpy.core.toolboxes.cluster.componentsAlg import Ar... | {
"content_hash": "c51756d6c0f4264fc70415d88ab9981d",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 78,
"avg_line_length": 30.270042194092827,
"alnum_prop": 0.6034290493448564,
"repo_name": "clusterpy/clusterpy",
"id": "1b5ae7b3b167575db03dbf1ce987a5bdf0cb2e84",
"size": ... |
"""
SMC common functions
"""
import numpy as np
from scipy.linalg import cholesky
def _initial_population(draws, priors):
posterior = np.array([prior.rvs(draws) for prior in priors]).T
return posterior
def _metrop_kernel(
q_old,
old_tempered_logp,
proposal,
scaling,
accepted,
n_steps... | {
"content_hash": "e912e56aa5debfcac828faffa7d54377",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 86,
"avg_line_length": 26.57843137254902,
"alnum_prop": 0.5942456658059757,
"repo_name": "bomeba/bomeba0",
"id": "9cf57284f55a8bd7134b588faee2304bf5b81d10",
"size": "5422"... |
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import NoReverseMatch
class MockObject(object):
def __init__(self, **kwargs):
self._kwargs = kwargs
for key, val in kwargs.items():
setattr(self, key, val)
def __str__(self):
kwargs_str = '... | {
"content_hash": "6ef9317676c19cd623fb9960af58310a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 29.90566037735849,
"alnum_prop": 0.5886435331230284,
"repo_name": "werthen/django-rest-framework",
"id": "5b2d75864a1ddfa31495f38545b6d3a12ac7936f",
... |
from datetime import datetime, timedelta
from werkzeug import cached_property
from ua_parser import user_agent_parser
from flask import request
from coaster.utils import buid as make_buid
from coaster.sqlalchemy import make_timestamp_columns
from . import db, BaseMixin
from .user import User
from ..signals import sessi... | {
"content_hash": "be87e111d910b104fbf7a28f3192cdcf",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 111,
"avg_line_length": 38.55045871559633,
"alnum_prop": 0.6373155640171347,
"repo_name": "sindhus/lastuser",
"id": "023353046c9704ebc0b986a43e15276d25a6c7ad",
"size": "42... |
from robot.model import SuiteVisitor
class ModelModifier(SuiteVisitor):
def __init__(self, *tags, **extra):
if extra:
tags += tuple('%s-%s' % item for item in extra.items())
self.config = tags or ('visited',)
def start_suite(self, suite):
config = self.config
if c... | {
"content_hash": "4db1fc18bd5ec3701c24b2543aa477c8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 81,
"avg_line_length": 36.083333333333336,
"alnum_prop": 0.5254041570438799,
"repo_name": "HelioGuilherme66/robotframework",
"id": "23f8fb5f9c450c7a118d4e7ad9787769f351de55",... |
"""
Filesystem backup script
"""
import datetime
import logging
import optparse
import os
import socket
import sys
import stat
import yaml
from Branckenstein.storage import StorageManager
logger = logging.getLogger('Branckenstein')
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter(... | {
"content_hash": "69a6487019a562f203ab889eee4a64e6",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 80,
"avg_line_length": 32.74747474747475,
"alnum_prop": 0.5046267735965454,
"repo_name": "rshk/branckenstein",
"id": "2e450f1031039f8083e59a659b823138b87feaf1",
"size": "1... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, COIN
from io import BytesIO
def txFromHex(hexstring):
tx = CTransaction()
f = BytesIO(hex_str_to_bytes(hexstring))
tx.deserialize(f)
return tx
def check_ar... | {
"content_hash": "aea0a6fb11f52c659bef89620aca3eae",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 112,
"avg_line_length": 49.425233644859816,
"alnum_prop": 0.5733194667675144,
"repo_name": "jimmykiselak/lbrycrd",
"id": "0783a1f3d37179566e69eba81b43ee06374d7beb",
"size"... |
import colander
from deform import (
Form,
ValidationFailure,
widget,
)
@colander.deferred
def deferred_status(node, kw):
values = kw.get('daftar_status', [])
return widget.SelectWidget(values=values)
STATUS = (
(1, 'Active'),
(0, 'Inactive'),
)
@colande... | {
"content_hash": "788b869ac8fe2c435a08b088998fefc0",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 45,
"avg_line_length": 22.25531914893617,
"alnum_prop": 0.5927342256214149,
"repo_name": "aagusti/i-pbb",
"id": "642f119a9ed785d1915ff3eeee26a10a0f851712",
"size": "1046",
... |
'''
Created on 21 Sep 2015
@author: mawa
'''
import os
INPUT_DIR = '/home/mawa/Downloads/stats/hd'
OUTPUT_FILE = '/home/mawa/Downloads/stats_hd.csv'
TOTAL_STATS = {}
def get_files(path):
files = os.listdir(path)
files.sort()
return files
def add_stat(stat_name, stat_value, file_name):
if not TOT... | {
"content_hash": "1851a5efa98350f2f772cccbdda75637",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 84,
"avg_line_length": 24.491803278688526,
"alnum_prop": 0.5890227576974565,
"repo_name": "mwach/transcoderwebapi",
"id": "14210119f2c8f8ce6110579a42f59fdf7534e729",
"size"... |
from apps.data.users.models import User
from apps.data.songs.models import Song
from apps.data.userPlaySong.models import UserPlaySong
from apps.similarities.Cosine.benchmark.models import BenchCosine_SongTitle
from apps.recommenders.UserAverage.algorithm.models import UserAverage_Life
from django.db.models import Sum
... | {
"content_hash": "024a6f3a3963ecce256b7b4fbf97ffc0",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 164,
"avg_line_length": 41.813559322033896,
"alnum_prop": 0.652614511552493,
"repo_name": "DiegoCorrea/ouvidoMusical",
"id": "a73b93902aa83bba257d4f2b8faff77716e7b7b6",
"si... |
from circuits.web import JSONRPC as JSONRPCDispatcher
from ..plugin import BasePlugin
class JSONRPC(BasePlugin):
"""JSONRPC Plugin
This plugin provides no user commands. This plugin gives
JSON-RPC support to the system allowing other systems to
interact with the system and other loaded plugins.
... | {
"content_hash": "8065f0e2bf90676d28600a35b85defa4",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 27.77777777777778,
"alnum_prop": 0.6893333333333334,
"repo_name": "prologic/kdb",
"id": "d5eba03a4376b7158c8b313a01c67f4706e82a25",
"size": "750",
... |
import os
import six
__all__ = [
'prefix_dict_keys',
'compare_path_file_name'
]
def prefix_dict_keys(dictionary, prefix='_'):
"""
Prefix dictionary keys with a provided prefix.
:param dictionary: Dictionary whose keys to prefix.
:type dictionary: ``dict``
:param prefix: Key prefix.
... | {
"content_hash": "50a93b3cd0eb1767d9d1c08eee890b17",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 78,
"avg_line_length": 20.64406779661017,
"alnum_prop": 0.6141215106732348,
"repo_name": "Itxaka/st2",
"id": "7be5013a92bb59673ac11594d8d82dd906009bf5",
"size": "1998",
"... |
"""
Ironic host manager.
This host manager will consume all cpu's, disk space, and
ram from a host / node as it is supporting Baremetal hosts, which can not be
subdivided into multiple instances.
"""
from oslo.config import cfg
from nova.openstack.common import log as logging
from nova.openstack.common import timeuti... | {
"content_hash": "f2ff143d00af3031caf4f577ec5b1a7f",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 76,
"avg_line_length": 36.298701298701296,
"alnum_prop": 0.6415026833631485,
"repo_name": "srajag/nova",
"id": "409c6dd1cc1b8ed1dc7b7f2478202cab9f44e844",
"size": "3478",
... |
from .javacls import JavaClass
class Serializable:
pass
| {
"content_hash": "660166ead2093d946313d60dcdf683ce",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 30,
"avg_line_length": 15.25,
"alnum_prop": 0.7704918032786885,
"repo_name": "lodevil/javaobject",
"id": "4cc2fd88944abe1348469e60b12b3541234c310d",
"size": "61",
"binary"... |
"""Illustrates a method to intercept changes on objects, turning
an UPDATE statement on a single row into an INSERT statement, so that a new
row is inserted with the new data, keeping the old row intact.
"""
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import event
from sqlalchemy... | {
"content_hash": "e68be7dca1f45eef5a67b71407a5af55",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 78,
"avg_line_length": 24.369747899159663,
"alnum_prop": 0.6844827586206896,
"repo_name": "zzzeek/sqlalchemy",
"id": "96d2e399ec14c8c01a8c0eaf6c0f045006803fce",
"size": "2... |
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch
)
from salttesting.helpers im... | {
"content_hash": "d7a3e46fae83a365a04e1ed30d263bc4",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 34.33582089552239,
"alnum_prop": 0.5205390132579873,
"repo_name": "stephane-martin/salt-debian-packaging",
"id": "56ef9714f042ff1e6562cd2bbb90daca4d84... |
import sqlalchemy as sql
def upgrade(migrate_engine):
# The group_project_metadata table was not updated in terms of its
# FK to the tenant table when the tenant->project change was made at
# the 015 migration for sqlite. This upgrade fixes that.
# We need to create a fake tenant table so that we can... | {
"content_hash": "9bedb0b34eb08571e6d1a1b81a276cea",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 77,
"avg_line_length": 34.39655172413793,
"alnum_prop": 0.6163742690058479,
"repo_name": "UTSA-ICS/keystone-SID",
"id": "61fce39eb360cb59e66d57f80073eb85cb848bad",
"size":... |
from .dataset import Dataset
class SparkObjectDataset(Dataset):
"""Spark Server dataset.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param description: Dataset description.
:type descript... | {
"content_hash": "48fde4a9431def56735f25d69062e194",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 228,
"avg_line_length": 43.34285714285714,
"alnum_prop": 0.7277521423862887,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "0f998f03375c1aba07ec97cf79362c152d5eb425",
... |
"""
This bot resets a (user) sandbox with predefined text.
This script understands the following command-line arguments:
¶ms;
Furthermore, the following command line parameters are supported:
-hours:# Use this parameter if to make the script repeat itself
after # hours. Hours can be... | {
"content_hash": "0850db91ef297f8cd47691c396d62e18",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 93,
"avg_line_length": 42.284246575342465,
"alnum_prop": 0.537053535271726,
"repo_name": "hperala/kontuwikibot",
"id": "40229713376f093a927da091258287d23317bc96",
"size": ... |
from django.db import models
class Building(models.Model):
code = models.CharField(max_length=6, db_index=True)
latititude = models.CharField(max_length=40)
longitude = models.CharField(max_length=40)
name = models.CharField(max_length=200)
class Meta:
db_table = "myuw_mobile_building"
... | {
"content_hash": "710b2cd810b3798915dee21057fe213b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 28.75,
"alnum_prop": 0.6840579710144927,
"repo_name": "fanglinfang/myuw",
"id": "9fbdb90f0e298918469f4c13913f375f4b93cdbc",
"size": "345",
"binary"... |
import argparse
import copy
from textwrap import dedent
from polygraphy import constants, mod
from polygraphy.exception import PolygraphyException
from polygraphy.logger import G_LOGGER
from polygraphy.tools.args import (
ComparatorCompareArgs,
ComparatorPostprocessArgs,
ComparatorRunArgs,
CompareFuncI... | {
"content_hash": "c224ccc6dafd564e87cac3e6ffe621a3",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 128,
"avg_line_length": 34.38942307692308,
"alnum_prop": 0.6075772403187474,
"repo_name": "NVIDIA/TensorRT",
"id": "131f482b22ccb84db23a82805e8e0a78db8b63fd",
"size": "784... |
"""Allow bots to build and deploy themselves. So like Rapid in ~300 lines."""
# In general, we want to catch all exceptions, so ignore lint errors for e.g.
# catching Exception
# pylint: disable=broad-except
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
f... | {
"content_hash": "c38d2f706500c85a30b2632294a2fa4e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 80,
"avg_line_length": 34.9875,
"alnum_prop": 0.6152197213290461,
"repo_name": "google/hypebot",
"id": "9beb4fc3f766e54e7437e62d9b6b479e85387fc8",
"size": "3418",
"binary... |
import sys
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if sys.version_info >= (3, 8):
from typing i... | {
"content_hash": "0663c17024a6d73d60e3d7b02f5ff006",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 108,
"avg_line_length": 52.375,
"alnum_prop": 0.722255369928401,
"repo_name": "Azure/azure-sdk-for-python",
"id": "9cd67a515ff753dca320d22e85cc40633dcffb8c",
"size": "3820"... |
from time import strftime, localtime
from cme.protocols.smb.remotefile import RemoteFile
from impacket.smb3structs import FILE_READ_DATA
from impacket.smbconnection import SessionError
import logging
import re
import traceback
class SMBSpider:
def __init__(self, smbconnection, logger):
self.smbconnection ... | {
"content_hash": "1fd3117eab392d7d5100acf3b8eb9537",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 183,
"avg_line_length": 50.47938144329897,
"alnum_prop": 0.41019095272133155,
"repo_name": "jorik041/CrackMapExec",
"id": "b69866debfbad30a095cb5054817271f516f9b48",
"size... |
from msrest.serialization import Model
class ImageDataDisk(Model):
"""Describes a data disk.
All required parameters must be populated in order to send to Azure.
:param lun: Required. Specifies the logical unit number of the data disk.
This value is used to identify data disks within the VM and the... | {
"content_hash": "ba6447ef034df251ed2f0021a9840f72",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 42.90384615384615,
"alnum_prop": 0.6364858807709547,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "d696f2804c4bde7e5db1221e3c419f5af6464b7a",
"... |
try:
from ._models_py3 import Answer
from ._models_py3 import CreativeWork
from ._models_py3 import Error
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import Identifiable
from ._models_py3 import ImageObject
from ._models_py3 import MediaObject
from ._... | {
"content_hash": "f7ea22229ba92605576147110ca2e95b",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 66,
"avg_line_length": 29.78494623655914,
"alnum_prop": 0.7043321299638989,
"repo_name": "Azure/azure-sdk-for-python",
"id": "482fbb3e796c27cb43ec286a8e486dc7a6f5067e",
"si... |
import asyncio
from enum import Enum
import os
import traceback
from prompt_toolkit.token import Token
from prompt_toolkit.mouse_events import MouseEventType
class TaskManager:
def __init__(self, tosh):
self.tosh = tosh
self._tasks = []
def get_tokens(self, _):
if not self._tasks:
... | {
"content_hash": "0593db408a97f4e41a5106f46d3521a7",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 106,
"avg_line_length": 34,
"alnum_prop": 0.5645905420991926,
"repo_name": "javitonino/tosh",
"id": "d929fc62fe145878df6b49c093915d57c3a54f9d",
"size": "5212",
"binary":... |
"""Populate compound fields"""
# pylint: disable=missing-function-docstring
import logging
import os
import time
from datetime import datetime
from typing import Any, Generator, List, Optional
from urllib.parse import quote
import pandas as pd
import pubchempy as pcp
import requests
from rdkit import Chem
from rdkit.... | {
"content_hash": "2dd4e13cb1bb9f8fa94fff1c1c66c5b6",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 106,
"avg_line_length": 39.237037037037034,
"alnum_prop": 0.645365301113838,
"repo_name": "biorack/metatlas",
"id": "aac42d1b2e9b344acd7e61f12c6392964fbc7499",
"size": "10... |
from base_memory import *
import os, sys
import random
class TestMemoryAllocDoesNotReturnNull():
def setup(self):
pass
def teardown(self):
pass
def test(self):
l = ri_mem_alloc(128)
assert l != None
class TestMemoryFreeReturnsZero():
def setup(self):
self... | {
"content_hash": "c3c77e0faf3d05d2d162fde90cc2d01f",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 81,
"avg_line_length": 16.986842105263158,
"alnum_prop": 0.5189775367931836,
"repo_name": "chiyama/lucille",
"id": "f82427ff208ff33c167badf24086ef02bfd2c579",
"size": "1291... |
import unittest
from .. import Stopwords
class TestStopwords(unittest.TestCase):
def test_default(self):
test = Stopwords()
compare = Stopwords('arakhne/stopwords/defaults/english.txt')
return self.assertEqual(test, compare)
| {
"content_hash": "0b1a171b65858095b8fc2c4d80c0602c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 69,
"avg_line_length": 23.363636363636363,
"alnum_prop": 0.7003891050583657,
"repo_name": "thePortus/arakhne",
"id": "22abaabb09d1d413c391c0f535519b5f3de2d32f",
"size": "25... |
class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
if not s:
return True
stack = []
for i in xrange(len(s)):
# if its opening it, its getting deeper so add to stack
if s[i] in "([{":
... | {
"content_hash": "b1b882326ee2acab55033b51ba858df9",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 34.76,
"alnum_prop": 0.4430379746835443,
"repo_name": "young-geng/leet_code",
"id": "f776efe76b9587466ad0e9e382f6761f256d1fd7",
"size": "920",
"bin... |
"""
This module implements the main Evennia server process, the core of
the game engine.
This module should be started with the 'twistd' executable since it
sets up all the networking features. (this is done automatically
by evennia/server/server_runner.py).
"""
from __future__ import print_function
from builtins im... | {
"content_hash": "67d8047c3844291f1502605bf85d35fe",
"timestamp": "",
"source": "github",
"line_count": 559,
"max_line_length": 131,
"avg_line_length": 39.991055456171736,
"alnum_prop": 0.6279132185193469,
"repo_name": "titeuf87/evennia",
"id": "028447daa9abe23d33443138a7689d29e110ad03",
"size": "2... |
"""RFC 3548: Base16, Base32, Base64 Data Encodings"""
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
#import re
import struct
import binascii
__all__ = [
# Legacy interface exports traditional RFC 1521 Base64 encodings
'encode... | {
"content_hash": "108b966c92b690a9720f8bdf651cb6c9",
"timestamp": "",
"source": "github",
"line_count": 379,
"max_line_length": 78,
"avg_line_length": 31.337730870712402,
"alnum_prop": 0.5932474530605372,
"repo_name": "gpitel/pyjs",
"id": "07e12bc05a3505b410867a0a9994ac65387fe79c",
"size": "12134",... |
from dbobj.dbobj import dbRecord
from dbobj.dbobj import dbTable
class lng_lex_lex(dbRecord):
def __init__(self, app, **args):
if args.has_key("fields"):
dbRecord.__init__(self, app, "lng_lex_lex", args["fields"])
else:
dbRecord.__init__(self, app, "lng_lex_lex", args)
class lng_lex_lexemes(... | {
"content_hash": "74e8c9c0cb611c4f96cddb0979c46564",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 65,
"avg_line_length": 24.047619047619047,
"alnum_prop": 0.6158415841584158,
"repo_name": "boudewijnrempt/kura",
"id": "a32dd62c4e78a1fdb93e3513a1a3e1c43abd5069",
"size": "... |
from python_qt_binding.QtCore import *
from python_qt_binding.QtGui import *
from diarc.util import *
import sys
import logging
log = logging.getLogger('qt_view.SpacerContainter')
class SpacerContainer(QGraphicsWidget):
""" A SpacerContainer is a specialized widget for creating artifical
spacing between other... | {
"content_hash": "b614692b046f7dd2664593b48945cbf4",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 97,
"avg_line_length": 43.1858407079646,
"alnum_prop": 0.6111680327868853,
"repo_name": "mrdanbrooks/diarc",
"id": "041f49d2532db358e5fa0694d7bb2b22599d3bb3",
"size": "103... |
from __future__ import absolute_import
import unittest
from calc import views
class CalcTestBase(unittest.TestCase):
def setUp(self):
self.app = views.app.test_client()
| {
"content_hash": "0481802341aa81632ce76ee5bfa8f159",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 42,
"avg_line_length": 18.5,
"alnum_prop": 0.7189189189189189,
"repo_name": "saadbinakhlaq/prove-it",
"id": "9d2627035005270f4071f49470ea42b064649625",
"size": "185",
"bi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.