text stringlengths 4 1.02M | meta dict |
|---|---|
"""Interface for using pretrained SE3DS models for prediction."""
from typing import List, NamedTuple, Optional
import numpy as np
from se3ds import constants
from se3ds.models import image_models
from se3ds.utils import pano_utils
import tensorflow as tf
class PanoData(NamedTuple):
"""Data corresponding to a Mat... | {
"content_hash": "c376b834f767360abfe1472e55d14503",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 80,
"avg_line_length": 40.24431818181818,
"alnum_prop": 0.632570944515036,
"repo_name": "google-research/se3ds",
"id": "f2d436a1a1d68cda508e0e76e7f2fa9c79c60c93",
"size": ... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Title(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "indicator"
_path_str = "indicator.title"
_valid_props = {"align", "font", "text"}
# alig... | {
"content_hash": "5fec9e509d5fddea2eeab0d67901941f",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 82,
"avg_line_length": 29.93121693121693,
"alnum_prop": 0.5050380060102528,
"repo_name": "plotly/python-api",
"id": "4fadefa94daa1b1812d8c239e5add2d5098e09d1",
"size": "56... |
"""A word-counting workflow."""
from __future__ import absolute_import
import argparse
import logging
import re
import apache_beam as beam
from apache_beam.io import ReadFromText
from apache_beam.io import WriteToText
from apache_beam.metrics import Metrics
from apache_beam.utils.pipeline_options import PipelineOpti... | {
"content_hash": "31d27fe1c9b3f6b0e269ba553095dde4",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 80,
"avg_line_length": 35.577777777777776,
"alnum_prop": 0.655840099937539,
"repo_name": "ravwojdyla/incubator-beam",
"id": "4d482b02c48951b1ee0b45573061bb79fd4fba15",
"siz... |
import rospy
import rosbag
from std_msgs.msg import String
from sensor_msgs.msg import LaserScan
from trunk_volume import TrunkVolumeDetector
import matplotlib.pyplot as plt
TV_detector = TrunkVolumeDetector()
cur_frame = []
def callback(data):
global cur_frame
volume = TV_detector.push(data)
cur_frame... | {
"content_hash": "f433ece0030c7ac94009f0a8461e5410",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 23.51063829787234,
"alnum_prop": 0.6416289592760182,
"repo_name": "xuyongzhi/scan_volume",
"id": "f51fa84d4b9958dccb5c6af842a1aee4ea112c69",
"size": ... |
""" Simple web crawler using concurrent futures """
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
import requests
import sys
import urllib
import re
import pickle
import zlib
import argparse
from bs4 import BeautifulSoup as bs
www_re = re.compile(r'^www\d*\.', re.IGNORECASE)
skip_re = re.com... | {
"content_hash": "18e85e5af5ed3984ef51984d240f2e21",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 110,
"avg_line_length": 35.213793103448275,
"alnum_prop": 0.5432824128476302,
"repo_name": "pythonhacker/pyconindia2017concurrency",
"id": "cced32bb356a31848f03a2e33c83d6bd1... |
from slimmer import * # slimmer.py has an __all__ variable | {
"content_hash": "28131f6bd0e505f7f606b0f1846d48e3",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 58,
"avg_line_length": 58,
"alnum_prop": 0.7241379310344828,
"repo_name": "AloneRoad/Inforlearn",
"id": "0a105aca3c1e1b1eedb97f9a987f6fe85ee9504c",
"size": "58",
"binary":... |
from google.appengine.ext import db
class Product(db.Model):
# Key: The name of the product should be stored by the app in the entity's
# key_name. This will be used to uniquely identify the product instead of
# having appengine assign an integer ID.
pass
| {
"content_hash": "05c7f093142ece35ea65b779ef6fd9b3",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 76,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.7509433962264151,
"repo_name": "supriyantomaftuh/syzygy",
"id": "6dfedf25394a747a54ce4d0280e45a0b6d687561",
"size"... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from slim import LanguageField, Slim
try:
from PIL import Image, ImageOps
except ImportError:
import Image
import ImageOps
STATE_CHOICES = (
('AC', u'Acre'),
('... | {
"content_hash": "845fc9e46f5cf4195fa26f2bf3e5b413",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 79,
"avg_line_length": 34.51526717557252,
"alnum_prop": 0.5683954439898263,
"repo_name": "klebercode/canaa",
"id": "50a4823796e861f233f765e7e6c45835e01daacb",
"size": "909... |
"""Small tool for scraping http://redditlist.com/"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
from bs4 import BeautifulSoup
import requests
# Only getting SFW subreddits.
BASE = 'http://redditlist.com/sfw?page='
def fe... | {
"content_hash": "92dac96645d1f0deac8836656ac03ec0",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 82,
"avg_line_length": 26.796296296296298,
"alnum_prop": 0.6744989633724948,
"repo_name": "conversationai/conversationai-moderator-reddit",
"id": "c3e1978968c8ea805426444904c... |
"""\
=========================
Simple multicast receiver
=========================
A simple component for receiving packets in the specified multicast group.
Remember that multicast is an unreliable connection - packets may be lost,
duplicated or reordered.
Example Usage
-------------
Receiving multicast packets... | {
"content_hash": "6433cccc79fdb8eb70a626a1ac765138",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 97,
"avg_line_length": 29.28813559322034,
"alnum_prop": 0.6001157407407407,
"repo_name": "sparkslabs/kamaelia_",
"id": "3a9d27c07281be68e5349ef991e63668be2f2484",
"size": ... |
from django.conf import settings
def metasyntactic_variables(request):
"""Include the meta-syntactic variables"""
r = {}
for var in settings.FOO_VARIABLES:
r[var] = getattr(settings, 'FOO_%s' % var)
return r | {
"content_hash": "f10df9a91275016235f86ecd25aae99c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 44,
"avg_line_length": 24,
"alnum_prop": 0.7129629629629629,
"repo_name": "thsutton/django-application-settings",
"id": "9a3794ebc5f6745696a0bfa9c21b6f7178f44b48",
"size": "... |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements(fname):
for line in open(os.path.join(os.path.dirname(__file__), fname)):
yield line.strip()
setup(
name = "wikiclass",
version = read('VE... | {
"content_hash": "2ce2d881308148fc7f8c2f46b5ec4150",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 112,
"avg_line_length": 36.857142857142854,
"alnum_prop": 0.6341085271317829,
"repo_name": "wikimedia/Wiki-Class",
"id": "0e15e116660c84f2ff67a2eb8b71f578fe10d6ee",
"size":... |
"""Tkinter widgets for VTK."""
__all__ = ['vtkTkRenderWidget', 'vtkTkImageViewerWidget',
'vtkTkRenderWindowInteractor', 'vtkTkPhotoImage']
| {
"content_hash": "13b80ce4360d966c90dec6f6ef49db76",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 60,
"avg_line_length": 38.75,
"alnum_prop": 0.6709677419354839,
"repo_name": "hlzz/dotfiles",
"id": "19d7f3c0b6596ecf6b8b6844c8c2c89d0d7ea161",
"size": "155",
"binary": fa... |
from highdicom import ann
from highdicom import color
from highdicom import ko
from highdicom import legacy
from highdicom import pm
from highdicom import sc
from highdicom import seg
from highdicom import sr
from highdicom.base import SOPClass
from highdicom.content import (
AlgorithmIdentificationSequence,
Is... | {
"content_hash": "9ae99401172d07675a3e6405105a1876",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 41,
"avg_line_length": 25.14814814814815,
"alnum_prop": 0.7417771232204222,
"repo_name": "MGHComputationalPathology/highdicom",
"id": "517c7ad906a31795ec3df5d67e43199822c2d06... |
import itunespy
from itunespy import result_item
class MovieArtist(result_item.ResultItem):
"""
Defines an Movie Artist
"""
def __init__(self, json):
"""
Initializes the ResultItem class from the JSON provided
:param json: String. Raw JSON data to fetch information from
... | {
"content_hash": "d1a9624feb346b16c956b57c71ce8f3b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 88,
"avg_line_length": 31.35,
"alnum_prop": 0.631578947368421,
"repo_name": "spaceisstrange/itunespy",
"id": "75b365da7049c0da1ee1a6339e1e529d5fd5bc79",
"size": "1327",
"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import abel
import collections
import matplotlib.pylab as plt
from time import time
# inverse Abel transform methods -----------------------------
# ... | {
"content_hash": "ee09eaf201d9f5d879d7582280454f41",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 76,
"avg_line_length": 30.672727272727272,
"alnum_prop": 0.6425607587433314,
"repo_name": "DhrubajyotiDas/PyAbel",
"id": "124e53a2e2038102b888db9b6560414d294684d0",
"size"... |
"""TestCases for exercising a Recno DB.
"""
import os, sys
import errno
from pprint import pprint
import string
import unittest
from test_all import db, test_support, verbose, get_new_environment_path, get_new_database_path
#----------------------------------------------------------------------
class SimpleRecnoTe... | {
"content_hash": "e84cc67e3fd32dc81f5f703826017d66",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 95,
"avg_line_length": 27.432601880877744,
"alnum_prop": 0.5110273111644383,
"repo_name": "IronLanguages/ironpython2",
"id": "10974200f31797e4fdda3e268abdec09b4045e06",
"s... |
import os
import sys
import time
import six
import numpy as np
import math
import argparse
import logging
import paddle.fluid as fluid
import paddle
import time
import reader as reader
from nets import MultiviewSimnet, SimpleEncoderFactory
logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s")
logger ... | {
"content_hash": "b6e02438d0cc024707ceff4840dbc1d1",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 80,
"avg_line_length": 33.672955974842765,
"alnum_prop": 0.5928277923048189,
"repo_name": "kuke/models",
"id": "f098fd109e8813ffbfb40753122acbef3cd896a6",
"size": "5964",
... |
import coverage
import message
import test
import verilog
# we reuse vpi test
import test_vpi
message.message.verbosity(message.INT_DEBUG)
################################################################################
class test_cvg :
class coverpoint_sig(coverage.coverpoint) :
'bits toggle'
def __init_... | {
"content_hash": "9e577f9d921fe19bc378a07443cc1b3f",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 126,
"avg_line_length": 36.20183486238532,
"alnum_prop": 0.617840851495185,
"repo_name": "rporter/verilog_integration",
"id": "42d8780b947d69b6cbb985490f0b8f711864b981",
"... |
'''test cases for post module'''
import unittest
import os
from cray.craylib.post import Post
POST_DIR = os.path.join(os.path.dirname(__file__), "test_site", "_post")
def get_test_suites():
'''Return test cases as a suite in this module'''
suite = unittest.TestSuite()
suite.addTest(PostGenerateTestCase(... | {
"content_hash": "3ae0a324afa03bf873b949614999068e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 90,
"avg_line_length": 33.78378378378378,
"alnum_prop": 0.5712,
"repo_name": "boluny/cray",
"id": "ddfd8cab173b2356a8be4d466544456dec59c521",
"size": "1274",
"binary": fa... |
import random
def generate(myrace, myclass, mystats, infeats, inlevel):
if infeats != "rand":
return infeats
else:
return ["Implementation", "Needed"]
#Account for input classes here, make an educated guess about feats based on stats
| {
"content_hash": "877bc4c7866a3b2ac5d8cdaf1f78a6fe",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 84,
"avg_line_length": 27.11111111111111,
"alnum_prop": 0.7377049180327869,
"repo_name": "laisrael/Game-Tools-NPC-Generator",
"id": "0fcdce040a7249db9a35ae5e79c10828a623ca7d",... |
"""Test all functions related to the basic accessory implementation.
This includes tests for all mock object types.
"""
from datetime import datetime, timedelta
from unittest.mock import patch, Mock
import pytest
from homeassistant.components.homekit.accessories import (
debounce,
HomeAccessory,
HomeBrid... | {
"content_hash": "fea3890dd0089f339998649d748313c7",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 86,
"avg_line_length": 34.393393393393396,
"alnum_prop": 0.6729241246834891,
"repo_name": "fbradyirl/home-assistant",
"id": "fcc0e05b570c1a1ad9b6f6ee6b5b355c7ab2ecf2",
"si... |
"""
Main Rasadron launcher file
"""
from __future__ import division
import time, math, sys, os
import RPi.GPIO as GPIO
from Motor import Motor
from DS18B20 import Temperature
from MPU6050 import Gyro
#from GPS6MV import GPS
#from QC1602A import LCD
#from Camera import Camera
GPIO.setmode(GPIO.BOARD)
#GPIO.setmode(GP... | {
"content_hash": "5e6742e8963be777df2ea530b58d7471",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 53,
"avg_line_length": 19.940298507462686,
"alnum_prop": 0.7118263473053892,
"repo_name": "DavisMiculis/Rasadron",
"id": "b8026bf9d91735ea9d851bbe00fd489deb0aa163",
"size":... |
from petersen.app.base import app
from sqlalchemy import (
create_engine,
Column,
Integer,
String,
Boolean,
ForeignKey,
TIMESTAMP
)
from pytz import utc
from datetime import datetime as dt
from sqlalchemy.orm import sessionmaker
from petersen.models.base import Base
from functools import wra... | {
"content_hash": "8c57c5b46b9e0a9574dce0a8c8503b7e",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 81,
"avg_line_length": 25.7979797979798,
"alnum_prop": 0.6515270164447925,
"repo_name": "TRManderson/petersen",
"id": "3796df73b9912162b7928f68b2617a5321a101de",
"size": "2... |
from django.shortcuts import render,render_to_response
from django.http import HttpResponse,JsonResponse,HttpResponseRedirect
from .models import Users
import json,datetime
from django.template import RequestContext
from django import forms
# Create your views here.
class home(object):
def __init__(request, ):
... | {
"content_hash": "a727807b510b564c1ee10d16b6a5c487",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 102,
"avg_line_length": 30.617977528089888,
"alnum_prop": 0.571743119266055,
"repo_name": "yephper/django",
"id": "fac013e2300cbf5fb052f154477e8a405eacb5d9",
"size": "2829"... |
import os
from unittest import mock
import flask
import pytest
from airflow.dag_processing.processor import DagFileProcessor
from airflow.security import permissions
from airflow.utils.session import create_session
from airflow.utils.state import State
from airflow.www.utils import UIAlert
from airflow.www.views impo... | {
"content_hash": "0505a170d11aae6178422fdc8798fbcc",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 108,
"avg_line_length": 38.18340611353712,
"alnum_prop": 0.6619396157365051,
"repo_name": "apache/incubator-airflow",
"id": "748f5ee6b3e254fad6eacb82363ff0751abdfef2",
"si... |
"""Negative log likelihoods as objective functions."""
from flax.core import frozen_dict
from gpax import utils
from gpax.models import gp
import jax.numpy as jnp
def objective(model: gp.GaussianProcess, params: frozen_dict.FrozenDict,
dataset: utils.Dataset) -> jnp.floating:
"""Negative log likeliho... | {
"content_hash": "b010a0c3dd1b2f3e39bc8b9831f851f0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 79,
"avg_line_length": 28.64,
"alnum_prop": 0.6983240223463687,
"repo_name": "google-research/gpax",
"id": "3f25dfece1b801089f45cbab1c7afd102e72ba8f",
"size": "1309",
"bi... |
"""Main Module to migrate Hive tables to BigQuery."""
import logging
from google.api_core import exceptions
from hive_to_bigquery.bigquery_component import BigQueryComponent
from hive_to_bigquery.bigquery_table import BigQueryTable
from hive_to_bigquery import custom_exceptions
from hive_to_bigquery.gcs_sto... | {
"content_hash": "5e47b32fee27a3a40283ca7a27b31584",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 81,
"avg_line_length": 44.495114006514655,
"alnum_prop": 0.6227672035139092,
"repo_name": "CloudVLab/professional-services",
"id": "62af835a753f70f18174b11a3af4e41c0039d8e5"... |
import sdb_database as sdb_db
from database import ManagedSession, sliced_query
from chunking import noun_phrases
from csv import DictReader
from utils import drop
from time import strptime
import argparse
def preprocess(text):
return text.lower()
def memoized_row(memo, row):
hashed = row.uuid()
if hashed... | {
"content_hash": "599d45cb76dba2c06305c59e45771849",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 133,
"avg_line_length": 36.380645161290325,
"alnum_prop": 0.5910622450789147,
"repo_name": "dpfried/mocs",
"id": "ccf73e68ce6e9f94aeb223a121c51aad5f4a0147",
"size": "5639"... |
class WeimaqiPipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "23f61304d8dfab15feaaf97112bf0eb2",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 31,
"alnum_prop": 0.6881720430107527,
"repo_name": "neilnee/octopus",
"id": "35d8d73265b51830d6412c1d0aa5e4f699df1ce5",
"size": "287",
"binary": fal... |
import string
import sys
import os
import glob
# EOL constants
CR = "\r"
LF = "\n"
CRLF = "\r\n"
if sys.platform == "win32":
NATIVE = CRLF
else:
# Yes, LF is the native EOL even on Mac OS X. CR is just for
# Mac OS <=9 (a.k.a. "Mac Classic")
NATIVE = LF
# Automatically generated sections contain start... | {
"content_hash": "01c642608bb63f71fd5aaa8620ba1735",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 107,
"avg_line_length": 37.51219512195122,
"alnum_prop": 0.5770016719301505,
"repo_name": "eigenpuff/np2",
"id": "ec772f8c5695cfaebaac05678507298c00301060",
"size": "11687... |
class Implnd:
"""A class for an impervious land segment for an HSPF model."""
def __init__(self,
operation,
subbasin,
area,
length,
slope,
elev,
lat,
ATMP = False,
... | {
"content_hash": "baaa320bb5010f20f54e356b4c1ad7e3",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 80,
"avg_line_length": 34.9864406779661,
"alnum_prop": 0.5050867164034493,
"repo_name": "kbrannan/PyHSPF",
"id": "161cc6e4e2573fdd275caf9379ffef96b3483c42",
"size": "10541... |
from __future__ import absolute_import, division, print_function
import abc
import functools
import itertools
import re
from ._compat import string_types, with_metaclass
from .version import Version, LegacyVersion, parse
class InvalidSpecifier(ValueError):
"""
An invalid specifier was found, users should re... | {
"content_hash": "9ee9f6e916fe9ce8e20a43627cbb5746",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 79,
"avg_line_length": 36.24410540915395,
"alnum_prop": 0.5511250574008878,
"repo_name": "FenceAtMHacks/flaskbackend",
"id": "8022578621a4103f7111e8d82b841cbfce0cfab0",
"s... |
from queue_common import sleep_rand
#from queue_common import threads_all_died
#from queue_common import exit_threads
from queue_common import default_check as check
from queue_common import read_tool
from queue_common import write_tool
#from queue_common import thread_tool
#from queue_common import two_queue_thread
fr... | {
"content_hash": "cab657a126ef836ad658e288d2520bba",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 67,
"avg_line_length": 20.934426229508198,
"alnum_prop": 0.6562255285826155,
"repo_name": "alingse/crawler",
"id": "aa58fa35a034a76ce7db041f58d4c1a7e7d08001",
"size": "1319... |
"""
Tips for
Uses multiple GPUs, indicated by the flag --nr-gpu
Example usage:
CUDA_VISIBLE_DEVICES=0,1,2,3 python train_double_cnn.py --nr_gpu 4
"""
# utility modules
import os
from os import path
import shutil
import sys
import time
import json
import argparse
import numpy as np
import tensorflow as tf
import tens... | {
"content_hash": "5f5a9e5497d746a4a4349548eec12d4d",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 115,
"avg_line_length": 39.82258064516129,
"alnum_prop": 0.6148238153098421,
"repo_name": "LuxxxLucy/mnist_LeNet",
"id": "41f92cf5d47e7c465071d3a3034cf239eaba7e09",
"size"... |
from socket import timeout as socket_timeout # noqa
from django.core.urlresolvers import reverse
from django import http
from mox import IsA # noqa
from horizon import exceptions
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.images import utils
from openstack_dashboard.test impor... | {
"content_hash": "daea88b41f94d530ebb361fcbfcc58e3",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 79,
"avg_line_length": 45.264,
"alnum_prop": 0.5729350771768588,
"repo_name": "tsufiev/horizon",
"id": "8dd9223614d83e49d0a549ed2a6ed0459c0083c5",
"size": "17776",
"bina... |
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts.
Functional tests are disabled on Windows by default. Use --force to run them anyway.
For a description of arguments recognized by test scripts, ... | {
"content_hash": "f1d1b34eed816a1af3ca889116d865db",
"timestamp": "",
"source": "github",
"line_count": 614,
"max_line_length": 195,
"avg_line_length": 38.656351791530945,
"alnum_prop": 0.6110806825363387,
"repo_name": "digibyte/digibyte",
"id": "5ac5ac9d65943968a2513bbea25afd8639e5aa6d",
"size": "... |
import sys
import subprocess
from microbuild import microbuild
@microbuild.task()
def apidoc():
"""
Generate API documentation using epydoc.
"""
subprocess.call(["epydoc","--config","epydoc.config"])
@microbuild.task()
def test():
"""
Run unit tests.
"""
subprocess.call(["python","... | {
"content_hash": "1decd1d4e7fb59378f9548d49d366649",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 93,
"avg_line_length": 31.304347826086957,
"alnum_prop": 0.6555555555555556,
"repo_name": "CalumJEadie/microbuild",
"id": "5eb6f7508ad45fb6dd5d24775cbd4032c7617d8f",
"size"... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import simple_elasticsearch
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
'elasticsearch>=2.0.0',
]
test_requirements = [
'datadiff>=1.1.6',... | {
"content_hash": "ad14d9874cb41269da98eb5c8c75281e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 72,
"avg_line_length": 31.966101694915253,
"alnum_prop": 0.630965005302227,
"repo_name": "jaddison/django-simple-elasticsearch",
"id": "64480d00653efcd06cb6a3ce126509b8693ce4... |
"""
DAG designed to test a PythonOperator that calls a functool.partial
"""
from __future__ import annotations
import functools
import logging
from datetime import datetime
from airflow.models import DAG
from airflow.operators.python import PythonOperator
DEFAULT_DATE = datetime(2016, 1, 1)
default_args = dict(start... | {
"content_hash": "dbbd253ed529cf1ed503e2086e88b669",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 21.5531914893617,
"alnum_prop": 0.7018756169792695,
"repo_name": "nathanielvarona/airflow",
"id": "ec655ad43500ec8160a8ad25f357bda72957db3b",
"size":... |
import click
from molecule import logger
from molecule.command import base
LOG = logger.get_logger(__name__)
class Dependency(base.Base):
"""
.. program:: molecule dependency
.. option:: molecule dependency
Target the default scenario.
.. program:: molecule dependency --scenario-name foo
... | {
"content_hash": "5b2a45ae4b6cac2251549ee0846ef307",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 76,
"avg_line_length": 24.242857142857144,
"alnum_prop": 0.6423099587507366,
"repo_name": "metacloud/molecule",
"id": "e8f76529d4392ce988b36ed84bb87554b86c8596",
"size": "2... |
import pylink
from pylink import TaggedAttribute as TA
def __do_it_do_it_now(self):
return self.whimsy_coefficient
ex = {
'whimsy_coefficient': TA(42,
datasheet="hitchhiker's guide to the galaxy",
author="Douglas Adams"),
'wacky_computation': __do_... | {
"content_hash": "6208a4c73db80c13e1531a3cced93b2e",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 86,
"avg_line_length": 43.55555555555556,
"alnum_prop": 0.560204081632653,
"repo_name": "harrison-caudill/pylink",
"id": "cbbcad47ba4a0bf147086bb1a97184da7ddb775d",
"size":... |
from oslo_utils import netutils
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.resources.openstack.neutron import neutron
from heat.engine import support
class Subnet(neutron.N... | {
"content_hash": "2325694f78511d02d79aed980358f56e",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 79,
"avg_line_length": 36.87337662337662,
"alnum_prop": 0.5314783833758915,
"repo_name": "maestro-hybrid-cloud/heat",
"id": "410363508fd582ed33ef3fad853165e387d8e5d3",
"si... |
__author__ = 'jonathan'
from lib.rome.core.orm.query import Query
class ControlledExecution():
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
pass
class FakeSession():
def add(self, *objs):
for obj in objs:
obj.save()
def query(self, *ent... | {
"content_hash": "efb67fd10085f1c2a8dea14ddd4bf239",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 49,
"avg_line_length": 20.029411764705884,
"alnum_prop": 0.591776798825257,
"repo_name": "BeyondTheClouds/rome",
"id": "40707176bb4db762d2265135c0b619a8339c5d0e",
"size": "... |
class RetrieveRequest(object):
def __init__(self):
self.group = None
self.dataset = None
self.request = None
self.filename = None
def getGroup(self):
return self.group
def setGroup(self, group):
self.group = group
def getDataset(self):
return s... | {
"content_hash": "eff580f7d1ec33c94f9df6860887db72",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 36,
"avg_line_length": 20.3125,
"alnum_prop": 0.6061538461538462,
"repo_name": "mjames-upc/python-awips",
"id": "3507dff1b8187a7ced2d50420ebc6ca4f89d785c",
"size": "727",
... |
import socket
import sys
from paramiko.py3compat import u
# windows does not have termios...
try:
import termios
import tty
has_termios = True
except ImportError:
has_termios = False
def interactive_shell(chan):
if has_termios:
posix_shell(chan)
else:
windows_shell(chan)
def... | {
"content_hash": "fd30afa6d4e656f0ce712748c3dd0dde",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 93,
"avg_line_length": 24.60759493670886,
"alnum_prop": 0.5005144032921811,
"repo_name": "wesleybowman/karsten",
"id": "d2d0192d49c3bacb5bf12bdf70468e104887f7af",
"size": "... |
"""Platform for the Garadget cover component."""
import logging
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.cover import CoverDevice, PLATFORM_SCHEMA
from homeassistant.helpers.event import track_utc_time_change
from homeassistant.const i... | {
"content_hash": "27d5d7d26c0e72688ad273a06527facd",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 86,
"avg_line_length": 32.435424354243544,
"alnum_prop": 0.5786120591581343,
"repo_name": "qedi-r/home-assistant",
"id": "d487c39db6bfa51823ff0dacf934d66ea6a4f409",
"size"... |
from tk_tools.canvas import Gauge, Graph, Led, RotaryScale
from tk_tools.groups import (
ButtonGrid,
Calendar,
EntryGrid,
KeyValueEntry,
LabelGrid,
MultiSlotFrame,
SevenSegment,
SevenSegmentDigits,
)
from tk_tools.widgets import (
BinaryLabel,
ByteLabel,
ScrollableFrame,
... | {
"content_hash": "9dd910bdd8087f0cb4975a04b3277f3c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 58,
"avg_line_length": 17.431372549019606,
"alnum_prop": 0.6344206974128234,
"repo_name": "slightlynybbled/tk_tools",
"id": "ffeb5851e107448546d73cd70d89837b59804243",
"siz... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.chat.v3.channel import ChannelList
class V3(Version):
def __init__(self, domain):
"""
Initialize the V3 version of Chat
:retu... | {
"content_hash": "d1b099f948c9be661a25cf219cd34393",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 55,
"avg_line_length": 22.536585365853657,
"alnum_prop": 0.5313852813852814,
"repo_name": "twilio/twilio-python",
"id": "51c334ed8633b7b87744859402d1b29ffdda7d12",
"size": ... |
from builtins import str
from pyhive import presto
from pyhive.exc import DatabaseError
from airflow.hooks.dbapi_hook import DbApiHook
class PrestoException(Exception):
pass
class PrestoHook(DbApiHook):
"""
Interact with Presto through PyHive!
>>> ph = PrestoHook()
>>> sql = "SELECT count(1) A... | {
"content_hash": "4d58a574c5858e466ba0b15a431a9a43",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 76,
"avg_line_length": 30.272727272727273,
"alnum_prop": 0.5765765765765766,
"repo_name": "Tagar/incubator-airflow",
"id": "935a9a548ab37e4f800979eaf77abae2cb6a94d5",
"size... |
'''
The configuration for the application.
We use the config module found here: http://www.red-dove.com/config-doc/
Load the config file we find in REALCHAT_CONFIG_FILE. This file is
required for config imports to work.
'''
import os
from config import Config, ConfigMerger
class ConfigException(Exception):
pas... | {
"content_hash": "37074ee2e66da88c3768a305374c9e54",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 31.340425531914892,
"alnum_prop": 0.6653088934147997,
"repo_name": "james-m/realchat",
"id": "e8311e8232cf4b928773e694039b055ade8f73d2",
"size": "147... |
import os
import qiniu
from qiniu import Auth
from gevent import monkey
from gevent.pool import Pool
from config import config
monkey.patch_socket()
def down(token, key, localfile, mime_type, delete=False):
ret, info = qiniu.put_file(
token, key, localfile,
mime_type=mime... | {
"content_hash": "af15acad37abc00740d15119ff362e99",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 27.54022988505747,
"alnum_prop": 0.5471619365609349,
"repo_name": "billvsme/videoSpider",
"id": "f77e3f0f20aad3400ababc225485f790dbbd8157",
"size": "... |
import logging
import sys
from collections import defaultdict
from functools import cached_property, lru_cache
from typing import Dict, Iterable, Iterator, Set, Tuple
from google.protobuf.descriptor_pb2 import FieldDescriptorProto as field_proto
import yaml
from udpa.annotations import security_pb2
from udpa.annotati... | {
"content_hash": "aab59dca0543dd5c27d690073c8d08a9",
"timestamp": "",
"source": "github",
"line_count": 581,
"max_line_length": 133,
"avg_line_length": 40.67641996557659,
"alnum_prop": 0.6287817881775484,
"repo_name": "envoyproxy/envoy",
"id": "651d9b78e74963b63fef16c060a68d2a70869357",
"size": "23... |
import json
import time
import unittest
from project.server import db
from project.server.models import User
from project.tests.base import BaseTestCase
class TestAuthBlueprint(BaseTestCase):
def test_registraion(self):
"""Test for user registration"""
with self.client:
response = s... | {
"content_hash": "929f7c1456586cc2a51f61627fc0e333",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 89,
"avg_line_length": 41.772549019607844,
"alnum_prop": 0.5284453623732632,
"repo_name": "androiddrew/jwt-auth",
"id": "f2722adbb8c7e6ca809f5588109a97b96c750601",
"size":... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, print_function
import io
import re
import sys
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
from setuptool... | {
"content_hash": "35fd2efc2c61407cbea366d99007e738",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 116,
"avg_line_length": 32.943661971830984,
"alnum_prop": 0.5964087216759298,
"repo_name": "ionelmc/python-signalfd",
"id": "215997ef3b4429f7c2b83f8da34ea45656ba70c2",
"siz... |
"""Base module for unittesting."""
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import login
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
from plone.app.t... | {
"content_hash": "c6424006f61d18a66a7fe1d71c745015",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 60,
"avg_line_length": 29.921875,
"alnum_prop": 0.7154046997389034,
"repo_name": "a25kk/stv",
"id": "27d160f0b4b9bddbdae196c0c1489a2cc14869c5",
"size": "1939",
"binary": ... |
import objects
import pygame
from util import Block, Font
objectFactory = objects.ObjectsFactory()
class GObject(Block):
count = 1
def __init__(self, name):
self.baseObject = objectFactory.createObject(name)
super().__init__(imgname=self.baseObject.imagename)
self.typ = self.base... | {
"content_hash": "2cd3640b9703acb7d01ac6c56f05ec3e",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 59,
"avg_line_length": 20.9,
"alnum_prop": 0.6220095693779905,
"repo_name": "anokata/pythonPetProjects",
"id": "bac34383a0f14ef2080c6f3baac14cc6fd9ab6bb",
"size": "627",
... |
'''
Created on 10/12/2009
@author: martin
'''
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url(r'^sign_up/$', 'users.views.sign_up', name="users_sign_up"),
url(r'^check_profile/$', 'users.views.check_profile', name="users_check_profile"),
url(r'^developers_json/$', 'users... | {
"content_hash": "dde2622a60595238f6eccd428e5294c4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 118,
"avg_line_length": 55.31818181818182,
"alnum_prop": 0.6442070665571077,
"repo_name": "devsar/ae-people",
"id": "62137e86428571c003523abe41aa6aa8df4b39e2",
"size": "121... |
from __future__ import print_function
import datetime
import json
import os
import pkg_resources
import re
import shutil
import sys
import traceback
from dateutil import tz
from bloom.generators import BloomGenerator
from bloom.generators import resolve_dependencies
from bloom.generators import update_rosdep
from b... | {
"content_hash": "0eb760a675c9992213498f2ad5f2c828",
"timestamp": "",
"source": "github",
"line_count": 640,
"max_line_length": 102,
"avg_line_length": 39.6453125,
"alnum_prop": 0.5991802309541638,
"repo_name": "130s/bloom",
"id": "a0482d662661bf822fbaf5b81baa3544fd0269e6",
"size": "26978",
"bina... |
from __future__ import absolute_import, division, print_function, unicode_literals
def main_fun(args, ctx):
import tensorflow_datasets as tfds
import tensorflow as tf
from tensorflowonspark import compat
tfds.disable_progress_bar()
strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy()
BUF... | {
"content_hash": "2f3cdf43251719fc5e64e0b49b87e656",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 192,
"avg_line_length": 43.46153846153846,
"alnum_prop": 0.7236409608091025,
"repo_name": "yahoo/TensorFlowOnSpark",
"id": "b1c9fdb8675b64beab6e8edac60d79c99a2283be",
"size... |
import mock
from oslo_serialization import jsonutils
import webob
from cinder import context
from cinder import exception
from cinder import test
from cinder.tests.api import fakes
# This list of fake volumes is used by our tests. Each is configured in a
# slightly different way, and includes only the properties th... | {
"content_hash": "77cd3baa9dd32c4a8c31b2c798bf80ae",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 40.25170068027211,
"alnum_prop": 0.6052053405441947,
"repo_name": "tmenjo/cinder-2015.1.0",
"id": "2939a61b8a2a06e556372523cd6aef6e762b4b4c",
"size"... |
import re
from django.test import TestCase
from django.db.utils import IntegrityError
from smartfields.models import SmartfieldsModelMixin
from test_app.models import TextTesting
from test_suite.test_files import add_base
class TextTestCase(TestCase):
def strip(self, text):
return re.sub('( +|\t+|\n+)'... | {
"content_hash": "21bbb8b158f9bafae316d29e03ff72af",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 92,
"avg_line_length": 45.35964912280702,
"alnum_prop": 0.6646683426803326,
"repo_name": "lehins/django-smartfields",
"id": "ca4addaf12741ea7e4d4defe9be8eee14ec948c3",
"si... |
import logging
from contextlib import closing
from flask import g
from app import settings
from app.signatures import cert_chain_url_valid, parse_certificate, signature_valid
logger = logging.getLogger(__name__)
class AlexaRequest():
intent_name = None
slots = None
def __init__(self, flask_request):
... | {
"content_hash": "6216d46f8b0c1ff295e0afbf90682fdc",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 83,
"avg_line_length": 29.245714285714286,
"alnum_prop": 0.5484564282923017,
"repo_name": "peap/alexa-astro",
"id": "f0f7486ba3f2c7faf9f106107e251032daa28c67",
"size": "51... |
from django.db.models import signals
from django.conf import settings
from django.utils.translation import ugettext_noop as _
if "notification" in settings.INSTALLED_APPS and getattr(settings, 'DJANGO_MESSAGES_NOTIFY', True):
from notification import models as notification
def create_notice_types(app, created... | {
"content_hash": "81ecc9e67c78e5d0eae0c809554a4aca",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 143,
"avg_line_length": 71.38888888888889,
"alnum_prop": 0.7291828793774319,
"repo_name": "sozlukus/sozlukus.com",
"id": "2172a0f16bc4eef27689e0225176c41ac34306ee",
"size":... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
('users', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
... | {
"content_hash": "6982f83a31b1f1a80ee567d7eb1a9555",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 81,
"avg_line_length": 27.25,
"alnum_prop": 0.5897771952817824,
"repo_name": "anistark/mozillians",
"id": "5dc6c8e917013c22a5f8499ec3075a0dd5d1a70c",
"size": "787",
"bina... |
from mysql.connector import connect, Error
import re
import tweepy
tweet_id = 0
# DB Configuration
config = {
'user': 'root',
'password': 'rmtdl0680036',
'host': '127.0.0.1',
'database': 'twitterdata',
'raise_on_warnings': True,
}
consumer_key = "Hol90i780joDoqDzWS32tR2cn"
consumer_secret = "wIPsoeGyHbqfmHNc... | {
"content_hash": "c84ad8d4d6b8a3dfdfdad4763b643a04",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 29.61904761904762,
"alnum_prop": 0.6864951768488746,
"repo_name": "SkumarAG/twitterFeedExtractor",
"id": "0ee2c5eae06870293e53523976af773ebe66cb0f",
... |
'''
Exercise 1a - Class 2 - Check module loading
Changes to use exceptions to check if module exist. So this could be used to
make the programa compatible with more than one specific module if the
preferred one isn't found on the system (like pysnmp and netsnmp)
Gleydson Mazioli da Silva <gleydsonmazioli@gmail.com>
''... | {
"content_hash": "eb0c0e2ba77c30a2c1ea499f0e8f369f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 76,
"avg_line_length": 28.347826086956523,
"alnum_prop": 0.754601226993865,
"repo_name": "gleydsonm/pynet_ex",
"id": "2e6a5a55830d16054dbbe41c7de9902a7c7a0f81",
"size": "67... |
"""passlib.handlers.scram - hash for SCRAM credential storage"""
#=============================================================================
# imports
#=============================================================================
# core
import logging; log = logging.getLogger(__name__)
# site
# pkg
from passlib.util... | {
"content_hash": "e3feaf18b65728de2890dfa911e9ddb1",
"timestamp": "",
"source": "github",
"line_count": 582,
"max_line_length": 97,
"avg_line_length": 38.72680412371134,
"alnum_prop": 0.512888770575447,
"repo_name": "marcuskelly/recover",
"id": "87bfabde7238ea813e6848ae93eae5a859881546",
"size": "2... |
import sys, os, re, shutil, tarfile
import paths
class BuildTAPWindows(object):
# regex for doing search replace on @MACRO@ style macros
macro_amper = re.compile(r"@(\w+)@")
def __init__(self, opt):
self.opt = opt # command line options
if not... | {
"content_hash": "bbf0ce364bf7043d15369cfc8ab3617a",
"timestamp": "",
"source": "github",
"line_count": 511,
"max_line_length": 242,
"avg_line_length": 37.900195694716245,
"alnum_prop": 0.545670470387773,
"repo_name": "Jigsaw-Code/outline-client",
"id": "377138a40e801b8c733fb5e162d34183ffc9e1c1",
"... |
import gzip
import logging
import zlib
from io import BytesIO
from os import environ
from typing import Dict, Optional
from time import sleep
import backoff
import requests
from opentelemetry.sdk.environment_variables import (
OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE,
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION,
O... | {
"content_hash": "f4bd61533823db2196afe4fc1fa12eb5",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 98,
"avg_line_length": 32.946236559139784,
"alnum_prop": 0.616677545691906,
"repo_name": "open-telemetry/opentelemetry-python",
"id": "9dc3b65014db56164d9adbfca2e8e4845f1170... |
from pyvirtualdisplay import Display
from selenium import webdriver
from time import sleep
import sys
from contextlib import contextmanager
@contextmanager
def create_hidden_display(width, height):
display = Display(visible=0, size=(width, height))
display.start()
yield display
display.stop()
@cont... | {
"content_hash": "6ecce29535e396dcd12d37f9e2c43c0d",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 54,
"avg_line_length": 21.976190476190474,
"alnum_prop": 0.676056338028169,
"repo_name": "Xaviju/turpenscape",
"id": "07f9d9c734fc8bf4a74bf7ada39beee91803b2b6",
"size": "97... |
from __future__ import generators
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
os.path.split(parent_dir)[1] == 'pygame')
if not is... | {
"content_hash": "ba0a14ce39068dfe3e725afa8390b1b2",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 91,
"avg_line_length": 28.42753623188406,
"alnum_prop": 0.5834820290593933,
"repo_name": "jingzhehu/udacity_mlnd",
"id": "6bb53f17fcea09b74e9c8c4fa6720ef8fb49b453",
"size"... |
import pytest
from thefuck.rules.rm_dir import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command('rm foo', stderr='rm: foo: is a directory'),
Command('rm foo', stderr='rm: foo: Is a directory'),
Command('hdfs dfs -rm foo', stderr='rm: `foo`: Is a director... | {
"content_hash": "3bed3a6ba3da52de7383b07f962a7730",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 30.322580645161292,
"alnum_prop": 0.65,
"repo_name": "subajat1/thefuck",
"id": "ae8c92f14537ee704ba2269f22552dd5223cc835",
"size": "940",
"binary":... |
from .pyjsparserdata import *
class Ecma51NotSupported(Exception):
def __init__(self, feature):
super(Ecma51NotSupported,
self).__init__("%s is not supported by ECMA 5.1." % feature)
self.feature = feature
def get_feature(self):
return self.feature
class BaseNode:
... | {
"content_hash": "96a18f3dc7087be97e0eaf569b0b02b5",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 78,
"avg_line_length": 28.045822102425877,
"alnum_prop": 0.6062469966362326,
"repo_name": "kimjinyong/i2nsf-framework",
"id": "e527583e93a98efa6ef0795739efbb178b333fd1",
"... |
"""
Creates hdf5 file with only the specified columns from the full dataset.
This is useful space saving measure as while the full dataset is quite large
only a few columns are of interest.
"""
import h5py
import numpy as np
def main():
columns = [
'#CMSSM_parameters @CMSSM::primary_parameters::A0',
... | {
"content_hash": "90d4755d94c5ddb2a43e4df0c1e18e31",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 78,
"avg_line_length": 36.857142857142854,
"alnum_prop": 0.5835486649440138,
"repo_name": "idark-project/idark-ml",
"id": "f21d9d61b9bb823df4b601a0a08161bd89bdc82b",
"size"... |
import unittest, sys
from lxml.tests.common_imports import doctest, make_doctest, HelperTestCase
from lxml import html
from lxml import cssselect
import os
doc_fn = os.path.join(os.path.dirname(__file__),
'css_shakespear.html')
try:
basestring = __builtins__['basestring']
except (NameError, ... | {
"content_hash": "490c2e7ced1f94c7901b9d3bc7b0d3fa",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 32.08955223880597,
"alnum_prop": 0.5132558139534884,
"repo_name": "rajendrakrp/GeoMicroFormat",
"id": "bdee34b4ef095d501a43f35726d69cfe2a9940d6",
"s... |
import os
if "WPROBOT_DIR" not in os.environ:
import sys
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), "..")))
import wprobot
| {
"content_hash": "8ec11f5d1f82632205903c90eb59d0ab",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 59,
"avg_line_length": 25.428571428571427,
"alnum_prop": 0.6123595505617978,
"repo_name": "nullzero/wprobot",
"id": "282132f8c874aed93909939d8ec951d75d329c33",
"size": "204"... |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Slb20130221DescribeLoadBalancerAttributeRequest(RestApi):
def __init__(self,domain='slb.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.loadBalancerId = None
def getapiname(self):
return 'slb.aliyuncs.com.Descr... | {
"content_hash": "32405c505e67b0c1cbe5a8946ac5c842",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 68,
"avg_line_length": 32.45454545454545,
"alnum_prop": 0.7647058823529411,
"repo_name": "francisar/rds_manager",
"id": "b2185679aeea43e924ad61e466dc397359796c84",
"size": ... |
"""Node classes for the AST for a Mojo IDL file."""
# Note: For convenience of testing, you probably want to define __eq__() methods
# for all node types; it's okay to be slightly lax (e.g., not compare filename
# and lineno). You may also define __repr__() to help with analyzing test
# failures, especially for more c... | {
"content_hash": "76164b123353ec045d88c3c6daee8797",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 80,
"avg_line_length": 33.935960591133004,
"alnum_prop": 0.6579329365655393,
"repo_name": "google-ar/WebARonARCore",
"id": "2c6b5fcdf85ba3dfae7e31fd01df1cf077617633",
"siz... |
"""
Tests for pika.heartbeat
"""
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
from pika import connection
from pika import frame
from pika import heartbeat
class HeartbeatTests(unittest.TestCase):
INTERVAL = 5
def setUp(self):
self.mock_conn = mock.Mock(... | {
"content_hash": "2415691856c4fb0be00583e9e365b411",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 81,
"avg_line_length": 38.279329608938546,
"alnum_prop": 0.6647694103911267,
"repo_name": "suthat/signal",
"id": "4448a9733e3e1f53e598d5d4b91ef233e25b2e5d",
"size": "6852"... |
"""Unittest for Cisco XR acl rendering module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from lib import ciscoxr
from lib import nacaddr
from lib import naming
from lib import policy
import m... | {
"content_hash": "fac69ffaabb8d2adb98a9b939bf5d471",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 74,
"avg_line_length": 27.048076923076923,
"alnum_prop": 0.6139353003910416,
"repo_name": "ryantierney513/capirca",
"id": "f75c0ebbd9b2441350c441bf53d3e767e7080762",
"size... |
from functools import wraps
from django.dispatch import Signal
class BetterSignal(Signal):
def connect(self, receiver=None, **kwargs):
"""
Support decorator syntax:
>>> @signal.connect(sender=type)
>>> def my_receiver(**kwargs):
>>> pass
"""
def wrappe... | {
"content_hash": "5b9354c61fa7096e3349e1d619acd98a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 91,
"avg_line_length": 27.541666666666668,
"alnum_prop": 0.6248108925869894,
"repo_name": "rdio/sentry",
"id": "05f4c65c5a39846774112a7fba779fdcab9b50a4",
"size": "661",
... |
import json
import re
import time
import urllib2
import urlparse
import monasca_agent.collector.checks as checks
EVENT_TYPE = SOURCE_TYPE_NAME = 'rabbitmq'
QUEUE_TYPE = 'queues'
EXCHANGE_TYPE = 'exchanges'
NODE_TYPE = 'nodes'
MAX_DETAILED_QUEUES = 150
MAX_DETAILED_EXCHANGES = 100
MAX_DETAILED_NODES = 50
ALERT_THRES... | {
"content_hash": "ee7de313d3e37a6f0aaa4e7ad29b00e9",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 619,
"avg_line_length": 45.27857142857143,
"alnum_prop": 0.5757217226691907,
"repo_name": "sapcc/monasca-agent",
"id": "aa7f4b32e8991166e7abbaf02f9dcd19de955d46",
"size": ... |
import copy
import hashlib
import multiprocessing
import os.path
import re
import signal
import subprocess
import sys
import gyp
import gyp.common
import gyp.msvs_emulation
import gyp.MSVSVersion
import gyp.xcode_emulation
from gyp.common import GetEnvironFallback
import gyp.ninja_syntax as ninja_syntax
generator_def... | {
"content_hash": "1e5b943002650c2b16db67bd6918525c",
"timestamp": "",
"source": "github",
"line_count": 1793,
"max_line_length": 80,
"avg_line_length": 41.21193530395984,
"alnum_prop": 0.6252554369155401,
"repo_name": "mkrautz/gyp-libmumble",
"id": "b26edd352173fdc760f239f1f384179263e7d2b0",
"size"... |
import tensorflow as tf
from tensorflow.contrib import rnn
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]="2"
class LossLayer():
def __init__(self, args, pred_start_logits, pred_end_logits, scope="loss"):
print("building loss layer", scope)
batch_size = args.batch_size
vocab_size = args.voca... | {
"content_hash": "1717562ed08b33402ea9ea205c7e0c18",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 198,
"avg_line_length": 61.38235294117647,
"alnum_prop": 0.633445136559655,
"repo_name": "ashtonteng/squad_exp",
"id": "737e0cba266a47c2abd2e79b8cbc491e998498b7",
"size": "... |
from django import forms
from ckeditor.fields import RichTextFormField
class CkEditorForm(forms.Form):
content = RichTextFormField()
| {
"content_hash": "c5c7224609a4d9d1b7eb54c2c0731f04",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 45,
"avg_line_length": 20,
"alnum_prop": 0.8,
"repo_name": "riklaunim/django-ckeditor",
"id": "8b8dbc659a9f5aea2849922cab8a74e814b0fd86",
"size": "140",
"binary": false,
... |
import play
import behavior
import tactics.line_up
import robocup
import constants
class LineUp(play.Play):
def __init__(self):
super().__init__(continuous=False)
self.add_transition(behavior.Behavior.State.start,
behavior.Behavior.State.running, lambda: True,
... | {
"content_hash": "b34b521f93039502bbdfd472be40f6c4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 100,
"avg_line_length": 41.03333333333333,
"alnum_prop": 0.6238830219333875,
"repo_name": "JNeiger/robocup-software",
"id": "f2ecebe40b0a7261439bd080775cf9531899333d",
"siz... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('signage', '0020_auto_20210121_0943'),
]
operations = [
migrations.AlterField(
model_name='signage',
name='type',
field=m... | {
"content_hash": "2076ef95d49901581aa8f1e0ee6b0f78",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 153,
"avg_line_length": 27.764705882352942,
"alnum_prop": 0.635593220338983,
"repo_name": "makinacorpus/Geotrek",
"id": "f8f69a154b0a37533d12895437902799f1d098f8",
"size": ... |
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
class LandedCost(Model):
_name = "landed.cost"
_name_field = "number"
_string = "Landed Costs"
_audit_log = True
_multi_company=True
_fields = {
"number": fields.Char("Number"... | {
"content_hash": "a95033486dce85631fd82da015eff644",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 174,
"avg_line_length": 39.85953177257525,
"alnum_prop": 0.5150192985400235,
"repo_name": "anastue/netforce",
"id": "b2bb54c534990d6d9fb0373dd40bd79a9ad4d369",
"size": "13... |
"""Common constants, exceptions and helpe functions
"""
import sys
import xml.parsers.expat
PY3 = sys.version_info[0] == 3
# Fail early when pyexpat is not installed correctly
if not hasattr(xml.parsers.expat, "ParserCreate"):
raise ImportError("pyexpat") # pragma: no cover
class DefusedXmlException(ValueError... | {
"content_hash": "559adb8820d3c07fcbb9a9001c1bb266",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 97,
"avg_line_length": 29.992248062015506,
"alnum_prop": 0.6128198500904627,
"repo_name": "it-robotics/cros",
"id": "7e4bb0bd62bba1b3f7947decb4766244bc51cfb4",
"size": "40... |
from parsl.config import Config
from parsl.channels import LocalChannel
from parsl.providers import SlurmProvider
from parsl.executors import HighThroughputExecutor
from parsl.addresses import address_by_hostname
from parsl.data_provider.scheme import GlobusScheme
# This is an example config, make sure to
# r... | {
"content_hash": "f42e8b632d829f6cf3148427d0a66427",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 75,
"avg_line_length": 32.15,
"alnum_prop": 0.5777604976671851,
"repo_name": "swift-lang/swift-e-lab",
"id": "56d74dc025cf5d4f0ed7e69f3b1048250006066b",
"size": "1286",
"... |
"""
user template tags
========================
Tags for including plugin javascript assets into a template.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django import template
from .. import hooks
register = template.Library()
@regis... | {
"content_hash": "7716dee6fbd1757fd75fe931ba7ccb3b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 90,
"avg_line_length": 25.75,
"alnum_prop": 0.7087378640776699,
"repo_name": "mrpau/kolibri",
"id": "8616946a19117407c43922b6e037f02e7b1ad484",
"size": "633",
"binary": f... |
POSTING_DICT_NAME = "postingDict.index"
POSTING_LISTS_NAME = "postingLists.index"
REPLYTO_DICT_NAME = "replyToDict.index"
REPLYTO_LISTS_NAME = "replyToLists.index"
DOCUMENT_MAP_NAME = "documentMap.index"
DOCUMENT_MAP_DICT_NAME = "documentMapDict.index"
PARTIAL_THRESHOLD = 10000000
SKIP_SIZE = 10000
DOCUMENT_MAP_TMP_DIR... | {
"content_hash": "869a072f1850fdd2634b923e83d54c33",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 48,
"avg_line_length": 39.4,
"alnum_prop": 0.7791878172588832,
"repo_name": "CodeLionX/CommentSearchEngine",
"id": "8779828405b90fb96af97bcdd6839014cc1ebf2f",
"size": "394"... |
"""An example of using Dakota as a component with PyMT.
This example requires a WMT executor with PyMT installed, as well as
the CSDMS Dakota interface and FrostNumberModel installed as
components.
"""
import os
from pymt.components import MultidimParameterStudy, FrostNumberModel
from dakotathon.utils import configur... | {
"content_hash": "e2491c1d37fa31d48b1f1221e9632379",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 68,
"avg_line_length": 28.162790697674417,
"alnum_prop": 0.6952931461601982,
"repo_name": "csdms/dakota",
"id": "23faddb427ccf2b4a51011515cdd3a2b5edefbe2",
"size": "1211",
... |
import errno
import os
import string
import sys
from utils import helpFunctions
###################################################################
### Before running this, make sure all files are in lowecase!! ###
# to do this in Linux: run `find . -depth -print -execdir rename -f 'y/A-Z/a-z/' '{}' \;` in the TIMI... | {
"content_hash": "30eff8647a0f0df1ef3c7e44bf047dc5",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 150,
"avg_line_length": 43.07462686567164,
"alnum_prop": 0.6323631323631324,
"repo_name": "matthijsvk/multimodalSR",
"id": "c80c960647218b4d8179cc6e5d0a66f310f6a06f",
"siz... |
import logging
import json
import six
from .response import Response
from .exceptions import InvalidUsage
logger = logging.getLogger("pysnow")
class SnowRequest(object):
"""Creates a new :class:`SnowRequest` object.
:param parameters: :class:`params_builder.ParamsBuilder` object
:param session: :class:... | {
"content_hash": "e5c852874dd0acf75e80754eee5eb8b0",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 118,
"avg_line_length": 32.84905660377358,
"alnum_prop": 0.594868849320314,
"repo_name": "rbw0/pysnow",
"id": "96f4a56b99cf1412b24d9ac1ce7fb814d04b1317",
"size": "5248",
... |
from django.test import TestCase
class CollectionTest(TestCase):
def test_index(self):
r = self.client.get('/')
self.assertEqual(r.status_code, 200)
def test_no_logic_page(self):
r = self.client.get('/about/')
self.assertEqual(r.status_code, 200)
| {
"content_hash": "10ae48b576f75a9e9256a7d77af8bbd4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 44,
"avg_line_length": 26.363636363636363,
"alnum_prop": 0.6344827586206897,
"repo_name": "hellowebapp/hellowebapp-code",
"id": "76f087d75adcd07c4e731c3ee147858c6609f478",
... |
import socket
import select
import sys
from .util import flatten_parameters_to_bytestring
""" @author: Aron Nieminen, Mojang AB"""
class RequestError(Exception):
pass
class Connection:
"""Connection to a Minecraft Pi game"""
RequestFailed = "Fail"
def __init__(self, address, port, debug=False):
... | {
"content_hash": "2de08acdd8aa5eb6906c393c3532bd58",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 84,
"avg_line_length": 30.285714285714285,
"alnum_prop": 0.5660377358490566,
"repo_name": "wensheng/JuicyRaspberryPie",
"id": "020260007208f2e35b19d04bf2af978fc9abd5d1",
"s... |
import sys
import os
import select
import socket
import errno
import logging
try:
BrokenPipeError
except NameError:
BrokenPipeError = None
def ignore_broken_pipe(fn, *args):
try:
return fn(*args)
except OSError as e:
if e.errno == errno.EPIPE:
return None
raise
... | {
"content_hash": "a59b363116f4d6fcaed4a357ce27606f",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 100,
"avg_line_length": 26.974137931034484,
"alnum_prop": 0.5832534356024289,
"repo_name": "lincheney/ssh-forward-proxy",
"id": "14b0863869273191f9f9cf1ce9ce7560c02624f5",
... |
from flask import session
from indico.core import signals
from indico.core.logger import Logger
from indico.modules.events.static.models.static import StaticSite
from indico.util.i18n import _
from indico.web.flask.util import url_for
from indico.web.menu import SideMenuItem
logger = Logger.get('events.static')
@s... | {
"content_hash": "ba3e94a59537c127bc1dec44e04d1dd1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 108,
"avg_line_length": 33.82608695652174,
"alnum_prop": 0.7609254498714653,
"repo_name": "indico/indico",
"id": "f3f3d2c7847b68f053e2f776b0f101c1d5f234c6",
"size": "992",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.