text stringlengths 4 1.02M | meta dict |
|---|---|
import platform
import re
# Platform identification constants.
UNKNOWN = 0
RASPBERRY_PI = 1
BEAGLEBONE_BLACK = 2
MINNOWBOARD = 3
def platform_detect():
"""Detect if running on the Raspberry Pi or Beaglebone Black and return the
platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or U... | {
"content_hash": "7b3c52079db3264f852ce39893ab771c",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 105,
"avg_line_length": 36.174418604651166,
"alnum_prop": 0.6174863387978142,
"repo_name": "steelee/minnow_max_maker",
"id": "a97030938b35ad092b2493a9c39f794cfa45357f",
"si... |
try:
from itertools import izip as zip
except ImportError: # will be 3.x series
pass
from collections import Counter
import subprocess
import logging
def grouper(iterable, n, padvalue=None):
"""
Group interable into chunks of size n
Removes last group if shorter than n
grouper('abcdefg', 3) --... | {
"content_hash": "31b53a3376b9a475b99cc679018e11f4",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 110,
"avg_line_length": 30.03676470588235,
"alnum_prop": 0.5263157894736842,
"repo_name": "Curly-Mo/mir-tools",
"id": "2795a50c3315faa0bdef2f842b0a837c387f49fd",
"size": "... |
"""A set of common utilities used within the environments. These are
not intended as API functions, and will not remain stable over time.
"""
# These submodules should not have any import-time dependencies.
# We want this since we use `utils` during our import-time sanity checks
# that verify that our dependencies are... | {
"content_hash": "238879b630095af788e73c76adaa0820",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 72,
"avg_line_length": 43,
"alnum_prop": 0.7930232558139535,
"repo_name": "hparik11/Deep-Learning-Nanodegree-Foundation-Repository",
"id": "6d6aa82efb71d0d84bc742ffa6747697d8... |
import asyncio
from pytest import fixture
from analyzer.storages import BaseStorage
LOOP = asyncio.get_event_loop()
class SimpleObj:
def __init__(self, key, unique, not_unique):
self.key = key
self.unique = unique
self.not_unique = not_unique
def __eq__(self, other):
return... | {
"content_hash": "3768d7ab52d11388d2db785f91a41d47",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 108,
"avg_line_length": 24.50980392156863,
"alnum_prop": 0.5336,
"repo_name": "peterVorman/apartments-analyzer",
"id": "01bd792f79a17bb9052afa1c8134ebdc3fc256df",
"size": "... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_time_period import TapiCommonTimePeriod # noqa: F401,E501
from tapi_server import util
class Tapi... | {
"content_hash": "72842bf52a5fe0f3c6113729c1b54173",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 96,
"avg_line_length": 28.630769230769232,
"alnum_prop": 0.6389038151531434,
"repo_name": "OpenNetworkingFoundation/ONFOpenTransport",
"id": "3a62ea24a4bcb659a4c6a93b161cf123... |
from copy import deepcopy
from django.utils import simplejson
__all__ = ['hungarian_to_python', 'lookupattr']
def dumpjs(obj, *args, **kwargs):
"""Dump a Python object as Javascript, with support for a __json__ method."""
class Encoder(simplejson.JSONEncoder):
def iterencode(self, o, _one_shot=False):... | {
"content_hash": "1f34777ab8a85ca3c3d1a26157dbe0e5",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 84,
"avg_line_length": 34.990196078431374,
"alnum_prop": 0.5508545811151583,
"repo_name": "stavrik/test",
"id": "192bc136739a529f1ba5d91161a07603715e8c40",
"size": "3578",... |
from os.path import abspath
import urlparse
from urlparse import urlsplit
from coherence.extern.et import parse_xml as et_parse_xml
from coherence import SERVER_ID
from twisted.web import server, http, static
from twisted.web import client, error
from twisted.web import proxy, resource, server
from twisted.internet ... | {
"content_hash": "9a1bc5e0d26e55cdae3485ce342e4c3d",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 102,
"avg_line_length": 31.384615384615383,
"alnum_prop": 0.5764046003016591,
"repo_name": "ismaelgaudioso/Coherence",
"id": "c3db2a84f788ab7ecd84ece5180ebd26b3fa53b4",
"s... |
"""
Zabbix Server external inventory script.
========================================
Returns hosts and hostgroups from Zabbix Server.
Configuration is read from `zabbix.ini`.
Tested with Zabbix Server 2.0.6.
"""
from __future__ import print_function
import os, sys
import argparse
import ConfigParser
try:
fro... | {
"content_hash": "b44151a59fb3673b3144194e2168c71f",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 114,
"avg_line_length": 28.74576271186441,
"alnum_prop": 0.5701650943396226,
"repo_name": "abtreece/ansible",
"id": "28b643bca630270ca5197f36024529dce8871476",
"size": "41... |
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AnswerPart',
... | {
"content_hash": "9adf3c9a9bc445b8c6788c43837f6ec0",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 307,
"avg_line_length": 57.11888111888112,
"alnum_prop": 0.5661728697355534,
"repo_name": "deka108/meas_deka",
"id": "985e070c0509253a4d466b288e4510e3608a41f0",
"size": "1... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
# Create your models here.
class Trip(models.Model):
route_id = models.ForeignKey('routes.Route', verbose_name=_(u'Route ID'))
service_id = models.ForeignKey('schedule.Calendar', verbose_name=_(u'Service ID'))
trip_id = m... | {
"content_hash": "d5e05a5752ffe26bc2bb809ab0b7dcfa",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 132,
"avg_line_length": 44.30555555555556,
"alnum_prop": 0.6294670846394984,
"repo_name": "renanalencar/hermes",
"id": "1bb276a10b2fc8e8bcc36b737dc40ca1b4e5cc6e",
"size": "... |
"""Test the Google Maps Travel Time config flow."""
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.google_travel_time.const import (
ARRIVAL_TIME,
CONF_ARRIVAL_TIME,
CONF_AVOID,
CONF_DEPARTURE_TIME,
CONF_DESTINATION,
CONF_LANGUAGE,
CONF_OPTIONS,
C... | {
"content_hash": "c62115e019f0f243b68869da081c6900",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 87,
"avg_line_length": 32.138047138047135,
"alnum_prop": 0.5858564693556836,
"repo_name": "adrienbrault/home-assistant",
"id": "64dc77903ff514c66c6ce5f686ba61abdddb9af5",
... |
"""
This module implements a model checkpoint loader and writer.
"""
import os
import tensorflow as tf
from niftynet.engine.application_variables import global_vars_init_or_restore
from niftynet.engine.signal import \
ITER_FINISHED, SESS_FINISHED, SESS_STARTED
from niftynet.io.misc_io import touch_folder
FILE_PR... | {
"content_hash": "7feab854c245cf1e7618ba4b1c1d034d",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 78,
"avg_line_length": 34.076142131979694,
"alnum_prop": 0.5694920303887978,
"repo_name": "NifTK/NiftyNet",
"id": "5f7af91cc6f2864934ff92fbd0a4086731dd61c9",
"size": "6737... |
from ..broker import Broker
class UploadedCertificateBroker(Broker):
controller = "uploaded_certificates"
def index(self, **kwargs):
"""Lists the available uploaded certificates. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to query lis... | {
"content_hash": "7a7466784025cd39bd230c23435fc307",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 350,
"avg_line_length": 37.443661971830984,
"alnum_prop": 0.53836750047019,
"repo_name": "infobloxopen/infoblox-netmri",
"id": "e3a5360831ecba8151b93505353bfcc837d2a7a7",
... |
"""Iteration over tf.data.Datasets when eager execution is enabled."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.experimental.ops import prefetching_ops
from tensorflow.python.data.ops import iterator_ops
from tensorflow.py... | {
"content_hash": "7d9e6532d4dd7f0b2b0e18ba03d8d3e4",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 105,
"avg_line_length": 36.417910447761194,
"alnum_prop": 0.6967213114754098,
"repo_name": "girving/tensorflow",
"id": "3aed121233be1268531495a2fa83fd323412e1fd",
"size": "... |
import cv2
from plantcv.plantcv import analyze_thermal_values, outputs
def test_analyze_thermal_values(test_data):
"""Test for PlantCV."""
# Clear previous outputs
outputs.clear()
# Read in test data
mask = cv2.imread(test_data.thermal_mask, -1)
img = test_data.load_npz(test_data.thermal_obj_f... | {
"content_hash": "e8f0a757c42ff97605b26c37720e80b4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 36.92307692307692,
"alnum_prop": 0.7020833333333333,
"repo_name": "danforthcenter/plantcv",
"id": "30b5efd1f908564169985d04bf730ffb5e5951b0",
"size":... |
from page_sets.system_health import system_health_story
from telemetry import decorators
@decorators.Disabled('win') # crbug.com/656040
class BlankAboutBlankStory(system_health_story.SystemHealthStory):
"""Story that loads the about:blank page."""
NAME = 'blank:about:blank'
URL = 'about:blank'
def _DidLoadD... | {
"content_hash": "f4701f76e436de6a0de8752ab48b6c4a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 32.56521739130435,
"alnum_prop": 0.6955941255006676,
"repo_name": "Samsung/ChromiumGStreamerBackend",
"id": "dbfd385d95b4fe79f3f980b86d4a86994cc96e0e",... |
"""
Inicialització.
"""
from .test import TestService # noqa
| {
"content_hash": "430617c8a38ea43b4d5d4676f2918cf3",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 37,
"avg_line_length": 12.6,
"alnum_prop": 0.6825396825396826,
"repo_name": "sisap-ics/sidiap",
"id": "86d3a76010ca50a9fdf2c975a102c3bf4236c899",
"size": "88",
"binary": f... |
'''
'''
import os
ROOT_DIR = os.getcwd()
HOMEPATH = '../../..'
ResultFile = '../../result.txt'
IOTIVITY_DIR = HOMEPATH+'/IotivityOrgSource/target/iotivity'
TC_BUILD_DIR = HOMEPATH+'/IotivityOrgSource/target/iotivity/test'
IOTIVITY_BUILD_COMMAND_LINUX_RC ='scons TARGET_OS=linux'
ORGSOURCEPATH = HOMEPATH + '/Iotivity... | {
"content_hash": "bda856b91762cde287bf7f9a33052737",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 65,
"avg_line_length": 23.553846153846155,
"alnum_prop": 0.7250163291966035,
"repo_name": "rzr/iotivity",
"id": "b0e4415e147117ab5e0ca5549be53261db38d7f9",
"size": "2300",
... |
"""tornado.options enhancement"""
import io
import traceback
import os
from tornado.options import parse_command_line, options, define
def parse_config_file(filename):
"""Rewrite tornado default parse_config_file.
Parses and loads the Python config file at the given filename.
This version allow customi... | {
"content_hash": "a90bb566cc7e154eab657cb26a69b417",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 107,
"avg_line_length": 31.477272727272727,
"alnum_prop": 0.6483754512635379,
"repo_name": "palmhold/djinn",
"id": "36da52f815f6e91b2c5d5830c4fb745d4f3144c6",
"size": "1991... |
from __future__ import unicode_literals
from unittest import skipIf
from django.db import connection, models
from django.test import TestCase
from .models import Post
class TextFieldTests(TestCase):
def test_max_length_passed_to_formfield(self):
"""
TextField passes its max_length attribute to... | {
"content_hash": "7942d801cfbc737e4fea4c04ca4a45ad",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 96,
"avg_line_length": 32.4,
"alnum_prop": 0.6587301587301587,
"repo_name": "erikr/django",
"id": "a3cd516cb4d1b1f41ef43205e3799a1d20735c0b",
"size": "1164",
"binary": fa... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration... | {
"content_hash": "b4bf0391a1ca3be37c001f37c60649e5",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 32.014150943396224,
"alnum_prop": 0.6863120671872698,
"repo_name": "hyperion-rt/hyperion",
"id": "53be2228ed901362c8a931ba1a1a7420a7c2f4be",
"size":... |
from __future__ import print_function
import codecs
import inspect
import json
import logging
import os
import re
import progressbar
from indic_transliteration import sanscript
from sanskrit_parser.base.sanskrit_base import SanskritObject
from sanskrit_parser.lexical_analyzer.sanskrit_lexical_analyzer import Sanskrit... | {
"content_hash": "7aa9c5b68548dc4b36496e1d2441f995",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 138,
"avg_line_length": 39.985849056603776,
"alnum_prop": 0.45287247847115725,
"repo_name": "kmadathil/sanskrit_parser",
"id": "1a77a80286e4f6b83bf024b735482b3f1784627b",
... |
from conary.repository import changeset
| {
"content_hash": "ae191b1e05e14d11cfcf9b38e676fec8",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 39,
"avg_line_length": 40,
"alnum_prop": 0.875,
"repo_name": "sassoftware/conary",
"id": "b68389422fe67fa45cac70739f04ea66cd5c3b17",
"size": "652",
"binary": false,
"cop... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
# initialize MessageLogger and output report
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.threshold = 'INFO'
process.MessageLogger.categories.append('Demo')
process.MessageLogger.cerr.INFO = cms.untracked.PSet(... | {
"content_hash": "e12bad63c8ff8df2a3e947482041f89e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 80,
"avg_line_length": 31.757575757575758,
"alnum_prop": 0.7509541984732825,
"repo_name": "diana-hep/c2numpy",
"id": "e9afb86f3cde818297ed6bc725cd9147719e6778",
"size": "10... |
"""
Write a program that randomizes a number
and prints the sum total of its digits.
For example if the number was: 2345
The result should be: 14
"""
from random import randint
num = randint(1,9999)
print "Starting with: %d" % num
# Numeric calculation
num_i = num
sum_d = 0
while num_i != 0:
digit = num_i % 10
... | {
"content_hash": "8a31971aaff90d5ea4713427f8989f89",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 40,
"avg_line_length": 17,
"alnum_prop": 0.6607843137254902,
"repo_name": "nonZero/python-examples",
"id": "cb194f9331d7b94c63ba5e35b78c62bdded8029d",
"size": "510",
"bin... |
import logging
import openerp
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
class pos_config(osv.osv):
_inherit = 'pos.config'
_columns = {
'discount_pc': fields.float('Discount Percentage', help='The discount percentage'),
'discount_prod... | {
"content_hash": "eef792f015faefff70b6228e560a8b00",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 132,
"avg_line_length": 27.166666666666668,
"alnum_prop": 0.6768916155419223,
"repo_name": "diogocs1/comps",
"id": "f8d24eb638bae28752342b5ef967e7863dc37f8f",
"size": "1468... |
import functools
import json
import optparse
import tempfile
import unittest
from webkitpy.common.system.executive import ScriptError
from webkitpy.common.system.executive_mock import MockExecutive
from webkitpy.common.system.output_capture import OutputCapture
from webkitpy.common.system.platform_info_mock import Moc... | {
"content_hash": "f5f8d088f91d587243c03b08ea7b8371",
"timestamp": "",
"source": "github",
"line_count": 615,
"max_line_length": 130,
"avg_line_length": 50.895934959349596,
"alnum_prop": 0.6290533848758826,
"repo_name": "youtube/cobalt",
"id": "44b772a621ab7a9c88b77dc340f3a97fa28190e8",
"size": "328... |
from gi.repository import GObject, Gtk, GdkPixbuf
from gettext import gettext as _
from sugar3.graphics.palette import Palette
from sugar3.graphics.palettemenu import PaletteMenuBox
from sugar3.graphics.palettemenu import PaletteMenuItem
from sugar3.graphics.tray import TrayButton
import constants
import utils
class... | {
"content_hash": "c36f7ae5321aea43c968abb1432e5b4e",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 77,
"avg_line_length": 32.62626262626262,
"alnum_prop": 0.5770897832817338,
"repo_name": "godiard/record-activity",
"id": "1ef42d3ccb1f490d79f942e4bb7466599ccf9b13",
"size"... |
"""
Support for typing ctypes function pointers.
"""
from __future__ import absolute_import
import ctypes
import sys
from numba import types
from . import templates
from .typeof import typeof_impl
CTYPES_MAP = {
None: types.none,
ctypes.c_bool: types.boolean,
ctypes.c_int8: types.int8,
ctypes... | {
"content_hash": "7b43debc89e94d55c9c492c08cbcd1f6",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 80,
"avg_line_length": 26.775280898876403,
"alnum_prop": 0.6437263953000419,
"repo_name": "pombredanne/numba",
"id": "a3a94fc37ee34cac400833503f2214a6b05e7ef0",
"size": "23... |
"""
Query subclasses which provide extra functionality beyond simple data retrieval.
"""
from django.core.exceptions import FieldError
from django.db.models.sql.constants import *
from django.db.models.sql.datastructures import Date
from django.db.models.sql.query import Query
from django.db.models.sql.where import AN... | {
"content_hash": "a888472bb05f0c4467f880d5b6acb3cf",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 121,
"avg_line_length": 40.494923857868024,
"alnum_prop": 0.5818238796615481,
"repo_name": "hugs/django",
"id": "5ca041cbded64e7db61a93280ccedd7e30efb192",
"size": "15955"... |
__author__ = 'Joe Linn'
import json
import pylastica.index
class Action(object):
OP_TYPE_CREATE = 'create'
OP_TYPE_INDEX = 'index'
OP_TYPE_DELETE = 'delete'
OP_TYPE_UPDATE = 'update'
def __init__(self, op_type=OP_TYPE_INDEX, metadata=None, source=None):
"""
@param op_type: see O... | {
"content_hash": "be16a4b8dcba354c7dc62a52ad5a6ae8",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 77,
"avg_line_length": 20.936842105263157,
"alnum_prop": 0.49019607843137253,
"repo_name": "jlinn/pylastica",
"id": "6975ca021bb1ee9a2dd56230281a83ed0a22ec9c",
"size": "39... |
import os, struct, numpy
dB_MIN = -80.
PWI_THS = 60.
PW_MIN = PWI_THS * (10.** (dB_MIN / 20.))
class SpectrumBase(object):
'''Base type of spectrums'''
def __init__(self, audio):
self.audio = audio
def walk(self, win, step, start, end, join_channels):
'''Generator of spectrum frames'''
... | {
"content_hash": "2b9e0b8c6f0730c2035d521abfb88efd",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 67,
"avg_line_length": 28.156626506024097,
"alnum_prop": 0.5126230209670518,
"repo_name": "dongying/dear",
"id": "0209b0e0ce297c4715a34fd10dee27dd9a1100ab",
"size": "2361",... |
from appdirs import *
#---- self test code
if __name__ == "__main__":
print("applib: user data dir: %s" % user_data_dir("Komodo", "ActiveState"))
print("applib: site data dir: %s" % site_data_dir("Komodo", "ActiveState"))
print("applib: user cache dir: %s" % user_cache_dir("Komodo", "ActiveState"))
| {
"content_hash": "3adab6b61d917800f769e9ecbd9881ce",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 81,
"avg_line_length": 31.6,
"alnum_prop": 0.6139240506329114,
"repo_name": "ActiveState/applib",
"id": "dc6412ef7d6b9b28224865f14881e9056368ebfc",
"size": "414",
"binary... |
"""Ancient Greek phonology
"""
| {
"content_hash": "ed1bcb5a0a4fdc562bb16973f98beb91",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 26,
"avg_line_length": 15.5,
"alnum_prop": 0.6774193548387096,
"repo_name": "diyclassics/cltk",
"id": "30d626a43530018424b9c20a366816e24c8fa51f",
"size": "31",
"binary": f... |
from __future__ import absolute_import
import sys
from google.api_core.protobuf_helpers import get_messages
from google.api import http_pb2
from google.cloud.videointelligence_v1p1beta1.proto import video_intelligence_pb2
from google.longrunning import operations_pb2
from google.protobuf import any_pb2
from google.pr... | {
"content_hash": "8bfa54573ff20196e68f44e3f5614df0",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 81,
"avg_line_length": 27.162790697674417,
"alnum_prop": 0.7226027397260274,
"repo_name": "jonparrott/gcloud-python",
"id": "8bd345a758d4c0deec392d3cc731d3233a908c96",
"siz... |
from django.contrib.syndication.views import Feed
from blog.models import Post
from django.core.urlresolvers import reverse
class BlogLatestEntries(Feed):
title = "Thiago Pagonha"
link = "/blog/"
description = "Últimas notícias no blog."
def items(self):
return Post.objects.filte... | {
"content_hash": "f56295d955ac7ba413cea77b38c36f0e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 59,
"avg_line_length": 29,
"alnum_prop": 0.656896551724138,
"repo_name": "thiagopa/thiagopagonha",
"id": "af38394f7a3aec1d507bb271ffd65b336baea8d3",
"size": "606",
"binar... |
"""Server Version Class."""
import logging
class ServerVersion(object): # Can't import APIClassTemplate due to dependency loop.
"""
Get the FMC's version information.
Set instance variables for each version info returned as well as return the whole response text.
:return: requests' response.text
... | {
"content_hash": "4d977cf009c2f08083ff8ed2fee2fe0f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 106,
"avg_line_length": 33.046875,
"alnum_prop": 0.6146572104018913,
"repo_name": "daxm/fmcapi",
"id": "b76d56baa7359eeb8a5dc23f125b97f579005a2e",
"size": "2115",
"binary... |
"""Tests for tf.keras models using DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl.testing import parameterized
import numpy as np
from tensorflow.contrib.distribute.python import combinations
from tensorflow.con... | {
"content_hash": "04bad8d52e20f4d8e31b33f7785dc660",
"timestamp": "",
"source": "github",
"line_count": 1015,
"max_line_length": 80,
"avg_line_length": 41.70147783251232,
"alnum_prop": 0.6219198147754389,
"repo_name": "alshedivat/tensorflow",
"id": "f8714b52b23f96379db8a793e6ecd4daf3a9adbe",
"size"... |
from flask import Blueprint
blueprint = Blueprint(
'opportunities', __name__, url_prefix='/beacon',
static_folder='../static', template_folder='../templates'
)
from . import views
| {
"content_hash": "dab562ab42ae363e1f14d6ce09607cbb",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 61,
"avg_line_length": 23.75,
"alnum_prop": 0.6842105263157895,
"repo_name": "codeforamerica/pittsburgh-purchasing-suite",
"id": "a00ee71db666dd7185b215b5538d7cb5ff59b029",
... |
from __future__ import absolute_import
from __future__ import print_function
import copy
import six
import ujson
from django.utils.translation import ugettext as _
from django.conf import settings
from importlib import import_module
from six.moves import filter, map
from typing import (
Any, Dict, Iterable, Optio... | {
"content_hash": "77e37766ea1fd705bd5f624f8988cb76",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 122,
"avg_line_length": 49.92670157068063,
"alnum_prop": 0.578125,
"repo_name": "sonali0901/zulip",
"id": "8b7dc3cf17b7c0c867df61837e99e4cf27cff88e",
"size": "19192",
"b... |
from .. import NextGenInstanceResource, NextGenListResource
class Activity(NextGenInstanceResource):
"""
An Activity resource
"""
def delete(self):
"""
Delete an activity.
"""
return self.parent.delete_instance(self.name)
def update(self, **kwargs):
"""
... | {
"content_hash": "2d0296165c9174b286a42757afdee111",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 79,
"avg_line_length": 30.894736842105264,
"alnum_prop": 0.6042021578648495,
"repo_name": "Gchorba/Ask",
"id": "ea1c502d5312a59a7e241dc509eaf225f770652d",
"size": "1761",
... |
"""Tests for V2 LSTM layer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import time
from absl.testing import parameterized
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf impo... | {
"content_hash": "36e3ca35bc7f519fe4ed5912697a598e",
"timestamp": "",
"source": "github",
"line_count": 1111,
"max_line_length": 80,
"avg_line_length": 35.344734473447346,
"alnum_prop": 0.6502241010492004,
"repo_name": "aldian/tensorflow",
"id": "c0f41b4bf7ccc61d62f99fac8023d791ecf800b9",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('question', '0010_checkin_coach_response'),
]
operations = [
migrations.AlterField(
model_name='checkin',
name='coach_respons... | {
"content_hash": "411205e7830ad4e8dfe29c46bef101a9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 52,
"avg_line_length": 21.555555555555557,
"alnum_prop": 0.6005154639175257,
"repo_name": "airportmarc/the416life",
"id": "16d09b78b12bc859151a4a10e0f8d7588e04837f",
"size"... |
from libcloud.types import Provider
from libcloud.providers import get_driver
EC2 = get_driver(Provider.EC2_US_EAST)
Slicehost = get_driver(Provider.SLICEHOST)
Rackspace = get_driver(Provider.RACKSPACE)
drivers = [ EC2('access key id', 'secret key'),
Slicehost('api key'),
Rackspace('username... | {
"content_hash": "1a402113f43af8f4b999fed57e0f0cc1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 30.227272727272727,
"alnum_prop": 0.6766917293233082,
"repo_name": "alex/libcloud",
"id": "d501a597626a920809b0a644015c3fd0b49b4752",
"size": "1451",... |
import httplib
import math
import os
import subprocess
import sys
import yaml
from optparse import OptionParser
def parse_time(timestr):
mul = 0.001
timestr = unicode(timestr.strip().lower())
if timestr[-1] == 's':
mul = 1
timestr = timestr[:-1]
if timestr[-1] == 'c':
mul = 0.01... | {
"content_hash": "ab78f115c31281395d761ff2779cdb3f",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 112,
"avg_line_length": 34.20338983050848,
"alnum_prop": 0.5681367690782954,
"repo_name": "zielmicha/satori",
"id": "2068f3f11d4f52a0d37cda5ad321236ba78358d2",
"size": "93... |
"""
Django settings for core project.
Generated by 'django-admin startproject' using Django 2.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
# Bu... | {
"content_hash": "6aa9cfc3f33158cd913863cf670417b2",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 91,
"avg_line_length": 25.3739837398374,
"alnum_prop": 0.6802306952899712,
"repo_name": "c0ntribut0r/django-mptt-urls",
"id": "f06c6e74da6e5082215432ecb50a0c00aa182e05",
"... |
"""
FILE: sample_conv_summarization_async.py
DESCRIPTION:
This sample demonstrates how to analyze a conversation for issue resolution.
For more info about how to setup a CLU conversation project, see the README.
USAGE:
python sample_conv_summarization_async.py
Set the environment variables with your... | {
"content_hash": "0c5127b7e7233bb74ccf365eef550184",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 121,
"avg_line_length": 38.97435897435897,
"alnum_prop": 0.4243421052631579,
"repo_name": "Azure/azure-sdk-for-python",
"id": "6919f6bdc53c7fe26a56ff817c5b96aa18bf8fb1",
"... |
"""
desispec.pipeline.defs
=========================
Common definitions needed by pipeline modules.
"""
from __future__ import absolute_import, division, print_function
task_states = [
"waiting",
"ready",
"running",
"done",
"failed"
]
"""The valid states of each pipeline task."""
task_state_to_... | {
"content_hash": "2d9e557217430793f819acd068a70c46",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 64,
"avg_line_length": 17.607843137254903,
"alnum_prop": 0.5612472160356348,
"repo_name": "desihub/desispec",
"id": "656766ea21e4127b28053ab0b4221b534decf645",
"size": "985... |
import sqlite3
import sys
import os
import platform
def replace_maccr(x):
"""Open text file and replace Mac CRs"""
f = open(x, 'r')
str = f.read()
f.close()
str = str.replace('\r', '\n')
f_new = open(x, 'w')
f_new.write(str)
f_new.close()
def db_connect(command, path, db_name):
... | {
"content_hash": "742ed31bc3167f3465759187fc227be8",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 94,
"avg_line_length": 27.36111111111111,
"alnum_prop": 0.617258883248731,
"repo_name": "btnpushnmunky/cupcake",
"id": "ee657faff5b0414adbb092ab94f312a3cdc50426",
"size": "... |
"""
homeassistant.components.httpinterface
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides an API and a HTTP interface for debug purposes.
By default it will run on port 8123.
All API calls have to be accompanied by an 'api_password' parameter and will
return JSON. If successful calls will return status code 200 or... | {
"content_hash": "2a8114ec35f23039aa1155ba464881b8",
"timestamp": "",
"source": "github",
"line_count": 379,
"max_line_length": 79,
"avg_line_length": 31.569920844327175,
"alnum_prop": 0.6211450062682825,
"repo_name": "hemantsangwan/Python-home-assistant",
"id": "5528267686f6894d23346f929bd38cd94d493... |
from riskmetrics import riskmetrics
def test_construct_cpe():
cpe = riskmetrics.construct_cpe("vendor", "product", "0.1")
assert cpe == 'cpe:/a:vendor:product:0.1'
def test_get_latest_version():
version = riskmetrics.get_latest_version("35g3q", "fq34gf")
assert version == ""
| {
"content_hash": "63bf62ce54fa7ead642c8e5145364aa6",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 63,
"avg_line_length": 26.90909090909091,
"alnum_prop": 0.6790540540540541,
"repo_name": "hacksmath/csci4900",
"id": "1823e888d917d7b778fae9619573943226f23d41",
"size": "32... |
from branch_utility import BranchUtility
from compiled_file_system import CompiledFileSystem
from environment import IsDevServer
from github_file_system_provider import GithubFileSystemProvider
from host_file_system_provider import HostFileSystemProvider
from third_party.json_schema_compiler.memoize import memoize
from... | {
"content_hash": "56cfaacbd351963a3c323a09c6bd3c00",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 80,
"avg_line_length": 49.4025974025974,
"alnum_prop": 0.7465825446898002,
"repo_name": "patrickm/chromium.src",
"id": "a4080497185719152cf90e5f2b199d59aebbaca5",
"size": "... |
import sys
import getpass
import re
import os
import glob
import traceback
import subprocess
import datetime
import tempfile
import shutil
import upgrade_util as uu
from utilities import _write_to_file
from utilities import error_
from utilities import get_dbver
from utilities import get_db_madlib_version
from utiliti... | {
"content_hash": "152b8c8d06991798a310cc2e7c0fe7c4",
"timestamp": "",
"source": "github",
"line_count": 1421,
"max_line_length": 143,
"avg_line_length": 41.42153413089374,
"alnum_prop": 0.5520387359836901,
"repo_name": "madlib/madlib",
"id": "74fff37395030ccdc5d956d12b2b49ec70b04d94",
"size": "5904... |
from __future__ import unicode_literals
from django.contrib import admin
from calaccess_raw import models
from .base import BaseAdmin
class AcronymsCdAdmin(BaseAdmin):
list_display = ("acronym", "stands_for", "effect_dt", "a_desc")
date_hierarchy = 'effect_dt'
search_fields = ("acronym", "a_desc")
class... | {
"content_hash": "c553fd104453f9fa53ddc87bb5e54616",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 77,
"avg_line_length": 21.49230769230769,
"alnum_prop": 0.7216893342877595,
"repo_name": "anthonyjpesce/django-calaccess-raw-data",
"id": "dba1942dbb0c08c35a90af046513040359... |
from chainerex.training.triggers.early_stopping_trigger import EarlyStoppingTrigger
class IterativeEarlyStoppingManager(object):
"""
Examples:
from chainerex.training.triggers import IterativeEarlyStoppingManager
iesm = IterativeEarlyStoppingManager()
trainer = Trainer(updater, s... | {
"content_hash": "bd4ffd89b9edebf667202c392e76c201",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 86,
"avg_line_length": 35.660377358490564,
"alnum_prop": 0.6328042328042328,
"repo_name": "corochann/chainerex",
"id": "33d6d309151baf50509e83938ca533e8505d7c12",
"size": "... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_display_units10.x... | {
"content_hash": "3f6f621f5a13043a58fe2cefd89cb8d0",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 84,
"avg_line_length": 26.425531914893618,
"alnum_prop": 0.6111111111111112,
"repo_name": "jkyeung/XlsxWriter",
"id": "e340a578c5f8bcdd2029f904f673e634e9cc3d39",
"size": "1... |
import time
from io import TextIOWrapper
from subprocess import Popen, PIPE
from six import PY2
import pysmt.smtlib.commands as smtcmd
from pysmt.solvers.eager import EagerModel
from pysmt.smtlib.parser import SmtLibParser
from pysmt.smtlib.script import SmtLibCommand
from pysmt.solvers.solver import Solver, SolverOp... | {
"content_hash": "a9cb03fda2d2201fe57aed6a9995a05c",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 78,
"avg_line_length": 35.34375,
"alnum_prop": 0.6102269378131447,
"repo_name": "agriggio/pysmt",
"id": "3738537943c333f02349c9f52c3aa9f0f0ac9be8",
"size": "7381",
"bina... |
"""Patching utilities for working with fake objects.
See :ref:`using-fudge` for common scenarios.
"""
__all__ = ['patch_object', 'with_patched_object', 'PatchHandler',
'patched_context', 'patch']
import sys
import fudge
from fudge.util import wraps
class patch(object):
"""A test decorator that patc... | {
"content_hash": "ecafb5bf8335040518d4edb0e3f4682e",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 179,
"avg_line_length": 33.75476839237057,
"alnum_prop": 0.517678398450113,
"repo_name": "mozilla/betafarm",
"id": "8ca7e68a11c2c1d926401ca6af7b06cf99ba9043",
"size": "123... |
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 c... | {
"content_hash": "4ef40d2d5a042dbaaf8ff111798fe2c9",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 97,
"avg_line_length": 31.775100401606426,
"alnum_prop": 0.7052578361981799,
"repo_name": "olemke/pyatmlab",
"id": "cc8802c381cd71ebe833e9598e469dfb1f90d20c",
"size": "835... |
import re, sys, os
# Check control characters.
def check_control_char(filename):
lineNum = 0
pos = []
flag = 0
with open(filename,'r', encoding='utf-8') as file:
for line in file:
lineNum += 1
if re.search(r'[\b]', line):
pos.append(lineNum)
... | {
"content_hash": "5b6157e6232592121df163cadd668067",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 95,
"avg_line_length": 23.692307692307693,
"alnum_prop": 0.54004329004329,
"repo_name": "pingcap/docs",
"id": "3bf7784c3b71801d9cfbcac2efffca117676902c",
"size": "2249",
... |
"""Full Sloth test suite"""
import logging
import os
import unittest
logger = logging.getLogger(__name__)
def suite():
from . import test_version
test_suite = unittest.TestSuite()
test_suite.addTest(test_version.suite())
return test_suite
def run_tests():
"""Run test complete test_suite"""
... | {
"content_hash": "defb8a6216c6c92c9429f7e6e14cf9e4",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 47,
"avg_line_length": 21.17391304347826,
"alnum_prop": 0.6632443531827515,
"repo_name": "maurov/xraysloth",
"id": "1806257ebc78c218a9f7d3365c48287cab98bd2c",
"size": "533"... |
import os
head = os.path.dirname(__file__)
pygtkweb = os.path.join(head, '..', '..', '..', 'pygtkweb')
TARGETS = {
'AutoGtk.py': dict(
options=[
'--library_dir',
os.path.join(pygtkweb, 'library'),
],
)
}
PACKAGE = {
'title': 'pywebgtkbuilder',
'desc': 'Python ... | {
"content_hash": "3efb9d4a85769a344a2ffd52a814ec8e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 77,
"avg_line_length": 21.135593220338983,
"alnum_prop": 0.5781876503608661,
"repo_name": "Hasimir/pyjs",
"id": "3bee55b7f47b5daf41e0822bcdfc36dfce26cd8b",
"size": "1294",
... |
from setuptools import setup
import sys
PY3 = sys.version_info >= (3,)
VERSION = "0.5.1-dev"
COMMANDS = ['fscat',
'fscp',
'fsinfo',
'fsls',
'fsmv',
'fscp',
'fsrm',
'fsserve',
'fstree',
'fsmkdir',
'f... | {
"content_hash": "55c5973e5db910f64d07ae3a6d5741e6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 75,
"avg_line_length": 27.420289855072465,
"alnum_prop": 0.516384778012685,
"repo_name": "pscottdevos/pyfilesystem",
"id": "ea8f1dc2581eee7c1349d837931ed430cee43f43",
"size... |
import os
import pytest
from mockito import mock, verify, when, unstub, ANY
from selenium import webdriver
from SeleniumLibrary.keywords import WebDriverCreator
LOG_DIR = "/log/dir"
@pytest.fixture(scope="module")
def creator():
return WebDriverCreator(LOG_DIR)
def teardown_function():
unstub()
def tes... | {
"content_hash": "c762951ffa44e2b97344a4e03246936f",
"timestamp": "",
"source": "github",
"line_count": 893,
"max_line_length": 88,
"avg_line_length": 34.19820828667413,
"alnum_prop": 0.6784112118929893,
"repo_name": "rtomac/robotframework-selenium2library",
"id": "27379a04e9918f8f368ae4259964d172154... |
'''
filenam log_campuse_net.py
fun :log the bupt net work
'''
import urllib2,re,cookielib,urllib
import regex
class log_campuse:
username = ''#username# raw_input('username:')
pwd = ''#raw_input('password:')
url = 'http://10.3.8.211/'
def __init__(self,username,pwd):
#return
self.userna... | {
"content_hash": "70415e0017f489ea23197754edc88294",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 150,
"avg_line_length": 33.78125,
"alnum_prop": 0.589731729879741,
"repo_name": "xuewindy/python-tools",
"id": "69352534ed843f9edbb10dc2ae5413b938db9799",
"size": "2162",
... |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WH... | {
"content_hash": "c399a5cff9c8a6ddc7c238235a5e3972",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 120,
"avg_line_length": 35.75,
"alnum_prop": 0.7604895104895105,
"repo_name": "jeremiedecock/snippets",
"id": "12a515b62d3687d7f79b703d89bdbb0c1ab4a9e7",
"size": "1830",
... |
"""
Support for Homekit lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.homekit_controller/
"""
import logging
from homeassistant.components.homekit_controller import (
HomeKitEntity, KNOWN_ACCESSORIES)
from homeassistant.components.lig... | {
"content_hash": "219e1fcf71b6b0759ee9991832d93a34",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 76,
"avg_line_length": 37.80152671755725,
"alnum_prop": 0.5581583198707593,
"repo_name": "tinloaf/home-assistant",
"id": "7c8119f6e89dbe1d180c409ea66b5767e4fd904a",
"size"... |
from functools import wraps
from plash import utils
from plash.eval import hint, register_macro
def cache_container_hint(cache_key_templ):
def decorator(func):
@wraps(func)
def wrapper(*args):
cache_key = cache_key_templ.format(":".join(args)).replace("/", "%")
container_i... | {
"content_hash": "2bf8a1166b11f797a24a907d4f01a11d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 80,
"avg_line_length": 25.223684210526315,
"alnum_prop": 0.647887323943662,
"repo_name": "ihucos/plash",
"id": "8d479f1f35f1d0cc463607c22a89dde44b23af72",
"size": "1917",
... |
"""
Django settings for nospammail project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import... | {
"content_hash": "1430b74874a075b6350a4f3e7b2eed3c",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 91,
"avg_line_length": 26.184615384615384,
"alnum_prop": 0.6780258519388954,
"repo_name": "jnyborg/nospammail",
"id": "05786ef9822ef3aae8d1a65a6c0e27f73ccf5648",
"size": "... |
from django.conf import settings
import importlib
# Merge two lots of mesobox-compatible context additions
def merge_context_additions(additions):
context = {}
boxes = {}
for c in additions:
try:
context.update(c.get("context"))
except TypeError:
pass
try:
... | {
"content_hash": "4ad5adef0242d41ef80f9e73e1835547",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 99,
"avg_line_length": 29.979166666666668,
"alnum_prop": 0.5726198749131342,
"repo_name": "grundleborg/mesosphere",
"id": "7e40178d5608ae8a4241fd14519c704411701759",
"size"... |
"""Light curve-related functions."""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import numpy as np
from .base import mp_root, create_gti_mask, cross_gtis, mkdir_p
from .base import contiguous_regions, calc_countrate, gti_len
from .base import _assign_v... | {
"content_hash": "4a97e23f40902628064101d725243b6c",
"timestamp": "",
"source": "github",
"line_count": 956,
"max_line_length": 79,
"avg_line_length": 34.12029288702929,
"alnum_prop": 0.5538183267420829,
"repo_name": "matteobachetti/MaLTPyNT",
"id": "a929968d62564863669e69b0bc0c23608a865054",
"size... |
def extractLazyladytranslationsBlogspotCom(item):
'''
Parser for 'lazyladytranslations.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'tran... | {
"content_hash": "24081c7e4cc34d9d84cc33d4972d9dee",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 27.476190476190474,
"alnum_prop": 0.6464471403812825,
"repo_name": "fake-name/ReadableWebProxy",
"id": "29e6e1eb1cd673d69445a3e6ff6d266989c26c83",
"... |
from openstack import exceptions
from openstack.tests import fakes
from openstack.tests.unit import base
class TestMicroversions(base.TestCase):
def setUp(self):
super(TestMicroversions, self).setUp()
self.use_compute_discovery()
def test_get_bad_inferred_max_microversion(self):
sel... | {
"content_hash": "7e0db3b83888ee90daf749d4acc04188",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 76,
"avg_line_length": 30.27358490566038,
"alnum_prop": 0.6001869741352446,
"repo_name": "openstack/python-openstacksdk",
"id": "67dc79d1a78adf7244c4c994472af02f2b4e3de8",
... |
import imp
import os
import io
import sys
from mock import patch
from gp_unittest import GpTestCase
class GpSshTestCase(GpTestCase):
def setUp(self):
# because gpssh does not have a .py extension, we have to use imp to import it
# if we had a gpssh.py, this is equivalent to:
# import g... | {
"content_hash": "f62a8e9291c1d062f047e521e11ff27c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 94,
"avg_line_length": 33.138888888888886,
"alnum_prop": 0.6236378876781223,
"repo_name": "kaknikhil/gpdb",
"id": "776a45eca23268387659dcb2f6f12e1225be4e3f",
"size": "1193"... |
"""
:mod:`zsl_jwt.configuration`
-------------------------
The configuration of the authentication.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import * # NOQA
class AuthConfiguration(object)... | {
"content_hash": "b5d5ada70f4cb15126254ca8c58d0cca",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 73,
"avg_line_length": 26.705882352941178,
"alnum_prop": 0.6585903083700441,
"repo_name": "AtteqCom/zsl_jwt",
"id": "31b899ebd927f52a496ce736582a174b6fbf752f",
"size": "908... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.devcenter import DevCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-devcenter
# USAGE
python list_usages.py
Before run the sample, please set the values of the client ID, tenant ID and client secre... | {
"content_hash": "558b005989f3f126c1eee56abba732da",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 145,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.7291471415182755,
"repo_name": "Azure/azure-sdk-for-python",
"id": "bf60f206c42edc0f0782a1ab0b9bb3ebc6667f41",
"... |
from panda3d.core import Datagram
import CatalogItem
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer
from direct.interval.IntervalGlobal import *
from toontown.estate import GardenGlobals
from direct.actor import Actor
class CatalogG... | {
"content_hash": "7d2a1afce6d99ea361fd55883f0ff389",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 128,
"avg_line_length": 39.32748538011696,
"alnum_prop": 0.6370260223048327,
"repo_name": "DedMemez/ODS-August-2017",
"id": "07c38af41364f1b5e0e775f8f578b4ac86044bce",
"si... |
def extractWwwBeanylandCom(item):
'''
Parser for 'www.beanyland.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loite... | {
"content_hash": "6866e53957accab9ca7648b1052747fe",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 25.952380952380953,
"alnum_prop": 0.6256880733944954,
"repo_name": "fake-name/ReadableWebProxy",
"id": "714280b8c3d07d6b02fbf116d5f812c8543b0566",
"... |
"""Replays web pages under simulated network conditions.
Must be run as administrator (sudo).
To record web pages:
1. Start the program in record mode.
$ sudo ./replay.py --record archive.wpr
2. Load the web pages you want to record in a web browser. It is important to
clear browser caches before this s... | {
"content_hash": "42336135505b29bcc6d0a4eaff07beed",
"timestamp": "",
"source": "github",
"line_count": 507,
"max_line_length": 91,
"avg_line_length": 40.625246548323474,
"alnum_prop": 0.6615041025392048,
"repo_name": "windyuuy/opera",
"id": "5eb423e849a86fb90d8906a976f2a2a013556ffb",
"size": "2121... |
"""Tests for dirs.py."""
from tests.common import testing
import time
from titan.common.lib.google.apputils import basetest
from titan.files import files
from titan.files import dirs
PATH_WRITE_ACTION = dirs.ModifiedPath.WRITE
PATH_DELETE_ACTION = dirs.ModifiedPath.DELETE
class DirManagingFile(dirs.DirManagerMixin,... | {
"content_hash": "5753171f3f2fa70dc955da4d28449516",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 79,
"avg_line_length": 37.77777777777778,
"alnum_prop": 0.6497899159663866,
"repo_name": "paulftw/titan-files",
"id": "9d8bb377b8325a8892c71c1db864a18ab6a6f9c1",
"size": "... |
import os
import tempfile
import shutil
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.log import logger
from pip.locations import (virtualenv_no_global, distutils_scheme,
build_prefix)
from pip.basecommand import Command
from pip.index import PackageFind... | {
"content_hash": "14c31bdaa19bf5096306a3d6df992775",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 79,
"avg_line_length": 36.90056818181818,
"alnum_prop": 0.5219031488182309,
"repo_name": "laborautonomo/pip",
"id": "e267d0a8b8e5a25614b188646910f008fce3ada4",
"size": "12... |
import rospy,sys
from std_msgs.msg import String
sys.path.append("/home/docker/catkin_ws/devel/lib/python2.7/dist-packages")
from mavros_msgs.msg import State,PositionTarget
from mavros_msgs.srv import SetMode,CommandBool
from geometry_msgs.msg import PoseStamped,Point
state=None
def callback(data):
#rospy.login... | {
"content_hash": "b24f544e2305221dda58f62297d6e42d",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 102,
"avg_line_length": 36.492537313432834,
"alnum_prop": 0.6368098159509202,
"repo_name": "orig74/DroneSimLab",
"id": "4678f3c50f212e6cca906a60b2f13be078b1b438",
"size": "... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from textwrap import dedent
from mock import MagicMock
from pants.backend.codegen.thrift.java.java_thrift_library import JavaThriftLibrary
from pants.backend.jvm.targets.java_library import JavaLibrary
from pants.backend.jvm.... | {
"content_hash": "5414d7a8a2dac60a8df5a4a49285c191",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 94,
"avg_line_length": 36.51176470588236,
"alnum_prop": 0.6742387626872886,
"repo_name": "twitter/pants",
"id": "fe4b8f20b14b54dbfdaaded128d743da709e648b",
"size": "6354",... |
"""A lexical analyzer class for simple shell-like syntaxes."""
# Module and documentation by Eric S. Raymond, 21 Dec 1998
# Input stacking and error message cleanup added by ESR, March 2000
# push_source() and pop_source() made explicit by ESR, January 2001.
# Posix compliance, split(), string arguments, and
# iterato... | {
"content_hash": "381007ca65bf1e30afb3960ed84a4a95",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 78,
"avg_line_length": 38.33236994219653,
"alnum_prop": 0.4951368468672246,
"repo_name": "xyuanmu/XX-Net",
"id": "c817274583135a3a64711cd38801276fe395a2c7",
"size": "13325... |
__all__ = [
'PJS'
]
def escape_value(value):
if type(value) in [str, unicode]:
value = '"{0}"'.format(value)
return value
class Attr(dict):
def __str__(self):
if self['namespace']:
return u'{namespace}.{attr_name}'.format(**self)
else:
return self... | {
"content_hash": "874c1a83b40edd33321a871e3c32596c",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 122,
"avg_line_length": 26.125,
"alnum_prop": 0.539712918660287,
"repo_name": "veeloox/ramen",
"id": "320fc88d9f3654285e064662fddcd8ccdaca430b",
"size": "4180",
"binary"... |
import pika, os, uuid, logging,sys, ConfigParser
import json
import time
import threading
logging.basicConfig()
#####################################################################################################################
# CR: I'll write all my comments starting with CR: if you don't mind, so you'll understa... | {
"content_hash": "73bcc6d7618fd26f1496f4227913eadb",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 161,
"avg_line_length": 41.61409395973154,
"alnum_prop": 0.5781791790984598,
"repo_name": "picotera/rabbit-coat",
"id": "9e19be801a786cceabebfb0100f381ef427d7145",
"size":... |
from inspectors.extensions import ma
from .models import (
User
)
class UserSchema(ma.ModelSchema):
class Meta:
model = User
user_schema = UserSchema()
| {
"content_hash": "efafd944eb2ab9c6063214dba68a5f7c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 36,
"avg_line_length": 16.636363636363637,
"alnum_prop": 0.644808743169399,
"repo_name": "codeforamerica/mdc-inspectors",
"id": "eb2a795dc7298b7db64fa31f22e32776cea0c60f",
... |
"""
file specification
"""
reserveChangedState = False
class FileSpec(object):
# attributes
_attributes = ('row_ID','PandaID','GUID','lfn','type','dataset','status','prodDBlock',
'prodDBlockToken','dispatchDBlock','dispatchDBlockToken','destinationDBlock',
'destinationD... | {
"content_hash": "78b7c7e9a3abec5c5e8a93bf85ff5793",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 96,
"avg_line_length": 30.45977011494253,
"alnum_prop": 0.5343396226415095,
"repo_name": "RRCKI/panda-server",
"id": "318c3b5c6421d363aeedbb27b7c9e07f9e5fecf8",
"size": "7... |
import os
import sys
from django.core.exceptions import ImproperlyConfigured
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sfchat.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "964f5e17c9e46d9275328be27a920336",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 76,
"avg_line_length": 24.25,
"alnum_prop": 0.7422680412371134,
"repo_name": "MySmile/sfchat",
"id": "3d1e742dd116ac5197577f165a23b25f10c0c855",
"size": "291",
"binary": ... |
"""Job Args"""
from argparse import ArgumentParser
class Args:
"""Job Args"""
def __init__(self, parser: ArgumentParser):
"""Initialize class properties."""
| {
"content_hash": "3312974b2cbd00f95b03192a3fbba01f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 19.555555555555557,
"alnum_prop": 0.6306818181818182,
"repo_name": "kstilwell/tcex",
"id": "829c4fce96c1228c96acfcb2fec1d0554bd5b8b6",
"size": "176",
... |
import sys
import os.path
import subprocess
import argparse
#print 'Number of arguments:', len(sys.argv), 'arguments.'
#print 'Argument List:', str(sys.argv)
parser = argparse.ArgumentParser(description="Sort and Index BAM files")
parser.add_argument('--output', type=str)
parser.add_argument('input_file')
results, l... | {
"content_hash": "66f92394b2313d398386d7d6e86f8356",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 81,
"avg_line_length": 28.761904761904763,
"alnum_prop": 0.7356512141280354,
"repo_name": "charite/Q",
"id": "f4fde2f5a90e8de72e7682e7d58e6a57b60f42ee",
"size": "1835",
"... |
import logging
import sys
import os.path
from nepugia.formats import PACFormat
from nepugia.util.file_io import chunked_copy, FileInFile
from nepugia.compression.huffmanc import HuffmanCoding
logger = logging.getLogger(__name__)
def main():
pac_filename = sys.argv[1]
target_dir = sys.argv[2]
extract_pac_... | {
"content_hash": "2a42491e07260130666484d0435336a4",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 116,
"avg_line_length": 39.26229508196721,
"alnum_prop": 0.5427974947807933,
"repo_name": "aheadley/python-nepugia",
"id": "a3ee2911ad33d857d2610660ca41e8fd83089f87",
"size... |
"""
Handles all requests relating to transferring ownership of volumes.
"""
import hashlib
import hmac
import os
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import six
from cinder.db import base
from cinder import exception
from cinder.i18n import _
from cinder im... | {
"content_hash": "1d1d44e40e252416b91696cd8f87597c",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 79,
"avg_line_length": 43.52466367713004,
"alnum_prop": 0.5595507933237173,
"repo_name": "Datera/cinder",
"id": "213fd4064719c25eb08c1769a4052db141c1b4eb",
"size": "10367"... |
"""
Created on June 18, 2015
@author: shiruilu
Common utils for CAPE
"""
import cv2
import numpy as np
from scipy.signal import argrelextrema
import matplotlib.pyplot as plt
def safe_convert(x, new_dtype):
"""
http://stackoverflow.com/a/23325108/2729100
convert x to new_dtype, clip values larger than max... | {
"content_hash": "53814e2f90537776018a55beba722774",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 91,
"avg_line_length": 33.472,
"alnum_prop": 0.5750478011472275,
"repo_name": "shiruilu/CAPE",
"id": "a770bf13281d79ef59f3fcfd6abcf040bfe85b7a",
"size": "4184",
"binary"... |
from operator import add
from django.db.models import FileField
from django.db.models.signals import post_delete
def _get_subclasses(klass):
return (klass,) + reduce(add, map(_get_subclasses, klass.__subclasses__()), ())
def get_subclasses(model, include_abstract=False):
"""
Returns a list of unique model... | {
"content_hash": "f7893534a17dcfe3c433e595f1b01ce8",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 88,
"avg_line_length": 41.525,
"alnum_prop": 0.686935580975316,
"repo_name": "ixc/glamkit-feincmstools",
"id": "d8abe6dd4c98b55c6a0cc3d7071d1475378f1748",
"size": "1661",
... |
from bambou import NURESTFetcher
class NUWirelessPortsFetcher(NURESTFetcher):
""" Represents a NUWirelessPorts fetcher
Notes:
This fetcher enables to fetch NUWirelessPort objects.
See:
bambou.NURESTFetcher
"""
@classmethod
def managed_class(cls):
""" ... | {
"content_hash": "ef679ed7b151c6dfe3d0947e05b35cde",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 65,
"avg_line_length": 20.96,
"alnum_prop": 0.6145038167938931,
"repo_name": "nuagenetworks/vspk-python",
"id": "b2e508b1ee7ae3382274af679d3d0921431aa9cb",
"size": "2135",
... |
from nylas.client.restful_models import RestfulModel, Message, File, Contact
from nylas.utils import HttpMethod
import re
def _add_options_to_body(body, options):
options_dict = options.__dict__
# Only append set options to body to prevent a 400 error
options_filtered = {k: v for k, v in options_dict.item... | {
"content_hash": "e7676b8fd910d791c7be63d293ab7a22",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 87,
"avg_line_length": 35.11413043478261,
"alnum_prop": 0.62590930196564,
"repo_name": "nylas/nylas-python",
"id": "a07106318118eed4561ea36898fbb91ad0d585c3",
"size": "646... |
from api.models import City, Country
from django.contrib.gis.db.models.functions import Area
Country.objects.annotate(area=Area('border_webmercator')).order_by('-area')
City.objects.filter(properties__wikipedia='Seattle')
| {
"content_hash": "e128d99930214565950bc349c9ca8c2e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 75,
"avg_line_length": 32.142857142857146,
"alnum_prop": 0.7911111111111111,
"repo_name": "notthatbreezy/django-example",
"id": "3a926f1f47a9ab3d5a2ba774c014ff53939dc04f",
"... |
import sys
import time
try:
import psutil
hasPsutil = True
except ImportError:
hasPsutil = False
def splicedCheck (mode):
splicedFound = True
if hasPsutil == True:
if mode == "start":
splicedFound = False
count = 0
while splicedFound == F... | {
"content_hash": "aeb62ca75388e3cbd05b1e2dce300535",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 62,
"avg_line_length": 25.04255319148936,
"alnum_prop": 0.44180118946474084,
"repo_name": "osrf/opensplice",
"id": "6014e1e9f22a6b3420f619355ffa9bf57cb268bf",
"size": "1177... |
from OpenGL.GL import *
from .geometric import *
from ..spaces.objective import *
from ..spaces.statespace import *
from ..spaces.configurationspace import *
from ..spaces.edgechecker import *
from ..spaces.metric import *
from ..planners.problem import PlanningProblem
class FlappyControlSpace(ControlSpace):
... | {
"content_hash": "33f9a76bed496002b24582ca66f9a020",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 110,
"avg_line_length": 34.458333333333336,
"alnum_prop": 0.5673518742442564,
"repo_name": "krishauser/pyOptimalMotionPlanning",
"id": "63162d0faebc8c8cbf6d231c627bf136567e8... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.