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 |
|---|---|---|---|---|---|---|---|---|
import os
import cv2
from PIL import Image
import torch
import mmcv
import numpy as np
from torch.utils.data import Dataset
import torchvision.transforms as T
from torchvision.datasets import ImageFolder
class ImageNetDataset(Dataset):
def __init__(self,
data_root,
test_mode=Fa... | 32.254237 | 104 | 0.504467 | [
"Apache-2.0"
] | anorthman/mmdetection | mmdet/datasets/classify/imagenet.py | 1,903 | Python |
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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 o... | 36.584726 | 115 | 0.666058 | [
"Apache-2.0"
] | ColCarroll/probability | tensorflow_probability/python/distributions/zipf_test.py | 15,329 | Python |
"""Implements interface for OSv unikernels."""
from backend.vm import VMConfig
from os import path
from .imgedit import set_cmdline
class OSv:
cmdline_template = "--ip=eth0,{ipv4_addr},255.255.255.0 --nameserver=10.0.125.0 {extra_cmdline}"
@staticmethod
def configure(image, config, nic_name):
c... | 29.535714 | 100 | 0.634825 | [
"MIT"
] | Cunik/Cunik-engine | backend/unikernel/osv/__init__.py | 827 | Python |
#
# Captions:
#
project_title="Services Repository"
project_owner1=""
project_owner2=""
project_cip="ServiceRepo"
nav_up="To the top"
cap_findsrv="Find service"
cap_findsrv_desc="Find service by JSON key"
cap_findsrvtag_desc="...or by query variable, tag etc."
cap_injson="Incoming JSON"
cap_outjson="Outgoing JSON"
ca... | 16.758621 | 55 | 0.771605 | [
"MIT"
] | divlv/servicerepo | www/captions.py | 486 | Python |
# coding=utf-8
# Copyright 2019 The Tensor2Robot Authors.
#
# 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 ... | 39.611268 | 80 | 0.732399 | [
"Apache-2.0"
] | AakashOfficial/tensor2robot | utils/train_eval_test.py | 14,062 | Python |
"""Support for Agent camera streaming."""
from datetime import timedelta
import logging
from agent import AgentError
from homeassistant.components.camera import SUPPORT_ON_OFF
from homeassistant.components.mjpeg.camera import (
CONF_MJPEG_URL,
CONF_STILL_IMAGE_URL,
MjpegCamera,
filter_urllib3_logging,... | 30.078704 | 137 | 0.64322 | [
"Apache-2.0"
] | CantankerousBullMoose/core | homeassistant/components/agent_dvr/camera.py | 6,497 | Python |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... | 39.878049 | 113 | 0.654434 | [
"Apache-2.0"
] | AlexeySanko/pybuilder | src/unittest/python/plugins/python/test_plugin_helper_tests.py | 3,270 | Python |
from .base import Index
from .multi import MultiIndex
from .range import RangeIndex
| 21 | 29 | 0.821429 | [
"BSD-3-Clause"
] | cda-group/baloo | baloo/core/indexes/__init__.py | 84 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 41.303681 | 789 | 0.637653 | [
"Apache-2.0"
] | sebtelko/pulumi-azure-native | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | 13,465 | Python |
import cv2
from PIL import ImageGrab
import numpy as np
def main():
while True:
# bbox specifies specific region (bbox= x,y,width,height)
img = ImageGrab.grab(bbox=(0, 40, 1075, 640))
vanilla = img_np = np.array(img)
img_np = np.array(img)
gray = cv2.cvtColor(img_np, cv2.CO... | 29.551724 | 72 | 0.57993 | [
"Apache-2.0"
] | kymotsujason/crossybot | main.py | 857 | Python |
from timetableparser import TimeTableParser
from timetablewriter import TimeTableWriter
parser = TimeTableParser(False)
writer = TimeTableWriter(True)
# parser.decrypt_pdf("test/a.pdf", "out_a.pdf")
# parser.decrypt_pdf("test/b.pdf", "out_b.pdf")
csv_file_a = "test/output_week_a.csv"
csv_file_b = "test/output_week_b.c... | 42.071429 | 107 | 0.791171 | [
"MIT"
] | SCOTT-HAMILTON/Pdf2TimeTable | Pdf2TimeTable/test.py | 589 | Python |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# 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 notice, this
# lis... | 36.12037 | 79 | 0.608989 | [
"BSD-3-Clause"
] | stormi/tsunami | src/secondaires/navigation/equipage/objectifs/rejoindre.py | 11,757 | Python |
"""
724. Minimum Partition
https://www.lintcode.com/problem/minimum-partition/description
01背包
算法班2020 C27 01背包变形
第1种dp定义
dp[i][j]: considering previous i items to fill <=j, what the maximum value
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - nums[i - 1]] + nums[i - 1])
dp[0][0] = 0
dp[i][0] = 0
answer
max(dp[n])
2d... | 37.230769 | 823 | 0.61312 | [
"MIT"
] | jianershi/algorithm | lintcode/724.1.py | 1,962 | Python |
from rdkit import Chem
from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions
molecules = open('glucose_degradation_output.csv','r')
lines = molecules.readlines()
counter = 0
with open('Glucose_Desc.csv', 'w') as the_file:
the_file.write("Generation,Id,NumStereoIsomers"+'\n') ... | 33.352941 | 94 | 0.730159 | [
"BSD-3-Clause"
] | Reaction-Space-Explorer/reac-space-exp | plots/stereoisomer_gen.py | 567 | Python |
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
from django import forms
from taggit.forms import TagField
from dcim.models import Device
from extras.forms import (
AddRemoveTagsForm, CustomFieldBulkEditForm, CustomFieldFilterForm, CustomFieldModelForm, CustomFieldModelCSVForm,
)
from utiliti... | 27.932203 | 134 | 0.622118 | [
"Apache-2.0"
] | Megzo/netbox | netbox/secrets/forms.py | 6,592 | Python |
import uvloop
import asyncio
import jinja2
import aiohttp_jinja2
from aiohttp import web
from quicksets import settings
from app.middlewares import middlewares
from app.views import routes
async def create_app():
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
app = web.Application(middlewares=middle... | 24.083333 | 69 | 0.769896 | [
"MIT"
] | ihor-nahuliak/task-23-jul-2019 | app/application.py | 578 | Python |
import tensorflow as tf
import numpy as np
def _tf_fspecial_gauss(size, sigma, ch=1):
"""Function to mimic the 'fspecial' gaussian MATLAB function
"""
x_data, y_data = np.mgrid[-size//2 + 1:size//2 + 1, -size//2 + 1:size//2 + 1]
x_data = np.expand_dims(x_data, axis=-1)
x_data = np.expand_dims(x_d... | 35.583333 | 95 | 0.571429 | [
"MIT"
] | 97chenxa/Multiview2Novelview | ssim.py | 2,989 | Python |
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# All rights reserved.
#
# 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... | 46.666667 | 140 | 0.793537 | [
"BSD-3-Clause"
] | George-Chia/Cloudroid-Swarm | base-image/rosbridge/rosbridge_library/src/rosbridge_library/rosbridge_protocol.py | 2,940 | Python |
from __future__ import print_function
import sys
import os
import getopt
import re
import string
import errno
import six
from jsbeautifier.__version__ import __version__
#
# The MIT License (MIT)
# Copyright (c) 2007-2013 Einar Lielmanis and contributors.
# Permission is hereby granted, free of charge, to any person... | 44.059501 | 4,249 | 0.583228 | [
"MIT"
] | fedmich/js-beautify | python/jsbeautifier/__init__.py | 68,865 | Python |
'''Module to manage and advanced game state'''
from collections import defaultdict
import numpy as np
from . import constants
from . import characters
from . import utility
class ForwardModel(object):
"""Class for helping with the [forward] modeling of the game state."""
def run(self,
num_times... | 44.561162 | 103 | 0.564801 | [
"Apache-2.0"
] | psyoblade/playground | pommerman/forward_model.py | 29,143 | Python |
import copy
import datetime
import glob
import json
import os
import sys
import threading
from os import path
from urllib.parse import urlparse, urljoin, ParseResult
import xmltodict
import yaml
from bs4 import BeautifulSoup
from flask import Flask, render_template, Response, send_from_directory, request
from flask.vi... | 32.096715 | 114 | 0.648815 | [
"Apache-2.0"
] | Chinay-Domitrix/kotlin-web-site | kotlin-website.py | 17,589 | Python |
# -*- coding: utf-8 -*-
class TestInvalidPathTweenFactory:
def test_it_400s_if_the_requested_path_isnt_utf8(self, app):
app.get("/%c5", status=400)
| 23.142857 | 64 | 0.697531 | [
"BSD-2-Clause"
] | 13625025773/h | tests/functional/test_tweens.py | 162 | Python |
"""
Simple million word count program.
main idea is Python pairs words
with the number of times
that number appears in the triple quoted string.
Credit to William J. Turkel and Adam Crymble for the word
frequency code used below. I just merged the two ideas.
"""
wordstring = '''SCENE I. Yorkshire. Gaultree Forest.
Ent... | 36.154605 | 64 | 0.786189 | [
"MIT"
] | onepseudoxy/Python | CountMillionCharacter.py | 10,991 | Python |
""" YQL out mkt cap and currency to fill out yahoo table """
""" TODO: retreive lists of 100 symbols from database and update"""
""" Results are intented to use while matching yahoo tickers, which one has mkt cap? which ones has sector? """
import mysql.connector
import stockretriever
import sys
import time
from rand... | 27.805556 | 111 | 0.618881 | [
"BSD-3-Clause"
] | pettersoderlund/fondout | script/StockScraper-master/update_market_cap_yahoo.py | 2,002 | Python |
import os
import time
import datetime
import socket
import platform
import sys
from multiprocessing.dummy import Pool as ThreadPool
from colorama import Fore, Back, Style
def rtspbrute(ip1):
log=open("logs",'r')
if ip1 not in log:
flag=0
ip1 = ip1[:-1]
os.system("mkdir -p Hikvision/%s 2> /dev/null"%(str(ip1).... | 38.413793 | 287 | 0.658887 | [
"MIT"
] | haka110/Cam-Brute | hik-brute.py | 2,228 | Python |
# Copyright (c) 2014 eBay Software Foundation
# Copyright 2015 HP Software, LLC
# All Rights Reserved.
#
# 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.o... | 33.677419 | 78 | 0.733716 | [
"Apache-2.0"
] | NeCTAR-RC/trove-dashboard | trove_dashboard/content/database_clusters/panel.py | 1,044 | Python |
# Generated by Django 2.2.1 on 2019-07-06 21:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('publish', '0031_bundle_description'),
]
operations = [
migrations.CreateModel(
name='Docset',
fields=[
... | 26.863636 | 114 | 0.57868 | [
"BSD-3-Clause"
] | SFDO-Tooling/sfdoc | sfdoc/publish/migrations/0032_docset.py | 591 | Python |
from functools import partial
from g_code_test_data.http.http_settings import HTTP_SETTINGS
from g_code_test_data.g_code_configuration import HTTPGCodeConfirmConfig
from robot_server.service.legacy.routers.modules import post_serial_command
from robot_server.service.legacy.models.modules import SerialCommand
from opent... | 29.452381 | 77 | 0.760711 | [
"Apache-2.0"
] | MarcelRobitaille/opentrons | g-code-testing/g_code_test_data/http/modules/magdeck.py | 1,237 | Python |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free S... | 29.12963 | 86 | 0.686586 | [
"MIT"
] | block1o1/CryptoPredicted | ENV/lib/python3.5/site-packages/pyrogram/api/types/channel_admin_log_event_action_toggle_pre_history_hidden.py | 1,574 | Python |
# https://github.com/iliaschalkidis/lmtc-eurlex57k/blob/master/metrics.py
from sklearn.metrics import accuracy_score
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
import numpy as np
def mean_precision_k(y_true, y_score, k=10):
"""Mean ... | 28.360434 | 96 | 0.602389 | [
"Apache-2.0"
] | myeonghak/kobert-multi-label-VOC-classifier | voc_classifier/metrics_for_multilabel.py | 10,465 | Python |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... | 37.301887 | 80 | 0.581858 | [
"Apache-2.0"
] | 92lqllearning/Paddle | python/paddle/fluid/tests/unittests/dygraph_to_static/test_ptb_lm.py | 11,862 | Python |
from tqdm import tqdm
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)
rc('text.latex', preamble=r'''\usepackage{amsmath}
\usepackage{physics}
\usepackage{siunitx}
''')
rc('figure', dpi=150)
def plot_and_save(plotting_func):
plo... | 26.818182 | 108 | 0.69661 | [
"Apache-2.0"
] | jacopok/notes | phd_courses/theoretical_high_energy_astroparticle/figures/make_all_figures.py | 590 | Python |
# Generated by Django 3.2.9 on 2022-01-03 10:15
import cloudinary.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('neighbourhood', '0003_auto_20211222_2324'),
]
operations = [
migrations.CreateMode... | 34.857143 | 121 | 0.600117 | [
"MIT"
] | Maryan23/MyHood | neighbourhood/migrations/0004_auto_20220103_1315.py | 1,708 | Python |
import deepSI
from deepSI.systems.system import System_ss, System_data
import numpy as np
class NarendraLiBenchmark(System_ss): #https://arxiv.org/pdf/2003.14162.pdf
"""docstring for NarendraLiBenchmark"""
def __init__(self):
'''Noise, system setting and x0 settings'''
super(NarendraLiBenchmark... | 37.35 | 109 | 0.655957 | [
"BSD-3-Clause"
] | csutakbalazs/deepSI | deepSI/systems/narendra_li_benchmark.py | 1,494 | Python |
from __future__ import absolute_import, division, print_function, \
with_statement
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
from shadowsocksr.crypto import rc4_md5
from shadowsocksr.crypto import openssl
from shadowsocksr.crypto import sodium
from shadowsocksr.cryp... | 20.54902 | 67 | 0.714695 | [
"Apache-2.0"
] | hcaijin/ssrspeedtest | shadowsocksr/encrypt_test.py | 1,048 | Python |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to implement an AWS Lambda function that publishes messages to an
AWS IoT Greengrass connector.
"""
# snippet-start:[greengrass.python.connector-modbus-rtu-usage.complete]
import json
impo... | 24.121951 | 75 | 0.706775 | [
"Apache-2.0"
] | 1n5an1ty/aws-doc-sdk-examples | python/example_code/greengrass/snippets/connector_modbus_rtu_usage.py | 989 | Python |
import constraint
coins = [1, 2, 5, 10, 20, 50, 100, 200]
CSP = constraint.Problem()
for coin in coins:
CSP.addVariable(coin, range(0, 201, coin))
CSP.addConstraint(constraint.ExactSumConstraint(200))
print len(CSP.getSolutions()) | 26.222222 | 53 | 0.724576 | [
"MIT"
] | rik0/rk-exempla | some-euler/p31.py | 236 | Python |
#!/usr/bin/env python
# file trying to apply and test the pid controller on carla.
import glob
import os
import sys
import time
import matplotlib.pyplot as plt
from PID_controller import PID
import numpy as np
import speed_profile_reader as spr
try:
sys.path.append(glob.glob('../**/*%d.%d-%s.egg' % (
sys.... | 33.593407 | 133 | 0.564279 | [
"MIT"
] | AbdulHoffmann/carla_carissma | PythonAPI/carissma_project/PID_apply_static_sp.py | 6,114 | Python |
{% if cookiecutter.use_celery == 'y' %}
from __future__ import absolute_import
import os
from celery import Celery
from django.apps import AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SET... | 38.253968 | 99 | 0.688797 | [
"Apache-2.0"
] | andkon/botstarter | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py | 2,410 | Python |
import logging
import os
from typing import Generator
import pytest
@pytest.fixture(scope="module", autouse=True)
def change_to_resources_dir(test_resources, request):
os.chdir(test_resources)
yield
os.chdir(request.config.invocation_dir)
@pytest.fixture()
def test_filename(
change_to_resources_dir... | 33.601852 | 111 | 0.74194 | [
"MIT"
] | AnesBenmerzoug/accsr | tests/accsr/test_remote_storage.py | 7,258 | Python |
"""Performs face alignment and stores face thumbnails in the output directory."""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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 witho... | 51.8875 | 133 | 0.57456 | [
"MIT"
] | btlk/facenet | facenet/align/align_dataset_mtcnn.py | 8,302 | Python |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MessageContact'
db.create_table('umessages_messagecontact', (
('id', self.gf('... | 65.691057 | 221 | 0.593936 | [
"BSD-3-Clause"
] | SkyTruth/django-userena | userena/contrib/umessages/migrations/0001_initial.py | 8,080 | Python |
#!/bin/env python
import csv
from datetime import datetime
import os
import xml.etree.ElementTree as ET
import xml
# https://stackabuse.com/reading-and-writing-xml-files-in-python/
# xmlformatter:
# https://www.freeformatter.com/xml-formatter.html#ad-output
infile = "./RAJAPerf-timing.csv"
def read_infile(infile)... | 25.563218 | 78 | 0.678507 | [
"BSD-3-Clause"
] | CRobeck/RAJAPerf | scripts/csv_xml.py | 4,448 | Python |
#!/usr/bin/env python2
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... | 37.90678 | 100 | 0.666331 | [
"MIT"
] | mikehash/qtum-electrum | qtum_electrum/plugins/hw_wallet/qt.py | 8,946 | Python |
"""Python Crypto Bot consuming Coinbase Pro or Binance APIs"""
import functools
import os
import sched
import sys
import time
import pandas as pd
from datetime import datetime
from models.PyCryptoBot import PyCryptoBot, truncate as _truncate
from models.AppState import AppState
from models.Trading import TechnicalAnal... | 51.137376 | 202 | 0.504417 | [
"Apache-2.0"
] | treggit/pycryptobot | pycryptobot.py | 41,319 | Python |
#!/usr/bin/env python3
# encoding: utf-8
# Copyright 2017 Tomoki Hayashi (Nagoya University)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Automatic speech recognition model training script."""
import logging
import os
import random
import subprocess
import sys
from distutils.version import LooseVe... | 31.438871 | 88 | 0.577376 | [
"Apache-2.0"
] | Advanjef/espnet | espnet/bin/asr_train.py | 20,058 | Python |
# -*- coding=utf-8 -*-
import pygame
from pygame.locals import MOUSEBUTTONDOWN
from pybfcontrol.bf_common import BFControlId,BFBase, TEXT_ALIGN_LEFT,TEXT_ALIGN_MIDDLE
CLICK_EFFECT_TIME = 100
PADING = 4
class BFButton(BFBase):
def __init__(self, parent, rect, text='Button', click=None):
super(BFButton, self... | 35.430894 | 137 | 0.583983 | [
"MIT"
] | zhangenter/bf_control | pybfcontrol/bf_button.py | 4,358 | Python |
#(c) 2016 by Authors
#This file is a part of ABruijn program.
#Released under the BSD license (see LICENSE file)
"""
Runs repeat/contigger binary
"""
from __future__ import absolute_import
import subprocess
import logging
import os
from flye.utils.utils import which
REPEAT_BIN = "flye-modules"
CONTIGGER_BIN = "flye... | 33.865979 | 83 | 0.624353 | [
"BSD-3-Clause"
] | arun-sub/Flye | flye/assembly/repeat_graph.py | 3,285 | Python |
import json
import typing
import collections
from matplotlib import cm
from matplotlib.colors import Normalize, to_hex, CSS4_COLORS, BASE_COLORS
import matplotlib.pyplot as plt
from clldutils.color import qualitative_colors, sequential_colors, rgb_as_hex
from cldfviz.multiparameter import CONTINUOUS, CATEGORICAL, Par... | 39.835294 | 94 | 0.599232 | [
"Apache-2.0"
] | cldf/cldfviz | src/cldfviz/colormap.py | 3,386 | Python |
import torch
class KFold:
def __init__(self, dataset, n_fold=10, batch_size=32, num_workers=0, pin_memory=False):
self.fold = 0
self.batch_size = batch_size
self.num_workers = num_workers
self.pin_memory = pin_memory
self.dataset = dataset
self.n_fold = n_fold
... | 39.353846 | 158 | 0.555903 | [
"MIT"
] | raharth/PyMatch | pymatch/utils/KFold.py | 2,558 | Python |
# -*- coding: utf-8 -*- #
# Copyright 2011 Google 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 o... | 27.714286 | 88 | 0.736082 | [
"Apache-2.0"
] | lmanul/awty | whoami.py | 970 | Python |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# 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 appli... | 38.944444 | 111 | 0.74679 | [
"Apache-2.0"
] | btarjan/NeMo | nemo/package_info.py | 1,402 | Python |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 40.219512 | 70 | 0.745907 | [
"Apache-2.0"
] | shubhramittal/selenium | py/test/selenium/webdriver/common/page_load_timeout_tests.py | 1,649 | Python |
from bs4 import BeautifulSoup
from django.forms import (
BaseForm,
BaseFormSet,
BoundField,
CheckboxInput,
CheckboxSelectMultiple,
DateInput,
EmailInput,
FileInput,
MultiWidget,
NumberInput,
PasswordInput,
RadioSelect,
Select,
SelectDateWidget,
TextInput,
... | 39.285458 | 119 | 0.621744 | [
"Unlicense"
] | Andre-Azu/neigbourhood | env/lib/python3.8/site-packages/bootstrap4/renderers.py | 21,882 | Python |
import tensorflow as tf
import numpy as np
import os
import matplotlib.pyplot as plt
from tqdm import tqdm
class RBM(object):
def __init__(self,num_visible,num_hidden,visible_unit_type='bin',main_dir='/Users/chamalgomes/Documents/Python/GitLab/DeepLearning/KAI PROJECT/rbm/models',
model_na... | 38.474849 | 354 | 0.633459 | [
"MIT"
] | Phoebe0222/MLSA-workshops-2019-student | Unsupervised-Learning/rbm.py | 19,123 | Python |
from data_processing_calibration import DataProcessingCalibration
if __name__ == "__main__":
# Start processing
dp_ST = DataProcessingCalibration()
print("Initialize is successful.")
# Open .csv file with data
data_from_sensor = dp_ST.openFile('C://static_test.csv')
print("Data was ... | 36.958333 | 113 | 0.722661 | [
"MIT"
] | DefenderOfSockets/Calibration_IMU_MPU6050 | static_test/main.py | 887 | Python |
"""
Support for Smappee energy monitor.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/smappee/
"""
import logging
from datetime import datetime, timedelta
import re
import voluptuous as vol
from requests.exceptions import RequestException
from homeassi... | 36.276353 | 78 | 0.581089 | [
"Apache-2.0"
] | Arshrock/home-assistant | homeassistant/components/smappee.py | 12,733 | Python |
import os
import math
from decimal import Decimal
import utility
import torch
import torch.nn.utils as utils
from tqdm import tqdm
class Trainer():
def __init__(self, args, loader, my_model, my_loss, ckp):
self.args = args
self.scale = args.scale
self.ckp = ckp
self.loader_train ... | 34.645503 | 105 | 0.51069 | [
"MIT"
] | CvlabAssignment/WRcan | src/trainer.py | 6,548 | Python |
#
# PySNMP MIB module NOKIA-HWM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-HWM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:23:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | 168 | 1,280 | 0.772321 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/NOKIA-HWM-MIB.py | 14,112 | Python |
class NoNodeData(Exception):
pass
class AVLNode(object):
def __init__(self, key=None, value=None) -> None:
"""Initializes the AVL Node.
Args:
data (dict, optional): {Key:Value} pair. Defaults to None.
"""
super().__init__()
self.key = key
self.valu... | 23.56 | 82 | 0.516129 | [
"MIT"
] | gpk2000/avl-db | avltree/AVLNode.py | 1,178 | Python |
# -*- coding: utf-8 -*-
from benedict.core import clone as _clone
from benedict.core import traverse as _traverse
import unittest
class traverse_test_case(unittest.TestCase):
def test_traverse(self):
i = {
'a': {
'x': 2,
'y': 3,
'z': {
... | 22 | 47 | 0.249311 | [
"MIT"
] | antran22/python-benedict | tests/core/test_traverse.py | 1,452 | Python |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
from logging import getLogger
from .onnx_model import OnnxModel
from typin... | 41.741379 | 104 | 0.609252 | [
"Apache-2.0"
] | kiminh/fastformers | examples/fastformers/onnx_graph_optimizer/fusion_utils.py | 2,421 | Python |
import pytest
import requests
from directory_constants import expertise, sectors
from django.shortcuts import Http404
from django.urls import reverse
from core import helpers
import core.tests.helpers
@pytest.mark.parametrize('status_code,exception', (
(400, requests.exceptions.HTTPError),
(404, Http404),
... | 31.388158 | 78 | 0.607001 | [
"MIT"
] | uktrade/directory-ui-supplier | core/tests/test_helpers.py | 4,771 | Python |
from setuptools import setup
setup(
name='yt-dl',
version = "0.1.0",
author = "Fernando Luiz Cola",
author_email ="fernando.cola@emc-logic.com",
license = "MIT",
install_requires=[
'Flask',
'youtube-dl',
],
)
| 21.571429 | 52 | 0.480132 | [
"Unlicense"
] | ferlzc/youtube-dl-flask | setup.py | 302 | Python |
import re
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from collections import OrderedDict
__all__ = ['DenseNet', 'densenet121', 'densenet169', 'densenet201', 'densenet161']
model_urls = {
'densenet121': 'https://download.pytorch.org/models/densenet... | 44.216814 | 109 | 0.625638 | [
"BSD-3-Clause"
] | AaronLeong/cvlib | cvlib/models/densenet.py | 9,993 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: storyboard_node.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.prot... | 52.987342 | 992 | 0.774845 | [
"Apache-2.0"
] | easyopsapis/easyops-api-python | container_sdk/model/next_builder/storyboard_node_pb2.py | 8,372 | Python |
#!/usr/bin/env python3
import asyncio
import logging
from collections import defaultdict
from functools import partial
from box import Box
_l = logging.getLogger(__name__)
_instances = dict()
_events = defaultdict(asyncio.Event)
_event_queues = list()
_event_callbacks = defaultdict(list)
class Component:
"""... | 33.524793 | 99 | 0.590903 | [
"MIT"
] | DrDub/pipekit | pipekit/component.py | 8,113 | Python |
# sqlite/base.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
r"""
.. dialect:: sqlite
:name: SQLite
:full_support: 3.21, 3.28+
:norma... | 34.656669 | 110 | 0.599601 | [
"MIT"
] | aalvrz/sqlalchemy | lib/sqlalchemy/dialects/sqlite/base.py | 87,820 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
#-----------------------------------------------------------------------------------------
class GeoMap:
'''
INFO:
Map boundary edges order:
... | 30.937282 | 90 | 0.401847 | [
"MIT"
] | wqqpp007/geoist | geoist/cattools/MapTools.py | 8,879 | Python |
#!/usr/bin/env python
# Test whether a client sends a correct PUBLISH to a topic with QoS 2 and responds to a disconnect.
import context
import paho_test
rc = 1
keepalive = 60
connect_packet = paho_test.gen_connect(
"publish-qos2-test", keepalive=keepalive, clean_session=False,
)
connack_packet = paho_test.gen_c... | 31.810811 | 99 | 0.614274 | [
"Unlicense"
] | Jegeva/BruCON_2021 | backend/mqtt_react/python_bugg/paho.mqtt.python/test/lib/03-publish-c2b-qos2-disconnect.py | 2,354 | Python |
import base64
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
# Reference: https://www.djangosnippets.org/snippets/243/
def view_or_basicauth(view, request, test_func, realm="", *args, **kwargs):
"""
This is a helper function used by both 'logged_in_or_basicauth' and... | 37.4 | 79 | 0.649198 | [
"MIT"
] | tullyrankin/python-frameworks | django/basic_auth/example1/decorators.py | 3,740 | Python |
# Configuration file with default options,
# There are four main sections: General, Features, LQP and Learning corresponding to different
# functionalities. You can disable any of the Features or Learning section (by commenting it out) according to your requirement.
[General]
# general options
idir=/home/hussain/dat... | 68.241379 | 256 | 0.698585 | [
"BSD-3-Clause"
] | csgcmai/lqp_face | face-rec/config.py | 3,958 | Python |
from __future__ import print_function
import os
import xml.etree.ElementTree as ET
def load_xml_for_module(xml_dir_path, module_name, or_dummy=True):
xml_tree = ET.Element("dummy") if or_dummy else None
for sfx in ["_8hpp", "_8h"]:
xml_path = os.path.join(xml_dir_path, "%s%s.xml" % (module_name, sfx))... | 40.754717 | 109 | 0.622685 | [
"BSD-3-Clause"
] | 745198699/src | tools/doxygen_utils.py | 2,160 | Python |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# 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... | 38.711268 | 78 | 0.709478 | [
"Apache-2.0"
] | Saiprasad16/tfx | tfx/dsl/compiler/testdata/iris_pipeline_sync.py | 5,497 | Python |
"""Similar to DDPG except we only need obs and act, not the reward, etc.
"""
import numpy as np
class RingBuffer(object):
def __init__(self, maxlen, shape, dtype='float32'):
self.maxlen = maxlen
self.start = 0
self.length = 0
if dtype == 'uint8':
# Daniel: special case... | 38.04908 | 84 | 0.60803 | [
"MIT"
] | DanielTakeshi/baselines-fork | baselines/imit/memory.py | 6,202 | Python |
"""empty message
Revision ID: eb02de174736
Revises: c0de0819f9f0
Create Date: 2020-02-04 18:29:57.302993
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'eb02de174736'
down_revision = 'c0de0819f9f0'
branch_labels = None
depends_on = None
def upgrade():
# ... | 25.257143 | 69 | 0.644796 | [
"Apache-2.0"
] | nkatwesigye/project_furry | starter_code/migrations/versions/eb02de174736_.py | 884 | Python |
from jogo_banco import __version__
def test_version():
assert __version__ == '0.1.0'
| 15.166667 | 34 | 0.725275 | [
"Apache-2.0"
] | rafaelgarrafiel/jogo_banco | tests/test_jogo_banco.py | 91 | 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.134969 | 90 | 0.624411 | [
"Apache-2.0"
] | GrassSunFlower/mxnet | tools/license_header.py | 5,727 | Python |
"""Test service helpers."""
import asyncio
from copy import deepcopy
import unittest
from unittest.mock import patch
# To prevent circular import when running just this file
import homeassistant.components # noqa
from homeassistant import core as ha, loader
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_EN... | 35.604396 | 75 | 0.603395 | [
"Apache-2.0"
] | DevRGT/home-assistant | tests/helpers/test_service.py | 6,480 | Python |
# ----------------------------------------------------------------
# ---------- ASSOCIATION RULE MINING : NOTEABLE ATTEMPT 2 ---------
# ----------------------------------------------------------------
# ------------------ DAILY DATASET --------------------
association_rules = apriori(dailyRankedCrimes.values, min_s... | 37.866667 | 142 | 0.634683 | [
"MIT"
] | CraftingGamerTom/wsu-computer-science | CS-383_Cloud-Computing_2020-Spring/association-rule-mining/attempt2.py | 1,136 | Python |
# Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the S... | 36.724138 | 91 | 0.64507 | [
"MIT"
] | JoanAzpeitia/lp_sg | install/app_store/tk-framework-adminui/v0.1.6/python/setup_project/project_delegate.py | 4,260 | Python |
import unittest
from robotide.preferences.settings import SettingsMigrator
from robotide.utils import overrides
class SettingsMigrationTestCase(SettingsMigrator, unittest.TestCase):
def __init__(self, methodName='runTest'):
unittest.TestCase.__init__(self, methodName=methodName)
def setUp(self):
... | 33.163265 | 69 | 0.721231 | [
"ECL-2.0",
"Apache-2.0"
] | Acidburn0zzz/RIDE | utest/preferences/test_settings.py | 1,625 | Python |
###
# Copyright (c) 2003-2005, Daniel DiPaolo
# All rights reserved.
#
# 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 notice,
# this list of cond... | 42.579545 | 79 | 0.681345 | [
"BSD-3-Clause"
] | ircpuzzles/competitionbot | plugins/News/test.py | 3,747 | Python |
from enum import Enum
class GeneClass(str, Enum):
PROTEIN_CODING = ("protein coding,nonsense mediated decay",)
PSEUDOGENE = "pseudogene,unprocessed pseudogene,polymorphic pseudogene,unitary pseudogene,transcribed unprocessed pseudogene,transcribed processed pseudogene, IG pseudogene"
MICRO_RNA = "micro RN... | 50 | 177 | 0.76 | [
"MIT"
] | lifeomic/phc-sdk-py | phc/easy/omics/options/gene_class.py | 700 | Python |
# Copyright 2021 Huawei Technologies Co., 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... | 37.509434 | 107 | 0.666499 | [
"Apache-2.0"
] | mindspore-ai/models | research/cv/resnext152_64x4d/postprocess.py | 1,988 | Python |
from .checkpoints_evaluation import CheckpointsEvaluationControlFlow
from .controlflow import (
record_train_batch_stats,
record_validation_stats,
validation_round,
)
from .helpers import prepare_batch
__all__ = [
"CheckpointsEvaluationControlFlow",
"record_validation_stats",
"record_train_batc... | 23.5625 | 68 | 0.777188 | [
"Apache-2.0"
] | c4dt/mlbench-core | mlbench_core/controlflow/pytorch/__init__.py | 377 | Python |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
""" Display accelerometer data once per second """
import time
import board
import adafruit_lsm303_accel
i2c = board.I2C() # uses board.SCL and board.SDA
sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)
while True:
ac... | 22.956522 | 73 | 0.666667 | [
"MIT"
] | Yarik9008/SoftAcademic | libralli/circcuitpython/adafruit-circuitpython-bundle-7.x-mpy-20211225/examples/lsm303_accel_simpletest.py | 528 | Python |
#!/usr/bin/python
# Copyright 2013 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.
"""Patch an orderfile.
Starting with a list of symbols in a binary and an orderfile (ordered list of
symbols), matches the symbols in the ... | 32.936975 | 80 | 0.710677 | [
"BSD-3-Clause"
] | yury-s/v8-inspector | Source/chrome/tools/cygprofile/patch_orderfile.py | 7,839 | Python |
# Generated by Django 2.0.2 on 2018-09-06 13:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('institution', '0016_institution_funding_document_email'),
]
operations = [
migrations.AddField(
model_name='institution',
... | 26.125 | 67 | 0.623604 | [
"MIT"
] | M4rkD/cogs3 | institution/migrations/0017_auto_20180906_1349.py | 627 | Python |
# -*- coding: utf-8 -*-
"""
This file contains all the settings used in production.
This file is required and if development.py is present these
values are overridden.
"""
from server.settings.components import config
# Production flags:
# https://docs.djangoproject.com/en/2.2/howto/deployment/
DEBUG = False
ALLO... | 26.294872 | 78 | 0.736714 | [
"MIT"
] | alisher-matkurbanov/wemake-django-template | {{cookiecutter.project_name}}/server/settings/environments/production.py | 2,051 | Python |
# ============================================
__author__ = "Sachin Mehta and Ximing Lu"
__maintainer__ = "Sachin Mehta and Ximing Lu"
# ============================================
import torch
from utilities.print_utilities import *
import os
from utilities.lr_scheduler import get_lr_scheduler
from metrics.metric_ut... | 41.248677 | 140 | 0.602745 | [
"MIT"
] | alibalapour/HATNet | train_and_eval/trainer.py | 15,592 | Python |
class Error(Exception):
'''Base Error.'''
def __init__(self):
self.error = 'Fatal error occured.'
super().__init__(self.error)
class ArgError(Error):
'''Argument Error.'''
def __init__(self):
self.error = 'Incorrect argument passed.'
super().__init__(self.error)
class MissingArg(ArgError):
'''Argument ... | 22.255319 | 63 | 0.685468 | [
"MIT"
] | cree-py/cocasync | cocasync/errors.py | 1,046 | Python |
from django.apps import AppConfig
class RuntimeMainConfig(AppConfig):
name = 'runtime_main'
| 16.333333 | 35 | 0.77551 | [
"Apache-2.0"
] | Bodya00/RunTime | runtime/runtime_main/apps.py | 98 | Python |
from sympy import symbols, integrate, Rational, lambdify
import matplotlib.pyplot as plt
import numpy as np
# Pollution from a factory is entering a lake. The rate of concentration of the pollutant at time t is given by
t = symbols( 't', positive = True )
dP = 91*t ** Rational( 5, 2 )
# where t is the number of years... | 33.464286 | 132 | 0.708645 | [
"MIT"
] | bmoretz/Python-Playground | src/Classes/MSDS400/Module 7/polution.py | 939 | Python |
import numpy as np
import pandas as pd
from collections import OrderedDict
def one_to_one_matching(pred_infos, gt_infos,
keys=('scene_id', 'view_id'),
allow_pred_missing=False):
keys = list(keys)
pred_infos['pred_id'] = np.arange(len(pred_infos))
gt_infos['g... | 36.369231 | 75 | 0.630711 | [
"MIT"
] | lesteve/robopose | robopose/evaluation/meters/utils.py | 2,364 | Python |
# -- --------------------------------------------------------------------------------------------------- -- #
# -- project: A python project for algorithmic trading in FXCM -- #
# -- ----------------------------------------------------------------------------------------------... | 44.698413 | 109 | 0.393111 | [
"MIT"
] | IFFranciscoME/trading-project | data.py | 2,816 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/1/28 14:07
# @Author : ywl
# @Email : astralrovers@outlook.com
# @File : commit-msg.py.py
import os
import sys
import re
import json
crc_list = (
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129... | 33.096296 | 98 | 0.597359 | [
"MIT"
] | wotsen/learning_platform_server | hooks/commit-msg.py | 4,550 | Python |
# Copyright 2020 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.382979 | 79 | 0.720762 | [
"Apache-2.0"
] | clincoln8/data | scripts/india_rbi/below_poverty_line/preprocess_test.py | 1,522 | Python |
# coding: utf-8
###################################################################
# Copyright (c) 2016-2020 European Synchrotron Radiation Facility #
# #
# Author: Marius Retegan #
# ... | 31.88785 | 95 | 0.59521 | [
"MIT"
] | jminar/crispy | crispy/gui/quanty/calculation.py | 23,886 | Python |
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.serializers import PrimaryKeyRelatedField, RelatedField
class UniqueRelatedField(RelatedField):
"""
Like rest_framework's PrimaryKeyRelatedField, but selecting by any unique
field instead of the primary key.
"""
default_err... | 38.181818 | 81 | 0.711111 | [
"MIT"
] | azengard/reseller-api | apps/api/serializers.py | 1,260 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.