text stringlengths 4 1.02M | meta dict |
|---|---|
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
| {
"content_hash": "2af2ae96924ecbb524dc07c6fd8b1bf9",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 14.625,
"alnum_prop": 0.6495726495726496,
"repo_name": "djb1815/Essex-MuSoc",
"id": "c650e6df983de912f3107537a7314604bf5fa56b",
"size": "117",
"bina... |
class FuzzyNumber(object):
def __init__(self, value, threshold):
self.value = value
self.threshold = threshold
def __repr__(self):
return "[%f %f]" % (self.value, self.threshold)
def __cmp__(self, other):
if hasattr(other, "value"):
if abs(self.value - other.va... | {
"content_hash": "eb71ac31157edd67351a75066cee4024",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 62,
"avg_line_length": 29.6875,
"alnum_prop": 0.5410526315789473,
"repo_name": "metapolator/mutatormathtools",
"id": "259d74704ec101e67637f27124ed20edd144b49c",
"size": "47... |
from CIM15.IEC61970.Informative.InfGMLSupport.GmlDiagramObject import GmlDiagramObject
class GmlPointGeometry(GmlDiagramObject):
"""Typically used for rendering power system resources and/or point assets.Typically used for rendering power system resources and/or point assets.
"""
def __init__(self, *args,... | {
"content_hash": "42e872f6d0d397a038bef296fd010c7d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 151,
"avg_line_length": 30.42105263157895,
"alnum_prop": 0.6505190311418685,
"repo_name": "rwl/PyCIM",
"id": "2393d796d4fd6e9a2e3593549e7a46e2e92c15e9",
"size": "1678",
"... |
"""
SECURITY ENDPOINTS CHECK
Add auth checks called /checklogged and /testadmin
"""
from __future__ import division, absolute_import
from .. import myself, lic, get_logger
from .base import ExtendedApiResource
from . import decorators as decorate
from flask_security import roles_required, auth_token_required
from conf... | {
"content_hash": "0920416935ac79e66eed513579d4f98d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 62,
"avg_line_length": 22.046511627906977,
"alnum_prop": 0.6972573839662447,
"repo_name": "pdonorio/rest-mock",
"id": "94a34e52b7eb509f50bbcab94b27868c2fa78f1b",
"size": "9... |
"""Transport for Python logging handler.
Logs directly to the the Stackdriver Logging API with a synchronous call.
"""
from google.cloud.logging import _helpers
from google.cloud.logging.handlers.transports.base import Transport
class SyncTransport(Transport):
"""Basic sychronous transport.
Uses this libra... | {
"content_hash": "6352820ff5c1acae4dd21f9fbfe82c1e",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 83,
"avg_line_length": 32.266666666666666,
"alnum_prop": 0.6363636363636364,
"repo_name": "tswast/google-cloud-python",
"id": "e87eb4885fbfa893ed04dfad0e35f4007b63949a",
"s... |
"""
Tests of inherited privilege handling.
"""
import unittest
import sys
from PyQt4.QtGui import QApplication
from datafinder.core.item.privileges.principal import SPECIAL_PRINCIPALS
from datafinder.gui.user.dialogs.privilege_dialog.main import PrivilegeDialog
from datafinder_test.gui.user.dialogs... | {
"content_hash": "2eff0383588c932fed1fff9eb4acc7b8",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 109,
"avg_line_length": 42.97530864197531,
"alnum_prop": 0.6762424590634875,
"repo_name": "DLR-SC/DataFinder",
"id": "00809c1f125d06a1264ccd157ac5fd2e36c97b36",
"size": "52... |
"""
The PhraseEngine for extracting phrases from discussions
"""
from chunker import BigramChunker, TrigramChunker
from segmenter import *
from collocate import *
from exceptions import PhraseEngineException, PhraseEngineServiceException
from nltk.corpus import conll2000, conll2002
import random
class PhraseEngine(obj... | {
"content_hash": "ee8710a31312c026308e01bff43df83b",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 101,
"avg_line_length": 41.5,
"alnum_prop": 0.6116774791473587,
"repo_name": "donama/phraseengine",
"id": "d5070642340466b0cf50801119078523f6d16687",
"size": "5417",
"bi... |
import tornado.ioloop
import tornado.web
import logging
import os
import json
import db
class SmsModel:
def __init__(self):
pass
def fetch(self):
item, count = db.fetch_sms_task()
if item:
sms_id = item[0]
number = item[1]
message = item[2]
... | {
"content_hash": "10b9fa9979b88fa7dc470a3441894f0b",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 90,
"avg_line_length": 32.693069306930695,
"alnum_prop": 0.5854027861901878,
"repo_name": "eggfly/gosms",
"id": "64c6cad27a70c73f3482f67b4ec68734b77694a2",
"size": "3325",... |
import astroid
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
def register(linter):
linter.register_checker(ImportStudentCode(linter))
class ImportStudentCode(BaseChecker):
"""
An extra lint to ensure that studentcode isn't imported anywhere but
the appropriate ... | {
"content_hash": "8af01ff994f7d5a5487d2b85ae87ffe1",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 95,
"avg_line_length": 30.307692307692307,
"alnum_prop": 0.6186548223350253,
"repo_name": "pioneers/PieCentral",
"id": "8387005f199d1409e92d99ef2c6c903e42d4ecc7",
"size": "... |
import json, urllib2
from settings import *
class AllocineObject(object):
_dict = dict()
def __new__(self, code, **kwargs):
AllocineObject._dict.setdefault(self.__module__,{})
if code in AllocineObject._dict[self.__module__]:
retval = AllocineObject._dict[self.__module__][code]
retval.__init__... | {
"content_hash": "ff06d86ec213c9000816b5e2ba5ee26d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 157,
"avg_line_length": 34.96969696969697,
"alnum_prop": 0.5961871750433275,
"repo_name": "gtnx/python-allocine",
"id": "983c89672ea7532fc4e333e74b81dec95606a3a5",
"size": ... |
"""
Copyright 2012 Wordnik, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | {
"content_hash": "dcb5c55f77650fedb7be5fb4a634a92c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 31.87878787878788,
"alnum_prop": 0.6283269961977186,
"repo_name": "Fewbytes/cosmo-manager-rest-client",
"id": "958911035e9d6f900572fd9ba96e066be6c9e45b... |
import os
import sys
PY3= sys.version > '3'
import numpy
import pytest
from scipy import optimize
try:
import pynbody
_PYNBODY_LOADED= True
except ImportError:
_PYNBODY_LOADED= False
from galpy import orbit, potential
from galpy.util import _rotate_to_arbitrary_vector, coords
#Test whether the normaliza... | {
"content_hash": "9c2b551df8f9803b17716e35a2848a4a",
"timestamp": "",
"source": "github",
"line_count": 5789,
"max_line_length": 355,
"avg_line_length": 57.731041630678874,
"alnum_prop": 0.6570368486408042,
"repo_name": "jobovy/galpy",
"id": "21d0fe4521db1aed78b9354e732c3777f59186ef",
"size": "3342... |
"""Tests for the Google Chrome History database plugin."""
import unittest
# pylint: disable=unused-import
from plaso.formatters import chrome as chrome_formatter
from plaso.lib import eventdata
from plaso.lib import timelib_test
from plaso.parsers import sqlite
from plaso.parsers.sqlite_plugins import chrome
from pl... | {
"content_hash": "59ad05669d5d7bae1a775a04605f4f37",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 78,
"avg_line_length": 36.411764705882355,
"alnum_prop": 0.7033925686591276,
"repo_name": "cvandeplas/plaso",
"id": "a47388972fc48cf8b5ed50c8f1025eddbb12ccd1",
"size": "379... |
import os
import subprocess
from Fabricate import util
# TODO: reduce this to a wrapper around os.environ[name].
class Configuration(dict):
def __init__(self, config_dict=None):
if config_dict is None:
config_dict = {}
dict.__init__(self, config_dict)
def __setattr__(self, name, value):
# Rais... | {
"content_hash": "daf70b16faa294c8c2e8bf8e77186388",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 75,
"avg_line_length": 30.45689655172414,
"alnum_prop": 0.6159071610529295,
"repo_name": "ekline/zed5",
"id": "7cc393ffae45c1c6bae82e55f84c5b9ec5174bce",
"size": "3701",
... |
import unittest
from pyparsing import ParseException
from cwr.grammar.field import basic
"""
Tests for Time (T) fields.
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
class TestTimeName(unittest.TestCase):
def test_name_default(self):
"""
Tests that... | {
"content_hash": "0918a31a3bae3802682b7d94a4d6c2b2",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 78,
"avg_line_length": 27.634920634920636,
"alnum_prop": 0.6148765077541642,
"repo_name": "weso/CWR-DataApi",
"id": "01f4491d8695c12c72461f641ffb617c0a67ce61",
"size": "35... |
import comm_client
import model
from kivy.app import App
import gui
from threading import Thread
import time
DEBUG = 1
class Controller(App):
title = 'Router Performance Client'
def __init__(self):
super(Controller,self).__init__()
self.SERVERIP = '0'
self.communication = comm_clien... | {
"content_hash": "a4ccfee6c0e8c9f212a861f5daac57a6",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 71,
"avg_line_length": 26.977777777777778,
"alnum_prop": 0.5137973640856672,
"repo_name": "Spe3do/benchmark",
"id": "6dff5f30a1018e65e41791e6302ec665dd4c04df",
"size": "49... |
import logging; log = logging.getLogger(__name__)
try:
import simplejson as json
except ImportError:
import json
import base64
import hashlib
import hmac
import inspect
import string
import time
import urllib
# 3rd party libraries that might not be present during initial install
# but we need to import for ... | {
"content_hash": "50ba5be2eccb0ce4dba6b2a107708d4f",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 174,
"avg_line_length": 34.12380952380953,
"alnum_prop": 0.6148478928272397,
"repo_name": "mLewisLogic/singleplatform",
"id": "8e357c0d2de209660712454ac0f6fa8cc63adef1",
"... |
import sys
import numpy as np
import pytest
from taichi.lang.util import has_pytorch
import taichi as ti
from tests import test_utils
if has_pytorch():
import torch
@pytest.mark.skipif(not has_pytorch(), reason='Pytorch not installed.')
@test_utils.test(arch=ti.cuda)
def test_torch_cuda_context():
device =... | {
"content_hash": "4e09887c2ddff9290bf9b512fc2fc3ee",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 78,
"avg_line_length": 27.944444444444443,
"alnum_prop": 0.5646123260437376,
"repo_name": "yuanming-hu/taichi",
"id": "b7a6e5cf7c8bb10874087323455cc462bd58c971",
"size": "... |
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scripts.assemblies import shielded_true_image
from scripts.utils import display_estimate
def display_transmission_sinogram():
import numpy as np
from pytracer import geometry as geo
radians = np.linspace(0, np... | {
"content_hash": "a1eaa5422c09bca0f2c70a4753488af6",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 95,
"avg_line_length": 29.88095238095238,
"alnum_prop": 0.6796812749003984,
"repo_name": "abnowack/PyTracer",
"id": "259c83a3581ea656bdbcd9081ba86861c357994a",
"size": "125... |
from __future__ import absolute_import
import textwrap
import pkgutil
import copy
import os
import json
from functools import reduce
try:
from math import gcd
except ImportError:
# Python 2
from fractions import gcd
# Create Lazy sentinal object to indicate that a template should be loaded
# on-demand f... | {
"content_hash": "6483e4737e029867e23bbe1b178385fb",
"timestamp": "",
"source": "github",
"line_count": 497,
"max_line_length": 90,
"avg_line_length": 30.47082494969819,
"alnum_prop": 0.563391442155309,
"repo_name": "plotly/plotly.py",
"id": "800525b95086fdf3ecd69fa89feb1055c6f70e80",
"size": "1514... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/theme_park/shared_invisible_object.iff"
result.attribute_template_id = -1
result.stfName("item_n","base_poi")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "80b972284bc76b8caf05e2ca67355e73",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 23.153846153846153,
"alnum_prop": 0.6910299003322259,
"repo_name": "obi-two/Rebelion",
"id": "2261c8aeec2299bfab27b00bb0726780096c9d17",
"size": "446... |
from ABE_ADCPi import ADCPi
from ABE_helpers import ABEHelpers
from datetime import datetime, timedelta
import sys
import logging
import time
from numpy import interp, clip
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
class StraightLineSpeed:
def __init__(self, drive):
""" Standard Construc... | {
"content_hash": "66657ea70b3562c10521f5c5b2594daf",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 81,
"avg_line_length": 34.79120879120879,
"alnum_prop": 0.5837018319646241,
"repo_name": "hackhitchin/piwars",
"id": "1ad79bf0afdf49bd639ddf2f856c7562b87594fb",
"size": "32... |
"""
Totally untested thread pool class.
Tries to not get more than "maximum" (but this is not a hard limit).
Kills off up to around half of its workers when more than half are idle.
"""
from __future__ import print_function
from __future__ import with_statement
from threading import Thread, RLock
from queue import Que... | {
"content_hash": "b73d6e2c4a046f97c8ddb7d9dc2c1fb7",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 72,
"avg_line_length": 24.516129032258064,
"alnum_prop": 0.5890350877192982,
"repo_name": "MurphyMc/pox",
"id": "01f1c9c943283c8e9015d8504fddccdbd651af68",
"size": "2860",
... |
import sys
import os.path
import pickle
import numpy as np
# Import the relevant PTS classes and modules
import pts.core.tools.archive as arch
from pts.eagle import config
from pts.eagle.database import Database
from pts.eagle.skirtrun import SkirtRun
# ----------------------------------------------------------------... | {
"content_hash": "146fe24ef0938a7c977de2e03f6a72aa",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 125,
"avg_line_length": 40.60344827586207,
"alnum_prop": 0.6348195329087049,
"repo_name": "Stargrazer82301/CAAPR",
"id": "ba8ce840e68810529cf74510f75588d902524cd8",
"size":... |
import functools
from promise import Promise, is_thenable, promise_for_dict
from ...pyutils.cached_property import cached_property
from ...pyutils.default_ordered_dict import DefaultOrderedDict
from ...type import (GraphQLInterfaceType, GraphQLList, GraphQLNonNull,
GraphQLObjectType, GraphQLUnion... | {
"content_hash": "1f1872e037bb13968fbf3bb7c94c8f35",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 114,
"avg_line_length": 33.02777777777778,
"alnum_prop": 0.5923344947735192,
"repo_name": "wandb/client",
"id": "427acbaf2233e9adf221ba609cd0642d34b9ff3a",
"size": "8323",... |
r"""
===============================================================================
pore_misc -- miscillaneous and generic functions to apply to pores
===============================================================================
"""
import scipy as _sp
def constant(geometry, value, **kwargs):
r"""
Assign ... | {
"content_hash": "20941f10a002e30f7ece8b9061ac0d36",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 32.86274509803921,
"alnum_prop": 0.529236276849642,
"repo_name": "amdouglas/OpenPNM",
"id": "df22a28d6976371b919ee2ad45aa7d9a92b1e1f9",
"size": "1676... |
from datetime import datetime
from .constants import Constants
class Configuration:
suffix = Constants.EMPTY_STRING
_validated = False
def __init__(self):
super().__init__()
def validate(self):
""" The most class members are asserted """
if not self._validated:
r... | {
"content_hash": "14d6e8e30417321dfb171d59a074eab8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 57,
"avg_line_length": 23.541666666666668,
"alnum_prop": 0.6265486725663717,
"repo_name": "PublicHealthEngland/animal-welfare-assessment-grid",
"id": "6d273a6096bc82b7f2a6ad6... |
STORAGE_ACCOUNT_NAME = ''
STORAGE_ACCOUNT_KEY = ''
SAS = ''
IS_EMULATED = False
| {
"content_hash": "07a8557a415fc5d1de0f4b2447706c4a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 25,
"avg_line_length": 20,
"alnum_prop": 0.6625,
"repo_name": "Azure/azure-storage-python",
"id": "882c5a0673b83b6db4e293bf2eb4c30892ff2b33",
"size": "391",
"binary": fals... |
from twisted.internet.defer import inlineCallbacks, returnValue
from twext.python.log import Logger
from txdav.caldav.icalendarstore import ComponentRemoveState
from uuid import UUID
log = Logger()
@inlineCallbacks
def getCalendarObjectForRecord(txn, record, uid):
"""
Get a copy of the event for a calendar u... | {
"content_hash": "9f9344deb3a7648ae9101ad9fbf1b107",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 153,
"avg_line_length": 30.242424242424242,
"alnum_prop": 0.6399465597862392,
"repo_name": "macosforge/ccs-calendarserver",
"id": "1f2e3c44255be3e702596b9082c31a9dd87b66f0",
... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20160901_0830'),
]
operations = [
migrations.DeleteModel(
name='Profesion',
),
]
| {
"content_hash": "2977ac887d44d5112972c58adf3cba43",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 44,
"avg_line_length": 17.9375,
"alnum_prop": 0.5993031358885017,
"repo_name": "mava-ar/sgk",
"id": "309c93171bf7c00a0aef3051ca89e4d39068cf6d",
"size": "359",
"binary": f... |
class FinisherTemplate(object):
def __init__(self, name, description, message, body_message):
self.name = name
self.description = description
self.message = message
self.body_message = body_message
| {
"content_hash": "ad4c010321eb40a7ff7f9f7735bc4ff8",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 65,
"avg_line_length": 39,
"alnum_prop": 0.6538461538461539,
"repo_name": "ChrisLR/Python-Roguelike-Template",
"id": "c15ab848523eafb28f804dcdc923b12cee398b1f",
"size": "234... |
"""gcloud dns record-sets transaction abort command."""
import os
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core import log
class Abort(base.Command):
"""Abort transaction.
This command aborts the transaction and deletes the transaction file.
... | {
"content_hash": "69c23eaa25c3e767f4246e4a8d5a3d39",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 80,
"avg_line_length": 25.40625,
"alnum_prop": 0.6765067650676507,
"repo_name": "wemanuel/smry",
"id": "c202952a18329ea1a098c42f6b1c893d006ce31a",
"size": "864",
"binary"... |
from django.contrib.contenttypes.admin import GenericTabularInline
from django.contrib.contenttypes.models import ContentType
from ordered_model.admin import OrderedModelAdmin
from polymorphic.admin import PolymorphicInlineSupportMixin, StackedPolymorphicInline, PolymorphicParentModelAdmin, \
PolymorphicChildModelA... | {
"content_hash": "fc1a16a4a092651f130138eb87774585",
"timestamp": "",
"source": "github",
"line_count": 908,
"max_line_length": 152,
"avg_line_length": 33.40418502202643,
"alnum_prop": 0.5899244996867891,
"repo_name": "proevo/pythondotorg",
"id": "9af126d39affbb0f6c8ec6467fc85774c78fa6da",
"size": ... |
"""distutils.command.build_clib
Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module."""
__revision__ = "$Id: build_clib.py 58495 2007-10-16 18:12:55Z guido.van.rossum $"
# XXX this module has *lots* of code ripped-off ... | {
"content_hash": "8507cc9b7eef039fcd6e3d15caa1e1e6",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 81,
"avg_line_length": 39.616504854368934,
"alnum_prop": 0.5696605808111751,
"repo_name": "MalloyPower/parsing-python",
"id": "b60237c6854b0d0a83a7b795c3afddfbe7334676",
"... |
"""Feature learning based on sparse filtering"""
# Author: Jan Hendrik Metzen
# License: BSD 3 clause
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
from sklearn.base import BaseEstimator
class SparseFiltering(BaseEstimator):
"""Sparse filtering
Unsupervised learning of features using the spar... | {
"content_hash": "6d950a8fab84e40f1368904b73939adb",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 79,
"avg_line_length": 35.53333333333333,
"alnum_prop": 0.5974756950366706,
"repo_name": "codeaudit/sparse-filtering",
"id": "be8a0cb86f7391ff16577ccff15dd8cbcdbb465f",
"s... |
"""Contains signals"""
# Python imports
from functools import wraps
# Django imports
from django.db.models import signals
# app imports
from oweb.models import Account, Planet, Moon
from oweb.models.research import *
from oweb.models.ship import *
from oweb.models.building import *
from oweb.models.defense import *
d... | {
"content_hash": "f5a947c975bbda0869069e1cf83cc81b",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 90,
"avg_line_length": 42.07741935483871,
"alnum_prop": 0.6965654707145048,
"repo_name": "Mischback/django-oweb",
"id": "17277316bd5de736b11776c8866c7dfecc13cb4a",
"size":... |
from neo.Utils.BlockchainFixtureTestCase import BlockchainFixtureTestCase
from neo.VM.InteropService import StackItem
from neo.VM.ExecutionEngine import ExecutionEngine
from neo.VM.ExecutionContext import ExecutionContext
from neo.SmartContract.StateReader import StateReader
from neo.Core.Block import Block
from neo.Co... | {
"content_hash": "072d3ed76bd400f6006b430db6bd0eaf",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 102,
"avg_line_length": 35,
"alnum_prop": 0.7364145658263306,
"repo_name": "hal0x2328/neo-python",
"id": "19595cfaa0524372dff27cd665cb2f7fc1890354",
"size": "3570",
"bin... |
from ....testing import assert_equal
from ..utils import RelabelHypointensities
def test_RelabelHypointensities_inputs():
input_map = dict(args=dict(argstr='%s',
),
aseg=dict(argstr='%s',
mandatory=True,
position=-3,
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_excep... | {
"content_hash": "4c3a68339da2713f568134a6755c6f13",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 25.365384615384617,
"alnum_prop": 0.6338134950720242,
"repo_name": "dgellis90/nipype",
"id": "e08d447d1ee68f23459a0319e8e33d80ff7f94ca",
"size": "137... |
"""Here is defined the Index class."""
from __future__ import print_function
from __future__ import absolute_import
import math
import operator
import os
import os.path
import sys
import tempfile
import warnings
from time import time, clock
import numpy
from .idxutils import (calc_chunksize, calcoptlevels,
... | {
"content_hash": "31bba3c2f17e1fdb0a6120d70c3dffdf",
"timestamp": "",
"source": "github",
"line_count": 2226,
"max_line_length": 91,
"avg_line_length": 40.9622641509434,
"alnum_prop": 0.5528284091158343,
"repo_name": "andreabedini/PyTables",
"id": "e37b7eafeb84ee5a9e20d7dc51a86307aff40951",
"size":... |
from telemetry.core.timeline_data import TimelineData
class EmptyTimelineDataImporter(object):
"""Imports empty TimlineData objects."""
def __init__(self, model, timeline_data, import_priority=0):
pass
@staticmethod
def CanImport(timeline_data):
if not isinstance(timeline_data, TimelineData):
re... | {
"content_hash": "398da065095e309589403cf55062ab41",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 62,
"avg_line_length": 26.73913043478261,
"alnum_prop": 0.7008130081300813,
"repo_name": "anirudhSK/chromium",
"id": "a7c5b4d66392c282723c4a79cfb2c0d2edcfa032",
"size": "77... |
"""Config flow for DoorBird integration."""
from ipaddress import ip_address
import logging
import urllib
from doorbirdpy import DoorBird
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_USER... | {
"content_hash": "39f2698a2c0b380007cc9681529576f3",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 84,
"avg_line_length": 35.17777777777778,
"alnum_prop": 0.6388186986734049,
"repo_name": "tchellomello/home-assistant",
"id": "8e3f661254df1521be8bba15ad4f03136782411e",
"... |
import datetime
import urllib
from tempest.api.compute import base
from tempest import test
class InstanceUsageAuditLogTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def resource_setup(cls):
super(InstanceUsageAuditLogTestJSON, cls).resource_setup()
cls.adm_client = cls.os_adm.instance_... | {
"content_hash": "9f3f3ded76a7ece01c693d5a285d5cf5",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 40.64102564102564,
"alnum_prop": 0.592429022082019,
"repo_name": "Vaidyanath/tempest",
"id": "16ce93c6184de4ce01a0a4b9b987eb42b90935c4",
"size": "221... |
from logging import Handler
from logtracker.models import *
import traceback
logrecord_keys = ['msecs', 'args', 'name', 'thread', 'created', 'process', 'threadName', 'module', 'filename', 'levelno', 'processName', 'lineno', 'exc_info', 'exc_text', 'pathname', 'funcName', 'relativeCreated', 'levelname', 'msg']
class T... | {
"content_hash": "8f3e7830ce7d9a4149acfdacab368339",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 233,
"avg_line_length": 46,
"alnum_prop": 0.48867753623188404,
"repo_name": "commtrack/commtrack-core",
"id": "232314125cb8f69955f58ce92c3911c856b07474",
"size": "2367",
... |
from collections import defaultdict
from Cookie import SimpleCookie
from cookielib import Cookie
from weakref import ref
from .pool import ConnectionPool
from .request import Request
from .response import Response
MAX_REDIRECTS = 10
class Session(object):
def __init__(self, debuglevel=None):
self._pool ... | {
"content_hash": "f14dc2ad44e435d49da7e0cafb086cb1",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 95,
"avg_line_length": 32.796460176991154,
"alnum_prop": 0.5682676740420939,
"repo_name": "baverman/swoop",
"id": "e540109c0744ee06f4baea53497340b5ffcf1b29",
"size": "3706... |
import numbers
from typing import Type
import warnings
import numpy as np
from pandas._libs import lib
from pandas.compat import set_function_name
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.base import ExtensionDtype
from pandas.core.dtypes.cast import astype_nansafe
from pandas.core.... | {
"content_hash": "04afa9a20154ab58941d03ee8ce47e15",
"timestamp": "",
"source": "github",
"line_count": 867,
"max_line_length": 85,
"avg_line_length": 27.91118800461361,
"alnum_prop": 0.5566345716765155,
"repo_name": "kushalbhola/MyStuff",
"id": "867122964fe592c0b12243e141b71be4ea62ac63",
"size": "... |
from __future__ import division
from vistrails.db.domain import DBPluginData
import unittest
import copy
import random
from vistrails.db.domain import IdScope
import vistrails.core
class PluginData(DBPluginData):
##########################################################################
# Constructors and c... | {
"content_hash": "ef794bccf2200fd0486f89a6e77c5750",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 28.28985507246377,
"alnum_prop": 0.5005122950819673,
"repo_name": "hjanime/VisTrails",
"id": "2beddcc50b31bc9c67c20adef22cf154d0c8aec8",
"size": "386... |
from rest_framework.serializers import (
ModelSerializer,
SerializerMethodField
)
from trialscompendium.trials.api.plot.plotserializers import plot_serializers
from trialscompendium.trials.models import Treatment
from trialscompendium.utils.hyperlinkedidentity import hyperlinked_identity
from trialscompendium.u... | {
"content_hash": "2f59756d7badf1c8e7b889abf17398cc",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 94,
"avg_line_length": 31.82857142857143,
"alnum_prop": 0.5957510472770796,
"repo_name": "nkoech/trialscompendium",
"id": "de7852658e88568656ba18c3d783ca37809fa295",
"size... |
from django.db import models #djangoのベースにあるmodelsから派生させる
class Page(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=256)
description = models.CharField(max_length=1024)
href = models.URLField(max_length=2084)
date_published = models.DateField(auto_now=Tru... | {
"content_hash": "dbe1ee0d46ce2a92df91d94c04f7463d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 78,
"avg_line_length": 41.25581395348837,
"alnum_prop": 0.7294250281848929,
"repo_name": "mdworks2016/work_development",
"id": "4510e4d55898fc986ca16e9a69523fef6d3d56a1",
"... |
"""PostProcessor for serving reveal.js HTML slideshows."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import os
import webbrowser
from tornado import web, ioloop, httpserver
from tornado.httpclient import AsyncHTTPClient... | {
"content_hash": "57fe33eedaa4789cb9743e262c5d6d70",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 95,
"avg_line_length": 34.923809523809524,
"alnum_prop": 0.6086719389146441,
"repo_name": "ArcherSys/ArcherSys",
"id": "9b561c66121329a06b43eb6396a5a5cf8ce7b51d",
"size": ... |
"""Utilities related to dates, times, intervals, and timezones."""
from __future__ import absolute_import, print_function, unicode_literals
import numbers
import os
import random
import time as _time
from calendar import monthrange
from datetime import date, datetime, timedelta, tzinfo
from kombu.utils.functional imp... | {
"content_hash": "b77e17a6f53f4118aeaf6bffa07a3246",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 78,
"avg_line_length": 31.641975308641975,
"alnum_prop": 0.6001560671088568,
"repo_name": "kawamon/hue",
"id": "4783c767942f9868e154192ddfd4d1c75dd58327",
"size": "12839",... |
"""
Create a demo spectrum with a couple of lines in it, and check they look sensible when we resample them.
"""
from math import pi
import numpy as np
from fourgp_degrade import SpectrumResampler
from fourgp_speclib import Spectrum
# Create a really bonkers raster to sample a spectrum on
raster_original = np.concat... | {
"content_hash": "72759f3f479de18033ee44850305df77",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 105,
"avg_line_length": 38.5,
"alnum_prop": 0.6523022432113341,
"repo_name": "dcf21/4most-4gp-scripts",
"id": "5491f4dea270a79231e34e298619b7127914a16f",
"size": "2180",
... |
from django import test
from django_cradmin.templatetags import cradmin_tags
class TestCradminTestCssClass(test.TestCase):
def test_test_css_classes_disabled(self):
with self.settings(DJANGO_CRADMIN_INCLUDE_TEST_CSS_CLASSES=False):
self.assertEqual('', cradmin_tags.cradmin_test_css_class('my-... | {
"content_hash": "a314222f2e95b8d91e5259c04700ce12",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 85,
"avg_line_length": 42.07142857142857,
"alnum_prop": 0.6859083191850595,
"repo_name": "appressoas/django_cradmin",
"id": "dd7dc589d4ccdd8d811c80991f006fea0d258e18",
"siz... |
__author__ = 'juan'
import remote_database
import glob
db = remote_database.database()
files = glob.glob("*.txt")
print files
for file in files:
try:
file = open(file,"r")
try:
lines = file.readlines()
finally:
file.close()
except IOError:
pas... | {
"content_hash": "00128700d83cb5b24fd62ac60409df75",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 37,
"avg_line_length": 16.666666666666668,
"alnum_prop": 0.5425,
"repo_name": "aitoralmeida/eu-elections",
"id": "6ff6e48997ace4453f3890b2436d84461ed656c0",
"size": "400",
... |
from ftp import FtpUpload | {
"content_hash": "a4fdf12f6ffa3f1d5eeab55e238f48f2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 25,
"avg_line_length": 25,
"alnum_prop": 0.88,
"repo_name": "tspycher/python-blogengine",
"id": "aaa47c06e335da2da0221899f3ec47240059145a",
"size": "25",
"binary": false,
... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | {
"content_hash": "8a9e62fa9b99afed8263e6d083539617",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 80,
"avg_line_length": 37.16216216216216,
"alnum_prop": 0.6334545454545455,
"repo_name": "jbedorf/tensorflow",
"id": "d7f2446d355dd8ee98c37a6ff8179c19e2e721df",
"size": "6... |
import os
from logging.config import fileConfig
from flask import Flask, request, jsonify
from flask_apscheduler import APScheduler
from flask_googlemaps import GoogleMaps
from flask_mongoengine import MongoEngine
from werkzeug.exceptions import HTTPException
# MongoEngine instance used in the app
db = MongoEngine()
... | {
"content_hash": "9d33eb1e7913a312b5f296bd76cf57ee",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 93,
"avg_line_length": 27.139240506329113,
"alnum_prop": 0.6735074626865671,
"repo_name": "ksluckow/foodtrucklocator",
"id": "cb97930fa407a83fd20239bf64fc39ca258c8c15",
"si... |
"""
InformationMachineAPILib.Models.GetProductAlternativeTypesWrapper
"""
from InformationMachineAPILib.APIHelper import APIHelper
from InformationMachineAPILib.Models.ProductAlternativeTypeInfo import ProductAlternativeTypeInfo
from InformationMachineAPILib.Models.MetaBase import MetaBase
class GetProductAlt... | {
"content_hash": "9f6c10c8c8d166bce86b654e71366381",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 97,
"avg_line_length": 35.94117647058823,
"alnum_prop": 0.6134206219312602,
"repo_name": "information-machine/information-machine-api-python",
"id": "2580f6d16f18caf0c47f081b... |
""" discover and run doctests in modules and test files."""
from __future__ import absolute_import
import traceback
import pytest, py
from _pytest.python import FixtureRequest
from py._code.code import TerminalRepr, ReprFileLocation
def pytest_addoption(parser):
parser.addini('doctest_optionflags', 'option flags ... | {
"content_hash": "03fc2b85015f531f23a2a4686063e509",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 95,
"avg_line_length": 36.86153846153846,
"alnum_prop": 0.5977671118530885,
"repo_name": "gabrielcnr/pytest",
"id": "fd4a24790b8f7839544c4c274c5356079471f3a3",
"size": "95... |
"""Generic FAQ Wizard.
This is a CGI program that maintains a user-editable FAQ. It uses RCS
to keep track of changes to individual FAQ entries. It is fully
configurable; everything you might want to change when using this
program to maintain some other FAQ than the Python FAQ is contained in
the configuration... | {
"content_hash": "3951ddedc38ad4841794f9f427b3e502",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 89,
"avg_line_length": 30.491082045184303,
"alnum_prop": 0.4784541590297547,
"repo_name": "google/google-ctf",
"id": "babb42658210d49d626d0b9c1eeb8d0633355f67",
"size": "2... |
from __future__ import absolute_import
from sfepy.base.base import Struct
from sfepy.solvers.solvers import Solver, use_first_available
class AutoFallbackSolver(Solver):
"""
Base class for virtual solvers with the automatic fallback.
"""
_ls_solvers = []
def __new__(cls, conf, **kwargs):
... | {
"content_hash": "3a9526af9d4354c2612e436d37b32d7c",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 29.107692307692307,
"alnum_prop": 0.6025369978858351,
"repo_name": "BubuLK/sfepy",
"id": "2e112a3cec9d237d85caead5c97d533414d09cb4",
"size": "1892",
... |
import web
import sys, logging
from wsgilog import WsgiLog
#import config
# Copied this code from:
# http://stackoverflow.com/questions/7192788/how-do-i-redirrect-the-output-in-web-py
class WebLog(WsgiLog):
def __init__(self, application):
WsgiLog.__init__(
self,
application,
logformat = web.... | {
"content_hash": "8323f01c27428a344be68774b5efb424",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 112,
"avg_line_length": 30.236842105263158,
"alnum_prop": 0.6318537859007833,
"repo_name": "jimboca/ISYHelper",
"id": "23a4e5c97e2d806f082372e54a46133ed9d64a48",
"size": "1... |
from __future__ import print_function
from collections import defaultdict
from os import listdir
from os.path import abspath, basename, dirname, isdir, isfile, join, realpath, relpath, splitext
import re
from subprocess import Popen, PIPE
import sys
# Runs the tests.
WREN_DIR = dirname(dirname(realpath(__file__)))
WR... | {
"content_hash": "c2496925760c212f05bddf28f754c22c",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 96,
"avg_line_length": 27.89679715302491,
"alnum_prop": 0.6088786835055492,
"repo_name": "robotii/Wren.NET",
"id": "d4e04d6e37422e4ce524ac0eb1a212d4eae31d0f",
"size": "786... |
"""Tests for AddNodeNotificationTransformer"""
import unittest
from o2a.converter.task import Task
from o2a.converter.task_group import ActionTaskGroup, ControlTaskGroup
from o2a.converter.workflow import Workflow
from o2a.o2a_libs.property_utils import PropertySet
from o2a.transformers.add_node_notificaton_transforme... | {
"content_hash": "d6871dd3dd8cebfafd4fae60c78eca87",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 108,
"avg_line_length": 34.24033149171271,
"alnum_prop": 0.5916095199677289,
"repo_name": "GoogleCloudPlatform/oozie-to-airflow",
"id": "1bc00f765f71c5f2598d69e1f968d202e62a... |
"""
Manwë resource fields.
.. moduleauthor:: Martijn Vermaat <martijn@vermaat.name>
.. Licensed under the MIT license, see the LICENSE file.
"""
import dateutil.parser
class Field(object):
"""
Base class for resource field definitions.
A field definition can convert field values from their API repres... | {
"content_hash": "5d7a639b3b00fa9b6a373314e4e6ca7b",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 78,
"avg_line_length": 29.22222222222222,
"alnum_prop": 0.60412401286926,
"repo_name": "fmin2958/manwe",
"id": "38f4ef1d27511d947002fa1fabbd317826957842",
"size": "6863",
... |
from django.shortcuts import render
# Currently we are using the default Django auth views, at some point we will
# want to write our own views here | {
"content_hash": "46f90694ea4853303a4ff25633dc6221",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 78,
"avg_line_length": 37.75,
"alnum_prop": 0.7814569536423841,
"repo_name": "mcdermott-scholars/mcdermott",
"id": "5866f44c9593cfe8faa34a50cd2fd2cdd078b1e0",
"size": "151",... |
VERSION = (0, 3, 5)
__version__ = '.'.join(map(str, VERSION))
class PaymentProviderException(Exception):
def __init__(self, message, *args, **kwargs):
super(PaymentProviderException, self).__init__(message, *args, **kwargs)
payment_providers = {}
def register_provider(name, provider):
payment_provi... | {
"content_hash": "f1094a4d9640d3c59b44bb438cd8a696",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 26.307692307692307,
"alnum_prop": 0.6695906432748538,
"repo_name": "feinheit/zipfelchappe",
"id": "b1c19441fe40087665caeda0731ef83bf68b466b",
"size":... |
"""Run all of the unit tests for this package."""
from __future__ import print_function
import sys
import pytest
from ._compat import input
try:
import System
except ImportError:
print("Load clr import hook")
import clr
clr.AddReference("Python.Test")
clr.AddReference("System.Collections")
... | {
"content_hash": "525b9c198bff6ff802953792b2e5d0e7",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 24.594594594594593,
"alnum_prop": 0.676923076923077,
"repo_name": "vmuriart/pythonnet",
"id": "8011d05e62b4a6ea87aebfa52bffe9203f2cb45b",
"size": "95... |
from cloud4rpi import utils
class Device(object):
def __init__(self, api):
def on_command(cmd):
self.__on_command(cmd)
self.__api = api
self.__api.on_command = on_command
self.__variables = {}
self.__diag = {}
@staticmethod
def __resolve_binding(bindin... | {
"content_hash": "3fcf02a6408341ac818339762e83bfa0",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 78,
"avg_line_length": 31.419642857142858,
"alnum_prop": 0.539357772094345,
"repo_name": "cloud4rpi/cloud4rpi",
"id": "d6f47b1c0c8b8cfcf0394ea8062954e5f226a936",
"size": "... |
import abc
class SnmpSenderBase(object, metaclass=abc.ABCMeta):
"""Abstract Vitrage snmp trap sender"""
@abc.abstractmethod
def send_snmp(self, alarm_data):
pass
| {
"content_hash": "8510ebdd81078d6c40a10a4adfc13067",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 52,
"avg_line_length": 20.555555555555557,
"alnum_prop": 0.6864864864864865,
"repo_name": "openstack/vitrage",
"id": "3fedf4cf551d7ab83a9aafedaa0351d959af3e4e",
"size": "752... |
from Bio import pairwise2, Entrez, SeqIO
from Bio.SubsMat import MatrixInfo as matlist
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio.Blast import NCBIXML
import tensorflow as tf
from urllib.request import urlopen
from urllib.parse import urlparse
from subprocess import call, check_output, run
f... | {
"content_hash": "99829f04fde8bf87bcd4899b2b06976e",
"timestamp": "",
"source": "github",
"line_count": 3837,
"max_line_length": 288,
"avg_line_length": 35.60672400312745,
"alnum_prop": 0.5648975648316902,
"repo_name": "alec-djinn/alefuncs",
"id": "8245ec825ff9d6835695e398905a1e1d5686a6e1",
"size":... |
"""
.. module: security_monkey.tests.watchers.openstack.test_instance
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Michael Stair <mstair@att.com>
"""
from security_monkey.tests.watchers.openstack import OpenStackWatcherTestCase
class OpenStackInstanceWatcherTestCase(OpenStackWatcherTestCase):
... | {
"content_hash": "b4a4220fb292ca0f65ba6e1caa9a483d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 99,
"avg_line_length": 36.75,
"alnum_prop": 0.7687074829931972,
"repo_name": "Netflix/security_monkey",
"id": "5965b98b87f12f9fc9a1d42118ea8c1c88c2b5b8",
"size": "1244",
... |
from elixir.statements import Statement
from elixir import Entity, has_field, using_options, Integer, Unicode
from sqlalchemy import and_
import types
class Tag(Entity):
has_field('target_id', Integer)
has_field('target_table', Unicode)
has_field('tagname', Unicode)
using_options(tablename='tags')
cl... | {
"content_hash": "6bd99087d97aee87300533289d4c7c34",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 77,
"avg_line_length": 35.01639344262295,
"alnum_prop": 0.5987827715355806,
"repo_name": "gjhiggins/elixir",
"id": "e945299ae3994c80314e6107e8de2cab8c20d64d",
"size": "2136... |
"""
Command dispatcher module
"""
import main
import manage
def dispatcher(*args):
lookup = {
'add': main.add,
'update': main.update,
'check': main.check_database,
'manage': manage.entry,
}
if len(args) == 0:
main.main()
else:
lookup[args[0]](*(args[1:]... | {
"content_hash": "d3815defccea78576d64fcbb38eaa1d2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 37,
"avg_line_length": 17,
"alnum_prop": 0.5294117647058824,
"repo_name": "Ayase-252/auto-anime-downloader",
"id": "d434bbc1268817d05f1fdc57bf08bf65bdde1858",
"size": "323"... |
from tia.bbg.v3api import *
LocalTerminal = Terminal('localhost', 8194)
from tia.bbg.datamgr import *
| {
"content_hash": "ee7ae855fc53cb75615337d9fb6bb10a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 43,
"avg_line_length": 20.8,
"alnum_prop": 0.75,
"repo_name": "bpsmith/tia",
"id": "63f20884c11ce07356a0003f24206d33168f5c45",
"size": "104",
"binary": false,
"copies": ... |
import socket, ssl
class PortScanner:
""" Finds open paths between this host and a specified host """
def __init__(self, target):
""" Initializes the port scanner with the specified target host"""
self.target_host = target
def run_scan(self):
""" Runs a scan against a collection... | {
"content_hash": "cefd7ad9311cda42b57f90a23cda4664",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 33.06896551724138,
"alnum_prop": 0.5422314911366006,
"repo_name": "dgarant/weasel",
"id": "e0554a6d2b5b6279fb7c1cc85b28bf836efa3b53",
"size": "959",
... |
from selenium.common.exceptions import NoAlertPresentException, NoSuchElementException
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from tempfile import NamedTemporaryFile
from selenese.locators import create_locator
from selenese.patterns import creat... | {
"content_hash": "e8809b6133b460cc7bb3932e4862454e",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 97,
"avg_line_length": 33.18250950570342,
"alnum_prop": 0.6343531568694855,
"repo_name": "Lukas-Stuehrk/selenese",
"id": "6ec9e7c7343fd31c6fbf50d46354d8bc07e72583",
"size"... |
import zmq
from control4.misc.randomness import random_string
from control4.misc.collection_utils import chunk_slices
from control4.parallel.parallel import PoolBase,get_cpu_count
import os,time
def child_process_loop(addr):
context = zmq.Context() #pylint: disable=E1101
socket = context.socket(zmq.REP) #pylint... | {
"content_hash": "801a26216b99340c7178a0b7fe3a19ac",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 131,
"avg_line_length": 34.02857142857143,
"alnum_prop": 0.5443604813881892,
"repo_name": "SFPD/rlreloaded",
"id": "0098b21df8da1f4f49f706157c279a3706c89721",
"size": "357... |
import plugins, os, string, shutil, sys, logging, glob
from ConfigParser import ConfigParser, NoOptionError
from copy import copy
from ordereddict import OrderedDict
plugins.addCategory("bug", "known bugs", "had known bugs")
plugins.addCategory("badPredict", "internal errors", "had internal errors")
plugins.addCategor... | {
"content_hash": "87ab75ffe9b3758072cd8f37b782ee86",
"timestamp": "",
"source": "github",
"line_count": 526,
"max_line_length": 149,
"avg_line_length": 41.2148288973384,
"alnum_prop": 0.6161723326721712,
"repo_name": "emilybache/texttest-runner",
"id": "e65cee7fcf6de87fcb9449c0900c4712dc9533da",
"s... |
import re, os, subprocess, select, time, datetime
import tests, debug, siteconfig
from common import TestCommon, TimeoutError, select_timeout
from results import RowResults
# TODO: this test needs a control loop like the httperf test to
# ramp up the load until it saturates. currently it just runs N
# iterations of a ... | {
"content_hash": "b26c34817f251bd99689aaa55b578a27",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 82,
"avg_line_length": 39.40880503144654,
"alnum_prop": 0.5647941270347909,
"repo_name": "BarrelfishOS/barrelfish",
"id": "56db9071fc1aa004c5e6482d06480afb17dc6541",
"size... |
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.messages import error
from django.contrib.comments.signals import comment_was_posted
from django.core.urlresolvers import reverse
from django.db.models import get_model, ObjectDoesNotExist
from django.http import HttpResponse, H... | {
"content_hash": "2cca3cd6feafe76ba0ef21ced15102d6",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 78,
"avg_line_length": 43.42307692307692,
"alnum_prop": 0.6260702686743431,
"repo_name": "guibernardino/mezzanine",
"id": "f2931c7e6857123d5fcfb9bcd0cfaae0ab71dcd7",
"size... |
import argparse
import multiprocessing
import warnings
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import generic_protein
from sklearn.externals import joblib
from sklearn.preprocessing import normalize
from lib.hmmer import hmmstats
from lib.hmmer import hmmscan
def ... | {
"content_hash": "161e026d1613d1ee0ca0cda621d24c2e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 117,
"avg_line_length": 38.88172043010753,
"alnum_prop": 0.6219579646017699,
"repo_name": "trappedInARibosome/go-model",
"id": "18f1928d089daae1c4dd975acbdaac70d0fda4dd",
"... |
"""
Module : symbol_table
Function : Contains class and function definitions used to implement a symbol table
"""
import ir_generation as IR
class SymTabEntry(object):
SCALAR, ARRAY, HASH = range(3)
def __init__(self, variable):
self.scopeNum = -1 # Indicates the fact that it has not ... | {
"content_hash": "05f21d755fe88726459a6cdd963f669e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 142,
"avg_line_length": 31.493827160493826,
"alnum_prop": 0.6103488827910624,
"repo_name": "vaishious/comperler",
"id": "6c768f3b6bc7069e1762cdaa083ada4495eb4d98",
"size":... |
"""Manage class and methods for all types of indicators."""
from ast import literal_eval
from typing import List
import logging
import os
import pandas
from data_source import DataSource
from constants import IndicatorType
import utils
# Load logging configuration
log = logging.getLogger(__name__)
class Indicator:
... | {
"content_hash": "b7b16e89ffa7ad33b3f8da2e35b5d799",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 209,
"avg_line_length": 46.13868613138686,
"alnum_prop": 0.6568580920740389,
"repo_name": "alexisrolland/data-quality",
"id": "21a02857e9991e9c378b9019d52bbc904642d36c",
"... |
"""
Tests project generation
"""
import mmap
import os
import re
from distutils.util import strtobool
import typing
from binaryornot.check import is_binary
from pytest_cookies.plugin import Cookies
import pytest
PATTERN = r"{{(\s?cookiecutter)[.](.*?)}}"
RE_OBJ = re.compile(PATTERN)
EXPECTED_BASE_BAKED_FILES = ... | {
"content_hash": "f61f483094198c7da41d4dbe991632e9",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 78,
"avg_line_length": 33.432291666666664,
"alnum_prop": 0.6306278236485434,
"repo_name": "ryankanno/cookiecutter-py",
"id": "af2c7daffea6b5f03b6e766425f0e7c6772ba220",
"s... |
from __future__ import print_function
import os, sys
import json
import datetime
import argparse
from github import Github
from bearlib.config import Config
def getUser(o):
result = {}
if o is not None:
result['login'] = o.login
result['name'] = o.name
result['id'] = o.id
ret... | {
"content_hash": "4426b2e1441195f154d7f2632946df4d",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 70,
"avg_line_length": 33.19,
"alnum_prop": 0.4754444109671588,
"repo_name": "bear/github-archive",
"id": "7c095ddeb90d8d42371e582fbde3e8b442355742",
"size": "3431",
"bi... |
from __future__ import print_function
import cx_Oracle
import db_config
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
print(cx_Oracle.version)
print("Database version:", con.version)
print("Client version:", cx_Oracle.clientversion())
| {
"content_hash": "4ebec1ec9b2146fcc18159e07e4f0214",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 68,
"avg_line_length": 26.1,
"alnum_prop": 0.7547892720306514,
"repo_name": "kawamon/hue",
"id": "513ac30cd013acd5e02096a8ef1dd493a0360437",
"size": "686",
"binary": fals... |
import pygame
from SystemPanic.Core.draw_util import draw_text
def draw_game_over_screen(game_surface, game_state):
# Add the background
game_surface.blit(
game_state["active_config"]["background"],
[0, 0]
)
draw_text(game_surface, "GAME OVER", (160, 120), game_state["garbled"])
... | {
"content_hash": "87df1e0a6075641ee6d24a1f6a9ce3e7",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 107,
"avg_line_length": 40.76086956521739,
"alnum_prop": 0.6325333333333333,
"repo_name": "xaroth8088/SystemPanic",
"id": "c8c23580df1960d874ca4cda6d8774aee57df846",
"size"... |
import sys
# NullWriter defines a dummy file object which does nothing with its output
class NullWriter:
def write(self, s):
pass
# BeQuiet allows stderr output to be temporarily suppressed:
#
# with BeQuiet():
# stuff stuff stuff
class BeQuiet:
def __enter__(self):
self.old_stderr = sys.s... | {
"content_hash": "a5cb0e70de1d329f454ed94f8326dffa",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 75,
"avg_line_length": 24.77777777777778,
"alnum_prop": 0.6614349775784754,
"repo_name": "BinaryMuse/moodle-tools",
"id": "2b2975fe79f4920bc526d4c8f629b988b28ccb6a",
"size"... |
r"""
Check Python source code formatting, according to PEP 8.
For usage and a list of options, try this:
$ python pep8.py -h
This program and its regression test suite live here:
http://github.com/jcrocholl/pep8
Groups of errors and warnings:
E errors
W warnings
100 indentation
200 whitespace
300 blank lines
400 imp... | {
"content_hash": "179c1f9bbef7e481637f55307c356bb3",
"timestamp": "",
"source": "github",
"line_count": 1917,
"max_line_length": 79,
"avg_line_length": 38.48982785602504,
"alnum_prop": 0.5575930067086806,
"repo_name": "dguo-coursera/arcanist",
"id": "450dcdf4b99f24598654b069ec3b3302d22f2bc5",
"size... |
def shifList(numbers , n ):
if(n-1 < 0):
return numbers
numbers[n] = numbers[n-1];
return numbers ;
def findIndex(numbers , num ):
for i in range(0 , len(numbers)):
if(numbers[i] > num ):
return i
return len(numbers)-1
def printList(numbers):
strp = ""
for i in range(0 , len(numbers)):
strp += str(... | {
"content_hash": "000a56d9c9268c0ad9de846dd8b0f233",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 57,
"avg_line_length": 21.514285714285716,
"alnum_prop": 0.6294820717131474,
"repo_name": "MajidLashgarian/HackerRank",
"id": "c495acba7a7ea527e1d04555bcb090372fe1bafb",
"s... |
from django.utils.translation import gettext as _
import plotly.offline as plotly
import plotly.graph_objs as go
from reports import utils
def bmi_bmi(objects):
"""
Create a graph showing bmi over time.
:param objects: a QuerySet of BMI instances.
:returns: a tuple of the the graph's html and javasc... | {
"content_hash": "77d6adae21b9e54ab5d0842c40c3e910",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 74,
"avg_line_length": 31.939393939393938,
"alnum_prop": 0.6375711574952562,
"repo_name": "cdubz/babybuddy",
"id": "355a453a4269dc517ea2f13b652666dfc2778f89",
"size": "1078... |
from typing import Union
from fastapi import Body, FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: Union[str, None] = None
price: float
tax: Union[float, None] = None
class User(BaseModel):
username: str
full_name: Union[str, None] = Non... | {
"content_hash": "75bf0c9284b393025fbe6621a5af95cd",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 88,
"avg_line_length": 19.757575757575758,
"alnum_prop": 0.6211656441717791,
"repo_name": "tiangolo/fastapi",
"id": "beea7d1e38ff89b95418697f7fa416ea84930816",
"size": "652... |
from sheetDB.table import *
from nose.tools import *
from mock import patch, MagicMock
# main class tests
@patch('sheetDB.table.Table.fetchFromParent')
@patch('sheetDB.table.Table.updateHeader')
@patch('sheetDB.table.Table.updateConstraints')
@patch('sheetDB.table.Table.fetchRowLabels')
@patch('sheetDB.table.reverseD... | {
"content_hash": "6687f280d1c3df3a1516b90f9bb8b0c5",
"timestamp": "",
"source": "github",
"line_count": 559,
"max_line_length": 78,
"avg_line_length": 41.09660107334526,
"alnum_prop": 0.6683498019414095,
"repo_name": "knyte/sheetDB",
"id": "5fb8251b72af7c44838da7677dcbf7a614d2c28c",
"size": "23005"... |
from typing import Dict, Union # pylint: disable=unused-import
import time
import apache_beam as beam
import fastavro
from gcp_variant_transforms.beam_io import vcf_header_io # pylint: disable=unused-import
from gcp_variant_transforms.beam_io import vcf_parser
from gcp_variant_transforms.libs import hashing_util
f... | {
"content_hash": "d391d14e526908ce5e2d7774e508d893",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 89,
"avg_line_length": 39.61971830985915,
"alnum_prop": 0.6871667259153929,
"repo_name": "googlegenomics/gcp-variant-transforms",
"id": "855db68818679f762922fc0de586b82f3d1a4... |
import k3d
import numpy as np
from k3d.colormaps import matplotlib_color_maps
from k3d.helpers import map_colors
from numpy.linalg import norm
from k3d.headless import k3d_remote, get_headless_driver
def generate():
p = np.linspace(-1, 1, 10)
def f(x, y, z):
return y * z, x * z, x * y
vectors = ... | {
"content_hash": "2aaa8f8bb32daf0f7ad25650f8d20193",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 85,
"avg_line_length": 30.9,
"alnum_prop": 0.5711974110032363,
"repo_name": "K3D-tools/K3D-jupyter",
"id": "35d4c7d2f4f7c3805d067e038089605625f7c32d",
"size": "1236",
"bi... |
"""
BOSH OpenStack Ironic CPI
"""
# Python 2 and 3 compatibility
from __future__ import unicode_literals
import re
import time
class CPISettings(object):
_instance = None
_string_booleans_true = ['1', 'yes', 'true', 'on']
_re_macaddr = re.compile("^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$")
def __ne... | {
"content_hash": "c0c6c7924bdd702ae588aa3e9525e0e9",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 81,
"avg_line_length": 33.39622641509434,
"alnum_prop": 0.572316384180791,
"repo_name": "jriguera/bosh-ironic-cpi-release",
"id": "b6f7d2b70bec6765f89b740eec7687547c0bdb66",
... |
from keystone.common import sql
from keystone.common.sql import migration
from keystone import exception
from keystone.openstack.common.db.sqlalchemy import session as db_session
class ProjectEndpoint(sql.ModelBase, sql.DictBase):
"""project-endpoint relationship table."""
__tablename__ = 'project_endpoint'
... | {
"content_hash": "b301e8fb8e892b913d97c7635c23d2b5",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 74,
"avg_line_length": 41.46969696969697,
"alnum_prop": 0.6225794665692364,
"repo_name": "derekchiang/keystone",
"id": "d0d02f1c9fdb9bdff3b0ca300da4a65b7fc49540",
"size": "... |
import json
import boto3
import os
import requests
import StringIO
from flask import send_file
from botocore.exceptions import ClientError
from threading import Thread
from time import sleep
client = boto3.client('s3')
resource = boto3.resource('s3')
region = 'eu-west-1'
def pather(*args):
return "/".join([arg for... | {
"content_hash": "b62420d6950283f6967756077e4221e7",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 70,
"avg_line_length": 26.104761904761904,
"alnum_prop": 0.4914264866836921,
"repo_name": "martyni/not_db",
"id": "a0eec6c6dc8cb561021a22607ed6f49bef313468",
"size": "2741... |
"""
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import logging
import os
import re
from ctypes import CD... | {
"content_hash": "2c4232e55e0e5bfd57eb74eee1f9094c",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 95,
"avg_line_length": 31.347826086956523,
"alnum_prop": 0.6584989983048235,
"repo_name": "evansd/django",
"id": "810161ffebb757727d892e4314aa5de213432894",
"size": "6489"... |
'''
====================================================================================
Copyright 2013, 2014 Windy Darian (大地无敌), Studio "Sekai no Kagami"
(世界之镜制作组) of Seven Ocean Game Arts (七海游戏文化社
, 北京航空航天大学学生七海游戏文化社) @ http://sogarts.com
Licensed under the Apache License, Version 2.0 (the "Lic... | {
"content_hash": "e2546ad6e41ed3e0e9a3dc963feec8f7",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 124,
"avg_line_length": 31.523489932885905,
"alnum_prop": 0.5507770917606983,
"repo_name": "WindyDarian/Sogal",
"id": "1da39369c755dd4235499a557ae7dd6d131d1107",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.