text stringlengths 4 1.02M | meta dict |
|---|---|
import __init__
import os, sys, time
import numpy as np
from commons.utils import logger
from commons import utils
from commons import dataloader
import evaluator
# parameter config area
para = {'dataPath': '../../../data/',
'dataName': 'dataset#1',
'dataType': 'tp', # set the dataType as 'rt' or 'tp... | {
"content_hash": "d45563271f72ea882e647c0073fd53c4",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 104,
"avg_line_length": 37.644444444444446,
"alnum_prop": 0.6422668240850059,
"repo_name": "wsdream/WS-DREAM",
"id": "43c502c2979e211b59335bfdd25b8f9b8561d9d5",
"size": "19... |
print "You enter a dark room with two doors. Do you go through door #1 or door #2?"
door = raw_input("> ")
if door == "1":
print "There's a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear ==... | {
"content_hash": "f3ebe08cd653e2370821db2bb38f8b9d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 83,
"avg_line_length": 31.228571428571428,
"alnum_prop": 0.6010978956999085,
"repo_name": "cloudedge/LearningPython",
"id": "49f0ec71adeffd8e13afd6135635098ab55fb9d2",
"siz... |
"""
"""
from gluegov.lib.tables import CSVTable
CSVTable(
"communications",
"broadbandcoverage",
"http://d2a9983j4okwzn.cloudfront.net/downloads/ofcom-uk-broadband-speed-data-2013.csv",
"broadband_coverage_2013.csv"
).parse(keyRow=1)
CSVTable(
"communications",
"mopbilecoverage",
"http://... | {
"content_hash": "3c28628ebaac16db2d19640b36662a36",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 92,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.7483974358974359,
"repo_name": "JoeReid/GlueGov",
"id": "2aa8f7bb829824b9cbe55e100dac4f5bdb8b2a69",
"size": "624"... |
"""
Bake and deploy test to see if Spinnaker can interoperate with Microsoft Azure.
Sample Usage:
Assuming you have created $CITEST_ROOT points to the root directory of this repository
(which is . if you execute this from the root)
PYTHONPATH=$CITEST_ROOT:$CITEST_ROOT/spinnaker_testing \
python $CITEST_... | {
"content_hash": "c35bbd5388b4ad4af353757c650f89d3",
"timestamp": "",
"source": "github",
"line_count": 695,
"max_line_length": 133,
"avg_line_length": 37.90791366906475,
"alnum_prop": 0.5571244211645031,
"repo_name": "ewiseblatt/spinnaker",
"id": "6f2b62749bfcdc86125c72238fa3a5c38a013d68",
"size":... |
'''
Free as freedom will be 26/8/2016
@author: luisza
'''
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from django.http.response import HttpResponseRedirect, HttpResponseForbidden
from django.urls.base import reverse_lazy, reverse
from django.urls.exceptions imp... | {
"content_hash": "844b5e53c822ecd3eac9f7506f291711",
"timestamp": "",
"source": "github",
"line_count": 791,
"max_line_length": 90,
"avg_line_length": 34.97597977243995,
"alnum_prop": 0.5278681414009976,
"repo_name": "oscarmlage/django-cruds-adminlte",
"id": "022508880ef79b547ae1fb7e7c78e64fbf84a382"... |
import unittest
from apps.computeSPVariability2 import *
class PDBTestCase(unittest.TestCase):
def testOperate(self):
workingDirectory = "/home/jatienza/Desktop/cathAnalysis/eclipseProject/cathAnalysis/src/launchers/kk/"
alnFileName = workingDirectory+"1.10.10.180.mmult-FINAL.aln"
min... | {
"content_hash": "713d875f5df1bba0c8fb5e98ebfe8d1a",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 111,
"avg_line_length": 49.77777777777778,
"alnum_prop": 0.71875,
"repo_name": "julianah/cathAnalysis",
"id": "11e5acd1df9d68319a1cce1f7e30c752eaf31e38",
"size": "448",
"b... |
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_array_equal
from seaborn._core.groupby import GroupBy
from seaborn._stats.counting import Hist, Count
class TestCount:
@pytest.fixture
def df(self, rng):
n = 30
return pd.DataFrame(dict(
x=rng... | {
"content_hash": "6c96a8a99cd821a774bc6de90c26da90",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 80,
"avg_line_length": 31.149425287356323,
"alnum_prop": 0.5428044280442804,
"repo_name": "mwaskom/seaborn",
"id": "7656654492aa5ce56d47cbe9cf923376ed714643",
"size": "813... |
__author__ = 'Pabitra'
from django.test import TestCase
from hs_core import hydroshare
from hs_core.models import AbstractResource
class TestGetResourceTypesAPI(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_get_resource_types(self):
# this is the api call we ... | {
"content_hash": "ddfeb8ff2c76be6aed42c836477bbb77",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 26.82608695652174,
"alnum_prop": 0.6807131280388979,
"repo_name": "hydroshare/hydroshare_temp",
"id": "994b81a7a6d4d96a45245a6e1bbc7cd68810fea4",
"si... |
import argparse
from pipeline.backend.pipeline import PipeLine
from pipeline.component import DataTransform
from pipeline.component import HeteroFeatureBinning
from pipeline.component import Intersection
from pipeline.component import Reader
from pipeline.interface import Data
from pipeline.utils.tools import load_job... | {
"content_hash": "5e4450aadc33199d0151d2c12d4984fa",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 103,
"avg_line_length": 35.729729729729726,
"alnum_prop": 0.6656580937972768,
"repo_name": "FederatedAI/FATE",
"id": "061111e53b6da37a93ab2b26e9e11ade2553a058",
"size": "32... |
class DummyPostData(dict):
def getlist(self, key):
v = self[key]
if not isinstance(v, (list, tuple)):
v = [v]
return v
| {
"content_hash": "b66c3d3012f01716d8077f2b4728e85f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 44,
"avg_line_length": 26.5,
"alnum_prop": 0.5094339622641509,
"repo_name": "wtforms/wtforms",
"id": "c8d28a0f34803d1ddfe6beb2e3ade4a03396a855",
"size": "159",
"binary": f... |
"""
LlamaLab Automate notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.llamalab_automate/
"""
import logging
import requests
import voluptuous as vol
from homeassistant.components.notify import (BaseNotificationService,
... | {
"content_hash": "6f5f2e006eca1652b1526134f76e56a3",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 79,
"avg_line_length": 32.016666666666666,
"alnum_prop": 0.6631962519521083,
"repo_name": "Smart-Torvy/torvy-home-assistant",
"id": "7a00b5ba237e34b6e90b1c64d2c7469c7fadd05c"... |
import sqlite3
import json
from flask import Flask, request, session, g, redirect, \
url_for, abort, render_template, flash
from contextlib import closing
import bcrypt
import game
#cfg
DATABASE = 'db.db'
#
DEBUG = True
app = Flask(__name__)
app.config.from_object(__name__)
app.secret_key = b'\t\x00\x8dSAc\x1f... | {
"content_hash": "f610ffaa984612559211e6be83a274dc",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 112,
"avg_line_length": 34.239669421487605,
"alnum_prop": 0.5664977069756215,
"repo_name": "eli173/star",
"id": "7e62512775e3943b6acdd487870f84515b1f1f0e",
"size": "8368",... |
from flask_testing import TestCase
from fortunate.utils import make_app
class ViewsMixin(object):
fortunes = list('abcdefg')
def set_fortune(self, *args, **kwargs):
payload = kwargs
response = self.client.post('/fortune/', data=payload)
return response
def test_to... | {
"content_hash": "4642b6412d7bc144d5aae2ef087c9a7c",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 92,
"avg_line_length": 34.22429906542056,
"alnum_prop": 0.6234298197706172,
"repo_name": "kryptn/Fortunate",
"id": "0cc9d30c12789cf2891eb02ab72098ce41fdfe8a",
"size": "366... |
import sys
import csv
import django
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
django.setup()
from helios.models import Election
election_uuid = sys.argv[1]
email = sys.argv[2]
csv_output = csv.writer(sys.stdout)
voters = Election.objects.get(uuid=election_uuid).voter_set.filter(voter_e... | {
"content_hash": "6260e4004f9b3b065f7c3dcfc5772527",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 85,
"avg_line_length": 20.238095238095237,
"alnum_prop": 0.76,
"repo_name": "benadida/helios-server",
"id": "dc9ac956425b1145d5432b2d8db848737e5fff7a",
"size": "632",
"bi... |
"""Platform and system specific function."""
import getpass
import logging
import os
import pkgutil
import sys
log = logging.getLogger(__name__)
def is_tty():
"""
Checks if the standard output is connected (is associated with a terminal device) to a tty(-like)
device.
"""
if not hasattr(sys.stdou... | {
"content_hash": "80f33a581ce0286a925bf2b58b44ef38",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 101,
"avg_line_length": 30,
"alnum_prop": 0.6538461538461539,
"repo_name": "sekikn/incubator-airflow",
"id": "73eb609cdbcc2c6e2c4b7452d96dfb4702a42afb",
"size": "2736",
"... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/terminal/shared_terminal_character_builder.iff"
result.attribute_template_id = -1
result.stfName("terminal_name","terminal_character_builder")
#### BEGIN MODIFICATIONS ####
result.setStringAttribute("radia... | {
"content_hash": "e1310f65a6de66d172d150adb5f4e152",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 83,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.7301980198019802,
"repo_name": "anhstudios/swganh",
"id": "2448215c416a6ee08a1167c9f886761d50648eff",
"size": "54... |
""" Optimizations of the expression tree representation for better CSE
opportunities.
"""
from sympy import Add, Mul
from sympy.core.operations import AssocOp
from sympy.utilities.iterables import preorder_traversal
def assumed(e, name):
""" Return True if the given assumption is true about the sympy expression.
... | {
"content_hash": "1be4ad265d41e75bab0e4cbeec90366c",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 81,
"avg_line_length": 29.13157894736842,
"alnum_prop": 0.5564588979223125,
"repo_name": "minrk/sympy",
"id": "ec1d194b3fdb0aa1ce03b2dbe23d680d33122788",
"size": "2214",
... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('votes', '0003_auto_20170928_2238'),
]
operations = [
migrations.AlterField(
... | {
"content_hash": "c68dffd12dfc0d18bbdf823e58046d8a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 153,
"avg_line_length": 27.05,
"alnum_prop": 0.6543438077634011,
"repo_name": "Angoreher/xcero",
"id": "5e74d758cacb023846f6c31392298b735bc29d91",
"size": "614",
"binary"... |
from django.utils.functional import LazyObject
__version__ = '1.1.0.internal.1'
default_app_config = 'constance.apps.ConstanceConfig'
class LazyConfig(LazyObject):
def _setup(self):
from .base import Config
self._wrapped = Config()
config = LazyConfig()
| {
"content_hash": "445d722e41b7b98976b731a0b8768b16",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 21.46153846153846,
"alnum_prop": 0.6953405017921147,
"repo_name": "dmugtasimov/django-constance",
"id": "d563ea68adda77c4a989dbf702e2e5031298b07d",
"... |
import logging
from pants.backend.python.targets.import_wheels_mixin import ImportWheelsMixin
from pants.base.deprecated import deprecated_conditional
from pants.base.payload import Payload
from pants.base.payload_field import PrimitiveField
from pants.build_graph.target import Target
from pants.util.collections impor... | {
"content_hash": "55533a6b5b433502ef90dc3a7b1dd8a7",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 105,
"avg_line_length": 43.14705882352941,
"alnum_prop": 0.615087480118155,
"repo_name": "wisechengyi/pants",
"id": "45057e31d8840e2d2ed92d842246fb8cc5dd927d",
"size": "45... |
"""
Based on https://github.com/analytics-pros/universal-analytics-python
"""
| {
"content_hash": "1596d50d54a14621679b96c4b817601e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 69,
"avg_line_length": 26,
"alnum_prop": 0.7435897435897436,
"repo_name": "botstory/botstory",
"id": "425bb5467b595af8a4e67c2a0f8995f5cd10f77b",
"size": "78",
"binary": fa... |
from __future__ import absolute_import
from sentry import analytics
class BaseIncidentEvent(analytics.Event):
attributes = (
analytics.Attribute("incident_id"),
analytics.Attribute("organization_id"),
analytics.Attribute("incident_type"),
)
class IncidentCreatedEvent(BaseIncidentEve... | {
"content_hash": "1539a8f52cd4fcd5749210d1f19bc83d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 59,
"avg_line_length": 27.25,
"alnum_prop": 0.7339449541284404,
"repo_name": "mvaled/sentry",
"id": "c4f4f4bccda41fb8b1ca2ec94d901d5855e1e45d",
"size": "981",
"binary": f... |
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaebusiness.business import CommandExecutionException
from tekton import router
from gaecookie.decorator import no_csrf
from livro_app import facade
from routes.livros import admin
@no_csrf
def index(... | {
"content_hash": "92c89f60b6299efdc4aceab201be26c9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 104,
"avg_line_length": 34.25,
"alnum_prop": 0.7174139728884255,
"repo_name": "RoAbreu/AulaJavaScripts",
"id": "a2f7ba17a124883270c01ab2b96e5dec2e60ce30",
"size": "983",
... |
__all__ = [
'CombineTables',
'ReshapeTable',
'ExtractArray',
'SplitTableOnArray',
'AppendTableToCellData',
]
__displayname__ = 'Table Operations'
import numpy as np
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
import pyvista as pv
from .. import _helpers, interface
from ..ba... | {
"content_hash": "044d62b47cd82bf30da0a457cd55606a",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 88,
"avg_line_length": 35.153318077803206,
"alnum_prop": 0.5621663845853404,
"repo_name": "banesullivan/ParaViewGeophysics",
"id": "bc46373c47326daf165af4cbb3ff80245ab39e5b"... |
code_begin = """#!/usr/bin/python
from __future__ import print_function
import re
import pycurl
try:
from io import BytesIO
except ImportError:
from StringIO import StringIO as BytesIO
def main():
buffer = BytesIO()
curl_handler = pycurl.Curl()
curl_handler.setopt(curl_handler.URL, '{url}')
cur... | {
"content_hash": "1c053f1fc55e1163b03f4ca7a7f2ccb0",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 87,
"avg_line_length": 26.20618556701031,
"alnum_prop": 0.6369000786782061,
"repo_name": "dhruvagarwal/http-request-translator",
"id": "d6d2ac584f51491cc1ecd8cb9c45e6fd723772... |
"""SCons.Tool.gs
Tool-specific initialization for Ghostscript.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Permis... | {
"content_hash": "232fa7fc83a2c9e4877e13153db3d3d3",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 83,
"avg_line_length": 32.48,
"alnum_prop": 0.7253694581280788,
"repo_name": "frew/simpleproto",
"id": "24f985f3ebe775b0abd889345cd08fbfebd2b827",
"size": "2436",
"binary... |
from __future__ import unicode_literals
import logging
import socket
try:
import cmemcache as memcache
except ImportError:
try:
import memcache
except:
memcache = None
from django.conf import settings
from djblets.cache.forwarding_backend import DEFAULT_FORWARD_CACHE_ALIAS
def get_memca... | {
"content_hash": "dce2ea971b196b9c62dea95651543704",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 77,
"avg_line_length": 24.54255319148936,
"alnum_prop": 0.5721716514954487,
"repo_name": "bkochendorfer/reviewboard",
"id": "e9f0ae38b33f39c171f6a24270c276905d028cab",
"siz... |
from itertools import product
import random
class Mazegen(object):
"""
Base class to generates random mazes. The default implements is the Aldous-Broder algorithm.
The Aldous-Broder algorithm is to randomly choose direction (target) from your current position (source). if the target is hadn't been v... | {
"content_hash": "5ac1bf03c5348f0538da9d559753d172",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 181,
"avg_line_length": 33.72049689440994,
"alnum_prop": 0.5988211456990238,
"repo_name": "evostrov/python-maze-generator",
"id": "e158cf9c304dd74826660e1a4c58a085f0a2e9d4",... |
"""
System-level utilities and helper functions.
"""
import collections.abc
import math
import re
import unicodedata
import urllib
from oslo_utils._i18n import _
from oslo_utils import encodeutils
UNIT_PREFIX_EXPONENT = {
'k': 1,
'K': 1,
'Ki': 1,
'M': 2,
'Mi': 2,
'G': 3,
'Gi': 3,
'T'... | {
"content_hash": "0aa47c8dcf478c08e0f302159faf3cac",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 121,
"avg_line_length": 36.410122164048865,
"alnum_prop": 0.5812682739778555,
"repo_name": "openstack/oslo.utils",
"id": "2bd89ee976a1c47c4fcef711012ed1c3ea1ad0d1",
"size"... |
"""Support for the LiteJet lighting system."""
import logging
import pylitejet
from serial import SerialException
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_PORT
from homeassistant.core import HomeAssistant
from homeassistant.excep... | {
"content_hash": "512176f4e35edf101af102ea5aaa1484",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 95,
"avg_line_length": 31.453333333333333,
"alnum_prop": 0.658753709198813,
"repo_name": "mezz64/home-assistant",
"id": "5131ee52e672bc6fae44ddca89a6133615e38558",
"size": ... |
from collections import deque
import sys
import time
from eventlet.pools import Pool
from eventlet import timeout
from eventlet import hubs
from eventlet.hubs.timer import Timer
from eventlet.greenthread import GreenThread
class ConnectTimeout(Exception):
pass
class BaseConnectionPool(Pool):
def __init__(s... | {
"content_hash": "9c44c13fe49fab01e7acdaaaee28f344",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 105,
"avg_line_length": 40.29573934837093,
"alnum_prop": 0.5971513869884314,
"repo_name": "ioram7/keystone-federado-pgid2013",
"id": "d388c19de2cd9f3f4fa73a0bc3a0f2a76990d52... |
import os
import re
import time
import netaddr
import six
from six import moves
from rally.common.i18n import _
from rally.common import log as logging
from rally.common import utils
from rally.deployment.serverprovider import provider
from rally import exceptions
LOG = logging.getLogger(__name__)
INET_ADDR_RE = re... | {
"content_hash": "e0957d23abe82fb2f23814f538fb2d86",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 79,
"avg_line_length": 38.30681818181818,
"alnum_prop": 0.534559477899733,
"repo_name": "shdowofdeath/rally",
"id": "347972769908467a4afd4c17d3f1cfe001dd802f",
"size": "14... |
"""Testing utilities."""
import shutil
from six import iteritems
import tempfile
from django.conf import settings
from django.test.utils import override_settings
from django.utils.encoding import force_bytes
from django_downloadview.middlewares import is_download_response
from django_downloadview.response import (enc... | {
"content_hash": "7c4923bd69617255aeb61df315221ee4",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 78,
"avg_line_length": 34.87428571428571,
"alnum_prop": 0.6382107160412912,
"repo_name": "fladi/django-downloadview",
"id": "627adb5db8c09cc317c654581f707ac952237f79",
"si... |
import click
import os
from flask.cli import cli
@cli.command()
def clean():
"""Recursively remove *.pyc and *.pyo files."""
for dirpath, dirnames, filenames in os.walk('.'):
for filename in filenames:
if filename.endswith('.pyc') or filename.endswith('.pyo'):
filepath = o... | {
"content_hash": "17f95a702e079f56bdeb1dd207b5c2dc",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 70,
"avg_line_length": 29.2,
"alnum_prop": 0.6004566210045662,
"repo_name": "briancappello/flask-react-spa",
"id": "c0d4ed1a12b1f75505a876da77cf3d3a750e057b",
"size": "498"... |
import numpy as np
from robosuite.controllers.base_controller import Controller
from robosuite.utils.control_utils import *
# Supported impedance modes
IMPEDANCE_MODES = {"fixed", "variable", "variable_kp"}
class JointPositionController(Controller):
"""
Controller for controlling robot arm via impedance con... | {
"content_hash": "71f42e4983816f90f26b30de0f2d25a7",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 120,
"avg_line_length": 45.666666666666664,
"alnum_prop": 0.6440845498783455,
"repo_name": "ARISE-Initiative/robosuite",
"id": "054f1c717b9bbc6ade1a165aadcada4d586b4547",
... |
default_app_config = 'providers.edu.chapman.apps.AppConfig'
| {
"content_hash": "33a5d80be2af467b912e3f9a1d1e4caa",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 59,
"avg_line_length": 60,
"alnum_prop": 0.8,
"repo_name": "zamattiac/SHARE",
"id": "f3abca6ffae7694a429542fbc2e7be3db02580ad",
"size": "60",
"binary": false,
"copies": ... |
"""Form file for editing."""
from django import forms
from django.contrib.auth.models import User
class ProfileForm(forms.ModelForm):
"""Form for photo addition."""
class Meta:
"""."""
model = User
fields = []
| {
"content_hash": "f35c7fcdd26c85a55a96d8f4c03e88a2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 43,
"avg_line_length": 18.923076923076923,
"alnum_prop": 0.6097560975609756,
"repo_name": "cahudson94/django-imager",
"id": "835f651e5fac2bdb68b48ebff55f0e64cf87e092",
"siz... |
"""add registry_trust_id to bay
Revision ID: adc3b7679ae
Revises: 40f325033343
Create Date: 2015-12-07 15:49:07.622122
"""
# revision identifiers, used by Alembic.
revision = 'adc3b7679ae'
down_revision = '40f325033343'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('bay', sa.Colu... | {
"content_hash": "4339e52acdd01fc8dd476a356dffed2a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 56,
"avg_line_length": 21.105263157894736,
"alnum_prop": 0.7057356608478803,
"repo_name": "jay-lau/magnum",
"id": "c780d10f5e638052f99ea6962589f3329b31596e",
"size": "974",... |
import datetime
import re
import urlparse
import scrapy
from scrapy.exceptions import CloseSpider
from .base import BaseSpider
from ..items import Link, Loader
FG_URLS = [
'http://www.fangraphs.com/blogs/',
'http://www.fangraphs.com/community/',
'http://www.fangraphs.com/plus/',
]
DATE_RE = re.compile(... | {
"content_hash": "6893c1410c4bae39ea785a9a5896b2c5",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 119,
"avg_line_length": 34.91228070175438,
"alnum_prop": 0.5723618090452262,
"repo_name": "mattdennewitz/baseball-pagerank",
"id": "adbb445e63cb646bc89463aba336d244b53c932f"... |
from .adaptor import Camera
from .feed import Feed
from .light_sensor import LightSensor
from .ocr import OCR
__version__ = '0.0.4'
| {
"content_hash": "3f100adce866d8f830cb3c232837ae46",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 37,
"avg_line_length": 19.142857142857142,
"alnum_prop": 0.7388059701492538,
"repo_name": "zorg-framework/zorg-network-camera",
"id": "be7169a1a464c919f6578f16ffef8651e0339c24... |
import pandas as pd
import pytest
# noinspection PyUnresolvedReferences
from contrib.experimental.great_expectations_experimental.expectations.expect_queried_table_row_count_to_be import (
ExpectQueriedTableRowCountToBe,
)
from great_expectations.core.batch import BatchRequest, RuntimeBatchRequest
from great_expec... | {
"content_hash": "7c89f370a093f06fb98f0a70dd4b28f5",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 159,
"avg_line_length": 30.871657754010695,
"alnum_prop": 0.6563311969513251,
"repo_name": "great-expectations/great_expectations",
"id": "679c8b6ffbf12c8d7606a3604ca51611c8... |
""" Module for translating ONNX operators into Mxnet operatoes"""
# pylint: disable=unused-argument,protected-access
from . import translation_utils
from .... import symbol
# Method definitions for the callable objects mapped in the import_helper module
def identity(attrs, inputs, cls):
"""Returns the identity fu... | {
"content_hash": "c5be9ae111e7064165a519fb7de9e8f7",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 95,
"avg_line_length": 42.06870229007634,
"alnum_prop": 0.5763624266618279,
"repo_name": "jiajiechen/mxnet",
"id": "a67c18199eb811aaa6a460f13f27742473a98763",
"size": "173... |
from django import template
from jmboyourwords.models import YourStoryCompetition
from django.contrib.sites.models import Site
register = template.Library()
@register.simple_tag(takes_context=True)
def get_your_words_competitions(context, limit=5, var_name='your_words_list'):
stories = YourStoryCompetition.objec... | {
"content_hash": "2b9ecbb53a167da142442129b7ab1e89",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 84,
"avg_line_length": 38.92857142857143,
"alnum_prop": 0.6513761467889908,
"repo_name": "praekelt/jmbo-your-words",
"id": "9bcee805c29c3d09086429eb9dc7ca34d05d4324",
"size... |
"""
:author: Damian Eads, 2009
:license: modified BSD
"""
import numpy as np
from scipy import ndimage
def square(width, dtype=np.uint8):
"""
Generates a flat, square-shaped structuring element. Every pixel
along the perimeter has a chessboard distance no greater than radius
(radius=floor(width/2)) p... | {
"content_hash": "e4f63a06b979a0c05610d2dc66c83bcc",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 95,
"avg_line_length": 27.268370607028753,
"alnum_prop": 0.6032806092560047,
"repo_name": "SamHames/scikit-image",
"id": "5e0606c087767fd0cc7da0cf4e061bbb62d221f6",
"size"... |
from __future__ import annotations
import itertools
import os.path
import shutil
import pytest
from pre_commit import git
from pre_commit.staged_files_only import staged_files_only
from pre_commit.util import cmd_output
from testing.auto_namedtuple import auto_namedtuple
from testing.fixtures import git_dir
from tes... | {
"content_hash": "5b35a22b575f9f251cb072861ea45be3",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 78,
"avg_line_length": 31.096354166666668,
"alnum_prop": 0.6353739217820953,
"repo_name": "pre-commit/pre-commit",
"id": "a91f315198230d9da603573fedc3f9695e7fa0f8",
"size"... |
import logging
import os
import time
import zopkio.adhoc_deployer as adhoc_deployer
from zopkio.remote_host_helper import get_ssh_client, exec_with_env
import zopkio.runtime as runtime
logger = logging.getLogger(__name__)
class StreamProcessor:
"""
Represents a standalone StreamProcessor that uses zookeeper f... | {
"content_hash": "e8d011d9cedd1cf7451eb68d37822a10",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 297,
"avg_line_length": 42.51428571428571,
"alnum_prop": 0.6176075268817204,
"repo_name": "lhaiesp/samza",
"id": "f42590b30c28ee85fb1e39a97a3ba613a2cfba03",
"size": "5249"... |
"""Hello world Lambda function for mu testing.
"""
import json
import sys
def main(event, context):
from c7n.utils import parse_cidr
parse_cidr('10.0.0.0/24') # while we're here, ensure ipaddress availability
json.dump(event, sys.stdout)
def get_function(session_factory, name, role, events):
from c... | {
"content_hash": "c954f5aad3cfa64233b976311a6ea0d6",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 24.233333333333334,
"alnum_prop": 0.6478679504814305,
"repo_name": "alfredgamulo/cloud-custodian",
"id": "46af14eac5c0a2e7e26feda0885e9b9f25a3ae9a",
... |
r"""volume.py tests"""
from corelib.units.volume import m3
def test_volume():
r"""Test expected values"""
expected_value = 1.
atol = 1e-10
assert expected_value - atol <= m3(litre=1000.) <= expected_value + atol | {
"content_hash": "9bad34c30096c806a84eab8196d457ca",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 76,
"avg_line_length": 23,
"alnum_prop": 0.6478260869565218,
"repo_name": "fullmar/corelib",
"id": "b55ec2de8859b3ef593718547a8e9c926b1e86d9",
"size": "269",
"binary": fa... |
from functools import wraps
import flask
from zeeguu.model.user import User
# we define the blueprint here, and extended it in several files
account = flask.Blueprint("account", __name__)
@account.before_request
def setup():
if "user_id" in flask.session:
flask.g.user = User.query.get(flask.session["us... | {
"content_hash": "6c342570798c2162d160079e0b17c3a8",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 81,
"avg_line_length": 23.92452830188679,
"alnum_prop": 0.6356466876971609,
"repo_name": "MrAlexDeluxe/Zeeguu-Web",
"id": "fc1452fb2c541a9b91b86a09720efe93eddeaf35",
"size"... |
'''
Cockcoin base58 encoding and decoding.
Based on https://cockcointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return by... | {
"content_hash": "705d6644ed69ce5e1db39531d35e3b7c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 97,
"avg_line_length": 27.134615384615383,
"alnum_prop": 0.6080793763288448,
"repo_name": "cockcoin/cockcoin",
"id": "b121be88ce092375f1c4fd2223b2a2d70c8a53fe",
"size": "2... |
from hidparser import DeviceBuilder
from hidparser.Item import ItemType, Item, ValueItem
from hidparser.Device import Unit as _Unit
from hidparser.UsagePage import UsagePage
class UsagePageItem(ValueItem):
usage_page = None
def __init__(self, *args, **kwargs):
kwargs["signed"] = False
super(U... | {
"content_hash": "4a684658e5452de29799e6f2cdb4f1b1",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 83,
"avg_line_length": 22.510752688172044,
"alnum_prop": 0.6393599235729639,
"repo_name": "NZSmartie/PyHIDParser",
"id": "9b2901eb6d64fb7ee4636618c241ae38681dec98",
"size"... |
""" Test the Cookiecutter template.
A template project is created in a temporary directory, the application is
installed into a self-contained venv environment, and the application test
suite is run.
"""
from json import loads
from pathlib import Path
from shlex import split
from shutil import which
from subprocess ... | {
"content_hash": "a5297aed66943bad5422bb8cb6379544",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 35.31111111111111,
"alnum_prop": 0.657016991818754,
"repo_name": "mdklatt/cookiecutter-python-lib",
"id": "5b53d17962f36f5341074b595f312027b9a75671",
... |
import os
import sys
import pygame
import copy
import math
from common.constants import *
from client.constants import *
class RezSpark:
def __init__(self, inCharacter):
self.character = inCharacter
self.pos = [int(self.character.precisePos[0]),
int(self.character.precisePos[1... | {
"content_hash": "b87a464562105a3dce8b8cb03822f68f",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 73,
"avg_line_length": 26.69736842105263,
"alnum_prop": 0.5347461803844258,
"repo_name": "Wopple/fimbulvetr",
"id": "5427b5a3177546c3ccdb634f953325fbef8799ec",
"size": "202... |
import sys
def update_status(text):
print("""<script id="___autoremovable">
$("#status").html(""" + repr(text.replace('\n', '<br />')) + """);
$("#___autoremovable").remove();
</script>""")
# print("New status:", text, file=sys.stderr)
sys.stdout.flush()
| {
"content_hash": "252a07d935841812f4f4e4892e737b35",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 32.333333333333336,
"alnum_prop": 0.5223367697594502,
"repo_name": "Alexponomarev7/plotter",
"id": "3a0cf08c6fa74581822ce31a9dc71b74d456c7f8",
"size":... |
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from entertainment_tonight.models import Event
class EventCreate(CreateView):
# trying to create a new event
model = Event
fields = ['event_name', 'event_location', 'event_address', 'event_type', 'upload_photo', 'event_creator','cre... | {
"content_hash": "193c4d9eb6728a2d45e5861c97276cc8",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 135,
"avg_line_length": 38,
"alnum_prop": 0.7368421052631579,
"repo_name": "ashleyf1996/OOP_Web_Application_Assignment3",
"id": "b4d7d77be9890874a568894fdf06e3c1b9cc7182",
"... |
import numpy as np
import theano
import theano.tensor as T
import theano.tensor.nnet as nnet
from mlbase.layers import layer
from mlbase.util import floatX
__all__ = [
'UpConv2d',
]
class UpConv2d(layer.Layer):
"""
Theano explanation of the ops can be found at:
http://deeplearning.net/software/theano_... | {
"content_hash": "68d0100a2a65322036f4c0c414967760",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 112,
"avg_line_length": 36.65868263473054,
"alnum_prop": 0.5313622999019928,
"repo_name": "aissehust/sesame-paste-noodle",
"id": "fbc878cec7d282242a4cc9f09c2885167a122f85",
... |
"""
This program shows the basic usage of several features in the
sys and os modules. You may need to change the values of the
ds and di variables to get a meaningful result.
"""
import os, sys
ds = '/home/student/pydata/words.txt'
di = '/home/student/pydata'
# ds = 'c:/pydata/words.txt'
# di = 'c:/pydata'
... | {
"content_hash": "3d8f21b974126b92a57c246efd3f73fc",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 63,
"avg_line_length": 29.428571428571427,
"alnum_prop": 0.6877022653721683,
"repo_name": "jeremyprice/PythonForDevs",
"id": "2f3dc1e1d55fc0d2b5073c6365576f0ca723683c",
"si... |
import time
from datetime import datetime
from database.model import Session
from database.message_model import Message
from monitor.system.control import shutdown, restart
from monitor.system.update import preform_update
def check_for_messages():
session = Session()
current_time = datetime.no... | {
"content_hash": "9f7beea758d0bdc5428298c897bd6505",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 88,
"avg_line_length": 22.84285714285714,
"alnum_prop": 0.5878674171357098,
"repo_name": "nstoik/sensor_monitor",
"id": "e7bdb3b0c3881c7e018ec63e5d4067febc464cb4",
"size": ... |
import functools
# third-party imports
import click
import pytest
from click.testing import CliRunner
# local imports
from shpkpr.cli import options
@pytest.fixture
def runner():
@click.command()
@options.marathon_client
def _test(marathon_client, **kw):
pass
runner = CliRunner()
return... | {
"content_hash": "4339a37d35fdaa86f34552a01ebaec43",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 84,
"avg_line_length": 24.014705882352942,
"alnum_prop": 0.6466625842008573,
"repo_name": "shopkeep/shpkpr",
"id": "b2945372becffa25f820e564067d6a33500882a6",
"size": "1650... |
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import timeutils
import six
from heat.common.i18n import _
from heat.common.i18n import _LI
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import reso... | {
"content_hash": "9beeab9b90eb0b0e052894c2959640f5",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 77,
"avg_line_length": 31.963768115942027,
"alnum_prop": 0.5753797324869644,
"repo_name": "srznew/heat",
"id": "21f5a316d6cfe74568ae8adfe4350c1fd4b163b1",
"size": "4986",
... |
__author__ = 'himanshu'
import json
import requests
def _setup_request_data(filename):
file= open(filename, 'rb')
data = {}
lineno = 0
lines = file.readlines()
for l in lines:
lineno+=1
if l=="\n" or l=="":
break
parts = l.spl... | {
"content_hash": "2426da4c5354a955e16480d9bb6feeb7",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 25.84,
"alnum_prop": 0.521671826625387,
"repo_name": "himanshuo/spamassassin",
"id": "4cd1f65d5a95cbb330d437dff6ebc680db5b16ed",
"size": "1292",
"b... |
from src.base.solution import Solution
from src.tests.part1.q290_test_word_pattern import WordPatternTestCases
"""
https://leetcode.com/problems/word-pattern/#/description
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a ... | {
"content_hash": "91f36c50f11a76addc927d1d108cc6c4",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 119,
"avg_line_length": 26.753246753246753,
"alnum_prop": 0.5733009708737864,
"repo_name": "hychrisli/PyAlgorithms",
"id": "ebae037a464bdbae5299c83808e35e104ca02eee",
"size... |
from datetime import timedelta
import discord
from decimal import Decimal
from discord.ext import commands
from django.db import transaction
from django.utils import timezone
from orm.models import RaidMessage
class Rsvp(commands.Cog):
"""Reservation system"""
def __init__(self, bot):
self.bot = bo... | {
"content_hash": "03de45ee76c6ba3de5331daf1223dc0e",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 133,
"avg_line_length": 45.79497907949791,
"alnum_prop": 0.5988122430333486,
"repo_name": "peter-obrien/organizer",
"id": "995494d21ca2b98584e51696cb06bb5d78c24357",
"size... |
class Solution(object):
def detectCapitalUse(self, word):
"""
:type word: str
:rtype: bool
"""
if word == word.upper():
return True
elif word[1:] == word.lower()[1:]:
return True
else:
return False | {
"content_hash": "751a45fb3e97d06dcbea4e0f03846c90",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 42,
"avg_line_length": 24.583333333333332,
"alnum_prop": 0.4576271186440678,
"repo_name": "njfahey/LeetCode",
"id": "481b005b1ac0fc28c5a7c0db024253408170f9dd",
"size": "295... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reports', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='report',
name='processed',
field=mo... | {
"content_hash": "52745220994906ad7a88aa2a1acc7b87",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 20.61111111111111,
"alnum_prop": 0.5902964959568733,
"repo_name": "ben174/bart-crime",
"id": "3e736edd17dfc196a8c4fd31c53e4cffac377b77",
"size": "444... |
import httplib as http
import importlib
import pkgutil
import pytest
from pytz import utc
from datetime import datetime
import urllib
from nose.tools import * # noqa:
import re
from tests.base import ApiTestCase, DbTestCase
from osf_tests import factories
from tests.utils import make_drf_request_with_version
from ... | {
"content_hash": "edb45955ac542ac8c40155a71ff603db",
"timestamp": "",
"source": "github",
"line_count": 687,
"max_line_length": 134,
"avg_line_length": 38.36535662299855,
"alnum_prop": 0.5848541184505065,
"repo_name": "mattclark/osf.io",
"id": "7ff4d4d74ceb4ad44198731ff3bd7afc40b5ee2b",
"size": "26... |
'''
--------------------------------------------------------------
Before running this Airflow module...
Install StarThinker in cloud composer ( recommended ):
From Release: pip install starthinker
From Open Source: pip install git+https://github.com/google/starthinker
Or push local code to the cloud co... | {
"content_hash": "457e6590d43340306590c87c94768a14",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 145,
"avg_line_length": 31.231292517006803,
"alnum_prop": 0.49705946416902635,
"repo_name": "google/starthinker",
"id": "88b5a8bd498e51679ea7e1f36fd5112f44928731",
"size":... |
from string import Template
from code_generator import CodeGenerator
from collections import OrderedDict
from java_class import InternalJavaFileData
class WrapperGenerator(CodeGenerator):
""" Generator class thar generates wrapper layer code."""
def __init__(self, java_data, class_loader):
super(WrapperGenera... | {
"content_hash": "e7ad0e8584e0b560bea22df725170fca",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 82,
"avg_line_length": 33.92176870748299,
"alnum_prop": 0.6359169758347538,
"repo_name": "Bysmyyr/crosswalk",
"id": "5e406173e7ce064eb1cef50a86dd5aaa7bbb4c9f",
"size": "10... |
'''
Python and Ansible for Network Engineers
Week 4, Exercise 1
Use Paramiko to retrieve the entire 'show version' output.
'''
import paramiko
from getpass import getpass
import time
MAX_BUFFER = 65535
def disable_paging(ssh_conn):
ssh_conn.send('terminal length 0\n')
def send_command(ssh_conn, cmd):
ss... | {
"content_hash": "b8cc5bdbec21cd4b805113c720beaa9b",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 71,
"avg_line_length": 20.60377358490566,
"alnum_prop": 0.6401098901098901,
"repo_name": "ibyt32/pynet_test",
"id": "87e179ad59b7f2a311db0d596dc945a39a350a8f",
"size": "111... |
from __future__ import unicode_literals
from collections import namedtuple
import io
import os
import struct
import uuid
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
from .exceptions import (
InvalidCiphertextException,
... | {
"content_hash": "80c5df04d515d0c3db19f88e5fd525f8",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 114,
"avg_line_length": 33.18012422360248,
"alnum_prop": 0.685698240359416,
"repo_name": "william-richard/moto",
"id": "4eacba1a62e1dbfaaeb47bb24cb5c706f3a305eb",
"size": ... |
from .nbytes import nbytes
from .score import Scorer
from heapdict import heapdict
import time
def cost(nbytes, time):
return float(time) / nbytes / 1e9
def memo_key(args, kwargs):
result = (args, frozenset(kwargs.items()))
try:
hash(result)
except TypeError:
result = tuple(map(id, ar... | {
"content_hash": "c813f62f36dbe4c4a7737579b3bf3b6a",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 79,
"avg_line_length": 27.926966292134832,
"alnum_prop": 0.540132770066385,
"repo_name": "Winterflower/cachey",
"id": "b8ad6bdb4e9094a010e4e3066b86a13bb0d279e1",
"size": "... |
from django.test import TestCase
import datetime
from django.utils import timezone
from .models import Question
from django.core.urlresolvers import reverse
# Create your tests here.
class QuestionMethodTests(TestCase):
def test_was_published_recently_with_future_question(self):
time = timezone.now() + dat... | {
"content_hash": "2d0e80ded611710f6199d6f4cde72604",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 141,
"avg_line_length": 46.435483870967744,
"alnum_prop": 0.7061479680444599,
"repo_name": "LoopSun/PythonWay",
"id": "1c6ee4a7947ef225223b5f88701e1e1afb00d6d2",
"size": "2... |
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/endor/shared_endor_catwalk.iff"
result.attribute_template_id = -1
result.stfName("building_name","base_filler_building")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "6f08ba730d8d935722f4e4c77bd42a1a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 24,
"alnum_prop": 0.7019230769230769,
"repo_name": "anhstudios/swganh",
"id": "5e11cee4a913b1a82ca31153ba9d78aa6e79510a",
"size": "457",
"binary": ... |
from JumpScale import j
descr = """
create and start a routeros image
"""
organization = "jumpscale"
author = "deboeckj@codescalers.com"
license = "bsd"
version = "1.0"
category = "deploy.routeros"
period = 0 # always in sec
enable = True
async = True
queue = 'hypervisor'
def action(networkid, publicip, publicgwip,... | {
"content_hash": "6c6cfcdf4691d6e4130b62d0549b247d",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 120,
"avg_line_length": 37.05106382978723,
"alnum_prop": 0.6038819340760307,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "40d83a1dfb7a6b23a4a9ddb8b915e83930ba563d",
"s... |
import os
import sys
import subprocess
if __name__ == '__main__':
os.environ['PYTHONPATH'] = '.'
fab_location = subprocess.check_output('which fab'.split(' '))
fab_location = fab_location.strip()
fab_deploy_cmd = []
fab_deploy_cmd.append(fab_location)
fab_deploy_cmd.append('-f')
fab_deploy_... | {
"content_hash": "348a86d268e990eb08e843535025f90d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 32.9375,
"alnum_prop": 0.6432637571157496,
"repo_name": "rpq/django_deploys",
"id": "b83f6955f82d1c1d0dd829e9e78f47eaccc3cb3e",
"size": "576",
"bin... |
from .utils.module_loading import import_module
from .conversation import Statement
class ChatBot(object):
def __init__(self, name, **kwargs):
self.name = name
storage_adapter = kwargs.get("storage_adapter",
"chatterbot.adapters.storage.JsonDatabaseAdapter"
)
logic_a... | {
"content_hash": "3346b75de43089e5e383effc0e6393b1",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 83,
"avg_line_length": 31.672619047619047,
"alnum_prop": 0.6203721105055441,
"repo_name": "iAmMrinal0/ChatterBot",
"id": "36cfa41424ab6f26753de8d6e7e880228be1f6ec",
"size"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
from builtins import open
from textwrap import dedent
from pants.base.build_environment import get_buildroot
from pants.fs.archive import ZIP
from pants.java.distribution.distribution import DistributionLocator
fr... | {
"content_hash": "20c6f656bc4c23d939cc95bc67af0b39",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 102,
"avg_line_length": 43.32867132867133,
"alnum_prop": 0.6528405422853454,
"repo_name": "twitter/pants",
"id": "effcb2e1efd81f706c6f63abd2ea5374262ea298",
"size": "6343"... |
import _plotly_utils.basevalidators
class VisibleValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="visible", parent_name="surface", **kwargs):
super(VisibleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "db6bcec23b85de6787bdf92f4f6dabce",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 79,
"avg_line_length": 39.61538461538461,
"alnum_prop": 0.6058252427184466,
"repo_name": "plotly/python-api",
"id": "a4ef75a333189a0d1ba62e361ae3920ce0150aac",
"size": "515... |
from django.db import models
class Konkurencja(models.Model):
Nazwa = models.CharField(max_length=20,primary_key=True,unique=True,default='')
Kon = models.CharField(max_length=4,primary_key=False,unique=True,default='')
class Meta:
verbose_name_plural = 'Konkurencje'
ordering = ('Nazwa... | {
"content_hash": "40bf519138c20a7bf7eb1a64fdc9aefa",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 132,
"avg_line_length": 36.22222222222222,
"alnum_prop": 0.6343558282208589,
"repo_name": "superdyzio/PWR-Stuff",
"id": "63052b327985c018a1a1522593eab465a3aea926",
"size": ... |
from captcha.fields import ReCaptchaField
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.urls import reverse
from allauth.account.forms import (
ChangePasswordForm as AllauthChangePasswordForm,
Lo... | {
"content_hash": "533fe502c898581866846f7ee28879e5",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 88,
"avg_line_length": 30.216730038022813,
"alnum_prop": 0.6398640996602492,
"repo_name": "PersonalGenomesOrg/open-humans",
"id": "770e7652214b5f9dbcc1f829ddd40d5d697bd1c2",... |
""" routes.py - NumberToStringApi - A REST API for translating numbers to strings
"""
# Python stdlib
import ConfigParser
import json
import logging
import pprint as pp
import sys
# 3rd Party Modules
from flask import request
from flask import abort
from flask import make_response
# Codero Modules
import NumberToStr... | {
"content_hash": "310fca13cc68d564632c2f7d9642ee5c",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 124,
"avg_line_length": 33.951388888888886,
"alnum_prop": 0.5655553282879935,
"repo_name": "kedron/python-number-to-string",
"id": "970101abbabd271dc9caa9834d94602bea995f37"... |
"""
Tv Shows related regex.
"""
from dsl import *
from refo import Plus, Question
from quepy.dsl import HasKeyword
from quepy.parsing import Lemma, Lemmas, Pos, QuestionTemplate, Particle
nouns = Plus(Pos("NN") | Pos("NNS") | Pos("NNP") | Pos("NNPS"))
class TvShow(Particle):
regex = Plus(Question(Pos("DT")) + n... | {
"content_hash": "0af0eac01a54daa3b2779f6cf2f4db81",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 79,
"avg_line_length": 27.12727272727273,
"alnum_prop": 0.5650134048257373,
"repo_name": "emoron/quepy",
"id": "1f7f09652a323a32928cff461ee963830b6ad63b",
"size": "3001",
... |
import os
import platform
import sys
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Tuple, Union
from uuid import uuid4
from flask import current_app
from alerta.app import db
from alerta.database.base import Query
from alerta.utils.format import DateTime
from alerta... | {
"content_hash": "abc75c4f8a124a3bf3e147b080f56ecb",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 158,
"avg_line_length": 38.37988826815643,
"alnum_prop": 0.5953420669577875,
"repo_name": "guardian/alerta",
"id": "5e7908fa6fc043698d21a44e1d0b21d0baa572e7",
"size": "687... |
import binascii
import errno
import logging
import sys
import usb.core
import usb.util
from scapy.layers.bluetooth import *
from scapy.supersocket import SuperSocket
# See BT 4.2 Spec, Vol 4, Part B, "USB Transport Layer".
# Used for "Single Function Primary Controller" devices:
USB_DEVICE_CLASS_WIRELESS_CONTROLL... | {
"content_hash": "53dfc99ab344cf85dd54888de5a752fb",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 78,
"avg_line_length": 31.669767441860465,
"alnum_prop": 0.6222646497283008,
"repo_name": "pebble/pybluetooth",
"id": "9a5c21c27496e7aa42b56d0d2cd5bf63ddb4ff6f",
"size": "... |
"""This module contains static methods for validating different kinds of data.
"""
__copyright__ = 'Copyright (C) 2009, Purdue University'
__license__ = 'BSD'
__version__ = '#TRUNK#'
import sys
import cPickle
import datetime
import re
import IPy
import constants
import errors
import helpers_lib
from roster_core im... | {
"content_hash": "55befdb572952a7e1dc75511a1a7ec35",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 80,
"avg_line_length": 27.455072463768115,
"alnum_prop": 0.6245777027027027,
"repo_name": "stephenlienharrell/roster-dns-management",
"id": "2ab4b8bb54794201ea4760c4875b0087... |
import os
import shutil
import envoy
import tempfile
from django.conf import settings
from collections import defaultdict
from allmychanges.downloaders.utils import normalize_url
from allmychanges.utils import cd, do, log
def guess(source, discovered={}):
with log.name_and_fields('vcs.hg'):
result = defa... | {
"content_hash": "4ec13e3c9a27f829db121524ea261218",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 75,
"avg_line_length": 32.266666666666666,
"alnum_prop": 0.5428719008264463,
"repo_name": "AllMyChanges/allmychanges.com",
"id": "ca26c6fae4359c484e3a432f72c557b1c75592a0",
... |
from io import StringIO
from mako.pygen import adjust_whitespace
from mako.pygen import PythonPrinter
from mako.testing.assertions import eq_
class GeneratePythonTest:
def test_generate_normal(self):
stream = StringIO()
printer = PythonPrinter(stream)
printer.writeline("import lala")
... | {
"content_hash": "a0ab4661b59999646d6c944999af5ef0",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 65,
"avg_line_length": 20.534296028880867,
"alnum_prop": 0.47134317862165964,
"repo_name": "sqlalchemy/mako",
"id": "8adc14263b408b26d76a4abb8562060ead6202b0",
"size": "56... |
def check_imports(*names):
not_found = []
for name in names:
try:
__import__(name)
except ImportError:
not_found.append(name)
if len(not_found) > 0:
print(('\nauv-docker requires these packages: {}\n'
+ 'Install with "pip3 install {}"\n')
... | {
"content_hash": "3de4e7c7694c7f60310827c1e3bd7235",
"timestamp": "",
"source": "github",
"line_count": 583,
"max_line_length": 163,
"avg_line_length": 32.315608919382505,
"alnum_prop": 0.560828025477707,
"repo_name": "cuauv/software",
"id": "31aeac5b533c1f8e4a2af483ed65146daa5eb7d6",
"size": "1891... |
import account_wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| {
"content_hash": "8ae796b1174734a8240621a49f6339c4",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 65,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.8202247191011236,
"repo_name": "ntiufalara/openerp7",
"id": "a295fe1bd739f67c17519a2dc19b3b7896dd0c31",
"size": "1... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
ex... | {
"content_hash": "08186f77fda61940fda642807e788df6",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 105,
"avg_line_length": 54.84604715672677,
"alnum_prop": 0.698715355047542,
"repo_name": "Goamaral/SCC",
"id": "06da5b9b17166680d428d0b665b4c84a55fa3243",
"size": "39752",... |
"""Configure routing between VLANs."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... | {
"content_hash": "10ce57ff0635c3f3c26490582d5d7d6e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 91,
"avg_line_length": 33.676923076923075,
"alnum_prop": 0.620831429876656,
"repo_name": "trentindav/faucet",
"id": "6981d9dcac5c0929144e905ece15e77f9f3854ce",
"size": "218... |
import logging
import datetime
import decimal
from random import uniform
import discord
from discord.ext import commands
from .common import Cog, CoinConverter
from .utils import Table
from .coins import AccountType
log = logging.getLogger(__name__)
# steal constants
BASE_CHANCE = decimal.Decimal('1')
STEAL_CONSTAN... | {
"content_hash": "14841a2c5112c5248bc03b4d7ab61ac9",
"timestamp": "",
"source": "github",
"line_count": 750,
"max_line_length": 79,
"avg_line_length": 34.797333333333334,
"alnum_prop": 0.5302705188137022,
"repo_name": "lnmds/jose",
"id": "5b4e71fe6ad1e82b4d80297f7444a5c8c9194aba",
"size": "26102",
... |
import datetime
import email.utils as eut
import json
import os
import re
from functools import wraps
import msrest.polling
from azure_serializer import AzureSerializer
from c7n_azure import utils, constants
from c7n_azure.session import Session
from c7n_azure.utils import ThreadHelper
from mock import patch
from msre... | {
"content_hash": "92864e02c6efe79d8f14facc05b421fa",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 99,
"avg_line_length": 39.26603325415677,
"alnum_prop": 0.5705039017603291,
"repo_name": "ewbankkit/cloud-custodian",
"id": "7fb4f91b58ad105f3d988ef45bbb28a38e5c2c82",
"si... |
from .ortho_display_ascii import AsciiDisplay
from .ortho_display_image import ImageDisplay
| {
"content_hash": "84b2779606f01bfe2c761160d25a3715",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 45,
"avg_line_length": 46,
"alnum_prop": 0.8478260869565217,
"repo_name": "VaysseB/PySimpleMazeGenerator",
"id": "096a9666d9e7c46d7e9724603f6cf512eb784ed1",
"size": "117",
... |
"""
Example that trains an LSTM or GRU networks for sentiment analysis
Reference:
See J.Li et al, EMNLP2015 - http://arxiv.org/pdf/1503.00185v5.pdf
$ python examples/imdb_lstm.py -e 2 -eval 1 --rlayer_type lstm
"""
from neon.backends import gen_backend
from neon.data.dataloaders import load_imdb
from neon.data.... | {
"content_hash": "5d31ff2b28bb008e069d11bb5f4aec34",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 97,
"avg_line_length": 35.65625,
"alnum_prop": 0.6958808063102542,
"repo_name": "dongjoon-hyun/neon",
"id": "061ef37e6f4c5cd531048fff3b41b1c005a52da2",
"size": "4186",
"b... |
from micropython import const
import struct
import bluetooth
# Advertising payloads are repeated packets of the following form:
# 1 byte data length (N + 1)
# 1 byte type (see constants below)
# N bytes type-specific data
_ADV_TYPE_FLAGS = const(0x01)
_ADV_TYPE_NAME = const(0x09)
_ADV_TYPE_UUID16_COMPLETE = con... | {
"content_hash": "d63135be64392818cd752ccc969440f2",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 98,
"avg_line_length": 29.24175824175824,
"alnum_prop": 0.6260804208944006,
"repo_name": "iabdalkader/openmv",
"id": "e520af57cd58798efc7154c436692330cfa70779",
"size": "38... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "2b6214000759db98bebeff77315c3fc5",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 92,
"avg_line_length": 37.263888888888886,
"alnum_prop": 0.7711516958628402,
"repo_name": "alexryndin/ambari",
"id": "08c856963dff740be3a18560de3102c27e0239a2",
"size": "27... |
"""
Weather: A simple weather plugin.
"""
import sys
if sys.version_info <= (3, 6):
raise RuntimeError("This plugin requires Python 3.6 or above.")
import supybot
from supybot import world
# Use this for the version of this plugin.
__version__ = "15092021"
# XXX Replace this with an appropriate author or supybot... | {
"content_hash": "72c0d9440a0d8d66103bb5780b1b692c",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 78,
"avg_line_length": 27.431818181818183,
"alnum_prop": 0.7174813587406794,
"repo_name": "Alcheri/Plugins",
"id": "3a3bc405f28312e2a9b6532750729cc2a95bb18f",
"size": "2789... |
from pymongo import MongoClient
from patterny.bugzilla.comment import Comment
from patterny.bugzilla.bug import Bug
import abc
class MongoDB(object):
def __init__(self, config):
self.url = config.mongo_url
self.db = config.mongo_db
@property
def url(self):
return self._url
@u... | {
"content_hash": "1f1b694b0cdc6f4c12ef48e4b7b4348e",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 54,
"avg_line_length": 22.072289156626507,
"alnum_prop": 0.5960698689956332,
"repo_name": "marquesarthur/BugAnalysisRecommender",
"id": "3469e3a98fd735f5f81b5b5c8bb8641cbaa8d... |
'''
InfPcdObject
'''
import os
import re
from Logger import StringTable as ST
from Logger import ToolError
import Logger.Log as Logger
from Library import GlobalData
from Library import DataType as DT
from Library.Misc import Sdict
from Library.Misc import GetHelpStringByRemoveHashKey
from Library.ParserValidate imp... | {
"content_hash": "5706e6665e50b2e27ef7ef8189356a25",
"timestamp": "",
"source": "github",
"line_count": 626,
"max_line_length": 109,
"avg_line_length": 39.86741214057508,
"alnum_prop": 0.5299515166085668,
"repo_name": "egraba/vbox_openbsd",
"id": "f69e056ae33e4f5c04110ce0d7ed72f1463fce83",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.