text stringlengths 4 1.02M | meta dict |
|---|---|
import sys
from collections import Counter
def main(fp):
c = Counter(fp)
for item in c.most_common(5):
print item
if __name__ == '__main__':
main(sys.stdin)
| {
"content_hash": "534c63a547afb146f2fa687a539a1de3",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 33,
"avg_line_length": 17.9,
"alnum_prop": 0.6033519553072626,
"repo_name": "zhaipro/misc",
"id": "fd4d70373be18bae94df2be29f64938db7786596",
"size": "198",
"binary": fal... |
'''
Created on Aug 21, 2012
@author: cryan
'''
import numpy as np
import matplotlib.pyplot as plt
import cPickle
from copy import deepcopy
from scipy.constants import pi
from PySim.QuantumSystems import Hamiltonian, Dissipator
from PySim.SystemParams import SystemParams
from PySim.PulseSequence import PulseSeque... | {
"content_hash": "38301d2794055345bbbb9626a56a7fd8",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 166,
"avg_line_length": 34.648648648648646,
"alnum_prop": 0.6743369734789392,
"repo_name": "BBN-Q/PySimulator",
"id": "c692068a7e107b60d84b79255bd54309bc30d8fa",
"size": "2... |
from flask import request, Blueprint, redirect
from flask import url_for, g, current_app
from flask import jsonify
from flask_fas_openid import fas_login_required
from fedora_college.core.models import * # noqa
from fedora_college.core.database import db
bundle = Blueprint('auth', __name__, url_prefix='/auth')
'''
... | {
"content_hash": "70a8d5b1547d29e8b15dbec61e904efe",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 77,
"avg_line_length": 25.385185185185186,
"alnum_prop": 0.5873942223519113,
"repo_name": "echevemaster/fedora-college",
"id": "0d028a1fd1b7c1b2ea13d68b90de41cf7f0a843f",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registers', '0017_auto_20170518_1419'),
]
operations = [
migrations.CreateModel(
name='Platform',
fields=[
(... | {
"content_hash": "af5bee89e4bebdb442339ba7ed0313e2",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 355,
"avg_line_length": 38.60606060606061,
"alnum_prop": 0.5447409733124019,
"repo_name": "rockychen-dpaw/oim-cms",
"id": "e8002c3e338f51336f9594da11f257ca14e5aa23",
"size"... |
from pexif import ExifSegment
from thumbor.utils import logger
WEBP_SIDE_LIMIT = 16383
class MultipleEngine:
def __init__(self, source_engine):
self.frame_engines = []
self.source_engine = source_engine
def add_frame(self, frame):
frame_engine = self.source_engine.__class__(self.so... | {
"content_hash": "debf3f49463be892e8c4997776d7abab",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 119,
"avg_line_length": 31.821100917431192,
"alnum_prop": 0.5993945509586277,
"repo_name": "dhardy92/thumbor",
"id": "56fffe376b2487506aed8bec4270b05908a201f6",
"size": "7... |
"""
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. If there is no next
right node, the next pointer should be set to NULL.
Initially, all next pointers are set to NULL.
Note... | {
"content_hash": "a81b517cf8990ff67cd560272ebc4205",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 22.848101265822784,
"alnum_prop": 0.5412742382271468,
"repo_name": "fantuanmianshi/Daily",
"id": "f2020920c3c47c778a48cce7879f30fc3980513e",
"size": ... |
from django.test import TestCase
from django.core import mail
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from zeropass.models import Token
class ReceiverTestCaseEmail(TestCase):
def test_no_email_when_silent(self):
"""when a token is created an email is sent"... | {
"content_hash": "f2768013ffb2a38b3990ba72887b18fb",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 54,
"avg_line_length": 28.18421052631579,
"alnum_prop": 0.580765639589169,
"repo_name": "jamiecurle/django-zeropass",
"id": "48b3615564cd79e46c1d70c7c082658dbe8461ed",
"siz... |
import MySQLdb
user = "benchmark"
passwd = "benchmark"
db = "mlproject"
source_db = "symblichens"
db = MySQLdb.connect(host="localhost",
user=user,
passwd=passwd,
db="mlproject")
cur = db.cursor()
sql = 'CREATE TABLE ocred_records_raw \
SELECT IFN... | {
"content_hash": "aebdc674241d0a195f94aecf96126e83",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 103,
"avg_line_length": 28.59259259259259,
"alnum_prop": 0.6515544041450777,
"repo_name": "mjcollin/ml_ocr",
"id": "8ea3bc708ded2c89c2f3f9a071a46bc49b05f244",
"size": "938"... |
from __future__ import unicode_literals, division, absolute_import
import logging
import os
import threading
from flask import Flask, abort, redirect
from flexget.event import event
from flexget.config_schema import register_config_key
from flexget.utils.tools import singleton
log = logging.getLogger('web_server')
... | {
"content_hash": "c9c62e3d77117cc4fc6f5f1035b7f9d9",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 105,
"avg_line_length": 26.1,
"alnum_prop": 0.6177424108458591,
"repo_name": "ZefQ/Flexget",
"id": "97e202cbcbba149706761d1724390792a85e22ad",
"size": "3393",
"binary": ... |
import os
from selenium.webdriver.remote.webdriver import WebDriver
import selene.config
import selene.driver
import selene.factory
from selene import helpers
from selene.common.none_object import NoneObject
from selene.elements import SeleneElement, SeleneCollection
from selene.wait import wait_for
def quit_driver... | {
"content_hash": "d0a34bcef3431445e414d0823b6b92d6",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 91,
"avg_line_length": 26.376146788990827,
"alnum_prop": 0.7064347826086956,
"repo_name": "SergeyPirogov/selene",
"id": "15e7b92341c83c6c2bf6a5bb830eb607eddb43dd",
"size":... |
"""
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
"""
from __future__ import unicode_literals
import base64
import cgi
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from... | {
"content_hash": "80cd25a69364f04b177bad5679a97213",
"timestamp": "",
"source": "github",
"line_count": 644,
"max_line_length": 109,
"avg_line_length": 35.659937888198755,
"alnum_prop": 0.5441759198780753,
"repo_name": "vsajip/django",
"id": "3f1b7b81016c1dbe7e549ac272c724ada9b7ed4b",
"size": "2296... |
from .utils import export
@export
class ArtifactoryError(Exception):
pass
@export
class ImmutableConfigError(ArtifactoryError):
pass
| {
"content_hash": "8282f60bf9a4932c7dad8a9ca7dd71c0",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 46,
"avg_line_length": 15.88888888888889,
"alnum_prop": 0.7832167832167832,
"repo_name": "rabbitt/artifactory",
"id": "17d33109fd114f4a52a31a29fb927e8c483c135f",
"size": "14... |
"""
test_smartystreets
----------------------------------
Tests for `smartystreets` module.
"""
import pytest
from smartystreets.data import Address, AddressCollection
class TestAddress:
def test_empty(self):
addr = Address([])
assert addr.location is None
def test_location(self):
a... | {
"content_hash": "3a91afcf7418e579f2f30297a58cbc79",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 71,
"avg_line_length": 29.95945945945946,
"alnum_prop": 0.5083446098331078,
"repo_name": "bennylope/smartystreets.py",
"id": "ba653c704fbcb1eed25fbd45eb24697f1078e2c2",
"si... |
"""
Adapted from LA Times datadesk credit to Ben Welsh.
http://datadesk.latimes.com/posts/2012/06/test-your-django-app-with-travisci/
"""
import os
import sys
from django.conf import settings
import django
class QuickDjangoTest(object):
"""
A quick way to run the Django test suite without a... | {
"content_hash": "beb1acbf7fe9fe4bcf77bb550565b031",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 90,
"avg_line_length": 29.657894736842106,
"alnum_prop": 0.5306122448979592,
"repo_name": "KonstantinSchubert/django-shibboleth-adapter",
"id": "dceebbcf54229c3020c1b267862bb... |
import six
class Base(Exception):
error_code = 500
error_type = None
error_message = None
errors = None
def __init__(self, *args, **kwargs):
self.errors = kwargs.pop('errors', None)
self.object = kwargs.pop('object', None)
super(Base, self).__init__(*args, **kwargs)
... | {
"content_hash": "62862676aa05aea80d7ae46b86d95ee4",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 75,
"avg_line_length": 19.541666666666668,
"alnum_prop": 0.7061567164179104,
"repo_name": "ionrock/designate",
"id": "1d3a9d673520e9ec617cec2c2118a93d87be3864",
"size": "8... |
import pytest
import unittest
from modules.sfp_textmagic import sfp_textmagic
from sflib import SpiderFoot
from spiderfoot import SpiderFootEvent, SpiderFootTarget
@pytest.mark.usefixtures
class TestModuleTextmagic(unittest.TestCase):
def test_opts(self):
module = sfp_textmagic()
self.assertEqua... | {
"content_hash": "954c5a7ee4016af81b096589ef6df87a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 30.06122448979592,
"alnum_prop": 0.6693822131704006,
"repo_name": "smicallef/spiderfoot",
"id": "350b82d5f64eb5bdb517e6ef66ab2271e7b3b58a",
"size": "... |
"""
Various conveniences used for migration scripts
"""
from sqlalchemy.schema import Table as SqlaTable
from designate.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def create_tables(tables):
for table in tables:
LOG.debug("Creating table %s" % table)
table.create()
... | {
"content_hash": "e219197bc2135b54157feea5f4da46ad",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 53,
"avg_line_length": 22.53846153846154,
"alnum_prop": 0.6638225255972696,
"repo_name": "NeCTAR-RC/designate",
"id": "dc09dd6a60463cfd2875c41cea11240ac5a5d8c7",
"size": "1... |
import logging, json, couchdb
import hashlib
from pylons import config, request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from lr.lib.base import BaseController, render
import urllib2
log = logging.getLogger(__name__)
_COUCH_SERVER = config['app_conf']['couchdb... | {
"content_hash": "f6bd90af062dcaf4c8f30e84a08a8740",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 151,
"avg_line_length": 39.7939393939394,
"alnum_prop": 0.5513250076149863,
"repo_name": "jimklo/LearningRegistry",
"id": "06669b889775bfababe9afdf5ce0dac8fffda4a9",
"size... |
import copy, os, shlex, shutil, subprocess, sys, tempfile
# import loadGraph from scripts utilities
cur_dir = os.path.dirname(__file__)
path = os.path.abspath(os.path.join(cur_dir, '..', 'scripts'))
if not path in sys.path:
sys.path.insert(1, path)
del path
from forest_util import loadGraph
def print_graph(g):
... | {
"content_hash": "98a92ef62513370d383bbcd857e7e009",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 182,
"avg_line_length": 37.280701754385966,
"alnum_prop": 0.6428235294117647,
"repo_name": "Mkebede/OmicsIntegrator",
"id": "aad271af485cd8ef358befc0eeeba9c2df50a0b2",
"si... |
"""Test Admin SDK Directory API."""
import unittest
from directory_api_users_test_base import DirectoryApiUsersTestBase
from test_utils import GetExpectedPrintOutput
class DirectoryApiPrintUsersStdoutTest(DirectoryApiUsersTestBase):
"""Tests api's used by ls_users.py."""
def setUp(self):
"""Need users to s... | {
"content_hash": "b02efefd40a2d79666d580e4f5f2c695",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 74,
"avg_line_length": 39.729729729729726,
"alnum_prop": 0.7204081632653061,
"repo_name": "google/gfw-toolkit",
"id": "f18a20a53a9d52d17a6716fc1ae800f2dbc4d086",
"size": "2... |
"""Test mk.py."""
import os
import sys
from os.path import join, dirname, abspath, exists, splitext, \
basename, normpath
import re
from glob import glob
import unittest
import doctest
import logging
from testlib import TestError, TestSkipped, tag
class DataTestCase(unittest.TestCase):
"""T... | {
"content_hash": "6b2d5fe4fb74e2dc9b82f39562ce1de0",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 79,
"avg_line_length": 34.450980392156865,
"alnum_prop": 0.5347182697780307,
"repo_name": "ActiveState/mk",
"id": "1f8abd6a442f4a7fee34fa803a0aa443c72db1bd",
"size": "1066... |
"""HTTP server base class.
Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
(including CGI scripts).
Contents:
- BaseHTTPRequestHandler: HTTP request handler base class
- test: test function
XXX To do:
- send server version
- l... | {
"content_hash": "ff98eb24ca6b311600bbbb6e85ceb3b1",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 78,
"avg_line_length": 34.163223140495866,
"alnum_prop": 0.6151194436044753,
"repo_name": "neopoly/rubyfox-server",
"id": "cbc60e400da3811a9abecb7766509be332e6e459",
"size... |
from rlib.arithmetic import int_type
from rlib.erased import new_erasing_pair
from rlib.jit import JitDriver
from rlib.objectmodel import instantiate
from som.vmobjects.abstract_object import AbstractObject
from rlib.debug import make_sure_not_resized
from som.vm.globals import nilObject, falseObject, trueObject
from s... | {
"content_hash": "d48b330e52742903776bea88f8e832a7",
"timestamp": "",
"source": "github",
"line_count": 862,
"max_line_length": 99,
"avg_line_length": 36.15313225058004,
"alnum_prop": 0.5758888461044795,
"repo_name": "SOM-st/RPySOM",
"id": "a94ff836abfea49584db829fc57fad0c0de4075f",
"size": "31164"... |
import os
import sys
sys.path += ['..']
import gencerts
# Generate the keys -- the same key is used between all intermediate certs and
# between all leaf certs.
root_key = gencerts.get_or_generate_rsa_key(2048,
gencerts.create_key_path('root'))
i_key = gencerts.get_or_gener... | {
"content_hash": "a2022f525aaa7bcf22c6a3461fe98139",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 80,
"avg_line_length": 42.818652849740936,
"alnum_prop": 0.7060745401742498,
"repo_name": "nwjs/chromium.src",
"id": "a6fe8a667eb32b6aeabb56f5a0598d0fe7733759",
"size": "8... |
import json
import sys
import decimal
from collaborative_filtering import CollaborativeFiltering
# define the recommendation algorithm and the hyperparameters
recommender = CollaborativeFiltering('movie_ratings')
hyperparameters = {'rank': 8, 'iterations': 15, 'lambda': .1}
user_id = 0
if len(sys.argv) != 2:
prin... | {
"content_hash": "7fbc3700e95e47cbc8c2e035f782982f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 91,
"avg_line_length": 38.69230769230769,
"alnum_prop": 0.6620278330019881,
"repo_name": "lukedoolittle/moviematch",
"id": "b416a2860b982a60c3609d9851f2417b55cfb021",
"size... |
"""
Base classes for the ads client
"""
import requests
import warnings
import os
from .exceptions import APIResponseError
from .config import TOKEN_FILES, TOKEN_ENVIRON_VARS
from . import __version__
import ads.config # For manually setting the token
class APIResponse(object):
"""
Represents an adsws-api ... | {
"content_hash": "ddf2e582a765760341812954f24b98ac",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 77,
"avg_line_length": 29.57943925233645,
"alnum_prop": 0.5620853080568721,
"repo_name": "bsipocz/ads",
"id": "2f8e405b8a973aa7f191ff191d75fdb873575296",
"size": "3165",
... |
"""
Kalman Smoother
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
import numpy as np
SMOOTHER_STATE = 0x01 # Durbin and Koopman (2012), Chapter 4.4.2
SMOOTHER_STATE_COV = 0x02 # ibid., Chapter 4.4.3
SMOOTHER_DISTURBANCE = 0x04 # ibid... | {
"content_hash": "1103532db89b45241f965e2b1b2b16d8",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 79,
"avg_line_length": 40.786764705882355,
"alnum_prop": 0.5507481521543176,
"repo_name": "ChadFulton/statsmodels",
"id": "717054a07a0e2e070e131c87dfc805bf1ef4c063",
"size... |
import os
import sys
from .types import DiyLangError, Environment
from .parser import remove_comments
from .interpreter import interpret
# importing this gives readline goodness when running on systems
# where it is supported (i.e. UNIX-y systems)
try:
import readline
except ImportError:
pass
# Python 2 / Py... | {
"content_hash": "901de05bc8c4c5dbcfa551f37c4253bf",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 86,
"avg_line_length": 27.375,
"alnum_prop": 0.4911937377690802,
"repo_name": "kvalle/diy-lang",
"id": "07e3243c62658d9677981428ba671a00bba6335a",
"size": "3095",
"binar... |
import hashlib
import json
import logging
import os
import StringIO
import sys
import tempfile
import unittest
import urllib
import zlib
# net_utils adjusts sys.path.
import net_utils
import auth
import isolated_format
import isolateserver
import test_utils
from depot_tools import auto_stub
from utils import file_pat... | {
"content_hash": "997fdac01c09ca4e80c169c251634945",
"timestamp": "",
"source": "github",
"line_count": 997,
"max_line_length": 80,
"avg_line_length": 32.68605817452357,
"alnum_prop": 0.6255676936295569,
"repo_name": "sgraham/nope",
"id": "20b661208048be80b245a8f9edea66dee17b154d",
"size": "32831",... |
import os
import logging
import pymongo
from counterblock.lib import config, cache, util
from counterblock.lib.processor import RollbackProcessor
logger = logging.getLogger(__name__)
def get_connection():
"""Connect to mongodb, returning a connection object"""
logger.info("Connecting to mongoDB backend ..."... | {
"content_hash": "b7f4fe90988cbb91dfc9439cfa7fcd39",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 142,
"avg_line_length": 42.516949152542374,
"alnum_prop": 0.6962328084512657,
"repo_name": "CounterpartyXCP/counterblock",
"id": "46b9ba41c45b9e6ac18ed8e72c3a16a02450079c",
... |
'''
Copyright 2015, Institute e-Austria, Timisoara, Romania
http://www.ieat.ro/
Developers:
* Gabriel Iuhasz, iuhasz.gabriel@info.uvt.ro
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
ht... | {
"content_hash": "a22f23694f2a0623a597c0515e35f6cd",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 140,
"avg_line_length": 30.99656357388316,
"alnum_prop": 0.6242793791574279,
"repo_name": "igabriel85/IeAT-DICE-Repository",
"id": "1e6ad768466843f6e66a31a1dddbcbf00c908544"... |
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
from thrift.transport import TTransport
all_structs = []
class Lang:
JAVASCRIPT = 1
GROOVY = 2
PYTHON =... | {
"content_hash": "4ae0ea216253dfb51bfebf0fd5e1e4ef",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 134,
"avg_line_length": 32.105740181268885,
"alnum_prop": 0.5395690223016844,
"repo_name": "hazelcast/hazelcast-python-client",
"id": "df0319b50fce6fcd213a114e8ac4f77af16a45... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0007_auto_20170912_1230'),
]
operations = [
migrations.AlterModelOptions(
name='school',
options={'ordering': ('id',)},
... | {
"content_hash": "59ca9e50f1ae030d015c5d2d78aaac42",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 43,
"avg_line_length": 19.529411764705884,
"alnum_prop": 0.5753012048192772,
"repo_name": "puneetugru/Experiment",
"id": "2f0683c1748d5d948a565b4959951aeb7be31e4c",
"size":... |
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
application.run(host='0.0.0.0')
| {
"content_hash": "bfe811a37a45576d56910a435d66f6d2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 35,
"avg_line_length": 20.22222222222222,
"alnum_prop": 0.6153846153846154,
"repo_name": "ddki/my_study_project",
"id": "de5da4f71d2ad252dd78ac7a659876af1ce561fb",
"size": "... |
"""Tests for 1-Wire sensors."""
import logging
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.config_validation import ensure_list
from . imp... | {
"content_hash": "e2012953344057a4c42c67f04d390029",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 85,
"avg_line_length": 35.82608695652174,
"alnum_prop": 0.7249190938511327,
"repo_name": "toddeye/home-assistant",
"id": "a20714fedfc1520bf9d42ec149c80d2994315483",
"size":... |
from scrapy.contrib.exporter import CsvItemExporter
from scrapy.contrib.exporter import JsonItemExporter
from scrapy.contrib.exporter import JsonLinesItemExporter
from scrapy.contrib.exporter import XmlItemExporter
from scrapy.contrib.exporter import BaseItemExporter
import json
import simplekml
class MTQInfraXmlItem... | {
"content_hash": "b00d225e99db279e1f36c51a4285978d",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 241,
"avg_line_length": 54.46774193548387,
"alnum_prop": 0.5709209357417826,
"repo_name": "mponton/MTQInfraScraper",
"id": "6b1fed473c076d88fbd12090952e0170ffecaddf",
"siz... |
"""
Project name: Open Methodology for Security Tool Developers
Project URL: https://github.com/cr0hn/OMSTD
Copyright (c) 2014, cr0hn<-AT->cr0hn.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. R... | {
"content_hash": "b06a6da56ff713d5da46bcb3a0c32d47",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 755,
"avg_line_length": 42,
"alnum_prop": 0.5835058661145618,
"repo_name": "cr0hn/OMSTD",
"id": "b52f3c2c690a812bf32a66e958abb7c7c7c921ee",
"size": "5821",
"binary": fal... |
import logging
import time
class Constant(object):
"""
Application constants
"""
LOGGER_RUNTIME = None
"""
Runtime Logger instance
"""
LOGGER_RUNTIME_FILEHANDLER = None
"""
Runtime Logger's file handler instance
"""
LOGGER_TIME = None
"""
Timer associated to ... | {
"content_hash": "6f0574d950d021da51a17d34049337db",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 74,
"avg_line_length": 27.866666666666667,
"alnum_prop": 0.5789473684210527,
"repo_name": "davidandreoletti/pyconvert",
"id": "f2d74c85b4b22cdc294192e341019311cc766ba1",
"s... |
from datetime import datetime, timedelta
import mock
from nose.tools import assert_equal
from pylons import tmpl_context as c
from ming.orm.ormsession import ThreadLocalORMSession
import forgetracker
from forgetracker.model import Globals
from forgetracker.tests.unit import TrackerTestWithModel
from allura.lib import... | {
"content_hash": "e2d7e255bb56a1789b437bc60cf4a24d",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 80,
"avg_line_length": 39.52205882352941,
"alnum_prop": 0.6238139534883721,
"repo_name": "lym/allura-git",
"id": "e3945dca992a69043c243068243935fb401af21d",
"size": "6245"... |
'''
Create an index with `.cat` mappings
index: name of index to set mapping (references config file)
config-path: path to config file
n-shards: number of primary shards
no-cat: comma separated list of fields to omit `.cat` mapping (eg free text fields)
'''
import json
import argparse
fro... | {
"content_hash": "92090abd6e2e289c325262b47101cd1d",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 88,
"avg_line_length": 29.276923076923076,
"alnum_prop": 0.5112979506043089,
"repo_name": "gophronesis/ernest",
"id": "39c4cc8b6ff8c644284c2747455d61b6c1eafbe5",
"size": "1... |
import random
from rally.plugins.task.scenarios.requests import utils
from rally.task import scenario
"""Scenarios for HTTP requests."""
@scenario.configure(name="HttpRequests.check_request")
class HttpRequestsCheckRequest(utils.RequestScenario):
def run(self, url, method, status_code, **kwargs):
"""S... | {
"content_hash": "47b32a63269b1111993458b2db40081e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 72,
"avg_line_length": 32.95454545454545,
"alnum_prop": 0.7020689655172414,
"repo_name": "openstack/rally",
"id": "e85ee5af26d6176f3136515016f95e0fc3fffb0e",
"size": "2023"... |
"""Scapy sniff ARP packets, must run as sudo!"""
from scapy.all import sniff
pkts = sniff(filter="arp", count=10)
print(pkts.summary())
| {
"content_hash": "64c7333e380e37f5bf8295856c5f417f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 48,
"avg_line_length": 34,
"alnum_prop": 0.7132352941176471,
"repo_name": "jamesacampbell/python-examples",
"id": "e8a8f687a56264f3200478b6af13b3d12a7bfc57",
"size": "136",
... |
"""
Handles all requests relating to Virtual Storage Arrays (VSAs).
Experimental code. Requires special VSA image.
For assistance and guidelines pls contact
Zadara Storage Inc & Openstack community
"""
import sys
from nova import compute
from nova import db
from nova import exception
from nova import flags
from ... | {
"content_hash": "271875b74b7fdd836bfe78dc0cddd61a",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 78,
"avg_line_length": 40.233502538071065,
"alnum_prop": 0.5258642442593995,
"repo_name": "xushiwei/nova",
"id": "18cf13705756f7ca11b0194816e87669e9f38f70",
"size": "16549... |
"""
Module for jenkinsapi nodes
"""
import logging
from six.moves.urllib.parse import urlencode
from jenkinsapi.node import Node
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.custom_exceptions import JenkinsAPIException
from jenkinsapi.custom_exceptions import UnknownNode
from jenkinsapi.custom_except... | {
"content_hash": "7c49da781d9861e1daa6ac463342d6f6",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 99,
"avg_line_length": 32.41011235955056,
"alnum_prop": 0.5794765123938291,
"repo_name": "salimfadhley/jenkinsapi",
"id": "e021343c6536e67b29afbe9992a23f8f2063ac78",
"size... |
"""
Class for PXE bare-metal nodes.
"""
import datetime
import os
import jinja2
from oslo.config import cfg
from oslo.db import exception as db_exc
from nova.compute import flavors
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import fileutils
from nova.openst... | {
"content_hash": "50de99f59866422ca6bc6ac2988465da",
"timestamp": "",
"source": "github",
"line_count": 487,
"max_line_length": 79,
"avg_line_length": 39.1170431211499,
"alnum_prop": 0.5779002624671916,
"repo_name": "eayunstack/nova",
"id": "239adf687230aa7fdde1d081b2fab641f30f07bc",
"size": "19750... |
"""Utils for inference."""
import os
from language.compgen.csl.model.inference import inference_wrapper
from language.compgen.csl.qcfg import qcfg_file
from language.compgen.csl.targets import target_grammar
import tensorflow as tf
def get_checkpoint(wrapper, model_dir, checkpoint):
"""Return checkpoint path and ... | {
"content_hash": "d844416bf1bb249e259148d50090f796",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 66,
"avg_line_length": 33.351351351351354,
"alnum_prop": 0.6952998379254457,
"repo_name": "google-research/language",
"id": "3fc1820ba1e8cdf9da4ab557959b4af945f22eec",
"siz... |
"""Test suite for phlsys_signal."""
# =============================================================================
# TEST PLAN
# -----------------------------------------------------------------------------
# Here we detail the things we are concerned to test and specify which tests
#... | {
"content_hash": "4e584b28c999e2450ebb37948b4a33b4",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 79,
"avg_line_length": 42.441489361702125,
"alnum_prop": 0.6208798094999374,
"repo_name": "aevri/phabricator-tools",
"id": "5f10c7e848bd18787247bd834b8758fd221585db",
"siz... |
from appium.webdriver.common.touch_action import TouchAction
from AppiumLibrary import utils
from AppiumLibrary.locators import ElementFinder
from keywordgroup import KeywordGroup
class _ElementKeywords(KeywordGroup):
def __init__(self):
self._element_finder = ElementFinder()
# Public, el... | {
"content_hash": "118c1ec90fc668fa9f5598c0b998ddcb",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 136,
"avg_line_length": 41.93197278911565,
"alnum_prop": 0.5810350421804024,
"repo_name": "lzhang1/robotframework-appiumlibrary",
"id": "d9b7214f375c99f23e9439dad307a661a8ae... |
"""
This module contains utilities for generating timestamps for client-side
timestamp specification.
"""
import logging
import time
from threading import Lock
log = logging.getLogger(__name__)
class MonotonicTimestampGenerator(object):
"""
An object that, when called, returns ``int(time.time() * 1e6)`` when... | {
"content_hash": "21cd732c2ea25e33ee3a5dd83c494527",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 84,
"avg_line_length": 35.23157894736842,
"alnum_prop": 0.610696145802211,
"repo_name": "mambocab/python-driver",
"id": "d11359cf130a59fcf55c7fbfbb0d847342d2a4c5",
"size": ... |
from django import forms
from django.db.models.fields import DateField, DateTimeField
from django.db.models.fields.related import ForeignKey, ManyToManyField, ForeignObjectRel
from pyston.filters.filters import NONE_LABEL
from pyston.filters.utils import OperatorSlug
from pyston.filters.managers import DjangoFilterMan... | {
"content_hash": "0dc3e9e72ef03083adfc63b418736595",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 116,
"avg_line_length": 33.09271523178808,
"alnum_prop": 0.6912147288373024,
"repo_name": "matllubos/django-is-core",
"id": "2cd2343248c2aba544a1e0c6f573146807b6995c",
"si... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_marksman_trainer_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","rodian_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "1ad1c4136365c669619e2a2a77398b16",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 23.692307692307693,
"alnum_prop": 0.698051948051948,
"repo_name": "anhstudios/swganh",
"id": "19c5c87915f5a3c2d66dedd9870eaf5d6848ad87",
"size": "453... |
import os
import time
import codecs
import sys
import re
import click
from curitools.settings import Settings, MissingFileSettings
from curitools.setup_problems import SetupProblem
import curitools.requestpages.pages as rp
from requests.exceptions import HTTPError
import logging
import tempfile
@click.group(invoke_wit... | {
"content_hash": "6dd18daa9e38a9b40fd3e60f6a764b7e",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 104,
"avg_line_length": 32.66304347826087,
"alnum_prop": 0.6479201331114809,
"repo_name": "gutorc92/curitools",
"id": "7bd07365d284ebd1689de569dfb36d98245b02b5",
"size": "3... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- Django configuration ... | {
"content_hash": "013909b298f3280a4af0573038e955b5",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 99,
"avg_line_length": 32.00772200772201,
"alnum_prop": 0.7018094089264174,
"repo_name": "rhouse2/django-rest2pdf",
"id": "b4b40a363238e4e16dc7311ff668abfb97f5ab23",
"size... |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | {
"content_hash": "6bd621dff36709f45d03db397732389e",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 111,
"avg_line_length": 40.5,
"alnum_prop": 0.6008999653859467,
"repo_name": "jhuapl-boss/intern",
"id": "0d9cf00c2ab2e40db8a0f9f8be9a671b4dd25c0e",
"size": "8669",
"bin... |
from facerec.classifier import SVM
from facerec.validation import KFoldCrossValidation
from facerec.model import PredictableModel
from svmutil import *
from itertools import product
import numpy as np
import logging
def range_f(begin, end, step):
seq = []
while True:
if step == 0: break
if ste... | {
"content_hash": "afcc17515847f6769f25ed621c2be088",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 171,
"avg_line_length": 36.87671232876713,
"alnum_prop": 0.6515601783060921,
"repo_name": "rishabhjain141/FaceRecCode",
"id": "e189454a64c7c1647aa01a085189080794b5e367",
"s... |
from django.conf.urls import patterns, url, include
import api as api_views
dashboards_urls = patterns(
'',
url(
r'^(?P<template_name>\w+)/$',
api_views.dashboard_template,
name='dashboard_template'))
urlpatterns = patterns(
'',
url(r'^dashboards/', include(dashboards_urls)),... | {
"content_hash": "230e4416a1fa38a900ff65e4fa8abfde",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 20.4375,
"alnum_prop": 0.6146788990825688,
"repo_name": "Alexx-G/django-grafana",
"id": "74c4abcc1f11b0efb54a91c3810bb33658dfd416",
"size": "327",
... |
import pywinauto
# build the system
# first connect to the correct location
# Second if it isn't there then run the correct window
# This class acts as a game interface and data collection device.
# This class mashes together the interface and data collection functionality.
# The data collection and game interface mi... | {
"content_hash": "a89d2a81f92ba92f42bc80c95eb17ba0",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 105,
"avg_line_length": 36.76,
"alnum_prop": 0.6730141458106638,
"repo_name": "skincell/auto-traversal",
"id": "4f1223cc9284c66df30bb5e038be21bf585aa85b",
"size": "1838",
... |
"""add cati to questionnaire response
Revision ID: 8ab7f6708ea3
Revises: b43e5f5c2905
Create Date: 2020-10-22 09:58:18.379524
"""
from alembic import op
import sqlalchemy as sa
import rdr_service.model.utils
from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus
from ... | {
"content_hash": "fcba09fb035c2bc2335331572e82330f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 125,
"avg_line_length": 32.78333333333333,
"alnum_prop": 0.7539400101677681,
"repo_name": "all-of-us/raw-data-repository",
"id": "5dc5836952082ea49c7023aa056800035f76128f",
... |
import logging
logging.basicConfig()
logger = logging.getLogger('behave_cli')
| {
"content_hash": "bda3c95fb8b05e049e7860118c71f6e0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 40,
"avg_line_length": 19.75,
"alnum_prop": 0.7848101265822784,
"repo_name": "longaccess/longaccess-behave",
"id": "cb8652e901f3a790f74e6fa05dfc521951ade630",
"size": "79",
... |
from __future__ import absolute_import
import datetime
import pickle
from StringIO import StringIO
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.db import connections, router, DEFAU... | {
"content_hash": "4ced3df83cd491ee52e1f43ce774b13f",
"timestamp": "",
"source": "github",
"line_count": 1916,
"max_line_length": 139,
"avg_line_length": 45.6419624217119,
"alnum_prop": 0.6201943967981703,
"repo_name": "mixman/djangodev",
"id": "d5bf8479bba1cd75e33e8fc2967425c5b0e950ee",
"size": "87... |
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'piclodio3.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"... | {
"content_hash": "3c37fdbcaafd75db95f1033be8ce0ca8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 30.35,
"alnum_prop": 0.657331136738056,
"repo_name": "Sispheor/piclodio3",
"id": "055c0fa187d48e330502c4b347b8273e0029354f",
"size": "629",
"binary... |
"""Support for Synology Surveillance Station Cameras."""
from functools import partial
import logging
import requests
from synology.surveillance_station import SurveillanceStation
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.const import (
CONF_NA... | {
"content_hash": "cbff0a1aa3f9f19bbe2fd90cbe71fc58",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 86,
"avg_line_length": 33.45454545454545,
"alnum_prop": 0.6580267558528428,
"repo_name": "soldag/home-assistant",
"id": "4417f72918d0dce4208e00db9f34781df4dc57aa",
"size":... |
"""Experimental utilities re:tf.estimator.*."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import,line-too-long,wildcard-import
from tensorflow.contrib.estimator.python.estimator.baseline import *
from tensorflow.contrib.estima... | {
"content_hash": "fd73da9d96390244c46e90a9fcec9568",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 81,
"avg_line_length": 39.15151515151515,
"alnum_prop": 0.7581269349845201,
"repo_name": "manipopopo/tensorflow",
"id": "e1453ae1d04ebd8d72f812b51480f0b05f7a5416",
"size": ... |
"""
test_assert_data_property.py -- Given a URI, a vivo data property predicate
and a value, generate RDF for asserting thar the URI has the data property
value. The tests demonsrtate that that the function does not check for
a valid predicate, nor a valid value.
The value can be a string or a dic... | {
"content_hash": "5c1c7b2d1299178deeb4a9ea8534461d",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 41.333333333333336,
"alnum_prop": 0.6811414392059554,
"repo_name": "mconlon17/vivotools",
"id": "a7a3d6f9ed24124806a200911c848f8a463c2b3e",
"size": "... |
from datetime import date
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django import forms
from wagtail.wagtailadmin.edit_handlers import (
get_form_for_model,
extract_panel_definitions_from_model_class,
FieldPanel,
RichTextFieldPanel,
... | {
"content_hash": "97fac4230c6d0bd2cfc426c04e8f69f2",
"timestamp": "",
"source": "github",
"line_count": 559,
"max_line_length": 161,
"avg_line_length": 44.11091234347048,
"alnum_prop": 0.6691540270905993,
"repo_name": "Klaudit/wagtail",
"id": "eb7b5889819d457fc1f148747e3980fc7a5f42e8",
"size": "246... |
import webapp2
## The CampaignManager is a web request handler for users trying to
## create/edit a DND campaign
class CampaignManager(webapp2.RequestHandler):
def get(self):
self.response.write('This is the CampaignManager')
| {
"content_hash": "d0626c697dc620e155b93a3e5ee8606a",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 67,
"avg_line_length": 30,
"alnum_prop": 0.7541666666666667,
"repo_name": "HeavensDevil321/dnd-app",
"id": "f2b88a52c2ffbd223f895566a31e2777976bac62",
"size": "258",
"bina... |
"""This example gets the account hierarchy under the current account.
Note: this code example won't work with test accounts. See
https://developers.google.com/adwords/api/docs/test-accounts
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this fil... | {
"content_hash": "19c260cee943908e049f91db2f878c66",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 77,
"avg_line_length": 34.890243902439025,
"alnum_prop": 0.6840265641384131,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "a077c122e10c7e64732347fa3c5682fb0b5ae251"... |
"""
Resolver implementation for querying successive authoritative servers to
lookup a record, starting from the root nameservers.
@author: Jp Calderone
todo::
robustify it
documentation
"""
import warnings
from twisted.python.failure import Failure
from twisted.internet import defer
from twisted.names impor... | {
"content_hash": "2b9c8480c5bad4b723b6b703013d4a4b",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 91,
"avg_line_length": 36.67235494880546,
"alnum_prop": 0.5878082829222895,
"repo_name": "normanmaurer/autobahntestsuite-maven-plugin",
"id": "c57efa3a9740d7765ce45fb7db0822... |
from msrest.paging import Paged
class PacketCaptureResultPaged(Paged):
"""
A paging container for iterating over a list of :class:`PacketCaptureResult <azure.mgmt.network.v2016_12_01.models.PacketCaptureResult>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
... | {
"content_hash": "3b1aeeff7751f780904769fbed508b08",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 147,
"avg_line_length": 32.0625,
"alnum_prop": 0.6393762183235867,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "6b9882e4db2e06709f7ab1ac31e038e7bd5b1437",
"size": "9... |
import os
import sys
def add_root_to_path ():
"""adds trex_control_plane root dir to script path, up to `depth` parent dirs"""
root_dirname = 'trex_control_plane'
file_path = os.path.dirname(os.path.realpath(__file__))
components = file_path.split(os.sep)
sys.path.append( str.join(os.sep, compo... | {
"content_hash": "14f3dcc6fff47a281cfe296581cf7aa8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 30.384615384615383,
"alnum_prop": 0.6734177215189874,
"repo_name": "zverevalexei/trex-http-proxy",
"id": "de4ec03b7d0279cf5753143c36cc232137132e66",
... |
from delphixpy.v1_6_0.delphix_engine import DelphixEngine
from delphixpy.v1_6_0.web import group, database
group_name = "Dev Copies"
database_name = "Employee DB - Dev"
server_session = DelphixEngine("landsharkengine", "delphix_admin", "landshark", "DOMAIN")
all_groups = group.get_all(server_session)
for each in all... | {
"content_hash": "60614865cd549dd7e05d2361ff7891e3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 89,
"avg_line_length": 28.5,
"alnum_prop": 0.759170653907496,
"repo_name": "mcbrune/delphixpy-automation",
"id": "a726aa7482a929cc9ffe4837e8bf6a240af65ea3",
"size": "649",
... |
"""
.. versionadded:: 4.0
Plug-in interfaces for coverage.py.
Coverage.py supports a few different kinds of plug-ins that change its
behavior:
* File tracers implement tracing of non-Python file types.
* Configurers add custom configuration, using Python code to change the
configuration.
* Dynamic context switch... | {
"content_hash": "19e26a8c9da1e6362c36ed5c910d0613",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 108,
"avg_line_length": 34.60566037735849,
"alnum_prop": 0.6694836704650783,
"repo_name": "sonntagsgesicht/regtest",
"id": "5b38e33619ce433a537aafcdfd35e34382395247",
"siz... |
import datetime
import mwparserfromhell
import pywikibot
import re
import sys
SOFT_REDIR_CATS = "Wikipedia soft redirected categories"
NUM_PAGES = 2
SUMMARY = "[[Wikipedia:Bots/Requests for approval/EnterpriseyBot 10|Bot]] removing the article class assessment"
def verify_redirect_age(site, page):
"""Returns True... | {
"content_hash": "97fd894741bc9a9c08d76e9e2b41f3e2",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 112,
"avg_line_length": 38.02247191011236,
"alnum_prop": 0.6382978723404256,
"repo_name": "APerson241/EnterpriseyBot",
"id": "aaa3c731f0e423b043c1e5a0d4af1c5dba27a71e",
"si... |
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyPublisher
from std_msgs.msg import Empty
'''
Created on 31.01.2017
@author: Alberto Romay
'''
class PublisherEmptyState(EventState):
'''
Publishes an empty (std_msgs/Empty) message on a given topic name.
-- topic string The topic ... | {
"content_hash": "ae14ea1686fdc6bcf241d21aeeec2790",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 68,
"avg_line_length": 21.285714285714285,
"alnum_prop": 0.6496644295302013,
"repo_name": "matteopantano/youbot-thesis",
"id": "707ae9134ed1e2b5ebe6672c6323ed298e4a72b8",
"... |
import anki.hooks
import aqt
import aqt.utils
from anki.notes import Note
from aqt.qt import QDialog, Qt, QHBoxLayout, QWidget, QGridLayout, QComboBox, QLabel
class ChangeModelDialog(QDialog):
"""
Dialog that allows user to create field and template maps from one note model to another
Extrated from main A... | {
"content_hash": "cb897cc2d4baa49c36f1e897f6dea0b0",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 116,
"avg_line_length": 36.705555555555556,
"alnum_prop": 0.5848342666868472,
"repo_name": "Stvad/CrowdAnki",
"id": "ad751dda9d8049f7b7d947ce5a53bd3c33fe8c65",
"size": "66... |
"""
Implement common functionality for all `wins` objects ; contains
`Base` and `Reference` classes.
Revision Info
=============
* $LastChangedBy: mandke $
* $LastChangedDate: 2011-09-23 12:36:44 -0500 (Fri, 23 Sep 2011) $
* $LastChangedRevision: 5140 $
:author: Ketan Mandke <kmandke@mail.utexas.edu>
:copyright:
... | {
"content_hash": "877c0ef3655dc837a615313e4df5d9fc",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 81,
"avg_line_length": 34.516363636363636,
"alnum_prop": 0.5936578171091446,
"repo_name": "reidlindsay/wins",
"id": "941f0f2ae2d9e9037263b7a39bc82773fb8fbd15",
"size": "95... |
"""
Script to add 'standard' glycans to proteins.
Pymol is used to edit the structures and generate CONECT records.
Created models are suitable as input to the Glycan Reader function of
CHARMM-GUI in order to generate CHARMM PSF/PDB pairs for simulation.
Note: The method is totally naive and matches the atoms of the l... | {
"content_hash": "4a3c6775325601e782d2963a9d9cc2d0",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 154,
"avg_line_length": 37.11695906432749,
"alnum_prop": 0.5850795651488893,
"repo_name": "dww100/pymol-glycosylation",
"id": "fe65ccdc5426b52d68e82381c64feed7fe2ea6e1",
"... |
import pytest
from awxkit.api.registry import URLRegistry
class One(object):
pass
class Two(object):
pass
@pytest.fixture
def reg():
return URLRegistry()
def test_url_pattern(reg):
desired = r'^/some/resources/\d+/(\?.*)*$'
assert reg.url_pattern(r'/some/resources/\d+/').pattern == desire... | {
"content_hash": "86a4b3a794e5f1d08bfeadd35a2ee845",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 102,
"avg_line_length": 36.79133858267716,
"alnum_prop": 0.666880684858213,
"repo_name": "GoogleCloudPlatform/sap-deployment-automation",
"id": "bfc3ca09ffb749e11b639c97026a... |
"""
This module contains a native python syntax highlighter.
"""
import logging
import re
from pyqode.core.api import SyntaxHighlighter as BaseSH
def any(name, alternates):
"""Return a named group pattern matching list of alternates."""
return "(?P<%s>" % name + "|".join(alternates) + ")"
def make_json_patt... | {
"content_hash": "fa311c89b3b82fb2d32822523fe35a0e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 28.057692307692307,
"alnum_prop": 0.5154215215901302,
"repo_name": "pyQode/pyqode.json",
"id": "f1aef6867ee91f1ff9a5e71dd5a938f8eb50cfd1",
"size": "1... |
import decimal
import datetime
from django.conf import settings
from django.utils import dateformat, numberformat, datetime_safe
from django.utils.importlib import import_module
from django.utils.encoding import smart_text
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from djan... | {
"content_hash": "c4e33973b3e17dfbec4be374644643f5",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 96,
"avg_line_length": 38.03664921465968,
"alnum_prop": 0.6502408809359945,
"repo_name": "vsajip/django",
"id": "a52de1a2beba375d99224eb538010b0d8c427e5f",
"size": "7265",... |
class Policy(object):
"""Decides which action to take."""
def __init__(self):
super(Policy, self).__init__()
# def select_action(self, actions, values):
# return
| {
"content_hash": "6f1cd59e87bd10d1d5f5be75bdfe1e4e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 27.285714285714285,
"alnum_prop": 0.5706806282722513,
"repo_name": "arnomoonens/DeepRL",
"id": "8331c9e0bcea913625adba9a25f29ba0f90d230d",
"size": "21... |
import os
from os.path import exists
from tornado.concurrent import return_future
class BaseStorage(object):
def __init__(self, context):
self.context = context
def put(self, bytes):
raise NotImplementedError()
@return_future
def get(self, callback):
raise NotImplementedError... | {
"content_hash": "b40f4f4d3d06314df36553b0fca87c77",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 44,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.5727699530516432,
"repo_name": "wking/thumbor",
"id": "7d865a91ae3f43622bf8599af20d74cb6b38eb9f",
"size": "890",
... |
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General con... | {
"content_hash": "1f8e8816c1751c60e842d406ae45cf92",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 80,
"avg_line_length": 31.81896551724138,
"alnum_prop": 0.6923597940937415,
"repo_name": "Rawtechio/oscar",
"id": "9b5deaf53f23eca4754dba508b5598b0a6c4a2d2",
"size": "7770... |
import shutil
import os.path
from dfsinterface import DfsInterface
class Vfs(DfsInterface):
def __init__(self, config):
DfsInterface.__init__(self, config)
self.prefix = self.config.get("Vfs", "prefix")
def __dfsToReal(self, dfspath):
realpath = os.path.join(self.prefix, dfspath)
return realpath
def copyT... | {
"content_hash": "16d0afa800cf5aaf5aaa006fa53db984",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 48,
"avg_line_length": 23.63013698630137,
"alnum_prop": 0.6892753623188406,
"repo_name": "stroucki/tashi",
"id": "650a805bd7f15a7008f65dd124a29286ead36472",
"size": "2562",... |
"""Op Handlers for use with different NetworkRegularizers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from morph_net.framework import concat_op_handler
from morph_net.framework import depthwise_convolution_op_handler
from morph_n... | {
"content_hash": "07e38e650d14225ae1ffc3a77d5dd00f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 80,
"avg_line_length": 37.563380281690144,
"alnum_prop": 0.6812898387701537,
"repo_name": "google-research/morph-net",
"id": "2121ff834b2277f5c6a3b636c65f21a37a4ded22",
"si... |
import sys
sys.path.insert(0, "..")
import smtplib
from email.mime.text import MIMEText
from config import EMAIL_CONFIG
def send_mail(to_list, subject, content):
"""docstring for send_mail(to_list, subject, content)"""
print "Sending email..."
user = EMAIL_CONFIG['user'] if '@' not in EMAIL_CONFIG['user... | {
"content_hash": "40f81185dc712056605c15a74c6466d8",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 127,
"avg_line_length": 28.862068965517242,
"alnum_prop": 0.5949820788530465,
"repo_name": "keepzero/fluent-mongo-parser",
"id": "551663dcb7a1fb1c46f199b0d6323e032c32e906",
... |
import binascii
import inspect
import json
import logging
import math
import netaddr
import os
import signal
import sys
import time
import traceback
from random import randint
from ryu import cfg
# import all packet libraries.
PKT_LIB_PATH = 'ryu.lib.packet'
for modname, moddef in sys.modules.iteritems():
if not ... | {
"content_hash": "dac2e49eaece4970b1e0f8d833ddb791",
"timestamp": "",
"source": "github",
"line_count": 1502,
"max_line_length": 79,
"avg_line_length": 40.1185086551265,
"alnum_prop": 0.5322944671246972,
"repo_name": "gopchandani/ryu",
"id": "ba52e52dc1989a32907ad045ef1b9b761c50f569",
"size": "6087... |
''' Class 8, exercise 3 '''
from net_system.models import NetworkDevice, Credentials
import django
def main():
''' create new NetworkDevice objects in the database '''
django.setup()
ipaddr = raw_input("Enter new IP address: ")
'''
temp_sw007 = NetworkDevice(
device_name = 'temp_sw007',... | {
"content_hash": "8223f09bf019de5b0dfd2446563cc619",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 60,
"avg_line_length": 20.63157894736842,
"alnum_prop": 0.5829081632653061,
"repo_name": "daveg999/automation_class",
"id": "c4d5beb9c06852974897ff7bab1753c8b99709e9",
"siz... |
"""View the 3-Layers BEM model using Freeview
"""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
import sys
import os
import os.path as op
from mne.utils import run_subprocess, get_subjects_dir
def freeview_bem_surfaces(subject, subjects_dir, method)... | {
"content_hash": "9723d4b4f236f4e25ea8c0642e1e7be8",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 76,
"avg_line_length": 31.45054945054945,
"alnum_prop": 0.6142557651991615,
"repo_name": "jmontoyam/mne-python",
"id": "78b085bd0ceb89c63b2a8adcdc832f264bc23d57",
"size": "... |
"""Tests for queues.py"""
import unittest
import unittest.mock
import asyncio
from asyncio import test_utils
class _QueueTestBase(unittest.TestCase):
def setUp(self):
self.loop = test_utils.TestLoop()
asyncio.set_event_loop(None)
def tearDown(self):
self.loop.close()
class QueueB... | {
"content_hash": "7e7c1305a20d515097ea81ba89400e80",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 77,
"avg_line_length": 28.84334763948498,
"alnum_prop": 0.564838925675173,
"repo_name": "tempbottle/ironpython3",
"id": "fc2bf460b8fb57004a59c8ac3c74ad35258d0bdd",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0020_policy'),
]
operations = [
migrations.CreateModel(
name='Checkcode',
fields=[
('id', models.Auto... | {
"content_hash": "e9697c8eaa963bec6bc0e77ef2f58822",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 28.44,
"alnum_prop": 0.5358649789029536,
"repo_name": "malaonline/Server",
"id": "6dce01b57d38855aea5dcb4d4af90bc02e3d12b3",
"size": "735",
"binar... |
import enum
import time
import typing as tp
from satella.coding.decorators import for_argument
from ..data import MetricData, MetricDataCollection
class MetricLevel(enum.IntEnum):
DISABLED = 1
RUNTIME = 2
DEBUG = 3
INHERIT = 4
def __ge__(self, other: 'MetricLevel') -> bool:
return self.v... | {
"content_hash": "600783be20d4df23fb2c7d922a3c6b33",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 100,
"avg_line_length": 35.74596774193548,
"alnum_prop": 0.6066553863508178,
"repo_name": "piotrmaslanka/satella",
"id": "8427195d275dab639b13d0c614788675874d6636",
"size"... |
from zoo.pipeline.api.onnx.mapper.operator_mapper import OperatorMapper
import zoo.pipeline.api.autograd as autograd
from zoo.pipeline.api.onnx.onnx_helper import OnnxHelper
import zoo.pipeline.api.keras.layers as zlayers
class ReduceMeanMapper(OperatorMapper):
def __init__(self, node, _params, _all_tensors):
... | {
"content_hash": "62d86b06ec0c06a79eb7f085b1f9b90c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 95,
"avg_line_length": 44.578947368421055,
"alnum_prop": 0.6953955135773318,
"repo_name": "intel-analytics/analytics-zoo",
"id": "f8f0ef4684fd68a1fec3f35242a1176cb65b8815",
... |
from bigml.api import HTTP_CREATED, HTTP_ACCEPTED
from bigml.api import FINISHED, FAULTY
from bigml.execution import Execution
from .read_resource_steps import wait_until_status_code_is
from .world import world, eq_
def the_execution_and_attributes(step, param, param_value, result):
"""Step: the script id is cor... | {
"content_hash": "5d94b8145463fc3aafd5942dd8f0c39f",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 39.666666666666664,
"alnum_prop": 0.6554621848739496,
"repo_name": "jaor/python",
"id": "f94cc4cdd051b7da040e6329c1097449188fc5da",
"size": "4112",
... |
import logging
import os
import stat
import yaml
from managesf.services import base
# from managesf.services import exceptions as exc
from managesf.services.gerrit import utils
logger = logging.getLogger(__name__)
class SFGerritReviewManager(base.CodeReviewManager):
def get(self, **kwargs):
client = se... | {
"content_hash": "60026b5f7959a0f41e025e9baa13162d",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 41.891891891891895,
"alnum_prop": 0.5616129032258065,
"repo_name": "enovance/managesf",
"id": "de4387722031b92c653eeffaef2985a8726a8a3c",
"size": "37... |
"""
Utilties for sending data.
Author: Jeff Kinnison (jkinniso@nd.edu)
"""
import json
import pika
class PikaProducer(object):
"""
Utility for sending job data to a set of endpoints.
"""
def __init__(self, rabbitmq_url, exchange, exchange_type="direct", routing_keys=[]):
"""
Instant... | {
"content_hash": "d6b4c6591c543204ce1186e8c4c58162",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 88,
"avg_line_length": 31.262376237623762,
"alnum_prop": 0.5566112430720507,
"repo_name": "apache/airavata",
"id": "3302d67c75e33989eda208d49ae600c195907801",
"size": "710... |
from __future__ import unicode_literals, absolute_import
"""
Useful utility functions.
"""
import os
from django.http import HttpResponse
from django.conf import settings
from twilio import twiml
from .models import Caller, Credential
def discover_twilio_credentials(user=None):
""" Due to the multiple ways o... | {
"content_hash": "a3dcdb067fbfe9c090a7fa170a86a8b2",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 79,
"avg_line_length": 29.45,
"alnum_prop": 0.6735993208828522,
"repo_name": "xHeliotrope/injustice_dropper",
"id": "617ea0a05a82c5b5439f0092708ba22fbe1d753f",
"size": "238... |
import click
import requests
from phue import Bridge, PhueRegistrationException
NO_BRIDGE_DETECTED = "No Bridge detected using: https://www.meethue.com/api/nupnp."
NO_BRIDGE_CONNECTION = "Unable to connect to Bridge. Press the button on Bridge and try again."
def discover():
r = requests.get('https://www.meethu... | {
"content_hash": "81430a1793d821fae8160b58a91fa82a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 95,
"avg_line_length": 29.64,
"alnum_prop": 0.7098515519568152,
"repo_name": "projectweekend/HUEcli",
"id": "6c48782958153f5f15ae9d7bb0e11b2550c872ae",
"size": "741",
"bi... |
"""An abstract interface class for output hooks.
"""
import abc
from airflow.hooks import base_hook
from plugins.pipeline_plugins.utils import blob
class OutputHookInterface(abc.ABC, base_hook.BaseHook):
"""An abstract interface class for output hooks."""
@abc.abstractmethod
def send_events(self, blb: blob.... | {
"content_hash": "ba01edef2952ade1ab1728b387790c61",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 32.8,
"alnum_prop": 0.705574912891986,
"repo_name": "google/TaglessCRM",
"id": "7e6c57da9511ba97c04fae3dbe31dbfb045fd83f",
"size": "1739",
"binary"... |
import itertools
import warnings
import numpy
from numpy.core.multiarray import normalize_axis_index
from scipy import special
from . import _ni_support
from . import _nd_image
from ._ni_docstrings import docfiller
__all__ = ['spline_filter1d', 'spline_filter', 'geometric_transform',
'map_coordinates', '... | {
"content_hash": "4d493e76ca6fd206b713e808ce7b6991",
"timestamp": "",
"source": "github",
"line_count": 930,
"max_line_length": 79,
"avg_line_length": 36.549462365591395,
"alnum_prop": 0.605630902297667,
"repo_name": "rgommers/scipy",
"id": "1e7dc3ba84896ed2e80134a0c44aeb038089f7ac",
"size": "35433... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.