text stringlengths 4 1.02M | meta dict |
|---|---|
from stomp_message_controller import StompMessageController
from stomp_message import StompMessage
class TomcatVirtualHostServiceController(StompMessageController):
stomp_tasks = ["CreateTomcatVirtualHost", "RemoveTomcatVirtualHost", "EnableTomcatVirtualHost", "DisableTomcatVirtualHost"]
def run(self):
print("... | {
"content_hash": "a58f823c9f3f11e2486b872d6cee0492",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 124,
"avg_line_length": 36.945205479452056,
"alnum_prop": 0.8068223952539859,
"repo_name": "MarkAufdencamp/stomp-client-daemon",
"id": "77ce87a22d5befc2caeff1d0db4a7d429b422c... |
"""aide associée à ce module, exemple d'utiliation de pydoc"""
import os.path
import os
def pydoc_present () :
"""teste la présence du fichier pydoc.py"""
p = "c:\\python26\\lib\\pydoc.py"""
return os.path.exists (p)
def pydoc_generation (file) :
"""génère la documentation associée au fichier file... | {
"content_hash": "1334c1c4a043db1d741c6da8de6b61ab",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 32.87096774193548,
"alnum_prop": 0.5947006869479883,
"repo_name": "sdpython/teachpyx",
"id": "dafbbf235c30894739847ca5e0504c244dabf228",
"size": "103... |
import json
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(is_safe=True)
def jsonify(obj, indent=0):
return mark_safe(json.dumps(obj, indent=indent))
| {
"content_hash": "c1fe2687e06b2cc1dbe609cf99b20f8f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 52,
"avg_line_length": 21.09090909090909,
"alnum_prop": 0.7672413793103449,
"repo_name": "bulv1ne/django-utils",
"id": "57a798db617631067d2ae447d71f07fff528086c",
"size": "... |
import logging
from neutronclient.neutron import v2_0 as neutronV20
def _format_provider(pool):
return pool.get('provider') or 'N/A'
class ListPool(neutronV20.ListCommand):
"""List pools that belong to a given tenant."""
resource = 'pool'
log = logging.getLogger(__name__ + '.ListPool')
list_co... | {
"content_hash": "8c544c5bd63a7dd9ccd8fc3fdc4182f2",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 79,
"avg_line_length": 31.700854700854702,
"alnum_prop": 0.5710434079266649,
"repo_name": "ntt-sic/python-neutronclient",
"id": "1c62dcebf85a43f89974e666cf5ebbb819209053",
... |
from __future__ import division, unicode_literals, print_function
from django.core.management import BaseCommand
from bs4 import BeautifulSoup
from applications.dianping.models import Shop
import requests
import json
base_url = "http://www.dianping.com/ajax/json/shop/wizard/BasicHideInfoAjaxFP?"
headers = {
"refe... | {
"content_hash": "16010634c5ca66891a240f72bf04bb0b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 141,
"avg_line_length": 32.41025641025641,
"alnum_prop": 0.617879746835443,
"repo_name": "chenchiyuan/gym",
"id": "e98df3e25551c995e25781115feeb22508d28f37",
"size": "1316"... |
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class APIError(Model):
"""Error information returned by the API.
:param code: The error code.
:type code: object
:param message: A message explaining the error reported by the service.
:type message: str
"... | {
"content_hash": "52072aa7c0d13d9ddb055a15282af90b",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 217,
"avg_line_length": 43.884507042253524,
"alnum_prop": 0.6648051864689646,
"repo_name": "Azure/azure-sdk-for-python",
"id": "4d86c5b14eee26f41dedff5e9af29459cd02a50f",
... |
"""Tests of grpc_status with gRPC AsyncIO stack."""
import logging
import traceback
import unittest
import grpc
from google.protobuf import any_pb2
from google.rpc import code_pb2, error_details_pb2, status_pb2
from grpc.experimental import aio
from grpc_status import rpc_status
from tests_aio.unit._test_base import... | {
"content_hash": "b81c639ae7ace7ca48e4f38a1e00caa6",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 79,
"avg_line_length": 36.19135802469136,
"alnum_prop": 0.6735459662288931,
"repo_name": "firebase/grpc",
"id": "980cf5a67e7cf69a6ba8e826d929860c3fe86786",
"size": "6443",... |
"""
WSGI Application
This application listens for a form. When a form is submitted, this application
takes the information submitted, formats it into a python dictionary, then
emails it to a specified email
"""
import os
import smtplib
import werkzeug
import urllib
import hashlib
from urllib import urlencode
from url... | {
"content_hash": "11509dd99c81088d88100813c9ec7960",
"timestamp": "",
"source": "github",
"line_count": 554,
"max_line_length": 118,
"avg_line_length": 36.46750902527076,
"alnum_prop": 0.6110973617779538,
"repo_name": "osuosl/formsender",
"id": "daf71217595f26a42af12403221b95a877ade281",
"size": "2... |
import os
import sys
import re
def read_config(hosts_file):
host=[]
host_file=open(hosts_file)
# 判断第一行是否有主机组
for line in host_file:
if re.search("^#",line) or re.search("^ *$",line):
continue
host_info=line.strip().split("===")
if len(host_info) < 4:
print... | {
"content_hash": "43b2156e05251427136ae78861dfe6ea",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 74,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.5627177700348432,
"repo_name": "BillWang139967/zabbix_manager",
"id": "b8b532e0171eef00c24b7e89caac14d7621e18c1",
... |
"""
sentry.web.frontend.projects.keys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.contrib import messages
from django.core.context_processors import csrf
from django.core.urlresolvers import revers... | {
"content_hash": "ae4fa374ca26a45f3848ac1ca9d33c1e",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 114,
"avg_line_length": 34.583333333333336,
"alnum_prop": 0.7087779690189329,
"repo_name": "rdio/sentry",
"id": "cb4e9b83afd554f16866f00a6f419a47033b8163",
"size": "2905",
... |
from djangopress.menus.menu import register
from django.template import Template, RequestContext
from .models import GallerySection
class GalleryRender(object):
_menu = Template("""
<ul{% if menu.class_tag%} class="{{ menu.class_tag }}"{% endif %}{% if menu.name %} id="{{ menu.name }}"{% endif %}>
... | {
"content_hash": "508d4b306cae3fb78b2977190d1b9063",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 135,
"avg_line_length": 44.63157894736842,
"alnum_prop": 0.5294811320754716,
"repo_name": "codefisher/djangopress",
"id": "2753d06bb3b1340358ab30c193d494ec94eaca00",
"size"... |
"""Classes and functions used to construct graphs."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import linecache
import re
import sys
import threading
import numpy as np
import six
from six.m... | {
"content_hash": "472154c86ea29794553ad2e3ace6ccee",
"timestamp": "",
"source": "github",
"line_count": 5380,
"max_line_length": 115,
"avg_line_length": 35.48048327137546,
"alnum_prop": 0.655824187337926,
"repo_name": "guschmue/tensorflow",
"id": "dc4ffb174782d6148594e4ca8f1078640ef7905e",
"size": ... |
from pyarrow.compat import unittest
import pyarrow as arrow
A = arrow
class TestTypes(unittest.TestCase):
def test_integers(self):
dtypes = ['int8', 'int16', 'int32', 'int64',
'uint8', 'uint16', 'uint32', 'uint64']
for name in dtypes:
factory = getattr(arrow, name)... | {
"content_hash": "a94a51069dfb1618b43293006f25c1e2",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 56,
"avg_line_length": 24.82857142857143,
"alnum_prop": 0.5097813578826237,
"repo_name": "TheNeuralBit/arrow",
"id": "507ebb878d87b866dbfda66e8e6c9d79b3824116",
"size": "25... |
"""
This example demonstrates the use of pyqtgraph's parametertree system. This provides
a simple way to generate user interfaces that control sets of parameters. The example
demonstrates a variety of different parameter types (int, float, list, etc.)
as well as some customized parameter types
"""
import initExample... | {
"content_hash": "bb4e4a7f960d4551e964c618858458e9",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 128,
"avg_line_length": 40.18390804597701,
"alnum_prop": 0.6045480549199085,
"repo_name": "vallsv/pyqtgraph",
"id": "6e8e0dbdd8b846eded9a650916f27db61ec90a6a",
"size": "70... |
import os
import re
import random
import hashlib
# import binascii
import datetime
import uuid
from rdoclient import RandomOrgClient
import config
# get time in format I like
def get_timestamp():
"""
Function to generate timestamp for use in application
:return timestamp:
"""
dt = datetime.dat... | {
"content_hash": "72928fee86fcc8bca24b94b4bc782df0",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 82,
"avg_line_length": 21.621951219512194,
"alnum_prop": 0.6576424139875916,
"repo_name": "nicorellius/password-generator",
"id": "d9daf586c6304400696ddae638a54dc3cca1ab8b",
... |
from django.contrib.postgres.fields import JSONField
from django.utils.translation import ugettext as _
from wagtail.core.models import Page
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel
class BaseModel(Page):
# core fields
section_title = RichTextField(blan... | {
"content_hash": "4d343c4668c8f8f3e8aa22bbd491a6e1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 86,
"avg_line_length": 28.92,
"alnum_prop": 0.7164591977869986,
"repo_name": "evonove/evonove.it",
"id": "9387591ab2f22b15455a7544317b38124fb7b379",
"size": "723",
"binar... |
from __future__ import annotations
import os
import typing as T
import xml.etree.ElementTree as ET
from .vs2010backend import Vs2010Backend
from ..mesonlib import MesonException
if T.TYPE_CHECKING:
from ..build import Build
from ..interpreter import Interpreter
class Vs2017Backend(Vs2010Backend):
def _... | {
"content_hash": "4cf8fe93479276f701113a933823704c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 113,
"avg_line_length": 44.68518518518518,
"alnum_prop": 0.597596353087443,
"repo_name": "pexip/meson",
"id": "4ed5e483c4b82b26572d9a7e21179fc2e6fcfd38",
"size": "3005",
... |
import os
from common import BASE_DIR
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.templa... | {
"content_hash": "8c14a4e328d9031c830fd0551128eee7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 29.045454545454547,
"alnum_prop": 0.543035993740219,
"repo_name": "pomahtuk/py-cooking",
"id": "2a817af3c871ad6ad4cc29bea705d445bea9e179",
"size": "6... |
"""Analytic approximation for European option prices using SABR model."""
import enum
import tensorflow.compat.v2 as tf
@enum.unique
class SabrApproximationType(enum.Enum):
"""Approximation to the SABR model.
* `HAGAN`: Using the Hagan approximation [1].
#### References
[1] Hagan et al, Managing Smile Ris... | {
"content_hash": "5e2a83dfb0a08e4cef0e547ae4e26f5c",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 80,
"avg_line_length": 36.87665198237885,
"alnum_prop": 0.6312268546171306,
"repo_name": "google/tf-quant-finance",
"id": "d7eeca917d49fed322d4126c6945c522e5d1f6da",
"size... |
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import range, object
import json
import logging
import os
import subprocess
import sys
import time
import uuid
import proxy.conf
import tempfile
from configobj import ConfigObj
from django.db.mo... | {
"content_hash": "200ffb24ceacb19ecff3c689c9cbcdb0",
"timestamp": "",
"source": "github",
"line_count": 1569,
"max_line_length": 137,
"avg_line_length": 36.55066921606119,
"alnum_prop": 0.6699100230173677,
"repo_name": "kawamon/hue",
"id": "4ff80a2050f910db3b8b058693d14c0590eed468",
"size": "58174"... |
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 configura... | {
"content_hash": "4d611b0672aefb49e0540766ea343056",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 80,
"avg_line_length": 32.10480349344978,
"alnum_prop": 0.7007616974972797,
"repo_name": "smidm/camera.py",
"id": "34874b05303800935daa32708e9f9528119161c2",
"size": "7772... |
import copy
import os
import sys
import time
import unittest
rootDirectory = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if rootDirectory not in sys.path:
sys.path.insert(0, rootDirectory)
from oxford.vision import Vision
class TestFace(unittest.TestCase):
'''Tests the Project Oxford Vision ... | {
"content_hash": "dc5f0fd3e81a3b359c2b75c2c73ae8ac",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 103,
"avg_line_length": 35.68217054263566,
"alnum_prop": 0.6269824027807951,
"repo_name": "chidochipotle/oxford",
"id": "ae57d96cbeb818dbb55697d793d94cfcd01cb783",
"size":... |
from __future__ import absolute_import
from django.conf import settings
from zerver.models import get_client, UserProfile
from zerver.lib.response import json_success
from zerver.lib.validator import check_dict
from zerver.decorator import authenticated_api_view, REQ, has_request_variables, to_non_negative_int, flexibl... | {
"content_hash": "170efb52dc729f5787c0be447986dd96",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 152,
"avg_line_length": 43.34304207119741,
"alnum_prop": 0.5922496826700515,
"repo_name": "vaidap/zulip",
"id": "c8323a25cb2fbb5d4c7ac37b91b6310e4e22c57e",
"size": "13393"... |
from distutils.core import setup
import googstyle
setup(
name='googstyle',
version=googstyle.__version__,
description="CSS and images extracted from Closure Library",
url="https://github.com/ludios/Googstyle",
author="Ivan Kozik",
author_email="ivan@ludios.org",
classifiers=[
'Development Status :: 4 - Beta'... | {
"content_hash": "ee86b934ca48f67867c13fe7dfd2268f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 61,
"avg_line_length": 27.095238095238095,
"alnum_prop": 0.6994727592267135,
"repo_name": "ludios/Googstyle",
"id": "d4f2932177ca08758b5c76ad12da64e78233f64e",
"size": "592... |
import constants
from euctwfreq import EUCTWCharToFreqOrder, EUCTW_TABLE_SIZE, EUCTW_TYPICAL_DISTRIBUTION_RATIO
from euckrfreq import EUCKRCharToFreqOrder, EUCKR_TABLE_SIZE, EUCKR_TYPICAL_DISTRIBUTION_RATIO
from gb2312freq import GB2312CharToFreqOrder, GB2312_TABLE_SIZE, GB2312_TYPICAL_DISTRIBUTION_RATIO
from big5freq ... | {
"content_hash": "8f7fafffba622b8503d880c79b72226b",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 238,
"avg_line_length": 42.80346820809248,
"alnum_prop": 0.6272788656313302,
"repo_name": "JeyZeta/Dangerous",
"id": "1f95fc84828eceb0f38fb1464f359922781f0e28",
"size": "8... |
""" Creating correlation
"""
from world import world, setup_module, teardown_module
import create_source_steps as source_create
import create_dataset_steps as dataset_create
import create_correlation_steps as correlation_create
class TestCorrelation(object):
def setup(self):
"""
Debug informa... | {
"content_hash": "74e5ceaf9c381fc9855083f2b3881d29",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 95,
"avg_line_length": 45.60377358490566,
"alnum_prop": 0.5829540752999586,
"repo_name": "xaowoodenfish/python-1",
"id": "886b0d61db78db7ce34d784f55dab970e36bd75a",
"size":... |
"""OpenTherm Gateway config flow."""
import asyncio
import pyotgw
from pyotgw import vars as gw_vars
from serial import SerialException
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_DEVICE,
CONF_ID,
CONF_NAME,
PRECISION_HALVES,
PRECISION_T... | {
"content_hash": "9b97af572fe1a3e1db0b8009fc4ff7f9",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 86,
"avg_line_length": 33.99363057324841,
"alnum_prop": 0.5366310661420274,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "7c3bc8f8f6b538b33b6e4e2d1dafcad35d7a9d30"... |
""" Tests for the utils module """
from __future__ import unicode_literals
from soco.utils import deprecated
# Deprecation decorator
def test_deprecation(recwarn):
@deprecated('0.7')
def dummy(args):
"""My docs"""
pass
@deprecated('0.8', 'better_function', '0.12')
def dummy2(args):
... | {
"content_hash": "ffef88cecb712ee8224b4d7e0e175d3a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 27.243243243243242,
"alnum_prop": 0.5357142857142857,
"repo_name": "intfrr/SoCo",
"id": "51e7eb5d97a190ecfe59bb857aadb362c57ffbc2",
"size": "1032",
... |
"""Meta-estimators for building composite models with transformers
In addition to its current contents, this module will eventually be home to
refurbished versions of Pipeline and FeatureUnion.
"""
from ._column_transformer import ColumnTransformer, make_column_transformer
from ._target import TransformedTargetRegre... | {
"content_hash": "b545cb44b3eaf8d7a485e1d5bfe3529d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 75,
"avg_line_length": 26.9375,
"alnum_prop": 0.7795823665893271,
"repo_name": "chrsrds/scikit-learn",
"id": "1cfd53c50d6829c0e7cb6aa993f71d4b9f124895",
"size": "431",
"b... |
class Function(object):
def sample(self, n):
raise NotImplementedError
def __call__(self, S):
raise NotImplementedError
@property
def parameters(self):
raise NotImplementedError
def gradient(self, S):
"""Gradients of the log-likelihood wrt the parameters."""
... | {
"content_hash": "993895ffe1dc1e1d0624f5ee6b26f69d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 23.22222222222222,
"alnum_prop": 0.65311004784689,
"repo_name": "net-titech/VidSum",
"id": "a901fb23888819084a2ac51ee8130e6cbff44b0d",
"size": "418",... |
import string
import glob
import time
import xml.etree.ElementTree as ET
from itertools import chain
# Import reader
import xlrd
import csv
import requests
# Import data handlers
import collections
# Import Network Analysis Tools
import networkx as nx
import igraph as ig
# Import language processing tools
from gens... | {
"content_hash": "55f2c56cafa2a2de837907ae30c9a4d7",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 126,
"avg_line_length": 37.53061224489796,
"alnum_prop": 0.573533046616244,
"repo_name": "chreman/isis-praktikum",
"id": "404ae076e3689f94424fe3f491b66a2183f50fe6",
"size"... |
"""
Title: Image classification via fine-tuning with EfficientNet
Author: [Yixing Fu](https://github.com/yixingfu)
Date created: 2020/06/30
Last modified: 2020/07/16
Description: Use EfficientNet with weights pre-trained on imagenet for Stanford Dogs classification.
"""
"""
## Introduction: what is EfficientNet
Effic... | {
"content_hash": "f39bc282532323810cdf182427d1b528",
"timestamp": "",
"source": "github",
"line_count": 499,
"max_line_length": 192,
"avg_line_length": 38.44288577154309,
"alnum_prop": 0.7620288797372674,
"repo_name": "keras-team/keras-io",
"id": "4da25d54bd0a2321bb1935a1ebd535577afe1d39",
"size": ... |
import os
MONGODB_SETTINGS = {
'db': 'tushedb', # Name of the database, other available settings refer to Mongoengine documentation
}
APP_NAME = 'light-cms' # English Only
SECRET_KEY = 'secret' # Change this in production
SITE_NAME = '图社'
ADMIN_URL = '/admin/' # I forgot where I used it
BASE_DIR = os.path.d... | {
"content_hash": "3f5409138b28f7581da35bff65981dab",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 105,
"avg_line_length": 26.6,
"alnum_prop": 0.6902255639097744,
"repo_name": "nsdown/tushe",
"id": "73f3718b5dc1c38bddcbedc591d44abbff53d38e",
"size": "693",
"binary": fa... |
import wx
import wx.html
from ..utils.generic_class import GenericClass
from ..utils.constants import control, dtype
from ..utils.validator import CharValidator
import os
import pkg_resources as p
class AnatomicalPreprocessing(wx.html.HtmlWindow):
def __init__(self, parent, counter = 0):
from urllib2 imp... | {
"content_hash": "30c57b12f71f5c09ed2406e040bbeaaf",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 308,
"avg_line_length": 49.03448275862069,
"alnum_prop": 0.569971870604782,
"repo_name": "sgiavasis/C-PAC",
"id": "cf850c588066eff34884be94b3daca0a002f5249",
"size": "8532... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import glob
import os
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class TestIndexJavaIntegration(PantsRunIntegrationTest):
def test_... | {
"content_hash": "fe907926b8e8fdba090e5114641f3501",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 95,
"avg_line_length": 52.03125,
"alnum_prop": 0.6684684684684684,
"repo_name": "pombredanne/pants",
"id": "695888163897c0f595aa96043ddcdf2b39b23a9e",
"size": "1812",
"bi... |
"""
======================================================================
Time-frequency on simulated data (Multitaper vs. Morlet vs. Stockwell)
======================================================================
This example demonstrates the different time-frequency estimation methods
on simulated data. It shows ... | {
"content_hash": "2d2f217f978f2a68a555f11ad116ab1d",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 79,
"avg_line_length": 42.56060606060606,
"alnum_prop": 0.6035362525216565,
"repo_name": "mne-tools/mne-tools.github.io",
"id": "da22307274e2da9e1123689fd867a4efa07f001f",
... |
import pytest
import responses
from flask import Flask
from urlobject import URLObject
from flask_dance.consumer import OAuth2ConsumerBlueprint
from flask_dance.consumer.storage import MemoryStorage
from flask_dance.contrib.meetup import make_meetup_blueprint, meetup
@pytest.fixture
def make_app():
"A callable t... | {
"content_hash": "1a9514af56f68a61b3221ff2248ea6e0",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 86,
"avg_line_length": 33.14772727272727,
"alnum_prop": 0.6643812135755913,
"repo_name": "singingwolfboy/flask-dance",
"id": "6412a598299c94728d34925579e07dc7610639fb",
"si... |
"""Tests for the Whois config flow."""
from unittest.mock import AsyncMock, MagicMock
import pytest
from whois.exceptions import (
FailedParsingWhoisOutput,
UnknownDateFormat,
UnknownTld,
WhoisCommandFailed,
)
from homeassistant.components.whois.const import DOMAIN
from homeassistant.config_entries im... | {
"content_hash": "0788a09a1e4310c8489ffe8ce11344a4",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 74,
"avg_line_length": 30.89344262295082,
"alnum_prop": 0.677368002122579,
"repo_name": "mezz64/home-assistant",
"id": "7250a9d15672f0b4a69664c39dd0623e6faae092",
"size": ... |
from django.core import urlresolvers
from django.conf.urls import include, url
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore import hooks
from wagtail.wagtailsearch.urls import admin as admin_urls
from wagtail.wagtailadmin.menu import MenuItem
@hooks.register('register_admin_urls'... | {
"content_hash": "72247cea92dfcf3c0f7d1fbc07ad5661",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 138,
"avg_line_length": 31.916666666666668,
"alnum_prop": 0.7310704960835509,
"repo_name": "100Shapes/wagtail",
"id": "d3d533036160a50d186b3e1c595c6af85f57c0b1",
"size": "7... |
"""This module contains the clparserutil's unit tests."""
import logging
import optparse
import unittest
from .. import clparserutil
class TestCase(unittest.TestCase):
def test_check_logginglevel(self):
option = clparserutil.Option(
"--create",
action="store",
dest="... | {
"content_hash": "6f6f3d57137b106e752b7a57ad71023c",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 76,
"avg_line_length": 34.06849315068493,
"alnum_prop": 0.48391636509851227,
"repo_name": "simonsdave/tor-async-couchdb",
"id": "85e9ea308074564930af6fce437a223cbd7b0ca0",
... |
from sympy import Rational as frac
from ..helpers import article, expand_symmetries
from ._helpers import CnScheme
_source = article(
authors=["G.M. Ewing"],
title="On Approximate Cubature",
journal="The American Mathematical Monthly",
volume="48",
number="2",
month="feb",
year="1941",
... | {
"content_hash": "49ff5f90c69646edc956a5d9e073cbac",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 64,
"avg_line_length": 25.954545454545453,
"alnum_prop": 0.6147110332749562,
"repo_name": "nschloe/quadpy",
"id": "d5e107b09c9c45ebd25b6d27196c08fbe2fb64b1",
"size": "571",... |
from toolset.test_types.verifications import basic_body_verification, verify_headers
from toolset.test_types.abstract_test_type import AbstractTestType
class TestType(AbstractTestType):
def __init__(self, config):
self.plaintext_url = ""
kwargs = {
'name': 'plaintext',
'req... | {
"content_hash": "6dbde592bc0eecd0698f7d4c54fb2dcc",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 117,
"avg_line_length": 32.8875,
"alnum_prop": 0.5248954770049411,
"repo_name": "greenlaw110/FrameworkBenchmarks",
"id": "1ca4bee1236c5fcb1c83bf165ece2174b9cf3958",
"size":... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/loot_schematic/shared_utensils_schematic.iff"
result.attribute_template_id = -1
result.stfName("craft_item_ingredients_n","utensils")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
ret... | {
"content_hash": "a06c4974f0509d709a42064cd1eb803e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 25.384615384615383,
"alnum_prop": 0.7121212121212122,
"repo_name": "anhstudios/swganh",
"id": "a5340af8dd42a65f660ee88de24452a062abb145",
"size": "47... |
import numpy as np
from collections import Counter
from MachineLearning.Distances import DistancesMatrix
class NearestNeighbor:
def __init__(self,k):
self.k=k
def train(self,X,y):
#X is matrix NlearnXp y is 1d-vector of length Nlearn
self.X=X
self.y=y
self.Nl=X.shape[0]
def query(self,Xt,typeD='Euc'):
... | {
"content_hash": "c5d778c3eb0f1e1e92e31b8c248285ec",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 89,
"avg_line_length": 23.625,
"alnum_prop": 0.6785714285714286,
"repo_name": "L-F-A/Machine-Learning",
"id": "8ba4610c1a2a08685e148f1db05d85892965f264",
"size": "756",
"... |
"""
Reactor that uses IO completion ports
"""
from twisted.internet import base, interfaces, main, error
from twisted.python import log, failure
from twisted.internet._dumbwin32proc import Process
from zope.interface import implements
import socket, sys
from twisted.internet.iocpreactor import iocpsupport as _iocp
... | {
"content_hash": "5976f8fe4be976dbdbfc3a42ca330c90",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 79,
"avg_line_length": 31.68780487804878,
"alnum_prop": 0.6142241379310345,
"repo_name": "hortonworks/hortonworks-sandbox",
"id": "08c4a36b3d2da24e6d5c9b74fba7f48402d0f4d4",... |
"""Implementation of magic functions for matplotlib/pylab support.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distri... | {
"content_hash": "5df1a05545169f9736a31ef65e2fb0d3",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 104,
"avg_line_length": 39.25903614457831,
"alnum_prop": 0.5771060303820776,
"repo_name": "unnikrishnankgs/va",
"id": "f3c70a34072e1eeea34deb88697de8d9f683cfe8",
"size": "... |
from __future__ import division, print_function
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import gammaln
from autograd import grad
import scipy.optimize
# The code in this example implements a method for finding a stationary point of
# the negative binomial likelihoo... | {
"content_hash": "26fb13583e0243a9d10db321db7db9cb",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 93,
"avg_line_length": 32.71212121212121,
"alnum_prop": 0.6702176933765632,
"repo_name": "HIPS/autograd",
"id": "47beaa5f7c861f9f535a0a96572798cb4694902f",
"size": "2159",
... |
'''
Created on 2013-5-8
@author: lan (www.9miao.com)
'''
from DBUtils.PooledDB import PooledDB
import MySQLdb
DBCS = {'mysql':MySQLdb,}
class DBPool(object):
'''
'''
def initPool(self,**kw):
'''
'''
self.config = kw
creator = DBCS.get(kw.get('engine','mysql'),MySQLdb)
... | {
"content_hash": "e6fd83c98e5d2a4abaa441f655c58140",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 60,
"avg_line_length": 18.16,
"alnum_prop": 0.5704845814977973,
"repo_name": "fuhongxue/Firefly",
"id": "97307d3dbba94e91f3dfbc998842fc3afe262b17",
"size": "467",
"binary... |
import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'mysql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
db = settings_dict['OPTIONS'].get('db',... | {
"content_hash": "480d3f74593c2551f2743937dd3c03c8",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 82,
"avg_line_length": 35.45,
"alnum_prop": 0.5239774330042313,
"repo_name": "scottferg/web-console",
"id": "cb4d1814653c3831c3a486ba76dc8a496957af5c",
"size": "1418",
"b... |
"""
Classes for the efficient drawing of large collections of objects that
share most properties, e.g., a large number of line segments or
polygons.
The classes are not meant to be as flexible as their single element
counterparts (e.g., you may not be able to select all line styles) but
they are meant to be fast for c... | {
"content_hash": "c5dcbf23255eb5f705f7a0e06bb8883d",
"timestamp": "",
"source": "github",
"line_count": 1838,
"max_line_length": 81,
"avg_line_length": 34.33188248095756,
"alnum_prop": 0.5653703527621945,
"repo_name": "miloharper/neural-network-animation",
"id": "e84bd3e578d3fbc58d40e79de6bbb225870e6... |
"""curses
The main package for curses support for Python. Normally used by importing
the package, and perhaps a particular module inside it.
import curses
from curses import textpad
curses.initwin()
...
"""
__revision__ = "$Id: __init__.py,v 1.4 2001/04/05 16:08:41 akuchling Exp $"
from _curses imp... | {
"content_hash": "a34a290a1f31f612a5c08e22f96f492d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 77,
"avg_line_length": 30.38888888888889,
"alnum_prop": 0.6849482023156612,
"repo_name": "MalloyPower/parsing-python",
"id": "9691e1dae06075d1341152087ffe32bbda293525",
"si... |
from swgpy.object import *
def create(kernel):
result = Ship()
result.template = "object/ship/shared_blacksun_medium_s03_tier4.iff"
result.attribute_template_id = -1
result.stfName("","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "73cff0c2e6b4573229c47a0910cee194",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 21.307692307692307,
"alnum_prop": 0.6714801444043321,
"repo_name": "obi-two/Rebelion",
"id": "4266010a6da5ce6e884de5a414d4d31243128f81",
"size": "422... |
from __future__ import unicode_literals
import swapper
from accelerator_abstract.models.base_program_cycle import BaseProgramCycle
class ProgramCycle(BaseProgramCycle):
class Meta(BaseProgramCycle.Meta):
swappable = swapper.swappable_setting(BaseProgramCycle.Meta.app_label,
... | {
"content_hash": "22a1c797f3fe60cebda7d02ae3ed7799",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 78,
"avg_line_length": 32.09090909090909,
"alnum_prop": 0.6940509915014165,
"repo_name": "masschallenge/django-accelerator",
"id": "f431ca01e4129eb038152b9d5ce53c676f8fe8db",... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_waf_signature
except ImportError:
py... | {
"content_hash": "f9c24d92f12826faefce939fefbdc508",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 142,
"avg_line_length": 34.55440414507772,
"alnum_prop": 0.6437246963562753,
"repo_name": "thaim/ansible",
"id": "2dfefd26262a39e43a7ff60638d5cbb86d8bc3f0",
"size": "7365"... |
"""Împăratul a primit serie de mesaje importante pe care este
important să le descifreze cât mai repede.
Din păcate mesagerul nu a apucat să îi spună împăratul care au fost
cheile alese pentru fiecare mesaj și tu ai fost ales să descifrezi
misterul.
Informații:
În criptografie, cifrul lui Caesar este o metodă sim... | {
"content_hash": "f26d11dc4381e5c29bb61c116ec2b2b2",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 74,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6796703296703297,
"repo_name": "alexandrucoman/labs",
"id": "ae68fba7105cb935cc993e9c8b8340444eb66a26",
"size": "... |
import tensorflow as tf
from ._common import layer_register
__all__ = ['SoftMax']
@layer_register()
def SoftMax(x, use_temperature=False, temperature_init=1.0):
"""
A SoftMax layer (no linear projection) with optional temperature
:param x: a 2D tensor
"""
if use_temperature:
t = tf.get_var... | {
"content_hash": "33770e1142f8bf72d1b20bd707e1b14d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 83,
"avg_line_length": 30.375,
"alnum_prop": 0.6378600823045267,
"repo_name": "yinglanma/AI-project",
"id": "a5ebd049a2d301635497174aeb1e7113a3a9acad",
"size": "593",
"bi... |
import unittest
from nymms.schemas import Result, StateRecord, types
from nymms.reactor import filters
class TestFilters(unittest.TestCase):
def setUp(self):
self.result = Result({'id': 'test:filter',
'state': types.STATE_OK,
'state_type': types... | {
"content_hash": "237eea373dfe3af9be088e0fbd8339dc",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 74,
"avg_line_length": 35.13513513513514,
"alnum_prop": 0.6484615384615384,
"repo_name": "cloudtools/nymms",
"id": "499e4b300a741b75a6f0d46d08524dc115a37eaa",
"size": "2600... |
from __future__ import unicode_literals
from core.models import BaseManager, Subcategory, Detail
from . import DETAIL_TYPE
class FormsTypeManager(BaseManager):
def get_queryset(self):
q = super(FormsTypeManager, self).get_queryset()
return q.filter(type=DETAIL_TYPE)
class FormSubcategory(Subca... | {
"content_hash": "2be0a32e237e50bfa6a6492e6c2f7aa0",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 58,
"avg_line_length": 23.794871794871796,
"alnum_prop": 0.6519396551724138,
"repo_name": "michaupl/materialsapp",
"id": "fbe8ac5e3375d6bd1ad1d297d19b1019f19f6bd0",
"size":... |
""" Humans.txt generator, based on work done on Kuma.
https://github.com/mozilla/kuma/blob/master/apps/humans/models.py
More info about humans.txt here http://humanstxt.org/"""
from django.apps import AppConfig
default_app_config = 'mozillians.humans.HumansConfig'
class HumansConfig(AppConfig):
name = 'mozi... | {
"content_hash": "ef1053bde793dea88cdcb136a7fb0af1",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 65,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.755223880597015,
"repo_name": "chirilo/mozillians",
"id": "023ceac427503eb522a545c1f3624c6a7e605c55",
"size": "33... |
"""A utility tool to run pnacl-translate for all archtectures.
Example usage:
The following command generates stripped nexefile_arm.nexe and
nexefile_x86_32.nexe and nexefile_x86_64.nexe.
python pnacl_translate.py --command=/path/to/toolchain/linux_pnacl \
--input=/path/to/pexefile --output_base=/path/to/ne... | {
"content_hash": "9018526e48627d9b55970c69c1da504e",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 79,
"avg_line_length": 35.8125,
"alnum_prop": 0.6175101803374055,
"repo_name": "takahashikenichi/mozc",
"id": "e4008d197f0f14c0f0d7f3a3ea47960d46d67c56",
"size": "4996",
... |
import sys
import re
import optparse
from ctypes import *
"""
This script will use the prototypes from "checkdocs.py -s" to concoct
a 1:1 Python wrapper for Allegro.
"""
class _AL_UTF8String:
pass
class Allegro:
def __init__(self):
self.types = {}
self.functions = {}
self.constants ... | {
"content_hash": "abcc385439b743439080faa603beabef",
"timestamp": "",
"source": "github",
"line_count": 538,
"max_line_length": 78,
"avg_line_length": 32.113382899628256,
"alnum_prop": 0.44897841060369276,
"repo_name": "tsteinholz/SR-Gaming",
"id": "96ad28c2dd9ae6ef03f679cdacad71d486f77efe",
"size"... |
from __future__ import unicode_literals
from decimal import Decimal
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('indicators', '0020_auto_20190128_1307'),
]
operations = [
migrations.AlterField(
model_name='collecteddata',... | {
"content_hash": "70c4ea20b2741e814ca0cffd22ebf226",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 193,
"avg_line_length": 43.93877551020408,
"alnum_prop": 0.6270320483046912,
"repo_name": "toladata/TolaActivity",
"id": "b4bf32ad12321890846cf879dbb2f4fcb962e4f2",
"size":... |
from openvino.inference_engine import IENetwork, IEPlugin
import argparse
import numpy as np
from urllib.parse import urlparse
from google.cloud import storage
from google.auth import exceptions
import classes
import datetime
from shutil import copy
import os
import json
def get_local_file(source_path):
parsed_pat... | {
"content_hash": "9945868ff695e547bf9dcb7cf3337f00",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 169,
"avg_line_length": 40.40677966101695,
"alnum_prop": 0.610738255033557,
"repo_name": "kubeflow/pipelines",
"id": "1ea24c2d391fd227ee63e8b10c71b2e740105e6c",
"size": "7... |
import copy
from nova.api.validation import parameter_types
snapshots_create = {
'type': 'object',
'properties': {
'snapshot': {
'type': 'object',
'properties': {
'volume_id': {
'type': 'string', 'minLength': 1,
},
... | {
"content_hash": "f0bdc4a38c9a80241d239cec440794d8",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 32.6,
"alnum_prop": 0.4316787506971556,
"repo_name": "openstack/nova",
"id": "0a13c50b11414877d468c1bd7ec878fe536ae06a",
"size": "2424",
"binary": ... |
import os
from golem.report import report
from golem.core.project import Project
class TestGetLastExecutionTimestamps:
def test_get_last_execution_timestamps(self, project_function, test_utils):
_, project = project_function.activate()
# suite does not exist
last_exec = report.get_last_... | {
"content_hash": "71c699e9ad3f96b7d90ae602a3a5b1d2",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 108,
"avg_line_length": 41.267605633802816,
"alnum_prop": 0.6757679180887372,
"repo_name": "lucianopuccio/golem",
"id": "4756e0f31270be98d35e69470908702375972fa5",
"size": ... |
from ginga import trcalc
from ginga.util import wcs
from ginga.util.six.moves import map
class CanvasMapper(object):
"""A coordinate mapper that maps to the viewer's canvas in
canvas coordinates.
"""
def __init__(self, viewer):
# record the viewer just in case
self.viewer = viewer
... | {
"content_hash": "9dbf027110c3fed2b348a0f0e93f8a0c",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 71,
"avg_line_length": 31.24,
"alnum_prop": 0.5871959026888605,
"repo_name": "rajul/ginga",
"id": "56cbfa41504c336a0ce9a6d60530d0a73a88a4fd",
"size": "4144",
"binary": f... |
from __future__ import unicode_literals, division, absolute_import
import datetime
import logging
import re
from requests.exceptions import TooManyRedirects
from sqlalchemy import Column, Unicode, DateTime
from flexget import plugin, db_schema
from flexget.config_schema import one_or_more
from flexget.entry import E... | {
"content_hash": "d40c2816745db4b5d6b19762c82c7de9",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 120,
"avg_line_length": 38.57198443579767,
"alnum_prop": 0.5790376273580147,
"repo_name": "OmgOhnoes/Flexget",
"id": "984decc0b6c346bfd54a383c21228d2521f59ced",
"size": "9... |
import os
from .. import bot
from .. import db
from .test_bot import EXAMPLE_TWEET
TESTDB = 'test_goldstar.db'
class TestDB():
def setup(self):
os.remove(TESTDB)
self.db = db.GoldStarDB(TESTDB)
def teardown(self):
os.remove(TESTDB)
def test_db_save(self):
# Save a twe... | {
"content_hash": "8b2edd9f3971a300060598bc0e630533",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 33.31707317073171,
"alnum_prop": 0.6112737920937042,
"repo_name": "barentsen/AstroGoldStars",
"id": "985a4bd665aac429039a8184a7285986057b38c2",
"size... |
import logging
import numpy as np
from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
from ray.rllib.models.torch.misc import SlimFC, AppendBiasLayer, \
normc_initializer
from ray.rllib.utils.annotations import override
from ray.rllib.utils.framework import try_import_torch
torch, nn = try_import_torch(... | {
"content_hash": "2fbaad9db35daa3bdcd0f2c85ebe3be2",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 75,
"avg_line_length": 39.404580152671755,
"alnum_prop": 0.5559860519178613,
"repo_name": "robertnishihara/ray",
"id": "4080c93185a2161183b84fda41dfde5d723d1f1c",
"size": ... |
"""Support for SimpliSafe alarm systems."""
from __future__ import annotations
import asyncio
from collections.abc import Callable, Iterable
from datetime import timedelta
from typing import Any, cast
from simplipy import API
from simplipy.device import Device, DeviceTypes
from simplipy.errors import (
EndpointUn... | {
"content_hash": "a22c171ec1c9626e767f13f019021afb",
"timestamp": "",
"source": "github",
"line_count": 893,
"max_line_length": 88,
"avg_line_length": 34.347144456886895,
"alnum_prop": 0.6258150756390193,
"repo_name": "nkgilley/home-assistant",
"id": "53aa9e84054214b6ec483f0dda33187a7fbdb343",
"siz... |
import sys
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import Pi... | {
"content_hash": "3508dd69a00920fd1be3e4fce4dd680c",
"timestamp": "",
"source": "github",
"line_count": 1664,
"max_line_length": 198,
"avg_line_length": 46.00420673076923,
"alnum_prop": 0.6472808977021854,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a7d2ada008297290be94288cf5bc0a65e6935d34",
... |
import unittest
from django.core.exceptions import ImproperlyConfigured
from django.db import ProgrammingError
try:
from django.contrib.gis.db.backends.postgis.operations import PostGISOperations
HAS_POSTGRES = True
except ImportError:
HAS_POSTGRES = False
except ImproperlyConfigured as e:
# If psycop... | {
"content_hash": "75716c39fcc355e27a6f79223bbd5a59",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 95,
"avg_line_length": 37.270270270270274,
"alnum_prop": 0.6323422770123278,
"repo_name": "tysonclugg/django",
"id": "2f55406f56ae65fea9f0edead8f06b0e1875342d",
"size": "4... |
from __future__ import unicode_literals
from __future__ import print_function
import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
import site
site.addsitedir("..\Lib")
from ChineseUtilities import ChineseDB, SortStringDB
import datafiles, os
# ------------------------------------------------------... | {
"content_hash": "f59c9d5d318e37191c38bf04e7f7df0f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 93,
"avg_line_length": 27.875,
"alnum_prop": 0.5889387144992526,
"repo_name": "rmlockwood/FLExTrans",
"id": "23f290ed0224f41f132aee67b329cd5921b0710e",
"size": "1559",
"b... |
"""
Plugin responsible for post-installation configuration
"""
from packstack.installer import utils
from packstack.installer import basedefs
# ------------- Postscript Packstack Plugin Initialization --------------
PLUGIN_NAME = "Postscript"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initCon... | {
"content_hash": "196c1f57012c2f63926c8e5fd1dab228",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 91,
"avg_line_length": 34.5,
"alnum_prop": 0.5785507246376812,
"repo_name": "mahak/packstack",
"id": "a6e02f21ee7329d6598d8efd2f9d4091bcc45b74",
"size": "2295",
"binary":... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Group
from django.utils.safestring import mark_safe
from authority import permissions, get_choices_for
from authority.models import Permissi... | {
"content_hash": "24c20923e9fbd6481b49a58a3a3b5f9e",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 80,
"avg_line_length": 38.65384615384615,
"alnum_prop": 0.5972636815920398,
"repo_name": "mythmon/kitsune",
"id": "03a93dd19e1ba04c93eaf06c605302439d20edd9",
"size": "4020... |
"""Browser steps for Gherkin"""
import os
from contextlib import contextmanager
from aloe import around, world
from selenium import webdriver
from xvfbwrapper import Xvfb
@around.all
@contextmanager
def with_browser():
"""Start a browser for the tests."""
if 'XVFB' in os.environ:
world.vdisplay = ... | {
"content_hash": "ec27d174a9fa86c528c76cafa1f1d263",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 80,
"avg_line_length": 26.179775280898877,
"alnum_prop": 0.6094420600858369,
"repo_name": "jricardo27/holiday_planner",
"id": "8562f22ff084b9515ff6114fec6255f105df9da5",
"s... |
"Python and Django compatibility functions."
from __future__ import unicode_literals
from django.conf import settings
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
try:
from django.contrib.auth import get_user_model
except ImportError: # pragma: no cover
# Django < 1.5
from django... | {
"content_hash": "cb19a8055bf292d23a080fcf78c8efa7",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 74,
"avg_line_length": 27.09090909090909,
"alnum_prop": 0.7189597315436241,
"repo_name": "vyscond/django-all-access",
"id": "615f5eb31d6da58f9e320e41843af1036bb589ad",
"siz... |
import abc
import collections
import collections.abc
import functools
import operator
import sys
import types as _types
import typing
__all__ = [
# Super-special typing primitives.
'Any',
'ClassVar',
'Concatenate',
'Final',
'LiteralString',
'ParamSpec',
'ParamSpecArgs',
'ParamSpecK... | {
"content_hash": "1cafc3c9e0f2a1aefa053401f4e29749",
"timestamp": "",
"source": "github",
"line_count": 2209,
"max_line_length": 90,
"avg_line_length": 36.250792213671346,
"alnum_prop": 0.5626139513973876,
"repo_name": "paolodedios/pybuilder",
"id": "ef42417c208e93c55d704728d3e88dfe46250d92",
"size... |
"""
Django settings for santicms project.
Generated by 'django-admin startproject' using Django 1.9.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | {
"content_hash": "9a8e4d9bf28915a6e78799edde56091c",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 91,
"avg_line_length": 27.879310344827587,
"alnum_prop": 0.6914038342609771,
"repo_name": "daimon99/santicms",
"id": "cdaabda4c863f7f3cbbc68b90633caaa2e11af16",
"size": "3... |
"""
auto rule template
~~~~
:author: LoRexxar <LoRexxar@gmail.com>
:homepage: https://github.com/LoRexxar/Kunlun-M
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 LoRexxar. All rights reserved
"""
from utils.api import *
class CVI_1001():
"""
rule cla... | {
"content_hash": "31ec76d85c7398d58108aa16785afef0",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 67,
"avg_line_length": 22.389830508474578,
"alnum_prop": 0.5253595760787282,
"repo_name": "LoRexxar/Cobra-W",
"id": "a5a09dc92af8d2bb4f8d6c2cdf0092b08bb6aed1",
"size": "139... |
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 All Rights Reserved
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.apa... | {
"content_hash": "75271a80e60d675839eaf9de1ccf98c5",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 76,
"avg_line_length": 44.471830985915496,
"alnum_prop": 0.5703879651623119,
"repo_name": "os-cloud-storage/openstack-workload-disaster-recovery",
"id": "2d586cd4c74c119ee52... |
"""
Tests for pika.connection.Connection
"""
# Suppress pylint warnings concerning access to protected member
# pylint: disable=W0212
# Suppress pylint messages concerning missing docstrings
# pylint: disable=C0111
# Suppress pylint messages concerning invalid method name
# pylint: disable=C0103
try:
import ... | {
"content_hash": "5938bb725f3acbceec24a8c700577199",
"timestamp": "",
"source": "github",
"line_count": 859,
"max_line_length": 80,
"avg_line_length": 41.80209545983702,
"alnum_prop": 0.6443132449593405,
"repo_name": "Zephor5/pika",
"id": "0ffe78e667ce077c04a44d1de8f0d169cec71070",
"size": "35908",... |
from django.db import models
# If ticket #1578 ever slips back in, these models will not be able to be
# created (the field names being lower-cased versions of their opposite
# classes is important here).
class First(models.Model):
second = models.IntegerField()
class Second(models.Model):
first = models.For... | {
"content_hash": "c15ca447b3db5c2c831ff80365ac01af",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 32.61764705882353,
"alnum_prop": 0.7060414788097386,
"repo_name": "gabelula/b-counted",
"id": "8ddec98da44b04b95f2874c43357e54a3c9f79c3",
"size": "11... |
from __future__ import unicode_literals
from rest_framework import permissions as drf_permissions
from api.base.utils import get_user_auth
from osf.models.action import ReviewAction
from osf.models.mixins import ReviewableMixin, ReviewProviderMixin
from osf.utils.workflows import DefaultTriggers
from osf.utils import... | {
"content_hash": "7cafa46c7df0b65907c38963a24a7ab1",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 116,
"avg_line_length": 43.80357142857143,
"alnum_prop": 0.6865063187933144,
"repo_name": "chennan47/osf.io",
"id": "0986b25f122d3a76f2d85fe6ad4c9d080423d2d5",
"size": "247... |
from setuptools import find_packages, setup
version = '0.2.1'
setup(
name='streamcat',
packages=find_packages(exclude=('tests', 'docs')),
version=version,
description='Encode and decode concatenated objects as streams',
long_description=open('README.rst', 'r').read(),
author='Bertrand Bonnefoy... | {
"content_hash": "ea8569d34777a4220934c5482b207332",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 38.36666666666667,
"alnum_prop": 0.63249348392702,
"repo_name": "cryptosense/streamcat",
"id": "021664b3652836fb6f66b93dac9de811a8db1818",
"size": "1... |
"""
Implementation of insertion sort
"""
from random import randint
def insert(arr, pos, value):
"""
inserts the value at its place in the subarray arr[0:pos-1]
"""
idx = pos - 1
while(idx >= 0 and arr[idx] > value):
arr[idx+1] = arr[idx]
idx -= 1
arr[idx + 1] = value
def inser... | {
"content_hash": "736af1d20fa1aed09c4b3988b99edaf3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 26.818181818181817,
"alnum_prop": 0.56045197740113,
"repo_name": "apurushottam/Algorithms",
"id": "17b07a190f1e1c5ebb7c8d03412662e80cfc8c7d",
"size":... |
"""
The MIT License (MIT)
Copyright (c) 2015-2019 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, ... | {
"content_hash": "751f8bf64b3a6c019b3a67992d8d7943",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 113,
"avg_line_length": 34.09945750452079,
"alnum_prop": 0.5960651217054674,
"repo_name": "imayhaveborkedit/discord.py",
"id": "ea202b656b548f841d4dd07676a3bd7c63d9e526",
... |
"""
Quickly load ROOT symbols without triggering PyROOT's finalSetup().
The main principle is that appropriate dictionaries first need to be loaded.
"""
from __future__ import absolute_import
import ROOT
from .. import log; log = log[__name__]
from .module_facade import Facade
__all__ = []
root_module = ROOT.modul... | {
"content_hash": "f1aa4703c0ccfb363d9bc2aad633032c",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 80,
"avg_line_length": 37.12359550561798,
"alnum_prop": 0.5920096852300242,
"repo_name": "ndawe/rootpy",
"id": "5b210137a0d390f377fbbc2d135f86544ad6b5ce",
"size": "3304",
... |
import struct
import logging
from zorro.di import di, has_dependencies, dependency
from .keyregistry import KeyRegistry
from .mouseregistry import MouseRegistry
from .window import Window
from .xcb import Core, Rectangle, XError
from .groups import GroupManager
from .commands import CommandDispatcher
from .classify i... | {
"content_hash": "fc7e46c65297eca1e19990456ec40a1f",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 79,
"avg_line_length": 35.025,
"alnum_prop": 0.5683695319669624,
"repo_name": "tailhook/tilenol",
"id": "745e5015909aed2aad2f34dec4b98553b5346775",
"size": "9807",
"bina... |
"""VCD Variable."""
from hdltools.vcd import VCDObject, VCDScope
class VCDVariable(VCDObject):
"""Variable declaration."""
def __init__(
self, *identifiers, var_type="wire", size=1, name=None, scope=None
):
"""Initialize."""
super().__init__()
self._vartype = var_type
... | {
"content_hash": "5b87111627400c6164280f11855dfe41",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 78,
"avg_line_length": 25.53103448275862,
"alnum_prop": 0.5232306861156132,
"repo_name": "brunosmmm/hdltools",
"id": "3ff296aab446af726cac3f16d6cb1df95a1222fb",
"size": "3... |
from flask import Flask, request
from flask_sqlalchemy import SQLAlchemy
from flask_webtest import get_scopefunc
def make_db(app):
session_options = {}
if app.testing:
session_options['scopefunc'] = get_scopefunc()
return SQLAlchemy(app, session_options=session_options)
app = Flask(__name__)
app... | {
"content_hash": "f91e0c4358d71ee92b012496baca1a96",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 62,
"avg_line_length": 24.054054054054053,
"alnum_prop": 0.6674157303370787,
"repo_name": "aromanovich/flask-webtest",
"id": "72f85e99ba84cb2de111d35bb48878618dc8fe7f",
"si... |
from django.views import generic
from . import forms
from django.shortcuts import redirect
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.contrib.auth import logout
from django.contrib import messages
class SignInAndSign... | {
"content_hash": "bf228e1f4aaa360a44e8a53120124958",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 73,
"avg_line_length": 40.92941176470588,
"alnum_prop": 0.5596435757401552,
"repo_name": "aarticianpc/marine-florits",
"id": "be5ab7de63d9b375ea034750b624efcf02cbbfbb",
"si... |
import cgi
from paste.urlparser import PkgResourcesParser
from pylons.middleware import error_document_template
from webhelpers.html.builder import literal
from abraxas.lib.base import BaseController
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The Error... | {
"content_hash": "d742f0b8f185cd0ffb409eb3be465827",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 91,
"avg_line_length": 37.97727272727273,
"alnum_prop": 0.6624775583482945,
"repo_name": "thakadu/Abraxas",
"id": "31d31c30c202677169cdd1fd5b1945e944e4bb2b",
"size": "1671"... |
"""Tests for tensorflow.ops.test_util."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import tensorflow.python.platform
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from google.protobuf import te... | {
"content_hash": "a1ad535aa2b6bd8ecf385d0dd72708e3",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 80,
"avg_line_length": 31.69172932330827,
"alnum_prop": 0.672835112692764,
"repo_name": "MemeticParadigm/TensorFlow",
"id": "fc847975017d329d6a437c23b9790ff68670ddb1",
"si... |
from azure_common import BaseTest, arm_template
from c7n.utils import local_session
from c7n_azure.query import ChildTypeInfo
from c7n_azure.session import Session
from c7n_azure.utils import ResourceIdParser
class RecordSetTest(BaseTest):
def test_record_set_schema_validate(self):
with self.sign_out_pat... | {
"content_hash": "9f10088429d3830d0040dbd4ae155b24",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 100,
"avg_line_length": 32.357798165137616,
"alnum_prop": 0.5250921462999717,
"repo_name": "FireballDWF/cloud-custodian",
"id": "a26785aeefbe5189a14210f7f17a9bda5c7426b9",
... |
from piped_statsd import version
from piped_statsd.reporter import MetricsReporter
| {
"content_hash": "39bb98cb438fb4bf23fe6d1633f07532",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 49,
"avg_line_length": 41.5,
"alnum_prop": 0.8674698795180723,
"repo_name": "alexbrasetvik/Piped",
"id": "47bf0affc6db0479e310ae2f295a3f66acf023db",
"size": "83",
"binary"... |
import feedparser
import entry
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
def compile_feeds(rsslist):
return reduce(lambda i, j: i + j,
map(lambda k: feedparser.parse(k)['entries'], rsslist), [])
def load_feed(rsslist):
for i in compile_feeds(... | {
"content_hash": "c1e54f5ec69a0f3733ceb1f44b156c23",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 24.72222222222222,
"alnum_prop": 0.6314606741573033,
"repo_name": "ChattanoogaPublicLibrary/booksforcha",
"id": "06cbe92c915cd89d7ef7b50ed962bb4c2556eb... |
import time
import subprocess
import libqtile
import libqtile.layout
import libqtile.bar
import libqtile.command
import libqtile.widget
import libqtile.manager
import libqtile.config
import libqtile.hook
import libqtile.confreader
from nose.tools import assert_raises
from nose.plugins.attrib import attr
from . import... | {
"content_hash": "9911e638434132d5b9b9b6a67ee64b1d",
"timestamp": "",
"source": "github",
"line_count": 921,
"max_line_length": 75,
"avg_line_length": 31.140065146579804,
"alnum_prop": 0.5773012552301255,
"repo_name": "nxnfufunezn/qtile",
"id": "1df7800bb05518009a7a1a1181c1d15d498a8ee2",
"size": "3... |
import numpy as np
class KNearestNeighbor:
""" a kNN classifier with L2 distance """
def __init__(self):
pass
def train(self, X, y):
"""
Train the classifier. For k-nearest neighbors this is just
memorizing the training data.
Input:
X - A num_train x dimension array where each row is ... | {
"content_hash": "1180c60ba4a730cb447ca8e228f6c5d0",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 80,
"avg_line_length": 43.22360248447205,
"alnum_prop": 0.4323897111653973,
"repo_name": "DeercoderCourse/cs231n",
"id": "cc094f8fe033bea5b083583d11051e8e3727a0ab",
"size"... |
""" Handler for the generated preferences stuff. """
import base64
import codecs
import logging
from StringIO import StringIO
from xml.parsers.expat import ExpatError
from datafinder.core.configuration.gen import preferences
from datafinder.core.error import ConfigurationError
from datafinder.persiste... | {
"content_hash": "d2fc202cb81a843fef6c6e8942777fc8",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 130,
"avg_line_length": 40.29934210526316,
"alnum_prop": 0.5737490817076157,
"repo_name": "DLR-SC/DataFinder",
"id": "07b1cc97ac59671bf113fb595f8c8764f50db5a5",
"size": "1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.