text stringlengths 4 1.02M | meta dict |
|---|---|
from .column import Column
from typing import List, Union
class Numeric(Column):
_allowed_column_types = [
'INTEGER',
'INT',
'SMALLINT',
'TINYINT',
'MEDIUMINT',
'BIGINT',
'DECIMAL',
'NUMERIC',
'FLOAT',
'DOUBLE',
'BIT',
]
... | {
"content_hash": "60604f3860915ac84286ccb018ae9551",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 120,
"avg_line_length": 40.888888888888886,
"alnum_prop": 0.5557065217391305,
"repo_name": "cmancone/mygrations",
"id": "d8f8d24a21f949cf9a897c590b0f18eb8995102e",
"size":... |
from django.contrib.auth.models import User
from django.db import models
class Nonce(models.Model):
server_url = models.CharField(max_length=2047)
timestamp = models.IntegerField()
salt = models.CharField(max_length=40)
def __unicode__(self):
return u"Nonce: %s, %s" % (self.server_url, self.s... | {
"content_hash": "dafd8c539c97c8ac64882ddb107988a4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 70,
"avg_line_length": 32.03448275862069,
"alnum_prop": 0.697524219590958,
"repo_name": "vtemian/django-openid-auth",
"id": "3c3764a5c42762b98e3a84c389e4957ae54fc4f0",
"siz... |
__all__ = ['pretty_print_model_fields']
def _get_class_full_name(cls_):
return cls_.__module__ + '.' + cls_.__name__
class _ModelFieldRow(object):
def __init__(self, field):
self.field = field
self.name = field.name
self.type_ = _get_class_full_name(type(field))
if self.fiel... | {
"content_hash": "aacbf60fc2011e76a392b3613d584091",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 84,
"avg_line_length": 35.76086956521739,
"alnum_prop": 0.5580547112462007,
"repo_name": "wwitzel3/awx",
"id": "1e637e9c1b924e183f188272ee322ced8e6ee576",
"size": "1645",
... |
"""
Flask-WhooshAlchemy-Redux
-------------
Whoosh extension to Flask/SQLAlchemy
"""
from setuptools import setup
import os
setup(
name='Flask-WhooshAlchemy-Redux',
version='0.7.1',
url='https://github.com/dhamaniasad/Flask-WhooshAlchemy',
license='BSD',
author='Asad Dhamani',
author_email='... | {
"content_hash": "c45f0a02910a50099e3c8218d2a5e02b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 87,
"avg_line_length": 28.926829268292682,
"alnum_prop": 0.633220910623946,
"repo_name": "dhamaniasad/Flask-WhooshAlchemy",
"id": "37ab5d82adbc8db51949586afda375274a5a3cb8",
... |
import mock
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from nova import context
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import request_spec
from nova.tests.unit import fake_flavor
from nova.tests.unit import fake_instance
from n... | {
"content_hash": "a14f23870a9b7bd8f33e55dd5e7e77bd",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 79,
"avg_line_length": 42.92292089249493,
"alnum_prop": 0.5557865885355134,
"repo_name": "dims/nova",
"id": "d68df0171f30f5d7ec00f721b3c258c2d4d32625",
"size": "21770",
... |
import numpy as np
from simplenet.util import orthogonalize_vectors
def test_does_not_mutate_first_selected_vector():
"""
A pair of vectors requires the calculation of a single
projection coefficient of the first vector onto the
second vector. This is the simplest scenario to test.
"""
origina... | {
"content_hash": "00bf771e7731e90b1b1bc281a873fee7",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 89,
"avg_line_length": 39.76271186440678,
"alnum_prop": 0.710997442455243,
"repo_name": "rileymcdowell/simplennet",
"id": "9a1235e5e038d4adbaa6c0959d9caa492cf4cd94",
"size"... |
from flask import render_template, redirect, abort, url_for, request, \
make_response, send_from_directory, send_file
from flask_admin.contrib import sqla
from flask_security import current_user, login_required
from app import app
from app.models import Panther, Link, Location
@app.route('/')
@app.route('/index'... | {
"content_hash": "3eb98829624d444ac99a5f16016a998d",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 87,
"avg_line_length": 32.64661654135338,
"alnum_prop": 0.5746199907876555,
"repo_name": "David-OConnor/lakenheath",
"id": "180d1686baecd8d4c4818ca9fa3a474c7172c4d2",
"siz... |
""" Utils to train DistilBERT
adapted in part from Facebook, Inc XLM model (https://github.com/facebookresearch/XLM)
"""
import json
import logging
import os
import socket
import git
import numpy as np
import torch
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(me... | {
"content_hash": "a93de3158813aeed72039c1081cd3592",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 90,
"avg_line_length": 30.65546218487395,
"alnum_prop": 0.6055372807017544,
"repo_name": "huggingface/transformers",
"id": "6d439453fe08ded6735208035dc0ed647849e957",
"siz... |
import copy
class SigOptException(Exception):
pass
class ConnectionException(SigOptException):
"""
An exception that occurs when the SigOpt API was unavailable.
"""
def __init__(self, message):
super().__init__(message)
self.message = message
def __str__(self):
return '{0}: {1}'.format(
... | {
"content_hash": "b3098e95bb440b4b64831b43f24fb6e1",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 89,
"avg_line_length": 31.045454545454547,
"alnum_prop": 0.6466569058077111,
"repo_name": "sigopt/sigopt-python",
"id": "cead4e2b73fd7b930c12e686ffdc632dab93283d",
"size": ... |
"""Tests for distutils.command.bdist_dumb."""
import os
import sys
import zipfile
import unittest
from test.support import run_unittest
from distutils.core import Distribution
from distutils.command.bdist_dumb import bdist_dumb
from distutils.tests import support
SETUP_PY = """\
from distutils.core impo... | {
"content_hash": "7d109e42398c238711694631b575c9cb",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 30.88659793814433,
"alnum_prop": 0.5607476635514018,
"repo_name": "Suwmlee/XX-Net",
"id": "9f3aaf1f655fe54c798e3b9c4cc45504272c6219",
"size": "2996",... |
"""Counterfactual explanations using linear model."""
import copy
from typing import Any, List, Optional, Text, Dict, Sequence, Iterable
from absl import logging
from lit_nlp.api import components as lit_components
from lit_nlp.api import dataset as lit_dataset
from lit_nlp.api import dtypes
from lit_nlp.api import m... | {
"content_hash": "a4996c5b090842d4f35eff015177f048",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 80,
"avg_line_length": 33.151785714285715,
"alnum_prop": 0.7045515755453811,
"repo_name": "pair-code/lit",
"id": "6aec6e308d881cee99e540dd0f33f3dbbbeacdb4",
"size": "4387"... |
import lxml.html.soupparser
import pandas as pd
import requests
class StockUtils(object):
@staticmethod
def new_stocks():
url = 'http://vip.stock.finance.sina.com.cn/corp/view/vRPD_NewStockIssue.php?page=1&cngem=0&orderBy=NetDate&orderType=desc'
request = requests.get(url)
doc = lxml.h... | {
"content_hash": "1fbc0008757b1b97906bee79307e2720",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 131,
"avg_line_length": 44.85,
"alnum_prop": 0.6265328874024526,
"repo_name": "Pyangs/ShiPanE-Python-SDK",
"id": "5fe16e73ff5d8928cb662267fcd091472b0a1339",
"size": "922",
... |
import re
import web
from libweasyl.ratings import GENERAL, MODERATE, MATURE, EXPLICIT
from weasyl import character, journal, media, searchtag, submission
from weasyl import define as d
_query_find_modifiers = {
"#submission": "submit",
"#character": "char",
"#journal": "journal",
"#user": "user",
}... | {
"content_hash": "221966a604d21c3721ce3b6b0f706bd6",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 127,
"avg_line_length": 36.53150684931507,
"alnum_prop": 0.5823458827058647,
"repo_name": "dzamie/weasyl",
"id": "cb503a1850865cb6ae7fa577af7ab12f81a56a76",
"size": "13334... |
"""
This file holds utility functions that have no dependencies on other console code.
Avoids import loops
"""
import time
import webcolors
import importlib, os
import config
def importmodules(dir: str):
# dir of form relative path name
importlist = {}
path = dir.split('/')
if path[0] == '': del path[0]
pypath ... | {
"content_hash": "c1665ac5b99fa1e3f308be34e3cfcaf4",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 103,
"avg_line_length": 26.801324503311257,
"alnum_prop": 0.6449221645663454,
"repo_name": "kevinkahn/softconsole",
"id": "4d7c082c3204e8770f750d60906fd29b04bdaf57",
"size... |
import urllib
import jinja2
from django_jinja import library
from django.contrib.staticfiles.storage import staticfiles_storage
from django.utils.http import urlquote
from django.core.urlresolvers import reverse
from django.template.defaultfilters import linebreaksbr, urlize
from airmozilla.base.utils import get_abs... | {
"content_hash": "ec902d1529ccfe6109d65213aa1584e2",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 66,
"avg_line_length": 25.875,
"alnum_prop": 0.6586151368760065,
"repo_name": "mozilla/airmozilla",
"id": "b99c6c1c59b817003a3cd6d8f2c02996ef841426",
"size": "2484",
"bin... |
""" A TVTK scene editor. """
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from apptools.preferences.api import get_default_preferences
from tvtk.pyface.tvtk_scene import TVTKScene
from tvtk.pyface.api import DecoratedSc... | {
"content_hash": "9aa80ab18f061006a393f218e3944174",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 32.50961538461539,
"alnum_prop": 0.5226264418811003,
"repo_name": "dmsurti/mayavi",
"id": "a50e06e19b87d2fde92c0d7553051d4279c11209",
"size": "3381"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('frbb', '0006_poem_category'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='withdrawn',
... | {
"content_hash": "05d95235897380b53727c924f6cbc1b9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 49,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.592,
"repo_name": "seriouscamp/frbb",
"id": "1873936a2f3d6b512ac40be5659d6409f38aca8e",
"size": "447",
"binary"... |
from invoke.tasks import task
@task(aliases=('bar', 'otherbar'))
def foo(ctx):
"""
Foo the bar.
"""
pass
@task
def foo2(ctx):
"""
Foo the bar:
example code
Added in 1.0
"""
pass
@task
def foo3(ctx):
"""Foo the other bar:
example code
Added in 1.1
"""
... | {
"content_hash": "80b6859a2da2ee3559fa102f0b717845",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 55,
"avg_line_length": 14.203703703703704,
"alnum_prop": 0.590612777053455,
"repo_name": "pfmoore/invoke",
"id": "0518c8bde5367009f38b3c7abc1195b3a482ddde",
"size": "767",
... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0038_auto_20171129_0616'),
('product', '0037_auto_20171129_1004'),
]
operations = [
]
| {
"content_hash": "0fce4d441f46ad9d880b6193447a322c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 47,
"avg_line_length": 18.928571428571427,
"alnum_prop": 0.6339622641509434,
"repo_name": "UITools/saleor",
"id": "7c0b8078c4ecdb87e982b70509ae95f620af754a",
"size": "338",... |
"""
Utility functions for bAbI example and demo.
"""
from neon.data import BABI
from neon.initializers import GlorotUniform, Uniform, Orthonormal
from neon.layers import Affine, GRU, LookupTable, MergeMultistream, LSTM
from neon.models import Model
from neon.transforms import Logistic, Softmax, Tanh
# list of bAbI ta... | {
"content_hash": "06737afa6f98d25c888caa29655496a7",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 92,
"avg_line_length": 30.96385542168675,
"alnum_prop": 0.6571984435797665,
"repo_name": "NervanaSystems/neon",
"id": "a9a30baf1e9396da45a7ce25608dc6c8a56e907b",
"size": "3... |
__author__ = 'tyler'
import os
import project
class Workspace(object):
def __init__(self, path):
self.path = path
self.projects = self.set_projects(path)
def find_projects(self, path):
projects = []
folders = [os.path.join(path, o) for o in os.listdir(path) if
... | {
"content_hash": "c8d91f01cafdf9d37b95ccf77ac6794d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 110,
"avg_line_length": 32.06060606060606,
"alnum_prop": 0.5708884688090737,
"repo_name": "tylerhjones/workspacer",
"id": "7a123504b1bed0ec75f33a2272de7cd5ab65643d",
"size"... |
from blazeweb.views import asview
from blazeweb.wrappers import Response
@asview()
def helloworld():
return 'Hello World'
@asview('/mms')
def make_me_shorter():
return 'make_me_shorter'
@asview('/hw/<tome>')
def helloto(tome='World'):
return 'Hello %s' % tome
@asview('/hw2/<tome>')
def helloto2(noth... | {
"content_hash": "68b268ce9a9accd55fe72b8a403bca08",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 73,
"avg_line_length": 19.164556962025316,
"alnum_prop": 0.6393659180977543,
"repo_name": "level12/blazeweb",
"id": "5547e820549e1c0b675412797f6cd19495d58727",
"size": "151... |
import cv2
from geosolver.diagram.draw_on_image import draw_point, draw_instance, draw_label
from geosolver.ontology.ontology_semantics import evaluate
from geosolver.utils.prep import display_image
__author__ = 'minjoon'
class ImageSegment(object):
def __init__(self, segmented_image, sliced_image, binarized_se... | {
"content_hash": "98052fdd53d88d904734362f330a9c7f",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 117,
"avg_line_length": 39.116129032258065,
"alnum_prop": 0.6740887349496949,
"repo_name": "lupantech/InterGPS",
"id": "d969868a11bf7c5b51fb6c6df7abb51c062861e3",
"size": ... |
from functools import partial
import logging
import unittest
# 3rd
from mock import Mock
# project
from tests.checks.common import Fixtures
log = logging.getLogger(__name__)
WMISampler = None
# Thoughts
# Log WMI activity
# Mechanism to timeout
# Check when pywintypes.com_error are raised
# Check the role of the... | {
"content_hash": "0dc443074505d9d685403aea096dad45",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 158,
"avg_line_length": 35.07185628742515,
"alnum_prop": 0.6160719367139036,
"repo_name": "amalakar/dd-agent",
"id": "98c93884e0da6ce962bac4a0cfb6e29d3050f8d4",
"size": "1... |
import datetime
import os
import shutil
import sys
import yaml
def gen_vehicle_controller_header(content, output_dir):
controller_header_tpl_file = "template/controller.h.tpl"
car_type = content["car_type"]
with open(controller_header_tpl_file, 'r') as tpl:
fmt = tpl.readlines()
controller_he... | {
"content_hash": "09fe0a73dbda52890d10784dd704042b",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 93,
"avg_line_length": 40.32743362831859,
"alnum_prop": 0.5822909809084924,
"repo_name": "ApolloAuto/apollo",
"id": "eb18ec65465abbc9e4d345538808d924ec7069dd",
"size": "99... |
"""
Find the k-cores of a graph.
The k-core is found by recursively pruning nodes with degrees less than k.
See the following references for details:
An O(m) Algorithm for Cores Decomposition of Networks
Vladimir Batagelj and Matjaz Zaversnik, 2003.
http://arxiv.org/abs/cs.DS/0310049
Generalized Cores
Vladimir Bata... | {
"content_hash": "0fe6149fe94e0cad27e424b0cb232bef",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 77,
"avg_line_length": 28.617391304347827,
"alnum_prop": 0.6259495594044363,
"repo_name": "andnovar/networkx",
"id": "c98c7d77c65678cfcba19e2ab2571ec8b29cbd74",
"size": "1... |
import os
import sys
from unittest import TestCase, main
from cliez.conf import settings, Settings
class Model(object):
config_none = settings()
def __init__(self):
self.config = settings()
pass
pass
class SettingsTests(TestCase):
def setUp(self):
sys.path.insert(0, os.pat... | {
"content_hash": "7b4714258b7f616cfe120e646fcfe556",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 63,
"avg_line_length": 19.976190476190474,
"alnum_prop": 0.6042908224076281,
"repo_name": "9nix00/cliez",
"id": "d84a3affe1a0cc3d245c9a2d87dd44310efef041",
"size": "839",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20160406_1726'),
]
operations = [
migrations.AlterField(
model_name='post',
name='draft',
fie... | {
"content_hash": "6eeceed68d59296977daf8e1921f4f27",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 20.88888888888889,
"alnum_prop": 0.5904255319148937,
"repo_name": "smi96/django-blog_website",
"id": "4f69d5f7a168127cae5abaaea412a13941f15b37",
"siz... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ConfigurationVariableConfig(AppConfig):
name = 'django_admin_conf_vars'
verbose_name = _(u'Configuration variables')
def ready(self):
from .global_vars import config
config.load_attributes()
| {
"content_hash": "eee3078f8cb17b6be87cc33d50bf5c8f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 55,
"avg_line_length": 28.90909090909091,
"alnum_prop": 0.7264150943396226,
"repo_name": "maoaiz/django-admin-conf-vars",
"id": "5a8eaaabefd0731522e66889eadccedcfc38dd1d",
... |
"""
Run a Python script in the directory specified by **ctx.bldnode**.
Select a Python version by specifying the **version** keyword for
the task generator instance as integer 2 or 3. Default is 3.
Any string passed to the **add_to_pythonpath** keyword will be appended to the
PYTHONPATH environmetal variable; strings... | {
"content_hash": "bc6cf825544fff49244a54e16b0738e3",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 95,
"avg_line_length": 32.1764705882353,
"alnum_prop": 0.5980347349177331,
"repo_name": "MarekIgnaszak/econ-project-templates",
"id": "e9751c95e5da5616c64f77c8945dcd362fe4bf... |
from django.contrib import admin
from file_picker.uploads import models as upload_models
admin.site.register(upload_models.Image)
admin.site.register(upload_models.File)
| {
"content_hash": "285c7cf878bcab5baa45768ef8335b49",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 55,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.8255813953488372,
"repo_name": "caktus/django-file-picker",
"id": "d7637a9894736bd34b52432db138dc9a18d1a82a",
"siz... |
from aiohttp import web
import urllib.parse
from foglamp.common.storage_client.payload_builder import PayloadBuilder
from foglamp.services.core import connect
__author__ = "Ashish Jabble"
__copyright__ = "Copyright (c) 2018 OSIsoft, LLC"
__license__ = "Apache 2.0"
__version__ = "${VERSION}"
_help = """
---------... | {
"content_hash": "cfd020ba45cf5661da9fe43301a06131",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 100,
"avg_line_length": 39.05357142857143,
"alnum_prop": 0.563328760859625,
"repo_name": "foglamp/FogLAMP",
"id": "6a58f4391bb4f60b0b0255a67337314028d269bd",
"size": "2281"... |
from __future__ import absolute_import
from __future__ import print_function
import os
import socket
from apptools.preferences.preference_binding import bind_preference
from smb.SMBConnection import SMBConnection, OperationFailure
from traits.api import Str
from pychron.media_storage.storage import RemoteStorage
from... | {
"content_hash": "608be6e3bc04bf9bceb0a804d5689215",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 91,
"avg_line_length": 32.237037037037034,
"alnum_prop": 0.5533088235294118,
"repo_name": "UManPychron/pychron",
"id": "0a91f11155892744bd3a6d6ad7d83f4dee286ec6",
"size": ... |
import numpy as np
import tvm
from tvm.contrib import graph_runtime
from tvm.relay.testing.config import ctx_list
from tvm import relay
from model_zoo import c2_squeezenet, c2_resnet50, c2_vgg19
from caffe2.python import workspace, core
from caffe2.proto import caffe2_pb2
from collections import namedtuple
def get_tv... | {
"content_hash": "27fefae02a178bef163ada8723ab08f2",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 100,
"avg_line_length": 30.43577981651376,
"alnum_prop": 0.5733232856066315,
"repo_name": "Huyuwei/tvm",
"id": "92258bbc284e5aa39933079c9aa2d8bbac403d57",
"size": "7420",
... |
import datetime
import sys
from lxml import etree
from xml.sax.saxutils import escape, unescape
TABLE = "table"
ROW = "row"
COL = "col"
FIELD = "field"
TAG = "tag"
HASHTAG = "hashtag"
# -----------------------------------------------------------------------------
def xml_encode(s):
if s:
s = escape(s, {... | {
"content_hash": "420aba6df082883c91fb788f27420cfc",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 88,
"avg_line_length": 32.35117056856188,
"alnum_prop": 0.44515662152382923,
"repo_name": "flavour/RedHat",
"id": "03970def0b1f664dd69f7fdf39a28801d38ff5f7",
"size": "9965... |
import msl.package_manager as pm
def test_github():
pkgs = pm.github()
assert pm.utils._PKG_NAME in pkgs
pkg = pkgs[pm.utils._PKG_NAME]
assert len(pkg['description']) > 0
assert len(pkg['version']) > 0
assert len(pkg['tags']) > 10
assert len(pkg['branches']) > 0
| {
"content_hash": "3a121ede420a64bd4af94f536cb919cd",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 38,
"avg_line_length": 26.636363636363637,
"alnum_prop": 0.621160409556314,
"repo_name": "MSLNZ/msl-package-manager",
"id": "7c05bb589b6b8ef2ca636fa2106510c1fca5ea1f",
"siz... |
from __future__ import unicode_literals
from django.db import migrations
from pages.models import Page
def rebuild_tree(apps, schema_editor):
Page.objects.rebuild()
class Migration(migrations.Migration):
dependencies = [
('pages', '0009_pages_mptt'),
]
operations = [
migrations.... | {
"content_hash": "42b247b486da8f815cd63bef61846804",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 43,
"avg_line_length": 16.714285714285715,
"alnum_prop": 0.6695156695156695,
"repo_name": "fidals/refarm-site",
"id": "123c4179601da01070e933b07ba4bab2e17616a4",
"size": "4... |
import base64
import io
import os
import shutil
import tempfile
import zipfile
import invoke
from . import paths
@invoke.task
def authors():
print("[generate.authors] Generating AUTHORS")
# Get our list of authors
print("[generate.authors] Collecting author names")
r = invoke.run("git log --use-mai... | {
"content_hash": "c2156da10618a1b6aa37cd367826cce1",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 79,
"avg_line_length": 34.08646616541353,
"alnum_prop": 0.6151979706628433,
"repo_name": "msabramo/pip",
"id": "098f9f4830e142f23785a5721a2d78747e933f44",
"size": "9067",
... |
import argparse
import arrow
import cmd
import datetime
import glob
import json
import inspect
import os
import re
import readline
import shlex
import sys
import textwrap
import types
import talus_client.api
import talus_client.errors as errors
import talus_client.utils as utils
from talus_client.utils import Colors
... | {
"content_hash": "3191f7569281079fa77fb6a17bb9960f",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 118,
"avg_line_length": 27.79905437352246,
"alnum_prop": 0.6485245343991836,
"repo_name": "optiv-labs/talus_client",
"id": "1bd7909e99939a8811d983b6c051289a7cbbceff",
"siz... |
import sys
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self): #Runs everytime we make a window object
super(Window, self).__init__()
self.setGeometry(50, 50, 500, 300)
self.setWindowTitle("PyQT tuts!")
self.setWindowIcon(QtGui.QIcon('pythonlogo.png... | {
"content_hash": "5caea73bbc04241dd25f6b687e6471ca",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 104,
"avg_line_length": 31.52747252747253,
"alnum_prop": 0.6106657371906588,
"repo_name": "mbayon/TFG-MachineLearning",
"id": "4be4ffd05385f80e3b19d19b0f9c43941c2e513d",
"... |
class Solution(object):
def canConstruct(self, ransomNote, magazine):
"""
:type ransomNote: str
:type magazine: str
:rtype: bool
"""
letters = {}
for l in magazine:
if letters.has_key(l):
letters[l] = letters[l] + 1
else... | {
"content_hash": "9cf273032319879e905dc8deb0ae053b",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 49,
"avg_line_length": 28.545454545454547,
"alnum_prop": 0.445859872611465,
"repo_name": "lunabox/leetcode",
"id": "7ec07f772930ee664c04f4db99d2c28d73a42af6",
"size": "628"... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VmDateRolledBackEvent(vim, *args, **kwargs):
'''This event records when the VirtualCen... | {
"content_hash": "251bc5cf99529d278144a37ea8a7a6b8",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 124,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.6023789294817332,
"repo_name": "xuru/pyvisdk",
"id": "5530341d44bf43cc25cdbc3b46622144f05ee48e",
"size": "1178",... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('sphinx'))
# -- General config... | {
"content_hash": "69f4ef704e5f35819fe184331cff5e43",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 80,
"avg_line_length": 32.131147540983605,
"alnum_prop": 0.6982142857142857,
"repo_name": "Keno/StrPack.jl",
"id": "d90789698b10e0ab31e196082103829954bc7b3a",
"size": "826... |
from __future__ import unicode_literals
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BlogPost.site'
db.add_column('blog_blogpost', 'site', self.gf('django.db.mod... | {
"content_hash": "dcb4fb8070f5ec9a15e5171a353eac00",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 190,
"avg_line_length": 74.28346456692914,
"alnum_prop": 0.5522577909688361,
"repo_name": "eRestin/MezzGIS",
"id": "7ada431141846ee776b1a77771845832e1beec6a",
"size": "945... |
"""Contains the logic for `aq show personality`."""
from sqlalchemy.orm import joinedload, subqueryload, contains_eager
from sqlalchemy.sql import or_
from aquilon.aqdb.model import (Archetype, Personality, HostEnvironment,
PersonalityGrnMap)
from aquilon.worker.dbwrappers.grn import ... | {
"content_hash": "edeba6b6ad0dae0d77ba029ce878fcce",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 89,
"avg_line_length": 38.907407407407405,
"alnum_prop": 0.603998096144693,
"repo_name": "stdweird/aquilon",
"id": "61affe9d76d7833d861a6e1e6eff44b75f285857",
"size": "2784... |
import tornado
from tornado import gen
from tornado.web import HTTPError
from handler.api.base import BaseHandler
#from data.collections import User
class ProfileHandler(BaseHandler):
def data_received(self, chunk):
pass
@tornado.web.asynchronous
@gen.coroutine
def get(self):
uid = s... | {
"content_hash": "a8962501c49f131df5fff934d73c24ad",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 64,
"avg_line_length": 24.555555555555557,
"alnum_prop": 0.5941176470588235,
"repo_name": "INAP-LABS/noc-orchestrator",
"id": "f6229fee54b44118718f5218ceeb584f98940376",
"s... |
import io
import json
import time
from typing import Dict, List, Union, Any
import dateutil
from .fs import FS
from .stat_result import FileType, StatResult
def _stat_dict_to_stat_result(stat: Dict[str, Any]) -> StatResult:
dt = dateutil.parser.isoparse(stat['modification_time'])
mtime = time.mktime(dt.time... | {
"content_hash": "be7e39ba894b9bbd65a5703b6cdac0de",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 126,
"avg_line_length": 32.44444444444444,
"alnum_prop": 0.6102311643835616,
"repo_name": "hail-is/hail",
"id": "e172a06c07bc2f7c0961aac8534250587e5334d7",
"size": "4672",... |
import os
from uuid import uuid4
import create_dataset_video_sample
import pytest
import helpers
PROJECT_ID = os.getenv("BUILD_SPECIFIC_GCLOUD_PROJECT")
VIDEO_METADATA_SCHEMA_URI = (
"gs://google-cloud-aiplatform/schema/dataset/metadata/video_1.0.0.yaml"
)
@pytest.fixture(scope="function", autouse=True)
def te... | {
"content_hash": "6577f2405d65e093f747376e4ea697b7",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 84,
"avg_line_length": 28.821428571428573,
"alnum_prop": 0.7410161090458488,
"repo_name": "sasha-gitg/python-aiplatform",
"id": "902676b8bbcb1130eef3aad164247c39c4cf2bfa",
... |
"""
from: http://adventofcode.com/2016/day/6
--- Part Two ---
Of course, that would be the message - if you hadn't agreed to use a modified repetition code
instead.
In this modified code, the sender instead transmits what looks like random data, but for each
character, the character they actually want to send is sli... | {
"content_hash": "93c68664a071a651dad8fabd99df761b",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 99,
"avg_line_length": 37.53125,
"alnum_prop": 0.7144046627810158,
"repo_name": "kmcginn/advent-of-code",
"id": "c3c97d0122a8955dfd1ede553be7caaa21804aad",
"size": "1201",
... |
import sys
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure... | {
"content_hash": "5e3ace7bbb628c2104ab7fa79a5ded08",
"timestamp": "",
"source": "github",
"line_count": 612,
"max_line_length": 232,
"avg_line_length": 43.61764705882353,
"alnum_prop": 0.6426537798756274,
"repo_name": "Azure/azure-sdk-for-python",
"id": "e70a0fb14851604c5994f60405afa33e9ff4d6b4",
"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from pants.contrib.node.subsystems.command import command_gen
LOG = logging.getLogger(__name__)
PACKAGE_MANAGER_NPM = 'npm'
PACKAGE_MANAGER_YARNPKG ... | {
"content_hash": "11a6469bfee557808436a6ada7a7947e",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 102,
"avg_line_length": 37.28879310344828,
"alnum_prop": 0.701652988093862,
"repo_name": "UnrememberMe/pants",
"id": "5ed8dad3bd05881b8fb5db56ee7c137edf576bd2",
"size": "8... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .settings import VOLUME_STATES, VOLUME_TYPES, VOLUME_STATE_CREATING, VOLUME_TYPE_VOLUME
class Volume(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(_('Volume name'), null=False, blank=Fals... | {
"content_hash": "0e744431a2b2764b03c30ecc3d11803c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 106,
"avg_line_length": 43.75,
"alnum_prop": 0.6906122448979591,
"repo_name": "lyndonChen/eonboard",
"id": "ca92caea0c2f8ff04ebe2ce82536c3fc8a3ae916",
"size": "1249",
"bi... |
from gluon import *
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
class S3MainMenu(default.S3MainMenu):
"""
Custom Application Main Menu:
The main menu consists of several sub-menus, each of which can
be cust... | {
"content_hash": "8e4e7a46315bab287b9ee3a3f9ccdd71",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 83,
"avg_line_length": 42.815561959654175,
"alnum_prop": 0.39092683583495996,
"repo_name": "gnarula/eden_deployment",
"id": "7a27b3b168440c31d6985e74866bb7f5e41f31ec",
"si... |
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
tests.integration.modules.pw_user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
# Import python libs
from __future__ import absolute_import
import os
import string
import random
# Import Salt Testing libs
from salttesting import skipIf
from salttesting.... | {
"content_hash": "a8f822230de4cbde93b8b4c557857800",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 86,
"avg_line_length": 33.08045977011494,
"alnum_prop": 0.5868658790826963,
"repo_name": "stephane-martin/salt-debian-packaging",
"id": "9fe7e21cc6e08ae43f010a003fa64dd18947e... |
"""SI URL Feeds Class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
import logging
class SIUrlFeeds(APIClassTemplate):
"""The SIUrlFeeds Object in the FMC."""
VALID_JSON_DATA = [
"id",
"name",
"type",
"checksumURL",
"feedURL",
"updateFre... | {
"content_hash": "cf03a27317aecef7fdbccc7aaeb901bc",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 75,
"avg_line_length": 28.145833333333332,
"alnum_prop": 0.5943745373797187,
"repo_name": "daxm/fmcapi",
"id": "b40bd83407a1845a6e9529fcd8b0d4e39fea59bd",
"size": "1351",
... |
def benchmark_hash_data():
"""
CommandLine:
python ~/code/ubelt/dev/bench_hash.py --convert=True --show
python ~/code/ubelt/dev/bench_hash.py --convert=False --show
"""
import ubelt as ub
#ITEM = 'JUST A STRING' * 100
ITEM = [0, 1, 'a', 'b', ['JUST A STRING'] * 4]
HASHERS = [... | {
"content_hash": "3ae7512dcde4ecd2bde052e7839caf3d",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 107,
"avg_line_length": 36.455555555555556,
"alnum_prop": 0.5681194757695824,
"repo_name": "Erotemic/ubelt",
"id": "70d70952e8e41f07bd1e12a989423fc3f3204f55",
"size": "3282... |
import os
import sys
def environ(key, bool=False, required=True):
if key not in os.environ:
if required:
sys.stderr.write(
"Set the environment variable {} correctly. It's required!".format(key)
)
sys.exit(2)
else:
return None
if... | {
"content_hash": "0ea740da054d31d920e35aacf258e303",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 87,
"avg_line_length": 23.705882352941178,
"alnum_prop": 0.5483870967741935,
"repo_name": "watchdogpolska/feder",
"id": "038a48d32c458a5e2e032c5ac73098a57b667edd",
"size": ... |
"""Conversion tool from EDF, EDF+, BDF to FIF
"""
# Authors: Teon Brooks <teon.brooks@gmail.com>
# Martin Billinger <martin.billinger@tugraz.at>
#
# License: BSD (3-clause)
import calendar
import datetime
import os
import re
import numpy as np
from ...utils import verbose, logger, warn
from ..utils import... | {
"content_hash": "319035e025be019379bf417fb15f348f",
"timestamp": "",
"source": "github",
"line_count": 561,
"max_line_length": 79,
"avg_line_length": 41.3048128342246,
"alnum_prop": 0.5529949939582255,
"repo_name": "ARudiuk/mne-python",
"id": "de9635ef548ec0bb3d7fd2242036e8799d11376d",
"size": "23... |
import sys
from distutils.core import setup
name_ = 'algmoid'
version_ = '0.0.2'
if '--help'in sys.argv[1:] or sys.argv[1] in (
'--help-commands', 'egg_info', 'clean', '--version'):
cmdclass_ = {}
ext_modules_ = []
else:
import numpy
from pycodeexport.dist import pce_build_ext, PCEExtension
... | {
"content_hash": "aa4c84f2d1f804db80c06b660cdfdc6d",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 95,
"avg_line_length": 32.32876712328767,
"alnum_prop": 0.5457627118644067,
"repo_name": "bjodah/algmoid",
"id": "1ddac4fdb39164bfce8e470184c588802f0398e0",
"size": "2408",... |
import mock
import mongomock
try:
import pymongo
_HAVE_PYMONGO = True
except ImportError:
_HAVE_PYMONGO = False
from tests.multicollection import MultiCollection
from unittest import TestCase, skipIf
class BulkOperationsTest(TestCase):
test_with_pymongo = False
def setUp(self):
super(... | {
"content_hash": "6413f7e9ee1755cbd27662429c5981ce",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 98,
"avg_line_length": 41.205882352941174,
"alnum_prop": 0.5632711328642807,
"repo_name": "marcinbarczynski/mongomock",
"id": "7ec33f52b12510c7de74522880dbcaa8fb1fd7c0",
"... |
import os
import sys
from setuptools import setup, find_packages
requirements = [
"argparse",
"pip",
]
test_requirements = [
"mock",
"nose",
"six",
"unittest2six",
]
if sys.version_info < (2, 7):
requirements.append("ordereddict")
test_requirements.append("unittest2")
root = os.pat... | {
"content_hash": "0a9f747052b8c9380bd8c1f7aa7b5b3a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 115,
"avg_line_length": 27.557377049180328,
"alnum_prop": 0.6020226055919096,
"repo_name": "steder/pundler",
"id": "728b0ecc0274635311d12935ee69d71d2eaab524",
"size": "1703... |
import re
import sys
import os
import datetime
import json
#處理掉unicode 和 str 在ascii上的問題
reload(sys)
sys.setdefaultencoding('utf8')
#aha's library
from PTT import PTT_DB,PTT
if __name__ =="__main__":
ptt = PTT('https://www.ptt.cc/bbs/Loan/index.html')
db = PTT_DB(os.path.dirname(__file__)+"/mongodb.inf","loan")
... | {
"content_hash": "0591eb5efb29496b60756ab6be4e5f5b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 20,
"alnum_prop": 0.68,
"repo_name": "ntuaha/NewsInsight",
"id": "76442eaa6abce465e001d1000d482393b1b10a9d",
"size": "643",
"binary": false,
"cop... |
from apps.recurring_donations.models import MonthlyDonor
from rest_framework import permissions
class IsOwner(permissions.BasePermission):
""" Read / write permissions are only allowed if the obj.user is the logged in user. """
def has_object_permission(self, request, view, obj):
return obj.user == re... | {
"content_hash": "853de264f79f13887fd815f6e3b846e2",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 92,
"avg_line_length": 32.05714285714286,
"alnum_prop": 0.6265597147950089,
"repo_name": "onepercentclub/onepercentclub-site",
"id": "3d892215e233f1c40996559869ee5a4f9bb10470... |
import os
import re
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
try:
from cms.models import get_plugin_media_path
except ImportError:
def get_plugin_media_path(instance, filename):
"""
See cms.models.pluginmodel.get_plug... | {
"content_hash": "1484501b56f856d2cb6c1a3d3e8dd8d3",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 77,
"avg_line_length": 26.209302325581394,
"alnum_prop": 0.650399290150843,
"repo_name": "divio/djangocms-flash",
"id": "595b31e7ded42714db4e2ac5fab3a25272603c6d",
"size": ... |
"""Provides type checking routines.
This module defines type checking utilities in the forms of dictionaries:
VALUE_CHECKERS: A dictionary of field types and a value validation object.
TYPE_TO_BYTE_SIZE_FN: A dictionary with field types and a size computing
function.
TYPE_TO_SERIALIZE_METHOD: A dictionary with fiel... | {
"content_hash": "0c9eeb01739642acf6df87d59ecffaf5",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 80,
"avg_line_length": 38.9938080495356,
"alnum_prop": 0.7383882493052799,
"repo_name": "ryfeus/lambda-packs",
"id": "f3f6d69fa11754bc7fc83ee5da7b6211a8dd50de",
"size": "1... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.time import Time
'''
Create a text file for FDBinary.
First column will be ln(wavelength).
The following columns will be data from one spectrum each.
This program REMOVES BCVs and GAMMA VELO... | {
"content_hash": "13d7ec9cb6c430a99495e20b0881a865",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 180,
"avg_line_length": 46.86666666666667,
"alnum_prop": 0.6429587482219061,
"repo_name": "mrawls/FDBinary-tools",
"id": "d4698c882ddec8cbd9cffe1b7490713026a446fb",
"size"... |
import sys
import os
import re
import json
class Request(object):
def __init__(self, environ):
self.environ = environ
self.method = environ['REQUEST_METHOD']
self.path = environ['PATH_INFO']
class Response(object):
def __init__(self):
self.status = "200 OK"
sel... | {
"content_hash": "c3f82e8ee55f172e636d26edef8a5dcd",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 79,
"avg_line_length": 29.6113074204947,
"alnum_prop": 0.5107398568019093,
"repo_name": "kwatch/step-by-step",
"id": "a54b4e5013a9b9976f7d27aaa35e228987fd2629",
"size": "8... |
import unittest
import check_orderfile
import symbol_extractor
class TestCheckOrderFile(unittest.TestCase):
_SYMBOL_INFOS = [symbol_extractor.SymbolInfo('first', 0x1, 0, ''),
symbol_extractor.SymbolInfo('second', 0x2, 0, ''),
symbol_extractor.SymbolInfo('notProfiled', 0x4, 0, ... | {
"content_hash": "f060344648a9d53456ea6de0d7ad4073",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 74,
"avg_line_length": 34.15384615384615,
"alnum_prop": 0.6171171171171171,
"repo_name": "chromium/chromium",
"id": "439a7977edbe6ae7e9cada2f80f7eeaec7aa639d",
"size": "105... |
"""Support to interface with the Plex API."""
import logging
from homeassistant.components.media_player.errors import BrowseError
from .const import DOMAIN
EXPANDABLES = ["album", "artist", "playlist", "season", "show"]
PLAYLISTS_BROWSE_PAYLOAD = {
"title": "Playlists",
"media_content_id": "all",
"media_... | {
"content_hash": "bd7bcba9621fd0245576c405bc472aee",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 90,
"avg_line_length": 31.088,
"alnum_prop": 0.6353576942871848,
"repo_name": "titilambert/home-assistant",
"id": "ac316edb938c914bc1d5a43df2a32b2e7c0e1b4c",
"size": "3886... |
from anibots import *
import breve
class AnibotPhysicsSim( breve.PhysicalControl ):
def __init__( self ):
breve.Control.__init__( self )
self.bots = breve.objectList()
self.actionDuration = 45
self.iterCount=0
self.videoLog = breve.Movie()
self.block = None
#configure the anibots
self.env = None
... | {
"content_hash": "96917552a1f8a609c30c7e555dc4934e",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 119,
"avg_line_length": 33.63503649635037,
"alnum_prop": 0.6861979166666666,
"repo_name": "SynapticNulship/Anibots",
"id": "dadfcce92063322d830e2741a1ed43d27dda022b",
"siz... |
import io
import json
import os
import unittest
from . import person
from .fhirdate import FHIRDate
class PersonTests(unittest.TestCase):
def instantiate_from(self, filename):
datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''
with io.open(os.path.join(datadir, filename), 'r', encoding='utf-... | {
"content_hash": "190391af4ecb378e36769180b9345c67",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 97,
"avg_line_length": 45.06172839506173,
"alnum_prop": 0.6531506849315069,
"repo_name": "all-of-us/raw-data-repository",
"id": "c19b18faa7a3d2ff094fdf3688e51b40f4a97475",
... |
import paramiko,socket
# ssh function
def sshConnect(ip, username, password, command):
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.WarningPolicy())
try:
client.connect(ip, username=username, password=password)
stdin, stdout, ... | {
"content_hash": "8b561d8537d63081e07396c831be488b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 64,
"avg_line_length": 29.87878787878788,
"alnum_prop": 0.6511156186612576,
"repo_name": "trjones841/pynet_class",
"id": "37a3558f24639c2e910b6673347ff34d52d55182",
"size":... |
from __future__ import (print_function, division, absolute_import, unicode_literals)
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import viewsets
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorators import detail_route, li... | {
"content_hash": "c92fd69c57048830014cab99a9e12e0e",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 105,
"avg_line_length": 32.3125,
"alnum_prop": 0.75177304964539,
"repo_name": "mrjmad/gnu_linux_mag_drf",
"id": "e74f559d3414ee56acc7c8812da7c7260cda47d2",
"size": "1576",
... |
from cc_server.services.files.__main__ import app, prepare
application = app
prepare()
| {
"content_hash": "1cf8b2c8e8852af2a7444df47a3d5ff6",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 58,
"avg_line_length": 22,
"alnum_prop": 0.75,
"repo_name": "curious-containers/cc-server",
"id": "3a5e2714a4c6a5c6f88b66a806718202d0a0949b",
"size": "88",
"binary": false... |
from django.db import models
import uuid
class UserAccess(models.Model):
ip_addr = models.GenericIPAddressField(max_length=30)
lang_code = models.CharField(max_length=10)
timestamp = models.DateTimeField(auto_now=True)
# accepted value: yes | no | na (not available)
accepted = models.CharField(max... | {
"content_hash": "039590678009d90048744bd221a218cc",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 75,
"avg_line_length": 34.85294117647059,
"alnum_prop": 0.6818565400843882,
"repo_name": "coolkang/cmcweb",
"id": "921bd8d0f6df3ee5a9f3dee379da87de70b416bf",
"size": "1185"... |
import numpy as np
import six
from chainercv.utils.testing.assertions.assert_is_bbox import assert_is_bbox
from chainercv.utils.testing.assertions.assert_is_image import assert_is_image
def assert_is_bbox_dataset(dataset, n_fg_class, n_example=None):
"""Checks if a dataset satisfies the bounding box dataset API.... | {
"content_hash": "1defd2588a2f728a57ecd8c70da5d7f8",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 79,
"avg_line_length": 35.280701754385966,
"alnum_prop": 0.6364992541024366,
"repo_name": "pfnet/chainercv",
"id": "96ac8591ca497df76e9e899a86f2c2af7aa1e04d",
"size": "2011... |
from __future__ import print_function
from abc import ABCMeta, abstractmethod, abstractproperty
import os, shlex, zlib, fnmatch, datetime
from urlparse import urlparse
from castlib3.models.filesystem import File, Folder
# Keeps all the declared backends classes indexed by their schemes
gCastlibBackends = {}
class Ba... | {
"content_hash": "b9fd7f4e1d082f5bcd08a619568d9c9e",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 90,
"avg_line_length": 34.17763157894737,
"alnum_prop": 0.5836381135707411,
"repo_name": "CrankOne/castlib",
"id": "11e1db15172366a41adfc1490b2abb8612e8fe99",
"size": "115... |
import numpy as np
import cv2
import cv2.cv as cv
import frame
import time
class Camera:
# If Camera is initialized with frame_path, Camera will cache a Frame from disk for further reading
# If image cannot be found from the disk, Camera snapshots a new image and caches it
def __init__(self, frame_path = N... | {
"content_hash": "c8ab6f600481c1e01a943cdfb99a1305",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 103,
"avg_line_length": 31.693877551020407,
"alnum_prop": 0.6387636831938184,
"repo_name": "mlensment/rebot",
"id": "4e486900240d55d336809299027b5bac2be389fe",
"size": "155... |
import discord, time
from discord.ext import commands
from Cogs import Utils, PCPP, DisplayName, Message, PickList
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(Hw(bot, settings))
# This is the Uptime module. It keeps track of how long the bot's been up
class... | {
"content_hash": "750303675331de5fa5b2885c0632eea0",
"timestamp": "",
"source": "github",
"line_count": 1096,
"max_line_length": 192,
"avg_line_length": 34.97445255474452,
"alnum_prop": 0.6378743608473338,
"repo_name": "corpnewt/CorpBot.py",
"id": "ee3d00c33e7f389971055303165070d7240f1978",
"size":... |
"""
Welcome to the API documentation for MongoKat.
Please see the [README on GitHub](https://github.com/pricingassistant/mongokat) for more info about MongoKat.
"""
from mongokat._bson import decode_all, _element_to_dict, _get_object, _elements_to_dict
import pymongo
import datetime
# This is the only monkey-patch n... | {
"content_hash": "12f0afe31c6463ab6dfb86d68f227150",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 109,
"avg_line_length": 43.056603773584904,
"alnum_prop": 0.7002629272567923,
"repo_name": "pricingassistant/mongokat",
"id": "9002982d5d85ab7c3912760b5952885937655c4d",
"s... |
import abc
import functools
import re
import six
from oslo_log import log as logging
from trove.common import exception
from trove.common.i18n import _
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class ModuleDriver(object):
"""Base class that defines the contract for module drivers.
... | {
"content_hash": "18250e3f515e73ef8772addc89398c01",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 38.305263157894736,
"alnum_prop": 0.5762572135201979,
"repo_name": "hplustree/trove",
"id": "e758c2a7af3bdb2f210b452d9c0251a5c0d607ad",
"size": "790... |
from google.analytics import admin_v1alpha
async def sample_run_access_report():
# Create a client
client = admin_v1alpha.AnalyticsAdminServiceAsyncClient()
# Initialize request argument(s)
request = admin_v1alpha.RunAccessReportRequest(
)
# Make the request
response = await client.run_a... | {
"content_hash": "97e3885c2b98980f205a780ecf913b1c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.7494824016563147,
"repo_name": "googleapis/python-analytics-admin",
"id": "8400d66e4a6544bf7b0e116b031551d0819d077e... |
from fastapi import FastAPI, Query
app = FastAPI()
@app.get("/items/")
async def read_items(
q: str
| None = Query(
default=None,
title="Query string",
description="Query string for the items to search in the database that have a good match",
min_length=3,
)
):
results... | {
"content_hash": "cb053a8ba8ecf8862af85bebf949594c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 98,
"avg_line_length": 23,
"alnum_prop": 0.5720823798627003,
"repo_name": "tiangolo/fastapi",
"id": "489f631d5e90875a5b9128dffbd7aac973c50317",
"size": "437",
"binary": f... |
'''pyMKL
'''
from distutils.core import setup
from setuptools import find_packages
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Topic :: Scientific/Engineering... | {
"content_hash": "d2cac8b7fb004e393535cbe3e798046f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 72,
"avg_line_length": 31.52,
"alnum_prop": 0.6364213197969543,
"repo_name": "dwfmarchant/pyMKL",
"id": "61b730e76cd354ebd6848b9bc837d6dbf7b887bd",
"size": "1576",
"binar... |
#-------------------------------------------------------------------------
import cross3d
from cross3d import abstractmethod
from collections import MutableSequence
class Collection(MutableSequence):
"""
The Collection object allows to perform operation on several objects at once
allowing to optimi... | {
"content_hash": "1bbbce1f0cd8aad87b97d35e2d5eab7c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 78,
"avg_line_length": 23.766666666666666,
"alnum_prop": 0.6009817671809257,
"repo_name": "blurstudio/cross3d",
"id": "449d30b0a1a2eed85261f399a012a9474b17d94c",
"size": "1... |
from AppKit import NSSegmentedControl, NSSegmentedCell, NSImage, NSSegmentSwitchTrackingSelectOne, NSSegmentSwitchTrackingSelectAny, NSSegmentSwitchTrackingMomentary
from vanilla.vanillaBase import VanillaBaseControl
_trackingModeMap = {
"one": NSSegmentSwitchTrackingSelectOne,
"any": NSSegmentSwitchTracking... | {
"content_hash": "06fe8ea238b099cd5711607334e33c49",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 165,
"avg_line_length": 43.069148936170215,
"alnum_prop": 0.510065456341855,
"repo_name": "typesupply/vanilla",
"id": "f09bbd60230c68d013c591ce16bff45ac64d060b",
"size": "... |
from django.db import models
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import ArrayField
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from picklefield.fields import PickledObjectField
... | {
"content_hash": "715de5917e510da030159b32773b2477",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 110,
"avg_line_length": 48.42028985507246,
"alnum_prop": 0.572732714756061,
"repo_name": "mattcongy/itshop",
"id": "aaf78ad4aaa018a21ae62aabf43df39ed643cf8e",
"size": "761... |
import bitcoin as btc
# https://github.com/klingebj/shamir_bip39_2039
from shamir_bip39_2039.api import shares_to_mnemonic, check_mnemonic_checksum
from shamir_bip39_2039 import seed
import binascii
import hashlib
import argparse
parser = argparse.ArgumentParser(
description='Generate BIP32 addresses from mnemonic... | {
"content_hash": "26a149a9bf787623d6f396e9b63f2926",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 170,
"avg_line_length": 41.35813953488372,
"alnum_prop": 0.6887089518668466,
"repo_name": "klingebj/shamir_bip39_2039",
"id": "08e2ad8b127eef95913f8cd51ffb3062e909100b",
"... |
import json
import random
import requests
from olipy.ia import Text
from botfriend.bot import BasicBot
from botfriend.model import Post
class JunkMailBot(BasicBot):
COLLECTION = "tednelsonjunkmail"
def update_state(self):
cutoff = self.model.last_state_update_time
old_state = self.model.json... | {
"content_hash": "174e0d504fd51c3b8f4bb8edca983838",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 77,
"avg_line_length": 29.829787234042552,
"alnum_prop": 0.6241084165477889,
"repo_name": "leonardr/botfriend",
"id": "d214ac14f1fcb69e7b822f50e48f18e109af3ad0",
"size": "1... |
"""Decorator for view methods to help with data validation."""
from functools import wraps
import logging
import voluptuous as vol
# mypy: allow-untyped-defs
_LOGGER = logging.getLogger(__name__)
class RequestDataValidator:
"""Decorator that will validate the incoming data.
Takes in a voluptuous schema an... | {
"content_hash": "be5afc9672773fa64841c327e6a47851",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 82,
"avg_line_length": 31.0188679245283,
"alnum_prop": 0.5790754257907542,
"repo_name": "Teagan42/home-assistant",
"id": "51b3b5617e49cbeff498eff7e6a66efa93f0e59a",
"size":... |
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
try:
from collections import OrderedDict
except ImportError:
if not '_OrderedDict' in dir():
from odict import OrderedDict
else:
OrderedDict = _OrderedDict
class OrderedConfigParser(ConfigParser.Confi... | {
"content_hash": "11340d160c98e2fcbf9026b6d916aea3",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 75,
"avg_line_length": 30.8,
"alnum_prop": 0.5806277056277056,
"repo_name": "PyUtilib/pyutilib.virtualenv",
"id": "1c71cae8cec21589f8793bd85534b91afa2df88c",
"size": "2281"... |
"""Surfaces, blitting and animation.
"""
####
import pygame
import random
####
def random_rgb():
return random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)
####
class PygView(object):
def __init__(self, width=800, height=600, fps=50):
"""Initializing background surface for st... | {
"content_hash": "8d1bb90b99864db799d53f77a50de7b6",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 90,
"avg_line_length": 24.54326923076923,
"alnum_prop": 0.534769833496572,
"repo_name": "yipyip/Pygame-Examples",
"id": "4e84b83d2a95b30825503a718676c8cabb82a7fb",
"size":... |
"""
testifi.pypi
~~~~~~~~~~~~
This module contains the portions of testifi code that know how to handle
interacting with PyPI.
"""
import treq
import structlog
from twisted.internet.defer import inlineCallbacks, returnValue
logger = structlog.getLogger()
@inlineCallbacks
def certifiVersions():
"""
This fu... | {
"content_hash": "6c4938fd5d126017684a04da3607c0b4",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 27.263157894736842,
"alnum_prop": 0.652992277992278,
"repo_name": "Lukasa/testifi",
"id": "910d15599ccb691c530ea66c29faa6ddd211afe4",
"size": "2096",... |
"""simulation data operations
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from pykern.pkcollections import PKDict
from pykern.pkdebug import pkdc, pkdlog, pkdp
from sirepo.template.lattice import LatticeUtil
from sirepo.template.temp... | {
"content_hash": "eb0b41e6e20d6286c4735a6525d9e828",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 88,
"avg_line_length": 34.64505119453925,
"alnum_prop": 0.5296029947788395,
"repo_name": "radiasoft/sirepo",
"id": "e5d999c8de774c52f63cac8627fc1ee1ceac0bad",
"size": "101... |
import multiprocessing
from multiprocessing.managers import BaseManager
from message import Msg
from evdev import InputDevice, categorize, ecodes, KeyEvent, list_devices
from select import select
import xml.etree.ElementTree as ET
import logging
logger = logging.getLogger(__name__)
class KeyMsg(Msg):
def __init_... | {
"content_hash": "158100370aba789f5f8ea87300a97c6b",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 114,
"avg_line_length": 40.85057471264368,
"alnum_prop": 0.546426561620709,
"repo_name": "Elwetana/rfid_player",
"id": "1ed8cc0784dc1dbb574b8383e66d947fc5090087",
"size": "... |
from __future__ import unicode_literals, absolute_import
from ckeditor.widgets import CKEditorWidget
from django import forms
from djanban.apps.base.auth import get_user_boards
from djanban.apps.multiboards.models import Multiboard
from crequest.middleware import CrequestMiddleware
# Multiboard form
class Multiboar... | {
"content_hash": "c5b6d75a1e8b833c8ae0d0745c2ddcc2",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 120,
"avg_line_length": 36.10769230769231,
"alnum_prop": 0.6429484448231785,
"repo_name": "diegojromerolopez/djanban",
"id": "0a6c4e86bb1e4791c856e6bed3ecbd25845388e6",
"si... |
"""Manage external data directories mounted to a docker container.
"""
from __future__ import print_function
import os
import six
from bcbiovm.docker import remap
def prepare_system(datadir, docker_biodata_dir):
"""Create set of system mountpoints to link into Docker container.
"""
mounts = []
for d ... | {
"content_hash": "9a88c51e9f032f13e4d339205af1ab56",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 110,
"avg_line_length": 41.68376068376068,
"alnum_prop": 0.6065204018864055,
"repo_name": "fw1121/bcbio-nextgen-vm",
"id": "d8623e0eda4b197f8ddbab26d97610558ca4f4dc",
"siz... |
"""
Created on Mon Jul 17 16:17:25 2017
@author: jorgemauricio
"""
"""
De los datos proporcionados por SCHP, se eligen algunas columnas para trabajar la información
y se exploran las relaciones entre los montos registrados por mes, año, mes-año y año-sector.
La intención es responder las siguientes preguntas sen... | {
"content_hash": "608adf68b85d40b4852cf08cfcc69645",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 100,
"avg_line_length": 26.901639344262296,
"alnum_prop": 0.7273004265691652,
"repo_name": "jorgemauricio/INIFAP_Course",
"id": "7b8226720602671e789cbf43046ee7b0b9fe8620",
... |
import os, sys
os.environ["MXNET_KVSTORE_BIGARRAY_BOUND"] = "10"
os.environ["DMLC_NUM_KEYRANGE"] = "12"
os.environ["PS_VAN"] = "zmq"
os.environ["MXNET_MERGE_THRESHOLD"] = "2"
os.environ["MXNET_MERGE_TAU_MILLISECOND"] = "0"
import argparse
import logging
logging.basicConfig(level=logging.DEBUG)
from common impo... | {
"content_hash": "cb15ba22f0b80b455bc251517e944caf",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 143,
"avg_line_length": 37.6,
"alnum_prop": 0.6315280464216635,
"repo_name": "xcgoner/dist-mxnet",
"id": "ecb3ba975e34ca6ec10d762cc509a7f0d46a219b",
"size": "2068",
"bina... |
"""Master-Slave connection to Mongo.
Performs all writes to Master instance and distributes reads among all
slaves. Reads are tried on each slave in turn until the read succeeds
or all slaves failed.
"""
from pymongo import helpers, thread_util
from pymongo import ReadPreference
from pymongo.common import BaseObject
... | {
"content_hash": "761300ae13f65af0f2b4acfe6ea614d4",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 81,
"avg_line_length": 36.447811447811446,
"alnum_prop": 0.5939030023094688,
"repo_name": "edisonlz/fruit",
"id": "dbf00fac8cbf2f7ba7f40fef1ea85aaf2e865a85",
"size": "1140... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.