text stringlengths 4 1.02M | meta dict |
|---|---|
from beamit.resources.base import Resource
class PasswordChangeRequest(Resource):
MEDIA_TYPE = 'application/vnd.beamit.password.change.request+json'
def __init__(self, email, password, new_password):
self.email = email
self.password = password
self.new_password = new_password
de... | {
"content_hash": "805ecd92fc785f196cec7c2ce6c76d2b",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 93,
"avg_line_length": 27.319148936170212,
"alnum_prop": 0.6137071651090342,
"repo_name": "ksweta/BeamIt-Server",
"id": "038a4e2425643785cb2f571d803b9a54b8153fdf",
"size": ... |
"""ovirt-host-setup websocket_proxy plugin."""
from otopi import util
from . import config
from . import pki
@util.export
def createPlugins(context):
config.Plugin(context=context)
pki.Plugin(context=context)
# vim: expandtab tabstop=4 shiftwidth=4
| {
"content_hash": "114801fcbb74f8aa9e48a91a90e0d35a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 46,
"avg_line_length": 15.588235294117647,
"alnum_prop": 0.7358490566037735,
"repo_name": "halober/ovirt-engine",
"id": "6e59d3656b27a0a252a16d1dee5aa6c98ef6ebcf",
"size": ... |
#!/usr/bin/env python
from datetime import date
import os
import re
SRC_DIR = 'src/main/java/'
ABSTRACT = re.compile(r'public abstract class Abstract')
TYPE = re.compile(r'class [A-Za-z0-9]+(<[^>]+?(?: extends ([A-Za-z0-9_]+))?>)?')
TARGET = re.compile(r'\s@Nullable (([A-Z][A-Za-z0-9_]+).*?)(<.+?>)? actual\) {')
IM... | {
"content_hash": "14cbd0a5b02985aab6004e5456dae51e",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 123,
"avg_line_length": 35.71653543307087,
"alnum_prop": 0.6166225749559083,
"repo_name": "pkware/truth-android",
"id": "e31059a54c21c5d37af06b22b8c33ca49e909b70",
"size":... |
'''
Write code to reverse a C-Style String. (C-String means that “abcd” is represented as
!ve characters, including the null character.)
'''
def reverse_cstyle_string(string_):
i = 2
reverse_string = ""
for _ in range(len(string_) - 1):
reverse_string += string_[-i]
i += 1
return reve... | {
"content_hash": "5806f98ca6be32a60492e78588a167a7",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 85,
"avg_line_length": 21.761904761904763,
"alnum_prop": 0.5864332603938731,
"repo_name": "roommen/CtCI",
"id": "4f50c51f0b9221bb8a5cb1b744eb45c0cae631ad",
"size": "461",
... |
import json
from urllib.request import urlopen
from datetime import datetime
from i3pystatus import IntervalModule
from i3pystatus.core.util import internet, require
class SpaceAPI(IntervalModule):
"""
Show if a hackerspace is open
.. rubric:: Available formatters
* {state}
* {message}
* {... | {
"content_hash": "a6d42942d6be437bec83acc95ae0ceb9",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 91,
"avg_line_length": 26.176470588235293,
"alnum_prop": 0.5865168539325842,
"repo_name": "Arvedui/i3pystatus",
"id": "167e6806bbea5803689aaf04e08a65fad485d807",
"size": "1... |
import itertools
import unittest
from oslo_log import log as logging
import mock
import oslotest.base
import testtools
from designate import exceptions
from designate import objects
LOG = logging.getLogger(__name__)
def debug(*a, **kw):
for v in a:
LOG.debug(repr(v))
for k in sorted(kw):
L... | {
"content_hash": "c1ea252b4e5fefe8c93e82ffaaa42df4",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 71,
"avg_line_length": 31.43820224719101,
"alnum_prop": 0.5393137955682631,
"repo_name": "tonyli71/designate",
"id": "58ba537acb8149f078b15fe0e1ae50a0e6bfcaea",
"size": "6... |
import asyncore
import os
import socket
import sys
import time
import traceback
from .. import protocol
from .. import util
BLOCK_SIZE = 8192
class Connection(asyncore.dispatcher):
'''A connection to a remote peer node.
Handles buffering input and output into messages and call the
corresponding ... | {
"content_hash": "4f70d8dbc3213053306e4603fdf86228",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 115,
"avg_line_length": 31.53818181818182,
"alnum_prop": 0.5715438717860025,
"repo_name": "ricmoo/pycoind",
"id": "edf68602bd60de61dcbd0c58e63a84fbe7bf0e00",
"size": "9793... |
from principal.models import Alumno, Imparteasignatura, Asignatura
from principal.services import DepartmentService
from django.db.models import Q
def get_student_subjects(student_id):
student = Alumno.objects.get(id=student_id)
return student.asignaturas.all().order_by('nombre')
def get_lecturer_subjects(l... | {
"content_hash": "5c7047bc491f6acd509a1392c7ed50d9",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 119,
"avg_line_length": 30.314102564102566,
"alnum_prop": 0.6614506238105308,
"repo_name": "carborgar/gestionalumnostfg",
"id": "f16c2b5a2c0642a834f356930917412c24c52ba4",
... |
from django.conf import settings
from django.db import models, transaction
from django.utils.crypto import get_random_string
from django.utils.timezone import now
class Key(models.Model):
key = models.CharField(max_length=254, unique=True, db_index=True)
created = models.DateTimeField(default=now)
user = ... | {
"content_hash": "edea14ee8a9898e4adfffc575f362f08",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 34.25,
"alnum_prop": 0.6613138686131387,
"repo_name": "MarkusH/django-sshlogin",
"id": "ec67ea17a38daec3e6fe88314cc53459ea0a8b40",
"size": "685",
"... |
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse, reverse_lazy
from django.shortcuts import render
from django.template import Context
from django.views.generic import FormView, CreateView
from django.views.generic.edit import ModelFormMixin
from rest_framework impo... | {
"content_hash": "a98f073f27a9a0e5fdc8233878895734",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 58,
"avg_line_length": 26.032258064516128,
"alnum_prop": 0.6951672862453532,
"repo_name": "hub-ology/video_village",
"id": "301a08d6087d463646ea879037ffb92d512091c9",
"size... |
"""Test the NEW_NAME config flow."""
from unittest.mock import patch
from homeassistant import config_entries, setup
from homeassistant.components.NEW_DOMAIN.config_flow import CannotConnect, InvalidAuth
from homeassistant.components.NEW_DOMAIN.const import DOMAIN
async def test_form(hass):
"""Test we get the fo... | {
"content_hash": "bab97d4d0252483b3c889058d26af69f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 86,
"avg_line_length": 33.24175824175824,
"alnum_prop": 0.5980165289256199,
"repo_name": "partofthething/home-assistant",
"id": "04eab6e683c6c41605245ff39a656b3f671c134d",
... |
import errno
import os
import re
from string import Template
PYTHONQT_WRAPPER_WITH_PARENT = Template("""
//-----------------------------------------------------------------------------
class PythonQtWrapper_${className} : public QObject
{
Q_OBJECT
public:
public Q_SLOTS:
${className}* new_${className}(${parentClassN... | {
"content_hash": "56077cf7d90b6cc46b6f8cc4990661a8",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 137,
"avg_line_length": 36.708695652173915,
"alnum_prop": 0.5527656046428995,
"repo_name": "rkhlebnikov/CTK",
"id": "ef7d895bece757f8a4f9d5f957bd31d33d2c14ed",
"size": "84... |
from TProtocol import *
from struct import pack, unpack
__all__ = ['TCompactProtocol', 'TCompactProtocolFactory']
CLEAR = 0
FIELD_WRITE = 1
VALUE_WRITE = 2
CONTAINER_WRITE = 3
BOOL_WRITE = 4
FIELD_READ = 5
CONTAINER_READ = 6
VALUE_READ = 7
BOOL_READ = 8
def make_helper(v_from, container):
def helper(func):
def... | {
"content_hash": "baab88e314d0f2f1712ea8ace3827dea",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 80,
"avg_line_length": 26.96808510638298,
"alnum_prop": 0.6412228796844182,
"repo_name": "CodEnFisH/palantir",
"id": "6d57aeba9a82b32310e7420761488435eae88366",
"size": "1... |
__all__ = ['spilloverpolicy_stats'] | {
"content_hash": "ef4b164675cadc8c3e5b2054b6dd4a12",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 35,
"avg_line_length": 35,
"alnum_prop": 0.6571428571428571,
"repo_name": "benfinke/ns_python",
"id": "3c5b6922c24e2b7b962e394baeb9f7c62d31917f",
"size": "35",
"binary": f... |
import traceback
def shell():
from config import get_version, set_win32_requests_ca_bundle_path
set_win32_requests_ca_bundle_path()
print """
Datadog Agent v%s - Python Shell
""" % (get_version())
while True:
cmd = raw_input('>>> ')
try:
exec(cmd)
except Except... | {
"content_hash": "8f2ebcd04886177fc81cce7b743e7465",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 69,
"avg_line_length": 21.57894736842105,
"alnum_prop": 0.5609756097560976,
"repo_name": "tebriel/dd-agent",
"id": "516e77c38027288a2c54946badb91bbc47c98555",
"size": "517"... |
import re
from logging import CRITICAL
import etree_loader
"""
CONSTANTS
=============================================================================
"""
"""
Constants you might want to modify
-----------------------------------------------------------------------------
"""
BLOCK_LEVEL_ELEMENTS = re.compile("^(p|... | {
"content_hash": "5db2ff8857f56649ee7201d3fe32e076",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 80,
"avg_line_length": 30.52212389380531,
"alnum_prop": 0.5326181501884604,
"repo_name": "stupidnetizen/miniblog",
"id": "db45a5ebc3cdebb84fa28ade8e6f54f69ca28a72",
"size"... |
"""
Created on Tue Apr 07 15:11:49 2014
@author: Maurizio Napolitano <napo@fbk.eu>
The MIT License (MIT)
Copyright (c) 2016 Fondazione Bruno Kessler http://fbk.eu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in... | {
"content_hash": "2a12f107b78f5314d73b08113158676f",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 143,
"avg_line_length": 45.46666666666667,
"alnum_prop": 0.7155425219941349,
"repo_name": "napo/arcgisrest2spatialite",
"id": "cf6dbf2efcc41bc6e64f2ed150955e30fe84b0c4",
"s... |
from pyxl import html
print(<html><body>Hello World!</body></html>)
| {
"content_hash": "315db4501fc788729a2cfbdf1b3e7908",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 45,
"avg_line_length": 23,
"alnum_prop": 0.7101449275362319,
"repo_name": "lez/pyxl3",
"id": "2b2ffee16fd344066ddfc4d66d3cfab74701af29",
"size": "85",
"binary": false,
"... |
"""unit tests for sparse utility functions"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (TestCase, run_module_suite, assert_equal,
assert_raises)
from scipy.sparse import sputils
class TestSparseUtils(TestCase):
def t... | {
"content_hash": "fb45b09b57c0c7ddc13c234ce947ad28",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 75,
"avg_line_length": 38.333333333333336,
"alnum_prop": 0.6302945301542777,
"repo_name": "DailyActie/Surrogate-Model",
"id": "5c18a38c05d5ab2ce8e75220d146a8681aa4f9f1",
"s... |
from layer import *
class SoftmaxLayer(Layer):
def __init__(self, *args, **kwargs):
super(SoftmaxLayer, self).__init__(*args, **kwargs)
@classmethod
def IsLayerType(cls, proto):
return proto.hyperparams.activation == deepnet_pb2.Hyperparams.SOFTMAX
def ApplyActivation(self):
state = self.state
... | {
"content_hash": "66e60218840155a3ff5fcd2fa1144550",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 88,
"avg_line_length": 38.41284403669725,
"alnum_prop": 0.6923811798423692,
"repo_name": "kashif/deepnet",
"id": "2da61ab7a12a4c62a76815c5d026311c1296c0dd",
"size": "4187"... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.playbook.attribute import FieldAttribute
from ansible.playbook.base import Base
class LoopControl(Base):
_loop_var = FieldAttribute(isa='str')
_label = FieldAttribute(isa='str')
_pause = FieldAttribute(i... | {
"content_hash": "98f17b1e858f2a2051ef6ae006e41ad9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 82,
"avg_line_length": 29.15,
"alnum_prop": 0.6895368782161235,
"repo_name": "e-gob/plataforma-kioscos-autoatencion",
"id": "b983ee88ed591da52d3ab74f7c509ceae311ef31",
"siz... |
"""Layer serialization/deserialization functions.
"""
# pylint: disable=wildcard-import
# pylint: disable=unused-import
import threading
from tensorflow.python import tf2
from tensorflow.python.keras.engine import base_layer
from tensorflow.python.keras.engine import input_layer
from tensorflow.python.keras.engine im... | {
"content_hash": "ced10e4511c61b3a5d9db1e09804ae55",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 132,
"avg_line_length": 45.92156862745098,
"alnum_prop": 0.7717050953600911,
"repo_name": "sarvex/tensorflow",
"id": "f623084ee7a854be185d72e6b945acf2ce994c3e",
"size": "7... |
from fabric import task
@task
def expect_conf_value(c):
assert c.it_came_from == "yml"
@task
def expect_conf_key_filename(c):
expected = ["private.key", "other.key"]
got = c.connect_kwargs.key_filename
assert got == expected, "{!r} != {!r}".format(got, expected)
@task
def expect_cli_key_filename(c... | {
"content_hash": "1e72928aed1f2421c72a607829a2be3e",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 22.75,
"alnum_prop": 0.6329670329670329,
"repo_name": "fabric/fabric",
"id": "650ced7d88202e3327ebef6e50bb9d22322a718a",
"size": "455",
"binary": f... |
"""Test descendant package tracking code."""
from decimal import Decimal
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.messages import COIN
from test_framework.p2p import P2PTxInvStore
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
as... | {
"content_hash": "2f0e8a637dab76213247ffe18c0fe001",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 153,
"avg_line_length": 45.4089552238806,
"alnum_prop": 0.6153037075992638,
"repo_name": "achow101/bitcoin",
"id": "068fdc0b658d0477bc38b42d5408c13cf46a46cc",
"size": "154... |
from sqlalchemy import *
from migrate import *
from nova import log as logging
from nova import utils
meta = MetaData()
networks = Table('networks', meta,
Column("id", Integer(), primary_key=True, nullable=False))
# Add priority column to networks table
priority = Column('priority', Integer())
def upgrade(mi... | {
"content_hash": "774353c7b72d16e6f0c5a6b09a9e7a82",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 21.517241379310345,
"alnum_prop": 0.7019230769230769,
"repo_name": "nii-cloud/dodai-compute",
"id": "b9b0ea37cec8163e1a64d81c6e91137bd560289b",
"size... |
"""Help to generate SQL string usable by the Python DB-API
:author: Logilab
:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
:contact: http://www.logilab.fr/ -- mailto:python-projects@logilab.org
"""
__docformat__ = "restructuredtext en"
# SQLGenerator #########################################################... | {
"content_hash": "b9a6d25fe3c510f9735f2c604e25c066",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 83,
"avg_line_length": 35.64192139737991,
"alnum_prop": 0.5026954177897575,
"repo_name": "h2oloopan/easymerge",
"id": "c19756df8aa8d843acfef35214b07ed438237b07",
"size": "... |
"""Python 2/3 compatibility module"""
import sys
if sys.version_info < (3,):
reload(sys)
sys.setdefaultencoding('utf-8')
| {
"content_hash": "d50e2b093a62c5094595130b0c7ba028",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 37,
"avg_line_length": 18.142857142857142,
"alnum_prop": 0.6850393700787402,
"repo_name": "pcbje/gransk",
"id": "db43d5570a27400be84946f3aff8ee5c1ffc324b",
"size": "170",
... |
from __future__ import print_function
# Form implementation generated from reading ui file './acq4/analysis/modules/MapImager/SpatialCorrelatorCtrlTemplate.ui'
#
# Created: Tue Dec 24 01:49:13 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCor... | {
"content_hash": "7791a8c158409d272297f4ffb6a200bd",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 121,
"avg_line_length": 50.452991452991455,
"alnum_prop": 0.6915127901067254,
"repo_name": "meganbkratz/acq4",
"id": "7ba2e28cd4c26277a9149230a0d4af472ef1bc30",
"size": "5... |
import sys
import unittest
import numpy as np
from op_test import OpTest
from test_softmax_op import stable_softmax
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard
import paddle
import paddle.nn.functional as F
paddle.enable_static()
CUDA_BLOCK_SIZE = 32
... | {
"content_hash": "05f9ae7363af46396ec4e7fcc9aee579",
"timestamp": "",
"source": "github",
"line_count": 706,
"max_line_length": 80,
"avg_line_length": 32.555240793201136,
"alnum_prop": 0.5170988513748694,
"repo_name": "PaddlePaddle/Paddle",
"id": "b3febb9b40daa1cf75deb90196d0caee90a0779b",
"size": ... |
NXT_TST_INTERVAL = 1
NEW_ROUND_INTERVAL = 2
TOGGLE_INTERVAL = 0.5
from rpiledmatrix import switch_on, switch_off, turn_all_off, cleanup, blink_on, blink_off, LED_INDICES
import time as time
def blink_on_serial():
for led in LED_INDICES:
blink_on(led)
time.sleep(TOGGLE_INTERVAL)
blink_off... | {
"content_hash": "b698fc684d276793e3452be2f74766b6",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 103,
"avg_line_length": 24.344827586206897,
"alnum_prop": 0.6317280453257791,
"repo_name": "san2488/echo-lets-play-tic-tac-toe",
"id": "30bd05e4870e7fd7efc5dc81cda110428fc8b2... |
from __future__ import absolute_import
from grab.error import GrabError
__all__ = ('SpiderError', 'SpiderMisuseError', 'FatalError',
'SpiderInternalError',
'NoTaskHandler', 'NoDataHandler')
class SpiderError(GrabError):
"""Base class for Spider exceptions"""
class SpiderConfigurationErro... | {
"content_hash": "1ead80a47aabdde63aba9b43984c3224",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 60,
"avg_line_length": 22.431818181818183,
"alnum_prop": 0.7011144883485309,
"repo_name": "mawentao007/reading_grab",
"id": "1402ffc1299d1b05770181f649787c3ef4055475",
"siz... |
import datetime
import random
import uuid
from oslo.utils import timeutils
import six
from keystone.common import sql
from keystone.contrib.oauth1 import core
from keystone import exception
from keystone.i18n import _
from keystone.openstack.common import jsonutils
class Consumer(sql.ModelBase, sql.DictBase):
_... | {
"content_hash": "9a34036a72220d510fc48bad1e682c7c",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 79,
"avg_line_length": 40.63529411764706,
"alnum_prop": 0.6078942289133372,
"repo_name": "scrapinghub/keystone",
"id": "9ad6cd4d64f841b50e18819c5f24e98ff631a485",
"size": ... |
import inspect
class StubOutForTesting:
"""Sample Usage:
You want os.path.exists() to always return true during testing.
stubs = StubOutForTesting()
stubs.Set(os.path, 'exists', lambda x: 1)
...
stubs.UnsetAll()
The above changes os.path.exists into a lambda that returns 1. Once
... | {
"content_hash": "bb9f3da0bf9c9ce8f72216620b1d1f59",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 79,
"avg_line_length": 34.403225806451616,
"alnum_prop": 0.6601031411157994,
"repo_name": "chromium/chromium",
"id": "ba391045b6d693f10cd0b39b19d1830b7ec3d76d",
"size": "4... |
"""
HTTP client.
"""
from __future__ import division, absolute_import
import os
import warnings
try:
from urlparse import urlunparse, urljoin, urldefrag
except ImportError:
from urllib.parse import urljoin, urldefrag
from urllib.parse import urlunparse as _urlunparse
def urlunparse(parts):
r... | {
"content_hash": "193d2cbb30bb0419c5377bee1bbf4445",
"timestamp": "",
"source": "github",
"line_count": 2166,
"max_line_length": 133,
"avg_line_length": 33.5517082179132,
"alnum_prop": 0.6187992789619253,
"repo_name": "ArcherSys/ArcherSys",
"id": "ae6b90460addec3ebb88de51e735b35fe2ae2bc7",
"size": ... |
def amalgamate_sql(app, model, extra_fields=None, table_name=None,
view_name=None):
"""This function returns a string, containing SQL to create
a view exposing given model's content_type_id and object_id,
with some extra_fields optionally.
This function does *not* escape or quote its... | {
"content_hash": "71187386f8950612896ee82a9928c0bb",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 90,
"avg_line_length": 29.952380952380953,
"alnum_prop": 0.48370429252782193,
"repo_name": "mpasternak/djorm-ext-filtered-contenttypes",
"id": "a0cd7be686cf9c605a4a9721bf63b5... |
from __future__ import unicode_literals
from ..maths import UnaryMaths
def test_UnaryMaths_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_file=dict(argstr='%s',
mandato... | {
"content_hash": "e981056e8b3cd176428b52239eec244e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 67,
"avg_line_length": 23.87272727272727,
"alnum_prop": 0.6047220106626047,
"repo_name": "mick-d/nipype",
"id": "4132931d57accf6f0cb4769c6629257a6e364401",
"size": "1367",
... |
from __future__ import print_function
import unicodedata
from collections import deque
class InputTranslator(object):
def push(self, evt):
pass
def get(self):
pass
def empty(self):
pass
class KeymapTranslator(InputTranslator):
def __init__(self, keymap, verbose=0,
... | {
"content_hash": "66d887c82db0fad3cc78924824652e9a",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 82,
"avg_line_length": 29.34285714285714,
"alnum_prop": 0.49756572541382665,
"repo_name": "timm/timmnix",
"id": "47e22ca01a9d48a7a34a9a76c681567bc551865a",
"size": "3629",
... |
"""Script for setuptools."""
from setuptools import setup, find_packages
with open('README.md') as readme:
long_description = readme.read()
version = __import__('gooey').__version__
setup(
name='Gooey',
version=version,
url='http://pypi.python.org/pypi/Gooey/',
author='Chris Kiehl... | {
"content_hash": "d204fadbafb1b8bd1b33ed6b8f8680a9",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 164,
"avg_line_length": 30.266666666666666,
"alnum_prop": 0.6244493392070485,
"repo_name": "alexkolar/Gooey",
"id": "79f6fe9c86f43c700f05aa7a53415e621bf90b15",
"size": "181... |
import numpy as np
import cv2
import urllib
def setEmpty(event, x, y, flags, param):
global emptyFrame, emptyFrame32
if event == cv2.EVENT_LBUTTONDOWN:
emptyFrame = frame
elif event == cv2.EVENT_LBUTTONDBLCLK:
emptyFrame = np.zeros(np.shape(frame), np.uint8)
emptyFrame32 = np.float32(em... | {
"content_hash": "160f02543ee29f357fb9bf5fdb2f10c3",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 110,
"avg_line_length": 25.294871794871796,
"alnum_prop": 0.644703497212367,
"repo_name": "SSG-DRD-IOT/commercial-iot-security-system",
"id": "3ae63dd622cd3e7a170d59f8664e24e... |
"""``test_networkd.py``
`NetworkD Unittests`
"""
from unittest.mock import MagicMock
from testlib.linux.networkd import NetworkD
class TestNetworkD(object):
def test_single_mgmt_port(self):
run_command = MagicMock()
n = NetworkD(run_command, ["test"])
n.clear_settings()
assert ... | {
"content_hash": "f778fd3219fa24b80c264b1116560e36",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 103,
"avg_line_length": 47.793103448275865,
"alnum_prop": 0.5580808080808081,
"repo_name": "taf3/taf",
"id": "b5fdce1f323850c69013285963f10fa3d15bf2b1",
"size": "3388",
"... |
import logging
from datetime import datetime
from sqlalchemy import or_
from aleph.core import db, url_for
from aleph.model.user import User
from aleph.model.forms import ListForm
log = logging.getLogger(__name__)
list_user_table = db.Table('list_user', db.metadata,
db.Column('list_id', db.Integer, db.ForeignK... | {
"content_hash": "642eaced5011a310f1f38436154f39f0",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 72,
"avg_line_length": 30.344827586206897,
"alnum_prop": 0.5713068181818182,
"repo_name": "nightsh/aleph",
"id": "5c78797cea59a6a4c2df176fa49935b726e9422e",
"size": "3520"... |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__,'bbi_file.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| {
"content_hash": "17ee224d9927005f3b6d91f6a63bb8af",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 69,
"avg_line_length": 39.714285714285715,
"alnum_prop": 0.5935251798561151,
"repo_name": "poojavade/Genomics_Docker",
"id": "430aa1c508a7403f58708914a9010fe447713f87",
"siz... |
import pytest
import easypost
@pytest.mark.vcr()
def test_parcel_create(basic_parcel):
parcel = easypost.Parcel.create(**basic_parcel)
assert isinstance(parcel, easypost.Parcel)
assert str.startswith(parcel.id, "prcl_")
assert parcel.weight == 15.4
@pytest.mark.vcr()
def test_parcel_retrieve(basic... | {
"content_hash": "618e6680c00dd25ea708388a57bbac2e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 58,
"avg_line_length": 24.454545454545453,
"alnum_prop": 0.7304832713754646,
"repo_name": "dsanders11/easypost-python",
"id": "fe21100ac76f1868686d162b2d49a8e3d0a9dd03",
"s... |
"""Common utilities for registering LinearOperator methods."""
# Note: only use this method in the commuting case.
def combined_commuting_self_adjoint_hint(operator_a, operator_b):
"""Get combined hint for self-adjoint-ness."""
# The property is preserved under composition when the operators commute.
if operat... | {
"content_hash": "342130a36ac03768f4915e35871936e8",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 36.12328767123287,
"alnum_prop": 0.7224118316268487,
"repo_name": "gautam1858/tensorflow",
"id": "b6ae4f40d0db045e0edc357d13d428498e5653fc",
"size":... |
from flask_script import Manager
from flask import Flask
import os
from lxml import etree
from app.models import db, Literature, Author
from app.models import AuthorLiterature, Cite, Citememe
from datetime import datetime
import re
import spacy
basedir = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__)... | {
"content_hash": "53196fa242882b68f45b3b8e60dec388",
"timestamp": "",
"source": "github",
"line_count": 680,
"max_line_length": 103,
"avg_line_length": 33.8,
"alnum_prop": 0.5627392969021928,
"repo_name": "cit563emef2dasdme/jklasjdf12nfasfdkl",
"id": "304d1ee5f3da286f2ea0b217f95d231471b0f7b6",
"siz... |
import base64
from django.contrib.auth import get_user_model
from django.contrib.auth.tokens import default_token_generator
from django.core import mail
from django.core.files.images import get_image_dimensions
from rest_framework.reverse import reverse
from django.utils.encoding import force_bytes
from django.utils.ht... | {
"content_hash": "a10f90f974693fcda62610574662441f",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 120,
"avg_line_length": 40.491749174917494,
"alnum_prop": 0.6266199364251365,
"repo_name": "yeti/YAK-server",
"id": "dfd3761bb28fce125bca056e9552ad4a2238b15e",
"size": "12... |
"""Join sensor data files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=missing-docstring
import argparse
import glob
import os
import sys
# Basic model parameters as external flags.
FLAGS = None
def join_sensor_data_file():
tar... | {
"content_hash": "cf1cf83777ce8dcb04544ed22b900bae",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 94,
"avg_line_length": 34.660377358490564,
"alnum_prop": 0.5955362003266195,
"repo_name": "eq-inc/eq-tensorflow-learn_uh_sensor_values",
"id": "ece3fbd5d5f595071d845e6cb43d9e... |
with open('inputs/strings.txt') as f:
content = f.read().splitlines()[:-1]
content_for_encode = content
total_original_length = 0
total_string_length = 0
for i in range(0,len(content)):
total_original_length += len(content[i])
#Remove quote marks from two ends of each line
if (content[i][0] == '\"... | {
"content_hash": "883432f9690dab40e90842e4b7273645",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 173,
"avg_line_length": 33.701492537313435,
"alnum_prop": 0.524800708591674,
"repo_name": "icydoge/AdventOfCodeSolutions",
"id": "b2d2f415ad6bb8f1c7fb063396faffdf212de903",
... |
from random import randint
from Entity import Entity
__author__ = 'George'
class Ball(Entity):
def __init__(self, app):
super().__init__(app.canvas)
self.app = app
self.speed = 6
self.width = 50
self.height = 50
self.color = "#FF00FF"
self.lastNotePos = {
... | {
"content_hash": "1c05b8dd48edbe8c865019c61e248288",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 145,
"avg_line_length": 28.906976744186046,
"alnum_prop": 0.5442477876106194,
"repo_name": "georgePadolsey/PythonProjects",
"id": "ea58db72f710da3a9b0de5b5d7161e4a31443535",
... |
import json
import re
import time
from datetime import datetime, timedelta
from itertools import cycle
from os import path
from django import test
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.test.ut... | {
"content_hash": "039b16d82bdbd000555773dd7a022003",
"timestamp": "",
"source": "github",
"line_count": 4338,
"max_line_length": 79,
"avg_line_length": 40.82618718303365,
"alnum_prop": 0.5935156744059987,
"repo_name": "tsl143/zamboni",
"id": "c025ec76c4ecf91492b02bcedecd79b69242da3f",
"size": "1771... |
"""Class MirroredStrategy implementing DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import threading
import six
from tensorflow.contrib.distribute.python import cross_tower_ops as cross_tower_ops_lib
from tenso... | {
"content_hash": "da207c7166ef97b5c8abb3976c1f9729",
"timestamp": "",
"source": "github",
"line_count": 513,
"max_line_length": 103,
"avg_line_length": 40.15204678362573,
"alnum_prop": 0.6417613360520439,
"repo_name": "yanchen036/tensorflow",
"id": "cef0a2907b85d230606eb530a0e94549b6b95e53",
"size"... |
import atexit
import sys
import time
from typing import Dict
from urllib3.exceptions import HTTPError
from polyaxon import pkg, settings
from polyaxon.agents.base import BaseAgent
from polyaxon.auxiliaries import V1PolyaxonInitContainer, V1PolyaxonSidecarContainer
from polyaxon.lifecycle import V1StatusCondition, V1... | {
"content_hash": "fa09781b9912202c24bb526fe579dc38",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 86,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.6125,
"repo_name": "polyaxon/polyaxon",
"id": "f04b8cfd4ed605ba293eaa844e51e3b5902f105e",
"size": "4445",
"bin... |
from allauth.socialaccount import app_settings
from allauth.socialaccount.models import SocialApp
class Provider(object):
def get_login_url(self, request, next=None, **kwargs):
"""
Builds the URL to redirect to when initiating a login for this
provider.
"""
raise NotImpleme... | {
"content_hash": "cd3878a4ec21a8f88a2be88c710d1988",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 98,
"avg_line_length": 32.65277777777778,
"alnum_prop": 0.6316461080391322,
"repo_name": "rawjam/django-allauth",
"id": "571f8e533d4603ceb0a2baec233da8e031ef2d80",
"size": ... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | {
"content_hash": "59c8d32f99af804f8870a76808290121",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 151,
"avg_line_length": 43.549019607843135,
"alnum_prop": 0.7172444844664565,
"repo_name": "redmeros/Lean",
"id": "30084c11f8e83cb9e58d1678486190bbd738bef4",
"size": "2223"... |
from __future__ import absolute_import, print_function, division
from os.path import join
import contextlib
import os
import shutil
import subprocess
import re
import shlex
import runpy
import zipfile
import tarfile
import platform
import click
import pysftp
import fnmatch
# https://virtualenv.pypa.io/en/latest/usergu... | {
"content_hash": "95b98e110219933e2564acdde15c4c56",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 98,
"avg_line_length": 31.514745308310992,
"alnum_prop": 0.5659719268396427,
"repo_name": "ParthGanatra/mitmproxy",
"id": "6177b3f331bce404034d7aab9ad8cd156f11f676",
"size... |
"""
Test suite for SocketServer.py.
"""
import contextlib
import imp
import os
import select
import signal
import socket
import select
import errno
import tempfile
import unittest
import SocketServer
import test.test_support
from test.test_support import reap_children, reap_threads, verbose
try:
import threading
... | {
"content_hash": "1854ccf9e4ff968b460774888dbf8388",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 77,
"avg_line_length": 33.65337423312884,
"alnum_prop": 0.571780147662018,
"repo_name": "albertjan/pypyjs",
"id": "83f5e3f72074920231ca9313adaf6b9a32611367",
"size": "1097... |
from nexus import settings,ProjectManager,Job
from nexus import generate_physical_system
from nexus import loop,linear,vmc,dmc
from qmcpack_calculations import standard_qmc
#general settings for nexus
settings(
pseudo_dir = './pseudopotentials',# directory with all pseudopotentials
sleep = 3, ... | {
"content_hash": "9adfeb10630857cc84238e50b6c142ec",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 79,
"avg_line_length": 44.601351351351354,
"alnum_prop": 0.5149219815179519,
"repo_name": "habanero-rice/hclib",
"id": "b476114712a3de1a9d25281b6d26a07e4cc11856",
"size": ... |
"""
796 API Trading Example/DEMO in Python
After getToken.
"""
import urllib.request, urllib.error, urllib.parse
import time
import base64
import hashlib
import hmac
import http.client
import json
import os
def get_796_token(appid,apikey,secretkey):
timestamp = time.time()#"1414142919" #time.time()
... | {
"content_hash": "aa1e46563558e0a9c98ae234d49b4240",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 161,
"avg_line_length": 33.71,
"alnum_prop": 0.6481756155443489,
"repo_name": "frrp/cryptoexchange",
"id": "198f45529cc89d3e67ff73bc2433348056ca8cc8",
"size": "3417",
"b... |
import unittest
from ggrc.utils import structures
class TestCaseInsensitiveDict(unittest.TestCase):
def setUp(self):
self.ci_dict = structures.CaseInsensitiveDict()
def test_basic_dict_functions(self):
self.ci_dict["Hello"] = "World"
self.assertEqual(self.ci_dict["Hello"], "World")
self.ci_dict... | {
"content_hash": "6194b8fb25aa73deb5460ef04cee1f61",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 71,
"avg_line_length": 29.75,
"alnum_prop": 0.6214833759590793,
"repo_name": "edofic/ggrc-core",
"id": "3a6e7615e8156da06ad313d8f8cdfdba717bf760",
"size": "2850",
"binary... |
import unittest
import mock
from ...management.rules_configs import RulesConfigs
class TestRulesConfigs(unittest.TestCase):
def test_init_with_optionals(self):
t = RulesConfigs(
domain="domain", token="jwttoken", telemetry=False, timeout=(10, 2)
)
self.assertEqual(t.client.op... | {
"content_hash": "88f577b8728e347be2dd650c4d2d79f6",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 79,
"avg_line_length": 32.125,
"alnum_prop": 0.6465629053177692,
"repo_name": "auth0/auth0-python",
"id": "bfe08293303957c5c6ed6fc301f70a6e54207555",
"size": "1542",
"bin... |
from django import forms
from .models import Link
class LinkCreationForm(forms.Form):
link = forms.URLField(label='url to be shortened')
| {
"content_hash": "c088144f05c31cc3c70ed7ba936ae07e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 16.22222222222222,
"alnum_prop": 0.7465753424657534,
"repo_name": "xpostudio4/django-url-shortener",
"id": "bcbe673bfdab925c4e8dafcb335653f86af9f4eb",
... |
from __future__ import unicode_literals, absolute_import, division
from armet.connectors.flask import resources as flask_resources
from armet.connectors.sqlalchemy import resources as sqlalchemy_resources
from alchemist import db
__all__ = [
'Resource',
'ModelResource',
]
class Resource(flask_resources.Resou... | {
"content_hash": "4f449c5d99008b9bc3a663342c805868",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 73,
"avg_line_length": 25.106382978723403,
"alnum_prop": 0.6322033898305085,
"repo_name": "concordusapps/alchemist-armet",
"id": "fdcf7b4c83246cae774b42afcb8bc4c9bc596d62",
... |
"""
WSGI config for {{ project_name }} project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPL... | {
"content_hash": "c6ca508ec417a8ea949d4c7c8ae7d125",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 79,
"avg_line_length": 48.61904761904762,
"alnum_prop": 0.7894221351616063,
"repo_name": "asnelzin/django-template",
"id": "9476749503f5f3051adad92c75e4339108ce697e",
"size... |
from linear_solver.core import solve_linear_system
| {
"content_hash": "5fcfd306a080143f5cd4398d616c4966",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 51,
"alnum_prop": 0.8431372549019608,
"repo_name": "tcmoore3/linear_solver",
"id": "683f40564e7c16bd41d29d97280f2aa9a12cf161",
"size": "51",
"binary... |
print "deprecated since version 1.1.0 of mtools. Use 'mloginfo <logfile> --distinct' instead."
| {
"content_hash": "973d493f1bf57b2adbbcce560b7ddce5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 94,
"avg_line_length": 95,
"alnum_prop": 0.7473684210526316,
"repo_name": "corymintz/mtools",
"id": "9a59e67ca00c3efe41fc7c77112b0cf98258381e",
"size": "118",
"binary": fa... |
"""
Class representing a Cloudstack instance. This module uses the csapi
library which calls the cloudstack API. For more information refer to
the Cloudstack documentation at https://github.com/syed/PerfKitBenchmarker.git
"""
import logging
from perfkitbenchmarker import flags
from perfkitbenchmarker import linux_vir... | {
"content_hash": "cc4a96206809ac8180ca701919b057cc",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 79,
"avg_line_length": 31.14,
"alnum_prop": 0.6212267180475273,
"repo_name": "xiaolihope/PerfKitBenchmarker-1.7.0",
"id": "c5e5fa94fc259faa88d6ae8b6c5d6691b3421521",
"size... |
"""
CLI interface for nova bare-metal management.
"""
import os
import sys
from oslo.config import cfg
from nova import config
from nova.openstack.common import cliutils
from nova.openstack.common import log as logging
from nova import version
from nova.virt.baremetal.db import migration as bmdb_migration
CONF = ... | {
"content_hash": "49c68c025b703972f814f23fbd5e33cc",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 79,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.5986394557823129,
"repo_name": "DirectXMan12/nova-hacking",
"id": "e28289f8d1f011af30df4b13d654a6cc0f4daab0",
"s... |
from motorengine import Document, StringField, IntField, DateTimeField, \
ReferenceField
class BaseDocument(Document):
def to_dict(self):
data = super(Document, self).to_son()
data['id'] = self._id
return data
class School(BaseDocument):
name = StringField(required=True)
veri... | {
"content_hash": "bbeb58aa58d64c1c8a8b4852167bfcaa",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 97,
"avg_line_length": 29.13888888888889,
"alnum_prop": 0.6882745471877979,
"repo_name": "INAP-LABS/noc-orchestrator",
"id": "48c4cc2f840418dc110c4e82833f2fc5e1589b54",
"si... |
"""Defines executor tasks handlers for MapReduce implementation."""
# pylint: disable=protected-access
# pylint: disable=g-bad-name
import datetime
import logging
import math
import os
import random
import sys
import time
import traceback
from mapreduce.third_party import simplejson
from google.appengine.ext impor... | {
"content_hash": "a31e6943d6c4cc17a241f072cd94a08e",
"timestamp": "",
"source": "github",
"line_count": 1826,
"max_line_length": 80,
"avg_line_length": 37.224534501642935,
"alnum_prop": 0.6546372035544048,
"repo_name": "singhj/locality-sensitive-hashing",
"id": "53b720c6342fa50fcd5d8e493e8781a3437ff7... |
from datetime import datetime
import math
import time
from rules.conditions.results.componentConditionStatus import ComponentConditionStatus
from rules.ruleResultChecker import RuleResultChecker
from data import dataRetriever
from rules.conditions.conditionsBuilder import ConditionsBuilder
from rules.conditions.process... | {
"content_hash": "b51d84cf61912f4e753f59c99e253dfa",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 117,
"avg_line_length": 48.550561797752806,
"alnum_prop": 0.6438324461930108,
"repo_name": "enableiot/iotanalytics-rule-engine",
"id": "cb9fd117a016cdaf4e509ec4e6943626c7bc3c... |
"""
celery.contrib.batches
======================
Experimental task class that buffers messages and processes them as a list.
.. warning::
For this to work you have to set
:setting:`CELERYD_PREFETCH_MULTIPLIER` to zero, or some value where
the final multiplied value is higher than ``flush_every``.
I... | {
"content_hash": "3b2cb9fa05b683de1664559e5d279748",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 78,
"avg_line_length": 28.70967741935484,
"alnum_prop": 0.6043539325842696,
"repo_name": "johankaito/fufuka",
"id": "8cabc6f6168ca35754a05736a1be9223375ee7a8",
"size": "71... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: get_certificate
author: "John Westcott IV (@john-westcott-iv)... | {
"content_hash": "3eb361ef8a4e733c8f056792ab5ee756",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 147,
"avg_line_length": 34.70422535211268,
"alnum_prop": 0.6354707792207792,
"repo_name": "thaim/ansible",
"id": "99883366a42fe49c07eb45cba2c52209b96bfda0",
"size": "12453... |
"""
Base settings file, common to all environments.
These settings can be overridden in local.py.
"""
import datetime
import os
import json
import hashlib
import logging
from datetime import timedelta
from collections import OrderedDict
os_env = os.environ
def parent_dir(path):
'''Return the parent of a directo... | {
"content_hash": "cccceadd3dc5f1ce4015db31bc67d9bd",
"timestamp": "",
"source": "github",
"line_count": 1935,
"max_line_length": 161,
"avg_line_length": 26.422739018087857,
"alnum_prop": 0.6023509622907214,
"repo_name": "sloria/osf.io",
"id": "b77a6a59b642019793d88bed4ffa7ed29c53e516",
"size": "511... |
from lib import server
server.instance = server.TeaserServer()
server.instance.main()
| {
"content_hash": "1d42f199756f7fe09d51bd9c0a130d24",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 39,
"avg_line_length": 21.75,
"alnum_prop": 0.7931034482758621,
"repo_name": "Cibiv/Teaser",
"id": "a51156f29e10cd36c2cbd97a8db7a96e4f21f473",
"size": "109",
"binary": fal... |
from twisted.internet import reactor
from scaletix.factory import ScaleFactory
from tests.test_application import TestFactory
__author__ = 'nacim'
if __name__ == '__main__':
mp_factory = ScaleFactory(TestFactory(), core=2)
# launch the new multiprocessing factory
port = reactor.listenTCP(8118, mp_factory)... | {
"content_hash": "ae92513d778cf9f280a22a925be6a59f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 52,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.7227138643067846,
"repo_name": "Grindizer/scaletix",
"id": "b0fa782a1d4841fd924643fd70d2165f7e9e9164",
"size": "3... |
__author__ = "Christopher and Cody Reichert"
__copyright__ = "Copyright 2015, SimplyRETS Inc. <support@simplyrets.com>"
__credits__ = ["Christopher Reichert", "Cody Reichert"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Christopher Reichert"
__email__ = "christopher@simplyrets.com"
__status__ = "Productio... | {
"content_hash": "4686246cc16a1514f79485dadcca91ca",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 93,
"avg_line_length": 35.3968253968254,
"alnum_prop": 0.5668161434977579,
"repo_name": "SimplyRETS/simplyrets-python-sdk",
"id": "27646db2dff6c77f05bb12f4e2338b1b9e25a7ce",
... |
from __future__ import unicode_literals
from django.conf.urls import include, url
import spirit.topic.views
import spirit.admin.urls
import spirit.user.urls
import spirit.search.urls
import spirit.category.urls
import spirit.topic.urls
import spirit.comment.urls
patterns = [
url(r'^$', spirit.topic.views.index_... | {
"content_hash": "b4a2dd26e57a8da2dfd999a1f49a1c66",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 32,
"alnum_prop": 0.7071759259259259,
"repo_name": "battlecat/Spirit",
"id": "a47ea209c5a36ceaf4eaea335d62a1661b640e06",
"size": "889",
"binary": f... |
import rospy, tf, math
from lab3Helpers import *
from aStar import *
from std_msgs.msg import Header
from nav_msgs.msg import OccupancyGrid #format for reading the map. Data is stored by row.
from nav_msgs.msg import GridCells #format for publishing to rviz display
from geometry_msgs.msg import PoseWithCovarianceStampe... | {
"content_hash": "e80c51554808c45606972295f0e04fcb",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 127,
"avg_line_length": 35.925925925925924,
"alnum_prop": 0.7096907216494845,
"repo_name": "cwgeary/rbe3002-d14-teamZTC",
"id": "e7f1379c3967c40de638c984685ba3a62498afd9",
... |
import logging
from mhc_common import normalize_hla_allele_name
def read_hla_file(path, permissive_parsing=True):
"""
Read in HLA alleles and normalize them, returning a list of HLA allele
names.
"""
assert path.endswith(".hla"), \
"Expected HLA file %s to end with suffix .hla" % path
... | {
"content_hash": "f44dd29cdd5e9c29ef39a29519e55ac5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 36.70967741935484,
"alnum_prop": 0.5175746924428822,
"repo_name": "hammerlab/immuno",
"id": "a93a6e6232bc41f343b703019016e4ecf830f6c6",
"size": "1138... |
import pyphen
import sys
import re
hyphenator = pyphen.Pyphen(filename='patterns/hyph_la_classical.dic',left=2,right=2)
seenSegs = {}
line = 0
def comparenoncompletehyphens(original, obtained):
i = 0
for c in obtained:
if c == '-':
if original[i] == '-':
i = i + 1
else:
if original[i] == '-':
retu... | {
"content_hash": "58cfeff69d965f17c2345587ee3c6e98",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 154,
"avg_line_length": 27.20408163265306,
"alnum_prop": 0.641410352588147,
"repo_name": "gregorio-project/hyphen-la",
"id": "6e88e32229733800c9a475d226bff4ab8a8f8a7b",
"si... |
from oslo_config import cfg
from senlin.common.i18n import _
HEALTH_MANAGER_GROUP = cfg.OptGroup('health_manager')
HEALTH_MANAGER_OPTS = [
cfg.StrOpt('nova_control_exchange', default='nova',
help=_("Exchange name for nova notifications.")),
cfg.StrOpt('nova_notification_topic', default='version... | {
"content_hash": "d8a0ecac6f8c9b86595236caa863e81a",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 76,
"avg_line_length": 38.138888888888886,
"alnum_prop": 0.6300072833211945,
"repo_name": "stackforge/senlin",
"id": "3c671e0a236b861b23a459523fc724d9af64dc0f",
"size": "19... |
"""Mac-only module to find the home file of a resource."""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc import sstruct
import array
import calldll
import macfs, Res
def HomeResFile(res):
"""Return a path to the file in which resource 'res' li... | {
"content_hash": "44e5b76e0d32fd0594a727896d24fb33",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 85,
"avg_line_length": 23.729166666666668,
"alnum_prop": 0.6769095697980685,
"repo_name": "googlei18n/TachyFont",
"id": "a2d1c8c0c928f1406896d92e3f6e4126d4a97bd1",
"size": ... |
"""Debugger Wrapper Session Consisting of a Local Curses-based CLI."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import shutil
import sys
import tempfile
# Google-internal import(s).
from tensorflow.python.debug.cli import an... | {
"content_hash": "a20826fdf3854af718e6b8639b53802b",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 80,
"avg_line_length": 37.029038112522684,
"alnum_prop": 0.6418173797970886,
"repo_name": "MoamerEncsConcordiaCa/tensorflow",
"id": "1aab95152ad3262b34a53fca625d5f9981494e6d... |
import re
print "generating template instantiations"
with open("cloudproc.hpp","r") as infile:
with open("autogen_instantiations.cpp","w") as outfile:
while True:
line = infile.readline()
if not line: break
if line.startswith("template"):
funcline = infile... | {
"content_hash": "f6a2875ef8d1dd931dcce9233bcd7193",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 99,
"avg_line_length": 48.214285714285715,
"alnum_prop": 0.5222222222222223,
"repo_name": "DeadSocks/trajopt",
"id": "ff2fab5a29de6a2021b2899c4676d1c77828184b",
"size": "13... |
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import assert_raises_message, eq_
class _DateProcessorTest(fixtures.TestBase):
def test_date_no_string(self):
assert_raises_message(
ValueError,
"Couldn't parse date string '2012' - value is not a string",
... | {
"content_hash": "b172100dbdfd6b55c4a4d421e3a56b85",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 82,
"avg_line_length": 28.113095238095237,
"alnum_prop": 0.5005293245818336,
"repo_name": "michaelBenin/sqlalchemy",
"id": "b1c482f09deb1f663f30179b1290923963c932f8",
"siz... |
INCLUDE_FIELDS = '&include_fields=id,component,classification,' \
'creation_time,last_change_time,is_open,priority,' \
'severity,status,summary,assigned_to,creator,resolution,dupe_of'
def query_from_to(from_date, to_date, limit=0):
severity = ['blocker', 'critical', 'major', 'nor... | {
"content_hash": "912a610b4488daa3c29c9e4a1f3938a1",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 120,
"avg_line_length": 24.536363636363635,
"alnum_prop": 0.6050389032975176,
"repo_name": "marquesarthur/BugAnalysisRecommender",
"id": "3df09ee2b53fb0e3e587aaf1120442ac795... |
"""
Show how to set custom font properties.
For interactive users, you can also use kwargs to the text command,
which requires less typing. See examples/fonts_demo_kw.py
"""
from matplotlib.font_manager import FontProperties
from pylab import *
subplot(111, axisbg='w')
font0 = FontProperties()
alignment = {'horizon... | {
"content_hash": "2574053705506064b507be0e75191deb",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 76,
"avg_line_length": 24.06140350877193,
"alnum_prop": 0.6084578928180824,
"repo_name": "yavalvas/yav_com",
"id": "562fb7f171e01c415284c651db3534d41879bc17",
"size": "276... |
from ducktape.tests.test import Test
from ducktape.mark.resource import cluster
from ducktape.mark import parametrize, matrix
from kafkatest.tests.kafka_test import KafkaTest
from kafkatest.services.performance.streams_performance import StreamsSimpleBenchmarkService
from kafkatest.services.zookeeper import ZookeeperS... | {
"content_hash": "893b8a733db54be5a5c845eee6ca9939",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 245,
"avg_line_length": 47.59090909090909,
"alnum_prop": 0.5776026743075454,
"repo_name": "ErikKringen/kafka",
"id": "258b7c0a50aa1062f39cbfc570dbf9f28866f476",
"size": "49... |
from django.db import models
from cookiedjango.core.models import TimeStampedModel
class TwitterPost(TimeStampedModel):
tag = models.CharField(max_length=140)
text = models.TextField()
| {
"content_hash": "72068f82fd44eb75f066082f886e08e4",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 53,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.788659793814433,
"repo_name": "shanenater/shanecookie",
"id": "6ce4299cc1bef4fcb9d2c610733b29e1f5ae2c38",
"size": ... |
"""
Implementation of Simple Storage Service support.
:py:class:`S3Target` is a subclass of the Target class to support S3 file
system operations. The `boto` library is required to use S3 targets.
"""
from __future__ import division
import datetime
import itertools
import logging
import os
import os.path
import time... | {
"content_hash": "175e0dfef8c4e675fd517e240ee445d8",
"timestamp": "",
"source": "github",
"line_count": 778,
"max_line_length": 134,
"avg_line_length": 35.74421593830334,
"alnum_prop": 0.5881549138768025,
"repo_name": "jw0201/luigi",
"id": "d01995fb79c50b868d74578a08256f8449eaf68e",
"size": "28412"... |
import functools
import imath
import IECore
import Gaffer
import GafferUI
Gaffer.Metadata.registerNode(
Gaffer.EditScope,
"description",
"""
A container that interactive tools may make nodes in
as necessary.
""",
"icon", "editScopeNode.png",
"graphEditor:childrenViewable", True,
# Add + buttons for se... | {
"content_hash": "dbfaec8595232abd29b04bd8bcdadcef",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 155,
"avg_line_length": 28.900862068965516,
"alnum_prop": 0.6850111856823267,
"repo_name": "ImageEngine/gaffer",
"id": "e1bc4680cce49251a22c7b8531b5a059b2ac69d5",
"size": ... |
import sys
import subprocess
args = sys.argv[1:]
#print args
ret = subprocess.call(args)
i = len(args) - 1
deplocation = None
while (i >= 0):
if args[i] == '-MF':
deplocation = args[i+1]
break
i = i - 1
if deplocation is None:
exit(0)
objdir = '/'.join(deplocation.split('/')[:-2]) + '/.obj/'
depfile = open(depl... | {
"content_hash": "f5aa4b9bc7cc5b6eee7fdb5c1522186a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 57,
"avg_line_length": 20.928571428571427,
"alnum_prop": 0.6638225255972696,
"repo_name": "DimaKirk/distcc-gen-hosts",
"id": "0400756dea753db32cb10bbb6274eebfb15e77f0",
"si... |
"""Constraints definition for minimize."""
import numpy as np
from ._hessian_update_strategy import BFGS
from ._differentiable_functions import (
VectorFunction, LinearVectorFunction, IdentityVectorFunction)
from ._optimize import OptimizeWarning
from warnings import warn, catch_warnings, simplefilter
from numpy.te... | {
"content_hash": "6d05354c9f5e6b362fe4b67bf70b87d3",
"timestamp": "",
"source": "github",
"line_count": 569,
"max_line_length": 88,
"avg_line_length": 38.64674868189807,
"alnum_prop": 0.609549795361528,
"repo_name": "anntzer/scipy",
"id": "2bcd270ce1e4a1f182fb1126ad51934f1e226380",
"size": "21990",... |
from omics_pipe.parameters.default_parameters import default_parameters
from omics_pipe.utils import *
p = Bunch(default_parameters)
def annovar(sample, annovar_flag):
'''Annotates variants with ANNOVAR variant annotator. Follows VarCall.
input:
.vcf
output:
.vcf
citation:
Wa... | {
"content_hash": "b982b450712ada34738e86eda9f8c894",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 375,
"avg_line_length": 39.666666666666664,
"alnum_prop": 0.6442577030812325,
"repo_name": "adammaikai/OmicsPipe2.0",
"id": "dbe6d0605b5685f6aeba2dd6e8a79395ea7e225e",
"siz... |
import os
from mi.logging import config
from mi.dataset.driver.adcpt_acfgm.dcl.pd0.adcpt_acfgm_dcl_pd0_driver_common import AdcptAcfgmDclPd0Driver
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.core.versioning import version
__author__ = "Jeff Roy"
@version("15.7.0")
def parse(basePythonCodeP... | {
"content_hash": "855eeea00aab068df2234d2b76ba3450",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 106,
"avg_line_length": 30.23076923076923,
"alnum_prop": 0.7150127226463104,
"repo_name": "JeffRoy/mi-dataset",
"id": "9aaa684a594a9e32ca926c798b1c8f7d1ec8e886",
"size": "8... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from voprov.serializers.provn import VOProvNSerializer
from voprov.serializers.xml import VOProvXMLSerializer
from voprov.serializers.provjson import VOProvJSONSerializer
from prov import Error
__author__ = 'J... | {
"content_hash": "dc08b0cdc8de354c34e1ddd1c1863e6a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 30.436363636363637,
"alnum_prop": 0.6804062126642771,
"repo_name": "sanguillon/voprov",
"id": "dc04d4d3e48b7e5041f276e879a7ac611281a7a3",
"size": "16... |
import unittest
from nose.tools import *
from footy.test_data.test_data_paths import premier_league_2015_2016_path
from footy.src.clubs.club_gateway import ClubGateway
class ClubGatewayTest(unittest.TestCase):
def setUp(self):
self.gateway = ClubGateway(premier_league_2015_2016_path)
def test_get_al... | {
"content_hash": "614e27707439adee97d45d074a1cf9a8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 33.65,
"alnum_prop": 0.6983655274888558,
"repo_name": "bryce-klinker/hello-python",
"id": "3b3d82864cc0776c4af3325f627956c088809c05",
"size": "673",
... |
import posixpath
import xml.dom.minidom as xml
from xml.parsers.expat import ExpatError
from appengine_url_fetcher import AppEngineUrlFetcher
from docs_server_utils import StringIdentity
from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode
from future import Future
import svn_constants
import url... | {
"content_hash": "2eda9520b3918675baea7e79f54dd66f",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 80,
"avg_line_length": 37.4969696969697,
"alnum_prop": 0.6272830127687086,
"repo_name": "jing-bao/pa-chromium",
"id": "c0ff68c9a1fd7e6c1d64c992b04a2075c20dd7c3",
"size": "... |
from django.conf import settings as django_settings
SU_ADMIN_NAME = "Django Admin"
SU_ADMIN_MENU = [
]
class Settings(object):
"""Settings for internal use."""
def __getattr__(self, name):
if not hasattr(django_settings, name) and name not in globals():
raise ValueError('{} is not found... | {
"content_hash": "902f0220989418000372a01276b1e7ed",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 23.63157894736842,
"alnum_prop": 0.6458797327394209,
"repo_name": "gbdlin/django-admin-sidebar",
"id": "024af5987a25c715fd9986aa6a83a3e37c6b0a6b",
"s... |
import MySQLdb
import collections
c = MySQLdb.connect()
f = collections.deque.popleft
# TODO not sure if this should be an error or not
f(None) # e 0
c # 0 MySQLConnection
if 1:
c # 4 MySQLConnection
x = 1 # 0 int
def g():
global x
x = ''
x # 0 int
g()
x # 0 <int|str>
x = '' # 0 str
g()
x # 0 <int... | {
"content_hash": "a6fed78db594f9cff37bdae2a7c18a29",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 107,
"avg_line_length": 13.289473684210526,
"alnum_prop": 0.601980198019802,
"repo_name": "kmod/icbd",
"id": "732299f31ce2f70b4b1dbc995fcb6176873d9fc1",
"size": "505",
"b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.