text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import telnetlib
import random
import redis
import json
import os
import threading
import pdb
from scrapy import signals
from .user_agents_pc import agents
from .proxy import initIPPOOLS, updateIPPOOLS
from .cookie import initCookie, updateCookie, removeCookie
from scrapy.utils.response import response_s... | {
"content_hash": "941c34fdb34e9f3d7b5c882fa4eb2bd1",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 146,
"avg_line_length": 36.66206896551724,
"alnum_prop": 0.5718585402558315,
"repo_name": "AlexTan-b-z/ZhihuSpider",
"id": "67921b595f19ce678571722de6ecfb7847271f83",
"siz... |
import unittest
import os
import fileops
class TestReadWriteFile(unittest.TestCase):
"""Test case to verify list read/write functionality."""
def setUp(self):
"""This function is run before each test."""
self.fixture_file = r"v:\workspace\FileHandling\src\test-read-write.txt"
self.... | {
"content_hash": "fb834813897dadb47e385f072c3af7d6",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 84,
"avg_line_length": 37.55,
"alnum_prop": 0.6051930758988016,
"repo_name": "ceeblet/OST_PythonCertificationTrack",
"id": "b7129b188db2309653dbd32d27bbcf532f437466",
"size... |
"""Collection of distribution implementations."""
from chainer.distributions.bernoulli import Bernoulli # NOQA
from chainer.distributions.beta import Beta # NOQA
from chainer.distributions.categorical import Categorical # NOQA
from chainer.distributions.cauchy import Cauchy # NOQA
from chainer.distributions.chisqu... | {
"content_hash": "7c035e8df85c7ebfb4e0e14c39ee3d90",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 80,
"avg_line_length": 57.95,
"alnum_prop": 0.8308886971527178,
"repo_name": "jnishi/chainer",
"id": "db73f2bd295369a15e6252c1b85f1fbd67633784",
"size": "1159",
"binary":... |
from django.contrib import admin
#from models import Blog
#class BlogAdmin(admin.ModelAdmin):
# list_display = ('key', 'address_from', 'block_index', 'tx_id')
# search_fields = ('key', 'address_from', 'block_index', 'tx_id')
#admin.site.register(Blog, BlogAdmin)
from models import Transaction
class TransactionA... | {
"content_hash": "59d476d9c82f79d403197d7878efbd93",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 136,
"avg_line_length": 49.903225806451616,
"alnum_prop": 0.7117000646412411,
"repo_name": "Peerapps/PeerMarket-Server",
"id": "94025c30efe015d3153cba04e7b3933a8bc4eb7b",
"... |
from sikuli import *
import os
from keywordgroup import KeywordGroup
class _ApplicationKeywords(KeywordGroup):
def __init__(self):
self.application_name = None
self.application_path = None
# Public
def set_application_focus(self, app_name):
"""Sets focus to the open ``appl... | {
"content_hash": "d12fd089af01c8bf9bc821dcfc78a751",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 178,
"avg_line_length": 40.18181818181818,
"alnum_prop": 0.6115061409179057,
"repo_name": "jaredfin/SikuliXRobotLibrary",
"id": "81395cb9b64b830df38b9fe6f1f0b5dbde7afa14",
... |
import sys
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from... | {
"content_hash": "b9c25bc7e825c650a109b6e243926463",
"timestamp": "",
"source": "github",
"line_count": 731,
"max_line_length": 251,
"avg_line_length": 47.33789329685362,
"alnum_prop": 0.6539995376257081,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c2bd81da017b69705d650a214cd86ae67d80ac54",
"... |
import os
from os.path import join
import urlparse
import urllib
import httplib
import logging
import authomatic
from authomatic.exceptions import FetchError
def custom_fetch(self, url, method='GET', params=None, headers=None, body='', max_redirects=5, content_parser=None): # NOQA
params = params or {}
para... | {
"content_hash": "32ee151dc5e4101b3e85f4363a64d00d",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 124,
"avg_line_length": 34.971698113207545,
"alnum_prop": 0.59778796870785,
"repo_name": "heynemann/generator-flask-app",
"id": "4d06aac9ae9aa29d6729703fe63d848714e6b27c",
... |
"""
Main module of the Gol and Pressure Demo.
Uses the Complex Automaton Base.
"""
from cab_core.ca.cab_cell import CellHex
from cab_core.cab_global_constants import GlobalConstants
from cab_core.cab_system import ComplexAutomaton
from cab_core.util.cab_input_handling import InputHandler
from cab_core.util.cab_visualiz... | {
"content_hash": "e9f835cce8f42cbd11f6b4d0851151db",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 101,
"avg_line_length": 29.795454545454547,
"alnum_prop": 0.5062929061784897,
"repo_name": "Micutio/Pyosphere",
"id": "96ee11b02b1ff5a730e40c3c8ef00798fbd72522",
"size": "... |
"""Implementation of the RTSP protocol.
This is a simple implementation of the RTSP protocol used by Apple (with its quirks
and all). It is somewhat generalized to support both AirPlay 1 and 2.
"""
import asyncio
from hashlib import md5
import logging
import plistlib
from random import randrange
from typing import Any... | {
"content_hash": "ed068ad47b866ce9ea8ac9e7c2917ddb",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 87,
"avg_line_length": 33.811258278145694,
"alnum_prop": 0.5932817549701302,
"repo_name": "postlund/pyatv",
"id": "7b9b997b2e9150a6129ac0b6d351b6bb630c16f7",
"size": "1021... |
import unittest
from graphtheory.structures.edges import Edge
from graphtheory.structures.graphs import Graph
from graphtheory.coloring.nodecolorlf import LargestFirstNodeColoring
# 0 --- 1 --- 2 outerplanar, chordal, 2-tree
# | / | / |
# | / | / |
# | / | / |
# 3 --- 4 --- 5
# Best node coloring - 3 col... | {
"content_hash": "23ca0f9e947746d165d95ef40176f5ea",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 31.019607843137255,
"alnum_prop": 0.5802781289506953,
"repo_name": "ufkapano/graphs-dict",
"id": "6df7d50d4126ba2e5f905d8eec986842f677f318",
"size": ... |
"""SCons.Platform.cygwin
Platform-specific initialization for Cygwin systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2... | {
"content_hash": "cf5616a6fb4ef76c9c6a42ee646d6c84",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 119,
"avg_line_length": 37.45454545454545,
"alnum_prop": 0.7315533980582525,
"repo_name": "sftd/scons",
"id": "7429407a312c8c770bc3579f45a1f85cbb9f1ac0",
"size": "2060",
... |
import errno
import os
import re
import subprocess
import sys
def get_keywords():
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
... | {
"content_hash": "c9d44b02dba90ef30ae7e7ac0eb72b5f",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 79,
"avg_line_length": 33.977777777777774,
"alnum_prop": 0.5714192282537607,
"repo_name": "jeroyang/retools",
"id": "8b1516a224ec303762684b2ebdfab1d804fdc884",
"size": "15... |
from south.db import db
from django.db import models
from states.models import *
class Migration:
def forwards(self, orm):
# Changing field 'StateReport.group_action'
# (to signature: django.db.models.fields.CharField(max_length=50, null=True))
db.alter_column('states_staterep... | {
"content_hash": "fa3a84ea3a3954b7c66ea2e1bc8934b3",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 156,
"avg_line_length": 62.19718309859155,
"alnum_prop": 0.5591032608695652,
"repo_name": "vikingco/django-states",
"id": "96e3560c0884befd9535580c33b9e9727d74f9c4",
"size"... |
from apis.models.test import Test, Answer
from apis.exception import NotFound
from . import Resource
class TestsIdScore(Resource):
def _get_test(self, id):
test = Test.objects(id=id).first()
if not test or test.status == 'draft':
raise NotFound('account_not_found')
return tes... | {
"content_hash": "b40b0da7b5911158a7ca48936a3be820",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 26.842105263157894,
"alnum_prop": 0.6294117647058823,
"repo_name": "gusibi/Metis",
"id": "110b8c71fb91d1129f1aa7ba33bc37a74c94632b",
"size": "535",
... |
from zeit.cms.i18n import MessageFactory as _
import grokcore.component as grok
import lxml.objectify
import zeit.content.cp.blocks.block
import zeit.content.cp.interfaces
class XMLBlock(zeit.content.cp.blocks.block.Block):
grok.implements(zeit.content.cp.interfaces.IXMLBlock)
type = 'xml'
class XMLBlockFa... | {
"content_hash": "15ff83a1c183587c430d9f459699265b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 65,
"avg_line_length": 27.041666666666668,
"alnum_prop": 0.711864406779661,
"repo_name": "ZeitOnline/zeit.content.cp",
"id": "b9b4619bd657bac14f4318e85db434d77a40656e",
"si... |
"""Implements the |Queue| interface on top of `celery`_, a distributed task
queue system. When a message is enqueued, a delivery task is queued up in
celery. Celery workers will then pick up the task and attempt delivery,
retrying and bouncing in the same manner as |Queue|.
A :class:`celery.Celery` object must be give... | {
"content_hash": "fcfb8d5a64e034a6c33512c3525bdd0b",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 79,
"avg_line_length": 36.15923566878981,
"alnum_prop": 0.6198696494627444,
"repo_name": "slimta/python-slimta-celeryqueue",
"id": "36fdc0cec0b016896ac7e3fb732ce614e54b0ca2"... |
"""HydraTK default event class
.. module:: core.event
:platform: Unix
:synopsis: HydraTK default event class
.. moduleauthor:: Petr Czaderna <[email protected]>
"""
import pprint
class Event(object):
""" Class Event
"""
_id = None
_args = ()
_data = {}
_propagate = True
_run_default... | {
"content_hash": "013a4145f2a48a37b0441b9b83031589",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 74,
"avg_line_length": 18.359375,
"alnum_prop": 0.488936170212766,
"repo_name": "hydratk/hydratk",
"id": "7c7e722895fdc6eccb3668ffb71a331fdd9cdcce",
"size": "4724",
"bin... |
import math
import m5
from m5.objects import *
from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
#
# Declare caches used by the protocol
#
class L1Cache(RubyCache): pass
class L2Cache(RubyCache): pass
#
# Probe filter is a cache
#
class ProbeFilter(RubyCache): pass
def defi... | {
"content_hash": "ea6eb28b68d6efbf65c439ecc467fde9",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 94,
"avg_line_length": 42.41596638655462,
"alnum_prop": 0.5923724616146607,
"repo_name": "ayoubg/gem5-graphics",
"id": "d757b75c6c67e7e1b18c2f7f7f032b20d7e97074",
"size": ... |
import numpy as np
import matplotlib.pyplot as plt
from load_files import training_ims, training_labels
# Visualize an example just for testing
index = 14
label = training_labels[1]
image = training_ims[1]
image = np.array(image)
image = np.reshape(image, (28, 28))
image[image > 0] = 1
plt.imshow(image)
plt.title(... | {
"content_hash": "bf8d03d01c28f980e2176a4a5b9c9c41",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 54,
"avg_line_length": 20.88888888888889,
"alnum_prop": 0.723404255319149,
"repo_name": "h-mayorquin/mnist_deep_neural_network_BPNNs",
"id": "104005803cd58790c43b8946250a8453... |
"""Common utils to support apply and reverting recommendations on bulk."""
import collections
from concurrent import futures
import json
import logging
import time
from google_auth_httplib2 import AuthorizedHttp
import httplib2
from google.oauth2 import service_account
class Recommendation(object):
"""Encapsul... | {
"content_hash": "14ab2ad1997ea56f783d64be4584ada8",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 94,
"avg_line_length": 35.5878962536023,
"alnum_prop": 0.6132480362782412,
"repo_name": "GoogleCloudPlatform/professional-services",
"id": "d0718bf4fab1818b3817ce09cf4df1f9c... |
from django.db import models
class Join(models.Model):
email = models.EmailField()
ref_id = models.CharField(max_length=120, default = 'abra')
ip_address = models.CharField(max_length=120, default='ABC')
# dupa = models.CharField(max_length=120, default='dupa')
# kupa = models.CharField(max_length=12... | {
"content_hash": "dee0e5f8ef64761b67e3ef342fe1a9f0",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 88,
"avg_line_length": 36.4,
"alnum_prop": 0.7046703296703297,
"repo_name": "micbuz/project2",
"id": "798d4d34ea8978c2926af350d9eeef9978d3b17f",
"size": "728",
"binary": ... |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="name", parent_name="sunburst", **kwargs):
super(NameValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_t... | {
"content_hash": "e5f53abbcc8178778a2844d6a69b3e52",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 35.45454545454545,
"alnum_prop": 0.6153846153846154,
"repo_name": "plotly/plotly.py",
"id": "2c25c5ac7b063ee35c8db787aedb9e285b1e7fe7",
"size": "390"... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem103.py
#
# Special subset sums: optimum
# ============================
# Published on Friday, 26th August 2005, 06:00 pm
#
# Let S(A) represent the sum of elements in set A of size n. We shall call it a
# special sum set if for any two non-empty disjoint subsets... | {
"content_hash": "4aa8daf1deaadb123531be7a1483c8c3",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 47.61290322580645,
"alnum_prop": 0.6422764227642277,
"repo_name": "olduvaihand/ProjectEuler",
"id": "f5e42c60264826297a39bddba835fb26af79e8bd",
"size... |
'''
Problem
=======
A palindromic number reads the same both ways.
The largest palindrome made from the product of two 2-digit numbers is 9009 = 91x99.
Find the largest palindrome made from the product of two 3-digit numbers.
'''
def isPalindrome(num):
num = str(num)
charArr = list(num)
rrArahc = list(num)... | {
"content_hash": "c31845dc608c943068f25b27e12560c9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 92,
"avg_line_length": 29.27777777777778,
"alnum_prop": 0.7096774193548387,
"repo_name": "ryanbmilbourne/euler",
"id": "9b639b752b85e3e3f826bdd385040b3f377a0841",
"size": "... |
'''code description'''
# pylint: disable = I0011, E0401, C0103, C0321
class Solution(object):
'''Solution description'''
def func(self, m, n, k):
'''Solution function description'''
res = []
self.helper(res, [], 0, 0, 0, 0, 0, 0, m, n, k)
return res
def helper(self, total, p... | {
"content_hash": "4e94245c988cf1574bcb4f659309f25e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 107,
"avg_line_length": 46.69444444444444,
"alnum_prop": 0.5651397977394408,
"repo_name": "cerebrumaize/leetcode",
"id": "3f7d7cf0ca06d29dcbbc4013fa0ae80965c05cf9",
"size":... |
import datetime
import re
def string_to_date(s, format='%Y%m%d', strict=False):
"""
Convert a string to a datetime.date object
Returns ``None`` on dates that it can't parse unless you call it
with the kwarg ``strict`` set to ``True``.
"""
try:
return datetime.datetime.strptime(s, form... | {
"content_hash": "45372fe13e8d2155086ba75f84d0a851",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 27.2,
"alnum_prop": 0.5972222222222222,
"repo_name": "texas/tx_tecreports",
"id": "63ef0624426cca48dcbba012949e731f1ca67e08",
"size": "1224",
"bina... |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="smartbackup",
version="0.1.0",
author="alex",
author_email="[email protected]",
description="Backup tools using the framework bakthat.",
... | {
"content_hash": "4b21ee4f7dd5819f2ac7d7c635fd5bf3",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 73,
"avg_line_length": 31,
"alnum_prop": 0.639599555061179,
"repo_name": "alexsilva/smartbackup",
"id": "4fb73a05421e7d1bf95cb470d9ab104d954723c5",
"size": "899",
"binary... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import threading
from past.builtins import basestring
from caffe2.proto import caffe2_pb2
# The name scope and device scope when creating a new opera... | {
"content_hash": "ad1d8424f9cf1ad60443282d4454bfe8",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 83,
"avg_line_length": 31.783505154639176,
"alnum_prop": 0.6925072980862796,
"repo_name": "Yangqing/caffe2",
"id": "148980f902e7cb215a54aee7d232be9b696da1db",
"size": "3801... |
'''Implements EWrapper subclass SynchronizedWrapper.'''
__copyright__ = "Copyright (c) 2009 Kevin J Bluck"
__version__ = "$Id$"
import Queue
from tws import EWrapper
class SynchronizedWrapper(EWrapper):
'''Synchronizes wrapper events into another thread.
Since the client socket is read in a worker thr... | {
"content_hash": "aa659351a6bf1543e5433a7cb4542cf0",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 79,
"avg_line_length": 36.32034632034632,
"alnum_prop": 0.6388557806912991,
"repo_name": "kbluck/pytws",
"id": "b0ae23cc2a681588a43d848e6459fdfdc720ded5",
"size": "8390",
... |
from runner.koan import *
class AboutClasses(Koan):
class Dog(object):
"Dogs need regular walkies. Never, ever let them drive."
def test_instances_of_classes_can_be_created_adding_parentheses(self):
fido = self.Dog()
self.assertEqual('Dog', type(fido).__name__)
def test_classes_h... | {
"content_hash": "513fdcf354b575d9eec24c86e101cdff",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 79,
"avg_line_length": 30.876623376623378,
"alnum_prop": 0.5392218717139853,
"repo_name": "ducngtuan/my-python3-koans-solution",
"id": "a37c5ad301e2f54b72b333460865a4ab130da... |
import sys
import gtk
import pango
import traceback
from StringIO import StringIO
import gtksourceview2 as gtksourceview
class SourcePad(gtk.ScrolledWindow):
"""This class represents a source code editor""" # No used yet!
def __init__(self, application):
gtk.ScrolledWindow.__init__(self)
self... | {
"content_hash": "364649a34d2d6d9cc415f37ee4201a77",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 110,
"avg_line_length": 35.28484848484848,
"alnum_prop": 0.6344898660254208,
"repo_name": "jaliste/sanaviron.gtk-3",
"id": "185ef6eea057945cf49c475d281d8b2c5239a9db",
"siz... |
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPT... | {
"content_hash": "bc18f3db07a91e6aad5dfdbfc0b5f580",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 80,
"avg_line_length": 31.35483870967742,
"alnum_prop": 0.49074074074074076,
"repo_name": "narayanaditya95/Robotix",
"id": "19bda00863c6dd284fdaf97c9a1964a3b5c2c8be",
"size... |
from functools import wraps
from pythonwrap import Parser, Client, Channel
import numerics
def register(command, min_args=0, max_args=0, access=1, rate_control=0):
def decorator(func):
Parser.Register(command, func,
min_args=min_args,
max_args=max_args,
access=access,
rate_control=rate_... | {
"content_hash": "e644a0a591d59ee4fc6c0b9fcb043532",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 86,
"avg_line_length": 22.9625,
"alnum_prop": 0.6096897114861187,
"repo_name": "oftc/oftc-ircd",
"id": "c834c221625e7b8588b15c7bf4f1b9b2279e45d0",
"size": "2954",
"binary... |
"""
Production Configurations
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis for cache
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
from .base import * # noqa
... | {
"content_hash": "dab3f107a412ebc8ecc3fe02a45f1728",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 117,
"avg_line_length": 36.36407766990291,
"alnum_prop": 0.6072620477906822,
"repo_name": "devrishik/Heroes",
"id": "7ffc964d302fc95080f043c1f99774e844b14a33",
"size": "75... |
from .TProtocol import *
from struct import pack, unpack
class TBinaryProtocol(TProtocolBase):
"""Binary implementation of the Thrift protocol driver."""
# NastyHaxx. Python 2.4+ on 32-bit machines forces hex constants to be
# positive, converting this into a long. If we hardcode the int value
# instead it'l... | {
"content_hash": "e49544e7184deca14fed8aa85207cc00",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 72,
"avg_line_length": 24.141078838174273,
"alnum_prop": 0.6658645582674458,
"repo_name": "tailhook/aio-hs2",
"id": "13e2fd2bfe0306538ee257743cf38973ce3116b9",
"size": "66... |
import platform
import setuptools
from setuptools.command import test
import sys
install_requires = [
'future',
# mock-1.0.1 is the last version compatible with setuptools <17.1,
# which is what comes with Ubuntu 14.04 LTS.
'mock<=1.0.1',
'portpicker',
'psutil',
'pytz',
'pyyaml',
't... | {
"content_hash": "aa57107ec1392464b6ba77899ac12e6b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 79,
"avg_line_length": 26.984375,
"alnum_prop": 0.614939200926462,
"repo_name": "l-meng/mobly",
"id": "e460099d95b3c9dd7356495b42c881d3750821fc",
"size": "2306",
"binary"... |
import numpy
from keras.layers import Input
from keras.models import Model
from deep_qa.layers.entailment_models import MultipleChoiceTupleEntailment
from deep_qa.layers.time_distributed_embedding import TimeDistributedEmbedding
class TestTupleAlignment:
def test_tuple_alignment_does_not_crash(self):
ques... | {
"content_hash": "2f40703828b9f7b6acb74ef139a0b970",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 104,
"avg_line_length": 54.38235294117647,
"alnum_prop": 0.6836127636560303,
"repo_name": "RTHMaK/RPGOne",
"id": "67fe146f66439d619ffe9200f86e8c5f13804b6a",
"size": "1892",... |
class ValidationError(Exception):
pass
class ConfigurationError(Exception):
pass
class AlreadyRegisteredError(Exception):
pass
class RegisterError(Exception):
pass
class PermissionError(Exception):
pass | {
"content_hash": "e37b6519b676e1d0cb87d921ccac20fe",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 40,
"avg_line_length": 12.777777777777779,
"alnum_prop": 0.7521739130434782,
"repo_name": "pombredanne/django-avocado",
"id": "e37b68b1bd73694487894f3852346f370074df03",
"s... |
from __future__ import absolute_import, print_function
import json
from pprint import pprint
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy import API
if __name__ == '__main__':
with open('api_secret_token.json') as data_file:
authdata = jso... | {
"content_hash": "dbfe14a4ab38115d5d4e77ebe5cc648a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 82,
"avg_line_length": 37.13636363636363,
"alnum_prop": 0.7294981640146879,
"repo_name": "fuzzyhandle/pihangout",
"id": "55729100a855ba143fae2c47f5aea61c9fda934b",
"size": ... |
from msrest.serialization import Model
class EnvironmentVariable(Model):
"""A collection of environment variables to set.
All required parameters must be populated in order to send to Azure.
:param name: Required. The name of the environment variable.
:type name: str
:param value: Required. The ... | {
"content_hash": "eec0e1d4939ee17acf8ff4e0e48d0258",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 28.321428571428573,
"alnum_prop": 0.5939470365699874,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "56b44c8176455ed385540da26dd41e7c7021e614",
... |
import os, sys, time, inspect
from prettytable import PrettyTable
"""
#Environment Setup
@src_dir : file current path
@arch_dir : libs path of different architecture
@leap_dir : Leap Motion module path
"""
src_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
arch_dir = '../../motion-leap/lib/x64' if sy... | {
"content_hash": "2920e0a35586912551ce68ec4bd8d267",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 96,
"avg_line_length": 26.25,
"alnum_prop": 0.563265306122449,
"repo_name": "peitaosu/motion-tools",
"id": "1307622fc4614b3d72064d2c7e89d23db4f6410e",
"size": "2205",
"bi... |
from distutils.core import setup, Extension
setup(name="ctypes-test",
ext_modules = [Extension("C", ["C.c"])])
| {
"content_hash": "4b2eff3ab87e67babfb2816fd9746d13",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 46,
"avg_line_length": 29.5,
"alnum_prop": 0.6610169491525424,
"repo_name": "otron/python-intro-course-cern",
"id": "9f529d2f9f647c2d15745cae0ed432c6695fe30c",
"size": "119"... |
from nose.tools import ok_
from flask.ext.viewunit import config, ViewTestCase
from app import app
class HookTest(ViewTestCase):
"""
All the flask hooks/functions use module-wide global state, so this is not
going to be entirely pretty. Sorry.
"""
def test_app_hook(self):
config.set_app(... | {
"content_hash": "c09793374e018fe3a707f958649587b8",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 79,
"avg_line_length": 27.923076923076923,
"alnum_prop": 0.5576544667453759,
"repo_name": "wingu/flask_viewunit",
"id": "a72b86368a4c7da46c0dbaae30ad8840466d0e4f",
"size": ... |
from __future__ import with_statement
import os
import glob
import sys
import shutil
import tempfile
import threading
import multiprocessing
import random
import time
from mapproxy.util.lock import (
FileLock,
SemLock,
cleanup_lockdir,
LockTimeout,
)
from mapproxy.util.fs import (
_force_rename_dir,... | {
"content_hash": "a8576590b88bb045b8b66fd2ec5d9a4c",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 85,
"avg_line_length": 31.380487804878047,
"alnum_prop": 0.5736048499922276,
"repo_name": "Anderson0026/mapproxy",
"id": "270ad7deb5f7a9bf968eb4e92c9f698c9b62453f",
"size"... |
import argparse
import time
import sys
import httplib
##Built in python 2.7.3
##Author: Steve Miskiewicz
##Check the status of the request, will return true for goodStatus
##sys.exit badStatus
def getStatus(r1, goodStatus, badStatus):
if r1.status in goodStatus:
done = True
status = "Website Up."
... | {
"content_hash": "46c034fe25862524a46ebe25f9c9bbc2",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 151,
"avg_line_length": 29.576923076923077,
"alnum_prop": 0.6059817945383615,
"repo_name": "smiskiewicz/httpStatusBot",
"id": "197b178b26820617cc2fd6424c996a1fdbdc9e9e",
"... |
import os
import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primar... | {
"content_hash": "7b9de9b16e9998d48a9fddb7414b4a04",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 64,
"avg_line_length": 24.578125,
"alnum_prop": 0.6484424666242848,
"repo_name": "maistrovas/My-Courses-Solutions",
"id": "7fb77ae551e72225ed9ff0520717ce47140e3fb0",
"size"... |
from operator import gt, lt, ge, le
from hq.hquery.functions.core_string import string
from hq.verbosity import verbose_print
from hq.hquery.functions.core_boolean import boolean
from hq.hquery.functions.core_number import number
from hq.hquery.object_type import object_type, is_boolean, is_number
from hq.hquery.synta... | {
"content_hash": "474068f03b68142c1ca46ce5b95e9122",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 113,
"avg_line_length": 37.39393939393939,
"alnum_prop": 0.6158833063209076,
"repo_name": "rbwinslow/hq",
"id": "25de6b7939b55e940389daaa8707a8438d103647",
"size": "3702",
... |
import unittest
from autosklearn.pipeline.components.regression.gradient_boosting import GradientBoosting
from autosklearn.pipeline.util import _test_regressor, _test_regressor_iterative_fit
import sklearn.metrics
class GradientBoostingComponentTest(unittest.TestCase):
def test_default_configuration(self):
... | {
"content_hash": "e5603ce14a71bd74d64ae3d12da28845",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 89,
"avg_line_length": 39.80952380952381,
"alnum_prop": 0.7248803827751196,
"repo_name": "hmendozap/auto-sklearn",
"id": "4a331a79fcd35d0bf54328a48733b0f377ae6b7b",
"size":... |
import time
#import RPi.GPIO as io
#io.setmode(io.BCM)
class WaterController(object):
CONFIGURATION = False
TOTAL_WATER_VOLUME_PUMPED = 0
CURRENT_WATER_FLOW_RATE = 0
def __init__(self, conf):
''' Setup the Water Controller. '''
print("> NOTICE: Activating Water Controller.")
self.CONFIGURATION = conf
... | {
"content_hash": "37c67ae40c9c230da8859a83d5cc6aa6",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 86,
"avg_line_length": 25.352941176470587,
"alnum_prop": 0.6504253673627224,
"repo_name": "fisherinnovation/FI-Automated-Greenhouse",
"id": "adfbfc45687ae7de5f7ab42659c35df59... |
import copy
import math
import pickle
import random
from itertools import combinations
import js2py
import hashlib
import base64
def euclid(a, b):
"""returns the Greatest Common Divisor of a and b"""
a = abs(a)
b = abs(b)
if a < b:
a, b = b, a
while b != 0:
a, b = b, a % b
retu... | {
"content_hash": "7a04c4737ab01abec32e812b3f088226",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 82,
"avg_line_length": 28.0926517571885,
"alnum_prop": 0.5669282383714318,
"repo_name": "lazygunner/xunleipy",
"id": "95bb44ec8555d01cb370b5b6a440e3cf6cbefab8",
"size": "8... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations... | {
"content_hash": "e815ea646e280df4134a4a045e305c49",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 129,
"avg_line_length": 25.195652173913043,
"alnum_prop": 0.6264020707506471,
"repo_name": "dilwaria/thoughtconcert",
"id": "bc4e1ff1d4179620ec4650218c733b04aaf78ce0",
"siz... |
from __future__ import absolute_import, division, print_function, unicode_literals
import getpass
from builtins import input
from colors import cyan, green, red
from pants.auth.basic_auth import BasicAuth, BasicAuthCreds, Challenged
from pants.base.exceptions import TaskError
from pants.task.console_task import Cons... | {
"content_hash": "db5402a7b49b450cc9d688a1e3ca2106",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 96,
"avg_line_length": 36.20338983050848,
"alnum_prop": 0.6942883895131086,
"repo_name": "twitter/pants",
"id": "4db5b7c0fcebcf37ef61cd97c9c7ce2bdd46afa6",
"size": "2283",
... |
from conf import ServiceConfigure
from utils import merge_into, blipp_import, get_most_recent
from schema_cache import SchemaCache
import settings
from validation import validate_add_defaults
import pprint
# should be blipp_conf, but netlogger doesn't like that for some reason
logger = settings.get_logger('confblipp'... | {
"content_hash": "cc6bc5a7b2e4dc5f6a47d58ab143e489",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 99,
"avg_line_length": 39.627450980392155,
"alnum_prop": 0.574468085106383,
"repo_name": "periscope-ps/blipp",
"id": "ca9d6e643200cac244e8f080ff701e7a0870ce1b",
"size": "6... |
"""Type-based simulation operations
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from pykern import pkconfig
from pykern import pkinspect
from pykern import pkio
from pykern import pkjson
from pykern.pkcollections import PKDict
from p... | {
"content_hash": "a40279430d4dacb338845af041b39471",
"timestamp": "",
"source": "github",
"line_count": 854,
"max_line_length": 89,
"avg_line_length": 29.7576112412178,
"alnum_prop": 0.5597528823830323,
"repo_name": "radiasoft/sirepo",
"id": "7059bd6c4c210726e77b2a17fadc2bb4b0a6dc60",
"size": "2543... |
'''
Access Groups v2
================
The following methods allow for interaction into the Tenable.io
:devportal:`access-groups-v2 <v2-access-groups>` API endpoints.
Methods available on ``tio.access_groups_v2``:
.. rst-class:: hide-signature
.. autoclass:: AccessGroupsV2API
:members:
'''
from restfly.utils impo... | {
"content_hash": "625665532fc09830a1da7f97b42bd663",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 99,
"avg_line_length": 41.50985221674877,
"alnum_prop": 0.5563994541031271,
"repo_name": "tenable/pyTenable",
"id": "cf5fb4ed1e0fb55c84d0b8350c3bcc0d9b543bf5",
"size": "16... |
print ("____________________________________________________________")
import os,time,sys
def main():
print("Welcome to journal_writer!")
print("0 - set journal file")
print("1 - write to temporary file")
print("2 - sync temporary file to journal file")
print("3 - decrypt and read the journal file")
print("4 - ... | {
"content_hash": "adaf2713b81fa6055b5f1597b1d29976",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 108,
"avg_line_length": 27.35185185185185,
"alnum_prop": 0.6079891672308734,
"repo_name": "aidenholmes/journal_writer",
"id": "9cfabe965d8d5b79e66679c43d826c7d814f1873",
"s... |
import logging
import sys
import os
import yaml
from raven import Client
from raven.handlers.logging import SentryHandler
from raven.conf import setup_logging
import utils
with open(os.path.join('configs', 'prod.yml')) as config_file:
config = yaml.load(config_file.read())
if 'sentry' in config:
client = ... | {
"content_hash": "6e9066f6ffc4e7260c567d4b04931dfe",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 27.75438596491228,
"alnum_prop": 0.6194690265486725,
"repo_name": "nsiregar/reddit2telegram",
"id": "17a15ae6c409dbc91bce3703fee7349e13fd5b62",
"size... |
"""
This is a minimum working example of a Matchmaker Exchange server.
It is intended strictly as a useful reference, and should not be
used in a production setting.
"""
from __future__ import with_statement, division, unicode_literals
import logging
import json
from flask import Flask, request, after_this_request, ... | {
"content_hash": "babbbc351c8317d874172257ba28d385",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 117,
"avg_line_length": 29.884615384615383,
"alnum_prop": 0.7014157014157014,
"repo_name": "MatchmakerExchange/reference-server",
"id": "40bbe3ed684753d1039b4be4dcbf23ba94c20... |
from __future__ import annotations
from typing import TYPE_CHECKING
from libqtile import config, group, hook
from libqtile.backend.base import FloatStates
from libqtile.config import Match
if TYPE_CHECKING:
from libqtile.backend.base import Window
class WindowVisibilityToggler:
"""
WindowVisibilityTogg... | {
"content_hash": "694c538b73a7a6b0f48743551fb07f3b",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 97,
"avg_line_length": 37.70542635658915,
"alnum_prop": 0.5868969298245614,
"repo_name": "ramnes/qtile",
"id": "cfaa7c4ed24cf48e59b6a0538efffb03101aaac1",
"size": "15686",... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('versiones', '0005_auto_20160329_0010'),
]
operations = [
migrations.AddField(
model_name='modulo',
... | {
"content_hash": "4583779883db5fa91caf9d53b6a1ba89",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 117,
"avg_line_length": 25.263157894736842,
"alnum_prop": 0.6395833333333333,
"repo_name": "famachot/controlVersionesAPI",
"id": "3e127d282f069fa151d7d8deefddf41efe22a627",
... |
from __future__ import absolute_import, division, print_function
import sys
PY2 = sys.version_info.major == 2
import atexit
from collections import defaultdict
try:
from cPickle import dump
except ImportError:
from pickle import dump
import datetime
import os
if PY2:
from itertools import izip_longest as ... | {
"content_hash": "fc877c5ee928436ab6d55cc2a1e9bcb1",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 115,
"avg_line_length": 31.559796437659035,
"alnum_prop": 0.5638152059985487,
"repo_name": "sdrave/simdb",
"id": "34c2529b89344505afac060b3ec76a20b5308c1e",
"size": "13769... |
import os.path as op
from nose.tools import assert_true
from mne import read_dip
from mne.datasets import sample
data_path = sample.data_path(download=False)
dip_fname = op.join(data_path, 'MEG', 'sample',
'sample_audvis_set1.dip')
@sample.requires_sample_data
def test_io_dip():
"""Test IO f... | {
"content_hash": "f46d46881640232cf336f5ef223123a4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 56,
"avg_line_length": 26.954545454545453,
"alnum_prop": 0.6475548060708263,
"repo_name": "jaeilepp/eggie",
"id": "d5314f496694d1a02a8c149a17f363a33d30c4a0",
"size": "593",... |
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class RoleAssignmentApprovalActorIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The identity type : user/servicePrincipal."""
USER = "user"
SERVICE_PRINCIPAL = "servicePrincipal"
class RoleAssignmentApprovalStepReviewR... | {
"content_hash": "a819a398b077ab9f37c5bdbbf3efac7c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 100,
"avg_line_length": 30.75,
"alnum_prop": 0.7327235772357723,
"repo_name": "Azure/azure-sdk-for-python",
"id": "74ba291f3bcca238da835c0e72383cce698e955d",
"size": "1452"... |
from . import Check, CheckStatus, UnexpectedFailure
import socket
class PortOpenCheck(Check):
def __init__(self, payload, name=None, **kwargs):
super(PortOpenCheck, self).__init__(specification='PortOpenCheck(host={h}, port={p})'.format(
h=payload['hostname'],
p=payload['port']
... | {
"content_hash": "3685d5d3a281ea9076868b76bd0d1600",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 119,
"avg_line_length": 36.515151515151516,
"alnum_prop": 0.5800829875518673,
"repo_name": "dopsi/sentry",
"id": "5f41605e63aa3ddd8d63baff70b6013bd26f10e6",
"size": "1205",... |
"""
Load centrality.
"""
# Copyright (C) 2004-2010 by
# Aric Hagberg <[email protected]>
# Dan Schult <[email protected]>
# Pieter Swart <[email protected]>
# All rights reserved.
# BSD license.
__author__ = "\n".join(['Aric Hagberg ([email protected])',
'Pieter Swart (swart@la... | {
"content_hash": "ae2c17a57e6514c859687e471891d4cc",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 82,
"avg_line_length": 33.276041666666664,
"alnum_prop": 0.580059477226483,
"repo_name": "rainest/dance-partner-matching",
"id": "a317e399fddad76a5a899086fd9f93b5c43113f2",
... |
import os
import sys
from optparse import OptionParser
try:
from urllib.parse import urlparse, parse_qs
except ImportError:
from urlparse import urlparse, parse_qs
# Do not write pyc/pyo files
sys.dont_write_bytecode = True
# Import from 'dist' directory
curdir = os.path.join(os.path.dirname(os.path.realpath... | {
"content_hash": "583a2dcd5d42facec6caf785730c87ed",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 186,
"avg_line_length": 35.8974358974359,
"alnum_prop": 0.6039285714285715,
"repo_name": "markembling/totp-tool",
"id": "3b9a8f82ca8d6564d82058166f5f596039528293",
"size": ... |
import json
import logging
from typing import Any, Dict, List, Optional, Union
from urllib import request
from urllib.error import URLError
from celery.utils.log import get_task_logger
from sqlalchemy import and_, func
from superset import app, db
from superset.extensions import celery_app
from superset.models.core i... | {
"content_hash": "511d6014ae34482be3efc9748d0a6c2f",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 87,
"avg_line_length": 30.519713261648747,
"alnum_prop": 0.5699354081033471,
"repo_name": "mistercrunch/panoramix",
"id": "546eaebdb056581d14db13c0604b60b7e4cbb4db",
"size... |
class GeneralInquiryModel(object):
"""General Card Attributes Inquiry data object model.
:param str primaryAccountNumber: **Required**. Primary account number (PAN). 13-19 characters string.
**Request:**
.. code:: json
{
"primaryAccountNumber": "4465390000029077"
}
... | {
"content_hash": "962662d5d9b1c34733385cbb85ce90b7",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 105,
"avg_line_length": 28.61904761904762,
"alnum_prop": 0.5099833610648918,
"repo_name": "ppokrovsky/pyvdp",
"id": "421b34213bfcbcd496687ba14bad3c45bfaa0e08",
"size": "120... |
import unittest, rostest
import rosnode, rospy
import time
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse #追加
class MotorTest(unittest.TestCase):
def setUp(self): #このメソッドを追加
rospy.wait_for_service('... | {
"content_hash": "858ec343e8709c860078e7e16da3c446",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 111,
"avg_line_length": 38.58108108108108,
"alnum_prop": 0.603152364273205,
"repo_name": "Kageken/pimouse_ros",
"id": "baadf6d7f68827792714ff155655142500036fe1",
"size": "2... |
from tempest.api.compute import base
from tempest import config
from tempest import exceptions
from tempest import test
import time
CONF = config.CONF
class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
super(AttachInterfacesTestJSON, cls).skip_checks()
... | {
"content_hash": "d304c3e3d3a005659ce049fbaa04bb6f",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 78,
"avg_line_length": 40.23566878980892,
"alnum_prop": 0.5822384043058414,
"repo_name": "Vaidyanath/tempest",
"id": "33995f30ae05d7e5df5f7d3d16b5d400dbe1165e",
"size": "6... |
import os
import shutil
import tempfile
import zipfile
from utils.file_util import get_files_by_re, gen_new_file_extension
def get_aar_files(proj_dir, des_dir):
rel_aar_dir = r"build\outputs\aar"
aar_dirs = [os.path.join(proj_dir, i) for i in os.listdir(proj_dir) if os.path.isdir(os.path.join(proj_dir, i))]
... | {
"content_hash": "5c3900ba812d851abfed9b7d8563b170",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 116,
"avg_line_length": 36.82,
"alnum_prop": 0.6121673003802282,
"repo_name": "gengjiawen/AndroidHelper",
"id": "e2673fded863a8226c1ee8b006bccf1afaff02da",
"size": "1841",
... |
from concurrent.futures import ThreadPoolExecutor
from typing import List
from toolz import juxt
from itertools import repeat
from saapy.graphdb import Neo4jClient
class Neo4jAbstractQuery:
def __init__(self, labels=()):
self.labels = labels
def __call__(self, neo_client):
raise NotImplement... | {
"content_hash": "eb2e5995b02c9db371efdbb777adc90f",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 75,
"avg_line_length": 33.96992481203007,
"alnum_prop": 0.5061974324922532,
"repo_name": "ashapochka/saapy",
"id": "e96d139abf3453287d0d337ae32d1373d7c96a29",
"size": "453... |
import pytest
CODEVERSION = '0.0.1'
NEW_CODEVERSION = '0.0.2'
@pytest.fixture()
def campaign():
from psiturk.models import Campaign
parameters = {
'codeversion': CODEVERSION,
'mode': 'sandbox',
'goal': 100,
'minutes_between_rounds': 1,
'assignments_per_round': 10,
... | {
"content_hash": "d71ae409fde4d56686d81df9b01cde7b",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 118,
"avg_line_length": 33.7037037037037,
"alnum_prop": 0.7041208791208792,
"repo_name": "NYUCCL/psiTurk",
"id": "3e2750162578e0afa0a50c88dff6de04fcfe1bfb",
"size": "3640"... |
from itertools import tee, chain, islice, groupby
from heapq import merge
def hamming_numbers():
# Generate "5-smooth" numbers, also called "Hamming numbers"
# or "Regular numbers". See: http://en.wikipedia.org/wiki/Regular_number
# Finds solutions to 2**i * 3**j * 5**k for some integers i, j, and k.
... | {
"content_hash": "f800e849aa71837e5f0203e795047751",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 85,
"avg_line_length": 41.03846153846154,
"alnum_prop": 0.5773195876288659,
"repo_name": "ActiveState/code",
"id": "8ab9c9cc9bfcf96d22389c2db9078001e3357f97",
"size": "1067... |
import unittest
from mycroft.client.speech.hotword_factory import HotWordFactory
class PocketSphinxTest(unittest.TestCase):
def testDefault(self):
config = {
'hey mycroft': {
'module': 'pocketsphinx',
'phonemes': 'HH EY . M AY K R AO F T',
'thre... | {
"content_hash": "5f7b6fc596bcc4b84ce573923d35955b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 65,
"avg_line_length": 33.372093023255815,
"alnum_prop": 0.5358885017421603,
"repo_name": "linuxipho/mycroft-core",
"id": "e4063656f7e585a7edb2ddd1ea341bb570f5383a",
"size"... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class RetrieveToken(Choreography):
def __init__(self, temboo_session):
"""
Create a... | {
"content_hash": "8f5fef8cd6568a4567d48082d8d7f53d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 254,
"avg_line_length": 42.45070422535211,
"alnum_prop": 0.6950895819508959,
"repo_name": "jordanemedlock/psychtruths",
"id": "84ac11fe45f43e76b90ce7e24c0bd790a262dea2",
"s... |
"""Handles all processes relating to instances (guest vms).
The :py:class:`ComputeManager` class is a :py:class:`nova.manager.Manager` that
handles RPC calls relating to creating instances. It is responsible for
building a disk image, launching it via the underlying virtualization driver,
responding to calls to check... | {
"content_hash": "1e50d3f2f262c906676d42f14b722658",
"timestamp": "",
"source": "github",
"line_count": 6361,
"max_line_length": 79,
"avg_line_length": 45.71765445684641,
"alnum_prop": 0.5579209793335855,
"repo_name": "affo/nova",
"id": "b0975edae4a6d7680390c85645ffcbafacddeaee",
"size": "291580",
... |
"""Pyhole Logging"""
import bz2
import glob
import logging
import logging.handlers
import os
import requests
import shutil
import utils
LOG_DIR = utils.get_directory("logs")
LOG_ARCHIVE_DIR = utils.get_directory(os.path.join("logs", "archive"))
LOG_FORMAT = "%(asctime)s [%(name)s] %(message)s"
LOG_DATEFMT = "%H:%M:... | {
"content_hash": "2ed22221e5852454b3d4853bc4a0e319",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 70,
"avg_line_length": 30.625,
"alnum_prop": 0.6217687074829932,
"repo_name": "jk0/pyhole",
"id": "f271eb39e97680acb90fbc3675580a5f79e8d9b4",
"size": "2807",
"binary": fa... |
import os
import ssl
import time
import datetime
import ipaddress
import sys
import typing
from pyasn1.type import univ, constraint, char, namedtype, tag
from pyasn1.codec.der.decoder import decode
from pyasn1.error import PyAsn1Error
import OpenSSL
from mitmproxy.coretypes import serializable
# Default expiry must ... | {
"content_hash": "67f4443fcdbf055ea59f208e4bc117ed",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 119,
"avg_line_length": 32.12141280353201,
"alnum_prop": 0.5828465397567177,
"repo_name": "MatthewShao/mitmproxy",
"id": "4e10529abb01b33a4538725725372d28f14e6074",
"size"... |
"""
BART: Denoising Sequence-to-Sequence Pre-training for
Natural Language Generation, Translation, and Comprehension
See https://arxiv.org/abs/1910.13461.
The BART agent can be instantiated as simply `-m bart`,
however it is recommended to specify `--init-model zoo:bart/bart_large/model`
or `-mf zoo:bart/bart_large/... | {
"content_hash": "2ac324af309aba70066cfd9add6f1400",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 79,
"avg_line_length": 32.248618784530386,
"alnum_prop": 0.5886585574781565,
"repo_name": "facebookresearch/ParlAI",
"id": "27cd5ee39f714a4de1a9125d87b33e87767a93c1",
"siz... |
from .serializers import ActivitySerializer
from ..models import Activity
from helpers.api.viewsets import AuthenticatedModelViewSet
from rest_framework import viewsets
class ActivityViewSet(AuthenticatedModelViewSet):
serializer_class = ActivitySerializer
queryset = Activity.objects.all()
| {
"content_hash": "b2d43bd73e6cbef7314b2ff248aa0c22",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 30.2,
"alnum_prop": 0.8311258278145696,
"repo_name": "toss-app/toss-backend",
"id": "250a37415b0b1fa21be704227be043132ec24f70",
"size": "302",
"bin... |
from __future__ import print_function
import argparse
from hashlib import sha1
from os import link, makedirs, path, remove
import shutil
from subprocess import check_call, CalledProcessError
from sys import stderr
from util import hash_file, resolve_url
from zipfile import ZipFile, BadZipfile, LargeZipFile
CURRENT_LO... | {
"content_hash": "e73b261cd6eff543318edf8da8e5e569",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 78,
"avg_line_length": 31.892215568862277,
"alnum_prop": 0.5912504693954187,
"repo_name": "WANdisco/gerrit",
"id": "bd498f9b16941b1489f2c2892a8595282743a2a8",
"size": "594... |
from flask.ext.wtf import Form
from wtforms.fields import TextField,\
PasswordField,\
BooleanField
from wtforms.validators import Required
class LoginForm(Form):
username = TextField('Username', validators=[Required()])
password = PasswordField('Password', validators=[Required()])
rememb... | {
"content_hash": "a3f1023db14423e26d1221b7b0ec0c04",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 65,
"avg_line_length": 33.45454545454545,
"alnum_prop": 0.7255434782608695,
"repo_name": "taeram/ineffable",
"id": "d897c02f5be927b4cfbf3a45dba51785ddccd5e1",
"size": "368"... |
from zimsoap import zobjects
class MethodMixin:
def create_contact(self, attrs, members=None, folder_id=None, tags=None):
"""Create a contact
Does not include VCARD nor group membership yet
XML example :
<cn l="7> ## ContactSpec
<a n="lastName">MARTIN</a>
... | {
"content_hash": "26e5303afc84b2696cd4dc1fd06795a0",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 34.94117647058823,
"alnum_prop": 0.5090488215488216,
"repo_name": "zacbri/zimsoap",
"id": "a012ec836c742dffd337cec1862153f7917a8d76",
"size": "4752"... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='photos2geojson',
version='1.3',
description="Makes geojson from EXIF data.",
author="Visgean Skeloru",
author_email='[email protected]',
url='https://github.com/visgean/photos2geojson',
... | {
"content_hash": "b1cbf57a3ae383e53a271654d37ad670",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 55,
"avg_line_length": 24.405405405405407,
"alnum_prop": 0.5891472868217055,
"repo_name": "Visgean/photos2geojson",
"id": "57e7b1d185b52bb68bee1fa8fa4e642121fab168",
"size"... |
from __future__ import absolute_import
from datetime import datetime
import jenkins
from celery.utils.log import get_task_logger
from django.conf import settings
from django.utils import timezone
logger = get_task_logger(__name__)
def _get_jenkins_client(jenkins_config):
return jenkins.Jenkins(jenkins_config.j... | {
"content_hash": "6d74a8c64f143971adda19798b9edf9d",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 93,
"avg_line_length": 36.37735849056604,
"alnum_prop": 0.6161825726141079,
"repo_name": "arachnys/cabot",
"id": "362e6ec11fb8eeb605806b4f9d913d6af6a84451",
"size": "1928",... |
from django.urls import reverse_lazy
from django.views.generic import CreateView, DeleteView, DetailView, ListView
from boilerplate.mixins import (
ActionListMixin, CreateMessageMixin, DeleteMessageMixin
)
from core import tasks
from core.models import Invite
from core.views.mixins import (
CompanyCreateMixin... | {
"content_hash": "8ad2b11422d0066991bb266618d76773",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 77,
"avg_line_length": 27.057971014492754,
"alnum_prop": 0.6898768077129084,
"repo_name": "ikcam/django-skeleton",
"id": "242675f6fef8398d1fad4630e03246cba804e1e7",
"size":... |
from django.conf.urls import url
from django.contrib import admin
from .views import (reports_edit_category, reports_edit_product,
reports_edit_report, reports_edit_unit, reports_navigate,
reports_new_category, reports_new_product,
reports_new_report, reports... | {
"content_hash": "42ca895ae09bf2dcc7432039a9f70a76",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 78,
"avg_line_length": 33.23684210526316,
"alnum_prop": 0.5740300870942201,
"repo_name": "VirrageS/io-kawiarnie",
"id": "f90c63ae76ccfe396af1aac31c5f0fb51060c30b",
"size": ... |
import uuid
import os
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from ajax_upload.models import UploadedFile
from . import settings as upload_settings
class UploadedFileForm(forms.ModelForm):
if getattr(settings, 'AJAX_UPLOAD_USE_IMAGE_FIEL... | {
"content_hash": "f4a66f00b80cad1e6169cc5ee25add7e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 109,
"avg_line_length": 31.13888888888889,
"alnum_prop": 0.6610169491525424,
"repo_name": "DjangoAdminHackers/django-ajax-upload-widget",
"id": "2a5b61a6ba99909e307c042194db5... |
import os
import time
import re
import urllib.request
import shutil
import datetime
import sys
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
GENRES = ['Rap', 'Hip-Hop', 'RB', 'Pop', 'Soul',
'Fusion', 'Electro', '', 'Grime']
def parse_date(song_dat... | {
"content_hash": "03f26e476dbafa75736627567cb88979",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 34.825471698113205,
"alnum_prop": 0.5388053636733036,
"repo_name": "PeterParushev/viperial-crawler",
"id": "1f01274e6442b0cbbf1ef7f0c7a71240bf933f33",... |
"""
pretty_helper.py
Contains all of the functions that do the actual analyzing and formatting of the lines of a text file.
"""
import re
def to_text(lines):
"""Re-joins the lines into a single newline-separated string."""
return '\n'.join(lines)
def search_backwards(lines, i):
"""Search backwards unt... | {
"content_hash": "87a8b66293acb400d1da5999336d0e70",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 208,
"avg_line_length": 39.72072072072072,
"alnum_prop": 0.48673168518938537,
"repo_name": "Ryan-Holben/prettify",
"id": "ff618d2562add87ca31a58f21f8a5453dc8ca538",
"size"... |
"""
A mixin which provides listenable methods to an object.
"""
class ListenedObject:
"""
A mixin which provides convenience methods for storing, adding, and removing L{AbstractListener}C{s} to an object.
"""
def __init__(self):
self._listeners = []
def getListeners(self):
"""
Returns the list of listeners... | {
"content_hash": "cc517abed3a5bcd57172d01726ac59e7",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 115,
"avg_line_length": 23.58974358974359,
"alnum_prop": 0.7010869565217391,
"repo_name": "jeremyflores/cocosCairo",
"id": "bc13c6c2d42a37957c940a981545c80e611c6294",
"size... |
"""Tests for the multi-processing base process."""
import unittest
from plaso.multi_processing import base_process
from tests import test_lib as shared_test_lib
class TestProcess(base_process.MultiProcessBaseProcess):
"""Implementation of the multi-processing base process for testing."""
def _GetStatus(self):... | {
"content_hash": "fd9fefb904ebba15b55fe1ef520da918",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 26.189655172413794,
"alnum_prop": 0.7011191573403555,
"repo_name": "dc3-plaso/plaso",
"id": "e91992b82dc79cb7b0911034b7feac2f361bcf95",
"size": "1561... |
import functools
import hashlib
import os
import re
from inspect import isclass
from inspect import ismodule
import pyramid.url
from colander import EMAIL_RE
from pyramid.testing import DummyRequest
from pyramid.threadlocal import get_current_registry
# Regexps for underscore/camelcase convertions
CAMELCASE_RE = re... | {
"content_hash": "224888f7b5cbc50d334bb1ceedf8e3ca",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 76,
"avg_line_length": 22.578199052132703,
"alnum_prop": 0.6389588581024349,
"repo_name": "sanglass/sandglass.time",
"id": "77c3062f6ad71e782c58f2b3460e2ed6d589a260",
"siz... |
import os
import hashlib
import hmac
from flask import Flask, request, abort
import config
app = Flask(__name__)
def verify_github_signature(req):
reqsig = request.headers.get('X-Hub-Signature')
data = request.get_data()
secret = os.environ.get('GITHUB_SECRET', '')
if not reqsig.startswith("sha1="... | {
"content_hash": "c88e674aeb1695ed484a3ac3a2dac1f7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 89,
"avg_line_length": 25.810344827586206,
"alnum_prop": 0.6439545758183033,
"repo_name": "tensorflow/build",
"id": "ae910f6a1ef2a58ceb326a114a0699ac3f4437b6",
"size": "149... |
"""
Created on Thu Mar 3 14:45:35 2016
@author: swoboj
"""
import os, glob,getopt,sys
import scipy as sp
import matplotlib
matplotlib.use('Agg') # for use where you're running on a command line
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from GeoData.plotting import scatterGD, slice2DGD,insert... | {
"content_hash": "6cb6db117b1da7a31037e0c88101c725",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 112,
"avg_line_length": 28.48,
"alnum_prop": 0.6537921348314607,
"repo_name": "jswoboda/MahaliPlotting",
"id": "6c0d72a169f8c3c44c2a8a56b916c2003f754437",
"size": "1446",
... |
from pyglet_gui.controllers import ContinuousStateController
from pyglet_gui.core import Viewer
class Slider(ContinuousStateController, Viewer):
PATH = 'slider'
IMAGE_BAR = 'bar'
IMAGE_KNOB = 'knob'
IMAGE_STEP = 'step'
def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None, steps... | {
"content_hash": "c487cfbd2fac51397323c5d7a22dff0b",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 112,
"avg_line_length": 37.813793103448276,
"alnum_prop": 0.5407623563742476,
"repo_name": "jorgecarleitao/pyglet-gui",
"id": "7194a4d6bd8225e2c4406c73155c64adfaed7738",
"... |
import os
from celery import Celery
env=os.environ
CELERY_BROKER_URL=env.get('CELERY_BROKER_URL','redis://localhost:6379'),
CELERY_RESULT_BACKEND=env.get('CELERY_RESULT_BACKEND','redis://localhost:6379')
celery= Celery('tasks',
broker=CELERY_BROKER_URL,
backend=CELERY_RESULT_BACKEND)
| {
"content_hash": "7f2185c4fe13dc1130e7950bac2e193f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 79,
"avg_line_length": 29.09090909090909,
"alnum_prop": 0.69375,
"repo_name": "CSUChico-CINS465/CINS465-Spring2017-Lecture-Examples",
"id": "910b62b894a0bdf053edbb0a53314daee... |
__author__ = 'toure'
from iridium.plugins.inspector import Plugin
import novaclient.client as nvclient
from iridium.libs.openstack import keystone
class NovaBase(object):
"""
This class is serving as a common interface for both local plugins as well as
openstack client methods.
"""
def __init__(... | {
"content_hash": "cd817daad546d9b9fb1a3884c4026f56",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 100,
"avg_line_length": 33.464285714285715,
"alnum_prop": 0.6414087513340448,
"repo_name": "Toure/Iridium",
"id": "876901c732e13ce51314ac68e5421ffe607b775f",
"size": "937",... |
"""A local settings template.
Be careful changing this file as it will affect all development users.
"""
import fnmatch
# * imports should really never be used. Given this is passing settings around,
# this particular setup is getting a special pass.
from default import *
# local settings
DEBUG = True
TEMPLATE_DEBU... | {
"content_hash": "d9922e6c6af50696dba6eccaf0bcbc7d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 79,
"avg_line_length": 25.195652173913043,
"alnum_prop": 0.6289905090595341,
"repo_name": "iamkelroy/CS673_G1_T3_BUGTRACKER",
"id": "7bb6fc45d0531ecf356cf13e262a4f89152ed6c9"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.