text stringlengths 4 1.02M | meta dict |
|---|---|
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'QuestaoDeAvaliacao.retorno_correcao'
db.alter_column('Questao_questaodeavaliacao', 'retorno_correcao_id', self.gf... | {
"content_hash": "b7650c16dddb161b875ea56085376c9e",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 243,
"avg_line_length": 81.7910447761194,
"alnum_prop": 0.5666058394160584,
"repo_name": "arruda/amao",
"id": "3e5f2747c1625f696ad8b9e132556be7c93c68bf",
"size": "16464",
... |
import pytest
from awx.api.versioning import reverse
from awx.main.models import Group
@pytest.mark.django_db
def test_cyclical_association_prohibited(post, inventory, admin_user):
parent = Group.objects.create(inventory=inventory, name='parent_group')
child = parent.children.create(inventory=inventory, nam... | {
"content_hash": "ed47c9f3567db9b75f4e0205437ded4e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 75,
"avg_line_length": 38.8,
"alnum_prop": 0.7353951890034365,
"repo_name": "wwitzel3/awx",
"id": "1498cfa2beb6b4f77e3c0704174a5e6991d73214",
"size": "582",
"binary": fal... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import os
import subprocess
from pants.backend.android.targets.android_library import AndroidLibrary
from pants.backend.android.targets.android_resourc... | {
"content_hash": "edbd948c6ad27530d5294cdbef155f89",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 105,
"avg_line_length": 48.3905325443787,
"alnum_prop": 0.6880655416972364,
"repo_name": "sameerparekh/pants",
"id": "c39994b32a1ba0129c5616bd15344c634bfab494",
"size": "8... |
from django.core.management import execute_manager
import sys
from django.conf import settings
PROJECT_APPS = ('web_performance', 'tests')
try:
import django_jenkins
JENKINS_APP = ('django_jenkins',)
except ImportError:
JENKINS_APP = tuple()
settings.configure(DEBUG = True,
DATABASE_EN... | {
"content_hash": "62d172ecc3dfecab585c25a8d11cfc45",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 91,
"avg_line_length": 35.642857142857146,
"alnum_prop": 0.49365397461589844,
"repo_name": "coagulant/django-webperf",
"id": "ed4ad396a216da9f5f2bd1ac9f17de07306c4a30",
"si... |
"""Adds merged_type to transactions and worker to block table
Revision ID: 53dcf1daebec
Revises: 219a47ab9647
Create Date: 2014-05-14 06:48:11.695068
"""
# revision identifiers, used by Alembic.
revision = '53dcf1daebec'
down_revision = '219a47ab9647'
from alembic import op
import sqlalchemy as sa
def upgrade():
... | {
"content_hash": "9de3c7a46fe8244d46baf8948b4306ac",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 27.964285714285715,
"alnum_prop": 0.6934865900383141,
"repo_name": "simplecrypto/simplecoin",
"id": "d9c0e07fcbb6d878b9a36dd2efd0e8e2d529e5cb",
"size... |
from django.forms import ModelForm, ValidationError
# import models from core for forms
from core.models import Organization, RecordGroup, RecordIdentifierTransformation,\
Transformation, ValidationScenario, OAIEndpoint, FieldMapper, get_rits_choices,\
get_field_mapper_choices, get_validation_scenario_choices,... | {
"content_hash": "fa2f63dd6cca06ea403197f9a1782815",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 177,
"avg_line_length": 37.55813953488372,
"alnum_prop": 0.6342621259029928,
"repo_name": "WSULib/combine",
"id": "5d0dddc5c1ad2bcf590ac5731dfef0fdde95cd6e",
"size": "4845... |
from sympy import simplify, Eq
class Parser(object):
@staticmethod
def solve(validated_input_str):
# Escape input_str
# Start doing real shit
# Check if equation is passed with right and left side
split_equation = validated_input_str.split('=')
if len(split_equation) =... | {
"content_hash": "f54f740824ae989df3957873d93ae7f4",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 83,
"avg_line_length": 25.19047619047619,
"alnum_prop": 0.6266540642722117,
"repo_name": "ViktorBarzin/TechFest",
"id": "3cc8a7306e7099ab35a1d1ac985a8fca5979e489",
"size": ... |
from __future__ import unicode_literals
from django.apps import apps
from django.db import models
from django.db.models.signals import post_migrate
from django.test import TestCase, override_settings
class TestAdminViewPermissionConfig(TestCase):
def setUp(self):
class Meta:
permissions = (
... | {
"content_hash": "ec908d64f3818e5472d1a136da175c29",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 78,
"avg_line_length": 34.516129032258064,
"alnum_prop": 0.5813084112149532,
"repo_name": "ctxis/django-admin-view-permission",
"id": "7aa81f4b894fe6a98aff1b6a3b46e1ea94eb74e... |
import json
import logging
import discord
import discord.ext.commands as commands
# Setup logging
rlog = logging.getLogger()
rlog.setLevel(logging.INFO)
handler = logging.FileHandler('panda.log', encoding='utf-8')
handler.setFormatter(logging.Formatter('{asctime}:{levelname}:{name}:{message}', style='{'))
rlog.addHan... | {
"content_hash": "910e01476237d8235cb3bb608890ac3d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 111,
"avg_line_length": 28,
"alnum_prop": 0.6659663865546218,
"repo_name": "PapyrusThePlant/MusicPanda",
"id": "394239df50af69120354b326d33deb02398b09ee",
"size": "952",
... |
from __future__ import generators # for python 2.2
from random import randrange,randint,seed
try:
from os import urandom
except:
seed()
urandom = lambda x: ''.join([chr(randint(0,255)) for i in xrange(x)])
from sha import sha
try:
True
except:
True = 1
False = 0
try:
from Crypto.Ciph... | {
"content_hash": "d3cb2d59e0327d5cf32eaa60e434cb86",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 205,
"avg_line_length": 30.292929292929294,
"alnum_prop": 0.6125375125041681,
"repo_name": "tumdum/bittornado",
"id": "9510414c1e8aeaa06fd27b650def36c337af8d05",
"size": "3... |
def extractMelontranslations599293570WordpressCom(item):
'''
Parser for 'melontranslations599293570.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | {
"content_hash": "c1254cde16b58ee4180226d104deb509",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 28.142857142857142,
"alnum_prop": 0.6548223350253807,
"repo_name": "fake-name/ReadableWebProxy",
"id": "a824860c40e2026879b703616133cb1ea0d015e7",
"... |
"""
Support for constructing and viewing custom "track" browsers within Galaxy.
Track browsers are currently transient -- nothing is stored to the database
when a browser is created. Building a browser consists of selecting a set
of datasets associated with the same dbkey to display. Once selected, jobs
are started to... | {
"content_hash": "cc6642e0c6da6eb88e512595d1afc904",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 148,
"avg_line_length": 43.15503875968992,
"alnum_prop": 0.6096640919705407,
"repo_name": "volpino/Yeps-EURAC",
"id": "1af13f582fc31886a0554fba9c03851d98545c47",
"size": "... |
from itertools import product
import datetime
import os.path as op
import numpy as np
from numpy.testing import (assert_array_equal, assert_equal, assert_allclose)
import pytest
import matplotlib.pyplot as plt
import mne
from mne import (Epochs, read_events, pick_types, create_info, EpochsArray,
Info... | {
"content_hash": "d1b8c5f60e26279460c93382c91002e3",
"timestamp": "",
"source": "github",
"line_count": 1156,
"max_line_length": 79,
"avg_line_length": 40.53287197231834,
"alnum_prop": 0.5942675431108075,
"repo_name": "Eric89GXL/mne-python",
"id": "b0edd9a968e092e649ae3cfca4a0d5cfa367d62a",
"size":... |
from test import CollectorTestCase
from test import get_collector_config
from mock import Mock
from mock import patch
from diamond.collector import Collector
from httpjson import HTTPJSONCollector
################################################################################
class TestHTTPJSONCollector(CollectorTe... | {
"content_hash": "a446fbf23a3bfc23602d39cd87edf955",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 97,
"avg_line_length": 32.689655172413794,
"alnum_prop": 0.6582278481012658,
"repo_name": "metamx/Diamond",
"id": "52f23f98a295b8444ea70b983e4cc319eda9e4c3",
"size": "1062"... |
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def jserr():
js_string = """
<script type="text/javascript">
if (%s) {
window.onerror = function(message, url, lineNumber){
... | {
"content_hash": "13bee8a411326a48ba5fa4172e6d5557",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 108,
"avg_line_length": 31.416666666666668,
"alnum_prop": 0.5291777188328912,
"repo_name": "gridcell/jserr",
"id": "4ccd4857532d65b7c9fc810e0973c32f4824caec",
"size": "754"... |
import pytest
#from flask import url_for
from app.models import User
from app import mail
def test_login_and_logout(client, db):
# Add test user.
user = User(email='test@example.com', password='secretsauce', confirmed=True)
db.session.add(user)
db.session.commit()
# Login
rv = client.post('/a... | {
"content_hash": "f49c12934e86ebd83cca354b77526089",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.6580907244414353,
"repo_name": "Limpan/bytardag",
"id": "4e84a2247b3ce83cf199dbe1c5259210d6900c8b",
"size": "1483... |
"""
Support for MQTT switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.mqtt/
"""
import logging
import voluptuous as vol
from homeassistant.components import mqtt, switch
from homeassistant.components.switch import SwitchDevice
from homea... | {
"content_hash": "8ad2fef0622bb0a02df1c502955a79b0",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 79,
"avg_line_length": 35.82231404958678,
"alnum_prop": 0.6290229553581728,
"repo_name": "jamespcole/home-assistant",
"id": "4847afd80c90e6596e1782f0521133dee11a8b93",
"si... |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
| {
"content_hash": "fac63f381f6963ac8332472288be7e7b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 66,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.7904191616766467,
"repo_name": "tombasche/BookChook",
"id": "980d0a5744fabe0be38c27d9b230b8a05f9a6616",
"size": "1... |
default_app_config = 'funrun.match.apps.AppConfig'
| {
"content_hash": "58146a1191c06f567896a8cb55e4a598",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 51,
"alnum_prop": 0.7843137254901961,
"repo_name": "wormer/funrun",
"id": "027a57391a7de19129a79ce244152feab4b05d2b",
"size": "51",
"binary": false,... |
"""
Plot coverage of the three primer regions from a given bam file
"""
import os
import sys
import argparse
import pysam
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy
def get_coverage(bamfile, genomelen, refg):
"""
Get the coverage of the bamfile from 0 to genom... | {
"content_hash": "a60e4695c799dab7e93c753f0e40679d",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 137,
"avg_line_length": 33.824074074074076,
"alnum_prop": 0.6279770052012045,
"repo_name": "linsalrob/EdwardsLab",
"id": "b94e0d1bcec3a7feb18546c0df06a435db9c1d09",
"size"... |
from django.core.management import setup_environ
import os
import sys
sys.path.append(os.path.dirname(__file__))
import settings
setup_environ(settings)
#===================================#
from django.contrib.gis.utils import LayerMapping
from seak.models import Watershed
a = Watershed.objects.all()
for i in a:
... | {
"content_hash": "50631e36efc165fcda4d2dffb7939f56",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 76,
"avg_line_length": 22.8,
"alnum_prop": 0.6257309941520468,
"repo_name": "Ecotrust/juniper-priorities",
"id": "d1bd5b8d548c00ac1c4ed29cc0c757617b3783c6",
"size": "684",
... |
DEPS = [
'depot_tools/depot_tools',
'depot_tools/gclient',
'recipe_engine/step',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/python'
]
| {
"content_hash": "9ccb52817fa2b8ec2ae3752f4d36efc7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 28,
"avg_line_length": 20.75,
"alnum_prop": 0.6686746987951807,
"repo_name": "eunchong/build",
"id": "b712fc2a11b067e85da0095ec705c46ccec986c2",
"size": "166",
"binary": f... |
from .linked_service import LinkedService
class DynamicsLinkedService(LinkedService):
"""Dynamics linked service.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param connect_via: The integratio... | {
"content_hash": "9549385877829a35f0ad6fae94a6ab1e",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 281,
"avg_line_length": 54.51578947368421,
"alnum_prop": 0.6953079745124542,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "8161c702bd6986431ee2df307556c14ed3413efd",
... |
from collections import deque
import dequeextensions
class QueenSolver(object):
def __init__(self):
self.availableRanks = deque([1, 2, 3, 4, 5, 6, 7, 8])
self.results = list()
self.unavailableSquare = set()
def checkUnavailableSquare(self, square):
if square in self.unavaila... | {
"content_hash": "8450f0f5d486c7dbe7e5c0621e9f7d0e",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 100,
"avg_line_length": 31.79591836734694,
"alnum_prop": 0.6161745827984596,
"repo_name": "MiyamotoAkira/python-katas-and-praxis",
"id": "ae44cf0a8dbc95fe5aa73648fd0b947eda1... |
from __future__ import absolute_import, division, print_function
import numpy as np
from collections import OrderedDict
import re
from atom.api import Atom, Str, observe, List, Int, Bool, Typed
from skbeam.fluorescence import XrfElement as Element
from skbeam.core.fitting.xrf_model import K_LINE, L_LINE, M_LINE
fro... | {
"content_hash": "e3d2b02b848a79c443bbec2b9a284e15",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 99,
"avg_line_length": 33.74728260869565,
"alnum_prop": 0.5697721233593687,
"repo_name": "NSLS-II/PyXRF",
"id": "851c662b9a3c860cd2e01bdb7edf3cb52ae2b427",
"size": "12419"... |
from __future__ import print_function
# returns a list of errors in string format
def error_list(train_sents, test_sents):
"""
Returns a list of human-readable strings indicating the errors in the
given tagging of the corpus.
:param train_sents: The correct tagging of the corpus
:type train_sent... | {
"content_hash": "95cc386da5b9e46bf433aac7d279ba01",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 77,
"avg_line_length": 39.58620689655172,
"alnum_prop": 0.5496515679442509,
"repo_name": "NorfolkDataSci/presentations",
"id": "72253d7eaf8de4eca1487dab9787992277abbab5",
"... |
__author__ = 'Flavio'
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from pelican.utils import slugify
from pelican_admin.models.settings import Settings
import os, datetime, codecs
MARKUPS = (
(0, 'rst'),
(1, 'md'),
)
STATUS = (
(... | {
"content_hash": "57fcb19a2c73ba311f41f20a01ae4967",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 98,
"avg_line_length": 31.44723618090452,
"alnum_prop": 0.5661553211888782,
"repo_name": "fjcaetano/pelican_admin",
"id": "f5a106891bcbed9d408a49035b73e1080f7853d0",
"size... |
from PyObjCTools import AppHelper
import MyWindowController
AppHelper.runEventLoop()
| {
"content_hash": "f6361a63c5121c67e6549b375f64ba30",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.4,
"alnum_prop": 0.8620689655172413,
"repo_name": "Khan/pyobjc-framework-Cocoa",
"id": "501228982a9ca1b691dd86b461e02a387b0428ca",
"size": "87",
... |
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
fro... | {
"content_hash": "e32f7208af1ef6f717c3af4e476bdc6f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 27.892857142857142,
"alnum_prop": 0.7266325224071702,
"repo_name": "borh/jsrs",
"id": "850134676618e49b545b0386eebf716380c285ae",
"size": "1586",
"... |
""" Starts home assistant. """
from __future__ import print_function
import sys
import os
import argparse
import subprocess
DEPENDENCIES = ['requests>=2.0', 'pyyaml>=3.11', 'pytz>=2015.2']
IS_VIRTUAL = (getattr(sys, 'base_prefix', sys.prefix) != sys.prefix or
hasattr(sys, 'real_prefix'))
def validate_... | {
"content_hash": "9257d9bd3c548df5967d65cb2cc6093b",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 29.322981366459626,
"alnum_prop": 0.6352467697521712,
"repo_name": "sanmiguel/home-assistant",
"id": "6f937d6916e99cc6263aba7f4cb6cd7521f43be1",
"si... |
import unittest
from django.conf import settings
from django.db.models import get_app, get_apps
from django.test import _doctest as doctest
from django.test.utils import setup_test_environment, teardown_test_environment
from django.test.testcases import OutputChecker, DocTestRunner, TestCase
# The module name f... | {
"content_hash": "9b54aea41295b73d1b7c7e77cb6943cd",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 114,
"avg_line_length": 37.97969543147208,
"alnum_prop": 0.6098636728147554,
"repo_name": "greggian/TapdIn",
"id": "6f30b020829dfc9cef8c509ec9ada1d3b6b7361e",
"size": "748... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sermons', '0002_mediafile_file_size'),
]
operations = [
migrations.AddField(
model_name='series',
name='complete',
... | {
"content_hash": "e7e6979e21be32425d0d360cb4a05b2f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 21.22222222222222,
"alnum_prop": 0.5968586387434555,
"repo_name": "psyonara/agonizomai",
"id": "082affcd9eb2a474c7ac52871c4b19c8b4450d63",
"size": "4... |
import logging
import re
import requests
from cat.app_settings import Config
logger = logging.getLogger(__name__)
class SMS(object):
ALL_ERROR = range(-2, 0)
(
ERROR_NO_CALL_NUM,
ERROR_DEFAULT
) = ALL_ERROR
def __init__(self, *args, **kwargs):
super(SMS, self).__init__()
... | {
"content_hash": "937505c14f23141280337c02049ae43d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 82,
"avg_line_length": 29.044776119402986,
"alnum_prop": 0.5580678314491264,
"repo_name": "ciknight/doge",
"id": "07e3156fb051888f1280e7f07f0c0a5b18dc1db1",
"size": "2083",... |
"""
Add-on utilities for the L{qpid.messaging} API.
"""
from qpid.messaging import *
from logging import getLogger
from threading import Thread
log = getLogger("qpid.messaging.util")
def auto_fetch_reconnect_urls(conn):
ssn = conn.session("auto-fetch-reconnect-urls")
rcv = ssn.receiver("amq.failover")
rcv.capa... | {
"content_hash": "0ab86eb60be2ea434d9f6c7cfadc7739",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 93,
"avg_line_length": 30.244444444444444,
"alnum_prop": 0.6458486407053637,
"repo_name": "SVADemoAPP/AmqpCode",
"id": "726cfd5172553416643fcb3dd9cc08c1c4f5bfb3",
"size": "... |
"""
Basic pyodbc helper methods for simplifying sql statements
and caching query results.
"""
import logging
import pyodbc
from funcutils import memoize, flatten, tuplify, is_seq, remove_ws, \
chunks, pipe
LOGGER = logging.getLogger('sqlutils')
def is_hex_string(s):
"""Test for "hex"-ness of a string"""
... | {
"content_hash": "f5836adf76cf233e6e574d74228f84bd",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 76,
"avg_line_length": 32.94652406417112,
"alnum_prop": 0.5877292647297516,
"repo_name": "obsoleter/sqlutils",
"id": "f58fd81291e57e72a46afbc3b5445da78a2a6809",
"size": "6... |
import argparse
import cmd
import signal
import shlex
from time import sleep
from pyfirmata import Arduino, serial
from conf import Config
class Sh(cmd.Cmd):
prompt = 'rswtch> '
intro = 'type \'help\' to see available commands'
def default(self, line):
print(line + ": not found")
def do_EO... | {
"content_hash": "1d3290d8bbb6826ad26576841a6275d9",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 106,
"avg_line_length": 27.497354497354497,
"alnum_prop": 0.5507023282663075,
"repo_name": "dbolgheroni/rswtch",
"id": "1a4eed8c4e06753bc353deb25b842ef021867838",
"size": ... |
from django.contrib import admin
from catalog.models import Author, Genre, Book, BookInstance, Language
# Register your models here.
class AuthorsInline(admin.TabularInline):
model = Book
class AuthorAdmin(admin.ModelAdmin):
# 在列表页显示更多信息
list_display = ('last_name', 'first_name', 'date_of_birth', 'date... | {
"content_hash": "1b2ff73f4539c4d1330232b02cb2bee0",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 137,
"avg_line_length": 26.875,
"alnum_prop": 0.6784053156146179,
"repo_name": "sharkspeed/dororis",
"id": "dd18fee864ef341af0a562da41e6a21006a6cdd2",
"size": "1539",
"bi... |
"""Arithmetic Operations that don't fit into math_ops due to dependencies.
To avoid circular dependencies, some math_ops should go here.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
from six.moves import xrange # pylint: disable=redefine... | {
"content_hash": "ec217468e0af9aae8fb884b43fe4cf17",
"timestamp": "",
"source": "github",
"line_count": 529,
"max_line_length": 80,
"avg_line_length": 34.79962192816635,
"alnum_prop": 0.6425661361290673,
"repo_name": "snnn/tensorflow",
"id": "cfab94389615fe95daf88517a8490a550572801b",
"size": "1909... |
"""A module for writing GTFS feeds out into Google Earth KML format.
For usage information run kmlwriter.py --help
If no output filename is specified, the output file will be given the same
name as the feed file (with ".kml" appended) and will be placed in the same
directory as the input feed.
The resulting KML file... | {
"content_hash": "aa4325adab5d0faa49857d8be9c4b0a5",
"timestamp": "",
"source": "github",
"line_count": 788,
"max_line_length": 81,
"avg_line_length": 37.83502538071066,
"alnum_prop": 0.6504997652109747,
"repo_name": "jonpetersen/transitfeed-1.2.12",
"id": "6f2ca1db03403640ca54967dc809f09fc40552b5",
... |
import sys
from google.appengine._internal.antlr3 import *
from google.appengine._internal.antlr3.compat import set, frozenset
from google.appengine._internal.antlr3.tree import *
HIDDEN = BaseRecognizer.HIDDEN
DOLLAR=54
EXPONENT=49
LT=11
LSQUARE=23
ASCII_LETTER=52
LOG=40
SNIPPET=44
OCTAL_ESC=57
MAX=41
FLOAT=3... | {
"content_hash": "1ac8c43bf04c56e8de501ffa0ec7e4f5",
"timestamp": "",
"source": "github",
"line_count": 2251,
"max_line_length": 182,
"avg_line_length": 23.797867614393603,
"alnum_prop": 0.5054229125053669,
"repo_name": "pigeonflight/strider-plone",
"id": "3aafc32f64badfdcdd24260c8d2fe7d79d13584d",
... |
import MySQLdb
from Config import Config
from Logger import Logger
from tools import singleton
@singleton
class DbHelper(object):
"""
Encapsulate basic operations of database
"""
TAG = "DbHelper"
def __init__(self):
self.connect()
self.logger = Logger()
def connect(self)... | {
"content_hash": "1c2863fb5f1735e0224c29a58c835a42",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 68,
"avg_line_length": 23.1,
"alnum_prop": 0.5541125541125541,
"repo_name": "vinx13/WikiCrawler",
"id": "ea87fd0964accb7238440cea52b4d12e98db844c",
"size": "1155",
"binar... |
'''
author: Taylor Kessinger & Richard Neher
date: 10/07/2014
content: generate beta coalescent trees and calculate their SFS
'''
import numpy as np
import random as rand
import scipy.special as sf
from Bio import Phylo
class betatree(object):
'''
class that simulates a beta coalescent tree
... | {
"content_hash": "4129e14c89d11473736a3da9c1c87cb1",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 105,
"avg_line_length": 39.1030303030303,
"alnum_prop": 0.6033787972721637,
"repo_name": "rneher/betatree",
"id": "cb72a69aadc7ea51d3c1a7e60a4d4cde2a0b4af6",
"size": "6499... |
"""Defused xml.sax
"""
from __future__ import print_function, absolute_import
from xml.sax import InputSource as _InputSource
from xml.sax import ErrorHandler as _ErrorHandler
from . import expatreader
__origin__ = "xml.sax"
def parse(source, handler, errorHandler=_ErrorHandler(), forbid_dtd=False,
forbi... | {
"content_hash": "e2ae424be6d6b86dffb18169eaf8fb1e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 74,
"avg_line_length": 28.931818181818183,
"alnum_prop": 0.7124901806755696,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "534d0ca7370d92fd3112946db79cd9ce904d6b51",
... |
from copy import deepcopy
import datetime
from django.core.urlresolvers import reverse
from django.db.models import Sum, Count
from django.utils.translation import ugettext_lazy as _
from grappelli.dashboard import modules, Dashboard
from grappelli.dashboard.modules import ModelList, DashboardModule
from boris.client... | {
"content_hash": "2694b66e7e39ea2fabc5879c2eb93974",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 130,
"avg_line_length": 35.76100628930818,
"alnum_prop": 0.5473091804431938,
"repo_name": "fragaria/BorIS",
"id": "5c48ec467366a5f575b699e1b449a5aa5149048e",
"size": "5736... |
import unittest
import pytest
import numpy as np
from .context import holonets
class TestHolonetsRun(unittest.TestCase):
"""
To test that the run module can take a training function, run it over
epochs and accumulate results in a HoloMap object.
"""
@classmethod
def setUpClass(self):
... | {
"content_hash": "0c4fb45b9c22196ab11b458ee7cc3ffd",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 76,
"avg_line_length": 26.1875,
"alnum_prop": 0.6189339697692919,
"repo_name": "gngdb/holo-nets",
"id": "3b4d5b01246d937fdc84ef3567b81d4b289b48ec",
"size": "1368",
"binar... |
'''
====================================================================
Copyright (c) 2003-2017 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
======================================================... | {
"content_hash": "abe4803e73f5bd3f087d1ac30b5ba3b7",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 156,
"avg_line_length": 43.82876712328767,
"alnum_prop": 0.6158774808563838,
"repo_name": "barry-scott/scm-workbench",
"id": "d0e7a32f10c1a27b26c7120c8696df8c5810a0bc",
"s... |
"""
Django settings for labquiz project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... | {
"content_hash": "b6c6cdd1ea319e6423326d591981c69a",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 91,
"avg_line_length": 25.680851063829788,
"alnum_prop": 0.668323667495167,
"repo_name": "sehgalayush1/labquiz",
"id": "e24630f7147bff2f0ce3bf621bfb0141b83316af",
"size": ... |
"""Functions for common roidb manipulations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from past.builtins import basestring
import logging
import numpy as np
from detectron.core.config import cfg
from detect... | {
"content_hash": "e2b35ee79fc2fadb44353296286a83a2",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 80,
"avg_line_length": 38.358695652173914,
"alnum_prop": 0.6289317086993482,
"repo_name": "facebookresearch/Detectron",
"id": "57b6e9cfeedc12d822e0b9ec46e58ff9a4bbb288",
"... |
"""
Diamond collector that monitors relevant MySQL performance_schema values
For now only monitors replication load
[Blog](http://bit.ly/PbSkbN) announcement.
[Sniplet](http://bit.ly/SHwYhT) to build example graph.
#### Dependencies
* MySQLdb
* MySQL 5.5.3+
"""
from __future__ import division
try:
import ... | {
"content_hash": "7b15e31aa7f3a2a2d0f86c396c5d4c1f",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 79,
"avg_line_length": 33.93061224489796,
"alnum_prop": 0.49067725249609045,
"repo_name": "wikimedia/operations-debs-python-diamond",
"id": "ad043ad4b21421521331f80be7908723... |
import os
import sublime
import subprocess
import threading
import time
SHELL_ERROR = "TINT: Could not run your shell: {}\n"
class CommandRunner():
def __init__(self, working_dir):
self.working_dir = working_dir
def build_command(self, string):
settings = sublime.load_settings("Tint.sublime-... | {
"content_hash": "dbc3f5f68a9b2370e90fa7ff5d213903",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 93,
"avg_line_length": 30.239436619718308,
"alnum_prop": 0.4997671169073125,
"repo_name": "yyyc514/Tint",
"id": "8501b04de8c114c4b5eaef0956975dbc26bcc41c",
"size": "2147",
... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Website settings
SECRET_KEY = os.environ.get('SECRET_KEY', 'knv3mcls)af%i!m2(8byle2#%=qa6#^)!h=@#nvs)nc*g)a7u4')
DEBUG = os.environ.get('DEBUG', True)
ALLOWED_HOSTS = [
... | {
"content_hash": "0be6c6906c84b8c9deea0bf94d2d0d31",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 95,
"avg_line_length": 24.978165938864628,
"alnum_prop": 0.6746503496503496,
"repo_name": "richardcornish/timgorin",
"id": "c7a704e30f93d60793c3ed0c1a135c2f05672f82",
"siz... |
import torch
from torch import Tensor
from torch import nn
from typing import Union, Tuple, List, Iterable, Dict
import os
import json
class WeightedLayerPooling(nn.Module):
"""
Token embeddings are weighted mean of their different hidden layer representations
"""
def __init__(self, word_embedding_dim... | {
"content_hash": "c45ff0a8710e11ced073af1dfa3707db",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 165,
"avg_line_length": 42.37735849056604,
"alnum_prop": 0.6727515583259127,
"repo_name": "UKPLab/sentence-transformers",
"id": "3a0b98fdb36fe24257bc5870208594821e8c5ac6",
... |
#类switch:用以实现switch功能
class switch(object):
def __init__(self, value):
self.value = value
self.fall = False
def __iter__(self):
"""Return the match method once, then stop"""
yield self.match
raise StopIteration
def match(self, *args):
"""Indicate whether or not to enter a case suite"""
... | {
"content_hash": "c2a3086e4d6cf17fe073f06a0b8d60c4",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 56,
"avg_line_length": 23.095238095238095,
"alnum_prop": 0.6453608247422681,
"repo_name": "GavinGL/workspace",
"id": "44fb4463f3b1eaa2ece74b48d0c01e06a55f9aea",
"size": "52... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('amaztv_app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Data',
fields=[
('id', models.A... | {
"content_hash": "877a8afd3091c554d531b2f7b3e0ef76",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 188,
"avg_line_length": 36.2962962962963,
"alnum_prop": 0.5448979591836735,
"repo_name": "AMAZTV/website",
"id": "a51907f61c3ad04d781b005e61dde216e2efa165",
"size": "1004",... |
import os
import hou
from anima.dcc.base import DCCBase
class Houdini(DCCBase):
"""the houdini DCC class"""
name = "Houdini"
extensions = {
0: ".hiplc",
hou.licenseCategoryType.Commercial: ".hip",
hou.licenseCategoryType.Apprentice: ".hipnc",
hou.licenseCategoryType.Indie:... | {
"content_hash": "368388e3c9bb0d27aa6c3e4d9942f5f5",
"timestamp": "",
"source": "github",
"line_count": 649,
"max_line_length": 87,
"avg_line_length": 33.550077041602464,
"alnum_prop": 0.5358684669789657,
"repo_name": "eoyilmaz/anima",
"id": "04849e3cec9cca88200fc471452d7975836ff05a",
"size": "2179... |
"""
Helper functions to build trees of logical
conditions to query on dictionary field values.
Example
-------
>>> talk = {'title': 'Meeting',
>>> 'duration': 60,
>>> 'admin_type': 'EPS session',
>>> 'language': 'English',
>>> }
>>> conds = [('duration', (30, 45, 60)),
>>> ('l... | {
"content_hash": "8d1e234df7193bc24f20484b8213e067",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 108,
"avg_line_length": 27.788235294117648,
"alnum_prop": 0.581922099915326,
"repo_name": "EuroPython/ep-tools",
"id": "8c9e0ada7d809ea678c74c53c87ec65efc3e298a",
"size": ... |
import sys
import os
import getopt
import subprocess
from os.path import exists, abspath, dirname, basename
# The PCI base class for NETWORK devices
NETWORK_BASE_CLASS = "02"
CRYPTO_BASE_CLASS = "0b"
# global dict ethernet devices present. Dictionary indexed by PCI address.
# Each device within this is itself a dicti... | {
"content_hash": "4222af71deee06f173c8198811a974f0",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 79,
"avg_line_length": 36.13365539452496,
"alnum_prop": 0.5792147600160436,
"repo_name": "ipdcode/containerdns",
"id": "1b9c651553c633785c6ddf54b2a49445c662d848",
"size": ... |
"""
sentry.plugins.sentry_urls.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sentry
from sentry.plugins import register
from sentry.plugins.bases.tag i... | {
"content_hash": "e89926407343f92dfa73f9d418d31afa",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 75,
"avg_line_length": 25.45945945945946,
"alnum_prop": 0.6358811040339702,
"repo_name": "BuildingLink/sentry",
"id": "e2a32f7e07055a625b02b8cffa1894cee9af273e",
"size": "9... |
from random import choice
from plotdevice.gfx import CENTER, CORNER, CMYK
from plotdevice.util import random, choice
from plotdevice.lib import register
_ctx = register(__name__)
SPACING = 1.2
def spacing(x=1.2):
"""Sets the lineheight or linespacing
for a pixie text paragraph().
"""
global SPACING
... | {
"content_hash": "90a38bd0e5058f3fbd17dd3aea78836a",
"timestamp": "",
"source": "github",
"line_count": 682,
"max_line_length": 84,
"avg_line_length": 28.422287390029325,
"alnum_prop": 0.5818200577796121,
"repo_name": "kantel/Virtuelle-Wunderkammer",
"id": "e8940ac9121957b4141d6ca4a4e900dea6a693f6",
... |
from bottle import route, run, template, view, static_file
from database import *
import os
import random
root = os.path.dirname(__file__)
static_root = os.path.join(root, "static")
@route('/')
@view('index')
def slogan():
slogan = random.choice(Slogan.objects()).slogan
noun = random.choice(Noun.objects()).noun
r... | {
"content_hash": "7e53a139bda84c8785c91acf689551d2",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 61,
"avg_line_length": 24.636363636363637,
"alnum_prop": 0.672509225092251,
"repo_name": "daxtens/diy-web-app",
"id": "2879dcb96c2322927327061a4a2e0fd250617469",
"size": "1... |
import rospy
import tf
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Pose, Quaternion, Point
def publishOdom():
rospy.init_node('fake_odom')
base_frame_id = rospy.get_param("~base_frame_id", "base_link")
odom_frame_id = rospy.get_param("~odom_frame_id", "odom")
publish_frequency = r... | {
"content_hash": "6d9e962d157b7ff67a458d6124366757",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 99,
"avg_line_length": 33.52777777777778,
"alnum_prop": 0.6404308202154101,
"repo_name": "aut-sepanta/Sepanta3",
"id": "19f86f1cdbd0fb751421a6f72d2e43e8748e934d",
"size": "... |
from .base import BaseOptimization
from .utils import OpDispatcher
from .. import Operations
class IntBounds(BaseOptimization):
dispatcher = OpDispatcher()
bounds_dispatcher = OpDispatcher()
@dispatcher.register(Operations.INT_LT)
def optimize_INT_LT(self, optimizer, operation):
[lhs, rhs] = ... | {
"content_hash": "fa4f0395d249ed1eb75f7ac378c45f59",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 90,
"avg_line_length": 48.7816091954023,
"alnum_prop": 0.6581055607917059,
"repo_name": "alex/optimizer-model",
"id": "b3d2e8932d1ea622de923a9fced5bb96180e50df",
"size": "4... |
import six
import platform
from . import CommentJsonTest
if six.PY2:
from json.tests.test_pass1 import TestPass1
else:
from test.test_json.test_pass1 import TestPass1
version = platform.sys.version_info
class TestCommentJsonPass1(TestPass1, CommentJsonTest):
pass
| {
"content_hash": "1cf104231abe2cf2dbcaec4e58aa33b0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 55,
"avg_line_length": 17.625,
"alnum_prop": 0.776595744680851,
"repo_name": "vaidik/commentjson",
"id": "b3bc9c204308987fd5b84b15ea4ba9cba0c6d96d",
"size": "282",
"binar... |
"""The tests for Device tracker device conditions."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import STATE_HOME, STATE_NOT_HOME
from homeassistant.helpers import device_registry
from homeassistant.setup i... | {
"content_hash": "e0de24f1ac3c8f33c52d19427b7ec3b2",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 107,
"avg_line_length": 34.84251968503937,
"alnum_prop": 0.5154802259887006,
"repo_name": "tboyce1/home-assistant",
"id": "a187f21e954d514be28bdba027eb89bfd1a619b4",
"size... |
from config.settings.common import *
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['*']
WSGI_APPLICATION = 'config.wsgi.application'
# BASE_URL = 'http://127.0.0.1/'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'base',
'USER': 'base',
... | {
"content_hash": "eb71e428834fec5e554ea3501a9a0825",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 119,
"avg_line_length": 28.242424242424242,
"alnum_prop": 0.5654506437768241,
"repo_name": "michailbrynard/django-skeleton",
"id": "aeb4213b41cc888608e7f576726ed19eb485d575",... |
"""
Parser for the .lang translation format.
"""
import codecs
import re
from parsimonious.exceptions import (
ParseError as ParsimoniousParseError,
VisitationError,
)
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
from pontoon.sync.exceptions import ParseError
from pontoo... | {
"content_hash": "61f51bc6c51a4f3596e298f4c09e1523",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 86,
"avg_line_length": 30.370192307692307,
"alnum_prop": 0.5914199778375812,
"repo_name": "mathjazz/pontoon",
"id": "34545f9ad698e41bce8d3ed7982fe0febde35eee",
"size": "63... |
from flask import flash, render_template, request, session
from werkzeug.exceptions import NotFound
from indico.modules.events.contributions import Contribution
from indico.modules.events.operations import (create_reviewing_question, delete_reviewing_question,
sort_reviewi... | {
"content_hash": "b202fe78055f608ca2bdff2f742cd90e",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 116,
"avg_line_length": 47.09385113268608,
"alnum_prop": 0.6431418361737218,
"repo_name": "ThiefMaster/indico",
"id": "a15a32c33bd24420adb81829f72a03919e6aa151",
"size": "... |
from datetime import date, timedelta
from ggrc.services.common import Resource
from ggrc.models import *
from ggrc_basic_permissions.models import *
from ggrc.app import app
from ggrc import db
from tests.ggrc.api_helper import Api
import string
import random
import names
class Generator():
def __init__(self):
... | {
"content_hash": "5e9ac2628e26b11d6ca932c927d4a25e",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 78,
"avg_line_length": 28.910828025477706,
"alnum_prop": 0.5560696188587795,
"repo_name": "vladan-m/ggrc-core",
"id": "3da501223def4c474f866d5a99ae6104bd6485f9",
"size": "... |
"""Updates EnterprisePolicies enum in histograms.xml file with policy
definitions read from policies.yaml.
If the file was pretty-printed, the updated version is pretty-printed too.
"""
from __future__ import print_function
import os
import re
import sys
from ast import literal_eval
from optparse import OptionParse... | {
"content_hash": "f9d2e1991a0aa4c384c05c2d451746d8",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 80,
"avg_line_length": 33.02739726027397,
"alnum_prop": 0.696391538780589,
"repo_name": "chromium/chromium",
"id": "18bb357a6eaa26a35322c5b375faef23138e0c0e",
"size": "496... |
from rest_framework.generics import (
DestroyAPIView,
ListAPIView,
UpdateAPIView,
RetrieveAPIView,
CreateAPIView)
from danibraz.booking... | {
"content_hash": "a11351e5de7299f5e125ea0f82854d13",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 86,
"avg_line_length": 33.372549019607845,
"alnum_prop": 0.6439482961222092,
"repo_name": "CoutinhoElias/danibraz",
"id": "9bbbbb5e6a4565f78c2f946b5c7f3d9a746bee23",
"size"... |
"""
pygments.formatters.terminal256
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for 256-color terminal output with ANSI sequences.
RGB-to-XTERM color conversion routines adapted from xterm256-conv
tool (http://frexx.de/xterm-256-notes/data/xterm256-conv2.tar.bz2)
by Wolfgang Frisch.
... | {
"content_hash": "7165a9d2319961f23b4381bb8d365b53",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 81,
"avg_line_length": 35.77064220183486,
"alnum_prop": 0.5307771223390613,
"repo_name": "ktan2020/legacy-automation",
"id": "2027c808c379e31e5159ca7485f0f3babc8f4a04",
"s... |
import json
import yaml
from nose_parameterized import parameterized
from unittest import skip
from tests.st.test_base import TestBase
from tests.st.utils.docker_host import DockerHost
from tests.st.utils.utils import ETCD_CA, ETCD_CERT, \
ETCD_KEY, ETCD_HOSTNAME_SSL, ETCD_SCHEME, get_ip, \
retry_until_success... | {
"content_hash": "e8a91a95abe35bb4cff9f82725147cf7",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 77,
"avg_line_length": 40.16577540106952,
"alnum_prop": 0.5328185328185329,
"repo_name": "caseydavenport/calico-containers",
"id": "8c8806bde4879f34cfb6fbdad527f493c9ffec66"... |
"""Utility functions for string manipulation."""
import re
# Regex to detect upper cases followed by lower cases, e.g, Apple1D2.
# Numbers should not be used as postfixes, or "AB12" will become "a_b12" instead
# of "ab12".
_camel_by_postfix = re.compile(r'([^_])([A-Z][a-z]+)')
# Regex to detect upper cases followed b... | {
"content_hash": "d5761dfccbeffdfd6149806f10061b15",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 80,
"avg_line_length": 26.987654320987655,
"alnum_prop": 0.6646843549862763,
"repo_name": "google/makani",
"id": "88ebcb756780ab94ef699c2eae5befdd3afbae33",
"size": "2775",... |
from datetime import datetime
import endpoints
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
import models
import process.profiles
import utils
DEFAULTS = {
"city": "Default City",
"maxAttendees": 0,
"seatsAvailable": 0,
"topics": ["Default", "Topic"]
}
def copyCo... | {
"content_hash": "07f5f48ea76099f65dc2ac789161c24a",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 34.27894736842105,
"alnum_prop": 0.6459388914478735,
"repo_name": "odinjv/conference-udacity",
"id": "951d7c04217378131cf413679fd8615546479fff",
"si... |
# Copyright (c) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | {
"content_hash": "04536d289866a0d93e3923f0e178d0ab",
"timestamp": "",
"source": "github",
"line_count": 914,
"max_line_length": 213,
"avg_line_length": 31.814004376367613,
"alnum_prop": 0.709161565444666,
"repo_name": "js0701/chromium-crosswalk",
"id": "219bf4a49e92b5b63d6806092cc2424c914d18ba",
"s... |
"""
Called by GitHub Action when the nightly build fails.
This reports an error to the #nightly-build-failures Slack channel.
"""
import os
import requests
if "SLACK_WEBHOOK_URL" in os.environ:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables
... | {
"content_hash": "895efcf5498cce0f64fd3a13ee50e2f5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 123,
"avg_line_length": 31.428571428571427,
"alnum_prop": 0.6795454545454546,
"repo_name": "torchbox/wagtailmedia",
"id": "c42b51317ee9ecad201942b43e4b4aa312fd5748",
"size"... |
"""
homeassistant.components.switch.transmission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enable or disable Transmission BitTorrent client Turtle Mode
Configuration:
To use the Transmission switch you will need to add something like the
following to your config/configuration.yaml
switch:
platform: transmiss... | {
"content_hash": "2ec441f1b4401ecbeca0c9d85b42630f",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 77,
"avg_line_length": 25.5,
"alnum_prop": 0.6747404844290658,
"repo_name": "ErykB2000/home-assistant",
"id": "8638f11a2e9e3d663ba2f20519b4cda4075daa95",
"size": "3468",
... |
__author__ = 'mpetyx'
from tastypie.authorization import DjangoAuthorization
from .models import OpeniDevice
from OPENiapp.APIS.OpeniGenericResource import GenericResource
from OPENiapp.APIS.OPENiAuthorization import Authorization
from OPENiapp.APIS.OPENiAuthentication import Authentication
class DeviceResource(Gen... | {
"content_hash": "9b2a1bdad9cccd086c67e5554be417f2",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 70,
"avg_line_length": 31.159420289855074,
"alnum_prop": 0.4213953488372093,
"repo_name": "OPENi-ict/ntua_demo",
"id": "3ddc3d250a4bee09414557b0ced4bd6100ccb6dc",
"size": "... |
import os
import re
from debtcollector import moves
from hacking import core
from neutron_lib.hacking import checks
import pep8
import six
def flake8ext(f):
"""Decorator to indicate flake8 extension.
This is borrowed from hacking.core.flake8ext(), but at now it is used
only for unit tests to know which ... | {
"content_hash": "c87ed158ad687682d90758c20f12c591",
"timestamp": "",
"source": "github",
"line_count": 411,
"max_line_length": 78,
"avg_line_length": 34.6301703163017,
"alnum_prop": 0.6100611255532916,
"repo_name": "cloudbase/neutron",
"id": "b01ef84952197152df57a1da5ef541a3c1c2d86c",
"size": "148... |
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 'Location.hint'
db.add_column('classes_location', 'hint',
self.gf('django.db.models.fields.Char... | {
"content_hash": "84ee8c6796f2590be3c42593ba960787",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 237,
"avg_line_length": 80.248,
"alnum_prop": 0.5519888346127007,
"repo_name": "knowledgecommonsdc/kcdc3",
"id": "7ccf40ba6124769e5a9c4b74362671ed2e64d2ef",
"size": "10055... |
"""
Signature and digest algorithms supported by XAdES are described in ETSI TS 119 312.
Digest algorithms:
- SHA-224 FIPS Publication 180-4
- SHA-256 FIPS Publication 180-4
- SHA-384 FIPS Publication 180-4
- SHA-512 FIPS Publication 180-4
- SHA-512/256 FIPS Publication 180-4
- SHA3-256 FIPS Publication 202
- SHA3-384 ... | {
"content_hash": "fc231c0f82da5c15230fdbf6bd12df00",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 120,
"avg_line_length": 53.740947075208915,
"alnum_prop": 0.6810760379412222,
"repo_name": "XML-Security/signxml",
"id": "8e73a61fb194359c97ee889ab5a0b59f0888d399",
"size"... |
"""
Downloading helper functions for benchbuild.
The helpers defined in this module provide access to some common Downloading
methods for the source code of benchbuild projects.
All downloads will be cached in BB_TMP_DIR and locked down with a hash that
is generated after the first download. If the hash matches the fi... | {
"content_hash": "1892706aa75d1428678264af3a48768e",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 76,
"avg_line_length": 25.864035087719298,
"alnum_prop": 0.5930133966423605,
"repo_name": "simbuerg/benchbuild",
"id": "633d6f052f31f4a1044ed0e74b4ec503d2ae0acf",
"size": ... |
from __future__ import annotations
import time
import json
import logging
import os
import requests
from typing import Any, List, Optional, Text, Dict
import rasa.utils.endpoints as endpoints_utils
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.recipes.default_recipe import DefaultV1Re... | {
"content_hash": "71545f0def849d87d8991f3d67027a25",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 88,
"avg_line_length": 37.30582524271845,
"alnum_prop": 0.5850357839947951,
"repo_name": "RasaHQ/rasa_nlu",
"id": "aa5b8f0c49b784b78d423188de4a53c43c0a76a1",
"size": "7685... |
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.utils.encoding import force_unicode
from django.utils.text import capfirst
# Not a Django model, but tightly tied to them and there doesn't seem to be a
# better spot in the tree.
from haystack.exceptions imp... | {
"content_hash": "7c3d05df01fd7090ef4aea2b01e8892a",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 122,
"avg_line_length": 34.59016393442623,
"alnum_prop": 0.5726698262243286,
"repo_name": "calvinchengx/django-haystack",
"id": "18df4bef9ae777b1cbf822e61d12088b3e5cb35d",
... |
from pokemongo_bot import inventory
from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot.item_list import Item
from pokemongo_bot.base_task import BaseTask
class EvolvePokemon(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
def initialize(self):
self.api = self.bot.api
self.evolve_all... | {
"content_hash": "da85aa1a04b17f419d7c0526c66f51fd",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 115,
"avg_line_length": 39.403225806451616,
"alnum_prop": 0.5454359394187475,
"repo_name": "geminiyellow/PokemonGo-Bot",
"id": "4cc451115b2b2c41d78fe0e1853f6f2e3eb7caaa",
... |
"""Refactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring tool.
"""
from __future__ import with_statement
__author__ = "Guido van Rossum <guido@python.org>"
#... | {
"content_hash": "885bc9710ac7f9d45cbc880336c7553a",
"timestamp": "",
"source": "github",
"line_count": 744,
"max_line_length": 81,
"avg_line_length": 37.53629032258065,
"alnum_prop": 0.5429870734414725,
"repo_name": "wdv4758h/ZipPy",
"id": "7cd034a269588ca890e3a8d31d01edd3011a51c3",
"size": "28028... |
import json
from src.myexceptions import UserNotFoundException
class User():
""" SiteImage user model """
def __init__(self, username, html_page):
self.username = username
self._data = self._extract_data_from_html(html_page)
self._images = self._get_images(self._data)
self._... | {
"content_hash": "a220cbb5905be688807d5d22eea08128",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 30.028169014084508,
"alnum_prop": 0.5712945590994372,
"repo_name": "delete/spymanager",
"id": "d848d9816e2a2789a2d17e13e5c07180c7e4446c",
"size": "21... |
from .base import Atom
from .expr import Expression
class Symbol(Atom):
""" Represents an algebraic constant.
An atomic algebraic component that can be used in expressions alongside numbers and other symbols.
Attributes:
name: A string identifier that is unique
"""
def __in... | {
"content_hash": "11f271c681c1a03c47902909e2ed04ed",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 102,
"avg_line_length": 22.79090909090909,
"alnum_prop": 0.5341045073793379,
"repo_name": "robalar/A2_Project",
"id": "f929cfc9dfcba4c11dfdb15005f057a7e7762be4",
"size": "... |
import os
from django.core.urlresolvers import reverse_lazy
try:
import otp_yubikey
except ImportError:
otp_yubikey = None
BASE_DIR = os.path.dirname(__file__)
SECRET_KEY = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.co... | {
"content_hash": "a64558a50a5ca7e32145cbdfdbbc9e9b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 67,
"avg_line_length": 23.421875,
"alnum_prop": 0.694462975316878,
"repo_name": "moreati/django-two-factor-auth",
"id": "63d65e29e78b396d626ac38ff0d7928d14677c3a",
"size": ... |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('image', parent_package, top_path)
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**configuration(... | {
"content_hash": "e7a81dc0ba190e5bd8de27180e172d65",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 61,
"avg_line_length": 31.181818181818183,
"alnum_prop": 0.6880466472303207,
"repo_name": "yarikoptic/NiPy-OLD",
"id": "5aad19b316495d6287c04772485834b690d9158b",
"size": "... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.utils import today, cint, global_date_format, get_fullname, strip_html_tags, markdown
from frappe.website.utils import find_... | {
"content_hash": "2bb7db623102db78c88b3184bb6244ce",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 116,
"avg_line_length": 32.403225806451616,
"alnum_prop": 0.6983573917371827,
"repo_name": "drukhil/frappe",
"id": "189c24f05eef14fc484fba66cc1879cdfb422af9",
"size": "612... |
import collections
import contextlib
import mock
from oslo_config import cfg
import oslo_messaging
from testtools import matchers
import webob.exc
from neutron.agent import firewall as firewall_base
from neutron.agent.linux import iptables_manager
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.ap... | {
"content_hash": "efc7ac9598e473ff8fdf0bc936be6770",
"timestamp": "",
"source": "github",
"line_count": 3224,
"max_line_length": 79,
"avg_line_length": 45.68114143920595,
"alnum_prop": 0.5584616638148782,
"repo_name": "dims/neutron",
"id": "dd5a5607c1ac033e2b0da55e4f89c761182ddc98",
"size": "147918... |
"""
homeassistant.components.device_sun_light_trigger
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to turn on lights based on
the state of the sun and devices.
"""
import logging
from datetime import timedelta
import homeassistant.util.dt as dt_util
from homeassistant.const import STATE_HO... | {
"content_hash": "73f3925cfc8356083ee61fdf8444a1f1",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 78,
"avg_line_length": 36.63905325443787,
"alnum_prop": 0.5952842377260982,
"repo_name": "sanmiguel/home-assistant",
"id": "c53fff0e4f3909923398ae77ed9416651c93000c",
"siz... |
import math
import numpy as np
from enum import IntEnum, unique
from typing import List, Tuple, Union
import torch
from torch import device
_RawBoxType = Union[List[float], Tuple[float, ...], torch.Tensor, np.ndarray]
@unique
class BoxMode(IntEnum):
"""
Enum of different ways to represent a box.
"""
... | {
"content_hash": "36c2586009d8c092d36fab898db554ee",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 97,
"avg_line_length": 33.910377358490564,
"alnum_prop": 0.5552928084573654,
"repo_name": "facebookresearch/detectron2",
"id": "fd396f68645db1d6946056eed868ffcc02cd7a22",
... |
from unittest import TestCase
from asserts import assert_equal
from htmlgen.link import Link
class LinkTest(TestCase):
def test_simple(self):
link = Link("foo")
assert_equal([b'<a href="foo">', b"</a>"], list(iter(link)))
def test_caption_argument(self):
link = Link("foo", "initial"... | {
"content_hash": "780014aba99fae143740e8d2a940aba9",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 77,
"avg_line_length": 27.980392156862745,
"alnum_prop": 0.4863349684653118,
"repo_name": "srittau/python-htmlgen",
"id": "f515f56c9a26fdafd885493e9229d87ece315ed3",
"size"... |
import sys, time, os
# todo: see if VIRTUAL_ENV variable is in the paths
# and if it is not, add to os.path - this is necessary when sphinx is
# installed only in the sitewide packages directory
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. I... | {
"content_hash": "11aff6df86fdadab2f1fe797cf327d29",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 119,
"avg_line_length": 33.54205607476636,
"alnum_prop": 0.7085539147394817,
"repo_name": "noisy/steemprojects.com",
"id": "85b36f3b8ca66f0b60507c66bfa93e9e60fc250b",
"siz... |
import sys
import os
import oop_maya.core
def get_paths():
return sys.path
def add_paths( paths ):
added_paths = []
for path in paths:
if path in sys.path:
oop_maya.core.warning( "{0} already exists!".format( path ) )
else:
if os.path.exists( path ):
... | {
"content_hash": "ce9fcf9ce53b4b959ad6ed3c5d29522d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 70,
"avg_line_length": 20.457142857142856,
"alnum_prop": 0.5432960893854749,
"repo_name": "nicholas-silveira/art_pipeline",
"id": "f8ff9552a871171eab102d29aecefe3a42a196ea",
... |
import mock
import six
from heat.common import exception
from heat.common import template_format
from heat.engine.resources.openstack.barbican import secret
from heat.engine import rsrc_defn
from heat.engine import scheduler
from heat.tests import common
from heat.tests import utils
stack_template = '''
heat_template... | {
"content_hash": "d4a7b152a1e548f3407e55387b18d6d3",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 78,
"avg_line_length": 37.24324324324324,
"alnum_prop": 0.6188316400580551,
"repo_name": "rh-s/heat",
"id": "4f172714436e4f0cb6ad1b2ee1d71c14702bdf46",
"size": "6087",
"... |
from common.attacks.hash.preimage import SecondPreimageAttack
from common.challenge import MatasanoChallenge
from common.hash.tools.build import BasicHashFunctionFactory
class Set7Challenge53(MatasanoChallenge):
K = 5
BLOCK = 'LTA!'*16
MESSAGE = BLOCK*(K + 1 + 2**K)
def __init__(self):
... | {
"content_hash": "5ddc795ba0451be533e9ff9b6a6b4027",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 37.25,
"alnum_prop": 0.6279961649089166,
"repo_name": "lukius/mts",
"id": "c9cbfb89bd6294364343f06de37209376f139128",
"size": "1043",
"binary": fal... |
# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
import string
t = BoostBuild.Tester()
t.write("jamroot.jam", """\
lib main : main.cpp l ;
lib l : l.cpp main ;
... | {
"content_hash": "17a209c469e22d02bcfbd4feddcdc1b6",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 81,
"avg_line_length": 23.608695652173914,
"alnum_prop": 0.6500920810313076,
"repo_name": "ycsoft/FatCat-Server",
"id": "e8c79a9e850a871303a8108e395a3fe7c9577404",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.