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 numpy as np
from .transform import sph2vec, vec2sph
def angle_between(ang1, ang2, sign=True):
d = (ang1 - ang2 + np.pi) % (2 * np.pi) - np.pi
if not sign:
d = np.abs(d)
return d
def angdist(v1, v2, zenith=True):
if v1.shape[0] == 2:
v1 = sph2vec(v1, zenith=zenith)
if v2.sh... | 24.826087 | 53 | 0.535026 | [
"MIT"
] | Foztarz/insectvision | sphere/distance.py | 1,142 | Python |
# Copyright 2020 The Maritime Whale Authors. All rights reserved.
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE.txt file.
#
# Processes wind and vessel data. Performs simple analysis.
from match_wind_data import *
from datetime import *
from meet_and_pass import *
im... | 49.545161 | 80 | 0.560258 | [
"MIT"
] | maritime-whale/maritime-whale | src/process_maritime_data.py | 15,359 | Python |
import maya.mel as mm
import maya.cmds as mc
import glTools.utils.attribute
import glTools.utils.base
import glTools.utils.layer
import glTools.utils.reference
import glTools.utils.shader
import glTools.utils.shape
import glTools.utils.transform
import re
# ===========
# - Cleanup -
# ===========
def toggleCons(sta... | 25.851967 | 174 | 0.699916 | [
"MIT"
] | Lynn5160/glTools | utils/cleanup.py | 24,973 | Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from segmentation_models_pytorch.base import modules as md
class DecoderBlock(nn.Module):
def __init__(
self,
in_channels,
skip_channels,
out_channels,
use_batchnorm=True,
attention_type=None,
)... | 30.790323 | 96 | 0.587742 | [
"MIT"
] | navivokaj/segmentation_models.pytorch | segmentation_models_pytorch/decoders/unet/decoder.py | 3,818 | Python |
import random
import string
import os.path
import jsonpickle
import getopt
import sys
from model.contact import Contact
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["namber of group", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "/data/contacts.json"
for o, a ... | 44.588235 | 103 | 0.474934 | [
"Apache-2.0"
] | vdenPython/python_training | generator/contact.py | 2,274 | Python |
from ampel.t3.supply.load.T3SimpleDataLoader import T3SimpleDataLoader
from ampel.core.AmpelContext import AmpelContext
def test_instantiate(core_config, patch_mongo, ampel_logger):
"""
AbsT3Loader understands all the aliases in the ampel-core config
"""
ctx = AmpelContext.load(core_config)
aliase... | 34 | 70 | 0.677941 | [
"BSD-3-Clause"
] | mafn/Ampel-core | ampel/test/test_T3SimpleDataLoader.py | 680 | Python |
<<<<<<< HEAD
# Copyright 2015 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 requir... | 36.289256 | 80 | 0.751765 | [
"Apache-2.0"
] | devsangwoo/tensor | tensorflow/python/ops/data_flow_grad.py | 4,391 | Python |
# -*- coding: utf-8 -*-
from werkzeug.exceptions import abort as _abort, HTTPException
def abort(http_status_code, **kwargs):
try:
_abort(http_status_code)
except HTTPException as e:
if len(kwargs):
e.data = kwargs
raise
| 22.25 | 62 | 0.629213 | [
"MIT"
] | soasme/axe | axe/utils.py | 267 | Python |
import re
import numpy
import math
import sys
#implementing the stop words and
def extractCleanWords(review):
stopWords = ["in", "i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you",
"your", "yours", "yourself", "yourselves", "he", "him", "his", "himself", "she",
"her", "hers", "hers... | 39.654867 | 179 | 0.612512 | [
"MIT"
] | atahiraj/MLMovieReviewClassifier | NaiveBayesClassifier.py | 13,443 | Python |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: rack.py
@time: 2018-04-06 18:22
"""
from __future__ import unicode_literals
from datetime import datetime
from flask import (
request,
flash,
render_template,
url_for,
redirect,
abort,
jsonify,
Blu... | 29.418557 | 91 | 0.593146 | [
"MIT"
] | zhanghe06/bearing_project | app_backend/views/rack.py | 14,948 | Python |
import argparse
import logging
import os
import sys
from typing import Any
from typing import Optional
from typing import Sequence
from typing import Union
import pre_commit.constants as C
from pre_commit import color
from pre_commit import git
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.comm... | 35.384428 | 79 | 0.638864 | [
"MIT"
] | ModischFabrications/pre-commit | pre_commit/main.py | 14,543 | Python |
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.:wq
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" ... | 36.241379 | 106 | 0.610711 | [
"Apache-2.0"
] | AlanBinu007/deep-learning-containers | test/sagemaker_tests/mxnet/training/resources/mnist/horovod_mnist.py | 7,357 | Python |
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
allow_sliced_subqueries_with_in = False
can_introspect_autofield = True
can_introspect_small_integer_field = True
can_return_id_from_insert = True
can_use_chunked_reads = False
for_u... | 36.382353 | 65 | 0.800323 | [
"BSD-3-Clause"
] | dwasyl/django-mssql-backend | sql_server/pyodbc/features.py | 1,237 | Python |
import responses
from urllib.parse import urlencode
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
key = random_str()
secret = random_str()
asset... | 24.666667 | 81 | 0.737613 | [
"MIT"
] | 0x000050/binance-connector-python | tests/spot/margin/test_margin_asset.py | 888 | Python |
from collections import defaultdict
class RunningAverage:
"""
Computes exponential moving averages averages.
"""
def __init__(self, mix_rate: float = 0.95):
self.mix_rate = mix_rate
self.avgs = defaultdict(lambda: None)
def record(self, name: str, value: float, ignore_nan=True):
... | 30.851852 | 98 | 0.591837 | [
"Apache-2.0"
] | vzhong/wrangl | wrangl/metrics/running_avg.py | 833 | Python |
import argparse
import torch
from pathlib import Path
import h5py
import logging
from types import SimpleNamespace
import cv2
import numpy as np
from tqdm import tqdm
import pprint
from . import extractors
from .utils.base_model import dynamic_load
from .utils.tools import map_tensor
'''
A set of standard configurat... | 32.401914 | 79 | 0.562463 | [
"Apache-2.0"
] | oldshuren/Hierarchical-Localization | hloc/extract_features.py | 6,772 | Python |
class TokenNotFound(Exception):
"""
Indicates that a token could not be found in the database
"""
pass | 23.6 | 61 | 0.661017 | [
"MIT"
] | HenryYDJ/flaskAPI | backEnd/app/api/auth/exceptions.py | 118 | Python |
import os
import unittest
from telethon.tl import TLObject
from telethon.extensions import BinaryReader
class UtilsTests(unittest.TestCase):
@staticmethod
def test_binary_writer_reader():
# Test that we can read properly
data = b'\x01\x05\x00\x00\x00\r\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
... | 41.66129 | 105 | 0.593109 | [
"MIT"
] | Cafelipe/telethon | telethon_tests/utils_test.py | 2,583 | Python |
from antlr4 import *
class PlSqlBaseParser(Parser):
_isVersion10 = False
_isVersion12 = True
def isVersion10(self):
return self._isVersion10
def isVersion12(self):
return self._isVersion12
def setVersion10(self, value):
self._isVersion10 = value
def setVersion12(sel... | 20.222222 | 34 | 0.673077 | [
"Apache-2.0"
] | Pro-v-7/code-generation | js_production_rule_gen/grammars-v4-master/sql/plsql/Python3/PlSqlBaseParser.py | 364 | Python |
# Copyright The PyTorch Lightning 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 34.408046 | 103 | 0.719559 | [
"Apache-2.0"
] | sumanmichael/lightning-flash | tests/image/segmentation/test_model.py | 5,987 | Python |
from engine.steps.IStep import IStep
from keras.models import Model
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adam
class config_model(IStep):
"""config model"""
create_Optimizer_func = None
create_loss_func = None
def __init... | 33.28 | 89 | 0.654647 | [
"MIT"
] | Borrk/DeepLearning-Engine | source/engine/steps/config_model.py | 2,496 | Python |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowDomainQuotaResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | 27.247788 | 79 | 0.560247 | [
"Apache-2.0"
] | huaweicloud/huaweicloud-sdk-python-v3 | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | 3,079 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
from ppmessage.db.models import PredefinedScript
import json
import logging
class PPMovePr... | 30.843137 | 92 | 0.684043 | [
"MIT"
] | x-debug/ppmessage_fork | ppmessage/api/handlers/ppmovepredefinedscriptintogroup.py | 1,573 | Python |
_base_ = [
'../_base_/models/fcn_litehrxv3_no-aggregator.py', '../_base_/datasets/hrf_extra.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_step_40k_ml.py'
]
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='CascadeEncoderDecoder',
num_stages=2,
decode_head=[... | 35.695431 | 89 | 0.436576 | [
"Apache-2.0"
] | evgeny-izutov/mmsegmentation | configs/litehrnet/ocr_litehrxv3_split_aux-border_256x256_40k_hrf_amsoftmax.py | 7,032 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test spending coinbase transactions.
The coinbase transaction in block N can appear in block
N+100... ... | 40.719298 | 124 | 0.720379 | [
"MIT"
] | MonkeyD-Core/Nestcoin | test/functional/mempool_spend_coinbase.py | 2,321 | 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... | 39.608696 | 505 | 0.653128 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | 5,466 | Python |
from kaffe.tensorflow import Network
class GoogleNet(Network):
def setup(self):
(self.feed('data')
.conv(7, 7, 64, 2, 2, name='conv1_7x7_s2')
.max_pool(3, 3, 2, 2, name='pool1_3x3_s2')
.lrn(2, 2e-05, 0.75, name='pool1_norm1')
.conv(1, 1, 64, 1, 1, name='c... | 41.539683 | 72 | 0.531907 | [
"MIT"
] | 1989Ryan/Semantic_SLAM | Third_Part/PSPNet_Keras_tensorflow/caffe-tensorflow/examples/imagenet/models/googlenet.py | 7,851 | Python |
from time import sleep
from random import randint
numeros = []
def sorteio():
c = 0
while True:
n = randint(0, 20)
numeros.append(n)
c = c+1
if c == 5:
break
print('=-'*20)
print('SORTEANDO OS 5 VALORES DA LISTA:', end=' ')
for n in numeros:
slee... | 17.060606 | 59 | 0.50444 | [
"MIT"
] | joaoschweikart/python_projects | ex100 sorteio e soma.py | 563 | Python |
import os
import sys
import time
import _ollyapi
def addscriptpath(script):
"""
Add the path part of the scriptfile to the system path to
allow modules to be loaded from the same place.
Each path is added only once.
"""
pathfound = 0
scriptpath = os.path.dirname(script)
... | 28.071942 | 127 | 0.563557 | [
"BSD-3-Clause"
] | exported/ollypython | python/init.py | 3,902 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import *
from builtins import object
READS_LOCATION = 'genest... | 21.422222 | 54 | 0.698133 | [
"MIT"
] | genestack/python-client | genestack_client/unaligned_reads.py | 964 | Python |
import os
import multiprocessing
def num_cpus():
cpus = 0
try:
cpus = os.sysconf("SC_NPROCESSORS_ONLN")
except:
cpus = multiprocessing.cpu_count()
return cpus or 3
name = 'django'
bind = '0.0.0.0:8000'
workers = num_cpus() * 2 + 1
debug = True
daemon = False
loglevel = 'debug'
| 15.7 | 48 | 0.633758 | [
"MIT"
] | bradojevic/django-prod | gunicorn/gunicorn_config.py | 314 | Python |
"""The tests for the Script component."""
# pylint: disable=protected-access
import unittest
from unittest.mock import patch, Mock
from homeassistant.components import script
from homeassistant.components.script import DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_NAME, SERVICE_RELOAD, SERVICE_TOGG... | 29.544554 | 79 | 0.535188 | [
"Apache-2.0"
] | 27tech/home-assistant | tests/components/test_script.py | 8,952 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Flask-Resources is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
from werkzeug.datastructures import MIMEAccept
from werkzeug.http im... | 32.55618 | 88 | 0.72459 | [
"MIT"
] | fenekku/flask-resources | tests/test_content_negotiation.py | 5,795 | Python |
from setuptools import setup
setup(
name='expressvpn-python',
version='1.1',
packages=['expressvpn'],
install_requires=['Flask','flask_restful'],
url='https://github.com/philipperemy/expressvpn-python',
license='MIT',
author='Philippe Remy',
author_email='premy.enseirb@gmail.com',
d... | 25.928571 | 60 | 0.688705 | [
"MIT"
] | ezekri/expressvpn-python | setup.py | 363 | Python |
# The MIT License (MIT)
#
# Copyright (c) 2015-present, vn-crypto
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | 44.75 | 80 | 0.783719 | [
"MIT"
] | NovelResearchInvestment/vnpy_deribit | vnpy_deribit/__init__.py | 1,253 | Python |
# Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
#
# 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 applic... | 27.954023 | 74 | 0.704359 | [
"Apache-2.0"
] | iorchard/masakari-monitors | masakarimonitors/version.py | 2,432 | Python |
"""sukh_site_v1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... | 34.75 | 77 | 0.708633 | [
"MIT"
] | sbhuller98/main_django | sukh_site_v1/sukh_site_v1/urls.py | 834 | Python |
from selenium.webdriver.common.by import By
osd_sizes = ("512", "2048", "4096")
login = {
"ocp_page": "Overview · Red Hat OpenShift Container Platform",
"username": ("inputUsername", By.ID),
"password": ("inputPassword", By.ID),
"click_login": ("//button[text()='Log in']", By.XPATH),
"flexy_kubead... | 40.0125 | 88 | 0.6272 | [
"MIT"
] | keesturam/ocs-ci | ocs_ci/ocs/ui/views.py | 19,207 | Python |
"""
``name_index`` builds an inverted index mapping words to sets of Unicode
characters which contain that word in their names. For example::
>>> index = name_index(32, 65)
>>> sorted(index['SIGN'])
['#', '$', '%', '+', '<', '=', '>']
>>> sorted(index['DIGIT'])
['0', '1', '2', '3', '4', '5', '6', '... | 30.027778 | 77 | 0.572618 | [
"MIT"
] | eumiro/example-code-2e | 08-def-type-hints/charindex.py | 1,081 | Python |
from typing import Any, Dict, Mapping, Optional, Set
from pydantic import validator
from transformer.transformers.abstract import ExtraHashableModel, Transformer
from transformer.transformers.flatters import Flatter, FlatterConfig, Unflatter
class ReportMissingData(Exception):
def __init__(self, keys: Set[str])... | 40.4 | 117 | 0.661634 | [
"MIT"
] | santunioni/Transformer | transformer/transformers/map_keys.py | 4,040 | Python |
from warnings import simplefilter
simplefilter(action='ignore', category=FutureWarning)
import numpy as np
import argparse
import pandas as pd
from tqdm.auto import tqdm
from datetime import datetime
import seaborn as sns
import matplotlib.pyplot as plt
from utils.functions import compute_exact_tau, compute_exact_tau... | 47.784173 | 119 | 0.647094 | [
"MIT"
] | Mr8ND/ACORE-LFI | acore/classifier_power_multid_truth.py | 6,642 | Python |
"""
"""
# Created on 2016.08.09
#
# Author: Giovanni Cannata
#
# Copyright 2016, 2017 Giovanni Cannata
#
# This file is part of ldap3.
#
# ldap3 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 Software Foundat... | 32.714286 | 103 | 0.645261 | [
"MIT"
] | crav7/ProjectDjango | lib/python2.7/site-packages/ldap3/protocol/formatters/validators.py | 3,893 | Python |
import py
from ctypes import *
from support import BaseCTypesTestChecker
import os
import ctypes
signed_int_types = (c_byte, c_short, c_int, c_long, c_longlong)
unsigned_int_types = (c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong)
int_types = unsigned_int_types + signed_int_types
def setup_module(mod):
import ... | 32.980159 | 85 | 0.47395 | [
"MIT"
] | igormcoelho/neo-boa | idea2/pypyjs-3/deps/pypy/pypy/module/test_lib_pypy/ctypes_tests/test_bitfields.py | 8,311 | Python |
from __future__ import print_function, division
import logging
import numpy as np
from . import operators
from . import utils
from . import algorithms
def delta_data(A, S, Y, W=1):
return W*(A.dot(S) - Y)
def grad_likelihood_A(A, S, Y, W=1):
D = delta_data(A, S, Y, W=W)
return D.dot(S.T)
def grad_likelih... | 42.012048 | 226 | 0.652853 | [
"MIT"
] | herjy/proxmin | proxmin/nmf.py | 6,974 | Python |
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import Pool, cpu_count
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from tensorboardX import SummaryWriter
from torch.nn.utils.rnn import pad_sequence
from ... | 46.231527 | 227 | 0.58212 | [
"Apache-2.0"
] | AliOsm/simpletransformers | simpletransformers/seq2seq/seq2seq_model.py | 46,925 | Python |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTest(TestCase):
def test_create_user_with_email_successful(self):
"""이메일로 유저 생성을 성공하는 테스트"""
email = 'test@testemail.com'
password = 'testpassword'
user = get_user_model().objects.create_use... | 30.65 | 71 | 0.644372 | [
"MIT"
] | jacobjlee/simple-shopping | shoppingmall/core/tests/test_models.py | 1,352 | Python |
# Generated by Django 2.1.2 on 2019-02-05 08:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0038_merge_20190203_1423'),
('core', '0039_auto_20190205_0609'),
]
operations = [
]
| 17.866667 | 47 | 0.641791 | [
"MIT"
] | metabolism-of-cities/ARCHIVED-metabolism-of-cities-platform-v3 | src/core/migrations/0040_merge_20190205_0807.py | 268 | Python |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Entry point for both build and try bots.
This script is invoked from XXX, usually without arguments
to package an SDK. It autom... | 34.692611 | 80 | 0.692386 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | davgit/chromium.src | native_client_sdk/src/build_tools/build_sdk.py | 35,213 | Python |
# Copyright (c) 2016, 2020, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# ... | 31.034286 | 80 | 0.643528 | [
"MIT"
] | Abdullah9340/Geese-Migration | backend/env/Lib/site-packages/mysqlx/authentication.py | 5,431 | Python |
from os.path import realpath
def main():
inpString = open(f'{realpath(__file__)[:-2]}txt').read()
inpString += '0' * (3 - len(inpString) % 3) # Padding to make it divisible by 3
inp = list(inpString)
for i in range(len(inp)):
if inp[i] not in '0123456789abcdef':
inp[i] = ... | 23.956522 | 105 | 0.53539 | [
"MIT"
] | PROxZIMA/AquaQ-Challenge-Hub | 01/01.py | 551 | Python |
from bughunter.action.core import *
import cgum.statement
class ModifyAssignment(ReplaceRepairAction):
@staticmethod
def from_json(jsn, before, after):
return ReplaceRepairAction.from_json(ModifyAssignment, jsn, before, after)
@staticmethod
def detect(patch, stmts_bef, stmts_aft, actions):
... | 35.254545 | 86 | 0.596699 | [
"MIT"
] | ChrisTimperley/BugCollector | bughunter/action/assignment.py | 3,878 | Python |
# This file is part of postcipes
# (c) Timofey Mukha
# The code is released under the MIT Licence.
# See LICENCE.txt and the Legal section in the README for more information
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .postcipe import Postci... | 33.707483 | 79 | 0.52775 | [
"MIT"
] | Mopolino8/postcipes | postcipes/bfs.py | 4,955 | Python |
from django.contrib import admin
from .models import Post, Reply
# Register your models here.
admin.site.register(Post)
admin.site.register(Reply)
| 18.625 | 32 | 0.791946 | [
"MIT"
] | EvanPatrick423/Showcase | showcase/post/admin.py | 149 | Python |
from gym_pybullet_drones.envs.multi_agent_rl.BaseMultiagentAviary import BaseMultiagentAviary
from gym_pybullet_drones.envs.multi_agent_rl.FlockAviary import FlockAviary
from gym_pybullet_drones.envs.multi_agent_rl.LeaderFollowerAviary import LeaderFollowerAviary
from gym_pybullet_drones.envs.multi_agent_rl.MeetupAviar... | 83.4 | 93 | 0.918465 | [
"MIT"
] | MFadhilArkan/gym-pybullet-drones | gym_pybullet_drones/envs/multi_agent_rl/__init__.py | 417 | Python |
from setuptools import find_packages, setup
with open('README.md', 'r') as readme:
long_description = readme.read()
setup(
name='ba_samples',
package_dir={"": "src"},
packages=find_packages('src'),
version='0.1.0-dev0',
description='Examples using ArcGIS Business Analyst with Python.',
lon... | 25.375 | 70 | 0.684729 | [
"Apache-2.0"
] | knu2xs/business-analyst-python-api-examples | setup.py | 406 | Python |
# Listing_19-1.py
# Copyright Warren & Carter Sande, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# Trying out sounds in Pygame
import pygame
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode([640,480... | 30.086957 | 82 | 0.628613 | [
"Apache-2.0"
] | axetang/AxePython | FatherSon/HelloWorld2_source_code/Listing_19-1.py | 692 | Python |
"""
With these settings, tests run faster.
"""
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",
default="4UWuZDCfH... | 33.857143 | 80 | 0.510549 | [
"MIT"
] | aightmunam/portfolio | config/settings/test.py | 1,422 | Python |
import copy
from functools import wraps
import numpy as np
import wandb
import torchvision
import torch
import torch.nn.functional as F
from kornia import enhance, filters
from torchvision.transforms import RandomApply, RandomChoice
from atariari.methods.utils import EarlyStopping
from torch import nn
from torch.u... | 34.246914 | 244 | 0.620944 | [
"MIT"
] | mariodoebler/byol-pytorch | byol_pytorch/byol_pytorch.py | 11,096 | Python |
# SPDX-License-Identifier: MIT
#!/usr/bin/env python3
import os
import sys
from ply import yacc
from ply.lex import TOKEN
from .slexer import SLexer
from ..lib import dbg
from .symbol import (
BinaryOperatorSymbol, ConstraintSymbol, FieldSymbol, ArraySymbol,
CallSymbol, IDSymbol, ConcreteIntSymbol, StringLitera... | 35.005848 | 109 | 0.538423 | [
"MIT"
] | oslab-swrc/apisan | analyzer/apisan/parse/sparser.py | 5,986 | Python |
""" StreamSort Projects Extension -- Constants
Copyright (c) 2021 IdmFoundInHim, under MIT License
"""
SINGLE_MAX_MS = 15 * 60 * 1000
SINGLE_MAX_TRACKS = 4
| 22.571429 | 51 | 0.740506 | [
"MIT"
] | IdmFoundInHim/streamsort | projects/constants.py | 158 | Python |
# -*- coding: utf-8 -*-
""" XIO plugin for the minicbf format of images (DECTRIS-PILATUS).
"""
__version__ = "0.2.1"
__author__ = "Pierre Legrand (pierre.legrand@synchrotron-soleil.fr)"
__date__ = "23-09-2012"
__copyright__ = "Copyright (c) 2009-2012 Pierre Legrand"
__license__ = "New BSD, http://www.opensource.org/l... | 40.172662 | 103 | 0.566082 | [
"BSD-3-Clause"
] | harumome/kamo | yamtbx/dataproc/XIO/plugins/minicbf_interpreter.py | 5,584 | Python |
from src.model import unpool_resize,unpool_deconv, unpool_checkerboard, unpool_simple
from tensorflow.keras.layers import Input, UpSampling2D
from tensorflow.keras.models import Model
input = Input(shape=(20, 20, 3))
out1 = unpool_resize(input)
model1 = Model(inputs=input, outputs=out1)
print("")
out2 = unpool_decon... | 25.4 | 85 | 0.769685 | [
"MIT"
] | rcmalli/polimi-dl-project | tools/unpool_test.py | 508 | Python |
# -*- coding: utf-8 -
#
# This file is part of gaffer. See the NOTICE for more information.
import os
import sys
from setuptools import setup, find_packages, Extension
py_version = sys.version_info[:2]
if py_version < (2, 6):
raise RuntimeError('On Python 2, Gaffer requires Python 2.6 or better')
CLASSIFIERS ... | 28.333333 | 75 | 0.6 | [
"MIT",
"Unlicense"
] | mikiec84/gaffer | setup.py | 2,125 | Python |
#!/usr/bin/env 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 "Licen... | 37.892396 | 78 | 0.613381 | [
"Apache-2.0"
] | Verizon/libcloud | demos/gce_demo.py | 26,411 | Python |
from django.shortcuts import render
from django.http import JsonResponse
from django.core.files.storage import FileSystemStorage
import requests
# Create your views here.
def cnn(request):
return render(request, 'CNN/cnn.html')
def change(request):
##########################################################... | 32.59375 | 83 | 0.568552 | [
"MIT"
] | suyongeum/PML | CNN/views.py | 1,043 | Python |
"""
Compatibility tools for differences between Python 2 and 3
"""
import functools
import itertools
import sys
import urllib
PY3 = (sys.version_info[0] >= 3)
PY3_2 = sys.version_info[:2] == (3, 2)
if PY3:
import builtins
from collections import namedtuple
from io import StringIO, BytesIO
import inspe... | 24.766917 | 79 | 0.611718 | [
"BSD-3-Clause"
] | Aziiz1989/statsmodels | statsmodels/compat/python.py | 6,588 | Python |
from vektonn import Vektonn
from vektonn.dtos import Attribute, AttributeValue, Vector, InputDataPoint, SearchQuery
vektonn_client = Vektonn('http://localhost:8081')
input_data_points = [
InputDataPoint(
attributes=[
Attribute(key='id', value=AttributeValue(int64=1)),
Attribute(key... | 36.727273 | 107 | 0.668812 | [
"Apache-2.0"
] | vektonn/vektonn-examples | quick-start/python/quick-start.py | 2,020 | Python |
from rest_framework.permissions import SAFE_METHODS, BasePermission
from artists.models import Artists
class IsAuthenticatedAndIsOwner(BasePermission):
message = "current user not matching user trying to update user"
def has_object_permission(self, request, view, obj):
if request.method in SAFE_MET... | 31.842105 | 68 | 0.659504 | [
"MIT"
] | KeserOner/where-artists-share | was/permissions.py | 605 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# License: MIT. See LICENSE
# import frappe
from frappe.model.document import Document
class WebPageBlock(Document):
pass
| 19 | 58 | 0.741627 | [
"MIT"
] | 15937823/frappe | frappe/website/doctype/web_page_block/web_page_block.py | 209 | Python |
INFO_PREFIX = "> [ info ] "
ERROR_PREFIX = "> [warning] "
WARNING_PREFIX = "> [ error ] "
INPUT_KEY = "input"
LATENT_KEY = "latent"
PREDICTIONS_KEY = "predictions"
LABEL_KEY = "labels"
SQLITE_FILE = "sqlite.db"
| 19.454545 | 31 | 0.668224 | [
"MIT"
] | carefree0910/carefree-learn-deploy | cflearn_deploy/constants.py | 214 | Python |
from builtins import range
from builtins import object
import numpy as np
from past.builtins import xrange
class KNearestNeighbor(object):
""" a kNN classifier with L2 distance """
def __init__(self):
pass
def train(self, X, y):
"""
Train the classifier. For k-nearest neighbors t... | 47.392473 | 112 | 0.473511 | [
"MIT"
] | Michellemingxuan/stanford_cs231n | assignments/2021/assignment1/cs231n/classifiers/k_nearest_neighbor.py | 8,815 | Python |
# Copyright 2016 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 applicab... | 34.954955 | 91 | 0.620619 | [
"Apache-2.0"
] | jdavidagudelo/tensorflow-models | research/cognitive_mapping_and_planning/datasets/factory.py | 3,880 | Python |
import pandas as pd
import numpy as np
def gloriosafuncao(df):
df = pd.DataFrame([df])
numerico = [
11, "email", 1, 2, 3, 7,
8, 9, 12, 10, 13, 14,
15, 16, 17, 18, 19, 20, 21, 4, 5, 6
]
df.columns = numerico
labels = [
'email',
'PPI',
'ProgramasSo... | 27.72 | 79 | 0.553535 | [
"MIT"
] | willidert/aux_est_micro | data-clean/clean.py | 6,947 | Python |
# -*- coding: utf-8 -*-
# Copyright 2020-2022 CERN
#
# 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... | 33.542328 | 139 | 0.713621 | [
"Apache-2.0"
] | R-16Bob/rucio | lib/rucio/tests/conftest.py | 12,679 | Python |
# -*- coding: utf-8 -*-
"""
Copyright © 2019-present Lenovo
This file is licensed under both the BSD-3 license for individual/non-commercial use and
EPL-1.0 license for commercial use. Full text of both licenses can be found in
COPYING.BSD and COPYING.EPL files.
"""
import time
from copy import deepcopy
from fnmatch... | 28.385928 | 88 | 0.580335 | [
"EPL-1.0",
"BSD-3-Clause"
] | CarrotXin/Antilles | antilles-core/openHPC_web_project/tests/user/mock_libuser.py | 13,314 | Python |
# Generated by Django 1.11.24 on 2019-10-16 22:48
from typing import Any, Set, Union
import ujson
from django.conf import settings
from django.contrib.auth.hashers import check_password, make_password
from django.db import migrations
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db... | 48.73913 | 97 | 0.692507 | [
"Apache-2.0"
] | Bpapman/zulip | zerver/migrations/0209_user_profile_no_empty_password.py | 11,210 | Python |
from pyspark import SparkContext, SparkConf
def isNotHeader(line: str):
return not (line.startswith("host") and "bytes" in line)
if __name__ == "__main__":
conf = SparkConf().setAppName("unionLogs").setMaster("local[*]")
sc = SparkContext(conf = conf)
julyFirstLogs = sc.textFile("in/nasa_19950701.tsv... | 31.7 | 73 | 0.733438 | [
"MIT"
] | shubozhang/pyspark-tutorial | rdd/nasaApacheWebLogs/UnionLogSolutions.py | 634 | Python |
from flask import g
import logging
from datetime import datetime
import config
def get_logger(name):
# type: (str) -> logging.Logger
logging.basicConfig()
logger = logging.getLogger(name)
logger.setLevel(config.GLOBAL_LOGGING_LEVEL)
ch = logging.StreamHandler()
ch.setLevel(config.GLOBAL_LOGGING_LEVEL)
fo... | 26.4 | 87 | 0.715909 | [
"Apache-2.0"
] | Bhaskers-Blu-Org1/long-way-home-callforcode | app_util.py | 792 | Python |
# coding: utf-8
"""
TheTVDB API v2
API v3 targets v2 functionality with a few minor additions. The API is accessible via https://api.thetvdb.com and provides the following REST endpoints in JSON format. How to use this API documentation ---------------- You may browse the API routes without authentication... | 30.928571 | 2,040 | 0.591132 | [
"MIT"
] | h3llrais3r/tvdb_api | tvdb_api/models/movie.py | 10,825 | Python |
import math
import gym
from gym import spaces, logger
from gym.utils import seeding
import numpy as np
class CartPoleEnv(gym.Env):
"""
Description:
A pole is attached by an un-actuated joint to a cart, which moves along a frictionless track. The pendulum starts upright, and the goal is to prevent it fr... | 39.72973 | 245 | 0.593424 | [
"MIT"
] | takuseno/configurable-control-gym | configurable_control_gym/envs/cartpole.py | 8,820 | Python |
from odoo import models, api
class AccountUnreconcile(models.TransientModel):
_name = "account.unreconcile"
_description = "Account Unreconcile"
def trans_unrec(self):
context = dict(self._context or {})
if context.get('active_ids', False):
self.env['account.move.line'].browse... | 32.846154 | 99 | 0.686183 | [
"MIT"
] | LucasBorges-Santos/docker-odoo | odoo/base-addons/account/wizard/account_unreconcile.py | 427 | Python |
# Copyright (c) 2015 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditi... | 40.605263 | 71 | 0.755023 | [
"BSD-2-Clause"
] | 1M15M3/yubikey-manager | ykman/__init__.py | 1,543 | Python |
#
# Spec2Vec
#
# Copyright 2019 Netherlands eScience Center
#
# 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... | 37.783688 | 103 | 0.57114 | [
"Apache-2.0"
] | matchms/old-iomega-spec2vec | matchms/old/ms_similarity_classical.py | 21,310 | Python |
from leapp.models import Model, fields
from leapp.topics import BootPrepTopic, SystemInfoTopic
from leapp.utils.deprecation import deprecated
class DracutModule(Model):
"""
Specify a dracut module that should be included into the initramfs
The specified dracut module has to be compatible with the target ... | 36.112903 | 87 | 0.724654 | [
"Apache-2.0"
] | JohnKepplers/leapp-repository | repos/system_upgrade/common/models/initramfs.py | 4,478 | Python |
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.colorimetry.luminance` module.
"""
import numpy as np
import unittest
from colour.colorimetry import (
luminance_Newhall1943, intermediate_luminance_function_CIE1976,
luminance_CIE1976, luminance_ASTMD1535, luminance_Fairchild2010,
lu... | 32.215071 | 79 | 0.620194 | [
"BSD-3-Clause"
] | colour-science/colour | colour/colorimetry/tests/test_luminance.py | 20,521 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2021. All Rights Reserved.
""" setup.py for resilient-circuits Python module """
import io
from os import path
from setuptools import find_packages, setup
this_directory = path.abspath(path.dirname(__file__))
with io.open(path.join(this_... | 31.676923 | 102 | 0.63186 | [
"MIT"
] | ibmresilient/resilient-python-api | resilient-circuits/setup.py | 2,059 | Python |
import pyglet
class Resources:
# --- Player Parameters ---
player_animation_started = False
player_images = []
player_animation_time = 1. / 9.
player_animation_index = 0
# --- Obstacle Parameters ---
obstacle_images = []
# --- Player Methods ---
# loads the images neede... | 36.211538 | 108 | 0.698885 | [
"MIT"
] | lukDev/dinosaur | src/dinosaur/game/resources.py | 1,883 | Python |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | 43.527778 | 117 | 0.686662 | [
"Apache-2.0"
] | saravanpa-aot/sbc-auth | queue_services/business-events-listener/src/business_events_listener/worker.py | 6,269 | Python |
##############################################################################
# Copyright 2019 Parker Berberian and Others #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# yo... | 47.150943 | 78 | 0.502201 | [
"Apache-2.0"
] | opnfv/laas-reflab | laas/tests/test_action_get_task_list.py | 2,499 | Python |
from datetime import date
import pytest
from dateutil.parser import parse as dt_parse
from freezegun import freeze_time
from app.models.alert_date import AlertDate
def test_AlertDate_properties():
sample_datetime = dt_parse('2021-03-02T10:30:00Z')
alerts_date = AlertDate(sample_datetime)
assert alerts_d... | 43.196721 | 81 | 0.696395 | [
"MIT"
] | alphagov/notifications-govuk-alerts | tests/app/models/test_alert_date.py | 2,635 | Python |
# Copyright 2018 Google 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 29.336538 | 132 | 0.57839 | [
"Apache-2.0"
] | Dileepbodapati/cloud-foundation-toolkit | dm/templates/external_load_balancer/external_load_balancer.py | 9,153 | Python |
#python exceptions let you deal with
#unexpected results
try:
print(a) #this will throw an exception since a is not found
except:
print("a is not defined!")
#there are specific errors in python
try:
print(a) #this will throw a NameError
except NameError:
print("a is still not defined")
except:
print("Somethin... | 21.210526 | 61 | 0.744417 | [
"MIT"
] | Adriantsh/astr-119 | exceptions.py | 403 | Python |
"""
.. autoclass:: ppci.arch.arch.Architecture
:members:
.. autoclass:: ppci.arch.arch_info.ArchInfo
:members:
.. autoclass:: ppci.arch.arch.Frame
:members:
.. autoclass:: ppci.arch.isa.Isa
:members:
.. autoclass:: ppci.arch.registers.Register
:members: is_colored
.. autoclass:: ppci.arch.e... | 23.4 | 74 | 0.618803 | [
"BSD-2-Clause"
] | darleybarreto/ppci-mirror | ppci/arch/__init__.py | 1,755 | Python |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | 22.078947 | 174 | 0.684148 | [
"Apache-2.0"
] | AndreasA/openapi-generator | samples/openapi3/client/petstore/python-experimental/test/test_composed_bool.py | 839 | Python |
from warnings import warn
from functools import partial
from tqdm import tqdm
import torch
import numpy as np
from torch.optim import Adam
from torch.nn import MSELoss
from odl.contrib.torch import OperatorModule
from dival.reconstructors import IterativeReconstructor
from dival.reconstructors.networks.unet import U... | 37.382022 | 79 | 0.585512 | [
"MIT"
] | MBaltz/dival | dival/reconstructors/dip_ct_reconstructor.py | 6,654 | Python |
"""
PAIPASS Oauth2 backend
"""
import re
from .oauth import BaseOAuth2
from ..utils import handle_http_errors, url_add_parameters
from ..exceptions import AuthCanceled, AuthUnknownError
class PaipassOAuth2(BaseOAuth2):
"""Facebook OAuth2 authentication backend"""
name = "paipass"
ID_KEY = "email"
... | 38.898551 | 80 | 0.634128 | [
"BSD-3-Clause"
] | everchain-ontech/social-core | social_core/backends/paipass.py | 2,684 | Python |
"""ConnManagerMQTT containing script"""
import _thread
import time
import random
import logging
from .uconn_mqtt import UConnMQTT
from . import exceptions
class ConnManagerMQTT(object):
"""
UconnMQTT wrapper that guarantee delivery to addressee
"""
_SENDER = 'sender'
_DESTINATION = 'destination'
... | 35.024194 | 99 | 0.588994 | [
"Apache-2.0"
] | connax-utim/uhost-micropython | utilities/connmanagermqtt.py | 4,343 | Python |
from typing import Tuple
import torch as th
import torch.nn as nn
from torchvision import transforms
from autoencoding_rl.latent_extractors.autoencoder.SimpleEncoder import SimpleEncoder
from autoencoding_rl.latent_extractors.autoencoder.SimpleDecoder import SimpleDecoder
from autoencoding_rl.utils import Transition... | 57.654321 | 287 | 0.678051 | [
"MIT"
] | c-rizz/autoencoding_rl | src/autoencoding_rl/latent_extractors/dyn_autoencoder/DynAutoencoder.py | 9,340 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 10 18:18:26 2021
@author: Paolo Cozzi <paolo.cozzi@ibba.cnr.it>
"""
import click
import logging
import datetime
from pathlib import Path
from mongoengine.errors import DoesNotExist
from src import __version__
from src.data.common import WORKING_... | 23 | 68 | 0.707246 | [
"MIT"
] | cnr-ibba/SMARTER-database | src/data/update_db_status.py | 1,380 | Python |
from django import forms
class LoginForm(forms.Form):
username = forms.CharField(widget=forms.TextInput())
password = forms.CharField(widget=forms.PasswordInput(render_value=False)) | 39.2 | 79 | 0.760204 | [
"MIT"
] | X-ELE/DjangoSales | DjangoSales/apps/users/forms.py | 196 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.