text stringlengths 4 1.02M | meta dict |
|---|---|
import re
from unittest import mock
import grpc
import pytest
from celery.states import EXCEPTION_STATES, PROPAGATE_STATES, SUCCESS
from clearly.client import ClearlyClient, ModeTask, ModeWorker
from clearly.client.client import Modes
from clearly.protos.clearly_pb2 import Null, PatternFilter, RealtimeMessage, SeenTa... | {
"content_hash": "c09411baa42002c8e091cfb17bb9901f",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 96,
"avg_line_length": 37.67048710601719,
"alnum_prop": 0.6918688674222256,
"repo_name": "rsalmei/clearly",
"id": "e02e1b2e520f54145e7828738efb9ae5820a87a5",
"size": "1314... |
import platform
import unittest
import warnings
from test.test_support import (fcmp, have_unicode, TESTFN, unlink,
run_unittest, _check_py3k_warnings, check_warnings)
from operator import neg
import sys, cStringIO, random, UserDict
# count the number of test runs.
# used to ski... | {
"content_hash": "efbc67618ea210e61eab4d563d7b4201",
"timestamp": "",
"source": "github",
"line_count": 1604,
"max_line_length": 99,
"avg_line_length": 37.08416458852868,
"alnum_prop": 0.5174251466805642,
"repo_name": "babyliynfg/cross",
"id": "9261efb2bf3b7e0b581f2d71f6156588a0dbcbc2",
"size": "59... |
from __future__ import absolute_import
from .preparer import Preparer # NOQA
| {
"content_hash": "6ae34a4389df239497203239e310274a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 38,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.759493670886076,
"repo_name": "mvaled/sentry",
"id": "bdd469843998b7d42e0ae26ba57fe7bf88757e5c",
"size": "79",
"... |
import os, sys
import os.path as osp
import argparse
import scipy.io as sio
this_dir = osp.dirname(__file__)
sys.path.insert(1, osp.join(this_dir, '../../external/'))
from vdetlib.utils.protocol import proto_dump, path_to_index, proto_load, annot_boxes_at_frame
from vdetlib.utils.common import iou
import numpy as np
d... | {
"content_hash": "4b393897ad2c65fee3e37efc11107538",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 94,
"avg_line_length": 36.742574257425744,
"alnum_prop": 0.511991376987335,
"repo_name": "myfavouritekk/TPN",
"id": "a83e676f28203568cbbaafa363af248222a9d015",
"size": "37... |
"""Pervasive/commonly-used utilities."""
import abc
import datetime as dt
import errno
import hashlib
import math
import re
import six
import socket
import ssl
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
from oslo_log import log as logging
from oslo_utils import units
from pyasn1.... | {
"content_hash": "c6efd3f869f5be2ffc67ea13baf2a572",
"timestamp": "",
"source": "github",
"line_count": 620,
"max_line_length": 79,
"avg_line_length": 39.38548387096774,
"alnum_prop": 0.6161595478930341,
"repo_name": "powervm/pypowervm",
"id": "aff9a8b2b4eb7ddbeed8969609deed2d4b154b03",
"size": "25... |
"""
Test the iosconfig Execution module.
"""
import textwrap
import salt.modules.iosconfig as iosconfig
# Import Salt modules
from salt.utils.odict import OrderedDict
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
class TestModulesIOSConfig(TestCase, LoaderModuleMock... | {
"content_hash": "4834cfbb6e7c7945ecbd82bcab107687",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 86,
"avg_line_length": 30.932806324110672,
"alnum_prop": 0.4543828264758497,
"repo_name": "saltstack/salt",
"id": "d8b6dd1d69a32912285feebdc6ed7dcda91230ab",
"size": "7826... |
from json import loads,dumps
import importlib as imp
import pip
import sys
from time import sleep
debug = True
# dependency Installer and installer
class Installer(object):
def __init__(self, Uninstall= False):
print("Fetching data...")
jsonFile="modules.json"
self.data = self.fetchJson(j... | {
"content_hash": "78c7512245b3288f38a45722f3de3622",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 109,
"avg_line_length": 30.325581395348838,
"alnum_prop": 0.5465235173824131,
"repo_name": "joshsbirch/assistant",
"id": "014406beabb3f52525b48126ef27397b5f6625d1",
"size"... |
from bson.objectid import ObjectId
from celery.task import Task
from apps.social.models import MSharedStory, MSocialProfile, MSocialServices, MSocialSubscription
from django.contrib.auth.models import User
from utils import log as logging
class PostToService(Task):
def run(self, shared_story_id, service):
... | {
"content_hash": "53c3989d6e22152f52dbb778d0be957a",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 114,
"avg_line_length": 35.39795918367347,
"alnum_prop": 0.6555203228596137,
"repo_name": "Einsteinish/PyTune3",
"id": "f6727e96eb2672f0476c3abd62f01337e9df45cc",
"size": "... |
TRAIN_FILE = 'train.txt'
TRAIN_DB = 'train_db'
VAL_FILE = 'val.txt'
VAL_DB = 'val_db'
TEST_FILE = 'test.txt'
TEST_DB = 'test_db'
MEAN_FILE_IMAGE = 'mean.jpg'
# Classification jobs
LABELS_FILE = 'labels.txt'
DEFAULT_BATCH_SIZE = 16
# Caffe Protocol Buffers
MEAN_FILE_CAFFE = 'mean.binaryproto'
| {
"content_hash": "c8a98985d4776be69db3c8754472ad9c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 36,
"avg_line_length": 18.5625,
"alnum_prop": 0.6868686868686869,
"repo_name": "RadicoLabs/DIGITS",
"id": "b9b8ec9c5575b0ec6fbbcc810243c61b468f9ce4",
"size": "378",
"bina... |
import numpy as _np
from DeepFried2 import floatX as _floatX
def data(T, N, nterms=2):
"""
`T` is the sequence length, `N` is the number of sequences and `nterms` is
the amount of terms that should be "active" in the stream.
Returned array is of shape (N, T, 2)
"""
X = _np.random.rand(N, T).as... | {
"content_hash": "192f16562ef1a227c13a56b1108e8ea3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 109,
"avg_line_length": 33.19047619047619,
"alnum_prop": 0.6169296987087518,
"repo_name": "yobibyte/DeepFried2",
"id": "cb6c4d716775269c96becde3867e180193c3cfa8",
"size": "... |
"""Utilities related to glance image management for the PowerVM driver."""
from nova import utils
def stream_blockdev_to_glance(context, image_api, image_id, metadata, devpath):
"""Stream the entire contents of a block device to a glance image.
:param context: Nova security context.
:param image_api: Ha... | {
"content_hash": "a7629b6e11763a1f52c00ca86e554ec4",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 79,
"avg_line_length": 37.170212765957444,
"alnum_prop": 0.6514024041213509,
"repo_name": "gooddata/openstack-nova",
"id": "1d8e497e85a4684d449c252da5a3748ef05b29a2",
"size... |
"""Init for `cltk.lemmatize`."""
from .processes import *
| {
"content_hash": "375bf374927c3511c376ba4dfebee353",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 32,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.6290322580645161,
"repo_name": "diyclassics/cltk",
"id": "22a16fa700282bb8d732affff67d4958eddaf850",
"size": "62",... |
from __future__ import absolute_import, unicode_literals
# Import the fastest implementation of
# pickle package. This should be removed
# when python3 come the unique supported
# python version
try:
import cPickle as pickle
except ImportError:
import pickle
import json
import msgpack
from django.core.except... | {
"content_hash": "f42e5c069ba49cd94ea4df3edd4cdd24",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 85,
"avg_line_length": 26.044776119402986,
"alnum_prop": 0.6893982808022923,
"repo_name": "zl352773277/django-redis",
"id": "6c3a791b684f9dd3339b4781246065e160d6c0e8",
"siz... |
"""
.. module: security_monkey.auditors.sqs
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Denver Janke <denverjanke@gmail.com>
"""
from security_monkey.auditors.resource_policy_auditor import ResourcePolicyAuditor
from security_monkey.watchers.sqs import SQS
class SQSAuditor(ResourcePolicyAuditor)... | {
"content_hash": "d19bdd95ed841f78628ecd24672406df",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 82,
"avg_line_length": 27.61904761904762,
"alnum_prop": 0.7034482758620689,
"repo_name": "markofu/security_monkey",
"id": "d409f19b2b6480a2e33b00846bd8c46a90f4f115",
"size"... |
from __future__ import division, print_function, unicode_literals
from Foundation import NSPoint
__doc__="""
Create a center guideline between two guides.
"""
font = Glyphs.font
glyphs = font.glyphs
# get active layer
layer = font.selectedLayers[0]
def average(number1, number2):
return (number1 + number2) / 2.0... | {
"content_hash": "aa124e52c030bf20fef9758f884481f2",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 65,
"avg_line_length": 17.87272727272727,
"alnum_prop": 0.6856561546286877,
"repo_name": "filipenegrao/glyphsapp-scripts",
"id": "db03d4c515c27f3b76471d8b98fcc6dfdf8b4174",
... |
from platform import machine as pm
import logging
import os
import winreg
liblogger = logging.getLogger('steamclean.libproviders')
def winreg_read(keypath, subkeyname):
""" Get provider installation path from reading registry data.
If unable to read registry information prompt user for input. """
system... | {
"content_hash": "2d0e1ca0634b88b3281a8a8719d1d3ed",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 75,
"avg_line_length": 35.73770491803279,
"alnum_prop": 0.6293577981651376,
"repo_name": "evitalis/steamclean",
"id": "32f0e8253163403f7d4c531f5351ed3931004cca",
"size": "2... |
import mock
from st2common.models.db.trigger import TriggerDB
from st2common.transport.publishers import PoolPublisher
import st2reactor.container.utils as container_utils
from st2tests.base import CleanDbTestCase
MOCK_TRIGGER_TYPE = {}
MOCK_TRIGGER_TYPE['id'] = 'trigger-type-test.id'
MOCK_TRIGGER_TYPE['name'] = 'tri... | {
"content_hash": "c22ad0a6e55175440c457d9f96060a47",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 86,
"avg_line_length": 36,
"alnum_prop": 0.7509578544061303,
"repo_name": "pinterb/st2",
"id": "11c4291c4e0ef83a08f54b137a081e896196dfe6",
"size": "1824",
"binary": false... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
print("VAR is '{}'".format(os.environ["VAR"]))
| {
"content_hash": "1a78f8d733185b1f0cc8c7d33ac2a53e",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 82,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.7132867132867133,
"repo_name": "kageiit/buck",
"id": "eb18f87f2a6ef17d2166fa2c4f51f0de8e68836c",
"size": "143",
... |
"""OpenID 2.0 - Requesting Authentication
Ref: https://openid.net/specs/openid-authentication-2_0.html#requesting_authentication
"""
from urllib.parse import urlencode
from uuid import uuid4
from datetime import datetime, timezone
from requests import get
from .utils import create_return_to
class Authentication:
... | {
"content_hash": "1b386fdf11fe8513f052e71a2ad66548",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 104,
"avg_line_length": 32.71287128712871,
"alnum_prop": 0.6083535108958837,
"repo_name": "mac-developer/openid-wargaming",
"id": "48192b791ad102c83ffcc3557765dee1749bfce8",... |
'''
This program demonstrates Laplace point/edge detection using
OpenCV function Laplacian()
It captures from the camera of your choice: 0, 1, ... default 0
Usage:
python laplace.py <ddepth> <smoothType> <sigma>
If no arguments given default arguments will be used.
Keyboard Shortcut... | {
"content_hash": "f9aa30fe5044f8c30f9b8d1eef4313bb",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 148,
"avg_line_length": 34.11940298507463,
"alnum_prop": 0.6119860017497812,
"repo_name": "opencv/opencv",
"id": "f485e5741ce640651977bf541da935e90b75f477",
"size": "2309",... |
import pkg_resources
###### Files ######
# Gene panel:
panel_file = "demo/panel_1.txt"
panelapp_file = "demo/panelapp_test_panel.json"
madeline_file = "demo/madeline.xml"
# Case info
ped_file = "demo/643594.ped"
load_file = "demo/643594.config.yaml"
cancer_load_file = "demo/cancer.load_config.yaml"
clinical_snv_fil... | {
"content_hash": "28cb8f677152514429c861bdaf5d5c2e",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 95,
"avg_line_length": 47.85,
"alnum_prop": 0.7694183211424591,
"repo_name": "Clinical-Genomics/scout",
"id": "02155d956ef5e168f98955a331c1b03e620186b8",
"size": "2871",
... |
import os
def pytest_addoption(parser):
parser.addoption("--no-optional-skip", action="store_true",
help="don't skip any tests with optional dependencies")
def pytest_configure(config):
if config.getoption('no_optional_skip'):
from .tests import helpers
for attr in helper... | {
"content_hash": "2bcd434767788d8998db2e6e6453ff0f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 36.40909090909091,
"alnum_prop": 0.6242197253433208,
"repo_name": "JudoWill/glue",
"id": "50313f5ce39bd78131c0dc8b800ecb49f10624d8",
"size": "801",
... |
import curses
from selenium.common.exceptions import WebDriverException
from libs.javascript.javascriptscript import *
from libs.javascript.javascriptcommands import *
from libs.javascript.jswalker import *
class JavascriptScreen:
def __init__(self, screen, webdriver, curses_util, jsinjector):
self.version=0.1
... | {
"content_hash": "acd5f4579ee208319addb10b6b8e1948",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 79,
"avg_line_length": 28.73015873015873,
"alnum_prop": 0.687292817679558,
"repo_name": "bugbound/webnuke",
"id": "810df3c4132f0648cd1eacd47e13a87350756eeb",
"size": "1810"... |
class VumiError(Exception):
pass
class InvalidMessage(VumiError):
pass
class InvalidMessageType(VumiError):
pass
class MissingMessageField(InvalidMessage):
pass
class InvalidMessageField(InvalidMessage):
pass
class DuplicateConnectorError(VumiError):
pass
class InvalidEndpoint(VumiEr... | {
"content_hash": "c305203a85506ef8b16fdf81f8cca951",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 16.72222222222222,
"alnum_prop": 0.760797342192691,
"repo_name": "vishwaprakashmishra/xmatrix",
"id": "49d9e9d4b16af960173031a887bb2c8b7f5da9e9",
"si... |
import win32ui
import win32api
from pywin.mfc import docview, dialog, window
import win32con
import string
import re
import glob
import os
import stat
import glob
from . import scriptutils
def getsubdirs(d):
dlist = []
flist = glob.glob(d+'\\*')
for f in flist:
if os.path.isdir(f):
dlist.append(f)
dlist = d... | {
"content_hash": "bc5ad7e865a6b53ea6ee676151d4315f",
"timestamp": "",
"source": "github",
"line_count": 510,
"max_line_length": 195,
"avg_line_length": 34.34117647058824,
"alnum_prop": 0.6652392371816832,
"repo_name": "sserrot/champion_relationships",
"id": "feeacb6e11242681a1570680856f225ae59abfe8",... |
"""Run interop (cross-language) tests in parallel."""
import argparse
import atexit
import dockerjob
import itertools
import jobset
import json
import multiprocessing
import os
import re
import report_utils
import subprocess
import sys
import tempfile
import time
import uuid
# Docker doesn't clean up after itself, so... | {
"content_hash": "1f00d60a7bcec811382b6caa685b0d40",
"timestamp": "",
"source": "github",
"line_count": 794,
"max_line_length": 110,
"avg_line_length": 32.60705289672544,
"alnum_prop": 0.5969100038624952,
"repo_name": "shishaochen/TensorFlow-0.8-Win",
"id": "edbdf05e2a24937b6a281fe0fe926ea0458a02d2",... |
from tkinter import *
root = Tk()
Label(root, text = "Hello tasdik!").pack(fill = BOTH, expand = YES)
root.mainloop() | {
"content_hash": "1ec91f0286f024e30814d3526ca844e4",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 67,
"avg_line_length": 23.6,
"alnum_prop": 0.6779661016949152,
"repo_name": "prodicus/dabble",
"id": "3076f4e0142695f883f06dbfc7a9cc2137f28c7e",
"size": "144",
"binary": f... |
from onadata.libs.permissions import get_object_users_with_permissions
from onadata.libs.permissions import OwnerRole
from onadata.libs.permissions import ROLES
def set_project_perms_to_xform(xform, project):
# allows us to still use xform.shared and xform.shared_data as before
# only switch if xform.shared i... | {
"content_hash": "e1b836de74da17442a28dce6f330fdd7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 73,
"avg_line_length": 36.17391304347826,
"alnum_prop": 0.6754807692307693,
"repo_name": "jnordling/cabin",
"id": "b4be644e2179bc1ebb12794966fcc3c757a6078a",
"size": "832",... |
from testutils import unittest, skip_before_python, skip_before_postgres
from testutils import ConnectingTestCase, skip_copy_if_green
import psycopg2
class ConnectTestCase(unittest.TestCase):
def setUp(self):
self.args = None
def conect_stub(dsn, connection_factory=None, async=False):
... | {
"content_hash": "43dcf9f19d51d8a1c8fe0e8e28db7832",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 77,
"avg_line_length": 33.44604316546763,
"alnum_prop": 0.592600559260056,
"repo_name": "poojavade/Genomics_Docker",
"id": "b2f5279dd4cd340ac53d5f45f7bfc94bd66010a4",
"siz... |
"""Dataset utilities and synthetic/reference datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
from os import path
import numpy as np
from tensorflow.contrib.learn.python.learn.datasets import base
from tensorflow.contrib.learn.pytho... | {
"content_hash": "ace6ac22f941e04d01d4c88eb359c977",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 80,
"avg_line_length": 29.958333333333332,
"alnum_prop": 0.713490959666203,
"repo_name": "av8ramit/tensorflow",
"id": "7240b0de149051afa045a8113f9e9b212840c311",
"size": "3... |
"""Configuration for Externality Mushrooms.
Externality mushrooms is an immediate feedback collective action problem and
social dilemma. Unlike the other sequential social dilemmas in this suite, there
is no delay between the time when an agent takes an antisocial (or prosocial)
action and when its effect is felt by a... | {
"content_hash": "4e11b949fb16eb16abcc7ee814c8afa5",
"timestamp": "",
"source": "github",
"line_count": 1064,
"max_line_length": 80,
"avg_line_length": 33.99812030075188,
"alnum_prop": 0.45184386575993807,
"repo_name": "deepmind/meltingpot",
"id": "20ec5465d27a05e9bc8c1602c0e1813cf227cfe3",
"size":... |
"""Automatically detects if file resides in a ruby on rails application and set the properly language."""
import gedit, os
class RubyOnRailsLoader(gedit.Plugin):
"""Automatically strip all trailing whitespace before saving."""
def activate(self, window):
"""Activate plugin."""
self.window = ... | {
"content_hash": "332efe8b381a69bc1a3c620072abaaba",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 105,
"avg_line_length": 33.95238095238095,
"alnum_prop": 0.5669705469845723,
"repo_name": "icebreaker/dotfiles",
"id": "e9c6342df9f734c4c45048441b0b59cbcf612617",
"size": "... |
"""
This module provides the base sparse command and a load hook for dynamically
adding other subcommands. The "load_suparsers" function searches for modules
in the streamparse/bin directory that have a "subparser_hook" method. The
"subparser_hook" accepts a the sparse subparsers object and adds it's
subparser as need... | {
"content_hash": "656df382b4231878dff2a7d6c968095e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 135,
"avg_line_length": 33.89247311827957,
"alnum_prop": 0.6424492385786802,
"repo_name": "Parsely/streamparse",
"id": "a99c1d6f2c4401a389d71cdc4f8aebbc9c42e444",
"size": "... |
"""Misc file tests.
Made for Jython.
"""
from __future__ import with_statement
import os
import unittest
from test import test_support
class FileTestCase(unittest.TestCase):
def tearDown(self):
if os.path.exists(test_support.TESTFN):
os.remove(test_support.TESTFN)
def test_append(self):
... | {
"content_hash": "b2f42a5157f6595ae32a96e263864b08",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 60,
"avg_line_length": 26.346153846153847,
"alnum_prop": 0.5897810218978102,
"repo_name": "ofermend/medicare-demo",
"id": "da5412297508b2562ea7fe311be78293d2727e9b",
"size"... |
import mock
from django.test import TestCase
from django.views.generic import View
from django_universal_view_decorator import ViewDecoratorBase
def test_log(*args, **kwargs):
pass
# Test views
def regular_view_function(request, *args, **kwargs):
test_log(regular_view_function, request, *args, **kwargs)
... | {
"content_hash": "1d73ef2b36154f8c623faa81840010d8",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 118,
"avg_line_length": 42.6551724137931,
"alnum_prop": 0.6405526567208054,
"repo_name": "pasztorpisti/django-universal-view-decorator",
"id": "5916ac2706e4a553cae51d33b48ca... |
'''Klassz étterem page subclass module.'''
import datetime
import re
import dateutil.parser # dateutils
import page # FoodAId
class KlasszEtterem(page.Page):
'''Page handling for this restaurant.'''
def __init__(self, scraper):
'''Constructor.'''
super(KlasszEtterem, self).__in... | {
"content_hash": "02a0abbbb75516211e138d934e653e6d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 115,
"avg_line_length": 34.38961038961039,
"alnum_prop": 0.573262839879154,
"repo_name": "Pregnor/foodAId",
"id": "77f74517eb94ad0079c291a24040106ca4f2c527",
"size": "2673"... |
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
import io
import tokenize
NON_CODE_TOKENS = frozenset((
tokenize.COMMENT, tokenize.ENDMARKER, tokenize.NEWLINE, tokenize.NL,
))
def check_docstring_first(src, filename='<unknown>'):
"""Returns nonzero if the sour... | {
"content_hash": "8f5c61711dffd2ae10cd105fcae1b758",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 76,
"avg_line_length": 30.46031746031746,
"alnum_prop": 0.5685252735799896,
"repo_name": "Coverfox/pre-commit-hooks",
"id": "da5425d2cb60a37e504a9655578f635317bb0239",
"siz... |
from django.test import TestCase
import pytest
from mittab.apps.tab.models import Debater, Team
from mittab.libs.tests.assertion import assert_nearly_equal
from mittab.libs.tests.data.load_data import load_debater_rankings
from mittab.libs.tests.data.load_data import load_team_rankings
from mittab.libs.tab_logic.ranki... | {
"content_hash": "0d1a7eb4ffbfa31ef2e1b088e0ba2331",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 42.27272727272727,
"alnum_prop": 0.6163440860215054,
"repo_name": "jolynch/mit-tab",
"id": "73be0a49948dfc67964cd6beea11e95c120e1b9a",
"size": "2325"... |
import json
import logging
import sys
from os.path import dirname, join
# The working path for the Azure Function doesn't include this file's folder
sys.path.append(dirname(dirname(__file__)))
from c7n_azure import handler, entry
try:
import azure.functions as func
from azure.functions_worker.bindings.http i... | {
"content_hash": "2e621b5d44c135a904a319dcbdce3ad7",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 90,
"avg_line_length": 26.020833333333332,
"alnum_prop": 0.6533226581265013,
"repo_name": "taohungyang/cloud-custodian",
"id": "f08b50ea400ade0d6ea2a24da1b2ae4c189e01bd",
"... |
"""
Gauged - https://github.com/chriso/gauged
Copyright 2014 (c) Chris O'Hara <cohara87@gmail.com>
"""
from random import random
from math import floor, ceil
from time import time
from calendar import timegm
from datetime import datetime, timedelta
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
fro... | {
"content_hash": "1cb3de80c21a4fee5b842299cf19b1c4",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 77,
"avg_line_length": 34.64646464646464,
"alnum_prop": 0.6626822157434402,
"repo_name": "chriso/gauged",
"id": "0b72a52cf795191aa08ac8035144125002a0f981",
"size": "3430",
... |
"""Tests for layer graphs construction & handling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
import numpy as np
from tensorflow.python.eager import context
from tensorflow.python.eager import def_function
from tensorflow.python.f... | {
"content_hash": "c104ee9fb4ac0b0fb8be96332d51beb5",
"timestamp": "",
"source": "github",
"line_count": 2533,
"max_line_length": 80,
"avg_line_length": 35.895380971180415,
"alnum_prop": 0.6373964783388142,
"repo_name": "freedomtan/tensorflow",
"id": "fea3ee16da7441e1d487a253f06d03fbe2ff316e",
"size... |
from AlgorithmImports import *
from clr import GetClrType as typeof
from Selection.UniverseSelectionModel import UniverseSelectionModel
class FutureUniverseSelectionModel(UniverseSelectionModel):
'''Provides an implementation of IUniverseSelectionMode that subscribes to future chains'''
def __init__(self,
... | {
"content_hash": "c4d18ccce8ffa06298600ff78d15ad09",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 179,
"avg_line_length": 50.7319587628866,
"alnum_prop": 0.6433651696809591,
"repo_name": "jameschch/Lean",
"id": "6f53dbbb21ca37c2a58b9133258a3a437f8d617f",
"size": "5609",... |
from .base import make_agg_primitive, make_trans_primitive
from .standard import *
from .utils import (
get_aggregation_primitives,
get_default_aggregation_primitives,
get_default_transform_primitives,
get_transform_primitives,
list_primitives
)
| {
"content_hash": "9bffadcd54063743009884f6b9e45fb7",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 58,
"avg_line_length": 29.555555555555557,
"alnum_prop": 0.7556390977443609,
"repo_name": "Featuretools/featuretools",
"id": "08217a8f1a5a49f5663c737c792b6c6f1446f48c",
"siz... |
import pytest
from os.path import join, realpath, dirname
@pytest.mark.torch
def test_featurize():
"""Test that BertFeaturizer.featurize() correctly featurizes all sequences,
correctly outputs input_ids and attention_mask."""
from deepchem.feat.bert_tokenizer import BertFeaturizer
from transformers import Ber... | {
"content_hash": "f8e3307d0a5048df8503e7f2a4f78c13",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 77,
"avg_line_length": 35.15909090909091,
"alnum_prop": 0.7084680025856497,
"repo_name": "peastman/deepchem",
"id": "af00408c1fe6abd0e8e6337068d77e4a5f841bfa",
"size": "154... |
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.core.management import BaseCommand
from django.db import DEFAULT_DB_ALIAS, router
from django.db.models.deletion import Collector
from ...management import get_contenttypes_and_models
class Command(BaseCommand):
... | {
"content_hash": "06e84c336f587f098b128c9670e6bc93",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 113,
"avg_line_length": 40.785714285714285,
"alnum_prop": 0.5437828371278459,
"repo_name": "MoritzS/django",
"id": "e5f77dc7dfdde63353e3c1510401721b92eb9c5e",
"size": "3426... |
import myhdl
from myhdl import (Signal, intbv, always_seq, always_comb, concat)
from rhea.build.boards import get_board
@myhdl.block
def zybo_blink(led, btn, clock):
maxcnt = int(clock.frequency)
cnt = Signal(intbv(0, min=0, max=maxcnt))
toggle = Signal(bool(0))
@always_seq(clock.posedge, reset=None... | {
"content_hash": "5c0ad46cadcb0261171be784d1c53f59",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 66,
"avg_line_length": 19.19047619047619,
"alnum_prop": 0.5533498759305211,
"repo_name": "NickShaffner/rhea",
"id": "94ca6acf62ce82b379f8945a1fe7683faa52839c",
"size": "807... |
"""AFF4 RDFValue implementations.
This module contains all RDFValue implementations.
NOTE: This module uses the class registry to contain all implementations of
RDFValue class, regardless of where they are defined. To do this reliably, these
implementations must be imported _before_ the relevant classes are reference... | {
"content_hash": "7d16390d0b127d4fc0f2b5c26a6167a0",
"timestamp": "",
"source": "github",
"line_count": 1464,
"max_line_length": 108,
"avg_line_length": 29.095628415300546,
"alnum_prop": 0.6647572542022725,
"repo_name": "demonchild2112/travis-test",
"id": "1d912477f2b8324845d8e9b38d19f016c56f89a3",
... |
from socket import *
from time import ctime
import select
import sys
HOST=''
PORT=21569
BUFSIZ=1024
ADDR=(HOST,PORT)
tcpSerSock=socket(AF_INET,SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
input=[tcpSerSock,sys.stdin]
while True:
print 'waiting for connection...'
tcpCliSock,addr=tcpSerSock.accept()
print... | {
"content_hash": "6f69ed7dc29b1a64ccc78e20eb5b78ab",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 98,
"avg_line_length": 21.97142857142857,
"alnum_prop": 0.7269180754226268,
"repo_name": "eggfly/gosms",
"id": "e8960284a818895b0a245b15add2b5a12dd52669",
"size": "920",
... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'functional_test.views.home', name='home'),
url(r'^login/(?P<provider_name>\w+)',
'functional_test.views.login', name='login'),
)
| {
"content_hash": "661b861c02913a25cbd8d78caa9ac2d3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 77,
"avg_line_length": 39.75,
"alnum_prop": 0.4779874213836478,
"repo_name": "peterhudec/authomatic",
"id": "5555a24e0dec37ad02df29b3db70d42f458ee016",
"size": "342",
"bin... |
__version__ = '0.2.12'
def validate_gateway(gateway):
"""Test that a gateway is correctly set up.
Returns True if successful, or an error message."""
from hiicart.gateway.base import GatewayError
from hiicart.gateway.amazon.gateway import AmazonGateway
from hiicart.gateway.google.gateway import Go... | {
"content_hash": "534621aab2d413f05a778304e07b4e1d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 36,
"alnum_prop": 0.6862139917695473,
"repo_name": "kbourgoin/hiicart",
"id": "d5081163096ca5ecebdbfa073f20256a080e6b95",
"size": "972",
"binary": ... |
import TownLoader
import TTStreet
from toontown.suit import Suit
class TTTownLoader(TownLoader.TownLoader):
def __init__(self, hood, parentFSM, doneEvent):
TownLoader.TownLoader.__init__(self, hood, parentFSM, doneEvent)
self.streetClass = TTStreet.TTStreet
self.musicFile = 'phase_3.5/audi... | {
"content_hash": "e9802de1e6dd2c8631273d51158e7772",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 90,
"avg_line_length": 36.40909090909091,
"alnum_prop": 0.6803995006242197,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "7f402e20521edd4b3108929cf3f84579ad18d... |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, LLC
#
# 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... | {
"content_hash": "6be8e307baeba2b6060f4ae1de200b45",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 119,
"avg_line_length": 43.19230769230769,
"alnum_prop": 0.5841495992876224,
"repo_name": "gogoair/foremast",
"id": "60cb5ac99aa4dacd7b76a34ca68801962910bd1d",
"size": "12... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2016-2018 Dietrich Pescoller @Microgate SRL
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 wit... | {
"content_hash": "904888562b3ea74ca563bf4bf408ebd4",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 77,
"avg_line_length": 40.903225806451616,
"alnum_prop": 0.805205047318612,
"repo_name": "Diti24/python-ivi",
"id": "d9316e82bfbffab8d9c9ffe288c785ab6b35e45d",
"size": "126... |
def bucket_sort(arr):
''' Bucket Sort
Complexity: O(n^2)
The complexity is dominated by nextSort
'''
# The number of buckets and make buckets
num_buckets = len(arr)
buckets = [[] for bucket in range(num_buckets)]
# Assign values into bucket_sort
for value in arr:
inde... | {
"content_hash": "5afc0f65fe2aeb3b986e537e723fab1a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 53,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.55,
"repo_name": "amaozhao/algorithms",
"id": "d89232ccfc37674df7b54375363e5dddc92ba154",
"size": "800",
"binar... |
from selenium import webdriver
from getpass import getpass
usr = input('Enter your username or email : ')
pwd = getpass('Enter your password : ')
driver = webdriver.Chrome()
driver.get('https://twitter.com/login')
usr_box = driver.find_element_by_class_name('js-username-field')
usr_box.send_keys(usr)
pwd_box = driv... | {
"content_hash": "20ef5674f2ca09256560087472e98095",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 117,
"avg_line_length": 31.470588235294116,
"alnum_prop": 0.7570093457943925,
"repo_name": "umangahuja1/Python",
"id": "7cac446febe49c9ef430ab223b27e8fd1f7f7c13",
"size": "... |
import numpy as np
from nlpaug.model.audio import Audio
class Crop(Audio):
def manipulate(self, data, start_pos, end_pos):
aug_data = data.copy()
aug_data = np.delete(aug_data, np.s_[start_pos:end_pos])
return aug_data
| {
"content_hash": "f756fe6dc22b0d11af824042cb4d77e7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 25,
"alnum_prop": 0.648,
"repo_name": "makcedward/nlpaug",
"id": "277e337ec924a583578283d1f637b5cb6024bfb4",
"size": "250",
"binary": false,
"cop... |
"""All the views for DrawWrite."""
# Imports {{{
import logging
from base64 import b64decode
from itertools import zip_longest
from django.core.files.base import ContentFile
from django.db import IntegrityError
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed, JsonResponse
from django.shortcut... | {
"content_hash": "82947d3402cfd47239cb35d92a535201",
"timestamp": "",
"source": "github",
"line_count": 747,
"max_line_length": 96,
"avg_line_length": 37.24899598393574,
"alnum_prop": 0.6201617250673854,
"repo_name": "RMMoreton/drawwrite",
"id": "f29eb97bde521edd81ed384744a4767a2260435a",
"size": "... |
from position import Position
class Portfolio(object):
"""Portfolio class"""
instance = None
def __init__(self, list_of_positions, wallet_value):
if Portfolio.instance == None:
super(Portfolio, self).__init__()
self.positions = list_of_positions
self.value = sum(self.positions)
self.wallet_value = wal... | {
"content_hash": "965b8330a63c19c08ab2be374f9e5651",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 57,
"avg_line_length": 24.434782608695652,
"alnum_prop": 0.702846975088968,
"repo_name": "coders-creed/botathon",
"id": "3e9598e73f3c6b38714b7e52724458f6c7423640",
"size": ... |
from __future__ import unicode_literals
import json
import warnings
from django import forms
from django.conf import settings
from django.contrib.admin.utils import (
display_for_field, flatten_fieldsets, help_text_for_field, label_for_field,
lookup_field,
)
from django.core.exceptions import ObjectDoesNotExi... | {
"content_hash": "8391f44a47f579d216a01b3f6de42ddd",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 113,
"avg_line_length": 37.79259259259259,
"alnum_prop": 0.5797073043251013,
"repo_name": "nemesisdesign/django",
"id": "c433f32579b44a420b8e5b5cb8fdd4a7b77da6d0",
"size":... |
from __future__ import absolute_import
import json
from exam import fixture
from sentry.testutils import TestCase
class GroupEventJsonTest(TestCase):
@fixture
def path(self):
return '/{}/{}/issues/{}/events/{}/json/'.format(
self.organization.slug,
self.project.slug,
... | {
"content_hash": "efa5bfe234e706b74124f173db4e7412",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 57,
"avg_line_length": 25.807692307692307,
"alnum_prop": 0.6020864381520119,
"repo_name": "mitsuhiko/sentry",
"id": "c9acc576d3a075e1f0454996f75253d8aec280c4",
"size": "671... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.shortcuts import redirect
from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.generic import ... | {
"content_hash": "4366650427cbe886df202a5b89133cc3",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 95,
"avg_line_length": 36.36871508379888,
"alnum_prop": 0.6219662058371735,
"repo_name": "dotKom/onlineweb4",
"id": "90d3021503f79a362f7e0382aa0a0f8a4de4ef39",
"size": "65... |
"""Transport adapter for Requests."""
from __future__ import absolute_import
import functools
import logging
import numbers
import os
import time
try:
import requests
except ImportError as caught_exc: # pragma: NO COVER
import six
six.raise_from(
ImportError(
"The requests library i... | {
"content_hash": "65e28b2c116894137d14d89d36393513",
"timestamp": "",
"source": "github",
"line_count": 525,
"max_line_length": 96,
"avg_line_length": 36.92761904761905,
"alnum_prop": 0.6239232475370093,
"repo_name": "luci/luci-py",
"id": "d317544b74f718d0a819c224e63a1e034b576e15",
"size": "19963",... |
from django.contrib.auth import get_user_model
from django.core import mail
from django.urls import reverse
from django.test import TestCase
from ..models import Job
from ..factories import (
ApprovedJobFactory, DraftJobFactory, JobCategoryFactory, JobTypeFactory,
ReviewJobFactory, JobsBoardAdminGroupFactory,
... | {
"content_hash": "639c1511b63b200b372c38d189344686",
"timestamp": "",
"source": "github",
"line_count": 717,
"max_line_length": 92,
"avg_line_length": 37.642956764295675,
"alnum_prop": 0.6167098925527973,
"repo_name": "python/pythondotorg",
"id": "763dca666b23e9d809c97e5705b3f29a9390b59b",
"size": ... |
"""Helper methods for creating & verifying XSRF tokens."""
__authors__ = [
'"Doug Coker" <dcoker@google.com>',
'"Joe Gregorio" <jcgregorio@google.com>',
]
import base64
import hmac
import os # for urandom
import time
from oauth2client import util
# Delimiter character
DELIMITER = ':'
# ... | {
"content_hash": "acd025535f27009b42102d5ffa96ed74",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 73,
"avg_line_length": 29.193877551020407,
"alnum_prop": 0.6452289409297448,
"repo_name": "emedinaa/contentbox",
"id": "d51be1e08f5081d5f2304feff78eed5436e53352",
"size": "... |
"""
/hosts endpoint for Daisy v1 API
"""
import subprocess
from oslo_config import cfg
from oslo_log import log as logging
from webob.exc import HTTPBadRequest
from webob.exc import HTTPConflict
from webob.exc import HTTPForbidden
from webob.exc import HTTPNotFound
from webob import Response
from collections import Cou... | {
"content_hash": "581cd535ca1320001e401647f5139417",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 135,
"avg_line_length": 47.39945652173913,
"alnum_prop": 0.514131743392765,
"repo_name": "OpenDaisy/daisy-api",
"id": "95cf0b307873bd1f044d363a0d5e2f52c72a9797",
"size": "... |
"""
Helpers for pytest fixtures and data related testing.
"""
##########################################################################
## Imports and Module Variables
##########################################################################
from collections import namedtuple
## Used for wrapping an dataset into ... | {
"content_hash": "e209fc71dd5f387f519837c41e3579b8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 74,
"avg_line_length": 29.692307692307693,
"alnum_prop": 0.46113989637305697,
"repo_name": "pdamodaran/yellowbrick",
"id": "8fc8f83c22a166bdc6f1720b10aa3e237ab48127",
"size... |
from __future__ import absolute_import
from mock import Mock
from sentry.api.bases.team import TeamPermission
from sentry.models import ApiKey
from sentry.testutils import TestCase
class TeamPermissionBase(TestCase):
def setUp(self):
self.org = self.create_organization(flags=0)
self.team = self.... | {
"content_hash": "0b645850c6540aec8340943695ccbf4f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 102,
"avg_line_length": 33.76923076923077,
"alnum_prop": 0.6127562642369021,
"repo_name": "fotinakis/sentry",
"id": "bb9f48528a48af2d00e9e64acbebfe7ac6d3c5ed",
"size": "307... |
from collections import Counter
from typing import List, Mapping, Union, Optional
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from bartpy.runner import run_models
from bartpy.sklearnmodel import SklearnModel
ImportanceMap = Mapping[int, float]
ImportanceDistribut... | {
"content_hash": "83c0d9ef5335339f508f52be03c47a3c",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 129,
"avg_line_length": 37.229729729729726,
"alnum_prop": 0.673805202661827,
"repo_name": "JakeColtman/bartpy",
"id": "b15150641ad446dea195c906961c56fc57b4086a",
"size": "... |
import os
import contextlib
import functools
import gc
import socket
import sys
import types
import warnings
_DEPR_MSG = (
"pyarrow.{} is deprecated as of {}, please use pyarrow.{} instead."
)
def implements(f):
def decorator(g):
g.__doc__ = f.__doc__
return g
return decorator
def _dep... | {
"content_hash": "36fe26addee437def27ad023e9b0316e",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 78,
"avg_line_length": 25.405228758169933,
"alnum_prop": 0.5847697453048624,
"repo_name": "apache/arrow",
"id": "0e0f3e72650834fa16139ee519c85b19feb897dc",
"size": "4703",... |
from recommender.database.daos import PositionDao, RatingDao
class UserWithSkills(object):
def __init__(self, user):
self.user = user
self.skills = None
def getSkills(self):
if self.skills is None:
raise Exception("You need to call loadSkills or loadExtendedSkills first!"... | {
"content_hash": "049d1b51eb3e8f049e84c3c87bbb3e65",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 104,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.6404084609773888,
"repo_name": "ScJa/projectr",
"id": "7e20d1001eba2594f03b7a965a4616ce685979c6",
"size": "1371"... |
"""Tests for external_optimizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
# pylint: disable=g-import-not-at-top,unused-import
try:
import __builtin__ as builtins
except ImportError:
import builtins
... | {
"content_hash": "3086eb079e8c94b4e8815d335312d4f7",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 78,
"avg_line_length": 30.1875,
"alnum_prop": 0.6443064182194617,
"repo_name": "ppries/tensorflow",
"id": "9dd64e5b32514c00be917cad2fccd2d6b2974666",
"size": "5520",
"bi... |
from core.himesis import Himesis
import uuid
class HConnECU2VirtualDevice2(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule ConnECU2VirtualDevice2.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HConnECU2VirtualDevice2, self).__init__(name... | {
"content_hash": "d84eb7f612d02548a4654011023f4e8a",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 102,
"avg_line_length": 36.15909090909091,
"alnum_prop": 0.6621621621621622,
"repo_name": "levilucio/SyVOLT",
"id": "660ac02665404209b78a5c836e6e2d48f3ce1971",
"size": "318... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Simple charts from HBase small tables, based on the HBase REST server, Pygal, Flask and Requests
'''
from flask import Flask, make_response
from flask import render_template
from werkzeug.routing import BaseConverter, ValidationError
import pygal
from pygal.style imp... | {
"content_hash": "259594f821b0719f5598efc385aa788f",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 527,
"avg_line_length": 57.34272300469483,
"alnum_prop": 0.6602259701981333,
"repo_name": "juanrh/data42",
"id": "fd2c302a537ee5894445520986a0e817e1aca425",
"size": "12214... |
__name__ = "tlsh_bh_tool"
__version__ = 1.0
__author__ = "Jayson Pryde"
import os, sys, tlsh, argparse, threading, pefile, requests
import logging, logging.config, hashlib, ConfigParser, simplejson
from extended_file_properties import extended_file_properties as efp
from os.path import getsize
class TlshStru... | {
"content_hash": "60db0deebcbdb0e556c8c598d834e257",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 158,
"avg_line_length": 43.386243386243386,
"alnum_prop": 0.5179268292682927,
"repo_name": "pombredanne/tlsh",
"id": "0ee9e72faa06b5456685d28f7d7cf26361b583c5",
"size": "8... |
from django.test import TestCase, Client
from django.http import HttpRequest, Http404
from wagtail.wagtailcore.models import Page, Site
from wagtail.tests.models import EventPage
class TestRouting(TestCase):
fixtures = ['test.json']
def test_find_site_for_request(self):
default_site = Site.objects.... | {
"content_hash": "f238733e6d2cdb687bce23dbf257287f",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 107,
"avg_line_length": 44.30714285714286,
"alnum_prop": 0.667418990810898,
"repo_name": "suziesparkle/wagtail",
"id": "d08bf8ddd5b1fd47de250e3cf0bdb15701963b9b",
"size": ... |
"""
Orange Canvas Resource Loader
"""
import os
import logging
log = logging.getLogger(__name__)
def package_dirname(package):
"""Return the directory path where package is located.
"""
if isinstance(package, str):
package = __import__(package, fromlist=[""])
filename = package.__file__
... | {
"content_hash": "d81ba42fdfe8d557f9f0fcf3a772f444",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 79,
"avg_line_length": 27.71647509578544,
"alnum_prop": 0.59524467790987,
"repo_name": "cheral/orange3",
"id": "2a415f64c2c3532c94d8507a67ab6c1cc709890d",
"size": "7234",
... |
import _base
from html5lib.constants import voidElements, namespaces, prefixes
from xml.sax.saxutils import escape
# Really crappy basic implementation of a DOM-core like thing
class Node(_base.Node):
type = -1
def __init__(self, name):
self.name = name
self.parent = None
self.value = N... | {
"content_hash": "ece11adef3ca71d623a13b8e20c25865",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 163,
"avg_line_length": 29.14516129032258,
"alnum_prop": 0.5556170448256779,
"repo_name": "fergalmoran/Chrome2Kindle",
"id": "ff6bfe400333aa1611323063cadeb58ae0e99a93",
"s... |
"""
This module provide extended power to decode HTML you crawled.
"""
import chardet
def smart_decode(binary, errors="strict"):
d = chardet.detect(binary)
encoding = d["encoding"]
confidence = d["confidence"]
text = binary.decode(encoding, errors=errors)
return text, encoding, confidence
#--- ... | {
"content_hash": "d2f4013a4992d8d55a76453c99e892ad",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 62,
"avg_line_length": 23.454545454545453,
"alnum_prop": 0.6492248062015504,
"repo_name": "MacHu-GWU/crawl_trulia-project",
"id": "e776531abbebe87d626c489035cb5e2ab0bfbadc",
... |
import datetime
# start and end dates (year 2001)
start = datetime.datetime(2001, 1, 1)
end = datetime.datetime(2002, 1, 1)
# do a 4-hour timestep; time step should be specified in minutes. HSPF can use
# any time step from 1 minute to 1 day (1440 minutes) as long as it divides
# evenly into 1440.
tstep = 240
#... | {
"content_hash": "dc74ca84d2413b7ede80f8078a274223",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 80,
"avg_line_length": 36.141573033707864,
"alnum_prop": 0.7162842753217683,
"repo_name": "kbrannan/PyHSPF",
"id": "809c0f2a78663cf6fe3f3c2c2b5e46784905e011",
"size": "167... |
import wx
# begin wxGlade: dependencies
import gettext
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class LogonDialog(wx.Dialog):
"""
This class implements the logon dialog for the Pressure Ulcer System GUI.
It requests the users' id and password and then logs the user into the database.
M... | {
"content_hash": "ff57a083de38a592eb63a2ed493e754c",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 157,
"avg_line_length": 41.17557251908397,
"alnum_prop": 0.6028921023359288,
"repo_name": "VHAINNOVATIONS/GE-Pressure-Ulcer",
"id": "f07ace684f2051ae1053e5ba41b8d5619777b936... |
import json
import flask
from flask import abort, request as req
from optparse import OptionParser
from remote_manager import RemoteControl, PrepareVMManager, GetAllSystemInfo
from system_control_cmd import *
from VMDash_cli import KEEP_STATISTICS
import time, threading
VMDash = flask.Flask(__name__)
ServerCurrentS... | {
"content_hash": "731859241d6e00716e9276ea7719c607",
"timestamp": "",
"source": "github",
"line_count": 358,
"max_line_length": 152,
"avg_line_length": 37.41340782122905,
"alnum_prop": 0.5455427803494102,
"repo_name": "lach76/LinuxHostMonitor",
"id": "6322a8440f1f1df2751e4eb555e6cdb91a517685",
"siz... |
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is rea... | {
"content_hash": "77546a094c5a43b6e166e92b715d3a9e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 77,
"avg_line_length": 36.5,
"alnum_prop": 0.6238145416227608,
"repo_name": "vchaptsev/cookiecutter-django-vue",
"id": "80a3e3a681b5e65c220afcfe2359088cac26f3a0",
"size": "... |
"""some various utilities and helper classes, most of them used in the
main pylint class
"""
from __future__ import print_function
import codecs
import collections
from inspect import cleandoc
import os
from os.path import dirname, basename, splitext, exists, isdir, join, normpath
import re
import sys
import tokenize
... | {
"content_hash": "458f2e1f940b140571b073ac4d5fe2a3",
"timestamp": "",
"source": "github",
"line_count": 1198,
"max_line_length": 100,
"avg_line_length": 38.502504173622704,
"alnum_prop": 0.573754498547457,
"repo_name": "AtomLinter/linter-pylama",
"id": "9c078eba83ce005927988e2c344cf59da08b99da",
"s... |
import copy
import os
import sys
import textwrap
from alembic.autogenerate import api as alembic_ag_api
from alembic import config as alembic_config
from alembic.operations import ops as alembic_ops
from alembic import script as alembic_script
import fixtures
import mock
from oslo_utils import fileutils
import pkg_res... | {
"content_hash": "64df6c4d96ac0b9507f056a9ef22c559",
"timestamp": "",
"source": "github",
"line_count": 729,
"max_line_length": 79,
"avg_line_length": 40.40466392318244,
"alnum_prop": 0.569852317093872,
"repo_name": "cloudbase/neutron",
"id": "fa403b78b0ced6278ce3cad015dc9e5a7e1f1b8e",
"size": "301... |
import os
import posixpath
import re
import signal
import sys
import time
import psutil
import pytest
from daemonocle import Daemon, DaemonError
def test_simple(pyscript):
script = pyscript("""
import sys
import time
from daemonocle import Daemon
def worker():
time.s... | {
"content_hash": "f88f375041f3a427b44cfbc322148371",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 79,
"avg_line_length": 29.336614173228348,
"alnum_prop": 0.5918271488961954,
"repo_name": "jnrbsn/daemonocle",
"id": "e6a4a011f013b33678e275d68db756446c2b65b5",
"size": "1... |
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.forms import *
from django.contrib.auth import login, logout, get_user_model
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.http import HttpR... | {
"content_hash": "329dfbd1724b80300829fff1ec68b17f",
"timestamp": "",
"source": "github",
"line_count": 644,
"max_line_length": 94,
"avg_line_length": 40.65683229813665,
"alnum_prop": 0.6529045563915518,
"repo_name": "ramusus/django-authopenid",
"id": "23aefae8d52ff051a10b03d1751776174b3137da",
"si... |
"""Support for esphome devices."""
import asyncio
import logging
import math
from typing import Any, Callable, Dict, List, Optional
from aioesphomeapi import (
APIClient, APIConnectionError, DeviceInfo, EntityInfo, EntityState,
HomeassistantServiceCall, UserService, UserServiceArgType)
import voluptuous as vol... | {
"content_hash": "c7109282f78080053c5baa9fd21c8b9f",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 79,
"avg_line_length": 38.0348623853211,
"alnum_prop": 0.6076511167928988,
"repo_name": "jabesq/home-assistant",
"id": "db5aeea2aa1faecc06112f6311b7353bc505e316",
"size": ... |
"""Copyright 2020 The Google Earth Engine Community Authors.
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | {
"content_hash": "afe99826321d23acb58cf4192776bbc7",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 35.796875,
"alnum_prop": 0.6870362287210825,
"repo_name": "google/earthengine-community",
"id": "8c4da1c4956efd9ab0c1979106b04491a4e9dc16",
"size": "... |
'''
CYK algorithm for Context Free Language
Author: Chenguang Zhu
CS154, Stanford University
'''
import sys,traceback
import os
import string
maxProductionNum = 100 #max number of productions
VarNum = 4
production = [[0] * 3 for i in range(maxProductionNum+1)]
'''Prouductions in Chomsky Normal Form (C... | {
"content_hash": "18aefdfafdaee932cdb66c4e0ca3c064",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 157,
"avg_line_length": 29.098765432098766,
"alnum_prop": 0.53097157403479,
"repo_name": "shouya/thinking-dumps",
"id": "ad4eae53114e02d025b84e1f0d28b6700f185d33",
"size":... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project Compiler
#
import os, sys, re, shutil, time, run, sgmllib, codecs, tempfile, subprocess
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
sys.path.append(os.path.abspath(os.path.join(template_dir,'..')))
sys.path.append(os.pa... | {
"content_hash": "281e792a27acd4c6adc881c76b9a2446",
"timestamp": "",
"source": "github",
"line_count": 751,
"max_line_length": 265,
"avg_line_length": 34.77230359520639,
"alnum_prop": 0.6650838630619591,
"repo_name": "jvkops/titanium_mobile",
"id": "ad62b36ed7cd2f51d4ceb918ca84a68ffe8ed76c",
"size... |
import numpy as np
import logging
import qmpy
from .renderable import *
logger = logging.getLogger(__name__)
class Point(Renderable):
def __init__(self, coord, label=None, **kwargs):
if isinstance(coord, Point):
self.coord = list(coord.coord)
self.label = coord.label
... | {
"content_hash": "d79ce5d26cafdabf0d7aeccfaabe2935",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 85,
"avg_line_length": 28.246913580246915,
"alnum_prop": 0.5738636363636364,
"repo_name": "wolverton-research-group/qmpy",
"id": "d5a7fde3b6afd723f28fd7e07cb928b22dfc23ad",
... |
from experimental_framework.benchmarks import benchmark_base_class
from experimental_framework.packet_generators \
import dpdk_packet_generator as dpdk
import experimental_framework.common as common
from experimental_framework.constants import framework_parameters as fp
PACKET_SIZE = 'packet_size'
VLAN_SENDER = '... | {
"content_hash": "b86968728d7b8344b6e805f1266f99bc",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 77,
"avg_line_length": 36.47540983606557,
"alnum_prop": 0.5532584269662921,
"repo_name": "dtudares/hello-world",
"id": "9db62e6399f570e2d5eda4481dd667d8caf194b0",
"size": ... |
# Hive Appier Framework
# Copyright (c) 2008-2015 Hive Solutions Lda.
#
# This file is part of Hive Appier Framework.
#
# Hive Appier Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foundation, either version 2.0 of the L... | {
"content_hash": "b447ca5ec571841bdbe620b1ce53787d",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 83,
"avg_line_length": 37.58914728682171,
"alnum_prop": 0.641781810682615,
"repo_name": "JacquesBonet/appier",
"id": "450c29f9fa3549c98f27eec8e83853b75dcb31e1",
"size": "4... |
import pytest
import unittest
from modules.sfp_abuseipdb import sfp_abuseipdb
from sflib import SpiderFoot
from spiderfoot import SpiderFootEvent, SpiderFootTarget
@pytest.mark.usefixtures
class TestModuleAbuseipdb(unittest.TestCase):
def test_opts(self):
module = sfp_abuseipdb()
self.assertEqua... | {
"content_hash": "b6f9056aaab494f5c08c2822de56796e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 30.020408163265305,
"alnum_prop": 0.6689326988443236,
"repo_name": "smicallef/spiderfoot",
"id": "b4fe8e165126afa63eecd3d284426c5519d4f376",
"size": ... |
from typing import Optional
from ray_release.config import Test
from ray_release.result import Result
def handle_result(
test: Test,
result: Result,
) -> Optional[str]:
last_update_diff = result.results.get("last_update_diff", float("inf"))
test_name = test["legacy"]["test_name"]
if test_name i... | {
"content_hash": "afceb61993f31f674ac172137f3dd40b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 26.53488372093023,
"alnum_prop": 0.5898334794040315,
"repo_name": "ray-project/ray",
"id": "ffbd02bde9abffe91997b2828345e955ab299e74",
"size": "1141"... |
"""Common runtime ctypes."""
# pylint: disable=invalid-name
import ctypes
import json
import numpy as np
from .base import _LIB, check_call
tvm_shape_index_t = ctypes.c_int64
class ArgTypeCode(object):
"""Type code used in API calls"""
INT = 0
UINT = 1
FLOAT = 2
HANDLE = 3
NULL = 4
TVM_T... | {
"content_hash": "86a62f0132bfa9f11f6b26fd4113529e",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 100,
"avg_line_length": 29.83820662768031,
"alnum_prop": 0.5684327431893905,
"repo_name": "Laurawly/tvm-1",
"id": "03a68e9f9720662b9d4e3d9145150179da8ccab2",
"size": "1609... |
import os
import re
import commands
import traceback
from time import localtime
from glob import glob
from shutil import copy2, rmtree
import Mover as mover
from PilotErrors import PilotErrors
from pUtil import tolog, readpar, isLogfileCopied, isAnalysisJob, removeFiles, getFileGuid, PFCxml, createLockFile, \
getM... | {
"content_hash": "b4ff59a377b264be1be30f0724737de7",
"timestamp": "",
"source": "github",
"line_count": 1377,
"max_line_length": 229,
"avg_line_length": 48.620188816267245,
"alnum_prop": 0.5563256161314414,
"repo_name": "mlassnig/pilot",
"id": "84ef3a36e41fe657485e9dca0f004ab0983bf1a3",
"size": "66... |
"""Example implementation of code to run on the Cloud ML service.
"""
import traceback
import argparse
import json
import os
from . import model
import shutil
import tensorflow as tf
if __name__ == '__main__':
parser = argparse.ArgumentParser()
# Input Arguments
parser.add_argument(
'--train_dat... | {
"content_hash": "c7d446be17ccc6e9420b449cf4bcfc94",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 79,
"avg_line_length": 25.9625,
"alnum_prop": 0.5907558979297063,
"repo_name": "GoogleCloudPlatform/training-data-analyst",
"id": "199b7eec75f22747e185e703ccb06342e685f899",
... |
"""The tests for the logbook component."""
# pylint: disable=protected-access,invalid-name
from datetime import datetime, timedelta
import logging
import unittest
import pytest
import voluptuous as vol
from homeassistant.components import logbook, recorder, sun
from homeassistant.components.alexa.smart_home import EV... | {
"content_hash": "390caf2eb42caf8a4bb149ab10e50ddb",
"timestamp": "",
"source": "github",
"line_count": 1486,
"max_line_length": 88,
"avg_line_length": 39.331763122476445,
"alnum_prop": 0.5929816757061953,
"repo_name": "Teagan42/home-assistant",
"id": "70e769a54f2d58341c645be8015147397e929f77",
"si... |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from django.http import HttpRespon... | {
"content_hash": "8a6fe3249820ca35d9309bf9fa98b3e9",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 90,
"avg_line_length": 34.827586206896555,
"alnum_prop": 0.667920792079208,
"repo_name": "chrisfranzen/django",
"id": "0746e843a356bcdde8d3775e36f12caf8e338831",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.