text
stringlengths
4
1.02M
meta
dict
from unittest import skip from nose.tools import * from .context import ask from .fixtures.requests import TEST_FULL_REQUEST_DICT, TEST_SPARSE_REQUEST_DICT class TestStandardRequest(object): def setUp(self): self.example = ask.Request(TEST_FULL_REQUEST_DICT) def tearDown(self): self.examp...
{ "content_hash": "8f780a3213999a1152f2929244eba296", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 82, "avg_line_length": 29.128205128205128, "alnum_prop": 0.6616784037558685, "repo_name": "bhairavmehta95/flashcard-helper-alexa-skill", "id": "58d4c03e30d69ccd53fbfb1819941...
''' @author: YYK ''' import shell import ssh import os.path import log import subprocess import lock import time import json logger = log.get_logger(__name__) class SaltError(Exception): '''salt error''' def prepare_salt_state(state_path, salt_state_path='/srv/salt'): try: subprocess.call(['sal...
{ "content_hash": "d6ea75a6a04d734a57c2edf2aa838497", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 413, "avg_line_length": 39.96808510638298, "alnum_prop": 0.6012776151184456, "repo_name": "mingjian2049/zstack-utility", "id": "1297ec94691550d83cdc67f42f8f0c8304d609d8", "...
from django import forms from django.utils.translation import ugettext_lazy as _ from ..utils import get_user_model class RegistrationForm(forms.Form): username = forms.RegexField( regex=r'^[\w.@+-]+$', max_length=30, label=_('Username'), error_messages={'invalid': _('The username must contain on...
{ "content_hash": "9382c7dea76d921de8781c23ec9eaae2", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 79, "avg_line_length": 35.888888888888886, "alnum_prop": 0.5557275541795665, "repo_name": "brutasse/django-le-social", "id": "be234d2e405bad94ac9513fb2ade16f4734149d4", "si...
""" Created on Thu Dec 1 18:52:57 2016 @author: aishwaryakamath """ from keras.models import Sequential from keras.layers import Bidirectional, BatchNormalization from keras.layers.core import Dense, Activation, Merge, Dropout, Flatten, Reshape from keras.layers.convolutional import MaxPooling2D, MaxPooling1D from k...
{ "content_hash": "1a4e96af785e7c97078622a4f342befb", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 136, "avg_line_length": 42.05555555555556, "alnum_prop": 0.6277410832232496, "repo_name": "ashkamath/VQA", "id": "a394e9fb27dcbcd9d591724ec950f8b1d8d1cb8b", "size": "3809",...
import os import pickle import pytest import functools try: import pycuda except ImportError: ans = input('PyCUDA not found. Regression tests will take forever. Do you want to continue? [y/n] ') if ans in ['Y', 'y']: pass else: sys.exit() from pygbe.main import main @pytest.mark.par...
{ "content_hash": "15c00cd3e4848f13c25c6a89d5401b40", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 106, "avg_line_length": 31.07843137254902, "alnum_prop": 0.5488958990536278, "repo_name": "barbagroup/pygbe", "id": "f81e0154df93ec55a1ef3840926ef551bcc81533", "size": "158...
from logging import getLogger from galaxy.util import parse_xml_string from ..job import ( BaseJobExec, job_states, ) log = getLogger(__name__) argmap = { "destination": "-q", "Execution_Time": "-a", "Account_Name": "-A", "Checkpoint": "-c", "Error_Path": "-e", "Group_List": "-g", ...
{ "content_hash": "0b2f8e236f9197b01808a86854e124fc", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 118, "avg_line_length": 29.431192660550458, "alnum_prop": 0.5152743142144638, "repo_name": "galaxyproject/pulsar", "id": "12c843583c92ea0c56d2a49f56aac308dd44f4b0", "size"...
""" Support for DEB packages """ import datetime import logging import os import re import salt.utils.args import salt.utils.data import salt.utils.files import salt.utils.path import salt.utils.stringutils from salt.exceptions import CommandExecutionError, SaltInvocationError log = logging.getLogger(__name__) # De...
{ "content_hash": "b73340eb9dadea6dbe93933de157ba3a", "timestamp": "", "source": "github", "line_count": 440, "max_line_length": 88, "avg_line_length": 30.10909090909091, "alnum_prop": 0.5641606280193237, "repo_name": "saltstack/salt", "id": "2bd12a7e615050658caf94da01e071f88bff98f0", "size": "13248...
import pytest from inventory_control import storage def get_config(): """ Create my simple localhost config :return: """ config = {'host': 'localhost', 'user': 'wce', 'password': 'thispasswordisobjectivelyterrible', 'db': 'inventory_control'} return config def te...
{ "content_hash": "15522b29908f7747b1e90ead9dc53b6f", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 63, "avg_line_length": 26.318840579710145, "alnum_prop": 0.6200440528634361, "repo_name": "codeforsanjose/inventory-control", "id": "f79d4e285f5d426ab721dd0aaf81fe334b3e8d63"...
"""From flight data, gather info about distance between airports and check for consistency. Then write to distance.csv""" from sets import Set import numpy as np import pandas as pd pd.options.mode.chained_assignment = None #Suppress overwrite error. def get_distancefreq(): #Empty dataframe to accumulate freque...
{ "content_hash": "af387e873b57e8028e39cf390a0eadda", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 108, "avg_line_length": 39.28409090909091, "alnum_prop": 0.6355221290135956, "repo_name": "mtb0/flightmodel", "id": "b6231e28cd99fc6a938dc743a0f2ee6a3a7af998", "size": "347...
from setuptools import setup from yolk.__init__ import __version__ as VERSION setup(name="yolk", license = "BSD License", version=VERSION, description="Command-line tool for querying PyPI and Python packages installed on your system.", long_description=open("README", "r").read(), maintainer="Rob...
{ "content_hash": "3b110f9294f0e258411fac94e314ca81", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 100, "avg_line_length": 37.44444444444444, "alnum_prop": 0.6261127596439169, "repo_name": "cakebread/yolk", "id": "2e08c6b0a1cde96a9c144615386e230d6b9f7e93", "size": "1035"...
import os import numpy as np from PIL import Image from singa import device from singa import tensor from singa import sonnx import onnx from utils import download_model, check_exist_or_download import logging logging.basicConfig(level=logging.INFO, format='%(asctime)-15s %(message)s') def preprocess(img): img ...
{ "content_hash": "3681889caf4afd2aac941321336829bf", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 90, "avg_line_length": 30.483870967741936, "alnum_prop": 0.6204585537918871, "repo_name": "apache/incubator-singa", "id": "369cee9e58e21508d5e879b82256e13e0a1973cf", "size"...
import os from collections import defaultdict from flask import Flask from flask import json from flask import request from flask import render_template app = Flask(__name__) PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) RESULTS_DIR = os.path.join(PROJECT_DIR, '../results') def visualise_file(): ve...
{ "content_hash": "2a06648c090d838a03b5f06eec29d328", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 77, "avg_line_length": 32.20754716981132, "alnum_prop": 0.5629759812536614, "repo_name": "elbaschid/mti-lightbulb", "id": "05330392dfa0e08d71fab756f3f7519c24446a9a", "size"...
from django.core.urlresolvers import NoReverseMatch # noqa from django.core.urlresolvers import reverse from django.http import HttpResponse # noqa from django.template import defaultfilters as filters from django.utils import html from django.utils.http import urlencode from django.utils import safestring from djang...
{ "content_hash": "cdb6c8dae34aeba2213290ca513db55d", "timestamp": "", "source": "github", "line_count": 422, "max_line_length": 79, "avg_line_length": 34.72985781990521, "alnum_prop": 0.5912254366812227, "repo_name": "CiscoSystems/avos", "id": "a4389f989c3a370c6346b8ec9dc3089a00d4bd71", "size": "15...
from django.apps import AppConfig class UsersConfig(AppConfig): name = 'todolist.users' verbose_name = "Users" def ready(self): """Override this to put in: Users system checks Users signal registration """ pass
{ "content_hash": "807410c36bba244c2c2c8088edb90279", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 37, "avg_line_length": 21.076923076923077, "alnum_prop": 0.5912408759124088, "repo_name": "Joneyviana/todolist-django-angular", "id": "94c9b48e086a5fdbf12a81f78d53ec41b68a6b5...
from twisted.web import resource class Logout(resource.Resource): """ Log the user out. @param cookieDict: A C{dict} mapping cookie values to Twitter usernames. """ allowedMethods = ('GET',) def __init__(self, cookieDict, conf): resource.Resource.__init__(self) self._cookieDi...
{ "content_hash": "f665d27924eb539d074470ccb5698dba", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 76, "avg_line_length": 26.142857142857142, "alnum_prop": 0.5901639344262295, "repo_name": "fluidinfo/lastpage-server", "id": "f2c9f5d9939af3fa47b2c8c8209a73d11a6fddc5", "si...
from swgpy.object import * def create(kernel): result = Creature() result.template = "object/mobile/shared_dressed_warren_cyborg_style_01.iff" result.attribute_template_id = 9 result.stfName("theme_park_name","1h_trainer") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
{ "content_hash": "e9eabb86018180bfd7ab94dd02115967", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 76, "avg_line_length": 24, "alnum_prop": 0.6987179487179487, "repo_name": "obi-two/Rebelion", "id": "c7ec2d8035253b5964c50ccd9c99fc760cebaf5a", "size": "457", "binary": f...
from django.core.management import call_command from django.test import TestCase from mock import call from mock import patch from kolibri.core.content import models as content class DeleteChannelTestCase(TestCase): """ Testcase for delete channel management command """ fixtures = ["content_test.jso...
{ "content_hash": "09bc3a6554face371a45c41a50fc115a", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 83, "avg_line_length": 38.17391304347826, "alnum_prop": 0.6814730447987851, "repo_name": "lyw07/kolibri", "id": "6b96bfef58b4e0f3892eca2a78609d7e86527bfb", "size": "2634", ...
from abc import ABCMeta, abstractmethod from schedprof.coroutine import Coroutine from schedprof.cpu import CPU, State class Scheduler(object): __metaclass__ = ABCMeta def __init__(self): self._now = 0 self.cpus = [] self.coros = [] self._idle_cputime = 0 self._context...
{ "content_hash": "172b5222628dce03cc1887d40e6d292b", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 123, "avg_line_length": 45.4609375, "alnum_prop": 0.5512974737927478, "repo_name": "isn-/dfk", "id": "9dfec888c781f0f888cbb977de23ce0a161cc5db", "size": "5866", "binary"...
from datetime import datetime from typing import List, Optional, Union from dbt.contracts.graph.manifest import WritableManifest from dbt.contracts.rpc import ( GetManifestParameters, GetManifestResult, RPCCompileParameters, RPCDocsGenerateParameters, RPCRunOperationParameters, RPCSeedParameter...
{ "content_hash": "fabb270dbc994ce1bb48a600b62903e1", "timestamp": "", "source": "github", "line_count": 220, "max_line_length": 78, "avg_line_length": 30.563636363636363, "alnum_prop": 0.6763831052944675, "repo_name": "fishtown-analytics/dbt", "id": "99a67f8a36b90863356b53b9c03d427477c05bf3", "size...
""" RHEAS module for retrieving meteorological forecasts/hindcasts from the NMME model suite. .. module:: nmme :synopsis: Retrieve NMME meteorological forecast data .. moduleauthor:: Kostas Andreadis <kandread@jpl.nasa.gov> """ import datasets import rpath import dbio import subprocess import tempfile import os ...
{ "content_hash": "dcd3c8b5fd0e4bc61457a7c783cce949", "timestamp": "", "source": "github", "line_count": 219, "max_line_length": 309, "avg_line_length": 51.342465753424655, "alnum_prop": 0.6359836357168267, "repo_name": "nasa/RHEAS", "id": "db957c130576df5c976383f0862de1e937aee675", "size": "11244",...
""" P1 tests for memory resource limits """ # Import Local Modules from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.lib.base import ( Account, ServiceOffering, ...
{ "content_hash": "3c3a9edb833856364a74176e574c7b8f", "timestamp": "", "source": "github", "line_count": 772, "max_line_length": 137, "avg_line_length": 45.575129533678755, "alnum_prop": 0.5067075943610733, "repo_name": "wido/cloudstack", "id": "51e92ce67f18c53abed5987bc97190bcf01e714a", "size": "35...
from __future__ import unicode_literals # Ensure 'assert_raises' context manager support for Python 2.6 import tests.backport_assert_raises from nose.tools import assert_raises import base64 import datetime import boto from boto.ec2.instance import Reservation, InstanceAttribute from boto.exception import EC2Response...
{ "content_hash": "4e39753cdf0ce33842c22ee06d99b35e", "timestamp": "", "source": "github", "line_count": 807, "max_line_length": 123, "avg_line_length": 40.45105328376704, "alnum_prop": 0.7073275333905159, "repo_name": "tootedom/moto", "id": "58b1f693a26510c448483a05ed162dd27689fa66", "size": "32644...
try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from gluon import current from gluon.html import A, URL from gluon.storage import Storage from s3 import s3_fullname T = current.T settings = current.deployment_set...
{ "content_hash": "6f54c08e6e545e6a0dde8aa611b48197", "timestamp": "", "source": "github", "line_count": 2052, "max_line_length": 187, "avg_line_length": 39.77436647173489, "alnum_prop": 0.4514990749476212, "repo_name": "collective/eden", "id": "d9113a8253b4d481a237bb5bc5d4b75d86b59419", "size": "81...
from django.http import HttpResponseRedirect from django.conf import settings class LoginRequiredMiddleware: def process_request(self, request): if not request.user.is_authenticated(): path = request.path_info if not path.startswith('/accounts/'): return HttpRespons...
{ "content_hash": "11734a0a9f99fb0f0545839e99cdc46d", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 63, "avg_line_length": 35, "alnum_prop": 0.6942857142857143, "repo_name": "sychsergiy/DocFlow", "id": "876287170056f5efce009a7b0837b56e29f1abab", "size": "350", "binary":...
"""Repository access. This module contains the base class for git repositories (BaseRepo) and an implementation which uses a repository on local disk (Repo). """ from io import BytesIO import errno import os import sys from dulwich.errors import ( NoIndexPresent, NotBlobError, NotCommitError, NotGit...
{ "content_hash": "def6a5c8f41e410a6c13ad0426c380ce", "timestamp": "", "source": "github", "line_count": 968, "max_line_length": 84, "avg_line_length": 33.96797520661157, "alnum_prop": 0.58857698975092, "repo_name": "Sorsly/subtle", "id": "12faefcc56aea786607e4d72149af3f091f11dde", "size": "33773", ...
"""Fixer that changes buffer(...) into memoryview(...).""" # Local imports from .. import fixer_base from ..fixer_util import Name class FixBuffer(fixer_base.BaseFix): explicit = True # The user must ask for this fixer PATTERN = """ power< name='buffer' trailer< '(' [any] ')' > any* > ...
{ "content_hash": "321b90bb8755f090626dc219cc115ecd", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 66, "avg_line_length": 25.77777777777778, "alnum_prop": 0.5948275862068966, "repo_name": "MalloyPower/parsing-python", "id": "21d04aed0b3c456aa9ab3f290ed49fe21e97ef87", "si...
''' Run pylint against each python file with changes ''' import os import re import sys import common PYLINT_RCFILE = "jenkins/test/validators/.pylintrc" LINT_EXCLUDE_PATTERN_LIST = [ r'prometheus_client' r'ansible/inventory/aws/hosts/ec2.py' r'ansible/inventory/gce/hosts/gce.py' r'docs/*'] def linte...
{ "content_hash": "f0358af85902a087c43c57744d8a6247", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 102, "avg_line_length": 30.06024096385542, "alnum_prop": 0.6072144288577155, "repo_name": "drewandersonnz/openshift-tools", "id": "62793a33ec4e1f5447010b5866442804b09ec45b", ...
from google.api_core import datetime_helpers def undelete_table(table_id, recovered_table_id): # [START bigquery_undelete_table] import time from google.cloud import bigquery # Construct a BigQuery client object. client = bigquery.Client() # TODO(developer): Choose a table to recover. #...
{ "content_hash": "fc6adec3787a2ef95df94d8ce179409e", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 86, "avg_line_length": 35, "alnum_prop": 0.6824175824175824, "repo_name": "tswast/google-cloud-python", "id": "18b15801ffee0065a1fd77f06db7d7373dc887c7", "size": "2396", ...
from __future__ import division import warnings import numpy as np import scipy.sparse as sp from .base import BaseEstimator, ClassifierMixin, RegressorMixin from .utils import check_random_state from .utils.validation import check_array from .utils.validation import check_consistent_length from .utils.random import ...
{ "content_hash": "150b7745f7838c157b7c62617174d076", "timestamp": "", "source": "github", "line_count": 467, "max_line_length": 79, "avg_line_length": 36.563169164882225, "alnum_prop": 0.5503953147877013, "repo_name": "schets/scikit-learn", "id": "f87a6d0def9816313f1e6aa4556185774be384e6", "size": ...
""" Unit tests for the Hyper-V utils V2. """ import mock from neutron.plugins.hyperv.agent import utils from neutron.plugins.hyperv.agent import utilsv2 from neutron.tests import base class TestHyperVUtilsV2(base.BaseTestCase): _FAKE_VSWITCH_NAME = "fake_vswitch_name" _FAKE_PORT_NAME = "fake_port_name" ...
{ "content_hash": "a0c398a65928399fa90ce991d5b0a5bb", "timestamp": "", "source": "github", "line_count": 501, "max_line_length": 79, "avg_line_length": 43.41317365269461, "alnum_prop": 0.6000459770114942, "repo_name": "sajuptpm/neutron-ipam", "id": "c020f16e0f6910eae137c2efd46b3e73416b7aff", "size":...
import mxnet as mx import re def load_checkpoint(prefix, epoch): """ Load model checkpoint from file. :param prefix: Prefix of model name. :param epoch: Epoch number of model we would like to load. :return: (arg_params, aux_params) arg_params : dict of str to NDArray Model parameter, di...
{ "content_hash": "cfb4482908454650ba7b40b25c7bc5f2", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 91, "avg_line_length": 36.05882352941177, "alnum_prop": 0.6264274061990212, "repo_name": "vincentlooi/FCIS", "id": "7c78cb60d3b52cb6fcbc3415412887ac30436829", "size": "2452...
from twisted.web import resource from coherence.upnp.core.soap_service import UPnPPublisher from coherence.upnp.core import service class FakeMediaReceiverRegistrarBackend: def upnp_IsAuthorized(self, *args, **kwargs): r = {'Result': 1} return r def upnp_IsValidated(self, *args, **kwargs):...
{ "content_hash": "83ca03e79a7b9a8af00cdd8e10be1409", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 120, "avg_line_length": 32.74193548387097, "alnum_prop": 0.6364532019704433, "repo_name": "coherence-project/Coherence", "id": "9b85ac82b366902d83356cbde541d394bc3587c1", "...
import click from markov_slackbot.main import markov_slackbot from markov_slackbot.main import generate_example_config_file from markov_slackbot.main import prepare_environment def main(): cli.add_command(run_bot) cli.add_command(generate_example_config) cli.add_command(prepare_env) cli() @click.gr...
{ "content_hash": "148149a9d5b89262278ba31d7ab31137", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 61, "avg_line_length": 20.195121951219512, "alnum_prop": 0.678743961352657, "repo_name": "StuartJSquires/markov_slackbot", "id": "2946456ed15a8b05c2be4535429c66d34dac05ec", ...
import math import torch from ..constraints import Positive from .kernel import Kernel class PeriodicKernel(Kernel): r""" Computes a covariance matrix based on the periodic kernel between inputs :math:`\mathbf{x_1}` and :math:`\mathbf{x_2}`: .. math:: \begin{equation*} k_{\text{Period...
{ "content_hash": "2365e136a791128bd001bf786f51098b", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 116, "avg_line_length": 40.56140350877193, "alnum_prop": 0.6176470588235294, "repo_name": "jrg365/gpytorch", "id": "65c1f1b085733dfa12fe58526a06c675b99ab9dd", "size": "464...
"""Tests for the unified diff parser process.""" from __future__ import unicode_literals import codecs import os.path import unittest from unidiff import PatchSet from unidiff.patch import PY2 from unidiff.errors import UnidiffParseError if not PY2: unicode = str class TestUnidiffParser(unittest.TestCase): ...
{ "content_hash": "2774e5d41a979ed473c948c75960bca8", "timestamp": "", "source": "github", "line_count": 494, "max_line_length": 99, "avg_line_length": 39.45748987854251, "alnum_prop": 0.5934229427457418, "repo_name": "matiasb/python-unidiff", "id": "221e5fa1e6b1c7ea3985dacc6e52181ee4f3643a", "size"...
from pyos8 import * from socket import * from sockwrap import Socket def handle_client(client,addr): print "Connection from", addr while True: data = yield client.recv(65536) if not data: break yield client.send(data) print "Client closed" yield client.close() def s...
{ "content_hash": "5b4bc05124196b8cf7f509088090a7e7", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 49, "avg_line_length": 24.310344827586206, "alnum_prop": 0.6581560283687943, "repo_name": "iamaris/xpython", "id": "edcdaabf6bb3321a5b37434b128ba112288d6ef7", "size": "769"...
import sys import numpy import math import pygame import pygame.freetype from pathlib import Path def getfont_mono(pathstr=None): if pathstr is None: #d = Path(sys.argv[0]).resolve().parent f = 'liberation_mono.ttf' paths = [ #d / f, #d.parent / 'share' / '...
{ "content_hash": "7305b9d34006a481ea34f69f24974523", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 70, "avg_line_length": 33.803030303030305, "alnum_prop": 0.5369789332138055, "repo_name": "rbmj/pyflightcontrol", "id": "874675a832843ac493e057dae648e4d5a89d61b2", "size": ...
""" Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Examples: pattern = "abba", str = "dog cat cat dog" should return true. pattern = "abba", str = "dog cat cat fish" should ...
{ "content_hash": "861d63b36afe628e087c5c93a499eb7e", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 79, "avg_line_length": 31.372093023255815, "alnum_prop": 0.6004447739065975, "repo_name": "fantuanmianshi/Daily", "id": "07a8fd80afda3b363ced77eaa8c86023080e5b88", "size": ...
"""Tests for subscription management.""" from __future__ import annotations from core import feconf from core.domain import collection_domain from core.domain import collection_services from core.domain import exp_domain from core.domain import exp_services from core.domain import feedback_services from core.domain i...
{ "content_hash": "e71973472a38742888f94d03e3984f55", "timestamp": "", "source": "github", "line_count": 558, "max_line_length": 114, "avg_line_length": 41.4910394265233, "alnum_prop": 0.6415428472702143, "repo_name": "oppia/oppia", "id": "74dff6a33a919dad5012877e59cbafbbdc0df381", "size": "23775", ...
from msrest.serialization import Model class DiskInstanceView(Model): """The instance view of the disk. :param name: The disk name. :type name: str :param statuses: The resource status information. :type statuses: list[~azure.mgmt.compute.v2015_06_15.models.InstanceViewStatus] """ _...
{ "content_hash": "25a6726fd5549d799d68b2b8ee25cdfb", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 75, "avg_line_length": 29.863636363636363, "alnum_prop": 0.6133942161339422, "repo_name": "lmazuel/azure-sdk-for-python", "id": "cc4b78b3c2b377bca721f77ae5b7f04e045ff783", ...
import sys from optparse import make_option from scaffolder.core.utils import import_class from scaffolder.core.optparser import CommandMeta from scaffolder.core.optparser import CommandOptionParser from scaffolder import get_version from clint.textui.colored import red class CommandController(): DEFAULT_ARGUME...
{ "content_hash": "72bd7b263e9cbef8708a0b95b53ad02e", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 91, "avg_line_length": 30.830303030303032, "alnum_prop": 0.5803027324552782, "repo_name": "goliatone/minions", "id": "07e9ebf6035296d030b16b06916207eefc23b256", "size": "5...
"""Empty revision This is the empty revision that can be used as the base for future migrations. Initial database creation shall be done via `metadata.create_all()` and `alembic stamp head`. Revision ID: 4784a128a6dd Revises: Create Date: 2017-12-13 00:48:12.079431 """ from alembic import op import sqlalchemy as s...
{ "content_hash": "b9d58ef49179b010e4fc0dfc2eb97792", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 71, "avg_line_length": 16.25, "alnum_prop": 0.7442307692307693, "repo_name": "lukasjuhrich/pycroft", "id": "b0fb50c7523783314d432bc17264f23d43543436", "size": "520", "bin...
def test_init(medius_client): assert medius_client.access_token == 'ACCESS_TOKEN' assert medius_client.mocked_request_method.called_once() assert medius_client.mocked_request_method.call_args[0][0] == 'https://api.medium.com/v1/me' assert medius_client.user_id == 'ID' assert medius_client.username =...
{ "content_hash": "f99ab5acda4ba93325938a0031352d8e", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 127, "avg_line_length": 42.666666666666664, "alnum_prop": 0.7053571428571429, "repo_name": "cleberzavadniak/medius", "id": "f26be385af607b4d9189419286dada4fafe74692", "size...
import glob import sys def main(): hits_dir = sys.argv[1] input_files = [inp for inp in glob.glob(hits_dir + '/input*') if '.txt' not in inp] inputs = ['urls\n'] for input_file in input_files: with open(input_file) as fh: inputs.extend(fh.readlines()[1:]) with open(hits_dir + '...
{ "content_hash": "fc9ba882b19266f0338dcdad22c992af", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 87, "avg_line_length": 25.625, "alnum_prop": 0.5658536585365853, "repo_name": "andriluka/mechturk-public", "id": "8d28824dad6446daab1154f1c23829c602ff4a78", "size": "410", ...
import cPickle from diamond.handler.Handler import Handler from cloudify_handler.format import jsonify class TestHandler(Handler): def process(self, metric): if self.config.get('output_cloudify_format', False): metric = jsonify(metric) with open(self.config['log_path'], 'a') as f: ...
{ "content_hash": "d6e9e662b69b6b55c24a5a2bff2f2aca", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 60, "avg_line_length": 27.23076923076923, "alnum_prop": 0.672316384180791, "repo_name": "geokala/cloudify-diamond-plugin", "id": "b17ceeda977d7e895b0004b0a8fec741ebc72821", ...
from sqlalchemy.orm import class_mapper from gearshift import config, identity from gearshift.database import session from gearshift.util import load_class import logging log = logging.getLogger("gearshift.identity.saprovider") # Global class references -- # these will be set when the provider is initialised. user_...
{ "content_hash": "86acaa755e6fd6217e8504ed798ba4f7", "timestamp": "", "source": "github", "line_count": 230, "max_line_length": 79, "avg_line_length": 35.04347826086956, "alnum_prop": 0.6202233250620347, "repo_name": "dbrattli/python-gearshift", "id": "d2e0e3e9a0969373c884cfa84d40de2d3054758f", "si...
""" WSGI config for imdel_backend project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANG...
{ "content_hash": "acfa4eaaf5d1250dc5c790360ea7d04a", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 78, "avg_line_length": 25.25, "alnum_prop": 0.7722772277227723, "repo_name": "aleksanderhan/imdel_backend", "id": "4ad21b29dd9432e9b5a3458ac5eea014c2da3e2d", "size": "404",...
''' Generate some random frames from an image, and also plot out the colors ''' # coding: utf-8 import matplotlib import cv2 matplotlib.use('agg') from matplotlib import pyplot as plt from matplotlib.font_manager import FontProperties import numpy import sys import argparse import random import os parser = argpa...
{ "content_hash": "86513449edcad4c415ed26ad55601585", "timestamp": "", "source": "github", "line_count": 110, "max_line_length": 219, "avg_line_length": 33.42727272727273, "alnum_prop": 0.6464509110688061, "repo_name": "linsalrob/depth-profile-video-processing", "id": "15a9a86bf394ad10fada0594f4fc4949...
import argparse import pytest import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import fresh_config local_config = fresh_config() local_config.retries = 2 @python_app def sleep_fail(sleep_dur, sleep_rand_max, fail_prob, inputs=[]): import time import random s = ...
{ "content_hash": "3ec1f2161782ccd39a6f184ba70cd209", "timestamp": "", "source": "github", "line_count": 188, "max_line_length": 81, "avg_line_length": 23.579787234042552, "alnum_prop": 0.544777802842319, "repo_name": "Parsl/parsl", "id": "e065dba9e65e41b20ba0adace3631800a4734497", "size": "4433", ...
import sys, os import re from subprocess import call, Popen, PIPE import shlex # 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. sy...
{ "content_hash": "22d4c26af2faa5b78597284686766276", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 106, "avg_line_length": 33.514084507042256, "alnum_prop": 0.711914267703299, "repo_name": "hwmaier/esp-idf", "id": "120de169a7921db3d7fbbba55b4b978fac257e1a", "size": "995...
from datetime import datetime from peewee import ForeignKeyField, DateTimeField from wx.app import database from wx.models.station import Station class Report(database.Model): station = ForeignKeyField(Station, related_name='reports') timestamp = DateTimeField(default=datetime.now) class Meta: ...
{ "content_hash": "2ec1451d0f1d29b940fcedfc93d5d87d", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 62, "avg_line_length": 23.2, "alnum_prop": 0.75, "repo_name": "zeckalpha/wx", "id": "119582858572904690407fe7ba34bb523432ac0c", "size": "348", "binary": false, "copies"...
import sys import os # -- Allow Markdown ----------------------------------------------------- # source_suffix = ['.rst', '.md'] # 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.pa...
{ "content_hash": "de862f666cb648c808294a081f81e2f7", "timestamp": "", "source": "github", "line_count": 468, "max_line_length": 265, "avg_line_length": 29.574786324786324, "alnum_prop": 0.6508200274546637, "repo_name": "thespacedoctor/tastic", "id": "9db819255864f176eba954d62a99336dff8fa1a2", "size...
import unittest import pytest from airflow.models import Connection from airflow.models.dag import DAG from airflow.providers.mongo.hooks.mongo import MongoHook from airflow.providers.mongo.sensors.mongo import MongoSensor from airflow.utils import db, timezone DEFAULT_DATE = timezone.datetime(2017, 1, 1) @pytest....
{ "content_hash": "f85b0871adbd25e2412d07a7364da795", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 106, "avg_line_length": 28.63888888888889, "alnum_prop": 0.6304558680892337, "repo_name": "dhuang/incubator-airflow", "id": "6623631550855bccb6b162e6e7f56a76e1fdd814", "siz...
""" | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: BSD | This file contains the DAL support for many relational databases, including: - SQLite & SpatiaLite - MySQL - Postgres - Firebird - Oracle - MS SQL - DB2 - Interbase - Ing...
{ "content_hash": "30221cd8f010fb0de3542ab859dba478", "timestamp": "", "source": "github", "line_count": 1026, "max_line_length": 169, "avg_line_length": 36.95711500974659, "alnum_prop": 0.5365525607890712, "repo_name": "willimoa/pydal", "id": "b1bd7cf49dea93c1f298faa0bc9db83838259804", "size": "379...
"""sorno_locate_git gets the remote location of a local file/directory from a local git repository. Copyright 2016 Heung Ming Tai 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 ...
{ "content_hash": "c7d2a66f6e067f6863d585fdfdfa0627", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 78, "avg_line_length": 30.791304347826088, "alnum_prop": 0.542219711945778, "repo_name": "hermantai/sorno-py-scripts", "id": "77078bf4c27dffa6816f315df4932bbd4570d561", "s...
from os import curdir, sep from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer class S198_Handler(BaseHTTPRequestHandler): def do_GET(self): print self.path f = open(curdir + sep + "index.html") self.send_response(200) self.send_header('Content-type', 'text/html'...
{ "content_hash": "c16daa5078c74e2ec987a7a237e09b30", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 66, "avg_line_length": 30.26923076923077, "alnum_prop": 0.5781448538754765, "repo_name": "amin10/scripts", "id": "5db66d226bcdb30af6d9e8f70f2a5d25f9f6b5f0", "size": "787", ...
import os import numpy as np import pandas as pd from confparser import load_config from expyriment import stimuli, misc def launch_instructions(instructions_ini, exp): # Select .ini file for instructions setting = load_config(instructions_ini) # Define the pathway of the instructions file instructio...
{ "content_hash": "839dcfa8d4c868cb8b95907d1f8bca2e", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 78, "avg_line_length": 47.22222222222222, "alnum_prop": 0.4954010695187166, "repo_name": "hbp-brain-charting/public_protocols", "id": "074ee3a74ff4f44d58409aa57838b5c2f7a99d1...
""" Allows downloading a Plex media item from a local or shared library. You may specify the item by the PlexWeb url (everything after !) or by manually searching the items from the command line wizard. Original contribution by lad1337. """ import argparse import os import re from urllib.parse import unquote from ple...
{ "content_hash": "baa07e40492940208b0f3033264056f0", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 118, "avg_line_length": 38.32941176470588, "alnum_prop": 0.6243093922651933, "repo_name": "pkkid/python-plexapi", "id": "69a39b8134ce608ed7516104768953dad8750c16", "size": ...
"""Provides yaml parser Python APIs for Matter.""" from . import parser
{ "content_hash": "6caed77d47a4bc99117a4d3232cd2dfc", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 50, "avg_line_length": 36, "alnum_prop": 0.7361111111111112, "repo_name": "project-chip/connectedhomeip", "id": "055bec97cafac42d1c5829eb9901eb5b7ac7834a", "size": "775", ...
""" PySCeS - Python Simulator for Cellular Systems (http://pysces.sourceforge.net) Copyright (C) 2004-2022 B.G. Olivier, J.M. Rohwer, J.-H.S Hofmeyr all rights reserved, Brett G. Olivier (bgoli@users.sourceforge.net) Triple-J Group for Molecular Cell Physiology Stellenbosch University, South Africa. Permission to us...
{ "content_hash": "812180271c5ef51d51776f7021a71568", "timestamp": "", "source": "github", "line_count": 486, "max_line_length": 112, "avg_line_length": 29.818930041152264, "alnum_prop": 0.5002760143527464, "repo_name": "PySCeS/pysces", "id": "e22afda484a99d13bf9c5fc06226b5d3ed3e64da", "size": "1449...
from caravan.commands import run_swf_command from caravan.commands.base import BaseCommand class Command(BaseCommand): description = 'Terminate a workflow execution' def setup_arguments(self, parser): parser.add_argument('-d', '--domain', required=True) parser.add_argument('-i', '--id', requ...
{ "content_hash": "cc31e71e1b21f964a92d018a56261920", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 74, "avg_line_length": 33.44444444444444, "alnum_prop": 0.6190476190476191, "repo_name": "pior/caravan", "id": "6fd1c3ea7baa984f53878caf79ac0239eaf98d43", "size": "903", ...
'''Setup for filament_watch''' import ez_setup ez_setup.use_setuptools() from setuptools import setup with open('README.md') as readme_file: README = readme_file.read() setup( name="filament_watch", version="1.0", author="Richard L. Lynch", author_email="rich@richlynch.com", description=("M...
{ "content_hash": "1c747349e203704f4103546ad2ba1305", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 105, "avg_line_length": 26.272727272727273, "alnum_prop": 0.6551326412918108, "repo_name": "rllynch/filament_watch", "id": "59a25d6c5e72fa5c23f352e42866bc6f8b048141", "size...
from unittest import mock from ironic.common import exception from ironic.objects import base from ironic.objects import fields from ironic.objects import notification from ironic.tests import base as test_base class TestNotificationBase(test_base.TestCase): @base.IronicObjectRegistry.register_if(False) cla...
{ "content_hash": "bb8ed612d8e7406337430138bb140143", "timestamp": "", "source": "github", "line_count": 354, "max_line_length": 79, "avg_line_length": 43.69774011299435, "alnum_prop": 0.6145840067231236, "repo_name": "openstack/ironic", "id": "255845debf757a599c5127b75557bdf04c20c832", "size": "160...
from __future__ import unicode_literals import re from pybtex.richtext import Symbol, Text from pybtex.style.formatting import BaseStyle, toplevel from pybtex.style.template import ( field, first_of, href, join, names, optional, optional_field, sentence, tag, together, words ) def dashify(text): dash_re...
{ "content_hash": "59fce48540172d0eb80575337a7b3957", "timestamp": "", "source": "github", "line_count": 441, "max_line_length": 98, "avg_line_length": 32.35374149659864, "alnum_prop": 0.4761003644519204, "repo_name": "live-clones/pybtex", "id": "fd48230d9bcd6e5bd98896b4cfdd24d92319ce6a", "size": "1...
SHARED_DATA_USERNAME = "admin_user" SHARED_DATA_PASSWORD = "admin_password"
{ "content_hash": "35264abbf9da29ff9b062d251e93aec0", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 39, "avg_line_length": 38, "alnum_prop": 0.7631578947368421, "repo_name": "telerik/cloudbase-init", "id": "66ec8cfb17446f7b5b8113b1c6f9365ff3713cc1", "size": "737", "binar...
import os import csv import pickle from functools import wraps from io import StringIO from operator import itemgetter from flask.ext.heroku import Heroku from flask import ( Flask, Response, redirect, request, render_template, send_from_directory, url_for ) import youtube app = Flask(__name__) class AuthE...
{ "content_hash": "175739787cf0751fe7c51fc2e58f567b", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 77, "avg_line_length": 21.041666666666668, "alnum_prop": 0.5889674681753889, "repo_name": "Mause/yt_sub", "id": "e81c4f203036cff46844a0382bc3629cb23dac67", "size": "3583",...
import random, unittest, collections from treedict import TreeDict, getTree import treedict from copy import deepcopy, copy from hashlib import md5 import random from common import * class TestBadValues(unittest.TestCase): def test_KeyNotEmpty(self): p = sample_tree() self.assertRaises(NameError...
{ "content_hash": "788a15af05d76c98c8b56ee5066636dd", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 72, "avg_line_length": 28.6375, "alnum_prop": 0.633347883020515, "repo_name": "hoytak/treedict", "id": "2c6bf031fcb6ec73a0745e00f7f6abd7922484b4", "size": "3840", "binary...
"""A wrapper around ggplot2 ( http://had.co.nz/ggplot2/ ) and plotnine (https://plotnine.readthedocs.io/en/stable/index.html ) Takes a pandas.DataFrame object, then add layers with the various add_xyz functions (e.g. add_scatter). Referr to the ggplot/plotnine documentation about the layers (geoms), and simply repla...
{ "content_hash": "8d70ef641fa9ff5c144735d7f52b6b05", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 96, "avg_line_length": 46.55263157894737, "alnum_prop": 0.7377049180327869, "repo_name": "TyberiusPrime/pyggplot", "id": "3bfe10706172220fc2b3b93f4b334eec437e17b1", "size":...
import xlrd def open_db(filename): try: data = xlrd.open_workbook(filename) return data except Exception, e: print str(e) def read_excel(filename): data = open_db(filename) table = data.sheet_by_index(0) # rows nrows = table.nrows # columns ncols = table.ncols...
{ "content_hash": "bad8f5992166c77f7a7347327f81ba18", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 48, "avg_line_length": 20.96153846153846, "alnum_prop": 0.5798165137614679, "repo_name": "ClarkYan/msc-thesis", "id": "8d27404f44d313f22aaaf726c949b428904d1862", "size": "6...
import random import numpy as np import math class gpsarsa: def __init__(self, actions, nstates=0, epsilon=0.1, gamma=0.9, sigma=5, p=4): self.mean_q = {} self.cov_q = {} self.states_vectors = {} # states vector representation self.action_vectors = {} # actions vector...
{ "content_hash": "b51b6097f7079660cc15776a11d982aa", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 81, "avg_line_length": 30.81761006289308, "alnum_prop": 0.5424489795918367, "repo_name": "hkhpub/cliff-walking", "id": "bc1408c8971cc1067c68093f041405a99a8785e3", "size": ...
#exclusions = ('__weakref__', # special-members #'__doc__', '__module__', '__dict__', # undoc-members #) #exclude = name in exclusions #inclusions = ('_src') #include = name in inclusions #if include: #print app, what, name, obj, skip, options #...
{ "content_hash": "0a1b4d44f1288eb3f222d68bdf7ff8bd", "timestamp": "", "source": "github", "line_count": 406, "max_line_length": 98, "avg_line_length": 31.773399014778324, "alnum_prop": 0.663953488372093, "repo_name": "fivejjs/GPy", "id": "91a6c75b164a628847bec427e1ced7b73283d392", "size": "13613", ...
""" Parse FindBugs -xml:withMessages output. FindBugs XML output is pretty straightforward: a sequence of <BugInstance> tags, with type and rank (severity) attributes. Each has one or more <SourceLine> tags; if more, one will have an attribute of primary="true". However, it groups nearby bugs of the same type via an...
{ "content_hash": "f0e30ad382a0cfd3e1a75b93a23d4c64", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 147, "avg_line_length": 39.25, "alnum_prop": 0.6801637852593266, "repo_name": "jkleint/blamethrower", "id": "8b1ac351b23d1b27de0225d4636ca667404beb26", "size": "2302", "b...
import numpy as np from . import Graph # prevent circular import in Python < 3.5 class FullConnected(Graph): r"""Fully connected graph. All weights are set to 1. There is no self-connections. Parameters ---------- N : int Number of vertices (default = 10) Examples -------- ...
{ "content_hash": "d5faf62718e51089ff061dbaae36afaf", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 75, "avg_line_length": 24.625, "alnum_prop": 0.5609137055837563, "repo_name": "epfl-lts2/pygsp", "id": "0f4c1deee0abcc9a06e09a784b417af3ca0d8c1e", "size": "813", "binary"...
from setuptools import setup, Extension long_description = open('README.rst').read() setup(name="jellyfish", version="0.1.2", platforms=["any"], description=("a library for doing approximate and " "phonetic matching of strings."), url="http://github.com/sunlightlabs/jellyfis...
{ "content_hash": "1527bab147a81575c4c1868665caff07", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 76, "avg_line_length": 48.69565217391305, "alnum_prop": 0.49464285714285716, "repo_name": "sdiehl/pycraig", "id": "a966cc92b4fb5662e38a840eaf409208e6baa92a", "size": "1142"...
from django.conf.urls import url, include from rest_framework import routers from inventory.api.views import HostViewSet, InterfaceViewSet, IPAddressViewSet from api.views import InventoryRootView router = routers.DefaultRouter() # rewrite default view name router.root_view_name = 'inventory-root' router.APIRootVie...
{ "content_hash": "9a1f1beaae49d74c5b19535b5318077d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 79, "avg_line_length": 29.272727272727273, "alnum_prop": 0.7919254658385093, "repo_name": "H0neyBadger/cmdb", "id": "6eb373c4cc6cdea7352d3b9ae7ba7d5b500267c8", "size": "644...
"""Basic tests for basic deterministic model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensor2tensor.models.video import basic_recurrent from tensor2tensor.models.video import tests_utils import tensorflow as tf class NextFrameTest(tests_u...
{ "content_hash": "8fe6f210b775ffe8809f6fe31e37cd12", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 54, "avg_line_length": 26, "alnum_prop": 0.7357859531772575, "repo_name": "mlperf/training_results_v0.5", "id": "d9deb5c987af37f19de9984ac8c19b6417335e58", "size": "1204", ...
from novaclient.v1_1 import aggregates from novaclient.tests import utils from novaclient.tests.v1_1 import fakes cs = fakes.FakeClient() class AggregatesTest(utils.TestCase): def test_list_aggregates(self): result = cs.aggregates.list() cs.assert_called('GET', '/os-aggregates') for agg...
{ "content_hash": "76979e963d48162564dfba29e474cfd1", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 76, "avg_line_length": 39.26829268292683, "alnum_prop": 0.6459627329192547, "repo_name": "citrix-openstack-build/python-novaclient", "id": "bbd7f2c10e0316d3eab81005808662e41...
""" Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import itertools import os from lib.core.common import checkFile from lib.core.common import parseXmlFile from lib.core.data import kb from lib.core.data import paths from lib.parse.handler import ...
{ "content_hash": "f2d2f0834ff74190032a27db23841c7d", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 114, "avg_line_length": 40.80952380952381, "alnum_prop": 0.6371061843640606, "repo_name": "JeyZeta/Dangerous", "id": "7384b14b9b6869b536aa0eb2038f624163f3065d", "size": "17...
"""Tests for perfkitbenchmarker.vm_util.""" import os import psutil import subprocess import threading import time import unittest import mock from perfkitbenchmarker import vm_util class ShouldRunOnInternalIpAddressTestCase(unittest.TestCase): def setUp(self): p = mock.patch(vm_util.__name__ + '.FLAGS') ...
{ "content_hash": "d0fae4c398d56c581045dc3e3a8756b9", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 77, "avg_line_length": 30.261194029850746, "alnum_prop": 0.7055487053020961, "repo_name": "meteorfox/PerfKitBenchmarker", "id": "1cdc9734be14feb5327ff720ac940e9573290de4", ...
"""Test for the wordcount example.""" # pytype: skip-file import collections import logging import re import tempfile import unittest from apache_beam.examples import wordcount_dataframe from apache_beam.testing.util import open_shards class WordCountTest(unittest.TestCase): SAMPLE_TEXT = """ a a b a b c ...
{ "content_hash": "0d3866e0e9990bfb3482ce9827cd250d", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 70, "avg_line_length": 27.2, "alnum_prop": 0.6551470588235294, "repo_name": "axbaretto/beam", "id": "aa2fcc568012acc0758803bfc63c81fd5708df9a", "size": "2169", "binary": ...
from ctypes import POINTER from ctypes import c_void_p from ctypes import cdll import ctypes.util import platform # LLVM_VERSION: sync with PACKAGE_VERSION in CMakeLists.txt # but leave out the 'svn' suffix. LLVM_VERSION = '10.0.0' __all__ = [ 'c_object_p', 'get_library', ] c_object_p = POINTE...
{ "content_hash": "49d1fbb5c435aad97638d8e9ecda248b", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 86, "avg_line_length": 30.128205128205128, "alnum_prop": 0.6204255319148936, "repo_name": "epiqc/ScaffCC", "id": "9c6c6d433458c1f4223ed76c37037c64df435331", "size": "3890"...
from a10sdk.common.A10BaseClass import A10BaseClass class SynCookie(A10BaseClass): """Class Description:: Global Syn-Cookie Protection. Class syn-cookie supports CRUD Operations and inherits from `common/A10BaseClass`. This class is the `"PARENT"` class for this module.` :param on_threshold...
{ "content_hash": "3a67fb9be1f2ed607458a3195677307b", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 231, "avg_line_length": 41, "alnum_prop": 0.6329565734681737, "repo_name": "amwelch/a10sdk-python", "id": "2c3c49da0e5b211ff603ebb6f112b7b182c2cbb2", "size": "1681", "bin...
import pytest from commitizen import BaseCommitizen, defaults, factory from commitizen.config import BaseConfig from commitizen.exceptions import NoCommitizenFoundException def test_factory(): config = BaseConfig() config.settings.update({"name": defaults.DEFAULT_SETTINGS["name"]}) r = factory.commiter_f...
{ "content_hash": "30a4532f66ad37a4454cc008d90f43d0", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 76, "avg_line_length": 31.428571428571427, "alnum_prop": 0.75, "repo_name": "Woile/commitizen", "id": "5fbd2deebbbc8e2beede3ac3caa8072ed0bbe403", "size": "660", "binary":...
""" Does all steps required for initialising the application Fetches list of cnx 50 stocks and populates the redis cache """ import sys import requests import redis companies = [] sectors = [] try: redis_obj = redis.Redis(host='10.193.124.239', port=6379, db=0, password=None) except Exception, e: pr...
{ "content_hash": "8220e10e52bd47b53dd9b12b52f1315f", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 93, "avg_line_length": 40.726027397260275, "alnum_prop": 0.6115035317860746, "repo_name": "rajaram1990/Nifty50Cards", "id": "37d4d74f0a548a4d62b8857e59b5d292b4776bae", "siz...
from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'MyProfile.area' db.alter_column(u'accounts_myprofile', 'area', self.gf('django...
{ "content_hash": "b098c6bf3ffdb4623c3b789795815805", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 187, "avg_line_length": 65.36082474226804, "alnum_prop": 0.5884858044164037, "repo_name": "joeyjy/ayi-django", "id": "af2b9115e8aaaf996f50b08660dd5ff1dad1d36e", "size": "63...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from collections import defaultdict from pants.backend.jvm.targets.java_library import JavaLibrary from pants.backend.jvm.tasks.classpath_products import Cl...
{ "content_hash": "c7c00d7f4f9b125c4b3178a099cc95a9", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 120, "avg_line_length": 42.81553398058252, "alnum_prop": 0.6471655328798186, "repo_name": "qma/pants", "id": "b13f9986dffc3fec22f84d109d0cd097d1e7dc36", "size": "4557", ...
"""The tests for reproduction of state.""" import pytest from homeassistant.components.media_player import ( ATTR_INPUT_SOURCE, ATTR_MEDIA_CONTENT_ID, ATTR_MEDIA_CONTENT_TYPE, ATTR_MEDIA_VOLUME_LEVEL, ATTR_MEDIA_VOLUME_MUTED, ATTR_SOUND_MODE, DOMAIN, SERVICE_PLAY_MEDIA, SERVICE_SEL...
{ "content_hash": "8e97587acb11d16187cf10dd825af88d", "timestamp": "", "source": "github", "line_count": 294, "max_line_length": 88, "avg_line_length": 29.316326530612244, "alnum_prop": 0.6190973430792436, "repo_name": "mezz64/home-assistant", "id": "cc30058d4b1e6945581c32f70e7b8ee42924ad54", "size"...
from wheelcms_axle.registries.registry import Registry from UserDict import IterableUserDict class WorkflowRegistry(IterableUserDict): _default = None def get_default(self): return self._default def set_default(self, workflow): self._default = workflow def register(self, spoke, workf...
{ "content_hash": "9077d544787dc14e47620f20ccee69ad", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 79, "avg_line_length": 28.043478260869566, "alnum_prop": 0.662015503875969, "repo_name": "wheelcms/wheelcms_axle", "id": "f73b99ebfc78639201ae1f78b9db64e1dc91e483", "size":...
"""while_v2 and gradient. This is a version of while_loop that emits a single While op, as well as the gradient function for While ops produced by while_loop. This will eventually replace the current tf.while_loop implementation once it reaches feature and performance parity. """ from __future__ import absolute_import...
{ "content_hash": "7591d5e4f42c77d085a7fa597d3d6fc6", "timestamp": "", "source": "github", "line_count": 1216, "max_line_length": 110, "avg_line_length": 43.0296052631579, "alnum_prop": 0.689377723415641, "repo_name": "arborh/tensorflow", "id": "a4ef39038a1c36d4b896ef39d18c23e74313f6d1", "size": "53...
import os.path, os import ujson as json from flask import Flask, make_response, url_for, redirect, render_template, request, send_from_directory from flask_mail import Mail from flask_user import current_user, UserManager, SQLAlchemyAdapter import pytz #import yaml #import redis #import requests from classes import b...
{ "content_hash": "d02a90f48f03318d8535d6b1c19da84b", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 104, "avg_line_length": 30.87878787878788, "alnum_prop": 0.6833496892378148, "repo_name": "NetBUG/classintouch", "id": "e88a238800c11499a35e32c4b7b1c58963b62553", "size": "...
def _status(device, **kwarg): #print device.full() pass def _config(device, **kwarg): #print device.full() pass # function variables holding current callbacks status = _status config = _config def register_status_cb(callback): global status if callback: def newstatus(device, **kwar...
{ "content_hash": "6509ecb2e1b0cde2375891af89b7b590", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 46, "avg_line_length": 18.047619047619047, "alnum_prop": 0.5435356200527705, "repo_name": "UniPiTechnology/evok", "id": "cbf86b7a9afd70e56870243c65f127a7b83c3ecd", "size": ...
from typing import Callable from django.http import HttpRequest, HttpResponse from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from confirmation.models import Confirmation, ConfirmationKeyError, get_object_from_key from zerver.actions.user_settings import do_change_user_setting...
{ "content_hash": "d3f55381ab4b9d03398fcf7b2a42cf1a", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 100, "avg_line_length": 39.265822784810126, "alnum_prop": 0.7537072856221793, "repo_name": "zulip/zulip", "id": "b071bdc90d9f746343986b5afcce9dde6323925c", "size": "3102", ...
from __future__ import unicode_literals import re from django.utils.translation import ugettext_lazy as _ from rapidsms.contrib.handlers.handlers.keyword import KeywordHandler class AppointmentHandler(KeywordHandler): "Base keyword handler for the APPT prefix." prefix = 'APPT' form = None success_...
{ "content_hash": "b2f158730b25b2f5bc81f1955592068d", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 90, "avg_line_length": 32.40384615384615, "alnum_prop": 0.5750741839762611, "repo_name": "caktus/rapidsms-appointments", "id": "4b0b4da35c5fb96591c180499040700125245fc5", "...
from six import moves from tempest.api.image import base from tempest.common.utils import data_utils from tempest import config from tempest import test CONF = config.CONF class CreateRegisterImagesTest(base.BaseV1ImageTest): """Here we test the registration and creation of images.""" @test.idempotent_id('...
{ "content_hash": "20ecef333f2a1445a1e5c732b35c7c98", "timestamp": "", "source": "github", "line_count": 265, "max_line_length": 77, "avg_line_length": 44.64528301886792, "alnum_prop": 0.5741695545600541, "repo_name": "tudorvio/tempest", "id": "7739d160295809782d98be73238b1203ff9929fa", "size": "124...
from datetime import datetime import threading from netmiko import ConnectHandler from net_system.models import NetworkDevice, Credentials import django def show_version(n_device): creds = n_device.credentials remote_conn = ConnectHandler(device_type=n_device.device_type, ip=n_device.ip_address, ...
{ "content_hash": "c85607592e2b0823890e0248307364f4", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 90, "avg_line_length": 27.511627906976745, "alnum_prop": 0.6398985629754861, "repo_name": "linkdebian/pynet_course", "id": "6493744e9c56d2a4fdd1dec6126225a81140085f", "size...
from django.apps import AppConfig class StoryConfig(AppConfig): name = 'story'
{ "content_hash": "42dffef5457d900685e667bdb56aa5fc", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 33, "avg_line_length": 17, "alnum_prop": 0.7411764705882353, "repo_name": "DjangoGirls/djangogirls", "id": "d8c9522ac024b4fd44de1d15938e7c8f88c27d92", "size": "85", "binar...
from rest_framework import serializers class BaseModelSerializer(serializers.ModelSerializer): id = serializers.SerializerMethodField() def get_id(self, instance): return str(instance.id)
{ "content_hash": "6fad90d307025b684512231f97d9327d", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 55, "avg_line_length": 29.428571428571427, "alnum_prop": 0.7621359223300971, "repo_name": "mnazim/django-rest-kickstart", "id": "1f872de6d3ae01e67bad9a10e71ee192fe7881ca", "...
from agents import AGENTS import random class CustomUserAgentMiddleware(object): def process_request(self, request, spider): agent = random.choice(AGENTS) request.headers['User-Agent'] = agent
{ "content_hash": "97f6f31481cd7d505985f90a0e7c5aa7", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 47, "avg_line_length": 26.875, "alnum_prop": 0.7209302325581395, "repo_name": "carpedm20/hali", "id": "2773ab6df4c63cd566aec4639e3b6a34b96f8f95", "size": "215", "binary": ...
__author__ = 'rogerjiang' ''' Purposes: 1. Visualization of training data 2. Evaluation of training data augmentation ''' ''' Notes on the data files: train_wkt_v4.csv: training labels with ImageId, ClassType, MultipolygonWKT train_geoson_v3 (similar to train_wkt_v4.csv): training labels with ImageId (folder name)...
{ "content_hash": "25f307630c714e3958018c40860b2a70", "timestamp": "", "source": "github", "line_count": 942, "max_line_length": 83, "avg_line_length": 30.82908704883227, "alnum_prop": 0.5682999896697772, "repo_name": "jiangxu87/dstl_unet", "id": "e9350ea2a6aba6e13184107a15139d90ca535338", "size": "...
class CookeryWrongMatch(Exception): pass class CookeryWrongNumberOfArguments(Exception): pass class CookeryCannotImportModule(Exception): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)
{ "content_hash": "fa5200a212eab9130f24c13bdea08789", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 47, "avg_line_length": 21.181818181818183, "alnum_prop": 0.6909871244635193, "repo_name": "mikolajb/cookery", "id": "6b51d55982125f998a807a91dc32844b5d132e3b", "size": "233...