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 argparse
import sys
from os import path
import cv2 as cv
from mcrops import veget, utils
def full_imshow(name, image):
cv.namedWindow(name, cv.WINDOW_NORMAL)
cv.resizeWindow(name, 800, 600)
cv.imshow(name, image)
def main(image_path: str, resolution: float, row_sep: float):
print(f'Starting... | 27.247619 | 74 | 0.650122 | [
"MIT"
] | raikel/mcrops | examples/vegetation.py | 2,861 | Python |
# Copyright (c) 2014, Raphael Kubo da Costa <rakuco@FreeBSD.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
import PyKDE4.kdecore
if __name__ == '__main__':
try:
import PyKDE4.pykdeconfig
pykdecfg = ... | 41.73913 | 78 | 0.713542 | [
"BSD-3-Clause"
] | KDE-China/extra-cmake-modules | attic/modules/FindPyKDE4.py | 960 | Python |
# -*- coding: utf-8 -*-
from random import randint
import json
from .base import analyse_process_graph, PROCESS_DICT, PROCESS_DESCRIPTION_DICT
from openeo_grass_gis_driver.process_schemas import Parameter, ProcessDescription, ReturnValue
from .actinia_interface import ActiniaInterface
__license__ = "Apache License, Ve... | 36.539007 | 113 | 0.607725 | [
"Apache-2.0"
] | AnikaBettge/openeo-grassgis-driver | src/openeo_grass_gis_driver/actinia_processing/get_data_process.py | 5,154 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2010 Søren Roug, European Environment Agency
#
# This is free software. You may redistribute it under the terms
# of the Apache license and the GNU General Public License Version
# 2 or at your option any later version.
#
# This program is distributed ... | 34.901099 | 107 | 0.652393 | [
"Apache-2.0"
] | 10088/hue | desktop/core/ext-py/odfpy-1.4.1/tests/testform.py | 3,177 | Python |
import os.path
import sys
from tf_pwa.config_loader import ConfigLoader
from tf_pwa.vis import draw_decay_struct
this_dir = os.path.dirname(__file__)
sys.path.insert(0, this_dir + "/..")
def main():
config = ConfigLoader("config.yml")
for i, dec in enumerate(config.get_decay()):
draw_de... | 21.666667 | 66 | 0.641758 | [
"MIT"
] | ReynLieu/tf-pwa | tutorials/examples/show_decay_chain.py | 455 | Python |
import os
import hashlib
from django.db import models
from sample.fields import Md5Field, Sha256Field
from scanworker.file import PickleableFileSample
from scaggr.settings import SAMPLE_UPLOAD_DIR, MAX_SHA256_DIRECTORY_DEPTH
def generate_hash_directories(hash_str):
return "/".join([d for d in hash_str[:MAX_SHA256_D... | 32.686567 | 89 | 0.755251 | [
"Apache-2.0"
] | scsich/phagescan | sample/abstract.py | 2,190 | Python |
""" Test the gym's code for configuring the DonkeyCar's camera settings.
"""
import os
import argparse
import gym
import gym_donkeycar
import numpy as np
import uuid
if __name__ == "__main__":
# Initialize the donkey environment
# where env_name one of:
env_list = [
"donkey-warehouse-v0",
... | 27.953488 | 129 | 0.553245 | [
"MIT"
] | vihank/gym-donkeycar | examples/test_cam_config.py | 2,404 | Python |
from src.pre_processing import Preprocessing
def identifyQuery(query):
q_l: str = query
if q_l.__contains__("AND") or q_l.__contains__("OR") or q_l.__contains__("NOT"):
return "B"
elif query.__contains__("/"):
return "PR"
elif len(q_l.split()) == 1:
return "S"
else:
... | 28.106061 | 102 | 0.547439 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | thealifaisal/boolean-retrieval-model | src/search.py | 3,710 | Python |
test = { 'name': 'q3_b',
'points': 5,
'suites': [ { 'cases': [ { 'code': '>>> no_match in '
"list(['professor', 'engineer', "
"'scientist', 'cat'])\n"
'True',
... | 45.076923 | 80 | 0.235495 | [
"Apache-2.0"
] | UCBerkeley-SCET/DataX-Berkeley | dataxHWSp2021/HW3-4_NLP/student/tests/q3_b.py | 586 | Python |
#!/usr/bin/env python
#
# Copyright 2018 Confluent 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... | 33.422414 | 105 | 0.689709 | [
"Apache-2.0"
] | RasmusWL/confluent-kafka-python | examples/confluent_cloud.py | 3,877 | Python |
'''Paginatiors for Figures
'''
from rest_framework.pagination import LimitOffsetPagination
class FiguresLimitOffsetPagination(LimitOffsetPagination):
'''Custom Figures paginator to make the number of records returned consistent
'''
default_limit = None
| 22.416667 | 81 | 0.784387 | [
"MIT"
] | TheMOOCAgency/figures | figures/pagination.py | 269 | Python |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
from spack import *
class ScalapackBase(CMakePackage):
"""Base class for building ScaLAPACK, shared with... | 35.364407 | 95 | 0.627366 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | Bambi/spack | var/spack/repos/builtin/packages/netlib-scalapack/package.py | 4,173 | Python |
"""
ParallelCluster
ParallelCluster API # noqa: E501
The version of the OpenAPI document: 3.0.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from pcluster_client.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNo... | 38.211429 | 110 | 0.589203 | [
"Apache-2.0"
] | Chen188/aws-parallelcluster | api/client/src/pcluster_client/model/delete_cluster_response_content.py | 6,687 | Python |
"""
ASGI config for achristos project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SET... | 23.235294 | 78 | 0.787342 | [
"MIT"
] | n0tNoah/achristos | achristos/asgi.py | 395 | Python |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.core.pipeline.policies import ContentDecodePolicy
from azure.core.pipeline.policies import SansIOHTTPPolicy, HTTPPolicy
from ._models import T... | 40.386364 | 122 | 0.68655 | [
"MIT"
] | anuchandy/azure-sdk-for-python | sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_policies.py | 1,777 | Python |
# Copyright (c) 2016 Tzutalin
# Create by TzuTaLin <tzu.ta.lin@gmail.com>
try:
from PyQt5.QtGui import QImage
except ImportError:
from PyQt4.QtGui import QImage
from base64 import b64encode, b64decode
from libs.pascal_voc_io import PascalVocWriter
from libs.pascal_voc_io import XML_EXT
import os.path
import s... | 33.058824 | 91 | 0.571429 | [
"MIT"
] | DHZS/labelImg | libs/labelFile.py | 3,934 | Python |
"""
:author: Maikel Punie <maikel.punie@gmail.com>
"""
import velbus
class VMB1BLModule(velbus.Module):
"""
Velbus input module with 6 channels
"""
def __init__(self, module_type, module_name, module_address, controller):
velbus.Module.__init__(self, module_type, module_name, module_address, co... | 32.184211 | 90 | 0.641864 | [
"MIT"
] | ddanssaert/python-velbus | velbus/modules/vmbbl.py | 2,446 | Python |
from django.contrib.auth import authenticate, login, logout, get_user_model
from django.shortcuts import render, redirect
# Create your views here.
from .forms import LoginForm, RegisterForm
User = get_user_model()
def register_view(request):
form = RegisterForm(request.POST or None)
if form.is_valid():
... | 34.927273 | 75 | 0.609058 | [
"MIT"
] | aklauritzen/django-bootcamp | accounts/views.py | 1,921 | 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... | 33.511905 | 89 | 0.738899 | [
"Apache-2.0"
] | ankitdobhal/aliyun-openapi-python-sdk | aliyun-python-sdk-drds/aliyunsdkdrds/request/v20190123/DescribeDrdsInstancesRequest.py | 2,815 | Python |
default_app_config = "%s.apps.AppConfig" % __name__
__version__ = "0.2.1"
| 18.75 | 51 | 0.72 | [
"BSD-3-Clause"
] | bashu/django-fineuploader | fineuploader/__init__.py | 75 | Python |
# -*- coding: utf-8 -*-
# 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/.
from cli_common.log import get_logger
logger = get_logger(__name__)
WORKER_CHECKOUT = '/builds... | 32.753623 | 124 | 0.623894 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Mozilla-GitHub-Standards/7a0517c85b685752ad36ce0e8246040e3de8d842fb0f2696540dfc0c54da847b | src/staticanalysis/bot/static_analysis_bot/task.py | 2,260 | Python |
import time
from array import array
from itertools import product
from time import clock
import sys
from java.lang import Math
sys.path.append("./ABAGAIL.jar")
import java.util.Random as Random
from shared import ConvergenceTrainer
from opt.example import FourPeaksEvaluationFunction
from opt.ga import DiscreteChan... | 34.214286 | 98 | 0.600128 | [
"BSD-3-Clause"
] | linqiao710/cs7641_a2_shared | jython/peaks4.py | 6,227 | Python |
# Copyright 2017 The TensorFlow 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 applica... | 40.05618 | 81 | 0.731136 | [
"Apache-2.0"
] | 252125889/tensorflow | tensorflow/contrib/boosted_trees/estimator_batch/trainer_hooks.py | 7,130 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.15.9
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... | 30.228188 | 124 | 0.60857 | [
"Apache-2.0"
] | playground-julia/kubernetes_asyncio | kubernetes_asyncio/client/models/v1beta2_deployment_strategy.py | 4,504 | Python |
from requests.exceptions import TooManyRedirects, ConnectionError
from raccoon_src.utils.web_server_validator import WebServerValidator
from raccoon_src.utils.exceptions import WAFException, WebServerValidatorException
from raccoon_src.utils.request_handler import RequestHandler
from raccoon_src.utils.coloring import C... | 37.34 | 125 | 0.605428 | [
"MIT"
] | IraqNoPhobia/Raccoon | raccoon_src/lib/waf.py | 5,601 | Python |
"""Tests for http/wsgi.py"""
import io
import asyncio
import socket
import unittest
from unittest import mock
import aiohttp
from aiohttp import multidict
from aiohttp import wsgi
from aiohttp import protocol
from aiohttp import helpers
class TestHttpWsgiServerProtocol(unittest.TestCase):
def setUp(self):
... | 37.512821 | 76 | 0.61338 | [
"Apache-2.0"
] | tumb1er/aiohttp | tests/test_wsgi.py | 11,704 | Python |
from django.shortcuts import render
| 13 | 36 | 0.794872 | [
"MIT"
] | Alshak/rdm | rdm/wrappers/interaction_views.py | 39 | Python |
try:
from django.conf.urls import patterns, url, include
except ImportError:
from django.conf.urls.defaults import patterns, url, include
| 29.2 | 64 | 0.767123 | [
"BSD-3-Clause"
] | brack3t/django-heythere | tests/compat.py | 146 | Python |
import os
from conans import ConanFile, CMake, tools
class XsimdTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
self.run(os.path.join("bi... | 21.352941 | 75 | 0.633609 | [
"MIT"
] | 0x8000-0000/conan-center-index | recipes/xsimd/all/test_package/conanfile.py | 363 | Python |
#!/usr/bin/python
import socket
import fcntl
import struct
import os
ip=socket.gethostbyname(socket.gethostname())
hostname=socket.gethostname()
#def get_ip_address(ifname):
# s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# return socket.inet_ntoa(fcntl.ioctl(
# s.fileno(),
# 0x8915, # S... | 23.222222 | 128 | 0.692185 | [
"Apache-2.0"
] | jmbarros/minicloud-auto | update_inventory.py | 627 | Python |
from django import forms
from vlabs import Config, AppManager
class VlabsForm(forms.Form):
def __init__(self, *args, **kwargs):
self.vlcg = Config()
self.market = self.vlcg.getmarket()
super(VlabsForm, self).__init__(*args, **kwargs)
self.k = None
self.nameoftheap... | 54 | 271 | 0.664048 | [
"MIT"
] | virtlabs/vlabs | webui/vlabs/vlabs/forms.py | 5,346 | Python |
# Copyright 2018-2021 Xanadu Quantum Technologies 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 applicabl... | 31.838926 | 94 | 0.697407 | [
"Apache-2.0"
] | AkashNarayanan/pennylane | pennylane/gradients/__init__.py | 9,488 | Python |
import pkg_resources
from anonlink import bloommatcher
from anonlink import entitymatch
from anonlink import network_flow
__version__ = pkg_resources.get_distribution('anonlink').version
__author__ = 'Stephen Hardy, Brian Thorne' | 28.875 | 64 | 0.848485 | [
"Apache-2.0"
] | luyang1210/PPRL | anonlink/__init__.py | 231 | Python |
import streamlit as st
import pandas as pd
from PIL import Image
import subprocess
import os
import base64
import pickle
# Molecular descriptor calculator
def desc_calc():
# Performs the descriptor calculation
bashCommand = "java -Xms2G -Xmx2G -Djava.awt.headless=true -jar ./PaDEL-Descriptor/PaDEL-Descriptor.j... | 37.783133 | 250 | 0.728954 | [
"MIT"
] | ferdinand-popp/BIDD | app.py | 3,136 | Python |
# Copyright 2019 The TensorFlow 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 applica... | 36.417808 | 80 | 0.61877 | [
"Apache-2.0"
] | 1250281649/tensorflow | tensorflow/lite/testing/op_tests/transpose_conv.py | 5,317 | Python |
# orm/query.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The Query class and support.
Defines the :class:`.Query` class, the central
constru... | 36.305412 | 84 | 0.594135 | [
"MIT"
] | slafs/sqlalchemy | lib/sqlalchemy/orm/query.py | 133,495 | Python |
#!/usr/bin/env python
# license removed for brevity
import rospy, tf, socket, sys, struct
from geometry_msgs.msg import PoseStamped
topic = "/mocap_client/ARBI/pose"
UDP_IP = "10.201.0.100"
UDP_PORT = 21444
def callback(data):
x = data.pose.position.x
y = data.pose.position.y
z = data.pose.position.z
... | 21.431818 | 54 | 0.663839 | [
"MIT"
] | alfalcmar/grvc-utils | mocap_bridge/scripts/mocap2udp.py | 943 | Python |
# Copyright (c) MONAI Consortium
# 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, so... | 39.753623 | 110 | 0.594969 | [
"Apache-2.0"
] | LarcoScarsa/MONAI | tests/test_patch_wsi_dataset.py | 5,486 | Python |
from currency_exchanger.currencies.models import Currency
from currency_exchanger.wallets.models import Wallet
from django.db import models
class Stock(models.Model):
symbol = models.CharField(max_length=10)
currency = models.ForeignKey(Currency, on_delete=models.CASCADE, related_name="stocks")
price = mo... | 34.025641 | 96 | 0.740769 | [
"MIT"
] | norbertcyran/currency-exchanger | backend/currency_exchanger/stocks/models.py | 1,327 | Python |
from datetime import date, datetime
from typing import Any, Dict, List, Literal, Optional
from pydantic import BaseModel, Field
class BadRequestResponse(BaseModel):
"""The client called the endpoint incorrectly."""
detail: str = Field(
...,
description="A human-readable summary of the client... | 25.84 | 68 | 0.668731 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Takuya-Miyazaki/ctms-api | ctms/schemas/web.py | 646 | Python |
import re
from epcpy.epc_schemes.base_scheme import EPCScheme
from epcpy.utils.common import ConvertException
from epcpy.utils.regex import BIC_URI
BIC_URI_REGEX = re.compile(BIC_URI)
class BIC(EPCScheme):
"""BIC EPC scheme implementation.
BIC pure identities are of the form:
urn:epc:id:bic:<BICcon... | 26.675676 | 75 | 0.694022 | [
"MIT"
] | nedap/retail-epcpy | epcpy/epc_schemes/bic.py | 987 | Python |
"""
Time series analysis functions.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------... | 37.576687 | 100 | 0.601102 | [
"BSD-3-Clause-Clear"
] | edilberto100/yt | yt/data_objects/time_series.py | 24,500 | Python |
from core.attack.attack import Attack
import random
import os
import re
import sys
import json
try:
from lxml import etree
except ImportError:
print("Failed to import ElementTree from any known place")
sys.exit(0)
try:
from bs4 import UnicodeDammit # BeautifulSoup 4
def decode_html(html_string):... | 51.17 | 189 | 0.496385 | [
"Apache-2.0"
] | qazbnm456/VWGen | core/attack/mod_unfilter.py | 10,234 | Python |
import os, os.path
import shutil
from play.utils import *
COMMANDS = ['idealize', 'idea']
HELP = {
'idealize': 'Create all IntelliJ Idea configuration files'
}
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
play_env = kargs.get("env")
ap... | 29.731707 | 189 | 0.607875 | [
"MIT"
] | ericlink/adms-server | playframework-dist/1.1-src/framework/pym/play/commands/intellij.py | 1,219 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 23 10:11:14 2018
@author: magalidrumare
@ copyright https://github.com/fchollet/deep-learning-with-python-notebooks
"""
# Use of a pre-trained convnet : VGG16
# An effective approach to deep learning on small image dataset is to leverage a pre-tr... | 37.22314 | 110 | 0.720693 | [
"MIT"
] | MagaliDrumare/How-to-learn-Keras-Deep-Learning-with-Python-book- | 08_PreTrainedConvNet.py | 4,505 | Python |
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import json
import os
"""
Using the plotter:
Call it from the command line, and supply it with logdirs to experiments.
Suppose you ran an experiment with name 'test', and you ran 'test' for 10
random seeds. The runner code stored it in the dir... | 28.616667 | 92 | 0.629004 | [
"MIT"
] | tiagokv/drlberkeley | hw2/plot.py | 3,434 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-02 22:29
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('database', '0037_auto_20170901_0917'),
]
operations = [
migrations.RenameModel(
... | 20.3 | 48 | 0.625616 | [
"MIT"
] | ACLARKNET/aclarknet-database | aclarknet/database/migrations/0038_auto_20170902_1829.py | 406 | Python |
print("Hello nader from python")
num = 101
if (num % 2) == 0:
print("{0} is Even number".format(num))
else:
print("{0} is Odd number".format(num))
| 17.444444 | 43 | 0.605096 | [
"MIT"
] | mickknutson/SITE_BOOTCAMP_QA | StudentWork/Nader/python/main.py | 157 | Python |
# Distributed under the MIT License.
# See LICENSE.txt for details.
from spectre.Visualization.GenerateXdmf import generate_xdmf
import spectre.Informer as spectre_informer
import unittest
import os
# For Py2 compatibility
try:
unittest.TestCase.assertRaisesRegex
except AttributeError:
unittest.TestCase.asse... | 38.672414 | 79 | 0.617477 | [
"MIT"
] | Ambrou/spectre | tests/Unit/Visualization/Python/Test_GenerateXdmf.py | 2,243 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Pint integration helpers
# (C) 2016 VRT Systems
#
from pint import UnitRegistry
HAYSTACK_CONVERSION = [
(u'_', ' '),
(u'°','deg'),
(u'per ', '/ '),
(u'per_h','per_hour'),
(u'... | 42.012766 | 82 | 0.474526 | [
"BSD-2-Clause"
] | clarsen/hszinc | hszinc/pintutil.py | 9,903 | Python |
""" .. _Line-api:
**Line** --- Spectral line metadata.
------------------------------------
This module defines the Line class for LINE entries in BDPs.
"""
# system imports
import xml.etree.cElementTree as et
# ADMIT imports
import bdp_types as bt
from UtilBase import UtilBase
class Line(UtilBase):
... | 29.813636 | 163 | 0.495197 | [
"MIT"
] | astroumd/admit | admit/util/Line.py | 6,559 | Python |
algorithm='hc'
env_class='UnityMLVector'
model_class='SingleLayerPerceptron'
environment = {
'name': 'compiled_unity_environments/Banana.app'
}
model = {
'state_size': 37,
'action_size': 4
}
agent = {
'action_size': 4,
'policy': 'stochastic'
}
train = {
'n_episodes': 2000,
'solve_score':... | 14.291667 | 52 | 0.629738 | [
"MIT"
] | danielnbarbosa/angela | cfg/unity/banana/banana_hc.py | 343 | Python |
from functools import partial
from typing import List, Optional, Sequence, cast
import dask.array as da
import dask.dataframe as dd
import numpy as np
import pandas as pd
from kartothek.core.typing import StoreFactory
from kartothek.io.dask.compression import pack_payload, unpack_payload_pandas
from kartothek.io_comp... | 35.301887 | 86 | 0.716195 | [
"MIT"
] | MartinHaffner/kartothek | kartothek/io/dask/_shuffle.py | 5,613 | Python |
from operator import ge
from typing import List, Optional, Tuple # Dict,
from fastapi import FastAPI, HTTPException, Depends, Query, status
from fastapi.templating import Jinja2Templates
from pathlib import Path
from fastapi import Request # , Response
# from fastapi.responses import JSONResponse
# from pymongo.comm... | 30.114583 | 88 | 0.672778 | [
"MIT"
] | owlsong/todoer | todoer_api/app/main.py | 5,782 | Python |
import json
from symro.src.automenu import Command
class SpecialCommand(Command):
def __init__(self,
symbol: str,
line_index: int = -1):
super(SpecialCommand, self).__init__()
self.symbol: str = symbol
self.line_index: int = line_index
def __str__(s... | 27.833333 | 66 | 0.559281 | [
"MIT"
] | ari-bou/symro | src/scripting/specialcommand.py | 835 | Python |
import os
import numpy as np
from keras import backend as K
from keras.losses import mean_absolute_error
import utils
from model import wdsr_b
def psnr(hr, sr, max_val=2):
mse = K.mean(K.square(hr - sr))
return 10.0 / np.log(10) * K.log(max_val ** 2 / mse)
def data_generator(path, batch_size=8, input_shap... | 26.066667 | 64 | 0.55925 | [
"MIT"
] | zhaipro/keras-wdsr | src/train.py | 1,173 | Python |
""" Git Branch Merge Target Model tests """
from django.test import TestCase
from django.test import Client
from django.conf import settings
from django.utils import timezone
from app.logic.gitrepo.models.GitProjectModel import GitProjectEntry
from app.logic.gitrepo.models.GitBranchModel import GitBranchEntry
from app... | 34.079545 | 98 | 0.679226 | [
"MIT"
] | imvu/bluesteel | app/logic/gitrepo/tests/tests_model_GitBranchMergeTargetModel.py | 2,999 | Python |
# Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import asyncio
import os
from decimal import Decimal
import random
import time
from typing import (Optional, Sequence, Tuple, List, Set, D... | 48.687807 | 185 | 0.632389 | [
"MIT"
] | jeroz1/electrum-ravencoin-utd | electrum/lnworker.py | 109,012 | Python |
# **********************************************************************************************************************
# **********************************************************************************************************************
# ****************************************************************************... | 42.9875 | 120 | 0.447223 | [
"MIT"
] | RosaliaTufano/rlgameauthors | CartPole/CartPole_RL-baseline_1k_episodes.py | 6,878 | Python |
from .base import *
from .visualization import *
from .guided_backprop import *
from .occlusion import *
from .integrated_gradients import *
from .grad_cam import *
from .xrai import *
from .blur_ig import *
| 23.111111 | 35 | 0.769231 | [
"Apache-2.0"
] | aliabd/history-of-interpretation | saliency/__init__.py | 208 | Python |
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""SQLAlchemy storage backend."""
import threading
from oslo_log import log
from oslo_config import cfg
from oslo_utils import uuidutils
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import enginefacade
from ... | 34.859213 | 93 | 0.632357 | [
"Apache-2.0"
] | MarioCarrilloA/fault | fm-rest-api/fm/fm/db/sqlalchemy/api.py | 16,837 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2015 Baidu, Inc. 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 o... | 31.069444 | 77 | 0.583818 | [
"Apache-2.0"
] | aiplat/bigflow | bigflow_python/python/bigflow/transform_impls/test/reduce_test.py | 2,237 | Python |
from io import BytesIO
from string import ascii_letters
from zipfile import ZipFile
import pytest
from openpyxl.chart import BarChart
from openpyxl.drawing.spreadsheet_drawing import SpreadsheetDrawing
from openpyxl import Workbook
from openpyxl.worksheet.table import Table
@pytest.fixture
def ExcelWriter():
fr... | 26.356164 | 103 | 0.685551 | [
"MIT"
] | sekcheong/openpyxl | openpyxl/writer/tests/test_excel.py | 3,848 | Python |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re, ast
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in accounting/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('accounting/__init__.... | 25.615385 | 65 | 0.72973 | [
"MIT"
] | gavindsouza/accounting-app | setup.py | 666 | Python |
from .ShuntCompensator import ShuntCompensator
class LinearShuntCompensator(ShuntCompensator):
'''
A linear shunt compensator has banks or sections with equal admittance values.
:bPerSection: Positive sequence shunt (charging) susceptance per section Default: 0.0
:gPerSection: Positive sequence shunt (charging) ... | 36 | 117 | 0.73374 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | CIM-IEC/CIMpy | cimpy/cgmes_v2_4_15/LinearShuntCompensator.py | 1,476 | Python |
# 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 agreed to in writing, software
#... | 31.870229 | 78 | 0.523593 | [
"Apache-2.0"
] | boris-42/rally | rally/plugins/openstack/context/magnum/cluster_templates.py | 4,175 | Python |
##########################################################################
# Author: Samuca
#
# brief: returns the int part of number
#
# this is a list exercise available on youtube:
# https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT-
###########################################################... | 36.705882 | 76 | 0.540064 | [
"MIT"
] | Samuca47prog/Python_exercises_CursoEmVideo | ex016.py | 624 | Python |
import os
import sys
import time
import random
import string
import argparse
import torch
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import torch.optim as optim
import torch.utils.data
import numpy as np
from utils import CTCLabelConverter, AttnLabelConverter, Averager
from dataset import hiera... | 47.62623 | 160 | 0.645257 | [
"MIT"
] | unanan/deep-text-recognition-benchmark-mnn-ncnn | train.py | 14,526 | Python |
# -*- coding: utf-8 -*-
# Copyright 2017, 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
"""
Quantum Tomography Module
Description:
This module contains functions for performing... | 36.681863 | 79 | 0.591025 | [
"Apache-2.0"
] | filemaster/qiskit-terra | qiskit/tools/qcvv/tomography.py | 37,012 | Python |
"""Test Pyvista camera parameters."""
import os
import numpy as np
import pyvista as pv
import nibabel as nb
FILE = "/home/faruk/data2/DATA_MRI_NIFTI/derived/sub-04/flattening/sub-04_ses-T2s_segm_rim_CS_LH_v02_borderized_multilaterate_perimeter_chunk_T2star_flat_400x400_voronoi.nii.gz"
OUTDIR = "/home/faruk/data2/DA... | 27.846154 | 177 | 0.654144 | [
"BSD-3-Clause"
] | ofgulban/meso-MRI | scripts/wip/anim-test_camera.py | 1,810 | Python |
from typing import List, TYPE_CHECKING
import numpy as np
import scipy.sparse
from qdrant_openapi_client.models.models import Distance
from docarray.math.helper import EPSILON
if TYPE_CHECKING:
from docarray.types import ArrayType
class QdrantStorageHelper:
@classmethod
def embedding_to_array(
... | 23.710526 | 56 | 0.662597 | [
"Apache-2.0"
] | fastflair/docarray | docarray/array/storage/qdrant/helper.py | 901 | Python |
#!/usr/bin/env python3
import torch
import torch.cuda.profiler as profiler
from apex import pyprof
class Foo(torch.jit.ScriptModule):
def __init__(self, size):
super(Foo, self).__init__()
self.n = torch.nn.Parameter(torch.ones(size))
self.m = torch.nn.Parameter(torch.ones(size))
@torc... | 21.53125 | 53 | 0.690856 | [
"BSD-3-Clause"
] | 58733511/apex | apex/pyprof/examples/jit/jit_script_method.py | 689 | Python |
from pathlib import Path
from typing import List, Optional, Dict, Union, Tuple, Literal, Sequence, Any
import fsspec
import numpy as np
from xarray import DataArray
from dataclasses import asdict, dataclass
import json
from ..io.mrc import mrc_to_dask
from ..io import read
import dask.array as da
import dacite
from xar... | 28.015564 | 147 | 0.659167 | [
"MIT"
] | trautmane/fibsem-tools | src/fibsem_tools/attrs/attrs.py | 7,200 | Python |
"""A dictionary of module names to pytype overlays.
Some libraries need custom overlays to provide useful type information. Pytype
has some built-in overlays, and additional overlays may be added to the overlays
dictionary. See overlay.py for the overlay interface and the *_overlay.py files
for examples.
Each entry in... | 38.25 | 80 | 0.800654 | [
"Apache-2.0"
] | gs-jackal/pytype | pytype/overlay_dict.py | 1,224 | Python |
from bottle import route, run, template
@route('/hello/<name>')
def index(name):
return template('<b>Hello {{name}}</b>!', name=name)
run(host='localhost', port=8080)
| 19.333333 | 56 | 0.66092 | [
"MIT"
] | axeldeveloper/codigos | python/hello_bottle.py | 174 | Python |
''' Natural language understanding model based on multi-task learning.
This model is trained on two tasks: slot tagging and user intent prediction.
Inputs: user utterance, e.g. BOS w1 w2 ... EOS
Outputs: slot tags and user intents, e.g. O O B-moviename ... O\tinform+moviename
Author : Xueson... | 57.956395 | 228 | 0.62853 | [
"MIT"
] | XuesongYang/end2end_dialog | SlotTaggingModel_multitask.py | 19,937 | Python |
'''
PipedImagerPQ is a graphics viewer application written in PyQt
that receives its images and commands primarily from another
application through a pipe. A limited number of commands are
provided by the viewer itself to allow saving and some manipulation
of the displayed image. The controlling application, however,... | 43.410734 | 103 | 0.587274 | [
"Unlicense"
] | Jhongesell/PyFerret | pviewmod/pipedimagerpq.py | 39,634 | Python |
from django.core.urlresolvers import reverse_lazy
from django.views import generic
from select2_many_to_many.forms import TestForm
from select2_many_to_many.models import TestModel
class UpdateView(generic.UpdateView):
model = TestModel
form_class = TestForm
template_name = 'select2_outside_admin.html'
... | 27.625 | 54 | 0.789593 | [
"MIT"
] | MyFinanceInc/django-autocomplete-light | test_project/select2_outside_admin/views.py | 442 | Python |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
from typing import List, Optional
from omegaconf import OmegaConf
from hydra.core.object_type import ObjectType
from hydra.plugins.config_source import ConfigLoadError, ConfigResult, ConfigSource
class FileConfigSource(ConfigSource):
... | 37.923077 | 88 | 0.627992 | [
"MIT"
] | MULXCODE/hydra | hydra/_internal/core_plugins/file_config_source.py | 2,465 | Python |
class SpaceAge(object):
ORBITAL_PERIOD = 31557600 # seconds
def __init__(self, seconds):
self.seconds = seconds
def on_mercury(self) -> float:
return round(self.seconds / float(self.ORBITAL_PERIOD) / 0.2408467, 2)
def on_venus(self) -> float:
return round(self.seconds / float... | 33.258065 | 79 | 0.659554 | [
"MIT"
] | PlugaruT/exercism-playground | python/space-age/space_age.py | 1,031 | Python |
#
# 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, software
# ... | 41.186813 | 78 | 0.564301 | [
"Apache-2.0"
] | HyunJin-Jeong/heat | heat/tests/test_support.py | 3,748 | Python |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by David O'Brien
# Copyright (c) 2017 David O'Brien
#
# License: MIT
#
"""Exports the Vcom plugin class."""
from SublimeLinter.lint import Linter
class Vcom(Linter):
"""Provides an interface to vcom (Mentor Model... | 43 | 120 | 0.503876 | [
"MIT"
] | dave2pi/SublimeLinter-contrib-vcom | linter.py | 2,064 | Python |
import paho.mqtt.client as mqtt
import time
import argparse
from tinydb import TinyDB, Query
from tinyrecord import transaction
import logging
import sys
import json
import threading
import ssl
from random import randint
CA_ROOT_CERT_FILE = "ag-certificate/AmazonRootCA1.pem"
THING_CERT_FILE = "ag-certificate/..."
THIN... | 32.068966 | 165 | 0.661022 | [
"MIT"
] | alexismarquet/MSE-TM-nRF9160 | application/AWS-ag.py | 3,720 | Python |
from Graphs import *
G1 = Graph(NodeSize=.2)
G1.addNode([-2,0])
G1.addNode([-2,1.3])
G1.addNode([-2.7,-1])
G1.addNode([-2.2,-2.3])
G1.addEdges([0,0,0,2],[1,2,3,3])
G2 = Graph(NodeSize=.2)
G2.addNode([-1,0])
G2.addNode([0,0])
G2.addNode([1,.5])
G2.addNode([2,-.5])
G2.addNode([-1.5,.5])
G2.addEdges([0,1,... | 20.377358 | 68 | 0.513889 | [
"MIT"
] | AlexanderFraebel/GraphDrawing | GraphProducts.py | 1,080 | Python |
# -*- coding: utf-8 -*-
"""
Doors
AOE rider
"""
# Adding to the system path is needed
# because no longer in parent directory
# and I want to run this file as a script
import sys, os
sys.path.append(os.path.abspath('../'))
import farmbot as fb
class Farmer_Doors(fb.Farmbot):
def __init__(self):
fb.Farmbot.__ini... | 23.637168 | 83 | 0.594534 | [
"MIT"
] | fryougi/farmbot | nodes/doors.py | 2,671 | Python |
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
def L1TCaloStage2ParamsForHW(process):
process.load("L1Trigger.L1TCalorimeter.caloStage2Params_HWConfig_cfi")
... | 52.863388 | 246 | 0.733151 | [
"Apache-2.0"
] | nistefan/cmssw | L1Trigger/Configuration/python/customiseReEmul.py | 19,348 | Python |
##################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2019 #
##################################################
from os import path as osp
from typing import List, Text
import torch
__all__ = ['change_key', 'get_cell_based_tiny_net', 'get_search_spaces', 'get_cifar_models', 'ge... | 50.790816 | 165 | 0.714917 | [
"MIT"
] | hyunghunny/AutoDL-Projects | nas201bench/models/__init__.py | 9,955 | Python |
# Tai Sakuma <tai.sakuma@gmail.com>
from __future__ import print_function
import os
import errno
import logging
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl import mkdir_p
##__________________________________________________________________||
@pytest.fixture... | 28.140351 | 70 | 0.741895 | [
"BSD-3-Clause"
] | shane-breeze/AlphaTwirl | tests/unit/misc/test_mkdir_p.py | 1,604 | Python |
import os, sys, re
import importlib
try:
from PySide.QtGui import *
from PySide.QtCore import *
except:
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from multi_script_editor import scriptEditor
importlib.reload(scriptEditor)
import MaxPlus
q3dsmax = QApp... | 27.486486 | 56 | 0.701082 | [
"MIT"
] | ReimuSG/NukeToolSet | python/pw_multiScriptEditor/managers/_3dsmax.py | 1,017 | Python |
# Copyright 2015, Google 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 copyright
# notice, this list of conditions and the f... | 42.324324 | 97 | 0.721485 | [
"BSD-3-Clause"
] | DiracResearch/grpc | src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py | 20,358 | Python |
"""
===========================================
Comparison of F-test and mutual information
===========================================
This example illustrates the differences between univariate F-test statistics
and mutual information.
We consider 3 features x_1, x_2, x_3 distributed uniformly over [0, 1], the
targ... | 32.94 | 97 | 0.676381 | [
"BSD-3-Clause"
] | NickVeld/scikit-learn-proj | examples/feature_selection/plot_f_test_vs_mi.py | 1,647 | Python |
"""
Tests utils for tagging.
"""
from django.template import Origin
from django.template.loaders.base import Loader
class VoidLoader(Loader):
"""
Template loader which is always returning
an empty template.
"""
is_usable = True
_accepts_engine_in_init = True
def get_template_sources(self,... | 23.555556 | 70 | 0.663522 | [
"BSD-3-Clause"
] | Fantomas42/django-tagging | tagging/tests/utils.py | 636 | Python |
from imdbclassifier.train_nn import KTrain
from imdbclassifier.parser_utils_nn import KParseArgs
from time import time
import sys
import os
# Hide warning messages
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
if __name__ == '__main__':
parser = KParseArgs()
args = parser.parse_args()
start_time = time()
... | 24.323529 | 66 | 0.688029 | [
"MIT"
] | mmm84766/ai-platform | tasks/natural-language-processing/sentiment-analysis/keras/imdbclassifier/main_nn.py | 827 | Python |
"""Unit tests for Tangent PCA."""
import geomstats.backend as gs
import geomstats.tests
from geomstats.geometry.spd_matrices import SPDMatrices, SPDMetricAffine
from geomstats.geometry.special_euclidean import SpecialEuclidean
from geomstats.geometry.special_orthogonal import SpecialOrthogonal
from geomstats.learning.... | 36.889764 | 75 | 0.691142 | [
"MIT"
] | SwastiKh/geomstats | tests/tests_geomstats/test_pca.py | 4,685 | Python |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import hashlib
import logging
import os
import re
import selectors
import threading
import time
from contextlib import closing
from pants.base.build_environment import get_buildroot
from ... | 40.470914 | 105 | 0.624298 | [
"Apache-2.0"
] | revl/pants | src/python/pants/java/nailgun_executor.py | 14,610 | Python |
import abc
import configparser
import json
import os
from typing import Any, Dict, Optional
from pystratum_backend.RoutineWrapperGeneratorWorker import RoutineWrapperGeneratorWorker
from pystratum_backend.StratumStyle import StratumStyle
from pystratum_common.Util import Util
class CommonRoutineWrapperGeneratorWorke... | 35.451087 | 120 | 0.496397 | [
"MIT"
] | DatabaseStratum/py-stratum-common | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | 6,523 | Python |
import sys
import psycopg2
import os
# Inicialização de parâmetros
database = os.environ['DATABASE_URL']
# Cria um banco de dados Postgres para armazenar informações, caso não exista.
def carregar_bd():
# Conecta ao banco de dados na URL especificada
connection = psycopg2.connect(database)
# Cria um curso... | 41.59009 | 105 | 0.490307 | [
"MIT"
] | felipedeoliveirarios/Atrix | database.py | 9,300 | Python |
"""
neuropredict : easy and comprehensive predictive analysis.
"""
from __future__ import print_function
__all__ = ['run', 'cli', 'get_parser']
import argparse
import os
import sys
import textwrap
import traceback
import warnings
import matplotlib
import matplotlib.pyplot as plt
from sys import version_info
from os.... | 43.069742 | 438 | 0.673227 | [
"MIT"
] | dinga92/neuropredict | neuropredict/run_workflow.py | 40,141 | Python |
from typing import Any, Callable, List, Optional, Tuple
import gym
import numpy as np
from tianshou.env.worker import EnvWorker
try:
import ray
except ImportError:
pass
class _SetAttrWrapper(gym.Wrapper):
def set_env_attr(self, key: str, value: Any) -> None:
setattr(self.env, key, value)
... | 30.365079 | 85 | 0.652378 | [
"MIT"
] | BIT-UAV-JJJ/tianshou | tianshou/env/worker/ray.py | 1,913 | Python |
"""
Base settings for jackergram project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import environ
ROOT_DIR = environ.Path(__file__) - 3 # (jackergram/confi... | 36.956522 | 101 | 0.627255 | [
"MIT"
] | jmk2729/jackergram | config/settings/base.py | 10,200 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.