text stringlengths 4 1.02M | meta dict |
|---|---|
"""Geometric transforms (e.g. rigid transformation)."""
import dataclasses
from typing import Union
import numpy as np
@dataclasses.dataclass
class Isometry:
"""3D transform object used to represent an SE(3) (isometric) transform.
Underneath this class stores the transform [R|t] composed of rotation (R) and
... | {
"content_hash": "5cc07c6ab0ca4aecc0548c531d84c9a8",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 102,
"avg_line_length": 30.36842105263158,
"alnum_prop": 0.654896013864818,
"repo_name": "google-research/sunds",
"id": "a5fa41a921133d285a7ac0eda09ba23ec9ae82c6",
"size":... |
from masseuse.core import massage
from masseuse.cli import argparser
from masseuse.kernels import kernels
import datetime as dt
import re
def makeparser(form):
def parse(astring):
return dt.datetime.strptime(astring, form).date()
return parse
def lintimes(times, lpad=0, rpad=0, step=1):
minday,max... | {
"content_hash": "6d3cf8800dc1013b98b032f36c28e88e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 62,
"avg_line_length": 30.93103448275862,
"alnum_prop": 0.6633221850613155,
"repo_name": "triposorbust/masseuse",
"id": "f98ef4312bcd2fa9fb1c9d971d74aa803db0de2f",
"size": ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.projects.base_project_integration_test import ProjectIntegrationTest
class ExamplesIntegrationTest(ProjectIntegrationTest):
def tests_examples(self... | {
"content_hash": "63ca9fc03d58d6d72519057bdc4901ff",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 108,
"avg_line_length": 49.5,
"alnum_prop": 0.702020202020202,
"repo_name": "gmalmquist/pants",
"id": "db8913867f06de7c24d7e914c6f29f3be03faca8",
"size": "741",
"binary":... |
import numpy as np
from sdafile.character_inserter import (
ArrayInserter, BytesInserter, StringInserter,
)
from sdafile.testing import InserterTestCase
class TestCharacterInserter(InserterTestCase):
def setUp(self):
InserterTestCase.setUp(self)
self.grp_attrs = dict(
RecordType=... | {
"content_hash": "e078c35f8dc730936f6cf639a96f9c14",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 64,
"avg_line_length": 26.424778761061948,
"alnum_prop": 0.5154052243804421,
"repo_name": "enthought/sandia-data-archive",
"id": "04dd713b2f9de1f962aea8c94db031117697760e",
... |
from django import forms
from django.http import HttpResponse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.utils.translation import gettext_lazy
from wagtail.admin import messages
from wagtail.admin.auth import user_passes_test
from wagtail.admin.views.generic... | {
"content_hash": "1c09542e579b37ff7413205a19119953",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 72,
"avg_line_length": 31.566265060240966,
"alnum_prop": 0.7179389312977099,
"repo_name": "zerolab/wagtail",
"id": "cca5129b86d6e7fe4eabdd36dfc2b96022d6e553",
"size": "2620... |
"""
Copyright (c) 2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute... | {
"content_hash": "5d0e91512a98a707abba68dc61d36b61",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 117,
"avg_line_length": 33.02200488997555,
"alnum_prop": 0.5009625351695542,
"repo_name": "alexforencich/hdg2000",
"id": "986201bce01cd657b86d95e81744d1be4f810d17",
"size"... |
"""
Command-line and common processing for Docutils front-end tools.
Exports the following classes:
* `OptionParser`: Standard Docutils command-line processing.
* `Option`: Customized version of `optparse.Option`; validation support.
* `Values`: Runtime settings; objects are simple structs
(``object.attribute``). ... | {
"content_hash": "86b4bcc80c744da5959f1270d533e20d",
"timestamp": "",
"source": "github",
"line_count": 784,
"max_line_length": 80,
"avg_line_length": 43.26020408163265,
"alnum_prop": 0.5713527538624837,
"repo_name": "ddd332/presto",
"id": "83f5fde594647739f22da18ac205dba4666b0b6c",
"size": "34078"... |
"""Foundational utilities common to many sql modules.
"""
import itertools
import operator
import re
from .visitors import ClauseVisitor
from .. import exc
from .. import util
coercions = None # type: types.ModuleType
elements = None # type: types.ModuleType
type_api = None # type: types.ModuleType
PARSE_AUTOC... | {
"content_hash": "71d723683dffa3ea8d979d19d80a0cb9",
"timestamp": "",
"source": "github",
"line_count": 993,
"max_line_length": 79,
"avg_line_length": 33.152064451158104,
"alnum_prop": 0.5808930741190765,
"repo_name": "wujuguang/sqlalchemy",
"id": "da384bdabcb34703efd87c183cfb8fb5fd9603aa",
"size":... |
"""
>>> pingpong = thriftpy.load("pingpong.thrift")
>>>
>>> class Dispatcher(object):
>>> def ping(self):
>>> return "pong"
>>> server = make_server(pingpong.PingPong, Dispatcher())
>>> server.listen(6000)
>>> client = ioloop.IOLoop.current().run_sync(
lambda: make_client(pingpong.PingPong, '127.0.0.1'... | {
"content_hash": "7d43dff99f6b05eb3c59060b6ffc9307",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 93,
"avg_line_length": 36.80888888888889,
"alnum_prop": 0.6108427915962328,
"repo_name": "importcjj/thriftpy",
"id": "2006823ae30b6ece48853c1f2e70f48ee9877c80",
"size": "8... |
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(
default=timezone... | {
"content_hash": "3e647a67bf8ceabb79b193d18ee227ed",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 44,
"avg_line_length": 25.857142857142858,
"alnum_prop": 0.6574585635359116,
"repo_name": "django-girls/best-blog-in-the-world",
"id": "454a89829dcf659184ad6d1c86d40bd8e34fc0... |
import random
import math
import subprocess
import codecs
import numbers
import base64, StringIO
### maybe someday convert to cElementTree output rather than string concatenation
# try:
# import xml.etree.cElementTree as ElementTree
# except ImportError:
# import xml.etree.cElementTree as ElementTree
# Specia... | {
"content_hash": "515832c98bda09ba8689ca2b3e9477eb",
"timestamp": "",
"source": "github",
"line_count": 1246,
"max_line_length": 332,
"avg_line_length": 42.170144462279296,
"alnum_prop": 0.5648599269183922,
"repo_name": "opendatagroup/cassius",
"id": "1fb34f5abd6b6d6fafef0450f71d55a5a05a7387",
"siz... |
"""SOAP client."""
import os.path
from pkg_resources import get_distribution, DistributionNotFound
RINSE_DIR = os.path.dirname(__file__)
ENVELOPE_XSD = 'soap-1.1_envelope.xsd'
NS_SOAPENV = 'http://schemas.xmlsoap.org/soap/envelope/'
NS_MAP = {
'soapenv': NS_SOAPENV,
}
try:
_dist = get_distribution('rinse')... | {
"content_hash": "e7367d68cbd029d0f2bb6fac6153f025",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 74,
"avg_line_length": 25.82608695652174,
"alnum_prop": 0.6750841750841751,
"repo_name": "tysonclugg/rinse",
"id": "748c3198018fee66139d0e8cdab4aaabb4928940",
"size": "594"... |
import sys
import os
import glob
import tempfile
import shutil
import errno
from gerapy import get_logger
from gerapy.cmd.init import PROJECTS_FOLDER
from gerapy.server.core.config import config
from os.path import join
from subprocess import check_call
logger = get_logger(__name__)
def build_project(project):
... | {
"content_hash": "629e90c231e22befcae3173d4cbc9510",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 101,
"avg_line_length": 26.96330275229358,
"alnum_prop": 0.5923783599863899,
"repo_name": "Gerapy/Gerapy",
"id": "986a83a34c5e9480d9b518db304e0e45f773b484",
"size": "2939"... |
from pexdoc.ptypes import real_num, positive_real_num, offset_range, function
from peng.ptypes import real_numpy_vector, increasing_real_numpy_vector
# Intra-package imports
from .basic_source import BasicSource
from .csv_source import CsvSource
from .series import Series
from .panel import Panel
from .figure import F... | {
"content_hash": "fb104ac729f602c15cd3b4aaff58f888",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 84,
"avg_line_length": 30.818181818181817,
"alnum_prop": 0.7654867256637168,
"repo_name": "pmacosta/pplot",
"id": "d24483c15100646920d51aad62839a22ef4e9e3e",
"size": "818",... |
"""
Django settings for {{ project_name }} project.
Generated by 'django-admin startproject' using Django {{ django_version }}.
For more information on this file, see
https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.c... | {
"content_hash": "1c9674ed85100253eacd9125c7c63542",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 86,
"avg_line_length": 26.043478260869566,
"alnum_prop": 0.6822481914301614,
"repo_name": "hamsterbacke23/wagtail",
"id": "c9756393734591525d24d7c9cd641d171825484b",
"size... |
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose
import pytest
from sklearn.ensemble._hist_gradient_boosting.binning import (
_BinMapper,
_find_binning_thresholds,
_map_to_bins,
)
from sklearn.ensemble._hist_gradient_boosting.common import X_DTYPE
from sklearn.ensemble._hist... | {
"content_hash": "ef6ac476738017467bbff731d38b47ca",
"timestamp": "",
"source": "github",
"line_count": 461,
"max_line_length": 86,
"avg_line_length": 33.24945770065076,
"alnum_prop": 0.6143658663883089,
"repo_name": "huzq/scikit-learn",
"id": "7cbc6603ee01f37702ea139bc3ca3dbc401d0f10",
"size": "15... |
"""Statistical metrics for Calibrator routines
"""
import numpy as np
from sklearn.metrics import r2_score
def filter_nan(s, o):
"""
this functions removed the data from simulated and observed data
wherever the observed data contains nan
this is used by all other functions, otherwise they will produ... | {
"content_hash": "21b6d0d03b8cfa8c26f043570b14593c",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 75,
"avg_line_length": 19.35377358490566,
"alnum_prop": 0.5303436509870826,
"repo_name": "biogeochemistry/PorousMediaLab",
"id": "10932ff3509f35456a50b8503dd54fdbe0777bd4",
... |
from test import *
MONGO_HOST = 'localhost'
| {
"content_hash": "0319dbb2b354c0ac3cbeae679d7d559d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 24,
"avg_line_length": 15,
"alnum_prop": 0.7111111111111111,
"repo_name": "raccoongang/socraticqs2",
"id": "3d7ca2efd5a056c4596c4bee1a07be682669af7a",
"size": "61",
"binar... |
from src.base.test_cases import TestCases
class SortCharByFreqTestCases(TestCases):
def __init__(self):
super(SortCharByFreqTestCases, self).__init__()
self.__add_test_case__('Test 1', 'tree', ['eetr', 'eert'])
self.__add_test_case__('Test 2', 'cccaaa', ['cccaaa', 'aaaccc'])
self.... | {
"content_hash": "8e15238db396ed95c2bad5496fae3286",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 39.54545454545455,
"alnum_prop": 0.5770114942528736,
"repo_name": "hychrisli/PyAlgorithms",
"id": "a300c5e6eed2eea909643e47a031632441615955",
"size":... |
from __future__ import print_function
import os
from . import py3k_compat as pickle
import numpy as np
def pickle_results(filename=None, verbose=True):
"""Generator for decorator which allows pickling the results of a funcion
Pickle is python's built-in object serialization. This decorator, when
used o... | {
"content_hash": "8afd6c4a65d0ad2afd33d6ed0c508a2a",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 77,
"avg_line_length": 37.05940594059406,
"alnum_prop": 0.5153620090836227,
"repo_name": "kcavagnolo/astroML",
"id": "7dc0a239a6eeb818130d51aedb2f3ad7c2034908",
"size": "3... |
import collections
from .. import scalartypes as scalars
from .. import ir
def allocateRequiredConstants(pool, long_irs):
# see comments in writebytecode.finishCodeAttrs
# We allocate the constants pretty much greedily. This is far from optimal,
# but it shouldn't be a big deal since this code is almost n... | {
"content_hash": "eeab938778b87f2b586c361f657397f6",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 85,
"avg_line_length": 39.70967741935484,
"alnum_prop": 0.5934199837530463,
"repo_name": "tp7309/AndroidOneKeyDecompiler",
"id": "60f77e73a6cf2d6eace32d6124a394e63d7a0477",
... |
import ctypes
import windows.generated_def as gdef
from ..apiproxy import ApiProxy, NeededParameter
from ..error import fail_on_zero, no_error_check
class User32Proxy(ApiProxy):
APIDLL = "user32"
default_error_check = staticmethod(fail_on_zero)
# Window
@User32Proxy()
def EnumWindows(lpEnumFunc, lParam):
... | {
"content_hash": "a9d87bae10ed15063317c9c845be8aec",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 105,
"avg_line_length": 31.57983193277311,
"alnum_prop": 0.7783395423097392,
"repo_name": "hakril/PythonForWindows",
"id": "98b16bc037d03c527f48a224565465096739ed6e",
"siz... |
"""
core.configs
"""
__author__ = 'Rnd495'
__all__ = ['Configs', 'ConfigsError']
import os
import json
# check "config/now.conf"
# if not exists, create by copying "config/default.conf" to "config/now.conf"
ROOT_PATH = os.path.split(os.path.split(__file__)[0])[0]
CONFIG_PATH_NOW = os.path.join(ROOT_PATH, "config/now... | {
"content_hash": "3ddd8fcd283098c9368306493dc797be",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 97,
"avg_line_length": 32.60526315789474,
"alnum_prop": 0.5585149313962873,
"repo_name": "SakuraSa/TenhouLoggerX",
"id": "fb8d38a9d4279160b1b528e866dd9747833490dc",
"size":... |
import os.path
import sys
import logging
from typing import List
import pygame
from .scenes.loginscene import LoginScene
from .config import config
class Game:
def __init__(self):
self.logger = logging.getLogger(__name__)
pygame.init()
self._clock = pygame.time.Clock()
# TODO: ... | {
"content_hash": "0558f1cde2e644919a73a6264788249d",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 109,
"avg_line_length": 30.81111111111111,
"alnum_prop": 0.5106382978723404,
"repo_name": "XenGi/hacc",
"id": "df0793c7ab21c90dcbab1bf106f2de3783bd54a7",
"size": "2773",
... |
from autobahn.wamp import Api
# create an API object to use the decorator style
# register/subscribe WAMP actions
api = Api()
@api.register(u'com.example.add2')
def add2(a, b):
return a + b
@api.subscribe(u'com.example.on-hello', details=True)
def on_hello(msg, details=None):
print(u'Someone said: {}'.format... | {
"content_hash": "b92be2d79a6d556d6235091f5b2f81ee",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 28.229166666666668,
"alnum_prop": 0.6856088560885609,
"repo_name": "RyanHope/AutobahnPython",
"id": "4ecd24732d4c9ef2d07c84334e0791a4e0354265",
"size... |
import unittest
import time
from app import create_app, db
from app.models import User, Permission, AnonymousUser, Role
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
d... | {
"content_hash": "7039d60b116d8bb67629732b3d378600",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 80,
"avg_line_length": 35.8062015503876,
"alnum_prop": 0.6139857111928989,
"repo_name": "dronly/flask-blog",
"id": "3b5aceec9197106859c3e037a853636b7012f969",
"size": "466... |
from secret import twitter_instance
from json import dump
import sys
tw = twitter_instance()
# [1]
response = tw.users.report_spam(screen_name='showa_yojyo')
# [2]
dump(response, sys.stdout, ensure_ascii=False, indent=4, sort_keys=True)
| {
"content_hash": "e3d02ba6b16d69f8a1e81e55142373c5",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 21.818181818181817,
"alnum_prop": 0.7416666666666667,
"repo_name": "showa-yojyo/notebook",
"id": "997a70e5515af26e8e41186733e2b4b66e834afa",
"size": ... |
import unittest
from quantum.common import utils
from quantum.plugins.nec.common import config
from quantum.plugins.nec.db import api as ndb
from quantum.plugins.nec.db import models as nmodels
from quantum.plugins.nec import ofc_manager
class OFCManagerTest(unittest.TestCase):
"""Class conisting of OFCManager u... | {
"content_hash": "2a055e40f2a78ad8c01921b276468127",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 71,
"avg_line_length": 41.42657342657343,
"alnum_prop": 0.6205266711681297,
"repo_name": "psiwczak/quantum",
"id": "05dde8e52a06a2646edcce4fe91a508ece92c3d8",
"size": "662... |
"""
This is the installation script for Satchmo. It will create the base Satchmo configuration.
Before running this script, you must have python and pip installed.
It is also recommended that you install Python Imaging using your distribution's
package method.
The simplest way to install Satchmo would be:
pip ins... | {
"content_hash": "2ef2d29cdb3362f89a3401336ef46574",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 139,
"avg_line_length": 40.43046357615894,
"alnum_prop": 0.6545454545454545,
"repo_name": "dokterbob/satchmo",
"id": "08a5f7f7e3c6f2bf8f89d09d7d154423724ea9e3",
"size": "6... |
import flask, sqlite3
class Database:
def __init__(self, path):
self.path = path
self._connection = None
def connect(self):
if not self._connection:
self._connection = sqlite3.connect(self.path)
self._connection.row_factory = sqlite3.Row
return self._connection
def close(self):
if self._connectio... | {
"content_hash": "b910f0ca5c5c40bda00e234d059f041b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 48,
"avg_line_length": 22.586206896551722,
"alnum_prop": 0.6824427480916031,
"repo_name": "scizzorz/flaskplate",
"id": "27898d1e8d7104e99d1c96a03b8f35b404f0d9a8",
"size": "... |
"""
第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
"""
import pymysql
__author__ = 'Chris5641'
def code2sql():
f = open('ActivationCode.txt', 'r')
conn = pymysql.connect(user='root', passwd='password')
cursor = conn.cursor()
cursor.execute('create database if not exists accode')
cursor.exe... | {
"content_hash": "e27972ca4dc1bd732974e15d2faa80b6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 94,
"avg_line_length": 27.375,
"alnum_prop": 0.6377473363774734,
"repo_name": "Yrthgze/prueba-sourcetree2",
"id": "4f81226b971b45712a3ea0ba8f60ad144f46c9da",
"size": "741",... |
from setuptools import setup
setup(
name='vrouter',
version='0.1dev',
packages=['vrouter',
'vrouter.vrouter',
'vrouter.vrouter.cpuinfo',
'vrouter.vrouter.process_info',
'vrouter.sandesh',
'vrouter.sandesh.virtual_machine',
... | {
"content_hash": "79d013edeb9373634aad523fbccedea5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 58,
"avg_line_length": 27.071428571428573,
"alnum_prop": 0.5131926121372031,
"repo_name": "cloudwatt/contrail-controller",
"id": "2e18f69982fdbcc50f5a72115bc52e455201064f",
... |
from django.contrib import admin
from blog.models import Post
class PostAdmin(admin.ModelAdmin):
# fields display on change list
list_display = ['title', 'description']
# fields to filter the change list with
list_filter = ['published', 'created']
# fields to search in change... | {
"content_hash": "1d19724f958a0a1dc47d40a84d4cd11d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 62,
"avg_line_length": 37.526315789473685,
"alnum_prop": 0.6367461430575035,
"repo_name": "DanielleWingler/UnderstandingDjango",
"id": "f642fc4b80489d2eb0b15ef84e85d48ce11000... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | {
"content_hash": "725d82b5d0bd5c1324e29580ac08c2be",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 145,
"avg_line_length": 41.916666666666664,
"alnum_prop": 0.557455268389662,
"repo_name": "PXL-CF2016/pxl-master-server",
"id": "3d4d1b0d1b4a54de2bb1f6bcd1d79693f6d64e79",
... |
import os
import unittest
from mock import Mock, create_autospec, patch
from apache.aurora.executor.bin.thermos_executor_main import dump_runner_pex, initialize, proxy_main
from apache.aurora.executor.common.path_detector import MesosPathDetector
from apache.aurora.executor.thermos_task_runner import DefaultThermosTa... | {
"content_hash": "dfa1dc725f65703f1501106f81a10e2d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 100,
"avg_line_length": 40.94736842105263,
"alnum_prop": 0.7377892030848329,
"repo_name": "thinker0/aurora",
"id": "5ad2999d2fbb05bb44fc4801df605b95f8351538",
"size": "2104... |
from __future__ import unicode_literals, division, absolute_import
import collections
from gatesym.gates import Switch
class BinaryIn(collections.Sequence):
def __init__(self, network, size, value=0):
self.switches = [Switch(network) for i in range(size)]
self.write(value)
def write(self, v... | {
"content_hash": "94a84f54b4043cb208a9370ec92bb108",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 66,
"avg_line_length": 22.354166666666668,
"alnum_prop": 0.5340167753960857,
"repo_name": "babbageclunk/gatesym",
"id": "5fd3713bdb5a0dbdbf8fe2439348ff826a8ffa66",
"size": ... |
"""
ZFS Storage Appliance NFS Cinder Volume Driver
"""
import base64
import datetime as dt
import errno
from oslo_config import cfg
from oslo_log import log
from oslo_utils import excutils
from oslo_utils import units
from cinder import exception
from cinder.i18n import _, _LE, _LI
from cinder.volume.drivers import n... | {
"content_hash": "5997075a9a224490209d804f61fc32fe",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 79,
"avg_line_length": 39.5958904109589,
"alnum_prop": 0.5533644698149109,
"repo_name": "yanheven/cinder",
"id": "721f11c0a507fdb6dd7b40a3e1abfd9bf239f857",
"size": "12177... |
from ansible import errors
try:
import netaddr
except Exception, e:
raise errors.AnsibleFilterError('python-netaddr package is not installed')
# ---- IP address and network filters ----
def ipaddr(value, query = '', version = False, alias = 'ipaddr'):
''' Check if string is an IP address or network and ... | {
"content_hash": "d393b135f1a0d8e95f1c09e577de6819",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 92,
"avg_line_length": 27.381322957198442,
"alnum_prop": 0.48642887594145234,
"repo_name": "le9i0nx/ansible-home",
"id": "68e2fd778c4ce41d652ae2a9e435a8be455066b5",
"size"... |
'''
This script helps you scrap stock data avaliable on Bloomberg Finance
and store them locally.
Please obey applicable local and federal laws and applicable API term of use
when using this scripts. I, the creater of this script, will not be responsible
for any legal issues resulting from the use of this script.
@au... | {
"content_hash": "89f216fe9ed594268a09ac220bede5d6",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 95,
"avg_line_length": 29.31081081081081,
"alnum_prop": 0.5956662056247118,
"repo_name": "Michael-Tu/tools",
"id": "6740dbc5cd1d471f34b6ff0a348f444320239e03",
"size": "2169... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "1296feb3287688ce9caf616ef34d6ec7",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 253,
"avg_line_length": 28.103529411764708,
"alnum_prop": 0.6940723375753517,
"repo_name": "benfinke/ns_python",
"id": "5298bb68dbbfebd46a1ba6d935526e5e6679cac9",
"size": ... |
import numpy as np
import base64
import json
from galry import CompoundVisual
__all__ = ['SceneCreator',
'encode_data', 'decode_data', 'serialize', 'deserialize', ]
# Scene creator
# -------------
class SceneCreator(object):
"""Construct a scene with `add_*` methods."""
def __init__(self, constra... | {
"content_hash": "72951eac31101ccabc20af52f0e33708",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 94,
"avg_line_length": 39.307291666666664,
"alnum_prop": 0.5877832251225653,
"repo_name": "rossant/galry",
"id": "859b4ec505bdc0cd2753f69bcb57fc77a17da20e",
"size": "7547"... |
from flask import current_app as app
from flask.ext.zodb import Object, List, Dict, ZODB
from hashlib import sha256
class User():
def __init__(self, username, password, userid):
self.username = username
self.passwordHash = sha256(password).hexdigest()
self.id = userid
self.offset = 0
self.restid_to_good_co... | {
"content_hash": "afcf5d8e996ead5572c9e451aebf6a11",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 110,
"avg_line_length": 21.682692307692307,
"alnum_prop": 0.6651884700665188,
"repo_name": "skxu/Vittles",
"id": "8da3c134305bf412f40116ca2c82571e041b3b05",
"size": "2255"... |
"""Ros node for playing audio chirps and recording the returns along
with data from a depth camera.
This requires that the depth camera and sound_play nodes have been
started (in separate terminals.):
source ./ros_config_account.sh
roslaunch openni2_launch openni2.launch
roslaunch sound_play soundplay_node.launch
"... | {
"content_hash": "f81d808e38d5d7619857d7d7c89c46fd",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 92,
"avg_line_length": 27.67032967032967,
"alnum_prop": 0.6449563145353455,
"repo_name": "spragunr/echolocation",
"id": "7e2cf477d906637df8e77bf9f40a3d475e45bd8d",
"size": ... |
"""
Featurizes proposed binding pockets.
"""
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2017, Stanford University"
__license__ = "MIT"
import numpy as np
from deepchem.utils.save import log
from deepchem.feat import Featurizer
... | {
"content_hash": "8dbb5992ef42a4ed04a77372550ea921",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 31.607142857142858,
"alnum_prop": 0.6175141242937853,
"repo_name": "Agent007/deepchem",
"id": "bf26d0e76a73f84a5208746d56818c147ce2df34",
"size": "17... |
"""Internal class for proxy query execution context implementation in the Azure
Cosmos database service.
"""
import json
from six.moves import xrange
from azure.cosmos.exceptions import CosmosHttpResponseError
from azure.cosmos._execution_context import multi_execution_aggregator
from azure.cosmos._execution_context.b... | {
"content_hash": "54eadf049f49520643469dff60e71e0f",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 120,
"avg_line_length": 42.80213903743316,
"alnum_prop": 0.627936031984008,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c731d3535549dd2587b5b57f82160d3b03329332",
"s... |
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterModelManagers(
... | {
"content_hash": "cbc33e412d9ddd9e181d4590efe49277",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 317,
"avg_line_length": 41.32786885245902,
"alnum_prop": 0.5894486314954384,
"repo_name": "jkbrzt/cointrol",
"id": "6025ee90b9180325f5ec7e57f17b48206e68870f",
"size": "2594... |
"""Utility to handle vocabularies."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import codecs
import os
import tensorflow as tf
from tensorflow.python.ops import lookup_ops
from third_party.nmt.utils import misc_utils as utils
UNK = "<unk>"
SOS = "... | {
"content_hash": "d3960ef5bdfc9f8dd6aa42dc4839cf2d",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 80,
"avg_line_length": 32.30434782608695,
"alnum_prop": 0.5955585464333782,
"repo_name": "google/active-qa",
"id": "d07031177fb52608ea78716207329b755e989358",
"size": "511... |
from cupy.cuda import runtime
class Event(object):
"""CUDA event, a synchronization point of CUDA streams.
This class handles the CUDA event handle in RAII way, i.e., when an Event
instance is destroyed by the GC, its handle is also destroyed.
Args:
block (bool): If True, the event blocks o... | {
"content_hash": "3c7685a7707e62def92dcc70bb27dc94",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 79,
"avg_line_length": 30.395061728395063,
"alnum_prop": 0.6078391551584078,
"repo_name": "t-abe/chainer",
"id": "6cead5420867eaac27bd0dea3d3c314861d9160a",
"size": "4924"... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('Hindlebook', 'node_data'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='... | {
"content_hash": "cde46ca5cf3c03875eeb6d4f5e728cb0",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 120,
"avg_line_length": 29.23076923076923,
"alnum_prop": 0.6157894736842106,
"repo_name": "Roshack/cmput410-project",
"id": "ba800ae06c020b734d989f31ba3a1249a4af4fbb",
"siz... |
from django.contrib import admin
# import your models
# Register your models here.
# admin.site.register(YourModel) | {
"content_hash": "243b77622a46b2224ab38a58a474c6f4",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 23.2,
"alnum_prop": 0.7931034482758621,
"repo_name": "datamade/la-metro-councilmatic",
"id": "6767362fddda0f6e69e7d295dd02e55295b2c9d0",
"size": "116"... |
"""
This code sample demonstrates how to write records in pending mode
using the low-level generated client for Python.
"""
from google.cloud import bigquery_storage_v1
from google.cloud.bigquery_storage_v1 import types
from google.cloud.bigquery_storage_v1 import writer
from google.protobuf import descriptor_pb2
# I... | {
"content_hash": "370b150bee32f12aa89b9356581759e2",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 149,
"avg_line_length": 41.705882352941174,
"alnum_prop": 0.7386661293572436,
"repo_name": "googleapis/python-bigquery-storage",
"id": "af780ffa5b92dcce761f75b04540585e6a19f... |
from v2ex import v2ex
| {
"content_hash": "11ab3de796c244be1d2144c7d4304abc",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.8181818181818182,
"repo_name": "littson/bee",
"id": "37e9c071cf224d1dbf663ddfb7618eff078fa4d8",
"size": "22",
"binary": false,
... |
from celery.utils.log import get_task_logger
import datetime
from redash.worker import celery
from redash import utils
from redash import models, settings
from .base import BaseTask
logger = get_task_logger(__name__)
def base_url(org):
if settings.MULTI_ORG:
return "https://{}/{}".format(settings.HOST, ... | {
"content_hash": "d9a99bd64bdb930e56146b8ba6e5b270",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 119,
"avg_line_length": 38.869565217391305,
"alnum_prop": 0.6521252796420581,
"repo_name": "guaguadev/redash",
"id": "97b84a63e25b2f78f634ee31c46a92e1934ecd59",
"size": "17... |
import os
import yaml
from extended_uva_judge import errors
def get_problem_directory(app_config):
"""Gets the directory containing the problem configs.
:return: The path to the problem configs.
:rtype: str
"""
problem_directory = app_config['problem_directory']
if not problem_directory:
... | {
"content_hash": "7fa451574e9dcc35fc3a8bd88405d54e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 75,
"avg_line_length": 29.862745098039216,
"alnum_prop": 0.6999343401181878,
"repo_name": "fritogotlayed/Extended-UVA-Judge",
"id": "899e62389d7e3e73d0a9cac9e6a927bac137f515"... |
"""Functions for FIR filter design."""
from __future__ import division, print_function, absolute_import
from math import ceil, log
import numpy as np
from numpy.fft import irfft
from scipy.special import sinc
from . import sigtools
__all__ = ['kaiser_beta', 'kaiser_atten', 'kaiserord',
'firwin', 'firwin2',... | {
"content_hash": "613bd463ad83ebea3b86bbb557b01c9e",
"timestamp": "",
"source": "github",
"line_count": 582,
"max_line_length": 94,
"avg_line_length": 34.52061855670103,
"alnum_prop": 0.6168931362301528,
"repo_name": "kmspriyatham/symath",
"id": "fd7c2e59c4b725138e868e603ca272a47cd4767b",
"size": "... |
import BaseHTTPServer
import os.path
from mimetypes import MimeTypes
from urlparse import urlparse
mime = MimeTypes()
class Handler( BaseHTTPServer.BaseHTTPRequestHandler ):
def do_GET( self ):
path = urlparse('client' + self.path).path
if not os.path.isfile(path):
path = 'client/index... | {
"content_hash": "fbc1b59d7e3401fa0606bda8ab179c9f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 68,
"avg_line_length": 31.05263157894737,
"alnum_prop": 0.6677966101694915,
"repo_name": "demerzel3/desmond",
"id": "04726a237e75e55e556c651821b231b33246b6a3",
"size": "613... |
import sys
class ToleoException(Exception):
'''
Base exception class.
'''
def __init__(self, message, error=None):
super().__init__(message)
self.message = message
self.error = error or 'ToleoException'
def quit(self):
sys.exit('{}: {}'.format(self.error, self.mess... | {
"content_hash": "c8b45506f172b055b02cda6047011881",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 23.285714285714285,
"alnum_prop": 0.5828220858895705,
"repo_name": "carlwgeorge/toleo-old",
"id": "c6b251cc4b869058bf58fb518c5572d953d57f5b",
"size":... |
import unittest
import os
import subprocess
import hgapi
# vcs, , represent version controlled directories, internal
from yotta.lib import vcs
# fsutils, , misc filesystem utils, internal
from yotta.lib import fsutils
Test_Repo_git = "git@github.com:autopulated/testing-dummy.git"
Test_Repo_hg = "ssh://hg@bitbucket.... | {
"content_hash": "32559f956820c74e22bfd0fa141d3098",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 95,
"avg_line_length": 37.09782608695652,
"alnum_prop": 0.6343392909463815,
"repo_name": "BlackstoneEngineering/yotta",
"id": "b1e4103ee9eeb9b3128e46e18f65fcfb3ce9fe0e",
"s... |
from django.views.generic import TemplateView
class LandingPageView(TemplateView):
template_name = 'tt_disposal_wells/landing.html'
| {
"content_hash": "a4c412c37a9d16e54ed988d368591ce7",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 52,
"avg_line_length": 27.6,
"alnum_prop": 0.7971014492753623,
"repo_name": "texastribune/tt_disposal_wells",
"id": "cb2a594a26d36decf9ca4b8911bb4c460452c399",
"size": "138"... |
import pandas as pd
from sklearn import model_selection
from sklearn.ensemble import GradientBoostingClassifier
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data"
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
df = pd.re... | {
"content_hash": "e6a0d60036931babef05f81abd8e5b0a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 32.13636363636363,
"alnum_prop": 0.7256011315417256,
"repo_name": "sindresf/The-Playground",
"id": "77888f51e949298f0f8a1a69a71b3a090a45ff95",
"size... |
import sys, re
import math
import fileinput
from subprocess import *
from nlputil import *
import itertools
import time
import os.path
import traceback
############################################################################
# Quick Start #
#############... | {
"content_hash": "24e8b80c73dbe2c504eb48e46f391445",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 126,
"avg_line_length": 44.96491228070175,
"alnum_prop": 0.5562817011314866,
"repo_name": "utcompling/fieldspring",
"id": "3d20a77051781493a4e3569a2d271821aa41f4c3",
"size... |
import sys
import os
import urllib.parse
import requests
from deconstrst.builder import DeconstJSONBuilder
from sphinx.application import Sphinx
from sphinx.builders import BUILTIN_BUILDERS
def build(srcdir, destdir):
"""
Invoke Sphinx with locked arguments to generate JSON content.
"""
# I am a ter... | {
"content_hash": "9c6e241ad243d1403e70b4cb5ff102af",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 79,
"avg_line_length": 30.906666666666666,
"alnum_prop": 0.5763589301121657,
"repo_name": "ktbartholomew/preparer-sphinx",
"id": "8f5c5e37946dea3e89a3d599681295ad2175cf48",
... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from feincms_simplegallery.util.mixins import OrderableMixin
try:
from feincms.admin.item_editor import FeinCMSInline
ex... | {
"content_hash": "68ea60a9c51772158e661525ccedbed1",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 69,
"avg_line_length": 28.305732484076433,
"alnum_prop": 0.5562556255625563,
"repo_name": "paramono/feincms_simplegallery",
"id": "247820a60c88b56208515dbbc8c5f965b9f3962a",... |
from __future__ import unicode_literals
import re
from collections import namedtuple
from six import string_types
from prompt_toolkit.document import Document
from prompt_toolkit.filters import to_filter
from .base import Completer, Completion
from .word_completer import WordCompleter
__all__ = [
'FuzzyComplete... | {
"content_hash": "e679741a6612d58467c73e6d1fc51ba5",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 90,
"avg_line_length": 36.87134502923977,
"alnum_prop": 0.6413957176843775,
"repo_name": "lmregus/Portfolio",
"id": "83e602495a3ca41e62808b1b04390d59bdc5aa99",
"size": "63... |
"""generated automatically by auto_dao.py"""
class DBChangeParameter(object):
vtType = 'changeParameter'
def __init__(self, moduleId=None, alias=None, functionId=None, function=None, parameterId=None, parameter=None, type=None, value=None):
self.__db_moduleId = moduleId
self.__db_alias = alia... | {
"content_hash": "0cde2962949e864950b0475889e6869f",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 149,
"avg_line_length": 33.72294887039239,
"alnum_prop": 0.6011071541906139,
"repo_name": "CMUSV-VisTrails/WorkflowRecommendation",
"id": "ccc0198c70be9785335dd0c00a4860486a... |
"""
This file contains the class definition for the sampler MCMCSample classes.
"""
__author__ = 'Brandon C. Kelly'
import numpy as np
from matplotlib import pyplot as plt
import scipy.stats
import acor
class MCMCSample(object):
"""
Class for parameter samples generated by a yamcmc++ sampler. This class con... | {
"content_hash": "980848820bd3a467977f2cca42438c73",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 120,
"avg_line_length": 44.97794117647059,
"alnum_prop": 0.597896572393875,
"repo_name": "brandonckelly/carma_pack",
"id": "057afae722b9581e6d0186bfd2cd44395214b0dc",
"siz... |
class SummitRestException(Exception):
def __init__(self, status, uri, msg='', code=None, method='GET'):
self.status = status
self.uri = uri
self.msg = msg
self.code = code
self.method = method
def __str__(self):
return 'HTTP {0} error: {1}'.format(self.status, s... | {
"content_hash": "e7cbe45a7e1fc351c6146982fbf22303",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 69,
"avg_line_length": 29.90909090909091,
"alnum_prop": 0.5683890577507599,
"repo_name": "josephl/summit-python",
"id": "92c15cf29eb54910fd21395b740f579d8f893dfd",
"size": ... |
"""Classes and functions implementing Layer SavedModel serialization."""
from tensorflow.python.keras.mixed_precision import policy
from tensorflow.python.keras.saving.saved_model import base_serialization
from tensorflow.python.keras.saving.saved_model import constants
from tensorflow.python.keras.saving.saved_model ... | {
"content_hash": "6fc1d63aab83bb24a211c067184dada7",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 104,
"avg_line_length": 41.08695652173913,
"alnum_prop": 0.7298563869992442,
"repo_name": "karllessard/tensorflow",
"id": "9e6f2c55615d63ec59ecc06131eb9ad09facbf7e",
"size... |
"""
The MatchMaker classes should except a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""
import itertools
import json
from oslo.config import cfg
from logcollector.openstack.common.gettextutils import _
from logcollector.openstack.common import log as logging... | {
"content_hash": "073df7721456cf7f3046ddb14424c604",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 76,
"avg_line_length": 31.597826086956523,
"alnum_prop": 0.60921912624699,
"repo_name": "redhat-cip/openstack-logcollector",
"id": "1f6e3331b1e1075b0972fcc7ca5203623b10bea2",... |
"""AppAssure 5 Core API"""
from appassure.api import AppAssureAPI
class IDiagnosticsManagement(AppAssureAPI):
"""Full documentation online at
http://docs.appassure.com/display/AA50D/IDiagnosticsManagement
"""
def executeRemoteCommand(self, data):
"""Executes an arbitrary remote command."""
... | {
"content_hash": "df7ac67bf0372657978ceb7f9a218182",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 66,
"avg_line_length": 33.86046511627907,
"alnum_prop": 0.6263736263736264,
"repo_name": "rshipp/python-appassure",
"id": "99b0864422153782a337b28d0176aad80ef9d292",
"size"... |
from datetime import datetime, timedelta
from rdr_service.dao.ghost_check_dao import GhostCheckDao
from tests.helpers.unittest_base import BaseTestCase
class GhostCheckDaoTest(BaseTestCase):
def test_loads_only_vibrent(self):
"""We might accidentally start flagging CE participants as ghosts if they're re... | {
"content_hash": "97a5f8374d42f43ffa4095ae4599a714",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 106,
"avg_line_length": 44.52272727272727,
"alnum_prop": 0.6865747830525778,
"repo_name": "all-of-us/raw-data-repository",
"id": "a8f25d5bc9708496e9e835a2692e8fdbbd25b4c6",
... |
from google.cloud import assuredworkloads_v1
def sample_acknowledge_violation():
# Create a client
client = assuredworkloads_v1.AssuredWorkloadsServiceClient()
# Initialize request argument(s)
request = assuredworkloads_v1.AcknowledgeViolationRequest(
name="name_value",
comment="comme... | {
"content_hash": "f15080288ea64216eb36fdf1eca8c7dd",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 87,
"avg_line_length": 27.9,
"alnum_prop": 0.7401433691756273,
"repo_name": "googleapis/python-assured-workloads",
"id": "4c772f772f8e7a633ffd1d735a7f667c4300a518",
"size":... |
import unittest
from programy.dialog import Sentence, Question, Conversation
from programy.bot import Bot
from programy.brain import Brain
from programy.config.brain import BrainConfiguration
from programy.config.bot import BotConfiguration
#############################################################################... | {
"content_hash": "616f257538901f09f8809fe632c7f1f8",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 78,
"avg_line_length": 41.58139534883721,
"alnum_prop": 0.6533557046979865,
"repo_name": "JustArchi/program-y",
"id": "4cc48e9626c1fd2a54f7674b91cc13a5be8a8a20",
"size": "... |
import warnings
import asyncio
import collections
import logging
from datetime import datetime, timedelta
from asyncio import ensure_future
from .protocol import STATE_NEW, STATE_OPEN, STATE_CLOSING, STATE_CLOSED
from .protocol import FRAME_OPEN, FRAME_CLOSE
from .protocol import FRAME_MESSAGE, FRAME_MESSAGE_BLOB, FR... | {
"content_hash": "4626db0616ae31c61940b2eaffae3ed1",
"timestamp": "",
"source": "github",
"line_count": 411,
"max_line_length": 81,
"avg_line_length": 28.99270072992701,
"alnum_prop": 0.5451493789862369,
"repo_name": "aio-libs/sockjs",
"id": "7c8c425e68c60cb566e95dadb94fe82e29b1525d",
"size": "1191... |
from colossus.game.route import Route
from colossus.game.core import Core
from colossus.game.ice import Ice
from colossus.game.entity import Node, Packet | {
"content_hash": "902119e6ab4d393b29bdfed8d802762e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 38.25,
"alnum_prop": 0.8366013071895425,
"repo_name": "spectralflux/colossus",
"id": "fa53fd8917aede2477931db6f3eecb8efdf295de",
"size": "153",
"bin... |
from freebase.schema import dump_base, dump_type, restore
try:
import jsonlib2 as json
except ImportError:
try:
import simplejson as json
except ImportError:
import json
import sys
def cmd_dump_base(fb, baseid):
"""dump a base to stdout
%prog dump_base baseid
Dump a base by o... | {
"content_hash": "aae42d0cfe8a960979ed00c33d405594",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 86,
"avg_line_length": 27.341463414634145,
"alnum_prop": 0.6815343443354148,
"repo_name": "yuvadm/freebase-python",
"id": "b5a30da071d0166dcf4a25957be6270741376589",
"size"... |
from typing import Any, Dict, List, Optional
import numpy as np
from paralleldomain.decoding.common import DecoderSettings
from paralleldomain.decoding.directory.sensor_frame_decoder import DirectoryCameraSensorFrameDecoder
from paralleldomain.decoding.frame_decoder import FrameDecoder, TDateTime
from paralleldomain.... | {
"content_hash": "775dca633ab8a8940a5a3a450d3f199f",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 105,
"avg_line_length": 44.23711340206186,
"alnum_prop": 0.7093917501747844,
"repo_name": "parallel-domain/pd-sdk",
"id": "2b95c8c26e0083eed4b7c62887532f56e8416658",
"size"... |
"""
debug.py
"""
import re
import time
import sys
import types
import gc
import os
from cStringIO import StringIO
normalize_re = re.compile(r'\d+')
class ObjCallLogger(object):
"""Log every call"""
def __init__(self, obj):
self.obj = obj
self.log = []
def __getattr__(self, name):
... | {
"content_hash": "d9f0fefef1e8cf67660fa06780a01bd5",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 76,
"avg_line_length": 26,
"alnum_prop": 0.532520325203252,
"repo_name": "douban/douban-utils",
"id": "2912d5aa3631053aeb7ab4677557224702cae8e2",
"size": "3238",
"binary... |
"""
this is the code to accompany the Lesson 3 (decision tree) mini-project
use an DT to identify emails from the Enron corpus by their authors
Sara has label 0
Chris has label 1
"""
import sys
import os
from time import time
#sys.path.append("../tools/")
os.chdir("C:/Vindico/Projects/Code/... | {
"content_hash": "61b6fecc330eea5a150858560a71aea3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 120,
"avg_line_length": 28.622222222222224,
"alnum_prop": 0.6669254658385093,
"repo_name": "tuanvu216/udacity-course",
"id": "3faa9521c6de3f27aa27b699e3dafa11c5435b17",
"si... |
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 'TeamResult.start_time'
db.add_column('scorebrd_teamresult', 'start_time',
self.gf('django.db.m... | {
"content_hash": "8d9a9f9f7375347bcdfcf2637d0d4fc1",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 182,
"avg_line_length": 65.51282051282051,
"alnum_prop": 0.549119373776908,
"repo_name": "xlcteam/scoreBoard",
"id": "baab0908a88db40d6443cecade497ac3e6e19375",
"size": "7... |
from settings import *
import nltk
import sys
import textract
import re
import unicodedata
class Opinion:
def __init__(self, name):
self.name = name
self.total = 0
self.fore = 0
self.against = 0
self.no_opinions = 0
self.ratio_for = 0
self.ratio_against = 0
... | {
"content_hash": "2bc895d27ac2bbbb55415b81fa307d51",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 101,
"avg_line_length": 36.67768595041322,
"alnum_prop": 0.5297431275349257,
"repo_name": "zozoh94/PolReview",
"id": "d1628a32c8b27cd5bb9ecb8b89278be3e0f48bfc",
"size": "4... |
'''
Split methylation BigQuery table into chromosomes
'''
import pprint
import sys
import json
from apiclient.errors import HttpError
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
from oauth2client.client import AccessTokenRefreshError
import time
from bigquery_etl.utils.... | {
"content_hash": "846d5549d9044fd51f369b6a90e0babe",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 160,
"avg_line_length": 43.5,
"alnum_prop": 0.6028097062579821,
"repo_name": "isb-cgc/ISB-CGC-data-proc",
"id": "572f84f7c51c084109df6cea781029ea1fcc9847",
"size": "5310",... |
'''Test percolator.py.'''
from test.support import requires
requires('gui')
import unittest
from tkinter import Text, Tk, END
from idlelib.percolator import Percolator, Delegator
class MyFilter(Delegator):
def __init__(self):
Delegator.__init__(self, None)
def insert(self, *args):
self.inser... | {
"content_hash": "18644620a382a9c90a96e09ebf83e0dc",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 74,
"avg_line_length": 34.38135593220339,
"alnum_prop": 0.634458959822529,
"repo_name": "Microsoft/PTVS",
"id": "573b9a1e8e69e3905122b905c4f30ee3958b17d7",
"size": "4057",... |
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('livelayermanager', '0009_auto_20170602_1459'),
]
operations = [
migrations.AlterField(
model_nam... | {
"content_hash": "fd05949bc2edf45e27e0fe63a81c2868",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 311,
"avg_line_length": 34.6,
"alnum_prop": 0.6734104046242775,
"repo_name": "rockychen-dpaw/borgcollector",
"id": "9b790ac6cd18f8edcbf931cbddce23b37ec13c15",
"size": "764"... |
import tensorflow as tf
with tf.name_scope('policy') as scope:
# tf Graph Input
features = 4
objects = 8
layers = 3
x = tf.placeholder(tf.float32, [None, 8, 8, features], name='input')
y = tf.placeholder(tf.float32, [None, 8, 8, 1], name='expected')
# Set model weights
#first pass fi... | {
"content_hash": "bb61f38e013a549471c95015e0040f6c",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 101,
"avg_line_length": 35.59349593495935,
"alnum_prop": 0.5600730927364094,
"repo_name": "Tenebryo/coin",
"id": "6a10ed6975deea4245c15d71f79e160fcfcbd483",
"size": "4378"... |
import config, webui, BaseHTTPServer, urllib, sys, getopt, os
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
config = config.Config("config.ini")
ssh_user = None
def set_content_type(self, content_type):
self.send_header('Content-Type', content_type)
def run(self):
if se... | {
"content_hash": "ca815a13f12b1b9f744d0d95ff130bd0",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 73,
"avg_line_length": 35.46875,
"alnum_prop": 0.5378854625550661,
"repo_name": "techtonik/pydotorg.pypi",
"id": "94f7d319cd7cc8be30ebeffc5a462a4503d6c845",
"size": "4558"... |
"""
ABP analyzer and graphics tests
"""
cases = [
('Run Pymodel Graphics to generate dot file from FSM model, no need use pma',
'pmg.py ABP'),
('Generate SVG file from dot',
'dotsvg ABP'),
# Now display ABP.dot in browser
('Run PyModel Analyzer to generate FSM from original FSM, should be ... | {
"content_hash": "72d9f98e3cfab3d9c294da53322e3d50",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 82,
"avg_line_length": 25.541666666666668,
"alnum_prop": 0.6541598694942904,
"repo_name": "nfredrik/pyModelStuff",
"id": "3582ef463bc23bae59174a0b2b8c276b24a2439a",
"size":... |
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from go... | {
"content_hash": "6adced89cff4ebdd58047804f43dd72d",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 560,
"avg_line_length": 32.5678391959799,
"alnum_prop": 0.6340070976701127,
"repo_name": "dhermes/gcloud-python",
"id": "5208450f5deae1866048e7a1d79c26b08b20accd",
"size":... |
import abc
class BaseWSGIContainer(object):
__metaclass__ = abc.ABCMeta
DESCRIPTION = abc.abstractproperty
@abc.abstractproperty
def name(self):
pass
@abc.abstractmethod
def send_request(self):
"""Should be implemented by subclasses""" | {
"content_hash": "5c0cbbe31975a44e872b9dfb2336e904",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 43,
"avg_line_length": 18.714285714285715,
"alnum_prop": 0.7099236641221374,
"repo_name": "rishimishra/flask_tornado",
"id": "eb6a4d85ef8f71f07f227552415ea2786881ad47",
"si... |
"""Pyxie's image packing implementation. Based on greedy algorithm described
in this stack overflow question:
http://stackoverflow.com/questions/1213394/algorithm-needed-for-packing-\
rectangles-in-a-fairly-optimal-way
Start with the largest rectangle. Add the next largest rectangle to the place
that extends th... | {
"content_hash": "4105058f1a10d9861dd8dfa55e424bba",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 107,
"avg_line_length": 44.35755813953488,
"alnum_prop": 0.5907333377023396,
"repo_name": "shopwiki/pyxie",
"id": "a1ccdffe622c98ed756b7e597b1d956bef018fdd",
"size": "1530... |
"""Wraps the body of a converted function with auxiliary constructs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gast
from tensorflow.python.autograph.core import converter
from tensorflow.python.autograph.pyct import anno
from tensorflow.pyt... | {
"content_hash": "8e92cc87db138a3ff5265ef6557f4b2e",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 78,
"avg_line_length": 35.21186440677966,
"alnum_prop": 0.6813477737665463,
"repo_name": "renyi533/tensorflow",
"id": "100a14e44949aa9df614e7dd7dce9fe85b98ec1e",
"size": "... |
"""This code example creates new activity groups.
To determine which activity groups exist, run get_all_activity_groups.py.
Tags: ActivityGroupService.createActivityGroups
"""
__author__ = 'Vincent Tsao'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are n... | {
"content_hash": "f191971e2df9621e829b5a577acca543",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 80,
"avg_line_length": 34.12280701754386,
"alnum_prop": 0.6730077120822622,
"repo_name": "lociii/googleads-python-lib",
"id": "24f94f32f4a6b31f9ed38162147d9fe85b3ecc9d",
"s... |
from .download import *
from .login import login_session as login
from .config import load_config as config
def sort_teacher(teacher_list: list) -> str:
teacher_name = []
for i in teacher_list:
teacher_name.append(i.string)
if len(teacher_name) >= 3:
teacher_name[2] += '等'
... | {
"content_hash": "ccca416c83c0ad7b5c85ac34e3e1dd05",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 44,
"avg_line_length": 28,
"alnum_prop": 0.6208791208791209,
"repo_name": "Rhilip/cn-mooc-dl",
"id": "5b88483aa5f3475f3aaf790dc8351928a4d85347",
"size": "392",
"binary": ... |
"""Cancel an existing iSCSI account."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@click... | {
"content_hash": "e3af1c56be97c468968cd5941e5268b1",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 32.4,
"alnum_prop": 0.7129629629629629,
"repo_name": "skraghu/softlayer-python",
"id": "f744cb62723aac06d7af3ba689ca377319e5ae3c",
"size": "972",
"... |
import sys
import tweepy # https://github.com/tweepy/tweepy
import csv
import api_keys
import xlsxwriter
import tweet_cleaner
import json
import argparse
parser = argparse.ArgumentParser(description='collect user tweets')
parser.add_argument('-u', '--user', type=str,
help='user', required=True)
... | {
"content_hash": "2b3cb59a13b2faed4b6c1911985f8ef5",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 102,
"avg_line_length": 37.5959595959596,
"alnum_prop": 0.6265448683503493,
"repo_name": "motazsaad/tweets-collector",
"id": "f77875ceec7c5aa78cf2ffcc3e4d7864eec2118b",
"si... |
from __future__ import division
from random import random, seed, expovariate, uniform, triangular, gammavariate, gauss, lognormvariate, weibullvariate
from datetime import datetime
import os
from csv import writer
import yaml
import shutil
import networkx as nx
from data_record import DataRecord
from server import Ser... | {
"content_hash": "a05e28aaa3a619235f47a7080d8de163",
"timestamp": "",
"source": "github",
"line_count": 858,
"max_line_length": 180,
"avg_line_length": 38.35081585081585,
"alnum_prop": 0.534599604923264,
"repo_name": "geraintpalmer/ASQ",
"id": "99a283600242bc95b026315ea2633bf05142fef0",
"size": "32... |
''' Provide the Auto property.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = loggin... | {
"content_hash": "44a6d18fc2e7260b9b0475c5c1f93915",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 82,
"avg_line_length": 28.23170731707317,
"alnum_prop": 0.2920086393088553,
"repo_name": "stonebig/bokeh",
"id": "51079f01e023592368e00196d1dd1a37dade9d05",
"size": "2646",... |
from distutils.core import setup
import pytz
setup(
name='gae-pytz',
version=pytz.__version__,
url='https://github.com/potatolondon/gae-pytz/',
license='MIT',
author='Stuart Bishop',
author_email='stuart@stuartbishop.net',
description='A version of pytz for Django on Google App Engine.',
... | {
"content_hash": "ef2fa8b5291708b48e8478baa4daa57b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 30.40740740740741,
"alnum_prop": 0.6236297198538368,
"repo_name": "davidwtbuxton/gae-pytz",
"id": "1d17be51ab0e60faedaddbe614f4587e7145bbad",
"size":... |
import logging
from typing import Dict
from django.contrib.auth import get_user_model
from django.contrib.auth.password_validation import validate_password
from django.core import exceptions
from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand, CommandError
from poly... | {
"content_hash": "6aca9748b8e4b5acdf47a62435a1633c",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 98,
"avg_line_length": 34.48951048951049,
"alnum_prop": 0.58779399837794,
"repo_name": "polyaxon/polyaxon",
"id": "aa44cea184e0cf00b47c24ca6daf08d97909ca69",
"size": "5537... |
import unittest
from telemetry.user_story import user_story_filter
from telemetry.page import page
from telemetry.page import page_set
class MockUrlFilterOptions(object):
def __init__(self, page_filter_include, page_filter_exclude):
self.page_filter = page_filter_include
self.page_filter_exclude = page_fil... | {
"content_hash": "6e3f6d98be5a97652431b5f4071481aa",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 75,
"avg_line_length": 50.362637362637365,
"alnum_prop": 0.7636919048658084,
"repo_name": "dushu1203/chromium.src",
"id": "8445e70dcc5a06cad7731f477a8f0e0e3fc44290",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.