text stringlengths 4 1.02M | meta dict |
|---|---|
"""Connection class marshals data over UDP to daemon."""
import socket
import json
class _Connection(object):
"""Instances of _Connection are used to communicate with the X-Ray daemon
via UDP.
"""
def __init__(self, collector_url):
self._collector_url = collector_url
self._socket = soc... | {
"content_hash": "77bdd834860b0194edfa3cd22a5b1340",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 86,
"avg_line_length": 31.9,
"alnum_prop": 0.622257053291536,
"repo_name": "nornagon/xray-python-opentracing",
"id": "fa593b4e2bc1a6d958c1e886971c6922ccfb85e3",
"size": "63... |
"""
website.docs
~~~~~~~~~~~~
website docs blueprint.
"""
| {
"content_hash": "4468e6971824c616a4437cef3bae6e2a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 27,
"avg_line_length": 11.833333333333334,
"alnum_prop": 0.43661971830985913,
"repo_name": "alibaba/FlexGW",
"id": "3f90ff26649bdf7d59f5f6e181adc0c7594a047c",
"size": "95",
... |
"""Fichier contenant la volonté LeverAncre"""
import re
from secondaires.navigation.equipage.ordres.lever_ancre import LeverAncre as \
Ordre
from secondaires.navigation.equipage.ordres.long_deplacer import LongDeplacer
from secondaires.navigation.equipage.volonte import Volonte
class LeverAncre(Volonte):
... | {
"content_hash": "af89047f86714a6989c7e3d012e2c428",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 83,
"avg_line_length": 31.634146341463413,
"alnum_prop": 0.5813415574402467,
"repo_name": "vlegoff/tsunami",
"id": "5c899164461eea8c476236ad77934210bdceef1f",
"size": "4171... |
from tackerclient.common import exceptions
from tackerclient.common import utils
from tackerclient.openstack.common.gettextutils import _
API_NAME = 'servicevm'
API_VERSIONS = {
'1.0': 'tackerclient.v1_0.client.Client',
}
def make_client(instance):
"""Returns an tacker client.
"""
tacker_client = ut... | {
"content_hash": "fe3f1139ca1bf2abd7ea53e6bad54df6",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 76,
"avg_line_length": 36.2,
"alnum_prop": 0.5067805123053741,
"repo_name": "trozet/python-tackerclient",
"id": "9d48ef37036545fbacd49a052e8cc584aae77247",
"size": "2629",
... |
import os
import shutil
import time
import threading
import traceback
from vmipl.vmipl_parser import VmiplParser
from vmipl_aux.constants import Constants
from vmipl_communication.connection import Connection
from vmipl_communication.network_connection import NetworkConnection
from vmipl_communication.receiver impor... | {
"content_hash": "0f684693a2135a13d5cf3f14d689a243",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 71,
"avg_line_length": 30.34536082474227,
"alnum_prop": 0.6840496008153558,
"repo_name": "FlorianWestphal/VMI-PL",
"id": "8b260b140c3e7455964e516f88002d1970b8f487",
"size"... |
from setuptools import setup, find_packages
setup(
name='string-formatting',
packages=find_packages()
)
| {
"content_hash": "d36f2f8e97681e5a5771c5140e588a24",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 43,
"avg_line_length": 20.166666666666668,
"alnum_prop": 0.6776859504132231,
"repo_name": "richlewis42/string_formatting",
"id": "c589e87f7cd2457d47a7798c1a2f61c9b8f7c1e8",
... |
import sys
from django.core.management.base import BaseCommand
from kaleo.models import InvitationStat
class Command(BaseCommand):
help = "Adds invites to all users with 0 invites remaining."
def handle(self, *args, **kwargs):
if len(args) == 0:
sys.exit("You must supply the number ... | {
"content_hash": "ae045c6302621ba9608dec36922f38ca",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 28.95,
"alnum_prop": 0.6338514680483592,
"repo_name": "pombredanne/kaleo",
"id": "e734a653a35e26c855297fbd5933f19b90c8279c",
"size": "579",
"binary... |
"""This version uses a traditional event-driven version,
using continuation passing style. Each method call is passed
a completion callback and an error callback
"""
from statistics import median
import json
import asyncio
import random
import time
import hbmqtt.client
from collections import deque
from antevents.base... | {
"content_hash": "004caae81b00dcae070649f700e11203",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 100,
"avg_line_length": 38.25118483412322,
"alnum_prop": 0.5631272456944616,
"repo_name": "mpi-sws-rse/antevents-python",
"id": "01cce22c693ce47cd7b8cd0b5f4e638791ea3d32",
... |
import logging
from airflow.models import DAG
from airflow.utils.dates import days_ago
from airflow_multi_dagrun.operators import TriggerMultiDagRunOperator
log = logging.getLogger(__name__)
def generate_dag_run(**context):
"""Callable can depend on the context"""
log.info('!!!!!!!! =========== TRY NUMBER ... | {
"content_hash": "6bb93c2804236ea43fa7cc0629e0c901",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 85,
"avg_line_length": 26.605263157894736,
"alnum_prop": 0.5934718100890207,
"repo_name": "mastak/airflow_multi_dagrun",
"id": "9c3601ef66cb3b89df93cde2af356b5fa7edaf8d",
"... |
from django.http import JsonResponse
from django.views import generic
from django.utils import timezone
from django.db.models import Count, Q
from django.contrib.auth.decorators import login_required
from rest_framework.viewsets import ReadOnlyModelViewSet
from artist.models import Artist
from event.models import Eve... | {
"content_hash": "1df8e7c2aa67542d5045749e641a7f4e",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 116,
"avg_line_length": 33.09322033898305,
"alnum_prop": 0.6437900128040973,
"repo_name": "FedorSelitsky/eventrack",
"id": "f3a3ea0b116c9184d4f7fbc0ec3ee3832f9bf946",
"siz... |
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.contrib.auth import authenticate, login as auth_login, \
logout as auth_logout
from models import PageCopy, Module, Mo... | {
"content_hash": "bc50c293fcb5cdbffea68d9d0956c312",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 71,
"avg_line_length": 27.633333333333333,
"alnum_prop": 0.6019300361881785,
"repo_name": "jonathanendersby/spazaschool",
"id": "f451e33288dab8f430df47ec948c08889d2e9c3c",
... |
import mock
from oslo_utils import uuidutils
from ironic.common import driver_factory
from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.conductor import utils as conductor_utils
from ironic import objects
from ironic.tests import base as tests_ba... | {
"content_hash": "6b0600c1b6c90b902d4bb6f4d80692c1",
"timestamp": "",
"source": "github",
"line_count": 690,
"max_line_length": 79,
"avg_line_length": 48.995652173913044,
"alnum_prop": 0.5844351761469518,
"repo_name": "bacaldwell/ironic",
"id": "f4bcf412daf978b5a634891aae6b33099bc0aac7",
"size": "3... |
import ConfigParser
import StringIO
import unittest
import UserDict
from test import test_support
class SortedDict(UserDict.UserDict):
def items(self):
result = self.data.items()
result.sort()
return result
def keys(self):
result = self.data.keys()
result.sort()
... | {
"content_hash": "88d6b93dbfe1b8ee63fbc8779e5ab11d",
"timestamp": "",
"source": "github",
"line_count": 490,
"max_line_length": 79,
"avg_line_length": 37.659183673469386,
"alnum_prop": 0.5130873028775809,
"repo_name": "MalloyPower/parsing-python",
"id": "a8b5d7c389ad4ed48a5db1bda3668173c8b2199b",
"... |
from django.db import models, migrations
import markupfield.fields
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("companies", "0001_initial"),
]
operations ... | {
"content_hash": "c483b9d0fb309f81f5a86d2a0752946a",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 88,
"avg_line_length": 34.71134020618557,
"alnum_prop": 0.3724383724383724,
"repo_name": "proevo/pythondotorg",
"id": "2908c117244a2aa1a11b0eeee4741eebe7875929",
"size": "3... |
import os
from glob import glob
from ievv_opensource.utils.ievvbuildstatic import pluginbase
from ievv_opensource.utils.ievvbuildstatic.filepath import \
AbstractDjangoAppPath
from ievv_opensource.utils.ievvbuildstatic.watcher import ProcessWatchConfig
from ievv_opensource.utils.shellcommandmixin import (ShellComm... | {
"content_hash": "9bf0396830eb05ca141feb6ee7f52d8d",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 107,
"avg_line_length": 35.792270531400966,
"alnum_prop": 0.526386826832231,
"repo_name": "appressoas/ievv_opensource",
"id": "ff95da081b5184521702f482a22898a5f5490113",
"... |
from ..utils import Scraper
from bs4 import BeautifulSoup
from collections import OrderedDict
from queue import Queue
from threading import Thread, Lock
from time import time
import http.cookiejar
import json
import os
import re
import sys
class Courses:
"""A scraper for UofT's Course Finder web service.
Cou... | {
"content_hash": "2fcd6af36382dbb7f586902cdd7ced98",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 80,
"avg_line_length": 30.70943396226415,
"alnum_prop": 0.4861145244531826,
"repo_name": "g3wanghc/uoft-scrapers",
"id": "617faaef602b4662f18e062ebe30a579f5476163",
"size"... |
from ctypes import *
from ctypes.util import find_library
from errno import *
from functools import partial
from platform import machine, system
from stat import S_IFDIR
from traceback import print_exc
import six
if six.PY3:
unicode_ = str
else:
unicode_ = unicode # NOQA: F821 undefined name 'unicode': Needed... | {
"content_hash": "37e10136c9a53a1a2c918340bfa048f8",
"timestamp": "",
"source": "github",
"line_count": 682,
"max_line_length": 95,
"avg_line_length": 34.03372434017595,
"alnum_prop": 0.5531859894015768,
"repo_name": "Konubinix/pyfilesystem",
"id": "fad51eba5167271a65ba0e6bf27fc4015bfbbffe",
"size"... |
import os
import warnings
import theano
import theano.sandbox.cuda
from theano import config
def set_gpu_from_theano():
"""
This set the GPU used by PyCUDA to the same as the one used by Theano.
"""
# Transfer the theano gpu binding to pycuda, for consistency
if config.device.startswith("gpu") an... | {
"content_hash": "e2f3497c14d14bc7feb02882a1b3cef6",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 80,
"avg_line_length": 38.707692307692305,
"alnum_prop": 0.613275039745628,
"repo_name": "rizar/attention-lvcsr",
"id": "dd771fb5f51d77aea3f0f7b9aacb8ec5ea2fc451",
"size": ... |
__author__ = 'tdesai'
import os
import subprocess
import sys
from twitter.common.contextutil import environment_as, temporary_file
from twitter.common.quantity import Amount, Data
from twitter.common.string import ScanfParser
from twitter.common.util.command_util import CommandUtil
class HDFSHelper(object):
"""
... | {
"content_hash": "64a0cc3d8f3f32a41779ae072180ed4c",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 88,
"avg_line_length": 30.995535714285715,
"alnum_prop": 0.6318594267607662,
"repo_name": "pombredanne/commons",
"id": "9a521b8f321dc3702d92c952fd3c11dd076110ed",
"size": ... |
from __future__ import with_statement
from distutils.version import LooseVersion
from classytags import (arguments, core, exceptions, utils, parser, helpers,
values)
from classytags.blocks import BlockDefinition, VariableBlockName
from classytags.compat import compat_next
from classytags.test.context_managers impor... | {
"content_hash": "4d8e9008fa5a95c708330a51e704af17",
"timestamp": "",
"source": "github",
"line_count": 1301,
"max_line_length": 79,
"avg_line_length": 37.86471944657956,
"alnum_prop": 0.5412894320165645,
"repo_name": "philippeowagner/django-classy-tags",
"id": "117a9d24acb6903f8c99a1b20904ee3f56f23b... |
import numpy as np
import pandas as pd
import time
# ------------------------------------------------------------------------------
print(f"Starting ... {int(time.time())}");
length: int = 1100000000
df = pd.DataFrame({"INDEX": np.arange(0, length),
"normal": np.random.normal(size=length),
... | {
"content_hash": "9a601b639b644741e7de5fd2abe1d26f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 29.727272727272727,
"alnum_prop": 0.5066258919469928,
"repo_name": "hosseinmoein/DataFrame",
"id": "2ed81d85a242540a1f47ef41814b5c07d314f2ee",
"size"... |
""" Salesforce API message templates """
DEPLOY_MSG = \
"""<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:met="http://soap.sforce.com/2006/04/metadata">
<soapenv:Header>
<met:CallOptions>
<met:client>{client}</met:client>
</met:CallOptions>
<met:Sessi... | {
"content_hash": "be9b1dc1621d8fb68b3bf780b31272f1",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 66,
"avg_line_length": 33.787234042553195,
"alnum_prop": 0.6388539042821159,
"repo_name": "rbauction/sfdclib",
"id": "73284d48d1c8b5fce7315230237ff5b302ab98d4",
"size": "31... |
from django.contrib import admin
from .models import MyModel
from admin_wmdeditor import WmdEditorModelAdmin
class MyModelAdmin(WmdEditorModelAdmin):
wmdeditor_fields = ('text1','text2')
admin.site.register(MyModel, MyModelAdmin)
| {
"content_hash": "68d5c379b31bbd4b09c66c5e8e405f10",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.8059071729957806,
"repo_name": "paltman-archive/django-admin-wmdeditor",
"id": "6b1dbf90110e6e4a9d5a7e915c3c76cd898d... |
import numpy as np
import pandas as pd
from os.path import join, dirname
from scipy.io import savemat
def add_median_ratio_cytoplasm_nuclei(df):
'''Add median_ratio in DataFrame if it has nuclei and cytoplasm objects.
nuc/cyto is stored in nuclei, cyto/nuc is stored in cytoplasm
'''
object_names = np.... | {
"content_hash": "86174e333e278b053087b824f89459e3",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 117,
"avg_line_length": 45.98979591836735,
"alnum_prop": 0.6081650765475927,
"repo_name": "braysia/covertrack",
"id": "b52618d19864ddf222f7c99886931f81fda126a2",
"size": "4... |
"""Wraps capture_tpu_profile binary."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import subprocess
import sys
import tensorflow as tf
tf.flags.DEFINE_string('service_addr', '',
'Address of TPU profiler service e.g. ... | {
"content_hash": "916fb85df1fc14188fedb766fff04388",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 27.46153846153846,
"alnum_prop": 0.676937441643324,
"repo_name": "eadgarchen/tensorflow",
"id": "7970c20a2693cbbe91a136080240f676d29f2053",
"size": "... |
import asyncio
from unittest.mock import patch
from aiohttp import WSMsgType
from async_timeout import timeout
import pytest
from homeassistant.core import callback
from homeassistant.components import websocket_api as wapi, frontend
from tests.common import mock_http_component_app
API_PASSWORD = 'test1234'
@pyte... | {
"content_hash": "27bf00dab3de0e91168dd9f660f5a8d4",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 77,
"avg_line_length": 27.79530201342282,
"alnum_prop": 0.6430037426053362,
"repo_name": "dmeulen/home-assistant",
"id": "bdad5032a24e12b50088d99b8a087ccc53a72382",
"size"... |
"""Axis network device abstraction."""
import asyncio
import async_timeout
from homeassistant.const import (
CONF_DEVICE,
CONF_HOST,
CONF_MAC,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_USERNAME,
)
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryNotRe... | {
"content_hash": "a719f3ff897c42683c95c2c127379b1e",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 87,
"avg_line_length": 31.861344537815125,
"alnum_prop": 0.6173018594223922,
"repo_name": "fbradyirl/home-assistant",
"id": "465d8c73b742053c3afe8e21cd41e5d871ebae52",
"si... |
import tkinter as tk
from tkinter import ttk
from window_main import MainWindow
from input_thread import InputThread
import midi_manager as mm
# Initialize the input thread
input_thread = InputThread()
# Initialize the UI
root = tk.Tk()
root.wm_title("pianopad")
root.geometry("600x410")
app = MainWindow(input_thread... | {
"content_hash": "9569654178451e921e9c46883d839e1a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 43,
"avg_line_length": 20.5,
"alnum_prop": 0.764808362369338,
"repo_name": "danodic/pianopad",
"id": "6dee40150c3defd0935c2d1822d2d4f4d10e9717",
"size": "574",
"binary": ... |
from django.conf.urls import patterns
from django.conf.urls import url
from .views import IndexView
urlpatterns = patterns(
'',
url(r'^$', IndexView.as_view(), name='index'),
)
| {
"content_hash": "1ad997fe1773ccb9586efaa75d53d55b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 50,
"avg_line_length": 18.8,
"alnum_prop": 0.6914893617021277,
"repo_name": "b1-systems/horizon-dashboard-cookiecutter",
"id": "5796add938d53f8803c526e5746b4c735adff11d",
"... |
"""Support for WeMo humidifier."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import math
from typing import Any
from pywemo.ouimeaux_device.humidifier import DesiredHumidity, FanMode, Humidifier
import voluptuous as vol
from homeassistant.components.fan import SUPPORT_SET_SPEED... | {
"content_hash": "c29924dda3fd7b12c72e8ab95f111606",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 87,
"avg_line_length": 33.344086021505376,
"alnum_prop": 0.6575298290873912,
"repo_name": "GenericStudent/home-assistant",
"id": "253ff34213e79d9cadd73099b5234eb28eadefb0",
... |
"""Utilities for testing driver specs."""
import functools
import threading
from collections import abc
from test import IntegrationTest, client_context, client_knobs
from test.utils import (
CMAPListener,
CompareType,
EventListener,
OvertCommandListener,
ServerAndTopologyEventListener,
camel_t... | {
"content_hash": "016f8cf21d09a62e422b98a431849832",
"timestamp": "",
"source": "github",
"line_count": 648,
"max_line_length": 100,
"avg_line_length": 38.66358024691358,
"alnum_prop": 0.5950746387802347,
"repo_name": "mongodb/mongo-python-driver",
"id": "8528ecb8c751bfd0e4e3db1b0ceb99df192fc16e",
... |
import sys
from PyQt5.QtCore import QCoreApplication, Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QAction, QMessageBox
from PyQt5.QtWidgets import QCheckBox
class window(QMainWindow):
def __init__(self):
super(window, self).__init__()
... | {
"content_hash": "a28a89d493a0fadd9efe27a56069f9d9",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 97,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.6053105310531053,
"repo_name": "kenwaldek/pythonprogramming",
"id": "3f57a454d6bee7869cb0fa30e026233def186566",
"... |
"""
Astropy affiliated package for image reprojection (resampling).
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init import *
# -------------------------------... | {
"content_hash": "d12a6dcaaac3bae6741ba7ac515a5f33",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 78,
"avg_line_length": 35.75,
"alnum_prop": 0.47086247086247085,
"repo_name": "bsipocz/reproject",
"id": "82c1eba8e5804382ec66ce9aa81230c75fcc52ff",
"size": "493",
"binar... |
"""
.. dialect:: mssql
:name: Microsoft SQL Server
Auto Increment Behavior
-----------------------
SQL Server provides so-called "auto incrementing" behavior using the
``IDENTITY`` construct, which can be placed on an integer primary key.
SQLAlchemy considers ``IDENTITY`` within its default "autoincrement" behav... | {
"content_hash": "f84bea3c4d9c48c6ccda9f11c1e66f76",
"timestamp": "",
"source": "github",
"line_count": 2057,
"max_line_length": 101,
"avg_line_length": 34.403500243072436,
"alnum_prop": 0.5778176576983948,
"repo_name": "NoahFlowa/glowing-spoon",
"id": "6975754c6379a1315d3963ee49f50dbf7b3d38d8",
"s... |
from unittest.mock import Mock, call, patch
from django.test import TestCase
from django.db.models import QuerySet
from requests.exceptions import ConnectionError
from jarbas.chamber_of_deputies.management.commands.receipts import Command
class TestCommandHandler(TestCase):
@patch('jarbas.chamber_of_deputies.m... | {
"content_hash": "183db01e2d6b727ff4f6b8699b2b2357",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 103,
"avg_line_length": 43.38157894736842,
"alnum_prop": 0.6748559296329997,
"repo_name": "marcusrehm/serenata-de-amor",
"id": "689f541c0007736ef8a760ce143906372ff519e1",
... |
"""
Installation script for Nova's development virtualenv
"""
import os
import subprocess
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
VENV = os.path.join(ROOT, '.nova-venv')
PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires')
TWISTED_NOVA = 'http://nova.openstack.org/Twisted... | {
"content_hash": "7bedb44036520533c174a3de8512b923",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 32.02238805970149,
"alnum_prop": 0.6229317175483571,
"repo_name": "superstack/nova",
"id": "812b1dd0fb860571a1ca50002c189e5b853a396a",
"size": "5103... |
'''
Run this script to update all the copyright headers of files
that were changed this year.
For example:
// Copyright (c) 2009-2012 The Bitcoin Core developers
it will change it to
// Copyright (c) 2009-2015 The Bitcoin Core developers
'''
import os
import time
import re
year = time.gmtime()[0]
CMD_GIT_DATE = 'g... | {
"content_hash": "72528bc85352a8759def3746d5514fe5",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 83,
"avg_line_length": 29.622222222222224,
"alnum_prop": 0.6174043510877719,
"repo_name": "zurcoin/zurcoin",
"id": "4a67cc5bbbc26021b73c3214f185c58573a25887",
"size": "1355... |
"""
Author: Jonathan Rosado Lugo
Email: jonathan.rosado-lugo@hp.com
Description:
General script for parsing YAML lists and key value pairs
Dependencies:
-PyYaml
Input:
hudson:
securityRealm:
attributes: 'database-authentication'
disableSignup: 'true'
enableCaptcha: 'false'
authorizatio... | {
"content_hash": "05bb9db24e5138f580b4af97303cf035",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 122,
"avg_line_length": 26.04040404040404,
"alnum_prop": 0.6206361520558572,
"repo_name": "gmatoshp/jenkins-tomcat-nginx",
"id": "34d8db963dc15bd0cc2b5dd22e7e101a741d97ee",
... |
import re
import datetime
import times
from zitkino import parsers
from zitkino.models import Cinema, Showtime, ScrapedFilm
from . import scrapers, Scraper
cinema = Cinema(
name=u'Kinokavárna',
url='http://www.kinokavarna.cz/',
street=u'Náměstí SNP 33',
town=u'Brno',
coords=(49.2179300, 16.6207... | {
"content_hash": "04b6506e7eccf58168c589f626caa63f",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 77,
"avg_line_length": 27.45054945054945,
"alnum_prop": 0.5416333066453163,
"repo_name": "zitkino/zitkino.cz",
"id": "284e70cd5815c809ff8684bf60e31594b9c12bf7",
"size": "25... |
"""TensorFlow Eager execution prototype.
EXPERIMENTAL: APIs here are unstable and likely to change without notice.
To use, at program startup, call `tf.enable_eager_execution()`.
@@metrics
@@list_devices
@@num_gpus
@@py_func
@@defun
@@function
@@make_template
@@implicit_gradients
@@implicit_value_and_gradients
@@g... | {
"content_hash": "133b57336c5f318a25326b2eee59cd53",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 124,
"avg_line_length": 36.45774647887324,
"alnum_prop": 0.8305968707745799,
"repo_name": "apark263/tensorflow",
"id": "b82e1bb71bce9a28d7bbbf961cc6d5e25dd18acf",
"size": ... |
"""
Dictionary-based Logging Parser Module
"""
from .log_parser_v1 import LogParserV1
def get_parser(database):
"""Get the parser object based on database"""
db_ver = int(database.get_version())
# DB version 1 and 2 correspond to v1 parser
if db_ver in [1, 2]:
return LogParserV1(database)
... | {
"content_hash": "d47b706dfedf373da05feb387d35f4fd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 49,
"avg_line_length": 20.9375,
"alnum_prop": 0.6716417910447762,
"repo_name": "zephyrproject-rtos/zephyr",
"id": "16f2f9ec8e9c088a183e6d4ce3a80f7a4e6a3dc7",
"size": "440",... |
from django import template
import markdown
register = template.Library()
@register.filter
def markdown_this(text):
# safe_mode governs how the function handles raw HTML
return markdown.markdown(text, safe_mode='escape')
| {
"content_hash": "9fa8ef50ff6574628a73fdb7fe2bc9e3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 57,
"avg_line_length": 21.181818181818183,
"alnum_prop": 0.759656652360515,
"repo_name": "vmogilev/soloist",
"id": "6a485af07f1b53a1ba0def7f90d58d3956ce32de",
"size": "233"... |
from tests.conftest import JiraTestCase
class WorklogTests(JiraTestCase):
def setUp(self):
JiraTestCase.setUp(self)
self.issue_1 = self.test_manager.project_b_issue1
self.issue_2 = self.test_manager.project_b_issue2
self.issue_3 = self.test_manager.project_b_issue3
def test_wo... | {
"content_hash": "7c63487cb3412dbe1514b98a25d79821",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 84,
"avg_line_length": 44.01538461538462,
"alnum_prop": 0.6623558196434813,
"repo_name": "pycontribs/jira",
"id": "642539094eb7638e6eba827e15d6a320a09c5af1",
"size": "2861"... |
import sys
import khmer
import os.path
import screed
K = 20
def main():
readsfile = sys.argv[1]
contigfile = sys.argv[2]
outfile = os.path.basename(readsfile) + '.sweep'
if len(sys.argv) == 4:
outfile = sys.argv[3]
# create a nodegraph data structure
ht = khmer.Nodegraph(K, 1, 1)
... | {
"content_hash": "67102357c6bb8a057d39858d9fa7ff77",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 60,
"avg_line_length": 22.454545454545453,
"alnum_prop": 0.650472334682861,
"repo_name": "ged-lab/khmer",
"id": "bf20a6468cf34cd942817feb4f0e4fa99975d077",
"size": "2537",
... |
"""
Test the configuration parser.
"""
from __future__ import print_function
from unittest import TestCase
from contextlib import contextmanager
from voluptuous import (
MultipleInvalid,
)
from six import StringIO
from mock import (
patch,
MagicMock,
)
import plix.configuration
class ConfigurationTest... | {
"content_hash": "293976532cce20a7294ee4a41a3d7272",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 79,
"avg_line_length": 26.52247191011236,
"alnum_prop": 0.5210760432111841,
"repo_name": "freelan-developers/plix",
"id": "45a47c9f22ecd27daa6368020cb8114e2adef46d",
"size... |
"""A demo for enforcing a timeout on multiple read operations."""
import sys
from syncless import coio
from syncless import patch
def Asker(timeout, age_answer_channel):
print 'You have %s seconds altogether to tell me your age.' % timeout
while True:
sys.stdout.write('How old are you? ')
sys.stdout.flu... | {
"content_hash": "1d3adf218a3df2b195a7802d1e22523e",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 29.61904761904762,
"alnum_prop": 0.6696141479099679,
"repo_name": "olopez32/syncless",
"id": "4f1b92fd9e4667b83879344b2f6f4750832a6120",
"size": "127... |
import subprocess
from datetime import datetime
def execute(cmd):
return subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True).communicate()[0];
def listRunning(proc, liveOnly=False):
subtasks = execute("ls /proc/%s/task" % proc)
for task in subtasks.splitlines():
stats = execute("cat /proc/%s... | {
"content_hash": "0fa005337a39e24feadc7910b50e5c41",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 117,
"avg_line_length": 36.96296296296296,
"alnum_prop": 0.6362725450901804,
"repo_name": "h3adache/process",
"id": "904511eb17315ac6552c8f01f480278b810f0d54",
"size": "101... |
"""
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
"""
import sys
def is_prime_number(number):
if number < 2:
return False
for i in range(2, (number//2)+1):
# When i reaches more than the half, there are no more natural numbers to ... | {
"content_hash": "e1b8cfe711eb319e7efd9c9e0f9d69a6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 91,
"avg_line_length": 23.791666666666668,
"alnum_prop": 0.5779334500875657,
"repo_name": "Pauekn/project_euler",
"id": "b4c362d7d4e958c678c2a7b40d822fb8697d5c98",
"size": ... |
"""The console module contains the :class:`Command` class that's
useful for building command-line scripts.
Consider a function `myfunc` that you want to call directly from the
command-line, but you want to avoid writing glue that deals with
argument parsing, converting those arguments to Python types and
passing them ... | {
"content_hash": "0ed733dc4cc8a3230d4368ae6d472c2e",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 72,
"avg_line_length": 26.023952095808383,
"alnum_prop": 0.6063046479521399,
"repo_name": "rajegannathan/grasp-lift-eeg-cat-dog-solution-updated",
"id": "a773c362543b98fe77a... |
"""Connect to a MySensors gateway via pymysensors API."""
import logging
import voluptuous as vol
from homeassistant.components.mqtt import valid_publish_topic, valid_subscribe_topic
from homeassistant.const import CONF_OPTIMISTIC
from homeassistant.core import callback
import homeassistant.helpers.config_validation ... | {
"content_hash": "e5fa65bc67022d5131cb885b652869ac",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 88,
"avg_line_length": 31.456521739130434,
"alnum_prop": 0.6299239806496199,
"repo_name": "Teagan42/home-assistant",
"id": "a528be15e1475b4f03795b9404372fc8f541567a",
"siz... |
"""Non-blocking HTTP client implementation using pycurl."""
from __future__ import absolute_import, division, print_function
import collections
import functools
import logging
import pycurl # type: ignore
import threading
import time
from io import BytesIO
from tornado import httputil
from tornado import ioloop
fro... | {
"content_hash": "b761ef18523ea3e8849e61c775084497",
"timestamp": "",
"source": "github",
"line_count": 505,
"max_line_length": 98,
"avg_line_length": 44.93663366336634,
"alnum_prop": 0.5848940201824351,
"repo_name": "SuminAndrew/tornado",
"id": "e0ec3fbaf88be76a29c15f3c7e6e9c8aa806af62",
"size": "... |
"""Imports Onsets and Frames model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| {
"content_hash": "9f2cc4feabb89acfac3199b8d78634c1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 29.8,
"alnum_prop": 0.738255033557047,
"repo_name": "adarob/magenta",
"id": "97ff2189bfafa68a92985ad85282ff8bb2df6dc4",
"size": "734",
"binary": fal... |
from setuptools import setup
with open('README.rst') as fp:
long_description = fp.read()
setup(
name='Flask-Elastic',
version='0.2',
download_url='https://github.com/bbmogool/flask-elastic/',
license='BSD',
author='Marcel Tschopp',
author_email='mt@corova.net',
descriptio... | {
"content_hash": "ed34f3ba08b92ffc7a1a06ae03154b1e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 74,
"avg_line_length": 30.242424242424242,
"alnum_prop": 0.6072144288577155,
"repo_name": "marceltschoppch/flask-elastic",
"id": "b0417284e6a294c4addef0b2b446aab3cf7744f9",
... |
import re
from .utils import Str, classify, get_regexp_width, Py36, Serialize, suppress
from .exceptions import UnexpectedCharacters, LexError, UnexpectedToken
###{standalone
from copy import copy
class Pattern(Serialize):
raw = None
def __init__(self, value, flags=(), raw=None):
self.value = value... | {
"content_hash": "4a211d8349b321d8ce40e95bc1362a75",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 156,
"avg_line_length": 35.65645514223195,
"alnum_prop": 0.587173979748389,
"repo_name": "erezsh/lark",
"id": "730d95e560a086e1bd8792eadb3483348fc8d13d",
"size": "16319",
... |
from msrest.paging import Paged
class NetworkInterfacePaged(Paged):
"""
A paging container for iterating over a list of :class:`NetworkInterface <azure.mgmt.network.v2017_08_01.models.NetworkInterface>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'cu... | {
"content_hash": "8134336c9108c324f4a824a84475d9f7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 141,
"avg_line_length": 31.125,
"alnum_prop": 0.6285140562248996,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "a969cc46ad68c1e9011490187462563c4fbaa697",
"size": ... |
import setuptools
version = '1.1.6'
setuptools.setup(
name='sure',
version=version,
url='http://pypi.python.org/packages/source/s/sure/sure-%s.tar.gz' % version,
license='GPLv3',
author='Gabriel Falcao',
author_email='gabriel@nacaolivre.org'
)
| {
"content_hash": "76160578c1cf5876ead97bf6267fc365",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 81,
"avg_line_length": 22.5,
"alnum_prop": 0.6703703703703704,
"repo_name": "Scalr/packages",
"id": "fa942edb4314f2abb516e6e458bcf0addb6b2770",
"size": "270",
"binary": f... |
"""Search Google from the command line
This program is part of "Dive Into Python", a free Python book for
experienced programmers. Visit http://diveintopython.org/ for the
latest version.
"""
__author__ = "Mark Pilgrim (mark@diveintopython.org)"
__version__ = "$Revision: 1.2 $"
__date__ = "$Date: 2004/05/20 18:53:59... | {
"content_hash": "9e1f010ace12c55c628d0bba0eedad56",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 69,
"avg_line_length": 31.56756756756757,
"alnum_prop": 0.6215753424657534,
"repo_name": "tapomayukh/projects_in_python",
"id": "55b37ad1058898a041866a6c8ecab6ccbaa78f0a",
... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "46ae1924276599e760dc1586d2c843b2",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 375,
"avg_line_length": 38.6144578313253,
"alnum_prop": 0.5840873634945398,
"repo_name": "napalm-automation/napalm-yang",
"id": "08b748cb7508764db697409a9403f73f70b26651",
... |
from __future__ import unicode_literals
from zope.dottedname.resolve import resolve
from adyen import Backend
from django.conf import settings
def get_backend():
try:
backend_class = settings.ADYEN_BACKEND
except AttributeError:
backend_class = 'django_adyen.backends.SimpleSettingsBackend'
... | {
"content_hash": "ce4e709dc9cd05942fe98d126e94158e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 78,
"avg_line_length": 30.655172413793103,
"alnum_prop": 0.6850393700787402,
"repo_name": "machtfit/adyen",
"id": "6cfe071239d977d984a8bae0ea0fd2359f4c08ed",
"size": "914",... |
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the following automatically:
- fetch all translations using the tx tool
- post-process them into valid and committable format
- remove invalid control characters
- remove location tags (makes diffs less noisy)... | {
"content_hash": "f1e91e9fc123049a320e885960dee060",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 141,
"avg_line_length": 39.03317535545024,
"alnum_prop": 0.62178241864983,
"repo_name": "aurarad/auroracoin",
"id": "28c2f730d25b935136ea7bf6ff8b2db578587a80",
"size": "84... |
import os
import uuid
class CommandContextMocker:
def __init__(self):
pass
@staticmethod
def set_vm_uuid_param(name):
vm_uuid = str(uuid.uuid4())
CommandContextMocker.set_command_param(name,vm_uuid)
return uuid
@staticmethod
def set_command_param(name, value):
... | {
"content_hash": "26e017df70002b886760f8c2e711dafe",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 60,
"avg_line_length": 20.529411764705884,
"alnum_prop": 0.6332378223495702,
"repo_name": "QualiSystems/vCenterShell",
"id": "808829012fbc0190dc29027cc57d21217c3148d4",
"si... |
"""Python TAXII 2.1 Client API"""
from __future__ import unicode_literals
import json
import logging
import time
import six
from six.moves.urllib import parse as urlparse
from .. import MEDIA_TYPE_TAXII_V21
from ..common import (
_filter_kwargs_to_query_params, _grab_total_items_from_resource,
_TAXIIEndpoint... | {
"content_hash": "65647ec28fa95f05a8285c3a270a95ee",
"timestamp": "",
"source": "github",
"line_count": 752,
"max_line_length": 113,
"avg_line_length": 39.1875,
"alnum_prop": 0.602769011503614,
"repo_name": "oasis-open/cti-taxii-client",
"id": "72858df6357688a0bc74ba4e6891761057e49f2f",
"size": "29... |
import os
import os.path
import sys
if len(sys.argv) == 2:
top = sys.argv[1]
else:
top = "."
for root, dirs, files in os.walk(top):
for filename in files:
path = os.path.join(root, filename)
if any(filename.endswith(ending) for ending in [".py", ".html", ".txt", ".css"]):
tabs ... | {
"content_hash": "ccec1a744b6759d5c1e0cb3737c1a7d3",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 89,
"avg_line_length": 33.096774193548384,
"alnum_prop": 0.4512670565302144,
"repo_name": "amarandon/pinax",
"id": "84d5fda9df4cd660de408a9c497754155180b1b9",
"size": "1049... |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeli... | {
"content_hash": "0163700eae067a2b08aa2ca4833f096b",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 136,
"avg_line_length": 47.72254335260116,
"alnum_prop": 0.6478924418604651,
"repo_name": "Azure/azure-sdk-for-python",
"id": "8e8230430e8261d8dbdd3bb1624cde9d22614a2f",
"... |
from kafka.tools.protocol.responses import BaseResponse
class DescribeGroupsV1Response(BaseResponse):
schema = [
{'name': 'throttle_time_ms', 'type': 'int32'},
{'name': 'groups',
'type': 'array',
'item_type': [
{'name': 'error', 'type': 'int16'},
{'name'... | {
"content_hash": "48bc2d8e31b4d90b0f52bab5e46e3d4d",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 65,
"avg_line_length": 38.12,
"alnum_prop": 0.4281217208814271,
"repo_name": "toddpalino/kafka-tools",
"id": "1777d5a849b65c9813fa34313cdb65f0ebff31d8",
"size": "1739",
"... |
import collections
import os
import signal
import pygame
import config
import debug
import logsupport
from utils import threadmanager, displayupdate, hw
from controlevents import CEvent, PostEvent, ConsoleEvent
from logsupport import ConsoleDetail, ConsoleWarning
from stores import valuestore
import time
# from sets... | {
"content_hash": "61a4a4007be78482091225e7eca101c8",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 117,
"avg_line_length": 30.42433234421365,
"alnum_prop": 0.6786306446893592,
"repo_name": "kevinkahn/softconsole",
"id": "f49e8ea38a9d37228e7b7ef96d92fc07011ce310",
"size"... |
from mock import Mock, patch
from purchasing.opportunities.models import Opportunity
from purchasing.data import contracts, flows, stages
from purchasing.data.contract_stages import ContractStage
from purchasing.users import models
from purchasing_test.factories import (
ContractBaseFactory, UserFactory, Contract... | {
"content_hash": "b2e405e500d92c77f1bac89d9c9f0517",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 102,
"avg_line_length": 42.473214285714285,
"alnum_prop": 0.694134959007778,
"repo_name": "ajb/pittsburgh-purchasing-suite",
"id": "b1e059608f7db0c78c8a0c241228efbae06f493a"... |
import pytest
import io
from openregister.representations.json import reader
def test_reader_zero_items():
stream = io.StringIO("")
with pytest.raises(StopIteration):
next(reader(stream))
def test_reader_one_item():
stream = io.StringIO('[{"name":"one"}]')
items = reader(stream)
assert ... | {
"content_hash": "797bbe1e5c0fc566ba4e948f6da31b0c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 56,
"avg_line_length": 25.818181818181817,
"alnum_prop": 0.5516431924882629,
"repo_name": "openregister/entry",
"id": "adb3962894ff78ab9e4ee4adae6b5e3190a74334",
"size": "8... |
"""Task management utilities."""
__all__ = [
'Cancelled',
'Closed',
'CompletionQueue',
'Empty',
'Full',
'as_completed',
'get_all_tasks',
'get_current_task',
'joining',
'spawn',
'spawn_onto_stack',
]
import collections
import logging
from g1.asyncs.kernels import contexts
f... | {
"content_hash": "a4335d891ca41f844c1fd061fc9c78fb",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 78,
"avg_line_length": 26.967611336032387,
"alnum_prop": 0.5948055847470349,
"repo_name": "clchiou/garage",
"id": "e25b0476f588aaad081794e172b8efc7b8681959",
"size": "6661... |
from version_info.get_version import *
| {
"content_hash": "e2c4499ada6fc0e06a5ffbf731c69c41",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 38,
"avg_line_length": 39,
"alnum_prop": 0.7948717948717948,
"repo_name": "TyMaszWeb/python-version-info",
"id": "ed2244a21b482a40be520d1e597dca9ef69a7807",
"size": "39",
... |
from distutils.core import setup
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = ''
setup(
name = 'internal_links',
version = '0.1.6.6',
description = 'SEO tool for adding links to text contained in Django apps databases.... | {
"content_hash": "887f3125dcdd88c674b4606c8b96e9d7",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 88,
"avg_line_length": 35.535714285714285,
"alnum_prop": 0.6381909547738693,
"repo_name": "deployed/internal_links",
"id": "e1a6427e80e1dfd904ffbcd23d6d47ed8042c02e",
"size... |
"""
Visualization of named colors.
Simple plot example with the named colors and its visual representation.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
c... | {
"content_hash": "f96387aa800f352e7e949eb932270c2c",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 25.21794871794872,
"alnum_prop": 0.6298932384341637,
"repo_name": "bundgus/python-playground",
"id": "dde34a80c97433d50bde3030a568e60cb3fd0bdc",
"siz... |
"""Support for MQTT sensors."""
from __future__ import annotations
from datetime import timedelta
import functools
import logging
import voluptuous as vol
from homeassistant.components import sensor
from homeassistant.components.sensor import (
DEVICE_CLASSES_SCHEMA,
STATE_CLASSES_SCHEMA,
SensorEntity,
)... | {
"content_hash": "30809612f1a30ca6ea69304f351b5a87",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 140,
"avg_line_length": 35.17786561264822,
"alnum_prop": 0.6177528089887641,
"repo_name": "sander76/home-assistant",
"id": "16c19c8fc51b746916ee43cd289e8db7c1dd65da",
"siz... |
import pytest
from pyrsistent import v
from katana.utils import Node, Pair, prepare
from katana.compound import sequence, group, repeat, option, maybe
from katana.term import term
Ta, Tb, Tc = [term(k) for k in 'abc']
Na, Nb, Nc = [Node(k, 'data') for k in 'abc']
def test_sequence():
s = sequence(Ta, Tb)
g... | {
"content_hash": "876ebde3b07238d34877abee7d174c30",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 66,
"avg_line_length": 21.563636363636363,
"alnum_prop": 0.5750421585160203,
"repo_name": "eugene-eeo/katana",
"id": "9280cd94fab9f39f8221dc8ea02949c5ec56118e",
"size": "11... |
import bpy
import sys
import os
from bpy.types import AddonPreferences
from bpy.props import CollectionProperty, BoolProperty, StringProperty, FloatProperty
from bpy.props import IntProperty, PointerProperty, EnumProperty, FloatVectorProperty
from .rfb_utils import envconfig_utils
from . import rfb_logger
from . impor... | {
"content_hash": "dcd3cb94fe8b4576b8e36590ea792658",
"timestamp": "",
"source": "github",
"line_count": 560,
"max_line_length": 283,
"avg_line_length": 39.38035714285714,
"alnum_prop": 0.5648211127737722,
"repo_name": "adminradio/RenderManForBlender",
"id": "0db41d2a32d21e96d6e9cd886359d6af57c1d1f3",... |
class DecimalBaseConverter(object):
def __init__(self):
self.__digits = "0123456789ABCDEF"
def convert_to_base(self, number, base):
if number < base:
return self.__digits[number]
else:
return self.convert_to_base(number // base, base) + self.__digits[number % ba... | {
"content_hash": "ba23ef1000f35d7062947680232c7ff2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 92,
"avg_line_length": 28.466666666666665,
"alnum_prop": 0.6276346604215457,
"repo_name": "anthonynsimon/python-data-structures-algorithms",
"id": "70f23121f33a900150b97ceba7... |
import os,sys,time
import csv
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
import os,sys
path = os.getcwd()
parent_path = os.path.dirname(path)
parent_path = os.path.dirname(parent_path)
print(parent_path) | {
"content_hash": "04156f8ca9d0ee2e01df42b8dd788267",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 51,
"avg_line_length": 24.5,
"alnum_prop": 0.7959183673469388,
"repo_name": "zimuxin/AliMusicPrediction",
"id": "1e3674611b2791eee91b6761e5c027b6b42b7512",
"size": "245",
... |
import webob.exc
from nova.api.openstack import common
from nova.api.openstack.compute.views import images as views_images
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova import flags
import nova.image.glance
from nova.openstack.common import log as loggi... | {
"content_hash": "8beaf50eb090748260b4d3176ca995f1",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 78,
"avg_line_length": 32.4263959390863,
"alnum_prop": 0.6227301189730745,
"repo_name": "tylertian/Openstack",
"id": "1b20531def22269e66fb6ba0940c6763df6a49d7",
"size": "7... |
'''
Created on May 12, 2017
@author: yingziwu
'''
import requests
import time
import logging
from v2ex_base.v2_sql import SQL
import settings
class spider(object):
'''
A base Spider for v2ex.
'''
def __init__(self,url,sleep_time):
'''
>>>from v2ex_spider import base_spider
... | {
"content_hash": "ad7b5d1e56c75a4a584f57198b8cf6ce",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 118,
"avg_line_length": 31.253164556962027,
"alnum_prop": 0.5694613203726205,
"repo_name": "yingziwu/v2ex_delete",
"id": "6ea926494da6a775b5567d7f810df3b2171b1367",
"size":... |
"""
Copyright (c) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distr... | {
"content_hash": "012a44edcbbad1fc98fa89367967729c",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 88,
"avg_line_length": 36.48816568047337,
"alnum_prop": 0.5048244547149923,
"repo_name": "alexforencich/verilog-ethernet",
"id": "2a4286ddad3a152c85ae82c40d48a74cea762f87",
... |
import mock
import MySQLdb
import unittest2
from thanatos.questions import universe
class BorderingRegionsTestCase(unittest2.TestCase):
def setUp(self):
self.mock_db_connection = mock.Mock(spec=MySQLdb.connection)
def test_class_initializes(self):
""" Simply test we can create an instance o... | {
"content_hash": "9cee4583f2a7e713486dcac2c021bdd9",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 103,
"avg_line_length": 33.517857142857146,
"alnum_prop": 0.6209376664890783,
"repo_name": "evetrivia/thanatos",
"id": "c5d8d9bf3c2f38ce9feda469c3495772d03ebb95",
"size": ... |
import ast
import builtins
import collections.abc as abc
import importlib
import inspect
import logging
import os
import uuid
from contextlib import contextmanager
from copy import deepcopy
from dataclasses import is_dataclass
from typing import List, Tuple, Union
import cloudpickle
import yaml
from omegaconf import Di... | {
"content_hash": "4b0576622a651d1ae1a3a46888b87b03",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 100,
"avg_line_length": 38.031026252983295,
"alnum_prop": 0.5592092877314089,
"repo_name": "facebookresearch/detectron2",
"id": "3b80f3787ca156a617e2b35e56515d9dd9105060",
... |
from runner.koan import *
class AboutNewStyleClasses(Koan):
class OldStyleClass:
"An old style class"
# Original class style have been phased out in Python 3.
class NewStyleClass(object):
"A new style class"
# Introduced in Python 2.2
#
# Aside from this set of... | {
"content_hash": "5c121fc105686140429bea523b1ca29b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 88,
"avg_line_length": 39.36065573770492,
"alnum_prop": 0.6084964598084132,
"repo_name": "exaroth/python_koans",
"id": "8c66081849bccf27795bfb78cacade1e2de41ebc",
"size": "... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = '''
---
module: nxos_vrf_interface
extends_documentation_fragment: nxos
version_added: "2.1"
short_description: Manages interface specific VRF configuration.
descrip... | {
"content_hash": "bc2d77583cbe945c6ea6e5a36957a07c",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 87,
"avg_line_length": 29.690376569037657,
"alnum_prop": 0.5985062006764374,
"repo_name": "thaim/ansible",
"id": "4dcb3bc71bd1cd50c60c2b019eb1689543c1f62f",
"size": "7771"... |
def mklist(*args):
result = None
for element in reversed(args):
result = (element, result)
return result
print mklist(1,2,3,4,5,6)
cons = lambda el, lst: (el, lst)
mklist = lambda *args: reduce(lambda lst, el: cons(el, lst), reversed(args), None)
car = lambda lst: lst[0] if lst else lst
cdr = la... | {
"content_hash": "2e11226431e669b60f4cb339a01601be",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 90,
"avg_line_length": 38.4375,
"alnum_prop": 0.6439024390243903,
"repo_name": "gusyussh/learntosolveit",
"id": "8924a04b0bc5fa04766ce4bdeaa7f50467da2827",
"size": "615",
... |
import os
import sys
from builtins import input
def check_debian_user():
# Check whether the current user is the kolibri user when running kolibri
# that is installed from .deb package.
# The code is mainly from https://github.com/learningequality/ka-lite/blob/master/bin/kalite#L53
if not os.name == ... | {
"content_hash": "dc76fad65c6d555956e9b5bf1f3e9d71",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 100,
"avg_line_length": 39.41025641025641,
"alnum_prop": 0.6402081977878985,
"repo_name": "benjaoming/kolibri",
"id": "6b95d566413a0292a0e2a860e3cd53b8881a62be",
"size": "1... |
from django.contrib import admin
from models import Request
admin.site.register(Request)
| {
"content_hash": "ed0f013c34a6bf117553c497976a2f3c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 32,
"avg_line_length": 22.5,
"alnum_prop": 0.8333333333333334,
"repo_name": "nbeck90/city-swap",
"id": "4c904bb9b2ce5a5a19cd8d7ccca67f7b60be85c4",
"size": "90",
"binary": ... |
import os
import ConfigParser
set_f=os.path.join(request.env.web2py_path,'applications','ferry_boat','private','settings.ini')
Config = ConfigParser.ConfigParser()
Config.read(set_f)
try:
if Config.getboolean('General','AllowRegister'):
if 'register' in auth.settings.actions_disabled:
auth.sett... | {
"content_hash": "c4036e0b390534bc2608ed83c1d3e87d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 106,
"avg_line_length": 40.6,
"alnum_prop": 0.7044334975369458,
"repo_name": "Titosoft/ferry-boat",
"id": "150c19040fed0dcd9f2ec6e619232cd61a96f880",
"size": "633",
"bina... |
"""A fake server that "responds" to API methods with pre-canned responses.
All of these responses come from the spec, so if for some reason the spec's
wrong the tests might raise AssertionError. I've indicated in comments the
places where actual behavior differs from the spec.
"""
from keystoneclient import auth
from... | {
"content_hash": "3a4c77b23bcfa37162a827fc4c9bb6ee",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 76,
"avg_line_length": 30.294117647058822,
"alnum_prop": 0.570873786407767,
"repo_name": "dims/heat",
"id": "60bb4c6c55225b24915aad091df2a69e610cb7f3",
"size": "6755",
"... |
import tweepy
import time
from credentials import settings
from twitter_stream import twstream
def reply(api, tweet):
"""
replies to all captured tweets
:param api: tweepy api method
:param tweet: [[username, msg, id]]
:return: None
"""
for t in tweet:
# to create a reply you simply @... | {
"content_hash": "ed38eb254da87cd5b424ae6f5f1c4614",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 119,
"avg_line_length": 30.76,
"alnum_prop": 0.6326397919375812,
"repo_name": "castaway2000/marketing_twitterbot",
"id": "12fcc3b00b79d93190382af6f8556d5ce3934903",
"size":... |
"""
component_params.py
Note the places you need to change to make it work for you.
They are marked with keyword 'TODO'.
"""
## TODO: here goes the list of the input files. Use flags:
## '__REQUIRED__' to make it required
## '__FLAG__' to make it a flag or switch.
input_files = {
# 'input_file1' : ... | {
"content_hash": "00df2b75ab0bd55f825d99ebf2553351",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 81,
"avg_line_length": 28.941176470588236,
"alnum_prop": 0.516260162601626,
"repo_name": "jtaghiyar/kronos",
"id": "242b2d641134d27faf171e5211c6a1d993c7bef4",
"size": "984"... |
from magnum.common.pythonk8sclient.swagger_client import api_client
from magnum.common.pythonk8sclient.swagger_client.apis import apiv_api
from magnum.tests.functional.python_client_base import BayAPITLSTest
from magnum.tests.functional.python_client_base import BayTest
from magnumclient.openstack.common.apiclient impo... | {
"content_hash": "b32af8c63f9a3f2943162a50941406aa",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 77,
"avg_line_length": 42.26,
"alnum_prop": 0.5138034390282379,
"repo_name": "dimtruck/magnum",
"id": "24cbb910a20ec72cefd19a5b55e13be85294cd4c",
"size": "6881",
"binary... |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Mts20140618SubmitAnalysisJobRequest(RestApi):
def __init__(self,domain='mts.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.AnalysisConfig = None
self.Input = None
self.PipelineId = None
self.UserData = None
... | {
"content_hash": "9d5659964ca64ff1f0b9644ef82b1170",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 56,
"avg_line_length": 28.642857142857142,
"alnum_prop": 0.7381546134663342,
"repo_name": "francisar/rds_manager",
"id": "517ec224dd06d39c8f5070f4e59008c7413a8e68",
"size":... |
"""
Tests that features that are currently unsupported in
either the Python or C parser are actually enforced
and are clearly communicated to the user.
Ultimately, the goal is to remove test cases from this
test suite as new feature support is added to the parsers.
"""
import pandas.io.parsers as parsers
import panda... | {
"content_hash": "841fb7f5a97d432e9487bf1d118ea3a0",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 75,
"avg_line_length": 35.518248175182485,
"alnum_prop": 0.5990546650226058,
"repo_name": "louispotok/pandas",
"id": "3117f6fae55da0c9e5c1476edbec0eeb7240fd83",
"size": "4... |
from pythonforandroid.util import current_directory, ensure_dir
from pythonforandroid.toolchain import shprint
from pythonforandroid.recipe import Recipe
from multiprocessing import cpu_count
from os.path import join
import sh
class LibgeosRecipe(Recipe):
version = '3.7.1'
url = 'https://github.com/libgeos/li... | {
"content_hash": "721d01d51dafda245dabf60f358516f9",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 37.21153846153846,
"alnum_prop": 0.5762273901808785,
"repo_name": "germn/python-for-android",
"id": "cff9fe0f5e1f7f9a3e707d5a02518641213a7474",
"size... |
import datetime as dt
import os
import time
from cltk.corpus.greek.tlg.parse_tlg_indices import get_epithet_of_author
from cltk.corpus.greek.tlg.parse_tlg_indices import get_id_author
import pandas
from sklearn.externals import joblib
from sklearn.feature_extraction.text import CountVectorizer
def stream_lemmatized_... | {
"content_hash": "1c82dc5cba30ab0fb6866c195867b62b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 129,
"avg_line_length": 35.98550724637681,
"alnum_prop": 0.6830447039871124,
"repo_name": "kylepjohnson/notebooks",
"id": "d365751a2f16d4b8778d57c37d334ad429ceb6d7",
"size"... |
"""Type hinting decorators allowing static or runtime type-checking for the SDK.
This module defines decorators which utilize the type-hints defined in
'type_hints.py' to allow annotation of the types of function arguments and
return values.
Type-hints for functions are annotated using two separate decorators. One is... | {
"content_hash": "b099601fce7c850d91881bb1aca79ae9",
"timestamp": "",
"source": "github",
"line_count": 562,
"max_line_length": 80,
"avg_line_length": 33.45195729537367,
"alnum_prop": 0.6912765957446808,
"repo_name": "shakamunyi/beam",
"id": "89dc6afa34c80d1e4f1b2bc847d2c524c3b0eb48",
"size": "1958... |
from __future__ import absolute_import
import re
from sentry.stacktraces.platform import get_behavior_family_for_platform
from sentry.utils.safe import setdefault_path
_windecl_hash = re.compile(r"^@?(.*?)@[0-9]+$")
_rust_hash = re.compile(r"::h[a-z0-9]{16}$")
_cpp_trailer_re = re.compile(r"(\bconst\b|&)$")
_rust_b... | {
"content_hash": "e563d2b411a2f6230c3a1eed87c11fa4",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 87,
"avg_line_length": 31.37786259541985,
"alnum_prop": 0.5891010825933585,
"repo_name": "beeftornado/sentry",
"id": "a90228d0d6e5c62a9c07aab22f65674d19f841f9",
"size": "8... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/creature/npc/droid/shared_droideka_base.iff"
result.attribute_template_id = 3
result.stfName("droid_name","droideka_base")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "6b6541387ae4430eaa08445ba4068550",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 23.46153846153846,
"alnum_prop": 0.6983606557377049,
"repo_name": "anhstudios/swganh",
"id": "91cea1b492afdb8b53af920e6a0b0978b6a66862",
"size": "450... |
"""
CcPy daemon configuration file parser
"""
import xml.etree.ElementTree as ET
import logging
from .common import LoggerName
DefCcPydConfigFileName = "/etc/ccpyd.conf"
Logger = logging.getLogger(LoggerName)
class ParseError(Exception):
pass
def _get_elem_value(element, default_value):
if element is not... | {
"content_hash": "7fc070b0fd735d4bd2d77d51c352c659",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 87,
"avg_line_length": 30.196428571428573,
"alnum_prop": 0.6049674748669427,
"repo_name": "kindkaktus/CcPy",
"id": "66e9ea828922eeb29b4b2a21b856d4396bcfbf06",
"size": "1995... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.