text stringlengths 4 1.02M | meta dict |
|---|---|
import json
from .._abstract.abstract import BaseAGOLClass, BaseSecurityHandler
from ..security import security
import collections
########################################################################
class Services(BaseAGOLClass):
"""
The administration resource is the root node and initial entry point
... | {
"content_hash": "b98762d8b62aaa5b53d6564764ce59d4",
"timestamp": "",
"source": "github",
"line_count": 1904,
"max_line_length": 154,
"avg_line_length": 39.14915966386555,
"alnum_prop": 0.46377783740273676,
"repo_name": "DShokes/ArcREST",
"id": "8ed24f48568d3fd9772c0a932cda19b2062be8c6",
"size": "7... |
""" Set of classes and methods specific to Philips scanning environments
"""
from __future__ import print_function
from __future__ import division
import os
from os.path import join
import sys
import time
import re
import fnmatch
import glob
import json
import logging
from threading import Thread
from queue import Qu... | {
"content_hash": "0f7a23933586d1ee4f89db5e90fc4fcc",
"timestamp": "",
"source": "github",
"line_count": 734,
"max_line_length": 125,
"avg_line_length": 37.98228882833787,
"alnum_prop": 0.6087736288963018,
"repo_name": "jeffmacinnes/pyneal",
"id": "a70ba415577f025bc8e86647e96375747a6f5248",
"size": ... |
from ncclient.operations.third_party.juniper.rpc import *
import json
import unittest
from mock import patch
from ncclient import manager
import ncclient.manager
import ncclient.transport
from ncclient.xml_ import *
from ncclient.operations import RaiseMode
from xml.etree import ElementTree
class TestRPC(unittest.Tes... | {
"content_hash": "a4f884b254e029377593fcdfb550f9b4",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 85,
"avg_line_length": 48.7906976744186,
"alnum_prop": 0.6545916746107404,
"repo_name": "GIC-de/ncclient",
"id": "03e6acede086efbf15e2881f0d207e608708437b",
"size": "12588... |
"""
Multi-class / multi-label utility function
==========================================
"""
from collections.abc import Sequence
from itertools import chain
import warnings
from scipy.sparse import issparse
from scipy.sparse import dok_matrix
from scipy.sparse import lil_matrix
import numpy as np
from .validation... | {
"content_hash": "ecb43e6b6073966c56dd62f25ca2d054",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 88,
"avg_line_length": 33.40286298568507,
"alnum_prop": 0.5817313579037591,
"repo_name": "sergeyf/scikit-learn",
"id": "4e5981042f2777c50026bc96e91999fa1bc0729e",
"size": ... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration... | {
"content_hash": "78f76ca72583cd013c42c028a46bf4db",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 80,
"avg_line_length": 31.49767441860465,
"alnum_prop": 0.7058476077968104,
"repo_name": "openpolis/rst2pdf-patched-docutils-0.8",
"id": "53f01159efc80f8b19725f9245af842d92e... |
from src.utility import HMCClientLogger,HTTPClient,HmcHeaders
from src.generated_src import UOM
import xml.etree.ElementTree as etree
log = HMCClientLogger.HMCClientLogger(__name__)
ROOT = "LogicalPartition"
CONTENT_TYPE = "application/vnd.ibm.powervm.uom+xml;type=SRIOVEthernetLogicalPort"
SCHEMA_VER = "V1_3_0"
ADAPTE... | {
"content_hash": "8f3f8f0c1a25ba12b8e11f68e64c83de",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 99,
"avg_line_length": 42.266666666666666,
"alnum_prop": 0.6703470031545742,
"repo_name": "PowerHMC/HmcRestClient",
"id": "d046d16d2d352664957513ef5c5f0e1306e1c8f8",
"size"... |
import re
from pip import __version__
from pip.commands.show import search_packages_info
def test_show(script):
"""
Test end to end test for show command.
"""
result = script.pip('show', 'pip')
lines = result.stdout.split('\n')
assert len(lines) == 6
assert lines[0] == '---', lines[0]
... | {
"content_hash": "eaa9a93ff3f0357a3d8cd01229bd4674",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 76,
"avg_line_length": 27.696202531645568,
"alnum_prop": 0.606489945155393,
"repo_name": "minrk/pip",
"id": "cf68e0404faa306bbd3e0a9166ea1109b89d249d",
"size": "2188",
"b... |
import numpy as np
import math
from libcore import Img
from libcore import RestructuringMethod
def main():
img = Img.load_image('../gletscher.jpg')
# 45 Grad
rotation_matrix = Img.get_2d_rotation_matrix(np.radians(45))
translation_vector = np.array([50, 600])
RestructuringMethod.affine_transfor... | {
"content_hash": "d0afd4b2af16f49eccb97b46a550d060",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 64,
"avg_line_length": 21.043478260869566,
"alnum_prop": 0.5764462809917356,
"repo_name": "StefanoD/ComputerVision",
"id": "8a61a9f2810498ff3dcfe2f21d96662145ee8a7b",
"size... |
from django.http import HttpResponse
from vodkamartiniqa.views.helpers import get_answers
from vodkamartiniqa.views.helpers import get_questions
import json
#from django.core.serializers.json import DjangoJSONEncoder
# TODO get answers via ajax with start and end
def get_answers_ajax(request, question_id, start=0, end... | {
"content_hash": "9801b405749037740c3f3ff722c0bddb",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 97,
"avg_line_length": 48,
"alnum_prop": 0.5969551282051282,
"repo_name": "alexisbellido/django-vodkamartini-qa",
"id": "a26bfe2236101ab242d44880d2f367ae452e9f10",
"size": ... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test_db.sqlite'
}
}
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contri... | {
"content_hash": "2e7c471d475232b909ee9101a2077193",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 67,
"avg_line_length": 27.253521126760564,
"alnum_prop": 0.7250645994832041,
"repo_name": "dominicrodger/millionmilestogether",
"id": "ae91c48b80461f6d1aefb2d9b2a7f69282a947d... |
"""Redirect middleware for Django CMS."""
from urlparse import urlparse
from cms_redirects.models import CMSRedirect
from django import http
from django.conf import settings
class RedirectMiddleware(object):
"""Middleware for handling redirects."""
def get_possible_paths(self, parsed_path):
"""Get a ... | {
"content_hash": "b495fab25f686d6023775de78f40a580",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 34.55421686746988,
"alnum_prop": 0.606694560669456,
"repo_name": "hzlf/django-cms-redirects",
"id": "5a23cc4946d8358e133fdd8332871acc2b22e3ac",
"size... |
import logging
import os
import platform
import requests
import socket
import fcntl
import struct
logger = logging.getLogger(__name__)
def address_by_route():
logger.debug("Finding address by querying local routing table")
addr = os.popen("/sbin/ip route get 8.8.8.8 | awk '{print $NF;exit}'").read().strip()
... | {
"content_hash": "dfbd8d8ec8ef5593108b981dc2294d68",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 143,
"avg_line_length": 28.770833333333332,
"alnum_prop": 0.6734250543084721,
"repo_name": "swift-lang/swift-e-lab",
"id": "8caa00b1f51733bdc256a090cef49f1bceb3f0fe",
"size... |
"""Miscellaneous utility functions for use with Swift."""
from __future__ import print_function
import errno
import fcntl
import grp
import hmac
import json
import operator
import os
import pwd
import re
import sys
import time
import uuid
import functools
import email.parser
from hashlib import md5, sha1
from random ... | {
"content_hash": "3089f2bffd6759e969a29bdfdc79f01e",
"timestamp": "",
"source": "github",
"line_count": 3711,
"max_line_length": 79,
"avg_line_length": 34.65642683912692,
"alnum_prop": 0.5988492341186533,
"repo_name": "thiagodasilva/swift",
"id": "d6cc5d7afb4700ff218e30ff5845c33f7cb8c387",
"size": ... |
"""Canonicalizes for loops into while loops.
This canonicalizer uses the len function on its argument. That should be
converted to a tf.shape separately.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.py2tf.pyct import anno
fro... | {
"content_hash": "05bb3573b07eea21b128083714d5fda8",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 72,
"avg_line_length": 30.76923076923077,
"alnum_prop": 0.62625,
"repo_name": "Xeralux/tensorflow",
"id": "4297c1cf2a3632e097973280cc985fc48da64475",
"size": "3089",
"bin... |
"""Calculates mold growth indication from temperature and humidity."""
import logging
import math
import voluptuous as vol
from homeassistant import util
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
EVENT_HOMEASSISTANT_S... | {
"content_hash": "e9795df02cdf12cfe16d7e05d7e98704",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 86,
"avg_line_length": 31.591022443890274,
"alnum_prop": 0.5558888538048626,
"repo_name": "turbokongen/home-assistant",
"id": "e2d9909c7ca1d47c104e74d513e89684108b401b",
"... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
ex... | {
"content_hash": "0b7afd2018ba92f53fda525bc6b18331",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 132,
"avg_line_length": 48.01960784313726,
"alnum_prop": 0.735810534912209,
"repo_name": "linz/QGIS-AIMS-Plugin",
"id": "4b83db545fea9cede0b7bf4c5c58c7b2ce6295f4",
"size": ... |
import logging
from six.moves.urllib import parse as urlparse
import testtools
from tempest.api.compute import base
from tempest.common import compute
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
from tempest.common import waiters
from tempest import config
from tem... | {
"content_hash": "5f0d39a4518e1d2c3443da3f6d55af14",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 79,
"avg_line_length": 46.4954128440367,
"alnum_prop": 0.6098263614838201,
"repo_name": "sebrandon1/tempest",
"id": "9077801ea9b2f6aca80feeae21a6f076972716a1",
"size": "25... |
"""Volume-related Utilities and helpers."""
import ast
import math
import re
import time
import uuid
from Crypto.Random import random
import eventlet
from eventlet import tpool
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import strutils
fr... | {
"content_hash": "f1610d0deac46e9f2617ad48d25823b8",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 79,
"avg_line_length": 34.08764367816092,
"alnum_prop": 0.6003793466807166,
"repo_name": "bswartz/cinder",
"id": "53fd2bdb7cb2b72ee66cecea1ee4cffd9aaaebf4",
"size": "24342... |
import traceback
class ObjectImportError(Exception):
pass
def import_items(import_directives):
"""
Import the items in import_directives and return a list of the imported items
Each item in import_directives should be one of the following forms
* a tuple like ('module.submodule', ('classnam... | {
"content_hash": "c9549865da0c0a6d30b122ee8898ad0e",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 146,
"avg_line_length": 40.45569620253165,
"alnum_prop": 0.5622653316645807,
"repo_name": "bop/bauhaus",
"id": "a10cdd50a8fb82d06ef604706492d812fc8b7012",
"size": "6392",
... |
import copy
import json
from oslo_log import log as logging
from testtools import matchers
from heat_integrationtests.common import test
from heat_integrationtests.functional import functional_base
LOG = logging.getLogger(__name__)
class AutoscalingGroupTest(functional_base.FunctionalTestsBase):
template = '... | {
"content_hash": "4f2c90e285110f94fe15fe36eed91ac7",
"timestamp": "",
"source": "github",
"line_count": 733,
"max_line_length": 79,
"avg_line_length": 41.99317871759891,
"alnum_prop": 0.5652837789545498,
"repo_name": "srznew/heat",
"id": "1b9fe991ba2e7e0d7c6085f41a358ed05f8601b8",
"size": "31354",
... |
from oslo_log import log as logging
from oslo_utils import excutils
from cinder import context
from cinder import exception
from cinder.i18n import _, _LI
from cinder.volume.drivers.huawei import constants
from cinder.volume import qos_specs
LOG = logging.getLogger(__name__)
class SmartQos(object):
def __init__... | {
"content_hash": "cc8d11d821ef209489e5d182e1ac8c0b",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 79,
"avg_line_length": 37.096330275229356,
"alnum_prop": 0.531222950414245,
"repo_name": "Hybrid-Cloud/cinder",
"id": "2569e57073efe9e98d0645326865fb6d96109e09",
"size": "... |
import django
class APIConfig(django.apps.AppConfig):
"""
This is the app configuration of the modelmanager.plugins.browser app.
"""
name = 'modelmanager.plugins.browser.api'
verbose_name = 'API'
label = 'api'
| {
"content_hash": "e8321cc15fb4938515ce41f37198dbee",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 74,
"avg_line_length": 23.6,
"alnum_prop": 0.673728813559322,
"repo_name": "mwort/modelmanager",
"id": "e0bafbeb7648bc9537e68a6024147d1652202d60",
"size": "236",
"binary"... |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^api/v1/', include([
url(r'^pastes/$', views.api_paste_list, name='api_paste_list'),
url(r'^pastes/([a-zA-Z0-9]+)/$', views.api_paste_detail, name='api_paste_detail'),
url(r'^star/$', views.api_star_create... | {
"content_hash": "23c0baf8ee49acd748ac039da78403c9",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 90,
"avg_line_length": 42.77777777777778,
"alnum_prop": 0.593939393939394,
"repo_name": "davidwtbuxton/captain-pasty",
"id": "efc0c2a07ec7d912999331c048f7408d5fb58a43",
"si... |
"""
BarMap.py -- cotranscriptional folding using *barriers* and *treekin*
"""
import logging
import os
import re
import sys
import argparse
import numpy as np
import subprocess as s
import collections as c
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import ribolands as ri... | {
"content_hash": "fc8928651b3b110d51d1ceaacc97f48f",
"timestamp": "",
"source": "github",
"line_count": 724,
"max_line_length": 99,
"avg_line_length": 33.680939226519335,
"alnum_prop": 0.507033012097601,
"repo_name": "bad-ants-fleet/ribolands",
"id": "694bd2427fc076d723a1e09f403c3d9ff58a9d60",
"siz... |
from .. import tutils, mastertest
from mitmproxy.builtins import stickycookie
from mitmproxy.flow import master
from mitmproxy.flow import state
from mitmproxy import options
from netlib import tutils as ntutils
def test_domain_match():
assert stickycookie.domain_match("www.google.com", ".google.com")
assert ... | {
"content_hash": "02ed60bfb9642b375d650f3958c4b2b3",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 91,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.5640074211502782,
"repo_name": "dufferzafar/mitmproxy",
"id": "e9d92c831af5f56b7e132e85cd5136241e8198b4",
"size"... |
import os
import sys
from typing import List
from django.core.management.base import AppCommand
from django_extensions.management.utils import _make_writeable, signalcommand
class Command(AppCommand):
help = "Creates a Django template tags directory structure for the given app name in the apps's directory"
... | {
"content_hash": "2e42b6345f7568f6377b03e45df85d36",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 156,
"avg_line_length": 39.31944444444444,
"alnum_prop": 0.6015542211232779,
"repo_name": "django-extensions/django-extensions",
"id": "83ab9cf9332d6f4e968b2d915ae42fadf96a6b... |
import os
import zipfile
def print_seconds_nice(seconds, prefix=""):
"""
Static method for interval print in human readable format
:param seconds: seconds count
:param prefix: prefix for print
:return: string which contains human readable representation of interval
"""
if seconds < 60:
... | {
"content_hash": "8c7131e64f35c63fce0dfbe4fb08de13",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 76,
"avg_line_length": 27.5,
"alnum_prop": 0.6405594405594406,
"repo_name": "JFF-Bohdan/tamaku",
"id": "5188ea9d47bbef6abd0577ffd86653d35eabe611",
"size": "1430",
"binary... |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name="color",
parent_name="scattergeo.marker.colorbar.tickfont",
**kwargs,
):
super(ColorValidator, self).__init__(
plotly_name=... | {
"content_hash": "e62ab608efad94b4a441d35270b7caf7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 28.5625,
"alnum_prop": 0.5798687089715536,
"repo_name": "plotly/plotly.py",
"id": "cfbcf0432d63b822c797597b499c1ba59d4d76dc",
"size": "457",
"binar... |
"""
Generate morse sounds without using numpy.
"""
import math
import time
import pyaudio
#sudo apt-get install python-pyaudio
PyAudio = pyaudio.PyAudio
#See http://en.wikipedia.org/wiki/Bit_rate#Audio
BITRATE = 22050 #number of frames per second/frameset.
#See http://www.phy.mtu.edu/~suits/notefreqs.html
FREQUENCY... | {
"content_hash": "86b57531a529dbb1bbab71ee70aadafd",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 83,
"avg_line_length": 23.76923076923077,
"alnum_prop": 0.6871628910463862,
"repo_name": "rzzzwilson/morse",
"id": "bb6b5d0512677ca010ce2b59a210540e2482ad68",
"size": "947"... |
import sys
import os
import shlex
# Make sure sphinx finds the packages
sys.path.insert(0, os.path.abspath('../'))
print(sys.path)
# 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.p... | {
"content_hash": "6a980e6df5d567a80e4b1b949147984d",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 155,
"avg_line_length": 32.9349593495935,
"alnum_prop": 0.6725088455525384,
"repo_name": "lukauskas/means",
"id": "4c4f2e246e139769a2d8c22a8d74a0f61021f562",
"size": "1257... |
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
# Raspberry Pi pin configuration:
RST = 24
# Note the following are only used with SPI:
DC = 23
SPI_PORT = 0
SPI_DEVICE = 0
# Beaglebone Black pin configuration:
# RST = 'P9_12'
# Note the following are only used with SPI:
# DC = 'P9_15'
# SPI_PORT = 1
# SPI_DEV... | {
"content_hash": "aa29664f5477f2acfa501554f8607e6a",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 116,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.742686170212766,
"repo_name": "PrinzJuliano/Linux-Image-Display",
"id": "1a8f609fff4e049818fc0885e1473bef6d2e29aa"... |
import os
from dataclasses import dataclass, field
from typing import Any, List
import hydra
from mephisto.operations.hydra_config import register_script_config
from omegaconf import DictConfig
from parlai.crowdsourcing.tasks.dialcrowd.dialcrowd_blueprint import (
STATIC_BLUEPRINT_TYPE,
)
from parlai.crowdsourcin... | {
"content_hash": "c7a2d993de5335f66ea22ad70d7bd8ac",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 94,
"avg_line_length": 27.38095238095238,
"alnum_prop": 0.7234782608695652,
"repo_name": "facebookresearch/ParlAI",
"id": "67d5222515bdf92ac32740b26f7c2ef2e9fdf8a5",
"size"... |
"""
Attach to a MIDI device and print events to standard output.
"""
import sys
import time
import midi
import midi.sequencer as sequencer
if len(sys.argv) != 3:
print("Usage: {0} <client> <port>".format(sys.argv[0]))
exit(2)
client = sys.argv[1]
port = sys.argv[2]
seq = sequencer.SequencerRead(sequencer_r... | {
"content_hash": "d0ae49afa620ae71633a5087c4900891",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 60,
"avg_line_length": 20.565217391304348,
"alnum_prop": 0.6955602536997886,
"repo_name": "jameswenzel/mydy",
"id": "03eba642ff545a62cfe61a754bdf970163d14894",
"size": "495... |
import multiprocessing
from pxpoint import pxpointsc
from pxpoint.util.datacatalog import * # NOQA
from geospatialdefaults import * # NOQA
import geospatiallib
import zmq
class GeoSpatialWorker(multiprocessing.Process):
def __init__(self, options):
"""Spatial Worker Initialization Routine"""
mu... | {
"content_hash": "2f147be2eb4941df5056b36deefc5d4d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 82,
"avg_line_length": 35.64935064935065,
"alnum_prop": 0.570856102003643,
"repo_name": "safou/spatial",
"id": "1b327c3025aad060c44fad61053625cdca4f60cc",
"size": "2745",
... |
from __future__ import with_statement
from sqlite3 import dbapi2 as sqlite3
from hashlib import md5
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash, _app_ctx_stack, jsonify, Response
from werkzeug import check_password_hash, generate_password_hash
import uuid
import ... | {
"content_hash": "0639f1abb567babf86abfc791b23ff52",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 88,
"avg_line_length": 30.563492063492063,
"alnum_prop": 0.6756686574915607,
"repo_name": "servioticy/servioticy-vagrant",
"id": "842963fab160c0850d9b112316740101181cca51",
... |
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000141'
addresses_name = 'parl.2017-06-08/Version 1/South-Kesteven Democracy_Club__08June2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/South-Kesteven... | {
"content_hash": "bf5a9c024a85c2989bd077512f79b6a3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 94,
"avg_line_length": 51.75,
"alnum_prop": 0.7657004830917874,
"repo_name": "chris48s/UK-Polling-Stations",
"id": "2013969faf7d320e574a746dff0de62042f79fe8",
"size": "414",... |
"""
Middleware provided and used by Horizon.
"""
import json
import logging
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.contrib import messages as django_messages
from django import http
from django import sho... | {
"content_hash": "9c02ffa34b4edf7a7a400af12d93905d",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 45.64736842105263,
"alnum_prop": 0.565663553557016,
"repo_name": "yeming233/horizon",
"id": "8fd3c407fda8c20c7e949bed1a94dbd6a9207b12",
"size": "943... |
import subprocess
import sys
import sqlite3
import os
# from thrift import Thrift
# from thrift.transport import TSocket
# from thrift.transport import TTransport
# from thrift.protocol import TBinaryProtocol
from xml.dom.minidom import Document
import pexpect
import pxssh
sys.path.append('..')
# from THService import... | {
"content_hash": "a81d3b56669562c65c987e80f063d612",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 111,
"avg_line_length": 29.891304347826086,
"alnum_prop": 0.5689090909090909,
"repo_name": "openedbox/bigdata-all-in-one",
"id": "7bbaf9f1c19517457f39db3a396a7f0bfc64bde4",
... |
from .run_command import run_command
def make_volume_dict():
volume_dict = {}
for line in run_command("sudo blkid").stdout.strip("\n").split(sep="\n"):
line = line.split()
volume_name = line[0][:-1]
volume_dict[volume_name] = {}
for field_value in line[1:]:
f... | {
"content_hash": "358a16d1fa6110153710224883a4f7e2",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 20.681818181818183,
"alnum_prop": 0.5626373626373626,
"repo_name": "UCSD-CCAL/ccal",
"id": "fcbe27ad97b1a5f72e8aa76de5b2a0c3cb1f3831",
"size": "455",... |
'''
Meshes for hamitonian Generator
'''
from numpy import *
from multithreading import mpido
from scipy.linalg import eigh,eigvalsh
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from utils import H2G
import pdb,time
__all__=['Emesh','Hmesh','Gmesh']
class Emesh(obje... | {
"content_hash": "51716e5b7a66077fdd4df9fefa45af6b",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 107,
"avg_line_length": 27.06008583690987,
"alnum_prop": 0.5246629659000793,
"repo_name": "Lynn-015/NJU_DMRG",
"id": "af742f54c601455f125675b76f64dd94b4d9b86c",
"size": "6... |
import re
from babik_card_primitives.exceptions import (
InvalidCardNumber,
IssuerNotRecognised
)
CARD_ISSUERS = [
{
'regex': re.compile(r'^4[0-9]{12,18}$'),
'slug': 'visa',
'name': 'Visa',
},
{
'regex': re.compile(r'^5[1-5][0-9]{14}$'),
'slug': 'mastercard'... | {
"content_hash": "1a518e3626fa8015d98cee155cef7408",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 76,
"avg_line_length": 26.551724137931036,
"alnum_prop": 0.6025974025974026,
"repo_name": "aubreystarktoller/django-babik-card-primitives",
"id": "3bdef2087e3d83ac27c77a5c6bb... |
"""Offer zone automation rules."""
import voluptuous as vol
from homeassistant.const import (
ATTR_FRIENDLY_NAME,
CONF_ENTITY_ID,
CONF_EVENT,
CONF_PLATFORM,
CONF_ZONE,
)
from homeassistant.core import CALLBACK_TYPE, HassJob, callback
from homeassistant.helpers import condition, config_validation as... | {
"content_hash": "575704153bafac3deee5719650cfc15d",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 109,
"avg_line_length": 32.6,
"alnum_prop": 0.5725971370143149,
"repo_name": "Danielhiversen/home-assistant",
"id": "ef054b397140db805e83c6f8e7e935afcb82ebb4",
"size": "293... |
from django.contrib import admin
from reversion.admin import VersionAdmin
from profiles.models import Profile
def username(obj):
return (obj.user.username)
username.short_description = "User username"
def user_email(obj):
return (obj.user.email)
user_email.short_description = "User email"
class ProfileA... | {
"content_hash": "d0c62a133b682b78bdf43624c1371781",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 23.26086956521739,
"alnum_prop": 0.7383177570093458,
"repo_name": "pydanny/djangopackages",
"id": "166e810847c0eb68ea916f856bcf4e9a9ec72c9e",
"size":... |
import json
import os
import webapp2
from google.appengine.ext import ndb
DEFAULT_TOKEN_VALUE = 'default_token'
# Key methods
def token_key(token_value=DEFAULT_TOKEN_VALUE):
return ndb.Key('Token', token_value)
# Helper methods
def valid_secret_key(request):
return 'X-Secret-Key' in request.headers and... | {
"content_hash": "1a6ca72f1ad683f4ce5d4c659615d085",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 112,
"avg_line_length": 26.39240506329114,
"alnum_prop": 0.6153477218225419,
"repo_name": "WGierke/weightlifting_schwedt",
"id": "de8bee7a54fc2f2e121ed6b16383b2ba529718a3",
... |
import collections
import pickle
import os
import re
import subprocess
import sys
UTF8 = "utf-8"
TRANSFORM, SUMMARIZE = ("TRANSFORM", "SUMMARIZE")
Code = collections.namedtuple("Code", "name code kind")
def main():
genome = 3 * GENOME
for i, code in enumerate(CODE):
context = dict(genome=genome, tar... | {
"content_hash": "c11c745a9944a2018af3585aba20fcac",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 75,
"avg_line_length": 29.083870967741934,
"alnum_prop": 0.6645962732919255,
"repo_name": "johnobrien/PyPractice",
"id": "e55996d0f8b4daf9c4fecf81193c24e170d55c16",
"size"... |
import sys
from traceback import format_exc, extract_tb
from sanic.exceptions import (
ContentRangeError,
HeaderNotFound,
INTERNAL_SERVER_ERROR_HTML,
InvalidRangeType,
SanicException,
TRACEBACK_LINE_HTML,
TRACEBACK_STYLE,
TRACEBACK_WRAPPER_HTML)
from sanic.log import log
from sanic.resp... | {
"content_hash": "8228170d66d0c1efb190a9802bff808c",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 77,
"avg_line_length": 35.45859872611465,
"alnum_prop": 0.5579306628345608,
"repo_name": "ai0/sanic",
"id": "64df2c2cb794d421f0035eb0a15aaeea99028b1b",
"size": "5567",
"... |
from farmfs.fs import Path
from farmfs.fs import ensure_file
from farmfs.fs import walk
from hashlib import md5
from json import loads, JSONEncoder
from errno import ENOENT as NoSuchFile
from errno import EISDIR as IsDirectory
from os.path import sep
from farmfs.util import egest, safetype
keydb_encoder = JSONEncoder(... | {
"content_hash": "4558f5bde642de6bce80a80c7f081ac1",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 121,
"avg_line_length": 30.77777777777778,
"alnum_prop": 0.5796802475502837,
"repo_name": "andrewguy9/farmfs",
"id": "0c8ff6b5ccafcec18cdb6df246c31df7dcd15ab5",
"size": "3... |
import collections
import cPickle as pickle
import hashlib
import json
import math
import os.path as osp
import cv2
import numpy as np
import skimage.color
import skimage.io
import skimage.transform
import rospkg
from .data import get_object_images
PKG_DIR = rospkg.RosPack().get_path('jsk_arc2017_common')
def ge... | {
"content_hash": "9846162e03ba824aad0d8ab6c5cb0461",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 79,
"avg_line_length": 31.39072847682119,
"alnum_prop": 0.564873417721519,
"repo_name": "pazeshun/jsk_apc",
"id": "6dfe4fd931854e6da5f589002f478ad690b80949",
"size": "9480... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog, traduccion):
Dialog.setObjectName("Dialog")
Dialog.resize(499, 428)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.listWidget = QtW... | {
"content_hash": "73dd8c3fd6ba38a9c82c7b1c8d0dbe96",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 106,
"avg_line_length": 51.79032258064516,
"alnum_prop": 0.6754905014014326,
"repo_name": "jon85p/pyENL",
"id": "05fc8e2a2b04ac70f7751f1533f55eff76d84afc",
"size": "3406",
... |
"""Makes sure that all files contain proper licensing information."""
import json
import optparse
import os.path
import subprocess
import sys
def PrintUsage():
print """Usage: python checklicenses.py [--root <root>] [tocheck]
--root Specifies the repository root. This defaults to "../.." relative
t... | {
"content_hash": "1f3ee2e58d5b58a979847dabc625eabc",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 97,
"avg_line_length": 29.594594594594593,
"alnum_prop": 0.5660795825179387,
"repo_name": "chromium2014/src",
"id": "d90b8eda4cf1911a2200357171bcf4db97211d50",
"size": "15... |
from typing import Type
from pydantic import BaseModel
from pydantic import ValidationError
class Foo:
pass
class Bar(Foo):
pass
class Other:
pass
class SimpleModel(BaseModel):
just_subclasses: Type[Foo]
SimpleModel(just_subclasses=Foo)
SimpleModel(just_subclasses=Bar)
try:
SimpleModel(ju... | {
"content_hash": "0f002accb416b1a5a46c3bf80ec8b88e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 38,
"avg_line_length": 13.678571428571429,
"alnum_prop": 0.7467362924281984,
"repo_name": "samuelcolvin/pydantic",
"id": "933d7ee945985a7bd897ce014fbb2350d4a5c9ac",
"size":... |
from invoke import Collection
from tasks import build, check, db
ns = Collection()
ns.add_collection(build)
ns.add_collection(check)
ns.add_collection(db)
| {
"content_hash": "e98bf617d776fee5774d69bab9fb4182",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 34,
"avg_line_length": 19.625,
"alnum_prop": 0.7770700636942676,
"repo_name": "xuhcc/airy",
"id": "90f8c9b5852336ddc14183680d8e9a4b28a08725",
"size": "157",
"binary": fals... |
import numpy
import struct
import traceback
def header_creator():
ret = ""
ret += struct.pack('i', 3) # slot num
ret += struct.pack('i', 1) # sequence flag
ret += struct.pack('i', 0) # slot0 dense type
ret += struct.pack('i', 3) # slot0 dim
ret += struct.pack('i', 1) # slot1 sparse non va... | {
"content_hash": "31b795f45ace510c50648fb43a0fc74d",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 61,
"avg_line_length": 30.541353383458645,
"alnum_prop": 0.5923190546528804,
"repo_name": "putcn/Paddle",
"id": "85ea90d6eec25eb709b19d06a18c7a955078be04",
"size": "4664",... |
from evdev import InputDevice, ecodes, list_devices
import sys
import errno
import logging
import pulsectl
from logging import DEBUG
KEY_PRESS = 1
INCREASE = 1
INCREASE_AMOUNT = 0.02
DECREASE_AMOUNT = -0.02
log = logging.getLogger('powermated')
log.setLevel(DEBUG)
log.addHandler(logging.StreamHandler(sys.stdout))
d... | {
"content_hash": "90bc8335f5d635098d5b7e4da6250f74",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 99,
"avg_line_length": 31.25,
"alnum_prop": 0.5249655172413793,
"repo_name": "xstefanox/powermated",
"id": "934168409489f1435d0f0bdcb3678a79d9b67056",
"size": "3625",
"b... |
import abc
import string
from keystone import exception
# The characters used to generate verifiers are limited to alphanumerical
# values for ease of manual entry. Commonly confused characters are omitted.
VERIFIER_CHARS = string.ascii_letters + string.digits
CONFUSED_CHARS = 'jiIl1oO0'
VERIFIER_CHARS = ''.join(c f... | {
"content_hash": "6b3b471acb32cc837faaa5542d259296",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 78,
"avg_line_length": 29.980295566502463,
"alnum_prop": 0.64196516595465,
"repo_name": "openstack/keystone",
"id": "f8142dd112e975ca3a1e13f6e754a9e85659a865",
"size": "66... |
from __future__ import unicode_literals
import codecs
import logging
import sys
import itertools
import re
from subprocess import Popen, PIPE
import config.seedev_types
from classification.rext.kernelmodels import ReModel
from classification.results import ResultsRE
from config import config
from text.pair import Pai... | {
"content_hash": "9586e53b4ab968a009146b077f6469e9",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 120,
"avg_line_length": 51.93413173652694,
"alnum_prop": 0.4537069064914101,
"repo_name": "AndreLamurias/IBEnt",
"id": "214efe1a24f9260565d6fbe9f2149ff8540e02a3",
"size": ... |
pass
| {
"content_hash": "deb150aa1931ce4035f97e90db88765b",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 4,
"avg_line_length": 5,
"alnum_prop": 0.8,
"repo_name": "francesconistri/p2ptv-pi",
"id": "e1214d359ccf5a6af86cda0c7a7d6aa39656b515",
"size": "65",
"binary": false,
"co... |
binOffsets = [512+64+8+1, 64+8+1, 8+1, 1, 0]
binOffsetsExtended = [4096+512+64+8+1, 512+64+8+1, 64+8+1, 8+1, 1, 0]
_binFirstShift = 17 # How much to shift to get to finest bin.
_binNextShift = 3 # How much to shift to get to next larger bin.
_binOffsetOldToExtended = 4681 # From binRange.h
def __bin_from_range_st... | {
"content_hash": "30d25b3817f3a4390e63cd2aec3199c0",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 104,
"avg_line_length": 38.77272727272727,
"alnum_prop": 0.6584603360687769,
"repo_name": "ramseylab/cerenkov",
"id": "fd2b88d95b4b384b097101a23f2da893b971540c",
"size": "2... |
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest
class AddIncident(unittest.TestCase):
def setUp(self):
self.wd = webdriver.Chrome("C:\\tests\\JARs\\chromedriver_win32\\chromedriver.ex... | {
"content_hash": "81647253b91140e8d33cd1504ef17878",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 99,
"avg_line_length": 41.69230769230769,
"alnum_prop": 0.6439114391143912,
"repo_name": "bzelmanov/My_Python",
"id": "655dc95ca84ccf69eb84423926c350a9b91b069d",
"size": "1... |
'''
Copyright (c) 2008 Georgios Giannoudovardis, <vardis.g@gmail.com>
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,... | {
"content_hash": "c4095faea15655cfc1b70a387de0f37f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 111,
"avg_line_length": 40.0655737704918,
"alnum_prop": 0.6415711947626841,
"repo_name": "vardis/pano",
"id": "828fdb27663c291494b1880e0e957dc3321f7c1f",
"size": "2444",
... |
"""
surveymonty.constants
---------------------
"""
DEFAULT_HOST = 'https://api.surveymonkey.net'
DEFAULT_VERSION = 'v3'
VERSIONS_MODULE = 'surveymonty.versions'
| {
"content_hash": "7b3c43041490fa5e3e11180e3315a55a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 45,
"avg_line_length": 23.142857142857142,
"alnum_prop": 0.6358024691358025,
"repo_name": "andrewkshim/surveymonty",
"id": "4c57c3b90ec156f34c901aa263d60a3add1c60f2",
"size"... |
import logging
import os
from pyjade import Compiler as _Compiler, Parser, register_filter
from pyjade.runtime import attrs
from pyjade.exceptions import CurrentlyNotSupported
from pyjade.utils import process
from django.conf import settings
class Compiler(_Compiler):
autocloseCode = 'if,ifchanged,ifequal,ifnote... | {
"content_hash": "62540ec4258e4f7c4666e2b5fb6c1168",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 165,
"avg_line_length": 32.24742268041237,
"alnum_prop": 0.6313938618925832,
"repo_name": "huiyiqun/pyjade",
"id": "7452d8ddcfdca3142d823892b75f905f9d126ab0",
"size": "3128... |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import iam_backend, User
class IamResponse(BaseResponse):
def attach_role_policy(self):
policy_arn = self._get_param('PolicyArn')
role_name = self._get_param('RoleName')
iam_backend.attach_r... | {
"content_hash": "e1edfcd6130ea976a42640a54c3d44f8",
"timestamp": "",
"source": "github",
"line_count": 991,
"max_line_length": 137,
"avg_line_length": 37.564076690211905,
"alnum_prop": 0.6559125342502552,
"repo_name": "heddle317/moto",
"id": "8e19b3aa7600c927829e001d206d9d1d7cef52b5",
"size": "372... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import osf.models.base
class Migration(migrations.Migration):
dependencies = [
('osf', '0116_merge_20180703_2258'),
]
... | {
"content_hash": "1b714dedb8cacb50e18cd06350f96152",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 211,
"avg_line_length": 61.65625,
"alnum_prop": 0.6137861125190066,
"repo_name": "saradbowman/osf.io",
"id": "56c9d98231f36f21cc5bfe24df1aeeae23004557",
"size": "4020",
"... |
"""Test matrix ops via einsum"""
from iree.tf.support import tf_test_utils
from iree.tf.support import tf_utils
import tensorflow.compat.v2 as tf
VECTOR_DIM = 16
class EinsumVectorModule(tf.Module):
@tf.function(input_signature=[
tf.TensorSpec([VECTOR_DIM], tf.float32),
])
def einsum_identity(self, x):... | {
"content_hash": "2850917d35733d582dea7aa88fd0953e",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 75,
"avg_line_length": 32.707070707070706,
"alnum_prop": 0.6516368128474367,
"repo_name": "iree-org/iree",
"id": "228f26bda0d10b07117edfc9cc41665490ddf965",
"size": "3455",... |
"""
oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import logging
from oauthlib import common
from .. import errors
from .base import GrantTypeBase
log = logging.getLogger(__name__)
class ImplicitGrant(GrantTypeBase):
"""`Implicit Grant`_
The implicit grant type is used to o... | {
"content_hash": "dc585568844eded1f1fd61f77c2822a2",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 119,
"avg_line_length": 44.819148936170215,
"alnum_prop": 0.6109660574412533,
"repo_name": "idan/oauthlib",
"id": "6110b6f3379114145d7b830bdaa77e405ea9eb0d",
"size": "1685... |
import os
from nipype.testing import (skipif)
import nipype.workflows.fmri.fsl as fsl_wf
import nipype.interfaces.fsl as fsl
import nipype.interfaces.utility as util
from nipype.interfaces.fsl import no_fsl, no_fsl_course_data
import nipype.pipeline.engine as pe
import warnings
import tempfile
import shutil
from nipy... | {
"content_hash": "8f26dbd5a21088f7b1d9ca1e7ad1177d",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 37.4468085106383,
"alnum_prop": 0.6744318181818182,
"repo_name": "carolFrohlich/nipype",
"id": "f622b8304a8e9dab28db7abc92b08337e55dd1af",
"size": "1... |
from tempest.services.volume.xml import availability_zone_client
class VolumeV2AvailabilityZoneClientXML(
availability_zone_client.BaseVolumeAvailabilityZoneClientXML):
def __init__(self, auth_provider):
super(VolumeV2AvailabilityZoneClientXML, self).__init__(
auth_provider)
... | {
"content_hash": "af040309ca92171f6539055eac1bc165",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 70,
"avg_line_length": 31.272727272727273,
"alnum_prop": 0.7209302325581395,
"repo_name": "nikolay-fedotov/tempest",
"id": "68ca39bb655ae4ae909c3a12f145d5256591743b",
"size... |
try:
from collections import namedtuple
except ImportError:
try:
from .ip_connection import namedtuple
except ValueError:
from ip_connection import namedtuple
try:
from .ip_connection import Device, IPConnection, Error
except ValueError:
from ip_connection import Device, IPConnectio... | {
"content_hash": "6f11a85dd083574eb5dd693ce5649a6a",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 154,
"avg_line_length": 45.22485207100592,
"alnum_prop": 0.6760434384404029,
"repo_name": "DeathPoison/tinker-cnc",
"id": "599ba7772231cd437e2432090d16c5e75423cc8e",
"size... |
import lldbsuite.test.lldbinline as lldbinline
from lldbsuite.test.decorators import *
lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest])
| {
"content_hash": "63883dc22c4f5fabec62c65b7a4cee6c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 70,
"avg_line_length": 39.75,
"alnum_prop": 0.8050314465408805,
"repo_name": "apple/swift-lldb",
"id": "d773710c0d159afd89966dd223beef20ec622a47",
"size": "613",
"binary":... |
from predicthq.endpoints.base import UserBaseEndpoint
from predicthq.endpoints.decorators import accepts, returns
from .schemas import (
SearchParams,
EventResultSet,
CountResultSet,
CalendarParams,
CalendarResultSet,
)
class EventsEndpoint(UserBaseEndpoint):
@accepts(SearchParams)
@return... | {
"content_hash": "e177b46d6bfbfd467e66ede0c3f8043b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 59,
"avg_line_length": 28.73170731707317,
"alnum_prop": 0.6179966044142614,
"repo_name": "predicthq/sdk-py",
"id": "51fb33a51758fe901ec18164538705d2d49d1415",
"size": "1178... |
"""
Common functionalities shared between different iLO modules.
"""
import tempfile
from oslo_config import cfg
from oslo_utils import importutils
import six.moves.urllib.parse as urlparse
from ironic.common import exception
from ironic.common.glance_service import service_utils
from ironic.common.i18n import _
fro... | {
"content_hash": "c454a7abf417d70058683cfc8514ef12",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 79,
"avg_line_length": 37.869140625,
"alnum_prop": 0.6383516426839961,
"repo_name": "supermari0/ironic",
"id": "1d1363d0df44ff8d3ead6ddd6b446e339ab2f669",
"size": "19996",... |
from __future__ import unicode_literals
from django.contrib.admin.tests import AdminSeleniumTestCase
from django.test import override_settings
from django.urls import reverse
from ..models import Article
@override_settings(ROOT_URLCONF='forms_tests.urls')
class LiveWidgetTests(AdminSeleniumTestCase):
available... | {
"content_hash": "c38c691782d8cd66d2691dbe958a298a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 92,
"avg_line_length": 36.82608695652174,
"alnum_prop": 0.7166469893742621,
"repo_name": "sarthakmeh03/django",
"id": "f67954fd3a5fb4977ecae66797050943e5ee464a",
"size": "8... |
"""
Tests the shell core module
:author: Thomas Calmant
"""
# Standard library
import os
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
# Tests
try:
import unittest2 as unittest
except ImportError:
import unittest
# Pelix
from pelix.framework import Framewo... | {
"content_hash": "3bc4acd62a3c999c3f76157f1ba712b0",
"timestamp": "",
"source": "github",
"line_count": 890,
"max_line_length": 80,
"avg_line_length": 33.825842696629216,
"alnum_prop": 0.5383158943697061,
"repo_name": "tcalmant/ipopo",
"id": "407f24374463d2376f788b17ac7da051d09d46aa",
"size": "3015... |
import ana
import simuvex
import claripy
import mulpyplexer
import logging
l = logging.getLogger('angr.path_group')
class CallReturn(simuvex.SimProcedure):
NO_RET = True
def run(self):
l.info("A PathGroup.call-created path returned!")
return
class PathGroup(ana.Storable):
'''
Path ... | {
"content_hash": "2b818b6faa7f51d47598a13c0ff7397e",
"timestamp": "",
"source": "github",
"line_count": 743,
"max_line_length": 289,
"avg_line_length": 43.17092866756393,
"alnum_prop": 0.5796233944382092,
"repo_name": "cureHsu/angr",
"id": "f695fb38f021534c9bb6ff8f14697e5734e23462",
"size": "32076"... |
import cgi, cgitb
form = cgi.FieldStorage()
if form.getvalue('maths'):
math_flag = "ON"
else:
math_flag = "OFF"
if form.getvalue('physics'):
physics_flag = "ON"
else:
physics_flag = "OFF"
if form.getvalue('computer'):
computer_flag = "ON"
else:
computer_flag = "OFF"
print("Content-typ... | {
"content_hash": "656a90ec92e77b6a5afe9ab54d1d0321",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 26.92,
"alnum_prop": 0.6136701337295691,
"repo_name": "5610110083/Safety-in-residential-project",
"id": "326ee1b1930823f338a26c2efd7f05a8598a65af",
"... |
"""Tests for google.protobuf.descriptor_database."""
__author__ = 'matthewtoia@google.com (Matt Toia)'
import unittest
import warnings
from google.protobuf import unittest_pb2
from google.protobuf import descriptor_pb2
from google.protobuf.internal import factory_test2_pb2
from google.protobuf.internal import no_pac... | {
"content_hash": "eb3ce0c6b03d2b732777e61cc6621898",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 81,
"avg_line_length": 44.45360824742268,
"alnum_prop": 0.7314471243042672,
"repo_name": "chromium/chromium",
"id": "3c086b92471ad54be55fcfbf86dfd169dca2d3ac",
"size": "594... |
import pygtk
pygtk.require('2.0')
import gtk
import gtksourceview2
import gobject
import mimetypes
import pango
import subprocess
import fcntl
import os
import sys
import re
import ast
import optparse
import source
def patch_key_event(event, keyname):
keyval = int(gtk.gdk.keyval_from_name(keyname))
keymap = gtk.gdk.... | {
"content_hash": "23864dbc9b78acc6ae051e0b5febf229",
"timestamp": "",
"source": "github",
"line_count": 532,
"max_line_length": 71,
"avg_line_length": 27.774436090225564,
"alnum_prop": 0.6650649702219816,
"repo_name": "nailgun/mydbg",
"id": "11d0945b8e7e821f3c494baabb49414c620db6bd",
"size": "14776... |
"""Tests for tf.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import operator
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_imp... | {
"content_hash": "194becf91fd0d21647d2c6fb7245e1a8",
"timestamp": "",
"source": "github",
"line_count": 655,
"max_line_length": 94,
"avg_line_length": 36.5587786259542,
"alnum_prop": 0.6347197861855842,
"repo_name": "mavenlin/tensorflow",
"id": "12421c1dcc351939ce8f85b6597705bbb7f6a055",
"size": "2... |
from django.contrib import admin
from my_app.models import Article
# Register your models here.
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'pub_date', 'update_time',)
admin.site.register(Article, ArticleAdmin)
| {
"content_hash": "c056a1a89a1e7dba53645711d668be75",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 56,
"avg_line_length": 23.8,
"alnum_prop": 0.7521008403361344,
"repo_name": "wmh-demos/django-first-demo",
"id": "ee5d39ab5ef64d95d7bc0bc4c63bd274a2a4b25a",
"size": "238",
... |
"""
This module defines constant variables used by the GUI. These variable should
never be modified by user.
Variables defining the style or theme of the GUI can be found in:
- style.py
- painterstyle.py
"""
import pygame.event as pygame_event
from pygame.font import get_fonts
from pygame.locals import USEREVE... | {
"content_hash": "41c9bd3cc6967d4f774ffdbea38757ef",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 104,
"avg_line_length": 26.174311926605505,
"alnum_prop": 0.706975113915177,
"repo_name": "YannThorimbert/Thorpy-1.4",
"id": "720cdba1c9b4b38aa99de955b0a4d7eb7df7f5b1",
"s... |
"""
Preprocess
----------
"""
import numpy as np
import sklearn.preprocessing as skl_preprocessing
import bottleneck as bn
import Orange.data
from Orange.data import Table
from . import impute, discretize
from ..misc.enum import Enum
__all__ = ["Continuize", "Discretize", "Impute", "SklImpute",
"Normalize... | {
"content_hash": "ea9d3cf46bfaf5b58a44b04df7464789",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 89,
"avg_line_length": 30.568396226415093,
"alnum_prop": 0.6014967980865674,
"repo_name": "qPCR4vir/orange3",
"id": "5bfe56dbed7c74157540fdaf261e4a5558a824b8",
"size": "12... |
from api_v3.models import Profile
from .support import DjangoModelFactory, Faker
class ProfileFactory(DjangoModelFactory):
class Meta:
model = Profile
email = Faker('email')
first_name = Faker('first_name')
last_name = Faker('last_name')
bio = Faker('job')
last_login = Faker('past_da... | {
"content_hash": "c6c5683b1a27bf1d8f7e3df6434ab998",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.6686046511627907,
"repo_name": "occrp/id-backend",
"id": "aed2cb6458da57ddbf7e685b9944f98da51e3ee5",
"size": "344... |
from ..interface import GreatFETInterface
class I2CDevice(GreatFETInterface):
"""
Class representing an generic I2C device connected to a GreatFET I2C Bus.
This acts both as the base class for I2C devices, and as a generic class
that can be used to access I2C devices for which no existing... | {
"content_hash": "473bc778715fff081539059dae2d24b6",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 87,
"avg_line_length": 32.417910447761194,
"alnum_prop": 0.5718232044198895,
"repo_name": "dominicgs/GreatFET-experimental",
"id": "35c66412a7eb3660b633bacca3f252b0c40a55e0",... |
import hashlib
import os.path
import re
import urllib.parse
import w3lib.url
def hash(url):
"""Returns hash of url"""
return hashlib.sha1(url.encode('utf-8')).hexdigest()
def hash_document(document):
"""Returns hash of document"""
return hashlib.sha1(document).hexdigest()
def remove_www(url):
... | {
"content_hash": "4f8e868fa808e0158e564219084350e3",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 78,
"avg_line_length": 25.03937007874016,
"alnum_prop": 0.6094339622641509,
"repo_name": "UPOLSearch/UPOL-Search-Engine",
"id": "583469cc78aba75b71ebe7f569fa34040dcfc9ce",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('action_notifications', '0005_actionnotification_do_not_send_before'),
]
operations = [
migrations.AlterField(
model_name='actionnotificationpreference',
name='email_... | {
"content_hash": "e1dbae4a756c15e7974350d206c13a9e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 167,
"avg_line_length": 38.61904761904762,
"alnum_prop": 0.6214549938347719,
"repo_name": "burnsred/django-action-notifications",
"id": "83cc7cdebfb43e546a164fb2fe63a44cde73b... |
from __future__ import unicode_literals
from django.utils import six
from reviewboard.reviews.models import FileAttachmentComment
from reviewboard.webapi.resources import resources
from reviewboard.webapi.tests.base import BaseWebAPITestCase
from reviewboard.webapi.tests.mimetypes import (
review_reply_file_attac... | {
"content_hash": "23c88a94a160730d41fe10706e0b09f0",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 80,
"avg_line_length": 41.37152777777778,
"alnum_prop": 0.6287872429710449,
"repo_name": "bkochendorfer/reviewboard",
"id": "cf75dadb6bef9122c6784dff1b192f9f58bb804e",
"si... |
import os
import sys
import time
import base64
import requests
from magnolia.utility import *
from magnolia.utility import LOG as L
from magnolia.script import testcase
def find_all_files(directory):
for root, dirs, files in os.walk(directory):
yield root
for f in files:
yield os.path.... | {
"content_hash": "90c46223329638be1a2bb7be55798f53",
"timestamp": "",
"source": "github",
"line_count": 427,
"max_line_length": 141,
"avg_line_length": 44.78688524590164,
"alnum_prop": 0.5581468312068605,
"repo_name": "setsulla/stir",
"id": "5821efce173a9f73ca3a14983ca3d1903af3812e",
"size": "19124... |
from django.views.generic import View
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.contrib.auth import logout
class LogoutView(View):
def get(self, request):
logout(request)
return redirect(
reverse(
"home"
... | {
"content_hash": "ea61155aaa51288605bf04ec6998b54e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 44,
"avg_line_length": 22.3125,
"alnum_prop": 0.5910364145658263,
"repo_name": "manducku/blogram",
"id": "64cf916275e1f1d6191f4107f3c11ad486947cc8",
"size": "357",
"binar... |
import os.path
import xml.etree.cElementTree as CET
from botocore.compat import XMLParseError
from burp import IBurpExtender
from burp import IScannerCheck
from burp import ITab
from javax.swing import JTextField
from javax.swing import JLabel
from javax.swing import JFrame
from javax.swing import JPanel
from javax.swi... | {
"content_hash": "99bd81f7299889fc1159217d107518d7",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 98,
"avg_line_length": 39.03112840466926,
"alnum_prop": 0.6067191705712291,
"repo_name": "VirtueSecurity/aws-extender",
"id": "270eddf7522f5e03fb7c1672ce857bd1abe212cc",
"... |
"""
:codeauthor: Rahul Handay <rahulha@saltstack.com>
"""
import salt.modules.pagerduty as pagerduty
import salt.utils.json
import salt.utils.pagerduty
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class PagerdutyTe... | {
"content_hash": "50f057015e77664196d62666b8eea6b1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 84,
"avg_line_length": 34.56944444444444,
"alnum_prop": 0.627159501807955,
"repo_name": "saltstack/salt",
"id": "494000e8a239e702dbc71f767dbab5d16600df1c",
"size": "2489",
... |
__all__ = [
"Provider",
"State",
"LibcloudLBError",
"LibcloudLBImmutableError",
"OLD_CONSTANT_TO_NEW_MAPPING",
]
from libcloud.common.types import LibcloudError
class LibcloudLBError(LibcloudError):
pass
class LibcloudLBImmutableError(LibcloudLBError):
pass
class Provider(object):
... | {
"content_hash": "41202531e4c0c0dc91db04c929e2cd23",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 76,
"avg_line_length": 20.207792207792206,
"alnum_prop": 0.6606683804627249,
"repo_name": "mistio/libcloud",
"id": "b97663f33ff7882ef3ea2ce60ae42ff879f20c6f",
"size": "2338... |
import os
from flask import Flask, g
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'label.sqlite'),
)
if test_config is None:... | {
"content_hash": "aedbd7d8b3ab8ac0e7390406c7493b22",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 24.65625,
"alnum_prop": 0.6400506970849176,
"repo_name": "ivankeller/set-game",
"id": "5c1f46f4829b4357195a9595b86047b472331f70",
"size": "789",
"b... |
from __future__ import print_function
import os
import sys
import signal
from tornado.ioloop import IOLoop
from ipykernel.kernelbase import Kernel
from pexpect import replwrap, EOF
__version__ = '0.2'
try:
from traitlets import Unicode
except ImportError:
from IPython.utils.traitlets import Unicode
class MP... | {
"content_hash": "d31b6d1368e765923484f401541d5c2a",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 123,
"avg_line_length": 35.64670658682635,
"alnum_prop": 0.5602217369393583,
"repo_name": "TDAbboud/mpkernel",
"id": "05fbce185588fecdb30d9d9824a1b4c3b8498558",
"size": "5... |
from mozdns.views import MozdnsDeleteView
from mozdns.views import MozdnsCreateView
from mozdns.views import MozdnsDetailView
from mozdns.views import MozdnsUpdateView
from mozdns.views import MozdnsListView
from mozdns.srv.models import SRV
from mozdns.srv.forms import SRVForm
class SRVView(object):
model = SRV
... | {
"content_hash": "c2856cff67fbf94105e9ebccfbc67181",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 47,
"avg_line_length": 23.352941176470587,
"alnum_prop": 0.7518891687657431,
"repo_name": "mozilla/inventory",
"id": "7f8eafdba6c55b7c3385087b2418689b681a0567",
"size": "79... |
import time
import datetime
import json
import platform
import lora_interface
#transmission_mode = 1 # Max range, slow data rate.
transmission_mode = 5 # Better reach, medium time on air. Test this mode because it doesn't mandate Low Data Rate Optimisation, which is not supported on Hope RF95.
transmission_channel = l... | {
"content_hash": "d396b8122797d83412fcdb8830199ca3",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 164,
"avg_line_length": 37.921875,
"alnum_prop": 0.6254635352286774,
"repo_name": "lupyuen/RaspberryPiImage",
"id": "c934af50cf4608a16ab226e066f3a4aa4be62044",
"size": "254... |
from django.conf import settings
from django.core import urlresolvers
from django.utils import translation
from localeurlcustom import utils
def reverse(*args, **kwargs):
reverse_kwargs = kwargs.get('kwargs') or {}
locale = utils.supported_language(reverse_kwargs.pop(
'locale', translation.get_lang... | {
"content_hash": "c45dd992cbd218c255fd1fcacc710938",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 30.5,
"alnum_prop": 0.7061790668348046,
"repo_name": "pyconjp/pyconjp-website",
"id": "63bd806cc59d7101b0e79d8a9d2fd1e408895ca6",
"size": "793",
"b... |
import inspect
from app.services import auth
class InjectPlugin(object):
name = 'inject'
api = 2
def __init__(self, keyword='inject', **kwargs):
self.keyword = keyword
def setup(self, app):
self.app = app
def apply(self, callback, context):
args = inspect.getargspec(cont... | {
"content_hash": "42ae3bddae179990aaf9d1c660d7bd72",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 54,
"avg_line_length": 24.705882352941178,
"alnum_prop": 0.5107142857142857,
"repo_name": "kianby/sandbox",
"id": "53d90c49932813f6153613f4c927b7bcf6f893a8",
"size": "883",... |
'''
Regular Expression
Ref:
https://swtch.com/~rsc/regexp/regexp1.html
'''
| {
"content_hash": "d343faa937ee64be2aa4324e2a233390",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 11.571428571428571,
"alnum_prop": 0.654320987654321,
"repo_name": "oxnz/algorithms",
"id": "24615718dc305547e577640f04799a8d4561cee3",
"size": "632",
... |
"""
Atmosphere allocation rest api.
"""
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework import status
from core.models import Allocation, AllocationStrategy
from core.query import only_active_memberships
from api.v1.serializers import AllocationSerializ... | {
"content_hash": "47a3962809c5b7b6018d0ac6b49151d5",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 30.314814814814813,
"alnum_prop": 0.6551618814905315,
"repo_name": "CCI-MOC/GUI-Backend",
"id": "b17ddc01d364db713079e23c8ca28850ba35fb0c",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.