text stringlengths 4 1.02M | meta dict |
|---|---|
def get_election_year_from_term_class(term_class):
# make sure we've got a string
term_class = str(term_class)
if term_class == '1':
return 2018
elif term_class == '2':
return 2014
elif term_class == '3':
return 2016
return None
def get_term_class_from_election_year(elec... | {
"content_hash": "00b4173a5e9f268f2317a89b3854355f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 53,
"avg_line_length": 29.38095238095238,
"alnum_prop": 0.6094003241491086,
"repo_name": "sunlightlabs/read_FEC",
"id": "69dec00d9733932d8a5b448f661fbee437aaa4f2",
"size": ... |
import wtforms.fields.html5
from flask.ext import wtf
class SettingsForm(wtf.Form):
email = wtforms.fields.html5.EmailField(
'E-mail', [wtforms.validators.Optional(), wtforms.validators.Email()],
description='E-mail address that will be used for notifications.')
submit = wtforms.SubmitField('S... | {
"content_hash": "aef5157b796355b64012f34167191bd6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 78,
"avg_line_length": 36.22222222222222,
"alnum_prop": 0.7208588957055214,
"repo_name": "aromanovich/kozmic-ci",
"id": "0f590baf0d61bfd35f02cdd06a7716758f4bf613",
"size": "... |
"""
Created on Jun 19, 2012
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Jun 19, 2012"
import unittest
import os
import warnings
from pymongo imp... | {
"content_hash": "a2244a588323905a4d573678680a91ab",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 81,
"avg_line_length": 42.01242236024845,
"alnum_prop": 0.5526315789473685,
"repo_name": "migueldiascosta/pymatgen-db",
"id": "c29be768bce48620a42102d86a2568128821190e",
"... |
from asynq import AsyncTask, asynq
from asynq.generator import (
END_OF_GENERATOR,
async_generator,
list_of_generator,
take_first,
Value,
)
from qcore.asserts import assert_eq, assert_is, assert_is_instance, AssertRaises
def test_value():
val = Value("value")
assert_eq("value", val.value)
... | {
"content_hash": "5b82e8bb9d46682ee2d30ad8f5710508",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 80,
"avg_line_length": 22.402439024390244,
"alnum_prop": 0.617855198693522,
"repo_name": "quora/asynq",
"id": "f9c33688bf8e1f2ae58f6eb9cbac361f9da86144",
"size": "2411",
... |
"""
Tests for L{twisted.protocols.amp}.
"""
import datetime
import decimal
from zope.interface import implements
from zope.interface.verify import verifyClass, verifyObject
from twisted.python.util import setIDFunction
from twisted.python import filepath
from twisted.python.failure import Failure
from twisted.protoc... | {
"content_hash": "fcefb3e944c927d2f7a841ad4ecc96d7",
"timestamp": "",
"source": "github",
"line_count": 3174,
"max_line_length": 91,
"avg_line_length": 33.15595463137996,
"alnum_prop": 0.6156769957334398,
"repo_name": "biddisco/VTK",
"id": "325af405af4f8e4983ed47bddbad6784760578da",
"size": "105344... |
import os
import vtk
import vtk.test.Testing
import math
class TestParallelCoordinatesColors(vtk.test.Testing.vtkTest):
def testLinePlot(self):
"Test if colored parallel coordinates plots can be built with python"
# Set up a 2D scene, add a PC chart to it
view = vtk.vtkContextV... | {
"content_hash": "d4c2ba08dcbfe90a4440cd9bb7892f14",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 117,
"avg_line_length": 34.47126436781609,
"alnum_prop": 0.5875291763921308,
"repo_name": "hlzz/dotfiles",
"id": "e5e25f871669491b0389ec155256525745ea34ad",
"size": "3047",... |
from __future__ import absolute_import, division, print_function
from enum import Enum
from cryptography import x509
from cryptography.hazmat.backends import _get_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import ec, rsa
from cryptography.ut... | {
"content_hash": "b88815c85e6bc070d012af0649b032d3",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 77,
"avg_line_length": 34.71875,
"alnum_prop": 0.6147614761476148,
"repo_name": "kimjinyong/i2nsf-framework",
"id": "1e11e28ef5b35c9d179031bfd73aaf180e4f68ed",
"size": "46... |
from scipy.fftpack import fft as FFT
from scipy.fftpack import dct as DCT
import numpy as np
def mfcc(framewiseData, order = 60, samplerate = 48000, fftLen = None, low = 0, high = None):
""" Get the mel-frequency cepstral coefficients for the give data
Calculates the MFCCs of the data, it is assumed tha... | {
"content_hash": "bf40128b0db00ec8d92685a5c4ec9acf",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 124,
"avg_line_length": 33.44303797468354,
"alnum_prop": 0.6328538985616957,
"repo_name": "dabraude/PYSpeechLib",
"id": "93f5148460107d9b1747834c63c1cb78e4852569",
"size": ... |
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from oauth2app.mo... | {
"content_hash": "7d82930f796cecc61da911568377fcea",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 31.115384615384617,
"alnum_prop": 0.7206427688504327,
"repo_name": "eschloss/openPDS-RegistryServer-for-Heroku",
"id": "137ea213b76d726d4e49c8af1a277d3... |
from twilio.rest import TwilioRestClient
from datetime import datetime
import socket
import errno
##########################################################################
# Public Functions #
#####################################################################... | {
"content_hash": "ba7c32d9b8faa69954c5c9234c6a32bb",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 79,
"avg_line_length": 33.904761904761905,
"alnum_prop": 0.5370786516853933,
"repo_name": "topher23/IntelliKeg",
"id": "c3801b6aad2db65b69b0386192846a894822d26d",
"size": ... |
"""
This module contains a Google Sheets API hook
"""
from typing import Any, Dict, List, Optional
from googleapiclient.discovery import build
from airflow.exceptions import AirflowException
from airflow.gcp.hooks.base import CloudBaseHook
class GSheetsHook(CloudBaseHook):
"""
Interact with Google Sheets v... | {
"content_hash": "357e947d4725b93d9027bfac91a10d06",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 103,
"avg_line_length": 40.37891737891738,
"alnum_prop": 0.629436252028505,
"repo_name": "Fokko/incubator-airflow",
"id": "d8e37e3b9bad99ce2a1befed3563f2dfac004ef9",
"size... |
"""
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""
from __future__ import print_function
from __future__ import absolute_import
# System modules
import pprint
# Our mod... | {
"content_hash": "dd15da400a68ccd9349711b71ad3fbae",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 30.045454545454547,
"alnum_prop": 0.7367624810892587,
"repo_name": "apple/swift-lldb",
"id": "2a0cda14c3bf85b3a08c93d81520810c4d4ed667",
"size": "661... |
import uuid
from django.db import models
from django.contrib.auth.models import User
User._meta.get_field('email')._unique = True
class Song(models.Model):
track_name = models.CharField(max_length=200)
track_id = models.CharField(db_index=True, max_length=200)
track_uri = models.CharField(max_length=200)
... | {
"content_hash": "92f9af7ff51150a93b98732c090848cb",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 87,
"avg_line_length": 31.2875,
"alnum_prop": 0.7271274470635237,
"repo_name": "ecatkins/instabilly",
"id": "fae695eab1341712a2fc8f27c8cdd4016944fe01",
"size": "2503",
"b... |
import re
import rumps
from timer import Timer
from config import *
class MultiTimerApp(rumps.App):
def __init__(self):
super(MultiTimerApp, self).__init__(APP_TITLE,
icon=PATH_RES_IMG_MY_TIME_ALPHA)
self.menu = [MENU_ITEM_ADD_TIMER, MENU_ITEM_REMOVE_TI... | {
"content_hash": "2c69595261b96d6f06d7e7dc6a30bced",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 76,
"avg_line_length": 34.08130081300813,
"alnum_prop": 0.5062022900763359,
"repo_name": "kanairen/MultiTimer",
"id": "74cd5dff82f0967741f3c61bff901e0121a53d8d",
"size": "... |
u"""Test getting own and adm jobs.
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
import os
from pykern.pkcollections import PKDict
import time
def setup_m... | {
"content_hash": "fe1e1c434d6802e6755f2f702817aee9",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 100,
"avg_line_length": 29.561855670103093,
"alnum_prop": 0.5557105492589364,
"repo_name": "mkeilman/sirepo",
"id": "7c350bcdb7a0284b58c7c6d8adc894361b559c30",
"size": "57... |
"""
Test addrv2 relay
"""
import time
from test_framework.messages import (
CAddress,
msg_addrv2,
NODE_NETWORK
)
from test_framework.mininode import P2PInterface
from test_framework.test_framework import PivxTestFramework
from test_framework.util import assert_equal
ADDRS = []
for i in range(10):
add... | {
"content_hash": "8c8441f0c649dd491e1d10e87c95411f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 90,
"avg_line_length": 30.22972972972973,
"alnum_prop": 0.6222619579794367,
"repo_name": "PIVX-Project/PIVX",
"id": "3f6b681f232eccb40418c1c0118bab15d38337db",
"size": "244... |
import analysis.event
import analysis.hitfinding
import analysis.pixel_detector
import analysis.sizing
import plotting.image
import plotting.line
import plotting.correlation
import plotting.histogram
from backend.record import add_record
import numpy as np
import time
import ipc
import utils.reader
import re
import os
... | {
"content_hash": "4e7e48f8c132a20bd19c027dd515af23",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 192,
"avg_line_length": 34.2,
"alnum_prop": 0.6518928901200369,
"repo_name": "SPIhub/hummingbird",
"id": "205eaad26b6871eeb735554ee5d0f16ccf2c9139",
"size": "6533",
"bin... |
from collections import OrderedDict
from itertools import chain
from ..utils.orderedtype import OrderedType
from .structures import NonNull
from .dynamic import Dynamic
class Argument(OrderedType):
def __init__(self, type, default_value=None, description=None, name=None, required=False, _creation_counter=None):... | {
"content_hash": "95a05f743878584298c5f4c684d0a2f8",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 118,
"avg_line_length": 32.46969696969697,
"alnum_prop": 0.6061595893607092,
"repo_name": "Globegitter/graphene",
"id": "8a621b4267edbddb368a07894c2ce235b84ea295",
"size": ... |
""" Sahana Eden Disaster Victim Registration Model
@copyright: 2012-15 (c) Sahana Software Foundation
@license: MIT
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
... | {
"content_hash": "8aa9d394aa0710eda6854cea1bd37bd7",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 104,
"avg_line_length": 43.723636363636366,
"alnum_prop": 0.35944777112441784,
"repo_name": "anurag-ks/eden",
"id": "5eb1d2d9b736cba38f61b7486652a99a45039fab",
"size": "12... |
import httplib2 as http
import urllib
import json
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
class Bourdon(object):
def __init__(self, user, uri):
self.user = user
self.uri = uri
self.headers = {
'Accept': 'application/json... | {
"content_hash": "8fcbb446ebae308fe51c8e2108d3ff20",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 110,
"avg_line_length": 30.459016393442624,
"alnum_prop": 0.6114101184068891,
"repo_name": "malenkiki/bourdon",
"id": "83db8b15c070af9c0bcc00e307ebbb3c3234027c",
"size": "3... |
import pdb
import os
import hashlib
from bottle import route, run, template, SimpleTemplate, static_file, request, redirect
#from TransmissionClient import NoSuchTorrent, TransmissionClient
# FILE UPLOAD FROM STACK OVERFLOW
# http://stackoverflow.com/questions/22839474/python-bottle-how-to-upload-media-files-without-d... | {
"content_hash": "ed7cbf89558abb35c04ca0636cbd0142",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 111,
"avg_line_length": 27.240963855421686,
"alnum_prop": 0.6421937195931003,
"repo_name": "erik998/tontineseed",
"id": "99783034b8646158b2a9f530f0bbefb2168715e4",
"size": ... |
"""
OVERVIEW:
Master Script that checks a given dataset directory for any processing requests.
Currently only 16S processing supported.
"""
import numpy as np
import os
import os.path
import sys
import pickle
from optparse import OptionParser
from SummaryParser import *
import QualityControl as QC
# Read in argu... | {
"content_hash": "69b9d8bac11b7f4934bb08e1d9742d7a",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 133,
"avg_line_length": 39.203007518796994,
"alnum_prop": 0.6582278481012658,
"repo_name": "thomasgurry/amplicon_sequencing_pipeline",
"id": "4b36aabae7110295b12cc6f877ec550... |
import django
import floppyforms
from copy import deepcopy
_WIDGET_COMMON_ATTRIBUTES = (
'is_hidden',
'needs_multipart_form',
'is_localized',
'is_required')
_WIDGET_COMMON_ARGUMENTS = ('attrs',)
def _copy_attributes(original, new_widget, attributes):
for attr in attributes:
original_valu... | {
"content_hash": "42a69269e8ccb134176c4a401e462d08",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 94,
"avg_line_length": 40.87747035573123,
"alnum_prop": 0.6765615935022239,
"repo_name": "andrewsmedina/django-admin2",
"id": "bf439304622c7c3ad2e79e53b7f3f7aa6d835613",
"... |
"""Calxeda: __init__.py """
import sys
import time
from cxmanage_api.tftp import InternalTftp, ExternalTftp
from cxmanage_api.node import Node
from cxmanage_api.tasks import TaskQueue
from cxmanage_api.cx_exceptions import TftpException
COMPONENTS = [
("ecme_version", "ECME version"),
("cdb_version", "CDB v... | {
"content_hash": "64f2b9e2dd5111dc8f7e9125d9e2c5bd",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 79,
"avg_line_length": 32.197101449275365,
"alnum_prop": 0.5448325531148721,
"repo_name": "Cynerva/cxmanage",
"id": "bb0f2f7e8992c9ceb830760a6798fe3bd6ba8ac5",
"size": "12... |
"""
FEZ graphics type readers
"""
from __future__ import print_function
from xnb_parse.type_reader import (TypeReaderPlugin, BaseTypeReader, ValueTypeReader, GenericTypeReader,
generic_reader_type)
from xnb_parse.type_readers.xna_graphics import PrimitiveTypeReader, Texture2DReader
... | {
"content_hash": "4c81345be700f4910cad4886574394e6",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 118,
"avg_line_length": 49.75409836065574,
"alnum_prop": 0.6782537067545304,
"repo_name": "fesh0r/xnb_parse",
"id": "42a3dee55d14535a8b510bf9aefa09e8dd1e86f9",
"size": "60... |
from __future__ import print_function
from subprocess import Popen, PIPE
dirty = Popen(["git", "diff-index", "--quiet", "HEAD"], stdout=PIPE).wait() != 0
commit_process = Popen(["git", "describe", "--always", "--tags", "--abbrev=0"], stdout=PIPE)
(version, err) = commit_process.communicate()
print("STABLE_GIT_VERSIO... | {
"content_hash": "c49635bf318a564d7cf672670134a112",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 92,
"avg_line_length": 31.76923076923077,
"alnum_prop": 0.6246973365617433,
"repo_name": "bazelbuild/bazel-watcher",
"id": "9dd585101626935e07a66d69719a869f94b74b67",
"size... |
import pythoncom
from win32com.shell import shell, shellcon
from win32com.server.policy import DesignatedWrapPolicy
tsf_flags = list((k,v) for k,v in shellcon.__dict__.items() if k.startswith('TSF_'))
def decode_flags(flags):
if flags == 0:
return 'TSF_NORMAL'
flag_txt = ''
for k,v in tsf_flags:
... | {
"content_hash": "784ae57daffc1383897bbafc096ecb3a",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 115,
"avg_line_length": 33.013698630136986,
"alnum_prop": 0.6800829875518672,
"repo_name": "ntuecon/server",
"id": "040cd0b53bbd769031979f92b84abe8f70697ef5",
"size": "2457... |
import logging
logger = logging.getLogger(__name__)
class Context:
def __init__(self, checker, newcontext):
self.checker = checker
self.newcontext = newcontext
def __enter__(self):
self.checker.context.append(self.newcontext)
def __exit__(self, type, value, traceback):
s... | {
"content_hash": "c46b8a6fcd42e85c48600b92e8636c86",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 88,
"avg_line_length": 36.29761904761905,
"alnum_prop": 0.5647753361757953,
"repo_name": "googlei18n/fontmake",
"id": "8a164cee56f08c6dfbcb6144ed15a1cf15171164",
"size": "3... |
"""Accesses the google.monitoring.v3 GroupService API."""
import functools
import pkg_resources
import warnings
from google.oauth2 import service_account
import google.api_core.gapic_v1.client_info
import google.api_core.gapic_v1.config
import google.api_core.gapic_v1.method
import google.api_core.grpc_helpers
import... | {
"content_hash": "efed638e12d75298cca76bb2bb54684f",
"timestamp": "",
"source": "github",
"line_count": 682,
"max_line_length": 152,
"avg_line_length": 43.183284457478,
"alnum_prop": 0.5911514040270279,
"repo_name": "dhermes/gcloud-python",
"id": "8a28b7b7dc32564ffccb9c24be2df67d88f492ed",
"size": ... |
"""
Test lldb process launch flags.
"""
from __future__ import print_function
import copy
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import six
class ProcessLaunchTestCase(TestBase):
mydir = TestBase.comp... | {
"content_hash": "86dd18669bb83f4f4932f166d55fc76b",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 119,
"avg_line_length": 34.47596153846154,
"alnum_prop": 0.5824850090642867,
"repo_name": "youtube/cobalt_sandbox",
"id": "9d1cac90d85693d0a146c12f9c3cf56acf1215f9",
"size... |
import os
import importlib
from collections import OrderedDict
import json
from modularodm import storage
from werkzeug.contrib.fixers import ProxyFix
import framework
from framework.render.core import init_mfr
from framework.flask import app, add_handlers
from framework.logging import logger
from framework.mongo imp... | {
"content_hash": "fe1250ff8c04ae63dbc1a08a16cfe790",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 96,
"avg_line_length": 37.421052631578945,
"alnum_prop": 0.6998945147679325,
"repo_name": "zkraime/osf.io",
"id": "7e4dd8dc32ea44ce7ce56f0a90c4f541098ef41a",
"size": "5713... |
from setuptools import setup, find_packages
import SCFpy
import os
def extra_dependencies():
import sys
ret = []
if sys.version_info < (2, 7):
ret.append('argparse')
return ret
def read(*names):
values = dict()
extensions = ['.txt', '.rst']
for name in names:
value = ''
... | {
"content_hash": "1026503bc13f212646a7a603d9541be2",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 56,
"avg_line_length": 26.470588235294116,
"alnum_prop": 0.5772222222222222,
"repo_name": "pudu1991/SCFpy",
"id": "36fe01db95825debb633af4068b45498bd16252e",
"size": "1823"... |
"""Support for Prometheus metrics export."""
from contextlib import suppress
import logging
import string
from aiohttp import web
import prometheus_client
import voluptuous as vol
from homeassistant import core as hacore
from homeassistant.components.climate.const import (
ATTR_CURRENT_TEMPERATURE,
ATTR_HVAC_... | {
"content_hash": "f65f9b8d7a1ed74938bcab6c1f500164",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 108,
"avg_line_length": 34.111111111111114,
"alnum_prop": 0.572959448614455,
"repo_name": "rohitranjan1991/home-assistant",
"id": "7690ee5d1fc43d1766b4a858cc46482816641de3",... |
import unittest
from .test_sqlite import TestSQLite
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "519014bb5a6638629904799a5c2aa7b7",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 35,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.6534653465346535,
"repo_name": "moskytw/mosql",
"id": "fc0f1874ab1563dc193fa2a94c7188195a06b15a",
"size": "148",
... |
"""Locations where we look for configs, install stuff, etc"""
import getpass
import os
import os.path
import site
import sys
import tempfile
from distutils import sysconfig
from distutils.command.install import install, SCHEME_KEYS
from pip import appdirs
from pip.compat import get_path_uid
import pip.exceptions
... | {
"content_hash": "f5052b4aac937fa8ab04767fc4afc916",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 79,
"avg_line_length": 31.33061224489796,
"alnum_prop": 0.6375716519020324,
"repo_name": "laborautonomo/pip",
"id": "8adadbee251876b93c0fd86e7ac1fe02b1389564",
"size": "76... |
"""The consistencygroups api."""
from oslo_log import log as logging
from oslo_utils import strutils
import webob
from webob import exc
from cinder.api import common
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api.views import consistencygroups as consistencygroup_views
from ci... | {
"content_hash": "57accf5c08ee467b1fd0df76352a8711",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 78,
"avg_line_length": 41.677536231884055,
"alnum_prop": 0.6098409110666783,
"repo_name": "bswartz/cinder",
"id": "a9abc3aef869abb1a324e77cdb7e5fc77dd3052e",
"size": "1214... |
while True:
s = input('Enter something: ')
if s == 'quit':
break
if len(s) < 3:
print('Too small')
continue
print('Input is of sufficient length')
| {
"content_hash": "b9cc67befd2104e4d55da94bf3b81bae",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 42,
"avg_line_length": 18.5,
"alnum_prop": 0.5351351351351351,
"repo_name": "louistin/thinkstation",
"id": "3ba4969fad21bb809acc5cbab148cd6f65342a32",
"size": "229",
"bin... |
import logging
logger = logging.getLogger("membership.signals")
from django.dispatch import Signal
# Signals
send_as_email = Signal(providing_args=["instance"])
send_preapprove_email = Signal(providing_args=["instance", "user"])
send_duplicate_payment_notice = Signal(providing_args=["instance","user","billingcycle"])... | {
"content_hash": "a405164128d6c91f13ae34ab0d1a946f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 89,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.7663551401869159,
"repo_name": "AriMartti/sikteeri",
"id": "762cf79128e0e849aaf610eeb3556ab81344cc7d",
"size": "34... |
from __future__ import print_function, unicode_literals
import os
import sys
import tarfile
import subprocess
import shutil
import io
if sys.version_info[0] < 3:
from urllib import urlopen
else:
from urllib.request import urlopen
try:
import argparse as ap
except ImportError:
import pyne._argparse as a... | {
"content_hash": "4dd7084bbc9d2dda48406cae8d2cab20",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 87,
"avg_line_length": 35.77639751552795,
"alnum_prop": 0.6048611111111111,
"repo_name": "gidden/cyclus",
"id": "75cf78faed90cc44642f31974b3bab40020f92d6",
"size": "5783",... |
"""
Prefix processing procedures
"""
from ipv4seq import *
def getholes(prefix, (ipstack), opt_g=False):
holes = []
netunion = []
while len(ipstack):
cur_prefix = ipstack.pop()
sum_prefix = netsum(cur_prefix, prefix)
if len(sum_prefix) and opt_g:
pref... | {
"content_hash": "8405e75c2e7e9925e8243c40d8cecd84",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 106,
"avg_line_length": 30.2,
"alnum_prop": 0.5107615894039735,
"repo_name": "Urlandi/bgptablehole",
"id": "125dd2e8d6926ed2e0344484c9d53bb4fd365b25",
"size": "1233",
"bi... |
from __future__ import division, print_function, unicode_literals, \
absolute_import
"""
Wulff construction to create the nanoparticle
"""
from six.moves import range
import itertools
from math import gcd
from functools import reduce
import numpy as np
from pymatgen.core.structure import Structure, Molecule
fr... | {
"content_hash": "626adc23029ebfd0e2d815bece0e9be3",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 83,
"avg_line_length": 37.33742331288344,
"alnum_prop": 0.5989155438711797,
"repo_name": "henniggroup/MPInterfaces",
"id": "de6e60538bf173846c5cf4e0459874d96e9db459",
"siz... |
"""Test configs for reciprocal."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests
fr... | {
"content_hash": "6c5aa624546d9c2779631828d5348d0a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 31.545454545454547,
"alnum_prop": 0.6772334293948127,
"repo_name": "sarvex/tensorflow",
"id": "1253d26c86f1e7c11e062436b0372b7d2c748e75",
"size": "20... |
from argparse import ArgumentParser
from sys import stdin
def parse_args():
p = ArgumentParser()
p.add_argument('columns', nargs='*', type=int,
help="Specify which columns should be reversed."
"All columns are reversed if not specified")
p.add_argument('-d', '--delimi... | {
"content_hash": "d7e8015595d91be288e425e6f94b8a1c",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 67,
"avg_line_length": 27.894736842105264,
"alnum_prop": 0.560377358490566,
"repo_name": "juditacs/morph-segmentation",
"id": "55ee189fb264c021b398a29b0f89b9f06d0eb564",
"s... |
bl_info = {
"name": "Sure UVW Map v.0.5.1",
"author": "Alexander Milovsky (www.milovsky.ru)",
"version": (0, 5),
"blender": (2, 6, 3),
"api": 45093,
"location": "Properties > Object Data (below UV Maps), parameters in Tool Properties",
"description": "Box / Best Planar UVW Map (Make M... | {
"content_hash": "ec041b1a6dc521a0a0edcd47deb7e27d",
"timestamp": "",
"source": "github",
"line_count": 467,
"max_line_length": 145,
"avg_line_length": 31.241970021413277,
"alnum_prop": 0.5134338588074023,
"repo_name": "creepydragon/revision1",
"id": "4d58925833caf8d789e405ff56515e01a97d36e3",
"siz... |
from collections import namedtuple
from functools import lru_cache
from django.db.models import Sum
from django.template.response import TemplateResponse
from django.urls import reverse_lazy as reverse
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from ...f... | {
"content_hash": "e431bf318861e2633af99aaa388da600",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 118,
"avg_line_length": 42.670212765957444,
"alnum_prop": 0.6270256793817003,
"repo_name": "leprikon-cz/leprikon",
"id": "37424c5e0733e925d60ff9148cf4c8386b63d475",
"size"... |
from math import sqrt
# Select the active layer.
mylayer = iface.activeLayer()
# List of all start-points and end-points of all line segments and their id
startEndPoints = []
for feature in mylayer.getFeatures():
xy = feature.geometry().asPolyline()
startEndPoints.append({"line": (xy[0], xy[-1]), "id": featu... | {
"content_hash": "452b45eb3cd87b129f0a8daf20dedd41",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 125,
"avg_line_length": 39.95652173913044,
"alnum_prop": 0.6459466811751904,
"repo_name": "sigita42/vagrant-postgres-osm",
"id": "3b3ed4ab87804a25a350365f3c1fccab3f9fe232",
... |
from eventlet import patcher
from nova.console import serial as serial_console
from nova.console import type as ctype
from nova import exception
from nova.i18n import _, _LI # noqa
from oslo_config import cfg
from oslo_log import log as logging
from hyperv.nova import constants
from hyperv.nova import ioutils
from hy... | {
"content_hash": "2a6db7605daaaa5419f1e99293242291",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 78,
"avg_line_length": 37.25170068027211,
"alnum_prop": 0.5969685902118335,
"repo_name": "adelina-t/compute-hyperv",
"id": "6f5f13671ff57fea1dc914ce99b6d74286dd9c1c",
"siz... |
""" This program provides an agent that sends and responds to
health-check packets in order to determine the liveliness of the
configured MPLS tunnels. """
import eossdk
import eossdk_utils
import functools
import json
import os
import pyinotify
import scapy
import scapy.fields
import scapy.layers.l2
import scapy.lay... | {
"content_hash": "da0aa97ddcad9d724a87ca11d96990cd",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 85,
"avg_line_length": 42.134419551934826,
"alnum_prop": 0.6354408352668214,
"repo_name": "tsuna/EosSdk",
"id": "4a62fffc43801034ca9fe5844085fd97dad77e8a",
"size": "20830"... |
import inspect
import multiprocessing
import logging
import os
import datetime
import socket
from uuid import getnode as get_mac
_LAZY_M_ENABLED_ = True
IPCType = {'NewSourceJob' : 1,
'UpdateSourceJob': 2,
'InstallSocketCriteria': 3,
'DeleteSocketCriteria': 4,
'NewSocket': ... | {
"content_hash": "c21805e42c6578e12f1cb872bbc8c98b",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 128,
"avg_line_length": 29.537974683544302,
"alnum_prop": 0.5451039211484894,
"repo_name": "pupeng/hone",
"id": "07f74f95b82e12ad06047ae4629a94fc6525fe22",
"size": "4855",... |
import win32ui
import win32con
import win32api
from pywin.mfc import docview, window, afxres
import commctrl
class GenericFrame(window.MDIChildWnd):
def OnCreateClient(self, cp, context):
# handlers for toolbar buttons
self.HookCommand (self.OnPrevious, 401)
self.HookCommand (self.OnNext, 402)
# Its not neces... | {
"content_hash": "e8562a850389a525f73a3f2498b9fa01",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 94,
"avg_line_length": 30.147727272727273,
"alnum_prop": 0.7218243497926875,
"repo_name": "Microsoft/PTVS",
"id": "30e7346c69f64bcef5850e1b8973682d63396a27",
"size": "2745"... |
"""
Volume driver for NetApp Data ONTAP (C-mode) FibreChannel storage systems.
"""
from cinder import interface
from cinder.volume import driver
from cinder.volume.drivers.netapp.dataontap import block_cmode
from cinder.zonemanager import utils as fczm_utils
@interface.volumedriver
class NetAppCmodeFibreChannelDrive... | {
"content_hash": "d9a5822a469f3b46d430641736702d94",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 76,
"avg_line_length": 39.096,
"alnum_prop": 0.6470227133210559,
"repo_name": "Nexenta/cinder",
"id": "1c070cbf1d458e5c73ae8997a23b4305876c79af",
"size": "5580",
"binary... |
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template.context import RequestContext
from resumes.models import UserResume
def list_resume(request):
return HttpResponse()
def view_resume(request, resume_id=None, user_id=None):
resume = Non... | {
"content_hash": "60d008edfe752fb836cef9a957fb9f78",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 116,
"avg_line_length": 33.13793103448276,
"alnum_prop": 0.7148803329864725,
"repo_name": "juanyunis/django-resumes",
"id": "4ffa0b90272f04e3891bac9cba41988bb4c7bf94",
"siz... |
"""
productporter.app
~~~~~~~~~~~~~~~~~
manages the app creation and configuration process
:copyright: (c) 2014 by the ProductPorter Team.
:license: BSD, see LICENSE for more details.
"""
import os
import logging
import datetime
from flask import Flask
from productporter.weixin.views import weix... | {
"content_hash": "31e1e99bc854242de89c301afca0d550",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 90,
"avg_line_length": 29.726027397260275,
"alnum_prop": 0.6351766513056836,
"repo_name": "kamidox/weixin_producthunt",
"id": "db3f53a79f25e5bf5e880d3d0adb6dbef71833f7",
"... |
doc = """\
Storage Compute manager
"""
import sys
from gevent import monkey
from gevent.subprocess import Popen, PIPE
monkey.patch_all()
import os
import glob
import socket
import subprocess
import json
import time
import datetime
import pdb
import re
import argparse
import ConfigParser
import signal
import syslog
g... | {
"content_hash": "bc85ec5e547445f0d385b33736912a1b",
"timestamp": "",
"source": "github",
"line_count": 922,
"max_line_length": 87,
"avg_line_length": 41.61279826464208,
"alnum_prop": 0.4904214559386973,
"repo_name": "nischalsheth/contrail-controller",
"id": "bc2912526b2d3d4161ee18a578255844daf51efc"... |
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file and with no dependencies other than the
Python S... | {
"content_hash": "c8dc893b41a5ca9d2c2aaf63f741044a",
"timestamp": "",
"source": "github",
"line_count": 3586,
"max_line_length": 103,
"avg_line_length": 39.510039040713885,
"alnum_prop": 0.5806624647981762,
"repo_name": "tashaband/RYU295",
"id": "3f4f0deaef90687c14f7a914ca733478183ec6a3",
"size": "... |
from django.core.management.commands import migrate
from django.db.utils import DEFAULT_DB_ALIAS
from django_sae.conf.settings import patch_sae_restful_mysql
class Command(migrate.Command):
def handle(self, *args, **kwargs):
patch_sae_restful_mysql()
kwargs.setdefault('database', DEFAULT_DB_ALIAS)... | {
"content_hash": "7e44e8825d94715f013022685136fea2",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 60,
"avg_line_length": 37.4,
"alnum_prop": 0.7272727272727273,
"repo_name": "smallcode/django-sae",
"id": "676967e20c36616d2914f5eb37b320314f64e2ed",
"size": "389",
"bina... |
import pymysql.cursors
from model import Group
from model import Contact
class DBFixture:
def __init__(self, host, database, user, password):
self.host = host
self.database = database
self.user = user
self.password = password
self.connection = pymysql.connect(
ho... | {
"content_hash": "448a2b2db81b887c1e4ab0de417c455f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 113,
"avg_line_length": 30.467741935483872,
"alnum_prop": 0.47591318157755425,
"repo_name": "melipharo/stru-python19",
"id": "18231a9f289858143733f9646e3e743413f0ae2e",
"si... |
"""A class to help start/stop the lighttpd server used by layout tests."""
import logging
import os
import time
from webkitpy.layout_tests.servers import http_server_base
_log = logging.getLogger(__name__)
class Lighttpd(http_server_base.HttpServerBase):
def __init__(self, port_obj, output_dir, background=Fa... | {
"content_hash": "e2c58a1186e12fc2bf213cd539af2060",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 136,
"avg_line_length": 45.93,
"alnum_prop": 0.5592205530154583,
"repo_name": "lordmos/blink",
"id": "1fbf1321231976527a3ecb22c72d7a312fe225d2",
"size": "10716",
"binary... |
from p2ner.core.namespace import Namespace, initNS
from abc import abstractmethod
class Scheduler(Namespace):
def sanityCheck(self, requirements):
return
for var in requirements:
if var not in self.g:
raise ValueError("%s is not a valid variable in current environment" ... | {
"content_hash": "7912dcb4dc5d270a2418af929fad92b5",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 91,
"avg_line_length": 26.729166666666668,
"alnum_prop": 0.5681995323460639,
"repo_name": "schristakidis/p2ner",
"id": "2ac7e1b17d546cb9ed0c1e4fc186f069d597ba53",
"size": "... |
"""
Module defining Mem5TraderD agent class.
"""
import random
from fms import agents
from fms.utils import BUY, SELL
from fms.utils.exceptions import MissingParameter
class Mem5TraderD(agents.Agent):
"""
Simulate an agent taking random decisions
This agent subclass should have two keys in the
args ... | {
"content_hash": "755d2dc77aa387972360362708079e5b",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 32.287581699346404,
"alnum_prop": 0.5740890688259109,
"repo_name": "nikete/fms",
"id": "a9bccad35c82bcadaa41c997ed0dc999f9a2e738",
"size": "4985",
... |
import hashlib
import json
import logging
import urllib2
from controllers.gcm.gcm import GCMConnection
class NotificationSender(object):
WEBHOOK_VERSION = 1
@classmethod
def send_gcm(cls, notification):
gcm_connection = GCMConnection()
gcm_connection.notify_device(notification)
@cl... | {
"content_hash": "8604dddc2bc1b683928aaa9e009fb7fa",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 108,
"avg_line_length": 32.46666666666667,
"alnum_prop": 0.5569815195071869,
"repo_name": "josephbisch/the-blue-alliance",
"id": "e2512d11d1d81e3ae2594bae9fc3d421823d5597",
... |
from oslo.utils import excutils
from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine.resources.vpc import VPC
from heat.openstack.common import log as ... | {
"content_hash": "5a0fea3b7e8e1903e5085b330608c8e3",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 79,
"avg_line_length": 40.99036144578313,
"alnum_prop": 0.5586385280112868,
"repo_name": "redhat-openstack/heat",
"id": "071a9682df1401ac434d8a6b00652eb85e981911",
"size":... |
"""\
============================
Audio Playback using PyMedia
============================
This component plays raw audio sent to its "inbox" inbox using the pymedia
library.
Example Usage
-------------
Playing 8KHz 16 bit mono raw audio from a file::
Pipeline( RateControlledFileReader("recording.raw", r... | {
"content_hash": "533d7b217ac59408f8e581481fd5130b",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 88,
"avg_line_length": 29.232142857142858,
"alnum_prop": 0.6423335369578497,
"repo_name": "sparkslabs/kamaelia_",
"id": "1cf6063b7f8eb770513ab064571dc33ab25dbb97",
"size":... |
"""The tests for the group fan platform."""
from unittest.mock import patch
import pytest
from homeassistant import config as hass_config
from homeassistant.components.fan import (
ATTR_DIRECTION,
ATTR_OSCILLATING,
ATTR_PERCENTAGE,
ATTR_PERCENTAGE_STEP,
DIRECTION_FORWARD,
DIRECTION_REVERSE,
... | {
"content_hash": "e13eb94ea117329f7787253d6e6a5c42",
"timestamp": "",
"source": "github",
"line_count": 499,
"max_line_length": 84,
"avg_line_length": 35.81563126252505,
"alnum_prop": 0.6693710832587287,
"repo_name": "jawilson/home-assistant",
"id": "abb1dcf245a8a394dff140b85ec6b04874432b41",
"size... |
from model.contact import Contact
def test_add_contact_1(app):
app.contact.open_new_contact_page()
app.contact.create(Contact(name="Elena", Middle="Yrevna", Last_name="Korolevskaya", Nickname="ekorolevskaya",
Title="Title", Company="Name", Adress="Mira 2", Home_telephone="656506", Mobile="... | {
"content_hash": "07ff0269c8cf94f3d5cef457c4d61b61",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 114,
"avg_line_length": 43.833333333333336,
"alnum_prop": 0.6096324461343473,
"repo_name": "ekorolevskaya/zadanie",
"id": "1c8995082065d42b37cd8eaad53cebae9170c77b",
"size"... |
import os
from setuptools import setup, find_packages
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return ''
def get_r... | {
"content_hash": "738d21f47f830f2913272e1639fe737a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 74,
"avg_line_length": 31.35135135135135,
"alnum_prop": 0.6155172413793103,
"repo_name": "sixpearls/django-mediacracy",
"id": "670f491b852af8920bd34e65c4ab705a88b4a156",
"s... |
__author__ = 'aje'
#
# Copyright (c) 2008 - 2013 10gen, Inc. <http://10gen.com>
#
# 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 r... | {
"content_hash": "b54ff658bc25c2eceb24c3632669e095",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 104,
"avg_line_length": 30.603053435114504,
"alnum_prop": 0.5739585931653779,
"repo_name": "italoag/M101P",
"id": "94abd6563f299bfb25797edc67fe90ee5b54c4a2",
"size": "4009... |
import configparser
import logging
import logging.config
import os
import tempfile
import yaml
import dcm
import dcm.agent.cloudmetadata as cloudmetadata
from dcm.agent.cloudmetadata import CLOUD_TYPES
import dcm.agent.connection.websocket as websocket
import dcm.agent.exceptions as exceptions
import dcm.agent.job_run... | {
"content_hash": "dcc997eb1a76aa559d080644b365a698",
"timestamp": "",
"source": "github",
"line_count": 451,
"max_line_length": 92,
"avg_line_length": 39.48558758314856,
"alnum_prop": 0.5783355795148248,
"repo_name": "JPWKU/unix-agent",
"id": "884c5445ebb8244fd50e0d47cae5682566e63765",
"size": "183... |
"""
Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of condi... | {
"content_hash": "044dfbc89c3e9e4093e84159baf2081f",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 78,
"avg_line_length": 35.154761904761905,
"alnum_prop": 0.7111412123264477,
"repo_name": "gaberger/pybvc",
"id": "486a6c0d2f24fd3b0499e43dc896f5021f297c3d",
"size": "2972"... |
import itertools
from oslo_log import log as logging
from nova.db.main import api as db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
LOG = logging.getLogger(__name__)
# TODO(berrange): Remove NovaObjectDictCompat
@base.NovaObjectRegistry.registe... | {
"content_hash": "56e0cf1acca055d61c5a2cc016577610",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 37.840425531914896,
"alnum_prop": 0.5856058476244026,
"repo_name": "mahak/nova",
"id": "6d69e13ceba30c4e6a8bfcea8f26453e8d1a26b2",
"size": "4162",
... |
"""admin.py ."""
# flake8: noqa
from django.contrib import admin
# Register your models here.
| {
"content_hash": "aeb4096254694e32fc5c0871f2e06e9e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 19,
"alnum_prop": 0.7052631578947368,
"repo_name": "andrewtcrooks/taskorganizer",
"id": "569d440a82908c4bb450b02f89ce35e6329ec923",
"size": "95",
"b... |
from ciscoconfigparse
| {
"content_hash": "b80e2abb7f3ec57b897ad9c05b8923d0",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.9090909090909091,
"repo_name": "cocoloco69/pynet",
"id": "af054d58afd33f964cdeec88031258e15c632871",
"size": "22",
"binary": fal... |
import pytest
@pytest.fixture
def organism():
return{
'name': 'mouse',
'taxon_id': '9031'
}
@pytest.fixture
def organism_1(organism):
item = organism.copy()
item.update({
'schema_version': '1',
'status': 'CURRENT',
})
return item
def test_organism_upgrade(up... | {
"content_hash": "92d5842836b08d0d3ee807799649c78e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 19.84,
"alnum_prop": 0.5987903225806451,
"repo_name": "kidaa/encoded",
"id": "1e99736c06fb0f5c666a7d0f4b970b36d8b14847",
"size": "496",
"binary": f... |
"""
Our HADS database gets loaded up with duplicates, this cleans it up.
called from RUN_MIDNIGHT.sh
"""
import datetime
import sys
from pyiem.util import get_dbconn, utc, logger
LOG = logger()
def query(sql, args=None):
"""
Do a query and make it atomic
"""
pgconn = get_dbconn("hads")
hcurso... | {
"content_hash": "47b0e00ca65e72897beb69d5083e9ec4",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 77,
"avg_line_length": 25.225352112676056,
"alnum_prop": 0.6063651591289783,
"repo_name": "akrherz/iem",
"id": "7badc234145692010f17f310d70f1043336c813b",
"size": "1791",
... |
import commands
import logging
import sys
from libs import config_libs
from libs import utils_libs
from libs import verify_libs
def main():
# Run the Testcases:
test = test_gbp_prs_neg()
if test.test_gbp_prs_neg_1() == 0:
test.cleanup(tc_name='TESTCASE_GBP_PRS_NEG_1')
if test.test_gbp_prs_ne... | {
"content_hash": "571f51a9976841da50d777595817f181",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 79,
"avg_line_length": 39.08247422680412,
"alnum_prop": 0.5209707201266157,
"repo_name": "jiahaoliang/group-based-policy",
"id": "9a122f8ac3c82ceafe654423cb2c0878ddf1acf6",
... |
"""
Assignment 3:
Use Pexpect to retrieve the output of 'show ip int brief' from pynet-rtr2.
"""
import pexpect
import re
from getpass import getpass
def main():
ip_addr ='50.76.53.27'
username = 'pyclass'
port = 8022
password = getpass() # password: 88newclass
# Spawn a child process
s... | {
"content_hash": "7cf12976a1ab2410b22bee0c29290e58",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 82,
"avg_line_length": 21.705882352941178,
"alnum_prop": 0.6178861788617886,
"repo_name": "philuu12/PYTHON_4_NTWK_ENGRS",
"id": "8c51c27f97bea1664e41559af15dc1a2feb53cda",
... |
import unittest
from pathlib import Path
from pymatgen.io.cp2k.outputs import Cp2kOutput
from pymatgen.util.testing import PymatgenTest
class SetTest(PymatgenTest):
def setUp(self):
self.TEST_FILES_DIR = Path.joinpath(self.TEST_FILES_DIR, "cp2k")
self.out = Cp2kOutput(Path.joinpath(self.TEST_FILE... | {
"content_hash": "8b0568b1e3b2a84b813b79367ec66723",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 93,
"avg_line_length": 30.84,
"alnum_prop": 0.6731517509727627,
"repo_name": "richardtran415/pymatgen",
"id": "6e9281afe47a89fc47e2bbc9b13f35df6cd2fddd",
"size": "881",
"... |
from importlib import import_module
import inspect
import os
import re
from django.apps import apps
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.core.exceptions import ViewDoesNotExist
... | {
"content_hash": "fe04ee57aa0af816fd5f773bee70b1ee",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 116,
"avg_line_length": 38.75555555555555,
"alnum_prop": 0.5522426095820592,
"repo_name": "edevil/django",
"id": "2ffd402c95d023043ecaa89d67b679194d64efb0",
"size": "15696... |
""" a kernel implementation of a (localised) seamless update from a coupling between
two weighted ensembles (coarse and fine) to two coupled evenly weighted ensembles """
from __future__ import absolute_import
from __future__ import division
from firedrake import *
from firedrake.mg.utils import get_level
from fade ... | {
"content_hash": "223b9f19fc674d76e3196f0508259c48",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 100,
"avg_line_length": 39.5735294117647,
"alnum_prop": 0.6065898674594327,
"repo_name": "alsgregory/firedrake_da",
"id": "18bad7383af485c2661421f8f7982244e0aa2f2f",
"size... |
import _env
import leancloud
from config import leancloud_config
leancloud.init(leancloud_config.LeanCloud.APP_ID,
master_key=leancloud_config.LeanCloud.APP_MASTER_KEY)
| {
"content_hash": "d89e2dfd7a329f7e0c654cf2c10e84eb",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 68,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.7675675675675676,
"repo_name": "PegasusWang/picwall",
"id": "25f382c6098d76f5d73322acc189c2702d6aebef",
"size": "2... |
'''
Derived functions, name prefix specifies its container, like
* KS\_: nets.KeepSignFunc
* JC\_: nets.JointComplex
'''
import numpy as np
import pdb
from . import functions, pfunctions, linears
from .nets import KeepSignFunc, JointComplex
from .utils import dtype_c2r, dtype_r2c
__all__ = ['KS_Tanh', 'KS_Ge... | {
"content_hash": "f3e09755bc73bf5944e6029101f172d8",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 79,
"avg_line_length": 25.76,
"alnum_prop": 0.5916149068322981,
"repo_name": "GiggleLiu/poorman_nn",
"id": "4333f3452d956fd7e73a9de60cca2f1461425376",
"size": "2576",
"b... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
class HttpSuccessOperations(object):
"""HttpSuccessOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An obj... | {
"content_hash": "f583279921db437cbf3997a77add9268",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 140,
"avg_line_length": 40.15432098765432,
"alnum_prop": 0.6464258262874711,
"repo_name": "veronicagg/autorest",
"id": "582289e799dab05a2881dc6f4f55e76245412c84",
"size": ... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "ad02ca673fd0669a98e64a470957a486",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 134,
"avg_line_length": 31.418367346938776,
"alnum_prop": 0.7141929197791491,
"repo_name": "mahabs/nitro",
"id": "d0fcec7e9a1412db1969bf94fb08b67ca300bf36",
"size": "3693",... |
"""Zookeeper transport.
:copyright: (c) 2010 - 2013 by Mahendra M.
:license: BSD, see LICENSE for more details.
**Synopsis**
Connects to a zookeeper node as <server>:<port>/<vhost>
The <vhost> becomes the base for all the other znodes. So we can use
it like a vhost.
This uses the built-in kazoo recipe for queues
... | {
"content_hash": "75f9d213621555c39b0513b0196bd25f",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 78,
"avg_line_length": 29.870646766169155,
"alnum_prop": 0.6149233844103931,
"repo_name": "pexip/os-kombu",
"id": "30b0e2928bd875e11317fcc2d668582e012231e3",
"size": "6004... |
"""Implementation of field projection."""
from collections.abc import Mapping, Sequence
FIELD_SEPARATOR = ","
FIELD_DEREFERENCE = "__"
def apply_subfield_projection(field, value, deep=False):
"""Apply projection from request context.
The passed dictionary may be mutated.
:param field: An instance of `F... | {
"content_hash": "aabbc9c84415264ab6e81833479db211",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 84,
"avg_line_length": 32.26086956521739,
"alnum_prop": 0.6371293800539084,
"repo_name": "genialis/resolwe",
"id": "280956dee900cdbeb29531ab5dd6351f464c0b5e",
"size": "2968... |
from api.models import match
import json
from django.http import HttpResponse
| {
"content_hash": "e6503f6f537736a74144171492aef4ab",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 36,
"avg_line_length": 26,
"alnum_prop": 0.8461538461538461,
"repo_name": "nerdherd/NerdyScout",
"id": "165f48530be7793c09233071bd74425fc652c0f2",
"size": "78",
"binary": ... |
"""
shortest.py
----------------
Given a mesh and two vertex indices find the shortest path
between the two vertices while only traveling along edges
of the mesh.
"""
import trimesh
import networkx as nx
if __name__ == '__main__':
# test on a sphere mesh
mesh = trimesh.primitives.Sphere()
# edges with... | {
"content_hash": "a316dda4ce41e93254c6810f8820527a",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 74,
"avg_line_length": 28.4,
"alnum_prop": 0.6185446009389671,
"repo_name": "dajusc/trimesh",
"id": "cc82810f255f3c4a049da9ca2d2f1987ab10dff6",
"size": "1704",
"binary": ... |
import glob
import gzip
import pickle
with gzip.open('data.pkl.gz', 'rb') as pkl_file:
data = pickle.load(pkl_file)
print('Loading page information...')
pages = {}
for dimension in data:
for i in range(len(data[dimension][1])):
pages[data[dimension][1][i]] = 0
print('Processing view data...')
for s... | {
"content_hash": "17cf9bf9037814d2a465b63084293821",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 66,
"avg_line_length": 28.76923076923077,
"alnum_prop": 0.6256684491978609,
"repo_name": "mpetroff/nugacious",
"id": "4eaca8b513f1c51125527b836fb2359e8c266eb7",
"size": "86... |
from rest_framework import serializers
from wenjuan.models.question import Answer
class AnswerModelSerializer(serializers.ModelSerializer):
"""
Answer Model Serializer
"""
class Meta:
model = Answer
fields = ("id", "question", "option", "answer")
class AnswerDetailSerializer(serial... | {
"content_hash": "3bd3a45e84938a771bfcc313e363c724",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 79,
"avg_line_length": 26.4,
"alnum_prop": 0.6727272727272727,
"repo_name": "codelieche/codelieche.com",
"id": "ee2bf93cfd4e7b22cb55c39d5fb984e0a3a67326",
"size": "683",
... |
"""measure_cocoapod_size.py provides size impact of a given set of cocoapods.
Usage: ./measure_cocoapod_size.py -cocoapods $POD_NAME:$POD_VERSION
"""
import argparse
import json
import os
import tempfile
from collections import OrderedDict
from xcode_project_diff import GenerateSizeDifference
from utils import shell... | {
"content_hash": "3f2a4248c6306566998576beea3db04e",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 137,
"avg_line_length": 35.19344262295082,
"alnum_prop": 0.6285634432643935,
"repo_name": "google/cocoapods-size",
"id": "ec123d61bcc2202c77c140146cd80ec098a21c23",
"size"... |
import os, unittest
import sqlite3 as sqlite
class CollationTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def CheckCreateCollationNotCallable(self):
con = sqlite.connect(":memory:")
try:
con.create_collation("X", 42)
... | {
"content_hash": "e8204517903a240f978dc4d5085e47ef",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 91,
"avg_line_length": 34.25903614457831,
"alnum_prop": 0.5505538948478987,
"repo_name": "ktan2020/legacy-automation",
"id": "59a80e7d0994f79a1233ed0f8e9036d4112fb787",
"s... |
"""Unittest for the type checker."""
import unittest
from astroid import test_utils
from pylint.checkers import typecheck
from pylint.testutils import CheckerTestCase, Message, set_config
class TypeCheckerTest(CheckerTestCase):
"Tests for pylint.checkers.typecheck"
CHECKER_CLASS = typecheck.TypeChecker
d... | {
"content_hash": "7db01dbaf355ee0697a5de8ecfdbaea3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 75,
"avg_line_length": 30.738095238095237,
"alnum_prop": 0.6119287374128582,
"repo_name": "willemneal/Docky",
"id": "33efe5da5c96b582fff6bbbb2b10ef6e18f5dd19",
"size": "129... |
from __future__ import absolute_import, unicode_literals
class Site(object):
"""The site supported object which could be mounted to app instance.
:param name: the name of the supported site.
"""
def __init__(self, name):
self.name = name
self.actions = []
def record_action(self,... | {
"content_hash": "7881fd4f644ac2468352c9794f5f85a0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 79,
"avg_line_length": 35.125,
"alnum_prop": 0.5923289837880585,
"repo_name": "douban/brownant",
"id": "82a40641f4cc579a9fda090352dbf718bf31437a",
"size": "2529",
"binary... |
from datetime import datetime
from django.template import defaultfilters
from django.utils.translation import ugettext as _
from django.utils.timezone import is_aware, utc
from .. import register
@register.filter(expects_localtime=True)
def shortnaturaltime(value):
"""
now, 1s, 1m, 1h, 1 Ene, 1 Ene 2012
... | {
"content_hash": "213913a121ee0b6249be77ab13866f31",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 77,
"avg_line_length": 26.317073170731707,
"alnum_prop": 0.597775718257646,
"repo_name": "Si-elegans/Web-based_GUI_Tools",
"id": "93b7272d6e7ce68fcc2dba875b3ac7524ac1ee12",
... |
from sqlalchemy import Column, String, Integer
from sqlalchemy.ext.declarative import declarative_base
from db import engine
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
openid = Column(String(50), primary_key=True)
cardnum = Column(String(50), nullable=False)
uuid = ... | {
"content_hash": "0666ba0d9e9b413a20eec0932e446c27",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 55,
"avg_line_length": 24.38095238095238,
"alnum_prop": 0.662109375,
"repo_name": "HeraldStudio/wechat",
"id": "935437c2c80b60c25ddb3ec6ca60dd5452ca971e",
"size": "607",
... |
from struct import unpack
import pefile
from viper.common.out import print_warning, print_error
def get_unicode_string(buf, pos):
out = ''
for i in range(len(buf[pos:])):
if not (ord(buf[pos + i]) >= 32 and ord(buf[pos + i]) <= 126) and not (ord(buf[pos + i + 1]) >= 32 and ord(buf[pos + i + 1]) <= 1... | {
"content_hash": "0f936945dca2531b2b4a82f7394d78ad",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 141,
"avg_line_length": 51.140449438202246,
"alnum_prop": 0.6255080742612326,
"repo_name": "kevthehermit/viper",
"id": "6f67877ce594d87e0495216d3faf7980920e4b60",
"size": ... |
import os.path
"""This module configures that alphabet."""
def _load_alphabet(filename):
"""
Load a file containing the characters of the alphabet.
Every unique character contained in this file will be used as a symbol
in the alphabet.
"""
with open(filename, 'r') as f:
return list(set... | {
"content_hash": "7bba771479e86402eef00bccbe656134",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 30.0625,
"alnum_prop": 0.6091476091476091,
"repo_name": "GeorgeArgyros/symautomata",
"id": "f6bb265e5ef789073ed06838eb18946097d4b742",
"size": "962",... |
import unittest
import pickle
from urllib3.exceptions import (HTTPError, MaxRetryError, LocationParseError,
ClosedPoolError, EmptyPoolError,
HostChangedError, ReadTimeoutError,
ConnectTimeoutError, HeaderParsingError)
from ... | {
"content_hash": "c80e304c614fa9e92f62d1df53b196d6",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 34.77358490566038,
"alnum_prop": 0.6559956592512208,
"repo_name": "Lukasa/urllib3",
"id": "beb538b376f7c1b21fb65c6df5c878afc6bf6a7d",
"size": "1843",... |
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop(-1)
def peak(self):
return self.items[-1]
def isEmpty(self):
return self.items == []
def size(self):
return len... | {
"content_hash": "3bb832c5913367e17a4c30f0d0fee9f5",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 100,
"avg_line_length": 29.428571428571427,
"alnum_prop": 0.5218446601941747,
"repo_name": "Etwigg/Examples",
"id": "e5391d1c6d46cbcf1193fda4aefa29205a28eb2a",
"size": "326... |
"""Auth providers for Home Assistant."""
import importlib
import logging
import types
from typing import Any, Dict, List, Optional
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant import data_entry_flow, requirements
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TY... | {
"content_hash": "18fd357b84830eef7b507fc48202f843",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 88,
"avg_line_length": 33.19565217391305,
"alnum_prop": 0.6162409954158481,
"repo_name": "sdague/home-assistant",
"id": "1fe59346b00804bc7aeaeda0ffb79e4702b0ad25",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.