text
stringlengths
4
1.02M
meta
dict
import structlog from banal import ensure_list, ensure_dict from normality import normalize, stringify log = structlog.get_logger(__name__) class Lookup(object): """Lookups are ways of patching up broken input data from a source.""" def __init__(self, name, config): self.name = name self.req...
{ "content_hash": "c585f54d754912044aead4a8ab671e33", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 74, "avg_line_length": 31.107142857142858, "alnum_prop": 0.574052812858783, "repo_name": "pudo/opennames", "id": "1c88cc5db018065190b3a50f975aa4117a014683", "size": "3484"...
from shinytest import ShinyTestCase class TestNpc(ShinyTestCase): def setUp(self): ShinyTestCase.setUp(self) from shinymud.models.player import Player from shinymud.models.npc import Npc from shinymud.models.area import Area from shinymud.models.room import Room ...
{ "content_hash": "bda7d48fc1532d2478bfc4ddd96bf215", "timestamp": "", "source": "github", "line_count": 198, "max_line_length": 110, "avg_line_length": 53.974747474747474, "alnum_prop": 0.6433049499391784, "repo_name": "shinymud/ShinyMUD", "id": "be6f999b68334f7b6e1d53d020cd0749ba6bdf72", "size": "...
from boundaries.base_views import APIView from django.shortcuts import get_object_or_404 from postcodes.models import Postcode class PostcodeDetailView(APIView): model = Postcode def get(self, request, code): postcode = get_object_or_404(Postcode, code=code) if request.GET.get('sets'): ...
{ "content_hash": "55b18431a28abe142d2778bfec5311bf", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 57, "avg_line_length": 27.875, "alnum_prop": 0.6547085201793722, "repo_name": "opennorth/represent-postcodes", "id": "0adade216dd7d8595925de7443b71c1abc7ca64a", "size": "44...
import json import os # Celery from celery import task # OpenStack import keystoneclient.v2_0.client as ksclient from novaclient.v1_1 import client # Cosmo from cosmo.events import send_event, get_cosmo_properties @task def provision(__cloudify_id, nova_config, security_group, **kwargs): nova_client = _init_cli...
{ "content_hash": "d54971b66c247292af61d2fb0973985a", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 122, "avg_line_length": 36.72, "alnum_prop": 0.6227305737109659, "repo_name": "Fewbytes/cosmo-plugin-openstack-sg-provisioner", "id": "ffc410c0c6daf1e13a37e921208df9c7395b1ec...
""" Tests for the blaze interface to the pipeline api. """ from __future__ import division from collections import OrderedDict from datetime import timedelta from unittest import TestCase import warnings import blaze as bz from datashape import dshape, var, Record from nose_parameterized import parameterized import n...
{ "content_hash": "bf44c46622023ea966cb7aa9c0523d41", "timestamp": "", "source": "github", "line_count": 617, "max_line_length": 78, "avg_line_length": 31.905996758508913, "alnum_prop": 0.487656202377324, "repo_name": "jimgoo/zipline-fork", "id": "c42f4e1490003b67ba3a006445f9059b748ff70a", "size": "...
import re import os.path from io import open from setuptools import find_packages, setup # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-marketplaceordering" PACKAGE_PPRINT_NAME = "Market Place Ordering" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/'...
{ "content_hash": "796c2d58604363152e986e16e73ab26b", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 103, "avg_line_length": 35.042857142857144, "alnum_prop": 0.62291072156543, "repo_name": "Azure/azure-sdk-for-python", "id": "c1ab69102ad07eef37579d074173fa185b3bddb0", "si...
from ._farm_beats_client import FarmBeatsClient __all__ = ['FarmBeatsClient']
{ "content_hash": "16035e01f095056480803101f9dbc2dc", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 47, "avg_line_length": 39, "alnum_prop": 0.7435897435897436, "repo_name": "Azure/azure-sdk-for-python", "id": "8250e30455784bd0f727bf199e470f56e3d218e7", "size": "546", "b...
import os import re from slack_bolt import App from slack_bolt.adapter.socket_mode import SocketModeHandler from sympy import sympify, SympifyError app = App(token=os.environ["SLACK_BOT_TOKEN"]) @app.message(re.compile(r"^([-+*/^%!().\d\s]+)$")) def calc(message, context, say): try: formula = context["m...
{ "content_hash": "7a89b6e6933564525968b1236fd0ba02", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 60, "avg_line_length": 27.555555555555557, "alnum_prop": 0.6276881720430108, "repo_name": "takanory/slides", "id": "c1952c183c22cd0c3cff1b566b25d43c1778343f", "size": "744"...
""" .. module:: win_symlink :platform: Windows :synopsis: Add support in Python for symlinks under Windows Vista and up, if not already present. .. moduleauthor:: Brandon Huber """ # # Original Creation Date: 2016-05-07 # from __future__ import absolute_import from __future__ import division...
{ "content_hash": "8388ee0343fe1234b2b8726eb930aec5", "timestamp": "", "source": "github", "line_count": 206, "max_line_length": 80, "avg_line_length": 29.393203883495147, "alnum_prop": 0.5846407927332783, "repo_name": "shalesbridge/steamssdmanager", "id": "360de4919c26b5c3030b7defa68a6193fda1b27b", ...
import datetime from dateutil.parser import parse import pytz import app_config import logging logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) """ Tools for managing charts """ class TimeTools: @staticmethod def seconds_since(a): now = datetime.datetime.now(py...
{ "content_hash": "f7e0f60c55675ec6e734057504b6387b", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 101, "avg_line_length": 30.78640776699029, "alnum_prop": 0.575212866603595, "repo_name": "thecarebot/carebot", "id": "3727dce63a1badf2b675d43b7a7f73abb0d95ba7", "size": "3...
import base64 import logging import re import time from html import unescape as html_unescape from Crypto.Cipher import PKCS1_v1_5 from Crypto.PublicKey import RSA import streamlink from streamlink.exceptions import FatalPluginError from streamlink.plugin import Plugin, PluginArgument, PluginArguments, pluginmatcher ...
{ "content_hash": "901224e0df946d31275acd28423a7cbd", "timestamp": "", "source": "github", "line_count": 229, "max_line_length": 122, "avg_line_length": 40.646288209606986, "alnum_prop": 0.5711216158143533, "repo_name": "melmorabity/streamlink", "id": "058461ef024fb5deec899dff20effdbdaf2434cf", "siz...
__author__ = "Peter Shipley" import os from ISY.IsyEvent import ISYEvent def main() : server = ISYEvent() # you can subscribe to multiple devices # server.subscribe('10.1.1.25') server.subscribe( addr=os.getenv('ISY_ADDR', '10.1.1.36'), userl=os.getenv('ISY_USER', "admin"), ...
{ "content_hash": "8e52b45f028b12e3fd7e2dc94b8e26d9", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 65, "avg_line_length": 21.176470588235293, "alnum_prop": 0.5708333333333333, "repo_name": "sjthespian/ISYlib-python", "id": "a8ec5d84cec6b0043f94498e238c976cebf86034", "siz...
def detail(): item_id = request.args(0) or redirect(UR(c='default', f='index')) item = db(db.item.id == item_id).select() return locals() def item_add_location_list(): itens = db(db.item.id > 0).select(orderby=db.item.item_name) return locals() @auth.requires_login() def add_location(): item...
{ "content_hash": "aa8a2ad0682472bccc5e26aa0452d8d8", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 70, "avg_line_length": 28.782608695652176, "alnum_prop": 0.6117824773413897, "repo_name": "kaaete/web_app", "id": "6c32c9621e8289b73414b75d5b00c1966843db8c", "size": "687",...
"""Tensor utility functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor from tensorfl...
{ "content_hash": "466e29d38ddf7169d8406a59fcf18603", "timestamp": "", "source": "github", "line_count": 279, "max_line_length": 80, "avg_line_length": 36.13978494623656, "alnum_prop": 0.6766835267281563, "repo_name": "unsiloai/syntaxnet-ops-hack", "id": "8839da2947aff58447e6fd28422c29e2b666ec3d", "...
import os, os.path, sys, argparse SOURCE_TEMPLATE = """ #include "internal/Embedded.h" #include <string> #include <unordered_map> namespace { %s const std::unordered_map<std::string, EmbeddedContent> embedded = { %s }; } // namespace const EmbeddedContent* findEmbeddedContent(const std::string& name) { ...
{ "content_hash": "8072a8428338c1ff0852fc7314fa1006", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 130, "avg_line_length": 27.098765432098766, "alnum_prop": 0.5995444191343964, "repo_name": "mattgodbolt/seasocks", "id": "7bdd21ba8b92f2336dc051d463aacef99adc1810", "size":...
"""C++ compiler code generator.""" import os import generators.cpp_templates import scope import spgen_parser class Properties: OUTPUT_CPP_HEADER = 'outputCppHeader' OUTPUT_CPP_SOURCE = 'outputCppSource' OUTPUT_CPP_NAMESPACE = 'outputCppNamespace' OUTPUT_DIRECTORY = 'outputDirectory' DEFAULT_MODULE_NAME = 'defau...
{ "content_hash": "3f01e9f82cf41e4a92fd61f2bb9126bc", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 121, "avg_line_length": 32.58108108108108, "alnum_prop": 0.7561177934467026, "repo_name": "lrgar/spgen", "id": "f01b817c953a0d26353934c9b79e11b838b25090", "size": "2552", ...
""" @author: Deniz Altinbuken, Emin Gun Sirer @note: Example membership object @copyright: See LICENSE """ class Membership(): def __init__(self): self.members = set() def add(self, member): if member not in self.members: self.members.add(member) def remove(self, member): ...
{ "content_hash": "1f57d0cf4ac2c2934226ca0b27d8344b", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 55, "avg_line_length": 24.714285714285715, "alnum_prop": 0.5895953757225434, "repo_name": "milannic/expCPython", "id": "d66c3d5041c32b003f7f19add59e5e9bd6f09a33", "size": "...
"""Factories to help in tests.""" from factory import PostGenerationMethodCall, Sequence from factory.alchemy import SQLAlchemyModelFactory from personal_website.database import db from personal_website.user.models import User class BaseFactory(SQLAlchemyModelFactory): """Base factory.""" class Meta: ...
{ "content_hash": "f3229f65a08fd6166cf50e1b7ef049c9", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 66, "avg_line_length": 25.166666666666668, "alnum_prop": 0.6887417218543046, "repo_name": "arewellborn/Personal-Website", "id": "f3fb97cbef997cea3248ed9a6e897a0f6b9c87c0", ...
import re def Parser(text, sub_linefeed): text = text.decode('utf-8') messages = {} # title title_pattern = re.compile(u"题目[::.](.*?)\n") messages['title'] = re.findall(title_pattern, text) if len(messages['title']) == 1: messages['title'] = messages['title'][0].strip() else: messages['title'] = '' # ti...
{ "content_hash": "2bccba69cc17770b283e2951f46598ac", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 73, "avg_line_length": 30.295081967213115, "alnum_prop": 0.6352813852813853, "repo_name": "HeadCow/ARPS", "id": "927f58bdf321fef183accdc8b02b7008ba22b51e", "size": "1952", ...
import schoolopy import yaml with open('example_config.yml', 'r') as f: cfg = yaml.load(f) sc = schoolopy.Schoology(schoolopy.Auth(cfg['key'], cfg['secret'])) sc.limit = 10 # Only retrieve 10 objects max print('Your name is %s' % sc.get_me().name_display) for update in sc.get_feed(): user = sc.get_user(upda...
{ "content_hash": "9ccc7562f7bb2745bf4ad5dd2c177c9f", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 75, "avg_line_length": 32.06666666666667, "alnum_prop": 0.6257796257796258, "repo_name": "ErikBoesen/schoolopy", "id": "305cd661ff4abaff9862903351ed405a7903c025", "size": "...
""" This part of code is the Deep Q Network (DQN) brain. view the tensorboard picture about this DQN structure on: https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/4-3-DQN3/#modification View more on my tutorial page: https://morvanzhou.github.io/tutorials/ Using: Tensorflow: r1.2 """ ...
{ "content_hash": "695cee3327295bc402f2a626b57bd288", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 159, "avg_line_length": 41.80232558139535, "alnum_prop": 0.5826147426981919, "repo_name": "ZhiangChen/soft_arm", "id": "263d7489c219445273b88a73b1513e592aa3a0e4", "size": ...
import tkinter as tk from PIL import Image, ImageTk import play import functools from video import Video def display_list(db, cfg): foo = VideoDisplay(db, cfg) foo.run() return foo.getConfig() class VideoDisplay: SERIES_ID='seriesID' def __init__(self, db, cfg): self.cfg = cfg series = {} for a in db: i...
{ "content_hash": "07d42e8fc4971c956162a54271373c95", "timestamp": "", "source": "github", "line_count": 394, "max_line_length": 99, "avg_line_length": 26.883248730964468, "alnum_prop": 0.6675793051359517, "repo_name": "Ben0mega/VideoViewer", "id": "ed4cfe578d34e6573db48f2499d895b5388b0842", "size":...
"""Test the kernels service API.""" import json import sys import time from requests import HTTPError from traitlets.config import Config from tornado.httpclient import HTTPRequest from tornado.ioloop import IOLoop from tornado.websocket import websocket_connect from unittest import SkipTest from jupyter_client.ker...
{ "content_hash": "f0d62c3194cd966cf9cbc5d2f3ab9fcd", "timestamp": "", "source": "github", "line_count": 283, "max_line_length": 107, "avg_line_length": 34.62190812720848, "alnum_prop": 0.5916513574198816, "repo_name": "sserrot/champion_relationships", "id": "36c441c2c7dc42f8faae6ac614ddd59b9030ec69",...
""" --- geometry parameters for Howorka --- """ nm = 1e-9 # @TODO maybe include tolc in parent file tolc = 1e-14*nm # tolerance for coordinate comparisons dim = 2 # DNA radius rDNA = 1.1*nm # molecule radius rMolecule = 0.5*nm # effective pore radius r0 = 1*nm # barrel outer radius r1 = 2.5*nm # pore length l0 = 1...
{ "content_hash": "8157167e1530792b94cfefbae2e64a7f", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 69, "avg_line_length": 17.975609756097562, "alnum_prop": 0.7014925373134329, "repo_name": "mitschabaude/nanopores", "id": "d33d109f8bd2469dda5bb7bb85e3ca4c38773705", "size"...
from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views.generic import View class LoginRequired(View): @method_decorator(login_required) def dispatch(self, *args, **kwargs): return super(LoginRequired, self).dispatch(*args, **kwa...
{ "content_hash": "6f53d23b4f0b6250799501cab3e3d011", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 94, "avg_line_length": 34.642857142857146, "alnum_prop": 0.7608247422680412, "repo_name": "andresriancho/django-plans", "id": "68caa88dddc5752f925aaf8578ba4a4fa46036b6", "s...
"""Helpers for logging allowing more advanced logging styles to be used.""" import inspect import logging # mypy: allow-untyped-defs, no-check-untyped-defs class KeywordMessage: """ Represents a logging message with keyword arguments. Adapted from: https://stackoverflow.com/a/24683360/2267718 """ ...
{ "content_hash": "1117dcb57455feaf7b47f97284575a7f", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 77, "avg_line_length": 32.18867924528302, "alnum_prop": 0.5908558030480656, "repo_name": "fbradyirl/home-assistant", "id": "e69564453fada02ac2d126471be54db327781b9b", "size...
from zope.interface import implements from twisted.names import dns, common from twisted.python import failure, log from twisted.internet import interfaces, defer class CacheResolver(common.ResolverBase): """ A resolver that serves records from a local, memory cache. @ivar _reactor: A provider of L{int...
{ "content_hash": "1b59c3011746a6490b160be06317b0d1", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 79, "avg_line_length": 30.716666666666665, "alnum_prop": 0.5371676614215952, "repo_name": "denny820909/builder", "id": "854050b3f64375a2ae128baffd6a638ffd077448", "size": ...
from __future__ import absolute_import, unicode_literals, division from armet import http from .base import BaseResourceTest class TestResourceDelete(BaseResourceTest): def test_delete_existing(self, connectors): response, content = self.client.delete( path='/api/poll/1/', headers...
{ "content_hash": "0be37f6e3e7c577b76fcf23672007df5", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 66, "avg_line_length": 32.07692307692308, "alnum_prop": 0.697841726618705, "repo_name": "armet/python-armet", "id": "037f2e841fa4ab57dbf4d57ee0ddf23b37d1baa8", "size": "441...
''' Created on 2012-11-10 @author: vincent ''' from trac.env import open_environment import aopMiscUtils TRACADMIN = "trac-admin" class Trac: def __init__(self, envpath): self.envPath = envpath env = open_environment(envpath) self.db = env.get_db_cnx() def getValidTicket(self, ticket)...
{ "content_hash": "4a06781d1e865e0be0c23583384b3d84", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 74, "avg_line_length": 30.96, "alnum_prop": 0.6111111111111112, "repo_name": "fleeto/svn2trac", "id": "2dd36155c1148aa7ebe06a96b3bbc2231017c485", "size": "797", "binary":...
import json import os import subprocess import sys SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) RUNWAY_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "..")) BIN_DIR = os.path.abspath(os.path.join(RUNWAY_DIR, "bin")) VALID_FORMATS = {None, "json", "csv"} def clean_output(output): lines = output.split("...
{ "content_hash": "a0f57bc35e91e275c0037dd051c0cb66", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 87, "avg_line_length": 27.76829268292683, "alnum_prop": 0.6126482213438735, "repo_name": "swiftstack/runway", "id": "a0290392e39719a615a494ed501cb94a9e5843d1", "size": "238...
import os import sys import pymongo import json from parsing import parse_db_address def cleanup(path): if not os.path.isdir(path): raise Exception("%s is not a valid directory" % path) with open(os.path.join(path, 'config.json'), 'r') as f: cfg = json.load(f) db_address = parse_db_addr...
{ "content_hash": "7b0ced52868fb5f9604e3922f4d5e067", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 94, "avg_line_length": 24.73076923076923, "alnum_prop": 0.6438569206842923, "repo_name": "fmaguire/BayeHem", "id": "71660c388865babfd52482ab3bd264549a1f9b9d", "size": "1027...
import webob from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute from nova import exception from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('compute', 'consoles') class ConsolesControll...
{ "content_hash": "c056bec69bcf58e8f649103cced9e22e", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 79, "avg_line_length": 37.01724137931034, "alnum_prop": 0.6208663251047974, "repo_name": "paulmathews/nova", "id": "7750a767785b30ee17b8f6cbe7d5436aea13e177", "size": "2798...
from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from django.views.generic import ListView from djangoautoconf.ajax_select_utils.channel_creator_for_model import create_channels_for_related_fields_in_model # from towel.modelview import ModelView from djangoa...
{ "content_hash": "3ebdac238fb242bec8d1599eb691927d", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 120, "avg_line_length": 58.146067415730336, "alnum_prop": 0.5418357487922705, "repo_name": "weijia/obj_sys", "id": "acb5473f183932d6c983c3a6aa84fb58eb7e041f", "size": "5175...
"""empty message Revision ID: e86a4e731a84 Revises: 9a85e02050e0 Create Date: 2017-12-19 12:25:41.564000 """ # revision identifiers, used by Alembic. revision = 'e86a4e731a84' down_revision = '9a85e02050e0' from alembic import op import sqlalchemy as sa import sqlalchemy_utils def upgrade(): # ### commands au...
{ "content_hash": "a1abcc1437d0bf2145f9d4571f64529c", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 86, "avg_line_length": 24.25925925925926, "alnum_prop": 0.6885496183206107, "repo_name": "codesmart-co/bit", "id": "a674970b4b1447a9b52895bb3ba57303bc01be8a", "size": "655"...
def test_assert_false(testdir): """Test pytest does not display captured stderr on test failure.""" # create a temporary pytest test module testdir.makepyfile( """ import pytest import sys import datetime import logging import logging.handlers log_fo...
{ "content_hash": "c5818a34ad15505ceb6d7bd64e391fa3", "timestamp": "", "source": "github", "line_count": 672, "max_line_length": 104, "avg_line_length": 34.098214285714285, "alnum_prop": 0.6179191760495767, "repo_name": "hamzasheikh/pytest-hidecaptured", "id": "3499e6d7e8762436096be6febbe978dee753e996...
""" Keras LSTM Sequence to Sequence Model for Translation ================================= **Author**: `Siju Samuel <https://siju-samuel.github.io/>`_ This script demonstrates how to implement a basic character-level sequence-to-sequence model. We apply it to translating short English sentences into short French sent...
{ "content_hash": "66e05b887938bb39ce096d26d39d7988", "timestamp": "", "source": "github", "line_count": 238, "max_line_length": 96, "avg_line_length": 38.285714285714285, "alnum_prop": 0.6658252853380158, "repo_name": "Huyuwei/tvm", "id": "16c737418c6f8e80f66535ed6f0aaca5f3242c86", "size": "9897", ...
''' Module for handling openstack glance calls. :optdepends: - glanceclient Python adapter :configuration: This module is not usable until the following are specified either in a pillar or in the minion's config file:: keystone.user: admin keystone.password: verybadpass keystone.tenant:...
{ "content_hash": "2607170ccb55ebe062e6a2703a4191d7", "timestamp": "", "source": "github", "line_count": 232, "max_line_length": 108, "avg_line_length": 28.879310344827587, "alnum_prop": 0.585820895522388, "repo_name": "victorywang80/Maintenance", "id": "b4c6f48b8e100c3c3727daa5b4cfa53f7e735418", "s...
""" Bitmap is a basic wrapper for image pixels. It includes some basic processing tools: crop, find bounding box of a color and compute histogram of color values. """ import array import base64 import cStringIO import collections import os import struct import subprocess def HistogramDistance(hist1, hist2): """Ear...
{ "content_hash": "1ad0bbb0e33fed83ba4ffc72af41255d", "timestamp": "", "source": "github", "line_count": 321, "max_line_length": 80, "avg_line_length": 33.70716510903427, "alnum_prop": 0.6324399260628466, "repo_name": "google/AppSpeedIndex", "id": "9e7b796d9220b7d2227d0920573fbb38c60fb151", "size": ...
import uuid from django.core.urlresolvers import reverse from django import http from django.utils.datastructures import SortedDict from mox import IsA from openstack_dashboard import api from openstack_dashboard.test import helpers as test class InstanceViewTest(test.BaseAdminViewTests): @test.create_stubs({a...
{ "content_hash": "5613ce3d285f58ad2f39eccc3f76a420", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 79, "avg_line_length": 46.80681818181818, "alnum_prop": 0.5793882010196649, "repo_name": "fajoy/horizon-example", "id": "8e379ef601abdc9f3e7e7db35465244e007bb09a", "size":...
import time import re import logging from ggputils.utils import * from ggputils.utils import _fmt from cgi import escape from gevent.lock import * from gevent.queue import * from gevent.event import * g_logger = logging.getLogger(__name__) #------------------------------------------------------------------------- # H...
{ "content_hash": "ae657698ae3891bf678a8da9725e4888", "timestamp": "", "source": "github", "line_count": 628, "max_line_length": 98, "avg_line_length": 45.22770700636943, "alnum_prop": 0.5314579445833186, "repo_name": "daveraja/pyggputils", "id": "0e14dd7a160c25ebf3678227d60efbd381b7a524", "size": "...
from __future__ import absolute_import from __future__ import print_function import theano.tensor as T from collections import OrderedDict from theano import scan from keras.layers.core import Layer, Merge from keras.utils.theano_utils import ndim_tensor, alloc_zeros_matrix from ..utils import apply_layer class Rec...
{ "content_hash": "22f5cfd2f0c7a5147a1371e1e076fc5c", "timestamp": "", "source": "github", "line_count": 290, "max_line_length": 107, "avg_line_length": 38.65172413793103, "alnum_prop": 0.5299313052011776, "repo_name": "berleon/seya", "id": "54957d056f06891fd31c0fc2ed72024f5ea0bc62", "size": "11209"...
import os import sys from django.conf import settings import django # 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.ins...
{ "content_hash": "6b46beb64d2bad799eea2751c54d49ff", "timestamp": "", "source": "github", "line_count": 363, "max_line_length": 80, "avg_line_length": 31.65564738292011, "alnum_prop": 0.6988947872247846, "repo_name": "mobb-io/django-erp", "id": "000f9422af595dd6cb6e737c4ba918185e944ea8", "size": "1...
from slisonner import decoder, encoder from tests import mocker from tempfile import mkdtemp from shutil import rmtree def test_full_encode_decode_cycle(): temp_out_dir = mkdtemp() slice_id = '2015-01-02 00:00:00' x_size, y_size = 10, 16 temp_slice_path = mocker.generate_slice(x_size, y_size, 'float3...
{ "content_hash": "ec9291920cc3c61074e0dee2eb4f03e0", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 75, "avg_line_length": 30.85185185185185, "alnum_prop": 0.6626650660264105, "repo_name": "Habidatum/slisonner", "id": "ab5be15bbc59ecc18cf93a6170b0dd272f33cfd6", "size": "8...
import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "homeworkpal_project.settings.local") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
{ "content_hash": "6cbb2041a5dd9e5a48f3414728903636", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 89, "avg_line_length": 27.333333333333332, "alnum_prop": 0.7235772357723578, "repo_name": "luiscberrocal/homeworkpal", "id": "93d935246fcd1879760b2ce8b4e2fbb785511f02", "siz...
import sys sys.path.append('.') import saltlint errors = saltlint.run('tests/states/dataset.sls') def test_indent(): assert len(errors) == 0
{ "content_hash": "1681bcc7a2bd71a920320c4c4120005a", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 49, "avg_line_length": 18.125, "alnum_prop": 0.7103448275862069, "repo_name": "dragon788/salt-lint", "id": "26dd273074f778bbcc26664b9fe0964608c76bea", "size": "168", "bina...
import unittest import thread_cert import mle LEADER_1_2 = 1 ROUTER_1_1 = 2 REED_1_2 = 3 ROUTER_1_2 = 4 REED_1_1 = 5 MED_1_1 = 6 MED_1_2 = 7 # Topology # (lq:2) (pp:1) # REED_1_2 ----- ROUTER_1_2 # | \ / | \ # | \/ REED_1_1 \ # (lq:2) | / \ / `rou...
{ "content_hash": "83f93bfde55cfb588d0032c6fddab065", "timestamp": "", "source": "github", "line_count": 261, "max_line_length": 117, "avg_line_length": 42.43295019157088, "alnum_prop": 0.6235665914221219, "repo_name": "bukepo/openthread", "id": "154d400fb3d0d899fc9b1f44d0e30f7f1496e1ef", "size": "1...
from django.apps import AppConfig from ievv_opensource.ievv_model_mommy_extras import postgres_field_generators class ModelMommyExtrasAppConfig(AppConfig): name = 'ievv_opensource.ievv_model_mommy_extras' verbose_name = "IEVV model mommy extras" def ready(self): postgres_field_generators.add_to_m...
{ "content_hash": "7da1b5cd0926feab04cf9524806bdd5e", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 77, "avg_line_length": 33.4, "alnum_prop": 0.7634730538922155, "repo_name": "appressoas/ievv_opensource", "id": "c7f49326bbebbaa36c2928d185caff5eba6d534a", "size": "334", ...
from distutils.core import setup setup( name='provisor', version='0.2', packages=['provisor'], author='Hashbang Team', author_email='team@hashbang.sh', license='GPL 3.0', description='Server that provisions new users on a Linux system', long_description=open('README.md').read(), ins...
{ "content_hash": "47c3f6c60759bd8c8f8fe9428aa50bf8", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 69, "avg_line_length": 23.9375, "alnum_prop": 0.6240208877284595, "repo_name": "hashbang/provisor", "id": "ea12767b2955f612236f0c1019fd7d64123d2d58", "size": "405", "bina...
""" Cryptographic capabilities for TLS. """
{ "content_hash": "1067592660400204e7489d23514da6fa", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 35, "avg_line_length": 14.666666666666666, "alnum_prop": 0.7045454545454546, "repo_name": "4shadoww/hakkuframework", "id": "063697b25dddfbfd414de40e586faca70443508e", "size"...
from __future__ import print_function, division import sys, os sys.path.append(os.path.abspath(".")) from problems.problem import * from helper.pom3 import pom3 __author__ = 'panzer' class POM3B(Problem): """ POM 3B """ def __init__(self): Problem.__init__(self) self.name = POM3B.__name__ names = ...
{ "content_hash": "95c0b5ceab626a8a12243871aac99f85", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 111, "avg_line_length": 33.74074074074074, "alnum_prop": 0.5949506037321625, "repo_name": "rahlk/Experimental-Algorithms", "id": "d54f23379b0eb5c0c135106ae27c9f04f9276c67", ...
from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import tabs from openstack_dashboard import api from openstack_dashboard.dashboards.nikolaboard.catalogpanel import tables class CatalogTab(tabs.Tab): name = _("Overview") slug = "service_catalog_tab" tem...
{ "content_hash": "512b0fa74be40a27992cfcbd2fc19364", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 78, "avg_line_length": 26.92105263157895, "alnum_prop": 0.7096774193548387, "repo_name": "AlexOugh/horizon", "id": "9b2cdc423ba55de475467a71f7f068b4e2281a6d", "size": "1023...
""" Exception classes for OpenMDAO. """ from StringIO import StringIO from traceback import print_exception class ConstraintError(ValueError): """Raised when a constraint is violated.""" pass class CircularDependencyError(RuntimeError): """Raised when a circular dependency occurs.""" pass class Ru...
{ "content_hash": "5d279229b695ef582cae1062be2a9959", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 80, "avg_line_length": 25.942307692307693, "alnum_prop": 0.6782802075611564, "repo_name": "DailyActie/Surrogate-Model", "id": "b99cb4baa982ea0fad9ad99416b069a5691accae", "s...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import re from pants.util.strutil import camelcase DEFAULT_PACKAGE_PARSER = re.compile(r'^\s*package\s+([^;]+)\s*;\s*$') OPTION_PARSER = re.compile(r'^\s*...
{ "content_hash": "27a3e0edd66e242af4d2e957337fbc2a", "timestamp": "", "source": "github", "line_count": 110, "max_line_length": 93, "avg_line_length": 32.08181818181818, "alnum_prop": 0.5996032870501559, "repo_name": "megaserg/pants", "id": "dc19e0c8f01e529712caccfe459f6f23fdb3a072", "size": "3676"...
"""Functional tests using WebTest. See: http://webtest.readthedocs.org/ """ from flask import url_for class TestLoggingIn: """Login.""" def test_can_log_in_returns_200(self, user, testapp): """Login successful.""" # Goes to homepage res = testapp.get('/login') # Fills out log...
{ "content_hash": "3548482a7bf34b28f7c1efa877d916fe", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 78, "avg_line_length": 32.983333333333334, "alnum_prop": 0.5816068721576554, "repo_name": "makerhanoi/tagio", "id": "7c5293b1bd68fad8577409ccdc605442a4eb44f3", "size": "200...
import subprocess import logging from . import common LOG = logging.getLogger(__name__) def process_mp3(input_path, output_path): try: duration = common.get_media_duration(input_path) if duration > 20: start_time = duration / 2 else: start_time = 0 command =...
{ "content_hash": "d070a1c3d600382a386195ca876da585", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 71, "avg_line_length": 34.03333333333333, "alnum_prop": 0.4671890303623898, "repo_name": "vladimiroff/humble-media", "id": "e7f7a1c68f448866d420203064b470cfac82dc08", "size...
from netmiko import ConnectHandler from getpass import getpass password = getpass() secret = getpass("Enter secret: ") cisco1 = { "device_type": "cisco_ios", "host": "cisco1.lasthop.io", "username": "pyclass", "password": password, "secret": secret, } net_connect = ConnectHandler(**cisco1) # Call...
{ "content_hash": "c857961cd878ca02f9803c1d7a434edc", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 46, "avg_line_length": 23.055555555555557, "alnum_prop": 0.689156626506024, "repo_name": "ktbyers/netmiko", "id": "a8ec0c09e0dc9fceeaed4d6dfb60b1da50adabd9", "size": "437",...
import os from topaz.module import ClassDef from topaz.objects.objectobject import W_Object class W_EnvObject(W_Object): classdef = ClassDef("EnviromentVariables", W_Object.classdef) @classdef.setup_class def setup_class(cls, space, w_cls): space.set_const(space.w_object, "ENV", cls(space)) ...
{ "content_hash": "b2cf1947d60bb7ca2161107a1a2f21fb", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 86, "avg_line_length": 34.1875, "alnum_prop": 0.6166971358927483, "repo_name": "kachick/topaz", "id": "bcb62104da3b525aa42c923e7bf55e379372bcaf", "size": "1641", "binary"...
"""Support for LIFX lights.""" import asyncio from datetime import timedelta from functools import partial import logging import math import aiolifx as aiolifx_module import aiolifx_effects as aiolifx_effects_module from awesomeversion import AwesomeVersion import voluptuous as vol from homeassistant import util from...
{ "content_hash": "20a30cb2378c20c57002cd090ed6162a", "timestamp": "", "source": "github", "line_count": 764, "max_line_length": 86, "avg_line_length": 32.6413612565445, "alnum_prop": 0.5968802630523699, "repo_name": "home-assistant/home-assistant", "id": "998b99ef88f78f2526fa27c1e6c35aae0c30745d", ...
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def lowestCommonAncestor(self, root, p, q): """ :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode ...
{ "content_hash": "d168c609466a322cc2f48908a6925279", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 47, "avg_line_length": 21.52173913043478, "alnum_prop": 0.41818181818181815, "repo_name": "daicang/Leetcode-solutions", "id": "240e99ab2bd16cd7718518c0952d110c0942d8a8", "s...
from django.views.decorators.http import require_GET from app.constants.index import INDEX_DIR, ALL_TYPES from app.errors import PersOARequiredFieldError, PersOANotFound, PersOALeftoverField from app.models.choice import BasicChoice, LinearChoice, SubChoice from app.models.group import TraitGroup from app.models.trait...
{ "content_hash": "eab4ca020e7f44268cfcbbd3a2b8d1df", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 85, "avg_line_length": 32.60176991150443, "alnum_prop": 0.5863192182410424, "repo_name": "Saevon/PersOA", "id": "fb68ee9e676b31d5e8e7d7a2cd597a83bffd5184", "size": "3684",...
from flask import Flask, request from flask import render_template from jinja2 import Markup from brain import Brain import note import re import jangopath Make_Notes = 0 Internet_Check = 0 def strip_non_ascii(string): stripped = (c for c in string if 0 < ord(c) < 127) return ''.join(stripped) app = Flask(__...
{ "content_hash": "fa9c2a79387cc7d4ea6084d014181445", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 117, "avg_line_length": 26.551724137931036, "alnum_prop": 0.5857142857142857, "repo_name": "rahulxxarora/Jango", "id": "f28898591961cc0d33c8a84e9916d274587e9317", "size": "...
from django.contrib import admin from .models import Member, ResearchGroup, Division class ImmutableModelMixin(object): """A mixin class for a ModelAdmin which should never allow adding or deleting objects. Use this for models which are immutable and managed entirely by migrations. """ def has_ad...
{ "content_hash": "a0ff0d038bb793dbb51320bcc96f6e87", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 73, "avg_line_length": 30.62295081967213, "alnum_prop": 0.6873661670235546, "repo_name": "rjw57/edpcmentoring", "id": "20763111386abb758498358fddf855128773a74b", "size": "1...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import copy from collections import deque from pants.backend.core.tasks.console_task import ConsoleTask from pants.base.exceptions import TaskError from pants.util.st...
{ "content_hash": "a5c51ed4be006c71539e7131cd9107fc", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 93, "avg_line_length": 32.08791208791209, "alnum_prop": 0.6462328767123288, "repo_name": "slyphon/pants", "id": "676a9c4ca251641b42c38c3d8c222d050d366b29", "size": "3067", ...
""" Driver base-classes: (Beginning of) the contract that compute drivers must follow, and shared types that support that contract """ import sys from oslo.config import cfg from nova.i18n import _ from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova impor...
{ "content_hash": "808c82f56ee5bd6d8200f84f9d4521aa", "timestamp": "", "source": "github", "line_count": 1379, "max_line_length": 79, "avg_line_length": 40.53009427121102, "alnum_prop": 0.6355763897586374, "repo_name": "virtualopensystems/nova", "id": "f12757ad6ac98bf9ccb669e901ba80eaf91119b6", "siz...
import sh from os.path import join from kivy_ios.toolchain import CythonRecipe, shprint from kivy_ios.context_managers import cd class NetifacesRecipe(CythonRecipe): version = "0.10.9" url = "https://pypi.io/packages/source/n/netifaces/netifaces-{version}.tar.gz" depends = ["python3", "host_setuptools3"...
{ "content_hash": "2795a1d118dbede5a5542c4b087187fe", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 82, "avg_line_length": 27.878048780487806, "alnum_prop": 0.5896762904636921, "repo_name": "kivy/kivy-ios", "id": "02efcac414763382850bb83a9c1f9b2b02d6c220", "size": "1143",...
from ingenico.connect.sdk.param_request import ParamRequest from ingenico.connect.sdk.request_param import RequestParam class ConvertAmountParams(ParamRequest): """ Query parameters for Convert amount See also https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/python/services/convertAmount....
{ "content_hash": "2602ea3ccc7e35da643a59a5b14d85ca", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 108, "avg_line_length": 24.90909090909091, "alnum_prop": 0.5888077858880778, "repo_name": "Ingenico-ePayments/connect-sdk-python2", "id": "6e57befe2c1a1fd1eae946fae936e4f6a9a...
from django.shortcuts import render,get_object_or_404 from django.http import HttpResponse,Http404,HttpResponseRedirect from django.core.urlresolvers import reverse from polls.models import Poll from django.template import RequestContext,loader from django.views import generic from django.utils import timezone # Crea...
{ "content_hash": "eab186ea92412426ed0fc4ffeb34285e", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 199, "avg_line_length": 33.84705882352941, "alnum_prop": 0.7337504344803615, "repo_name": "lugubru/kinetic", "id": "e17863196e77de0126d2f4b9aba6ab2dbbad6d4f", "size": "2877...
import logging.config import PythonCRUD.crud.deleterecords import PythonCRUD.crud.utils.databaseutils import PythonCRUD.crud.utils.query class DeleteRecordsImpl(PythonCRUD.crud.deleterecords.DeleteRecords): """ This class implements the two interfaces Scope of this class is delete the records in to datab...
{ "content_hash": "fd1937d10a3837ba1ef394cb3a1a74a2", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 97, "avg_line_length": 32.5, "alnum_prop": 0.638095238095238, "repo_name": "sundarcse1216/python-crud", "id": "7740f11f8ac7884aab881bd73f6c074d5ca9c49d", "size": "1365", ...
import hatServer.sortingHat.sortingHat import hatServer.sortingHat.variables import hatServer.sortingHat.buildDB
{ "content_hash": "2e6c7ef13cdcf986f16799d4caa4a510", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 38, "avg_line_length": 28.5, "alnum_prop": 0.8859649122807017, "repo_name": "jeor0980/TeamChampion", "id": "431143f1521bbf92e4e781fbb6f65de0c3eee842", "size": "114", "bina...
import random import numpy as np from helpers import compute_volume import pygmsh def test(): with pygmsh.geo.Geometry() as geom: # Generate an approximation of a circle t = np.arange(0, 2.0 * np.pi, 0.05) x = np.column_stack([np.cos(t), np.sin(t), np.zeros_like(t)]) points = [ge...
{ "content_hash": "bf1f85c568d640b8e4bc355947d80366", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 71, "avg_line_length": 26.682926829268293, "alnum_prop": 0.5703839122486288, "repo_name": "nschloe/python4gmsh", "id": "735ac56fdeabd721e689ec46f9f6792e4f26c87d", "size": "...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('teslarent', '0001_initial'), ] operations = [ migrations.AlterField( model_name='credentials', name='refresh_token', field=models.CharField(max_length=20...
{ "content_hash": "0b6c8470d981c201c31fa87aa6a9125e", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 52, "avg_line_length": 21.375, "alnum_prop": 0.5789473684210527, "repo_name": "flarno11/teslarent", "id": "43fbba1888e149eb6f9d7c3647e6ab068c341aeb", "size": "391", "bina...
from __future__ import print_function import pygion from pygion import task, RW import numpy @task(privileges=[RW]) def hello(R): print(R.x) # Define the main task. This task is called first. @task def main(): R = pygion.Region([0, 0], {'x': pygion.float64}) pygion.fill(R, 'x', 3.14) hello(R) if __...
{ "content_hash": "aa2ef7d2bde7c5d6dfb37478f217ec50", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 52, "avg_line_length": 17.65, "alnum_prop": 0.6203966005665722, "repo_name": "StanfordLegion/legion", "id": "46204d43f4248b8f8dbd0ae39e926f88b12abfb7", "size": "963", "bi...
"""Tests for perfkitbenchmarker.packages.blazemark.""" import os import unittest from perfkitbenchmarker import test_util from perfkitbenchmarker.linux_packages import blazemark class BlazemarkTestCase(unittest.TestCase, test_util.SamplesTestMixin): maxDiff = None def setUp(self): self.data_dir = os.path....
{ "content_hash": "e4e75c3f2fe8c5806b9a4dabda483a5d", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 73, "avg_line_length": 38.795918367346935, "alnum_prop": 0.6806943713834824, "repo_name": "GoogleCloudPlatform/PerfKitBenchmarker", "id": "133af785be77885368e42d77ce9e272134a...
import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('ext')) # -- General configura...
{ "content_hash": "89d9a8c7a4cd3b2e6510e76922f522a4", "timestamp": "", "source": "github", "line_count": 204, "max_line_length": 80, "avg_line_length": 32.3921568627451, "alnum_prop": 0.7062651331719129, "repo_name": "ipdcode/containerdns", "id": "ded8eadaf7a22ec94b356cfe5158518bf734b07d", "size": "...
import datetime import os.path from scrapy import log from scrapy.exceptions import CloseSpider from scraper.models import Event from scraper.scraper_test import EventSpider, ScraperTest from dynamic_scraper.models import SchedulerRuntime, Log class ScraperRunTest(ScraperTest): def test_missing_base_...
{ "content_hash": "ad49c0d72356d6721e9bd55f21b512d1", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 120, "avg_line_length": 33.073469387755104, "alnum_prop": 0.5965691719116377, "repo_name": "developerworks/django-dynamic-scraper", "id": "06ec07319448e7362f79f3adec98abf0af...
from enum import Enum class CriteriaTarget(Enum): ROW = 1
{ "content_hash": "a23b28275e8e07f6783183a0a3bfdf5b", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 27, "avg_line_length": 12.6, "alnum_prop": 0.7142857142857143, "repo_name": "smartsheet-platform/smartsheet-python-sdk", "id": "53a2830a0a4a8db0e6a4674b91dc291569e0c1ed", "s...
"""Classes to encapsulate the idea of a dataset in machine learning, including file access. This file contains the ARFF class for people who have arff installed. """ # This software is distributed under BSD 3-clause license (see LICENSE file). # # Authors: Soeren Sonnenburg try: import arff have_arff =...
{ "content_hash": "48fe196305dceb49e35e7aa945ba7d10", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 88, "avg_line_length": 33.670103092783506, "alnum_prop": 0.5808328230251072, "repo_name": "sorig/shogun", "id": "69481f5aa6c51e4bb3be22cc0afe04f27cb0cd1d", "size": "3289", ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2016 - Frank Lin from java_variable import VarType from skrutil.string_utils import indent _JAVA_BR = '\n\n' _JAVA_SPACE = ' ' class JavaClass: """Java file generator, including package, class, fields, enums and manager. """ def __init_...
{ "content_hash": "b91ed3edaf37bd33b0e7889a0a2b1a9d", "timestamp": "", "source": "github", "line_count": 357, "max_line_length": 142, "avg_line_length": 47.15126050420168, "alnum_prop": 0.5843284025426246, "repo_name": "DaYeSquad/worktilerwdemo", "id": "fde3634b7237d4c28d9d4d40017d0f5b8e299c45", "si...
import random from .base import MessageHandler class EightBallHandler(MessageHandler): TRIGGERS = ['8ball', 'eight_ball'] HELP = 'random fortune' def handle_message(self, event, triggers, query): return random.choice(( 'It is certain', 'It is decidedly so', 'Without a doubt', ...
{ "content_hash": "01a43703744063f28d0f7f729ae3cd1f", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 51, "avg_line_length": 25.0625, "alnum_prop": 0.5473815461346634, "repo_name": "nkouevda/slack-rtm-bot", "id": "2ed289934ff13620a7d648548f3feffb9c2879f1", "size": "802", ...
import os, sys, re, math from db import SQLite3 def get_words(document): splitter = re.compile(r'\W*') words = [s.lower() for s in splitter.split(document)\ if len(s) > 2 and len(s) < 20] return dict([w, 1] for w in words) class Classifier(object): def __init__(self, get_features, filenam...
{ "content_hash": "9c9992493e44aeaba8885782ddfbb987", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 118, "avg_line_length": 34.254658385093165, "alnum_prop": 0.5347234814143246, "repo_name": "after12am/expecto", "id": "adddfcd93ea6545ac02a1a97d5fedf0059749a48", "size": "...
from msrest.serialization import Model class StorageAccountCheckNameAvailabilityParameters(Model): """The parameters used to check the availabity of the storage account name. :param name: :type name: str :param type: Default value: "Microsoft.Storage/storageAccounts" . :type type: str """ ...
{ "content_hash": "afb5d645374714a971e51a72e4eaa38d", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 79, "avg_line_length": 26.25, "alnum_prop": 0.6031746031746031, "repo_name": "v-iam/azure-sdk-for-python", "id": "af3628ff05c8226815f5eef712f398251323b2e7", "size": "1104",...
import _plotly_utils.basevalidators class ValueValidator(_plotly_utils.basevalidators.NumberValidator): def __init__(self, plotly_name="value", parent_name="scatter.error_x", **kwargs): super(ValueValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
{ "content_hash": "0735582b2ebb2df3866ca1e0a6f8aeb5", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 85, "avg_line_length": 37, "alnum_prop": 0.5904365904365905, "repo_name": "plotly/python-api", "id": "0817ab7f17f43fa9cfe54617cce880e207b671f4", "size": "481", "binary": ...
from __future__ import print_function import unittest import cPickle import os import numpy as np from sifra.sysresponse import calc_loss_arrays from sifra.sifraclasses import _ScenarioDataGetter, FacilitySystem, Scenario from sifra.sysresponse import calc_sys_output __author__ = 'sudipta' class TestSifra(unittest....
{ "content_hash": "e03f2ad1920ed127e22065535ab3634d", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 120, "avg_line_length": 51.81720430107527, "alnum_prop": 0.6152728781904959, "repo_name": "gasuperdev/sifra", "id": "7fe41bd2c2f946871af5866b4347b9d34f6900e0", "size": "481...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest import hypothesis.strategies as st from hypothesis import given, settings import numpy as np from caffe2.python import core, workspace import caffe2.pytho...
{ "content_hash": "1aad536758590bf316512b4279a0c1c4", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 70, "avg_line_length": 31.456521739130434, "alnum_prop": 0.5908776779543884, "repo_name": "bwasti/caffe2", "id": "fa9301c2c9ebe0019fdcab2d18693bb157cf0cf4", "size": "1447",...
"""Fingerprinting code for the Java runtime.""" import os import textwrap from gae_ext_runtime import ext_runtime from googlecloudsdk.api_lib.app import util from googlecloudsdk.api_lib.app.images import config from googlecloudsdk.core import exceptions from googlecloudsdk.core import log NAME ='java' ALLOWED_RUNTI...
{ "content_hash": "64d38d599862dc3599bb0194602fa37b", "timestamp": "", "source": "github", "line_count": 239, "max_line_length": 80, "avg_line_length": 34.9163179916318, "alnum_prop": 0.6624325943678849, "repo_name": "flgiordano/netcash", "id": "e7b534616b8789d87b8880adc1bfc0be347f595d", "size": "89...
""" This model provides a base class for all models: Models: * Feature * Scenario * ScenarioOutline * Step """ from .exceptions import RadishError class Tag(object): """ Represents a tag for a model """ def __init__(self, name, arg=None): self.name = n...
{ "content_hash": "d20c4b5c18cda6399743eaa5a88861be", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 148, "avg_line_length": 24.46153846153846, "alnum_prop": 0.5566037735849056, "repo_name": "SamuelYvon/radish", "id": "e6719455ef298b6d16948d9a8dc131c3a62adebc", "size": "16...
''' Problem 50 15 August 2003 The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is ...
{ "content_hash": "0e1639ddb463dab576b490e2fe4bc874", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 118, "avg_line_length": 30.956521739130434, "alnum_prop": 0.7008426966292135, "repo_name": "robertdimarco/puzzles", "id": "c19a0165a3f66700ba80d19a5798c887bf2e6c6d", "size"...
import traceback from change_range import ChangeRange from statement import Statement, WarningResult from tokenized_statement import TokenizedStatement; class Chunk(object): """ A chunk is a series of consecutive lines in a Worksheet treated as a unit. The Chunk class is a base class for different types ...
{ "content_hash": "09791069ac5e1d0da3dc52ee91754d95", "timestamp": "", "source": "github", "line_count": 192, "max_line_length": 139, "avg_line_length": 34.864583333333336, "alnum_prop": 0.6092022706901703, "repo_name": "lamby/pkg-reinteract", "id": "aa2f771a101081d5d2ee1baae4f78b9f8d8380cb", "size"...
"""Script to parse MAF file To run: python load.py config_file """ import sys from bigquery_etl.load import load_data_from_file import json import os from bigquery_etl.utils.logging_manager import configure_logging def load(config): """ Load the bigquery table load_data_from_file accepts following params:...
{ "content_hash": "9bf2bd991fea408dc4c57335bfcaa352", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 80, "avg_line_length": 33.68627450980392, "alnum_prop": 0.610011641443539, "repo_name": "isb-cgc/ISB-CGC-data-proc", "id": "31ac4883b559acb824c050b110e63dd304882be3", "size...
from __future__ import with_statement from distutils.core import setup with open("LICENCE",'r') as input_h: LICENCE=input_h.read() VERSION="3.2" setup(name='tema-adapterlib', provides=['adapterlib',], license=LICENCE, version=VERSION, description='Library for building keyword-adapters', ...
{ "content_hash": "29df5ecdf4890689e06c6db22c91bf62", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 80, "avg_line_length": 28.38888888888889, "alnum_prop": 0.6673189823874756, "repo_name": "samini/gort-public", "id": "2f5785d17d246f8009fdfcf965dbc315b7ebd8d1", "size": "16...
__import__( "IECore" ) __import__( "IECoreScene" ) import warnings # the first import of pyopenvdb results in a duplicate c++ -> python # boost python type conversions warnings. # we use the warnings module to suppress these during the import with warnings.catch_warnings(): warnings.simplefilter("ignore") import pyo...
{ "content_hash": "02382d64c1d46805c94fa125247e1cd5", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 87, "avg_line_length": 31.571428571428573, "alnum_prop": 0.7375565610859729, "repo_name": "appleseedhq/cortex", "id": "cce54a68f6db7be5bb29c114fc7d04a19cc5a6b9", "size": "2...
"""Controllers for interactive and non-interactive widgets.""" __author__ = 'sll@google.com (Sean Lip)' from oppia.apps.widget.models import InteractiveWidget from oppia.apps.widget.models import NonInteractiveWidget from oppia.controllers.base import BaseHandler import utils from google.appengine.api import users ...
{ "content_hash": "285539565c0d60c75d28c6b285d4671e", "timestamp": "", "source": "github", "line_count": 142, "max_line_length": 78, "avg_line_length": 35.359154929577464, "alnum_prop": 0.5925114519020116, "repo_name": "sunu/oppia-test-4", "id": "b7b5b225701482f856ee049182411aac7958a40b", "size": "5...
from copy import deepcopy import glob import os import textwrap import time verbose = 0 cmd = None changes = dict() def setLevel(level): global verbose verbose = level def setCmd(command): global cmd cmd = command def runAtLevel(level): global verbose def outer(f): def decoration(*args, **kwargs): i...
{ "content_hash": "d5fb56577bba7bc86d4c5570bb67bcc5", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 136, "avg_line_length": 19.355371900826448, "alnum_prop": 0.6182749786507259, "repo_name": "swirepe/Watch", "id": "62b71ea028805af12a9bf89d18146f0d1b845585", "size": "2342...
import os import sys import time import numpy import theano import nonlinearity import theano.tensor as T from theano.tensor.signal import downsample from theano.tensor.nnet import conv import theano.tensor.nnet as Tnn class ConvMaxPool(object): """ Pool Layer of a convolutional network """ def __ini...
{ "content_hash": "19f3e67de7b6d517d46c3ef2a79c3fe1", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 119, "avg_line_length": 37.6566265060241, "alnum_prop": 0.5490321548552232, "repo_name": "zhenxuan00/mmdgm", "id": "8d4f4778d4d5826efc1b728f4f10cecffd7ce9e5", "size": "625...
__all__ = [ '__version__', '__author__', 'enable_attach', 'wait_for_attach', 'break_into_debugger', 'is_attached', ] # "force_pydevd" must be imported first to ensure (via side effects) # that the ptvsd-vendored copy of pydevd gets used. from ._vendored import force_pydevd from ptvsd.version import...
{ "content_hash": "8932ec4b49ae19d0e232a2450ae3dd07", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 77, "avg_line_length": 31.533333333333335, "alnum_prop": 0.6701902748414377, "repo_name": "SlicerRt/SlicerDebuggingTools", "id": "d3bd8623aa26f5c41465e0b3099caa95847a59b0", ...
from oslo_log import log as logging from rock.tasks import flow_utils LOG = logging.getLogger(__name__) class HostDisable(flow_utils.BaseTask): default_provides = "host_disable_result" def execute(self, target, disabled_reason, host_evacuate_result): if not host_evacuate_result: ...
{ "content_hash": "333b11818d82770aee5f2ca2f75628e5", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 78, "avg_line_length": 30.848484848484848, "alnum_prop": 0.5943025540275049, "repo_name": "unitedstack/rock", "id": "6aa18c1fac4d7f981d61d17497c6652b93b9cc73", "size": "166...
def list_tables(dataset_id): # [START bigquery_list_tables] from google.cloud import bigquery # Construct a BigQuery client object. client = bigquery.Client() # TODO(developer): Set dataset_id to the ID of the dataset that contains # the tables you are listing. # dataset...
{ "content_hash": "d7508357c9380eb6c0c4bb997f55c2dd", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 81, "avg_line_length": 32.73684210526316, "alnum_prop": 0.6479099678456591, "repo_name": "tswast/google-cloud-python", "id": "9ab527a4915f4fb0c412f3bbd5552e5597c70267", "si...
import sys sys.path.append("./src") from sat import SAT_solver from sudoku import sudoku, printSudoku, processResult from logConstructs import FlatCNF print "=================================================" print "SUDOKU" print "=================================================" solver = SAT_solver() # define bo...
{ "content_hash": "c77528aad99e44eb8d1ac770ff71dd9f", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 63, "avg_line_length": 35.0078125, "alnum_prop": 0.5942869895112698, "repo_name": "urska19/LVR-sat", "id": "00f0153d408051d45c194a3cea98b427860691f2", "size": "4525", "b...
from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("common", "0034_auto_20210913_1918"), ("accounts", "0012_remove_account_company"), ] operations = [ migrations.AddField( model_name="acco...
{ "content_hash": "fc513791c69bef71bde3d63bfe6c76a6", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 74, "avg_line_length": 28.825, "alnum_prop": 0.5108412836079792, "repo_name": "MicroPyramid/Django-CRM", "id": "5531f09d3af06f4d5f606f1f68e0f612331c0471", "size": "1200", ...
""" Vanilla RNN @author Graham Taylor """ import numpy as np import theano import theano.tensor as T from sklearn.base import BaseEstimator import logging import time import os import datetime import pickle as pickle import math import matplotlib.pyplot as plt plt.ion() mode = theano.Mode(linker='cvm') #mode = '...
{ "content_hash": "6e365c3b3abcc252f46f7710835387ce", "timestamp": "", "source": "github", "line_count": 714, "max_line_length": 80, "avg_line_length": 36.745098039215684, "alnum_prop": 0.526719012044519, "repo_name": "mengyun1993/RNN-binary", "id": "e1377a219a830fcd7e6f37248f902a10384d4c80", "size"...