max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
python/HandwrittenDigitRecognitionUsingCNNWithKeras.py | GangababuManam/tensorflow-101 | 832 | 186981 | <filename>python/HandwrittenDigitRecognitionUsingCNNWithKeras.py
#This program applies convolutional neural networks to handwritten digit dataset (MNIST)
#It consumes Keras API, uses TensorFlow as backend
#It produces 99.29% accuracy on test set
#blog post: https://sefiks.com/2017/11/05/handwritten-digit-recogniti... | 0 | 0 | 0 | 0 | 0 | 0 |
facebook_problems/problem_41.py | loftwah/Daily-Coding-Problem | 129 | 186993 | """This problem was asked by Facebook.
We have some historical clickstream data gathered from our site anonymously using cookies.
The histories contain URLs that users have visited in chronological order.
Write a function that takes two users' browsing histories as input and returns the longest
contiguous sequence ... | 0 | 0 | 0 | 0 | 0 | 0 |
info_cam/CUB-200-2011/utils/utils_io.py | ZhenyueQin/Research-Softmax-with-Mutual-Information | 103 | 187010 | <gh_stars>100-1000
import datetime
import os
import fnmatch
import shutil
import json
def normalize_data(data_type, channels, sequence):
if data_type == 'multi_mnist':
if channels > 1:
sequence = sequence.permute([0, 3, 1, 2])
else:
sequence = sequence.permute([0, 3, 1, 2])... | 0 | 0 | 0 | 0 | 0 | 0 |
travis_files/google_drive_integration.py | timgates42/trex-core | 956 | 187037 | from __future__ import annotations
from __future__ import print_function
import io
import os.path
import pickle
import sys
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload
TOKEN = '<PASSWORD>/token.pickle'
DOWNLOAD_LINK = "travis_files/download_link.txt"
class Google... | 0 | 3 | 0 | 0 | 3 | 0 |
amazon_scraper/__init__.py | adamlwgriffiths/amazon_scraper | 252 | 187047 | # -*- coding: utf-8 -*-
from __future__ import annotations
from __future__ import absolute_import
import logging
import re
try:
import urlparse
except:
import urllib.parse as urlparse
import urllib
import functools
import locale
import calendar
import time
import requests
import warnings
from amazon.api import ... | 11 | 28 | 0 | 0 | 39 | 0 |
learn/prog/07/geometry.py | mauroere/opencv | 568 | 187051 | <reponame>mauroere/opencv
class Point(object):
def __init__(self, x, y):
self._x = x
self._y = y
def get_x(self):
return self._x
def set_x(self, x):
self._x = x
def get_y(self):
return self._y
def set_y(self, y):
self._y = y
def euclidean_distan... | 0 | 0 | 0 | 0 | 0 | 0 |
hypergan/inputs/fitness_image_loader.py | limberc/HyperGAN | 889 | 187081 | <filename>hypergan/inputs/fitness_image_loader.py<gh_stars>100-1000
from hypergan.gan_component import ValidationException, GANComponent
import glob
import os
import torch
import torch.utils.data as data
import torchvision
from hypergan.inputs.image_loader import ImageLoader
import numpy as np
class FitnessImageLoade... | 0 | 0 | 0 | 0 | 0 | 0 |
qanta/buzzer/train.py | Mshivam2409/qb | 122 | 187096 | import os
import chainer
from chainer import training
from chainer.training import extensions
from qanta.buzzer.nets import RNNBuzzer, MLPBuzzer, LinearBuzzer
from qanta.buzzer.util import read_data, convert_seq
from qanta.util.constants import BUZZER_TRAIN_FOLD, BUZZER_DEV_FOLD
def main(model):
train = read_da... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_dlib.py | karthik20122001/docker-python | 2,030 | 187167 | <gh_stars>1000+
import unittest
import cv2
import dlib
class TestDLib(unittest.TestCase):
def test_dlib_face_detector(self):
detector = dlib.get_frontal_face_detector()
image = cv2.imread('/input/tests/data/face.jpg')
image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = de... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/310320_webcounter/recipe-310320.py | tdiprima/code | 2,023 | 187207 | <filename>recipes/Python/310320_webcounter/recipe-310320.py<gh_stars>1000+
#!/usr/bin/python -u
# 2004/10/15
#v1.0.0
# webcounter.py
# A very simple webcounter.
# Copyright <NAME>
# You are free to modify, use and relicense this code.
# No warranty express or implied for the accuracy, fitness to purpose or otherwise... | 0 | 0 | 0 | 0 | 0 | 0 |
passpie/validators.py | bcfurtado/passpie | 700 | 187211 | <gh_stars>100-1000
import click
from .history import clone
from . import config
def validate_remote(ctx, param, value):
if value:
try:
remote, branch = value.split('/')
return (remote, branch)
except ValueError:
raise click.BadParameter('remote need to be in fo... | 0 | 0 | 0 | 0 | 0 | 0 |
pymterm/client/ssh_client.py | stonewell/pymterm | 102 | 187213 | from __future__ import annotations
from binascii import hexlify
import getpass
import logging
import os
import paramiko
def agent_auth(transport, username) -> None:
"""
Attempt to authenticate to the given transport using any of the private
keys available from an SSH agent.
"""
ag... | 2 | 8 | 0 | 1 | 11 | 0 |
Day 9/py_day_mod/another/__init__.py | loveyourpassion/comm | 149 | 187223 | #from make_messages import MessageUser | 0 | 0 | 0 | 0 | 0 | 0 |
2017/continuations-trampolines/evenodd.py | mikiec84/code-for-blog | 1,199 | 187303 | # Example of mutual recursion with even/odd.
#
# <NAME> [http://eli.thegreenplace.net]
# This code is in the public domain.
from __future__ import annotations
def is_even(n) -> bool | object:
if n == 0:
return True
else:
return is_odd(n - 1)
def is_odd(n) -> bool | object:
if n == 0:
... | 0 | 5 | 0 | 0 | 5 | 0 |
app/kernel.py | golem4300/quattran | 183 | 187318 | <reponame>golem4300/quattran
import os
from app.service_container import ServiceContainer
from app.plugin_manager import PluginManager
import ruamel.yaml
class Kernel(object):
"""
The Kernel handles the creation of the app and service container.
"""
def __init__(self):
# type: () -> None... | 0 | 0 | 0 | 0 | 0 | 0 |
openshift_fl/run_party.py | imec-int/federated-learning-lib | 294 | 187371 | """
Licensed Materials - Property of IBM
Restricted Materials of IBM
20190891
© Copyright IBM Corp. 2021 All Rights Reserved.
"""
#!/usr/bin/env python3
import logging
import os
import sys
from time import sleep
from ibmfl.party.party import Party
from ibmfl.party.status_type import StatusType
fl_path = os.path.abs... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/python/40.timex-resolution/language_generation.py | Aliacf21/BotBuilder-Samples | 1,998 | 187385 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import datetime
from datatypes_timex_expression import Timex
class LanguageGeneration:
"""
This language generation capabilities are the logical opposite of what the recognizer does.
As an exper... | 0 | 0 | 0 | 0 | 0 | 0 |
finetuner/tuner/callback/evaluation.py | jina-ai/finetuner | 270 | 187403 | import math
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple
from ... import embed
from ..evaluation import Evaluator
from .base import BaseCallback
if TYPE_CHECKING:
from docarray import DocumentArray
from ..base import BaseTuner
class EvaluationCallback(BaseCallback):
"""
A ... | 9 | 0 | 0 | 3 | 12 | 0 |
dojo/tools/skf/parser.py | mtcolman/django-DefectDojo | 1,772 | 187416 | <reponame>mtcolman/django-DefectDojo
import csv
import hashlib
import io
from datetime import datetime
from dojo.models import Finding
class ColumnMappingStrategy(object):
mapped_column = None
def __init__(self):
self.successor = None
def map_column_value(self, finding, column_value):
... | 0 | 0 | 0 | 0 | 0 | 0 |
democase/alexnet/preprocessing/make_labels.py | intel/Theano-dev | 248 | 187479 | # map labels to shuffled images
import os
import yaml
import numpy as np
def div_labels(src_file, orig_batch_size, num_div):
'''
src_file, is a .npy file
orig_batch_size, original batch size
num_div, is number of batches to divide, can only be 2 or 4 for now
'''
labels = np.load(src_file)
... | 0 | 0 | 0 | 0 | 0 | 0 |
TODO (CLI-VER)/todolist.py | avinashkranjan/PraticalPythonProjects | 930 | 187539 | #Check for the existence of file
no_of_items=0
try:
f=open("./TODO (CLI-VER)/todolist.txt")
p=0
for i in f.readlines():#Counting the number of items if the file exists already
p+=1
no_of_items=p-2
except:
f=open("./TODO (CLI-VER)/todolist.txt",'w')
f.write("_________TODO LIST__________\... | 0 | 0 | 0 | 0 | 0 | 0 |
dev_wsgi.py | chadwhitacre/confidant | 1,820 | 187542 | from confidant import settings
from confidant.app import create_app
if __name__ == '__main__':
app = create_app()
app.run(
host=settings.get('HOST', '127.0.0.1'),
port=settings.get('PORT', 5000),
debug=settings.get('DEBUG', True)
)
| 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/domain/__init__.py | dimagilg/commcare-hq | 471 | 187543 | <reponame>dimagilg/commcare-hq
SHARED_DOMAIN = "<shared>"
UNKNOWN_DOMAIN = "<unknown>"
| 0 | 0 | 0 | 0 | 0 | 0 |
pandas_ta/utils/data/__init__.py | ryanrussell/pandas-ta | 2,298 | 187560 | <reponame>ryanrussell/pandas-ta
# -*- coding: utf-8 -*-
from .alphavantage import av
from .yahoofinance import yf | 0 | 0 | 0 | 0 | 0 | 0 |
external/AR/ltr/models/meta/steepestdescent.py | tzhhhh123/Stark | 376 | 187561 | from __future__ import annotations
import math
import torch
import torch.nn as nn
from pytracking import TensorList
from ltr.models.layers import activation
class GNSteepestDescent(nn.Module):
"""General module for steepest descent based meta learning."""
def __init__(self, residual_module, num_iter: int=1, c... | 10 | 3 | 0 | 0 | 13 | 0 |
yargy/token.py | xepozz/yargy | 250 | 187568 | <filename>yargy/token.py
from .record import Record
from .span import Span
class Token(Record):
__attributes__ = ['value', 'span', 'type']
def __init__(self, value, span, type):
self.value = value
self.span = span
self.type = type
@property
def normalized(self):
retu... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/external_libs/python-daemon-2.0.5/test_version.py | timgates42/trex-core | 956 | 187605 | # -*- coding: utf-8 -*-
#
# test_version.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2015 <NAME> <<EMAIL>>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License as published by the
# Free Software Foundation... | 2 | 11 | 17 | 0 | 30 | 0 |
cgt/nn_ops/cross_channel_lrn.py | rohanraja/cgt_distributed | 698 | 187609 | <filename>cgt/nn_ops/cross_channel_lrn.py
import ctypes
import cgt
from cgt import core
from collections import namedtuple
LRNInfo = namedtuple("LRNInfo",["localsize","alpha","beta"])
def make_closure(info):
return [
("localsize",ctypes.c_int,info.localsize),
("alpha",ctypes.c_double,info.alpha),
... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/r_talesfromtechsupport/app.py | mainyordle/reddit2telegram | 187 | 187611 | #encoding:utf-8
subreddit = 'talesfromtechsupport'
t_channel = '@r_talesfromtechsupport'
def send_post(submission, r2t) -> object:
return r2t.send_simple(submission)
| 0 | 1 | 0 | 0 | 1 | 0 |
train_cg.py | m95music/yukarin | 139 | 187620 | import argparse
from copy import copy
from functools import partial
from pathlib import Path
from typing import Any
from typing import Dict
from chainer import cuda
from chainer import optimizers
from chainer import training
from chainer.dataset import convert
from chainer.iterators import MultiprocessIterator
from ch... | 0 | 1 | 1 | 0 | 2 | 0 |
up/tasks/multitask/models/wrappers/__init__.py | ModelTC/EOD | 196 | 187636 | from .multitask_wrapper import * # noqa | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/greatest-sum-divisible-by-three.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 187645 | <reponame>Sourav692/FAANG-Interview-Preparation
# Time: O(n)
# Space: O(1)
class Solution(object):
def maxSumDivThree(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
dp = [0, 0, 0]
for num in nums:
for i in [num+x for x in dp]:
dp[... | 0 | 0 | 0 | 0 | 0 | 0 |
veles/ensemble/test_workflow.py | AkshayJainG/veles | 1,007 | 187667 | # -*- coding: utf-8 -*- # pylint: disable=C0302
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on June 17, 2015
Ensemble of m... | 0 | 3 | 1 | 0 | 4 | 0 |
timing/fuzzers/015-mult/fuzzer.py | Keno/prjtrellis | 256 | 187697 | <gh_stars>100-1000
import cell_fuzzers
def include_cell(name, type):
return type.startswith("mult_reg")
def rewrite_cell_pipemode(name, type):
if type.startswith("mult_reg"):
return "MULT18X18D:REGS={}".format(type.split("_", 2)[2])
else:
return type
def rewrite_pin(name, type, pin):
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/takesystem/takesystem_OverrideGroupModes.py | tdapper/cinema4d_py_sdk | 113 | 187734 | <filename>scripts/takesystem/takesystem_OverrideGroupModes.py<gh_stars>100-1000
import c4d
from c4d import gui
#Author: s_bach
#TakeSystem Example
def main():
takeData = doc.GetTakeData()
if takeData is None:
return
# This code adds the currently selected objects to a new group in the c... | 0 | 0 | 0 | 0 | 0 | 0 |
voice-conversion/encode/__init__.py | mberkanbicer/torch-light | 310 | 187767 | import os
import sys
curdir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(curdir)
from .utils import *
from .model import Model
from .writer import Writer
from .data_loader import get_loader
from .radam import RAdam | 0 | 0 | 0 | 0 | 0 | 0 |
pathlib__examples/syntax_path.py | DazEB2/SimplePyScripts | 117 | 187826 | <filename>pathlib__examples/syntax_path.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# C:\Windows\System32\Boot
import pathlib
path = pathlib.Path('C:/') / 'Windows' / 'System32' / 'Boot'
print(path) # C:\Windows\System32\Boot
| 0 | 0 | 0 | 0 | 0 | 0 |
evaluators/rank/ReciprocalRankEvaluator/__init__.py | strawberrypie/jina-hub | 106 | 187839 | from typing import Sequence, Union, Optional
from jina.executors.evaluators.rank import BaseRankingEvaluator
class ReciprocalRankEvaluator(BaseRankingEvaluator):
"""
Gives score as per reciprocal rank metric.
:param args: Additional positional arguments
:param kwargs: Additional keyword arguments
... | 2 | 1 | 0 | 0 | 3 | 0 |
gordon/exceptions.py | patgoley/gordon | 2,204 | 187840 | <gh_stars>1000+
class BaseGordonException(Exception):
code = 1
hint = u"Something went't wrong"
def get_hint(self):
return self.hint.format(*self.args)
class ResourceSettingRequiredError(BaseGordonException):
code = 2
hint = u"Resource {} requires you to define '{}' in it's settings."
... | 0 | 0 | 0 | 0 | 0 | 0 |
build/plugins/_xsyn_includes.py | HeyLey/catboost | 6,989 | 187850 | <filename>build/plugins/_xsyn_includes.py
def get_include_callback():
"""
.. function: get_include_callback returns function that processes each DOM element to get xsyn include from it, and it's aware of directory with all the xsyns.
:param xsyn_dir directory with xsyns.
"""
def get_incl... | 0 | 0 | 0 | 0 | 0 | 0 |
Stephanie/AudioManager/audio_recognizer.py | JeremyARussell/stephanie-va | 866 | 187873 | from Stephanie.configurer import config
# noinspection SpellCheckingInspection
class AudioRecognizer:
def __init__(self, recognizer, UnknownValueError, RequestError):
self.UnknownValueError = UnknownValueError
self.RequestError = RequestError
self.r = recognizer
self.c = config
... | 0 | 0 | 0 | 0 | 0 | 0 |
warp/sim/particles.py | addy1997/warp | 306 | 187886 | # Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | 17 | 1 | 0 | 0 | 18 | 0 |
bin/search_fulltext.py | AlexFaraino/cve-search | 377 | 187926 | <reponame>AlexFaraino/cve-search
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Search the CVE full text database
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2012-2015 <NAME> - <EMAIL>
# Copyright (c) 2015 <NAME> - <EMAIL>
import os
from whoosh import index, qparse... | 0 | 0 | 0 | 0 | 0 | 0 |
src/probnum/utils/linalg/__init__.py | christopheroates/probnum | 226 | 187941 | <filename>src/probnum/utils/linalg/__init__.py
"""Utility functions that involve numerical linear algebra."""
from ._cholesky_updates import cholesky_update, tril_to_positive_tril
__all__ = ["cholesky_update", "tril_to_positive_tril"]
| 0 | 0 | 0 | 0 | 0 | 0 |
bip_utils/monero/mnemonic/__init__.py | MIPPLTeam/bip_utils | 149 | 187951 | from bip_utils.monero.mnemonic.monero_mnemonic_ex import MoneroChecksumError
from bip_utils.monero.mnemonic.monero_mnemonic import (
MoneroLanguages, MoneroWordsNum, MoneroMnemonic, MoneroMnemonicDecoder, MoneroMnemonicEncoder
)
from bip_utils.monero.mnemonic.monero_entropy_generator import MoneroEntropyBitLen, Mon... | 0 | 0 | 0 | 0 | 0 | 0 |
thinkpad_tools_assets/battery.py | devksingh4/thinkpad-tools | 207 | 187968 | <filename>thinkpad_tools_assets/battery.py
"""
Battery related stuff
"""
import os
import re
import sys
import pathlib
import argparse
from thinkpad_tools_assets.utils import ApplyValueFailedException, NotSudo
BASE_DIR = pathlib.PurePath('/sys/class/power_supply/')
PROPERTIES: dict = {
'alarm': 0,
'capacity... | 0 | 0 | 0 | 0 | 0 | 0 |
ch04/04_20.py | leeseedong/book-cryptocurrency | 121 | 187975 | import pandas as pd
url = "https://finance.naver.com/item/sise_day.nhn?code=066570"
df = pd.read_html(url)
print(df[0])
| 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/exac_combine/exac_combine_mkconf.py | tsnowlan/vcfanno | 303 | 187989 | <filename>docs/examples/exac_combine/exac_combine_mkconf.py
import sys
import gzip
import re
xopen = lambda f: (gzip.open if f.endswith(".gz") else open)(f)
vcf = xopen(sys.argv[1])
key = sys.argv[2]
patt = re.compile("ID=AN_(...),")
fields = []
for line in vcf:
if line[0] != "#": break
m = patt.search(line)... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tools/vttests/template.py | Ghosty141/Terminal | 34,359 | 188124 | ################################################################################
# #
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# #
####... | 0 | 0 | 0 | 0 | 0 | 0 |
dev_tools/docker/clusters/apache_2.6.0/images/base/scripts/zk_wait.py | timgates42/pydoop | 203 | 188192 | <filename>dev_tools/docker/clusters/apache_2.6.0/images/base/scripts/zk_wait.py
import sys
import os
import time
from kazoo.client import KazooClient
import logging
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
host = 'zookeeper'
port = int(os.environ['ZOO_CLIENT_PORT'])
logger.inf... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | sergioisidoro/django-flows | 104 | 188244 | # -*- coding: UTF-8 -*-
from distutils.core import setup
from setuptools import find_packages
import time
_version = "1.3"
_packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "example"])
# common dependencies
_install_requires = [
'django>=1.4',
'six'
]
_short_description = "d... | 0 | 0 | 0 | 0 | 0 | 0 |
v1-python/imgencode.py | alexadam/img-encode | 202 | 188250 | <gh_stars>100-1000
#!/usr/bin/python
from PIL import Image
import math, wave, array, sys, getopt
def start(inputfile, outputfile, duration):
im = Image.open(inputfile)
width, height = im.size
rgb_im = im.convert('RGB')
durationSeconds = float(duration)
tmpData = []
maxFreq = 0
data = ... | 0 | 0 | 0 | 0 | 0 | 0 |
opentpod/object_detector/migrations/0005_trainconfig.py | cnguyen123/OpenTPOD | 111 | 188264 | # Generated by Django 2.2.3 on 2019-11-19 20:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('object_detector', '0004_auto_20191115_1631'),
]
operations: list[object] = [
migrati... | 0 | 0 | 2 | 0 | 2 | 0 |
test/utils/test_wrapped_apply_fun.py | gpescia/MyNetKet | 352 | 188265 | # Copyright 2021 The NetKet 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 applicable ... | 0 | 2 | 0 | 0 | 2 | 0 |
pyperf/_psutil_memory.py | brandtbucher/pyperf | 225 | 188294 | <reponame>brandtbucher/pyperf
import os
try:
import psutil
except ImportError:
raise ImportError('psutil is not installed')
import threading
import time
class PeakMemoryUsageThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.process = psutil.Process(os.getpi... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark.py | feifeibear/dlbench | 181 | 188311 | <gh_stars>100-1000
import argparse
import sys,os,time
import subprocess
import collect_gpu_power as cgp
from threading import Thread
# Parse arguments
parser = argparse.ArgumentParser(description='Benchmark deep learning tools')
parser.add_argument('-config', type=str, help='Path to the config file')
parser.add_argum... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/alert.py | pzahemszky/guizero | 320 | 188333 | from guizero import App
app = App()
app.info("Info", "This is a guizero app")
app.error("Error", "Try and keep these out your code...")
app.warn("Warning", "These are helpful to alert users")
app.display() | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_mystem.py | smoke-b/pymystem3 | 205 | 188364 | # -*- coding: utf-8 -*-
from pymystem3 import Mystem
class TestMystem(object):
def test_mystem(self):
m = Mystem()
tokens = m.lemmatize("<NAME>")
assert ["мама", " ", "мыть", " ", "рама", "\n"] == tokens
def test_mystem_not_entireinput(self):
m = Mystem(entire_input=False)
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pxScene2d/external/libnode-v10.15.3/test/addons-napi/test_constructor/binding.gyp | madanagopaltcomcast/pxCore | 1,144 | 188388 | <reponame>madanagopaltcomcast/pxCore
{
"targets": [
{
"target_name": "test_constructor",
"sources": [ "test_constructor.c" ]
},
{
"target_name": "test_constructor_name",
"sources": [ "test_constructor_name.c" ]
}
]
}
| 0 | 0 | 0 | 0 | 0 | 0 |
SimMuon/RPCDigitizer/python/rpcNeutronWriter_cfi.py | ckamtsikis/cmssw | 852 | 188431 | <filename>SimMuon/RPCDigitizer/python/rpcNeutronWriter_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
rpcNeutronWriter = cms.EDProducer("RPCNeutronWriter",
timeWindow = cms.double(20.0),
writer = cms.string('EDM'),
output = cms.string('RPCNeutronHits.root'),
neutronTimeCut = cms.doub... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_0430-global_index-for-tuples-of-DataFrames.py | eic/uproot4 | 133 | 188446 | <reponame>eic/uproot4
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/main/LICENSE
import numpy as np
import pytest
import skhep_testdata
import uproot
pytest.importorskip("pandas")
def test():
for arrays in uproot.iterate(
[skhep_testdata.data_path("uproot-HZZ-uncompressed.root"... | 0 | 0 | 0 | 0 | 0 | 0 |
test/labeling/lf/test_nlp_spark.py | melonwater211/snorkel | 2,906 | 188447 | import unittest
from types import SimpleNamespace
import pytest
from pyspark.sql import Row
from snorkel.labeling.lf.nlp import NLPLabelingFunction
from snorkel.labeling.lf.nlp_spark import (
SparkNLPLabelingFunction,
spark_nlp_labeling_function,
)
from snorkel.types import DataPoint
def has_person_mention(... | 3 | 6 | 0 | 0 | 9 | 0 |
FWCore/Integration/test/testEDLooperESProducer_cfg.py | Purva-Chaudhari/cmssw | 852 | 188458 | <filename>FWCore/Integration/test/testEDLooperESProducer_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(5)
)
process.source = cms.Source("EmptySource")
process.intEventProducer = cms.EDProducer("IntProducer",
... | 0 | 0 | 0 | 0 | 0 | 0 |
thermo/flash/__init__.py | RoryKurek/thermo | 380 | 188466 | # -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2019, 2020 <NAME> <<EMAIL>>
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 wi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_model.py | paudan/anago | 1,524 | 188490 | <reponame>paudan/anago<filename>tests/test_model.py<gh_stars>1000+
import os
import shutil
import unittest
from anago.models import BiLSTMCRF, load_model, save_model
class TestModel(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.save_root = os.path.join(os.path.dirname(__file__), 'models'... | 0 | 0 | 0 | 0 | 0 | 0 |
Easy Challenges/Challenge 0027 Easy/solutions/solution.py | FreddieV4/DailyProgrammerChallenges | 331 | 188493 | <reponame>FreddieV4/DailyProgrammerChallenges<gh_stars>100-1000
#Solution by https://github.com/Ouss4
from math import ceil
year = int(input("Enter year: "))
print("Centry : {}".format(ceil(year/100)))
print("Leap Year: {}".format("Yes" if (year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)) else "No"))
| 0 | 0 | 0 | 0 | 0 | 0 |
Schweizer-Messer/numpy_eigen/test/numpy_eigen_tests.py | PushyamiKaveti/kalibr | 2,690 | 188516 | #!/usr/bin/env python
import roslib; roslib.load_manifest('numpy_eigen'); roslib.load_manifest('rostest');
import numpy_eigen
import numpy_eigen.test as npe
import numpy
import sys
# http://docs.python.org/library/unittest.html#test-cases
import unittest
class TestEigen(unittest.TestCase):
def assertMatrixClos... | 0 | 0 | 0 | 0 | 0 | 0 |
cpu_ver/funkyyak/scheme/core.py | bigaidream-projects/drmad | 119 | 188519 | from collections import namedtuple
from primitives import primitives
# ----- Expression types -----
fundef = namedtuple('fundef', ('name', 'argnames', 'body'))
vardef = namedtuple('vardef', ('name', 'exp'))
call = namedtuple('call', ('funname', 'args'))
kyif = namedtuple('kyif', ('cond... | 1 | 6 | 0 | 0 | 7 | 0 |
openrec/tf2/data/__init__.py | pbaiz/openrec | 399 | 188544 | <reponame>pbaiz/openrec
from openrec.tf2.data.utils import _DataStore
from openrec.tf2.data.utils import _ParallelDataset
from openrec.tf2.data.dataset import Dataset
| 0 | 0 | 0 | 0 | 0 | 0 |
spot_bullet/paper/GMBC_data_plotter.py | sofya-pugach/spot_mini_mini | 323 | 188563 | <filename>spot_bullet/paper/GMBC_data_plotter.py
#!/usr/bin/env python
import numpy as np
import sys
import os
import argparse
import pickle
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import copy
from scipy.stats import norm
sns.set()
# ARGUMENTS
descr = "Spot Mini Mini ARS Agent Evalua... | 0 | 0 | 0 | 0 | 0 | 0 |
ufora/FORA/python/PurePython/SlicingTestCases.py | ufora/ufora | 571 | 188585 | # Copyright 2015 Ufora 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 i... | 0 | 10 | 0 | 0 | 10 | 0 |
DaPy/methods/utils.py | huihui7987/DaPy | 552 | 188692 | from __future__ import annotations
from DaPy.core import SeriesSet, is_iter, Series
from DaPy.matlib import describe
from collections import namedtuple
from operator import itemgetter
__all__ = ['_label', 'score_binary_clf']
_binary_perf_result = namedtuple('binary_clf', ['TP', 'FN', 'FP', 'TN'])
def plot_reg(y_hat... | 0 | 1 | 0 | 0 | 1 | 0 |
other-materials/python-intro/atom.py | inferential/drug-computing | 103 | 188703 | class AtomClass:
def __init__(self, Velocity, Element: str = 'C', Mass: float = 12.0):
self.Velocity = Velocity
self.Element = Element
self.Mass = Mass
def Momentum(self) -> object:
return self.Velocity * self.Mass
| 2 | 1 | 0 | 0 | 3 | 0 |
src/genie/libs/parser/iosxr/tests/ShowIpInterfaceBrief/cli/equal/golden_output4_expected.py | balmasea/genieparser | 204 | 188709 | <gh_stars>100-1000
expected_output = {
"interface": {
"Loopback0": {
"interface_status": "Up",
"ip_address": "192.168.3.11",
"protocol_status": "Up"
},
"MgmtEth0/RSP0/CPU0/0": {
"interface_status": "Up",
"ip_address": "172.16.17.32"... | 0 | 0 | 0 | 0 | 0 | 0 |
quimb/tensor/tensor_arbgeom.py | mattorourke17/quimb | 264 | 188711 | <gh_stars>100-1000
import functools
from operator import add
from autoray import do, dag
from ..utils import check_opt, ensure_dict
from ..utils import progbar as Progbar
from .tensor_core import TensorNetwork, get_symbol
class TensorNetworkGen(TensorNetwork):
"""A tensor network which notionally has a single t... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/popgen/generator.py | gglin001/poptorch | 128 | 188714 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved
import datetime
import sys
from popgen import registry, transform
# emit_handlers(namespace, aten, handlers, f=sys.stdout)
#
# Emits the C++ handlers for one operator.
# Parameters:
# namespace - namespace the operator is in
# aten - name of the operator
# ... | 0 | 1 | 0 | 0 | 1 | 0 |
scripts/convert_pytorch_models.py | leggedrobotics/DeLORA | 154 | 188726 | <reponame>leggedrobotics/DeLORA<filename>scripts/convert_pytorch_models.py
#!/usr/bin/env python3
# Copyright 2021 by <NAME>, Robotic Systems Lab, ETH Zurich.
# All rights reserved.
# This file is released under the "BSD-3-Clause License".
# Please see the LICENSE file that has been included as part of this package.
im... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/521866_myspace_profile_parser/recipe-521866.py | tdiprima/code | 2,023 | 188768 | <reponame>tdiprima/code
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib, urllib2
from re import *
class Profile(object):
""" parse profile information from a myspace.com account """
def __init__(self, uid):
self.uid = uid
self.profile_url = 'http://profile.myspace.com/'
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | timgkeller/restfulgit | 103 | 188775 | #!/usr/bin/env python
from setuptools import setup, find_packages
import os
import sys
NAME = 'restfulgit'
VERSION = '0.1.1'
CLASSIFIERS = [
'Development Status :: 2 - Beta',
'Environment :: Web Environment',
'Framework :: Flask',
'Intended Audience :: Developers',
'License :: OSI Approved :: M... | 0 | 1 | 0 | 0 | 1 | 0 |
kAFL-Fuzzer/fuzzer/technique/interesting_values.py | SafeBreach-Labs/hAFL2 | 102 | 188784 | <reponame>SafeBreach-Labs/hAFL2<filename>kAFL-Fuzzer/fuzzer/technique/interesting_values.py
# Copyright (C) 2017-2019 <NAME>, <NAME>, <NAME>
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
AFL-style 'interesting values' mutations (deterministic stage).
"""
from fuzzer.te... | 0 | 0 | 0 | 0 | 0 | 0 |
hwt/synthesizer/rtlLevel/reduce_processes.py | ufo2011/hwt | 134 | 188836 | from itertools import islice
from hwt.doc_markers import internal
from hwt.hdl.statements.assignmentContainer import HdlAssignmentContainer
from hwt.hdl.statements.codeBlockContainer import HdlStmCodeBlockContainer
from hwt.hdl.statements.utils.reduction import HdlStatement_merge_statement_lists, \
is_mergable_sta... | 2 | 2 | 0 | 0 | 4 | 0 |
clearml_agent/backend_config/environment.py | Honzys/clearml-agent | 112 | 188840 | <gh_stars>100-1000
from os import getenv, environ
from .converters import text_to_bool
from .entry import Entry, NotSet
class EnvEntry(Entry):
@classmethod
def default_conversions(cls):
conversions = super(EnvEntry, cls).default_conversions().copy()
conversions[bool] = text_to_bool
re... | 0 | 0 | 0 | 0 | 0 | 0 |
gluon/packages/dal/pydal/parsers/oracle.py | ArtemTokar13/web2py | 408 | 188851 | <filename>gluon/packages/dal/pydal/parsers/oracle.py
from ..adapters.oracle import Oracle
import json
from .base import BasicParser, ListsParser
from datetime import datetime, date, time, timedelta
from base64 import b64decode
from .._compat import to_native
from . import parsers, for_type
class OracleParser(BasicPar... | 0 | 0 | 0 | 0 | 0 | 0 |
Core/third_party/JavaScriptCore/Scripts/builtins/__init__.py | InfiniteSynthesis/lynx-native | 677 | 188855 | # Required for Python to search this directory for module files
from builtins import *
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_basic.py | duczen/pynsq | 308 | 188867 | <reponame>duczen/pynsq
from __future__ import absolute_import
from decimal import Decimal
import os
import sys
import pytest
# shunt '..' into sys.path since we are in a 'tests' subdirectory
base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
if base_dir not in sys.path:
sy... | 0 | 0 | 0 | 0 | 0 | 0 |
bcs-ui/backend/bcs_web/audit_log/hooks.py | laodiu/bk-bcs | 599 | 188911 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you... | 0 | 4 | 0 | 1 | 5 | 0 |
vol2/vol2-python-examples/examples/example_gp.py | Sun-Joong/aifh | 777 | 188935 | from __future__ import annotations
"""
Artificial Intelligence for Humans
Volume 2: Nature-Inspired Algorithms
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2014 by <NAME>
Licensed under the Apache Licens... | 21 | 19 | 0 | 4 | 44 | 0 |
pydocx/openxml/wordprocessing/picture.py | botzill/pydocx | 127 | 188943 | # coding: utf-8
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
from pydocx.models import XmlModel, XmlCollection
from pydocx.openxml.vml import Shape, Rect
class Picture(XmlModel):
XML_TAG: str = 'pict'
children = XmlCollection(Shape, Rect)
| 0 | 0 | 1 | 0 | 1 | 0 |
omniduct/utils/config.py | gridgentoo/omniduct | 235 | 188979 | from __future__ import annotations
import inspect
import io
import json
import logging
import os
import sys
import six
def ensure_path_exists(path) -> object:
path = os.path.expanduser(path)
if not os.path.exists(path):
os.makedirs(path)
return path
logger = logging.getLogger(__name__)
class ... | 13 | 6 | 0 | 2 | 21 | 0 |
lab3/text_recognizer/lit_models/__init__.py | Agyey/fsdl-text-recognizer-2021-labs | 402 | 189004 | <reponame>Agyey/fsdl-text-recognizer-2021-labs
from .base import BaseLitModel
# Hide lines below until Lab 3
from .ctc import CTCLitModel
# Hide lines above until Lab 3
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/modules/contrib/test_octoprint.py | spxtr/bumblebee-status | 1,089 | 189013 | <reponame>spxtr/bumblebee-status
import pytest
pytest.importorskip("tkinter")
pytest.importorskip("PIL")
pytest.importorskip("requests")
pytest.importorskip("simplejson")
def test_load_module():
__import__("modules.contrib.octoprint")
| 0 | 0 | 0 | 0 | 0 | 0 |
TrackingTools/GeomPropagators/python/AnyDirectionAnalyticalPropagator_cfi.py | ckamtsikis/cmssw | 852 | 189023 | <filename>TrackingTools/GeomPropagators/python/AnyDirectionAnalyticalPropagator_cfi.py
import FWCore.ParameterSet.Config as cms
AnyDirectionAnalyticalPropagator = cms.ESProducer("AnalyticalPropagatorESProducer",
MaxDPhi = cms.double(1.6),
ComponentName = cms.string('AnyDirectionAnalyticalPropagator'),
Prop... | 0 | 0 | 0 | 0 | 0 | 0 |
emacs-the-best-python-editor/PyEval/debug-example.py | syberflea/materials | 3,682 | 189041 | <filename>emacs-the-best-python-editor/PyEval/debug-example.py
"""
Example code for debugging PyEval
"""
from pyeval_expression import Expression
expr = Expression("53 * -2 + 4")
expr.parse()
print(expr.result())
| 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/576370_Weighted_random_choice/recipe-576370.py | tdiprima/code | 2,023 | 189115 | <reponame>tdiprima/code<filename>recipes/Python/576370_Weighted_random_choice/recipe-576370.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import random, bisect
class ItemGenerator(object):
'''Choices randomly an element from a list.
It does it not uniformly, but using a g... | 0 | 0 | 0 | 0 | 0 | 0 |
EventFilter/HcalRawToDigi/python/hcallaserFilterFromTriggerResult_cff.py | ckamtsikis/cmssw | 852 | 189124 | import FWCore.ParameterSet.Config as cms
from HLTrigger.HLTfilters.hltHighLevel_cfi import hltHighLevel
hcalfilter = hltHighLevel.clone(
TriggerResultsTag = cms.InputTag('TriggerResults'),
HLTPaths = cms.vstring('user_step' )
)
hcalfilterSeq = cms.Sequence( hcalfilter )
| 0 | 0 | 0 | 0 | 0 | 0 |
backdoor_stuff/sha1block.py | macdaliot/patcherex | 147 | 189176 | #!/usr/bin/env python
import hashlib
import itertools
import struct
import time
import multiprocessing
from ctypes import cdll
nbits = 19
mask = (1<<nbits)-1 #0x7ffff
tot_values = pow(2,nbits)
def process_killer():
cdll['libc.so.6'].prctl(1,9)
def _left_rotate(n, b):
"""Left rotate a 32-bit integer n by b... | 0 | 0 | 0 | 0 | 0 | 0 |
pyKriging/utilities.py | vitor-vidal-negr/pyKriging | 354 | 189202 | <filename>pyKriging/utilities.py<gh_stars>100-1000
__author__ = 'chrispaulson'
import dill as pickle
import numpy as np
from copy import deepcopy
def norm(x):
# x = np.array(x, dtype=float)
# return ((x-min(x))/(max(x)-min(x)))
x = ((x)/(max(x)-min(x)))
return x-min(x)
def saveModel(model, filePath):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/Unit/Evolution/Systems/RelativisticEuler/Valencia/TestFunctions.py | nilsvu/spectre | 117 | 189211 | <reponame>nilsvu/spectre
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def spatial_velocity_oneform(spatial_velocity, spatial_metric):
return np.einsum("a, ia", spatial_velocity, spatial_metric)
def spatial_velocity_squared(spatial_velocity, spatial_metric):
return ... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/zh/exc_04_10.py | Jette16/spacy-course | 2,085 | 189218 | <reponame>Jette16/spacy-course
TRAINING_DATA = [
(
"我去年去了西安,那里的城墙很壮观!",
{"entities": [(4, 5, "TOURIST_DESTINATION")]},
),
(
"人一辈子一定要去一趟巴黎,但那里的埃菲尔铁塔有点无趣。",
{"entities": [(5, 6, "TOURIST_DESTINATION")]},
),
(
"深圳也有个巴黎的埃菲尔铁塔,哈哈哈",
{"entities": []}
),
... | 0 | 0 | 0 | 0 | 0 | 0 |
neutron/tests/functional/agent/linux/base.py | congnt95/neutron | 1,080 | 189231 | # Copyright 2014 Cisco Systems, 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 o... | 0 | 1 | 0 | 0 | 1 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.