text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../'))
from qhost import Display
class TestDisplay(unittest.TestCase):
def setUp(self):
self.display = Display()
def test_padding(self):
o = self.display.pad("m", 10)
self.a... | {
"content_hash": "ac234e08d56c6dc3560b6bf43bef2079",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 81,
"avg_line_length": 28.607843137254903,
"alnum_prop": 0.5777930089102125,
"repo_name": "kmanalo/qhost",
"id": "1a1cf6386e544417d894d21d4b3e8878a68f81b3",
"size": "1459",... |
"""Separable array class."""
import numpy as np
__all__ = ('separray',)
class separray(np.ndarray):
"""Separable array, for iterating over parts of an array.
Iterating over this array iterates over views to the separate parts of the
array as defined from initialization. Aside from that and the :attr:`p... | {
"content_hash": "55d7800f7d0cdb78f95dfb851311ce13",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 79,
"avg_line_length": 32.791666666666664,
"alnum_prop": 0.6114993646759848,
"repo_name": "ryanvolz/prx",
"id": "7375c741198ad84d79ec7ab27390b2fde959278c",
"size": "3517",
... |
"""Copyright © 2014 German Neuroinformatics Node (G-Node)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted under the terms of the BSD License. See
LICENSE file in the root of the Project.
Author: Jan Grewe <jan.grewe@g-node.org>
This tutorial ... | {
"content_hash": "58766172dd96df94dd9beb97004e3f07",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 132,
"avg_line_length": 39.82203389830509,
"alnum_prop": 0.6897212172802724,
"repo_name": "stoewer/nixpy",
"id": "b859ca8d07e1b4dbc19120f18d432c0caa7e00a2",
"size": "4747"... |
import logging
from cloudfiles.errors import ContainerNotEmpty
from django import shortcuts
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.template.defaultfilters import filesizeformat
from django.utils import http
from novaclient import exceptions as novaclient_exceptions... | {
"content_hash": "03338318bb097cef9e06e425c42d7422",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 78,
"avg_line_length": 33.57954545454545,
"alnum_prop": 0.6042301184433164,
"repo_name": "citrix-openstack/horizon",
"id": "84e027f07265ab6deb1109a88482ddfcad34186e",
"siz... |
import logging
import tempfile
from telemetry.core import exceptions
from telemetry.core.platform import tracing_category_filter
from telemetry.core.platform import tracing_options
from telemetry.core import util
from telemetry.core import video
from telemetry import decorators
from telemetry.image_processing import i... | {
"content_hash": "03f2fe56bed6de48658fb2e370dbebfa",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 80,
"avg_line_length": 38.53,
"alnum_prop": 0.7209966260057098,
"repo_name": "mou4e/zirconium",
"id": "fd37f0a0b234776b010cb3813222883a63e924f9",
"size": "7869",
"binary... |
"""
Function fusion example.
Fusing map operations together.
"""
from __future__ import print_function, absolute_import
from alge import datatype, Case, of
Map = datatype("Map", ["func", "value"])
Fuse = datatype("Fuse", ["first", "second"])
Func = datatype("Func", ["name"])
Var = datatype("Var", ["name"])
class fu... | {
"content_hash": "fe79fab4193e26ee402157d801344e4b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 24.285714285714285,
"alnum_prop": 0.5870588235294117,
"repo_name": "ContinuumIO/pyalge",
"id": "c459b19433c2f570f250bc5cc6dfdec582cbdb55",
"size": "8... |
"""
Helper methods for operations related to the management of volumes,
and storage repositories
"""
import time
from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova import utils
from nova.virt.hyperv import basevolumeutils
from nova.virt.hyperv import vmutils
CONF = cfg.CONF
cla... | {
"content_hash": "dc52f56fd81ae0d0f57ec0bfa6f010d2",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 78,
"avg_line_length": 38.49152542372882,
"alnum_prop": 0.6041391457507705,
"repo_name": "citrix-openstack-build/nova",
"id": "a3d8e20271319f0acb8c2cc40bd4de0ff3800358",
"s... |
"""
Rectified linear (ReLU) transform functions and classes.
"""
from neon.transforms.activation import Activation
class RectLin(Activation):
"""
Embodiment of a rectified linear activation function.
"""
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def apply_function(self,... | {
"content_hash": "5fe317f654ae7129b9b980128179fef6",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 77,
"avg_line_length": 35.514925373134325,
"alnum_prop": 0.6112628703509141,
"repo_name": "ml-lab/neon",
"id": "bbf51704c6a4f282de3d6b56c6a760bb500a397a",
"size": "5500",
... |
"""Tests for the Landis+Gyr Heat Meter component."""
| {
"content_hash": "bae5bd38b572c6ba82502b45a303abc7",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 52,
"avg_line_length": 53,
"alnum_prop": 0.7169811320754716,
"repo_name": "w1ll1am23/home-assistant",
"id": "0ee6eb225100a9efc55a96de489a36ccf13ff167",
"size": "53",
"bina... |
from django.contrib import admin
from chat.models import UserProfile, Comments, Roll, Emblem
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
# Register your models here.
class UserProfileAdmin(admin.StackedInline):
... | {
"content_hash": "8cfa7043d4ed057d8d574b12353b7af7",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 94,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.7091346153846154,
"repo_name": "crazyskateface/LC",
"id": "73f20f919fce708ea0909e19d2ac62a5035ce44f",
"size": "16... |
import pandas as pd
import datetime
from collections import Counter
from scipy.signal import argrelmax
def data_loader(filename):
df = pd.read_csv(filename)
df['date'] = df['timestamp'].apply(lambda x: datetime.datetime.fromtimestamp(int(x)).strftime('%Y-%m-%d %H:%M:%S'))
return df
def wrangling(data_frame):
... | {
"content_hash": "b6cb11986217bb2a99b4a6aa00998cf0",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 116,
"avg_line_length": 24.78125,
"alnum_prop": 0.6443883984867591,
"repo_name": "ignacioelola/steam-stats",
"id": "45b2dc1f643b087b11fe1ce9f3fd0ff2ff513064",
"size": "1587... |
import translate.storage.versioncontrol
from translate.storage.versioncontrol import run_command
from translate.storage.versioncontrol import GenericRevisionControlSystem
def is_available():
"""check if bzr is installed"""
exitcode, output, error = run_command(["bzr", "version"])
return exitcode == 0
def... | {
"content_hash": "d599e9a1dae59a6efd451b697a9ff9c8",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 79,
"avg_line_length": 38.617283950617285,
"alnum_prop": 0.5812020460358056,
"repo_name": "dbbhattacharya/kitsune",
"id": "83faa19140f39693e734d46dcd3d0b9a40b6c6d8",
"size"... |
try:
from setuptools import setup, find_packages
except ImportError:
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(name="ampcrowd_client",
version="0.0.4",
description="A python client for using the AMPCrowd service.",
license="Apache License ... | {
"content_hash": "b0fc8fa74b148a29791ff6ac5f9a5b68",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 29.82608695652174,
"alnum_prop": 0.6297376093294461,
"repo_name": "amplab/ampcrowd-client-py",
"id": "6e45f80273b61a3d444b87fe2f04a42314fa3bdf",
"siz... |
"""
A class to manage sets of neuroimage files.
"""
# ------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
# Wrocław University of Technology
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# -------------------------------... | {
"content_hash": "ed29f8380e86214c32d5081c398c841a",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 114,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.5510214375788146,
"repo_name": "Neurita/boyle",
"id": "e2e19228a7b828d83e99812ae43f7ead1291c0a5",
"size": "1984... |
"""
A minimal front end to the Docutils Publisher, producing LaTeX using
the new LaTeX writer.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates LaTeX documents from standalone reStructuredText... | {
"content_hash": "2c717fc31e10269a263ff7140fada370",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 77,
"avg_line_length": 28.36842105263158,
"alnum_prop": 0.7235621521335807,
"repo_name": "santisiri/popego",
"id": "903ada50aec2b155852c4bd34223782039fe76ad",
"size": "805"... |
def listattrs(x):
try:
dictkeys = x.__dict__.keys()
except (AttributeError, TypeError):
dictkeys = []
#
try:
methods = x.__methods__
except (AttributeError, TypeError):
methods = []
#
try:
members = x.__members__
except (AttributeError, TypeError):... | {
"content_hash": "a5aba1f04f3981543bb939bce34fd034",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 69,
"avg_line_length": 25.28358208955224,
"alnum_prop": 0.551948051948052,
"repo_name": "MalloyPower/parsing-python",
"id": "356beccf8f3f1d663055374c379524172bc034d4",
"siz... |
import os, pest
class CustomPest(pest.Pest):
cmd = ''
def set_command(self, cmd):
self.cmd = cmd
def run_tests(self):
super(CustomPest, self).run_tests()
self.notify(self.grade_result(os.system(self.cmd))) | {
"content_hash": "638bf342aa14a6afbffa15f87012d298",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 23.363636363636363,
"alnum_prop": 0.5836575875486382,
"repo_name": "ccollins/pest",
"id": "d1a2f91695d22899fe9a6b6a7354e10dfe298d20",
"size": "257",
... |
"""General middleware."""
from django.utils.cache import patch_vary_headers
class VaryByHostMiddleware(object):
"""Different cache per hostname."""
def process_response(self, request, response):
"""Add "host" to cache key."""
patch_vary_headers(response, ('Host',))
return response
| {
"content_hash": "c4a4a26feeaf321953706df35297eba4",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 50,
"avg_line_length": 26.5,
"alnum_prop": 0.6635220125786163,
"repo_name": "happeninghq/happening",
"id": "ff3885eb874cf4c988dae6b11aac39eec1209280",
"size": "318",
"bin... |
from source.app import app
from source.tools.configuration import Configuration
if __name__ == '__main__':
context = ('server.crt', 'server.key')
config = Configuration()
config.migrate()
app.run(host='0.0.0.0',
port=8500,
ssl_context=context,
threaded=True)
| {
"content_hash": "a5a585c2408be830f787f14a25295c11",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 52,
"avg_line_length": 28.363636363636363,
"alnum_prop": 0.5993589743589743,
"repo_name": "fpytloun/alba-asdmanager",
"id": "03378eec197ba419c55342cfa6cb303e68b8b05b",
"siz... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""PyAuto: Python Interface to Chromium's Automation Proxy.
PyAuto uses swig to expose Automation Proxy interfaces to Python.
For ... | {
"content_hash": "ca9fda780e8a6886afb19dbbad086249",
"timestamp": "",
"source": "github",
"line_count": 4919,
"max_line_length": 80,
"avg_line_length": 36.33482415125025,
"alnum_prop": 0.638093000095115,
"repo_name": "aYukiSekiguchi/ACCESS-Chromium",
"id": "51ae497b67b93277fdd9bf3a025b7ac28df776a0",
... |
import os
import subprocess
import tempfile
import time
import IECore
import Gaffer
import GafferUI
import GafferScene
import GafferSceneUI
scriptWindow = GafferUI.ScriptWindow.acquire( script )
viewer = scriptWindow.getLayout().editors( GafferUI.Viewer )[0]
graphEditor = scriptWindow.getLayout().editors( GafferUI.Gr... | {
"content_hash": "8b25d90e40fb184d72e61b248079bb34",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 140,
"avg_line_length": 43.7979797979798,
"alnum_prop": 0.753459409594096,
"repo_name": "GafferHQ/gaffer",
"id": "ddea96ed38e329704fdb60097fad6a7daf0e3f36",
"size": "4605",... |
import itertools
import dictionary.dictionary as local_dictionary
# Problem:
# Given a sentence of abbreviated words and a dictionary,
# print out all possibilities for that sentence
#
# Abbreviation:
# The abbreviation of allies would be: a4s
# The abbreviation of alliance would be: a6e
# The abbreviation of atmosphe... | {
"content_hash": "904ee782f77fc5ba951b35444d0b7565",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 68,
"avg_line_length": 28.88372093023256,
"alnum_prop": 0.6940418679549114,
"repo_name": "Blisse/Interviews",
"id": "66868cf8619f3825d20614ecebde54157f92f861",
"size": "124... |
import datetime
import locale
import scrapy
from scrapy.utils.url import canonicalize_url
from dauphin.items import RssItem
class MernSpider(scrapy.Spider):
name = 'mern'
allowed_domains = ['mern.gouv.qc.ca']
start_urls = ['http://mern.gouv.qc.ca/presse/communiques.jsp']
root_url = "http://mern.gouv... | {
"content_hash": "66a29c4934dfe230ac581983f0786cd0",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 112,
"avg_line_length": 44.694117647058825,
"alnum_prop": 0.5930508028428534,
"repo_name": "mobula/scrapy_dauphin",
"id": "3e229d2d1a303f54957b69046d2b8bb7d192526e",
"size"... |
"""
bmp.py - module for constructing simple BMP graphics files
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, ... | {
"content_hash": "bff3e6321bddd1e42c4a07e69f08ef04",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 141,
"avg_line_length": 32.4,
"alnum_prop": 0.5794051627384961,
"repo_name": "Marcdnd/electrum-cesc",
"id": "66a100748a9119d36c46663e7f7397985a40d8d6",
"size": "7153",
"... |
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def size(s... | {
"content_hash": "e0c9edb026536e2f1b4195bcf298d264",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 45,
"avg_line_length": 18.636363636363637,
"alnum_prop": 0.5292682926829269,
"repo_name": "monicalzn/DrawMe",
"id": "297cbad8f3e7394e98bc6c5ded298d0cfd865e68",
"size": "410... |
"""
Implement the random and np.random module functions.
"""
import math
import random
import numpy as np
from llvmlite import ir
from numba.core.cgutils import is_nonelike
from numba.core.extending import intrinsic, overload, register_jitable
from numba.core.imputils import (Registry, impl_ret_untracked,
... | {
"content_hash": "133a3a46a81817c4c9df92ea9535e828",
"timestamp": "",
"source": "github",
"line_count": 2237,
"max_line_length": 134,
"avg_line_length": 34.191774698256594,
"alnum_prop": 0.5429288637284767,
"repo_name": "numba/numba",
"id": "797d17327f4757432741a66e648e5c0dbdd538b7",
"size": "76487... |
r"""Train a ConvNet on MNIST using K-FAC.
Multi tower training mode. See `convnet.train_mnist_multitower` for details.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import flags
import tensorflow as tf
from tensorflow.contrib.kfac.example... | {
"content_hash": "badcb3204b0ebd77d9130a5f155f5246",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 80,
"avg_line_length": 26,
"alnum_prop": 0.6900452488687783,
"repo_name": "drpngx/tensorflow",
"id": "4249bf8a8d9d3a5beb87d4140a55b0ee6eadbc64",
"size": "1573",
"binary":... |
"""
Created on 16 Oct 2020
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
from scs_core.data.crypt import Crypt
# --------------------------------------------------------------------------------------------------------------------
my_password = "secret_AES_key_string_to_encrypt/decrypt_with"
my_dat... | {
"content_hash": "6e6c2f9b7c5ab38a6dd7149802f2d47e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 118,
"avg_line_length": 29.441176470588236,
"alnum_prop": 0.6183816183816184,
"repo_name": "south-coast-science/scs_core",
"id": "63923749744dd60f118cd10380f3566d4dccd132",
... |
"""Test the base sequences views.
"""
import enaml
from exopy.testing.util import show_widget, handle_dialog
from exopy_pulses.pulses.sequences.base_sequences import (BaseSequence,
RootSequence)
with enaml.imports():
from exopy_pulses.pulses.sequences.vie... | {
"content_hash": "0d85b9fb9d8cc64d45c82aa8358be841",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 71,
"avg_line_length": 28.482142857142858,
"alnum_prop": 0.6614420062695925,
"repo_name": "Ecpy/ecpy_pulses",
"id": "a78c9779455f10c099331b75a2ec91184b982cb9",
"size": "198... |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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... | {
"content_hash": "98fa577fbc685f860a367232396323dd",
"timestamp": "",
"source": "github",
"line_count": 378,
"max_line_length": 102,
"avg_line_length": 41.26190476190476,
"alnum_prop": 0.6393537218695903,
"repo_name": "jhuapl-boss/intern",
"id": "fed5fe93232e304dd47fa25f90ec43c06e57322e",
"size": "... |
class UsersService:
def __init__(self, client):
self.client = client
async def users_byUserId_address_byAddressId_get(self, addressId, userId, headers=None, query_params=None, content_type="application/json"):
"""
get address id
of address
It is method for GET /users/{us... | {
"content_hash": "92212431a49025bdd4a96c9365791150",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 144,
"avg_line_length": 37.1978021978022,
"alnum_prop": 0.6026587887740029,
"repo_name": "Jumpscale/go-raml",
"id": "5a9ed287be716f2edbaffac37305f5a4425400ea",
"size": "346... |
"""
A simple connectionless client. It is for studying purposes only.
"""
import socket
__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"
def do_some_messaging(host, port):
"""
Handle a simple UDP client. Ask for stdinput data and send it to the UDP
server.
:param... | {
"content_hash": "067c7c66340570b293c348c9e9f3f181",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 25.642857142857142,
"alnum_prop": 0.649025069637883,
"repo_name": "facundovictor/non-blocking-socket-samples",
"id": "939bd03d22857c5578853166905cb542d... |
from flask import Flask
app=Flask(__name__)
# using this file to learn basic knowledge about flask web
@app.route("/")
def index():
return "Index Page"
@app.route("/hello")
def hello_world():
return "<h1>hello world!</h1>"
@app.route("/user/<username>")
def show_username(username):
return "User: %s" % us... | {
"content_hash": "fd3cd117b1e278fb746ec01b63de055d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 59,
"avg_line_length": 21.727272727272727,
"alnum_prop": 0.6359832635983264,
"repo_name": "Hubert51/AutoGrading",
"id": "8fc49f431a82981827297fd1b1c0ac85608b33d1",
"size": ... |
"""
Conformer generation.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
class ConformerGenerator(object):
"""
Generate molecule conformers.
Procedure
---------
... | {
"content_hash": "67c0c7d34389cdd32d5879e74a7b4067",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 77,
"avg_line_length": 27.741935483870968,
"alnum_prop": 0.6281976744186046,
"repo_name": "rbharath/deepchem",
"id": "4461d7de6cb20bb761e7b16f7d628670f60fb52d",
"size": "6... |
from openstack import proxy
class Proxy(proxy.BaseProxy):
def return_hello(self, **data):
return "Hello"
def return_goodbye(self, **data):
return "Goodbye"
| {
"content_hash": "588691deca7e92e0ef47c49c3dcf8812",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 37,
"avg_line_length": 18.4,
"alnum_prop": 0.6413043478260869,
"repo_name": "TerryHowe/openstacksdk-plugin",
"id": "23e313a34832451df5699ce860231bf5d34672d1",
"size": "730"... |
import os
import pwd
import grp
from .. import constants as _c
# Test Queue Directory
TEST_DIR = os.path.join(os.path.dirname(__file__), u'test_queues')
# The original (default) FSQ_ROOT value
ORIG_ROOT = _c.FSQ_ROOT
# 2 FSQ_ROOT directories for testing, within TEST_DIR
ROOT1 = os.path.join(TEST_DIR, u'queue')
ROOT... | {
"content_hash": "60df798606f117ca80a6184e818b5fe3",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 78,
"avg_line_length": 28.247524752475247,
"alnum_prop": 0.6943568173852086,
"repo_name": "axialmarket/fsq",
"id": "18e417e51fc562c7bc77b1927a91cf8406eac59e",
"size": "285... |
import logging
from .parameters import get_parameter
from .exceptions import MissingParametersError
from .paginate import Paginator
from . import BotoCoreObject
logger = logging.getLogger(__name__)
class Operation(BotoCoreObject):
_DEFAULT_PAGINATOR_CLS = Paginator
def __init__(self, service, op_data, pagin... | {
"content_hash": "a86fd6149897c50fdbefe20da6e8fa91",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 71,
"avg_line_length": 37.272,
"alnum_prop": 0.5451813693925736,
"repo_name": "jonparrott/botocore",
"id": "53a04e178d24356a20086fc16001bebdd88e7298",
"size": "5843",
"b... |
"""Unit tests for Gram-Charlier exansion
No reference results, test based on consistency and normal case.
Created on Wed Feb 19 12:39:49 2014
Author: Josef Perktold
"""
import pytest
import numpy as np
from scipy import stats
from numpy.testing import assert_allclose, assert_array_less
from statsmodels.sandbox.di... | {
"content_hash": "933d1751d3dba5b49fc3c567e30fd010",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 29.606382978723403,
"alnum_prop": 0.6291771469637082,
"repo_name": "jseabold/statsmodels",
"id": "ad4e7010c3c64ea304ca13658e3166a4add3163c",
"size": ... |
import sys
import os
import signal
# From https://blog.zhaw.ch/icclab/process-management-in-docker-containers/
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while 1:
write_stdout('READY\n')
line = sys.st... | {
"content_hash": "6538ee445d8f1bdf109144ed79403b42",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 78,
"avg_line_length": 27.88888888888889,
"alnum_prop": 0.5949535192563081,
"repo_name": "rfay/ddev",
"id": "60152523de75fd5e289c88c8d35667fc812684ed",
"size": "776",
"bi... |
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "ca_description"
PROJECT_SPACE_DIR = "/home/joemelt101/catkin_ws/install"
PROJECT_VERSION = "1.... | {
"content_hash": "191c976544a192534e7f0e3d5d029b38",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 68,
"avg_line_length": 46.42857142857143,
"alnum_prop": 0.64,
"repo_name": "joemelt101/BIR_Labs",
"id": "a7e364cccf9b0c05adccf979699fc469d7ade296",
"size": "382",
"binary"... |
from emend import Edit
PAGE_SIZE = 10
def get(handler, response):
site = handler.get_site(required=True)
# get some edits
from_index = handler.request.get('from')
if from_index:
from_index = int(from_index)
edits = Edit.all().\
ancestor(site).\
filter('index <=', from_index).\
filter... | {
"content_hash": "9c4549cd9448a1925e5155d37bf2fe10",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 91,
"avg_line_length": 30.5,
"alnum_prop": 0.5988428158148505,
"repo_name": "tantalor/emend",
"id": "5490d3540c891422c371d465157db9011bcf0762",
"size": "1037",
"binary": ... |
from ctypes import *
import array
import gc
import unittest
class X(Structure):
_fields_ = [("c_int", c_int)]
init_called = False
def __init__(self):
self._init_called = True
class Test(unittest.TestCase):
def test_from_buffer(self):
a = array.array("i", range(16))
x = (c_int *... | {
"content_hash": "d84630c3c52e5d6ffa6c896e242b368f",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 77,
"avg_line_length": 36.98581560283688,
"alnum_prop": 0.5913710450623202,
"repo_name": "Microsoft/PTVS",
"id": "55c244356b30d0e2913c31e8f0159ab810a32191",
"size": "5215"... |
from . import configs, utils
from ...core.logger import get_logger
from ...core.utils.callback import CallbackManager
import zmq
import time
import threading
import queue
logger = get_logger(__file__)
__all__ = ['NameServer']
class NameServerControllerStorage(object):
def __init__(self):
self._all_peer... | {
"content_hash": "4393f15fbd5bdf9c7dbe9f15d87bae67",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 109,
"avg_line_length": 40.168067226890756,
"alnum_prop": 0.5432008368200837,
"repo_name": "vacancy/TensorArtist",
"id": "75305c70c4adceb1b24624d5dad4935ac9ca53c3",
"size"... |
import sys
import 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('..'))
import mfr # noqa... | {
"content_hash": "65b4a91aa27a208d22d51683851bb52b",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 80,
"avg_line_length": 34.298850574712645,
"alnum_prop": 0.7158176943699732,
"repo_name": "AddisonSchiller/modular-file-renderer",
"id": "fb28ccda31dcf560b022751f63c4589e2da... |
"""Event loop and event loop policy."""
__all__ = (
'AbstractEventLoopPolicy',
'AbstractEventLoop', 'AbstractServer',
'Handle', 'TimerHandle', 'SendfileNotAvailableError',
'get_event_loop_policy', 'set_event_loop_policy',
'get_event_loop', 'set_event_loop', 'new_event_loop',
'get_child_watcher'... | {
"content_hash": "461c052c6ad41fd6f5b33bbdf8684ac3",
"timestamp": "",
"source": "github",
"line_count": 796,
"max_line_length": 79,
"avg_line_length": 32.89572864321608,
"alnum_prop": 0.6318121061676533,
"repo_name": "zooba/PTVS",
"id": "e4e632206af1bc5411094d51de533201feabe25f",
"size": "26185",
... |
"""Compute v2 Aggregate action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import parseractions
from openstackclient.common import utils
class AddAggregateHost(show.ShowOne):
"""Add host to aggregate"""
... | {
"content_hash": "f22cd6608a88799d19db368ecb688d14",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 78,
"avg_line_length": 29.075163398692812,
"alnum_prop": 0.5538945712037766,
"repo_name": "JioCloud/python-openstackclient",
"id": "8fff4e6fcf7b7e1cf3099a53e8300e02ff11cb03"... |
import sys
def getoutput3(cmd,stdin=None,pipe=None):
if not (sys.version_info < (3,0)):
try:
#Python 3 is an unmitigated disaster
#Thanks for breaking everything, Guido
from subprocess import check_output,STDOUT,Popen,PIPE
if stdin:
stdin = open(stdin)
result=None
if p... | {
"content_hash": "6cba268bcca5b49c6fd8062dc8f5b923",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 76,
"avg_line_length": 30.083333333333332,
"alnum_prop": 0.5969529085872576,
"repo_name": "minyee/sst-macro",
"id": "40a1ade11e3bd78fe61f5b712b1b687b01cdf6dc",
"size": "144... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST,... | {
"content_hash": "efb90a8af864c428dbd0118fdcbf9ae8",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 246,
"avg_line_length": 52.52256532066508,
"alnum_prop": 0.5041606367583212,
"repo_name": "111pontes/ydk-py",
"id": "07ab5c40a3e1c28f46f2cfc35f0cfb49685b59f2",
"size": "22... |
import sys
import time
import pyspark
import pyspark.streaming
import bloomfilter as bf
# parameters
N = 1000000 # number of items
W = 6 # number of workers
P = 18 # number of parititons
K = 10 # number of unique keys
def make_bloomFilter(L):
"""Create a new empty... | {
"content_hash": "606fd200f6e90ba34f1cdc696dff946a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 92,
"avg_line_length": 30.0188679245283,
"alnum_prop": 0.623507228158391,
"repo_name": "msalloum/cs181",
"id": "33355a4dfbaf23a578a0fd879403ff4857a996b2",
"size": "1613",
... |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.project import ProjectHelper
from fixture.james import JamesHelper
from fixture.signup import SignupHelper
from fixture.mail import MailHelper
class Application:
# запуск браузера
def __init__(self, browser, config):
... | {
"content_hash": "ec5ea5524077299d03cfef7ad48a9b0a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 30.58139534883721,
"alnum_prop": 0.626615969581749,
"repo_name": "kochetov-a/python_training_mantis",
"id": "73d95f966e2dca2d74110ca771c22b4fb254ccbf",... |
import re
from setuptools import setup, find_packages
# determine version and the authors
code = open('sklikapiclient/__init__.py', 'r').read(1000)
version = re.search(r'__version__ = \'([^\']*)\'', code).group(1)
authors = eval(re.search(r'__authors__ = (\[[^\]\[]*\])', code).group(1))
setup(
name='sklik-api-cli... | {
"content_hash": "f7090f0b6240c0b5b5d477f9b1ad4ac0",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 73,
"avg_line_length": 27.789473684210527,
"alnum_prop": 0.6136363636363636,
"repo_name": "mergado/sklik-api-client-python",
"id": "563e263bd51bd4a78a790353b921f34ba81d6381",... |
"""The feature extraction module contains classes for feature extraction."""
import numpy as np
import SimpleITK as sitk
import mialab.filtering.filter as fltr
class AtlasCoordinates(fltr.IFilter):
"""Represents an atlas coordinates feature extractor."""
def __init__(self):
"""Initializes a new inst... | {
"content_hash": "20a3968bad193c2cc2605af081cbc5eb",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 181,
"avg_line_length": 36.296747967479675,
"alnum_prop": 0.5731884869526263,
"repo_name": "mrunibe/MIALab",
"id": "7b30a91a5119fc53cede8e5293e29552c461122c",
"size": "892... |
"""Google Analytics Data API sample application demonstrating the batch creation
of multiple reports.
See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
for more information.
"""
# [START analyticsdata_run_batch_report]
from google.analytics.data_v1beta impor... | {
"content_hash": "8c8909cbcdca5e2e80e22dbe1e5cd73c",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 110,
"avg_line_length": 31.161290322580644,
"alnum_prop": 0.6340579710144928,
"repo_name": "googleapis/python-analytics-data",
"id": "07cdf40fdff541ddaa6256c202d484870f38c177... |
from subprocess import check_output
def get_pass():
return check_output("pass Users/mb/Library/Keychains/datameer.keychain/Apps/offline_imap", shell=True).splitlines()[0]
| {
"content_hash": "b38231fcd3d563042f4b7a5ff8c60d1a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 122,
"avg_line_length": 35.4,
"alnum_prop": 0.768361581920904,
"repo_name": "mbauhardt/dotfiles",
"id": "6a8235ff7758a94059eb895aa3e842aa6ed4162d",
"size": "201",
"binary"... |
from model.group import Group
import random
def test_delete_some_group(app,db,check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test"))
old_groups=db.get_group_list()
group=random.choice(old_groups)
app.group.delete_group_by_id(group.id)
new_groups=db.get_group_list(... | {
"content_hash": "85aa4bb3c745784912f783accc0b8297",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 109,
"avg_line_length": 35.0625,
"alnum_prop": 0.679144385026738,
"repo_name": "Nish1975/python_training",
"id": "f7941142a553f803333753a78d7871ae6553ec55",
"size": "561",
... |
import gc
from pprint import pprint
import weakref
gc.set_debug(gc.DEBUG_UNCOLLECTABLE)
class ExpensiveObject:
def __init__(self, name):
self.name = name
def __repr__(self):
return 'ExpensiveObject({})'.format(self.name)
def __del__(self):
print(' (Deleting {})'.format(self))... | {
"content_hash": "5a59b1096da2d33eebbd000de3357fd9",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 60,
"avg_line_length": 24.96153846153846,
"alnum_prop": 0.5947611710323575,
"repo_name": "jasonwee/asus-rt-n14uhp-mrtg",
"id": "f58a58eb0ae7df91abaa51b57ff686159eeab5ef",
"... |
import base64
from datetime import datetime
import json
from django.http import HttpResponseForbidden, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from holodeck.models import Metric, Sample
@csrf_exempt
def store(request):
"""
Main API method storing pushed data.
TODO: Needs a lot o... | {
"content_hash": "937dd3a492f1e4f49d6ac78c3759872a",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 31.92105263157895,
"alnum_prop": 0.6314921681780709,
"repo_name": "shaunsephton/holodeck",
"id": "08ed3accda443428b0f3eed0b20116b3ec8ed37e",
"size": ... |
from django.views.generic import ListView
from django.shortcuts import render, get_object_or_404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.core.mail import send_mail
from django.db.models import ... | {
"content_hash": "8921b3a38a89519bd574a589ef33bd95",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 77,
"avg_line_length": 33.02985074626866,
"alnum_prop": 0.5842747401717127,
"repo_name": "crasker/mysite",
"id": "900a83662810783475ba0d007b2cbc6a3c9d4576",
"size": "2213",... |
"""Test that some if statement tests can be simplified."""
# pylint: disable=missing-docstring, invalid-name, no-else-return
def test_simplifiable_1(arg):
# Simple test that can be replaced by bool(arg)
if arg: # [simplifiable-if-statement]
return True
else:
return False
de... | {
"content_hash": "5065a3e9b10c10843df9689aea83a3cc",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 75,
"avg_line_length": 26.008333333333333,
"alnum_prop": 0.5892342198013457,
"repo_name": "lucidmotifs/auto-aoc",
"id": "82e2d947da9dbf055a261efa0260c5d7e25e1841",
"size":... |
"""
Copyright 2017 Deepgram
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, software
distri... | {
"content_hash": "51144d907c2583db00af9d98eac95c7c",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 27.96808510638298,
"alnum_prop": 0.7299353366298973,
"repo_name": "deepgram/kur",
"id": "6ba03d33dbe772903967b0209f9bf99849f3668b",
"size": "2629",
... |
from flask import Blueprint
nanopub_blueprint = Blueprint("nanopub_blueprint", __name__)
| {
"content_hash": "4b6bfc5c567281f61c86d99c101628e8",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 60,
"avg_line_length": 30,
"alnum_prop": 0.7666666666666667,
"repo_name": "tetherless-world/graphene",
"id": "01aff691f59b4446f802317118c7f5c09e0ab1a3",
"size": "90",
"bin... |
"""
This file contains a Distancer object which computes and
caches the shortest path between any two points in the maze. It
returns a Manhattan distance between two points if the maze distance
has not yet been calculated.
Example:
distancer = Distancer(gameState.data.layout)
distancer.getDistance( (1,1), (10,10) )... | {
"content_hash": "8f0db991cbb9ea6e26a94aee7a603d2a",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 85,
"avg_line_length": 30.649717514124294,
"alnum_prop": 0.6280184331797235,
"repo_name": "startupjing/Artificial-Intelligence",
"id": "618470a1b78478698c242f5dd9905d03c64a1... |
"""
-------------------------------------------------------------------------
AIOpening - box.py
Defines a Box like Space (Rn with upper and lower bounds)
created: 2017/09/01 in PyCharm
(c) 2017 Sven - ducandu GmbH
-------------------------------------------------------------------------
"""
from .base imp... | {
"content_hash": "7fa70a02457c585cda35c78ff2d87133",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 113,
"avg_line_length": 28.96590909090909,
"alnum_prop": 0.5496273048254218,
"repo_name": "ducandu/aiopening",
"id": "ef83610e9863edd3d5ae43e296e68a95a3db31a4",
"size": "25... |
from django.conf import settings
from django.db import models
from workplace.constants import MaxLengths
class Person(models.Model):
workplace = models.ForeignKey('workplaces.Workplace', related_name='people')
first_name = models.CharField(max_length=MaxLengths.FIRST_NAME)
last_name = models.CharField(m... | {
"content_hash": "907b6671fa2ff3cf8501203e466fa660",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 85,
"avg_line_length": 25.07377049180328,
"alnum_prop": 0.644655116050997,
"repo_name": "dogukantufekci/workplace",
"id": "fa1d947af7a19e21dec28feaa9f9191f0e0cb919",
"size... |
from google.appengine.ext import ndb
import random, sys, math
def get_max_bits():
return int(math.log(sys.maxsize+2, 2))
def calculate_max_hashes(rows, bands):
return rows * bands
def get_random_bits(max_hashes):
return [random.getrandbits(get_max_bits()) for _ in xrange(max_hashes)]
class Dataset(n... | {
"content_hash": "30b7daf3c898bc89de4c696818022b54",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 77,
"avg_line_length": 34.25925925925926,
"alnum_prop": 0.5735135135135135,
"repo_name": "singhj/locality-sensitive-hashing",
"id": "0ebbd99ece49d4c004104f259813dd5c404ac77b"... |
""" MongoDB Backend - Uses aggregation pipeline
If you don't have a mongo server running
$ conda install mongodb -y
$ mongod &
>> from blaze import *
>> data = [(1, 'Alice', 100),
... (2, 'Bob', -200),
... (3, 'Charlie', 300),
... (4, 'Denis', 400),
... (5, 'Edith', -500)]
Migra... | {
"content_hash": "8ababb80d5135a9779f76275cee9fed7",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 86,
"avg_line_length": 27.625482625482626,
"alnum_prop": 0.56743535988819,
"repo_name": "cpcloud/blaze",
"id": "9dcc24a249ceb7a4534dbff779a645265eced584",
"size": "14310",... |
from distutils.core import setup
setup(name='mini-parse',
version='0.1',
py_modules=['mini_parse'],
author='Dan Simon',
author_email='des480@nyu.edu',
url='https://github.com/dan-simon/mini-parse')
| {
"content_hash": "68f23a456f47e00c447ea1887219e788",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 52,
"avg_line_length": 28.625,
"alnum_prop": 0.62882096069869,
"repo_name": "dan-simon/mini-parse",
"id": "ddbff2f39acadd81de5be7d785e1f5ab896206eb",
"size": "229",
"binar... |
import simulations.dynamics.npop_discrete_replicator as dr
import simulations.dynamics.replicator_fastfuncs as fastfuncs
import simulations.simulation as simulation
import math
import numpy as np
from nose.tools import assert_equal
class PDSim(dr.NPopDiscreteReplicatorDynamics):
_payoffs = [[3., 0.],[4., 1.]]
... | {
"content_hash": "861124a8c568e1c3665ce74a96d98888",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 214,
"avg_line_length": 36.864541832669325,
"alnum_prop": 0.5777585647897979,
"repo_name": "gsmcwhirter/simulations",
"id": "cfb38f6d69cfd2269bfcab3c3fa555a6a97f830f",
"si... |
"""CLI tool to manage the Blazar DB. Inspired by Neutron's same tool."""
import gettext
import os
from alembic import command as alembic_command
from alembic import config as alembic_config
from alembic import util as alembic_util
from oslo_config import cfg
from oslo_db import options as db_options
gettext.install(... | {
"content_hash": "837f305f4cba1c2079b036af64d45d58",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 77,
"avg_line_length": 29.523364485981308,
"alnum_prop": 0.6489395378284267,
"repo_name": "ChameleonCloud/blazar",
"id": "d11f88d9240e5e75b5476b688a4964f617694973",
"size"... |
'''Plot the point cloud from any .ply file with ASCII encoding using matplotlib and mplot3d'''
'''Team SAAS, Ekalavya 2017, IIT Bombay'''
#import the necessary packages
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import LinearLocator
import numpy as np
import matplot... | {
"content_hash": "ac8c8724cc7df92e436d25994d5d82a9",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 113,
"avg_line_length": 23.7319587628866,
"alnum_prop": 0.6715899218071243,
"repo_name": "animeshsrivastava24/3D-SCANNER-IITB",
"id": "defa698a06ed7fd19bae7a8e2d05845a00aa494... |
"""
"""
#Import Local Modules
import unittest
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import (Account,
Domain,
Router,
... | {
"content_hash": "3711836498cc62102c6c920a6b2b7da8",
"timestamp": "",
"source": "github",
"line_count": 925,
"max_line_length": 143,
"avg_line_length": 47.43351351351351,
"alnum_prop": 0.48550460388367217,
"repo_name": "mufaddalq/cloudstack-datera-driver",
"id": "09e1dd6309bf2c22aff33fc9a99c09edacea9... |
from copy import deepcopy
import yaml
from slackminion.bot import Bot
from slackminion.exceptions import NotSetupError
from slackminion.plugins.core import version
from slackminion.tests.fixtures import *
class PluginWithEvents(BasePlugin):
notify_event_types = [test_event_type]
def handle_event(self):
... | {
"content_hash": "66ae160efe087c175e28beec83d74084",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 91,
"avg_line_length": 38.02028985507246,
"alnum_prop": 0.6239231531600213,
"repo_name": "arcticfoxnv/slackminion",
"id": "92a6340d56a133579fd08d83a43096d6d705178e",
"size... |
"""
2010.09.18
S.Rodney
Module for constructing fake SN point spread functions.
This module is called by plantfake to build a set of fake SN psf
images. For each fake SN we define a separate psf profile for each of
the flt frames that it will be planted in. The psf profile is
constructed by TinyTim to incorporate g... | {
"content_hash": "75262d3e712e6b5f958a3efef7ea928f",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 120,
"avg_line_length": 38.9125,
"alnum_prop": 0.6024734982332155,
"repo_name": "srodney/hstfakes",
"id": "41776ad12576c37f06cfd3130dca8fc7e9cae2f4",
"size": "18704",
"b... |
import arcpy
countyref = "Database Connections\\"+dbaseNAME+"\\TPP_GIS.MCHAMB1.County\\TPP_GIS.MCHAMB1.County"
cntyQUERY = raw.input("county number?")
cntyQUERY
qursor = arcpy.SearchCursor(countyref)
for row in qursor:
numb = row.getValue("CNTY_NBR")
name = row.getValue("CNTY_NM")
if numb cntyQUERY
return name
... | {
"content_hash": "e7626f5590ef949167aeb656ce4cc2e6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 97,
"avg_line_length": 26.076923076923077,
"alnum_prop": 0.7345132743362832,
"repo_name": "adambreznicky/python",
"id": "e521f1842223822d6a4d872af2e5b45bdc4789b6",
"size": ... |
import pos_cashier | {
"content_hash": "049af5f361db363ebd1b7fbb17487e35",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 18,
"avg_line_length": 18,
"alnum_prop": 0.8888888888888888,
"repo_name": "vileopratama/vitech",
"id": "4d2bf69c3759b78c342d2def7fcb44353cfda62c",
"size": "18",
"binary": ... |
import os
import sys
# 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 con... | {
"content_hash": "2260474df66622af5ecb3f02a8cf56d3",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 80,
"avg_line_length": 31.887931034482758,
"alnum_prop": 0.6930251419302514,
"repo_name": "EricZaporzan/evention",
"id": "0556d664a0232819a96843211f1e943d83cb9b47",
"size"... |
import unittest
import warnings
from twilio import jwt
from twilio.task_router import TaskRouterCapability
class TaskRouterCapabilityTest(unittest.TestCase):
def check_policy(self, method, url, policy):
self.assertEqual(url, policy['url'])
self.assertEqual(method, policy['method'])
self.... | {
"content_hash": "123ab5ba56ce30a826653674837bd199",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 102,
"avg_line_length": 40.0722891566265,
"alnum_prop": 0.6282321106434156,
"repo_name": "bcorwin/twilio-python",
"id": "a32768bfbf23c7ac5f1b5195764c58ad07b13837",
"size":... |
from sqlalchemy import or_
from flask.ext.admin._compat import as_unicode, string_types
from flask.ext.admin.model.ajax import AjaxModelLoader, DEFAULT_PAGE_SIZE
class QueryAjaxModelLoader(AjaxModelLoader):
def __init__(self, name, session, model, **options):
"""
Constructor.
:pa... | {
"content_hash": "bafa14fe06177004453d9c067a053854",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 109,
"avg_line_length": 32.66233766233766,
"alnum_prop": 0.6127236580516898,
"repo_name": "pawl/flask-admin",
"id": "50e2e8d4140dee721731f6ec04c127a9e806a641",
"size": "251... |
from base import Task
from common import phases
class ImageExecuteCommand(Task):
description = 'Execute command in the image'
phase = phases.system_modification
@classmethod
def run(cls, info):
from common.tools import log_check_call
for raw_command in info.manifest.plugins['image_commands']['commands']:
... | {
"content_hash": "9e24a4ba635a00fe0ffde119460381f9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 93,
"avg_line_length": 31.285714285714285,
"alnum_prop": 0.7557077625570776,
"repo_name": "brianspeir/Vanilla",
"id": "1c8e3e4be16fe658fd688f92572535878d51de7c",
"size": "4... |
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db.models import CharField
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@pytho... | {
"content_hash": "284a1ad7410086e75cadbedc5b5ceda5",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 34.05,
"alnum_prop": 0.7474302496328928,
"repo_name": "bionikspoon/Annotation-Tool",
"id": "fb58aed5dfd6c9490fbe0d1ff9fc4dc85bb17b3d",
"size": "681",... |
from collections import namedtuple
from mw import Timestamp
from nose.tools import eq_
from ...datasources import page_creation, revision, site
from ...dependencies import solve
from ..page import age, is_content_namespace, is_mainspace
def test_is_content_namespace():
FakeNamespace = namedtuple("FakeNamespace"... | {
"content_hash": "e173e8cde3df5d7768778fc472c24461",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 34.21739130434783,
"alnum_prop": 0.6442185514612452,
"repo_name": "eranroz/revscoring",
"id": "ca4a97b5c10f65f589f483588d74003c478b68dc",
"size": "15... |
import warnings
from numba.core import (errors, types, typing, funcdesc, config, pylowering,
transforms)
from numba.core.compiler_machinery import (FunctionPass, LoweringPass,
register_pass)
from collections import defaultdict
@register_pass(mutates_C... | {
"content_hash": "d3f3cf4365dbd00442ffccefcef61b1d",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 79,
"avg_line_length": 43.02958579881657,
"alnum_prop": 0.5493674367436744,
"repo_name": "gmarkall/numba",
"id": "96153b4a84c624408b0846eadd9b4dda54e27950",
"size": "7272"... |
"""
author : Akshay Vilekar
Load the dialog box and choose file
"""
## imports
import tkFileDialog
import tkMessageBox
import tkSimpleDialog
import os
# global variable filename
infilename = ''
def encrypt():
global infilename
## open the temporary file and deal with it
filep = o... | {
"content_hash": "78f5cf361032523a6b1812bfaca73e67",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 126,
"avg_line_length": 27.064935064935064,
"alnum_prop": 0.5100767754318618,
"repo_name": "ak2703/Cifrare",
"id": "6be7d594dc0a83952f884dafeb6ea55d8e6ae554",
"size": "2100... |
"""Test echo socket communication."""
import pytest
# import sys
HEADER = 'GET /src/server.py HTTP/1.1<CRLF> Host: 127.0.0.1:5017<CRLF><CRLF>'
ECHO_MESSAGES = [
'Yo',
'This is a longer message, longer than most other messages.',
'This has sixteen',
]
CLIENT_MESSAGES = [
["GET /index.html HTTP/1.1<CR... | {
"content_hash": "f503368029cb7e4c1b6fb7aa6a6ff32a",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 111,
"avg_line_length": 34.83720930232558,
"alnum_prop": 0.6538718291054739,
"repo_name": "clair3st/http-server",
"id": "6b81f3ce4792cc6d01d32262181ad72dc41e800f",
"size": ... |
import hashlib
import os
import re
import tarfile
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
from typing import Dict
from studio.artifacts import artifacts_tracker
from studio.util import util, logs
from studio.credentials import credentials
from studio.storage impo... | {
"content_hash": "0ac1fb3426a59e0ff70428e99893f9d3",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 88,
"avg_line_length": 37.852380952380955,
"alnum_prop": 0.5760473015473645,
"repo_name": "studioml/studio",
"id": "174b19a519ff1087f4c3bf15d796df7af8016811",
"size": "158... |
from typing import Any, Callable, Iterable, Optional, Tuple, TypeVar
import reactivex
from reactivex import Observable, abc
_T = TypeVar("_T")
_TOther = TypeVar("_TOther")
def zip_(
*args: Observable[Any],
) -> Callable[[Observable[Any]], Observable[Tuple[Any, ...]]]:
def _zip(source: Observable[Any]) -> Ob... | {
"content_hash": "9b42ffc9a33426b800f05869fee48d73",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 86,
"avg_line_length": 28.710843373493976,
"alnum_prop": 0.5774234158623583,
"repo_name": "ReactiveX/RxPY",
"id": "f56a3d1256bf55de9a5ca3d31a42fd4d834562a8",
"size": "2383"... |
"""
Entrypoint for copy artifacts worker
Copyright (c) 2013 Heikki Nousiainen, F-Secure
See LICENSE for details
"""
import json
import optparse
import sys
import logging
from . import copy_artifacts
__appname__ = "copy artifacts worker"
__usage__ = "%prog -c <configuration file>"
__version__ = "1.0"
__author__ =... | {
"content_hash": "ba2734fc5e57a0599ef72c2c864602b7",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 153,
"avg_line_length": 26.8,
"alnum_prop": 0.6514925373134328,
"repo_name": "F-Secure/distci",
"id": "3207b0be12deef60d24420cbc46718c6cec3932a",
"size": "1340",
"binary"... |
import abc
import asyncio
import logging
from collections import (
defaultdict,
deque,
)
from logging import getLogger
from random import choice
from ..._async_compat.concurrency import (
Condition,
CooperativeRLock,
RLock,
)
from ..._async_compat.network import NetworkUtil
from ..._conf import (
... | {
"content_hash": "f02edb626d98e0558aedafec78088264",
"timestamp": "",
"source": "github",
"line_count": 809,
"max_line_length": 111,
"avg_line_length": 39.708281829419036,
"alnum_prop": 0.557246918192006,
"repo_name": "neo4j/neo4j-python-driver",
"id": "c0c8842e1ea0c3e2f0daaa7032ecef5d28893172",
"s... |
"""
Resource Export Tools
@see: U{B{I{S3XRC}} <http://eden.sahanafoundation.org/wiki/S3XRC>}
@requires: U{B{I{gluon}} <http://web2py.com>}
@requires: U{B{I{lxml}} <http://codespeak.net/lxml>}
@requires: U{B{I{xlwt}} <http://pypi.python.org/pypi/xlwt>}
@author: Dominic König <dominic[at]aidiq.... | {
"content_hash": "9ec0e33b996b9619aba4c1dbd9c1232a",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 90,
"avg_line_length": 32.85925925925926,
"alnum_prop": 0.5820559062218215,
"repo_name": "flavour/cedarbluff",
"id": "80db01d0bef70d1e9a20342213709da9b544efae",
"size": "4... |
from . import common
from ...systems import user
class ShadowStdoutLog(common.Log):
def parse(self):
self.logger.debug('parsing')
self.data = user.Users()
self.name = 'users'
with open(self.path, 'r') as f:
for line in f.readlines():
parts = line.rstri... | {
"content_hash": "4c6ce00905678283e6aaff23b645a882",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 31.72,
"alnum_prop": 0.5245901639344263,
"repo_name": "Doveps/bassist",
"id": "c8a265e9f411d4c8bddefce21f233e0863dcbba1",
"size": "872",
"binary": ... |
resources = {
'Bob' : [],
'Jim' : [],
'Nick' : [],
}
class project:
title = "Main Project"
estimate = 3
class task_a:
estimate = 8
desc = '''Common work.'''
class task_d:
class task_b:
estimate = 4
def deps(): return [project.task_a, other.t... | {
"content_hash": "c85935c5e0123050374f4983e198cca5",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 78,
"avg_line_length": 23.0188679245283,
"alnum_prop": 0.5729508196721311,
"repo_name": "fifoforlifo/pyqplan",
"id": "be3b61f8e2a2ed7dbdd9046e41f10972015dd1fc",
"size": "12... |
from rx import Observable, AnonymousObservable
from rx.internal.utils import adapt_call
from rx.internal import extensionmethod
@extensionmethod(Observable, alias="map")
def select(self, selector):
"""Project each element of an observable sequence into a new form
by incorporating the element's index.
1 -... | {
"content_hash": "a1ab5310bab533eb8704c72d62b5a29a",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 80,
"avg_line_length": 32.075,
"alnum_prop": 0.661730319563523,
"repo_name": "ChemiKhazi/Sprytile",
"id": "fbf555969c5e2014488b5b499aab51272a941e91",
"size": "1283",
"bin... |
import unittest
from app.utils import geocode
class ParseCsvTestCase(unittest.TestCase):
# Check that geocoded coordinates match expected values
def test_geocode(self):
loc1 = geocode('15 & chestnut')
self.assertAlmostEqual(float(loc1[0]), 39.951304, places=3)
self.assertAlmostEqual(f... | {
"content_hash": "dc085af960917b8e916e5b9fd3fa3666",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 68,
"avg_line_length": 36.92,
"alnum_prop": 0.6630552546045504,
"repo_name": "hack4impact/clean-air-council",
"id": "c132c233f52383da16b4d097ea084d04e67f2d4e",
"size": "923... |
import sys
from pathlib import Path
if len(Path(__file__).parents) > 2:
sys.path += [str(Path(__file__).parents[2])]
from style_variable_generator.find_invalid_css_variables import FindInvalidCSSVariables
import unittest
class FindInvalidCSSVariablesTest(unittest.TestCase):
def testUnspecified(self):
... | {
"content_hash": "c415ad0051c105e420ba75466300f465",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 87,
"avg_line_length": 22.49532710280374,
"alnum_prop": 0.5222268383880349,
"repo_name": "nwjs/chromium.src",
"id": "e3e1074f16a0184f1dc59a7d7aa52ca19efb63c7",
"size": "25... |
'''Code below was motivated from the question ==> https://www.hackerrank.com/challenges/ctci-find-the-running-median'''
#The solution to the question above requires finding the running median in constant time.
#An intuition to solving it is to split the array in to two halves(lower&higher) and maintain a Max Heap and ... | {
"content_hash": "0de0b2801ee88b3627075c27fdb7f6f6",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 145,
"avg_line_length": 28.689075630252102,
"alnum_prop": 0.541593438781488,
"repo_name": "jcchuks/Hackerrank",
"id": "6edc535138275678de9427468ddb48a31344f8e6",
"size": "... |
"""
topology_lib_tcpdump communication library implementation.
"""
from __future__ import unicode_literals, absolute_import
from __future__ import print_function, division
from re import match
from re import search
from datetime import datetime
from time import sleep
# Add your library functions here.
def tcpdump_r... | {
"content_hash": "7788027fc79d4d86850f13048aab1425",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 33.2972972972973,
"alnum_prop": 0.544237012987013,
"repo_name": "vivekramamoorthy/tcpdump",
"id": "5021fa103d45c3240ea1f834a18d3bee12c99a7d",
"size":... |
from flask import Blueprint, request
from ...middlewares import auth_manager
from .middlewares import (s, validate)
from ...container import container
from ...models import PeopleSynchronization
from ...jobs import SynchronizePeopleJob
from .view_models import PublicPerson, Person as PersonViewModel
people = Blueprint... | {
"content_hash": "b5952ce9911925f52bc1e431da16c6e4",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 77,
"avg_line_length": 21.5968992248062,
"alnum_prop": 0.6615218951902369,
"repo_name": "masom/doorbot-api-python",
"id": "967be1ecfd7d24275e46ba9b0a20602474600f08",
"size... |
from django.conf import settings
from django.db import models
class Product(models.Model):
name = models.TextField()
class Purchase(models.Model):
product = models.ForeignKey(Product)
quantity = models.IntegerField()
timestamp = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(se... | {
"content_hash": "5377c9267d8f9918eee36a42bbd07795",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.747093023255814,
"repo_name": "pzrq/discover-road-runner",
"id": "27047f7d47804336362de3a5882de77d3bb0fd96",
"size... |
"""
Threadsafe pure-Python implementation of the Circuit Breaker pattern, described
by Michael T. Nygard in his book 'Release It!'.
For more information on this and other patterns and best practices, buy the
book at https://pragprog.com/titles/mnee2/release-it-second-edition/
"""
from __future__ import annotations
im... | {
"content_hash": "5debd8b8c5714ba3eda107ea0fca7383",
"timestamp": "",
"source": "github",
"line_count": 985,
"max_line_length": 117,
"avg_line_length": 31.839593908629443,
"alnum_prop": 0.5893756775715835,
"repo_name": "danielfm/pybreaker",
"id": "87958f3009a74f3f4c6a53696d7d9d07ca8ccb0e",
"size": ... |
from juriscraper.opinions.united_states.state import tex
class Site(tex.Site):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.court_id = self.__module__
self.court_name = "capp_2"
| {
"content_hash": "c0fa3e34620943aff0d566a5b1f5cb9d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 56,
"avg_line_length": 29.875,
"alnum_prop": 0.602510460251046,
"repo_name": "freelawproject/juriscraper",
"id": "5c06ece9eace9857433fcaec4fb28a3330f76b29",
"size": "384",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.