text stringlengths 4 1.02M | meta dict |
|---|---|
"""test staticmethod and classmethod as decorator"""
__revision__ = None
class StaticMethod1(object):
"""staticmethod test"""
def __init__(self):
pass
@staticmethod
def do_work():
"Working..."
@staticmethod
def do_work_with_arg(job):
"Working on something"
pri... | {
"content_hash": "4a8a19f31e62c7ee2ba0b1a6624e9987",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 52,
"avg_line_length": 19.59375,
"alnum_prop": 0.5661881977671451,
"repo_name": "willemneal/Docky",
"id": "7884cbde741cb6903c5348d37370c04b01dd09b6",
"size": "668",
"bina... |
"""Provides a way to memoize pure functions with the cache stored to the state.
For usage examples, check memoize in the examples folder.
Written by Peter Duerr
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
fr... | {
"content_hash": "1eee8cce8148254dfac8e2f85c3924a7",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 25.714285714285715,
"alnum_prop": 0.6340277777777777,
"repo_name": "duerrp/pyexperiment",
"id": "6fb74353c824a846a870f674c78aa545921f04fd",
"size": "... |
"""
sentry.runner.initializer
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import click
import os
import six
from sentry.utils import warnings
from sentry.utils.... | {
"content_hash": "235db805381a23cae7d80d3a2c90fbec",
"timestamp": "",
"source": "github",
"line_count": 451,
"max_line_length": 124,
"avg_line_length": 35.60088691796009,
"alnum_prop": 0.6420029895366218,
"repo_name": "alexm92/sentry",
"id": "d132422295167a90a6bf8488bd82f559e8d920da",
"size": "1605... |
import time
import Netmaxiot
# Connect the Netmaxiot SPDT Relay to digital port D4
# SIG,NC,VCC,GND
relay = 4
Netmaxiot.pinMode(relay,"OUTPUT")
while True:
try:
# switch on for 5 seconds
Netmaxiot.digitalWrite(relay,1)
print ("on")
time.sleep(5)
# switch off for 5 seconds
... | {
"content_hash": "0db536fc752ba595dd0fc6659a64c423",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 53,
"avg_line_length": 21.32,
"alnum_prop": 0.6191369606003753,
"repo_name": "NetmaxIOT/Netmaxiot-Shield",
"id": "61c2d87e7bb5989c776cb870157472b58dd16fc9",
"size": "886",
... |
"""Tests the engine."""
import unittest
from dfvfs.helpers import fake_file_system_builder
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.path import factory as path_spec_factory
from dfvfs.path import path_spec
from dfvfs.resolver import context
from dfvfs.vfs import file_system as dfvfs_file_syst... | {
"content_hash": "7545bad3a27c67f9c0f9c1dfd234740b",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 79,
"avg_line_length": 35.173611111111114,
"alnum_prop": 0.717670286278381,
"repo_name": "log2timeline/plaso",
"id": "1f669ab71f2c1c69a5b8f23e183f13342dc85525",
"size": "5... |
"""
.. moduleauthor:: Gabriel Martin Becedillas Ruiz <gabriel.becedillas@gmail.com>
"""
import os
import sys
sys.path.append(os.path.join("..", "symbols"))
sys.path.append(os.path.join("..", "..")) # For pyalgotrade
import pyalgotrade.logger
pyalgotrade.logger.file_log = "download_data.log"
logger = pyalgotrade.lo... | {
"content_hash": "106727a298ad3fc5b564f333bd0ba35f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 95,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6148148148148148,
"repo_name": "cgqyh/pyalgotrade-mod",
"id": "91cd4f45d577c0ef5a3ff8fd33457aecdd2c6fa5",
"size":... |
import logging, threading, time, socket, httplib, os
from urlparse import urlparse
from py2030.base_component import BaseComponent
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
def createRequestHandler(event_manager = None, _options = {}):
class CustomHandler(SimpleHT... | {
"content_hash": "4b911bdafad727c488bb5c95b99afcca",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 113,
"avg_line_length": 37.23936170212766,
"alnum_prop": 0.5693472361091273,
"repo_name": "markkorput/py2030",
"id": "18d6d9d9f6a7528f5faf0412dab68e48b8444c57",
"size": "7... |
"""Special pages such as the recent changes page."""
from .actions import page_missing
from .database import Page
from .database import RevisionedPage
from .utils import generate_template
from .utils import Pagination
from .utils import Response
def page_index(request):
"""Index of all pages."""
letters = {}
... | {
"content_hash": "f707f659e4d1a64ecfed831627cfd90b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 77,
"avg_line_length": 29.6,
"alnum_prop": 0.674831081081081,
"repo_name": "pallets/werkzeug",
"id": "2c286f5b562c72d5fb1064b4d5eade01b8fc5e9e",
"size": "1184",
"binary":... |
"""Util for modifying the GRR server configuration."""
import argparse
import ConfigParser
import getpass
import json
import os
import re
# importing readline enables the raw_input calls to have history etc.
import readline # pylint: disable=unused-import
import socket
import sys
import urlparse
# pylint: disable=... | {
"content_hash": "87928afa14b60d4c20b5db74f367eb9c",
"timestamp": "",
"source": "github",
"line_count": 911,
"max_line_length": 80,
"avg_line_length": 36.18441273326015,
"alnum_prop": 0.6738259919912633,
"repo_name": "ahojjati/grr",
"id": "5bf3c8901e23baef2396ae9bf5cd6d570da8eb48",
"size": "32986",... |
from __future__ import unicode_literals
import frappe, json
class User:
"""
A user object is created at the beginning of every request with details of the use.
The global user object is `frappe.user`
"""
def __init__(self, name=''):
self.defaults = None
self.name = name or frappe.session.get('user')
self.r... | {
"content_hash": "276c3855dd40c81e18cc14d81b2a7551",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 111,
"avg_line_length": 28.61304347826087,
"alnum_prop": 0.6435192220027351,
"repo_name": "gangadharkadam/office_frappe",
"id": "9095a4422a9f07bc56b0c8f569a9b30a3f03c09d",
... |
class SignOnException(Exception):
pass
class AppProfileException(Exception):
pass
class TransactionRequestException(Exception):
pass
class ApplicationRequestException(Exception):
pass
| {
"content_hash": "23ff1be65962f53882c9283d00823dee",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 45,
"avg_line_length": 14.714285714285714,
"alnum_prop": 0.7766990291262136,
"repo_name": "Zertifica/evosnap",
"id": "4377675c0782abdebe53eb5fe923ccacbf060815",
"size": "20... |
import sys
import petsc4py
petsc4py.init(sys.argv)
import numpy as np
from time import time
from scipy.io import savemat
# from src.stokes_flow import problem_dic, obj_dic
from petsc4py import PETSc
from src import stokes_flow as sf
from src.myio import *
from src.objComposite import *
# from src.myvtk import save_si... | {
"content_hash": "1df06676009b050adcb7ae93d006812b",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 110,
"avg_line_length": 44.695402298850574,
"alnum_prop": 0.5878230680210879,
"repo_name": "pcmagic/stokes_flow",
"id": "78457a840bfff267dc8acd477b18a88d0218e249",
"size":... |
"""Module for handling consistent state storage.
Attributes:
state_file(str): file path where state storage is kept. By default XDG conventions are used. (Most likely ~/.config/python-cozify/python-cozify.cfg)
state(configparser.ConfigParser): State object used for in-memory state. By default initialized with ... | {
"content_hash": "f8f749a11a63c11f6a10a88d8fb96d66",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 244,
"avg_line_length": 36.054054054054056,
"alnum_prop": 0.6714142928535732,
"repo_name": "Artanicus/python-cozify",
"id": "198cf619e101b7c6e68a589ca297c780c16ef295",
"si... |
"""Tests for the generate-timezone-mask-ancillary CLI."""
import pytest
from . import acceptance as acc
pytest.importorskip("timezonefinder")
pytest.importorskip("numba")
pytestmark = [pytest.mark.acc, acc.skip_if_kgo_missing]
CLI = acc.cli_name_with_dashes(__file__)
run_cli = acc.run_cli(CLI)
GRIDS = ["uk", "glob... | {
"content_hash": "82dce2b1d2dcc9f2dcd691e902fa1c42",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 79,
"avg_line_length": 32.20779220779221,
"alnum_prop": 0.6479838709677419,
"repo_name": "fionaRust/improver",
"id": "085015d8497da10482f72d4abb99c391924a0dca",
"size": "41... |
import numpy as np
import pytest
import pandas.util.testing as tm
from pandas import date_range
from pandas._libs.tslib import iNaT
from pandas._libs.tslibs import conversion, timezones
def compare_utc_to_local(tz_didx, utc_didx):
f = lambda x: conversion.tz_convert_single(x, 'UTC', tz_didx.tz)
result = conv... | {
"content_hash": "3122dcd5ea02a0e695c1f62c162db864",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 76,
"avg_line_length": 42.763636363636365,
"alnum_prop": 0.6113945578231292,
"repo_name": "harisbal/pandas",
"id": "76038136c26cb6d3899b437ceac9c98e17a9f924",
"size": "2377... |
from __future__ import unicode_literals
import random
import nose
from nose.tools import raises
from xvalidator.validators import Token, Name, NCName, Language, \
NMTOKEN, IntegerValidator, NonNegativeInteger, PositiveInteger, \
NegativeInteger, FloatValidator, NonNegativeFloat, BooleanValidator, \
EnumVal... | {
"content_hash": "4495e22cedc0249df287edea5c05c79f",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 74,
"avg_line_length": 23.03309692671395,
"alnum_prop": 0.6769988709842965,
"repo_name": "berndca/xvalidator",
"id": "286be97056a584e295fd443da55c568509a39bfa",
"size": "9... |
import sys
from django.conf import settings
from django.core.management import execute_from_command_line
import django
if django.VERSION < (1, 6):
extra_settings = {
'TEST_RUNNER': 'discover_runner.DiscoverRunner',
}
else:
extra_settings = {}
if not settings.configured:
settings.configure(
... | {
"content_hash": "6b45ea7a5b4aaa4d33b0363c9aa5a9fc",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 60,
"avg_line_length": 19.526315789473685,
"alnum_prop": 0.5592991913746631,
"repo_name": "MarkusH/django-nap",
"id": "fcc01a72768c76c70142000d8f02002bfbfbfb1c",
"size": "8... |
import os
from .. import run_python_module
from .base import BaseTestApp
class TestNbGraderFetch(BaseTestApp):
def _release(self, assignment, exchange):
self._copy_file("files/test.ipynb", "release/ps1/p1.ipynb")
run_python_module([
"nbgrader", "release", assignment,
"--c... | {
"content_hash": "3549155660d132407e21c0e3b5de2383",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 67,
"avg_line_length": 31.71153846153846,
"alnum_prop": 0.5858095815645846,
"repo_name": "dementrock/nbgrader",
"id": "e272bf018d3cfadb3483edb9f4a2e35182c2aeb0",
"size": "1... |
"""Flux database.
"""
import os
import psycopg2
import psycopg2.extras
from astropy import log
try:
from StringIO import StringIO # Python 2
except ImportError:
from io import StringIO
from . import config
class FluxDB(object):
def __init__(self,
dbinfo=config.DBINFO,
... | {
"content_hash": "c669ef65d5a2fdc7cedeed2749eba040",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 83,
"avg_line_length": 32.36585365853659,
"alnum_prop": 0.47445365486058777,
"repo_name": "barentsen/meteor-flux",
"id": "4d370d17379a38815fdf008b4a71a59186f6c230",
"size"... |
from typing import Dict, Optional
from appium.options.common.supports_capabilities import SupportsCapabilities
AVD_ENV = 'avdEnv'
class AvdEnvOption(SupportsCapabilities):
@property
def avd_env(self) -> Optional[Dict[str, str]]:
"""
Mapping of emulator environment variables.
"""
... | {
"content_hash": "d5a07fe52d4efe218b382efbc1ea303d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 76,
"avg_line_length": 26.761904761904763,
"alnum_prop": 0.6512455516014235,
"repo_name": "appium/python-client",
"id": "a673a95fd9af5d8f379ff0aa486450f6cc02ded1",
"size": ... |
''' Миграция для дат в транзакции '''
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
''' Автоматическая подстановка даты в транзакции '''
dependencies = [
('lawe', '0002_auto_20161227_2005'),
]
operations = [
migrations.AlterField(
... | {
"content_hash": "a15b1391fbdd10e1cb31a19575c413a3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 66,
"avg_line_length": 23,
"alnum_prop": 0.7025171624713958,
"repo_name": "DronMDF/laweb",
"id": "5bf48e4a7e7fe61333671d040accaa3fb780bbd0",
"size": "573",
"binary": fals... |
"""
Given a collection of candidate numbers (candidates) and a target number
(target), find all unique combinations in candidates where the candidate numbers
sums to target.
Each number in candidates may only be used once in the combination.
Note:
All numbers (including target) will be positive integers.
T... | {
"content_hash": "600da75b86def9a5d0e51f6d3a06996c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 85,
"avg_line_length": 25.075757575757574,
"alnum_prop": 0.5637462235649546,
"repo_name": "algorhythms/LeetCode",
"id": "7658b27ba54591a8544b80a501d02d4d999bbd76",
"size": ... |
"""
Deployment for SUMO in production.
Requires commander (https://github.com/oremj/commander) which is installed on
the systems that need it.
"""
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from commander.deploy import task, hostgroups # noqa
import commander_settings as setti... | {
"content_hash": "1efa723f7d911ff893cb0b809c2db09e",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 97,
"avg_line_length": 29.819875776397517,
"alnum_prop": 0.6556967298479484,
"repo_name": "MziRintu/kitsune",
"id": "07f1b6a82c6968fbd0635797a90d61a2d89b4203",
"size": "48... |
"""
The :mod:`bolt.model` module contains classes which represent
parametric models supported by Bolt.
Currently, the following models are supported:
:class:`bolt.model.LinearModel`: a linear model for binary
classification and regression.
:class:`bolt.model.GeneralizedLinearModel`: a linear model for multi-cl... | {
"content_hash": "789c56564d7e3329aa56265792b68fc5",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 91,
"avg_line_length": 34.981818181818184,
"alnum_prop": 0.5885308385308385,
"repo_name": "pprett/bolt",
"id": "295f2fadd7d07ee4036e200f5c36079c27185da1",
"size": "5874",
... |
from translate.convert import po2tmx
from translate.convert import test_convert
from translate.misc import wStringIO
from translate.storage import tmx
from translate.storage import lisa
class TestPO2TMX:
def po2tmx(self, posource, sourcelanguage='en', targetlanguage='af'):
"""helper that converts po sourc... | {
"content_hash": "76a224462cc7f22d54d75e84b9f7189d",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 128,
"avg_line_length": 34.01324503311258,
"alnum_prop": 0.6388239875389408,
"repo_name": "dbbhattacharya/kitsune",
"id": "7cb439e7ed9a5e950d6cf894c40e5a62043d06e9",
"size... |
from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics
# Creation of the hdf5 file for input/output
with Hdf5() as io:
# Definition of a cube as a convex shape
io.addConvexShape('Cube', [
(-1.0, 1.0, -1.0),
(-1.0, -1... | {
"content_hash": "3b7e6c1476e7bc5992bed9db03e7c2ca",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 36.33802816901409,
"alnum_prop": 0.6089147286821706,
"repo_name": "bremond/siconos",
"id": "c810dafb094f44b98380669e1e986b6d18741efd",
"size": "2678"... |
""" A guide renderer for displaying grid lines on Bokeh plots.
"""
from __future__ import absolute_import
from ..core.properties import Int, String, Float, Auto, Instance, Tuple, Either, Include, Override
from ..core.property_mixins import FillProps, LineProps
from .renderers import GuideRenderer
from .tickers impor... | {
"content_hash": "ad25971a02a9d95d6a74df52d36a465b",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 98,
"avg_line_length": 30.558823529411764,
"alnum_prop": 0.6742059672762272,
"repo_name": "quasiben/bokeh",
"id": "21d859d8a4f971bdef4cf858e541b4c6249c678c",
"size": "2078"... |
import unittest
from prime_factors import prime_factors
class PrimeFactorsTest(unittest.TestCase):
def test_1(self):
self.assertEqual([], prime_factors(1))
def test_2(self):
self.assertEqual([2], prime_factors(2))
def test_3(self):
self.assertEqual([3], prime_factors(3))
de... | {
"content_hash": "c8afb92fde983548cb12126d7ffd864f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 72,
"avg_line_length": 24.38095238095238,
"alnum_prop": 0.6064453125,
"repo_name": "rootulp/xpython",
"id": "02524dce8477520f652462add96ea699e232707c",
"size": "1024",
"b... |
import importlib
import json
from typing import Any, Callable, Dict, Optional
from django.conf import settings
from django.utils.translation import gettext as _
from zulip_bots.lib import BotIdentity, RateLimit
from zerver.actions.message_send import (
internal_send_huddle_message,
internal_send_private_messa... | {
"content_hash": "665b0c028773760acc0342abcb89d3b8",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 92,
"avg_line_length": 35.90909090909091,
"alnum_prop": 0.6092224231464738,
"repo_name": "rht/zulip",
"id": "47750d9e2b9ff4e7edb443ae7588fefed626cec8",
"size": "5530",
"... |
"""
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the __metaclass__ for your Field subclass, implement
to_python() and the other necessary methods and everything will work seamlessly.
"""
from inspect import getargspec
from warnings i... | {
"content_hash": "ebfafbe32fb4534580b58bbe0cb7951e",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 93,
"avg_line_length": 37.3448275862069,
"alnum_prop": 0.6255771006463527,
"repo_name": "alex/django-old",
"id": "148a998f1c8462fb3cd7e5303d163bae4f5fa457",
"size": "4332"... |
"""Package contenant un objet destiné à montrer des informations.
Par exemple, vous trouverez dans ce package le module score et la classe
MontrerScore, destinée à montrer le score d'un personnage. L'intérêt de
passer par des classes (simple conteneurs, méthodes statiques) est que l'on
peut utiliser la même classe pou... | {
"content_hash": "021c77dc9f0eea55b3740a70399ad006",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 75,
"avg_line_length": 45.888888888888886,
"alnum_prop": 0.7820823244552058,
"repo_name": "vlegoff/tsunami",
"id": "5982687de629501273bb89b816f4870f9b8659cd",
"size": "1990"... |
from app import app, swagger
from flask import Blueprint, jsonify
from config import BUILD_VERSION
swagger_bp = Blueprint('swagger_bp', __name__)
@app.route('/')
def show_swagger():
res = swagger.spec.to_dict()
for hidden_views in ('/signup',):
if hidden_views in res['paths']:
del res['pa... | {
"content_hash": "9eb0ca5b35e49811d78c26dada3a6dd6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 46,
"avg_line_length": 23.105263157894736,
"alnum_prop": 0.6560364464692483,
"repo_name": "giubil/trackit",
"id": "3c3b3425007e375947628197ef6c07c4c86dcf63",
"size": "439",... |
import os.path
from typing import Dict, List
from .variable import Variable
from .subprogram import Subprogram
class CompilationUnit:
"""
CompilationUnit for DWARF
See http://dwarfstd.org/doc/DWARF5.pdf page 60
"""
def __init__(self, name, comp_dir, low_pc, high_pc, language):
self.name ... | {
"content_hash": "790964356310da951584796cccf17420",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 66,
"avg_line_length": 28.136363636363637,
"alnum_prop": 0.6365105008077544,
"repo_name": "angr/cle",
"id": "8a8c57c439cc97d10674bfa06b54ae58f1098a99",
"size": "619",
"bi... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
# RiBuild Modules
from delphin_6_automation.database_interactions import mongo_setup
from delphin_6_automation.database_... | {
"content_hash": "e8bbae82b66af35810f2e540e8e6640b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 120,
"avg_line_length": 47.13846153846154,
"alnum_prop": 0.6622062663185379,
"repo_name": "thp44/delphin_6_automation",
"id": "bbbbca2c143a105103d70633e7914ddaeba2b029",
"s... |
import optproblems.cec2005
import numpy as np
import time
from ASO import *
import os
if __name__ == "__main__":
dim = 30
repeats = 10
evaluations = 10000*dim
population = 30
external_rate = 3
internal_rate = 1
fickleness_rate = 0.5
if not os.path.exists('results'):
os.makedirs... | {
"content_hash": "bdc8f47458b085b6c622fa3030df54ff",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 97,
"avg_line_length": 36.76875,
"alnum_prop": 0.5934047254801972,
"repo_name": "JJSrra/Research-SocioinspiredAlgorithms",
"id": "91372c47ed40a5a7a848d95ab476894c361c6ad7",
... |
import os
import sys
argv = sys.argv
sys.argv = [sys.argv[0]]
import ROOT
import CrombieTools # Needed for KinematicFunctions.h
import logging
logging.basicConfig(level=logging.INFO)
def main(in_file, out_file, cut, *args, **kwargs):
dump = args or ['run', 'luminosityBlock', 'event']
to_scan = ':'.join(dum... | {
"content_hash": "7225935af40905082d86dfc20a437d4d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 75,
"avg_line_length": 24.42105263157895,
"alnum_prop": 0.6282327586206896,
"repo_name": "dabercro/CrombieTools",
"id": "8a928c28c7310f05d1ecb8c54b32d541a99ecdd7",
"size": ... |
from django.contrib import admin
from models import Message, Report
class MessageAdmin(admin.ModelAdmin):
list_display = ('destination', 'message_type')
search_fields = ('destination',)
fieldsets = [
(None, {'fields': ['destination', 'message_type']}),
('Optional', {'fields': ['source_nam... | {
"content_hash": "3051aa315ae4c72e28ebac70e10fe932",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 60,
"avg_line_length": 33.25,
"alnum_prop": 0.43609022556390975,
"repo_name": "MagicSolutions/django-labyrinpy",
"id": "a05fa811a4fa612ee717b1e22b6a64cf95d24c91",
"size": "... |
import os
import webapp2
import logging
import utils
from google.appengine.ext import db
from google.appengine.api import users
from gpx import SaveToDB
from models import GPXheader, ToroamUsers
from usermgmt import UserMgmt
from views import BaseHandler
class LoginPage(BaseHandler):
def get(self):
user = ... | {
"content_hash": "eef62f95ad4f95a8032ebeed805f8d6c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 103,
"avg_line_length": 32.27450980392157,
"alnum_prop": 0.5820170109356014,
"repo_name": "yafraorg/yafra-toroam",
"id": "53bcabea102b10655645378e472006f508dc854d",
"size":... |
from corehq.fluff.calculators.xform import FormPropertyFilter
from couchforms.models import XFormInstance
import fluff
from custom.tdh import TDH_DOMAINS, ENROLL_CHILD_XMLNSES, INFANT_CLASSIFICATION_XMLNSES, INFANT_TREATMENT_XMLNSES, \
NEWBORN_CLASSIFICATION_XMLNSES, NEWBORN_TREATMENT_XMLNSES, CHILD_CLASSIFICATION_... | {
"content_hash": "fb5f5495adbf097aaef22c1ac51bea1e",
"timestamp": "",
"source": "github",
"line_count": 3448,
"max_line_length": 116,
"avg_line_length": 76.00493039443155,
"alnum_prop": 0.6047202030030717,
"repo_name": "puttarajubr/commcare-hq",
"id": "38c3af5ef6f9c6d66da55662a0777df3ca1512d7",
"si... |
import numpy as np
import scipy.sparse as sp
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises_regexp
from s... | {
"content_hash": "023721c811d3affadd18c0f937e974d8",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 78,
"avg_line_length": 38.99248120300752,
"alnum_prop": 0.5887003470883146,
"repo_name": "YinongLong/scikit-learn",
"id": "04bdf8b6f60fe44ed966bb691680b2c5829e752f",
"size... |
from datetime import date, timedelta
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http.response import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views import View
from django.views.generic import ListView
from swiftwind.bil... | {
"content_hash": "8b022532dc50b7ed5d77ccf4092fd4e9",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 91,
"avg_line_length": 35.578947368421055,
"alnum_prop": 0.7292899408284024,
"repo_name": "adamcharnock/swiftwind",
"id": "2e35cab5c4783bfe76bbb15375726be8d67de5c5",
"size"... |
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from starthinker_ui.recipe.scripts import Script
from starthinker.tool.example import recipe_to_python
class Command(BaseCommand):
help = 'Generate Templates For Python'
def handle(self, *args, **kwargs):
for ... | {
"content_hash": "ea23497836a0e4fdb379e2efb7e7c487",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 65,
"avg_line_length": 29.766666666666666,
"alnum_prop": 0.5778275475923852,
"repo_name": "google/starthinker",
"id": "2b9ce94029dd2ac5236b5c0bb264c59420c0ec36",
"size": "1... |
import random
import collections
from getpass import getpass as get_keyword
class GuessWord(object):
def __init__(self):
self.word_list = ["jack", "back", "cock", "luck", "bang", "tool", "dogs", "bags", "life", "kick"]
self.key = True
self.last_word = []
self.word = self.grab_w... | {
"content_hash": "454e42ab126b60757f7f0409b7a33466",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 175,
"avg_line_length": 37.5,
"alnum_prop": 0.5196396396396397,
"repo_name": "praba230890/guesswordgame",
"id": "4d486b25da4941754240aa977badb56807b1dffd",
"size": "2775",
... |
import logging
from .engine import SimEngine
l = logging.getLogger("angr.engines.hook")
# pylint: disable=abstract-method,unused-argument
class SimEngineHook(SimEngine):
def __init__(self, project):
super(SimEngineHook, self).__init__()
self.project = project
def _check(self, state, procedu... | {
"content_hash": "6eb664cb0295138b60f34008916e7756",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 111,
"avg_line_length": 34.37096774193548,
"alnum_prop": 0.6189582355701548,
"repo_name": "chubbymaggie/angr",
"id": "e9624b7236d2ac1264eeb63e4b961cb930532d4f",
"size": "21... |
from __future__ import annotations
from typing import Any, Mapping, Optional, Sequence, Union
from pydantic import BaseModel, root_validator, validator
from datadog_checks.base.utils.functions import identity
from datadog_checks.base.utils.models import validation
from . import defaults, validators
class AuthToke... | {
"content_hash": "e0083e149b570b43a6f13e187b19602f",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 110,
"avg_line_length": 30.657894736842106,
"alnum_prop": 0.703862660944206,
"repo_name": "DataDog/integrations-core",
"id": "b924b6cdecdf71e2e9ffa3b2af778d4704b33f7c",
"s... |
"""Tests for git compatibility utilities."""
from dulwich.tests import (
SkipTest,
TestCase,
)
from dulwich.tests.compat import utils
class GitVersionTests(TestCase):
def setUp(self):
super(GitVersionTests, self).setUp()
self._orig_run_git = utils.run_git
self._version_str = ... | {
"content_hash": "67c8eedf3f990ebe30b83dcf6bd72cb8",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 74,
"avg_line_length": 35.76712328767123,
"alnum_prop": 0.585982382229031,
"repo_name": "johndbritton/gitviz",
"id": "6ecd449dea1431b8957e3f163867b449dc34e11a",
"size": "34... |
import sys
import json
from subprocess import Popen, PIPE
try:
import yaml
except ImportError:
print('Unable to import YAML module: please install PyYAML', file=sys.stderr)
sys.exit(1)
class Reporter(object):
"""Collect and report errors."""
def __init__(self):
"""Constructor."""
... | {
"content_hash": "9f6adacdd74810f88413347e056ddc55",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 96,
"avg_line_length": 28.360655737704917,
"alnum_prop": 0.588150289017341,
"repo_name": "easyreporting/fmri_reporting",
"id": "6af0a3317061d8663dafad9de41aec2156b7e597",
... |
"""Package contenant le paramètre 'créer' de la commande 'banc'."""
from primaires.interpreteur.masque.parametre import Parametre
from primaires.interpreteur.editeur.presentation import Presentation
class PrmCreer(Parametre):
"""Commande 'banc créer'"""
def __init__(self):
"""Constructeur du... | {
"content_hash": "4e41474819d3032ce466e25a13e84f16",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 37.70967741935484,
"alnum_prop": 0.6193327630453379,
"repo_name": "stormi/tsunami",
"id": "9db1aca935197ace9952c2d4012be69d954f95ff",
"size": "2746",... |
"""Basic example of feeding files into a directory being watched by spark streaming.
This script will monitor a directory tree passed as a argument. When new files are added inside this tree
(provided that they are lexicographically later than the last file fed into the stream - see updating_walk.py)
they will be firs... | {
"content_hash": "d721880e2234344ffdef7911d72b617f",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 117,
"avg_line_length": 45.65714285714286,
"alnum_prop": 0.6733416770963705,
"repo_name": "andrewosh/thunder-streaming",
"id": "e49a4a31a0eaa798c9f891a63b117b12c32da796",
"... |
"""
Name server control module. Slightly enhanced for QA package.
"""
from pycopia.remote import pyro
def print_listing(listing):
for name, uri in sorted(listing.items()):
if len(uri) > 45:
print(("{:>35.35s} --> \n{:>79.79s}".format(name, uri)))
else:
print(("{:>35.35s} -... | {
"content_hash": "5193305893e6f6f6dafaf752e16bdfea",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 68,
"avg_line_length": 22.014705882352942,
"alnum_prop": 0.5497661990647963,
"repo_name": "kdart/pycopia3",
"id": "aead9e051ff1fbb6d20a4845db8c34a909dd3070",
"size": "2110"... |
""" Defines miscellaneous Qt-related helper classes and functions.
"""
# Standard library imports.
import inspect
# System library imports.
from IPython.external.qt import QtCore, QtGui
# IPython imports.
from IPython.utils.traitlets import HasTraits, TraitType
#-----------------------------------------------------... | {
"content_hash": "ce935f40c8ed115e5747fde82e5f11f7",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 80,
"avg_line_length": 37.367924528301884,
"alnum_prop": 0.5740974501388538,
"repo_name": "sodafree/backend",
"id": "096c27ea1aba7f945bb0ca20763cc1abfb2e1e3d",
"size": "39... |
from django.shortcuts import render
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from openid.consumer import discover
from openid.server import server
from openid.extensions import sreg, ax
# Create your views here.
from django.http import HttpResponse
from openid.store... | {
"content_hash": "a7b962d88f90736e1ee9fb871d7468b2",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 120,
"avg_line_length": 39.46853146853147,
"alnum_prop": 0.67487597448618,
"repo_name": "qmagico/openid_server",
"id": "f8803991a595b9d95749570dac0b0332bfbb7b68",
"size": ... |
import inspect
import sys
import time
import pipes.pipe
from pipes import *
from writers import VideoServer
from sensors.pisensor import PiSensor
def get_pipes():
classes = inspect.getmembers(sys.modules[__name__], inspect.isclass)
return [c[1]() for c in classes
if pipes.pipe.Pipe in c[1].__bases... | {
"content_hash": "61ae3518c0bc5ead64987550520229d2",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 72,
"avg_line_length": 25.61111111111111,
"alnum_prop": 0.5672451193058569,
"repo_name": "jstriebel/webcam-effects",
"id": "64badc9b65a30328de0a4634d45289afd1a96afc",
"size... |
from overkill import manager
from overkill.extra.mail import MailNotifySink
from overkill.extra.notify import Notify
from overkill.sinks import SimpleSink
from subprocess import Popen
manager.add_sink(MailNotifySink())
class BatteryNotifySink(SimpleSink, Notify):
summary = "Battery Warning"
subscription = "ba... | {
"content_hash": "37e89c3c9d018b4a6e7f83da2a1748ad",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 67,
"avg_line_length": 32.638888888888886,
"alnum_prop": 0.6408510638297872,
"repo_name": "Stebalien/overkill-config",
"id": "c9f3f11243c676d143a41b8d26d256d291144ee4",
"si... |
import asyncio
import atexit
import contextlib
import importlib
import inspect
import os
import types
from collections import defaultdict
from functools import partial
from statistics import mean, median
from time import sleep
from timeit import default_timer
from unittest.mock import patch
from urllib.parse import url... | {
"content_hash": "3cf4742abca2a57665d4afedca8d46b3",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 110,
"avg_line_length": 33.389920424403186,
"alnum_prop": 0.5927867810613282,
"repo_name": "jmb/geopy",
"id": "42889bfd2659139564f0d1c36b6206d058ea44ce",
"size": "12594",
... |
from gala import classify
datas = []
labels = []
import numpy as np
for i in range(4):
data, label = classify.load_training_data_from_disk('training-data-%i.h5' % i,
names=['data', 'labels'])
datas.append(data)
labels.append(label[:, 0])
X0 = np.c... | {
"content_hash": "22496b758087820f2904f233e692a796",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 82,
"avg_line_length": 39.241379310344826,
"alnum_prop": 0.5949033391915641,
"repo_name": "jni/gala-scripts",
"id": "a53efad364f19720cb45cd178c674665d60f73c7",
"size": "115... |
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self): # Показывает в консоле списки
return "%s:%s:%s:%s" % (self.id, self.name,... | {
"content_hash": "c580a204075ffc1a8013d0cdbffb0fb9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 103,
"avg_line_length": 30,
"alnum_prop": 0.580952380952381,
"repo_name": "zr4x/pythonTests",
"id": "e7996b47f8c201a35e70ee9f4b5252569e93ab9c",
"size": "678",
"binary": f... |
from __future__ import annotations
from dynaconf import settings
print("EXAMPLE_ prefix")
settings.configure(ENVVAR_PREFIX_FOR_DYNACONF="EXAMPLE")
print(settings.VAR1)
print(settings.VAR2)
print("_ prefix")
settings.configure(ENVVAR_PREFIX_FOR_DYNACONF="")
print(settings.VAR1)
print(settings.VAR2)
print("no prefix ... | {
"content_hash": "1b628f6110e492168c822a4cfd5450f0",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 56,
"avg_line_length": 23.36,
"alnum_prop": 0.7825342465753424,
"repo_name": "rochacbruno/dynaconf",
"id": "eb88dd647af7af0cb8f36216e4bff98f79fa594a",
"size": "584",
"bin... |
import os
import sys
import unittest
classifiers = """\
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: Information Technology
Intended Audience :: System Administrators
Intended Audience :: Telecommunications Indust... | {
"content_hash": "9c4a1d3f6ebafa8103c3ecc487b16aa6",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 99,
"avg_line_length": 26.247619047619047,
"alnum_prop": 0.6186502177068215,
"repo_name": "etingof/pyasn1",
"id": "dc5d7042a1a3617d31148ff4b0d30fcbbb63d762",
"size": "2935... |
"""Common profiles are defined here to be easily used within a project using --profile {name}"""
from typing import Any, Dict
black = {
"multi_line_output": 3,
"include_trailing_comma": True,
"force_grid_wrap": 0,
"use_parentheses": True,
"ensure_newline_before_comments": True,
"line_length": 8... | {
"content_hash": "6b5c6ac08f1a7ef2843744bc0880d0fc",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 96,
"avg_line_length": 24.63953488372093,
"alnum_prop": 0.6045304388862671,
"repo_name": "glenngillen/dotfiles",
"id": "21d064630068fec7e69cbf9c4089327f786e88d1",
"size": "... |
import numpy as np
import argparse
import os
import sys
import signal
import time
import socket
from contextlib import closing
import math
import paddle
import paddle.fluid as fluid
import paddle.fluid.profiler as profiler
import paddle.fluid.unique_name as nameGen
from paddle.fluid import core
import unittest
from mul... | {
"content_hash": "9122c188099444e3a3e19566ee5fa9d1",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 65,
"avg_line_length": 25.829268292682926,
"alnum_prop": 0.7214353163361662,
"repo_name": "luotao1/Paddle",
"id": "22ca990c55afde93e2b28ab1167785e6e0559f49",
"size": "1670"... |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import json
def main():
asset_results = []
incident = demisto.incident()
if not incident:
raise ValueError("Error - demisto.incident() expected to return current incident "
"from co... | {
"content_hash": "3d34ba6bac431dfaa9267d07eaeb1032",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 100,
"avg_line_length": 36.794117647058826,
"alnum_prop": 0.6258992805755396,
"repo_name": "demisto/content",
"id": "32e2d1dcfdce6751e3c469e2510a8130a6820904",
"size": "125... |
"""
This module is for internal use only; no backwards-compatibility guarantees.
The classes in this file keep shared state, and organize metrics information.
Available classes:
- MetricKey - Internal key for a metric.
- MetricResult - Current status of a metric's updates/commits.
- _MetricsEnvironment - Keeps track... | {
"content_hash": "4c1659ecd57dabb19663fdaa8bf2bb85",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 80,
"avg_line_length": 34.0188679245283,
"alnum_prop": 0.6891846921797005,
"repo_name": "RyanSkraba/beam",
"id": "691891484e43a0c8fa3b9a54608908bfc7398b54",
"size": "9800"... |
from collections.abc import Mapping
import re
import warnings
import pytest
from scipy import sparse
from sklearn.feature_extraction.text import strip_tags
from sklearn.feature_extraction.text import strip_accents_unicode
from sklearn.feature_extraction.text import strip_accents_ascii
from sklearn.feature_extraction... | {
"content_hash": "0f8640a2b1cda85e9a7b93dab84beda7",
"timestamp": "",
"source": "github",
"line_count": 1253,
"max_line_length": 79,
"avg_line_length": 35.44213886671987,
"alnum_prop": 0.6387894345740728,
"repo_name": "chrsrds/scikit-learn",
"id": "59ddcb5fa1ac351866f76f1572137d3d91c5cd18",
"size":... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v11.errors",
marshal="google.ads.googleads.v11",
manifest={"CustomInterestErrorEnum",},
)
class CustomInterestErrorEnum(proto.Message):
r"""Container for enum describing possible custom interest
errors.
... | {
"content_hash": "748e30575981548f32fda4d728a10a09",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 28,
"alnum_prop": 0.6607142857142857,
"repo_name": "googleads/google-ads-python",
"id": "bbf5b64d012ec4df1d7b999269221df040f8cd77",
"size": "1440",
... |
import gzip
import json
import zlib
import mock
import pytest
from s4 import utils
class TestTryDecompress:
def test_bad_value(self):
with pytest.raises(ValueError) as exc:
utils.try_decompress(b"Not compressed data")
assert str(exc.value) == "Unknown compression format"
def tes... | {
"content_hash": "91e8cf459cf278985b9c6c76222c042b",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 80,
"avg_line_length": 27.641025641025642,
"alnum_prop": 0.6224489795918368,
"repo_name": "MichaelAquilina/s3backup",
"id": "8d0362a2d4c7ce7af5bb2976bcee7ba76e218cfa",
"siz... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from rq import Connection, Queue, Worker
if __name__ == '__main__':
# Tell rq what Redis connection to use
with Connection():
q = Queue()
Worker(q).work()
| {
"content_hash": "215474a84805c1aeb813bbc89b819aea",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 29,
"alnum_prop": 0.5862068965517241,
"repo_name": "jclee81/sktacc",
"id": "4feb2179ebfcbe2f12794bc7ed789e3fecc8433c",
"size": "314",
"binary": fal... |
from botocore.exceptions import DataNotFoundError
from botocore.docs.utils import get_official_service_name
from botocore.docs.client import ClientDocumenter
from botocore.docs.waiter import WaiterDocumenter
from botocore.docs.paginator import PaginatorDocumenter
from botocore.docs.bcdoc.restdoc import DocumentStructur... | {
"content_hash": "9fcaf7cbe8b16a9065ab375d341f6991",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 37.42307692307692,
"alnum_prop": 0.6413155190133607,
"repo_name": "VirtueSecurity/aws-extender",
"id": "c9b5d7b31e1cc5c5d454100c0b5abe63d80069d9",
"s... |
from JumpScale import j
import sys
j.application.debug = (sys.argv[1] == 'True')
# Start debugging if 1+1 == 2
if 1 + 1 == 2:
j.application.break_into_jshell("DEBUG STARTED")
| {
"content_hash": "b35a6f72cebed493af6806ff99d9251e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 52,
"avg_line_length": 25.714285714285715,
"alnum_prop": 0.6722222222222223,
"repo_name": "Jumpscale/jumpscale_core8",
"id": "7a16545195c4cadd75d1bad4c3651e02b1a141ac",
"siz... |
def undeploy_model(project_id, model_id):
"""Undeploy a model."""
# [START automl_undeploy_model]
from google.cloud import automl
# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# model_id = "YOUR_MODEL_ID"
client = automl.AutoMlClient()
# ... | {
"content_hash": "03d4bdaeeb47ddea06e1e28bb6d8bd39",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 36.875,
"alnum_prop": 0.6779661016949152,
"repo_name": "googleapis/python-automl",
"id": "25b5cdb7c507832464daafa6595bdded52086fa6",
"size": "1165",
... |
"""Run interop (cross-language) tests in parallel."""
from __future__ import print_function
import argparse
import atexit
import itertools
import json
import multiprocessing
import os
import re
import subprocess
import sys
import tempfile
import time
import uuid
import six
import traceback
import python_utils.docker... | {
"content_hash": "1bf3f11a1b2bb6638fdab13164747902",
"timestamp": "",
"source": "github",
"line_count": 1234,
"max_line_length": 177,
"avg_line_length": 34.79011345218801,
"alnum_prop": 0.6093265938366216,
"repo_name": "kskalski/grpc",
"id": "1e702a863651b82b738a0aeebc808e3f47f36ade",
"size": "4353... |
from __future__ import unicode_literals
def get_jenv():
import frappe
if not getattr(frappe.local, 'jenv', None):
from jinja2 import Environment, DebugUndefined
# frappe will be loaded last, so app templates will get precedence
jenv = Environment(loader = get_jloader(),
undefined=DebugUndefined)
set_fil... | {
"content_hash": "b9d816b5e2f9cbc544bfa253e45c6f02",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 113,
"avg_line_length": 29.52863436123348,
"alnum_prop": 0.6981948381321796,
"repo_name": "paurosello/frappe",
"id": "dca6d8a066d4f1bc9e16a867ef540b188652d008",
"size": "6... |
"""This code example archives ad units.
The parent ad unit and all ad units underneath it will be archived. To create ad
units, run create_ad_units.py.
Tags: InventoryService.getAdUnitsByStatement
"""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
# Locate the client library. If module was installed via "setup.p... | {
"content_hash": "6b01c20079792eacea01280e6c23851d",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 80,
"avg_line_length": 33.203125,
"alnum_prop": 0.6705882352941176,
"repo_name": "donspaulding/adspygoogle",
"id": "3261f760e176bba818bddb7cd414aa2ca4ac527f",
"size": "2743... |
from Tkinter import *
import time
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
scale = Scale(frame, from_=0, to=180,
orient=HORIZONTAL, command=self.update)
scale.grid(row=0)
pwm = Pwm()
def update(self, angle):
duty =... | {
"content_hash": "f66f21d108ab2d2f74da946d273b2bf0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 53,
"avg_line_length": 20.545454545454547,
"alnum_prop": 0.5796460176991151,
"repo_name": "eugenekolo/kololib",
"id": "e3b1d5620389e10a81018ddae8f4235284b593b0",
"size": "4... |
"""Load data from the specified paths and format them for training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
import tensorflow as tf
from data_augmentation import augment_data
LABEL_NAME = "gesture"
DATA_NAME = "a... | {
"content_hash": "0a3efb19fc8d0581134371b582c23769",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 113,
"avg_line_length": 43.57303370786517,
"alnum_prop": 0.5941206807632801,
"repo_name": "galak/zephyr",
"id": "35ff4825a8beb6fe3d95dc53960bdadf3dfe2fca",
"size": "4628",
... |
from ..Constant import Constant
from ..Minutes import Minutes
from ..Irradiance import Irradiance
from .BaseComponent import BaseComponent
class SolarIrradianceComponent(BaseComponent):
''' handle GM1 solar irradiance '''
# TODO: add support for codes from 10-97
DATA_FLAGS = {"00": "Untested",
... | {
"content_hash": "9f3a6ea58bc22db3850444b714137fb5",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 104,
"avg_line_length": 56.23076923076923,
"alnum_prop": 0.5444596443228454,
"repo_name": "haydenth/ish_parser",
"id": "81503feefc98f40303685d9428ea5209b24ee4af",
"size": "... |
import os
import json
import requests
import pkg_resources
from pkg_resources import DistributionNotFound
from types import ModuleType
from .constants import HTTP_STATUS_CODE, ERROR_CODE, URL
from . import resources, utility
from .errors import (BadRequestError, GatewayError,
ServerError)
de... | {
"content_hash": "0cc13b989dbd81e72258fad057b0d598",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 133,
"avg_line_length": 32.61052631578947,
"alnum_prop": 0.5714977404777276,
"repo_name": "razorpay/razorpay-python",
"id": "f835e1397e1e05c774ba9b83eeb6beee9a7a62e0",
"si... |
"""
===============================================================================
Selecting the number of clusters with silhouette analysis on KMeans clustering
===============================================================================
Silhouette analysis can be used to study the separation distance between the... | {
"content_hash": "60e6569bd732f9d6d858dd43e2fadbb3",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 79,
"avg_line_length": 41.92253521126761,
"alnum_prop": 0.6643709054258358,
"repo_name": "raghavrv/scikit-learn",
"id": "ac36bc1fe72e5f89af0084efc178733b6b50773d",
"size":... |
"""Write a sample config for a given directory containing fastq files
following SRA naming conventions
"""
#--- standard library imports
#
import os
import sys
import logging
import glob
import subprocess
import argparse
import re
#--- third-party imports
#
import yaml
# --- project specific imports
#
# add lib dir f... | {
"content_hash": "9133632e37ef573b7c4cda67a19efea5",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 121,
"avg_line_length": 34.06111111111111,
"alnum_prop": 0.5728266188223781,
"repo_name": "gis-rpd/pipelines",
"id": "1bc419cc4887df29762d9dc6450b0962436a044e",
"size": "6... |
click(Pattern("Ilama.png").targetOffset(23,0))
exit(0) | {
"content_hash": "2ad10ae0ec705a22d59eb8e7c1471d05",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 46,
"avg_line_length": 27,
"alnum_prop": 0.7407407407407407,
"repo_name": "silverbulleters/vanessa-behavoir",
"id": "b70e6ec6b30254ec1870afd3f4c71846276fe7ae",
"size": "54",... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('release', '0002_auto_20180815_2248'),
('build', '0014_auto_20180601_2003'),
]
operations = [
migrations.Add... | {
"content_hash": "c7977882d9ec9a8a9f357304cd4012ba",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 186,
"avg_line_length": 33.48,
"alnum_prop": 0.6176821983273596,
"repo_name": "SalesforceFoundation/mrbelvedereci",
"id": "3f0377ee604aced1d962d32dd4df47b837bef656",
"size"... |
from django.test import TestCase
from rest_framework.reverse import reverse
class CiviliansTestCase(TestCase):
fixtures = [
'civilians.json',
'series.json',
]
def test_civilian_list(self):
resp = self.client.get(reverse('api:v1:civilian-list'))
self.assertEqual(resp.statu... | {
"content_hash": "8f7e38c1e9c89924a95b789135bc7cad",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 111,
"avg_line_length": 32.2,
"alnum_prop": 0.6601597160603372,
"repo_name": "reiniervdwindt/power-rangers-api",
"id": "d2272e48cfcbb9120bda68064be08161f90aa598",
"size": "... |
import numpy as np
import tensorflow as tf
def xavier_init(fan_in, fan_out, *, const=1.0, dtype=tf.dtypes.float32):
k = const * np.sqrt(6.0 / (fan_in + fan_out))
return tf.random.uniform((fan_in, fan_out), minval=-k, maxval=k, dtype=dtype)
def sample_bernoulli(ps):
return tf.nn.relu(tf.sign(ps - tf.rand... | {
"content_hash": "24ca19bfe76915e10c62a251d0d4ade0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 87,
"avg_line_length": 31.2,
"alnum_prop": 0.6773504273504274,
"repo_name": "meownoid/tensorfow-rbm",
"id": "57392a9140466c0030da2228ed615075d8539ef3",
"size": "468",
"bi... |
import base64
import os
import re
import random
import shutil
import socket
import string
import json
import ipaddress
import charms.leadership
from shutil import move
from shlex import split
from subprocess import check_call
from subprocess import check_output
from subprocess import CalledProcessError
from charms ... | {
"content_hash": "4cf13292b20499d8ce04d971a5ff65e4",
"timestamp": "",
"source": "github",
"line_count": 1246,
"max_line_length": 79,
"avg_line_length": 36.08667736757624,
"alnum_prop": 0.6516768970732141,
"repo_name": "KarolKraskiewicz/kubernetes",
"id": "d27caf59f57e68ee6f606c397b87837188e40c91",
... |
from datapackage_pipelines_mojp.common.processors.base_processors import BaseProcessor
import logging, datetime
from copy import deepcopy
class Processor(BaseProcessor):
def _filter_resource_descriptor(self, resource_descriptor):
super(Processor, self)._filter_resource_descriptor(resource_descriptor)
... | {
"content_hash": "b5acc49008fff220ada71dd3ff235921",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 86,
"avg_line_length": 33.4,
"alnum_prop": 0.6287425149700598,
"repo_name": "Beit-Hatfutsot/mojp-dbs-pipelines",
"id": "2302e8dafa86c7ddefd50116844604c68a13d17e",
"size": "... |
import base64
import urllib.request, urllib.parse, urllib.error
import urllib.parse
from saml2.authn_context import INTERNETPROTOCOLPASSWORD
from saml2.response import LogoutResponse
from saml2.client import Saml2Client
from saml2 import samlp, BINDING_HTTP_POST, BINDING_HTTP_REDIRECT
from saml2 import saml, config, c... | {
"content_hash": "d2d110eb3912f6e785f0e82acf423e18",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 80,
"avg_line_length": 40.549668874172184,
"alnum_prop": 0.5900702270129021,
"repo_name": "rohe/pysaml2-3",
"id": "cb684c756870d6a08ca39d1b67a1822d8e546171",
"size": "1841... |
import uuid
import sqlalchemy
from keystone.common import sql
from keystone import exception
class PolicyAssociation(sql.ModelBase, sql.ModelDictMixin):
__tablename__ = 'policy_association'
attributes = ['policy_id', 'endpoint_id', 'region_id', 'service_id']
# The id column is never exposed outside this... | {
"content_hash": "e1e54868ef74def2a98469859da79278",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 78,
"avg_line_length": 43.92063492063492,
"alnum_prop": 0.5898084568124322,
"repo_name": "himanshu-setia/keystone",
"id": "aacbb083216f363dd3a6d351999d5d638d8b5a50",
"size... |
import unittest
from sqlalchemy.exc import IntegrityError
from agentserver.db.models import (models, User, UserAuthToken,
Agent, AgentAuthToken, AgentDetail)
class TestDb(unittest.TestCase):
@classmethod
def setUpClass(cls):
models.connect('sqlite:///:memory:')
@classmetho... | {
"content_hash": "dbfc20e280923d99e036800e75142cd1",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 74,
"avg_line_length": 39.70967741935484,
"alnum_prop": 0.5696588139723802,
"repo_name": "silverfernsys/agentserver",
"id": "39d9bbb475fe63e498ae7067710bcb2e246d7d6b",
"si... |
from .essential import Essential
class Action(Essential):
def __init__(self, app, id_):
super().__init__(app, id_)
self.running = True
async def execute(self):
self.logger.info('action_run')
try:
result = await self.run()
except:
self.logger.er... | {
"content_hash": "6af28e8a5b3afc6fd8bc8f2cc38f9a98",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 60,
"avg_line_length": 22.70967741935484,
"alnum_prop": 0.5426136363636364,
"repo_name": "insolite/alarme",
"id": "edbb4ede3d3242becc36e37b9568068ba51cf873",
"size": "704",... |
from __future__ import print_function
from .charset import MBLENGTH
from ._compat import PY2, range_type
from .constants import FIELD_TYPE, SERVER_STATUS
from . import err
from .util import byte2int
import struct
import sys
DEBUG = False
NULL_COLUMN = 251
UNSIGNED_CHAR_COLUMN = 251
UNSIGNED_SHORT_COLUMN = 252
UNSIG... | {
"content_hash": "b2b55e048fd84fda4a2acda782c0e96d",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 112,
"avg_line_length": 35.002932551319645,
"alnum_prop": 0.5961796246648794,
"repo_name": "sergey-dryabzhinsky/dedupsqlfs",
"id": "e302edab37549339499f458059142d39e769084a"... |
from __future__ import absolute_import
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
import ujson
CIRCLECI_SUBJECT_TEMPLATE = '{repository_name}'
CIRCLECI_MESSAGE_TEMPLATE =... | {
"content_hash": "e3aaa5f4026b14abb65268a76f5e84e4",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 123,
"avg_line_length": 33.88095238095238,
"alnum_prop": 0.6985242445537596,
"repo_name": "peiwei/zulip",
"id": "670fd610b1f32d658b4f1640ce1fb0d929c9c40e",
"size": "1461",
... |
import json
from copy import copy
import requests
MOPIDY_API = '/mopidy/rpc'
_base_dict = {'jsonrpc': '2.0', 'id': 1, 'params': {}}
class Mopidy:
def __init__(self, url):
self.is_playing = False
self.url = url + MOPIDY_API
self.volume = None
self.clear_list(force=True)
... | {
"content_hash": "b9238ce75e4b7cdcf54bbfa07bf2e288",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 78,
"avg_line_length": 32.24226804123711,
"alnum_prop": 0.5278976818545164,
"repo_name": "MycroftAI/mycroft-core",
"id": "9efd1dda43d65f5532d84b65642ed4117f0e25ea",
"size"... |
""" This script loads the raw phone_brand_device_model phone set, creates the
features and deals with NaN values."""
import os
from os import path
import pandas as pd
import pickle as pkl
from dotenv import load_dotenv, find_dotenv
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import St... | {
"content_hash": "b04041a97f07d208ab70a6941116d7ac",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 88,
"avg_line_length": 46.935064935064936,
"alnum_prop": 0.6768123962368566,
"repo_name": "Kebniss/TalkingData-Mobile-User-Demographics",
"id": "127bf571260653ac1a54bd5bc14af... |
import os
import l20n.format.lol.parser as parser
import l20n.format.lol.serializer as serializer
import l20n.format.lol.ast as ast
import codecs
def read_file(path):
with file(path) as f:
return f.read()
def write_file(path, s):
f = codecs.open(path, encoding='utf_8', mode='w+')
f.write(s)
f.... | {
"content_hash": "73242eca50a30fdad9e56a26cf62eba9",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 74,
"avg_line_length": 25.315068493150687,
"alnum_prop": 0.5633116883116883,
"repo_name": "stasm/python-l20n",
"id": "a6b9b8b8ff77092031819164afb4d0c66442cbfb",
"size": "18... |
class ConfigurationError(Exception):
"""Raised when something is incorrectly configured."""
class ConnectionFailure(Exception):
"""Raised when a connection to the thrift source cannot be made os is lost."""
class ServerSelectionError(Exception):
"""Thrown when no thrift source is available for an operat... | {
"content_hash": "9b2acea869bf50dc248e5067b01cf911",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 82,
"avg_line_length": 29.5,
"alnum_prop": 0.7433414043583535,
"repo_name": "Free0xFF/flumelogger-for-python3",
"id": "71f00585dc35703d83ed041ec529687f7ac1c248",
"size": "4... |
"""
WSGI config for ExampleDjango project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | {
"content_hash": "b3347bdf7137e273ef65d614fbc73021",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 25.25,
"alnum_prop": 0.7772277227722773,
"repo_name": "GoberInfinity/ExampleDjango",
"id": "ea537b1bba99e010dcab502fc522fe6bd3e05b95",
"size": "404",... |
"""
Copyright (c) 2015 Michael Bright and Bamboo HR LLC
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... | {
"content_hash": "a5f502c746cc185629cedab4cb09c505",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 73,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.7351351351351352,
"repo_name": "BambooHR/rapid",
"id": "0fa480f0d0354fd7bfa18139de508973a49a7ff3",
"size": "740",... |
from StringIO import StringIO
from markdown import Markdown
from bleach import linkify, callbacks
markdown_extension_list = [
"extra",
"admonition",
"codehilite",
"nl2br",
"sane_lists",
"toc",
"wikilinks",
]
md = Markdown(extensions=markdown_extension_list)
def markdown_convert(source):
... | {
"content_hash": "3091d2a2acb64f673ad094302786262f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 62,
"avg_line_length": 23.511627906976745,
"alnum_prop": 0.6439169139465876,
"repo_name": "PoolC/Yuzuki",
"id": "34b66d664c799af5417d514015d60d24e4df7f99",
"size": "1035",
... |
"""A Task logger that presents our DB interface,
but exists entirely in memory and implemented with dicts.
Authors:
* Min RK
TaskRecords are dicts of the form::
{
'msg_id' : str(uuid),
'client_uuid' : str(uuid),
'engine_uuid' : str(uuid) or None,
'header' : dict(header),
... | {
"content_hash": "1c5bd263b78a22797ef29f4a74c71a70",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 110,
"avg_line_length": 32.81818181818182,
"alnum_prop": 0.5718788805043462,
"repo_name": "martydill/url_shortener",
"id": "8754c028b129227a0fd62db8c967c2304389c349",
"siz... |
from tulip import tlp
# The updateVisualization(centerViews = True) function can be called
# during script execution to update the opened views
# The pauseScript() function can be called to pause the script execution.
# To resume the script execution, you will have to click on the "Run script " button.
# The runGrap... | {
"content_hash": "e039ab73f6861bcca1c3102069746449",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 105,
"avg_line_length": 46.26315789473684,
"alnum_prop": 0.7305379489679831,
"repo_name": "spaghetti-open-data/ODFest2017-horizon2020-network",
"id": "d62af449e1125fe1ed5bd2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.