text stringlengths 4 1.02M | meta dict |
|---|---|
'''
CRUD for the category.
'''
import json
import tornado.web
import config
from torcms.core import tools
from torcms.core.base_handler import BaseHandler
from torcms.model.category_model import MCategory
from torcms.model.post2catalog_model import MPost2Catalog
from torcms.model.post_model import MPost
class Cate... | {
"content_hash": "9804a4908cc96de0a5262d84a173ea91",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 76,
"avg_line_length": 24.741496598639454,
"alnum_prop": 0.4855650261204289,
"repo_name": "bukun/TorCMS",
"id": "b9928013aab3079adb9146da83b75b9af578c7a9",
"size": "3678",... |
from typing import NamedTuple, List
from src.independent.util import chcast
from src.independent.SExpr import SExpr, sexpr_subst_mult_string, SExprOrStr
class L4Macro(NamedTuple):
macroparams: List[str]
macrobody: SExpr
def subst(self, paramvals:List[SExprOrStr]) -> SExpr:
return chcast(SExpr, s... | {
"content_hash": "0ec4c66863c2857e10836c80b1ffde6e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 113,
"avg_line_length": 34.421052631578945,
"alnum_prop": 0.7400611620795107,
"repo_name": "legalese/legalese-compiler",
"id": "53ec5e7d8e5923c28d5c8bbfaf491fbdffbdaa9d",
"... |
import json
def essentials_of(solution):
result = {}
for key in ['problemId', 'score', 'solution', 'seed']:
result[key] = solution[key]
return result
with open("scores.json") as f:
best = {}
for solution in json.loads(f.readline()):
problem_id = solution['problemId']
if pr... | {
"content_hash": "c9517e67d073fd6086ebfee95be97538",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 61,
"avg_line_length": 27.91304347826087,
"alnum_prop": 0.5872274143302181,
"repo_name": "codingteam/icfpc-2015",
"id": "01ce17839b59fa2b7389b1b39862980158eb67eb",
"size": ... |
def setup():
# module-level
pass
def setup_cache():
# module-level
pass
def track_test():
# module-level 難
return 0
class MyClass:
def setup(self):
# class-level
pass
def setup_cache(self):
# class-level
pass
def track_test(self):
# class-... | {
"content_hash": "e931a3835b20e33e4192bb966a896076",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 26,
"avg_line_length": 14.375,
"alnum_prop": 0.5362318840579711,
"repo_name": "pv/asv",
"id": "faed25d8fe1c15a69038c1456467489aa9181ee1",
"size": "374",
"binary": false,
... |
import urllib
import json
import os
import requests
import datetime
import twilio.twiml
from flask import Flask
from flask import jsonify
from flask import url_for
from flask import request
from flask import make_response
from twilio.rest import TwilioRestClient
# Flask app should start in global layout
app = Flask(__... | {
"content_hash": "07ae659a993c667c9ea5cd72d7576d6a",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 154,
"avg_line_length": 40.35294117647059,
"alnum_prop": 0.6422740524781341,
"repo_name": "vijayraghu/python.github.io",
"id": "cc8222817e7b4549559a730b20da7ece3c30582d",
... |
import keras_tuner
from autokeras.engine import tuner as tuner_module
class RandomSearch(keras_tuner.RandomSearch, tuner_module.AutoTuner):
"""KerasTuner RandomSearch with preprocessing layer tuning."""
pass
| {
"content_hash": "1bc3ae977d849a65f0f124dd7fde9583",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 69,
"avg_line_length": 24.444444444444443,
"alnum_prop": 0.7818181818181819,
"repo_name": "keras-team/autokeras",
"id": "3017799244959f30fd9eb93d66f893152b128a08",
"size": "... |
from datetime import datetime
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.util import display_for_field, label_for_field, lookup_field
from django.contrib.admin.util import NestedObjects
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
from django.contr... | {
"content_hash": "ec20803235b2fd3917e56d9ee0b60fb6",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 105,
"avg_line_length": 31.57563025210084,
"alnum_prop": 0.5773785761809714,
"repo_name": "faun/django_test",
"id": "518a16d1513d580b47b31acf09c116962b127e82",
"size": "75... |
import paddle.v2 as paddle
import data_provider
import vgg_ssd_net
import os, sys
import gzip
from config.pascal_voc_conf import cfg
def eval(eval_file_list, batch_size, data_args, model_path):
cost, detect_out = vgg_ssd_net.net_conf(mode='eval')
assert os.path.isfile(model_path), 'Invalid model.'
parame... | {
"content_hash": "acb272c11c486ae36ee8f90ae4d583b5",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 28.083333333333332,
"alnum_prop": 0.6379821958456974,
"repo_name": "xinghai-sun/models",
"id": "345e46f98b098480877a54dac842bd576112b1a3",
"size": "1... |
import codecs
from html.entities import codepoint2name
from html.entities import name2codepoint
import re
from urllib.parse import quote_plus
import markupsafe
html_escape = markupsafe.escape
xml_escapes = {
"&": "&",
">": ">",
"<": "<",
'"': """, # also " in html-only
"'": "&... | {
"content_hash": "0cbeb8e96dcd0d9eb8a6b94389dd5cf5",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 77,
"avg_line_length": 28.455128205128204,
"alnum_prop": 0.5845911241270556,
"repo_name": "chromium/chromium",
"id": "af202f3f5294605bf4ed0efc9726832f834bbf26",
"size": "4... |
'''
Copyright (C) 2022, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'Beluga CDN (Beluga)'
def is_waf(self):
schemes = [
self.matchHeader(('Server', r'Beluga')),
self.matchCookie(r'^beluga_request_trail=')
]
if any(i for i in schemes):
return True
... | {
"content_hash": "849f9cc1e150ab45fae452555df60774",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 20.875,
"alnum_prop": 0.6227544910179641,
"repo_name": "EnableSecurity/wafw00f",
"id": "5da92287a93e0af989262400cfeaee7550c2f78b",
"size": "356",
"... |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | {
"content_hash": "dd9147a4983677bea863933b921a112e",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 99,
"avg_line_length": 34.37593984962406,
"alnum_prop": 0.664588801399825,
"repo_name": "airbnb/streamalert",
"id": "500198abf8ed64f574481c1dd52178f99f9a4214",
"size": "91... |
import argparse
import sys
import time
from rclpy.executors import ExternalShutdownException
from test_msgs.action import Fibonacci
from test_msgs.action import NestedMessage
class ExpectedGoal:
def is_goal_expected(self, goal):
raise NotImplementedError('is_goal_expected() is not implemented')
de... | {
"content_hash": "3e34853b669deda759bf3bf2f3248f98",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 92,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.6269194312796208,
"repo_name": "ros2/system_tests",
"id": "4fa0e1415f21fbacf935f7d81ceca365d6c6b7b5",
"size": "5... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "403900a2d1789683c5e3ac1834d00854",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 80,
"avg_line_length": 31.847161572052403,
"alnum_prop": 0.7002605237899355,
"repo_name": "karolmajta/boreas",
"id": "bbfb38d86864dc4309b175b7e2e90f95e70941d9",
"size": "7... |
import smbus
# ===========================================================================
# Adafruit_I2C Class
# ===========================================================================
class Adafruit_I2C :
@staticmethod
def getPiRevision():
"Gets the version number of the Raspberry Pi board"
# Court... | {
"content_hash": "c8c9373c620cda484b10d8efa9ce8530",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 77,
"avg_line_length": 32.145833333333336,
"alnum_prop": 0.603802117087924,
"repo_name": "Tyler-Ward/GolemClock",
"id": "77f3795f05b45235ecf05cfcca6ae6d0581ca19b",
"size":... |
import sys
from struct import unpack_from as old_unpack_from
from struct import unpack_from as old_unpack
from struct import calcsize
from collections import OrderedDict
# From: http://code.activestate.com/recipes/577197-sortedcollection/
from SortedCollection import SortedCollection
MEGABYTE = 1024 * 1024
class L... | {
"content_hash": "aeb50ac44f647a57b083f34c4685d696",
"timestamp": "",
"source": "github",
"line_count": 465,
"max_line_length": 86,
"avg_line_length": 27.920430107526883,
"alnum_prop": 0.540321959485481,
"repo_name": "ohio813/INDXParse",
"id": "d95cd5f74562e07585c346ec5eac5c2dddcaaad5",
"size": "13... |
''' pidhandler.py '''
import json
import tornado.web
from heron.shell.src.python import utils
class PidHandler(tornado.web.RequestHandler):
"""
Responsible for getting the process ID for an instance.
"""
# pylint: disable=attribute-defined-outside-init
@tornado.web.asynchronous
def get(self, instance_id)... | {
"content_hash": "bf874b20077fa06974b1ad8723909496",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 57,
"avg_line_length": 26.181818181818183,
"alnum_prop": 0.6267361111111112,
"repo_name": "nlu90/heron",
"id": "da1c5c3e169901b66fd619e9930e1f56e41f891d",
"size": "1426",
... |
"""
Copyright 2015 Brocade Communications Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | {
"content_hash": "0a8c3b5d488fcc774e4658ffae34ad33",
"timestamp": "",
"source": "github",
"line_count": 762,
"max_line_length": 79,
"avg_line_length": 53.0485564304462,
"alnum_prop": 0.4929124508324469,
"repo_name": "SivagnanamCiena/pynos",
"id": "fd8b8a5bdcaa031635d463562c5c0c0990c3fbf3",
"size": ... |
from werkzeug.exceptions import HTTPException
from werkzeug.routing import Map, Rule
from spa.wrappers import Request
class App(object):
def __init__(self, urls, settings=None, request_class=None):
self.urls = urls
self.settings = settings
self.map, self.handlers = build_rules(urls)
... | {
"content_hash": "61e992923e85bed72c1bc87872e15c03",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 30.18,
"alnum_prop": 0.6189529489728297,
"repo_name": "btubbs/spa",
"id": "cdf425594b0e91acf6b0c34aaa5be6482f47c1e7",
"size": "1509",
"binary": fal... |
"""mpeg.py - play MPEG movies in the Vision Egg
This demo uses pygame.movie to draw movies. See also the quicktime.py
demo."""
import os
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation, FunctionController, T... | {
"content_hash": "fd149cef1c50a3a5780f40696f301d77",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 92,
"avg_line_length": 33.43636363636364,
"alnum_prop": 0.6008700380641653,
"repo_name": "chrox/RealTimeElectrophy",
"id": "44404cab2ce044cc42e9d95f850f69ce18ee4f5b",
"siz... |
import json
import os
import sys
import signal
from lambda_toolkit.modules.utils import Utils
from lambda_toolkit.modules.lambdacontext import LambdaContext
def signal_handler(signal, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
class Receiver:
def __init__(self, conf, kwargs):
s... | {
"content_hash": "6de32c655300c83892b8b5f370c55de5",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 124,
"avg_line_length": 42.2,
"alnum_prop": 0.534529451591063,
"repo_name": "lucioveloso/lambda-toolkit",
"id": "c3d20740113e1a0547fab0254c7496656b347c4b",
"size": "2977",
... |
from greenlet import greenlet
#=========================================================================
# InQueuePortProxy
#=========================================================================
class InQueuePortProxy (object):
#-----------------------------------------------------------------------
# Constr... | {
"content_hash": "65c59258ded9804ece8160261f0427ce",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 74,
"avg_line_length": 25.8,
"alnum_prop": 0.3209302325581395,
"repo_name": "tj93/pymtl",
"id": "af5536398f8c92b8d33701742b5d4586960420e5",
"size": "3091",
"binary": fal... |
import serial
ser = serial.Serial('/dev/ttyUSB0') # Open serial port
# Write a string
ser.write("Hello World!".encode())
# Read a eight bytes (changable)
msg = ser.read(8)
| {
"content_hash": "1a1e16b84a390882138cccc23c1f5e10",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 19.444444444444443,
"alnum_prop": 0.6971428571428572,
"repo_name": "FlatTargetInk/ECE562-Software",
"id": "36e3f372aafa6a4332404db363027ceff874a5b9",
... |
import random
from templates.text import TextTemplate
def process(input):
gn = [
'Night, dude!',
'Good night, dude! Sleep tight! :P'
]
output = {
'input': input,
'output': TextTemplate(random.choice(gn)).get_message(),
'success': True
}
return output
| {
"content_hash": "4c9029408ace814847de9eb8395c9d1f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 64,
"avg_line_length": 20.866666666666667,
"alnum_prop": 0.5686900958466453,
"repo_name": "manparvesh/BotDude",
"id": "255c6b165b0c8ef9157fc041b37e13b888452a70",
"size": "3... |
'''
The MIT License (MIT)
Copyright (c) 2016 Sean UN Wood
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge,... | {
"content_hash": "3a8c4e897983f6a70f428f8f02e934d6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 44.36,
"alnum_prop": 0.7953110910730388,
"repo_name": "seanwood/gcc-nmf",
"id": "90b78d9454ff792af01fa9da6ce741f3d0a260ff",
"size": "1109",
"binary... |
"""
Copyright 2010 Sami Dalouche
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | {
"content_hash": "4484550c021c160db89dd8bd2bcd13e7",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 104,
"avg_line_length": 33.10989010989011,
"alnum_prop": 0.6637902422834384,
"repo_name": "pymager/pymager",
"id": "a629b21c6cefee9fa04b2ff49d8dba929d92ad8d",
"size": "3013... |
from core.himesis import Himesis
import uuid
class HAttribute(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule Attribute.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HAttribute, ... | {
"content_hash": "e66b8d563e2d2a7b027fa7dfe1b0c861",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 82,
"avg_line_length": 27.71794871794872,
"alnum_prop": 0.46762257169287696,
"repo_name": "levilucio/SyVOLT",
"id": "65500c0cc6328f5379d1663322ea31123e67a364",
"size": "216... |
import datetime
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
from django.utils import timezone
from django.utils.functional import cached_property
from django.utils.translation import gettext as _
from django.views... | {
"content_hash": "13fcc66803aadcc0156cbfa727672c29",
"timestamp": "",
"source": "github",
"line_count": 720,
"max_line_length": 103,
"avg_line_length": 35.016666666666666,
"alnum_prop": 0.5940028557829605,
"repo_name": "treyhunner/django",
"id": "3da05cf8e5bb879a66f5b4cba40e774f6331e0fd",
"size": "... |
"""Tests for common layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports
import numpy as np
from tensor2tensor.layers import common_layers
import tensorflow as tf
class CommonLayersTest(tf.test.TestCase):
def testSaturating... | {
"content_hash": "cdedfd35fefaa7d8c1fd872b5ef3dadb",
"timestamp": "",
"source": "github",
"line_count": 611,
"max_line_length": 80,
"avg_line_length": 37.734860883797054,
"alnum_prop": 0.6215735600277585,
"repo_name": "rsepassi/tensor2tensor",
"id": "2bf6b4cee4ec6e7b9bd20d06ea1b206e3da90de3",
"size... |
from setuptools import setup
exec(open('chemblnet/version.py').read())
setup(name='chemblnet',
version=__version__,
description='Neural Networks for ChEMBL',
url='http://github.com/jaak-s/chemblnet',
author='Jaak Simm',
author_email='jaak.simm@gmail.com',
license='MIT',
packa... | {
"content_hash": "6ed21726948a3abffec878f1945bc298",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 47,
"avg_line_length": 25.857142857142858,
"alnum_prop": 0.638121546961326,
"repo_name": "jaak-s/chemblnet",
"id": "616f961ef4f463602a26c333979d8e52320dad04",
"size": "362"... |
"""Contains the InputSpec class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import zip # pylint: disable=redefined-builtin
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import tensor_shape
from tenso... | {
"content_hash": "91c60b81fc9e3890438d7529e6f09cf6",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 80,
"avg_line_length": 39.25735294117647,
"alnum_prop": 0.6062933133545608,
"repo_name": "cxxgtxy/tensorflow",
"id": "52a2829ffdb85919dd739303a90a19026c8b850a",
"size": "1... |
from base64 import b64encode
import gzip
import sys
import urllib
try:
import urllib2
except ImportError:
import urllib.request as urllib2
import hmac
import os
import time
import socket
import logging
from hashlib import sha256
try:
from cStringIO import StringIO
except ImportError:
try:
from... | {
"content_hash": "e7acd609501b9993677983c765f7962c",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 79,
"avg_line_length": 38.422360248447205,
"alnum_prop": 0.5590042030391206,
"repo_name": "AkihikoITOH/capybara",
"id": "60224a4fdfb29668da2f0207dc2303b904c0b589",
"size":... |
if __name__ == '__main__':
from qtmpl import main
raise SystemExit(main())
from matplotlib import use
#force matplotlib to use wx with the use('wx') call before importing pyplot
use('wx')
from matplotlib import pyplot
from matplotlib.backends import backend_wx
from twisted.internet import wxreactor
#force Tw... | {
"content_hash": "35aee27702070683a1de73ccf883307f",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 87,
"avg_line_length": 24.806451612903224,
"alnum_prop": 0.6276549631556133,
"repo_name": "opikalo/pyfire",
"id": "3987c95024fc6d8eee9100bf5dc5cd637e65e125",
"size": "2436"... |
AUTO_SCROLL_TO_ERROR = "auto_scroll_to_error"
XML_CATALOG_FILES = "xml_catalog_files"
| {
"content_hash": "5e367fd25a56453af3924a5193a4b5cf",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 45,
"avg_line_length": 43,
"alnum_prop": 0.7441860465116279,
"repo_name": "eerohele/exalt",
"id": "ce3f1084bde85c31aba512d67ea9d52307333d92",
"size": "86",
"binary": false... |
'''
Perform Granger based causality analysis using Generalized Parital Directed
Coherence on example dataset.
Uses the data and example from mne-python combined with the Scot package
to perform the Granger Causality analysis.
Author: Praveen Sripad <pravsripad@gmail.com>
'''
import numpy as np
from scipy import stat... | {
"content_hash": "53db733896b899742dee0fcd0a01b338",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 80,
"avg_line_length": 37.70469798657718,
"alnum_prop": 0.6571733713065148,
"repo_name": "pravsripad/jumeg",
"id": "c2c1b6e37beab82cdc7f906fd940525d074d88b6",
"size": "564... |
from django.apps import AppConfig
class DynamicSettingConfig(AppConfig):
name = 'dynamic_setting'
verbose_name = 'Setting' | {
"content_hash": "ad57133ceacd539496d9c1f5fdc321a0",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 26.2,
"alnum_prop": 0.7557251908396947,
"repo_name": "koralarts/django-dynamic-settings",
"id": "1148b9a15c35728e13b6b36728805fd0d5637ec1",
"size": "1... |
"""
Raw time-series data from BES detectors.
BES detectors generate differential signals such that "zero signal" or
"no light" corresponds to about -9.5 V. DC signal levels should be referenced
to the "zero signal" output. "No light" shots (due to failed shutters)
include 138545 and 138858.
BES detector channels **... | {
"content_hash": "2fab8a853e1c87b60c18a0f7a7df6b7b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 39.60526315789474,
"alnum_prop": 0.7142857142857143,
"repo_name": "drsmith48/fdp",
"id": "55d6451227dfce402a2a33bffc9b228b1279a832",
"size": "1529",
... |
"""Tests for server initialization and loop logic."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
import pytest
from cwmud.core.server import EVENTS, SERVER
# We need a dummy p... | {
"content_hash": "e70568d1d4c8c11a0f1db9e473f516d8",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 73,
"avg_line_length": 21.725490196078432,
"alnum_prop": 0.6308664259927798,
"repo_name": "whutch/atria",
"id": "e3d4f731b53635e41c040af8a3fd4b80b5cbe615",
"size": "1132",
... |
import sys
try:
from collections import OrderedDict
except ImportError:
# python 2.6 or earlier, use backport
from ordereddict import OrderedDict
# Useful for very coarse version differentiation.
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
PYPY = hasattr(sys, 'pypy_translation_info')
_ide... | {
"content_hash": "1697d2eede0ac8fc43b50b9dff065aba",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 28.66176470588235,
"alnum_prop": 0.6285274499743458,
"repo_name": "moonrabbit/flask-jsonrpc",
"id": "8fe4ab029b9b189cf1bf4996891286b113078bed",
"siz... |
import hashlib
import os
import posixpath
from dmunit import DeviceManagerTestCase
class Cat2TestCase(DeviceManagerTestCase):
def runTest(self):
"""This tests copying a binary file to and from the device the binary.
File is > 64K.
"""
testroot = posixpath.join(self.dm.getDevic... | {
"content_hash": "f039dd036a234ba791c0ea4c39fa48ca",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 37.130434782608695,
"alnum_prop": 0.6194379391100703,
"repo_name": "sergecodd/FireFox-OS",
"id": "59681268971b9f3006b0b56b0866cf9b3c49822c",
"size": ... |
"""
Miscellaneous functions that don't fit anywhere else.
"""
from __future__ import division
import os
import sys
import re
import math
import imp
import string
import threading
import signal
import pkgutil
import traceback
import logging
import random
import hashlib
import subprocess
from subprocess import CalledPro... | {
"content_hash": "1b4e2fbf37603d1de45eca55ef43c6d9",
"timestamp": "",
"source": "github",
"line_count": 847,
"max_line_length": 124,
"avg_line_length": 33.91263282172373,
"alnum_prop": 0.5996727475281994,
"repo_name": "bjackman/workload-automation",
"id": "a66e985beb6f573554290459d7516c521baa5dc5",
... |
from setuptools import setup
setup(
name='learning-nodejs',
version='0.1.0',
)
| {
"content_hash": "5ae0f837e7e2b7e48741fa5e3957b1a9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 28,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.6590909090909091,
"repo_name": "imsardine/learning",
"id": "d39d4cdc4963630aced40063641c1d4679fb53d8",
"size": "88... |
"""Add password reset expiry
Revision ID: 217af36c820
Revises: f9897e968a
Create Date: 2014-06-28 11:04:23.134422
"""
# revision identifiers, used by Alembic.
revision = '217af36c820'
down_revision = 'f9897e968a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alem... | {
"content_hash": "b72cc0777ef4ec9b166229fdcde68d9e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 89,
"avg_line_length": 24.384615384615383,
"alnum_prop": 0.6987381703470031,
"repo_name": "Kerbas-ad-astra/KerbalStuff",
"id": "0a702c8a9d7b77b9870d70ae47f0f16ea5505143",
"... |
"""Views for when a user first visits."""
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic import TemplateView
from open_connect.connect_core.utils.views import CommonViewMixin
class WelcomeView(CommonViewMixin, TemplateView):
"""WelcomeView red... | {
"content_hash": "8144b88dd9be25d006eb76377d8c2992",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 69,
"avg_line_length": 37.04545454545455,
"alnum_prop": 0.6883435582822086,
"repo_name": "lpatmo/actionify_the_news",
"id": "3759e14ff745c0e2796ce50e0fd59b6c88780ff3",
"siz... |
import json
from datetime import date, datetime
class CJsonEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime):
return obj.strftime('%Y-%m-%d %H:%M:%S')
elif isinstance(obj, date):
return obj.strftime('%Y-%m-%d')
else:
return j... | {
"content_hash": "9111e3120b5712e7cb6e8be788670a68",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 54,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.6258205689277899,
"repo_name": "Z2Y/CUIT-ACM-Website",
"id": "41fb6b131cfb499127e0ed2993a8ddb920a2ec5d",
"size": ... |
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _
from localflavor.deprecation import DeprecatedPhoneNumberField
from .forms import USPhoneNumberField as USPhoneNumberFormField
from .forms import USSocialSecurityNumberField as USSocialSecurityNumberFieldFormField
from .for... | {
"content_hash": "ff9a86db62ce548ef5149e00e69b58c4",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 107,
"avg_line_length": 31.859504132231404,
"alnum_prop": 0.6658884565499351,
"repo_name": "jieter/django-localflavor",
"id": "67d12c2b47fe99c1094a9979a97b1f560681e066",
"... |
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this data, including any software or models in source or binary
# form, as well as any drawings, specifications, and documentation
# (collectively "the Data"), to deal in the Data without restriction,
# including without limitatio... | {
"content_hash": "af2da780d9069f14c6480b2edcab23bb",
"timestamp": "",
"source": "github",
"line_count": 2054,
"max_line_length": 263,
"avg_line_length": 52.34664070107108,
"alnum_prop": 0.7158110119047619,
"repo_name": "pombredanne/metamorphosys-desktop",
"id": "271401ac0cfe09b7f6bbb15851745c85f5b522... |
options = dict(
verbose=True,
model_extensions=[
'h2o.model.extensions.ScoringHistoryTrees',
'h2o.model.extensions.VariableImportance',
'h2o.model.extensions.Trees',
],
)
deprecated_params = dict(offset_column=None)
doc = dict(
__class__="""
Builds a Distributed Random Forest (D... | {
"content_hash": "59b5b395577629129db99fdb98ce7279",
"timestamp": "",
"source": "github",
"line_count": 766,
"max_line_length": 149,
"avg_line_length": 46.265013054830284,
"alnum_prop": 0.5736335675385874,
"repo_name": "michalkurka/h2o-3",
"id": "34799dd1b039c0e4c9a16575cfb49e0e2cb0f332",
"size": "... |
__author__ = "Vasyl Khomenko"
__copyright__ = "Copyright 2013, Qubell.com"
__license__ = "Apache"
__version__ = "1.0.1"
__email__ = "vkhomenko@qubell.com"
import os
from qubell.api.testing import *
def manifest(name):
return os.path.realpath(os.path.join(os.path.dirname(__file__), name))
@environment({
'd... | {
"content_hash": "1a65c116ae48d5e4f274ada4d933d042",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 96,
"avg_line_length": 38.60377358490566,
"alnum_prop": 0.5899315738025416,
"repo_name": "vasichkin/contrib-python-qubell-client",
"id": "e54e55ab8d5470cdaea5e76a476a0a00ca6c... |
"""Fake LDAP server for test harness.
This class does very little error checking, and knows nothing about ldap
class definitions. It implements the minimum emulation of the python ldap
library to work with nova.
"""
import fnmatch
from nova.openstack.common.gettextutils import _
from nova.openstack.common import j... | {
"content_hash": "5944466bc759b73f5d152ae3353856d2",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 77,
"avg_line_length": 27.85031847133758,
"alnum_prop": 0.5726700971983991,
"repo_name": "cloudbau/nova",
"id": "ddaef8a5f8878ef61dd9ab269e66c53bfcb81bda",
"size": "9521",... |
import sys
import _parjtag
VERSION = "1.3"
DEBUG = 0 #disable debug messages by default
#frame specific consts
ERASE_MASS = 2
ERASE_MAIN = 1
ERASE_SGMT = 0
#states
FREERUNNING = 0
STOPPED = 1
#Configurations of the MSP430 driver
VERIFICATION_MODE = 0 #Verify data downloaded to FL... | {
"content_hash": "c2b2663e71dd03a13dfd3d133d23f771",
"timestamp": "",
"source": "github",
"line_count": 596,
"max_line_length": 120,
"avg_line_length": 39.48993288590604,
"alnum_prop": 0.5212440516655337,
"repo_name": "jcook/crazyIoT",
"id": "0cb556a91ded9a253ef1960f26ba0ad2af0a24b0",
"size": "2379... |
import re
import sys
import unittest
import metricbeat
import getpass
import os
SYSTEM_CPU_FIELDS = ["idle.pct", "iowait.pct", "irq.pct", "nice.pct",
"softirq.pct", "steal.pct", "system.pct", "user.pct"]
SYSTEM_CPU_FIELDS_ALL = ["idle.pct", "idle.ticks", "iowait.pct", "iowait.ticks", "irq.pct", "... | {
"content_hash": "138de1688f7cab9d189af7834df0ec90",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 136,
"avg_line_length": 35.974160206718345,
"alnum_prop": 0.564574055451803,
"repo_name": "phenomenes/varnishbeat",
"id": "ce1c29b3ed9b4788eae6615d1966910eded905db",
"size... |
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""
| {
"content_hash": "3fccbb8f29b0d7cc00bc3546dfd8377a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 79,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.7272727272727273,
"repo_name": "dreamhost/akanda-horizon",
"id": "dfb074ed6022b367452fc45c2569b80ff1c8be7a",
"size... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0026_xforminstancesql_initial_processing_complete'),
('form_processor', '0027_allow_null_form_uuid_in_case_transaction'),
]
operations = [... | {
"content_hash": "e17e12ed7d4ea4eb5090a9ce8b7a7355",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 80,
"avg_line_length": 23.357142857142858,
"alnum_prop": 0.6819571865443425,
"repo_name": "qedsoftware/commcare-hq",
"id": "538e0a9b18ed56a42c9349668f525f5ca4a2c213",
"size... |
"""Install boost headers into a list of toolchains, in such a way that it gets
pulled into the SDK installer. Note that this script only installs boost
headers, and does not build any of the boost libraries that require building.
"""
import build_utils
import os
import shutil
import sys
import tarfile
import tempfile... | {
"content_hash": "cc931ed76e0f489668995b1ebb75e225",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 78,
"avg_line_length": 32.98076923076923,
"alnum_prop": 0.6807580174927114,
"repo_name": "aYukiSekiguchi/ACCESS-Chromium",
"id": "7252e281648fc8fdc5ebf3cd33d61c2d578c2fe8",
... |
import json
import logging
from django.conf import settings
from django.http import HttpResponse
from django.utils.translation import ugettext as _
from desktop import appmanager
from desktop.lib.django_util import render, login_notrequired
from desktop.log.access import access_log_level
from desktop.models import Se... | {
"content_hash": "6e7431186bf653067a6e6ae66afdd2cb",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 83,
"avg_line_length": 31.78846153846154,
"alnum_prop": 0.7047791893526921,
"repo_name": "yongshengwang/builthue",
"id": "ed980f85632a73a7d4b947400a8cd318f28ac005",
"size":... |
"""
Constructs a data source for the ga4gh server by downloading data from
authoritative remote servers.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import gzip
import os
import requests
import shutil
import subprocess
import tempfil... | {
"content_hash": "a1e6c7d6de1d1f022ed6e039078e30b9",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 78,
"avg_line_length": 36.63495575221239,
"alnum_prop": 0.609879823660849,
"repo_name": "macieksmuga/server",
"id": "d79170417fe702e66cbf1d90aae66c5f2c790af5",
"size": "16... |
"""Base class for optimizers."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
from tensorflow.python.eager import backprop
from tensorflow.python.eager import context
from tensorflow.python.framework import dtypes... | {
"content_hash": "705a357ed02126c5d2187620d43cdad2",
"timestamp": "",
"source": "github",
"line_count": 1208,
"max_line_length": 115,
"avg_line_length": 39.937086092715234,
"alnum_prop": 0.6731199734682033,
"repo_name": "xodus7/tensorflow",
"id": "699162b30c7eae7340d3af3db03a9d1c12889971",
"size": ... |
"""lambda-uploader - Simple way to create and upload python lambda jobs"""
from __future__ import print_function
import sys
import logging
import traceback
import lambda_uploader
from os import getcwd, path, getenv
from lambda_uploader import package, config, uploader, subscribers
from boto3 import __version__ as bo... | {
"content_hash": "3cd2e1b88571d4aa008c1f22a47fcc4f",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 79,
"avg_line_length": 36.77127659574468,
"alnum_prop": 0.5660350065094749,
"repo_name": "rackerlabs/lambda-uploader",
"id": "14de0987e6b53b46eaa23448a6bc25143fae84ad",
"s... |
"""HTTP request and response messages
.. seealso:: :rfc:`2616#section-4`
"""
import re
from httoop.exceptions import InvalidLine
from httoop.meta import HTTPSemantic
from httoop.six import with_metaclass
from httoop.util import Unicode, _
__all__ = ('Method', )
class Method(with_metaclass(HTTPSemantic)):
u"""A H... | {
"content_hash": "7c855fe076e941490fd08c57411a73c1",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 91,
"avg_line_length": 23.46938775510204,
"alnum_prop": 0.6808695652173913,
"repo_name": "spaceone/httoop",
"id": "5c876aeea5e23cf585da09ada1a8d2c11521be3f",
"size": "1174"... |
import os
# import socket
# my_ips = socket.gethostbyname_ex(socket.gethostname())
from datetime import timedelta
import jsonschema
import ipaddress
import re
basedir = os.path.abspath(os.path.dirname(__file__))
@jsonschema.FormatChecker.cls_checks('cidr')
def _validate_cidr_format(cidr):
"""Validate CIDR IP ran... | {
"content_hash": "dca08bbea2a79a9105d384c898d11de1",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 76,
"avg_line_length": 30.111524163568774,
"alnum_prop": 0.6517283950617284,
"repo_name": "certeu/do-portal",
"id": "9978665d90f4925e848343cc73e02fb1040f7d35",
"size": "81... |
"""DRBD block device related functionality"""
import errno
import logging
import time
from ganeti import constants
from ganeti import utils
from ganeti import errors
from ganeti import netutils
from ganeti import objects
from ganeti.storage import base
from ganeti.storage.drbd_info import DRBD8Info
from ganeti.storag... | {
"content_hash": "d21111d7155a04172c5c1a81bcb16fa5",
"timestamp": "",
"source": "github",
"line_count": 1064,
"max_line_length": 80,
"avg_line_length": 33.955827067669176,
"alnum_prop": 0.636330925295469,
"repo_name": "yiannist/ganeti",
"id": "4f6cd77eaed618fd92823fcb90dab25924831588",
"size": "375... |
import unittest, time, sys, time, random, json
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_common
DO_RANDOM_SAMPLE = True
DO_RF = False
print "Assumes you ran ../build_for_clone.py in this directory"
print "Using h2o-nodes.json. Also the sandbox di... | {
"content_hash": "384cfa24b9b28ef4df41059c92252fec",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 130,
"avg_line_length": 42.303703703703704,
"alnum_prop": 0.5522675538434599,
"repo_name": "woobe/h2o",
"id": "ea9066cf5d8287b2df14b6cc619f03e019bb07ce",
"size": "5711",
... |
from hacksport.problem_templates import CompiledBinary
Problem = CompiledBinary(sources=["vuln.c"])
| {
"content_hash": "2c2963da3cbae60e7cd10ddc0196e7af",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 54,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.8118811881188119,
"repo_name": "royragsdale/picoCTF",
"id": "75c3f89de98a8b18216d2c38d54fbe2d1250cd59",
"size": "1... |
from ._airflow import Airflow # noqa
| {
"content_hash": "c9071e3a54c4a28273c0e6d8ab423743",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 37,
"avg_line_length": 38,
"alnum_prop": 0.7368421052631579,
"repo_name": "yebrahim/pydatalab",
"id": "60ad573ee3af97f48c0a947a8eee319e8cd6ac5a",
"size": "626",
"binary": ... |
from optparse import make_option
import threading
from blinkpy.tool.commands.command import Command
class AbstractLocalServerCommand(Command):
server = None
launch_path = '/'
def __init__(self):
options = [
make_option(
'--httpd-port',
action='store',
... | {
"content_hash": "47b36eed3289658c5fe307a0914879ec",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 105,
"avg_line_length": 34.46808510638298,
"alnum_prop": 0.55,
"repo_name": "nwjs/chromium.src",
"id": "8a9e3f65fa11f230ff5cbfce17bffb0ca5a9c77d",
"size": "2965",
"binary... |
BROKER_URL = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND = "redis"
CELERY_IMPORTS = ("tasks", )
CELERY_RESULT_SERIALIZER = "json"
CELERY_TASK_RESULT_EXPIRES = None
| {
"content_hash": "64202d595508cc6b49204105ca22accc",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 39,
"avg_line_length": 21.5,
"alnum_prop": 0.7151162790697675,
"repo_name": "xbzbing/celery-php",
"id": "b76fb6a58611925ad59d8c362f8b4634359b5ac2",
"size": "172",
"binary"... |
import os, sys
import unittest
from uuid import uuid4
import numpy as np
from desispec.resolution import Resolution
from desispec.frame import Frame
from desispec.fiberflat import FiberFlat
from desispec import io
from desispec.pipeline.core import runcmd
class TestBinScripts(unittest.TestCase):
@classmethod
... | {
"content_hash": "1274a10d9d47b853a48ba5c0c12c03f8",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 129,
"avg_line_length": 37.57657657657658,
"alnum_prop": 0.6118436825701271,
"repo_name": "profxj/desispec",
"id": "a2db5a3e60f4fbdedcbe3097d6e0abecd8186856",
"size": "417... |
from urllib.request import urlopen
from bs4 import BeautifulSoup
from sqlalchemy import create_engine
from sqlalchemy import desc
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from roll import Roll
import os
from datetime import datetime
from price import get_price
db_... | {
"content_hash": "0eecfa4d14b6d11c98aad1b27f143516",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 87,
"avg_line_length": 32.868852459016395,
"alnum_prop": 0.6743142144638404,
"repo_name": "petertom51/tw-stock-roll",
"id": "ce890bb5a8a2b7c86d619d115970757780d041e9",
"siz... |
"""
RomTrainer module
This module contains the Step for Training ROMs
Created on May 6, 2021
@author: alfoa
supercedes Steps.py from alfoa (2/16/2013)
"""
#External Modules------------------------------------------------------------------------------------
#External Modules End--------------------------------... | {
"content_hash": "90b322ba4f7c31bb31c8d57111ecfb59",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 177,
"avg_line_length": 45.53947368421053,
"alnum_prop": 0.625541750939035,
"repo_name": "joshua-cogliati-inl/raven",
"id": "fcb12c30ab406ee799397e7cb39c98bc242bd691",
"siz... |
execfile("version.py")
import datetime
today = datetime.date.today().strftime("%Y%m%d")
cmd = "git archive --format=tar.gz --prefix=iVisDesigner-%s/ -o dist/iVisDesigner-%s-%s-r%s.tar.gz HEAD" % \
(IV_version, IV_version, today, IV_rev)
print cmd
commands.getoutput(cmd)
| {
"content_hash": "70a6d1c993b57d304861e3a128f7def1",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 108,
"avg_line_length": 27.8,
"alnum_prop": 0.6942446043165468,
"repo_name": "donghaoren/iVisDesigner",
"id": "19879e2bba0716290d3da7b9ccb4f23693186ef0",
"size": "297",
"... |
import logging
from django.contrib.auth.models import User
from desktop.conf import LDAP
from models import UserProfile
from views import import_ldap_users
import ldap_access
LOG = logging.getLogger(__name__)
class LdapSynchronizationMiddleware(object):
"""
Synchronize against LDAP authority.
"""
USER_C... | {
"content_hash": "0a617b9c49a4be60d4ab5aee42179837",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 135,
"avg_line_length": 30.025641025641026,
"alnum_prop": 0.7181895815542272,
"repo_name": "2013Commons/hue",
"id": "e749d6b0d12a39516e626b15676e2be075495ef6",
"size": "196... |
import pytest
from celery.result import EagerResult
from {{ cookiecutter.project_slug }}.users.tasks import get_users_count
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
@pytest.mark.django_db
def test_user_count(settings):
"""A basic test to execute the get_users_count Celery ta... | {
"content_hash": "f78a2a5fa68e6c4693a5c4a90b2405cc",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 77,
"avg_line_length": 33.0625,
"alnum_prop": 0.7466918714555766,
"repo_name": "Parbhat/cookiecutter-django-foundation",
"id": "addb091db5c334cf45d191f4a0ee78ff9ab3f7d6",
"... |
from unittest import mock
from heat.common import exception
from heat.common import template_format
from heat.engine.resources.openstack.neutron import security_group_rule
from heat.tests import common
from heat.tests.openstack.neutron import inline_templates
from heat.tests import utils
class SecurityGroupRuleTest(... | {
"content_hash": "87826113a4671a8f4b4df5d858c9f1a8",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 79,
"avg_line_length": 37.32258064516129,
"alnum_prop": 0.6070296744454048,
"repo_name": "openstack/heat",
"id": "49b4276344fe3d1deb20265e21d6774993635527",
"size": "4046",... |
"""
Mission
-------
This is a work-around to bolt saltstack modules and states into any python code.
Saltstack is a permissively-licensed, pythonic configuration management system.
Fabric is a task-runner for all sorts of miscellaneous configurations. Both are
essential tools.
You can read the documentation for the ... | {
"content_hash": "a96c5f9dd5a56ceb0d8bf4b7a9c1da51",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 113,
"avg_line_length": 28.816326530612244,
"alnum_prop": 0.6922804532577904,
"repo_name": "tony/salt-states-configs",
"id": "79d6d0512add054f82caa20dfc37c7c1f5bf7b29",
"si... |
import codecs
import os.path
import re
import subprocess
from functools import partial
from collections import defaultdict
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from lib import struct, newAction, newIcon, addActions, fmtShortcut
from shape import Shape, DEFAULT_LINE_COLOR, DEFAULT_FILL_COLOR
from can... | {
"content_hash": "15ba2f20ece2ca82989c73bce9a45a93",
"timestamp": "",
"source": "github",
"line_count": 1173,
"max_line_length": 122,
"avg_line_length": 38.83972719522592,
"alnum_prop": 0.5928576132048552,
"repo_name": "chenpeikai/labelimg",
"id": "fa245a15cec02da9a2104c9fb23d03295567278f",
"size":... |
'''
New Integration Test for hybrid.
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import time
test_obj_dict = test_state.TestStateDict()
test_stub = test_lib.lib_get_test_stub()
hybrid = test_stub.Hy... | {
"content_hash": "5bf89d73901c208b57b5c92759ecfc49",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 59,
"avg_line_length": 22.514285714285716,
"alnum_prop": 0.7258883248730964,
"repo_name": "zstackio/zstack-woodpecker",
"id": "834ff6b17eb870fe2b5b7ba6f9a41c44bbf81bcb",
"s... |
from __future__ import absolute_import, division, with_statement
import os
import traceback
from tornado.escape import utf8, native_str, to_unicode
from tornado.template import Template, DictLoader, ParseError, Loader
from tornado.testing import LogTrapTestCase
from tornado.util import b, bytes_type, ObjectDict
cla... | {
"content_hash": "8fba1925034f2612998fa36b0e770c26",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 121,
"avg_line_length": 38.45945945945946,
"alnum_prop": 0.5382212852346373,
"repo_name": "pombredanne/catawampus",
"id": "d70e4875c4b42e8980868131aa01519e28324a65",
"size... |
from Tkinter import *
from Tkinter import _flatten, _cnfmerge, _default_root
# WARNING - TkVersion is a limited precision floating point number
if TkVersion < 3.999:
raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
import _tkinter # If this fails your Python may not be configured for Tk
# So... | {
"content_hash": "8dcf1fe070b7b8108c8743db5676ee9b",
"timestamp": "",
"source": "github",
"line_count": 1773,
"max_line_length": 96,
"avg_line_length": 39.186689227298366,
"alnum_prop": 0.6054578427703734,
"repo_name": "MalloyPower/parsing-python",
"id": "b35d423dd14a6179fc3e837c3ba947229e0fa2a5",
... |
"""Glue between metadata sources and the matching logic."""
from __future__ import division, absolute_import, print_function
from collections import namedtuple
import re
from beets import logging
from beets import plugins
from beets import config
from beets.autotag import mb
from jellyfish import levenshtein_distance... | {
"content_hash": "af458e8242ceef26298c34bf9d23a211",
"timestamp": "",
"source": "github",
"line_count": 594,
"max_line_length": 79,
"avg_line_length": 34.936026936026934,
"alnum_prop": 0.6027370855821126,
"repo_name": "Freso/beets",
"id": "5c8e0e2c502d9d40ca98091c0b6a85de12fd955f",
"size": "21423",... |
import datetime
import csv
myfile = open('timetable.csv', 'wb')
wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
start = datetime.datetime.strptime("2013-10-01 00:00:00", "%Y-%m-%d %H:%M:%S")
end = datetime.datetime.strptime("2014-10-01 00:00:00", "%Y-%m-%d %H:%M:%S")
# date_generated2 = [start + datetime.timedelta(da... | {
"content_hash": "5e47df3662a6c6376976e3d583678f92",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 100,
"avg_line_length": 34.95,
"alnum_prop": 0.6680972818311874,
"repo_name": "meaton00/class_project",
"id": "1cb138e09c328efebfd23edd2d5b8f2f005af3b8",
"size": "845",
"... |
from typing import TypeVar, Generic, Callable, Any
T = TypeVar('T')
U = TypeVar('U')
class Either(Generic[T]):
"""
The Either type represents values with two possibilities: B value of type Either[A, B] is either Left[A or Right[B]
But not both in the same time.
"""
def __init__(self, value: T) ... | {
"content_hash": "4beb6f4c746cd48d682561d0f5293948",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 119,
"avg_line_length": 25.535885167464116,
"alnum_prop": 0.563050402848042,
"repo_name": "przemyslawjanpietrzak/pyMonet",
"id": "8d52cb87145c0cbaff99d0814e076db60a6dab75",
... |
import sys
import os
from os import system
import tashi.services.layoutlocality.localityservice as localityservice
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from tashi.util import getConfig
(config, configFiles)... | {
"content_hash": "3433587de75bb7dcc12b4607ae2a6fc5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 71,
"avg_line_length": 22.94,
"alnum_prop": 0.7061900610287707,
"repo_name": "apache/tashi",
"id": "49ecb1190f6fba4e1c1304c6841dc4ffc77860f4",
"size": "1953",
"binary": f... |
import os
import sys
from _pydevd_bundle.pydevd_constants import CYTHON_SUPPORTED
use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
dirname = os.path.dirname(os.path.dirname(__file__))
# Do not show incorrect warning for .egg files for Remote debugger
if not CYTHON_SUPPORTED or dirname.endswith('.egg'):
# Do not ... | {
"content_hash": "e4d7393b4959fef8809ab65fb6335636",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 142,
"avg_line_length": 50.20289855072464,
"alnum_prop": 0.6830254041570438,
"repo_name": "signed/intellij-community",
"id": "18f579685706cdcc7374de37bc67a84360623e28",
"si... |
from __future__ import absolute_import
from datetime import datetime
from django.core.urlresolvers import reverse
from sentry.models import Release, ReleaseCommit
from sentry.testutils import APITestCase
class ProjectReleaseListTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
... | {
"content_hash": "cba74cab0957a3a5344ab771c2acf6d9",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 84,
"avg_line_length": 31.610091743119266,
"alnum_prop": 0.5694383979103178,
"repo_name": "alexm92/sentry",
"id": "d460fcf1eab7cdc7e99b5d106e3fea8ceaa08d5d",
"size": "6891... |
"""
lossy_flow_accumulator.py: Component to accumulate flow and calc drainage area,
while permitting gain or loss of discharge during flow.
DEJH, late 2018
"""
import sys
from landlab.components.flow_accum import (
FlowAccumulator,
flow_accum_bw,
flow_accum_to_n,
)
if sys.version_info[0] >= 3:
from ... | {
"content_hash": "ebbc31137cabdb50a056a11f09e694c9",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 159,
"avg_line_length": 40.5966735966736,
"alnum_prop": 0.5503661596763456,
"repo_name": "landlab/landlab",
"id": "cd8cfea75a4850cdbaddc1f88450dfac05ef5cff",
"size": "1954... |
from os.path import join, dirname
from ithz.lib import template
from ithz.utils import u
templatedir = join(dirname(dirname(__file__)),"templates")
def getTemplate(name,values):
return u(template.render(join(templatedir, name), values))
| {
"content_hash": "82a731b8ccb8868e48ce679f7fa05628",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 62,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.7603305785123967,
"repo_name": "ergoithz/ithz",
"id": "f49bd7c1f3ceff0ca769c4aaab1b9657363fa4c4",
"size": "242",
... |
from django.db.models import Q
from django.core.exceptions import ValidationError
from cms.apphook_pool import apphook_pool
from cms.models import Page
from menus.base import Menu
class CMSAttachMenu(Menu):
cms_enabled = True
instance = None
name = None
def __init__(self, *args, **kwargs):
... | {
"content_hash": "ca6d77fe0a6f921dda3ef51800c5ba9b",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 86,
"avg_line_length": 30.72,
"alnum_prop": 0.5963541666666666,
"repo_name": "divio/django-cms",
"id": "444b18942db0a1c9a6b2152fd9db19520d73992a",
"size": "1536",
"binary... |
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
# Third-party
import numpy as np
import astropy.units as u
__all__ = ["BasePrior", "UniformPrior", "LogarithmicPrior", "NormalPrior"]
logger = logging.getLogger(__name__)
... | {
"content_hash": "618f6fc285116bd4fc3770865eb19930",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 84,
"avg_line_length": 28.28301886792453,
"alnum_prop": 0.5223482321547699,
"repo_name": "abonaca/gary",
"id": "59f739e46b48f86df28d3a51f1d4808c962511ae",
"size": "6015",
... |
import os
import sys
import json
import gpu_path_util
from gpu_tests import gpu_integration_test
html_path = os.path.join(gpu_path_util.CHROMIUM_SRC_DIR, 'content', 'test',
'data', 'gpu', 'webcodecs')
data_path = os.path.join(gpu_path_util.CHROMIUM_SRC_DIR, 'media', 'test',
... | {
"content_hash": "4a5d80f211b2a3227c7c52491f90560a",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 80,
"avg_line_length": 32.93877551020408,
"alnum_prop": 0.5888062783973564,
"repo_name": "scheib/chromium",
"id": "c44cd0fa75fc4a60db1078b9cf2cef43fd95eb5e",
"size": "5005... |
from django import forms
| {
"content_hash": "8e8c8c3956e9257db780238b69f38ba0",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 24,
"avg_line_length": 13,
"alnum_prop": 0.8076923076923077,
"repo_name": "ashwoods/django-double-taggit",
"id": "7112ef9333c1703f624998863783bfdc81634434",
"size": "1066",
... |
from typing import Type, Dict
class SsaContext():
"""
:ivar objCnt: the dictionary of object counts used for name generating
"""
def __init__(self):
self.objCnt = 0 # : Dict[Type, int] = {}
def genName(self, obj):
prefix = getattr(obj, "_GEN_NAME_PREFIX", "o")
i = self.o... | {
"content_hash": "06f2716a2cff388ec8a4fafd4aa45a29",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 27.1875,
"alnum_prop": 0.542528735632184,
"repo_name": "Nic30/hwtHls",
"id": "0ebeb7499db3361d295668cde33702a27d54e071",
"size": "435",
"binary": f... |
"""Test Utils for Forseti unit tests."""
from builtins import range
import collections
import contextlib
import json
import logging
import os
import tempfile
import unittest
import socket
import sys
from google.cloud.forseti.common.util import logger
def get_available_port():
"""Get a port that is available to u... | {
"content_hash": "8efee84d5cafb8e4f0926f9d0441b477",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 91,
"avg_line_length": 35.416666666666664,
"alnum_prop": 0.6108597285067874,
"repo_name": "forseti-security/forseti-security",
"id": "23e1cafb8c24d851de31f1bc26d9a44a9c7ee4f... |
"""Gets all the saved reports for user's default account.
Tags: savedreports.list
"""
__author__ = 'jalc@google.com (Jose Alcerreca)'
import sys
from apiclient import sample_tools
from oauth2client import client
from adsense_util import get_account_id
MAX_PAGE_SIZE = 50
def main(argv):
# Authenticate and cons... | {
"content_hash": "0bee577287fa03628b6fad2e36de332d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 30.02173913043478,
"alnum_prop": 0.6603910209992759,
"repo_name": "ya7lelkom/googleads-adsense-examples",
"id": "e386b228cf8771c230bbd02b07eb24663f8a94... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'chart_axis33.xlsx'
... | {
"content_hash": "e82c3d7f3d21431a3136113811a48bc5",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 89,
"avg_line_length": 28.381818181818183,
"alnum_prop": 0.564381806534273,
"repo_name": "jkyeung/XlsxWriter",
"id": "bb8e6ef2097aa5540859c26a2bf01ecf054b2e8b",
"size": "17... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
# 引入这个 Field,其它的不要变
from DjangoUeditor.models import UEditorField
from django.core.urlresolvers import reverse
@python_2_unicode_compatible
class Column(models.Model):
name = models.C... | {
"content_hash": "1230554a21150104bd897f3a6a0f9527",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 85,
"avg_line_length": 32.25,
"alnum_prop": 0.6760797342192691,
"repo_name": "yephper/django",
"id": "cc5e962f721a5ae4644b0dc1f4043ce6a18fbc16",
"size": "1982",
"binary":... |
""" autonomous.py - Version 1.0 2016-10-12
General framework based on Patrick Goebel's nav_test.py
Initial version based on ccam-navigation by Chris Mobley
Autonomous movement added by Jonathan Hodges
Define waypoint destinations for a robot to move autonomously within
a map framework.
This p... | {
"content_hash": "fff7a30873bec2e79b41044f99d965b1",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 87,
"avg_line_length": 30.466019417475728,
"alnum_prop": 0.7087316762268961,
"repo_name": "orsonl/MBZIRC_challenge2",
"id": "70fd33e04f19b6b60b4eaaa62dc06de3503c2599",
"si... |
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0041_channel_previous_tree'),
]
operations = [
migrations.AlterField(
model_name='channel',
... | {
"content_hash": "2f8f2aca251d0e773b2ea7bcac438b34",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 354,
"avg_line_length": 58.486486486486484,
"alnum_prop": 0.5910351201478743,
"repo_name": "jayoshih/content-curation",
"id": "a6af55040b77a62d1e6aa16582c9017df0305bec",
"s... |
"""This package contains code and wrapper classes to access the different
types of cloud providers. For example, OpenStack, Amazon, etc.
To add support to a different cloud provider, we need to drop a module
within the providers package and define a *configure_provider* function
within the module. This function will b... | {
"content_hash": "c48504060af950392f53cae110effc0c",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 82,
"avg_line_length": 34.182857142857145,
"alnum_prop": 0.623370110330993,
"repo_name": "scavarda/mysql-dbcompare",
"id": "7205c8c3147634922828bc3a484d788b0078993a",
"siz... |
try:
from Plugins import Plugin
except:
from PEATDB.Plugins import Plugin
from Tkinter import *
import Pmw
import os, sys, math, string
import csv
import math, numpy
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
from PEATDB.Ekin.Base import EkinProject,Ekin... | {
"content_hash": "96fa5d4b93003f833f1a7004d3f9c176",
"timestamp": "",
"source": "github",
"line_count": 765,
"max_line_length": 119,
"avg_line_length": 36.712418300653596,
"alnum_prop": 0.5243724408047,
"repo_name": "dmnfarrell/peat",
"id": "8ed21ed04955dd21f4c3754430435b5092cb9811",
"size": "29021... |
from test.test_support import have_unicode, run_unittest
import unittest
class base_set:
def __init__(self, el):
self.el = el
class set(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
return [self.el][n]
... | {
"content_hash": "cae59ebe40194de4867914334d370dd0",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 72,
"avg_line_length": 29.405405405405407,
"alnum_prop": 0.5122549019607843,
"repo_name": "ktan2020/legacy-automation",
"id": "960b6c26820b2724d636416de984233cbe86b4e4",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.