text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import print_function
import argparse
import sys
import time
parser = argparse.ArgumentParser(description="Removes potential deamination from vcf file")
#add options to argparser
parser.add_argument('-i', action="store", dest="vcf_input", type=str)
parser.add_argument('-o', action="store", dest="vcf... | {
"content_hash": "b5c9235b8714acc1781f7bb748724c93",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 91,
"avg_line_length": 23.517857142857142,
"alnum_prop": 0.6476841305998481,
"repo_name": "ruidlpm/Utils",
"id": "05286d3a527cf876de721250e323fcbdbd52bfe2",
"size": "3071"... |
import copy
class UnspecifiedError(Exception):
"""Base class for all exceptions in docker_registry."""
def __init__(self, *args, **kwargs):
self.message = kwargs.pop('message', 'No details')
super(UnspecifiedError, self).__init__(*args, **kwargs)
class UsageError(UnspecifiedError):
"""E... | {
"content_hash": "3ea89cffac1ff7ae096bb75af6bdfc51",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 110,
"avg_line_length": 31.921348314606742,
"alnum_prop": 0.6448433650123196,
"repo_name": "rgreinho/saliere",
"id": "9059eace99c26f8531ddd78d9019d84c08b583ee",
"size": "28... |
"""
TODO
"""
import sys
import logging
import numpy
import numpy as np
from theano import function, shared
from theano import tensor as TT
import theano
sharedX = lambda X, name : \
shared(numpy.asarray(X, dtype=theano.config.floatX), name=name)
def kinetic_energy(vel):
"""
Returns the kinetic energ... | {
"content_hash": "6a27c91bc822adac9b49bbd96d2701f9",
"timestamp": "",
"source": "github",
"line_count": 389,
"max_line_length": 98,
"avg_line_length": 37.23650385604113,
"alnum_prop": 0.6405246807041768,
"repo_name": "NoSRPKU/GradD",
"id": "4e719ff9e6fc04689dd4a953b0531c85b573e3a1",
"size": "14485"... |
import logging
import numpy as np
import os
import csv
logger = logging.getLogger(__name__)
class CERerankingEvaluator:
"""
This class evaluates a CrossEncoder model for the task of re-ranking.
Given a query and a list of documents, it computes the score [query, doc_i] for all possible
documents and ... | {
"content_hash": "67d9f4fba9b76a69bcd29adcf1733c43",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 294,
"avg_line_length": 42.752941176470586,
"alnum_prop": 0.5784259768849752,
"repo_name": "UKPLab/sentence-transformers",
"id": "e2f47ff10f6da4c1c428a1c4e07737859f1716ff",
... |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20140815DescribeModifyParameterLogRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.DBInstanceId = None
self.EndTime = None
self.PageNumber = None
self.PageSiz... | {
"content_hash": "6e62baec422473a175768a0c8f8e7896",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 65,
"avg_line_length": 29.533333333333335,
"alnum_prop": 0.7471783295711061,
"repo_name": "francisar/rds_manager",
"id": "18b4e41f2dc4a96d2316fee4a4a1694e338e8c3f",
"size":... |
""" The crypto.hash package.
Part of the CryptoPy framework.
"""
| {
"content_hash": "c5d9b7e8a86ce901d73e34f8c7738a2c",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 35,
"avg_line_length": 23,
"alnum_prop": 0.6666666666666666,
"repo_name": "mrknow/filmkodi",
"id": "4fc0e5e31470a40734c4fd495b62dbcdd289a739",
"size": "98",
"binary": fals... |
import subprocess
import numpy as np
import pandas as pd
import itertools
from sklearn.metrics import log_loss
import avito2_io
import pdb
BASE = avito2_io.BASE
DATA = avito2_io.DATA
VWDATA = BASE + 'vwdata/'
TMP = BASE + 'tmp/'
SUBMISSION = BASE + '/submissions/submission_%d.csv'
SAMPLE = DATA + '/sampleSubmission.cs... | {
"content_hash": "72d4e0d633c614ccc6ccb683653edbd1",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 82,
"avg_line_length": 31.847161572052403,
"alnum_prop": 0.6492527080762375,
"repo_name": "davidthaler/Kaggle_Avito-2015",
"id": "6ab6360982059d5a6e9730379e3b51df002f1b77",
... |
import grpc
from google.cloud.language_v1.proto import (
language_service_pb2 as google_dot_cloud_dot_language__v1_dot_proto_dot_language__service__pb2,
)
class LanguageServiceStub(object):
"""Provides text analysis operations such as sentiment analysis and entity
recognition.
"""
def __init__(self,... | {
"content_hash": "ee7893452ebf3abc4c3d077a2c65747e",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 152,
"avg_line_length": 56.212765957446805,
"alnum_prop": 0.7209184960888216,
"repo_name": "dhermes/gcloud-python",
"id": "40a7da3057736fb489766a16d0fc4a9b42bd9eb6",
"size... |
"""Enable periodic transmission of DB and job-produced content to BigQuery."""
__author__ = [
'Michael Gainer (mgainer@google.com)',
]
import base64
import collections
import copy
import datetime
import logging
import os
import random
import re
import sys
import traceback
import apiclient
import httplib2
import ... | {
"content_hash": "7f2fd946818aae8bd50c4b3b3f94852a",
"timestamp": "",
"source": "github",
"line_count": 1145,
"max_line_length": 80,
"avg_line_length": 47.0235807860262,
"alnum_prop": 0.6009063556331489,
"repo_name": "wavemind/gcb17ml",
"id": "8c253a79dc8d6f78c09fbc54dc6a36b80d51d498",
"size": "544... |
import json
from urllib import urlencode
from urllib2 import urlopen
#get_encoding, decode_page, check_status, and geocode are largely
#from the GoogleV3 module in the geopy library
#Per MIT liscence, we have included the following from geopy
#Copyright (c) 2006-2010 Brian Beck
#Copyright (c) 2010-2012 GeoPy Projec... | {
"content_hash": "f5f120005d33a425258b1a5f264d4e07",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 115,
"avg_line_length": 37.6764705882353,
"alnum_prop": 0.677855841790268,
"repo_name": "daeyun/campus-path",
"id": "2d65badb3611c8282cc9708a67b6face8d94f191",
"size": "38... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('municipal_finance', '0009_auto_20170301_1230'),
]
operations = [
migrations.AlterField(
model_name='age... | {
"content_hash": "ee37f16e89384267fa66fe767d34eead",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 155,
"avg_line_length": 32.857142857142854,
"alnum_prop": 0.5389945652173913,
"repo_name": "Code4SA/municipal-data",
"id": "277ade9de4a7fc6d417197fd5635cd98c2bcf5cf",
"siz... |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class WlbItemAddRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.color = None
self.goods_cat = None
self.height = None
self.is_dangerous = None
sel... | {
"content_hash": "c464f1a6fd43809eb310ed80c8b3ac3b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 55,
"avg_line_length": 25.29032258064516,
"alnum_prop": 0.6581632653061225,
"repo_name": "CooperLuan/devops.notes",
"id": "9cecefa74c33d55d9d6851b491af9e3ee7b66bf7",
"size"... |
"""Setup script for oauth2client.
Also installs included versions of third party libraries, if those libraries
are not already installed.
"""
import setup_utils
has_setuptools = False
try:
from setuptools import setup
has_setuptools = True
except ImportError:
from distutils.core import setup
packages = [
'oa... | {
"content_hash": "60455bf80b02a931dfc38fc5dfbc4390",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 116,
"avg_line_length": 30.271186440677965,
"alnum_prop": 0.6556550951847704,
"repo_name": "MapofLife/MOL",
"id": "ec87873d325a375900d5c0a7ae71aa91c3b2c1ec",
"size": "2367"... |
import os
import argparse
import inspect
import sys
from nipype.interfaces.base import Interface
from nipype.utils.misc import str2bool
def listClasses(module=None):
if module:
__import__(module)
pkg = sys.modules[module]
print "Available Interfaces:"
for k,v in pkg.__dict__.items()... | {
"content_hash": "eff7cf76bc42667b244d7877cbc9b140",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 120,
"avg_line_length": 36.53947368421053,
"alnum_prop": 0.5797623334533669,
"repo_name": "glatard/nipype",
"id": "f215bfccee696ba183031e267a837c11c389e1d7",
"size": "2777"... |
"""
Forms and validation code for user registration.
"""
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
from django import forms
from django.utils.translation import ugettext_lazy as _
# I ... | {
"content_hash": "da2e02a9bf7f55d365014cf2e99c8543",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 141,
"avg_line_length": 39.078125,
"alnum_prop": 0.6165533786485405,
"repo_name": "gminds/rapidnewsng",
"id": "c22627096394038ec827f812e143246634095656",
"size": "5002",
... |
"""Tests for base google test functionality."""
__author__ = 'dborowitz@google.com (Dave Borowitz)'
import os
import re
import string
import sys
import unittest
import gflags as flags
from google.apputils import basetest
PY_VERSION_2 = sys.version_info[0] == 2
FLAGS = flags.FLAGS
flags.DEFINE_integer('testid', 0,... | {
"content_hash": "e6be66f55442aedcc2b1c10e30bc603a",
"timestamp": "",
"source": "github",
"line_count": 1570,
"max_line_length": 80,
"avg_line_length": 38.18789808917197,
"alnum_prop": 0.6482361771328496,
"repo_name": "LeslieW/apputils",
"id": "426eed7325681994653e4faa46ead974449b91f1",
"size": "60... |
import unittest
from rdlmpy import RDLMClient
from rdlmpy import RDLMLockWaitExceededException, RDLMLockDeletedException, RDLMServerException
from httpretty import HTTPretty, httprettified
import base64
import os
class TestClient(unittest.TestCase):
client = None
server = "localhost"
port = 8888
baseu... | {
"content_hash": "76933e9d838147ef686a0847955e1f16",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 99,
"avg_line_length": 40.333333333333336,
"alnum_prop": 0.6584710743801653,
"repo_name": "thefab/rdlm-py",
"id": "73994a752172724c3479b6b3416dce7d7d6f0f3e",
"size": "4840... |
"""Tests for the heuristic_payoff_table library."""
from absl import logging
from absl.testing import absltest
from absl.testing import parameterized
import numpy as np
from open_spiel.python.egt import heuristic_payoff_table
from open_spiel.python.egt import utils
import pyspiel
class ModuleLevelTest(absltest.Test... | {
"content_hash": "99803fcedb29e5086a8552846783c922",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 78,
"avg_line_length": 31.985714285714284,
"alnum_prop": 0.6185797230906654,
"repo_name": "deepmind/open_spiel",
"id": "48e84b07fd01e370712de977f7818cd2e7258a5a",
"size": ... |
from gdcdictionary import gdcdictionary
class GDCGraphValidator(object):
"""
Validator that validates entities' relationship with existing nodes in
database.
"""
def __init__(self):
self.schemas = gdcdictionary
self.required_validators = {
"links_validator": GDCLinksV... | {
"content_hash": "d7afc8b378a946cda400a2c040da51aa",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 91,
"avg_line_length": 37.65942028985507,
"alnum_prop": 0.4906676928997499,
"repo_name": "NCI-GDC/gdcdatamodel",
"id": "093e220e40bb7b729c8476738997f940f1b41431",
"size": ... |
import random
import math
from datetime import timedelta
from scipy.stats import norm
class SpikeRequestGenerator:
def __init__(self, constant_rpm, quantum_seconds, max_error,
start_datetime):
self.quantum_seconds = quantum_seconds
self.max_error = max_error
self.constant... | {
"content_hash": "e4dc36743c51c32f7006ba4951a1457a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 31.214285714285715,
"alnum_prop": 0.6384439359267735,
"repo_name": "swarmer/autoscaler",
"id": "dbe8f9c7d5899313ef44fe72ecf8d1170ced26bf",
"size": "8... |
"""Support for Dominos Pizza ordering."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components import http
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.hel... | {
"content_hash": "f823a44b030f911d68b3723fe0e02c69",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 78,
"avg_line_length": 28.976744186046513,
"alnum_prop": 0.598314606741573,
"repo_name": "fbradyirl/home-assistant",
"id": "59869ed0a977d16b786c7bec005b6d62954d37a0",
"siz... |
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
class LoginRequiredMixin(object):
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs)
| {
"content_hash": "06ab6b69afd319387c2f4412273346c5",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 72,
"avg_line_length": 37.375,
"alnum_prop": 0.7658862876254181,
"repo_name": "mailme/mailme.io",
"id": "5956543f56067eeba5f8a25c084ce2f33e2907b3",
"size": "299",
"binary"... |
import pytest
pytestmark = pytest.mark.page('definition_lists.html')
def test_returns_the_matching_elements(browser):
assert list(browser.dts(class_name='current-industry')) == \
[browser.dt(class_name='current-industry')]
def test_returns_the_number_of_divs(browser):
assert len(browser.dts()) == 1... | {
"content_hash": "3a9ff6b711f77e7660c2df8c08cdc0b9",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 64,
"avg_line_length": 26.423076923076923,
"alnum_prop": 0.6622998544395924,
"repo_name": "lmtierney/watir-snake",
"id": "38fb786c80475f833f765a6048c9ec66f035d127",
"size":... |
'''
Wavenet model definition and generation using contrib.layers
- Carl Quillen
'''
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.layers as layers
from tensorflow.contrib.framework import arg_scope
def wavenet_block(xpad, x, conditioning, num_outputs,
num... | {
"content_hash": "479742ae82857e013f53323f35da75c1",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 79,
"avg_line_length": 41,
"alnum_prop": 0.574144051299668,
"repo_name": "cbquillen/wavenet_experiment",
"id": "2c1845d2816d55c4cc1aea6b53a63906b08444f6",
"size": "8755",
... |
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 'OccupationalStandard.attachment'
db.add_column(u'admin_occupationalstandard', 'attachment',
se... | {
"content_hash": "2a46749136a23b3ca05c043c881f5565",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 218,
"avg_line_length": 77.58783783783784,
"alnum_prop": 0.5562135330488548,
"repo_name": "arpitprogressive/arpittest",
"id": "ca9018caa10bd2e31b57793eb67b3e7bef77971c",
"... |
import boto
from boto.connection import AWSQueryConnection
from boto.regioninfo import RegionInfo
from boto.exception import JSONResponseError
from boto.directconnect import exceptions
from boto.compat import json
class DirectConnectConnection(AWSQueryConnection):
"""
AWS Direct Connect makes it easy to estab... | {
"content_hash": "8330d6d77a02ece9bed6b59eaf823f18",
"timestamp": "",
"source": "github",
"line_count": 607,
"max_line_length": 93,
"avg_line_length": 37.018121911037895,
"alnum_prop": 0.6279483756119271,
"repo_name": "appneta/boto",
"id": "08197ddfa873003a8275abead648037cbabbbf3d",
"size": "23594"... |
"""
COHORTE Java isolate loader, based on jPype
**TODO:**
* Review constants names & values
:author: Thomas Calmant
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the... | {
"content_hash": "da469b5acef8bf1a448458bb7fe4aad3",
"timestamp": "",
"source": "github",
"line_count": 778,
"max_line_length": 113,
"avg_line_length": 32.68637532133676,
"alnum_prop": 0.5767204089657885,
"repo_name": "isandlaTech/cohorte-runtime",
"id": "1620a2d5f69105149e0c24cc257b55e40f733b95",
... |
"""Tests for tensorflow.ops.resource_variable_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import gc
import os
import pickle
import re
from absl.testing import parameterized
import numpy as np
from tensorflow.core.framework import te... | {
"content_hash": "6a619c6331661328615d5ae411b01f08",
"timestamp": "",
"source": "github",
"line_count": 1413,
"max_line_length": 91,
"avg_line_length": 42.29299363057325,
"alnum_prop": 0.6416331994645248,
"repo_name": "chemelnucfin/tensorflow",
"id": "b36b252bd81332a7f35d840be3cab88ab1cc03a9",
"siz... |
"""
Provides the ability to run test on a standalone Django app.
"""
import sys
from optparse import OptionParser
from settings import configure_settings
# Configure the default settings
configure_settings()
# Django nose must be imported here since it depends on the settings being configured
from django_nose impor... | {
"content_hash": "f6e7a6b749e0da32a0385092e4e2d30d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 91,
"avg_line_length": 24.470588235294116,
"alnum_prop": 0.7007211538461539,
"repo_name": "wesleykendall/django-issue",
"id": "c41022484ce495b3970b0fa815395a5724a17f8e",
"s... |
"""Gradients for operators defined in nn_ops.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import backprop
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.pytho... | {
"content_hash": "b537bba03a747515d4bc1d2bb6a69e66",
"timestamp": "",
"source": "github",
"line_count": 1199,
"max_line_length": 80,
"avg_line_length": 33.98415346121768,
"alnum_prop": 0.6332981569195278,
"repo_name": "aam-at/tensorflow",
"id": "a02e31f80a5e82fdc10bc55f1aab1022220eba47",
"size": "4... |
import datetime
import sqlite3
from os import getcwd, startfile
import PyQt5.QtGui as QtGui
import PyQt5.QtWidgets as QtWidgets
import PyQt5.QtCore as QtCore
from misc_files import common_vars
from settings import settings_window
from video_entry import entry_screen
class MainWindow(QtWidgets.QMainWindow):
def __i... | {
"content_hash": "7209f2512291b08ff3d6f3e05acf7790",
"timestamp": "",
"source": "github",
"line_count": 562,
"max_line_length": 114,
"avg_line_length": 41.195729537366546,
"alnum_prop": 0.6861178299930891,
"repo_name": "bsobotka/amv_tracker",
"id": "21f2f3536348aacada2db88dbd327112256a4290",
"size"... |
"""Tests for the DeterminantalPointProcess distribution."""
import contextlib
from absl.testing import parameterized
import numpy as np
import tensorflow.compat.v2 as tf
from tensorflow_probability.python.distributions import bernoulli as bernoulli_lib
from tensorflow_probability.python.distributions import dpp as d... | {
"content_hash": "05a17873ffb4726ac1c84ad56738ed98",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 90,
"avg_line_length": 37.13068181818182,
"alnum_prop": 0.619433817903596,
"repo_name": "tensorflow/probability",
"id": "15ef69e06096839de8a95f3896e8875e9278575a",
"size":... |
"""Multi-layer Perceptron
"""
# Authors: Issam H. Laradji <issam.laradji@gmail.com>
# Andreas Mueller
# Jiyuan Qian
# Licence: BSD 3 clause
import numpy as np
from abc import ABCMeta, abstractmethod
from scipy.optimize import fmin_l_bfgs_b
import warnings
from ..base import BaseEstimator, Classifi... | {
"content_hash": "c986fec4f2efcaddf350e30495383a6e",
"timestamp": "",
"source": "github",
"line_count": 1268,
"max_line_length": 81,
"avg_line_length": 39.61514195583596,
"alnum_prop": 0.5877528268832617,
"repo_name": "DSLituiev/scikit-learn",
"id": "f0d6268d9d60116fd1eb5fa40cd29066176e90ec",
"size... |
import sys
sys.path.insert(1, "../../../")
import h2o
def benign(ip,port):
# Connect to h2o
h2o.init(ip,port)
training_data = h2o.import_frame(h2o.locate("smalldata/logreg/benign.csv"))
Y = 3
X = range(3) + range(4,11)
#Log.info("Build the model")
model = h2o.glm(y=training_data[Y].asfac... | {
"content_hash": "52dc52cd0ac1092e14ed0f6548f90ee2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 115,
"avg_line_length": 34.23076923076923,
"alnum_prop": 0.5719101123595506,
"repo_name": "ChristosChristofidis/h2o-3",
"id": "9733392a9c65bd42384fe5ca7a39ec2f5f5c1dac",
"s... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import itertools
import os
import sys
from abc import abstractmethod
from contextlib import contextmanager
from hashlib import sha1
from twitter.common.collections.or... | {
"content_hash": "9b1c96f7c80f95c9ca62ae35e84fd43a",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 119,
"avg_line_length": 43.29007633587786,
"alnum_prop": 0.6935284782225357,
"repo_name": "scode/pants",
"id": "a808e3d5ded0ea9645379d0fc9e12489d253cff1",
"size": "22831",... |
from __future__ import unicode_literals
from django.db import migrations, models
import filingcabinet.models
class Migration(migrations.Migration):
dependencies = [
('document', '0003_auto_20180521_1619'),
]
operations = [
migrations.AddField(
model_name='pageannotation',
... | {
"content_hash": "51ed68f734d6fb7cab35f5a497bb536b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 125,
"avg_line_length": 25.63157894736842,
"alnum_prop": 0.6509240246406571,
"repo_name": "stefanw/froide",
"id": "86d6b841e06ac17f3e5312594ebdba94ac36dfb1",
"size": "561",... |
"""
Copyright (C) 2016, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import datetime
from bennu.localdb import SQLite3Db
import mysql.connector as mysqlConnector
"""
本地端資料庫存取
"""
#Findfine MySQL localdb
class LocalDbForJson... | {
"content_hash": "eb53a83452ef082470312e58bf280bd1",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 146,
"avg_line_length": 41.68929110105581,
"alnum_prop": 0.6521707670043415,
"repo_name": "muchu1983/findfine",
"id": "35949f8b487ebd580de09275d2a95bee711bc531",
"size": "... |
"""
Tests for the circle module.
"""
import astropy.units as u
import numpy as np
import pytest
from astropy.coordinates import SkyCoord
from numpy.testing import assert_allclose
from photutils.aperture.circle import (CircularAnnulus, CircularAperture,
SkyCircularAnnulus, SkyCir... | {
"content_hash": "89ac8874f8af2d3e2413cf73f01ffabb",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 79,
"avg_line_length": 31.363636363636363,
"alnum_prop": 0.6434782608695652,
"repo_name": "astropy/photutils",
"id": "33e1150809980379f83f6ce94d31a929ebc9ee8e",
"size": "5... |
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
urlpatterns = [
url(r'^login/$', auth_views.login, name='login'),
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
url(r'^password_change/$', auth_views.password_change, name='password_chan... | {
"content_hash": "6d202e090df1890639724301fa6d9a6b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 162,
"avg_line_length": 66.23076923076923,
"alnum_prop": 0.6782810685249709,
"repo_name": "meiordac/ecommerce",
"id": "5f2afcd183e2d72944047dedd18da54ef1966c1b",
"size": "8... |
import subprocess
import os,time
from HPC.Logger import Logger
from HPC.HPCManagerPlugins.plugin import Plugin
class slurm(Plugin):
def __init__(self, logFileName):
self.__log= Logger(logFileName)
self.__failedPollTimes = 0
def getHPCResources(self, partition, max_nodes=None, min_nodes=2, min... | {
"content_hash": "ac3dc514406e97171617ac48b52381fa",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 220,
"avg_line_length": 46.6051282051282,
"alnum_prop": 0.5390625,
"repo_name": "PanDAWMS/pilot",
"id": "b54a6c2fd6ef8dcd5499af4ad65d0d2954eab3b5",
"size": "9089",
"bina... |
import datetime
from scrapy import log
def string_strip(text, loader_context):
chars = loader_context.get('string_strip', ' \n\t\r')
return text.strip(chars)
def pre_string(text, loader_context):
pre_str = loader_context.get('pre_string', '')
return pre_str + text
def post_string(text, l... | {
"content_hash": "ea7beb672df213fb92a2027b93d0afda",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 130,
"avg_line_length": 30.956204379562045,
"alnum_prop": 0.5722706908747937,
"repo_name": "sundisee/django-dynamic-scraper",
"id": "29ceef2c00c74c318dc008c67ca778561801a146... |
import operator
from rply import LexerGenerator, ParserGenerator
from .utils import BoxInt
class TestBoth(object):
def test_arithmetic(self):
lg = LexerGenerator()
lg.add("NUMBER", r"\d+")
lg.add("PLUS", r"\+")
lg.add("TIMES", r"\*")
pg = ParserGenerator(["NUMBER", "PLUS... | {
"content_hash": "71a9621577411b69275694129218f831",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 25.76923076923077,
"alnum_prop": 0.4975124378109453,
"repo_name": "agamdua/rply",
"id": "38c8ad2763a44158ca9e2d95f80205d9c3eb6120",
"size": "1005",
... |
import mock
from six.moves.urllib import parse
from heat.engine import resource
from heat.engine.resources.openstack.keystone import region
from heat.engine import stack
from heat.engine import template
from heat.tests import common
from heat.tests import fakes
from heat.tests import utils
KEYSTONE_REGION_TEMPLATE = ... | {
"content_hash": "d0124c340fc9bfca56424962180fd8b7",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 32.91044776119403,
"alnum_prop": 0.5934240362811791,
"repo_name": "cwolferh/heat-scratch",
"id": "a156f3bd00b14016682429f1feed450e45781870",
"size":... |
from pip.req import parse_requirements
from pip.download import PipSession
from setuptools import setup
long_desc = """Poor Tux needs a new heart. We do that by feeding it a raspberrypi.
The end goal is to keep Tux's basic functionnality:
- Wings position detection, push buttons and movement
- Mouth movement and po... | {
"content_hash": "20c7776963ba6d6610b7952d8e6fef92",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 82,
"avg_line_length": 30.02127659574468,
"alnum_prop": 0.6959603118355776,
"repo_name": "TuxEatPi/common",
"id": "4f21883b5284f3541f066c30395c60a090d365f7",
"size": "1458"... |
import os
import sys
import time
import argparse
try:
import configparser
except:
import ConfigParser as configparser
from stir.script import StirTestCase
from magnolia.server import MinicapService
from magnolia.utility import *
from magnolia.utility import LOG as L
class TestCase_Unit(StirTestCase):
def... | {
"content_hash": "71114f5480a459189dbcefde131d5fda",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 106,
"avg_line_length": 38.196969696969695,
"alnum_prop": 0.5985719952399842,
"repo_name": "setsulla/stir",
"id": "a84c00bbe1f893b882b01c588add2989e6b3137f",
"size": "2521"... |
import warlock
from glanceclient.common import utils
from glanceclient.v2 import schemas
MEMBER_STATUS_VALUES = ('accepted', 'rejected', 'pending')
class Controller(object):
def __init__(self, http_client, schema_client):
self.http_client = http_client
self.schema_client = schema_client
@u... | {
"content_hash": "b4deaefa497278bd2bc6a07aa74317c9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 34.25,
"alnum_prop": 0.6240875912408759,
"repo_name": "mmasaki/python-glanceclient",
"id": "5d07b9b5e821ced6dc4460bfbce84a0eb5454495",
"size": "2006"... |
import socketio
import eventlet
import json
from flask import Flask
from datetime import datetime as date
from datetime import timedelta
import thread
from colour import get_bus, register_item, item_is_locked_in
class Item(object):
def __init__(self, name, colour):
self.name = name
self.colour = co... | {
"content_hash": "880e25fcee837e29151fc20a1e9bc202",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 138,
"avg_line_length": 34.009389671361504,
"alnum_prop": 0.6283821093318609,
"repo_name": "kwang101/5olution",
"id": "5c5a2e82cdb32333c1f86d0e85363b1222a6132a",
"size": "... |
from datetime import datetime
import errno
import os
import select
import socket
import ssl
import gunicorn.http as http
import gunicorn.http.wsgi as wsgi
import gunicorn.util as util
import gunicorn.workers.base as base
from gunicorn import six
class SyncWorker(base.Worker):
def run(self):
# self.socke... | {
"content_hash": "dd2481438256eb02238519b638fd5ac1",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 78,
"avg_line_length": 36.30065359477124,
"alnum_prop": 0.5061217140799423,
"repo_name": "mpetyx/palmdrop",
"id": "baf45a90e96bc894003185e35f9cb8694ea8f8e5",
"size": "5684... |
import numpy as np
import random
def L1_dist(x, y):
"""
x : one long sample vector
y : array of cluster bases
"""
return np.sum(abs(x-y), axis=1)
def KMeans(N, X, tol, max_iter, metric, centers):
"""
N : number of clusters
X : samples in numpy array, sample_num * feat_num
tol : cost < tol, while loop will br... | {
"content_hash": "c88392daa29d0fd8ea330392adab1c7f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 87,
"avg_line_length": 25.25,
"alnum_prop": 0.6455445544554456,
"repo_name": "zhouyang2640/MLCourse",
"id": "82aa119b18fcf702d81013ff3c5c6d4fe8df947d",
"size": "1549",
"b... |
from django.db.models.fields import FloatField
from .base import CompositeField
class ComplexField(CompositeField):
real = FloatField()
imag = FloatField()
def __init__(self, verbose_name=None, blank=False, null=False, default=None):
super(ComplexField, self).__init__()
self.verbose_nam... | {
"content_hash": "64e583158e08f13d7ae4438c6af024d6",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 81,
"avg_line_length": 33.23809523809524,
"alnum_prop": 0.586676217765043,
"repo_name": "georgemarshall/django-composite-field",
"id": "ea02261b119d807e778fb63d494664909f802d... |
"""
Handles all request to the Platform or Guest VM
"""
from eventlet import Timeout
from oslo.messaging.rpc.client import RemoteError
from oslo import messaging
from trove.common import cfg
from trove.common import exception
from trove.common.i18n import _
import trove.common.rpc.version as rpc_version
from trove.op... | {
"content_hash": "15e2c3529809d8ca895c8fcbe99f6da3",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 79,
"avg_line_length": 46.67424242424242,
"alnum_prop": 0.6044473299788995,
"repo_name": "CMSS-BCRDB/RDS",
"id": "f42c8c1e028e6539462987e234ac35eab91068a8",
"size": "19123... |
'''Base58 encoding
Implementations of Base58 and Base58Check encodings that are compatible
with the bitcoin network.
'''
# This module is based upon base58 snippets found scattered over many bitcoin
# tools written in python. From what I gather the original source is from a
# forum post by Gavin Andresen, so direct y... | {
"content_hash": "edd0185f84a242dc8d1da5825fa4f949",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 79,
"avg_line_length": 25.528301886792452,
"alnum_prop": 0.6304508499630451,
"repo_name": "keis/base58",
"id": "929014f2eb62b8f2184db098a6d7ec11ea832b31",
"size": "4059",
... |
from google.cloud import aiplatform_v1
async def sample_get_model_evaluation_slice():
# Create a client
client = aiplatform_v1.ModelServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1.GetModelEvaluationSliceRequest(
name="name_value",
)
# Make the request
... | {
"content_hash": "3c0309431a9888bf2b51b927eb2e96e1",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 27,
"alnum_prop": 0.732943469785575,
"repo_name": "googleapis/python-aiplatform",
"id": "a7b8371a97b5def962e923e4d62ca23acbd4da44",
"size": "1924",
... |
from Crypto.Util.number import long_to_bytes, bytes_to_long
import sys
from Crypto.Util.py3compat import *
__all__ = [ 'DerObject', 'DerInteger', 'DerOctetString', 'DerNull', 'DerSequence', 'DerObjectId' ]
class DerObject:
"""Base class for defining a single DER object.
Instantiate this class ONLY wh... | {
"content_hash": "0080a6322ec37d03a7b251532f2f9965",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 98,
"avg_line_length": 44.26136363636363,
"alnum_prop": 0.5091998288403937,
"repo_name": "nmercier/linux-cross-gcc",
"id": "37957ce95293e27e7700b0058f2d5394f17e06ae",
"siz... |
from bokeh.models import Div, Select, WidgetBox
from bokehselectize.selectizeselect import SelectizeSelect
from bokeh.io import show, curdoc
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Button
import random
DATA = {
'A': dict(email=['foo@bar.com', 'another@email.com', 'third@email.c... | {
"content_hash": "fcae9750578edebcbc3014f609963ad4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 108,
"avg_line_length": 35.72727272727273,
"alnum_prop": 0.5619168787107719,
"repo_name": "lukauskas/bokeh-selectize",
"id": "876de20c9d9c37fa9c7680e12737063094b428ad",
"si... |
from __future__ import division
import os
import sys
import time
import csv
import shutil
import threading
import errno
import tempfile
from distutils.version import LooseVersion
from wlauto import Instrument, Parameter, IterationResult
from wlauto.instrumentation import instrument_is_installed
from wlauto.exception... | {
"content_hash": "ea6161b622b48ee39c194db4b8df36f7",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 131,
"avg_line_length": 48.76512455516014,
"alnum_prop": 0.6046121287309348,
"repo_name": "rockyzhang/workload-automation",
"id": "ecdd1bb61e9dffee027d39c139530690875ac26b",... |
import win32security, ntsecuritycon, winnt
class Enum:
def __init__(self, *const_names):
"""Accepts variable number of constant names that can be found in either
win32security, ntsecuritycon, or winnt."""
for const_name in const_names:
try:
const_val=getattr(... | {
"content_hash": "db2f85eaeebe3a202360f263abf495eb",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 126,
"avg_line_length": 29.936708860759495,
"alnum_prop": 0.6593023255813953,
"repo_name": "zooba/PTVS",
"id": "c0b7aff5351c56a239221d4e4a7017969e538949",
"size": "9460",
... |
import os.path
import re
import random
import time
from typing import Dict, Any
from kvmagent import kvmagent
from kvmagent.plugins.imagestore import ImageStoreClient
from kvmagent.plugins import mini_fencer
from zstacklib.utils import jsonobject
from zstacklib.utils import http
from zstacklib.utils import log
from z... | {
"content_hash": "66b48531a613dda23f1b01b0135c9587",
"timestamp": "",
"source": "github",
"line_count": 1185,
"max_line_length": 151,
"avg_line_length": 43.23628691983122,
"alnum_prop": 0.6135259100224456,
"repo_name": "zstackorg/zstack-utility",
"id": "78df340343c3f1c2fc33860394d164aed62e026e",
"s... |
def modular_inverse(a, n):
"""
Used for division in elliptic curves. Very important in RSA/ECDSA algorithms.
It uses EGCD.
Extended Euclidean Algorithm:
- http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
- http://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extende... | {
"content_hash": "824b31d9af8d993ac73d4391dd530b28",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 104,
"avg_line_length": 36.06666666666667,
"alnum_prop": 0.6321626617375231,
"repo_name": "LaPlataPy/btcutils",
"id": "79657f3ca28920652293ad3465580f7ccf933f19",
"size": "5... |
from i3pystatus import IntervalModule, formatp
class Uptime(IntervalModule):
"""
Outputs Uptime
.. rubric:: Available formatters
* `{days}` - uptime in days
* `{hours}` - rest of uptime in hours
* `{mins}` - rest of uptime in minutes
* `{secs}` - rest of uptime in seconds
* `{uptime}... | {
"content_hash": "34f4e2f7d350e54b56b53aed8149ee8a",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 75,
"avg_line_length": 29.825396825396826,
"alnum_prop": 0.49334752527940395,
"repo_name": "Elder-of-Ozone/i3pystatus",
"id": "6027e0e1af767ec88cc9fa250b2ed3b90f126168",
"s... |
'''
Created on 2014��11��12��
@author: ���
'''
import unittest
import feedin.engine
import json
import os
class SimpleFileFeedTest(unittest.TestCase):
def setUp(self):
self.engine = feedin.engine.Engine()
def tearDown(self):
pass
def get_conf_file(self, file):
di... | {
"content_hash": "207fb7a0eb5cfe734884cb53de58ca84",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 100,
"avg_line_length": 33.65714285714286,
"alnum_prop": 0.616723259762309,
"repo_name": "kevenli/FeedIn",
"id": "26c24317fb11223899d86ce8861182ff1ffa3966",
"size": "2398",... |
import hashlib
def get_md5_value(key):
value = None
try:
value = hashlib.md5(key).hexdigest()
except Exception, e:
print e
return value
| {
"content_hash": "bf1df17086d9230950366e0a7c103670",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 17,
"alnum_prop": 0.6,
"repo_name": "AisinoPythonTeam/PythonAiniso",
"id": "8d6130729a851af4251ebf1ea8a71e21a4adce5a",
"size": "193",
"binary": fal... |
import lasagne.layers as ll
import theano.tensor as T
from lasagne.objectives import categorical_crossentropy
from lasagne import nonlinearities
from layers import DenseLayerWithReg, Conv2DLayerWithReg
from theano.ifelse import ifelse
import theano
import numpy as np
import time
class MLP(object):
def __init__(se... | {
"content_hash": "ca07fc99a2b07b72670ba0e5e79f596e",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 109,
"avg_line_length": 41.810344827586206,
"alnum_prop": 0.5723711340206186,
"repo_name": "bigaidream-projects/drmad",
"id": "70456806cb945b0f5ba084d6f585fb3171fd392e",
"... |
import fourch
import fourdragon
import re
""" THIS IS HOW I'D LIKE THE MODULE TO WORK:
>>> r = Raid("123456789", verbose=True)
Found Boss(name=$name, type=$type, element=$element, difficulty=$difficulty, hp=$hp)
>>> r.sync()
Found Bard(id=$id, ) # unsure what Bards will have
Found Knight(id=$id, ) # same here
Knigh... | {
"content_hash": "5ef6256fba928c6b9a40b92008cadb6d",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 101,
"avg_line_length": 33.04807692307692,
"alnum_prop": 0.5388420133837649,
"repo_name": "sysr-q/4dragon",
"id": "97d3878e4544750a40dd887d283f006a30eb09f2",
"size": "3461... |
from . import AppCase
from app.models.attachment import Attachment
class AttachmentTest(AppCase):
def setUp(self):
self.setup_app()
self.create_project()
self.create_issue()
self.attachment = Attachment(
file_id='12345',
project=self.test_project,
... | {
"content_hash": "29ba5161dc1b9a9527f75c2981e178c2",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 63,
"avg_line_length": 30.571428571428573,
"alnum_prop": 0.6355140186915887,
"repo_name": "publicscience/hive",
"id": "e0df35031315ec4465677f0968c2435aecb6c107",
"size": "1... |
"""
Ensures client1 can connect but that clients with ou=client2 or ca=other_root can't connect.
"""
from common import LOCALHOST, RootCert, STATUS_PORT, SocketPair, TcpServer, TlsClient, print_ok, run_ghostunnel, terminate
import ssl
if __name__ == "__main__":
ghostunnel = None
try:
# create certs
... | {
"content_hash": "a12bb04aa8770f01508eebf51fd648e1",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 122,
"avg_line_length": 41.029411764705884,
"alnum_prop": 0.5491039426523298,
"repo_name": "square/ghostunnel",
"id": "0751180cdd865b62aab42d0307fb3da1ddc5c6ae",
"size": "2... |
from django.conf import settings
import sys
__author__ = 'franki'
from django.apps import AppConfig
class ImageConfig(AppConfig):
name = 'image'
label = 'image'
verbose_name = "Image"
# def ready(self):
# if settings.DEBUG and not 'django.template.context_processors.request' in settings.TEM... | {
"content_hash": "0fce0febc66af68fa6e5a68edfc3a98a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 122,
"avg_line_length": 35.578947368421055,
"alnum_prop": 0.658284023668639,
"repo_name": "neerajvashistha/pa-dude",
"id": "c4eaeb348c496828977bdeb3c626420b84fa16ef",
"size... |
import re
import unittest
from pathlib import Path
from shutil import copyfile, copytree
from tempfile import TemporaryDirectory
import jmespath
import pytest
from parameterized import parameterized
from tests.charts.helm_template_generator import render_chart
CHART_DIR = Path(__file__).parent / ".." / ".." / "chart... | {
"content_hash": "4bea39a33a328c655c415fd7e4f0c6fb",
"timestamp": "",
"source": "github",
"line_count": 603,
"max_line_length": 109,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.4658565579183727,
"repo_name": "lyft/incubator-airflow",
"id": "2ac8927f1cf8a6182943b552ae55c6561d98f54f",
"siz... |
from flask import request, flash, session, redirect, url_for, render_template, make_response
from flask_blog import db, cache
from flask_blog.user import blueprint
from flask_blog.model.user import User
from flask_blog.core.encrypt import password_validate, newest_encrypt
@blueprint.route("/login", methods=["GET", "P... | {
"content_hash": "a420c7c792dd452e678b3774feee54fa",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 96,
"avg_line_length": 46.733333333333334,
"alnum_prop": 0.5582501188777936,
"repo_name": "PurpleSun/Flask_Blog",
"id": "2f30889e0bf9174658014bf5f4b0c740ff6d2811",
"size": ... |
import abc
import copy
import datetime
import traceback
import mock
from oslo_context import context
from oslo_utils import timeutils
from oslotest import base
from oslotest import mockpatch
import six
from stevedore import extension
from ceilometer import pipeline
from ceilometer import publisher
from ceilometer.pub... | {
"content_hash": "4f17af92d78cc400ddefe7018c2c6066",
"timestamp": "",
"source": "github",
"line_count": 2139,
"max_line_length": 79,
"avg_line_length": 40.137447405329596,
"alnum_prop": 0.5269876767535584,
"repo_name": "idegtiarov/ceilometer",
"id": "867fff51b6755bfc8207f858b8a2be0e96785065",
"size... |
import collections
import re
import compiler
import tq_types
import typed_ast
class TypeContext(collections.namedtuple(
'TypeContext', ['columns', 'aliases', 'ambig_aliases',
'implicit_column_context', 'aggregate_context'])):
"""Defines the set of valid fields in a point in code, ... | {
"content_hash": "dee80939748d47b5a6c208bd94171cb0",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 79,
"avg_line_length": 44.35672514619883,
"alnum_prop": 0.5934080421885299,
"repo_name": "burnhamup/tinyquery",
"id": "68efad5f7c2ce8a0501f3783b314995759a49174",
"size": "... |
from ..interfaces.burpui_api_translate import TranslateBurpuiAPI
from ..dummy.burpui_dummy_api import Clients
class BUIClients:
""""
Get data from burp ui clients
"""
def __init__(self):
"""
"""
# Define clients from Interface
self.clientsobj = Clients
# Get t... | {
"content_hash": "562f6bef8eb4b7f85468a6028e877c57",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 25.93548387096774,
"alnum_prop": 0.6405472636815921,
"repo_name": "pablodav/burp_server_reports",
"id": "33b55283aa5738c91be1a826afc864cf785794bd",
"... |
try:
from .currentenv import *
except ImportError:
# going to assume that we are in prod and make use of prod settings
from prod import *
| {
"content_hash": "b5f29ef4689de3e52d9534614e1aed9a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 71,
"avg_line_length": 30,
"alnum_prop": 0.7066666666666667,
"repo_name": "reinbach/tutorus",
"id": "341eed37ced299beeeef10f86fd7f40fc25a9ee8",
"size": "150",
"binary": fa... |
import rq_worker
if __name__ == '__main__':
rq_worker.start_worker("github_zip")
| {
"content_hash": "40ab38b8043a5f8baea3b390f11114f8",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 40,
"avg_line_length": 21.5,
"alnum_prop": 0.6046511627906976,
"repo_name": "total-impact/depsy",
"id": "44d909fb3d1d03f73654de3f9635745756c30c73",
"size": "86",
"binary":... |
from ._UniqueID import *
| {
"content_hash": "61cd18beadb8a8c8fa879d32704e3107",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 25,
"alnum_prop": 0.72,
"repo_name": "superdyzio/PWR-Stuff",
"id": "c2c2533bd56e7403c1485a795038f6da7bc9925c",
"size": "25",
"binary": false,
"cop... |
from arcpy import GetParameterAsText
from esri2open import writeFile, prepareGeoJSON, closeJSON
#compute the peramaters
features = GetParameterAsText(0).split(";")
outJSON=GetParameterAsText(1)
includeGeometry = "geojson"
fileType = "geojson"
out=prepareGeoJSON(outJSON)
first=True#this makes sure sure we arn't ... | {
"content_hash": "8c737cf0339f97c2492275b68fd3cce0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 58,
"avg_line_length": 34.6,
"alnum_prop": 0.7418111753371869,
"repo_name": "opendata/esri2open",
"id": "27365d05bedfa7acd6dfe46100b2ffcc6c7b5755",
"size": "519",
"binary... |
from setuptools import setup, find_packages
# perform the install
setup(
name='girder-audit-logs',
version='0.2.0a1',
description='Keeps detailed logs of every REST request and low-level file download event.',
author='Kitware, Inc.',
author_email='kitware@kitware.com',
license='Apache 2.0',
... | {
"content_hash": "f47ff1d72f7a6ef9c7ff54496c86d77c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 95,
"avg_line_length": 31.774193548387096,
"alnum_prop": 0.6081218274111675,
"repo_name": "kotfic/girder",
"id": "f1c7ec04143e26f4579be800e1bd0987baa0d868",
"size": "1779",... |
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
from salttesting.helpers im... | {
"content_hash": "395ef458f4b22531354c3e4ffad3ac4a",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 83,
"avg_line_length": 27.28735632183908,
"alnum_prop": 0.5855096882898062,
"repo_name": "stephane-martin/salt-debian-packaging",
"id": "ab1a698056c7ca50afda7f453ec8439fbf93c... |
from __future__ import absolute_import, division, print_function
"""
Testing the cli
"""
##############################################################################
# Imports
##############################################################################
import contextlib
import sys # late import to avoid breaki... | {
"content_hash": "1b962e1d58636d4695bee514832cf244",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 124,
"avg_line_length": 40.2212389380531,
"alnum_prop": 0.5938393839383939,
"repo_name": "pyros-dev/ros1_template",
"id": "98da2ec67be94308c999ca80910d32608a1af97d",
"size... |
from go import strings
from go import regexp
#from go import os
from go import io/ioutil
from go import net
from . import dns
from . import flag
from . import hexdump
PORT = flag.Int('port', 0, 'UDP port to listen on for DNS.')
UDPMAX = 512 # Should be enough bytes for DNS packets.
# [1] is Before the quote, [2] is... | {
"content_hash": "c427a922a4e956a1f09eb1a85d77b8a9",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 91,
"avg_line_length": 23.764705882352942,
"alnum_prop": 0.568069306930693,
"repo_name": "strickyak/aphid",
"id": "9162450a207663651a25fc02a1d1ecc26a05c875",
"size": "5324... |
import sys
sys.path.insert(0, "../../python")
import os.path
import mxnet as mx
from config_util import get_checkpoint_path, parse_contexts
from stt_metric import STTMetric
#tensorboard setting
from tensorboard import SummaryWriter
import json
from stt_bucketing_module import STTBucketingModule
def get_initializer(... | {
"content_hash": "34ae1689904a8264964a644d9558fd4b",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 207,
"avg_line_length": 43.917647058823526,
"alnum_prop": 0.6467988213233324,
"repo_name": "lxn2/mxnet",
"id": "f3a7555529e3d2c223b0e4b9936ccc7077d7139d",
"size": "7466",
... |
from setuptools import setup, find_packages, Extension
from pkgutil import get_importer
from collections import defaultdict
from functools import wraps
from distutils import sysconfig
import re
from fnmatch import fnmatch
from os.path import join
import os
def find(directory, patterns):
result = []
for node, ... | {
"content_hash": "1cfc2fcbf045797418209472ebadd762",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 78,
"avg_line_length": 29.06508875739645,
"alnum_prop": 0.5846905537459284,
"repo_name": "concordusapps/python-hummus",
"id": "dd5c7421f00eac47354be40f6011b9afcba03077",
"... |
import base64
import copy
import sys
import time
from webkitpy.layout_tests.port import DeviceFailure, Driver, DriverOutput, Port
from webkitpy.layout_tests.port.base import VirtualTestSuite
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
from webkitpy.layout_tests.models import test_run_... | {
"content_hash": "db0e95fcfdb18947d136a6d67405b091",
"timestamp": "",
"source": "github",
"line_count": 620,
"max_line_length": 150,
"avg_line_length": 43.88709677419355,
"alnum_prop": 0.664571848585079,
"repo_name": "crosswalk-project/blink-crosswalk",
"id": "c4399b7232fc0c2119a326082557decafab2a072... |
import os
import sys
import time
import traceback
import warnings
import lib.pool
SQL_QUERY = 'SELECT {columns} FROM {table} WHERE project_id = {project_id}'
SQL_INSERT = 'INSERT INTO {table}({columns}) VALUES ({placeholders})'
SQL_UPDATE = '''
UPDATE {table}
SET {placeholders}
WHERE project_id = {project... | {
"content_hash": "9de0e2899851a31272e8ac3c62c10683",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 78,
"avg_line_length": 35.965753424657535,
"alnum_prop": 0.5299942868025138,
"repo_name": "RepoReapers/reaper",
"id": "e648a85160c183e9eea1900b261893b7c38dd06e",
"size": "... |
"""Check the DEPS file for correctness."""
import os
import re
import subprocess
import sys
import utils
INFRA_BOTS_DIR = os.path.dirname(os.path.realpath(__file__))
SKIA_DIR = os.path.abspath(os.path.join(INFRA_BOTS_DIR, os.pardir, os.pardir))
def main():
"""Load the DEPS file and verify that all entries are ... | {
"content_hash": "928716827e6ddc865c76dcf378bb1fff",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 28.75,
"alnum_prop": 0.6260869565217392,
"repo_name": "endlessm/chromium-browser",
"id": "6f3106643d1e9c8c289a6cf75bbc2ac061ffa8b2",
"size": "1768",
... |
import abc
import six
import struct
from . import packet_base
from . import icmpv6
from . import tcp
from . import udp
from . import sctp
from . import in_proto as inet
from ryu.lib import addrconv
from ryu.lib import stringify
IPV6_ADDRESS_PACK_STR = '!16s'
IPV6_ADDRESS_LEN = struct.calcsize(IPV6_ADDRESS_PACK_STR)
I... | {
"content_hash": "ff3ecb0c12146a48e0edd441f7b3a643",
"timestamp": "",
"source": "github",
"line_count": 584,
"max_line_length": 78,
"avg_line_length": 34.707191780821915,
"alnum_prop": 0.49380827865212884,
"repo_name": "noobcoderT/ryu-3.21",
"id": "8d0a82eb5632fe9598c49edb097cd6a79bf4c4c1",
"size":... |
from django.conf import settings
from corehq.apps.groups.models import Group
from dimagi.utils.decorators.memoized import memoized
from pillowtop.listener import AliasedElasticPillow
from .mappings.group_mapping import GROUP_INDEX, GROUP_MAPPING
from .base import HQPillow
class GroupPillow(HQPillow):
"""
Sim... | {
"content_hash": "1c71d8c62171abacf50c9e62f4563d96",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 62,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7386759581881533,
"repo_name": "gmimano/commcaretest",
"id": "40f9f1387e839679ee4202d895e8bab45afa0626",
"size": ... |
"""The tests for the MQTT discovery."""
from unittest.mock import patch
from homeassistant.components import mqtt
from homeassistant.components.mqtt.discovery import (
ALREADY_DISCOVERED, async_start)
from homeassistant.const import STATE_OFF, STATE_ON
from tests.common import MockConfigEntry, async_fire_mqtt_mes... | {
"content_hash": "e28ec36116b173cac3cdd7c085c6bf4b",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 79,
"avg_line_length": 32.714285714285715,
"alnum_prop": 0.6345060558622394,
"repo_name": "MartinHjelmare/home-assistant",
"id": "42513a2e9007d21dbf942622bd3b3cb2eef94f60",
... |
'''
This module includes the implementation of an object which periodically sends
events and also sends events in response to receiving a particular type of
event.
TODO LIST:
- generating the event using user-defined code does not work yet
- there is some problem with the Scheduler where events are being sent... | {
"content_hash": "d4d9532ae99745e75bf7b905f0e2ed67",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 107,
"avg_line_length": 40.146067415730336,
"alnum_prop": 0.5272180240694094,
"repo_name": "csrg-utfsm/acscb",
"id": "210585a4fbded7090b18d3c596c646eba23c3d5c",
"size": "1... |
from common.dbhelper import SQLTable
def get_code_for_title(title, tablename):
return get_instance().get_code_for_title(title, tablename)
def get_title_for_code(code, tablename):
return get_instance().get_title_for_code(code, tablename)
def add_tracker(tablename, mode):
return get_instance().add_tracker(... | {
"content_hash": "242bac1ef41d806ee4e054db797f1006",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 76,
"avg_line_length": 31.638009049773757,
"alnum_prop": 0.5765160183066361,
"repo_name": "sonya/eea",
"id": "50c860381cf76456b6e8d5d17f623859172f9050",
"size": "7572",
... |
import jinja2
from flask import Flask
from flask import jsonify
from flask import request
import model
import report_generator
app = Flask(__name__)
app.config['DEBUG'] = True
@app.errorhandler(404)
def page_not_found(e):
"""Return a custom 404 error."""
return 'Sorry, nothing at this URL.', 404
@app.rou... | {
"content_hash": "d0538c902aea9caa7bc01875ecfed171",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 79,
"avg_line_length": 30.317073170731707,
"alnum_prop": 0.6938857602574416,
"repo_name": "rekab/papt",
"id": "b3aff2843ed2cb23f6fbfbadbf8d7de4dfeee9d5",
"size": "2486",
... |
#!/usr/bin/env python
from xml.etree import ElementTree
from xml.dom import minidom
import json
import string
import re
import sys
import tempfile
def prettify(rawxml, indent=" "):
"""Return a pretty-printed XML string"""
reparsed = minidom.parseString(rawxml)
return reparsed.toprettyxml(indent)
def n... | {
"content_hash": "9e532f9c3b2d74c2f54b9b01c38b2148",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 138,
"avg_line_length": 41.40925266903915,
"alnum_prop": 0.526727397731179,
"repo_name": "sourcepole/ogrtools",
"id": "9d8ce7d5a43cb826ea15f2c06812cb6d0483beed",
"size": "... |
from __future__ import absolute_import
from __future__ import print_function
from typing import (
AbstractSet, Any, AnyStr, Callable, Dict, Iterable, Mapping, MutableMapping,
Optional, Sequence, Set, Text, Tuple, TypeVar, Union
)
from django.utils.html import escape
from django.utils.translation import ugettex... | {
"content_hash": "e2f8d72e5c933589d66efca3749f4bc4",
"timestamp": "",
"source": "github",
"line_count": 3766,
"max_line_length": 223,
"avg_line_length": 44.40706319702602,
"alnum_prop": 0.6227449667238709,
"repo_name": "niftynei/zulip",
"id": "e704702b9fb00f209a29403e86c72c61d2f6d473",
"size": "167... |
from Graph import *
import Queue
"""
Construct the graph with a series of obstacles that can still be navigated around
Source: http://www.redblobgames.com/pathfinding/a-star/introduction.html
"""
xSize = 5
ySize = 10
obstacles = [(0,1), (2,4), (2,5),
(2,6), (4,2), (4,3),
(2,0), (2,1), (2,2),
... | {
"content_hash": "b77e506e1374ea190718b98a4f949dad",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 83,
"avg_line_length": 25.488888888888887,
"alnum_prop": 0.6756756756756757,
"repo_name": "lukemerrett/PathFindingInPython",
"id": "97ab22de3a1daa327ff238cac99cfd0578c6a680",... |
"""Reproduce an Light state."""
from __future__ import annotations
import asyncio
from collections.abc import Iterable
import logging
from types import MappingProxyType
from typing import Any, cast
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STAT... | {
"content_hash": "79c106b83152288609fcc54f70c20396",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 118,
"avg_line_length": 29.31924882629108,
"alnum_prop": 0.6257806244995997,
"repo_name": "FreekingDean/home-assistant",
"id": "77e5742bbab53462030e7d6fce21a5fe67455bb0",
... |
"""Implementation of an image service that uses Glance as the backend."""
from __future__ import absolute_import
import copy
import itertools
import json
import random
import sys
import time
import glanceclient
import glanceclient.exc
from oslo.config import cfg
import six
import six.moves.urllib.parse as urlparse
... | {
"content_hash": "39bdc212b2f02a1969f76d5ace0d70f6",
"timestamp": "",
"source": "github",
"line_count": 612,
"max_line_length": 79,
"avg_line_length": 36.287581699346404,
"alnum_prop": 0.5991084293948127,
"repo_name": "nkrinner/nova",
"id": "cb3bd6585845dd56829831878b703a70448d2282",
"size": "22844... |
import splunktaforpuppetenterprise_declare
import os
import sys
import time
import datetime
import json
import modinput_wrapper.base_modinput
from solnlib.packages.splunklib import modularinput as smi
import input_module_puppet_enterprise_overview_enforcement as input_module
bin_dir = os.path.basename(__file__)
... | {
"content_hash": "ad2f6288394c476a7fef80252d2d082c",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 214,
"avg_line_length": 45.970588235294116,
"alnum_prop": 0.5941565365749627,
"repo_name": "domeger/SplunkTAforPuppetEnterprise",
"id": "ef71982e340b7227acb8795c2cd543cce7a6... |
import logging
# Dagda logger class
class DagdaLogger(logging.Logger):
# -- Init
logging.basicConfig(format='<%(asctime)s> <%(levelname)s> <DagdaServer> <%(module)s> <%(funcName)s:%(lineno)d> ' +
'<%(message)s>')
_logger = logging.getLogger('DagdaLogger')
_logger.setLe... | {
"content_hash": "9e0c2f56c954025f0fb856d5c84c60a5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 118,
"avg_line_length": 24.11111111111111,
"alnum_prop": 0.5944700460829493,
"repo_name": "eliasgranderubio/dagda",
"id": "53d5527e21aea038f90018657db3a989ff436e78",
"size"... |
"""
Tests that test the value of individual items
"""
from unittest import TestCase
import validictory
class TestEnum(TestCase):
schema = {"enum": ["test", True, 123, ["???"]]}
schema2 = {"enum": ("test", True, 123, ["???"])}
def test_enum_pass(self):
data = ["test", True, 123, ["???"]]
... | {
"content_hash": "a62ab81fb13d965d334ac8d26bd4beec",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 79,
"avg_line_length": 31.425891181988742,
"alnum_prop": 0.5636417910447761,
"repo_name": "simon-weber/validictory",
"id": "61dc5c61416dd214dbc67fcc332c371426776e44",
"siz... |
from warnings import warn
import pandas as pd
from zipline.assets import Asset
from zipline.utils.input_validation import expect_types
from .utils.enum import enum
from zipline._protocol import BarData # noqa
# Datasource type should completely determine the other fields of a
# message with its type.
DATASOURCE_TY... | {
"content_hash": "33aaf6214cb1ab00c6a500373a4331ab",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 79,
"avg_line_length": 27.396491228070175,
"alnum_prop": 0.5642930327868853,
"repo_name": "florentchandelier/zipline",
"id": "5d94434733a11e486637718f39fb9196b713d679",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.