text stringlengths 4 1.02M | meta dict |
|---|---|
from django.views.generic.detail import SingleObjectMixin, SingleObjectTemplateResponseMixin
from django.views.generic.edit import ModelFormMixin, ProcessFormView, BaseDeleteView
from django.utils.translation import get_language
from hvad.forms import translatable_modelform_factory
from hvad.utils import collect_contex... | {
"content_hash": "e590cd448b0b9dc7aef01c70c097213e",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 108,
"avg_line_length": 44.64545454545455,
"alnum_prop": 0.6196294033801669,
"repo_name": "promil23/django-hvad",
"id": "5d0175ef684cc8d6ee39563070f45870fe7e0828",
"size":... |
from pykalman import KalmanFilter
def moving_average(values, transition_covariance=.01):
kf = KalmanFilter(transition_matrices = [1],
observation_matrices = [1],
initial_state_mean = 0,
initial_state_covariance = 1,
observatio... | {
"content_hash": "44f0433983ec1fe31d51ea456f3d2ed9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 38.5,
"alnum_prop": 0.577922077922078,
"repo_name": "gpostelnicu/fin_data",
"id": "45a39bd04e797a34b84a0a51f1a3fcb07130a77c",
"size": "462",
"binar... |
from __future__ import absolute_import
from logging import getLogger
Logger = getLogger('chime.error_functions')
from flask import current_app, request
from urllib import quote
from urlparse import urlparse
from os.path import join, exists
from .view_functions import get_repo, strip_index_file, path_display_type, get_... | {
"content_hash": "d2922b7afae35156b28e11d406cc7847",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 159,
"avg_line_length": 41.86734693877551,
"alnum_prop": 0.6361199122593224,
"repo_name": "darvelo/chime",
"id": "9c96d515a3590d5e3e098d2a31f5455607353897",
"size": "4103",... |
from typing import Sequence
from google.api_core.client_options import ClientOptions
from google.cloud import documentai
# TODO(developer): Uncomment these variables before running the sample.
# project_id = 'YOUR_PROJECT_ID'
# location = 'YOUR_PROCESSOR_LOCATION' # Format is 'us' or 'eu'
# processor_id = 'YOUR_PROCE... | {
"content_hash": "247194c3d8a85fcebd1cbb0c4b9184bd",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 120,
"avg_line_length": 39,
"alnum_prop": 0.6974969474969475,
"repo_name": "googleapis/python-documentai",
"id": "e49e8ff1895af411581feca08fc47dd47861a389",
"size": "3901",... |
"""
=============================================
Joint feature selection with multi-task Lasso
=============================================
The multi-task lasso allows to fit multiple regression problems
jointly enforcing the selected features to be the same across
tasks. This example simulates sequential measuremen... | {
"content_hash": "7c4e6fb958481c95e6fef112e780475c",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 33.16923076923077,
"alnum_prop": 0.6572356215213359,
"repo_name": "Eric89GXL/scikit-learn",
"id": "699b2e00d7f03baa8f91657f275e9b8a5152377b",
"size":... |
import os
import unittest
from conans.test.utils.tools import TestClient
class UserChannelTestPackage(unittest.TestCase):
def test(self):
# https://github.com/conan-io/conan/issues/2501
client = TestClient()
conanfile = """from conans import ConanFile
class SayConan(ConanFile):
pass
... | {
"content_hash": "30976fa22b720554b2891349d53dbf32",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 97,
"avg_line_length": 34.98351648351648,
"alnum_prop": 0.6210146065651013,
"repo_name": "memsharded/conan",
"id": "a5a5655121cd9e2f6676781f678da3fa72aa7af8",
"size": "636... |
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
"""
import httplib
import endpoints
from protorpc import messages
from google.appengine.ext import ndb
class ConflictException(endpoints.ServiceException):
"""ConflictExcept... | {
"content_hash": "905608268da20076df95a93c3dd287c1",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 77,
"avg_line_length": 30.88268156424581,
"alnum_prop": 0.7212373371924746,
"repo_name": "YH-Zhou/ConferenceCentral",
"id": "ce38da4c5cbe58126e89c2d10042957b4c26bc1f",
"si... |
"""DatabaseExtractors query upstream databases and save data on S3 before writing manifests."""
from contextlib import closing
from typing import Dict, List, Optional
import etl.db
from etl.config.dw import DataWarehouseSchema
from etl.extract.extractor import Extractor
from etl.relation import RelationDescription
c... | {
"content_hash": "ebdec7d3761e9302ba57bfe9753935a8",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 102,
"avg_line_length": 38.4,
"alnum_prop": 0.5911458333333334,
"repo_name": "harrystech/arthur-redshift-etl",
"id": "ba2b39de5b69e08d66e9a1d81828598d9484cfd6",
"size": "7... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python import tf2
from tensorflow.contrib.solvers.python.ops import lanczos
from tensorflow.contrib.solvers.python.ops import util
from tensorflow.python.framework import con... | {
"content_hash": "61e1f5a1e6b15173db27c58da14729fc",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 80,
"avg_line_length": 37.59493670886076,
"alnum_prop": 0.6080808080808081,
"repo_name": "theflofly/tensorflow",
"id": "f31bdbd399c9de4f2f5d557b75b1ece6d64a765e",
"size": "... |
"""
Display uptime for workers in running Storm topologies.
"""
from __future__ import absolute_import, print_function
from pkg_resources import parse_version
from prettytable import PrettyTable
from .common import add_environment
from ..util import get_ui_json, storm_lib_version
def subparser_hook(subparsers):
... | {
"content_hash": "cccd0e8b71fed36591d118c6d4d9527d",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 85,
"avg_line_length": 37.58064516129032,
"alnum_prop": 0.5901287553648069,
"repo_name": "crohling/streamparse",
"id": "3d8f539b4020265eaa01bd428b69b4381fd7293c",
"size": "... |
__author__ = 'Shamal Faily'
from . import ObjectCreationParameters
class TemplateObstacleParameters(ObjectCreationParameters.ObjectCreationParameters):
def __init__(self,obsName,obsCat,obsDef,obsConcerns,obsResp,obsProb,obsProbRat):
ObjectCreationParameters.ObjectCreationParameters.__init__(self)
self.theNa... | {
"content_hash": "9f601f706a4128b8b19704b755ffba84",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 84,
"avg_line_length": 41.54545454545455,
"alnum_prop": 0.7932166301969366,
"repo_name": "nathanbjenx/cairis",
"id": "dd6ad8c3e8c2351b3464509195afd601d5e88470",
"size": "17... |
from bitcoin.main import *
from bitcoin.transaction import *
from bitcoin.bci import *
from bitcoin.deterministic import *
from bitcoin.blocks import *
# Takes privkey, address, value (satoshis), fee (satoshis)
def send(frm, to, value, fee=10000, **kwargs):
return sendmultitx(frm, to + ":" + str(value), fee, **kw... | {
"content_hash": "fcc2951536252edcb985e3a865ff67a1",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 94,
"avg_line_length": 31.721212121212123,
"alnum_prop": 0.5909438288116163,
"repo_name": "wizardofozzie/pybitcointools",
"id": "b7d7c8e11302a9ce7c4bce17532becd698a5a747",
... |
extensions = ['hieroglyph']
templates_path = ['_templates']
exclude_patterns = ['_build']
source_suffix = '.rst'
master_doc = 'index'
project = u'Slides'
copyright = u'2017, Markus Zoeller'
author = u'Markus Zoeller'
# TODO: Use ``git describe`` here.
version = u'2017.12.28'
release = version # it's always the same... | {
"content_hash": "1a202b18cad4630f003e12dc41130163",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 78,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.623352165725047,
"repo_name": "markuszoeller/edu",
"id": "649a536f2c2aebd0686d54e0aed60404879acd43",
"size": "632... |
from __future__ import print_function
import json
import netrc
from optparse import SUPPRESS_HELP
import os
import re
import shutil
import socket
import subprocess
import sys
import time
from pyversion import is_python3
if is_python3():
import urllib.parse
import xmlrpc.client
else:
import imp
import urlparse
... | {
"content_hash": "5d8c72176c51afe026225a328464da7b",
"timestamp": "",
"source": "github",
"line_count": 837,
"max_line_length": 93,
"avg_line_length": 34.432497013142175,
"alnum_prop": 0.6080152671755725,
"repo_name": "4455jkjh/repo",
"id": "43d450be5b8b6a739fff3b70c0f866cb12967b73",
"size": "29423... |
from django import template
from django.template.loader import render_to_string
register = template.Library()
@register.tag
def pagemenu(parser, token):
"""
Output pagemenu.
"""
try:
tag_name, pagemenu = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError('... | {
"content_hash": "08a3a4a6e354c2d8754f6e5ed7dc4808",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 135,
"avg_line_length": 31.22222222222222,
"alnum_prop": 0.6571767497034401,
"repo_name": "praekelt/django-pagemenu",
"id": "604ac3fb828273a8661e66ce5d14c1405cbff0a7",
"siz... |
# -*- coding: utf-8 -*-
# Copyright 2008-2013 Alex Zaddach (mrzmanwiki@gmail.com), bjweeks
# This file is part of wikitools.
# wikitools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of th... | {
"content_hash": "23557f5375965e604cbcfd838e3191bb",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 161,
"avg_line_length": 29.08108108108108,
"alnum_prop": 0.6356877323420075,
"repo_name": "rrallo/GenomeBrowser",
"id": "85ebbe69c1d57d8005f03b2205eff240d018a20d",
"size":... |
import logging
import time
import zlib
import sys
import socket
import os
from ..packages import six
from ..packages import requests
from .. import version as agent_version
from .addresses import platform_url, proxy_details
from .exceptions import (NetworkInterfaceException, ForceAgentRestart,
ForceAgentDis... | {
"content_hash": "199f93bae4f48acc03949655d2ac7b05",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 79,
"avg_line_length": 40.16828478964401,
"alnum_prop": 0.5939413470834676,
"repo_name": "Arable/evepod",
"id": "09bf115e4e6ed27810c3e44c16939ce299522f1f",
"size": "12412"... |
"""
PaaSTA service list (instances) etc.
"""
from pyramid.view import view_config
from paasta_tools import __version__
@view_config(route_name="version", request_method="GET", renderer="json")
def version(request):
return __version__
| {
"content_hash": "0c03b219dadcf954e41e9949509821bb",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 21.90909090909091,
"alnum_prop": 0.7136929460580913,
"repo_name": "Yelp/paasta",
"id": "2fffa66c3264b7e74a7277cd73749d1b1592af43",
"size": "841",
"... |
import subprocess
import argparse
import json
import pickle
import ast
import datetime
import os
from pprint import pprint
import requests
def unix_time(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
return delta.total_seconds()
def unix_time_millis(dt):
return unix_time(dt) * 1... | {
"content_hash": "9abdd47e07e9a2f93549a4582fe8043e",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 152,
"avg_line_length": 31.11320754716981,
"alnum_prop": 0.6303820497271073,
"repo_name": "ThomasMarcel/tom-schneider-flask",
"id": "22c16df2343104b8eb7fa8d20b48e877f44596a4... |
"""
lychee upload v1.3
(C) 2014-2015 Roman Sirokov
Imports images from a location on hard drive to the Lychee installation on a remote server via SSH.
Based on lycheesync by Gustave Paté
https://github.com/GustavePate/lycheesync
"""
import argparse
import os
import sys
import re
import logging
import sources.dire... | {
"content_hash": "0b47c70fd94ae715e90f145aa51a8fee",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 119,
"avg_line_length": 34.84848484848485,
"alnum_prop": 0.617888198757764,
"repo_name": "r0x0r/lycheeupload",
"id": "ba3a28031595e94725c5feb4e68f4ed658600de7",
"size": "8... |
import pytest
from blitzdb import Document
from ..conftest import test_mongo
if test_mongo:
def test_non_existing_key(mongodb_backend):
attributes = {'foo': 'bar', 'baz': 1243, 'd': {1: 3, 4: 5}, 'l': [1, 2, 3, 4]}
doc = Document(attributes)
mongodb_backend.save(doc)
mongodb_ba... | {
"content_hash": "6d3ea27f76fdf8ad694dd90f43979d7c",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 96,
"avg_line_length": 30.313432835820894,
"alnum_prop": 0.5775480059084195,
"repo_name": "adewes/blitzdb",
"id": "cd80294e04658b5a0b1b3fda98b36708087a56c4",
"size": "2031"... |
import numpy as np
from .base import HomogFamilyAlignment
from .affine import DiscreteAffine
from .similarity import Similarity
class Translation(DiscreteAffine, Similarity):
r"""
An ``n_dims``-dimensional translation transform.
Parameters
----------
translation : ``(n_dims,)`` `ndarray`
... | {
"content_hash": "476c79ae75ae8f35a3b94b6f5dcdf035",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 78,
"avg_line_length": 30.204225352112676,
"alnum_prop": 0.5283282816507344,
"repo_name": "mozata/menpo",
"id": "77b0e48634023ff5dd2b9ea9238060cbbd081957",
"size": "4289",... |
from socialauth.models import UserProfile
import logging
logger = logging.getLogger(__name__)
def get_profile(
backend,
user,
response,
details,
is_new=False,
*args,
**kwargs
):
img_url = None
#Get photo
if backend.name == 'facebook':
img_url = 'http:... | {
"content_hash": "7b9d0086cc6a033e973bff6b573e437a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 27.12,
"alnum_prop": 0.5958702064896755,
"repo_name": "latuannetnam/django-socialauth",
"id": "3824d9b9c0882d1091ca685b5496e2eac5db9a19",
"size": "13... |
from __future__ import print_function
import sys, os
md = os.path.abspath(os.path.split(__file__)[0])
sys.path = [os.path.join(md, '..', '..', 'util')] + sys.path
dataFile = "../../atlas/CochlearNucleus/images/cochlear_nucleus.ma"
labelFile = "../../atlas/CochlearNucleus/images/cochlear_nucleus_label.ma"
from acq4.ut... | {
"content_hash": "32e3f62e8070ea22f68a2a90e1a1f3d4",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 149,
"avg_line_length": 30.580357142857142,
"alnum_prop": 0.6005839416058394,
"repo_name": "meganbkratz/acq4",
"id": "6c04a3a5e9b098c686a9aa5428d1ccdbd7cb02e9",
"size": "1... |
import traceback
from cassandra.metadata import cql_keywords_reserved
from . import pylexotron, util
Hint = pylexotron.Hint
class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
available_compression_classes = (
'DeflateCompressor',
'SnappyCompressor',
'LZ4Compressor',
)
available... | {
"content_hash": "737789dd9e71ded0347c9be240782dd8",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 103,
"avg_line_length": 37.67192429022082,
"alnum_prop": 0.535672416680623,
"repo_name": "iburmistrov/Cassandra",
"id": "6ee3cf57db9c978e24c648d6b1d031a8f6f4494d",
"size":... |
from calvin.utilities.calvin_callback import CalvinCB
from calvin.utilities import calvinlogger
from calvin.utilities import calvinuuid
from calvin.runtime.south.plugins.transports import base_transport
_log = calvinlogger.get_logger(__name__)
_join_request_reply = {'cmd': 'JOIN_REPLY', 'id': None, 'sid': None, 'seri... | {
"content_hash": "9dd5aeea14c9ec8c700ea0ae27317c31",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 105,
"avg_line_length": 36.82272727272727,
"alnum_prop": 0.5830144426613998,
"repo_name": "les69/calvin-base",
"id": "5a856baaa7e95c0cd2535284f2c64b0503da9d74",
"size": "8... |
"""Runs an infinite loop to find race conditions in context get_tasklet."""
from google.appengine.ext import testbed
from ndb import model
from ndb import tasklets
def cause_problem():
tb = testbed.Testbed()
tb.activate()
tb.init_datastore_v3_stub()
tb.init_memcache_stub()
ctx = tasklets.make_default_cont... | {
"content_hash": "a35917eae746629910f07b2cab51cc8c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 75,
"avg_line_length": 25.027027027027028,
"alnum_prop": 0.6771058315334774,
"repo_name": "GoogleCloudPlatform/datastore-ndb-python",
"id": "b256d05c1524405221ead5f87f5f697f1... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0031_projector_default_height"),
("agenda", "0008_default_ordering_item"),
]
operations = [
migrations.AddField(
model_name="item",
name="tags",
... | {
"content_hash": "63db4b21feeadb37e764c7fb3cd7e4c6",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 23.647058823529413,
"alnum_prop": 0.5746268656716418,
"repo_name": "jwinzer/OpenSlides",
"id": "96384a03258847e4f3f9ee3ea7dd9ddc9b1fdb8a",
"size": "4... |
__author__ = 'hs634'
from collections import defaultdict
class TrieNode(object):
def __init__(self, value=None):
self.val = value
self.children = {}
self.is_end = False
class Trie(object):
def __init__(self, root_value='0'):
self.root = TrieNode(root_value)
def insert(se... | {
"content_hash": "8a4fc45b23b922cbf99c10db92399d77",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 72,
"avg_line_length": 21.279411764705884,
"alnum_prop": 0.497581202487906,
"repo_name": "hs634/algorithms",
"id": "b866f0e99c4a020856ddc96770d9ff352c74d83b",
"size": "1447... |
from couchdbkit import Document, StringProperty, SchemaListProperty
import bcrypt
__all__ = ['Permission', 'Group', 'User', 'init_model']
def hashpw(password, salt=None):
"""
Hash a password using the optional salt. If salt is not specified one
will be generated. The hash, which includes the salt, is re... | {
"content_hash": "0dd0efc84e648228d3eb2a3c6a2430bf",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 86,
"avg_line_length": 32.870588235294115,
"alnum_prop": 0.6664280601288475,
"repo_name": "BlueDragonX/whatcouch",
"id": "a19966f368a6517d20ecff595237bcfb5d028195",
"size":... |
from .health_evaluation import HealthEvaluation
class ReplicaHealthEvaluation(HealthEvaluation):
"""Represents health evaluation for a replica, containing information about
the data and the algorithm used by health store to evaluate health. The
evaluation is returned only when the aggregated health state ... | {
"content_hash": "335113c15c1e770c37335c4f43bc2617",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 147,
"avg_line_length": 48.270833333333336,
"alnum_prop": 0.6983167889512301,
"repo_name": "SUSE/azure-sdk-for-python",
"id": "db1c4349529985b7c2cf37a57c55dfd372da326c",
"s... |
"""
.. moduleauthor:: Gabriel Martin Becedillas Ruiz <gabriel.becedillas@gmail.com>
"""
import unittest
import datetime
import broker_backtesting_test
from pyalgotrade import broker
from pyalgotrade.broker import fillstrategy
from pyalgotrade.broker import backtesting
from pyalgotrade import bar
class BaseTestCase... | {
"content_hash": "a172c02036ab9f59ed650c20b55d65c1",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 141,
"avg_line_length": 60.85470085470085,
"alnum_prop": 0.7116573033707865,
"repo_name": "cgqyh/pyalgotrade-mod",
"id": "21d6f1921311a29cfc43cdff8ae431a074640caa",
"size"... |
import sys
import os
import unittest
from copow.lib import powlib
class TestVersion(unittest.TestCase):
def setUp(self):
"""Setup everything needed for the test (should be as few as possible)"""
return
def testFirst(self):
"""test 1st says: 1st specify and fail,... | {
"content_hash": "02fc8a4f6ac38e09dd496f75d2dd151d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 81,
"avg_line_length": 21.363636363636363,
"alnum_prop": 0.5914893617021276,
"repo_name": "pythononwheels/copow",
"id": "3a8a5733f25ba5a3003a4d810b0797252fac469e",
"size": ... |
""" Domain expression processing
The main duty of this module is to compile a domain expression into a
SQL query. A lot of things should be documented here, but as a first
step in the right direction, some tests in test_osv_expression.yml
might give you some additional information.
For legacy reasons, a domain uses a... | {
"content_hash": "59c907c5650bc0c06315720a14b2e3c7",
"timestamp": "",
"source": "github",
"line_count": 1214,
"max_line_length": 173,
"avg_line_length": 46.183690280065896,
"alnum_prop": 0.5344141830310165,
"repo_name": "chjw8016/GreenOdoo7-haibao",
"id": "b1717e91a5893b7c6ce362366e17cea5dee89ce7",
... |
import datetime
from hashlib import sha1
import logging
from pymongo import MongoClient
from pymongo.mongo_replica_set_client import MongoReplicaSetClient
import pymongo.uri_parser
import pymongo.errors
from saml2.saml import NAMEID_FORMAT_PERSISTENT
from saml2.eptid import Eptid
from saml2.mdstore import InMemoryMet... | {
"content_hash": "a2345ce3ab998e6574b6e3c073b7feaf",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 79,
"avg_line_length": 31.463470319634702,
"alnum_prop": 0.5564182570205355,
"repo_name": "cloudera/hue",
"id": "0cc33619072a61d656a43ccac5cff89ccb15691f",
"size": "13781"... |
import sys, imp, os
try:
import electrum
except:
sys.path.append(os.environ['HOME'] + '/sourcecode/electrum')
imp.load_module('electrum', *imp.find_module('lib'))
import electrum
script_dir = os.path.dirname(os.path.realpath(__file__))
class ElectrumClient:
def __init__(self, server = None, proxy ... | {
"content_hash": "fee1e6b806e820c2197f9f437b703aa6",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 84,
"avg_line_length": 33.811764705882354,
"alnum_prop": 0.5768963117606124,
"repo_name": "ulrichard/bitcoinutilities",
"id": "4a3e42b4fbb9c6fed3d340d7f4280f447b607d64",
"s... |
arduino = Runtime.createAndStart("Arduino","Arduino")
arduino.connect("/dev/ttyACM0")
leftneckPin = 14
rightneckPin = 15
# Function to keep the servo movements in sync
# If both servos should rotate in the same direction, change from "- delta" to "+ delta"
def neckMoveTo(restPos,delta):
leftneckServo.moveTo(restPos + ... | {
"content_hash": "433ee095612b2dc25c7b4f91c598c5d8",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 29.5,
"alnum_prop": 0.7785310734463277,
"repo_name": "MyRobotLab/pyrobotlab",
"id": "8926d3e73538edddfb3d85df1780116ccda5d266",
"size": "905",
"bin... |
from pyoembed.providers import BaseProvider
class GeographOrgUkProvider(BaseProvider):
priority = 10
oembed_schemas = ['http://*.geograph.org.uk/*',
'http://*.geograph.co.uk/*',
'http://*.geograph.ie/*',
# not tested
'ht... | {
"content_hash": "911ca9ec8cfc5d2e1ed0e10eb8a3ec4b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 32.69230769230769,
"alnum_prop": 0.5364705882352941,
"repo_name": "rafaelmartins/pyoembed",
"id": "1319c0bfaf4d6366afb2987e3a34d0a4b0a67d30",
"size":... |
"""
Code PyQt4
In this example, we create a simple
window in PyQt4.
"""
import sys, os
from PyQt4 import QtGui, QtCore
class Button(QtGui.QToolButton):
def __init__(self, text, parent=None):
super(Button, self).__init__(parent)
self.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGu... | {
"content_hash": "021ddef37e7425db7dab94f47fceaf0f",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 79,
"avg_line_length": 28.652173913043477,
"alnum_prop": 0.6215477996965099,
"repo_name": "janusnic/21v-python",
"id": "4f21906ef705dad2b9c78c86768f65ddd0ffbce3",
"size": ... |
"""
/shell.py will allow you to get a console and enter commands within your flask environment.
"""
import os
import sys
import readline
from pprint import pprint
from flask import *
sys.path.insert(0, '/home/lucas/www/reddit.lucasou.com/reddit-env/flask_reddit')
from flask_reddit import *
from flask_reddit.users.mod... | {
"content_hash": "0986a9ab2ff53b533ea04a0dd2ea193a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 91,
"avg_line_length": 29.444444444444443,
"alnum_prop": 0.7830188679245284,
"repo_name": "codelucas/flask_reddit",
"id": "61e36a1634516564bb3d1cadd2941633d709a629",
"size"... |
import logging
import os
import uuid
from keystoneauth1.identity import generic
from keystoneauth1 import session as keystone_session
from designateclient.v2 import client
logging.basicConfig(level='DEBUG')
auth = generic.Password(
auth_url=os.environ.get('OS_AUTH_URL'),
username=os.environ.get('OS_USERNAM... | {
"content_hash": "47114b223e3b60573b6b2e1d35fb9355",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 53,
"avg_line_length": 23,
"alnum_prop": 0.6897233201581028,
"repo_name": "openstack/python-designateclient",
"id": "febbe9068495097f7413538a958998566d9a45e2",
"size": "101... |
"""Tests for the Cast config flow."""
from unittest.mock import ANY, patch
import pytest
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import cast
from tests.common import MockConfigEntry
async def test_creating_entry_sets_up_media_player(hass):
"""Test setting up Cast... | {
"content_hash": "64f13921393193c3a2e28dd50f7f8df4",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 88,
"avg_line_length": 34.46621621621622,
"alnum_prop": 0.6237012350519506,
"repo_name": "w1ll1am23/home-assistant",
"id": "97218a396dd3cfc3b2816c62b9ed4fb64d1c7c24",
"siz... |
from datetime import datetime
from csv import DictReader
from math import exp, log, sqrt
# parameters #################################################################
train = 'train.csv' # path to training file
test = 'test.csv' # path to testing file
D = 2 ** 20 # number of weights use for learning
alpha = .1... | {
"content_hash": "7c3009984c67cfcfe47128aaffbe0667",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 29.584745762711865,
"alnum_prop": 0.5585792036665712,
"repo_name": "ryanswanstrom/Sense.io-Projects",
"id": "673cf909ab02fa0696165d5cbfb5990a16d956b2"... |
ONBOARDING_FLOW = ['/onboarding/follow', '/invite', '/onboarding/welcome']
ONBOARDING_START = ONBOARDING_FLOW[0] + '?onboarding'
ONBOARDING_FINISH = '/'
def is_onboarding(request):
return (request.user.is_authenticated()
and 'onboarding' in request.GET
and request.path in ONBOARDING_FLOW)
... | {
"content_hash": "ab57738399422172b4289604aaed3819",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 87,
"avg_line_length": 30.526315789473685,
"alnum_prop": 0.6810344827586207,
"repo_name": "canvasnetworks/canvas",
"id": "1c4b6fc1b3c92f0196ea639623af0b8dc24000c0",
"size":... |
"""Pathname and path-related operations for the Macintosh."""
import os
from stat import *
# Normalize the case of a pathname. Dummy in Posix, but <s>.lower() here.
def normcase(path):
return path.lower()
def isabs(s):
"""Return true if a path is absolute.
On the Mac, relative paths begin with a colo... | {
"content_hash": "b280e7c6336e62acec78f12fcd5e4f99",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 79,
"avg_line_length": 25.896860986547086,
"alnum_prop": 0.578008658008658,
"repo_name": "MalloyPower/parsing-python",
"id": "12eec0c97ea5c81db2c10116a4cd89c316e4b68b",
"s... |
"""
CNAME Lookup Middleware
Middleware that translates an unknown domain in the host header to
something that ends with the configured storage_domain by looking up
the given domain's CNAME record in DNS.
This middleware will continue to follow a CNAME chain in DNS until it finds
a record ending in the configured stor... | {
"content_hash": "dbaae7cca5dacaed616f375cba79deec",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 77,
"avg_line_length": 37.96363636363636,
"alnum_prop": 0.5539591315453385,
"repo_name": "gotostack/swift",
"id": "bd3697144b7dbcd240a234c5c3562759c9ca3081",
"size": "6860... |
import unittest
from telemetry import decorators
from telemetry.core import browser_options
from telemetry.core.backends.chrome import ios_browser_finder
class IosBrowserFinderUnitTest(unittest.TestCase):
# TODO(baxley): Currently the tests require a device with Chrome running.
# This should be stubbed out so it... | {
"content_hash": "188521226c1dd245af8410ae81e47669",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 34.904761904761905,
"alnum_prop": 0.762619372442019,
"repo_name": "krieger-od/nwjs_chromium.src",
"id": "e9e9042943183b3e9a7e1ae81b596e6666916b14",
"... |
import argparse
from fp import similarity, fingerprint, score, read_file
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Rank pairs of files by similarity.')
parser.add_argument('files', nargs='+', type=str, help='files to rank')
parser.add_argument('--k', type=int, default=2, help... | {
"content_hash": "f54b849fd55f43c520d81900dc9ee99e",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 107,
"avg_line_length": 43,
"alnum_prop": 0.6056201550387597,
"repo_name": "lionell/labs",
"id": "0c1b249d23f4e2871f3c4edec5b3b3e74f58e092",
"size": "1056",
"binary": fal... |
from decimal import Decimal as D
from unittest import mock
from django.test import TestCase
from oscar.apps.partner import strategy
class TestNoTaxMixin(TestCase):
def setUp(self):
self.mixin = strategy.NoTax()
self.product = mock.Mock()
self.stockrecord = mock.Mock()
self.stock... | {
"content_hash": "2bbafa653a0e179a63a109c88b821d6c",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 32.07017543859649,
"alnum_prop": 0.6449671772428884,
"repo_name": "sasha0/django-oscar",
"id": "46bec65c8c59720455caff64e9a3360257b9b02e",
"size": "1... |
"""
@summary:
Demonstrates the basic usage.
@author: Ruben Reifenberg
"""
# First, create a pure database-writing server:
# (this is independent from the connection type, like XMLRPC)
from rrlog.server import dbwriter_sa
engineStr = "mysql://logtester@localhost/logtest"
logServer = dbwriter_sa.createRotatingSe... | {
"content_hash": "e265265fa94e42ef5e85c21b18f84c7f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 100,
"avg_line_length": 23.142857142857142,
"alnum_prop": 0.7358024691358025,
"repo_name": "shful/python-rrlog",
"id": "c8c781e4782cf1c695e38997d2ed1194b8e1d91f",
"size": "... |
import mock
from rally import exceptions
from rally.plugins.openstack import types
from tests.unit import fakes
from tests.unit import test
class FlavorTestCase(test.TestCase):
def setUp(self):
super(FlavorTestCase, self).setUp()
self.clients = fakes.FakeClients()
self.clients.nova().fla... | {
"content_hash": "f8e19d2c0ca53de6335f4a3f87b885da",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 79,
"avg_line_length": 43.032051282051285,
"alnum_prop": 0.5852822880977209,
"repo_name": "eayunstack/rally",
"id": "40c59c45d5b6206f849e18f66e5e7ddc3585d28e",
"size": "14... |
import unreal_engine as ue
class FacesDetector:
def __init__(self):
self.texture_to_draw = None
def draw_hud(self):
# exit if we do not have enough data
if not self.texture_to_draw:
return
# draw what the player pawn is seeing
self.uobject.h... | {
"content_hash": "fb16064337059d37d5cc3c97e46a3b8c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 75,
"avg_line_length": 26.642857142857142,
"alnum_prop": 0.5898123324396782,
"repo_name": "getnamo/UnrealEnginePython",
"id": "56f5081cc39672c67275909f76f41bba45d9afb4",
"s... |
import json
import os
import sys
import logging
from subprocess import Popen, PIPE
def mkdir(directory):
if not os.path.isdir(directory):
cmd = 'mkdir -p %s' % directory
output = Popen(cmd, stdout=PIPE, shell=True).stdout.read()
logging.info(cmd)
logging.info(output)
def mount(entr... | {
"content_hash": "09d02d26371aab60ff9ab969b56b7d8a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 66,
"avg_line_length": 28.2972972972973,
"alnum_prop": 0.6255969436485196,
"repo_name": "jhorey/ferry",
"id": "665e12ff46e8bfca8f20979e0be88c3142a8e35a",
"size": "1047",
... |
"""Defines a git hook to allow pre-commit warnings and errors about import order.
usage:
exit_code = git_hook(strict=True|False, modify=True|False)
"""
import os
import subprocess # nosec - Needed for hook
from pathlib import Path
from typing import List
from isort import Config, api, exceptions
def get_output... | {
"content_hash": "503da681f9e39a515725cb177b5c2ada",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 97,
"avg_line_length": 36.406976744186046,
"alnum_prop": 0.6339827531140211,
"repo_name": "PyCQA/isort",
"id": "135886fcbcbb28f8ec8144e27937bd86693b1540",
"size": "3131",
... |
from setuptools import setup, find_packages
from react import VERSION
setup(
name='PyReact',
version=VERSION,
author='Kunal Mehta',
author_email='kunalm@fb.com',
url='https://github.com/reactjs/react-python/',
license='Apache-2.0',
description='Python bridge to JSX & the React JavaScript l... | {
"content_hash": "c59273f28e361a02ea7b51b80b1841f1",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 71,
"avg_line_length": 31.885714285714286,
"alnum_prop": 0.6129032258064516,
"repo_name": "frankier/react-python",
"id": "59ab67b7d3d36de20dd14ff87226af716dc44b1a",
"size":... |
"""
This module is used to find key words and phrases in the articles index and map the
text to sentiment values in the googles index
"""
import json
import re
import pickle
import math
import os
import numpy as np
import nltk
import elastic
class ElasticSentimentSelection(object):
"""
Conducts a search on an ... | {
"content_hash": "fe2eb621776155ee2c991da535931b3d",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 100,
"avg_line_length": 36.17314487632509,
"alnum_prop": 0.6030086939533066,
"repo_name": "kapil1garg/eecs338-chris-jones",
"id": "62fb02ef6c7c3a8ef047156d00040c5c973437a4",... |
import sys
import os
import torch
sys.path += ['../']
import gzip
import pickle
from utils.util import pad_input_ids, multi_file_process, numbered_byte_file_generator, EmbeddingCache
import csv
from model.models import MSMarcoConfigDict, ALL_MODELS
from torch.utils.data import DataLoader, Dataset, TensorDatase... | {
"content_hash": "5a0de6531243671fe8b08d0d4875cfa6",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 162,
"avg_line_length": 31.236238532110093,
"alnum_prop": 0.5371906894779352,
"repo_name": "microsoft/ANCE",
"id": "a01a84f3b47964381956fa2bc90fbf22a363fce3",
"size": "136... |
import urllib.parse
from django.test import Client, TestCase
from django.urls import reverse
from circuits.models import Circuit, CircuitType, Provider
from utilities.testing import create_test_user
class ProviderTestCase(TestCase):
def setUp(self):
user = create_test_user(permissions=['circuits.view_p... | {
"content_hash": "e598edbe201239e5498f08d362fc6903",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 87,
"avg_line_length": 31.778947368421054,
"alnum_prop": 0.6316661146074859,
"repo_name": "lampwins/netbox",
"id": "cb0ea0a320f7647da67d5d26beecef61832ad9db",
"size": "3019... |
from __future__ import absolute_import, print_function, unicode_literals
import jinja2
from lxml import etree, html
from lxml.html import clean
import logging
import sys
import zipfile
from preprocess import preprocess
import json
from cgi import escape
__author__ = 'bluec0re'
log = logging.getLogger(__name__)
d... | {
"content_hash": "1dd895c0411564d944d47f278099eb52",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 117,
"avg_line_length": 31.27027027027027,
"alnum_prop": 0.56028522039758,
"repo_name": "bluec0re/python-docx_templating",
"id": "6de19a31a119127c824a0acc0f54df99245b103c",
... |
from os import path
from django.template import Library
register = Library()
@register.filter
def shortenfilepath(path, num_dirs=2, pathsep='/'):
splitted = path.split(path)[1]
return pathsep.join(path.split(pathsep)[-num_dirs:])
| {
"content_hash": "0604bb079ee4ee98501e77efc9815a92",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 56,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.7291666666666666,
"repo_name": "reincubate/django-templatesadmin",
"id": "dfe213727448ebcf33fb97eafcab64b14d7f9782",... |
from geopy.geocoders.bing import Bing
from geopy.geocoders.google import Google
from geopy.geocoders.googlev3 import GoogleV3
from geopy.geocoders.dot_us import GeocoderDotUS
from geopy.geocoders.geonames import GeoNames
from geopy.geocoders.wiki_gis import MediaWiki
from geopy.geocoders.wiki_semantic import SemanticMe... | {
"content_hash": "91ba1a3cd94b908b6ddc605e4a713609",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 92,
"avg_line_length": 45.83838383838384,
"alnum_prop": 0.5579550462758924,
"repo_name": "pivotal-energy-solutions/geopy",
"id": "84544065bf1eb63f8a53e7288112f8dc1aa727ed",
... |
"""Package contenant la commande 'escalader'."""
from primaires.interpreteur.commande.commande import Commande
from primaires.interpreteur.masque.exceptions.erreur_interpretation import \
ErreurInterpretation
class CmdEscalader(Commande):
"""Commande 'escalader'"""
def __init__(self):
"... | {
"content_hash": "eef957220a3d627688bea75504184e46",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6380165289256199,
"repo_name": "stormi/tsunami",
"id": "fe99ddca4155e4d11a4fbb7daf3c1d345cc0c851",
"size": "2779"... |
from __future__ import absolute_import, division, print_function, with_statement
import logging
import re
import socket
import sys
import traceback
from tornado.concurrent import Future, return_future, ReturnValueIgnoredError, run_on_executor
from tornado.escape import utf8, to_unicode
from tornado import gen
from to... | {
"content_hash": "7b5de44bb8f152b9d5f9e87a2371da39",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 94,
"avg_line_length": 32.065,
"alnum_prop": 0.6135973803212225,
"repo_name": "lancezlin/ml_template_py",
"id": "8ce095ec1b3118e2d49a99b168c844d9399d139e",
"size": "13422"... |
import unittest
from rx import Observable
from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable
from rx.disposables import Disposable, SerialDisposable
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
sub... | {
"content_hash": "1d0a453aa81a67e0d6a442d14667b19a",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 76,
"avg_line_length": 25.413793103448278,
"alnum_prop": 0.5457937584803256,
"repo_name": "dbrattli/RxPY",
"id": "ab60adb47852acb5148ff8bb811655ded229d4bc",
"size": "2948"... |
from django.template import Template, Context, TemplateSyntaxError
from django.test import TestCase
from django.test.utils import override_settings
from ..serializers import <%= classifiedName %>Serializer
from .. import models
class Test<%= classifiedName %>Serializer(TestCase):
pass
| {
"content_hash": "8254d2535fb16b93e899f499af089f0d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 29.3,
"alnum_prop": 0.7952218430034129,
"repo_name": "thePortus/generator-djangular-gift",
"id": "da8134cb0433bf896abe3950f820401256a37030",
"size": ... |
from parser import Parser
import logging
import os
import sys
class Cleanup(Parser):
nodes = None
def __init__(self, logger=None):
Parser.__init__(self, logger)
def run_cleanup(self):
if self.nodes is None:
logging.debug("Node list is None")
sys.exit(-1)
... | {
"content_hash": "f9040ca2b6955f0a0c2a0efb93cf1638",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 68,
"avg_line_length": 28.526315789473685,
"alnum_prop": 0.550430504305043,
"repo_name": "Sriee/Mutex",
"id": "e6b7770b0958a5b6637a08c04fd168b8e20fc878",
"size": "1626",
... |
from collections import OrderedDict
import os
import re
from typing import (
Dict,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Type,
Union,
cast,
)
from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as... | {
"content_hash": "fb68acdabead0f9182fe12af1ee93747",
"timestamp": "",
"source": "github",
"line_count": 3651,
"max_line_length": 171,
"avg_line_length": 40.57628047110381,
"alnum_prop": 0.5878942110379091,
"repo_name": "googleapis/python-artifact-registry",
"id": "a1d200bdbd189eeb7526b1e02f5ee38ffe09... |
"""
Script to help deploy a Fluo or Accumulo cluster (optionally to AWS EC2)
"""
import os
import sys
from sys import exit
import shutil
from botocore.exceptions import ClientError
from config import DeployConfig, HOST_VAR_DEFAULTS, PLAY_VAR_DEFAULTS
from util import parse_args, AMI_HELP_MSG, get_block_device_map
from... | {
"content_hash": "4bcbd45d6f9cac5d0cd860e0b5035aed",
"timestamp": "",
"source": "github",
"line_count": 475,
"max_line_length": 119,
"avg_line_length": 45.614736842105266,
"alnum_prop": 0.5828218027414963,
"repo_name": "mikewalch/zetten",
"id": "a7824f5b417de98d00a7687644f2fce6f914a168",
"size": "2... |
from setuptools import setup, find_packages
setup(
name='richenum',
version='1.3.0',
description='Enum library for python.',
long_description=(
open('README.rst').read() + '\n\n' +
open('CHANGELOG.rst').read() + '\n\n' +
open('AUTHORS.rst').read()),
classifiers=[
'D... | {
"content_hash": "e7f0fdb12b88eadc54cb2c0d6d5fef70",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 36.13513513513514,
"alnum_prop": 0.5991024682124159,
"repo_name": "hearsaycorp/richenum",
"id": "aeafa4f0525964291443bb2f11b03ecb71870279",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name=... | {
"content_hash": "eca9597cdbf2a42a89ae3486a9ec7312",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 169,
"avg_line_length": 47.357142857142854,
"alnum_prop": 0.5779788838612367,
"repo_name": "bioinformatics-ua/django-userena",
"id": "b8606a1790119d4d77a576ef93549141ba83d758... |
from emigrer.settings.base import *
| {
"content_hash": "6524dff011c54a8ab2ca4303e94c912b",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 35,
"avg_line_length": 36,
"alnum_prop": 0.8055555555555556,
"repo_name": "henocdz/evernote-migrator",
"id": "3bd52878e5473e08d3097fa6d27f55ea77197917",
"size": "36",
"bin... |
"""
Harvester for the SHAREOK Repository Repository for the SHARE project
Example API call: https://shareok.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc
"""
from __future__ import unicode_literals
import logging
from lxml import etree
from scrapi.base import OAIHarvester
logger = logging.getLogger(__name_... | {
"content_hash": "26dd3241714f0f7de5dee66ab03e7b79",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 88,
"avg_line_length": 30.50769230769231,
"alnum_prop": 0.6116994452849218,
"repo_name": "ostwald/scrapi",
"id": "52daf47eea5620755057b301fe209a00c14919fb",
"size": "1983",... |
"""Provides some useful tools for working with Cyclopts, including reporting
output.
:author: Matthew Gidden <matthew.gidden _at_ gmail.com>
"""
from __future__ import print_function
import os
import io
import uuid
import shutil
import operator
import tables as t
import numpy as np
from functools import reduce
from c... | {
"content_hash": "6db49a236d8375211985dd4de5907fce",
"timestamp": "",
"source": "github",
"line_count": 695,
"max_line_length": 103,
"avg_line_length": 33.771223021582735,
"alnum_prop": 0.5668271483958928,
"repo_name": "gidden/cyclopts",
"id": "452fd6028b2ebc1e75591bee96890bd04964dc58",
"size": "23... |
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def __init__(self):
self.pre = None
def isValidBST(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
if root:... | {
"content_hash": "2b91e4d4f9dd549d5e9678ec0120e1f4",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 53,
"avg_line_length": 23.958333333333332,
"alnum_prop": 0.4956521739130435,
"repo_name": "Lanceolata/code-problems",
"id": "939c6591d495c72e238141a8f72ab7322730aa7e",
"siz... |
"""A class for managing IPython extensions."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from shutil import copyfile
import sys
from traitlets.config.configurable import Configurable
from IPython.utils.path import ensure_dir_exists
from traitlets i... | {
"content_hash": "a0f50a20f4bc54d4f4f25a814f5161c5",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 90,
"avg_line_length": 38.30232558139535,
"alnum_prop": 0.6258348512446873,
"repo_name": "Edu-Glez/Bank_sentiment_analysis",
"id": "87c671130b84e8751820e890adb0127b64b9cb95"... |
"""
talkoohakemisto
~~~~~~~~~~~~~~~
This module contains the Flask application core.
"""
import os
import warnings
import colander
from flask import Flask, jsonify, _request_ctx_stack
import itsdangerous
import jsonpatch
import jsonpointer
from sqlalchemy.exc import SAWarning
from sqlalchemy.orm.exc impor... | {
"content_hash": "f16c1681f4345124cce107562889b5fb",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 79,
"avg_line_length": 31.97452229299363,
"alnum_prop": 0.6107569721115538,
"repo_name": "talkoopaiva/talkoohakemisto-api",
"id": "18a0b35dd38efd13c24c7e33211ea315f86b80ef",... |
import weakref
from django.conf import settings as django_settings
from django.http import JsonResponse
from django.db import transaction
from rest_framework.decorators import api_view, throttle_classes
from rest_framework.response import Response
from rest_framework import generics
from rest_framework import status
fr... | {
"content_hash": "8135b6db11b2f9658338ca2d1e2cf12c",
"timestamp": "",
"source": "github",
"line_count": 859,
"max_line_length": 142,
"avg_line_length": 42.37019790454016,
"alnum_prop": 0.6433948785580833,
"repo_name": "mluo613/osf.io",
"id": "930d70c6047678843606247c387dca775477ebbf",
"size": "3639... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Test the filesystem related flows."""
import io
import os
import platform
from unittest import mock
from absl import app
from grr_response_core.lib import utils
from grr_response_core.lib.parsers import windows_registry_parser as winreg_parser
from grr_response_core... | {
"content_hash": "1a4694afa9168ff32490961f6b6723a7",
"timestamp": "",
"source": "github",
"line_count": 923,
"max_line_length": 82,
"avg_line_length": 36.683640303358615,
"alnum_prop": 0.6504031424436634,
"repo_name": "google/grr",
"id": "0c16383405d21f1f58baa743b01522ad06eef390",
"size": "33907",
... |
from sqlalchemy import *
from sqlalchemy import sql
from sqlalchemy.databases import sybase
from test.lib import *
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = sybase.dialect()
def test_extract(self):
t = sql.table('t', sql.column('col1'))
mapping = {
'... | {
"content_hash": "781a81f60462315ad8061184d7feb056",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 73,
"avg_line_length": 26.071428571428573,
"alnum_prop": 0.5465753424657535,
"repo_name": "ioram7/keystone-federado-pgid2013",
"id": "0a7cbf6b6dd72e61377b9ceea284491899332f7a... |
import numpy as np
from data.image import image
from spec.mamba import *
with description('image'):
with it('constructs without error'):
expect(calling(image.Image, np.zeros((3, 3)))).not_to(raise_error)
with it('tracks mutations'):
i = image.Image(np.zeros((3, 3), dtype=np.uint8))
i.invert()
exp... | {
"content_hash": "478b923d84e5c9568d59857828f636c9",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 76,
"avg_line_length": 32.92913385826772,
"alnum_prop": 0.5839311334289814,
"repo_name": "PhilHarnish/forge",
"id": "50dc51a7c9ba92966c3bafe864a744635a88fcf6",
"size": "41... |
from optparse import OptionParser
import sys
from urlparse import urlsplit
import mirrormeta
parser = OptionParser(usage='usage: %prog [options] sf.net URL [sf.net URL] [...]')
parser.add_option("-o", action="store", type="string", metavar="FILE",
dest="filename", help="output file (default: stdout)"... | {
"content_hash": "b8e1291e73aea0d2e153e792ce1fa189",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 83,
"avg_line_length": 31.225806451612904,
"alnum_prop": 0.6683884297520661,
"repo_name": "d0k/mirrormeta",
"id": "fa58d198752b1382aaf6a02c593e1550d1057d04",
"size": "1118"... |
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename('chart_display_units01.xlsx')
def test_c... | {
"content_hash": "3e83578aa188fed7c900fefe07376778",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 24.243243243243242,
"alnum_prop": 0.6243032329988851,
"repo_name": "jmcnamara/XlsxWriter",
"id": "cf0dc708fe4d07d371a1f2e241ab5256f026d2b2",
"size": ... |
import __builtin__
import system
import unittest
import riemann
import logging
from marathon import models
class TestingRiemannFunctions(unittest.TestCase):
def setUp(self):
logging.basicConfig()
__builtin__.__pillar__ = {}
__builtin__.__grains__ = {}
__builtin__.__salt__ = {'syst... | {
"content_hash": "154dcacc8ac79f9aecc66af6b82f7b2c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 120,
"avg_line_length": 43.84375,
"alnum_prop": 0.556664290805417,
"repo_name": "elyast/saltstack-formulas",
"id": "df8e38c10721e9fa5ea8f053f27d06ee448c7e25",
"size": "1403... |
from __future__ import absolute_import, unicode_literals, division
import re
def dasherize(value):
"""Dasherizes the passed value."""
value = value.strip()
value = re.sub(r'([A-Z])', r'-\1', value)
value = re.sub(r'[-_\s]+', r'-', value)
value = re.sub(r'^-', r'', value)
value = value.lower()
... | {
"content_hash": "4d81e7863e24991c9dc2cdc322ec49d4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 28.083333333333332,
"alnum_prop": 0.5875370919881305,
"repo_name": "armet/python-armet",
"id": "a46a9d0b081a89a1bcdacc3f9f77373589bb5dd4",
"size": "3... |
"""
Django settings for deploy project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... | {
"content_hash": "2b41565341178f1288c95ea9c8c25491",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 83,
"avg_line_length": 25.559322033898304,
"alnum_prop": 0.6813660477453581,
"repo_name": "dntdevops/cloudops",
"id": "78f312ce510b40652bc7aff068334492a5f52b8c",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opendebates', '0021_submission_local_votes'),
]
operations = [
migrations.AddField(
model_name='sitemode',
name='announcemen... | {
"content_hash": "117690c8d837afc902b5fac88792d4bd",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 74,
"avg_line_length": 27.428571428571427,
"alnum_prop": 0.5807291666666666,
"repo_name": "ejucovy/django-opendebates",
"id": "977c17a3025a215065eac5d26a2a823c541a2395",
"s... |
entityName = ''
offset = 0
cur_batch = sdc.createBatch()
hasNext = True
while hasNext:
offset = offset + 1
record = sdc.createRecord('record souce id')
record.value = "record value"
cur_batch.addError(record, "error msg")
# if the batch is full, process it and start a new one
if cur_batch.err... | {
"content_hash": "328eff18329c424f7bf5fb749848d5c6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 30.041666666666668,
"alnum_prop": 0.6490984743411928,
"repo_name": "streamsets/datacollector",
"id": "95252effd82e38d1415b622367be151c2de4693d",
"siz... |
import sys
import os
from os import path
import re
from itertools import imap, repeat, chain
import globals
import process
import parboilfile as pbf
from futures import Future
from error import ErrorType
class Benchmark(object):
"""A benchmark.
If the benchmark is malformed or otherwise invalid, only the 'n... | {
"content_hash": "3f1ba290335469afa404b6b717fc650d",
"timestamp": "",
"source": "github",
"line_count": 528,
"max_line_length": 154,
"avg_line_length": 36.640151515151516,
"alnum_prop": 0.6058616768324201,
"repo_name": "zhangfengthu/CoRunBench",
"id": "2436deca9757fbabee0302e7c6d36f353ef7f449",
"si... |
import logging
import urlparse
import click
import termcolor
import mutagen.id3
import mutagen.mp3
import requests
import soundcloud
client = soundcloud.Client(client_id='<Your CLIENT_ID here>')
log = logging.getLogger('SoundDrizzle')
def _bold(text):
return termcolor.colored(text, attrs=['bold'])
@click.comma... | {
"content_hash": "bed43f4e7c4c5f6f0dd1cddcda3c9122",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 111,
"avg_line_length": 31.97938144329897,
"alnum_prop": 0.6470019342359767,
"repo_name": "wonderb0lt/sounddrizzle",
"id": "2429f2f18a9e007e69274928acace3919efdad3c",
"size... |
"""Utilities used in the Kadenze Academy Course on Deep Learning w/ Tensorflow.
Creative Applications of Deep Learning w/ Tensorflow.
Kadenze, Inc.
Parag K. Mital
Copyright Parag K. Mital, June 2016.
"""
import matplotlib.pyplot as plt
import tensorflow as tf
import urllib
import numpy as np
import zipfile
import os
... | {
"content_hash": "814f446bb937935399cb1042dcf69662",
"timestamp": "",
"source": "github",
"line_count": 782,
"max_line_length": 83,
"avg_line_length": 26.888746803069054,
"alnum_prop": 0.5469634279735578,
"repo_name": "niazangels/CADL",
"id": "f6efedd2a426da7b409bf88327231b6192e0d8c4",
"size": "210... |
import time
import gc
import sys
import mxnet as mx
from mxnet.gluon import nn
from mxnet.contrib import quantization
#shape, num_hidden:
sizes = [
(( 1, 224), 512),
(( 1, 224), 4096),
(( 16, 1024), 1024),
(( 32, 4096), 1024),
(( 32, 4096), 4096),
((512, 512), 4096)]
rounds = 1000
warmup... | {
"content_hash": "ab7a0dd55870ea0542d499cbce82b656",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 99,
"avg_line_length": 38.608695652173914,
"alnum_prop": 0.5701415701415702,
"repo_name": "DickJC123/mxnet",
"id": "6cf2f929ecedd9b9f4f0a6fe3ed5d989542e3ea4",
"size": "700... |
"""Functional tests for common/users.py."""
__author__ = [
'johncox@google.com (John Cox)',
]
import logging
import webapp2
from common import users
from tests.functional import actions
from google.appengine.api import users as gae_users
class TestHandler(webapp2.RequestHandler):
def get(self):
... | {
"content_hash": "d5f459efeabe662932bd744b9666203e",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 79,
"avg_line_length": 34.675392670157066,
"alnum_prop": 0.6717499622527555,
"repo_name": "wijnandb/CodeCult-Scratch",
"id": "a2f5de029543e9f6aa6fbff5c7df79e1d74c929f",
"s... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/corellia/shared_corl_imprv_wall_4x16_s01.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "ed9f2139d0567717c48363860db3db47",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 89,
"avg_line_length": 24.46153846153846,
"alnum_prop": 0.6981132075471698,
"repo_name": "anhstudios/swganh",
"id": "b5f325df9132e8457168299584077e450ba82f06",
"size": "463... |
import random as rd
import rospy
from std_msgs.msg import *
if __name__ == '__main__':
rospy.init_node('std_msgs')
pub_bool = rospy.Publisher('Bool', Bool, queue_size=10)
pub_colorrgba = rospy.Publisher('ColorRGBA', ColorRGBA, queue_size=10)
pub_duration = rospy.Publisher('Duration', Duration, queue_size=10)... | {
"content_hash": "7ecaa5800bd91d74d32700cd99b916de",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 44.625,
"alnum_prop": 0.6834733893557423,
"repo_name": "gaug-cns/ros-control-center",
"id": "aa09b4495b6ea9e4c6d8dd272ccc8f1174b31922",
"size": "1804... |
"This module provides various low-level inter-Actor transport implementations."
from datetime import timedelta
from thespian.system.timing import ExpirationTimer
from thespian.system.utilis import thesplog
import logging
DEFAULT_MAX_TRANSMIT_PERIOD = timedelta(minutes=5)
TRANSMIT_RETRY_PERIOD = timedelta(secon... | {
"content_hash": "a0a5e8337e83fe85fa36a49296a47c62",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 105,
"avg_line_length": 40.235772357723576,
"alnum_prop": 0.6263218158550549,
"repo_name": "godaddy/Thespian",
"id": "8e8a6d4b03265a591da9fa9c0a7d737af9579b19",
"size": "1... |
import logging
import pkgutil
from functools import lru_cache
from socket import AF_INET, AF_INET6
from typing import Any, Dict, Iterator, Optional, Tuple, Type
# noinspection PyPackageRequirements
import urllib3.util.connection as urllib3_util_connection
# noinspection PyPackageRequirements
import urllib3.util.ssl_ a... | {
"content_hash": "02b869fc8055d7a64d3f7fb17b1437fd",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 128,
"avg_line_length": 39.51975051975052,
"alnum_prop": 0.5473196906728391,
"repo_name": "bastimeyer/streamlink",
"id": "c4f6235f585451205fbda10b19538d389745fc71",
"size"... |
from setuptools import setup
if __name__ == "__main__":
setup()
| {
"content_hash": "04e38f3fac518a6424a2a6a5f7e8d218",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 28,
"avg_line_length": 17.25,
"alnum_prop": 0.5797101449275363,
"repo_name": "PyO3/setuptools-rust",
"id": "25536050b29963bbfbb07ad400439bb16afbb82a",
"size": "92",
"binar... |
import requests
from bs4 import BeautifulSoup
from json import loads
import re
from ..config import config
def seek(chk_key, epi, params):
tepi = epi
chk_key = str(chk_key)
try:
int(chk_key)
except ValueError:
query_url = ("http://search.bilibili.com/bangumi"
"?ke... | {
"content_hash": "ae8133796df175de6aafdfaacf790b1d",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 95,
"avg_line_length": 29.516129032258064,
"alnum_prop": 0.533879781420765,
"repo_name": "chienius/anicolle",
"id": "a67539c5a5f74efcce4ac165bfd7584afaf945e0",
"size": "186... |
from torch._six import container_abcs
from itertools import repeat
def _ntuple(n):
def parse(x):
if isinstance(x, container_abcs.Iterable):
return x
return tuple(repeat(x, n))
return parse
_single = _ntuple(1)
_pair = _ntuple(2)
_triple = _ntuple(3)
_quadruple = _ntuple(4)
def _... | {
"content_hash": "a361c9526c57922a9d8db3ea3ae21678",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 91,
"avg_line_length": 27.82608695652174,
"alnum_prop": 0.640625,
"repo_name": "ryfeus/lambda-packs",
"id": "2b8ebd642b000a6d05606db16f3e921d16b51338",
"size": "640",
"bi... |
import pytest
import numpy as np
from datetime import timedelta
import pandas as pd
import pandas.util.testing as tm
from pandas import (timedelta_range, date_range, Series, Timedelta,
DatetimeIndex, TimedeltaIndex, Index, DataFrame,
Int64Index, _np_version_under1p8)
from panda... | {
"content_hash": "8fe789763ff62b18de2fa598488114f6",
"timestamp": "",
"source": "github",
"line_count": 599,
"max_line_length": 79,
"avg_line_length": 37.010016694490815,
"alnum_prop": 0.5344850917948487,
"repo_name": "linebp/pandas",
"id": "79fe0a864f24689b2da019af05f0a170025b10cf",
"size": "22169... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.