text
stringlengths
4
1.02M
meta
dict
import optparse from melange import ipv4 from melange import mac from melange import version from melange.common import config from melange.db import db_api from melange.db.sqlalchemy import session def upgrade(migrate_engine): _db_connect() interface = session.get_session().execute( "SELECT COUNT(1...
{ "content_hash": "ba1a957fc2fdf39d9cc630288ae2d679", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 79, "avg_line_length": 35.982142857142854, "alnum_prop": 0.5885856079404467, "repo_name": "openstack-attic/melange", "id": "069318d01764e06615fc841822d92af918e00fe9", "siz...
from django.urls import path urlpatterns = [ path("posts/(<int:pk>/", lambda **kwargs: "", name="post-detail"), path( "hasprimaryslug/<int:pk>/", lambda **kwargs: "", name="hasprimaryslug-detail", ), path( "hasprimaryuuid/<int:pk>/", lambda **kwargs: "", ...
{ "content_hash": "f9f3b7d1eaa11b7639beed1ab226c3e0", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 70, "avg_line_length": 22.5, "alnum_prop": 0.5361111111111111, "repo_name": "PetrDlouhy/django-admin-smoke-tests", "id": "fe48d911c1627fb49fa9a5fd29dca9f55bf192b7", "size":...
"""Docker related utilities.""" import logging import os import sys import tarfile import tempfile import time import uuid import warnings from . import gcp from . import machine_config import docker from google.cloud import storage from google.cloud.exceptions import NotFound from googleapiclient import discovery fr...
{ "content_hash": "0bbdc92779d51b528d45a68ee6bfb8dd", "timestamp": "", "source": "github", "line_count": 555, "max_line_length": 145, "avg_line_length": 39.174774774774775, "alnum_prop": 0.5800754300432343, "repo_name": "tensorflow/cloud", "id": "55252d53cf24eaee1537cb57f42ace17d5b49d85", "size": "2...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Scouting2016', '0032_auto_20160421_2234'), ] operations = [ migrations.RenameModel( old_name='Compitition', new_name='Compet...
{ "content_hash": "e8f273391325d285126098e8e5c2e253", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 52, "avg_line_length": 20.294117647058822, "alnum_prop": 0.6057971014492753, "repo_name": "ArcticWarriors/scouting-app-2016", "id": "29f3f74226a1c3a0dc973f6ac018cdeaa6a586cf"...
from pythonds.graphs import Graph, Vertex from pythonds.basic import Queue def bfs(g,start): start.setDistance(0) start.setPred(None) vertQueue = Queue() vertQueue.enqueue(start) while (vertQueue.size() > 0): currentVert = vertQueue.dequeue() for nbr in currentVert.getConnections(): if (nb...
{ "content_hash": "61bca45ee130a0a71bac65fdc0b24066", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 85, "avg_line_length": 37.714285714285715, "alnum_prop": 0.6742424242424242, "repo_name": "robin1885/algorithms-exercises-using-python", "id": "7aa686dbe67e0da465e2e61a23b612...
import gevent from socketio.namespace import BaseNamespace from socketio.mixins import BroadcastMixin from socketio import socketio_manage from flask import request, Response from backend import app import random import string import time import json import bleach roundlength = 10 # Load word file # Not the best pl...
{ "content_hash": "5a7d20e1f78c69ec0a8bbc16539fe0a7", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 90, "avg_line_length": 27.70940170940171, "alnum_prop": 0.6172115977791487, "repo_name": "thumphries/untitled", "id": "b0ded8144c0bf79e2978dd75908b2d413653d7a2", "size": "...
import os import sys if __name__ == "__main__": os.environ[ 'DJANGO_SETTINGS_MODULE'] = 'lino_book.projects.homeworkschool.settings.demo' from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
{ "content_hash": "a608f5fbdad8e78d5f759f3ae0b6e496", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 85, "avg_line_length": 36.42857142857143, "alnum_prop": 0.7019607843137254, "repo_name": "lino-framework/book", "id": "fad7177bfbeab948b74354869b39def237457a76", "size": "27...
from helper import MockXPI from validator.chromemanifest import ChromeManifest import validator.testcases.content as content from validator.errorbundler import ErrorBundle def test_marking_overlays(): """ Mark an overlay, then test that it marks the scripts within the overlay. """ err = ErrorBundle(...
{ "content_hash": "e4fa4855ddd1241c6a20b188bd96946b", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 78, "avg_line_length": 30.21641791044776, "alnum_prop": 0.6265744628303285, "repo_name": "wagnerand/amo-validator", "id": "d7d3f6d44b54c6d5d16891feea70741e9e8dd698", "size...
import os import csv from ooni.settings import config def load_input(file_input, file_output): fw = open(file_output, "w+") with open(file_input) as f: csvreader = csv.reader(f) csvreader.next() for row in csvreader: fw.write("%s\n" % row[0]) fw.close() def generate_c...
{ "content_hash": "20a9ebe7fa221c55540885e8f4efdeba", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 76, "avg_line_length": 28.442307692307693, "alnum_prop": 0.5422582826233941, "repo_name": "Karthikeyan-kkk/ooni-probe", "id": "0a56ec09b3c2631437ec7359a5444dc8a2105aba", "s...
from migrate.versioning import api from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) api.downgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, v - 1) v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIG...
{ "content_hash": "e62c37b4e1bbbb7c9140bbfc1efa07c6", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 70, "avg_line_length": 41.888888888888886, "alnum_prop": 0.7984084880636605, "repo_name": "samcheck/PyMedia", "id": "fb85fb6c9caf12d33f0e2dbbb36f7875463730bd", "size": "396"...
from __future__ import unicode_literals from django.db import models from django.utils import timezone class SiteDetail(models.Model): label = models.CharField(max_length=200) key = models.CharField(max_length=200) value = models.CharField(max_length=400) pub_date = models.DateTimeField(default=timez...
{ "content_hash": "04e4b8fa9166136e975a5a8c945c925d", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 57, "avg_line_length": 26, "alnum_prop": 0.6990950226244343, "repo_name": "501code/Fletcher-Street-Urban-Riding-Club", "id": "043104272dfef221fb04296ada70530f3bc513cb", "si...
from xml.dom import minidom from django.contrib.syndication import views from django.core.exceptions import ImproperlyConfigured from django.test import TestCase from django.utils import tzinfo from django.utils.feedgenerator import rfc2822_date, rfc3339_date from models import Entry class FeedTestCase(TestCase): ...
{ "content_hash": "8086db4ae9659f52a66e1dad0fc9d59e", "timestamp": "", "source": "github", "line_count": 305, "max_line_length": 151, "avg_line_length": 40.94754098360656, "alnum_prop": 0.6004483945872368, "repo_name": "disqus/django-old", "id": "66432981dd361f4908cb0b5cff928cd4e856f697", "size": "1...
import logging import tornado.escape import tornado.gen import tornado.httpclient import tornado.ioloop import tornado.locale import tornado.web import uimodules ENTRIES = [ { 'name': 'one', 'per': 'm' }, { 'name': 'two', 'per': 'm' }, { 'name': 'three', ...
{ "content_hash": "a6cd12dc115923b275e386aff28916ce", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 77, "avg_line_length": 20.073529411764707, "alnum_prop": 0.5882783882783883, "repo_name": "tao12345666333/Talk-Is-Cheap", "id": "1a0b91a8b881a3a061e15a7a7f91cb3be1fe93a6", ...
from __future__ import print_function # $example on:init_session$ from pyspark.sql import SparkSession # $example off:init_session$ # $example on:schema_inferring$ from pyspark.sql import Row # $example off:schema_inferring$ # $example on:programmatic_schema$ # Import data types from pyspark.sql.types import * # $ex...
{ "content_hash": "9248980181aad39f0b2b5e846d47f9f7", "timestamp": "", "source": "github", "line_count": 202, "max_line_length": 97, "avg_line_length": 27.663366336633665, "alnum_prop": 0.5706871868289191, "repo_name": "alec-heif/MIT-Thesis", "id": "ebcf66995b4777bd696eb471d6003c82cf663932", "size":...
import mock from rally.plugins.openstack.scenarios.quotas import quotas from tests.unit import test class QuotasTestCase(test.ScenarioTestCase): def setUp(self): super(QuotasTestCase, self).setUp() self.context.update({ "user": { "tenant_id": "fake", "...
{ "content_hash": "fc745b4ab75c5dc69ba839cefff40aeb", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 79, "avg_line_length": 40.09090909090909, "alnum_prop": 0.6149659863945578, "repo_name": "eayunstack/rally", "id": "ac91619f63e93be1621dd0676f0cd66e176ac379", "size": "2833...
"""Common cgroups management routines. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import io import logging import os from treadmill import fs from treadmill.fs import linux as fs_linux #: Base directory wh...
{ "content_hash": "67ca4529a5fd22a1fa42a1d41d585865", "timestamp": "", "source": "github", "line_count": 224, "max_line_length": 79, "avg_line_length": 26.700892857142858, "alnum_prop": 0.6326701220531684, "repo_name": "ceache/treadmill", "id": "078501ad68ff4eeafc7889f044308e6c71e94f42", "size": "59...
"""Tests for factorization_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin import tensorflow as tf INPUT_MATRIX = np.array( [[0.1, 0.0, 0.2, 0....
{ "content_hash": "d7b7074c3bef952b4299842caff19bab", "timestamp": "", "source": "github", "line_count": 505, "max_line_length": 80, "avg_line_length": 41.90891089108911, "alnum_prop": 0.6038083538083538, "repo_name": "mrry/tensorflow", "id": "6a8a52f96da9a1ac76a7ef0827e846983d006384", "size": "2185...
import copy import fixtures import mock from oslo_config import cfg from oslo_utils import uuidutils from webob import exc from neutron.api.v2 import attributes as attr from neutron import context from neutron.db import api as dbapi from neutron.db import flavors_db from neutron.db import servicetype_db from neutron....
{ "content_hash": "59bded3da2c771a663b14c0172fd9c04", "timestamp": "", "source": "github", "line_count": 704, "max_line_length": 79, "avg_line_length": 43.34943181818182, "alnum_prop": 0.516383773510715, "repo_name": "chitr/neutron", "id": "bcc1eec8b604f7e776f6eb7c3a38f5509a86c9bc", "size": "31096",...
import base64 import os from Plugin import PluginManager from Crypt import CryptBitcoin from lib.pybitcointools import bitcoin as btctools import CryptMessage @PluginManager.registerTo("UiWebsocket") class UiWebsocketPlugin(object): def encrypt(self, text, publickey): encrypted = CryptMessage.encrypt(te...
{ "content_hash": "4c77d10a94201850714f9d26afac7f09", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 113, "avg_line_length": 38.52348993288591, "alnum_prop": 0.6179442508710802, "repo_name": "kustomzone/Fuzium", "id": "0302c83ac61e830de9b7979e9b21b5fc44abd1d6", "size": "5...
"""Scheduling learning rate.""" import logging from math import cos, pi class LRScheduler(object): """Base class of a learning rate scheduler. A scheduler returns a new learning rate based on the number of updates that have been performed. Parameters ---------- base_lr : float, optional ...
{ "content_hash": "b835162b7348ed902ff8030462a6578c", "timestamp": "", "source": "github", "line_count": 264, "max_line_length": 98, "avg_line_length": 40.74242424242424, "alnum_prop": 0.6023614726664187, "repo_name": "mlperf/training_results_v0.6", "id": "436085620a2e941404da710f60b30f0f1313861e", ...
#!/usr/bin/env python3 import traceback import better_exceptions import threading import SpoonModes import numpy as np import random MODES = SpoonModes.SpoonSliceModes() LM = SpoonModes.SpoonLoopModes() from spoon_logging import D, L, W, E from pythonosc import dispatcher from pythonosc import osc_server def set...
{ "content_hash": "f90a0870362559614d4fa13350cfda61", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 102, "avg_line_length": 34.824742268041234, "alnum_prop": 0.6035129267811328, "repo_name": "zarquin/SpoonFight", "id": "9021d5635269f57f4660eadd673f505ffef9cff6", "size": ...
import encoder import unittest import visual_metrics def LinearVector(slope=0.0, offset=0.0): """A point pair set that has points in a straight line.""" return [[float(i), float(i*slope)+offset] for i in (10, 20, 30, 40)] class FakeCodec(object): def __init__(self): self.name = 'mock' self.option_set ...
{ "content_hash": "366a3a51b3f75c692df47f25f20ef4c8", "timestamp": "", "source": "github", "line_count": 139, "max_line_length": 80, "avg_line_length": 35.28776978417266, "alnum_prop": 0.6389398572884811, "repo_name": "alvestrand/old-compare-codecs", "id": "65af54bdbb17dd5c8d27eee9862933c18d3a3fd1", ...
import json import socket import datetime import argparse import struct import random import time import weakref from binascii import hexlify, unhexlify from cryptokit import target_from_diff, uint256_from_str from gevent import sleep, with_timeout from gevent.queue import Queue from gevent.pool import Pool from geven...
{ "content_hash": "c958855bdb49e83a6d1bd2bacb21ef33", "timestamp": "", "source": "github", "line_count": 750, "max_line_length": 113, "avg_line_length": 40.861333333333334, "alnum_prop": 0.5414409710892123, "repo_name": "sigwo/powerpool", "id": "22c06943fe89526c3cd23f00b41b5e9ac70e993a", "size": "30...
from hy.models.expression import HyExpression from hy.models.integer import HyInteger from hy.models.float import HyFloat from hy.models.complex import HyComplex from hy.models.symbol import HySymbol from hy.models.string import HyString from hy.models.dict import HyDict from hy.models.list import HyList from hy.models...
{ "content_hash": "c1e6a91bc2628301e40f5eba95b4b049", "timestamp": "", "source": "github", "line_count": 327, "max_line_length": 76, "avg_line_length": 28.941896024464832, "alnum_prop": 0.595519864750634, "repo_name": "zackmdavis/hy", "id": "07429d40f5b235cb051a266d6458be3d85186f37", "size": "10653"...
import sys from robot.errors import DataError from robot import utils from .model import LibraryDoc, KeywordDoc class JavaDocBuilder(object): def build(self, path): doc = ClassDoc(path) libdoc = LibraryDoc(name=doc.qualifiedName(), doc=self._get_doc(doc), ...
{ "content_hash": "d1861335adfddae440409f2e32c94c05", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 81, "avg_line_length": 37.078947368421055, "alnum_prop": 0.5585521646557843, "repo_name": "jaloren/robotframework", "id": "39e119bec243dbb66778795f17e9c05d504c7f04", "size...
from .compiler import DjangoScssCompiler # NOQA
{ "content_hash": "5070ba825d1bfe5814fcae06b08093d4", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 48, "avg_line_length": 49, "alnum_prop": 0.8163265306122449, "repo_name": "fusionbox/django-pyscss", "id": "a31ff8548954203fdb3844364108bba02030d907", "size": "49", "binar...
""" Django settings for quokka project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) imp...
{ "content_hash": "6f7bbaef25aade5307aeba8cf37738dd", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 71, "avg_line_length": 22.7625, "alnum_prop": 0.7221306974190006, "repo_name": "OmegaDroid/django_cookbook", "id": "2ae39bd63a164c938d056f22d9ce861c32e74abd", "size": "1821...
import dataclasses import typing @dataclasses.dataclass class A: x: int y: str z: float = 0.0 A(<warning descr="Parameter 'x' unfilled"><warning descr="Parameter 'y' unfilled">)</warning></warning> A(1<warning descr="Parameter 'y' unfilled">)</warning> A(1, "a") A(1, "a", 1.0) A(1, "a", 1.0, <warning desc...
{ "content_hash": "04f12de07a39f4a68a9a834d2666aa6a", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 134, "avg_line_length": 26.339285714285715, "alnum_prop": 0.6620338983050847, "repo_name": "msebire/intellij-community", "id": "1d7caa8c426eb33f4d15f8c83798b0c7876d6b65", ...
PRIMARY_OS = 'Ubuntu-16.04' PRIMARY = '''#!/bin/sh FQDN="{{fqdn}}" export DEBIAN_FRONTEND=noninteractive # locale locale-gen en_US.UTF-8 # hostname hostnamectl set-hostname $FQDN sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts # packages curl -s 'https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7d...
{ "content_hash": "840b7393d30ed984fb609df3dc7b379a", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 135, "avg_line_length": 23.14516129032258, "alnum_prop": 0.6947735191637631, "repo_name": "kizbitz/train", "id": "4d5756a705985fee7a82a0520cb61a63e847e292", "size": "1468",...
from Module import Command import string module_name = "xkcd" def command_xkcdrandomnumber(cmd, bot, args, msg, event): return "[4 // Chosen by fair dice roll. Guaranteed to be random.](http://xkcd.com/221/)" def command_xkcd(cmd, bot, args, msg, event): if len(args) < 1: return "Not enough argument...
{ "content_hash": "6fa4c83d73baff8a1b2ba6c394ba6b22", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 158, "avg_line_length": 34.95454545454545, "alnum_prop": 0.6710013003901171, "repo_name": "Mego/DataBot", "id": "f3ef18f52b01b12f4449ce6a15b67d6d4cff4321", "size": "769", ...
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() from links.views import LinkListView, LinkDetailView urlpatterns = patterns('', # Examples: # url(r'^$', 'linkify.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin...
{ "content_hash": "f3cccf5240eb7f3ba6e65d000944b70f", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 79, "avg_line_length": 29.235294117647058, "alnum_prop": 0.6559356136820925, "repo_name": "promptworks/schematics", "id": "ad8e6e574c502b4d5547f1252fabd9b5c3cc1b72", "size"...
import json import logging import os import shutil import sys import time import urllib2 import warnings import re # Dropping a table inexplicably produces a warning despite # the 'IF EXISTS' clause. Squelch these warnings. warnings.simplefilter('ignore') import MySQLdb import environment import utils from mysql_flav...
{ "content_hash": "d5445cadb6506baab4608af37f10fe31", "timestamp": "", "source": "github", "line_count": 706, "max_line_length": 79, "avg_line_length": 34.09065155807365, "alnum_prop": 0.5991773308957953, "repo_name": "tjyang/vitess", "id": "555abc8b1880880aacd9d887f3c8c0f43e6e75c4", "size": "24068"...
import shutil import csv import json import logging import os import sys import time from pyvirtualdisplay import Display from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary import foctor_core.foctor_core as fc class HeadlessBrowser: def __init__(self): sel...
{ "content_hash": "d8efe547f8d7611f66b7bde873344347", "timestamp": "", "source": "github", "line_count": 329, "max_line_length": 118, "avg_line_length": 38.07598784194529, "alnum_prop": 0.5364412868204678, "repo_name": "lianke123321/centinel", "id": "695b8e1a7b844ec4a0bdadc5f05a9e4686ddca44", "size"...
r""" =================== Overview of Sampler =================== Sampler class calculates probabilities or quasi-probabilities of bitstrings from quantum circuits. A sampler is initialized with an empty parameter set. The sampler is used to create a :class:`~qiskit.providers.JobV1`, via the :meth:`qiskit.primitives.S...
{ "content_hash": "4e128092cdc65dc627ae8a55f675f4a2", "timestamp": "", "source": "github", "line_count": 384, "max_line_length": 100, "avg_line_length": 35.557291666666664, "alnum_prop": 0.5963087739856452, "repo_name": "QISKit/qiskit-sdk-py", "id": "64854a328077670c50803adc23e0c10329c3f88a", "size"...
from __future__ import print_function from pprint import pformat import distro def pprint(obj): for line in pformat(obj).split('\n'): print(4 * ' ' + line) print('os_release_info:') pprint(distro.os_release_info()) print('lsb_release_info:') pprint(distro.lsb_release_info()) print('distro_release_info...
{ "content_hash": "07becea0ace663e5fa22042eaa8f42fa", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 73, "avg_line_length": 33.63333333333333, "alnum_prop": 0.6987115956392468, "repo_name": "nir0s/distro", "id": "5c5ed9ef6f77e7c1bcb535c8f978fe1295e185e7", "size": "1606", ...
from typing import Iterable, List, Optional, Sequence, Text from django.core.exceptions import ValidationError from django.utils.translation import ugettext as _ from zerver.lib.exceptions import JsonableError from zerver.lib.request import JsonableError from zerver.models import ( Realm, UserProfile, get_...
{ "content_hash": "9cd4943839b9d3b6292c17d03985395a", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 101, "avg_line_length": 35.61068702290076, "alnum_prop": 0.602357984994641, "repo_name": "mahim97/zulip", "id": "58761baeee011075e1c0e608b24a7a80b7f8104d", "size": "4666",...
import pytest from pybind11_tests import ExamplePythonTypes, ConstructorStats, has_optional, has_exp_optional def test_repr(): # In Python 3.3+, repr() accesses __qualname__ assert "ExamplePythonTypes__Meta" in repr(type(ExamplePythonTypes)) assert "ExamplePythonTypes" in repr(ExamplePythonTypes) def t...
{ "content_hash": "b4958b09747957272dfa8b636a443c59", "timestamp": "", "source": "github", "line_count": 502, "max_line_length": 107, "avg_line_length": 33.223107569721115, "alnum_prop": 0.616740616380861, "repo_name": "apple/coremltools", "id": "c5ade90b1349f883824e2064a842756dad79ee1e", "size": "1...
"""Hiitrack models.""" from .funnel import FunnelModel from .property import PropertyModel, PropertyValueModel from .visitor import VisitorModel from .bucket import BucketModel, bucket_check, bucket_create from .user import UserModel, user_authorize from .event import EventModel
{ "content_hash": "cb07f44a3d5067d2bb2bd778f1ed7f08", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 60, "avg_line_length": 35.125, "alnum_prop": 0.8185053380782918, "repo_name": "hiidef/hiitrack-api", "id": "e3e6b1f465b975ff965250d5a2d72c3cfc6ac9f3", "size": "328", "bina...
from django.shortcuts import _get_queryset from django.conf import settings def get_object_or_None(klass, *args, **kwargs): """ Uses get() to return an object or None if the object does not exist. klass may be a Model, Manager, or QuerySet object. All other passed arguments and keyword argum...
{ "content_hash": "10562a2f71de86cf4a0fe725a6fdfe35", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 84, "avg_line_length": 28.09375, "alnum_prop": 0.6562847608453838, "repo_name": "hfercc/mese2014", "id": "e056092caff454e0ea22e27d71ec1c089c05528c", "size": "899", "binar...
"""Tests for yapf.line_joiner.""" import textwrap import unittest from yapf.yapflib import comment_splicer from yapf.yapflib import line_joiner from yapf.yapflib import pytree_unwrapper from yapf.yapflib import pytree_utils from yapf.yapflib import style class LineJoinerTest(unittest.TestCase): @classmethod de...
{ "content_hash": "39f79a4816fcaffad0fdc272d6ee834e", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 103, "avg_line_length": 29.04494382022472, "alnum_prop": 0.6847195357833655, "repo_name": "jamesblunt/yapf", "id": "7cd4f2ccc8eee6140ca78db98fcf01d2d59d8933", "size": "3181...
import json import errno import os.path from flask_restful import abort from .util import is_valid_mac_address class MachineNotFound(Exception): pass class MissingMachineField(Exception): pass class Machine(object): def __init__(self, **kwargs): self.mac = kwargs.pop('mac') self.name...
{ "content_hash": "e8f93abde6e40013fe29bcf1373d348b", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 80, "avg_line_length": 36.47154471544715, "alnum_prop": 0.52652697280428, "repo_name": "neticdk/bodil", "id": "59802c79fcb295d604026db3cc0fdf835c4676e9", "size": "4486", ...
""" A Kik bot that just logs every event that it gets (new message, message read, etc.), and echos back whatever chat messages it receives. """ import logging import sys import kik_unofficial.datatypes.xmpp.chatting as chatting from kik_unofficial.client import KikClient from kik_unofficial.callbacks import KikClient...
{ "content_hash": "1f6fc37833486429cba623e58dc93f1d", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 118, "avg_line_length": 45.2803738317757, "alnum_prop": 0.686687306501548, "repo_name": "tomer8007/kik-bot-api-unofficial", "id": "9099b8dcc93e2ca240eaab20281c493e3f3d70e9",...
"""Reproduce a Select entity state.""" from __future__ import annotations import asyncio from collections.abc import Iterable import logging from typing import Any from homeassistant.components.select.const import ATTR_OPTIONS from homeassistant.const import ATTR_ENTITY_ID from homeassistant.core import Context, Home...
{ "content_hash": "43c05fd15d0df10245f3644f3cda8087", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 81, "avg_line_length": 27.734375, "alnum_prop": 0.643943661971831, "repo_name": "aronsky/home-assistant", "id": "d41fd5dae46674abe053dfde96b4e4cada6de42d", "size": "1775", ...
__author__ = 'treww' import unittest import json import http class CountersTests(unittest.TestCase): def test_get_root_group(self): server = http.client.HTTPConnection("localhost", 8888) server.connect() server.request("GET", "/api/v1/groups") response = server.getresponse() ...
{ "content_hash": "e7c9c2a7fc3dc9d5a17d4287b7bb6ad5", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 99, "avg_line_length": 37.34615384615385, "alnum_prop": 0.6165465156196361, "repo_name": "treww/counters", "id": "4c0ed892ac3dd36a2481242f9475e288cddf9886", "size": "2913",...
from collections import defaultdict import re import time # 3rd party import requests # project from checks import AgentCheck from config import _is_affirmative from util import headers STATS_URL = "/;csv;norefresh" EVENT_TYPE = SOURCE_TYPE_NAME = 'haproxy' class Services(object): BACKEND = 'BACKEND' FRONT...
{ "content_hash": "f475390aaae567eb1d4f48ac0dd47081", "timestamp": "", "source": "github", "line_count": 480, "max_line_length": 232, "avg_line_length": 40.25833333333333, "alnum_prop": 0.5543883253984683, "repo_name": "pmav99/praktoras", "id": "3ef3a4e1ed07aabd6cbe7e543bf204450b2fb1a3", "size": "19...
"""Draw Random Circles. Start and stop with mouse. """ from graphics import * import random, time def main(): win = GraphWin("Random Circles", 300, 300) text = Text(Point(win.getWidth()/2, 30), "Click to start; click to end") text.draw(win) win.getMouse() text.undraw() while win.checkMou...
{ "content_hash": "9937ad83a4860993118f736aaa41791a", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 76, "avg_line_length": 24.741935483870968, "alnum_prop": 0.5619295958279009, "repo_name": "hwheeler01/comp150", "id": "eff9090af1389f467f0dd14a20fafa8f4f264997", "size": "7...
import pandas as pd import sys reload(sys) sys.setdefaultencoding("utf_8") import lev from nltk import word_tokenize import nltk from nltk.corpus import stopwords from nltk.corpus import wordnet as wn import utils import datetime from collections import Counter # Load train train = pd.read_csv('train.csv', encoding='...
{ "content_hash": "d1c0d68d971bc2d36d79859a8c3f43e7", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 115, "avg_line_length": 29.4375, "alnum_prop": 0.6454352441613588, "repo_name": "hulkwork/kaggle-quora", "id": "5b48c3a170c22c2e4f1d8a705bbc5d30c3c78b76", "size": "1884", ...
import sys sys.path.insert(1,"../../") import h2o from tests import pyunit_utils from h2o.estimators.gbm import H2OGradientBoostingEstimator def pub_445_long_request_uri(): mnistTrain = h2o.import_file(path=pyunit_utils.locate("bigdata/laptop/mnist/train.csv.gz")) mnistTest = h2o.import_file(path=pyunit_utils...
{ "content_hash": "d27a710b3acbd6c5252028c1b6eaec93", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 103, "avg_line_length": 34.5, "alnum_prop": 0.7312252964426877, "repo_name": "YzPaul3/h2o-3", "id": "23bbd87e8fbd2b62e110546aeb1b3e03bc2e0312", "size": "759", "binary": f...
"""Rest alarm notifier with trusted authentication.""" from keystoneclient.v3 import client as keystone_client from oslo_config import cfg from six.moves.urllib import parse from aodh.alarm.notifier import rest cfg.CONF.import_opt('http_timeout', 'aodh.service') cfg.CONF.import_group('service_credentials', 'aodh.se...
{ "content_hash": "b3acd828d40060b25ee14919c0cac363", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 78, "avg_line_length": 36.63461538461539, "alnum_prop": 0.6619422572178477, "repo_name": "chungg/aodh", "id": "303fa74fd49fe92dd27338ec0756ca1ef9a12f57", "size": "2480", ...
import numpy as np import re from neon.util.persist import load_obj class ModelDescription(dict): """ Container class for the model serialization dictionary. Provides helper methods for searching and manipulating the dicitonary. Arguments: pdict (dict or str): the configuration dictionary ...
{ "content_hash": "97882ee850374ed88cf22d63bd906949", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 93, "avg_line_length": 31.717557251908396, "alnum_prop": 0.524187725631769, "repo_name": "DougFirErickson/neon", "id": "ee3455afb669e7845223679d370c008fee87a7ad", "size": ...
import warnings from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # ty...
{ "content_hash": "f4d1ff6ae4a0de7f46a247db96e31335", "timestamp": "", "source": "github", "line_count": 264, "max_line_length": 118, "avg_line_length": 44.13636363636363, "alnum_prop": 0.6099382080329557, "repo_name": "googleads/google-ads-python", "id": "dc30f471edaf723b3e2c60ed3edbf74d45e40f68", ...
"""WSGI middleware initialization for the sample-ecommerce application.""" from sample_ecommerce.config.app_cfg import base_config from sample_ecommerce.config.environment import load_environment __all__ = ['make_app'] # Use base_config to setup the necessary PasteDeploy application factory. # make_base_app will w...
{ "content_hash": "2e0185e76b67520071f54811ea76ef53", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 84, "avg_line_length": 34.6578947368421, "alnum_prop": 0.7099468488990129, "repo_name": "gasbasd/tgapp-stroller2", "id": "bf7a38fb60b0e588235051d758cb7109a4d7efc6", "size":...
import getopt import sys from genologics.entities import Process from genologics.lims import Lims HOSTNAME = "" VERSION = "" BASE_URI = "" api = None args = None def get_workflow_stage(lims, workflow_name, stage_name=None): workflows = [w for w in lims.get_workflows() if w.name == workflow_name] if len(wor...
{ "content_hash": "27b034e92d4c0c92cefe83d60bd2aafd", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 194, "avg_line_length": 34.26744186046512, "alnum_prop": 0.6331862911435358, "repo_name": "EdinburghGenomics/clarity_scripts", "id": "14a6375e341126230fef25256fd1ca1ec2cb0f0e...
from __future__ import print_function from bcc import BPF from time import strftime import argparse examples = """examples: ./gethostlatency # time getaddrinfo/gethostbyname[2] calls ./gethostlatency -p 181 # only trace PID 181 """ parser = argparse.ArgumentParser( description="Show latency fo...
{ "content_hash": "d3add2eb8c492ccd7b1eecb708340705", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 78, "avg_line_length": 28.36283185840708, "alnum_prop": 0.6087363494539781, "repo_name": "tuxology/bcc", "id": "0ba5a1eb2c57016039b7e12523612c662c047c4c", "size": "3837", ...
""" Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import re from lib.core.common import Backend from lib.core.common import Format from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.enums imp...
{ "content_hash": "9fa82d11e8e0f6f1cd2fe13cc01456d3", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 178, "avg_line_length": 30.15447154471545, "alnum_prop": 0.5796710703693718, "repo_name": "V11/volcano", "id": "4b56b3122700fe38d3ed89eb9196ef5b2338eb4b", "size": "3732", ...
from __future__ import print_function print("This is deep brother module talking.", __name__) def someBrotherFunction(): pass print("The __module__ of function here is", someBrotherFunction.__module__)
{ "content_hash": "24598c1c9a86b1a0d2a6d7fda5b6a274", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 75, "avg_line_length": 21.1, "alnum_prop": 0.7061611374407583, "repo_name": "kayhayen/Nuitka", "id": "3667ab8fff4d6997bc229e92e22aad7dc2341d7e", "size": "980", "binary": ...
"""Errors used by the Google Ads Client Library.""" class GoogleAdsError(Exception): """Parent class of all errors raised by this library.""" pass class GoogleAdsValueError(GoogleAdsError): """Error indicating that the user input for a function was invalid.""" pass class AdWordsReportError(GoogleAdsError)...
{ "content_hash": "466d82301039949380cfa79143a83e66", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 79, "avg_line_length": 34.755319148936174, "alnum_prop": 0.6755433119069483, "repo_name": "losnikitos/googleads-python-lib", "id": "618bc64e38bd1007ce124757e5b6fe565512f1f4",...
import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): """Remove ReMo bot from voting notifications.""" remobot = orm['profiles.UserProfile'].objects.get(user__username='remobot') rem...
{ "content_hash": "f8efd774762b0119fb352268ca084c2f", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 199, "avg_line_length": 85.33858267716535, "alnum_prop": 0.554714892046503, "repo_name": "chirilo/remo", "id": "e3ac9548b43fc5c236f5e66aaf967c34c0a009dc", "size": "10862",...
import pytest from helpers import for_each_database, for_one_database, get_credentials, open_cursor from query_fixture import query_fixture from turbodbc import DatabaseError, Error, InterfaceError, connect @for_one_database def test_new_cursor_properties(dsn, configuration): connection = connect(dsn, **get_cred...
{ "content_hash": "6162540e1bd81792c3d5a2e429534b46", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 106, "avg_line_length": 33.7682119205298, "alnum_prop": 0.6809178270249069, "repo_name": "blue-yonder/turbodbc", "id": "c9e94ba94753da688d203c339f4e05966d68aa18", "size": ...
import sys reload(sys) sys.setdefaultencoding("utf-8") def spiderDefaultSave(item): print("saving item: " + str(item)) for key, value in item.getDict().items(): print("default save for item with field: " + key) print("and value: " + str(value)) def customSave(item): print("Custom save f...
{ "content_hash": "f0fef9c3122695a28b0fb587a9382244", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 57, "avg_line_length": 22.933333333333334, "alnum_prop": 0.6395348837209303, "repo_name": "Zincr0/pyscrap", "id": "85dc215a64de175fe245e5536947a5c0bc8fd6e1", "size": "950",...
from salt.modules.inspectlib.fsdb import CsvDBEntity class IgnoredDir(CsvDBEntity): """ Ignored directories """ _TABLE = "inspector_ignored" def __init__(self): self.path = "" class AllowedDir(CsvDBEntity): """ Allowed directories """ _TABLE = "inspector_allowed" ...
{ "content_hash": "8698ce264288800bc25e915fa104a9cc", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 52, "avg_line_length": 16.205882352941178, "alnum_prop": 0.5163339382940109, "repo_name": "saltstack/salt", "id": "319204bbf3ae621345889d8e3994369fc564d900", "size": "1674"...
""" @package mi.dataset.driver.auv_eng.auv @file mi/dataset/driver/auv_eng/auv/auv_eng_auv_telemetered_driver.py @author Jeff Roy @brief Driver for the auv_eng_auv instrument Release notes: Initial Release """ from mi.dataset.dataset_driver import SimpleDatasetDriver from mi.dataset.parser.auv_eng_auv import AuvEngA...
{ "content_hash": "235f9ba66eee6615b2cafcfa8fed07ab", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 89, "avg_line_length": 28.5, "alnum_prop": 0.6982456140350877, "repo_name": "petercable/mi-dataset", "id": "0e6088dd37390ada78a7d2eb0602c39ff06b0bb0", "size": "1448", "bi...
c = get_config() # The IP address the notebook server will listen on. c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False # The port the notebook server will listen on. c.NotebookApp.port = 8081 # The full path to an SSL/TLS certificate file. c.NotebookApp.certfile = u'/path/to/.ipython/profile_pyspark/nbcert...
{ "content_hash": "945d00e0bb307380a6ef3e08126cfd05", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 72, "avg_line_length": 29.470588235294116, "alnum_prop": 0.7485029940119761, "repo_name": "lowcloudnine/singularity-spark", "id": "91d4870732485b175322359d236538911cb09dc6", ...
from __future__ import absolute_import from rest_framework.response import Response from sentry.api.bases.organization import OrganizationEndpoint from sentry.api.serializers import serialize from sentry.models import User from sentry.api.endpoints.organization_member_index import MemberPermission class Organizatio...
{ "content_hash": "9f4e70f2a25bb289c5e254c299d49776", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 81, "avg_line_length": 33.5, "alnum_prop": 0.7313432835820896, "repo_name": "mvaled/sentry", "id": "642ccf47792e0cddd10b14c036854d0f478a9927", "size": "737", "binary": fa...
from __future__ import absolute_import from .. import QROOT from ..decorators import snake_case_methods from .base import Plottable __all__ = [ 'Line', 'Ellipse', 'Arrow', ] @snake_case_methods class Line(Plottable, QROOT.TLine): _ROOT = QROOT.TLine def __init__(self, *args, **kwargs): ...
{ "content_hash": "1a9bb2755f2c828712fdfcba37a83643", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 44, "avg_line_length": 19.823529411764707, "alnum_prop": 0.6275964391691394, "repo_name": "kreczko/rootpy", "id": "92a033666ef7e575c81ad25b2c7d5d1581ff3436", "size": "674",...
try: from ez_setup import use_setuptools use_setuptools() except ImportError: pass try: from setuptools import setup except ImportError: from distutils.core import setup from os.path import join, dirname execfile(join(dirname(__file__), 'src', 'Selenium2Library', 'version.py')) DESCRIPTION = """ ...
{ "content_hash": "53ada8dcf2f293072ce5dc5b5f5e09db", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 102, "avg_line_length": 38.416666666666664, "alnum_prop": 0.5927331887201736, "repo_name": "jussimalinen/robotframework-selenium2library", "id": "bb06cf6c207063651668481631e4...
import logging from optparse import OptionParser import os import requests import json import fiona from shapely.geometry import Point, shape from shapely.prepared import prep import sys SUCCESS_COLOR = '#8FD933' POSSIBLE_ERROR_COLOR = '#FF9300' ERROR_COLOR = '#FF0000' def run_tests(bbox, service_url, status_path=Non...
{ "content_hash": "812ac8c4dc23e5a5b3df2b5b3f058402", "timestamp": "", "source": "github", "line_count": 175, "max_line_length": 93, "avg_line_length": 34.65714285714286, "alnum_prop": 0.5119538334707338, "repo_name": "trailbehind/ElevationServiceTester", "id": "82de83446fe83f273f974ffb0299bbaaf72742f...
from flask import jsonify, request, current_app, url_for from . import api from ..models import User, Post @api.route('/users/<int:id>') def get_user(id): user = User.query.get_or_404(id) return jsonify(user.to_json()) @api.route('/users/<int:id>/posts/') def get_user_posts(id): user = User.query.get_or...
{ "content_hash": "639a4aedfa408f38d073b3b1b9456468", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 78, "avg_line_length": 32.15094339622642, "alnum_prop": 0.619131455399061, "repo_name": "theLastTrain/seaside", "id": "febc359fa3584910294535352f2826d0a1df0252", "size": "1...
""" lets.slavery ~~~~~~~~~~~~ Links 2 greenlets by the slavery. :copyright: (c) 2013-2018 by Heungsub Lee :license: BSD, see LICENSE for more details. """ import sys from gevent import GreenletExit, killall from gevent.event import Event import six __all__ = ['MasterGreenletExit', 'join_slaves', 'l...
{ "content_hash": "ed7417114892e18f328a07b6f8e73d61", "timestamp": "", "source": "github", "line_count": 137, "max_line_length": 79, "avg_line_length": 30.175182481751825, "alnum_prop": 0.6678761490082245, "repo_name": "sublee/lets", "id": "2cf22cfec93c092f81f3402e87b742ecb7581002", "size": "4158", ...
from __future__ import division import dill as pickle from collections import defaultdict import datetime import time import xxhash from bokeh.embed import components from src.common.database import Database from src.engine import EngineConstants from src.engine.EngineConstants import EngineUtils from src.engine.cor...
{ "content_hash": "253e7cd9101d139ef122134a53f02307", "timestamp": "", "source": "github", "line_count": 384, "max_line_length": 158, "avg_line_length": 42.859375, "alnum_prop": 0.5788066593753798, "repo_name": "aysenurbilgin/tilt_api", "id": "d40636c0a8e2b80cc01ce49ef655f701dcd10e3e", "size": "1645...
from __future__ import print_function import logging import os import socket import subprocess import sys import tempfile import time import six.moves.urllib.request as request sys.path.append(os.path.dirname(os.path.abspath(__file__))) import jobset # must be synchronized with test/core/util/port_server_client.h _...
{ "content_hash": "3d9909d15ddabaf9f73c4b15296f6aeb", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 87, "avg_line_length": 39.9, "alnum_prop": 0.5104427736006684, "repo_name": "grpc/grpc-ios", "id": "15eada447733f59e730b223f508bf8acf6e80b3b", "size": "5366", "binary": ...
""" This file defines the main physical constants of the system: * Speed of sound * Absorption of materials * Scattering coefficients * Air absorption """ import io import json import os import numpy as np # tolerance for computations eps = 1e-10 # We implement the constants as a dictionary so that ...
{ "content_hash": "8c036b18a862726800e3e2ac381013b3", "timestamp": "", "source": "github", "line_count": 469, "max_line_length": 88, "avg_line_length": 32.43283582089552, "alnum_prop": 0.5911511406219183, "repo_name": "LCAV/pyroomacoustics", "id": "4a363d8ca80b0d0a3f80ea779cd0ae46b2c1cb02", "size": ...
""" ========== Grid Data! ========== If you don't have Monte Carlo chains, and have grid evaluations instead, that's fine too! Just flatten your grid, set the weights to the grid evaluation, and set the grid flag. Here is a nice diamond that you get from modifying a simple multivariate normal distribution. Note that...
{ "content_hash": "10df8aad4f6167b918155f73920db3d7", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 94, "avg_line_length": 40, "alnum_prop": 0.6705555555555556, "repo_name": "Samreay/ChainConsumer", "id": "6316d44093d9f5b958597e937feafe42e75f9b21", "size": "1824", "bina...
import os import sys import tempfile import time import unittest import webbrowser import test_env import mock from buildbot.status import results from buildbot.status.builder import BuildStatus, BuildStepStatus, BuilderStatus from buildbot.status.logfile import LogFile from buildbot.status.master import Status as ...
{ "content_hash": "04aec66068bcb96d0c2071cd6f14e001", "timestamp": "", "source": "github", "line_count": 209, "max_line_length": 79, "avg_line_length": 31.019138755980862, "alnum_prop": 0.6156100570723431, "repo_name": "eunchong/build", "id": "e5956dc12f920eaf1cd042a1f4962e0450c4ce0c", "size": "6668...
"""Preprocessing stage.""" # pylint: disable=g-classes-have-attributes from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.data.ops import dataset_ops from tensorflow.python.framework import ops from tensorflow.python.k...
{ "content_hash": "9045679073f8f856bd82fe22a8a060a5", "timestamp": "", "source": "github", "line_count": 259, "max_line_length": 82, "avg_line_length": 38.87644787644788, "alnum_prop": 0.6484258615552686, "repo_name": "petewarden/tensorflow", "id": "cf6028018a3125842fe12cc07bd2c6617c4d6028", "size":...
import sys class ProductKey: def __init__(self, fileName = None): self.keyFile = None if (fileName is not None): self.Open(fileName) def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.Close() def Open(self, fileName): if (self.k...
{ "content_hash": "7a32033d0fb4514b92ee07d6db16554a", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 97, "avg_line_length": 29.892857142857142, "alnum_prop": 0.5125448028673835, "repo_name": "andry81/contools", "id": "151ea6228ac1be23d7b70062a25e20225596c662", "size": "167...
import sys # [START storage_get_requester_pays_status] from google.cloud import storage def get_requester_pays_status(bucket_name): """Get a bucket's requester pays metadata""" # bucket_name = "my-bucket" storage_client = storage.Client() bucket = storage_client.get_bucket(bucket_name) requester...
{ "content_hash": "802e284a941e5674d51c54c8cc94543f", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 62, "avg_line_length": 27.083333333333332, "alnum_prop": 0.6892307692307692, "repo_name": "googleapis/python-storage", "id": "a2eeb34d70f837c5d8cd4bacdd9d723d612f484d", "si...
"""Remote control support for Bravia TV.""" from __future__ import annotations from collections.abc import Iterable from typing import Any from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from h...
{ "content_hash": "6b0e6b8f7dfe9cb72ea803bc6c86da19", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 86, "avg_line_length": 31.342105263157894, "alnum_prop": 0.6763224181360201, "repo_name": "Danielhiversen/home-assistant", "id": "81761240320de655d4356c2925c7f666eba271c7", ...
import pytest import libqtile.config from libqtile import layout from test.conftest import no_xinerama from test.layouts.layout_utils import ( assert_dimensions, assert_focus_path, assert_focused, ) class ZoomyConfig: auto_fullscreen = True main = None groups = [ libqtile.config.Group...
{ "content_hash": "90443b3519bc4d2957d1658bb7cf3576", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 89, "avg_line_length": 27.0327868852459, "alnum_prop": 0.6622195269860521, "repo_name": "zordsdavini/qtile", "id": "849fa53bf6b0c86ed1d817011e3638962e4a897e", "size": "2987...
import sys, os, threading, traceback import types from collections.abc import Mapping from . import envs from .thread_state import thread_local from .values import McInvalidValue from .config_errors import InvalidUsageException, ConfigExcludedAttributeError, ConfigApiException from .bases import get_bases from .attrib...
{ "content_hash": "dd77bcbf31f7dd33adf855e914d98753", "timestamp": "", "source": "github", "line_count": 508, "max_line_length": 152, "avg_line_length": 42.11614173228347, "alnum_prop": 0.5532601075017527, "repo_name": "lhupfeldt/multiconf", "id": "c7ead51c242aef4dfd16d5643308e53a3d30844d", "size": ...
__author__ = "@jframos" import behave from behave import step from hamcrest import assert_that, is_ from qautils.dataset.dataset_utils import DatasetUtils from commons.step_helpers import send_context_notification_step_helper from commons.constants import IMPLICIT_WAIT_AFTER_NOTIFICATION import time behave.use_step_m...
{ "content_hash": "0e8e44e73732e6e5ef1588b55b8a1f8a", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 119, "avg_line_length": 41.15277777777778, "alnum_prop": 0.7124535943300708, "repo_name": "Fiware/cloud.Facts", "id": "79716bb4ff2a95c8681cf83e542a5f590f023371", "size": "3...
from __future__ import absolute_import, print_function from collections import defaultdict, namedtuple from datetime import timedelta import six from django.core.urlresolvers import reverse from django.db.models import Q from django.utils import timezone from sentry import tsdb from sentry.api.serializers import Ser...
{ "content_hash": "a14b6744e793b29334c6d5605cf0ba80", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 95, "avg_line_length": 38.320945945945944, "alnum_prop": 0.5800934497046637, "repo_name": "JamesMura/sentry", "id": "f9a5760a0a7e730360bf1b2a34a6779164fc6873", "size": "11...
from mock import patch, call, Mock from ...testcases import DustyTestCase from dusty.commands.setup import (_get_mac_username, setup_dusty_config, complete_setup, _get_vm_size) from dusty.payload import Payload from dusty import constants class TestSetupCommands(DustyTestCase): @...
{ "content_hash": "820548e19bde74e3026a9a4ccf35fed1", "timestamp": "", "source": "github", "line_count": 155, "max_line_length": 169, "avg_line_length": 53.52903225806452, "alnum_prop": 0.6373387971555984, "repo_name": "gamechanger/dusty", "id": "62a23330efd2ea8f9b69e8a864c91719bb505938", "size": "8...
from collections import namedtuple import pytest Tree = namedtuple('Tree', 'x l r') def is_balanced(T): """ Time: O(n log n), Space worst O(n) best/avg O(log n) """ if T is None: return True diff_height = abs(height(T.l) - height(T.r)) if diff_height > 1: return False ...
{ "content_hash": "fc015568927db9d9b863b7913f642fae", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 81, "avg_line_length": 21.901960784313726, "alnum_prop": 0.4941808415398389, "repo_name": "daviur/py-cracking-the-coding-interview", "id": "7baa6c7a346047eacb0f6776b22174aa2...
from .templates import SortTemplate class SelectionSort(SortTemplate): """Creates a class to implement the selection sort. """ def sort(self): """Uses the section sort algorithm to sort. This is a basic section sort algorithm. """ for i in range(self.length): ...
{ "content_hash": "d77f9afd9a718444f280dd0b06ee2a54", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 74, "avg_line_length": 30.29787234042553, "alnum_prop": 0.5393258426966292, "repo_name": "OctavianLee/Algorithm-Python", "id": "328a19ccc1ea0c9733ae6ccc8632d5037dcfc5ad", "...
"""Runs kubernetes e2e test with specified config""" import argparse import hashlib import os import random import re import shutil import subprocess import sys import urllib2 import time ORIG_CWD = os.getcwd() # Checkout changes cwd # The zones below are the zones available in the CNCF account (in theory, zones va...
{ "content_hash": "3aa8f0bd5e4ad4fe2a77a554998843fc", "timestamp": "", "source": "github", "line_count": 710, "max_line_length": 97, "avg_line_length": 37.874647887323945, "alnum_prop": 0.6032501580454427, "repo_name": "foxish/test-infra", "id": "5bc1f21185f9d137d95a3ab536834123d8e405e7", "size": "2...
import os from oslo.config import cfg from nova import config from nova import ipv6 from nova.openstack.common.fixture import config as config_fixture from nova import paths from nova.tests import utils CONF = cfg.CONF CONF.import_opt('use_ipv6', 'nova.netconf') CONF.import_opt('host', 'nova.netconf') CONF.import_o...
{ "content_hash": "5e159c0578445a04f5a892ab8bdd4557", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 77, "avg_line_length": 44.21568627450981, "alnum_prop": 0.6607538802660754, "repo_name": "petrutlucian94/nova_dev", "id": "0503d740b1e45ef6a0d5125556ffae264ca33872", "size"...
from django.conf.urls import url from .views import CurrentUserView urlpatterns = [ url(r'^me$', CurrentUserView.as_view(), name='me') ]
{ "content_hash": "e13d7f21c48346c372fc95cd6e568009", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 54, "avg_line_length": 18, "alnum_prop": 0.7013888888888888, "repo_name": "locarise/locarise-drf-oauth2-support", "id": "046b974c768cd410fc4d739e7651b1e5fd880958", "size": "...
__author__ = 'sulantha' import pandas as pd import numpy from matplotlib import pyplot as plt from sklearn.metrics import roc_curve, auc, confusion_matrix from Python.RUSRandomForest import RUSRandomForestClassifier from Python.RUSRandomForest import Config mci_df = pd.read_csv('../../Classification_Table.csv', delimi...
{ "content_hash": "cff745e6a0e80ddd75b0d32c5c6dfb14", "timestamp": "", "source": "github", "line_count": 184, "max_line_length": 160, "avg_line_length": 61.09782608695652, "alnum_prop": 0.7312755737413271, "repo_name": "sulantha2006/Conversion", "id": "220b6e5b1ae4a768a7142529ad2e66b5e422bb5e", "siz...
from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import cstr import mimetypes, json from werkzeug.wrappers import Response from frappe.website.context import get_context from frappe.website.utils import scrub_relative_urls, get_home_page, can_cache, delete_page_cache from fr...
{ "content_hash": "b640c3debd173b89a0df766d72bc3568", "timestamp": "", "source": "github", "line_count": 175, "max_line_length": 97, "avg_line_length": 24.685714285714287, "alnum_prop": 0.705324074074074, "repo_name": "gangadharkadam/johnfrappe", "id": "17c9af9398d3ad4aa291ca18e204bef3d43fe7e6", "si...
import array import logging import datetime import time from argparse import ArgumentParser import os import sys import traceback from ant.fs.manager import ( Application, AntFSAuthenticationException, AntFSTimeException, AntFSDownloadException, ) from ant.fs.manager import AntFSUploadException from an...
{ "content_hash": "b4fbbde0f23fb0a2320db2cf16c5de99", "timestamp": "", "source": "github", "line_count": 381, "max_line_length": 87, "avg_line_length": 33.56955380577428, "alnum_prop": 0.5666927286942924, "repo_name": "Tigge/antfs-cli", "id": "d24d3e1ec5284826663d104b856a8e81e6994ead", "size": "1393...
"""Utility functions for Windows builds. This file is copied to the build directory as part of toolchain setup and is used to set up calls to tools used by the build that need wrappers. """ from __future__ import print_function import os import re import shutil import subprocess import stat import sys BASE_DIR = os...
{ "content_hash": "4c8f64b526eca03a7db04b089f35ce3a", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 81, "avg_line_length": 38.22222222222222, "alnum_prop": 0.6450719822812846, "repo_name": "flutter/buildroot", "id": "b4fc8485ffa17057ad70706a99865fc36d9127a4", "size": "73...
import proto # type: ignore __protobuf__ = proto.module( package="google.ads.googleads.v12.enums", marshal="google.ads.googleads.v12", manifest={"SkAdNetworkUserTypeEnum",}, ) class SkAdNetworkUserTypeEnum(proto.Message): r"""Container for enumeration of SkAdNetwork user types. """ class S...
{ "content_hash": "1acd4d8a43a364aa883cb17509e99f88", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 60, "avg_line_length": 23.666666666666668, "alnum_prop": 0.6496478873239436, "repo_name": "googleads/google-ads-python", "id": "e5e9549f820a24fb53bff58553b1ee3fdbfbb0f7", "...
""" test_synonym_inducers ---------------------------------- Tests for `synonym_inducers` module. """ try: import unittest2 as unittest except ImportError: import unittest from wikipediabase import synonym_inducers as si class TestSynonymInducers(unittest.TestCase): def setUp(self): pass d...
{ "content_hash": "a7c79e22c3de7d3a1866c062ee7cb6a6", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 72, "avg_line_length": 22.63888888888889, "alnum_prop": 0.6073619631901841, "repo_name": "fakedrake/WikipediaBase", "id": "a64f2fa40d2f2f6cb4d2c035c3e49c11791e8614", "size"...
"""Model setup for photos and albums.""" from django.db import models from django.contrib.auth.models import User from django.utils.encoding import python_2_unicode_compatible from sorl.thumbnail import ImageField from taggit.managers import TaggableManager PUBLISHED_STATUS = ( ('PB', 'public'), ('PV', 'priva...
{ "content_hash": "8eb40e050eb71f9d58dc7664ff351a26", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 70, "avg_line_length": 33.921875, "alnum_prop": 0.6282818977429756, "repo_name": "cahudson94/django-imager", "id": "d3296dba2effbecf558058b054df74e018e42021", "size": "2171...
class bcolors: """ bcolors: Facilitates printing colors on terminals with support for escape sequences. It was borrowed from the following stackoverflow answer: <http://stackoverflow.com/a/287944> """ HEADER = '\033[95m' BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = ...
{ "content_hash": "2ce842db151167fc5f4a9f0c9df50b60", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 79, "avg_line_length": 28.59259259259259, "alnum_prop": 0.5621761658031088, "repo_name": "yamadapc/life", "id": "38f6bf6325da1c0fd10135d8ca7fdcc09d89dde7", "size": "1544", ...
from collections import namedtuple from enum import Enum import re from .exceptions import ScanError _COMMENT_TEST_RX = re.compile(r'^\s*#.*$') _CTX_WS_RX = re.compile(r'\S') _INT_RX = re.compile(r'-?\d+') _WS_RX = re.compile(r'\s+') class Keywords(object): css_start = '$' accessor_start = '|' attr_acc...
{ "content_hash": "badae6e2ae5a4553e87ec256ab7e6722", "timestamp": "", "source": "github", "line_count": 425, "max_line_length": 116, "avg_line_length": 36.27764705882353, "alnum_prop": 0.5407964716565054, "repo_name": "tiffon/take", "id": "297d70bb6d9cf22a744d14345169a3c88185bee8", "size": "15418",...
from __future__ import absolute_import, print_function class SlotPickleMixin(object): # SlotPickelMixin is originally from: # http://code.activestate.com/recipes/578433-mixin-for-pickling-objects-with-__slots__/ # Copyright (c) 2013 Created by Oren Tirosh # # Permission is hereby granted, free of...
{ "content_hash": "4d0f9cbc0e5096512360b091a9fc0d42", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 92, "avg_line_length": 51.18181818181818, "alnum_prop": 0.6897572528123149, "repo_name": "marcreyesph/scancode-toolkit", "id": "703e50e94efb30d3ce55971e6a7a974852ca0bd2", "...
import types import tempfile from .utils import needs_uge from .utils import generate_random_string from .utils import create_config_file from .utils import load_values from uge.api.qconf_api import QconfApi from uge.config.config_manager import ConfigManager from uge.log.log_manager import LogManager from uge.excepti...
{ "content_hash": "75c2a2f7c1fa8be1a92619b1f7c95b08", "timestamp": "", "source": "github", "line_count": 226, "max_line_length": 101, "avg_line_length": 29.18141592920354, "alnum_prop": 0.534950720242608, "repo_name": "gridengine/config-api", "id": "560dfa2f92ada2d0011b9c77477b4709a600b368", "size":...
""" Hello world example client. @see: U{HelloWorld<http://pyamf.org/wiki/HelloWorld>} wiki page. @since: 0.1.0 """ from pyamf.remoting.client import RemotingService gateway = RemotingService('http://demo.pyamf.org/gateway/helloworld') echo_service = gateway.getService('echo.echo') print echo_service('Hello world!...
{ "content_hash": "ebc32a9cccbc106ac540243281195ecc", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 69, "avg_line_length": 21.533333333333335, "alnum_prop": 0.7430340557275542, "repo_name": "cardmagic/PyAMF", "id": "9750954bbecefdae007018a58812d3dbc575876d", "size": "400"...