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 |
|---|---|---|---|---|---|---|---|---|
# Generated by Django 2.2.13 on 2020-09-16 14:47
# Third-party
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("licenses", "0004_auto_20200902_1302"),
]
operations = [
migrations.AlterUniqueTogether(
name="translatedlicensename",
... | 22.310345 | 48 | 0.582689 | [
"MIT"
] | Cronus1007/cc-licenses | licenses/migrations/0005_auto_20200916_1047.py | 647 | Python |
from backpack.core.derivatives.linear import LinearDerivatives
from backpack.extensions.curvmatprod.hmp.hmpbase import HMPBase
class HMPLinear(HMPBase):
def __init__(self):
super().__init__(derivatives=LinearDerivatives(), params=["weight", "bias"])
def weight(self, ext, module, g_inp, g_out, backpro... | 32.875 | 87 | 0.66635 | [
"MIT"
] | f-dangel/backpack | backpack/extensions/curvmatprod/hmp/linear.py | 1,052 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 52.675 | 232 | 0.67427 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2019_06_01_preview/aio/operations/_agent_pools_operations.py | 33,712 | Python |
import dis
import unittest
from test.support.bytecode_helper import BytecodeTestCase
def count_instr_recursively(f, opname):
count = 0
for instr in dis.get_instructions(f):
if instr.opname == opname:
count += 1
if hasattr(f, '__code__'):
f = f.__code__
for c in f.co_consts... | 38.88447 | 91 | 0.534217 | [
"BSD-3-Clause"
] | Froggo8311/brython | www/src/Lib/test/test_peepholer.py | 20,531 | Python |
import pytest
import subprocess
from Browser.assertion_engine import AssertionOperator
@pytest.fixture()
def application_server():
process = subprocess.Popen(
["node", "./node/dynamic-test-app/dist/server.js", "7272"]
)
yield
process.terminate()
@pytest.fixture()
def browser(monkeypatch):
... | 22.153846 | 72 | 0.710648 | [
"Apache-2.0"
] | emanlove/robotframework-browser | utest/test_python_usage.py | 867 | Python |
import sys
import os
import shutil
import zipfile
'''
Author: Benny Megidish
Description: This program extracts all the drawing, image and 3D design files out of an 123dx file
Arguments naming conventions is used like in java (camelCase)
'''
numOfFileExtracted = 0
def _extract... | 34.325581 | 113 | 0.634598 | [
"MIT"
] | bennymeg/123-Fusion | fusion123/converter.py | 4,428 | Python |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def sumOfLeftLeaves(self, root):
"""
:type root: TreeNode
:rtype: int
"""
while not root:
... | 29.105263 | 81 | 0.587703 | [
"MIT"
] | Apocrypse/LeetCode | Python/404sum_of_left_leaves.py | 553 | Python |
# Copyright (c) 2010 Chris Moyer http://coredumped.org/
#
# 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, modify, ... | 33.393939 | 92 | 0.609256 | [
"Apache-2.0"
] | 10088/hue | desktop/core/ext-py/boto-2.46.1/boto/ecs/item.py | 5,510 | Python |
# -*- coding: utf-8 -*-
"""DNACenterAPI topology API fixtures and tests.
Copyright (c) 2019 Cisco and/or its affiliates.
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, inclu... | 26.531746 | 95 | 0.747981 | [
"MIT"
] | wastorga/dnacentersdk | tests/api/v1_3_1/test_topology.py | 6,686 | Python |
# Copyright (c) 2020 Huawei Technologies Co., Ltd
# Copyright (c) 2019, Facebook CORPORATION.
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/lice... | 37.474359 | 108 | 0.660965 | [
"BSD-3-Clause"
] | Ascend/pytorch | test/test_npu/test_network_ops/test_tril.py | 2,923 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 46.82218 | 175 | 0.671798 | [
"MIT"
] | acured/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_10_01/operations/public_ip_prefixes_operations.py | 24,488 | Python |
# -*- coding:utf8 -*-
# File : env.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 12/29/16
#
# This file is part of TensorArtist.
from ...core import get_logger
from ...core.event import EventManager, register_event, trigger_event
from ...core.utils.meta import notnone_property
from ..graph.en... | 29.096774 | 103 | 0.661863 | [
"MIT"
] | cosmic119/DiscoGAN | TensorArtist/tartist/nn/train/env.py | 2,706 | Python |
"""Tcp client for synchronous uhd message tcp port"""
import threading
import Queue
import time
import socket
import struct
import numpy as np
class _TcpSyncClient(threading.Thread):
"""Thead for message polling"""
queue = Queue.Queue()
q_quit = Queue.Queue()
ip_address = None
port = None
de... | 29.850877 | 101 | 0.566265 | [
"MIT"
] | Opendigitalradio/ODR-StaticPrecorrection | src/tcp_sync.py | 3,403 | Python |
import tensorflow as tf
def dense_value_graph(inputs, activation_fn=tf.nn.tanh, scope='value_graph', reuse=None):
with tf.variable_scope(scope, reuse=reuse):
net = inputs
net = tf.contrib.layers.flatten(net)
net = tf.layers.dense(net, 64, activation=activation_fn)
net = tf.layers.d... | 34.307692 | 89 | 0.686099 | [
"MIT"
] | apparatusbox/rlbox | rlbox/models/value_graphs.py | 446 | Python |
#!/usr/bin/env python3
# Packet MAC Sniffer
# Author Yehia Elghaly
import socket
import textwrap
import struct
from colorama import Fore, Back, Style
def main():
connection = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(3))
while True:
read_data, addr = connection.recvfrom(65536)
send_mac, recv... | 31.423077 | 105 | 0.734394 | [
"MIT"
] | bpbpublications/Learn-Penetration-Testing-with-Python-3.x | Chapter 06/Packet-Sniffer-MAC.py | 817 | Python |
# -*- coding: utf-8 -*-
from .domainconfig import DomainConfig # noqa
from .resourceconfig import ResourceConfig # noqa
| 24.6 | 50 | 0.731707 | [
"BSD-3-Clause"
] | Alan01252/eve-sqlalchemy | eve_sqlalchemy/config/__init__.py | 123 | Python |
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2019 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 ... | 45.769231 | 119 | 0.785714 | [
"Apache-2.0"
] | Kiike5/akg | python/akg/ms/cce/sparse_softmax_cross_entropy_with_logits.py | 1,190 | Python |
import ast
import copy
import json
import os
import re
from collections import OrderedDict
from dataclasses import fields
from urllib.parse import urlparse
import supervisely_lib as sly
import sly_globals as g
from functools import lru_cache
def camel_to_snake(string_to_process):
return re.sub(r'(?<!^)(?=[A-Z]... | 35.183288 | 117 | 0.706274 | [
"MIT"
] | supervisely-ecosystem/gl-metric-learning | supervisely/labeling-tool/src/sly_functions.py | 13,053 | Python |
from matplotlib.pyplot import axis
from utils import *
def unify_features(csv_path):
file_name = os.path.basename(csv_path)
file_date = file_name.split("-")[0]
file_year = int(file_date[0:4])
file_date = int(file_date)
col_2020 = ['starttime', 'stoptime', 'start station id',
'sta... | 36.5 | 75 | 0.633562 | [
"MIT"
] | SajjadPSavoji/CitiBikeNYC | preprocess_data.py | 1,460 | Python |
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Andrew Dykstra <andrew.r.dykstra@gmail.com>
# Mads Jensen <mje.mads@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
from copy import deepcopy
import warnings
import ... | 37.070248 | 78 | 0.677684 | [
"BSD-3-Clause"
] | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/mne/tests/test_evoked.py | 17,942 | Python |
import sqlite3
import mmap
import os
import sys
import copy
import math
import tempfile
from tqdm import tqdm
from scipy.stats import norm
from expiringdict import ExpiringDict
cache = ExpiringDict(max_len=100000,max_age_seconds=600)
def get_num_lines(file_path):
fp = open(file_path, "r+")
buf = mmap.mmap(fp... | 32.415094 | 129 | 0.501892 | [
"MIT"
] | ChuVal/Respaldo2 | server/ai/src/naive_bayes.py | 6,872 | Python |
from pathlib import Path
import tvm
from tvm import autotvm
from tvm import relay
from tvm.autotvm.tuner import GATuner
from tvm.autotvm.tuner import GridSearchTuner
from tvm.autotvm.tuner import RandomTuner
from tvm.autotvm.tuner import XGBTuner
from rl_tuner.ga_dqn_tuner import GADQNTuner
from rl_tuner.ga_dqn_tuner... | 35 | 103 | 0.649854 | [
"Apache-2.0"
] | lhutton1/benchmark-tvm | tools/tune_model.py | 3,430 | Python |
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from application.models import Corpus
def layout():
corpus_options = []
corpora = Corpus.query.filter(Corpus.status == 'ready').all()
for corpus in corpora:
corpus_options.append({
... | 39.474138 | 78 | 0.320594 | [
"Apache-2.0"
] | Bhaskers-Blu-Org1/discover-archetype | web-app/application/pages/dashboard/layout.py | 4,579 | Python |
#!/usr/bin/env python
# Author: Nick Zwart
# Date: 2016jun01
# Backup all the projects of a git-hub style website via git mirroring.
# https://www.garron.me/en/bits/backup-git-bare-repo.html
import os
import sys
import time
import gitlab # external GitLab API
import github # external GitHub API
import shutil
impo... | 35.57563 | 79 | 0.615803 | [
"MIT"
] | nckz/BackupHub | BackupHub.py | 8,467 | Python |
import os
from src.multi_site_inputs_parser import multi_site_csv_parser
from src.parse_api_responses_to_csv import parse_responses_to_csv_with_template
from src.post_and_poll import get_api_results
from src.parse_api_responses_to_excel import parse_api_responses_to_excel
"""
Change these values
"""
##################... | 44.175 | 137 | 0.68987 | [
"BSD-3-Clause"
] | pragadeeshm/REopt-API-Analysis | multi_site/baseline_scenario_full_service_restaurant.py | 1,767 | Python |
import math
import sys
def example_1():
"""
THIS IS A LONG COMMENT AND should be wrapped to fit within a 72
character limit
"""
long_1 = """LONG CODE LINES should be wrapped within 79 character to
prevent page cutoff stuff"""
long_2 = """This IS a long string that looks gross and... | 31.615385 | 80 | 0.561233 | [
"MIT"
] | DevinJMantz/lambdata-25 | lambdata/code_review.py | 1,233 | Python |
from rest_framework.test import APIRequestFactory
from rest_framework import status
from django.test import TestCase
from django.urls import reverse
from ..models import User
from ..serializer import UserSerializer
from ..views import UserViewSet
import ipapi
class UsersApiRootTestCase(TestCase):
def test_api_ro... | 39.052846 | 108 | 0.65192 | [
"MIT"
] | r-o-main/users-exercise | users_django/users/tests/test_views.py | 9,607 | Python |
# Credits to Ozan Sener
# https://github.com/intel-isl/MultiObjectiveOptimization
import numpy as np
import torch
class MGDASolver:
MAX_ITER = 250
STOP_CRIT = 1e-5
@staticmethod
def _min_norm_element_from2(v1v1, v1v2, v2v2):
"""
Analytical solution for min_{c} |cx_1 + (1-c)x_2|_2^2
... | 36.599174 | 83 | 0.489669 | [
"MIT"
] | DavidHidde/backdoors101 | utils/min_norm_solvers.py | 8,857 | Python |
from .main import Controller
__all__ = ['Conttroler'] | 18 | 28 | 0.759259 | [
"MIT"
] | Grosse-pasteque/CPT | CPT/__init__.py | 54 | Python |
"""This module contains logic for refreshing materialized views.
Materialized views don't get refreshed automatically after a bucardo initial
sync. This module detects them and refreshes them.
Classes exported:
MatViews: Identify materialized views and refresh them on the secondary database.
"""
import psycopg2
from... | 34.027027 | 86 | 0.629468 | [
"MIT"
] | emmadev/bucardo_wrapper | plugins/mat_views/__init__.py | 2,518 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: list_translate_rule.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.... | 42.509259 | 777 | 0.766935 | [
"Apache-2.0"
] | easyopsapis/easyops-api-python | monitor_sdk/api/translate/list_translate_rule_pb2.py | 9,182 | Python |
"""NAO robot class"""
from .robot import Robot
import torch
class Pose_Assumption(Robot):
def __init__(self, env_params):
super(Pose_Assumption, self).__init__(env_params)
env_params = self.ingest_params2(env_params)
self.target = env_params["target error"]
self.joints = env_params... | 35.128788 | 82 | 0.463015 | [
"MIT"
] | AroMorin/DNNOP | environments/nao/pose_assumption.py | 4,637 | Python |
__package__ = "blackhat.bin.installable"
from ...helpers import Result
from ...lib.input import ArgParser
from ...lib.output import output
from ...lib.ifaddrs import getifaddrs
__COMMAND__ = "ifconfig"
__DESCRIPTION__ = ""
__DESCRIPTION_LONG__ = ""
__VERSION__ = "1.2"
def parse_args(args=[], doc=False):
"""
... | 34.853659 | 121 | 0.602519 | [
"MIT"
] | stautonico/blackhat-simulator | client/blackhat/bin/installable/ifconfig.py | 2,858 | Python |
# -*- coding: utf-8 -*-
import numpy as np
import astropy.units as u
import pkg_resources
from astropy.io import ascii
from astropy.modeling.tabular import tabular_model
from .baseclasses import BaseAtttauVModel
from .helpers import _test_valid_x_range
__all__ = ["WG00"]
x_range_WG00 = [0.1, 3.0001]
class WG00(... | 26.47962 | 85 | 0.494535 | [
"BSD-3-Clause"
] | gbrammer/dust_attenuation | dust_attenuation/radiative_transfer.py | 19,491 | Python |
"""
Extract CLOS / NLOS lookup.
Written by Ed Oughton.
March 2021
"""
import os
import configparser
import json
import math
import glob
import random
import numpy as np
import pandas as pd
import geopandas as gpd
import pyproj
from shapely.geometry import Point, Polygon, box, LineString
from shapely.ops import trans... | 29.416435 | 97 | 0.593675 | [
"MIT"
] | edwardoughton/e3nb | scripts/los.py | 21,121 | Python |
# Generated by Django 3.1.4 on 2021-01-03 18:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Attribute',
... | 41.238095 | 130 | 0.592379 | [
"MIT"
] | darkun7/Evaluate-CS-Student-as-Lecture-Assistant | home/migrations/0002_attribute_training_trainingvalue.py | 1,732 | Python |
# This script is used to parse BOOST special function test data into something
# we can easily import in numpy.
import re
import os
# Where to put the data (directory will be created)
DATA_DIR = 'scipy/special/tests/data/boost'
# Where to pull out boost data
BOOST_SRC = "boostmath/test"
CXX_COMMENT = re.compile(r'^\s... | 27.515873 | 82 | 0.552062 | [
"BSD-3-Clause"
] | ikamensh/scipy | scipy/special/utils/convert.py | 3,467 | Python |
import json
import os
from time import sleep
import requests
import pyrominfo.pyrominfo.snes as snes
from shutil import copy
from pyrominfo.pyrominfo import nintendo64
def n64_info(filename):
n64_parser = nintendo64.Nintendo64Parser()
props = n64_parser.parse(filename)
return props
def snes_info(filen... | 29.522727 | 116 | 0.531178 | [
"MIT"
] | mugenoesis/Gripper | main.py | 2,598 | Python |
import numpy as np
import os
import time
import argparse
import PruneAndSearch as algs
def get_args():
parser = argparse.ArgumentParser (
prog='PruneAndSearch',
description='Implementation of the Prune and Search Algorithm. ',
usage='python main.py { --rand RAND | --file FILE | --list LI... | 37.870813 | 169 | 0.576374 | [
"Apache-2.0"
] | kothiga/N-Smallest | main.py | 7,915 | Python |
# Copyright 2017 Square, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 31.141243 | 119 | 0.623458 | [
"Apache-2.0"
] | Bhav97/pylink | tests/unit/test_jlock.py | 11,024 | Python |
from dataclasses import dataclass, field
from typing import List
__NAMESPACE__ = "NISTSchema-SV-IV-list-hexBinary-maxLength-1-NS"
@dataclass
class NistschemaSvIvListHexBinaryMaxLength1:
class Meta:
name = "NISTSchema-SV-IV-list-hexBinary-maxLength-1"
namespace = "NISTSchema-SV-IV-list-hexBinary-m... | 24.857143 | 68 | 0.641762 | [
"MIT"
] | tefra/xsdata-w3c-tests | output/models/nist_data/list_pkg/hex_binary/schema_instance/nistschema_sv_iv_list_hex_binary_max_length_1_xsd/nistschema_sv_iv_list_hex_binary_max_length_1.py | 522 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayUserMpointPreconsultModel import AlipayUserMpointPreconsultModel
class AlipayUserMpointPreconsultRequest(object):
def __i... | 27.268966 | 148 | 0.643399 | [
"Apache-2.0"
] | antopen/alipay-sdk-python-all | alipay/aop/api/request/AlipayUserMpointPreconsultRequest.py | 3,954 | Python |
##########################################################################
#
# Copyright (c) 2007-2010, Image Engine Design 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:
#
# * Redis... | 31.352941 | 88 | 0.670598 | [
"BSD-3-Clause"
] | PaulDoessel/cortex | test/IECore/Turbulence.py | 3,731 | Python |
# -*- coding: utf-8 -*-
from .deprecated_code import (chi2_bin, best_ks_bin, make_bin, feature_analysis, calc_bin_cond)
| 30.25 | 95 | 0.752066 | [
"Apache-2.0"
] | longxl87/TimeDragon | __init__.py | 121 | Python |
#!/usr/bin/env python3
import ast
from collections import namedtuple
from functools import partial
import itertools
import logging
import os
from pathlib import Path
import re
from tempfile import NamedTemporaryFile, TemporaryDirectory
import time
import traceback
from typing import (
Any,
Iterator,
List,
... | 29.830287 | 87 | 0.579519 | [
"MIT"
] | ambv/flake8-mypy | flake8_mypy.py | 11,426 | 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... | 40.375 | 90 | 0.724458 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1010data/incubator-airflow | airflow/lineage/backend/__init__.py | 1,292 | Python |
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT
from verta._swagger.base_type import BaseType
class ModeldbAddProjectTags(BaseType):
def __init__(self, id=None, tags=None):
required = {
"id": False,
"tags": False,
}
self.id = id
self.tags = tags
for k, v in required.items():
if self... | 21.8 | 62 | 0.597859 | [
"Apache-2.0"
] | Atharex/modeldb | client/verta/verta/_swagger/_public/modeldb/model/ModeldbAddProjectTags.py | 654 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AllFieldsModel',
fields=[
('id', models.AutoFie... | 58.313433 | 148 | 0.622217 | [
"BSD-3-Clause"
] | lumasepa/clean_admin | example/second_app/migrations/0001_initial.py | 3,907 | Python |
import time
import random
import numpy as np
import gym
from rlkit.scripted_experts.scripted_policy import ScriptedPolicy
ACT_MAG = 0.275
ACT_NOISE_SCALE = 0.1
ACT_SLOW_NOISE_SCALE = 0.05
SLOW_DOWN_RADIUS = 0.01
def get_linear_pos_act(cur_pos, reach_pos):
cur_pos = cur_pos.copy()
reach_pos = reach_pos.copy()
... | 37.495798 | 94 | 0.600628 | [
"MIT"
] | KamyarGh/rl_swiss | rlkit/scripted_experts/linear_few_shot_reach_env_expert.py | 4,462 | Python |
# -*- coding: utf-8 -*-
def calculate_map(gt_path, my_path):
id2videos = dict()
with open(gt_path, 'r') as fin:
lines = fin.readlines()
for line in lines:
terms = line.strip().split(' ')
id2videos[terms[0]] = terms[1:]
id_num = len(lines)
my_id2videos = dict()
... | 30.108696 | 68 | 0.540794 | [
"MIT"
] | LegenDong/IQIYI_VID_FACE_2019 | evaluation_map.py | 1,385 | Python |
# Copyright 2021 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... | 65.3125 | 129 | 0.852632 | [
"Apache-2.0"
] | 22SWU/FlowerIdentify | tensorflow_examples/lite/model_maker/public/image_classifier/__init__.py | 2,090 | Python |
from .DTM import DTM | 20 | 20 | 0.8 | [
"MIT"
] | TNAlotaibi/DTM-crypt | src/DTM_crypt/__init__.py | 20 | Python |
import os
import random
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
from datasets.data_io import get_transform, read_all_lines, pfm_imread
class PicoStereoDataset(Dataset):
def __init__(self, datapath, list_filename, training):
self.datapath = datapath
self.left_fi... | 37.740614 | 119 | 0.579942 | [
"Apache-2.0"
] | skylook/mobilestereonet | datasets/dataset.py | 11,058 | Python |
from unittest.mock import MagicMock
import pytest
from click.testing import CliRunner
from prefect.cli.register import register
def test_register_init():
runner = CliRunner()
result = runner.invoke(register)
assert result.exit_code == 0
assert "Register flows" in result.output
def test_register_he... | 32.22973 | 87 | 0.644025 | [
"Apache-2.0"
] | BluePoof/prefect | tests/cli/test_register.py | 2,385 | Python |
# Copyright (c) 2017-2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""
This module contains pretty-print/formatting utilities.
"""
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class PrettyOptions:
... | 25.756757 | 102 | 0.701994 | [
"Apache-2.0"
] | digital-asset/dazl-client | python/dazl/pretty/options.py | 953 | Python |
import logging
import numpy as np
import trimesh
from src.common import compute_iou
# from scipy.spatial import cKDTree
from src.utils.libkdtree import KDTree
from src.utils.libmesh import check_mesh_contains
# Maximum values for bounding box [-0.5, 0.5]^3
EMPTY_PCL_DICT = {
'completeness': np.sqrt(3),
'accu... | 36.293578 | 126 | 0.605536 | [
"MIT"
] | hummat/convolutional_occupancy_networks | src/eval.py | 7,912 | Python |
# Copyright (c) 2018 Intel 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 applicable law or agreed to in... | 40.330709 | 112 | 0.632175 | [
"MIT"
] | iscumd/KiloOhm | kohm_gazebo/launch/include/navigation/nav2/nav.launch.py | 5,122 | Python |
import json
json_settings = json.dumps([
{
"type": "numeric",
"title": "Lower Limit",
"desc": "Lowest number to be used when asking questions",
"section": "General",
"key": "lower_num"
},
{
"type": "numeric",
"title": "Upper Limit",
"desc": "H... | 22.894737 | 66 | 0.512644 | [
"MIT"
] | gopar/Kivy-Tutor | json_settings.py | 435 | Python |
from .mlp_q_function import MLPQFunction
from .min_q_function import MinQFunction
from .zero_q_function import ZeroQFunction
__all__ = ['MinQFunction', 'MLPQFunction', 'ZeroQFunction']
| 31 | 59 | 0.827957 | [
"MIT"
] | roosephu/boots | boots/q_function/__init__.py | 186 | Python |
from setuptools import setup
# def readme():
# with open('README.md') as f:
# retun f.read()
setup(
name = 'cypher',
version = '0.2',
author = 'shashi',
author_email = 'skssunny30@gmail.com',
description = 'Password Encryptor by suggesting wheather a password is strong or not',
#l... | 28.25 | 90 | 0.610619 | [
"MIT"
] | walkershashi/Cypher | setup.py | 678 | Python |
# Generated by Django 3.0.8 on 2020-07-01 19:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 29.923077 | 121 | 0.645244 | [
"MIT"
] | arthtyagi/Geddit | users/migrations/0001_initial.py | 778 | Python |
"""Source URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/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-based ... | 35.269231 | 77 | 0.720829 | [
"Apache-2.0"
] | normalclone/color_detection | Source/urls.py | 917 | Python |
# Lab 2 Linear Regression
import tensorflow as tf
tf.set_random_seed(777) # seed 설정
# training data
x_train = [1, 2, 3]
y_train = [1, 2, 3]
# regerssion 결과는 W = 1, b = 0 이라는 것을 알 수 있음
# but tensorflow로 training 시켜서 해보기!!
# W와 b는 어떻게 달라질까?
# tf.Variable() : tensorflow가 사용하는 변수(trainable variable)
# tf.random_normal... | 27.983051 | 72 | 0.677771 | [
"MIT"
] | statKim/TIL | Python/tensorflow/DeepLearningZeroToAll/ver.py/Lab02-1-linear_regression.py | 1,879 | Python |
import torch.nn as nn
from .registry import Registry
COMPRESSION_MODULES = Registry('compression modules')
class ProxyModule:
def __init__(self, module):
self._module = module
def __getattr__(self, name):
return getattr(self._module, name)
class _NNCFModuleMixin:
def __init__(self, *a... | 27.725806 | 63 | 0.623618 | [
"Apache-2.0"
] | AbraInsight/nncf_pytorch | nncf/layer_utils.py | 1,719 | Python |
"""
"""
import unittest
from unittest.mock import Mock, patch
from wheezy.core import __version__, httpclient
from wheezy.core.gzip import compress
class HTTPClientTestCase(unittest.TestCase):
def setUp(self):
self.patcher = patch.object(httpclient, "HTTPConnection")
self.mock_c_class = self.pat... | 37.844595 | 79 | 0.612926 | [
"MIT"
] | akornatskyy/wheezy.core | src/wheezy/core/tests/test_httpclient.py | 5,601 | Python |
# Generic CNN classifier that uses a geojson file and gbdx imagery to classify chips
import numpy as np
import os, random
import json, geojson
from mltools import geojson_tools as gt
from mltools.data_extractors import get_data_from_polygon_list as get_chips
from keras.layers.core import Dense, Dropout, Activation, F... | 46.923541 | 91 | 0.595086 | [
"MIT"
] | DigitalGlobe/mltools | examples/polygon_classify_cnn/pool_net.py | 23,321 | Python |
import six
from smqtk.representation import DescriptorIndex, get_data_element_impls
from smqtk.utils import merge_dict, plugin, SimpleTimer
try:
from six.moves import cPickle as pickle
except ImportError:
import pickle
class MemoryDescriptorIndex (DescriptorIndex):
"""
In-memory descriptor index wit... | 34.992857 | 84 | 0.651051 | [
"BSD-3-Clause"
] | cdeepakroy/SMQTK | python/smqtk/representation/descriptor_index/memory.py | 9,798 | Python |
import cv2
import glob
import os
if __name__ == "__main__":
img_path = "/workspace/mnt/storage/yankai/test_cephfs/YOLOX/datasets/ducha_det/labels/val"
save_size_path = "/workspace/mnt/storage/yankai/test_cephfs/YOLOX/datasets/ducha_det/sizes/val"
if not os.path.exists(save_size_path):
os.makedirs(... | 39.434783 | 125 | 0.643881 | [
"Apache-2.0"
] | yankai317/YOLOX | tools/add_img_size.py | 907 | Python |
from typing import Optional
from pydantic import AnyHttpUrl, Field, IPvAnyAddress
from app.schemas.base import AbstractParentResourceModel
from app.schemas.mixin import TimestampMixin
class Script(AbstractParentResourceModel, TimestampMixin):
"""Script"""
url: AnyHttpUrl = Field(...)
ip_address: Option... | 25.142857 | 58 | 0.784091 | [
"MIT"
] | ninoseki/uzen | app/schemas/script.py | 352 | Python |
def conv(T,taille):
# conv (list(list(bool)) * int -> list(list(int)))
# Convertis un tableau à 2 dimensions contenent des booléens en tableau à 2 dimensions contenant des entiers tel que True = 1 et False = 0
# T (list(list(bool))) : tableau à 2 dimensions contenant des booléens
# taille (int) : taille... | 54.538462 | 142 | 0.682652 | [
"MIT"
] | Erwanexyz/Python | conv_tableau_2_dimensions_bool_int.py | 719 | Python |
"""Definitions for all core text instructions."""
from pyshgp.push.type_library import PushTypeLibrary
from pyshgp.push.instruction import SimpleInstruction, ProducesManyOfTypeInstruction
from pyshgp.push.types import Char
from pyshgp.utils import Token
def _concat(a, b):
return str(b) + str(a),
def _first_char... | 27.012844 | 134 | 0.577299 | [
"MIT"
] | RedBeansAndRice/pyshgp | pyshgp/push/instructions/text.py | 14,722 | 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 us... | 34.084034 | 79 | 0.677885 | [
"Apache-2.0"
] | elwinarens/beam | sdks/python/setup.py | 8,112 | Python |
import os
import requests
# configurations to be adjusted
# 1. put here URL (see textfile)
base_url = "https://data-dataref.ifremer.fr/stereo/AA_2015/2015-03-05_10-35-00_12Hz/input/cam1/"
# 2. decide which (range of) images
start = 0
end = 149
# 3. name folder to save images to, best take from url (change "/" to "_")
... | 34.236364 | 146 | 0.680297 | [
"MIT"
] | sea-state-estimation/sea-state-estimation | dataset_preparation/downloading.py | 1,883 | Python |
# :coding: utf-8
# :copyright: Copyright (c) 2015 ftrack
import os
import uuid
import tempfile
import pytest
import ftrack_api.cache
@pytest.fixture(params=['proxy', 'layered', 'memory', 'file', 'serialised'])
def cache(request):
'''Return cache.'''
if request.param == 'proxy':
cache = ftrack_api.c... | 26.01199 | 91 | 0.608648 | [
"MIT"
] | Mikfr83/OpenPype | openpype/modules/ftrack/python2_vendor/ftrack-python-api/test/unit/test_cache.py | 10,847 | Python |
import sys
import time
import math
import psutil
import pytest
import threading
from loky import TimeoutError
from loky import get_reusable_executor
from loky.backend import get_context
# Set a large timeout as it should only be reached in case of deadlocks
TIMEOUT = 40
_test_event = None
def initializer_event(ev... | 38.526066 | 79 | 0.651126 | [
"BSD-3-Clause"
] | pombredanne/loky | tests/_executor_mixin.py | 8,129 | Python |
# Copyright 2016 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 or agreed to in writing, ... | 37.032929 | 84 | 0.580494 | [
"Apache-2.0"
] | fsx950223/ci_edit | app/window.py | 64,104 | Python |
import os
import sys
def dump_output(path, data):
f = open(path, 'wb')
if data is None:
f.write(b'\0')
else:
f.write(data)
f.close()
def get_path_list(directory):
paths = []
if not os.path.exists(directory):
raise FileNotFoundError('No such directo... | 28.754717 | 75 | 0.57185 | [
"MIT"
] | Zemana/utils | pe_extractor/extractor.py | 3,048 | Python |
import functools
import typing
from aws_cdk import core
from cdk_resources.utils import (
app_context,
ALLOWED_ENVIRONMENTS,
get_environment,
)
__all__ = ["ResourceStack", "register_stacks"]
class ResourceStack(core.Stack):
""" """
EXISTING_RESOURCES = None
RESOURCES = None
def __ini... | 29.541176 | 78 | 0.573875 | [
"MIT"
] | sfernandezf/cdk-resources | cdk_resources/stacks.py | 2,511 | Python |
# Generated by Django 3.1.1 on 2020-09-08 18:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('grocery', '0003_auto_202... | 31.037037 | 142 | 0.656325 | [
"MIT"
] | MeRichard123/LifeExpenses | ExpenseTracker/grocery/migrations/0004_auto_20200908_1918.py | 838 | Python |
import numpy as np
from scipy.io import loadmat
m = loadmat('test.mat', squeeze_me=True, struct_as_record=True,
mat_dtype=True)
np.savez('test.npz', **m)
| 23.285714 | 63 | 0.711656 | [
"BSD-3-Clause"
] | 0x0L/scipy | scipy/fftpack/tests/gendata.py | 163 | Python |
import re
#
# Модуль 2 из домашнего задания для 4 вебинара.
#
# Пользователь вводит любые цифры через запятую.
# Сохранить цифры в список.
# Получить новый список в котором будут только уникальные элементы исходного.
# Вывести его на экран.
#
s_input = input("Введите элементы списка через разделитель [,:/]: ")
l_... | 30.714286 | 78 | 0.718605 | [
"MIT"
] | andreylrr/PythonDeveloperHW4 | 2seq.py | 645 | Python |
#!/usr/bin/env python3
# Copyright (c) 2016-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.
"""Encode and decode BASE58, P2PKH and P2SH addresses."""
from .script import hash256, hash160, sha256, C... | 32.420455 | 75 | 0.687697 | [
"MIT"
] | Falconno7/xpchain | test/functional/test_framework/address.py | 2,853 | Python |
from django import forms
class PaymentForm(forms.Form):
stripeTokenType = forms.CharField(required=False)
stripeEmail = forms.EmailField(required=False)
stripeToken = forms.CharField(required=True)
| 23.666667 | 53 | 0.769953 | [
"MIT"
] | phildini/logtacts | payments/forms.py | 213 | Python |
from __future__ import absolute_import, division, unicode_literals
import sys
import numpy as np
import pytest
try:
import holoviews as hv
except Exception:
hv = None
hv_available = pytest.mark.skipif(hv is None, reason="requires holoviews")
try:
import matplotlib as mpl
mpl.use('Agg')
except Except... | 23.689655 | 89 | 0.711305 | [
"BSD-3-Clause"
] | bstadlbauer/panel | panel/tests/util.py | 2,061 | Python |
# Copyright (c) 2021 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/micro-ROS/system_modes.
#
# 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 o... | 37.634146 | 86 | 0.705768 | [
"Apache-2.0"
] | bjv-capra/micro_ros_diagnostics | micro_ros_diagnostic_bridge/launch/diagnostic_bridge.launch.py | 1,543 | Python |
"""
DriverFactory class
Note: Change this class as you add support for:
1. SauceLabs/BrowserStack
2. More browsers like Opera
"""
import dotenv,os,sys,requests,json
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabil... | 38.634615 | 160 | 0.659781 | [
"MIT"
] | akkuldn/interview-scheduler | QA/page_objects/DriverFactory.py | 4,018 | Python |
from __future__ import unicode_literals
import unittest
from torrent_parser import encode
class TestEncode(unittest.TestCase):
def test_encode(self):
self.assertEqual(encode(12345), b'i12345e')
| 17.583333 | 51 | 0.772512 | [
"MIT"
] | 7sDream/torrent_parser | tests/test_encode.py | 211 | Python |
"""
*Element Height*
"""
from strism._geoshape import Pixel
from ._dimension import Dimension
__all__ = ["ElementHeight"]
class ElementHeight(
Pixel,
Dimension,
):
def __init__(
self,
height: int,
):
super(ElementHeight, self).__init__(
height,
)
| 12.72 | 44 | 0.578616 | [
"Apache-2.0"
] | jedhsu/text | text/_shape/height.py | 318 | Python |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Define a class for creating the jailed context."""
import os
import shutil
from subprocess import run, PIPE
from retry.api import retry_call
from framework.defs import API_USOCKET_NAME, FC_BINARY_NAME,... | 35.004274 | 79 | 0.588084 | [
"Apache-2.0"
] | Pennyzct/firecracker | tests/framework/jailer.py | 8,191 | Python |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback
from myuw.dao.calendar import api_request
from myuw.views.api import ProtectedAPI
from myuw.views.error import handle_exception
from myuw.views import prefetch_resources
from myuw.logger.timer import ... | 33.321429 | 68 | 0.69239 | [
"Apache-2.0"
] | timtim17/myuw | myuw/views/api/calendar.py | 933 | Python |
from django import forms
from django.forms import ModelForm
from .models import Review
class ReviewForm(ModelForm):
required_css_class = 'required'
def __init__(self, *args, **kwargs):
"""
user object is passed to the form in kwargs in the view
the user objected is removed from kwarg... | 31.513514 | 93 | 0.616638 | [
"Apache-2.0"
] | mohammadasim/online-bookstore | reviews/forms.py | 1,166 | Python |
import warnings
warnings.simplefilter("ignore", category=FutureWarning)
from pmaf.biome.essentials._metakit import EssentialFeatureMetabase
from pmaf.biome.essentials._base import EssentialBackboneBase
from pmaf.internal._constants import (
AVAIL_TAXONOMY_NOTATIONS,
jRegexGG,
jRegexQIIME,
BIOM_TAXONOMY... | 37.081016 | 133 | 0.559903 | [
"BSD-3-Clause"
] | mmtechslv/PhyloMAF | pmaf/biome/essentials/_taxonomy.py | 30,666 | Python |
import pickle
import numpy as np
# pickle_file = 'experiment_pickle_12_0.15_5_0.075.p'
pickle_file = 'experiment_pickle_12_0.1_5_0.075.p'
content = pickle.load(open(pickle_file))
familys = content.keys()
for family in familys:
collected = []
measurements = content[family]
for measurement in measurements... | 29.588235 | 130 | 0.717694 | [
"Unlicense"
] | ai-se/BEETLE__FSE_2018 | src/RQ4_exp/run_pickle.py | 503 | Python |
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 60.373737 | 145 | 0.704367 | [
"Apache-2.0"
] | ajmal017/qf-lib | qf_lib_tests/integration_tests/backtesting/alpha_model_strategy_testers/test_alpha_model_strategy_for_stop_losses_intraday.py | 5,979 | Python |
import json
import os
from djoser.conf import settings as djoser_settings
from djoser.compat import get_user_email
from django.utils.timezone import now
from django.http import HttpResponse
from rest_framework import status
from rest_framework.decorators import api_view, authentication_classes, permission_classes, act... | 41.194444 | 147 | 0.736514 | [
"MIT"
] | SunSpecOrangeButton/ahj-registry | server/ahj_app/views_users.py | 5,932 | Python |
#!/usr/bin/env python
import os
import sys
basepath = os.path.dirname(os.path.abspath(__file__))
basepath = os.path.abspath(os.path.join(basepath, os.pardir))
wavpath = os.path.join(basepath, "spectro", "tchaikovsky.wav")
sys.path.append(basepath)
from utils import PhysicalKeyboard
from spectro import Spectro
kbd... | 19.4 | 62 | 0.765464 | [
"MIT"
] | valschneider/lauzhack2017 | demos/spectro_tchai.py | 388 | 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... | 38.389121 | 299 | 0.663215 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/databoxedge/v20201201/get_share.py | 9,175 | Python |
#!/usr/bin/env python
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
with open(
os.path.join(here, "requirements.txt"), encoding="utf-8"
) as requirements_file:
requirements = requirements_file.read().splitlines()
with open(
os.path.join(here, "requirements_dev.... | 31.780488 | 86 | 0.71911 | [
"BSD-3-Clause"
] | zfit/zfit-interface | setup.py | 1,303 | Python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 15:13:33 2019
@author: ifenty
"""
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
from .llc_array_conversion import llc_compact_to_tiles
from .llc_array_conversion import llc_compact_to_faces
from .llc_array_... | 28.567976 | 109 | 0.577834 | [
"MIT"
] | cpatrizio88/ECCO_tools | ecco_v4_py/test_llc_array_loading_and_conversion.py | 9,456 | Python |
import requests
import json
from pybliometrics.scopus import AbstractRetrieval
arr_authors = [
'55949131000', #EG
'56344636600', #MF
'6602888121', #MG
'7005314544' #SR
]
MY_API_KEY = 'afd5bb57359cd0e85670e92a9a282d48'
from pybliometrics.scopus.utils import config
#config['Authentication']['APIKey... | 30.462963 | 120 | 0.619453 | [
"MIT"
] | big-unibo/big-website | script/bib_script2_not_working.py | 1,645 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.