text stringlengths 4 1.02M | meta dict |
|---|---|
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("orgs", "0017_auto_20161026_1513")]
operations = [
migrations.AlterField(
model_name="invitation",
name="created_on",
field=models.DateTim... | {
"content_hash": "804cbd5023762b09ef530d9f92ae1acf",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 66,
"avg_line_length": 31.9,
"alnum_prop": 0.5015673981191222,
"repo_name": "rapidpro/dash",
"id": "a6564fd4252696065a38694edacf2a76406af79f",
"size": "2308",
"binary": f... |
from collections import OrderedDict
import lasagne.init as LI
import lasagne.layers as L
import lasagne.nonlinearities as LN
import lasagne.nonlinearities as nl
import numpy as np
import theano
from visual_dynamics.predictors import layers_theano as LT
class VggConvNetwork(object):
def __init__(self, input_shap... | {
"content_hash": "cc52a6006e57d995385dbde02ce51a97",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 109,
"avg_line_length": 47.20283018867924,
"alnum_prop": 0.4701708803837314,
"repo_name": "alexlee-gk/visual_dynamics",
"id": "8ee1b20da60fac5f8d1b28677586fd28b2f38bc3",
"... |
import logging
import os
import time
from parsl.channels import LocalChannel
from parsl.providers.cluster_provider import ClusterProvider
from parsl.providers.grid_engine.template import template_string
from parsl.launchers import SingleNodeLauncher
from parsl.providers.provider_base import JobState, JobStatus
from pa... | {
"content_hash": "4d371834d46fc26ea35599fda4e2dd10",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 104,
"avg_line_length": 37.19827586206897,
"alnum_prop": 0.5855156431054461,
"repo_name": "Parsl/parsl",
"id": "65547c92ccdf4aff3ca94a9def1797b1398ad23f",
"size": "8630",
... |
import pymysql
import os
from time import sleep
from getpass import getpass
from queue import Queue
q = Queue()
pl = []
def create_playlist():
passwd = getpass()
with pymysql.connect(user='root', db='music', passwd=passwd) as cur:
cur.execute('SELECT LINK FROM LANWE')
result = cur.fetchall()... | {
"content_hash": "133405d0d249b420ec0d32ea00ae5703",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 20.424242424242426,
"alnum_prop": 0.5845697329376854,
"repo_name": "MrLanwe/Laplayer",
"id": "d46a656e5929a828af90feb7a6550ccf6e1260f5",
"size": "674... |
import os
class Workspace():
def __init__(self, directory):
self.directory = directory
self.config_file = None
if directory is not None:
self.config_file = directory + "/project.bluep"
def check_workspace(self):
"""Check if workspace dir and workspace config exist
... | {
"content_hash": "fa048350f102c16b59c883578511c112",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 70,
"avg_line_length": 33.371428571428574,
"alnum_prop": 0.5351027397260274,
"repo_name": "X-Scapin/BlueP",
"id": "45e60239b202649d13083f4cb95ebd73425f5805",
"size": "1168"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('cities_light', '0006_compensate_for_0003_bytestring_bug'),
]
operations = [
migrations.CreateMo... | {
"content_hash": "b1c8fad553950c93531a0cf7e6601e52",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 119,
"avg_line_length": 39.41379310344828,
"alnum_prop": 0.5520559930008749,
"repo_name": "moas/carbooking",
"id": "a4f8b0d2b042696289e400747f1ad8debf058151",
"size": "2358... |
"""
[+] problem description
========================
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
... | {
"content_hash": "0fc3f771a37954d110b8b9d76beb1227",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 107,
"avg_line_length": 25.90909090909091,
"alnum_prop": 0.5740350877192982,
"repo_name": "greyshell/Guff",
"id": "54b696e3fcf82924e6fcf93e7e73ce4563644400",
"size": "1465"... |
"""
Prints a comparison between different serializers.
Compares results based on size of the output, and time taken to (de)serialize.
"""
from __future__ import print_function
from timeit import default_timer as perf_timer
import sys
import datetime
import decimal
import uuid
import Pyro4.util
import Pyro4.errors
impo... | {
"content_hash": "2837893778d075e868b67fff3b73f582",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 127,
"avg_line_length": 41.62992125984252,
"alnum_prop": 0.582750141857386,
"repo_name": "irmen/Pyro4",
"id": "9c6d5ac7153defb5043a23c91d98c4f8f301e020",
"size": "5287",
... |
from __future__ import annotations
from collections import defaultdict
from pants.engine.addresses import Address
class PackageRootedDependencyMap:
"""A utility class for mapping Java FQTs and packages to owning source Addresses.
This class treats Java packages as logically opaque strings, ignoring the
... | {
"content_hash": "cef44827dc699ff03050cd6803e69980",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 94,
"avg_line_length": 44.05714285714286,
"alnum_prop": 0.6277561608300908,
"repo_name": "patricklaw/pants",
"id": "4e1f8e9a8780b639f56f8cae9b5b6f4614485b90",
"size": "475... |
import json
from io import BytesIO
from rest_framework.parsers import JSONParser
from django.conf import settings
from django.test import Client
from equipment.models import Equipment, EquipmentItem
from equipment.serializers import EquipmentItemSerializer, EquipmentSerializer
from emstrack.tests.util import date2is... | {
"content_hash": "4c7060b4520821376d4bd22c3dbecc85",
"timestamp": "",
"source": "github",
"line_count": 536,
"max_line_length": 134,
"avg_line_length": 46.076492537313435,
"alnum_prop": 0.5918937522776045,
"repo_name": "EMSTrack/WebServerAndClient",
"id": "5da5063f4f967a2e09b74fcf7973d42af9c84c6c",
... |
"""Provide methods to bootstrap a Home Assistant instance."""
import asyncio
import contextlib
from datetime import datetime
import logging
import logging.handlers
import os
import sys
import threading
from time import monotonic
from typing import TYPE_CHECKING, Any, Dict, Optional, Set
import voluptuous as vol
import... | {
"content_hash": "6f20dcc6a84d62b8094695c0cae2ebbf",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 95,
"avg_line_length": 33.19384057971015,
"alnum_prop": 0.6298095290072586,
"repo_name": "partofthething/home-assistant",
"id": "6d334ac8953d391cae334037585d6d36fa178623",
... |
class TestSetupOneArgumentPlugin:
def __init__(self, cardinal):
self.cardinal = cardinal
def setup(cardinal):
return TestSetupOneArgumentPlugin(cardinal)
| {
"content_hash": "1dc2196ec8e0092fb1de70a336832a25",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.7325581395348837,
"repo_name": "JohnMaguire/Cardinal",
"id": "62ee28e75fcbea298dabad802ae15ae4430c704f",
"size": "... |
"""
Coursera's wrapper for data exports API.
"""
import requests
from courseraoauth2client import oauth2
from courseraresearchexports.models.utils import requests_response_to_model
from courseraresearchexports.constants.api_constants import \
RESEARCH_EXPORTS_APP, RESEARCH_EXPORTS_API, CLICKSTREAM_API
from courser... | {
"content_hash": "98c67ec185a5f63711a8df779d29aeb2",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 78,
"avg_line_length": 33.513513513513516,
"alnum_prop": 0.7294354838709678,
"repo_name": "coursera/courseraresearchexports",
"id": "a3d60bf63c3cb3c02b83c6e3059deda0513fce2d"... |
class InterpolationError(Exception):
pass
def interpolate_using_previous(pointlist):
'''
Throw
InterpolationError
if a key has no non-null values
Return
pointlist without gaps
'''
pl = pointlist # alias
npl = [] # new, interpolated pointlist
if len(pl) < 1:... | {
"content_hash": "846f34d531c8e8be71eceb8f1f9578e6",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 100,
"avg_line_length": 26.046511627906977,
"alnum_prop": 0.5598214285714286,
"repo_name": "infant-cognition-tampere/saccademodel-py",
"id": "330f91e8367a69d8360947433d4c6c14... |
import numpy as np
import math
from vraag import *
import bpy
# Nozzle diameter. The "fudge factor" tricks Cura into actually slicing the lines
d = 0.4
# Number of grid/column layers, the actual number of layers is double this number
layers = 5
# String width
xs, ys = 1*d,1*d # strings
# Gap width
xh, yh = 1.5, 1.5
... | {
"content_hash": "2fe19e0c176ee1a973bbb0230b666a1c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 81,
"avg_line_length": 24.72972972972973,
"alnum_prop": 0.6622950819672131,
"repo_name": "akloster/blender-vraag",
"id": "18ebacb8c26dea43ddd793bd678657a8dc17c7f9",
"size":... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'', include('restapp.urls')),
)
| {
"content_hash": "e6d78e838ac50043983499dc9bcaacb0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 23,
"alnum_prop": 0.6763285024154589,
"repo_name": "rodrigorn/rest_demo",
"id": "985c458252db9f729d0772d172a399f35cf8fdf2",
"size": "207",
"binary":... |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import epysteme
import epysteme.exploration as epex
import epysteme.helpers as helpers | {
"content_hash": "c2403b658c91493d5fc51eb4edaf0f49",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 41,
"avg_line_length": 21.428571428571427,
"alnum_prop": 0.7933333333333333,
"repo_name": "sjpet/epysteme",
"id": "2898fb60f5e09aa2d96ae311094cc6f277c32c4b",
"size": "150",
... |
import random
import asyncio
from logging import getLogger
from rpcudp.protocol import RPCProtocol
from kademlia.node import Node
from kademlia.routing import RoutingTable
from kademlia.utils import digest
class KademliaProtocol(RPCProtocol):
def __init__(self, sourceNode, storage, ksize):
RPCProtocol._... | {
"content_hash": "3ca65ed19626128a7d0a250dd74e4c28",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 104,
"avg_line_length": 39.403361344537814,
"alnum_prop": 0.6427809767541054,
"repo_name": "faisalburhanudin/kademlia",
"id": "c7fa9d3207b2d5d539158a79bf7028b25f6eee95",
"... |
import unittest
class TestMaxVersionsGCRule(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.bigtable.column_family import MaxVersionsGCRule
return MaxVersionsGCRule
def _make_one(self, *args, **kwargs):
return self._get_target_class()(*args, **kwargs... | {
"content_hash": "33a5548a7e9e98d84f89d2f67619f796",
"timestamp": "",
"source": "github",
"line_count": 617,
"max_line_length": 74,
"avg_line_length": 33.416531604538086,
"alnum_prop": 0.6103889805024736,
"repo_name": "daspecster/google-cloud-python",
"id": "126a18da3003f5eb43f603bdc3ccac77bc64e11d",... |
""":mod:`gitconfig_parser.parser` -- Parser implementation
"""
from pyparsing import (
OneOrMore, restOfLine, Group, ZeroOrMore,
CharsNotIn, Suppress, Word, alphanums, Literal, pythonStyleComment)
def build_parser():
key = Word(alphanums).setResultsName('key')
value = restOfLine.setParseAction(
... | {
"content_hash": "4c64a218d55cdeed854b1edfbf8ca35a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 73,
"avg_line_length": 36.61538461538461,
"alnum_prop": 0.6838235294117647,
"repo_name": "seanfisk/gitconfig-parser",
"id": "d40cd5794c364cbfbd47cd7ffe66063081da15e8",
"siz... |
"""
Tests for states.py.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['option_lists'] = [
["""\
Short options:
-a option -a
-b file option -b
-c name option -c
""",
"""\
<document source... | {
"content_hash": "43ed322ae845df2ee39cc8eb097ba8a9",
"timestamp": "",
"source": "github",
"line_count": 748,
"max_line_length": 61,
"avg_line_length": 26.0427807486631,
"alnum_prop": 0.39835728952772076,
"repo_name": "spreeker/democracygame",
"id": "15115bf7ba3b7a4a6ae27b63042a26f0f20cd15f",
"size"... |
import yaml
import os
import logging
import sys
__author__ = 'johlyh'
primary_config = 'libsolace.yaml',
try:
primary_config = os.environ['LIBSOLACE_CONFIG']
except Exception, e:
pass
__yamlfiles__ = [
"%s" % primary_config,
'/etc/libsolace/libsolace.yaml',
'/opt/libsolace/libsolace.yaml'
]
__do... | {
"content_hash": "93a4d3da9e2d799cf50eb489019340a5",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 104,
"avg_line_length": 26.397849462365592,
"alnum_prop": 0.6419551934826884,
"repo_name": "unixunion/python-libsolace",
"id": "97c81f4ee239002ce559196e72a841885c58ad99",
"... |
"""Examine success/fail history for Chrome/ium OS builds.
Used to check in a LKGM version for Chrome OS for other consumers.
"""
from __future__ import print_function
import distutils.version
import os
from chromite.cbuildbot import archive_lib
from chromite.cbuildbot import cbuildbot_config
from chromite.cbuildbot... | {
"content_hash": "0875c2bce0bea7de43b50e1b1baf3dc8",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 80,
"avg_line_length": 36.94063926940639,
"alnum_prop": 0.6517923362175525,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "ab53d2cd0566cb9f3ff9c1e0eaca7302bb9744ec... |
import serial
from codinghyde.ant.exceptions import DriverException
class Driver(object):
def __init__(self, device, debug=False):
self.device = device
self.debug = debug
self.is_open = False
def isOpen(self):
return self.is_open
def open(self):
if self.isOpen():
... | {
"content_hash": "b2c55292fcaf755102e8f9844389032e",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 79,
"avg_line_length": 25.836363636363636,
"alnum_prop": 0.555594651653765,
"repo_name": "mvillalba/codinghyde.ant",
"id": "07ea185fe6db34ceb08c72a5dd647e6f4a696880",
"siz... |
from flask import Flask, render_template, request
import db
from bson import ObjectId
app = Flask(__name__)
def v(k, default=None):
return request.values.get(k, default)
@app.route("/", methods=['POST', 'GET'])
def index():
result = ''
if request.method == 'POST':
mongodb = 'mongodb://%s:%s/%s'%(v('server', "loc... | {
"content_hash": "a468c7f6723a10d0da66c229ce5361be",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 88,
"avg_line_length": 35.38461538461539,
"alnum_prop": 0.5413043478260869,
"repo_name": "Bloodevil/easy_mongo",
"id": "b202688003a2d15969c9553d10582254ba554356",
"size": "... |
a = 4
def print_func():
a = 17
print "in print_func a = ", a
print_func()
print "a = ", a,"which is global variable assigned prior to the function print_func"
| {
"content_hash": "4674a107e04864a801fdb4ece7e31633",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 84,
"avg_line_length": 21.375,
"alnum_prop": 0.6257309941520468,
"repo_name": "janusnic/py-21v",
"id": "602b85dae4a0148efb83cb2571101ee1b644e6d7",
"size": "171",
"binary":... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "5cd627d48c5b465aa1c6f94f18eca25b",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 75,
"avg_line_length": 28.229607250755286,
"alnum_prop": 0.5688142123287672,
"repo_name": "lathama/Adynaton",
"id": "0f0e331ae89a7d3f546c4208fbe1142856cc406a",
"size": "93... |
from zechat.app import create_app, create_manager
app = create_app()
manager = create_manager(app)
manager.run()
| {
"content_hash": "f438510e92110af6e32cfd0e7f0b2307",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 49,
"avg_line_length": 22.8,
"alnum_prop": 0.7543859649122807,
"repo_name": "mgax/zechat",
"id": "36e635ab35242302adc7c24a69660183a617325e",
"size": "137",
"binary": false... |
from Plex import *
letter = Range("AZaz")
digit = Range("09")
name = letter + Rep(letter | digit)
number = Rep1(digit)
space = Any(" \t\n")
class MyScanner(Scanner):
def begin_comment(self, text):
if self.nesting_level == 0:
self.begin('comment')
self.nesting_level = self.nesting_level + 1
def end... | {
"content_hash": "3f8b96caaba5aa768b26e0a83676eaa2",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 52,
"avg_line_length": 21.804347826086957,
"alnum_prop": 0.5712861415752741,
"repo_name": "probcomp/bayeslite",
"id": "1cb158b4edd97908b00e0529e3d3ab9ff34a59e6",
"size": "1... |
"""Test case-sensitivity (PEP 235)."""
import sys
from test.test_importlib import util
importlib = util.import_importlib('importlib')
machinery = util.import_importlib('importlib.machinery')
import os
from test.support import os_helper
import unittest
import warnings
@util.case_insensitive_tests
class CaseSensitiv... | {
"content_hash": "b0e673ad7fbc0411b3a5309c841772fc",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 85,
"avg_line_length": 38.41304347826087,
"alnum_prop": 0.6624221844934918,
"repo_name": "brython-dev/brython",
"id": "9d472707abe840e72301988a460163aa2838c49b",
"size": "3... |
import copy
from itertools import chain as iter_chain
from itertools import combinations as iter_combinations
import eventlet
import mock
import netaddr
from neutron_lib import constants as lib_constants
from neutron_lib import exceptions as exc
from oslo_config import cfg
from oslo_log import log
import oslo_messagin... | {
"content_hash": "9dc1fcd0bf7b01e18c35f7debeee5f38",
"timestamp": "",
"source": "github",
"line_count": 2844,
"max_line_length": 79,
"avg_line_length": 46.13045007032349,
"alnum_prop": 0.5627577270475247,
"repo_name": "sebrandon1/neutron",
"id": "e0ba242648b6440ed50278ac2435d6d80fbffa29",
"size": "... |
import unittest
import json
from math import sqrt
import msgpackrpc
from jubatus.recommender.client import Recommender
from jubatus.recommender.types import *
from jubatus_test.test_util import TestUtil
from jubatus.common import Datum
host = "127.0.0.1"
port = 21003
timeout = 10
class RecommenderTest(unittest.Test... | {
"content_hash": "baa8ae6e03bc7ab4fd4c3a9ede2e8b22",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 113,
"avg_line_length": 35.94392523364486,
"alnum_prop": 0.5834633385335414,
"repo_name": "jubatus/jubatus-python-client",
"id": "afe0cc99b3a55086e035e7907848a984819b0a41",
... |
from paddle.trainer.PyDataProvider2 import *
# Define a py data provider
@provider(input_types={
'pixel': dense_vector(28 * 28),
'label': integer_value(10)
})
def process(settings, filename): # settings is not used currently.
imgf = filename + "-images-idx3-ubyte"
labelf = filename + "-labels-idx1-ub... | {
"content_hash": "ef2bb40f128d420149a20dccac4d661a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 67,
"avg_line_length": 24.0625,
"alnum_prop": 0.574025974025974,
"repo_name": "zuowang/Paddle",
"id": "32af29730a7365df1a98fe54a2edf8850ee93e8d",
"size": "770",
"binary":... |
import pytest
@pytest.mark.slow
def test_transactions(mambuapi):
loans = mambuapi.get_loan(None)
if len(loans) > 0:
assert mambuapi.get_transactions(loans[0]['id']) is not None
@pytest.mark.slow
def test_create_transaction(mambuapi, unapproved_loan):
result = mambuapi.approve(unapproved_loan['id... | {
"content_hash": "b9e1d1f7417a5e0fde1d64db3beb87b0",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 77,
"avg_line_length": 36.55421686746988,
"alnum_prop": 0.6733684904416611,
"repo_name": "paze-me/mambu",
"id": "83b4bb0da8ae6195504f91b59a32c55dc8fbb7a3",
"size": "3034",
... |
"""
coop_edition template tags
used for magic form
"""
from six import string_types
from django import template
from django.forms.formsets import BaseFormSet
from django.template import Context
from django.template.base import TextNode, VariableNode, FilterExpression
from django.template.context_processors import csr... | {
"content_hash": "d65aa405fc609965404a8d69f9cfc288",
"timestamp": "",
"source": "github",
"line_count": 588,
"max_line_length": 116,
"avg_line_length": 35.81802721088435,
"alnum_prop": 0.5831631926309292,
"repo_name": "ljean/coop_cms",
"id": "f21fb1dabe40ce76872752a512f40d50c3c92a4b",
"size": "2108... |
"""
Tests for projectq.backends._printer.py.
"""
import io
import pytest
from projectq import MainEngine
from projectq.backends import _printer
from projectq.cengines import DummyEngine, InstructionFilter, NotYetMeasuredError
from projectq.meta import LogicalQubitIDTag
from projectq.ops import NOT, Allocate, Command... | {
"content_hash": "5a5caf34219a40c352b4ae11e057dba2",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 95,
"avg_line_length": 30.717391304347824,
"alnum_prop": 0.6854210898796886,
"repo_name": "ProjectQ-Framework/ProjectQ",
"id": "658fb78c74724261c47c99b26ac54fd753b59c50",
"... |
def test_1(input_list):
new_list = []
for i in range(len(input_list)):
new_list[i] = input_list[i]
print("list is {}, new_list is {}".format(input_list, new_list))
return new_list
test_1([1, 2, 3, 4])
# situation 2: allocate enough space for the new_list, which is not significant or meani... | {
"content_hash": "6ffdc97b2a08aa90d65e4e610c1e4453",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 94,
"avg_line_length": 34.241379310344826,
"alnum_prop": 0.6163141993957704,
"repo_name": "rush2catch/algorithms-leetcode",
"id": "e30e5a4d7c9fe5b81cf38f1fe9395a2f0d7bce59",
... |
"""
This should probably be renamed guifront.py This defines all of the visual
components to the GUI It is invoked from guiback, which handles the nonvisual
logic.
BUGS:
* Copying the ungrouped imageset raises an error. Should have the option
to copy or move it. Other special imageset should not have this opt... | {
"content_hash": "7cde0340dfdc8d00dc2bc16cbb594099",
"timestamp": "",
"source": "github",
"line_count": 1681,
"max_line_length": 133,
"avg_line_length": 44.10113027959548,
"alnum_prop": 0.5489114306526021,
"repo_name": "SU-ECE-17-7/ibeis",
"id": "8479b498d5e35128eca93b2754d3d0ddc4ffe55e",
"size": "... |
"""
Define UVParameters: data and metadata objects for interferometric data sets.
UVParameters are objects to hold specific data and metadata associated with
interferometric data sets. They are used as attributes for classes based on
UVBase. This module also includes specialized sublasses for particular types
of metad... | {
"content_hash": "dee3728f9533c2716fff8b9a13c0af5e",
"timestamp": "",
"source": "github",
"line_count": 584,
"max_line_length": 88,
"avg_line_length": 40.26883561643836,
"alnum_prop": 0.476506357103372,
"repo_name": "HERA-Team/pyuvdata",
"id": "294b2940a3754b3e481b5a28028936c1f39a6f34",
"size": "23... |
import os
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from pyxform.builder import create_survey_from_xls
from onadata.apps.logger.models.xform import XForm
from onadata.libs.utils.logger_tools import publish_xls_form
from onadata.libs.utils.viewer_tool... | {
"content_hash": "5e43d973bf0915c681f6d7a470c51ef9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 37.82666666666667,
"alnum_prop": 0.5826577370461755,
"repo_name": "kobotoolbox/kobocat",
"id": "890691b7247979dc0e9af46c18944fa3ccf19de2",
"size": "2... |
"""
This module allows replacing stdlib's logging module with twiggy,
it implements the following interface:
logging's interface:
:getLogger: returns a logger that supports debug/info/error etc'.
:root: the root logger.
:basicConfig: raises an Exception.
hijack interface:
:hijack: for 'import loggin... | {
"content_hash": "3e540b5039b6afaceccd9ec08b60f3a2",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 93,
"avg_line_length": 29.138121546961326,
"alnum_prop": 0.6259006446719757,
"repo_name": "wearpants/twiggy",
"id": "b3d5e86c443091e16521d1d006ed7738ec25e46b",
"size": "52... |
import unittest
from is_increasing import is_increasing
class Test_IS_Increasing(unittest.TestCase):
def test_inc(self):
self.assertTrue(is_increasing([3, 5, 8, 9, 22]))
if __name__ == "__main__":
unittest.main()
| {
"content_hash": "cdd8a34b056a7088438040c285f2b659",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 19.5,
"alnum_prop": 0.6538461538461539,
"repo_name": "sevgo/Programming101",
"id": "70c1f44bd991a07be3683080c94697e127e48dac",
"size": "258",
"bina... |
from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.utils import translation
from django.utils.encoding import smart_text
from fluent_pages.models.db import UrlNode
from icekit.publishing.models import \
sync_mptt_tree_fields_from_draft_to_published
class Command(... | {
"content_hash": "c3fca769a972de2a10e5fd4124ec4ee2",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 79,
"avg_line_length": 37.90625,
"alnum_prop": 0.5935696619950536,
"repo_name": "ic-labs/django-icekit",
"id": "17bb54738b298d313a5bdf42b0623634f582e270",
"size": "2426",
... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext
from django.contrib import messages
from django.contrib.adm... | {
"content_hash": "29d7e48e5239241bd97c36414f5062e5",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 92,
"avg_line_length": 32.15217391304348,
"alnum_prop": 0.5927428442641425,
"repo_name": "zhiwehu/IBookmark",
"id": "dd3fe2172d35ca2a3b5a1c9eb3448d3ea427dac1",
"size": "44... |
"""
WSGI config for djcms_sbadmin2 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | {
"content_hash": "85062f9d5b62151d20a76f0a7bd6b40b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.3125,
"alnum_prop": 0.7728395061728395,
"repo_name": "guhuajun/djcms-sbadmin2",
"id": "de1ef8bcf98e22a1ee4ff30c89d0c38925414f88",
"size": "405",
... |
from django.contrib import admin
from main.models import File,Share,Setting,Peer
# Register your models here.
admin.site.register(File)
admin.site.register(Share)
admin.site.register(Setting)
admin.site.register(Peer)
| {
"content_hash": "b2cc63727406f542f3fc33e6c1b75d8b",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 24.444444444444443,
"alnum_prop": 0.8090909090909091,
"repo_name": "TheTacoScott/tacozmq2",
"id": "9e0a0c888bbe79b1419f4d85d54efa11a034a392",
"size": ... |
import struct
import json
import socket
from .. import const
from ..Remote import Remote
from ..Node import Node
class TCPRPC(object):
def __init__(self, service, loop):
self.service = service
self.loop = loop
def pack_ping(self, local, remote, echo):
"""Pack Ping Message
Ar... | {
"content_hash": "0cd861f047984bef53646c11d2eefdae",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 77,
"avg_line_length": 29.340236686390533,
"alnum_prop": 0.5403851971362307,
"repo_name": "SkyZH/ddcm-protocol",
"id": "7047bb14535210c97d1d029f6fd92b25e359aa5f",
"size": ... |
'''
Created on Jan 17, 2014
@author: oliwa
'''
import sys as sys
import numpy as np
from prody.dynamics.anm import calcANM, ANM
from prody.dynamics.editing import extendModel, sliceModel
from prody.dynamics.functions import saveModel, loadModel, writeArray
from prody.proteins.pdbfile import writePDB, parsePDB
from pro... | {
"content_hash": "40a75da62c6aac523955957538523e11",
"timestamp": "",
"source": "github",
"line_count": 2169,
"max_line_length": 470,
"avg_line_length": 60.751498386353155,
"alnum_prop": 0.7214919936252562,
"repo_name": "Shen-Lab/cNMA",
"id": "e8f41406cd05cfd60f730812638a362bc9a38230",
"size": "131... |
"""Tests for tfx.orchestration.portable.input_resolution.channel_resolver."""
from absl.testing.absltest import mock
import tensorflow as tf
from tfx.orchestration import mlmd_connection_manager as mlmd_cm
from tfx.orchestration.portable.input_resolution import channel_resolver
from tfx.proto.orchestration import pipe... | {
"content_hash": "410780c03a6cad092682b6d2d458b382",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 80,
"avg_line_length": 25.672199170124482,
"alnum_prop": 0.5113140455794407,
"repo_name": "tensorflow/tfx",
"id": "3197431b8b528ba406893a4aa737a440264c2994",
"size": "1297... |
import dis
from ..java import (
Code as JavaCode,
opcodes as JavaOpcodes,
ExceptionInfo as JavaExceptionInfo,
LineNumberTable
)
from .utils import extract_command, find_blocks
from .opcodes import Ref, resolve_jump, jump, Opcode, ALOAD_name, ICONST_val
class IgnoreBlock(Exception):
"""An escape ... | {
"content_hash": "6d7119488533243654b41b1d22278c4c",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 130,
"avg_line_length": 37.62376237623762,
"alnum_prop": 0.5628947368421052,
"repo_name": "glasnt/voc",
"id": "6ed2103fa6abef6c99f173de0b5153a4052d49e3",
"size": "11400",
... |
"""
AMF metadata (inside Flash video, FLV file) parser.
Documentation:
- flashticle: Python project to read Flash (formats SWF, FLV and AMF)
http://undefined.org/python/#flashticle
Author: Victor Stinner
Creation date: 4 november 2006
"""
from lib.hachoir_core.field import (FieldSet, ParserError,
UInt8, UIn... | {
"content_hash": "4243f8c90efc61fa9f8e500327d350f1",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 70,
"avg_line_length": 28.536363636363635,
"alnum_prop": 0.5931825422108952,
"repo_name": "Branlala/docker-sickbeardfr",
"id": "963f3207be40182e39c6f1eae0743539797b70c1",
... |
from tiddlyweb.config import config
from tiddlywebwiki import init as twinit
from tiddlywebplugins.utils import get_store
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.serializer import Serializer
def setup_module(module):
twinit(config)
store = get_store(con... | {
"content_hash": "c2fa879814cdaeda6368644a582b0330",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 98,
"avg_line_length": 31.027027027027028,
"alnum_prop": 0.7116724738675958,
"repo_name": "cdent/lazytiddlywebwiki",
"id": "451dc6b7f4e10d2e4219175da4f597cb574c9361",
"size... |
from uuid import uuid4
from itertools import cycle
# Neutron Agent superclass
from rpcdaemon.lib.neutronagent import NeutronAgent, NeutronAgentException
# RPC superclass
from rpcdaemon.lib.rpc import RPC
# Logger wrapper
from rpcdaemon.lib.logger import Logger
# Config parser
from rpcdaemon.lib.config import Config... | {
"content_hash": "39d562c3fed2fb0964b78fd730900994",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 103,
"avg_line_length": 32.94117647058823,
"alnum_prop": 0.4870535714285714,
"repo_name": "rcbops/rpcdaemon-buildpackage",
"id": "1c40c7795441294a3bd652eabafe254e598f4060",
... |
"""Tests for fft operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
from absl.testing import parameterized
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.core.protobuf impo... | {
"content_hash": "dd0a662f4fd7bbf913229647206081e1",
"timestamp": "",
"source": "github",
"line_count": 670,
"max_line_length": 79,
"avg_line_length": 39.82089552238806,
"alnum_prop": 0.6026986506746627,
"repo_name": "petewarden/tensorflow",
"id": "1730287bd9bced66aa80ff7352ae1b4e6aceba34",
"size":... |
from typing import Iterator, TYPE_CHECKING
from cirq import ops
from cirq.interop.quirk.cells.cell import CellMaker
if TYPE_CHECKING:
import cirq
def generate_all_scalar_cell_makers() -> Iterator[CellMaker]:
yield _scalar("NeGate", ops.global_phase_operation(-1))
yield _scalar("i", ops.global_phase_oper... | {
"content_hash": "40f54a8c20c91c7e529f4c5a4eab102c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 34.63157894736842,
"alnum_prop": 0.7051671732522796,
"repo_name": "quantumlib/Cirq",
"id": "0236b354d78f4de698bd23eea8ffddf550306231",
"size": "1246"... |
import os
def find_database(dbname):
cwd = os.getcwd()
while True:
dbpath = os.path.join(cwd,dbname)
if os.path.isfile(dbpath):
return dbpath
nwd = os.path.dirname(cwd)
if (nwd == cwd or not os.path.isdir(nwd)):
return None
cwd = nw... | {
"content_hash": "628297d40d8400f1f8a2a0d36831ed45",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 50,
"avg_line_length": 19.130434782608695,
"alnum_prop": 0.5363636363636364,
"repo_name": "lionicsheriff/tagi",
"id": "f6ef2ca2bbe53351fc97f5b8729c7065d979b726",
"size": "4... |
import threading
from time import sleep
class SMPPKeepAlive(threading.Thread):
def __init__(self, obj):
self.obj = obj
threading.Thread.__init__(self)
self.daemon = True
def run(self):
while 1:
self.obj._keepalive()
... | {
"content_hash": "469f5d3a4fb5609e935c4b4bd76dc2fe",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 26.307692307692307,
"alnum_prop": 0.48830409356725146,
"repo_name": "henrythor/SMPP.py",
"id": "8a46abc308fa09e406d578de03f44239142dcb3b",
"size": "3... |
import base64
import os
import re
import shutil
import subprocess
import tempfile
import urllib
from contextlib import contextmanager
from datetime import timedelta
from typing import (
Any,
Callable,
Collection,
Dict,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sequence,
Se... | {
"content_hash": "a5fb0970736e8d35ba1954bee90e0435",
"timestamp": "",
"source": "github",
"line_count": 1822,
"max_line_length": 103,
"avg_line_length": 38.37980241492865,
"alnum_prop": 0.6168916599931358,
"repo_name": "kou/zulip",
"id": "6803902000ce003ddafe007dc71cf9624df70812",
"size": "69928",
... |
import web
import requests
import uuid
from config import *
accesstoken = PB_ACCESS_TOKEN
clientid = PB_CLIENT_ID
clientsecret = PB_CLIENT_SECRET
urls = (
'/', 'index'
'/auth_complete' , 'auth_complete'
)
app = web.application(urls, globals())
render = web.template.render('templates/')
class index(object):
... | {
"content_hash": "532211b8583e39c314c66611bf5133c7",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 124,
"avg_line_length": 39.43396226415094,
"alnum_prop": 0.6813397129186602,
"repo_name": "Haxim/ShackBullet",
"id": "88c73d1b343caa5408a040477ecc0b1b147fa6a0",
"size": "20... |
import time
import math
from whirlybird.server.devices.i2c import I2c
from enum import Enum
AdafruitPwmAddress = 0x40
class AdafruitPwmRegisters(Enum):
Mode1 = 0x00
Mode2 = 0x01
Subaddr1 = 0x02
Subaddr2 = 0x03
Subaddr3 = 0x04
Prescale = 0xFE
Led0OnL = 0x06
Led0OnH = 0x07
Led0OffL ... | {
"content_hash": "d48063233bd21c20c7fd439da1cd5023",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 96,
"avg_line_length": 30.424242424242426,
"alnum_prop": 0.649734395750332,
"repo_name": "levisaya/whirlybird",
"id": "e17743918f0f2c8db0e88d31204c732eebd4f6e1",
"size": "3... |
class DfsNode:
White = 0
Grey = 1
Black = 2
def __init__( self ):
self._preVisit = -1
self._postVisit = -1
self._color = DfsNode.White
def setColor( self, color ):
assert color in ( DfsNode.White, DfsNode.Grey, DfsNode.Black ), "invalid color value"
self._... | {
"content_hash": "c6c8a921f35a6269916f1bd061edbfeb",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 103,
"avg_line_length": 24.3876404494382,
"alnum_prop": 0.5549412577747063,
"repo_name": "wo3kie/pchGenerator",
"id": "b6bce09097370310ceb8be00f34f5345e6a27bdc",
"size": "... |
from handlers.base import BaseHandler
import logging
logger = logging.getLogger('tutu.' + __name__)
class IndexHandler(BaseHandler):
def get(self):
self.render_jinja2("index.html")
| {
"content_hash": "ab7e9d95997b7b4f0a472f8239453eb0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 46,
"avg_line_length": 21.77777777777778,
"alnum_prop": 0.7091836734693877,
"repo_name": "shizhz/tutu",
"id": "df6d7863dd8c9774096bf1446d6ed8a44b4b15e6",
"size": "221",
"b... |
from __future__ import absolute_import
from pychron.git.hosts.gitlab import GitLabService
from pychron.git.tasks.base_git_plugin import BaseGitPlugin
from pychron.git.tasks.githost_preferences import GitLabPreferencesPane
class GitLabPlugin(BaseGitPlugin):
name = 'GitLab'
service_klass = GitLabService
de... | {
"content_hash": "aaa60923b2a4d11bcceebcd844ebe583",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 71,
"avg_line_length": 33,
"alnum_prop": 0.6796536796536796,
"repo_name": "UManPychron/pychron",
"id": "817976880254e0ea9b4fd43cfce45dff2ee7803f",
"size": "1394",
"binary... |
from teafacto.blocks.seq.enc import SimpleSeq2Bool, SimpleSeq2Vec, SimpleSeq2Idx
from teafacto.blocks.lang.sentenc import WordCharSentEnc
from teafacto.blocks.seq.rnn import EncLastDim
from teafacto.blocks.basic import VectorEmbed, SMOWrap
from teafacto.core.base import Val
from teafacto.util import argprun, ticktock, ... | {
"content_hash": "45605b7a0b9b1368eb8c02bff810ae88",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 120,
"avg_line_length": 40.213793103448275,
"alnum_prop": 0.6100154347453267,
"repo_name": "lukovnikov/teafacto",
"id": "b44cab4055a428c6e8419c4b167ae553cb9e4d4d",
"size":... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
cwd = os.getcwd()
paren... | {
"content_hash": "972ae75b08a0ce180750ef55c7571113",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 82,
"avg_line_length": 32.41908713692946,
"alnum_prop": 0.7060028158197875,
"repo_name": "s-m-i-t-a/jinja2-stl",
"id": "1f88c122a8b2fe0a50f6195f461a290bf34b64bc",
"size": ... |
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "cnzz.com")
| {
"content_hash": "40cb3e86a137e4a2533018e3805daced",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 54,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.7325581395348837,
"repo_name": "cflq3/getcms",
"id": "fe9dcc9cc99062d645a6bf6963b567e361894ccb",
"size": "128",
... |
from sklearn.utils import check_random_state
from .base import base_minimize
from ..utils import cook_estimator
def gbrt_minimize(func, dimensions, base_estimator=None,
n_calls=100, n_random_starts=None,
n_initial_points=10,
initial_point_generator="random",
... | {
"content_hash": "5a7ff8a12ba8487f23ec3444f59052d2",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 94,
"avg_line_length": 43.376344086021504,
"alnum_prop": 0.6378284581060981,
"repo_name": "scikit-optimize/scikit-optimize",
"id": "de43d6fccf3a1b232ed23383278671f3b358e7ae"... |
import argparse
import itertools
import json
import collections
import datetime
import sys
import mercantile
import shapely.geometry
MIN_DATE = '0000-00-00'
MAX_DATE = '9999-99-99'
MIN_ZOOM = 0
MAX_ZOOM = 19
cache_down = {}
cache_up = {}
cache_center = {}
cache_date = {}
cache_in_bound = {}
def get_down_tiles(x, ... | {
"content_hash": "e7296ccea7a9441e6a76eb4a3188ab8a",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 117,
"avg_line_length": 37.792156862745095,
"alnum_prop": 0.580886167894573,
"repo_name": "tbicr/map-trends",
"id": "b5e2a5a7b1f6893f2124fe6d38a67986357a1b82",
"size": "96... |
from sample_module.example import redis_cache
def test_redislite_can_set():
r = redis_cache()
assert r.set('foo', 'bar') is True
assert r.get('foo') == b'bar'
| {
"content_hash": "cefa0b5f9d1df1d875708fa6f065515a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 45,
"avg_line_length": 24.714285714285715,
"alnum_prop": 0.6416184971098265,
"repo_name": "bionikspoon/isolate_redislite_tox_psutil",
"id": "a7e0691da6728f5adfbc20d231ddefb392... |
"""Classes supporting configuration property editor and REST operations."""
__author__ = 'Pavel Simakov ([email protected])'
import cgi
import urllib
from controllers import sites
from controllers.utils import BaseRESTHandler
from controllers.utils import XsrfTokenManager
from models import config
from models impor... | {
"content_hash": "ced08e69fc05d53ea3f532a0631bc447",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 79,
"avg_line_length": 34.775456919060055,
"alnum_prop": 0.5760192206622119,
"repo_name": "esacosta/u-mooc",
"id": "5d6451b4eb7375ba20441c4776b99358e6664f7a",
"size": "139... |
from office365.runtime.paths.entity import EntityPath
class NonePath(EntityPath):
def __init__(self, parent=None):
super(NonePath, self).__init__(None, parent, parent)
| {
"content_hash": "ca2e6af0b5e302f29a6d82d90e8336a0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 60,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.6994535519125683,
"repo_name": "vgrem/Office365-REST-Python-Client",
"id": "b07bff9603ad9c227fbc429c064949286b8fe62c... |
from matplotlib import rc
import matplotlib
matplotlib.rcParams['text.latex.preamble']=[""]
params = {#'text.usetex' : False,
'font.size' : 15,
'font.family' : 'sans-serif',
#'text.latex.unicode': True,
}
matplotlib.rcParams.update(params)
matplotlib.rc('xtick', labelsize=15)
m... | {
"content_hash": "31802a45a64237da76f182d07aace0b6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 88,
"avg_line_length": 37.5,
"alnum_prop": 0.6708771929824562,
"repo_name": "libsmelt/libsmelt",
"id": "9f28ca2cbecfe3bd508a2032ffa5cfa678696e9a",
"size": "1425",
"binary... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BlogEntry',
fields=[
('id', models.AutoField(verbose_name='ID', seriali... | {
"content_hash": "180de58b9ea04bd4b90cc5bc586af31e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 114,
"avg_line_length": 33.48275862068966,
"alnum_prop": 0.5303810504634398,
"repo_name": "salmanwahed/pypanda_project",
"id": "441683f29f301e2ac12019c53fe3fed7f45ba0b1",
"... |
import unittest2
from pyoauth.error import InvalidOAuthParametersError, \
InvalidAuthorizationHeaderError, \
InvalidSignatureMethodError, \
InvalidHttpResponseError, HttpError, InvalidContentTypeError, IllegalArgumentError
from pyoauth.http import RequestAdapter, ResponseAdapter
from pyoauth.protocol import... | {
"content_hash": "14add8e0c70113278a9a88036a4255b2",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 223,
"avg_line_length": 60.0985401459854,
"alnum_prop": 0.6314447075970122,
"repo_name": "gorakhargosh/pyoauth",
"id": "4fb4b8bcaa482d045dda45063876c544754c9131",
"size": ... |
from flask import Flask
from werkzeug.contrib.cache import SimpleCache
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.mail import Mail
# Celery
from celery import Celery
###########
# GLOBALS #
###########
# the Flask app
app = Flask(__name__)
app.config.from_object('config')
# database
db = SQLAlchemy(... | {
"content_hash": "6c1c32b2791d11e98ee67a1ed423f410",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 57,
"avg_line_length": 17.515151515151516,
"alnum_prop": 0.7249134948096886,
"repo_name": "nlohmann/lqfb_viewer",
"id": "665170abfac3921ce30afd1636e6149297ac916f",
"size": ... |
import numpy as np
from scipy.spatial import distance
def DB_index2D(centroids, clusters, X, metric='euclidean'):
"""
Return the Davies-Bouldin index for cluster evaluation for 2D data.
The index is calculated using the formula:
DB = (1/k) * sum(max((sigma_i + sigma_j)/distance(c_i, c_j)))
where:... | {
"content_hash": "0013d970ee5a7f9663d8b1a6bca8a676",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 145,
"avg_line_length": 38.13636363636363,
"alnum_prop": 0.605979340484704,
"repo_name": "paren8esis/thesis",
"id": "248b2cf573293dd7e816f97614419fe7e43b5f23",
"size": "10... |
from crypto_library import ctr_aes
blocksize = 16
key = 'YELLOW SUBMARINE'
nonce = 0
nonce_format = '<q'
counter_format = '<Q'
ciphertext = 'L77na/nrFsKvynd6HzOoG7GHTLXsTVu9qvY/2syLXzhPweyyMTJULu/6/kXX0KSvoOLSFQ=='.decode('base64')
print repr(ctr_aes(ciphertext, key, nonce, nonce_format, counter_format, blocksize))
| {
"content_hash": "049def6ef515b596be1210d68fdac7c6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 104,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.7672955974842768,
"repo_name": "dimkarakostas/matasano-cryptochallenges",
"id": "752649c865cdf119ad28232dd3f5131724... |
"""Routing directing."""
from __future__ import absolute_import
from channels.routing import route
from rotest.api.consumers import ws_connect, ws_disconnect, ws_receive
channel_routing = [
route('websocket.connect', ws_connect),
route('websocket.receive', ws_receive),
route('websocket.disconnect', ws_di... | {
"content_hash": "fae342580821f2ed33715ff86263cc97",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 70,
"avg_line_length": 27.75,
"alnum_prop": 0.7327327327327328,
"repo_name": "gregoil/rotest",
"id": "bd2d86304f01bab461d73a2444290d2d414d578b",
"size": "333",
"binary": ... |
from urllib.parse import urljoin
from os.path import join, dirname, exists
from os import makedirs
import yaml, argparse
template = '''<!DOCTYPE html>
<meta charset="utf-8">
<title>Redirecting...</title>
<link rel="canonical" href="{href}">
<meta http-equiv="refresh" content="0; url={href}">
<h1>Redirecting...</h1>
<a... | {
"content_hash": "43f1130d9077410cfd22cd3d1565f64f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 32.72093023255814,
"alnum_prop": 0.644633972992182,
"repo_name": "mapzen/mapzen-docs-generator",
"id": "e8071379894038925f36098dd70c811092722479",
"s... |
"""
Copyright (c) 2011-2016 Eric R. Jeschke
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and th... | {
"content_hash": "65a401999d8be9614fe700a5633c88fd",
"timestamp": "",
"source": "github",
"line_count": 557,
"max_line_length": 86,
"avg_line_length": 40.077199281867145,
"alnum_prop": 0.5538682076781795,
"repo_name": "Cadair/ginga",
"id": "6e8631473bac60fa4ec7033a7ea581599ae43f1b",
"size": "22439"... |
from rockit.core import serializers
from rockit.core.holders import Holder
class MixesHolder(Holder):
"""
A holder that collects all items that can be assigned to when action
"""
CONTAINER_WHEN = 'when'
CONTAINER_THEN = 'then'
CONTAINER_FINISH = 'finish'
def __init__(self, association):
... | {
"content_hash": "36e81f8a11aea79b28a2b2d2a2bc7ec3",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 26.956204379562045,
"alnum_prop": 0.5548334687246141,
"repo_name": "acreations/rockit-server",
"id": "365e710257398374bd966df3e74093d53f3e5b3b",
"si... |
import base_filters
COPY_GOOGLE_DOC_KEY = '18Zus5ARv6KLPX49AsIzoOU2_nlfl0NMmhdTEIu58T68'
USE_ASSETS = False
# Use these variables to override the default cache timeouts for this graphic
# DEFAULT_MAX_AGE = 20
# ASSETS_MAX_AGE = 300
JINJA_FILTER_FUNCTIONS = base_filters.FILTERS
| {
"content_hash": "f68f717bec73c8b8c842d7c2b89ecff4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 25.636363636363637,
"alnum_prop": 0.7872340425531915,
"repo_name": "nprapps/dailygraphics",
"id": "0605fc9a267131a27650eaf61ba53b51b570dc53",
"size":... |
from __future__ import absolute_import
import cobra
import json
import pandas as pd
import cobra.test
from cobra.core import Reaction
from medusa.core.ensemble import Ensemble
from cobra.io import load_json_model
from os.path import abspath, dirname, join
from pickle import load
medusa_directory = abspath(join(di... | {
"content_hash": "d238cbca1f63d9007499e3fbe61003c2",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 116,
"avg_line_length": 37.25581395348837,
"alnum_prop": 0.6779026217228464,
"repo_name": "gregmedlock/Medusa",
"id": "24e0a7c0a3451be17d3cbfa67ad9545708e664bb",
"size": "3... |
import sys
import re
import os
from parser import parse_file
from style import Style
from content_error import ContentError
from song import Song
from songbook import Songbook
'''
If your text is one line string then you can use
from reportlab.pdfbase.pdfmetrics import stringWidth
textWidth = stringWidth(text, font... | {
"content_hash": "8f70e3b493d3b2ac4da0614aa07fbdbd",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 97,
"avg_line_length": 23.714285714285715,
"alnum_prop": 0.7259036144578314,
"repo_name": "wojtex/cantionale",
"id": "413e23ab053c3af303816c1c2ce0f1ac5a4b7ae3",
"size": "10... |
from PDFWriter import PDFWriter
with PDFWriter("test_pdfwriter.pdf") as pw:
pw.setFont("Courier", 12)
pw.setHeader("Input: test_pdfwriter.py Output: test_pdfwriter.pdf")
pw.setFooter("Generated by xtopdf: http://bit.ly/xtopdf")
with open("test_pdfwriter.py") as in_fil:
for lin in in_fil:
... | {
"content_hash": "d635643e16a12a823b07a5b33dc37510",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 71,
"avg_line_length": 31.454545454545453,
"alnum_prop": 0.6705202312138728,
"repo_name": "ActiveState/code",
"id": "5100eb0b8404ce14532659acf12bb520da55693d",
"size": "367... |
import clang_util
import cpp
import file_parser
import re
import util
import parser_addition
from clang.cindex import TypeKind
def sequence_from_text(text):
return [cpp.SimpleToken(entry) for entry in text.split(' ')]
def get_alias_from_text(name, text):
return cpp.Alias(name, [cpp.SimpleToken(spelling) for... | {
"content_hash": "27a2a939c29be7b3420cb7d0c52be4d9",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 151,
"avg_line_length": 37.76391982182628,
"alnum_prop": 0.6643076197216324,
"repo_name": "lubkoll/friendly-type-erasure",
"id": "01ac14c403a10c45529fc4d6702dd7d776cb7376",
... |
'''OpenGL extension SUN.vertex
This module customises the behaviour of the
OpenGL.raw.GL.SUN.vertex to provide a more
Python-friendly API
Overview (from the spec)
This extension provides new GL commands to specify vertex data such as
color and normal along with the vertex in one single GL command in order to
... | {
"content_hash": "252a7a6a1630c5652ac1dbdf1f8be7f6",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 149,
"avg_line_length": 27.698795180722893,
"alnum_prop": 0.7666376685515441,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "21d46cb1e443de6c36a65a3cb677fba9028c74c8"... |
import thread
assert hasattr(thread, '__file__')
| {
"content_hash": "e668d5c7d979e20cae3e15393763fe12",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 34,
"avg_line_length": 16.666666666666668,
"alnum_prop": 0.7,
"repo_name": "babble/babble",
"id": "c12155c9d1c5da88b68b70caea542bbc8e3334e6",
"size": "50",
"binary": false... |
from __future__ import absolute_import, division, print_function, unicode_literals
from yaml import safe_load, safe_dump, SafeLoader
SafeLoader.add_constructor('tag:yaml.org,2002:python/unicode', SafeLoader.construct_yaml_str)
def yaml_load(stream):
"""Loads a dictionary from a stream"""
return safe_load(s... | {
"content_hash": "bfb64b3b34cd971145707b403589a5f8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 93,
"avg_line_length": 29.625,
"alnum_prop": 0.7362869198312236,
"repo_name": "Anaconda-Platform/anaconda-client",
"id": "bb2987800e900aac38d6e6be1ee1260b17a34edd",
"size":... |
import uuid
class Task(object):
"""
Task for worker.
:param sender: opaque object to identify response receiver
:param id: id for this task. identical tasks should share the same id,
(e.g. requests for the same meta tile)
:param doc: the task as JSON
"""
def __init__(self, id, doc,... | {
"content_hash": "8c59172adc45bde436a7db36a52bbc3e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 74,
"avg_line_length": 30.285714285714285,
"alnum_prop": 0.6022012578616353,
"repo_name": "mapproxy/mapproxy-renderd",
"id": "7155b249ed5c6883977771a4ae5b575825819c48",
"si... |
import pytest
import salt.states.mac_assistive as assistive
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {assistive: {}}
def test_installed():
"""
Test installing a bundle ID as being allowed to run with assistive access
"""
expected = {... | {
"content_hash": "50b99fdd55ebc4d7121d5c931b44ac5b",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 86,
"avg_line_length": 29.155038759689923,
"alnum_prop": 0.6032969954799255,
"repo_name": "saltstack/salt",
"id": "e83d422f59166e6f10296608eda20d853f673b09",
"size": "3761... |
from cuckoo.common.config import config
from cuckoo.common.exceptions import CuckooOperationalError
class Elastic(object):
def __init__(self):
self.client = None
self.enabled = None
self.hosts = None
self.calls = None
self.index = None
self.index_time_pattern = None... | {
"content_hash": "2f4e745cef0913d046cb35de47d17946",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 79,
"avg_line_length": 32.5625,
"alnum_prop": 0.6071657069737684,
"repo_name": "cuckoobox/cuckoo",
"id": "d4a866845574d0269374fea5a47c074f173cba4b",
"size": "1732",
"bina... |
import argparse
import json
import logging
import numpy as np
import os
import threading
import time
from ray._private.test_utils import monitor_memory_usage
from ray.data._internal.progress_bar import ProgressBar
from collections import namedtuple
from queue import Queue
import ray
logging.basicConfig(level=loggin... | {
"content_hash": "d77cbd388b47b7ff10ae631e77aec2d5",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 81,
"avg_line_length": 32.04294478527607,
"alnum_prop": 0.6053991958644457,
"repo_name": "ray-project/ray",
"id": "8b0fef482cb16ff5366c37a429e079c1261019f9",
"size": "5223... |
import os
import re
import toml.decoder
from setuptools import setup, find_packages
# from packaging.version import parse as version_parse
from sys import version_info as python_version_info
from semantic_version import SimpleSpec, Version
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
PYPROJECT_TOML = toml.... | {
"content_hash": "99b3f9a033d12e38155aac023dcff418",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 116,
"avg_line_length": 31.70731707317073,
"alnum_prop": 0.6382051282051282,
"repo_name": "4dn-dcic/fourfront",
"id": "ea77d0ef411c2c99a718342ad1d2fc7f93ad64c3",
"size": "... |
"""Generic TFX example_validator executor."""
import os
from typing import Any, Dict, List
from absl import logging
import tensorflow_data_validation as tfdv
from tfx import types
from tfx.components.example_validator import labels
from tfx.components.statistics_gen import stats_artifact_utils
from tfx.components.uti... | {
"content_hash": "d97e1ec7408de9d31d8f52288e44016f",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 79,
"avg_line_length": 43.338345864661655,
"alnum_prop": 0.6776544066620402,
"repo_name": "tensorflow/tfx",
"id": "f1db660131424d7b0a375cf064d14085d142c979",
"size": "6360... |
import os
import re
import sys
import ast
import json
import codecs
import argparse
import shutil
# The root of our pypy source checkout, if it exists.
PYPY_ROOT = os.path.join(
os.path.dirname(__file__),
"../deps/pypy",
)
# Modules that are builtin, so we shouldn't expect them in the bundle.
BUILTIN_MODULES... | {
"content_hash": "4a92ed0b320f0bc21bc4c939e6000ce4",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 90,
"avg_line_length": 35.68817204301075,
"alnum_prop": 0.5659191667025352,
"repo_name": "albertjan/pypyjs",
"id": "90f50d1ac1672f0d1b65949c0acbe62555ea627b",
"size": "241... |
import sys
import time
class display:
def __init__(self,width,height):
# store pixels in rows (screen has height many lists that are width long)
self.screen = []
self.width = width
self.height = height
for i in range(0,height):
self.screen.append([])
for j in range(0,width):
self.scree... | {
"content_hash": "cadcde41daedb552010845fc15a7d2ef",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 75,
"avg_line_length": 23.80722891566265,
"alnum_prop": 0.5981781376518218,
"repo_name": "tbjoern/adventofcode",
"id": "27f659ca1e45461f30c69af59cc45d3eff3b493b",
"size": "... |
import socket, time
# Python 2.3 does not have 'set' in normal namespace.
# But it can be imported from 'sets'
try:
set()
except NameError:
from sets import Set as set
"""MK Livestatus Python API
This module allows easy access to Nagios via MK Livestatus.
It supports persistent connections via the connection... | {
"content_hash": "86f1dd87a2930dec87bdd3972a00bb26",
"timestamp": "",
"source": "github",
"line_count": 610,
"max_line_length": 117,
"avg_line_length": 37.967213114754095,
"alnum_prop": 0.5701640759930915,
"repo_name": "daniellawrence/simplenagios",
"id": "9e130d1ab58cd49dbfeecf5875527af2535f4767",
... |
import os
import unittest
from GoogleScraper import scrape_with_config
from GoogleScraper.parsing import get_parser_by_search_engine
from GoogleScraper.config import get_config
from collections import Counter
config = get_config()
base = os.path.dirname(os.path.realpath(__file__))
all_search_engines = config.get('sup... | {
"content_hash": "3911e5fdb8386d67419f9399d72268bf",
"timestamp": "",
"source": "github",
"line_count": 397,
"max_line_length": 174,
"avg_line_length": 44.30226700251889,
"alnum_prop": 0.6168410279736184,
"repo_name": "ARDivekar/SearchDistribute",
"id": "1329b50f99e227615596b2a433d801ab6769ae13",
"... |
import logging
import os
import os.path
import codecs
from edge.opensearch.datasetisoresponse import DatasetIsoResponse
from edge.opensearch.datasetwriter import DatasetWriter
class IsoWriter(DatasetWriter):
def __init__(self, configFilePath):
super(IsoWriter, self).__init__(configFilePath)
... | {
"content_hash": "8fd8a3ea984cdcf60fd07ffb1f3ca27e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 101,
"avg_line_length": 32.607142857142854,
"alnum_prop": 0.7042716319824753,
"repo_name": "dataplumber/edge",
"id": "a93bd7694535cd6966e6f421d697ae13eae74cf3",
"size": "91... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.