text stringlengths 4 1.02M | meta dict |
|---|---|
force_https = False
def init_reverse_proxy(settings_force_https,settings_prefix):
global force_https,prefix
force_https = settings_force_https
prefix = settings_prefix
class HTTPSProxied(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
... | {
"content_hash": "9fb7ce416e1cc5fbac4a35a8bd19bfb8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 61,
"avg_line_length": 27.375,
"alnum_prop": 0.6484018264840182,
"repo_name": "ArneBab/gamification-engine",
"id": "bdb0be50542303cc6ffb9911cf1e2b654a717728",
"size": "463"... |
import os.path
import argparse
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
FTP_ROOT = '/ftp_root'
def run_ftpd(user: str, password: str, host: str, port: int, passive: str, anon: bool) -> None:
user_dir = os.path.join(FTP_RO... | {
"content_hash": "167f4b7cb4f9bd5ff1b7adb3f63717c8",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 95,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.6435294117647059,
"repo_name": "robinrodricks/FluentFTP",
"id": "86957f2a50b41471e8057c0bd838935a9de15f3b",
"size... |
from temp_log import Fridges, db
from app import app
import sys
import os, os.path
import csv
from datetime import datetime
# Starting from a CSV in the old format, import data into the database
def import_data(fridge, data):
if not isinstance(fridge, Fridges):
raise TypeError('Fridge must be an instance ... | {
"content_hash": "f045b85fae1bff9f3cbbd221dfc406b0",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 27.603448275862068,
"alnum_prop": 0.5746408494690818,
"repo_name": "spauka/therm_flask",
"id": "8910c3967022207a583e1698f7c1567239658c40",
"size": "1... |
from django.conf import settings
from django.core import urlresolvers
from django import http
from django.test.client import Client
from django.utils.importlib import import_module
from mox import IsA
import horizon
from horizon import api
from horizon import base
from horizon import test
from horizon import users
c... | {
"content_hash": "cf52c89161aa540f73508c1304a756fb",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 79,
"avg_line_length": 42.55719557195572,
"alnum_prop": 0.5968091563339981,
"repo_name": "xhorn/xchorizon",
"id": "995f915bada4fc27a866dc6d2fc6f6eb39466329",
"size": "1237... |
from __future__ import absolute_import
import logging
logger = logging.getLogger(__name__)
VERSION = (0, 99, 6, "dev")
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Alberto Paro"
__contact__ = "alberto.paro@gmail.com"
__homepage__ = "http://github.com/aparo/pyes/"
__docformat__ ... | {
"content_hash": "1f844056badddbfb73f00d6289fe3909",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 71,
"avg_line_length": 23.38888888888889,
"alnum_prop": 0.6437054631828979,
"repo_name": "HackLinux/pyes",
"id": "91b66fdbb752a7bfc9f7e5dd1fdb3113d103c9a2",
"size": "866",
... |
"""Scraper for the 1st District Court of Appeals
CourtID: ohio
Court Short Name: Ohio
Author: Andrei Chelaru
"""
from juriscraper.opinions.united_states.state import ohio
class Site(ohio.Site):
def __init__(self):
super(Site, self).__init__()
self.court_id = self.__module__
self.court_ind... | {
"content_hash": "75b5b53c14c68d894498bfc1f8c6cf1d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 25.933333333333334,
"alnum_prop": 0.6606683804627249,
"repo_name": "brianwc/juriscraper",
"id": "e4fcd568b41fca3213b64fa43797a2ebcada04e6",
"size": "... |
import os
from config.base import *
HOST = '0.0.0.0'
PORT = int(os.environ['PORT'])
DEBUG = False
CSRF_ENABLED = True
| {
"content_hash": "91fc352f5cf618eadb7334cb0bd4f646",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 30,
"avg_line_length": 15,
"alnum_prop": 0.675,
"repo_name": "nrempel/rucksack-api",
"id": "4a7b9e98a6f5ff8c30a97e89e74a929e41e7bbf3",
"size": "145",
"binary": false,
"c... |
import functools
from oslo_serialization import jsonutils as json
from six.moves import http_client
from six.moves.urllib import parse as urllib
from tempest.lib.common import api_version_utils
from tempest.lib.common import rest_client
# NOTE(vsaienko): concurrent tests work because they are launched in
# separate p... | {
"content_hash": "34eeb2f2e50bac18ea69c1704da26961",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 34.80555555555556,
"alnum_prop": 0.5975373389579295,
"repo_name": "Wuguanping/Server_Manage_Plugin",
"id": "757a77075aeadcbda1dff684b9b351d67a6f8c63",... |
import logging
import asyncio
from agent.check_plugins import AbstractCheckPlugin
# Do khong biet dung thu vien asyncio ntn ca nen em dung thu vien request
# python
import requests
import sys
import time
from datetime import datetime
logger = logging.getLogger(__name__)
class FirstByte(AbstractCheckPlugin):
@a... | {
"content_hash": "4ca2ad1eff04b50b81ad7ba75eb000b5",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 73,
"avg_line_length": 31.06896551724138,
"alnum_prop": 0.5588235294117647,
"repo_name": "PiScale/god-eye",
"id": "d06295145567139280862957bdfc4e25704ee919",
"size": "1802"... |
from oslo_config import cfg
import oslo_messaging
_DEFAULT_AUTH_METHODS = ['external', 'password', 'token', 'oauth1']
_CERTFILE = '/etc/keystone/ssl/certs/signing_cert.pem'
_KEYFILE = '/etc/keystone/ssl/private/signing_key.pem'
_SSO_CALLBACK = '/etc/keystone/sso_callback_template.html'
FILE_OPTIONS = {
None: [
... | {
"content_hash": "fcd4199ff31ed7690df822fa0489c261",
"timestamp": "",
"source": "github",
"line_count": 1184,
"max_line_length": 79,
"avg_line_length": 56.242398648648646,
"alnum_prop": 0.5256416032196544,
"repo_name": "dstanek/keystone",
"id": "a841445a130a24fda4a30e7e2b839e7a36886fd2",
"size": "6... |
"""
Base test class for testing the WorldMap API used by GeoConnect
"""
import os
from os.path import isfile, join, dirname, realpath
from django.test import TestCase
import json
import string
import random
from django.conf import settings
#------------------
from gc_apps.geo_utils.msg_util import *
class World... | {
"content_hash": "275b8635cdfdc88d59b96da067cca2a1",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 137,
"avg_line_length": 35.29824561403509,
"alnum_prop": 0.658051689860835,
"repo_name": "IQSS/geoconnect",
"id": "7ec120884ca021bf71879161e46000f2145d2af8",
"size": "2012"... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
from django.db.models import Model, ManyToManyField, ForeignKey, CharField, TextField, DateTimeField, IntegerField, FileField, BooleanField
from jeevesdb.JeevesModel import JeevesModel as Model
from jeevesdb.JeevesModel ... | {
"content_hash": "a3691384e4193820659a701ed5568810",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 139,
"avg_line_length": 32.03135888501742,
"alnum_prop": 0.6532144022625911,
"repo_name": "jeanqasaur/jeeves",
"id": "96bfe358631d2bd2007abd32c9e734afe5780538",
"size": "9... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "6248fec06e17aff0af08a187f7e197af",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 110,
"avg_line_length": 34.869565217391305,
"alnum_prop": 0.6999168744804655,
"repo_name": "arenadata/ambari",
"id": "cf05a366c648fd4e69d0247668ac0df6a0d4f7ec",
"size": "24... |
from django.utils.translation import gettext_lazy as _
import horizon
class KeyPairs(horizon.Panel):
name = _("Key Pairs")
slug = 'key_pairs'
permissions = ('openstack.services.compute',)
policy_rules = (("compute", "os_compute_api:os-keypairs:index"),
("compute", "os_compute_api:... | {
"content_hash": "0bca17b35c1184762a9944ca65e830b7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 70,
"avg_line_length": 31.181818181818183,
"alnum_prop": 0.6472303206997084,
"repo_name": "openstack/horizon",
"id": "de362dd55bc5dc99eda9c25d5091a7476839c463",
"size": "95... |
events = []
def store_event(ev):
events.append(ev)
def reg_ev_hook(mh, event, callback=store_event):
hook = [{'event': event, 'callback': callback}]
mh.register_event_hook(hook)
def dummy_method(*args):
return True
def dummy_method_2(*args):
return False
| {
"content_hash": "ae4f8012686caa3a05af2e5bfbb84386",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 51,
"avg_line_length": 13.045454545454545,
"alnum_prop": 0.6376306620209059,
"repo_name": "hydratk/hydratk",
"id": "5ef077bef112abb8489f3ef81a6e3f5b1ec99639",
"size": "287"... |
"""
Vision system demo.
Notes
-----
Generate input file by running ./data/generate_vision_input.py
and generate configurations of LPUs by running ./data/generate_vision_gexf.py
"""
import argparse
import itertools
import networkx as nx
nx.readwrite.gexf.GEXF.convert_bool = {'false':False, 'False':False,
... | {
"content_hash": "8b3cacc8a23dd6ebfc6427bd98352597",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 99,
"avg_line_length": 33.026315789473685,
"alnum_prop": 0.649800796812749,
"repo_name": "neurokernel/vision",
"id": "9cd340260b8886ce0fca595bb4bd24af0a301104",
"size": "25... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class UserEnterpriseAuth(models.Model):
"""Tower Enterprise Auth association model"""
PROVIDER_CHOICES = (
('radius', _('RADIUS')),
('tacacs+', _('TACACS+')),
... | {
"content_hash": "ad8e910fbb52b505228338ece469b0d4",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 70,
"avg_line_length": 26.47826086956522,
"alnum_prop": 0.6305418719211823,
"repo_name": "wwitzel3/awx",
"id": "474c3d8c57d450a6b06cd56560cc64027ff4305b",
"size": "677",
... |
from __future__ import division
from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relation, backref
from waldo.backend import Base
class GOAnnotation(Base):
__tablename__ = 'mgi_goannotation'
mgi_go_id = Column(Integer, primary_key=True)
mgi_id = Column(String(32), Forei... | {
"content_hash": "2880346553a91308aad9781c42e11feb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 31.441860465116278,
"alnum_prop": 0.6427514792899408,
"repo_name": "luispedro/waldo",
"id": "036a6aa62dbb0e2b458242db9c5de67c0fda393a",
"size": "2562... |
"""
.. module: security_monkey.common.sts_connect
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Patrick Kelley <pkelley@netflix.com> @monkeysecurity
"""
from security_monkey.datastore import Account
import boto
import boto.ec2
import boto.ses
import boto.iam
import boto.sns
import boto.sqs
import bot... | {
"content_hash": "28d1358033591307f966776f93ac1f72",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 122,
"avg_line_length": 35.26970954356847,
"alnum_prop": 0.581764705882353,
"repo_name": "daichenge/security_monkey",
"id": "5c76d6aa3e2b96179a304c6bd08c8876e235ac26",
"si... |
from .algebra import FunctionRing
from .operator import OperatorRing
from .differential import DifferentialRing, FDFactory, DFactory
| {
"content_hash": "cae7dff5fee5a34e95a377b572779693",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 63,
"avg_line_length": 33.5,
"alnum_prop": 0.8507462686567164,
"repo_name": "pearu/sympycore",
"id": "9627c95b951e21281d920b91c8b1a83b88423526",
"size": "135",
"binary": f... |
from flask import Flask
app = Flask(__name__)
import os
# ex :) MOVIES_BACKEND_BASE_URL = 'http://localhost:8080'
BACKEND_MOVIES_BASE_URL = os.environ.get('BACKEND_MOVIES_BASE_URL')
BACKEND_POLITICS_BASE_URL = os.environ.get('BACKEND_POLITICS_BASE_URL')
BACKEND_WEATHER_BASE_URL = os.environ.get('BACKEND_WEATHER_BAS... | {
"content_hash": "0d288e0a56a475bc22e54a3a67040a50",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 35.473684210526315,
"alnum_prop": 0.7373887240356083,
"repo_name": "microstack/api_gateway",
"id": "ae4deb2e77d627ca8dfc679c0bd550cdd1c1122a",
"size"... |
from djangoautoconf.auto_conf_admin_tools.reversion_feature import ReversionFeature
from djangoautoconf.auto_conf_admin_tools.admin_register import AdminRegister
import models
managed_item_admin_register = AdminRegister()
managed_item_admin_register.add_feature(ReversionFeature())
managed_item_admin_register.register... | {
"content_hash": "3315e4f2c5791eb09290ce6512235da3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 83,
"avg_line_length": 42.5,
"alnum_prop": 0.8470588235294118,
"repo_name": "weijia/server-info-collector",
"id": "269ab430c69d7c98c914157c97fee040745bbc5e",
"size": "447",
... |
"""An extended :class:`TestCase` for the plain python tests of a Lino
project.
"""
import os
import sys
import doctest
import warnings
from pathlib import Path
from atelier.test import TestCase
class TestCase(TestCase):
"""An extended :class:`atelier.test.TestCase` to be run using
:xfile:`setup.py` in the r... | {
"content_hash": "c6b6fd7dc1e77e469b775dc854350d62",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 87,
"avg_line_length": 34.063380281690144,
"alnum_prop": 0.5877610088898078,
"repo_name": "lino-framework/lino",
"id": "83746a822c33998e7b11b613cf78139702391e14",
"size": ... |
import time
import logging
import hashlib
import collections
from django.core.cache import DEFAULT_CACHE_ALIAS
from django.conf import settings
import six
from cacheback import tasks
from cacheback.utils import get_cache
logger = logging.getLogger('cacheback')
MEMCACHE_MAX_EXPIRATION = 2592000
# Container for cal... | {
"content_hash": "79420d5bc742213c580ed3591e3c18c6",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 90,
"avg_line_length": 38.25984251968504,
"alnum_prop": 0.5722027852095767,
"repo_name": "michaelkuty/django-cacheback",
"id": "43a3b0c86d7530c2e8d0a05631cc8cf7f86d5f70",
... |
"""Module to test the API's Shopping list endpoints"""
import json
from tests.basetest import TestBase
class ShoppinglistTestCase(TestBase):
"""Class used to test operations on shoppinglists"""
def test_shoppinglist_creation(self):
"""Test if API can create a shoppinglist"""
self.get_acces... | {
"content_hash": "2a76d400b18d47282af90e563b7beefb",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 77,
"avg_line_length": 32.904761904761905,
"alnum_prop": 0.5872203050205944,
"repo_name": "machariamarigi/shopping_list_api",
"id": "95af96a38de7b9167bafa89a128d075cbe742bb0... |
import json
import io
import os
import logging
import markdown
from cgi import escape
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
from tornado import web, httpserver, ioloop, log
from tornado.httpclient import AsyncHTTPClient
import tornado.options
from tornado.options import define, opti... | {
"content_hash": "e0baac41d2eca7ae73c1dc0e30a31e72",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 159,
"avg_line_length": 36.02429149797571,
"alnum_prop": 0.6531804899977524,
"repo_name": "iamjakob/nbviewer",
"id": "9e916ed49161dd73c4a5b243dc1aaf11ed2a71e0",
"size": "9... |
"""
Provide a directory of SAMs and this will print
the sum total matched nucleotides to the reference
(if the sam file was created without a header and
with unaligned rows suppressed)
"""
import sys, re, string, os
d = sys.argv[1]
fs = sorted([i for i in os.listdir(d) if i.endswith(".sam")])
ps = [os.path.join(d, i)... | {
"content_hash": "9d0b1b3641e8bc4dd298978ccec9183b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 63,
"avg_line_length": 31.392857142857142,
"alnum_prop": 0.5642775881683731,
"repo_name": "karoraw1/xMetaPipeline",
"id": "991ce133ce70a8d087796cea142b1a5160e45fc5",
"size"... |
from io import StringIO
from antlr4.RuleContext import RuleContext
from antlr4.error.Errors import IllegalStateException
class PredictionContext(object):
# Represents {@code $} in local context prediction, which means wildcard.
# {@code#+x =#}.
#/
EMPTY = None
# Represents {@code $} in an array i... | {
"content_hash": "c2c1f0a5a7ce82ab5a4d4382676dd06e",
"timestamp": "",
"source": "github",
"line_count": 617,
"max_line_length": 115,
"avg_line_length": 36.309562398703406,
"alnum_prop": 0.6339329554077578,
"repo_name": "ericvergnaud/antlr4",
"id": "623611b97f312448f5162df889a20d34ce66ece0",
"size":... |
import time
import hashlib
import json
import logging
import os
import urllib
import urllib2
from threading import Thread
from baseScreen import BaseScreen
import mopidy.core
import pygame
from ..graphic_utils import Progressbar, ScreenObjectsManager, TextItem, TouchAndTextItem
from ..input import InputManager
lo... | {
"content_hash": "bc1e62754fa24f58dcb75faf61fbc84c",
"timestamp": "",
"source": "github",
"line_count": 460,
"max_line_length": 112,
"avg_line_length": 38.99130434782609,
"alnum_prop": 0.5086975914362176,
"repo_name": "kdbdallas/Mopidy-Touchclient",
"id": "ee46625eca8bedfcd685cff787a6817d51f17d79",
... |
from django.conf import settings as djsettings
from ideasbox import __version__
def settings(request):
keys = ['IDEASBOX_NAME']
return {k: getattr(djsettings, k) for k in keys}
def version(request):
return {'IDEASBOX_VERSION': __version__}
| {
"content_hash": "9c7158c40f3b0a3e70adfd6a721a7e22",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 52,
"avg_line_length": 21.416666666666668,
"alnum_prop": 0.6964980544747081,
"repo_name": "Lcaracol/ideasbox.lan",
"id": "a2e6039405bdd019fbaf3f9495ad63a28298950b",
"size":... |
import errno
import os
import platform
import select
import shutil
import stat
from Queue import Queue
from threading import Thread
def isWindows():
""" Returns True when running with the native port of Python for Windows,
False when running on any other platform (including the Cygwin port of
Python).
"""
... | {
"content_hash": "1899c7aea1fb8275afe4516c23f13f5c",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 78,
"avg_line_length": 28.42,
"alnum_prop": 0.6651419188365001,
"repo_name": "nuclearmistake/repo",
"id": "33cb2ec34baa6648df34d8b0f71e680c7463faf5",
"size": "9129",
"bi... |
import numpy.random
import random
def randint(low, high):
return numpy.random.randint(low, high+1)
def choice(seq):
if not seq:
raise IndexError
else:
x = randint(0, len(seq)-1)
return seq[x]
shuffle = numpy.random.shuffle
def seed(seed = None):
numpy.random.seed(seed)
r... | {
"content_hash": "eea7c14d1e9ca1a8591ff87d143c8229",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 44,
"avg_line_length": 19.391304347826086,
"alnum_prop": 0.6704035874439462,
"repo_name": "y4n9squared/HEtest",
"id": "7f44645bf3e53aa4aa75103625f659d26f11b9db",
"size": "1... |
"""Tests for Requests."""
from __future__ import division
import json
import os
import unittest
import pickle
import requests
import pytest
from requests.auth import HTTPDigestAuth
from requests.adapters import HTTPAdapter
from requests.compat import str, cookielib, getproxies, urljoin, urlparse
from requests.cookies... | {
"content_hash": "9edecbdd47216db992a92ddb8e4418af",
"timestamp": "",
"source": "github",
"line_count": 1005,
"max_line_length": 133,
"avg_line_length": 35.680597014925375,
"alnum_prop": 0.5662734599403219,
"repo_name": "r3tard/BartusBot",
"id": "a800ba71c40f1fcd380bcd2fe58fa54983b8781f",
"size": "... |
import tensorflow as tf
import numpy as np
import json
import pickle
from sklearn.utils import shuffle
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from tensorflow.contrib.layers import flatten
class Maxpool:
def __init__(self, size, strides):
self.size = size
sel... | {
"content_hash": "770948d8cc1282ee697abe9ce59a0e56",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 113,
"avg_line_length": 29.72573839662447,
"alnum_prop": 0.5613910574875799,
"repo_name": "ssarangi/self_driving_cars",
"id": "597f574862d2f99216ee7425b8d41df2a66b50e4",
"... |
from node.interfaces import (
ILocation,
INode,
IRoot,
ILeaf,
ICallableNode,
IAttributeAccess,
INodeAttributes,
IAttributedNode,
ILifecycleNode,
INodeCreatedEvent,
INodeAddedEvent,
INodeModifiedEvent,
INodeRemovedEvent,
INodeDetachedEvent,
IAliaser,
ICompo... | {
"content_hash": "66024ba2dad722c794f43b6e5f4df0a3",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 29,
"avg_line_length": 19.3,
"alnum_prop": 0.6968911917098446,
"repo_name": "bluedynamics/zodict",
"id": "552106f5a92aa1265d2a53ce2da728ba4590c2ac",
"size": "386",
"binar... |
"""Beam Optics functions."""
import math as _math
import numpy as _np
from mathphys import constants as _c
from mathphys import units as _u
# NOTE: This function is used in siriuspy!
def beam_rigidity(**kwargs):
"""Beam rigidity."""
# TODO: cleanup this function (and siriuspy Normalizer)
electron_rest_en... | {
"content_hash": "8dc472b0ca4e5bbb04c1a97bf6f415e9",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 72,
"avg_line_length": 34.55072463768116,
"alnum_prop": 0.5927013422818792,
"repo_name": "lnls-fac/mathphys",
"id": "a513b712d8d70486fe11769417df97f815cff5b9",
"size": "238... |
"""field_handler module tests."""
from __future__ import print_function
import os
import sys
from chromite.api import field_handler
from chromite.api.gen.chromite.api import build_api_test_pb2
from chromite.api.gen.chromiumos import common_pb2
from chromite.lib import chroot_lib
from chromite.lib import cros_test_li... | {
"content_hash": "1e635504352160ef0c8badfe567eb931",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 80,
"avg_line_length": 38.54337899543379,
"alnum_prop": 0.6890178888757256,
"repo_name": "endlessm/chromium-browser",
"id": "fd8d0973abc1e91d874ca55ab11b5ed5b8a4c703",
"si... |
"""Module to authenticate Consoles."""
| {
"content_hash": "ce27452af4d2189b81244552dbee3c1f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 38,
"avg_line_length": 39,
"alnum_prop": 0.717948717948718,
"repo_name": "xuweiliang/Codelibrary",
"id": "7cc78567cd7d468727bb033faef54935fe860b05",
"size": "678",
"binary... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: aci_epg_to_domain
short_description: Bind EPGs to Domains (f... | {
"content_hash": "141ece145b3e6fcd85e8fbe46d04e3c5",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 141,
"avg_line_length": 31.326781326781326,
"alnum_prop": 0.615686274509804,
"repo_name": "SergeyCherepanov/ansible",
"id": "24aeb883cf1615dd5da13e48c4e4c0ac0cbdd041",
"si... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: vmware_vmkernel_ip_config
short_description: Configure the VM... | {
"content_hash": "9d4c9d26f6ac83a56b653ac373f7766b",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 103,
"avg_line_length": 30.137931034482758,
"alnum_prop": 0.6375858123569794,
"repo_name": "thaim/ansible",
"id": "60046a017c0b37b78b4557d7174a3d1a5d79a792",
"size": "3691... |
import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse... | {
"content_hash": "8d04ae5b1dcb10d4a0411b6f21632477",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 171,
"avg_line_length": 45.78977272727273,
"alnum_prop": 0.6612482938329818,
"repo_name": "Azure/azure-sdk-for-python",
"id": "792b2aacd816b26cea7dc325296a3de1ec78b2e8",
"... |
from IPython.display import display, HTML
display(HTML("<style>.rendered_html {"
" font-size: 150%;"
"}</style>"))
| {
"content_hash": "77ee4063770b0bb17a8c6c65eb64070a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 41,
"avg_line_length": 29.5,
"alnum_prop": 0.6694915254237288,
"repo_name": "mlovci/tmpnb_PAG2015",
"id": "d76b948956c5e06155c4162d6b85899d813b857e",
"size": "119",
"binar... |
from django.template import VariableNode, Context
from django.template.loader import get_template_from_string
from django.utils.unittest import TestCase
from django.test.utils import override_settings
from django.utils import six
class NodelistTest(TestCase):
def test_for(self):
source = '{% for i in 1 %}... | {
"content_hash": "75338769ebf15de6db85f7e2fbcf6133",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 132,
"avg_line_length": 43.96610169491525,
"alnum_prop": 0.5824980724749421,
"repo_name": "vsajip/django",
"id": "ee76b0c39b79a749fdb084cd5c0c8c212dcf89de",
"size": "2594",... |
"""Homematic base entity."""
from abc import abstractmethod
from datetime import timedelta
import logging
from homeassistant.const import ATTR_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from .const import (
ATTR_ADDRESS,
ATTR_CHANNEL,
ATTR_INT... | {
"content_hash": "d70984cbca5d589840461d4d418c40e1",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 92,
"avg_line_length": 32.43462897526502,
"alnum_prop": 0.5886262120056651,
"repo_name": "adrienbrault/home-assistant",
"id": "50b9bcb2bfcd7858afef26bab01423373eae12fd",
"... |
import abc
from enum import Enum, IntEnum
import itertools
class Spin(IntEnum):
UP = 0
DOWN = 1
class SpinPairs(Enum):
"""The spin orbitals corresponding to a pair of spatial orbitals."""
SAME = 1
ALL = 0
DIFF = -1
class HubbardLattice(metaclass=abc.ABCMeta):
"""Base class for a Hubba... | {
"content_hash": "0811ceb7aaa8668d0d56b5b1eab4e5e0",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 80,
"avg_line_length": 35.33540372670807,
"alnum_prop": 0.5670592371242749,
"repo_name": "quantumlib/OpenFermion",
"id": "624d1e7609d560b4bb0e4bfa4f3ca29f7e6a31d1",
"size"... |
from setuptools import find_packages, setup
from version import __version__
setup(
name='opencensus-ext-jaeger',
version=__version__, # noqa
author='OpenCensus Authors',
author_email='census-developers@googlegroups.com',
classifiers=[
'Intended Audience :: Developers',
'Developmen... | {
"content_hash": "f1dce261757c2fa957c75544e8b61d91",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 126,
"avg_line_length": 36.92307692307692,
"alnum_prop": 0.6166666666666667,
"repo_name": "census-instrumentation/opencensus-python",
"id": "18b918c7baa95fb50e0a3d08ed4ac8a61... |
"""Contains train method and other training utilities for training loop."""
import functools
import os
from typing import Any, Dict, Optional, Sequence, Tuple
from absl import logging
from clu import metric_writers
from clu import periodic_actions
from flax import jax_utils
from flax.training import checkpoints
from ... | {
"content_hash": "9c4faf04c0c681cc523a70d15fdd2fcd",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 92,
"avg_line_length": 34.54926108374384,
"alnum_prop": 0.6639338418763813,
"repo_name": "google-research/language",
"id": "ba0baea5e3ff293be585edfc9d2936a0065a615b",
"siz... |
import paddle.fluid as fluid
import unittest
import numpy as np
import os
def create_reader(shape, batch_number):
def __impl__():
idx = 0
for _ in range(batch_number):
yield np.ones(shape).astype('float32') * idx,
idx += 1
return __impl__
class DataLoaderKeepOrderTes... | {
"content_hash": "a226adddd5101d81e2504bcf0d63add6",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 80,
"avg_line_length": 35.386740331491715,
"alnum_prop": 0.4955503512880562,
"repo_name": "luotao1/Paddle",
"id": "f2dd18c008082e755bec72af166c06fc991b0af1",
"size": "7016... |
""" General matlab interface code """
import os
from .base import (CommandLineInputSpec, InputMultiPath, isdefined,
CommandLine, traits, File, Directory)
from .. import config
def get_matlab_command():
if 'NIPYPE_NO_MATLAB' in os.environ:
return None
try:
matlab_cmd = os.e... | {
"content_hash": "82ce4680d428e37609ecc60122f0b731",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 151,
"avg_line_length": 40.64921465968586,
"alnum_prop": 0.5816589386913962,
"repo_name": "pearsonlab/nipype",
"id": "fe9d4457a620372f512c371dd530b193d0d27d43",
"size": "7... |
"""
snaplayer.__main__
~~~~~~~~
Main entry point
:copyright: (c) 2015 by Alejandro Ricoveri
:license: MIT, see LICENSE for more details.
"""
import sys
from docopt import DocoptExit
from snaplayer import softlayer
from snaplayer.app import handle_except, init, shutdown
def main(argv=None):
"""
This is th... | {
"content_hash": "42801fc6b69dad3210d7060dabccb2bf",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 69,
"avg_line_length": 25.046153846153846,
"alnum_prop": 0.5964373464373465,
"repo_name": "axltxl/snaplayer",
"id": "cebc73164f540083a2a927a914bd1af64d4ad86a",
"size": "165... |
import uuid
import jsonschema
from pykechain.enums import (
FormCategory,
Multiplicity,
PropertyType,
StatusCategory,
WorkflowCategory,
)
from pykechain.exceptions import (
APIError,
ForbiddenError,
IllegalArgumentError,
NotFoundError,
)
from pykechain.models.form import Form
from ... | {
"content_hash": "522f0e3c775475340f42e1e28acc5afe",
"timestamp": "",
"source": "github",
"line_count": 684,
"max_line_length": 108,
"avg_line_length": 38.36695906432749,
"alnum_prop": 0.5955492893342986,
"repo_name": "KE-works/pykechain",
"id": "d5ceb710e8fb23dd9f4888bf68d0814c12f014f5",
"size": "... |
import distutils.version as dist_version
import os
import re
from oslo.config import cfg
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.common import exceptions
from neutron.openstack.common import excutils
from neutron.openstack.common import jsonutils
from neutron.openstac... | {
"content_hash": "73a9cafc496165bdb179a0ca7b9ae64d",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 79,
"avg_line_length": 40.152136752136755,
"alnum_prop": 0.5416577972668057,
"repo_name": "sajuptpm/neutron-ipam",
"id": "89d983ab18105e783f0e0ad2e403f47cdea1b288",
"size"... |
"""Utility methods for working with WSGI servers."""
from __future__ import print_function
import errno
import os
import socket
import ssl
import sys
import time
import eventlet
import eventlet.wsgi
import greenlet
from oslo.config import cfg
from paste import deploy
import routes.middleware
import webob.dec
import ... | {
"content_hash": "a461ffa03cdc090008c4b8aeddd8bbb3",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 79,
"avg_line_length": 33.365949119373774,
"alnum_prop": 0.5762463343108505,
"repo_name": "e0ne/cinder",
"id": "81533a6bb2d597c8125c1f6e095a52a5cb0a756c",
"size": "17820",... |
"""
trinitee
"""
__version_info__ = {
'major': 0,
'minor': 1,
'micro': 0,
'releaselevel': 'trunk',
'serial': 1
}
def get_version():
"""
Return the formatted version information
"""
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
vers.append(".%(micro)i" % __version_info__... | {
"content_hash": "8de90fa3b33cbff5012bb2b7c2096a72",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 62,
"avg_line_length": 20.208333333333332,
"alnum_prop": 0.5855670103092784,
"repo_name": "chaosk/trinitee",
"id": "df178ea144f7552d3d9c4949babc32e6d282d8f8",
"size": "485"... |
import urllib2
import cherrypy
import mock
from easydict import EasyDict
from jsonpath_rw import parse
import os
from tests import base
import json
import starcluster.config
import cumulus
from cumulus.transport.files.upload import upload_path
from girder.constants import ROOT_DIR
from docutils.parsers.rst.directives... | {
"content_hash": "c7f11ba6b6ed75753dd8f6b906804633",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 80,
"avg_line_length": 38.65686274509804,
"alnum_prop": 0.5554146588891706,
"repo_name": "cjh1/cumulus",
"id": "c1e0f5f9c30ae302b30af96540e4f49f54cab94f",
"size": "4737",
... |
import core.notify.dispatcher as notify
import conf.vhosts.available.token as token
class VHost(token.VHost):
host = ['localhost']
port = '8181'
def build(self):
"""
Build the resource tree
"""
token.VHost.build(self)
# [Change the notifiers] #
root = self.... | {
"content_hash": "9c016b2141b0386ec6e4541ef67c919c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 81,
"avg_line_length": 28.526315789473685,
"alnum_prop": 0.6162361623616236,
"repo_name": "slaff/attachix",
"id": "f60e5fb8f9189a35d424ec9f0d15baff54955155",
"size": "542",... |
""" anydo.api """
from anydo.lib.bind import AnyDoAPIBinder
from anydo.lib.utils import create_uuid
from anydo.error import AnyDoAPIError
import time
class AnyDoAPI(object):
""" Base class that all AnyDo API client"""
def __init__(self, username=None, password=None):
self.api = AnyDoAPIBinder(username... | {
"content_hash": "74ce375fbc9a26597d376e99729d39c9",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 79,
"avg_line_length": 33,
"alnum_prop": 0.4616519174041298,
"repo_name": "gvkalra/python-anydo",
"id": "bfe4de4dfca75facb58e7fea2eed63a6ec01b22a",
"size": "7482",
"bina... |
from django.test import TestCase, TransactionTestCase
from django.urls import reverse
from apps.core.factories import PIXELER_PASSWORD, PixelerFactory
from .. import models
from .test_views import AsyncImportMixin, TagsTestMixin
class SubmissionProcessTestCase(TestCase):
def test_can_create_submission_process(s... | {
"content_hash": "91c3b1d7fc2fdde7112b8906aaedc05f",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 68,
"avg_line_length": 28.672,
"alnum_prop": 0.5669642857142857,
"repo_name": "Candihub/pixel",
"id": "d30f0b658f340d65fd440b9af0a78d73269666a7",
"size": "3584",
"binary... |
"""
WSGI config for tethys project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | {
"content_hash": "de578e3db98f4a63876889f8f45d4448",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.3125,
"alnum_prop": 0.7686375321336761,
"repo_name": "JosePedroMatos/Tethys",
"id": "4e99ba725799438ff87751f7eb8a149509389e72",
"size": "389",
"... |
'''
New Simulator Test for VPC SNAT
@author: Hengguo Ge
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.vpc_operations as vpc_ops
import os
test_stub = test_lib.lib_get_test_stub()
tes... | {
"content_hash": "73ecc3409ef0fb5ca6a2e2b8b56a61c9",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 108,
"avg_line_length": 36.625,
"alnum_prop": 0.7079473427596294,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "fd0a42e534a6dd09a88e0c43aab3dac314def57a",
"size": "205... |
r"""Public API for parsing, inspecting and modifying test data.
Exposed API
-----------
The publicly exposed parsing entry points are the following:
* :func:`~.lexer.lexer.get_tokens`,
:func:`~.lexer.lexer.get_resource_tokens`, and
:func:`~.lexer.lexer.get_init_tokens`
functions for `parsing data to tokens`_.
... | {
"content_hash": "9433c9175099670d56f45ac93c6063a7",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 85,
"avg_line_length": 37.64259259259259,
"alnum_prop": 0.7045801151178236,
"repo_name": "robotframework/robotframework",
"id": "c4ca3b387d0c647709c488c6d7dd0d475972c67b",
... |
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from django.template import loader
from django.http import Http404
from django.urls import reverse
from .models import Choice, Question
# Create your views here.
def index(request):
latest_question_list... | {
"content_hash": "ddb5f7f264bb9b46548ba4aeeef4b16d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 82,
"avg_line_length": 39.4,
"alnum_prop": 0.7055837563451777,
"repo_name": "mbayon/TFG-MachineLearning",
"id": "e297584f04964cc7afa0a2ecb0c4958ef3f71458",
"size": "1576",
... |
import os
import sys
import subprocess
import tempfile
from time import sleep
from os.path import exists, join, abspath
from shutil import rmtree
from tempfile import mkdtemp
import six
from twisted.trial import unittest
from twisted.internet import defer
from scrapy.utils.python import to_native_str
from scrapy.util... | {
"content_hash": "f6c941e066a1eb1048aaf7e0ef4480d5",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 95,
"avg_line_length": 34.40856031128405,
"alnum_prop": 0.5964039353160692,
"repo_name": "pombredanne/scrapy",
"id": "e0c0648caac3a1d838cca5fbf0a0132ea84108bd",
"size": "8... |
"""
Preliminary module to handle fortran formats for IO. Does not use this outside
scipy.sparse io for now, until the API is deemed reasonable.
The *Format classes handle conversion between fortran and python format, and
FortranFormatParser can create *Format instances from raw fortran format
strings (e.g. '(3I4)', '(... | {
"content_hash": "32c156ac52dffe61bf98534cc37ff34d",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 83,
"avg_line_length": 28.738853503184714,
"alnum_prop": 0.5237145390070922,
"repo_name": "teoliphant/scipy",
"id": "4cb129a271d587e0fd20be11d78e6f7715a6db6c",
"size": "90... |
from django.core.urlresolvers import reverse
from django.test import TestCase
from pinax.apps.tribes.models import Tribe
class TribesTest(TestCase):
fixtures = ["tribes_auth.json"]
urls = "pinax.apps.tribes.tests.tribes_urls"
def test_unauth_create_get(self):
"""
can an unauth'd user ... | {
"content_hash": "93aeb7fafa7061e1cd48b68cb35b0042",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 116,
"avg_line_length": 39.34285714285714,
"alnum_prop": 0.6042120551924474,
"repo_name": "kevinr/750book-web",
"id": "c499875d3831af074bc08398ddc455c176540f1b",
"size": "2... |
import yaml
import json
with open('my_list.yml') as f:
yaml_list = yaml.load(f)
print yaml_list
with open('my_list.json') as f:
json_list = json.load(f)
print json_list
| {
"content_hash": "2feca09af889698720004a601447ea8e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 31,
"avg_line_length": 13.142857142857142,
"alnum_prop": 0.657608695652174,
"repo_name": "jmerrell93/pynet_work",
"id": "642c365ee61116e363aa32fba6f61262dba056b9",
"size": ... |
from django.forms import forms
from django.shortcuts import render
from gmapi import maps
from gmapi.forms.widgets import GoogleMap
from vikalp.service.article_service import ArticleService
articleService = ArticleService()
class MapForm(forms.Form):
map = forms.Field(widget=GoogleMap(attrs={'width': 500, 'heig... | {
"content_hash": "143cdc9dd1009bd523829b3f2253ee55",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 95,
"avg_line_length": 30.761904761904763,
"alnum_prop": 0.6455108359133127,
"repo_name": "vikalpindia/vikalp",
"id": "0da15100be59280ef653abfb7938742cec847287",
"size": "... |
def new(num_brackets=256):
"""Initialises a Map with the given number of buckets."""
aMap = []
for i in range(0, num_brackets):
aMap.append([])
return aMap
def hash_key(aMap, key):
"""Given a key this will create a number and then convert it to an index for the aMap's buckets."""
return hash(key) % len(aMap)
... | {
"content_hash": "58f2d6c9814ad08d4a54279f83d30e14",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 100,
"avg_line_length": 24.6984126984127,
"alnum_prop": 0.6503856041131105,
"repo_name": "peterhogan/python",
"id": "2e7f84ae561564ed1d6308da8571c31dfd20434b",
"size": "155... |
from django import template
from django.template import resolve_variable
register = template.Library()
@register.tag(name="home_link")
def do_home_link(parser, token):
"""Provides a back button link to the home panel.
"""
tokens = token.split_contents()
print tokens
if len(tokens) == 1:
hre... | {
"content_hash": "56922a731db1d4f32f1e4cdf6048f455",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 160,
"avg_line_length": 34.61009174311926,
"alnum_prop": 0.570311464546057,
"repo_name": "underbluewaters/marinemap",
"id": "bfa336257ae830852dc42eeeb5dc975c67e61aef",
"si... |
import tensorflow as tf
import numpy as np
import pposgd_mpi.common.tf_util as U
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn
class Pd(object):
"""
A particular probability distribution
"""
def flatparam(self):
raise NotImplementedError
def mode(self):
... | {
"content_hash": "5a08eb65e2706482f13bd24f18fc0647",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 199,
"avg_line_length": 36.76470588235294,
"alnum_prop": 0.6270117647058824,
"repo_name": "machine-intelligence/rl-teacher-atari",
"id": "752016ebee247f6abc8295b6ffb8fa602f9... |
"""
Depends plugin
/// Experimental: Not working yet.
"""
from hyde.plugin import Plugin
class DependsPlugin(Plugin):
"""
The plugin class setting explicit dependencies.
"""
def __init__(self, site):
super(DependsPlugin, self).__init__(site)
def begin_site(self):
"""
I... | {
"content_hash": "79e00b8177e4a7476f86c02663b7774f",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 97,
"avg_line_length": 30.084745762711865,
"alnum_prop": 0.5791549295774648,
"repo_name": "JeNeSuisPasDave/hyde",
"id": "304d4036a2d8633d2aaaa40a95c11fad19bc721b",
"size": ... |
import types, sys, re
from itertools import izip, count
from types import NoneType
from compiler import ast
from decimal import Decimal
from datetime import date, datetime
from cPickle import loads, dumps
from copy import deepcopy
from functools import update_wrapper
from pony import options
from pony.utils import avg... | {
"content_hash": "3ae0914e1bb0ed05a5fb3de23745a6ff",
"timestamp": "",
"source": "github",
"line_count": 2250,
"max_line_length": 135,
"avg_line_length": 47.864444444444445,
"alnum_prop": 0.5972050698732532,
"repo_name": "buddyli/private2w",
"id": "f7e83b0de6372e59541abfe8ed446aa4e7ead866",
"size": ... |
from hwt.doc_markers import internal
from hwt.hdl.types.hdlType import HdlType
from hwt.serializer.generic.indent import getIndent
from pyMathBitPrecise.bits3t import Bits3t
BITS_DEFAUTL_SIGNED = None
BITS_DEFAUTL_FORCEVECTOR = False
BITS_DEFAUTL_NEGATED = False
class Bits(HdlType, Bits3t):
"""
Elemental HDL... | {
"content_hash": "6b883c70ef5e37f30adc588397cda005",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 78,
"avg_line_length": 31.339805825242717,
"alnum_prop": 0.572180916976456,
"repo_name": "Nic30/HWToolkit",
"id": "5752f14f52e96dcafa1654739fc24d722700a795",
"size": "3228... |
from google.appengine.ext import db
class Blog(db.Model): #google datastore entity
subject = db.StringProperty(required = True)
content = db.TextProperty(required =True)
created = db.DateTimeProperty(auto_now_add = True)
class User(db.Model):
username = db.StringProperty(required = True)
passw... | {
"content_hash": "21b1c740244903b2f3f56c3918043fc6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 33.785714285714285,
"alnum_prop": 0.7272727272727273,
"repo_name": "beichu/blog",
"id": "07a3784ed171c2dd0ad1d2911d6cc2df02a00ba7",
"size": "473",
... |
from __future__ import unicode_literals
from django.contrib.sitemaps import Sitemap
from allink_apps.blog.models import Blog
class BlogSitemap(Sitemap):
changefreq = "never"
priority = 0.5
i18n = True
def __init__(self, *args, **kwargs):
self.namespace = kwargs.pop('namespace', None)
... | {
"content_hash": "64adcc8884722ab219005e901c71792c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 58,
"avg_line_length": 24.4,
"alnum_prop": 0.6516393442622951,
"repo_name": "allink/allink-apps",
"id": "997e1bbd86cd7c8deb910f00baf32cfac4fce2c5",
"size": "513",
"binary... |
from otto.lib.otypes import ResultType
class Test(object):
"""
A Base Class for tests
The return types are specified so that we can detect if the child's
signature doesn't match the parents
"""
def __init__(self, config):
self.testformat = 1
self.config = config
def setup... | {
"content_hash": "ef54c4f0c3be5604b2b629b43c1ad9e5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 72,
"avg_line_length": 25.714285714285715,
"alnum_prop": 0.6407407407407407,
"repo_name": "mennis/oTTo",
"id": "8f14108ab7dd86bd002af09203bfcb481a2b38a8",
"size": "540",
... |
"""Defines the PYPOWER case file format.
A PYPOWER case file is a Python file or MAT-file that defines or returns
a dict named ppc, referred to as a "PYPOWER case dict". The keys
of this dict are C{baseMVA}, C{bus}, C{gen}, C{branch}, and (optional)
C{gencost}. With the exception of C{baseMVA}, a scalar, each data var... | {
"content_hash": "f56d24475bc9e8250b03826e92ad8196",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 78,
"avg_line_length": 44.102739726027394,
"alnum_prop": 0.66438888026091,
"repo_name": "praba230890/PYPOWER",
"id": "d589c0120313cd9d6e868bca54bc84bf26147e9b",
"size": "6... |
import getpass
from unittest.mock import call
import pytest
from scripts.pa_get_scheduled_tasks_list import main
from pythonanywhere.task import Task
@pytest.fixture
def task_list(mocker):
username = getpass.getuser()
specs1 = {
"can_enable": False,
"command": "echo foo",
"enabled": ... | {
"content_hash": "39460b95ce4d9f04db0279cbc50a9a66",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 98,
"avg_line_length": 36.403225806451616,
"alnum_prop": 0.6313690739920248,
"repo_name": "pythonanywhere/helper_scripts",
"id": "402afd21060a28370e290778d83d029924728baa",
... |
"""
Hermit player(http://mufeng.me/hermit-for-wordpress.html) plugin for niu-x2-sidebar theme.
This plugin replaces [hermit xiami=collect:12345678 loop auto nolist] with the hermit player html structure.
"""
import pelican
import logging
import os
logger = logging.getLogger(__name__)
_hermit_begin_code = u'[hermit'
... | {
"content_hash": "d557ae4c070a3b8ebc7286cb6866aaf3",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 166,
"avg_line_length": 36.284615384615385,
"alnum_prop": 0.5984736061055755,
"repo_name": "sdphome/blog-content",
"id": "1f14e065d9005243f1a3bf0009e06e7f3a24392b",
"size"... |
from zoo.serving.client import InputQueue, OutputQueue
import time
def run():
input_api = InputQueue()
output_api = OutputQueue()
output_api.dequeue()
import numpy as np
a = np.array([1, 2])
input_api.enqueue('a', p=a)
time.sleep(5)
print(output_api.query('a'))
if __name__ == "__main... | {
"content_hash": "433974db4a41ebd4abbdc22efc1fda80",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 19.705882352941178,
"alnum_prop": 0.6059701492537314,
"repo_name": "intel-analytics/analytics-zoo",
"id": "9c155be58ae40372837aeaecbaf42d69458e47b1",
... |
"""
relshell.batch_to_from_file
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis: Provides abstract BatchToFromFile class
"""
from abc import ABCMeta, abstractmethod
from os import remove
from tempfile import mkstemp
class BatchToFromFile(object):
"""(Abstract) batch <=> process (input|output) translator"""
... | {
"content_hash": "0208b464c31465bc4b9b6439224bebf5",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 123,
"avg_line_length": 26.525,
"alnum_prop": 0.5815268614514609,
"repo_name": "laysakura/relshell",
"id": "3f9d5d8c593a09a53051801b410a107f84ebcfca",
"size": "1085",
"bi... |
import unittest
from unittest import mock
from cupy import cuda
from cupy import prof
@unittest.skipUnless(cuda.nvtx.available, 'nvtx is required for time_range')
class TestTimeRange(unittest.TestCase):
def test_time_range(self):
push_patch = mock.patch('cupy.cuda.nvtx.RangePush')
pop_patch = mo... | {
"content_hash": "82a612766d537c8372817f2b49cb4ec6",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 76,
"avg_line_length": 35.724489795918366,
"alnum_prop": 0.5815481291059698,
"repo_name": "cupy/cupy",
"id": "2d3799e74e0a34b10a1368b0f1fae48766a78051",
"size": "3501",
"... |
from django.db import models
# Create your models here.
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.conf import settings
from userena import settings as userena_settings
from easy_thumbnails.fields import ThumbnailerImageField
from userena.models impo... | {
"content_hash": "9d552fbab371d22b4ef3ad77f4b73588",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 96,
"avg_line_length": 37.67613636363637,
"alnum_prop": 0.5667320162871362,
"repo_name": "shafiquejamal/socialassistanceregistry",
"id": "52c2f693cb692c6511a9a1f9046eb4166ab... |
from pygame.rect import Rect
class floating(object):
def __init__(self, startx, starty, label):
self.label = label
self.x = startx
self.y = starty
self.width = label.width
self.height = label.height
self.surface = label.surface.copy()
... | {
"content_hash": "b8e76b06ad2e1d55ecd7c5fad391cef6",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 28.46551724137931,
"alnum_prop": 0.5572380375529982,
"repo_name": "sparkslabs/kamaelia",
"id": "c3680bd1008390e8424cbb5b29c8584174b96ed7",
"size": "2... |
from threading import RLock
from typing import Optional
from reactivex import abc
class SerialDisposable(abc.DisposableBase):
"""Represents a disposable resource whose underlying disposable
resource can be replaced by another disposable resource, causing
automatic disposal of the previous underlying disp... | {
"content_hash": "368584fe6a6115894d89bca11baea65d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 72,
"avg_line_length": 30.086206896551722,
"alnum_prop": 0.6269340974212034,
"repo_name": "ReactiveX/RxPY",
"id": "bb51121df49870233a92844aa4d524a0cf0bfb81",
"size": "1745"... |
METRIC_MAP = {
"gitea_accesses": "accesses",
"gitea_actions": "actions",
"gitea_attachments": "attachments",
"gitea_comments": "comments",
"gitea_follows": "follows",
"gitea_hooktasks": "hooktasks",
"gitea_issues": "issues",
"gitea_issues_closed": "issues.closed",
"gitea_issues_open"... | {
"content_hash": "6de7e897afe30f74561dfc9a46aa73b1",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 86,
"avg_line_length": 39.925,
"alnum_prop": 0.6537257357545397,
"repo_name": "DataDog/integrations-extras",
"id": "7dc91e559e194d76461e2b538c83b39be26eed17",
"size": "1597... |
import setuptools
with open('README.rst', 'r') as file_pointer:
long_description = file_pointer.read()
with open('cas_client/_version.py', 'r') as file_pointer:
exec(file_pointer.read())
setuptools.setup(
author='Josiah Wolf Oberholtzer',
author_email='joberholtzer@discogsinc.com',
classifiers=... | {
"content_hash": "5c6783b0f6ac68aae6003a378fc7c45f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 27.46,
"alnum_prop": 0.5753823743627094,
"repo_name": "discogs/python-cas-client",
"id": "6a0cc6c88070c276df0d125ebff044d90d7e8c98",
"size": "1395",
... |
import unittest
import sys
import os
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import base_test
class RefreshPageTest(base_test.WebDriverBaseTest):
# Get a static page that must be the same upon refresh
def test_refreshPage(self):
self.dri... | {
"content_hash": "b68929b2c2c73333d326a74a85771c80",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 90,
"avg_line_length": 36.785714285714285,
"alnum_prop": 0.6728155339805825,
"repo_name": "yugang/crosswalk-test-suite",
"id": "560a9d9f342afd46cd5a5a734dfcd1a787718fa2",
"... |
"""Script to run run_train.py locally.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
from subprocess import call
import sys
CONFIGS_PATH = './configs'
CONTEXT_CONFIGS_PATH = './context/configs'
def main():
bb = '.'
base_nu... | {
"content_hash": "01554216731393f11db95ec8f164c882",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 87,
"avg_line_length": 35.950819672131146,
"alnum_prop": 0.5294117647058824,
"repo_name": "derekjchow/models",
"id": "718c88e8fedd381707ac944f5ee9243b636ac915",
"size": "28... |
'''
Created on 31.10.2011
@author: michi
'''
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtGui import QGraphicsEllipseItem, QPen, QBrush
from geotiledmapobjectinfo import GeoTiledMapObjectInfo ##@UnresolvedImport
class GeoTiledMapCircleObjectInfo(GeoTiledMapObjectInfo):
circle = None
'@type circle: GeoMapCi... | {
"content_hash": "2a1e7984713f20c226811696693cdacd",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 75,
"avg_line_length": 27.82608695652174,
"alnum_prop": 0.6192708333333333,
"repo_name": "mtils/ems",
"id": "74cceacd3dcdb7a3d7fb9b51fd35ef50accccd98",
"size": "1920",
"b... |
import json
import re
from functools import reduce
from math import gcd
LETTERS_REGEXPS = {
'en': re.compile('^[a-zA-Z]+$'),
'ru': re.compile('^[а-яА-Я]+$')
}
with open('frequencies.json') as data_file:
frequencies = json.load(data_file)
class WithLanguage:
def __init__(self, lang):
freq = f... | {
"content_hash": "b51a4569d8fbdac0a6a3b29f235536cc",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 109,
"avg_line_length": 26.5,
"alnum_prop": 0.638228055783429,
"repo_name": "Drapegnik/bsu",
"id": "a7b020dea17ee73ace29196274477b9c07f14718",
"size": "1271",
"binary": f... |
import unittest
from atod import Hero, Heroes
class TestHeroes(unittest.TestCase):
def setUp(self):
self.all_heroes = Heroes.all()
def test_init_with_ids(self):
''' I'm not sure how to test classes like this.
So, what tests are doing is basically: call method with some arguments,
... | {
"content_hash": "484807452c25ffdbcaf6a9f5bea4778d",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 84,
"avg_line_length": 29.795180722891565,
"alnum_prop": 0.5936109987868985,
"repo_name": "gasabr/AtoD",
"id": "c3b619a782374681733b0726534cad5f2f0afd53",
"size": "2496",
... |
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from bootcamp.notifications.models import Notification, notification_handler
... | {
"content_hash": "4ab679aa527eb8df14040b7b2da8356b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 86,
"avg_line_length": 37.11290322580645,
"alnum_prop": 0.6849196001738375,
"repo_name": "vitorfs/bootcamp",
"id": "42556bf1788a536d2a18c234a12c856b6ff8af97",
"size": "2301... |
import functools
import mmcv
import torch
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
... | {
"content_hash": "f432ab84a6602112767a1f318b0d463c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 31.365384615384617,
"alnum_prop": 0.6128142244022072,
"repo_name": "open-mmlab/mmdetection",
"id": "778237ebfd57160a3533d6d82b3d8fd7a36bf481",
"size... |
from nova.network import model as network_model
from nova import test
from nova.tests.unit import fake_network
from nova.virt import netutils
class TestNetUtilsTestCase(test.NoDBTestCase):
def setUp(self):
super(TestNetUtilsTestCase, self).setUp()
def test_get_cached_vifs_with_vlan_no_nw_info(self):
... | {
"content_hash": "653b21b97508947b2ca35fdeb7a228fa",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 78,
"avg_line_length": 45.09375,
"alnum_prop": 0.6632016632016632,
"repo_name": "Juniper/nova",
"id": "6f5bb6f51f29a8e7fc51adcbf9d138a400885a44",
"size": "2016",
"binary"... |
from flask import Flask
app = Flask(__name__)
import flickrapi
api_key = '1bb68d78110e40cee89a92ef52faddaa'
flickr = flickrapi.FlickrAPI(api_key, format='etree')
from app import controllers | {
"content_hash": "27c0125e0a2a5662afc7243856338ae8",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 53,
"avg_line_length": 31.5,
"alnum_prop": 0.7936507936507936,
"repo_name": "rishubil/tonic",
"id": "baf6002e07bf180a81d7a9d5ef1e8fdb723ac062",
"size": "189",
"binary": fa... |
import json
import os
import tarfile
from collections import defaultdict
# Project Imports
from xpkg import build
from xpkg import linux
from xpkg import util
from xpkg import paths
xpkg_root_var = 'XPKG_ROOT'
xpkg_tree_var = 'XPKG_TREE'
xpkg_repo_var = 'XPKG_REPO'
xpkg_local_cache_var = 'XPKG_LOCAL_CACHE'
def par... | {
"content_hash": "720cde51cfcc43bca153cc674cea73ee",
"timestamp": "",
"source": "github",
"line_count": 1500,
"max_line_length": 91,
"avg_line_length": 30.314,
"alnum_prop": 0.5477777044709815,
"repo_name": "jlisee/xpkg",
"id": "989cd22cc4643d8442ea26c9bf3edfd4f9a79a44",
"size": "45531",
"binary"... |
from __future__ import print_function
__author__ = 'John Sirois'
import hashlib
import getpass
import os
import pkgutil
import shutil
import subprocess
from collections import defaultdict
from twitter.common.collections import OrderedDict, OrderedSet
from twitter.common.config import Properties
from twitter.common.... | {
"content_hash": "3ae266197bd82f3693d3a07bf86076eb",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 100,
"avg_line_length": 37.84313725490196,
"alnum_prop": 0.6146273415703467,
"repo_name": "foursquare/commons-old",
"id": "6459359d430cfd7c6beb907a9db683b8f325cc20",
"size... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import pandas as pd
import numpy as np
import re
import pickle
from tensorflow.python.keras.preprocessing import sequence
from tensorflow.python.keras.preprocessing import text
from ten... | {
"content_hash": "02a4b0fb08153b51158b86f06a9d546b",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 111,
"avg_line_length": 39.473333333333336,
"alnum_prop": 0.6632325620672184,
"repo_name": "GoogleCloudPlatform/training-data-analyst",
"id": "cb75f56373f23c2b72fec8e4e3255e... |
__version__ = '0.5.1'
default_app_config = 'behaviors.apps.BehaviorsConfig'
| {
"content_hash": "fdcfa2da15dde0a5e20465d75798f9aa",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 53,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.7012987012987013,
"repo_name": "audiolion/django-behaviors",
"id": "366883311d4733b6a96503c42687c120c1e10303",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.