text stringlengths 4 1.02M | meta dict |
|---|---|
def paginator_range(current, stop, start=1):
"""Build a paginator.
Ex : paginator_range(10, 20) returns [1, 2, None, 8, 9, 10, 11, 12, None, 19, 20]
:param current: current page
:param stop: last page
:param start: first page
:return: a list of page numbers for shown pages and None when pages ... | {
"content_hash": "fc18bb47ca113baa8a017effb97e6064",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 94,
"avg_line_length": 33.19047619047619,
"alnum_prop": 0.5839311334289814,
"repo_name": "Findspire/workflow",
"id": "430204e57b43c13dccf82df2bcacf97379d6e3cb",
"size": "10... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.psvm import H2OSupportVectorMachineEstimator
def svm_svmguide1():
svmguide1 = h2o.import_file(pyunit_utils.locate("smalldata/svm_test/svmguide1.svm"))
svmguide1_test = ... | {
"content_hash": "e0ff270755f84770d6c2e0155cbd1cb2",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 102,
"avg_line_length": 33.903225806451616,
"alnum_prop": 0.708848715509039,
"repo_name": "h2oai/h2o-3",
"id": "68a9c8b8c57627958b04d378785973e722b247d3",
"size": "1051",
... |
'''
Common tests for IOs:
* check presence of all necessary attr
* check types
* write/read consistency
See BaseTestIO.
The public URL is in url_for_tests.
To deposite new testing files, please create a account at
gin.g-node.org and upload files at NeuralEnsemble/ephy_testing_data
data repo.
'''
# needed for ... | {
"content_hash": "4a7a2f3663634a9ceb8304a8865d09a4",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 89,
"avg_line_length": 38.24612403100775,
"alnum_prop": 0.592399290600456,
"repo_name": "rgerkin/python-neo",
"id": "6bb14c8c892c136b0f5a1f43c9cd30ceaac4d567",
"size": "19... |
import os
import yaml
from .. import app
__all__ = ('data',)
# Data loaded on import time so file system is not read and YAML parsed
# on every request.
with open(os.path.join(app.static_folder, 'data', 'beginners.yml')) as f:
data = yaml.safe_load(f.read())
| {
"content_hash": "a325907a468df84c5d254d4dc454c669",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 73,
"avg_line_length": 19.214285714285715,
"alnum_prop": 0.6728624535315985,
"repo_name": "honzajavorek/python.cz",
"id": "f3efef6a379260d2e44aa7377f307bbfaffedd69",
"size"... |
"""
sentry.utils.debug
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import cProfile
import re
import pstats
import six
import sys
from django.conf import settings
from django.http impo... | {
"content_hash": "20f136ae3e6991f6ab434e792c86b8a9",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 99,
"avg_line_length": 29.866242038216562,
"alnum_prop": 0.5427596502452549,
"repo_name": "JackDanger/sentry",
"id": "1b2d40da65e2a082b6e53301261e2f8de5b0b263",
"size": "4... |
"""
The JS Shell Test Harness.
See the adjacent README.txt for more details.
"""
import os, sys, textwrap
from copy import copy
from subprocess import list2cmdline, call
from lib.results import NullTestOutput
from lib.tests import TestCase
from lib.results import ResultsSink
from lib.progressbar import ProgressBar
... | {
"content_hash": "3692fb542c2f4bc7dd264fa26cb0c986",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 113,
"avg_line_length": 38.75987841945289,
"alnum_prop": 0.5971612296110415,
"repo_name": "sergecodd/FireFox-OS",
"id": "98b06bc193e28ce347e787219fe3745147d63871",
"size":... |
import sys
import os
import argparse
import shutil
import subprocess
from natsort import natsorted
import funannotate.library as lib
from Bio import SeqIO
def runSubprocess(cmd, dir):
proc = subprocess.Popen(
cmd, cwd=dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communica... | {
"content_hash": "c7bd9e025b1d2f00032c5cfb649581ff",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 168,
"avg_line_length": 37.97860962566845,
"alnum_prop": 0.560264714165024,
"repo_name": "nextgenusfs/funannotate",
"id": "a4865177889c5b2d9f5b0411ced093e73a1f6704",
"size... |
import numpy as np
from .epochs import Epochs
from .utils import check_fname, logger, verbose, _check_option, _check_fname
from .io.constants import FIFF
from .io.open import fiff_open
from .io.pick import pick_types, pick_types_forward
from .io.proj import (Projection, _has_eeg_average_ref_proj, _read_proj,
... | {
"content_hash": "dac3a5422c8be8fe998a44399ea22403",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 79,
"avg_line_length": 35.275109170305676,
"alnum_prop": 0.5617108195097796,
"repo_name": "Teekuningas/mne-python",
"id": "8bdd80cdb1f1f29eeb34864d422ee3a5e93fcd47",
"size... |
import sys
import time as tmod
import warnings
import numpy as np
warnings.simplefilter("ignore")
sys.path.insert(0, "../FATS/")
import FATS
#We open the ligth curve in two different bands
lc_B = FATS.ReadLC_MACHO('lc/lc_1.3444.614.B.txt')
lc_R = FATS.ReadLC_MACHO('lc/lc_1.3444.614.R.txt')
#We import the data
[ma... | {
"content_hash": "886f9feb5b9704eae481db7e9761cefd",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 111,
"avg_line_length": 29.540816326530614,
"alnum_prop": 0.6773747841105354,
"repo_name": "carpyncho/feets",
"id": "ed130147a51ebc25da32804b4679131456c1f32b",
"size": "289... |
import uuid
import ddt
import mock
from oslo_utils import strutils
from oslo_utils import timeutils
import six
import webob
from cinder.api import microversions as mv
from cinder.api.v3 import group_specs as v3_group_specs
from cinder.api.v3 import group_types as v3_group_types
from cinder.api.v3.views import group_t... | {
"content_hash": "6df14a978969b5b69a6c76b291875276",
"timestamp": "",
"source": "github",
"line_count": 666,
"max_line_length": 78,
"avg_line_length": 40.746246246246244,
"alnum_prop": 0.5309724730073332,
"repo_name": "j-griffith/cinder",
"id": "9f6d7d25c256102e2bccaae27c2cd46a074df847",
"size": "2... |
"""
===============================
Computing source space SNR
===============================
This example shows how to compute and plot source space SNR as in [1]_.
"""
# Author: Padma Sundaram <tottochan@gmail.com>
# Kaisu Lankinen <klankinen@mgh.harvard.edu>
#
# License: BSD (3-clause)
# sphinx_gallery_th... | {
"content_hash": "84d7897d40dc5377c1c3f5325c5e0321",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 79,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.5926573426573427,
"repo_name": "cjayb/mne-python",
"id": "4191665d597e80a26141f5f15c13626303e958ac",
"size": "346... |
import numpy as np
import pytest
from pandas._libs.tslibs import IncompatibleFrequency
from pandas import (
DataFrame,
Period,
Series,
Timestamp,
date_range,
period_range,
to_datetime,
)
import pandas._testing as tm
@pytest.fixture
def date_range_frame():
"""
Fixture for DataFram... | {
"content_hash": "b922e5d8fdbadd89a2cf5fdc0f7fecad",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 84,
"avg_line_length": 32.324175824175825,
"alnum_prop": 0.561958184599694,
"repo_name": "gfyoung/pandas",
"id": "6931dd0ea2d4c2d01972ca3c03e0a60a48ecb1f6",
"size": "5883"... |
import os
import sys
import yaml
import logging
import json
import re
import argparse
import datetime
import salt.client
import device42
from nodefilter import node_filter
logger = logging.getLogger('log')
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setFormatter(logging.Formatter('%(asctim... | {
"content_hash": "3de17772ed1f4ea42c9b792e2871bb90",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 128,
"avg_line_length": 38.71382636655949,
"alnum_prop": 0.5132890365448505,
"repo_name": "device42/salt_to_device42_sync",
"id": "106761b78634a7790fc4c284d4905300707d1d6a",... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.azurestack import AzureStackManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-azurestack
# USAGE
python put.py
Before run the sample, please set the values of the client ID, tenant ID and client secr... | {
"content_hash": "790034b1d9f9f9e9b4e7b3a69ee78b8b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 141,
"avg_line_length": 36.857142857142854,
"alnum_prop": 0.737984496124031,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a7067b5dacab3b7c39a3a2bc41a64a090b1eca8e",
"s... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("XGBClassifier" , "BinaryClass_100" , "mssql")
| {
"content_hash": "3915fb32aeb5fdd466eb8dbe8c06b1f0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 35.75,
"alnum_prop": 0.7832167832167832,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "d968aeaac0627f1d93e8eb61b45af17344997c8c",
"size": "14... |
from aws import Action
service_name = 'Amazon CloudWatch Logs'
prefix = 'logs'
CreateLogGroup = Action(prefix, 'CreateLogGroup')
CreateLogStream = Action(prefix, 'CreateLogStream')
DeleteLogGroup = Action(prefix, 'DeleteLogGroup')
DeleteLogStream = Action(prefix, 'DeleteLogStream')
DeleteMetricFilter = Action(prefix,... | {
"content_hash": "a60cb722de29ccd3bc5cd97584a5b431",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 44.26315789473684,
"alnum_prop": 0.8085612366230678,
"repo_name": "craigbruce/awacs",
"id": "33e7612466a02bc95cc87bd8c50ef87ed836909d",
"size": "957"... |
import copy
from django.core.urlresolvers import reverse
from django import http
from mox3.mox import IgnoreArg # noqa
from mox3.mox import IsA # noqa
import six
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.routers.extensions.routerrules\
import rulemanager
from openstack_das... | {
"content_hash": "73217e6eaf8b2b5489b3c0297ef0d7c8",
"timestamp": "",
"source": "github",
"line_count": 993,
"max_line_length": 80,
"avg_line_length": 44.53474320241692,
"alnum_prop": 0.5645478597110101,
"repo_name": "ankur-gupta91/horizon-net-ip",
"id": "7acc63e17e4faace6ab53fe8fa4d3ee0c1fd6d4b",
... |
import signal
import warnings
from collections import Mapping
import os
import click
import ethereum
import gevent
from IPython.core import ultratb
from ethereum.blocks import Block, genesis
from devp2p.service import BaseService
import rlp
import sys
from ethereum import slogging
import types
from ethereum.utils imp... | {
"content_hash": "c855ad00209ed1fbb14d8ce4cb8b6252",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 97,
"avg_line_length": 36.84431137724551,
"alnum_prop": 0.6075085324232082,
"repo_name": "RomanZacharia/pyethapp",
"id": "1191b640bbeb2a62e1a04f43922dbcf81ae30dd0",
"size"... |
import tempfile
from io import StringIO
from django.contrib.gis import gdal
from django.contrib.gis.db.models import Extent, MakeLine, Union, functions
from django.contrib.gis.geos import (
GeometryCollection, GEOSGeometry, LinearRing, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, from... | {
"content_hash": "3b31b8d59674f7e6f7e0acd149ac5b21",
"timestamp": "",
"source": "github",
"line_count": 550,
"max_line_length": 117,
"avg_line_length": 43.41818181818182,
"alnum_prop": 0.6214405360134003,
"repo_name": "labcodes/django",
"id": "1ccac6fd1c057c2100122c1e3331152a6cb88ae2",
"size": "238... |
from tornado.web import RequestHandler
class Handler(RequestHandler):
async def get(self):
self.set_header('Content-Type', 'text/plain')
if hasattr(self.application, 'shutting_down') and self.application.shutting_down == True:
self.write('SHUTTING DOWN')
self.set_status(503... | {
"content_hash": "a7056ad2a9d2a4ff886dc0f59ee356dc",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 97,
"avg_line_length": 33.083333333333336,
"alnum_prop": 0.6322418136020151,
"repo_name": "thomaserlang/storitch",
"id": "1e997ae2bdf2469889d7e1d75c09bdda2e61a29e",
"size":... |
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse, NoReverseMatch
from django.db import models
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, ListAdminView
class DetailsPlugin(BaseAdminPlugin):
show_detail_fields = []
show_all_rel_detail... | {
"content_hash": "fb40a676d9040168bafb420163f83407",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 167,
"avg_line_length": 47.85245901639344,
"alnum_prop": 0.5220966084275437,
"repo_name": "pobear/django-xadmin",
"id": "168649da16e49fa309904003be66a9266de330ff",
"size": ... |
from calvin.runtime.south.calvinsys import base_calvinsys_object
class MockInputOutput(base_calvinsys_object.BaseCalvinsysObject):
"""
MockInputOutput - Mocked input output device, printing data to stdout
"""
init_schema = {
"description": "Init object",
"type": "object",
"pro... | {
"content_hash": "4319bf5f82f878cd4553a31127591789",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 126,
"avg_line_length": 28.71764705882353,
"alnum_prop": 0.5702580909463335,
"repo_name": "EricssonResearch/calvin-base",
"id": "ebb0272a1eb0410b5967a326e2cfbaea03165dd8",
... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.languages.node_mono_repo as node
import os
node.owlbot_main(relative_dir="packages/google-cloud-monitoring",staging_excludes=["README.md", "package.json"])
# ----------------------------------------------... | {
"content_hash": "75bbe04535d3d5206727a5aafc8d582a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 112,
"avg_line_length": 34.07142857142857,
"alnum_prop": 0.519916142557652,
"repo_name": "googleapis/google-cloud-node",
"id": "3289c79cd0ea53c24e8edfbdcea263d61ea3bdb4",
"... |
"""
Meerkat Hermes Tests
Unit tests for Meerkat Hermes util methods and resource classes.
"""
from boto3.dynamodb.conditions import Key
from unittest import mock
from datetime import datetime
import meerkat_hermes.util as util
import meerkat_hermes
from meerkat_hermes import app
import requests
import json
import unit... | {
"content_hash": "4aa66b1c20e7360012364cc5afb5ce81",
"timestamp": "",
"source": "github",
"line_count": 698,
"max_line_length": 83,
"avg_line_length": 37.64756446991404,
"alnum_prop": 0.5708196970850141,
"repo_name": "meerkat-code/meerkat_hermes",
"id": "9e7a809463ebe54feee0c0bef2fa6a1b8e93d9c5",
"... |
__author__ = 'hou'
import subprocess
def run(cmd, capture = False):
out_stream = subprocess.PIPE if capture else None
err_stream = subprocess.PIPE if capture else None
print cmd
p = subprocess.Popen(cmd, shell=True, stdout=out_stream, stderr=err_stream)
(stdout, stderr) = p.communicate()
std... | {
"content_hash": "29652441d1e4fdf928054cd0111c5fed",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 28.217391304347824,
"alnum_prop": 0.6240369799691834,
"repo_name": "begeekmyfriend/ezfm_diarisation",
"id": "d2f249a7e3cd777a5584212453abddbd134e46c3",... |
people = 20
cats = 30
dogs = 15
if people < cats:
print "Too many cats! The world is doomed!"
if people > cats:
print "Not many cats! The world is saved!"
if people < dogs:
print "The world is drooled on!"
if people > dogs:
print "The world is dry!"
dogs += 5
if people >= dogs:
print "People are greater... | {
"content_hash": "c20883cfe21e46aeed0ee8dc6ad7f5df",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 51,
"avg_line_length": 16.535714285714285,
"alnum_prop": 0.6587473002159827,
"repo_name": "jmcguire/learning",
"id": "c71de51a182fd8ef9ab1d750262f5cd938a199b2",
"size": "46... |
from google.cloud import managedidentities_v1
def sample_validate_trust():
# Create a client
client = managedidentities_v1.ManagedIdentitiesServiceClient()
# Initialize request argument(s)
trust = managedidentities_v1.Trust()
trust.target_domain_name = "target_domain_name_value"
trust.trust_t... | {
"content_hash": "d0dd9f413e249f696083794ceef0d1e2",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 104,
"avg_line_length": 30.967741935483872,
"alnum_prop": 0.7208333333333333,
"repo_name": "googleapis/python-managed-identities",
"id": "b5ec2ea243074a80009b993b1a24d8f80a50... |
"""Author: Krzysztof Trzepla
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
Brings up a set of onepanel nodes. They can create separate clusters.
"""
import copy
import json
import os
from . import common, docker, dns, gui
def panel_domain(instance, uid):... | {
"content_hash": "50b69874b6a06b8c8142125ea4c014b4",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 103,
"avg_line_length": 33.39506172839506,
"alnum_prop": 0.6046210720887246,
"repo_name": "kliput/onezone-gui",
"id": "f8d08fa398f38c5185e8a73761947dba274c10ac",
"size": "... |
"""
Generate graph of Double Elo model's error for given K.
"""
__author__ = 'riko'
import matplotlib.pyplot as plt
import numpy as np
import data_tools as dt
import models
elo = models.DoubleEloModel()
train_data = dt.get_main_matches_data()
x = np.array([1.0 * i / 4 for i in range(4, 120)])
y = np.array([elo.... | {
"content_hash": "a662f5755c257e1fae37e7e6d81c1d6b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 18.551724137931036,
"alnum_prop": 0.6747211895910781,
"repo_name": "erix5son/Tennis-Modelling",
"id": "ebd04721897a48389c8f2443de6504756a604b64",
"si... |
__author__ = 'Stephanie Federwisch'
"""Tests for statistics continuous computations."""
from core import jobs_registry
from core.domain import event_services
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import stats_jobs
from core.platform import models
(stats_models,) = mo... | {
"content_hash": "e6c9dbd4a243f4d5ac8ac9ccbee0b1b7",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 81,
"avg_line_length": 42.873198847262245,
"alnum_prop": 0.612018552127445,
"repo_name": "fernandopinhati/oppia",
"id": "577c68b0fed7ab824c6897789e73f011e95a4bed",
"size":... |
from muntjac.api import \
(VerticalLayout, TextField, RichTextArea, HorizontalLayout,
NativeSelect, Slider, Button, Alignment)
from muntjac.ui.button import IClickListener
from muntjac.ui.window import Notification
class NotificationCustomExample(VerticalLayout):
_CAPTION_PROPERTY = 'CAPTION'
def... | {
"content_hash": "e1e6f948f2348fa2d1fb864bb6156e94",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 76,
"avg_line_length": 39.714285714285715,
"alnum_prop": 0.6604716227018386,
"repo_name": "rwl/muntjac",
"id": "e2bc2c82a6b4a6bbe00cb80c9212b607bd96a80a",
"size": "5005",
... |
from flask import Flask, render_template
app = Flask(__name__)
app.secret_key = 'my_secret_key'
@app.route('/')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run(debug = True)
| {
"content_hash": "f6517af6f49624f65796617dd72884c6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 40,
"avg_line_length": 21.9,
"alnum_prop": 0.634703196347032,
"repo_name": "jiobert/python",
"id": "18e109efc8185ffaf119eaa5a9f6bc728a94437e",
"size": "219",
"binary": fa... |
from .response import Response
class SearchResponse(Response):
"""Defines the top-level object that the response includes when the request
succeeds.
Variables are only populated by the server, and will be ignored when
sending a request.
:param _type: Constant filled by server.
:type _type: s... | {
"content_hash": "f37be98d5b72cc5bcf691715aa1b5f67",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 101,
"avg_line_length": 45.3125,
"alnum_prop": 0.6554022988505747,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "10bfdb41e025aaee3df7dc27fa3d6cfaac57b413",
"size":... |
"""
High-level table operations:
- join()
- setdiff()
- hstack()
- vstack()
- dstack()
"""
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
import collections
import itertools
from collections import OrderedDict, Counter
from collections.abc import Mapping, Sequence
import nu... | {
"content_hash": "43a861a3bcb8292cd02415f9f5eae820",
"timestamp": "",
"source": "github",
"line_count": 1148,
"max_line_length": 101,
"avg_line_length": 37.224738675958186,
"alnum_prop": 0.5829316235316142,
"repo_name": "stargaser/astropy",
"id": "baa3e2408065ab50e0afa9d71c8e706b358088eb",
"size": ... |
from datetime import datetime, timedelta
import time
from collections import OrderedDict
from userver.database.db0 import db0,ConstDB
from utils.log import logger
class ConstStatis:
dev = 'DEV'
group = 'GROUP'
class Statistician(object):
def __init__(self, eui, type):
if type == 'DEV':
... | {
"content_hash": "04f5f8dba791b9e21af3fa7ddf80654e",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 98,
"avg_line_length": 30.06282722513089,
"alnum_prop": 0.5027864855451062,
"repo_name": "soybean217/lora-python",
"id": "dbff441f92732a2c47fcf70104f369f320d684eb",
"size"... |
class Person(object):
def __init__(self, name):
#create a person with name name
self.name = name
try:
firstBlank = name.rindex(' ')
self.lastName = name[firstBlank+1:]
except:
self.lastName = name
self.age = None
def getLastName(self):
... | {
"content_hash": "67ab4368356b3e5c3ca7b2ae8a7c2d37",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 32.258620689655174,
"alnum_prop": 0.5622661678246926,
"repo_name": "spencerpomme/coconuts-on-fire",
"id": "51117c045e237cd19c4917c05c7907e53ebf2d46",
... |
import logging
import time
import tablib
from calendar import Calendar
from collections import defaultdict, Counter, OrderedDict
from datetime import datetime, timedelta
from hashlib import md5
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
from dja... | {
"content_hash": "6134eb6107b07b96c2eabc543fc80051",
"timestamp": "",
"source": "github",
"line_count": 2558,
"max_line_length": 90,
"avg_line_length": 37.1790461297889,
"alnum_prop": 0.6164514636608345,
"repo_name": "tndatacommons/tndata_backend",
"id": "cf0f147719e57c35281bfa5875636b0d28276b8e",
... |
import pytest
import numpy as np
import murraylab_tools.echo as mt_echo
@pytest.mark.skip(reason="tests not yet implmented")
class TestEchoFunctions():
def test_implement_me(self):
assert 0
| {
"content_hash": "e83e32fb849f957bdb1c632ec0b8a9f9",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 52,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.7401960784313726,
"repo_name": "sclamons/murraylab_tools",
"id": "519444b5062f7c39bcaabcdc74981a0fb3d1180b",
"size... |
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, \
current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
from .forms import LoginForm, RegistrationForm, ChangePasswordForm,\
... | {
"content_hash": "5fc64be8cfb09aaee4df812e682727c2",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 78,
"avg_line_length": 34.26993865030675,
"alnum_prop": 0.6308628714643753,
"repo_name": "mvbn6789/flask-blog",
"id": "6178eace98de9ca1b7190ee8a7b229b80b41fba4",
"size": "... |
"""
Test suite for the docx.parts.document module
"""
from __future__ import absolute_import, print_function, unicode_literals
import pytest
from mock import Mock
from docx.opc.constants import CONTENT_TYPE as CT, RELATIONSHIP_TYPE as RT
from docx.opc.package import PartFactory
from docx.opc.packuri import PackURI
... | {
"content_hash": "e49b640f447a089170db536b8adfa08c",
"timestamp": "",
"source": "github",
"line_count": 599,
"max_line_length": 77,
"avg_line_length": 34.90651085141903,
"alnum_prop": 0.5966808551341528,
"repo_name": "ludoo/python-docx",
"id": "c5cf5a36baad262bc820ff8bc8d80729e595c4ea",
"size": "20... |
"""Tools for analyzing a Python codebase as a whole. Analysis happens
before indexing in order to compute data that requires knowledge of the
entire codebase.
"""
import ast
import os
from collections import defaultdict
from warnings import warn
from dxr.build import unicode_contents
from dxr.plugins.python.utils imp... | {
"content_hash": "13ea4121467197e9283fc7e9b4b508c8",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 97,
"avg_line_length": 42.415637860082306,
"alnum_prop": 0.6203550984767634,
"repo_name": "pelmers/dxr",
"id": "faf1e3e922c2a4cd01b7d3ea8830b2c07d293680",
"size": "10307",... |
import unittest
class TestTransaction(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.datastore.transaction import Transaction
return Transaction
def _make_one(self, client, **kw):
return self._get_target_class()(client, **kw)
def test_ctor_defau... | {
"content_hash": "a7e2abed327b189790cb97829a77c382",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 73,
"avg_line_length": 32.03292181069959,
"alnum_prop": 0.593268242548818,
"repo_name": "jgeewax/gcloud-python",
"id": "c09304df6f5b5c5922982a5416a9e9e8efd2d190",
"size": ... |
import _plotly_utils.basevalidators
class TexttemplateValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="texttemplate", parent_name="scatter", **kwargs):
super(TexttemplateValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_n... | {
"content_hash": "d46e4ee33ae111372a3cfb7de1da4cb5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 84,
"avg_line_length": 38.583333333333336,
"alnum_prop": 0.6241900647948164,
"repo_name": "plotly/plotly.py",
"id": "f95e1320db750e43946cbddeb77b00b23fafbf63",
"size": "463... |
"""Synchronization primitives backed by the datastore.
The `Mutex` class's interface matches the Python standard library's
`threading.Lock` class.
"""
import datetime
import random
import time
from google.appengine.ext import db
from google.appengine.api import datastore
class Mutex(db.Model):
"""A mut... | {
"content_hash": "f5cfd0a439bc6cdbd644f7ab33cb2834",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 80,
"avg_line_length": 23.994535519125684,
"alnum_prop": 0.6606695513550445,
"repo_name": "GoogleCloudPlatform/appengine-python-standard",
"id": "05f40640a18c129e4ea86bb51dd... |
"""
Bagelbot script for checking for attendance for an upcoming bagelbot meeting.
"""
import logging
import sys
import time
from datetime import datetime, timedelta
from config import ATTENDANCE_TIME_LIMIT
from utils import YES, NO, initialize, nostdout, download_shelve_from_s3, upload_shelve_to_s3
def check_attenda... | {
"content_hash": "34878665c3f3b4a33079d054c63ce092",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 129,
"avg_line_length": 37.51123595505618,
"alnum_prop": 0.5149019020518196,
"repo_name": "statmuse/bagelbot",
"id": "8fbc35f0f26ac198a2e2de47a58e4109e404a438",
"size": "6... |
'''
Created on 2014年2月22日
@author: lan (www.9miao.com)
'''
import sys
from gtwisted.core import reactor
from gtwisted.core.rpc import PBServerProtocl,PBServerFactory
from gtwisted.utils import log
class MyPBServerProtocl(PBServerProtocl):
def remote_getResult(self,a,b):
print a,b
... | {
"content_hash": "f3c8ed3ee6edaa0986b97d5a8ef89668",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 61,
"avg_line_length": 24.25,
"alnum_prop": 0.6701030927835051,
"repo_name": "viphxin/gtwisted",
"id": "dcdfddd4a379cd594839ca5207414de55106599a",
"size": "699",
"binary"... |
"""
...
"""
from __future__ import absolute_import, division, print_function
import logging
from .base_stat_swfilter import BaseStatSWFilter
class AlphaBetaSWFilter(BaseStatSWFilter):
"""
https://en.wikipedia.org/wiki/Alpha_beta_filter
"""
__logger = logging.getLogger(__name__)
def ag... | {
"content_hash": "c9e3b4d578da6ed74d8bc6cb95a6d273",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 64,
"avg_line_length": 24.6875,
"alnum_prop": 0.480168776371308,
"repo_name": "w495/python-video-shot-detector",
"id": "3136ea4a9ddc562d4f41a877d2df54263becf7a0",
"size": "... |
"""
docker_registry.drivers.ufile
~~~~~~~~~~~~~~~~~~~~~~~~~~
UFile is a distributed key/value storage provided by UCloud.
See http://docs.ucloud.cn/ufile/index.html for additional info.
"""
import functools
import logging
import os
import time
import requests
from docker_registry.core import driver
from docker_reg... | {
"content_hash": "5cfc54c1f2ea0156b499f0a037441924",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 79,
"avg_line_length": 31.327188940092167,
"alnum_prop": 0.5458958517210944,
"repo_name": "SkyLothar/docker-registry-driver-ufile",
"id": "70584d0f1d784c2032899e454a65ba3352... |
import sys
import os
from l20n.compiler.js import Compiler
from l20n.format.lol.parser import Parser
from pyjs.serializer import Serializer
def read_file(path):
with file(path) as f:
return f.read()
def get_lol(path):
s = read_file(path)
parser = Parser()
lol = parser.parse(s)
return lol... | {
"content_hash": "a4db3aa616df03a90afc73af4c8c6a4c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 43,
"avg_line_length": 21.170731707317074,
"alnum_prop": 0.5956221198156681,
"repo_name": "stasm/python-l20n",
"id": "2c70d14f353326ebe0ff78540af6df7e179f9db2",
"size": "86... |
import sys, dia, string
def bbox_cb (data, flags) :
layer = data.active_layer
dest = data.add_layer ("BBox of '%s' (%s)" % (layer.name, sys.platform), -1)
box_type = dia.get_object_type ("Standard - Box")
for o in layer.objects :
bb = o.bounding_box
b, h1, h2 = box_type.create (bb.left, bb.top)
b.move_hand... | {
"content_hash": "a255bd9863988608b1f562814976756a",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 81,
"avg_line_length": 31.842105263157894,
"alnum_prop": 0.6132231404958678,
"repo_name": "krattai/monoflow",
"id": "3839ed0496c338a1354c6c9d7af1babe8d0d6b95",
"size": "209... |
import collections
import os
import os.path
import re
import sys
import docutils.nodes
from typing import Dict, List, Set
DIRECTIVE_PAT = re.compile(r'\s*\.\. (\S+)::\s*([^\n]*)\n?$')
REF_DEF_PAT = re.compile(r'\s*\.\. _([^:\s]+):')
ROLE_PAT = re.compile(r'(?::(\S+):)`(?:[^<`]+\s*<)?([^\s>]+)>?`', re.M)
RefDef = col... | {
"content_hash": "108b170258d63fea9c25b97a5d1897e7",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 102,
"avg_line_length": 32.296551724137935,
"alnum_prop": 0.5620328849028401,
"repo_name": "jeff-allen-mongo/mut",
"id": "5d00369272e63a852302b5ff47eab55472accb27",
"size"... |
import re
import math
try:
import numpy
except ImportError:
pass
from nltk.tokenize.api import TokenizerI
BLOCK_COMPARISON, VOCABULARY_INTRODUCTION = 0, 1
LC, HC = 0, 1
DEFAULT_SMOOTHING = [0]
class TextTilingTokenizer(TokenizerI):
"""Tokenize a document into topical sections using the TextTiling algor... | {
"content_hash": "858cf12662f10305d3bccd62945b39b0",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 101,
"avg_line_length": 36.8783185840708,
"alnum_prop": 0.5488631591577179,
"repo_name": "arju88nair/projectCulminate",
"id": "65ab241cac0f33980109e4ab7c0fb619a98372d5",
"... |
import os
import sys
if sys.platform == 'win32':
pybabel = 'flask\\Scripts\\pybabel'
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
print "usage: tr_init <language-code>"
sys.exit(1)
os.system(pybabel + ' extract -F babel.cfg -k lazy_gettext -o messages.pot app')
os.system(pybabel + ' init -... | {
"content_hash": "4e643decc28c33a007367cfbdfd9dc9c",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.6725,
"repo_name": "vbshah1992/microblog",
"id": "c80525c45825bad11f90a87b2947a17b707d8332",
"size": "419",
"bi... |
from __future__ import unicode_literals
import itertools
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.db import models
class Command(BaseCommand):
help = "Prints generic configuration for any models which use a st... | {
"content_hash": "25c45ac882d28ec042a302632fb6b7c1",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 143,
"avg_line_length": 40.075471698113205,
"alnum_prop": 0.6459510357815442,
"repo_name": "NewVadim/django-sphinx",
"id": "1659d1b0fc4512d24270b1a0d35df4b642c5e169",
"size... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_photodb_category'),
]
operations = [
migrations.RemoveField(
model_name='photoext',
name='location',
),... | {
"content_hash": "58931d95ad4fa6dc21612878dbee1b80",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 62,
"avg_line_length": 26.58139534883721,
"alnum_prop": 0.5336832895888014,
"repo_name": "BOOLRon/lovelypic",
"id": "06839a42aef1c044e2c5ba85a13050cc1875a17d",
"size": "121... |
import unittest
import datetime
from django.conf import settings
from django.db import connection
from models import CustomPKModel, UniqueTogetherModel, UniqueFieldsModel, UniqueForDateModel, ModelToValidate
class GetUniqueCheckTests(unittest.TestCase):
def test_unique_fields_get_collected(self):
m = Uniq... | {
"content_hash": "fee757db29588c038daf0d09ea24a37c",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 109,
"avg_line_length": 39.10526315789474,
"alnum_prop": 0.6255047106325706,
"repo_name": "bfirsh/django-old",
"id": "1b966390c4402c35bc889658546924dcd5eace57",
"size": "29... |
import contextlib
import ftplib
import os
import uuid
import paramiko
from nova import exception as nova_exception
from nova.openstack.common import log as logging
from nova import utils
from nova.virt.powervm import constants
from nova.virt.powervm import exception
LOG = logging.getLogger(__name__)
class Connecti... | {
"content_hash": "00f967c31cd3fca49c492b7b49ffe6ed",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 77,
"avg_line_length": 34.87619047619047,
"alnum_prop": 0.621381758601857,
"repo_name": "zestrada/nova-cs498cc",
"id": "34658547cb2acd43ce06f4fbd5b16ecff481a632",
"size": ... |
from robotide.lib.robot.errors import (ExecutionFailed, ExecutionStatus, DataError,
HandlerExecutionFailed, KeywordError, VariableError)
from robotide.lib.robot.utils import ErrorDetails, get_timestamp
class StatusReporter(object):
def __init__(self, context, result, dry_run_lib_kw=Fals... | {
"content_hash": "5e7efa4417f063dad179b2d8476552a1",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 83,
"avg_line_length": 40.766666666666666,
"alnum_prop": 0.6091578086672118,
"repo_name": "HelioGuilherme66/RIDE",
"id": "44a0052cc27e4a03f89803345ecd60a468bdc1a0",
"size":... |
from django import http
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
class CeilometerApiTests(test.APITestCase):
def test_sample_list(self):
samples = self.samples.list()
meter_name = "meter_name"
ceilometerclie... | {
"content_hash": "0a06e5040d038c9b36606621582737e9",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 77,
"avg_line_length": 40.74063400576369,
"alnum_prop": 0.5936903161915541,
"repo_name": "bac/horizon",
"id": "16be994eef965f1c4a56ec1bb46887b14c80db3d",
"size": "14717",
... |
import datetime
import copy
import yaml
class YamlPrinter():
_references= {}
def get_header(self, filetype):
yoda_header = "---\n"
yoda_header += "YODA:\n"
yoda_header += " - {"
yoda_header += "Version: \"{0}\", ".format("0.1.0")
yoda_header += "Profile: \"{0}\", ".for... | {
"content_hash": "e399ee2e04b65400385ad8efed3b2f35",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 134,
"avg_line_length": 38.79182156133829,
"alnum_prop": 0.5259223766171538,
"repo_name": "ODM2/ODM2YODAParser",
"id": "eac981b1c1ae1296cdfadcddf0f7343de8d90124",
"size": ... |
import pytest
import salt.cloud.clouds.openstack as openstack
from salt.utils import dictupdate
from tests.support.mock import MagicMock, call, patch
# pylint: disable=confusing-with-statement
class MockImage:
name = "image name"
id = "image id"
class MockNode:
name = "node name"
id = "node id"
... | {
"content_hash": "d5755b35bb815f73a85b6b642ce2552c",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 96,
"avg_line_length": 31.835135135135136,
"alnum_prop": 0.5781475507258681,
"repo_name": "saltstack/salt",
"id": "f78935c144991d8625d15ae6a97c9f96d2403bea",
"size": "1177... |
"""
==========================================
Statistical functions (:mod:`scipy.stats`)
==========================================
.. module:: scipy.stats
This module contains a large number of probability distributions as
well as a growing library of statistical functions.
Each univariate distribution is an insta... | {
"content_hash": "d1ee00eeb704aeb661252767b146d2bd",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 94,
"avg_line_length": 26.489028213166144,
"alnum_prop": 0.5715976331360947,
"repo_name": "mortonjt/scipy",
"id": "7d71537b991ed181eea4389ec2e1eccd521f49ab",
"size": "8450... |
import setuptools
import sys
requiredList = ['requests', 'python-dateutil']
if sys.version_info[:2] <= (2, 6):
requiredList.extend(['argparse', 'unittest2'])
if sys.version_info[:2] <= (2, 7):
requiredList.extend(['mock'])
if sys.version_info[:2] <= (3,):
requiredList.extend([])
setuptools.setup(
nam... | {
"content_hash": "ad58184453fd9a8cf645f2a2c915af5b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 50,
"avg_line_length": 25.695652173913043,
"alnum_prop": 0.6480541455160744,
"repo_name": "dvrasp/TheTroz",
"id": "465125bbb324247d5bf50f49b31dd9873efbfb50",
"size": "614",... |
import json
import os
class Configuration(object):
def __init__(self, directory):
self.package = None
self.name = None
self.icon_name = None
self.version = None
self.numeric_version = None
self.orientation = None
self.permissions = [ "VIBRATE" ]... | {
"content_hash": "e6f05d8beea9a47287653208ed2b4fec",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 197,
"avg_line_length": 34.18421052631579,
"alnum_prop": 0.6198999230177059,
"repo_name": "flyher/pymo",
"id": "4ee1b629084e403c150ad20af5a330df6b931b12",
"size": "5196",
... |
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from time import sleep, time
from threading import Event
from subprocess import PIPE, STDOUT
import socket
from system_test import TestCase, Qdrouterd, main_module, TIME... | {
"content_hash": "7f00e8cfa0c6ffb2afb0daa7bf769287",
"timestamp": "",
"source": "github",
"line_count": 2766,
"max_line_length": 187,
"avg_line_length": 42.369848156182215,
"alnum_prop": 0.5585818507615513,
"repo_name": "ganeshmurthy/qpid-dispatch",
"id": "2edc5095a1165608560a035d92654d32f93267ab",
... |
import theano.tensor as T
import theano.compile.sharedvalue as S
import numpy as np
from pymanopt import Problem
from pymanopt.manifolds import Euclidean
from pymanopt.solvers import TrustRegions
if __name__ == "__main__":
# Cost function is the squared reconstruction error
wT = T.matrix()
yT = S.shared(... | {
"content_hash": "bc656e844f45de019ed5308bccd435de",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 30.615384615384617,
"alnum_prop": 0.6273031825795645,
"repo_name": "j-towns/pymanopt",
"id": "2520328772214bf30b0c2b7289a3c2018eff3679",
"size": "119... |
from autothreadharness.harness_case import HarnessCase
import unittest
class Leader_7_1_1(HarnessCase):
role = HarnessCase.ROLE_LEADER
case = '7 1 1'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "9ef173993142856705f8912016ea3bd2",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 54,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.6643835616438356,
"repo_name": "erja-gp/openthread",
"id": "9e1e798379f4cf0c102d236ba8ace56df9f389cf",
"size": "1... |
import os
import jinja2
from functools import wraps
from .models import Posts, Comments, Votes
template_dir = os.path.join(os.path.dirname(__file__), '../templates')
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir),
autoescape=True)
def login_required(f):
... | {
"content_hash": "5b60f9ba162a6571affdf0c93d149a31",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 76,
"avg_line_length": 22.933333333333334,
"alnum_prop": 0.5352990033222591,
"repo_name": "stonescar/multi-user-blog",
"id": "e87665711b6d80cd3f0235f61539805982d3fbba",
"s... |
import sys
from qpid.messaging import *
if __name__ == "__main__":
if len(sys.argv) < 5:
sys.exit(-1)
print 'app name {}, broke ip {}, broker port {}, queue id {}'.format(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
broker = "{}/xxxx@{}:{}".format(sys.argv[1], sys.argv[2], sys.argv[3])
a... | {
"content_hash": "a30b17333fd16c54b004b6ba3d18bba5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 124,
"avg_line_length": 38.34285714285714,
"alnum_prop": 0.4992548435171386,
"repo_name": "SVADemoAPP/AmqpCode",
"id": "8e49d00781994bbe26b8260357c7cc5729066e59",
"size": "... |
from proxy_handler import *
import requests
from requests.exceptions import *
def grab_code_from_page(page_url, ip_address="0"):
"""
Function to get the source code of the url provided
:param ip_address: Proxy IP Address
:param page_url: URL of the page
:returns: string formatted source code
... | {
"content_hash": "f55fe5cc9fbc0399b184bad6cde1fafd",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 101,
"avg_line_length": 35.5,
"alnum_prop": 0.6050469483568075,
"repo_name": "Shivamohan07/snapdeal_crawler",
"id": "4323039a4afd238ff939fc9b0b6bd8af5f0424da",
"size": "170... |
"""``pytest_caselogger.py``
`Plugin is getting logs for each test case`
"""
import time
import pytest
from .pytest_helpers import get_tcname
from .pytest_onsenv import setup_scope
from testlib import caselogger
def pytest_addoption(parser):
"""Describe plugin specified options.
"""
group = parser.ge... | {
"content_hash": "b3982128f7d4af5258bdd3ec87c43be5",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 129,
"avg_line_length": 36.66867469879518,
"alnum_prop": 0.6071956628881222,
"repo_name": "taf3/taf",
"id": "3d9a300af277c52ff1b62aa7ebe806a0ef182352",
"size": "6681",
"... |
import torch
import ocnn
import torch.nn
import torch.nn.functional as F
class OUNet(torch.nn.Module):
def __init__(self, depth, channel_in, nout, full_depth=2):
super().__init__()
self.depth = depth
self.channel_in = channel_in
self.nout = nout
self.full_depth = full_depth
self.nempty = Fal... | {
"content_hash": "93ec23b7e747f0e6d99039398d32beac",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 75,
"avg_line_length": 37.61267605633803,
"alnum_prop": 0.6264744429882044,
"repo_name": "microsoft/O-CNN",
"id": "35a2626909fac7f20b8d715eb34f7d131741cccc",
"size": "5341... |
"""Remove error field from task_queue
Revision ID: 5686f64a46c8
Revises: dd35678aae90
Create Date: 2020-10-27 14:06:58.794701
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "5686f64a46c8"
down_revision = "dd35678aae90"
branch_labels = None
depends_on = None
... | {
"content_hash": "5837681fd9a3edc6df535995b20ab0e9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 101,
"avg_line_length": 25,
"alnum_prop": 0.6914285714285714,
"repo_name": "psi4/DatenQM",
"id": "76d65a4555e5f9a115671ab69ca01295537d0ce7",
"size": "700",
"binary": fals... |
"""Tests for tensorflow.ops.math_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
fro... | {
"content_hash": "a07d7753684f036431edf47f5e00d047",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 80,
"avg_line_length": 36.31481481481482,
"alnum_prop": 0.6216216216216216,
"repo_name": "anand-c-goog/tensorflow",
"id": "8b40c8599e5cfc0e77c50772ba215921e9c5e157",
"size... |
from __future__ import unicode_literals
from django.test import TestCase
from django.utils import six
from .models import (Building, Child, Device, Port, Item, Country, Connection,
ClientStatus, State, Client, SpecialClient, TUser, Person, Student,
Organizer, Class, Enrollment, Hen, Chick, A, B, C)
class Se... | {
"content_hash": "5e2912cfda4dec5cd887b490f40a1d36",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 131,
"avg_line_length": 47.974489795918366,
"alnum_prop": 0.6424545357864512,
"repo_name": "lecaoquochung/ddnb.django",
"id": "4a498d707a5b7ad6ab4d08080d4ef71cd673397d",
"... |
"""
Elliptic Curve Library
Copyright 2017 Ivan Sarno
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 ag... | {
"content_hash": "f8e7437243943e80f1bf44996fe2847e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 72,
"avg_line_length": 23.723076923076924,
"alnum_prop": 0.6076523994811932,
"repo_name": "ivansarno/EllipticCurvesLibrary",
"id": "f861ce3189e1dd7d21ec929b0f6762295da6aeb6",... |
"""EasyEngine core variable module"""
import platform
import socket
import configparser
import os
import sys
import psutil
import datetime
class EEVariables():
"""Intialization of core variables"""
# EasyEngine version
ee_version = "3.2.2"
# EasyEngine packages versions
ee_wp_cli = "0.19.1"
... | {
"content_hash": "b0093a027c8c421184b1dacd34bcf4b1",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 79,
"avg_line_length": 36.33734939759036,
"alnum_prop": 0.5830570291777188,
"repo_name": "rjdp/EE-dbmigrate",
"id": "c615dc0b7b3a91178a82dc211b4fab3b04cb9d41",
"size": "60... |
"""Plugged In Status Support for the Nissan Leaf."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from . import DATA_CHARGING, DATA_LEAF, DATA_PLUGGED_IN, LeafEntity
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info=None):
... | {
"content_hash": "84911abac8854cba37f347f83af9de9f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 72,
"avg_line_length": 27.109375,
"alnum_prop": 0.6334293948126801,
"repo_name": "leppa/home-assistant",
"id": "1ee450df87d0ad3b70274869632af9ab9ca86454",
"size": "1735",
... |
from google.cloud import gke_backup_v1
async def sample_update_restore():
# Create a client
client = gke_backup_v1.BackupForGKEAsyncClient()
# Initialize request argument(s)
restore = gke_backup_v1.Restore()
restore.backup = "backup_value"
request = gke_backup_v1.UpdateRestoreRequest(
... | {
"content_hash": "d2eacb6455fe5eb4aff634d370cd1edc",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 63,
"avg_line_length": 24.153846153846153,
"alnum_prop": 0.7006369426751592,
"repo_name": "googleapis/python-gke-backup",
"id": "c5e3115c4b0937d8f3bf48e9f9a106901178bce6",
... |
''' Tests for chronicler.decorators.audits '''
from mock import Mock
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from chronicler.models import AuditItem
from chronicler.decorators import audits
from chronicler.tests import TestCase
from chronicler.tests.mode... | {
"content_hash": "9a53c727b42d732b554f316f890eabda",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 75,
"avg_line_length": 34.62264150943396,
"alnum_prop": 0.6452316076294278,
"repo_name": "analytehealth/chronicler",
"id": "46d63a78bf9593fc08d8c6d9f37dfe00cf696ae0",
"siz... |
__author__ = 'swhite'
# Non-admin non-project specific web views (not REST API views)
REGULAR_WEB_VIEWS = (
'home',
'view_markers',
'view_fluorochromes',
'view_parameters',
'view_specimens',
'add_project',
'view_sample_groups',
)
# Admin views not tied to a project and not REST API views
A... | {
"content_hash": "5d2b0252cc28e6352e7bba6d8357f808",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 63,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.625,
"repo_name": "whitews/ReFlow",
"id": "3c0e5b0f6ab2223820409a45eecfd2df1de5a595",
"size": "448",
"binary": ... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 0, transform = "Quantization", sigma = 0.0, exog_count = 100, ar_order = 0); | {
"content_hash": "eb3a565440506f38802fd7df72b6722d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 170,
"avg_line_length": 38.57142857142857,
"alnum_prop": 0.7111111111111111,
"repo_name": "antoinecarme/pyaf",
"id": "7e06d6048393ea4fc68675e2a3f70426328d7e21",
"size": "270... |
"""
Generator classes to produce random data with specific properties.
"""
import datetime as dt
import logging
import numpy as np
import shapely
from faker import Faker
from functools import partial
from itertools import count, islice
from queue import Queue, Full
from random import Random
from shapely.geometry impor... | {
"content_hash": "a3fe74fddbe8e802c1117d8765a2d726",
"timestamp": "",
"source": "github",
"line_count": 1025,
"max_line_length": 150,
"avg_line_length": 32.9609756097561,
"alnum_prop": 0.6034926742637265,
"repo_name": "maxalbert/tohu",
"id": "fe1c682b4ffe2ed6bbab5e2c53a21332c572b710",
"size": "3380... |
"""Unit test package for ahps_alerts."""
| {
"content_hash": "515477444490f67623878d2c561f8c55",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 41,
"alnum_prop": 0.6829268292682927,
"repo_name": "DavidHickman/ahps_alerts",
"id": "0a3f057a0e7d2280e2e34d8b87a3d78399e1fbdf",
"size": "66",
"bina... |
import os
from dpa.action import Action, ActionError, ActionAborted
from dpa.location import current_location_code
from dpa.product import Product, ProductError, validate_product_name
from dpa.product.version import ProductVersion, ProductVersionError
from dpa.product.representation import (
ProductRepresentation,... | {
"content_hash": "c35acae5ca01dcefff8ab0b48c78ed5e",
"timestamp": "",
"source": "github",
"line_count": 556,
"max_line_length": 80,
"avg_line_length": 33.710431654676256,
"alnum_prop": 0.45697060235821374,
"repo_name": "Clemson-DPA/dpa-pipe",
"id": "48e7338f8cdbe57d51c9602439628f42836a4379",
"size"... |
people = 30
cars = 40
buses = 15
if cars > people:
print "We should take the cars."
elif cars < people:
print "We should not take the cars."
else:
print "We can't decide."
if buses > cars:
print "That's too many buses."
elif buses < cars:
print "Maybe we could take the buses."
else:
print "We still can't decid... | {
"content_hash": "a40fdfeef6d7d3ada967631f12d63228",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 44,
"avg_line_length": 18.73913043478261,
"alnum_prop": 0.6821345707656613,
"repo_name": "kaitlinahrens/learn-python-the-hard-way",
"id": "26a81f0fd77726e04abf7bd504706b77a47... |
from __future__ import unicode_literals
from prompt_toolkit.keys import Keys
from ..key_bindings import KeyBindings
__all__ = [
'load_cpr_bindings',
]
def load_cpr_bindings():
key_bindings = KeyBindings()
@key_bindings.add(Keys.CPRResponse, save_before=lambda e: False)
def _(event):
"""
... | {
"content_hash": "56efbe41aabd920bff9b0cc5c387491c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 68,
"avg_line_length": 27.08,
"alnum_prop": 0.6440177252584933,
"repo_name": "lmregus/Portfolio",
"id": "bc3334a22039abb673aeb0b737daf43c05cecceb",
"size": "677",
"binary... |
import sys
def version(prog):
print(prog, "0.0.1")
def opterr(prog, wrngopt):
print("%s: invalid option -- \'%s\'" % (prog, wrngopt.opt), file=sys.stderr)
print("Try \'%s --help\' for more information." % (prog), file=sys.stderr)
exit(1)
def ferr(prog, file):
print("%s: %s: No such file or dir... | {
"content_hash": "9f4e5a3e8e00b8fbb555d70317e6a634",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 25.964285714285715,
"alnum_prop": 0.5969738651994498,
"repo_name": "FreeBirdLjj/py-coreutils",
"id": "a71f409ebfc944ebdb323e9d96c3b1248147fc67",
"siz... |
import xml.etree.ElementTree as ET
class brocade_firmware(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def firmware_autoupgrade_enable(self, **kwargs):
"""Auto Generated Code
"""
config = ET.El... | {
"content_hash": "f3a32345dce744a518bd40d11d0060f6",
"timestamp": "",
"source": "github",
"line_count": 1478,
"max_line_length": 112,
"avg_line_length": 43.08592692828146,
"alnum_prop": 0.6287746737645451,
"repo_name": "SivagnanamCiena/pynos",
"id": "c3b4ef40b947aeda86aedc6acc216a2fba9940ca",
"size... |
from .base import *
from .airos import * | {
"content_hash": "c523e5699f2691f5b9620f71f70d6759",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 20,
"avg_line_length": 20,
"alnum_prop": 0.725,
"repo_name": "ninuxorg/netengine",
"id": "bc70f2cb2bcf1ff374a1f7c1f28a59b118a3180d",
"size": "40",
"binary": false,
"copi... |
from oslo_versionedobjects import fields
from magnum.db import api as dbapi
from magnum.objects import base
# possible status
ERROR = 'Error'
RUNNING = 'Running'
STOPPED = 'Stopped'
PAUSED = 'Paused'
@base.MagnumObjectRegistry.register
class Container(base.MagnumPersistentObject, base.MagnumObject,
... | {
"content_hash": "c79214d0dcac2a227c0ec810a8da15b0",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 82,
"avg_line_length": 39.15882352941176,
"alnum_prop": 0.5995193029893345,
"repo_name": "ramielrowe/magnum",
"id": "fefd460f401f5f4ce8e129e4b2b04e38488ba490",
"size": "72... |
from __future__ import print_function, unicode_literals
import threading
_counters = {}
_counter_lock = threading.Lock()
def next_counter(name):
with _counter_lock:
cur = _counters[name] = _counters.get(name, 0) + 1
return cur
def next_name(name):
return "%s-%i" % (name, next_counter(name))
| {
"content_hash": "6525a7eb29f40c2542785bc8da08cb28",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 58,
"avg_line_length": 21.133333333333333,
"alnum_prop": 0.6529968454258676,
"repo_name": "morelab/weblabdeusto",
"id": "b7af0dcf0e182e43ffa1d3afe3d53705901159ce",
"size": ... |
from .backends.couch import TendersStorage, ReleasesStorage
from .backends.fs import FSStorage
__all__ = [TendersStorage, ReleasesStorage, FSStorage]
| {
"content_hash": "9b70e0d87a7526310068116187525498",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 59,
"avg_line_length": 37.75,
"alnum_prop": 0.8079470198675497,
"repo_name": "yshalenyk/ocds.storage",
"id": "50deea64753eba9045450fdf6f3f14ab567b408c",
"size": "151",
"bi... |
"""Workflow for serving static content of Django projects."""
from django_cloud_deploy.cloudlib import storage
from google.auth import credentials
class StaticContentServeWorkflow(object):
"""A class to control the workflow of serving static content."""
# The directory in Google Cloud Storage bucket to sav... | {
"content_hash": "27f075c3637212aec547caa94519db1d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 41.940298507462686,
"alnum_prop": 0.6274021352313167,
"repo_name": "GoogleCloudPlatform/django-cloud-deploy",
"id": "191a59714c4487090ca3380745d220f888... |
from google.cloud import datacatalog_v1
def sample_update_taxonomy():
# Create a client
client = datacatalog_v1.PolicyTagManagerClient()
# Initialize request argument(s)
request = datacatalog_v1.UpdateTaxonomyRequest(
)
# Make the request
response = client.update_taxonomy(request=request... | {
"content_hash": "1695a4d2b27fd07acd56059d373e73cd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 69,
"avg_line_length": 24.444444444444443,
"alnum_prop": 0.7340909090909091,
"repo_name": "googleapis/python-datacatalog",
"id": "ea3262c0cda22bff8452aa1c00df7239e39da96a",
... |
"""
monolith is an argparse based command line interface framework
"""
VERSION = (0, 3, 4, 'dev')
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
return '.'.join((str(each) for each in VERSION[:4]))
| {
"content_hash": "e1a351721f8f2347228f1ce3115888d1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 23.923076923076923,
"alnum_prop": 0.617363344051447,
"repo_name": "lukaszb/monolith",
"id": "f21d61b04994aa22d23a10063369bc218f10f10b",
"size": "311"... |
import sys, os
from distutils.core import setup, Extension
# Below ROOT, we expect to find include, include/libxml2, lib and bin.
# On *nix, it is not needed (but should not harm),
# on Windows, it is set by configure.js.
ROOT = r'/usr'
# Thread-enabled libxml2
with_threads = 1
# If this flag is set (windows only),
... | {
"content_hash": "c727d0c2a09761dace536bf1d80d52f4",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 78,
"avg_line_length": 28.962184873949578,
"alnum_prop": 0.5927752792688235,
"repo_name": "schober2/tc359_helper_methods",
"id": "e5043237c78111e9fa78ae0fe95624a7af9064e2",
... |
"""Example code of learning a large scale convnet from LSVRC2012 dataset
with multiple GPUs using data parallelism.
Prerequisite: To run this example, crop the center of ILSVRC2012 training and
validation images, scale them to 256x256 and convert them to RGB, and make
two lists of space-separated CSV whose first colum... | {
"content_hash": "24e57421f9e5f77774b52278c80c415f",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 40.148148148148145,
"alnum_prop": 0.6452029520295203,
"repo_name": "tkerola/chainer",
"id": "a41c5f50bf54cf5d2ea8b03f5afcbe668f5a3d4f",
"size": "544... |
"""Submit one or more try jobs."""
import argparse
import json
import os
import re
import subprocess
import sys
import tempfile
BUCKET_SKIA_PRIMARY = 'skia/skia.primary'
BUCKET_SKIA_INTERNAL = 'skia-internal/skia.internal'
INFRA_BOTS = os.path.join('infra', 'bots')
TASKS_JSON = os.path.join(INFRA_BOTS, 'tasks.json'... | {
"content_hash": "26401e142fdcedb39a924742d80e3f48",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 80,
"avg_line_length": 31.316901408450704,
"alnum_prop": 0.6210928715988306,
"repo_name": "HalCanary/skia-hc",
"id": "ccf9c2f09637a9bee7552df5cd1fb8fa33ea1476",
"size": "4... |
"""Common utility library."""
from __future__ import with_statement
import datetime
import functools
import inspect
import os
import re
import sys
import six
__all__ = [
'Error',
'decode_datetime',
'get_package_for_module',
'positional',
'TimeZoneOffset',
'total_seconds',
]
class Error(Exce... | {
"content_hash": "6c75c3b2acba3547b4a26627e1d6d02b",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 80,
"avg_line_length": 31.31159420289855,
"alnum_prop": 0.5889840314741958,
"repo_name": "KaranToor/MA450",
"id": "4df045869d7a8fccfa99de8002009ab6ef81866e",
"size": "9243... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.