text stringlengths 4 1.02M | meta dict |
|---|---|
from oslo_utils import uuidutils
from cinder.tests.functional import functional_helpers
from cinder.volume import configuration
class GroupsTest(functional_helpers._FunctionalTestBase):
_vol_type_name = 'functional_test_type'
_grp_type_name = 'functional_grp_test_type'
osapi_version_major = '3'
osapi... | {
"content_hash": "0deb7b8efc7856d88cc07d46930e32b3",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 41.03061224489796,
"alnum_prop": 0.5901517035563293,
"repo_name": "Datera/cinder",
"id": "13f22b1795aa168501015798e75d4e47f17bf0e7",
"size": "4652",
... |
def extractStrayCats(item):
"""
'StrayCats'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = [
('Virtual World: The Legendary Thief', 'Virtual World: The Legendary Thief', ... | {
"content_hash": "9a15b8f69f5be8a9d0084f0920efb6c7",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 129,
"avg_line_length": 41,
"alnum_prop": 0.6277278562259306,
"repo_name": "fake-name/ReadableWebProxy",
"id": "129af07982dca27156e85a2a71aad79c0d69b2e0",
"size": "779",
... |
"""
This module implements functionality required by master processes, such as
starting new contexts via SSH. Its size is also restricted, since it must
be sent to any context that will be used to establish additional child
contexts.
"""
import dis
import imp
import inspect
import itertools
import logging
import os
im... | {
"content_hash": "2fb8165964c5c33fb2cb8c8f83d5e673",
"timestamp": "",
"source": "github",
"line_count": 767,
"max_line_length": 79,
"avg_line_length": 32.559322033898304,
"alnum_prop": 0.5625675729788171,
"repo_name": "edwinsteele/biblebox-pi",
"id": "d057f7f19d9f2b90223fc889d9a53ed5f7ca9b59",
"siz... |
"""
@brief test log(time=33s)
"""
import os
import unittest
import platform
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import ExtTestCase
from pyquickhelper.ipythonhelper import test_notebook_execution_coverage
import cpyquickhelper
class TestRunNotebooksPython(ExtTestCase):
@unitte... | {
"content_hash": "3e7a2fece0acf57b79b82b37e66e352a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 72,
"avg_line_length": 31.8,
"alnum_prop": 0.5786163522012578,
"repo_name": "sdpython/cpyquickhelper",
"id": "cc2b6491077a14d7d44ca5760b710a92ddab5f8f",
"size": "1773",
"... |
from msrest.serialization import Model
class ResourceUpdate(Model):
"""The Resource model definition.
:param tags: Resource tags
:type tags: dict[str, str]
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
}
def __init__(self, **kwargs):
super(ResourceUpda... | {
"content_hash": "05b92bffcd605a0160a6abcaee128765",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 54,
"avg_line_length": 23.176470588235293,
"alnum_prop": 0.5786802030456852,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "182590bbdd32fc7877b43645f319e68ed7cf4bd1",
... |
import theano.tensor as T
class JointAE(object):
def __init__(self, num_vis, num_hiddens, layer_types, autoencoder_act_funcs,
output_act_func, initializer,
cost_class, tie_weights,
init_params, **kargs):
self.hidden_layers = []
self.params... | {
"content_hash": "d46f3272b9eb2c4ea7c48c7837db24dc",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 80,
"avg_line_length": 35.44565217391305,
"alnum_prop": 0.4446488807114382,
"repo_name": "ybzhou/JointAE",
"id": "2ef627aba6f3c74e970fb0752639e9da440b0763",
"size": "3261",... |
"""
Get frequency data on 2-grams
"""
import conceptual_spaces
conceptual_spaces.bigram_data("POS_ONLY", "Round2")
| {
"content_hash": "c7959528f212054d0b342d1773343da1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 51,
"avg_line_length": 16.714285714285715,
"alnum_prop": 0.7264957264957265,
"repo_name": "hmillerbakewell/studious-octo-invention",
"id": "691dd592ae2660fe2d5793e9bdbf10bb89d... |
from jenkinsflow.flow import serial
from .framework import api_select
def test_multi_level_mixed(api_type):
with api_select.api(__file__, api_type) as api:
api.flow_job()
_params = (('password', '', 'Some password'), ('s1', '', 'Some string argument'))
api.job('job-1', max_fails=0, expect_... | {
"content_hash": "175948da37764a5df566e64ab41c954b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 104,
"avg_line_length": 56.9,
"alnum_prop": 0.6051552431165788,
"repo_name": "lhupfeldt/jenkinsflow",
"id": "8a2181c2555b62c89bd3075b997fb93470359fa4",
"size": "1845",
"b... |
import logging
import json
import requests
import xmltodict
import random
import string
import hashlib
# django modules
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils import timezone
# local modules
from app import models
from app.utils import random_string, get_reques... | {
"content_hash": "a2377dfcfae3794e00bc5919ba64cad6",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 133,
"avg_line_length": 38.877742946708466,
"alnum_prop": 0.6073213997742299,
"repo_name": "malaonline/Server",
"id": "505758ba032fb34c74cc515287a07d0ff1e01e3e",
"size": "... |
import unittest
from mock import Mock, patch
from airflow.models import Pool
from airflow.ti_deps.deps.pool_slots_available_dep import STATES_TO_COUNT_AS_RUNNING, PoolSlotsAvailableDep
from airflow.utils.db import create_session
from tests.test_utils import db
class TestPoolSlotsAvailableDep(unittest.TestCase):
... | {
"content_hash": "088be3c949947111042da26303561bea",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 107,
"avg_line_length": 36.74418604651163,
"alnum_prop": 0.6822784810126582,
"repo_name": "Fokko/incubator-airflow",
"id": "ff8d1502d90dedef4b6877d12b0dc2144042d8d9",
"size... |
"""
As you guess, utils module contains some useful tools.
"""
from __future__ import unicode_literals, print_function
from __future__ import absolute_import
import os, codecs, md5
def smartwrite(data, target):
"""A smart writer.
Not going to write if data is equal to target's data. Create folder
if ta... | {
"content_hash": "cfa9fcf72c142ad5375f59abfcec87d5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 72,
"avg_line_length": 30.37037037037037,
"alnum_prop": 0.6195121951219512,
"repo_name": "lingyunyumo/PyLinden",
"id": "86335f1fb19652ab35c037bae92f43567b1e6331",
"size": "... |
import defcon
from fontParts.base import BaseGuideline
from fontParts.fontshell.base import RBaseObject
class RGuideline(RBaseObject, BaseGuideline):
wrapClass = defcon.Guideline
def _init(self, wrap=None):
if wrap is None:
wrap = self.wrapClass()
wrap.x = 0
wrap.... | {
"content_hash": "35c3023762b963e8c282f21e39ff4d1f",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 48,
"avg_line_length": 19.675,
"alnum_prop": 0.5470139771283354,
"repo_name": "robofab-developers/fontParts",
"id": "03f3e46de2c111dff8d23f21d216bac43ebc31bc",
"size": "157... |
from dock.core import incoming, outgoing
| {
"content_hash": "8e144184dcd8d53e47ec7f4520f52b32",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 41,
"alnum_prop": 0.8292682926829268,
"repo_name": "ravidziv/dock",
"id": "bccce1611c4c39efdecd62219bbd4423e9ace2fb",
"size": "41",
"binary": false,... |
"""
Backtracking TL synthesis implementation for gridworlds.
Scott C. Livingston,
2011, 2012.
"""
from automaton import BTAutomaton, BTAutomatonNode
from gridworld import *
import itertools
import copy
import numpy as np
import tulip.gr1cint
import tulip.jtlvint
from tulip.spec import GRSpec
def create_nominal(W, ... | {
"content_hash": "9ece7643675eeb277e4d1b359cb6fba4",
"timestamp": "",
"source": "github",
"line_count": 1292,
"max_line_length": 220,
"avg_line_length": 42.44969040247678,
"alnum_prop": 0.5342146047953323,
"repo_name": "slivingston/btsynth",
"id": "a19b021f8244988f9f1e2363b924492ab0a35cd8",
"size":... |
import os
from werkzeug.datastructures import FileStorage
from shuttl.Models.FileTree.Directory import Directory
from shuttl.Models.FileTree.FileObjects.Template import Template
from shuttl.Models.FileTree.Webpage import Webpage
from shuttl.tests import testbase
from shuttl import app
from shuttl.Models.Reseller impor... | {
"content_hash": "a456a80d05ed992964fe7567a365a539",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 127,
"avg_line_length": 52.813559322033896,
"alnum_prop": 0.6976893453145058,
"repo_name": "shuttl-io/shuttl",
"id": "e6aa6923cac0bed757198c3ee991e37727446965",
"size": "31... |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='store_true')
command = parser.add_subparsers(help='commands')
commandA = command.add_parser('A')
commandA.add_argument('-a','--aye', help='command attribute')
operations = commandA.add_subparsers(help='operations')
o... | {
"content_hash": "2d02bd5d4bbf6f2864565e870d84497a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 22.75,
"alnum_prop": 0.7208791208791209,
"repo_name": "eddo888/Tools",
"id": "ddfb4cb74440d49a6743113765bd9850fcb613a6",
"size": "479",
"binary": f... |
from robotide.lib.robot.errors import DataError
from robotide.lib.robot.utils import plural_or_not, seq2str
from robotide.lib.robot.variables import is_list_var
class ArgumentValidator(object):
def __init__(self, argspec):
""":type argspec: :py:class:`robot.running.arguments.ArgumentSpec`"""
self... | {
"content_hash": "8ff3d57a8f2252166a6e57f33f6c91a6",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 47.388888888888886,
"alnum_prop": 0.5943728018757327,
"repo_name": "robotframework/RIDE",
"id": "7366bd0fa90c7f04fd5ff248a35d80b1122ee618",
"size": "... |
import os
import unittest
from config import basedir
from app import app, db
from app.models import User, Post
from datetime import datetime, timedelta
class TestCase(unittest.TestCase):
def test_follow_posts(self):
# make 3 monkeys and 1 to test delete
u1 = User(nickname='alex', email='alex@a.co... | {
"content_hash": "48df828d025c95b5389dc78526515232",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 94,
"avg_line_length": 31.162790697674417,
"alnum_prop": 0.5970149253731343,
"repo_name": "dysya92/monkeys",
"id": "e86ba4a0f93dd9f7bd6e37b6cdc27b30819f3199",
"size": "1359... |
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
# max size of lookup table size
max_lookup_tab_size = 65537
# node name hashing function
def str_hash(name):
return abs(hash(name))
class maglev_hash:
backends_num = 13 # => N
lookuptab_size = 5 # => M
permutation = ... | {
"content_hash": "d85545e991fe8f7c0ed29f00b847b0d1",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 100,
"avg_line_length": 36.224489795918366,
"alnum_prop": 0.5703286384976526,
"repo_name": "feelkill/feelkill.github.io",
"id": "55cd656d06f44860edd035d57f9b8c5c1ca12afa",
... |
"""JSON parser/serializer for Python.
The main implementation of this module is accessed through calls to
``read()`` and ``write()``. See their documentation for details.
"""
__author__ = "John Millikin <jmillikin@gmail.com>"
__version__ = (1, 6, 1)
__license__ = "GPL"
__all__ = [
'loads', 'dumps', 'read', '... | {
"content_hash": "6d0c28c204eaf16eeaa915e16e2ffe30",
"timestamp": "",
"source": "github",
"line_count": 829,
"max_line_length": 85,
"avg_line_length": 31.623642943305185,
"alnum_prop": 0.5480241074153189,
"repo_name": "hudora/huTools",
"id": "8e4cedc25879a06fdd9e97164ee3b5e0fda92a11",
"size": "2689... |
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of Scrapy nor the names of its contributors may be used
#... | {
"content_hash": "8d85baf635a794f084bd2f9d1b474927",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 92,
"avg_line_length": 40.411764705882355,
"alnum_prop": 0.7176128093158661,
"repo_name": "bcajes/pipeable",
"id": "c3f6080de884f874a61cd3976bb4e4f6d9f3995b",
"size": "2567... |
from setuptools import find_packages, setup
import os.path
import sys
import os
if os.environ.get('distutils_issue8876_workaround_enabled', False):
# sdist_hack: Remove reference to os.link to disable using hardlinks when
# building setup.py's sdist target. This is done because
# V... | {
"content_hash": "ee6112d476ecd4498c4f92803bdc5af4",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 89,
"avg_line_length": 29.47761194029851,
"alnum_prop": 0.6587341772151899,
"repo_name": "ponty/sphinxcontrib-eagle",
"id": "ed2947a5256f05f86a3a60f5b9d2304d86321e7f",
"siz... |
"""
Script to print potentially missing source dependencies based on the actual
.h and .cc files in the source tree and which files are included in the gyp
and gn files. The latter inclusion is overapproximated.
TODO(machenbach): Gyp files in src will point to source files in src without a
src/ prefix. For simplicity,... | {
"content_hash": "af4ad7e54ae47d8e9fdd0f3e17be9671",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 78,
"avg_line_length": 28.782178217821784,
"alnum_prop": 0.6580667354661163,
"repo_name": "kingland/runtime",
"id": "56e3156550aa4c07bac6e87445a0d82f472366c5",
"size": "30... |
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# create an n1dim by n2dim by n3dim random array.
n1dim = 30
n2dim = 15
n3dim = 73
n4dim = 144
ntrials = 10
sys.stdout.write('reading and writing a %s by %s by %s by %s random array ..\n'%(n1dim,n2dim,n3dim,n4dim))
sys.stdou... | {
"content_hash": "95e2560944e6b7f4f9b7205d85c50cb5",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 106,
"avg_line_length": 39.73015873015873,
"alnum_prop": 0.6360367558929285,
"repo_name": "Unidata/netcdf4-python",
"id": "03919985ec893206648a1aec9617dbea08a9b2d0",
"size"... |
from setuptools import setup
setup(
name='ringmq',
version='0.1',
url='http://github.com/mar29th/ring',
author='Douban Inc.',
author_email='platform@douban.com',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: System :: Netw... | {
"content_hash": "2c1b1ed3b5c91c733c1dd9f8956e1715",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 61,
"avg_line_length": 30.761904761904763,
"alnum_prop": 0.5975232198142415,
"repo_name": "mar29th/ring",
"id": "ed624e5c78356425b76cdc5841fa6074f5939fa0",
"size": "646",
... |
"""
=====================================
:mod:`topologies` -- Swarm topologies
=====================================
This module defines various topologies for swarm intelligence algorithms.
Particle swarms make use of topologies, which determine the logical
relationships among partic... | {
"content_hash": "2ff805fea7f5db6fc3e9ddb5f1ae2e1f",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 83,
"avg_line_length": 39.618556701030926,
"alnum_prop": 0.6695290137913089,
"repo_name": "saulshanabrook/pushgp.py",
"id": "c166b6d8fe84e2013b164f9e34bb1e30cc41b2f6",
"siz... |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
setup(
name='ph_py',
# Versions should comply with P... | {
"content_hash": "79b6bd76f02534834d216be22bcc28bc",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 169,
"avg_line_length": 40.392405063291136,
"alnum_prop": 0.6806643685365089,
"repo_name": "anatg/ph_py",
"id": "f28841053fb7cdef753faff30e89349733902e72",
"size": "3191",
... |
"""
LAS
===
This file defines the classes and functions necessary to read and write LAS
Version 2.0 [1]_ files.
References
----------
.. [1] LAS Version 2.0:
http://www.cwls.org/wp-content/uploads/2014/09/LAS_20_Update_Jan2014.pdf
"""
import numpy as np
from collections import OrderedDict
try:
import builti... | {
"content_hash": "e33b99d838781887e4df505b7e7b8663",
"timestamp": "",
"source": "github",
"line_count": 1125,
"max_line_length": 120,
"avg_line_length": 35.63911111111111,
"alnum_prop": 0.5480371127849554,
"repo_name": "giruenf/GRIPy",
"id": "0992aa6c2a264d666088426004935724e1ade8a8",
"size": "4011... |
"""
Contains the core classes and functionality that makes Horizon what it is.
This module is considered internal, and should not be relied on directly.
Public APIs are made available through the :mod:`horizon` module and
the classes contained therein.
"""
import collections
import copy
import inspect
import logging
... | {
"content_hash": "114db7171407634c978adab823180344",
"timestamp": "",
"source": "github",
"line_count": 1000,
"max_line_length": 79,
"avg_line_length": 38.428,
"alnum_prop": 0.5918601020089518,
"repo_name": "Tesora/tesora-horizon",
"id": "04123afdb0b1cdfe9a627d9fcacaf87e8d6ea2dd",
"size": "39033",
... |
from plenum.common.constants import TRUSTEE, STEWARD
from indy_common.auth import Authoriser
from indy_common.constants import VALIDATOR_INFO
def test_permission_for_validator_info(role):
authorized = role in (TRUSTEE, STEWARD)
assert authorized == Authoriser.authorised(typ=VALIDATOR_INFO,
... | {
"content_hash": "3948296d540b26035e35ef53cbab9430",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 36.8,
"alnum_prop": 0.6902173913043478,
"repo_name": "spivachuk/sovrin-node",
"id": "6e2be97bc1051794d9666956d21c804b151bf0e4",
"size": "368",
"bin... |
from src.base.test_cases import TestCases
class PerfectSquaresTestCases(TestCases):
def __init__(self):
super(PerfectSquaresTestCases, self).__init__()
self.__add_test_case__("Example 1", 12, 3)
self.__add_test_case__("Example 2", 13, 2) | {
"content_hash": "00e58a5d5829ea1f90fb895d2c4758e7",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 33.375,
"alnum_prop": 0.6404494382022472,
"repo_name": "hychrisli/PyAlgorithms",
"id": "54310ea3fb5e155e275df928f27e9929de553326",
"size": "267",
"b... |
from msrest.serialization import Model
class FailoverGroupReadOnlyEndpoint(Model):
"""Read-only endpoint of the failover group instance.
:param failover_policy: Failover policy of the read-only endpoint for the
failover group. Possible values include: 'Disabled', 'Enabled'
:type failover_policy: str... | {
"content_hash": "5bcd9ff0e17795523b6c167025ff162b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 34,
"alnum_prop": 0.6934984520123839,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "be2fed191312a8ca68215c3877be041c3394c5a9",
"size": "1120... |
"""HTTP server classes.
Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see
SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST,
and CGIHTTPRequestHandler for CGI scripts.
It does, however, optionally implement HTTP/1.1 persistent connections,
as of version 0.3.
Notes on CGIHTT... | {
"content_hash": "e9d82ee43617a36966a16dba5c240577",
"timestamp": "",
"source": "github",
"line_count": 1245,
"max_line_length": 100,
"avg_line_length": 37.24096385542169,
"alnum_prop": 0.575520327833495,
"repo_name": "Bjay1435/capstone",
"id": "cfa29f44d351cfd3ac6e8ea05d18b6d43c148e2b",
"size": "4... |
"""
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example shows characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. With the exception ... | {
"content_hash": "8995162ebf50b69b9c20f02201375541",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 87,
"avg_line_length": 29.810606060606062,
"alnum_prop": 0.5515883100381195,
"repo_name": "betatim/scikit-learn",
"id": "c27c1f2d45ce3a6edf8c8988ca9f4f1afd3e5b54",
"size":... |
import sys
#sys.path.insert(0, "../")
#from pyes import ES
from pyes.es import ES
from datetime import datetime
import shelve
conn = ES('127.0.0.1:9500')
#conn = ES('192.168.2.50:9200')
try:
conn.delete_index("test-index")
except:
pass
dataset = shelve.open("samples.shelve")
mapping = {u'description': {'boo... | {
"content_hash": "b3e3d1cba8daa3128d3177a77ced90ec",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 70,
"avg_line_length": 27.377777777777776,
"alnum_prop": 0.5146103896103896,
"repo_name": "aparo/pyes",
"id": "de4c1fc7ba917a0bcca9c1f7f0e3e59180d390be",
"size": "1232",
... |
from pbr import version
version_info = version.VersionInfo('driverlog')
| {
"content_hash": "79105e08cab3d22800b7acb5f6adbafd",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 47,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.7945205479452054,
"repo_name": "tracyajones/driverlog",
"id": "19e8e5c80fc07c4b65fb0cd4fa25cbfd14736ade",
"size": ... |
from setuptools import setup
setup(
name = 'fastmc',
version = '1.8.0-alpha1',
description = 'Fast Minecraft Protocol Parser/Writer',
author = 'Florian Wesch',
author_email = 'fw@dividuum.de',
packages = ['fastmc'],
license = 'BSD2',
install_requires = ['requests', 'pycrypto', 'simplejs... | {
"content_hash": "1f7046c9d18a0534b04da629b61bf142",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 26.846153846153847,
"alnum_prop": 0.6246418338108882,
"repo_name": "dividuum/fastmc",
"id": "e3389705d29743c4c8c15003deb44eecf5a15cae",
"size": "349"... |
import sys
from . import parser
import wamcompiler
import waminterpreter
import factplugin
if __name__ == "__main__":
rules = parser.RuleCollection()
rules.add(parser.Parser().parseRule('p(X,Y) :- spouse(X,Y) {r}.'))
rules.listing()
wp = wamcompiler.Compiler().compileRules(rules)
wp.listing()
... | {
"content_hash": "e434f226a59040a1c0a94b3a6cfe4a8d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 29.3,
"alnum_prop": 0.6723549488054608,
"repo_name": "TeamCohen/TensorLog",
"id": "b5d2cde9222de6c2b222fa76c882f22ec7b16a69",
"size": "647",
"binar... |
"""Convert a spreadsheet CAH from
http://boardgamegeek.com/thread/947849/hopefully-more-than-complete-listing-of-all-offici
https://docs.google.com/spreadsheet/ccc?key=0Ajv9fdKngBJ_dHFvZjBzZDBjTE16T3JwNC0tRlp6Wnc#gid=10
https://docs.google.com/spreadsheet/ccc?key=0Ajv9fdKngBJ_dHFvZjBzZDBjTE16T3JwNC0t... | {
"content_hash": "19acaff8df3743da56c66e7284fc05c1",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 171,
"avg_line_length": 29.87845303867403,
"alnum_prop": 0.6022559171597633,
"repo_name": "phildini/cards-against-django",
"id": "f1cb40fe78d1afa73c33a775350a8c16dae639c9",
... |
import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.... | {
"content_hash": "c27944c359cb53c2cb923c884dc7a850",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 255,
"avg_line_length": 46.5414201183432,
"alnum_prop": 0.6579683427626979,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a12bedcc72c961bc1a8b78713111e6cfc2ff2c07",
"s... |
from M2Crypto import SMIME, X509
# Instantiate an SMIME object.
s = SMIME.SMIME()
# Load the signer's cert.
x509 = X509.load_cert('mycert.pem')
sk = X509.X509_Stack()
sk.push(x509)
s.set_x509_stack(sk)
# Load the signer's CA cert. In this case, because the signer's
# cert is self-signed, it is the signer's cert itse... | {
"content_hash": "560734ccaba988ae19b186a4ed332901",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 63,
"avg_line_length": 23.347826086956523,
"alnum_prop": 0.7094972067039106,
"repo_name": "joschi/jersey-smime",
"id": "f550d8dbdc024bdeac2d515ae87378b8b3f3161a",
"size": "... |
import re
class Key(object):
def __init__(self, key="", start="", end=""):
self.key = key
self.start = start
self.end = end
def is_match(self, line="", key=""):
val = []
match = re.search(key, line)
if match:
val = match.groups()
m = Tr... | {
"content_hash": "7e6a22329a5a0ead4d1f5454e8a2598f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 49,
"avg_line_length": 18.025,
"alnum_prop": 0.47711511789181693,
"repo_name": "fmichalo/n9k-programmability",
"id": "1d38ed7e8993f2afd8f1044494cbc56288adf125",
"size": "78... |
from axon.test import *
test_all()
| {
"content_hash": "32b89092c0c0d401e863eddfde5c4eeb",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 23,
"avg_line_length": 9.25,
"alnum_prop": 0.6756756756756757,
"repo_name": "intellimath/pyaxon",
"id": "c96c5f25179f5e1e8bb91eabacb4cf6e17d03c30",
"size": "1213",
"binary... |
from django.test import TestCase
from django.conf import settings
from .. import fields
from models import *
from datetime import date
incoming_markdown = "**bold**, *italic*"
gen_html = "<p><strong>bold</strong>, <em>italic</em></p>"
class AutoMarkdownTests(TestCase):
def setUp(self):
self.m = TestAutoD... | {
"content_hash": "e2b4e55d9a8b1f85fff3118fa45e7c98",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 59,
"avg_line_length": 30.566176470588236,
"alnum_prop": 0.612942025499158,
"repo_name": "lygaret/django-autofields",
"id": "d55dda708b14770945e0676691a296378b570ba7",
"si... |
from __future__ import with_statement
import os
import sys
import types
from datetime import datetime
# 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 absolu... | {
"content_hash": "5d14e3209fcd14f4243f9edfa0ea53e8",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 80,
"avg_line_length": 33.44,
"alnum_prop": 0.7026847421584264,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "cae374741d5c5a875c06a832781e03298fa914e0",
"size": "7941",
... |
import binary_heap as bh
class priorityQueue(object):
def __init__(self):
self.bin_heap = bh.binHeap()
def insert(self, input_value, order):
self.bin_heap.push(input_value)
def pop(self):
input_value = self.bin_heap.pop()
return input_value
def peek(self):
i... | {
"content_hash": "a31eb001e5e3442246a281131b3a9865",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 41,
"avg_line_length": 21.055555555555557,
"alnum_prop": 0.604221635883905,
"repo_name": "jacquestardie/data-structures",
"id": "6a43fae7722f1a85e9b30b3b487583cada93b1d4",
... |
"""
Provides interfaces to various commands provided by Camino-Trackvis
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(data... | {
"content_hash": "4ba7cbd2f49514d8eadebac3e7753e80",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 136,
"avg_line_length": 36.816901408450704,
"alnum_prop": 0.6201224177505739,
"repo_name": "mick-d/nipype",
"id": "b9032ba1cdd4a8d518290298007eb555f5be4361",
"size": "5252... |
import mock
import datetime
from cloudferry.lib.utils import filters
from tests import test
class BaseCFFiltersTestCase(test.TestCase):
def test_base_class_has_get_filters_method(self):
self.assertTrue(callable(filters.CFFilters.get_filters))
def test_cannot_create_object_of_filters(self):
s... | {
"content_hash": "796912467b0a1c488d8438331180c274",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 65,
"avg_line_length": 32.51587301587302,
"alnum_prop": 0.6177690993409812,
"repo_name": "SVilgelm/CloudFerry",
"id": "1f31b3e5a7544691888361a6f6c6deb7f73a8e36",
"size": "... |
"""Entry point of Python Exonum test library"""
from suite.exonum import ExonumNetwork
from suite.process_manager import ProcessOutput, ProcessExitResult
from suite.common import *
from suite.crypto_advanced_client import ExonumCryptoAdvancedClient
| {
"content_hash": "3c96763ebe00209dc763e78282bcb349",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 67,
"avg_line_length": 49.8,
"alnum_prop": 0.8433734939759037,
"repo_name": "alekseysidorov/exonum",
"id": "4581a2854dcae93887ad673ccaa11f1ffac50013",
"size": "249",
"bina... |
"""
Created on 4 Sep 2020
Updated 23 Mar 2021
@author: Jade Page (jade.page@southcoastscience.com)
https://packaging.python.org/tutorials/packaging-projects/
https://packaging.python.org/guides/single-sourcing-package-version/
"""
import codecs
import os
import setuptools
# ----------------------------------------... | {
"content_hash": "f3c8a88065ba4ec5f1af763128367b7e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 118,
"avg_line_length": 31.3015873015873,
"alnum_prop": 0.5786004056795132,
"repo_name": "south-coast-science/scs_core",
"id": "802e4cf1b7f847e1d3a390083ee5b2f966d53624",
"... |
"""Add status to leases
Revision ID: 23d6240b51b2
Revises: 2bcfe76b0474
Create Date: 2014-04-25 10:41:09.183430
"""
# revision identifiers, used by Alembic.
revision = '23d6240b51b2'
down_revision = '2bcfe76b0474'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('leases', sa.Column(... | {
"content_hash": "53dc8cf74a4c172b5fa4269077c92604",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 29.487179487179485,
"alnum_prop": 0.6443478260869565,
"repo_name": "frossigneux/blazar",
"id": "d4300ab8efb12bce0f3f133a9a7b77f2db416a3d",
"size": "1... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer, BigInteger, Numeric, DateTime, ForeignKey
from sqlalchemy.orm import backref, relationship
from geoalchemy2 import Geometry
"""
Object-relational model of floats database.
See etl.py for extract/transform/load proce... | {
"content_hash": "8303353557b8e0f9aff7eca059d8bb71",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 89,
"avg_line_length": 34.15853658536585,
"alnum_prop": 0.6315601570867547,
"repo_name": "joefutrelle/noaa_floats",
"id": "85b1ca148713c5125410cc78a99c89127b4be2dd",
"size"... |
dbfilename = '../db/people_file'
ENDDB = 'enddb'
ENDREC = 'endrec'
RECSEP = '=>'
def storeDbase(db, dbfilename=dbfilename):
dbfile = open(dbfilename, 'w')
for key in db:
print(key, file=dbfile)
for (name,value) in db[key].items():
print(name + RECSEP + repr(value), file=dbfile)
... | {
"content_hash": "7f54465d6d8f2d91323002bdc74632a3",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 59,
"avg_line_length": 22.71794871794872,
"alnum_prop": 0.5519187358916479,
"repo_name": "lichengshuang/python",
"id": "932d5c922122ef6b524de42797ee354bf959f586",
"size": "... |
from __future__ import division, unicode_literals, print_function
from applications.weixin.weixin.conf import get_conf
from applications.weixin.weixin.utils import get_class_by_path
class CacheMixin(object):
def gen_cache_key(self, from_user_name, **kwargs):
key = "USER:STATE:%s" % from_user_name
... | {
"content_hash": "087ee8d8eec52ef1f612b849213b1593",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 76,
"avg_line_length": 33.71875,
"alnum_prop": 0.6232622798887859,
"repo_name": "chenchiyuan/django-project-template",
"id": "d67548dc521ba6d00f9d5d642fdbb0b56768aa3a",
"si... |
"""bool_q dataset."""
from tensorflow_datasets import testing
from tensorflow_datasets.datasets.bool_q import bool_q_dataset_builder
class PawsXWikiTest(testing.DatasetBuilderTestCase):
DATASET_CLASS = bool_q_dataset_builder.Builder
SPLITS = {
"train": 2, # Number of fake train examples
"validation"... | {
"content_hash": "d0b687fe9b8f4db6067c37805ef75e83",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 25.45,
"alnum_prop": 0.6738703339882122,
"repo_name": "tensorflow/datasets",
"id": "3b5675d5f98095d2500373c2703d74ed4c258893",
"size": "1121",
"bin... |
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 2432033
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = {}
import re
import sys
import dns.resolver
import collections
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d... | {
"content_hash": "12397434683919627f4d8c3d25a46c94",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 186,
"avg_line_length": 32.48101265822785,
"alnum_prop": 0.5518316445830086,
"repo_name": "mincoin-project/mincoin",
"id": "3fe6583414a22addab68918f45ded6becc2e9788",
"siz... |
from handlers.index import login
from handlers.index import logout
from handlers.index import home
urls = [
(r'/login', login.LoginHandler),
(r'/login/search', login.UserSearch),
(r'/logout', logout.LogoutHandler)
]
urls += [
(r'/', home.LogoutHandler)
]
| {
"content_hash": "f67b857c5f21604bf246e64389a62d70",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 41,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.6788321167883211,
"repo_name": "VMatrixTeam/open-matrix",
"id": "d534301fae8ae856a47656f1a209c646a21aae87",
"size... |
from distutils.core import setup
__author__ = 'szpytfire'
setup(
name = 'django_api_tools',
packages = ['django_api_tools'],
version = '0.1.1',
description = 'Django API add-on is a mini-framework which allows developers to run RESTful APIs alongside websites using Forms/Templates.',
author = 'Tom Szpytman'... | {
"content_hash": "b9fcf0b4c7fa256621491e1485a04cb1",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 142,
"avg_line_length": 35.125,
"alnum_prop": 0.6903914590747331,
"repo_name": "szpytfire/django-api-tools",
"id": "56d0f2faec91e79aca0cb2c9d1b160a45e5cf440",
"size": "562"... |
import veritable
import veritable.utils
import json
import sys
TABLE_NAME = 'movielens'
'''
Perform analysis on the given data file and and schema, creating the
table first if needed and uploading the data.
'''
def main(data_file, schema_file):
rows = json.loads(open(data_file).read())
schema = json.loads(... | {
"content_hash": "4523ca44619bd800ba20fbb85bbf59d8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 69,
"avg_line_length": 23.235294117647058,
"alnum_prop": 0.6544303797468355,
"repo_name": "rkomartin/user-recs-example",
"id": "95b12f4511b59348d8b96466b8ff6b001104ff9c",
"... |
"""
WSGI config for spitballingHere project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... | {
"content_hash": "d7955d9c7aacb660f30308e90a6b2c76",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.4375,
"alnum_prop": 0.7788697788697788,
"repo_name": "mikelese/spitballingHere",
"id": "038e204c4cee89aaccf8711eaa2b988d1a2c1592",
"size": "407",
... |
trainImgFpath = "../data/plat-indo-train/master.jpg"
resultFlatten = "../xprmt/ocr/flattened_images.txt"
resultClass = "../xprmt/ocr/classifications.txt" | {
"content_hash": "01d3e76d33e9430d9fe11bb920e5d056",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 52,
"avg_line_length": 51,
"alnum_prop": 0.7516339869281046,
"repo_name": "Anggunasr/plat",
"id": "573216daaeb308a8c27fae22fdc32fe884da4cce",
"size": "171",
"binary": fals... |
"""Helpers shared by cloudstorage_stub and cloudstorage_api."""
__all__ = ['CS_XML_NS',
'CSFileStat',
'dt_str_to_posix',
'LOCAL_API_HOST',
'local_run',
'get_access_token',
'get_metadata',
'GCSFileStat',
'http_time_to_posix',
... | {
"content_hash": "88fc4adb7f8735860dae23dd2818ff81",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 79,
"avg_line_length": 27.574257425742573,
"alnum_prop": 0.6330341113105925,
"repo_name": "nicko96/Chrome-Infra",
"id": "eb7a214bc1a4b31e7270bc6c7b8d4f6838cf6082",
"size":... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import time
import logging
import logging.config
import json
import cv2
import numpy as np
def time_this(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.... | {
"content_hash": "d07681878c7b7433f34101f51329e34d",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 82,
"avg_line_length": 25.942857142857143,
"alnum_prop": 0.5501101321585903,
"repo_name": "neilhan/python_cv_learning",
"id": "06a732d8b089be2d7f4e3170f579c2d62f837ec8",
"s... |
import json
import os
import sys
import pickle
from flask import Flask, request, make_response
import pystache
from resultslogger.constants import ResultLoggerConstants
from resultslogger.experimentlogger import ExperimentLogger
from resultslogger.experimentqueue import ExperimentQueue, CsvExperimentQueue
from result... | {
"content_hash": "187456a44c5b3d072ce3a8917ffe5923",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 138,
"avg_line_length": 49.2046783625731,
"alnum_prop": 0.5909198954124079,
"repo_name": "mallamanis/resultslogger",
"id": "2b0f183591b2509a04aae528b906b6b240773b96",
"siz... |
"""
Generate summary statistics using Facets.
Facets must be installed. See: https://github.com/PAIR-code/facets
In particular, see the Python code here:
https://github.com/PAIR-code/facets/tree/master/facets_overview/python
"""
from feature_statistics_generator import ProtoFromTfRecordFiles
DATASET_PATH = "/tmp/adu... | {
"content_hash": "660334ef328dfc63945ea0de5b2b72f9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 70,
"avg_line_length": 31.05263157894737,
"alnum_prop": 0.752542372881356,
"repo_name": "brain-research/data-linter",
"id": "38ff8b654ac5cfe3f5c925395203cacfcbd56b02",
"siz... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
import SuperDiffer.routes
| {
"content_hash": "a27cc6ed169892da340bc747651e04a8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 39,
"avg_line_length": 17,
"alnum_prop": 0.7647058823529411,
"repo_name": "gpaOliveira/SuperDiffer",
"id": "b7a26c0a9ed6e74ca6b51fb114621a2fa3bb1357",
"size": "170",
"bin... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('layout.html')
if __name__ == '__main__':
app.run() | {
"content_hash": "c56ce9484bc7ffe5b6ac1fad1d5973ff",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 41,
"avg_line_length": 15.416666666666666,
"alnum_prop": 0.6108108108108108,
"repo_name": "hsrob/drink-league",
"id": "6a833c4bb4e08cfa4a011c82f36e7712c17b5878",
"size": "1... |
import argparse
class sumeet_class(object):
def __init__(self, name, balance, bank_name):
self.name = name
self.balance = balance
self.bank_name = bank_name
def withdraw(self, amount):
if amount > self.balance:
raise RuntimeError("Amount greater than available ba... | {
"content_hash": "311d20bf0d43ddca3f802ac1f34cb00f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 88,
"avg_line_length": 28.3,
"alnum_prop": 0.5530035335689046,
"repo_name": "sum-coderepo/spark-scala",
"id": "010fd1df10b70f9854659070d4be68faeeace533",
"size": "1743",
... |
from neutron import manager
from neutron.tests.unit.bigswitch import test_base
from neutron.tests.unit import test_extension_security_group as test_sg
from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
class RestProxySecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase,
... | {
"content_hash": "4c5b187446a715958d123c8d49657ad8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 39.125,
"alnum_prop": 0.6693290734824281,
"repo_name": "uni2u/neutron",
"id": "409e9ce4f4542f528c4b5360f9760216227d116a",
"size": "1888",
"binary":... |
from osmnodepbf import osmnodepbf
import os
parser = osmnodepbf.Parser("data/germany-latest.osm.pbf")
places = parser.parse({"place": {
"suburb", "borough", "quarter", "city", "neighbourhood", "city_block", "town", "village", "hamlet",
"isolated_dwelling", "farm", "allotments"}}, refresh=True)
f = file("dat... | {
"content_hash": "93b4c65cf16b6abaabf1ae08ba30936c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 103,
"avg_line_length": 28.38095238095238,
"alnum_prop": 0.5855704697986577,
"repo_name": "gaetjen/place_names",
"id": "f22b272294d8292994f13ee8a92a546660b8e6b8",
"size": "... |
""" """
from .file import FileUrl
class Hdf5Url(FileUrl):
"""URL that references an HDF5 file"""
match_priority = FileUrl.match_priority-5
def __init__(self, url=None, downloader=None, **kwargs):
super().__init__(url, downloader, **kwargs)
@classmethod
def _match(cls, url, **kwargs):
... | {
"content_hash": "94c0e37f10d51071b7f368e303c84724",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 84,
"avg_line_length": 23.594594594594593,
"alnum_prop": 0.6036655211912944,
"repo_name": "CivicKnowledge/rowgenerators",
"id": "534a6a0491873f6e94af75a341aa5c72338f6c9d",
... |
import pyscreenshot as ImageGrab
# part of the screen
im=ImageGrab.grab(bbox=(10,10,500,500))
im.show()
| {
"content_hash": "ef03c92f52256afc70b78f826f8e3a17",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 21,
"alnum_prop": 0.7523809523809524,
"repo_name": "Faianca/Anime-Tv-shows-Scrapper",
"id": "5ad53689dc3af5a79ee9c6762f5d0b6161971043",
"size": "105",... |
import oanda.oanda_common.view
from oanda.position.view import print_positions_map
from oanda.order.view import print_orders_map
from oanda.trade.view import print_trades_map
def update_attribute(dest, name, value):
"""
Set dest[name] to value if it exists and is not None
"""
if hasattr(dest, name) a... | {
"content_hash": "8bd5293857e089f55250246238b4fd66",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 80,
"avg_line_length": 28.455938697318008,
"alnum_prop": 0.5812575737175172,
"repo_name": "JavierGarciaD/AlgoTrader",
"id": "8a09167f8fbe3443e8c6380bc6382a44f4367781",
"si... |
from __future__ import print_function
from os import getpid
from functools import partial
from bcc import BPF
from bcc.containers import filter_by_containers
import errno
import argparse
from time import strftime
# arguments
examples = """examples:
./capable # trace capability checks
./capable -v ... | {
"content_hash": "70a5a6c9bed703c1bab8f6ad21fd091b",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 96,
"avg_line_length": 28.031141868512112,
"alnum_prop": 0.6143685964695716,
"repo_name": "iovisor/bcc",
"id": "db78de39e562f0af5beb84f56125cd8db3a2f860",
"size": "8479",
... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from django.forms.models import inlineformset_factory
from django.http import Http404
from django.http import HttpResponseRedirect
from django.views.generic.detail import SingleOb... | {
"content_hash": "2226d4d7a3cc08a024474e0353057e40",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 97,
"avg_line_length": 37.82608695652174,
"alnum_prop": 0.6772030651340997,
"repo_name": "popen2/djangopypi2",
"id": "d5f426523fb52c97d7c602656d055bcbf6b66fb1",
"size": "5... |
""" tests all modules for syntax correctness and internal imports
"""
from glob import glob
from importlib import import_module
from inspect import (
getfile,
currentframe
)
from os import walk
from os.path import (
abspath,
dirname,
join,
split
)
from sys import path as syspath
SCRIPT_PATH = dirnam... | {
"content_hash": "018898e97a009fcf676a3b60b6717599",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 74,
"avg_line_length": 28.152173913043477,
"alnum_prop": 0.6277992277992278,
"repo_name": "peter1000/ReOBJ",
"id": "f326d3a976dfd0b320618a19e2ccd1b523521d19",
"size": "1295... |
from PIL import Image
class Resizer(object):
def __init__(self, expand=False, filter=Image.ANTIALIAS):
self.expand = expand
self.filter = filter
def transformations(self, size, target_size):
# should return a list of JSON-serializable commands
# that are processed with transf... | {
"content_hash": "ac24604b1fce8b12e3a13dbccf8e8c25",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 72,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.5389100695223145,
"repo_name": "Lehych/iktomi",
"id": "8b8816e77a9998e0d60d050e1905a10ec5bbe13b",
"size": "4459"... |
""" MiniMark GC.
Environment variables can be used to fine-tune the following parameters:
PYPY_GC_NURSERY The nursery size. Defaults to 1/2 of your cache or
'4M'. Small values
(like 1 or 1KB) are useful for debugging.
PYPY_GC_NURSERY_CLEANUP The interval ... | {
"content_hash": "19b5e67227f6d26cbe8256fa9621fc76",
"timestamp": "",
"source": "github",
"line_count": 2095,
"max_line_length": 79,
"avg_line_length": 45.75751789976134,
"alnum_prop": 0.5924558219106633,
"repo_name": "oblique-labs/pyVM",
"id": "8cb1a5f9b4456df4626f381ad80e2c72c9d814fc",
"size": "9... |
from flask import Flask
from flask.ext.triangle import Triangle
#from flask.ext.mail import Mail
app = Flask(__name__)
Triangle(app)
# # app.config.update(dict(
# # DEBUG=True,
# # MAIL_SERVER='smtp.gmail.com',
# # MAIL_PORT=465,
# # MAIL_USE_TLS=False,
# # MAIL_USE_SSL=True,
# # MAIL_USERNAME=... | {
"content_hash": "0d7a574043187eae0ad3d8c909f54349",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 46,
"avg_line_length": 23.77777777777778,
"alnum_prop": 0.6308411214953271,
"repo_name": "nirmitgoyal/longclaw",
"id": "7a0b6d72f9cc1760f6404eae49af0c10a91ff3d6",
"size": "... |
import numpy as np
class StructuredModel(object):
"""Interface definition for Structured Learners.
This class defines what is necessary to use the structured svm.
You have to implement at least joint_feature and inference.
"""
def __repr__(self):
return ("%s, size_joint_feature: %d"
... | {
"content_hash": "164ecd74c3821b6d23959fe0532f588f",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 89,
"avg_line_length": 35.689655172413794,
"alnum_prop": 0.5772946859903382,
"repo_name": "amueller/pystruct",
"id": "c63fcdaf8de34c14ebd66a45adfb093229f913f4",
"size": "4... |
"""Test configuration files"""
import os
import sys
from pyrseas.config import Config
from pyrseas.cmdargs import cmd_parser, parse_args
from pyrseas.yamlutil import yamldump
USER_CFG_DATA = {'database': {'port': 5433},
'output': {'version_comment': True}}
CFG_TABLE_DATA = {'schema public': ['t1', '... | {
"content_hash": "a8e254de99be7655ede371bc8e6118b6",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 32.425,
"alnum_prop": 0.6534309946029299,
"repo_name": "perseas/Pyrseas",
"id": "faab758732abc2a871e225e386deac875868b908",
"size": "2618",
"binary... |
import sys
import pytest
if sys.version_info >= (3, 3):
from unittest.mock import Mock
ABI = [{}]
ADDRESS = '0xd3CdA913deB6f67967B99D67aCDFa1712C293601'
NON_CHECKSUM_ADDRESS = '0xd3cda913deb6f67967b99d67acdfa1712c293601'
INVALID_CHECKSUM_ADDRESS = '0xd3CDA913deB6f67967B99D67aCDFa1712C293601'
@pytest.mark.para... | {
"content_hash": "73ffe62e033749bea2075a0a437cf52e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 84,
"avg_line_length": 31.75609756097561,
"alnum_prop": 0.6781874039938556,
"repo_name": "pipermerriam/web3.py",
"id": "e60f492fcd90b07e52ca9309138f847816e083ce",
"size": "... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PhotoPortfolio.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "bf5285657b58115cced559b5cd32fa79",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 78,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.7191489361702128,
"repo_name": "tsitra/PhotoPortfolio",
"id": "63e0ee7c020dc650c7132219c2fc60d90fa2b7ce",
"size": "... |
from wsstat.clients import WebsocketTestingClient
import asyncio
import datetime
import random
import websockets
import sys
if sys.version_info < (3, 4, 4):
asyncio.ensure_future = getattr(asyncio, 'async')
@asyncio.coroutine
def echo_time(websocket, path):
while True:
now = datetime.datetime.utcnow(... | {
"content_hash": "0e9ebf94328f3c90786dc23d53d99bdc",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 70,
"avg_line_length": 28.517241379310345,
"alnum_prop": 0.6469165659008465,
"repo_name": "Fitblip/wsstat",
"id": "a7d0cbd2cf911daf9817cb70147cee4a0459bac2",
"size": "827",... |
__author__= 'liez'
import random
import sqlite3
def make_number(num, length):
str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
a = []
i = 0
while i < num:
numstr = ''
for j in range(length):
numstr += random.choice(str)
if numstr not in a: #如果没... | {
"content_hash": "bda59765aea8d5e88744f5ab1ede843e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 23.38235294117647,
"alnum_prop": 0.5849056603773585,
"repo_name": "Show-Me-the-Code/python",
"id": "a32ef373e8d86ea50aa07b11643e9f922ae5142f",
"size"... |
from typing import List, Dict
from fedlearner_webconsole.utils.file_manager import FileManagerBase
class FakeFileManager(FileManagerBase):
def can_handle(self, path: str) -> bool:
return path.startswith('fake://')
def ls(self, path: str, recursive=False) -> List[Dict]:
return [{'path': 'fake... | {
"content_hash": "bb5973f7c927cf9eaecfae2acf0c0786",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6302631578947369,
"repo_name": "bytedance/fedlearner",
"id": "4a672d32703f745c4d4f4103e1d07362b4c3b4ef",
"size": ... |
import os
import sys
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
from autobahn.wamp.types import PublishOptions
if 'MYTICKET' in os.environ and len(sys.argv) > 1:
# principal from command line, ticket from environment... | {
"content_hash": "e54ad4a4fb8ed1a66d2f57eb089f9d71",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 148,
"avg_line_length": 33.640776699029125,
"alnum_prop": 0.6424242424242425,
"repo_name": "crossbario/crossbarexamples",
"id": "73cb049a07e861b24ea7a863ede83b69b8842ba1",
... |
import os
import sys
import pytest
## 3rd party
import pandas as pd
## package
from pyTecanFluent import Fluent
from pyTecanFluent import Labware
# data dir
test_dir = os.path.join(os.path.dirname(__file__))
data_dir = os.path.join(test_dir, 'data')
# tests
def test_db():
db = Fluent.db()
RackTypes = db.R... | {
"content_hash": "913245bacb6d579e775622badaa940b0",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 50,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.6358974358974359,
"repo_name": "leylabmpi/pyTecanFluent",
"id": "2c1dd536cb537f7a9a20da00220ae187a3f81332",
"size... |
from django.contrib.auth.models import Permission
from django.db.models import Q
from mptt.managers import TreeManager
class ItemManager(TreeManager):
"""
Specific manager for mojo.navigation Item models.
"""
def for_slug(self, slug):
"""
Filters items for a specific tree by its slug.... | {
"content_hash": "a0f2011ae32e12189fcc1275863fd9ed",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 90,
"avg_line_length": 35.84313725490196,
"alnum_prop": 0.6214442013129103,
"repo_name": "django-mojo/mojo-navigation",
"id": "149e3a31b0604c628d29c1f53083e9e24a66003f",
"s... |
import os
import sys, getopt, argparse
import logging
import json
import time
import requests
class BadCallError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class LatencyTest(object):
def __init__(self):
self.latency_sum = ... | {
"content_hash": "ad18b94f4e84bed4ed286acb7ee41894",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 107,
"avg_line_length": 32.18840579710145,
"alnum_prop": 0.5790184601530842,
"repo_name": "SeldonIO/seldon-server",
"id": "0ce3b42b4e35094e0a5092528ac30aaded2e951d",
"size"... |
"""PlannerOverride API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class PlannerOverrideAPI(BaseCanvasAPI):
"""PlannerOverride API Vers... | {
"content_hash": "643e5eeea5ed384cebb6278e30f96e67",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 166,
"avg_line_length": 31.324324324324323,
"alnum_prop": 0.5395234618703126,
"repo_name": "tylerclair/py3canvas",
"id": "bf06281d199e015eed52ea319b59829e1af1ccf9",
"size"... |
from django import forms
class AddRestaurant(forms.Form):
name = forms.CharField(label='Nombre', max_length=50)
id_restaurant = forms.CharField(label='Identificador', max_length=8)
direc = forms.CharField(label='Dirección', max_length=50)
zipcode = forms.CharField(label='Código Postal', max_length=5)
... | {
"content_hash": "620f10e133a63a04325b87a844ab82a0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 46.77777777777778,
"alnum_prop": 0.7220902612826603,
"repo_name": "jmanday/Master",
"id": "6f7c4d5f3462392850e807534b3c47d6bb0a9378",
"size": "423",
... |
from flask import redirect
from flask_admin import Admin, AdminIndexView, expose
from flask_admin.menu import url_for
from flask_login import current_user
from plenario.database import postgres_session
from plenario.models.SensorNetwork import FeatureMeta, NetworkMeta, NodeMeta, SensorMeta
from .admin_views import adm... | {
"content_hash": "ffc61901bd3fe713a4987692c0b8b2cc",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 88,
"avg_line_length": 30.95,
"alnum_prop": 0.7245557350565428,
"repo_name": "UrbanCCD-UChicago/plenario",
"id": "24d285fae09f15b1478a96d1e15834ef38014adf",
"size": "1238",... |
"""
Common Auth Middleware.
"""
from oslo.config import cfg
import webob.dec
import webob.exc
from nova import context
from nova.openstack.common.gettextutils import _
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova import wsgi
auth_opts = [
cfg.BoolOpt('a... | {
"content_hash": "6b0645ed24c984cb535e8c64e4731a7c",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 79,
"avg_line_length": 35.923611111111114,
"alnum_prop": 0.583607191184999,
"repo_name": "ewindisch/nova",
"id": "f15648a77a249f8f3d08e9ccca5646285aaa41d4",
"size": "5789"... |
from google.cloud.spanner import Client
from .streaming_utils import INSTANCE_NAME as STREAMING_INSTANCE
STANDARD_INSTANCE = "google-cloud-python-systest"
def scrub_instances(client):
for instance in client.list_instances():
if instance.name == STREAMING_INSTANCE:
print("Not deleting streamin... | {
"content_hash": "926c193a46c83bd57f90c9eab3c1ceb3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 83,
"avg_line_length": 33.523809523809526,
"alnum_prop": 0.6590909090909091,
"repo_name": "dhermes/gcloud-python",
"id": "79cd51fdfc94b1fc37650bf1032578ad2b6ead78",
"size":... |
"""Package contenant la commande 'détailler'."""
from primaires.interpreteur.commande.commande import Commande
from secondaires.navigation.visible import Visible
class CmdDetailler(Commande):
"""Commande 'détailler'"""
def __init__(self):
"""Constructeur de la commande"""
Commande.__init__(s... | {
"content_hash": "a78d33c4357f16180a43d37efbd61248",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 40.116279069767444,
"alnum_prop": 0.6075362318840579,
"repo_name": "stormi/tsunami",
"id": "6d6f600482f20b804499633db1b80a924c3f21d7",
"size": "3311"... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterDestroyedEvent(vim, *args, **kwargs):
'''This event records when a cluster is d... | {
"content_hash": "6ecaa3bf6ac1cbcfc486673b75654587",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 124,
"avg_line_length": 34.72727272727273,
"alnum_prop": 0.5968586387434555,
"repo_name": "xuru/pyvisdk",
"id": "3f34a3c70c064193c1257c5cbccbcd3420553c31",
"size": "1147",
... |
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 model 'Location'
db.create_table('events_location', (
('id', self.gf('django.db.models.fields.AutoField')(prima... | {
"content_hash": "6b1159437d8fefe69867747b1d184df4",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 116,
"avg_line_length": 57.60919540229885,
"alnum_prop": 0.557462090981644,
"repo_name": "pugpe/pugpe",
"id": "46a8520a072c891b3f7596c4fb8b503c8a2025a4",
"size": "5036",
... |
"""
chex
Indexes chess game states from one or more PGN files
(https://en.wikipedia.org/wiki/Portable_Game_Notation) with Spotify's annoy
(https://github.com/spotify/annoy) so the user can search for game states
similar to a game state they input as well as the games in which they're
found.
Requires https://pypi.pyth... | {
"content_hash": "a7d091ae1b08fee7ddf5100d0533fc15",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 79,
"avg_line_length": 38.06412478336222,
"alnum_prop": 0.5332149524199791,
"repo_name": "samirsen/chex",
"id": "786f5dd17b4bbd14256184d04985cba1db4b1c60",
"size": "21985"... |
import serial
import database
import protocol
import time
import power_indication
class SkladInterface:
def __init__(self):
#self.serial = serial.Serial(0)
#self.serial = serial.serial_for_url('loop://', timeout=1)
self.serial = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=1)
... | {
"content_hash": "7f8a32b1492a9f7ede75f8a2c3cc34d7",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 86,
"avg_line_length": 33.01020408163265,
"alnum_prop": 0.5758887171561051,
"repo_name": "honya121/sklad-daemon",
"id": "4573d189d92e48d3ad0f7b0be16c51ecc7bdd6a7",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.