text stringlengths 4 1.02M | meta dict |
|---|---|
"""Treadmill spawn extension.
"""
import os
BUCKETS = 256
MAX_PER_BUCKET = 1000
APPS_DIR = 'apps'
SVSCAN_TREE_DIR = os.path.join(APPS_DIR, 'svscan_tree')
JOBS_DIR = os.path.join(APPS_DIR, 'jobs')
MANIFEST_DIR = 'manifest'
RUNNING_DIR = 'running'
CLEANUP_DIR = 'cleanup'
ZK_MIRROR_DIR = 'zk_mirror'
CELLAPI_SOCK = 'cel... | {
"content_hash": "3657bcae00d14026462bc4b19aed0066",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 78,
"avg_line_length": 27.75,
"alnum_prop": 0.6088588588588588,
"repo_name": "gaocegege/treadmill",
"id": "e69007ab75a832fd9dcf016d171e2cdf59880cb5",
"size": "1332",
"bin... |
import collections
from absl.testing import parameterized
import tensorflow as tf
from tensorflow_federated.python.learning.optimizers import optimizer
class _TestOptimizer(optimizer.Optimizer):
def initialize(self, specs):
del specs
return (0, 1)
def next(self, state, weights, gradients):
del gra... | {
"content_hash": "6329b4f2230e6540ec47fb2990c2f11a",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 74,
"avg_line_length": 36.05952380952381,
"alnum_prop": 0.6447672499174645,
"repo_name": "tensorflow/federated",
"id": "cf3e64d6c0466bd59505a7179b10755357c16d65",
"size": "... |
def convert(input_grid):
pass
| {
"content_hash": "b171995559b73c5df7f517d72e4f97c0",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 24,
"avg_line_length": 17,
"alnum_prop": 0.6764705882352942,
"repo_name": "pheanex/xpython",
"id": "5d753d548dce1a0f04d547bdb8e9aa99339816ed",
"size": "34",
"binary": fals... |
"""Support for ISY994 covers."""
import logging
from typing import Callable
from homeassistant.components.cover import DOMAIN, CoverDevice
from homeassistant.const import (
STATE_CLOSED,
STATE_CLOSING,
STATE_OPEN,
STATE_OPENING,
STATE_UNKNOWN,
)
from homeassistant.helpers.typing import ConfigType
... | {
"content_hash": "a53b82b7f8a7dcb38875482436f7e45b",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 87,
"avg_line_length": 30.721649484536083,
"alnum_prop": 0.6359060402684564,
"repo_name": "leppa/home-assistant",
"id": "f5e052f6926d447af8349e3deae5441bfc835541",
"size": ... |
import numpy as np
import matplotlib.pyplot as plt
from random import random
from scipy.interpolate import lagrange
def func(x):
return 5*x*x - 3*x + 2
#Define the true curve
x_true = np.arange(-2,2.1,0.1)
y_true = func(x_true)
#Define 5 "data points" from this curve, with noise
x_data = np.arange(-... | {
"content_hash": "d895d1e5cf10ec1763fc88318541d2e8",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 33.1,
"alnum_prop": 0.67472306143001,
"repo_name": "BU-PyCon/Meeting-3",
"id": "48a5c4449bb048a2e2944c905e1c0077b68fb756",
"size": "993",
"binary":... |
from __future__ import division
import logging
import os
import signal
import sys
import time
from optparse import OptionParser
from util import local_libpath
sys.path.insert(0, local_libpath())
from thrift.protocol import TProtocol, TProtocolDecorator
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
class T... | {
"content_hash": "659044b1cc7d14784febde67664362ba",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 139,
"avg_line_length": 38.119289340101524,
"alnum_prop": 0.6296690858246221,
"repo_name": "nsuke/thrift",
"id": "81ae1ad62eeceb55e743be943dc6975d11fa90a5",
"size": "15827... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from .core import UnitedStates
class Wisconsin(UnitedStates):
"""Wisconsin"""
include_columbus_day = False
include_federal_presidents_day = False
include_christmas_eve = True
FIXED_HOLIDAY... | {
"content_hash": "8641823a19762ecf6058c1220b4f65d6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 66,
"avg_line_length": 28.357142857142858,
"alnum_prop": 0.6498740554156172,
"repo_name": "sayoun/workalendar",
"id": "db7c35ce3b0508f5cfecad51bf0f8cacf8f2a466",
"size": "4... |
from collections import OrderedDict
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render
from django.template import RequestContext
from fle_site.apps.articles.models import Article
def blog_filter_page(... | {
"content_hash": "c39844806283ea076a7e41a63787ba92",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 117,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6699029126213593,
"repo_name": "jtamiace/fle-home",
"id": "71c5831f13a01b0de3751d39561b1fbd9f9df016",
"size": "2... |
"""This pip smoke test verifies dependency files exist in the pip package.
This script runs bazel queries to see what python files are required by the
tests and ensures they are in the pip package superset.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_functio... | {
"content_hash": "2506d3fe41c3e2ec85ad4d60bc79a559",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 121,
"avg_line_length": 38.578947368421055,
"alnum_prop": 0.695164468697893,
"repo_name": "aam-at/tensorflow",
"id": "60e1ae5b65623a84dbb034c18793075dc7ea00f6",
"size": "7... |
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
DESCRIPTOR = _descriptor.FileDescriptor(
name='address_book_protobuf.proto',
... | {
"content_hash": "3810707cc62402e2f467d4a0f6f0c1d7",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 654,
"avg_line_length": 33.92972972972973,
"alnum_prop": 0.7067070256491955,
"repo_name": "tongsucn/protobuf_thrift_benchmark",
"id": "f8375cd02327cba101418d5ddf554dbb983fde... |
default_app_config = 'apps.auth.apps.AuthConfig' | {
"content_hash": "04408c5e9471238a5bab5ca18916f6cc",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 48,
"avg_line_length": 48,
"alnum_prop": 0.7916666666666666,
"repo_name": "ycheng-aa/qr_server",
"id": "518062b98e5e6024507e35496f9d556822ea5763",
"size": "48",
"binary": ... |
import os.path
# ## Import required libraries
import pandas as pd
from sklearn.metrics import accuracy_score
from ludwig.api import LudwigModel
from ludwig.datasets import mnist
# create data set for predictions
test_data = {'image_path': [], 'label': []}
dataset = mnist.Mnist()
test_dir = os.path.join(dataset.proce... | {
"content_hash": "96b1d585cf1bd97c82697c67842880eb",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 91,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.6975124378109453,
"repo_name": "uber/ludwig",
"id": "2af619a4e9e14d62c41c8412bcd19bfba81ac515",
"size": "1124",
... |
try:
my_id = instance_id()
except NameError:
from serverondemand.xen import instance_id, instance_region
my_id = instance_id()
import os
import requests
username = RS_USERNAME
apikey = RS_APIKEY
payload = '{"auth": {"RAX-KSKEY:apiKeyCredentials": {"username": "%s", "apiKey": "%s"}}}' % (username, apikey)... | {
"content_hash": "40f1096eec47ec9d53803b69f1f5e3c1",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 110,
"avg_line_length": 36.476190476190474,
"alnum_prop": 0.6801566579634465,
"repo_name": "adregner/server-on-demand",
"id": "ea4740e5326c76e845a763ba7bc41dd14a778a3c",
"s... |
"""
homeassistant.components.media_player.denon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides an interface to Denon Network Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.denon/
"""
import logging
import telnetlib
from hom... | {
"content_hash": "fcdc8a72cc8f605c7df4de12fbcc587d",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 79,
"avg_line_length": 29.88888888888889,
"alnum_prop": 0.5966542750929368,
"repo_name": "nnic/home-assistant",
"id": "2853dda90ac477fa6d2ea00fbea630753ffd2500",
"size": "... |
import os
from unittest import TestCase
from test_base import PackstackTestCaseMixin
from packstack.plugins import serverprep_901
from packstack.installer.setup_controller import Controller
serverprep_901.controller = Controller()
class OSPluginUtilsTestCase(PackstackTestCaseMixin, TestCase):
def test_rhn_creds... | {
"content_hash": "257c94903f8318623a30764f97a62b8a",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 74,
"avg_line_length": 42.97435897435897,
"alnum_prop": 0.6789976133651552,
"repo_name": "slagle/packstack",
"id": "730f039d3a26045e741e09f8d156bcfe90111e96",
"size": "2301... |
import os
from django.test import override_settings
from django.utils.crypto import get_random_string
from resolwe.flow.models import Process
from resolwe.test import ProcessTestCase
class PurgeTestFieldsMixin:
"""
This class contains tests, which validate each field individually. It is used
to perform ... | {
"content_hash": "18130fb3f53a600f89f09a2263208e23",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 88,
"avg_line_length": 34.86147186147186,
"alnum_prop": 0.5340866757730038,
"repo_name": "genialis/resolwe",
"id": "cb701fb4c412d4c0ba9d039094c75f8a4165df91",
"size": "808... |
from __future__ import absolute_import, division, print_function, with_statement
import unittest
from . import util
class UtilTest(unittest.TestCase):
def test_is_in_dir(self):
self.assertTrue(util.is_in_dir("foo/bar.py", "foo"))
self.assertTrue(util.is_in_dir("foo/bar.py", "foo/"))
self... | {
"content_hash": "1e4f7a86efd1f1587a1e2dc96a7d9e49",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 80,
"avg_line_length": 31.842105263157894,
"alnum_prop": 0.6264462809917355,
"repo_name": "shs96c/buck",
"id": "c15a58c342eff9992563826b6d8b6e4ea40ae9c8",
"size": "605",
... |
from datetime import datetime
from david.ext.babel import lazy_gettext as _
from david.core.db import db, orm, func, CatLimitedQuery, UidMixin, SerializeMixin
from david.core.accounts import User
from david.core.attachment import PictureMixin
from david.lib.utils import truncate, striptags
from david.ext.views.static ... | {
"content_hash": "3998c916f7590c9006fcf9322f8b2135",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 89,
"avg_line_length": 30.23076923076923,
"alnum_prop": 0.6607294317217981,
"repo_name": "ktmud/david",
"id": "bf6fe10a64ff4d8ea3e37964d6cf08bd14a7a77d",
"size": "2374",
... |
from BTL.ConvertedMetainfo import ConvertedMetainfo
from BTL.bencode import bencode, bdecode
import os
def file_from_path(path):
assert os.path.splitext(path)[1].lower() == '.torrent'
return open(path, 'rb').read()
def metainfo_from_file(f):
metainfo = ConvertedMetainfo(bdecode(f))
return metainfo
d... | {
"content_hash": "b285df4daa9fc9a817975a4f432841d4",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 81,
"avg_line_length": 29.531645569620252,
"alnum_prop": 0.6545220745820831,
"repo_name": "sauloal/linuxscripts",
"id": "4fd8d379005fe682e498f72fe74c68835bbd65b0",
"size": ... |
import datetime
from nose.tools import eq_, ok_
import mock
from django.conf import settings
from django.contrib.auth.models import Group
from django.utils import timezone
from funfactory.urlresolvers import reverse
from airmozilla.main.models import (
Event,
EventTweet,
Location,
Approval
)
from .b... | {
"content_hash": "1ef750abed19188d23fdf5821e8109a3",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 73,
"avg_line_length": 33.27989130434783,
"alnum_prop": 0.5510737323426145,
"repo_name": "Nolski/airmozilla",
"id": "7d0a95159df5cbc528ec300be67d1538b5df8edd",
"size": "12... |
from swifpy import Dictionary, Int, Optional, Some, String
import unittest
class TestDictionary(unittest.TestCase):
def test_sample(self):
dictionary: Dictionary[String, Int] = Dictionary({'a': 2, 'b': 3, 'c': 5})
a: Optional[Int] = dictionary['a'] # Optional(2)
dictionary['d'] = 7
... | {
"content_hash": "d2381bef7964abd8262bb583b4bfa415",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 82,
"avg_line_length": 30.294117647058822,
"alnum_prop": 0.5941747572815534,
"repo_name": "koher/swifpy",
"id": "1f93fd4dea874e6a0138917c035553a59094de18",
"size": "515",
... |
from monolithe.generators.lib import TemplateFileWriter
from monolithe.lib import SDKUtils
class PackageWriter(TemplateFileWriter):
"""
"""
def __init__(self, monolithe_config):
"""
"""
super(PackageWriter, self).__init__(package="monolithe.generators.lang.html")
self.mon... | {
"content_hash": "7fd9519dbf8287a314c622d30e7978d1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 113,
"avg_line_length": 29.97222222222222,
"alnum_prop": 0.6144578313253012,
"repo_name": "nuagenetworks/monolithe",
"id": "9ebb5dc8c4f5b4d82d1d8dcdf820046324b37bef",
"size... |
from datetime import (
datetime,
timedelta,
)
import operator
import numpy as np
import pytest
import pytz
from pandas._libs.tslibs import iNaT
from pandas.core.dtypes.common import is_datetime64_any_dtype
from pandas import (
DatetimeIndex,
DatetimeTZDtype,
Index,
NaT,
Period,
Serie... | {
"content_hash": "a1b85f6b6498edd32d13729b28e1785a",
"timestamp": "",
"source": "github",
"line_count": 704,
"max_line_length": 88,
"avg_line_length": 28.136363636363637,
"alnum_prop": 0.567296042003231,
"repo_name": "pandas-dev/pandas",
"id": "e310506935729788d5edea7804d58a7087120063",
"size": "19... |
'''
The MIT License (MIT)
Portions Copyright (c) 2015-2019, The OmniDB Team
Portions Copyright (c) 2017-2019, 2ndQuadrant Limited
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restricti... | {
"content_hash": "2986b070db46289fca45628ee471d889",
"timestamp": "",
"source": "github",
"line_count": 1055,
"max_line_length": 161,
"avg_line_length": 35.4739336492891,
"alnum_prop": 0.47706078824315296,
"repo_name": "OmniDB/OmniDB",
"id": "12b3a4a492879f8dfefc571c6caf4aca8213dc2e",
"size": "3742... |
import os
dbFilename = "task_database_python.txt"
#dbPath = os.path.join( os.getenv("HOME"), dbFilename )
with open(dbFilename, "r") as myfile:
dbContents = myfile.read()
trimmedContents = dbContents.rstrip()
print(trimmedContents)
| {
"content_hash": "1ac9f94ade618879aafeb40cc1f64179",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 55,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7113821138211383,
"repo_name": "dgoldman916/nyu-python",
"id": "660a291f5bc8404d65f513efb0a2f20ee059b88c",
"size":... |
import random
import re
import string
import uuid
from oslo_config import cfg
from oslo_utils import uuidutils
import six
from sahara import conductor as c
from sahara import context
from sahara.plugins import base as plugin_base
from sahara.service import shares as shares_service
from sahara.swift import swift_helpe... | {
"content_hash": "f829ebd3edf9749265bcfa7170b5c51c",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 79,
"avg_line_length": 34.426332288401255,
"alnum_prop": 0.6326716445091969,
"repo_name": "zhangjunli177/sahara",
"id": "a1b702275237d2978e60e6de6eb3572667aa7f35",
"size":... |
import json
import time
from charmhelpers.core import hookenv
from charms.layer.apache_bigtop_base import get_package_version
from charms.layer.bigtop_zookeeper import Zookeeper
from charms.leadership import leader_set, leader_get
from charms.reactive import (
hook,
is_state,
remove_state,
set_state,
... | {
"content_hash": "76796df0f1dd8bd6798cec44e4597f46",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 77,
"avg_line_length": 34.05397727272727,
"alnum_prop": 0.6443647284558272,
"repo_name": "JunHe77/bigtop",
"id": "fe5de90537df6563fcc667c95dd62214ea7a9004",
"size": "12769... |
from __future__ import unicode_literals
from django.test import TestCase
from cms.api import add_plugin, create_page
from cms.models.placeholdermodel import Placeholder
from cmsplugin_cascade.link.plugin_base import LinkElementMixin
from cmsplugin_cascade.bootstrap3.buttons import BootstrapButtonPlugin
class ButtonWr... | {
"content_hash": "4e00d01bc8ae050a41698b8b90894757",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 113,
"avg_line_length": 56.388888888888886,
"alnum_prop": 0.680295566502463,
"repo_name": "aldryn/djangocms-cascade",
"id": "a3ca544b6d3a26233b2ae33c4afc4bfc6cac81f3",
"siz... |
from os import path
from codecs import open
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='claimchain',
version='0.3.1',
packages=["claimchain", "claim... | {
"content_hash": "eb1e64bd490f70a6f0d57375d0994800",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 26,
"alnum_prop": 0.597985347985348,
"repo_name": "gdanezis/claimchain-core",
"id": "45a368bbbfdcab59070be46be31e63e2bf03fd09",
"size": "1092",
"bi... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangocms_googlecalendar', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='googlecalendar',
name='title',... | {
"content_hash": "5d20d7b4386a2efde7fb214860eecdc7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 22.27777777777778,
"alnum_prop": 0.6084788029925187,
"repo_name": "c4sc/arividam",
"id": "34f1e095e65ec57ff5d36cdfe2732cd9d467915f",
"size": "473",
... |
import time, uuid, json, calendar
from flask import current_app
from app.forms import *
from app.lib import geo, files
from flask import request, redirect
from flask import session, render_template
from flask import make_response, abort
from flask import jsonify, Response
from rfc6266 import build_header
import mim... | {
"content_hash": "a0ed88c6a72302bed7bfd6abb1d0b153",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 83,
"avg_line_length": 31.622448979591837,
"alnum_prop": 0.585350112939658,
"repo_name": "abhigd/bigboy",
"id": "c1440ec1aa4d90d2b0a451c2ab9db568227483c2",
"size": "3099",
... |
from __future__ import unicode_literals
import unittest
import unicodedata
import epitran
class TestHungarianGeneral(unittest.TestCase):
def setUp(self):
self.epi = epitran.Epitran(u'hun-Latn')
def _assert_trans(self, src, tar):
trans = self.epi.transliterate(src)
trans = unicodedat... | {
"content_hash": "5b078daea9319391092fb21bbb36ed1b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 65,
"avg_line_length": 26.9,
"alnum_prop": 0.6344485749690211,
"repo_name": "dmort27/epitran",
"id": "d970bcaf6a2f4b0c9c7152162ad3c749c9d623e3",
"size": "851",
"binary": ... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_mamien_ancient.iff"
result.attribute_template_id = 9
result.stfName("monster_name","mamien")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "b61afb6304b1da9a261e7cddcbdacbfa",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 60,
"avg_line_length": 22.23076923076923,
"alnum_prop": 0.6920415224913494,
"repo_name": "anhstudios/swganh",
"id": "b3bf7c91c4b0a7d9e5e7b60fb0ba087e71915c1e",
"size": "434... |
from insights.parsers.networkmanager_config import NetworkManagerConfig
from insights.parsers import networkmanager_config
from insights.tests import context_wrap
import doctest
NETWORKMANAGER_CONF = """
# Configuration file for NetworkManager.
#
# See "man 5 NetworkManager.conf" for details.
#
# The directories /usr/... | {
"content_hash": "6e5e63f35fe3a92d84c67f218f12a9d9",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 93,
"avg_line_length": 40.912,
"alnum_prop": 0.7731716855690262,
"repo_name": "RedHatInsights/insights-core",
"id": "042599855f55ef6e094a62a861bfffdb02b6de7a",
"size": "51... |
import unittest
from io import StringIO
from ...worksheet import Worksheet
class TestWriteSheetFormatPr(unittest.TestCase):
"""
Test the Worksheet _write_sheet_format_pr() method.
"""
def setUp(self):
self.fh = StringIO()
self.worksheet = Worksheet()
self.worksheet._set_fileh... | {
"content_hash": "b007e57227a60bb9a754bb0fb65774f2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 58,
"avg_line_length": 24.44,
"alnum_prop": 0.6350245499181669,
"repo_name": "jmcnamara/XlsxWriter",
"id": "b2f7250e61c3705ac7fa79f8743716ea1318b14b",
"size": "824",
"bin... |
import bz2
import time
import sys
import numpy
import numpy.matlib
from splicesites.utils import create_dataset
from esvm.utils import calcroc
from esvm.experiment import crossvalidation
from esvm.mldata import init_datasetfile
def test_gc(gcfilename):
"""
Check the gc content files for conflicting labels
... | {
"content_hash": "9281081b703254816cbd8681f1da7f00",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 102,
"avg_line_length": 33.0625,
"alnum_prop": 0.6679269061121613,
"repo_name": "ratschlab/oqtans_tools",
"id": "a519891dac9397c59b39959c2752937412d4e65b",
"size": "1610",
... |
from ansible.module_utils.basic import *
import sys, os, hashlib, json, yaml
# Calculate md5 hash and return
def md5Checksum(filePath):
with open(filePath, 'rb') as fh:
m = hashlib.md5()
while True:
data = fh.read(8192)
if not data:
break
m.update... | {
"content_hash": "e77c62e5308d6daaeb64ea87d3cfd155",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 113,
"avg_line_length": 36.310344827586206,
"alnum_prop": 0.6191832858499525,
"repo_name": "shinesolutions/aem-aws-stack-builder",
"id": "90370d27f9944c65f739261729843cd7dbd8... |
from django.conf.urls import patterns, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('_1327.information_pages.views',
url(r"edit/(?P<title>[\w-]+)/$", 'edit', name='edit'),
url(r"(?P<title>[\w-]+)/$", 'view_information', name='view_information'),
)
| {
"content_hash": "c87077a689ff69019cec8bde3ab50814",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 32,
"alnum_prop": 0.6805555555555556,
"repo_name": "janno42/1327",
"id": "7c88e08f159a9fb5c3676d963099979904682e8e",
"size": "288",
"binary": false,... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.xmlstream import ElementBase, StanzaBase, ET
from sleekxmpp.xmlstream import register_stanza_plugin
class StreamFeatures(Stanza... | {
"content_hash": "04d5c514c86247439916b91a6e0b14c7",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 68,
"avg_line_length": 22.01851851851852,
"alnum_prop": 0.5693860386879731,
"repo_name": "Petraea/jsonbot",
"id": "b800011f80d7e1e642c7006fa87553be6f407fa8",
"size": "1189"... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | {
"content_hash": "331ca2e9cd2945d5160f5a7e89018d45",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 73,
"avg_line_length": 27.558823529411764,
"alnum_prop": 0.7075773745997865,
"repo_name": "datalogics/scons",
"id": "a39dd22f091a1f57ec9039cc5bb083091f3b3c14",
"size": "187... |
import logging
from gensim.corpora import TextCorpus, Dictionary
from gensim.models.doc2vec import LabeledSentence
class SeriesCorpus(TextCorpus):
def __init__(self, series, vocab=None, stem=False, bigram=None,
labels=True):
""" Create a corpus that returns one row at a time out
... | {
"content_hash": "d994bb905e55f44fc7934bfc88284db3",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 74,
"avg_line_length": 34.744680851063826,
"alnum_prop": 0.5590936925903246,
"repo_name": "cemoody/Document2Vec",
"id": "43536e31000142b3272ced2c81892dd8936b8605",
"size": ... |
"""
Copyright 2014 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | {
"content_hash": "8c7eec31d88f8a77e17ed7e5f302a848",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 79,
"avg_line_length": 37.46534653465346,
"alnum_prop": 0.6683403805496829,
"repo_name": "jmvrbanac/barbican",
"id": "ade82fe09141497d462f95ebb9e39da8bfa1ae7a",
"size": "3... |
"""Google Cloud Platform library - BigQuery UDF Functionality."""
from __future__ import absolute_import
from __future__ import unicode_literals
from past.builtins import basestring
from builtins import object
class UDF(object):
"""Represents a BigQuery UDF declaration.
"""
@property
def name(self):
retu... | {
"content_hash": "ddbc8ed9e9553e521ca3e9a2c98b06bd",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 98,
"avg_line_length": 34.63461538461539,
"alnum_prop": 0.6204886174347585,
"repo_name": "googledatalab/pydatalab",
"id": "3e4acf54e766c089ec58e2a9549de39a5eb59799",
"size... |
"""Test utils for tensorflow."""
import collections
from collections import OrderedDict
import contextlib
import functools
import gc
import itertools
import math
import os
import random
import re
import tempfile
import threading
import time
import unittest
from absl.testing import parameterized
import numpy as np
impo... | {
"content_hash": "75e86ecdebb34b0e4f38c36ab216175b",
"timestamp": "",
"source": "github",
"line_count": 3926,
"max_line_length": 145,
"avg_line_length": 34.90244523688232,
"alnum_prop": 0.6581111751698571,
"repo_name": "gautam1858/tensorflow",
"id": "653032057c4b0b8e6a8eb31e170960f3dc7a4180",
"size... |
"""
CartoDB Spatial Analysis Python Library
See:
https://github.com/CartoDB/crankshaft
"""
from setuptools import setup, find_packages
setup(
name='crankshaft',
version='0.0.01',
description='CartoDB Spatial Analysis Python Library',
url='https://github.com/CartoDB/crankshaft',
author='Data Se... | {
"content_hash": "4bde03a768b1d1938c0349524004498c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 70,
"avg_line_length": 24.319148936170212,
"alnum_prop": 0.6281714785651793,
"repo_name": "CartoDB/crankshaft",
"id": "f045b6233584d927b2545dcf5e272fe3a5da8c38",
"size": "1... |
"""
Demo platform that offers a fake thermostat.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.thermostat import ThermostatDevice
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
def setup_platform(has... | {
"content_hash": "024388fa2c7b0d0281c9107147983e18",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 74,
"avg_line_length": 29.162790697674417,
"alnum_prop": 0.6271929824561403,
"repo_name": "leoc/home-assistant",
"id": "7718299ef6a35c8384ea8d7df3e7d12b28712638",
"size": "... |
import unittest
import synapse.daemon as s_daemon
import synapse.telepath as s_telepath
from synapse.tests.common import *
class Foo:
def bar(self):
return 'baz'
class CryptoTest(SynTest):
def test_crypto_rc4(self):
dmon = s_daemon.Daemon()
dmon.share('foo',Foo())
link = d... | {
"content_hash": "e7c14f6e972ea25152623e5a6f191896",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 67,
"avg_line_length": 20.92105263157895,
"alnum_prop": 0.5874213836477987,
"repo_name": "imjonsnooow/synapse",
"id": "8c1eed2b59aaf8e0ec5f990c3d5fd7da3e706808",
"size": "7... |
#############################################################################
##
## Copyright (C) 2004-2005 Trolltech AS. All rights reserved.
##
## This file is part of the example classes of the Qt Toolkit.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as publis... | {
"content_hash": "886450f9e18aab6f8084e13171a1ab50",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 113,
"avg_line_length": 38.72826086956522,
"alnum_prop": 0.6422958181307886,
"repo_name": "cherry-wb/SideTools",
"id": "ea42df36b9564d4addaf358c1aefd4545b9c796a",
"size": ... |
from mxnet.test_utils import *
from mxnet.base import MXNetError
import pytest
from common import assertRaises
import random
import warnings
def is_scalar(var):
return False if hasattr(var, "__len__") else True
def get_result_type(call, dflt_stype):
"""Try to infer result storage type for a sparse matrix and ... | {
"content_hash": "078a8fbf34ab6bba46f51165c74ebe08",
"timestamp": "",
"source": "github",
"line_count": 2066,
"max_line_length": 139,
"avg_line_length": 48.63988383349468,
"alnum_prop": 0.49526321026967857,
"repo_name": "DickJC123/mxnet",
"id": "d82d1925ca1aadee7a9c9cefb4f4ceca746648f6",
"size": "1... |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def hist_test():
kwargs = {}
kwargs['server'] = True
print "Import small prostate dataset"
hex = h2o.import_file(h2o.locate("smalldata/logreg/prostate.csv"))
hex["AGE"].hist(**kwargs)
hex["VOL"].hist(**kwargs)
if __name__ ==... | {
"content_hash": "2afe3dc762b87c78d97fb1c31a546a17",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 20.72222222222222,
"alnum_prop": 0.5924932975871313,
"repo_name": "brightchen/h2o-3",
"id": "2797bee533826e6df60878a87393f78a6bee104d",
"size": "373"... |
from nltk.corpus import movie_reviews
from nltk.probability import FreqDist
from nltk.corpus import stopwords
from scipy import sparse
import string
import os
import sys
import re
import json
import nltk
import pdb
import time
import numpy as np
path = '../data'
class gen_graphs(object):
'''
class that gener... | {
"content_hash": "6849f869428ea7bd7a75f65d4f692838",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 134,
"avg_line_length": 33.96,
"alnum_prop": 0.46828201245162376,
"repo_name": "shashankg7/word2graph2vec",
"id": "86229ca1577893367009e8eb7e46791f98cad304",
"size": "5989... |
DEBUG = True
# Define the application directory
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
# Define the database - we are working with
# SQLite for this example
#SQLALCHEMY_DATABASE_URI = os.environ('DATABASE_URL')
#DATABASE_CONNECT_OPTIONS = {}
# Application threads. A common general assumpti... | {
"content_hash": "082a53253dd07ccf24b9f18008da09a7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 62,
"avg_line_length": 27.11111111111111,
"alnum_prop": 0.7486338797814208,
"repo_name": "kevin-hannegan/vps-droplet",
"id": "94df2542f1469fb1b5c661fe78b18d4f1bd47010",
"si... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('server', '0022_auto_20151125_1811'),
]
operations = [
migrations.AlterModelOptions(
name='updatehistoryitem',
options={'orde... | {
"content_hash": "e1af594a474fcc5fad764cfd2b4512ca",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 48,
"avg_line_length": 21.176470588235293,
"alnum_prop": 0.6027777777777777,
"repo_name": "erikng/sal",
"id": "0ec603a8b0240060c8c46ec415a0a782090c22ac",
"size": "384",
"... |
from . import base
from unittest.mock import patch
import decorators
class TestDecorators(base.BaseCase):
@patch('decorators.LOG.info')
def test_timeit_smoke_test(self, info):
@decorators.timeit
def some_task(param, **kwargs):
pass
some_task(42, option='value')
(args... | {
"content_hash": "3fb4511f557ccb779bccc2477b47c98d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 97,
"avg_line_length": 39.08695652173913,
"alnum_prop": 0.6312569521690767,
"repo_name": "elifesciences/builder",
"id": "87d904484d37e670cbfaefb4b8ccfa728d3a6106",
"size": ... |
"""S3 file system implementation for accessing files on AWS S3."""
# pytype: skip-file
from __future__ import absolute_import
from future.utils import iteritems
from apache_beam.io.aws import s3io
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystem import CompressedFile
from apache_beam... | {
"content_hash": "514a57f68a42c0eb8c027248731ec04a",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 79,
"avg_line_length": 31.36996336996337,
"alnum_prop": 0.6719990658570761,
"repo_name": "iemejia/incubator-beam",
"id": "4bb0b6b4b218293db58f32afb138be8e73f7b22e",
"size"... |
import sys
import os
from ghosting_model import GhostingModel
from flask.ext.restful import Resource, reqparse
from flask import Flask, jsonify, request, make_response
import os
from database import db
from flask.ext.security import current_user
from json import dumps
class Ghosting_resource(Resource):
def post(se... | {
"content_hash": "9cc48e2eb0d3e3217ce217c0089c6636",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 68,
"avg_line_length": 33.388888888888886,
"alnum_prop": 0.7271214642262895,
"repo_name": "wigginslab/lean-workbench",
"id": "762361104c58b7e5f9d4cefc7b51b777524fe9d3",
"si... |
"""
This module deals with managing packages installed on the host system.
It attempts to do so in a distribution-agnostic way, but actually only
support a strict set of distributions with well-known package managers.
"""
import logging
import subprocess
from .configuration import Configuration
from .utils import get... | {
"content_hash": "4dd4a3c94cd01b09b0131dc129c4ea6e",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 93,
"avg_line_length": 33.47894736842105,
"alnum_prop": 0.6305612325106116,
"repo_name": "hbeatty/incubator-trafficcontrol",
"id": "a5701036a0d7e2fdbc78997aaed0516d58663c1f"... |
import math
import bayeslite.core
from bayeslite import bql_quote_name
from bayeslite.exception import BayesLiteException as BLE
def extract_target_cols(bdb, generator, targets=None):
"""Extract target columns (helper for LL/KL query).
If targets is None, then a list of all sqlite3 quoted column names from
... | {
"content_hash": "2635e4a3e95783fd4280dfe79fc523ea",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 80,
"avg_line_length": 35.63533834586466,
"alnum_prop": 0.613777824665049,
"repo_name": "probcomp/bdbcontrib",
"id": "ef0be1aed3a483ceb457385621a0446f22acfba6",
"size": "1... |
from typing import Iterator, List
import uuid
from google.cloud import bigquery
import pytest
import authorized_view_tutorial
@pytest.fixture(scope="module")
def client() -> bigquery.Client:
return bigquery.Client()
@pytest.fixture
def datasets_to_delete(client: bigquery.Client) -> Iterator[List[str]]:
do... | {
"content_hash": "955be42a9b3f624af486b6801a1f6046",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 87,
"avg_line_length": 31.12121212121212,
"alnum_prop": 0.6484907497565725,
"repo_name": "googleapis/python-bigquery",
"id": "cae8704864eb8884d078ed9174a1c8096c3ff636",
"si... |
from __future__ import print_function
import random
import time
import sys
import threading
sys.path.append(".")
import stackimpact
agent = stackimpact.start(
agent_key = 'agent key here',
app_name = 'MyPythonApp')
def simulate_cpu_work():
for j in range(0, 100000):
random.randint(1, 1000000... | {
"content_hash": "0d0b175c651411add113e84c1a2ddc24",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 38,
"avg_line_length": 15.894736842105264,
"alnum_prop": 0.6258278145695364,
"repo_name": "stackimpact/stackimpact-python",
"id": "b8566e960912b927b5e44d4e0cb421e95f197973",
... |
import subprocess
import threading
class MKFlowSocat:
def __init__(self, port1, port2):
self.buffer = []
self.port1 = port1
self.port2 = port2
def start(self):
try:
self.alive = True
self.thread = threading.Thread(target=self.loop)
self.threa... | {
"content_hash": "71c5b8dfd67009f8d877e2200062ff90",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 103,
"avg_line_length": 27.897058823529413,
"alnum_prop": 0.5413811280969952,
"repo_name": "ukos-git/python-flowmeter",
"id": "655994303e2df69693f6c74d68ca571b374a67aa",
"s... |
import logging
import warnings
from oslo_serialization import jsonutils
from oslo_utils import strutils
from oslo_messaging.notify import notifier
class LogDriver(notifier.Driver):
"Publish notifications via Python logging infrastructure."
# NOTE(dhellmann): For backwards-compatibility with configurations... | {
"content_hash": "2de6b74775aba531dca2a9a836a01635",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 74,
"avg_line_length": 37.06666666666667,
"alnum_prop": 0.6483812949640287,
"repo_name": "ozamiatin/oslo.messaging",
"id": "7322f07b6ab6bb30416d4d94a72aefe3c57a6f59",
"size... |
"""This module tests the RDFValue implementation for performance."""
from grr.lib import test_lib
from grr.lib import type_info
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import structs as rdf_structs
from grr.proto import jobs_pb2
class StructGrrMessage(rdf_structs.RDFProtoStruct):
... | {
"content_hash": "ae5a8947277db2ea4a0c78b612eebb93",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 79,
"avg_line_length": 30.783382789317507,
"alnum_prop": 0.650472334682861,
"repo_name": "pchaigno/grr",
"id": "fc9bc5ca348bcc3c102cc53b69a5a07a7461054d",
"size": "10396",... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "photogram.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is r... | {
"content_hash": "17db95cb7af03d3f4233170f6a6642a4",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 37.38095238095238,
"alnum_prop": 0.621656050955414,
"repo_name": "KirovVerst/photogram",
"id": "051f788c9085914b950530a0a6b4f2166788eeb0",
"size": "8... |
from crawler import Crawler
class MSDManualCrawler(Crawler):
def get_p(self, url):
if 'msdmanual.pl' in url:
return 1
return 0
def filename_from_url(self, url):
return url.split('m=')[1] +'.txt'
if __name__ == '__main__':
crawler = MSDManualCrawler('http://www.ms... | {
"content_hash": "a4f2ca0cc012b3582faa79346aea0888",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 93,
"avg_line_length": 25.866666666666667,
"alnum_prop": 0.6005154639175257,
"repo_name": "eonum/medtextcollector",
"id": "084fbcce62236e67f2d6669b3079972a24cd99d9",
"size"... |
"""
idflow.Docker
"""
from __future__ import print_function
import os
import json
import getpass
class Docker:
@staticmethod
def __print_line(line):
"""
"""
try:
line = line.decode('utf-8')
except:
print("Could not decode line")
return
... | {
"content_hash": "014e802d7884718d37f2b529f5e0d10b",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 103,
"avg_line_length": 28.443181818181817,
"alnum_prop": 0.4876148621654015,
"repo_name": "VJftw/invoke-tools",
"id": "a564ece16c1aa4f5ece2613e8259501e8ca52ba4",
"size": ... |
"""
Chat object providing simple forum representation.
@author: Milos Prchlik
@contact: U{happz@happz.cz}
@license: DPL (U{http://www.php-suit.com/dpl})
"""
import time
import hlib.api
import hlib.events
import hlib.format
import hlib.pageable
impor... | {
"content_hash": "30488199bf4df1738883f16c906dbd37",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 131,
"avg_line_length": 30.09271523178808,
"alnum_prop": 0.670774647887324,
"repo_name": "happz/settlers",
"id": "c6b1e37a1c69277ded51e7ed71fd81fdd268063d",
"size": "4544"... |
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from smtplib import SMTP
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("skyline.analyzer.alerts")
"""
Create any alerter you want here. The function will be ... | {
"content_hash": "d306c77da3fccf1923822dd8e3bc6de0",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 127,
"avg_line_length": 42.06666666666667,
"alnum_prop": 0.6481774960380349,
"repo_name": "klynch/skyline",
"id": "16d6a8c6c2790e254d2ab5a7640404d6db3896eb",
"size": "3155"... |
import calendar
import datetime
import time
import requests
import uuid
import random
from django.conf import settings
import simplejson as json
from dateutil import parser
ACTIVITY_EXPIRES = 5
def get_rdio_user_data(rdio_user_key):
response = requests.post('https://services.rdio.com/api/1/get', {
'keys': rd... | {
"content_hash": "8fa88fbd3944fb6dc8e3a6ac3c263171",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 117,
"avg_line_length": 29.395147313691506,
"alnum_prop": 0.6275573374211426,
"repo_name": "mkapolka/rdiodj",
"id": "7574b1f720eb03aad9dcc340553934fe28ed20d7",
"size": "16... |
from django.apps import AppConfig
class ExtcommentsConfig(AppConfig):
name = "extcomments"
| {
"content_hash": "dac4fda88bcdf16144865c0b466abc3c",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 35,
"avg_line_length": 19.4,
"alnum_prop": 0.7731958762886598,
"repo_name": "pbanaszkiewicz/amy",
"id": "e02c2aba8a8c5b3c14e32440cc5c73c71acb55ed",
"size": "97",
"binary":... |
import os
import sys
import warnings
from itertools import chain
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
sys.path.insert(0, './wlauto/core/')
from version import get_wa_version
# happends if falling back to distutils
warnings.filterwarnings('ignore', "Unknown di... | {
"content_hash": "2402c0a655ba30e4562920a8aab131b3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 106,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6350877192982456,
"repo_name": "rockyzhang/workload-automation",
"id": "4eb13f9893d8445bf7c7ec5a28d8da334613627b",... |
"""Local file storage."""
import errno
import hashlib
import os
import shutil
import jinja2
from grow.storage import base_storage
class FileStorage(base_storage.BaseStorage):
@staticmethod
def open(filename, mode=None):
if mode is None:
mode = 'r'
return open(filename, mode=mode)
... | {
"content_hash": "4a4eb1005dc92f078d121689410c7fb6",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 79,
"avg_line_length": 27.81081081081081,
"alnum_prop": 0.5892452218982831,
"repo_name": "grow/pygrow",
"id": "217450307df80ba91346dc6d479eb31250aadf74",
"size": "3087",
... |
import os
import sys
from tools import impl
parser = impl.argparser()
parser.add_argument("-o", dest="output", action=impl.StripQuotesAction)
parser.add_argument("-test-arg", action=impl.StripQuotesAction)
(options, args) = parser.parse_known_args()
assert os.path.exists(options.test_arg), options.test_arg
# ran... | {
"content_hash": "03cb16c4367c21a0b3e80ce78bed3b6d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 73,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.7111111111111111,
"repo_name": "kageiit/buck",
"id": "963b2a50726f9ab101e461583f22d8a407c73e40",
"size": "654",
... |
"""
Auto-generated class for Cluster
"""
from .EnumClusterDriveType import EnumClusterDriveType
from .EnumClusterStatus import EnumClusterStatus
from .StorageServer import StorageServer
from . import client_support
class Cluster(object):
"""
auto-generated. don't touch.
"""
@staticmethod
def cre... | {
"content_hash": "0a1f6764127a4446a3d161800d67737a",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 107,
"avg_line_length": 36.166666666666664,
"alnum_prop": 0.6013824884792627,
"repo_name": "g8os/grid",
"id": "74c5276d2c3d7f59ca4e38c6637ce513ffdfca98",
"size": "4340",
... |
from templar.api.config import ConfigBuilder
configuration = ConfigBuilder().build()
| {
"content_hash": "d1eacf71b413d64b290fba82493cbdbc",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 44,
"avg_line_length": 42.5,
"alnum_prop": 0.8235294117647058,
"repo_name": "albert12132/templar",
"id": "aba1e4b9254b73c3bca8e0e9bca9677097b83960",
"size": "175",
"binary... |
import json
import time
import urllib
from ..auth import digest
from ..import rpc
# @gist PutPolicy
class PutPolicy(object):
scope = None # 可以是 bucketName 或者 bucketName:key
expires = 3600 # 默认是 3600 秒
callbackUrl = None
callbackBody = None
returnUrl = None
returnBody = None
endUser = None... | {
"content_hash": "d186f0e4dcbac9702300177209b2cb36",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 60,
"avg_line_length": 21.49532710280374,
"alnum_prop": 0.6630434782608695,
"repo_name": "yobin/saepy-log",
"id": "fad90198119b83037cf2e291a61902d239e63177",
"size": "2342... |
import io
import os
import sys
import random
import hashlib
import unittest
import pickle
import json
from heartbeat.exc import HeartbeatError
from heartbeat import Merkle
from GenericCorrectnessTests import GenericCorrectnessTests
class TestMerkleHelper(unittest.TestCase):
def setUp(self):
pass
... | {
"content_hash": "0708cfbd2cc80ba62be1ef9ab4b311fc",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 113,
"avg_line_length": 32.12707182320442,
"alnum_prop": 0.5800515907136715,
"repo_name": "Storj/heartbeat",
"id": "e9db05891ed0904c2ec3e3ff44bb88f27c7ee629",
"size": "714... |
import networkx as nx
from bokeh.io import show, output_file
from bokeh.models import Plot, Range1d, MultiLine, Circle, HoverTool, TapTool, BoxSelectTool
from bokeh.models.graphs import from_networkx, NodesAndLinkedEdges, EdgesAndLinkedNodes
from bokeh.palettes import Spectral4
G=nx.karate_club_graph()
plot = Plot(p... | {
"content_hash": "19e38f2f9737e7ebcca19c29a1040029",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 98,
"avg_line_length": 42.53125,
"alnum_prop": 0.7773695811903012,
"repo_name": "timsnyder/bokeh",
"id": "5c6da2e933d1924ad5f2c3042d064ffdee48102d",
"size": "1361",
"bina... |
import functools
import inspect
from .patch import monkey_patch
def wraps(wrapped):
""" a convenience function on top of functools.wraps:
- adds the original function to the wrapped function as __wrapped__ attribute."""
def new_decorator(f):
returned = functools.wraps(wrapped)(f)
returned.... | {
"content_hash": "ee5069c29bb8d3f9b98ae5a77615a31b",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 85,
"avg_line_length": 31.523809523809526,
"alnum_prop": 0.6910876132930514,
"repo_name": "Infinidat/infi.pyutils",
"id": "90e3939e5c016ee2d290480d58fb6799fc4756a2",
"size"... |
"""
Salt states to create and manage VMware vSphere datacenters (datacenters).
:codeauthor: `Alexandru Bleotu <alexandru.bleotu@morganstaley.com>`
Dependencies
============
- pyVmomi Python Module
States
======
datacenter_configured
---------------------
Makes sure a datacenter exists and is correctly configured.... | {
"content_hash": "958a0f1cd569ac812f557f1bd7f440dd",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 85,
"avg_line_length": 27.944827586206898,
"alnum_prop": 0.6184600197433366,
"repo_name": "saltstack/salt",
"id": "3bc3d1dcc02ab0e9c22f19a7f1c60862e6aafe7f",
"size": "4052... |
from __future__ import print_function, division, absolute_import
import flask
weberrors = flask.Blueprint('web_error_handlers', __name__)
| {
"content_hash": "d1f336ea5ade96e26d866731ef385b41",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 64,
"avg_line_length": 17.875,
"alnum_prop": 0.7342657342657343,
"repo_name": "bretthandrews/marvin",
"id": "f56fc0489b9754f85876803b5e3d513b6b186232",
"size": "374",
"bin... |
import argparse
import os
import sys
import lasio
def convert_version():
args = get_convert_version_parser().parse_args(sys.argv[1:])
assert os.path.isfile(args.input)
las = lasio.read(args.input, ignore_header_errors=args.ignore_header_errors)
if os.path.isfile(args.output) and not args.overwrite... | {
"content_hash": "222067bce4e34fbf7624fbfc44670af7",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 26.6046511627907,
"alnum_prop": 0.6433566433566433,
"repo_name": "kinverarity1/lasio",
"id": "085ee199b197388b27c94c892c22c6be9d56af69",
"size": "114... |
"""
Tests of simple concepts.
"""
import pytest
def test_one_equals_one():
assert 1 == 1
@pytest.mark.xfail
def test_one_equals_two():
assert 1 == 2
def test_ping(client):
res = client.get('/ping')
assert res.status_code == 200
assert res.text == 'pong'
| {
"content_hash": "57ad05348451c8daab0d601b7e66ba4a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 33,
"avg_line_length": 14.05,
"alnum_prop": 0.6192170818505338,
"repo_name": "odarbelaeze/condor-api",
"id": "9c74af75d2dc78226991afd50745eea77417c051",
"size": "281",
"b... |
from lib import actions
class SetHomeAction(actions.BaseAction):
def run(self, structure=None):
if structure:
s = self._get_structure(structure)
else:
s = self._get_default_structure()
s.away = False
return s.away
| {
"content_hash": "4fc3079374aa5f086a0e83bf9845a2cf",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 46,
"avg_line_length": 23.083333333333332,
"alnum_prop": 0.592057761732852,
"repo_name": "pinterb/st2contrib",
"id": "ce443cd588ee8680776addd22aa681007dc05292",
"size": "27... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.structure.parametercontainer import ParameterContainer
from connection import Connection
from full import FullConnection
class OwnershipViolation(Exception):
"""Exception raised when one attempts to write-access the parameters of the
SharedConnection, inst... | {
"content_hash": "161e90dd5aca872421630fa5883391b3",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 32.06153846153846,
"alnum_prop": 0.6765834932821497,
"repo_name": "rbalda/neural_ocr",
"id": "6493a32b057f634b4b06dc4bee5143ff64e2a135",
"size": "208... |
import os
import numpy as np
import pandas as pd
import sct_utils as sct
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from spinalcordtoolbox.image import Image
from config_file import config
def run_optic(fname_in, contrast, ofolder):
cmd = ['sct_get_centerline', '-i', fname_in, '-c', co... | {
"content_hash": "1e5ba2984fc5fa7d377a1e3044e5ddd9",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 118,
"avg_line_length": 37.450331125827816,
"alnum_prop": 0.5906277630415562,
"repo_name": "neuropoly/spinalcordtoolbox",
"id": "9a3bb54b47e08935983ccf578ac8c5b6fa477a3b",
... |
import logging
import logging.config
import os
from flask import Flask, render_template
from environments.environments import environments
from releases.releases import releases
app = Flask(__name__)
app.config.from_object("observatory.settings")
for setting, value in app.config.iteritems():
if setting in os.en... | {
"content_hash": "e261240220fecd1719908883cb0a9510",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 64,
"avg_line_length": 27.92,
"alnum_prop": 0.7679083094555874,
"repo_name": "lonnen/observatory",
"id": "8f92029608a76314a0742c509d2cda79c43a52d7",
"size": "698",
"binar... |
def reverse_sentence(string):
string_list = string.split() # split string by word into list
output = ' '.join([word[::-1] for word in string_list]) # reverse each element/word in list and consolidate into single string
print output
# test cases
test = "Hey dude!"
reverse_sentence(test)
test2 = "dude"
reverse_sente... | {
"content_hash": "fec0b80fb6666d00354fc2590b073bff",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 127,
"avg_line_length": 30.09090909090909,
"alnum_prop": 0.7280966767371602,
"repo_name": "derekmpham/interview-prep",
"id": "1c8ca4faef1bf67268e3507f026983677189f28a",
"si... |
import uuid
import mock
import six
import webob
from nova.api.openstack.compute import floating_ips as fips_v21
from nova.api.openstack.compute.legacy_v2.contrib import floating_ips \
as fips_v2
from nova.api.openstack import extensions
from nova import compute
from nova.compute import utils as compute_utils
... | {
"content_hash": "c61008d6249001f5cbad1f701e74f549",
"timestamp": "",
"source": "github",
"line_count": 889,
"max_line_length": 78,
"avg_line_length": 41.87739032620922,
"alnum_prop": 0.5870423594509656,
"repo_name": "apporc/nova",
"id": "67f4b42a76c73b2cc8aed8fd741bc470de86e46f",
"size": "37919",
... |
"""
Invoke tasks helper functions
=============================
"""
import logging
import os
log = logging.getLogger(__name__) # pylint: disable=invalid-name
def download_file(
url,
local_filepath,
chunk_size=1024*512,
lock_timeout=10,
http_timeout=None,
session=None
... | {
"content_hash": "0abfbc578cb1bde092b29c97cfb554dd",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 86,
"avg_line_length": 32.96491228070175,
"alnum_prop": 0.5875465673230442,
"repo_name": "frol/flask-restplus-server-example",
"id": "29553dab4b128e5bf7fd827ff4f720d7d98d1909... |
from lang import lang
from framework import framework
from header import headers
from cms import cms
from server import server
from waf import waf
from os import os
from lib.net import http
from lib.net import utils
from lib.utils import printer
class CheckAll():
""" Docstring for CheckAll """
def __init__(self,url,... | {
"content_hash": "6571bc75a94b8b2625587cdf67a03984",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 69,
"avg_line_length": 27.263157894736842,
"alnum_prop": 0.6531531531531531,
"repo_name": "Yukinoshita47/Yuki-Chan-The-Auto-Pentest",
"id": "2e23a61215399e78fd9f010a5f93cf913... |
'''run_client.py - An example client using the python socket implementation of
the Google Protocol Buffers.
This module is an executable script demonstrating the usage of the python socket
implementation of the Google Protocol Buffers. To work correctly, the script
requires a server to be running first (i.e. run_serve... | {
"content_hash": "aec4d1b78d451ade1838e895e590b0df",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 80,
"avg_line_length": 26.725,
"alnum_prop": 0.7090739008419084,
"repo_name": "nowelium/protobuf-socket-rpc",
"id": "c5eab9607d97ec9d75ef72b3f31012e210e7c168",
"size": "220... |
import os
import sys
import glob
import pep8
from pyflakes.scripts import pyflakes
def findpy(path):
for cfile in glob.glob(os.path.join(path, '*')):
if os.path.isdir(cfile):
for py in findpy(cfile):
yield py
if cfile.endswith('.py'):
yield cfile
def chec... | {
"content_hash": "00bde1e4c4fef72a4726d5bd84829416",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 68,
"avg_line_length": 23.867924528301888,
"alnum_prop": 0.5754940711462451,
"repo_name": "oubiwann/workerpool",
"id": "e526f696df5ff213fc807ba581b0bc496573b4b9",
"size": "... |
import random
import numpy as np
from six.moves import xrange
import tensorflow as tf
from tensorflow.contrib import rnn, seq2seq
from tensorflow.python.layers.core import Dense
import special_vocab as config
import util.vocabutils as vocab_utils
class ChatbotModel(object):
def __init__(self, vocab_size, hidden_s... | {
"content_hash": "a7a86e785471dd7fa6f6742ce70f4c1f",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 124,
"avg_line_length": 44.94827586206897,
"alnum_prop": 0.5684695051783659,
"repo_name": "wangcan04/chatbot",
"id": "f6a3b3147ec9d8d99fd12e02709d5555903ca4ed",
"size": "7... |
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals)
from builtins import *
def {{cookiecutter.cli_entry_point_function_name }}():
""" Command-line entry point for {{ cookiecutter.repo_name }} """
print('{{ cookiecutter.repo_name }} placeholder CLI entry point'... | {
"content_hash": "96284a8ae90f8187e2ba49d3a91ae57a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 69,
"avg_line_length": 29.5,
"alnum_prop": 0.6593220338983051,
"repo_name": "DC23/cookiecutter-dcpypackage",
"id": "2c57d04ccba195df63cd6202e8e28fa948364848",
"size": "662"... |
import os
import stat
import config
import MySQLdb
def regenerate_keys():
db = None
try:
db = MySQLdb.connect(host=config.val('db.host'),
user=config.val('db.user'),
passwd=config.val('db.pwd'),
db=config.val('db.nam... | {
"content_hash": "3d0ad7ec759e111cda76a3eda37e49bf",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 85,
"avg_line_length": 33.96,
"alnum_prop": 0.5512367491166078,
"repo_name": "Etenil/anvil",
"id": "1e1fc2f30c0c2677fef900df3b8e65b8ec35e0b0",
"size": "849",
"binary": fa... |
"""The Met Office integration."""
from __future__ import annotations
import asyncio
import logging
import re
from typing import Any
import datapoint
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_API_KEY,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_NAME,
Platf... | {
"content_hash": "6416da88270286075481dc0bfe32e4c1",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 88,
"avg_line_length": 30.919254658385093,
"alnum_prop": 0.6597026918441141,
"repo_name": "mezz64/home-assistant",
"id": "057947d76e478bb10ea7aeb3c68508190f598df3",
"size"... |
from .Command import Command
class Init(Command):
command = 'init'
help = "Initialize new document repository"
def set_args(self, subparser):
subparser.add_argument("--force", help="Overwrite existing document repository", action='store_true')
def run(self, args):
from ..Database impo... | {
"content_hash": "fdc4bbc727b25a9d73ec70f65d98ef03",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 109,
"avg_line_length": 33.083333333333336,
"alnum_prop": 0.690176322418136,
"repo_name": "tmearnest/sbd",
"id": "8b71ca45a1f47fa3ed165f7c221a0286060f7311",
"size": "397",
... |
import io
import os
import pytest
from dvc.command.experiments import CmdExperimentsInit
from dvc.exceptions import DvcException
from dvc.main import main
from dvc.repo.experiments.init import init
from dvc.stage.exceptions import DuplicateStageName
# the tests may hang on prompts on failure
pytestmark = pytest.mark... | {
"content_hash": "db479068891a91e7c077b7e0975c77cd",
"timestamp": "",
"source": "github",
"line_count": 449,
"max_line_length": 79,
"avg_line_length": 29.14476614699332,
"alnum_prop": 0.49335167354424575,
"repo_name": "dmpetrov/dataversioncontrol",
"id": "05bf99bab83059206ac3e78d8ec1295c407dd71d",
... |
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Question'
db.create_table('questions_question', (
('id', self.gf('django.db.models.fields.AutoField')(
primary_key=True)),
... | {
"content_hash": "a1b4df0ffa6c9536ec55f055901abefb",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 71,
"avg_line_length": 37.975,
"alnum_prop": 0.5016458196181699,
"repo_name": "reinbach/tutorus",
"id": "369d7b6b0d8baf7b533332f5a64e547db3cae03c",
"size": "1543",
"binar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.