text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import print_function
import getopt
import os
import sys
import subprocess
VERSION = "pilprint 0.3/2003-05-05"
from PIL import Image
from PIL import PSDraw
letter = (1.0*72, 1.0*72, 7.5*72, 10.0*72)
def description(filepath, image):
title = os.path.splitext(os.path.split(filepath)[1])[0]
fo... | {
"content_hash": "02320b6ede028b51cd0c9cc3ddf402ca",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 68,
"avg_line_length": 26.359550561797754,
"alnum_prop": 0.5541346973572038,
"repo_name": "drakeloud/louderdev",
"id": "9430fb43dab67a787dcaf757d060814180b6763e",
"size": "... |
from unittest.mock import patch
from django.utils import timezone
import warnings
from collections import namedtuple
from django.test import TestCase
from ..factories import SpecFactory, JobFactory
from ..models import Job, Package, Spec
from ..tasks import query_pypi
def fake_distributions(*distributions):
Dis... | {
"content_hash": "39a7318f339b2e91d7f15b1143a462ef",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 140,
"avg_line_length": 36.05072463768116,
"alnum_prop": 0.6182914572864322,
"repo_name": "futurecolors/gopython3",
"id": "02e68291594bb6c1efdd15444a5a57d4ed507f59",
"size... |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#... | {
"content_hash": "ef48ca82e190032e22f98cbb00b044be",
"timestamp": "",
"source": "github",
"line_count": 1626,
"max_line_length": 120,
"avg_line_length": 34.621156211562116,
"alnum_prop": 0.5863857604718087,
"repo_name": "shwetams/python_azure_tables",
"id": "9c20d1cb668da1781f4fdaa6df973b63fa33dadb",... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "54d9bc776908505ac616990abf827702",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 76,
"avg_line_length": 30.74230769230769,
"alnum_prop": 0.7032403352933817,
"repo_name": "jcollado/rabbithole",
"id": "a85c1b8bea47a2c59759c1127dab88607790e16c",
"size": "... |
import datetime
from django.utils.timezone import now
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Project'
db.create_table('issues_project', (
('id', self.gf('djang... | {
"content_hash": "428147b5750c6ad7b1b789ebfad2a29d",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 182,
"avg_line_length": 66.62295081967213,
"alnum_prop": 0.5670521653543307,
"repo_name": "mostateresnet/django-ticket",
"id": "c6ca6fc0c4faec58bf496702fffb03dd6ca1eccb",
... |
import json
import pymysql
import argparse
def InsertToMySQL(conn, record):
cursor = conn.cursor()
cursor.execute( "INSERT user values (%s,%s,%s,%s,%s)", [
record['user_id'], record['name'], record['review_count'],
record['average_stars'], record['yelping_since']])
def main(fileName):
... | {
"content_hash": "42aa4955ea2771b0b01c266a9e14f428",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 96,
"avg_line_length": 25.733333333333334,
"alnum_prop": 0.6113989637305699,
"repo_name": "zhewang/restauranthunter",
"id": "d91de04c585e3a0377d82c7325b97e0a419b5421",
"siz... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'AnswerReference.migrated'
db.delete_column('website_answerreference', 'migrated')
# Adding field 'AnswerR... | {
"content_hash": "9eaabaa229a8ac94c063ae7164408224",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 182,
"avg_line_length": 90.62256809338521,
"alnum_prop": 0.5471446972949764,
"repo_name": "solarpermit/solarpermit",
"id": "74de7c93794ab579e709849aea904e9a4cfdd237",
"siz... |
"""
Copyright 2013 Steven Diamond
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... | {
"content_hash": "cfbcbed5a1ccbf1353907d6592bf3739",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 72,
"avg_line_length": 33.57142857142857,
"alnum_prop": 0.774468085106383,
"repo_name": "merraksh/cvxpy",
"id": "cd017bc8aea92657bc22858cd0977fe940efa27f",
"size": "705",
... |
"""Tests for the profile page."""
__author__ = 'Sean Lip'
import datetime
from core.domain import exp_services
from core.domain import user_services
from core.tests import test_utils
import feconf
import utils
class SignupTest(test_utils.GenericTestBase):
def test_signup_page_does_not_have_top_right_menu(self... | {
"content_hash": "08bde782c03b8e669e7c4595c29f8baa",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 79,
"avg_line_length": 40.16,
"alnum_prop": 0.6259130146082338,
"repo_name": "won0089/oppia",
"id": "bf3045ea9cb111eaec512879dd6f60c25eb055d8",
"size": "12653",
"binary"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.maintenance import MaintenanceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-maintenance
# USAGE
python configuration_assignments_delete.py
Before run the sample, please set the values of the clie... | {
"content_hash": "1038f454a584af26dc7336df3c5cf848",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 159,
"avg_line_length": 36.361111111111114,
"alnum_prop": 0.7433155080213903,
"repo_name": "Azure/azure-sdk-for-python",
"id": "5dccc98c7db0d2b2f3206c431fc12b9ed3c9c6e9",
"... |
"""Cross-language tests for the JWT primitives."""
import datetime
import json
from absl.testing import absltest
from absl.testing import parameterized
import tink
from tink import jwt
from util import testing_servers
from util import utilities
SUPPORTED_LANGUAGES = testing_servers.SUPPORTED_LANGUAGES_BY_PRIMITIVE... | {
"content_hash": "56ab5b53a3d13ffcc4b825a91f6af176",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 80,
"avg_line_length": 45.41216216216216,
"alnum_prop": 0.6551108466002084,
"repo_name": "google/tink",
"id": "e078c50c7cd94196f79343b860bee4c2018a396e",
"size": "7296",
... |
import datetime
from sqlalchemy import CheckConstraint, Column, Integer, String, ForeignKey, DateTime
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
class Project(Base):
__tablename__ = 'projects'
... | {
"content_hash": "53c2fc84a6f0c60a808b397d34084749",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 111,
"avg_line_length": 28.32,
"alnum_prop": 0.6793785310734464,
"repo_name": "renemilk/pyjuxa",
"id": "17b4de99bdde07aa6719742f58c6a8fba7ae1b46",
"size": "2124",
"binary... |
import socket
class NetworkPrinter(object):
"""
Object to send ZPL to zebra network printer using sockets
:param ip_address: printer network address as 'xxx.xxx.xxx.xxx'
:param port: port of printer as int (default 9100)
"""
def __init__(self, ip_address, port=9100):
self.ip = ip_add... | {
"content_hash": "56fe09c5554ed756da26b7b793112efa",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 31.576923076923077,
"alnum_prop": 0.630937880633374,
"repo_name": "sacherjj/simple_zpl2",
"id": "066f48eb18ba3e8a6b9fc1bf0ad8ce22696407de",
"size": "... |
import numpy as np
import cPickle
import os
import sys
import time
from os.path import join as pjoin
import theano
import theano.tensor as T
from models.Gauss_VAE import Gaussian_VAE
from models.neural_net.activation_fns import Sigmoid, Identity, Softmax
from models.neural_net.loss_fns import *
from utils.load_data i... | {
"content_hash": "13076d7931a12889ec855db720cf3546",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 157,
"avg_line_length": 40.888888888888886,
"alnum_prop": 0.6148393194706995,
"repo_name": "enalisnick/stick-breaking_dgms",
"id": "1993546e707dec7eb2106523309851e927301eab"... |
from model.contact import Contact
def test_add_contact(app, db, json_contacts, check_ui):
contact = json_contacts
old_contacts = db.get_contact_list()
app.contact.create(contact)
new_contacts = db.get_contact_list()
old_contacts.append(contact)
assert sorted(old_contact... | {
"content_hash": "fb11dcd39ba0be64cefd8d9497370f54",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 108,
"avg_line_length": 47.92307692307692,
"alnum_prop": 0.5778491171749599,
"repo_name": "100loto/kruglov_group_16",
"id": "61f37b8c17e94ead51590f6af7a9cdccd5317c3d",
"siz... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import re
import logging
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
log = logging.getLogger('... | {
"content_hash": "f993eb96fba90467d619ded0984b7130",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 109,
"avg_line_length": 32.896103896103895,
"alnum_prop": 0.5752072641136992,
"repo_name": "qvazzler/Flexget",
"id": "24713be9f684f618695bf182c9c909ac26bc2cb1",
"size": "25... |
import re
from thingsboard_gateway.connectors.connector import log
class Device:
def __init__(self, path, name, config, converter, converter_for_sub):
self.path = path
self.name = name
self.config = config
self.converter = converter
self.converter_for_sub = converter_for_su... | {
"content_hash": "0c2e23d863c74c0e502b98d14ca42e39",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 108,
"avg_line_length": 40.142857142857146,
"alnum_prop": 0.4918149466192171,
"repo_name": "thingsboard/thingsboard-gateway",
"id": "0347c32d2f323b9f4fb6a15b9b9f045072bbf7d9"... |
"""Tests for manipulating Nodes via the DB API"""
import datetime
import mock
import six
from ironic.common import exception
from ironic.common import utils as ironic_utils
from ironic.db import api as dbapi
from ironic.openstack.common import timeutils
from ironic.tests.db import base
from ironic.tests.db import ut... | {
"content_hash": "798dfd742c4d93178104358515776f8e",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 79,
"avg_line_length": 35.966814159292035,
"alnum_prop": 0.5677554284308298,
"repo_name": "varunarya10/ironic",
"id": "4f631e9d749df87500512a0b57b10f66495d620d",
"size": "... |
from google.cloud import aiplatform_v1
async def sample_purge_artifacts():
# Create a client
client = aiplatform_v1.MetadataServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1.PurgeArtifactsRequest(
parent="parent_value",
filter="filter_value",
)
# M... | {
"content_hash": "e48fb970bc51027229a720c3a5c20c11",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 25.041666666666668,
"alnum_prop": 0.7071547420965059,
"repo_name": "googleapis/python-aiplatform",
"id": "50e7e64a414c66c0b9046dcc50d52426e33fdbde",
... |
"""
Quota synteny alignment (QUOTA-ALIGN)
%prog [options] anchorsfile --qbed=qbedfile --sbed=sbedfile
This python program does the following:
1. merge 2D-overlapping blocks (now skipped, but existed in original version)
2. build constraints that represent 1D-overlap among blocks
3. feed the data into the linear progr... | {
"content_hash": "9c6d319dc2cc51b1fb8ebd25b1223085",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 88,
"avg_line_length": 27.760563380281692,
"alnum_prop": 0.5927194317605277,
"repo_name": "tanghaibao/jcvi",
"id": "de8b7acd3afe13178fbb51c2fff4bd28126dc1b6",
"size": "793... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from sklearn import mixture
n_samples = 300
# generate random sample, two components
np.random.seed(0)
# generate spherical data centered on (20, 20)
shifted_gaussian = np.random.randn(n_samples, 2) + np.array([20, 0])
shifted_g... | {
"content_hash": "78ebe47a4964184b95e0954c34592ec0",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 77,
"avg_line_length": 32.170731707317074,
"alnum_prop": 0.6990144048521607,
"repo_name": "ronnyb29/kmeans-theory",
"id": "a8e28214a579182260bd0d1b0a4a91508a33575b",
"size"... |
import sys
"""Sample that sets the replication behavior or recovery point objective (RPO) to default.
This sample is used on this page:
https://cloud.google.com/storage/docs/managing-turbo-replication
For more information, see README.md.
"""
# [START storage_set_rpo_default]
from google.cloud import storage
from... | {
"content_hash": "19a1fdf31bb0aa30e3448652fb3f86a5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 90,
"avg_line_length": 26.40625,
"alnum_prop": 0.7088757396449704,
"repo_name": "googleapis/python-storage",
"id": "883fee0c972c1e9b3c272e8ee3580c1e6334c226",
"size": "1443... |
import argparse
import urllib.request
import re
import os
import csv
import io
import gnupg
import sys
import shutil
import time
USER_HOME = os.path.expanduser('~')
USER_M2_REPO = USER_HOME + '/.m2/repository/'
SONATYPE_RELEASE_URL = "https://oss.sonatype.org/content/repositories/releases"
SONATYPE_SNAPSHOT_URL = "htt... | {
"content_hash": "71c0f79db9d52959092fa6926db7f13c",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 139,
"avg_line_length": 38.817351598173516,
"alnum_prop": 0.678508410775203,
"repo_name": "Flowdalic/MavenToAndroidAnt",
"id": "7a2ebec44914fe6c20f865ee2fe2e7b9df45fbc1",
... |
__author__ = 'rcj1492'
__created__ = '2017.03'
__license__ = 'MIT'
'''
PLEASE NOTE: mailgun requires domain verification to send messages
api uses [email protected] as sender address
make sure to add mx record under the mailgun subdomain
SETUP: https://doc... | {
"content_hash": "3c7e59f42bef984fd2785edf697cd24f",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 185,
"avg_line_length": 35.05882352941177,
"alnum_prop": 0.5636700812433769,
"repo_name": "collectiveacuity/labPack",
"id": "6d86721408c6241c3faee98d2aa56b0b36cc88a1",
"si... |
import logging
import os
import re
import socket
import warnings
from conf_d import Configuration
from beaver.utils import eglob
class BeaverConfig():
def __init__(self, args, logger=None):
self._logger = logger or logging.getLogger(__name__)
self._logger.debug('Processing beaver portion of conf... | {
"content_hash": "05a7db7a3194402cf3569aca3adf58fa",
"timestamp": "",
"source": "github",
"line_count": 447,
"max_line_length": 160,
"avg_line_length": 36.94183445190156,
"alnum_prop": 0.5121419487676376,
"repo_name": "moniker-dns/debian-beaver",
"id": "0af7ebab9419d04861f56d45fdef6c10f6a980d3",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('company', '0003_auto_20170204_1135'),
]
operations = [
migrations.AlterField(
model_name='crpdate',
... | {
"content_hash": "9128869984a0cdea8ea500adea038204",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 126,
"avg_line_length": 25.526315789473685,
"alnum_prop": 0.6371134020618556,
"repo_name": "aakashrana1995/svnit-tnp",
"id": "fda6bf22ed6b3e17a092777f9ae257d7b60413e4",
"si... |
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
client = Client(account_sid, auth_token)
activities = client.taskrouter.workspaces(worksp... | {
"content_hash": "09ded0a727c5eac18b20c52ec32a97e0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 74,
"avg_line_length": 34.166666666666664,
"alnum_prop": 0.802439024390244,
"repo_name": "teoreteetik/api-snippets",
"id": "6967e238f0b29cd3ab7ddaab23a6bd42fabc4576",
"size... |
import os
import pytest
from pex import interpreter
from pex.testing import IS_PYPY, ensure_python_interpreter
try:
from mock import patch
except ImportError:
from unittest.mock import patch
class TestPythonInterpreter(object):
@pytest.mark.skipif('sys.version_info >= (3,0)')
def test_all_does_not_raise_w... | {
"content_hash": "d03ce45a938ed47929dda246a81eeb89",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 80,
"avg_line_length": 31.620689655172413,
"alnum_prop": 0.7382769901853872,
"repo_name": "kwlzn/pex",
"id": "cccf4a8dfd04b9f5c02ba1f828ff5079b8ec6106",
"size": "1049",
"... |
from django.http import HttpResponseBadRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from google.appengine.ext import ndb
import datetime
from entities import *
from util import *
from constants import *
@csrf_exempt
def event_refresher(request):
'''
refresh the events every 1 minute to ... | {
"content_hash": "8d470848b87da017ac8459880666cf1b",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 124,
"avg_line_length": 33.708333333333336,
"alnum_prop": 0.703955500618047,
"repo_name": "wattad169/sportbuddy_server",
"id": "469aac00aa9c373b7e8969fa90a9e615573cddd4",
"... |
import re
class Want(object):
"""Defines a request, possibly with a specific version"""
def __init__(self,
requirement):
self.requirement = requirement
@property
def tool(self):
return re.findall(r".*?(?=[0-9])", self.requirement + '0')[0]
@property
def vers... | {
"content_hash": "35323ec5b3e624211857536266d63d93",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 69,
"avg_line_length": 24.22222222222222,
"alnum_prop": 0.5688073394495413,
"repo_name": "koborit/SpaceSwitcherSample",
"id": "569ee11b8367fe883f6f0cbfa68ccb7065ea12b9",
"s... |
from __future__ import (absolute_import, print_function,
division, unicode_literals)
import os
import sys
import argparse
from .. import prov_definition
from .. import prov_deployment
from .. import prov_execution
from .. import utils
from ..persistence import persistence
from .command import... | {
"content_hash": "6f554a44be7cfda477f00a27a9c7aeed",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 78,
"avg_line_length": 37.04032258064516,
"alnum_prop": 0.5649902024820379,
"repo_name": "paopao74cn/noworkflow",
"id": "3338861c2d3bfc7f40df8c125313cdbb9d5fd64f",
"size":... |
from __future__ import absolute_import, division, print_function
import os
import pytest
from cryptography.exceptions import AlreadyFinalized, InvalidSignature
from cryptography.hazmat.primitives import hashes, interfaces
from cryptography.hazmat.primitives.asymmetric import dsa
from cryptography.utils import bit_le... | {
"content_hash": "0c1eba19c033473e0b332bd83660396b",
"timestamp": "",
"source": "github",
"line_count": 699,
"max_line_length": 78,
"avg_line_length": 39.17024320457797,
"alnum_prop": 0.5392987582176771,
"repo_name": "dstufft/cryptography",
"id": "14b24d6920f8e7c000f2d212618c70d8a04d7378",
"size": ... |
"""
Django settings for jetere project.
Generated by 'django-admin startproject' using Django 1.9.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | {
"content_hash": "8b2d73490037191c8d6c1515477cb404",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 91,
"avg_line_length": 26.51219512195122,
"alnum_prop": 0.6915056731064091,
"repo_name": "idanmo/jetere",
"id": "12301a5cedec59fb1b40c4882a4ad70095011fa1",
"size": "3261",... |
from __future__ import print_function
from builtins import object
from lib.common import helpers
class Stager(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'AppleScript',
'Author': ['@harmj0y'],
'Description': ('Generates AppleScript to exe... | {
"content_hash": "48dcddfe900d24f2f229cfafdc9ed8c5",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 148,
"avg_line_length": 34.83132530120482,
"alnum_prop": 0.5029401591144933,
"repo_name": "byt3bl33d3r/Empire",
"id": "1817cdab4822231a062069e3eb83575f1ece8b12",
"size": "2... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gitmill.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "c6000bdf5628ec6efd68ffd1a39222fd",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 71,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.7105263157894737,
"repo_name": "gitmill/gitmill",
"id": "a873f8449378f68a5aae483e5bc90c9251cb3445",
"size": "250",... |
import unittest
from flexfit.base import BaseParameter
from flexfit.lineshapes import lorentzian
from flexfit.model import model
from flexfit.algorithms import levenberg_marquardt
import numpy as np
import copy
class TestAlgorithm(unittest.TestCase):
def test_levenberg_marquardt(self):
'''
can I se... | {
"content_hash": "b67f84e7c964651532647e2ef61a4112",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 111,
"avg_line_length": 42.42857142857143,
"alnum_prop": 0.6286676286676287,
"repo_name": "parsonsaaron/FlexFit",
"id": "0b9d1d6b8d1d98dc89ec3888d1bc3c825c0c30a7",
"size": ... |
import sys
from mox3 import mox
from neutronclient.common import exceptions
from neutronclient.neutron.v2_0 import quota as test_quota
from neutronclient.tests.unit import test_cli20
class CLITestV20Quota(test_cli20.CLITestV20Base):
def test_show_quota(self):
resource = 'quota'
cmd = test_quota.... | {
"content_hash": "b67d11179a9744cb646ef525ade33296",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 78,
"avg_line_length": 39.104651162790695,
"alnum_prop": 0.6095747844186739,
"repo_name": "Juniper/python-neutronclient",
"id": "78f4daefe86b822b9787ea86dec20c02c2941e88",
... |
def extractHaikushilanWordpressCom(item):
'''
Parser for 'haikushilan.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('saye', 'SAYE 「Run Freely」', 'trans... | {
"content_hash": "306ab689a30d170ce35cf1367da8602b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 104,
"avg_line_length": 31.59090909090909,
"alnum_prop": 0.581294964028777,
"repo_name": "fake-name/ReadableWebProxy",
"id": "aa3b6c569dd94e6141cea0db6816d0c1eb2171ff",
"si... |
import numpy as np
import datetime as dtm
from dateutil import rrule
import pandas as pd
import csv
import matplotlib.pylab as plt
import sys, os
#lets first create the csv file
#
#change this to actual csv file name
pingfile="weeklylogs.csv"
#paramters @plotinterval = 10 minutes
plotinterval = 10
#csv file columns
col... | {
"content_hash": "00dc5c445adaca8ea2c79dcae287ca33",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 121,
"avg_line_length": 49.53142857142857,
"alnum_prop": 0.639132441162898,
"repo_name": "waidyanatha/pingsam",
"id": "44e045deef397f388e079c0452f9b7433bab4e91",
"size": "... |
"""
Description:
Provides a pyGtk vtkRenderWindowInteractor widget. This embeds a
vtkRenderWindow inside a GTK widget and uses the
vtkGenericRenderWindowInteractor for the event handling. This is
similar to GtkVTKRenderWindowInteractor.py.
The extensions here allow the use of gtkglext rather than ... | {
"content_hash": "db56ec63b31853520aa68ff643c69d86",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 74,
"avg_line_length": 33.43092105263158,
"alnum_prop": 0.5763062087966152,
"repo_name": "hlzz/dotfiles",
"id": "d4a6bd2983e2bbe48a9480cf89322acc98428955",
"size": "10163"... |
from __future__ import absolute_import
import unittest
from builtins import range
from apache_beam.metrics.execution import MetricKey
from apache_beam.metrics.execution import MetricsContainer
from apache_beam.metrics.metricbase import MetricName
class TestMetricKey(unittest.TestCase):
def test_equality_for_key_w... | {
"content_hash": "6e95821edf5d5d0c414ace7122c013a5",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 78,
"avg_line_length": 40.797872340425535,
"alnum_prop": 0.6826597131681877,
"repo_name": "RyanSkraba/beam",
"id": "fc363a4ec1d87df31eb31a6e78b5ee7ef526a833",
"size": "4620... |
"""
encapsulation.py
Created by Thomas Mangin on 2014-06-21.
Copyright (c) 2014-2015 Exa Networks. All rights reserved.
"""
from struct import pack
from struct import unpack
from exabgp.bgp.message.open.asn import ASN
from exabgp.bgp.message.update.attribute.community.extended import ExtendedCommunity
# ==========... | {
"content_hash": "ecc874706d67e5fee8f21fddf9e50f4f",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 144,
"avg_line_length": 23.004716981132077,
"alnum_prop": 0.6188230469550954,
"repo_name": "dneiter/exabgp",
"id": "f50061662a71192f81ab2da3615554323ce7ded5",
"size": "489... |
import sys
import unittest
from PySide import QtGui
from ibl_stuff.libs import qt_helpers
class Foo(QtGui.QDialog):
pass
class Bar():
pass
class SimpleTest(unittest.TestCase):
def test_get_parent_empty(self):
self.assertIsNone(qt_helpers.get_parent())
class TestQt(unittest.TestCase):
P... | {
"content_hash": "5df3c1e29c0b2d22242469f8fdcd1925",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 72,
"avg_line_length": 19.72093023255814,
"alnum_prop": 0.6474056603773585,
"repo_name": "csaez/ibl_stuff",
"id": "cdeaa8203890e8d87c825f4adfde7c65d3cf0c44",
"size": "848",... |
from ..slack.resource import MsgResource
from ..slack.slackbot import SlackerAdapter
class DoNotDisturbManager(object):
def __init__(self):
self.slackbot = SlackerAdapter()
def focus(self, dnd=None):
if dnd.get("dnd_enabled", None):
self.slackbot.send_message(text=MsgResource.FOCU... | {
"content_hash": "24981f65da14c17ef746fa18e3f2beae",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 31.307692307692307,
"alnum_prop": 0.6756756756756757,
"repo_name": "DongjunLee/kino-bot",
"id": "aaa7b9e31512a742fec06e81e681d2040c086cee",
"size": "... |
import json
import datetime
import os
from random import randint
import feedparser
from _core import *
"""
Pyvona Voices
[ Marlene, Hans, Kendra, Salli ]}
"""
# Get JSON Config
json_data = open(getConfigPath(__file__) + str(guid) + '.json').read()
data = json.loads(json_data)
## define time variable
wakeupTime ... | {
"content_hash": "14bd934088d1efa99ce68f895043b947",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 98,
"avg_line_length": 20.916666666666668,
"alnum_prop": 0.6759628154050464,
"repo_name": "WakemeHackathon/AlarmPi",
"id": "07480f8af5b98e984e8a829bf2f0fd0a8999f745",
"size... |
from __future__ import unicode_literals, print_function
import frappe
import unittest, json, sys, os
import time
import xmlrunner
import importlib
from frappe.modules import load_doctype_module, get_module_name
from frappe.utils import cstr
import frappe.utils.scheduler
import cProfile, pstats
from six import StringIO... | {
"content_hash": "76217fe38095678c0f7059a09df0c5dc",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 114,
"avg_line_length": 30.070093457943926,
"alnum_prop": 0.7089355089355089,
"repo_name": "vjFaLk/frappe",
"id": "e7ec13afe6d6b3f36a9bcfa9cd1afdbe78b66d0b",
"size": "1297... |
import pytest
from notifiers.exceptions import BadArguments
from notifiers.exceptions import NotificationError
from notifiers.exceptions import ResourceError
provider = "gitter"
class TestGitter:
def test_metadata(self, provider):
assert provider.metadata == {
"base_url": "https://api.gitter... | {
"content_hash": "1c904d53d647b66a7a24f9c9017ae928",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 72,
"avg_line_length": 33.08474576271186,
"alnum_prop": 0.5998975409836066,
"repo_name": "liiight/notifiers",
"id": "0da81888a236fc77b0da9e79bca79844e57e062c",
"size": "39... |
"""Implement (a generalized version of) the idea from papers [1, 2].
[1] Alexandre Sedoglavic, "A non-commutative algorithm for multiplying (7 × 7)
matrices using 250 multiplications" (2017).
[2] Drevet, Charles-Éric, Md Nazrul Islam, and Éric Schost. "Optimization
techniques for small matrix multiplication." Theoret... | {
"content_hash": "deb90621974e50589868faeb7072c688",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 80,
"avg_line_length": 43.17901234567901,
"alnum_prop": 0.6677626876340244,
"repo_name": "deepmind/alphatensor",
"id": "efa84565ab957f8cd27e403774a7cc3fc6e6fa2b",
"size": ... |
from __future__ import absolute_import
import json
import mock
import os.path
import responses
import pytest
from datetime import datetime
from flask import current_app
from uuid import UUID
from changes.config import db
from changes.constants import Status, Result
from changes.models import (
Artifact, TestCase... | {
"content_hash": "d9ed35a4442706e2a1f919ee852da16b",
"timestamp": "",
"source": "github",
"line_count": 845,
"max_line_length": 260,
"avg_line_length": 35.19644970414201,
"alnum_prop": 0.5763760465350862,
"repo_name": "alex/changes",
"id": "e1ca6cd81369263deb5f10806c40c309f0d6dfe7",
"size": "29741"... |
from django.contrib import admin
from django.http import HttpResponse, HttpResponseNotFound
from django.template import Context, Template
from django.urls import include, path
import treenav.urls
from ..admin import MenuItemAdmin
from ..models import MenuItem
admin.autodiscover()
# create a second Admin site and reg... | {
"content_hash": "0f218a8d42829c95bdb9d6fd13956f70",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 74,
"avg_line_length": 24.674418604651162,
"alnum_prop": 0.6672950047125353,
"repo_name": "caktus/django-treenav",
"id": "850c8920ca42db928d7fea4cfe529a40f5df4aec",
"size":... |
import glob
import logging
import os
import pyauto_functional # Must be imported before pyauto
import pyauto
class ThemesTest(pyauto.PyUITest):
"""TestCase for Themes."""
def Debug(self):
"""Test method for experimentation.
This method will not run automatically.
"""
while True:
raw_inpu... | {
"content_hash": "4ad786e54049e92c44dd91b867fb7fa8",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 79,
"avg_line_length": 33.645348837209305,
"alnum_prop": 0.6476585450146881,
"repo_name": "keishi/chromium",
"id": "e856f04c1de7fea918a9094c26c7ed3c685f283f",
"size": "597... |
from django.apps import AppConfig
class MediaAuthConfig(AppConfig):
name = "media_management_api.media_auth"
verbose_name = "media_management_api.media_auth"
| {
"content_hash": "2b0c7e3338eb26ba295c9fb270a608a8",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 52,
"avg_line_length": 28,
"alnum_prop": 0.7559523809523809,
"repo_name": "Harvard-ATG/media_management_api",
"id": "9089a31846645e43f3c4fba3cf33eb0280788921",
"size": "168"... |
import re
import time
from datetime import datetime
import pytest
import requests.adapters
from responses import matchers
from mollie.api.client import Client, generate_querystring
from mollie.api.error import (
NotFoundError,
RequestError,
RequestSetupError,
ResponseError,
ResponseHandlingError,
... | {
"content_hash": "661a01c7ddc7b48f7a267041f460976b",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 154,
"avg_line_length": 40.02570093457944,
"alnum_prop": 0.6870001751211254,
"repo_name": "mollie/mollie-api-python",
"id": "8049da5341a47dc1cfca1d44e5eb3e735bc760dd",
"si... |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^', include('config.urls_api')),
url(r'^admin/', admin.site.urls),
]
| {
"content_hash": "855d4b2f209fcdfdf29eb8c4541ff34a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 25,
"alnum_prop": 0.68,
"repo_name": "tm-kn/farmers-api",
"id": "89fb44840abe4bb923b5e8784cefb884d80b3cda",
"size": "175",
"binary": false,
"copie... |
"""Template task in which two jars need to be toppled over."""
import phyre.creator as creator_lib
__PLATFORM_X = [val * 0.05 for val in range(6, 16)]
__PLATFORM_Y = [val * 0.1 for val in range(0, 8)]
@creator_lib.define_task_template(
max_tasks=100,
platform1_x=__PLATFORM_X,
platform1_y=__PLATFORM_Y,
... | {
"content_hash": "fa69267418e6b4d70e35590a1e3d8f73",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 35.140625,
"alnum_prop": 0.6153846153846154,
"repo_name": "facebookresearch/phyre",
"id": "d3a8d90223ed0a5ccc3de86cf2bd3e590b4ba6f7",
"size": "2847",... |
from lintreview.review import Problems, Comment
from lintreview.tools.pep8 import Pep8
from unittest import TestCase
from tests import root_dir, read_file, read_and_restore_file, requires_image
class TestPep8(TestCase):
fixtures = [
'tests/fixtures/pep8/no_errors.py',
'tests/fixtures/pep8/has_err... | {
"content_hash": "0f3db8f38a5fad6fdd615911d0c3579d",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 78,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.6114718614718615,
"repo_name": "markstory/lint-review",
"id": "b9f862039848ef439f1cfa18acbb7d1990fb6191",
"size"... |
default_app_config = 'wagtail_embed_videos.apps.WagtailEmbedVideosAppConfig'
| {
"content_hash": "b598018efdf7dc383d99dd8bf020da0d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 76,
"avg_line_length": 77,
"alnum_prop": 0.8441558441558441,
"repo_name": "infoportugal/wagtail-embedvideos",
"id": "de6feab266339ab41abd82d0e064bdd7429c53e0",
"size": "77",... |
"""Translates gRPC's server-side API into gRPC's server-side Beta API."""
import collections
import threading
import grpc
from grpc import _common
from grpc.beta import _metadata
from grpc.beta import interfaces
from grpc.framework.common import cardinality
from grpc.framework.common import style
from grpc.framework.... | {
"content_hash": "08dfcb250b1845e46dc183b7b56eaa36",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 82,
"avg_line_length": 37.44266666666667,
"alnum_prop": 0.587422548251549,
"repo_name": "simonkuang/grpc",
"id": "ccafec8951d1d14889b5826d51fd3beb60c63e4d",
"size": "14618... |
import flask
from flask.testing import FlaskClient
def test_get_index(app: flask.app.Flask, client: FlaskClient) -> None:
res = client.get("/")
assert res.status_code == 200
def test_post_index(app: flask.app.Flask, client: FlaskClient) -> None:
res = client.post("/")
assert res.status_code == 405
| {
"content_hash": "9fca23cbd6e58556f7ba58419bc8d19c",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 71,
"avg_line_length": 26.583333333333332,
"alnum_prop": 0.6833855799373041,
"repo_name": "GoogleCloudPlatform/cloud-run-microservice-template-python",
"id": "89a921967eca876... |
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
if __name__ == '__main__':
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.ru... | {
"content_hash": "18e6a5170899e5151ac88f3d8af70b22",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.6894736842105263,
"repo_name": "nigma/django-easy-pdf",
"id": "ed27485d8c392113af2b7701e847271d105828a1",
"size":... |
import os
import testinfra.utils.ansible_runner
import pytest
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize("package", [
"zsh",
])
def test_packages(host, package):
p = host.package(package)
assert p... | {
"content_hash": "b8c7c6ea125279cbb052db9c50c42a35",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 21.655172413793103,
"alnum_prop": 0.6552547770700637,
"repo_name": "ctorgalson/ansible-role-oh-my-zsh",
"id": "15ef0569e92b98e8fff8f194974188c1a2a2cd58... |
from __future__ import absolute_import
from google.appengine.ext import ndb
# import do not work yet (for unit test)
# add them later
from api import fields
import model
import util
import config
#TODO import Taggable
#class WayPoint(model.Base): # does not work with unit test yet
from .tag import Taggable#, TagStr... | {
"content_hash": "18e168b08edf21587559ab4a04275f28",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 89,
"avg_line_length": 32.22549019607843,
"alnum_prop": 0.540614542135686,
"repo_name": "wodore/wodore-gae",
"id": "84ce6d5961933ecb41817fc67379df88983f6762",
"size": "330... |
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
from random import randrange
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, force=True... | {
"content_hash": "c6affaaba1fab1495f1d2bf90619c717",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 120,
"avg_line_length": 27.302702702702703,
"alnum_prop": 0.5810730548406257,
"repo_name": "netajibasa/simplealphabets",
"id": "5bea9ebd89d32c17d50947fe2dc57937f5fe19d9",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Inventory', '0013_auto_20151227_1230'),
]
operations = [
migrations.RenameField(
model_name='ecoresproductmodel',
old_name='... | {
"content_hash": "0571d88878d7c819b4c6c0c575f72397",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 49,
"avg_line_length": 21.88888888888889,
"alnum_prop": 0.6091370558375635,
"repo_name": "alexharmenta/Inventationery",
"id": "68f127669ceb199265353cfaba5517c484d6344d",
"s... |
from django.conf.urls import url
from .views import multiple_form
from .autocomplete_light_registry import CustomAutocomplete
from .models import ModelOne, ModelTwo
urlpatterns = [
url(r'^$', multiple_form, name='select2_outside_admin_multiple'),
# Autocomplete urls
url(
r'^modelone-autocomplete/... | {
"content_hash": "2bfc70a928862e6bf3af5ef5c30e25c3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 69,
"avg_line_length": 25.692307692307693,
"alnum_prop": 0.6182634730538922,
"repo_name": "shubhamdipt/django-autocomplete-light",
"id": "a563c64157f6723be8722d91abf3897d4511... |
from itertools import chain
from typing import Dict, Iterable, NewType, Union
from attr import attrib, attrs, evolve
from polygraph.types import (
DeferredType,
PolygraphField,
PolygraphInputValue,
PolygraphType,
)
from polygraph.utils.strict_dict import StrictDict
TypeName = NewType("TypeName", str... | {
"content_hash": "0462ef40aa8170138b8677e66af8c20d",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 90,
"avg_line_length": 28.80373831775701,
"alnum_prop": 0.6537962362102531,
"repo_name": "polygraph-python/polygraph",
"id": "3d4706d8067b2fa7975cb2aa9df27b2ad9f3a759",
"s... |
from playlist.models import SlackUser, Song
import simplejson as json
import pickle
from Queue import Queue
class PlaylistService:
def __init__(self, reco_service):
self.reco_service = reco_service
self.load()
def enqueue(self, song):
self.load()
self.reco_service.next_reco_for... | {
"content_hash": "80997ca5c400ec1ac38aa5d2d3a20256",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 48,
"avg_line_length": 23.966666666666665,
"alnum_prop": 0.5373203523412147,
"repo_name": "schatten/radioslack",
"id": "57d4a55b6235cd4012284df5d98e0456dcff9d68",
"size": "... |
"""imake_web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | {
"content_hash": "18f40f4c97fc42bb8d2b24d84b9a4410",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 36.142857142857146,
"alnum_prop": 0.6982872200263505,
"repo_name": "chanita/imake",
"id": "b14c5264cf1a6d62af5228c7a45a3b8c254c345c",
"size": "759",
... |
import contextlib
import copy
import mock
from webob import exc
from quantum.api import extensions
from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from quantum.common import constants
from quantum import context
from quantum.db import agents_db
from quantum.db import dhcp_rpc_base
from quantum.db import... | {
"content_hash": "c63437072f5c80b695fee951a2a6d516",
"timestamp": "",
"source": "github",
"line_count": 899,
"max_line_length": 79,
"avg_line_length": 49.07230255839822,
"alnum_prop": 0.5095656904524436,
"repo_name": "yamt/neutron",
"id": "4ab15a88a8de20b8a60307784ced21dffd4e8226",
"size": "44707",... |
import abc
class OutputMatch(object):
def __init__(self, key, item, words):
self.key = key
self.item = item
self.words = words
class AbstractOutputItem(object):
"""
Represents one target or context word
"""
__metaclass__ = abc.ABCMeta
@abc.abstractproperty
def id... | {
"content_hash": "33b4033e3bae88110b89feaf1b84c9c0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 87,
"avg_line_length": 22.9,
"alnum_prop": 0.6076107298814722,
"repo_name": "FilippoC/anatomize",
"id": "7ab95b0215bdfe1abce378f0adfb17692764aac9",
"size": "1603",
"binar... |
import abc
from oslo_config import cfg
from oslo_log import log as logging
from pkg_resources import iter_entry_points
import requests
import six
from magnum.common import clients
from magnum.common import exception
from magnum.common import paths
from magnum.i18n import _
from magnum.i18n import _LW
LOG = logging.... | {
"content_hash": "7b5c98ed29e9c2b0a49967bb2a173dc4",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 79,
"avg_line_length": 37.44230769230769,
"alnum_prop": 0.5671052111730078,
"repo_name": "jay-lau/magnum",
"id": "3bc40847011c7ef846fd3cbfaa787dd707650fd9",
"size": "25911... |
import contextlib
import logging
import os
import shutil
import subprocess
import socket
import sys
import time
import pywintypes
import win32api
import win32service
import win32serviceutil
import rpc_client
_UPDATER_TEST_SERVICE_NAME = 'UpdaterTestService'
# Errors that might be raised when interacting with the s... | {
"content_hash": "e36ad78edf92b7f783d4e9bd4d1667ed",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 80,
"avg_line_length": 29.69795918367347,
"alnum_prop": 0.6944749862561848,
"repo_name": "ric2b/Vivaldi-browser",
"id": "3389bdf1da31f59f18910139c725f72358e4df53",
"size":... |
import os
import sys
import pytest
try:
import clr
except ImportError:
clr = None
from msl import loadlib
def add_py4j_in_eggs():
# if py4j is located in the .eggs directory and not in the site-packages directory
# then the py4j*.jar file cannot be found, so we need to create a PY4J_JAR env variable... | {
"content_hash": "794ba169e496f6387e2a1fe1d035d5a2",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 104,
"avg_line_length": 30.862903225806452,
"alnum_prop": 0.651685393258427,
"repo_name": "MSLNZ/msl-loadlib",
"id": "9cd783d385f421b7f799c4b3af8abe494750aeea",
"size": "3... |
import sys
sys.path.append('../src')
import getopt
opts, _ = getopt.getopt(sys.argv[1:], 't:', ['test'])
n_night_shifts = 5
n_day_shifts = 5
n_tasks = n_night_shifts+n_day_shifts
horizon = n_tasks
from pyschedule import Scenario, solvers, plotters
S = Scenario('shift_bounds',horizon=horizon)
R = S.Resource('P')
for ... | {
"content_hash": "41853a924e177494bd8639bbfadda863",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 88,
"avg_line_length": 29.217391304347824,
"alnum_prop": 0.6555059523809523,
"repo_name": "timnon/pyschedule",
"id": "f489c8e357b676ad2e0bdc06344fbc7a252a41cd",
"size": "13... |
import _index
from energy.libs.MongoStock import Feed
from energy.libs.eAlgoLib import eAlgoLib as eal
from pyalgotrade import strategy
from pyalgotrade import bar
#from pyalgotrade.technical import stoch
from pyalgotrade.technical import ma
from pyalgotrade.talibext import indicator
from pyalgotrade.technical import ... | {
"content_hash": "47e606b907a0e193def155414531fc62",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 139,
"avg_line_length": 36.524752475247524,
"alnum_prop": 0.6177825969097316,
"repo_name": "vyouzhis/energy",
"id": "1a7e60cc016a1eda3628e9166ed63b56d671fa3d",
"size": "38... |
import pytest
import boto3
import base64
import os
import json
import time
import uuid
from faker import Factory
from dotenv import Dotenv
from api.chalicelib.aws_ir.aws_ir.plugins import tag_host
CFN_TEMPLATE_PATH = "cfn/dummy-machine.yml"
SESSION = boto3.Session(
profile_name='incident-account',
region_na... | {
"content_hash": "6e109b9ec78963037b6bee5d389b3b43",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 81,
"avg_line_length": 26.452380952380953,
"alnum_prop": 0.621962196219622,
"repo_name": "ThreatResponse/aws_ir-api",
"id": "9487bcf646a2ebaefc010973c8a758ea555778c1",
"siz... |
import google.api_core.grpc_helpers
from google.cloud.trace_v1.proto import trace_pb2_grpc
class TraceServiceGrpcTransport(object):
"""gRPC transport class providing stubs for
google.devtools.cloudtrace.v1 TraceService API.
The transport provides access to the raw gRPC stubs,
which can be used to ta... | {
"content_hash": "96f5465915db0a397d3f7f4ebe2820f9",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 87,
"avg_line_length": 37.44927536231884,
"alnum_prop": 0.6178405572755418,
"repo_name": "tswast/google-cloud-python",
"id": "63239085778e5a4961a2279fc61dd034c07a7ebb",
"s... |
"""
Test plugin infrastructure and hooks.
"""
import argparse
import sys
from unittest import (
mock,
)
import pytest
import cmd2
from cmd2 import (
Cmd2ArgumentParser,
exceptions,
plugin,
with_argparser,
)
class Plugin:
"""A mixin class for testing hook registration and calling"""
def ... | {
"content_hash": "2d6222728f580709868c29b2d1342dcb",
"timestamp": "",
"source": "github",
"line_count": 1005,
"max_line_length": 127,
"avg_line_length": 33.41492537313433,
"alnum_prop": 0.6915311774164731,
"repo_name": "python-cmd2/cmd2",
"id": "61b140ab07d7f37ad8c9daa18e4d0fc710f34064",
"size": "3... |
from injector import singleton, inject
from .. import DataBuilder
from ..measurement import Measurements
try:
import configparser
except ImportError:
import configparser as configparser
from sht1x.Sht1x import Sht1x as SHT1x
@singleton
class Sensor:
name = "SHT1x"
priority = 1
@inject
def ... | {
"content_hash": "2cd58d9f1d9566b011cb6abfca4de600",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 101,
"avg_line_length": 33.42,
"alnum_prop": 0.6223818073010173,
"repo_name": "wuan/klimalogger",
"id": "a801ddf70ae76b8f78c85860a1448888454ef682",
"size": "1697",
"binar... |
"""
Create a profile object from a `numpy.ndarray` of data
======================================================
Use the TAMOC ambient module to create profiles in netCDF format for use by
TAMOC from idealized laboratory data. This file demonstrates working with the
data input directly by the user as a `numpy.ndarra... | {
"content_hash": "e2122b93f74b2a5449a5a72e61e920ec",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 210,
"avg_line_length": 32.2463768115942,
"alnum_prop": 0.647191011235955,
"repo_name": "socolofs/tamoc",
"id": "4b557cf9a0c75fd2dbe41822f14230964f3e3542",
"size": "2225",
... |
'''
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Update (2015-02-12):
For C programmers: Try to solve it in-place in O(1) space.
click to show clarification.
Clarification:
What constitutes a word?
A sequence of non-space characters cons... | {
"content_hash": "37490ce64ae6852c22df0d455846ae28",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 87,
"avg_line_length": 29.933333333333334,
"alnum_prop": 0.562731997030438,
"repo_name": "UmassJin/Leetcode",
"id": "2adaae4dfcc4202d772e34ab21be2d191d615c05",
"size": "134... |
"""Base class for linear operators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import contextlib
import numpy as np
import six
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorf... | {
"content_hash": "4c48fc76244f662d0e76f6209ebccffd",
"timestamp": "",
"source": "github",
"line_count": 978,
"max_line_length": 99,
"avg_line_length": 34.83537832310839,
"alnum_prop": 0.6464821391881183,
"repo_name": "apark263/tensorflow",
"id": "4c99e86dc59a8c39abb57494ae84bcfdc13faa1b",
"size": "... |
import re
from .exceptions import NotAllowed, LoginRequired
def check_permissions(path, restrictions, request) -> bool:
"""
Enforces the rules specified in `CRM_CONTENT_RESTRICTIONS`.
"""
for rule in restrictions:
if rule['path'] == '*' or (path is not None and re.match(r'^' + rule['path'] + ... | {
"content_hash": "6533bec3fa3bb55350df17ae2310ee98",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 117,
"avg_line_length": 29.2,
"alnum_prop": 0.5743639921722113,
"repo_name": "zulumarketing/crm",
"id": "cf60d6dcc85cc863f98d3382daa598e5cefe2237",
"size": "1047",
"binar... |
r"""
This script transfers pages from a source wiki to a target wiki.
It also copies edit history to a subpage.
-tolang: The target site code.
-tosite: The target site family.
-prefix: Page prefix on the new site.
-overwrite: Existing pages are skipped by default. Use his option to... | {
"content_hash": "8c7072ba3865ffbe7cac675dd0c121c9",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 79,
"avg_line_length": 29.427777777777777,
"alnum_prop": 0.6299792335284123,
"repo_name": "magul/pywikibot-core",
"id": "e727e644e2bf5ef3c12e77da99f032a0128d48f0",
"size":... |
import os
import zope.testrunner
from sparc.testing.fixture import test_suite_mixin
class test_suite(test_suite_mixin):
package = 'sparc.catalog.repoze'
module = 'field'
if __name__ == '__main__':
zope.testrunner.run([
'--path', os.path.dirname(__file__),
... | {
"content_hash": "a24880200d5ffcd7826a708063d2cc8d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 29.0625,
"alnum_prop": 0.49032258064516127,
"repo_name": "davisd50/sparc.catalog",
"id": "22bc5655b67e46cf0dff95b57792908881c00a57",
"size": "465",
... |
import glob
import os
import unittest
import warnings
import comtypes.typeinfo
import comtypes.client
import comtypes.client._generate
from comtypes.test import requires
requires("typelibs")
# filter warnings about interfaces without a base interface; they will
# be skipped in the code generation.
warnin... | {
"content_hash": "b763e6577da5864fe9e29cd02c79a520",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 109,
"avg_line_length": 33.66101694915254,
"alnum_prop": 0.5843403826787512,
"repo_name": "ezarko/cfn-init",
"id": "3a36126c628746bb4f757f7d40fd493baa26373e",
"size": "397... |
import json
from google.appengine.ext import ndb
class Insight(ndb.Model):
"""
Insights are the end result of analyzing a batch of data, such as the
average score for all matches in a year.
key_name is like '2012insights_matchavg'
"""
MATCH_HIGHSCORE = 0
MATCH_HIGHSCORE_BY_WEEK = 1
M... | {
"content_hash": "17e97e467593cb9aec97843bdf700d6e",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 83,
"avg_line_length": 34.79,
"alnum_prop": 0.6407013509629204,
"repo_name": "the-blue-alliance/the-blue-alliance",
"id": "ecfd76c6419faa0354296d95029e950086139408",
"size... |
import cgi
import datetime
import html
import logging
import re
import time
import urllib
import urllib.parse
from collections import deque
from dataclasses import dataclass
from typing import (
Any,
Callable,
Dict,
Generic,
List,
Match,
Optional,
Pattern,
Set,
Tuple,
TypeVar... | {
"content_hash": "b5ee06e854957dac36eb8cf00b4ee00b",
"timestamp": "",
"source": "github",
"line_count": 2628,
"max_line_length": 160,
"avg_line_length": 39.092465753424655,
"alnum_prop": 0.5875212926461284,
"repo_name": "kou/zulip",
"id": "00df4937bd50ddc3284f25c5e838b4c52f1128e0",
"size": "102861"... |
from unipath import Path
import os
PROJECT_ROOT = Path(__file__).ancestor(2)
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Paul Hallett', '[email protected]'),
)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
MANAGERS = ADMINS
BASE_URL = 'http://pokeapi.co'
# Hosts/domain nam... | {
"content_hash": "497b63b9af0313286c3cfa312eb8d03a",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 82,
"avg_line_length": 23.683417085427134,
"alnum_prop": 0.6541481009972416,
"repo_name": "phalt/pokeapi",
"id": "1b2731b4d91a8c16dc69788b7a2793f649095441",
"size": "4735"... |
"""
Copyright (c) 2020 The Orbit Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
"""
import logging
import time
from pywinauto.base_wrapper import BaseWrapper
from core.orbit_e2e import E2ETestCase, wait_for_condition
class MoveTab(E2E... | {
"content_hash": "49b72e4d058999825691e92a30547800",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 102,
"avg_line_length": 42.301587301587304,
"alnum_prop": 0.6112570356472795,
"repo_name": "google/orbit",
"id": "7f4a7aa21098b89b9b149a70ae007d00de5322f4",
"size": "5330"... |
from runner.koan import *
class AboutStringManipulation(Koan):
def test_use_format_to_interpolate_variables(self):
value1 = 'one'
value2 = 2
string = "The values are {0} and {1}".format(value1, value2)
self.assertEqual("The values are one and 2", string)
def test_formatted_va... | {
"content_hash": "0ec9d349593bb220af61c253132d1e54",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 79,
"avg_line_length": 37.41095890410959,
"alnum_prop": 0.6188209447088978,
"repo_name": "vatsala/python_koans",
"id": "be41a03718c9efb0626e1dcd7c5d2030a4bc499f",
"size": "... |
import io
import logging
import research.coding.varbyte
from research.index.common import Metadata
from research.index.common import raise_property_not_found
from research.lexicon import ArrayLexicon
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
class ForwardIndex:
def __init__(se... | {
"content_hash": "f2224371efdeb2f5dcea29bf48ed379d",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 113,
"avg_line_length": 35.33163265306123,
"alnum_prop": 0.592202166064982,
"repo_name": "west-tandon/ReSearch",
"id": "cee95bd9b635e0d94fbde952023f5e50f187be08",
"size": ... |
"""
A :term:`NIC` (Network Interface Card) is a logical entity that provides a
:term:`Partition` with access to external communication networks through a
:term:`Network Adapter`. More specifically, a NIC connects a Partition with a
:term:`Network Port`, or with a :term:`Virtual Switch` which then connects to
the Networ... | {
"content_hash": "72acac1f93547c0657d36fd6599e5a0f",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 79,
"avg_line_length": 34.901234567901234,
"alnum_prop": 0.6090378493102229,
"repo_name": "zhmcclient/python-zhmcclient",
"id": "3a2b0e46c15584203c1078b76b2dc84fd58033ca",
... |
"""
Created on Fri Jun 05 21:36:21 2015
@author: Paco
"""
from api import API
class NineGag(API):
_class_name = '9Gag'
_category = 'Social'
_help_url = 'https://github.com/k3min/infinigag'
_api_url = 'http://infinigag.eu01.aws.af.cm/'
def _parsing_data(self,data):
res = {'de... | {
"content_hash": "d87aecbdecc2c250e277a9f698f92116",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 28.181818181818183,
"alnum_prop": 0.556989247311828,
"repo_name": "franblas/pyAPI",
"id": "ea677555bc00e2afec7005d8fdc1a6d2d894d14d",
"size": "954",
... |
from unittest import TestCase
from chatterbot.adapters.output import OutputAdapter
class OutputAdapterTestCase(TestCase):
"""
This test case is for the OutputAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality ... | {
"content_hash": "458b46e01fb5ec0cc2b2f81aa6cb7079",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 79,
"avg_line_length": 35.22222222222222,
"alnum_prop": 0.7287066246056783,
"repo_name": "osDanielLee/SelfThinkingRobot",
"id": "d50adc2405c8121abce5acbcf91f5a420b44147e",
... |
"""Train a Fast R-CNN network on a region of interest database."""
import argparse
import pprint
import numpy as np
import pdb
import sys
import os.path
import tensorflow as tf
# this_dir = os.path.dirname(__file__)
# sys.path.insert(0, this_dir + '/..')
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.realp... | {
"content_hash": "f2922ff0662280093cf84106152dcdc6",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 103,
"avg_line_length": 37.850467289719624,
"alnum_prop": 0.5841975308641976,
"repo_name": "Zardinality/TF_Deformable_Net",
"id": "1138a045f1b28b032a59702a86c5ab83b7eef5fb",... |
from ftplib import FTP
import sys, os, os.path, operator
def upload(handle,filename):
f = open(filename,"rb")
(base,ext) = os.path.splitext(filename)
picext = ".bmp .jpg .jpeg .dib .tif .tiff .gif .png"
if(operator.contains(picext,ext)):
try:
handle.storbinary("STOR " + filename,f,1)
except Exception:
pr... | {
"content_hash": "d343f01e7bb98f59706b2a96f0c2b3a4",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 252,
"avg_line_length": 27.96,
"alnum_prop": 0.6763233190271817,
"repo_name": "ActiveState/code",
"id": "fc08717a6d31b61c61f0206174c48bbf5fb31c8e",
"size": "5592",
"bina... |
from collections import OrderedDict
from collections import defaultdict
from flask import redirect
from flask import render_template
from flask_login import current_user
from markupsafe import escape
from sqlalchemy import and_
from sqlalchemy_continuum import version_class
from sqlalchemy_continuum import versioning_... | {
"content_hash": "f3cf8717c134b216364c705b187bc5a8",
"timestamp": "",
"source": "github",
"line_count": 594,
"max_line_length": 112,
"avg_line_length": 40.7979797979798,
"alnum_prop": 0.6249071552364447,
"repo_name": "archlinux/arch-security-tracker",
"id": "fd555df84771cb1e141030666e25e91803155366",... |
from __future__ import unicode_literals
import calendar
import datetime
from django.utils import http as http_utils
from daydreamer.tests.views.core import http
class TestCase(http.TestCase):
"""
Common utilities for testing HTTP view behaviors.
"""
# Utilities.
def format_etag(self, etag)... | {
"content_hash": "a1f1f470bfc5dd5523bb033790d83f34",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 22.482758620689655,
"alnum_prop": 0.6196319018404908,
"repo_name": "skibblenybbles/django-daydreamer",
"id": "c1dbd99308c34797df473e8ba4d58ceb16e40f30"... |
"""A manual controller for model search."""
from typing import Iterator, Sequence
from adanet.experimental.controllers.controller import Controller
from adanet.experimental.phases.phase import ModelProvider
from adanet.experimental.phases.phase import Phase
from adanet.experimental.work_units.work_unit import WorkUnit... | {
"content_hash": "3bc31c80bb03cbfbb599d4d50f2a029e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 34.34285714285714,
"alnum_prop": 0.7271214642262895,
"repo_name": "tensorflow/adanet",
"id": "5e186bccef04651949a2a2c229fda78010d67058",
"size": "182... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.