text stringlengths 4 1.02M | meta dict |
|---|---|
"""Generic presubmit checks that can be reused by other presubmit checks."""
import os as _os
_HERE = _os.path.dirname(_os.path.abspath(__file__))
# Justifications for each filter:
#
# - build/include : Too many; fix in the future.
# - build/include_order : Not happening; #ifdefed includes.
# - build/namespace ... | {
"content_hash": "f11cd859ad8c67c56318e5147680af24",
"timestamp": "",
"source": "github",
"line_count": 1134,
"max_line_length": 80,
"avg_line_length": 36.7962962962963,
"alnum_prop": 0.6654923670525079,
"repo_name": "liaorubei/depot_tools",
"id": "9179fb6ee35436d654ecae91ed4e02692514d0b3",
"size":... |
import collections
import contextlib
import functools
import gc
import inspect
import itertools
import re
import sys
import uuid
import weakref
import eventlet.greenpool
import eventlet.greenthread
import semantic_version
import six
from yaql.language import contexts
import yaql.language.exceptions
import yaql.langua... | {
"content_hash": "f5dc02805ac3ee397f03b6ba4c080300",
"timestamp": "",
"source": "github",
"line_count": 721,
"max_line_length": 79,
"avg_line_length": 30.21775312066574,
"alnum_prop": 0.6032496442832882,
"repo_name": "DavidPurcell/murano_temp",
"id": "57757a8a885f98d4e0a9a3adae89020e9c3608f6",
"siz... |
{
' (leave empty to detach account)': ' (leave empty to detach account)',
' Module is the main communications hub of the Sahana system. It is used to send alerts and/or messages using SMS & Email to various groups and individuals before, during and after a disaster.': ' Module is the main communications hub of the Sa... | {
"content_hash": "9b6772561d3586adea569ffaff713c1b",
"timestamp": "",
"source": "github",
"line_count": 4069,
"max_line_length": 951,
"avg_line_length": 60.73212091422954,
"alnum_prop": 0.7284263856684431,
"repo_name": "nicopresto/webSkapes",
"id": "077d8db7daa4c2ab6ee976b06ab6b2b31fc92e37",
"size"... |
import os
def ensuredirs(path, mode=0777):
try:
os.makedirs(path, mode)
except OSError:
if not os.path.isdir(path):
raise
| {
"content_hash": "a0840b7fea477091c5b9251b4c6daaad",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 35,
"avg_line_length": 19.875,
"alnum_prop": 0.5786163522012578,
"repo_name": "zielmicha/satori",
"id": "1557dae36221a195b570cab6cbb6360ec984f790",
"size": "192",
"binary"... |
"""cyme.managers
- These are the managers for our models in :mod:`cyme.models`.
- They are not to be used directly, but accessed through
the ``objects`` attribute of a Model.
"""
from __future__ import absolute_import
from anyjson import serialize
from celery import current_app as celery
from djcelery.managers ... | {
"content_hash": "e5f02d5b8c8caae59c658a2af7ce405f",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 78,
"avg_line_length": 32.52142857142857,
"alnum_prop": 0.5873050735778608,
"repo_name": "celery/cyme",
"id": "a53dbba3e8c3abdf7ee0722c389b9883e16d75ca",
"size": "4553",
... |
import tfrrs,bs4,requests,cli
| {
"content_hash": "1f7a017bb54429ecfc058cdd9b067f51",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 29,
"avg_line_length": 30,
"alnum_prop": 0.8333333333333334,
"repo_name": "ethanwh/tfrrs",
"id": "ffb7bda4dd7dd2692a015a038f9dc00bbefd29dd",
"size": "30",
"binary": false,... |
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow... | {
"content_hash": "828413c7a5e6fcd4baaba20dc5c9e5e7",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 66,
"avg_line_length": 33.177304964539005,
"alnum_prop": 0.7736212056434374,
"repo_name": "hlzz/dotfiles",
"id": "4857135157055709794301ac52c3d40ac3c88e76",
"size": "4701"... |
from setuptools import setup
setup(name="x")
| {
"content_hash": "bfc25db848a6582a019d3ce9db7fadd7",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 28,
"avg_line_length": 22.5,
"alnum_prop": 0.7777777777777778,
"repo_name": "ccwang002/2014-Taipeipy-venv",
"id": "f8ea3023540effcb9bed3b64f87a87086e9c67ae",
"size": "45",
... |
import web
from libraries.utils import hash_utils
from localsys.storage import db
import localsys
from localsys import storage
import re
import base64
class users_model:
@classmethod
def authorize(cls):
"""
Returns user_id if request is authorized, else 0.
Authorizes by checking the ... | {
"content_hash": "83abb59d9eb8374b26c66a7e2f5624ea",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 122,
"avg_line_length": 33.79245283018868,
"alnum_prop": 0.5801228364042434,
"repo_name": "mapto/sprks",
"id": "ef89f3e01a810b4e1535f1466fe6dc6ae056b650",
"size": "5373",
... |
from panda3d.core import *
from panda3d.direct import *
from toontown.toonbase.ToonBaseGlobal import *
from toontown.toonbase.ToontownGlobals import *
from toontown.distributed.ToontownMsgTypes import *
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import St... | {
"content_hash": "fb7bdfa819238ff892c8a606fbbe4752",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 303,
"avg_line_length": 42.72185430463576,
"alnum_prop": 0.647651526895055,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "4095b013d760f086e72468d6b8e8bdc60d2dd2f... |
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal
from png import Reader
from sm.engine.png_generator import PngGenerator
def test_png_gen_greyscale_works():
alpha_ch = np.array([[1, 1, 1]])
gen = PngGenerator(alpha_ch, greyscale=True)
img_data = np.array([[0., 5., 10.]])
... | {
"content_hash": "a4907e685d7713359fdcff9df5ae5554",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 100,
"avg_line_length": 32.36363636363637,
"alnum_prop": 0.6587078651685393,
"repo_name": "SpatialMetabolomics/SM_distributed",
"id": "037d974de56a55b9198c4293ea07142b8599337... |
import logging
import classad
from adstash.ad_sources.generic import GenericAdSource
from adstash.convert import to_json, unique_doc_id
class FileAdSource(GenericAdSource):
def __init__(self, checkpoint_file=None, **kwargs):
pass
def fetch_ads(self, ad_file):
"""
Generates one Cla... | {
"content_hash": "43f7dd59593b7ac2fa17619add8fe5f2",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 102,
"avg_line_length": 34.59322033898305,
"alnum_prop": 0.506124448799608,
"repo_name": "htcondor/htcondor",
"id": "1d52fd8393bd086a57e7a6d772d90cd93888bd67",
"size": "268... |
import os
import unittest
import mock
from unittest import TestCase
from dropbot.bot import DropBot
class DropBotTestCase(TestCase):
def setUp(self):
self.bot = DropBot('test@test.com', 'testpassword')
def call_command(self, command, args=[]):
"""Fakes a call to a bot command"""
msg ... | {
"content_hash": "b8642df2050d3df505b2ae2789190e86",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 123,
"avg_line_length": 38.30120481927711,
"alnum_prop": 0.6322743000943692,
"repo_name": "nikdoof/dropbot",
"id": "1905043a9b6e6111e35b25f99323b9a761b96d0e",
"size": "635... |
import datetime
import functools
import json
from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied
import olympia.core.logger
from . import models as context
task_log = olympia.core.logger.getLogger('z.task')
def login_required(f=None, redirect=True):
""... | {
"content_hash": "5e665fd87b96d58d92f165bc3c842781",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 78,
"avg_line_length": 29.863387978142075,
"alnum_prop": 0.605672461116194,
"repo_name": "mozilla/olympia",
"id": "5158e8465b271b0da3ab10f3a364a2464288bd15",
"size": "5465... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0036_remove-auto-doctype'),
]
operations = [
migrations.CreateModel(
name='HTMLFile',
fields=[
],
... | {
"content_hash": "b53a304acf7a4b627efb3712e63b6c56",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 49,
"avg_line_length": 20.52173913043478,
"alnum_prop": 0.4872881355932203,
"repo_name": "rtfd/readthedocs.org",
"id": "dee21a140bd0b1c646c533dc0005d5f190018253",
"size": "... |
import paho.mqtt.client as mqtt
import json
import mqttsqlite.settings.private_settings as Settings
MANAGEMENT_PASSWORD = Settings.QUERY_PASSWORD
MQTT_HOST = Settings.MQTT_HOST
MQTT_PORT = Settings.MQTT_PORT
ROOT_TOPIC = Settings.ROOT_TOPIC
desired_topic = 'salon/humedad'
payload = {}
payload['client'] = 'simple_exam... | {
"content_hash": "c652e3009911f6ff2eef4afcfd4ea8b6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 56,
"avg_line_length": 28.07894736842105,
"alnum_prop": 0.7104029990627929,
"repo_name": "rdiaz82/mqttSqlLite",
"id": "b4168883cf99b501bb831650d0683b3047da0387",
"size": "1... |
from django.test import SimpleTestCase
from corehq.apps.app_manager.models import Application, AutoSelectCase, AUTO_SELECT_USER, AUTO_SELECT_CASE, \
LoadUpdateAction, AUTO_SELECT_FIXTURE, AUTO_SELECT_RAW, WORKFLOW_MODULE, DetailColumn, WORKFLOW_PREVIOUS
from corehq.apps.app_manager.tests.util import TestFileMixin
f... | {
"content_hash": "140942fabd30b040e787eaa8c731425e",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 109,
"avg_line_length": 41.294372294372295,
"alnum_prop": 0.6216584547646504,
"repo_name": "SEL-Columbia/commcare-hq",
"id": "26247b046cf9b5e4bbb8dc71b2e0803204bb4130",
"s... |
"""This code example updates a creative wrapper to the 'OUTER' wrapping order.
To determine which creative wrappers exist, run get_all_creative_wrappers.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For mor... | {
"content_hash": "9d48c68fcc994f4e76a438ecc6b4d59e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 78,
"avg_line_length": 34.753846153846155,
"alnum_prop": 0.6923417441345728,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "926cb14f94d6382970cf5d445f00e5e85375ad24"... |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
# TLE:
# class Solution(object):
# def hasCycle(self, head):
# """
# :type head: ListNode
# :rtype: bool
# """
# ptr = head
# total_call = 0
# while True:
# ... | {
"content_hash": "1ad4d82a84a7eed1a86d2ef964cecc82",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 25.413793103448278,
"alnum_prop": 0.4762550881953867,
"repo_name": "heyf/cloaked-octo-adventure",
"id": "7b6ceb657ea7bc0bd9894ac503d6ab8d9c99083f",
"... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from units.modules.utils import set_module_args, exit_json, fail_json, AnsibleExitJson
from ansible.module_utils import basic
from ansible.modules.network.check_point import cp_mgmt_dynamic_object
OBJECT = {
"name... | {
"content_hash": "40a77f961f1396e6613bcf8ec4b2fa44",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 109,
"avg_line_length": 33.54639175257732,
"alnum_prop": 0.6760909649661955,
"repo_name": "thaim/ansible",
"id": "c2092a8a0f59efaadca1cd749b8e02792d536736",
"size": "3934",... |
import fcntl
import logging
import os
import psutil
from devil import devil_env
from devil.android.constants import file_system
from devil.android.valgrind_tools import base_tool
from devil.utils import cmd_helper
def _GetProcessStartTime(pid):
return psutil.Process(pid).create_time
class _FileLock(object):
""... | {
"content_hash": "7339c70800ae4863f57fa16af6fa219c",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 80,
"avg_line_length": 37.784615384615385,
"alnum_prop": 0.6515472312703583,
"repo_name": "XiaosongWei/chromium-crosswalk",
"id": "8794797ffcebba3b7dc033a6d66c28fe379e7527",... |
from locust import HttpUser, task, run_single_user
class QuickstartUser(HttpUser):
host = "http://localhost"
@task
def hello_world(self):
with self.client.get("/hello", catch_response=True) as resp:
pass # maybe set a breakpoint here to analyze the resp object?
# if launched direct... | {
"content_hash": "610d9d1fa0295b02ad203b092f34e0f9",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 81,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.6651685393258427,
"repo_name": "mbeacom/locust",
"id": "43e799a80e3e4e78b89e2f7b9d41770095840655",
"size": "445",... |
"""
File: <interest_rate.py>
Copyright (c) 2016 <Krystal Lee>
License: MIT
<Find the value of euros after 3 years with 5 percent interest with 1000 euros.>
"""
#Exercise 1.6
#Let p be a bank's interest_rate in percent per year. An initial amount A has grown to A(1+p/100)**n after n years.
#M... | {
"content_hash": "f123fd1087c4581514e7f8a610029bf9",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 120,
"avg_line_length": 29.166666666666668,
"alnum_prop": 0.6914285714285714,
"repo_name": "chapman-cpsc-230/hw1-lee301",
"id": "2eb4e3a693b4db93665e9646811324eb24081b05",
... |
"""
Tests by file. Runs through a list of *.xls files, and expects that the output for a *.xml
with a matching prefix before the . is as expected. Possibly risky: all tests in this file
are defined according to matching files.
"""
from lxml import etree
from formencode.doctest_xml_compare import xml_compare
from unit... | {
"content_hash": "931c764a7add7e2fc1c1833f3117bbc8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 94,
"avg_line_length": 42.21951219512195,
"alnum_prop": 0.6452917388792605,
"repo_name": "dorey/pyxform",
"id": "eab88b0d2f119413ac914142ae9e9a8f48c56962",
"size": "1731",
... |
from CIM15.IEC61970.Wires.Conductor import Conductor
class DCLineSegment(Conductor):
"""A wire or combination of wires not insulated from one another, with consistent electrical characteristics, used to carry direct current between points in the DC region of the power system.A wire or combination of wires not insu... | {
"content_hash": "2a3c6a132666319d1aef1ef62c1a6c7f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 383,
"avg_line_length": 48.666666666666664,
"alnum_prop": 0.708523592085236,
"repo_name": "rwl/PyCIM",
"id": "7ed1d62656b24bcf4c2144b7c3ca74a9a4daf608",
"size": "2414",
"... |
__author__ = 'stanley'
import json
import webapp2
from google.appengine.api import users
from init import *
from domain.user import *
from util.sanity_check import*
class LanguageHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/snippets/languages.html... | {
"content_hash": "4543343fa1d66ba96a03c207d57708bd",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 90,
"avg_line_length": 27.515625,
"alnum_prop": 0.5545144804088586,
"repo_name": "nimadini/Teammate",
"id": "dddc8af2595175994a9a3f80b61148e65a53f0c4",
"size": "3522",
"... |
"""
Feature extractor class for Speech2Text
"""
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import P... | {
"content_hash": "7a3372d43e2fb4c821da942fba34ccac",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 119,
"avg_line_length": 44.65573770491803,
"alnum_prop": 0.6209618208516887,
"repo_name": "huggingface/transformers",
"id": "af605626d0a848a5bd79ff7e9277d91f805a5743",
"si... |
import h5py
import mock
import os
import numpy as np
import pytest
from .mockdata import write_file
from .mockdata.xgm import XGM
from karabo_data import run_files_map, RunDirectory
def test_candidate_paths(tmp_path):
# 'real' paths (like /gpfs/exfel/d)
prop_raw_path = tmp_path / 'raw' / 'FXE' / '201901' / 'p... | {
"content_hash": "a5b81a37dd4f39412a75c3ad751fce60",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 75,
"avg_line_length": 32.265822784810126,
"alnum_prop": 0.6418203216947823,
"repo_name": "European-XFEL/h5tools-py",
"id": "f926d47c458a5d7701ec812d2a125c62e97d2d03",
"siz... |
import zlib
import logging
from contextlib import contextmanager
import redis
from redis.client import StrictRedis, StrictPipeline
class TracingPipeline(StrictPipeline):
"""Simple sublcass that logs pipeline stacks to the trace logger
"""
def __init__(self, *args, **kwargs):
self.trace = kwargs.p... | {
"content_hash": "083ac74efb6c81389ba9182b57987ce3",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 79,
"avg_line_length": 37.31428571428572,
"alnum_prop": 0.5545036892663233,
"repo_name": "nficano/jotonce.com",
"id": "203b3ad52a9281ca9160e4c9f2797a54f8da13b9",
"size": "... |
from wtforms import *
from wtforms.validators import *
import wtforms.fields
import wtforms.widgets
from util import MultiValueDict
class BaseForm(Form):
def __init__(self, handler=None, obj=None, prefix='', formdata=None, **kwargs):
if handler:
formdata = MultiValueDict()
for name in handler.reque... | {
"content_hash": "ad6d737616e94a7057e8bceb565a57c8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 87,
"avg_line_length": 26.916666666666668,
"alnum_prop": 0.6795665634674922,
"repo_name": "haldun/bookmarks",
"id": "5748e23a642fdfc12f8ba33ba1f758f604d362fb",
"size": "129... |
"""This module provides a common interface for all HTTP requests.
HttpResponse: Represents the server's response to an HTTP request. Provides
an interface identical to httplib.HTTPResponse which is the response
expected from higher level classes which use HttpClient.request.
GenericHttpClient: Provide... | {
"content_hash": "531713e4938e6c93549319cdcfa965a0",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 77,
"avg_line_length": 32.267605633802816,
"alnum_prop": 0.689873417721519,
"repo_name": "edisonlz/fruit",
"id": "1508c38f80fe39fb954df70a02d8ee995f4671fa",
"size": "5183"... |
__time__ = __import__('time')
from jevent import ioloop
IDLE_SLEEP = 0.01
class timerloop(object):
def __init__(self, coreloop):
self.coreloop = coreloop
def wait(self, secs):
if secs <= 0:
# TODO: do we want to register, switch, and let it switch back?
return
... | {
"content_hash": "2afbcc943279243d4981a8ffb4eaa0c7",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 75,
"avg_line_length": 25.61764705882353,
"alnum_prop": 0.5602755453501722,
"repo_name": "reversefold/jevent",
"id": "a65f2ca9fd2fc58dc111841f7d06b9fd039a1794",
"size": "87... |
from bottle import template, redirect
import utils
def GET(**params):
return template('materiales_index.html')
| {
"content_hash": "2f6292b6082b87ab638af1393a8521b2",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 23.2,
"alnum_prop": 0.7586206896551724,
"repo_name": "andres-hurtado-lopez/naranjaverdeprod",
"id": "a75da42c30a81b005fdbf6018079ab1942a4ff1f",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('jobs', '0008_job_tags'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "f6b2d59ce7e277f7bccb537206065b3a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 114,
"avg_line_length": 29.82608695652174,
"alnum_prop": 0.5889212827988338,
"repo_name": "ScorpionResponse/freelancefinder",
"id": "19efb9455ff9b906f2c97f67644f27c614d74841"... |
from numpy import *
from numpy import f2py # not part of import *
from scitools.StringFunction import StringFunction
import time, sys, os
# make sys.path so we can find Grid2D.py:
sys.path.insert(0, os.path.join(os.environ['scripting'],
'src','py','examples'))
from Grid2D import Grid2D
... | {
"content_hash": "7f3d65e24bf707b74f0e5a3aba0526f9",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 87,
"avg_line_length": 34.59136212624585,
"alnum_prop": 0.5740011525163273,
"repo_name": "sniemi/SamPy",
"id": "b36dd66b1c0553e4b8c4eb8395be1243fb15de83",
"size": "20847",... |
import scattertext as st
movie_df = st.SampleCorpora.RottenTomatoes.get_data()
movie_df.category = movie_df.category\
.apply(lambda x: {'rotten': 'Negative', 'fresh': 'Positive', 'plot': 'Plot'}[x])
corpus = st.CorpusFromPandas(
movie_df,
category_col='category',
text_col='text',
nlp=st.whitespace_nlp_with_sente... | {
"content_hash": "336f5866ef35abd290d0ae244f177b5a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 85,
"avg_line_length": 26.96551724137931,
"alnum_prop": 0.7033248081841432,
"repo_name": "JasonKessler/scattertext",
"id": "9e92f18dd3f3259b291513de503d01cdefd5d3af",
"size... |
"""Implementation of config command for creating a gsutil configuration file."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import datetime
import json
import multiprocessing
import os
import signal
import socket... | {
"content_hash": "210443f5236fb1d1af2d57ac7ca41dd9",
"timestamp": "",
"source": "github",
"line_count": 1256,
"max_line_length": 105,
"avg_line_length": 47.44904458598726,
"alnum_prop": 0.6822605543996242,
"repo_name": "catapult-project/catapult",
"id": "e5a3d7e2fb48dabddd64d49e5622a0c6550fc9f0",
"... |
"""Useful wrappers and other tools."""
import re
from collections import namedtuple
from streamlink.utils import parse_json, parse_qsd as parse_query, parse_xml
__all__ = ["parse_json", "parse_xml", "parse_query"]
tag_re = re.compile(r'''(?=<(?P<tag>[a-zA-Z]+)(?P<attr>.*?)(?P<end>/)?>(?:(?P<inner>.*?)</\s*(?P=tag)\... | {
"content_hash": "699bcc2c0f2c6bee9823f24965bb3ce0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 115,
"avg_line_length": 40.67857142857143,
"alnum_prop": 0.607550482879719,
"repo_name": "beardypig/streamlink",
"id": "d64f11ba04427e1d8d37b4a6cbfebedccd46a415",
"size": "... |
import _plotly_utils.basevalidators
class TicklabeloverflowValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="ticklabeloverflow",
parent_name="scattercarpet.marker.colorbar",
**kwargs,
):
super(TicklabeloverflowValidator, self)... | {
"content_hash": "e9ddf16797f4d1f00bef01f059459ec0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 88,
"avg_line_length": 34.470588235294116,
"alnum_prop": 0.6092150170648464,
"repo_name": "plotly/plotly.py",
"id": "44f5514fd43d9f326da14264b84e799691d0f309",
"size": "586... |
"""
Uber OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/uber.html
"""
from .oauth import BaseOAuth2
class UberOAuth2(BaseOAuth2):
name = 'uber'
ID_KEY='uuid'
SCOPE_SEPARATOR = ' '
AUTHORIZATION_URL = 'https://login.uber.com/oauth/authorize'
ACCESS_TOKEN_U... | {
"content_hash": "fd30656010d20814ae1b6e20fd1fcc27",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 74,
"avg_line_length": 34.17948717948718,
"alnum_prop": 0.5603900975243811,
"repo_name": "IKholopov/HackUPC2017",
"id": "e95a0a05cabf31d92993902e1ee12574092e67c7",
"size": ... |
import hf, logging
from sqlalchemy import *
from datetime import datetime,timedelta
from time import mktime
import modules.feedparser
class RSSFeed(hf.module.ModuleBase):
config_keys = {
'source': ('URL of the RSS feed', '')
# 'entries': ('Number of entries', '-1'),
# 'days': ('Show only entr... | {
"content_hash": "52860426678159c53143b88c31e10f25",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 136,
"avg_line_length": 31.571428571428573,
"alnum_prop": 0.5727752639517345,
"repo_name": "HappyFaceGoettingen/HappyFaceCore",
"id": "87f94f99aaf8d244d1bdb9bdcdb5493b9f3ce5a... |
"""
tmdbsimple.discover
~~~~~~~~~~~~~~~~~~~
This module implements the Discover functionality of tmdbsimple.
Created by Celia Oakley on 2013-10-31.
:copyright: (c) 2013-2017 by Celia Oakley
:license: GPLv3, see LICENSE for more details
"""
from .base import TMDB
class Discover(TMDB):
"""
Discover functional... | {
"content_hash": "bd74130a86d5dc4ebc718028ef798e8f",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 80,
"avg_line_length": 49.84827586206897,
"alnum_prop": 0.5301604869950194,
"repo_name": "coronary/RandomEpisode",
"id": "28ac8dd823908dfa4d483e33013f1b6543ae8aa0",
"size"... |
from ..world.location import Location
from learning import QLearner
class AI:
def __init__(self, learner):
self.learner = learner
self.rewards = []
self.actions = []
self.done = False
# keep track of which sheep are done
self.sheep_done = set([])
def setLearne... | {
"content_hash": "cfca5fff79682eda1b8901d666ab3805",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 94,
"avg_line_length": 31.294871794871796,
"alnum_prop": 0.6042605489553462,
"repo_name": "schmit/sheepherding",
"id": "644f529799e0b49cc7f5fb3e7a4c13b04316ef9c",
"size": "... |
import weakref
from automaton import machines
from taskflow import logging
from taskflow import states as st
from taskflow.types import failure
from taskflow.utils import iter_utils
# Default waiting state timeout (in seconds).
WAITING_TIMEOUT = 60
# Meta states the state machine uses.
UNDEFINED = 'UNDEFINED'
GAME_... | {
"content_hash": "f8636ce879fbde94cc1fe32fa7d6100d",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 79,
"avg_line_length": 44.9812734082397,
"alnum_prop": 0.5293921731890091,
"repo_name": "pombredanne/taskflow-1",
"id": "9013cd8a917f532d13598a40bbc2685e97b2606b",
"size":... |
"Makes working with XML feel like you are working with JSON"
try:
from defusedexpat import pyexpat as expat
except ImportError:
from xml.parsers import expat
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesImpl
try: # pragma no cover
from cStringIO import StringIO
except ... | {
"content_hash": "c5b2bf5f59a6decf8b12e8c0460aa272",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 80,
"avg_line_length": 36.44638949671772,
"alnum_prop": 0.5665826128722382,
"repo_name": "transtats/transtats",
"id": "08d8faff2b9df7b555cd13ac89262b327a6364b3",
"size": "... |
import errno
import logging
import os
import re
import shutil
import tempfile
import threading
import time
from devil.android import decorators
from devil.android import device_errors
from devil.android.sdk import adb_wrapper
from devil.utils import reraiser_thread
logger = logging.getLogger(__name__)
class LogcatM... | {
"content_hash": "81d7fe96dbfe43bd7b62c191ed9d750b",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 80,
"avg_line_length": 34.06024096385542,
"alnum_prop": 0.647329324372126,
"repo_name": "catapult-project/catapult-csm",
"id": "571662f95293913b1d0dde65e0c57d31e1d9d49e",
... |
import numpy
from rpyc.core import netref
def apply_pathes():
def fixed_make_method(name, doc, orig=netref._make_method):
if name == "__array__":
def __array__(self, dtype=None):
# Note that protocol=-1 will only work between python
# interpreters of the same v... | {
"content_hash": "b3694d017f9ef4e92a686d7b92bdd6a4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 69,
"avg_line_length": 29.413793103448278,
"alnum_prop": 0.4771395076201641,
"repo_name": "modin-project/modin",
"id": "13d33e6652e1b5d083ac2ef80c6a6d56ab31e5b1",
"size": "... |
from functools import wraps
from elasticsearch import ElasticsearchException
from statsd import statsd
def es_error_statsd(fun):
"""Sends a statsd ping for every ES error
.. Note::
This has to be the inner-most decorator so that it can see the
Elasticsearch error, do its statsd thing and re-r... | {
"content_hash": "33aea7aeefa345586fca6c732e3d860b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 69,
"avg_line_length": 24.189655172413794,
"alnum_prop": 0.639344262295082,
"repo_name": "rlr/fjord",
"id": "67d4f2e3d3fd03736699979ec945303770f33b9f",
"size": "1403",
"b... |
from flask import Flask, render_template
from flask import redirect, url_for, request, session, make_response
import sqlite3, os
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/form/',methods = ['POST'])
def form():
db = sqlite3.connect(os.path.join(app.... | {
"content_hash": "329c2864bf6debf49abb6999f6372691",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 92,
"avg_line_length": 26.344827586206897,
"alnum_prop": 0.6465968586387435,
"repo_name": "smdsbz/homework",
"id": "3fdf81bb6ce1cbfbd89e8d102f6f4c1aceaec363",
"size": "764"... |
import glfw
import OpenGL.GL.shaders
import numpy as np
from OpenGL.GL import *
def main():
# initalize glfw
if not glfw.init():
return
window = glfw.create_window(800, 600, "My OpenGL Window", None, None)
if not window:
glfw.terminate()
return
glfw.make_context_current(... | {
"content_hash": "37595b6f67e8c9935a5cc67c66ed9973",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 121,
"avg_line_length": 24.04494382022472,
"alnum_prop": 0.6158878504672897,
"repo_name": "quanhua92/learning-notes",
"id": "394296c42a63378aa34b1597f1fecea4db5dfcea",
"siz... |
import scrapy
class BfscrapsItem(scrapy.Item):
# define the fields for your item here like:
name = scrapy.Field()
# pass
| {
"content_hash": "384a89bd89039bdba1b865bdfd04f7fc",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 48,
"avg_line_length": 19.285714285714285,
"alnum_prop": 0.6814814814814815,
"repo_name": "mattgiguere/doglodge",
"id": "9c9490e8dff9882b632195f8203b7dd7fdeecbd9",
"size": "... |
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('../sphinxext'))
# -- General ... | {
"content_hash": "1a23e848f3eb84e90cc2f02a13788ad6",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 80,
"avg_line_length": 32.34166666666667,
"alnum_prop": 0.693635660912136,
"repo_name": "bjornaa/gridmap",
"id": "7a688dbfcdbfab08ad8490d767d7fb78155f2611",
"size": "8188"... |
from darwinpush.xb.raw.binding_ import *
| {
"content_hash": "9c0cd11a22c3936b42309c4f594e5b48",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 41,
"alnum_prop": 0.7804878048780488,
"repo_name": "HackTrain/darwinpush",
"id": "9f5e6c22c18ceb3ca1e5ec7db55ddb0cec7ba081",
"size": "65",
"binary":... |
from __future__ import absolute_import, unicode_literals
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``defaults.py`` module within each of Mezzanine's apps, but are
# common enough to be put here, commented out, for con... | {
"content_hash": "4d1a059eeac1e3303c9b3273b8d35aa1",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 79,
"avg_line_length": 34.89010989010989,
"alnum_prop": 0.6886614173228346,
"repo_name": "eroesch/mymezz",
"id": "575b86bce1a129fad72f9cb00cbc59c38130b300",
"size": "12700... |
from requestbuilder import Arg
from euca2ools.commands.iam import IAMRequest, AS_ACCOUNT, arg_iprofile
from euca2ools.commands.iam.deleterole import DeleteRole
from euca2ools.commands.iam.getinstanceprofile import GetInstanceProfile
from euca2ools.commands.iam.removerolefrominstanceprofile import \
RemoveRoleFromI... | {
"content_hash": "42a542dd3b282d0cc05830d60982d791",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 79,
"avg_line_length": 48.36363636363637,
"alnum_prop": 0.5632832080200502,
"repo_name": "jhajek/euca2ools",
"id": "ab266da11e2b176fc1113eb4e8f9357f844f887e",
"size": "4539... |
import time
from math import isinf
from indico.util.console import cformat
class Benchmark:
"""Simple benchmark class.
Can be used manually or as a contextmanager:
with Benchmark() as b:
do_stuff()
b.print_result()
"""
def __init__(self, start=False):
self._start_time = Non... | {
"content_hash": "59f8c24a915cabcc36421aadb17d53cc",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 69,
"avg_line_length": 25.677419354838708,
"alnum_prop": 0.5383165829145728,
"repo_name": "pferreir/indico",
"id": "24920a5e92beb405199e4248ee20b52e1792a97f",
"size": "1806... |
import unittest
from cssqc.parser import CSSQC
from cssqc.qualityWarning import QualityWarning
class Test_noUniversalSelectors(unittest.TestCase):
def parse(self, data):
c = CSSQC({"noUniversalSelectors": True})
c.parse(data)
return c
def test_no_universal_selectors(self):
... | {
"content_hash": "3d5f261eee8d472c9f81f72ca5eec2d9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 55,
"avg_line_length": 23.076923076923077,
"alnum_prop": 0.6122222222222222,
"repo_name": "matematik7/CSSQC",
"id": "7c1e73d91a45fe52dd2e62807b7707e0dc63ab97",
"size": "130... |
from typing import List
import typepy
from ._text_writer import TextTableWriter
class CsvTableWriter(TextTableWriter):
"""
A table writer class for character separated values format.
The default separated character is a comma (``","``).
:Example:
:ref:`example-csv-table-writer`
... | {
"content_hash": "f7cdb70f8d5a0f7b0b2ac8818a4c2010",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 67,
"avg_line_length": 23.49206349206349,
"alnum_prop": 0.5905405405405405,
"repo_name": "thombashi/pytablewriter",
"id": "b88a9191d96b0c9cb150d753c64338e62164d118",
"size"... |
from __future__ import print_function
import contextlib
import unittest
from functools import partial
import numpy as np
import paddle
import paddle.fluid.core as core
import paddle.fluid as fluid
from paddle.fluid import compiler
def get_places():
places = []
if core.is_compiled_with_cuda():
places... | {
"content_hash": "fc2fc69def3a768debde3f10e8fc2b2d",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 84,
"avg_line_length": 34.2,
"alnum_prop": 0.5619047619047619,
"repo_name": "baidu/Paddle",
"id": "e5e7e76737177f7f4aaae7d7e28e9e5166b96de5",
"size": "6598",
"binary": f... |
""" Sahana Eden Automated Test - HRM001 Create Job Role
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software with... | {
"content_hash": "49df865ce51d20b03d9aab96e0d2fe35",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 110,
"avg_line_length": 40.745098039215684,
"alnum_prop": 0.6568816169393648,
"repo_name": "vgupta6/Project-2",
"id": "ed3697540793fa1b9fcc3e6d54de67eb8393904b",
"size": "2... |
"""Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or... | {
"content_hash": "ec9baa0266c95b92892b1f6fab11a5b5",
"timestamp": "",
"source": "github",
"line_count": 619,
"max_line_length": 90,
"avg_line_length": 33.07592891760905,
"alnum_prop": 0.6002246751978119,
"repo_name": "jstammers/EDMSuite",
"id": "0b21c166689afda91f98739ede48d159d29828a0",
"size": "2... |
from __future__ import annotations
from tempfile import NamedTemporaryFile
from unittest import TestCase, mock
from airflow.providers.google.cloud.transfers.gdrive_to_local import GoogleDriveToLocalOperator
TASK_ID = "test-drive-to-local-operator"
FOLDER_ID = "1234567890qwerty"
FILE_NAME = "file.pdf"
GCP_CONN_ID = "... | {
"content_hash": "8e3cdd6e7015caf17518b7ff122a29f8",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 95,
"avg_line_length": 35.94285714285714,
"alnum_prop": 0.6351351351351351,
"repo_name": "apache/airflow",
"id": "def50026f8fbede3b0f3a43e6ba65e5ec2cfeb50",
"size": "2045",... |
class Solution(object):
def containsNearbyDuplicate(self, nums, k):
d = {}
for index,value in enumerate(nums):
if value not in d :
d[value] = index
else:
dist = index - d[value]
if dist <= k:
return True
... | {
"content_hash": "74e3f5ee0eeb5e2d710742f92ee8a6d6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 47,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.44594594594594594,
"repo_name": "menghanY/LeetCode-Python",
"id": "cd3715b084d181209badcc795dfc0820f14fd7ed",
"si... |
import requests
import getpass
################################################################################
####################################################################### Config #
################################################################################
urlInsaCloud = 'http://localhost/api/events/... | {
"content_hash": "fcf936c4cec277d35c2320818f9f67b3",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 133,
"avg_line_length": 48.472727272727276,
"alnum_prop": 0.44373593398349587,
"repo_name": "insacloud/insacloud-back",
"id": "983e3713f0a5c5d1ee5184b9a318d71beb9c2c0e",
"s... |
import mock
from nose.plugins.skip import SkipTest
from nose.tools import eq_, raises
import sqlalchemy.exc as saexc
import savalidation.tests.examples as ex
from savalidation import ValidationError
class TestFamily(object):
def tearDown(self):
# need this to clear the session after the exception catchin... | {
"content_hash": "c34cebeb61de045589b6119b9b6fa876",
"timestamp": "",
"source": "github",
"line_count": 418,
"max_line_length": 170,
"avg_line_length": 35.04545454545455,
"alnum_prop": 0.5611987166359479,
"repo_name": "marquisthunder/sqlalchemy-validation",
"id": "994b6f7ed308c7a6e27915ac8b8a8796a81d... |
from django import forms
from confucius.models import Review
class ProblemForm(forms.Form):
problem = forms.CharField(label=u'Enter your explanation', help_text=u'Please indicate in a concise way the exact problem with the paper or the assignment.',
min_length=12, widget=forms.Textarea(attrs={'class':... | {
"content_hash": "9016c29ed8c6e59e31d2ea397cb5c6b2",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 161,
"avg_line_length": 37.43103448275862,
"alnum_prop": 0.6499309074159374,
"repo_name": "jfouca/confucius",
"id": "ef233d5c02efee98d79665cc6a16f652dbfbce8e",
"size": "217... |
"""Provides utilities to preprocess images for the Inception networks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
def apply_with_random_selector(x, func, num_cases):
"""... | {
"content_hash": "7801ece2bf220b9c200f12a6a6192e68",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 80,
"avg_line_length": 44.08843537414966,
"alnum_prop": 0.6673352877642339,
"repo_name": "AlgoHunt/nerual_style_transfer",
"id": "45e81fd8cf4a7bcfd59a233d0bb27b833b835a17",
... |
from ..base import * # noqa
INSTALLED_APPS += [
'django.contrib.admin',
'apps.admin_site',
]
ROOT_URLCONF = 'apps.admin_site.urls'
AUTH_USER_MODEL = 'core.AdminUser'
| {
"content_hash": "5237199173d3257ebb2728acb9727956",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 37,
"avg_line_length": 16.272727272727273,
"alnum_prop": 0.6480446927374302,
"repo_name": "thnee/django-template",
"id": "4b8fc43c2ad8f20139d353e364387ffc1f6b850f",
"size":... |
import datetime
from decimal import Decimal
from django.contrib import admin
from django.contrib.auth.models import User as DjangoUser
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.contrib.localflavor.us.models import USStateField, PhoneNumberField
from lebay.apps.base... | {
"content_hash": "aec3fafc03222b25ef387bfdbc293682",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 339,
"avg_line_length": 41.8109756097561,
"alnum_prop": 0.6737640367507657,
"repo_name": "tarequeh/little-ebay",
"id": "10a8a0627b05c1a057ab88f24464382f9376ee4f",
"size": ... |
import pqb
from ... import types
from . import exceptions
from . import utils
import uuid
class EdgeDriver(types.BaseEdgeDriver):
def create(self, from_, to, data = {}):
eType = data.get('class', 'E')
QB = pqb.Select()
if isinstance(from_, dict):
from_Class, from_Value ... | {
"content_hash": "aca9b966a2c2119e66cbb4e57c23f534",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 33.38461538461539,
"alnum_prop": 0.5350230414746544,
"repo_name": "josegomezr/graph_db",
"id": "040cdd54a78e364d382927195f9afe6266baa858",
"size": "2... |
'''@file cross_enthropytrainer_rec.py
contains the CrossEnthropyTrainerRec for reconstruction of the audio samples'''
import tensorflow as tf
from nabu.neuralnetworks.trainers import trainer
from nabu.neuralnetworks import ops
class JointFeaturesTextCost(trainer.Trainer):
'''A trainer that minimises the cross-ent... | {
"content_hash": "152fafda28844df4a5bf4d8adf9710ff",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 80,
"avg_line_length": 40.472972972972975,
"alnum_prop": 0.6253756260434057,
"repo_name": "JeroenBosmans/nabu",
"id": "51112e5aec436b935fa16ba455fa30baf6ec59f5",
"size": "2... |
import platform
import re
# Platform identification constants.
UNKNOWN = 0
RASPBERRY_PI = 1
BEAGLEBONE_BLACK = 2
MINNOWBOARD = 3
def platform_detect():
"""Detect if running on the Raspberry Pi or Beaglebone Black and return the
platform type. Will return RASPBERRY_PI, BEAGLEBONE_BLACK, or U... | {
"content_hash": "c05c54ea10dab5eb6d553e78e5d720fe",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 94,
"avg_line_length": 35.56976744186046,
"alnum_prop": 0.6142530238640078,
"repo_name": "CardosoTech/CardosoTech_Python_GPIO",
"id": "d2ac867539411d6fa9ee719e67db5175dbf17fe... |
from model.credentials import Credentials
def test_success_login_mk(app):
app.session.login(Credentials(login="38096000000", password="xxx"))
app.mk.hello_mk()
app.mk.merge_from_mk()
app.session.logout()
| {
"content_hash": "505cd106c10a862545ef800d52bf9a57",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 71,
"avg_line_length": 27.75,
"alnum_prop": 0.7117117117117117,
"repo_name": "AlexBenyuh/python_training",
"id": "dc337456449257200f25a598a70331711c0317cc",
"size": "246",
... |
"""Constants used by multiple Tasmota modules."""
CONF_DISCOVERY_PREFIX = "discovery_prefix"
DATA_REMOVE_DISCOVER_COMPONENT = "tasmota_discover_{}"
DATA_UNSUB = "tasmota_subscriptions"
DEFAULT_PREFIX = "tasmota/discovery"
DOMAIN = "tasmota"
PLATFORMS = [
"binary_sensor",
"light",
"sensor",
"switch",... | {
"content_hash": "93fd13f9e40bb956cdc0fb73b543318b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 54,
"avg_line_length": 19.77777777777778,
"alnum_prop": 0.6910112359550562,
"repo_name": "balloob/home-assistant",
"id": "0f4dfde1646061c0701d7f0134009bfd55048e0a",
"size":... |
from __future__ import print_function
from apiclient import discovery
from httplib2 import Http
from oauth2client import client, file, tools
SCOPES = "https://www.googleapis.com/auth/forms.body"
DISCOVERY_DOC = "https://forms.googleapis.com/$discovery/rest?version=v1"
store = file.Storage('token.json')
creds = None
... | {
"content_hash": "77c3393b9c888fe733c8d3261fa554e6",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 76,
"avg_line_length": 28.274509803921568,
"alnum_prop": 0.6061026352288488,
"repo_name": "gsuitedevs/python-samples",
"id": "bfb6ea8a95d985d49b72aa63b309706b173d2769",
"si... |
"""
THIS WILL CLEAR YOUR DATABASE AND FILL IT WITH TEST DATA!
Prepare the local database for load testing.
It does the following:
- Creates an admin user.
- Creates 1000 channels. Create 3 users for each channel, and assign 1 as the editor and the other two as viewers.
"""
import logging
import os
import subprocess
i... | {
"content_hash": "2bd1bdc89748973b364f9ad7cd3829c8",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 114,
"avg_line_length": 26.391304347826086,
"alnum_prop": 0.6897309170785283,
"repo_name": "DXCanas/content-curation",
"id": "f97e1a72e6b7e9c321bec66ae546ac1ba7d5cb0d",
"si... |
"""
Read a result info files and filter based on a predicate
"""
from load_klee_runner import add_KleeRunner_to_module_search_path
add_KleeRunner_to_module_search_path()
from KleeRunner import ResultInfo
import argparse
import logging
import os
import pprint
import re
import sys
import yaml
_logger = None
def main(... | {
"content_hash": "d7f5853626d24ae5de1fe09580298bf4",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 92,
"avg_line_length": 33.351351351351354,
"alnum_prop": 0.6110210696920584,
"repo_name": "delcypher/klee-runner",
"id": "654d314135429a19424ddf6eea4ff026ed271521",
"size":... |
from __future__ import unicode_literals
import addons.base.models
from django.db import migrations, models
import django_extensions.db.fields
import osf.models.base
import osf.utils.datetime_aware_jsonfield
import osf.utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]... | {
"content_hash": "a9e9966436c999474d4ac1c7a0012418",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 203,
"avg_line_length": 52.21818181818182,
"alnum_prop": 0.6340529247910863,
"repo_name": "cslzchen/osf.io",
"id": "617fc761a88582edacd7145cbb4307d7327b1f1c",
"size": "2946... |
"""
Implementation of the OSGi LogService, based on Python standard logging
:author: Thomas Calmant
:copyright: Copyright 2020, Thomas Calmant
:license: Apache License 2.0
:version: 1.0.1
..
Copyright 2020 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you may not use thi... | {
"content_hash": "754246cf769dd9e29a6740553d467149",
"timestamp": "",
"source": "github",
"line_count": 515,
"max_line_length": 80,
"avg_line_length": 27.63883495145631,
"alnum_prop": 0.5613320219193481,
"repo_name": "tcalmant/ipopo",
"id": "fc8cb3d2406d848a3ad38baac9eaf31d0896750d",
"size": "14288... |
from __future__ import unicode_literals
from unittest import skipUnless
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql, oracle, no_mysql, no_oracle, no_spatialite
from django.test import TestCase
if HAS_GEOS:
from django.contrib.gis.db.models import ... | {
"content_hash": "8e7ed9f610f6faaff85ce91b170aa837",
"timestamp": "",
"source": "github",
"line_count": 307,
"max_line_length": 155,
"avg_line_length": 48.504885993485345,
"alnum_prop": 0.6387750990531194,
"repo_name": "ericholscher/django",
"id": "b165699e22143e92196a51f4b5539274d6f6c4f6",
"size":... |
from flask import Flask, request
from flask.views import MethodView
from flask.ext.introspect import blueprint as rest, TreeView, ObjectViewMixin, DictViewMixin
from unittest import TestCase
class Config():
SERVER_NAME = 'localhost'
DEBUG = True
TESTING = True
class O(object):
def __init__(self, **kwa... | {
"content_hash": "5471e3fb0717d4eadef3d35acbe91002",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 99,
"avg_line_length": 33.01724137931034,
"alnum_prop": 0.6135770234986945,
"repo_name": "denz/flask_introspect",
"id": "f4f91537c4158b103b18ffda45ed8e885a6ad033",
"size": ... |
import re
class BaseTokenizer(object):
"""
Really simple tokenizer
"""
@staticmethod
def tokenize(text):
"""
Splits text into a list of words removing any symbol and converts it into lowercase
"""
tokens = []
text = text.lower()
for dot_item in BaseTo... | {
"content_hash": "4b9858680dda8548183198c6e540d949",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 91,
"avg_line_length": 28.825,
"alnum_prop": 0.5238508239375542,
"repo_name": "umitproject/tease-o-matic",
"id": "9a201356a478baf77409241bce3d93240ea97384",
"size": "1153",... |
from direct.showbase.PythonUtil import invertDict
from toontown.toonbase import ToontownGlobals
from toontown.coghq import NullCogs
from toontown.coghq import CashbotMintBoilerRoom_Battle00_Cogs
from toontown.coghq import CashbotMintBoilerRoom_Battle01_Cogs
from toontown.coghq import CashbotMintControlRoom_Battle00_Cog... | {
"content_hash": "fe66e158db364737ee26d494252941ca",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 122,
"avg_line_length": 48.608,
"alnum_prop": 0.8413429888084266,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "c7bebf8637e68fac6079784350e69be6cd09633f",
"... |
print "I could have code like this." # and the comment after is ignored
# You can also use a comment to "disable" or comment out a piece of code:
# print "this won't run."
print "This will run."
| {
"content_hash": "f0e169ba1b3ce9041f7f36588998c905",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 73,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.7106598984771574,
"repo_name": "alfredleo/learnPythonTheHardWay",
"id": "69c9e7abea41a7d0f716f041c6e532bfb7d0dd22",
... |
import csv
import re
def preProcess(column):
column = re.sub(' +', ' ', column)
column = re.sub('\n', ' ', column)
column = column.strip().strip('"').strip("'").lower()
if not column:
column = None
return column
def print_csv(input_file, output_file, header, clustered_dupes):
orig_d... | {
"content_hash": "10af6a76a18b03e17762bf03fa91aa5b",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 89,
"avg_line_length": 29.785714285714285,
"alnum_prop": 0.539568345323741,
"repo_name": "datamade/dedupe",
"id": "d6ed956fb1a92f84d776ca11bbd73319791c95ac",
"size": "1251"... |
"""
"""
# Native
import random
import time
import curses
from curses import wrapper
import argparse
# # 3rd-Party
# # Proprietary
from monitors.building_monitor import BuildingMonitor
def main(screen):
parser = argparse.ArgumentParser(description='Building Monitor')
parser.add_argument('--interval', act... | {
"content_hash": "b0303ac524391ca4dfbea20012a75f80",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 15.35483870967742,
"alnum_prop": 0.7226890756302521,
"repo_name": "m3talstorm/foe-bot",
"id": "7ed1b80bbfcbf4062c54225ff866c2068e274470",
"size": "47... |
'''
Copyright (c) 2017 Yogesh Khatri
This file is part of mac_apt (macOS Artifact Parsing Tool).
Usage or distribution of this software/code is subject to the
terms of the MIT License.
'''
import logging
import os
import re
import sys
from plugins.helpers.macinfo import *
from plugins.helpers.write... | {
"content_hash": "1aa4df1a51e2c8e243f41ce36f66d8a0",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 197,
"avg_line_length": 55.83018867924528,
"alnum_prop": 0.5858736059479553,
"repo_name": "ydkhatri/mac_apt",
"id": "5540359aaec04b9b282100b74dd0c5106d382d08",
"size": "14... |
import sys
import os
up_time_quanta = 60
f = open(sys.argv[1])
announce_histogram = {}
node_uptime_histogram = {}
for i in xrange(0, 50): announce_histogram[i] = 0
for i in xrange(0, 5000, up_time_quanta): node_uptime_histogram[i] = 0
counter = 0;
for line in f:
counter += 1
if counter % 1000 == 0:
print '\r%... | {
"content_hash": "20703a21856aaf09040dcf2d0b54ed2f",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 76,
"avg_line_length": 24.608695652173914,
"alnum_prop": 0.6743227326266196,
"repo_name": "chongyc/libtorrent",
"id": "51af6525e4af1d914fe1d99f15a0d237719aef42",
"size": "1... |
from flask import request
from indico.modules.admin.views import WPAdmin
from indico.modules.users import User
from indico.util.i18n import _
from indico.web.breadcrumbs import render_breadcrumbs
from indico.web.views import WPDecorated, WPJinjaMixin
class WPUser(WPJinjaMixin, WPDecorated):
"""Base WP for user p... | {
"content_hash": "78998e2bb32142e079b297efcd4c46c5",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 85,
"avg_line_length": 31.88235294117647,
"alnum_prop": 0.6875768757687577,
"repo_name": "pferreir/indico",
"id": "9bbf031071d1d8fad1d77a3586dc911454c0c605",
"size": "1840"... |
import platform
import re
import sys
import time
import eventlet
eventlet.monkey_patch()
from oslo_config import cfg
import oslo_messaging
from neutron.agent.common import config
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as com... | {
"content_hash": "22b532282f0e0af898365397dfd24db2",
"timestamp": "",
"source": "github",
"line_count": 448,
"max_line_length": 79,
"avg_line_length": 39.32142857142857,
"alnum_prop": 0.5518278837420527,
"repo_name": "rdo-management/neutron",
"id": "58580f5bd43ee5978189c2804d5004a8accf30a6",
"size"... |
from jnpr.junos import jxml
from jnpr.junos import jxml as JXML
from lxml.etree import _Element
from ncclient.operations.rpc import RPCError
class FactLoopError(RuntimeError):
"""
Generated when there is a loop in fact gathering.
"""
pass
class RpcError(Exception):
"""
Parent class for all ... | {
"content_hash": "24f3dad606b386f67e5faa9979d1b169",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 83,
"avg_line_length": 27.306397306397308,
"alnum_prop": 0.5273736128236745,
"repo_name": "spidercensus/py-junos-eznc",
"id": "38651ef0011bd725c2c105992fbbf4e0102167f9",
"... |
import json
from heatclient import exc
from heatclient.v1 import client as v1client
from keystoneclient.v2_0 import client as ksclient
def script_keystone_client():
ksclient.Client(auth_url='http://no.where',
insecure=False,
password='password',
tenant_... | {
"content_hash": "fa35e5060baff348fb50d387154dc972",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 76,
"avg_line_length": 29.826923076923077,
"alnum_prop": 0.5341715022566086,
"repo_name": "citrix-openstack-build/python-heatclient",
"id": "199dad9f8695f29dea41cc1cc5a4f0c9... |
"""
Installs and configures nova
"""
import os
import uuid
import logging
import platform
from packstack.installer import processors, utils, validators
from packstack.installer.exceptions import ScriptRuntimeError
from packstack.modules.ospluginutils import NovaConfig, getManifestTemplate, appendManifestFile, manife... | {
"content_hash": "ceb73bfa805e05bfe957516f57981542",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 133,
"avg_line_length": 51.0036036036036,
"alnum_prop": 0.5121701345956831,
"repo_name": "pkilambi/packstack",
"id": "b037a6620a2235c381c7f818be89afee21a69fda",
"size": "2... |
from __future__ import absolute_import
from exam import fixture
from django.core.urlresolvers import reverse
from sentry.models import ProjectOption
from sentry.testutils import TestCase
class ManageProjectPluginsTest(TestCase):
@fixture
def path(self):
return reverse('sentry-manage-project-plugins... | {
"content_hash": "6a333869ba218ec4ed5a7e7b5bc96fc8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 84,
"avg_line_length": 30.25,
"alnum_prop": 0.6081267217630854,
"repo_name": "daevaorn/sentry",
"id": "9837585d7951e11e004709e9036db84a4254a91a",
"size": "1452",
"binary"... |
"""Cleans up old trace from Treadmill."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import time
import click
from treadmill.apptrace import zk
from treadmill import context
from treadmill impor... | {
"content_hash": "9e771a77a77057b5ca28503ad13289a7",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 76,
"avg_line_length": 31.519685039370078,
"alnum_prop": 0.5578316262802898,
"repo_name": "captiosus/treadmill",
"id": "b5590eb0c72cecb7edd699d505ec352a61e5b02a",
"size": ... |
import warnings
import numpy as np
from numpy import nanmean, nansum
__all__ = [
"median",
"nanmedian",
"nansum",
"nanmean",
"nanvar",
"nanstd",
"nanmin",
"nanmax",
"nanargmin",
"nanargmax",
"ss",
"anynan",
"allnan",
]
def nanargmin(a, axis=None):
"Slow nanargm... | {
"content_hash": "feb578d54159c596bbb875f09e0a05d4",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 60,
"avg_line_length": 25.402173913043477,
"alnum_prop": 0.660676080445015,
"repo_name": "kwgoodman/bottleneck",
"id": "4743bdb43b7b2aba26aaef4aeb08994b17cd2ed4",
"size": "... |
import taxcalc
import dropq
import pandas as pd
import os
import json
from rq import Queue
from worker import conn
import time
q = Queue(connection=conn)
def test_func(personal_exemp, exemp_start, phase_out):
job = q.enqueue(do_work, personal_exemp, exemp_start, phase_out)
time.sleep(1)
while(not job.res... | {
"content_hash": "a3dc99e7ebbc02ddc45bd1bd75becbfd",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 83,
"avg_line_length": 26.53125,
"alnum_prop": 0.6702002355712603,
"repo_name": "PeterDSteinberg/webapp-public",
"id": "ecb09832cfe18f708bab6a65865d5ce3937dd721",
"size": "... |
from abc import ABCMeta
#-----------------------------------------------------------------------------
# BaseTranslator interface
class BaseTranslator(object):
"""
An abstract class for translating between filepaths and
:class:`drslib.drs.DRS` objects.
Concrete subclasses are returned by factory fun... | {
"content_hash": "12663a203ae04259b8558d27e587f4cf",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 78,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.586038961038961,
"repo_name": "ESGF/esgf-drslib",
"id": "e8026dbe70ad264697aa6dcb79aa995df5f04d4c",
"size": "2053... |
from pytorch_lightning.callbacks.base import Callback
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
from pytorch_lightning.callbacks.finetuning import BackboneFinetuning, BaseFinetuning
from pytorch_lightning.callbacks.gpu_stats_monitor import GPUStatsMonitor
from pytorch_lightning.callbacks.grad... | {
"content_hash": "d05f82adae9672a1c3d9c3fccf8a7758",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 101,
"avg_line_length": 43.75,
"alnum_prop": 0.8222222222222222,
"repo_name": "williamFalcon/pytorch-lightning",
"id": "d2c405b5c2d10073fcd55e3238ac1bebde7073f6",
"size": "... |
import argparse
import sys
from ros_buildfarm.argument import add_argument_arch
from ros_buildfarm.argument import add_argument_build_name
from ros_buildfarm.argument import add_argument_config_url
from ros_buildfarm.argument import add_argument_dry_run
from ros_buildfarm.argument import add_argument_os_code_name
from... | {
"content_hash": "bca9ed14e665fe49a848b9622de35bec",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 73,
"avg_line_length": 35.111111111111114,
"alnum_prop": 0.745253164556962,
"repo_name": "ros-infrastructure/ros_buildfarm",
"id": "f39166129c4991e7a041da012b3a0a0e0798661a",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.