content
stringlengths
7
928k
avg_line_length
float64
3.5
33.8k
max_line_length
int64
6
139k
alphanum_fraction
float64
0.08
0.96
licenses
list
repository_name
stringlengths
7
104
path
stringlengths
4
230
size
int64
7
928k
lang
stringclasses
1 value
from unittest import TestCase from block import source, conjunction, negation, operator_of, nor from components import rs_flip_flop from simulation import Simulation def sr_simulation(initial_s, initial_q): nor1, nor2, source_r, source_s, _, _ = rs_flip_flop(initial_q, initial_s) simulation = Simulation([sou...
30.911765
77
0.662226
[ "MIT" ]
mjoniak/adder
test_simulation.py
2,102
Python
import dataclasses import re import textwrap from typing import Optional, Iterable, List, Match, Pattern, Tuple, Type, TypeVar, Union def add_line_prefix(s: str, prefix: str, /, empty_lines=False) -> str: if empty_lines: predicate = lambda line: True else: predicate = None return textwrap...
24.46875
88
0.58791
[ "Apache-2.0", "MIT" ]
ctron/rust-monaco
ts2rs/ts2rs/helpers.py
4,698
Python
# Copyright 2015 OpenStack Foundation # 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 requ...
38.462366
78
0.662007
[ "Apache-2.0" ]
HybridF5/nova
nova/conf/wsgi.py
3,577
Python
import pickle import zmq import threading import pymongo from constants import ( MONGO_DEFAULT_HOST, MONGO_DEFAULT_PORT, ZMQ_DEFAULT_HOST, ZMQ_DEFAULT_PORT ) class QueryExecutor(object): """A query executor""" def __init__(self, dbconfig={}, zmqconfig={}): """Initialize executor""" ...
32.705882
139
0.63729
[ "Apache-2.0" ]
voidabhi/mongomq
mongomq/queryexecutor.py
1,668
Python
import math from pyvolution.EvolutionManager import * from pyvolution.GeneLibrary import * """ This example attempts to find a solution to the following system of equations: a + b + c + d - 17 = 0 a^2 + b^2 - 5 = 0 sin(a) + c - d - 20 = 0 """ def fitnessFunction(chromosome): """ Given a "chromosome", this ...
38.878788
119
0.708885
[ "Apache-2.0" ]
littley/pyvolution
examples/EquationSolver_simple.py
2,566
Python
import json import argparse from time import sleep import psycopg2 import subprocess import os import signal def connTemp(puser, phost, pport, stmt): conn = psycopg2.connect(database = 'postgres', user = puser, host = phost, port = pport) conn.autocommit = True cur = conn.cursor() cur.execute(stmt) ...
39.696312
517
0.488033
[ "Apache-2.0" ]
zettadb/cloudnative
person/charles/PGX/pgx_install.py
18,308
Python
# -*- coding: utf-8 -*- """ Created on Tue Jun 07 2016 @author: Matthew Carse """ #@ Class containing methods for machine learning. #@ Chromosomes must be preprocessed through feature scaling standardisation prior to being #@ used in machine learning. The class implements Scikit-learn to apply feature scaling...
49.278932
180
0.613898
[ "MIT" ]
MatthewCarse/evolve
machineLearning.py
16,607
Python
""" In this exercise you are going to apply what you learned about stacks with a real world problem. We will be using stacks to make sure the parentheses are balanced in mathematical expressions such as: ((3^2 + 8)*(5/2))/(2+6) In real life you can see this extend to many things such as text editor plugins and...
24.067568
103
0.623807
[ "MIT" ]
m-01101101/udacity-datastructures-algorithms
3. data_structures/stack/balanced_parantheses.py
1,781
Python
import os import re import uuid import typing as t import logging import pathlib import functools from typing import TYPE_CHECKING from distutils.dir_util import copy_tree from simple_di import inject from simple_di import Provide import bentoml from bentoml import Tag from bentoml.exceptions import BentoMLException ...
39.56262
392
0.631617
[ "Apache-2.0" ]
almirb/BentoML
bentoml/_internal/frameworks/tensorflow_v2.py
20,533
Python
""" Django settings for modelos project. Generated by 'django-admin startproject' using Django 1.9.7. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os #...
25.862903
91
0.697225
[ "MIT" ]
probardjango/Modelos-de-Django
src/modelos/settings.py
3,207
Python
"""nflDAs URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.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 ...
34
77
0.708556
[ "MIT" ]
BARarch/NFL-Topics
nflDAs/nflDAs/urls.py
748
Python
import numpy as np from gym.envs.mujoco import mujoco_env from gym import utils def mass_center(model, sim): mass = np.expand_dims(model.body_mass, 1) xpos = sim.data.xipos return (np.sum(mass * xpos, 0) / np.sum(mass))[0] class PoppyHumanoidKeepStandingEnv(mujoco_env.MujocoEnv, utils.EzPickle): def _...
41.096154
170
0.614881
[ "MIT" ]
garrettkatz/poppy-simulations
ambulation/envs/poppy_humanoid_keep_standing/poppy_humanoid_keep_standing.py
2,137
Python
''' Simple tool to find big functions in a js or ll file ''' import os, sys, re filename = sys.argv[1] i = 0 start = -1 curr = None data = [] for line in open(filename): i += 1 if line.startswith(('function ', 'define ')): start = i curr = line elif line.startswith('}') and curr: size = i - start ...
19.083333
56
0.576419
[ "MIT" ]
Cloudef/emscripten
tools/find_bigfuncs.py
458
Python
from spn.structure.Base import Product, Sum, get_nodes_by_type from spn.structure.leaves.cltree.CLTree import CLTree from spn.algorithms.Validity import is_consistent from scipy.sparse.csgraph import minimum_spanning_tree from scipy.sparse.csgraph import depth_first_order from error import RootVarError import numpy ...
27.627249
105
0.602773
[ "Apache-2.0" ]
gengala/Random-Probabilistic-Circuits
utils.py
10,747
Python
import hashlib import json from datetime import datetime, timedelta import wordai.models as models from flask import Blueprint from flask_jwt_extended import (JWTManager, create_access_token, create_refresh_token, get_jwt_identity, get_raw_jwt, jwt_refres...
33.101493
110
0.546307
[ "MIT" ]
archichen/wordai
wordai/api/apis.py
11,089
Python
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
43.074074
112
0.656492
[ "Apache-2.0" ]
Li-kewei/models
official/cv/brdnet/preprocess.py
2,411
Python
from __future__ import absolute_import # Copyright (c) 2010-2019 openpyxl import pytest from io import BytesIO from zipfile import ZipFile from openpyxl.xml.functions import fromstring, tostring from openpyxl.tests.helper import compare_xml from ..manifest import WORKSHEET_TYPE @pytest.fixture def FileExtension(): ...
34.188153
135
0.603139
[ "MIT" ]
chenc2/openpyxl
openpyxl/packaging/tests/test_manifest.py
9,812
Python
from .engine_input import EngineInput from ..announcements import gen_victim_prefix_ann class ValidPrefix(EngineInput): __slots__ = () def _get_announcements(self, **extra_ann_kwargs): return [gen_victim_prefix_ann(self.AnnCls, self.victim_asn, ...
30.083333
58
0.612188
[ "BSD-3-Clause" ]
jfuruness/lib_bgp_simulator
lib_bgp_simulator/engine_input/valid_prefix.py
361
Python
import asyncio import logging import ssl import time import traceback from ipaddress import IPv6Address, ip_address, ip_network, IPv4Network, IPv6Network from pathlib import Path from secrets import token_bytes from typing import Any, Callable, Dict, List, Optional, Union, Set, Tuple from aiohttp import ClientSession,...
45.655319
119
0.623047
[ "Apache-2.0" ]
GreenBerry-Network/greenberry-blockchain
greenberry/server/server.py
32,187
Python
# Copyright 2019-2020 QuantumBlack Visual Analytics Limited # # 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 # # THE SOFTWARE IS PROVIDED "AS IS"...
36.782123
112
0.679982
[ "Apache-2.0" ]
mkretsch327/causalnex
causalnex/structure/pytorch/notears.py
13,168
Python
import re from . import inlinepatterns from . import util from . import odict def build_treeprocessors(md_instance, **kwargs): """ Build the default treeprocessors for Markdown. """ treeprocessors = odict.OrderedDict() treeprocessors["inline"] = InlineProcessor(md_instance) treeprocessors["prettify"] ...
35.038781
80
0.528579
[ "MIT" ]
Con-Mi/lambda-packs
Tensorflow_LightGBM_Scipy_nightly/source/markdown/treeprocessors.py
12,649
Python
from selenium import webdriver import time url = "http://localhost/litecart/admin/" browser = webdriver.Chrome() browser.implicitly_wait(1) without_title = 0 try: browser.get(url) # логинемся login = browser.find_element_by_css_selector("[name='username']") login.send_keys("admin") password = ...
30.018519
106
0.650833
[ "Apache-2.0" ]
aminzin-1990/software-testing-repository
selenium/find_elements/app_main_menu.py
1,780
Python
""" Considerando duas listas de inteiros ou floats (lista A e lista B) Some os valores nas listas retornando uma nova lista com os valores somados: Se uma lista for maior que a outra, a soma só vai considerar o tamanho da menor. Exemplo: lista_a = [1, 2, 3, 4, 5, 6, 7] lista_b = [1, 2, 3, 4] ===================...
29.235294
76
0.633803
[ "MIT" ]
lel352/Curso-Python
aulaspythonintermediario/exercicios06/exercicio01.py
498
Python
import functools from teamiclink.slack.model import GoalContent from typing import Any, Dict from slack_bolt import Ack from slack_bolt.context import BoltContext from pydantic import ValidationError CREATE_GOAL_CALLBACK_ID = "create_goal_view_id" CREATE_GOAL_INPUT = "create_goal_action" CREATE_GOAL_INPUT_BLOCK = "cr...
32.816327
85
0.620647
[ "Apache-2.0" ]
e1004/teamiclink
teamiclink/slack/view_goal_create.py
1,608
Python
import concurrent.futures import contextlib import http.client import json import math import os import time from .common import FileDownloader from .http import HttpFD from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7 from ..compat import compat_os_name, compat_struct_pack, compat_urllib_error from ..utils import ...
42.242086
130
0.582525
[ "Unlicense" ]
9Fork/yt-dlp
yt_dlp/downloader/fragment.py
22,684
Python
from functools import partial from typing import Any, Callable, List, Optional, Sequence, Type, Union from torch import nn from torchvision.prototype.transforms import VideoClassificationEval from torchvision.transforms.functional import InterpolationMode from ....models.video.resnet import ( BasicBlock, Basi...
28.431373
119
0.644828
[ "BSD-3-Clause" ]
Bethhhh/vision
torchvision/prototype/models/video/resnet.py
4,350
Python
from __future__ import print_function from __future__ import absolute_import from builtins import range from abc import ABCMeta, abstractmethod, abstractproperty import os import re import json from . import globalDictionaries from . import configTemplates from .dataset import Dataset from .helperFunctions import repla...
45.268844
157
0.568852
[ "Apache-2.0" ]
4quarks/cmssw
Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py
36,034
Python
# ---------------------------------------------------------------------- # # Brad T. Aagaard, U.S. Geological Survey # Charles A. Williams, GNS Science # Matthew G. Knepley, University at Buffalo # # This code was developed as part of the Computational Infrastructure # for Geodynamics (http://geodynamics.org). # # Copy...
39.260331
113
0.564362
[ "MIT" ]
Shengduo/pylith
pylith/apps/ConfigSearchApp.py
9,501
Python
# Interview Questions """ Given the following list of objects {user, loginTime, logoutTime}. What is the maximum number of concurrent users logged in at the same time? Input: [ {user: A, login: 1, logout: 3}, {user: B, login: 3, logout: 4}, {user: C, login: 1, logout: 2}, {user: D, login: 123123123, logo...
18.45614
141
0.520913
[ "MIT" ]
BizShuk/code_concept
interview/booking.com/max_concurrent.py
1,052
Python
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
34.300885
78
0.557792
[ "Apache-2.0" ]
WuHaobo/Paddle
python/paddle/fluid/tests/unittests/test_roll_op.py
3,876
Python
import importlib import os from datasets.hdf5 import get_test_loaders from unet3d import utils from unet3d.config import load_config from unet3d.model import get_model logger = utils.get_logger('UNet3DPredictor') def _get_predictor(model, loader, output_file, config): predictor_config = config.get('pr...
30.869565
84
0.687324
[ "MIT" ]
stonebegin/Promise12-3DUNet
predict.py
1,420
Python
# -*- coding: utf-8 -*- # # django-staticbuilder documentation build configuration file, created by # sphinx-quickstart on Wed Jan 30 22:32:51 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated ...
32.708502
82
0.714692
[ "MIT" ]
hzdg/django-staticbuilder
docs/source/conf.py
8,079
Python
# coding: utf-8 """ Purity//FB REST Client Client for Purity//FB REST API (1.0 - 1.6), developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/). OpenAPI spec version: 1.6 Contact: info@purestorage.com ...
42.758824
261
0.601458
[ "Apache-2.0" ]
unixtreme/purity_fb_python_client
purity_fb/purity_fb_1dot6/apis/usage_users_api.py
7,269
Python
from django.conf import settings MINIJS_MODE = getattr(settings, "MINIJS_MODE", "development") MINIJS_OUTPUT_DIR = getattr(settings, "MINIJS_OUTPUT_DIR", "minijs") MINIJS_BYPASS = getattr(settings, "MINIJS_BYPASS", False) MINIJS_ALWAYS_MINIFY = getattr(settings, "MINIJS_ALWAYS_MINIFY", False) MINIJS_ALWAYS_COMPILE_COF...
67.555556
127
0.84375
[ "MIT" ]
tombenner/minijs
settings.py
608
Python
""" Unit tests for the structured metamodel component. """ import unittest import inspect import numpy as np from numpy.testing import assert_almost_equal import openmdao.api as om from openmdao.utils.assert_utils import assert_near_equal, assert_warning, assert_check_partials from openmdao.utils.general_utils import...
40.718373
140
0.583719
[ "Apache-2.0" ]
JustinSGray/OpenMDAO
openmdao/components/tests/test_meta_model_structured_comp.py
54,074
Python
"""Collection of Jax network layers, wrapped to fit Ivy syntax and signature. """ # global import jax.numpy as jnp import jax.lax as jlax # local from ivy.functional.backends.jax import JaxArray def conv1d( x: JaxArray, filters: JaxArray, strides: int, padding: str, data_format: str = "NWC", ...
25.416667
88
0.691803
[ "Apache-2.0" ]
thatguuyG/ivy
ivy/functional/backends/jax/layers.py
1,525
Python
import numpy import torch import pytorch_pfn_extras as ppe from torch.utils.data import Dataset class TabularDataset(Dataset): """An abstract class that represents tabular dataset. This class represents a tabular dataset. In a tabular dataset, all examples have the same number of elements. For examp...
33.38024
79
0.577092
[ "MIT" ]
HiroakiMikami/pytorch-pfn-extras
pytorch_pfn_extras/dataset/tabular/tabular_dataset.py
11,149
Python
from collections import defaultdict from operator import attrgetter from typing import Union from hypergraph.network import HyperGraph, StateNode, Node, BipartiteNetwork, BipartiteStateNetwork from hypergraph.transition import gamma, d, pi def create_network(hypergraph: HyperGraph, non_backtracking: bool) -> Union[B...
33.609756
117
0.607402
[ "MIT" ]
antoneri/mapping-hypergraphs
hypergraph/representation/bipartite.py
2,756
Python
def invert_binary_tree(node): if node: node.left, node.right = invert_binary_tree(node.right), invert_binary_tree(node.left) return node class BinaryTreeNode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = None self.right = None...
26.043478
93
0.72621
[ "MIT" ]
YazzyYaz/codinginterviews
practice_problems/trees_graphs/invert_binary_tree.py
599
Python
import network import torch if __name__ == '__main__': net = network.modeling.__dict__['deeplabv3plus_resnet50']() print(net) input=torch.FloatTensor(2,3,512,512) output=net(input) print(output.shape)
22.6
63
0.69469
[ "MIT" ]
WuShaogui/DeepLabV3Plus-Pytorch
test.py
226
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...
35.449275
78
0.656378
[ "Apache-2.0" ]
ChinaMassClouds/nova
nova/tests/unit/console/test_serial.py
4,892
Python
# Copyright 2018-2021 Streamlit Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
34.469945
105
0.684052
[ "MIT" ]
Deepanjalkumar/Attacksurfacemanagement
notebook/lib/python3.9/site-packages/streamlit/bootstrap.py
12,616
Python
{ 'repo_type' : 'archive', 'download_locations' : [ #UPDATECHECKS: http://fftw.org/download.html #{ "url" : "http://fftw.org/fftw-3.3.9.tar.gz", "hashes" : [ { "type" : "sha256", "sum" : "bf2c7ce40b04ae811af714deb512510cc2c17b9ab9d6ddcf49fe4487eea7af3d" }, ], }, #{ "url" : "https://fossies.org/linux/misc/fftw-3...
61.272727
188
0.605836
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
hydra3333/h3333_python_cross_compile_script_v100
packages/dependencies/fftw3_dll_double.py
2,022
Python
from django.shortcuts import render, get_object_or_404 from .models import PostReview from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger def single_review(request, year, month, day, review): review = get_object_or_404(PostReview, slug=review, status='published'...
35.758621
76
0.608486
[ "MIT" ]
Karol-Zielke/book_post-review
main/reviews/views.py
1,037
Python
import json import time import datetime import requests import json playbackStampRecords = [{"b500c6b0-633b-11ec-85c5-cba80427674d2021-10-10"}] def getConfigurations(): url = "https://data.mongodb-api.com/app/data-mtybs/endpoint/data/beta/action/find" payload = json.dumps({ "collection": "configuratio...
39.678571
175
0.651215
[ "MIT" ]
briankinsella26/thegoodmorningproject
pi_scripts/user_details.py
2,222
Python
from django.apps import AppConfig class VideoBackConfig(AppConfig): name = 'video_background' verbose_name = "Video Backgrounds"
19.857143
38
0.76259
[ "BSD-3-Clause" ]
LegionMarket/django-cms-base
video_background/apps.py
139
Python
from django.shortcuts import render # Create your views here. from django.http import HttpResponse def index(request): category_list = Category.objects.order_by('-name')[:5] #category_list = Category.objects().order_by('-name') context = {'categories': category_list} # Aquí van la las variables para la...
29.307692
91
0.732283
[ "Apache-2.0" ]
pmmre/SSBW2
rango/views.py
382
Python
import numpy as np from LoopStructural.utils import getLogger logger = getLogger(__name__) def gradients(vals, func, releps=1e-3, abseps=None, mineps=1e-9, reltol=1, epsscale=0.5): """ Calculate the partial derivatives of a function at a set of values. The derivatives are calculated using th...
35.456
110
0.569946
[ "MIT" ]
Loop3D/LoopStructural
LoopStructural/probability/_gradient_calculator.py
4,432
Python
''' @author: xiayuanhuang ''' import csv import matchECtoDemog import decisionTreeV7 import family_treeV4 import inference import combine_new_ped def combine(addressFile, nameFile, demoFile, accountFile, outputFile, patientFile, ecFile, familyTreeOutput): reader_add = csv.reader(open(addressFile, 'r'), delimite...
38.488372
133
0.678751
[ "MIT" ]
xiayuan-huang/E-pedigrees
Source/combine.py
4,965
Python
#!flask/bin/python from migrate.versioning import api from config2 import SQLALCHEMY_DATABASE_URI from config2 import SQLALCHEMY_MIGRATE_REPO api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) print('Current database version: ' + str(v))
45.285714
68
0.85489
[ "BSD-3-Clause" ]
djgidwani/remotetest
db_upgrage2.py
317
Python
import acequia as aq from acequia import KnmiStations if 1: # test KnmiStations.prec_stns() knmi = KnmiStations() print("Retrieving list of all available precipitation stations.") #filepath = r'..\02_data\knmi_locations\stn-prc-available.csv' filepath = 'stn-prc-available.csv' dfprc = knmi.p...
29.074074
76
0.704459
[ "MIT" ]
acequia-package/Acequia
old_tests/test_read_knmistations.py
785
Python
from kivy.core.window import Window from kivy.app import App from kivy.uix.button import Button from kivy.uix.textinput import TextInput from kivy.uix.label import Label from kivy.uix.boxlayout import BoxLayout from kivy.uix.screenmanager import ScreenManager, Screen from ins import * from ruffier import* f...
30.970909
95
0.573676
[ "CC0-1.0" ]
RetiredTea/kettle
main.py
8,742
Python
from rest_framework import serializers class HelloSerializer(serializers.Serializer): """serializers a name field for testing our APIView""" name = serializers.CharField(max_length = 10)
39
58
0.784615
[ "MIT" ]
roith44/JustDijangoApi
profile_api/serializers.py
195
Python
#!/usr/bin/env python3 import iterm2 # To install, update, or remove packages from PyPI, use Scripts > Manage > Manage Dependencies... import subprocess async def main(connection): component = iterm2.StatusBarComponent( short_description = 'k8s current context', detailed_description = 'Dis...
33.242424
98
0.618049
[ "MIT" ]
bassaer/iterm2-k8s-context
k8s-context.py
1,099
Python
# celery settings broker_url = 'amqp://guest:guest@rabbitmq:5672/' result_backend = 'rpc://' accept_content = ['json'] task_serializer = 'json' task_soft_time_limit = 60 * 3 # 3 minute timeout result_serializer = 'json' timezone = 'UTC' enable_utc = True
21.5
49
0.724806
[ "Apache-2.0" ]
phacic/photos_album
config/celeryconfig.py
258
Python
# Copyright (C) 2019-2021 HERE Europe B.V. # SPDX-License-Identifier: Apache-2.0 """This module defines all the configs which will be required as inputs to autosuggest API.""" from .base_config import Bunch class SearchCircle: """A class to define ``SearchCircle`` Results will be returned if they are locat...
25.746032
94
0.663379
[ "Apache-2.0" ]
heremaps/here-location-services-python
here_location_services/config/autosuggest_config.py
1,622
Python
import random import pdb from torchvision.transforms import functional as F from utils.box_list import BoxList def resize(img_list, box_list=None, min_size=None, max_size=None): assert type(min_size) in (int, tuple), f'The type of min_size_train shoule be int or tuple, got {type(min_size)}.' if isinstance(min...
34
118
0.694754
[ "MIT" ]
feiyuhuahuo/PAA_minimal
data/transforms.py
2,516
Python
LAB_SOURCE_FILE = "lab05.py" """ Lab 05: Trees and Proj2 Prep """ def couple(lst1, lst2): """Return a list that contains lists with i-th elements of two sequences coupled together. >>> lst1 = [1, 2, 3] >>> lst2 = [4, 5, 6] >>> couple(lst1, lst2) [[1, 4], [2, 5], [3, 6]] >>> lst3 = ['c', 6]...
25.746803
111
0.540081
[ "MIT" ]
weijiew/cs61a
lab/lab05/lab05.py
10,067
Python
import itertools import re import detectEnglish import freqAnalysis vigenereCipher = __import__('vigenereCipher') LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # SILENT_MODE = False # If set to True, program doesn't print anything. SILENT_MODE = True NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey. MAX_KE...
48.218868
2,051
0.679136
[ "MIT" ]
asiman161/university
crypto/vigenere/vigenere_breaker.py
12,778
Python
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-2020 Dan <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free...
30.149254
103
0.631188
[ "Apache-2.0" ]
Georgiy123456/heroku-userbot
venv/Lib/site-packages/pyrogram/raw/functions/messages/get_dialog_unread_marks.py
2,020
Python
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
33.157407
98
0.685283
[ "Apache-2.0" ]
ghairapetian/digitalbuildings
tools/concrete_model/model/entity.py
3,581
Python
#!/usr/bin/env python #encoding: utf8 import unittest, rostest import rosnode, rospy import time from pimouse_ros.msg import MotorFreqs from geometry_msgs.msg import Twist from std_srvs.srv import Trigger, TriggerResponse from pimouse_ros.srv import TimedMotion class MotorTest(unittest.TestCase): def setUp(self): ...
36.853659
91
0.630046
[ "BSD-3-Clause" ]
ei0410/pimouse_ros
test/travis_test_motors.py
3,022
Python
# Python GLFW hello world example based on C++ guide at # http://www.glfw.org/docs/latest/quick.html import sys import glfw import numpy from OpenGL import GL from OpenGL.GL.shaders import compileShader, compileProgram from OpenGL.arrays import vbo from openvr.glframework.glmatrix import rotate_z, ortho,...
33.426087
73
0.616285
[ "MIT" ]
cmbruns/vr_samples
src/python/vrprim/mesh/glfw_triangle.py
3,844
Python
"""general utility functions for HTML Map templates""" def safe_quotes(text, escape_single_quotes=False): """htmlify string""" if isinstance(text, str): safe_text = text.replace('"', "&quot;") if escape_single_quotes: safe_text = safe_text.replace("'", "&#92;'") return safe...
24.148148
72
0.653374
[ "BSD-3-Clause" ]
CartoDB/cartoframes
cartoframes/viz/html/utils.py
652
Python
import unittest from quarkchain.cluster.tests.test_utils import ( create_transfer_transaction, ClusterContext, ) from quarkchain.core import ( Address, Branch, Identity, TokenBalanceMap, XshardTxCursorInfo, ) from quarkchain.evm import opcodes from quarkchain.utils import call_async, assert_...
45.332616
118
0.58573
[ "MIT" ]
Belgarion/pyquarkchain_cuda
quarkchain/cluster/tests/test_cluster.py
63,239
Python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np # type: ignore import onnx from ..base import Base from . import expect from ..utils import all_numeric_dtypes class Max(Base): @staticmethod ...
32.7
71
0.558104
[ "MIT" ]
15737939656/onnx
onnx/backend/test/case/node/max.py
1,962
Python
import theano.tensor as T import theano import numpy as np from scipy.spatial.distance import pdist, squareform, cdist import random import time ''' Sample code to reproduce our results for the Bayesian neural network example. Our settings are almost the same as Hernandez-Lobato and Adams (ICML15) https://jmhl...
42.714724
188
0.5614
[ "MIT" ]
MinHyung-Kang/Thesis
python/bayesian_nn_subset.py
27,850
Python
''' This file contains test cases for tflearn ''' import tensorflow as tf import zqtflearn import unittest class TestInputs(unittest.TestCase): ''' This class contains test cases for serval input types ''' INPUT_DATA_1 = [ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ] ] INPUT_DATA_2 = [ [ 6 ], [ 7 ], ...
38.186441
119
0.594319
[ "MIT" ]
ZhengDeQuan/AAA
zqtflearn2/tests/test_inputs.py
2,253
Python
# 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 required by applicable law or agreed to...
31.485981
100
0.697536
[ "Apache-2.0" ]
Rossil2012/mindspore
tests/ut/python/parallel/test_transpose.py
3,369
Python
# Quiet TensorFlow. import os import numpy as np # from transformers import AutoTokenizer, TFAutoModelForSequenceClassification, pipeline from transformers import BertTokenizer, BertForSequenceClassification import textattack from textattack import Attacker from textattack.attack_recipes.my_attack.my_textfooler import...
45.021277
137
0.76087
[ "MIT" ]
hbr690188270/SelfTextAttack
experiments/sst/attack_bert_textfooler_sst.py
2,116
Python
from utilities import * from model import get_model from data import get_data, get_loaders from augmentations import get_augs from test_epoch import test_epoch import gc import neptune from accelerate import Accelerator, DistributedType import pandas as pd import numpy as np def run_inference(df, ...
38.154472
97
0.442574
[ "MIT" ]
kozodoi/Pet_Pawpularity
code/run_inference.py
4,693
Python
# -*- coding: utf-8 -*- from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer from settings import Microsoft ''' See the Microsoft DirectLine api documentation for how to get a user access token. https://docs.botframework.com/en-us/restapi/directline/ ''' chatbot = ChatBot( 'Micro...
29.59375
82
0.761352
[ "BSD-3-Clause" ]
Hacker-VP/ChatterBot
examples/microsoft_bot.py
947
Python
import picamera from time import sleep camera = picamera.PiCamera() camera.capture('image.jpg') #camera.resolution = (640, 480) #max resolution is 2592 x 1944 for stills, # 1920 x 1080 (<15fps) for video #camera.framerate = 45 camera.vflip = True camera.start_recording('...
29.142857
78
0.663399
[ "Apache-2.0" ]
harrychowjackson/automated-radishes
src/test.py
612
Python
# coding: utf-8 """ Adobe Experience Manager (AEM) API Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API OpenAPI spec version: 2.2.0 Contact: opensource@shinesolutions.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import ab...
40.217729
130
0.549033
[ "Apache-2.0" ]
hoomaan-kh/swagger-aem
clients/python/generated/swaggeraem/apis/crx_api.py
25,860
Python
import json import re from django.http import JsonResponse from django.db.models import Q from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from apps.vit.models import Vit from apps.notification.utilities import notify from apps.vit.utilities import find_mention, find_plustag from ....
39.111111
146
0.586174
[ "BSD-3-Clause" ]
Visualway/Vitary
apps/vit/api.py
5,280
Python
import math import torch import torch.nn as nn import torch.nn.functional as F #-------------------------------------------------# # MISH激活函数 #-------------------------------------------------# class Mish(nn.Module): def __init__(self): super(Mish, self).__init__() def forward(self, x): re...
37.410112
105
0.463583
[ "MIT" ]
Arcofcosmos/MyYolov4_Pytorch
.history/nets/CSPdarknet_20210816140029.py
7,299
Python
# -*- coding: utf-8 -*- # Scrapy settings for mySpider project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://doc.scrapy.org/en/latest/topics/settings.html # https://doc.scrapy.org/en/latest/topi...
33.945055
102
0.775332
[ "MIT" ]
zxallen/spider
mySpider/mySpider/settings.py
3,089
Python
# Generated by Django 3.1.2 on 2020-12-07 05:13 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('zooniverse', '0006_auto_20201207_0713'), ] operations = [ migrations.CreateModel( ...
29.884615
123
0.615187
[ "MIT" ]
karilint/cradle_of_mankind
quality_control/migrations/0001_initial.py
777
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Code from: https://github.com/michailbrynard/ethereum-bip44-python This submodule provides the PublicKey, PrivateKey, and Signature classes. It also provides HDPublicKey and HDPrivateKey classes for working with HD wallets.""" import os import math import codecs impo...
33.901889
111
0.590135
[ "MIT" ]
ukor/pywallet
pywallet/utils/ethereum.py
55,633
Python
# -*- coding: utf-8 -*- from tkinter import ( Frame, LabelFrame, Text, Scrollbar, Button, Label, RIDGE, W, E, N, S, FLAT, CENTER, SUNKEN, END, INSERT, ) from tkinter.simpledialog import askinteger, askstring from tkinter.messagebox ...
34.039882
95
0.522413
[ "MIT" ]
MircoT/py-pdp8-tk
Emulatore.py
23,048
Python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import sys from pathlib import Path from typing import Any import nevergrad as ng from hydra.core.override_parser.overrides_parser import OverridesParser from hydra.core.plugins import Plugins from hydra.plugins.sweeper import Sweeper from hydra.te...
35.005525
86
0.631629
[ "MIT" ]
beerzyp/hydra
plugins/hydra_nevergrad_sweeper/tests/test_nevergrad_sweeper_plugin.py
6,336
Python
#!/usr/bin/env python3 def sum_recursin(numList): if len(numList) == 1: return numList[0] else: return numList[0] + sum_recursin(numList[1:]) if __name__ == "__main__": print(sum_recursin(list(range(1, 101))))
21.818182
53
0.629167
[ "BSD-2-Clause" ]
zzz0072/Python_Exercises
07_RSI/ch03/sum.py
240
Python
#!/content/Python/bin/python3.6 import os import torch from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension from compiler_args import nvcc_args, cxx_args setup( name='interpolation_cuda', ext_modules=[ CUDAExtension('interpolation_cuda', [ ...
25.285714
67
0.696798
[ "MIT" ]
iBobbyTS/Colab-DAIN
my_package/Interpolation/setup.py
531
Python
# Copyright 2018-2020 Streamlit Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
35.168652
278
0.576087
[ "Apache-2.0" ]
OakNorthAI/streamlit-base
lib/streamlit/DeltaGenerator.py
112,188
Python
import numpy as np import matplotlib.pyplot as plt ts = np.load("ts.npy") ts -= ts[0] xs = np.load("xs.npy") print("ts shape: {0}".format(np.shape(ts))) print("xs shape: {0}".format(np.shape(xs))) plt.figure() plt.scatter(ts, xs) plt.show()
16.333333
43
0.64898
[ "MIT" ]
ThatSnail/synth_detune
plotter.py
245
Python
class Solution: def numSpecialEquivGroups(self, A: List[str]) -> int: S = set() for s in A: S.add(''.join(sorted(s[::2]) + sorted(s[1::2]))) return len(S)
25
55
0.56
[ "MIT" ]
chopchap/leetcode
Algorithms/String/893. Groups of Special-Equivalent Strings.py
175
Python
from collections import OrderedDict import numpy as np from gym.spaces import Box, Dict from multiworld.envs.env_util import get_stat_in_paths, \ create_stats_ordered_dict, get_asset_full_path from multiworld.core.multitask_env import MultitaskEnv from multiworld.envs.mujoco.sawyer_xyz.push.sawyer_push import SawyerP...
32.207965
166
0.668636
[ "MIT" ]
Neo-X/R_multiworld
multiworld/envs/mujoco/sawyer_xyz/pickPlace/sawyer_coffee.py
7,279
Python
from armstrong.core.arm_sections import utils from armstrong.core.arm_sections.models import Section from ._utils import ArmSectionsTestCase, override_settings from .support.models import SimpleCommon def rel_field_names(rels): return [rel.field.name for rel in rels] class get_configured_item_modelTestCase(Arm...
44.180556
99
0.762339
[ "Apache-2.0" ]
armstrong/armstrong.core.arm_sections
tests/utils.py
3,181
Python
import setuptools from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="ChromedriverInstall", version="0.0.1", long_description=long_description, long_description_content_type="text/markdown", packages=setuptools.find_packages(), entry_po...
22.263158
108
0.742317
[ "MIT" ]
SagaOfAGuy/Chromedriver-Install
setup.py
423
Python
""" Evolutionary optimization of something """ import random import multiprocessing import numpy as np import numpy.random as npr import matplotlib.pylab as plt from tqdm import tqdm from automata import SnowDrift class EvolutionaryOptimizer(object): """ Optimize! """ def __init__(self): """ ...
25.032051
81
0.580026
[ "MIT" ]
kpj/PySpaMo
evolutionary_optimization.py
3,905
Python
"""Define SetConfig message.""" # System imports # Third-party imports # Local imports from pyof.v0x01.common.header import Type from pyof.v0x01.controller2switch.common import SwitchConfig __all__ = ('SetConfig',) class SetConfig(SwitchConfig): """Set config message.""" def __init__(self, xid=None, flag...
28.896552
71
0.663484
[ "MIT" ]
Niehaus/python-openflow
pyof/v0x01/controller2switch/set_config.py
838
Python
import numpy as np import scipy.interpolate from numpy import polyint, polymul, polyval from scipy.interpolate import BSpline as SciBSpline, PPoly from ..._utils import _domain_range from ._basis import Basis class BSpline(Basis): r"""BSpline basis. BSpline basis elements are defined recursively as: .....
35.566952
79
0.5467
[ "BSD-3-Clause" ]
alejandro-ariza/scikit-fda
skfda/representation/basis/_bspline.py
12,484
Python
import json import logging import traceback from google.appengine.api import taskqueue from google.appengine.ext import ndb from helpers.cache_clearer import CacheClearer from helpers.firebase.firebase_pusher import FirebasePusher from helpers.notification_helper import NotificationHelper from helpers.manipulator_bas...
38.865031
136
0.581058
[ "MIT" ]
bvisness/the-blue-alliance
helpers/match_manipulator.py
6,335
Python
"""Test config validators.""" from datetime import timedelta, datetime, date import enum import os from socket import _GLOBAL_DEFAULT_TIMEOUT from unittest.mock import Mock, patch import pytest import voluptuous as vol import homeassistant.helpers.config_validation as cv def test_boolean(): """Test boolean vali...
24.199667
79
0.569582
[ "Apache-2.0" ]
AidasK/home-assistant
tests/helpers/test_config_validation.py
14,544
Python
#!/usr/bin/env python from wsgiref.simple_server import make_server import sys import os import json import urlparse import json EXTRA_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__))) if EXTRA_DIR not in sys.path: sys.path.append(EXTRA_DIR) import dao try: import requests except ImportError:...
23.75
69
0.688722
[ "MIT" ]
simonmikkelsen/mapillary-browser
api/getTags.py
1,330
Python
import io import os import ssl import boto3 import gzip import json import time import uuid import unittest import datetime import requests from io import BytesIO from pytz import timezone from botocore.exceptions import ClientError from six.moves.urllib.request import Request, urlopen from localstack import config fro...
41.718584
119
0.638751
[ "Apache-2.0" ]
Josemaralves/localstack
tests/integration/test_s3.py
70,713
Python
# Generated by Django 2.2.1 on 2019-11-18 10:44 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0020_auto_20191112_1048'), ] operations = [ migrations.AlterModelOptions( name='payment', options={'ordering': ('dat...
22.722222
109
0.611247
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
OS2bos/OS2bos
backend/core/migrations/0021_auto_20191118_1144.py
409
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 10 19:37:19 2018 @author: kaustabh """ #making a single list representing all sides in a serial fashion r = ['w1','w2','w3','w4','w5','w6','w7','w8','w9','b1','b2','b3','r1','r2','r3','g1','g2','g3','o1','o2','o3','b4','b5','b6','r4','r5','r6',...
24.701639
276
0.335678
[ "MIT" ]
KaustabhGanguly/RemixRubiks
Rubikmovement.py
7,534
Python
from pavilion import result_parsers import yaml_config as yc import re import sre_constants class Regex(result_parsers.ResultParser): """Find matches to the given regex in the given file. The matched string or strings are returned as the result.""" def __init__(self): super().__init__(name='regex...
39.06
79
0.46979
[ "BSD-3-Clause" ]
ubccr/pavilion2
lib/pavilion/plugins/results/regex.py
7,812
Python
#define functions that will extract the data from SDSS based on an input RA/DEC from astroquery.sdss import SDSS from astropy import coordinates as coords import pandas as pd from astroquery.ned import Ned import matplotlib.pyplot as plt from astropy.convolution import convolve, Box1DKernel import numpy as np from a...
34.722222
147
0.666764
[ "MIT" ]
sofiapasquini/Code-Astro-Group-23-Project
exampledoc/Extractor.py
6,875
Python