text stringlengths 4 1.02M | meta dict |
|---|---|
import time
from django import forms
from django.conf import settings
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.hashcompat import sha_constructor
from django.utils.translation import ungettext, ugettext_lazy as _
from tcc.models import Comment
class CommentForm(forms.Model... | {
"content_hash": "68dcdd1f8a706e62e750835d0e54bf52",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 86,
"avg_line_length": 41.54838709677419,
"alnum_prop": 0.6061723602484472,
"repo_name": "pterk/django-tcc-tmp",
"id": "195eba98d4614b81506adfded8803e66ad21190d",
"size": ... |
"""
The functionality itself for each task.
Each task is specified with the ``a_task`` decorator and indicates whether it's
necessary to provide the task with the object containing all the images and/or
one specific image object.
"""
from harpoon.container_manager import make_server, Manager, wait_for_server
from harp... | {
"content_hash": "600567400814200ca387c6822839b770",
"timestamp": "",
"source": "github",
"line_count": 509,
"max_line_length": 100,
"avg_line_length": 32.717092337917485,
"alnum_prop": 0.6422266258331832,
"repo_name": "delfick/harpoon",
"id": "070073e578f13f7b143e50ac0813900a2db1e94a",
"size": "16... |
"""VIF drivers for libvirt."""
import copy
from oslo.config import cfg
from nova import exception
from nova.network import linux_net
from nova.network import model as network_model
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.openstack.common import proc... | {
"content_hash": "a119fdba8024dde12b4146f5283a819b",
"timestamp": "",
"source": "github",
"line_count": 827,
"max_line_length": 79,
"avg_line_length": 40.051995163240626,
"alnum_prop": 0.5395042719560427,
"repo_name": "nkrinner/nova",
"id": "3a1b2f75f2de4d0e191d5d3c2de718caebec3a5d",
"size": "33825... |
"""
Django settings for data_refinery_foreman project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
... | {
"content_hash": "6371918006446077b7bb8b662dbbc009",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 91,
"avg_line_length": 29.382716049382715,
"alnum_prop": 0.6859243697478992,
"repo_name": "data-refinery/data_refinery",
"id": "5a8955bf618e795536fa60a99e5e18992aa1e534",
... |
import time
import ezdxf
BIG_FILE = ezdxf.options.test_files_path / "CADKitSamples" / "torso_uniform.dxf"
def load_ascii():
with open(BIG_FILE, "rt", encoding="cp1252") as fp:
while True:
line = fp.readline()
if not line:
break
def load_bytes():
with open(BIG... | {
"content_hash": "492e5d27bda60c19f32d8a199b56e6d7",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.5692307692307692,
"repo_name": "mozman/ezdxf",
"id": "21d3145596b18d0030efd037d2d73cc0d35d79d1",
"size": "847",
... |
"""
WSGI config for english_diary project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | {
"content_hash": "cabfae62ac9c2a4634f8d95116e56e28",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.1875,
"alnum_prop": 0.771712158808933,
"repo_name": "jupiny/EnglishDiary",
"id": "f8b923cf56aa6009d39a136d8721b5a74a61f381",
"size": "403",
"bin... |
"""Define your static and time-series features based on input data."""
import collections
import functools
import logging
import math
from typing import Dict, List, Optional, Sequence, Tuple
import numpy as np
import pandas as pd
from covid_epidemiology.src import constants
from covid_epidemiology.src import feature_... | {
"content_hash": "89db9b841938bedf14a28e6417fee4dd",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 80,
"avg_line_length": 40.05665722379604,
"alnum_prop": 0.6864922206506365,
"repo_name": "google-research/google-research",
"id": "4857946792bdcb52a0108882919ee3f6108b1c71",... |
from __future__ import print_function
import site
import getopt, glob, sys
from PIL import Image
if len(sys.argv) == 1:
print("PIL File 0.4/2003-09-30 -- identify image files")
print("Usage: pilfile [option] files...")
print("Options:")
print(" -f list supported file formats")
print(" -i show... | {
"content_hash": "4b445ce93c9cc0acfdc6dfc9d37086e9",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 77,
"avg_line_length": 26.644736842105264,
"alnum_prop": 0.5145679012345679,
"repo_name": "gannetson/sportschooldeopenlucht",
"id": "3c3997466850fbf932d566ff54a8c657daf08d31"... |
"""Fichier contenant le paramètre 'créer' de la commande 'roadmap'."""
from primaires.interpreteur.masque.parametre import Parametre
class PrmCreer(Parametre):
"""Commande 'roadmap créer'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, "créer", "create")
... | {
"content_hash": "ee45c5dad17aed22e5ffe0fdbf0e8d88",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 43.67567567567568,
"alnum_prop": 0.6051980198019802,
"repo_name": "vlegoff/tsunami",
"id": "87912ac1cc92f35a1d2e4b0e2705fbe31e55b500",
"size": "3211"... |
import numpy as np
import tensorflow as tf
from sandbox.rocky.tf.core.layers_powered import LayersPowered
from sandbox.rocky.tf.core.network import MLP
from sandbox.rocky.tf.misc import tensor_utils
from sandbox.rocky.tf.distributions.categorical import Categorical
from sandbox.rocky.tf.optimizers.penalty_lbfgs_optimi... | {
"content_hash": "e17e0f7b820de5dae7ed8c3b771d7c6d",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 119,
"avg_line_length": 40.72832369942196,
"alnum_prop": 0.5973602043712745,
"repo_name": "brain-research/mirage-rl-qprop",
"id": "62c4d07ec3acb5f18fc3b4de1c9bc44454d8b6ee",... |
from urllib3.util.url import parse_url
class InsecureTransport(Exception):
pass
class InvalidHost(Exception):
pass
def is_secure_transport(uri):
"""Check if the uri is over ssl."""
return uri.lower().startswith('https://')
def verify_host(url, allowed):
return parse_url(url).host in allowed
| {
"content_hash": "244b4fa772848fc2ac6d42c71918a294",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 45,
"avg_line_length": 17.77777777777778,
"alnum_prop": 0.696875,
"repo_name": "keybar/keybar",
"id": "65027796c50b2637957013bd1eb1101e5b9ce106",
"size": "344",
"binary":... |
"""Alexa state report code."""
from __future__ import annotations
import asyncio
from http import HTTPStatus
import json
import logging
import aiohttp
import async_timeout
from homeassistant.const import MATCH_ALL, STATE_ON
from homeassistant.core import HomeAssistant, State, callback
from homeassistant.helpers.sign... | {
"content_hash": "1d01c77afc54776bcc72409b7c3772b8",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 129,
"avg_line_length": 30.781569965870307,
"alnum_prop": 0.644417341168644,
"repo_name": "jawilson/home-assistant",
"id": "767bfa18224a09e87af01ac66d25fc9f63408729",
"siz... |
from marshmallow_enum import EnumField
from marshmallow_sqlalchemy import ModelSchema
from ..models import Role, User
class UserSchema(ModelSchema):
class Meta:
model = User
dump_only = ('created_at', 'last_signed_in_at', 'updated_at')
exclude = ('deleted_at',)
role = EnumField(Role,... | {
"content_hash": "ff9aa9245f306c51a305f3d337cb073e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 27,
"alnum_prop": 0.6837606837606838,
"repo_name": "josuemontano/api-starter",
"id": "f95163cc9b7fa6a26ecc83eb6b4d053a101ddc4f",
"size": "351",
"bi... |
from telemetry import benchmark
from measurements import blink_style
import page_sets
@benchmark.Disabled('reference', 'win8')
class BlinkStyleTop25(benchmark.Benchmark):
"""Measures performance of Blink's style engine (CSS Parsing, Style Recalc,
etc.) on the top 25 pages.
"""
test = blink_style.BlinkStyle
... | {
"content_hash": "60c438ea21a4fd5a3341fbd9a5df3aac",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 77,
"avg_line_length": 26.363636363636363,
"alnum_prop": 0.7413793103448276,
"repo_name": "PeterWangIntel/chromium-crosswalk",
"id": "c3f8fb2b3b8f8c8a64bda30906911f392620eeda... |
import sys
import socket
from kikutils import *
MY_SIGN = 'x'
THEIR_SIGN = 'o'
if __name__ == "__main__":
if len(sys.argv) != 3:
sys.stderr.write("usage: %s ip port\n" % (sys.argv[0], ))
exit(1)
try:
addr = sys.argv[1]
port = int(sys.argv[2])
assert port > 0
except:
sys.stderr.write("... | {
"content_hash": "a60e733d838788b5b426e5ae71bd1ec2",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 63,
"avg_line_length": 23.18811881188119,
"alnum_prop": 0.5452604611443211,
"repo_name": "damianrusinek/classes-pas",
"id": "71d4c5dc42b1ec0474ce2718d56cc406c9c74db1",
"si... |
import base64
import copy
import httplib
import Queue
import socket
import threading
import time
import eventlet
from oslo.config import cfg
from neutron.common import log as call_log
from neutron import context
from neutron.db.loadbalancer import loadbalancer_db as lb_db
from neutron.extensions import loadbalancer
f... | {
"content_hash": "34fff366f63aeccc91e73a32ea23ac94",
"timestamp": "",
"source": "github",
"line_count": 838,
"max_line_length": 79,
"avg_line_length": 40.32338902147971,
"alnum_prop": 0.5127400787191856,
"repo_name": "zhhf/charging",
"id": "dae5d144548009df6a6bbdcf120ba617eec17388",
"size": "34482"... |
import getopt
import os
import os.path
import re
import socket
import subprocess
import sys
import threading
import time
import tokenize
import traceback
import types
import io
import linecache
from code import InteractiveInterpreter
from platform import python_version, system
try:
from tkinter import *
except Im... | {
"content_hash": "922301a748dcb03df3134a792e6d686f",
"timestamp": "",
"source": "github",
"line_count": 1608,
"max_line_length": 87,
"avg_line_length": 36.1884328358209,
"alnum_prop": 0.5713598322764689,
"repo_name": "tpsatish95/Python-Workshop",
"id": "e8890d1746e19f7c20fd37cd611190545c5428c1",
"s... |
from kippo_extra.utils import ExtendedHoneyPotCommand, ModifiedOptionParser, \
OptionParsingError, OptionParsingExit
commands = {}
class command_uname(ExtendedHoneyPotCommand):
def call(self):
""" Add uname command to identify server """
# Initialize options
parser = ModifiedOptionPa... | {
"content_hash": "0268cdb6823a6f68aeb120394fdd62cf",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 79,
"avg_line_length": 39.36363636363637,
"alnum_prop": 0.5653066461380549,
"repo_name": "basilfx/kippo-extra",
"id": "f6af69b7f60c977b80acde4e2c447d48fe5bdcb1",
"size": "3... |
import time
from cinderclient import exceptions as cinder_exceptions
from fabric import api as fabric_api
from keystoneclient import exceptions as ks_exceptions
from neutronclient.common import exceptions as neutron_exceptions
from novaclient import exceptions as nova_exceptions
from cloudferry_devlab.tests import ba... | {
"content_hash": "38dddbdbef091c591ccc8bde18ee0ac2",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 79,
"avg_line_length": 43.62198391420912,
"alnum_prop": 0.5496281728228136,
"repo_name": "SVilgelm/CloudFerry",
"id": "d94f6c403736866d19f2b66d4c36239e5a5889c1",
"size": "... |
from __future__ import unicode_literals
import datetime
import os
from decimal import Decimal
from unittest import skipUnless
import warnings
from django import forms
from django.core.exceptions import FieldError, NON_FIELD_ERRORS
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validato... | {
"content_hash": "d9e5d7715ed4d74b5849e499b38e061e",
"timestamp": "",
"source": "github",
"line_count": 2547,
"max_line_length": 219,
"avg_line_length": 41.7208480565371,
"alnum_prop": 0.6017334349679568,
"repo_name": "cntnboys/410Lab6",
"id": "a1871bf2bfb801604f52f5ac9f36989dc19382e2",
"size": "10... |
import json
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from nose.tools import eq_
from mkt.api.tests.test_oauth import RestOAuth
from mkt.constants.applications import DEVICE_GAIA, DEVICE_DESKTOP
from mkt.constants.r... | {
"content_hash": "c8a757d87deb19470978c1297e3aedaf",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 78,
"avg_line_length": 37.15204678362573,
"alnum_prop": 0.593263025342358,
"repo_name": "clouserw/zamboni",
"id": "03f8e3907cbaefc3c2fb93500c66ca8a6c4d4699",
"size": "6353... |
from gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class PixelExpectations(GpuTestExpectations):
def SetExpectations(self):
# Sample Usage:
# self.Fail('Pixel.Canvas2DRedBox',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
self... | {
"content_hash": "e6ec0dbfa5ed6c2b232697569fa23521",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 35.411764705882355,
"alnum_prop": 0.6843853820598007,
"repo_name": "Workday/OpenFrame",
"id": "0ce1f6d2a95af33d8ee75cc3c4b242880386a9da",
"size": "76... |
"""List health check types."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command()
@environment.pass_env
def cli(env):
"""List health check types."""
mgr = SoftLayer.LoadBalancerManager(env.... | {
"content_hash": "407a0e0f4e6f4598ee8c0f2a3e8dadca",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 55,
"avg_line_length": 23.23076923076923,
"alnum_prop": 0.6589403973509934,
"repo_name": "kyubifire/softlayer-python",
"id": "49a12a5cdb0775be5a92b259bdcd139a3300ef1c",
"si... |
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
from ... | {
"content_hash": "ceb11a3601b194a5ba63d52f779a7111",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 101,
"avg_line_length": 38.19847328244275,
"alnum_prop": 0.6392885691446842,
"repo_name": "SIDDHARTH-SRIVASTAVA/cookiecutter_demo",
"id": "5cf880aae983a5a628c0c91b526f2e4ab9... |
import itertools
import re
import StringIO
import def_format
def Attribute(name):
assert name in def_format.SUPPORTED_ATTRIBUTES
return name
class Operand(object):
__slots__ = [
'read_write_attr',
'arg_type',
'size',
'implicit',
'index']
read_write_attr_regex = r'[%s%s%s%s]?... | {
"content_hash": "a3b3a4cb77d2967b272e691737e4e46b",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 80,
"avg_line_length": 30.876838235294116,
"alnum_prop": 0.6470203012442698,
"repo_name": "nacl-webkit/native_client",
"id": "5b9b6d4cbb398b84314f81f5bfe5781e822b6379",
"s... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: ipmi_power
short_description: Power management for machine
... | {
"content_hash": "b14e2529483fc595246d95a9c160b53d",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 110,
"avg_line_length": 26.1875,
"alnum_prop": 0.6127684964200477,
"repo_name": "e-gob/plataforma-kioscos-autoatencion",
"id": "43510c5d643fef5150fde5ef44daeddd493a44a2",
... |
import struct
from avro.io import (
AvroTypeException,
BinaryDecoder,
BinaryEncoder,
DatumReader,
DatumWriter,
SchemaResolutionException,
Validate,
)
STRUCT_FLOAT = struct.Struct('>f') # big-endian float
STRUCT_DOUBLE = struct.Struct('>d') # big-endian double
STRUCT_INT = struct.Struct('... | {
"content_hash": "17c729f2467ea590c833500f2f0086e8",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 100,
"avg_line_length": 32.45161290322581,
"alnum_prop": 0.6002556092019312,
"repo_name": "lincoln-lil/flink",
"id": "db8a9da3e7bd801e0c8e34db7d255acf5bb27a37",
"size": "8... |
"""Functions copied from unreleased versions of numpy.
See the NumPy license in the licenses directory.
"""
import numpy as np
try:
from numpy import broadcast_to, stack, nanprod
except ImportError: # pragma: no cover
# these functions should arrive in numpy v1.10
def _maybe_view_as_subclass(original_ar... | {
"content_hash": "de242a3591f6c7c242ef832c386069d5",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 82,
"avg_line_length": 35.015810276679844,
"alnum_prop": 0.5577378936674569,
"repo_name": "drewokane/xray",
"id": "174683003925e9a05d134cb098a5e152eade4298",
"size": "8859... |
import logging
import requests
from bzt import TaurusNetworkError
from bzt.bza import BZAObject, User
from bzt.engine import ScenarioExecutor
from bzt.modules.aggregator import ConsolidatingAggregator
from bzt.modules.blazemeter import CloudProvisioning
from bzt.utils import to_json
from tests import BZTestCase
from ... | {
"content_hash": "7849cc9c0a2a6c4b44733fff3aed9d6b",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 111,
"avg_line_length": 37.861111111111114,
"alnum_prop": 0.5502567865003668,
"repo_name": "itaymendel/taurus",
"id": "d7c124e9728f2f1dea66f0ae0f7b793177792fbe",
"size": "... |
r"""Handles lattice geometries to find rotations and transformations
"""
import numpy as np
class Lattice(object):
u"""Class to describe a generic lattice system defined by lattice six
parameters, (three constants and three angles).
Parameters
----------
a : float
Lattice constant *a* in... | {
"content_hash": "aa63eeadb7ab2ef8ac0909f6dcf581fe",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 137,
"avg_line_length": 26.92,
"alnum_prop": 0.5426263001485884,
"repo_name": "pseudocubic/neutronpy",
"id": "998c9d9ae14e6ca52d920fde1892f72d4351dff4",
"size": "10792",
... |
from sqlalchemy import Column
from sqlalchemy.orm import relationship
from sqlalchemy.schema import ForeignKey
from sqlalchemy.schema import Table
from sqlalchemy.types import Integer
from sqlalchemy.types import Unicode
from sqlalchemy.types import UnicodeText
from sandglass.time.models import BaseModel
from sandglas... | {
"content_hash": "a32e7a436b7434fb05c23149242d1664",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 71,
"avg_line_length": 28.548387096774192,
"alnum_prop": 0.6949152542372882,
"repo_name": "sanglass/sandglass.time",
"id": "138a2c2cbef3b60eb0bc778433492ce3adada9a3",
"size... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zoning', '0002_auto_20200211_1011'),
]
operations = [
migrations.RunSQL('ALTER SEQUENCE f_b_zonage_id_seq RENAME TO restrictedareatype_id_seq;'),
migrations.RunSQL('ALTER SEQUENCE l_secteur... | {
"content_hash": "993d274bbd1c11082c1a82ed6d9571bb",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 107,
"avg_line_length": 33.714285714285715,
"alnum_prop": 0.690677966101695,
"repo_name": "makinacorpus/Geotrek",
"id": "c689a17e0a6f7d7d432a2d58886a4808ab82d008",
"size": ... |
from google.cloud import aiplatform_v1beta1
def sample_explain():
# Create a client
client = aiplatform_v1beta1.PredictionServiceClient()
# Initialize request argument(s)
instances = aiplatform_v1beta1.Value()
instances.null_value = "NULL_VALUE"
request = aiplatform_v1beta1.ExplainRequest(
... | {
"content_hash": "f00c0d4c41278280abf44ebdd2fd2411",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 78,
"avg_line_length": 25.52173913043478,
"alnum_prop": 0.7155025553662692,
"repo_name": "googleapis/python-aiplatform",
"id": "d0993cb1676175b8e5022892772b3394a06b3f7e",
"... |
"""
group sharee tests
"""
from twext.enterprise.jobqueue import JobItem
from twext.python.filepath import CachingFilePath as FilePath
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue, succeed
from twisted.trial import unittest
from twistedcaldav.config import co... | {
"content_hash": "3abcd236d872bf317b235486267c5ae4",
"timestamp": "",
"source": "github",
"line_count": 832,
"max_line_length": 97,
"avg_line_length": 43.93269230769231,
"alnum_prop": 0.6672685489166119,
"repo_name": "red-hood/calendarserver",
"id": "449b534f439d0ba33af3171a30a451b94a82def7",
"size... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20160630_0243'),
]
operations = [
migrations.CreateModel(
name='ProjectProperty',
... | {
"content_hash": "bc18adf8c9370e3f84c59aa3a486604d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 114,
"avg_line_length": 32.74074074074074,
"alnum_prop": 0.5882352941176471,
"repo_name": "pvital/patchew",
"id": "00e1d53fa39e19d33e6c088c764d6b69b2958571",
"size": "956",... |
"""
The Snippy GUI.
"""
from datetime import datetime
import tkinter as tk
from typing import Iterable
from tkinter import messagebox, ttk
from snippy.data.snippytypes import Snippet
from snippy.data.tabledefinitions import TABLE_STANDARD, TableDefinition
from snippy.logic.snippydb import SnippyDb
from snippy... | {
"content_hash": "45715e35a9b7cf37b8e9bf42a405df62",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 79,
"avg_line_length": 36.43089430894309,
"alnum_prop": 0.5850628579930075,
"repo_name": "pauljxtan/snippy",
"id": "fd93cc6cd599c4ea656346dfb827fbd7f56a784a",
"size": "134... |
from osgeo.gdal import deprecation_warn
deprecation_warn('ogr')
from osgeo.ogr import *
| {
"content_hash": "bceece61a61bfe5819f3d5415e1deb64",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 39,
"avg_line_length": 22.25,
"alnum_prop": 0.7865168539325843,
"repo_name": "TUW-GEO/OGRSpatialRef3D",
"id": "3c51e196a0f29c30f9c9844b2d0498518a2d527e",
"size": "125",
"b... |
"""
Config Module for KSP Add-on Version Checker.
"""
# Copyright 2014 Dimitri "Tyrope" Molenaars
# 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... | {
"content_hash": "6430088492539a79c770b3a9b8c9fef2",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 74,
"avg_line_length": 34.06172839506173,
"alnum_prop": 0.56759695541863,
"repo_name": "tyrope/KSP-addon-version-checker",
"id": "883cf80026a35969ad50c9e231d7abaa209ad2bf",
... |
import base64
import hexdump
import logging
from binascii import hexlify
from hashlib import md5
from kkmip import types, enums
from kkmip.error import KmipError
from paramiko.message import Message
from agentk.utils import bigint_to_bytes
from agentk.kkmip_payloads import *
logger = logging.getLogger(__name__)
cla... | {
"content_hash": "1ba5b846115c65ccfe444b468a64bf72",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 102,
"avg_line_length": 31.731884057971016,
"alnum_prop": 0.5919159625485271,
"repo_name": "bolaum/agentk",
"id": "b23061d8015282d037bc27c0a9787bf680a5ce33",
"size": "4379... |
class flightaware(object):
"""
Flightaware data scraper
"""
def __init__(self):
super(flightaware, self).__init__()
def get(self, flight):
return self.__load(flight)
def __load(self, flight):
import urllib2
url = 'http://uk.flightaware.com/live/flight/' + flight... | {
"content_hash": "221f0b51d654bf3e0669a5365b5ec448",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 84,
"avg_line_length": 44.236363636363635,
"alnum_prop": 0.5791204274558158,
"repo_name": "nim901/flightaware",
"id": "1eebe6109a032701ce01da768d3b65fb451bed09",
"size": "2... |
"""
Created on 2017-4-25
@author: cheng.li
"""
import datetime as dt
import numpy as np
import pandas as pd
from alphamind.data.winsorize import winsorize_normal
def benchmark_winsorize_normal(n_samples: int, n_features: int, n_loops: int) -> None:
print("-" * 60)
print("Starting winsorize... | {
"content_hash": "e58d14e96255caa9f91a3aa0fc89b9c1",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 101,
"avg_line_length": 33.97872340425532,
"alnum_prop": 0.5272385723231058,
"repo_name": "wegamekinglc/alpha-mind",
"id": "d5a4104962800246c7d852c401bb5d81c0c30259",
"size... |
'''For the original round of synthesis (draft 22) the
studies came from phylografter, but the info about
which ones should be included (ergo which were rooted correctly)
was stored in python scripts in gcmdr.
This script takes:
1. a path to gcmdr, and reads that list of study+tree IDs; and
It uses the phylesyste... | {
"content_hash": "755aa8f6784df4d2f47ed52f9e8a7852",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 103,
"avg_line_length": 35.576470588235296,
"alnum_prop": 0.6901455026455027,
"repo_name": "mtholder/peyotl",
"id": "e4b888deab6ea65639fdf22902f39c965cb39ab7",
"size": "304... |
import sys
is_python3 = sys.version_info.major == 3
if is_python3:
unicode = str
from mappyfile.tokens import COMPOSITE_NAMES, ATTRIBUTE_NAMES, SINGLETON_COMPOSITE_NAMES
ALL_KEYWORDS = COMPOSITE_NAMES.union(ATTRIBUTE_NAMES).union(SINGLETON_COMPOSITE_NAMES)
class PrettyPrinter(object):
def __init__(self,... | {
"content_hash": "2c71691ef22f75e3bef29964b9930bf9",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 121,
"avg_line_length": 32.3,
"alnum_prop": 0.5172413793103449,
"repo_name": "Jenselme/mappyfile",
"id": "b2ec8cb08002e3780c9f88ac088aea17f612e54b",
"size": "9367",
"bin... |
'''
Created on 2012-8-29
@author: shanfeng
'''
from utils.azdg import *
import json
import web
cookiekey = "user"
safekey = "todo"
expires = 604800 #one week
class Login:
'''
classdocs
'''
@staticmethod
def logout():
web.webapi.setcookie(cookiekey, "", -1,path="/")
@staticmethod
def decode_cookie(has... | {
"content_hash": "7fee9b0834143788d36305714a34a073",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 63,
"avg_line_length": 19.2,
"alnum_prop": 0.6597222222222222,
"repo_name": "waile23/todo",
"id": "eb8a9385b99e61d74795c7285e171345df56538d",
"size": "864",
"binary": fal... |
"""Detect modules in a network.
Citation: He Y, Wang J, Wang L, Chen ZJ, Yan C, et al. (2009) Uncovering
Intrinsic Modular Organization of Spontaneous Brain Activity in Humans. PLoS
ONE 4(4): e5226. doi:10.1371/journal.pone.0005226
Comparing community structure identification
J. Stat. Mech. (2005) P0900
Leon Danon1,2... | {
"content_hash": "5e58956539db90c8db9fd154886789e0",
"timestamp": "",
"source": "github",
"line_count": 1475,
"max_line_length": 372,
"avg_line_length": 35.63864406779661,
"alnum_prop": 0.5779100956874085,
"repo_name": "jrcohen02/brainx_archive2",
"id": "06fc43b6c39be205e8c761a526880b597a208877",
"... |
from qiniu import Auth
from qiniu import BucketManager
"""
获取空间绑定的加速域名
https://developer.qiniu.com/kodo/api/3949/get-the-bucket-space-domain
"""
# 七牛账号的 公钥和私钥
access_key = '<access_key>'
secret_key = '<secret_key>'
# 空间名
bucket_name = ''
q = Auth(access_key, secret_key)
bucket = BucketManager(q)
ret, info = bucke... | {
"content_hash": "3847f475b0d5c30a2b3a4a0f093977fb",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 69,
"avg_line_length": 17.19047619047619,
"alnum_prop": 0.7202216066481995,
"repo_name": "qiniu/python-sdk",
"id": "20600ccbd01f9cbf962ee56f18426651126ee890",
"size": "449"... |
from twilio.twiml.voice_response import Redirect, VoiceResponse
response = VoiceResponse()
response.redirect('http://pigeons.com/twiml.xml', method='POST')
print(response)
| {
"content_hash": "50cd74af6fa8fc962353f256a67438f9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 64,
"avg_line_length": 29,
"alnum_prop": 0.7873563218390804,
"repo_name": "TwilioDevEd/api-snippets",
"id": "16981a0268a631de83ceb68a8b56a59cf904afb2",
"size": "174",
"bin... |
import os
ref = "Space_group_ref.txt"
def get_symbol_list(crystal_system):
''' Get short names in one crystal system
argument:
crystal_system - str - name of crystal system
'''
import linecache
ind_list = []
ref_path = os.path.join(os.path.dirname(__file__), ref) # relative p... | {
"content_hash": "ba94e970aa9359b07b504a521f045faf",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 82,
"avg_line_length": 34.861111111111114,
"alnum_prop": 0.5322709163346614,
"repo_name": "chiahaoliu/pdf_lib",
"id": "2c01282843f481e225d5805b4a9eb2307df387d8",
"size": "1... |
from licenser import licenser
from tests import cwd
def test_get_defaults():
'''
reads defaults from a .licenser file
'''
x = licenser.get_defaults(cwd + '/assets/.licenser')
assert x.get('name') == 'n'
assert x.get('email') == 'e'
assert x.get('license') == 'unlicense'
def test_get_def... | {
"content_hash": "e18cbc23bfba516224e8e5a2a273af24",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 63,
"avg_line_length": 22.272727272727273,
"alnum_prop": 0.6163265306122448,
"repo_name": "tylucaskelley/licenser",
"id": "f5d3114eee4192bdc4f4beba6795d540a114c11c",
"size"... |
import unittest
import mock
from telemetry.core import platform
from telemetry import decorators
from telemetry.internal.browser import possible_browser
class FakeTest(object):
def SetEnabledStrings(self, enabled_strings):
# pylint: disable=attribute-defined-outside-init
self._enabled_strings = enabled_st... | {
"content_hash": "766fd5eea3b5e05506538ffcbdfb9d5a",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 80,
"avg_line_length": 36.286127167630056,
"alnum_prop": 0.6986061330147352,
"repo_name": "SummerLW/Perf-Insight-Report",
"id": "a65bfb84af51f8483655602321fc4f9ab6081b95",
... |
"""Support for Flux lights."""
import logging
import socket
import random
import voluptuous as vol
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PROTOCOL
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
ATTR_EFFECT,
ATTR_WHITE_VALUE,
EFFECT_COLORLOOP,
... | {
"content_hash": "491a85ab74faff5d9be5e0b77d778093",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 87,
"avg_line_length": 29.573407202216067,
"alnum_prop": 0.5993817909329336,
"repo_name": "fbradyirl/home-assistant",
"id": "23fdb38aa05f7b9564d09b5a9d044f0e702b9df4",
"si... |
def downcase_keys(dict_):
return {k.lower(): v for k, v in dict_.items()}
def assert_aws4auth_in_headers(headers):
lc_headers = downcase_keys(headers)
assert 'authorization' in lc_headers
assert 'x-amz-date' in lc_headers
assert 'x-amz-content-sha256' in lc_headers
auth_header = lc_headers.get... | {
"content_hash": "87689f03ea1dffd6e46a55cf9a544418",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 51,
"avg_line_length": 33.857142857142854,
"alnum_prop": 0.6877637130801688,
"repo_name": "nickrw/keyfree",
"id": "c73a3fe36451c175389a97e9e2f568edfef8ce89",
"size": "474",... |
import collections
from multiprocessing.pool import ThreadPool
import queue
import subprocess
import sys
import traceback
from argparse import ArgumentParser
_PROG_HELP = """
Diagnose the environment and print out helpful instructions to fix.
"""
Task = collections.namedtuple('Task',
['n... | {
"content_hash": "c912e7c56074f86ae0f89588beea3c86",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 122,
"avg_line_length": 30.743506493506494,
"alnum_prop": 0.6424120815292006,
"repo_name": "janetkuo/marketplace-k8s-app-tools",
"id": "a7bd9ccd5fee93fbe6231ca3f4e372e10d05a... |
from westpa.tools import WESTParallelTool, WESTDataReader, IterRangeSelection, ProgressIndicatorComponent
import numpy as np
from westpa.core import h5io
from westpa.core.data_manager import seg_id_dtype, n_iter_dtype, weight_dtype
from westpa.core.extloader import get_object
def _find_matching_segments(west_datafi... | {
"content_hash": "4618ef9bb198cfc2be11c4317a01ed23",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 140,
"avg_line_length": 42.99557522123894,
"alnum_prop": 0.5538746526705773,
"repo_name": "westpa/westpa",
"id": "83d2c78f73117f4010339ec51c2e978d028ca7fd",
"size": "9717"... |
import pytest
import sys
import numpy as np
from cloudvolume.chunks import encode, decode
from cloudvolume import chunks
def encode_decode(data, format, shape=(64,64,64), num_chan=1, level=None):
compression_params = { "level": level }
encoded = encode(data, format, compression_params)
result = decode(encoded... | {
"content_hash": "3d43d9d96e9f1ff2d4e416b2a74f3c0a",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 98,
"avg_line_length": 36.510791366906474,
"alnum_prop": 0.6599014778325123,
"repo_name": "seung-lab/cloud-volume",
"id": "cf85e399f00e9cc0f0fca3e4e6ad27216c89f1fd",
"size... |
from apps.common.mixins import MonitoringView
from apps.processing.ala.monitoring.checks import check_ala
class AlaMonitoringView(MonitoringView):
def perform_check(self, context):
error_dict = check_ala()
if error_dict:
return 503, error_dict
| {
"content_hash": "a28c6caa257952273cf88457a462c17e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 59,
"avg_line_length": 30.88888888888889,
"alnum_prop": 0.7158273381294964,
"repo_name": "gis4dis/poster",
"id": "27ccc387f99fc59403a0b04f765b7fbc2d3da2ca",
"size": "278",
... |
import math
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
startTime = datetime.now()
def pythag_pos_diff(objPosArray1,objPosArray2):
#calculates the pythagorian position difference between two n-dimensional position arrays
pythagSum=0
for l in range(len(objPosArray1)... | {
"content_hash": "f0e750953b7a0117159009d9afbfd826",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 132,
"avg_line_length": 34.99404761904762,
"alnum_prop": 0.665079095084198,
"repo_name": "KayaBaber/Computational-Physics",
"id": "f6ad1b65a894ada55929cfdfebd0368bb43c70cf",... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('mail', '0004_automaticemail'),
... | {
"content_hash": "86df844b06e5dc691589f60d2a51f817",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 126,
"avg_line_length": 37.53333333333333,
"alnum_prop": 0.6252220248667851,
"repo_name": "mitodl/micromasters",
"id": "23cc2119fcef4d6741afb011668e7af9ae137ed3",
"size": "... |
g_program_name = __file__.split('/')[-1]
g_version_str = '0.1.1'
g_date_str = '2020-4-15'
g_usage_msg = """
Modify a polymer in specific locations specified by the user.
Atom types can be modified, bonded interactions can be added or modified,
and additional restraint fixes (eg. "fix restrain", "fix twi... | {
"content_hash": "f2bc2dc6eb5cb0f975dab13f1ffbaefb",
"timestamp": "",
"source": "github",
"line_count": 832,
"max_line_length": 122,
"avg_line_length": 46.13100961538461,
"alnum_prop": 0.45446965946692375,
"repo_name": "smsaladi/moltemplate",
"id": "45de647e51c0efa99c13a0bdfaf07bf025d14aad",
"size"... |
import ray
def force_spill_objects(object_refs):
"""Force spilling objects to external storage.
Args:
object_refs: Object refs of the objects to be
spilled.
"""
core_worker = ray.worker.global_worker.core_worker
# Make sure that the values are object refs.
for object_ref i... | {
"content_hash": "771d100b00d0d87f75ff31613c233cc7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 34.05555555555556,
"alnum_prop": 0.6411092985318108,
"repo_name": "richardliaw/ray",
"id": "def5d23535aef3cea3f6fc17c3b7917de0dcbf00",
"size": "613",... |
"""
Django settings for dj17_testproject project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... | {
"content_hash": "6ddce02a479edf14314fc930672d6a2e",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 71,
"avg_line_length": 24.301204819277107,
"alnum_prop": 0.7253346554288548,
"repo_name": "anentropic/kombu-django-json-serializer",
"id": "e1d7f5d15df9e95990aa1733476b10fed7... |
"""
Flask-ZODB
----------
.. image:: http://packages.python.org/Flask-ZODB/_static/flask-zodb.png
Transparent and scalable persistence of Python objects for Flask
applications. Use it as your database or as a complement to another
database - for example PostgreSQL where you need to perform rich queries
and ZODB wher... | {
"content_hash": "2f54657999847735afeccf6a22991d09",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 74,
"avg_line_length": 27.216216216216218,
"alnum_prop": 0.6077457795431976,
"repo_name": "Kyah/flask-zodb",
"id": "3f17c92c2f7aaa588e2c7afb2bc2fe5bea2156ea",
"size": "2014... |
from django_assets import Bundle
js = Bundle(
'js/etherpad.js'
)
css = Bundle(
'css/etherpad.css'
) | {
"content_hash": "b6873951d6f0777e999e23ae9feb5ea5",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 32,
"avg_line_length": 11,
"alnum_prop": 0.6454545454545455,
"repo_name": "spectralsun/etherkeeper",
"id": "187d1980d26d1faa05d0870cdd8d4150d9a6c3fa",
"size": "110",
"bin... |
import logging
import platform
import os
import subprocess
import traceback
from typing import Any, Dict, Optional
from django.conf import settings
from django.http import HttpRequest
from django.views.debug import get_exception_reporter_filter
from zerver.lib.logging_util import find_log_caller_module
from zerver.li... | {
"content_hash": "b51b2f86c991217bdd59682a60da5186",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 115,
"avg_line_length": 41.86538461538461,
"alnum_prop": 0.6169039963252182,
"repo_name": "rishig/zulip",
"id": "a2b8290c14487b7e3fe91d2115e188bf730cc903",
"size": "6618",... |
from __future__ import division, unicode_literals, print_function
import json
import glob
import itertools
import logging
import math
import os
import re
import warnings
import xml.etree.cElementTree as ET
from collections import defaultdict
from io import StringIO
import numpy as np
from monty.io import zopen, rever... | {
"content_hash": "5bb9061d6faa62fea690db6daebf1830",
"timestamp": "",
"source": "github",
"line_count": 4236,
"max_line_length": 143,
"avg_line_length": 41.432247403210575,
"alnum_prop": 0.5119226013777228,
"repo_name": "nisse3000/pymatgen",
"id": "4897742321431fbbdfcd8014c571ecc633795b07",
"size":... |
import pytest
from hailtop.hailctl.dataproc import cli
def test_submit(gcloud_run):
cli.main(["submit", "test-cluster", "a-script.py"])
gcloud_args = gcloud_run.call_args[0][0]
assert gcloud_args[:5] == ["dataproc", "jobs", "submit", "pyspark", "a-script.py"]
assert "--cluster=test-cluster" in gcloud... | {
"content_hash": "5e1fc51554d4e4f589e3df4a8c39a4cf",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 102,
"avg_line_length": 36.53846153846154,
"alnum_prop": 0.6552631578947369,
"repo_name": "danking/hail",
"id": "c62e9bc3c6f0886cb5ba14f1fbc08e8bc46e1b76",
"size": "1900",
... |
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 'Source.number'
db.delete_column('web_source', 'number')
# Adding field 'Source.name'
db.a... | {
"content_hash": "4f887b6b9d6f9feaeb92a454b93ab757",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 185,
"avg_line_length": 62.775757575757574,
"alnum_prop": 0.5473064298127052,
"repo_name": "jeremymason/Archivist",
"id": "2896d1c4480d2fd73fc1172fe69796daf05d0011",
"size... |
import mock
from heat.common import exception
from heat.common import service_utils
from heat.engine import stack_lock
from heat.objects import stack as stack_object
from heat.objects import stack_lock as stack_lock_object
from heat.tests import common
from heat.tests import utils
class StackLockTest(common.HeatTest... | {
"content_hash": "e06df22090e1b76e5a154562a98a79f5",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 79,
"avg_line_length": 46.346456692913385,
"alnum_prop": 0.5835032279986408,
"repo_name": "cwolferh/heat-scratch",
"id": "d5bd512da61f9b8bd1f336a2bdfffa649f9c61df",
"size"... |
from celery import task
@task(name='astral.settings')
def settings(holder):
return holder
@task(name='astral.mixes')
def mixes(holder):
return None | {
"content_hash": "3f2747b44879045d5250fb0e933f619f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 29,
"avg_line_length": 17.444444444444443,
"alnum_prop": 0.7261146496815286,
"repo_name": "acreations/rockit-server",
"id": "7df7037ac7b92f10a02c7818b5a6f2fd9cd10ea7",
"size... |
import inspect
import webob
from cinder.api.openstack import wsgi
from cinder import exception
from cinder import test
from cinder.tests.unit.api import fakes
class RequestTest(test.TestCase):
def test_content_type_missing(self):
request = wsgi.Request.blank('/tests/123', method='POST')
request.... | {
"content_hash": "0420bd6e56c03c8045de8ccc157423ed",
"timestamp": "",
"source": "github",
"line_count": 1068,
"max_line_length": 79,
"avg_line_length": 35.78651685393258,
"alnum_prop": 0.5700680272108843,
"repo_name": "scottdangelo/RemoveVolumeMangerLocks",
"id": "5d97befcad60981d0afde242fdd65c3d93f5... |
__author__ = 'Blake'
from basetypes import Asset, TextContentAsset
import article, page, image, script, style
all_content_types = {
'pages': page.Page,
'articles': article.Article,
'images': image.Image,
'scripts': script.Script,
'styles': style.Style
}
| {
"content_hash": "f2cbdc9009388df6eae664dd5ed0e620",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 45,
"avg_line_length": 21.307692307692307,
"alnum_prop": 0.6678700361010831,
"repo_name": "blakev/synpost",
"id": "e4bb4561cc70292893fe6edc789748f3084b39da",
"size": "277",... |
"""
Management class for host-related functions (start, reboot, etc).
"""
from oslo.utils import units
from nova.compute import arch
from nova.compute import hvtype
from nova.compute import vm_mode
from nova import exception
from nova import utils
from nova.virt.vmwareapi import ds_util
from nova.virt.vmwareapi impor... | {
"content_hash": "ccef7009dec8992ed27ede5b56ad5740",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 76,
"avg_line_length": 36.80821917808219,
"alnum_prop": 0.5846669147748418,
"repo_name": "maelnor/nova",
"id": "fb9803daf9c73d808563a4b02c24942fbd8ead73",
"size": "3359",
... |
try:
from nose.plugins.skip import SkipTest
import sys
if 'nosetest' in ''.join(sys.argv):
raise SkipTest()
except ImportError:
pass
import scriptine
from scriptine import path
from scriptine.shell import backtick_, sh
PACKAGE_NAME = 'MapProxy'
REMOTE_DOC_LOCATION = 'omniscale.de:domains/mappr... | {
"content_hash": "bc6bb5a53dc5e08cffdb4c089da17fe5",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 93,
"avg_line_length": 30.41322314049587,
"alnum_prop": 0.6035326086956522,
"repo_name": "procrastinatio/mapproxy",
"id": "ce9faeccff4d6ac402a13941381eb90996df2dc1",
"size... |
""" Unit tests for ``wheezy.templates.ext.determined``.
"""
import unittest
class DeterminedTestCase(unittest.TestCase):
""" Test the ``DeterminedExtension``.
"""
def setUp(self):
from wheezy.template.ext.determined import DeterminedExtension
self.preprocess = DeterminedExtension(
... | {
"content_hash": "252fe305971f973b7bb5b32de7cd9824",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 30.53846153846154,
"alnum_prop": 0.5289672544080605,
"repo_name": "ezotrank/wheezy.template",
"id": "6822f5651a10bb7f89c8a181b8098b33af39ac6f",
"size... |
from __future__ import print_function
import itertools
from collections import namedtuple
from textwrap import dedent
# https://xkcd.com/1319/
# https://xkcd.com/1205/
TestEnvBase = namedtuple('TestEnvBase', ['python_version', 'pytest_version',
'django_version', 'settings'])... | {
"content_hash": "e5fff60c2965ebcc3440c4dfdcffcb6a",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 115,
"avg_line_length": 32.37906137184115,
"alnum_prop": 0.5737540416991861,
"repo_name": "aptivate/pytest-django",
"id": "7795c691b2b960ebf566587dcb7a85f077a660b1",
"size... |
"""Fichier contenant le masque <date>"""
from primaires.interpreteur.masque.masque import Masque
from primaires.interpreteur.masque.fonctions import *
from primaires.interpreteur.masque.exceptions.erreur_validation \
import ErreurValidation
class Date(Masque):
"""Masque <date>"""
nom = "... | {
"content_hash": "f9698fd7c1f9ad590f9bd9b2f2b29b85",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 74,
"avg_line_length": 30.685185185185187,
"alnum_prop": 0.5691007845503923,
"repo_name": "stormi/tsunami",
"id": "f897b2e23cd5b324cb6e6f68a4dc3daa1feb3b9d",
"size": "3224"... |
import os
import os.path
import sys
import tarfile
from contextlib import closing
from functools import wraps
import docker
import docker.errors
from .error import ContainerNotFound, InvalidContainerSpec, ItemNotFound, \
UsageError
from .tarstream import TarStream
BUFFER_SIZE = tarfile.RECORDSIZE
def _checke... | {
"content_hash": "07eb45451622ac0bc1674f398e61e501",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 79,
"avg_line_length": 34.17977528089887,
"alnum_prop": 0.6296844181459567,
"repo_name": "vinzenz/docker-cp",
"id": "bd8e1a3194e635736367cc6284079f0384e91df4",
"size": "68... |
from __future__ import unicode_literals
from django.contrib import admin
from djangobmf.models import Configuration
from djangobmf.models import Document
from djangobmf.models import Report
from djangobmf.models import PDFRenderer
from djangobmf.forms import ReportCreateForm
from djangobmf.forms import ReportUpdateF... | {
"content_hash": "1e7d776b3fd02822b172a9aeab80ef06",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 84,
"avg_line_length": 29.457142857142856,
"alnum_prop": 0.7158098933074685,
"repo_name": "glomium/django-bmf",
"id": "c025d167f4206e3b8d21a277cda15c6375835596",
"size": "1... |
from behave import given, when, then
from testutils import upload_assets, upload_pullPath, delete
@given(u'some valid media file at {upload_method} {uri} of type {media_type}')
def given_upload_details(context, upload_method, uri, media_type):
if upload_method == "path":
context.upload_method = upload_as... | {
"content_hash": "1e43f32cfc3108109bbb635601e01017",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 82,
"avg_line_length": 33.3921568627451,
"alnum_prop": 0.6946564885496184,
"repo_name": "hashimmm/KTS",
"id": "da77da8fb15df83c6cb66086529ad0a4f984a4ce",
"size": "1703",
... |
from streamsx.topology.topology import *
import streamsx.topology.context
from streamsx.topology.schema import *
import sys
import pytest_funcs
def main():
tkdir = sys.argv[1]
topo = Topology("str_map_str")
ts = topo.subscribe("pytest/string/map", schema=CommonSchema.String)
ts = ts.map(pytest_funcs.string... | {
"content_hash": "0ea75e2076537dc021e72e12a373accf",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 22.28,
"alnum_prop": 0.7127468581687613,
"repo_name": "ibmkendrick/streamsx.topology",
"id": "3d9711b5d59d1fb25dc5cb614184a02aadbe00bf",
"size": "623... |
import sys
import logging
from peewee import PeeweeException
from taxadb.schema import db, DatabaseFactory
class TaxaDB(object):
"""Main TaxaDB package class
Parent class of the Taxadb application. Use this class to create inheriting
classes.
Args:
**kwargs: Arbitrary arguments. Supported... | {
"content_hash": "7cfac8e7a935ec65b1ffe1dc824a74b1",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 79,
"avg_line_length": 30.442748091603054,
"alnum_prop": 0.5754764292878636,
"repo_name": "HadrienG/taxadb",
"id": "4fe384761f28b50e9e2b495e80c229fc88aeb166",
"size": "398... |
import os
import unittest
from pymatgen.core.structure import Molecule
from pymatgen.analysis.graphs import MoleculeGraph
from pymatgen.analysis.local_env import OpenBabelNN
from pymatgen.util.testing import PymatgenTest
from pymatgen.analysis.fragmenter import Fragmenter
try:
import openbabel as ob
except Import... | {
"content_hash": "0e81e5cad28b4c7bf8dfb121f74a13f5",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 114,
"avg_line_length": 44.81666666666667,
"alnum_prop": 0.6362960208255857,
"repo_name": "montoyjh/pymatgen",
"id": "f03da6e87de0c8859cefb12d4ce2898aef6a01be",
"size": "5... |
import mock
from nova.console.rfb import auth
from nova.console.rfb import authnone
from nova.console.rfb import auths
from nova import exception
from nova import test
class RFBAuthSchemeListTestCase(test.NoDBTestCase):
def setUp(self):
super(RFBAuthSchemeListTestCase, self).setUp()
self.flags(... | {
"content_hash": "977c14718b8b483d9beb6813a849dfec",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 72,
"avg_line_length": 30.796610169491526,
"alnum_prop": 0.6422674738580078,
"repo_name": "klmitch/nova",
"id": "c4026b6637a5311e2c62d80425840d0f7749a879",
"size": "2399",
... |
from elasticsearch_dsl import ( # pylint: disable=unused-import
Document,
Keyword,
Text,
)
class Article(Document):
title = Text(analyzer="snowball", fields={"raw": Keyword()})
body = Text(analyzer="snowball")
class Index:
name = "test-index"
dsl_create_statement = {
"mappings"... | {
"content_hash": "dea61c6d5c86990b1cfeac42c1f2e483",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 65,
"avg_line_length": 24.90909090909091,
"alnum_prop": 0.49391727493917276,
"repo_name": "open-telemetry/opentelemetry-python-contrib",
"id": "b27d291ba3f5c889b90c1f3d1e67ed... |
"""
FC Drivers for ETERNUS DX arrays based on SMI-S.
"""
from oslo_concurrency import lockutils
import six
from cinder import context
from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume.drivers.fujitsu import eternus_dx_common
from cinder.zonemanager import utils as ... | {
"content_hash": "1b5b812514bd7f2c0bc10b98cdb6f4aa",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 79,
"avg_line_length": 34.26027397260274,
"alnum_prop": 0.5944288951086232,
"repo_name": "Akrog/cinder",
"id": "695538a0a8681ad702001c8965d509f19e4e3f5c",
"size": "8175",
... |
import argparse
import sys
import os
# Make utilities folder available
sys.path.append(os.path.abspath("../"))
from utilities.io import list_files
from utilities.runner import multiprocess
from fnmatch import fnmatch
#==============================================================================
#Command line options==... | {
"content_hash": "8071bb134c02d9859f29bec0065d35bc",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 84,
"avg_line_length": 32.927536231884055,
"alnum_prop": 0.5400528169014085,
"repo_name": "qfma/ohnolog-dc",
"id": "7beb45ec535fb98d6d44fa8f6babeeea5a13e94b",
"size": "2441... |
""" Outputs to the user.
Printing with intends or plain, mostly a compensation for the print strangeness.
We want to avoid "from __future__ import print_function" in every file out
there, which makes adding another debug print rather tedious. This should
cover all calls/uses of "print" we have to do, and the make it ... | {
"content_hash": "d756a9557fb6f6b5d9fc15f259bb96cf",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 86,
"avg_line_length": 27.422053231939163,
"alnum_prop": 0.6166112035496395,
"repo_name": "kayhayen/Nuitka",
"id": "de0d188fd2032bd51cb607794a10de63a394e7ee",
"size": "799... |
"""
Views for the Projects App
"""
import datetime
from copy import deepcopy
from channels import Channel
from django.http import HttpResponseRedirect
from django.db.models.aggregates import Count
from django.contrib import messages
from django.views.generic import CreateView, UpdateView, DetailView, DeleteView, Redi... | {
"content_hash": "f35cfcc144571398e51d362f08a67526",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 151,
"avg_line_length": 33.76772247360483,
"alnum_prop": 0.6497677327139539,
"repo_name": "worthwhile/fabric-bolt",
"id": "9b401c63f70c9551463b606de3c5350dc8aabe27",
"size... |
from django.contrib.auth import get_user_model
from django.db.models import Sum
from .models import Apartment, Comment, Vote
from rest_framework import serializers
User = get_user_model()
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username',)
... | {
"content_hash": "5f5109d9ace5166e5c7f212e36575054",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 87,
"avg_line_length": 31.08,
"alnum_prop": 0.6332046332046332,
"repo_name": "vero4karu/portafolio",
"id": "84dab57f37fab7a93310bb275ee1704cf9531645",
"size": "2331",
"bi... |
"""Parse configuration and start lightningserver.
When run with -daemon, daemonize the process first.
Usage:
-daemon: daemonize (Default False)
-debug: use the debug server (Currently conflicts with daemon)
-datadir=<path>: specify the directory to run in
-conf=<file>: specify the configuration file (default lightnin... | {
"content_hash": "c9b8e2169878c20908910427808751a4",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 34.75,
"alnum_prop": 0.6685508735868448,
"repo_name": "martindale/lightning-python",
"id": "e3773ec2abf3130c67bbef4a4d9847a89b9aefce",
"size": "1971"... |
from collections import defaultdict
class Node(object):
def __init__(self):
self.children = defaultdict(Node)
self.end = False
class Solution(object):
def replaceWords(self, dict, sentence):
"""
:type dict: List[str]
:type sentence: str
:rtype: str
"""
... | {
"content_hash": "fde271dc62bfa7e8b2975baac30b07c6",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 50,
"avg_line_length": 26.64864864864865,
"alnum_prop": 0.40872210953346855,
"repo_name": "ckclark/leetcode",
"id": "e501d63368721ee6180d6a1398e4a28cbdfb6540",
"size": "986... |
from __future__ import annotations
import subprocess
import sys
script = """
import threading
import traceback
import_succeeded = False
def import_dask_distributed():
try:
import dask.distributed # noqa
except Exception:
# Print the exception for debugging
traceback.print_exc()
... | {
"content_hash": "e9fa3cc2ce52489652ed368b3ee63797",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 74,
"avg_line_length": 24.289473684210527,
"alnum_prop": 0.7074756229685807,
"repo_name": "dask/distributed",
"id": "35b1fb76e63343739a9797053a634dc7bf6fe1d7",
"size": "923... |
import logging
# Our imports
from emission.core.get_database import get_uuid_db
import emission.analysis.result.userclient as userclient
class PrecomputeResults:
def __init__(self):
pass
def precomputeResults(self):
for user_uuid_dict in get_uuid_db().find({}, {'uuid': 1, '_id': 0}):
... | {
"content_hash": "01f80644f491cf1556365493b83be429",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 97,
"avg_line_length": 33.07692307692308,
"alnum_prop": 0.6523255813953488,
"repo_name": "yw374cornell/e-mission-server",
"id": "4077aa5fef77f2ba4585ae7995b933645e32cce7",
... |
import xmlrpclib
@auth.requires_login()
def index():
""" Whitelist the remote that clicks the button. """
response.title = 'Whitelist'
form = FORM.confirm('Add exception')
if form.accepted:
from firewall import Whitelist
whitelist = Whitelist()
whitelist.add(request.env.remote... | {
"content_hash": "1219c706f5655b2cfcfdac51151680f9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 56,
"avg_line_length": 25.214285714285715,
"alnum_prop": 0.6543909348441926,
"repo_name": "tessercat/ddj",
"id": "adc9f7dd6b26efcd54d02be74d00f420b95630f5",
"size": "353",
... |
from web.helpers.http import HttpResponseNotAllowed
import pymssql
import pymysql
import sqlite3
from web.helpers.json import json_response, json_request
from core.parameters_manager import KnownParameters
@json_response
def check(request):
"""
Проверяет коннект к базы данных,
используется на мастере уст... | {
"content_hash": "e9dcb2bcfc3c7acd043b190dd83b0eda",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 117,
"avg_line_length": 33.01904761904762,
"alnum_prop": 0.6308047303143929,
"repo_name": "helicontech/zoo",
"id": "162a1fa29f5a2b85e30ae5c69c961b77fb2c0f91",
"size": "377... |
from intmaniac.output.base import GenericOutput
class TeamcityOutput(GenericOutput):
str_message = "##teamcity[message text='{message}'{status}{details}]"
str_message_details = " errorDetails='{details}'"
str_message_status = " status='{status}'"
str_test_suite_open = "##teamcity[testSuiteStarted na... | {
"content_hash": "30132eb98cffd0ed10849492eccf1c9f",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 73,
"avg_line_length": 34.46296296296296,
"alnum_prop": 0.5583019881783987,
"repo_name": "flypenguin/python-intmaniac",
"id": "3adc66b425094e4d9471e736a20d588d85788db6",
"s... |
from setuptools import setup
import re
import sys
verstr = "unknown"
try:
verstrline = open('klout/_version.py', "rt").read()
except EnvironmentError:
pass # Okay, there is no version file.
else:
VSRE = r"^__release__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
vers... | {
"content_hash": "72803048c7ba88097b720acd37b65b9e",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 29.54,
"alnum_prop": 0.6113744075829384,
"repo_name": "ibmjstart/bluemix-python-sample-twitter-influence-app",
"id": "fa23f02c28092fd2f923b1972c93d176c... |
"""
Plotting tools for the pygaia package.
To use these tools matplotlib and cartopy are required.
"""
from . import sky
| {
"content_hash": "1e11515096402e16f0073476e7c93822",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 55,
"avg_line_length": 17.571428571428573,
"alnum_prop": 0.7398373983739838,
"repo_name": "agabrown/PyGaia",
"id": "40092f4d7c4803218c77317ea414dcb2b8520255",
"size": "123",... |
"""
BRD NNLS
========
for 1D BRD, adapted mainly from Venkataramanan 2002 but checked against BRD
1981
"""
from pylab import *
from pyspecdata import *
from scipy.optimize import nnls
init_logging('debug')
vd_list = nddata(linspace(5e-4,10,25),'vd')
t1_name = r'$\log(T_1)$'
logT1 = nddata(r_[-4:2:100j],t1_name)
def Ga... | {
"content_hash": "ad9e0653c619bf922d79faf87b81b325",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 112,
"avg_line_length": 30.38235294117647,
"alnum_prop": 0.6305259761213294,
"repo_name": "jmfranck/pyspecdata",
"id": "75b15a46e53fb74faf8c86a5e2a2af6f4e8f73ac",
"size": ... |
import os
import sys
import traceback
import cv2
from sklearn.externals import joblib
from common.config import get_config
from common.image_transformation import apply_image_transformation
from common.image_transformation import resize_image
def get_image_from_label(label):
testing_images_dir_path = get_config... | {
"content_hash": "d85bbb2583b6394b103e08534c6d674b",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 109,
"avg_line_length": 34,
"alnum_prop": 0.6409897292250234,
"repo_name": "SIgnlngX/sign-language-interpreter",
"id": "f01d9869394858145c6970734285ec8e166a4995",
"size": "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.