text stringlengths 4 1.02M | meta dict |
|---|---|
import pytest
pytest.importorskip("kick")
from ansible.module_utils.network.ftd.device import FtdPlatformFactory, FtdModel, FtdAsa5500xPlatform, \
Ftd2100Platform, AbstractFtdPlatform
from units.modules.network.ftd.test_ftd_install import DEFAULT_MODULE_PARAMS
class TestFtdModel(object):
def test_has_value... | {
"content_hash": "28d75386aa717d05601833be9a99d43f",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 109,
"avg_line_length": 42.94488188976378,
"alnum_prop": 0.7207554088742207,
"repo_name": "thaim/ansible",
"id": "3cbe0d61da727aa16177a82c2d2190c8d653a381",
"size": "6161"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings_content_gfk")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "135c2b7dca1757f33d32525c82d93e69",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.7112068965517241,
"repo_name": "Eksmo/django-tastypie",
"id": "5daae21df878568bd9b98e780dca7b1911957306",
"size": "... |
import os
import sys
from fabric.api import env, run, cd
DEPLOYMENTS = {
'prod': {
'home': '/var/www/',
'host_string': 'bamboo@bamboo.io',
'virtual_env': 'bamboo',
'repo_name': 'current',
'project': 'bamboo',
'docs': 'docs',
'branc... | {
"content_hash": "9f46112f4ff7127917e423eddf12b908",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 31.04225352112676,
"alnum_prop": 0.5893829401088929,
"repo_name": "pld/bamboo",
"id": "76c1f2457d59c6e147c8f221fcd0c7a23ec109a5",
"size": "2204",
"... |
import os.path
# Test import of same modules from different packages
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
import pkg2.foo
print " Finished importing pkg2.foo"
var2 = pkg2.foo.Pkg2_Foo()
if str... | {
"content_hash": "34dc99c2d768f16cb453d2c0a2dba891",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 37.76923076923077,
"alnum_prop": 0.6985743380855397,
"repo_name": "DEKHTIARJonathan/BilletterieUTC",
"id": "2107597b3bf72827dda36b86157e144edb2e6587",
... |
"""
Tests and Confidence Intervals for Binomial Proportions
Created on Fri Mar 01 00:23:07 2013
Author: Josef Perktold
License: BSD-3
"""
from statsmodels.compat.python import lzip
from typing import Callable, Tuple
import numpy as np
import pandas as pd
from scipy import optimize, stats
from statsmodels.stats.base... | {
"content_hash": "2b2b6bf38180f9f104c856700e8284d1",
"timestamp": "",
"source": "github",
"line_count": 2333,
"max_line_length": 83,
"avg_line_length": 36.56150878696957,
"alnum_prop": 0.5724518746043283,
"repo_name": "josef-pkt/statsmodels",
"id": "25528204e8a20b75a801c86a1fbd141d42477932",
"size"... |
from test_plus.test import TestCase
class TestUser(TestCase):
def setUp(self):
self.user = self.make_user()
def test__str__(self):
self.assertEqual(
self.user.__str__(),
"testuser" # This is the default username for self.make_user()
)
def test_get_absolu... | {
"content_hash": "67ce7fe3657e38bf857e8577fddc6092",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 23.263157894736842,
"alnum_prop": 0.5542986425339367,
"repo_name": "pkom/gestionies",
"id": "30065868ea2430e5b28198d20822ed345757e403",
"size": "442"... |
import copy
def merge(dbag, data):
""" Simply overwrite the existsing bag as, the whole configuration is sent every time """
if "rules" not in data:
return dbag
dbag['config'] = data['rules']
return dbag
| {
"content_hash": "667380d51eaa9aade2317d66a11529aa",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 93,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.6478260869565218,
"repo_name": "wido/cloudstack",
"id": "777130974b04194305503e57bd53bd048911be44",
"size": "1016"... |
import mock
from boto.exception import BotoServerError
from boto.route53.connection import Route53Connection
from boto.route53.exception import DNSServerError
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
class TestRoute53Connection(AWSMockServiceTestCase):
connection_class = Rou... | {
"content_hash": "0fff7e87606926e02598ec1bfe9bd566",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 68,
"avg_line_length": 28.822580645161292,
"alnum_prop": 0.6284275321768327,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "3141dd1744a98712a616a05ee3aabd64d75023c4",
"size"... |
"""The virtual interfaces extension."""
import webob
from jacket.api.compute.openstack import api_version_request
from jacket.api.compute.openstack import common
from jacket.api.compute.openstack import extensions
from jacket.api.compute.openstack import wsgi
from jacket.compute import cloud
from jacket.i18n import _... | {
"content_hash": "be80359538c84bc2adc334a0ad9526cf",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 32.98795180722892,
"alnum_prop": 0.6566837107377648,
"repo_name": "HybridF5/jacket",
"id": "da51d92a00453540db40f70afd2e5f47e4d212a4",
"size": "3369"... |
import typing
import numpy as np
from .unit import Unit
class FixedLength(Unit):
"""
FixedLengthUnit Class.
Process unit to get the fixed length text.
Examples:
>>> from matchzoo.preprocessors.units import FixedLength
>>> fixedlen = FixedLength(3)
>>> fixedlen.transform(lis... | {
"content_hash": "0380adb17f122ffa3aaa54eb303ccf4a",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 77,
"avg_line_length": 32.45569620253165,
"alnum_prop": 0.5522620904836193,
"repo_name": "faneshion/MatchZoo",
"id": "d1425f031e48688fe5867f86de769dbf4779b033",
"size": "25... |
from collections import OrderedDict
import copy
from netman.core.objects.bond import Bond
from netman.core.objects.interface import Interface
from netman.core.objects.port_modes import ACCESS, TRUNK
from netman.core.objects.switch_base import SwitchBase
from netman.core.objects.vlan import Vlan
from netman.core.object... | {
"content_hash": "471402993bfe25164407de32fc59a773",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 80,
"avg_line_length": 38.06363636363636,
"alnum_prop": 0.6509035904784651,
"repo_name": "mat128/netman",
"id": "d074ac14f6940a83dbd54724b0359ef206620714",
"size": "13135"... |
import sys
import os
from harvester.post_processing.couchdb_runner import CouchDBJobEnqueue
from harvester.post_processing.couchdb_runner import CouchDBWorker
from harvester.image_harvest import harvest_image_for_doc
from harvester.couchdb_init import get_couchdb
import couchdb #couchdb-python
from dplaingestion.selec... | {
"content_hash": "1d6261fe63227cb2f85025e4648fe58c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 32.41025641025641,
"alnum_prop": 0.6091772151898734,
"repo_name": "mredar/harvester",
"id": "5f6554bb50d24af394ff2f715161d12ca0b0908a",
"size": "1283... |
from markdown.util import AtomicString
from markdown.util import etree
from markdown.inlinepatterns import Pattern
from markdown import Extension
class MathJaxPattern(Pattern):
groups = 2, 3, 4
start_end = None
def __init__ (self, start_end=None, groups=None):
if start_end is not None:
... | {
"content_hash": "ed066a528e2fb199faa71f49456c5159",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 88,
"avg_line_length": 33.083333333333336,
"alnum_prop": 0.6202770780856424,
"repo_name": "epsilony/md_mathjax",
"id": "4047918a50a34a603b5f912497311b4359f209cc",
"size": "... |
import sys
def add(x, y): return x + y
def sub(x, y): return x - y
def mult(x, y): return x * y
OPERATIONS = [add, sub, mult]
REPRESENTATIONS = {add: '+', sub: '-', mult: '*'}
def new_counter(counter, item):
if counter is None: counter = 0
if type(item) == type(add): return counter - 1
else: return counter + 1
... | {
"content_hash": "a7e9384cb2ffa0cbc9d6266941d214e3",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 89,
"avg_line_length": 26.227848101265824,
"alnum_prop": 0.6013513513513513,
"repo_name": "seanhess/contests",
"id": "936348ff26d96b5094fc24972fd6db51e718a00f",
"size": "20... |
'''
*
* VTN-based RTM Network Service
*
* file: \rtm-api\api\v1_0\policies.py
*
* This software contributed by NEC under Apache 2.0 license for open source use. This software is supplied under the terms of the OpenSourceSDN Apache 2.0 license agreement
* Copyright (c) 2015 NEC Europe Ltd.
*
* Aut... | {
"content_hash": "a29211af705d436a8c79b28aa819f6c7",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 173,
"avg_line_length": 35.72,
"alnum_prop": 0.7254199328107502,
"repo_name": "OpenNetworkingFoundation/ASPEN-Real-Time-Media-Interface",
"id": "8cbdda443c4ca213d96ee640cf32... |
from src.base import Template, Collector
__version__ = '0.1' | {
"content_hash": "2b53def220bf90fb74006e0861773219",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 40,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.7049180327868853,
"repo_name": "smirnoval/simple-template-engine",
"id": "14ea18ad35bc3b01afddaf75bdcb7ca87ca7cbef",... |
import os.path
import shutil
import click
from .movie import find_likely_movie, cleanup_filename
from .config import Settings, update_settings
def misnamer(in_file):
"""Main misnamer function. Process movie files.
"""
directory, filename = os.path.split(in_file)
_, extension = os.path.splitext(filena... | {
"content_hash": "4feb288a8ab4ab6bd37d650059eda98c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 77,
"avg_line_length": 32.38297872340426,
"alnum_prop": 0.6872536136662286,
"repo_name": "ygreenc/misnamer",
"id": "72710697a9ed41990f4e90a80686e093ec073076",
"size": "1545... |
import asyncio
def f(lock):
yield from lock.acquire()
try:
yield from asyncio.sleep(0.1)
finally:
lock.release()
loop = asyncio.get_event_loop()
lock = asyncio.Lock()
print('pass 1')
loop.run_until_complete(f(lock))
def g(lock):
with (yield from lock):
yield from asyncio.s... | {
"content_hash": "590317505f6f4e9f352e98c041a08f3c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 37,
"avg_line_length": 15.24,
"alnum_prop": 0.6325459317585301,
"repo_name": "asvetlov/europython2015",
"id": "10c8ed2f2a7f0950f1e3fb4e6cc3191ce47ddfd6",
"size": "381",
"... |
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from functools import partial
from hashlib import md5
from operator import attrgetter
import pickle
import os
import uuid
from toolz import merge, groupby, curry, identity
from toolz.functoolz import Compose
from .co... | {
"content_hash": "94c36d3a2eb3905c5c520699df6dd99f",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 90,
"avg_line_length": 33.163636363636364,
"alnum_prop": 0.59406328320802,
"repo_name": "gameduell/dask",
"id": "2f24db9006df15406ed6df42bcae5d6b858134b3",
"size": "12768"... |
import re
import json
import jinja2
import regex
def parse(lines, hilight_words, filters, objref_dict):
"""
Given filters returns indeces of wanted lines from log
Args:
lines: array of log lines
hilight_words: array of words that need to be bolded
filters: dictionary of which fil... | {
"content_hash": "1dca16d567ee1aa1a67ad374cd9f1a96",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 80,
"avg_line_length": 33.298507462686565,
"alnum_prop": 0.6230389959659346,
"repo_name": "girishkalele/test-infra",
"id": "2a0ca934b62337e9e9153885f73d7452b8aa92a4",
"size... |
import sys
from collections import OrderedDict
try:
from PyQt4 import QtGui, QtCore
qt_widgets = QtGui
except ImportError:
from PyQt5 import QtCore, QtGui
from PyQt5 import QtWidgets as qt_widgets
if sys.version_info >= (3,):
unicode = str
class MultipleFieldsDialog(qt_widgets.QDialog):
"""Di... | {
"content_hash": "090c72bade3f722075564872adc64709",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 77,
"avg_line_length": 34.1625,
"alnum_prop": 0.6121478229052324,
"repo_name": "aroberge/easygui_qt",
"id": "b5b96bdb2d916143a221dea1371653464dd6c302",
"size": "2733",
"b... |
import os,os.path
import re,time,copy,string,math,random,fcntl
import traceback
from glideinwms.lib import xmlFormat,timeConversion
from glideinwms.lib import rrdSupport
from glideinwms.lib import logSupport
############################################################
#
# Configuration
#
###############################... | {
"content_hash": "466a10f70924210c5b2642d4b0f7cd5b",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 163,
"avg_line_length": 38.09763313609467,
"alnum_prop": 0.5031063135823561,
"repo_name": "bbockelm/glideinWMS",
"id": "6d8254c191b6246b008aef607515820c7a896062",
"size": ... |
"""Example DAG demonstrating the DummyOperator and a custom DummySkipOperator which skips by default."""
import airflow
from airflow.exceptions import AirflowSkipException
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
args = {
'owner': 'Airflow',
'start_date': airfl... | {
"content_hash": "546660f762e2b61bc8ecc034bb76e06d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 104,
"avg_line_length": 32.52272727272727,
"alnum_prop": 0.7120894479385046,
"repo_name": "Fokko/incubator-airflow",
"id": "205cd7a6404f1bd7e7f31e1027fe518fdc339aa0",
"size... |
import sys
import numpy as np
import warnings
if sys.version > '3':
xrange = range
basestring = str
from pyspark import SparkContext
from pyspark.mllib.common import callMLlibFunc, inherit_doc
from pyspark.mllib.linalg import Vectors, SparseVector, _convert_to_vector
class MLUtils(object):
"""
Help... | {
"content_hash": "d915c2bd0c8ad0dcbf036e9639289ea9",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 98,
"avg_line_length": 36.890965732087224,
"alnum_prop": 0.5971964195237291,
"repo_name": "tophua/spark1.52",
"id": "10a1e4b3eb0fc269373e0525e1d1f0962d7ef623",
"size": "12... |
from django.db.models import Q
from rest_framework import authentication
from rest_framework import exceptions
from api.models.User import User
from api.models.Organization import Organization
from api.models.OrganizationType import OrganizationType
from api.utils import get_firstname_lastname
class UserAuthenticatio... | {
"content_hash": "81740ba105d1e7a9c5085f056f31f334",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 83,
"avg_line_length": 42.984375,
"alnum_prop": 0.6401308615049073,
"repo_name": "swcurran/tfrs",
"id": "706db968f7a415b5b259c3f74cfd0b5218c77846",
"size": "2797",
"binar... |
"""Pluralize English nouns (stage 4)
This program is part of "Dive Into Python", a free Python book for
experienced programmers. Visit http://diveintopython.org/ for the
latest version.
Command line usage:
$ python plural4.py noun
nouns
"""
__author__ = "Mark Pilgrim (mark@diveintopython.org)"
__version__ = "$Revis... | {
"content_hash": "a25ecdf7593b902a5aa0f9053a48e68e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 66,
"avg_line_length": 25.75,
"alnum_prop": 0.6248896734333628,
"repo_name": "tapomayukh/projects_in_python",
"id": "9ac406fe64d31fd65c6fada5c679db0a3ebd7675",
"size": "113... |
from s3 import S3CustomController
THEME = "skeleton"
# =============================================================================
class index(S3CustomController):
""" Custom Home Page """
def __call__(self):
self._view(THEME, "index.html")
return dict()
# END ============================... | {
"content_hash": "bac47b089e0d0e12d5c1f57496a59b59",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.35792349726775957,
"repo_name": "gnarula/eden_deployment",
"id": "c3614bbab6844e4e7c9cfad5d82d225240ec4ccf",
"siz... |
def get_starting_line(logFile,delimeter,skipln):
raw_log = open(logFile) # open file
raw_lines = raw_log.read().split('\n') # split file by line
line_cnt = 0
for line in raw_lines:
if delimeter in str(line): # look for delimiter
line_cnt += skipln # add offset
break;
line_cn... | {
"content_hash": "27c4c3229438606ef0dad52bb2a39440",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 86,
"avg_line_length": 31.571428571428573,
"alnum_prop": 0.5933257918552036,
"repo_name": "zane-weissman/XL2-analysis",
"id": "a12af44a1dd85829549015ba3457323283cc847f",
"s... |
from __future__ import unicode_literals
from django.apps import AppConfig
class DataBaseConfig(AppConfig):
name = 'data_base'
| {
"content_hash": "e0233a1452b5a69cc76103cafe204315",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 19,
"alnum_prop": 0.7518796992481203,
"repo_name": "xuqiantong/NY_Auto",
"id": "ee4c321e15b826b01f7a2b11b4a8ae6d6428f6ef",
"size": "133",
"binary": ... |
from functools import partial
from itertools import islice
from pathlib import Path
from urllib.parse import urljoin
from typing import NamedTuple, Iterable, Optional
from xml.etree import ElementTree as ET
import gzip
import sys
import mimetypes
DEFAULT = 'http://www.sitemaps.org/schemas/sitemap/0.9'
RS = 'http://ww... | {
"content_hash": "bc37d795889b634dfaf496b210f1c0f8",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 82,
"avg_line_length": 31.714285714285715,
"alnum_prop": 0.5906531531531531,
"repo_name": "libris/librisxl",
"id": "d42310dc2b87c58e6c352fda81013663d996faee",
"size": "106... |
"""
tests.appctx
~~~~~~~~~~~~
Tests the application context.
:copyright: (c) 2016 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import flask
def test_basic_url_generation():
app = flask.Flask(__name__)
app.config['SERVER_NAME'] = 'localhost'
app.... | {
"content_hash": "cf8a48dd0a6688152094ac98bea1eefb",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 69,
"avg_line_length": 27.27891156462585,
"alnum_prop": 0.5930174563591022,
"repo_name": "Parkayun/flask",
"id": "31e3b2071729f51db3dd7b2c73a984d6e752bbd2",
"size": "4034"... |
from rx import Observable, AnonymousObservable
from rx.internal.utils import adapt_call
from rx.internal import extensionmethod
@extensionmethod(Observable)
def skip_while(self, predicate):
"""Bypasses elements in an observable sequence as long as a specified
condition is true and then returns the remaining e... | {
"content_hash": "4dd313bcba7beba7d327dad5270b1625",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 82,
"avg_line_length": 34.45454545454545,
"alnum_prop": 0.6418205804749341,
"repo_name": "Sprytile/Sprytile",
"id": "45870bd1f9abd8db22af122d1860cde38510ee49",
"size": "151... |
from lxml.builder import ElementMaker
from moai.metadata.mods import NL_MODS, XSI_NS
class DIDL(object):
"""A metadata prefix implementing the DARE DIDL metadata format
this format is registered under the name "didl"
Note that this format re-uses oai_dc and mods formats that come with
MOAI by... | {
"content_hash": "d7855cac9e2539f08853b9cc3ab02dc3",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 124,
"avg_line_length": 39.98684210526316,
"alnum_prop": 0.4738400789733465,
"repo_name": "infrae/moai",
"id": "f70ac9c888e434188cbef3a72ff9b7b53e5fafd7",
"size": "6079",
... |
from asyncio import Event
from alembic import config, script, command
from alembic.runtime import migration
from sqlalchemy import engine
from configparser import ConfigParser
from datetime import datetime
from subprocess import check_output, CalledProcessError
from sys import exit, hexversion
from traceback import for... | {
"content_hash": "d498459285ee1795f8cc49a994a1465c",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 200,
"avg_line_length": 36.37931034482759,
"alnum_prop": 0.5714285714285714,
"repo_name": "ihaveamac/Kurisu",
"id": "9eea228bab18fd53fa819364d8f0c2cd1e0d2da9",
"size": "14... |
"""Exceptions raised by Apps."""
from functools import wraps
from typing import Callable, List, Union, Any, TypeVar, Optional
from types import TracebackType
import dill
import logging
from tblib import Traceback
from six import reraise
from parsl.data_provider.files import File
logger = logging.getLogger(__name__)... | {
"content_hash": "37f40c18929c98df84bc7a7144028fa8",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 105,
"avg_line_length": 31.269662921348313,
"alnum_prop": 0.6525332375134747,
"repo_name": "Parsl/parsl",
"id": "d524c81b7745759f71fc47b666a5da29027964e8",
"size": "5566",... |
from math import log
import numpy as np
from scipy.linalg import pinvh
import pytest
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import assert_array_less
from sklearn.utils._testing import assert_raise_message
from sk... | {
"content_hash": "795bb2191ddbb5a1a00220be3bf5885c",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 78,
"avg_line_length": 35.38709677419355,
"alnum_prop": 0.6366859110705966,
"repo_name": "ryfeus/lambda-packs",
"id": "529702ff752ace5d3409b4b4672a3dda751c6f6d",
"size": "... |
"""Ban logic for HTTP component."""
from collections import defaultdict
from datetime import datetime
from ipaddress import ip_address
import logging
from aiohttp.web import middleware
from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized
import voluptuous as vol
from homeassistant.config import load_yam... | {
"content_hash": "ae499d5f7b872c734adf8d96f6ad5a71",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 78,
"avg_line_length": 32.44808743169399,
"alnum_prop": 0.6588076793533176,
"repo_name": "aequitas/home-assistant",
"id": "1cb610e71a640ebaad46df014d758ab44dbb9274",
"size... |
import tweepy
import json
from datetime import datetime
import pytz
class TwitterAPI:
def __init__(self, keys_filename):
self.api = None
self.authenticate_api(keys_filename)
def authenticate_api(self, keys_filename):
# Open the file containing the API keys and authenticate tweepy
... | {
"content_hash": "57605fc76d54a5c46f5220812f48052d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 89,
"avg_line_length": 36.55813953488372,
"alnum_prop": 0.594147582697201,
"repo_name": "dsykesturner/TwitterFavouriteFilter",
"id": "73b6f1b9360bfa4b8006f43fe7f77efecb83ae0f... |
"""
@authors: Sergei Garbuzov
@status: Development
@version: 1.1.0
"""
import time
from websocket import create_connection
from pysdn.common.status import STATUS
from pysdn.common.utils import load_dict_from_file
from pysdn.controller.controller import Controller
from pysdn.controller.notification import Inventory... | {
"content_hash": "4dd464888184389a050214516815f371",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 79,
"avg_line_length": 34.60493827160494,
"alnum_prop": 0.539065287192294,
"repo_name": "brocade/pysdn",
"id": "4a3f074f462483f81b45535355c92df6d2560b6e",
"size": "7180",
... |
"""Tool for helpers used in linux building process."""
import os
import SCons.Defaults
import subprocess
def _OutputFromShellCommand(command):
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
return process.communicate()[0].strip()
# This is a pure SCons helper function.
def _InternalBui... | {
"content_hash": "694a34291233c35f63aa32cf46bf6457",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 80,
"avg_line_length": 38.91760299625468,
"alnum_prop": 0.6641324222885189,
"repo_name": "muzili/libjingle-0.6.14",
"id": "67214c08cc367585a2f67257fc460a1029c58546",
"size... |
'''
Created on 25 sty 2015
@author: Adam Polomski
'''
import unittest
from model import TwoCriteriaModelFactory, AgregateMetric
from unittest.mock import MagicMock
from probability.metric import Metric
class TwoCriteriaModelFactoryTest(unittest.TestCase):
def testShouldCalculateValueFrequency(self)... | {
"content_hash": "72dac5e49b619d0aed367ae0e5fd8507",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 124,
"avg_line_length": 29.75,
"alnum_prop": 0.5745798319327731,
"repo_name": "adampolomski/decisionmaker",
"id": "5b3f1eed1ef46edda2acb0f37432be782791885a",
"size": "1904"... |
"""Support for Vallox ventilation units."""
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import date
import ipaddress
import logging
from typing import Any, NamedTuple
from uuid import UUID
from vallox_websocket_api import PROFILE as VALLOX_PROFILE, Vallox
from vallox_webs... | {
"content_hash": "0f95c0e7199d9bc223dbf7ad1ea88559",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 99,
"avg_line_length": 30.494915254237288,
"alnum_prop": 0.641951978657181,
"repo_name": "GenericStudent/home-assistant",
"id": "aeb9e59e28682d51937a1aa1fd892ba582f3d583",
... |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('pdb_in', default=None, help='Input PDB file')
args = parser.parse_args()
import os, inspect
dirs = {}
dirs['script'] = os.path.dirname(os.path.abspath(\
inspect.getfile(inspect.currentframe())))
execfile(os.path.join(dirs['script'],'_external_pa... | {
"content_hash": "b49b0eb6bf81b0dc5b7974e6ecf1c14e",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 84,
"avg_line_length": 36.87916666666667,
"alnum_prop": 0.6341656310021466,
"repo_name": "gkumar7/AlGDock",
"id": "fbbe90df0370133364607206faebf5e5c976ca7d",
"size": "8886... |
from abc import ABCMeta, abstractmethod
from core import log
import threading
import time
logger = log.getLogger("service")
class Service(threading.Thread):
__metaclass__ = ABCMeta
@abstractmethod
def do_action(self):
"""
Implement this method that is called every step.
"""
... | {
"content_hash": "cc36b1ed9c23acb5d565c95fc5790f1f",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 66,
"avg_line_length": 28.057971014492754,
"alnum_prop": 0.53150826446281,
"repo_name": "ict-felix/stack",
"id": "5c47dd6a42e305d9d4bf542db20dbf06e5fb52dc",
"size": "1936",... |
import os
from compressor.exceptions import FilterError
def get_class(class_string, exception=FilterError):
"""
Convert a string version of a function name to the callable object.
"""
if not hasattr(class_string, '__bases__'):
try:
class_string = class_string.encode('ascii')
... | {
"content_hash": "ad81628fe3627a687a971f005d9b2a78",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 77,
"avg_line_length": 32.24285714285714,
"alnum_prop": 0.6030128489144883,
"repo_name": "neumerance/cloudloon2",
"id": "83a1a2a1167a05204a1bf6bc21d3f69bb2970cdb",
"size": ... |
from zipline.api import order, order_target_percent, record, symbol, symbols, set_symbol_lookup_date, history, \
get_datetime, schedule_function, get_open_orders
import pprint
from numpy import diff, isnan, arange, insert, sort, array
class DTPortfolio:
def __init__(self, cash):
self.start_cash = cash... | {
"content_hash": "b8adc075bdfc0566c8966f8d4f2f227e",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 112,
"avg_line_length": 37.63793103448276,
"alnum_prop": 0.5464956481905634,
"repo_name": "jdtogni/trader",
"id": "2cc7052560593a715f13d4e571e1a7f36d4e7f9f",
"size": "1091... |
import page_objects
def click_button():
page = page_objects.dynamic_controls.DynamicControlsPage()
page.click_button()
return
def click_button_and_wait_for_loading():
page = page_objects.dynamic_controls.DynamicControlsPage()
page.click_button_and_wait_for_loading()
return
def click_checkbox(... | {
"content_hash": "612d8ae5d1c7bad8194774889cd9667f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 62,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.7323232323232324,
"repo_name": "MooMan272/selenium_the_internet",
"id": "ed94e8c793a4af43e518ef7b607e83d8fd0ede45",... |
from __future__ import absolute_import
from .enums import *
from .errors import *
class RAMONBase(object):
"""
RAMONBase Object for storing neuroscience data
"""
def __init__(self, id=DEFAULT_ID,
confidence=DEFAULT_CONFIDENCE,
kvpairs=DEFAULT_DYNAMIC_METADATA,
... | {
"content_hash": "15bc6686b8163edeb5e34eb8894dce88",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 78,
"avg_line_length": 32.26190476190476,
"alnum_prop": 0.5852398523985239,
"repo_name": "openconnectome/ndio",
"id": "51fefbd10d20da70df087f1383de95730730491e",
"size": "1... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General conf... | {
"content_hash": "1e7c2655db2c43d9158252035ca7760e",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 32.107142857142854,
"alnum_prop": 0.7078235076010382,
"repo_name": "imdark/kafka-rest",
"id": "47354f338ea1200bc69033ff11cb29614b242021",
"size": "8... |
"""
Flask-Kinesis
-------------
With this library, you can simply record events from the flask application to aws kinesis
"""
from distutils.core import setup
setup(
name="Flask-kinesis",
version="0.1.9",
py_modules=["flask_kinesis"],
author="doyoung",
author_email="hdy3405" "@" "gmail.com",
... | {
"content_hash": "dc5b4ed4164737194c5a6117b9edca5e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 89,
"avg_line_length": 27.83783783783784,
"alnum_prop": 0.6019417475728155,
"repo_name": "iidd0101/flask-kinesis",
"id": "00239aaf8acaef88b7dfef9c845d3198e30a6dff",
"size":... |
try:
from unittest.mock import Mock
from unittest.mock import patch
except ImportError:
from mock import Mock
from mock import patch
from moira_client.client import Client
from moira_client.client import InvalidJSONError
from moira_client.client import ResponseStructureError
from moira_client.models.su... | {
"content_hash": "c511e349a3acb2f8b144492cf211366c",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 114,
"avg_line_length": 35.56140350877193,
"alnum_prop": 0.6578687715836211,
"repo_name": "moira-alert/python-moira-client",
"id": "07801b0fe8ae77f5c8435428d7af5892e414ca1f"... |
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Series',
fields=[
(... | {
"content_hash": "1f384cc6b862ea0924b11347890afa35",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 116,
"avg_line_length": 32.06666666666667,
"alnum_prop": 0.5353430353430353,
"repo_name": "reiniervdwindt/power-rangers-api",
"id": "160d60787e8a8b020eebb7fc21b993698939f39d"... |
import argparse
import datetime
import shlex
import subprocess
from maas_common import metric
from maas_common import metric_bool
from maas_common import print_output
from maas_common import status_err
from maas_common import status_ok
def run_command(arg):
proc = subprocess.Popen(shlex.split(arg),
... | {
"content_hash": "1523fe6ff0669bc48dd27f9045de3576",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 77,
"avg_line_length": 33.838095238095235,
"alnum_prop": 0.5817618913594146,
"repo_name": "cloudnull/rpc-maas",
"id": "1aaedb6ab7fafd753191612e2a71a4deea65570b",
"size": "... |
_author_ = 'Pylar'
#!flask/bin/python
from app import create_app
import os
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
app.run(debug = True)
| {
"content_hash": "e0c66ae5501515273424f1e29667c06d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 56,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.7142857142857143,
"repo_name": "EricFZ/flask",
"id": "87faa81e7e32a4a991d5544ceef565bfcc8e551e",
"size": "178",
... |
import numpy as np
import os, pdb
import pytest
from astropy import units as u
from xastropy.igm.abs_sys import abssys_utils as xabsys
from linetools.spectralline import AbsLine
'''
def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'files')
return os.path.join(data_dir, filename)
''... | {
"content_hash": "f4040d23b3b65b042232a7ba8632eebb",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 63,
"avg_line_length": 23.444444444444443,
"alnum_prop": 0.665086887835703,
"repo_name": "nhmc/xastropy",
"id": "0cbadaaadb118c2ab00caeb075f67da0c5b4fd23",
"size": "711",
... |
"""
Running CLI
"""
from sunhead.cli.entrypoint import main
if __name__ == '__main__':
main()
| {
"content_hash": "1142b9cac2c387b75deb93299963a979",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 39,
"avg_line_length": 11.222222222222221,
"alnum_prop": 0.5742574257425742,
"repo_name": "anti1869/sunhead",
"id": "07d49e245836c468ff01b52d213443ca37ad93f6",
"size": "101"... |
from __future__ import unicode_literals
import datetime
import os
import subprocess
VERSION = (0, 1, 0, 'rc', 0)
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
if version is None:
version = VERSION
else:
assert len(version) == 5
assert ... | {
"content_hash": "ec3554f7e6f8327b1857ca2d43312e3d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 32.089285714285715,
"alnum_prop": 0.6249304396215916,
"repo_name": "kevwilde/cmsplugin-twcarousel",
"id": "607be56e01caa1b4509efb7e6850892b7adeff20",
... |
import sys
if sys.platform not in ['mozilla', 'ie6', 'opera', 'oldmoz', 'safari']:
from __pyjamas__ import doc
from pyjamas import Factory
from pyjamas import DOM
from HTMLTable import HTMLTable
from RowFormatter import RowFormatter
from FlexCellFormatter import FlexCellFormatter
class FlexTable(HTMLTable):
... | {
"content_hash": "5f6a9b4c125be86c084af65a9f024fb5",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 119,
"avg_line_length": 31.82758620689655,
"alnum_prop": 0.6522210184182016,
"repo_name": "jaredly/pyjamas",
"id": "a9bd8cd785505eb3b43b412edd9e77955bfe6435",
"size": "2505... |
from kbox import kbox
import unittest
class TestAirML(unittest.TestCase):
def test_list(self):
output = kbox.execute('-list')
self.assertTrue('KBox KNS Resource table list' in output)
def test_info(self):
output = kbox.execute("-info http://purl.org/pcp-on-web/dbpedia")
print(... | {
"content_hash": "ebf4f5f7a288b56ceb69ec89c9dbc5fa",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 74,
"avg_line_length": 29.86111111111111,
"alnum_prop": 0.6288372093023256,
"repo_name": "AKSW/KBox",
"id": "cdd32e8e385ee997fe4532fbe262e4fe9f95b8e8",
"size": "1075",
"b... |
"""
pghoard: fixtures for tests
Copyright (c) 2015 Ohmu Ltd
See LICENSE for details
"""
import contextlib
import json
import lzma
import os
import random
import re
import signal
import subprocess
import tempfile
import time
from distutils.version import LooseVersion
from unittest import SkipTest
import psycopg2
impor... | {
"content_hash": "c551c2e1ce842db65cd1e78a588aa1b9",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 123,
"avg_line_length": 35.33038348082596,
"alnum_prop": 0.5983134340819904,
"repo_name": "ohmu/pghoard",
"id": "55cdaa2f3437e7d338410b1cac0caca6697fc876",
"size": "11977"... |
import operator
from pyinter.interval_set import IntervalSet
from .extrema import INFINITY, NEGATIVE_INFINITY
def open(lower_value, upper_value):
"""Helper function to construct an interval object with open lower and upper.
For example:
>>> open(100.2, 800.9)
(100.2, 800.9)
"""
return Interv... | {
"content_hash": "99fda78dc499b8a86b1654c1c9f224a1",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 123,
"avg_line_length": 39.635451505016725,
"alnum_prop": 0.6096531938233061,
"repo_name": "intiocean/pyinter",
"id": "20a86636009722f32e3f63c3ef4fdbc57370bf12",
"size": "... |
module_name = 'example module'
module_version = '0.0'
module_author = 'HydroGen'
def main(message, long_pool_thead):
pass
| {
"content_hash": "2210111d1ee1b02c4bef49c695f7cdc1",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 35,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.712,
"repo_name": "ihydrogen/hydrogen-chat-bot-py",
"id": "4bcda1500cd4f95daa1a08f12a0d42d197504623",
"size": "125... |
import argparse
import json
from operator import attrgetter
import os
from pprint import pprint
import subprocess
import sys
from lib import Flow
import utils
OVS_OFCTL = '/usr/bin/ovs-ofctl'
def parse_args():
parser = argparse.ArgumentParser(description='openflow parser')
parser.add_argument('--disable-un... | {
"content_hash": "04e15d34434a950cbfe60fe0c1d13574",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 79,
"avg_line_length": 32.75714285714286,
"alnum_prop": 0.5601831661578718,
"repo_name": "tr3buchet/flozer",
"id": "6ef400c606cb829b4859e6a838bc79ab3affa1dd",
"size": "523... |
import requests
from pagespeed.settings import GOOGLE_API_KEY, GOOGLE_PAGESPEED_URL
def get_results(input_url):
api_key = GOOGLE_API_KEY
test_url = GOOGLE_PAGESPEED_URL
payload = {'url': input_url, 'key': api_key}
r = requests.get(test_url, params=payload)
json = r.json()
results = json["rul... | {
"content_hash": "c9de0db9a6e4792cabd8cbc2891a8ac6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.674863387978142,
"repo_name": "boomajoom/pagespeed",
"id": "2aad3f33c1f7b0ba462ce31c1b861a6fc7200b42",
"size": "3... |
"""URLs for all views."""
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include, path, reverse_lazy
from django.views.generic import RedirectView, TemplateView
from djpsilobus.core import views
from djauth.views import loggedout
admin.autodiscover()
han... | {
"content_hash": "cec87392ab20b1f58b0933c9e7db48c8",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 75,
"avg_line_length": 26.612244897959183,
"alnum_prop": 0.584739263803681,
"repo_name": "carthage-college/django-djpsilobus",
"id": "4c11e25e6649c70c9c917b012e6bb320768b9140... |
__author__ = 'yinjun'
class Solution:
"""
@param nums: The integer array
@return: The length of LIS (longest increasing subsequence)
"""
def longestIncreasingSubsequence(self, nums):
# write your code here
if nums == None or nums == []:
return 0
l = len(nums)
... | {
"content_hash": "820102fc106c22380882f4ba73b7a1b6",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 63,
"avg_line_length": 23.071428571428573,
"alnum_prop": 0.5030959752321982,
"repo_name": "shootsoft/practice",
"id": "ab0543b51f101d74cea6db70c15c18eaa1821522",
"size": "6... |
import numpy as np
import mxnet as mx
from mxnet import gluon
from mxnet.gluon.data.vision import CIFAR10
IMAGE_SIZE = 64
def transformer(data, label):
""" data preparation """
data = mx.image.imresize(data, IMAGE_SIZE, IMAGE_SIZE)
data = mx.nd.transpose(data, (2, 0, 1))
data = data.astype(np.float32... | {
"content_hash": "ed837ae92198d257e36f93eb75228561",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 28.19047619047619,
"alnum_prop": 0.6858108108108109,
"repo_name": "dmlc/mxnet",
"id": "782f74ffca5d7c5fb54efa6ce86a24f610792b91",
"size": "1621",
"... |
"""
Tests for Block Device utility functions.
"""
from oslo_utils.fixture import uuidsentinel as uuids
import six
from nova import block_device
from nova import exception
from nova import objects
from nova import test
from nova.tests.unit import fake_block_device
from nova.tests.unit import matchers
class BlockDevic... | {
"content_hash": "a2be6e3a2d0c2ad86bdf4ac4ffed99be",
"timestamp": "",
"source": "github",
"line_count": 710,
"max_line_length": 79,
"avg_line_length": 43.45211267605634,
"alnum_prop": 0.5361252471556838,
"repo_name": "rahulunair/nova",
"id": "abf265818a32083da47c69534fe376dbd2312ca1",
"size": "3148... |
"""engine.SCons.Variables.ListVariable
This file defines the option type for SCons implementing 'lists'.
A 'list' option may either be 'all', 'none' or a list of names
separated by comma. After the option has been processed, the option
value holds either the named list elements, all list elemens or no
list elements a... | {
"content_hash": "aad5badd4bf9db34384e19f7c7ff39ba",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 90,
"avg_line_length": 33.45112781954887,
"alnum_prop": 0.6414924702180266,
"repo_name": "frew/simpleproto",
"id": "4dcaa1c95c53fe6efec56826c2a24cf2873cfb69",
"size": "444... |
from collections import defaultdict
from collections import namedtuple
from collections import OrderedDict
import copy
import re
import time
from oslo_config import cfg
from oslo_log import log
from vitrage.common.constants import EdgeProperties as EProps
from vitrage.common.constants import VertexProperties as VProp... | {
"content_hash": "30b5ec7b4d0d0ab7b10b6f2a3850645a",
"timestamp": "",
"source": "github",
"line_count": 618,
"max_line_length": 79,
"avg_line_length": 41.85598705501618,
"alnum_prop": 0.575984845556114,
"repo_name": "openstack/vitrage",
"id": "eee52d5307986b73ba189f5f3bb871f43c85f131",
"size": "264... |
from __future__ import with_statement # needed for python 2.5
import os
from fabric.api import *
def blef_fr():
"""Use the actual webserver"""
env.project_name = 'moon'
env.hosts = ['blef.fr']
env.user = 'root'
env.key_filename = '~/.ssh/id_rsa'
env.path = '/var/www/%(project_name)s' % env
... | {
"content_hash": "c54fe654341cd20a3b8eca0778c2eadf",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 86,
"avg_line_length": 31.023255813953487,
"alnum_prop": 0.618440779610195,
"repo_name": "Frky/moon",
"id": "b685681e7aa971c7a2ad8d2e5e8ef3ca7dfec6be",
"size": "1334",
"b... |
from swproject.settings import *
DATABASES['default']['NAME'] = 'hudson'
DATABASES['default']['USER'] = 'hudson'
DATABASES['default']['HOST'] = 'localhost'
CELERY_ALWAYS_EAGER = True
HAYSTACK_SEARCH_ENGINE = 'simple'
| {
"content_hash": "482a0b1ae039878a10be9991dcfc0993",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 42,
"avg_line_length": 22.1,
"alnum_prop": 0.7013574660633484,
"repo_name": "snswa/swsites",
"id": "f706eba5f491cc1833e996e746a919dad8e0d10d",
"size": "221",
"binary": fa... |
"""
This script tests functions to compute different Power Spectra from complex SH coefficients
"""
# standard imports:
import os
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
# import shtools:
sys.path.append(os.path.join(os.path.dirname(__file__), "../../.."))
import pyshtoo... | {
"content_hash": "d1a437d114f1ba85cad5c6c39f367338",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 109,
"avg_line_length": 36.46551724137931,
"alnum_prop": 0.6515366430260048,
"repo_name": "pochoi/SHTOOLS",
"id": "7638b5218de80af908aab50b8d3cc21461af0b85",
"size": "4252... |
import datetime
import h5py
import os
import random
import sys
import time
import timeit
import numpy as np
DTYPE = np.dtype({'names': ('time', 'price', 'volume', 'amount'),
'formats': ('i4', 'f4', 'f4', 'f4')})
def bench_ds():
filename = '/tmp/bench-%d.h5' % int(time.time())
symbols = ["... | {
"content_hash": "8e3a12680e62a3153e24c79f1967ac62",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 82,
"avg_line_length": 24.346153846153847,
"alnum_prop": 0.5624012638230648,
"repo_name": "yinhm/datafeed",
"id": "312d00b36fa4bdf349a107c305527d232f2609db",
"size": "1970"... |
from ducktape.services.service import Service
from kafkatest.services.kafka.directory import kafka_dir
import subprocess
import time
class ZookeeperService(Service):
logs = {
"zk_log": {
"path": "/mnt/zk.log",
"collect_default": True},
"zk_data": {
"path": "/... | {
"content_hash": "5f7462036ef42afd6bacb1b537b0c142",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 105,
"avg_line_length": 37.08695652173913,
"alnum_prop": 0.5982805783509183,
"repo_name": "junrao/kafka",
"id": "a1f999ea9ee1e10d1a3c36179d6ab882317ff500",
"size": "3341",
... |
import random
import hashlib
challengelen = 2
chain = []
def mine(lastblock, txns):
hash = '1'*challengelen
nonce = 0
while hash[:challengelen] != '0'*challengelen:
hash = hashlib.md5(lastblock[4] + '|' + txns + '|' + str(nonce)).digest()
nonce += 1
#print(txns, nonce, hash[:challengelen])
return (lastblo... | {
"content_hash": "17ef8953b638b55df82a9675699fe900",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 82,
"avg_line_length": 20.75,
"alnum_prop": 0.664841182913472,
"repo_name": "ragulbalaji/Random-Cool-Things",
"id": "79b58189e496cdf0ccea23dcce46a35c55da942a",
"size": "913... |
"""
Copyright (c) 2011, 2012, Regents of the University of California
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 l... | {
"content_hash": "7ba340c907ba854ae0cbd7e10448941e",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 88,
"avg_line_length": 34.345238095238095,
"alnum_prop": 0.6779896013864818,
"repo_name": "Alwnikrotikz/smap-data",
"id": "65367df7681cc25e524bce67fa54d548d0f8c091",
"size"... |
import json
import logging
import time
import unittest
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from nose.plugins.skip import SkipTest
from nose.tools import assert_true, assert_false, assert_equal
from desktop.lib.django_test_util import make_logged_in_client
from desk... | {
"content_hash": "22aeb4fc6c350e932f2aaf83afad2cc6",
"timestamp": "",
"source": "github",
"line_count": 662,
"max_line_length": 937,
"avg_line_length": 43.012084592145015,
"alnum_prop": 0.6302943035751915,
"repo_name": "erickt/hue",
"id": "8d9df27fb438137348507f6cfd9a5551cb4d8f6b",
"size": "29267",... |
"""Symbols exported by this module are imported into the puls namespace. Usage:
from puls import <symbol>
"""
from __future__ import absolute_import, unicode_literals, division
from puls.compat import range
import math
class AttributeDict(dict):
def __getattr__(self, key):
try:
return dict._... | {
"content_hash": "d69a6d14fd3b4aa0ac7512d1cce08f7a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 25.675675675675677,
"alnum_prop": 0.5505263157894736,
"repo_name": "za-creature/puls",
"id": "06d44d2710983e679a3e4acd86a93ef162bf5113",
"size": "191... |
"""
Support for EBox.
Get data from 'My Usage Page' page: https://client.ebox.ca/myusage
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.ebox/
"""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
from homeas... | {
"content_hash": "038a64427b92c65679f6e955e96f796e",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 74,
"avg_line_length": 30.83225806451613,
"alnum_prop": 0.610797237915882,
"repo_name": "shaftoe/home-assistant",
"id": "3cfa5ef9ff4682264e199ab7a838c6c114d655de",
"size":... |
import datetime
import json
from decimal import Decimal
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import MinLengthValidator, validate_slug
from django import forms
from ... | {
"content_hash": "5db95d00814d2d42bbb9b2f82461ac7f",
"timestamp": "",
"source": "github",
"line_count": 1962,
"max_line_length": 121,
"avg_line_length": 37.95514780835882,
"alnum_prop": 0.5321211795670624,
"repo_name": "puttarajubr/commcare-hq",
"id": "b0834745ec6789ebf4986f2d0484a02bb50cc99c",
"si... |
from datetime import date, datetime, time, timedelta
from django.contrib.auth.models import User
from django_lean.lean_retention.models import DailyActivity
def sort_retention_periods(retention_periods):
result = list(sorted(set(p + 0 for p in retention_periods)))
if result and result[0] < 1:
raise ... | {
"content_hash": "64439eeeb578bd928d02c5f3ef81150b",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 78,
"avg_line_length": 37.3125,
"alnum_prop": 0.5793251974156497,
"repo_name": "e-loue/django-lean",
"id": "e9473cf77a6cf64fe4f57c61e49427213984b433",
"size": "4179",
"b... |
import abc
from oslo.config import cfg
import six
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper
from neutron.common import exceptions as qexception
from neutron.openstack.common import log as logging
from neutron.plugins.common import const... | {
"content_hash": "90d0a181809dc1e96d9e27282f91b9b8",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 79,
"avg_line_length": 36.37772397094431,
"alnum_prop": 0.5561102236421726,
"repo_name": "sajuptpm/neutron-ipam",
"id": "b7ee906fd58667b8f4c5c454f63586edd3af5e55",
"size":... |
import argparse
import tempfile
import os
import signal
import shutil
import urllib
import urllib.request
import hashlib
import time
import socket
import json
import base64
from urllib.parse import urlparse
from prepare_release_candidate import run
from http.client import HTTPConnection
DEFAULT_PLUGINS = ["analysis-i... | {
"content_hash": "9dda529059d03722bd2ad1e7f4fde22d",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 208,
"avg_line_length": 42.45418326693227,
"alnum_prop": 0.6145833333333334,
"repo_name": "strahanjen/strahanjen.github.io",
"id": "883a62210c9b5061580773a7db28a0eafe823abb"... |
from crudns.settings.prod import * # NOQA (ignore all errors on this line)
| {
"content_hash": "1c7d5f834f79d489b24ab6d6a7339f2c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 75,
"avg_line_length": 76,
"alnum_prop": 0.75,
"repo_name": "CRUDNS/CRUDNS",
"id": "539a1361be0049ac48ade92655eaa332446c7178",
"size": "76",
"binary": false,
"copies": "... |
import github.GithubObject
class Status(github.GithubObject.NonCompletableGithubObject):
"""
This class represents status as defined in https://status.github.com/api
"""
@property
def status(self):
"""
:type: string
"""
return self._status.value
@property
... | {
"content_hash": "5dc52c9e32383b580a6e3aafbf08988b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 88,
"avg_line_length": 29.096774193548388,
"alnum_prop": 0.6308203991130821,
"repo_name": "ArcherSys/ArcherSys",
"id": "46e3921263a811cc4a03339ae051568384366ab7",
"size": "... |
import datetime as dt
import json
import os
import re
from mock import MagicMock
from pyVmomi import vim
from requests import Response
from six import iteritems
from tests.common import HERE, VSPHERE_VERSION
from datadog_checks.vsphere.api import VersionInfo
class MockedCounter(object):
def __init__(self, count... | {
"content_hash": "dda271e6f3debce4ea428627273fc9b6",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 120,
"avg_line_length": 38.858369098712444,
"alnum_prop": 0.5115970841616965,
"repo_name": "DataDog/integrations-core",
"id": "dccd4b1cd05fda86cd01d196d5293b99f824e1eb",
"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "NewsPortal.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "d1e87b7e158ecc5142490703d5f9b019",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.7142857142857143,
"repo_name": "Rahul91/Exotel_NewsPortal",
"id": "29040c66b160ef9d1346dc8151cdb138e086d117",
"siz... |
from __future__ import print_function
import numpy as np
import sys
# AC_tools modules
from . AC_time import *
from . core import *
from . utils import *
from . GEOSChem_nc import *
from . GEOS import *
from . HEMCO import *
from . KPP import *
from . mask import *
from . observations import *
from . planeflight import... | {
"content_hash": "72ab1109e44a0456acdf024d7443cdc9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 160,
"avg_line_length": 34.80487804878049,
"alnum_prop": 0.7372109320252278,
"repo_name": "tsherwen/AC_tools",
"id": "7e19dcd60fc7fdd6546814e8561bfc235dcb5528",
"size": "14... |
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination
from image_app.serializers import ImageSerializer
from image_app.models import Image, Label
from image_app.filters import LabelsFilter
class StandardResultsSetP... | {
"content_hash": "d639669f189a8968bfd7440e6e8ef139",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 27.166666666666668,
"alnum_prop": 0.7533742331288343,
"repo_name": "pstrinkle/drf-image-app",
"id": "f17c969f43bd893647a05064c9060dab5bef1c05",
"size... |
import flask
import tempfile
import flask_sqlalchemy
import flask_praetorian
import flask_cors
db = flask_sqlalchemy.SQLAlchemy()
guard = flask_praetorian.Praetorian()
cors = flask_cors.CORS()
# A generic user model that might be used by an app powered by flask-praetorian
class User(db.Model):
id = db.Column(db.... | {
"content_hash": "033ed738f419cecf76e69ff1c93c2e2d",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 85,
"avg_line_length": 29.99514563106796,
"alnum_prop": 0.6368344392296488,
"repo_name": "dusktreader/flask-praetorian",
"id": "37ae6ed1032b9ceb74dd1e002a1c0ccd1b57e135",
... |
"""QuickLangevin.py - test the Langevin dynamics.
Tests Langevin dynamics using the EMT Copper potential.
"""
import sys, time
from numpy import *
import asap3
from asap3.testtools import ReportTest
from asap3.md.langevin import Langevin
from asap3.md.verlet import VelocityVerlet
from ase.lattice.cubic import FaceCen... | {
"content_hash": "ecd10a01b92444a0f5919096417d68a7",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 84,
"avg_line_length": 30.233333333333334,
"alnum_prop": 0.6181550900404263,
"repo_name": "auag92/n2dm",
"id": "e6f843b93b79c02363160db0fae1dae94f3f2399",
"size": "2745",
... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("site", "0014_handle_taxes")]
operations = [
migrations.AddField(
model_name="sitesettings",
name="track_inventory_by_default",
field=models.BooleanField(default=True)... | {
"content_hash": "6bdfa14deb153b5288544dcacb26978c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 52,
"avg_line_length": 24.142857142857142,
"alnum_prop": 0.6153846153846154,
"repo_name": "mociepka/saleor",
"id": "96100d5372f763366775b3ea13795c3b7d4dd82d",
"size": "387"... |
from discord import Embed, Color, Game
from utils import functions
description = "Add roles wich languages you write in."
perm = 2
customenabled = False
async def ex(message, client):
author = message.author
content = message.content
channel = message.channel
global customenabled
args = " ".j... | {
"content_hash": "5c3a0cc13739b7783c83ff5295eae08c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 147,
"avg_line_length": 34.69230769230769,
"alnum_prop": 0.6951219512195121,
"repo_name": "zekroTJA/regiusBot",
"id": "e0283dc78331371e37a18dbb38841335e16c7aaa",
"size": "9... |
"""
ROS service source code generation for Python.
Converts ROS .srv files into Python source code implementations.
"""
import os
import sys
import genrb.generator
import genrb.genrb_main
if __name__ == "__main__":
genrb.genrb_main.genmain(sys.argv, 'gensrv_rb.py', genrb.generator.SrvGenerator())
| {
"content_hash": "9f7cc59bad7f5544e1d1b9a0b2f41f53",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 86,
"avg_line_length": 21.857142857142858,
"alnum_prop": 0.7320261437908496,
"repo_name": "OTL/genrb",
"id": "229d4c891bc88c9b5f4e566cbea362a0219e0819",
"size": "1933",
"... |
version = '0.5'
def main():
from tippet import baker
baker.run()
| {
"content_hash": "eee3bf0d4ccec4f474d2d612bd391d0a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 28,
"avg_line_length": 14.8,
"alnum_prop": 0.6081081081081081,
"repo_name": "kizbitz/tippet",
"id": "7c8f4160b0a9b5ad8a2920e80bb2031ae00b121a",
"size": "74",
"binary": fal... |
import os
import logging
logger = logging.getLogger("eapptools")
RUNMODE_DEV = 'DEV'
RUNMODE_PROD = 'PROD'
if not 'SERVER_SOFTWARE' in os.environ or os.environ['SERVER_SOFTWARE'].startswith('Dev'):
RUNMODE = RUNMODE_DEV
else:
RUNMODE = RUNMODE_PROD
logger.info("RUNMODE=%s", RUNMODE)
# config paramater names
CFG... | {
"content_hash": "bd8f259b3c9939368892dc96b67b5ffd",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 90,
"avg_line_length": 18.4390243902439,
"alnum_prop": 0.6944444444444444,
"repo_name": "oliverbo/eapptools",
"id": "2e4d66dde40a17be40dac00d7d302dc808af2863",
"size": "799... |
from proxy import Proxy, proxied_attr
from proxy import proxied_attr_get as pag, proxied_attr_set as pas, proxied_attr_getset as pags
from arc_utils import arcmethod
import errors
from errors import not_implemented, fail
import urllib
class group(Proxy):
name = property(pag("name"))
features = property(*pag... | {
"content_hash": "1df635e11f9ab12a2a3464f8e5701566",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 108,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.6336633663366337,
"repo_name": "willb/wallaroo",
"id": "fd9512e98f4b7eeb0ac8347a3a48ad3e017e110a",
"size": "2344... |
from __future__ import annotations
import enum
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Callable, List, Tuple
if TYPE_CHECKING:
from minihack import MiniHack
from nle.nethack import Command, CompassDirection
Y_cmd = CompassDirection.NW
class EventType(enum.IntEnum):
MESSA... | {
"content_hash": "feea26f63a8787e9c49efa97a7c59d20",
"timestamp": "",
"source": "github",
"line_count": 860,
"max_line_length": 82,
"avg_line_length": 32.205813953488374,
"alnum_prop": 0.563093475827707,
"repo_name": "facebookresearch/minihack",
"id": "cca9fb7c50d20e2927711445f0278850348bc6d7",
"si... |
import wx
import wx.grid as Grid
import images
#---------------------------------------------------------------------------
class MegaTable(Grid.GridTableBase):
"""
A custom wx.Grid Table using user supplied data
"""
def __init__(self, data, colnames, plugins):
"""data is a list of the form
... | {
"content_hash": "e890e959245f6e6d7869e50d96ed7d87",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 120,
"avg_line_length": 31.409274193548388,
"alnum_prop": 0.5581231144489377,
"repo_name": "dnxbjyj/python-basic",
"id": "332693b50c15f32456bdde5116cb735a9cd195a3",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.