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 keras
from sklearn.metrics import roc_auc_score
from src.predictionAlgorithms.machineLearning.helpers.validation import Validation
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
class Callbacks(keras.callbacks.Callback):
validationSequences =... | 28 | 82 | 0.597595 | [
"MIT"
] | aivaras-ciurlionis/meteo | src/predictionAlgorithms/machineLearning/helpers/callbacks.py | 2,828 | Python |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | 32.617021 | 76 | 0.643183 | [
"Apache-2.0"
] | UbuntuEvangelist/hacking | hacking/checks/dictlist.py | 1,533 | Python |
# Source:https://github.com/Show-Me-the-Code/show-me-the-code
# Author:renzongxian
# Date:2014-11-30
# Python 3.4
"""
第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码
(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
"""
import uuid
def generate_key():
key_list = []
for i in range(200):
uuid_key = uuid.... | 19.076923 | 68 | 0.663306 | [
"MIT"
] | 11deepak0209/python | renzongxian/0001/0001.py | 606 | Python |
from art import logo_blackjack
from replit import clear
import random
def deal_card():
"""Return random card"""
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
card = random.choice(cards)
return card
def calculate_score(cards):
"""Take a list of cards and return the score"""
if sum(cards)... | 36.123288 | 102 | 0.665908 | [
"Apache-2.0"
] | Yunram/python_training | Programs/day_11_blackjack.py | 2,637 | Python |
#quest by zerghase
import sys
from com.l2jfrozen import Config
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
qn = "43_HelpTheSister"
COOPER=30829
GALLADUCCI=30097
CRAFTE... | 28.919355 | 170 | 0.652259 | [
"Unlicense"
] | DigitalCoin1/L2SPERO | datapack/data/scripts/quests/43_HelpTheSister/__init__.py | 3,586 | Python |
# Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 34.315789 | 86 | 0.592216 | [
"Apache-2.0"
] | pschuh/flax | tests/linen/linen_linear_test.py | 10,432 | Python |
import os, sys, shutil, glob, math
import regex as re
from doconce import globals
from .doconce import read_file, write_file, doconce2format, handle_index_and_bib, preprocess
from .misc import option, help_print_options, check_command_line_options, system, _abort, \
find_file_with_extensions, folder_checker, doconc... | 46.156379 | 125 | 0.642118 | [
"BSD-3-Clause"
] | aless80/doconce | lib/doconce/jupyterbook.py | 33,648 | Python |
from collections import defaultdict
from hsst.utility import search
from hsst.utility.graph import SemanticGraph
class SubgraphEnumeration(object):
def __init__(self, graph, node_set_size_limit=0):
self.full_node_set = graph.nodes
self.full_edge_set = graph.edges
self.current_node_set =... | 38.898305 | 115 | 0.652505 | [
"MIT"
] | matichorvat/hsst | hsst/utility/dfs_subgraph_enumeration.py | 4,590 | Python |
import os
import h5py
import numpy as np
from keras import backend as K
from keras.layers import Activation, BatchNormalization, Conv2D, Dense, Dot, \
Dropout, Flatten, Input, MaxPooling2D, GlobalAveragePooling2D
from keras import regularizers
from keras.layers import Average as KerasAverage
from keras.models imp... | 26.539583 | 79 | 0.605464 | [
"MIT"
] | paschalidoud/raynet | raynet/models.py | 12,739 | Python |
from models import Supervisor
import unittest
class SupervisorTestCase(unittest.TestCase):
def setUp(self):
self.supervisor = Supervisor.login('Mohammad', '1234', '0123456')
self.sample = Supervisor.sample()
def test_all_data(self):
self.assertIsInstance(self.supervisor, Supervisor,
... | 41.357143 | 73 | 0.609672 | [
"MIT"
] | mhgzadeh/unit-testing-python | main.py | 1,158 | Python |
"""
module init
"""
from flask import Flask
<<<<<<< HEAD
from config import config_options
from flask_sqlalchemy import SQLAlchemy
import os
=======
from config import DevelopmentConfig
from .views import orders_blue_print
>>>>>>> ba86ec7ade79a936b81e04ee8b80a97cf8f97770
def create_app(DevelopmentConfig):
"""
... | 21.118644 | 56 | 0.693419 | [
"MIT"
] | codebr3ak/Fast-Food-Fast | app/__init__.py | 1,246 | Python |
# DO NOT EDIT THIS FILE!
#
# All configuration must be done in the `configuration.py` file.
# This file is part of the Peering Manager code and it will be overwritten with
# every code releases.
from __future__ import unicode_literals
import os
import socket
from django.contrib.messages import constants as messages
... | 28.195745 | 156 | 0.641111 | [
"Apache-2.0"
] | amtypaldos/peering-manager | peering_manager/settings.py | 6,626 | Python |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' file acc... | 32.627451 | 77 | 0.722957 | [
"Apache-2.0"
] | ChaiBapchya/sagemaker-training-toolk | src/sagemaker_training/_entry_point_type.py | 1,664 | Python |
# Lint as: python2, python3
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 44.179487 | 80 | 0.667054 | [
"Apache-2.0"
] | zhaowt96/models | research/object_detection/builders/calibration_builder_test.py | 10,338 | Python |
"""
Leetcode 70.
Climbing Stairs.
DP.
类似斐波那契数列:
转移方程: f(n) = f(n-1) + f(n-2).
时间复杂度:O(n)
还是没看明白这跟DP有啥关系,就是递归而已。
"""
class Solution:
def climbStairs(self, n: int) -> int:
res = [-1] * (n)
def dfs(n):
if n == 1:
return 1
if n == 2:
return 2
... | 19.148148 | 46 | 0.40619 | [
"MIT"
] | vandesa003/leetcode_algo | dp/climbing_stairs.py | 597 | Python |
import apache
if apache.version == (2, 2):
from apache22.util_script import *
else:
raise RuntimeError('Apache version not supported.')
| 20.714286 | 55 | 0.717241 | [
"Apache-2.0"
] | GrahamDumpleton-abandoned/apswigpy | apache/util_script.py | 145 | Python |
import logging
from collections import Counter
from itertools import chain
import numpy as np
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import pairwise_distances
from pysrc.papers.analysis.text import get_frequent_tokens
logger = logging.getLogger(__name__)
def compute_topics_similar... | 46.117647 | 118 | 0.67331 | [
"Apache-2.0"
] | JetBrains-Research/pubtrends | pysrc/papers/analysis/topics.py | 6,272 | Python |
# Copyright (c) Chris Choy (chrischoy@ai.stanford.edu).
#
# 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, ... | 35.194286 | 99 | 0.624696 | [
"MIT"
] | zarzarj/MinkowskiEngine | examples/minkunet.py | 12,318 | Python |
#! /usr/bin/env python
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the build configuration tools of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL21$
## Commercial License Usag... | 34.45098 | 132 | 0.581816 | [
"Apache-2.0"
] | wgnet/wds_qt | qtmultimedia/tests/auto/runautotests.py | 7,028 | Python |
import warnings
import numpy as np
from nilearn.plotting import cm
from nilearn.plotting.js_plotting_utils import decode
from nilearn.plotting import html_connectome
from .test_js_plotting_utils import check_html
def test_prepare_line():
e = np.asarray([0, 1, 2, 3], dtype=int)
n = np.asarray([[0, 1], [0, 2... | 40.436893 | 78 | 0.508283 | [
"BSD-2-Clause"
] | JohannesWiesner/nilearn | nilearn/plotting/tests/test_html_connectome.py | 8,330 | Python |
import numpy as np
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
dataset = load_boston()
X = dataset.data
y = dataset.target
mean = X.mean(axis=0)
std = X.std(axis=0)
X = (X-mean)/std
# print(X)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
n_tr... | 21.271186 | 72 | 0.636653 | [
"Apache-2.0"
] | ZXTFINAL/deeplearning | 1_boston.py | 1,285 | Python |
# Name:
# Date:
# proj02: sum
# Write a program that prompts the user to enter numbers, one per line,
# ending with a line containing 0, and keep a running sum of the numbers.
# Only print out the sum after all the numbers are entered
# (at least in your final version). Each time you read in a number,
# you can immed... | 35.137931 | 84 | 0.697743 | [
"MIT"
] | ryanaspears/VSA | proj02_loops/proj02_01.py | 1,019 | Python |
#!/usr/bin/env python
"""
convert corpus to annotated corpus
This script uses nltk for dependency parsing, which is based on stanford corenlp.
"""
import os
from nltk.parse.stanford import *
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('corenlp_path',
help='Dir... | 43.784314 | 211 | 0.631438 | [
"Apache-2.0"
] | berntham/vsmlib | vsmlib/embeddings/bofang/annotate_corpus_nltk.py | 4,466 | Python |
#!/usr/bin/python
#
# Copyright JS Foundation and other contributors, http://js.foundation
#
# 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
# Unles... | 32.091667 | 108 | 0.497923 | [
"Apache-2.0"
] | 3anology/node-red | packages/node_modules/@node-red/nodes/core/hardware/nrgpio.py | 7,702 | Python |
# Import Basic modules
import numpy as np
import os
# Import everything needed to edit video clips
from moviepy.editor import *
from moviepy.Clip import *
from moviepy.video.VideoClip import *
from moviepy.config import get_setting # ffmpeg, ffmpeg.exe, etc...
class AudioProcessing:
# documentation stri... | 20.57265 | 108 | 0.617366 | [
"Unlicense"
] | papar22/livius | livius/audio/audioProcessing.py | 2,407 | Python |
# Copyright 2016-2018 Dirk Thomas
# Licensed under the Apache License, Version 2.0
from collections import defaultdict
from collections import OrderedDict
import itertools
import os
from pathlib import Path
from colcon_core.package_selection import add_arguments \
as add_packages_arguments
from colcon_core.packag... | 42.496855 | 79 | 0.492896 | [
"Apache-2.0"
] | chapulina/colcon-package-information | colcon_package_information/verb/graph.py | 13,514 | Python |
#!/usr/bin/env python
# encoding: utf-8
'''
@project : MSRGCN
@file : cmu_runner.py
@author : Droliven
@contact : droliven@163.com
@ide : PyCharm
@time : 2021-07-28 13:29
'''
from datas import CMUMotionDataset, get_dct_matrix, reverse_dct_torch, define_actions_cmu, draw_pic_gt_pred
from nets import MSRGCN,... | 45.378182 | 215 | 0.550845 | [
"MIT"
] | Droliven/MSRGCN | run/cmu_runner.py | 12,529 | Python |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory tha... | 31.395683 | 98 | 0.581118 | [
"MIT"
] | 26rahulsingh/new | contrib/seeds/generate-seeds.py | 4,364 | Python |
class Type:
def __init__(self):
pass
def get_repr(self):
return self
def __repr__(self):
return self.get_repr().stringify()
def stringify(self):
return ""
def put_on_stack(self, stack):
stack.put(self.get_repr())
def take_from_stack(self, stack):
... | 29.182266 | 148 | 0.58339 | [
"MIT"
] | dstep/old_jf_compiler | utils/parsxv2/typesystem.py | 5,924 | Python |
"""
logan.runner
~~~~~~~~~~~~
:copyright: (c) 2012 David Cramer.
:license: Apache License 2.0, see NOTICE for more details.
"""
import argparse
import os
import re
import sys
from django.core import management
from nautobot import __version__
from . import importer
from .settings import create_default_settings
__... | 29.083942 | 119 | 0.651148 | [
"Apache-2.0"
] | Joezeppe/nautobot | nautobot/core/runner/runner.py | 7,969 | Python |
from __future__ import annotations
from typing import Optional, Type, TYPE_CHECKING
import actor
from actions.ai import BasicMonster
import graphic
from inventory import Inventory
if TYPE_CHECKING:
from actions import Action
from location import Location
class Fighter(graphic.Graphic):
render_order = ... | 22.722222 | 70 | 0.683374 | [
"MIT"
] | Belvarm/roguelike-tutorial | races/__init__.py | 818 | Python |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 34.069444 | 111 | 0.6596 | [
"Apache-2.0"
] | JMichaelStringer/NeMo | nemo/collections/nlp/data/text_normalization/utils.py | 2,453 | Python |
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "... | 32.675381 | 78 | 0.62295 | [
"MIT"
] | bopopescu/JobSniperRails | gcloud/google-cloud-sdk/.install/.backup/lib/third_party/dns/rdata.py | 14,998 | Python |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 23 15:54:01 2018
@author: shinyonsei2
"""
import numpy as np
import imageio
def read_pfm(fpath, expected_identifier="Pf"):
# PFM format definition: http://netpbm.sourceforge.net/doc/pfm.html
def _get_next_line(f):
next_line = f.readline().decode('... | 34.485981 | 122 | 0.566938 | [
"MIT"
] | marmus12/CornerView | epinet_fun/util.py | 3,690 | Python |
# Copyright 2020 University of New South Wales, University of Sydney
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by app... | 39.28259 | 119 | 0.573898 | [
"Apache-2.0"
] | RadiotherapyAI/platipy | platipy/dicom/io/crawl.py | 44,900 | Python |
"""
Conjuntos são chamados de set's
- Set não possui duplicidade
- Set não possui valor ordenado
- Não são acessados via indice, ou seja, não são indexados
Bons para armazenar elementos são ordenação, sem se preocupar com chaves, valores e itens duplicados.
Set's são referenciados por {}
Diferença de set e dict
- Dic... | 31.863014 | 117 | 0.479364 | [
"MIT"
] | PauloFTeixeira/curso_python | Secao7_ColecoesPython/Conjutos.py | 4,683 | Python |
version = '1.6.4'
| 9 | 17 | 0.555556 | [
"MIT"
] | caniko/tridesclous | tridesclous/version.py | 18 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import builderutils.parser as parser
import builderutils.renderer as renderer
import builderutils.dom as dom
@click.group()
def cli():
pass
@click.command()
@click.option("--configfile", type=click.Path(), help="Builder config", required=True)
def crea... | 25.181818 | 86 | 0.723827 | [
"Apache-2.0"
] | bdastur/builder | builder/builder.py | 1,108 | Python |
from .treasury_yields import Treasury_Yield_Task
from .mariadb import Mariadb_Task
from .bea import BEA_Task
from .yfinance import Yfinance_Task | 36.75 | 49 | 0.85034 | [
"MIT"
] | samsea18/Treasury-Yield-Analysis | treasury_yield_analysis/task/__init__.py | 147 | Python |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template_file: python-cli-command.j2
# justice-platform-service (4.10.0)
# pylint: disable=duplicate-co... | 30.054054 | 88 | 0.718525 | [
"MIT"
] | AccelByte/accelbyte-python-sdk | samples/cli/accelbyte_py_sdk_cli/platform/_download.py | 2,224 | Python |
import unittest
import numpy as np
import string
from pyffm.util import Map
class TestMap(unittest.TestCase):
def test_basic(self):
map1 = Map()
map_size_to_test = 1000
all_letters = string.ascii_uppercase + string.ascii_lowercase
counter = 0
for char in "".join(
... | 26.5 | 69 | 0.610063 | [
"MIT"
] | mascaroa/pyffm | pyffm/test/test_utils.py | 636 | Python |
"""
Credentials used when making CLIs.
"""
from pathlib import Path
from dcos_e2e.cluster import Cluster
DEFAULT_SUPERUSER_USERNAME = 'bootstrapuser'
DEFAULT_SUPERUSER_PASSWORD = 'deleteme'
def add_authorized_key(cluster: Cluster, public_key_path: Path) -> None:
"""
Add an authorized key to all nodes in th... | 22 | 72 | 0.540541 | [
"Apache-2.0"
] | dcos/dcos-e2e | src/dcos_e2e_cli/common/credentials.py | 814 | Python |
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from scipy.spatial import KDTree, Voronoi, voronoi_plot_2d
np.random.seed(42)
data = np.random.rand(25, 2)
vor = Voronoi(data)
print('Using scipy.spatial.voronoi_plot_2d, wait...')
voronoi_plot_2d(vor)
xlim = plt.xlim()
ylim = plt.ylim(... | 25.166667 | 69 | 0.701987 | [
"MIT"
] | Drishttii/pyprobml | scripts/knn_voronoi_plot.py | 755 | Python |
"""Some miscellaneous utility functions."""
from contextlib import contextmanager
import os
import re
import sys
import warnings
import unittest
from fnmatch import fnmatchcase
from io import StringIO
from numbers import Number
# note: this is a Python 3.3 change, clean this up for OpenMDAO 3.x
try:
from collectio... | 27.180818 | 97 | 0.607161 | [
"Apache-2.0"
] | DKilkenny/OpenMDAO | openmdao/utils/general_utils.py | 34,574 | Python |
import json
import os
srt_path = '/home/lyp/桌面/MAE_论文逐段精读【论文精读】.457423264.zh-CN.srt'
json_path = '/home/lyp/桌面/caption.json'
txt_path = '/home/lyp/桌面'
def srt2txt(path):
out_path= os.path.join(txt_path,path.split('.')[0]+'.txt')
with open(path,'r+') as f:
with open(out_path, 'w+') as out:
fo... | 36.36 | 73 | 0.585259 | [
"MIT"
] | lyp2333/External-Attention-pytorch | test_model/utils/caption2txt.py | 945 | Python |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.3 Python SDK
Pure Storage FlashBlade REST 1.3 Python SDK, 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.3
Contact: i... | 42.981172 | 204 | 0.585933 | [
"Apache-2.0"
] | asun-ps/purity_fb_python_client | purity_fb/purity_fb_1dot3/apis/network_interfaces_api.py | 20,545 | Python |
"""
This project demonstrates NESTED LOOPS (i.e., loops within loops)
in the context of SEQUENCES OF SUB-SEQUENCES.
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues,
and Lucas D'Alesio.
""" # DONE: 1. PUT YOUR NAME IN THE AB... | 36.935035 | 79 | 0.519002 | [
"MIT"
] | dalesil/19-MoreLoopsWithinLoops | src/m3_more_nested_loops_in_sequences.py | 15,919 | Python |
import unittest
import textwrap
from typing import Any, List
from hstest.check_result import CheckResult
from hstest.stage_test import StageTest
from hstest.test_case import TestCase
class FeedbackOnExceptionTest4(StageTest):
def generate(self) -> List[TestCase]:
return [
TestCase(feedback_o... | 27.571429 | 65 | 0.606218 | [
"MIT"
] | AlexandruPopa88/Hypercar-Service-Center | Hypercar Service Center/task/hypercar/hs-test-python-2.0.1/tests/outcomes/feedback_on_exception_test_4/test.py | 1,158 | Python |
'''
BVH Parser Class
By Omid Alemi
Created: June 12, 2017
Based on: https://gist.github.com/johnfredcee/2007503
'''
import re
import numpy as np
from data import Joint, MocapData
class BVHScanner:
'''
A wrapper class for re.Scanner
'''
def __init__(self):
def identifier(scanner, token):
... | 33.831967 | 152 | 0.586796 | [
"MIT"
] | seanschneeweiss/RoSeMotion | app/resources/pymo/pymo/parsers.py | 8,255 | Python |
import requests
import logging
import os
import selenium
import unittest
import time
import requests, re
from django.core.management.base import BaseCommand
from search.models import Product, Category, DetailProduct
from django.db import IntegrityError
from django.core.exceptions import MultipleObjectsReturned
from lo... | 38.470149 | 112 | 0.668477 | [
"MIT"
] | pythonmentor/david-p8 | search/management/commands/test_selenium.py | 5,155 | Python |
import asyncio
import datetime
import importlib
import itertools
import os
import random
import re
import shutil
import signal
import subprocess
import sys
import time
import zipfile
import discord
import psutil
from src import const
from src.algorithms import levenshtein_distance
from src.bc import DoNotUpdateFlag
f... | 46.596296 | 118 | 0.604443 | [
"MIT"
] | SergeyKonnov/walbot | src/bot.py | 25,162 | Python |
from typing import List, Dict
from DataObjects.ClassCluster import Cluster
from Murphi.ModularMurphi.MurphiTokens import MurphiTokens
from Murphi.ModularMurphi.TemplateClass import TemplateHandler
from DataObjects.ClassMachine import Machine
class GenModStateFunc(MurphiTokens, TemplateHandler):
def __init__(se... | 39 | 104 | 0.660684 | [
"MIT"
] | icsa-caps/HieraGen | Murphi/ModularMurphi/GenModStateFunc.py | 1,170 | Python |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Run Regression Test Suite
This module calls down into individual test cases via subprocess. It will
... | 31.663043 | 163 | 0.638174 | [
"MIT"
] | LumoCash2018/LumoCash | qa/pull-tester/rpc-tests.py | 8,739 | Python |
'''
URL: https://leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/
Difficulty: Easy
Description: Maximum Nesting Depth of the Parentheses
A string is a valid parentheses string (denoted VPS) if it meets one of the following:
It is an empty string "", or a single character not equal to "(" or ")",
It c... | 25.115942 | 118 | 0.58569 | [
"MIT"
] | AtharvRedij/leetcode-solutions | 1614 Maximum Nesting Depth of the Parentheses.py | 1,733 | Python |
from django.core.management.base import BaseCommand
from django.contrib.admin.models import LogEntry
def clear_old_admin_logs():
logs = LogEntry.objects.all()
for i in range(2000, len(logs)):
logs[i].delete()
class Command(BaseCommand):
def handle(self, *args, **options):
clear_old_admi... | 21.933333 | 51 | 0.705167 | [
"MIT"
] | HelloMelanieC/FiveUp | courier/management/commands/clear_old_admin_logs.py | 329 | Python |
def remove_nan_entries(df, key_columns, verbose=True):
n_row = len(df)
for column in key_columns:
df = df[df[column] == df[column]]
if verbose:
print("Prune ({}/{}) rows.".format(n_row - len(df), n_row))
return df
def parse_relationship_path(relationship_path):
# TODO: get the rela... | 41.375 | 99 | 0.643882 | [
"MIT"
] | sibyl-dev/VBridge | vbridge/utils/entityset_helpers.py | 5,296 | Python |
from django.test import TestCase
# Create your tests here.
class Account(TestCase):
def test_register(self):
self.assertTrue(True)
| 14.7 | 32 | 0.714286 | [
"MIT"
] | youngershen/hhcms | hhcms/apps/account/tests.py | 147 | Python |
import gc
import string
import random
class ActiveGarbageCollection:
def __init__(self, title):
assert gc.isenabled(), "Garbage collection should be enabled"
self.title = title
def __enter__(self):
self._collect("start")
return self
def __exit__(self, exc_type, exc_val, ... | 31.639344 | 95 | 0.684456 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Amsterdam/GOB-Upload | src/gobupload/utils.py | 1,930 | Python |
import tensorflow as tf
import cPickle as pickle
import rnn_model
import cnn_model
from dataloader import Dataloader
import os
import datetime
import numpy as np
import argparse
from cnn_model import unroll
def main():
parser = argparse.ArgumentParser(description='Evaluate .')
parser.add_argument('rundir', ty... | 41.309524 | 192 | 0.594566 | [
"MIT"
] | TUM-LMF/fieldRNN | evaluate.py | 12,145 | Python |
#! /usr/bin/env python
# coding=utf-8
import os
import time
import shutil
import numpy as np
import tensorflow as tf
import core.utils as utils
from tqdm import tqdm
from core.dataset import Dataset
from core.yolov3 import YOLOV3
from core.config import cfg
class YoloTrain(object):
def __init__(self): # 从config文... | 51.978142 | 130 | 0.610387 | [
"MIT"
] | Byronnar/tensorflow-serving-yolov3 | train.py | 9,978 | Python |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
from collections import namedtuple
from flask import session
from flask.ext.lo... | 37.8 | 79 | 0.737997 | [
"ECL-2.0",
"Apache-2.0"
] | sriharshakappala/ggrc-core | src/ggrc/rbac/permissions_provider.py | 5,103 | Python |
"""
Django settings for session_words project.
Generated by 'django-admin startproject' using Django 1.11.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
im... | 25.696721 | 91 | 0.698565 | [
"MIT"
] | justnclrk/Python | Django/session_words/session_words/settings.py | 3,135 | Python |
import unittest
import tfexpt
import expt
from tensorlog import matrixdb
from tensorlog import program
from tensorlog import dataset
class TestNative(unittest.TestCase):
def setUp(self):
(self.n,self.maxD,self.epochs) = (16,8,20)
(self.factFile,trainFile,testFile) = expt.genInputs(self.n)
# (self.factF... | 33.5 | 120 | 0.71981 | [
"Apache-2.0"
] | TeamCohen/TensorLog | datasets/grid/testexpt.py | 1,474 | Python |
import hashlib
import random
from typing import Tuple, Dict
from self_driving.beamng_config import BeamNGConfig
from self_driving.beamng_evaluator import BeamNGEvaluator
from core.member import Member
from self_driving.catmull_rom import catmull_rom
from self_driving.road_bbox import RoadBoundingBox
from self_driving.... | 37.67027 | 143 | 0.634094 | [
"MIT"
] | IharBakhanovich/DeepHyperion | DeepHyperion-BNG/self_driving/beamng_member.py | 6,969 | Python |
#
# Copyright 2019 The FATE 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... | 37.05618 | 126 | 0.595512 | [
"Apache-2.0"
] | 0xqq/FATE | federatedml/feature/feature_scale/standard_scale.py | 6,596 | Python |
# -*- coding: utf-8 -*
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
----------------------------------------------... | 44.882353 | 111 | 0.753277 | [
"MIT"
] | Chromico/bk-base | src/api/auth/bkiam/urls.py | 3,088 | Python |
#link (https://neps.academy/problem/443)
voltas,placas= input().split()
result = int(voltas) * int(placas)
numbers = []
resultado = result * float(str(0) + str('.') + str(1))
for x in range(2,11):
if int(resultado)==resultado:
numbers.append(int(resultado))
else:
numbers.append(int(resultado)+1... | 26.9375 | 58 | 0.607889 | [
"MIT"
] | Filipe-uefs/Algoritmos | Python/Hora da Corrida - SBC 2019.py | 431 | Python |
class UserError(Exception):
def __init__(self, message):
self.message = message
class UserNotFoundError(UserError):
pass
class UserAlreadyRegisteredError(UserError):
pass
class InvalidEmailError(UserError):
pass
class IncorrectPasswordError(UserError):
pass
| 13.454545 | 44 | 0.733108 | [
"MIT"
] | nealwobuhei/pricing-service | models/user/errors.py | 296 | Python |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages = ['youbot_behavior_simple_test'],
package_dir = {'': 'src'}
)
setup(**d) | 21.727273 | 60 | 0.748954 | [
"BSD-3-Clause"
] | FlexBE/youbot_behaviors | behaviors/youbot_behavior_simple_test/setup.py | 239 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tethys_datasets', '0002_auto_20150119_1756'),
]
operations = [
migrations.CreateModel(
name='SpatialDatasetServi... | 40.0625 | 227 | 0.613885 | [
"BSD-2-Clause"
] | CI-WATER/django-tethys_datasets | tethys_datasets/migrations/0003_spatialdatasetservice.py | 1,282 | Python |
import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
from keras.applications.mobilenet import preprocess_input
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Model
from keras.optimizers import Adam
from keras.callbacks import Mode... | 39.93617 | 86 | 0.546084 | [
"MIT"
] | We-Gold/Malaria | train_more.py | 1,877 | Python |
import subprocess
subprocess.call(["/usr/bin/python", "innotest.py"])
print "1-0"
subprocess.call(["/usr/bin/time","-v","-otiming", "./innotest", "0", "1", "0"])
print "4-0"
subprocess.call(["/usr/bin/time","-v","-otiming","--append","./innotest", "0", "4", "0"])
print "8-0"
subprocess.call(["/usr/bin/tim... | 44.16129 | 95 | 0.569759 | [
"Apache-2.0"
] | AYCH-Inc/aych.tron.realm | test/experiments/bench.py | 1,369 | Python |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Interface to the Stanford Part-of-speech and Named-Entity Taggers
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Nitin Madnani <nmadnani@ets.org>
# Rami Al-Rfou' <ralrfou@cs.stonybrook.edu>
# URL: <http://nltk.org/>
# For license information, see LICENSE.T... | 39.685279 | 183 | 0.637375 | [
"Apache-2.0"
] | Edu-Glez/Bank_sentiment_analysis | env/lib/python3.6/site-packages/nltk/tag/stanford.py | 7,818 | Python |
##############################################################################
#
# Copyright 2019 Leap Beyond Emerging Technologies B.V. (unless otherwise stated)
#
# 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... | 31.932039 | 95 | 0.652174 | [
"Apache-2.0"
] | LeapBeyond/catwalk | catwalk/cicd/build_steps.py | 3,289 | Python |
#!/usr/bin/env python
#
# Copyright (c) 2014 Google, Inc
#
# SPDX-License-Identifier: GPL-2.0+
#
# Intel microcode update tool
from optparse import OptionParser
import os
import re
import struct
import sys
MICROCODE_DIR = 'arch/x86/dts/microcode'
class Microcode:
"""Holds information about the microcode for... | 34.823899 | 90 | 0.564475 | [
"Apache-2.0"
] | CAFA1/afl | qemu_mode/qemu-2.10.0/roms/u-boot/tools/microcode-tool.py | 11,074 | Python |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2007-2008 Trolltech ASA. All rights reserved.
##
## This file is part of the example classes of the Qt Toolkit.
##
## Licensees holding a valid Qt License Agreement may use this file in
## accordance... | 35.822695 | 89 | 0.643833 | [
"EPL-1.0"
] | Southpaw-TACTIC/Team | src/python/Lib/site-packages/PySide/examples/phonon/capabilities.py | 5,051 | 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,... | 31.453333 | 78 | 0.680797 | [
"Apache-2.0"
] | CodingFanSteve/google-auth-library-python | google/auth/_service_account_info.py | 2,359 | Python |
"""
ASGI config for infosafe project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETT... | 23.117647 | 78 | 0.78626 | [
"Apache-2.0"
] | royaleagle-dev/infosafe | infosafe/asgi.py | 393 | Python |
from rest_framework import generics
from rest_framework.exceptions import NotFound
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from workprogramsapp.expertise.models import UserExpertise, ExpertiseComments, Expertise
from workprogramsapp.expertise.serializers import UserE... | 38.253247 | 135 | 0.733831 | [
"MIT"
] | 18ariana/analytics_backend | application/workprogramsapp/expertise/views.py | 6,570 | Python |
import datetime
from ..errors import NaiveDateTimeNotAllowed
from ..ewsdatetime import EWSDateTime
from ..util import create_element, set_xml_value, xml_text_to_value, peek, TNS, MNS
from ..version import EXCHANGE_2010
from .common import EWSService
class GetServerTimeZones(EWSService):
"""
MSDN: https://msd... | 50.12069 | 117 | 0.596491 | [
"BSD-2-Clause"
] | dsanghan/exchangelib | exchangelib/services/get_server_time_zones.py | 5,814 | Python |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36.413793 | 97 | 0.726136 | [
"Apache-2.0"
] | danielmawhirter/tf_1_0 | tensorflow/tensorboard/plugins/projector/projector_plugin_test.py | 5,280 | Python |
#!/usr/bin/python
import re
import sys
import glob
import subprocess
BLACKLIST = [
"googlestreetview"
]
def main():
if len(sys.argv) > 1:
split_current, split_number = (int(v) for v in sys.argv[1].split("/"))
split_current = split_current - 1
else:
split_current, split_number = ... | 31.363636 | 114 | 0.603623 | [
"MIT"
] | Geoportail-Luxembourg/geoportailv3 | geoportal/geoportailv3_geoportal/static-ngeo/ngeo/buildtools/test_examples.py | 1,380 | Python |
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def compute_lr(target_lr, n_epochs, train_set_size, batch_size, warmup):
total = (n_epochs - 1) * int(np.ceil(train_set_size / batch_size))
progress = [float(t) / total for t in range(0, total)]
factor = [p / warmup if p < w... | 28.666667 | 96 | 0.648983 | [
"Apache-2.0"
] | qurator-spk/sbb_ned | qurator/sbb_ned/models/evaluation.py | 1,376 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 33.169492 | 79 | 0.666326 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | MonetDB/MonetDB | documentation/monetdbe/conf.py | 1,957 | Python |
import httpretty
import json
import textwrap
import pygerduty.events
from pygerduty.events import INTEGRATION_API_URL
from pygerduty.common import Requester
@httpretty.activate
def test_create_event():
body = textwrap.dedent("""
{
"status": "success",
"message": "Event processed",
"incident_key... | 22.263158 | 67 | 0.665485 | [
"MIT"
] | amckenna-pinterest/pygerduty | tests/events_test.py | 846 | Python |
#!/usr/bin/env python
import sys
from Bio import SeqIO
min_length, fasta_file_path = sys.argv[1:]
with open(fasta_file_path.replace('fa', 'filter{}.fa'.format(min_length)), 'w') as filtered_fasta:
with open(fasta_file_path, 'rU') as input_fasta:
def filtered_contigs_generator(min):
for contig in SeqIO.parse(input... | 38.916667 | 98 | 0.745182 | [
"CC0-1.0"
] | CFSAN-Biostatistics/filter_contigs | filter_contigs.py | 467 | Python |
class User(object):
"""
"""
def __init__(self, user_id, user_name, user_cereal, user_midday, user_dinner):
self.user_id = user_id
self.user_name = user_name
self.user_cereal = user_cereal
self.user_midday = user_midday
self.user_dinner = user_dinner
if __name__ ==... | 21.375 | 82 | 0.640351 | [
"MIT"
] | serviceoutsource/ML-AI | hyperflex_recommend/enpity/User.py | 342 | Python |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | 39.106635 | 79 | 0.64558 | [
"MIT"
] | claytonbrown/SublimeLinter-contrib-AWS-Cloudformation-JSON | dist/awscli/customizations/datapipeline/__init__.py | 16,503 | Python |
from PIL import ImageGrab
import pyautogui
import numpy
import time
import cv2
import os
timeA = time.time()
fourcc = cv2.VideoWriter_fourcc(*"XVID")
name = f"Recording{len(os.listdir())-2}.mp4"
out = cv2.VideoWriter(name, fourcc, 14.0, (1920, 1080))
white = (255, 255, 255)
black = (0, 0, 0)
while T... | 22.702703 | 59 | 0.608333 | [
"Apache-2.0"
] | udham2511/Python-Screen-Recorder | recorder.py | 840 | Python |
from ._datasets import fly_brain, scicar_mouse_kidney
__all__ = ['fly_brain', 'scicar_mouse_kidney']
| 17.333333 | 53 | 0.788462 | [
"MIT"
] | brianhie/schema | schema/datasets/__init__.py | 104 | Python |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class ProtectionInfo(object):
"""Implementation of the 'ProtectionInfo' model.
dataLocation defines data location related information.
Attributes:
end_time_usecs (long|int): Specifies the end time for object
retention.
l... | 36.028846 | 81 | 0.62957 | [
"Apache-2.0"
] | cohesity/management-sdk-python | cohesity_management_sdk/models/protection_info.py | 3,747 | Python |
from mycroft import MycroftSkill, intent_file_handler
import subprocess
class Fortune(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('fortune.intent')
def handle_fortune(self, message):
result = subprocess.run("fortune", capture_output=True, text=True)
... | 23.823529 | 74 | 0.728395 | [
"MIT"
] | rogermoore6872/fortune-skill | __init__.py | 405 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Archdiffer and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
Created on Sun Mar 4 10:23:41 2018
@author: Pavla Kratochvilova <pavla.kratochvilova@gmail.com>
"""
import operator
import datetime
from f... | 31.760479 | 78 | 0.659879 | [
"MIT"
] | Kratochvilova/archdiffer | archdiffer/flask_frontend/request_parser.py | 5,304 | Python |
#
# mcfly
#
# Copyright 2017 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 applicable l... | 38.618143 | 92 | 0.667632 | [
"Apache-2.0"
] | wadpac/mcfly | mcfly/modelgen.py | 18,305 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functions to draw various pygimli matrices with matplotlib."""
import numpy as np
import matplotlib.pyplot as plt
import pygimli as pg
def drawSparseMatrix(ax, mat, **kwargs):
"""Draw a view of a matrix into the axes.
Parameters
----------
ax : mpl a... | 28.789063 | 110 | 0.538128 | [
"Apache-2.0"
] | JuliusHen/gimli | pygimli/viewer/mpl/matrixview.py | 3,685 | Python |
import uuid
from http import HTTPStatus
import pytest
from botx.clients.methods.errors.chat_not_found import (
ChatNotFoundData,
ChatNotFoundError,
)
from botx.clients.methods.v3.chats.add_user import AddUser
from botx.concurrency import callable_to_coroutine
pytestmark = pytest.mark.asyncio
pytest_plugins =... | 26.902439 | 80 | 0.682684 | [
"MIT"
] | ExpressApp/pybotx | tests/test_clients/test_methods/test_errors/test_chat_not_found.py | 1,103 | Python |
"""This is the core module for accessing using and accessing the bot"""
from .core import Bot
| 23.75 | 71 | 0.747368 | [
"MIT"
] | CaffeineDuck/BoilerBot | bot/__init__.py | 95 | Python |
from abaqusConstants import *
from .BoundaryConditionState import BoundaryConditionState
class DisplacementBaseMotionBCState(BoundaryConditionState):
"""The DisplacementBaseMotionBCState object stores the propagating data for a velocity base
motion boundary condition in a step. One instance of this object is ... | 35.756757 | 179 | 0.733182 | [
"MIT"
] | Haiiliin/PyAbaqus | src/abaqus/BoundaryCondition/DisplacementBaseMotionBCState.py | 2,646 | Python |
from abc import abstractmethod, ABCMeta
from collections import deque
from functools import partial
from plenum.common.constants import VIEW_CHANGE_START, PreVCStrategies, VIEW_CHANGE_CONTINUE
from plenum.common.messages.node_messages import ViewChangeStartMessage, ViewChangeContinueMessage, PrePrepare, Prepare, \
... | 44.715278 | 131 | 0.701196 | [
"Apache-2.0"
] | andkononykhin/indy-plenum-copy | plenum/server/view_change/pre_view_change_strategies.py | 6,439 | Python |
import requests
import json
import datetime
import os
import io
from invoke import task
from .invoke_utils import ServerConnection, use_dump_modifier_function
RAJK_PASSWORD = os.environ.get("RAJK_PASSWORD")
RAJK_RSA = os.environ.get("RAJK_RSA")
TEST_DEPLOY_DIRECTORY = os.getcwd() + "/build"
rajk_server_connection ... | 29.703557 | 102 | 0.637126 | [
"MIT"
] | rajk-apps/rajk-appman | rajk_appman/invoke_rajk.py | 7,515 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.