text stringlengths 4 1.02M | meta dict |
|---|---|
import curio
from ... import gvars
from ...utils import pack_addr, unpack_addr
from ..base.udpclient import UDPClient
class SSUDPClient(UDPClient):
proto = "SS(UDP)"
async def sendto(self, data, addr):
self.target_addr = addr
iv, encrypt = self.ns.cipher.make_encrypter()
payload = iv... | {
"content_hash": "82a79d1e6f7a70baed27ece2505f14b3",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 31.516129032258064,
"alnum_prop": 0.6059365404298874,
"repo_name": "guyingbo/shadowproxy",
"id": "507e0946d7f5bc4edcc137902d600a0012720dd1",
"size": ... |
"""Constants used by Advantage Air integration."""
DOMAIN = "advantage_air"
ADVANTAGE_AIR_RETRY = 5
ADVANTAGE_AIR_STATE_OPEN = "open"
ADVANTAGE_AIR_STATE_CLOSE = "close"
ADVANTAGE_AIR_STATE_ON = "on"
ADVANTAGE_AIR_STATE_OFF = "off"
| {
"content_hash": "6678a8fae364878b80cfdab5b86ec0eb",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 50,
"avg_line_length": 33.142857142857146,
"alnum_prop": 0.7327586206896551,
"repo_name": "sdague/home-assistant",
"id": "078c266bfb0d03456b4eacc54cbb665b4eebd7ca",
"size": ... |
from msrest.serialization import Model
class SoaRecord(Model):
"""An SOA record.
:param host: The domain name of the authoritative name server for this SOA
record.
:type host: str
:param email: The email contact for this SOA record.
:type email: str
:param serial_number: The serial numbe... | {
"content_hash": "404f7aa65a9f68486b665bfebf7719cb",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 138,
"avg_line_length": 39.26190476190476,
"alnum_prop": 0.6252274105518496,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "fec121ed625d1e5fb016984c5ee69ab95ea5ca30",
"s... |
from oslo_log import log as logging
from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib import decorators
from tempest.scenario import manager
CONF = config.CONF
LOG = logging.getLogger(__name__)
class TestVolumeMigrateRetypeAttached(manager.ScenarioTest):... | {
"content_hash": "a62e85bfdfd6d7b2b9ee433b54668cc8",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 79,
"avg_line_length": 46.166666666666664,
"alnum_prop": 0.6036313442344446,
"repo_name": "cisco-openstack/tempest",
"id": "106500e5ad0520f1b0f26ba68601dfdaa5080bf4",
"siz... |
from __future__ import absolute_import # for logging import below
import datetime
import logging
from django.conf import settings
from django.shortcuts import redirect, resolve_url
from django.template.defaultfilters import date as date_filter
from django.utils import six
from django.utils.http import is_safe_url
fr... | {
"content_hash": "2b33fcd538d917be14140b7158434a72",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 77,
"avg_line_length": 35.55,
"alnum_prop": 0.6997187060478199,
"repo_name": "sonofatailor/django-oscar",
"id": "27c44354e0e11ab31fe58ab5ebb57bafaa81b1ed",
"size": "4266",... |
"""
SmallNet.py is a class that provides a network for Person localization
Created 6/13/17.
"""
__author__ = "Alexander Ponamarev"
__email__ = "alex.ponamaryov@gmail.com"
import tensorflow as tf
from collections import namedtuple
from tensorflow import name_scope, variable_scope, stop_gradient
from .ObjectDetection... | {
"content_hash": "fd993c576ff2beb9a00c319ea9b465bc",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 111,
"avg_line_length": 38.65384615384615,
"alnum_prop": 0.591044776119403,
"repo_name": "aponamarev/FootBallTracking",
"id": "4649e8453e27e2f18f8221c72a6975baf3bf8e46",
"... |
class Solution:
def __init__(self):
self.stack = []
def push(self, node):
self.stack.append(node)
# write code here
def pop(self):
return self.stack.pop()
# write code here
def top(self):
if len(stack) == 0: return None
return self.stack[-... | {
"content_hash": "0c6de2a249f86d715428b784e48005cf",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 39,
"avg_line_length": 24.941176470588236,
"alnum_prop": 0.5235849056603774,
"repo_name": "linjinjin123/leetcode",
"id": "7878e61f2829194437c050e2f41dcac4a968e1a5",
"size":... |
from pandajedi.jedicore.JediTaskBufferInterface import JediTaskBufferInterface
tbIF = JediTaskBufferInterface()
tbIF.setupInterface()
from pandajedi.jediddm.DDMInterface import DDMInterface
ddmIF = DDMInterface()
ddmIF.setupInterface()
import multiprocessing
from pandajedi.jediorder import TaskCommando
parent_con... | {
"content_hash": "f0717bcd31e6a7859ef60a5299e869af",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 23.766666666666666,
"alnum_prop": 0.6956521739130435,
"repo_name": "RRCKI/panda-jedi",
"id": "f434390a9203e47b37a7cf2424ada68ab4f927df",
"size": "713... |
"Tests for the `btclib.tx_in` module."
import json
from os import path
import pytest
from btclib.exceptions import BTClibValueError
from btclib.tx.out_point import OutPoint
from btclib.tx.tx import Tx
def test_out_point() -> None:
out_point = OutPoint()
assert out_point.tx_id == b"\x00" * 32
assert out... | {
"content_hash": "6f4c5495cfd5c0e8af73977836aa60eb",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 82,
"avg_line_length": 36.903614457831324,
"alnum_prop": 0.6793992817499184,
"repo_name": "fametrano/BitcoinBlockchainTechnology",
"id": "c0ee2c1236e11ae1ab87bdf5507bb8c8c22e... |
"""Noop tool that defines builder functions for non-default platforms to
avoid errors when scanning sconsscripts."""
import SCons.Builder
def generate(env):
"""SCons method."""
if not env.Bit('windows'):
builder = SCons.Builder.Builder(
action=''
)
env.Append(BUILDERS={'RES': builder, 'Grit'... | {
"content_hash": "26bc86cb833e1d5589555f17dc44fada",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 72,
"avg_line_length": 22.6875,
"alnum_prop": 0.6776859504132231,
"repo_name": "snak3ater/android_external_chromium_org_third_party_libjingle_source_talk",
"id": "b184ddc542d... |
from ivreg.models import Voter
def test_index(app):
app.get('/')
def test_registration(app):
resp = app.get('/registration/')
resp.form['voter_id'] = '123'
resp = resp.form.submit()
resp = resp.follow()
assert resp.request.path.startswith('/ballot/')
def test_registration_callback(mocker, ... | {
"content_hash": "a921c8ccc0e8ca6786c53dc02df31459",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 97,
"avg_line_length": 34.8780487804878,
"alnum_prop": 0.6727272727272727,
"repo_name": "00riddle00/internet-voting-authorization",
"id": "0d31a8df2ac349128dfd3bdc11643273aff... |
"""For all the benchmarks that set options, test that the options are valid."""
from collections import defaultdict
import os
import unittest
from telemetry import benchmark as benchmark_module
from telemetry.core import browser_options
from telemetry.core import discover
from telemetry.unittest_util import progress_... | {
"content_hash": "f1582cba81381bea16bf9abb2d021cb9",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 35.87692307692308,
"alnum_prop": 0.7388507718696398,
"repo_name": "Fireblend/chromium-crosswalk",
"id": "571585e7412c98d07af6ab745b00c0c155bf6df3",
"... |
"""Build vocab and cache it so we don't have to keep running."""
import collections
from absl import app
from absl import flags
from absl import logging
import tensorflow.compat.v1 as tf
import tensorflow_datasets as tfds
flags.DEFINE_string('vocab_file_path', '/tmp/lra_data/aan',
'Path for vocab... | {
"content_hash": "e6c21101cc3c0b1e8048be7af50528fc",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 74,
"avg_line_length": 31.486238532110093,
"alnum_prop": 0.592948717948718,
"repo_name": "google-research/long-range-arena",
"id": "38bc47caf2acda48d7a3fdd996ba73cfc1febebf"... |
"""Utility class for producing a scansion pattern for a Latin hendecasyllables.
Given a line of hendecasyllables, the scan method performs a series of transformation and checks
are performed and for each one performed successfully, a note is added to the scansion_notes
list so that end users may view the provenance of... | {
"content_hash": "8afde8f14f35b819fc98067352b05943",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 331,
"avg_line_length": 43.24311926605505,
"alnum_prop": 0.6169513100668294,
"repo_name": "cltk/cltk",
"id": "9f503b4fb37a88276abf3990641b8ce16afe7643",
"size": "9435",
... |
"""Unit tests for test_env.py functionality.
Each unit test is launches python process that uses test_env.py
to launch another python process. Then signal handling and
propagation is tested. This similates how Swarming uses test_env.py.
"""
import os
import signal
import subprocess
import sys
import time
import unitt... | {
"content_hash": "0eb83ac539018002d053e4e81044b2a4",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 68,
"avg_line_length": 28.775,
"alnum_prop": 0.7089487402258905,
"repo_name": "endlessm/chromium-browser",
"id": "76d5766debce418275e64db818c3c968fd5d7d91",
"size": "2491",... |
__author__ = 'lorenzo'
from config.config import _REST_SERVICE, _SERVICE
def format_message(exception, root=_REST_SERVICE):
if root == 'hydra':
root = _SERVICE + '/hydra/'
return str({"error": 1, "exception": exception, "back": root})
| {
"content_hash": "ec84683e152bd50a68055d4ec590c7e7",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 66,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.6338582677165354,
"repo_name": "pincopallino93/rdfendpoints",
"id": "a640687ff46e9db6bc42fba5ec40023148de4d86",
"si... |
"""Ptransform overrides for DataflowRunner."""
from apache_beam.coders import typecoders
from apache_beam.pipeline import PTransformOverride
class CreatePTransformOverride(PTransformOverride):
"""A ``PTransformOverride`` for ``Create`` in streaming mode."""
def matches(self, applied_ptransform):
# Imported ... | {
"content_hash": "36d2386548edc727a39487fa46f0d996",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 39.483870967741936,
"alnum_prop": 0.7124183006535948,
"repo_name": "tgroh/incubator-beam",
"id": "0ce212fa31bdd79d1a285448d64444cb1d6075bc",
"size": ... |
"""AMPAL objects that represent ligands."""
from ampal.base_ampal import Polymer, Monomer
class LigandGroup(Polymer):
"""A container for `Ligand` `Monomers`.
Parameters
----------
monomers : Monomer or [Monomer], optional
Monomer or list containing Monomer objects to form the Polymer().
... | {
"content_hash": "ca517c64f6384ffaac06c7762217d41e",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 80,
"avg_line_length": 35.78448275862069,
"alnum_prop": 0.6270778125752831,
"repo_name": "woolfson-group/isambard",
"id": "ee254dc22603cca8327fe9173c5de25880cc1911",
"size... |
from django.db import models
from django.utils import timezone
# Category
class Category(models.Model):
name = models.TextField()
name_search = models.CharField(max_length=512)
alias = models.CharField(max_length=100)
description = models.TextField()
parent = models.ForeignKey('s... | {
"content_hash": "c9dab47eeff74090b4cc3b7da99c5c12",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 116,
"avg_line_length": 39.77570093457944,
"alnum_prop": 0.6018562030075187,
"repo_name": "abezpalov/anodos",
"id": "0b838cd8bd022a8d7cd5c56a1679f6330dfc928d",
"size": "88... |
import __future__
import os
import unittest
import distutils.dir_util
import tempfile
from test import test_support
try: set
except NameError: from sets import Set as set
import modulefinder
# Note: To test modulefinder with Python 2.2, sets.py and
# modulefinder.py must be available - they are not in the standard
... | {
"content_hash": "c6cd4fc47e51483d529c665b9945a99c",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 83,
"avg_line_length": 27.99665551839465,
"alnum_prop": 0.47186716043483456,
"repo_name": "IronLanguages/ironpython2",
"id": "497ee5c68ce8f2f65cf882273c7db8b8afb34cc2",
"s... |
import os
from flask import Flask, render_template, send_file, request, after_this_request, redirect, url_for, safe_join
import re
from config import MAX_FOLDER_DL_SIZE_BYTES, IGNORE_FILES, ROOT_PATHS
app = Flask(__name__)
def get_size(start_path):
total_size = 0
for dirpath, dirnames, filenames in os.walk(s... | {
"content_hash": "a6cf66712710e8368ac5d3926aa5f9bd",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 110,
"avg_line_length": 31.231578947368423,
"alnum_prop": 0.5244354566902595,
"repo_name": "nickw444/MediaBrowser",
"id": "9e5c2511a9b537220149fabc7105e5dd16ee77c5",
"size"... |
import pykube
import logging
from invoke import task
import requests
from prettytable import PrettyTable
KUBE_CONFIG_PATH="~/.kube/config"
kapi = pykube.HTTPClient(pykube.KubeConfig.from_file(KUBE_CONFIG_PATH))
log = logging.getLogger(__name__)
# log.setLevel(logging.DEBUG)
log.setLevel(logging.INFO)
console = logging... | {
"content_hash": "598b622f49e36e9c816f33f04183bc4f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 102,
"avg_line_length": 35.22222222222222,
"alnum_prop": 0.692429022082019,
"repo_name": "cackharot/kubo",
"id": "ade6069c4a37f5beb6227e0d7c6b8fca791fe63d",
"size": "1268",... |
from docutils.statemachine import StringList
def get_rst_class_elements(
environment, module_name, module_path_name, whitelist_names=None,
undocumented_members=False, private_members=False,
force_partial_import=False, skip_attribute_value=False, rst_elements=None
):
"""Return :term:`reStructuredText` ... | {
"content_hash": "1c40cc312e5560fbe24e83f082dc9a2d",
"timestamp": "",
"source": "github",
"line_count": 618,
"max_line_length": 77,
"avg_line_length": 32.85113268608414,
"alnum_prop": 0.6214166092010639,
"repo_name": "buddly27/champollion",
"id": "bf521c5d474c8ed16a2729b9b2d8f2ee9d021be5",
"size": ... |
from google.cloud import iam_v2beta
async def sample_get_policy():
# Create a client
client = iam_v2beta.PoliciesAsyncClient()
# Initialize request argument(s)
request = iam_v2beta.GetPolicyRequest(
name="name_value",
)
# Make the request
response = await client.get_policy(reques... | {
"content_hash": "428248a12b470452bb05a06f3e7d384b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 55,
"avg_line_length": 22.789473684210527,
"alnum_prop": 0.6928406466512702,
"repo_name": "googleapis/python-iam",
"id": "08bf54bc7d0715bdc90f45790cab533e5654ea85",
"size":... |
"""
The Tornado Framework
By Ali Pesaranghader
University of Ottawa, Ontario, Canada
E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com
"""
import random
from math import *
from streams.generators.tools.transition_functions import Transition
class MIXED:
def __init__(self, concept_length=200... | {
"content_hash": "f6c199f23598a01ed3c67b112fb9e716",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 118,
"avg_line_length": 38.282442748091604,
"alnum_prop": 0.5042871385842472,
"repo_name": "alipsgh/tornado",
"id": "2fa79e400e0b593944ba287610908f3bebfbe730",
"size": "50... |
"""
docstring needed
:copyright: Copyright 2010-2017 by the NineML Python team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from ...base import Parameter
from nineml.abstraction.expressions import Alias, Constant
from nineml.visitors import BaseVisitor
from nineml.units import Dimension, Unit
class T... | {
"content_hash": "b70625c21be920588630370484337296",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 71,
"avg_line_length": 31.783783783783782,
"alnum_prop": 0.6794217687074829,
"repo_name": "INCF/lib9ML",
"id": "130a78c99bc8c8ebaf43470aacd6d850e0d263f8",
"size": "1176",
... |
from __future__ import unicode_literals
import base64
import struct
import zlib
from Crypto.Cipher import ARC4
from Crypto.Hash import MD5
class BaseStantinkoDecryptor(object):
def __init__(self):
self.time = None
self.name = None
self.payload = None
self.errors = []
def _de... | {
"content_hash": "0fb49918528009001b6601514668e7d5",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 88,
"avg_line_length": 27.747863247863247,
"alnum_prop": 0.5338056368396735,
"repo_name": "eset/malware-research",
"id": "1ed84b950245553723ebbad47e61d4641a12eb3b",
"size"... |
"""
ggame package defines names that may be imported directly from ggame (legacy)
"""
from .__version__ import VERSION
from .asset import ImageAsset, TextAsset, CircleAsset, RectangleAsset
from .asset import PolygonAsset, LineAsset, EllipseAsset
from .asset import Frame, Color, LineStyle, BLACK, WHITE, BLACKLINE, WHITE... | {
"content_hash": "bddcb9ba0ae6c604741a913ceb5adad4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 78,
"avg_line_length": 40.90909090909091,
"alnum_prop": 0.7955555555555556,
"repo_name": "BrythonServer/ggame",
"id": "b470076c7ebfd2caf6e11ed6f1009d5608a6244b",
"size": "4... |
import datetime
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from intranet3.utils.views import BaseView, MonthMixin
from intranet3.utils import excuses
from intranet3.helpers import next_month, previous_month
from intranet3.models import ApplicationConfig, User, Holiday
from intra... | {
"content_hash": "67fafb01fab6ca8a377ec8273c05784d",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 102,
"avg_line_length": 34.82113821138211,
"alnum_prop": 0.5937427037123512,
"repo_name": "pytlakp/intranetref",
"id": "434bc4114d9ca8da916f257b47dc72fc596ec0c6",
"size": ... |
"""
基于python 自身 Queue
"""
from scrapy.downloadermiddlewares.retry import RetryMiddleware
import logging
from scrapy.exceptions import NotConfigured
from scrapy.utils.response import response_status_message
import base64
try:
from Queue import Queue,Empty,Full
except ImportError:
# py3
from queue import Queu... | {
"content_hash": "129b4931cd091954b217eb1491cda138",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 118,
"avg_line_length": 38.08,
"alnum_prop": 0.6143457382953181,
"repo_name": "1398491991/scrapyProxyQueue",
"id": "55f67c1e097fa019148f86ab1c4f9d942488f992",
"size": "692... |
"""Support for Tellstick sensors."""
from collections import namedtuple
import logging
from tellcore import telldus
import tellcore.constants as tellcore_constants
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_ID,
CONF... | {
"content_hash": "43848a00a0297ca9eda2115ded4a80e3",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 88,
"avg_line_length": 33.27388535031847,
"alnum_prop": 0.5997320061255743,
"repo_name": "kennedyshead/home-assistant",
"id": "f58c5916bfb1cd2707d4ce6a510e3f4e96159fc6",
"... |
"""Support for HomeMatic covers."""
import logging
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
CoverEntity,
)
from .const import ATTR_DISCOVER_DEVICES
from .entity import HMDevice
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, d... | {
"content_hash": "b20813f15bdfc12dfeecc045b4d2ac67",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 72,
"avg_line_length": 30.130841121495326,
"alnum_prop": 0.5949131513647643,
"repo_name": "robbiet480/home-assistant",
"id": "a520c08e4789fa2f3dee6b59e16c37fc68fb2461",
"s... |
'''
test_dns_sprockets_impl - Tests DNSSprocketsImpl implementation class.
.. Copyright (c) 2015 Neustar, Inc. All rights reserved.
.. See COPYRIGHT.txt for full notice. See LICENSE.txt for terms and conditions.
'''
# pylint: skip-file
import dns_sprockets_lib.utils as utils
import dns_sprockets_lib.loaders as load... | {
"content_hash": "38171c07311bdafd55a3c89038c516cd",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 30.94871794871795,
"alnum_prop": 0.676056338028169,
"repo_name": "ultradns/dns_sprockets",
"id": "bcfc041160de5ccc65be3c77b91564b0cf0abe6e",
"size": ... |
from oslo_utils.fixture import uuidsentinel
from nova.compute import power_state
from nova.compute import vm_states
from nova import objects
TEST_FLAVOR = objects.flavor.Flavor(
memory_mb=2048,
swap=0,
vcpu_weight=None,
root_gb=10, id=2,
name=u'm1.small',
ephemeral_gb=0,
rxtx_factor=1.0,
... | {
"content_hash": "0eb636573b5b18f7b7318298ec1b9ba4",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 60,
"avg_line_length": 23.571428571428573,
"alnum_prop": 0.6676767676767676,
"repo_name": "klmitch/nova",
"id": "dedb6af7db1071c290947f461f364d0eb3c45634",
"size": "1599",
... |
import vtk.qt
try:
import PyQt4
vtk.qt.PyQtImpl = "PyQt4"
except ImportError:
try:
import PySide
vtk.qt.PyQtImpl = "PySide"
except ImportError:
raise ImportError("Cannot load either PyQt or PySide")
from vtk.qt.QVTKRenderWindowInteractor import *
if __name__ == "__main__":
... | {
"content_hash": "6655dd6b2c94bc6891bb1a910b1febba",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 62,
"avg_line_length": 21.823529411764707,
"alnum_prop": 0.6630727762803235,
"repo_name": "sumedhasingla/VTK",
"id": "dd5d1def585549ff85516cff003c1d100db7217d",
"size": "37... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, PageChooserPanel
from urlparse import urlparse
class Redirect(models.Model):
old_path = models.CharField(verbose_name=_("Redirect from"), max_length=25... | {
"content_hash": "663e81cb94cf2919275c0967cde70a93",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 227,
"avg_line_length": 33.04,
"alnum_prop": 0.6347861178369653,
"repo_name": "sahat/wagtail",
"id": "6440ad383ffb0ead2b65bb15839946251d9b0614",
"size": "2478",
"binary":... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('presentations', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='presentation',
name='author',
... | {
"content_hash": "38ac312dc995f1c9cdd20cd622395d64",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 64,
"avg_line_length": 24.88,
"alnum_prop": 0.5691318327974276,
"repo_name": "CIGIHub/django-presentations",
"id": "a36071f6232714f989dc57f54bb11c7e3edd9b0b",
"size": "646"... |
import re
from ztag.annotation import Annotation
from ztag.annotation import OperatingSystem
from ztag import protocols
import ztag.test
class FtpBulletproofFtpd(Annotation):
protocol = protocols.FTP
subprotocol = protocols.FTP.BANNER
port = None
impl_re = re.compile("^220[- ]BulletProof FTP Server r... | {
"content_hash": "073ce75808e495d746ba0819bc3e7d7b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 31.096153846153847,
"alnum_prop": 0.6147186147186147,
"repo_name": "zmap/ztag",
"id": "aa47c9d589038f81158f8a579afb1a969deb024c",
"size": "1617",
"... |
"""Support for SwitchBot curtains."""
from __future__ import annotations
import logging
from typing import Any
import switchbot
from homeassistant.components.cover import (
ATTR_CURRENT_POSITION,
ATTR_POSITION,
CoverDeviceClass,
CoverEntity,
CoverEntityFeature,
)
from homeassistant.config_entries... | {
"content_hash": "4c5bacd18b4e077e3d7ff8a29d5f6903",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 84,
"avg_line_length": 36.65384615384615,
"alnum_prop": 0.6775970619097587,
"repo_name": "mezz64/home-assistant",
"id": "696c9455f28bd5b2dbeb3c2607909f6568cd8fe3",
"size":... |
"""Naming set for Korean"""
import copy
import basepart
class ComposerElementKorean(basepart.ComposerElementBase):
"""Korean name composer - inspired by 이강성, 『파이썬 3 바이블』"""
character = ( \
tuple('ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ'), \
tuple('ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ'), \
tuple(' ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈ... | {
"content_hash": "cfa96614e17f431f4b1f93a4d9a9ea8f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 98,
"avg_line_length": 35.296875,
"alnum_prop": 0.601593625498008,
"repo_name": "pauis/name",
"id": "22f777acc96fe3c605219d03e3840eaa673df6a0",
"size": "2449",
"binary": ... |
from __future__ import unicode_literals
from django.db import migrations
import djorm_pgfulltext.fields
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='post',
name='search_index',... | {
"content_hash": "2d3453a87dfca0d89383c80c97e74218",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 125,
"avg_line_length": 24.42105263157895,
"alnum_prop": 0.6293103448275862,
"repo_name": "evg-dev/pyblog",
"id": "5e80852d001e4e66940690bd316e481077dc71cb",
"size": "535",... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.servicefabric import ServiceFabricManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-servicefabric
# USAGE
python get_a_service.py
Before run the sample, please set the values of the client ID, tenant... | {
"content_hash": "a6bc0a7e4539748a3102e7602814b689",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 150,
"avg_line_length": 33.65714285714286,
"alnum_prop": 0.7300509337860781,
"repo_name": "Azure/azure-sdk-for-python",
"id": "9021133d080cf7283739505b405bdde067180c74",
"s... |
import datetime
import warnings
from django.conf import settings
from haystack.backends import BaseEngine
from haystack.constants import DJANGO_CT
from haystack.exceptions import MissingDependency
from haystack.utils import get_identifier, get_model_ct
# Backport support
from .elasticsearch_backend import (Elasticse... | {
"content_hash": "75042dd9ff480aae7344853ae56de448",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 98,
"avg_line_length": 35.83460559796438,
"alnum_prop": 0.4800113612156501,
"repo_name": "reviewboard/reviewboard",
"id": "5241e0901109018a9d0f6f8595893bacdc2ffa6b",
"size... |
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | {
"content_hash": "23e7622967edb0e153b7d8fdfd7666d3",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 512,
"avg_line_length": 30.16083916083916,
"alnum_prop": 0.5699049385578484,
"repo_name": "realms-team/solmanager",
"id": "f48e08deb1e2d3db2467ba00b93f23c1f187e31c",
"size... |
"""
Support for showing the date and the time.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.time_date/
"""
import logging
import homeassistant.util.dt as dt_util
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__nam... | {
"content_hash": "07cd7feb25e930884a84070a1a1bb703",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 75,
"avg_line_length": 30.726315789473684,
"alnum_prop": 0.5707434052757794,
"repo_name": "Zyell/home-assistant",
"id": "e6e78fe8ff9094f9a6aca33cff20ee495ca95f1a",
"size": ... |
import collections
import json
import os
import uuid
import mock
import six
from heat.common import exception
from heat.common.i18n import _
from heat.common import identifier
from heat.common import template_format
from heat.common import urlfetch
from heat.engine import attributes
from heat.engine import environmen... | {
"content_hash": "755c1e34281f550ac0e5ae26672819ef",
"timestamp": "",
"source": "github",
"line_count": 1009,
"max_line_length": 79,
"avg_line_length": 44.41724479682854,
"alnum_prop": 0.5214539125778165,
"repo_name": "maestro-hybrid-cloud/heat",
"id": "91cbe91b1acb2e8635ebaa6254b50367c1957122",
"s... |
"""
Implements some utility functionality.
"""
from datafinder.persistence.adapters.sftp import constants
__version__ = "$Revision-Id:$"
class ItemIdentifierMapper(object):
""" Utility class to simplify different operations on logical
and persistence IDs. """
def __init__(self, b... | {
"content_hash": "15181f322eeba8cd891dcbd9fa22758d",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 89,
"avg_line_length": 32.34090909090909,
"alnum_prop": 0.5685172171468728,
"repo_name": "DLR-SC/DataFinder",
"id": "c91235c377d0d835c912402299c1f35963844e65",
"size": "454... |
import sys
import logging
import gensim
from optparse import OptionParser
from docs import config
from lib.models import load_model
logging.basicConfig(format="%(asctime)s : %(levelname)s : %(message)s", level=logging.INFO)
# Build this program's option parser
def build_opt_parser():
usage = "usage: %prog [option... | {
"content_hash": "42217613c3db9862a64e4f473ec3c238",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 91,
"avg_line_length": 26.847826086956523,
"alnum_prop": 0.6623481781376518,
"repo_name": "munnellg/elltm",
"id": "d87a720eee822a824ea866b39fcc8d16e3f7a5b2",
"size": "1235"... |
"""
Created on Thu Mar 24 08:18:04 2016
@author: npop
class DataWriterAscii
Inherits from DataWriter
This is simply head files and ascii data files
However, the header file saved is relevant only to this software
The header file means less processing to read the header information
"""
import os
import glob
import str... | {
"content_hash": "967124af71d912689fafb6346873e952",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 91,
"avg_line_length": 28.20754716981132,
"alnum_prop": 0.6682274247491639,
"repo_name": "nss350/magPy",
"id": "21f051c3c1219197b8229a16b5c0353b55cd659f",
"size": "1519",
... |
from django.core.urlresolvers import reverse
from django.db import models
from midnight_main.models import BaseTree, Base, BreadCrumbsMixin, BaseComment
from ckeditor.fields import RichTextField
from django.utils.translation import ugettext_lazy as _
from sorl.thumbnail import ImageField
from mptt.fields import TreeMan... | {
"content_hash": "cbdffb87b9c210c3afe7d654b39294a6",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 124,
"avg_line_length": 28.083333333333332,
"alnum_prop": 0.6761869436201781,
"repo_name": "webadmin87/midnight",
"id": "b67b35eb818dc4e5baf99aad96bee0144538fed9",
"size": ... |
"""
Blueprint providing features regarding the news entries.
"""
from operator import attrgetter
from flask import Blueprint, abort, current_app, render_template, request
bp_news = Blueprint('news', __name__, url_prefix='/news')
@bp_news.route("/")
def show():
"""Get all markdown files from 'content/news/', par... | {
"content_hash": "1dc87ba2ebdc0081ae8911580fb61918",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 33.225352112676056,
"alnum_prop": 0.602797795676134,
"repo_name": "agdsn/sipa",
"id": "8cb54a8a5a43143047e81dbb3c432b41debbff10",
"size": "2361",
"... |
import copy
import multiprocessing
from multiprocessing import Pool
import numpy as np
from tick.base.simulation import Simu
def simulate_single(simulation):
simulation.simulate()
return simulation
class SimuHawkesMulti(Simu):
"""Parallel simulations of a single Hawkes simulation
The incoming Haw... | {
"content_hash": "7cdcc7cad08d07b6c67c755710a0c5ad",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 80,
"avg_line_length": 29.751445086705203,
"alnum_prop": 0.6259957256654362,
"repo_name": "Dekken/tick",
"id": "70137ecb723daebea2bdcd3c3d49905efd28967e",
"size": "5172",
... |
"""Tests for the TypeSpec base class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from absl.testing import parameterized
import numpy as np
import six
from tensorflow.python.framework import dtypes
from tensorflow.python.framewo... | {
"content_hash": "d8d8794f32f1c6a758508159350da991",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 84,
"avg_line_length": 39.14258188824663,
"alnum_prop": 0.652030519320699,
"repo_name": "petewarden/tensorflow",
"id": "d55a6c4c3794b8363379b7a495fc7f53984babaa",
"size": ... |
import json
import mimetypes
import os
import logging
import redis
from django.core.urlresolvers import NoReverseMatch, reverse
from django.conf import settings
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseNotFound
from django.shortcuts imp... | {
"content_hash": "689100d6d9e51a3e0b3b39c35a54a776",
"timestamp": "",
"source": "github",
"line_count": 459,
"max_line_length": 141,
"avg_line_length": 39.108932461873636,
"alnum_prop": 0.5746197983399254,
"repo_name": "indexofire/gork",
"id": "09aa24f40d3cdb54155f7d48c8efd487f595027b",
"size": "17... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = r'''
---
module: vmware_vswitch_info
short_description: Gathers info about an ESXi host's vswitch confi... | {
"content_hash": "d4d1d5fbf773ceab3b11e68a3eda72a2",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 136,
"avg_line_length": 32.9078947368421,
"alnum_prop": 0.6089564174330268,
"repo_name": "thaim/ansible",
"id": "0732547df50ec3ed2b1d364bd57eeca250ea3e0b",
"size": "5200",... |
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('../'))
# -- General con... | {
"content_hash": "14ffabdf68fdc7303964a3a441cff386",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 80,
"avg_line_length": 32.24390243902439,
"alnum_prop": 0.7008861033066782,
"repo_name": "jonlooney/jxmlease",
"id": "ffafc9b02048048de6c21f9a14d26d6361eb732e",
"size": "9... |
import sys
import mapper
class ExifReport(mapper.Job):
def map(self, photo):
seen = set()
for tag, _, value in photo['exif']:
if tag not in seen and value is not None and type(value) != list:
seen.add(tag)
yield tag, value
def reduce(self, key, val... | {
"content_hash": "25e6af39db79cb814229a9890f72ec42",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 86,
"avg_line_length": 24.595238095238095,
"alnum_prop": 0.4937076476282672,
"repo_name": "andreisavu/exif-dataminer",
"id": "88ed81793477f92e79bbf5078ba7293bdd0819be",
"si... |
from .common import random_str, auth_check
from rancher import ApiError
import pytest
def test_dns_fields(admin_pc_client):
auth_check(admin_pc_client.schema, 'dnsRecord', 'crud', {
'namespaceId': 'cr',
'projectId': 'cr',
'hostname': 'cru',
'allocateLoadBalancerNodePorts': 'cru',
... | {
"content_hash": "d4eeb872daa0e571e8837fd6f82856d9",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 78,
"avg_line_length": 33.32258064516129,
"alnum_prop": 0.5866408518877058,
"repo_name": "rancherio/rancher",
"id": "20d939458f239323056c48cd74174e839dca0d87",
"size": "41... |
__author__ = 'greghines'
import numpy as np
import matplotlib.pyplot as plt
import pymongo
import cPickle as pickle
import os
import math
import sys
import urllib
import matplotlib.cbook as cbook
if os.path.exists("/home/ggdhines"):
sys.path.append("/home/ggdhines/PycharmProjects/reduction/experimental/clusteringA... | {
"content_hash": "cb596396e84ff6e8910a7531bdbb563e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 103,
"avg_line_length": 29.074074074074073,
"alnum_prop": 0.6267515923566879,
"repo_name": "camallen/aggregation",
"id": "295a5516d015f8b3c8228d38fb86aeda011fc507",
"size"... |
import logging
from abc import abstractmethod
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, Dict, Generator, Generic, Iterable, List, Optional, Type, TypeVar, Union
import pypeln
from pypeln.utils import A, BaseStage, Undefined
from tqdm import tqdm
from paralleldomain... | {
"content_hash": "6e429a069d3baa158cd92db208be8a12",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 105,
"avg_line_length": 30.381642512077295,
"alnum_prop": 0.6751470822070281,
"repo_name": "parallel-domain/pd-sdk",
"id": "d570656242f748b55ef5247b57462774099a9dff",
"siz... |
#! /usr/bin/python
"""
Copyright (c) 2012-2013 The Ohio State University.
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 re... | {
"content_hash": "8f76ad4ef2841428c7dc18b23b60aad5",
"timestamp": "",
"source": "github",
"line_count": 2223,
"max_line_length": 168,
"avg_line_length": 45.15969410706253,
"alnum_prop": 0.5127801573861939,
"repo_name": "anilshanbhag/GPUDB",
"id": "45b6d9f83b69ff0839fb2d778590f7fee67c862f",
"size": ... |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import unittest
from sample.str_process import classLv01
from sample.process.handler import Handler
class BasicTestSuite(unittest.TestCase):
"""
Test level 1 class
"""
def test_CalssLv01(self):
... | {
"content_hash": "5b557a66349c00bd4d8314924e4f7e7e",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 82,
"avg_line_length": 25.15625,
"alnum_prop": 0.6161490683229813,
"repo_name": "dqi2018/python-structure",
"id": "ea3486d1fd864d1519e4b599966564a5951735f0",
"size": "829",... |
"""Fetch managed repos.
This can be useful if you are switching from one arcyd instance to
another, to 'pre-fetch' before actually moving over.
"""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------... | {
"content_hash": "0c11e794e8a89cbc56c611d380b88eb8",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 79,
"avg_line_length": 31.27433628318584,
"alnum_prop": 0.5588568194680249,
"repo_name": "valhallasw/phabricator-tools",
"id": "961f0f7d54edf63f5cc55aa91e54a812f4aa20ae",
... |
from .base import CanaryToolsBase
class DataBundles(object):
def __init__(self, console):
"""Initialize a DataBundles object
:param console: The Console from which API calls are made
"""
self.console = console
def parse(self, data):
"""Parse JSON data
:param ... | {
"content_hash": "83d7ce651d665041df747651a7a1ba9d",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 93,
"avg_line_length": 39.30769230769231,
"alnum_prop": 0.571917808219178,
"repo_name": "thinkst/canarytools-python",
"id": "cf789d29f48401125db0c87aa13b4534f1d1ff87",
"siz... |
import pytest
from tenable.nessus.schema.pagination import FilterSchema, ListSchema
def test_filter_schema_dict():
filter = {'filter': 'name', 'quality': 'eq', 'value': 'something'}
schema = FilterSchema()
assert schema.dump(schema.load(filter)) == filter
def test_filter_schema_tuple():
filter_out =... | {
"content_hash": "109e8ab05214d45f19b77fe5571d5a37",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 74,
"avg_line_length": 33.146341463414636,
"alnum_prop": 0.5732155997056659,
"repo_name": "tenable/pyTenable",
"id": "9deb5040e1ea968a3068348f5f66930a821543ae",
"size": "13... |
import optparse
from scapy.all import *
def findGuest(pkt):
raw = pkt.sprintf('%Raw.load%')
name = re.findall('(?i)LAST_NAME=(.*)&', raw)
room = re.findall("(?i)ROOM_NUMBER=(.*)'", raw)
if name:
print '[+] Found Hotel Guest ' + str(name[0])+\
', Room #' + str(room[0])
def main():
... | {
"content_hash": "b2cac5e212b48a62db14aa081bd0a1b8",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 60,
"avg_line_length": 24.857142857142858,
"alnum_prop": 0.5643678160919541,
"repo_name": "psb-seclab/CTFStuff",
"id": "681c0eba68b673257a18ff920761b707a8d21491",
"size": "... |
"""This code example creates new activity groups.
To determine which activity groups exist, run get_all_activity_groups.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching a... | {
"content_hash": "1e928b11ce5720373693986d09739ee9",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 33.8,
"alnum_prop": 0.6982248520710059,
"repo_name": "Aloomaio/googleads-python-lib",
"id": "195585f0beb24d0ed93e05870fbb03d6be671cac",
"size": "2481... |
import io
import json
import pytest
import stix2
from ...exceptions import InvalidValueError
from .constants import IDENTITY_ID
EXPECTED_BUNDLE = """{
"type": "bundle",
"id": "bundle--00000000-0000-4000-8000-000000000007",
"spec_version": "2.0",
"objects": [
{
"type": "indicator"... | {
"content_hash": "d40689b45da67dce9d924337d8f7f594",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 125,
"avg_line_length": 35.226890756302524,
"alnum_prop": 0.6079039440203562,
"repo_name": "oasis-open/cti-python-stix2",
"id": "07fa24daccd95fa7686561703078452f7e32d813",
... |
"""Tests for the ``influxdb_get_postgresql_size`` management command."""
from django.test import TestCase
from mock import patch
from ..management.commands.influxdb_get_postgresql_size import Command
class InfluxdbGetPostgresqlSizeTestCase(TestCase):
"""Tests for the ``influxdb_get_postgresql_size`` management ... | {
"content_hash": "c0a83c00f8ea8e4bcab87ad5ee0be4c5",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 38.19512195121951,
"alnum_prop": 0.6411238825031929,
"repo_name": "bitlabstudio/django-influxdb-metrics",
"id": "699364192709650441def323a22ddf3b2e089a... |
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST API... | {
"content_hash": "2b72782accf26473c6e5a21f2fe9e890",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 409,
"avg_line_length": 33.12852664576803,
"alnum_prop": 0.6095760787282362,
"repo_name": "wavefrontHQ/python-client",
"id": "b2c107da1e525c18f85b09bd85aaeb0ecdd9e55d",
"s... |
"""
Form Widget classes specific to the Django admin site.
"""
import copy
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.html import escape
from django.utils.text import truncate_words
from django.utils.translation import ugettext a... | {
"content_hash": "e88af2f2b3acc39b92988b95e06aa43a",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 157,
"avg_line_length": 40.78983050847457,
"alnum_prop": 0.6201279813845259,
"repo_name": "jamespacileo/django-france",
"id": "f210d4ec79783a2331b8bdb514a577dacb8b525c",
"... |
"""
Copyright 2016 Udey Rishi
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
dist... | {
"content_hash": "15bea9aa22c8f77ea7ab414fe6ee8856",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 118,
"avg_line_length": 33.330275229357795,
"alnum_prop": 0.628131021194605,
"repo_name": "udeyrishi/bo",
"id": "fa046fa3a18ba1ab3ea132cc26b74ed9764ab126",
"size": "3656",... |
from meta import Album, Track, Artist
class MyMusicAlbum(Album):
type = "mymusic_album"
fields = ['mymusic_track_count', 'added_at', 'title', 'total_tracks', 'duration', 'release_date', 'release_format', 'rating', 'popularity', 'streamable', 'artist_display_name']
refs = ['artists', 'label', 'tracks', 'use... | {
"content_hash": "9e567a5a0f1be9e4a838a7230b4d37c1",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 180,
"avg_line_length": 41.41818181818182,
"alnum_prop": 0.6439859525899913,
"repo_name": "imsparsh/pybeats",
"id": "f1ca79aa68d7d90578a27cbdd8904a5e4845b90b",
"size": "227... |
import serial
import tornado.websocket
import tornado.ioloop
ser = serial.Serial(2) # open serial COM3 (change this to whatever port your uC is connected to)
print(ser.portstr) # check which port was really used (issues on windows)
line = 0
listeners = [] #list that will hold all the current connections
... | {
"content_hash": "62fbb73c4ae6e9ce3a5fd67186091a33",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 98,
"avg_line_length": 27.235294117647058,
"alnum_prop": 0.6857451403887689,
"repo_name": "Sulter/arduino-oxymeter",
"id": "dea17094b281f802ed9d64dc1055ea5459aff266",
"size... |
import inspect
import os
import textwrap
import types
import warnings
from .reference import Reference
from .shim import ModuleShim
class XTracebackFrame(object):
FILTER = ("__builtins__", "__all__", "__doc__", "__file__", "__name__",
"__package__", "__path__", "__loader__", "__cached__")
FUN... | {
"content_hash": "b2861a42753ca51b382e46259cd9e503",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 93,
"avg_line_length": 39.72811059907834,
"alnum_prop": 0.4876464447279898,
"repo_name": "Hypernode/xtraceback",
"id": "8778f9cb7493077454db9de4f6b769d38b244043",
"size": ... |
def extract희노애락(item):
"""
Parser for '희노애락'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=frag, postfix=postfix)
... | {
"content_hash": "5aca938a99683057df72e72ed15be1e6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 89,
"avg_line_length": 33.4,
"alnum_prop": 0.7035928143712575,
"repo_name": "fake-name/ReadableWebProxy",
"id": "b2e5819387076fd39c0f48060a56ca78031f7cb7",
"size": "350",
... |
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth import authenticate
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.forms.models import modelformset_factory, inlineformset_factory
from slugify import slugify
i... | {
"content_hash": "c35b967bc6da09a4c27b946ed7122734",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 111,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.5992531446540881,
"repo_name": "tiagoarasilva/django-boilerplate",
"id": "5409a362074f30728b83a6e4a5153a6675302f9... |
from msrest.pipeline import ClientRawResponse
from msrest.exceptions import HttpOperationError
from .. import models
class AvailabilitySets(object):
"""AvailabilitySets operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An objec... | {
"content_hash": "a58ebce8e630542a6f256ebf96ac95dd",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 104,
"avg_line_length": 36.51315789473684,
"alnum_prop": 0.654054054054054,
"repo_name": "sharadagarwal/autorest",
"id": "a45da1f5bfd72ae801e1606a0a92009ec326964d",
"size":... |
class NullClass:
def __getattr__(self,name): return lambda *x,**y: None
# -------------------------------------------
# Example: switched writing to a logfile
log=err=NullClass()
if verbose:
log = open('/tmp/log')
err = open('/tmp/err')
log.write('blabla')
err.write('blabla error')
#This obviously avoids t... | {
"content_hash": "521522873b02e3eef3bc1961bc7fc6f2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 26,
"alnum_prop": 0.6225961538461539,
"repo_name": "ActiveState/code",
"id": "39c8b409dbfd1ef3456c5d6de2106e8a17a8bef4",
"size": "505",
"binary": f... |
"""Test mempool re-org scenarios.
Test re-org scenarios with a mempool that contains transactions
that spend (directly or indirectly) coinbase transactions.
"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
# Create one-input, one-output, no-fee transaction:
class M... | {
"content_hash": "e8bef6c782458f0ef99fd17a11775dc4",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 122,
"avg_line_length": 46.15533980582524,
"alnum_prop": 0.6503996634413126,
"repo_name": "bitreserve/bitcoin",
"id": "812b54ffcb3234ebd1c0c91a301f6874c2c205a6",
"size": "... |
"""Migrates Feed-based sitelinks at Campaign level to use extension settings.
To learn more about extensionsettings, see:
https://developers.google.com/adwords/api/docs/guides/extension-settings.
To learn more about migrating Feed-based extensions to extension settings, see:
https://developers.google.com/adwords/api/... | {
"content_hash": "0f5fc0f6c9f4647e2007d6bb479563d4",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 83,
"avg_line_length": 30.348927875243664,
"alnum_prop": 0.6417239385959278,
"repo_name": "ya7lelkom/googleads-python-lib",
"id": "0b1345495975fa336f512fc42bef992998a6b58a",... |
xmpp = runtime.start("xmpp","Xmpp")
# adds the python service as a listener for messages
xmpp.addListener("python","publishMessage")
# there is a big list of different xmpp/jabber servers out there
# but we will connect to the big one - since that is where our robots account is
xmpp.connect("talk.google.com", 5222, "... | {
"content_hash": "4a5b22e4769ddc96a2daa770edc41e70",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 110,
"avg_line_length": 35.25925925925926,
"alnum_prop": 0.7531512605042017,
"repo_name": "MyRobotLab/myrobotlab",
"id": "b25172352e739ebbb439ebb2ff5a937306c4c1ec",
"size":... |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('search_jobs')
@click.argument("tool_id", type=str)
@click.argument("inputs", type=str)
@click.option(
"--state",
help="only return jobs in this state",
type=str
)
@pass_... | {
"content_hash": "e1289d616f8195119af6c0578f18fbfd",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 29.63888888888889,
"alnum_prop": 0.6776007497656982,
"repo_name": "galaxy-iuc/parsec",
"id": "55c0a14fc3d3c8fd5c777b55eba8138e288f7f1d",
"size": "106... |
__author__ = 'frankhe'
import numpy as np
import time
import theano
floatX = theano.config.floatX
class DataSet(object):
def __init__(self, width, height, rng, max_steps=1000000, phi_length=4, discount=0.99, batch_size=32,
transitions_len=4):
self.width = width
self.height = hei... | {
"content_hash": "605bf77b4e36e4a281cc4d5b5f901208",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 122,
"avg_line_length": 51.948,
"alnum_prop": 0.5654115654115655,
"repo_name": "ShibiHe/Q-Optimality-Tightening",
"id": "75092adab91a28c84d3e849d640dec74c78edce5",
"size":... |
from helpers import functions
from flask import Flask, request, session, url_for, redirect, \
render_template, abort, g, flash, _app_ctx_stack
from werkzeug import check_password_hash, generate_password_hash
def login():
"""Logs the user in."""
if g.user:
return redirect(functions.url_for('/'))
... | {
"content_hash": "22b0267d3d72baf79e16a0caf3f905ec",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 90,
"avg_line_length": 40.857142857142854,
"alnum_prop": 0.5895979020979021,
"repo_name": "RoseyG/CSITWIT",
"id": "c079546a3fa62f918ed95768cfb14c18012a7bcc",
"size": "2288"... |
import unittest
import imath
import IECore
import IECoreScene
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
class CustomOptionsTest( GafferSceneTest.SceneTestCase ) :
def test( self ) :
p = GafferScene.Plane()
options = GafferScene.CustomOptions()
options["in"].setInput( p["out"]... | {
"content_hash": "44abe6d4d3dad7e505c6e0b03074feac",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 163,
"avg_line_length": 34.604790419161674,
"alnum_prop": 0.6523620003460806,
"repo_name": "lucienfostier/gaffer",
"id": "85882f711c375483b40f96eabc752546e8a9178f",
"size"... |
import os
from tempfile import mkstemp
from numpy.testing import *
from numpy.distutils.npy_pkg_config import read_config, parse_flags
simple = """\
[meta]
Name = foo
Description = foo lib
Version = 0.1
[default]
cflags = -I/usr/include
libs = -L/usr/lib
"""
simple_d = {'cflags': '-I/usr/include', 'libflags': '-L/us... | {
"content_hash": "6b07714b5757db49fd9546ada5a3560d",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 82,
"avg_line_length": 30.947916666666668,
"alnum_prop": 0.5624368899360485,
"repo_name": "plaes/numpy",
"id": "5553aa8786485adb6b8d158040a416cd109d6b51",
"size": "2971",
... |
"""Do a minimal test of all the modules that aren't otherwise tested."""
import importlib
import sys
from test import support
import unittest
class TestUntestedModules(unittest.TestCase):
def test_untested_modules_can_be_imported(self):
untested = ('encodings', 'formatter', 'tabnanny')
with support... | {
"content_hash": "219c88378da385a0b9c03ac67c68c7d0",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 76,
"avg_line_length": 37.267857142857146,
"alnum_prop": 0.5975083852419741,
"repo_name": "FFMG/myoddweb.piger",
"id": "4025c2354a6cdbe3f6db7fd74f6e1e6594165103",
"size": "... |
from pycoin.blockchain.BlockChain import BlockChain
class FakeBlock(object):
def __init__(self, n, previous_block_hash=None):
if previous_block_hash is None:
previous_block_hash = n - 1
self.n = n
self.previous_block_hash = previous_block_hash
self.difficulty = 1
d... | {
"content_hash": "87f465e98845c79abe73474c38d31f7e",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 77,
"avg_line_length": 33.57959183673469,
"alnum_prop": 0.5885498966816579,
"repo_name": "shivaenigma/pycoin",
"id": "f1f23b47ae805953fa5b02cd5e4a87d941469e3c",
"size": "8... |
from django.shortcuts import render, get_object_or_404
from blog.models import Post
def index(request):
#get the blog posts that are published
posts = Post.objects.filter(published=True)
#now return the rendered template
return render(request,'blog/index.html',{'posts':posts})
def post(request,slug):
#get the Po... | {
"content_hash": "ddaa1dc5571472e9c2d614275c6548dd",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 57,
"avg_line_length": 33,
"alnum_prop": 0.7597402597402597,
"repo_name": "intuinno/vistalk",
"id": "2dd5533d54d5fad205e490161d57ec510bd845b9",
"size": "488",
"binary": f... |
"""Mass Upload Libray - processing metadata values."""
__authors__ = 'User:Jean-Frédéric'
import re
import os
import codecs
from collections import defaultdict
import pywikibot.textlib as textlib
def remove_linebreaks(field, old_field_value):
new_value = old_field_value.replace('\n', ' ').replace('\r', '').repla... | {
"content_hash": "c72c7e1d5a5e7293a0fdcc3c58e6fb8f",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 123,
"avg_line_length": 35.381443298969074,
"alnum_prop": 0.5504807692307693,
"repo_name": "Commonists/MassUploadLibrary",
"id": "05845884844c80a005f83af159afbf209c6a6305",
... |
"""
RPM Package builder system
.. versionadded:: 2015.8.0
This system allows for all of the components to build rpms safely in chrooted
environments. This also provides a function to generate yum repositories
This module implements the pkgbuild interface
"""
import errno
import functools
import logging
import os
i... | {
"content_hash": "4ecfc2dc9767bcac0279965d99c8ec9f",
"timestamp": "",
"source": "github",
"line_count": 758,
"max_line_length": 106,
"avg_line_length": 33.138522427440634,
"alnum_prop": 0.5723157769019467,
"repo_name": "saltstack/salt",
"id": "1532817222ff2b28aa49abf860f085fd4de908e4",
"size": "251... |
"""Simple Flask application served by pulsar WSGI server on a pool of threads
"""
from flask import Flask, make_response
from pulsar.apps import wsgi
def FlaskApp():
app = Flask(__name__)
@app.errorhandler(404)
def not_found(e):
return make_response("404 Page", 404)
@app.route('/', methods=... | {
"content_hash": "a734d31f00daed86949e261a348d1077",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 21.62857142857143,
"alnum_prop": 0.607661822985469,
"repo_name": "quantmind/pulsar",
"id": "d6d9ad4108c1df1d4bdf6af943df917d69f3be15",
"size": "757",... |
import base64
import mimetypes
from urllib import urlencode
from urlparse import urlparse, urlunparse
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def _encode_params(data):
"""Encode parameters in a piece of data.
Will successfull... | {
"content_hash": "b2ffdb54dfed9ac57ca14f8b4b8b9242",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 108,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.5823863636363636,
"repo_name": "alexknight/jobscrawler",
"id": "3e2c6259a31d25c131fe6e9f3d8368d1aa96f87a",
"siz... |
'''
Config holds the various processing parameters for each of the
individual packages
''' | {
"content_hash": "9772a4e59ea491c0e84b73842010be70",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 62,
"avg_line_length": 22.5,
"alnum_prop": 0.7888888888888889,
"repo_name": "dabillox/kcl-fire-aot",
"id": "593bca0cbbf5f63d4b5e35f7db94cad7c3b15b38",
"size": "90",
"binar... |
import re, time
import urllib, urllib2
from bs4 import BeautifulSoup
from bs4 import UnicodeDammit
from util.functional import try_times
from Queue import Queue
import threading
from dao.dbSUBMIT import Submit
from dao.dbBase import db
import datetime
| {
"content_hash": "5709773b1505e34a9de6b17a889dff39",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 37,
"avg_line_length": 19.615384615384617,
"alnum_prop": 0.8313725490196079,
"repo_name": "Z2Y/CUIT-ACM-Spider",
"id": "325543013ee0b3c119c2ef273ffbf1c87d8a092b",
"size": "... |
__copyright__ = 'Copyright(c) Gordon Elliott 2017'
"""
"""
import logging
from datetime import datetime
from glod.db.person import Person
from glod.db.organisation import Organisation, OrganisationCategory, OrganisationStatus
from glod.model.communication_permission import CommunicationPermission
from glod.db.orga... | {
"content_hash": "d793adb902102289ce6c4eeb563c550c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 122,
"avg_line_length": 33.81818181818182,
"alnum_prop": 0.695084485407066,
"repo_name": "gordon-elliott/glod",
"id": "0feb73925a0d17589a3e6cfa1237061e11c7d7d3",
"size": "2... |
'''
Created on 3 Aug 2014
@author: ankur
'''
import logging
from ondelabs.copilot.dao.DiskDAO import DiskDAO
from ondelabs.copilot.model.TextClassType import TextClassType
from ondelabs.copilot.model.ValidationData import ValidationData
class DiskValidationDAO(DiskDAO):
def __init__(self, filename):
... | {
"content_hash": "7afcd8dd7ce98eecc4b2e24501c38d1b",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 96,
"avg_line_length": 29.934782608695652,
"alnum_prop": 0.616557734204793,
"repo_name": "ankur22/Butler",
"id": "4c04939f2e2b493025c3eeadcad18ceeaf1fe3b9",
"size": "1377",... |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class InventoryAdjustExternalRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.biz_type = None
self.biz_unique_code = None
self.items = None
self.occup... | {
"content_hash": "b85df5379f331949a02c1a6ed70df439",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 55,
"avg_line_length": 29.055555555555557,
"alnum_prop": 0.6921606118546845,
"repo_name": "CooperLuan/devops.notes",
"id": "068f704eb194ea1c7b4741467d6fa9ac9f790911",
"size... |
"""
Launch a Docker image with Ubuntu and LXDE window manager, and
automatically open up the URL in the default web browser.
"""
# Author: Xiangmin Jiao <xmjiao@gmail.com>
from __future__ import print_function # Only Python 2.x
import sys
import subprocess
import time
APP = "docker"
def parse_args(description):
... | {
"content_hash": "15197cddae78d0620fe41cee8b078865",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 90,
"avg_line_length": 34.52577319587629,
"alnum_prop": 0.4794714840250821,
"repo_name": "x11vnc/docker-desktop",
"id": "26be5cf07d8e8e63d9434f132a4a0c130399d4b5",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.