text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import shutil
import unittest
from unittest import TestCase
from wopmars.tests.resource.wrapper.FooWrapper10 import FooWrapper10
from wopmars.tests.resource.wrapper.FooWrapper4 import FooWrapper4
from wopmars.tests.resource.wrapper.FooWrapper5 import FooWrapper5
from wopmars.tests.resource.wrapper.FooWrapper... | {
"content_hash": "835d192303e6a465ccea1d24b4c9f521",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 129,
"avg_line_length": 48.82236842105263,
"alnum_prop": 0.7005794367335939,
"repo_name": "aitgon/wopmars",
"id": "3691e8781535f90240098eedbfd984e9893aa1af",
"size": "7421... |
import _plotly_utils.basevalidators
class TokenValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="token", parent_name="parcats.stream", **kwargs):
super(TokenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "eefbc20474b830141bc3d435fb137a0e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 84,
"avg_line_length": 38.57142857142857,
"alnum_prop": 0.5925925925925926,
"repo_name": "plotly/python-api",
"id": "eb75236212300dfb222c756bec4edcf4480678db",
"size": "540... |
import pytest
from six import iteritems
from datadog_checks.mesos_master import MesosMaster
from .common import BASIC_METRICS, CHECK_NAME, INSTANCE, not_windows_ci
pytestmark = not_windows_ci
@pytest.mark.integration
@pytest.mark.usefixtures("dd_environment")
def test_check_integration(instance, aggregator):
c... | {
"content_hash": "513abf4f28db28d25fb5c84c4d297c54",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 26.6,
"alnum_prop": 0.6992481203007519,
"repo_name": "DataDog/integrations-core",
"id": "5c308680cc8d2d4365a6a63e424636cffab09f7b",
"size": "1312",
... |
"""This module contains Dyn Message Management accounts features. It's important
to note that any/all timestamps are expected as `datetime.datetime` instances
and will be returned as such.
"""
from datetime import datetime
from ..core import cleared_class_dict
from .utils import str_to_date, date_to_str, APIDict
from ... | {
"content_hash": "5ebec146357c57f5b77edf3d4cd106d6",
"timestamp": "",
"source": "github",
"line_count": 648,
"max_line_length": 80,
"avg_line_length": 35.050925925925924,
"alnum_prop": 0.5978074230616828,
"repo_name": "mjhennig/dyn-python",
"id": "508d62959be3e3b4a670e1ec1fc41ac8a95346df",
"size": ... |
"""
solving mnist classification problem using tensorflow
one fully connected layer
"""
# Load MNIST dataset
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
# Import TensorFlow and start interactive Session
import tensorflow as tf
session = tf.I... | {
"content_hash": "9a02aad4845ded3abc8d3e71f6b7d2e5",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 92,
"avg_line_length": 35.234042553191486,
"alnum_prop": 0.7463768115942029,
"repo_name": "mnannt/mnist_experiments",
"id": "bd9a958000f74d902d9663c89facf5590300b74e",
"siz... |
__author__ = 'uolter'
import urllib
import sys
base_url = "http://ichart.finance.yahoo.com/table.csv?s="
def make_url(ticker_symbol):
return base_url + ticker_symbol
output_path = "/Users/uolter/src/pycode/finance"
def make_filename(ticker_symbol, directory):
return output_path + "/" + directory + "/" + t... | {
"content_hash": "4ae9a7614dc8971789417ec1c34e6d77",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 92,
"avg_line_length": 23.636363636363637,
"alnum_prop": 0.6717948717948717,
"repo_name": "uolter/BitCoin",
"id": "0091c437b8564b7b6369ca146117904525cfe918",
"size": "780",... |
""" Test of AQGD optimizer """
import unittest
from test.python.algorithms import QiskitAlgorithmsTestCase
from qiskit import Aer
from qiskit.circuit.library import RealAmplitudes
from qiskit.utils import QuantumInstance, algorithm_globals
from qiskit.opflow import PauliSumOp
from qiskit.algorithms.optimizers import A... | {
"content_hash": "e22ab6608d36cdb6c8f9b4bff635e4c2",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 100,
"avg_line_length": 37.72222222222222,
"alnum_prop": 0.6353460972017673,
"repo_name": "QISKit/qiskit-sdk-py",
"id": "37c12aa9550376ac27285bf6d733090605652103",
"size": ... |
from django.http import HttpResponse
import json
import requests
import urllib
import time
import math
import itertools
from models import CROP_NAME
from collections import defaultdict
from models import CropPrice
from django.utils.functional import lazy, memoize
import parse_nass
def fcRequest(req):
def waitForDat... | {
"content_hash": "6f71ae92cf2421acaf20dac607b828a1",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 197,
"avg_line_length": 35.56508875739645,
"alnum_prop": 0.639547458614092,
"repo_name": "georgejlee/croptrends",
"id": "f7838dd16da06548223515cecc80c3fbb4c6281a",
"size":... |
import argparse
import sys
from kvirt.config import Kconfig
from kvirt.common import pprint, error, success
import pyghmi.ipmi.bmc as bmc
class KBmc(bmc.Bmc):
def __init__(self, authdata, port, name, client):
super(KBmc, self).__init__(authdata, port)
self.bootdevice = 'default'
self.k = ... | {
"content_hash": "78925831f34a7b30f06dec6ee65f1f83",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 114,
"avg_line_length": 34.566265060240966,
"alnum_prop": 0.5956779365632625,
"repo_name": "karmab/kcli",
"id": "93c64835678f495897267e623e7b5ca55e13ef54",
"size": "2869",
... |
import datetime
import logging
import re
import time as py_time
from django.conf import settings
from common import api
from common import clock
from common import exception
from common.protocol import sms
from common.protocol import xmpp
utcnow = lambda: clock.utcnow()
_re_match_url = re.compile(r'(http://[^/]+(/... | {
"content_hash": "bf6578c77b73fc517dd1292a5c67081b",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 74,
"avg_line_length": 24.24390243902439,
"alnum_prop": 0.5989939637826962,
"repo_name": "CollabQ/CollabQ",
"id": "ff9ba0783735e2c4612d79c9be66351dcce4041d",
"size": "5586... |
import unittest
from progdb.ctags_parser import *
class TestCTagsParser(unittest.TestCase):
def test_parse_from_lines(self):
def doFile(filename):
f = open(filename,"r")
tags = parse_ctags_from_ctags_output(f.readlines())
for t in tags:
if t.needs_determining:
t.determine_line... | {
"content_hash": "4648fb93dcf3bc3a6bfc6e6d51ea6698",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 33,
"alnum_prop": 0.6921850079744817,
"repo_name": "natduca/ndbg",
"id": "91ca7b5b4262482bac1ce9d03cd805ed3c6c14a0",
"size": "1203",
"binary": fals... |
from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
version = '0.1'
install_requires = [
# List your project dependencies here.
# For more detail... | {
"content_hash": "c983572b7959aee056cb24e339ec84b4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 92,
"avg_line_length": 28.44736842105263,
"alnum_prop": 0.6651248843663274,
"repo_name": "supercodepoet/python-ga",
"id": "2b1ffa81f51a51d51e5d1b5fcb8318edeaf06e5a",
"size"... |
import os
import copy
import time
import urllib
import json
from xbmcswift2 import xbmc, xbmcplugin, xbmcvfs
from meta import plugin, import_tmdb, import_tvdb, LANG
from meta.gui import dialogs
from meta.info import get_tvshow_metadata_tvdb, get_tvshow_metadata_tmdb, get_season_metadata_tvdb, get_episode_metadata_tvdb,... | {
"content_hash": "7151a059456447e82d8a884a76209d5e",
"timestamp": "",
"source": "github",
"line_count": 1425,
"max_line_length": 597,
"avg_line_length": 49.719298245614034,
"alnum_prop": 0.5774453069865914,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "d85626964c4991f63f841afe6a28564559f8c4e5",... |
"""Common code for converting proto to other formats, such as JSON."""
import base64
import collections
import datetime
import json
import logging
from protorpc import message_types
from protorpc import messages
from protorpc import protojson
import six
from googlecloudapis.apitools.base.py import exceptions
__all... | {
"content_hash": "4aecc3c583cae7374adf592a426307ee",
"timestamp": "",
"source": "github",
"line_count": 635,
"max_line_length": 80,
"avg_line_length": 35.13385826771653,
"alnum_prop": 0.6946212460779919,
"repo_name": "ychen820/microblog",
"id": "02474aba8ef783e69dfe0f06707907bfad5e75b8",
"size": "2... |
''' handler module '''
__all__ = ['handlers']
from heron.ui.src.python.handlers import api
from heron.ui.src.python.handlers.base import BaseHandler
from heron.ui.src.python.handlers.mainhandler import MainHandler
from heron.ui.src.python.handlers.notfound import NotFoundHandler
#####################################... | {
"content_hash": "ef218e1cc297108712be1059a2f95438",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 80,
"avg_line_length": 54.05,
"alnum_prop": 0.7215541165587419,
"repo_name": "cliffyg/heron",
"id": "60da8dbaa199c424a307ce5160b01f0b2ed3e504",
"size": "1081",
"binary": ... |
import itertools
from typing import List
from django.db import connection
from django.db.models import Manager, Model
from django.db.models.query import QuerySet
from django.dispatch import Signal
from querybuilder.query import Query
from . import upsert2
# A signal that is emitted when any bulk operation occurs
po... | {
"content_hash": "35da734764433b2d24739550dac13af0",
"timestamp": "",
"source": "github",
"line_count": 744,
"max_line_length": 120,
"avg_line_length": 41.748655913978496,
"alnum_prop": 0.6563858214481182,
"repo_name": "ambitioninc/django-manager-utils",
"id": "e4cb65defd339cce176d575f64129e9b3a4920a... |
"""Contains the volume perturb augmentation model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from data_utils.augmentor.base import AugmentorBase
class ShiftPerturbAugmentor(AugmentorBase):
"""Augmentation model for adding random shift perturba... | {
"content_hash": "da86899d5f0943812e1d697ce1a231cb",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 76,
"avg_line_length": 32.970588235294116,
"alnum_prop": 0.6735057983942908,
"repo_name": "xinghai-sun/models",
"id": "c4cbe3e172f6b291f3b778b748affda0341a3181",
"size": "1... |
from __future__ import division
import numpy as np
def ndargmax(arr):
return np.unravel_index(np.argmax(np.ravel(arr)),arr.shape)
def match_by_overlap(a,b):
assert a.ndim == b.ndim == 1 and a.shape[0] == b.shape[0]
ais, bjs = list(set(a)), list(set(b))
scores = np.zeros((len(ais),len(bjs)))
for i,... | {
"content_hash": "e266ef48de9bf4081c1c004d042036da",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 97,
"avg_line_length": 31.407894736842106,
"alnum_prop": 0.5890238793464599,
"repo_name": "mattjj/pyhsmm-collapsedinfinite",
"id": "672122ba3f663e925f8e0f27f37d357ea1c58293",... |
import abc
from abc import ABC, abstractmethod
class A(ABC):
def print_function(self):
print("Abstract Base Class")
class SubClassB(A):
def print_function(self):
A.print_function(self)
print("Subclass")
if __name__ == "__main__":
B = SubClassB()
B.print_function() | {
"content_hash": "51d7ceee17b1c64119609b7b14bad032",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 36,
"avg_line_length": 18.176470588235293,
"alnum_prop": 0.6148867313915858,
"repo_name": "AnhellO/DAS_Sistemas",
"id": "847e2c8bc1eb805c2ef177ef6d51e0916cf443e9",
"size": ... |
"""
Defines a few (slightly silly) Django models that we can use in unit
tests.
"""
from __future__ import absolute_import, division, print_function, \
unicode_literals
from django.db import models
class Specie(models.Model):
common_name =\
models.CharField(
db_index = True,
max_lengt... | {
"content_hash": "f026275b921e79f4ab3919a7b88b3de3",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 68,
"avg_line_length": 18.76923076923077,
"alnum_prop": 0.5437158469945356,
"repo_name": "eflglobal/filters-django",
"id": "71d3886005f18848cef8f08503013fc177d0d4bf",
"size... |
"""
Support for Qwikswitch Sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.qwikswitch/
"""
import logging
from homeassistant.core import callback
from . import DOMAIN as QWIKSWITCH, QSEntity
DEPENDENCIES = [QWIKSWITCH]
_LOGGER = loggin... | {
"content_hash": "c12ac759d3104b13a7e95409ff338fc0",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 75,
"avg_line_length": 29.536231884057973,
"alnum_prop": 0.6319921491658489,
"repo_name": "jamespcole/home-assistant",
"id": "07d0247e4f60b5322f8874da2dc1cfb8a3f8ad6a",
"si... |
"""
Catmull-Rom interpolation.
http://www2.cs.uregina.ca/~anima/408/Notes/Interpolation/Parameterized-Curves-Summary.htm
"""
from .bspline import InterpolatorBSpline
from ..interpolate import Interpolator, Interpolate
from .. import algebra as alg
from ..types import Vector
from typing import Optional, Callable, Mappi... | {
"content_hash": "82c0d6d8016c666fa3b7ccd7a03c4653",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 101,
"avg_line_length": 26.844827586206897,
"alnum_prop": 0.6062941554271034,
"repo_name": "facelessuser/ColorHelper",
"id": "fcacf2d39ac921e134a0106e93aafbef86a72084",
"si... |
import os
import subprocess
import shutil
import tempfile
from ..environment import detect_ninja, detect_scanbuild
def scanbuild(exelist, srcdir, blddir, privdir, logdir, args):
with tempfile.TemporaryDirectory(dir=privdir) as scandir:
meson_cmd = exelist + args
build_cmd = exelist + ['-o', logdir... | {
"content_hash": "168908ddcd83532eb100f1cc526a2867",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 30.774193548387096,
"alnum_prop": 0.6530398322851153,
"repo_name": "becm/meson",
"id": "b9e96d20e355b44b513de4d30e237457fc4ed7f4",
"size": "1542",
... |
import numpy as np
from pgmpy.estimators import ParameterEstimator
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import BayesianModel
class BayesianEstimator(ParameterEstimator):
def __init__(self, model, data, **kwargs):
"""
Class used to compute parameters for a model using Ba... | {
"content_hash": "f525702dfb96af40b3ea4772e414f48e",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 117,
"avg_line_length": 49.10738255033557,
"alnum_prop": 0.5623889572229056,
"repo_name": "abinashpanda/pgmpy",
"id": "60931dd1b64dc597028dda34c7aff577e560b8ba",
"size": "... |
import six
import six.moves
from six import text_type
from mwclient.util import parse_timestamp
import mwclient.page
import mwclient.image
class List(object):
"""Base class for lazy iteration over api response content
This is a class providing lazy iteration. This means that the
content is loaded in chu... | {
"content_hash": "bd2cffe1005e192bc83edcd68a97670a",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 102,
"avg_line_length": 33.549839228295816,
"alnum_prop": 0.5615296147211041,
"repo_name": "ubibene/mwclient",
"id": "34d4d72fd6d8a72fb9f05beb189360cea05edfd2",
"size": "1... |
class Solution:
def largestRectangleArea(self, height):
if not height:
return 0
stack = []
max_area = 0
for i, h in enumerate(height):
if not stack or height[stack[-1]] <= h:
stack.append(i)
continue
... | {
"content_hash": "309d07f4b84cbfee64acfd6f37b831fc",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 52,
"avg_line_length": 28,
"alnum_prop": 0.4412442396313364,
"repo_name": "rahul-ramadas/leetcode",
"id": "377d13fce1e8b70fb0fc018093480ee4b0fb8a5a",
"size": "868",
"bina... |
from django.conf.urls import url
from . import views
app_name = 'voucher_table'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^results/$', views.results, name='results'),
]
| {
"content_hash": "07fa710c56f2aaa6ecfba868fa732e45",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 54,
"avg_line_length": 19.9,
"alnum_prop": 0.6482412060301508,
"repo_name": "carlosp420/VoSeq",
"id": "0c950a4f22c9a2c36084aec38878f50a255934ab",
"size": "199",
"binary":... |
import unittest
import os
import comm
import commands
import urllib2
import json
class TestCrosswalkApptoolsFunctions(unittest.TestCase):
def test_target_version(self):
comm.setUp()
comm.clear("org.xwalk.test")
cmd = "which android"
androidpath = commands.getstatusoutput(cmd)
... | {
"content_hash": "e41a81a8d52a9acb31f1707012fd4c37",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 90,
"avg_line_length": 37.785714285714285,
"alnum_prop": 0.6729678638941399,
"repo_name": "pk-sam/crosswalk-test-suite",
"id": "2a97ec654a7bbdbf7adeb03d9a9bc941388d5030",
"... |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 0.5, s, t 1, s, t 1.5, s, t 2.1, s, q"
tags = "FlipAngular3DTransition"
import cocos
from cocos.director import director
from cocos.actions import *
from cocos.layer import *
from cocos.scenes import ... | {
"content_hash": "5640fd1c41ab419f9da7e6b8ea7f1774",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 65,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.6128755364806867,
"repo_name": "shadowmint/nwidget",
"id": "98f52c29332e7e1eee0448bd1fefb33f9ab2e3c1",
"size": "12... |
import htmlmin # html minifier
import slimit # js minifier
import cssutils
import bs4
import urllib2
import urlparse
import wsgiref
def minify(html, base_url='', memcache=None):
m = Minifier(url)
m.memcache = memcache
return m.minify(html, 'text/html')
class WSGIMiddleware:
def __init__(self, app, memcache=None):... | {
"content_hash": "cb51177e03cb59dc8ee001cbeada506d",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 175,
"avg_line_length": 33.02542372881356,
"alnum_prop": 0.6920708237105466,
"repo_name": "nate-parrott/m.py",
"id": "4ac67356af12f9f9c2dc1ba18800fe5725e3fadd",
"size": "3... |
from msrest.serialization import Model
class VirtualMachineScaleSetStorageProfile(Model):
"""Describes a virtual machine scale set storage profile.
:param image_reference: Specifies information about the image to use. You
can specify information about platform images, marketplace images, or
virtual... | {
"content_hash": "7f8f5dc9845e3fa06e745d99eaa0cb9d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 161,
"avg_line_length": 55.6578947368421,
"alnum_prop": 0.7219858156028369,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "eea90cc9e86ea5544b7993a38cb7f95f2536d5df",
"... |
from django.conf.urls import url, include, patterns
from userflow import conf, views
sign_urls = patterns('',
url('^signin/', views.sign.signin.SigninView.as_view(), name='signin'),
url('^signup/', views.sign.signup.SignupView.as_view(), name='signup'),
url('^signout/$', views.sign.signout.SignoutView.as... | {
"content_hash": "8a14bbb3bfaa0c158045288c3a4527bf",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 125,
"avg_line_length": 47.92307692307692,
"alnum_prop": 0.6414125200642055,
"repo_name": "alexey-grom/django-userflow",
"id": "627d970ebe78edb7f93b94de364270ef8f6395e4",
"... |
from __future__ import absolute_import
import os
import nox
@nox.session
def default(session):
return unit(session, 'default')
@nox.session
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
def unit(session, py):
"""Run the unit test suite."""
# Run unit tests against all supported versions of Pyth... | {
"content_hash": "29ef54f92939da126ff22ca80c009f8d",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 77,
"avg_line_length": 29.629032258064516,
"alnum_prop": 0.6456178551986935,
"repo_name": "google/streetview-publish-client-libraries",
"id": "c3504011aaf4a77605a76a7a1cc8348... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
module: oneview_logical_switch_group_facts
short_description: Retrieve facts about OneView Logical Switch Groups.
description:
- Retrieve facts ... | {
"content_hash": "2050de9351340cf14327f104d0a17169",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 99,
"avg_line_length": 27.294117647058822,
"alnum_prop": 0.6770833333333334,
"repo_name": "HewlettPackard/oneview-ansible",
"id": "d9526978797a17e760e5425f67e537f1ae8e24cb",... |
import functools
import typing as t
import click
def user_credential_id_arg(
f: t.Optional[t.Callable] = None, *, metavar: str = "USER_CREDENTIAL_ID"
):
if f is None:
return functools.partial(user_credential_id_arg, metavar=metavar)
return click.argument("user_credential_id", metavar=metavar, typ... | {
"content_hash": "393e66f2fb065d5986ec0d9bfee72a1e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 84,
"avg_line_length": 31.37837837837838,
"alnum_prop": 0.6709732988802756,
"repo_name": "globus/globus-cli",
"id": "e7b79b2039de62316c52d88ee32148b5ec511c9e",
"size": "116... |
"""
File: otp.py
Author: Matthew Cole, Anh Quach, Dan Townley
Date: 11/20/16
"""
import math
import time
import hashlib
import hmac
import base64
"""
Constants specified by RFC 6238
"""
DIGESTS = {"sha1":hashlib.sha1, "sha256":hashlib.sha256, "sha512":hashlib.sha512}
"""
Notations specified by RFC 4226 and RFC 6238... | {
"content_hash": "51d07d7555033dbf78c753b362a3b73b",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 124,
"avg_line_length": 26.82312925170068,
"alnum_prop": 0.6601572406796855,
"repo_name": "colematt/pyOTP",
"id": "f88036ecc16be413ac016bfcf75459c117499c4d",
"size": "3967... |
from maya import cmds
def main():
current = cmds.currentTime(q=True)
min, max = cmds.playbackOptions(q=True,min=True), cmds.playbackOptions(q=True,max=True)
cmds.undoInfo(stateWithoutFlush=False)
if current == max:
cmds.currentTime(min)
else:
cmds.currentTime(current+1)
cmds.undoInfo(stateWithoutFlush=True) | {
"content_hash": "a44ba10c9812230fc49a5a63af551f3b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 88,
"avg_line_length": 29.09090909090909,
"alnum_prop": 0.7625,
"repo_name": "momotarou-zamurai/kibidango",
"id": "0a292eb32e0b7a21ae2d45528cacf575f0a15004",
"size": "703",... |
#!/usr/bin/env python
# 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
# "Li... | {
"content_hash": "b075b87df8fa4964a5351b66b1831775",
"timestamp": "",
"source": "github",
"line_count": 1205,
"max_line_length": 269,
"avg_line_length": 33.47385892116183,
"alnum_prop": 0.6962266957556525,
"repo_name": "resmo/cloudstack",
"id": "43c93c8763160a54a304d833b8b47f0c5cc38ffc",
"size": "4... |
""" py.test dynamic configuration.
For details needed to understand these tests, refer to:
https://pytest.org/
http://pythontesting.net/start-here/
"""
# Copyright © {{ cookiecutter.year }} {{ cookiecutter.full_name }} <{{ cookiecutter.email }}>
#
# Licensed under the Apache License, Version 2.0 (... | {
"content_hash": "e23ac2b8ec5f19983b8d841809fbb33f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 94,
"avg_line_length": 33.903225806451616,
"alnum_prop": 0.7288296860133207,
"repo_name": "1and1/py-generic-project",
"id": "691c4c3633f3f89e88e9d1c0e4a7632c107faaf4",
"siz... |
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from activity.models import Event
@login_required
def event_update(request, content_id, object_id, *args, **kwargs):
content_id = content_id
object_id = object_id
Event.objects.filter(user=request.user,
... | {
"content_hash": "6f80b9e89f2713635dc23a14c112cb4d",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 66,
"avg_line_length": 32.642857142857146,
"alnum_prop": 0.6783369803063457,
"repo_name": "owais/django-simple-activity",
"id": "186b274054af7716f74c3848d6e11476d3c5df27",
... |
import zeit.cms.testing
ZCML_LAYER = zeit.cms.testing.ZCMLLayer(
'ftesting.zcml', product_config=zeit.cms.testing.cms_product_config)
| {
"content_hash": "35a76497a97e8f6ab0652eb4ba2b02fd",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 72,
"avg_line_length": 28,
"alnum_prop": 0.7642857142857142,
"repo_name": "ZeitOnline/zeit.content.text",
"id": "ee36c10effd88117905dc7e0260c592dec7abf26",
"size": "140",
... |
"""
A drop-in replacement for the Mic class that allows for all I/O to occur
over the terminal. Useful for debugging. Unlike with the typical Mic
implementation, Jasper is always active listening with local_mic.
"""
class Mic:
prev = None
def __init__(self, speaker, passive_stt_engine, active_stt_engine):
... | {
"content_hash": "8102f5e4381507578a3219e33a8dda4f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 29.612903225806452,
"alnum_prop": 0.6198257080610022,
"repo_name": "tdmike/SASCHA",
"id": "a58370dad3936c3a3729f7741a5b9d49d2a6abb1",
"size": "941",
... |
"""
Import Redbridge
note: this script takes quite a long time to run
"""
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseCsvStationsCsvAddressesImporter
from data_finder.helpers import geocode_point_only, PostcodeError
class Command(BaseCsvStationsCsvAddressesImporter):
... | {
"content_hash": "e9ecaaec764e138ad774bb560c9bfe28",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 94,
"avg_line_length": 34.535714285714285,
"alnum_prop": 0.5966907962771458,
"repo_name": "chris48s/UK-Polling-Stations",
"id": "edcd767e8da360927908b1405b846509990c5855",
... |
import unittest
from mock import patch
from app.brain.admin.all_data import AllData
from app.constants import USERS_CONSTANTS, TAXONOMY_CONSTANTS, HISTORY_CONSTANTS
class AllDataTests(unittest.TestCase):
@patch('app.service.RepExercisesHistoryService.get_list_of_all_history')
@patch('app.service.RepExercis... | {
"content_hash": "857b94f5f87c8c37562627f49c0a8339",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 80,
"avg_line_length": 34.23076923076923,
"alnum_prop": 0.6853932584269663,
"repo_name": "pbraunstein/trackercise",
"id": "87fa4a5c6b6c654ab4021f5aa16a87ffb7fbfefc",
"size"... |
from toontown.toonbase import ToontownGlobals
ALLOW_TEMP_MINIGAMES = config.GetBool('allow-temp-minigames', False)
TEMP_MG_ID_COUNTER = ToontownGlobals.TravelGameId - 1
TempMgCtors = {}
def _printMessage(message):
print '\n\n!!!', message, '\n\n'
def _registerTempMinigame(name, Class, id, minPlayers = 1, maxPlay... | {
"content_hash": "eaf05922420213529945a1d33cfb4426",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 151,
"avg_line_length": 34.23076923076923,
"alnum_prop": 0.7078651685393258,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "3023993ab78a054cae2006332bd13441dc759ec... |
import itertools
import os
import struct
import json
import errno
from math import isnan
from os.path import isdir, exists, join, dirname, abspath, getsize, getmtime
from glob import glob
from bisect import bisect_left
izip = getattr(itertools, 'izip', zip)
try:
import fcntl
CAN_LOCK = True
except ImportError:
... | {
"content_hash": "d57ed0788131e25f9370883c21a638b2",
"timestamp": "",
"source": "github",
"line_count": 952,
"max_line_length": 100,
"avg_line_length": 32.58298319327731,
"alnum_prop": 0.6658499629259486,
"repo_name": "graphite-project/ceres",
"id": "5a61134864abb17fb347b2dfeecc299c52ad81ed",
"size... |
import proto # type: ignore
from google.ads.googleads.v12.common.types import tag_snippet
from google.ads.googleads.v12.enums.types import (
attribution_model as gage_attribution_model,
)
from google.ads.googleads.v12.enums.types import conversion_action_category
from google.ads.googleads.v12.enums.types import c... | {
"content_hash": "0c437433c4fe75761c76f3c0f2ce0bcc",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 134,
"avg_line_length": 42.420529801324506,
"alnum_prop": 0.6449925844976973,
"repo_name": "googleads/google-ads-python",
"id": "f749a0eea329ece290906336abb8f8de7fe81003",
... |
import os
import argparse
import datetime
import logging
import urlparse
import codecs
import gzip
import pymongo
from logger.ratchet import Local
from logger.accesschecker import AccessChecker
from logger import utils
logger = logging.getLogger(__name__)
COUNTER_COMPLIANT = int(
utils.settings.get('counter_com... | {
"content_hash": "a44c1ce5b34d71e6b0c9dd9374fb7e39",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 132,
"avg_line_length": 31.995283018867923,
"alnum_prop": 0.5532950022114109,
"repo_name": "fabiobatalha/Logger",
"id": "24a799a19644d6eea349a6c280d67a5f46ef1636",
"size":... |
from __future__ import absolute_import, division, print_function, unicode_literals
from guessit.test.guessittest import *
class TestMovie(TestGuessit):
def testMovies(self):
self.checkMinimumFieldsCorrect(filetype='movie',
filename='movies.yaml')
| {
"content_hash": "5739ea8b6019078fc01897c3d4bca5d1",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 82,
"avg_line_length": 33.44444444444444,
"alnum_prop": 0.6644518272425249,
"repo_name": "Kallehz/Python",
"id": "c0e28de420298f1c3f13f9a7e3a6047ac215922f",
"size": "1114",
... |
from os.path import abspath, dirname, join
from tornado.ioloop import IOLoop
from tornado.web import StaticFileHandler
from tornado.websocket import WebSocketHandler, WebSocketClosedError
from .nt_serial import NTSerial
import logging
logger = logging.getLogger("net2js")
__all__ = ["get_handlers", "NetworkTablesWe... | {
"content_hash": "c1134fc3720ce8d851b29eacdb943482",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 83,
"avg_line_length": 28.09375,
"alnum_prop": 0.6218020022246941,
"repo_name": "amorygalili/pynetworktables2js",
"id": "5f9bb3830c3747926c52cefee34e5b6b51d272c6",
"size": ... |
"""
Created on 2017-9-25
@author: cheng.li
"""
import unittest
from collections import deque
import numpy as np
import pandas as pd
from alphamind.execution.pipeline import ExecutionPipeline
from alphamind.execution.targetvolexecutor import TargetVolExecutor
from alphamind.execution.thresholdexecutor import Thresho... | {
"content_hash": "595f214fd85bc9156d1447b020678e0c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 32.58695652173913,
"alnum_prop": 0.6657771847898599,
"repo_name": "wegamekinglc/alpha-mind",
"id": "032e71250da837b302ec44b28b732d0dab23ee54",
"size"... |
"""Convolution methods on CPU."""
# These are extremely slow.
# Their main purpose is testing fast GPU implementations.
import numpy as np
def DivUp(a, b):
return (a + b - 1) / b
def ConvUp(images, filters, image_shape, conv_spec):
num_images, image_size_x, image_size_y, num_input_channels = image_shape
num_ou... | {
"content_hash": "d70505b5b1820f0562a37519e6a53e46",
"timestamp": "",
"source": "github",
"line_count": 593,
"max_line_length": 141,
"avg_line_length": 49.10623946037099,
"alnum_prop": 0.5995535714285715,
"repo_name": "DeercoderResearch/convnet",
"id": "6865600a9c9e6b4487cb5407439b5f66c45eae4c",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('problem', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='code',
name='text',
field=models.... | {
"content_hash": "67d2a3ddf55badbae2ae39e4173b29d8",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 47,
"avg_line_length": 20,
"alnum_prop": 0.5722222222222222,
"repo_name": "afg984/happycoding",
"id": "3d01c0d1244f4aad091be1de29f6ee826c69b60a",
"size": "384",
"binary":... |
import pandas as pd
import numpy as np
class ResponseSet:
# TODO - As currently written this code skips the second row of data,
# because that's what we want to do for Qualtrics csv results, but this is
# potentially a big gotcha, so document well or change.
def __init__(self, response_file, codebook,... | {
"content_hash": "bcfd35388c0e846b5f92ea1160f14ac0",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 109,
"avg_line_length": 43.916666666666664,
"alnum_prop": 0.5411764705882353,
"repo_name": "ctesta01/surveyhelper",
"id": "3aab6ca3e00b105dc70e2ebf7f0065d279440e7c",
"size"... |
import math
from random import choice, randint
import numpy as np
from neupy.network.utils import shuffle
__all__ = ('make_reber', 'is_valid_by_reber', 'make_reber_classification')
avaliable_letters = 'TVPXS'
reber_rules = {
0: [('T', 1), ('V', 2)],
1: [('P', 1), ('T', 3)],
2: [('X', 2), ('V', 4)],
... | {
"content_hash": "21f7e24c3372c0041396b4f37c7d88a0",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 76,
"avg_line_length": 25.607843137254903,
"alnum_prop": 0.5684022460439,
"repo_name": "stczhc/neupy",
"id": "63dbfc09f43da4041140ee30a78e874e91598cd3",
"size": "3943",
... |
from . import views
def register_in(router):
router.register(r'openstacktenant', views.OpenStackServiceViewSet, base_name='openstacktenant')
router.register(r'openstacktenant-service-project-link', views.OpenStackServiceProjectLinkViewSet,
base_name='openstacktenant-spl')
router.regist... | {
"content_hash": "9e6632ae8bb273f3c5d5c43e01dfa8a4",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 116,
"avg_line_length": 80.52380952380952,
"alnum_prop": 0.7794204612655233,
"repo_name": "opennode/nodeconductor-openstack",
"id": "d87d266474b886407a347d03ba094bb0dfbb0689"... |
from pyscf.prop.nmr import rhf
from pyscf.prop.nmr import uhf
from pyscf.prop.nmr import dhf
RHF = rhf.NMR
UHF = uhf.NMR
DHF = dhf.NMR
try:
from pyscf.prop.nmr import rks
from pyscf.prop.nmr import uks
RKS = rks.NMR
UKS = uks.NMR
except ImportError:
pass
| {
"content_hash": "1a1d995c507bd69670aba2ddb082fcbd",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 34,
"avg_line_length": 18.466666666666665,
"alnum_prop": 0.7003610108303249,
"repo_name": "gkc1000/pyscf",
"id": "a2d1cb997d49069557e1e88568cd4643e0869b5f",
"size": "959",
... |
from ciscoconfparse.ciscoconfparse import CiscoConfParse as CCP
from pprint import pprint as pp
with open('cisco_config.txt') as file:
parse = CCP(file)
pp(parse.find_objects(r'crypto map CRYPTO'))
ff_parents = parse.find_objects(r'crypto map CRYPTO')
i = 0
while i < len(parents):
print i
print parents[i... | {
"content_hash": "f5c7e36ed18e80f45e7e195d60f211c3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 63,
"avg_line_length": 22.2,
"alnum_prop": 0.7117117117117117,
"repo_name": "nlinkov/pynet_test",
"id": "6951f9ef3f00d3c8a02313ffc6bb181b3b3a6ef3",
"size": "356",
"binary... |
from flask import Flask, request, render_template
from random import shuffle
app = Flask(__name__)
app.config.update(dict(
DEBUG=True,
))
@app.route('/', methods=['GET', 'POST'])
def root():
if request.method == 'POST':
file = request.files['file']
content = file.stream.read(1024 * 1024)
... | {
"content_hash": "abfa96e30afbca9143d441d5f2d91408",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 49,
"avg_line_length": 23.136363636363637,
"alnum_prop": 0.5854616895874263,
"repo_name": "EUDAT-DLC/Shuffler",
"id": "10273872438a8619dc4292a7e5db9813b6a2788d",
"size": "5... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.redirectAppointment),
url(r'^view/$', views.viewAppointment, name='view'),
url(r'^schedule/$', views.scheduleAppointment, name='schedule'),
url(r'^doccreate/$', views.scheduleDoctor, name='scheduleDoctor'),
url(... | {
"content_hash": "f0f9507fd921cbb98b07207100c849bb",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 110,
"avg_line_length": 38.3,
"alnum_prop": 0.6566579634464752,
"repo_name": "blackpan2/HealthNet",
"id": "ad486149f389557bb376ba203af7a5c335f606bc",
"size": "766",
"bina... |
class AcquirerStatusResponse( object ):
"""
This class contains all necessary data that can be returned from a iDEAL AcquirerTrxRequest.
"""
def __init__( self ):
self.acquirerID = ''
self.consumerName = ''
self.consumerAccountNumber = ''
self.consumerCity = ''
self.transactionID = ''
self.status = ... | {
"content_hash": "36ad366cff2f556c056915e40a6c8f8d",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 94,
"avg_line_length": 22.402298850574713,
"alnum_prop": 0.698306824012314,
"repo_name": "wyleung/python-ideal",
"id": "6a3bc03a69a5c5374ffeacece2ac63c4a215acbb",
"size": "... |
"""
An http client that can make requests similar to how the google checkout
bot when it implements the notification api, version 2.5
"""
from django.test.client import Client
class GCClient(Client):
def post_notification(self, path, raw_post_data):
"""
Post a notificaiton similar to how google ch... | {
"content_hash": "22f4aa19f5002e8094defeb76cc6098b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 34.714285714285715,
"alnum_prop": 0.6954732510288066,
"repo_name": "mfogel/django-npo-google-checkout",
"id": "15585f29d9aa57dda056a0ef686442e90f272d17... |
import asyncio
import inspect
import json
import logging
import time
from collections import defaultdict
from aiohttp.web import Response
from sirbot.core import registry
from sirbot.utils import ensure_future
from .dispatcher import SlackDispatcher
from .. import database
logger = logging.getLogger(__name__)
IGNO... | {
"content_hash": "c4b39c8a4122f00c04944e62068bf24f",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 77,
"avg_line_length": 29.751824817518248,
"alnum_prop": 0.5525024533856723,
"repo_name": "pyslackers/sirbot-slack",
"id": "f2f71d97ca660c43461a36bf73a1b04e90fbe5eb",
"siz... |
from socket import *
from time import sleep
host = '10.0.0.41'
port = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
clientSocket.sendto('plex', (host, port))
message, address = clientSocket.recvfrom(1024)
print message
clientSocket.close()
| {
"content_hash": "4bdcf661034603eb3df3fe37d4ba530f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 46,
"avg_line_length": 19.071428571428573,
"alnum_prop": 0.6891385767790262,
"repo_name": "KevinMidboe/statusHandler",
"id": "7bfc2344f068b2bda671b4181ef6383f95eea5d0",
"si... |
import pytest
from django.core.exceptions import ValidationError
from ...core.notification.validation import validate_and_get_channel
from ...graphql.notifications.error_codes import ExternalNotificationErrorCodes
def test_validate_and_get_channel_for_non_existing_slug():
with pytest.raises(ValidationError):
... | {
"content_hash": "a4ce3980d314b4ffd37d3557eb8a0d84",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 79,
"avg_line_length": 33.05882352941177,
"alnum_prop": 0.7259786476868327,
"repo_name": "mociepka/saleor",
"id": "3718a146c07ca43f14abe41619db8e305811a566",
"size": "1124"... |
"""Crypto-Balances
Usage:
run.py [(address [(--add|--remove) <address_type> <address>...])]
[(exclusion [(--add|--remove) <asset>...])]
[base <currency> [--precision <n>]]
[-m --minimum <balance>]
[-i --itemize]
Options:
-h --help Show this screen
-v --version ... | {
"content_hash": "8ac90193661bb9460439a5dab34aed7c",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 76,
"avg_line_length": 31.154929577464788,
"alnum_prop": 0.5976491862567812,
"repo_name": "evanhenri/Crypto-Balances",
"id": "480a7a64e70a16f328e72d2e6c01eafa8d18fc88",
"si... |
"""
Parser for silme-compatible translation formats.
"""
import codecs
import silme
from collections import OrderedDict
from copy import copy
from silme.format.dtd import FormatParser as DTDParser
from silme.format.ini import FormatParser as IniParser
from silme.format.inc import FormatParser as IncParser
from silme.... | {
"content_hash": "88cb3cae968384e15f44844812832acc",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 87,
"avg_line_length": 32.26119402985075,
"alnum_prop": 0.5874392782789729,
"repo_name": "jotes/pontoon",
"id": "ac54ecfeb07282e12c7639c69c3c3708c334722b",
"size": "8646",... |
class ReferService(object):
u"""マージリクエスト参照サービス"""
def __init__(self):
from git_lab.apis.mergerequest.repositories import MergeRequestRepository
self.repo = MergeRequestRepository()
def show_merge_request(self, req_id):
u"""指定IDのマージリクエストを表示します
@param req_id : マージリクエストのID
... | {
"content_hash": "42e65fc500ea142ddfb7d831cd6c4783",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 113,
"avg_line_length": 32.331428571428575,
"alnum_prop": 0.4931071049840933,
"repo_name": "kamekoopa/git-lab",
"id": "9014171b530545bbd499c55f7fac1b44cba34f29",
"size": "... |
from setuptools import setup, find_packages, Command
class PyTest(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys,subprocess
errno = subprocess.call([sys.executable, 'runtests.py', 'tests'])
... | {
"content_hash": "a848163735f19a13d841815f92b9cbbb",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 114,
"avg_line_length": 33.01587301587302,
"alnum_prop": 0.5759615384615384,
"repo_name": "MiCHiLU/jinja2-precompiler",
"id": "00d0740f160274fe1d33d9a0a3cc3d4ec189d55c",
"s... |
"""FMCS - Find Maximum Common Substructure
This software finds the maximum common substructure of a set of
structures and reports it as a SMARTS strings.
This implements what I think is a new algorithm for the MCS problem.
The core description is:
best_substructure = None
pick one structure as the query, and oth... | {
"content_hash": "5787c4c86841106d868ef407a155465e",
"timestamp": "",
"source": "github",
"line_count": 2765,
"max_line_length": 134,
"avg_line_length": 37.65461121157324,
"alnum_prop": 0.6784613168131394,
"repo_name": "jandom/rdkit",
"id": "e1a7b15001761571cd77622b11c2aa0c63e81bdb",
"size": "10569... |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="x", parent_name="layout.scene.camera.up", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... | {
"content_hash": "e379e4a7a8ed1f6513225c9023482f61",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 88,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6,
"repo_name": "plotly/python-api",
"id": "5a5b79998ed7e7542d4a8d3ed7169d4088a11b64",
"size": "440",
"binary":... |
import os, sys, hashlib
# Reproduce this output with slashes consistent for Windows systems
#ba2812a436909554688154be461d976c A\SEC575-Clown-Chat\nvram
# Optimized for low-memory systems, read whole file with blocksize=0
def md5sum(filename, blocksize=65536):
hash = hashlib.md5()
with open(filename, "rb") as... | {
"content_hash": "c27c026bfd97e6982b7db8e2d8daf03d",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 152,
"avg_line_length": 33.88135593220339,
"alnum_prop": 0.5795397698849425,
"repo_name": "joswr1ght/md5deep",
"id": "75051fb2331190beaf5c1cd8670161962153e9d7",
"size": "4... |
import re
from utils.cache import cache
@cache(use_mem=True,use_file=True)
def text_to_segment_list(text):
'''
分词 将文本转换成单词list
:param text:
:return:
'''
return re.split('[^a-z]+', text.lower()) if text else []
| {
"content_hash": "a774e5300242f6f5b1d9b2ae7d57912b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 60,
"avg_line_length": 21.363636363636363,
"alnum_prop": 0.6212765957446809,
"repo_name": "DannyLee1991/article_cosine_similarity",
"id": "e33712a831eaca91e802cb2dd4e46c6ff9a... |
"""Moira lists app"""
from django.apps import AppConfig
class MoiraListsConfig(AppConfig):
"""MoiraLists AppConfig"""
name = "moira_lists"
| {
"content_hash": "fe9230f0493bbd2a9a792dadffdedc0b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 34,
"avg_line_length": 18.75,
"alnum_prop": 0.7,
"repo_name": "mitodl/open-discussions",
"id": "f0bf80700877eda481c183d58c3d91fe114a1fdc",
"size": "150",
"binary": false,
... |
from awsutils.exceptions.aws import AWSException
class SDBException(AWSException):
pass
class AccessFailure(SDBException):
#Access to the resource is denied
HTTP_STATUS = 403
class AttributeDoesNotExist(SDBException):
#Attribute does not exist
HTTP_STATUS = 404
class AuthFailure(SDBException):
... | {
"content_hash": "c2933648a86d0a5b488d204d0ccea5be",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 107,
"avg_line_length": 33.371428571428574,
"alnum_prop": 0.716466894977169,
"repo_name": "sanyi/awsutils",
"id": "26f684dacda9648ccc7dc594f2b1cb908b0ea8b8",
"size": "7213... |
from __future__ import unicode_literals
# Third Party Stuff
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('proposals', '0008_auto_20150528_2243'),
]... | {
"content_hash": "23627037688b0fc5dbaf5992151392a1",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 192,
"avg_line_length": 43.76315789473684,
"alnum_prop": 0.6259771497294047,
"repo_name": "ChillarAnand/junction",
"id": "192fbfc7fefa12d32e354684b63feb4faf489ed7",
"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('.'))
# -- General configurat... | {
"content_hash": "69bd85224fa1771fd1473cb6f80aa0de",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 80,
"avg_line_length": 32.17467248908297,
"alnum_prop": 0.7027687296416938,
"repo_name": "brandonw/personal-site",
"id": "24950d04ae6b1a7b637c1b2b75fcab882162e618",
"size"... |
"""
@authors: Sergei Garbuzov
@status: Development
@version: 1.1.0
"""
import time
import json
from pybvc.controller.controller import Controller
from pybvc.openflowdev.ofswitch import (OFSwitch,
FlowEntry,
Instruction,
... | {
"content_hash": "ad07108936d3f734e32fabe1b0d87b3e",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 73,
"avg_line_length": 34.10526315789474,
"alnum_prop": 0.5026234567901234,
"repo_name": "s-garbuzov/pybvc",
"id": "d12d1c9083c27229eb57444b0483ecdb2f497439",
"size": "805... |
"""
Usage:
./rtail.py user@host:path/foo.log bar.log host2:/path/baz.log
"""
import optparse
import os
import re
import select
import subprocess
import sys
def main():
op = optparse.OptionParser()
op.add_option("-i", "--identity", dest="identity")
options, args = op.parse_args()
streams = list()
... | {
"content_hash": "24913374f7feac31e3dfcff1f8f0dc4a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 122,
"avg_line_length": 31.836363636363636,
"alnum_prop": 0.48715019988577957,
"repo_name": "samuelclay/NewsBlur",
"id": "c2f5854b1aba0f3fb227a326fe4d2c43788cbc90",
"size":... |
"""
@name: PyHouse/src/Certificates/newcert.py
@author: D. Brian Kimmel
@contact: [email protected]
@copyright: (c) 2015-2019 by D. Brian Kimmel
@note: Created on Feb 24, 2015
@license: MIT License
@summary:
For posterity, you'll first need to generate a few client certificates all signed ... | {
"content_hash": "fa7ca875a5f7e363945bfdc58ececcb9",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 102,
"avg_line_length": 34.3,
"alnum_prop": 0.6997084548104956,
"repo_name": "DBrianKimmel/PyHouse",
"id": "dc4bf6be7d06649fb817c41df1487ef05d6e8e48",
"size": "1715",
"bi... |
import unicodecsv
from kvtags.models import *
def import_tags_csv(csv_file):
"""Imports tags from a csv file to the database.
A file instance must be provided as an argument.
File must be opened beforehand.
The first row is for tag key.
The second row is for keys of key-value pairs
Subsequen... | {
"content_hash": "4f9abd768a50ecf676a21ef179e5b348",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 81,
"avg_line_length": 25.9375,
"alnum_prop": 0.653012048192771,
"repo_name": "ozen/django-kvtags",
"id": "388d6186477c378448834fbafac13ba65c61d5ae",
"size": "830",
"bina... |
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.25
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubernete... | {
"content_hash": "105a603e1a947cf63707ee49c3701c20",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 366,
"avg_line_length": 37.00995024875622,
"alnum_prop": 0.6361070036295201,
"repo_name": "kubernetes-client/python",
"id": "0e141795f91a5e2f71e50ed4b551e7d8018667a4",
"si... |
"""
Created on Wed Dec 9 21:31:53 2015
Create random synthetic velocity profile + linear first guesses
@author: alex
"""
import random
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
r"""Smooth (and optionall... | {
"content_hash": "cb2b0d90204d33be0c43ce618f160a37",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 89,
"avg_line_length": 33.12807881773399,
"alnum_prop": 0.6511524163568774,
"repo_name": "bottero/IMCMCrun",
"id": "038be167da31531251f298959cfc70941f40266f",
"size": "674... |
import io
import os
from absl.testing import absltest
from absl.testing import flagsaver
import requests
from grr_api_client import errors as api_errors
import grr_colab
from grr_colab import _api
from grr_colab import errors
from grr_colab import testing
from grr_colab import vfs
from grr_response_core.lib.util imp... | {
"content_hash": "011273364f27c83c2742f51d577f5a51",
"timestamp": "",
"source": "github",
"line_count": 737,
"max_line_length": 77,
"avg_line_length": 31.51696065128901,
"alnum_prop": 0.6654468744618564,
"repo_name": "google/grr",
"id": "7332565e2d83501d4b889bca0712a729213f5645",
"size": "23250",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import cv2
import numpy as np
import json
import copy
import pycocotools
from pycocotools.coco import COCO
from .dataset import DetDataset
from lib.utils.workspace import register, serializable
__all... | {
"content_hash": "068d90318a6b90ddd08290420ecf09a7",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 80,
"avg_line_length": 33.63740458015267,
"alnum_prop": 0.505957108816521,
"repo_name": "PaddlePaddle/models",
"id": "42991a6f4ec67d6d3d9b38bc159ab379c02fa706",
"size": "9... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem035.py
#
# Circular primes
# ===============
# Published on Friday, 17th January 2003, 06:00 pm
#
# The number, 197, is called a circular prime because all rotations of the
# digits: 197, 971, and 719, are themselves prime. There are thirteen such
# primes below... | {
"content_hash": "6956204197b0af55e73c352745489ef6",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 78,
"avg_line_length": 25.88372093023256,
"alnum_prop": 0.5911949685534591,
"repo_name": "olduvaihand/ProjectEuler",
"id": "3ce4a85172f116f3fed6175badc1f9d3100a7f30",
"size... |
import mock
from networking_nec.tests.unit.nwa.nwalib import test_client
TENANT_ID = 'OpenT9004'
DC_RESOURCE_GROUP_POD1 = 'OpenStack/DC1/Common/Pod1Grp/Pod1'
DC_RESOURCE_GROUP_APP1 = 'OpenStack/DC1/Common/App1Grp/App1'
class TestNwaClientTenant(test_client.TestNwaClientBase):
def test_create_tenant(self):
... | {
"content_hash": "9704dbe99a9f93ba0ba855ca2d9521a4",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 40.95348837209303,
"alnum_prop": 0.653038046564452,
"repo_name": "openstack/networking-nec",
"id": "c2b3e285de744f2e83a6586ea27098a228d2a7da",
"size"... |
try:
from django.db import models
django_loaded = True
except ImportError:
django_loaded = False
if django_loaded:
from semantic_version import django_fields as semver_fields
class VersionModel(models.Model):
version = semver_fields.VersionField(verbose_name='my version')
spec = s... | {
"content_hash": "dd7947bdc810f112bd93593ec7ed66df",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 103,
"avg_line_length": 45,
"alnum_prop": 0.7236714975845411,
"repo_name": "rbarrois/python-semanticversion",
"id": "5f790b43c21ed606451578c906a0b86d4fef8111",
"size": "111... |
from __future__ import absolute_import
import numpy as np
import cv2
import random
import copy
from . import data_augment
import threading
import itertools
def union(au, bu, area_intersection):
area_a = (au[2] - au[0]) * (au[3] - au[1])
area_b = (bu[2] - bu[0]) * (bu[3] - bu[1])
area_union = area_a + area_b - area... | {
"content_hash": "12bda3f1b2d5ef0d63bd38e0b3f0fbd9",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 137,
"avg_line_length": 35.486646884273,
"alnum_prop": 0.6355882598879505,
"repo_name": "alexcu/hermes-bib-detect",
"id": "3551b8c8157341947bff1072b1eed876716af7c0",
"size... |
"""Sparse categorical cross-entropy losses."""
from __future__ import absolute_import
from __future__ import division
# from __future__ import google_type_annotations
from __future__ import print_function
import tensorflow as tf
def _adjust_labels(labels, predictions):
"""Adjust the 'labels' tensor by squeezing i... | {
"content_hash": "78f85fb845ff11ddd4870d2413c44538",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 79,
"avg_line_length": 39.01086956521739,
"alnum_prop": 0.7152410142100863,
"repo_name": "alexgorban/models",
"id": "b88d8e3665b70be63aaa4aa2f90bb78e4bd9af3f",
"size": "427... |
import json
import aiohttp
from asyncio import coroutine
from ...ut.async_request import request
from .base import Base
class Env(Base):
def __init__(self, id):
super(Env, self).__init__()
self.uri = uri(id)
@coroutine
def read(self, name):
return (yield from self.meta)['files'][... | {
"content_hash": "846112a18abfbf851d2e70010716cfb7",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 79,
"avg_line_length": 24.129032258064516,
"alnum_prop": 0.5775401069518716,
"repo_name": "Answeror/torabot",
"id": "50c61e9a09609d2c7031de1dda38d0472e995b55",
"size": "748... |
"""
rx320 tcp/ip server
:copyright: (c) 2013 by Tom van Dijk
:license: BSD, see LICENSE for more details.
"""
from rx320 import RX320
import socket
import threading
class RX320Connection(threading.Thread):
def __init__(self, connection, controller, *args, **kwargs):
super(RX320Connection,self).__init__(*ar... | {
"content_hash": "ba5c18434312617675f29b0e11d215e9",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 76,
"avg_line_length": 34.13548387096774,
"alnum_prop": 0.5407295407295407,
"repo_name": "trolando/python-rx320",
"id": "e3057ae9d1f9a7112e6bfe913c06502ff05f27a0",
"size":... |
from django.contrib import admin
from codefisher_apps.pastelsvg.models import Icon, PastelSVGDonation, ProtectedDownload, IconRequest, IconRequestComment, UseExample
from django.conf import settings
from upvotes.admin import RequestAdmin, RequestCommentAdmin
admin.site.register(IconRequest, RequestAdmin)
admin.site.r... | {
"content_hash": "880fcac2f0648e3ec3261801e664a90e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 132,
"avg_line_length": 40.02439024390244,
"alnum_prop": 0.7074954296160878,
"repo_name": "codefisher/codefisher_apps",
"id": "e4abc8906609290b2ebf4a321a0edfd5071ad893",
"s... |
"""Parsing module """
import logging
import os
import uuid
# noinspection PyPep8Naming
import xml.etree.ElementTree as ET
# noinspection PyPackageRequirements
from typing import Dict, List, Type
from airflow.utils.trigger_rule import TriggerRule
from o2a.converter.constants import HDFS_FOLDER
from o2a.converter.ooz... | {
"content_hash": "22ff3bc0312fe742ec412db28bd8d272",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 110,
"avg_line_length": 37.40338983050847,
"alnum_prop": 0.6262461482689867,
"repo_name": "GoogleCloudPlatform/oozie-to-airflow",
"id": "103c2f019edb9307fc82d6f317d04ecb6036... |
import os
import sys
from base64 import b64encode
from functools import wraps
from getpass import getpass
from subprocess import Popen
import peewee
import argh
from argh.decorators import aliases, arg
from tmc import conf
from tmc import api
from tmc.errors import (APIError, NoCourseSelected, NoExerciseSelected,
... | {
"content_hash": "3a4bb159677057b2f1d8dd7db8d66c66",
"timestamp": "",
"source": "github",
"line_count": 584,
"max_line_length": 79,
"avg_line_length": 31.46232876712329,
"alnum_prop": 0.5495809295743986,
"repo_name": "JuhaniImberg/tmc.py",
"id": "bf9ad5360038eb786c65a275b06ffb837ecc833d",
"size": "... |
try:
try:
from neutronclient.neutron import client
except ImportError:
from quantumclient.quantum import client
from keystoneclient.v2_0 import client as ksclient
HAVE_DEPS = True
except ImportError:
HAVE_DEPS = False
ANSIBLE_METADATA = {'status': ['deprecated'],
... | {
"content_hash": "746ed2090138b11aaa81820a7cc36619",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 122,
"avg_line_length": 32.239837398373986,
"alnum_prop": 0.6174505106543942,
"repo_name": "nwiizo/workspace_2017",
"id": "b2a1784d99a1c7c29a5aefd747e1064d70eab375",
"size... |
import importlib
import pkgutil
from flask import Blueprint
def register_blueprints(app, package_name, package_path):
"""Register all Blueprint found in the modules for the specified package.
:param app: the Flask application
:param package_name: the package name
:param package_path: the package pat... | {
"content_hash": "874f62cf16ebdb90a90b222cef4b0342",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 30.136363636363637,
"alnum_prop": 0.6349924585218703,
"repo_name": "kyouko-taiga/mushi",
"id": "6dfd3a99a5d1cca0571a060667f396fe8dd92552",
"size": "1... |
from custom_labels_csv_to_manifest import check_duplicates, create_manifest_file
from os.path import exists
from os import remove
from os import path
import pytest
"""
Unit tests for custom_labels_csv_to_manifest.py.
"""
def clean_up(*argv):
"""
Deletes supplied files, if they exist.
Removes any previous ... | {
"content_hash": "0e5bc546858990e8391d0b2aaae804ee",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 81,
"avg_line_length": 29,
"alnum_prop": 0.6660617059891107,
"repo_name": "awsdocs/aws-doc-sdk-examples",
"id": "367ad1a1964baf1279c46978fada2d756673529a",
"size": "3857",... |
from project import create_app, logger, db
from flask_script import Manager
import coverage
import unittest
logger.info('Server has started.')
COV = coverage.coverage(
branch=True,
include='project/*',
omit=[
'tests/*',
'project/website/*',
'project/__init__.py'
]
)
COV.start()... | {
"content_hash": "4b286485bb2ddf211cd54bc0d54d15bc",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 78,
"avg_line_length": 21.256756756756758,
"alnum_prop": 0.6382708200890019,
"repo_name": "Radu-Raicea/Stock-Analyzer",
"id": "d644da82799a25bf15daee675d98331e89c72332",
"s... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='VirtualMachine',
fields=[
('id', models.AutoField(verbose_name='ID', se... | {
"content_hash": "c0cf86c963048c833730485375a6f2a5",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 29.64,
"alnum_prop": 0.5492577597840755,
"repo_name": "arnaudmorin/instantserver",
"id": "be36d0e1a6eb0057c029f662ebd00d182dd3774d",
"size": "765",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.