text stringlengths 4 1.02M | meta dict |
|---|---|
"""
==================================================
Explicit feature map approximation for RBF kernels
==================================================
.. currentmodule:: sklearn.kernel_approximation
An example shows how to use :class:`RBFSampler` and :class:`Nystrom` to
appoximate the feature map of an RBF kern... | {
"content_hash": "9b5ea78ef4c35188dbc9e484f08efdfc",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 79,
"avg_line_length": 38.17874396135266,
"alnum_prop": 0.7070732633177275,
"repo_name": "kmike/scikit-learn",
"id": "6ce66fece207f9268bffd8b15a9b8aa5acec4be7",
"size": "7... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.vision_v1p4beta1.proto import (
product_search_service_pb2 as google_dot_cloud_dot_vision__v1p4beta1_dot_proto_dot_product__search__service__pb2,
)
from google.longrunning import (
operations_pb2 as google_dot_l... | {
"content_hash": "05f3914f4d13553f7bbb519fe197eeff",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 167,
"avg_line_length": 54.85660377358491,
"alnum_prop": 0.726078283001995,
"repo_name": "tseaver/google-cloud-python",
"id": "0d1f9704cb5ae89daef1613f8c0353c65ed82aa3",
"... |
import six
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
class QuotasTest(base.BaseAdminNetworkTest):
"""Tests the following operations in the Neutron API:
list quotas for tenants who have non-defau... | {
"content_hash": "f04f266822f6ecf90a0023efcc8bbcb4",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 77,
"avg_line_length": 38.666666666666664,
"alnum_prop": 0.6434729064039408,
"repo_name": "zsoltdudas/lis-tempest",
"id": "d72e960d26936b7b88798b023d7785ced7dc98de",
"size"... |
import re
import config
import util
from datetime import date
def nick_tracker(log_dict, track_users_on_channels = False):
"""
Tracks all nicks and the identifies nicks which point to same user
Args:
log_dict(dictionary): with key as dateTime.date object and value as {"data":datalist,"channel... | {
"content_hash": "eaaf6174c202b0deea5aa47313c3c527",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 155,
"avg_line_length": 43.5,
"alnum_prop": 0.5063291139240507,
"repo_name": "rohangoel96/IRCLogParser",
"id": "b4bd11b34571f7e9936a1b6cd43b4d917cfa2f22",
"size": "6873",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wireless', '0002_standardize_id_fields'),
]
operations = [
migrations.AlterField(
model_name='wirelesslan',
name='created',
field=models.DateTimeField(au... | {
"content_hash": "fcaa12916fdcdb7a30e8be9daff7a827",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 69,
"avg_line_length": 28,
"alnum_prop": 0.5728021978021978,
"repo_name": "digitalocean/netbox",
"id": "fe251248c02135886f1b63176814ef03aec9cc42",
"size": "777",
"binary"... |
from antlr4.IntervalSet import IntervalSet
from antlr4.Token import Token
# need forward declarations
from antlr4.atn.SemanticContext import Predicate, PrecedencePredicate
ATNState = None
RuleStartState = None
class Transition (object):
__slots__ = ('target','isEpsilon','label')
# constants for serializatio... | {
"content_hash": "6087166d77d612a3aef940dacf60163d",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 102,
"avg_line_length": 31.944,
"alnum_prop": 0.6342349110944152,
"repo_name": "ericvergnaud/antlr4",
"id": "2e4c9971763c34dbb2690660434c5c99d44193e1",
"size": "8762",
"... |
from django.contrib import admin
from django import forms
from django.db import models
from dailyrings.models import Image
class DifferentlySizedTextarea(forms.Textarea):
def __init__(self, *args, **kwargs):
attrs = kwargs.setdefault('attrs', {})
attrs.setdefault('cols', 40)
attrs.setdefault... | {
"content_hash": "83928460974637c7660c6b4924245775",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 95,
"avg_line_length": 35.516129032258064,
"alnum_prop": 0.6394187102633969,
"repo_name": "basilleaf/dailyrings",
"id": "422d5c9fafe92bd0ae49d796ce3693e94416ea92",
"size": ... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.synapse import SynapseManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-synapse
# USAGE
python kusto_pools_list_by_workspace.py
Before run the sample, please set the values of the client ID, tenant I... | {
"content_hash": "226da960381300b1ee3b6d843f5d2c5c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 145,
"avg_line_length": 34.06060606060606,
"alnum_prop": 0.7375444839857651,
"repo_name": "Azure/azure-sdk-for-python",
"id": "739de25d2543022cfa15c35fff7e498c54910e79",
"s... |
"""TPUEstimator class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import os
import signal
import threading
import time
import traceback
import numpy as np
import six
from six.moves import queue as Queue # pylint: dis... | {
"content_hash": "d987b7cb21557b965e64d4832c67ad5f",
"timestamp": "",
"source": "github",
"line_count": 3045,
"max_line_length": 112,
"avg_line_length": 39.20656814449918,
"alnum_prop": 0.6581283924143939,
"repo_name": "nburn42/tensorflow",
"id": "aeb7ba536f56cb3751553fe13f3ba28958196869",
"size": ... |
def find_second(search, target):
return search.find(target, search.find(target) + 1)
danton = "De l'audace, encore de l'audace, toujours de l'audace"
print find_second(danton, 'audace')
#>>> 25
twister = "she sells seashells by the seashore"
print find_second(twister,'she')
#>>> 13 | {
"content_hash": "c6abad1ee3609f05fb4fd8cb1dc2cae0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 28.8,
"alnum_prop": 0.7083333333333334,
"repo_name": "mi1980/projecthadoop3",
"id": "f3c012468c62210abd15a8f95ed5a9b4cdc47ee0",
"size": "523",
"bin... |
"""
This module implement a storage adapter interface.
"""
class ImagineAdapterInterface(object):
"""
Storage adapter interface
"""
def get_item(self, path):
"""
Get resource item
:param path: string
:return: PIL.Image
"""
raise NotImplementedError()
... | {
"content_hash": "f8face489f03ad63a3922ac981ea4db4",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 50,
"avg_line_length": 22.6734693877551,
"alnum_prop": 0.5526552655265526,
"repo_name": "FlaskGuys/Flask-Imagine",
"id": "4a93303f86bf4c0c472f16aee396c0e3cccfeea8",
"size":... |
from __future__ import absolute_import
from __future__ import unicode_literals
import itertools
import os
from ..variants import revcomp
try:
from pyfaidx import Genome as SequenceFileDB
# Allow pyflakes to ignore redefinition in except clause.
SequenceFileDB
except ImportError:
SequenceFileDB = Non... | {
"content_hash": "0ab0a09fea881a0d78dcc8affc7e327c",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 79,
"avg_line_length": 33.30057803468208,
"alnum_prop": 0.5717757333796216,
"repo_name": "counsyl/hgvs",
"id": "5c53da6ad220cbf5f19935388e6880aac31e23c5",
"size": "5761",
... |
from flask.ext import wtf
import auth
import flask
import model
import wtforms
import util
from main import app
###############################################################################
# Create
###############################################################################
class PayUpdateForm(wtf.Form):
nam... | {
"content_hash": "9daac556b089bbc689589758cc8ec5ac",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 92,
"avg_line_length": 31.14814814814815,
"alnum_prop": 0.5378517637732858,
"repo_name": "georgekis/salary",
"id": "d551ac674cb1f90991d221374300b9e61d0ff35d",
"size": "2523... |
import base64
import datetime
import sys
import time
import unittest
import xmlrpclib
import SimpleXMLRPCServer
import mimetools
import httplib
import socket
import StringIO
import os
import re
from test import test_support
try:
import threading
except ImportError:
threading = None
try:
... | {
"content_hash": "036f2795c5513d49fe0259a3c8c84f1f",
"timestamp": "",
"source": "github",
"line_count": 1018,
"max_line_length": 88,
"avg_line_length": 38.95383104125737,
"alnum_prop": 0.59750346740638,
"repo_name": "MattDevo/edk2",
"id": "5e3bc1f94d11531c3b4951fb31d3c08000a8f0c8",
"size": "39655",... |
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.images.models
class Migration(migrations.Migration):
dependencies = [
('images', '0003_auto_20160405_1542'),
]
operations = [
migrations.AlterField(
model_name='attributedrenditio... | {
"content_hash": "fedd23758cc867123a5fd9bd82d97c60",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 137,
"avg_line_length": 26.526315789473685,
"alnum_prop": 0.6488095238095238,
"repo_name": "OpenCanada/website",
"id": "d4c77b1a26c287554651e6a15191ae129fda0e2d",
"size": "... |
from abc import ABCMeta, abstractmethod
class BaseClient:
"""This class plays a role as an interface defining methods for agent to
communicate with teletraan service.
"""
__metaclass__ = ABCMeta
@abstractmethod
def send_reports(self, env_reports=None):
"""Args:
env_re... | {
"content_hash": "08c2f62142bac826e0bf123206239497",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 25.94736842105263,
"alnum_prop": 0.6348884381338742,
"repo_name": "nickdechant/teletraan",
"id": "39d6b77c6d6ca90da242dc851265cf40f9d92864",
"size": ... |
from pyspark import SparkContext, SparkConf
from pyspark.streaming import StreamingContext
from pyspark.sql import SQLContext
import time
import socket
def main(sc):
# Initialize spark streaming context with a batch interval of 10 sec,
# The messages would accumulate for 10 seconds and then get processed.
ssc ... | {
"content_hash": "d20645d68291552fd2959788cf4795a7",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 71,
"avg_line_length": 22.45614035087719,
"alnum_prop": 0.73359375,
"repo_name": "xuwenyihust/Visor",
"id": "12a37bba2da49b5e75362b079c8e3ba591cf7bab",
"size": "1280",
"b... |
"""
GoRename is a Go gorename plugin for Sublime Text 3.
It depends on the gorename tool being installed:
go get -u golang.org/x/tools/cmd/gorename
"""
# TODO: review & clean
import sublime, sublime_plugin, subprocess, time, re, os, subprocess, sys, time, hashlib
DEBUG = False
VERSION = ''
use_golangconfig = False
#... | {
"content_hash": "27cde97c7781ad2a63c6b65f3fa4fb3a",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 202,
"avg_line_length": 33.66090712742981,
"alnum_prop": 0.5583573949310234,
"repo_name": "alvarolm/GoRename",
"id": "5d706c05faff5e214238243cbfe0474d58c6ed22",
"size": "1... |
import abc
from oslo_log import log as logging
import webob.exc
from neutron.api import extensions
from neutron.api.v2 import resource
from neutron.common import rpc as n_rpc
from neutron import policy
from neutron import wsgi
from neutron_lib import exceptions
from networking_cisco._i18n import _
from networking_ci... | {
"content_hash": "3fe112bae8c6bab4ee69e459934c6dbf",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 79,
"avg_line_length": 37.32258064516129,
"alnum_prop": 0.6381446269086718,
"repo_name": "noironetworks/networking-cisco",
"id": "4fb186ce77101ea3ad1d3e111a977f3e26e79fd9",
... |
from __future__ import unicode_literals, division, absolute_import
import logging
from datetime import datetime, timedelta
from sqlalchemy import Column, Integer, String, Unicode, DateTime
from sqlalchemy.schema import Index
from flexget import db_schema, options, plugin
from flexget.event import event
from flexget.l... | {
"content_hash": "2a3c12b7792a5f2835c504b379fd99b4",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 119,
"avg_line_length": 38.02857142857143,
"alnum_prop": 0.5996744302529426,
"repo_name": "camon/Flexget",
"id": "8813e3e980e0e850e87f7cf66411fd726c3dfd0c",
"size": "7986"... |
import tornado.iostream
from waterbutler.server import settings
CORS_ACCEPT_HEADERS = [
'Range',
'Content-Type',
'Authorization',
'Cache-Control',
'X-Requested-With',
'X-CSRFToken',
]
CORS_EXPOSE_HEADERS = [
'Range',
'Accept-Ranges',
'Content-Range',
'Content-Length',
'Con... | {
"content_hash": "16e23e16be07f7022c475674a95695b0",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 99,
"avg_line_length": 36.270833333333336,
"alnum_prop": 0.6350756270342715,
"repo_name": "RCOSDP/waterbutler",
"id": "a421343c402de7ba0cf55a24d080172f27e1ab23",
"size": "... |
import copy
import io
import os
import pickle
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from unittest import mock
from django.conf import settings
from django.core import management, signals
from django.core.cache import (
DEFAULT_CACHE_ALIAS, CacheKeyWarn... | {
"content_hash": "f1ec90497134da5726475269ce2cdbf4",
"timestamp": "",
"source": "github",
"line_count": 2290,
"max_line_length": 115,
"avg_line_length": 39.76681222707423,
"alnum_prop": 0.628071947818066,
"repo_name": "camilonova/django",
"id": "13023a29ae360a5b6eb5f5ec9504fb86e7edaf45",
"size": "9... |
import Confidential
message = Confidential('top secret text')
secret_field = Confidential.getDeclaredField('secret')
secret_field.setAccessible(True) # break the lock!
print 'message.secret =', secret_field.get(message)
| {
"content_hash": "74c19593539d32459104b854377f6b2a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 37,
"alnum_prop": 0.7837837837837838,
"repo_name": "Wallace-dyfq/example-code",
"id": "1df710c39026038fe44a21267ddfc0fe01e5a6c9",
"size": "222",
"bi... |
from unittest import TestCase
from mock import Mock
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.Chain... | {
"content_hash": "ac3a0ce7c0729bae63a1e94a0d8f9d9e",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 96,
"avg_line_length": 48.35,
"alnum_prop": 0.5698035160289555,
"repo_name": "theQRL/QRL",
"id": "45eaf91b152ca7cb180fef960e691218aa67557a",
"size": "4835",
"binary": fa... |
import mock
import unittest
import os
from kfp_component.google.dataflow import launch_python
MODULE = 'kfp_component.google.dataflow._launch_python'
@mock.patch(MODULE + '.storage')
@mock.patch('kfp_component.google.dataflow._common_ops.display')
@mock.patch(MODULE + '.stage_file')
@mock.patch(MODULE + '.KfpExecuti... | {
"content_hash": "3f0023ec1b2f3dfe03eb0580515831f6",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 106,
"avg_line_length": 40.78125,
"alnum_prop": 0.6386973180076628,
"repo_name": "kubeflow/pipelines",
"id": "e755b5c89a977e99bef23b2c5d4d5956e88b09ff",
"size": "3196",
"... |
import ast # Tighten your belts...
from collections import namedtuple
from ..util import pypy, iterate, chunk as chunk_, Line, ensure_buffer
Pair = namedtuple('Pair', ('prefix', 'suffix'))
WrapFormat = namedtuple('WrapFormat', ('single', 'multiple', 'intra', 'indent'))
BARE_FORMAT = WrapFormat(Pair('', ''), Pair('... | {
"content_hash": "5a4ca0ac25e99780d2f3301d433798f5",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 121,
"avg_line_length": 29.126582278481013,
"alnum_prop": 0.6604374909459655,
"repo_name": "marrow/cinje",
"id": "074e18d57395f59022c6e6674675a78ba2d71e17",
"size": "6922"... |
"""
Created on Thu Jan 4 20:54:24 2018
@author: Stefan
"""
import numpy as np
import matplotlib.pyplot as plt
from Hashable import Hashable
# from TrainingDataFromSgf import TrainingDataSgfPass
import os
import time
import random
import sqlite3
from Filters import apply_filters_by_id
import collections
import io
# n... | {
"content_hash": "07f7f15bd671af3f461b82128ec5ea83",
"timestamp": "",
"source": "github",
"line_count": 556,
"max_line_length": 148,
"avg_line_length": 46.94604316546763,
"alnum_prop": 0.5568921921691824,
"repo_name": "stefanpeidli/GoNet",
"id": "0dd6db41fa457e993a251aef8bd214b5ea523887",
"size": "... |
"""Functions to bootstrap a new cluster.
"""
import os
import os.path
import re
import logging
import time
from ganeti.cmdlib import cluster
import ganeti.rpc.node as rpc
from ganeti import ssh
from ganeti import utils
from ganeti import errors
from ganeti import config
from ganeti import constants
from ganeti impor... | {
"content_hash": "79c8800e83ca95f942b622bfdaa1b90e",
"timestamp": "",
"source": "github",
"line_count": 1197,
"max_line_length": 80,
"avg_line_length": 38.48203842940685,
"alnum_prop": 0.6476564704860734,
"repo_name": "leshchevds/ganeti",
"id": "2b668b9673642918de7112ccaecaac489e4691b5",
"size": "4... |
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.21
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class OrderStateListResponse(object):
"""
NOTE: This class is auto gener... | {
"content_hash": "582892f70d5640cfa6d0e2a67fe0ebc7",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 77,
"avg_line_length": 26.03731343283582,
"alnum_prop": 0.5316709658928059,
"repo_name": "kinow-io/kinow-python-sdk",
"id": "e8482e034433fcc98c3a259e5181f4e464a23b07",
"si... |
import pandas as pd
unrate = pd.read_csv('unrate.csv')
unrate['DATE'] = pd.to_datetime(unrate['DATE'])
print(unrate.head(12))
## 6. Introduction to Matplotlib ##
import matplotlib.pyplot as plt
plt.plot()
plt.show()
## 7. Adding Data ##
plt.plot(unrate['DATE'].head(12),unrate['VALUE'].head(12))
## 8. Fixing Axis T... | {
"content_hash": "0a0c1c048467b21a99266708b1f3b888",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 58,
"avg_line_length": 23.51851851851852,
"alnum_prop": 0.6960629921259842,
"repo_name": "vipmunot/Data-Analysis-using-Python",
"id": "6c77e3984d9a815c4bc027e44ccb8374f0ab209... |
__author__ = 'greghines'
import pymongo
client = pymongo.MongoClient()
db = client['condor_2015-01-22']
classification_collection = db["condor_classifications"]
subject_collection = db["condor_subjects"]
print subject_collection.find({"state":"complete"}).count()
for subject in subject_collection.find({"state":"com... | {
"content_hash": "5cc809218f21f1826d949fff7c8778e8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 71,
"avg_line_length": 27.071428571428573,
"alnum_prop": 0.7255936675461742,
"repo_name": "camallen/aggregation",
"id": "522c3293c5cfdea27b985a3595cc07c36af211a8",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("data_finder", "0006_loggedpostcode_api_user")]
operations = [
migrations.AlterField(
model_name="loggedpostcode",
name="api_user",
... | {
"content_hash": "d6983cfc691fb8168e324a59463c0835",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 25.25,
"alnum_prop": 0.6361386138613861,
"repo_name": "DemocracyClub/UK-Polling-Stations",
"id": "34d279e55ddefd1c50de3953d6b67a8000ba49c1",
"size": ... |
from unittest.mock import MagicMock
from unittest.mock import patch
from cauldron.session.writing.components import plotly_component
from cauldron.test.support import scaffolds
def _fake_import(*args, **kwargs):
raise ImportError('Fake Error')
class TestPlotlyComponent(scaffolds.ResultsTest):
"""..."""
... | {
"content_hash": "589869a319eb8bf63b9906afbd3c5355",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 64,
"avg_line_length": 30.645833333333332,
"alnum_prop": 0.6267845003399048,
"repo_name": "sernst/cauldron",
"id": "ff6e00ea3c80172c87b52a2e01075a94c94c2ff3",
"size": "1471... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('flisol_event', '0004_auto_20141229_2309'),
]
operations = [
migrations.AddField(
model_name='flisolattendance',
name='commen... | {
"content_hash": "4cdaa7e3376b8dbb1126667d786fd48e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 131,
"avg_line_length": 34.891891891891895,
"alnum_prop": 0.6041828040278854,
"repo_name": "ikks/flisol-connect",
"id": "7f181a7f5dc742c9be1dc97deef6d40fe44a6a48",
"size": ... |
import unittest
import code_helper
class Test0012(unittest.TestCase):
def test_problem(self):
primes = list(code_helper.range_prime(10000))
triangle_number = -1
for n in range(7000, 20000):
triangle_number = n * (n + 1) / 2
divisors = 1
s = triangle_numb... | {
"content_hash": "e45aec6533aad8a9da129cecfba858d9",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 53,
"avg_line_length": 29.16,
"alnum_prop": 0.44170096021947874,
"repo_name": "mccxj/online-judge-code-example",
"id": "bb6778ecdb438556e533c3c273782a6776df6d8a",
"size": "... |
NAME = "CocoNodz"
VERSION_MAJOR = 0
VERSION_MINOR = 0
VERSION_PATCH = 1
version_info = [str(VERSION_MAJOR), str(VERSION_MINOR), str(VERSION_PATCH)]
version = ".".join(version_info)
__version__ = version
__all__ = ["version", "version_info", "__version__"] | {
"content_hash": "90e0752540ef73b367218198ec6608fe",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 75,
"avg_line_length": 23.454545454545453,
"alnum_prop": 0.6627906976744186,
"repo_name": "rkoschmitzky/coconodz",
"id": "933080497e0d3b5f4a446fb0f7e7409d692d227d",
"size":... |
def ping(event, server):
server.send_cmd('PONG :%s', event['server'])
print 'PONG PING'
| {
"content_hash": "e3a2976ecbaa9206821441ed4a42564a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 48,
"avg_line_length": 24.25,
"alnum_prop": 0.6185567010309279,
"repo_name": "iogf/candocabot",
"id": "d6425e5b285e9e4f9125592f8628541de0e0171d",
"size": "97",
"binary": f... |
import zounds
import argparse
samplerate = zounds.SR11025()
BaseModel = zounds.stft(resample_to=samplerate, store_fft=True)
@zounds.simple_in_memory_settings
class Sound(BaseModel):
pass
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--local-path',
r... | {
"content_hash": "c54e0fe7155fec48b5d174b6d18df82a",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 70,
"avg_line_length": 24.583333333333332,
"alnum_prop": 0.6293785310734463,
"repo_name": "JohnVinyard/zounds",
"id": "b61192e3148c551ac9f3090e6c717b180694a60b",
"size": "8... |
import itertools
from heat.openstack.common import log
from heat.common import exception
LOG = log.getLogger(__name__)
class ResourceInfo(object):
"""Base mapping of resource type to implementation."""
def __new__(cls, registry, path, value, **kwargs):
'''Create a new ResourceInfo of the appropria... | {
"content_hash": "1e48f693b262fb89bcb42c25a75d4e83",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 79,
"avg_line_length": 36.97826086956522,
"alnum_prop": 0.5762156714537667,
"repo_name": "rickerc/heat_audit",
"id": "db9f2e2a67eb3f2d0b2f4689ac10d566eb2dcd99",
"size": "1... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import sys
sys.path.append("utuputki/")
sys.path.append("../utuputki/")
import settings
from common import db
settings.config_init()
# this is the Alembic Config obje... | {
"content_hash": "be20e1dea023185b85d7b246a361b994",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 69,
"avg_line_length": 28.573170731707318,
"alnum_prop": 0.7102005975245412,
"repo_name": "katajakasa/utuputki2",
"id": "48a25ad61c56c1cde0d71d3ae1859759966420a7",
"size": ... |
import mock
from oslo_config import cfg
from oslo_log import log as logging
import requests
import testtools
from mistral.actions import std_actions
from mistral.db.v2 import api as db_api
from mistral.services import workflows as wf_service
from mistral.tests import base as test_base
from mistral.tests.unit.engine im... | {
"content_hash": "d8d7cd0e5c005e89faed27f3ad12de13",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 79,
"avg_line_length": 29.427906976744186,
"alnum_prop": 0.5868500079026395,
"repo_name": "dennybaa/mistral",
"id": "5dbe8998aed2c4e617ce7a93f20bdd868cbd058b",
"size": "69... |
import hashlib
import os
import shutil
import sys
import tarfile
import imp
from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.objects import testcase
SIMDJS_ARCHIVE_REVISION = "07e2713e0c9ea19feb0732d5bd84770c87310d79"
SIMDJS_ARCHIVE_MD5 = "cf6bddf99f18800b68e782054268ee3c"
SIM... | {
"content_hash": "50312ca0c3273b14f5a2ebac33ccacdb",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 74,
"avg_line_length": 35,
"alnum_prop": 0.655952380952381,
"repo_name": "dawangjiaowolaixunshan/runtime",
"id": "c0390afd65ea2f38da8f4bc1191863bcd38bd91e",
"size": "3526",... |
from input_algorithms.errors import BadSpec, BadSpecValue
from delfick_error import DelfickError, ProgrammerError
class SalmError(DelfickError):
pass
# Explicitly make these errors in this context
BadSpec = BadSpec
BadSpecValue = BadSpecValue
ProgrammerError = ProgrammerError
class BadYaml(SalmError):
desc =... | {
"content_hash": "5dce5b795361c356b909b853816e0355",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 57,
"avg_line_length": 25.419354838709676,
"alnum_prop": 0.766497461928934,
"repo_name": "delfick/simple-aws-lambda-maker",
"id": "c19b99f02841de5e53f4175a9ea05c6e518faee3",
... |
import os
from enjoycms import create_app, db
from enjoycms.models import EnjoycmsUser
from flask.ext.script import Manager, Shell
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
def make_shell_context():
return dict(app=app, db=db, EnjoycmsUser=EnjoycmsUser)
manager.add_comma... | {
"content_hash": "5f056b148dd56daa00012f10f76b450a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 72,
"avg_line_length": 28.130434782608695,
"alnum_prop": 0.714064914992272,
"repo_name": "dev-tao/Enjoy-CMS",
"id": "09645ab3a7f826d4df183aff485b4f74c8a8096d",
"size": "672... |
from django.apps import AppConfig
from django.utils.translation import ugettext, ugettext_lazy
class LocalConfig(AppConfig):
name="mmg.jobtrak.public"
# Translators: Admin Backend - Name of Public app (appears in the header bar)
verbose_name=ugettext_lazy("Public")
| {
"content_hash": "3f5d1aecdb348cbd25d819f2a50558a0",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 81,
"avg_line_length": 35.875,
"alnum_prop": 0.7456445993031359,
"repo_name": "MarconiMediaGroup/JobTrak",
"id": "c8a71f2d81b73bfc621e18b3a0ab7156478d44a2",
"size": "287",
... |
class Widget(object):
def __init__(self, width, height):
super(Widget, self).__init__()
self.width = width
self.height = height
# Draw the widget
# canvas: curses window object to draw the widget on
# offset_{x,y}: offset of widget on window
# min{x,y}, max{x,y}: coordina... | {
"content_hash": "0b86cd74083f71a500015cd0c6aaf92f",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 29.35135135135135,
"alnum_prop": 0.6160220994475138,
"repo_name": "mrngm/madmin",
"id": "541736a065cd5d399085e4742f3a47d3bc169f95",
"size": "1086",
... |
from django import db
from django.utils import timezone
from django_rq import job
from metaci.cumulusci.models import ScratchOrgInstance
@job("short")
def prune_orgs():
"""An RQ task to mark expired orgs as deleted.
We don't need to bother calling delete_org on each expired scratch
org, we'll trust that... | {
"content_hash": "ac80a2ba713154bbbf26c59b5359e0ca",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 81,
"avg_line_length": 32.19047619047619,
"alnum_prop": 0.7144970414201184,
"repo_name": "SalesforceFoundation/mrbelvedereci",
"id": "e969694ffde23f5a9da0d1040bab82e9bca1701e... |
from i3pystatus import IntervalModule
import psutil
import getpass
class MakeWatch(IntervalModule):
"""
Watches for make jobs and notifies when they are completed.
requires: psutil
"""
settings = (
("name", "Listen for a job other than 'make' jobs"),
("running_color", "Text color ... | {
"content_hash": "1d9a1680e79cead1f3004497435401ad",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 69,
"avg_line_length": 27.636363636363637,
"alnum_prop": 0.5304276315789473,
"repo_name": "plumps/i3pystatus",
"id": "be3bd0fd4e587e9ef7be05bcefeddd501b127524",
"size": "12... |
import os
import io
import re
import json
import math
import tarfile
import zipfile
import flask
import werkzeug.exceptions
from google.protobuf import text_format
try:
import caffe_pb2
except ImportError:
# See issue #32
from caffe.proto import caffe_pb2
import caffe.draw
import digits
from digits.webapp... | {
"content_hash": "25b5daf93ad777944d41c700511180f9",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 129,
"avg_line_length": 33.90094339622642,
"alnum_prop": 0.6070683177960206,
"repo_name": "hycis/DIGITS",
"id": "9f1658df872d0ee88ee3e527d77241f2d6312a51",
"size": "7257",... |
import logging
from functools import wraps
from tornado.gen import Return
from tornado.web import RequestHandler, HTTPError
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import ujson as json
except ImportError:
import json
log = logging.getLogger(__name__)
class BaseHandler(... | {
"content_hash": "8fe2549e9d69c1c2e1b1053dedfb2786",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 86,
"avg_line_length": 25.27777777777778,
"alnum_prop": 0.5846153846153846,
"repo_name": "jgiannuzzi/pypi-server",
"id": "fa361bd04d9c16d7f135897d8d1ea0c401160fcc",
"size":... |
import subprocess
import glob
import os
import io
import time
import copy
def check_queue_length():
proc = subprocess.Popen(["squeue", "-u", "dgellis"], stdout=subprocess.PIPE)
return len(list(io.TextIOWrapper(proc.stdout, encoding="utf-8")))
def wait_for_long_queue(sleeping_time=60, limit=1000):
while ... | {
"content_hash": "6831ed87056caea4a0d48788262cfc8c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 116,
"avg_line_length": 38.97560975609756,
"alnum_prop": 0.6132665832290363,
"repo_name": "ellisdg/3DUnetCNN",
"id": "1109b2a4a286441f88bc582b956c72e57a19386b",
"size": "15... |
"""
minimal_window_string.py
Created by Shengwei on 2014-07-06.
"""
# https://oj.leetcode.com/problems/minimum-window-substring/
# tags: hard, string, hashtable, minimal, edge cases, clarification (dups)
"""
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in c... | {
"content_hash": "504a01db28462019c184cb86fdcfd52d",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 124,
"avg_line_length": 38.09803921568628,
"alnum_prop": 0.5499227997941328,
"repo_name": "CodingVault/LeetCodeInPython",
"id": "0b30eca73e05d38333630c2a9fecf1c1d67340eb",
... |
"""
Django settings for my project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import ... | {
"content_hash": "7719cf23459e86f6d506e2a6f9582d66",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 118,
"avg_line_length": 28.934426229508198,
"alnum_prop": 0.6609065155807365,
"repo_name": "agushuley/gu-django-filebrowser-no-grappelli-test",
"id": "384f9dfdbe2cd5c545039b... |
from guicore.displayscreen import EventDispatch, NewMouse
from enum import Enum
from queue import Empty
from controlevents import CEvent, TimedGetEvent
import guicore.guiutils as guiutils
import debug
import logsupport
from logsupport import ConsoleWarning
import guicore.screenmgt as screenmgt
import guicore.switcher a... | {
"content_hash": "fa7e450d44088d20b61659dee90a1268",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 118,
"avg_line_length": 32.06060606060606,
"alnum_prop": 0.724007561436673,
"repo_name": "kevinkahn/softconsole",
"id": "ab515601f3f96a56544d5189394c4e319f0d0515",
"size":... |
import ctypes
import socket
import sys
if sys.platform == 'win32':
import wmi
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class HostUtils(object):
def __init__(self):
if sys.platform == 'win32':
self._conn_cimv2 = wmi.WMI(moniker='//./root/cimv2')
... | {
"content_hash": "c4d71f91e441b49a130b1e3b134d8ee4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 76,
"avg_line_length": 36.953125,
"alnum_prop": 0.545031712473573,
"repo_name": "maheshp/novatest",
"id": "d28ce75a5e04c55fef92405f4853ab479c93fb7e",
"size": "3049",
"bin... |
import unittest
from svtplay_dl.fetcher.dash import DASH
from svtplay_dl.fetcher.hls import HLS
from svtplay_dl.fetcher.http import HTTP
from svtplay_dl.subtitle import subtitle
from svtplay_dl.utils.parser import setup_defaults
from svtplay_dl.utils.stream import audio_role
from svtplay_dl.utils.stream import format_... | {
"content_hash": "e97ba5e617a2f2d48e0b795ee076fa5a",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 98,
"avg_line_length": 40.54187192118226,
"alnum_prop": 0.5613608748481167,
"repo_name": "spaam/svtplay-dl",
"id": "61525bffa2cbfd9dc11e21dd10bec91d84891557",
"size": "823... |
import sys
import os
import rlglue.network.Network as Network
from ClientEnvironment import ClientEnvironment
# BEGIN: change made by: Akshay Narayan (05-01-2015:2243)
from types import Reward
# END: change made by: Akshay Narayan (05-01-2015:2243)
from rlglue.versions import get_svn_codec_version
from rlglue.versions... | {
"content_hash": "76859ccfc155b0b7dcf2afc95f39f1bc",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 98,
"avg_line_length": 30.44,
"alnum_prop": 0.7496714848883048,
"repo_name": "okkhoy/mo-rlglue-python-codec",
"id": "bfe352305a9ba1e847faff55914d6b4680dc4149",
"size": "238... |
from traitsui.view import *
| {
"content_hash": "d5d68f0b2a8b86b51af92c074eeb5c4c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 28,
"alnum_prop": 0.7857142857142857,
"repo_name": "enthought/etsproxy",
"id": "63f81c111b4be00be4db9d878f0c59fa959f9c14",
"size": "43",
"binary": f... |
"""Tests for plaso.output.pstorage."""
import os
import unittest
from plaso.lib import pfilter
from plaso.lib import storage
from plaso.output import interface
from plaso.output import pstorage
from tests import test_lib as shared_test_lib
from tests.output import test_lib
class PstorageTest(test_lib.OutputModuleT... | {
"content_hash": "66d507a5c8b6fb4974d007a458a1a5e4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 35.234375,
"alnum_prop": 0.6966740576496674,
"repo_name": "8u1a/plaso",
"id": "75e94f3819844ec6c715ae5a2e261358d7be85dd",
"size": "2297",
"binary":... |
import unittest
from _fields_basic_helpers import create_simple_method
from jsrn import validators
from jsrn.exceptions import ValidationError
VALIDATOR_TESTS = [
(validators.MaxValueValidator(10), 10, None),
(validators.MaxValueValidator(10), 1, None),
(validators.MaxValueValidator(10), 11, ValidationErr... | {
"content_hash": "11dc166fc7140915ece434682b1ef47e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 35.83870967741935,
"alnum_prop": 0.7407740774077408,
"repo_name": "timsavage/jsrn",
"id": "be339c683131495d40da64284a0e37544f22d56d",
"size": "1135",... |
import unittest
import lxml.etree as etree
import subprocess
from tests.common import validate, URL
class DescribeTest(unittest.TestCase):
def setUp(self):
self.url = URL + '?service=wps&request=describeprocess&version=1.0.0&identifier=all'
self.schema_url = 'http://schemas.opengis.net/wps/1.0.0... | {
"content_hash": "ac086cd98a1adaa6107ddde5248c91bb",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 96,
"avg_line_length": 28.91304347826087,
"alnum_prop": 0.706766917293233,
"repo_name": "PyWPS/pywps-4-demo",
"id": "a6fc256adba866fdd7e51a04871998e28c5d2799",
"size": "665... |
"""
TCIA CTP preparation utilities.
"""
import sys
import os
import re
from .ctp_config import ctp_collection_for_name
from ..helpers.logging import logger
from .staging_error import StagingError
# OHSU - this is OHSU-specific.
# TODO - make the format a config item.
PROP_FMT = 'QIN-%s-OHSU.ID-LOOKUP.properties'
"""
... | {
"content_hash": "b723a77dcde734e7b01c6bb9c007f077",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 78,
"avg_line_length": 32.32283464566929,
"alnum_prop": 0.6107186358099879,
"repo_name": "ohsu-qin/qipipe",
"id": "7272a100f05e7080790b8a67f3b8b3cbb41b5067",
"size": "4105... |
from twisted.internet import defer
from synapse.api.errors import SynapseError, Codes
from synapse.push import PusherConfigException
from .base import ClientV1RestServlet, client_path_pattern
import simplejson as json
class PusherRestServlet(ClientV1RestServlet):
PATTERN = client_path_pattern("/pushers/set$")
... | {
"content_hash": "e95ac20ddda90e0ae50b9aae80bfceeb",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 81,
"avg_line_length": 34.116279069767444,
"alnum_prop": 0.5644171779141104,
"repo_name": "howethomas/synapse",
"id": "c83287c028d5956142972a77f5f8a89e040405f4",
"size": "3... |
import pytest
from polygraphy.tools.args import ModelArgs, TfLoadArgs
from tests.models.meta import TF_MODELS
from tests.tools.args.helper import ArgGroupTestHelper
tf = pytest.importorskip("tensorflow")
class TestTfLoaderArgs:
def test_load_graph(self):
arg_group = ArgGroupTestHelper(TfLoadArgs(), deps=... | {
"content_hash": "12bd971937efa9d9e461d70a61fd0ed3",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 81,
"avg_line_length": 34.5,
"alnum_prop": 0.7119565217391305,
"repo_name": "NVIDIA/TensorRT",
"id": "dd2a4c2b5c11a3b15cd456d4146847a1ca3de872",
"size": "1241",
"binary":... |
import datetime
import tempfile
from django.db import models
# Can't import as "forms" due to implementation details in the test suite (the
# current file is called "forms" and is already imported).
from django import forms as django_forms
from django.core.files.storage import FileSystemStorage
temp_storage_location ... | {
"content_hash": "291976cbe0b49b22fa0110fbaa7284fc",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 138,
"avg_line_length": 34.725,
"alnum_prop": 0.7041036717062635,
"repo_name": "chewable/django",
"id": "86bfb4b920c0791860630b93f5e986b3b8f8f639",
"size": "2904",
"binar... |
"""
Pretrained wizard of wikipedia end2end generative model.
"""
from parlai.core.build_data import download_models
def download(datapath):
opt = {'datapath': datapath}
fnames = ['end2end_generator_0.tar.gz']
download_models(
opt, fnames, 'wizard_of_wikipedia', version='v0.5', use_model_type=Fals... | {
"content_hash": "29c0fbeb9ad7193c0388cb791a66bc85",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 25.23076923076923,
"alnum_prop": 0.6859756097560976,
"repo_name": "facebookresearch/ParlAI",
"id": "4e36f136b9dd103fcacadf9c00855263656cc772",
"size"... |
"""Stack object."""
from oslo_log import log as logging
from oslo_versionedobjects import base
from oslo_versionedobjects import fields
import six
from heat.common import exception
from heat.common.i18n import _
from heat.common import identifier
from heat.db.sqlalchemy import api as db_api
from heat.objects import b... | {
"content_hash": "2f019a12a14e377a15bb1be708914a5d",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 79,
"avg_line_length": 36.968992248062015,
"alnum_prop": 0.578842524638289,
"repo_name": "noironetworks/heat",
"id": "a6904865d3c6d86607dc9abc4733bedca302c97c",
"size": "1... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "54f183e3a4c2953886ca69e1374161fd",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 76,
"avg_line_length": 30.834615384615386,
"alnum_prop": 0.7031308469502308,
"repo_name": "classtag/nba-prediction",
"id": "31a196f73f6aaf24e49d2f9554e40bb9bd2361c0",
"siz... |
import glob
import gzip
import sys
import re
from math import sqrt,log
class GoogleNgrams:
'''
gzip_dir is the name of a directory containing the
gzipped parts of the ngrams data.
'''
def __init__(self, gzip_dir):
self.gzip_dir = gzip_dir
# Index the start word of each file
... | {
"content_hash": "dfe10fcd156c563d170b0b6be7b1ff4b",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 109,
"avg_line_length": 30.434782608695652,
"alnum_prop": 0.5464285714285714,
"repo_name": "jayantk/pnp",
"id": "dfa90659921598bef5aa9f756a68917c296197b4",
"size": "1400",
... |
"""
.. _tut-inplace:
Modifying data in-place
=======================
Many of MNE-Python's data objects (`~mne.io.Raw`, `~mne.Epochs`, `~mne.Evoked`,
etc) have methods that modify the data in-place (either optionally or
obligatorily). This can be advantageous when working with large datasets
because it reduces the amo... | {
"content_hash": "bda4f1754a3f3e3b950d956a1b368849",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 79,
"avg_line_length": 38.857142857142854,
"alnum_prop": 0.7017156862745098,
"repo_name": "mne-tools/mne-tools.github.io",
"id": "6d6fa1dfaaef9b39dadd182d44ef3babe62d618e",
... |
from mock import MagicMock
from scrapy import signals
from twisted.internet.defer import Deferred
from twisted.trial import unittest
from scrapyrt.core import CrawlManager, ScrapyrtCrawlerProcess
from .spiders import MetaSpider
from .utils import get_settings
class CralwerProcessTestCase(unittest.TestCase):
de... | {
"content_hash": "53671ed66513a30ef43b3788d1e99b72",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 38.15555555555556,
"alnum_prop": 0.6423995340710542,
"repo_name": "pawelmhm/scrapyrt",
"id": "c418e17d6783d084dbcc7e5e17a43d92ce93d490",
"size": "174... |
def <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">a<caret>wait</warning>():
pass | {
"content_hash": "1ad15413b9d2a47a15c81c9ff934c3b1",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 109,
"avg_line_length": 59,
"alnum_prop": 0.7033898305084746,
"repo_name": "msebire/intellij-community",
"id": "308f572d59a7c1813cd66e3c2244b3bb94ee34e0",
"size": "118",
"... |
from file_system_image import FileSystemImage
from support_team import SupportTeam
from timeout import timeout
from subprocess import check_call
class Media:
def __init__(self, id, url, status):
self.id = id
self.url = url
self.status = status
@timeout(30)
def download(self):
... | {
"content_hash": "412f2e1f96ded1104d1fb1a0ccdf45bf",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 85,
"avg_line_length": 35,
"alnum_prop": 0.6142857142857143,
"repo_name": "camswords/raspberry-pi-instagram-printer",
"id": "4c18cc226c41645ad6948b0904805f4278eaa1a1",
"siz... |
import os, sys, subprocess
passed = []
ignore = ('fails_', 'giws_', 'unreal_', 'verilog', 'nuitka_', 'nim_', 'java_', 'custom_', 'cpython_', 'nodejs_')
ignoreosx = ['hello_cpython.md']
## rust is broken on fedora? Travis uses Debian.
TODO_FIX = (
'async_channels_rust.md', # rustc: error while loading shared librarie... | {
"content_hash": "5755f111f3203dabc7e13d0579e6cad4",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 160,
"avg_line_length": 24.46808510638298,
"alnum_prop": 0.668695652173913,
"repo_name": "rootfs/Rusthon",
"id": "1f8744160d6ac96199f3b7ed3a007ccc0d04286d",
"size": "1150",... |
"""
RFC 3744 (WebDAV Access Control Protocol) XML Elements
This module provides XML element definitions for use with WebDAV.
See RFC 3744: http://www.ietf.org/rfc/rfc3744.txt
"""
__all__ = []
from txdav.xml.base import WebDAVElement, PCDATAElement
from txdav.xml.base import WebDAVEmptyElement, WebDAVTextElement
fr... | {
"content_hash": "f90a5025c5ab537a32e5a9a0e7758792",
"timestamp": "",
"source": "github",
"line_count": 976,
"max_line_length": 131,
"avg_line_length": 26.045081967213115,
"alnum_prop": 0.6212037765538946,
"repo_name": "trevor/calendarserver",
"id": "d793651d5e8ab7c9ba78e5b1656d2dcd4f85ddcf",
"size... |
import inspect
import warnings
from pandas.util._exceptions import find_stack_level
from pandas._testing import * # noqa:F401,F403,PDF014
warnings.warn(
(
"pandas.util.testing is deprecated. Use the functions in the "
"public API at pandas.testing instead."
),
FutureWarning,
stacklev... | {
"content_hash": "35c1908d2daa882372c4f9564655415d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 70,
"avg_line_length": 24.466666666666665,
"alnum_prop": 0.7084468664850136,
"repo_name": "datapythonista/pandas",
"id": "5585ea0b5862844b8aa4c52adf74a3bae0141a8a",
"size":... |
"""Download handlers for http and https schemes
"""
from twisted.internet import reactor
from pyrake.utils.misc import load_object
class HTTP10DownloadHandler(object):
def __init__(self, settings):
self.HTTPClientFactory = load_object(settings['DOWNLOADER_HTTPCLIENTFACTORY'])
self.ClientContextFa... | {
"content_hash": "b5cc3bcdcb9dc597d70e148f5fcc404f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 92,
"avg_line_length": 36.84,
"alnum_prop": 0.6634093376764386,
"repo_name": "elkingtowa/pyrake",
"id": "80607dfb1a0edc82161156778ef754f451a30455",
"size": "921",
"binary... |
import numpy as np
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from ... | {
"content_hash": "f56f7b23b75905bddaadd2fe7ae48a25",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 78,
"avg_line_length": 39.435,
"alnum_prop": 0.6845441866362368,
"repo_name": "clemkoa/scikit-learn",
"id": "6efec43dce37bbe947dc4d5f377eee5e383336b4",
"size": "7887",
"... |
from __future__ import print_function
import sys
sys.path.append('../')
sys.path.append('../../')
import argparse
import logging
import time
import os
import glob
import pickle
from progressbar import ProgressBar
import xml.etree.ElementTree as ET
import csv
import numpy as np
from chainer import optimizers, cuda, Var... | {
"content_hash": "4ef9ce1dbb7e443a34931ba2d728194c",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 164,
"avg_line_length": 35.45897435897436,
"alnum_prop": 0.5714802227203702,
"repo_name": "TakuTsuzuki/Hackathon2015",
"id": "55d00f1e61a3841fe151dcddcef5987cc021bff6",
"s... |
from panda3d.direct import WaitInterval
from panda3d.core import Vec3
from direct.interval.IntervalGlobal import Sequence, Parallel, Wait, Func
from direct.interval.IntervalGlobal import LerpScaleInterval
from direct.interval.IntervalGlobal import WaitInterval, ActorInterval, FunctionInterval
from direct.task.Task... | {
"content_hash": "637a336de5a5a413a03466d43ab7f892",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 326,
"avg_line_length": 40.702127659574465,
"alnum_prop": 0.6382645060115003,
"repo_name": "DedMemez/ODS-August-2017",
"id": "425bea5f605b0741992cb82e3c67574a3a2a3ecf",
"s... |
"""
Example usage of 1-D stack plot widget
"""
# imports to future-proof the code
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from six.moves import zip
import sys
import numpy as np
from collections import OrderedDict
from xray_vision import QtCore, QtG... | {
"content_hash": "fa45dbe1b8014fc54dffc75f781b516d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 78,
"avg_line_length": 31.153846153846153,
"alnum_prop": 0.5835390946502058,
"repo_name": "licode/xray-vision",
"id": "57e1698e993be9ad368485c43b38716b8645fb0a",
"size": "... |
schools_list = "https://www.lectio.dk/lectio/login_list.aspx?showall=1"
assigment_list = "https://www.lectio.dk/lectio/{{SCHOOL_ID}}/OpgaverElev.aspx?elevid={{STUDENT_ID}}"
login_url = "https://www.lectio.dk/lectio/{{SCHOOL_ID}}/login.aspx?lecafdeling={{BRANCH_ID}}"
picture_url = "https://www.lectio.dk/lectio/{{SCHOOL_... | {
"content_hash": "635f5e043e552dc6f0f23788410338a4",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 100,
"avg_line_length": 87.8,
"alnum_prop": 0.7198177676537585,
"repo_name": "boh1996/lectio-assignments-google-calendar",
"id": "06e12ac7cd29987fcab7d85574ca95d43fd02896",
... |
import logging
import dbus
from nirikshak.common import plugins
from nirikshak.workers import base
LOG = logging.getLogger(__name__)
@plugins.register('systemd_enabled')
class SystemdEnabledWorker(base.Worker):
@base.match_expected_output
@base.validate(required=('service',), optional=('status',))
def ... | {
"content_hash": "e5d8c422e66c24e3ba8f0ae6675bd81c",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 32.7,
"alnum_prop": 0.6167176350662589,
"repo_name": "thenakliman/nirikshak",
"id": "be8e0fddaf716812deb73f04664e928f187caf7e",
"size": "1570",
"bi... |
import OpenPNM
import scipy as sp
print('-----> Using OpenPNM version: '+OpenPNM.__version__)
pn = OpenPNM.Network.Cubic(shape=[10,10,40],spacing=0.0001)
pn.add_boundaries()
Ps = pn.pores('boundary',mode='not')
Ts = pn.find_neighbor_throats(pores=Ps,mode='intersection',flatten=True)
geom = OpenPNM.Geometry.Toray090(ne... | {
"content_hash": "317b2c7bf0da4efc1b205b092f30556e",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 94,
"avg_line_length": 42.98529411764706,
"alnum_prop": 0.5706465959630517,
"repo_name": "stadelmanma/OpenPNM",
"id": "715775fb46893f7247c4818c275d4ad41cdf73ff",
"size": "2... |
"""The test for the bayesian sensor platform."""
import unittest
from homeassistant.setup import setup_component
from homeassistant.components.binary_sensor import bayesian
from tests.common import get_test_home_assistant
class TestBayesianBinarySensor(unittest.TestCase):
"""Test the threshold sensor."""
d... | {
"content_hash": "a49b2fb65f68901966929343879dd053",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 75,
"avg_line_length": 33.210332103321036,
"alnum_prop": 0.5158888888888888,
"repo_name": "tinloaf/home-assistant",
"id": "b52459ec47dbe91e565ef18457133cc3d77c8f98",
"size... |
"""Tracks the latency of a host by sending ICMP echo requests (ping)."""
from datetime import timedelta
import logging
import re
import subprocess
import sys
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import CONF_HOST, CONF_... | {
"content_hash": "7e8695db48dd7f8a164e157c59ba5a82",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 86,
"avg_line_length": 31.688741721854306,
"alnum_prop": 0.5650992685475444,
"repo_name": "leppa/home-assistant",
"id": "4d9a99c678e6c3348fa8ba3ccc9996e09829ce1c",
"size":... |
import os
import mock
from django.test import TestCase
from waliki.models import Page
from .factories import PageFactory
from waliki.settings import deep_update
from waliki import settings
rst = """
Title
=====
some rst markup
"""
rst_html = """\n <h2>Title</h2>\n <p>some rst markup</p>\n"""
md = """
# Hi
I... | {
"content_hash": "b560ab18368430878284be866a1b52d9",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 88,
"avg_line_length": 31.552,
"alnum_prop": 0.577079107505071,
"repo_name": "beres/waliki",
"id": "443e4e8ed863d1b918d65d345d7cee9e6fcfd5cc",
"size": "3990",
"binary": ... |
import gcloudutils
import sys
import requests
import argparse
from infoblox_client import connector
from infoblox_client import objects
from requests.auth import HTTPBasicAuth
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from oauth2client.client import GoogleCredentials
from googleapiclient i... | {
"content_hash": "ec343e2bb47a4009322e1502ee90f9a2",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 220,
"avg_line_length": 37.648648648648646,
"alnum_prop": 0.7875089734386217,
"repo_name": "brampling/infoblox-gcp-poc",
"id": "9ec893d1fc7877dfe5d112a05ddf7abd911d2f6d",
"... |
'''Get an object of type: whitelisted_url and save the object to a report file'''
__author__ = 'Jim Olsen <jim.olsen@tanium.com>'
__version__ = '2.1.5'
import os
import sys
sys.dont_write_bytecode = True
my_file = os.path.abspath(sys.argv[0])
my_name = os.path.splitext(os.path.basename(my_file))[0]
my_dir = os.path.d... | {
"content_hash": "05e4b4cb62efd48a0065aaa7b3979070",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 92,
"avg_line_length": 34.36666666666667,
"alnum_prop": 0.7032007759456838,
"repo_name": "tanium/pytan",
"id": "c09c2928ce9d68562612b6874ffd4eb0d8009d90",
"size": "1198",
... |
from contextlib import closing
import os
import socket
import sys
import httpmsg
import urlparse
# The default port for HTTP.
DEFAULT_PORT = 80
def _read_socket(sock):
'''
Reads all available data from a socket.
'''
msg = bytes()
read_size = 8192
while True:
read = sock.recv(read_... | {
"content_hash": "22650a502a8c753720063fdc7216f6c1",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 80,
"avg_line_length": 25.26595744680851,
"alnum_prop": 0.5810526315789474,
"repo_name": "alexhsamuel/codex",
"id": "0f0003b9c44a137b536dfee7e4f2cb6b09b92503",
"size": "237... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Fragmentation(A10BaseClass):
"""Class Description::
DS-Lite fragmentation parameters.
Class fragmentation supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param D... | {
"content_hash": "7a2090f75a7d0898dad741181027724c",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 116,
"avg_line_length": 25.857142857142858,
"alnum_prop": 0.6386740331491713,
"repo_name": "a10networks/a10sdk-python",
"id": "7d066abe1c4bad082943d39886a487e39a059b31",
"s... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('violations', '0002_violationtype_readable_description'),
]
operations = [
migrations.AlterField(
model_name='violationtype',
... | {
"content_hash": "88cb9e9fa52d46d80fa3a73a333502bd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 220,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.6768707482993197,
"repo_name": "ebrelsford/django-phillydata",
"id": "d47eaffb7896786e9e7cc1bd6fa8e77e2235948d",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Electricity',
fields=[
('id', models.AutoField(verbose_name='ID',
... | {
"content_hash": "4f80d4ea32438d491860c858bd28d2be",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 95,
"avg_line_length": 29.533333333333335,
"alnum_prop": 0.5022573363431151,
"repo_name": "ojarva/home-info-display",
"id": "37e1bc0887d21b63d29bbe0cd8246f483805b14b",
"siz... |
"""
Cancer Research Institute's
Table of Tumor Antigens Resulting from Mutations
http://cancerimmunity.org/peptide/mutations/
"""
from os.path import join
import pandas as pd
import numpy as np
from static_data import DATA_DIR
def load_dataframe(
mhc_class = None,
hla_type = None):
path = join(DA... | {
"content_hash": "6c5871d78a82ba996274bf9aea3eea66",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 48,
"avg_line_length": 23.633333333333333,
"alnum_prop": 0.6389280677009873,
"repo_name": "cpcloud/pepdata",
"id": "cc001cfd64d05cf4cf983cde0c6301e3287d7423",
"size": "1309... |
import unittest
class Test_entry_from_resource(unittest.TestCase):
@staticmethod
def _call_fut(resource, client, loggers):
from google.cloud.logging._helpers import entry_from_resource
return entry_from_resource(resource, client, loggers)
def test_unknown_type(self):
with self.as... | {
"content_hash": "a32ef120b00d28c497afd7d2ac2e94a1",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 72,
"avg_line_length": 29.020833333333332,
"alnum_prop": 0.6331658291457286,
"repo_name": "Fkawala/gcloud-python",
"id": "8f8e43f367343ffc1300322fb7395e48b8668f3c",
"size":... |
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models
from ._configuration import CostManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations i... | {
"content_hash": "afbf72e22a980baf2034e22c85d53d7f",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 116,
"avg_line_length": 52.778443113772454,
"alnum_prop": 0.746879963694123,
"repo_name": "Azure/azure-sdk-for-python",
"id": "4ba98e38ed4312b46dd5cf25e384df420d59500f",
"... |
import logging
from colorama import Fore, Back, Style
LOG_TEMPLATE = Back.BLACK + \
Fore.WHITE + \
'%(asctime)s %(name)s %(levelname)s: ' + \
Style.RESET_ALL + \
Back.BLACK + \
Style.BRIGHT + \
'{message_color}' + \
... | {
"content_hash": "cccd5d7bc22c217feb25e478b460b3b0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 99,
"avg_line_length": 28.526315789473685,
"alnum_prop": 0.5359778597785978,
"repo_name": "helloworlddata/nypd-major-felony-incidents",
"id": "6577b387f66dc7b38052578231e6725... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('fundraisers'... | {
"content_hash": "a6d9dff45d49383bc8137be70aa4aeda",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 161,
"avg_line_length": 27.652173913043477,
"alnum_prop": 0.6682389937106918,
"repo_name": "onepercentclub/bluebottle",
"id": "cf55fb81a19e1125c262a34872f41668be3c5798",
"s... |
from common import PrimeGenerator
import functools
import operator
def calculate_factors(number, prime_generator):
factors = []
prime_generator = iter(prime_generator)
while number != 1:
prime = next(prime_generator)
if number % prime == 0:
number = number // prime
... | {
"content_hash": "e75cdad6e5271b288d4b4000894517dc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 122,
"avg_line_length": 31.6875,
"alnum_prop": 0.6074950690335306,
"repo_name": "mytram/learning-python",
"id": "3d3be1385ecfa708da707302c0112d930fc28af4",
"size": "1621",
... |
import inspect
import IECore
import Gaffer
import GafferTest
class ProcessMessageHandlerTest( GafferTest.TestCase ) :
def testMessageOutSideProcessIsForwardedUnmodified( self ) :
capturingMessageHandler = IECore.CapturingMessageHandler()
messageHandler = Gaffer.ProcessMessageHandler( capturingMessageHandler )... | {
"content_hash": "a5bd3887dc6025baec91029e9e1e5d65",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 138,
"avg_line_length": 42.770833333333336,
"alnum_prop": 0.7471992206527034,
"repo_name": "johnhaddon/gaffer",
"id": "da69ef92542fdfdc5aa31c4de0ebe75456db6b9c",
"size": "5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.