content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
from recyclus import Client
import time
def load(job):
print('saving cyclus.sqlite...')
client.save('cyclus.sqlite', job.jobid)
def wait_for_completion(job):
while True:
time.sleep(2)
resp = job.status()
if resp['status'] != 'ok':
print(f'Error:', resp['message'])
... | 19.348837 | 72 | 0.543269 | [
"BSD-3-Clause"
] | yarden-livnat/ReCyclus | tests/run.py | 832 | Python |
from flask import Flask
from app.settings import conf
from app.ext import init_ext
from app.views import init_blue
def create_app(env_name):
#做一个校验
if not env_name in conf.keys():
raise Exception('您的环境名有问题')
app = Flask(__name__)
#各种配置
app.config.from_object(conf.get(env_na... | 22.5 | 47 | 0.654321 | [
"Apache-2.0"
] | General-ITer/Flask-Introduction | day02split/app/__init__.py | 461 | Python |
"""
Area Weighted Interpolation
"""
import numpy as np
import geopandas as gpd
from ._vectorized_raster_interpolation import _fast_append_profile_in_gdf
import warnings
from scipy.sparse import dok_matrix, diags, coo_matrix
import pandas as pd
import os
from tobler.util.util import _check_crs, _nan_check, _inf_check... | 33.81106 | 225 | 0.658307 | [
"BSD-3-Clause"
] | AnGWar26/tobler | tobler/area_weighted/area_interpolate.py | 22,011 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 50.357911 | 218 | 0.668792 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/operations/_replication_jobs_operations.py | 32,783 | Python |
"""Tuya Air Quality sensor."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFI... | 41.233577 | 737 | 0.601522 | [
"Apache-2.0"
] | InovelliUSA/zha-device-handlers | zhaquirks/tuya/air/ts0601_air_quality.py | 5,649 | Python |
# -*- coding: utf-8 -*-
from .ExactDate import ExactDate
from .JieQi import JieQi
from .NineStar import NineStar
from .EightChar import EightChar
from .ShuJiu import ShuJiu
from .Fu import Fu
from .Solar import Solar
from .SolarWeek import SolarWeek
from .SolarMonth import SolarMonth
from .SolarSeason import SolarSeaso... | 29 | 40 | 0.820327 | [
"MIT"
] | 6tail/lunar-python | lunar_python/__init__.py | 551 | Python |
"""
Training and validation method for arbitrary models.
"""
import io
import os
import sys
import time
from keras import Sequential
from keras.layers import Dense, Dropout, BatchNormalization
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
impo... | 42.524444 | 139 | 0.650397 | [
"MIT"
] | hurwitzlab/viral-learning | vl/model/training.py | 9,568 | Python |
import unittest
import os
import grp
from myDevices.sensors import sensors
from myDevices.devices import manager
from myDevices.utils.config import Config
from myDevices.utils import types
from myDevices.utils.logger import exception, setDebug, info, debug, error, logToFile, setInfo
from myDevices.devices.bus import ch... | 50.251497 | 197 | 0.654671 | [
"MIT"
] | 42electronics/Cayenne-Agent | myDevices/test/sensors_test.py | 8,392 | Python |
"""fix_parser.py - parse V1.0 fixprotocol sbe xml files described
by xsd https://github.com/FIXTradingCommunity/
fix-simple-binary-encoding/blob/master/v1-0-STANDARD/resources/sbe.xsd
"""
import xml.etree.ElementTree as etree
from pysbe.schema.constants import (
SBE_TYPES_TYPE,
STRING_ENUM_MAP,
VAL... | 32.321429 | 87 | 0.61326 | [
"Apache-2.0"
] | bkc/pysbe | pysbe/parser/fix_parser.py | 16,290 | Python |
"""
Created on Jan 24, 2014
@author: StarlitGhost
"""
from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand
from zope.interface import implementer
from urllib.parse import quote
from desertbot.message import IRCMessage
from desertbo... | 36 | 97 | 0.532307 | [
"MIT"
] | MasterGunner/DesertBot | desertbot/modules/commands/Urban.py | 3,312 | Python |
import numpy as np
import openmdao.api as om
class IntegratedSurfaceForces(om.ExplicitComponent):
def setup(self):
self.add_input('aoa',desc = 'angle of attack', units='rad',tags=['mphys_input'])
self.add_input('yaw',desc = 'yaw angle',units='rad',tags=['mphys_input'])
self.add_input('ref_a... | 53.004435 | 110 | 0.474001 | [
"Apache-2.0"
] | OpenMDAO/mphys | mphys/integrated_forces.py | 23,905 | Python |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY')
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED... | 39.316832 | 96 | 0.605515 | [
"Apache-2.0"
] | clairempr/bureau | config/settings/production.py | 7,942 | Python |
# Copyright 2018 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 46.590814 | 78 | 0.616301 | [
"Apache-2.0"
] | openstack/charm-octavia | unit_tests/test_lib_charm_openstack_api_crud.py | 22,317 | Python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'searchform.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_searchForm(object):
def setupUi(self, searchForm):
... | 53 | 94 | 0.715617 | [
"MIT"
] | FNgrey/musicplayer | searchform.py | 4,433 | Python |
# Copyright (c) Contributors to the aswf-docker Project. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""
CI Image and Package Builder
"""
import logging
import subprocess
import json
import os
import tempfile
import typing
from aswfdocker import constants, aswfinfo, utils, groupinfo, index
logger = log... | 35.637982 | 107 | 0.511324 | [
"Apache-2.0"
] | aloysbaillet/aswf-docker | python/aswfdocker/builder.py | 12,010 | Python |
# Mu Young
# Balrog Entry
from net.swordie.ms.constants import BossConstants
from net.swordie.ms.constants import GameConstants
options = {
0 : BossConstants.BALROG_EASY_BATTLE_MAP,
1 : BossConstants.BALROG_HARD_BATTLE_MAP
}
if not sm.isPartyLeader():
sm.sendSayOkay("Please have your party leader speak to me..")
e... | 45.157895 | 145 | 0.782051 | [
"MIT"
] | Descended/Spirit-V179 | scripts/npc/balog_accept.py | 858 | Python |
#
#
# Needs to be expanded to accommodate the common occurrence of sparse.multiSparse objects in the geounitNode class vs pure numpy arrays
#
#
import os
import sys
# If there is __init__.py in the directory where this file is, then Python adds das_decennial directory to sys.path
# automatically. Not sure why and how ... | 63.478261 | 562 | 0.642466 | [
"CC0-1.0"
] | dkifer/census2020-das-e2e | programs/engine/unit_tests/json_nodes_test.py | 2,920 | Python |
"""
Copyright June 25, 2020 Richard Koshak
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | 39.90393 | 198 | 0.63132 | [
"Apache-2.0"
] | cherub-i/openhab-rules-tools | time_utils/automation/lib/python/community/time_utils.py | 9,138 | Python |
"""
Copyright (C) 2020 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
import shutil
import os
here = os.path.abspath(os.path.dirname(__file__))
def... | 26.771429 | 83 | 0.693703 | [
"MPL-2.0"
] | khinsen/gridtest | gridtest/templates/__init__.py | 937 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Display a calendar populated from google calendar data on an inky display."""
from PIL import Image, ImageDraw # type: ignore
# from typing import Tuple
# import time
def draw_what_sheet(image: Image.Image) -> None:
"""Draw a calendar page for a WHAT display.
... | 24.941176 | 80 | 0.591195 | [
"MIT"
] | nukes327/inky_monitor | inky_calendar.py | 1,272 | Python |
""" Utility functions. """
import tensorflow as tf
def get_shape(tensor, dynamic=False):
""" Return shape of the input tensor without batch size.
Parameters
----------
tensor : tf.Tensor
dynamic : bool
If True, returns tensor which represents shape. If False, returns list of ints and/or... | 24.196078 | 100 | 0.627229 | [
"Apache-2.0"
] | bestetc/batchflow | batchflow/models/tf/utils.py | 2,468 | Python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# htt... | 35.352381 | 78 | 0.626347 | [
"Apache-2.0"
] | bopopescu/openstack-12 | nova/tests/vmwareapi/db_fakes.py | 3,712 | Python |
from bs4 import BeautifulSoup
import article
import requester
root_url = "http://www.nec-nijmegen.nl/"
source_url = "https://www.nec-nijmegen.nl/nieuws.htm"
def make_request():
html = requester.get_html(source_url)
return html
def get_articles():
print("Getting articles from: " + source_url)
html ... | 22.0625 | 53 | 0.631728 | [
"MIT"
] | midasvo/nec-bot | nec_sources/necnijmegen.py | 706 | Python |
#!/usr/bin/env python3
import socket
from util import ip4_range
import unittest
from framework import tag_fixme_vpp_workers
from framework import VppTestCase, VppTestRunner
from template_bd import BridgeDomain
from scapy.layers.l2 import Ether
from scapy.packet import Raw
from scapy.layers.inet import IP, UDP
from sc... | 36.702899 | 79 | 0.590326 | [
"Apache-2.0"
] | B4dM4n/vpp | test/test_gtpu.py | 15,195 | Python |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import json
import os
from tornado import web
from .. import _load_handler_from_location
from ...utils import clean_filename
from ...utils import quote
from ...utils import response_text
from ...utils import url_path_... | 34.651099 | 98 | 0.562753 | [
"BSD-3-Clause-Clear"
] | cybergis/nbviewer | nbviewer/providers/gist/handlers.py | 12,613 | Python |
#!/usr/bin/env python
import h5py
f = h5py.File('H11302_OLS_OSS/H11302_2m_1.bag')
print f.listobjects()
print f.listitems()
bag_root = f['/BAG_root']
metadata = ''.join(bag_root['metadata'])
o = file('metadata.xml','w')
o.write(metadata)
del o
#print metadata #[0:200]
elevation = bag_root['elevation']
print 'sh... | 19.804878 | 53 | 0.635468 | [
"Apache-2.0"
] | schwehr/bag-py | bag.py | 812 | Python |
#!/usr/bin/env python3
#
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
#
from typing import Sequence
from pefile import PE
from qiling.const import QL_ARCH
from qiling.exception import QlErrorArch, QlMemoryMappedError
from qiling.loader.loader import QlLoader
from qiling.os.memory import... | 35.912226 | 115 | 0.650052 | [
"CC0-1.0"
] | mrTavas/owasp-fstm-auto | qiling/qiling/loader/pe_uefi.py | 11,456 | Python |
from __future__ import annotations
from datetime import timedelta
import itertools
import numpy as np
import pytest
from pandas.compat import (
IS64,
is_platform_windows,
)
import pandas as pd
import pandas._testing as tm
###############################################################
# Index / Series comm... | 34.193878 | 88 | 0.565503 | [
"BSD-3-Clause"
] | 701KHK1915/8-PANDAS | pandas/tests/indexing/test_coercion.py | 40,212 | Python |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Task
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
import typing
from pydantic import Field, root_validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.erro... | 36.181689 | 93 | 0.615138 | [
"BSD-3-Clause"
] | chgl/fhir.resources | fhir/resources/task.py | 76,669 | Python |
# -*- coding: utf-8 -*-
"""
Parser elements.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import copy
import logging
import re
from lxml.builder import E
import six
import types
log = loggi... | 33.512821 | 230 | 0.599379 | [
"MIT"
] | ShuHuang/batterydatabase | chemdataextractor_batteries/chemdataextractor/parse/elements.py | 23,526 | Python |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Callable, List, NamedTuple, Tuple
import numpy as np
import plotly.graph_objs as go
import torch
from torch import Tenso... | 32.245098 | 87 | 0.620249 | [
"MIT"
] | facebookresearch/beanmachine | src/beanmachine/ppl/diagnostics/common_plots.py | 3,289 | Python |
import typing
from ParadoxTrading.Fetch.Crypto.FetchBase import FetchBase
class FetchDepth(FetchBase):
def __init__(
self, _psql_host='localhost', _psql_dbname='data',
_psql_user='', _psql_password='', _cache_path='cache'
):
super().__init__(
_psql_host=_psql_host... | 32.407407 | 65 | 0.613714 | [
"MIT"
] | gsamarakoon/ParadoxTrading | ParadoxTrading/Fetch/Crypto/FetchDepth.py | 875 | Python |
# Copyright (C) 2014-2018 DLR
#
# All rights reserved. This program and the accompanying materials are made
# available under the terms of the Eclipse Public License v1.0 which
# accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Annika Wollschlaeger <anni... | 48.077889 | 130 | 0.646668 | [
"EPL-1.0"
] | LJMP/RAFCON | source/rafcon/core/states/barrier_concurrency_state.py | 19,135 | Python |
from __future__ import absolute_import, print_function, unicode_literals
import pickle
from builtins import dict, str
import os
import re
import boto3
import logging
import botocore.session
from time import sleep
import matplotlib as mpl
from numpy import median, arange, array
from indra.tools.reading.util.reporter ... | 40.885496 | 83 | 0.582192 | [
"BSD-2-Clause"
] | budakn/INDRA | indra/tools/reading/submit_reading_pipeline.py | 48,204 | Python |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError, UserError
from odoo.addons import decimal_precision as dp
from odoo.tools import float_is_zero
class EventType(models.Model):
_i... | 46.270992 | 165 | 0.655118 | [
"MIT"
] | jjiege/odoo | addons/event_sale/models/event.py | 12,123 | Python |
import scrapy
from itemloaders.processors import Identity, MapCompose, TakeFirst
from price_parser.parser import parse_price
from scrapy.loader import ItemLoader
from burplist.utils.parsers import parse_abv, parse_name, parse_volume, quantize_price
class ProductItem(scrapy.Item):
platform = scrapy.Field()
n... | 30.151515 | 86 | 0.765829 | [
"MIT"
] | admariner/burplist | burplist/items.py | 995 | Python |
#Written by Shitao Tang
# --------------------------------------------------------
import connectDB
import time,hashlib,logging
def sign_up(username,password):
db=connectDB.database.getInstance()
if len(username)<=20:
return db.create_account(username,hashlib.sha224(password).hexdigest())
else:
... | 30.989691 | 122 | 0.570692 | [
"MIT"
] | yehan-xiao/SUCS | main_server/common.py | 6,012 | Python |
import random
import string
from pathlib import Path
r"""
In the root folder
$ pytest tests --template fastapi_plan\template
Where `template` is path to folder with `cookiecutter.json` file
See https://github.com/hackebrot/pytest-cookies
Or example tests here
https://github.com/audreyfeldroy/cookiecutter-pypackage... | 30.266667 | 94 | 0.712922 | [
"MIT"
] | rafsaf/fastapi-plan | tests/test_fastapi_plan.py | 2,724 | Python |
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-p',
dest='path',
help='Spectify the path')
parser.add_argument(
'-l', action='store_true',
dest='long_format',
help='use a long listing format')
parser.add_argument(
'-a', action... | 24.733333 | 53 | 0.614555 | [
"MIT"
] | Windsooon/pash | pash/arg_parse.py | 742 | Python |
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from selectelhackaton.utils import SimpleAuthMixinView
@method_decorator(login_required, name='get')
class MemberIndex(SimpleAuthMixinView):
template_name = 'member/member-index.html... | 27 | 67 | 0.783951 | [
"MIT"
] | mar4elkin/SelectelHackaton | selectelhackaton/views.py | 324 | Python |
class Solution:
def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]:
total_node_count = n
if total_node_count == 1:
# Quick response for one node tree
return [0]
# build adjacency matrix
adj_matrix = defaultdict... | 33.190476 | 88 | 0.522956 | [
"MIT"
] | shoaibur/SWE | Leetcoding-Actions/Explore-Monthly-Challenges/2020-11/04-Minimum-Height-Tree.py | 1,394 | Python |
#http://blog.gravatar.com/2008/01/17/gravatars-in-python-25/
import urllib, hashlib
# Set your variables here
email = "Someone@somewhere.com"
default = "http://www.somewhere.com/homsar.jpg"
size = 40
def get_gravatar(email):
gravatar_url = "http://www.gravatar.com/avatar.php?"
#gravatar_url += urllib.urlencode({'g... | 33.076923 | 127 | 0.74186 | [
"MIT"
] | k1000/django-stratus | stratus/gravatar.py | 430 | Python |
#!/usr/bin/env python
# $Id: update_pot.py 40713 2011-09-30 09:25:53Z nazgul $
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the ... | 32.759259 | 79 | 0.570944 | [
"Unlicense"
] | damiles/blendocv | po/update_pot.py | 3,538 | Python |
# coding: utf-8
"""
Factern API
"""
import pprint
import re # noqa: F401
import six
import importlib
parent_name = "BaseResponse"
def get_parent():
# Lazy importing of parent means that loading the classes happens
# in the correct order.
if get_parent.cache is None:
parent_fname = "fact... | 26.883436 | 122 | 0.581698 | [
"MIT"
] | Factern/factern-client-python | factern_client/com/factern/model/create_entity_response.py | 4,382 | Python |
import warnings
from cloudcafe.auth.provider import MemoizedAuthServiceComposite
from cloudcafe.blockstorage.config import BlockStorageConfig
from cloudcafe.blockstorage.volumes_api.common.config import VolumesAPIConfig
from cloudcafe.blockstorage.volumes_api.v1.config import \
VolumesAPIConfig as v1Config
from c... | 37.543478 | 77 | 0.72264 | [
"Apache-2.0"
] | kivattik/lk-cloudcafe-dev | cloudcafe/blockstorage/composites.py | 3,454 | Python |
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWebChannel import QWebChannel
from PyQt5 import Qt
import json
import sys
import time
import random
import threading
import os
ConfigData = {}
... | 31.302198 | 86 | 0.599614 | [
"MIT"
] | vt-dev-team/vt-randomName | main.py | 5,853 | Python |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name,anomalous-backslash-in-string,missing-docstring
"""mpl circuit visualization backend."""
imp... | 38.593377 | 95 | 0.445055 | [
"Apache-2.0"
] | rabaniten/qiskit-terra | qiskit/tools/visualization/_matplotlib.py | 29,138 | Python |
# Copyright 2016-2018 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 33.714286 | 82 | 0.783051 | [
"Apache-2.0"
] | Autodesk/py-cloud-compute-cannon | pyccc/__init__.py | 1,180 | Python |
from math import sqrt
# Example script demonstrating conversion of if statements
x = True
if x:
print("X was true")
a = 3
b = 4.5
if b > a:
print("B was greater than a")
elif a > b:
print("A was greater than a")
else:
print("They are equal")
# Nested ifs are supported
if True:
if b < a:
... | 17.675676 | 58 | 0.62844 | [
"MIT"
] | AndrewKahr/pyplus | examples/example_if.py | 654 | Python |
"""
Copyright 2019 Inmanta
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | 38.730909 | 128 | 0.629049 | [
"Apache-2.0"
] | inmanta/inmanta-core | src/inmanta/server/services/paramservice.py | 10,651 | Python |
# some utils taken from the DeepXplore Implementation
import random
from collections import defaultdict
import numpy as np
from keras import backend as K
from keras.models import Model
from keras.preprocessing import image
from keras import models, layers, activations
from scipy.spatial.distance import mahalanobis
f... | 42.521401 | 177 | 0.726116 | [
"MIT"
] | j-chan-hkust/deep_testing_of_advanced_learning_systems | 4_Coverage_Evaluation/CIFAR10/utils.py | 10,928 | Python |
"""Create portable serialized representations of Python objects.
See module cPickle for a (much) faster implementation.
See module copy_reg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.
Classes:
Pickler
Unpickler
Functions:
dump(object, file)
... | 32.437326 | 80 | 0.557793 | [
"MIT"
] | woodrow/pyoac | lib-python/modified-2.5.2/pickle.py | 46,580 | Python |
#######################################
# TESTING PURPOSE ONLY MODELS!! #
# DO NOT ADD THE APP TO INSTALLED_APPS#
#######################################
import datetime as base_datetime
from decimal import Decimal
from tempfile import gettempdir
from django.conf import settings
from django.contrib.contenttypes.... | 29.401914 | 88 | 0.71904 | [
"Apache-2.0"
] | atimilson/model_bakery | tests/generic/models.py | 12,291 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 35.472222 | 83 | 0.780736 | [
"Apache-2.0"
] | DataDog/aliyun-openapi-python-sdk | aliyun-python-sdk-slb/aliyunsdkslb/request/v20140515/SetServerCertificateNameRequest.py | 2,554 | Python |
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 36.045 | 92 | 0.625121 | [
"Apache-2.0"
] | 3ayazaya/synapse | synapse/push/pusherpool.py | 14,418 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 49.197719 | 229 | 0.672695 | [
"Unlicense",
"MIT"
] | amcclead7336/Enterprise_Data_Science_Final | venv/lib/python3.8/site-packages/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py | 12,939 | Python |
from functools import partial
from keras_metrics import metrics as m
from keras_metrics import casts
__version__ = "1.2.1"
def metric_fn(cls, cast_strategy):
def fn(label=0, **kwargs):
metric = cls(label=label, cast_strategy=cast_strategy, **kwargs)
metric.__name__ = "%s_%s" % (cast_strategy.__n... | 35.522388 | 79 | 0.843697 | [
"BSD-3-Clause"
] | maikherbig/AIDeveloper | AIDeveloper/keras_metrics/__init__.py | 2,380 | Python |
# This file contains a backport of np.random.choice from numpy 1.7
# The function can be removed when we bump the requirements to >=1.7
import numpy as np
import operator
from sklearn.utils import check_random_state
from ._random import sample_without_replacement
__all__ = ['sample_without_replacement', 'choice']
... | 33.353535 | 77 | 0.590703 | [
"Apache-2.0"
] | bopopescu/fbserver | venv/lib/python2.7/site-packages/sklearn/utils/random.py | 6,604 | Python |
#!/usr/bin/env python3
# This is run by the "run-tests" script.
import unittest
from test import TestHelper, Conn, parse
class TestNoListing(TestHelper):
def test_no_listing(self):
resp = self.get("/")
status, hdrs, body = parse(resp)
self.assertContains(status, "404 Not Found")
if __name_... | 23.875 | 52 | 0.664921 | [
"ISC"
] | adams549659584/darkhttpd | devel/test_no_listing.py | 382 | Python |
'''Test code.
'''
# pylint: disable=import-error
import unittest
from Chapter3_CodeTesting.UnitTesting.vector import Vector2D
class VectorTests(unittest.TestCase):
def setUp(self):
self.v1 = Vector2D(0, 0)
self.v2 = Vector2D(-1, 1)
self.v3 = Vector2D(2.5, -2.5)
def test_equality(self... | 27.160714 | 60 | 0.60618 | [
"MIT"
] | franneck94/UdemyPythonProEng | Chapter3_CodeTesting/UnitTesting/test_vector.py | 1,521 | Python |
# -*- coding: utf-8 -*-
from . import test_related
from . import test_new_fields
from . import test_onchange
from . import test_field_conversions
from . import test_attributes
| 22.125 | 36 | 0.774011 | [
"MIT"
] | tuanquanghpvn/odoo8-tutorial | odoo/openerp/addons/test_new_api/tests/__init__.py | 177 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 26 20:21:07 2019
Tecnológico Nacional de México (TECNM)
Tecnológico de Estudios Superiores de Ixtapaluca (TESI)
División de ingeniería electrónica
Introducción a la librería Numpy 2
M. en C. Rogelio Manuel Higuera Gonzalez
"""
import numpy as np
###########################... | 47.862745 | 122 | 0.610815 | [
"Unlicense"
] | RogelioHiguera/Python-2.0 | IibreriaNumpy2.py | 2,452 | Python |
#!venv/bin/python
""" This module imports Flask-Manager script, adds our create_db command
and run it. You can pass following arguments:
* create_db => creates sqlite database and all the tables
* shell => runs python shell inside application context
* runserver => runs Flask development server
* db => ... | 34.119048 | 72 | 0.692952 | [
"MIT"
] | Adynatos/egida | manager.py | 1,433 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | 36.542751 | 625 | 0.649339 | [
"Apache-2.0"
] | Jamim/kubernetes-client-python | kubernetes/client/models/v1_api_group.py | 9,830 | Python |
import logging
import numpy as np
from typing import Any, Dict, Optional
from mlagents.tf_utils import tf
from mlagents.envs.timers import timed
from mlagents.envs.brain import BrainInfo, BrainParameters
from mlagents.trainers.models import EncoderType, LearningRateSchedule
from mlagents.trainers.ppo.models import PP... | 40.362963 | 120 | 0.614883 | [
"Apache-2.0"
] | DdATM/ML-FlappyBird | ml-agents/mlagents/trainers/ppo/policy.py | 10,898 | Python |
from __future__ import absolute_import, division, print_function
from six.moves import range
from scitbx.lbfgs import core_parameters, termination_parameters
from scitbx.lbfgs import exception_handling_parameters, ext
from scitbx.array_family import flex
import scitbx
"""mpi_split_evaluator_run(), supports an LBFGS pa... | 38.805147 | 95 | 0.655708 | [
"BSD-3-Clause"
] | jorgediazjr/dials-dev20191018 | modules/cctbx_project/scitbx/lbfgs/tst_mpi_split_evaluator.py | 10,555 | Python |
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from common.layers import *
from common.gradient import numerical_gradient
from collections import OrderedDict
class TwoLayerNet:
def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01... | 29.78481 | 87 | 0.58946 | [
"MIT"
] | tmsick/deep-learning-from-scratch | ch05/two_layer_net.py | 2,471 | Python |
from __future__ import unicode_literals
import atexit
import os
import unittest
from django import VERSION
from selenium import webdriver
from django.urls import reverse
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import ui
from selenium.webdriver.support.ui import Select
try:
... | 34.580645 | 108 | 0.68268 | [
"MIT"
] | kimetrica/django-autocomplete-light | autocomplete_light/tests/test_widget.py | 12,864 | Python |
from test import support
from test.support import bigmemtest, _4G
import array
import unittest
from io import BytesIO, DEFAULT_BUFFER_SIZE
import os
import pickle
import glob
import tempfile
import pathlib
import random
import shutil
import subprocess
import threading
from test.support import import_helper
from test.s... | 37.521569 | 1,181 | 0.599603 | [
"BSD-3-Clause"
] | Froggo8311/brython | www/src/Lib/test/test_bz2.py | 38,272 | Python |
# coding=utf-8
# Copyright 2018 HuggingFace Inc..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 34.60396 | 96 | 0.629185 | [
"MIT"
] | borgr/ordert | transformers/examples/test_examples.py | 3,495 | Python |
#!/usr/bin/env python
# Problem: Many forked repos on GitHub fall behind from their origins.
# Solution:
# 1) Verify that `apt install myrepos` is available on the system.
# 2) Query GitHub API to find all of my repositories
# 3) Clone each *fork* into *~/repos/mynameofit*, such that place I forked it
# from is git... | 40.285714 | 77 | 0.719858 | [
"MIT"
] | edunham/toys | utilities/updatify.py | 564 | Python |
#!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, 2019, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# ... | 36.904255 | 74 | 0.758144 | [
"BSD-3-Clause"
] | RyoTTa/geopm | scripts/geopmpy/error.py | 3,469 | Python |
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
# Imports from this application
from app import app
# 2 column layout. 1st column width = 4/12
# https://... | 20.705882 | 78 | 0.620739 | [
"MIT"
] | Build-Week-Med-Cabinet-October-2020/med-cabinet | pages/predictions.py | 704 | Python |
# https://github.com/RainerKuemmerle/g2o/blob/master/g2o/examples/ba_anchored_inverse_depth/ba_anchored_inverse_depth_demo.cpp
import numpy as np
import g2o
from collections import defaultdict
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--noise', dest='pixel_noise', type=float, default=1... | 31.702899 | 126 | 0.611886 | [
"MIT"
] | alecone/ROS_project | g2opy/python/examples/ba_anchored_inverse_depth_demo.py | 4,375 | Python |
"""
Conditional Generative adversarial networks:
https://arxiv.org/abs/1611.07004
U-net:
https://arxiv.org/abs/1505.04597
Conditional generative adversarial network architecture modules
used for simulation of detector response and unfolding in JetGAN framework.
Generator() returns the generator model, and Discriminato... | 27.923077 | 75 | 0.807163 | [
"MIT"
] | nickelsey/jetgan | jetgan/model/cgan.py | 363 | Python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2019- d3p Developers and their Assignees
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses... | 43.657258 | 86 | 0.714325 | [
"Apache-2.0"
] | DPBayes/d3p | d3p/modelling.py | 10,828 | Python |
# encoding: utf-8
from libs.configs import cfgs
from libs.box_utils import bbox_transform
from libs.box_utils import nms_rotate
import tensorflow as tf
from libs.box_utils.coordinate_convert import coordinate_present_convert
def filter_detections(boxes, scores, is_training, gpu_id):
"""
:param boxes: [-1, 4]... | 45.405941 | 115 | 0.595072 | [
"Apache-2.0"
] | DLPerf/R3Det_Tensorflow | libs/detection_oprations/refine_proposal_opr_csl.py | 4,586 | Python |
# coding:utf-8
import time
import datetime
import os
import tensorflow as tf
import pickle
import utils
from keras.preprocessing.sequence import pad_sequences
import numpy as np
import evaluate
from utils import Utils
class SMN():
def __init__(self,
device_name='/cpu:0',
lr=0.00... | 53.362416 | 216 | 0.621997 | [
"Apache-2.0"
] | zlxy9892/chatbot-retrieval-based-smn | retrieval_model.py | 15,902 | Python |
#!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Disable the lint error for too-long lines for the URL below.
# pylint: disable=C0301
"""Fix Chrome App manifest.json files for u... | 28.328125 | 85 | 0.665196 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Alan-love/chromium | native_client_sdk/src/tools/fix_manifest.py | 3,626 | Python |
import numpy as np
import cv2
import math
def norm_image(img):
""" normalize image input """
img = img.astype(np.float32)
var = np.var(img, axis=(0, 1), keepdims=True)
mean = np.mean(img, axis=(0, 1), keepdims=True)
return (img - mean) / (np.sqrt(var) + 1e-7)
def mask_depth_image(depth_image, mi... | 35.174419 | 92 | 0.631736 | [
"MIT"
] | HelenYang1999/PointMVSNet | pointmvsnet/utils/preprocess.py | 3,025 | Python |
import asyncio, logging
from aiohttp import web
logging.basicConfig(level=logging.INFO)
def index(request):
return web.Response(body=b'<h1>Hello World</h1>', content_type='text/html')
async def init(loop):
app = web.Application(loop=loop)
app.router.add_route('GET', '/', index)
srv = await loop.cr... | 22.32 | 79 | 0.718638 | [
"MIT"
] | ResolveWang/minifw | app.py | 558 | Python |
import sys
import numpy as np
import torch
import torch.hub
from PIL import Image
from torchvision.transforms import Compose
from _model_base import ModelBase, handle_alpha
from _util import apply_colormap, to_rgb
# Simplified transforms from
# https://github.com/intel-isl/MiDaS/blob/master/models/transforms.py
cla... | 29.145299 | 99 | 0.633724 | [
"MIT"
] | valgur/GIMP-ML | models/MiDaS.py | 3,410 | Python |
import tensorflow as tf
import argparse
import os, re
import numpy as np
from tensorflow.contrib.layers import variance_scaling_initializer
from tensorpack import *
from tensorpack.utils import logger
from tensorpack.utils.stat import RatioCounter
from tensorpack.tfutils.symbolic_functions import *
from tensorpack.tfu... | 39.895288 | 110 | 0.591339 | [
"MIT"
] | ivankreso/semseg | OLD/models/resnet/old/resnet_orig.py | 7,620 | Python |
from healthcheck import HealthCheck, EnvironmentDump
from src.frameworks_and_drivers.healthchecks.postgres import postgres_healthcheck
from src.frameworks_and_drivers.healthchecks.redis import redis_healthcheck
from src.frameworks_and_drivers.healthchecks.info import application_data
def init_app(app):
health = H... | 41.769231 | 81 | 0.830571 | [
"MIT"
] | diododias/flask-boilerplate | src/frameworks_and_drivers/healthchecks/healthchecks.py | 543 | Python |
# test syntax and type errors specific to viper code generation
def test(code):
try:
exec(code)
except (SyntaxError, ViperTypeError, NotImplementedError) as e:
print(repr(e))
# viper: annotations must be identifiers
test("@micropython.viper\ndef f(a:1): pass")
test("@micropython.viper\ndef f... | 22.206897 | 67 | 0.653727 | [
"MIT"
] | 0xa71a5/micropython | tests/micropython/viper_error.py | 1,932 | Python |
import sys
from common import unittest2, platform_skip
import pyuv
TEST_PORT = 1234
if sys.platform == 'win32':
TEST_PIPE = '\\\\.\\pipe\\test-pipe'
else:
TEST_PIPE = 'test-pipe'
@platform_skip(["win32"])
class IPCTest(unittest2.TestCase):
def setUp(self):
self.loop = pyuv.Loop.default_loop()... | 37.165289 | 136 | 0.648655 | [
"MIT"
] | benoitc/pyuv | tests/test_ipc.py | 4,497 | Python |
import os
import urllib.parse
from datetime import timedelta
import flask
import requests
from cachetools import TTLCache
from flask import current_app, session, request, redirect, abort, jsonify
from flask_oauthlib.client import OAuth
from werkzeug import security
from urllib.parse import urlparse
from common.rpc.au... | 31.031818 | 93 | 0.642889 | [
"MIT"
] | Cal-CS-61A-Staff/cs61a-apps | common/oauth_client.py | 6,827 | Python |
"""
Module for testing goftest module.
"""
__author__ = "wittawat"
import unittest
import matplotlib.pyplot as plt
import numpy as np
import numpy.testing as testing
import scipy.stats as stats
import sbibm.third_party.kgof.data as data
import sbibm.third_party.kgof.density as density
import sbibm.third_party.kgof.... | 32.458763 | 88 | 0.545974 | [
"MIT"
] | mackelab/sbibm | sbibm/third_party/kgof/test/test_goftest.py | 6,297 | Python |
# coding=utf-8
# unpack.py
# Author: Meghan Clark
import binascii
import struct
from .message import HEADER_SIZE_BYTES, Message
from .msgtypes import *
# Creates a LIFX Message out of packed binary data
# If the message type is not one of the officially released ones above, it will create just a Message out of it
#... | 56.146132 | 156 | 0.651187 | [
"MIT"
] | DrTexx/lifxlan | lifxlan/unpack.py | 19,595 | Python |
import json
import logging.config
import os
default_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "%(asctime)s :: %(name)s :: %(levelname)s :: %(message)s"
}
},
"handlers": {
"console": {
"class": "... | 26.929577 | 98 | 0.54341 | [
"Apache-2.0"
] | thipokKub/geeup | geeup/config.py | 1,912 | Python |
from direct.directnotify import DirectNotifyGlobal
import RingTrack
class RingAction:
notify = DirectNotifyGlobal.directNotify.newCategory('RingAction')
def __init__(self):
pass
def eval(self, t):
return (0, 0)
class RingActionStaticPos(RingAction):
def __init__(self, pos):
... | 19.976744 | 70 | 0.656577 | [
"BSD-3-Clause"
] | AnonymousDeveloper65535/open-toontown | toontown/minigame/RingAction.py | 859 | Python |
###Titulo: Multiplicação através de repetidas somas
###Função: Este programa realiza a multiplicação de dois números através de sucessivas adições
###Autor: Valmor Mantelli Jr.
###Data: 14/12/2018
###Versão: 0.0.5
# Declaração de variáve
x = 0
y = 0
w = 0
z = 1
# Atribuição de valor a variavel
x = int(input("Dig... | 15.212121 | 94 | 0.651394 | [
"MIT"
] | profnssorg/valmorMantelli1 | exer508.py | 522 | Python |
#!/usr/bin/python
# Copyright: (c) 2018, Johannes Brunswicker <johannes.brunswicker@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: utm_proxy_... | 31.20098 | 118 | 0.614925 | [
"Apache-2.0"
] | jkroepke/homelab | kubernetes-the-hard-way/system/collections/ansible_collections/community/general/plugins/modules/web_infrastructure/sophos_utm/utm_proxy_location.py | 6,365 | Python |
import rlkit.misc.hyperparameter as hyp
from multiworld.envs.mujoco.cameras import init_sawyer_camera_v1
from multiworld.envs.mujoco.cameras import sawyer_pick_and_place_camera
from rlkit.launchers.launcher_util import run_experiment
from rlkit.torch.grill.launcher import grill_her_td3_full_experiment
import rlkit.torc... | 35.5 | 80 | 0.568289 | [
"MIT"
] | Asap7772/railrl_evalsawyer | experiments/steven/online-vae/pick_and_place/state_exp.py | 4,686 | Python |
from commons.neural_network import TwoLayerNet
from datasets.mnist import load_mnist
import numpy as np
(x_train, t_train), (x_test, t_test) = load_mnist(
normalize=True, one_hot_label=True)
network = TwoLayerNet(input_size=784, hidden_size=50, output_size=10)
iters_num = 10000
train_size = x_train.shape[0]
batc... | 28.121951 | 69 | 0.712923 | [
"MIT"
] | Myeonghan-Jeong/Deep-learning-from-scratch | chapter05/5.7.4_backpropagation_learning.py | 1,153 | Python |
import os
import re
from therandy.utils import get_closest, replace_command
from therandy.specific.brew import get_brew_path_prefix, brew_available
BREW_CMD_PATH = '/Library/Homebrew/cmd'
TAP_PATH = '/Library/Taps'
TAP_CMD_PATH = '/%s/%s/cmd'
enabled_by_default = brew_available
def _get_brew_commands(brew_path_pref... | 34.048193 | 124 | 0.649328 | [
"MIT"
] | benmonro/thefuck | therandy/rules/brew_unknown_command.py | 2,826 | Python |
#==============================================================================
# DEREDDEN.py Sean Andrews's deredden.pro ported to python3
#
# A simple function to provide the de-reddening factor in either magnitudes
# (with keyword /mags set) or flux density at a range of input wavelengths,
# given a visual extinctio... | 28.962617 | 87 | 0.592126 | [
"MIT"
] | Circumstellar/MichaelJordan | deredden.py | 3,099 | Python |
from option import *
import tkinter as tk
class Block:
""" Block class for each block of the map """
def __init__(self, x, y, char):
self.x = x
self.y = y
self.char = char
self.blockType = MAP_CHARS[char]
self.texture = BLOCK_TEXTURE[self.blockType]
self.colli... | 34.875969 | 86 | 0.4481 | [
"Apache-2.0"
] | rokonio/Platformer | script/map_and_player.py | 4,499 | Python |
#!/bin/python3
"""
https://www.hackerrank.com/challenges/crossword-puzzle/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=recursion-backtracking&h_r=next-challenge&h_v=zen
"""
# Complete the crossword_puzzle function below.
def crossword_puzzle(crossword, words):
"""resuelv... | 32.464286 | 194 | 0.336084 | [
"MIT"
] | pablosambuco/hackerrank | Interview Preparation Kit/Crossword puzzle/test.py | 5,454 | Python |
# coding: pyxl
from pyxl import html
def test():
if True:
b = <frag>{0#lol
}</frag>
| 13.714286 | 24 | 0.5625 | [
"Apache-2.0"
] | gvanrossum/pyxl3 | tests/test_python_comments_5.py | 96 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.