text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import subprocess
from logging import getLogger
local_logger = getLogger(__name__)
def doc_to_xml(filename, logger=None):
if not logger:
logger = local_logger
cmd = 'antiword -x db ' + filename + ' > ' + filename + '.awdb.xml'
logger.debug('Generated antiword command %s' % cmd)
outp... | {
"content_hash": "cdeee241817d8792905d57e19503df77",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 31.55,
"alnum_prop": 0.6481774960380349,
"repo_name": "alonisser/Open-Knesset",
"id": "822ff78b3f19c6c08c8c6f91f8849f17254d313c",
"size": "631",
"b... |
"""Pylons extension to simplify using couchdbkit with pylons. This features the
following:
* Simple configuration
* Authentication
* View synchronization
* Testing
Configuration
-------------
Add this to your ini file:
couchdb.uri = http://localhost:5984
couchdb.dbname = mydbname
cookies.secret = randomuniquestri... | {
"content_hash": "d9f104a0f7151625ae75ced61063afb4",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 84,
"avg_line_length": 27.4,
"alnum_prop": 0.7252039501932159,
"repo_name": "adamlofts/couchdb-requests",
"id": "11e860ec7eb118f4dacd40bd0ebd5858b62cce85",
"size": "2466",
... |
from west import log
log.load_config()
import logging
logger = logging.getLogger(__name__)
import requests
from requests.auth import HTTPBasicAuth
BEAKER_KEY = "beaker.session.id"
DOMAIN = "http://localhost:8080"
session_id = None
# basic use case
for uri, params, use_auth in [
("/ping", None, False),
("/p... | {
"content_hash": "f82900a6da79de6432446ac73ce75e79",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 71,
"avg_line_length": 30.367346938775512,
"alnum_prop": 0.5759408602150538,
"repo_name": "toopy/west",
"id": "75bc0508c9683023cdb53f438cb2e6b6b8eb9e17",
"size": "1510",
... |
"""Imports a filtered subset of the scores and configurations computed
by apm_quality_assessment.py into a pandas data frame.
"""
import argparse
import glob
import logging
import os
import re
import sys
try:
import pandas as pd
except ImportError:
logging.critical('Cannot import the third-party Python package pa... | {
"content_hash": "9971a59fa9a2ede9fcbf8dea0618b654",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 80,
"avg_line_length": 31.85042735042735,
"alnum_prop": 0.6295451496041863,
"repo_name": "koobonil/Boss2D",
"id": "fc1f44bcf888808d4eec5ee5f70318cd72565ecc",
"size": "7847... |
'''
Tesselate Demonstration
=======================
This demonstrates the experimental library for tesselating polygons. You
should see a hollow square with some buttons below it. You can click and
drag to create additional shapes, watching the number of vertices and elements
at the top of the screen. The 'debug' butt... | {
"content_hash": "a376437bc59d108e107f1f17a2e0c7e8",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 30.17808219178082,
"alnum_prop": 0.5297321833862915,
"repo_name": "akshayaurora/kivy",
"id": "3fb5a4c2c576115a12599175514d1e76ba29174b",
"size": "44... |
"""
NURBS Python Package
Licensed under MIT License
Developed by Onur Rauf Bingol (c) 2016-2017
"""
import sys
import itertools
import nurbs.utilities as utils
class Surface(object):
def __init__(self):
self._mDegreeU = 0
self._mDegreeV = 0
self._mKnotVectorU = []
self... | {
"content_hash": "7e0bfc6d8178912ed7559cd2bdb0a371",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 120,
"avg_line_length": 40.353053435114504,
"alnum_prop": 0.5433435800425632,
"repo_name": "jedufour/NURBS-Python",
"id": "cba91269fa86a0e10916c242306940e812257e85",
"size... |
from django.shortcuts import render, redirect
from django.contrib import messages
from django.urls import reverse
from django.template import RequestContext
from django.apps import apps
import hmac, base64, hashlib, binascii, os
import shopify
def _new_session(shop_url):
api_version = apps.get_app_config('shopify_... | {
"content_hash": "286029ec6c9dc54d61c76a879b6f6047",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 95,
"avg_line_length": 39.94285714285714,
"alnum_prop": 0.6795422031473534,
"repo_name": "Shopify/shopify_django_app",
"id": "d2999c4313654ecc6aadac2cd2bf66681044e262",
"si... |
"""
Tests for the module that encompasses second species counterpoint.
"""
import unittest
from foox.species.second import (
Genome,
create_population,
is_parallel,
make_fitness_function,
make_generate_function,
make_halt_function,
MAX_REWARD,
REWARD_STEPWISE_MOTION,
)
# The cantus fir... | {
"content_hash": "c8cbad43f24422ca4c7a3b3c0977ec0f",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 79,
"avg_line_length": 33.24120603015076,
"alnum_prop": 0.600151171579743,
"repo_name": "ntoll/foox",
"id": "ebe4b1ef3e50d8cfadc840a0f3f0dae221ee7783",
"size": "6615",
"... |
from django.contrib import admin
from django.conf import settings
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from purefap.core.models import FTPClient, FTPUser, FTPStaff
from purefap.core.forms import *
class FTPUserAdmin(UserAdmin):
form = FTPUserChangeForm
add... | {
"content_hash": "2a21126e31d6492c398564b3da964bc3",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 131,
"avg_line_length": 36.298507462686565,
"alnum_prop": 0.5361842105263158,
"repo_name": "fim/purefap",
"id": "911ff80cda7e1ef4cad7591b1373b4199fd6ef57",
"size": "2432",
... |
""" losses for training neural networks """
from __future__ import absolute_import
__all__ = ['Loss', 'L2Loss', 'L1Loss',
'SigmoidBinaryCrossEntropyLoss', 'SigmoidBCELoss',
'SoftmaxCrossEntropyLoss', 'SoftmaxCELoss',
'KLDivLoss', 'CTCLoss', 'HuberLoss', 'HingeLoss',
'SquaredH... | {
"content_hash": "e2440ec6d7305cae41d3b573534805ba",
"timestamp": "",
"source": "github",
"line_count": 689,
"max_line_length": 100,
"avg_line_length": 38.426705370101594,
"alnum_prop": 0.6105151835624717,
"repo_name": "jiajiechen/mxnet",
"id": "2be43981a64c4716b498bc32fb5475383233515b",
"size": "2... |
from djangox.test.depth import alltests
def suite():
return alltests(__file__, __name__)
| {
"content_hash": "59aa73cab038432614a809adbf859eae",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 19,
"alnum_prop": 0.6736842105263158,
"repo_name": "ask/ghettoq",
"id": "97abbfe014f54d12a7ad47abd906628b1dabb21e",
"size": "95",
"binary": false,
... |
from os_win import constants
from os_win import exceptions as os_win_exc
from os_win import utilsfactory
from oslo_log import log as logging
import nova.conf
from nova import utils
from nova.virt import event as virtevent
from nova.virt.hyperv import serialconsoleops
LOG = logging.getLogger(__name__)
CONF = nova.con... | {
"content_hash": "b2a4a5f5c1fd280ba78252a04776d1a3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 78,
"avg_line_length": 41.55555555555556,
"alnum_prop": 0.6464646464646465,
"repo_name": "gooddata/openstack-nova",
"id": "e958717bb80d6e585c477f66f9c4a90108a0c4e7",
"size"... |
__author__ = 'jcastro'
class Player(object):
def __init__(self):
self.nick = None
self.name = None
self.team = None
self.number = None
self.games = {}
def add_game(self, game, split):
if game not in self.games:
team = split[3]
position =... | {
"content_hash": "0365b902689df3ef166f2d98dfe94766",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 83,
"avg_line_length": 25.95,
"alnum_prop": 0.4932562620423892,
"repo_name": "jcastrojob/kata_tucan",
"id": "043dfe4c2bca735af7ad1fdeecfe2e5585fbf4d1",
"size": "519",
"bi... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SiteSettings',
fields=[
('id', models.AutoField(aut... | {
"content_hash": "2548a76588ce2aa66a0be45bf43c750e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 224,
"avg_line_length": 34,
"alnum_prop": 0.5842245989304813,
"repo_name": "TexasLAN/texaslan.org",
"id": "45c660acc301b3e437cfaf851712a7032020be85",
"size": "819",
"bina... |
"""Utilities for the API to configure cross-project networking (XPN)."""
from googlecloudsdk.api_lib.compute import client_adapter
from googlecloudsdk.api_lib.compute import utils
from googlecloudsdk.core import exceptions
# TODO(user): update it when a new XPN API version is released.
_DEFAULT_API_VERSION = 'alpha'
... | {
"content_hash": "a57ee265238b5ab50e2834e7360e89b4",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 79,
"avg_line_length": 40.625698324022345,
"alnum_prop": 0.7033828382838284,
"repo_name": "Sorsly/subtle",
"id": "0bfc33ac03b21b2e93bd541c8715e7d9de530ad6",
"size": "7867"... |
import os
import time
import numpy as np
import tensorflow as tf
from eight_mile.progress import create_progress_bar
from eight_mile.bleu import bleu
from baseline.utils import (
convert_seq2seq_golds,
convert_seq2seq_preds,
)
from baseline.train import Trainer, register_trainer
from baseline.tf.tfy import TR... | {
"content_hash": "f6013942378bdfd740071542b22cefa0",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 119,
"avg_line_length": 34.56363636363636,
"alnum_prop": 0.6754339821146765,
"repo_name": "dpressel/baseline",
"id": "eec40f5356b74be6352e7046fa8dbae9704ec70a",
"size": "19... |
from collections import defaultdict
from lampost.di.resource import Injected, module_inject
from lampost.db.dbo import DBOField, ParentDBO, ChildDBO, CoreDBO
log = Injected('log')
db = Injected('datastore')
module_inject(__name__)
def create(config_id, raw_configs, set_defaults=False):
sections = {}
all_val... | {
"content_hash": "f116f9c0fd52dc59548332d8ab382a00",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 119,
"avg_line_length": 34.46,
"alnum_prop": 0.587347649448636,
"repo_name": "genzgd/lampost_lib",
"id": "a9ce7fc208c850f043c784fe79bb0e4048069c69",
"size": "3446",
"bin... |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
| {
"content_hash": "f791d277a48deba47893862a915879a4",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 39,
"avg_line_length": 29,
"alnum_prop": 0.8103448275862069,
"repo_name": "cdagli/flask-api-starter",
"id": "1dc6828f1e96a904d0ff318e3b6d84d033724248",
"size": "101",
"bin... |
"""Tests of the Analyzer CLI Backend."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import tempfile
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.core.protobuf import config_pb2
from... | {
"content_hash": "97d9752d08ab31d843457a09a60763f5",
"timestamp": "",
"source": "github",
"line_count": 1055,
"max_line_length": 80,
"avg_line_length": 36.32037914691943,
"alnum_prop": 0.598074012213581,
"repo_name": "AndreasMadsen/tensorflow",
"id": "7d409aeccad445c6e91fac1ca01c8ef5fe9c4915",
"siz... |
from django.http import HttpRequest
from django.utils.datastructures import MultiValueDict
from django.http.request import QueryDict
from django.conf import settings
def encode_request(request):
"""
Encodes a request to JSON-compatible datastructures
"""
# TODO: More stuff
value = {
"get":... | {
"content_hash": "a1658912699a3dd851d2dc40a6020996",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 84,
"avg_line_length": 29.06382978723404,
"alnum_prop": 0.6493411420204978,
"repo_name": "octaflop/channels",
"id": "1c975ef4f99a2b728e8a2e43d1cc1e2d8a716266",
"size": "136... |
import tornado.web
from sandstone.lib.db import sandstone_db
class DBHandler(tornado.web.RequestHandler):
def prepare(self):
self.db = sandstone_db
self.db.connect()
return super(DBHandler, self).prepare()
def on_finish(self):
if not self.db.is_closed():
self.db.c... | {
"content_hash": "ceaae0193dc728c1e441aa0c68128725",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 49,
"avg_line_length": 25.133333333333333,
"alnum_prop": 0.6392572944297082,
"repo_name": "SandstoneHPC/OIDE",
"id": "26bd3360ebb77bb2233de62e163e0ae8dcfd78ae",
"size": "37... |
from sqlalchemy import MetaData
tables = ['image_locations']
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
if migrate_engine.name == "mysql":
d = migrate_engine.execute("SHOW TABLE STATUS WHERE Engine!='InnoDB';")
for row in d.fetchall():
table_name... | {
"content_hash": "37c52f85543fac0388e8ada9071597b5",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 28,
"alnum_prop": 0.5845864661654135,
"repo_name": "rickerc/glance_audit",
"id": "7d341251ea3cc12f205598f6c3eb127afe2dd117",
"size": "1240",
"binar... |
import random
max_num = 1e6
def gen_test(n = 1000, max_num = max_num):
# Generate a list of n items randomly, each number is within +/- of max_num
n = int(n)
data = [random.randint(-max_num, max_num) for i in range(n)]
return data
def verify_sort(data):
# Verify that the data is sorted ascendingl... | {
"content_hash": "ff12b8c43124ce9257b2bfc2ac39e7d7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 79,
"avg_line_length": 25.764705882352942,
"alnum_prop": 0.6095890410958904,
"repo_name": "JasonVann/CLRS",
"id": "f5b3c769383d90428d4e30bc9fb2bb18fff3fe11",
"size": "438",... |
"""
Code used for both Travis and local (deploy and configure)
"""
# Color guide
#
# - red: Error and warning messages
# - green: Welcome messages (use sparingly)
# - yellow: warning message (only use on Travis)
# - blue: Default values
# - bold_magenta: Action items
# - bold_black: Parts of code to be run or copied t... | {
"content_hash": "aaab1cd4d014330a58a6e1588de859d6",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 95,
"avg_line_length": 24,
"alnum_prop": 0.6702898550724637,
"repo_name": "drdoctr/doctr",
"id": "f5736c141df09c6295ed0e5c539d0aa98889ddbb",
"size": "1104",
"binary": fal... |
from gluon import *
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
# =============================================================================
class S3MainMenu(default.S3MainMenu):
""" Custom Application Main Menu """
# -----... | {
"content_hash": "970d4b561f239d32330f054952f1c8a8",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 88,
"avg_line_length": 38.728205128205126,
"alnum_prop": 0.375926906779661,
"repo_name": "anurag-ks/eden",
"id": "721c948026084afea6576ff1d7d708ddc5bbb91b",
"size": "7577"... |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | {
"content_hash": "55353c2fc3ce65ec506a567befeb5dd6",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 115,
"avg_line_length": 34.107142857142854,
"alnum_prop": 0.6832460732984293,
"repo_name": "xuegang/gpdb",
"id": "c965940e7d35c4a1236e07237151d16c2fbf2611",
"size": "1910",... |
import importlib
import sys
import warnings
from inspect import isabstract
from unittest import mock
import pytest
from airflow.models.baseoperator import BaseOperator
from tests.deprecated_classes import ALL, RENAMED_ALL
class TestDeprecations:
@staticmethod
def assert_warning(msg: str, warnings):
... | {
"content_hash": "65518499d842d1d9df6a47003682c9e2",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 103,
"avg_line_length": 42.613207547169814,
"alnum_prop": 0.6096967013504538,
"repo_name": "lyft/incubator-airflow",
"id": "d2dbc220b98646d812cc935400bcb2f4fd033a2d",
"siz... |
"""
WSGI config for counselling_site project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | {
"content_hash": "ee7d00c2bedb69b27d6e8188bd3e2a10",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.5625,
"alnum_prop": 0.7750611246943765,
"repo_name": "oinopion/cardiff-wellbeeing",
"id": "87b4604f120ab1a04734f4d064d1cef1d8cc2a3d",
"size": "409... |
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class K8sIoApiCoreV1ObjectField... | {
"content_hash": "078f3cf025060f3cd543b1cdf864c210",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 87,
"avg_line_length": 28.282894736842106,
"alnum_prop": 0.5666434054431263,
"repo_name": "kubevirt/client-python",
"id": "28e174bcc9020dddb186ac07fda12a0aa35d7e6a",
"size... |
__version__ = "2.7.1"
import codecs
import sys
import os
import csv
import urllib.request, urllib.error, urllib.parse
import shutil
import glob
import tempfile
import platform
try:
import hashlib
sha256 = hashlib.sha256
except ImportError: # Python < 2.5
# FIXME this is totally broken bec. I don't want t... | {
"content_hash": "fe13edc5bad96dad0ef2235393d3dadf",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 135,
"avg_line_length": 31.3,
"alnum_prop": 0.5970181043663472,
"repo_name": "skytreader/virtualenv-burrito",
"id": "629388cfd8fd4f1a062d0ed547188a71b329f4b5",
"size": "95... |
"""The volumes snapshots api."""
from oslo_log import log as logging
from oslo_utils import encodeutils
from oslo_utils import strutils
import webob
from webob import exc
from cinder.api import common
from cinder.api.openstack import wsgi
from cinder.api.views import snapshots as snapshot_views
from cinder import exc... | {
"content_hash": "5f33776179214e0296dd0741e1f4c332",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 79,
"avg_line_length": 35.405,
"alnum_prop": 0.5781669255754837,
"repo_name": "cloudbase/cinder",
"id": "b5ed4a27c69150dc027a1ccd7737ea1d9e3b78f3",
"size": "7717",
"bina... |
"Messages used to internally control thesplog settings."
from thespian.actors import ActorSystemMessage
class SetLogging(ActorSystemMessage):
def __init__(self, threshold, useLogging, useFile):
self.threshold = threshold
self.useLogging = useLogging
self.useFile = useFile
| {
"content_hash": "e84325f9362aee1d298a46bf3ebf786b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 56,
"avg_line_length": 30.8,
"alnum_prop": 0.724025974025974,
"repo_name": "godaddy/Thespian",
"id": "7f0792f4fb018355123edf8f009bb3d29b83a8cd",
"size": "308",
"binary": ... |
from sqlalchemy import create_engine, func
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Sequence
from sqlalchemy import Column
from sqlalchemy import BigInteger, Integer, SmallInteger
from sqlalchemy import DateTime, Float, String, Unicode
from datetime import datetime
from mabolab.database.db... | {
"content_hash": "b50a16b06eb9e36777372b46f2cdd809",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 327,
"avg_line_length": 44.97872340425532,
"alnum_prop": 0.6017029328287606,
"repo_name": "mabotech/maboss.py",
"id": "461f6479abf78c770987f5a614f1115c765dabbb",
"size": "2... |
from __future__ import unicode_literals
import datetime
import os
import re
import sys
import types
from django.conf import settings
from django.http import (HttpResponse, HttpResponseServerError,
HttpResponseNotFound, HttpRequest, build_request_repr)
from django.template import Template, Context, TemplateDoesNot... | {
"content_hash": "3aea1ca2df07c73ad71b5d3a20840758",
"timestamp": "",
"source": "github",
"line_count": 1168,
"max_line_length": 251,
"avg_line_length": 37.97517123287671,
"alnum_prop": 0.5795964378311351,
"repo_name": "errx/django",
"id": "c1acd8191ca4e77d8068bf0a04071d858c6acb94",
"size": "44355"... |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.brain import BrainFileConfiguration
class WeathersTestsClient(TestClient):
def __init__(self):
TestClient.__init__(self, debug=True)
def load_configuration(self, arguments):
super(WeathersTestsClient,... | {
"content_hash": "24b9adbd283229d048377c4b1066a23f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 165,
"avg_line_length": 41.416666666666664,
"alnum_prop": 0.6928236083165661,
"repo_name": "CHT5/program-y",
"id": "4f6bc6b3aeadae92bcfd75dd9517e9f17ebfe4fb",
"size": "1491... |
import logging
import struct
from teuthology.exceptions import CommandFailedError
from teuthology.orchestra import run
log = logging.getLogger(__name__)
class DaemonState(object):
"""
Daemon State. A daemon exists for each instance of each role.
"""
def __init__(self, remote, role, id_, *command_ar... | {
"content_hash": "dc29fc59170b3ea388ecf89815e7ce21",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 78,
"avg_line_length": 31.608187134502923,
"alnum_prop": 0.5715078630897318,
"repo_name": "dmick/teuthology",
"id": "3a6a17213d0c70dac390ba9d483c0a346af90300",
"size": "54... |
"""Generates test runner factory and tests for GTests."""
# pylint: disable=W0212
import fnmatch
import glob
import logging
import os
import shutil
import sys
from pylib import cmd_helper
from pylib import constants
from pylib.base import base_test_result
from pylib.base import test_dispatcher
from pylib.gtest impor... | {
"content_hash": "3ee766ebc7d1b8dbf91e9277c63fd577",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 80,
"avg_line_length": 35.8448275862069,
"alnum_prop": 0.6805355138688473,
"repo_name": "AndroidOpenDevelopment/android_external_chromium_org",
"id": "e89846e3b1d46b60a7e093... |
from insulaudit import core
from insulaudit.data import glucose
from insulaudit.console import device
import proto
class OnetouchApp(device.LinkCommand):
"""Onetouch compatible lifescan devices.
"""
name = 'onetouch'
def link_factory(self):
return proto.Link
#return proto.Linonetouch2.OneTouchUltra2(... | {
"content_hash": "f1041b035a3c642e4c5bc801c577202e",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 71,
"avg_line_length": 28,
"alnum_prop": 0.6761583011583011,
"repo_name": "bewest/insulaudit",
"id": "6a44d2033652c488e504dfe76e48dae4cde68e63",
"size": "2073",
"binary":... |
"""Tests for lead_sheet_pipelines."""
from absl.testing import absltest
from magenta.common import testing_lib as common_testing_lib
from magenta.pipelines import chord_pipelines
from magenta.pipelines import lead_sheet_pipelines
from magenta.pipelines import melody_pipelines
from note_seq import chords_lib
from note_... | {
"content_hash": "5c3a677e2429d445042a8880b6d0b0a3",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 43.714285714285715,
"alnum_prop": 0.6401143790849673,
"repo_name": "magenta/magenta",
"id": "a11a83984d11797149e9613cae3f90436c827ca9",
"size": "792... |
import fixtures
import logging
import mock
import os
import subprocess
import diskimage_builder.block_device.tests.test_base as tb
from diskimage_builder.block_device.level0.localloop import image_create
from diskimage_builder.block_device.level1.mbr import MBR
logger = logging.getLogger(__name__)
class TestMBR(t... | {
"content_hash": "3309703f18334f0e2c3996771040322b",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 79,
"avg_line_length": 37.58641975308642,
"alnum_prop": 0.594843159796354,
"repo_name": "openstack/diskimage-builder",
"id": "0645ee51560cece8971ce6727e4ce2a0c0291ea3",
"s... |
# NEEDS FIXING
# -*- coding: utf-8 -*-
'''
Covenant Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version... | {
"content_hash": "e2dcb8b209cf92fb3a40b59456c59815",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 119,
"avg_line_length": 41.15830115830116,
"alnum_prop": 0.4841463414634146,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "67ec76632a772a94e65531d31fe1c4652dab9fc1",
... |
import unittest
import random, sys, time, re
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
# ... | {
"content_hash": "6bf87ae2863b300564ac03e0c2b30ba3",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 156,
"avg_line_length": 50.86184210526316,
"alnum_prop": 0.5441728107618679,
"repo_name": "eg-zhang/h2o-2",
"id": "5b6588e35e343b04083ad1a14a5c145b6d0f2737",
"size": "7731... |
'''
Runs the set of rules defined in provided config YAML file.
'''
from __future__ import print_function
import argparse
import os
import yaml
import json
import re
import math
from . import mlp_parser
def is_integer(value):
return abs(round(value) - value) < 0.00001
class CCError(Exception):
pass
de... | {
"content_hash": "bfbac87f87f8dd5e8192174358ea5817",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 119,
"avg_line_length": 33.626168224299064,
"alnum_prop": 0.5240874559940708,
"repo_name": "mlperf/training_results_v0.7",
"id": "b57fa4a4e5f9ab5fc127db395758d1dc6dc6f679",
... |
import boto3
def get_public_api_base(event):
# https://forums.aws.amazon.com/thread.jspa?threadID=241370
host_header_value = event["request-params"]["header"]["Host"]
if host_header_value.endswith(".amazonaws.com"):
# Assume this is the default deployment URL.
return "https:/... | {
"content_hash": "c7a5c7e3a739e94f4c4b2b90b7e4b943",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 112,
"avg_line_length": 34.97727272727273,
"alnum_prop": 0.5964912280701754,
"repo_name": "moduspwnens/boa-chat",
"id": "54e6cb5ea96b6c6bea759fcc7e0c4e1d8d52fe36",
"size": ... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.WGL import _types as _cs
# End users want this...
from OpenGL.raw.WGL._types import *
from OpenGL.raw.WGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | {
"content_hash": "d4429de7b57cb9b49dbe148a8e9d1946",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 119,
"avg_line_length": 39.13333333333333,
"alnum_prop": 0.7597955706984668,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "8493ac5a6903d897636ae27361c0567fc298aac3",
... |
import re
class Unit:
"""Implementation of SVG units and conversions between them.
Parameters
----------
measure : str
value with unit (for example, '2cm')
"""
per_inch = {"px": 90, "cm": 2.54, "mm": 25.4, "pt": 72.0}
def __init__(self, measure):
try:
self.va... | {
"content_hash": "6ed8729c18c3d7a70574b28380a1f19c",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 77,
"avg_line_length": 24.16949152542373,
"alnum_prop": 0.4845722300140252,
"repo_name": "btel/svg_utils",
"id": "9928d7277b4e5d8d8b435450a5e34fb7788f990a",
"size": "1426",... |
from ctypes.wintypes import *
from ctypes import *
import logging
log = logging.getLogger(__name__)
CreateFileW = windll.kernel32.CreateFileW
CreateFileW.argtypes = (LPCWSTR, DWORD, DWORD, c_void_p, DWORD, DWORD, HANDLE)
CreateFileW.restype = HANDLE
ReadFile = windll.kernel32.ReadFile
ReadFile.argtypes = (HANDLE, c... | {
"content_hash": "3acb20c964abed1f12998edcaaee01ed",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 110,
"avg_line_length": 27.935185185185187,
"alnum_prop": 0.5896586012595293,
"repo_name": "pannal/Subliminal.bundle",
"id": "7bce197c241c6aff25bf457ed823eaf322e43bf7",
"s... |
from .. import Load, DirFromEnv, Nminus1Cut
newRatioComparer = Load('RatioComparison')
plotter = newRatioComparer()
def SetupFromEnv(aPlotter=plotter):
"""A function that sets up a plotter after sourcing a config file.
@param aPlotter is the plotter to setup. Defaults to plotter in this module.
... | {
"content_hash": "95ea43358dadaac1873544f9d2eb951f",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 116,
"avg_line_length": 38.716981132075475,
"alnum_prop": 0.6681286549707602,
"repo_name": "dabercro/CrombieTools",
"id": "06f5398904eec0ac31d68842ab1b0d786620c561",
"size"... |
import random
import re
from AISuite.game import Game as Game
import AISuite.player as player
from AISuite.alphabeta import UPPER_BOUND, LOWER_BOUND, shallowest_first
class Pig(Game):
def __init__(self, player1, player2, be_quiet = False, show_game = False):
super(self.__class__, self).__init__(player1, player2, be... | {
"content_hash": "1ff1f0209787be65db6bed181844e8ae",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 107,
"avg_line_length": 26.818897637795274,
"alnum_prop": 0.6250733998825602,
"repo_name": "blamedcloud/PythonGames",
"id": "0243644f2699e226aa5411416b059d97d75fba2a",
"si... |
from urllib import urlopen
doc = urlopen("http://www.python.org").read()
print doc
| {
"content_hash": "b2ae6f54e5761d959269cb8e0a068745",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 21,
"alnum_prop": 0.7261904761904762,
"repo_name": "ActiveState/code",
"id": "45ebfb353bb59d0edf9dc578f6a651c479e9932c",
"size": "84",
"binary": fal... |
"""Tests for the `FilterFusion` optimization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.python.data.experimental.ops import optimization
from tensorflow.python.data.kernel_tests import test_bas... | {
"content_hash": "ccc35f15754e7f9789fad754ff954553",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 74,
"avg_line_length": 35,
"alnum_prop": 0.6701940035273368,
"repo_name": "asimshankar/tensorflow",
"id": "3ce921b5efe9e870fe1c5fb6406736f8bbb9c09f",
"size": "3524",
"bin... |
class PlaybackState:
"""
Enum of playback states.
"""
#: Constant representing the paused state.
PAUSED = "paused"
#: Constant representing the playing state.
PLAYING = "playing"
#: Constant representing the stopped state.
STOPPED = "stopped"
| {
"content_hash": "c1f158d78d10d2c07ba2ee3d07401a3f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 47,
"avg_line_length": 20.214285714285715,
"alnum_prop": 0.6431095406360424,
"repo_name": "kingosticks/mopidy",
"id": "c1046f45d5cc4d2736ba34157be7db26777b7ba1",
"size": "2... |
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
# -- Project information -----------------------------------------------------
project = 'PyRep'
copyright = '2019, Stephen James'
author = 'Stephen James'
# -- General configuration ---------------------------------------------------
# Add any Sp... | {
"content_hash": "02b701d8b9729cd372e13cea1dcf9f29",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 30.2,
"alnum_prop": 0.6258278145695364,
"repo_name": "stepjam/PyRep",
"id": "4cf517f5fd5f80763e1d55a449bfe002ed225119",
"size": "2044",
"binary": f... |
"""
A reader for corpora that contain chunked (and optionally tagged)
documents.
"""
import os.path, codecs
import nltk
from nltk.corpus.reader.bracket_parse import BracketParseCorpusReader
from nltk import compat
from nltk.tree import Tree
from nltk.tokenize import *
from nltk.chunk import tagstr2tree
... | {
"content_hash": "2435c48fbf5e2442bfde379a865d7152",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 98,
"avg_line_length": 42.11219512195122,
"alnum_prop": 0.5687478281014711,
"repo_name": "MyRookie/SentimentAnalyse",
"id": "c13fef842aba0f1108023fc67d42406144961882",
"si... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Order.external_order_id'
db.delete_column('shop_order', 'external_order_id')
# Adding field 'OrderItem.ex... | {
"content_hash": "2fe9c789a928f53759db905e96c3ca71",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 197,
"avg_line_length": 86.60132890365449,
"alnum_prop": 0.5501975678060382,
"repo_name": "jaywink/cartridge-reservable",
"id": "f4c7b82a699c1198bc0a27dfe5e8675066d59ec7",
... |
import os
import json
from pathlib import Path
from .. import mesonlib
from ..mesonlib import MesonException
from . import ExtensionModule
from mesonbuild.modules import ModuleReturnValue
from ..interpreterbase import (
noPosargs, noKwargs, permittedKwargs,
InterpreterObject, InvalidArguments,
FeatureNew
)... | {
"content_hash": "7bb7d55ab6eef7865adbb85d606842fc",
"timestamp": "",
"source": "github",
"line_count": 523,
"max_line_length": 161,
"avg_line_length": 39.170172084130016,
"alnum_prop": 0.5913794786683588,
"repo_name": "thiblahute/meson",
"id": "d9ec56201a15f697df6eee51c4e95f407881e69b",
"size": "2... |
import json
from secret_sauce.action_models import action_train, action_predict
#importing functions for training and predicting the model
import torch.nn as nn
#importing torch
from torch.autograd import Variable
import torch
training_data = []
with open('app/datasets/action_dataset.json') as data_file:
data = j... | {
"content_hash": "26f4302d60aff2c111864c21b45f96dc",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 84,
"avg_line_length": 61.30952380952381,
"alnum_prop": 0.7640129449838188,
"repo_name": "RITct/Rita",
"id": "180994496d88c62b80c9fab84ac3f4ecac51f71f",
"size": "7825",
... |
"""
Copyright 2014 Hans Hoogenboom
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | {
"content_hash": "11f855903cde5b27f8d056f2e0dcdfef",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 107,
"avg_line_length": 32.91503267973856,
"alnum_prop": 0.5381254964257347,
"repo_name": "appleseedhq/houseed",
"id": "381e72c912bc0e3035b56c34a6e9032097c334a6",
"size": ... |
"""Utilities to calculate batch sizes."""
from lingvo.core import cluster_factory
from lingvo.core import py_utils
def scale_infeed_to_global(infeed_batch_size, use_per_host_infeed):
"""Obtains a global batch size from an infeed batch size and cluster configs.
Args:
infeed_batch_size: int: Per-infeed batch ... | {
"content_hash": "d69113a251569f4faf4b8793dbebf600",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 80,
"avg_line_length": 31.86046511627907,
"alnum_prop": 0.6985401459854015,
"repo_name": "tensorflow/lingvo",
"id": "1842e3dd86454d4fb62e639c9f9697b7ad4bb186",
"size": "342... |
import logging
from .. import requests
def get_build_results(conn, project_key=None, expand=''):
params = {
"expand": expand
}
entity = "result/"+project_key if project_key else "result"
res = requests.get_rest_return_json(
conn,
conn.baseurl+'/rest/api/latest/'+entity,
params)
r... | {
"content_hash": "5468a3058059ee9bd9f97a23f1f4ac02",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 22.066666666666666,
"alnum_prop": 0.6404833836858006,
"repo_name": "mhellmic/bamboo-automate",
"id": "b4848e5067c12dc9d3d22ee5d351bf919e3aacad",
"siz... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('myflq', '0012_auto_20141224_1141'),
]
operations = [
migrations.AddField(
model_name='analysisresults',
name='updating',
... | {
"content_hash": "e088b177055208fd0a2cfee0c210b22f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 53,
"avg_line_length": 22.263157894736842,
"alnum_prop": 0.5981087470449172,
"repo_name": "beukueb/myflq",
"id": "b34c4d10c1d63779cc45943466e484ac1f51ec85",
"size": "447",
... |
import boto3
import socket
import zeroconf
import z42
import z42.common
import z42.driver
LOG = z42.LOG.getChild(__name__)
class EC2Driver(z42.driver.Driver):
def __init__(self):
try:
self.region_names = self.fetch_region_names()
LOG.debug('Available region names: %s', self.regi... | {
"content_hash": "eb16c4ce5ea0fbdf4a6909adfd4ff78e",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 120,
"avg_line_length": 34.521126760563384,
"alnum_prop": 0.543859649122807,
"repo_name": "AkihiroSuda/z42",
"id": "414c97c27280282f148eaa3de227178d57800f1a",
"size": "2451... |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | {
"content_hash": "68954421559a7de82b1f3c2fd7e54c0f",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 94,
"avg_line_length": 41.21705426356589,
"alnum_prop": 0.45232273838630804,
"repo_name": "airbnb/streamalert",
"id": "07e8e69becd9b144557e136112a0c28084abb74b",
"size": "... |
from multiprocessing import pool
import tkinter as tk
import config
class TickerWindow:
"""
Template class for a ticker window. All/most of the code here
is "backend" and widgets are not drawn via tk.grid(). This is intended
to be inherited in the GUI classes where objects will be drawn and
functi... | {
"content_hash": "5e5297aac718faa5c40782c787284485",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 102,
"avg_line_length": 39.1578947368421,
"alnum_prop": 0.5388440860215054,
"repo_name": "JevinJ/Bittrex-Notify",
"id": "0147a10990310b288d933278138ecfa14cc0635a",
"size":... |
"""Provide functionality to interact with the vlc telnet interface."""
from __future__ import annotations
from datetime import datetime
from functools import wraps
from typing import Any, Callable, TypeVar, cast
from aiovlc.client import Client
from aiovlc.exceptions import AuthError, CommandError, ConnectError
impor... | {
"content_hash": "6fa522817f87e08eb11dcbee0832e2f2",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 88,
"avg_line_length": 31.286931818181817,
"alnum_prop": 0.6042858440025425,
"repo_name": "aronsky/home-assistant",
"id": "624234ce712c781a0f67842d09a5a35ee208a02e",
"size... |
__author__ = """Ubirajara Cruz"""
__email__ = 'xvzfbira@yahoo.com.br'
__version__ = '0.1.0'
import numpy as np
from osgeo import gdal
from scipy import interpolate | {
"content_hash": "2451e47027ae2aeefa075a725fcac7a1",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 35,
"avg_line_length": 20.625,
"alnum_prop": 0.6787878787878788,
"repo_name": "biracruz/rasterrgb",
"id": "913994cdf138b13942c54f464df10139094c917f",
"size": "190",
"binar... |
from couchdbkit import ResourceNotFound
from crispy_forms.bootstrap import StrictButton, InlineField, FormActions, FieldWithButtons
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field, HTML, Div, Fieldset
from django.utils.safestring import mark_safe
from dj... | {
"content_hash": "0165b72d7eb30d86b28e8d67bfe8f667",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 99,
"avg_line_length": 35.4375,
"alnum_prop": 0.5911228689006467,
"repo_name": "SEL-Columbia/commcare-hq",
"id": "43c3fee70103c168fb08f32a521e07852bc13cc9",
"size": "3402",... |
from tensorflow.python.ops.rnn_cell import _linear
from tensorflow.python.util import nest
import tensorflow as tf
from my.tensorflow import flatten, reconstruct, add_wd, exp_mask
def linear(args, output_size, bias, bias_start=0.0, scope=None, squeeze=False, wd=0.0, input_keep_prob=1.0,
is_train=None):
... | {
"content_hash": "5723affc84efdef09b5808838fa62be3",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 150,
"avg_line_length": 43.33519553072626,
"alnum_prop": 0.5946886682996003,
"repo_name": "allenai/bi-att-flow",
"id": "1248dac56e2699d57a05f8928a0fbbd8de3fdcda",
"size": ... |
import os
import math
import subprocess
########################################
f = open("wonkyworld-uniform.church")
ch_model = [l.rstrip() for l in f.readlines()]
f.close()
pfile = open("smoothed_15marbles_priors.txt") # get smoothed priors (kernel density estimates)
priors_15 = [l.rstrip() for l in pfile.readli... | {
"content_hash": "079b09a6f81088f6ac5e95420b2ae5c8",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 363,
"avg_line_length": 59.285714285714285,
"alnum_prop": 0.5921686746987952,
"repo_name": "thegricean/sinking-marbles",
"id": "434301425dcf1e5c2ec157600a46c44e8d6e7ef1",
"... |
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_equal, assert_allclose, assert_raises
from statsmodels.tsa.statespace.tools import (
constrain_stationary_univariate as constrain,
unconstrain_stationary_univariate as unconstrain)
from statsmodels.tsa.arima import specific... | {
"content_hash": "5c242ec10680d2ac7b4ce921d17321d0",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 79,
"avg_line_length": 41.21331058020478,
"alnum_prop": 0.5935157964473521,
"repo_name": "josef-pkt/statsmodels",
"id": "8f8164e15b024d20b2862716f180be35edda602d",
"size":... |
<<<<<<< HEAD
<<<<<<< HEAD
doctests = """
Unpack tuple
>>> t = (1, 2, 3)
>>> a, b, c = t
>>> a == 1 and b == 2 and c == 3
True
Unpack list
>>> l = [4, 5, 6]
>>> a, b, c = l
>>> a == 4 and b == 5 and c == 6
True
Unpack implied tuple
>>> a, b, c = 7, 8, 9
>>> a == 7 and b == 8... | {
"content_hash": "2358939653bb6e86a005b9d859fc18ee",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 79,
"avg_line_length": 20.194444444444443,
"alnum_prop": 0.5279479804926848,
"repo_name": "ArcherSys/ArcherSys",
"id": "abfbbf55885022a1c4134124e9d6e83f8e09fcd5",
"size": ... |
from __future__ import absolute_import
import atexit
import functools
import logging
import os
import re
import shutil
import socket
import sys
import warnings
import fixtures
from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslo_log import log
import oslotest.base as oslotest
from os... | {
"content_hash": "947150caef9bf41dcf8bd2a73f74c5c4",
"timestamp": "",
"source": "github",
"line_count": 646,
"max_line_length": 79,
"avg_line_length": 36.61764705882353,
"alnum_prop": 0.5951807228915663,
"repo_name": "rushiagr/keystone",
"id": "caca7dbdab3fea8c8065a67ec2c4e78b2926da17",
"size": "24... |
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
impo... | {
"content_hash": "413757cf792dfcda513bc666908e9fd5",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 119,
"avg_line_length": 25.342105263157894,
"alnum_prop": 0.7040498442367601,
"repo_name": "mindbody/API-Examples",
"id": "4ab276e64326e4fbd6090e04ad350fe21ed92508",
"size"... |
"""
fizzbuzz_functional_2.py (Python 2.7.5)
A second version of a functional approach.
This one is essentially the same idea
as the first functional code, but with named
rather than anonymous functions.
One addition is a "function generator" (fb_func)
for the fizzbuzz functions, allowing a more
perhaps... | {
"content_hash": "358f32c16d6e9451faca3edb7adb4e51",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 73,
"avg_line_length": 30.82716049382716,
"alnum_prop": 0.6900280336403685,
"repo_name": "CorySpitzer/FizzBuzz",
"id": "ea064c643b7c9f58875d71d4c8cb51efc877151b",
"size": "... |
import json
import logging
import sys
import tempfile
from collections import namedtuple
from multiprocessing import Process, Queue, current_process
from operator import attrgetter
from urllib.parse import urlparse
import click
import click_log
from detectem.core import Detector
from detectem.exceptions import Docker... | {
"content_hash": "97e5a604db0909c275117f2b07002db8",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 118,
"avg_line_length": 30.109375,
"alnum_prop": 0.6105345096004151,
"repo_name": "spectresearch/detectem",
"id": "1245c44f18bde67322910087aa9b1f9d05da880d",
"size": "7708... |
"""Utilities for working with ECS tasks."""
from .. import client as boto3client
def create(profile, cluster, task_definition, started_by=None, count=None):
"""Run a task in a cluster.
Args:
profile
A profile to connect to AWS with.
cluster
The name of the cluster t... | {
"content_hash": "2c3fec25a5d77bdaf5d1a09d5a2b445b",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 75,
"avg_line_length": 21.417391304347827,
"alnum_prop": 0.5789687373122209,
"repo_name": "jtpaasch/armyguys",
"id": "bb3bb714b34da0eec0101183d7049e2053859d1a",
"size": "2... |
from __future__ import absolute_import
import socket
from six.moves.socketserver import ThreadingUnixStreamServer
# from threading import Thread
# import select
# ============= local library imports ==========================
from .messaging_server import MessagingServer
from pychron.messaging.handlers.ipc_handler im... | {
"content_hash": "c656ee0f6e339ebc6a79d5749ef08bab",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 70,
"avg_line_length": 27.647058823529413,
"alnum_prop": 0.5872340425531914,
"repo_name": "NMGRL/pychron",
"id": "81f6346bb17d86bd94f62fbf3a9e2058ee1dbbe8",
"size": "1809",... |
'''
Una tienda hace un descuento del 10% por compras menores de 20,
un 20% por compras entre 20 y 50 y un 25% si la compra es mayor.
Escribe un programa que pida el precio de un producto
y muestre su precio final en las rebajas.
'''
from easygui import *
precio = float(enterbox('Introduce el precio'))
if precio < ... | {
"content_hash": "b9907f6e03a60a92331fa7c84f0f4e74",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 69,
"avg_line_length": 23.11627906976744,
"alnum_prop": 0.6609657947686117,
"repo_name": "txtbits/daw-python",
"id": "0470d35b61ab7a20b9c00a6f47336f241b96ebce",
"size": "10... |
class GetAttr:
eggs = 88 # eggs stored on class, spam on instance
def __init__(self):
self.spam = 77
def __len__(self): # len here, else __getattr__ called with __len__
print('__len__: 42')
return 42
def __getattr__(self, attr): # Provide __str__ i... | {
"content_hash": "cfdef2120447de4c084b552148ce0352",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 81,
"avg_line_length": 37.411764705882355,
"alnum_prop": 0.47746331236897277,
"repo_name": "dreadrel/UWF_2014_spring_COP3990C-2507",
"id": "71fe06b11b75caed2f7bd0bb5c4676bb18... |
'''
Mimics a neopets websession, handles cookies, headers, updating referer
header and human-like pauses.
Part of naps (neopets automation program suite)
'''
import requests
import pickle
import json
import os
import sys
import random
import time
import datetime
import configparser as cp
class NeoSession:
'''L... | {
"content_hash": "5849e378a3e0fb9a418018f9ad8411b4",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 141,
"avg_line_length": 32.46052631578947,
"alnum_prop": 0.5674908796108634,
"repo_name": "jameseh/naps",
"id": "09c561cef554e136f60fadb8c7f51b804174c561",
"size": "4957",... |
"""Defines a command message that sets PENDING status for job models"""
from __future__ import unicode_literals
import logging
from django.db import transaction
from job.models import Job
from messaging.messages.message import CommandMessage
from util.parse import datetime_to_string, parse_datetime
# This is the ma... | {
"content_hash": "47b937ae2e8eb9301452fe798fd7a173",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 119,
"avg_line_length": 30.422764227642276,
"alnum_prop": 0.6269374665954035,
"repo_name": "ngageoint/scale",
"id": "c609977ad52e39f96e41730374e40998550506a8",
"size": "37... |
import numpy as np
class MCMCSet(object):
"""Class for storage and management of multiple MCMC objects representing
repeated runs of the MCMC."""
def __init__(self, name):
"""Create the MCMCSet object and assign a name.
Assigns a name to the set and initializes an empty list
of MC... | {
"content_hash": "4fb20450bf3a853a8063345e31de9d66",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 87,
"avg_line_length": 38.52486187845304,
"alnum_prop": 0.585974472967159,
"repo_name": "jmuhlich/bayessb",
"id": "1be72487ca61d3855b02a7337b28c139d1187110",
"size": "6973... |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^$', 'remindme.views.home', name='home'),
url(r'^dashboard$', 'remindme.views.dashboard', name='dashboard'),
url(r'^create$', 'remindme.views.create', name='create'),
url(r'^admin/', include(admin.site.urls... | {
"content_hash": "c2e38f8f73934ea66f03aa11d8101ee7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 70,
"avg_line_length": 37.5,
"alnum_prop": 0.6613333333333333,
"repo_name": "hitchtest/django-remindme",
"id": "72398e14a2c39f2d0da3ba2847e49601a5fa048a",
"size": "375",
... |
import multiprocessing
#
# Server socket
#
# bind - The socket to bind.
#
# A string of the form: 'HOST', 'HOST:PORT', 'unix:PATH'.
# An IP is a valid HOST.
#
# backlog - The number of pending connections. This refers
# to the number of clients that can be waiting to be
# served. Exceeding ... | {
"content_hash": "1c7a4992d28b4e5d4a6174d96551f2f1",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 77,
"avg_line_length": 30.55909090909091,
"alnum_prop": 0.6569983638256731,
"repo_name": "Chumbak/RetailstoreTV-Content-Player",
"id": "c7baf209e87259ae07e8c2a1c0253f9d05cc0... |
from triangle import load_triangles, is_possible, load_triangles_from_cols
import unittest
class TestTriangle(unittest.TestCase):
def setUp(self):
self.triangles = [(1, 2, 3), (2, 2, 4), (2, 2, 3)]
self.col_triangles = [(1, 2, 2), (2, 2, 2), (3, 4, 3)]
def test_load_triangles(self):
a... | {
"content_hash": "813bfdf5f3ac554400a6b9c9e4d122ee",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 76,
"avg_line_length": 34.94736842105263,
"alnum_prop": 0.6189759036144579,
"repo_name": "machinelearningdeveloper/aoc_2016",
"id": "6c601f7476da65be2f00afd66f9520a627efe8af"... |
'''
pluginPackages test case
(c) Copyright 2012 Mark V Systems Limited, All rights reserved.
'''
def foo():
print ("imported unpackaged plug-in grandchild 1")
__pluginInfo__ = {
'name': 'Unpackaged Listed Import Grandchild 1.1',
'version': '0.9',
'description': "This is a packages-containing... | {
"content_hash": "39e583f3a186e2cca36a5911c6fcdb6f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 83,
"avg_line_length": 30.1,
"alnum_prop": 0.6495016611295681,
"repo_name": "sternshus/Arelle",
"id": "8c94841fc492897fe4165ea35f2ed28972d6610d",
"size": "602",
"binary":... |
import ast
import token
import tokenize
from os.path import islink
from StringIO import StringIO
from itertools import izip
from dxr.build import unignored
from dxr.filters import FILE, LINE
from dxr.indexers import (Extent, FileToIndex as FileToIndexBase,
iterable_per_line, Position, split_i... | {
"content_hash": "1acbce33e95759f2bde87877a605d525",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 87,
"avg_line_length": 36.538011695906434,
"alnum_prop": 0.5698623559539052,
"repo_name": "jay-z007/dxr",
"id": "a6e9147122c56e3815e5b3c98e772a036414bffa",
"size": "12496"... |
from __future__ import generators
import logging
_logger = logging.getLogger(__name__)
import os
from urlparse import urljoin, urldefrag
from urllib import pathname2url
from rdflib.term import URIRef, Variable, _XSD_PFX
class Namespace(URIRef):
@property
def title(self):
return URIRef(self + 'ti... | {
"content_hash": "3fd360f687a2c62d45dbd42e2cbe64b1",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 97,
"avg_line_length": 31.476923076923075,
"alnum_prop": 0.5586510263929618,
"repo_name": "robdennis/sideboard",
"id": "935f1a1b3f09c95470c36c8500ac52534bb6b156",
"size": ... |
"""
.. moduleauthor:: Jonas Berg
test_minimalmodbus: Unittests for the :mod:`minimalmodbus` module.
For each function are these tests performed:
* Known results
* Invalid input value
* Invalid input type
This unittest suite uses a mock/dummy serial port from the module :mod:`dummy_serial`,
so it is possible ... | {
"content_hash": "8bdf022a24855e17aa4e6f2626aed699",
"timestamp": "",
"source": "github",
"line_count": 6228,
"max_line_length": 276,
"avg_line_length": 36.478002569043035,
"alnum_prop": 0.5637211963818034,
"repo_name": "pyhys/minimalmodbus",
"id": "aef1a07471fb8e8e6897ebd70aaca8445104bd0d",
"size"... |
from sys import stderr, stdin, stdout
from poker import Card, Hand, Pocket, Table
# Copied or simplified from initial example code
class Bot(object):
'''
Main bot class
'''
def __init__(self):
'''
Bot constructor
Add data that needs to be persisted between rounds here.
... | {
"content_hash": "2f6ee2783cb4f5c217985487ee60361a",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 134,
"avg_line_length": 32.06214689265537,
"alnum_prop": 0.49497797356828194,
"repo_name": "nickname456/pbots",
"id": "004040a7bbb529017475e17645c54945230c81a0",
"size": "... |
import xml.parsers.expat
## Primitive
##
class Primitive(object):
def __init__(self, attrs):
if 'id' in attrs:
self.nid = int(attrs['id'])
else:
self.nid = None
self.attrs = attrs
self.names = []
self.props = []
return
def __repr__(sel... | {
"content_hash": "945580775c926a2ac248a5fd2646d5ee",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 65,
"avg_line_length": 24.279411764705884,
"alnum_prop": 0.5024227740763174,
"repo_name": "euske/osmtools",
"id": "c3b2c67104372469b1c4217fbc55b02ae51432b1",
"size": "3324... |
__version__ = "1.0b"
__author__ = "Li Chuan (daniellee0219@gmail.com)"
'''
Python client SDK for Youdao Note API using OAuth 2.
'''
try:
import json
except ImportError:
import simplejson as json
import urllib2, oauth2, time
ENCODING = 'utf-8'
BASE_URL = 'http://sandbox.note.youdao.com/'
OPTIONAL_BASE_URL = ... | {
"content_hash": "f6a9b3280d965532d9656f0a9c2b7425",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 116,
"avg_line_length": 35.77807486631016,
"alnum_prop": 0.5832150063522905,
"repo_name": "daniellee219/youdaonotepy",
"id": "e89f7043e6708f0ca9041dbc24970bf3d01b9daa",
"s... |
import logging
logger = logging.getLogger(__name__)
import numpy as np
import weakref
from gym import error, monitoring
from gym.utils import closer, reraise
env_closer = closer.Closer()
# Env-related abstractions
class Env(object):
"""The main OpenAI Gym class. It encapsulates an environment with
arbitrar... | {
"content_hash": "5dad300c50db7445fe17e9075baf0e57",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 129,
"avg_line_length": 33.54810495626822,
"alnum_prop": 0.6146693317111324,
"repo_name": "d1hotpep/openai_gym",
"id": "cdf6d1fa5b8ca1a730ab18d6f8472bcf70d76634",
"size": ... |
from rest_framework.test import APIClient
from datetime import datetime
from django.utils import timezone
from django.db import models
from django.apps import apps
from autofixture import AutoFixture
class OperisTestClient(APIClient):
models = {}
def register_fixtures(self,model,count):
... | {
"content_hash": "96041cefc163b1062ab0f5b267b55fbe",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 105,
"avg_line_length": 33.78947368421053,
"alnum_prop": 0.5638629283489096,
"repo_name": "Goldcap/django-operis",
"id": "3c5fec9582ba30ac3b15f25114b88d987b1194f8",
"size":... |
"""
algorithms.segment.trained_model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An API for a trained segmentation model to predict nodule boundaries and
descriptive statistics.
"""
import os
import numpy as np
import scipy.ndimage
from keras.models import load_model
from ...algorithms.segment.src.model import... | {
"content_hash": "63908ca0311fd8031f1b16ff03503815",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 120,
"avg_line_length": 37.53061224489796,
"alnum_prop": 0.6299619358346927,
"repo_name": "antonow/concept-to-clinic",
"id": "43eaf75546f0cf6249eab9001dd75ce770c76c09",
"si... |
import sys
import os
import gzip
import zipfile
from optparse import make_option
from django.conf import settings
from django.core import serializers
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.db import connections, router, transaction, DEFAULT_DB_... | {
"content_hash": "ca14b58695c4eef9a3f2ed9eda01585c",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 118,
"avg_line_length": 44.07826086956522,
"alnum_prop": 0.49852041822844745,
"repo_name": "aprefontaine/TMScheduler",
"id": "6212d6151dcb9d2d796296728846fb710db1c974",
"s... |
import os
from utils import HoraceTestObject
from test.CSSTest.pages.testpage import CSSTestPage
from test.CSSTest.pages.testpage_missing_elements import CSSTestPageWithMissingRequiredElements
from test.CSSTest.modules.paragraph import ParagraphSectionModule
from horace.contentNode import element, content_module, cont... | {
"content_hash": "e2824dd708a4d049cd4ff3659a6efae4",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 118,
"avg_line_length": 40.04615384615385,
"alnum_prop": 0.6613522858240491,
"repo_name": "lawrencec/horace",
"id": "cf5f994abc86fa6a69efa56641561d2643b29ac1",
"size": "52... |
"""Signals emited from waliki
"""
#===============================================================================
# IMPORTS
#===============================================================================
from flask.signals import Namespace
#========================================================================... | {
"content_hash": "287e09df8c3e4991b39dbde9c4249a2f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 28.75,
"alnum_prop": 0.2645962732919255,
"repo_name": "mgaitan/waliki_flask",
"id": "f687360d035191fccc69538af4c89b225f0c8818",
"size": "1251",
"bi... |
from django import forms
from taggit.forms import TagWidget
from apps.gallery.models import ResponsiveImage
class ResponsiveImageForm(forms.ModelForm):
class Meta(object):
model = ResponsiveImage
fields = ['name', 'description', 'photographer', 'tags']
widgets = {
'tags': Tag... | {
"content_hash": "1e89c5f0a374cac02c1e360ca282faa4",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 98,
"avg_line_length": 29.25,
"alnum_prop": 0.5863247863247864,
"repo_name": "dotKom/onlineweb4",
"id": "2af7100393f84907914521fbbcdaa60eeb9d698b",
"size": "644",
"binary... |
from pyfinder import ClientHub
import unittest
import requests
class TestClientHub(unittest.TestCase):
def setUp(self):
self.cHub = ClientHub()
#@unittest.skip("Skipping test_get_tags")
def test_get_tags(self):
#repo_name = "library/java"
repo_name ="andoladockeradmin/ubuntu"
... | {
"content_hash": "26a2f72704ed772d97c6a37ebdd15ac9",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 95,
"avg_line_length": 34.5,
"alnum_prop": 0.6388888888888888,
"repo_name": "di-unipi-socc/DockerFinder",
"id": "e9f0c281831ae8cef232cbe2705f6dc4563da462",
"size": "1656",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.