text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import logging
import os
import pendulum
import unittest
import time
from airflow import configuration, models, settings, AirflowException
from airflow.e... | {
"content_hash": "ca276bc34074704d1b92b5f810176216",
"timestamp": "",
"source": "github",
"line_count": 1585,
"max_line_length": 102,
"avg_line_length": 37.01829652996845,
"alnum_prop": 0.578177727784027,
"repo_name": "KL-WLCR/incubator-airflow",
"id": "3bab3cf043ab3538d70d1136cc74bcad1e6aedbf",
"s... |
'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.split()
words = []
for w in text:
if w in words:
continue
wo... | {
"content_hash": "59ae33a242b3afd8ffc94055c1e75d63",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 119,
"avg_line_length": 17.481927710843372,
"alnum_prop": 0.6409372846312887,
"repo_name": "LiaoPan/kaggle-advertised-salaries",
"id": "b67047752da8d3b14f77c0bcfc653450d38143... |
"""
Implementation of the DNS protocol for use in Pants.
"""
###############################################################################
# Imports
###############################################################################
import collections
import itertools
import os
import random
import socket
import struct... | {
"content_hash": "d4de807e197724078a19307429f086f3",
"timestamp": "",
"source": "github",
"line_count": 1173,
"max_line_length": 313,
"avg_line_length": 31.86018755328218,
"alnum_prop": 0.48905597773734344,
"repo_name": "ecdavis/pants",
"id": "fc3c922cf1e1fa791b30248fd74cce7e2fb958bb",
"size": "381... |
from src.Chart import Chart
from src.ColorSelector import ColorSelector
import os
def export_charts(title, desc, charts):
export = ''
export += '<html>'
export += get_header()
export += '<br/><div class="container">'
export += '<div class="row">'
export += '<div class="col-md-6"><div clas... | {
"content_hash": "05469c71dfbf7d527795becef9dc6bd1",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 137,
"avg_line_length": 27.271844660194176,
"alnum_prop": 0.5494838020647917,
"repo_name": "EliCDavis/PyChart",
"id": "3fde20acd4ae14d5c732f042256b671cf592bfa3",
"size": "... |
import numbers
import numpy as np
from scipy.sparse import issparse
from warnings import warn
from ..tree import ExtraTreeRegressor
from ..utils import (
check_random_state,
check_array,
gen_batches,
get_chunk_n_rows,
)
from ..utils.fixes import _joblib_parallel_args
from ..utils.validation import chec... | {
"content_hash": "a1e299bd3f6b21bf13f8a6409699a985",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 87,
"avg_line_length": 36.35852713178294,
"alnum_prop": 0.605671339480838,
"repo_name": "shyamalschandra/scikit-learn",
"id": "375a1b60874df229c057bac38757a2d7389cf994",
"... |
import Globals
try:
from collections import OrderedDict
except ImportError: # pragma: no coverage
from ordereddict import OrderedDict
from AccessControl import ClassSecurityInfo
from Products.CMFPlone.utils import safe_unicode
class AlphaBatch(object):
"""Object used to batch results alphabetically.
... | {
"content_hash": "f634fb2c2efb926c16555413bfa0a466",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 77,
"avg_line_length": 31.31858407079646,
"alnum_prop": 0.5049448996891778,
"repo_name": "collective/Products.UserAndGroupSelectionWidget",
"id": "4508cbe084d5d7ca4ab56bf4ac... |
"""Tools to parse and validate a MongoDB URI."""
from urllib import unquote_plus
from pymongo.common import validate
from pymongo.errors import (ConfigurationError,
InvalidURI,
UnsupportedOption)
SCHEME = 'mongodb://'
SCHEME_LEN = len(SCHEME)
DEFAULT_PORT = 27... | {
"content_hash": "604f0d255fea43e5ac756b29f3a51a3a",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 79,
"avg_line_length": 33.29712460063898,
"alnum_prop": 0.5797351755900979,
"repo_name": "deathping1994/sendmail-api",
"id": "50d7420fc5834f2a5d468482cbe663676127b843",
"s... |
import logging
import unittest
import os
import re
import time
import grpc
from google.rpc import code_pb2, status_pb2
import cirque.proto.capability_pb2 as capability_pb2
import cirque.proto.device_pb2 as device_pb2
import cirque.proto.service_pb2 as service_pb2
import cirque.proto.service_pb2_grpc as service_pb2_gr... | {
"content_hash": "ccbdcc2576be5e720b77ddb8918ce55e",
"timestamp": "",
"source": "github",
"line_count": 334,
"max_line_length": 80,
"avg_line_length": 32.544910179640716,
"alnum_prop": 0.6354185832566698,
"repo_name": "openweave/cirque",
"id": "e1ae9662a0926eec92f914a312b10dfa701848fb",
"size": "12... |
from ..core import *
import ctypes
lib.ElPermutationMetaSet.argtypes = [c_void_p,c_void_p,c_void_p]
lib.ElPermutationMetaClear.argtypes = [c_void_p]
lib.ElPermutationMetaTotalSend.argtypes = [c_void_p,POINTER(c_int)]
lib.ElPermutationMetaTotalRecv.argtypes = [c_void_p,POINTER(c_int)]
lib.ElPermutationMetaScaleUp.argty... | {
"content_hash": "ea9aa221f246d936e8bd27ffe8bfb906",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 75,
"avg_line_length": 39.54255319148936,
"alnum_prop": 0.6957223567393059,
"repo_name": "justusc/Elemental",
"id": "1b92a41a1ffb79168c92c4e6af70441f9f010a1b",
"size": "18... |
from datetime import datetime
GAME_VIDEO_BASE_URL = "http://www.nfl.com/feeds-rs/videos/byGameCenter/{0}.json"
LIVE_UPDATE_BASE_URL = "http://www.nfl.com/liveupdate/game-center/{0}/{0}_gtd.json"
class Game(object):
def __init__(self, id_, h, v):
self.id_ = id_
self.date = self.id_[:-2]
s... | {
"content_hash": "df96ac5f213c2ccc68543ba8cf22a6c8",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 83,
"avg_line_length": 28.16,
"alnum_prop": 0.5894886363636364,
"repo_name": "twbarber/nfl-highlight-bot",
"id": "73a6559d84f7e8e31ac4003082676f9872226364",
"size": "704",
... |
from .alloy_composition_descriptor import AlloyCompositionDescriptor
from .categorical_descriptor import CategoricalDescriptor
from .inorganic_descriptor import InorganicDescriptor
from .int_descriptor import IntDescriptor
from .organic_descriptor import OrganicDescriptor
from .real_descriptor import RealDescriptor
fro... | {
"content_hash": "830b7ecf6dea1dbf28db2e08d7c9cefc",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 68,
"avg_line_length": 53.57142857142857,
"alnum_prop": 0.8853333333333333,
"repo_name": "CitrineInformatics/python-citrination-client",
"id": "c7c6d5acf77500a56a683ebd5472777... |
import os
import subprocess
def returns_on_fail(return_value):
def decorator(func):
def inner(*args, **kwargs):
try:
return func(*args, **kwargs)
except subprocess.CalledProcessError:
return return_value
return inner
return decorator
cl... | {
"content_hash": "e3b2bae7d8191332f310e4e1c7d81c49",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 60,
"avg_line_length": 23.126984126984127,
"alnum_prop": 0.6424159231297186,
"repo_name": "giginet/django-debug-toolbar-vcs-info",
"id": "04c90089be67415534742db48c1ba30b43cd... |
import os, errno, json
import modules
from modules.misctools import mkdir_p
import datetime
bot=None
def logger(messageId, jid, messageContent, timestamp, wantsReceipt, pushName, isBroadcast):
path=os.path.join('logs','incoming',jid)
if not os.path.exists(path):
os.makedirs(path)
filepath=os.path.join(pa... | {
"content_hash": "c61545d81998957798b21037aabbba26",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 105,
"avg_line_length": 43.3,
"alnum_prop": 0.7927251732101617,
"repo_name": "siyei/python-whatsapp-bot",
"id": "589550a331bc7c6c873138618412625fd67b203d",
"size": "1732",
... |
"""
@package mi.instrument.mclane.driver
@file marine-integrations/mi/instrument/mclane/driver.py
@author Dan Mergens
@brief Driver base class for McLane instruments
Release notes:
initial version
"""
import datetime
__author__ = 'Dan Mergens'
__license__ = 'Apache 2.0'
import re
import time
from mi.core.log import... | {
"content_hash": "ab3c58c59e4018cabc9014f1b1d12408",
"timestamp": "",
"source": "github",
"line_count": 1255,
"max_line_length": 120,
"avg_line_length": 40.23824701195219,
"alnum_prop": 0.5660508128873839,
"repo_name": "ronkyo/mi-instrument",
"id": "b92f8511a269221d68dc322b7a4b926f04668567",
"size"... |
import ast
import os
import re
try:
from distutils.util import get_platform
is_windows = get_platform().startswith("win")
except ImportError:
# Don't break install if distuils is incompatible in some way
# probably overly defensive.
is_windows = False
try:
from setuptools import setup
except Im... | {
"content_hash": "fedae804fe19af4cecf160d61b87b2fb",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 102,
"avg_line_length": 33.65151515151515,
"alnum_prop": 0.6391265195857722,
"repo_name": "natefoo/pulsar",
"id": "be1c332481bee3c1e3d3cb7ac4d67e80a1d9efee",
"size": "4442... |
from django.apps import AppConfig
class SayingsConfig(AppConfig):
name = 'sayings'
| {
"content_hash": "659d2959584a8737657e9131d23ef27f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.8,
"alnum_prop": 0.7528089887640449,
"repo_name": "migdall/quickblog",
"id": "9b6439361a3e3f8dce64560b554f1408baa88808",
"size": "89",
"binary": ... |
import io
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from implib2.imp_eeprom import EEPROM
class TestEEPROM:
def test_init_ReadsData(self):
data = io.StringIO(u'255\n255\n255')
with patch('implib2.imp_eeprom.open', create=True) as mock_open:
... | {
"content_hash": "288251b081477be63352ce684c2d00cc",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 72,
"avg_line_length": 34.145161290322584,
"alnum_prop": 0.5762871988663203,
"repo_name": "mhubig/implib2",
"id": "b1b2e04f3afc22f5bb74f3dd7d185363eb818b61",
"size": "2142"... |
def voter_guide_followers_retrieve_doc_template_values(url_root):
"""
Show documentation about voterGuideFollowersRetrieve
"""
required_query_parameter_list = [
{
'name': 'voter_device_id',
'value': 'string', # boolean, integer, long, string
'd... | {
"content_hash": "1cc3762808d162a02a2dc353bbf03065",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 119,
"avg_line_length": 46.40909090909091,
"alnum_prop": 0.5012242899118511,
"repo_name": "wevote/WeVoteServer",
"id": "ab38b38219ef21111e1f85bc84f383fa55f3a936",
"size": "... |
"""Sana mDS Django admin interface
:Authors: Sana dev team
:Version: 2.0
"""
from django.contrib import admin
from django.forms.models import modelformset_factory
from .models import *
class UuidHackInline(admin.StackedInline):
def __init__(self,*args):
super(admin.StackedInline,self).__init__(self,*ar... | {
"content_hash": "16dfa7adcd7d59c2d4875986a200b902",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 102,
"avg_line_length": 31.723214285714285,
"alnum_prop": 0.6963129749507458,
"repo_name": "dekatzenel/team-k",
"id": "1c9a93eb313a8a3953017bcf620d818de9c5d22c",
"size": "... |
import os
import plistlib
import sys
#==== This should be modified to match your environment ====
REPO_ROOT = '/Volumes/its_munki_repo'
#-----------------------------------------------------------
manifest_path = os.path.join(REPO_ROOT, 'manifests')
script_path = os.path.dirname(os.path.realpath(sys.argv[0]))
def in... | {
"content_hash": "882f599748ce4b5f86fbad3e8ab15086",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 83,
"avg_line_length": 34.48076923076923,
"alnum_prop": 0.6257668711656442,
"repo_name": "vmiller/Munki-Helper-Scripts",
"id": "412c345be8c3619223813893856bfe468e06d55c",
"... |
import sys, codecs
import unittest, re
from httplib import HTTPException
from test import test_support
from StringIO import StringIO
class TestBase:
encoding = '' # codec name
codec = None # codec tuple (with 4 elements)
tstring = '' # string to test StreamReader
codectest... | {
"content_hash": "39cbbb88fa8dc11281b9f7eed3d8f924",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 81,
"avg_line_length": 38.08,
"alnum_prop": 0.5245636716224952,
"repo_name": "xxd3vin/spp-sdk",
"id": "0639032a2dd475efb7522e89a3633e81173e40a5",
"size": "12480",
"binar... |
from django.test import TestCase, Client
from bs4 import BeautifulSoup
from django.core import mail
from django.contrib.auth.models import User
import factory
class UserFactory(factory.Factory):
class Meta:
model = User
username = 'testsubject1'
first_name = 'Chell'
last_name = '[REDACTED]'
... | {
"content_hash": "f1b99c52425f69c7a9afc799fe625f15",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 71,
"avg_line_length": 31.83783783783784,
"alnum_prop": 0.5789473684210527,
"repo_name": "gatita/django-imager",
"id": "7ab587967ae7bf7ea62f1a49bed7bd8bb3c7a907",
"size": ... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016-2020 CNRS
# 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 limita... | {
"content_hash": "612173ab3fff78dfdb2278cb7e428076",
"timestamp": "",
"source": "github",
"line_count": 531,
"max_line_length": 85,
"avg_line_length": 27.657250470809792,
"alnum_prop": 0.5843660629170638,
"repo_name": "pyannote/pyannote-database",
"id": "8a7de9cc1884ff51e36d4c6e8fa1128fa7e38947",
"... |
import os
from subprocess import Popen, PIPE
import networkx as nx
import matplotlib.pyplot as plt
def solve_it(input_data):
# Writes the inputData to a temporay file
tmp_file_name = 'tmp.data'
tmp_file = open(tmp_file_name, 'w')
tmp_file.write(input_data)
tmp_file.close()
# Runs the command... | {
"content_hash": "8703f009c10bc36846fc160b78e035a6",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 131,
"avg_line_length": 28.08695652173913,
"alnum_prop": 0.6006191950464397,
"repo_name": "srmanikandasriram/discrete-optimization-coursera",
"id": "20cea6a26b696bfae30d5cb3f... |
__author__ = 'vden'
from model.group import Group
from model.contact import Contact
import random
def test_add_contact_in_group(app, orm):
if len(orm.get_group_list()) == 0:
app.group.create(Group(name="test"))
groups = orm.get_group_list()
group = random.choice(groups)
index = 0
for m in ... | {
"content_hash": "a65644ebd619ba7d12abd58bc511a3b3",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 101,
"avg_line_length": 33.370370370370374,
"alnum_prop": 0.6625971143174251,
"repo_name": "vdenPython/python_training",
"id": "4f0ac71d039d9041ab483260b4f8560433564876",
"... |
"""
Pagination fields
"""
# pylint: disable=no-init, too-few-public-methods, no-self-use
from collections import OrderedDict
from rest_framework import serializers
from rest_framework import pagination
from rest_framework.views import Response
from rest_framework.templatetags.rest_framework import replace_query_param
... | {
"content_hash": "102f52597f8118a1b5f320a3ca534825",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 74,
"avg_line_length": 28.401408450704224,
"alnum_prop": 0.6273245722787008,
"repo_name": "hnakamur/django-rest-framework-json-api",
"id": "85d660af6b512fd3d320e06fec665aee3... |
import sqlalchemy
from sqlalchemy import Column
from pp.db import Base
class TestTable(Base):
__tablename__ = 'test'
id = Column(sqlalchemy.types.String(36), primary_key=True, nullable=False, unique=True)
foo = Column(sqlalchemy.types.String(200), nullable=False)
def init():
"""Called to do the init... | {
"content_hash": "bd08ee079435788c9e6d8c7990c8eb01",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 91,
"avg_line_length": 25.772727272727273,
"alnum_prop": 0.6931216931216931,
"repo_name": "pythonpro-dev/pp-db",
"id": "b5e7d66a7cf6da8b8ae4c93f09bb74034b85e3e4",
"size": "... |
"""Starter script for All cinder services.
This script attempts to start all the cinder services in one process. Each
service is started in its own greenthread. Please note that exceptions and
sys.exit() on the starting of a service are logged and the script will
continue attempting to launch the rest of the service... | {
"content_hash": "200cf70b4b4b6d7fc616a6f9f3da4c3c",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 79,
"avg_line_length": 36.43434343434343,
"alnum_prop": 0.6343221513723316,
"repo_name": "bswartz/cinder",
"id": "a5708f05bc3693caa79ca8fc42f0d507576bc2c0",
"size": "4392",... |
class Query:
def __init__(self):
self._parameters = {}
self._aliased_parameters = {}
self.param_order = None
self.orders = []
def add(self, name, **kwargs):
return self.add_param(
Parameter(name=name, **kwargs)
)
@property
def params(self):
... | {
"content_hash": "a7f1d292e394d258fd7c4d5dd0af3775",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 61,
"avg_line_length": 24.151515151515152,
"alnum_prop": 0.5692179004600586,
"repo_name": "cbrand/python-filterparams",
"id": "8a4fc30600950e8c3c091e7bd6094aee89cb6dce",
"s... |
import signal
def initialize_worker():
"""Initialize Worker
Sets worker processes to ignore SIGINT.
"""
signal.signal(signal.SIGINT, signal.SIG_IGN) | {
"content_hash": "0789c0458e7d099b564af87f7d665ebe",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 45,
"avg_line_length": 15.6,
"alnum_prop": 0.7435897435897436,
"repo_name": "kalail/queen",
"id": "f2a0e3d764055e6387e482fccdf374c9d12de90d",
"size": "156",
"binary": fal... |
"""The Exponential distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops import gamma
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
class Exponentia... | {
"content_hash": "71bd8802784b40fd5a4637968b6e01ff",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 71,
"avg_line_length": 28.151515151515152,
"alnum_prop": 0.6803013993541442,
"repo_name": "petewarden/tensorflow_makefile",
"id": "4652e6b3ec7da57c4a00e877af8f905ebd8acb22",
... |
default_app_config = 'django_yubikey_admin.apps.YubiKeyConfig'
| {
"content_hash": "d63db32a8816327f54c3da2356019621",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 62,
"avg_line_length": 63,
"alnum_prop": 0.8095238095238095,
"repo_name": "LyricalSecurity/django-yubikey-admin",
"id": "4597817453ff821ac999e3c12d58cf45cd046e40",
"size": "... |
import abc
import inspect
import importlib_metadata
from stevedore import extension
from cliff import _argparse
_dists_by_mods = None
def _get_distributions_by_modules():
"""Return dict mapping module name to distribution names.
The python package name (the name used for importing) and the
distributio... | {
"content_hash": "6a664b63f1f51ee1fadb0814b6caf674",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 78,
"avg_line_length": 34.14356435643565,
"alnum_prop": 0.6011309264897782,
"repo_name": "openstack/cliff",
"id": "f8e38ad5bb6cd03f261ab95d6775551a6f502d10",
"size": "7452... |
from __future__ import with_statement
from datetime import datetime
from mock import patch
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from proccer.database import Job, JobResult
from proccer.t.testing import setup_module
from proccer.t.test_mail import ok_result
from proccer.app impor... | {
"content_hash": "ff0699b04f1a5894fca2b7b75e8412f4",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 62,
"avg_line_length": 26,
"alnum_prop": 0.6095947063688999,
"repo_name": "CSIS/proccer",
"id": "d6a2361e3c90c40a2d510046978b50a0da9e1f56",
"size": "2418",
"binary": fals... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | {
"content_hash": "704946f14ab1dc3c09950cee27e0bffe",
"timestamp": "",
"source": "github",
"line_count": 1073,
"max_line_length": 80,
"avg_line_length": 40.769804287045666,
"alnum_prop": 0.6855026745302427,
"repo_name": "levibostian/myBlanky",
"id": "5c041bc0212ea25584de0307c165f20a86f2bb8a",
"size"... |
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.contrib.auth.models import User, Group
from ..models import Configuration
from .configuration import ConfigurationAdmin
admin.site.register(Configuration, ConfigurationAdmin)
| {
"content_hash": "5fca4a00f4aa36ef4a0b41e4da2ab857",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 56,
"avg_line_length": 28.1,
"alnum_prop": 0.8291814946619217,
"repo_name": "globocom/database-as-a-service",
"id": "d7d9ecb1def4307585029f99958f23daa25e765b",
"size": "305... |
"""
Compute the Gacs-Korner common information
"""
from ...algorithms import insert_meet
from ...helpers import normalize_rvs, parse_rvs
from ...npdist import Distribution
from ...shannon import conditional_entropy as H
from ...utils import unitful
@unitful
def gk_common_information(dist, rvs=None, crvs=None, rv_mod... | {
"content_hash": "f9f40b1a3ca996e3c139b53b197f063c",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 79,
"avg_line_length": 33.55555555555556,
"alnum_prop": 0.6617786187322611,
"repo_name": "Autoplectic/dit",
"id": "2a654f6739482b65f3329891facfc64a1f647a57",
"size": "2114"... |
from Exscript.util import crypt
from Exscript.stdlib.util import secure_function
@secure_function
def otp(scope, password, seed, seqs):
"""
Calculates a one-time password hash using the given password, seed, and
sequence number and returns it.
Uses the md4/sixword algorithm as supported by TACACS+ ser... | {
"content_hash": "052e7c17a67a535fda23d2c662feb0cc",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 31.904761904761905,
"alnum_prop": 0.6865671641791045,
"repo_name": "knipknap/exscript",
"id": "970f3ed367260f3ae0f1b982bcde506cce2d1ebe",
"size": "17... |
"""
Copyright 2022, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | {
"content_hash": "0a57238a5e9727cf82c09b3883ce8ac7",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 96,
"avg_line_length": 25.892307692307693,
"alnum_prop": 0.6256684491978609,
"repo_name": "merraksh/cvxpy",
"id": "4e0d5d6caecc43b4aa2e9ee2af62d5421475da5c",
"size": "1683"... |
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000... | {
"content_hash": "20b555f291c7eb3a5fd7665829d3fef4",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 89,
"avg_line_length": 29.565420560747665,
"alnum_prop": 0.5376955903271693,
"repo_name": "yugang/crosswalk-test-suite",
"id": "3b073d5e0cebfe86cfa26120c6e7a57d6665e42d",
... |
import doctest
from custom.abt.reports import late_pmt_2020
def test_doctests():
results = doctest.testmod(late_pmt_2020)
assert results.failed == 0
| {
"content_hash": "4696da9ffb446463eb0dc356f928659a",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 44,
"avg_line_length": 20,
"alnum_prop": 0.73125,
"repo_name": "dimagi/commcare-hq",
"id": "a79f83ca75d7659e4874a2e793e540a47a2fe2e4",
"size": "160",
"binary": false,
"c... |
"""
.. module: security_monkey.views.poam
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Pritam D. Gautam <pritam.gautam@nuagedm.com> @nuagedm
"""
from sqlalchemy.orm import joinedload, aliased, load_only, defer
from security_monkey import db, rbac
from security_monkey.views import AuthenticatedServi... | {
"content_hash": "2e178bc9493c8ac72a091fc3a4bdcd40",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 171,
"avg_line_length": 37.143497757847534,
"alnum_prop": 0.49837015574067367,
"repo_name": "stackArmor/security_monkey",
"id": "9f1131870eb28b8fae50c0d28e79f82695f02030",
... |
"""Module that pre-processes the notebook for export to HTML.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed w... | {
"content_hash": "47172fdd6c67e1ce1faad3f2ecdd5a6c",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 84,
"avg_line_length": 29.72641509433962,
"alnum_prop": 0.5052364328784513,
"repo_name": "marcoantoniooliveira/labweb",
"id": "7f33fa9e780b8bbeffc111353976fcb698fdc9ec",
"... |
from tasks import request
url = 'https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json&formatversion=2'
result = request.delay(url)
response = result.get()
print(response.json()) | {
"content_hash": "5d5999c36335565dca6a5b75ec60b09d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 132,
"avg_line_length": 33.57142857142857,
"alnum_prop": 0.7787234042553192,
"repo_name": "sblancov/hello_world",
"id": "8807fb62cc97fe1f7bbab01c8c543a79394ccf1d",
"size": "... |
r"""
NLTK Tokenizer Package
Tokenizers divide strings into lists of substrings. For example,
tokenizers can be used to find the words and punctuation in a string:
>>> from nltk.tokenize import word_tokenize
>>> s = '''Good muffins cost $3.88\nin New York. Please buy me
... two of them.\n\nThanks.'''
... | {
"content_hash": "d9b8511b0e4ec1f04a875df86a649d3a",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 99,
"avg_line_length": 43.90163934426229,
"alnum_prop": 0.6786781179985063,
"repo_name": "arju88nair/projectCulminate",
"id": "b4b6dd7105ec544c20f6423baf87d210cb614a18",
"... |
import hashlib
import json
import time
import urllib
import requests
from requests import RequestException, ConnectionError, Timeout
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
from .api import ApiSpec
from .exceptions import ElongException, ElongAPIError, \
RetryableException, Retryabl... | {
"content_hash": "a3af305b21937599808d12fbe1168737",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 78,
"avg_line_length": 36.760736196319016,
"alnum_prop": 0.5539052069425902,
"repo_name": "DeanThompson/pyelong",
"id": "eb85f1e9e920e45a9cda0d9703f335d5b7a1e3bd",
"size":... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | {
"content_hash": "ac33226baf57a6b0416f3ac2e99f2f32",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 177,
"avg_line_length": 41.784615384615385,
"alnum_prop": 0.6049337260677466,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "e5faa6d725bc643da423dda3328a02d0cf025692",
... |
import select
# From python select module and Tornado source
_EPOLLIN = 0x001
_EPOLLPRI = 0x002
_EPOLLOUT = 0x004
_EPOLLERR = 0x008
_EPOLLHUP = 0x010
_EPOLLRDHUP = 0x2000
_EPOLLONESHOT = (1 << 30)
_EPOLLET = (1 << 31)
READ = _EPOLLIN
WRITE = _EPOLLOUT
ERROR = _EPOLLERR | _EPOLLHUP
MASK_ALL = 0xFFFF
class PollerImpl... | {
"content_hash": "2087e2bdc808e09f52d31cbdb16d541f",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 92,
"avg_line_length": 25.928934010152282,
"alnum_prop": 0.5644087705559906,
"repo_name": "mar29th/ring",
"id": "cde3ed8983b949f19922261750b28b1cb41a2424",
"size": "5712",... |
import fiona
# This module contains examples of opening files to get feature collections in
# different ways.
#
# It is meant to be run from the distribution root, the directory containing
# setup.py.
#
# A ``path`` is always the ``open()`` function's first argument. It can be
# absolute or relative to the working dir... | {
"content_hash": "fd69da7783d9e30202210ca900ae917c",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 30.96470588235294,
"alnum_prop": 0.6713525835866262,
"repo_name": "perrygeo/Fiona",
"id": "82e522264437a035da99d20e9031f0a35fab3257",
"size": "2633",... |
"""
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
N-dimensional cantilever beam problem.
"""
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.problems.problem import Problem
from smt.problems.reduced_problem import ReducedProble... | {
"content_hash": "0094257eb7273bbb4b3a410b3efa7eb9",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 31.133333333333333,
"alnum_prop": 0.6980728051391863,
"repo_name": "relf/smt",
"id": "30ad31616a417178b175b83d258207c111fad456",
"size": "934",
"bi... |
import argparse
import collections
from maas_common import get_openstack_client
from maas_common import metric
from maas_common import metric_bool
from maas_common import print_output
from maas_common import status_err
from maas_common import status_ok
# The actual stat names from novaclient are nasty, so this mappin... | {
"content_hash": "1666e3cf0dea9cb8f53507c878d4cf28",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 77,
"avg_line_length": 36.05172413793103,
"alnum_prop": 0.5248684839789575,
"repo_name": "npawelek/rpc-maas",
"id": "256c2a70f45d836914d83177f3ae383ec718d9a3",
"size": "47... |
from scipy.io import loadmat
import matplotlib.pyplot as plt
import numpy as np
def normalize_message(m):
return m / np.sum(m)
def belief_propagation(transition_prob, visible_to_hidden_prob, observations):
"""
My implementation
Used reference notes from
https://dl.dropboxusercontent.com/u/141153... | {
"content_hash": "7182fe68e9eb9ad54afa17dad2b86af1",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 91,
"avg_line_length": 32.747252747252745,
"alnum_prop": 0.5902684563758389,
"repo_name": "kastnerkyle/ift6085",
"id": "9aa70f9f1b72cb4921b518f6e4656403451e10b9",
"size": "... |
from __future__ import unicode_literals
import fnmatch
import glob
import io
import os
import re
import sys
from functools import total_ordering
from itertools import dropwhile
import django
from django.conf import settings
from django.core.files.temp import NamedTemporaryFile
from django.core.managemen... | {
"content_hash": "951299290b64c51469234497c163a4c6",
"timestamp": "",
"source": "github",
"line_count": 593,
"max_line_length": 108,
"avg_line_length": 42.22428330522766,
"alnum_prop": 0.5457486321338711,
"repo_name": "yephper/django",
"id": "c9550fcab3af646146f79f55c92ad52173021f87",
"size": "2503... |
__all__ = ['StatesSet']
class StatesSet:
STATE, CAPTURED = range(2)
def __init__(self):
self._list = []
self._set = set()
def __len__(self):
return len(self._list)
def __bool__(self):
return bool(self._list)
def __iter__(self):
yield from self._list
... | {
"content_hash": "1bbbabf0688cc85807e5583115ea04ed",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 49,
"avg_line_length": 20.384615384615383,
"alnum_prop": 0.5044025157232704,
"repo_name": "nitely/regexy",
"id": "549c9501282f3d09812cd57b127b6bef81fee83c",
"size": "821",
... |
from whoosh.qparser import QueryParser
import whoosh.index as index
from whoosh.fields import *
from whoosh import qparser
import argparse
import os
import time
import logging
class Timer(object):
def __init__(self, name=None, logger=None):
self.logger = logger
self.name = name
def __enter__... | {
"content_hash": "66b0ace280ff55d2a2403a5a193ac501",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 143,
"avg_line_length": 31.897196261682243,
"alnum_prop": 0.5493700556694989,
"repo_name": "bgshin/irqa",
"id": "d504e0066e9adf1224c95b916aeb5ff320c8ddbd",
"size": "3413",... |
import socket
import time
import threading
import json
import signal
import socketserver
socketserver.ThreadingTCPServer.allow_reuse_address = True
UUID_LEN = 32
monitor_ins_id = 'ab8bd7be5102545ea70d092b333d6631ab8bd7be5102545ea70d092b333d66314ec7c545c4504d3b89de49f067ce76c0'
class TCPHandler(socketserver.BaseReque... | {
"content_hash": "b0446c991b307a50891bd414c33877c3",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 115,
"avg_line_length": 26.670454545454547,
"alnum_prop": 0.6374094588836813,
"repo_name": "utam0k/c3os",
"id": "c4512d87a9cebc7a3602c2a1cd9ee01351c7024a",
"size": "2347",
... |
import numpy as np
from statsmodels.stats.correlation_tools import (
kernel_covariance, GaussianMultivariateKernel)
from numpy.testing import assert_allclose
def test_kernel_covariance():
np.random.seed(342)
# Number of independent observations
ng = 1000
# Dimension of the process
p = 3... | {
"content_hash": "fa2511cd3ceb1b6a7bb6da4ea9b0c3dc",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 71,
"avg_line_length": 28.7,
"alnum_prop": 0.5743321718931476,
"repo_name": "statsmodels/statsmodels",
"id": "9ee1b5531f958ff9cda3c84d41a62d8c70282c0c",
"size": "1722",
"... |
from test_managers import TestManager | {
"content_hash": "a0047a7b848258ddd30d7760d18bf7fd",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 37,
"avg_line_length": 37,
"alnum_prop": 0.8918918918918919,
"repo_name": "drtyrsa/django-cached-manager",
"id": "1e7b1bc2db51b29c0d0a562c857ccd12a138b8c1",
"size": "60",
... |
"""
Deep clustering
---------------
.. autoclass:: nussl.separation.deep.DeepClustering
:autosummary:
Deep mask estimation
--------------------
.. autoclass:: nussl.separation.deep.DeepMaskEstimation
:autosummary:
Deep audio estimation
---------------------
.. autoclass:: nussl.separation.deep.DeepAudioEst... | {
"content_hash": "ca89cacfa51fd4871a4e03afe3944b5a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 56,
"avg_line_length": 21,
"alnum_prop": 0.6964285714285714,
"repo_name": "interactiveaudiolab/nussl",
"id": "cd2037224d8c56c0cff1d748a1bf097f7e6a16ad",
"size": "504",
"b... |
from __future__ import absolute_import, division, print_function, unicode_literals
from botocore.exceptions import ClientError
import six
from c7n.manager import resources
from c7n.filters import FilterRegistry
from c7n.query import QueryResourceManager
from c7n.utils import local_session, type_schema
from c7n.actio... | {
"content_hash": "de180438a39c3805017337921b8db0bb",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 82,
"avg_line_length": 32.09475218658892,
"alnum_prop": 0.587318889948676,
"repo_name": "scotwk/cloud-custodian",
"id": "f5cf5d6aa96ed21b614faaabebf7b32c63630e28",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lotnisko', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='passenger',
name='id',
),
m... | {
"content_hash": "b91fa75cef1a315a8d666459458a2c64",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 25.821428571428573,
"alnum_prop": 0.5615491009681881,
"repo_name": "edek437/Zastosowanie-informatyki-w-gospodarce-projekt",
"id": "ed85c727876e41982888... |
from Chip import OpCodeDefinitions
from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase
class TestDeyOpCode(OpCodeTestBase):
def test_dey_implied_command_calls_dey_method(self):
self.assert_opcode_execution(OpCodeDefinitions.dey_implied_command, self.target.get_dey_command_executed)
| {
"content_hash": "2f3633b64a4c6ed3a076445baffc0c85",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 113,
"avg_line_length": 43.57142857142857,
"alnum_prop": 0.8163934426229508,
"repo_name": "jeroanan/Nes2",
"id": "0617b53f0161ad8448d043c3e032c2de3e6e7042",
"size": "305",
... |
import collections
import os
import eventlet
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from oslo_utils import importutils
from neutron.agent.linux import dhcp
from neutron.agent.linux import external_process
from neutron.agent.linux import utils as linux_utils
from neutron... | {
"content_hash": "5e6e98bddfe55eff79d757e956c5a87d",
"timestamp": "",
"source": "github",
"line_count": 574,
"max_line_length": 79,
"avg_line_length": 41.37282229965157,
"alnum_prop": 0.5835438773791477,
"repo_name": "pnavarro/neutron",
"id": "214bfdff14de3c55c2335d15866ed52301e02344",
"size": "243... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('leaflets', '0014_leaflet_publisher_person'),
]
operations = [
migrations.CreateModel... | {
"content_hash": "b8f2bd1a968747468cc1f0e3e6e8b323",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 172,
"avg_line_length": 41.25,
"alnum_prop": 0.6045454545454545,
"repo_name": "JustinWingChungHui/electionleaflets",
"id": "40b3bde1fd95265bf77784c59f4ed53a06727c25",
"size... |
"""
Current Fabric version constant plus version pretty-print method.
This functionality is contained in its own module to prevent circular import
problems with ``__init__.py`` (which is loaded by setup.py during installation,
which in turn needs access to this version information.)
"""
from subprocess import Popen, ... | {
"content_hash": "fb43115f83c7fabec4082c53f47d70ad",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 79,
"avg_line_length": 27.072164948453608,
"alnum_prop": 0.5495049504950495,
"repo_name": "ericholscher/fabric",
"id": "4cbcde0b367e93166057d669f3a6239f97ce3f73",
"size": "... |
def send_some_data(socket, data):
length = len(data)
header = b'SIZE:' + bytes(str(length), encoding='latin-1')
socket.send(header)
socket.send(data)
| {
"content_hash": "6eee4397d841d8170dbea0924d3140ef",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 62,
"avg_line_length": 33.2,
"alnum_prop": 0.6445783132530121,
"repo_name": "haarcuba/testix",
"id": "f5cdabff251f7efdd24e5bc3010e8ce2aaba4940",
"size": "167",
"binary": f... |
import netaddr
import six
from tempest.api.network import base_routers as base
from tempest.common.utils import data_utils
from tempest import config
from tempest import test
CONF = config.CONF
class RoutersTest(base.BaseRouterTest):
@classmethod
def skip_checks(cls):
super(RoutersTest, cls).skip_c... | {
"content_hash": "ed35226c0df97c74ded82f3b76cdec53",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 79,
"avg_line_length": 46.57402597402597,
"alnum_prop": 0.6019184652278178,
"repo_name": "Juraci/tempest",
"id": "78b51c8bcd8493aabbb5f637c51756bb012e8a1e",
"size": "18567... |
import logging
import re
from urllib.parse import urljoin
from streamlink.plugin import Plugin
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
class SSH101(Plugin):
url_re = re.compile(r'https?://(?:www\.)?ssh101\.com/(?:secure)?live/')
src_re = re.compile(r'sources.*?src:\s"(?P<ur... | {
"content_hash": "3fced482a5db4d4c7f8722260667b7f5",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 30.891304347826086,
"alnum_prop": 0.5918367346938775,
"repo_name": "beardypig/streamlink",
"id": "5bd83ef84f01f8d943142956cd50d4464bdf65c1",
"size": ... |
"""Spectral Embedding"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from scipy.linalg import eigh
from scipy.sparse.linalg import lobpcg
from ..base import BaseEstimator
from ..ext... | {
"content_hash": "7855f7b8b608c3d0b605bd7dbdecdb62",
"timestamp": "",
"source": "github",
"line_count": 484,
"max_line_length": 79,
"avg_line_length": 40.43801652892562,
"alnum_prop": 0.6178724708767627,
"repo_name": "Barmaley-exe/scikit-learn",
"id": "277ce0c48c9f37a1c873223c4b0a0bcaacbce0f6",
"si... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "manatsum.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "cb2aa7e663371cb0889fb77f899d45e9",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7117903930131004,
"repo_name": "mashabow/manatsum",
"id": "2a83262df5560a607d1cc405120fc75765b56bc1",
"size": "251... |
import unittest
import openmesh
import numpy as np
class BoundaryTriangleMesh(unittest.TestCase):
def setUp(self):
self.mesh = openmesh.TriMesh()
# Add some vertices
self.vhandle = []
self.vhandle.append(self.mesh.add_vertex(np.array([0, 1, 0])))
self.vhandle.append(self... | {
"content_hash": "62f5e34b4f22157339cabde17b0a0292",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 77,
"avg_line_length": 36.76136363636363,
"alnum_prop": 0.6003091190108192,
"repo_name": "TinyTinni/OF_Plugin-PyMesh",
"id": "6c6acb675bfad759247c7a9ebf0673cb1700f121",
"si... |
import os
from collections import OrderedDict
FILE_EXTENSIONS = ['.xlsx', '.xls', '.csv']
databases_folder_path = os.path.dirname(os.path.abspath(__file__))
def get_regions():
return [folder for folder in os.listdir(databases_folder_path) if folder != "weather"
and os.path.isdir(os.path.join(database... | {
"content_hash": "c83bf407cfb49de26580df37f8cd7ac4",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 125,
"avg_line_length": 35.33606557377049,
"alnum_prop": 0.562514497796335,
"repo_name": "architecture-building-systems/CEAforArcGIS",
"id": "eb23f2dbf68ff7f3b9c8fd724ddcca5... |
import os
ROOT_PATH = os.path.dirname(__file__)
TEMPLATE_DEBUG = DEBUG = True
MANAGERS = ADMINS = ()
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(ROOT_PATH, 'testdb.sqlite')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(ROOT_PATH, 'testdb.sqlit... | {
"content_hash": "3aaa82ee9d0e92f5831a5b69f1037c8c",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 127,
"avg_line_length": 31.347368421052632,
"alnum_prop": 0.6991269308260577,
"repo_name": "charles-vdulac/django-roa",
"id": "b0e1b6b91f12e74860e9cbf7d6deb40f8c891f46",
"s... |
import m3u8
import sys, getopt, urllib2, httplib, signal
def signal_handler(signal, frame):
print('Cancelat per Ctrl+C!')
sys.exit(0)
stats_text=''
# Analisi dels SubManfests (Playlists que contenen els .ts i que van variant)
def analitzaSubManifestNagios(m, test_ts,test_target_duration,expected_targ... | {
"content_hash": "c50a1d9e0161d412272837a3dc70d23d",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 139,
"avg_line_length": 34.082142857142856,
"alnum_prop": 0.5242586188829509,
"repo_name": "tcomerma/validaHLS",
"id": "f190a0da8965273d8d24055ee66b914b648b7f6a",
"size": ... |
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from oslo_serialization import jsonutils
import six
from neutron.common import constants
from neutron.common import exceptions
from neutron.common import utils
from neutron import context as neutron_context
from neutron.db import api... | {
"content_hash": "7d1c915be53b426b1113fe2db8c9d40d",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 78,
"avg_line_length": 46.55972696245734,
"alnum_prop": 0.5459610027855153,
"repo_name": "klmitch/neutron",
"id": "7e5bd94fbdbfb49f686a3e80b2ec650d906356e8",
"size": "1423... |
import codecs
import hashlib
from sqlalchemy import create_engine
from sqlalchemy.exc import IntegrityError, DataError
from sqlalchemy.orm import sessionmaker
from pbnh.db import models
from pbnh.db.connect import DBConnect
class Paster():
def __init__(self, dialect='sqlite', driver=None, username=None, password=... | {
"content_hash": "a7adb9af05c3e175f32ff6b3718ba9ef",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 96,
"avg_line_length": 34.71153846153846,
"alnum_prop": 0.5138504155124654,
"repo_name": "bhanderson/pbnh",
"id": "29dd7893ec8338ae0251d4c2109f93b501432ea5",
"size": "3610... |
import os
from setuptools import setup, find_packages
import people as app
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
dependency_links = [
# needs this dev version for django 1.6 fixes
'https://github.com/Kristia... | {
"content_hash": "c74f6b436c7394ed0d4fbded9f238f02",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 113,
"avg_line_length": 25.26,
"alnum_prop": 0.6247030878859857,
"repo_name": "chayapan/django-people",
"id": "fcf21b768ce1bb5294f1052d2d7032637a2646f6",
"size": "1263",
... |
"""
将持仓数据合并
"""
import os
import pandas as pd
from kquant_data.config import __CONFIG_H5_FUT_DATA_DIR__
def process1(input_path, output_path, member_name, folder_name):
# 由于文件数太多,从头加载很慢,需要增量处理
for dirpath, dirnames, filenames in os.walk(input_path):
for dirname in dirnames:
# 由于read_csv时不支... | {
"content_hash": "b84b5631cdf87fd53cf1912107498a8f",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 103,
"avg_line_length": 42.873684210526314,
"alnum_prop": 0.5926835256567641,
"repo_name": "wukan1986/kquant_data",
"id": "786ab0d7c3831264a23917427a5baa2c2f3c8a84",
"size"... |
'''
vn.zb的gateway接入
'''
import os
import json
from datetime import datetime
from time import sleep
from copy import copy
from threading import Condition
from Queue import Queue
from threading import Thread
from time import sleep
from vnpy.trader.vtGateway import *
from vnpy.api.zb import ZB_Sub_Spot_Api , zb_all_symbo... | {
"content_hash": "333fbe90852c6098b4aaf1f4f156cf86",
"timestamp": "",
"source": "github",
"line_count": 855,
"max_line_length": 132,
"avg_line_length": 35.23859649122807,
"alnum_prop": 0.4736964386471506,
"repo_name": "wisfern/vnpy",
"id": "db7f7f16c6da439a6fb90705a4a06e5bf55a5e9a",
"size": "31587"... |
import socket
import vstruct
from vstruct.primitives import *
import vstruct.defs.inet as vs_inet
# only the currently parsed record types
DNS_TYPE_A = 1
DNS_TYPE_NS = 2
DNS_TYPE_CNAME = 5
DNS_TYPE_SOA = 6
DNS_TYPE_PTR = 12
DNS_TYPE_MX = 15
DNS_TYPE_TXT = 16
dns_type_names = {
DNS_TYPE_A: 'A'... | {
"content_hash": "79e2741ede4b05c10947914eca4ecbb5",
"timestamp": "",
"source": "github",
"line_count": 432,
"max_line_length": 97,
"avg_line_length": 36.24768518518518,
"alnum_prop": 0.5889903569832046,
"repo_name": "HackerTool/vivisect",
"id": "13810cfeb03266b593ae8d268bd27fda994db68b",
"size": "... |
import os
from skimage._build import cython
base_path = os.path.abspath(os.path.dirname(__file__))
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
config = Configuration('filters', parent_package, top_path)
config.add_data_... | {
"content_hash": "6be5e5262a3e7589870e135409de75c9",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 38.77777777777778,
"alnum_prop": 0.6458452722063037,
"repo_name": "paalge/scikit-image",
"id": "0a21856bfd7bec9d9013c1c375ff46b92ade351f",
"size": "1... |
import sys
import os
if len(sys.argv) > 1:
# Get path to cross_sections.out file from command line argument
filename = sys.argv[-1]
else:
# Set default path for cross_sections.out
filename = 'cross_sections.out'
if not os.path.exists(filename):
raise OSError('Could not find cross_sections.o... | {
"content_hash": "fc678725d9f975a1ab9780fcf3579f94",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 70,
"avg_line_length": 32.53846153846154,
"alnum_prop": 0.6134751773049646,
"repo_name": "bhermanmit/cdash",
"id": "bf3cc1efd76a75611369270b37f9b7f8bd33a563",
"size": "1862... |
from __future__ import unicode_literals
import logging
import time
from mopidy import backend
logger = logging.getLogger(__name__)
class GMusicPlaybackProvider(backend.PlaybackProvider):
def __init__(self, audio, backend):
super(GMusicPlaybackProvider, self).__init__(audio, backend)
self._trac... | {
"content_hash": "71d0393f60e076cdcd7a10ab02de3d47",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 74,
"avg_line_length": 32.15384615384615,
"alnum_prop": 0.5988835725677831,
"repo_name": "elrosti/mopidy-gmusic",
"id": "e8e9f8923bc007c355cf569e54696db349bdee15",
"size": ... |
import random
class Dictannabinol(dict):
"""
Dictionnary that forgets things based on a trust ratio
This trust ratio is the viability of the object (in percentage)
All overrided functions have a (small) chance to loose some data
the chance to remove the data is 1 minus threshold th... | {
"content_hash": "a093ee4b705fa7388934f7e827f6cf0f",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 80,
"avg_line_length": 29.17241379310345,
"alnum_prop": 0.5233451536643026,
"repo_name": "Piplopp/misc",
"id": "96b8e1c5e9e782d9c09fec61dd20403f6cab0a93",
"size": "3427",
... |
"""mBuild library of atoms."""
from mbuild.lib.atoms.c3 import C3
from mbuild.lib.atoms.h import H
from mbuild.lib.atoms.n4 import N4
| {
"content_hash": "8b32120989e9115ae1422acce85bfe4d",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 34,
"avg_line_length": 33.5,
"alnum_prop": 0.7611940298507462,
"repo_name": "iModels/mbuild",
"id": "0f8bda67834318966874c8ecfa98d5fd2cf96fc6",
"size": "134",
"binary": fa... |
import sys
import os
sys.path.append(os.getcwd())
from pypaper import log
from pypaper.google import Archive
if __name__ == '__main__':
import argparse
p = argparse.ArgumentParser()
p.add_argument('bibtex', help='bibtex file')
p.add_argument('-c', '--cache', help='cache directory', default='cache')
... | {
"content_hash": "6265e2ebd6ce7915866c904b866f082b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 81,
"avg_line_length": 31,
"alnum_prop": 0.6612903225806451,
"repo_name": "Answeror/pypaper",
"id": "8592f814d543eaf8326bdbb42a3567757e78ee68",
"size": "791",
"binary": f... |
from BaseScouting.views.standard_views.base_team import BaseSingleTeamView
from Scouting2017.model.reusable_models import Team, TeamPictures, TeamComments, \
TeamCompetesIn
from Scouting2017.model.models2017 import TeamPitScouting
from Scouting2017.model.get_team_metrics import get_team_metrics
class SingleTeamVi... | {
"content_hash": "3c06290c7e8af9e83a2cf2f77db2231e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 134,
"avg_line_length": 43.642857142857146,
"alnum_prop": 0.7855973813420621,
"repo_name": "ArcticWarriors/scouting-app-2016",
"id": "14e5ff8da909c517bde555b5c2d5333c2296c8e3... |
"""
Different kind of fuzzy sets.
For any of these you can call C{set(x)} to get the membership value of x.
See L{Set<fuzzy.set.Set>} for more.
Examples can be found here U{http://pyfuzzy.sourceforge.net/demo/set/}
"""
__revision__ = "$Id: __init__.py,v 1.11 2010-03-28 18:44:46 rliebscher Exp $"
| {
"content_hash": "60305735e00e4ee1a464f114298f7524",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 27.363636363636363,
"alnum_prop": 0.6810631229235881,
"repo_name": "avatar29A/pyfuzzy",
"id": "bd26b4c731463d2815702adaeca3f2d94b13649f",
"size": "10... |
"""An apiproxy stub that calls a remote handler via HTTP.
This is a special version of the remote_api_stub which sends all traffic
to the local backends *except* for datastore.put calls where the key
contains a remote app_id.
It re-implements parts of the remote_api_stub so as to replace dependencies on
the (SDK only... | {
"content_hash": "96d302b1a67a5fcfdfe9f7747b472f1c",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 80,
"avg_line_length": 36.357142857142854,
"alnum_prop": 0.6690165260603259,
"repo_name": "SRabbelier/Melange",
"id": "cdef16115c0e3fdb08555d5f6a5adde53b30225a",
"size": "... |
import abc
import fnmatch
import hashlib
import os
from oslo_config import cfg
from oslo_log import log
from oslo_utils import timeutils
import six
from stevedore import extension
import yaml
from ceilometer.event.storage import models
from ceilometer.i18n import _, _LW
from ceilometer import publisher
from ceilomet... | {
"content_hash": "320d3e3b91c5e636bfad939698f3b316",
"timestamp": "",
"source": "github",
"line_count": 836,
"max_line_length": 79,
"avg_line_length": 35.32057416267943,
"alnum_prop": 0.552424817122731,
"repo_name": "mathslinux/ceilometer",
"id": "620933dda5b5e51723ca066c51c14178e9f26d66",
"size": ... |
from bottle import Bottle, run, request
import json
import subprocess
HOST_NAME = "localhost"
PORT=9999
app = Bottle()
##
## Basic route that returns all nodes/tags for a given environment (passed as part of the URL)
##
@app.route('/api/<env>')
def knife_search_env(env):
cmd = "knife search \"chef_environment:" + ... | {
"content_hash": "ab6dae16167a2c797c0fed40b4bdde6f",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 102,
"avg_line_length": 25.848101265822784,
"alnum_prop": 0.6385896180215475,
"repo_name": "semblano/chef-tags-api",
"id": "820f72167eec2d1eeaa7f5228c7dec56eec6c421",
"size... |
__all__ = [
'TableToTimeGrid',
'ReverseImageDataAxii',
'TranslateGridOrigin',
]
__displayname__ = 'Transform'
import numpy as np
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
from .. import _helpers, interface
from ..base import FilterBase
############################################... | {
"content_hash": "8a314b61a6650b60ebffa6c103a47611",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 89,
"avg_line_length": 34.30310262529833,
"alnum_prop": 0.5238989772490086,
"repo_name": "banesullivan/ParaViewGeophysics",
"id": "ba15ae30fe8854920fa121bef8b419487d4219a6",... |
"""MQTT component mixins and helpers."""
from __future__ import annotations
from abc import abstractmethod
from collections.abc import Callable
import json
import logging
from typing import Any, Protocol
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
... | {
"content_hash": "76adca3c4be8c0b6dc39567a110037b6",
"timestamp": "",
"source": "github",
"line_count": 849,
"max_line_length": 106,
"avg_line_length": 35.45465253239105,
"alnum_prop": 0.6208099398691074,
"repo_name": "rohitranjan1991/home-assistant",
"id": "9f3722a8f31743a5bfc71476961685fcf79247e0",... |
from handlers import Handler
from utils import Helper_sign
# Signup handler
class Signup(Handler):
def get(self):
self.render("signup-form.html")
def post(self):
have_error = False
self.username = self.request.get('username')
self.password = self.request.get('password')
... | {
"content_hash": "69c32c0e16036162ca19efdff9519940",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 62,
"avg_line_length": 30.390243902439025,
"alnum_prop": 0.5818619582664526,
"repo_name": "YuhanLin1105/Multi-User-Blog",
"id": "853c75cd849b96812acc8caf18cb78683f1cfdd5",
... |
import os
import fixtures
from oslo.config import cfg
from tuskar.common import policy as tuskar_policy
from tuskar.openstack.common import policy as common_policy
from tuskar.tests import fake_policy
CONF = cfg.CONF
class PolicyFixture(fixtures.Fixture):
def setUp(self):
super(PolicyFixture, self).se... | {
"content_hash": "afbb21825e583324798544fd7ff6e187",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 66,
"avg_line_length": 33,
"alnum_prop": 0.6373737373737374,
"repo_name": "ccrouch/tuskar",
"id": "5af88c3eee45a4ab8bae617576658fe18c668094",
"size": "1597",
"binary": fa... |
import logging
from google.appengine.ext import ndb
import webapp2
import tasks
class DemoHandler(webapp2.RequestHandler):
"""
Basic handler that trigger some code to be executed later.
"""
def get(self):
# If you have the ndb.toplevel middleware you can just fire-and-forget:
... | {
"content_hash": "1fbde77171add574e0b6e601ecae9965",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 92,
"avg_line_length": 25.84375,
"alnum_prop": 0.6541717049576784,
"repo_name": "freshplanet/AppEngine-Deferred",
"id": "26366077a3dac6fa255577e643d7f8980d3a082e",
"size": ... |
from networkapiclient.ApiGenericClient import ApiGenericClient
from networkapiclient.utils import build_uri_with_ids
class ApiEnvironment(ApiGenericClient):
def __init__(self, networkapi_url, user, password, user_ldap=None):
"""Class constructor receives parameters to connect to the networkAPI.
:... | {
"content_hash": "0563cd0202e5c0eb75add0ccd3797466",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 91,
"avg_line_length": 32.97841726618705,
"alnum_prop": 0.6151832460732984,
"repo_name": "globocom/GloboNetworkAPI-client-python",
"id": "c5be39339d1a718fc67345a241ba5ea2aca... |
"""Tests for manipulating Containers via the DB API"""
import six
from magnum.common import exception
from magnum.common import utils as magnum_utils
from magnum.tests.unit.db import base
from magnum.tests.unit.db import utils
class DbContainerTestCase(base.DbTestCase):
def test_create_container(self):
... | {
"content_hash": "d6629986eb264c451e069827d594bda0",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 78,
"avg_line_length": 41.67226890756302,
"alnum_prop": 0.5940713853599516,
"repo_name": "LaynePeng/magnum",
"id": "278b95988895189a24b22844b0354289c0b1894e",
"size": "559... |
import json
import os
try:
import testtools as unittest
except ImportError:
import unittest
from distill.exceptions import HTTPInternalServerError
from distill.renderers import RenderFactory, renderer
from distill.response import Response
class TestRenderers(unittest.TestCase):
def test_default_renderers(... | {
"content_hash": "4aeee8b2c84cdd255033048d181924a6",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 103,
"avg_line_length": 32.008620689655174,
"alnum_prop": 0.5957446808510638,
"repo_name": "Dreae/Distill",
"id": "b16ec4deda1137dd4f34029acb021fbbc78f9bcf",
"size": "3713... |
__author__ = 'thor'
from collections import OrderedDict
from ut.util.pobj import methods_of
class Analyzer(object):
"""
An Analyzer is a class to manage a simple dashboard that takes inputs from an html form, and takes action on these
inputs.
An Analyzer is defined by a list of dicts, each specifyi... | {
"content_hash": "bff977de599ef75eec327c05e63d65c3",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 118,
"avg_line_length": 39.23163841807909,
"alnum_prop": 0.5976382488479263,
"repo_name": "thorwhalen/ut",
"id": "b89a00823e2b25cfe82d5b6a2632899b9368d109",
"size": "6944"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.