text stringlengths 4 1.02M | meta dict |
|---|---|
"""
A number of function that enhance IDLE on MacOSX when it used as a normal
GUI application (as opposed to an X11 application).
"""
import sys
import Tkinter
def runningAsOSXApp():
"""
Returns True if Python is running from within an app on OSX.
If so, assume that Python was built with Aqua Tcl... | {
"content_hash": "c90dd5c20565501a487097f6e732e820",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 79,
"avg_line_length": 36.78787878787879,
"alnum_prop": 0.6081136738056013,
"repo_name": "babyliynfg/cross",
"id": "b3ac29789ba7d3b53567a261b4d8b8e0346890cf",
"size": "485... |
"""
__create_time__ = '13-10-13'
__author__ = 'Madre'
"""
from django.contrib import admin
from blog.models import CATEGORY, Blog, Tag
class CATEGORYAdmin(admin.ModelAdmin):
list_display = ('name', 'help_text', 'm_type', )
list_display_links = ['name']
list_editable = ['m_type']
list_filter = ['name']... | {
"content_hash": "04c47e87c23263efe429e99095e4cb34",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 65,
"avg_line_length": 27.085714285714285,
"alnum_prop": 0.6455696202531646,
"repo_name": "madre/PersonalWeb",
"id": "16d0d595feafa147dba6816b59291401a25b7f62",
"size": "96... |
from django.contrib import admin
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import PasswordResetForm
from django.utils.crypto import get_random_string
from authtools.admin import NamedUserAdmin
from authtools.forms import UserCreationForm
User = get_user_mod... | {
"content_hash": "633a2ba85a11e8d9c2c221115cd25f09",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 82,
"avg_line_length": 37.077922077922075,
"alnum_prop": 0.6290718038528896,
"repo_name": "kivikakk/django-authtools",
"id": "98efd5f3268e5e2f32e06b96112a1ba4698ee8c2",
"si... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import threading
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.base.base import BaseDatabase... | {
"content_hash": "6405d0fa7f948269f808463a08c7d784",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 113,
"avg_line_length": 38.51985559566787,
"alnum_prop": 0.6130271790065605,
"repo_name": "ghedsouza/django",
"id": "15adb0282e4efd3121ec75447d34f3b287c59ee8",
"size": "10... |
from collections import namedtuple
import datetime
import json
import logging
import os
import random
import time
logger = logging.getLogger()
def compare_namedtuples(items_base, items_compare, dedupe):
""" Return named tuples in a base list against a comparison list
Comparison is based on elements of the pa... | {
"content_hash": "704491de60baf416af384564f70e6c4c",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 78,
"avg_line_length": 28.949526813880126,
"alnum_prop": 0.591805600958919,
"repo_name": "curtisalexander/fc",
"id": "d8a51a8edd77292aa208738cc426fb9d0b561f02",
"size": "9... |
myPets = ['Zophie', 'Pooka', 'Fat-tail']
print('Enter a pet name:')
name = input()
if name not in myPets:
print('I do not have a pet named ' + name)
else:
print(name + ' is my pet.')
| {
"content_hash": "65ace8d3e25ba844ce3075e773c69afc",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 46,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.5858585858585859,
"repo_name": "xu6148152/Binea_Python_Project",
"id": "1b4636812b8f1b55a65a7ea30051c9e2216b0599",
... |
import socket
import time
import hlfilter
ircsock = None
server = ""
botnick = "deskbot" # Default bot nick.
password = "" # Default NickServ password.
admin = "" # Default admin nickname.
port = 6667 # Default server port.
timeout = 240 # Default ping timeout.
def display_info ():
print("Ni... | {
"content_hash": "cd7c65ebff8031a79f59d29efd6711b9",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 89,
"avg_line_length": 28.6046511627907,
"alnum_prop": 0.6495934959349593,
"repo_name": "skewerr/deskbot",
"id": "64c6e4def35b9786836e02fbb275e72aee32c2ff",
"size": "2460",... |
from collections import defaultdict
from itertools import groupby
import mock
import yaml
from nailgun.orchestrator import deployment_graph
from nailgun.orchestrator import graph_configuration
from nailgun.test import base
TASKS = """
- id: pre_deployment_start
type: stage
- id: pre_deployment
type: stage
r... | {
"content_hash": "9b059bc29e21367d5f4e187232c29eec",
"timestamp": "",
"source": "github",
"line_count": 631,
"max_line_length": 78,
"avg_line_length": 32.41838351822504,
"alnum_prop": 0.5681462651544779,
"repo_name": "zhaochao/fuel-web",
"id": "644b956c3a3fbb9f12a6bc2ca7eceee55c301c81",
"size": "21... |
"""Tests for apache_beam.runners.worker.sdk_worker."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import unittest
from builtins import range
import grpc
from apache_beam.portability.api import beam_fn_api_pb2
from apache_beam.portabili... | {
"content_hash": "bf4e541e7ceb21e3bbbccf8ccc6be36d",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 78,
"avg_line_length": 35.1764705882353,
"alnum_prop": 0.6686176142697882,
"repo_name": "RyanSkraba/beam",
"id": "e14b3f4bf80db6c35b2d578dcfdeb3a08d3113e8",
"size": "4372"... |
import sys
import functools
import os
import itertools
import weakref
import atexit
import threading # we want threading to install it's
# cleanup function before multiprocessing does
from subprocess import _args_from_interpreter_flags
from multiprocessing.process import curr... | {
"content_hash": "b45ee862f9c8848a3f8868f52a6831de",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 79,
"avg_line_length": 30.571428571428573,
"alnum_prop": 0.5760588586200039,
"repo_name": "cafe-grader-team/cafe-grader-web",
"id": "1530e8e80c71d52e2aee62a824d02004c130b77b... |
"""
APIs for dealing with Jabber rosters; ``jabber:iq:roster``
http://xmpp.org/rfcs/rfc6121.html#roster
"""
from lxml import etree
from ..stanzas import Iq
from ..stream import Mixin
from ..jid import Jid, internJid
from ..utils import xpathFilter
NS_URI = "jabber:iq:roster"
QUERY_TAG = "{%s}query" % NS_URI
ITEM_TAG ... | {
"content_hash": "55194385267f6cda3191a99d7165ca28",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 78,
"avg_line_length": 29.54189944134078,
"alnum_prop": 0.5794251134644478,
"repo_name": "nicfit/vexmpp",
"id": "f869340999ee9c0eda0fe077c3701d4f33181544",
"size": "5312",... |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="scatter3d.line.colorbar.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | {
"content_hash": "00abf4c88f59af2dac01d3db6aa24f45",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 32.61538461538461,
"alnum_prop": 0.6061320754716981,
"repo_name": "plotly/plotly.py",
"id": "789c9ef91e521c4d7a0bc94d7fbdc2094a166ff3",
"size": "424"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys
from collections import defaultdict
from contextlib import contextmanager
from twitter.common.collections import OrderedSet
from pants.base.addr... | {
"content_hash": "9f1b5a6b4695bcdef8be0c23474f2fc8",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 100,
"avg_line_length": 42,
"alnum_prop": 0.6967960023515579,
"repo_name": "digwanderlust/pants",
"id": "ea361e974719481bf431ec0782faf68af6b1c6ed",
"size": "13755",
"bin... |
"""
This package defines the astrophysics-specific units. They are also
available in the `astropy.units` namespace.
"""
from . import si
from astropy.constants import si as _si
from .core import (UnitBase, def_unit, si_prefixes, binary_prefixes,
set_enabled_units)
# To ensure si units of the cons... | {
"content_hash": "fcc6b523b5c44da0d8abbf224a317ea7",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 85,
"avg_line_length": 38.76216216216216,
"alnum_prop": 0.5315855529214893,
"repo_name": "MSeifert04/astropy",
"id": "9a4a5f2f26913ab6e4eb9c7e050137ab68f603e3",
"size": "7... |
"""Test case to have linter fail."""
class LinterFailTestClass(object):
"""Linter fail test class."""
def __init__(self):
"""Initializes a linter fail test object."""
super(LinterFailTestClass, self).__init__()
# Note that the indentation here is deliberately broken.
self._attribute = None
| {
"content_hash": "8c7ea7aa5130e76b2a76e2451f1b1d30",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 60,
"avg_line_length": 28.636363636363637,
"alnum_prop": 0.6698412698412698,
"repo_name": "rgayon/l2tdevtools",
"id": "f35c5c5bd0aa6832d466d16983fcba442d018540",
"size": "3... |
"""
**QtPy** is a shim over the various Python Qt bindings. It is used to write
Qt binding independent libraries or applications.
If one of the APIs has already been imported, then it will be used.
Otherwise, the shim will automatically select the first available API (PyQt5, PyQt6,
PySide2 and PySide6); in that case,... | {
"content_hash": "2bb239fa4187f6eba9306e1e1d67eb2e",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 94,
"avg_line_length": 31.822916666666668,
"alnum_prop": 0.6148936170212767,
"repo_name": "davvid/qtpy",
"id": "2862370121723c8e45662ae940d651b312db421f",
"size": "6283",
... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.pa... | {
"content_hash": "2995ca839ad9ebf53cec66b3829e2823",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 94,
"avg_line_length": 31.218855218855218,
"alnum_prop": 0.6945642795513374,
"repo_name": "SanMi86/doc-kurento",
"id": "3b3f3982bbc9e7d9c5ff9aa9b2958a26f24d1ee0",
"size": ... |
from keras.datasets import mnist
from keras.utils import np_utils
import numpy as np
import h5py
import os
import matplotlib.pylab as plt
def normalization(X):
result = X / 127.5 - 1
# Deal with the case where float multiplication gives an out of range result (eg 1.000001)
out_of_bounds_high = (res... | {
"content_hash": "89b22868984f254cf88c45080d57f2a6",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 112,
"avg_line_length": 34.3756345177665,
"alnum_prop": 0.5884524512699351,
"repo_name": "tdeboissiere/DeepLearningImplementations",
"id": "9d0d242e023b6fff3bea2c263cb0782bc... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name = 'profile')
display_name = models.CharField(max_length = 200, verbose_nam... | {
"content_hash": "bc1dbc0bde18e6716d308f27c2c7188e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 104,
"avg_line_length": 45.888888888888886,
"alnum_prop": 0.6791767554479419,
"repo_name": "brianray/chipy.org",
"id": "d20ffe1ed9d78dee6b505a0acd57e359914ce4f7",
"size": "... |
import numpy as np
from . import global_rand
def get_fans(shape):
fan_in = shape[0] if len(shape) == 2 else np.prod(shape[1:])
fan_out = shape[1] if len(shape) == 2 else shape[0]
return fan_in, fan_out
class WeightInitializer(object):
"""
Initializer for creating weights.
"""
def __init__... | {
"content_hash": "461c68f20698cdfb21b1ee2ac8bb63c0",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 72,
"avg_line_length": 28.985611510791365,
"alnum_prop": 0.574584264085381,
"repo_name": "tangyaohua/dl4mt",
"id": "3cd5ffdacc71985225462d0838e6aa32bed6e050",
"size": "407... |
import h5py
import theano
import theano.tensor as T
import os.path as osp
import numpy as np
from layers import split_state, MLP, BasicLSTM, Embedding, Attention
class Model(object):
"""
Region Attention model
"""
def __init__(self, name='ra', nimg=2048, na=512, nh=512, nw=512, nout=8843, npatch=30, ... | {
"content_hash": "28efeb64fc8d20ab287c5cee42e0ecb7",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 110,
"avg_line_length": 38.766917293233085,
"alnum_prop": 0.5513964313421257,
"repo_name": "fukun07/neural-image-captioning",
"id": "f067c1aaf651bff9f4de80dd49294b4f1cb57f8b... |
"""
Basic examples of
(i) pyproj in action - convert simple lat/lon pair to Irish Grid
(ii) create shapefiles from csv
(iii) create create new geoometriies especially a set of disolved buffers around points using 'shapely'
"""
import csv
from shapely.geometry import Point, mapping, shape
from shapely.ops import casca... | {
"content_hash": "f8b7c1562594c85af1686b85c9da851d",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 103,
"avg_line_length": 32.75609756097561,
"alnum_prop": 0.6157855547282204,
"repo_name": "d15123601/geotinkering",
"id": "fed67de58206a257c93e258bd7cbf57b3521c841",
"size"... |
import pytest
class TestMarkers:
@pytest.fixture
def testdir(self, testdir):
testdir.makeconftest(
"""
pytest_plugins = 'pytest_testdox.plugin'
"""
)
return testdir
def test_should_not_raise_warning_without_plugin_call(self, testdir):
testdi... | {
"content_hash": "7fd58c6dbbccf23372e3dd891f3eb353",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 24.466666666666665,
"alnum_prop": 0.5626702997275205,
"repo_name": "renanivo/pytest-testdox",
"id": "d6538eeee0ccf4ed0b6a43b821b51a15d1e04090",
"size... |
class Environment(object):
"""Base class for environment."""
def __init__(self):
pass
@property
def num_of_actions(self):
raise NotImplementedError
def GetState(self):
"""Returns current state as numpy (possibly) multidimensional array.
If the current state is terminal, returns None.
""... | {
"content_hash": "48e675a3fcf81e3b890d095ab7eb3123",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 72,
"avg_line_length": 22.205128205128204,
"alnum_prop": 0.684757505773672,
"repo_name": "vertix/deep_rl",
"id": "5b7c8923cd20fab013852c2915a2f4e5433278fc",
"size": "866",
... |
import fixtures
from ironic_tempest_plugin.services.baremetal import base
class APIMicroversionFixture(fixtures.Fixture):
def __init__(self, baremetal_microversion):
self.baremetal_microversion = baremetal_microversion
def _setUp(self):
super(APIMicroversionFixture, self)._setUp()
b... | {
"content_hash": "f825b0cb7a84ce33a832ce5c26777991",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 31.928571428571427,
"alnum_prop": 0.7494407158836689,
"repo_name": "jiazichenzhan/Server_Manage_Plugin",
"id": "ff7e09a8a44317848873c49e2d6e8da72b611da... |
import abc
from abc import abstractmethod, abstractproperty
import collections
import contextlib
import functools
import re as stdlib_re # Avoid confusion with the re we export.
import sys
import types
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc # F... | {
"content_hash": "7850b554e90db4e665e72c6747813b49",
"timestamp": "",
"source": "github",
"line_count": 2325,
"max_line_length": 87,
"avg_line_length": 33.14709677419355,
"alnum_prop": 0.5795865934835922,
"repo_name": "randyzingle/tools",
"id": "efe358faf20988b0e2e3a315b7447b14d81c7109",
"size": "7... |
from oslo_log import log as oslo_logging
from cloudbaseinit.osutils import factory
from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
base
)
from cloudbaseinit.utils import hostname
LOG = oslo_logging.getLogger(__name__)
class SetHostnamePlugin(base.BaseCloudConfigPlugin):
"""Cha... | {
"content_hash": "e940f13f86e15f00d279a4add4589958",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 26.607142857142858,
"alnum_prop": 0.7194630872483222,
"repo_name": "ader1990/cloudbase-init",
"id": "2b6bfe7dfc97b62f590f131215a77b299913a5db",
"size... |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from config import config
bootstrap = Bootstrap()
db = SQLAlchemy()
login_manager = LoginManager()
login_manager.login_view = "control_panel.login"
def create_app(c... | {
"content_hash": "924ff1b024b269982b214b36cc38c227",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 24.133333333333333,
"alnum_prop": 0.7486187845303868,
"repo_name": "Gateswong/GatesBlog",
"id": "b744249e3d78c651bdf83c9494f2fe89bfd94e49",
"size": "... |
"""Support for monitoring an OpenEVSE Charger."""
from __future__ import annotations
import logging
import openevsewifi
from requests import RequestException
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorEntityDescriptio... | {
"content_hash": "f53c0162fbd8ac24bee9a01677f648f8",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 86,
"avg_line_length": 33.36619718309859,
"alnum_prop": 0.6587167581257914,
"repo_name": "nkgilley/home-assistant",
"id": "5bb469a3d99b842d3c78bb5388a790ef138b33bf",
"size... |
import os
import sqlalchemy as sa
from asyncpgsa import create_pool, pg
from dotenv import find_dotenv, load_dotenv
from sqlalchemy import Table
from sqlalchemy.dialects.postgresql import insert as pg_insert
from sqlalchemy.dialects.postgresql.dml import Insert
from . import model
metadata = sa.MetaData()
load_dote... | {
"content_hash": "17a7b71f87cc051ca977e04060d1fb39",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 105,
"avg_line_length": 42.291666666666664,
"alnum_prop": 0.5631527093596059,
"repo_name": "aaront/puckdb",
"id": "6cc78736da5a6780bc3a597d8bf6642d12dfea68",
"size": "5075... |
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa:... | {
"content_hash": "9c595a8a256496fe236cfd5bad3744a5",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 110,
"avg_line_length": 35.6875,
"alnum_prop": 0.5954465849387041,
"repo_name": "onshape-public/onshape-clients",
"id": "4587c6b9746aaf4221d743a211558853eba97274",
"size":... |
#!/usr/bin/env python3
# This file is part of the Soletta Project
#
# Copyright (C) 2015 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code ... | {
"content_hash": "bbbcd191dd64a828342d1cad60ed9800",
"timestamp": "",
"source": "github",
"line_count": 1618,
"max_line_length": 143,
"avg_line_length": 33.050679851668725,
"alnum_prop": 0.6068142718228738,
"repo_name": "ricardotk/soletta",
"id": "7914d0411028a5615905351f0afaf62fcb6556f0",
"size": ... |
from __future__ import absolute_import, division, print_function
import binascii
import collections
import re
from contextlib import contextmanager
import pytest
import six
from cryptography.exceptions import UnsupportedAlgorithm
import cryptography_vectors
HashVector = collections.namedtuple("HashVector", ["mes... | {
"content_hash": "22ee366b64de4ea74318b1d36597959b",
"timestamp": "",
"source": "github",
"line_count": 763,
"max_line_length": 79,
"avg_line_length": 31.51114023591088,
"alnum_prop": 0.494530632616562,
"repo_name": "sholsapp/cryptography",
"id": "46d936467369c950530c14d3113e08e13fabe130",
"size": ... |
"""Module to handle ox_herd tasks.
An OxHerdTask is a general class to represent a task managed by ox_herd.
Users are meant to sub-class OxHerdTask for their own use. See docstring for
OxHerdTask for details.
You can find some example sub-classes of OxHerdTask in the simple_ox_tasks.py
module.
1;5202;0c"""
import sh... | {
"content_hash": "09136411944241c0056c150bfbff5575",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 79,
"avg_line_length": 39.90689655172414,
"alnum_prop": 0.5839453901322043,
"repo_name": "aocks/ox_herd",
"id": "6f75772dff520875c973fa9d82038ce639a4955c",
"size": "11573"... |
from os.path import expanduser
import shutil
import os
import json
from maskgen import config
imageLoaded = False
class MaskGenLoader:
def __init__(self, file_path=os.path.join(expanduser("~"), ".maskgen2")):
self.file_path = file_path
self.load()
def load(self):
global_image = config... | {
"content_hash": "01017d55d93df6322cf4bf5883a95170",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 112,
"avg_line_length": 30.67391304347826,
"alnum_prop": 0.569454287739192,
"repo_name": "rwgdrummer/maskgen",
"id": "9b0096f7f78261c1b8f9c20d0311b2c5d4e2fc25",
"size": "30... |
"""
Verion: 1.0
Author: zhangjian
Site: http://iliangqunru.com
File: send_dns_msg.py
Time: 2017/8/29 20:14
"""
import logging
import socket
import threading
import select
level = logging.DEBUG
format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
datefmt = '%Y-%m-%d %H:%M'
logging.basicConfig(level=leve... | {
"content_hash": "5159c1ce152cdf196055c586b1d71412",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 91,
"avg_line_length": 30.633136094674555,
"alnum_prop": 0.5933938574463975,
"repo_name": "Xarrow/pySimulatedDNS",
"id": "dac11eccb8e12859fea1414ff737d81960b1431e",
"size"... |
import httplib2
id = '123'
data = 'hello world'
#database = 'shelve'
database = 'fs'
#database = 'memory'
#action = 'POST'
action = 'PUT'
#action = 'DELETE'
base_url = 'http://localhost:8080'
def url(id):
return '/'.join([base_url, database, id])
h = httplib2.Http()
resp, content = h.request(url(id), action, dat... | {
"content_hash": "0f21799bf2d2c84a6335586d7dbed830",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 57,
"avg_line_length": 17.083333333333332,
"alnum_prop": 0.6487804878048781,
"repo_name": "dayatz/7oars",
"id": "d71545c61815d0b126b7ab0459fea5a70e2fc8f4",
"size": "665",
... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "df19b7ea8768ef9281686e4ee75ee355",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 81,
"avg_line_length": 30.723076923076924,
"alnum_prop": 0.7016775162744117,
"repo_name": "briancohan/fmapi",
"id": "448e08d64cc1d413ed2ec1a15140468db169d419",
"size": "84... |
from decimal import *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTC values"""
n = Decimal("20000... | {
"content_hash": "c68da484e196007c18a5a754d6e63936",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 111,
"avg_line_length": 37.77777777777778,
"alnum_prop": 0.6102941176470589,
"repo_name": "notforhire/Yup",
"id": "113aa9d3a5442949422baa61ba562061be16bb5f",
"size": "9886... |
import logging
from zope.interface import implements
from lbrynet.interfaces import IRateLimiter
from twisted.internet import task
log = logging.getLogger(__name__)
class DummyRateLimiter(object):
def __init__(self):
self.dl_bytes_this_second = 0
self.ul_bytes_this_second = 0
self.total... | {
"content_hash": "93ae0329bd8d936a7ae08a3d368da0a3",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 94,
"avg_line_length": 29.41025641025641,
"alnum_prop": 0.5980819529206626,
"repo_name": "zestyr/lbry",
"id": "b2d2f8698dd155545155f66848bf0c5967d4565d",
"size": "4588",
... |
__author__ = 'Alex Bo'
__email__ = 'bosha@the-bosha.ru'
def sqlalchemy_orm_to_dict(model):
"""
Converts sqlalchemy model to dictionary
:param model: declarative sqlalchemy model
:return: Sqlalchemy model as dictionary
:rtype: dict
:raise RuntimeError: if passed object not a sqlalchemy model
... | {
"content_hash": "b902bd3f78185b372d20c310b6151b92",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 94,
"avg_line_length": 34.1,
"alnum_prop": 0.6319648093841642,
"repo_name": "bosha/torhandlers",
"id": "23749afc30dfa8c7200b551e24e8f6fe15695bba",
"size": "706",
"binary"... |
from setuptools import setup, find_packages
setup(
name="onitu-amazon-s3",
version="0.1",
url="http://onitu.github.io",
description="Access your Amazon S3 buckets with Onitu",
license="MIT",
packages=find_packages(),
install_requires=["requests"],
dependency_links=[
"git+git://g... | {
"content_hash": "cd9bdba9b573dc29e4ab440ae005c993",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 59,
"avg_line_length": 26,
"alnum_prop": 0.5735785953177257,
"repo_name": "onitu/onitu",
"id": "19807e038fab4418836a2b02ca3f58b999de7ba2",
"size": "598",
"binary": false,... |
""" Handle the SCOP DOMain file.
The DOM file has been officially deprecated. For more information see
the SCOP"release notes.":http://scop.berkeley.edu/release-notes-1.55.html
The DOM files for older releases can be found
"elsewhere at SCOP.":http://scop.mrc-lmb.cam.ac.uk/scop/parse/
"""
from .Residues import Residu... | {
"content_hash": "1b13fe7494d04a436d7b11b309eb2ae2",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 77,
"avg_line_length": 29.791044776119403,
"alnum_prop": 0.5826653306613226,
"repo_name": "poojavade/Genomics_Docker",
"id": "50077df754f6576534b09ac658e3ee8bb5940c7d",
"si... |
"""
:Author Patrik Valkovic
:Created 08.07.2017 14:03
:Licence MIT
Part of grammpy
"""
from typing import Any
class GrammpyException(Exception):
"""
Base class for all exceptions
"""
def __init__(self, *args: Any) -> None:
super().__init__(*args) | {
"content_hash": "838ce43a3b5933e694a457770431b398",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 43,
"avg_line_length": 17.0625,
"alnum_prop": 0.6263736263736264,
"repo_name": "PatrikValkovic/grammpy",
"id": "742f89e9462f065c516bccef3e508c26d70b9cda",
"size": "295",
... |
import frappe
def execute():
column = "apply_user_permissions"
to_remove = ["DocPerm", "Custom DocPerm"]
for doctype in to_remove:
if frappe.db.table_exists(doctype):
if column in frappe.db.get_table_columns(doctype):
frappe.db.sql(f"alter table `tab{doctype}` drop column {column}")
frappe.reload_doc("... | {
"content_hash": "5215d100ad53b2a6aae822beb0f8b01a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 69,
"avg_line_length": 30.642857142857142,
"alnum_prop": 0.703962703962704,
"repo_name": "yashodhank/frappe",
"id": "0a0091624e236da0281d08cc09b3198739b910bb",
"size": "429... |
from django import forms
import account.forms
from bojv4.conf import GENDER
from .models import UserProfile, GroupProfile
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User, Group
from django_select2.forms import ModelSelect2MultipleWidget, ModelSelect2Widget
class Use... | {
"content_hash": "3e5347c66dcce52dda01007e1608a957",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 101,
"avg_line_length": 27.813084112149532,
"alnum_prop": 0.592741935483871,
"repo_name": "BUPT-OJ-V4/BOJ-V4",
"id": "7f5d836e55bdfa07ef712ccfd8c1d6eafa059c34",
"size": "2... |
"""Helper functions to locate and manipulate files in the bcbio analysis file structure
"""
import os
import glob
import datetime
import csv
from dateutil import parser
def fastq_screen_finished(fastq_screen_dir,check_png=False):
"""Determine if the finished output from fastq_screen exists
"""
pattern ... | {
"content_hash": "f920df07ebdddbcef3091759bb46e227",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 122,
"avg_line_length": 31.958333333333332,
"alnum_prop": 0.6130378096479792,
"repo_name": "kate-v-stepanova/scilifelab",
"id": "0bcee76d406872c820794d8ce1fa59a1a5571e08",
... |
def spam():
print('spam') | {
"content_hash": "5a923f79300f1e6ec80805df506c4757",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 17,
"avg_line_length": 14.5,
"alnum_prop": 0.5517241379310345,
"repo_name": "xu6148152/Binea_Python_Project",
"id": "996ecef9229a3ac8f56c63cb004d5bc57dc19da4",
"size": "56",... |
from __future__ import absolute_import, division, print_function, unicode_literals
import warnings
import json
# Try to import urljoin from the Python 3 reorganized stdlib first:
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
from django.conf import settings
from djang... | {
"content_hash": "6f68782991cd029d1203d00ffc1b4748",
"timestamp": "",
"source": "github",
"line_count": 799,
"max_line_length": 184,
"avg_line_length": 39.43053817271589,
"alnum_prop": 0.5516584669100143,
"repo_name": "elishowk/django-haystack",
"id": "1baec3cec63fe3a7aa78f904d4fc7748ed6d5c09",
"si... |
import datetime
from lxml import etree
from cinder.api.openstack.volume.views import versions as views_versions
from cinder.api.openstack import wsgi
from cinder.api.openstack import xmlutil
VERSIONS = {
"v1.0": {
"id": "v1.0",
"status": "CURRENT",
"updated": "2012-01-04T11:33:21Z",
... | {
"content_hash": "be9bbda436df485db040224bf4e3d5b5",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 79,
"avg_line_length": 31.891402714932127,
"alnum_prop": 0.57761066969353,
"repo_name": "tylertian/Openstack",
"id": "a3cc91f9bfc6979f3c00deafc1da65237439bf1b",
"size": "7... |
class Command:
"""
Defines constants for the standard WebDriver commands.
While these constants have no meaning in and of themselves, they are
used to marshal commands through a service that implements WebDriver's
remote wire protocol:
https://github.com/SeleniumHQ/selenium/wiki/JsonWirePr... | {
"content_hash": "441232ac87e7a0b3031a03cfc8e1e181",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 75,
"avg_line_length": 40.13333333333333,
"alnum_prop": 0.7031324157570005,
"repo_name": "valfirst/selenium",
"id": "e705c58088c2167956104aa6cb663f6ed4238cec",
"size": "50... |
import requests
import json
import time
def action(**kwargs):
''' This method is called to action a reaction '''
redata = kwargs['redata']
jdata = kwargs['jdata']
logger = kwargs['logger']
run = True
# Check for Trigger
if redata['trigger'] > jdata['failcount']:
run = False
# ... | {
"content_hash": "d19380ead2bd17f39b733f66af5285ed",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 110,
"avg_line_length": 30.24,
"alnum_prop": 0.593915343915344,
"repo_name": "Runbook/runbook",
"id": "dab073b17c9721ef88e54faece78c074a9fb3ec6",
"size": "1782",
"binary"... |
import csv
import datetime
import json
import logging
import urlparse
from cStringIO import StringIO
from django.conf import settings
from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.urlresolvers import reverse
from django.core.validators import validate_ipv4_address, valida... | {
"content_hash": "619a249bb874c232e1591d5cb1df84f1",
"timestamp": "",
"source": "github",
"line_count": 1402,
"max_line_length": 122,
"avg_line_length": 39.07917261055635,
"alnum_prop": 0.5678329591706365,
"repo_name": "DukeOfHazard/crits",
"id": "da0d35d7802e24f0de6f741c729fe4cfcd1129f8",
"size": ... |
"""The Virtual File System (VFS) file-like object interface."""
import abc
import os
# Since this class implements the file-like object interface
# the names of the interface functions are in lower case as an exception
# to the normal naming convention.
class FileIO(object):
"""Class that implements the VFS file... | {
"content_hash": "a7f00c50a13c2fc22fe7753d150255bf",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 29.647435897435898,
"alnum_prop": 0.6657297297297298,
"repo_name": "manashmndl/dfvfs",
"id": "4b923699c632b0cd6127136ee8177d80ab73454c",
"size": "46... |
from flask import Blueprint
api = Blueprint('api', __name__)
from . import http, events # noqa | {
"content_hash": "1ba6471e4880280ed2a261197ce27ea7",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 34,
"avg_line_length": 19.4,
"alnum_prop": 0.6907216494845361,
"repo_name": "EducationalTestingService/halef-messenger",
"id": "4b093ef97c5e78b468395406bfbc80f8df8f9ef6",
"s... |
import json
import time
import re
from collections import OrderedDict
from doajtest.helpers import DoajTestCase
from portality import models
from portality.upgrade import do_upgrade
from portality.lib.paths import rel2abs
def operation(journal):
j = models.Journal.pull(journal.id)
bj = j.bibjson()
bj.titl... | {
"content_hash": "e91ed5e0edfbf7f0a18269307da6f6f4",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 85,
"avg_line_length": 28.50632911392405,
"alnum_prop": 0.5674955595026643,
"repo_name": "DOAJ/doaj",
"id": "073ac90844acfe18070f85aa3615e5a5710f113e",
"size": "2252",
"b... |
#!/usr/bin/env python
"""
Copyright 2016-Present Couchbase, Inc.
Use of this software is governed by the Business Source License included in
the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that
file, in accordance with the Business Source License, use of this software will
be governed by the ... | {
"content_hash": "1843593739fff77dfa80e7c337a9a2a8",
"timestamp": "",
"source": "github",
"line_count": 1158,
"max_line_length": 201,
"avg_line_length": 37.487046632124354,
"alnum_prop": 0.565860400829302,
"repo_name": "couchbaselabs/sync_gateway",
"id": "56babf34054caa7b22d9e9a024b38284cd0b2225",
... |
"""Unit tests."""
import mock
import pytest
from google.cloud import errorreporting_v1beta1
from google.cloud.errorreporting_v1beta1.proto import report_errors_service_pb2
class MultiCallableStub(object):
"""Stub for the grpc.UnaryUnaryMultiCallable interface."""
def __init__(self, method, channel_stub):
... | {
"content_hash": "1bdf3759a01133420761340ec277709b",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 87,
"avg_line_length": 31.96590909090909,
"alnum_prop": 0.6583718450053324,
"repo_name": "dhermes/gcloud-python",
"id": "6f715244c70091a223c54648b7a6c7be231ef0c7",
"size": ... |
"""
=================================
Gaussian Mixture Model Selection
=================================
This example shows that model selection can be perfomed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in the... | {
"content_hash": "2a2c17c9457d9fd712be5de3f9c9faae",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 77,
"avg_line_length": 32.896907216494846,
"alnum_prop": 0.619554998433093,
"repo_name": "lucidfrontier45/scikit-learn",
"id": "4f9b46a95fad04029b167221bf06ce0753866798",
"... |
import os
import sys
import sphinx_rtd_theme
import pkg_resources
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
import sphinxcontrib; reload(sphinxcontrib)
extensions = ['sphinxcontrib.ros']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'sphinxcontritb... | {
"content_hash": "45ab3f68b5364f346f05044ba1b0c701",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 32.77272727272727,
"alnum_prop": 0.6990291262135923,
"repo_name": "otamachan/sphinxcontrib-ros",
"id": "cfbe6789405a40c2e277a1b39efc97afac405430",
"s... |
"""Utility for benchmark"""
import sys
import nnvm
def get_network(name, batch_size):
"""Get the symbol definition and random weight of a network
Parameters
----------
name: str
The name of the network, can be 'resnet-18', 'resnet-50', 'vgg-16', 'inception_v3', 'mobilenet', ...
batch_... | {
"content_hash": "1176842d52f4b9385fc00becf5e7e806",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 108,
"avg_line_length": 35.37662337662338,
"alnum_prop": 0.6171071953010279,
"repo_name": "mlperf/training_results_v0.6",
"id": "4825ac96571d26a9cb381cab9206db9837df6e36",
... |
"""
This is an example file for using the OPAL libraries. This particular
example measures the total energy of fields + particles + coupling for a
Coulomb explosion in two dimensions.
"""
from opal.fields import discrete_fourier_electrostatic as dfe
from opal.interpolaters_depositers import tent_dfes as depinterp
from ... | {
"content_hash": "e9bd4c0b4ea5dd4058be82248e936bcf",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 80,
"avg_line_length": 26.649224806201552,
"alnum_prop": 0.5885390153443386,
"repo_name": "radiasoft/opal",
"id": "67828d7a9a5227370df55c9ba8ff4996ec97b017",
"size": "1375... |
from django.contrib import admin
from .models import Contact
admin.site.register(Contact)
| {
"content_hash": "389099f11b513e0f2ee0a961e94d2d43",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 32,
"avg_line_length": 15.5,
"alnum_prop": 0.8064516129032258,
"repo_name": "tudyzhb/yichui",
"id": "99abb441a56688a23da030c316e8d9c8ed87b0bd",
"size": "93",
"binary": fal... |
from jinja2 import Template
import json
class Jinja2Engine(object):
"""
Jinja2 template engine class
"""
def render_from_object(self, object, **data):
template_str = json.dumps(object)
result = self.render(template_str, **data)
return json.loads(result)
def render(self, t... | {
"content_hash": "66eddf181a4ca7d007660f854b5abba9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 50,
"avg_line_length": 24.88235294117647,
"alnum_prop": 0.6430260047281324,
"repo_name": "fource/fource",
"id": "0a15c7f2693b596fd146ed7401a29dc73fea8580",
"size": "423",
... |
import logging
from elasticsearch.exceptions import RequestError, NotFoundError
logger = logging.getLogger(__name__)
class SchemaEnforcer(object):
def __init__(self, client):
self.client = client
def enforce(self, schema):
for name, template in schema['templates'].items():
logg... | {
"content_hash": "e21c2aa35da63cb5acfbca8859da2a0d",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 131,
"avg_line_length": 36.5,
"alnum_prop": 0.5907534246575342,
"repo_name": "Livefyre/pseudonym",
"id": "31ab3519b19b70dd9294a4a889e537bd2236a33a",
"size": "3504",
"bina... |
#!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory that... | {
"content_hash": "7427ca8b9e5f7d9c9bbda14ec545c6f3",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 98,
"avg_line_length": 31.814814814814813,
"alnum_prop": 0.5757857974388825,
"repo_name": "dev1972/Satellitecoin",
"id": "1ac96d463fd63cf5f1c4c1268d590f2acaa0e1b7",
"size"... |
import unittest
from LuncherPreferences import LuncherPreferences
class TestLuncherPreferences(unittest.TestCase):
def setUp(self):
self.luncherprefs = LuncherPreferences("ryan")
def test_add_over_100(self):
self.luncherprefs.update("pizza", 50)
self.luncherprefs.update("cafe", 60)
... | {
"content_hash": "27d41458092bc895944ac5abcf2ed594",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 31.6,
"alnum_prop": 0.694620253164557,
"repo_name": "ryanaustincarlson/markovlunch",
"id": "51c846fb48ff7a6f9aaa8a9cf30ee96b2695e79f",
"size": "655",... |
import abc
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_log import versionutils
from cinder import exception
from cinder.i18n import _, _LI, _LW, _LE
from cinder import utils
from cinder.volume.targets import driver
from cinder.volume import utils as vutils
LOG = logging.ge... | {
"content_hash": "701ac89feacd056af7d9a3e311dc2d60",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 79,
"avg_line_length": 37.907960199004975,
"alnum_prop": 0.5794343460857012,
"repo_name": "potsmaster/cinder",
"id": "b37535a1b87eae0902809d72b270c4db506b2c4a",
"size": "1... |
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_tb7300 as sensorObj
def main():
## Exit handlers ##
# This function stops python from printing a stacktrace when you hit control-C
def SIGINTHandler(signum, frame):
raise SystemExit
# This function let... | {
"content_hash": "46b934f76c00eadfafae383888f54581",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 83,
"avg_line_length": 34.53846153846154,
"alnum_prop": 0.680029695619896,
"repo_name": "Propanu/upm",
"id": "10a8c404fb86b47840febf25e4c664948c4c6b43",
"size": "3857",
"... |
from .apitask import APITask
from thing.models import Station
class ConquerableStationList(APITask):
name = 'thing.conquerable_station_list'
def run(self, url, taskstate_id, apikey_id, zero):
if self.init(taskstate_id, apikey_id) is False:
return
# Fetch the API data
if ... | {
"content_hash": "b55a28da38b0fb65a5a3e785fcf97029",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 31.26530612244898,
"alnum_prop": 0.5496083550913838,
"repo_name": "madcowfred/evething",
"id": "69b57a7e62021bcd0999156cc7347970eabaee1a",
"size": "3... |
import numpy as np
import pandas as pd
import matplotlib as plt
# <codecell>
hair_eye_color = pd.read_csv("HairEyeColor.csv", index_col=0)
# <codecell>
pivoted = pd.pivot_table(hair_eye_color, values='Freq', rows=['Eye', 'Sex'], cols=['Hair'])
# <codecell>
hairSexSum = 1.0*pivoted.sum(axis=1)
# <codecell>
norma... | {
"content_hash": "56752e127fff8ea80344234670249c19",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 91,
"avg_line_length": 14.578947368421053,
"alnum_prop": 0.6859205776173285,
"repo_name": "timaeudg/CSSE490-DataMining",
"id": "6ea086d8c491f1d6bc5cda8f38108d1728f66e84",
"... |
import os
from socket import timeout as socket_timeout
import tempfile
import unittest
from django.urls import reverse
import mock
import six
from horizon import exceptions
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.images import utils
from openstack_dashboard.test import helper... | {
"content_hash": "28cd0849a38e2b4ace36f721ffdc3ee2",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 79,
"avg_line_length": 46.4949083503055,
"alnum_prop": 0.5492575233255946,
"repo_name": "NeCTAR-RC/horizon",
"id": "2768aeda4985457cfde70172706711a070f387e3",
"size": "236... |
from south.db import db
from django.db import models
class Migration:
depends_on = (
("cms", "0019_public_table_renames"),
)
def forwards(self, orm):
db.rename_table("snippet_snippetptr", "cmsplugin_snippetptr")
db.rename_table("snippet_publicsnippetptr", "cmsplugin_snippet... | {
"content_hash": "e6375ebdcd195e2b0eaa66312f87defd",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 188,
"avg_line_length": 71.65,
"alnum_prop": 0.5321503339647095,
"repo_name": "emencia/emencia-cms-snippet",
"id": "f7471e51e4e3206aeaff4ebd53a274c5094782ee",
"size": "100... |
"""
ffs.exceptions
Base and definitions for all exceptions raised by FFS
"""
class Error(Exception):
"Base Error class for FFS"
class DoesNotExistError(Error):
"Something should have been here"
class ExistsError(Error):
"Something already exisis"
class InappropriateError(Error):
"Someone did somethi... | {
"content_hash": "abbdeae429f41fa1dac69f6acd3d276f",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 73,
"avg_line_length": 25.323529411764707,
"alnum_prop": 0.7409988385598142,
"repo_name": "davidmiller/ffs",
"id": "0e440f74e488877d9fe23c442792b6143eb4cf18",
"size": "861"... |
import math
class EventRegistry(object):
Events = {}
MetaEvents = {}
def register_event(cls, event, bases):
if (Event in bases) or (NoteEvent in bases):
assert event.statusmsg not in cls.Events, \
"Event %s already registered" % event.name
cls.Ev... | {
"content_hash": "1bd9d8d916bb2af8c89f163bd65c538f",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 79,
"avg_line_length": 26.519021739130434,
"alnum_prop": 0.5993441951019571,
"repo_name": "anassinator/beethoven",
"id": "a62fbad4c64f0d583367c8aa5c93cd4b49a5e50b",
"size"... |
import os
import random
from django.urls import reverse
from django.test import TestCase
from silk.config import SilkyConfig
from silk.middleware import silky_reverse
from silk.views.sql_detail import SQLDetailView
from .test_lib.mock_suite import MockSuite
class TestViewSQLDetail(TestCase):
@classmethod
d... | {
"content_hash": "a20049dfcdb485e3e6f1bce235cc687e",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 126,
"avg_line_length": 45.327586206896555,
"alnum_prop": 0.5675161658425256,
"repo_name": "jazzband/silk",
"id": "5e6934fbed854afbeaf111c5b28c8dcb0af067e6",
"size": "2629"... |
from __future__ import print_function
from imblearn.under_sampling import RandomUnderSampler
from imblearn.over_sampling import SMOTE
from sklearn.model_selection import GroupShuffleSplit
from pyAudioAnalysis import audioBasicIO
from pyAudioAnalysis import MidTermFeatures as aF
import sys
import numpy as np
import os
i... | {
"content_hash": "d8cd5dd15fbbea5865703335cd7b0688",
"timestamp": "",
"source": "github",
"line_count": 1221,
"max_line_length": 134,
"avg_line_length": 40.417690417690416,
"alnum_prop": 0.5605876393110436,
"repo_name": "tyiannak/pyAudioAnalysis",
"id": "e55955bb2e93354d98409808208dddebe34e4d38",
"... |
import subprocess
def run(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
return p.communicate()
| {
"content_hash": "830a30b0e85d83d823012816ad0bc0c0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 89,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.7350993377483444,
"repo_name": "RevelSystems/revel-bootstrap",
"id": "214eedbda514c7bc3bd141a3ebbef5e54fdee7a8",
"... |
"""Custom neural network layers in model_zoo."""
__all__ = ['Concurrent', 'HybridConcurrent', 'Identity', 'SparseEmbedding',
'SyncBatchNorm']
import warnings
from .... import nd, test_utils
from ...block import HybridBlock, Block
from ...nn import Sequential, HybridSequential, BatchNorm
class Concurrent(Se... | {
"content_hash": "53f29d183e3f8eb41ca9123b3a71b7a8",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 100,
"avg_line_length": 41.059633027522935,
"alnum_prop": 0.6185901016646185,
"repo_name": "mbaijal/incubator-mxnet",
"id": "c656cd2d4e1d61d50116f0a1b3b078bc42cbcc5a",
"si... |
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts connection configuration... | {
"content_hash": "5037c44caeb61f6b15b24b979041d34f",
"timestamp": "",
"source": "github",
"line_count": 965,
"max_line_length": 126,
"avg_line_length": 28.163730569948186,
"alnum_prop": 0.6418426668629038,
"repo_name": "smallyear/linuxLearn",
"id": "df45a493a96c96f36017469af8450abfc7156330",
"size"... |
import argparse
import os
import platform
import re
import sys
import xml.etree.ElementTree as ET
from collections import OrderedDict
from typing import List, Dict, TextIO, Tuple, Optional, Any, Union
# Import hardcoded version information from version.py
root_directory = os.path.join(os.path.dirname(os.path.abspath(_... | {
"content_hash": "b4181f04abd3bd3e94849e12e53b3905",
"timestamp": "",
"source": "github",
"line_count": 1802,
"max_line_length": 170,
"avg_line_length": 38.18534961154273,
"alnum_prop": 0.522206074698445,
"repo_name": "ZuBsPaCe/godot",
"id": "cd7de085d8ece944811cdba935d36b009da81475",
"size": "6892... |
import RPi.GPIO as GPIO
import time
import pingLib
import blinkLib
import logging
import threading
import ConfigParser
## Log Config
logging.basicConfig(level=logging.DEBUG, #Change it for different log level (debug, info)
format='%(asctime)s :: %(levelname)-8s :: %(message)s',
datefmt='%a, %d %b %Y %H... | {
"content_hash": "300e104939318a2a5cc20cf6abc0bd7c",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 91,
"avg_line_length": 31.625,
"alnum_prop": 0.6758893280632411,
"repo_name": "drdada/rPYlab",
"id": "bb35fd74ad373dbe3edd9e1a7e833b3925d38225",
"size": "3820",
"binary"... |
class EnemyBase(object):
enemy = None # database record
def __init__(self, enemy):
self.enemy = enemy
def attack(self):
"""
:return: damage amount
"""
raise NotImplementedError
def hit(self, damage, damage_type):
"""
Called when player success... | {
"content_hash": "27558a833f119fc50591fd63e98db9bf",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 20.52777777777778,
"alnum_prop": 0.5683355886332883,
"repo_name": "ej2/pixelpuncher",
"id": "569502f6c2b15d4e5a256001a7f6d9a5b16af964",
"size": "740"... |
"""Custom exceptions used across the project."""
class CallFailure(Exception):
"""Exception raised when a Google Music server responds that a call failed.
Attributes:
callname -- name of the protocol.Call that failed
"""
def __init__(self, message, callname):
Exception.__init__(self, ... | {
"content_hash": "fd65dbe6f3bcd8c1cca08e02e24cd6d8",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 79,
"avg_line_length": 23.950819672131146,
"alnum_prop": 0.5975359342915811,
"repo_name": "simon-weber/Unofficial-Google-Music-API",
"id": "12fdccc6e4018ba2dd968a05b5e5032a56... |
from numpy import *
import operator
def createDataSet():
group=array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
labels=['A','A','B','B']
return group,labels
def classify0(inX,dataSet,labels,k):
dataSetSize=dataSet.shape[0]
diffMat=tile(inX,(dataSetSize,1))-dataSet
sqDiffMat=diffMat**2
sqDistanc... | {
"content_hash": "69cfb47bc3d447aecfc9e7a68084fc3f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 91,
"avg_line_length": 31.59090909090909,
"alnum_prop": 0.6906474820143885,
"repo_name": "lemonsoda/machinelearning",
"id": "4ff2813bd128e985e4a9a85d21df4accf0175b82",
"siz... |
from __future__ import absolute_import, unicode_literals
import os
import unittest
import django
from django.conf import settings
from django.test import TestCase
from wagtail.wagtailcore.models import Site
from .utils import get_test_image_file, Image
@unittest.skipIf(django.VERSION < (1, 8), 'Multiple engines o... | {
"content_hash": "79fff9a9c9a58a1f2be74b9f621f4d61",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 117,
"avg_line_length": 37.5,
"alnum_prop": 0.6133333333333333,
"repo_name": "serzans/wagtail",
"id": "fcddb20e02532c57d02b05e896955b4142116eff",
"size": "2475",
"binary"... |
'''
@author: Andreas Schiweck
'''
import email
import sys
import html2text
import tempfile
from email.header import decode_header
class Message(object):
"""
"""
def __init__(self):
"""
"""
msg = sys.stdin.read()
sys.stdin = open('/dev/tty')
self.raw = email.mes... | {
"content_hash": "bd5bd3c0361d3494d796ebcb2b4ce943",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 102,
"avg_line_length": 33.65217391304348,
"alnum_prop": 0.4974160206718346,
"repo_name": "aschiweck/mutt-atlassian",
"id": "6c1d4416696fb54b30cfb62eaef770e95afead39",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
import djangobmf.fields.file
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('djangobmf', '0002_remove_old_report'),
]
operations = [
migr... | {
"content_hash": "e9a91befbbb8997e9d4f58d415602335",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 171,
"avg_line_length": 59.391304347826086,
"alnum_prop": 0.5961444607125427,
"repo_name": "glomium/django-bmf",
"id": "b3fdb12f1789ad5f9ef85a76ea0b11b64d84fad6",
"size": "... |
"""Basic tests for TF-TensorRT integration."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.tensorrt.test import tf_trt_integration_test_base as trt_test
from tensorflow.python.framework import dtypes
from tensorflow.python.framew... | {
"content_hash": "353f5bfec8dfd128f20dc15a8113eb20",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 85,
"avg_line_length": 41.88405797101449,
"alnum_prop": 0.6288927335640139,
"repo_name": "alshedivat/tensorflow",
"id": "3cf7dadb1f472247250687a0879df431bd81ee94",
"size":... |
"""Classes to collect and publish performance samples to various sinks."""
import abc
import io
import itertools
import json
import logging
import operator
import sys
import time
import uuid
from perfkitbenchmarker import disk
from perfkitbenchmarker import events
from perfkitbenchmarker import flags
from perfkitbenc... | {
"content_hash": "5e5a8a9ae316984e2554bfe7d529bca3",
"timestamp": "",
"source": "github",
"line_count": 561,
"max_line_length": 80,
"avg_line_length": 36.30837789661319,
"alnum_prop": 0.649909175708184,
"repo_name": "mateusz-blaszkowski/PerfKitBenchmarker",
"id": "cf46ebd7a11256370548341574b33ee7dac2... |
from __future__ import absolute_import
from __future__ import print_function
import itertools
# This is a list of top common words sorted by decreasing frequency and was
# borrowed (and heavily modified) from http://norvig.com/ngrams/count_1w100k.txt
# as provided by Peter Norvig. Note that is mostly for English-only... | {
"content_hash": "df6e58ca168cbf9fa543ae4136757aa3",
"timestamp": "",
"source": "github",
"line_count": 9922,
"max_line_length": 127,
"avg_line_length": 7.622959080830478,
"alnum_prop": 0.8599457922919284,
"repo_name": "yasharmaster/scancode-toolkit",
"id": "5fd51b1d4c369a4024e50ed8a1fa75483efffb9b",... |
"""
Testing for the bagging ensemble module (sklearn.ensemble.bagging).
"""
# Author: Gilles Louppe
# License: BSD 3 clause
import numpy as np
import joblib
from sklearn.base import BaseEstimator
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sk... | {
"content_hash": "fdb450ac84d457872ea3d73129edbb62",
"timestamp": "",
"source": "github",
"line_count": 877,
"max_line_length": 92,
"avg_line_length": 38.26339794754846,
"alnum_prop": 0.5684655958518342,
"repo_name": "chrsrds/scikit-learn",
"id": "345ee90f1fe4916b4cb8d4c5117f001ebe395145",
"size": ... |
from __future__ import absolute_import, print_function, unicode_literals
import requests
import requests_futures.sessions
import logging
LOG = logging.getLogger('stackquery')
STACKALYTICS_URL = 'http://stackalytics.com/'
def get_stats(params):
"""Query Stackalytics 'contribution' module with `params`.
:pa... | {
"content_hash": "20a3984091e842d42630e8c22b9eb547",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 78,
"avg_line_length": 33.1063829787234,
"alnum_prop": 0.660025706940874,
"repo_name": "arxcruz/stackquery-cmd",
"id": "c497ab73a7047a7464d4c4cf75344713c890824b",
"size": "... |
import sys
import json
import argparse
from pprint import pformat
import jmespath
from jmespath import exceptions
def main():
parser = argparse.ArgumentParser()
parser.add_argument('expression')
parser.add_argument('-f', '--filename',
help=('The filename containing the input data.... | {
"content_hash": "8e14d81480e34fd99edc73e6cf527c83",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 31.826923076923077,
"alnum_prop": 0.5854984894259819,
"repo_name": "rest-of/the-deck",
"id": "2928b1c5fd46e0ef9d7fe9158570a65d061c479f",
"size": "172... |
import random
EMPTY = tuple()
NUM_PROJECTS = 1000
class Folder:
def __init__(self, id, children=None):
self.id = id
self.children = children or []
class Leaf:
def __init__(self, id):
self.id = id
@property
def children(self):
return EMPTY
class Sequence:
def... | {
"content_hash": "a198a514570e76971fc166eeb01a1d2a",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 108,
"avg_line_length": 21.76595744680851,
"alnum_prop": 0.5747800586510264,
"repo_name": "cbare/Etudes",
"id": "3a1483c3be9d8c283bfe2e809b05b53372a9642f",
"size": "1023",
... |
"""Hook for Google Cloud Firestore service"""
from __future__ import annotations
import time
from typing import Sequence
from googleapiclient.discovery import build, build_from_document
from airflow.exceptions import AirflowException
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
# Tim... | {
"content_hash": "db3505e0a9a974abb0435bc19da5c9b4",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 112,
"avg_line_length": 41.144,
"alnum_prop": 0.6391211355240132,
"repo_name": "apache/airflow",
"id": "ac873c56bf777ba4e575e3b7cbd275b80602518f",
"size": "5930",
"binar... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/attachment/weapon/shared_xwing_weapon2_neg_s01_1.iff"
result.attribute_template_id = 8
result.stfName("item_n","ship_attachment")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return ... | {
"content_hash": "583dfdb012c8443f9101e279b8402f07",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 94,
"avg_line_length": 25.076923076923077,
"alnum_prop": 0.7055214723926381,
"repo_name": "anhstudios/swganh",
"id": "1042efa1286d4447266b01d2aaa83565063a8fa2",
"size": "47... |
import pytest
import six
from humancrypto import yearutil, pwutil
from humancrypto.error import VerifyMismatchError, PasswordMatchesWrongYear
from humancrypto.error import InsecureLength
class PasswordHashingMixin(object):
def get_module(self):
raise NotImplementedError(
"You must implement ... | {
"content_hash": "3b9b426c080a937c8b3d93a14923ee7a",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 78,
"avg_line_length": 34.064516129032256,
"alnum_prop": 0.6167140151515151,
"repo_name": "iffy/humancrypto",
"id": "7e985ec7ff9f501cc883bd7b9f742e9c26ef8b26",
"size": "42... |
from django.core.exceptions import ImproperlyConfigured
from django import forms
from django.forms.extras import SelectDateWidget
from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import settings
from mezzanine.core.forms import SplitSelectDateTimeWidget
from mezzanine.utils.importing import ... | {
"content_hash": "b7612d216d780ead398098cc3adcbf71",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 76,
"avg_line_length": 31.203883495145632,
"alnum_prop": 0.6866832607342875,
"repo_name": "orlenko/sfpirg",
"id": "54975ae72fcd6c0313c6da0446b6e6530c4bc98f",
"size": "3215... |
"""Exit the current subshell, optionally with a specific status. If no
status is given, the default of 0 is used, indicating successful
execution with no errors.
"""
import argparse
import os
import sys
def main(args):
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("status", action="store", n... | {
"content_hash": "db78539f28e509069f4d12a96edf6778",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 27.38888888888889,
"alnum_prop": 0.6551724137931034,
"repo_name": "cclauss/stash",
"id": "6ad91ea83c2aa4aa2c3b0a674eae9d865f73fabc",
"size": "596",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.