text stringlengths 4 1.02M | meta dict |
|---|---|
import datetime as dt
import pytest
import pytz
import stix2
from .constants import CAMPAIGN_ID, CAMPAIGN_MORE_KWARGS, IDENTITY_ID
EXPECTED = """{
"type": "campaign",
"spec_version": "2.1",
"id": "campaign--8e2e2d2b-17d4-4cbf-938f-98ee46b3cd3f",
"created_by_ref": "identity--311b2d2d-f010-4473-83ec-1... | {
"content_hash": "e076726749b1053e7e63385bfc10230c",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 118,
"avg_line_length": 32.26315789473684,
"alnum_prop": 0.6383904295812942,
"repo_name": "oasis-open/cti-python-stix2",
"id": "edc7d7779bed1d7c91d8d2d8916716f2148fc837",
"... |
"""Forseti Server utilities."""
import logging
# pylint: disable=protected-access
def autoclose_stream(f):
"""Decorator to close gRPC stream.
Args:
f (func): The function to decorate
Returns:
wrapper: wrapper of the decorator
"""
def wrapper(*args):
"""Wrapper functi... | {
"content_hash": "8fec345ddd11f8b83319a34357421a7f",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 75,
"avg_line_length": 24.140625,
"alnum_prop": 0.5904530744336569,
"repo_name": "forseti-security/forseti-security",
"id": "716df67c64b1cf906cb821e06cb4fb147b2d7b55",
"si... |
"""
Test quoting of arguments to lldb commands
"""
from __future__ import print_function
import os
import re
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class SettingsCommandTestCase(TestBase):
mydir = TestBase.comp... | {
"content_hash": "3237411f468ffc7ede5bb4a343a79752",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 95,
"avg_line_length": 30.436893203883496,
"alnum_prop": 0.6220095693779905,
"repo_name": "youtube/cobalt",
"id": "9265b47962b1bcfc71a20c549759c7901312ecb3",
"size": "3135... |
import mock
from nose.tools import * # noqa
from framework.auth.core import Auth
from framework.exceptions import PermissionsError
from tests.base import OsfTestCase
from tests.factories import UserFactory, ProjectFactory
from website.addons.zotero.tests.factories import ZoteroAccountFactory
from website.addons.zote... | {
"content_hash": "08bdf66ed37241a96dd2c3bf1d22a386",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 85,
"avg_line_length": 31.60326086956522,
"alnum_prop": 0.6029234737747206,
"repo_name": "Ghalko/osf.io",
"id": "52db8c8b90069cfa7409c7822f07fcd770f92506",
"size": "11655"... |
"""
These are internal helpers. Do not rely on their presence.
"""
from __future__ import absolute_import, unicode_literals
from distutils.version import LooseVersion
from django import get_version
from django.template.loader import render_to_string
if LooseVersion(get_version()) < LooseVersion('1.10'):
def ct_... | {
"content_hash": "bba8c0e1c06091a689e5f3c6bcd43e45",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 64,
"avg_line_length": 30.586206896551722,
"alnum_prop": 0.657271702367531,
"repo_name": "matthiask/feincms-elephantblog",
"id": "74c6309f2d6dc195da29a61c444403622c377e6a",
... |
import re, os, platform, urllib, cgi
PLUGIN_LOG_TITLE='Staxus' # Log Title
VERSION_NO = '2017.07.26.0'
# Delay used when requesting HTML, may be good to have to prevent being
# banned from the site
REQUEST_DELAY = 0
# URLS
BASE_URL='http://staxus.com%s'
# Example Video Details URL
# http://staxus.com/t... | {
"content_hash": "079db8f2f15a0c0da798e9c288396553",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 211,
"avg_line_length": 42.25550660792952,
"alnum_prop": 0.6456422018348624,
"repo_name": "iklier/plex-gay-metadata-agent",
"id": "734c14a721f12d982306b71f4d1fffe2c99ddb5e",... |
from ConfigParser import ConfigParser
def get_cfg():
cfg = ConfigParser()
cfg.read('configuration.ini')
return cfg
def api_info(a):
cfg = get_cfg()
items = dict(cfg.items(a))
return items
def get_api_item(a,b):
cfg = get_cfg()
item = cfg.get(a,b)
return item
def get_proxies():
... | {
"content_hash": "8bd7583d540d6ce6bc0f7c73a3e90740",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 38,
"avg_line_length": 20.384615384615383,
"alnum_prop": 0.5962264150943396,
"repo_name": "nramanan/nellie-bot",
"id": "fe92edbd08a03f24fb7485f7f18c7caf6808077f",
"size": "... |
from unittest.mock import patch, MagicMock
from flask import url_for
from tests.base import SampleFrontendTestBase
class BpFeaturesTestCase(SampleFrontendTestBase):
def test_bustimes_reachable(self):
mock = MagicMock()
with patch('sipa.blueprints.features.get_bustimes', mock):
resp =... | {
"content_hash": "802d99378a23dfd1eb8a9facd2f990aa",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 30.1875,
"alnum_prop": 0.7122153209109731,
"repo_name": "agdsn/sipa",
"id": "4ecd31751ae404d14b228b33de744e769e2c15d9",
"size": "483",
"binary": fa... |
"""django-accounts setup."""
from __future__ import print_function, unicode_literals
from setuptools import setup, find_packages
import accounts
setup(
name='accounts',
version=accounts.__version__,
author='Julio Vicente Trigo Guijarro',
author_email='',
url='http://github.com/juliotrigo/django-... | {
"content_hash": "73c9fff4ca427b69ea679fcc215cc565",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 70,
"avg_line_length": 31.405405405405407,
"alnum_prop": 0.6239242685025818,
"repo_name": "juliotrigo/django-accounts",
"id": "9779c7924826cf1dee3b18787fa8ec7901fdc1fc",
"s... |
class Credentials(object):
# Rely on default gcloud client credential resolution instead of
# reifying credentials in WAL-E.
pass
| {
"content_hash": "0204d8a9cfd74c712345a153dba973ab",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 68,
"avg_line_length": 35.5,
"alnum_prop": 0.7394366197183099,
"repo_name": "tenstartups/wal-e",
"id": "a48af6b5c5ecde29676e98f5df518d82508a6d6e",
"size": "142",
"binary":... |
from django.test import TestCase
from ..models import Staff
class StaffTests(TestCase):
def setUp(self):
Staff.objects.create(
name='Casper', address='China')
Staff.objects.create(
name='Muffin', address='Malasia')
def test_address(self):
casper = Staff.objects.... | {
"content_hash": "391cca84deb7ff2c4a5d4c47343fe05b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 49,
"avg_line_length": 26,
"alnum_prop": 0.6038461538461538,
"repo_name": "njj6666/forkmelon",
"id": "4acb01b7168aa7a15b5379b84a42408ae578266d",
"size": "520",
"binary": ... |
from .core import StructuredNode, db
from .properties import AliasProperty
from .exception import MultipleNodesReturned
import inspect
import re
OUTGOING, INCOMING, EITHER = 1, -1, 0
# basestring python 3.x fallback
try:
basestring
except NameError:
basestring = str
def rel_helper(lhs, rhs, ident=None, relat... | {
"content_hash": "40a9eb1b91445c005b89844b6a1272eb",
"timestamp": "",
"source": "github",
"line_count": 564,
"max_line_length": 115,
"avg_line_length": 34.638297872340424,
"alnum_prop": 0.5789312039312039,
"repo_name": "pombredanne/neomodel",
"id": "d8312906b39dd4bd671af7bd853efda9b362e720",
"size"... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General conf... | {
"content_hash": "5db493446e22009fb054fdb07fae89aa",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 80,
"avg_line_length": 32.44117647058823,
"alnum_prop": 0.7068600785735872,
"repo_name": "lexqt/django-pipeline",
"id": "c77282b2619f4fefbbd636fffd528fa26959f7ca",
"size":... |
from ..requestlist import RequestList
from ..played import Played
from ..song import Song
from ..artist import Artist
from ..album import Album
from ..siteoptions import SiteOptions
from ..users import Users
from ..suggestions import Suggestions
from ..mistags import Mistags
from ..catalog import Catalog
import sqlalch... | {
"content_hash": "2b133c50c020e39510f223b87f781e8e",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 152,
"avg_line_length": 45.40453074433657,
"alnum_prop": 0.5636493228795438,
"repo_name": "bmillham/djrq2",
"id": "5dbad4a68ffe56fb5d97bc8982f0fb1571d44ca5",
"size": "1403... |
'''Run two retrace instances in parallel, comparing generated snapshots.
'''
import math
import optparse
import os.path
import subprocess
import platform
import sys
from PIL import Image
from snapdiff import Comparer
from highlight import AutoHighlighter
import jsondiff
# Null file, to use when we're not interest... | {
"content_hash": "ddbe24d470e840395ac801026ef0b22e",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 99,
"avg_line_length": 32.54520547945206,
"alnum_prop": 0.5527401296405421,
"repo_name": "schulmar/apitrace",
"id": "55f771e2184e0d4d6746d1ee70ca7393467840a9",
"size": "13... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auditlog', '0006_object_pk_index'),
]
operations = [
migrations.AlterField(
model_name='logentry',
name='object_pk',
... | {
"content_hash": "1a4408655df6d51c5e81e1d33e2a7e87",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 92,
"avg_line_length": 23.5,
"alnum_prop": 0.6052009456264775,
"repo_name": "Zmeylol/auditlog",
"id": "3a724e8d734e7222b823cb4ffcfb66353ba42836",
"size": "447",
"binary":... |
from xpy.Anymethod import anymethod
_is_test_classes = False
class SuperMethod(object):
"""
class MyClass(...):
@SuperMethod
def foo(super, self, *args, **kwargs):
#
# equivalent to super(MyClass, self).foo()
#
super.foo()
#
# A SuperMeth... | {
"content_hash": "3b375c6d92fe7b34ac5620f840c4f8b1",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 27.941747572815533,
"alnum_prop": 0.49339819318971506,
"repo_name": "dbeal/xpy",
"id": "47c2b6b10eefd94bed1d802a3f5eaeeccc77e9a7",
"size": "2971",
... |
import requests as r
import unittest
import json
import time
class ApiUsersTest(unittest.TestCase):
def setUp(self):
self.URL_PRE = "http://localhost:5000/api/v1"
pass
def test_list_users(self):
response = r.get(self.URL_PRE + "/users")
print "Testing LIST USERS\t\t",
... | {
"content_hash": "a908493357e9e31bafd083362ea08e80",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 66,
"avg_line_length": 31,
"alnum_prop": 0.4596774193548387,
"repo_name": "krrg/gnomon",
"id": "35171c32a4348d28455e091af3e12293525fd404",
"size": "1753",
"binary": false... |
import json
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from data_api.models import System, Signal, LocalComputer, Blob
import django.utils.timezone as tmz
class TestViews(TestCase):
def setUp(self):
self.client = Client()
# when creating a System
... | {
"content_hash": "f6282c4d24fce6e481f905618063e3f3",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 118,
"avg_line_length": 42.67948717948718,
"alnum_prop": 0.6094923400420547,
"repo_name": "kietdlam/Dator",
"id": "4ce137f726fa735603c95fe903cf286064a2fb36",
"size": "3329"... |
import os
import re
import subprocess
import time
import sys
import random
import string
from Queue import Queue, Empty
from threading import Thread
from datetime import date
from sonLib.bioio import logger
from sonLib.bioio import system
from jobTree.batchSystems.abstractBatchSystem import AbstractBatchSystem
from j... | {
"content_hash": "d9488bb55daf8bc8d4a762e3508d4430",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 176,
"avg_line_length": 38.72789115646258,
"alnum_prop": 0.5706130335499736,
"repo_name": "benedictpaten/jobTree",
"id": "4bf02c7295bd8d5701f2263f97bc31a55f87277c",
"size"... |
import logging
import re
from random import choice
import requests
from lxml import etree
from spider import consts
def filter_http_tag(string):
"""
过滤网页端的多余字符和标签
:param string:
:return:
"""
pattern = r'<br/?>|\n'
replace_char = ''
string = re.sub(pattern=pattern, repl=replace_char, ... | {
"content_hash": "5c3868d245cee57bc026878db5274e40",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 147,
"avg_line_length": 29.303370786516854,
"alnum_prop": 0.5966257668711656,
"repo_name": "hehanlin/jobbole",
"id": "19efdf1a7af429af861066fd0fbc03a7f88a13b5",
"size": "27... |
RESULT_VIEW_NAME = 'gjslint_result_view'
SETTINGS_FILE = "sublime-closure-linter.sublime-settings"
| {
"content_hash": "76ba1cbb8289e3f818071b3ee0543636",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 57,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.78,
"repo_name": "fbzhong/sublime-closure-linter",
"id": "476560615a0f891800b1ef7b93fbe11dad9a2915",
"size": "101"... |
from __future__ import unicode_literals
from collections import OrderedDict
from operator import attrgetter
from flask import flash, request, session
from sqlalchemy.orm import joinedload, subqueryload
from indico.core.db import db
from indico.modules.events.abstracts.models.abstracts import Abstract, AbstractState
... | {
"content_hash": "e30aa764eeabaa7d5fa5396a9e9cbb87",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 118,
"avg_line_length": 48.76171875,
"alnum_prop": 0.5767844268204758,
"repo_name": "OmeGak/indico",
"id": "2dffedc10d3bb06df3687fe30a1fdf66296eaf33",
"size": "12697",
"... |
"""The tests for the time automation."""
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.bootstrap import _setup_component
import homeassistant.util.dt as dt_util
import homeassistant.components.automation as automation
from tests.common import fire_time_changed, get_... | {
"content_hash": "f303c7d71e9fd59323728def1bf62277",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 72,
"avg_line_length": 32.78238341968912,
"alnum_prop": 0.48759285601390867,
"repo_name": "sffjunkie/home-assistant",
"id": "b36ce8c92b554d76182ad8303f67d25ae63ebf6f",
"si... |
from django.views.generic.base import TemplateView
from django.conf import settings
from corehq.apps.app_manager.dbaccessors import get_app
class PreviewAppView(TemplateView):
template_name = 'preview_app/base.html'
urlname = 'preview_app'
def get(self, request, *args, **kwargs):
app = get_app(r... | {
"content_hash": "199db23c300a769036e4021ae791c75b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 59,
"avg_line_length": 30.5,
"alnum_prop": 0.6680327868852459,
"repo_name": "qedsoftware/commcare-hq",
"id": "f7cf48054f46720907522366d4eec5d789fa3bef",
"size": "488",
"b... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from oslo_config import cfg
import testtools
class ConfigurationTest(testtools.TestCase):
def test_defaults(self):
self.assertEqual('0.0.0.0', cfg.CONF.bind_host)
self.assertEqual(1789, c... | {
"content_hash": "368a1639b7018734da198154d96e9956",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 75,
"avg_line_length": 40.21739130434783,
"alnum_prop": 0.7027027027027027,
"repo_name": "openstack/congress",
"id": "4dec24cf8e57bf8388620650c725a5fb1dc44d7e",
"size": "15... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.cosmosdb import CosmosDBManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cosmosdb
# USAGE
python cosmos_db_sql_container_migrate_to_manual_throughput.py
Before run the sample, please set the values ... | {
"content_hash": "4c2e89c0d0123997e60ff9950e167969",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 170,
"avg_line_length": 35.65714285714286,
"alnum_prop": 0.7355769230769231,
"repo_name": "Azure/azure-sdk-for-python",
"id": "3e8ed45524df489d0752ba560b28e44df23ca81c",
"s... |
import random
import uuid
from keystone.auth import controllers as auth_controllers
from keystone.common import dependency
from keystone.common import serializer
from keystone.common import sql
from keystone.common.sql import migration_helpers
from keystone import config
from keystone import contrib
from keystone.cont... | {
"content_hash": "361001bf191af602984783f90193ff1d",
"timestamp": "",
"source": "github",
"line_count": 1544,
"max_line_length": 79,
"avg_line_length": 38.15349740932643,
"alnum_prop": 0.5162708584426828,
"repo_name": "JioCloud/keystone",
"id": "890934b61b8d95e05eb1f1e9f4faf350e94a63cb",
"size": "5... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, authenticate
from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from app.core.forms import RegistroDesocupado, RegistroEmpresa
from app.core.forms i... | {
"content_hash": "ffa8a2ae50d9977177c436b9616cbcf7",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 80,
"avg_line_length": 35.432,
"alnum_prop": 0.6884172499435538,
"repo_name": "YumiBunny/Gusoktor",
"id": "7e55935f349f8c2b5a60150923f602da18236b0d",
"size": "4446",
"bi... |
class EventHandler(list):
"""
A list of callable objects. Calling an instance of this will cause a call to each item in the list in ascending
order by index.
Code taken from: https://stackoverflow.com/a/2022629
To subscribe to the event simply append a function to the event handler:
``event_ha... | {
"content_hash": "bd6eb9a7d15e5dffaa47d3633e3339f5",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 115,
"avg_line_length": 31.470588235294116,
"alnum_prop": 0.6242990654205608,
"repo_name": "EmuKit/emukit",
"id": "dc1770bacc9c490c197f76830d6329c98a3af48b",
"size": "535",... |
from lflib.lightfield import LightField
from lflib.imageio import save_image
import numpy as np
import time
from scipy.sparse.linalg.interface import LinearOperator
from scipy.sparse.dia import dia_matrix
from pylflib import compute_long_object_compensation
# -------- Variance stabilizing transforms ----------- ... | {
"content_hash": "dc0b3bbbfd68edb981ad42ede9c5fef7",
"timestamp": "",
"source": "github",
"line_count": 1197,
"max_line_length": 173,
"avg_line_length": 40.12698412698413,
"alnum_prop": 0.5682461692205196,
"repo_name": "sophie63/FlyLFM",
"id": "881ddec7d56a9ff38595addcef1cc469b759503a",
"size": "48... |
import os
import unittest
from tempfile import TemporaryDirectory
import mock
import unicodecsv as csv
from mock import MagicMock
from airflow.providers.microsoft.azure.operators.oracle_to_azure_data_lake_transfer import (
OracleToAzureDataLakeTransferOperator,
)
class TestOracleToAzureDataLakeTransfer(unittest... | {
"content_hash": "41222f780b758a71c6c91fad183d4b55",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 103,
"avg_line_length": 39.52336448598131,
"alnum_prop": 0.5845353511468432,
"repo_name": "wooga/airflow",
"id": "06f6a8c1dc1216866bb001d32780d834c882707d",
"size": "5017"... |
from __future__ import print_function
import numpy as np
from fylearn import garules
from sklearn.datasets import load_iris
import pytest
def test_classifier():
l = garules.MultimodalEvolutionaryClassifier(n_iterations=100)
X = np.array([
[1, 2, 4],
[2, 4, 8]
])
y = np.array([
... | {
"content_hash": "2d76d59990d02eeb512e8ddbfb178fb5",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 87,
"avg_line_length": 24.432098765432098,
"alnum_prop": 0.6260737746336533,
"repo_name": "sorend/fylearn",
"id": "600c71cd11bfe668a22719faa884a4b25cd3ef9b",
"size": "1979"... |
"""
Common work items
"""
| {
"content_hash": "4e8ae6c638ab5bec5b68c27e99b68149",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 17,
"avg_line_length": 8.666666666666666,
"alnum_prop": 0.5769230769230769,
"repo_name": "macosforge/ccs-calendarserver",
"id": "347748cd3b133a0041593bb369bf4707f766b238",
"... |
import time
from typing import Optional
from .api_jwk import PyJWKSet, PyJWTSetWithTimestamp
class JWKSetCache:
def __init__(self, lifespan: int):
self.jwk_set_with_timestamp: Optional[PyJWTSetWithTimestamp] = None
self.lifespan = lifespan
def put(self, jwk_set: PyJWKSet):
if jwk_set... | {
"content_hash": "482e48967adca23f68c45d84ac771b28",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 29.5,
"alnum_prop": 0.6165254237288136,
"repo_name": "progrium/pyjwt",
"id": "e8c2a7e0a7760b06a2aef00ca2127608ef2f1a1f",
"size": "944",
"binary": f... |
from __future__ import unicode_literals
from django.db import models, migrations
def copy_dataset_from_selection(apps, schema_editor):
Task = apps.get_model('project.Task')
for task in Task.objects.all():
task.dataset = task.selection.dataset
task.save()
class Migration(migrations.Migration):... | {
"content_hash": "342ae2a0af08b06207b7cd7c5074efa6",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 94,
"avg_line_length": 29.153846153846153,
"alnum_prop": 0.6253298153034301,
"repo_name": "michaelbrooks/uw-message-coding",
"id": "97d725cbc5dbc957ce8d9f3b88d5d24772bc2874",... |
""" Various utilities useful when using kernels
"""
import logging
from multiprocessing import cpu_count
import numpy as np
import numexpr as ne
def get_kernel_object(name, sparse=True, **kwargs):
""" Factory function to get a kernel object
"""
if sparse:
from .sparse.sparse_kernels import Spars... | {
"content_hash": "598e8018786264b63bcea987a0b2b07e",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 79,
"avg_line_length": 32.054755043227665,
"alnum_prop": 0.5973208666726603,
"repo_name": "daien/ekovof",
"id": "c68adebc7d223d2a9ff1a0620361258543b44ff7",
"size": "11123"... |
from django.conf.urls import url
from userprofile import views
urlpatterns = [
url(r'^(?P<username>\w+)$',
views.UserProfileDetailView.as_view(), name='user_profile'),
url(r'^(?P<username>\w+)/edit$',
views.UserProfileEditView.as_view(), name='edit_user_profile'),
url(r'^(?P<username>\w+)/... | {
"content_hash": "4ba7569a1578887edbfd50e6445bd078",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 71,
"avg_line_length": 37,
"alnum_prop": 0.638996138996139,
"repo_name": "andela-ooshodi/codango-debug",
"id": "7da8ddfe6ba1ee85ccb0b2472f3a42fddbf06f14",
"size": "518",
... |
import sys
import re
import argparse
import socket
import json
import httplib2
import ssl
import fiapProto
import fiapConfig
FIAPC_TIMEOUT = 10
class CertificateValidationError(httplib2.HttpLib2Error):
pass
def validating_server_factory(config):
# we need to define a closure here because we don't control
... | {
"content_hash": "9f3042b0e7fd9a28ef4cbc8e45c590c7",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 82,
"avg_line_length": 30.632653061224488,
"alnum_prop": 0.5733510992671552,
"repo_name": "momotaro98/fiapy",
"id": "6e8f3364e119b2875872764bb715e1f98233e55f",
"size": "75... |
from __future__ import absolute_import
from sentry import analytics
class PluginEnabledEvent(analytics.Event):
type = "plugin.enabled"
attributes = (
analytics.Attribute("user_id"),
analytics.Attribute("organization_id"),
analytics.Attribute("project_id"),
analytics.Attribute... | {
"content_hash": "b1c8573877164b017ccac9c7bbd24c4e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 47,
"avg_line_length": 22.294117647058822,
"alnum_prop": 0.6886543535620053,
"repo_name": "mvaled/sentry",
"id": "686b01c62f5f4abe05c919a340b7938503c7ab12",
"size": "379",
... |
"""
This module contains all code for using the VMware SOAP API/SDK
"""
from time import sleep
import re
import os
import shutil
from suds.client import Client, WebFault
from suds.cache import ObjectCache
from suds.sudsobject import Property
from suds.plugin import MessagePlugin
from ovs.log.logHandler import LogHand... | {
"content_hash": "98ca0849595326264ec321ffdd388e28",
"timestamp": "",
"source": "github",
"line_count": 1023,
"max_line_length": 127,
"avg_line_length": 41.251221896383186,
"alnum_prop": 0.5281279620853081,
"repo_name": "mflu/openvstorage_centos",
"id": "75098324a8b6858fa708b35bcbda356534157349",
"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "daily_expenses.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "d61ba09709332e5d17a5539af0c6288b",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 78,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.7148936170212766,
"repo_name": "maths22/daily-expenses",
"id": "66567d4bfdd3cbafcc69327ed74f100a391e3e73",
"size": ... |
import datetime
import multiprocessing
import os
import socket
from django.http import JsonResponse
from cuckoo.common.files import Files
from cuckoo.core.database import Database
from cuckoo.core.rooter import rooter
from cuckoo.core.startup import check_version
from cuckoo.misc import cwd, version
from cuckoo.web.u... | {
"content_hash": "2b8db5d90095406276021686ce0261f7",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 78,
"avg_line_length": 32.885245901639344,
"alnum_prop": 0.5685443668993021,
"repo_name": "cuckoobox/cuckoo",
"id": "5b36ab17bd84e6b626789df89eb2276aab1178a4",
"size": "41... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_plugins_image', '0001_initial'),
('eventlistingfordate', '0003_auto_20161019_1906'),
]
operations = [
migrations.AddField(
... | {
"content_hash": "94c07cd6f075595e388a826996974160",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 209,
"avg_line_length": 40.689655172413794,
"alnum_prop": 0.6423728813559322,
"repo_name": "ic-labs/django-icekit",
"id": "b1ac6b1084c69978bb2ad59b56b4af74130962c8",
"size"... |
from unittest import TestCase
from muntjac.ui.table import Table
from muntjac.data.util.indexed_container import IndexedContainer
class TestFooter(TestCase):
"""Test case for testing the footer API"""
def testFooterVisibility(self):
"""Tests if setting the footer visibility works properly"""
... | {
"content_hash": "5ada39bc0e69ac104164d68dc95d8850",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 69,
"avg_line_length": 33.54216867469879,
"alnum_prop": 0.6522988505747126,
"repo_name": "rwl/muntjac",
"id": "d6a251828244c652886226be5bcf8f5ddb6974ea",
"size": "2827",
... |
import logging
from django.views.generic.detail import DetailView
from django.views.generic.edit import FormView, UpdateView
from django.views.generic import View
from django.http import JsonResponse
from django.core.urlresolvers import reverse
from django.template import Context
from django.template.loader import ge... | {
"content_hash": "2c85f4f4b9f48330b86c6cba72c6458e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 68,
"avg_line_length": 30.258064516129032,
"alnum_prop": 0.7014925373134329,
"repo_name": "ateoto/django-glair",
"id": "2eed85f6134b04a6d1a8b1a5c829fbaee05f17cf",
"size": "... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding index on 'SmsBillable', fields ['log_id']
db.create_index(u'smsbillables_smsbillable', ['log_id'])
def backwa... | {
"content_hash": "995b1aaba6ea52044b687ddeeb05e398",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 169,
"avg_line_length": 68.18181818181819,
"alnum_prop": 0.5575238095238095,
"repo_name": "puttarajubr/commcare-hq",
"id": "a4e56452e9807fede3d74355b53328e3856dc3c0",
"size... |
from django.conf import settings
def get_site_url_root():
domain = getattr(settings, 'MY_SITE_DOMAIN', 'localhost')
protocol = getattr(settings, 'MY_SITE_PROTOCOL', 'http')
port = getattr(settings, 'MY_SITE_PORT', '')
url = '%s://%s' % (protocol, domain)
if port:
url += ':%s' % port
... | {
"content_hash": "37b7ff77287aba0eda6148b02d5b6015",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 27.174603174603174,
"alnum_prop": 0.5823598130841121,
"repo_name": "SpokesmanReview/django-boundaryservice",
"id": "59cea5c5fdee018bb00e496c297106a34f3... |
import os
import sys
sys.path.insert(0, os.getcwd())
from twisted.internet import reactor
from txjsonrpc.netstring.jsonrpc import Proxy
def printValue(value):
print "Result: %s" % str(value)
reactor.stop()
def printError(error):
print 'error', error
reactor.stop()
proxy = Proxy('127.0.0.1', 7080... | {
"content_hash": "1a8b0085281d614297dcc77dad2e5cca",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 18.318181818181817,
"alnum_prop": 0.7096774193548387,
"repo_name": "aborilov/txjsonrpc",
"id": "4b9f9162009c9bf7be8eafe31091c76868377871",
"size": "4... |
import os
from mock import Mock
from mock import ANY
from amen.audio import Audio
from queue_functions import do_work
from queue_functions import make_audio
from server import handle_post
from uploaders.s3 import get_url
class MockAnalysis():
def to_json(self):
return True
def faux_analysis(filepath):
... | {
"content_hash": "7e25133d7809cbb1e8d6a53cb0911bb4",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 92,
"avg_line_length": 26.4375,
"alnum_prop": 0.7269503546099291,
"repo_name": "algorithmic-music-exploration/amen-server",
"id": "f80e3089e25ca654e7463c54b7c33a89b2abce16",
... |
import pytest
import requests
from json.decoder import JSONDecodeError
from backend.util.response.cart import CartSchema
from backend.util.response.error import ErrorSchema
def test_remove(domain_url, es_create):
prod_list = es_create("products", 2)
item_id = prod_list[0].meta["id"]
item_id_2 = prod_list... | {
"content_hash": "7a3933534283d0c57fa4ae7670a67cbb",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 60,
"avg_line_length": 27.26027397260274,
"alnum_prop": 0.5859296482412061,
"repo_name": "willrp/willbuyer",
"id": "7da23b24356753fbd4d2cfdc0c0fe1f837349ee8",
"size": "1990... |
import sys
import random
import warnings
from functools import reduce
from html import escape as html_escape
from pyspark import copy_func, since, _NoValue
from pyspark.rdd import RDD, _load_from_socket, _local_iterator_from_socket
from pyspark.serializers import BatchedSerializer, PickleSerializer, \
UTF8Deserial... | {
"content_hash": "34f402154b990d010b6fbef2c9c6ca57",
"timestamp": "",
"source": "github",
"line_count": 2371,
"max_line_length": 100,
"avg_line_length": 38.985660059046815,
"alnum_prop": 0.5657164493968735,
"repo_name": "ptkool/spark",
"id": "db2ddde00c88127f1e603f332f8b79d3682acda5",
"size": "9322... |
"""
jinja2.environment
~~~~~~~~~~~~~~~~~~
Provides a class that holds runtime and parsing time options.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from jinja2 import nodes
from jinja2.defaults import BLOCK_START_STRING, \
BLOC... | {
"content_hash": "05e718de575e5be35ff26e8b215b5bd2",
"timestamp": "",
"source": "github",
"line_count": 1190,
"max_line_length": 82,
"avg_line_length": 39.6781512605042,
"alnum_prop": 0.6050151428510918,
"repo_name": "amisrs/one-eighty",
"id": "fad5e237733bfd14223835cdafa3d9699f7df08a",
"size": "47... |
from django_couchdb_utils.auth.models import User
from datetime import datetime
from django.http import Http404
from django_openid import signed
from django.conf import settings
from .consumer import AuthConsumer
from .forms import RegistrationFormPasswordConfirm
from .models import UserOpenidAssociation
from django_op... | {
"content_hash": "aaef1b85ff88731f9d5f847d749be8af",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 95,
"avg_line_length": 38.29197080291971,
"alnum_prop": 0.5707205489897065,
"repo_name": "theju/django-couchdb-utils",
"id": "9c143849101fe85fedf65777defa880f0670c496",
"s... |
"""Top-level package for yamicache."""
__author__ = """Timothy McFadden"""
__version__ = "0.6.0"
from .yamicache import Cache, nocache, override_timeout # noqa: F401
| {
"content_hash": "bc442cc76c5111a0b99c0501fbaec0f7",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 69,
"avg_line_length": 28.166666666666668,
"alnum_prop": 0.6627218934911243,
"repo_name": "mtik00/yamicache",
"id": "05873a089352f20a14f6c9ab4aecdb07b81295b9",
"size": "194"... |
from runner.koan import *
def function():
return "pineapple"
def function2():
return "tractor"
class Class(object):
def method(self):
return "parrot"
class AboutMethodBindings(Koan):
def test_methods_are_bound_to_an_object(self):
obj = Class()
self.assertEqual(True, obj.m... | {
"content_hash": "57e12f5e84710af8087bc0d1caeffbe6",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 90,
"avg_line_length": 31.557894736842105,
"alnum_prop": 0.5973982655103403,
"repo_name": "MartinRiese/python_koans",
"id": "442b8c61c179ccd1311c6f1ed8367c34d6334393",
"siz... |
# NOTE: this requires PyAudio because it uses the Microphone class
import speech_recognition as sr
r = sr.Recognizer(key='AIzaSyCCHEwsmjuxssqgxZL_u_i8cBc3xq5cDFc')
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r... | {
"content_hash": "86d0a8550791c70d14beeb497f570b42",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 113,
"avg_line_length": 63.3,
"alnum_prop": 0.636650868878357,
"repo_name": "growse/lcd-btctracker",
"id": "aa4bf5bba74eb25964a4c01327e5b390ae0dec3d",
"size": "655",
"bin... |
__author__ = 'Takashi Yahata (@paoneJP)'
__copyright__ = 'Copyright (c) 2014, Takashi Yahata'
__license__ = 'MIT License'
import sys
import os
from socketserver import ThreadingMixIn
from wsgiref.simple_server import WSGIServer
import win32service
import win32serviceutil
import win32event
SERVICE_... | {
"content_hash": "ec18c7101f5d1243862806817d033a01",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 73,
"avg_line_length": 25.933333333333334,
"alnum_prop": 0.6709511568123393,
"repo_name": "paoneJP/python-SelfIop",
"id": "54c6d2453ac886edcb4be8ad0cbc7c23f1ae27b0",
"size"... |
"""
Expose top-level symbols that are safe for import *
"""
from __future__ import print_function, division, absolute_import
import re
from . import testing, decorators
from . import errors, special, types, config
# Re-export typeof
from .special import *
from .errors import *
from .pycc.decorators import export, exp... | {
"content_hash": "cdb87ac6dcf47597bed07348c6d8d4b0",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 76,
"avg_line_length": 22.51685393258427,
"alnum_prop": 0.6691616766467066,
"repo_name": "pitrou/numba",
"id": "9b46bb61e7536b0669bc15244808f6a73fa4f7c7",
"size": "2004",
... |
from __future__ import unicode_literals
from django.db import models
from django.dispatch import receiver, Signal
from django.utils.translation import ugettext as _
from django_enumfield import enum
from metrics import Collection
from tasks.models import Task
from tasks.models import TaskStatus
from tasks.models impo... | {
"content_hash": "84bc853c5d847b3fd0e8d8931b6205fb",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 96,
"avg_line_length": 30.032258064516128,
"alnum_prop": 0.6323845327604726,
"repo_name": "harnash/sparrow",
"id": "3b653aed3b4235d888b18c6ba90213f1970ab887",
"size": "374... |
"""Support for interfacing with the XBMC/Kodi JSON-RPC API."""
import asyncio
from collections import OrderedDict
from functools import wraps
import logging
import re
import socket
import urllib
import aiohttp
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, MEDIA_PL... | {
"content_hash": "948d3acc14ef36d89a9315b408d6e068",
"timestamp": "",
"source": "github",
"line_count": 963,
"max_line_length": 79,
"avg_line_length": 35.63032191069574,
"alnum_prop": 0.5892399160643507,
"repo_name": "aequitas/home-assistant",
"id": "661ebd86187720ba1b880e08c7aac97dcc42ae27",
"size... |
from __future__ import unicode_literals
from future.builtins import bytes, str
from unittest import skipUnless
import warnings
from django.conf import settings as django_settings
from mezzanine.conf import settings, registry, register_setting
from mezzanine.conf.models import Setting
from mezzanine.utils.tests impor... | {
"content_hash": "40826fe2e7b680a91f883f949e35345b",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 79,
"avg_line_length": 39.60538116591928,
"alnum_prop": 0.6166213768115942,
"repo_name": "ryneeverett/mezzanine",
"id": "8e3b426479461b09e6b5f525e1342c820972ec8e",
"size":... |
import os
import sys
if __name__ == "__main__":
import os
from django.core.management import execute_from_command_line
os.environ["DJANGO_SETTINGS_MODULE"] = "lino_book.projects.workflows.settings"
execute_from_command_line(sys.argv)
| {
"content_hash": "76886df4a6059803f076b334abf08cab",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 82,
"avg_line_length": 25.3,
"alnum_prop": 0.7035573122529645,
"repo_name": "lino-framework/book",
"id": "a517409a8164911511d8848adb84721ebd1f99b1",
"size": "275",
"binar... |
import json
import os
import pgpm.lib.utils.db
import psycopg2
import psycopg2.extras
class GlobalConfiguration(object):
"""
stores properties of schema configuration
"""
description = ""
license = ""
owner_role = ""
user_roles = []
def __init__(self, default_config_path='~/.pgpmconf... | {
"content_hash": "7096b5e6badd59ac8654bf41abad9524",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 113,
"avg_line_length": 44.18390804597701,
"alnum_prop": 0.559573361082206,
"repo_name": "affinitas/pgpm",
"id": "80778f36c8f5b3f3bacfd678821e04043ab42f4c",
"size": "3844",... |
"""
module for accessing a USB HID YubiKey NEO
"""
# Copyright (c) 2012 Yubico AB
# See the file COPYING for licence statement.
__all__ = [
# constants
'uri_identifiers',
# functions
# classes
'YubiKeyNEO_USBHID',
'YubiKeyNEO_USBHIDError'
]
import struct
import binascii
from .yubico_version ... | {
"content_hash": "e9d35285e6319e12ef57380577ee0c82",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 119,
"avg_line_length": 30.662857142857142,
"alnum_prop": 0.5639209839731644,
"repo_name": "Yubico/python-yubico-dpkg",
"id": "0f4334a70a7f28b8b32fe0524d5b4c9439db45c1",
"... |
# Config
API_INTERFACE = 'mudbjson' #mudbjson, sspanelv2, sspanelv3, sspanelv3ssr, glzjinmod, legendsockssr, muapiv2(not support)
UPDATE_TIME = 60
SERVER_PUB_ADDR = '127.0.0.1' # mujson_mgr need this to generate ssr link
#mudb
MUDB_FILE = 'mudb.json'
# Mysql
MYSQL_CONFIG = 'usermysql.json'
# API
MUAPI_CONFIG = 'use... | {
"content_hash": "1786746e6c0900dad1d9b90404ce33ac",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 120,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.7283582089552239,
"repo_name": "xuwei95/shadowsocksr",
"id": "2dab5a3d2f8c79e580de62ad70969321b8e09e9b",
"size":... |
"""Extend the basic Accessory and Bridge functions."""
from __future__ import annotations
import logging
from pyhap.accessory import Accessory, Bridge
from pyhap.accessory_driver import AccessoryDriver
from pyhap.const import CATEGORY_OTHER
from pyhap.util import callback as pyhap_callback
from homeassistant.compone... | {
"content_hash": "2e8f7fab1398ff268dab3c9f2ab752d9",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 88,
"avg_line_length": 34.61295681063123,
"alnum_prop": 0.600758266545088,
"repo_name": "GenericStudent/home-assistant",
"id": "c77fa96a5322f46e9fe9561ba7a956ef94178f0d",
... |
from bioagents.tra import kappa_client
__all__ = ['TRA', 'get_ltl_from_pattern', 'apply_condition',
'get_create_observable', 'pysb_to_kappa', 'get_sim_result',
'get_all_patterns', 'TemporalPattern', 'TimeInterval',
'InvalidTemporalPatternError', 'InvalidTimeIntervalError',
'M... | {
"content_hash": "051aaf6c62670d57ad8f0c07bb1d3890",
"timestamp": "",
"source": "github",
"line_count": 743,
"max_line_length": 117,
"avg_line_length": 39.6514131897712,
"alnum_prop": 0.5487933199823496,
"repo_name": "bgyori/bioagents",
"id": "611f656c1414df4d959727682c92979dfd99a1b2",
"size": "294... |
from django.utils import simplejson
import taskforce
from taskforce.base import *
def spit_errors(fn):
def new_fn(*args, **kwargs):
try:
return fn(*args, **kwargs)
except Exception, e:
return simplejson.dumps({
'error':str(e),
})
return new_f... | {
"content_hash": "60f39f2ba7d4156b95638b0afff83547",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 67,
"avg_line_length": 24.853658536585368,
"alnum_prop": 0.6123650637880275,
"repo_name": "mallipeddi/django-taskforce",
"id": "b239a8c796a325c4769c95f1e8efea42b9c3e969",
"... |
"""
instabot example
Workflow:
Repost best photos from users to your account
By default bot checks username_database.txt
The file should contain one username per line!
"""
import argparse
import os
import sys
import random
from tqdm import tqdm
sys.path.append(os.path.join(sys.path[0], "../"))
fr... | {
"content_hash": "b755ac9fd305497503574d5773be0456",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 86,
"avg_line_length": 32.14912280701754,
"alnum_prop": 0.6567530695770805,
"repo_name": "instagrambot/instabot",
"id": "f9267df2f9209c3d2b6b5584ab07f8b2ebcf7af1",
"size":... |
from restclients_core import models
class Evaluation(models.Model):
section_sln = models.IntegerField()
eval_open_date = models.DateTimeField()
eval_close_date = models.DateTimeField()
is_completed = models.NullBooleanField()
eval_status = models.CharField(max_length=7)
eval_url = models.URLFi... | {
"content_hash": "3a4bf9984f12c0eb23e405a8fb72e8a3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 61,
"avg_line_length": 35.09090909090909,
"alnum_prop": 0.5867875647668394,
"repo_name": "uw-it-aca/uw-restclients",
"id": "abaaaa5f1420b8ac053318b285a0345ca4d00388",
"size... |
from typing import Dict, List
import Levenshtein_search
from .core import Enumerator
from .index import Index
class LevenshteinIndex(Index):
_doc_to_id: Dict[str, int] # type: ignore[assignment]
def __init__(self) -> None:
self.index_key = Levenshtein_search.populate_wordset(-1, [])
self._... | {
"content_hash": "01d7af9134ec81004f20907526b4dd67",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 90,
"avg_line_length": 33.75675675675676,
"alnum_prop": 0.6253002401921537,
"repo_name": "dedupeio/dedupe",
"id": "d49d74807ef108135e1a37204e5454bd341364c0",
"size": "1249"... |
from __future__ import absolute_import
import sure
from .. import Chain, NoApiKeyId, NoApiKeySecret, Webhook, update_webhook
from .mock_http_adapter import *
def test_update_webhook():
update_webhook(webhook_id=webhook_id, webhook_url=webhook_url,
api_key_id=api_key_id, api_key_secret=api_key_... | {
"content_hash": "366c3aa898dcad8fb70212591ba8ba89",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 27.716666666666665,
"alnum_prop": 0.6578472639807577,
"repo_name": "cardforcoin/chain-bitcoin-python",
"id": "23dbd91c509155e5dd5ff81d43f69cf85464dfaf"... |
__author__ = 'Sebastian Wernicke'
from ScrabbleBot import ScrabbleAI
from ScrabbleBot import ScrabbleGame
from ScrabbleBot import ScrabbleUtils
import random
class ScrabbleMatch:
def __init__(self, dictionary_file: str, player_list: list):
self._total_scores = dict()
self._total_matchwins = dic... | {
"content_hash": "3bf854968451fa49bc64888b67990532",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 119,
"avg_line_length": 35.810810810810814,
"alnum_prop": 0.5867924528301887,
"repo_name": "wernicke/ScrabbleBot",
"id": "11d1cd5d7313d422b54b1c638b5e4acbbeee3b65",
"size":... |
"""Tests for initializers in init_ops_v2."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import tenso... | {
"content_hash": "1dae57087c60a5d39c3fbbe229af76d0",
"timestamp": "",
"source": "github",
"line_count": 595,
"max_line_length": 80,
"avg_line_length": 34.023529411764706,
"alnum_prop": 0.6488342224856748,
"repo_name": "freedomtan/tensorflow",
"id": "d524f1e1fc3cc4e6fb3b9cc280efed7bbbb95d02",
"size"... |
from .compat import *
import binascii
#This code is shared with tackpy (somewhat), so I'd rather make minimal
#changes, and preserve the use of a2b_base64 throughout.
def dePem(s, name):
"""Decode a PEM string into a bytearray of its payload.
The input must contain an appropriate PEM prefix and postfix
... | {
"content_hash": "4f56fe20539f85a6e176f3f3fea8216d",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 37.177083333333336,
"alnum_prop": 0.6251050714485851,
"repo_name": "rysson/filmkodi",
"id": "548bc34d248bdb43edccd7049b54785bd29caab3",
"size": "3667... |
from mox3 import mox
from neutronclient.v2_0 import client
from oslotest import base
from kuryr.lib import binding
from kuryr.lib import constants as lib_const
from kuryr_libnetwork import app
from kuryr_libnetwork import constants as const
from kuryr_libnetwork import controllers
from kuryr_libnetwork import utils
... | {
"content_hash": "d686b1ce9691b986da67a4533b2cc976",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 97,
"avg_line_length": 38.195035460992905,
"alnum_prop": 0.5080308235075666,
"repo_name": "celebdor/kuryr-libnetwork",
"id": "b63e759c0668e31be03d86b2b70dbc10fd9c85cb",
"s... |
"""Contains the global :class:`.EventManager` instance."""
__all__ = ['eventMgr']
from . import EventManager
#: The global event manager.
eventMgr = EventManager.EventManager()
| {
"content_hash": "5b48ac6c804ec96db19fe4d399f4a1ec",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 58,
"avg_line_length": 22.5,
"alnum_prop": 0.7111111111111111,
"repo_name": "chandler14362/panda3d",
"id": "73a35b8ba52e719d2421918b8c0cf8c16bc9b942",
"size": "180",
"bina... |
from __future__ import absolute_import, division, print_function
import errno
import hashlib
import os
import shutil
import tempfile
from muninn._compat import string_types as basestring
from muninn._compat import path_utf8, encode, decode
class TemporaryDirectory(object):
def __init__(self, *args, **kwargs):
... | {
"content_hash": "e236e8149b18f073889b147d7877a49e",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 120,
"avg_line_length": 39.985074626865675,
"alnum_prop": 0.6364315042926465,
"repo_name": "stcorp/muninn",
"id": "c9f09691a0f924fb34a4138fed3d88b283069abb",
"size": "1077... |
"""Utilities for identifying local IP addresses."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import re
import socket
import subprocess
from subprocess import Popen, PIPE
from warnings import warn
LOCAL_IPS = []
PUBLIC_IPS = []
LOCALHOST = ''
... | {
"content_hash": "fdec0419e4130a2421e4e8b3e1edc4d3",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 97,
"avg_line_length": 28.72992700729927,
"alnum_prop": 0.5932418699186992,
"repo_name": "lancezlin/ml_template_py",
"id": "b0ffdb0491e81dafb8d8f5cee8d2933a8d9560f8",
"siz... |
from automaton import exceptions as automaton_exceptions
from automaton import machines
import six
"""State machine modelling.
This is being used in the implementation of:
http://specs.openstack.org/openstack/ironic-specs/specs/kilo/new-ironic-state-machine.html
"""
from ironic.common import exception as excp
from... | {
"content_hash": "828a9cabd042130d996d63a68f22e7dc",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 90,
"avg_line_length": 37.638888888888886,
"alnum_prop": 0.6201722017220173,
"repo_name": "Tan0/ironic",
"id": "4076f8241d921e2d391ca0b2f680322dd3ffd21d",
"size": "4722",
... |
import asyncio
from itertools import chain
from typing import Any, List
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.routing
import tornado.template
import tornado.web
from tornado.options import define, options
from bgmi.config import FRONT_STATIC_PATH, IS_WINDOWS, SAVE_PATH,... | {
"content_hash": "6fd920c2205b45782719370a01c4206a",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 92,
"avg_line_length": 32.263888888888886,
"alnum_prop": 0.6198880757640981,
"repo_name": "BGmi/BGmi",
"id": "7057fb430345bea8d7312da27072fc9e1cd6c775",
"size": "2323",
"... |
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: pil.py 163 2006-11-13 04:15:46Z Alex.Holkner $'
import sys
from ctypes import *
from pyglet.gl import *
from pyglet.image import *
from pyglet.image.codecs import *
from pyglet.window.carbon import carbon, quicktime, _oscheck
from pyglet.window.carbon.... | {
"content_hash": "38b47a030a527ea59ea0c6281035cf27",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 80,
"avg_line_length": 32.003937007874015,
"alnum_prop": 0.5936769590355517,
"repo_name": "Codlydodly/python-client",
"id": "7fb39e84f59f824fe893276c1abedfc47937dee0",
"si... |
import datetime
import time
import re
class AmbiguousLookup(ValueError):
pass
class NoMatch(ValueError):
pass
def complete(it, lookup, key_desc):
partial_match = None
for i in it:
if i == lookup:
return i
if i.startswith(lookup):
if partial_match is not None:
... | {
"content_hash": "f5286b9db725ca15565cd3167d65b4a2",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 74,
"avg_line_length": 33.54545454545455,
"alnum_prop": 0.5365853658536586,
"repo_name": "vogdan/timebook",
"id": "dbe33a3677a846a1e78fbe3b33ff54f922b213a6",
"size": "3328"... |
from streamsx.topology.topology import *
import streamsx.topology.context
from streamsx.topology.schema import *
import sys
import pytest_funcs
def main():
tkdir = sys.argv[1]
topo = Topology("json_map_json")
ts = topo.subscribe("pytest/json/map", schema=CommonSchema.Json)
ts = ts.map(pytest_funcs.json_add... | {
"content_hash": "a0d768f6bf6a995c00eb0c5872632ccc",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 21.96,
"alnum_prop": 0.7085610200364298,
"repo_name": "IBMStreams/streamsx.topology",
"id": "feddbd1b508f64c0c17d20c94d52b0be5a037f36",
"size": "615"... |
from django.utils.html import strip_tags
class Highlighter(object):
css_class = 'highlighted'
html_tag = 'span'
max_length = 200
text_block = ''
def __init__(self, query, **kwargs):
self.query = query
if 'max_length' in kwargs:
self.max_length = int(kwargs... | {
"content_hash": "385b40ffa9699542f19286408d0e24bb",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 105,
"avg_line_length": 36.98136645962733,
"alnum_prop": 0.5290560967416863,
"repo_name": "hellhovnd/django-haystack",
"id": "1ede8036ae9b2d74f3db9c4219d8309c644fafab",
"s... |
from .lims_calibratorsAndMixes_io import lims_calibratorsAndMixes_io
class lims_calibratorsAndMixes_execute(lims_calibratorsAndMixes_io):
pass; | {
"content_hash": "37d3adcf276454e169bf56a63e0ee564",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 68,
"avg_line_length": 37,
"alnum_prop": 0.8378378378378378,
"repo_name": "dmccloskey/SBaaS_LIMS",
"id": "833f7f46d0039b17a4e65e0056b2bc9576256aa8",
"size": "149",
"binary... |
import enum
class SeverityNumber(enum.Enum):
"""Numerical value of severity.
Smaller numerical values correspond to less severe events
(such as debug events), larger numerical values correspond
to more severe events (such as errors and critical events).
See the `Log Data Model`_ spec for more in... | {
"content_hash": "a5b3171608e18de7df74d0fbd00f4a04",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 149,
"avg_line_length": 26.207920792079207,
"alnum_prop": 0.6728371741594258,
"repo_name": "open-telemetry/opentelemetry-python",
"id": "25703759909483b60e871fd05d15a5bedeed... |
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
"""example_dasch_methods.py.
"""
import numpy as np
import abel
import matplotlib.pyplot as plt
# Dribinski sample image size 501x501
n = 501
IM = abel.tools.analytical.sample_image(n)
# split into quadrant... | {
"content_hash": "b612a123c8baa29ba8bc6d1e2cc9ec24",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 77,
"avg_line_length": 29.78846153846154,
"alnum_prop": 0.7256294383473209,
"repo_name": "rth/PyAbel",
"id": "0d75ae16e1e05beab69e70e59968522445a47f9b",
"size": "1573",
"... |
'''
Simple RPC
Copyright (c) 2012-2013, LastSeal S.A.
'''
from simplerpc.common.python3 import portable_getargspec
from simplerpc.expose_api.javascript.base import JsTranslatorBase
from simplerpc.base.SimpleRpcLogicBase import SimpleRpcLogicBase
from simplerpc.expose_api.javascript.data_model import TranslationAstNode,... | {
"content_hash": "ae23d783843ff8a941eb1eb0ab6e6793",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 86,
"avg_line_length": 39.53488372093023,
"alnum_prop": 0.6402941176470588,
"repo_name": "joaduo/python-simplerpc",
"id": "84ee38c754a4cb8196b9986cca415f5135dd19ea",
"size"... |
'''
The MIT License (MIT)
Copyright (c) 2007 ~ 2015, Hong-She Liang <starofrainnight@gmail.com>.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation... | {
"content_hash": "8c8a7f19c57ebe406d4d2b139305e594",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 87,
"avg_line_length": 27.931818181818183,
"alnum_prop": 0.6362896663954435,
"repo_name": "starofrainnight/u8gettext",
"id": "7f386e0579c448f67b4ce4a024115dfd7cfd9ba5",
"s... |
import time
import yaml
import os
import sys
import requests
import re
import json
#define access levels, as per the gitlab documentation
access_levels = {}
access_levels['GUEST'] = 10
access_levels['REPORTER'] = 20
access_levels['DEVELOPER'] = 30
access_levels['MASTER'] = 40
access_levels['OWNER'] = 50
try:
confi... | {
"content_hash": "61c1666d57d7df8744ebcd6471c04d19",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 138,
"avg_line_length": 30.941747572815533,
"alnum_prop": 0.5723250705993097,
"repo_name": "Verigreen/demo",
"id": "c1afd9d14496db65a53682edc347917250299d0b",
"size": "642... |
import sys, os, signal, time, shutil, cgi
import commands, re
import urllib
import json
import traceback
from xml.dom import minidom
from xml.dom.minidom import Document
from xml.dom.minidom import parse, parseString
# Initialize the configuration singleton
import environment
env = environment.set_environment()
from... | {
"content_hash": "2b27c156aa07dd8b8544447352e76daf",
"timestamp": "",
"source": "github",
"line_count": 4704,
"max_line_length": 225,
"avg_line_length": 37.37308673469388,
"alnum_prop": 0.5488188483700506,
"repo_name": "anisyonk/pilot",
"id": "676ad80c24f607a0765fb929f03e5c664a82a536",
"size": "175... |
master_doc = "index"
extensions = ["sphinx.ext.autodoc", "uqbar.sphinx.book"]
html_static_path = ["_static"]
uqbar_book_console_setup = ["import supriya"]
uqbar_book_extensions = [
"uqbar.book.extensions.GraphExtension",
"supriya.ext.book.RenderExtension",
]
uqbar_book_strict = True
uqbar_book_use_black = Tr... | {
"content_hash": "8ecd263ba6373cc5ceede741a4241b77",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 24.846153846153847,
"alnum_prop": 0.7120743034055728,
"repo_name": "Pulgama/supriya",
"id": "25b389c43b288b81bb100b053869061277dc9df7",
"size": "323"... |
from tools import lines
import unittest
import os.path
class TestLines(unittest.TestCase):
FILE = os.path.join(os.path.dirname(__file__), "../modules/resources/bag.txt")
N = 100
def test_LinesSeq(self):
self.do_test(lines.LinesSeq)
def test_LinesSeqRnd(self):
self.do_test(lines.LinesS... | {
"content_hash": "cc25d17cdd5ec5efcd507ec804477d04",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 82,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.595,
"repo_name": "mamaddeveloper/telegrambot",
"id": "9c0b1d0bab015ecead4acc82e7611c2f826c5cf8",
"size": "600",
... |
import logging
import urllib2
try:
from urllib2 import quote as urllib_quote
except ImportError:
from urllib import quote as urllib_quote
from reviewboard.diffviewer.parser import DiffParser, DiffParserError
from reviewboard.scmtools.git import GitDiffParser
from reviewboard.scmtools.core import \
FileNot... | {
"content_hash": "50fdd7642939ce060d19b72098952046",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 79,
"avg_line_length": 36.14942528735632,
"alnum_prop": 0.5319554848966613,
"repo_name": "chazy/reviewboard",
"id": "36da32197c3f9f3931e7966eba92b857960661ac",
"size": "94... |
"""
boards module models
"""
import logging
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from django.utils.functional import cached_proper... | {
"content_hash": "e05226d96e0c973d32df216eda24a8ae",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 78,
"avg_line_length": 30.134556574923547,
"alnum_prop": 0.558859346458291,
"repo_name": "pawelad/zenboard",
"id": "69bb6b6d2f33b74dd2d2c922e3265947a38ad3b8",
"size": "985... |
from __future__ import print_function, absolute_import
import numpy as np
from keras.optimizers import Adam, SGD
from keras.models import Model, Sequential #, model_from_json
from keras.regularizers import l2
from keras.layers import Input, Dense, Dropout, Flatten, Activation, ELU
from keras.layers.normalization impo... | {
"content_hash": "e6c47d0c6ecb38330bf37a5e5f8e10eb",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 175,
"avg_line_length": 38.764309764309765,
"alnum_prop": 0.6631633805263615,
"repo_name": "babraham123/deepdriving",
"id": "f06ba745c602c92e191cedf71958a0a26fde0f4f",
"si... |
from typing import Dict
import pytest
DEMISTO_ARGS: Dict = {"stripSubject": 'True',
"escapeColons": 'False',
"searchThisWeek": 'true',
"from": "my_test_mail@test.com",
"subject": "test",
"body": "this is a tes... | {
"content_hash": "6159bc8061ae816bf3a3936b4c851fff",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 119,
"avg_line_length": 29.9,
"alnum_prop": 0.5875139353400223,
"repo_name": "demisto/content",
"id": "aa8d702e7fb1b5e7943d05a77c368f68afab0f39",
"size": "897",
"binary":... |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from model_utils.models import TimeStampedModel
class Vote(TimeStampedModel):
VALUES = Choices(
(1, "not_interested", _("Not Interested")),
(2, "may... | {
"content_hash": "a52ad584be41c646de2baad031594256",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 81,
"avg_line_length": 27.76923076923077,
"alnum_prop": 0.6048014773776547,
"repo_name": "patrick91/pycon",
"id": "70e613082d7a8e20260c04f14c19bdb174137918",
"size": "1083"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.