text stringlengths 4 1.02M | meta dict |
|---|---|
import os
def make_output_dir(state):
if not state.output_directory:
msg = "No Output Directory Specified for State:" + state.name
raise Exception(msg)
if os.path.exists(state.output_directory):
return
os.makedirs(state.output_directory)
| {
"content_hash": "1d0f9e8f32eb142e4b19b410f526b2ec",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 21.46153846153846,
"alnum_prop": 0.6702508960573477,
"repo_name": "savorywatt/tailorSCAD",
"id": "f24859ed2cc58270e2144b0c1e1d6133da32b454",
"size": ... |
"""Tests for autotagging functionality.
"""
from __future__ import division, absolute_import, print_function
import re
import copy
from test import _common
from test._common import unittest
from beets import autotag
from beets.autotag import match
from beets.autotag.hooks import Distance, string_dist
from beets.libra... | {
"content_hash": "aef0556b9cd24f0a958ab1ec53c1f2b0",
"timestamp": "",
"source": "github",
"line_count": 941,
"max_line_length": 88,
"avg_line_length": 35.722635494155156,
"alnum_prop": 0.5782835043879221,
"repo_name": "jcoady9/beets",
"id": "b2f3fd61d06c8fecc1d33452dcdee2fbbd9346e3",
"size": "34286... |
import pytest
from anchore_engine.common import helpers
from anchore_engine.common.helpers import make_anchore_exception
values = [
pytest.param("{}", {}, id="'{}'"),
pytest.param({}, {}, id="{}"),
pytest.param("a string", "a string", id="'a string'"),
]
class TestSafeExtractJsonValue:
@pytest.mark.... | {
"content_hash": "9fd241d6f82e55da57058834259ce3dc",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 561,
"avg_line_length": 35.71473354231975,
"alnum_prop": 0.40112349688405163,
"repo_name": "anchore/anchore-engine",
"id": "4e9fb0ab2c5ac77e110a2fb5f6af73f623383181",
"siz... |
BOT_NAME = 'bgmapi'
SPIDER_MODULES = ['bgmapi.spiders']
NEWSPIDER_MODULE = 'bgmapi.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
USER_AGENT = 'bgmapi (https://github.com/wattlebird/Bangumi_Spider)'
# Obey robots.txt rules
ROBOTSTXT_OBEY = False
LOG_LEVEL='INFO'
# Configu... | {
"content_hash": "92886901d3e1cd4f62c2bb3b4278f055",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 102,
"avg_line_length": 34.28,
"alnum_prop": 0.7389148191365228,
"repo_name": "wattlebird/Bangumi_Spider",
"id": "66081a883eceb51b3baa65c9d05346b1e2c27021",
"size": "3848"... |
"""Support for SimpliSafe freeze sensor."""
from simplipy.entity import EntityTypes
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_FAHRENHEIT
from homeassistant.core import HomeAssistant, callb... | {
"content_hash": "01c34360f3b7c2b12f71c9eeae33b7ff",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 84,
"avg_line_length": 37.45238095238095,
"alnum_prop": 0.7329942784488239,
"repo_name": "sander76/home-assistant",
"id": "c3f8d7c3ab0bb73f77a5ae32654dded23993f98b",
"size"... |
import os
import tempfile
import shutil
from unittest import skip
from lxml import etree
from hs_core.hydroshare import resource
from .base import ModelInstanceSciMetaTestCase
class TestScienceMetadataSWAT(ModelInstanceSciMetaTestCase):
@skip("skip this test, as we do not support SWATModelInstanceResource type... | {
"content_hash": "8cae3bcf425623a8b2b7df3ea7d08751",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 99,
"avg_line_length": 42.22222222222222,
"alnum_prop": 0.5663157894736842,
"repo_name": "ResearchSoftwareInstitute/MyHPOM",
"id": "eff7cb805bd785772352b8d8d7caed2822430156"... |
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from contrib.admin.admin import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'web.views.home', name='home'),
# always get the first record
url(r'^$', login_requ... | {
"content_hash": "881e9fffb5e215a243eee8f6b116184e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 62,
"avg_line_length": 32.25,
"alnum_prop": 0.599483204134367,
"repo_name": "rfancn/wxgigo",
"id": "0c37ce68379155be4539451c961c7253e298cd95",
"size": "387",
"binary": fa... |
'''
Several measures for evaluating chunking predictions with respect to a gold standard.
Pass -h to see usage.
Terminology used below:
* 'token': an instance of an atomic unit, such as a word;
* 'tag': indicates grouping and (possibly) classification of a token, e.g. B-PERSON
* 'mention': a sequence of tokens acco... | {
"content_hash": "d70eac4b1aeb09b79dccde8b2c11ced2",
"timestamp": "",
"source": "github",
"line_count": 785,
"max_line_length": 188,
"avg_line_length": 52.58471337579618,
"alnum_prop": 0.5577654497444221,
"repo_name": "nschneid/pyutil",
"id": "6fed039c6dee07d9e60e0eb28651e45d4eff9a38",
"size": "413... |
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("resolwe_bio_kb", "0007_feature_fullname_350"),
]
operations = [
migrations.AlterField(
model_name="feature",
name="aliases",
... | {
"content_hash": "79451e33f7fec35ffc8321fae4947769",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 25.318181818181817,
"alnum_prop": 0.5547576301615799,
"repo_name": "genialis/resolwe-bio",
"id": "1ccf65123e4c59d8de263941570aa3167f8563a0",
"size": ... |
import IECore
import Gaffer
import GafferUI
QtCore = GafferUI._qtImport( "QtCore" )
QtGui = GafferUI._qtImport( "QtGui" )
## The Timeline presents a time slider which edits the frame
# entry of a context.
class Timeline( GafferUI.EditorWidget ) :
def __init__( self, scriptNode, **kw ) :
self.__row = GafferUI.L... | {
"content_hash": "d4b4885555f02391d68cd8ae5a40ea20",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 154,
"avg_line_length": 43.948356807511736,
"alnum_prop": 0.7212904604208952,
"repo_name": "davidsminor/gaffer",
"id": "9e44c909a3726b01f2c8170f9c123071592240c7",
"size": ... |
from setuptools import setup, find_packages
from codecs import open
import os
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the README file
try:
import pypandoc
long_description = pypandoc.convert('README.md', format='md', to='rst')
except(IOError, ImportError):
with op... | {
"content_hash": "d167c44587545506f1de6a8e5de8bb78",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 87,
"avg_line_length": 32.12,
"alnum_prop": 0.6270236612702366,
"repo_name": "glomex/gcdt-lookups",
"id": "9983fb57f86a0bb0b5090fd2304b1bd482f9007b",
"size": "1606",
"bin... |
def info():
print('cgi-wsgi')
class CGIContext:
def __init__(self):
self.headers = {}
self.body = []
self.writing_headers = True
def append_body(self, lineOrLinesOrNil):
# print 'BODY: %s' % lineOrLinesOrNil
self.body.append(lineOrLinesOrNil or '')
def add_hea... | {
"content_hash": "f8af7b68525210a83376e0736667f279",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 65,
"avg_line_length": 26.49122807017544,
"alnum_prop": 0.5668874172185431,
"repo_name": "timdiggins/cgi_wsgi",
"id": "65eb7a2b0021bb4a8c336fe1397a551f82f45b60",
"size": "1... |
import unittest
from ...worksheet import Worksheet
class TestRangeReturnValues(unittest.TestCase):
"""
Test the return value for various functions that handle 1 or 2D ranges.
"""
def test_range_return_values(self):
"""Test writing a worksheet with data out of bounds."""
worksheet = Wo... | {
"content_hash": "2cae7ea32834c17069c51243b9c09847",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 86,
"avg_line_length": 33.02150537634409,
"alnum_prop": 0.6125040703353957,
"repo_name": "jmcnamara/XlsxWriter",
"id": "3df12fb192d59d6c6bdb43a83d8f9c9e215bcbe8",
"size": "... |
import os
from data_utils import load_data
from keras.layers.core import Dense, Activation, Dropout, Flatten, Merge
from keras.models import Sequential
from numpy import array
from keras.callbacks import CSVLogger
from tensorflow.python.ops import control_flow_ops
from keras.callbacks import ModelCheckpoint, EarlyStopp... | {
"content_hash": "e2f38b93b621028c3e96156ba98b2e5e",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 150,
"avg_line_length": 29.310344827586206,
"alnum_prop": 0.7047058823529412,
"repo_name": "Swaddle/nnQcompiler",
"id": "6aca27cfa46982bd52f77f84187fe17bfd48c366",
"size": ... |
from __future__ import print_function
from bcc import BPF
import argparse
from time import strftime
from socket import inet_ntop, AF_INET, AF_INET6
from struct import pack
from time import sleep
from bcc import tcp
# arguments
examples = """examples:
./tcpdrop # trace kernel TCP drops
"""
parser = argpar... | {
"content_hash": "cfdf89e8037034978bfb43f0dc964c5f",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 77,
"avg_line_length": 29.072222222222223,
"alnum_prop": 0.6124593923179821,
"repo_name": "mcaleavya/bcc",
"id": "bf8634df68b88dca4762530fed1a9685fb96a688",
"size": "5839"... |
def get_total_seconds(timedelta):
"""
Backported for Python < 2.7
See http://docs.python.org/library/datetime.html.
"""
return ((timedelta.microseconds + (
timedelta.seconds +
timedelta.days * 24 * 60 * 60
) * 10**6) / float(10**6))
| {
"content_hash": "b37218838aecafbb615431e0aba87f4e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 26.09090909090909,
"alnum_prop": 0.5574912891986062,
"repo_name": "lukaszb/porunga",
"id": "f33fdcebe1dc6c3a1b82959ba163aad5704f0dbc",
"size": "288",... |
from .control import *
# Little demo on how it could be used.
if __name__ == '__main__':
a = I2PController()
print(a.get_network_settings())
vals = a.get_router_info()
print(''.join([
'You are running i2p version ', str(vals['i2p.router.version']), '. ',
'It has been up for ', str(vals[... | {
"content_hash": "836827ea1985e3b8a86cec66ac4bfcf3",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 80,
"avg_line_length": 37,
"alnum_prop": 0.5743243243243243,
"repo_name": "chris-barry/i2py",
"id": "d557ccdccd6be77ab81dea49cfe1b0b64419a27e",
"size": "545",
"binary": f... |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Data(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.template"
_path_str = "layout.template.data"
_valid_props = {
"bar",
... | {
"content_hash": "112c18a60aaaaf92e54cd96fb91bdf6f",
"timestamp": "",
"source": "github",
"line_count": 1760,
"max_line_length": 101,
"avg_line_length": 32.39545454545455,
"alnum_prop": 0.5829416304195314,
"repo_name": "plotly/plotly.py",
"id": "42a910e0c02f83f53cb668f433dc428205ee7554",
"size": "5... |
import argparse
import os
import sys # exit
import shutil # copyfile
import math # pi
import subprocess # Popen
rapterRoot = "/home/bontius/workspace/RAPter/";
rapterExec = os.path.join( rapterRoot, "RAPter", "build", "Release", "bin", "rapter" );
def show( primitivesPath, associationsPath, ... | {
"content_hash": "2888dd05bb3914ffe8d7c8e5657e1c22",
"timestamp": "",
"source": "github",
"line_count": 334,
"max_line_length": 315,
"avg_line_length": 59.961077844311376,
"alnum_prop": 0.6277026014879912,
"repo_name": "amonszpart/globOpt",
"id": "2666d4bf45ef8be080a38f801b513a332114d4bd",
"size": ... |
import os
import random
class Subject:
def __init__(self, name):
self.name = name
self.state = PipelineState()
class PipelineState:
def __init__(self):
self.has_metric = False
self.has_initial_map = False
self.has_final_map = False
def MapsDir(base, source, target, pro... | {
"content_hash": "38048385f48300aba12aed6482965fd9",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 90,
"avg_line_length": 37.95161290322581,
"alnum_prop": 0.5898852528686783,
"repo_name": "alextsui05/mcmp",
"id": "04ed97e181a91f33f1a64cbf9bf073ef9322501c",
"size": "2353"... |
from datetime import datetime
from decimal import Decimal
import numpy as np
import pytest
from pandas._libs import lib
from pandas.compat import IS64
from pandas.errors import (
PerformanceWarning,
SpecificationError,
)
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Grouper,
... | {
"content_hash": "66a1fd499c420435e0dfb8c17ad7548e",
"timestamp": "",
"source": "github",
"line_count": 2900,
"max_line_length": 88,
"avg_line_length": 32.072758620689655,
"alnum_prop": 0.5703518938620163,
"repo_name": "datapythonista/pandas",
"id": "1af94434ca1fa37af34d078edbddb5bc0e56c012",
"size... |
import random
import tensorflow as tf
from rqsa.agent import Agent
from rqsa.environment import GymEnvironment, SimpleGymEnvironment
from config import get_config
flags = tf.app.flags
# Model
flags.DEFINE_string('model', 'm1', 'Type of model')
flags.DEFINE_boolean('dueling', False, 'Whether to use dueling deep q-net... | {
"content_hash": "1699aba2b9193f1e8f04515df72b5ad5",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 88,
"avg_line_length": 29.53030303030303,
"alnum_prop": 0.694202154951257,
"repo_name": "jonathanmei/rqsa",
"id": "86142d5f1b375dd95db23b5f5ccf39aa5b6321c8",
"size": "1949"... |
import datetime
from decimal import Decimal
import warnings
try:
import unittest2 as unittest
except ImportError:
import unittest
from agate import Table
from agate.aggregations import *
from agate.data_types import *
from agate.exceptions import *
from agate.warns import NullCalculationWarning
class TestSi... | {
"content_hash": "3707ac84006e74ade474466cfe41deb5",
"timestamp": "",
"source": "github",
"line_count": 603,
"max_line_length": 100,
"avg_line_length": 31.22553897180763,
"alnum_prop": 0.5732646449625578,
"repo_name": "JoeGermuska/agate",
"id": "5b1e805ffb69dd7d85c2f23e1e3fad6edff9211b",
"size": "1... |
"""Commands used for debugging purposes."""
import imp
import sys
import sublime
import sublime_plugin
class BtReloadModules(sublime_plugin.WindowCommand):
"""Reloads all BehaveToolkit modules."""
def run(self):
modules = [module for module in sys.modules.keys()
if module[:13] =... | {
"content_hash": "edd67cae9d5f2179d494930abc14d307",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 74,
"avg_line_length": 28.25925925925926,
"alnum_prop": 0.6330275229357798,
"repo_name": "mixxorz/BehaveToolkit",
"id": "63ff834d1ea2e446a26d569c68ed0e83c00b9872",
"size": ... |
import configparser
from typing import (List)
from ..lib import (look_up)
runners = [
# ======================================================================= #
# Single threaded runners
# ======================================================================= #
{
'name': 'single',
'... | {
"content_hash": "127c6c1fbed6f0d3ea93ec45eda90e6a",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 31.634730538922156,
"alnum_prop": 0.4688623887942457,
"repo_name": "NLeSC/noodles",
"id": "d735c1b641264f55e86a1f8a7645ee750aa5052a",
"size": "5283"... |
"""Tests the gdal_rasterize commandline application."""
import os
import subprocess
import tempfile
from osgeo import gdal
import gflags as flags
import unittest
from autotest2.gcore import gcore_util
from autotest2.gdrivers import gdrivers_util
FLAGS = flags.FLAGS
@gdrivers_util.SkipIfDriverMissing(gdrivers_uti... | {
"content_hash": "a9baa0d46b4582f1b45d87689efc81bf",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 68,
"avg_line_length": 28.17391304347826,
"alnum_prop": 0.6311728395061729,
"repo_name": "schwehr/gdal-autotest2",
"id": "28290c4264cb376abbbb69f2716a728deaee54fb",
"size":... |
class Templates(object):
def __init__(self):
self._filepath = 'core/templates/'
self._switch_template = self.get_template('switch')
def get_template(self, template):
with open('%s%s.html' % (self._filepath, template)) as template_file:
return template_file.read().replace('\n', '')
@property
... | {
"content_hash": "ccafd3065693d0f801ad30406865c667",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 73,
"avg_line_length": 24.952380952380953,
"alnum_prop": 0.6469465648854962,
"repo_name": "zpriddy/Firefly",
"id": "52e89a7791cce96d11edfbfa2740462a6184ed42",
"size": "688"... |
import sys
from argparse import ArgumentParser, Namespace
from contextlib import contextmanager
from typing import IO, Iterator
from idb.cli import ClientCommand
from idb.common.types import Client
class ScreenshotCommand(ClientCommand):
@property
def description(self) -> str:
return "Take a Screensh... | {
"content_hash": "52565a71921457a182a431865ea8f6e9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 88,
"avg_line_length": 27.375,
"alnum_prop": 0.6493150684931507,
"repo_name": "facebook/FBSimulatorControl",
"id": "457337d88bb9610b74d046b9eaa6bc5b491cf875",
"size": "1296... |
"""read presence from redis and write to push services, gcm, apple"""
from pymongo import MongoClient
import syslog
import requests
import redis
import json
import time
import datetime
from argparse import ArgumentParser
DIST = 1609 * 120;
GCM_SERVER_URL = 'https://android.googleapis.com/gcm/send'
HEADERS = {'Conte... | {
"content_hash": "a95f0ed9216c4a29ccff17dc952e0e6e",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 87,
"avg_line_length": 28.576923076923077,
"alnum_prop": 0.47806191117092867,
"repo_name": "navicore/oemap",
"id": "6bb0715e0aa9bb232fc620e4b1fc7ed42b5eac32",
"size": "373... |
from interage.api.config import APISettings
from interage.api.exceptions import HttpNotFoundError
from interage.api.utils.models import json_to_instance_list
class APIResult(object):
def __init__(self, **args):
super(APIResult, self).__init__()
self.client = args.get('client')
self.model_c... | {
"content_hash": "181d0be3875af829fbf5951ce04f8511",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 69,
"avg_line_length": 28.074626865671643,
"alnum_prop": 0.6018075491759702,
"repo_name": "IntMed/interage_python_sdk",
"id": "564ad8e6d48841cece1d113fc60fd21feb17b7fb",
"s... |
from __future__ import unicode_literals
import traitlets
from cesiumpy.base import _CesiumObject
import cesiumpy.entities.cartesian as cartesian
import cesiumpy.util.common as com
class Camera(_CesiumObject):
_props = ['destination', 'orientation']
destination = traitlets.Instance(klass=cartesian._Cartesi... | {
"content_hash": "7b9c408b355e3fe6eb054ba45109634e",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 81,
"avg_line_length": 33.9375,
"alnum_prop": 0.6488643339472069,
"repo_name": "sinhrks/cesiumpy",
"id": "27ddcf9e5690684dde940892016bf9b49df8d685",
"size": "1668",
"bina... |
import numpy as np
import theano
import logging
from numpy.testing import assert_allclose
from theano import tensor, function
from blocks import initialization
from blocks.bricks import Identity, Linear
from blocks.bricks.recurrent import SimpleRecurrent, LSTM
from blocks.initialization import Constant
from blocks_c... | {
"content_hash": "4a3c9ace83ff3f726ee9b9aca81b6dfa",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 66,
"avg_line_length": 27.238532110091743,
"alnum_prop": 0.6116537554732233,
"repo_name": "EderSantana/blocks_contrib",
"id": "6623af11c50602dc12e7122c73748535b2946bee",
"... |
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
token = "your_auth_token"
client = Client(account, token)
message = client.chat \
.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
.channels("CH... | {
"content_hash": "a425056ac65c935318f5324fb2263c8a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 65,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6921487603305785,
"repo_name": "teoreteetik/api-snippets",
"id": "4e8dc86c72763e0007b9c510e6810ae900f18991",
"size... |
import logging
from .taskqueue import app as celery_app
logger = logging.getLogger(__name__)
logger.info("Config package was imported")
| {
"content_hash": "08d7ba4c0ba5d2f2c796e0d3b3ebed75",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 42,
"avg_line_length": 23,
"alnum_prop": 0.7681159420289855,
"repo_name": "v-for-vincent/sight-reading",
"id": "10ce1b72323a98541554643c1702453b978772fb",
"size": "138",
"... |
import csv
from datetime import datetime
import pygal
import requests
import signal
import sys
import time
def getDeltaFromRequest(req):
reqDelta = req.elapsed
microDelta = reqDelta.microseconds
milliDelta = microDelta / 1000
return milliDelta
# TODO: Allow automatically stopping after some time
# ... | {
"content_hash": "5b098b42886a2e19948de8b542356ff3",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 79,
"avg_line_length": 26.11832061068702,
"alnum_prop": 0.5903843343562765,
"repo_name": "nsgomez/RequestTracker",
"id": "4959c8d4597d229df31ed39e4686641e442e38eb",
"size"... |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
f... | {
"content_hash": "abfc6ae5b1c18947fb2b672137c4f546",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 133,
"avg_line_length": 44.1965811965812,
"alnum_prop": 0.6372075033842584,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a9cf8690163e598bf3e8986361a7174b6f7ed418",
"s... |
from djangoappengine.settings_base import *
import os
# Activate django-dbindexer for the default database
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
AUTOLOAD_SITECONF = 'indexes'
SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'
INS... | {
"content_hash": "620055fe433372c2f660e6dd28c1377b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 28.75925925925926,
"alnum_prop": 0.7263361236316807,
"repo_name": "rickhurst/Django-non-rel-blog",
"id": "bf6ff134e85df4cfad1e8ea13fe82c2cc18f8abc",
... |
from configparser import RawConfigParser
def createsavefile(username, userclass, chapter):
config = RawConfigParser()
config.add_section('Main')
config.set('Main', 'Class', userclass)
config.set('Main', 'Username', username )
config.set('Main', 'Current_Chaper', chapter)
config.set('Cha... | {
"content_hash": "ea4dad0d12e631dd7e44e9d3b5b1d056",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 51,
"avg_line_length": 34.6,
"alnum_prop": 0.661849710982659,
"repo_name": "KaptainKaleb/Adventure-Adventure-Adventure",
"id": "68e918c7ede0fe2d43d6cb435431c7cbb1c99b02",
"... |
from __future__ import print_function, unicode_literals, absolute_import
'''Cursor control and color for the .NET console.
'''
#
# Ironpython requires a patch to work do:
#
# In file PythonCommandLine.cs patch line:
# class PythonCommandLine
# {
# to:
# public class PythonCommandLine
# ... | {
"content_hash": "8eff2be2519122862b8a77d8fe959b05",
"timestamp": "",
"source": "github",
"line_count": 418,
"max_line_length": 90,
"avg_line_length": 32.844497607655505,
"alnum_prop": 0.5245829994901304,
"repo_name": "tanium/pytan",
"id": "aa7f706fe05f2fda06394dea77df13444c2bc297",
"size": "14177"... |
import pickle
import doc2vec
with open('data/simple/models/graph_final.pickle', 'rb') as handle:
gf = pickle.load(handle)
# count category vectors from articles
doc2vec.doc2vec(gf)
| {
"content_hash": "7e255f4a11aa2b7a349dbffe84608dde",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 67,
"avg_line_length": 23.375,
"alnum_prop": 0.7540106951871658,
"repo_name": "Humblehound/WikiSpatialTree",
"id": "13d0b8ee39431ca6527ba79d9a19ec4ab889eb8e",
"size": "187",... |
import vb2py.extensions as extensions
# TODO: This class can be removed
class TranslateAttributes(extensions.SystemPluginREPlugin):
"""Plugin to convert attribute names from VB to Pythoncard
There are attribute like 'Text' and 'Visible' which are in lower
case in Pythoncard and others are simply different... | {
"content_hash": "6145d5d1a5cb49cfbc0ff0913816b0ba",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 34.964285714285715,
"alnum_prop": 0.6179775280898876,
"repo_name": "mvz/vb2py",
"id": "cc62b2c1325c5a3920fd2d8f2411ef5048f495ee",
"size": "979",
"b... |
from lxml import etree
from tempest.common import rest_client
from tempest.common import xml_utils as common
from tempest import config
CONF = config.CONF
class BaseExtensionsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(BaseExtensionsClientXML, self).__in... | {
"content_hash": "31b2c43839d45709c434e1fe06372585",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 68,
"avg_line_length": 24.90909090909091,
"alnum_prop": 0.6593673965936739,
"repo_name": "Mirantis/tempest",
"id": "fe8b7cb1865b39b7ac3cb1039f247d66ff64d1de",
"size": "1458... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20170414_1807'),
]
operations = [
migrations.AlterField(
model_name='manager',
... | {
"content_hash": "9501b51f204294ae67c0051bb6b73e91",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 124,
"avg_line_length": 25.68421052631579,
"alnum_prop": 0.6372950819672131,
"repo_name": "raghuraju/Simple-Project-Management",
"id": "ae76a9c52ed003155448f0db8ed7db13cf753d... |
"""
Bootstrap the app-template. This module disables itself after execution.
(This is meant to be run BEFORE changing $NEW_PROJECT_SLUG.
Once $NEW_PROJECT_SLUG is changed, bootstrap will no longer run.
See __init__.py for details.)
"""
import app_config
import json
import os
import subprocess
import uuid
import we... | {
"content_hash": "9feb679bbdd1a3404d36c1f407d63d21",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 145,
"avg_line_length": 36.51724137931034,
"alnum_prop": 0.6251180358829084,
"repo_name": "PostDispatchInteractive/app-template",
"id": "f32ac083efc0f97f3b913afd638a583517b6... |
from flask import blueprints, request, session, url_for, render_template
from werkzeug.utils import redirect
from models.users.user import User
import models.users.errors as UserErrors
import models.users.decorators as user_decorators
user_blueprint = blueprints.Blueprint('users', __name__)
@user_blueprint.route('/l... | {
"content_hash": "366ca049db34a9ba062f4a7ec7a9582d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 72,
"avg_line_length": 25.934426229508198,
"alnum_prop": 0.7098609355246523,
"repo_name": "asimonia/pricing-alerts",
"id": "0ccd78e889ef061cd64815c236385cb0d81d4320",
"size... |
"""
Unit test for ClassSelector parameters.
"""
from numbers import Number
import param
from . import API1TestCase
class TestClassSelectorParameters(API1TestCase):
def setUp(self):
super(TestClassSelectorParameters, self).setUp()
class P(param.Parameterized):
e = param.ClassSelecto... | {
"content_hash": "8a2d12063be01a57575217f53b6984db",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 88,
"avg_line_length": 31.747252747252748,
"alnum_prop": 0.6285912080304603,
"repo_name": "ioam/param",
"id": "e8aaf7d6d2db0fcc9f17b7769ff8e2fe2a9765e7",
"size": "2889",
... |
import uuid
import boto3
import pytest
from botocore.exceptions import ClientError
from moto import mock_sagemaker
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
TEST_REGION_NAME = "us-east-1"
@mock_sagemaker
def test_create__trial_component():
client = boto3.client("sagemaker", region_name=TEST_REGIO... | {
"content_hash": "108ac662141dada5911fd030aeef9c96",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 116,
"avg_line_length": 31.754716981132077,
"alnum_prop": 0.7011289364230541,
"repo_name": "spulec/moto",
"id": "0affddc3cb7c1c2315f6a4616c3ae97112d7b73b",
"size": "8415",... |
import unittest
from vodem.api import dns_mode
class TestDnsMode(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.valid_response = {
'dns_mode': 'auto',
}
def test_call(self):
resp = dns_mode()
self.assertEqual(self.valid_response, resp)
| {
"content_hash": "0e164edca903c67751a4869c006bf012",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 19.25,
"alnum_prop": 0.6071428571428571,
"repo_name": "alzeih/python-vodem-vodafone-K4607-Z",
"id": "1fff65ffa07acb9d3f1247c34c5f18b08d4ce529",
"size... |
"""The tests for the wake on lan switch platform."""
import unittest
from unittest.mock import patch
from homeassistant.setup import setup_component
from homeassistant.const import STATE_ON, STATE_OFF
import homeassistant.components.switch as switch
from tests.common import get_test_home_assistant
TEST_S... | {
"content_hash": "7593349acdd43629f19a8ed31c020167",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 68,
"avg_line_length": 32.851063829787236,
"alnum_prop": 0.5667098445595855,
"repo_name": "stefan-jonasson/home-assistant",
"id": "063cf93d87118ca7bc59faba2623b9de3782c0fa",... |
"""booksearch URL Configuration.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | {
"content_hash": "3270399a5dc7af41bc6ba672e4d1a578",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 37.04545454545455,
"alnum_prop": 0.694478527607362,
"repo_name": "gitgik/booksearch",
"id": "2f29cd66d8d9fad83f4b9a4ecf51c5a2ab42b426",
"size": "815"... |
import abc
import copy
import numpy as np
from menpo.base import Vectorizable
from menpo.transform.base import (Alignment, ComposableTransform,
VComposable, VInvertible)
class HomogFamilyAlignment(Alignment):
r"""
Simple subclass of Alignment that adds the ability to create ... | {
"content_hash": "6ba38585826592194dab40d185f8b317",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 79,
"avg_line_length": 35.651785714285715,
"alnum_prop": 0.6076884547958928,
"repo_name": "jabooth/menpo-archive",
"id": "bc59ae7547783a0406bb6a37467d8b6f3a8e18d5",
"size"... |
from flask import session, make_response, request, redirect, jsonify, render_template, current_app
from flask.ext.login import logout_user
from flask.views import View
from onelogin.saml2.auth import OneLogin_Saml2_Auth
from urlparse import urlparse
####
# Extension Manager
####
class SamlManager(object):
def __... | {
"content_hash": "3b79701c28f549a6d41884e327ba2d55",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 98,
"avg_line_length": 30.980891719745223,
"alnum_prop": 0.5933388157894737,
"repo_name": "cbron/python-saml-flask",
"id": "615dbc379d6eda0482779008b51a0d83f1379693",
"siz... |
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the a... | {
"content_hash": "8d1c94cc3672bb44ed8ced414e040635",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 71,
"avg_line_length": 33.6,
"alnum_prop": 0.6828231292517006,
"repo_name": "vencax/py-s21-admin",
"id": "78941d18cdab6a3e3d49271fa9d33b18c6afc038",
"size": "1176",
"bina... |
from kaira.loaders.abstract_loader import AbstractLoader
class LosotoLoader(AbstractLoader):
def __init__(self,data_container=None,**kwargs):
super(LosotoLoader,self).__init__(data_container=data_container,**kwargs)
def init_default_data_container(self):
'''Return the default empty data contai... | {
"content_hash": "f077d3e4a49e097c4c26cd3f39d603d2",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 81,
"avg_line_length": 32.54545454545455,
"alnum_prop": 0.7094972067039106,
"repo_name": "Joshuaalbert/KAIRApy",
"id": "d44734529bf1eb5119b32247d8e3d0b9e513e346",
"size": "... |
import pygame
class GameInstructions:
"""
GameOver class to emulate the game state 'game paused'
state variables:
score:integer
menuButton: pygame.Rect object
retryButton: pygame.Rect object
exitButton: pygame.Rect object
"""
def __init__(self... | {
"content_hash": "c276f367b949ea778656e8488c867283",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 145,
"avg_line_length": 33.63265306122449,
"alnum_prop": 0.5679611650485437,
"repo_name": "GuerreroGames/Snake-Game",
"id": "03ab1606e802053564b895ebb57bf1855590131c",
"siz... |
from copy import deepcopy
from glob import iglob as GLOBiglob
import json
from os.path import join as OSpath__join
# ENSO_metrics functions
from EnsoPlots.EnsoMetricPlot import main_plotter
from EnsoPlots.EnsoPlotToolsLib import remove_metrics
# ---------------------------------------------------#
# Arguments
# ----... | {
"content_hash": "50ebbe595f353a2d701b559bea17d60a",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 120,
"avg_line_length": 56.765765765765764,
"alnum_prop": 0.6135534042215521,
"repo_name": "eguil/ENSO_metrics",
"id": "024657175f6ef2cd779e32dbfc5b4069145baf7c",
"size": ... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Video.user'
db.add_column('videoportal_video', 'user',
self.gf('django.db.models.fields.relate... | {
"content_hash": "c7507b420e0c9ee20ff890045d4c8d51",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 208,
"avg_line_length": 76.89430894308943,
"alnum_prop": 0.5491647282723621,
"repo_name": "Piratenfraktion-Berlin/OwnTube",
"id": "8e003abce05bb8f766c65a99577866c1087fb97e",... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('domain', '0008_use_livequery'),
]
operations = []
| {
"content_hash": "ea83caafe952b6caa324ee6889a58be2",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 41,
"avg_line_length": 16.5,
"alnum_prop": 0.6363636363636364,
"repo_name": "dimagi/commcare-hq",
"id": "2ec993bb05c45039ea718ec60e7e9058d2e9586f",
"size": "165",
"binary... |
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import BadSymbol
from ccxt.base.decimal_to_precision import TICK_SIZE
from ccxt.base.precise import Precise
class bitstamp1(Exchange):
def describe(self):
return self.deep_extend(super(bitstamp1, self... | {
"content_hash": "2f16528e5efa8f9919599c900f356f4d",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 193,
"avg_line_length": 46.63101604278075,
"alnum_prop": 0.5276376146788991,
"repo_name": "ccxt/ccxt",
"id": "3696a7d131f246c078177d8d5c309a1aa7cd6a2c",
"size": "17621",
... |
"""
Finds all cliques in an undirected graph. A clique is a set of vertices in the
graph such that the subgraph is fully connected (ie. for any pair of nodes in
the subgraph there is an edge between them).
"""
def find_all_cliques(edges):
"""
takes dict of sets
each key is a vertex
value is set of all ... | {
"content_hash": "5264c70ccdedc147e452d242c925ec7a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 99,
"avg_line_length": 34.785714285714285,
"alnum_prop": 0.6228610540725531,
"repo_name": "keon/algorithms",
"id": "f1db16ed5af625ae6670ba3ce7a2334e08259877",
"size": "1461... |
"""
Personal Python package of Daniel Haase.
"""
from os.path import abspath, dirname, join
from warnings import warn
# read version number from text file
try:
_versionFilename = join(dirname(abspath(__file__)), "VERSION.txt")
with open(_versionFilename, "r") as _f:
for _line in _f:
_line... | {
"content_hash": "837394b747c5782268558a93bfd27d07",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 97,
"avg_line_length": 26.613636363636363,
"alnum_prop": 0.5499573014517506,
"repo_name": "dhaase-de/dh-python-dh",
"id": "31ddb30f4e7fd5a7e059f9472fa5d95dd74cbbf0",
"size"... |
import argparse
import csv
import os
##############################################################################
################################ Constants #################################
##############################################################################
LOGS_FOLDER_NAME = 'logs'
LOG_FILE_EXTENSION... | {
"content_hash": "12d9301be1c89b0492278c1687e57f70",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 90,
"avg_line_length": 38.10243902439024,
"alnum_prop": 0.5589553194213289,
"repo_name": "Javiercerna/pixhawk-flight-time",
"id": "a594455b9433c97e65a2bffbe8c693d0e8223414",... |
from ..geometry import create_plane
from ..gloo import set_state
from .mesh import MeshVisual
class PlaneVisual(MeshVisual):
"""Visual that displays a plane.
Parameters
----------
width : float
Plane width.
height : float
Plane height.
width_segments : int
Plane segmen... | {
"content_hash": "bff3684573558e6ff9c628e42fcccddf",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 79,
"avg_line_length": 35.327586206896555,
"alnum_prop": 0.5851634943875061,
"repo_name": "hronoses/vispy",
"id": "a4cc965d51343acaf5675e1413cc75640e71c60e",
"size": "2375"... |
""" Classes and routines to handle lattice issues for online modeling and
runtime calculations.
* ``LteParser``: parse ``ELEGANT`` lattice definition files for simulation:
1. convert lte file into dict/json format for further usage;
2. resolve rpn expressions within element definitions;
3. retain prefixed ... | {
"content_hash": "5e5515984bb0ce737390c2fcba0e12f1",
"timestamp": "",
"source": "github",
"line_count": 946,
"max_line_length": 116,
"avg_line_length": 37.21141649048626,
"alnum_prop": 0.5326117834213965,
"repo_name": "Archman/beamline",
"id": "4ec8bd7a9f596d1e18bb825eff4e96d4ce2f1242",
"size": "35... |
import sys
from helpers.run import *
args = sys.argv[1:]
if len(args) > 0:
if args[0] == "test":
options = "--configuration test/phpunit.xml"
tests = "test/Cases/."
filters = ""
if len(args) > 2:
if args[1] == "--filter":
filters = "--filter {test}".for... | {
"content_hash": "2147c75dcf2ea98524334db81e89aa08",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 93,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.4223300970873786,
"repo_name": "richrdkng/ffmpeg-php-wrapper",
"id": "0c67be8abbf119e515eb2126a6ae1eb5015bad13",
... |
from csv import DictWriter
from io import StringIO
from typing import Any, Dict, Iterable, List, Optional, Union
from flask import Response, jsonify, request, stream_with_context
from flask.json import dumps
import orjson
from ._config import MAX_RESULTS, MAX_COMPATIBILITY_RESULTS
from ._common import app, is_compati... | {
"content_hash": "088c12a10fac9bef1119f41066013c64",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 120,
"avg_line_length": 28.99245283018868,
"alnum_prop": 0.5603279968762203,
"repo_name": "cmu-delphi/delphi-epidata",
"id": "715214e198646468367ff3f10c8f539a6940e4be",
"s... |
from eventlet import tpool
from nova import context
from nova import db
from nova import flags
from nova import log as logging
from nova import utils
from nova.virt.libvirt import netutils
LOG = logging.getLogger("nova.virt.libvirt.firewall")
FLAGS = flags.FLAGS
try:
import libvirt
except ImportError:
LOG.... | {
"content_hash": "2a5f249cd00143c00bcea0cdda1eae21",
"timestamp": "",
"source": "github",
"line_count": 798,
"max_line_length": 79,
"avg_line_length": 41.41102756892231,
"alnum_prop": 0.5300792834231072,
"repo_name": "30loops/nova",
"id": "c6253511e68f90c9f624dae2fa81815727b5f66c",
"size": "33866",... |
class Solution(object):
def canJump(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
max_reach, end = 0, len(nums) - 1
for idx, num in enumerate(nums):
if max_reach < idx:
return False
if max_reach >= end:
... | {
"content_hash": "c67bc16ec7217ff7ef4cb1115ae9d689",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 29.923076923076923,
"alnum_prop": 0.4652956298200514,
"repo_name": "ChuanleiGuo/AlgorithmsPlayground",
"id": "af01a3d15d729c7626d8c23e80fd1b44d933ff19"... |
"""
Forward Simulation of Gradiometry Data for Magnetic Vector Models
=================================================================
Here we use the module *SimPEG.potential_fields.magnetics* to predict magnetic
gradiometry data for magnetic vector models. The simulation is performed on a
Tree mesh. For this tutori... | {
"content_hash": "39ebab1ff7c8fa00893fc91e6a526fd5",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 87,
"avg_line_length": 33.525597269624576,
"alnum_prop": 0.6715870915199023,
"repo_name": "simpeg/simpeg",
"id": "fff7fe4e236a76bd897967541112d161f9990141",
"size": "9823"... |
from pyparsing import ZeroOrMore, Regex
from PyProjManCore.proj_man import ProjMan
import json
import os
# This parser object should handle the following entities
# action
# object(s)
# parameters
# each verb objects and parameters are linked to an API call defined in the api.py module
class OpCode:
"""Used to s... | {
"content_hash": "2a4c5346b5d7cdbf2df9c3028ba79a33",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 125,
"avg_line_length": 39.140969162995596,
"alnum_prop": 0.5698368036015757,
"repo_name": "aawadall/PyProjMan",
"id": "b01cb3db400cba65d148ceefd4e33bf5537b34d9",
"size": ... |
import time
import json
import threading
import delegator
from tpl import errors
from pykit.path.temp import TempPipe
DEFAULT_SHELL_VARS = {
'pipe': None
}
class ShellExec(threading.Thread):
def __init__(self, command, injected_vars=None):
self.command = command
self.injected_vars = injected_... | {
"content_hash": "27227c60890edd77d70659f8f821fa76",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.57,
"repo_name": "faycheng/tpl",
"id": "90e74af6ac970d5f2da36a9a1f6d8a56c5b8d708",
"size": "1240",
"binary": fa... |
'''A convenient class for parsing HTML pages.'''
from __future__ import unicode_literals
from HTMLParser import HTMLParser
import logging
import re
from RSSvk.core import Error
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
class HTMLPageParser(HTMLParser):
'''A convenient class for parsing HTML... | {
"content_hash": "a13a95e167ee884a54f83f3363658631",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 128,
"avg_line_length": 27.548895899053626,
"alnum_prop": 0.5151723348219398,
"repo_name": "Densvin/RSSVK",
"id": "c61b449a86af6e59ef2678f448173dfb6fbe8a8e",
"size": "8733... |
""" Cisco_IOS_XE_process_cpu_oper
This module contains a collection of YANG definitions for
monitoring CPU usage of processes in a Network Element.Copyright (c) 2016\-2017 by Cisco Systems, Inc.All rights reserved.
"""
import re
import collections
from enum import Enum
from ydk.types import Empty, YList, YLeafLi... | {
"content_hash": "d627b182cb49778981ec3a1a83a2e9bb",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 333,
"avg_line_length": 31.825072886297377,
"alnum_prop": 0.48882374496152436,
"repo_name": "111pontes/ydk-py",
"id": "5f4fcf5cc8bdd0208f09e747730dc372129cae02",
"size": "... |
from django.test import TestCase
class mediacracyTest(TestCase):
"""
Tests for mediacracy
"""
def test_mediacracy(self):
pass
| {
"content_hash": "24e6b60556853fcafd584e32a145cdcb",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 32,
"avg_line_length": 17.88888888888889,
"alnum_prop": 0.6086956521739131,
"repo_name": "sixpearls/django-mediacracy",
"id": "7a83bf1dec9ef0768ed6538fb89b605766ae4db1",
"si... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('geral', '0031_fo2_parametro__jud... | {
"content_hash": "c695b8d097f333a7cadd2d37ef7fb1e5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 157,
"avg_line_length": 29.61904761904762,
"alnum_prop": 0.6672025723472669,
"repo_name": "anselmobd/fo2",
"id": "6de57da5f3d1f9a591f220109713c8ed20258550",
"size": "696",
... |
import json
import base64
import urllib
import urllib2
import ConfigParser
import subprocess
from baidu_nlu.srv import *
import rospy
'''
Baidu ASR Service need to register in http://yuyin.baidu.com
create your application, after that you will have your cuid,apikey,secretkey
all the information write in the nlu.cfg fi... | {
"content_hash": "c9ad69fc9d39dde89c2c1ffbade6f3cb",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 136,
"avg_line_length": 25.568181818181817,
"alnum_prop": 0.648,
"repo_name": "giphub/ros_test_afr",
"id": "150e3b01adc4179f3ca8d733ec997906fe3b2869",
"size": "2287",
"bi... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from appProcafe.models import Department, Unit, Section, Risk, Position, Location,\
Paysheet, Type, CourseRequest, CourseChangeRequest
from appProcafe.models import Telephone, Document, Takes, Course
from appProcafe.models import ... | {
"content_hash": "be78b1f00780fdc54a4fb20a7fab9037",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 171,
"avg_line_length": 37.252873563218394,
"alnum_prop": 0.6460968836778772,
"repo_name": "pierorex/PROCAFE-SSL",
"id": "7af4a614a4f09e8901c13163445f321f3096ad80",
"size":... |
import re
from .table import Table
from .column import Column
from .schema_manager import SchemaManager
from .platforms.postgres_platform import PostgresPlatform
class PostgresSchemaManager(SchemaManager):
def _get_portable_table_column_definition(self, table_column):
if table_column['type'].lower() == '... | {
"content_hash": "3428c78ad6e38c267c81ef47cba9268d",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 95,
"avg_line_length": 32.99047619047619,
"alnum_prop": 0.5072170900692841,
"repo_name": "sdispater/eloquent",
"id": "e024a411845bbcce0ec359ea75376ca37297e493",
"size": "3... |
from operator import attrgetter
from django.views.generic import DetailView
from ohashi.shortcuts import get_object_or_none
from apps.accounts.views import QuicklinksMixin
from .models import Group, Idol, Membership, Staff
class GroupDetailView(QuicklinksMixin, DetailView):
queryset = Group.objects.all()
t... | {
"content_hash": "69935bba5ccc6cb5abe7415570a01ac0",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 158,
"avg_line_length": 50.2,
"alnum_prop": 0.6726427622841965,
"repo_name": "hello-base/web",
"id": "dcd92d502e9a20e9e0c3d44449f83206d3b132db",
"size": "3012",
"binary":... |
import ast
import re
import six
import pep8
"""
Guidelines for writing new hacking checks
- Use only for Manila specific tests. OpenStack general tests
should be submitted to the common 'hacking' module.
- Pick numbers in the range M3xx. Find the current test with
the highest allocated number and then pick ... | {
"content_hash": "63b3c31b231d161e53f0ecb15b4749c6",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 78,
"avg_line_length": 36.63636363636363,
"alnum_prop": 0.628992235651965,
"repo_name": "NetApp/manila",
"id": "1778293ae2ad2f8049ce9b541a8b1d8c15fe2a96",
"size": "13099",... |
from __future__ import absolute_import
# encoding: UTF-8
from tests.mock import Client
from tml.api.pagination import allpages
import unittest
from tml import Application
from tml.language import Language
from tml.translation import Key
from tml.dictionary.source import SourceDictionary
from tml.rules.contexts.gender i... | {
"content_hash": "fbb27e7c9ae8520ee38127d7811f8001",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 143,
"avg_line_length": 39.023809523809526,
"alnum_prop": 0.6571079926784624,
"repo_name": "translationexchange/tml-python",
"id": "30d5d2af49299b659330afa0ee03e616d7e35a7d",... |
import json
import tweepy
import sys
import os.path
import argparse
import datetime
import shutil
def get_file_name(data_path, file_name, create_path=False, warn=False):
# check the data path and file
data_file_name = os.path.join(data_path, file_name)
if create_path:
if not os.path.isdir(data_pa... | {
"content_hash": "a1fd8b30bd4aeaf8134a5bbbb8839a89",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 145,
"avg_line_length": 38.702127659574465,
"alnum_prop": 0.6297416162726773,
"repo_name": "rwsharp/statement_collector",
"id": "a59ae5b6a944a81002c367c14c1c74ba97c3efb9",
... |
import re
import os
import os.path
import pathlib
import json
import hashlib
import random
import itertools
from . import topologies
from . import tests
from . import analyze
from lib.bash import CommandBlock
from pydblite import Base
import warnings
warnings.formatwarning = lambda message, category, *a: '{}: {}\n'.for... | {
"content_hash": "d5bda39c5228b311b7b3f15ad7d5fbfa",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 227,
"avg_line_length": 41.696296296296296,
"alnum_prop": 0.6180493871025049,
"repo_name": "serl/topoblocktest",
"id": "ac8e3539a9bbf2e7f01df1d065bc62009f5bfb2a",
"size": ... |
from q2_diversity_lib.alpha import METRICS
from ._pipeline import alpha, alpha_phylogenetic
from ._visualizer import (alpha_group_significance, alpha_correlation,
alpha_rarefaction,
alpha_rarefaction_unsupported_metrics)
__all__ = [
'alpha', 'alpha_phylogenetic... | {
"content_hash": "514cdd19abffe5fbfc4557cd17099c62",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 35,
"alnum_prop": 0.6681318681318681,
"repo_name": "jakereps/q2-diversity",
"id": "191456d9f4875ea96bc74602b384e6038c26e906",
"size": "805",
"binar... |
import sys, os, io, yaml, re, functools
# all open() calls have an implied encoding parameter, UTF-8 by default
open = functools.partial(__builtins__.open,
encoding=os.environ.get("SOURCE_ENCODING", "utf8"))
# some constants to make our lives easier
TAB = "\t"
EOL = "\n"
# regular expression for matching dedent... | {
"content_hash": "537890388b476e740604f5f8eb7186b9",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 159,
"avg_line_length": 50.533762057877816,
"alnum_prop": 0.5775642657164672,
"repo_name": "awsdocs/aws-doc-sdk-examples",
"id": "234f6cefce096cea1a1367f58bdaf841815a93ac",
... |
DOCUMENTATION = '''
---
module: hashivault_policy_delete
version_added: "2.1.0"
short_description: Hashicorp Vault policy delete module
description:
- Module to delete a policy from Hashicorp Vault.
options:
url:
description:
- url for vault
default: to environment variable VAULT_ADD... | {
"content_hash": "f939fa5dae1fdd5cab6692c251f703c6",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 167,
"avg_line_length": 31.568181818181817,
"alnum_prop": 0.6501079913606912,
"repo_name": "cloudvisory/ansible-modules-hashivault",
"id": "e394df2858ca7a88550d948d6a693deac8... |
import os, sys, copy, types
import Utilities, random
from math import *
import numpy as np
class NestedData(object):
"""This class manages a multiply nested dictionary and derives properties such the
levels of nesting. It also allows the dictionary to be re-arranged by secondary
keys. The methods as... | {
"content_hash": "3b3425877f1eafd30ed992a39e109d97",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 86,
"avg_line_length": 30.262569832402235,
"alnum_prop": 0.5659959387114639,
"repo_name": "dmnfarrell/peat",
"id": "eddab2ed6978eac3aa71caeb611fb3bea0cfdb33",
"size": "632... |
"""Tests for Pruning callbacks."""
import os
import tempfile
import numpy as np
import tensorflow as tf
# TODO(b/139939526): move to public API.
from tensorflow_model_optimization.python.core.keras import test_utils as keras_test_utils
from tensorflow_model_optimization.python.core.sparsity.keras import prune
from t... | {
"content_hash": "72d6ab8cd4141df041a8184f21be93ba",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 90,
"avg_line_length": 36.71328671328671,
"alnum_prop": 0.7022857142857143,
"repo_name": "tensorflow/model-optimization",
"id": "31106100d935770a9a960ab72604e81700984462",
... |
"""Run all tests."""
from __future__ import absolute_import, division, print_function, unicode_literals
from os import path
import sys
import unittest
from six import PY3
if not PY3:
try:
from mock import __version__
except ImportError:
print('Please run `pip install mock`')
raise
#... | {
"content_hash": "689b710713c2fe21e14fd2c40b020bc8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 86,
"avg_line_length": 24.5,
"alnum_prop": 0.6594387755102041,
"repo_name": "frost-nzcr4/find_forks",
"id": "364b6a31163b03ba2ba020ed92632c6aa47de558",
"size": "822",
"bi... |
'''
Use parameters from Diskfit in the Galaxy class
'''
from galaxies import Galaxy
from astropy.table import Table
import astropy.units as u
from cube_analysis.rotation_curves import update_galaxy_params
from paths import fourteenB_HI_data_path, fourteenB_HI_data_wGBT_path
# The models from the peak velocity aren'... | {
"content_hash": "9a43c060940db16e3292ca25368ebaa1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 25.904761904761905,
"alnum_prop": 0.75,
"repo_name": "e-koch/VLA_Lband",
"id": "c831661a4478f0ae697ba155875ba48e79c5b6e8",
"size": "1089",
"binary"... |
import requests
from bs4 import BeautifulSoup
import collections
import validation
def get_api_key(admin_domain, username, password):
endpoint_string = 'http://' + admin_domain + '/api/1/get.asmx/GetAPIKey'
payload = dict(username=username, password=password)
valid_call, soup = validation.soup_validatio... | {
"content_hash": "413aa02168d5f2dfd1bc89cc5c1639c9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 76,
"avg_line_length": 25,
"alnum_prop": 0.6863157894736842,
"repo_name": "cake-tools/ConversionExportTool",
"id": "62f2159edae91112865caf05bd6997c6d2a9e88c",
"size": "475"... |
'''
网易云音乐 Menu
'''
import curses
import locale
import threading
import sys
import os
import time
import webbrowser
import platform
from api import NetEase
from player import Player
from ui import Ui
from const import Constant
from config import Config
import logger
import signal
from storage import Storage
from cache ... | {
"content_hash": "a1a1d6889199b4a77b594ad684a0241d",
"timestamp": "",
"source": "github",
"line_count": 765,
"max_line_length": 134,
"avg_line_length": 36.840522875816994,
"alnum_prop": 0.48444097505588474,
"repo_name": "Ma233/musicbox",
"id": "de97be3f19d61d614f2d5a27691f87355cad47b5",
"size": "29... |
print "Hello World!"
# print "Hello Again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print "I'd much rather you 'not'."
print 'I "said" do not touch this.'
print "I \"said\" do not touch this." | {
"content_hash": "dbd50e38516b43167b90e850133830e4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 37,
"avg_line_length": 27.875,
"alnum_prop": 0.6771300448430493,
"repo_name": "pratikdesai/learnpython",
"id": "4e808f523c6d0ae9388fcef2c28de43e0b639624",
"size": "223",
"... |
"""
Copyright 2015 Reverb Technologies, Inc.
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... | {
"content_hash": "ec29f5d1449b1e471670d6b961fe278e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 97,
"avg_line_length": 27.746666666666666,
"alnum_prop": 0.5444497837578087,
"repo_name": "ahmedlawi92/pnc-cli",
"id": "f0f244d56511941d02c7bd6c47487bdf74e32816",
"size": "... |
import argparse
import json
import multiprocessing
import os
import re
import subprocess
import sys
import threading
from pathlib import Path
import queue as queue
def get_format_invocation(f, cmake_format_binary):
"""Gets a command line for cmake-format."""
start = [cmake_format_binary, "-i", f]
return s... | {
"content_hash": "c84e0294cf16731ded20da507b19a626",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 86,
"avg_line_length": 28.007874015748033,
"alnum_prop": 0.5805454034298566,
"repo_name": "RoboJackets/robocup-software",
"id": "400d15b65b11995e16de0403815601e0feb90e28",
... |
import logging
import sqlite3
import logger
import problemdb
import teamdb
from api import api
from flask import Flask, jsonify, make_response, render_template, session, redirect, url_for
from flask_limiter import Limiter
from decorators import admins_only, redirect_if_not_logged_in
app = Flask(__name__)
limiter = L... | {
"content_hash": "ea0ede09265762df91955f68fe52e0c1",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 121,
"avg_line_length": 31.14814814814815,
"alnum_prop": 0.6963931827189853,
"repo_name": "james9909/IntroCTF",
"id": "e1edba96886e4fb441e3239ccf4eb4a34f2c711f",
"size": "2... |
"""
Utility module to handle Java Manifest.mf files
:author: Thomas Calmant
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
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 th... | {
"content_hash": "a7a54ff666cd9b0efc64d56b42855ee5",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 80,
"avg_line_length": 29.48,
"alnum_prop": 0.5150222911416942,
"repo_name": "isandlaTech/cohorte-devtools",
"id": "7af3b3e7bd3e5f571e0db547f1f6442b5ecd5384",
"size": "520... |
from datetime import datetime
from itertools import izip
from stdnet.test import TestCase
from stdnet.utils import populate
from examples.models import Calendar, DateValue
NUM_DATES = 100
dates = populate('date',NUM_DATES)
values = populate('string', NUM_DATES, min_len = 10, max_len = 120)
class Tes... | {
"content_hash": "d1d884cad3c097aa4cdd766c049cfe44",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 67,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.569620253164557,
"repo_name": "TheProjecter/python-stdnet",
"id": "a99696404c68d0ffcd57af96bc296e3de18ea706",
"si... |
import os
import weakref
from ConfigParser import SafeConfigParser
class SingletonMixin(object):
"""
Adds a singleton behaviour to an existing class.
weakrefs are used in order to keep a low memory footprint.
As a result, args and kwargs passed to classes initializers
must be of weakly refereable... | {
"content_hash": "61fe1ec7012c3f3af2815363f8d1eb07",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.5919661733615222,
"repo_name": "jamilatta/citedby",
"id": "750fdefd0563ccedb799e3feebca6dc0a2a0b0f2",
"size": "18... |
def test_resources(e2e_plan_runner):
"Test that plan works and the numbers of resources is as expected."
modules, resources = e2e_plan_runner()
assert len(modules) > 0
assert len(resources) > 0
| {
"content_hash": "cbfc27e8d29d6d918ec2bd1d6433c5d9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 69,
"avg_line_length": 40.4,
"alnum_prop": 0.7277227722772277,
"repo_name": "GoogleCloudPlatform/cloud-foundation-fabric",
"id": "74705e423efa5a9095ab21fafe9925f445ef97dc",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.