text stringlengths 4 1.02M | meta dict |
|---|---|
from google.cloud import bigquery_connection_v1 as bq_connection
"""This sample shows how to create a BigQuery connection with a Cloud SQL for MySQL database"""
def main() -> None:
# TODO(developer): Set all variables for your Cloud SQL for MySQL connection.
project_id = "your-project-id" # set project_id
... | {
"content_hash": "fc1d5dbb03b653d4b1376d1d546ff954",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 95,
"avg_line_length": 36.95918367346939,
"alnum_prop": 0.676974047487576,
"repo_name": "googleapis/python-bigquery-connection",
"id": "a71c9678db0161256de85208608281d7e9161a... |
"""Tests for Latex exporter"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os.path
import textwrap
import re
from .base import ExportersTestsBase
from ..latex import LatexExporter
from IPython.nbformat import write
from IPython.nbformat import v4
from I... | {
"content_hash": "c8a988a7ea1448f84c3d5dd787343b8d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 104,
"avg_line_length": 35.35897435897436,
"alnum_prop": 0.6236403190717912,
"repo_name": "wolfram74/numerical_methods_iserles_notes",
"id": "28807af392720ae48af425325742faa... |
from setuptools import setup, find_packages
from glob import glob
from os import path
def requirements(filename):
return filter(None, [
line.strip()
for line in open(filename).readlines()])
libdir = 'pylib'
aeondir = 'pylib/aeon'
packages = find_packages(libdir)
setup(
name="aeon-venos",
... | {
"content_hash": "fdabf84f8bda6c78e66b1087403ccbec",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 33.82,
"alnum_prop": 0.6132465996451804,
"repo_name": "Apstra/aeon-venos",
"id": "ee6b1e25cc184945c81615825a38894f8bd7427e",
"size": "1911",
"binar... |
from sys import argv
import feedparser
# Error handlers
# --------------
# Check for incorrect usage
if len(argv) == 1:
print("URL is missing.\n")
url = input("Enter it: ")
# Default case
else:
url = argv[1]
# Fix broken links without protocol
if not (url.startswith("http://") or url.startswith("https://")):
... | {
"content_hash": "b44490f4c904091e8ebd9fbb6910530f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 80,
"avg_line_length": 20.77027027027027,
"alnum_prop": 0.620039037085231,
"repo_name": "ZDroid/feedstyl",
"id": "580f72836ea05a20362385f92b7874d03ef35083",
"size": "1636",... |
import asyncio
import datetime
import json
import re
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp import HttpVersion, HttpVersion10, HttpVersion11, hdrs, signals
from aiohttp.payload import BytesPayload
from aiohttp.test_utils import make_mocked_request
from aiohttp.web impor... | {
"content_hash": "dde7d7b3007b3a7b0e436bb4344c1d73",
"timestamp": "",
"source": "github",
"line_count": 1213,
"max_line_length": 79,
"avg_line_length": 27.39653751030503,
"alnum_prop": 0.6554525758305247,
"repo_name": "Eyepea/aiohttp",
"id": "72c0cc754a6d8ccbbfd2be9c3e8887b28459236a",
"size": "3328... |
from django.shortcuts import render, redirect, get_object_or_404
from .models import Article, Comment, Poll, NewUser
from .forms import CommmentForm, LoginForm, RegisterForm, SetInfoForm, SearchForm
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from djan... | {
"content_hash": "1277a04c81224ea8a60132eace8fe94f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 109,
"avg_line_length": 32.16339869281046,
"alnum_prop": 0.7037187563503353,
"repo_name": "polegithub/shopping_web_python",
"id": "714bcd7e705d8b1393c26e03617f2c624405ce36",... |
from __future__ import annotations
from django.apps import AppConfig
class PollsConfig(AppConfig):
name = "polls"
| {
"content_hash": "98698484db874a7ac7694796b9192717",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 34,
"avg_line_length": 17.285714285714285,
"alnum_prop": 0.743801652892562,
"repo_name": "rochacbruno/dynaconf",
"id": "654d697e2c39c6113b53ec9a9baf18fcfa492a10",
"size": "1... |
import logging
logging.basicConfig(filename="sample.log", level=logging.INFO)
log = logging.getLogger("ex")
try:
raise RunTimeError
except Exception, err:
log.exception("Error!")
| {
"content_hash": "33d483d9d29b443a6c75a3ec62e163ef",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 62,
"avg_line_length": 21,
"alnum_prop": 0.7407407407407407,
"repo_name": "talapus/Ophidian",
"id": "26bbcfa89b6aba11db986e5b35998ff72f8c1839",
"size": "189",
"binary": fa... |
import os
import unittest
import mock
import consul
from rpaas import consul_manager, nginx
class ConsulManagerTestCase(unittest.TestCase):
def setUp(self):
self.master_token = "rpaas-test"
os.environ.setdefault("RPAAS_SERVICE_NAME", "test-suite-rpaas")
os.environ.setdefault("CONSUL_HOS... | {
"content_hash": "65afd192d042eda1356b0f2759221481",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 113,
"avg_line_length": 56.98518518518519,
"alnum_prop": 0.6086052255297023,
"repo_name": "tsuru/rpaas",
"id": "cb1c9a2a301bac9478262423eb7ccf71ae93b25e",
"size": "30957",... |
from django.core.management.base import BaseCommand, CommandError
from galleries.models import Gallery
class Command(BaseCommand):
args = '<gallery_id>'
help = 'Creates Thumbnails for a Gallery'
def handle(self, *args, **options):
for gallery_id in args:
try:
gallery = ... | {
"content_hash": "3a03ac79097ab8fcb51cf5f1f1eae61d",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 90,
"avg_line_length": 40.5,
"alnum_prop": 0.46520763187429853,
"repo_name": "caa/django-galleries",
"id": "15ad8f79902e2779b0d012549f2fffddef3bf3be",
"size": "1782",
"bi... |
"""Tests for debugger functionalities in tf.Session."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import shutil
import tempfile
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from ten... | {
"content_hash": "9022f6d9e8504f421cb3e416dcc6052f",
"timestamp": "",
"source": "github",
"line_count": 1011,
"max_line_length": 80,
"avg_line_length": 39.453016815034616,
"alnum_prop": 0.6364981071527064,
"repo_name": "ryfeus/lambda-packs",
"id": "2b700facd7d66667175cb5cde768edd23e838bb0",
"size":... |
r"""
.. dialect:: mysql+asyncmy
:name: asyncmy
:dbapi: asyncmy
:connectstring: mysql+asyncmy://user:password@host:port/dbname[?key=value&key=value...]
:url: https://github.com/long2ice/asyncmy
.. note:: The asyncmy dialect as of September, 2021 was added to provide
MySQL/MariaDB asyncio compatibilit... | {
"content_hash": "d829492a000db155a57d5d5db92d8971",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 93,
"avg_line_length": 29.77570093457944,
"alnum_prop": 0.6166562042268257,
"repo_name": "sqlalchemy/sqlalchemy",
"id": "df8965cbbd8de7921a1af36b816d2abef2650ec3",
"size":... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_rebel_high_general_old_twilek_female_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","twilek_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
ret... | {
"content_hash": "15a40bde1c7ad7113755d208e7c9891c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 93,
"avg_line_length": 25.384615384615383,
"alnum_prop": 0.706060606060606,
"repo_name": "anhstudios/swganh",
"id": "dc14708e5b2b30254eb3c8b44a82ecce103d89d3",
"size": "475... |
"""
WSGI config for blog 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/
"""
from __future__ import absolute_import, unicode_literals
import os
from django.core.wsgi import g... | {
"content_hash": "4b713381ee7c229e09b27bc36a4fb7f1",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 24.88888888888889,
"alnum_prop": 0.7678571428571429,
"repo_name": "rocity/wagtail-blog",
"id": "04da6fc614f4fc45b9b18c5cfc2a28e55b887076",
"size": "4... |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_browse as h2b
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(1)
@classmethod
def tearDownC... | {
"content_hash": "53507ef8a3494641aad90dac51bb20c2",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 128,
"avg_line_length": 34.985915492957744,
"alnum_prop": 0.5700483091787439,
"repo_name": "eg-zhang/h2o-2",
"id": "44c28a6eaceae54c40ee94ad5603c3ab5eca692e",
"size": "2484... |
from oslo_config import cfg
from nova.tests.functional.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class PauseServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-pause-server"
ext... | {
"content_hash": "8fec054c1c7a073b07d59306c29d1659",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 77,
"avg_line_length": 36.51219512195122,
"alnum_prop": 0.6319305277221109,
"repo_name": "takeshineshiro/nova",
"id": "c7b1d5f1159e36515a68285c5a77a7068f89fdbb",
"size": "2... |
import tests.periodicities.period_test as per
per.buildModel((12 , 'BH' , 100));
| {
"content_hash": "6f059b4dd89ee767e01297c370364a02",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 20.75,
"alnum_prop": 0.7108433734939759,
"repo_name": "antoinecarme/pyaf",
"id": "742e79ed955bde72b1ac368d57e0db151815a140",
"size": "83",
"binary":... |
"""
.. warning :: This module will eventually be deprecated in favor of `brmp <https://github.com/pyro-ppl/brmp/>`_
The :mod:`pyro.contrib.oed.glmm` module provides models and guides for
generalised linear mixed models (GLMM). It also includes the
Normal-inverse-gamma family.
To create a classical Bayesian linear mod... | {
"content_hash": "9fd0011c4810fd46086725f5011ed3d5",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 111,
"avg_line_length": 39.513513513513516,
"alnum_prop": 0.66484268125855,
"repo_name": "uber/pyro",
"id": "c17c2212134628f35109c002106f6de8c227868d",
"size": "1551",
"b... |
from urllib.parse import parse_qs, urlencode, urlparse
from loguru import logger
from requests.exceptions import RequestException
from flexget import plugin
from flexget.components.sites.urlrewriting import UrlRewritingError
from flexget.event import event
logger = logger.bind(name='rutracker')
class SiteRutracker... | {
"content_hash": "15c4c26c7886f1f1933f429d6c4c88d4",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 86,
"avg_line_length": 30.189655172413794,
"alnum_prop": 0.604797258709309,
"repo_name": "Flexget/Flexget",
"id": "510c48cb1b2715b4d62b5b870e1025bfb691d9a9",
"size": "1776"... |
__all__ = ['create_subprocess_exec', 'create_subprocess_shell']
import subprocess
from . import events
from . import protocols
from . import streams
from . import tasks
from .coroutines import coroutine
from .log import logger
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
DEVNULL = subprocess.DEVNULL
class Su... | {
"content_hash": "32e33f495eeede727d9650fe81b34394",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 78,
"avg_line_length": 33.774647887323944,
"alnum_prop": 0.526827912149013,
"repo_name": "lunixbochs/actualvim",
"id": "b2f5304f772121de9c60691a9cc5499cfd07a168",
"size": ... |
import sys
if sys.platform == 'win32':
import wmi
from nova import exception
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.virt.hyperv import vmutils
from nova.virt.hyperv import vmutilsv2
from nova.virt.hyperv import volumeutilsv2
LOG = logging.getLogger(__name__)
class Li... | {
"content_hash": "04c4b444e9030f31ea3581a6d8bba0f3",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 79,
"avg_line_length": 45.53448275862069,
"alnum_prop": 0.5777167739492617,
"repo_name": "projectcalico/calico-nova",
"id": "8d5300bf4012a6a600644d41e0dbb16c55a618c9",
"si... |
import json
import test_utils
from nose.tools import ok_
from django.contrib.auth.models import AnonymousUser
import amo
from addons.models import Category
from mkt import regions
from mkt.api.tests.test_oauth import BaseOAuth
from mkt.regions import set_region
from mkt.reviewers.forms import ApiReviewersSearchForm... | {
"content_hash": "10fd19b91d7d046b82e70dd30afb20f2",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 40.4485294117647,
"alnum_prop": 0.5891656062534085,
"repo_name": "Joergen/zamboni",
"id": "ea68baea05b4b8400aaccd1c3ebe48f52771c37e",
"size": "5501"... |
from django.db import models
from django.dispatch import receiver
from django.contrib.comments.signals import comment_was_posted
from django.contrib.sites.models import Site
from django.template import loader, Context
from django.utils.translation import ugettext_lazy as _
from django_comments_xtd.conf import settings
... | {
"content_hash": "800166c160e0bc67e4393d1158818adb",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 99,
"avg_line_length": 39.59375,
"alnum_prop": 0.6558800315706393,
"repo_name": "demvher/pythondotorg",
"id": "dc1a017226492449cba1e9b6d965761cb92c958a",
"size": "5068",
... |
import msgpack
import sys
import socket
import uuid as uuidlib
class Client:
def __init__(self, host, port, uuid=None):
self.uuid = uuid if uuid is not None else uuidlib.uuid4()
self.uuid = str(self.uuid) # coerce to string
self.host = str(host)
self.port = int(port)
self.... | {
"content_hash": "20bb07bb6e9b380ea9d4421bb35dfd07",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 88,
"avg_line_length": 27.90909090909091,
"alnum_prop": 0.5814332247557004,
"repo_name": "gtfierro/cs262-project",
"id": "0c6b2ffd5717dbbc31b84f466b77c9270e42a720",
"size":... |
from nagare.i18n import _
from nagare import ajax, presentation
from .comp import CardWeightEditor
def answer(editor, comp):
if editor.commit():
comp.answer()
@presentation.render_for(CardWeightEditor, 'action')
def render_cardweighteditor(self, h, comp, *args):
if self.weighting_switch:
h ... | {
"content_hash": "8fbeca16f8f80b41d56096a054449a48",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 89,
"avg_line_length": 36.36363636363637,
"alnum_prop": 0.6055,
"repo_name": "Net-ng/kansha",
"id": "316e171abf9db38408bfba415ed6e0ebfc77b06f",
"size": "2222",
"binary": ... |
from copy import deepcopy
from hashlib import sha256
from common.serializers.serialization import domain_state_serializer
from indy_common.constants import ATTRIB, GET_ATTR, SIGNATURE_TYPE, REVOC_TYPE, TAG, CRED_DEF_ID, REVOC_REG_DEF_ID, \
CLAIM_DEF_SCHEMA_REF, CLAIM_DEF_PUBLIC_KEYS, SCHEMA_ATTR_NAMES, CLAIM_DEF_F... | {
"content_hash": "cb5b69131b5514f97427b5c3d6f15cb5",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 117,
"avg_line_length": 36.04935064935065,
"alnum_prop": 0.635636573240147,
"repo_name": "spivachuk/sovrin-node",
"id": "7e01907bc7b8263268741b33dae9a88bf5eb06ba",
"size":... |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import spoton
version = spoton.__version__
setup(
name='spoton',
version=version,
author='',
author_email='thung@me.com',
packages=[
'spoton',
],
include_package_da... | {
"content_hash": "11b3803ec23f55d91a7c55c2c23d65de",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 36,
"avg_line_length": 16.25925925925926,
"alnum_prop": 0.6173120728929385,
"repo_name": "masterfung/Spoton",
"id": "528fb4252a15c1dab7afc88d220b1cb2c5ac40fa",
"size": "486... |
from neutron_lib.api.definitions import uplink_status_propagation as usp
from neutron_lib.plugins.ml2 import api
from oslo_log import log as logging
from neutron.db import uplink_status_propagation_db as usp_db
LOG = logging.getLogger(__name__)
class UplinkStatusPropagationExtensionDriver(
api.ExtensionDri... | {
"content_hash": "41c99f0d76487eb2e0a0d309e70c43bd",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 32.36666666666667,
"alnum_prop": 0.717816683831102,
"repo_name": "mahak/neutron",
"id": "e77335e248e95bd03a7ecd10b0b6377972a67d7d",
"size": "1544",
... |
import json
import pickle
import tornado.escape
__author__ = 'kollad'
class FlashMessageMixin(object):
def _cookie_name(self, key):
return '{}_message_cookie'.format(key)
def _get_message_cookie(self, key):
return self.get_cookie(self._cookie_name(key))
def has_message(self, key):
... | {
"content_hash": "b1ad3103ca4fe0ce43d8903138561698",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 83,
"avg_line_length": 29.548387096774192,
"alnum_prop": 0.62882096069869,
"repo_name": "kollad/turbo-ninja",
"id": "7542491c115f4bb8383b66fa90dc283ccef5df1d",
"size": "916... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
# NOOP
]
| {
"content_hash": "4ea5d422b5cecac264efbcec91d06cb8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 40,
"avg_line_length": 14.76923076923077,
"alnum_prop": 0.6458333333333334,
"repo_name": "staranjeet/fjord",
"id": "2b3a83959bb52bd554579202037f2df0522e00d7",
"size": "216"... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource ... | {
"content_hash": "da4a412da145d1d41447cf2296fe99c0",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 142,
"avg_line_length": 40.44702842377261,
"alnum_prop": 0.6702229604548648,
"repo_name": "twilio/twilio-python",
"id": "a942f377dc41d50ca82c3f73fd9ff1c0381d4a5e",
"size":... |
"""Tests for `ged4py.detail.io` module."""
from contextlib import contextmanager
import io
import tempfile
import os
import unittest
from ged4py.detail.io import check_bom, guess_lineno, BinaryFileCR
@contextmanager
def _temp_file(data):
"""Create file with unique name and store some data in it.
Returns fi... | {
"content_hash": "ce86cb40934a5dde829b2a3f309a54d8",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 66,
"avg_line_length": 30.81764705882353,
"alnum_prop": 0.5894254628745944,
"repo_name": "andy-z/ged4py",
"id": "829115a1e889626bccfbfc661574019425ed875f",
"size": "5286",... |
import argparse
import urllib, urllib2
import cStringIO
import sys
import tempfile
import h5py
def main():
parser = argparse.ArgumentParser(description='Post an HDF5 file to the service.')
parser.add_argument('baseurl', action="store" )
parser.add_argument('token', action="store" )
parser.add_argument('h5fi... | {
"content_hash": "c5fd95d773834139e75f530263d840d6",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 149,
"avg_line_length": 27.6984126984127,
"alnum_prop": 0.6401146131805158,
"repo_name": "openconnectome/open-connectome",
"id": "fd74ef6889bc81a8de29fd58685e8b6dc15d80e2",
... |
"""Version-independent api tests"""
import httplib2
from oslo.serialization import jsonutils
from glance.tests import functional
class TestApiVersions(functional.FunctionalTest):
def test_version_configurations(self):
"""Test that versioning is handled properly through all channels"""
# v1 and... | {
"content_hash": "fbb39da33a29d35bb6a9a8c35c7eee32",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 75,
"avg_line_length": 37.634375,
"alnum_prop": 0.5192227850203438,
"repo_name": "yanheven/glance",
"id": "860df8fd8e5e09c4c2fe5081a8b4a4dfc5d9d93c",
"size": "12679",
"b... |
"""
Load geopotential heights and orography cube to get lat/lon cross-section
13/08/2014
"""
import os, sys
import pdb
import iris
import iris.analysis.cartography
from update_pp_cube_coords import update_coords
#import h5py
import numpy as np
#c_section_lon=74.
c_lon_min=75.
c_lon_max=85.
gap=1.
c_section_l... | {
"content_hash": "bc1f84aeecb7c756a383d4c14957f617",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 165,
"avg_line_length": 33.04950495049505,
"alnum_prop": 0.6698621929298981,
"repo_name": "peterwilletts24/Python-Scripts",
"id": "839e771fd9da3c5db511e0bb9e709ee56d38087d",... |
import os
import re
from docutils.parsers.rst import Directive, directives
from docutils.transforms import Transform
from docutils.utils.error_reporting import SafeString, ErrorString
from docutils import io, nodes
from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType
from sphinx.... | {
"content_hash": "8008df0ae95823fd2a8c033d8b18eadf",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 81,
"avg_line_length": 36.69230769230769,
"alnum_prop": 0.5094339622641509,
"repo_name": "thfabian/sequoia",
"id": "3a21e4d30f4a23c9df599b4aedebbc99e01b418d",
"size": "4176... |
"""
===============
bright_analysis
===============
This package is a template for other DESI_ Python_ packages.
You should use ``python setup.py version`` to set the version. This requires
the desiutil package.
.. _DESI: http://desi.lbl.gov
.. _Python: http://python.org
"""
#
from __future__ import (absolute_impor... | {
"content_hash": "1d8b90ce3c63bc52b8c3e1876089809e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.6378269617706237,
"repo_name": "apcooper/bright_analysis",
"id": "81878b2f653518a37bdf9c18e33987a5c8ff97be",
"siz... |
import foauth.providers
from foauth import OAuthDenied, OAuthError
class Venmo(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://venmo.com/'
docs_url = 'https://developer.venmo.com/docs/oauth'
favicon_url = provider_url + 'favicon.ico'
category = 'Money'
# UR... | {
"content_hash": "54bdb92dee4b03a649436d59c3a0197d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 76,
"avg_line_length": 37.6764705882353,
"alnum_prop": 0.6518345042935206,
"repo_name": "foauth/foauth.org",
"id": "d5d78084999d322be2269e380e480be4b8c41d04",
"size": "1281... |
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
try:
retur... | {
"content_hash": "57a5b80677448d5b4e0e8bd11f6a29b5",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 33.972972972972975,
"alnum_prop": 0.6459824980111376,
"repo_name": "redsolution/django-generic-ratings",
"id": "afd4d2d4b83748df35ddec4b472cb01836006a6... |
import pygame
import pygame.locals as GAME_GLOBALS
import pygame.event as GAME_EVENTS
# knihovna zakladnich funkci
import sys
# knihovna nahodnych cisel
import random
# knihovna casu
import time
# vyctove typy
from enum import Enum
# objekty #############################################################################... | {
"content_hash": "7f26670abb5c948101cf0cc95074c400",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 125,
"avg_line_length": 32.85024154589372,
"alnum_prop": 0.6316176470588235,
"repo_name": "dvorka/kids-coding-crash-course",
"id": "0569a3cfa85a8d967cd95409ac323ee08c6756d8"... |
from vizdoom import *
from doom_instance import DoomInstance
import numpy as np
class DoomInstanceCig():
def __init__(self, config, wad, skiprate, visible=False, mode=Mode.PLAYER, actions=None, id=None, color=0, bot_num=10):
self.bot_num = bot_num
args = (
"+name DoomNet +colorset ".fo... | {
"content_hash": "1fca8630db91634d4468251f6754882c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 123,
"avg_line_length": 35.407407407407405,
"alnum_prop": 0.5135983263598326,
"repo_name": "akolishchak/doom-net-pytorch",
"id": "49ced0ec5803195509c4715c3090e720f45a3f34",
... |
import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.di... | {
"content_hash": "25e3f228d28d3b6183ec1a9807a70a23",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 79,
"avg_line_length": 33.92,
"alnum_prop": 0.6650943396226415,
"repo_name": "hypokondrickard/pyNIBE",
"id": "0e1cbc6b9b48ed24308983bbdef8c727e1d60a75",
"size": "848",
"b... |
from setuptools import setup, find_packages
setup(
name="TrebuchetTrigger",
version="0.5.6",
packages=find_packages(),
install_requires=['GitPython>=0.3.1', 'PyYAML>=3.10', 'redis>=2.4.9', 'salt'],
author="Ryan Lane",
author_email="ryan@ryandlane.com",
description="An extendable git interf... | {
"content_hash": "3a9e43b9587c31d2405b4ef462a61c9e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 82,
"avg_line_length": 30,
"alnum_prop": 0.6196969696969697,
"repo_name": "wikimedia/operations-software-deployment-trebuchet-trigger",
"id": "db3fe6e159001ead00dbbef4dba5805... |
from django.conf import settings
from django.utils.importlib import import_module
def merge_dicts(d1, d2):
'''Update dictionary recursively. If values for a given key exist in both dictionaries and are dict-like they are merged.'''
for k, v in d2.iteritems():
# Try to merge the values as if they wer... | {
"content_hash": "382a416ea783d0a5acc6bc770cfe032c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 128,
"avg_line_length": 34.63265306122449,
"alnum_prop": 0.6364172068355922,
"repo_name": "potatolondon/dbindexer-1-4",
"id": "931a41b80f179f752ec07bf514388ea3599f8f8c",
"s... |
"""
Simplified Chinese language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
u'注意': 'attention',
u'小心': 'caution',
u'危险': 'danger',
u'错误': 'error',
u'提示': 'hint',
u'重要': 'impor... | {
"content_hash": "6a9fb4499843d62aec0fbd545b93122e",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 35.56666666666667,
"alnum_prop": 0.6119962511715089,
"repo_name": "santisiri/popego",
"id": "13e050a01ba2fda25df1875629f7e413d81a778f",
"size": "3878... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('flatpages', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='OrderedFlatPage',
fields=[
('fla... | {
"content_hash": "6a01eadb5fe085a93b098809aa1bc5a4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 152,
"avg_line_length": 29.56,
"alnum_prop": 0.5588633288227334,
"repo_name": "sreidy/roboticsclub.org",
"id": "1cf1678349f27cc53427b71b6dd77e5ab715bf9d",
"size": "763",
... |
from django import template
from rollyourown.seo.base import get_metadata, get_linked_metadata
from django.template import VariableDoesNotExist
register = template.Library()
class MetadataNode(template.Node):
def __init__(self, metadata_name, variable_name, target, site, language):
self.metadata_name = me... | {
"content_hash": "2511404a1087fab22c33c02d56bda027",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 130,
"avg_line_length": 37.00961538461539,
"alnum_prop": 0.5863860743050143,
"repo_name": "AlexLSB/django-seo",
"id": "34688130524372d59345fefe6e24dab3f44c2934",
"size": "... |
from py_utils.refactor.annotated_symbol.class_definition import *
from py_utils.refactor.annotated_symbol.function_definition import *
from py_utils.refactor.annotated_symbol.import_statement import *
from py_utils.refactor.annotated_symbol.reference import *
from py_utils.refactor import snippet
__all__ = [
'Ann... | {
"content_hash": "a2f6a10f75cdbafeb10d53bac9f119a1",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 25.651515151515152,
"alnum_prop": 0.7347903130537508,
"repo_name": "sahiljain/catapult",
"id": "610bc15cff919b856d2e9ec2f927c33aa6ab47bc",
"size": "1... |
import itertools
import os
import os.path
import logging
from nltk.tag.stanford import NERTagger
import wget
from iepy.preprocess.ner.base import BaseNERRunner
from iepy.utils import DIRS, unzip_file
logger = logging.getLogger(__name__)
stanford_ner_name = 'stanford-ner-2014-01-04'
download_url_base = 'http://nlp.st... | {
"content_hash": "470bfb3f399014bde51c82a276df6762",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 91,
"avg_line_length": 36.660714285714285,
"alnum_prop": 0.6134924500730639,
"repo_name": "mrshu/iepy",
"id": "2bc2773595b0c3a9fc57d847ed6b22f0dd15532a",
"size": "4106",
... |
'''
File name: example1.py
Author: Galaad Couillec
Date created: 10/02/2016
Date last modified: 10/06/2016
'''
from MongoManager import Mongod, MongoReplicaSet, MongoCluster
import argparse
import sys
parser = argparse.ArgumentParser(description='MongoDB cluster manager')
parser.add_argument('--initi... | {
"content_hash": "2cc115459e9be395acfd6b35300f464e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 140,
"avg_line_length": 33.891891891891895,
"alnum_prop": 0.7232854864433812,
"repo_name": "afissegalaad/MongoManager",
"id": "09351a12821f6e9d0be3e271d73d39bb858db76c",
"s... |
from flask import Blueprint
api = Blueprint('api', __name__)
from . import views, errors # noqa
| {
"content_hash": "68377a34bb4e6a6867309bba443f0795",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 34,
"avg_line_length": 19.6,
"alnum_prop": 0.6938775510204082,
"repo_name": "jatindhankhar/aslo-v3",
"id": "a7b4fbb5826afc0633cff5be7078f90ccc134918",
"size": "98",
"binar... |
filename = ''
customMitralCount = 2 # Full net 635=5*127
customGranulesPerMitralCount = 10 # Full net has total of 122166 GCs
#connectivity
makeSynConns = True
enableFIsyn = True
enableAmpaNmdasyn = True
enableOdorInput = True | {
"content_hash": "39b5342fbca6491315c9291d6acac086",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 25.77777777777778,
"alnum_prop": 0.771551724137931,
"repo_name": "JustasB/MitralSuite",
"id": "87c5cebc1ebbe23c84a037732944f7bdbfd69e46",
"size": "232... |
from __future__ import unicode_literals
import sys
import os
import errno
import unittest
from array import array
from weakref import proxy
from functools import wraps
from test.test_support import TESTFN, check_warnings, run_unittest, make_bad_fd
from test.test_support import py3k_bytes as bytes
from test.test_suppo... | {
"content_hash": "96d0d7971844a268215403124ffdabac",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 83,
"avg_line_length": 31.938356164383563,
"alnum_prop": 0.5370648366573737,
"repo_name": "ArneBab/pypyjs",
"id": "aecea18b4e7a6e68f313263c8da469207aebb916",
"size": "1403... |
import re
import pandas as pd
import numpy as np
import glob
import os
import nltk
from nltk import word_tokenize
##########################################################
#Preliminary Functions
##########################################################
def group_text(text, group_size):
"""
This function g... | {
"content_hash": "b23950dda5cd87801a11982059ecb118",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 107,
"avg_line_length": 26.38305084745763,
"alnum_prop": 0.5129127585763844,
"repo_name": "jmausolf/Python_Tutorials",
"id": "b3f17bad419edf5b64ba1dd39c1afef655be5a6f",
"s... |
"""Tests the tdb data store - in memory implementation."""
import shutil
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
# pylint: enable=unused-import,g-bad-import-order
from grr.lib import access_control
from grr.lib import config_lib
from grr.lib import data_store
from grr.l... | {
"content_hash": "f5ffc03a09a0e310238680c4bc098269",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 79,
"avg_line_length": 27.295081967213115,
"alnum_prop": 0.6984984984984985,
"repo_name": "ForensicTools/GRREAT-475_2141-Chaigon-Failey-Siebert",
"id": "3ea25ae3b2f418bbc4bd7... |
"""
==============================================================
Time-frequency representations on topographies for MEG sensors
==============================================================
Both average power and intertrial coherence are displayed.
"""
print(__doc__)
# Authors: Alexandre Gramfort <alexandre.gramfo... | {
"content_hash": "bb4d68ab3a2d44e42f8900758ca40b4b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 38.184615384615384,
"alnum_prop": 0.5979049153908138,
"repo_name": "effigies/mne-python",
"id": "39a643187ee00d6639ce6c607c67b2e1a723ab4c",
"size": "... |
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("data_import", "0022_auto_20191105_1924")]
operations = [
migrations.AlterField(
model_name="datatype",
name="description",
field=models.... | {
"content_hash": "c721740393f5617cdbc1dd180f3b7832",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 97,
"avg_line_length": 29.17241379310345,
"alnum_prop": 0.49527186761229314,
"repo_name": "PersonalGenomesOrg/open-humans",
"id": "cd8f0c943497f2396975497cc6fbda1da6479ac4",
... |
from django.apps import AppConfig
class HoaxConfig(AppConfig):
name = 'hoax'
| {
"content_hash": "5d3535c7839a42a1a7016cb64637615c",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 16.6,
"alnum_prop": 0.7349397590361446,
"repo_name": "barliant/fnc-id",
"id": "7cae59a87806563e74ebbc94dfa93cac08b3ae76",
"size": "83",
"binary": fa... |
from __future__ import print_function
import sys
import numpy as np
import netCDF4 as nc
from .base_grid import BaseGrid
class DaitrenRunoffGrid(BaseGrid):
def __init__(self, h_grid_def, description='Daitren runoff regular grid'):
self.type = 'Arakawa A'
self.full_name = 'Daitren_runoff'
... | {
"content_hash": "fbd20243bdac7cac04ba8ede11bd6db6",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 35.5,
"alnum_prop": 0.48169014084507045,
"repo_name": "DoublePrecision/esmgrids",
"id": "bc3fdc74f661a41bcc9b0ce25a369a0bab34239f",
"size": "1066",
... |
from synapse.exc import *
def chopurl(url):
'''
A sane "stand alone" url parser.
Example:
info = chopurl(url)
'''
ret = {}
if url.find('://') == -1:
raise BadUrl(':// not found!')
scheme,remain = url.split('://', 1)
ret['scheme'] = scheme.lower()
# carve query pa... | {
"content_hash": "53afee8d87e6bd89a0ce7c901f28b383",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 48,
"avg_line_length": 23.285714285714285,
"alnum_prop": 0.5,
"repo_name": "imjonsnooow/synapse",
"id": "8e2b97b3a0b691f604fc18745183d5c6ffd60f44",
"size": "1631",
"binar... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, COIN
from io import BytesIO
def txFromHex(hexstring):
tx = CTransaction()
f = BytesIO(hex_str_to_bytes(hexstring))
tx.deserialize(f)
return tx
class ListTr... | {
"content_hash": "d760457f7797791f058c5bbaedae249d",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 113,
"avg_line_length": 50.91752577319588,
"alnum_prop": 0.5739015995140717,
"repo_name": "amiller87/puracore",
"id": "f761c4162e919a662217e7dc3c2d1962d81fa2d4",
"size": "... |
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from math import log
from statistics import variance
import time
from random import randint
# Create a time stamp for data logging
def timestamp():
# Get current time
t = time.localtime()
stamp = str(t.tm_ye... | {
"content_hash": "24ad33b154454c85c1b2a0683644a49b",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 118,
"avg_line_length": 30.341040462427745,
"alnum_prop": 0.5717914523401283,
"repo_name": "mcm7f/thesis",
"id": "72436ea04b0f8847b0ca43578dafa8ebdcd87701",
"size": "15878... |
"""Python source file include Penguin pipeline functions and necessary utils.
The utilities in this file are used to build a model with scikit-learn.
This module file will be used in Transform and generic Trainer.
"""
import os
import pickle
from typing import Tuple
import absl
import numpy as np
from sklearn.neural... | {
"content_hash": "ead2d1985f1b9e24d9c832785ec4539a",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 80,
"avg_line_length": 32.378151260504204,
"alnum_prop": 0.7093174150012976,
"repo_name": "tensorflow/tfx",
"id": "6bd421128605f8e5f927463d7dca92b15a16b6f0",
"size": "4450... |
import mock
from oslo_config import cfg
from neutron.common import exceptions as n_exc
from neutron import manager
from neutron.plugins.common import constants
from neutron.services import provider_configuration as provconf
from neutron.tests import base
class ParseServiceProviderConfigurationTestCase(base.BaseTest... | {
"content_hash": "70875740cba31991b19ec1bf6b595f5e",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 77,
"avg_line_length": 42.22,
"alnum_prop": 0.5605163429654192,
"repo_name": "chitr/neutron",
"id": "21531a41a90d5856d1df87d48f127197e65cb707",
"size": "9070",
"binary":... |
from kivy.uix.widget import Widget
from kivy.uix.image import Image
from app.MainController import MainController
WINDOW_SIZE = 400, 768
BUTTON_SPACING = 16
class MainUI(Widget):
def __init__(self, **kwargs):
super(MainUI, self).__init__(**kwargs)
self.controller = MainController(window_size=WIND... | {
"content_hash": "9eab616da552479c711edd5a0792f1bb",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 126,
"avg_line_length": 47.627450980392155,
"alnum_prop": 0.6904075751337999,
"repo_name": "dandro/kivy_timetracker",
"id": "80d024e0490fa6774c8d721deac5358d1fa228b8",
"si... |
from django.db import models
from model_utils.managers import InheritanceManager
# Create your models here.
class User(models.Model):
class Meta:
verbose_name = "使用者(User)"
account = models.CharField("登入帳號", max_length=30, unique=True)
name = models.CharField("姓名", max_length=10)
nickname = mo... | {
"content_hash": "3c9805e30a52ada1b60344e2462411d7",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 120,
"avg_line_length": 33.90298507462686,
"alnum_prop": 0.6266784063394233,
"repo_name": "noracami/track-it",
"id": "881a78271e3d6a4d660d0a306cf690dccb3bc293",
"size": "4... |
import sys
### smithwaterman.py ###
# A very basic Smith-Waterman alignment
# Input: two sequences
# Output: Print a local alignment with the starting nucleotide of each sequence before each sequence
# Modifies: STDOUT
maxgap = 10
gapopen = -5
gapextend = -5
match = 10
mismatch = -5
#### print_matrix ###
# Input: A... | {
"content_hash": "23ceef20a2e14290ffc0ea8924335e91",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 228,
"avg_line_length": 26.386138613861387,
"alnum_prop": 0.6307692307692307,
"repo_name": "jason-weirather/Au-public",
"id": "fc06b9535c4203a85408847f6eed3fba14a8aa04",
"... |
import os
import shutil
import tempfile
import pytest
from sprinter.next.environment.injections import Injections
TEST_CONTENT = """
Testing abc.
#OVERRIDE
here is an override string. it should appear at the bottom.
#OVERRIDE
"""
TEST_OVERRIDE_CONTENT = """
Testing abc.
#testinjection
injectme
#testinjection
#OVE... | {
"content_hash": "baf5a7fcabc01c5dfd941ae023e6b00d",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 86,
"avg_line_length": 29.935294117647057,
"alnum_prop": 0.6989585380231873,
"repo_name": "toumorokoshi/sprinter",
"id": "1040b8e6e4ddd9e7e1f1acffad865e2269f3f4d2",
"size"... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class MerkleBlockTest(BitcoinTestFramework):
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 4)
def setup_network(self)... | {
"content_hash": "aebbe252fffaa1e59e91cba995248c9c",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 120,
"avg_line_length": 48.063291139240505,
"alnum_prop": 0.6494601000790098,
"repo_name": "willwray/dash",
"id": "a11608777d64d81ce0426b443644063c58c65de9",
"size": "4053"... |
import sys
import os
import subprocess
import time
from datetime import datetime
import shutil
import tempfile
import hashlib
import re
import logging
import argparse
################
#### InfluxDB Variables
################
# Packaging variables
PACKAGE_NAME = "influxdb"
INSTALL_ROOT_DIR = "/usr/bin"
LOG_DIR = "/var... | {
"content_hash": "aae535e077869b989fef9e4d81d587d6",
"timestamp": "",
"source": "github",
"line_count": 989,
"max_line_length": 135,
"avg_line_length": 42.05460060667341,
"alnum_prop": 0.520196191575303,
"repo_name": "rjtsdl/acs-engine",
"id": "3f41b0e120d295870c41338607fea0ff6ab5d75c",
"size": "41... |
"""Cholesky decomposition functions."""
from numpy import asarray_chkfinite
# Local imports
from misc import LinAlgError, _datacopied
from lapack import get_lapack_funcs
__all__ = ['cholesky', 'cho_factor', 'cho_solve', 'cholesky_banded',
'cho_solve_banded']
def _cholesky(a, lower=False, overwrite_a=Fa... | {
"content_hash": "fa9da25b51b2c44dc8a8bd37125b4b57",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 81,
"avg_line_length": 30.59259259259259,
"alnum_prop": 0.5839386602098466,
"repo_name": "lesserwhirls/scipy-cwt",
"id": "cb14cb466f267e0328026bec570e51c023fd21d0",
"size"... |
import datetime
from django import forms
from django.test import TestCase
from .models import Article
class FormsTests(TestCase):
# ForeignObjects should not have any form fields, currently the user needs
# to manually deal with the foreignobject relation.
class ArticleForm(forms.ModelForm):
... | {
"content_hash": "6e67d968ddcac8a875a578181a0b716d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 89,
"avg_line_length": 38.86206896551724,
"alnum_prop": 0.639751552795031,
"repo_name": "yephper/django",
"id": "edcf633ee597c239ccbe262c4e10d6a880f55910",
"size": "1127",
... |
"""Tests for corrupted MNIST."""
from tensorflow_datasets import testing
from tensorflow_datasets.image_classification import mnist_corrupted
class MNISTCorruptedTest(testing.DatasetBuilderTestCase):
BUILDER_CONFIG_NAMES_TO_TEST = ["dotted_line"]
DATASET_CLASS = mnist_corrupted.MNISTCorrupted
SPLITS = {
... | {
"content_hash": "f53a7ad0d087279954591365848e92a1",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 21.36842105263158,
"alnum_prop": 0.7044334975369458,
"repo_name": "tensorflow/datasets",
"id": "512dacc31f4eb6a6d14e520e9a96e2c09a6c92e9",
"size": "1... |
import inspect
import os
import sys
import traceback
from time import sleep
scriptdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
maindir = os.path.abspath(os.path.join(scriptdir, '../../'))
sys.path.append(maindir)
transitionsdir = os.path.abspath(os.path.join(scriptdir, '../../transit... | {
"content_hash": "8e89097f5a8340cf63173695b1f61dd9",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 133,
"avg_line_length": 37.26923076923077,
"alnum_prop": 0.5366357069143447,
"repo_name": "soumyanishan/azure-linux-extensions",
"id": "3fb8a40c809d984d1ac1ccaf4d6c789ebcf13... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from rest_framework import routers
router = routers.DefaultRouter()
import methods.routers
import proteomics.routers
import phosphoproteomics.routers
urlpatterns = [
url(r"^", include(router.urls)),
url(r"^v1/", include(rou... | {
"content_hash": "3b0c816de27d81e24c0cca89096f37eb",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 83,
"avg_line_length": 28.529411764705884,
"alnum_prop": 0.7298969072164948,
"repo_name": "naderm/django_rest_omics",
"id": "0b7e7952581b91b856fe10d1ca1a8525f78d81a2",
"siz... |
"""Numpy-related utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.util.tf_export import tf_export
@tf_export('keras.utils.to_categorical')
def to_categorical(y, num_classes=None):
"""Converts a class... | {
"content_hash": "26281a943896a16c46a82a680940b6ad",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 67,
"avg_line_length": 28.32075471698113,
"alnum_prop": 0.6722185209860093,
"repo_name": "Xeralux/tensorflow",
"id": "a611be08aaed824ebb278b4b28ef52ea1872563b",
"size": "21... |
import threading
import Queue
# A simple in memory message bus
class Subscriber(object):
def __init__(self, name):
self._name = name
@property
def name(self):
return self._name
def notify(self, message):
print("{} got notified for {}".format(self._name, message))
class Bus... | {
"content_hash": "bf92f896389ade3db9b2203401ea4703",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 67,
"avg_line_length": 25.446428571428573,
"alnum_prop": 0.5684210526315789,
"repo_name": "gangtao/pyflow",
"id": "430609c89c73553226317344d3786f3b601f7fae",
"size": "1425"... |
"""Device tracker platform that adds support for OwnTracks over MQTT."""
from homeassistant.components.device_tracker import (
ATTR_BATTERY,
ATTR_GPS,
ATTR_GPS_ACCURACY,
ATTR_LOCATION_NAME,
)
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.dev... | {
"content_hash": "bc2ca9b258d37ea4a13822ff6ac7ff2a",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 85,
"avg_line_length": 28.448051948051948,
"alnum_prop": 0.6165259073270942,
"repo_name": "Danielhiversen/home-assistant",
"id": "1deebf6b5316566bdb248245208d4a22fe41096c",
... |
from __future__ import print_function,division
import numpy as np
import time
def calc_pi():
"""A crude (even for python) implentation of monte pi
"""
Nsample=100000000
x = np.random.rand(Nsample)
y = np.random.rand(Nsample)
count = np.sum(np.sqrt(x**2+y**2)<1)
return 4*count/Nsample
i... | {
"content_hash": "e92d103bb3e0f924108b2ecc067f4147",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 57,
"avg_line_length": 23.85,
"alnum_prop": 0.6037735849056604,
"repo_name": "samjcus/pragma_pragma_pragma",
"id": "65477c66d2b0fd00b882021a86437dba817df91c",
"size": "477"... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def MigrationWarningEvent(vim, *args, **kwargs):
'''A migration warning.'''
obj =... | {
"content_hash": "f80b7b50a039038713f809421b663cc4",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 124,
"avg_line_length": 34.54545454545455,
"alnum_prop": 0.5921052631578947,
"repo_name": "xuru/pyvisdk",
"id": "502b6e0a14c94dd21a9a0087bead3d02486e9ba7",
"size": "1141",
... |
default_app_config = 'banners.apps.BannersAppConfig'
| {
"content_hash": "295d995955c38139c3e2a6606cfcb8a5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 52,
"avg_line_length": 53,
"alnum_prop": 0.8113207547169812,
"repo_name": "python/pythondotorg",
"id": "010b54570df8c48f47439ca17c77ede3db4a785c",
"size": "53",
"binary": ... |
"""xml2json.py Convert XML to JSON
Relies on ElementTree for the XML parsing. This is based on
pesterfish.py but uses a different XML->JSON mapping.
The XML->JSON mapping is described at
http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html
Rewritten to a command line utility by Hay Kranen < gith... | {
"content_hash": "7031b5ec2689fc5f29709ff6589bb365",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 131,
"avg_line_length": 29.858870967741936,
"alnum_prop": 0.5904118838622552,
"repo_name": "pokowaka/dhammapada-ionic",
"id": "7657b9d377328d782c7b249ae414b0df4c79356b",
"... |
from django.contrib import admin
from paypal.standard.ipn.models import PayPalIPN
class PayPalIPNAdmin(admin.ModelAdmin):
date_hierarchy = 'payment_date'
fieldsets = (
(None, {
"fields": [
"flag", "txn_id", "txn_type", "payment_status", "payment_date",
... | {
"content_hash": "34bb82295a2446672e1da6904c8b7834",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 80,
"avg_line_length": 37.582089552238806,
"alnum_prop": 0.4670373312152502,
"repo_name": "bluestemscott/librarygadget",
"id": "3f0423091440b1cb6a2e35ed05651007f037f882",
"... |
from keys import key_patterns
class Bindings(object):
def __init__(self, key_patterns):
self._tag_to_key_labels = {}
self._tag_to_help = {}
self._key_label_to_tag = {}
self._key_patterns = key_patterns
self._cache_keycode_to_tag = {}
def get_tag(self, keycode):
... | {
"content_hash": "ece9e25cef3f5c7bf13aad5d61dae093",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 98,
"avg_line_length": 36.488,
"alnum_prop": 0.588467441350581,
"repo_name": "yosinski/deep-visualization-toolbox",
"id": "7de7f9dfd9b5a216da9d52c5eb90c2ebf94f6462",
"size... |
import hashlib
import sys
import time
import traceback
import json
from typing import Optional
import certifi
import urllib.parse
import aiohttp
try:
from . import paymentrequest_pb2 as pb2
except ImportError:
sys.exit("Error: could not find paymentrequest_pb2.py. Create it with 'protoc --proto_path=electrum... | {
"content_hash": "ec2d69093440b071d0c7447121de58c6",
"timestamp": "",
"source": "github",
"line_count": 547,
"max_line_length": 160,
"avg_line_length": 35.26508226691042,
"alnum_prop": 0.5759460860549508,
"repo_name": "fujicoin/electrum-fjc",
"id": "fedcd1b3a14e6ea73aa71c2f7a2d847bd132e710",
"size"... |
import json
import tempfile
from preggy import expect
from tests.base import TestCase
from thumbor import __version__
from thumbor.config import Config
from thumbor.context import ServerParameters
from thumbor.error_handlers.file import ErrorHandler
class FakeRequest:
def __init__(self):
self.headers = ... | {
"content_hash": "35b861dfaab6948937ba9b7e2d0e07a5",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 81,
"avg_line_length": 30.93959731543624,
"alnum_prop": 0.5036876355748373,
"repo_name": "thumbor/thumbor",
"id": "88647bc5fc66ee0a72b9692e3150513f008c40f5",
"size": "4862... |
scope = "System"
description = """
This role grants a user basic object creation and editing permission.
"""
permissions = {
"read": [
"AccessControlList",
"Audit",
"Snapshot",
"Categorization",
"Category",
"Comment",
"ControlCategory",
"ControlAss... | {
"content_hash": "f84afdadda7bfe436810e20f1454b598",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 71,
"avg_line_length": 21.91703056768559,
"alnum_prop": 0.42657899980075714,
"repo_name": "AleksNeStu/ggrc-core",
"id": "495a6dd8a57b24a717ea34b69b9c4658eefcf9e3",
"size":... |
from glob import glob
from os import path
import argparse
import logging
import sys
log = logging.getLogger("bsdploy")
# register our own library and roles paths into ansible
bsdploy_path = path.abspath(path.dirname(__file__))
ansible_paths = dict(
roles=[path.join(bsdploy_path, 'roles')],
library=[path.jo... | {
"content_hash": "d95a8b1e7378970b134a337907d16c3e",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 95,
"avg_line_length": 35.3475935828877,
"alnum_prop": 0.6355521936459909,
"repo_name": "ployground/bsdploy",
"id": "9176befb89cc9c06ead6ff48e2fac5ecdc1c5d41",
"size": "66... |
"""Tests for ljspeech dataset module."""
from tensorflow_datasets import testing
from tensorflow_datasets.audio import ljspeech
class LJSpeechTest(testing.DatasetBuilderTestCase):
DATASET_CLASS = ljspeech.Ljspeech
SPLITS = {
"train": 2,
}
if __name__ == "__main__":
testing.test_main()
| {
"content_hash": "fa2fcbe4bec6df7b6a9e751917392f5d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 51,
"avg_line_length": 20.333333333333332,
"alnum_prop": 0.7081967213114754,
"repo_name": "tensorflow/datasets",
"id": "8b49fb2c502c5e44b293bf9a31f17a8350b7a2e1",
"size": "... |
DIRECTORIES = (
('assets', 'make public'),
('content', 'make html'),
)
| {
"content_hash": "7d4f1d5fe096f44c00cb205287e0c2ea",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 30,
"avg_line_length": 19.75,
"alnum_prop": 0.5316455696202531,
"repo_name": "reusine/bababille.com",
"id": "38213b95d4966ab21839bcc068edacfddfd18589",
"size": "79",
"bina... |
from django.test import TestCase
from django.contrib.admin.sites import AdminSite
from bejmy.users.models import User
from bejmy.users.admin import UserAdmin
class MockRequest:
pass
# class MockSuperUser:
# def has_perm(self, perm):
# return True
request = MockRequest()
# request.user = MockSuper... | {
"content_hash": "8b7cad4e40358dc7d5e56ee560e919f6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 69,
"avg_line_length": 21.3125,
"alnum_prop": 0.6642228739002932,
"repo_name": "bejmy/backend",
"id": "6f2c768ec57e912474c717e9bcc333af78603852",
"size": "682",
"binary":... |
import re
from robot.utils import NormalizedDict
from .criticality import Criticality
from .stats import TagStat, CombinedTagStat
from .tags import TagPatterns
class TagStatistics(object):
"""Container for tag statistics."""
def __init__(self, combined_stats):
#: Dictionary, where key is the name o... | {
"content_hash": "f918ebf4452904a5f2c5e93ff770ce2c",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 78,
"avg_line_length": 33.86363636363637,
"alnum_prop": 0.602013422818792,
"repo_name": "synsun/robotframework",
"id": "e50439c0ea053fc406127bb04eba57d8804f6ebe",
"size": ... |
import re
import pytest
from mimesis.data import EXTENSIONS, MIME_TYPES
from mimesis.enums import FileType, MimeType
from mimesis.exceptions import NonEnumerableError
from mimesis.providers.file import File
from . import patterns
class TestFile:
@pytest.fixture
def file(self):
return File()
def... | {
"content_hash": "138f54007c1268fe18cb9ebaa5be00b8",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 87,
"avg_line_length": 26.878504672897197,
"alnum_prop": 0.5782336578581363,
"repo_name": "lk-geimfari/elizabeth",
"id": "5171b4cf3643362cefea023cf2fc5603fab307a7",
"size"... |
'''This module will help in automating process of
execution of spider and will set appropriate setting.
You can set User Agent to random value for every
time spider will crawl, this will reduce chance of
getting banned.
'''
import sys
from os import path
sys.path.append( path.dirname( path.dirname( ... | {
"content_hash": "e3a20d8193e0264c335d885493116c94",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 142,
"avg_line_length": 39.57142857142857,
"alnum_prop": 0.7025270758122744,
"repo_name": "puchchi/stock_scraper_latest",
"id": "5e6af6111651027d705d351c1bf61933e7686478",
... |
"""Unittests for pushimage.py"""
from __future__ import print_function
import mock
import os
from chromite.lib import cros_build_lib
from chromite.lib import cros_test_lib
from chromite.lib import gs
from chromite.lib import gs_unittest
from chromite.lib import osutils
from chromite.lib import partial_mock
from chro... | {
"content_hash": "5d99b25dccdec5c5f8d555066423ae5e",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 77,
"avg_line_length": 33.376068376068375,
"alnum_prop": 0.6385403329065301,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "76618e4613f47296713a44b5efa2e4cc8e96316... |
import sys,os
hashMap = dict()
for line in sys.stdin:
data = line.split("\t")
tableName = data[0]
columnName = data[1].rstrip('\n')
if tableName == "TABLE_NAME":
continue
if tableName in hashMap:
hashMap[tableName] = hashMap[tableName] + [columnName]
else:
hashMap[ta... | {
"content_hash": "a66f52769664131934e6387a4eabab5a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 62,
"avg_line_length": 21.233333333333334,
"alnum_prop": 0.5777080062794349,
"repo_name": "hansfilipelo/tddd37",
"id": "0df7a98127efb93766d69bab5a753a2f52b14792",
"size": "... |
from django.contrib import admin
from Course.models import Enrollment, Assignment
admin.site.register(Enrollment)
admin.site.register(Assignment) | {
"content_hash": "9f0e05e7e00ff0acefb29f7b11fdbbcd",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 48,
"avg_line_length": 24.5,
"alnum_prop": 0.8435374149659864,
"repo_name": "RedBulli/CourseDeadlines",
"id": "1886301e0a5189ee9265dbaa6313298549f210e3",
"size": "147",
"b... |
import unittest
from flask.ext.toybox.sqlalchemy import SAModelMixin, SAModelView, SACollectionView, PaginableByNumber, QueryFiltering
from flask.ext.toybox.permissions import make_I
from flask.ext.toybox import ToyBox
from flask import Flask, g, request
from sqlalchemy import create_engine
from sqlalchemy.orm import ... | {
"content_hash": "54a31b5d7ed001092c50023db49825e9",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 144,
"avg_line_length": 43.17829457364341,
"alnum_prop": 0.5914721723518851,
"repo_name": "drdaeman/flask-toybox",
"id": "1cd16bcf4620a8beaf72c42185b931a975bd3e12",
"size"... |
class Options:
def __init__(self, restoreWindow, restoreFont, restoreSession, blink):
self.restoreWindow = restoreWindow
self.restoreFont = restoreFont
self.restoreSession = restoreSession
self.blink = blink
def __str__(self):
return ("restoreWindow={} re... | {
"content_hash": "6fbf8872384582354b58f0a3494e8e7a",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 74,
"avg_line_length": 31.866666666666667,
"alnum_prop": 0.6108786610878661,
"repo_name": "nwiizo/workspace_2017",
"id": "dff9d9d4dcbd88150c99698d223c232b7b890a7f",
"size":... |
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class Goodbye(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Goodbye()
x.Init(buf, n + offset)
... | {
"content_hash": "2123dcde9953aab222b72ef6a3eb3cc7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 139,
"avg_line_length": 36.206896551724135,
"alnum_prop": 0.6871428571428572,
"repo_name": "oberstet/autobahn-python",
"id": "e9de961913eef94aa1439545e1a69f2becffbc5b",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.