text stringlengths 4 1.02M | meta dict |
|---|---|
from django.core.paginator import Paginator
from djapian.tests.utils import BaseTestCase, Entry, Person
class ResultSetPaginationTest(BaseTestCase):
num_entries = 100
per_page = 10
num_pages = num_entries / per_page
def setUp(self):
p = Person.objects.create(name="Alex")
for i in ran... | {
"content_hash": "2ecd2afc5b3d7c108b2bff7cc471478a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 61,
"avg_line_length": 26.896551724137932,
"alnum_prop": 0.6115384615384616,
"repo_name": "daevaorn/djapian",
"id": "aa115822cf281aca65f153707f8490801ccd20b5",
"size": "780... |
"""
.. module: security_monkey.watchers.iam.iam_user
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Patrick Kelley <[email protected]> @monkeysecurity
"""
from security_monkey.watcher import Watcher
from security_monkey.watcher import ChangeItem
from security_monkey.exceptions import InvalidAWSJSON... | {
"content_hash": "c8be7ac32defeba0428da6d6fb25790d",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 116,
"avg_line_length": 34.111111111111114,
"alnum_prop": 0.5086444500125282,
"repo_name": "monkeysecurity/security_monkey",
"id": "7d95fa9abfea21eee44db7bb394db98e9b6965ae"... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
SECRET_KEY = 'damn it is hard to guess' or os.environ.get('SECRET_KEY')
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.163.com'
MAIL_PORT = 25
MAIL_USE_TLS = True
FLASKY_MAIL_SUBJECT_PREFIX = '[Seasi... | {
"content_hash": "d011b709d0d3b17702637c3ccfa1d25e",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 75,
"avg_line_length": 30.63917525773196,
"alnum_prop": 0.642328398384926,
"repo_name": "SanbaiWang/sanbaiblog",
"id": "46a10866082d0377dd53ae35c1e5213522572322",
"size": "... |
import BaseHTTPServer
import copy
import errno
import inspect
import itertools
import new
import os
import re
import shutil
import shlex
import signal
import socket
import stat
import StringIO
import subprocess
import sys
import time
import traceback
import testsuite
from M2Crypto import SSL
#conary
from conary.cmds ... | {
"content_hash": "e4d9e48f2d489390b73921176b2136e7",
"timestamp": "",
"source": "github",
"line_count": 3749,
"max_line_length": 150,
"avg_line_length": 37.95812216591091,
"alnum_prop": 0.5288851410702364,
"repo_name": "fedora-conary/conary",
"id": "1833865a767df84b0f22944f28f41954fc529849",
"size"... |
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
- Use sentry for error logging
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from djan... | {
"content_hash": "3e3e35fa031d621bdda5d081394bc953",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 117,
"avg_line_length": 34.922680412371136,
"alnum_prop": 0.6022140221402214,
"repo_name": "gladgod/verstand-server",
"id": "38b237931976a16750a3da8079e5f95ca2eaef42",
"si... |
from abc import ABCMeta
from .utils.conformance import verify_conformance, verify_not_overridden
from .utils.docs import update_docs
from .utils.inspection import (
set_explicit_override,
set_forced_override,
set_quirk_docs_method,
set_quirk_docs_mro,
should_skip,
)
class InterfaceMeta(ABCMeta):
... | {
"content_hash": "30d816414a3813bd477ee59d766eff3b",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 102,
"avg_line_length": 36.25853658536585,
"alnum_prop": 0.5735234763890757,
"repo_name": "matthewwardrop/interface_meta",
"id": "40cd0912c1c17c3394495f67cdbe71d43b90ed3a",
... |
from __future__ import print_function
import numpy as np
import sys
import sqaod
from sqaod import algorithm as algo
from . import formulas
from sqaod.common import checkers, symmetrize
class DenseGraphBFSearcher :
""" Dense graph brute-force searcher"""
def __init__(self, W, optimize, prefdict) :
if ... | {
"content_hash": "d57a11c05e8af2510d4c8c1b34237c56",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 132,
"avg_line_length": 29.891304347826086,
"alnum_prop": 0.5460363636363637,
"repo_name": "shinmorino/quant_sandbox",
"id": "d9eec51ecfc8aea79b6164f61405746a3f236851",
"s... |
from __future__ import unicode_literals
from django.db import migrations
from recipe.configuration.data.recipe_data import LegacyRecipeData
class Migration(migrations.Migration):
dependencies = [
('storage', '0002_workspace_is_move_enabled'),
('recipe', '0015_recipefile'),
]
def popula... | {
"content_hash": "507c9b8cff78d648c5d425277ed33e90",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 111,
"avg_line_length": 40.3968253968254,
"alnum_prop": 0.574852652259332,
"repo_name": "ngageoint/scale",
"id": "c2a6572f33fa66e0301080773cc494f1ef96afec",
"size": "2569",... |
import sublime, sublime_plugin
import re
def TagRemoveAttributesClean(data):
regexp = re.compile('(<([a-z0-9\:\-_]+)\s+>)');
data = regexp.sub('<\\2>', data);
return data
def TagRemoveAttributesAll(data, view):
return TagRemoveAttributesClean(re.sub('(<([a-z0-9\:\-_]+)\s+[^>]+>)', '<\\2>', data));
def TagRemoveA... | {
"content_hash": "6c8d8a53977782ca52a41238cae255f5",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 129,
"avg_line_length": 40.261538461538464,
"alnum_prop": 0.7065341994650363,
"repo_name": "Iristyle/ChocolateyPackages",
"id": "3b64546f4646242118fd6065cb314f11c77e168d",
... |
import requests
import uuid
from datetime import timedelta
from django.utils import datetime_safe
from keystoneclient.access import AccessInfo
from keystoneclient.service_catalog import ServiceCatalog
from keystoneclient.v3.domains import Domain, DomainManager
from keystoneclient.v3.roles import Role, RoleManager
fr... | {
"content_hash": "511107ff7e0dfd323af5bf2706bc3aed",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 76,
"avg_line_length": 31.685344827586206,
"alnum_prop": 0.45898517208543055,
"repo_name": "tylertian/Openstack",
"id": "4f13738b712504376f8dee27accb20964bb0c1a9",
"size":... |
class XContentTypeOptionsAnalyzer:
def __init__(self):
pass
def analyze(self, parse_results, headers, content):
results = parse_results["X-Content-Type-Options"]
parts = []
if results["status"] == "X_CONTENT_TYPE_OPTIONS_NONE":
parts.append({
"type" : "warning",
"message" : "X-Content-Type-Option... | {
"content_hash": "79fd8da22a3e9df81a563e64138764ad",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 232,
"avg_line_length": 38,
"alnum_prop": 0.712280701754386,
"repo_name": "HoLyVieR/http-security-headers",
"id": "265aa65db5884421f5a92914883b9b774cc763b4",
"size": "570",... |
from taskflow.patterns import linear_flow as lf
from taskflow.task import FunctorTask
from jobrunner.utils import list_tasks_in_flow
from tests.testcase import TestCase
def noop():
pass
class TestListTasksInFlow(TestCase):
def setUp(self):
self.flow_1 = lf.Flow("flow1")
self.flow_2 = lf.Flo... | {
"content_hash": "79b4a55aa5038f57b0fefa3c64e04fe3",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 77,
"avg_line_length": 27.851063829787233,
"alnum_prop": 0.5882352941176471,
"repo_name": "vdloo/jobrunner",
"id": "666d91239cb1b9982da261adabe19c46dc8ae9f7",
"size": "1309... |
import logging
from argparse import ArgumentParser
from .common import create_loggers
from ebu_tt_live.node.distributing import DistributingNode
from ebu_tt_live.clocks.local import LocalMachineClock
from ebu_tt_live.twisted import TwistedConsumer, UserInputServerProtocol, UserInputServerFactory, \
BroadcastServer... | {
"content_hash": "095c9364e32a1b2493b5ac2856fdb4f7",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 99,
"avg_line_length": 33.54666666666667,
"alnum_prop": 0.6903815580286169,
"repo_name": "bbc/ebu-tt-live-toolkit",
"id": "adc14fc61c2557eef982520862485112dd934de5",
"size"... |
import datetime
from operator import attrgetter
import os
from pathlib import Path
from django.contrib.sites.models import Site
from django.core.urlresolvers import set_urlconf
from django.template import Context, Template
from django.test import TestCase
from releases.models import Release
from .models import Docum... | {
"content_hash": "ab36faf6a996bbcd24049ef000b16668",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 116,
"avg_line_length": 37.141463414634146,
"alnum_prop": 0.5785395324402417,
"repo_name": "xavierdutreilh/djangoproject.com",
"id": "d499478f9df7d81aeb9f32abf3e492a129e818c... |
import re
import coredata
from glob import glob
from compilers import *
import configparser
build_filename = 'meson.build'
def find_coverage_tools():
gcovr_exe = 'gcovr'
lcov_exe = 'lcov'
genhtml_exe = 'genhtml'
if not mesonlib.exe_exists([gcovr_exe, '--version']):
gcovr_exe = None
if not... | {
"content_hash": "9b7e999bf94f7ad5dbddc09738b6eecb",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 114,
"avg_line_length": 39.56730769230769,
"alnum_prop": 0.5582017010935602,
"repo_name": "amaniak/meson",
"id": "c594776846062965a2baecb35dc5e74a92ad6e68",
"size": "25283... |
"""Module defining help types and providers for gsutil commands."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import collections
from gslib.exception import CommandException
ALL_HELP_TYPES = ['command_help', 'a... | {
"content_hash": "2edcbcc9d407e3cc9d2607740e19f058",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 39.765957446808514,
"alnum_prop": 0.6741573033707865,
"repo_name": "endlessm/chromium-browser",
"id": "afe30eb12ce00b14c60a8420288f2b0cab372cc4",
"si... |
"""Templates package."""
import pkgutil
from anybadge.exceptions import UnknownBadgeTemplate
def get_template(name: str) -> str:
"""Get a template by name.
Examples:
>>> get_template('default') # doctest: +ELLIPSIS
'<?xml version="1.0" encoding="UTF-8...
"""
try:
data = pk... | {
"content_hash": "9182513ebfd1b13a4c94bd58cb26ff11",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 57,
"avg_line_length": 21.791666666666668,
"alnum_prop": 0.6233269598470363,
"repo_name": "jongracecox/anybadge",
"id": "38e45aa6b9e1fb9a72c099a21140a0947df646dd",
"size": ... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/space/reverse_engineering/shared_shields_analysis_tool.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
re... | {
"content_hash": "27e3899d2c2f10308199715c1e8008f0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 102,
"avg_line_length": 25.46153846153846,
"alnum_prop": 0.7099697885196374,
"repo_name": "anhstudios/swganh",
"id": "abd9bb13211089ba81b7e254e25cd75576c795ac",
"size": "47... |
import pandas as pd
import os
os.chdir("../Module1/")
cwd = os.getcwd()
print(cwd)
# TODO: Load up the 'tutorial.csv' dataset
csv_df = pd.read_csv('tutorial.csv', sep=',')
# TODO: Print the results of the .describe() method
print(csv_df)
print(csv_df.describe())
print(csv_df.info())
print(csv_df.head(3... | {
"content_hash": "24a5c34d410cf1855ad64d2c5c6f0542",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 109,
"avg_line_length": 32.30434782608695,
"alnum_prop": 0.6823687752355316,
"repo_name": "kHarshit/DAT210x_Microsoft",
"id": "aad29cb6af1d7b08704a26cb185ffd221e99482d",
"s... |
from django.contrib.auth.models import User
import json
import requests
from readux import __version__
class GithubApiException(Exception):
pass
class GithubAccountNotFound(GithubApiException):
pass
class GithubApi(object):
'''Partial GitHub API access.
Does **NOT** implement the full API, only th... | {
"content_hash": "2b97d7a21257f9c53863fc113f6da907",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 76,
"avg_line_length": 38.81954887218045,
"alnum_prop": 0.610110400929692,
"repo_name": "emory-libraries/readux",
"id": "d4730adb67f63435ddc4abc2f9a20d4cab5a60d7",
"size":... |
class Solution:
# @return a list of lists of string
def solveNQueens(self, n):
self.solutions = []
self.n = n
self.recursiveSolve([], [], [])
drawings = []
for solution in self.solutions:
drawings.append(self.drawSolutions(solution))
return drawings... | {
"content_hash": "72641d09672e608f7c71d3d787211fe1",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 83,
"avg_line_length": 30.121951219512194,
"alnum_prop": 0.5060728744939271,
"repo_name": "feigaochn/leetcode",
"id": "f6fe54567fd032ae36ecd21ed88edef4e2f81b0a",
"size": "1... |
from ..models.Testcase import CodechefTestcase as Testcase
from bs4 import BeautifulSoup
from termicoder.utils.logging import logger
# Many corner cases are being handled in extracting testcases
# maybe we can implement our own parser here instead of using
# beautiful soup. Most type of problems should be extracted
d... | {
"content_hash": "6ad08177b155e695765ec4faeb3c510c",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 77,
"avg_line_length": 37.14563106796116,
"alnum_prop": 0.5893883951907998,
"repo_name": "termicoder/termicoder",
"id": "a89b52df4dee469bacf2f7fa084dfc78da821ba1",
"size":... |
def Help(inp):
print("sorry this help does not exist.")
| {
"content_hash": "d3a4b934e79368d6de693920bb093b40",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 44,
"avg_line_length": 30,
"alnum_prop": 0.6666666666666666,
"repo_name": "ScratchOs/hungryStack",
"id": "68ce08b9be1495f5f94ad89f3a5519b487983c7d",
"size": "60",
"binary"... |
from flask import render_template
from indico.core.notifications import email_sender, make_email
@email_sender
def notify_request(owner, blocking, blocked_rooms):
"""
Notifies room owner about blockings he has to approve.
Expects only blockings for rooms owned by the specified owner
"""
subject =... | {
"content_hash": "f6aed755a3616cb1ca1e78b51cd180ca",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 96,
"avg_line_length": 39.55172413793103,
"alnum_prop": 0.7061900610287707,
"repo_name": "OmeGak/indico",
"id": "a8809be56cb4064c19a3a9d4b605af8ed9ef44ac",
"size": "1361",
... |
"""
Reactor-based Services
Here are services to run clients, servers and periodic services using
the reactor.
If you want to run a server service, L{StreamServerEndpointService} defines a
service that can wrap an arbitrary L{IStreamServerEndpoint
<twisted.internet.interfaces.IStreamServerEndpoint>}
as an L... | {
"content_hash": "6d5d6d6ae5398e245dde699f16cdfc41",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 92,
"avg_line_length": 31.781094527363184,
"alnum_prop": 0.6314182842830307,
"repo_name": "timkrentz/SunTracker",
"id": "cc72dcd54bc6ffe5ffbd1f73adfd6f5741c6bfc6",
"size":... |
from py_paddle import swig_paddle
import util
import numpy as np
import unittest
class TestIVector(unittest.TestCase):
def test_createZero(self):
m = swig_paddle.IVector.createZero(10, False)
self.assertIsNotNone(m)
for i in xrange(10):
self.assertEqual(m[i], 0)
m[i... | {
"content_hash": "9886e96a4d6f6db83c787080fc4f9d04",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 80,
"avg_line_length": 36.935251798561154,
"alnum_prop": 0.5895987534086482,
"repo_name": "dayhaha/Paddle",
"id": "1ab095c1d3d0d2c84d2d2f95a03f172b901de209",
"size": "5744... |
from __future__ import absolute_import
import json
import os
import requests
from collections import OrderedDict
try:
from urllib import urlencode
except Exception as e:
from urllib.parse import urlencode
def _sort_dictionary(dictionary):
output = OrderedDict()
for key in sorted(dictionary):
... | {
"content_hash": "a5294c0432c2ee51c41f98e232f10356",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 115,
"avg_line_length": 36.31004366812227,
"alnum_prop": 0.5962717979555021,
"repo_name": "eillarra/irekia",
"id": "46a69ea08498e10f7f891038118a47f4a76c0b41",
"size": "831... |
import cv2
import numpy as np
import sys
# this script will find lines and circles in an image
# constrained to find medium-sized circles (for bike wheels)
# and near-vertical lines for identifying buses
# to invoke:
# python /path/to/hough_opencv.py /path/to/input_image.jpg
# there are several python packages that... | {
"content_hash": "81b5dad31c79c2a13b21a74f581859ab",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 88,
"avg_line_length": 29.82089552238806,
"alnum_prop": 0.6676676676676677,
"repo_name": "mgolub2/bikeraxx",
"id": "45c89597582bae5bd21dbe34202cf01e3725d76e",
"size": "1998... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "5d23ee875defff75123d61ba4ee7b676",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 76,
"avg_line_length": 30.85,
"alnum_prop": 0.7032788929061214,
"repo_name": "Lothiraldan/swagger-fuzzer",
"id": "e5dd32ac25cc508204cf8548bb1c4174eb76d037",
"size": "8470"... |
"""Settings for adding noise to the action and measurements."""
import numpy as np
from numpy import random
from fusion_tcv import tcv_common
class Noise:
"""Class for adding noise to the action and measurements."""
def __init__(self,
action_mean=None,
action_std=None,
... | {
"content_hash": "8e12f87ac8088f82e70b4678ab4b6c3b",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 37.88461538461539,
"alnum_prop": 0.6210659898477158,
"repo_name": "deepmind/deepmind-research",
"id": "c8363d75f08fe052053bdd9b4466aa425755b469",
"s... |
from django.contrib import admin
from basic.music.models import *
class GenreAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
admin.site.register(Genre, GenreAdmin)
class LabelAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
admin.site.register(Label, LabelAdmin)
cl... | {
"content_hash": "dd1983435a3d49f7183831f4579c3e13",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 46,
"avg_line_length": 22,
"alnum_prop": 0.7107438016528925,
"repo_name": "blampe/M2M",
"id": "90e436f6230567720cb6da2ce42c1eb32539733a",
"size": "726",
"binary": false,
... |
"""
flaskbb.forum.views
~~~~~~~~~~~~~~~~~~~~
This module handles the forum logic like creating and viewing
topics and posts.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
import datetime
from flask import (Blueprint, redirect, url_for, current_app,... | {
"content_hash": "ad72c30c08ec88a2e59c9a9d177ecc46",
"timestamp": "",
"source": "github",
"line_count": 605,
"max_line_length": 79,
"avg_line_length": 35.67768595041322,
"alnum_prop": 0.6164466064396572,
"repo_name": "lucius-feng/flaskbb",
"id": "081ec2c281338448fde883026c4a088b51a2bb29",
"size": "... |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def perfectSeparation_unbalanced():
print("Read in synthetic unbalanced dataset")
data = h2o.import_file(h2o.locate("smalldata/synthetic_perfect_separation/unbalanced.csv"))
print("Fit model on dataset.")
model = h2o.glm(x=data[["... | {
"content_hash": "c2f0254e4c4d3afe9dfc40c019746c98",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 118,
"avg_line_length": 36.68181818181818,
"alnum_prop": 0.6592317224287485,
"repo_name": "printedheart/h2o-3",
"id": "30d14b0c0b5ab84286e682c26b7581529bab5fbe",
"size": "8... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingMedian'] , ['NoCycle'] , ['MLP'] ); | {
"content_hash": "73b6257bc8ae53eec9e56460c6585c06",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 75,
"avg_line_length": 37,
"alnum_prop": 0.6959459459459459,
"repo_name": "antoinecarme/pyaf",
"id": "c283f737d0e90daf68d597f3df29df3a356f0600",
"size": "148",
"binary": f... |
"""cl.utils"""
from __future__ import absolute_import
import operator
from importlib import import_module
from itertools import imap, ifilter
from kombu.utils import cached_property # noqa
__all__ = ["force_list", "flatten", "get_cls_by_name",
"instantiate", "cached_property"]
def force_list(obj):
... | {
"content_hash": "bc3b13c1b0a930f5b0ab200571688a03",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 75,
"avg_line_length": 23.73394495412844,
"alnum_prop": 0.5887127947429455,
"repo_name": "pexip/os-python-cl",
"id": "91e98cc554fe49da11f92cc9554a37576fdb7a5d",
"size": "2... |
FAILEDOPERATION_APPLYBLACKLISTDATAERROR = 'FailedOperation.ApplyBlackListDataError'
# 提交黑名单出错。
FAILEDOPERATION_APPLYBLACKLISTERROR = 'FailedOperation.ApplyBlackListError'
# 提交信审申请出错。
FAILEDOPERATION_APPLYCREDITAUDITERROR = 'FailedOperation.ApplyCreditAuditError'
# 机器人任务作业状态更新出错。
FAILEDOPERATION_CHANGEBOTCALLSTATUSER... | {
"content_hash": "ab9244c28155722ee6ee138ab564c2f7",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 89,
"avg_line_length": 29.855670103092784,
"alnum_prop": 0.8535911602209945,
"repo_name": "tzpBingo/github-trending",
"id": "469c5bcb7a47dcb1010c1bc54b938945526b1c27",
"siz... |
"""
This module provides more sophisticated flow tracking and provides filtering and interception facilities.
"""
from __future__ import absolute_import
from abc import abstractmethod, ABCMeta
import hashlib
import Cookie
import cookielib
import os
import re
import urlparse
from netlib import wsgi
from netlib.exc... | {
"content_hash": "de45e14d10e3f0b3511ce9cd7d21dee6",
"timestamp": "",
"source": "github",
"line_count": 1114,
"max_line_length": 109,
"avg_line_length": 28.45152603231598,
"alnum_prop": 0.5369616658778987,
"repo_name": "ccccccccccc/mitmproxy",
"id": "d735b9eced709fe2786c8e5e6c0052e41f6e63c6",
"size... |
"""Additional help text for anonymous access."""
from __future__ import absolute_import
from gslib.help_provider import HelpProvider
_DETAILED_HELP_TEXT = ("""
<B>OVERVIEW</B>
gsutil users can access publicly readable data without obtaining
credentials. For example, the gs://uspto-pair bucket contains a number
... | {
"content_hash": "bfdf1d5812ece759f793ef121d9e2836",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 36.357142857142854,
"alnum_prop": 0.7531106745252129,
"repo_name": "KaranToor/MA450",
"id": "79c5a66abfa13fb07bcb89945ab8d70e9254707d",
"size": "2147... |
from scrapy.contrib.spiders import Spider
from scrapy.selector import Selector
from scrapy.http import Request
from Movie.items import MovieComment
class CommentSpider(Spider):
name = "moviecomment"
start_urls = [
]
def parse(self, response):
comments = list()
selector = ... | {
"content_hash": "48a1e682439621700a75b09b181b60f1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 108,
"avg_line_length": 42.645161290322584,
"alnum_prop": 0.586232980332829,
"repo_name": "time-river/wander",
"id": "21423d5281e0a16511d498a1525fd448de6488b5",
"size": "13... |
import unittest
from EXRReader import *
from TIFFReader import *
from ImagePrimitive import *
from JPEGReader import *
from CINReader import *
| {
"content_hash": "3d24124cf54ea5bce0462f994ed3d687",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 28,
"avg_line_length": 20.571428571428573,
"alnum_prop": 0.8055555555555556,
"repo_name": "hradec/cortex",
"id": "28e06a36af74997c81f0985297413c7b4e294dbd",
"size": "1928",
... |
'''
Fantastic Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in th... | {
"content_hash": "f73c5d3a8658c46d33b8d09a7c575b0c",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 116,
"avg_line_length": 34.10204081632653,
"alnum_prop": 0.5739078396169958,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "110ac820e5a4c180c65220c9de3e413378b73fd4",
... |
from __future__ import absolute_import
from sentry.constants import ObjectStatus
from sentry.models import Repository
class RepositoryMixin(object):
def get_repositories(self):
"""
Get a list of availble repositories for an installation
>>> def get_repositories(self):
>>> re... | {
"content_hash": "c8a3fddbfe46551aa58c904cc9b4aa98",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 29.96875,
"alnum_prop": 0.6256517205422315,
"repo_name": "looker/sentry",
"id": "89e335657434708dd02f2242cda934bfd43606f8",
"size": "959",
"binary"... |
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.25
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubernete... | {
"content_hash": "2178812677f26750166e5cd53d976b0e",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 124,
"avg_line_length": 28.127450980392158,
"alnum_prop": 0.5629139072847682,
"repo_name": "kubernetes-client/python",
"id": "67a7ff7571b738c0dc848f1fa2598d2b1f3a9f7c",
"s... |
import gzip
import numpy
from bigdl.dllib.feature.dataset import base
from bigdl.dllib.feature.dataset.transformer import *
from bigdl.dllib.utils.log4Error import *
SOURCE_URL = 'https://ossci-datasets.s3.amazonaws.com/mnist/'
TRAIN_MEAN = 0.13066047740239506 * 255
TRAIN_STD = 0.3081078 * 255
TEST_MEAN = 0.132514... | {
"content_hash": "53e438415a7b566bb9eb9daf6c4d3dc7",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 95,
"avg_line_length": 38.17460317460318,
"alnum_prop": 0.603950103950104,
"repo_name": "intel-analytics/BigDL",
"id": "1c8919efa0edbb8eba62ea4f8129d30165306062",
"size": ... |
"""Tests for the conversion functions."""
import pytest
from sc.conversions import UNITS, _to_dp, _from_dp
@pytest.mark.parametrize('unit', UNITS)
def test_conversion_bidirectional(unit):
to_ = _from_dp[unit]
from_ = _to_dp[unit]
assert to_(from_(100)) == 100
| {
"content_hash": "8ea161265f1c358093ac54c958d38742",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 50,
"avg_line_length": 23,
"alnum_prop": 0.6739130434782609,
"repo_name": "joshfriend/screencalc",
"id": "76c9cd991541ec3b9c8273f03b9a9fa217525f06",
"size": "299",
"binar... |
"""Unit tests for the API endpoint"""
import random
import StringIO
import boto
from boto.ec2 import regioninfo
from boto import exception as boto_exc
# newer versions of boto use their own wrapper on top of httplib.HTTPResponse
try:
from boto.connection import HTTPResponse
except ImportError:
from httplib im... | {
"content_hash": "fe67d73d10e30ae7995999c8db28ba4b",
"timestamp": "",
"source": "github",
"line_count": 598,
"max_line_length": 79,
"avg_line_length": 37.68561872909699,
"alnum_prop": 0.5705981540646078,
"repo_name": "usc-isi/nova",
"id": "4a426070533b4390f8d2966d40d4072ef5034627",
"size": "23313",... |
"""Parameter optimizer."""
__all__ = ['Trainer']
from .. import optimizer as opt
from ..model import _create_kvstore
from .parameter import ParameterDict, Parameter
class Trainer(object):
"""Applies an `Optimizer` on a set of Parameters. Trainer should
be used together with `autograd`.
Parameters
---... | {
"content_hash": "fca699ce71483a907ce8200f22c4c226",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 103,
"avg_line_length": 42.67272727272727,
"alnum_prop": 0.5749893481039625,
"repo_name": "TuSimple/mxnet",
"id": "e730fd7cd8bdd668b5b5849a0cd4bd4177c06882",
"size": "1022... |
import functools
import httplib as http
import itertools
from operator import itemgetter
from dateutil.parser import parse as parse_date
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.utils import timezone
from flask import request, redirect
import pytz
from framework.d... | {
"content_hash": "8ed71439ad5b3248fdec5c570e5e2b57",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 159,
"avg_line_length": 36.86898395721925,
"alnum_prop": 0.6648052795706723,
"repo_name": "chennan47/osf.io",
"id": "ee606fa73298d2e533b3ab470df66a94bfa1ed3c",
"size": "13... |
import datetime
import unittest
from unittest import mock
import pytest
from airflow.exceptions import AirflowException
from airflow.models import DAG, Connection, DagRun, TaskInstance as TI
from airflow.operators.dummy import DummyOperator
from airflow.operators.sql import (
BranchSQLOperator,
SQLCheckOperat... | {
"content_hash": "f8654d05966ce823fed6643a5ac2ba1f",
"timestamp": "",
"source": "github",
"line_count": 734,
"max_line_length": 96,
"avg_line_length": 34.81198910081744,
"alnum_prop": 0.580737319974953,
"repo_name": "apache/incubator-airflow",
"id": "3706fd6d4a0c12dcc45bce4bcfba8201b6a21ee7",
"size... |
"""
Exodus Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the h... | {
"content_hash": "d28e3fdd40d61925bd5e7da3d9839775",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 144,
"avg_line_length": 40.2710843373494,
"alnum_prop": 0.5213163799551234,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "f9126cb13ea03781cbc2c7ff63c9e4d21cf2766e",
... |
import falcon
import jieba
import json
import jieba.posseg as pseg
import posSeg
class Resource(object):
def on_post(self, req, resp):
body = req.stream.read()
if not body:
raise falcon.HTTPBadRequest('Empty request body')
#seg_list = list(jieba.cut(body, cut_all=False))
... | {
"content_hash": "472f87239ae628995511d67fab643a56",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 61,
"avg_line_length": 27.95,
"alnum_prop": 0.6100178890876565,
"repo_name": "eit/jieba-web-service",
"id": "615b29653411d9ad86ab567d648477b8e938b60f",
"size": "559",
"bi... |
from django.shortcuts import redirect, render
import clinq.models as model
from django.http import HttpResponse, StreamingHttpResponse
from django.db.models import Count, Min, Sum, Avg
from django.shortcuts import get_object_or_404, render
# Create your views here.
def Home(request):
return render(request, 'home... | {
"content_hash": "ee057a8cf8a99be6018ddac83a444ad9",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 123,
"avg_line_length": 27.296296296296298,
"alnum_prop": 0.7360922659430122,
"repo_name": "Ahn1/Clinq",
"id": "44946276c3130ca3fafd3da7cbfc736a7ef3071f",
"size": "1474",
... |
from bs4 import SoupStrainer
from bs4 import BeautifulSoup
from urllib import urlopen
only_ul_tags = SoupStrainer("ul")
url = "http://tratu.coviet.vn/hoc-tieng-trung/cap-cau-song-ngu/vietgle-tra-tu/tat-ca/trang-1.html"
soup = BeautifulSoup(urlopen(url), "html.parser", parse_only = only_ul_tags)
print (soup.prettify(... | {
"content_hash": "3f5c6b2d1533c038864689a2af685bad",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 98,
"avg_line_length": 32.2,
"alnum_prop": 0.7577639751552795,
"repo_name": "hoaibang07/collecting-corpus-online",
"id": "3ee178d8f2e03115e15dcf3e6cc5b0c823fd959f",
"size":... |
from typing import Tuple
import base64, getpass
import pysodium #type: ignore
#===============================================================================
def prompt_for_new_password() -> str:
""" Prompt the user to enter a new password, with confirmation """
while True:
passw: str = getpass.getp... | {
"content_hash": "9a38fdecd6ccd4a11e39f51eeb858cf9",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 87,
"avg_line_length": 45.01754385964912,
"alnum_prop": 0.5530007794232268,
"repo_name": "robehickman/simple-http-file-sync",
"id": "a66f5ea4943dd5a7f1a4fb206fd4e67fef3d061d"... |
"""
Fava – A web interface for beancount.
Copyright © 2015-2016 Dominik Aumayr <[email protected]>
Licensed under the MIT License.
You may not use this file except in compliance with the License.
Unless required by applicable law or agreed to in writing, software
distributed under the Licens... | {
"content_hash": "45f7e1e0d37c92e371b8ed15da5d7ff4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 76,
"avg_line_length": 41.470588235294116,
"alnum_prop": 0.7120567375886525,
"repo_name": "corani/beancount-web",
"id": "b49bde7ef33369fe70747b8986ffe35f46feef79",
"size": ... |
"""Fichier contenant la classe DiligenceMaudite, détaillée plus bas."""
from random import choice
from abstraits.obase import BaseObj
class DiligenceMaudite(BaseObj):
"""Classe représentant une diligence maudite.
Une diligence maudite au niveau prototype est un modèle, définissant
un ensemble de salles... | {
"content_hash": "65bd4fe8fcccc96507089b26a3b443a9",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 77,
"avg_line_length": 37.625,
"alnum_prop": 0.5954660934141098,
"repo_name": "vlegoff/tsunami",
"id": "cdbbc2da9a6e58fff6ec6503829dcb6f8567444e",
"size": "6724",
"binar... |
from django.test import Client, TestCase
from .utils import create_admin_account, make_request
from app.timetables.factories import TimetableFactory
class TimetableApiTest(TestCase):
def setUp(self):
self.client = Client()
create_admin_account()
self.timetable = TimetableFactory()
d... | {
"content_hash": "f5edc214eb25b6b2d05bbc6d83b0daf3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 55,
"avg_line_length": 27.153846153846153,
"alnum_prop": 0.6359773371104815,
"repo_name": "teamtaverna/core",
"id": "67179eb4207ea35286c19bcdf93e8b696bb462b3",
"size": "706... |
def library_keyword_1(arg1):
"""library keyword 1 doc"""
print arg1
def library_keyword_2(arg1, arg2):
"""library keyword 2 doc"""
print arg1, arg2
| {
"content_hash": "da168c98f274ae32486ab0585bf1bec3",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 34,
"avg_line_length": 21.75,
"alnum_prop": 0.6091954022988506,
"repo_name": "andriyko/sublime-robot-framework-assistant",
"id": "8b6015d8dd544413926b429b35bc3463a17c751f",
... |
from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER
from django.contrib.gis.geos.libgeos import lgeos, CS_PTR, GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import \
check_geom, check_minus_one, check_sized_string, check_string, check_zero
# This is the return type used by binary out... | {
"content_hash": "5d1782ebb7341b2fd287a36119e52cab",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 79,
"avg_line_length": 36.55555555555556,
"alnum_prop": 0.7403386886669562,
"repo_name": "chewable/django",
"id": "d42ceaa29205c0d201bffc93870b146440e33dfe",
"size": "4606... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mybitbank.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "d459e072e49a0d88d4f204dbf92010ee",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 23.1,
"alnum_prop": 0.70995670995671,
"repo_name": "sgoudelis/mybitbank",
"id": "ecaa0ecfa31ea71a6f84a7da645ca52cf138938a",
"size": "253",
"binary"... |
"""Support for Geofency."""
from aiohttp import web
import voluptuous as vol
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
ATTR_NAME,
CONF_WEBHOOK_ID,
HTTP_OK,
HTTP_UNPROCESSABLE_ENTITY,
STATE_NO... | {
"content_hash": "917ad48987471996bcdec2c7525c0324",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 87,
"avg_line_length": 29.289473684210527,
"alnum_prop": 0.6617250673854448,
"repo_name": "sander76/home-assistant",
"id": "1cbaea2373371f09eae4b3e2690854dbf960f493",
"siz... |
from api import serializers as s
class NodeVersionSerializer(s.Serializer):
hostname = s.Field()
version = s.Field(source='system_version')
platform_version = s.Field(source='platform_version')
| {
"content_hash": "414ca31c2279addd3acf9d4012b1dd2c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 57,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.7307692307692307,
"repo_name": "erigones/esdc-ce",
"id": "ed470e09cb3afdc26faf810f3ce0782a860ab6dd",
"size": "208"... |
from __future__ import unicode_literals
import frappe, copy, json
from frappe import _, msgprint
from frappe.utils import cint
rights = ("read", "write", "create", "delete", "submit", "cancel", "amend",
"print", "email", "report", "import", "export", "set_user_permissions")
def check_admin_or_system_manager(user=Non... | {
"content_hash": "4dce06f278cef33fe6c2151dc61125cb",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 142,
"avg_line_length": 35.46124031007752,
"alnum_prop": 0.72292053776369,
"repo_name": "gangadharkadam/v5_frappe",
"id": "c384689a0dce4037d0061d7b6efcfe4555197554",
"size... |
import os
import mock
from os_brick.initiator import connector
from nova import exception
from nova.tests.unit.virt.libvirt.volume import test_volume
from nova import utils
from nova.virt.libvirt.volume import vzstorage
class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
"""Tests the libvirt ... | {
"content_hash": "e9380ab261d24b062e243e6c874353a0",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 43.88775510204081,
"alnum_prop": 0.5773076028830505,
"repo_name": "vmturbo/nova",
"id": "23adb8d52b64b8e01bdef518812e78bd14cb5af5",
"size": "4874",
... |
"""
Retina-inspired preprocessing as described in
Salakhutdinov, R. and Hinton, G. Deep Boltzmann machines.
In *AISTATS* 2009.
"""
import numpy
from pylearn2.datasets.dense_design_matrix import DefaultViewConverter
from pylearn2.space import Conv2DSpace
def foveate_channel(img, rings, output, start_idx):
... | {
"content_hash": "7e44daaa796adef3bb9af1b7ee02d72a",
"timestamp": "",
"source": "github",
"line_count": 404,
"max_line_length": 143,
"avg_line_length": 28.455445544554454,
"alnum_prop": 0.6018615170494085,
"repo_name": "ml-lab/pylearn2",
"id": "5caa4bb01e354fb1bb97ad686dfe158b3cf6fa5a",
"size": "11... |
"""
#;+
#; NAME:
#; spec_guis
#; Version 1.0
#;
#; PURPOSE:
#; Module for Spectroscopy Guis with QT
#; These call pieces from spec_widgets
#; 12-Dec-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, ... | {
"content_hash": "005031a7f029ad1bb4fb9e9bb4ddde85",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 107,
"avg_line_length": 34.96875,
"alnum_prop": 0.5615132558832291,
"repo_name": "profxj/xastropy",
"id": "5f04ce8598c4605be7316491f98ffd12582f1a85",
"size": "20142",
"b... |
from __future__ import absolute_import, division, print_function, unicode_literals
import csv
import datetime
import io
from datetime import timedelta
import itertools
import time
from concurrent.futures import as_completed
from dateutil.tz import tzutc
import six
from botocore.exceptions import ClientError
from coll... | {
"content_hash": "4ad557e404d18152a116c2b15932e580",
"timestamp": "",
"source": "github",
"line_count": 1441,
"max_line_length": 99,
"avg_line_length": 32.47814018043026,
"alnum_prop": 0.5747740432896733,
"repo_name": "taohungyang/cloud-custodian",
"id": "00f2574a7b992e69e84feb6d8756237452e0c435",
... |
from __future__ import absolute_import
from datetime import timedelta
from random import randint
from flask import current_app
from celery import Celery
from celery.schedules import crontab
from celery.signals import worker_process_init
from redash import __version__, create_app, settings
from redash.metrics import ... | {
"content_hash": "a2f6f35edcda18a6d88fd9a6dd9242f3",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 117,
"avg_line_length": 32.41860465116279,
"alnum_prop": 0.6714490674318508,
"repo_name": "crowdworks/redash",
"id": "fed631698ee35e4f9fe77d57d60b952e8293ff67",
"size": "27... |
from .models import *
def fix_airport_country(country_str, iso_code2):
try:
aps = Airport.objects.filter(country_str__contains=country_str)
except:
print("No listings were found.")
try:
c = Country.objects.get(iso_code2=iso_code2)
except:
print("That country was not fou... | {
"content_hash": "c1d4999e94a0884d3500278614f9c373",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 76,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.5987124463519313,
"repo_name": "MarconiMediaGroup/TravelHub",
"id": "feea8816a90d18e6c34866f44b3c18f4f39d23ca",
"s... |
import os
from project import app
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port) | {
"content_hash": "f275c9236e11afedc043c233abda9a38",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 40,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.6875,
"repo_name": "yangchandle/FlaskTaskr",
"id": "a7191b9b69e1c151c84ffebe843ac8adf4092b82",
"size": "132",
"b... |
import rospy
import math
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Twist, Quaternion
from tf import transformations as tft
def quaternion_to_heading(quaternion):
"""
Converts a quaternion to equivalent Euler yaw/heading
input: nav_msgs.msg.Quaternion
output: euler heading in radi... | {
"content_hash": "66d079c55acfd4e80b12e549b9325d82",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 84,
"avg_line_length": 31.600806451612904,
"alnum_prop": 0.6698991961209646,
"repo_name": "buckbaskin/drive_stack",
"id": "84258e38a185583192da25355ba5468718d5efb9",
"size... |
'''
Manage RDP Service on Windows servers
'''
# Import python libs
import re
# Import salt libs
import salt.utils
def __virtual__():
'''
Only works on Windows systems
'''
if salt.utils.is_windows():
return 'rdp'
return False
def _parse_return_code_powershell(string):
'''
return... | {
"content_hash": "10fc1d619f935b4cef93f91cfe866c5b",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 76,
"avg_line_length": 19.74712643678161,
"alnum_prop": 0.5890570430733411,
"repo_name": "victorywang80/Maintenance",
"id": "428c360db32eb8885ae1d1096fb8c240654bba08",
"siz... |
import matplotlib as mp
mp.use('agg')
from model.bootstrap_func import flattenList, checkFileExists, readFreqsFile, readLDFile, readFstFile, estimateFstByBootstrap, estimateFstByBootstrap_bysnp, estimateFreqSpectrum, estimatePi, estimater2decay, estimatedprimedecay
from model.params_func import get_ranges, generate_p... | {
"content_hash": "b109a715043fc3cfe56f68bb5d6c2d23",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 268,
"avg_line_length": 47.7728285077951,
"alnum_prop": 0.6762237762237763,
"repo_name": "broadinstitute/cms",
"id": "704ccf37a7cf93128f9598b8978b02954ab8c7e8",
"size": "2... |
"""Fixtures for harmony tests."""
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
from aioharmony.const import ClientCallbackType
import pytest
from homeassistant.components.harmony.const import ACTIVITY_POWER_OFF
from .const import NILE_TV_ACTIVITY_ID, PLAY_MUSIC_ACTIVITY_ID, WATCH_TV_ACTIVITY_I... | {
"content_hash": "1188cbad13c364d660a3c3e518afd619",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 84,
"avg_line_length": 31.473333333333333,
"alnum_prop": 0.6015674645202288,
"repo_name": "partofthething/home-assistant",
"id": "29e897916b9bbe68d4f823103fab4cb44ff7d85c",
... |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import rapidtide.fit as tide_fit
import rapidtide.miscmath as tide_math
from rapidtide.tests.utils import mse
def eval_phaseanalysis(phasestep=0.01, amplitude=1.0, numpoints=100, display=False):
# read in some data
phases = np.linspa... | {
"content_hash": "f018db6a14406827f1889bce8b14aab9",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 99,
"avg_line_length": 27.9811320754717,
"alnum_prop": 0.6844234659474039,
"repo_name": "bbfrederick/rapidtide",
"id": "b06a849fd9099f762b5335aec63314fae2b860c7",
"size": "... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(... | {
"content_hash": "e5dfe4a165e73e00831950336c3bc8a2",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 66,
"avg_line_length": 25.0188679245283,
"alnum_prop": 0.5904977375565611,
"repo_name": "irothschild/stefuna",
"id": "48f02f459e391641a1dd7e32d55b703afe4942f9",
"size": "13... |
import sys
sys.path.insert(1, "../../../")
import h2o
def binop_eq(ip,port):
iris = h2o.import_file(path=h2o.locate("smalldata/iris/iris_wheader.csv"))
rows, cols = iris.dim
iris.show()
#frame/scaler
res = iris == 4.7
res_rows, res_cols = res.dim
assert res_rows == rows and res_... | {
"content_hash": "ee5fe93f969f8ca86276ab5ccb97f82f",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 87,
"avg_line_length": 28.404761904761905,
"alnum_prop": 0.5984911986588433,
"repo_name": "PawarPawan/h2o-v3",
"id": "bc5fa5b24f87290b39b06d65791a395ace8d0bb0",
"size": "23... |
"""A requests-compatible system for BIG-IP token-based authentication.
BIG-IP only allows users with the Administrator role to authenticate to
iControl using HTTP Basic auth. Non-Administrator users can use the
token-based authentication scheme described at:
https://devcentral.f5.com/wiki/icontrol.authentication_w... | {
"content_hash": "606baa9319d9bfab4983056ca13c75d3",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 82,
"avg_line_length": 40.4251012145749,
"alnum_prop": 0.6053079619429144,
"repo_name": "F5Networks/f5-icontrol-rest-python",
"id": "b2aa0fc6b31d539f0f7568d66bdd139310ee792b... |
"""
pygments.lexers.robotframework
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for Robot Framework.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# Copyright 2012 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version ... | {
"content_hash": "57a4eb4fecfa134712a3a79cf01d7b0c",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 108,
"avg_line_length": 33.42210144927536,
"alnum_prop": 0.5939617323432165,
"repo_name": "pygments/pygments",
"id": "91794d0f2b3362c63e3f11226428f7f9d78678e0",
"size": "1... |
from flask import request
from flask.ext.restful import Resource
from tracker.extensions import db, api
from tracker.models import Comment, Expense
from tracker.forms import CommentCreateForm
from flask.ext.login import current_user
from tracker.utils import seconds_since_week
from tracker.decorators import login_req... | {
"content_hash": "9e550a6b95608a89bdf0ba14e950a7aa",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 93,
"avg_line_length": 26.842105263157894,
"alnum_prop": 0.7627450980392156,
"repo_name": "ahsanali/expense-tracker",
"id": "95eb66af3f55024d1763cd6600c7d86b79da5259",
"siz... |
class Maybe(object):
"""Maybe a"""
def is_defined(self):
pass
def get_or_else(self, default):
"""get_or_else :: a -> a"""
pass
def or_else(self, default):
"""or_else :: Maybe a -> Maybe a"""
pass
def map(self, f):
"""map :: (a -> b) -> Maybe b"""
... | {
"content_hash": "5ea52d62dbe8ba580cb7cd51bdb19792",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 82,
"avg_line_length": 18.871559633027523,
"alnum_prop": 0.49586776859504134,
"repo_name": "fsarradin/pythonz",
"id": "44d844d62f0144f55806a2daa8b597a93ed167e8",
"size": "... |
import datetime
from decimal import Decimal
from django.db import models
from django.utils.translation import ugettext_lazy as _
from budget.categories.models import Category, StandardMetadata, ActiveManager
TRANSACTION_TYPES = (
('expense', _('Expense')),
('income', _('Income')),
)
class TransactionManag... | {
"content_hash": "19690df8c7dac758f5f5e97fcee0b7b5",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 138,
"avg_line_length": 36.375,
"alnum_prop": 0.708885616102111,
"repo_name": "toastdriven/django-budget",
"id": "64700d19452a3dd4b83317ae7eba4aee1ed06e47",
"size": "2037",... |
"""Responible for launching the server process."""
import subprocess, sys, os
shutdown_requested = False
while not shutdown_requested:
server_process = subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "start_server.py")])
out, errors = server_process.communicate()
print(server_process.returncod... | {
"content_hash": "1940b08fcd50fa6169ed236d78cc8204",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 101,
"avg_line_length": 40.7,
"alnum_prop": 0.7346437346437347,
"repo_name": "marky1991/Legend-of-Wumpus",
"id": "5cce6958c97d05936a372ef10cc8b8c7a9b292af",
"size": "407",
... |
import boto.ec2
import boto.ec2.elb
if __name__ == '__main__':
ec2_conn = boto.ec2.connection.EC2Connection()
instances = {}
for r in ec2_conn.get_all_instances():
for i in r.instances:
instances[i.id] = i
elb_conn = boto.ec2.elb.connect_to_region('us-east-1')
lb = elb_conn.ge... | {
"content_hash": "5892b51e4e408e9e15a7d95bbe8f01b2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 62,
"avg_line_length": 31.142857142857142,
"alnum_prop": 0.6192660550458715,
"repo_name": "nejstastnejsistene/bannerstalker-yesod",
"id": "e694ffa9d2ed6bd129121b1239fbacc46cf... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['PolyTrend'] , ['Seasonal_WeekOfYear'] , ['LSTM'] ); | {
"content_hash": "a4379a45f6e351891941c0f06813c9f0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 99,
"avg_line_length": 43,
"alnum_prop": 0.7325581395348837,
"repo_name": "antoinecarme/pyaf",
"id": "c9ce924c6ae30d0f29ba1203b53b24dbec712bed",
"size": "172",
"binary": f... |
import pysam
import sys
import csv
import os
import argparse
from quicksect import IntervalNode
from random import randint, seed
def getOverlap(a, b):
return max(0, min(a[1], b[1]) - max(a[0], b[0]))
def is_junction(read):
for c in read.cigartuples:
if c[0]==3:
return True
return ... | {
"content_hash": "08001d2a020c21abc2327abae120dedc",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 120,
"avg_line_length": 20.936666666666667,
"alnum_prop": 0.503900652762299,
"repo_name": "smangul1/rprofile",
"id": "de27e932eb0981e683b2b4e910db612f6e275501",
"size": "6... |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Commodity(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
value = db.Column(db.Float)
def __init__(self, name, value):
self.name = name
self.value = value
def __repr__(self):
... | {
"content_hash": "a12f34d36a2b10509fd5d4ae2fe3d9d1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 66,
"avg_line_length": 21.862068965517242,
"alnum_prop": 0.6025236593059937,
"repo_name": "ThaWeatherman/spot_price",
"id": "e1486a000289133ac41e6d4b6ec684c9adc7073b",
"siz... |
import contextlib
import os
import tempfile
import unittest
import torch
from torchvision.utils import save_image
from densepose.data.image_list_dataset import ImageListDataset
from densepose.data.transform import ImageResizeTransform
@contextlib.contextmanager
def temp_image(height, width):
random_image = torch... | {
"content_hash": "9bf3b9b73973098828ae40c223a90853",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 38.43478260869565,
"alnum_prop": 0.6555429864253394,
"repo_name": "facebookresearch/detectron2",
"id": "7932602448b49b9be4fcea9645fe7a9c4d53c00e",
"s... |
from ctypes import *
import ctypes
import struct, os, threading, platform, atexit, inspect
from acq4.util.clibrary import *
from MultiClampTelegraph import *
from acq4.util.debug import *
DEBUG=False ## Global flag for debugging hangups
if DEBUG:
print "MultiClamp driver debug:", DEBUG
__all__ = ['MultiClamp', 'a... | {
"content_hash": "f9edd54f16c439e279c3f5ffc86a1740",
"timestamp": "",
"source": "github",
"line_count": 550,
"max_line_length": 160,
"avg_line_length": 36.97818181818182,
"alnum_prop": 0.5498082407316354,
"repo_name": "mgraupe/acq4",
"id": "b680657fcaf959d52f898912a217cb1dcdd6a3c5",
"size": "20362"... |
class BaseCartModifier(object):
"""
Price modifiers are the cart's counterpart to backends.
It allows to implement Taxes and rebates / bulk prices in an elegant manner:
Everytime the cart is refreshed (via it's update() method), the cart will
call all subclasses of this registered with their f... | {
"content_hash": "ed0de23a68a9852e51808114930682fa",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 83,
"avg_line_length": 39.083333333333336,
"alnum_prop": 0.6200426439232409,
"repo_name": "eduardostalinho/django-shop",
"id": "4d59815bb4745448505e5bcab38a2a40bce5b668",
"... |
"""Contains LossScale classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.distribute import distribution_strategy_context
from tensorflow.python.framework import ops
from tensorflow.python.framework import smart_cond
from tenso... | {
"content_hash": "8ab4ab223f40379eab81ba5f8f3c1822",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 89,
"avg_line_length": 41.66949152542373,
"alnum_prop": 0.685784014643075,
"repo_name": "gunan/tensorflow",
"id": "c07c8cca60a2b0ce235d2838eb2fcb2a3a36c47d",
"size": "1052... |
"""Test the Uonet+ Vulcan config flow."""
import json
from unittest import mock
from unittest.mock import patch
from vulcan import (
Account,
ExpiredTokenException,
InvalidPINException,
InvalidSymbolException,
InvalidTokenException,
UnauthorizedCertificateException,
)
from vulcan.model import S... | {
"content_hash": "eff209f209b5a37b4cfd6cdc5c6cb0d8",
"timestamp": "",
"source": "github",
"line_count": 857,
"max_line_length": 114,
"avg_line_length": 37.858809801633605,
"alnum_prop": 0.651471721374634,
"repo_name": "mezz64/home-assistant",
"id": "c45ab430c2e1c55c1650fea70ad0cfd1e407bb2b",
"size"... |
from django import template
register = template.Library()
@register.filter
def get_computational_value_by_answer(hierarchial_data):
options = {}
for location, answers in hierarchial_data.items():
for option, answer in answers.items():
if not options.has_key(option):
options... | {
"content_hash": "939f082d8168a575b063044fd6708ec5",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 56,
"avg_line_length": 28.105263157894736,
"alnum_prop": 0.5880149812734082,
"repo_name": "unicefuganda/mics",
"id": "9e47a1183d89c7dd90e9f8f99a98971f72b37365",
"size": "53... |
import json
import threading
import time
import os
import stat
import ssl
from decimal import Decimal
from typing import Union, Optional, Dict, Sequence, Tuple
from numbers import Real
from copy import deepcopy
from aiorpcx import NetAddress
from . import util
from . import constants
from .util import base_units, bas... | {
"content_hash": "8c63ca02ca0cece60678e9d0eff71b48",
"timestamp": "",
"source": "github",
"line_count": 725,
"max_line_length": 134,
"avg_line_length": 37.358620689655176,
"alnum_prop": 0.5822041720509508,
"repo_name": "pooler/electrum-ltc",
"id": "e6e5464d4a98905c5d5b048e27563a268e5f3fe0",
"size":... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import signal
import subprocess
import time
import traceback
from contextlib import contextmanager
import psutil
from pants.base.build_envir... | {
"content_hash": "db4547cf413f1417d60ed672646e728e",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 100,
"avg_line_length": 36.46052631578947,
"alnum_prop": 0.6660411403825334,
"repo_name": "jtrobec/pants",
"id": "7422dc47f2763c41e774027dea759e1022928e47",
"size": "14002... |
import os
import os.path as path
import re
from pelican import signals
import logging
logger = logging.getLogger(__name__)
try:
from PIL import Image, ImageOps
enabled = True
except ImportError:
logging.warning("Unable to load PIL, disabling thumbnailer")
enabled = False
DEFAULT_IMAGE_DIR = "pictures... | {
"content_hash": "9bce84288185472c8dd86dc52076b7d5",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 132,
"avg_line_length": 35.370165745856355,
"alnum_prop": 0.5938769134645423,
"repo_name": "BenoitDherin/data-analysis-with-R",
"id": "1cf91deba26624da2e751edf3b3d637b93f56d... |
from __future__ import annotations
import contextlib
import logging
import os.path
import time
from typing import Generator
from pre_commit import git
from pre_commit.util import CalledProcessError
from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b
from pre_commit.xargs import xargs
log... | {
"content_hash": "40ac44232cbee3d5e734fbfcdd923a57",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 78,
"avg_line_length": 35.43564356435643,
"alnum_prop": 0.6174909192511875,
"repo_name": "pre-commit/pre-commit",
"id": "172fb20b17c04f94d6a6251357a164b9cffe7812",
"size":... |
'''
Latent Dirichlet Allocation
References:
Heinrich, Gregor. Parameter estimation for text analysis. Technical report. 2005 (revised 2009)
Minka, Thomas P. Estimating a Dirichlet distribution. 2000. (revised 2012)
'''
import math
import numpy as np
import numpy.random as nprand
import scipy as sp
import scipy.misc ... | {
"content_hash": "abcdeac954f347de73b6014a4f237336",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 98,
"avg_line_length": 39.343669250645995,
"alnum_prop": 0.574412189675555,
"repo_name": "elplatt/lda-gibbs-em",
"id": "449bbcd7deb5d015d4c2a37e715c03821d688817",
"size": ... |
"""Component to interface with cameras."""
import asyncio
import base64
import collections
from contextlib import suppress
from datetime import timedelta
import logging
import hashlib
from random import SystemRandom
import attr
from aiohttp import web
import async_timeout
import voluptuous as vol
from homeassistant.c... | {
"content_hash": "f6491b9b724b68b74c850cde92d407ed",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 79,
"avg_line_length": 31.426865671641792,
"alnum_prop": 0.6478438449848024,
"repo_name": "MartinHjelmare/home-assistant",
"id": "7a37dffe3b8263b1f705a3784f9ca64cb45ced4b",
... |
import os
from tempfile import mkdtemp
from unittest import TestCase
from warnings import catch_warnings
from .mock import Mock
from testfixtures import (
TempDirectory, Replacer, ShouldRaise, compare, OutputCapture
)
from ..compat import Unicode, PY3
from ..rmtree import rmtree
if PY3:
some_bytes = '\xa3'.e... | {
"content_hash": "88933babafbff48c288156a75d4577f9",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 78,
"avg_line_length": 32.49683544303797,
"alnum_prop": 0.5127081507449606,
"repo_name": "nebulans/testfixtures",
"id": "38147f71ac9f88df6f4fe306c0ad4680aca28d4f",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.