text stringlengths 4 1.02M | meta dict |
|---|---|
import uuid
from datetime import datetime
from flask.ext.login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from . import db, login_manager
def create_only_slug(form):
if form.slug.data == "":
slug = str(datetime.now())[0:10] + "-" + str(uuid.uuid4())[0:4]
... | {
"content_hash": "0b684e091f97ad73c2c2cc0081ea7c2c",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 137,
"avg_line_length": 29.97590361445783,
"alnum_prop": 0.6155546623794212,
"repo_name": "lleobox/PYtypecho",
"id": "2dcb653b9f41a12e41f0996ca6b4a48e6e5413a9",
"size": "5... |
from oslo_serialization import jsonutils
from nova import test
from nova.tests import fixtures
from nova.tests.unit.api.openstack import fakes
class UrlmapTest(test.NoDBTestCase):
def setUp(self):
super(UrlmapTest, self).setUp()
self.useFixture(fixtures.GlanceFixture(self))
def test_path_ver... | {
"content_hash": "ec03f6d7ef4c5b5ea2c1dd07037215cd",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 74,
"avg_line_length": 43.90756302521008,
"alnum_prop": 0.6072727272727273,
"repo_name": "klmitch/nova",
"id": "4ab837713a1422791f65602d8b9f76b2e65ffd4e",
"size": "5861",
... |
import xbmc, xbmcgui
import Config
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
def FormatMenuString( title, option ):
if len( option ) > 0:
return title + " [" + option + "]"
else:
return title
def DoAddDialog():
platform = ""
roms_dir = ""
roms_filter = ""
exe_file =... | {
"content_hash": "e6ccc6f3c7b7f435ebeb5ad2374095c1",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 178,
"avg_line_length": 31.73972602739726,
"alnum_prop": 0.659041864479931,
"repo_name": "peteward44/xbmc-romulator",
"id": "626164f6a60e987943092d777d439347c4c328ee",
"siz... |
"""
eq
Usage:
eq hello
eq log [options]
eq -h | --help
eq --version
Options:
-h --help Shows this screen.
--version Shows version.
--limit=<dec> Number of results [default: 10].
--start-time=<Date/Time> Query time period defaults to 30 days to ... | {
"content_hash": "5faf64e80fb0a4b5c5197bf267905281",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 108,
"avg_line_length": 37.77922077922078,
"alnum_prop": 0.6431763492609144,
"repo_name": "jacobnosal/eq-logger-cli",
"id": "4fd0c4ae81f519145ec39acbd0228874baf5fdea",
"siz... |
from __future__ import print_function, division, with_statement
__author__ = 'Vlad Popovici'
__version__ = 0.15
def img_to_raw():
pass
| {
"content_hash": "ee86176d144a50e2c0dc080540a6c528",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 63,
"avg_line_length": 17.75,
"alnum_prop": 0.6549295774647887,
"repo_name": "higex/qpath",
"id": "52594d44afc018b4eec19272c19ef469fe83387d",
"size": "142",
"binary": fals... |
import os, sys # low level handling, such as command line stuff
import string # string methods available
import re # regular expressions
import getopt # comand line argument handling
import hashlib
from low import * # custom functions, written by myself
from misa import MisaSSR
import newick
fro... | {
"content_hash": "4347196f23560a67ffce2b389c4b2876",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 113,
"avg_line_length": 32.136842105263156,
"alnum_prop": 0.5452014412053717,
"repo_name": "lotharwissler/bioinformatics",
"id": "dcc500c2eb9c6e0c4053dbaba356863be968ce59",
... |
from __future__ import unicode_literals
from django.db import models, migrations
def add_id_to_detail_page_url_scraped_obj_attributes(apps, schema_editor):
ScrapedObjAttr = apps.get_model("dynamic_scraper", "ScrapedObjAttr")
for soa in ScrapedObjAttr.objects.all():
if soa.attr_type == 'U':
... | {
"content_hash": "981e12238c365ce37d2a7b53fb187cff",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 78,
"avg_line_length": 29.153846153846153,
"alnum_prop": 0.633245382585752,
"repo_name": "Brother-Simon/django-dynamic-scraper",
"id": "6a72a0d6c93d0547b33dfe740cf272103e8986... |
from __future__ import unicode_literals
import os
import sys
try:
import io
StringIO = io.StringIO
except ImportError:
import StringIO
StringIO = StringIO.StringIO
import time
import socket
from tornado.web import Application
from tornado.web import RequestHandler
from tornado.httpserver import HTTPS... | {
"content_hash": "eea83e82a191c49d55703ea859b2c013",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 83,
"avg_line_length": 22.959731543624162,
"alnum_prop": 0.5559777842736042,
"repo_name": "CantemoInternal/HTTPretty",
"id": "03634a55173270e4a9cdc79cbce023611f936ed8",
"s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_wireless_controller_wtp
except ImportErr... | {
"content_hash": "dee8b9791d76cdb94c56a6bf3be0796b",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 142,
"avg_line_length": 41.16227180527383,
"alnum_prop": 0.5542305228403883,
"repo_name": "thaim/ansible",
"id": "aea02faba54f66a2899a4208a2f5623920a2ca34",
"size": "20989... |
import unittest
import os
import paddle
import paddle.fluid as fluid
from paddle.fluid import core
import paddle.static as static
class Test_XPU_Places(unittest.TestCase):
def assert_places_equal(self, places0, places1):
self.assertEqual(len(places0), len(places1))
for place0, place1 in zip(places... | {
"content_hash": "f1380aaed6f3855bb860749979b59ad8",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 76,
"avg_line_length": 32.9,
"alnum_prop": 0.646403242147923,
"repo_name": "luotao1/Paddle",
"id": "75679047301df4757a67097d9cf2f940d9bd1d1c",
"size": "1600",
"binary": f... |
import re
import logging
from django import forms
from django.forms import ModelForm
from django.forms.models import BaseInlineFormSet
from django.forms.models import inlineformset_factory
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import curry
from django.core.files.images im... | {
"content_hash": "999579d1e5e744299f047bce8efc712a",
"timestamp": "",
"source": "github",
"line_count": 732,
"max_line_length": 150,
"avg_line_length": 36.576502732240435,
"alnum_prop": 0.6011055501606035,
"repo_name": "jfunez/scielo-manager",
"id": "38b520ddfa67c34cbcd0602b413f7ea5c37f0494",
"size... |
"""Tests for lingvo.core.entmax."""
from lingvo import compat as tf
from lingvo.core import entmax
from lingvo.core import test_utils
class EntmaxTest(test_utils.TestCase):
# All expected values are generated based on official implementation.
def test_entmax_support_generate_right_probability(self):
inputs ... | {
"content_hash": "959b1325d032ab4622f70ceb570a0370",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 80,
"avg_line_length": 43.57692307692308,
"alnum_prop": 0.6345984112974404,
"repo_name": "tensorflow/lingvo",
"id": "4633328d92f1ad375f85a0c40c0e02a0979c4982",
"size": "295... |
"""
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | {
"content_hash": "d393ec362a7c13d39cec1ede192b9027",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 86,
"avg_line_length": 31.44295302013423,
"alnum_prop": 0.671504802561366,
"repo_name": "geniusgordon/NTHUOJ_web",
"id": "9af5a879dbd6d789294add8bccba841710262608",
"size"... |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
LOG = logging.getLogger(__name__)
class AddInterface(forms.SelfHandlingForm):... | {
"content_hash": "cbab9df2f5e81b8b179afbef0e51257e",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 78,
"avg_line_length": 40.31609195402299,
"alnum_prop": 0.5415538132573058,
"repo_name": "spring-week-topos/horizon-week",
"id": "c783d5306f747d66c31443dea968b3a821b081a0",
... |
from pyshorteners import Shortener
url = 'http://www.google.com'
shortener = Shortener('Tinyurl')
print("My short url is {}".format(shortener.short(url))) | {
"content_hash": "d12ba97aa5d4dd05a2cf59a812336388",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 56,
"avg_line_length": 31,
"alnum_prop": 0.7419354838709677,
"repo_name": "harrymt/boeing-hackathon",
"id": "6f55a12271bf6ab9ad3d7695fcb5d0b901ca5b8e",
"size": "155",
"bin... |
from unittest import TestCase
from chatterbot.adapters.storage import JsonDatabaseAdapter
from chatterbot.conversation import Statement, Response
class JsonAdapterTestCase(TestCase):
def setUp(self):
"""
Instantiate the adapter.
"""
from random import randint
# Generate a... | {
"content_hash": "54b3c2ffd086a00fb8032ea535907238",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 75,
"avg_line_length": 30.946268656716416,
"alnum_prop": 0.60673290247902,
"repo_name": "DarkmatterVale/ChatterBot",
"id": "9198e991238196c5bed597eff0b14c9367860c9b",
"siz... |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("portal", "0003_auto_20180411_0101"),
]
operations = [
mi... | {
"content_hash": "ec257a3dae34a7d53a51e65e0476a7db",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 66,
"avg_line_length": 26.869565217391305,
"alnum_prop": 0.5938511326860841,
"repo_name": "huangsam/chowist",
"id": "670ac6f6a63467e06597dab4747c96fbfe32cf40",
"size": "667... |
import collections
import functools
import six
from heat.engine import properties
from heat.engine.resources.software_config import software_config as sc
from heat.engine.resources.software_config import software_deployment as sd
class StructuredConfig(sc.SoftwareConfig):
'''
This resource is like OS::Heat::... | {
"content_hash": "ec576ec517ca7872f7b50295024a639f",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 78,
"avg_line_length": 33.378531073446325,
"alnum_prop": 0.6327014218009479,
"repo_name": "redhat-openstack/heat",
"id": "a44f7c14244d670d98afb9f55917c1f0f9bdf239",
"size"... |
"""
38. User-registered management commands
The manage.py utility provides a number of useful commands for managing a
Django project. If you want to add a utility command of your own, you can.
The user-defined command 'dance' is defined in the management/commands
subdirectory of this test application. It is a simple... | {
"content_hash": "8ea14d0e963d3e65fe6bd52f35112a0b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 76,
"avg_line_length": 30.733333333333334,
"alnum_prop": 0.7613882863340564,
"repo_name": "rawwell/django",
"id": "6db4b049df3294e85a4a740d952102535dda06e1",
"size": "922",... |
"""
MoinMoin - Teud Macro
This integrates the "Teud" documentation system into
MoinMoin. Besides Teud, you need 4XSLT.
Teud: http://purl.net/wiki/python/TeudProject
4XSLT: http://4suite.org/
@copyright: 2001 Juergen Hermann <jh@web.de>
@license: GNU GPL, see COPYING for details.
"""
_imp... | {
"content_hash": "3432c013d69ba3263ad493d983a8780d",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 77,
"avg_line_length": 29.186666666666667,
"alnum_prop": 0.5879396984924623,
"repo_name": "RealTimeWeb/wikisite",
"id": "4b7f7b5d454339f801dd0ed2d25de1cf2fbd4bd2",
"size": ... |
from __future__ import division, print_function
import logging
import numpy as np
FORMAT = '[%(asctime)s] %(name)-15s %(message)s'
DATEFMT = "%H:%M:%S"
logging.basicConfig(format=FORMAT, datefmt=DATEFMT, level=logging.INFO)
import os
import theano
import theano.tensor as T
import fuel
import ipdb
import time
import ... | {
"content_hash": "af834c42f63f31243c93ea219ebc2e26",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 137,
"avg_line_length": 38.25694444444444,
"alnum_prop": 0.5758758395353059,
"repo_name": "drewlinsley/draw_classify",
"id": "b0ad4767b4300ec713b2267d6603c126aa5e6273",
"s... |
from __future__ import absolute_import
import sys, os, re, inspect
import imp
try:
import hashlib
except ImportError:
import md5 as hashlib
from distutils.core import Distribution, Extension
from distutils.command.build_ext import build_ext
import Cython
from ..Compiler.Main import Context, CompilationOptio... | {
"content_hash": "d952e2995676ec9d88cf2672a0292067",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 110,
"avg_line_length": 35.409677419354836,
"alnum_prop": 0.5799398742825909,
"repo_name": "andreasvc/cython",
"id": "e169599818ba8c5d22a1af5ab99e093414968504",
"size": "1... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'PaymentMethodType'
db.create_table('buckaroo_paymentmethodtype', (
('id', self.gf('django.db.models.fiel... | {
"content_hash": "96a9a4496c2ab3e553fce9359edc35d7",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 164,
"avg_line_length": 72.38524590163935,
"alnum_prop": 0.6003850073604349,
"repo_name": "quarkness/django-buckaroo",
"id": "a62b715da3971d06b8a67e2677891b6bb61d5d5f",
"s... |
from PyQt4 import QtCore
from serieswatcher.config import Config
from serieswatcher.thetvdb import TheTVDB
class MakeSearch(QtCore.QObject):
searchFinished = QtCore.pyqtSignal(list)
def __init__(self, userInput):
super(MakeSearch, self).__init__()
self._userInput = userInput
def run(self... | {
"content_hash": "62135313b5f8ff93ec648b6b0fcecf65",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 30.842105263157894,
"alnum_prop": 0.6655290102389079,
"repo_name": "lightcode/SeriesWatcher",
"id": "bb1c40da91cc1fa5838f2911bd3da879b543a1a2",
"size... |
import math
import numpy as np
import scipy.sparse.linalg.eigen
def norm(vec):
"""
Find the norm of the given (one-dimensional) vector.
"""
return math.sqrt(vec.dot(vec))
def normalize(vec):
"""
Normalize the given vector. Zero vectors remain zero.
"""
vec_norm = norm(vec)
if ve... | {
"content_hash": "bb15a8bc4044a0a0582111c8f569c31b",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 79,
"avg_line_length": 29.424460431654676,
"alnum_prop": 0.6234718826405868,
"repo_name": "redreamality/assoc-space",
"id": "ade88f4fd466fc4a2a13ae5cb3ef0a973b17dc41",
"si... |
from quantum.agent.common import config
from quantum.openstack.common import cfg
DEFAULT_BRIDGE_MAPPINGS = []
DEFAULT_VLAN_RANGES = []
DEFAULT_TUNNEL_RANGES = []
ovs_opts = [
cfg.StrOpt('integration_bridge', default='br-int',
help=_("Integration bridge to use")),
cfg.BoolOpt('enable_tunneling'... | {
"content_hash": "8cdac8eb6e84d5c563843a2ae6571b17",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 74,
"avg_line_length": 40,
"alnum_prop": 0.5802083333333333,
"repo_name": "rossella/neutron",
"id": "4ffe58841919b7c4ca284b2e52fcc27a72bfdc04",
"size": "2571",
"binary": ... |
from django.shortcuts import render, redirect, render_to_response, RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
# Create your views here.
def login(request):
return render... | {
"content_hash": "09c00a3d8c5b021fd1deee2aae87bbdd",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 81,
"avg_line_length": 26.5,
"alnum_prop": 0.7641509433962265,
"repo_name": "molleolson/studentkompassen",
"id": "6b65ad9525b2b5a13112279cb66b8d97cf7cc089",
"size": "530",
... |
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/tatooine/shared_cantina_tatooine.iff"
result.attribute_template_id = -1
result.stfName("building_name","cantina_general")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "1fb32ab5aa03f241900652b0a8afb445",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 24.076923076923077,
"alnum_prop": 0.7060702875399361,
"repo_name": "obi-two/Rebelion",
"id": "0c4e0da525994b022867a172c3da99d0ec85f2d7",
"size": "458... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import subprocess
import tempfile
import gdb
import pwndbg.commands
import pwndbg.vmmap
parser = argparse.ArgumentParser(description="ROP gadget search... | {
"content_hash": "8d66b75422d4634944f830b453d1110b",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 100,
"avg_line_length": 29.80952380952381,
"alnum_prop": 0.6277955271565495,
"repo_name": "0xddaa/pwndbg",
"id": "f7d51b887a520e5012678a272424c98584c7dde9",
"size": "1298",... |
from castellan.common.objects import passphrase as key
from sahara.service.castellan import sahara_key_manager
from sahara.tests.unit import base
class SaharaKeyManagerTest(base.SaharaTestCase):
def setUp(self):
super(SaharaKeyManagerTest, self).setUp()
self.k_m = sahara_key_manager.SaharaKeyMan... | {
"content_hash": "651a2d70269d26535f4b5616599e1226",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 68,
"avg_line_length": 31.517241379310345,
"alnum_prop": 0.6466083150984683,
"repo_name": "openstack/sahara",
"id": "416bc146f6b7bdfa897c046fa796a66fc2075a78",
"size": "149... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'catalog.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| {
"content_hash": "a58fdd9c21ab3dcacc0fcc14176ebba2",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 51,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6554054054054054,
"repo_name": "nautilebleu/django-fdw",
"id": "4e41c5f105e88b02b4346daaea512da82bfe9969",
"size"... |
from .linting import BtHighlightUnimplementedStepsEventListener
__all__ = [
'BtHighlightUnimplementedStepsEventListener'
]
| {
"content_hash": "cffe410fb78976dd515f2041e95a1726",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 63,
"avg_line_length": 25.6,
"alnum_prop": 0.8125,
"repo_name": "mixxorz/BehaveToolkit",
"id": "d13245ddd8c08f0a56dbdc9f02e5b097b8c967c9",
"size": "128",
"binary": false,
... |
""" config.py """
import os
from flask import Flask
from peewee import MySQLDatabase, SqliteDatabase
#-------------------------------------------------------------------------------
# Environment
#-------------------------------------------------------------------------------
DB = 'idreamoftoast'
ENV = os.... | {
"content_hash": "56b573adc565d27ddcc9c479a3362232",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 32.37931034482759,
"alnum_prop": 0.49307774227902024,
"repo_name": "whiskeylover/idreamoftoast",
"id": "86c01ecece862595599544c66dd4d6f085a1c02e",
"s... |
"""
[2016-01-27] Challenge #251 [Hard] Solve a Nonogram + Bonus
https://www.reddit.com/r/dailyprogrammer/comments/42x90t/20160127_challenge_251_hard_solve_a_nonogram_bonus/
#Description
This week we are doing a challenge involving [Nonograms](https://en.wikipedia.org/wiki/Nonogram)
It is going to be a three parter:
... | {
"content_hash": "1e7f7fe56355277c39dd919b444b46c8",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 131,
"avg_line_length": 31.357723577235774,
"alnum_prop": 0.6333938294010889,
"repo_name": "DayGitH/Python-Challenges",
"id": "7b694b803b9d708da48e77bff21701192d4fff62",
"... |
__author__ = 'fcanas'
import termhelper
class Reporter:
"""
Responsible for displaying results and recording them to log files.
"""
def __init__(self, warg=0):
self.width = warg
self.set_terminal_width(warg) # default width of terminal
templates = {
'test': '[ {0:.<{2}}... | {
"content_hash": "f85adf51d148243fc72e8f1dda943ab6",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 111,
"avg_line_length": 38.19298245614035,
"alnum_prop": 0.5151584749655489,
"repo_name": "izv/IzVerifier",
"id": "eeb2234b098260248b28b878dbdd02e0cc205462",
"size": "4354... |
from ._base import Config, ConfigError
from synapse.appservice import ApplicationService
from synapse.types import UserID
import urllib
import yaml
import logging
logger = logging.getLogger(__name__)
class AppServiceConfig(Config):
def read_config(self, config):
self.app_service_config_files = config.... | {
"content_hash": "ada3a1fae90e24a74ba6f500e534aa6d",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 85,
"avg_line_length": 36.88666666666666,
"alnum_prop": 0.5534068317368516,
"repo_name": "TribeMedia/synapse",
"id": "82c50b82404557f3c70bdec27c466b5446de117e",
"size": "6... |
from .resource import Resource
class NamespaceResource(Resource):
"""Description of a Namespace resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar ... | {
"content_hash": "0d11b0d6a24d6fa3da5ec74acf27e49d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 268,
"avg_line_length": 45.819148936170215,
"alnum_prop": 0.6524262827954492,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "93eb3b0ee4e8f29e9bce16518d509b988f6a8bac"... |
from case9_4_1 import Case9_4_1
class Case9_4_6(Case9_4_1):
DESCRIPTION = """Send fragmented binary message message with message payload of length 4 * 2**20 (4M). Sent out in fragments of 64k."""
EXPECTATION = """Receive echo'ed binary message (with payload as sent)."""
def init(self):
sel... | {
"content_hash": "42860066241e7d8a4bbe84f5605e9cc0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 138,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6210526315789474,
"repo_name": "crossbario/autobahn-testsuite",
"id": "6349a985d2d070e24da93098d528e1dacc860b77",
... |
from django.conf.urls.defaults import patterns, url
import views
urlpatterns = patterns('',
url(r'^vcal/$', views.vcal, name='vcal.vcal'),
url(r'^My-Sheriff-duty.ics$', views.my_dates, name='vcal.my_dates'),
url(r'^Sheriff-Duty.ics$', views.all_dates, name='vcal.all_dates'),
)
| {
"content_hash": "ec92e59216975741a8af7eee469620af",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 72,
"avg_line_length": 36.375,
"alnum_prop": 0.6735395189003437,
"repo_name": "mozilla/sheriffs",
"id": "052e8bee8d401263ee86dd3c9a81be936207bb8a",
"size": "1939",
"binary... |
from django.core.management.base import BaseCommand
from mongoengine.django.auth import User
class Command(BaseCommand):
def _get_string(self, prompt, reader_func=raw_input):
"""Helper method to get a non-empty string.
"""
string = ''
while not string:
string = reader... | {
"content_hash": "b966b37d891096e877a95d886ab756bb",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 32.708333333333336,
"alnum_prop": 0.554140127388535,
"repo_name": "MechanisM/django-mumblr",
"id": "85e5a595a31b99271a4fbb814996292056d160c4",
"size"... |
import os
import json
import sys
import six
from six import StringIO
from pylint.reporters.json import JSONReporter
from pylint.lint import Run
from conans.client.output import Color
from conans.errors import ConanException
def conan_linter(conanfile_path, out):
apply_lint = os.environ.get("CONAN_RECIPE_LINTER"... | {
"content_hash": "c2d302d604e5676fd09f3a5b25b59593",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 94,
"avg_line_length": 30.936363636363637,
"alnum_prop": 0.5783132530120482,
"repo_name": "tivek/conan",
"id": "1520805a94a6046c97ead99d93548431f66515d0",
"size": "3403",
... |
"""
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``args``:
A dictionary of the arguments being sent to Request().
``pre_request``:
The Request object, directly after being created.
``pre_send``:
The Request object, directly before b... | {
"content_hash": "b78d0b92b84874c706a5630adbcb4d5c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 71,
"avg_line_length": 21.19607843137255,
"alnum_prop": 0.5948196114708603,
"repo_name": "katiecheng/Bombolone",
"id": "272abb73a6c8ea854f0388e4cbb3f56686f988e7",
"size": "... |
from __future__ import division
import six
import chainer
from chainer.backends import cuda
from chainer import function
from chainer.utils import type_check
def _fbeta_score(precision, recall, beta):
beta_square = beta * beta
return ((1 + beta_square) * precision * recall /
(beta_square * preci... | {
"content_hash": "e0c3891ebc994a1308c9b1c3bed834ee",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 36.88805970149254,
"alnum_prop": 0.630386405017196,
"repo_name": "rezoo/chainer",
"id": "70c0b58a1faa8d3c475e5904dc9962561914ce46",
"size": "4943",
... |
import requests
import json
import time
def action(**kwargs):
''' This method is called to action a reaction '''
redata = kwargs['redata']
jdata = kwargs['jdata']
logger = kwargs['logger']
run = True
# Check for Trigger
if redata['trigger'] > jdata['failcount']:
run = False
# ... | {
"content_hash": "a6cc4e2950fffd7249e3d094512a3ad3",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 110,
"avg_line_length": 34.74444444444445,
"alnum_prop": 0.5302206587783819,
"repo_name": "Runbook/runbook",
"id": "15e626126121e65c5b93d39063759ed756be11f9",
"size": "3397... |
'''
OpenShiftCLI class that wraps the oc commands in a subprocess
'''
# pylint: disable=too-many-lines
from __future__ import print_function
import atexit
import copy
import json
import os
import re
import shutil
import subprocess
import tempfile
# pylint: disable=import-error
try:
import ruamel.yaml as yaml
ex... | {
"content_hash": "1c36a27721de21a3a201ddc2156e9677",
"timestamp": "",
"source": "github",
"line_count": 1377,
"max_line_length": 118,
"avg_line_length": 33.40885984023239,
"alnum_prop": 0.5256934179636553,
"repo_name": "joelddiaz/openshift-tools",
"id": "37803cc0c1f57d7e5502cf1973e2ea6c6ddbee3a",
"... |
from __future__ import print_function, division
import os
import sys
import stat
import math
import time
from datetime import datetime
try:
import cPickle as pickle
except ImportError:
import pickle
from mapproxy.layer import map_extent_from_grid
import logging
log = logging.getLogger(__name__)
class bidic... | {
"content_hash": "506c2c0fc2db608e9fe6388e7ee9265f",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 114,
"avg_line_length": 32.17921146953405,
"alnum_prop": 0.5457785698373803,
"repo_name": "kaiCu/mapproxy",
"id": "48989980b2c688267b073594fae3478ad2f97020",
"size": "9628... |
import unittest
import uuid
import datetime
from boto.mturk.question import ExternalQuestion
from ._init_environment import SetHostMTurkConnection, external_url, \
config_environment
class Test(unittest.TestCase):
def setUp(self):
config_environment()
def test_create_hit_exter... | {
"content_hash": "f5d21e196953ec9da6be44d7eaadefb3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 345,
"avg_line_length": 45.95238095238095,
"alnum_prop": 0.6652849740932643,
"repo_name": "catapult-project/catapult",
"id": "82ec08afa92d793a68571c87c8b02491edb6e8cb",
"si... |
import sqlite3
import Graffity
import glob
import os
connection = sqlite3.connect(os.environ.get('CIAO_SQL')+'Dataloggers.db')
cursor = connection.cursor()
CDMS_BaseDir = '/home/cdeen/Code/CIAO/SPARTA/SPARTA_CIAO/CONFIG/spcicfg'
CDMS_ConfigDir = '/config/RTCDATA/CIAO/DEFAULT/'
sqlCommand = "ALTER TABLE CIAO_1_DataL... | {
"content_hash": "cfbe3161924cc7adc16d55e96359a482",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 73,
"avg_line_length": 27.56756756756757,
"alnum_prop": 0.796078431372549,
"repo_name": "soylentdeen/Graffity",
"id": "2776d3ed6b18f77497758a59322c1d9f8073090d",
"size": "1... |
from enum import Enum
class RdsDbType(Enum):
"""Only available types for the RDS"""
INSTANCE: str = "instance"
CLUSTER: str = "cluster"
| {
"content_hash": "80295df31bc06f9f0d2059a189fe3f97",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 18.875,
"alnum_prop": 0.6556291390728477,
"repo_name": "lyft/incubator-airflow",
"id": "154f65b5560c11a30a0590713239b287e4ddac40",
"size": "937",
"b... |
from pyxb_114.exceptions_ import *
import unittest
import pyxb_114.binding.datatypes as xsd
class _TestIntegerType (object):
"""Base class for testing any datatype that descends from integer.
Subclasses should define class variables:
THIS_TYPE = the xsd datatype class
PARENT_TYPE = the next dominating... | {
"content_hash": "e500ff6840f923c3eb204ce94dfb29a6",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 91,
"avg_line_length": 34.241134751773046,
"alnum_prop": 0.6425020712510356,
"repo_name": "msherry/PyXB-1.1.4",
"id": "7985e9e22474dcaa94df8993b869259c99f7d103",
"size": "... |
"""
Classes for reading/manipulating/writing exciting input files.
"""
import xml.etree.ElementTree as ET
import numpy as np
import scipy.constants as const
from monty.io import zopen
from monty.json import MSONable
from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element
from pymat... | {
"content_hash": "b62641fa2477c342990e1d8ea25ade7f",
"timestamp": "",
"source": "github",
"line_count": 389,
"max_line_length": 119,
"avg_line_length": 39.33161953727507,
"alnum_prop": 0.5626143790849674,
"repo_name": "vorwerkc/pymatgen",
"id": "b4774624f3825d95e7224ebad6238fe6d8993e1c",
"size": "1... |
from __future__ import division
from telemetry.core import util
from telemetry.image_processing import histogram
from telemetry.image_processing import rgba_color
from telemetry.util import external_modules
util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'png')
import png # pylint: disable=F0401
cv2 ... | {
"content_hash": "fabb22576dd077f5b38cea8817e57d07",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 80,
"avg_line_length": 35.48066298342541,
"alnum_prop": 0.6102460292743693,
"repo_name": "CTSRD-SOAAP/chromium-42.0.2311.135",
"id": "538909668d71cc485689351903c2755dea782be... |
""" Package summary:
Modules:
database_setup - Set up restaurantmenu database.
lotsofmenus - Populate the database with dummy data.
"""
| {
"content_hash": "c4131ded35f8389d28c367137eeaabd2",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 28,
"alnum_prop": 0.7428571428571429,
"repo_name": "courtneypattison/second-response",
"id": "27156be631bfaf84455606d9a91586be99cac2dc",
"size": "141"... |
from __future__ import unicode_literals, absolute_import
from django.shortcuts import render
# Create your views here.
| {
"content_hash": "dd7f8013d6fcdf6bfb20dd976b303f67",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 57,
"avg_line_length": 24.4,
"alnum_prop": 0.7786885245901639,
"repo_name": "kazaname/kurs_django",
"id": "9a0ff308b0e8541f01e9c2f117a033c6a7189595",
"size": "138",
"binar... |
from __future__ import unicode_literals, division, absolute_import
import logging
import urllib
from jinja2 import TemplateSyntaxError
from flexget import plugin
from flexget.event import event
from flexget.task import Task
from flexget.utils.search import normalize_unicode
log = logging.getLogger('search_rss')
cl... | {
"content_hash": "4a4b7b727e5726c9d543230c3dadb57e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 92,
"avg_line_length": 39.744680851063826,
"alnum_prop": 0.6504282655246253,
"repo_name": "Pretagonist/Flexget",
"id": "4ff8603f2ff4473b2ce60ee5deba8b87a1ee053e",
"size": "... |
from django.conf import settings
default_settings = {
'MAILCHIMP_CLIENT_ID': None,
'MAILCHIMP_CLIENT_SECRET': None,
'MAILCHIMP_AUTHORIZATION_URL': 'https://login.mailchimp.com/oauth2/authorize',
'MAILCHIMP_ACCESS_TOKEN_URL': 'https://login.mailchimp.com/oauth2/token',
'MAILCHIMP_METADATA_URL': 'ht... | {
"content_hash": "57100182688fc33709ce86bb94ff6ad8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 82,
"avg_line_length": 33.26315789473684,
"alnum_prop": 0.6867088607594937,
"repo_name": "avelis/django-plantains",
"id": "8fde42536835529cd7f007ebfd12411299441a89",
"size"... |
"""
Management command for loading all the known classifiers from the official
pypi, or from a file/url.
Note, pypi docs says to not add classifiers that are not used in submitted
packages. On the other hand it can be usefull to have a list of classifiers
to choose if you have to modify package data. Use it if you nee... | {
"content_hash": "bf3b634e8278e624d628cd0a9f8af030",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 37.43396226415094,
"alnum_prop": 0.6058467741935484,
"repo_name": "mattcaldwell/djangopypi",
"id": "1fc9c71163d14cee8577a174877c88991d8667d5",
"size"... |
from pyasn1.type import namedtype
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1_modules.rfc2459 import AlgorithmIdentifier
pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
rsaEncryption = univ.ObjectIdentifier('1.2.840.113549.1.1.1')
md2WithRSAEncryption = univ.ObjectIdentifier('1.2.840.113... | {
"content_hash": "db03f0edaf27d88928f1770328c2ad52",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 84,
"avg_line_length": 40.92857142857143,
"alnum_prop": 0.7185863874345549,
"repo_name": "catapult-project/catapult",
"id": "4e4113ffe528c19785afdc3d46dea812e676668c",
"siz... |
"""Execute a volatility command on the client memory.
This module implements the volatility enabled client actions which enable
volatility to operate directly on the client.
"""
# Initialize the volatility plugins, so pylint: disable=unused-import
from volatility import addrspace
from volatility import obj
from vo... | {
"content_hash": "9419697754be465fce07dd368561ac83",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 78,
"avg_line_length": 29.848979591836734,
"alnum_prop": 0.6578695473813756,
"repo_name": "simsong/grr-insider",
"id": "47753a6bdb2ca10f73fc3c13db25dc3c8e998009",
"size": ... |
"""
Python client for InfluxDB
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import itertools
import json
import socket
import requests
import requests.exceptions
from sys import version_info
from influxdb.line_... | {
"content_hash": "9be8b21876252bf0b334ab0eb847202d",
"timestamp": "",
"source": "github",
"line_count": 829,
"max_line_length": 79,
"avg_line_length": 34.775633293124244,
"alnum_prop": 0.5671719449165771,
"repo_name": "Asimmetric/influxdb-python",
"id": "92310c78b9ef6566c52014db33c4a6209e9570e4",
"... |
import datetime
import decimal
from dateutil.relativedelta import relativedelta
from django.db import transaction
from django.db.models import Sum
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django_filters.rest_framework import DjangoFilterBackend
from rest_framewo... | {
"content_hash": "8a0864abd5eddda88463996933c030ac",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 88,
"avg_line_length": 36.19836956521739,
"alnum_prop": 0.6019067637564748,
"repo_name": "opennode/nodeconductor-assembly-waldur",
"id": "01cc5c8244075721fcea84c6d488514f6d3... |
from ConfigParser import SafeConfigParser
import os
from zope.interface import moduleProvides
from carapace import meta
from carapace.sdk import interfaces
moduleProvides(interfaces.IConfig)
class Config(object):
pass
# Main
main = Config()
main.config = Config()
main.config.datadir = os.path.expanduser("~/... | {
"content_hash": "bbf6c31e1a6eade10d9f21cae5c543d5",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 77,
"avg_line_length": 33.13970588235294,
"alnum_prop": 0.5988462391834923,
"repo_name": "oubiwann/carapace",
"id": "f12045b0edeb221b46307f80ec6cfe1ab8d2d5eb",
"size": "45... |
import torch
from torch.utils.mobile_optimizer import optimize_for_mobile
from torchvision.models.detection import (
fasterrcnn_mobilenet_v3_large_320_fpn,
FasterRCNN_MobileNet_V3_Large_320_FPN_Weights,
)
print(torch.__version__)
model = fasterrcnn_mobilenet_v3_large_320_fpn(
weights=FasterRCNN_MobileNet_... | {
"content_hash": "140dfc17dd36985cbf4808e3ec6faec4",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 30.476190476190474,
"alnum_prop": 0.746875,
"repo_name": "pytorch/vision",
"id": "f99933e9a9ddf153c3085d5cd910f89f2919dea9",
"size": "640",
"binary... |
from collections import defaultdict
from datetime import timedelta
import json
import logging
import markus
from simple_pid import PID
from sqlalchemy.exc import OperationalError
from ichnaea import util
METRICS = markus.get_metrics()
LOGGER = logging.getLogger(__name__)
class ApiKeyLimits:
def __init__(self, ... | {
"content_hash": "538cb56c88b062b5482f5226121fd223",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 120,
"avg_line_length": 37.84450402144772,
"alnum_prop": 0.5675828846698782,
"repo_name": "mozilla/ichnaea",
"id": "aed1fcf6ab77016dea4c4f27bea7296044a817f2",
"size": "141... |
from app import db
from flask import current_app
from flask.ext.login import UserMixin
from . import login_manager
from hashlib import md5
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import random
import os
import requests
IMAGE_TYPES = ['poster', 'series', 'fanart', 'season']
STATUSES = {... | {
"content_hash": "c74dd3051ad2013a934aa43810263a96",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 78,
"avg_line_length": 35.39108910891089,
"alnum_prop": 0.5556021821233739,
"repo_name": "happyraul/tv",
"id": "1b6d6b06d579f21f44b6456787bf0a263f8704e0",
"size": "7149",
... |
"""
PXE Driver and supporting meta-classes.
"""
from ironic.drivers import base
from ironic.drivers.modules import ipminative
from ironic.drivers.modules import ipmitool
from ironic.drivers.modules import pxe
from ironic.drivers.modules import ssh
class PXEAndIPMIToolDriver(base.BaseDriver):
"""PXE + IPMITool dr... | {
"content_hash": "4f76fa4e2894c3cafabc1150919e9372",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 78,
"avg_line_length": 32.79032258064516,
"alnum_prop": 0.7083128381701919,
"repo_name": "citrix-openstack-build/ironic",
"id": "d6e0237fc8e1cb4f8a7aa6ebfa4abe447eb47802",
... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import datetime
from dashboard.api import api_request_handler
from dashboard.common import datastore_hooks
from dashboard.common import namespaced_stored_object
from dashboard.common import utils
from dashboar... | {
"content_hash": "10f66a49f94e811b04048966a0cb71f8",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 30.705128205128204,
"alnum_prop": 0.6755741127348643,
"repo_name": "endlessm/chromium-browser",
"id": "d03f6632f73b36f1cad956f4d1055af3bca6e06a",
"si... |
"""Tests for du command."""
from __future__ import absolute_import
import gslib.tests.testcase as testcase
from gslib.tests.testcase.integration_testcase import SkipForS3
from gslib.tests.util import ObjectToURI as suri
from gslib.util import Retry
class TestDu(testcase.GsUtilIntegrationTestCase):
"""Integration ... | {
"content_hash": "b39008ad2ff40b5305f0a2ab636f0b1f",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 80,
"avg_line_length": 40.93273542600897,
"alnum_prop": 0.6090052585451359,
"repo_name": "Sorsly/subtle",
"id": "3a1436af46cc719c3af5b19597e64b419bcbe757",
"size": "9776",... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['LinearTrend'] , ['BestCycle'] , ['SVR'] ); | {
"content_hash": "0a1fc776a8142b9dc59040e21dabdd83",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 90,
"avg_line_length": 40.75,
"alnum_prop": 0.7239263803680982,
"repo_name": "antoinecarme/pyaf",
"id": "91ff18e7be4200a00e80955c6578de538cf2d048",
"size": "163",
"binary"... |
""" This example assigns creatives to placements and creates a unique ad for
each assignment. To get creatives, run GetCreatives.java example. To get
placements, run get_placement.py.
Tags: creative.assignCreativesToPlacements
"""
__author__ = 'api.jdilallo@gmail.com (Joseph DiLallo)'
import os
import sys
sys.path.i... | {
"content_hash": "910e0e24da643f8e482779848e1c0ffe",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 79,
"avg_line_length": 34.28333333333333,
"alnum_prop": 0.6660184735051046,
"repo_name": "donspaulding/adspygoogle",
"id": "df0d28b41a204f24562bfb10adb68aaf787a8e05",
"size... |
from django.template import Context
from django.template.loader import get_template
from django import template
register = template.Library()
@register.filter
def bootstrap(element):
element_type = element.__class__.__name__.lower()
if element_type == 'boundfield':
template = get_template("bootstrapf... | {
"content_hash": "9d63c77cda479c9c6b8f6614a80580d1",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 31.5,
"alnum_prop": 0.6567460317460317,
"repo_name": "cojito/django-bootstrap-form",
"id": "9f29b27a2a3889ca5df7f86bbe9541ebdab37037",
"size": "1008"... |
from runner.koan import *
class AboutSets(Koan):
def test_sets_make_keep_lists_unique(self):
highlanders = ['MacLeod', 'Ramirez', 'MacLeod', 'Matunas', 'MacLeod', 'Malcolm', 'MacLeod']
there_can_only_be_only_one = set(highlanders)
self.assertEqual(set(['Malcolm', 'Matunas', 'MacLe... | {
"content_hash": "ff6d88b362e4ad93d3cc6294d297c5d1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 103,
"avg_line_length": 40.642857142857146,
"alnum_prop": 0.5371997656707674,
"repo_name": "arjunasuresh3/Mypykoans",
"id": "dc2520df6df39ec59b239e6f787954d623e6c55f",
"siz... |
from threading import Thread, current_thread, Lock
from time import sleep
report_progress_now = []
progress_lock = Lock()
def check_report_progress(me, id):
global report_progress_now, progress_lock
if report_progress_now[id]:
progress_lock.acquire()
print("{} [{}] is making progress.".format(... | {
"content_hash": "f25de3804f59094fd762011a9358e722",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 70,
"avg_line_length": 25.80327868852459,
"alnum_prop": 0.5851334180432021,
"repo_name": "DEVSENSE/PTVS",
"id": "120972ddc64cefbb5d471c85afb9acf026fd2d43",
"size": "1574",
... |
import numpy
import scipy.stats
import matplotlib.pylab as pt
import statsmodels.api as sm
#import scipy.optimize.minimize
def narrow_sense_hsq(genotype_mat, phenotype_list):
##Calculates narrow-sense heritability for a given phenotype (length n_segs), with genotypes specified by genotype_mat (n_segs x n_loci).
##Th... | {
"content_hash": "c346c35793c1c29a97edae476dc13aac",
"timestamp": "",
"source": "github",
"line_count": 998,
"max_line_length": 453,
"avg_line_length": 48.313627254509015,
"alnum_prop": 0.7259058008586183,
"repo_name": "erjerison/adaptability",
"id": "a78a4ed73df068218179e8cc937327763513b91d",
"siz... |
import os
from rbuild_test import rbuildhelp
from testutils import mock
from rbuild import errors
class CheckoutTest(rbuildhelp.RbuildHelper):
def _getHandle(self):
productStore = mock.MockObject(stableReturnValues=True)
productStore.getRbuildConfigPath._mock.setReturn(
... | {
"content_hash": "dce2775f64098d1ecc177a7c8bf87e63",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 85,
"avg_line_length": 51.61538461538461,
"alnum_prop": 0.5470476386248009,
"repo_name": "sassoftware/rbuild",
"id": "34e7bca5736a25e14f31e4f6be363a45c58a425c",
"size": "2... |
"""Tests for swift.obj.server"""
import six.moves.cPickle as pickle
import datetime
import json
import errno
import operator
import os
import mock
import six
from six import StringIO
import unittest
import math
import random
from shutil import rmtree
from time import gmtime, strftime, time, struct_time
from tempfile i... | {
"content_hash": "78df73f238da1de6d51642e25aa075f9",
"timestamp": "",
"source": "github",
"line_count": 6140,
"max_line_length": 79,
"avg_line_length": 44.10732899022801,
"alnum_prop": 0.5234603185153184,
"repo_name": "mjwtom/swift",
"id": "351c98642b3faab4796130df11ccc52efe23258d",
"size": "271432... |
from tests import BaseTestCase
class StaticDataManagerTestCase(BaseTestCase):
def setUp(self):
from riotpy import RiotApi
from riotpy.constants import Region
self.api = RiotApi(api_key=self.get_test_api_key(), region=Region.BR)
def test_get_champions(self):
with self.vcr():
... | {
"content_hash": "e14042311d2c119761526a6b95136273",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 28.575757575757574,
"alnum_prop": 0.6362672322375398,
"repo_name": "jarussi/riotpy",
"id": "e3516e702aee3dedd29f6f4d02370f20beadf4a1",
"size": "959",... |
"""Tests for Keras Premade WideNDeep models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.eager import context
from tensorflow.python.feature_column import dense_features_v2
from tensorflow.python.feature_col... | {
"content_hash": "0a8b44fe41ccb08769f77cab5a2e06fc",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 79,
"avg_line_length": 44.864150943396226,
"alnum_prop": 0.6618723189502902,
"repo_name": "xzturn/tensorflow",
"id": "12d569331bf6d7efc8c557e20870ce725d5e355c",
"size": "1... |
import os
import sys
import operator
import time
import logging
import enso.config
from enso.messages import displayMessage
def cmd_enso(ensoapi, cmd):
""" Enso system command """
if cmd == 'quit':
enso.stop()
elif cmd == 'about':
displayMessage(enso.config.ABOUT_BOX_XML)
... | {
"content_hash": "1408839699c77df8ffe618b6c841f31a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 59,
"avg_line_length": 23.5,
"alnum_prop": 0.6382978723404256,
"repo_name": "tartakynov/enso",
"id": "92e1f7eaa328869b105529e0c48a1a417765ba89",
"size": "517",
"binary": ... |
import random
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.orm import exc
from sqlalchemy.orm import joinedload
from neutron.common import constants as q_const
from neutron.common import utils as n_utils
from neutron.db import agents_db
from neutron.db import l3_agentschedulers_db as l3agent_sch... | {
"content_hash": "1a46b4c52aa1cbef54293fa5927d8acd",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 79,
"avg_line_length": 47.94178082191781,
"alnum_prop": 0.5598971355096792,
"repo_name": "redhat-openstack/neutron",
"id": "10a7e256e41603d6d6456d8d9142247828d963db",
"siz... |
"""
"""
__import__('pkg_resources').declare_namespace(__name__)
#EOF
| {
"content_hash": "aab976c88b1f4a61aedca532050e84a9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 55,
"avg_line_length": 11.833333333333334,
"alnum_prop": 0.5774647887323944,
"repo_name": "samjy/sloot.object",
"id": "361de315d7d7d579fe2576991e7cff133100a512",
"size": "11... |
import django_filters.rest_framework as filters
from .models import Monster, SkillEffect, Skill, LeaderSkill, ScalingStat
class MonsterFilter(filters.FilterSet):
name = filters.CharFilter(method='filter_name')
element = filters.MultipleChoiceFilter(choices=Monster.ELEMENT_CHOICES)
archetype = filters.Mul... | {
"content_hash": "a4557f99cd9444d2edaa3f33c176443c",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 134,
"avg_line_length": 41.64,
"alnum_prop": 0.6162343900096061,
"repo_name": "PeteAndersen/swarfarm",
"id": "a0d79765d07f7490fdd6c18cb7e6abd10966d3de",
"size": "4164",
... |
from .. import HopliteAppTestCase
from hoplite.api import create_app
class HopliteApiTestCase(HopliteAppTestCase):
def _create_app(self):
return create_app('hoplite.test_jobs')
| {
"content_hash": "d6aafff4a250c95e39b9feaea5a1ef5c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 27.285714285714285,
"alnum_prop": 0.7539267015706806,
"repo_name": "ni/hoplite",
"id": "37e128cec7dc8cdc9c7c236c463d1ee63812f262",
"size": "191",
"b... |
from .circuits import *
from .providers import *
| {
"content_hash": "e446be9861af487588eda69908ff1810",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 24,
"avg_line_length": 24.5,
"alnum_prop": 0.7551020408163265,
"repo_name": "digitalocean/netbox",
"id": "7bbaf75d367e288c6d58764a6f3f6ee78621d25b",
"size": "49",
"binary"... |
import ldap as pyldap
import ldap.sasl as sasl
import ldap.modlist
import re
from datetime import datetime, date
from copy import deepcopy
class CSHLDAP:
def __init__(self, user, password, host='ldaps://ldap.csh.rit.edu:636', \
base='ou=Users,dc=csh,dc=rit,dc=edu', bind='ou=Apps,dc=csh,dc=rit,dc=... | {
"content_hash": "9ba52c30c5cc1490b10e641e46c6a6a4",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 117,
"avg_line_length": 34.38,
"alnum_prop": 0.5577162802293693,
"repo_name": "stevenmirabito/csh-asterisk",
"id": "328f85bf3cc356f97d0f8501d3ae64ab93b0f432",
"size": "120... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1beta1In... | {
"content_hash": "027cedc2d45e6df54993e25eebbc4c25",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 281,
"avg_line_length": 32.38461538461539,
"alnum_prop": 0.5946159936658749,
"repo_name": "djkonro/client-python",
"id": "e0109f95cc08fd3eaa39aa7fab56d7388aa48558",
"size"... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'FailedAccessAttempt.expired'
db.add_column('cerberos_failedaccessattempt', 'expired',
self.gf(... | {
"content_hash": "163a2cfdd89154d859ddc1e0763c8853",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 131,
"avg_line_length": 52.93617021276596,
"alnum_prop": 0.5667202572347267,
"repo_name": "AdrianRibao/cerberos",
"id": "806c85975fda9eb0a6351904617de6e8faa97ba4",
"size": ... |
import base64
import logging
try:
import cPickle as pickle
except:
import pickle
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from django.contrib.admin.widgets import AdminTextInputWidget
from django.forms import widgets, TextInput, Textarea, Media
from django.template.loader import rende... | {
"content_hash": "762e1c98b73f38b40ff60127111091d4",
"timestamp": "",
"source": "github",
"line_count": 719,
"max_line_length": 112,
"avg_line_length": 42.013908205841446,
"alnum_prop": 0.5831898834745762,
"repo_name": "JuliBakagianni/CEF-ELRC",
"id": "ce69f7a19f03ea0b6af96f59aa0f4f62e9929d64",
"si... |
import time, subprocess, platform, threading, queue, os
from collections import deque
from housepy import osc, util, log, config, process
process.secure_pid(os.path.abspath(os.path.join(os.path.dirname(__file__), "run")))
log.info("--> controller is %s" % config['controller'])
class Health(threading.Thread):
de... | {
"content_hash": "e92a77ec2b43ed43fb0fbaf830c36e23",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 93,
"avg_line_length": 33.41121495327103,
"alnum_prop": 0.4993006993006993,
"repo_name": "brianhouse/dcue",
"id": "5867494e3e049012c13d7a068433908e0f12e113",
"size": "3599... |
"""WatchRule object."""
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
from heat.db import api as db_api
from heat.objects import fields as heat_fields
from heat.objects import stack
from heat.objects import watch_data
class WatchRule(base.VersionedObject, base.VersionedObjectDictCo... | {
"content_hash": "ddb27be87125a2d658f37c5192abec41",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 36.729729729729726,
"alnum_prop": 0.6070640176600441,
"repo_name": "pratikmallya/heat",
"id": "cf71e3723995a1712e759b88c6772a0276e3320b",
"size": "32... |
import cfp_common
import nltk
import sys
class CfpCommonV1(cfp_common.CfpCommon):
# top-level section -> (list weight, list nonterminal for that section)
list_weights = {nltk.Nonterminal("CFP_TOPIC_SECTION"):
(1,nltk.Nonterminal("CFP_TOPIC_LIST")),
nltk.Nonterminal("... | {
"content_hash": "d7302cf17aabb78a302dfa92b8f02495",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 76,
"avg_line_length": 44.01020408163265,
"alnum_prop": 0.5365175052167864,
"repo_name": "strib/scipher",
"id": "143141cd45bfdd1f50baf6dac37c3aef174e8e5d",
"size": "4448",
... |
"""
OpenMDAO Wrapper for PDCYL.
PDCYL is a structural esimation code that was pulled from ACSYNT.
"""
# pylint: disable-msg=E0611,F0401
from openmdao.lib.components.api import ExternalCode
from openmdao.main.api import FileMetadata
from openmdao.main.datatypes.api import Bool, Enum, Float, Int, Str
from openmdao.util... | {
"content_hash": "122696d75413032c449bc291cf540a43",
"timestamp": "",
"source": "github",
"line_count": 473,
"max_line_length": 129,
"avg_line_length": 41.0676532769556,
"alnum_prop": 0.5801801801801801,
"repo_name": "DailyActie/Surrogate-Model",
"id": "48085cecca0bc06adce27b5cb1d3540e92db776c",
"s... |
"""A basic example of authentication requests within a hug API"""
import hug
import jwt
# Several authenticators are included in hug/authentication.py. These functions
# accept a verify_user function, which can be either an included function (such
# as the basic username/password function demonstrated below), or logic... | {
"content_hash": "a275a01ab80ca3dac9b14d1e638ee952",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 100,
"avg_line_length": 36.093023255813954,
"alnum_prop": 0.7152061855670103,
"repo_name": "timothycrosley/hug",
"id": "26d7d4d7ce92cedc9aa04acae33900619ef0d91d",
"size": "... |
from collections import Counter
from nltk import RegexpTokenizer
from nltk.stem.porter import PorterStemmer
from nltk.stem.snowball import RussianStemmer
from pymorphy2 import MorphAnalyzer
import artm
import numpy as np
from string import punctuation
def build_text_cleaner():
remove_chars = punctuation
rem... | {
"content_hash": "d3d395c2d78e33bf68ab8db0b11bf42d",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 122,
"avg_line_length": 33.73737373737374,
"alnum_prop": 0.5745508982035928,
"repo_name": "menshikh-iv/image2pic",
"id": "a67bab0b2fe2f72940fc9970a4c80eeeefaa4bc2",
"size":... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Quotes(models.Model):
class Meta: # include this to ensure build in IDE
app_label = "Quotes_app"
quoter_first_name = models.CharField(max_length=255)
quoter_last_name = models.CharField(max_len... | {
"content_hash": "b6892c04fcd448a7b5d2a7a6f418c6d7",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 56,
"avg_line_length": 26.894736842105264,
"alnum_prop": 0.6418786692759295,
"repo_name": "GunnerJnr/_CodeInstitute",
"id": "72482b52964ba02d9a38b4a27b0bf71c1ea71370",
"siz... |
from django.utils.translation import ugettext
class SocialAuthBaseException(ValueError):
"""Base class for pipeline exceptions."""
pass
class BackendError(SocialAuthBaseException):
def __unicode__(self):
return ugettext('Backend error: %s' % self.message)
class WrongBackend(BackendError):
de... | {
"content_hash": "b6cb2edeb5c19859b158fbdfbb60f42f",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 76,
"avg_line_length": 30.821782178217823,
"alnum_prop": 0.6662383552842917,
"repo_name": "limdauto/django-social-auth",
"id": "0e0a5a23fdbde0d90b9c5893f6184bf589efedd3",
... |
from __future__ import absolute_import, division, print_function
import os
import pytest
from ramlfications import parse
from ramlfications import parser as pw
from ramlfications.config import setup_config
from ramlfications.raml import RootNode, ResourceTypeNode, TraitNode
from ramlfications._helpers import load_fi... | {
"content_hash": "199ee50815607c0825258bdc6d7d3b09",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 79,
"avg_line_length": 30.032608695652176,
"alnum_prop": 0.6545421643141512,
"repo_name": "jmagnusson/ramlfications",
"id": "1d9ed07fd9c82171d7971cd28dcc12bc5a0876ad",
"si... |
from __future__ import unicode_literals
from django.test import TestCase
from rest_framework.status import (
is_informational, is_success, is_redirect, is_client_error, is_server_error
)
class TestStatus(TestCase):
def test_status_categories(self):
self.assertFalse(is_informational(99))
self.a... | {
"content_hash": "95806d1e7d6061c8982411ad3faa54c4",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 35.15151515151515,
"alnum_prop": 0.678448275862069,
"repo_name": "MJafarMashhadi/django-rest-framework",
"id": "721a6e30b719c9e4e47c2df3653a441a970d7fd... |
import sys
from pyasn1.codec.der.decoder import decode as der_decode
from pyasn1.codec.der.encoder import encode as der_encode
from pyasn1_modules import pem
from pyasn1_modules import rfc5915
from pyasn1_modules import rfc5480
try:
import unittest2 as unittest
except ImportError:
import unittest
class MUD... | {
"content_hash": "8f60ade0152b034683d0dbad0d876d71",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 74,
"avg_line_length": 29.53488372093023,
"alnum_prop": 0.75748031496063,
"repo_name": "cloudera/hue",
"id": "bcb81981432edf3a9aefa922b6aa325beba57bbf",
"size": "1444",
"... |
"""
Network examples
Create all the pieces parts to have a working network.
To run:
python examples/network/create.py
"""
import sys
from examples import common
from examples import connection
def create(conn, name, opts, ports_to_open=[80, 22]):
dns_nameservers = opts.data.pop('dns_nameservers', '206.164... | {
"content_hash": "06b436b10a89f7ee1eb231a8ddb81be2",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 72,
"avg_line_length": 26.970149253731343,
"alnum_prop": 0.6142778085224129,
"repo_name": "dudymas/python-openstacksdk",
"id": "e948ccc8a51f10108ac3879164c846742f42f31e",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.