text stringlengths 4 1.02M | meta dict |
|---|---|
"""WMI RDF values."""
from grr.lib.rdfvalues import structs as rdf_structs
from grr.proto import sysinfo_pb2
class WMIActiveScriptEventConsumer(rdf_structs.RDFProtoStruct):
protobuf = sysinfo_pb2.WMIActiveScriptEventConsumer
class WMICommandLineEventConsumer(rdf_structs.RDFProtoStruct):
protobuf = sysinfo_pb2.... | {
"content_hash": "fe41ce79b1f69c34854e58bb6dfb5c90",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 63,
"avg_line_length": 29,
"alnum_prop": 0.8275862068965517,
"repo_name": "destijl/grr",
"id": "2a0d6574315c09bdfb9a7063d9e6c7b1774b13c2",
"size": "370",
"binary": false,... |
"""This is "__init__.py" file of maildaemon module."""
from ._logging import configure_logging
# from .config import load_config
from .connection import Connection
# from .connection_group import ConnectionGroup
from .imap_connection import IMAPConnection
# from .smtp_connection import SMTPConnection
# from .pop_con... | {
"content_hash": "e06a1b165db35b5b70f63993ac014cf2",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 63,
"avg_line_length": 27.464285714285715,
"alnum_prop": 0.7737321196358907,
"repo_name": "mbdevpl/maildaemon",
"id": "dd9fc4c69e883db53144ed7a10b03bead70f11bd",
"size": "7... |
"""Whimpy test script for the cl module
Roger E. Masse
"""
import cl
from test_support import verbose
clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID',
'ALGORITHM_VERSION', 'AUDIO', 'AWARE_ERROR', 'AWARE_MPEG_AUDIO',
'AWARE_MULTIRATE', 'AWCMP_CONST_QUAL', 'AWCMP_FIXED_RATE',
'AWCMP_INDEPENDENT', 'AWCMP_JO... | {
"content_hash": "e26663c6448818108a888a600b7f7f9d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 70,
"avg_line_length": 50.675324675324674,
"alnum_prop": 0.6978472578165044,
"repo_name": "mariaantoanelam/Licenta",
"id": "26c5146863f1b39b053f1cd3f45df87401a3078d",
"size... |
from __future__ import annotations
import numbers
from typing import TYPE_CHECKING
import warnings
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas._typing import (
ArrayLike,
Dtype,
type_t,
)
from pandas.compat.numpy import function as nv
from pandas.core.... | {
"content_hash": "b85d994bdf1e8081c0d7abf34538a8f8",
"timestamp": "",
"source": "github",
"line_count": 759,
"max_line_length": 88,
"avg_line_length": 31.534914361001317,
"alnum_prop": 0.5613118863588886,
"repo_name": "gfyoung/pandas",
"id": "14d059c04b7c073c6ad8d48e368b847d54fed7ba",
"size": "2393... |
import json
import os
from openpyxl import Workbook, cell
from restlib2.http import codes
from vdw.samples.models import Project
from guardian.shortcuts import assign
from ..base import AuthenticatedBaseTestCase
class VariantUploadResourceTestCase(AuthenticatedBaseTestCase):
fixtures = ['initial_variants.json']
... | {
"content_hash": "3e3097367ffdf52acb8fc4a816e6e7b6",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 77,
"avg_line_length": 40.28358208955224,
"alnum_prop": 0.5509447943682846,
"repo_name": "chop-dbhi/varify",
"id": "85dcabcdcaba2c0f6172b75e0f8aa574d5bc48a1",
"size": "2699... |
import json
import functools
from twisted.web import resource
from twisted.web.server import NOT_DONE_YET
from twisted.internet.defer import inlineCallbacks
from vumi.service import Worker
from vumi.message import JSONMessageEncoder
from vumi.transports.httprpc import httprpc
from vumi.components.message_store import... | {
"content_hash": "8d6d292bc08b58e79bfe5e45a042548c",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 79,
"avg_line_length": 37.20909090909091,
"alnum_prop": 0.6342536037136575,
"repo_name": "TouK/vumi",
"id": "bde6966299c21a256366abfee20e34dc93e8cda6",
"size": "8257",
"... |
from keystoneauth1.exceptions import base
__all__ = ['CatalogException',
'EmptyCatalog',
'EndpointNotFound']
class CatalogException(base.ClientException):
message = "Unknown error with service catalog."
class EndpointNotFound(CatalogException):
message = "Could not find requested endp... | {
"content_hash": "6b7efc035709d4ca81f3a73e6c12d52c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 69,
"avg_line_length": 25.41176470588235,
"alnum_prop": 0.7268518518518519,
"repo_name": "sjsucohort6/openstack",
"id": "4158e8e4ae0b1e577cf86cb9389a6d9c3d7cef47",
"size": ... |
from H2O import *
from Process import *
from PerfTest import *
import PerfUtils
import traceback
import os
import time
from multiprocessing import Process
class PerfRunner:
"""
A class for running the perfomrance tests.
The tests list contains a Test object for every test.
The tests_not_started is a... | {
"content_hash": "f1c42b3017ec78b878a1a7c2135c1556",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 113,
"avg_line_length": 34.85232067510549,
"alnum_prop": 0.5070217917675545,
"repo_name": "h2oai/h2o-2",
"id": "e59118aa5c1009f948d811895d0850a79f558cce",
"size": "8260",
... |
"""File operations wrapper functions to streamline common use cases"""
import os
from data_helper import hash, is_str_not_empty, is_int_pos, is_int_not_neg
def hash_file(hash_name, path, size=None, offset=0, whence=0):
"""Return the hash of a file
Args:
hash_name (str): Hash algorithm name. See :py:... | {
"content_hash": "5fd023ef038e805438ea4059bea2ad2b",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 218,
"avg_line_length": 41.53846153846154,
"alnum_prop": 0.6245014245014245,
"repo_name": "qevo/py_file_helper",
"id": "780910b209249168a677b8aa95d9364d74f1ada1",
"size": ... |
from __future__ import absolute_import, unicode_literals
from gaecookie.middleware import CSRFMiddleware, CSRFInputToDependency
from locale_app.middleware import LocaleMiddleware
from multitenancy import MultitenacyMiddleware, set_subdomain, set_domain
from tekton.gae.middleware.json_middleware import JsonResponseMiddl... | {
"content_hash": "2ec8ef992e3da0a58333d537fc4eaf23",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 89,
"avg_line_length": 43.69230769230769,
"alnum_prop": 0.7200704225352113,
"repo_name": "beatorizu/tekton",
"id": "0b71d371d2ff70e73ed8af5efccd9167d088eb41",
"size": "1728... |
from ..charts import Chart
from flask import jsonify, request
class DataTable(Chart):
"""Wrapper for jquery DataTables.
This class provides a wrapper for the JQuery DataTables
component within PyxleyJS. Datatables options can be passed
through the kwargs.
Args:
table_... | {
"content_hash": "e2bea00671de959e99489aacbe511c8e",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 78,
"avg_line_length": 32.39316239316239,
"alnum_prop": 0.49445910290237466,
"repo_name": "stitchfix/pyxley",
"id": "e56cd45f10eac45909145f742f82c00ed50fd52c",
"size": "37... |
import pandas as pd
def load_data(data_links_list=(
'https://raw.githubusercontent.com/JanetMatsen/bacteriopop/master'
'/raw_data/raw_data.csv',
'https://raw.githubusercontent.com/JanetMatsen/bacteriopop/master'
'/raw_data/sample_meta_info.tsv')):
"""Reads two dataframes from Gith... | {
"content_hash": "7799de5515eee8bdcb8bdb578f696286",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 75,
"avg_line_length": 38.728813559322035,
"alnum_prop": 0.6087527352297593,
"repo_name": "JanetMatsen/bacteriopop",
"id": "91bbc816564e7ea672eeed360fee509c0c9bc26d",
"size... |
from fabric.contrib.files import append, exists, sed
from fabric.api import env, local, run
import random
REPO_URL = 'https://github.com/abrahamvarricatt/journal.git'
def deploy():
site_folder = '/home/%s/sites/%s' % (env.user, env.host)
source_folder = site_folder + '/source'
_create_directory_structure... | {
"content_hash": "ae40c66db3cc24d6b74fa7cb587351d7",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 81,
"avg_line_length": 33.53846153846154,
"alnum_prop": 0.6274574049803407,
"repo_name": "abrahamvarricatt/journal",
"id": "8ca0fd4983884e89416744676c9f75a93266a6d7",
"size... |
"""Invenio error handlers."""
from __future__ import absolute_import, print_function
from flask import Blueprint, current_app, render_template
blueprint = Blueprint("invenio_theme_frontpage", __name__)
@blueprint.route("/")
def index():
"""Simplistic front page view."""
return render_template(
curr... | {
"content_hash": "ac1e92587f23018a0e200dadaf4d8465",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 73,
"avg_line_length": 30.9,
"alnum_prop": 0.6974110032362459,
"repo_name": "inveniosoftware/invenio-theme",
"id": "0c322a5a9713fed526729fc90b89f84225e430ea",
"size": "1471... |
import argparse
import subprocess
class DatabaseImporter(object):
args = None
def __init__(self, args):
self.args = args
def postgres(self):
if not self.args.database:
raise AttributeError('No database selected to import')
port = args.port or '5432'
postfix = ' {}'.format(self.args.additional)
command ... | {
"content_hash": "de9c8fec280d5572928ea613cfc065e6",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 90,
"avg_line_length": 37.610169491525426,
"alnum_prop": 0.6723749436683191,
"repo_name": "codecats/db_data",
"id": "96e2c7e43e1a0f55dd8b989a158650be3cc6e728",
"size": "224... |
from dtest import Tester, debug
from tools import known_failure, since
@since('2.2')
class TestLargeColumn(Tester):
"""
Check that inserting and reading large columns to the database doesn't cause off heap memory usage
that is proportional to the size of the memory read/written.
"""
def stress_wi... | {
"content_hash": "7521402f78240132aeb49b09587d5a3b",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 189,
"avg_line_length": 50.189189189189186,
"alnum_prop": 0.6276252019386107,
"repo_name": "thobbs/cassandra-dtest",
"id": "0b228d2167ef30c161af71d84b039454f1523edc",
"size... |
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
urlpatterns = i18n_patterns('',
url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {
'packages': ('pyconde.cor... | {
"content_hash": "c09a6972f75305ae221697f74bfc7ef6",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 67,
"avg_line_length": 31.72093023255814,
"alnum_prop": 0.6414956011730205,
"repo_name": "EuroPython/djep",
"id": "c8a93dad20a96d830ae7333b28aaf5828e800d1a",
"size": "1388"... |
from collections import defaultdict
from itertools import combinations
import numpy as np
from scipy.spatial.distance import pdist
def sq_to_dist(i, j, n):
"""Convert coordinate of square distance matrix to condensed matrix index.
The condensed version of a squareform, pairwise distance matrix is
a linea... | {
"content_hash": "4a8d885f99ac35bc4953ac4369315f87",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 101,
"avg_line_length": 28.254545454545454,
"alnum_prop": 0.601994851994852,
"repo_name": "jni/microscopium",
"id": "4b3d559b281eb4306f3c64706aacebb36e2c9f9b",
"size": "62... |
import json
import datetime
from flask import request
from flask.ext.cors import cross_origin
from alerta.app import app, db
from alerta.alert import Alert
from alerta.app.utils import jsonify, jsonp, process_alert
from alerta.app.metrics import Timer
from alerta.plugins import RejectException
LOG = app.logger
webh... | {
"content_hash": "fa5889cfccd1358b97051025100081e1",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 126,
"avg_line_length": 36.803703703703704,
"alnum_prop": 0.5985709972828822,
"repo_name": "mrkeng/alerta",
"id": "db9f950ef8afce78304fc8e3029e566243cec681",
"size": "9937... |
import os
import argparse
import logging
import subprocess
def checksum(md5sum, file):
setup_logging()
if not os.path.exists(file):
print "File not found! %s" % file
logging.info("md5sum check FAIL: %file - file not found")
exit(1)
hash = get_md5sum(file)
if not hash == md5sum:... | {
"content_hash": "90d79af074133a217256ffd2a8d365ad",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 109,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.6159822419533851,
"repo_name": "StanfordBioinformatics/qualia",
"id": "2ca2a93076b8da9d7ad5934dea5a810f8620ff3b",
... |
from __future__ import print_function
from timeit import Timer
from pyprimesieve import primes, primes_sum
def sumofprimes(n): # lambda expression is slower
return sum(primes(n))
if __name__ == "__main__":
for n in range(5, 9):
print('10**{}'.format(n))
for fn in ['primes_sum', 'sumofprimes'... | {
"content_hash": "8097d79cfe437c1d23e2be339ffbfdfa",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 102,
"avg_line_length": 33.75,
"alnum_prop": 0.5777777777777777,
"repo_name": "anirudhjayaraman/pyprimesieve",
"id": "255543ebd98ebe9ea6a60258eed4a222476ef432",
"size": "56... |
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | {
"content_hash": "febdd01e43bf7c62bf90f2e7f8c526b7",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 80,
"avg_line_length": 35.07368421052632,
"alnum_prop": 0.6449579831932774,
"repo_name": "tempbottle/mcrouter",
"id": "08ca3154f31ffa90f42e6ad3f7c08571a09151d0",
"size": "3... |
"""significant_figures_calculator URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home,... | {
"content_hash": "6db063a4f525b4013408c2b699f8ff53",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 37.5,
"alnum_prop": 0.6885714285714286,
"repo_name": "Rezztech/significant-figures-calculator",
"id": "0b4286ad818ec1f242c0ea53e28f65cdbea8275e",
"si... |
"""
sentry.web.urls
~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
from django.conf.urls.defaults import *
from django.views.defaults import page_not_found
from sentry.conf.settings import KEY
from sentry.web import v... | {
"content_hash": "5bcdf295bbcf38eaf6b07c9a659f5e39",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 105,
"avg_line_length": 30.322033898305083,
"alnum_prop": 0.660145332588038,
"repo_name": "joshjo/django-sentry",
"id": "e00668fef5d6748f7dcd0a11511e5daab545d1cf",
"size": ... |
from __future__ import print_function
from apiclient import discovery
from httplib2 import Http
from oauth2client import client, file, tools
SCOPES = "https://www.googleapis.com/auth/forms.body"
DISCOVERY_DOC = "https://forms.googleapis.com/$discovery/rest?version=v1"
store = file.Storage('token.json')
creds = None
... | {
"content_hash": "8643e1d6a18a1de8b928456e2cc11e0d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 83,
"avg_line_length": 28.5,
"alnum_prop": 0.6058897243107769,
"repo_name": "googleworkspace/python-samples",
"id": "964404b99da59f91a4d18b9900398761fd8e2c02",
"size": "219... |
import datetime
import os
import unittest
from airflow import settings
from airflow.configuration import conf
from airflow.models import DAG, TaskInstance as TI, XCom, clear_task_instances
from airflow.operators.dummy_operator import DummyOperator
from airflow.utils import timezone
from airflow.utils.session import cr... | {
"content_hash": "ef564111fb49f6c13a781d44a7606a4d",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 90,
"avg_line_length": 37.63354037267081,
"alnum_prop": 0.5548770424162403,
"repo_name": "wileeam/airflow",
"id": "b3ec17bddc8008e980184393854998ecbe314615",
"size": "1290... |
''':mod:`yakonfig` declarations for rejester.
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
'''
from __future__ import absolute_import
import os
import yakonfig
config_name = 'rejester'
default_config = {
'app_name': 'rejester',
'worker': 'fork_worker'... | {
"content_hash": "6cf0a7bdd9c544d678a4811d242929b9",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 69,
"avg_line_length": 35.127272727272725,
"alnum_prop": 0.6040372670807453,
"repo_name": "diffeo/rejester",
"id": "4e71b49e10b9ca053e22351deba3291ee8503412",
"size": "1932... |
from .curses_menu import CursesMenu
from .curses_menu import clear_terminal
from .selection_menu import SelectionMenu
from .multi_selection_menu import MultiSelect
from . import items
from .version import __version__
__all__ = ['CursesMenu', 'SelectionMenu', 'MultiSelect', 'items', 'clear_terminal']
| {
"content_hash": "0af47d80ce6990fb21ed87b870eb0527",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 83,
"avg_line_length": 37.75,
"alnum_prop": 0.7682119205298014,
"repo_name": "mholgatem/GPIOnext",
"id": "42d612073481820f56c8a014bbb3f171434bbb69",
"size": "302",
"binary... |
"""
Views for managing database clusters.
"""
from collections import OrderedDict
import logging
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
import six
from horizon import exceptions
from horizon import forms a... | {
"content_hash": "caabe11511e6b190b3426c322ffd67f7",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 78,
"avg_line_length": 37.2520325203252,
"alnum_prop": 0.6515713662156264,
"repo_name": "Tesora-Release/tesora-trove-dashboard",
"id": "43cf729320b2eff695e9a19bd743809c7fb67... |
from utils import calculate_bytecode, to_wei
scenario_description = (
"The DAO spent all its money and has to resort to retrieving money from "
"the extra balance account. This test checks that this is succesful."
)
def run(ctx):
ctx.assert_scenario_ran('spendall')
extra_balance_ether_to_get = 5
... | {
"content_hash": "1b76e8f7b02449fc14dd1c94cd7d62ed",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 77,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.648936170212766,
"repo_name": "Spreadway/core",
"id": "38f02336352f10725b1f32ddedb7f2c124a1ae80",
"size": "846",
... |
"""Import core names of TensorFlow.
Programs that want to build TensorFlow Ops and Graphs without having to import
the constructors and utilities individually can import this file:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
"""... | {
"content_hash": "d7190910340665d1bde42ca564c9af28",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 81,
"avg_line_length": 30.140794223826713,
"alnum_prop": 0.735896514552641,
"repo_name": "lakshayg/tensorflow",
"id": "bc9ddec2a54a784027120828e9b15a2bf500414e",
"size": "... |
from . import TGBot
import argparse
def build_parser():
parser = argparse.ArgumentParser(description='Run your own Telegram bot.')
parser.add_argument('plugins', metavar='plugin', nargs='*',
help='a subclass of TGPluginBase (ex: plugins.echo.EchoPlugin)')
parser.add_argument('--tok... | {
"content_hash": "92b25b4254970d9f0e3fb88ed2ee3de5",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 125,
"avg_line_length": 34.507246376811594,
"alnum_prop": 0.5833683326333473,
"repo_name": "pmpfl/tgbotplug",
"id": "c5f4d9a66d853034b1530a83239bb2c225488e8b",
"size": "240... |
from base_test import BaseTestCase
from pydyty.monitor import Monitored
class MonitorTestCase(BaseTestCase):
def test_monitor(self):
class A(Monitored):
def foo(self, x):
return x
# This doesn't work yet.
def bar(self, x, y):
return x ... | {
"content_hash": "0f1e65bd8ffef68d490811cc98dcf5dd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 27.73913043478261,
"alnum_prop": 0.493730407523511,
"repo_name": "davidan42/pydyty",
"id": "5ba06e51725fbcc86da6c05fe60f5d8534c2b8dc",
"size": "638",... |
from django.core.management.base import BaseCommand
from django_countries.data import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(BaseCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **options... | {
"content_hash": "9068c29d7bbeb04ed6e96cb4e3505d73",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 87,
"avg_line_length": 39.354166666666664,
"alnum_prop": 0.5224986765484383,
"repo_name": "qedsoftware/commcare-hq",
"id": "7d1023e2fc6b250ac103b14b859be460da613b3a",
"size... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import logging
from .const import Constant
FILE_NAME = Constant.user_log_file
if not os.path.isdir(Constant.user_conf_dir):
os.mkdir(Constant.user_conf_d... | {
"content_hash": "044e6150574cb367e616e3d408632088",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 82,
"avg_line_length": 23.885714285714286,
"alnum_prop": 0.6854066985645934,
"repo_name": "1dot75cm/repo-checker",
"id": "5df7ac75a79160b40674f1f65317357180523c67",
"size":... |
"""Django settings for Pontoon."""
import os
import socket
from django.utils.functional import lazy
import dj_database_url
_dirname = os.path.dirname
ROOT = _dirname(_dirname(_dirname(os.path.abspath(__file__))))
def path(*args):
return os.path.join(ROOT, *args)
# Environment-dependent settings. These are ... | {
"content_hash": "3b1c05b51041a1bb2ecb4b81b608217c",
"timestamp": "",
"source": "github",
"line_count": 765,
"max_line_length": 99,
"avg_line_length": 31.08888888888889,
"alnum_prop": 0.6080393558424084,
"repo_name": "participedia/pontoon",
"id": "5b25785ff2e02d76ae225057d8de26b8a21db6f4",
"size": ... |
from tempest_lib import decorators
import testtools
from tempest.api.telemetry import base
from tempest import config
from tempest import test
CONF = config.CONF
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
_interface = 'json'
@classmethod
def resource_setup(cls):
if CONF.tel... | {
"content_hash": "cafb515ce4e70c00a08c521a2694bc8f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 32.875,
"alnum_prop": 0.6368821292775665,
"repo_name": "CiscoSystems/tempest",
"id": "7e5d6eecf3b6453a6488b6a06dc6eae1e9ecfef7",
"size": "2677",
"b... |
import os
import sys
import requests
from getpass import getpass
# Using this method of secret storing:
# https://stackoverflow.com/questions/25501403/storing-the-secrets-passwords-in-a-separate-file
try:
import credentials
token = credentials.API_key
except Exception as e:
print (e)
token = getpass()... | {
"content_hash": "f167e874226bc6b4279ec2c664364e43",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 95,
"avg_line_length": 24.81081081081081,
"alnum_prop": 0.6492374727668845,
"repo_name": "MuckRock/API-examples",
"id": "3ff4a69c639fa7428f5dd840f2b80b9be439912d",
"size": ... |
"""Support for Modbus Coil sensors."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.modbus import (
CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN)
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeas... | {
"content_hash": "5529058d5628beb55443263dc5569bf5",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 71,
"avg_line_length": 30.357142857142858,
"alnum_prop": 0.6367058823529411,
"repo_name": "nugget/home-assistant",
"id": "4e0ab74445d2f1b267c313450efe4ca704c185a0",
"size":... |
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/faction_perk/hq/shared_hq_s01.iff"
result.attribute_template_id = -1
result.stfName("faction_perk_n","hq_s01")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "806295f53795ac84f7c80c8c371b5955",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 23.23076923076923,
"alnum_prop": 0.6854304635761589,
"repo_name": "anhstudios/swganh",
"id": "b7d9666c4db1cd8c4c2523ccf3e4e057af6e870a",
"size": "447... |
from distutils.core import setup, Command
from unittest import TextTestRunner, TestLoader
import perlinpinpin
class TestCommand(Command):
description = "run unit tests"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
... | {
"content_hash": "a6710db5150341621f3075309a8433a7",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 150,
"avg_line_length": 33.45,
"alnum_prop": 0.6270553064275037,
"repo_name": "cyberdelia/perlinpinpin",
"id": "70ce4dbe24c56347aee077cef0959bddad2afb8a",
"size": "1384",
... |
"""
FB Chatbot - Simple Reply Plugin
~~~~~~
based on triggers, return a response
"""
__author__ = 'Tim Chan'
__email__ = 'github@timc.me'
__copyright__ = 'Copyright 2020 by Tim Chan'
__version__ = '2.0'
__license__ = 'MIT'
import pickle
import settings.settings as config
import plugins.common as helper
... | {
"content_hash": "6d0d65a005bcc894dc89d715b436c49f",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 106,
"avg_line_length": 34.164556962025316,
"alnum_prop": 0.5694701741385698,
"repo_name": "TimLChan/FB-Altcoin-Stock-Chatbot",
"id": "36e7b4ff529090ef14f70ca7021c2dbc2308b03... |
__test__ = {"API_TESTS": r"""
>>> from django.conf import settings
>>> ORIGINAL_TIME_ZONE = settings.TIME_ZONE
>>> settings.TIME_ZONE = "UTC"
>>> from timezones import forms
# the default case where no timezone is given explicitly.
# uses settings.TIME_ZONE.
>>> f = forms.LocalizedDateTimeField()
>>> f.clean("2008-05... | {
"content_hash": "e0abd52e8e55c898153dfb546cd26f3b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 99,
"avg_line_length": 34.34090909090909,
"alnum_prop": 0.6724023825281271,
"repo_name": "indro/t2c",
"id": "eb7c87060f871a6453a9831294ee566533778c5a",
"size": "1512",
"b... |
from setuptools import setup, find_packages
setup(name="oauth2",
version="1.2.1",
description="Library for OAuth version 1.0a.",
author="Joe Stump",
author_email="joe@simplegeo.com",
url="http://github.com/simplegeo/python-oauth2",
packages = find_packages(),
install_requires ... | {
"content_hash": "afe3374b6fab3b7df40325799e62748f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 33.07142857142857,
"alnum_prop": 0.6177105831533477,
"repo_name": "e-loue/python-oauth2",
"id": "b2f9f5e548f48568d5c3f633e750bec2587572c9",
"size": "... |
"""Package for writing output files in HTML format.
This package is considered stable but it is not part of the public API.
"""
from .htmlfilewriter import HtmlFileWriter, ModelWriter
from .jsonwriter import JsonWriter
LOG = 'rebot/log.html'
REPORT = 'rebot/report.html'
LIBDOC = 'libdoc/libdoc.html'
TESTDOC = 'testd... | {
"content_hash": "880bf9ddc7647b927a71beb2836383d6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 71,
"avg_line_length": 28.083333333333332,
"alnum_prop": 0.7685459940652819,
"repo_name": "yamateh/robotframework",
"id": "5bceed5a3c3d2f1963276645ab2e364a31e9a9f0",
"size"... |
from pprint import pprint
import json
import sys
from networks.docker import build_image
from networks.docker import build_network
from networks.docker import inspect_network
from networks.docker import create_container
from networks.docker import connect_to_network
from networks.docker import stop_container
from netw... | {
"content_hash": "a787e779c3f1934ff05e22a97c78478e",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 98,
"avg_line_length": 32.189189189189186,
"alnum_prop": 0.6418975650713686,
"repo_name": "cyberImperial/attack-graphs",
"id": "26cc7da97f0e131a370c27fab83938f1f1fce6d7",
"... |
import pytest
import requests
import os
import keyring
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.table import Table, Column
from astropy.io.votable import parse
from astropy.io.votable.exceptions import W03, W50
from astroquery import log
import numpy as np
from astroquery.casda ... | {
"content_hash": "cfbab6d25687aab11237ab541135a9ec",
"timestamp": "",
"source": "github",
"line_count": 569,
"max_line_length": 125,
"avg_line_length": 38.81722319859402,
"alnum_prop": 0.6533254855797528,
"repo_name": "imbasimba/astroquery",
"id": "8a34fafe62ad259769ad9db97c68552cc910fbd3",
"size":... |
from equations import *
from texttree import TextTree
def find_best_attribute_to_split_on(training_set):
"""Which attribute has the highest information gain?"""
best_attr = None
best_gain = None
for attr in [key for key in training_set[0].keys() if key != 'classes']:
information_gain = I(training_set, attr)
if... | {
"content_hash": "0f1fe6552b626b533da2d4c1e616c082",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 130,
"avg_line_length": 34.19230769230769,
"alnum_prop": 0.6940382452193475,
"repo_name": "Bemmu/DecisionTree",
"id": "8418a29e45d6b2cea0817696acaad05ffdfd4e16",
"size": "2... |
import os
import unittest
import numpy as np
from pymatgen import Structure
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.abinit import ETSF_Reader
try:
import netCDF4
except ImportError:
netCDF4 = None
_test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
... | {
"content_hash": "5668e9eff1a7b06a89b0d10b713093ec",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 78,
"avg_line_length": 30.56989247311828,
"alnum_prop": 0.5392191347168483,
"repo_name": "blondegeek/pymatgen",
"id": "ca0d37639cad58c402f7c1aa2ac8eb2fa3341356",
"size": "2... |
from django.db import models
class Student(models.Model):
"""Student Model"""
class Meta(object):
verbose_name = "Студент"
verbose_name_plural = "Студенти"
first_name = models.CharField(
max_length=256,
blank=False,
verbose_name='Ім’я')
last_name = models.Cha... | {
"content_hash": "c11921878116ef1c463b2c364d35066a",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 58,
"avg_line_length": 22.24074074074074,
"alnum_prop": 0.5661948376353039,
"repo_name": "samitnuk/studentsdb",
"id": "511d28c4942ac48428fc368ec58c20b6dda21ccb",
"size": "1... |
"""Configurations for Encoders."""
from typing import Optional
import dataclasses
from official.modeling.hyperparams import base_config
from official.nlp.configs import encoders
@dataclasses.dataclass
class SmallEncoderConfig(base_config.Config):
"""Encoder config for the lowcost stage."""
net2net_ratio: float ... | {
"content_hash": "c84b7bc903d22d03aaff4f51464cab46",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 70,
"avg_line_length": 36.71084337349398,
"alnum_prop": 0.7095503774204135,
"repo_name": "google-research/google-research",
"id": "35dfd75fda2e88360e1359038448c3bdf6e90c52",
... |
from __future__ import absolute_import, unicode_literals
import logging
import random
from mopidy import exceptions
from mopidy.core import listener
from mopidy.internal import deprecation, validation
from mopidy.models import TlTrack, Track
logger = logging.getLogger(__name__)
class TracklistController(object):
... | {
"content_hash": "4dbd9c050596bde63db838c0755eb046",
"timestamp": "",
"source": "github",
"line_count": 646,
"max_line_length": 79,
"avg_line_length": 33.36532507739938,
"alnum_prop": 0.5877795304815812,
"repo_name": "quartz55/mopidy",
"id": "02508c97f3e7b17ed98a91fcb7820c2860bd23fb",
"size": "2155... |
import logging, coloredlogs
import re
from modules.config import *
from modules.database import Database
from modules.api import API
from websocket import create_connection
from urllib.parse import urlparse, parse_qs
database = Database(db_host, db_user, db_pass, db_name, db_autocommit)
database.database_connection(... | {
"content_hash": "c62499dfb2871b5f7eff17a5f5f6a56f",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 120,
"avg_line_length": 30.44871794871795,
"alnum_prop": 0.6703157894736842,
"repo_name": "kritzware/PyBot",
"id": "f32044b19df16d49606cddf010b8b68a3575c9fe",
"size": "2375... |
class PuzzleNotFound(Exception):
pass
| {
"content_hash": "21455d0464bf448ecba62b17ea2b3952",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 32,
"avg_line_length": 21,
"alnum_prop": 0.7619047619047619,
"repo_name": "bbuhai/sudoku-solver",
"id": "ddc93c500fb7d09bec3607fa278420aa2cd7a4df",
"size": "44",
"binary":... |
from unittest import TestCase
import json
from tornado_stub_client import stub, reset
from tornado_stub_client.collection import RequestCollection
class CommandsTest(TestCase):
""" the stub() command is actually a class who's initializer returns
itself, so we can do stub().and_return() in a ruby rspec mock fa... | {
"content_hash": "50fb85cc55198271bf4ed23b3f0df874",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 73,
"avg_line_length": 36.70967741935484,
"alnum_prop": 0.6441124780316344,
"repo_name": "dcosson/tornado-stub-client",
"id": "e692608ee5a23f02940b866bda6a16e7a2ff3c03",
"s... |
import matplotlib
import pmagpy.pmag as pmag
import wx
import copy
import os
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar
from pylab import Figure
from pmagpy.demag_gui_utilities import *
from num... | {
"content_hash": "e19d245661b64dda6391e87e0df7bcb0",
"timestamp": "",
"source": "github",
"line_count": 1600,
"max_line_length": 247,
"avg_line_length": 44.53375,
"alnum_prop": 0.5395205883178488,
"repo_name": "Caoimhinmg/PmagPy",
"id": "9feb77509e0e74b10ddff24afb1f7eceddcc30bf",
"size": "71277",
... |
import os
import select
import threading
class SelectReactor(object):
TIMEOUT = 0.5 if os.name == "nt" else None
def __init__(self):
self._active = False
self._readfds = set()
def register_read(self, fileobj):
self._readfds.append(fileobj)
def run(self):
self._activ... | {
"content_hash": "bd50f7e90c5a0a75e43d752640452dd2",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 23.743589743589745,
"alnum_prop": 0.5680345572354212,
"repo_name": "pyq881120/rpyc",
"id": "1e0046b12ace20498cbd28c9a796c887397e9b52",
"size": "926",... |
"""
Provides a full CRUD template, all inclusive. Very basic example is as follows.
class Widget(BaseModel):
name = ndb.StringProperty()
def __unicode__(self):
return self.name or '<Untitled Widget>'
class WidgetBlueprint(GenericCrud):
model = Widget
blueprint = Wid... | {
"content_hash": "b321c1a91be697a5df454af59d1bd84b",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 158,
"avg_line_length": 33.98726114649681,
"alnum_prop": 0.6178785607196402,
"repo_name": "kkinder/GAEStarterKit",
"id": "8dcc41435f40e0636a11954ba602b33b315b0119",
"size"... |
from picamera import PiCamera
import subprocess as sb
import os
def capture_img(img_path='img.jpg', res=(1024,768), vflip=True):
"""
Captures image with PiCamera and saves it to given path.
It cannot be used when camera is active
(for example when it is used by mjpg-streamer). In that case
exception ``P... | {
"content_hash": "19adba11bd444766a6d248e2ddfb0ea7",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 87,
"avg_line_length": 28.317073170731707,
"alnum_prop": 0.6507321274763135,
"repo_name": "ggljzr/pytRobot",
"id": "34e6b0c74c970f522bd4d289699829a9d3e6b8ed",
"size": "2322... |
"""
SharedConnection
"""
import inspect
import scipy
import numpy as np
from functions import extract, convolve1d, convolve2d, best_fft_shape
from connection import Connection, ConnectionError
from numpy.fft import fft, ifft
from numpy.fft import fft2, ifft2
from numpy.fft import rfft, irfft
from numpy.fft import rfft... | {
"content_hash": "d9a686886fde51c51a0fab8fca09f8f8",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 94,
"avg_line_length": 39.22380952380952,
"alnum_prop": 0.4911982517907005,
"repo_name": "rougier/dana",
"id": "0e9d75e3fc3a27a6522fd75f11f247fe0b837eb4",
"size": "10081",... |
import order
def user_order_by(self, field):
"""
Queryset method ordering objects by user ordering field.
"""
# Get ordering model.
model_label = order.utils.resolve_labels('.'.join(\
[self.model._meta.app_label, self.model._meta.object_name]))
orderitem_set = getattr(self.model, \... | {
"content_hash": "50b0ca7371e819783b0e12cd482261dd",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 79,
"avg_line_length": 35.03333333333333,
"alnum_prop": 0.6546146527117032,
"repo_name": "praekelt/django-order",
"id": "faecc2daacad296ee78ebffaa2108be5fe98dfe7",
"size": ... |
"""
Example Airflow DAG that creates, patches and deletes a Cloud SQL instance, and also
creates, patches and deletes a database inside the instance, in Google Cloud.
This DAG relies on the following OS environment variables
https://airflow.apache.org/concepts.html#variables
* GCP_PROJECT_ID - Google Cloud project for... | {
"content_hash": "c262636dc73f429fa6c42e59db00fe87",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 97,
"avg_line_length": 36.95578231292517,
"alnum_prop": 0.6438104003681546,
"repo_name": "nathanielvarona/airflow",
"id": "2fe8ee8ed6ff1a1898b33fec39b4659f5357d0d3",
"size... |
from wtforms import TextField
from flask.ext.wtf import Form
from wtforms.validators import Required, Email
class SignupForm(Form):
email = TextField('Email Address', validators=[Required(), Email()])
| {
"content_hash": "df7fd2b3ed3ca19bab8253e1436f5591",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 72,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.7681159420289855,
"repo_name": "angstwad/linky",
"id": "43df66bd9cc8eaf158863d1195e740cf4c7343c3",
"size": "852",
... |
class State(object):
"""A state has an operation, and can be moved into the next state given an input
"""
@staticmethod
def run(self, context):
raise NotImplementedError("Run not immplemented")
@staticmethod
def next(self, context):
raise NotImplementedError("Next not implemente... | {
"content_hash": "d8a6f24fecb5467f3397a18e9571de62",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 84,
"avg_line_length": 30.791666666666668,
"alnum_prop": 0.6332882273342354,
"repo_name": "colorfuldisaster/adolf-scriptler",
"id": "8894f3ed528b8a4d2b2396c693bc6bcfded6e632"... |
import os
import sys
from configparser import ConfigParser
from datetime import datetime
from irma.common.utils.utils import timestamp
from irma.common.plugins import PluginBase
from irma.common.plugin_result import PluginResult
from irma.common.base.utils import IrmaProbeType
from irma.common.plugins import ModuleDe... | {
"content_hash": "ca5ba291771948e5f9b85ca27d26a892",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 76,
"avg_line_length": 33.53465346534654,
"alnum_prop": 0.5701210510776499,
"repo_name": "quarkslab/irma",
"id": "aac936d4944797a8091c2ba3ee363dd015b83157",
"size": "3912"... |
"""SCons.Variables.PathVariable
This file defines an option type for SCons implementing path settings.
To be used whenever a a user-specified path override should be allowed.
Arguments to PathVariable are:
option-name = name of this option on the command line (e.g. "prefix")
option-help = help string for optio... | {
"content_hash": "b596a203ff6e919afaa3fed5179f31d2",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 86,
"avg_line_length": 38.17687074829932,
"alnum_prop": 0.6211689237348539,
"repo_name": "tempbottle/Nuitka",
"id": "3261d73064ea82617a7c71aea251ab866eb97043",
"size": "56... |
"""Support for Speedtest.net internet speed testing sensor."""
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import callback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import (
ATTR_BYTE... | {
"content_hash": "035344f61acdebeed131883c508898ff",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 85,
"avg_line_length": 30.9375,
"alnum_prop": 0.6112554112554113,
"repo_name": "turbokongen/home-assistant",
"id": "5607d2570c9797d95f3c4915f07c92bf199c14e9",
"size": "346... |
"""The security service api."""
from oslo_log import log
import six
import webob
from webob import exc
from manila.api import common
from manila.api.openstack import wsgi
from manila.api.views import security_service as security_service_views
from manila.common import constants
from manila import db
from manila impor... | {
"content_hash": "1dbc12778856f6bad26bdefcac0a4a06",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 79,
"avg_line_length": 38.40394088669951,
"alnum_prop": 0.5846587993842997,
"repo_name": "jcsp/manila",
"id": "c0ffb37afc645ed869d5c7c0c9fbadf2e0b72194",
"size": "8425",
... |
subreddit = 'tf2+tf2memes+tf2shitposterclub'
t_channel = '@r_TF2'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| {
"content_hash": "f9c6bc09cfc617406ad2618bed082c19",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 44,
"avg_line_length": 23.166666666666668,
"alnum_prop": 0.7338129496402878,
"repo_name": "Fillll/reddit2telegram",
"id": "308b1852787975c468ee7bc0ccd039c43b93cdbe",
"size":... |
"""Support for Ebusd daemon for communication with eBUS heating systems."""
from datetime import timedelta
import logging
import socket
import ebusdpy
import voluptuous as vol
from homeassistant.const import (
CONF_HOST,
CONF_MONITORED_CONDITIONS,
CONF_NAME,
CONF_PORT,
)
import homeassistant.helpers.c... | {
"content_hash": "a14cfe991c60d57b54a54156b765e825",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 88,
"avg_line_length": 30.89763779527559,
"alnum_prop": 0.6049949031600408,
"repo_name": "tchellomello/home-assistant",
"id": "855e62727b56838aeed96599cafd7c5e23c803ed",
"... |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem140.py
#
# Modified Fibonacci golden nuggets
# =================================
# Published on Saturday, 3rd February 2007, 07:00 am
#
# Consider the infinite polynomial series AG(x) = xG1 + x2G2 + x3G3 + ...,
# where Gk is the kth term of the second order recu... | {
"content_hash": "ffe16dda808cfd55f0ead3f481d144dd",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 39.125,
"alnum_prop": 0.6528221512247071,
"repo_name": "olduvaihand/ProjectEuler",
"id": "fd6b2b25dc06ed58a27283db0ff99ecc1a801907",
"size": "941",
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class CopyFolder(Choreography):
def __init__(self, temboo_session):
"""
Create a ne... | {
"content_hash": "6e27fbdbaadceddae6139f72ace0feb1",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 182,
"avg_line_length": 41.28395061728395,
"alnum_prop": 0.6791267942583732,
"repo_name": "jordanemedlock/psychtruths",
"id": "f92402fcfe9019821bfbbdfcf6969e8c5f81da6e",
"s... |
from collections import OrderedDict
from sqlalchemy import desc, asc
from webob.multidict import MultiDict
class SortQueryGenerator(OrderedDict):
@classmethod
def from_getlist(cls, field_list):
# assert isinstance(field_list, unicode)
return cls(cls._convert_from_getlist(field_list))
... | {
"content_hash": "a33fa569da249dc824915314cf39bcb0",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 79,
"avg_line_length": 30.61006289308176,
"alnum_prop": 0.5559893158002877,
"repo_name": "fillest/sapyens",
"id": "1f13e7ead2b07c1bd2cb682a145db8b3744c998a",
"size": "4891... |
import os
import sys
import unittest
## package
from leylab_pipelines.DB import Convert
# data dir
test_dir = os.path.join(os.path.dirname(__file__))
data_dir = os.path.join(test_dir, 'data')
# global variables
ENSEMBL_ID = 'ENST00000407559'
HGNC_ID = '9245'
ENTREZ_ID = '39'
UNIPROT_ID = 'Q9BWD1'
ACCESSION_ID = 'AC... | {
"content_hash": "4cc5c12db1ecd2f99538b1d3d8ee6dcb",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 73,
"avg_line_length": 28.416666666666668,
"alnum_prop": 0.6212121212121212,
"repo_name": "leylabmpi/leylab_pipelines",
"id": "56bba0012d6b2373b542ac75e53b4a47f04bb32c",
"s... |
"""
Project Bluebox
2015, University of Stuttgart, IPVS/AS
"""
from _collections_abc import Iterator
from itertools import count
import abc
"""
Project Bluebox
Copyright (C) <2015> <University of Stuttgart>
This software may be modified and distributed under the terms
of the MIT license. See t... | {
"content_hash": "bf74bbb8efcec4605c4391058d71fa08",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 186,
"avg_line_length": 34.193333333333335,
"alnum_prop": 0.5947553129264964,
"repo_name": "Al-Hashimi/BlueMix",
"id": "fa957e360d46f5f28fd74f4a92da9c95f2a16b21",
"size": ... |
"""
A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph is a maximal strongly connected subgraph.
Time Complexity: The above algorithm calls DFS, fins reverse of the graph and again calls DFS. DFS takes O(V+E) for a graph rep... | {
"content_hash": "64789ca48b2bbf61f6c7d59adf6f9f3e",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 264,
"avg_line_length": 26.444444444444443,
"alnum_prop": 0.5985060690943044,
"repo_name": "codervikash/algorithms",
"id": "ccb5d3f60baf40c3eb5174a6cb113d1035b67f1d",
"size... |
import pickle
import os
import settings
class Session(object):
def __init__(self):
self._data = {}
self._load()
def __getitem__(self, key):
return self._data.get(key)
def __setitem__(self, key, value):
self._data[key] = value
self._save()
def _load(self):
... | {
"content_hash": "96f5a9da4b3f5fbff58122fca59ee4c3",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 97,
"avg_line_length": 23.137931034482758,
"alnum_prop": 0.563338301043219,
"repo_name": "patrickporto/python-box",
"id": "99917cef67658bddc8f64d18022668c5344b43e7",
"size"... |
import copy
from auto_gen import DBVistrail as _DBVistrail
from auto_gen import DBAdd, DBChange, DBDelete, DBAbstraction, DBGroup, \
DBModule
from id_scope import IdScope
class DBVistrail(_DBVistrail):
def __init__(self, *args, **kwargs):
_DBVistrail.__init__(self, *args, **kwargs)
self.idScope = IdSc... | {
"content_hash": "521bdf941922af09a2e91880804ede75",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 77,
"avg_line_length": 40.10752688172043,
"alnum_prop": 0.5621983914209115,
"repo_name": "CMUSV-VisTrails/WorkflowRecommendation",
"id": "ba942d14483f36a9bea279d12019700ea6cf... |
'''
Created on Apr 7, 2014
@author: paepcke
NOTE: Requires existence of database 'unittest' and user 'unittest' without pwd
and ALL privileges. (Could get away with fewer privileges, but who cares.
'''
from collections import OrderedDict
import datetime
import unittest
from scripts.addAnonToActivityGradeTab... | {
"content_hash": "0ec4f028c224b49749ac1aee0535b3b5",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 438,
"avg_line_length": 49.61077844311377,
"alnum_prop": 0.5254073627036814,
"repo_name": "paepcke/json_to_relation",
"id": "3ddb95f296036142150b0ff2985dcf67b534b77b",
"si... |
from distutils.core import setup
setup(
name='Rancher V2 API Integration Tests',
version='0.1',
packages=[
'core',
],
license='ASL 2.0',
)
| {
"content_hash": "21a1f3f3573f9a8a6cbe87bc01128857",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 16.6,
"alnum_prop": 0.5903614457831325,
"repo_name": "rancher/v2-api",
"id": "2fa5f03bf0c36ff1a58ed2d7fff041f6a37a8cd4",
"size": "166",
"binary": f... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
from django.conf import settings
from django.contrib.gis.geos import Polygon
from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Q
from djan... | {
"content_hash": "245a3f944cd4eac948a49263f01aee37",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 78,
"avg_line_length": 34.25595238095238,
"alnum_prop": 0.635881841876629,
"repo_name": "RickMohr/nyc-trees",
"id": "0430d00d3c50a470409f54b8f021ae97848c2ee7",
"size": "11... |
import warnings
from .._tqdm import TqdmExperimentalWarning
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=TqdmExperimentalWarning)
from ..autonotebook import tqdm, trange
__all__ = ["tqdm", "trange"]
| {
"content_hash": "2595198968bc629b8805b675209099b4",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 69,
"avg_line_length": 39.166666666666664,
"alnum_prop": 0.7574468085106383,
"repo_name": "huguesv/PTVS",
"id": "b475793ca118fd166b54a96925b2fd5cbd33329c",
"size": "235",
... |
'''
$ sudo ip netns add ns1
$ sudo ip link set dev veth1 netns ns1
$ sudo ip netns exec ns1 bash
# python recv.py
'''
import pcap
from ryu.lib.packet import packet, icmpv6
for ts, data in pcap.pcap():
pkt = packet.Packet(data)
i = pkt.get_protocol(icmpv6.icmpv6)
m = i.data
print ts, i | {
"content_hash": "0c00b3bf184a621e4ccccd4f0715ce78",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 41,
"avg_line_length": 21.571428571428573,
"alnum_prop": 0.6721854304635762,
"repo_name": "ntts-clo/mld-ryu",
"id": "0f3535f0e0a64051e8dc59d50797f72ec285d4fd",
"size": "302... |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
class User(AbstractUser):
# First Name and Last Name do not cover name patterns
# around the globe.
name = models.CharField(_("Name of Us... | {
"content_hash": "bdc51417b5bd2ffdfd3b70bd6c4637ed",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 30.294117647058822,
"alnum_prop": 0.7126213592233009,
"repo_name": "evanepio/dotmanca",
"id": "5d814f1e24bec77305413e01d4444a470099bc95",
"size": "51... |
from oslo_log import versionutils
from oslo_policy import policy
from neutron.conf.policies import base
DEPRECATED_REASON = """
The network segment range API now supports project scope and default roles.
"""
COLLECTION_PATH = '/network_segment_ranges'
RESOURCE_PATH = '/network_segment_ranges/{id}'
rules = [
po... | {
"content_hash": "9964f72dfa6a48a2f4b83457e3f9b5f0",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 75,
"avg_line_length": 30.78021978021978,
"alnum_prop": 0.5680114244912531,
"repo_name": "openstack/neutron",
"id": "b0e07640f76bb8e3d0cb689d467dc133ffc33402",
"size": "341... |
from __future__ import absolute_import
import collections
import six
from collections import OrderedDict
from datetime import timedelta
from django.conf import settings
from django.utils import timezone
from enum import Enum
from sentry.utils.dates import to_datetime, to_timestamp
from sentry.utils.services import S... | {
"content_hash": "8ee2201c6e87370134c75c90148646d9",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 100,
"avg_line_length": 35.58139534883721,
"alnum_prop": 0.6168300653594772,
"repo_name": "mvaled/sentry",
"id": "f0550962636a6d091bf6466ecaaa24bd73a3aab4",
"size": "18360... |
import requests, bs4, json, threading, getpass
from collections import Counter
def getPayload():
payload = {
'user[remember_me]': 0
}
# TODO: get username and password
username = input('Input your username: ')
password = getpass.getpass('Input your password: ')
payload['user[handle]']... | {
"content_hash": "beee45a898ccfaefbb2a4fcfc28fbaa7",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 91,
"avg_line_length": 30.483870967741936,
"alnum_prop": 0.5365079365079365,
"repo_name": "endvroy/PATlanguages",
"id": "6ff22029ededf6428c78ae7acd882e19f08951aa",
"size": ... |
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/general/shared_distant_ship_controller_imperial.iff"
result.attribute_template_id = -1
result.stfName("obj_n","unknown_object")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return r... | {
"content_hash": "b38abcfaf623be1482e6a85b3ebe4108",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 96,
"avg_line_length": 25,
"alnum_prop": 0.7076923076923077,
"repo_name": "obi-two/Rebelion",
"id": "0feb2ecb673c10a2977b8ffc92ed4b737bcce2e0",
"size": "470",
"binary": f... |
import proto # type: ignore
from google.cloud.dialogflowcx_v3beta1.types import flow
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.dialogflow.cx.v3beta1",
manifest={
"CreateVersi... | {
"content_hash": "76ab531a71d894fe6b0fdd0d2560f1bf",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 119,
"avg_line_length": 30.70985915492958,
"alnum_prop": 0.6147495872317006,
"repo_name": "googleapis/python-dialogflow-cx",
"id": "415b9b2b73b207f2b29cc004b649081111e261f8"... |
"""The tests for the counter component."""
# pylint: disable=protected-access
import asyncio
import unittest
import logging
from homeassistant.core import CoreState, State
from homeassistant.setup import setup_component, async_setup_component
from homeassistant.components.counter import (
DOMAIN, decrement, increm... | {
"content_hash": "74dfbf613e5cd5e9d341086e32b98333",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 78,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.5783173734610123,
"repo_name": "LinuxChristian/home-assistant",
"id": "8dc04f0e76ab7b910d7cc8309ff0c8884d579b85",
... |
"""
opentrons_shared_data: a python package wrapping json config definitions
for the opentrons stack
This package should never be installed on its own, only as a dependency of
the main opentrons package
"""
import os
import json
from .load import get_shared_data_root, load_shared_data
HERE = os.path.abspath(os.path... | {
"content_hash": "82688292843fc35d38e3abb59a1fdea9",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 26.208333333333332,
"alnum_prop": 0.6963434022257552,
"repo_name": "OpenTrons/opentrons_sdk",
"id": "850d862fb69d19d131f1b4583c62674eebe58a2b",
"size... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General configura... | {
"content_hash": "47f4e4b961b0eb74f141cb19e9dec6de",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 80,
"avg_line_length": 31.43621399176955,
"alnum_prop": 0.6849064013614348,
"repo_name": "bennylope/django-organizations",
"id": "e80b2440b174e250c261b0b1f8b03f851a71a84d",
... |
"""engine.SCons.Tool.aixf77
Tool-specific initialization for IBM Visual Age f77 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permiss... | {
"content_hash": "046c40c6a2822832bfb974ec1150b0af",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 75,
"avg_line_length": 33.5125,
"alnum_prop": 0.7157776948899665,
"repo_name": "wfxiang08/Nuitka",
"id": "83c06442cc093a659061c5d15d103fe769b32481",
"size": "2681",
"bina... |
import requests
def http_get(url):
response = requests.get(url)
response.raise_for_status()
return response.text
| {
"content_hash": "a20e3d812b5c6c4ce4ae558ee3c12cdb",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 32,
"avg_line_length": 18.142857142857142,
"alnum_prop": 0.7007874015748031,
"repo_name": "teamfruit/defend_against_fruit",
"id": "97747f503fa21dfb6cd0b32032312b1e74f5db92",
... |
"""RestSession class for creating 'connections' to the Cisco Spark APIs."""
# Use future for Python v2 and v3 compatibility
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
from builtins import *
from past.builtins import basestring
from future import standard_li... | {
"content_hash": "bb9ac1eb31c504a820fbada42ee0374c",
"timestamp": "",
"source": "github",
"line_count": 471,
"max_line_length": 79,
"avg_line_length": 35.70700636942675,
"alnum_prop": 0.6060173623498633,
"repo_name": "jbogarin/ciscosparkapi",
"id": "9552ece21e9c01b9fd2f420df933a42d2c64c874",
"size"... |
import numpy as np
def compute_fsd_features(im_label, K=128, Fs=6, Delta=8, rprops=None):
"""
Calculates `Fourier shape descriptors` for each objects.
Parameters
----------
im_label : array_like
A labeled mask image wherein intensity of a pixel is the ID of the
object it belongs t... | {
"content_hash": "ffee112d7aebc84caab940a74b484057",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 78,
"avg_line_length": 30.654008438818565,
"alnum_prop": 0.6068823124569855,
"repo_name": "DigitalSlideArchive/HistomicsTK",
"id": "0d0cc2aa8e62715d15f3b1bbc135e54e10262190"... |
from __future__ import absolute_import
import numpy as np
from .. import backend as K
from .. import activations, initializations, regularizers
from ..engine import Layer, InputSpec
def time_distributed_dense(x, w, b=None, dropout=None,
input_dim=None, output_dim=None, timesteps=None):
... | {
"content_hash": "99c647a688ca3e67b73e32692f0119d8",
"timestamp": "",
"source": "github",
"line_count": 837,
"max_line_length": 130,
"avg_line_length": 46.81242532855436,
"alnum_prop": 0.5587769894339237,
"repo_name": "DeepGnosis/keras",
"id": "b41182deceb7ec26bab4ae07f3934287fc904bd9",
"size": "39... |
"""
Copyright 2012 Ali Ok (aliokATapacheDOTorg)
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 wr... | {
"content_hash": "b37ae6eec78a33b3bbaaba318bfe7c71",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 106,
"avg_line_length": 44.609756097560975,
"alnum_prop": 0.7840349917987972,
"repo_name": "aliok/trnltk",
"id": "14ae90be94dcfcac0729c3708de2ef789d996bb2",
"size": "1829",... |
import cgi
import hashlib
from core import database
from base64 import b64encode, b64decode
from os import urandom
class User:
""" Represents a user """
def __init__(self, userID, userName, userHash, userSalt):
self.userID = userID
self.userName = userName
self.userHash = userHash
... | {
"content_hash": "34cb93685e46f4b2e360783bdd80c187",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 88,
"avg_line_length": 26.151515151515152,
"alnum_prop": 0.6040942448821939,
"repo_name": "MatthewJWalls/Spiel",
"id": "387b7b012924a2d9703e4347519cd99c6d9c248f",
"size": "... |
import re
import logging
import sys
import urllib2 as u2
import kerberos as k
def getLogger():
log = logging.getLogger("http_kerberos_auth_handler")
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
handler.setFormatter(formatter)
log.addHandl... | {
"content_hash": "da1ccedffd25b1a3a6682ae8da22384f",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 93,
"avg_line_length": 29.832369942196532,
"alnum_prop": 0.5962022863786088,
"repo_name": "atupal/urllib2_kerberos",
"id": "0c362755c3aef38ec0719e90469f231dcf6b43e1",
"siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.