text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Tests for database migrations. This test case reads the configuration
file /tests/unit/test_migrations.conf for database connection settings
to use in the tests. For each connection found in the config file,
the test case runs a series of test cases to ensure that migrations work
properly both upgrading and downgra... | {
"content_hash": "18c7f9fba3cc3eb737477a747caff318",
"timestamp": "",
"source": "github",
"line_count": 1324,
"max_line_length": 79,
"avg_line_length": 39.93882175226586,
"alnum_prop": 0.5244047731613684,
"repo_name": "tanglei528/glance",
"id": "7956c5a721870ec3aac319d2f82dea9abaeb10df",
"size": "5... |
from ._service_fabric_management_client import ServiceFabricManagementClient
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch im... | {
"content_hash": "a01bab34adbf7b5742b79d03cc1711b5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 82,
"avg_line_length": 26.38888888888889,
"alnum_prop": 0.6905263157894737,
"repo_name": "Azure/azure-sdk-for-python",
"id": "b4beea6828430a9d5cb94efb4689e785aaa72163",
"si... |
"""
Script to help run migrations every time the models are changed
"""
import os
import unittest
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from app import db, create_app
# coverage stuff
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.co... | {
"content_hash": "0239a596ddb399cc34fe94fbdac1dc86",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 72,
"avg_line_length": 23.31578947368421,
"alnum_prop": 0.6772009029345373,
"repo_name": "Tinitto/ShoppingListAPI",
"id": "239ba4e370f71176ee270f5c7d0c8857daa8f0ac",
"size"... |
"""Defines interface for DB access.
The underlying driver is loaded as a :class:`LazyPluggable`.
Functions in this module are imported into the nova.virt.baremetal.db
namespace. Call these functions from nova.virt.baremetal.db namespace, not
the nova.virt.baremetal.db.api namespace.
All functions in this module retu... | {
"content_hash": "5b181384c94136d58c030185868c3958",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 79,
"avg_line_length": 30.37888198757764,
"alnum_prop": 0.6689838478838683,
"repo_name": "fajoy/nova",
"id": "206a59b4f539e7d6aac0a56703fb554a407cec30",
"size": "5768",
... |
from __future__ import unicode_literals
import uuid
from random import randint, random
from moto.core import BaseBackend, BaseModel
from moto.ec2 import ec2_backends
from copy import copy
class BaseObject(BaseModel):
def camelCase(self, key):
words = []
for i, word in enumerate(key.split('_')):
... | {
"content_hash": "a9927a2b2df6fc8897aed9245a58e316",
"timestamp": "",
"source": "github",
"line_count": 604,
"max_line_length": 196,
"avg_line_length": 41.76655629139073,
"alnum_prop": 0.6150156578269315,
"repo_name": "gjtempleton/moto",
"id": "e5a2e9f96dc76866a125210af6502c2b78dd46fc",
"size": "25... |
"""Integration tests for Keras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.keras.python import keras
from tensorflow.contrib.keras.python.keras import testing_utils
from tensorflow.python.platform import t... | {
"content_hash": "9461519bb621eea2634d184deaf5366e",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 78,
"avg_line_length": 39.776315789473685,
"alnum_prop": 0.5866688719814753,
"repo_name": "taknevski/tensorflow-xsmm",
"id": "f42f81b286ed5216188cfafbe189100f7f78c59d",
"s... |
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.core.urlresolvers import reverse
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required
from artists.models import *
from artists.forms import *
from ... | {
"content_hash": "0a0c2427284369b30613b853bad5032b",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 78,
"avg_line_length": 24.816568047337277,
"alnum_prop": 0.5834525512637101,
"repo_name": "cnanders/test-cxro-tickets",
"id": "4842a788ef7fcfb93f8e7bb500a9675fbbf09bc4",
"... |
"""
Minimally improved noise for python. Pragmatic, minimal improved logging for python.
* Provides two separate log levels.
* One log level for dependencies and one for the application.
* Improved default format string.
"""
from __future__ import absolute_import
import logging
import sys
from . import version
__ti... | {
"content_hash": "25abc9c6bcf9ca866656d2cab7efb486",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 87,
"avg_line_length": 31.827956989247312,
"alnum_prop": 0.6557432432432433,
"repo_name": "jmatt/threepio",
"id": "f7d881c91d9a4491a7559bc4a522f4b7883727d2",
"size": "2960"... |
"""
Add first_answer_email_sent and first_l10n_email_sent fields to Profile.
"""
from __future__ import unicode_literals
from django.db import models, migrations
import kitsune.sumo.models # noqa
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20150430_1304'),
]
op... | {
"content_hash": "be12b65bfdedb192f3ccd96b26688256",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 115,
"avg_line_length": 30.103448275862068,
"alnum_prop": 0.6265750286368843,
"repo_name": "mozilla/kitsune",
"id": "7a2a5de96c3f034e871b916c8afd65e09e61f126",
"size": "897... |
import os.path
from django import forms
from django.contrib.admin.helpers import ActionForm
from django.utils.translation import gettext_lazy as _
class ImportForm(forms.Form):
import_file = forms.FileField(
label=_('File to import')
)
input_format = forms.ChoiceField(
label=_('Format... | {
"content_hash": "60bd9f2c992c9aafd852b42fbe02b9ef",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 74,
"avg_line_length": 29.36231884057971,
"alnum_prop": 0.6031589338598223,
"repo_name": "bmihelac/django-import-export",
"id": "76dbaf75178ae8b43ea753a77f8320bbab778311",
... |
'''
Created on 11.06.2015
@author: marscher
'''
import warnings
import unittest
import os
import sys
from pyemma.util.config import readConfiguration
from pyemma.util.files import TemporaryDirectory
class TestConfig(unittest.TestCase):
@unittest.skipIf(sys.platform == 'win32', 'unix based test')
def test_c... | {
"content_hash": "3ea6ba3801590f3bfb39c93c315b494b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 64,
"avg_line_length": 29.81159420289855,
"alnum_prop": 0.5911521633446767,
"repo_name": "arokem/PyEMMA",
"id": "fec1b758e63b80c2cafeebd6de368f4bf4aa3168",
"size": "2057",
... |
import logging
import pkg_resources
import six
from novaclient import exceptions
from novaclient import utils
logger = logging.getLogger(__name__)
_discovered_plugins = {}
def discover_auth_systems():
"""Discover the available auth-systems.
This won't take into account the old style auth-systems.
"... | {
"content_hash": "8a7c9c2daa8cd6b2547b875cae35c2c2",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 31.776119402985074,
"alnum_prop": 0.6378581493658995,
"repo_name": "guptaankita/python-novaclient",
"id": "d729c4d5af46c2200eb81f43f5e9d303948b56b3",
... |
"""Define RainMachine data models."""
from dataclasses import dataclass
from homeassistant.helpers.entity import EntityDescription
@dataclass
class RainMachineEntityDescriptionMixinApiCategory:
"""Define an entity description mixin to include an API category."""
api_category: str
@dataclass
class RainMach... | {
"content_hash": "40c24eb6c0c1d35084e3cfd754545bea",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 23.5625,
"alnum_prop": 0.7811671087533156,
"repo_name": "mezz64/home-assistant",
"id": "9ae99fe247ad9564bca2eb7bcc41b0d7256bc22a",
"size": "754",
"... |
import json
import time
from dcos import (cosmos, errors, package, packagemanager, subcommand)
from shakedown.dcos.service import *
import shakedown
def _get_options(options_file=None):
""" Read in options_file as JSON.
:param options_file: filename to return
:type options_file: str
:r... | {
"content_hash": "fb3a91cf8edab05e94a62d78b92e3259",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 122,
"avg_line_length": 34.28472222222222,
"alnum_prop": 0.6405374383903856,
"repo_name": "dcos/shakedown",
"id": "960cbdaa09694084a0a9f8fc18f7ca4d63945303",
"size": "1481... |
def read_map(example_file):
with open(example_file) as f:
raw_map = f.readlines()
num = int(raw_map.pop(0))
ans = int(raw_map.pop(0))
test_map = [line.strip() for line in raw_map]
return [list(line) for line in test_map if line], num, ans
| {
"content_hash": "0d5ac1244cdf18248711917d8eaa6913",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 59,
"avg_line_length": 35.142857142857146,
"alnum_prop": 0.6666666666666666,
"repo_name": "gaoyunzhi/pathery",
"id": "822231a98d6ec099825fc5d36fc00363f148ce9b",
"size": "246... |
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
# put package requirements here
requirements = [
'jmespath',
'python-box'
]
# Optional pack... | {
"content_hash": "bfd16b0159f2deb46649a3fd34353a23",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 83,
"avg_line_length": 25.575342465753426,
"alnum_prop": 0.629887520085699,
"repo_name": "xeor/taggo",
"id": "a2585ea53835d6325bf354353401f3023324ff48",
"size": "1914",
"... |
"""Interfaces for credentials."""
import abc
import six
from google.auth import _helpers
@six.add_metaclass(abc.ABCMeta)
class Credentials(object):
"""Base class for all credentials.
All credentials have a :attr:`token` that is used for authentication and
may also optionally set an :attr:`expiry` to i... | {
"content_hash": "fd55e5fa8d7b32785c5113e2ede8fe97",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 84,
"avg_line_length": 35.601190476190474,
"alnum_prop": 0.658752716936967,
"repo_name": "javier-ruiz-b/docker-rasppi-images",
"id": "bc42546b9a0615984d2648dd7e61fb191efbc13... |
scope = "Private Program"
description = """
User with authorization to peform administrative tasks such as associating
users to roles within the scope of of a program.<br/><br/>When a person
creates a program they are automatically given the ProgramOwner role. This
allows them to Edit, Delete, or Map objects to... | {
"content_hash": "0916cc9d6594b5e13cf2d1ed99338cac",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 76,
"avg_line_length": 25.70212765957447,
"alnum_prop": 0.570364238410596,
"repo_name": "uskudnik/ggrc-core",
"id": "df7d7c6bd67ed51a624d55758063678717e256da",
"size": "120... |
from runner.koan import *
class AboutListAssignments(Koan):
def test_non_parallel_assignment(self):
names = ["John", "Smith"]
self.assertEqual(["John", "Smith"], names)
def test_parallel_assignments(self):
first_name, last_name = ["John", "Smith"]
self.assertEqual("Joh... | {
"content_hash": "767daf00478eca417b1a66b6034374b1",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 62,
"avg_line_length": 37.166666666666664,
"alnum_prop": 0.5885650224215246,
"repo_name": "bmcorser/python_koans",
"id": "b0b80615eabe2e98783805d2e325e2255c08c6bf",
"size":... |
from . import Operation, INestedOperation, ONestedOperation, NestedOperation
class NestedOp(Operation): # Risolutore e contenitore di operazioni multiple (per ora protocollo RegKey)
def __init__(self, oplist):
self._oplist = oplist
def RefLastOp(self):
return self._oplist[-1]
def PreCom... | {
"content_hash": "0b50e9b48a14c940997ab70f206c7443",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 105,
"avg_line_length": 30.87037037037037,
"alnum_prop": 0.5776844631073785,
"repo_name": "eisterman/MurPy",
"id": "839cf546babd3a8911db91d10cb2ff3d26832573",
"size": "1667... |
"""Integration tests for gsutil -D option."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import platform
import re
import six
import gslib
from gslib.cs_api_map import ApiSelector
import gslib.tests.testcase as ... | {
"content_hash": "6302d6dc0fb019a9087cc0c01037c75f",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 80,
"avg_line_length": 45.027027027027025,
"alnum_prop": 0.6384153661464586,
"repo_name": "catapult-project/catapult",
"id": "0fef3e8c800e347aa0e792e35bab91ee06324339",
"s... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
... | {
"content_hash": "5d7fc0768ba81a1440bcebddfb70124f",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 106,
"avg_line_length": 59.40689655172414,
"alnum_prop": 0.700139308103088,
"repo_name": "earlideal/jiandan",
"id": "b39bcc135d30b5f53836ed4f86828c349a3c4272",
"size": "89... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError, HTTPError
def download(url, outfname):
"""
Downl... | {
"content_hash": "afb0e9424f30d3093a3f957b7e87336c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 55,
"avg_line_length": 26.72,
"alnum_prop": 0.6377245508982036,
"repo_name": "HazyResearch/snorkel",
"id": "81547e5553b4e75c7c2339fd0ba983e93023c393",
"size": "668",
"bin... |
import pytest
@pytest.mark.plugin('jobs')
def testConstantsIsDefined(server):
from girder.plugins.jobs import constants
assert constants.JobStatus.isValid(constants.JobStatus.SUCCESS) is True
| {
"content_hash": "1e236413e5db8d2894d6ad0b5ce6b709",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 75,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.7970297029702971,
"repo_name": "data-exp-lab/girder",
"id": "efab5b137a0ac404c893cb2ab811f27175a3999c",
"size": "9... |
from __future__ import unicode_literals
import frappe
import HTMLParser
import smtplib
from frappe import msgprint, throw, _
from frappe.email.smtp import SMTPServer, get_outgoing_email_account
from frappe.email.email_body import get_email, get_formatted_html
from frappe.utils.verified_command import get_signed_params,... | {
"content_hash": "733dcc256252a107b3c84fdf4d5dca94",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 166,
"avg_line_length": 35.61904761904762,
"alnum_prop": 0.7293616310160428,
"repo_name": "anandpdoshi/frappe",
"id": "e4ca335098ed6ad8b5b0c9d07b3336ee97444835",
"size": "... |
import ast
import re
import pep8
"""
Guidelines for writing new hacking checks
- Use only for Nova specific tests. OpenStack general tests
should be submitted to the common 'hacking' module.
- Pick numbers in the range N3xx. Find the current test with
the highest allocated number and then pick the next value... | {
"content_hash": "0ddc8cbde5658dd614ac7fa6718cba27",
"timestamp": "",
"source": "github",
"line_count": 704,
"max_line_length": 79,
"avg_line_length": 36.86079545454545,
"alnum_prop": 0.6252793834296725,
"repo_name": "dims/nova",
"id": "6a0ab2fbdc5db645c6caea2068ab725f1e68cfe5",
"size": "26556",
... |
import os
import util.dict_utils as du
dataset_names = [
'rgbd_dataset_freiburg1_xyz',
'rgbd_dataset_freiburg1_rpy',
'rgbd_dataset_freiburg2_xyz',
'rgbd_dataset_freiburg2_rpy',
'rgbd_dataset_freiburg1_360',
'rgbd_dataset_freiburg1_floor',
'rgbd_dataset_freiburg1_desk',
'rgbd_dataset_fr... | {
"content_hash": "7cd4922f414a7f2c0126bf8f828d7054",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 119,
"avg_line_length": 37.44274809160305,
"alnum_prop": 0.6389398572884811,
"repo_name": "jskinn/robot-vision-experiment-framework",
"id": "8bd032dc5ce0a0be33118920113a66c5... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('myapp', '0008_auto_20150701_1012'),
]
operations = [
migrations.AlterField(
model_name='value',
name='timestamp',
... | {
"content_hash": "4ab1aad3be8e41e15f252743f2387fec",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 45,
"avg_line_length": 21.263157894736842,
"alnum_prop": 0.5816831683168316,
"repo_name": "mpetyx/energagement",
"id": "2f8c1b23c4ccfd6ebb7534b95aa2bdc532eeb10b",
"size": "... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
from __future__ import unicode_literals
import hashlib
import logging
import re
import random
from django.conf import settings
from django.core.urlresolvers import g... | {
"content_hash": "2a2416c2458ecd56e7b933a41ee42500",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 80,
"avg_line_length": 40.77625570776256,
"alnum_prop": 0.5764837625979843,
"repo_name": "mammique/django",
"id": "423034478b4cb00bd4a882395e6fc486b38d6d17",
"size": "8930... |
from ....testing import assert_equal
from ..preprocess import Bandpass
def test_Bandpass_inputs():
input_map = dict(args=dict(argstr='%s',
),
automask=dict(argstr='-automask',
),
blur=dict(argstr='-blur %f',
),
despike=dict(argstr='-despike',
),
environ=dict(nohash=True,
usedef... | {
"content_hash": "5f8f16f4acca5ebcb0e76a68e0828245",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 23.56578947368421,
"alnum_prop": 0.5901730876605249,
"repo_name": "carolFrohlich/nipype",
"id": "519d8fd501afd5f32af6c95c42a805425728147e",
"size": "... |
'''
Linode Cloud Module using Linode's REST API
===========================================
The Linode cloud module is used to control access to the Linode VPS system.
Use of this module only requires the ``apikey`` parameter. However, the default root password for new instances
also needs to be set. The password nee... | {
"content_hash": "9a74587190c167368a9e0b42c366e917",
"timestamp": "",
"source": "github",
"line_count": 1671,
"max_line_length": 111,
"avg_line_length": 26.590664272890486,
"alnum_prop": 0.5654355996669143,
"repo_name": "stephane-martin/salt-debian-packaging",
"id": "df77c62f6ccd0d094abaab5a3c30d1389... |
from lxml import etree
class elements:
def __init__(self):
pass
def strip_empty_elements(self, doc):
"""Remove empty elements from the document.
Solr date fields don't like to be empty - hence why this
method exists. As it turns out, it can't hurt to ditch empty
elemen... | {
"content_hash": "21b7ee41b2993e13806f4f033537271b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 68,
"avg_line_length": 27.6,
"alnum_prop": 0.5778985507246377,
"repo_name": "MLR-au/esrc-indexer",
"id": "94af1c5bf988c956688644191ee7e506d3dac7e6",
"size": "1923",
"bina... |
from lxml import etree
from oslo.serialization import jsonutils
import webob
from nova.compute import flavors
from nova import test
from nova.tests.api.openstack import fakes
FAKE_FLAVORS = {
'flavor 1': {
"flavorid": '1',
"name": 'flavor 1',
"memory_mb": '256',
"root_gb": '10',
... | {
"content_hash": "a4bb243fd21f19b9f893afa403147dc2",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 78,
"avg_line_length": 28.353982300884955,
"alnum_prop": 0.5749063670411985,
"repo_name": "maelnor/nova",
"id": "9b4a06cc1496584af575e3aded6a39c643cc5939",
"size": "3809",... |
from distutils.core import setup
setup(
name = 'dnsdiff',
packages = ['dnsdiff'], # this must be the same as the name above
scripts=['dnsdiff/dnsdiff'],
version = '1.3',
description = 'Utility to quickly suss out discrepancies between nameservers',
author = 'M Anzuoni',
author_email = '[email protected]... | {
"content_hash": "865c7e05050134e00a4035fcf44c3c49",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 109,
"avg_line_length": 39.1875,
"alnum_prop": 0.6953748006379585,
"repo_name": "gawkermedia/dnsdiff",
"id": "1559d0060273b010bec6a35fdb4da7d7e5555f92",
"size": "627",
"b... |
"""Tests for tensorflow.python.client.session.Session."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import random
import os
import sys
import threading
import time
import warnings
import numpy as np
import six
from six.moves import ... | {
"content_hash": "05ade63c100ba4ee81f1ceb1ef5eb847",
"timestamp": "",
"source": "github",
"line_count": 2030,
"max_line_length": 92,
"avg_line_length": 39.214778325123156,
"alnum_prop": 0.6252669396779137,
"repo_name": "hfp/tensorflow-xsmm",
"id": "c4a118a41406afc52586553b1d3f0b446005c46d",
"size":... |
"""Posterior/Prior predictive plot."""
import logging
import warnings
from numbers import Integral
import numpy as np
from ..labels import BaseLabeller
from ..sel_utils import xarray_var_iter
from ..rcparams import rcParams
from ..utils import _var_names
from .plot_utils import default_grid, filter_plotters_list, get... | {
"content_hash": "265b3c6848c8197948798ec38b52967e",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 100,
"avg_line_length": 37.574585635359114,
"alnum_prop": 0.6432877518012057,
"repo_name": "arviz-devs/arviz",
"id": "18480edbe747e78d7200cef14fbb326db6bb7613",
"size": "1... |
'''Package info module
'''
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
with_statement,
)
import os
__author__ = 'soutys <[email protected]>'
__version__ = open(
os.path.join(os.path.dirname(__file__), 'VERSION'), 'r').read().strip()
# https://pypi.py... | {
"content_hash": "c26bb8c6d9c1c03fbada4be4e9a25296",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 75,
"avg_line_length": 30.977777777777778,
"alnum_prop": 0.6219512195121951,
"repo_name": "soutys/metricol",
"id": "743646168a03f7eb21f022b94c8a2e3272282c28",
"size": "1419... |
from operator import not_
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from pygments import highlight
from pygments.util import ClassNotFound
from pygments.lexers import get_lexer_by_name, guess_lexer, TextLexer
from pygments.formatters import HtmlFormatter
class CodeHighlight(Dir... | {
"content_hash": "87906bf9198ef984cb0755d2d8fe27bd",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 77,
"avg_line_length": 28.67142857142857,
"alnum_prop": 0.6163428001993024,
"repo_name": "indexofire/feincms-markup",
"id": "f001822895334f65487a107406ad48fcc7aef712",
"siz... |
from telemetry.page import page
from telemetry.page import shared_page_state
from telemetry import story
class PluginPowerSaverPageSet(story.StorySet):
def __init__(self):
super(PluginPowerSaverPageSet, self).__init__(
archive_data_file='data/plugin_power_saver.json',
cloud_storage_bucket=story.... | {
"content_hash": "f21917b7f7f5d5aced357ea82fdeda53",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 36.5,
"alnum_prop": 0.7201565557729941,
"repo_name": "hujiajie/chromium-crosswalk",
"id": "ec3e6faa5c2edd554792cf770abeda8ddc53d646",
"size": "673",
... |
from __future__ import absolute_import, unicode_literals
import os
import platform
import shutil
import tempfile
import unittest
import pykka
from mopidy import core
from mopidy.internal import deprecation
from mopidy.m3u.backend import M3UBackend
from mopidy.models import Playlist, Track
from tests import dummy_au... | {
"content_hash": "5f692efa5a6c0baede7cd5dabb1ae5ba",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 79,
"avg_line_length": 39.333333333333336,
"alnum_prop": 0.651439988976161,
"repo_name": "vrs01/mopidy",
"id": "e0ea1ce473948aa4a746fbcba8db79c7f74cd05a",
"size": "14536",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0013_auto_20150204_1642'),
]
operations = [
migrations.AlterField(
model_name='card',
name='hp',
field=mo... | {
"content_hash": "6897262ce6ff6d145e062456bbe5b3f8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 57,
"avg_line_length": 21.57894736842105,
"alnum_prop": 0.5853658536585366,
"repo_name": "SchoolIdolTomodachi/SchoolIdolAPI",
"id": "ec76bf85757ab001f4eaf0f9655b65bcf8a31ddf"... |
from __future__ import unicode_literals
import unittest
import hello_world
class HelloWorldTests(unittest.TestCase):
def test_hello_without_name(self):
self.assertEqual(
'Hello, World!',
hello_world.hello()
)
def test_hello_with_sample_name(self):
self.assert... | {
"content_hash": "fb817ac22d58f6ebe3674d44f9a31147",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 48,
"avg_line_length": 22.106382978723403,
"alnum_prop": 0.534167468719923,
"repo_name": "christopher-demarco/exercism-exercises",
"id": "7fc4a4cf79ca78e62a6291345f3a0930c861... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "32ca53a8fc41cedf5f728f8d4d930dd5",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 114,
"avg_line_length": 36.81967213114754,
"alnum_prop": 0.7424309884238647,
"repo_name": "sekikn/ambari",
"id": "c27f79bbcd93afa9b7d224aab8d5739a8fb2dd49",
"size": "4514"... |
"""
PyChromecast: remote control your Chromecast
"""
from __future__ import print_function
import logging
import fnmatch
# pylint: disable=wildcard-import
import threading
from .config import * # noqa
from .error import * # noqa
from . import socket_client
from .discovery import discover_chromecasts
from .dial impo... | {
"content_hash": "fda225ecf1734d34df2eef7aa247055b",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 77,
"avg_line_length": 34.367924528301884,
"alnum_prop": 0.6331777838777565,
"repo_name": "kongseokhwan/kulcloud-prism-chromecast-agent",
"id": "c22f34f0a1c1d415d24ffd056aa0... |
"""
Django settings for actio_control project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_literals
import envi... | {
"content_hash": "5629fac629a12eaa712dce00e42aa111",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 103,
"avg_line_length": 35.888429752066116,
"alnum_prop": 0.6078295912492804,
"repo_name": "betobaz/django_docker",
"id": "4e996d4ac0037af7612845859f9d3eb98e8f58e3",
"size... |
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from .models import UrlconfRevision
class UrlconfAdmin(admin.ModelAdmin):
list_display = (
'revision',
)
admin.site.register(UrlconfRevision, UrlconfAdmin)
| {
"content_hash": "0271315a3c2bb04a732f8442b2e4d1e4",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 56,
"avg_line_length": 19.142857142857142,
"alnum_prop": 0.7425373134328358,
"repo_name": "aldryn/aldryn-apphook-reload",
"id": "da43ccab5d7aa09fe94a1101402f683e7b947824",
... |
import warnings
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import gapic_v1
from google.api_core import grpc_helpers_async
from google.api_core import operations_v1
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.g... | {
"content_hash": "827981a7eb89b9a2b97941d3a99a3b29",
"timestamp": "",
"source": "github",
"line_count": 877,
"max_line_length": 104,
"avg_line_length": 44.14025085518814,
"alnum_prop": 0.6228462194208364,
"repo_name": "googleapis/python-aiplatform",
"id": "2b458b2d3d8051abff952ddc1bab8437273de003",
... |
"""
.. _tut_preprocessing_ica:
Compute ICA on MEG data and remove artifacts
============================================
ICA is fit to MEG raw data.
The sources matching the ECG and EOG are automatically found and displayed.
Subsequently, artifact detection and rejection quality are assessed.
"""
# Authors: Denis Eng... | {
"content_hash": "9dbf0eaad648bd83d312cb9deb3fe241",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 35.25,
"alnum_prop": 0.6411872865773575,
"repo_name": "jmontoyam/mne-python",
"id": "4b466ad2e987dc8bdafb5db487ffc8a4f134842a",
"size": "3807",
"b... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.payload import Payload
from pants.base.payload_field import PayloadField, PrimitiveField, combine_hashes, stable_json_sha1
from pants.build_graph.targe... | {
"content_hash": "64e8267cf5e5fe0b16f1a00317621039",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 99,
"avg_line_length": 35.029411764705884,
"alnum_prop": 0.6400083963056256,
"repo_name": "fkorotkov/pants",
"id": "193380bff5573c867ddf532aea244e5fbf59a95c",
"size": "491... |
import logging
import os
import subprocess
import time
from pathlib import Path
from pkg_resources import resource_filename
from mapdamage.version import __version__
def misincorporation_plot(options):
folder = options.folder.absolute()
fmut = folder / "misincorporation.txt"
fcomp = folder / "dnacomp.tx... | {
"content_hash": "e708df53dee917973c23fc3dfadb9c53",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 87,
"avg_line_length": 29.5625,
"alnum_prop": 0.6295513272257458,
"repo_name": "ginolhac/mapDamage",
"id": "d8b931a4b8f203cd4e0771b9ba557517a3d22069",
"size": "4257",
"b... |
from datetime import datetime
from mongoengine import (connect, Document, StringField,
IntField, DateTimeField, ListField)
from dateutil.relativedelta import relativedelta
connect('another-one')
class OneIssue(Document):
issue_number = IntField()
create_time = DateTim... | {
"content_hash": "312a95782db43f9ca55528dd49192d90",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 81,
"avg_line_length": 33.41379310344828,
"alnum_prop": 0.6470588235294118,
"repo_name": "zhy0216/another-one",
"id": "61f1395fe9bc0e5eac3f95806d2762041a29c21d",
"size": "9... |
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-code... | {
"content_hash": "0ecb76c941ee2f473d2345b70a09e2ed",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 186,
"avg_line_length": 24.8,
"alnum_prop": 0.7227822580645161,
"repo_name": "iEngage/python-sdk",
"id": "3394235d98ad21dc0231283387f91e04ee345e09",
"size": "1009",
"bina... |
"""
Recursive algorithm:
Keep finding the leftmost node, make it upside down and
then make its parent to be its rightmost subtree recursively.
GOTCHA: at the last step when you are making original root to be the right node
of the new tree make sure to create another node instead of copying.
"""
class Solution(object)... | {
"content_hash": "1e018298cbe91b5c2644c8922aeec6c8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 91,
"avg_line_length": 35.15384615384615,
"alnum_prop": 0.661925601750547,
"repo_name": "young-geng/leet_code",
"id": "4993e2d5d4531075cbed6024a686f0ded1b4e7a9",
"size": "1... |
try:
import cPickle as pickle
except:
import pickle
from webhelpers.feedgenerator import Rss201rev2Feed as Feed
from datetime import datetime
import logging
import cgi
class Item(object):
def __init__(self, t, l, a, d):
self.title = t
self.link = l
self.author_name = a
self... | {
"content_hash": "7383c8fe282bac847f743e79f00d855f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 115,
"avg_line_length": 29.441860465116278,
"alnum_prop": 0.5813586097946287,
"repo_name": "renemilk/gitnotifs",
"id": "836d6c72e4c1994ac34adb26b224c5a2f61bfc13",
"size": "... |
import json
import threading
import time
import uuid
from pika import BasicProperties
from pika.exceptions import ConnectionClosed, ChannelClosed
from ...helper import fill_in_the_blank, log
from .consumer import Consumer
from .exception import NoConnectionError, SubscriptionNotAllowedError
from .helper ... | {
"content_hash": "bb8c6cc509b9842f29813837efd92ddb",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 165,
"avg_line_length": 45.527272727272724,
"alnum_prop": 0.5917959835691465,
"repo_name": "shiroyuki/vireo",
"id": "a44ecf44cfa210d44940c9689f66f8f476ce2b70",
"size": "17... |
import inspect
import os
import subprocess
import socket
import sys
import time
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in... | {
"content_hash": "412f3d3ba0745a52bff994435596959b",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 129,
"avg_line_length": 27.054545454545455,
"alnum_prop": 0.6854838709677419,
"repo_name": "krattai/noo-ebs",
"id": "8860c03620b698eb94605ce69bc5574c896811e4",
"size": "159... |
from zope.interface import Interface, Attribute
class ICommand(Interface):
"""
Generic Renamer command.
"""
name = Attribute("""
Command name.
""")
description = Attribute("""
Brief description of the command.
""")
def process(renamer, options):
"""
Called ... | {
"content_hash": "31469b0c34e92389baa2fb358317d604",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 19.602409638554217,
"alnum_prop": 0.594960049170252,
"repo_name": "jonathanj/renamer",
"id": "22e32b7b93d201bdd433d4724afc04be81d0f2cd",
"size": "162... |
import copy
import pytest
@pytest.mark.parametrize('model', [('kmeans_pca_topic_model'),
('base_topic_model'),
('custom_topic_model')])
def test_term_rank(model, request):
topic_model = copy.deepcopy(request.getfixturevalue(model))
fig = to... | {
"content_hash": "4ba24d2d57fd7e6e6906d597b05116cd",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 94,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.5915178571428571,
"repo_name": "MaartenGr/BERTopic",
"id": "6799efb25ebd33f36f49a7e5c8f3156b1811de22",
"size": "4... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('cosmopolitan', '0002_auto_20160128_1936'),
]
operations = [
migrations.CreateModel(
name='Pos... | {
"content_hash": "178dd6d9fadf49873c5133a03e930faa",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 103,
"avg_line_length": 36.68,
"alnum_prop": 0.604143947655398,
"repo_name": "openspending/cosmopolitan",
"id": "42034994c51f05a3187f5589c51c68c25d5527db",
"size": "941",
... |
"""
Perm Store
author: Kevin Jamieson, [email protected]
last updated: 12/31/2014
Persistent storage solution. Database hierarchy is organized as: ::\n
PermStore[database_id][bucket_id][doc_uid] = {key1:value1,key2:value2,...}
Dependencies: next.constants to determine location of mongoDB server
Some com... | {
"content_hash": "a2300deed553772a2f91999d8606fdbb",
"timestamp": "",
"source": "github",
"line_count": 823,
"max_line_length": 445,
"avg_line_length": 35.24908869987849,
"alnum_prop": 0.5640813512581868,
"repo_name": "lalitkumarj/NEXT-psych",
"id": "cad5a684fa88bc010501b8d3136204d10aadceba",
"size... |
from typing import List
from PyQt5.QtMultimedia import (QVideoFrame, QAbstractVideoBuffer, QAbstractVideoSurface,
QVideoSurfaceFormat)
from PyQt5.QtGui import QImage
from PyQt5.QtCore import QObject, pyqtSignal
from electrum_ltc.i18n import _
from electrum_ltc.logging import get_logger... | {
"content_hash": "ad06256ad79168ae3348acd244316678",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 115,
"avg_line_length": 37.57575757575758,
"alnum_prop": 0.6560483870967742,
"repo_name": "pooler/electrum-ltc",
"id": "7d2b00685d90585e354a859b923014b8622e2974",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('let_me_app', '0019_court_name'),
]
operations = [
migrations.AlterField(
model_name='bookingpolicy',
name='price',
... | {
"content_hash": "24cfc12570b4d660c457c65cedf4a2c1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 104,
"avg_line_length": 28.17391304347826,
"alnum_prop": 0.6049382716049383,
"repo_name": "oleg-chubin/let_me_play",
"id": "49f0ff996a9baaf28108c4b4b4e5592b23d196fd",
"size... |
"""SCons.Action
This encapsulates information about executing any sort of action that
can build one or more target Nodes (typically files) from one or more
source Nodes (also typically files) given a specific Environment.
The base class here is ActionBase. The base class supplies just a few
OO utility methods and so... | {
"content_hash": "ad4c2c6d01ffe5a6b2a1cd0efa199436",
"timestamp": "",
"source": "github",
"line_count": 1240,
"max_line_length": 153,
"avg_line_length": 37.93709677419355,
"alnum_prop": 0.588006462310276,
"repo_name": "BenLand100/rat-pac",
"id": "953519460dee4b227f3352d3a9ceae9daeded398",
"size": "... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/item/shared_item_place_setting_01.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "b89f40f9784a0a91cb8f48694a388c8d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 23.153846153846153,
"alnum_prop": 0.6877076411960132,
"repo_name": "anhstudios/swganh",
"id": "5c4985dc8f41de9e90af257f1a563a21eb203679",
"size": "44... |
"""
A function analysis module to detect and properly mark
microsoft hotpatch pads...
"""
import vivisect
def analyzeFunction(vw, funcva):
offset, bytes = vw.getByteDef(funcva)
ob = ord(bytes[offset-1])
if ob not in [0x90, 0xcc]:
return
count = 1
newb = ord(bytes[offset-count])
while... | {
"content_hash": "cb368806f2648ec32a39cb51d11c30dd",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 54,
"avg_line_length": 19.576923076923077,
"alnum_prop": 0.6051080550098232,
"repo_name": "imjonsnooow/vivisect",
"id": "a42f765cb1df9c0e305c1a1814b4c5b47f7017ad",
"size": ... |
from ._models_py3 import Actor
from ._models_py3 import CallbackConfig
from ._models_py3 import EncryptionProperty
from ._models_py3 import Event
from ._models_py3 import EventContent
from ._models_py3 import EventInfo
from ._models_py3 import EventListResult
from ._models_py3 import EventRequestMessage
from ._models_p... | {
"content_hash": "75cf6ee2af3ce001544250584debeab4",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 64,
"avg_line_length": 31.6555023923445,
"alnum_prop": 0.7707073760580411,
"repo_name": "Azure/azure-sdk-for-python",
"id": "103eeff5f15a199d29badeb850b367b22011ccb8",
"si... |
import pytest, tempfile, os.path
import helper
import biobox_cli.command.run as biobox
def create_args(output):
return ["run",
"short_read_assembler",
"bioboxes/velvet",
"--input={}".format(helper.verification_file('short_read_assembler/genome_paired_reads.fq.gz')),
... | {
"content_hash": "832495f43e700209ca5c239c55367b6d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 108,
"avg_line_length": 31.833333333333332,
"alnum_prop": 0.6335078534031413,
"repo_name": "michaelbarton/command-line-interface",
"id": "631719aa8b512ca4eaa3e862385cd9e05e48... |
import collections
from . import accessors, iterables
def is_ordered(container):
return isinstance(container, (collections.Sequence, collections.OrderedDict))
def iterkeys(container):
def _iterkeys(container):
if isinstance(container, collections.Sequence):
return iter(range(len(contain... | {
"content_hash": "b4a2e131fd480ef892f5809c20c0a335",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 81,
"avg_line_length": 28.928571428571427,
"alnum_prop": 0.7018518518518518,
"repo_name": "filonik/encore",
"id": "d50761d110997b68db94d6616b7b48d0b4fe7640",
"size": "1620"... |
import argparse
import os
import logging
from common import modelzoo
import mxnet as mx
from mxnet.contrib.quantization import *
def download_calib_dataset(dataset_url, calib_dataset, logger=None):
if logger is not None:
logger.info('Downloading calibration dataset from %s to %s' % (dataset_url, calib_dat... | {
"content_hash": "ae5bb57bda9123d62289a86a09f894ed",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 130,
"avg_line_length": 53.311557788944725,
"alnum_prop": 0.5564143651616552,
"repo_name": "mbaijal/incubator-mxnet",
"id": "8a2818c4bca0b0326fa781688fd52b92e869895e",
"si... |
from django.contrib import admin
from event.models import Event
class EventArtistsInline(admin.TabularInline):
model = Event.artists.through
verbose_name_plural = 'Artists'
extra = 1
class EventInline(admin.StackedInline):
model = Event
extra = 1
class EventAdmin(admin.ModelAdmin):
inline... | {
"content_hash": "1d31414cf4471efcf14874b8d9ac31e7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 52,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6884328358208955,
"repo_name": "FedorSelitsky/eventrack",
"id": "72f1eb80106cbf5bb10fef69c121d903a7a2dd83",
"size... |
from django.conf import settings
from django.contrib import messages
from django.db.models import Q
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django.views.generic import (
DeleteView, DetailView, FormView, ListView, UpdateView)
... | {
"content_hash": "9a7bf34e94cf099eb18cb5f476b33221",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 78,
"avg_line_length": 34.98268398268398,
"alnum_prop": 0.6120529637421112,
"repo_name": "solarissmoke/django-oscar",
"id": "8518be17df27654729330f828b88cecfab62deb5",
"si... |
"""Guard and reader functions for dealing with device CSV"""
from device_resolutions.util import find_lowest, as_float
def DeviceRow((model, width_dp, height_dp, width_px, height_px, screen_in, is_touch)):
"""Guard/validation function for device rows"""
return (
str(model),
as_float(width_dp),
... | {
"content_hash": "e85a313e2fd1b58fc4f14f6d043fd9d3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 86,
"avg_line_length": 17.523809523809526,
"alnum_prop": 0.6141304347826086,
"repo_name": "gordonbrander/device_resolutions",
"id": "d4cc8b834192c3b83550d1d17d141e5327a6ff4a"... |
from __future__ import absolute_import, print_function, unicode_literals, division
from time import sleep
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# Thi... | {
"content_hash": "b34d8769e71c386afe80b076ed6c554b",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 121,
"avg_line_length": 37.46078431372549,
"alnum_prop": 0.6346506150222455,
"repo_name": "ISISComputingGroup/EPICS-inst_servers",
"id": "bb0a2142a15ac5c6ddab6178e1e0117e7d8... |
"""Wrappers for protocol buffer enum types."""
import enum
class RecognitionConfig(object):
class AudioEncoding(enum.IntEnum):
"""
The encoding of the audio data sent in the request.
All encodings support only 1 channel (mono) audio, unless the
``audio_channel_count`` and ``enabl... | {
"content_hash": "e93bc93e3982d29a7bcbb806fc3401be",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 116,
"avg_line_length": 46.166666666666664,
"alnum_prop": 0.6469314079422382,
"repo_name": "tseaver/google-cloud-python",
"id": "aff388c7d8dba79e6bf01469e925b2aac9f9c66e",
... |
"""Test Wallet encryption"""
import time
from test_framework.test_framework import DigiByteTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
assert_greater_than,
assert_greater_than_or_equal,
)
class WalletEncryptionTest(DigiByteTestFramework):
def set_test_pa... | {
"content_hash": "120733d9d324fe4f274bf9c401808128",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 138,
"avg_line_length": 42.70886075949367,
"alnum_prop": 0.6760521636040309,
"repo_name": "aurarad/auroracoin",
"id": "8b4f21a2cd646dadf46cf3958fe563e680b6ba57",
"size": "3... |
class EventContext(object):
__slots__ = [
"current_state_ids",
"prev_state_ids",
"state_group",
"rejected",
"push_actions",
"prev_group",
"delta_ids",
"prev_state_events",
]
def __init__(self):
# The current state including the current... | {
"content_hash": "30b18e9c56f22ef45816c1e87d008335",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 69,
"avg_line_length": 26.678571428571427,
"alnum_prop": 0.5568942436412316,
"repo_name": "TribeMedia/synapse",
"id": "11605b34a38deea4315c5894ef58763f880bc9a1",
"size": "1... |
from django import template
register = template.Library()
@register.filter
def class_name(value):
return value.__class__.__name__
| {
"content_hash": "0b44c23516fc0486cfb4c50d03951343",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 35,
"avg_line_length": 15.333333333333334,
"alnum_prop": 0.7101449275362319,
"repo_name": "RegioHelden/django-datawatch",
"id": "b0652ccdde88e4fc882d8f460d0371be19cc7630",
"... |
from kivy import platform
__all__ = ('toast')
_toast = None
def _get_ref():
global _toast
if _toast is None:
if platform == 'android':
from androidtoast import toast
else:
from kivytoast import toast
_toast = toast
return _toast
def toast(text, length_lon... | {
"content_hash": "cd3705d19203c69a62ca53f3d78d130e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 45,
"avg_line_length": 19.789473684210527,
"alnum_prop": 0.5904255319148937,
"repo_name": "Fogapod/VKBot",
"id": "5af1a8739e50d478905d739d6332a4f32f7930b4",
"size": "376",
... |
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django import forms
from django.utils.timezo... | {
"content_hash": "1b9965e071319dae528c04404d78b291",
"timestamp": "",
"source": "github",
"line_count": 1850,
"max_line_length": 163,
"avg_line_length": 44.821621621621624,
"alnum_prop": 0.5816811384466956,
"repo_name": "hydroshare/hydroshare_temp",
"id": "3a707eaea08c289ec25aa4ab53f66872c07b1d09",
... |
class Solution(object):
def selfDividingNumbers(self, left, right):
"""
:type left: int
:type right: int
:rtype: List[int]
"""
def isDividingNumber(num):
n = num
while n > 0:
if (n%10) == 0 or (num%(n%10)) != 0:
... | {
"content_hash": "ec3c38eb142d93163934dc8cb4364ade",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 52,
"avg_line_length": 27.15,
"alnum_prop": 0.44014732965009207,
"repo_name": "tudennis/LeetCode---kamyu104-11-24-2015",
"id": "d3428690d778c719b891ae467560f2b573e9ff04",
"... |
"""
Generic sequence prediction script using CoNLL format.
"""
from __future__ import print_function
import sys
from seqlearn.datasets import load_conll
from seqlearn.evaluation import bio_f_score
from seqlearn.perceptron import StructuredPerceptron
from sklearn.metrics import accuracy_score
def features(sentence, ... | {
"content_hash": "c2680a3f3033d3b7689f61a6284f9c6e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 72,
"avg_line_length": 28.25423728813559,
"alnum_prop": 0.6412717456508699,
"repo_name": "fgregg/seqlearn",
"id": "557173304058ffed7ba9b2f33388446e57cb2031",
"size": "1726"... |
"""
Internally used submodule that contains runtime patches
to the standard multiprocessing library.
.. warning: Do not import this submodule in your code!
This is only meant to be imported from the
processmanager submodule!
"""
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2... | {
"content_hash": "c7e6eda1a11c5dc7fb8939b49e47d723",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 79,
"avg_line_length": 39.85549132947977,
"alnum_prop": 0.6278462654097172,
"repo_name": "JeyZeta/Dangerous",
"id": "d9c107706a03a200b07add25d71e6386290157e8",
"size": "69... |
"""Support for RESTful API sensors."""
import json
import logging
from xml.parsers.expat import ExpatError
from jsonpath import jsonpath
import voluptuous as vol
import xmltodict
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, PLATFORM_SCHEMA
from homeassistant.const import (
CONF_DEVICE_CLAS... | {
"content_hash": "8719d5a450e45a7180db419ffee7ebe3",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 87,
"avg_line_length": 33.582417582417584,
"alnum_prop": 0.5700261780104712,
"repo_name": "partofthething/home-assistant",
"id": "0699d9dc07c5a65b5cc65948c3ff0cfbb4d73327",
... |
__author__ = 'Sukrit'
import pandas as pd
import csv
f = open('../output/both_journal_list.txt', 'r') #reading list of journals present in Aminer and Elesevier
x = f.readlines()
f.close()
bothjs = []
for line in x:
bothjs.append(line.rstrip()) # list of common journals, removing '\n'
# OUR SNIP
our_SNIP = pd.r... | {
"content_hash": "1cc52fe7092ddc66f5fd4907121427d5",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 153,
"avg_line_length": 25.170212765957448,
"alnum_prop": 0.6538461538461539,
"repo_name": "SciBase-Project/internationality-journals",
"id": "9ec1b1ccb17c47789ee87f6645c49f4... |
"""
autoexam api
"""
import os, subprocess, random, jinja2
import sys
import autoexam
from os import system as run
master = 'master.txt'
# project_path = None
# region Helpers
def get_flag(kwargs, flag):
if kwargs.get(flag) == True:
return '--' + flag.replace('_', '-')
return ''
def get_value(kwa... | {
"content_hash": "acf123fa229f8c2d92afd02f4ee5c5b3",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 103,
"avg_line_length": 27.54140127388535,
"alnum_prop": 0.6006012950971323,
"repo_name": "matcom/autoexam",
"id": "9bfd63cbc30507b9927a8feb13c7a76a94e5f210",
"size": "436... |
from django.views.generic import ListView
from django.http import HttpResponse
from models import Job
from geoq.maps.models import FeatureType
from django.shortcuts import get_object_or_404
from datetime import datetime
from pytz import timezone
from webcolors import name_to_hex, normalize_hex
class JobKML(ListView)... | {
"content_hash": "38f5370d66ae1afe2d4f7b08ab93520c",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 187,
"avg_line_length": 43.61188811188811,
"alnum_prop": 0.5138298725246533,
"repo_name": "meilinger/geoq",
"id": "d25b60e3340dc02055c184baa423706e010a5863",
"size": "1247... |
import util
import json
class docker_wrapper:
def __init__(self):
cmd = ['docker', '-v']
r = util.subp(cmd)
if r.return_code != 0:
raise Exception('Unable to communicate with the docker server')
def inspect(self, obj_id):
# returns dict representation of "docker i... | {
"content_hash": "a4268ce49984d555153b8cfe1e3dfb69",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 75,
"avg_line_length": 34.79389312977099,
"alnum_prop": 0.48222904782799475,
"repo_name": "wcmitchell/insights-core",
"id": "d1f741f533d2e4d240c096b2dfe4440deb7f65fd",
"si... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | {
"content_hash": "c32564548d7a7fff81daa451367c77e9",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 117,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.7469026548672566,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "2d5531388a20552b4bf780dc858a03416c8eca85",... |
import os
import sublime
def get_plugin_path():
'''
Get path of the C++YouCompleteMe plugin.
'''
plugin_path = os.path.abspath(
os.path.join(sublime.packages_path(), 'C++YouCompleteMe'))
return plugin_path
def get_ycmd_path():
'''
Get path of the ycmd server.
'''
settings... | {
"content_hash": "e8f5f172502dea5986d15cb77c451f24",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 75,
"avg_line_length": 27.71698113207547,
"alnum_prop": 0.5824824143408214,
"repo_name": "kracejic/CppYCM",
"id": "33bcbbc802c7b75f142f01b5685c8a31766ce4b2",
"size": "4407... |
from __future__ import print_function
import os.path as op
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_allclose, assert_array_equal)
from scipy import sparse
from nose.tools import assert_true, assert_raises
import copy
import warnings
from m... | {
"content_hash": "0c371b6a5399c9a88a3d517c93e0d4ad",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 79,
"avg_line_length": 42.11916264090177,
"alnum_prop": 0.6114849365346383,
"repo_name": "leggitta/mne-python",
"id": "22747ceda789c2b43a6b88a699c9bbbb63dbcee5",
"size": "... |
# PyQt tutorial 3
import sys
from PySide import QtCore, QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.resize(200, 120)
quit = QtGui.QPushButton("Quit", window)
quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold))
quit.setGeometry(10, 40, 180, 40)
QtCore.QObject.conn... | {
"content_hash": "887c13bbdab339fbd93f543ade7fb7d9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 56,
"avg_line_length": 21.476190476190474,
"alnum_prop": 0.647450110864745,
"repo_name": "cherry-wb/SideTools",
"id": "2d133948c7e2ea3caed6e92697b1ec00bd4162c9",
"size": "4... |
import os
from datadog_checks.dev import get_docker_hostname, get_here
HERE = get_here()
DOCKER_COMPOSE_FILE = os.path.join(HERE, 'docker', 'docker-compose.yaml')
HOST = get_docker_hostname()
PORT = '8080'
SCHEME = 'http'
INSTANCE = {'scheme': SCHEME, 'host': HOST, 'port': PORT}
INSTANCE_BAD = {'scheme': 'https', 'h... | {
"content_hash": "327d516f6eeb876a0a714c1e6de4464a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 28.615384615384617,
"alnum_prop": 0.6801075268817204,
"repo_name": "DataDog/integrations-extras",
"id": "d84bc60c5697b0f6aa26b1c484e152510f806ea8",
"... |
from lapostesdk.apis import apisuivi, apicontroladresse
class LaPosteApi(object):
def __init__(self, api_key):
self.api_key = api_key
self.suivi = apisuivi.ApiSuivi(self.api_key)
self.controladresse = apicontroladresse.ApiControlAdresse(self.api_key)
| {
"content_hash": "9ee100b5d5110f6b0b352e6e8a7d02ca",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 79,
"avg_line_length": 35.125,
"alnum_prop": 0.7117437722419929,
"repo_name": "geelweb/laposte-python-sdk",
"id": "c944f14fdab388b21ad0e4582fa01f0d4bc5c8eb",
"size": "281",
... |
from __future__ import unicode_literals
import datetime
import json
import os
import re
import unittest
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from django.contrib.admin.op... | {
"content_hash": "b4f67b9effbb740bc8e434eac841d7a7",
"timestamp": "",
"source": "github",
"line_count": 6012,
"max_line_length": 119,
"avg_line_length": 46.26314038589488,
"alnum_prop": 0.6298618651441391,
"repo_name": "krisys/django",
"id": "48ce1770fbb40c3f338fc6d9d74039edb347efc8",
"size": "2782... |
from __future__ import print_function
from zope.interface import implementer_only
from twisted.trial import unittest
from foolscap import schema, remoteinterface
from foolscap.api import RemoteInterface
from foolscap.remoteinterface import getRemoteInterface, RemoteMethodSchema
from foolscap.remoteinterface import Rem... | {
"content_hash": "74f590181d77ed7b0efd84309db604f4",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 105,
"avg_line_length": 42.27062706270627,
"alnum_prop": 0.6299188007495315,
"repo_name": "warner/foolscap",
"id": "01ef049d922d2a6d6d7750c4562679c0eeeb7fc5",
"size": "128... |
"""Tests for single_return module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.autograph.converters import single_return
from tensorflow.contrib.autograph.core import converter_testing
from tensorflow.python.framework.ops impo... | {
"content_hash": "7071dc229de4f49fd6a5a948d7d985ae",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 79,
"avg_line_length": 22.914285714285715,
"alnum_prop": 0.5880299251870325,
"repo_name": "caisq/tensorflow",
"id": "1f0de4310e370235a4a7bfeaa61bd519a81aff47",
"size": "46... |
"""``tornado.gen`` is a generator-based interface to make it easier to
work in an asynchronous environment. Code using the ``gen`` module
is technically asynchronous, but it is written as a single generator
instead of a collection of separate functions.
For example, the following asynchronous handler::
class Asy... | {
"content_hash": "5d5f0aecbf56eb6db125626fe44b1f7d",
"timestamp": "",
"source": "github",
"line_count": 560,
"max_line_length": 91,
"avg_line_length": 35.45,
"alnum_prop": 0.6081503123111022,
"repo_name": "hiphopsmurf/bitcoin-secured",
"id": "23b3c81c35fe59310492f133ad7971d55677fef8",
"size": "1985... |
from setuptools import setup, find_packages
setup(
name='django-feedback',
version=__import__('feedback').__version__,
description='Basic Django Feedback',
author='Luke Hutscal',
author_email='[email protected]',
url='http://github.com/girasquid/django-feedback/',
packages=find_pac... | {
"content_hash": "3eab7ac4065d6529f9541d76539e25cc",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 55,
"avg_line_length": 31.954545454545453,
"alnum_prop": 0.6301564722617354,
"repo_name": "girasquid/django-feedback",
"id": "13082a0e750a37fa70d2cfde5b054dbc89f6ae2b",
"si... |
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts.
For a description of arguments recognized by test scripts, see
`test/functional/test_framework/test_framework.py:BitcoinTestFramework.main`.
"""... | {
"content_hash": "7ba4b506ae8316f405d0cf7d74bbaa40",
"timestamp": "",
"source": "github",
"line_count": 914,
"max_line_length": 205,
"avg_line_length": 39.16849015317287,
"alnum_prop": 0.6195251396648045,
"repo_name": "particl/particl-core",
"id": "3c8d17cc3c9e37f3c3718b532534dda7194c600b",
"size":... |
"""OAuth utility functions"""
import logging
from datetime import datetime
from django.conf import settings
from requests_oauthlib import OAuth2Session
from allauth.socialaccount.models import SocialAccount
DEFAULT_PRIVACY_LEVEL = getattr(settings, 'DEFAULT_PRIVACY_LEVEL', 'public')
log = logging.getLogger(__name_... | {
"content_hash": "dd55466a408537025427602ae5622d6c",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 82,
"avg_line_length": 30.340425531914892,
"alnum_prop": 0.5897615708274895,
"repo_name": "tddv/readthedocs.org",
"id": "019a51faf9110d6dd291925786a4712a4192d993",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.