text stringlengths 4 1.02M | meta dict |
|---|---|
def get_prime_array(high):
"""Gets all primes lower than high from the pre-generated primes to
improve efficiency.
Parameters
==========
high : Integer
The number below which primes will be returned
Returns
=======
int array : The primes less than high
"""
# Arra... | {
"content_hash": "9373e9d89bf02836786ccd27e289e227",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 71,
"avg_line_length": 30.60377358490566,
"alnum_prop": 0.5419235511713933,
"repo_name": "edschembor/PrimalPy",
"id": "3cdc864d3ae70bc1b093c00af170e275cda39e6c",
"size": "1... |
import sys, os
import tornado.ioloop
from tornado import gen
sys.path.append(os.path.dirname(sys.path[0]))
import time
from custor.decorators import run_with_thread_future
@run_with_thread_future(None)
def thread_sleep(self, args):
time.sleep(5)
@gen.coroutine
def sleep_coroutine():
yield thread_sleep(None,... | {
"content_hash": "9a1a8506ca833bd0dd52aeec4345ed4e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 52,
"avg_line_length": 19.391304347826086,
"alnum_prop": 0.742152466367713,
"repo_name": "jmpews/torweb",
"id": "bd52d3bfd2cc4af5154b9b294ff4955f85df716d",
"size": "462",
... |
from peer import *
from multiViewer import MultiViewer
from viewer import Viewer
from editor import Editor
class MultiViewEditor(Peer):
Description = ("Routing between editor elements and the query document of a multi-view element (like a table)",
'{ "dstRoom": null, "pillow": "MultiViewer.In.... | {
"content_hash": "ff8f1ec37efff053b6ec6840f31ebefc",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 115,
"avg_line_length": 26.29787234042553,
"alnum_prop": 0.6229773462783171,
"repo_name": "FreshXOpenSource/wallaby-base",
"id": "7dde7c132db309969c390a50c8914ea0f72738f4",
... |
"""
"""
import tornado
from tornado.web import HTTPError
from tornado import httputil
import pyrestful
import pyrestful.rest
class BaseHandler(pyrestful.rest.RestHandler):
def send_error(self, status_code=500, **kwargs):
"""
Generates the custom HTTP error.And always return 200 code.
""... | {
"content_hash": "7a3386d4267a51399c6576e069c42a91",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 26.03076923076923,
"alnum_prop": 0.5892434988179669,
"repo_name": "zhkzyth/tornado-async-rest-api",
"id": "9554b0b8428d41e2cdcb34285e53a8143dfc0aed",
... |
import os
import sys
from bcbio.rnaseq import (featureCounts, cufflinks, oncofuse, count, dexseq,
express, variation, stringtie, sailfish)
from bcbio.ngsalign import bowtie2, alignprep
from bcbio.variation import vardict
import bcbio.pipeline.datadict as dd
from bcbio.utils import filter_missi... | {
"content_hash": "0cce525e3fe7d55bb2dccc9ca299f17a",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 138,
"avg_line_length": 44.75257731958763,
"alnum_prop": 0.6496199032480995,
"repo_name": "mjafin/bcbio-nextgen",
"id": "759a082cb9f1171f18f9fe9aa67440d818064f0c",
"size":... |
from corehq.apps.sms.models import SMS
from pillowtop.dao.exceptions import DocumentNotFoundError
from pillowtop.dao.interface import ReadOnlyDocumentStore
class ReadonlySMSDocumentStore(ReadOnlyDocumentStore):
def get_document(self, doc_id):
try:
sms = SMS.objects.get(couch_id=doc_id)
... | {
"content_hash": "d3d259e7cd390dcc3f08c655170f4a0f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 58,
"avg_line_length": 30.357142857142858,
"alnum_prop": 0.7223529411764706,
"repo_name": "qedsoftware/commcare-hq",
"id": "e55fc37291f6f81d38c6329cc582ecd33aeef2f7",
"size... |
import os.path
import uuid
import pytest
from ..context import dnsimple
@pytest.fixture
def client():
return dnsimple.Client(
sandbox = True,
credentials_search_paths = [os.path.dirname(__file__)]
)
unregistered_domain_name = 'example-{0}.com'.format(uuid.uuid4())
# Ensure ... | {
"content_hash": "21ac2b103213ebd20570b1b24d8952f6",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 65,
"avg_line_length": 20.695652173913043,
"alnum_prop": 0.6617647058823529,
"repo_name": "vigetlabs/dnsimple",
"id": "519f8ca02682aae73c02bfcc277dbcdef96de636",
"size": "4... |
"""Test harness for diff_match_patch.py
Copyright 2006 Google Inc.
http://code.google.com/p/google-diff-match-patch/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/license... | {
"content_hash": "028cc7d63c733d9cee2cf0ce320544eb",
"timestamp": "",
"source": "github",
"line_count": 847,
"max_line_length": 408,
"avg_line_length": 47.91027154663518,
"alnum_prop": 0.6453918186298669,
"repo_name": "lemonad/methodiki",
"id": "11a01f23c7820a07f99d94c97a09c6389c8de47f",
"size": "4... |
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_param_EtherTap', [dirname(__file__)])
except ImportError:
import _par... | {
"content_hash": "33a7d8a27cdba9aa46a9cb52b07df220",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 110,
"avg_line_length": 37.05050505050505,
"alnum_prop": 0.6523991275899673,
"repo_name": "silkyar/570_Big_Little",
"id": "13f648f8de785058c2178b03426156bcc4488fa7",
"size"... |
import re
import falcon
from monasca_common.simport import simport
from monasca_common.validation import metrics as metric_validation
from oslo_config import cfg
from oslo_log import log
from oslo_utils import encodeutils
import pyparsing
import six
from monasca_api.api import alarm_definitions_api_v2
from monasca_ap... | {
"content_hash": "3bebd87cc9d5124ab5ff825b611aa9ce",
"timestamp": "",
"source": "github",
"line_count": 741,
"max_line_length": 100,
"avg_line_length": 43.18488529014845,
"alnum_prop": 0.53371875,
"repo_name": "stackforge/monasca-api",
"id": "a2913d27d042432dcaa2e03f4805addfb60978e9",
"size": "3263... |
'''
slurm2json.py: convert a slurm.conf to a machines.json input file
Copyright (c) 2017-2019 Vanessa Sochat
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... | {
"content_hash": "e8c593bd8b4684e0c6b02374ddd8c299",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 109,
"avg_line_length": 33.32411067193676,
"alnum_prop": 0.5620922784960266,
"repo_name": "researchapps/job-maker",
"id": "430d7a18d0a8fa08ff810b9e899a9b1600a69c61",
"size... |
from keystone.contrib.extensions.admin.extension import BaseExtensionHandler
from keystone.controllers.services import ServicesController
from keystone.controllers.roles import RolesController
class ExtensionHandler(BaseExtensionHandler):
def map_extension_methods(self, mapper, options):
# Services
... | {
"content_hash": "74347b94a4cfce043421c5f9950f2d68",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 76,
"avg_line_length": 48.78333333333333,
"alnum_prop": 0.6006149641270926,
"repo_name": "pvo/keystone",
"id": "5b34c18876c67c1f0ceedf0204e6888a1631025f",
"size": "3575",
... |
from sqlalchemy import Column, String, Integer, DATETIME, Boolean
from datetime import datetime
from .utils import Base
from .abstract import QkouBase
from static import LEC_INFO_ID_TEMPLATE, LEC_INFO_TEMPLATE
class Info(Base, QkouBase):
"""
Model for lecture information. This model relate with subject model... | {
"content_hash": "eba329d9e617af5de226780a0aea64c4",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 107,
"avg_line_length": 39.486111111111114,
"alnum_prop": 0.5768554344002814,
"repo_name": "pddg/qkouserver",
"id": "0a1774b769c590818331b6bb6c763254454d5729",
"size": "284... |
"""
deserializers.form_data
~~~~~~~~~~~~~~~~~~~~~~~~~
Deserializer that is compliant with the RFC 2388
multipart/form-data format
It's broken down into 2 parts:
* A parser for spec compliant validations
* A normalizer for converting into a common
format expected by our ... | {
"content_hash": "14a4091e74dfb9dc94e8f7107871700b",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 78,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.5789795918367346,
"repo_name": "sassoo/goldman",
"id": "efade46a82de7b2fa85fd8d2649618089d5eaa83",
"size": "4900... |
"""
SQLAlchemy models for nova data.
"""
from sqlalchemy import Column, Index, Integer, BigInteger, Enum, String, schema
from sqlalchemy.dialects.mysql import MEDIUMTEXT
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey, DateTime, Boolean, Text, Float
from sqlalchemy.orm import ... | {
"content_hash": "f68bce785070573eff89bbfce63a32a3",
"timestamp": "",
"source": "github",
"line_count": 1388,
"max_line_length": 79,
"avg_line_length": 36.757925072046106,
"alnum_prop": 0.6198549588396707,
"repo_name": "Yuriy-Leonov/nova",
"id": "3f44850caaae3a4e033e1906619a7e26dec72c57",
"size": "... |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, in_data, out_attributes, user_options, num_cores,
outfile):
import os
from genomicode import filelib
from genomicode import ... | {
"content_hash": "c37ec5326f27753d1cd2b3517e6daed0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 24.44736842105263,
"alnum_prop": 0.5683530678148547,
"repo_name": "jefftc/changlab",
"id": "2344f027fc7dfc86f51131ef3bce7cbbf6b8e81a",
"size": "929",... |
"""
Le premier programme en Python
* utilisation des arguments de la lignne de commande
* les listes et la fonction map
* les threads
* le logger
@author Dragos STOICA
@version 0.3
@date 16.feb.2014
"""
import sys, threading, logging
class Bonjour(threading.Thread):
def __init__(self, personne):
threadin... | {
"content_hash": "5aacd91f4b0bbb123f43db140b1102f8",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 26.44,
"alnum_prop": 0.6180030257186082,
"repo_name": "UPB-FILS/SE",
"id": "72a5ebbd1fd77e165e2502a2f564a96b9efe10de",
"size": "1322",
"binary": fa... |
from app import baza
from models import Pytanie, Odpowiedz
import os
def pobierz_dane(plikcsv):
"""Funkcja zwraca tuplę tupli zawierających dane pobrane z pliku csv."""
dane = []
if os.path.isfile(plikcsv):
with open(plikcsv, "r") as sCsv:
for line in sCsv:
line = line... | {
"content_hash": "871aeed7ed5d79556b4b8ba56c403bba",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 31.606060606060606,
"alnum_prop": 0.6116970278044104,
"repo_name": "koduj-z-klasa/python101",
"id": "e3140b9cffae652c1f6f17cc3755e3248f9b030b",
"size... |
import gnupg
import os.path
class GpgEncrypt:
def __init__(self):
self.encrypted_file = ''
self.try_decoded_file = ''
self.exported_private_key_file = os.path.dirname(os.path.abspath(__file__)) + '/exported_key.private'
self.exported_public_key_file = os.path.dirname(os.path.abspat... | {
"content_hash": "902c193e81d8dd337de1d49718f26407",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 109,
"avg_line_length": 46.71212121212121,
"alnum_prop": 0.611417450535193,
"repo_name": "boisde/Greed_Island",
"id": "23dbf9fde761dbb2d2a376154dbc218347939bd0",
"size": "3... |
"""
Django settings for vanguard project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
i... | {
"content_hash": "d3dab0a585f557b0af6b02b59096d8f3",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 91,
"avg_line_length": 26.789115646258505,
"alnum_prop": 0.6368715083798883,
"repo_name": "svalleru/vanguard",
"id": "ea9ee5fd8c58da177ac8865a24903591d942659a",
"size": "3... |
from cloudify.workflows import ctx
instance = next(ctx.node_instances)
instance.execute_operation('interface.op')
| {
"content_hash": "3c01369c73071c9d2677cc3591be2333",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 42,
"avg_line_length": 28.75,
"alnum_prop": 0.808695652173913,
"repo_name": "dankilman/clash",
"id": "12d2528e582f644f52bf58804c01157b1439dcdb",
"size": "115",
"binary": f... |
import stringcase
def normalize_acronyms(s: str) -> str:
"""Replaces variations of acronyms when converting various words.
Specifically when considering how to generate a CONST_CASE constant,
strings such as WiFi should not be WI_FI but rather WIFI
"""
return s.replace('WiFi', 'Wifi').repla... | {
"content_hash": "8160eca217704c8afb51c4b323af4a89",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 35.733333333333334,
"alnum_prop": 0.7276119402985075,
"repo_name": "project-chip/connectedhomeip",
"id": "594bcff7a2ecb70b13dcb138be5b96b124d20933",
... |
"""Websocket API for Z-Wave JS."""
from __future__ import annotations
from collections.abc import Callable
import dataclasses
from functools import partial, wraps
from typing import Any
from aiohttp import web, web_exceptions, web_request
import voluptuous as vol
from zwave_js_server.client import Client
from zwave_j... | {
"content_hash": "2c29aaa0df6275429c86480f6bad38a1",
"timestamp": "",
"source": "github",
"line_count": 2140,
"max_line_length": 98,
"avg_line_length": 30.445327102803738,
"alnum_prop": 0.6289196199714518,
"repo_name": "GenericStudent/home-assistant",
"id": "0e947de982b5537bfe9e27e74ae3e726b669660f",... |
"""Inventationery URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | {
"content_hash": "d4e75e781acba2316a40360ed597a117",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 84,
"avg_line_length": 48.51020408163265,
"alnum_prop": 0.6924694993689524,
"repo_name": "alexharmenta/Inventationery",
"id": "50e788266a71e38270d6c11385006a99e9701adc",
"s... |
'''
Elixir package
A declarative layer on top of the `SQLAlchemy library
<http://www.sqlalchemy.org/>`_. It is a fairly thin wrapper, which provides
the ability to create simple Python classes that map directly to relational
database tables (this pattern is often referred to as the Active Record design
pattern), provi... | {
"content_hash": "c3844c7fd8ed5c5a210185e227cad0a3",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 78,
"avg_line_length": 32.3421052631579,
"alnum_prop": 0.661513425549227,
"repo_name": "gjhiggins/elixir",
"id": "a242b538a123f5a88c61891de8359942ed5291ff",
"size": "3687"... |
from django.db import models
from django.conf import settings
from actstream.models import Action
from . import messages
class ActionNotification(models.Model):
action = models.ForeignKey(Action, on_delete=models.CASCADE)
user = models.ForeignKey(settings.AUTH_USER_MODEL, db_index=True, related_name='+', on_... | {
"content_hash": "48a03585e90526bfc5177c7e5ab584f3",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 113,
"avg_line_length": 30.45631067961165,
"alnum_prop": 0.6305387312719158,
"repo_name": "burnsred/django-action-notifications",
"id": "5648a36311cb087b1ff94f269510b3d3adb5... |
import json
from dlkit.json_.assessment.sessions import ItemLookupSession
from dlkit.json_.assessment.objects import ItemList
from dlkit.primordium.id.primitives import Id
from ..qti.numeric_response_records import MagicNumericResponseItemLookupSession
from ..qti.inline_choice_records import RandomizedInlineChoiceIt... | {
"content_hash": "6c6f43ee7b48d0e8d9d31562357edf8d",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 97,
"avg_line_length": 45.35849056603774,
"alnum_prop": 0.6568219633943427,
"repo_name": "mitsei/dlkit",
"id": "8808676b6c8157392bb9b5953f6f71c6bf61111b",
"size": "2404",
... |
"""
A very basic, ORM-based backend for simple search during tests.
"""
from django.conf import settings
from django.db.models import Q
from haystack import connections
from haystack.backends import BaseEngine, BaseSearchBackend, BaseSearchQuery, SearchNode, log_query
from haystack.inputs import PythonData
from haystac... | {
"content_hash": "3d4933698b588b5c4fa7d87faa14b03f",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 120,
"avg_line_length": 32.04838709677419,
"alnum_prop": 0.5624056366381479,
"repo_name": "josesanch/django-haystack",
"id": "36664da015f26e738bbdf83a9d959257f11e3b27",
"s... |
import console
class State(object):
def __init__(self):
self.current_stack = None
def update(self):
pass
def draw(self):
pass
class UIState(State):
def __init__(self, ui_element):
super(UIState, self).__init__()
self.ui_element = ui_element
def draw(sel... | {
"content_hash": "4086315899bd677c1e31503a0ffab2b1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 39,
"avg_line_length": 17.72,
"alnum_prop": 0.5643340857787811,
"repo_name": "co/TheLastRogue",
"id": "ae9cd3a9fb749eb6576d6ff9054a65bc20e79e84",
"size": "443",
"binary":... |
import _plotly_utils.basevalidators
class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hoverinfosrc", parent_name="funnel", **kwargs):
super(HoverinfosrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | {
"content_hash": "5011f9b253ae6aee57f5a04f44af218d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 83,
"avg_line_length": 37.09090909090909,
"alnum_prop": 0.6323529411764706,
"repo_name": "plotly/plotly.py",
"id": "f7497e22ec2fa7970e2dfdc56f589a3a69a00725",
"size": "408"... |
def generate(model, amount):
def wrap(n):
for i in range(n):
yield model.create()
return [y for x in wrap(amount) for y in x]
| {
"content_hash": "c12bf70740bfdebfc41aa8aca9b31501",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 47,
"avg_line_length": 30.8,
"alnum_prop": 0.5714285714285714,
"repo_name": "ahitrin/carlo",
"id": "601ed329092906363d64faa5ca4d8d25047a5f53",
"size": "154",
"binary": fal... |
"""
Allows for the computation of the PQ-Gram edit distance of two trees. To calculate the distance,
a Profile object must first be created for each tree, then the edit_distance function can be called.
For more information on the PQ-Gram algorithm, please see the README.
"""
import tree, copy
class P... | {
"content_hash": "1e21c7f0d1556a390e0987f3aacdff48",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 105,
"avg_line_length": 36.695238095238096,
"alnum_prop": 0.5853880093433688,
"repo_name": "TylerGoeringer/PyGram",
"id": "6a11acbebe0fe51cbbcb0fc1b8a840397a444e17",
"size... |
import argparse
import sys
import logging
import os
import random
DEBUG=True
NotDEBUG=not DEBUG
parser = argparse.ArgumentParser(description="CNV heatmap",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--input', action='store', nargs='... | {
"content_hash": "062291ef9638cdd0723f972246b00c0e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 158,
"avg_line_length": 32.65151515151515,
"alnum_prop": 0.5930394431554524,
"repo_name": "shengqh/ngsperl",
"id": "f48f363742e2f97718b334544190aca69be5ca8c",
"size": "2155... |
"""
Setup
"""
from setuptools import setup
from setuptools.command.install import install
URL = "http://dev.dataiku.com/~cstenac/dev-recruiting/us-census.db.gz"
LOCAL = "resources/us-census.db.gz"
LOCAL_EXTRACT = "resources/us-census.db"
class MyInstall(install):
def run(self):
install.run(self)
... | {
"content_hash": "23686b79e2c67d16b5d64d0e290b5c81",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 70,
"avg_line_length": 26.029411764705884,
"alnum_prop": 0.6418079096045197,
"repo_name": "sebdiem/webapp",
"id": "4215cb17fe240de86ecca67257065a4188288214",
"size": "1029"... |
"""
Provides serialization for API responses.
See `DRF serializer documentation <http://www.django-rest-framework.org/api-guide/serializers/>`_
Used by the View classes api/views.py to serialize API responses as JSON or HTML.
See DEFAULT_RENDERER_CLASSES setting in core.settings.contrib for the enabled renderers.
"""... | {
"content_hash": "87361e8de04ee89131f0284664938ecf",
"timestamp": "",
"source": "github",
"line_count": 1513,
"max_line_length": 120,
"avg_line_length": 34.66622604097819,
"alnum_prop": 0.6509437559580553,
"repo_name": "venicegeo/eventkit-cloud",
"id": "aa5af2b5a05d5e314a328b81bf1e9b462dc5994a",
"s... |
from oslo_log import helpers
from oslo_log import log as logging
import oslo_messaging
LOG = logging.getLogger(__name__)
class NwaL3ProxyCallback(object):
target = oslo_messaging.Target(version='1.0')
def __init__(self, context, agent):
self.context = context
self.agent = agent
@helper... | {
"content_hash": "2e237904ed61a5d037d17683c7516522",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 61,
"avg_line_length": 28.6,
"alnum_prop": 0.6748251748251748,
"repo_name": "openstack/networking-nec",
"id": "c1b19fdd6c288ceabdfaa6f875028c809ef3879f",
"size": "1494",
... |
import os.path
import os
import numpy as np
import copy
import PDielec.Calculator as Calculator
from PyQt5.QtWidgets import QPushButton, QWidget
from PyQt5.QtWidgets import QComboBox, QLabel, QLineEdit, QListWidget
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets ... | {
"content_hash": "2379ba0c8c7ca8838dda6e6c8b73202d",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 322,
"avg_line_length": 51.69202898550725,
"alnum_prop": 0.6336651012826803,
"repo_name": "JohnKendrick/PDielec",
"id": "4e2fe0b1aad7752c9a3015ab4e50216f4776dc4d",
"size":... |
from django import forms
class GitTokenForm(forms.Form):
user = forms.CharField(max_length=15)
password = forms.CharField(max_length=100, widget=forms.PasswordInput(render_value=False))
| {
"content_hash": "a52e179181a19467182d45e53bf45c53",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 94,
"avg_line_length": 28.142857142857142,
"alnum_prop": 0.7614213197969543,
"repo_name": "emergence-lab/emergence-lab",
"id": "c1d49a9b9a4a55aec03e924ea912ad3bfdff64fe",
"s... |
nos = 0
while nos < 10:
nos += 1
if nos%2 == 0:
continue
print(nos)
# AVOID INFINITE LOOP
# if the loop has no condition that can end, the loop will run infinitely
# here if we forgot to add "nos += 1, the loop will become infinite loop | {
"content_hash": "33e666c7e1ff6116a5f0167ddee0be8b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 25.7,
"alnum_prop": 0.6498054474708171,
"repo_name": "KT26/PythonCourse",
"id": "41272f933ac706bb835692a9eaf7ef4b4ce367ee",
"size": "465",
"binary"... |
def test_bitrise_den_agent(host):
bitrise_den_agent = host.file("/home/linuxbrew/bitrise-den-agent")
assert bitrise_den_agent.user == "linuxbrew"
assert bitrise_den_agent.group == "staff"
assert bitrise_den_agent.mode == 0o755
| {
"content_hash": "39179b2d35694d815c7ce3eb7b5d11c9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 70,
"avg_line_length": 48.6,
"alnum_prop": 0.7078189300411523,
"repo_name": "bitrise-io/osx-box-bootstrap",
"id": "542a452bc3416ee8e0c5e878cf64a3cafb5477dd",
"size": "243",
... |
from datetime import datetime, timedelta, time
import pytz
from time import mktime
import iso8601
import re
from unidecode import unidecode
from vumi.utils import get_first_word
from vusion.const import PLUS_REGEX, ZEROS_REGEX
def get_default(kwargs, field, default_value):
return kwargs[field] if field in kwarg... | {
"content_hash": "8e55f4be6b698a6d1ca3b6eb7ffbad46",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 96,
"avg_line_length": 28.598173515981735,
"alnum_prop": 0.6495289797221778,
"repo_name": "texttochange/vusion-backend",
"id": "5b0eb9a6ff5bf0be0ef37d7a90b2cbf9447b2d8e",
... |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
from openpyxl.descriptors import (
Integer,
Alias
)
from openpyxl.descriptors.excel import Relation
from openpyxl.descriptors.serialisable import Serialisable
class SheetBackgroundPicture(Serialisable):
tagname = "picture"
id =... | {
"content_hash": "8d8b7d5dd58e12a5b113d06df542f83d",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 58,
"avg_line_length": 28.26530612244898,
"alnum_prop": 0.5613718411552346,
"repo_name": "aragos/tichu-tournament",
"id": "49970a32b91d69249767a29cfed814cd10883f86",
"size"... |
import webbrowser
import os
import re
import urllib
import json
# Styles and scripting for the page
main_page_head = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fresh Tomatoes!</title>
<!-- Bootstrap 3 -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/boot... | {
"content_hash": "c9a3c3a762ca5aef4943472202bcbb74",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 146,
"avg_line_length": 33.64673913043478,
"alnum_prop": 0.5740591180746245,
"repo_name": "MariiaSurmenok/Movie-Trailer-Website",
"id": "b70a96e3fb79f8604112e46fb7575485acd1... |
from datetime import datetime
from django import forms
from django.utils.translation import ugettext_lazy as _
from pows.apps.forum.models import Topic, Reply
class PostForm(forms.ModelForm):
subject = forms.CharField(label=_('Subject'), widget=forms.TextInput(
attrs={'size':'80'}))
message =... | {
"content_hash": "a7cb460c864f0b77403ad0722ba75305",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 73,
"avg_line_length": 34.896103896103895,
"alnum_prop": 0.5764793449944176,
"repo_name": "indexofire/gork",
"id": "6e19b0e378fe2132969ab18be05685fa287d144f",
"size": "2712... |
from __future__ import print_function, division
import argparse
import requests
# See https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
# for URL format details.
URL = ('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?'
'db=%(database)s&id=%(id)s&rettype=fasta&retmode=text')
parser = arg... | {
"content_hash": "a2c881c0a6d3c375ef325d09f114f3aa",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 30.5,
"alnum_prop": 0.6908665105386417,
"repo_name": "bamueh/dark-matter",
"id": "5f45d66db529ccfaa520815b1862e581b77b10ca",
"size": "877",
"binary... |
import os
DEBUG = True
LOGIN_REDIRECT_URL = '/'
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
# SECURE_SSL_REDIRECT = True
# SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_HTTPONLY = True
CSRF_COOKIE_HTTPONLY = True
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
URL_PREFIX = ''
# Uncomment th... | {
"content_hash": "a2233a4b9ba71d86ec8f64ee86b1b1bc",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 86,
"avg_line_length": 31.404580152671755,
"alnum_prop": 0.6707583859990277,
"repo_name": "grendel513/django-DefectDojo",
"id": "d1b600285769e77a29348d74eacc2e00d7f5ddc2",
... |
import bz2
import csv
import datetime
import gzip
import json
import os
import random
import shutil
import tempfile
import unittest
import mock
from contextlib import closing
from freezegun import freeze_time
from exporters.exceptions import ConfigurationError
from exporters.export_formatter.csv_export_formatter import... | {
"content_hash": "14e53ec172ab2475c1104513a950bd7c",
"timestamp": "",
"source": "github",
"line_count": 695,
"max_line_length": 100,
"avg_line_length": 35.48057553956834,
"alnum_prop": 0.5721643213431201,
"repo_name": "scrapinghub/exporters",
"id": "0064b5250559acf92573895876318f6ae789768f",
"size"... |
"""
Mock unit tests for the NetApp block storage driver interfaces
"""
from cinder import test
from cinder.volume.drivers.netapp.dataontap import block_7mode
from cinder.volume.drivers.netapp.dataontap import block_cmode
from cinder.volume.drivers.netapp.dataontap import fc_7mode
from cinder.volume.drivers.netapp.dat... | {
"content_hash": "3336562a38a77f8f4b34c99a9e679e39",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 75,
"avg_line_length": 44.35087719298246,
"alnum_prop": 0.6950158227848101,
"repo_name": "ge0rgi/cinder",
"id": "6a42fde1ced31ef6610fda5b1fd2a0b0ce0ec77b",
"size": "3161",
... |
from django.contrib.auth.models import User
from django.db import models
from settings import UserSettings
class Setting(models.Model):
user = models.ForeignKey(User, unique=False)
name = models.CharField(max_length=200, unique=True)
value = models.CharField(max_length=200)
# attach a UserSettings o... | {
"content_hash": "c2777b1634c984dbebb02f2965c49843",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 30.846153846153847,
"alnum_prop": 0.7605985037406484,
"repo_name": "ychaim/mybitbank",
"id": "63ef4a35d78c2d62e621a15b49ab2bf0e176a99f",
"size": "401... |
"""
Get and parse one url
"""
import os
import sys
import requests
from bs4 import BeautifulSoup
import re
__author__ = 'Rob Edwards'
if True:
url = 'https://www.altmetric.com/details/1386636'
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96... | {
"content_hash": "17d5c26a346b7aaf995c064fc963dd5f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 147,
"avg_line_length": 25.55,
"alnum_prop": 0.6086105675146771,
"repo_name": "linsalrob/EdwardsLab",
"id": "05a4255318ef061f929e68b1a209cb846e72fddb",
"size": "1533",
"b... |
import tensorflow as tf
import numpy as np
import glob
from os import path, makedirs
from matplotlib import pyplot as plt
from batchnorm import ConvolutionalBatchNormalizer
from argparse import ArgumentParser
# Default values for parameters
NUM_EPOCHS = 1e+9
IMAGE_SAVE_RATE = 1000
MODEL_SAVE_RATE = 100000
FINAL_MODEL_... | {
"content_hash": "0a24e3c29169336222abbeb889e4b5d5",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 105,
"avg_line_length": 37.40588235294118,
"alnum_prop": 0.6333543009907218,
"repo_name": "bperez77/ensemble_colorization",
"id": "585bb6e42aa38b587cad0d6c732c9f2bff305b12",... |
import logging
from pitz.entity import Entity
from pitz.cmdline import PitzScript
log = logging.getLogger('pitz.cmdline.pitzedit')
class PitzEdit(PitzScript):
"""
Edit an attribute's value
"""
script_name = 'pitz-edit'
def handle_p(self, p):
p.set_usage('%prog frag attribute')
def... | {
"content_hash": "3b4d3fe8e420b064988e09d3fc6c5c86",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 59,
"avg_line_length": 23.142857142857142,
"alnum_prop": 0.5703703703703704,
"repo_name": "mw44118/pitz",
"id": "3e24ffd581883f956adc4b2a9c7497bcc3067d7f",
"size": "859",
... |
import torch
from numpy.testing import assert_almost_equal
import numpy
from allennlp.common import Params
from allennlp.common.testing.test_case import AllenNlpTestCase
from allennlp.modules.matrix_attention import CosineMatrixAttention
from allennlp.modules.matrix_attention.matrix_attention import MatrixAttention
... | {
"content_hash": "6e640855114d43d757206a8d8eb804ff",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 103,
"avg_line_length": 45,
"alnum_prop": 0.6491582491582492,
"repo_name": "allenai/allennlp",
"id": "579e8b38e0fc3e88676dfde71b352a1aab9d9400",
"size": "1485",
"binary":... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <openssl/hmac.h>
"""
TYPES = """
type... | {
"content_hash": "31bdaf37224bb083debab845336f6cbe",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 27.294117647058822,
"alnum_prop": 0.646551724137931,
"repo_name": "hipnusleo/laserjet",
"id": "3a48f6680fe2db88512fc5b4a0e45a172e219d3c",
"size": "13... |
import unittest
import pybullet
from pybullet_utils import bullet_client
PLANE_PATH = "plane.urdf"
ROBOT_PATH = "r2d2.urdf"
class TestUserDataMethods(unittest.TestCase):
@classmethod
def setUpClass(cls):
TestUserDataMethods.server = bullet_client.BulletClient(
connection_mode=pybullet.SHARED_MEMORY... | {
"content_hash": "3db07c82593b811a95aa557e9271ed44",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 99,
"avg_line_length": 43.19318181818182,
"alnum_prop": 0.7023590283258792,
"repo_name": "MTASZTAKI/ApertusVR",
"id": "1f0d06e8ed1639e82136b8ec819419b498ae7648",
"size": "... |
import itertools
import struct
from binascii import unhexlify
from codecs import getincrementaldecoder
from typing import Dict, Optional, Tuple, Union
import pytest
from wsproto import extensions as wpext, frame_protocol as fp
class TestBuffer:
def test_consume_at_most_zero_bytes(self) -> None:
buf = fp... | {
"content_hash": "d16e919e0cbc749b804b9aa52f0b4ec4",
"timestamp": "",
"source": "github",
"line_count": 1204,
"max_line_length": 86,
"avg_line_length": 35.848837209302324,
"alnum_prop": 0.5926972800148279,
"repo_name": "python-hyper/wsproto",
"id": "76c40e45cf180623ef70c3a5df6554f6f4df220a",
"size"... |
import ast
import yaml
import copy
import argparse
from argparse import ArgumentParser, RawDescriptionHelpFormatter
class ArgsParser(ArgumentParser):
def __init__(self):
super(ArgsParser, self).__init__(
formatter_class=RawDescriptionHelpFormatter)
self.add_argument(
"-o", ... | {
"content_hash": "4d251915d345c29d034d1d80053c0ad0",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 118,
"avg_line_length": 32.504464285714285,
"alnum_prop": 0.5449800851531383,
"repo_name": "PaddlePaddle/models",
"id": "4af0737186061c611aeb353d5a4ed0c73e16ba14",
"size":... |
from sqlalchemy import Integer, String, ForeignKey, func, desc, and_, or_
from sqlalchemy.orm import interfaces, relationship, mapper, \
clear_mappers, create_session, joinedload, joinedload_all, \
subqueryload, subqueryload_all, polymorphic_union, aliased,\
class_mapper, with_polymorphic
from sqlalchemy im... | {
"content_hash": "e2244ab5977f2bd9049983d50b4a3651",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 88,
"avg_line_length": 38.89473684210526,
"alnum_prop": 0.5579612088407758,
"repo_name": "rclmenezes/sqlalchemy",
"id": "93cccee7a3df68fd70962bce4dd4a94d603c782f",
"size":... |
from CIM15.Element import Element
class OperatingShare(Element):
"""Specifies the contract relationship between a PowerSystemResource and a contract participant.Specifies the contract relationship between a PowerSystemResource and a contract participant.
"""
def __init__(self, percentage=0.0, PowerSystemR... | {
"content_hash": "0eb1660e6ae14e0fc807409267f5a9c4",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 286,
"avg_line_length": 55.723076923076924,
"alnum_prop": 0.729431253451132,
"repo_name": "rwl/PyCIM",
"id": "2bdb4dd7b036dfcaad24f0b2c86e699895ec079c",
"size": "4722",
"... |
from ...external.qt import QtGui, QtCore
__all__ = ["CompletionTextEdit"]
class CompletionTextEdit(QtGui.QTextEdit):
def __init__(self, parent=None):
super(CompletionTextEdit, self).__init__(parent)
self.setMinimumWidth(400)
self.completer = None
self.word_list = None
... | {
"content_hash": "dac27e825eb65f0c946025e086de264d",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 84,
"avg_line_length": 30.52577319587629,
"alnum_prop": 0.6045254981425194,
"repo_name": "JudoWill/glue",
"id": "ebb297a33f4eb36a3413d99393e15b43776b129c",
"size": "3150",
... |
def extractSilenttranslationsCom(item):
'''
Parser for 'silenttranslations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Legend', 'Legend', 'translated'),
('P... | {
"content_hash": "6dc163ac43981dc0477ca352497f0723",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 29.476190476190474,
"alnum_prop": 0.6058158319870759,
"repo_name": "fake-name/ReadableWebProxy",
"id": "189ec5ebf3581a1691ee708a1ef1e8aa800c4bba",
"... |
import yaml
import sys
import argparse
outfile = None
def print_outfile(string):
print(string, file=outfile)
def print_log_to_stderr(string):
print(string, file=sys.stderr)
def get_dep_key(group_id, artifact_id, version):
return (group_id, artifact_id, version)
def get_version_string(version):
if t... | {
"content_hash": "b0fcc542f3aa3fc835049e5dc83e62fa",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 98,
"avg_line_length": 41.461077844311376,
"alnum_prop": 0.6031195840554593,
"repo_name": "monetate/druid",
"id": "ec564e13b4696ad3a283826893fae2657061c6d5",
"size": "7730... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stagecraft.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "72bf965caf2bb5736ba17da540e09d97",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.7142857142857143,
"repo_name": "alphagov/stagecraft",
"id": "e9daeeb53d51490fc5f0b58db47135d7efd30897",
"size": "2... |
import configparser
import glob
import os
import sys
import syslog
import time
import traceback
from libdaemon import Daemon
# constants
DEBUG = False
IS_JOURNALD = os.path.isfile('/bin/journalctl')
MYID = "".join(list(filter(str.isdigit, os.path.realpath(__file__).split('/')[-1])))
MYAPP = os.path... | {
"content_hash": "73cfb7251afe0c30d10aa290d75a5f5f",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 91,
"avg_line_length": 33.20348837209303,
"alnum_prop": 0.6023463491507617,
"repo_name": "Mausy5043/domod",
"id": "76c651dfe3b3a36c44ddabbd06efc85bc2c22d85",
"size": "5982... |
import os
class Gperf_P2:
conf_lst = {}
e = False
root_dir = ""
def init(self, c_lst, ex, root_dir):
self.conf_lst = c_lst
self.e = ex
self.root_dir = root_dir
self.config = {
"name": "gperf", # Name of the package
"version": "3.0.4",... | {
"content_hash": "655de162f902060546ec0ad6319278bd",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 90,
"avg_line_length": 32.15384615384615,
"alnum_prop": 0.49681020733652315,
"repo_name": "Morphux/installer",
"id": "365304aa62914d63382c6cc25465cd2eb1f2912b",
"size": "25... |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="name",
parent_name="scatter.marker.colorbar.tickformatstop",
**kwargs
):
super(NameValidator, self).__init__(
plotly_name=... | {
"content_hash": "680ce67e339e4e3228197ab58e8a5a07",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 66,
"avg_line_length": 29.823529411764707,
"alnum_prop": 0.5779092702169625,
"repo_name": "plotly/python-api",
"id": "46af8d2d5f70b83b6f9dc23404e615af3cb5939c",
"size": "50... |
"""
IBM Cloud provider class
"""
from ipaddress import ip_network
from kvirt import common
from kvirt.common import pprint, error
from kvirt.defaults import METADATA_FIELDS
from ibm_vpc import VpcV1, vpc_v1
import ibm_boto3
from ibm_botocore.client import Config
from ibm_cloud_sdk_core.authenticators import IAMAuthent... | {
"content_hash": "8c727545d8fda5308c6dc299e4400f59",
"timestamp": "",
"source": "github",
"line_count": 1427,
"max_line_length": 119,
"avg_line_length": 45.14926419060967,
"alnum_prop": 0.5395945862047556,
"repo_name": "karmab/kcli",
"id": "3dbe272cc629f8f474e0bff9fa561c2619f3d38f",
"size": "64474"... |
from Lotus.application import app
from Lotus.config import default_config
if __name__ == '__main__':
app.config.from_object(default_config.DevelopmentConfig)
HOST = app.config.get('HOST')
PORT = app.config.get('PORT')
DEBUG = app.config.get('DEBUG')
app.run(host=HOST, port=PORT, debug=DEBUG)
#... | {
"content_hash": "0aca0c2ee68a67b781207b9592c72629",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 89,
"avg_line_length": 39.30769230769231,
"alnum_prop": 0.6927592954990215,
"repo_name": "Jayin/Lotus",
"id": "376fb407dc0f60bbc49ee13711b5ffe6bfda6986",
"size": "536",
"... |
"""
"""
import cPickle
import gzip
import os
import sys
import time
import numpy
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from logistic_sgd import LogisticRegression, load_data
from mlp import HiddenLayer
from rbm import RBM
from rbm_mean import RBM_Mean
fr... | {
"content_hash": "334b76b604b45f76cebacc4453c6393f",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 78,
"avg_line_length": 40.825471698113205,
"alnum_prop": 0.5534373194685153,
"repo_name": "xiawei0000/Kinectforactiondetect",
"id": "d8bc42608a3364ada281e6baf985c7462348b3a0... |
import pandas as pd
import pandas.util.testing as tm
import pytest
import ibis
pytest.importorskip('multipledispatch')
pytestmark = pytest.mark.pandas
join_type = pytest.mark.parametrize(
'how',
[
'inner',
'left',
'right',
'outer',
pytest.mark.xfail(
's... | {
"content_hash": "6582012d39b8d7521cadad0d28a7237f",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 79,
"avg_line_length": 31.479495268138802,
"alnum_prop": 0.6288205230985069,
"repo_name": "deepfield/ibis",
"id": "a7f487c66e546155b6a39ba05f51911db566ddda",
"size": "9979... |
import logging
import pymel.core as pymel
from maya import cmds
from omtk import constants
from omtk.libs import libAttr
from omtk.libs import libCtrlShapes
from omtk.libs import libRigging
from omtk.modules import rigIK
from omtk.modules import rigLimb
log = logging.getLogger('omtk')
class CtrlIkLeg(rigIK.CtrlIk):... | {
"content_hash": "ef0cc1abb23864349702d27d75d4d1df",
"timestamp": "",
"source": "github",
"line_count": 611,
"max_line_length": 135,
"avg_line_length": 44.09001636661211,
"alnum_prop": 0.5923011247633543,
"repo_name": "SqueezeStudioAnimation/omtk",
"id": "4e1eb6e9a947c10bc5f8225216536a67cd6c8cb7",
... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import io
import json
import os
import re
import sys
import tempfile
import itertools
import pstats
import six
from .console import log, truncate_left
from .environment import get_environments
from . import u... | {
"content_hash": "73693500baa80e2ece307288680fd428",
"timestamp": "",
"source": "github",
"line_count": 608,
"max_line_length": 92,
"avg_line_length": 31.794407894736842,
"alnum_prop": 0.5418240132429776,
"repo_name": "ericdill/asv",
"id": "0c051e85aeacc00e4fdcceb5329ecb7a086f7073",
"size": "19420"... |
"""
flask_cors
~~~~
Flask-CORS is a simple extension to Flask allowing you to support cross
origin resource sharing (CORS) using a simple decorator.
:copyright: (c) 2016 by Cory Dolphin.
:license: MIT, see LICENSE for more details.
"""
from .decorator import cross_origin
from .extension import ... | {
"content_hash": "3318b3e25b8157d3fca2f05a9c480df2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 29.5,
"alnum_prop": 0.7327249022164276,
"repo_name": "corydolphin/flask-cors",
"id": "c84a763f80ec2d17dfb3f059ba3f719b14ab62e8",
"size": "791",
"bi... |
import csv
import codecs
import cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __iter__(self):
return self
def next(self):
ret... | {
"content_hash": "1380d0cb38be1ea76d58df86366aa3f0",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 74,
"avg_line_length": 27.159420289855074,
"alnum_prop": 0.6008537886872999,
"repo_name": "Glasgow2015/team-10",
"id": "42bb4d75b2e79362469de488523055eaa8cfbfd7",
"size": "... |
from django.core.management.base import BaseCommand, CommandError
from django.db.models.loading import get_model
from django_usda.models import Food, FoodGroup, FoodLanguaLFactor, LanguaLFactor, NutrientData, Nutrient, Source, Derivation, Weight, Footnote, DataLink, DataSource, DeletedFood, DeletedNutrient, DeletedFoot... | {
"content_hash": "7860b9447f54a4011ee54c28173d01cb",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 211,
"avg_line_length": 34.026785714285715,
"alnum_prop": 0.6037785358173707,
"repo_name": "Zundrium/django-usda",
"id": "4ff1fa100f6d7beea43b3e70fc84a6e50a168c19",
"size"... |
"""Generates the all_tests.js file for consumption by Protractor.
Usage:
$ cd packages/grpc-web
$ python3 ./scripts/gen_test_htmls.py # Prerequisite
$ python3 ./scripts/gen_all_tests_js.py
"""
from string import Template
import common
ALL_TESTS_TEMPLATE_FILE = './scripts/template_all_tests_js.txt'
# The path of th... | {
"content_hash": "26e16298457151c2742fccb08d5fc321",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 105,
"avg_line_length": 34.44186046511628,
"alnum_prop": 0.6988521269412559,
"repo_name": "grpc/grpc-web",
"id": "3886c5430547144d922254a20384aea511fb1796",
"size": "2078",... |
from flask import (g, request, redirect, render_template,
session, url_for, jsonify, Blueprint)
from .models import User, Group
from .application import db, meetup
from .auth import login_required
from .forms import GroupForm
studygroup = Blueprint("studygroup", __name__, static_folder='static')
@... | {
"content_hash": "c090a3e12d633eba87037fe6292c1338",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 76,
"avg_line_length": 27.40714285714286,
"alnum_prop": 0.6020328381548085,
"repo_name": "BostonPython/studygroup",
"id": "3060ac136512824d76f48b50cdf6bf8114aff55b",
"size... |
import sys
import os
import sphinx_rtd_theme
# 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.abspat... | {
"content_hash": "35e5a633f87949eb665bbcfe16a12ed9",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 79,
"avg_line_length": 30.51875,
"alnum_prop": 0.6876919926274832,
"repo_name": "mehdidc/fluentopt",
"id": "d6a620ae4c923e73c05db017c933663f286f0dee",
"size": "10195",
"... |
def omaketx_command (infile, outfile, extraargs="",
options="", output_cmd="-otex",
showinfo=True, showinfo_extra="",
silent=False, concat=True) :
command = (oiio_app("oiiotool")
+ " " + make_relpath(infile,tmpdir)
+ " " ... | {
"content_hash": "14ac3cfb8141f7e0c849707f7d149141",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 98,
"avg_line_length": 45.88815789473684,
"alnum_prop": 0.5948387096774194,
"repo_name": "lgritz/oiio",
"id": "da2a79d6655733502f67aa2bc654c09f048e39fa",
"size": "7099",
... |
def patch():
if patch._initialized:
return
patch._initialized = True
import gevent.monkey
gevent.monkey.patch_all()
import sys
if sys.version_info.major < 3:
_py2_patches()
_export()
patch._initialized = False
def _export():
import lymph
lymph.__version__ = '0.10... | {
"content_hash": "d8eaf895d96be0f6d46c9ac39b71eb55",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 95,
"avg_line_length": 23.93548387096774,
"alnum_prop": 0.6630727762803235,
"repo_name": "dushyant88/lymph",
"id": "779e7b7391cef99a2239bf6ce49e832fb23ad5f7",
"size": "744"... |
from mrjob.job import MRJob
class MRWordCounter(MRJob):
def mapper(self, key, line):
timestamp, user_id = line.split()
yield user_id, timestamp
def reducer(self, uid, timestamps):
yield uid, sorted(timestamps)
if __name__ == '__main__':
MRWordCounter.run()
| {
"content_hash": "a6274dcca1877a8b3f6907cc98bf2578",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 41,
"avg_line_length": 19.933333333333334,
"alnum_prop": 0.6254180602006689,
"repo_name": "jepatti/mrjob_recipes",
"id": "0b34358f8563c8932bebb6c807061edf17d667d7",
"size":... |
import os
import optparse
import psutil
import sys
import time
from collections import Counter
PROC_ROOT_DIR = '/proc/'
TCP_CONN_STATUSES = [
'ESTABLISHED',
'SYN_SENT',
'SYN_RECV',
'FIN_WAIT1',
'FIN_WAIT2',
'TIME_WAIT',
'CLOSE',
'CLOSE_WAIT',
'LAST_ACK',
'LISTEN',
'CLOSING',
'NONE'
]
def find_pids_from_name(process_... | {
"content_hash": "3711a9d2815c47c4c2505ccbce71ae42",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 85,
"avg_line_length": 33.4,
"alnum_prop": 0.6762603824608847,
"repo_name": "jaimegago/sensu-plugins-process-checks",
"id": "f23606a0944be6e164556606e81ac98661cf09a3",
"si... |
from unittest import mock
import pytest
from globus_sdk.authorizers import RefreshTokenAuthorizer
REFRESH_TOKEN = "refresh_token_1"
ACCESS_TOKEN = "access_token_1"
EXPIRES_AT = -1
@pytest.fixture(params=["simple", "with_new_refresh_token"])
def response(request):
r = mock.Mock()
r.by_resource_server = {
... | {
"content_hash": "629cc2d70f6cffb9d1809eb207daa2ca",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 88,
"avg_line_length": 32.50617283950617,
"alnum_prop": 0.6699582225598177,
"repo_name": "globusonline/globus-sdk-python",
"id": "6b8bc6d352ba69808dfe04e6cb078f50d3185712",
... |
import re
import os
import shutil
from gppylib.db import dbconn
from test.behave_utils.utils import check_schema_exists, check_table_exists, drop_table_if_exists
from behave import given, when, then
CREATE_MULTI_PARTITION_TABLE_SQL = """
CREATE TABLE %s.%s (trans_id int, date date, amount decimal(9,2), region text)
WI... | {
"content_hash": "a200c7d1b18d4e61b6adfc14ed34bdaf",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 169,
"avg_line_length": 39.88636363636363,
"alnum_prop": 0.6606521050965496,
"repo_name": "Chibin/gpdb",
"id": "2bc239dfb221a295ea3ae3e48226c72d6b6d5012",
"size": "15795",... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("GaussianNB" , "BinaryClass_10" , "oracle")
| {
"content_hash": "1b659318c2662ba056142c4a9cbf2c10",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 72,
"avg_line_length": 35,
"alnum_prop": 0.7785714285714286,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "4db90e1ee37ca5beb079e74cf3428a5b24c375d2",
"size": "140",... |
import math
import os
import random
import re
import sys
# Complete the circularArrayRotation function below.
def circularArrayRotation(a, k, queries):
nn = len(a)
results = []
for query_idx in queries:
a_rot = [0 for ii in range(nn)]
# Create version of a after k rotations.
for i... | {
"content_hash": "c5f584795c572082a04ce40b51360342",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 52,
"avg_line_length": 24.91891891891892,
"alnum_prop": 0.5704989154013015,
"repo_name": "ejspeiro/HackerRank",
"id": "2662dec42e2ce2612527053ea7d3c680996b58d9",
"size": "9... |
"""
ks.time.util
~~~~~~~~~~~~
Misc. utility functions for dealing with time.
:copyright: (c) 2010 -- 2012 by Charlie Sharpsteen
:license: BSD
"""
import time
from datetime import datetime, timedelta
def from_isostring(datestring):
"""Takes a string in 'unambiguous format' and returns a dat... | {
"content_hash": "0f7b941ff33f376c8882aa8263247467",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 24.185185185185187,
"alnum_prop": 0.6447166921898928,
"repo_name": "Sharpie/python-kitchensink",
"id": "5529b1c73af700d7809394b5bf02e52f50f025b0",
"s... |
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
import json
import os
import urllib
import re
from re import findall
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
fr... | {
"content_hash": "33a2d0b4173e736c0c639c5edb4454cf",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 59,
"avg_line_length": 22.20689655172414,
"alnum_prop": 0.5590062111801242,
"repo_name": "andrewpx1/apiai-weather-webhook-sample-master",
"id": "d5f4b10028302e1ac7683a43eadf1... |
import re
from marshmallow import ValidationError
# from marshmallow.validate import Validator
__author__ = 'quxl'
class Phone(object):
"""Validate an Phone in China.
:param str error: Error message to raise in case of a validation error. Can be
interpolated with `{input}`.
"""
PHONE_REGEX ... | {
"content_hash": "9dbc5d6471564d4417d81f7fb009b6b5",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 89,
"avg_line_length": 27.47457627118644,
"alnum_prop": 0.6162862430598396,
"repo_name": "snbway/flask-rest-framework",
"id": "dbffff8b527f86fb65ee6cbc0cd52ad7d0397b8f",
"s... |
"""Tests for wrapper_common.execute."""
import contextlib
import io
import signal
import unittest
from tools.wrapper_common import execute
_INVALID_UTF8 = b'\xa0\xa1'
def _cmd_filter(cmd_result, stdout, stderr):
# Concat the input to a native string literal, to make sure
# it doesn't trigger a unicode encode/de... | {
"content_hash": "2cfefb446dd5ce7b35007267034fd152",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 68,
"avg_line_length": 28,
"alnum_prop": 0.661734693877551,
"repo_name": "bazelbuild/rules_apple",
"id": "3657fe13b24f466e351e0c2448f0e437fbb21bd3",
"size": "2562",
"bina... |
"""
test.t_utils.test_compat
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2014 by the RootForum.org team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
from __future__ import unicode_literals
import os
import shutil
import tempfile
import stat
from unittest import TestCase
from ma... | {
"content_hash": "a2c3946f8c9d72f005e1f340896affe1",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 115,
"avg_line_length": 31.353658536585368,
"alnum_prop": 0.5929599377674056,
"repo_name": "RootForum/magrathea",
"id": "157f36b30ae7141635aec7dc2763b4856823c6e9",
"size":... |
"""Support for IKEA Tradfri covers."""
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
from .base_class import TradfriBaseDevice
from .const import ATTR_MODEL, CONF_GATEWAY_ID, DEVICES, DOMAIN, KEY_API
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load Tradfri cov... | {
"content_hash": "ddbe8ab9afa5e653e1e09c71bd9b751e",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 84,
"avg_line_length": 34.054794520547944,
"alnum_prop": 0.6468222043443282,
"repo_name": "tchellomello/home-assistant",
"id": "2d99de7756ac75407b7a93bd52fd6a27fdee9672",
"... |
import mango
import mango.core
import sys
if sys.platform.startswith('linux'):
import DLFCN as dl
_flags = sys.getdlopenflags()
sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)
from . import _mango_open_data_generator as _mango_open_data_generator_so
sys.setdlopenflags(_flags)
else:
from . import... | {
"content_hash": "9c5bc110596f2edfd671b5554ce4c271",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 153,
"avg_line_length": 32.004149377593365,
"alnum_prop": 0.6299753662647478,
"repo_name": "pymango/pymango",
"id": "a6da7c64e681b8dca72d19a9966a185d9e1e6390",
"size": "77... |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineRes... | {
"content_hash": "4705c54ea8a5060c8cd248b179b678f4",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 229,
"avg_line_length": 46.373333333333335,
"alnum_prop": 0.6563638106191297,
"repo_name": "Azure/azure-sdk-for-python",
"id": "0bf487cefd9d1d198205a0cd9238519b0a13cf0d",
... |
"""Computations based on Chebyshev polynomial expansion
The kernel polynomial method (KPM) can be used to approximate various functions by expanding them
in a series of Chebyshev polynomials.
"""
import warnings
import numpy as np
import scipy
from . import _cpp
from . import results
from .model import Model
from .s... | {
"content_hash": "d5446e28698a990b4cec9b87f210846e",
"timestamp": "",
"source": "github",
"line_count": 572,
"max_line_length": 99,
"avg_line_length": 38.69755244755245,
"alnum_prop": 0.6101648972215947,
"repo_name": "MAndelkovic/pybinding",
"id": "74d5f316f6dc766d879d794a3415f48cb462847f",
"size":... |
"""Pytest configuration file.
This is a bit of a, ahem, alternative way of allowing testpy to find the pypyr
module, without having to go into your virtualenv or dealing with setup.py
first. This is because pytest makes the dir this file is in the root.
What this file is actually for is per-directory fixture scopes:
... | {
"content_hash": "ff7b3dfa553717c6782a45317c3ca53f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 91,
"avg_line_length": 36.357142857142854,
"alnum_prop": 0.7897838899803536,
"repo_name": "pypyr/pypyr-cli",
"id": "ab0876a896b6662f8244aa219c2ff6a7da004195",
"size": "509"... |
"""Script to parse Windows Defender scan DetectionHistory files."""
import argparse
import logging
import sys
from dtformats import detection_history
from dtformats import output_writers
def Main():
"""The main program function.
Returns:
bool: True if successful or False if not.
"""
argument_parser = a... | {
"content_hash": "b5d607fdd463f62a9cf7fc0924e3ec59",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 25.043478260869566,
"alnum_prop": 0.6892361111111112,
"repo_name": "libyal/dtformats",
"id": "6508f69e9ee26af5bff15c866ef3fdfcfadd8a00",
"size": "177... |
"""
miscellaneous math.
"""
from numbers import Integral, Number
def is_number(x):
"""
Tests if `x` is a number.
Parameters
----------
x : object
The object to test the numericalness of.
Returns
-------
b : bool
True if `x` is a number, False otherwise.
"""
re... | {
"content_hash": "8bd508c96a185a2e5365734204652ea7",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 68,
"avg_line_length": 18.75257731958763,
"alnum_prop": 0.5123694337548104,
"repo_name": "chebee7i/dit",
"id": "27e5706528beb2a47c5370b1de9644d4fec5dbe3",
"size": "1819",
... |
"""Tests for pointnet."""
from absl.testing import parameterized
from lingvo import compat as tf
from lingvo.core import py_utils
from lingvo.core import test_utils
from lingvo.tasks.car import pointnet
class PointNetTest(test_utils.TestCase, parameterized.TestCase):
def _testOutShape(self, p, input_shape, expect... | {
"content_hash": "b7537bb50097de8fca780dcf85eb37cd",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 77,
"avg_line_length": 39.85,
"alnum_prop": 0.6612296110414053,
"repo_name": "tensorflow/lingvo",
"id": "09962d90ad2998d33397817cfa0bb5e8bb4bf718",
"size": "3080",
"binar... |
from __future__ import annotations
import re
import textwrap
import yaml
from pre_commit.util import yaml_load
def _is_header_line(line: str) -> bool:
return line.startswith(('#', '---')) or not line.strip()
def _migrate_map(contents: str) -> str:
if isinstance(yaml_load(contents), list):
# Find ... | {
"content_hash": "2ff1ff960c1f6a8bb8498f172ade48b3",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 27.57894736842105,
"alnum_prop": 0.6036895674300254,
"repo_name": "pre-commit/pre-commit",
"id": "c3d0a509f6be4e3db6c2ec132901fb56b21e08bc",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.