text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
import numpy as np
from plotting import path_figure
from fixtures import robot_arm1
class TestPlotting(unittest.TestCase):
def setUp(self):
self.robot_arm = robot_arm1
n = len(self.robot_arm.lengths)
s = len(self.robot_arm.destinations[0])
total_joints = n * s
... | {
"content_hash": "f320f5c4cb995051bd0310f825dc66f2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 89,
"avg_line_length": 37.12,
"alnum_prop": 0.6885775862068966,
"repo_name": "JakobGM/robotarm-optimization",
"id": "04f1a753487de85a1b20e57c0927fdc466542015",
"size": "928... |
import os
def match(command, settings):
return os.path.exists(command.script.split()[0]) \
and 'command not found' in command.stderr
def get_new_command(command, settings):
return u'./{}'.format(command.script)
| {
"content_hash": "1639be23096f1d6f5d5672a870360af3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 54,
"avg_line_length": 21.09090909090909,
"alnum_prop": 0.6810344827586207,
"repo_name": "dionyziz/thefuck",
"id": "4ceac489ded0d6acb9543172aec391e67351f8d5",
"size": "232"... |
from tempest.lib.common.utils import data_utils
from functional.tests.identity.v2 import test_identity
class ProjectTests(test_identity.IdentityTests):
def test_project_create(self):
project_name = data_utils.rand_name('TestProject')
description = data_utils.rand_name('description')
raw_... | {
"content_hash": "bd20926f33ba12dd6e8dac9081cf3d95",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 76,
"avg_line_length": 38.32432432432432,
"alnum_prop": 0.5863892806770099,
"repo_name": "redhat-openstack/python-openstackclient",
"id": "e9580ecfb675eaf62ed3fcfa6f6ac1c8a09... |
import sublime, sublime_plugin
import subprocess
import re, os, os.path
import itertools
from User.build import *
from User.output import *
import traceback
def make_build_system_name(system, variant):
if system.endswith('.'):
return "{} - {}".format(system[:-1], variant)
else:
return "{} - {}"... | {
"content_hash": "4af1968f7cdaedc8aec7d3ebefb5f4e9",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 103,
"avg_line_length": 31.02686567164179,
"alnum_prop": 0.5793727150279007,
"repo_name": "ciechowoj/minion",
"id": "24b2b0cd1786d5688ee655481cf27b0351c175c8",
"size": "10... |
class DeploymentModificationState(object):
STARTED = 'started'
FINISHED = 'finished'
ROLLEDBACK = 'rolledback'
STATES = [STARTED, FINISHED, ROLLEDBACK]
END_STATES = [FINISHED, ROLLEDBACK]
class SnapshotState(object):
CREATED = 'created'
FAILED = 'failed'
CREATING = 'creating'
UPLO... | {
"content_hash": "c26167adef7ddc2888bb0dce062e4205",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 28.09375,
"alnum_prop": 0.6718576195773082,
"repo_name": "isaac-s/cloudify-manager",
"id": "3ea36d123edad7b50f0074bbffaa475821302880",
"size": "1538"... |
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa:... | {
"content_hash": "3960271abebac6ec48f67690e41a09b1",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 89,
"avg_line_length": 35.54054054054054,
"alnum_prop": 0.5779467680608364,
"repo_name": "onshape-public/onshape-clients",
"id": "b7974c2db15749c7b29d5b962b7b84118feb6370",
... |
'''
based on solution 2 of the link: http://www.cnblogs.com/grandyang/p/4635425.html
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @return {boolean}
def isPalindrome(se... | {
"content_hash": "006f76e3a6d1e1b586761071b3e2570a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 82,
"avg_line_length": 24.10810810810811,
"alnum_prop": 0.5179372197309418,
"repo_name": "Chasego/codi",
"id": "cf0f65f6cbd23fcd9221b5f94da143102f5f6bf4",
"size": "892",
... |
class Authentication:
def __init__(self, userid, password):
self._userid=userid
self._password=password
self._token=None
def get_token(self):
return self._token
def set_token(self, token):
self._token=token
| {
"content_hash": "ac4aabf09ad541000523fbd03075a939",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 39,
"avg_line_length": 20.5,
"alnum_prop": 0.6382113821138211,
"repo_name": "brython-dev/brython-in-the-classroom",
"id": "8333449e97a8acb90e81e5bc9ec9d194ca98df4d",
"size"... |
import unittest
import rover.config
from StringIO import StringIO
class RepoInfoTest(unittest.TestCase):
def test_github_repo_info(self):
repo = rover.config.RepoInfo("github, git, git://github.com/")
self.assertEqual("github", repo.name)
self.assertEqual("git", repo.vcs)
self.ass... | {
"content_hash": "f2d3f689e30c4c0cd7923c0718445d3e",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 78,
"avg_line_length": 32.689655172413794,
"alnum_prop": 0.6239451476793249,
"repo_name": "amplify-education/rover",
"id": "2e64f7444d9e08579f3cd7d487210c947222adc2",
"size... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
ex... | {
"content_hash": "b9539ef460f5fd9bf3fdee69f8003f77",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 384,
"avg_line_length": 51.010714285714286,
"alnum_prop": 0.6806693271721627,
"repo_name": "lakewik/storj-gui-client",
"id": "2f91c24c90299fc9386f3c4eeaaa28e1b71e4624",
"s... |
"""Tests for an actual dns resolution."""
import logging
import unittest
import grpc
from tests.unit import test_common
from tests.unit.framework.common import test_constants
_METHOD = '/ANY/METHOD'
_REQUEST = b'\x00\x00\x00'
_RESPONSE = _REQUEST
class GenericHandler(grpc.GenericRpcHandler):
def service(self... | {
"content_hash": "5d1fbea9fc83de672cbed5a752300fcd",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 72,
"avg_line_length": 31,
"alnum_prop": 0.6260454002389486,
"repo_name": "stanley-cheung/grpc",
"id": "f4196aaaac16963a4545bd1250218fb21de859d1",
"size": "2254",
"binary... |
import binascii
import struct
import logging
logger = logging.getLogger(__name__)
import string
from counterpartylib.lib import (config, exceptions, util, message_type)
from . import rps
# move random rps_match_id
FORMAT = '>H16s32s32s'
LENGTH = 2 + 16 + 32 + 32
ID = 81
def initialise (db):
cursor = db.cursor()
... | {
"content_hash": "4c453318f83023bfdff6cac7c855d708",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 147,
"avg_line_length": 38.765306122448976,
"alnum_prop": 0.6079231376678074,
"repo_name": "CounterpartyXCP/counterparty-lib",
"id": "c56f21c9e951824b9a2a2cbb117f8415cb8d683... |
import os
import shutil
import tempfile
import unittest
import logging
from oyProjectManager.models.auth import User
class ConfigTester(unittest.TestCase):
"""test the system configuration
"""
def setUp(self):
"""setup the test
"""
logger = logging.getLogger("oyProjectManager"... | {
"content_hash": "b076af66a3d2187dcadbd0054c5afda7",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 82,
"avg_line_length": 40.338235294117645,
"alnum_prop": 0.5589986632640661,
"repo_name": "code-google-com/oyprojectmanager",
"id": "df90c632541a27bf4d3fab5e7db85a8b5dd3c81c... |
"""Test the setban rpc call."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
connect_nodes,
p2p_port
)
class SetBanTests(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.setup_clean_chain = True
self.extr... | {
"content_hash": "a969cbe8a78650eb8cabe0ec1e2deda0",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 93,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.6069711538461539,
"repo_name": "cculianu/bitcoin-abc",
"id": "89b7c1d079306ff3790f97a927bbfe2ca6bb7c27",
"size": ... |
import logging
import os
import re
import tempfile
import zipfile
from django import forms
from django.template.defaultfilters import slugify
from django.core.files import File
from dali.gallery.models import Gallery, Picture
class ZipFileForm(forms.Form):
gallery = forms.ModelChoiceField(queryset=Gallery.object... | {
"content_hash": "14912fce0968f909f9e4f19cfa314c1a",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 85,
"avg_line_length": 29.60185185185185,
"alnum_prop": 0.5877385048482953,
"repo_name": "varikin/dali",
"id": "0bfa96e38af7d22cbd934c4cc6380ecfe81158cd",
"size": "3197",
... |
import ljd.ast.nodes as nodes
import ljd.ast.traverse as traverse
def mark_locals(ast):
traverse.traverse(_LocalsMarker(), ast)
def mark_local_definitions(ast):
traverse.traverse(_LocalDefinitionsMarker(), ast)
class _LocalsMarker(traverse.Visitor):
class _State():
def __init__(self):
self.pending_slots =... | {
"content_hash": "04e8f60ae7432fd2ae5a71a8cfd8c287",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 65,
"avg_line_length": 21.99074074074074,
"alnum_prop": 0.6791578947368421,
"repo_name": "mrexodia/ljd",
"id": "00fdb26ffbb76d69a9b2c00dca531e232a0f24fa",
"size": "4823",
... |
import sys, os
from datetime import datetime
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath(... | {
"content_hash": "81ea660260e7382aa2b3e99dc03b7fab",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 80,
"avg_line_length": 32.66197183098591,
"alnum_prop": 0.7089262613195343,
"repo_name": "iGaskin/TMS_Alert",
"id": "ef215b92e88981827ca1c0158fcd59bee1748e1b",
"size": "73... |
import base64
from Crypto.Cipher import AES
from Crypto import Random
from Crypto.Hash import SHA256
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s: s[:-ord(s[len(s)-1:])]
class AESCipher:
def __init__(self, key):
self.key = key
def encrypt(self, raw):
... | {
"content_hash": "b64235e08c1faf12ccecc4cf958b4bb1",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 62,
"avg_line_length": 26.26923076923077,
"alnum_prop": 0.595900439238653,
"repo_name": "tghack/tg17hack",
"id": "0b204b977e5307345c9aa72ec7362539da1b725d",
"size": "683",
... |
"""Nova base exception handling.
Includes decorator for re-raising Nova-type exceptions.
SHOULD include dedicated exception logging.
"""
import functools
import inspect
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import six
import webob.exc
from webob ... | {
"content_hash": "bf8b81b7a136cb9165d8807aa7f6f4f7",
"timestamp": "",
"source": "github",
"line_count": 2108,
"max_line_length": 79,
"avg_line_length": 29.25189753320683,
"alnum_prop": 0.6707750190551871,
"repo_name": "CEG-FYP-OpenStack/scheduler",
"id": "d12b42d0b76d2fc895d2a833b35c1a67c3fa6584",
... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.views.dec... | {
"content_hash": "e9e58000302a0ab695c0791876994fc4",
"timestamp": "",
"source": "github",
"line_count": 467,
"max_line_length": 340,
"avg_line_length": 39.974304068522486,
"alnum_prop": 0.5620848510820655,
"repo_name": "agepoly/truffe2",
"id": "fe021492f8e3ca9a6d6112b7cf45250a58828336",
"size": "18... |
"""
Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | {
"content_hash": "c516a1c50f1bec8afb5ef1e3788065c2",
"timestamp": "",
"source": "github",
"line_count": 753,
"max_line_length": 126,
"avg_line_length": 41.091633466135455,
"alnum_prop": 0.5325770796974986,
"repo_name": "google-research/DBAP-simulation",
"id": "8b5ccbd1303a4364301fba867db246da8ccd4506... |
from . import packer
def define():
tabledef = packer.TableDef('_permission')
tabledef.define('uint16', 'id')
tabledef.define('uint8', 'state')
tabledef = packer.TableDef('_destroy')
tabledef.define('uint16', 'id')
tabledef = packer.TableDef('_GameObject')
tabledef.define('uint16', 'id')
... | {
"content_hash": "b8aa6203df4a0a443e04043b1cdefd32",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 69,
"avg_line_length": 31.357142857142858,
"alnum_prop": 0.6309794988610479,
"repo_name": "pqftgs/bge-netplay",
"id": "4e4ed38bffae0105c2a2ee4e532e31d83787e023",
"size": "8... |
"""A module for extracting properties from Python dicts.
A property is a string that represents a value in a JSON-serializable
dict. For example, "x.y" matches 1 in {'x': {'y': 1, 'z': 2}, 'y': [1,
2, 3]}.
See PropertySelector and PropertyGetter's docstrings for example
usage.
The grammar for properties is as follow... | {
"content_hash": "51239a58469e5c942b2379cb77716e5d",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 80,
"avg_line_length": 27.183937823834196,
"alnum_prop": 0.6200324025540837,
"repo_name": "KaranToor/MA450",
"id": "c0e773f1befe884f09e5cd6f70aa8d204999d1ed",
"size": "110... |
"""Test the SlimProto Player config flow."""
from unittest.mock import AsyncMock
from homeassistant.components.slimproto.const import DEFAULT_NAME, DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from tes... | {
"content_hash": "c21357a46487eefdca00245e47ee44e3",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 88,
"avg_line_length": 33.55263157894737,
"alnum_prop": 0.7231372549019608,
"repo_name": "mezz64/home-assistant",
"id": "15ea5434fc58cf25910491aa90260a3451a490dd",
"size": ... |
"""
Import related utilities and helper functions.
"""
import sys
import traceback
def import_class(import_str):
"""Returns a class from a string including module and class."""
mod_str, _sep, class_str = import_str.rpartition('.')
__import__(mod_str)
try:
return getattr(sys.modules[mod_str], ... | {
"content_hash": "7d3d4602af5f8b7e272a21e9dbae71fd",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 72,
"avg_line_length": 29.724137931034484,
"alnum_prop": 0.6438515081206496,
"repo_name": "tanglei528/glance",
"id": "b01a7cb46a20ccb56d1d858fc6ed95a5e401a365",
"size": "23... |
from libra.repository.mongodb.mongodb import Repository
from libra.repository.mongodb.orm import Collection, Property, PropertyDict
__all__ = (
"Repository",
"Collection",
"Property",
"PropertyDict"
)
| {
"content_hash": "c00542d5146167bd3a31024c0807b396",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 24.22222222222222,
"alnum_prop": 0.7201834862385321,
"repo_name": "pitomba/libra",
"id": "3c216aa98484acf70a33185e750feaa7da44b6fb",
"size": "218",
... |
"""
Fitmarket
Mali broj ljudi - donori - dijele dnevna mjerenja svoje težine. Iz dnevne težine jednog donora određujemo vrijednosti dviju dionica: - dionica X ima vrijednost koja odgovara težini donora na taj dan. - inverzna dionica ~X ima vrijednost (150 kg - X). Primjetimo da: - kako X raste, ~X pada. - ... | {
"content_hash": "46d2bf118f3b3bb49f318a8676bc104e",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 850,
"avg_line_length": 31.774725274725274,
"alnum_prop": 0.5868926162891233,
"repo_name": "brahle/fitmarket-python-api",
"id": "41be6cb8c6d50df36396c07326e511bfe3892086",
... |
import unittest
import mock
from django.forms import ValidationError
from ..forms import ResetForm
from .. import strings
class ResetFormTestCase(unittest.TestCase):
@mock.patch('authentication.forms.forms.Form.clean')
@mock.patch('authentication.forms.User')
def test_clean_should_return_super(self, use... | {
"content_hash": "3b403e0ae83668577998270e9fef1c78",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 71,
"avg_line_length": 33.06382978723404,
"alnum_prop": 0.6550836550836551,
"repo_name": "hellhovnd/dentexchange",
"id": "8f67df1fab33aaa4cbd5e4367502ec785427f057",
"size":... |
import os
import pytest
from engines import BingEngine, DuckgoEngine, FarooEngine, YandexEngine
from engines.base import EngineBase, ResultItemBase
bing = BingEngine(api_key=os.environ["BING_API_KEY"])
duckduckgo = DuckgoEngine()
faroo = FarooEngine(api_key=os.environ["FAROO_API_KEY"])
yandex = YandexEngine(
... | {
"content_hash": "812c62e5efde321ab888cc8d963cceaa",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 71,
"avg_line_length": 27.241935483870968,
"alnum_prop": 0.670219064535228,
"repo_name": "axknightroad/metasearch",
"id": "8621b0c32aef2d024f54cf4e013110f303da56e7",
"size"... |
"""\
Update files with AWS metadata
"""
import json
import logging
import transaction
from pyramid.paster import get_app
from pyramid.threadlocal import manager
from pyramid.testing import DummyRequest
EPILOG = __doc__
logger = logging.getLogger(__name__)
def run(app, files):
root = app.root_factory(app)
c... | {
"content_hash": "97849e83f6d51a28d8368df96a8aaee4",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 115,
"avg_line_length": 31.76923076923077,
"alnum_prop": 0.6146085552865214,
"repo_name": "4dn-dcic/fourfront",
"id": "8e6b658db92bda02ee4c9b05f394acb09eb62dc7",
"size": "2... |
import discord
from discord.ext import commands
from cogs.utils import checks
from __main__ import set_cog
from .utils.dataIO import dataIO
from .utils.chat_formatting import pagify, box
import importlib
import traceback
import logging
import asyncio
import threading
import datetime
import glob
import os
import aiohtt... | {
"content_hash": "10c5a6b56e75d89187f63e2884799483",
"timestamp": "",
"source": "github",
"line_count": 929,
"max_line_length": 109,
"avg_line_length": 37.29817007534984,
"alnum_prop": 0.5436652236652236,
"repo_name": "lsomers984/Chronoxia---Final-Year-Project",
"id": "949adcdb3531c4565426d446ee1bd05... |
"""Classes for stats-related testing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import contextlib
import mock
from grr_response_core.lib.util import precondition
from grr_response_core.stats import metrics
from grr_response_core.stats import stat... | {
"content_hash": "4e600c700a6150449a8abe3542e158bb",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 32.21212121212121,
"alnum_prop": 0.7121354656632173,
"repo_name": "dunkhong/grr",
"id": "7391fc2dfe4e5ce43f403341e4391fb0fd1c7db6",
"size": "2148",
... |
import sys, os
sys.path.insert(0, os.path.abspath('../../'))
import sphinx_bootstrap_theme
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like s... | {
"content_hash": "4c0127377b907f3adaa23812dae815c2",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 100,
"avg_line_length": 33.153094462540714,
"alnum_prop": 0.6817645902927884,
"repo_name": "EricFromCanada/sphinx-bootstrap-theme",
"id": "99c9883c3cd14897db5fec6e2ce4170c57... |
import datetime
from django.test import TestCase
from django.utils import timezone
from oscar.test import factories
from oscar.apps.offer import models
class TestActiveOfferManager(TestCase):
def test_includes_offers_in_date_range(self):
now = timezone.now()
start = now - datetime.timedelta(day... | {
"content_hash": "f1111c7c96b50a7267036f6feff22cca",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 66,
"avg_line_length": 38.55384615384615,
"alnum_prop": 0.6779728651237031,
"repo_name": "sasha0/django-oscar",
"id": "ce610371b43c42699d292f3b1005c34461e5c978",
"size": "2... |
from __future__ import print_function
import sys
import argparse
from greatfet.utils import GreatFETArgumentParser
def main():
# Set up a simple argument parser.
parser = GreatFETArgumentParser(description="Utility for loading runtime extensions on to a GreatFET board.")
parser.add_argument('--m0', dest... | {
"content_hash": "13c3e16906d875ed7cd50cf012dc2354",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 113,
"avg_line_length": 30.77777777777778,
"alnum_prop": 0.6787003610108303,
"repo_name": "greatscottgadgets/greatfet",
"id": "20cd67e418bb2f5d2e044ab03f7af65ba2052322",
"s... |
import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
Resour... | {
"content_hash": "25424ec09673e8f2cb99f913ed83b67e",
"timestamp": "",
"source": "github",
"line_count": 442,
"max_line_length": 225,
"avg_line_length": 46.66289592760181,
"alnum_prop": 0.6641939393939394,
"repo_name": "Azure/azure-sdk-for-python",
"id": "8fb133825cc959e947a072926fdd86d022485165",
"... |
import argparse
import sys
import numpy as np
import cv2
from ds_utils.video_utils import generate_video
# see https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_video/py_lucas_kanade/py_lucas_kanade.html
def optical_flow_kanade(input_video_path):
# load input video
cap = cv2.VideoCaptur... | {
"content_hash": "f5dd5036b06dd79b473409045914c96c",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 120,
"avg_line_length": 31.08695652173913,
"alnum_prop": 0.5636363636363636,
"repo_name": "5agado/data-science-learning",
"id": "c46b424d9dc899eccfb3c0ed7065ba76227d1773",
... |
__requires__ = 'Babel==1.3'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('Babel==1.3', 'console_scripts', 'pybabel')()
)
| {
"content_hash": "bd8d4e74d91080437a5151c9098d2ec7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 70,
"avg_line_length": 25.125,
"alnum_prop": 0.5920398009950248,
"repo_name": "IuryAlves/Novos-Bandeirantes",
"id": "6df27e1514771a0f60f8f033a18d01643f981f7b",
"size": "347"... |
"""SCons.Tool.g++
Tool-specific initialization for g++.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCon... | {
"content_hash": "bf50441d4357ed9608ca3ca2bded5587",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 113,
"avg_line_length": 36.05555555555556,
"alnum_prop": 0.6533127889060092,
"repo_name": "Distrotech/scons",
"id": "c9ec40a25e9c74f04849f8cc5e83cef50e974f3d",
"size": "324... |
"""Recursive feature elimination for feature ranking"""
import numpy as np
import numbers
from joblib import Parallel, effective_n_jobs
from ..utils.metaestimators import if_delegate_has_method
from ..utils.metaestimators import _safe_split
from ..utils._tags import _safe_tags
from ..utils.validation import check_is... | {
"content_hash": "9e030644b2c317df617f2a27e161790e",
"timestamp": "",
"source": "github",
"line_count": 643,
"max_line_length": 79,
"avg_line_length": 37.54121306376361,
"alnum_prop": 0.6181283400306558,
"repo_name": "kevin-intel/scikit-learn",
"id": "b6db0e9444524385705411b023075070566e8aa0",
"siz... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nonhumanuser.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "4fdf09cff004352149ef940bac337044",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 76,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.7167381974248928,
"repo_name": "bane138/nonhumanuser",
"id": "73af4696643e9b8445ec19282925fdf34306b952",
"size": "2... |
"""Tests for streams.py."""
import gc
import os
import socket
import sys
import unittest
from unittest import mock
try:
import ssl
except ImportError:
ssl = None
import asyncio
from asyncio import test_utils
class StreamReaderTests(test_utils.TestCase):
DATA = b'line1\nline2\nline3\n'
def setUp(se... | {
"content_hash": "6eb59db8ac4d60d403b610ea5d620b99",
"timestamp": "",
"source": "github",
"line_count": 641,
"max_line_length": 78,
"avg_line_length": 36.441497659906396,
"alnum_prop": 0.5849137377456227,
"repo_name": "munyirik/python",
"id": "2273049b81577c0ded9e200cd8a26e90ff58adb8",
"size": "233... |
"""leastsq_fit.py
This example shows how to fit a PDF to data via the method of
least-squares.
"""
import matplotlib.pyplot as plt
import numpy as np
import statspy as sp
import scipy.stats
# Define the true PDF (gaussian signal on top of an exponentially falling bkg)
pdf_true_sig = sp.PF("pdf_true_sig=norm(x;mu_t... | {
"content_hash": "8d8e3e58719c571100982a56d77c830c",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 37.21917808219178,
"alnum_prop": 0.6650717703349283,
"repo_name": "bruneli/statspy",
"id": "585879986de39448045f42c49d579802bd78164e",
"size": "2739"... |
"""Test legalize pass"""
import numpy as np
import tvm
from tvm import te
from tvm import relay
from tvm.contrib import graph_executor
from tvm.relay import transform, analysis
from tvm.relay.testing.temp_op_attr import TempOpAttr
def alpha_equal(x, y):
"""
Wrapper around alpha equality which ensures that
... | {
"content_hash": "5e174a9ddad75fedc34aa9d023c88ce9",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 99,
"avg_line_length": 41.91549295774648,
"alnum_prop": 0.5512432795698925,
"repo_name": "dmlc/tvm",
"id": "a30cd1e73e3f7b0cd3a4111a117885345b67b1cc",
"size": "12689",
"... |
__author__ = 'vladimir'
from collections import OrderedDict
import traceback
import ujson
from flask import Blueprint, request
from . import *
from .database import update_query, select_query
user_blueprint = Blueprint("user", __name__, url_prefix="user")
# actually this is get_or_create method
@user_blueprint.r... | {
"content_hash": "fc6fb5e4c99a25506a294faf7156221a",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 119,
"avg_line_length": 34.704109589041096,
"alnum_prop": 0.5337491118654772,
"repo_name": "d3QUone/db_api",
"id": "737415d4c14a1b4ba78ad39c322a45ef76625f87",
"size": "126... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rpocore', '0004_auto_20160920_1232'),
]
operations = [
migrations.AlterModelOptions(
name='notablesupporter',
options={'ordering': (... | {
"content_hash": "6e71ff65d65dae0f29881a0139fa1779",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 125,
"avg_line_length": 25.235294117647058,
"alnum_prop": 0.62004662004662,
"repo_name": "frmwrk123/rpo-website",
"id": "568ab879668e21c2896c5fed08a0cf3e83f45efd",
"size": ... |
from editor.app import app
app.run()
| {
"content_hash": "bf5a77b9e1da20a5574cc4c3c1f65a2a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 26,
"avg_line_length": 12.666666666666666,
"alnum_prop": 0.7368421052631579,
"repo_name": "ludwinas/editore",
"id": "13a48eb489c705c4c811c6dd7e5e87098a3f6fdc",
"size": "63",... |
__all__ = [
'fileio', 'laplacianSmoothing', 'lar', 'matrixutil_accel',
'pklzToSmoothObj', 'smooth',
'visualization', 'import_library'
]
import data_preparation
import pklzToSmoothObj
import objToVolume
# import fileio
# import laplacianSmoothing
# import lar
# import matrixutil_accel
# import matrixutil_no_... | {
"content_hash": "5367a001e733cb66f2258cef06fd23d9",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 62,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.7732919254658385,
"repo_name": "mjirik/larVolumeToObj",
"id": "87f1eaef2dc71d67bb39b2c4d7468f7d05c9d200",
"size":... |
import six
from page_sets.system_health import platforms
from page_sets.system_health import story_tags
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry.util import wpr_modes
# Extra wait time after the page has loaded required by the loading metric. We
# us... | {
"content_hash": "9a25f240b42a20b9578ad99ead092569",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 79,
"avg_line_length": 35.21138211382114,
"alnum_prop": 0.7083814361579311,
"repo_name": "nwjs/chromium.src",
"id": "c4c38fec743e710c59dbe2b689a1782239cba03b",
"size": "44... |
import socket
import time
import settings
from utils.timing import Timer
from utils.logger import log
class IRCBot:
"""
Sends and receives messages to and from IRC channels.
"""
def __init__(self, bot_name, owner_name, oauth):
"""
:param bot_name: str - The bot's username
:par... | {
"content_hash": "04a0ef9cceeda0731f6cc9d363c629f9",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 116,
"avg_line_length": 33.94488188976378,
"alnum_prop": 0.5801438181396428,
"repo_name": "Xelaadryth/Xelabot",
"id": "91f5f316d918554da696cbb2dc096e8d20285a1a",
"size": "... |
"""
Easy-to-use UMFPACK interface
=============================
.. currentmodule:: scikits.umfpack
The following functions can be used for LU decompositions and solving
equation systems:
.. autosummary::
:toctree: reference/
spsolve
splu
UmfpackLU
"""
from __future__ import division, print_function, a... | {
"content_hash": "e97fc8e82da1fce2c0a280757e8dd517",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 88,
"avg_line_length": 25.044510385756677,
"alnum_prop": 0.5225118483412322,
"repo_name": "scikit-umfpack/scikit-umfpack",
"id": "5e5fc6fdb73942043f89d2c48d261ad225a468dc",
... |
from south.db import db
from django.db import models
from laws.models import *
class Migration:
def forwards(self, orm):
# Adding field 'Vote.votes_count'
db.add_column('laws_vote', 'votes_count', orm['laws.vote:votes_count'])
def backwards(self, orm):
... | {
"content_hash": "a3fa6475e5457724a65aa6bc6b9d4546",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 170,
"avg_line_length": 72.14772727272727,
"alnum_prop": 0.5383524964561348,
"repo_name": "otadmor/Open-Knesset",
"id": "c16c354c709546af85776d0e8f88bebb1634deb5",
"size": ... |
from zerver.lib.test_classes import WebhookTestCase
class IFTTTHookTests(WebhookTestCase):
STREAM_NAME = 'ifttt'
URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = 'ifttt'
def test_ifttt_when_subject_and_body_are_correct(self) -> None:
expected_topic =... | {
"content_hash": "bb5b313059cf257a1d7e038cdd0c2adf",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 103,
"avg_line_length": 51.464285714285715,
"alnum_prop": 0.6897987508674531,
"repo_name": "rishig/zulip",
"id": "f13615c6eee1d599e537fb2e3506fbbc741afcbc",
"size": "1465",... |
"""Module for direct audit relationships mixin."""
from ggrc.models.audit import Audit
from ggrc.models.relationship import Relationship
class AuditRelationship(object):
# pylint: disable=too-few-public-methods
"""Mixin for mandatory link to an Audit via Relationships."""
_aliases = {
"audit": {
... | {
"content_hash": "4750592fd8a59fc847d396988360f380",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 66,
"avg_line_length": 32.47222222222222,
"alnum_prop": 0.6381522668947819,
"repo_name": "AleksNeStu/ggrc-core",
"id": "1726b05977ccbcc0ef59486cfdae501695bee532",
"size": "... |
"""
The flask application package.
"""
from flask import Flask
app = Flask(__name__)
import $safeprojectname$.views
| {
"content_hash": "622eb237e25621deb75ca3347094707e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 30,
"avg_line_length": 14.222222222222221,
"alnum_prop": 0.65625,
"repo_name": "Habatchii/PTVS",
"id": "da9151615ac2974c028a73d1ac941a4f2acd2d94",
"size": "128",
"binary":... |
import wx
from wx.lib.scrolledpanel import ScrolledPanel
class EditHotKeyDialog(wx.Dialog):
def __init__(self, parent, id, title, key):
wx.Dialog.__init__(self, parent, id, title, size=(250, 240))
self.currKey = key
self.panel = wx.Panel(self, -1)
self.updateUI()
vbox = wx.B... | {
"content_hash": "72bf5829d66711433259116eb6c88f5b",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 142,
"avg_line_length": 39.135802469135804,
"alnum_prop": 0.583596214511041,
"repo_name": "tobspr/panda3d",
"id": "8cde68b0ebf1edbd9897c82e033676edf561c00c",
"size": "6340... |
import numpy as np
from Coupling import Coupling
class Coupling2DCavities3D(Coupling):
"""
Coupling for cavity3D to cavity transmission.
"""
@property
def impedance_from(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as w... | {
"content_hash": "258829c7f0682743a6df4f583beca0c6",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 143,
"avg_line_length": 26.3953488372093,
"alnum_prop": 0.5762114537444933,
"repo_name": "FRidh/Sea",
"id": "4d8bca982016257f4542686e00328e03c100f8d0",
"size": "1135",
"b... |
import logging
import sys
import re
from osmfiltering.filters import BaseFilter, VersionIncrementor
from osmfiltering.filtering import run
from osmfiltering.writing import OSMWriter, OSCWriter
class PhoneFilter(BaseFilter):
def __init__(self):
self.parsable_re = re.compile(".*([1-9]).*?(\d).*?(\d).*?(\d)... | {
"content_hash": "37cf997252a8a167686a62afbef31084",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 107,
"avg_line_length": 30.417910447761194,
"alnum_prop": 0.5564278704612365,
"repo_name": "gileri/osmfiltering",
"id": "21bf2f6944f486a0eba9b4a828d7727ade6479fd",
"size": ... |
import web
from urls import urls
from config import *
from app.api.log import *
app = web.application(urls, globals())
if __name__ == "__main__":
logclass.append(cLogs())
app.run()
| {
"content_hash": "b880bbed11c67afc4e119f2120420b97",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 18.5,
"alnum_prop": 0.6756756756756757,
"repo_name": "selboo/squid-api",
"id": "fb839259056772023b6cf5fd9a86e451e3299b6c",
"size": "222",
"binary":... |
from gcp_common import BaseTest, event_data
class BigQueryDataSetTest(BaseTest):
def test_query(self):
factory = self.replay_flight_data('bq-dataset-query')
p = self.load_policy({
'name': 'bq-get',
'resource': 'gcp.bq-dataset'},
session_factory=factory)
... | {
"content_hash": "bbc428140d6fd02121241377e3cf1b34",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 87,
"avg_line_length": 38.71764705882353,
"alnum_prop": 0.5739896687936797,
"repo_name": "capitalone/cloud-custodian",
"id": "fc111ad3be2b333e01ff4a2d5fdc300ae2509ad2",
"si... |
"""Support for Rflink Cover devices."""
import logging
import voluptuous as vol
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice
from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_OPEN
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.restore_state import ... | {
"content_hash": "c411197563631dbccff85d43a54550f0",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 88,
"avg_line_length": 32.58479532163743,
"alnum_prop": 0.6136037329504667,
"repo_name": "postlund/home-assistant",
"id": "794542cb9d4c824ca75e1bd4a2063dfcad138eba",
"size... |
"""Test class of 3PAR Client handling CPG."""
from test import HPE3ParClient_base as hpe3parbase
from hpe3parclient import exceptions
DOMAIN = 'UNIT_TEST_DOMAIN'
CPG_NAME1 = 'CPG1_UNIT_TEST' + hpe3parbase.TIME
CPG_NAME2 = 'CPG2_UNIT_TEST' + hpe3parbase.TIME
class HPE3ParClientCPGTestCase(hpe3parbase.HPE3ParClientBa... | {
"content_hash": "fa683e755310b816f523a3a905df0f73",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 79,
"avg_line_length": 31.29255319148936,
"alnum_prop": 0.586775454699983,
"repo_name": "hpe-storage/python-3parclient",
"id": "9bdf39b8f1a9b595a3855b547ac891568844a706",
... |
from argparse import ArgumentParser
from sys import stderr
from . import MIN_GETDENTS_BUFF_SIZE, getdents
from .formatters import FORMATTERS
def parse_args(args, prog):
parser = ArgumentParser(
prog=prog,
description='Print directory contents.',
)
parser.add_argument('path', metavar='PAT... | {
"content_hash": "ebeb64cf8fa5adbc2974cef9d7c8c461",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 78,
"avg_line_length": 25.923076923076923,
"alnum_prop": 0.6017804154302671,
"repo_name": "ZipFile/python-getdents",
"id": "118ce0b770604b09a3ed09a746829ef40b0e3411",
"size... |
import requests, json, base64
placeID = 2322
personID = 72898
uri = "/api/core/v3/members/places/{}".format(placeID)
base_url = "https://geonet.esri.com"
url = base_url + uri
user = "username"
password = "password"
auth = "Basic " + base64.encodestring('%s:%s' % (user, password)).replace("\n","");
headers = { "C... | {
"content_hash": "f5ad0d503de451956f05f0f9c16f20bf",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 85,
"avg_line_length": 22.821428571428573,
"alnum_prop": 0.6416275430359938,
"repo_name": "thales007/Jive-Community-Management",
"id": "9f30ea3451a495f51d5e79d5fb973d6e08bd6b... |
import datetime, os
from email.utils import parseaddr
from django import forms
from django.conf import settings
from django.db.models import Q
from django.forms.util import ErrorList
from django.core.validators import email_re
from django.template.loader import render_to_string
from ietf.liaisons.accounts import (can... | {
"content_hash": "d92b6d89a3f72fa3f688e52b53d0529c",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 155,
"avg_line_length": 43.257383966244724,
"alnum_prop": 0.6060280920795942,
"repo_name": "mcr/ietfdb",
"id": "efe2c6eb4eaff4fca193ff257ba625a928555390",
"size": "20504",... |
import sys
from typing import TYPE_CHECKING
if sys.version_info < (3, 7) or TYPE_CHECKING:
from ._x import X
from ._y import Y
from ._z import Z
from . import x
from . import y
from . import z
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = rel... | {
"content_hash": "47ad1b0ddc00cd00dd3c35252a06781f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 65,
"avg_line_length": 25.375,
"alnum_prop": 0.5566502463054187,
"repo_name": "plotly/plotly.py",
"id": "40e571c2c8732d5419cd2e52a3dd520cf0cce217",
"size": "406",
"binary... |
import datetime
from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.utils.dateformat import format
from d... | {
"content_hash": "12465b1b8f42ff5102f0581e49ff7832",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 138,
"avg_line_length": 39.50919117647059,
"alnum_prop": 0.6587726236449076,
"repo_name": "fragaria/BorIS",
"id": "c3ee8763d242e6d471d8aab2aa8a2cabeca739b2",
"size": "2165... |
from neutron_lib.api.definitions import network as net_def
from neutron_lib.api.definitions import vlantransparent as vlan_apidef
from neutron.db import _resource_extend as resource_extend
@resource_extend.has_resource_extenders
class Vlantransparent_db_mixin(object):
"""Mixin class to add vlan transparent metho... | {
"content_hash": "55c624b550c19fa77099ad1ce92227bd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 75,
"avg_line_length": 38.5,
"alnum_prop": 0.7483766233766234,
"repo_name": "noironetworks/neutron",
"id": "066371027aa1ba18ed94e0775dfe7cdffc5d6fc7",
"size": "1254",
"bi... |
import time
from airflow.models import DAG
from airflow.operators.dummy import DummyOperator
from airflow.utils.context import Context
from airflow.utils.timezone import datetime
class DummyWithOnKill(DummyOperator):
def execute(self, context: Context):
import os
self.log.info("Signalling that I... | {
"content_hash": "dfef58b8a412ed2a3e94ebcfa7e90251",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 77,
"avg_line_length": 33.05555555555556,
"alnum_prop": 0.6630252100840336,
"repo_name": "mistercrunch/airflow",
"id": "e4000b8a9e7616eec9301ff4a3510d495880144e",
"size": "... |
import unittest
from model import Cell, Module, OutputType, CellType, Mux
import random
class CellTests (unittest.TestCase):
def setUp(self):
self.c = Cell()
def tearDown(self):
pass
def testAsyncOutputFalseWhenBothInputsFalse(self):
self.c.driveInputs([False, False])
self.assertFalse(self.c.... | {
"content_hash": "4942086505e2933a6b2ee651d565f0ea",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 91,
"avg_line_length": 29.055690072639226,
"alnum_prop": 0.694,
"repo_name": "nosnhojn/poser",
"id": "c61623b37bddc297ff4efcaa0c5fed293a59e6f0",
"size": "12000",
"binary... |
from os.path import exists
from setuptools import setup, find_packages
import versioneer
setup(name='topik',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='A Topic Modeling toolkit',
url='http://github.com/ContinuumIO/topik/',
author='Topik development ... | {
"content_hash": "3c6ed9049ddfa61d28c9da13f3f840ec",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 81,
"avg_line_length": 37.77272727272727,
"alnum_prop": 0.6594464500601684,
"repo_name": "ContinuumIO/topik",
"id": "0c854e1334f6e53bf0b3ebcf275179b9a21da894",
"size": "854... |
from __future__ import unicode_literals
from django.db import models, migrations
from auvsi_suas.models.server_info import ServerInfo
class Migration(migrations.Migration):
dependencies = [('auvsi_suas', '0003_missionconfig_is_active')]
operations = [
migrations.AddField(
model_name='m... | {
"content_hash": "74bd394dd584c912af22f81a99ab6a00",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 67,
"avg_line_length": 25.95,
"alnum_prop": 0.6223506743737958,
"repo_name": "transformation/utatuav-interop",
"id": "dabc373027af0cbeab31485a2edab56c314730c0",
"size": "54... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DatabaseCreate.database'
db.alter_column(u'maintenance_databasecreate', 'database_id', self.gf('django.db.models.... | {
"content_hash": "c697cbc9c94257130968258c96c90170",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 227,
"avg_line_length": 97.54048140043764,
"alnum_prop": 0.568691672648959,
"repo_name": "globocom/database-as-a-service",
"id": "287690833be65d6c92c97a8760403e35648534f0",
... |
from typing import MutableMapping, MutableSequence
import proto # type: ignore
__protobuf__ = proto.module(
package="google.cloud.essentialcontacts.v1",
manifest={
"NotificationCategory",
"ValidationState",
},
)
class NotificationCategory(proto.Enum):
r"""The notification categories... | {
"content_hash": "cf2a2ff943fbcb61596be3e7aa7e1e02",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 68,
"avg_line_length": 25.975609756097562,
"alnum_prop": 0.692018779342723,
"repo_name": "googleapis/python-essential-contacts",
"id": "92ad009dfab552035c8bf62e5d534703ec3cd5... |
import datetime
import time
from django.template import RequestContext
from django.http import Http404, HttpResponse
from django.shortcuts import render_to_response
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from events.models import Event
from events.forms import CalendarYearMonthForm
from e... | {
"content_hash": "b163f53eec515c20cdc8b0d4492b6a51",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 124,
"avg_line_length": 27.07859078590786,
"alnum_prop": 0.6703362690152121,
"repo_name": "asgardproject/asgard-calendar",
"id": "fe6dcc3a56afdbf45e1e08f64e4b0f746fe0fe8f",
... |
import time
from datetime import timedelta, date
import mock
from django.core import mail
from django.template import defaultfilters
from django.utils.timezone import now, get_current_timezone
from tenant_extras.utils import TenantLanguage
from bluebottle.activities.messages import ParticipantWithdrewConfirmationNoti... | {
"content_hash": "a60af88c60dcd449030c044dfdb103c6",
"timestamp": "",
"source": "github",
"line_count": 2557,
"max_line_length": 107,
"avg_line_length": 35.059835745013686,
"alnum_prop": 0.6352512047117616,
"repo_name": "onepercentclub/bluebottle",
"id": "f92856350e3dd39516e79ab0926145a005e764df",
... |
from __future__ import unicode_literals
import unittest
from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.db import connection
from django.forms import EmailField, IntegerField
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.... | {
"content_hash": "a39e0254c388b86c234a1590092960dc",
"timestamp": "",
"source": "github",
"line_count": 650,
"max_line_length": 162,
"avg_line_length": 37.863076923076925,
"alnum_prop": 0.5966437771728089,
"repo_name": "liavkoren/djangoDev",
"id": "e9f6da727904362f5e30c0f164996c5b5f2b32d8",
"size":... |
'''
Created on Jun 8, 2011
@author: evan
'''
from kayako.core.lib import UnsetParameter
from kayako.core.object import KayakoObject
from kayako.exception import KayakoRequestError, KayakoResponseError
from lxml import etree
import base64
class TicketAttachment(KayakoObject):
'''
Kayako TicketAttachment API O... | {
"content_hash": "ad878853c829b9d7eaa9016f6df03f48",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 164,
"avg_line_length": 36.713235294117645,
"alnum_prop": 0.6144602443420789,
"repo_name": "sahilsehgal81/python-api-library",
"id": "0f138204b8da895ff46f32c1f3b9ecb7e830d3f... |
import os
import time
from dataclasses import dataclass, field
from mashumaro.types import SerializableType
from pathlib import Path
from typing import (
Optional,
Union,
List,
Dict,
Any,
Sequence,
Tuple,
Iterator,
TypeVar,
)
from dbt.dataclass_schema import (
dbtClassMixin, Ext... | {
"content_hash": "4e89b12246e3a6af2c5da2503b64d96e",
"timestamp": "",
"source": "github",
"line_count": 920,
"max_line_length": 83,
"avg_line_length": 31.089130434782607,
"alnum_prop": 0.6392210334941613,
"repo_name": "analyst-collective/dbt",
"id": "f51ff7dedd57bff55842a333d542b558be682805",
"size... |
import numpy as np
from gym.spaces import Box
from metaworld.envs.asset_path_utils import full_v1_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerButtonPressTopdownEnv(SawyerXYZEnv):
def __init__(self):
hand_low = (-0.5, 0.40, 0.05)
... | {
"content_hash": "43e2cfbdea1cfacd946aa885f0c5da94",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 117,
"avg_line_length": 32.13709677419355,
"alnum_prop": 0.5668757841907152,
"repo_name": "rlworkgroup/metaworld",
"id": "1a91815ec9b922d1e2850e966ea2394f40a35df1",
"size"... |
from pprint import pprint
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
apikey = "your api key"
secretkey = "your secret key"
Driver = get_driver(Provider.IKOULA)
driver = Driver(key=apikey, secret=secretkey)
# This returns a list of CloudStackNetwork objects
nets = d... | {
"content_hash": "849da80f7de5de5d53d7bd67a9025b18",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 94,
"avg_line_length": 27.5,
"alnum_prop": 0.7648484848484849,
"repo_name": "apache/libcloud",
"id": "09d2c8d4d7a7c3c05bf3d727837ba67e4dd4312c",
"size": "825",
"binary": ... |
"""Enumerators for string types"""
# -*- coding: utf-8 -*-
from dlkit.abstract_osid.osid.errors import NotFound
STRING_MATCH_TYPES = {
'EXACT': 'Exact',
'IGNORECASE': 'Ignore Case',
'WORD': 'Word',
'WORDIGNORECASE': 'Word Ignore Case',
'WILDCARD': 'Wildcard',
'REGEX': 'Regular Expression',
... | {
"content_hash": "4c5b812f37b9727aaba4c403824ca330",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 76,
"avg_line_length": 27.15909090909091,
"alnum_prop": 0.5757322175732218,
"repo_name": "mitsei/dlkit",
"id": "248ee207f309d0498f47c4c48f4fb8d784acf9e0",
"size": "1195",
... |
import operator
from ..sql import operators
class UnevaluatableError(Exception):
pass
_straight_ops = set(getattr(operators, op)
for op in ('add', 'mul', 'sub',
'div',
'mod', 'truediv',
'lt', 'le', 'n... | {
"content_hash": "4321e631420f9dba5a7bef1c795d97fc",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 77,
"avg_line_length": 35.38582677165354,
"alnum_prop": 0.5129060970182465,
"repo_name": "rolandmansilla/microblog",
"id": "534e7fa8f1e24d70c6368f9890c13dc5fc81e70e",
"siz... |
"""
Copyright 2010 Christopher MacGown
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | {
"content_hash": "31d68fc7e2d9fba1e04f50c9c0c3f0b4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 32.02173913043478,
"alnum_prop": 0.6503733876442634,
"repo_name": "ChristopherMacGown/pynpoint",
"id": "2118d46d585f385b2bb32fc02d158744646f88d2",
"s... |
from .message_passing_layers import MP_LAYERS
#from .adjacency import construct_adjacency_matrix_layer
'''
This module implements the core message passing operations.
###adjacency.py <-- compute an adjacency matrix based on vertex data.
message_passing.py <-- run a single iteration of message passing.
message.py <-- ... | {
"content_hash": "05c0039eb3cae68021e73bd18eab0bd8",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 74,
"avg_line_length": 40,
"alnum_prop": 0.7659090909090909,
"repo_name": "isaachenrion/jets",
"id": "863ec91235f6b81d1545dd171eea4009ee2ed25a",
"size": "440",
"binary": ... |
import copy
import mock
from oslo.config import cfg
from mistral.openstack.common import log as logging
from mistral.tests import base
from mistral.db import api as db_api
from mistral.engine.scalable import engine
from mistral.actions import std_actions
from mistral.engine import states
from mistral.engine import cl... | {
"content_hash": "c4d30df4476ab72e609035ff3e8c804b",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 79,
"avg_line_length": 37.0184331797235,
"alnum_prop": 0.5284451636997386,
"repo_name": "TimurNurlygayanov/mistral",
"id": "e83d0f4300adb3bc59d3016a22d5b80b80055dda",
"siz... |
from models import User
import common
class UserManager():
def __init__(self):
pass
@property
def get_all(self):
return User.objects.all()
def add(self, user):
# 对用户密码加密
user.password = common.md5(user.password)
user.save()
| {
"content_hash": "8af7cf9c8d7cb4de3d68fd91a680c3b1",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 49,
"avg_line_length": 18.75,
"alnum_prop": 0.5533333333333333,
"repo_name": "GavinZhuLei/GavinsDjango",
"id": "49c355b5819eff1acacb7d0e2784a2940c8bb33c",
"size": "362",
... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('..'))
sys.path.append(os.path.abs... | {
"content_hash": "c6b43569a30148e61870d6f011e3d146",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 80,
"avg_line_length": 32.76881720430107,
"alnum_prop": 0.7099261689909762,
"repo_name": "beni55/django-userena",
"id": "b5d21558edb381c5f9a985ce3e9cee295f561dd1",
"size":... |
import copy
import re
import sys
from datetime import datetime
from pprint import PrettyPrinter
from ..rest_client import AtlassianRestAPI
RE_TIMEZONE = re.compile(r"(\d{2}):(\d{2})$")
class BitbucketBase(AtlassianRestAPI):
CONF_TIMEFORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
bulk_headers = {"Content-Type": "applica... | {
"content_hash": "d938e8a6994bb2c592e9284caabc7a05",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 115,
"avg_line_length": 33.42458100558659,
"alnum_prop": 0.5803108808290155,
"repo_name": "AstroTech/atlassian-python-api",
"id": "83daf05a7363e0f8735fa7df73977dd371c70582",... |
import numpy as np
import pybasis
import pyam
def skip_comments(fp):
while True:
line = next(fp)
# ignore comment lines
if line[0] != '#':
return line
def scale_factor(A):
return (18/A)**(.3)
def read_m_scheme_matel(filename, sp_basis, scale_factor=1.0):
ob_matel = {}
... | {
"content_hash": "1e67394f1e221ba674f0b5487b0e07fe",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 75,
"avg_line_length": 30.309859154929576,
"alnum_prop": 0.5497211895910781,
"repo_name": "kc9jud/ShellCorretta",
"id": "39038ea76501eb7ccd92d3c2e58ec4eed7a50915",
"size": ... |
"""Copyright 2014 Cyrus Dasadia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... | {
"content_hash": "7dc4b33a30c1127daa1e129181b17e16",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 135,
"avg_line_length": 32.11538461538461,
"alnum_prop": 0.6309880239520959,
"repo_name": "CitoEngine/cito_plugin_server",
"id": "b74e7b464308432f61038577a7ca6d2b3574321a",
... |
import unittest
from datetime import date
from datetime import datetime
from ggrc_workflows.models import task_group_task
class TestTaskGroupTask(unittest.TestCase):
def test_validate_task_type(self):
t = task_group_task.TaskGroupTask()
self.assertRaises(ValueError, t.validate_task_type, "task_type", "he... | {
"content_hash": "cd7c4cbf4aa04858b73800ca6f0e4a33",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 78,
"avg_line_length": 33.38297872340426,
"alnum_prop": 0.6443594646271511,
"repo_name": "VinnieJohns/ggrc-core",
"id": "6434835af7a99bce87cb3811e57025e431dbae88",
"size": ... |
import pytest
from f5.bigip.resource import MissingRequiredCreationParameter
from requests.exceptions import HTTPError
def delete_user(bigip, name):
user = bigip.auth.users.user
try:
user.load(name=name)
except HTTPError as err:
if err.response.status_code != 404:
raise
... | {
"content_hash": "3796b9f591953e9d40120db0bca78a00",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 77,
"avg_line_length": 31.125,
"alnum_prop": 0.6282909415439536,
"repo_name": "wojtek0806/f5-common-python",
"id": "17102b571d00bbb8719e550e8892b57230352a39",
"size": "506... |
import optparse
from webkitpy.common.system.executive_mock import MockExecutive2
from webkitpy.layout_tests.models import test_run_results
from webkitpy.layout_tests.port import browser_test
from webkitpy.layout_tests.port import browser_test_driver
from webkitpy.layout_tests.port import port_testcase
class _Browser... | {
"content_hash": "6e9eb2be7100e86a19bca71cf8fcb93b",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 116,
"avg_line_length": 40.55223880597015,
"alnum_prop": 0.6878910563121089,
"repo_name": "danakj/chromium",
"id": "59e8465f8bd9a5b85710642e704beccf10db266a",
"size": "4244... |
import sys
from manilaclient import v2
class MovedModule(object):
def __init__(self, new_module):
self.new_module = new_module
def __getattr__(self, attr):
return getattr(self.new_module, attr)
sys.modules["maniliaclient.v1"] = MovedModule(v2)
| {
"content_hash": "7ec1aa7958441734e305c061bb2a7c1b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 49,
"avg_line_length": 21,
"alnum_prop": 0.6703296703296703,
"repo_name": "sniperganso/python-manilaclient",
"id": "eb442d909cd20cea274c8b8349925d6f87e6db67",
"size": "911"... |
import collections
import os
import random
from artificialproject.random import weighted_choice
class GenerationFailedException(Exception):
pass
GeneratedField = collections.namedtuple("GeneratedField", ["value", "deps"])
class NullableGenerator:
def __init__(self, value_generator):
self._value_g... | {
"content_hash": "1ed58fdf9b848ce16b063736eb757940",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 88,
"avg_line_length": 38.394666666666666,
"alnum_prop": 0.5929990276427282,
"repo_name": "nguyentruongtho/buck",
"id": "6c151212bcf683752cc67d2c53518548b1729a6c",
"size":... |
from datasets.sts import STS
class STSLarge(STS):
def __init__(self, train_validation_split=None, test_split=None,
use_defaults=True, name='sts_large'):
super().__init__(subset=name)
| {
"content_hash": "7066a9c1551e284787b158cdb495a6f0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 68,
"avg_line_length": 30.571428571428573,
"alnum_prop": 0.6261682242990654,
"repo_name": "mindgarage/Ovation",
"id": "7cd21399992216c6a2a5a18147d3604786d42342",
"size": "21... |
import logging
from functools import reduce
import asyncio
from .timeout import timeout
from .futures import AsyncObject, Bench
from .protocols import Producer
logger = logging.getLogger('pulsar.clients')
class Pool(AsyncObject):
'''An asynchronous pool of open connections.
Open connections are either :a... | {
"content_hash": "d628e32c4cd2b6b7ff5b3fa748005591",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 78,
"avg_line_length": 32.33916083916084,
"alnum_prop": 0.5844956211482323,
"repo_name": "quantmind/pulsar",
"id": "9e2ed081a6aded592e45bf5a024f7adc260543bd",
"size": "924... |
from ..processing_node import ProcessingNode
class ResizeNode(ProcessingNode):
def __init__(self, width, height, quality):
self.width = int(width)
self.height = int(height)
self.quality = quality
def execute(self, processor, img):
return [img.resize((self.width, self.height), ... | {
"content_hash": "9cfb7fe7d256a818c4c643b4df8e3159",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 31.272727272727273,
"alnum_prop": 0.6569767441860465,
"repo_name": "PearCoding/SpriteResourceCompiler",
"id": "4b9fd766c6c8d8ffe502d7725eba9b89dceda7d4... |
CORE_SOURCE_FILES = [
'src/core/ext/filters/census/grpc_context.cc',
'src/core/ext/filters/client_channel/backend_metric.cc',
'src/core/ext/filters/client_channel/backup_poller.cc',
'src/core/ext/filters/client_channel/channel_connectivity.cc',
'src/core/ext/filters/client_channel/client_channel.cc'... | {
"content_hash": "7a8086db9ce013ba5c415723acf84c9d",
"timestamp": "",
"source": "github",
"line_count": 813,
"max_line_length": 118,
"avg_line_length": 58.9569495694957,
"alnum_prop": 0.7228573812901611,
"repo_name": "firebase/grpc-SwiftPM",
"id": "795c02680c57dd9f14795bbab7a91b9f72ffb8c0",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.