text stringlengths 4 1.02M | meta dict |
|---|---|
"""Base GCP client which uses the discovery API."""
import json
import httplib2
from apiclient import discovery
from googleapiclient.errors import HttpError
from oauth2client.client import GoogleCredentials
from retrying import retry
from google.cloud import security as forseti_security
from google.cloud.security.co... | {
"content_hash": "78d497fee4cc75cf263cfaf105969562",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 78,
"avg_line_length": 38.71910112359551,
"alnum_prop": 0.5767072934803638,
"repo_name": "thenenadx/forseti-security",
"id": "d6d78926238a09c434e8a7c893f529ab6ce9ace9",
"s... |
import sys
import time
import os
import unittest
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
# text_ = os.path.expanduser(os.path.join(TEST_DATA_DIR, 'text'))
seeds_ = os.path.expanduser(os.path.join(TEST_DATA_DIR, 'seeds'))
labelled_d... | {
"content_hash": "15cf494757453a2be6fd1782512709d4",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 84,
"avg_line_length": 31.983870967741936,
"alnum_prop": 0.6613716591023702,
"repo_name": "usc-isi-i2/WEDC",
"id": "8b1e2ed336eba193ab273c7c74e8d803595018f0",
"size": "396... |
from sqlalchemy.dialects.firebird import base, kinterbasdb, fdb
base.dialect = fdb.dialect
from sqlalchemy.dialects.firebird.base import \
SMALLINT, BIGINT, FLOAT, FLOAT, DATE, TIME, \
TEXT, NUMERIC, FLOAT, TIMESTAMP, VARCHAR, CHAR, BLOB,\
dialect
__all__ = (
'SMALLINT', 'BIGINT', 'FLOAT', 'FLOAT', '... | {
"content_hash": "822f1b90c65733f84ed68f1381dc80f7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 71,
"avg_line_length": 30.214285714285715,
"alnum_prop": 0.6524822695035462,
"repo_name": "michaelBenin/sqlalchemy",
"id": "094ac3e832de27b1f02f8dda8255e1f2a1d2149e",
"size... |
from helper import TestHelper
import sublime
class TestJumpPrevIndent(TestHelper):
def command(self):
return 'jump_prev_indent'
def test_empty_lines(self):
lines = [
'Lorem ipsum dolor sit amet',
'',
'',
'Lorem ipsum dolor sit amet'
]
starting_selection = [29, 29]
endin... | {
"content_hash": "b0ed694f5be65c2341e63e29d2fb6fe9",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 92,
"avg_line_length": 25.910344827586208,
"alnum_prop": 0.6334841628959276,
"repo_name": "mwean/sublime_jump_along_indent",
"id": "095e1c5944afbbc635178cc8a202577ad2f3d1e6"... |
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from .compat import cookielib
from .cookies import cookiejar_from_dict
from .models import Request
from .hooks import dispatch_hook, default_hooks
from .u... | {
"content_hash": "5b5e47a032e8a066d186ab9d278460bb",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 122,
"avg_line_length": 31.72422680412371,
"alnum_prop": 0.585831505402551,
"repo_name": "chushao/Gradesource-Uploader---GUI",
"id": "982e96f129ea9e8fc807f1dbbb71025c4a07499... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External impo... | {
"content_hash": "effca779d2238c15f09bc080efe3de2b",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 94,
"avg_line_length": 32.2,
"alnum_prop": 0.36335403726708076,
"repo_name": "timsnyder/bokeh",
"id": "9c268637e3288b609a880b4dc33fbecaf08bbdef",
"size": "2436",
"binary"... |
from __future__ import unicode_literals
from wtforms.fields.core import SelectField
from wtforms.fields.simple import TextAreaField
from wtforms.validators import DataRequired, ValidationError
from indico.modules.events.payment import payment_settings
from indico.util.i18n import _
from indico.web.forms.base import I... | {
"content_hash": "06add97c857bea4bfa0989f2258e9b9a",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 120,
"avg_line_length": 53.19565217391305,
"alnum_prop": 0.5986922762566408,
"repo_name": "mvidalgarcia/indico",
"id": "09a4d79b4fdc78497a014d5bb617ee13ab89b06a",
"size": "... |
"""
Implements operations on volumes residing on VMware datastores.
"""
import urllib
from oslo.utils import units
from cinder.i18n import _, _LE, _LI
from cinder.openstack.common import log as logging
from cinder.volume.drivers.vmware import error_util
from cinder.volume.drivers.vmware import vim_util
LOG = loggin... | {
"content_hash": "cc1d33f54fb30483416d0587f1ef154e",
"timestamp": "",
"source": "github",
"line_count": 1376,
"max_line_length": 79,
"avg_line_length": 44.13953488372093,
"alnum_prop": 0.5691846680716544,
"repo_name": "hguemar/cinder",
"id": "58b81285e6e428cfda16c22a46eaf1c1fdde92fc",
"size": "6136... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("users", "0007_superadmin")]
operations = [
migrations.AddField(
model_name="user",
name="gender",
field=models.CharField(blank=True, max_length=255),
)
]
| {
"content_hash": "aeaf27c65c9e7a576752a471e99574da",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 63,
"avg_line_length": 22.857142857142858,
"alnum_prop": 0.59375,
"repo_name": "FinnStutzenstein/OpenSlides",
"id": "028c666ac6d7e03e63eaf82e9aeac9e605061576",
"size": "369... |
"""Test sensor of Nettigo Air Monitor integration."""
from datetime import timedelta
from unittest.mock import AsyncMock, Mock, patch
from nettigo_air_monitor import ApiError
from homeassistant.components.nam.const import DOMAIN
from homeassistant.components.sensor import (
ATTR_STATE_CLASS,
DOMAIN as SENSOR_... | {
"content_hash": "72d69c7587a7c92c0941f541710dfd6f",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 93,
"avg_line_length": 39.46837944664031,
"alnum_prop": 0.711882229232387,
"repo_name": "w1ll1am23/home-assistant",
"id": "bee4c515cd0b3ccf5e95973de2369fee11836c34",
"size... |
import itertools
import logging
import unittest
import urllib
import environment
import keyspace_util
import utils
from vtdb import dbexceptions
from vtdb import vtgate_cursor
from vtdb import vtgate_client
shard_0_master = None
shard_1_master = None
lookup_master = None
keyspace_env = None
create_vt_user = '''cr... | {
"content_hash": "a48162225367a70d02cb5e4031ec596c",
"timestamp": "",
"source": "github",
"line_count": 1235,
"max_line_length": 96,
"avg_line_length": 33.31336032388664,
"alnum_prop": 0.5543240484176754,
"repo_name": "theskyinflames/bpulse-go-client",
"id": "0a92e10efcdece6cd590b54f4cf0acc01c01b58e"... |
from __future__ import unicode_literals
from hipster_api.fields.base import Field
from hipster_api.fields.str import StringList as _StringList
class Integer(Field):
def to_python(self):
value = super(Integer, self).to_python()
try:
value = int(value)
except ValueError:
... | {
"content_hash": "0790cd2bae28a1ef7028cd308fed22f3",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 78,
"avg_line_length": 27.783333333333335,
"alnum_prop": 0.5560887822435513,
"repo_name": "RustoriaRu/hipster_api",
"id": "50be4538e103b750ca5abb1a40c863c4a12d2762",
"size... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from collections import defaultdict, namedtuple
from pants.util.dirutil import safe_mkdir
# Lists of target addresses.
CacheStat = namedtuple('CacheStat',... | {
"content_hash": "16e0f782d1701011999034ad1eee7748",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 93,
"avg_line_length": 35.04,
"alnum_prop": 0.644406392694064,
"repo_name": "pgroudas/pants",
"id": "22066784a071fbb1addd0b4f62e806ec0b4b35ed",
"size": "1899",
"binary": ... |
from fabric.api import *
from fabric.contrib.files import exists
from fabtools import require
import fabtools
import time
MYSQL_PASSWORD = ""
WORDPRESS_USER_NAME = ""
FFT_WORDPRESS_USER_PASSWORD = ""
DB_PRODUCTION_HOST = ""
PRODUCTION_KEYNAME = ""
BLOG_NAME = ""
env.roledefs = {
'development': ['vagrant@127.0.0.1... | {
"content_hash": "d791c8589cf98ee62ccb4407af3212e2",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 136,
"avg_line_length": 37.33587786259542,
"alnum_prop": 0.6321815579636066,
"repo_name": "mik4el/wordpress_bootstrap_se_fabric",
"id": "021e3ae42a0c22d3057e2e4574db6b76bfcd... |
from pprint import isreadable, pformat
from re import search, sub
def search_text(rx, text):
'''
Safe search ``text`` with regex.
:param rx: regex to match on ``text``
:param text: content to work on
:return: either ``None`` if ``rx`` is not in ``text`` or
**match-object** of **re**.
... | {
"content_hash": "5ed23d2b271b45df6bac0f8e9c5e5f5f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 68,
"avg_line_length": 26.125,
"alnum_prop": 0.600956937799043,
"repo_name": "spookey/ffflash",
"id": "c1800f39c776061a7bd08a53c54df566cd06763a",
"size": "1045",
"binary"... |
"""Solvers for Ridge and LogisticRegression using SAG algorithm"""
# Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from ._base import make_dataset
from ._sag_fast import sag32, sag64
from ..exceptions import ConvergenceWarning
from ..utils import... | {
"content_hash": "cc1bcd2b303ed5bbaade0431b934adc3",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 79,
"avg_line_length": 37.16811594202898,
"alnum_prop": 0.6031349918115886,
"repo_name": "bnaul/scikit-learn",
"id": "caa9b2d13300320cd71c6e29e38bd568a02f1b25",
"size": "1... |
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 All Rights Reserved
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/... | {
"content_hash": "f6e87c4f47081e5ee686860ed21fc162",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 79,
"avg_line_length": 31.568292682926828,
"alnum_prop": 0.6549486208761492,
"repo_name": "os-cloud-storage/openstack-workload-disaster-recovery",
"id": "cc18eb5233412d5bfdc... |
import argparse, sys, datetime
from menagerie.formatting import tsv
from menagerie.decorators import memoized
from mwutil import api
from mwutil.lib import title
from . import database
HEADERS = [
'wiki_db',
'user_id',
'return_namespace',
'return_title'
]
def read_user_returns(f):
if not f.isatty():
return ts... | {
"content_hash": "0a8329cb4fd040ba2b5646e2db10027d",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 80,
"avg_line_length": 21.424242424242426,
"alnum_prop": 0.7093352192362093,
"repo_name": "halfak/Measuring-the-impact-of-GettingStarted",
"id": "a4c74ae8e9e26b800134b3eb226e... |
import pytest
from aoc2019.day22 import shuffle
SAMPLE_INSTRUCTIONS = [
"""deal with increment 7
deal into new stack
deal into new stack""",
"""cut 6
deal with increment 7
deal into new stack""",
"""deal with increment 7
deal with increment 9
cut -2""",
"""deal into new stack
... | {
"content_hash": "bd42e26ecfcdf2c2eee0a28315b73620",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 92,
"avg_line_length": 21.953488372093023,
"alnum_prop": 0.6207627118644068,
"repo_name": "bertptrs/adventofcode",
"id": "78866a72d69e28f624a41c4e3ce468f73dfa1877",
"size":... |
"""
Merge two BST.
Tree1: 2 -> 1,3
Tree2: 7 -> 6,8
Approach:
1. Traverse in-order both the tree.
2. Merge the in-order Traverse
3. Ceate the BST from the merge tree
"""
from collections import deque
class Node(object):
def __init__(self,val,left = None, right = None):
self.val = val
self.left = le... | {
"content_hash": "f9fb43254254d9c4d4285fcb1c3a9d51",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 53,
"avg_line_length": 23.395833333333332,
"alnum_prop": 0.568566340160285,
"repo_name": "bkpathak/HackerRank-Problems",
"id": "1a19b0c44c7a185a187354361de4155e7057a991",
"... |
"""
Master configuration file for Evennia.
NOTE: NO MODIFICATIONS SHOULD BE MADE TO THIS FILE!
All settings changes should be done by copy-pasting the variable and
its value to <gamedir>/conf/settings.py.
Hint: Don't copy&paste over more from this file than you actually want
to change. Anything you don't copy&paste... | {
"content_hash": "6dc5b0dd542636a2bbf47f5dc8903fc7",
"timestamp": "",
"source": "github",
"line_count": 681,
"max_line_length": 100,
"avg_line_length": 48.37444933920705,
"alnum_prop": 0.6892207752785113,
"repo_name": "shollen/evennia",
"id": "646cb8b641beb3e19d8c00fc32fb6129c4940bb0",
"size": "329... |
import astropy.units as u
import numpy as np
import pytest
# Custom
from ....integrate import DOPRI853Integrator
from ....potential import (Hamiltonian, HernquistPotential, MilkyWayPotential,
ConstantRotatingFrame)
from ....units import galactic
from ...core import PhaseSpacePosition
# Proj... | {
"content_hash": "4a8a9866cbc10bd75f36403d1f7fdb5f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 78,
"avg_line_length": 35.84615384615385,
"alnum_prop": 0.6232372777437155,
"repo_name": "adrn/gary",
"id": "60a7c5e510f35d6f2f6be1fe73c5090e72c349b2",
"size": "3276",
"b... |
from django.forms import ModelForm
from django import forms
from modulos.ventas.models import Ventas
class FormVentas(ModelForm):
class Meta:
model = Ventas
| {
"content_hash": "2c5d26c6388a6f6146c5247b2bb42515",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 40,
"avg_line_length": 19.11111111111111,
"alnum_prop": 0.7558139534883721,
"repo_name": "urkh/erp",
"id": "f3d38760fdcdfe543bbf1f76393810c75e6662c9",
"size": "172",
"bina... |
"""API test module."""
#
# (C) Pywikibot team, 2007-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
import datetime
import types
import pywikibot.data.api as api
import pywikibot.family
import pywikibot.login
import pywikibot.pa... | {
"content_hash": "0fab8cf04ec70bb3cf3c02fe6b2a34d9",
"timestamp": "",
"source": "github",
"line_count": 1030,
"max_line_length": 94,
"avg_line_length": 37.74951456310679,
"alnum_prop": 0.5853608353479759,
"repo_name": "darthbhyrava/pywikibot-local",
"id": "1b0ee7d83efac31a56add85526bf41c9a384358b",
... |
from django.conf import settings
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return '{name}'.format(id=self.id, name... | {
"content_hash": "af9e36d3a44ab685536df3b39eedcf06",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 95,
"avg_line_length": 28.695121951219512,
"alnum_prop": 0.6566085847853803,
"repo_name": "WeitBelou/technotrack-web1-spring-2017",
"id": "a3ebd04875d900beee8ff30730390c3f77a... |
import unittest
import copy
from IPython.display import Markdown, display
import numpy as np
from frozenlake import FrozenLakeEnv
def printmd(string):
display(Markdown(string))
def policy_evaluation_soln(env, policy, gamma=1, theta=1e-8):
V = np.zeros(env.nS)
while True:
delta = 0
for s in... | {
"content_hash": "ce33a46eaaf9135a2457d858713b059f",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 83,
"avg_line_length": 35.84375,
"alnum_prop": 0.6140656785818076,
"repo_name": "hetaodie/hetaodie.github.io",
"id": "9d3146b0cc3d2cd292f9b092b563aef9d4f6f755",
"size": "34... |
from taskplus.core.shared.action import Action
from taskplus.core.shared.response import ResponseSuccess
from taskplus.core.shared.request import Request
class AssignUserToTaskAction(Action):
def __init__(self, tasks_repo, users_repo):
super().__init__()
self.tasks_repo = tasks_repo
self.... | {
"content_hash": "bc4dc42c4601adba4556332c0fd356c4",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 32.08,
"alnum_prop": 0.594139650872818,
"repo_name": "Himon-SYNCRAFT/taskplus",
"id": "c8663fd656f19018e75d07b5afa5500054dfec4a",
"size": "1604",
"... |
from ....testing import assert_equal
from ..tracks import StreamlineTractography
def test_StreamlineTractography_inputs():
input_map = dict(gfa_thresh=dict(mandatory=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_file=dict(mandatory=True,
),
in_... | {
"content_hash": "2894f91b70c382ffa2a1159d29404958",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 78,
"avg_line_length": 26.32075471698113,
"alnum_prop": 0.646594982078853,
"repo_name": "FCP-INDI/nipype",
"id": "b4c4dae67933410cc1da056ce3ca6b3b12308a24",
"size": "1449",... |
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.oauthlib.provider import OAuth2Provider
from flask.ext.login import LoginManager
db = SQLAlchemy()
oauth = OAuth2Provider()
login_manager = LoginManager()
| {
"content_hash": "6d3d11e4e5c4c068d3f003bb6b2b5774",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 54,
"avg_line_length": 27,
"alnum_prop": 0.8148148148148148,
"repo_name": "taras1k/flask_auth_service",
"id": "b32b322b0781912eac9028623eaa6593a1140d70",
"size": "216",
"b... |
class Agent:
def __init__(self):
self.initQ()
def initQ(self):
self.nbQ = {}
self.q = {}
self.alpha = {}
def QValue(self,grid,action):
if (grid,action) in self.q:
return self.q[(grid,action)]
else:
return 0.0
def countQ(self,grid... | {
"content_hash": "220e658964b9eba4185066f28142f397",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 74,
"avg_line_length": 28.510204081632654,
"alnum_prop": 0.5433070866141733,
"repo_name": "RaphaelLapierre/INF4215",
"id": "7f616f104ab93453d0104300453a092d4b8a3ab2",
"size... |
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime, time
import logging
import en... | {
"content_hash": "b642ccaa3527194c5df3ba00747ea800",
"timestamp": "",
"source": "github",
"line_count": 829,
"max_line_length": 110,
"avg_line_length": 39.49698431845597,
"alnum_prop": 0.6138716672265828,
"repo_name": "AjayRad/project4_conf_central",
"id": "71d8b113821d792ef0d2c231af93828f785f8213",
... |
import hmac
from datetime import datetime
from time import mktime
from handler import *
from model import *
def genInvite():
code = '%i.%i' % (session.user.id, mktime(datetime.now().timetuple()))
return code + hmac.new(Config.getString('secret_key'), code).hexdigest()[:8]
@handler('invite/index')
def get_index():
... | {
"content_hash": "c70df189155de21c8231cc5c8b4e06db",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 125,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.7161716171617162,
"repo_name": "daeken/QuestCompanions",
"id": "911531ab8afbb782f0df3e56b8b311e8e4c24d1e",
"size... |
from Bio import SeqIO
import sys
START = int(sys.argv[2])
END = int(sys.argv[3])
for rec in SeqIO.parse(open(sys.argv[1]), "fasta"):
SeqIO.write([rec[START:END]], sys.stdout, "fasta")
| {
"content_hash": "274832cf93e3c66609a69ee99327d8f8",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 20.88888888888889,
"alnum_prop": 0.675531914893617,
"repo_name": "zibraproject/zika-pipeline",
"id": "5a966388af836db384e58630c3a899bb37c10fff",
"size... |
from __future__ import division
import numpy as np
np.set_printoptions(precision=3, suppress=True)
from vehicle_core.model import vehicle_model as vm
from vehicle_core.model import dynamic_model as dm
from vehicle_core.util import conversions as cnv
# controller modes
MODE_POSITION = 0
MODE_VELOCITY = 1
MODE_STATION... | {
"content_hash": "89e4d787be3d339825f8f836eec39d6c",
"timestamp": "",
"source": "github",
"line_count": 763,
"max_line_length": 151,
"avg_line_length": 36.17955439056357,
"alnum_prop": 0.5599710197428002,
"repo_name": "decabyte/vehicle_core",
"id": "bc390ff1aa67e7c435678f700b9ac0d79dc2647d",
"size"... |
from __future__ import absolute_import
import bson
import mock
from st2common.constants.triggers import TIMER_TRIGGER_TYPES
from st2common.models.db.trigger import TriggerDB
from st2common.models.system.common import ResourceReference
from st2common.persistence.trigger import TriggerType
from st2common.persistence.tri... | {
"content_hash": "2101a68ee030f37e273fc4004c894d38",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 87,
"avg_line_length": 37.07058823529412,
"alnum_prop": 0.6521739130434783,
"repo_name": "Plexxi/st2",
"id": "f4311d18d838bcddae24a01d9e2dde6d8f88cdc2",
"size": "3779",
"... |
'''
Funcion on this file isn't sync. It receive data from configNode and send to structureDevice
It's DONE
****Waste-time = 10 hour ************************
Because : wrong perceptions about Node. It should save inNode on every Device or Sensor
Take advantage of : Learn deep about Dict,list in Python
... | {
"content_hash": "1452a4bd162c4b7503950fe102410d6d",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 157,
"avg_line_length": 48.38823529411765,
"alnum_prop": 0.6892778993435449,
"repo_name": "lnanhkhoa/thesis-iot-khoa",
"id": "b221372bb7c6da0ca3fec1299e8375b7e4319041",
"si... |
import subprocess
import os
from ..core import InstallFailed
from .pip import PIP_INSTALLER
from ..installers import PackageManagerInstaller
from .source import SOURCE_INSTALLER
from ..shell_utils import read_stdout
SLACKWARE_OS_NAME = 'slackware'
SBOTOOLS_INSTALLER = 'sbotools'
SLACKPKG_INSTALLER = 'slackpkg'
def ... | {
"content_hash": "97750007523c0ec4016150e5263ae95c",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 120,
"avg_line_length": 32.07954545454545,
"alnum_prop": 0.7059865391427559,
"repo_name": "ros-infrastructure/rosdep",
"id": "d6a199e26c002ae1e70f9320cf083797dc5ea176",
"si... |
from datetime import datetime
import pytest
from dateutil import tz as dateutil_tz
from arrow import arrow, factory, formatter, locales, parser
@pytest.fixture(scope="class")
def time_utcnow(request):
request.cls.arrow = arrow.Arrow.utcnow()
@pytest.fixture(scope="class")
def time_2013_01_01(request):
req... | {
"content_hash": "d18653f1551c9dfa240bda28e5e0325b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 114,
"avg_line_length": 27.026666666666667,
"alnum_prop": 0.7192895905278737,
"repo_name": "crsmithdev/arrow",
"id": "5d5b9980e78cd4aa5ec0733a312914e99844a52e",
"size": "20... |
import os
import sys
from datetime import datetime
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.ab... | {
"content_hash": "e0fbee5eceeddfe3c240d118a13d947b",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 79,
"avg_line_length": 32.06390977443609,
"alnum_prop": 0.7038339781920506,
"repo_name": "rm-hull/max7219",
"id": "48afa3ad8f244f1021b609d1e9d48e013ace7eb1",
"size": "8957... |
import json
import logging
import create_client
def main():
"""Transfer from standard Cloud Storage to Cloud Storage Nearline."""
logging.getLogger().setLevel(logging.DEBUG)
transfer_service_client = create_client.create_transfer_client()
# Edit this template with desired parameters.
# Specify t... | {
"content_hash": "bd2f3df3adf3efa564f4374e9adb3afc",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 75,
"avg_line_length": 28.21153846153846,
"alnum_prop": 0.5173824130879345,
"repo_name": "kocicjelena/python-docs-samples",
"id": "d31bc19072004c1b2cad84b419e9e045bdd7ada1",
... |
import atexit
import random
import shutil
import subprocess
import tempfile
import time
import pymongo
import pytest
class MongoTemporaryInstance(object):
"""Singleton to manage a temporary MongoDB instance
Use this for testing purpose only. The instance is automatically destroyed
at the end of the prog... | {
"content_hash": "276423a5a1554ebdd3d6fe012558884a",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 82,
"avg_line_length": 29.654761904761905,
"alnum_prop": 0.513849859494179,
"repo_name": "its-dirg/pyop",
"id": "15f46b88bae3a816b14b0c13bbd4c1c806517132",
"size": "2491",
... |
from watcher.notifications import base as notificationbase
from watcher.objects import base
from watcher.objects import fields as wfields
@base.WatcherObjectRegistry.register_notification
class StrategyPayload(notificationbase.NotificationPayloadBase):
SCHEMA = {
'uuid': ('strategy', 'uuid'),
'nam... | {
"content_hash": "da1a2bf8d15b47eaf044c06343ff85de",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 68,
"avg_line_length": 34.77142857142857,
"alnum_prop": 0.6409202958093673,
"repo_name": "openstack/watcher",
"id": "f7da1091996997f7d49b32594150f60fe41a023d",
"size": "187... |
from msrest.serialization import Model
class ApplicationGatewayBackendHealthServer(Model):
"""Application gateway backendhealth http settings.
:param address: IP address or FQDN of backend server.
:type address: str
:param ip_configuration: Reference of IP configuration of backend server.
:type i... | {
"content_hash": "cc344b5997fa6a5714367f5dbc6a3515",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 89,
"avg_line_length": 41.148148148148145,
"alnum_prop": 0.684968496849685,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "b7af66689b6d89e6fc9f29c7962b63d85af4df6f",
"si... |
import unittest
from ...compatibility import StringIO
from ...relationships import Relationships
class TestInitialisation(unittest.TestCase):
"""
Test initialisation of the Relationships class and call a method.
"""
def setUp(self):
self.fh = StringIO()
self.relationships = Relations... | {
"content_hash": "20f101b37ecff9b1ebbad29bcfb07e8c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 26.48,
"alnum_prop": 0.6540785498489426,
"repo_name": "jkyeung/XlsxWriter",
"id": "760160bc9298eb11b4889bb38f99c73ceff7152d",
"size": "835",
"binar... |
from common import Common, logged
from fleet import Fleet
from sikuli import *
from config import Config
from status import Status
class ResupplyRunner(Common):
def __init__(self, fleets, from_small_resuppy=False, enable_expedition_check=False, message=None):
self.fleets = fleets
self.from_small_re... | {
"content_hash": "31da0232e3395d73137a25fcd405e01f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 125,
"avg_line_length": 35.15686274509804,
"alnum_prop": 0.6157278304517568,
"repo_name": "tantinevincent/Onegai-ooyodosan",
"id": "43168038cf134f96c38c8137e6866b5ff95c830a",... |
from phonedusk.app import create_app
from phonedusk.settings import ProdConfig, DevConfig
def test_production_config():
app = create_app(ProdConfig)
assert app.config['ENV'] == 'prod'
assert app.config['DEBUG'] is False
assert app.config['DEBUG_TB_ENABLED'] is False
assert app.config['ASSETS_DEBUG'... | {
"content_hash": "e16d2a5226285f6622e09496a755e61d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 52,
"avg_line_length": 31.9375,
"alnum_prop": 0.6966731898238747,
"repo_name": "kevana/phonedusk-server",
"id": "b8fca8a084814df625fc5209cb4da679ec855a5d",
"size": "535",
... |
"""
Command-line utility for administrative tasks.
"""
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"blog.settings"
)
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "d42b211332b8b32dc0216a303ee30002",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 64,
"avg_line_length": 21.133333333333333,
"alnum_prop": 0.6277602523659306,
"repo_name": "iharsh234/eElectronics",
"id": "07eda594efc1e2a6bf736113573c28f664131055",
"size"... |
from import_export import resources, fields
from import_export.admin import ImportExportModelAdmin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import PermissionDenied
from django.db import models
from django.http import HttpRequest
from import_e... | {
"content_hash": "9ede5ebeb4f2d53e5ec1aa1c56b5b4bd",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 91,
"avg_line_length": 41.099415204678365,
"alnum_prop": 0.5507968127490039,
"repo_name": "carlosp420/VoSeq",
"id": "e29d92f29af80ced0e1c36729cf46a3066d173fb",
"size": "70... |
import _plotly_utils.basevalidators
class ReversescaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="reversescale", parent_name="parcats.line", **kwargs
):
super(ReversescaleValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "c8a6902e6a5e8a07955ca923e7ceedb7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 34.07142857142857,
"alnum_prop": 0.6058700209643606,
"repo_name": "plotly/python-api",
"id": "7696beebcbc1c139dd0a85b2216310b484d6d202",
"size": "477... |
__author__ = 'weezhard'
__license__ = 'GPL'
__version__ = '1.0.0'
import libvirt
import sys
import struct
def getConnection():
try:
conn=libvirt.open("qemu:///system")
return conn
except libvirt.libvirtError, e:
print e.get_error_message()
sys.exit(1)
def delConnection(conn):
try:
conn.clo... | {
"content_hash": "60efd3854a715fd34756eaefefdb5302",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 39,
"avg_line_length": 17.8,
"alnum_prop": 0.6243980738362761,
"repo_name": "skylost/heap",
"id": "0ec84d52c9e6bc46276214b9dd34abe488c6e759",
"size": "646",
"binary": fal... |
from django import forms
from .models import User
class UserForm(forms.ModelForm):
class Meta:
# Set this form to use the User model.
model = User
# Constrain the UserForm to just these fields.
fields = ("first_name", "last_name")
class InstagramUserForm(forms.Form):
usern... | {
"content_hash": "0e697b799071609640db0b345e614037",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 64,
"avg_line_length": 27.51851851851852,
"alnum_prop": 0.5464333781965006,
"repo_name": "devrishik/timepost",
"id": "0c0331ef324ec037a2c3160cbad3eb594b8461b8",
"size": "76... |
import unittest
from test_parallel_dygraph_dataparallel import TestMultipleGpus
class TestParallelizer(TestMultipleGpus):
# check sharding logic as well as the accuracy with single mode
def test_parallelizer_logic(self):
self.run_mnist_2gpu('auto_parallel_parallelizer.py')
if __name__ == "__main__... | {
"content_hash": "117f729bce5745b45293040bd5438c51",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 24.5,
"alnum_prop": 0.7317784256559767,
"repo_name": "luotao1/Paddle",
"id": "2937dc33dde7868b2fee796ca13a66576ce4cd3c",
"size": "954",
"binary": f... |
import balanced
balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY')
bank_account = balanced.BankAccount.fetch('/bank_accounts/BA45anEaEr8g0lOhzhcE9VAN')
bank_account.credit(
amount=5000
) | {
"content_hash": "eca5d58a31f43a0a2ee9ef01f656e563",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 84,
"avg_line_length": 25.375,
"alnum_prop": 0.8275862068965517,
"repo_name": "balanced/balanced-python",
"id": "6231551d1ff5cdc01750a6fc44587e3830e7c05a",
"size": "203",
... |
"""
Download the JSON results file of pp-smokey from Jenkins. Exit with a code
which can be interpreted as a Sensu check:
http://sensuapp.org/docs/0.12/checks
Example: check-smokey-test.py smoke_test_name
To run locally, do this first:
```
export JENKINS_URL=https://deploy.preview.performance.service.gov.uk
```
Exit ... | {
"content_hash": "aea230c25dc96138c67d21e779959ffd",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 77,
"avg_line_length": 25.48314606741573,
"alnum_prop": 0.49834656084656087,
"repo_name": "alphagov/pp-puppet",
"id": "9f0644c6d09bef34f7c0d9c7cd1c95a200551108",
"size": "... |
from __future__ import unicode_literals
from supra import views as supra
import forms
import models
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views import generic
from django.views.generic.edit import UpdateView
from django.views.generic import... | {
"content_hash": "04ce7ab099be0ef49583c663a9b8b5ba",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 149,
"avg_line_length": 34.10267857142857,
"alnum_prop": 0.6407906794082995,
"repo_name": "darkdrei/GestionRegistro",
"id": "f29c518a88ff9e30bb657250112a7ecbfe2c2124",
"si... |
from io import BytesIO
from logging import getLogger
from typing import Mapping
from attr import define, field, fields_dict
from requests import Response
from urllib3.response import ( # type: ignore # import location false positive
HTTPHeaderDict,
HTTPResponse,
is_fp_closed,
)
from . import RichMixin
... | {
"content_hash": "6ed9701e6435f9669dbe938c5ea6df26",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 98,
"avg_line_length": 38.118811881188115,
"alnum_prop": 0.64,
"repo_name": "reclosedev/requests-cache",
"id": "9c01b8846fbb7027602cbc19d1753335e3d63431",
"size": "3850",
... |
import json
import os
from aldryn_client import forms
SYSTEM_FIELD_WARNING = 'WARNING: this field is auto-written. Please do not change it here.'
class Form(forms.BaseForm):
permissions_enabled = forms.CheckboxField(
'Enable permission checks',
required=False,
initial=True,
)
cms... | {
"content_hash": "f0cf8be452da892b487ae054536eac00",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 109,
"avg_line_length": 39.17785234899329,
"alnum_prop": 0.5640256959314776,
"repo_name": "JimyRyan/jimyryan-djangocms",
"id": "40f6ea1c1976e7d203352cc3a3a20323a88d0650",
... |
import ShareYourSystem as SYS
#Point direct with a special Key str
MyPointer=SYS.PointerClass().point(
#PointingToGetVariable
'/ChildPointer/GrandChildPointer',
#PointingToSetKeyVariable
'MyGrandChildPointer'
)
#print
print('MyPointer is')
SYS._print(MyPointer)
| {
"content_hash": "9d1321d42d804f2adc30c3b9fa9bd1e8",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 37,
"avg_line_length": 16.58823529411765,
"alnum_prop": 0.7624113475177305,
"repo_name": "Ledoux/ShareYourSystem",
"id": "be728698d0b18bea7c59fc19271fa61545de4ede",
"size":... |
'''Test the command ouput action.'''
import datetime
import unittest
import action
class TestSpeakShellCommandOutput(unittest.TestCase):
def _say(self, text):
self._say_text = text
def setUp(self):
self._say_text = None
def test_say_receives_output(self):
action.SpeakShellComm... | {
"content_hash": "dbf2993a2c946a98a3583b54adcd668e",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 78,
"avg_line_length": 23.925925925925927,
"alnum_prop": 0.6563467492260062,
"repo_name": "hanmy75/voice-recognizer",
"id": "dd0c2a92605a09d61f09dd4d46f41bd4ee1fdcb4",
"siz... |
from tempest.api.compute import base
from tempest import exceptions
from tempest.test import attr
class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Services API. List and Enable/Disable require admin privileges.
"""
_interface = 'json'
@classmethod
def setUpClass(c... | {
"content_hash": "bde65f1cdfc8fa776788419d99c9fda9",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 73,
"avg_line_length": 37.129629629629626,
"alnum_prop": 0.6623441396508728,
"repo_name": "BeenzSyed/tempest",
"id": "a1809c4e22e9074ac9c6374c203b507077e7ad51",
"size": "26... |
"""Handles database requests from other nova services."""
import copy
import itertools
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_serialization import jsonutils
from oslo_utils import excutils
from oslo_utils import timeutils
import six
from nova.api.ec2 import ec2utils
from nov... | {
"content_hash": "8e6ce757d964c240cfd20bc5167ce0f1",
"timestamp": "",
"source": "github",
"line_count": 853,
"max_line_length": 79,
"avg_line_length": 49.89800703399766,
"alnum_prop": 0.5623193853816695,
"repo_name": "kimjaejoong/nova",
"id": "c1327b716b2ac03dbe54e689f6406a5d50dbb711",
"size": "431... |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from koica.views import QuestionListView, QuestionCreateView, QuestionDetailView, AnswerCreateView, CommentCreateView, CommentAnswerCreateView, updateQuestionRatingView, QuestionRatingView, AnswerRatingView, updateAnswerRatingVie... | {
"content_hash": "e5afcf8b69861235273f4ea5a480e63e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 350,
"avg_line_length": 96.81818181818181,
"alnum_prop": 0.6882629107981221,
"repo_name": "synw/django-koica",
"id": "8f53c7e8f36435113683c10bf999020c08554e75",
"size": "21... |
from __future__ import absolute_import
from django import dispatch
cas_user_authenticated = dispatch.Signal(
providing_args=['user', 'created', 'attributes', 'ticket', 'service'],
)
| {
"content_hash": "51e6506a49639281b3592685cb071837",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 74,
"avg_line_length": 31.166666666666668,
"alnum_prop": 0.7219251336898396,
"repo_name": "11h42/django-cas-ng",
"id": "0a01144169f7544220b9d1d72bf254258ede3e43",
"size": "1... |
from bayesdb.client import Client
from cmd2 import Cmd
import sys
class BayesDBApp(Cmd):
"""Provides "interactive mode" features."""
Cmd.redirector = '>>>'
def __init__(self, client):
self.client = client
self.prompt = 'bql> '
Cmd.__init__(self, 'tab')
def do_show(self, line):
self.client('s... | {
"content_hash": "221b07e94474dddd21d5bd734608e78d",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 129,
"avg_line_length": 24.96590909090909,
"alnum_prop": 0.6144742831133364,
"repo_name": "poppingtonic/BayesDB",
"id": "579a32f6936fdf805f5e7033de3cfe424ab6b78b",
"size": ... |
from learntools.core import *
from learntools.core.asserts import assert_equal
from learntools.time_series.checking_utils import load_average_sales, load_holidays_events
class Q1(ThoughtExperiment): # Determine seasonality
_solution = """Both the seasonal plot and the periodogram suggest a strong weekly seasonal... | {
"content_hash": "0cde348f34ddc343b88a20b20630ba3c",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 370,
"avg_line_length": 33.81410256410256,
"alnum_prop": 0.6470142180094787,
"repo_name": "Kaggle/learntools",
"id": "05022dae40ca95cdfa5df84d2cf6aedc02518ab1",
"size": "5... |
"""Runs both the Python and Java tests."""
import optparse
import os
import sys
import time
from pylib import buildbot_report
from pylib import constants
from pylib import ports
from pylib.base.test_result import TestResults
from pylib.host_driven import run_python_tests
from pylib.instrumentation import apk_info
fro... | {
"content_hash": "46f78b4275a1ce9e80d849fdfffb5b71",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 80,
"avg_line_length": 32.46835443037975,
"alnum_prop": 0.7360623781676413,
"repo_name": "nacl-webkit/chrome_deps",
"id": "43925ae78a304150678b7d310f663162dc430e0f",
"size"... |
from __future__ import absolute_import
import atexit
import shutil
import signal
import tempfile
import threading
import grpc
from apache_beam.options import pipeline_options
from apache_beam.portability.api import beam_job_api_pb2_grpc
from apache_beam.runners.portability import local_job_service
from apache_beam.u... | {
"content_hash": "ae2677e337258086c61f3a1d20e185a3",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 79,
"avg_line_length": 29.697841726618705,
"alnum_prop": 0.6877422480620154,
"repo_name": "iemejia/incubator-beam",
"id": "ec40ae843b648b3599b7ff23035a722717905be7",
"size... |
import abc
from typing import Awaitable, Callable, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core... | {
"content_hash": "d116ea6e9741b96dc6f56f6057bc1a5e",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 101,
"avg_line_length": 38.776978417266186,
"alnum_prop": 0.6263450834879406,
"repo_name": "googleads/google-ads-python",
"id": "cfcc426b1743b8a85286474edc1dc753632d98ca",
... |
"""Module containing classes to connect to Simian as a client."""
import datetime
import httplib
import logging
import mimetools
import os
import platform
import subprocess
import sys
import tempfile
import time
import urllib
import urlparse
import warnings
from M2Crypto import SSL
from M2Crypto.SSL import Checker
... | {
"content_hash": "a4f626bd9caf9038431a021d6621ca72",
"timestamp": "",
"source": "github",
"line_count": 1482,
"max_line_length": 79,
"avg_line_length": 31.83940620782726,
"alnum_prop": 0.6401898868308397,
"repo_name": "googlearchive/simian",
"id": "8572dfde6055cc5a729d3df929da6b8f3da04d0f",
"size":... |
"""
Run some syntax checks.
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
from __future__ import print_function
import os
import sys
sys.path.insert(0, "../src")
sys.path.insert(1, "PyroTests")
def Pyflakes(path, modules):
try:
from pyflakes.scripts.pyflakes impo... | {
"content_hash": "543a70f6f2b7fab89d8e200d0d51c2d4",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 87,
"avg_line_length": 23.842105263157894,
"alnum_prop": 0.6412803532008831,
"repo_name": "irmen/Pyro4",
"id": "bb5ea9bc3fdee2ea5e8b4c9217964c4604d98dea",
"size": "906",
... |
""" A neural chatbot using sequence to sequence model with
attentional decoder.
This is based on Google Translate Tensorflow model
https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/
Sequence to sequence model by Cho et al.(2014)
Created by Chip Huyen as the starter code for assignment 3,
cla... | {
"content_hash": "e896f03c4886e54262eef1a80809f29a",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 116,
"avg_line_length": 44.40996168582375,
"alnum_prop": 0.603312915192822,
"repo_name": "swirlingsand/deep-learning-foundations",
"id": "0521bbf6f0f43d10acbdfd1e3cb7d6c455d... |
from flask_wtf import Form
from wtforms import TextField, BooleanField, IntegerField
from wtforms.validators import DataRequired, Length
from .models import Warehouse, Item
from mytrade.form.fields import Select2Field
from mytrade.utils import _
class WarehouseForm(Form):
id = IntegerField()
warehouse_name ... | {
"content_hash": "b27917eeafacc972ededa2c73801427b",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 132,
"avg_line_length": 33.816901408450704,
"alnum_prop": 0.6384839650145773,
"repo_name": "hellwen/mytrade",
"id": "a1d0b5dbfacb7141442cb3682a960d1bf5006d5a",
"size": "242... |
from __future__ import absolute_import, division, print_function
from twisted.python.components import proxyForInterface
from twisted.web.iweb import IResponse
from requests.cookies import cookiejar_from_dict
from treq.content import content, json_content, text_content
class _Response(proxyForInterface(IResponse))... | {
"content_hash": "b1c18cf0c9eedde8ad0bc5fd6c4a0ba8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 70,
"avg_line_length": 29.1875,
"alnum_prop": 0.6331192005710207,
"repo_name": "glyph/treq",
"id": "c71423b9ed4eb4139a083f3b621b64676f1d2a9c",
"size": "1401",
"binary": f... |
from .client import SaltClient
__all__ = [SaltClient]
| {
"content_hash": "84a486c7b0ab9ea9b8d4c69e3693422e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 30,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.7090909090909091,
"repo_name": "cizixs/saltclient",
"id": "26d1f216ea540430774cc980d8325538a977bfab",
"size": "55"... |
import pipeline_dp
from pipeline_dp import partition_selection
import unittest
from unittest.mock import patch
class PartitionSelectionTest(unittest.TestCase):
@patch(
"pydp.algorithms.partition_selection.create_truncated_geometric_partition_strategy"
)
def test_truncated_gemetric(self, mock_met... | {
"content_hash": "c292ec0dd487571aecdd2fcfec8f65d4",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 91,
"avg_line_length": 38.13636363636363,
"alnum_prop": 0.6942789034564958,
"repo_name": "OpenMined/PipelineDP",
"id": "c7b94f8d23fc4ab43474bb46a23f505bd1f6d740",
"size": "... |
from django.conf import settings
from django.db import models
from embed_video.fields import EmbedVideoField
from polymorphic.models import PolymorphicModel
from taggit.managers import TaggableManager
from rlp.projects.models import Project
class Document(PolymorphicModel):
title = models.CharField(max_length=2... | {
"content_hash": "5d2022e4c3e15ba227232a45b1c4c72f",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 117,
"avg_line_length": 34.50892857142857,
"alnum_prop": 0.581888745148771,
"repo_name": "HMSBeagle1831/rapidscience",
"id": "f6021158e4d73032258c7e14a3d98c26189f4430",
"s... |
"""
Support for TPLink HS100/HS110/HS200 smart switch.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.tplink/
"""
import logging
import time
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
fr... | {
"content_hash": "b116a50d60b9f44a71b5c4ce473635fe",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 78,
"avg_line_length": 30.89189189189189,
"alnum_prop": 0.6036745406824147,
"repo_name": "keerts/home-assistant",
"id": "961ee72496e99f0e72dbe2c19e600de39c75a17e",
"size":... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/reactor/shared_rct_cygnus_mk2.iff"
result.attribute_template_id = 8
result.stfName("space/space_item","rct_cygnus_mk2_n")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
retu... | {
"content_hash": "f54491a0cf64b4474b6a471754d0748e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 25.307692307692307,
"alnum_prop": 0.7051671732522796,
"repo_name": "anhstudios/swganh",
"id": "0a6f1e6482bf5324732d8a021f48cc056faf73d1",
"size": "47... |
from webob import exc
from nova.api.openstack import wsgi
class Controller(object):
""" The Shared IP Groups Controller for the Openstack API """
def index(self, req, **kwargs):
""" Returns a list of Shared IP Groups for the user """
raise exc.HTTPNotImplemented()
def show(self, req, id... | {
"content_hash": "5481c2d27e65d20364557e2108a185a0",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 29.257142857142856,
"alnum_prop": 0.6279296875,
"repo_name": "30loops/nova",
"id": "54d0a8334137ec23dfec7d672cb508870346e2a4",
"size": "1699",
"bin... |
My Submissions Question Solution
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
Note:
Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
[show hint]
Related probl... | {
"content_hash": "4ca35e0727d36b760daf66fbcca01f1e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 103,
"avg_line_length": 31.17241379310345,
"alnum_prop": 0.6161504424778761,
"repo_name": "UmassJin/Leetcode",
"id": "8e8b2057fd549f41cc53c86398ab6a343d1ea4bd",
"size": "90... |
"""Experiment class collecting information needed for a single training run."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import functools
import math
import os
import time
from tensorflow.contrib.framework import deprecated
from te... | {
"content_hash": "c7e8caff9093004e674c1b89df360963",
"timestamp": "",
"source": "github",
"line_count": 869,
"max_line_length": 82,
"avg_line_length": 42.601841196777904,
"alnum_prop": 0.6496042786526566,
"repo_name": "Kongsea/tensorflow",
"id": "fc4bd1f461d7bfbfcfb78201d527959055342f0a",
"size": "... |
from django.core.exceptions import ValidationError
from rest_framework import exceptions
from rest_framework import serializers as ser
from rest_framework.fields import empty
from rest_framework.exceptions import ValidationError as DRFValidationError
from website import settings
from api.base.exceptions import Conflic... | {
"content_hash": "f255afaaa22878b009e07a058b42f2a0",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 194,
"avg_line_length": 38.750936329588015,
"alnum_prop": 0.6563088967283622,
"repo_name": "Johnetordoff/osf.io",
"id": "2a379d93bed266342b34285dcd4b735583f8fb19",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0023_auto_20160131_1919'),
]
operations = [
migrations.AlterField(
model_name='channel',
name='kind',
fie... | {
"content_hash": "1fa19eacdcaf38217526cb1739468b8f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 231,
"avg_line_length": 30.77777777777778,
"alnum_prop": 0.5884476534296029,
"repo_name": "BetterWorks/healthchecks",
"id": "236a11dd887798a5fee4b10459624ec3a859a8e2",
"siz... |
import csv
import time
import tempfile
import os
#this code requires matplotlib to be installed
#please refer to http://matplotlib.org/downloads.html
import matplotlib.pyplot as plt
class TabularData:
def __init__(self, data, header=None):
self.data = data
self.header = header
####################... | {
"content_hash": "c1ee98c87d682a3a7fccd20394658ad7",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 92,
"avg_line_length": 28.408163265306122,
"alnum_prop": 0.5926724137931034,
"repo_name": "gems-uff/noworkflow",
"id": "a6f0b35fcad23d09c9c3049f303d9bfed76c645b",
"size": "... |
"""
The ASL module of niftyfit, which wraps the fitting methods in NiftyFit.
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\
data'))
>>> os.chdir(d... | {
"content_hash": "82a3f2af79b785e378e2c20ed5161f70",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 79,
"avg_line_length": 46.10322580645161,
"alnum_prop": 0.6055135740274279,
"repo_name": "mick-d/nipype",
"id": "f0cc8bc19bfdcbfa6e295d89762fd905347e640c",
"size": "7261",... |
import sys
import time
import random
import zmq
def main(myself, others):
print "Hello, I am", myself
context = zmq.Context()
# State Back-End
statebe = context.socket(zmq.PUB)
# State Front-End
statefe = context.socket(zmq.SUB)
statefe.setsockopt(zmq.SUBSCRIBE, '')
bind_address =... | {
"content_hash": "c4b371b79e9d0c446a4c4718e46313e1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 68,
"avg_line_length": 26.208333333333332,
"alnum_prop": 0.5357710651828299,
"repo_name": "krattai/noo-ebs",
"id": "044bbef4cc9f054f9d89682ac23f2facc5397e4f",
"size": "2038... |
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
... | {
"content_hash": "8d5874028ed32dc631b4fccecab7c2ed",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 86,
"avg_line_length": 31.852941176470587,
"alnum_prop": 0.6740535549399815,
"repo_name": "abhinavsingh/proxy.py",
"id": "26566757c9fb543226c1658e65dcd5379a2fff4f",
"size":... |
import webob
from nova.compute import vm_states
import nova.context
from nova import exception
from nova.openstack.common import jsonutils
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import test
from nova.tests import fake_instance
class CommonMixin(object):
... | {
"content_hash": "342b8ee34cbc61a63cfb653b42916bbc",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 77,
"avg_line_length": 40.825581395348834,
"alnum_prop": 0.5693534605525491,
"repo_name": "ewindisch/nova",
"id": "39c12b639322a9304f911b65e00f2826774d240b",
"size": "7614... |
"""
The FormattedDecimal class allows locale aware formatting of currency
amounts as decimals. This is intended to be used internally to format
total values and extra values automatically when printed.
"""
from django.conf import settings
from decimal import Decimal
from django.utils.safestring import mar... | {
"content_hash": "d7503d851fb0a819e4d585c0330d9dba",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 80,
"avg_line_length": 36.11656441717791,
"alnum_prop": 0.5846781042976049,
"repo_name": "willhardy/Roll-Your-Own",
"id": "d2e34f4824a5d7a60896181d42381055edc947b7",
"size... |
from .file_utils import fetch_or_upload_file_links, fetch_or_upload_html_links
import time as _time
from installed_clients.baseclient import ServerError as _DFUError
from uuid import uuid4
""" Utilities for creating reports using DataFileUtil """
def create_report(params, dfu):
"""
Create a simple report
... | {
"content_hash": "b02730dceb66e41243ea297436003543",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 89,
"avg_line_length": 34.26923076923077,
"alnum_prop": 0.6066217732884399,
"repo_name": "msneddon/KBaseReport",
"id": "fed98b4114b1065107473eff6a9f85291b73d49f",
"size": ... |
"""Leetcode 131. Palindrome Partitioning
Medium
URL: https://leetcode.com/problems/palindrome-partitioning/
Given a string s, partition s such that
every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
Example:
Input: "aab"
Output:
[
["aa","b"],
["a","a","b"]
]
"""... | {
"content_hash": "f9e6a7dc98889271b9a901190921328f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 74,
"avg_line_length": 23.35483870967742,
"alnum_prop": 0.5497237569060773,
"repo_name": "bowen0701/algorithms_data_structures",
"id": "661a80ea0dfab002e2aa4d5ca99c81a1a1d179... |
"""Base classes for all estimators."""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
from collections import defaultdict
import platform
import inspect
import re
import numpy as np
from . import __version__
from ._config import get_config
from .utils im... | {
"content_hash": "b102678e36387a8e5f00d8815c01c5df",
"timestamp": "",
"source": "github",
"line_count": 854,
"max_line_length": 79,
"avg_line_length": 35.441451990632316,
"alnum_prop": 0.5720421581260118,
"repo_name": "ndingwall/scikit-learn",
"id": "3d49ec4fe96f69d57508307f39fb31e87246989e",
"size... |
import os
import time
import Queue
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler, DirModifiedEvent
# Alias this as this can be called during interpreter shutdown
_Empty = Queue.Empty
class EventHandler(FileSystemEventHandler):
def __init__(self, callback=None):
... | {
"content_hash": "d6225ea435b3125db37fc50e82a60f9b",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 76,
"avg_line_length": 29.379746835443036,
"alnum_prop": 0.6092201637225334,
"repo_name": "lektor/lektor-archive",
"id": "ad0bdec210cff34768b01269c2b8097c07e57865",
"size":... |
from django.shortcuts import render
from .models import Stop, Agency
from . import forms
from traffic_stops import base_views
class Home(base_views.Home):
form_class = forms.AgencySearchForm
template_name = 'md.html'
success_url = 'md:agency-detail'
def get_context_data(self, **kwargs):
cont... | {
"content_hash": "7e2cacd6e8f4dfe8cd12e2f6a82151b3",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 62,
"avg_line_length": 24.382978723404257,
"alnum_prop": 0.6387434554973822,
"repo_name": "OpenDataPolicingNC/Traffic-Stops",
"id": "8b293d06725fa83b541fec5ae83b0d901daf8aa9"... |
from usched import Sched, wait
from pushbutton import Pushbutton, descriptor
def stop(fTim, objSch): # Stop the scheduler after fTim seconds
yield from wait(fTim)
objSch.stop()
def x5print(*args):
print("X5 released " +args[0]) # Demo of argumen... | {
"content_hash": "877a1c7847cc2a9916a39bbfbf87ff83",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 99,
"avg_line_length": 32.972972972972975,
"alnum_prop": 0.5967213114754099,
"repo_name": "peterhinch/Micropython-scheduler",
"id": "d9af9455fb748920495b6c01024a31ad63e467ec"... |
from flask import Flask, g
from flask_wtf.csrf import CsrfProtect
from flask_login import current_user, LoginManager
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from werkzeug.security import generate_password_hash
from server.database.models import Base, Entry, Feed, User
fro... | {
"content_hash": "f2043b38d5dd23c1a95ae9ac78f0a5c9",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 73,
"avg_line_length": 28.967741935483872,
"alnum_prop": 0.7071269487750557,
"repo_name": "flacerdk/smoke-signal",
"id": "ee42921edce5c025d5016a07bde94c770b28b671",
"size":... |
from organizations.models import Organization
from organizations.views.base import ViewFactory
from organizations.views.mixins import AdminRequiredMixin
from organizations.views.mixins import MembershipRequiredMixin
from organizations.views.mixins import OwnerRequiredMixin
bases = ViewFactory(Organization)
class Org... | {
"content_hash": "5319b69c85a0f1d09c38b32d3fd79396",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 23.618181818181817,
"alnum_prop": 0.8252501924557352,
"repo_name": "bennylope/django-organizations",
"id": "06d5cc0e811901d0aa093da24cd8b0991a34c80f",
... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungro... | {
"content_hash": "b7da9af579b862b1500ebea652be3bfa",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 107,
"avg_line_length": 52.775862068965516,
"alnum_prop": 0.7174126102580856,
"repo_name": "Azure/azure-sdk-for-python",
"id": "418d621007352ededa0887314ac6eba2e40c5e92",
"... |
"""empty message
Revision ID: f231d82b9b26
Revises: e68c4473c581
Create Date: 2018-03-20 19:47:54.991259
"""
from alembic import op
import sqlalchemy as sa
from superset.utils import generic_find_uq_constraint_name
# revision identifiers, used by Alembic.
revision = 'f231d82b9b26'
down_revision = 'e68c4473c581'
co... | {
"content_hash": "491fd45bead98f3ad93cc4fbc2772e2e",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 77,
"avg_line_length": 28.549295774647888,
"alnum_prop": 0.5974346324617662,
"repo_name": "timifasubaa/incubator-superset",
"id": "5d3acbef1d8130206d3c251cb7e4812c8ca5e048",
... |
from flask import Flask, Response
from twilio.util import TwilioCapability
app = Flask(__name__)
@app.route('/token', methods=['GET'])
def get_capability_token():
"""Respond to incoming requests."""
# Find these values at twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_tok... | {
"content_hash": "e5cd493c58438fb9f528ac5132a1aa55",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 58,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.7115646258503401,
"repo_name": "teoreteetik/api-snippets",
"id": "756bf932f6d23876e5fc4989e32712be52233cce",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.