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 |
|---|---|---|---|---|---|---|---|---|---|---|
alipay/aop/api/domain/ServiceConsultQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 1726385 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ServiceConsultQueryResponse(object):
def __init__(self):
self._consult_event_id = None
self._content = None
self._gmt_create = None
self._gmt_fi... | 0 | 0 | 0 | 0 | 0 | 0 |
mlens/preprocessing/__init__.py | mehrdad-shokri/mlens | 760 | 1726403 | <filename>mlens/preprocessing/__init__.py
"""ML-Ensemble
:author: <NAME>
:copyright: 2017-2018
:licence: MIT
Auxiliary transformers to support computational graphs.
"""
from .preprocess import Subset, Shift
__all__ = ['Subset', 'Shift']
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/powerbidedicated/azure-mgmt-powerbidedicated/azure/mgmt/powerbidedicated/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 1726424 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/examples_galaxia/utility_functions.py | rknop/amuse | 131 | 1726432 | # ---------------------------------------------------------------------------
# Script that shows the utility functions of galaxia. |
# These functions include: the computation of the components of the |
# tidal tensor at a given point, the eigen-values and the tidal radius |
# of a s... | 3 | 3 | 0 | 0 | 6 | 0 |
attendance/views.py | akshaya9/fosswebsite | 369 | 1726438 | from __future__ import annotations
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.http import Http404
from django.shortcuts import redirect, get_object_or_404, render
from django.utils import timezone
from django.utils.datetime_safe import date
from django.views.generi... | 2 | 9 | 7 | 0 | 18 | 0 |
Keras-OpenFace-master/gen_emb.py | kandekar007/FaceRecognition | 617 | 1726460 | from keras.models import load_model
import cv2
import numpy as np
from numpy import genfromtxt
import pandas as pd
import tensorflow as tf
import utils as K
np.set_printoptions(threshold=np.nan)
path1='/Users/victor_sy_wang/Developer/ML/openface/images/examples-aligned/lennon-1.png'
path2='/Users/victor_sy_wang/Devel... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/protocol_example.py | saneravi/ML_Stuff | 209 | 1726476 | from typing import Protocol
class SupportsClose(Protocol):
def close(self) -> None:
...
| 0 | 1 | 0 | 0 | 1 | 0 |
laspy/lasmmap.py | CCInc/laspy | 240 | 1726482 | <reponame>CCInc/laspy
import io
import mmap
from . import lasdata
from .header import LasHeader
from .point import record
from .typehints import PathLike
WHOLE_FILE = 0
class LasMMAP(lasdata.LasData):
"""Memory map a LAS file.
It works like a regular LasData however the data is not actually read in memory,
... | 0 | 0 | 0 | 0 | 0 | 0 |
shallow/preprocessing.py | imatge-upc/saliency | 210 | 1726505 | <gh_stars>100-1000
from lasagne import layers
from lasagne.updates import nesterov_momentum
from nolearn.lasagne import NeuralNet,BatchIterator
import os
import numpy as np
from sklearn.utils import shuffle
import cPickle as pickle
import matplotlib.pyplot as plt
import Image
import ImageOps
from scipy import misc
impo... | 0 | 0 | 0 | 0 | 0 | 0 |
forsun/plan.py | guanchaoguo/forsun | 202 | 1726512 | <filename>forsun/plan.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# 15/6/27
# create by: snower
import time
import datetime
import struct
import msgpack
import pytz
from . import config
if config.get("STORE_DRIVER") == 'redis':
server_id = int(config.get("STORE_REDIS_SERVER_ID"))
else:
server_id = 0
class P... | 0 | 0 | 0 | 0 | 0 | 0 |
FrontEndC/common.py | robertmuth/Cwerg | 171 | 1726532 | <filename>FrontEndC/common.py
from typing import List, Tuple
from pycparser import c_ast
EXPRESSION_NODES = (c_ast.ArrayRef,
c_ast.Assignment,
c_ast.BinaryOp,
c_ast.Cast,
c_ast.Constant,
c_ast.ExprList,
... | 0 | 0 | 0 | 0 | 0 | 0 |
wifi_password/__main__.py | topdefaultuser/wifi-password | 2,552 | 1726568 | from wifi_password import main
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/kivaloo/wire.py | Tarsnap/kivaloo | 176 | 1726572 | #!/usr/bin/env python3
from __future__ import annotations
""" Implentation of the kivaloo Wire protocol. """
import socket
import struct
import crcmod
# ## Public constant
# This is a somewhat arbitrary value
MAX_RESPONSE_BYTES = 16384
# Set up CRC32c algorithm
_CASTAGNOLI = 0x11EDC6F41 # From kivaloo/INTERFAC... | 0 | 8 | 0 | 2 | 10 | 0 |
tests/click_models/test_alternative_click_models.py | almajo/allRank | 473 | 1726582 | <gh_stars>100-1000
import numpy as np
from allrank.click_models.base import FixedClickModel, MultipleClickModel, ConditionedClickModel
from tests.click_models import click
def test_click_model_should_use_all_click_models():
np.random.seed(42)
click_model_0 = FixedClickModel([0])
click_model_1 = FixedCli... | 0 | 0 | 0 | 0 | 0 | 0 |
Const.py | kant/poeai | 184 | 1726611 | '''
Contains all constant values for the PoE AI
'''
#Cast times for different spells
QB_CT = 0.55
WB_CT = 0.19
EB_CT = 0.4
RB_CT = 0.44
TB_CT = 0.39
CT_LT = {'q':QB_CT, 'w':WB_CT, 'e':EB_CT, 'r':RB_CT, 't':TB_CT}
#Movement Map constants
MM_ISOP = 0.7 #Percantage of nearby closed cells for a cell to be considered isol... | 0 | 0 | 0 | 0 | 0 | 0 |
XML/XML_to_dict__xmltodict__examples/namespace_support.py | DazEB2/SimplePyScripts | 117 | 1726625 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/martinblech/xmltodict#namespace-support
# pip install xmltodict
import xmltodict
# By default, xmltodict does no XML namespace processing (it just treats namespace declarations as regular
# node attributes), but p... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/PyTorchNiftyNet/libs/dataset_niftynet.py | tdml13/NiftyNet | 1,403 | 1726641 | import numpy as np
import torch
from torch.utils.data import Dataset
class DatasetNiftySampler(Dataset):
"""
A simple adapter
converting NiftyNet sampler's output into PyTorch Dataset properties
"""
def __init__(self, sampler):
super(DatasetNiftySampler, self).__init__()
self.sampl... | 0 | 2 | 0 | 0 | 2 | 0 |
lib/models/shape_infers/__init__.py | shashank3959/NAS-Projects | 923 | 1726643 | <reponame>shashank3959/NAS-Projects<filename>lib/models/shape_infers/__init__.py
from .InferCifarResNet_width import InferWidthCifarResNet
from .InferImagenetResNet import InferImagenetResNet
from .InferCifarResNet_depth import InferDepthCifarResNet
from .InferCifarResNet import InferCifarResNet
from .InferMob... | 0 | 0 | 0 | 0 | 0 | 0 |
number13/number13/src/patchify.py | ktncktnc/SpaceNet_Off_Nadir_Solutions | 164 | 1726688 | <filename>number13/number13/src/patchify.py
import numpy as np
import cv2
try:
xrange
except NameError:
xrange = range
class PatchGenerator:
def __init__(self,stepsize, imsize, winsize=None):
self.stepsize = stepsize
self.imsize = imsize
if len(self.imsize)==2:
self.im... | 0 | 0 | 0 | 0 | 0 | 0 |
scale/job/test/error/test_error.py | kaydoh/scale | 121 | 1726722 | from __future__ import unicode_literals
from __future__ import absolute_import
import django
from django.test import TestCase
from job.error.error import JobError
class TestJobError(TestCase):
"""Tests functions in the job error module."""
def setUp(self):
django.setup()
def test_creat... | 0 | 0 | 0 | 0 | 0 | 0 |
Examples/keywords.py | keepit1/GoogleScraper | 2,294 | 1726735 | """
GoogleScraper will scrape the jobs according to the dictionaries below.
Passing the scrape_jobs to GoogleScraper is simple:
GoogleScraper --keyword-file keywords.py
"""
scrape_jobs = [
{
'query': 'hello world',
'search_engine': 'google', # on which search engines this keyword should be searc... | 0 | 0 | 0 | 0 | 0 | 0 |
FWCore/Framework/test/testTrigBits0_cfg.py | ckamtsikis/cmssw | 852 | 1726811 | <gh_stars>100-1000
#No Trig paths defined
import FWCore.ParameterSet.Config as cms
process = cms.Process("PROD")
import FWCore.Framework.test.cmsExceptionsFatalOption_cff
process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(True),
Rethrow = FWCore.Framework.test.cmsExceptionsFatalOption_cff... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/CrowdStrikeFalconX/Integrations/CrowdStrikeFalconX/TestsInput/http_responses.py | diCagri/content | 799 | 1726814 | SEND_UPLOADED_FILE_TO_SENDBOX_ANALYSIS_HTTP_RESPONSE = {
"errors": [],
"meta": {
"powered_by": "falconx-api",
"query_time": 0.163158146,
"quota": {
"in_progress": 3,
"total": 100,
"used": 36
},
"trace_id": "trace_id"
},
"resourc... | 0 | 0 | 0 | 0 | 0 | 0 |
utils.py | seilna/RWMN | 106 | 1726826 | # ============================================
# This file contains tensorflow ops for
# 1. Summary writing
# 2. Checkpoint saving
# ============================================
import tensorflow as tf
import os
import shutil
from tensorflow import flags
FLAGS = flags.FLAGS
def variable_summary(var, name):
mean = ... | 0 | 2 | 0 | 0 | 2 | 0 |
timingByPERank/TimingByPERank.py | microlyu/SmartInvest | 133 | 1726828 | <filename>timingByPERank/TimingByPERank.py<gh_stars>100-1000
import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def get_drawdown(p):
"""
计算净值回撤
"""
T = len(p)
hmax = [p[0]]
for t in range(1, T):
hmax.append(np.nanmax([p[t], hmax[t - 1]]))
dd = [p... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/protocolModule2.py | Jasha10/pyright | 3,934 | 1726830 | <reponame>Jasha10/pyright
# This sample tests protocol matching for modules.
from typing import Protocol, Type, TypeVar, Union, runtime_checkable
from . import protocolModule1
import datetime
from importlib import import_module
@runtime_checkable
class P1(Protocol):
var_1: int
var_2: Union[int, str]
def... | 0 | 0 | 0 | 0 | 0 | 0 |
src/meltano/api/models/oauth.py | siilats/meltano | 122 | 1726839 | from __future__ import annotations
from datetime import datetime
from . import db
class OAuth(db.Model):
__tablename__: str = "oauth"
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey("user.id"))
provider_id = db.Column(db.String(255))
provider_user_id = ... | 1 | 1 | 1 | 0 | 3 | 0 |
python/src/py/keyvi/_pycore/keyvimerger.py | vvucetic/keyvi | 199 | 1726840 | <reponame>vvucetic/keyvi
# -*- coding: utf-8 -*-
'''
keyvi - A key value store.
Copyright 2018 <NAME><<EMAIL>>
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/LICENS... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/getter.py | AndTornes/rabbitpy | 149 | 1726858 | <reponame>AndTornes/rabbitpy<gh_stars>100-1000
#!/usr/bin/env python
import rabbitpy
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
with conn.channel() as channel:
queue = rabbitpy.Queue(channel, 'example')
while len(queue) > 0:
message = queue.get()
... | 0 | 0 | 0 | 0 | 0 | 0 |
101-150/122-buy-sell-stock-II.py | bbram10/leetcode-master | 134 | 1726868 | <reponame>bbram10/leetcode-master
"""
STATEMENT
Given an array for which the ith element is the price of a given stock on day i, find the maximum profit.
You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times).
However, you may not engage in multiple transactions a... | 0 | 0 | 0 | 0 | 0 | 0 |
deeptools/multiBamSummary.py | gartician/deepTools | 351 | 1726927 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import os
import sys
import argparse
import numpy as np
import deeptools.countReadsPerBin as countR
from deeptools import parserCommon
from deeptools.utilities import smartLabels
from deeptools._version import __version__
old_settings =... | 4 | 3 | 0 | 0 | 7 | 0 |
sdk/python/pulumi_azure/loganalytics/data_source_windows_performance_counter.py | henriktao/pulumi-azure | 109 | 1726940 | <gh_stars>100-1000
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, over... | 0 | 0 | 0 | 0 | 0 | 0 |
tools.py | yihui-he/channel-pruning | 1,110 | 1726958 | <gh_stars>1000+
from __future__ import print_function
from lib.cfgs import c as dcfgs
import lib.cfgs as cfgs
import os
os.environ['JOBLIB_TEMP_FOLDER']=dcfgs.shm
import argparse
os.environ['GLOG_minloglevel'] = '3'
import os.path as osp
import pickle
import sys
from multiprocessing import Process, Queue
import matplo... | 0 | 0 | 0 | 0 | 0 | 0 |
HTML_Table_to_List/html_table_to_list_usage.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 1726978 | from HTMLTableToList import HTMLTableToList
from pprint import pprint
html_table_string = """<table class="table table-condensed">
<tr>
<th>RGB</th>
<td>53</td><td>72</td><td>35</td>
</tr>
<t... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/_base_/schedules/maskflownet_ft_1000k_schedule.py | hologerry/mmflow | 481 | 1727000 | <reponame>hologerry/mmflow
# optimizer
optimizer = dict(type='Adam', lr=5e-5, weight_decay=0.0004, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='MultiStage',
by_epoch=False,
gammas=[0.5, 0.5, 0.5, 0.5, 0.5],
milestone_lrs=[5e-5, 3e-5, 2e-5, 1e-5,... | 0 | 0 | 0 | 0 | 0 | 0 |
app/dwarf_expr.py | mongodb-labs/disasm | 269 | 1727022 | # Copyright 2016 MongoDB 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, sof... | 1 | 4 | 0 | 2 | 7 | 0 |
docs/rst_helpers.py | ion201/xonsh | 4,716 | 1727031 | """ReST-Jinja2 helpers"""
import re
def underline_title(title: str, level: int = -1) -> object:
symbols = "-.^"
if level < len(symbols):
under = symbols[level]
else:
under = symbols[-1]
return under * len(title)
def to_valid_id(name: str) -> str:
return re.sub(r"[^\w]", "_", name... | 8 | 5 | 0 | 0 | 13 | 0 |
zhaquirks/imagic/__init__.py | WolfRevo/zha-device-handlers | 213 | 1727043 | """Module for GreatStar quirks implementations."""
IMAGIC = "iMagic by GreatStar"
| 0 | 0 | 0 | 0 | 0 | 0 |
litedram/phy/sim_utils.py | jersey99/litedram | 237 | 1727054 | #
# This file is part of LiteDRAM.
#
# Copyright (c) 2021 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: BSD-2-Clause
from __future__ import annotations
from migen import *
from litex.build.sim import SimPlatform
from litex.build.sim.config import SimConfig
from litex.build.generic_platform import Pins, Subsi... | 7 | 8 | 5 | 2 | 22 | 0 |
examples/training.py | greehill/MinkowskiEngine | 851 | 1727103 | <reponame>greehill/MinkowskiEngine
# Copyright (c) <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 without restriction, including without limitation the rights to
# use, c... | 0 | 0 | 0 | 0 | 0 | 0 |
cocotb/queue.py | lavanyajagan/cocotb | 350 | 1727148 | <reponame>lavanyajagan/cocotb
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
import asyncio.queues
import collections
import heapq
from typing import Generic, TypeVar
import cocotb
from cocotb.triggers import Event, _pointer_st... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration_tests/api/system_backend/test_init.py | reimerp/hvac | 544 | 1727162 | import logging
from unittest import TestCase
from tests.utils.hvac_integration_test_case import HvacIntegrationTestCase
class TestInit(HvacIntegrationTestCase, TestCase):
def test_read_init_status(self):
read_response = self.client.sys.read_init_status()
logging.debug("read_response: %s" % read_r... | 0 | 0 | 0 | 0 | 0 | 0 |
galaxy/worker/exceptions.py | bmclaughlin/galaxy | 904 | 1727166 | <gh_stars>100-1000
# (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) an... | 0 | 0 | 0 | 0 | 0 | 0 |
Data_fetcher/fetcher_bal_orderbook.py | jianwang0212/Dash_eth | 159 | 1727208 | import requests
import pandas as pd
from datetime import datetime
import ccxt
import sqlite3
import config
import settings
now = datetime.utcnow()
def get_fx(currency_f) -> object:
fx = requests.get(
'https://apilayer.net/api/live?access_key=a1d6d82a3df7cf7882c9dd2b35146d6e&source=USD&format=1').json()
... | 0 | 6 | 0 | 0 | 6 | 0 |
myia/abstract/infer.py | strint/myia | 222 | 1727228 | <gh_stars>100-1000
"""Algorithms for inference."""
import asyncio
from dataclasses import replace as dc_replace
from functools import reduce
from ovld import OvldMC, ovld
from .. import operations, xtype
from ..info import About
from ..ir import Constant, Graph
from ..operations import primitives as P
from ..utils i... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/Vitis-AI-Runtime/VART/vart/trace/vaitrace/writer/parser/dpu_mc_parser/dpuv2.py | bluetiger9/Vitis-AI | 848 | 1727242 | <filename>tools/Vitis-AI-Runtime/VART/vart/trace/vaitrace/writer/parser/dpu_mc_parser/dpuv2.py<gh_stars>100-1000
# Copyright 2021 Xilinx 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/hello.py | fjflores/phy | 118 | 1727255 | """Hello world plugin."""
from phy import IPlugin, connect
class ExampleHelloPlugin(IPlugin):
def attach_to_controller(self, controller):
@connect(sender=controller)
def on_gui_ready(sender, gui):
"""This is called when the GUI and all objects are fully loaded.
This is to ... | 0 | 0 | 0 | 0 | 0 | 0 |
bashfuscator/modules/command_obfuscators/reverse.py | 0xflotus/Bashfuscator | 859 | 1727256 | <reponame>0xflotus/Bashfuscator<filename>bashfuscator/modules/command_obfuscators/reverse.py<gh_stars>100-1000
from bashfuscator.core.mutators.command_obfuscator import CommandObfuscator
from bashfuscator.core.mutators.command_obfuscator import Stub
class Reverse(CommandObfuscator):
def __init__(self):
su... | 0 | 0 | 0 | 0 | 0 | 0 |
autoscaler/__init__.py | christopherhesse/kubernetes-ec2-autoscaler | 900 | 1727264 | <reponame>christopherhesse/kubernetes-ec2-autoscaler
from autoscaler.kube import KubePodStatus
from autoscaler.kube import KubePod
from autoscaler.kube import KubeNode
from autoscaler.kube import KubeResource
| 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/997_Find_the_Town_Judge.py | its-sushant/coding-interview-gym | 713 | 1727304 | from collections import defaultdict
class Solution(object):
def findJudge(self, N, trust) -> object:
"""
:type N: int
:type trust: List[List[int]]
:rtype: int
"""
graph = defaultdict(list)
for i in range(1, N + 1):
graph[i] = []
for tru... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/is_ssa.py | tedbauer/bril | 176 | 1727400 | import json
import sys
def is_ssa(bril) -> bool:
"""Check whether a Bril program is in SSA form.
Every function in the program may assign to each variable once.
"""
for func in bril['functions']:
assigned = set()
for instr in func['instrs']:
if 'dest' in instr:
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/core/generate_/instance/test_generate_instance.py | akmaru/veriloggen | 232 | 1727453 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import generate_instance
expected_verilog = """
module blinkled #
(
parameter WIDTH = 8
)
(
input CLK,
input RST,
output [WIDTH-1:0] LED
);
genvar i;
generate for(i=0; i<WIDTH; i=i+1) begin: gen_for
submo... | 0 | 0 | 0 | 0 | 0 | 0 |
ztag/annotations/synology.py | justinbastress/ztag | 107 | 1727465 | from ztag.annotation import *
class SynologyDiskStationHTTPTitle(Annotation):
protocol = protocols.HTTP
subprotocol = protocols.HTTP.GET
port: None = None
def process(self, obj, meta) -> object:
t = obj["title"].strip()
if t.startswith("Synology DiskStation") or t.startswith("DiskSta... | 0 | 2 | 3 | 0 | 5 | 0 |
setup.py | marioidival/react-python | 374 | 1727478 | from setuptools import setup, find_packages
from react import VERSION
setup(
name='PyReact',
version=VERSION,
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/reactjs/react-python/',
license='Apache-2.0',
description='Python bridge to JSX & the React JavaScript library.',
... | 0 | 0 | 0 | 0 | 0 | 0 |
usaspending_api/etl/elasticsearch_loader_helpers/controller.py | ststuck/usaspending-api | 217 | 1727491 | import logging
from django.core.management import call_command
from math import ceil
from multiprocessing import Pool, Event, Value
from time import perf_counter
from typing import Generator, List, Tuple
from usaspending_api.broker.helpers.last_load_date import get_earliest_load_date, update_last_load_date
from usasp... | 0 | 0 | 0 | 0 | 0 | 1 |
gtfspy/import_loaders/stop_times_loader.py | Leo-Ryu/gtfspy | 118 | 1727516 | <reponame>Leo-Ryu/gtfspy<filename>gtfspy/import_loaders/stop_times_loader.py
from gtfspy.import_loaders.table_loader import TableLoader, decode_six
class StopTimesLoader(TableLoader):
fname = 'stop_times.txt'
table = 'stop_times'
tabledef = ('(stop_I INT, trip_I INT, arr_time TEXT, dep_time TEXT, '
... | 0 | 0 | 0 | 0 | 0 | 0 |
mmocr/datasets/pipelines/table_transforms.py | Jessmin/TableMASTER-mmocr | 206 | 1727597 | from __future__ import annotations
from mmdet.datasets.builder import PIPELINES
import os
import cv2
import random
import numpy as np
def visual_table_resized_bbox(results) -> object:
bboxes = results['img_info']['bbox']
img = results['img']
for bbox in bboxes:
img = cv2.rectangle(img, (int(bbox[0... | 13 | 13 | 0 | 0 | 26 | 0 |
src/networkx/algorithms/community/tests/test_asyn_lpa.py | MarletteFunding/aws-kube-codesuite | 184 | 1727608 | from itertools import chain
from itertools import combinations
from nose.tools import assert_equal, assert_in
import networkx as nx
from networkx.algorithms.community import asyn_lpa_communities
class TestAsynLpaCommunities(object):
def _check_communities(self, G, expected):
"""Checks that the communit... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/nose-1.3.7/functional_tests/support/package2/maths.py | kokosing/hue | 5,079 | 1727615 | <gh_stars>1000+
def add(a, b):
return a + b
def div(a, b):
return a // b
def minus(a, b):
return a - b
def mult(a, b):
return a * b
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_async.py | dhagrow/pydgraph | 260 | 1727663 | # Copyright 2020 Dgraph Labs, 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 writ... | 0 | 0 | 1 | 0 | 1 | 0 |
buildroot/support/testing/tests/package/test_luaossl.py | bramkragten/operating-system | 349 | 1727666 | from tests.package.test_lua import TestLuaBase
class TestLuaLuaossl(TestLuaBase):
config = TestLuaBase.config + \
"""
BR2_PACKAGE_LUA=y
BR2_PACKAGE_LUAOSSL=y
"""
def test_run(self):
self.login()
self.module_test("openssl")
self.module_test("_openssl")
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/twitter/common/threading/__init__.py | zhouyijiaren/commons | 1,143 | 1727691 |
from twitter.common.threading.periodic_thread import PeriodicThread
from twitter.common.threading.stoppable_thread import StoppableThread
__all__ = [
'PeriodicThread',
'StoppableThread'
]
| 0 | 0 | 0 | 0 | 0 | 0 |
src/lobe/api_client.py | AeroboticsGlobalTeam/lobe-python | 130 | 1727722 | #!/usr/bin/env python
import json
import requests
from PIL import Image
from .api_constants import IMAGE_INPUT
from .image_utils import image_to_base64
from .results import ClassificationResult
def send_image_predict_request(image: Image.Image, predict_url: str) -> ClassificationResult:
payload = {
IMAG... | 2 | 1 | 0 | 0 | 3 | 0 |
refinery/bnpy/bnpy-dev/bnpy/allocmodel/mix/HardDPMixModel.py | csa0001/Refinery | 103 | 1727746 | from __future__ import annotations
'''
HardDPMixModel.py
Bayesian parametric mixture model with a unbounded number of components K
'''
import numpy as np
from bnpy.allocmodel import DPMixModel
from bnpy.suffstats import SuffStatBag
from bnpy.util import NumericHardUtil
from bnpy.util import gammaln, digamma, EPS
cla... | 4 | 4 | 0 | 0 | 8 | 0 |
editor.py | JondareHM/Python-Prolog-Interpreter | 232 | 1727759 | from __future__ import annotations
from tkinter import Tk, Text, Menu, filedialog, Label, Button, END, W, E, FALSE
from tkinter.scrolledtext import ScrolledText
from prologpy.solver import Solver
def is_file_path_selected(file_path) -> object:
return file_path is not None and file_path != ""
def get_file_conten... | 3 | 6 | 0 | 1 | 10 | 0 |
server/intrinsic/management/commands/intrinsic_upload_photos.py | paulu/opensurfaces | 137 | 1727762 | from django.core.management.base import BaseCommand
from common.utils import progress_bar
from intrinsic.models import IntrinsicImagesDecomposition
from intrinsic.tasks import upload_intrinsic_file
class Command(BaseCommand):
args: str = ''
help: str = 'Upload images to EC2'
def handle(self, *args, **op... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/utils.py | DreamingRaven/TenSEAL | 410 | 1727769 | <reponame>DreamingRaven/TenSEAL
def almost_equal(vec1, vec2, m_pow_ten):
if len(vec1) != len(vec2):
return False
upper_bound = pow(10, -m_pow_ten)
for v1, v2 in zip(vec1, vec2):
if abs(v1 - v2) > upper_bound:
return False
return True
| 0 | 0 | 0 | 0 | 0 | 0 |
socialNetwork/test/TestPostStorage.py | rodrigo-bruno/DeathStarBench | 364 | 1727797 | import sys
sys.path.append('../gen-py')
import random
from social_network import PostStorageService
from social_network.ttypes import Media
from social_network.ttypes import PostType
from social_network.ttypes import Creator
from social_network.ttypes import Url
from social_network.ttypes import UserMention
from socia... | 0 | 0 | 0 | 0 | 0 | 0 |
module/RNN.py | mengtinglll/deepke | 173 | 1727799 | <gh_stars>100-1000
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
class RNN(nn.Module):
def __init__(self, config):
"""
type_rnn: RNN, GRU, LSTM 可选
"""
super(RNN, self).__init__()
# self.xxx = config.xxx
... | 0 | 0 | 0 | 0 | 0 | 0 |
pastepwn/scraping/pastebin/exceptions/pastedeletedexception.py | bajubullet/pastepwn | 113 | 1727804 | # -*- coding: utf-8 -*-
"""Module for the PasteDeletedException"""
class PasteDeletedException(Exception):
"""Exception class indicating a paste as been deleted"""
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
py2app_tests/plugin_with_scripts/main.py | flupke/py2app | 193 | 1727805 | <reponame>flupke/py2app
import sys
import Foundation
class BasicPlugin (Foundation.NSObject):
def performCommand_(self, cmd):
print ("+ %s"%(cmd,))
sys.stdout.flush()
| 0 | 0 | 0 | 0 | 0 | 0 |
lie_learn/representations/SO3/clebsch_gordan_numerical.py | machism0/lie_learn | 140 | 1727815 | <filename>lie_learn/representations/SO3/clebsch_gordan_numerical.py
"""
Compute the Clebsch-Gordan coefficients of SO(3) numerically.
These coefficients specify how a product of Wigner D functions can be re-expressed as a linear combination of
Wigner D functions.
Wikipedia gives the formula:
D^l_mn(a,b,c) D^l'_m'n'(a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_viz_substrcture.py | datamol-org/datamol | 130 | 1727861 | import datamol as dm
def test_match_substructure():
mol1 = dm.to_mol("CC(=O)OC1=CC=CC=C1C(=O)O")
mol2 = dm.to_mol("CCN(CC)CC(=O)CC(C)NC1=C2C=CC(=CC2=NC=C1)Cl")
query1 = dm.from_smarts("[C;H0](=O)")
query2 = dm.to_mol("CN(C)")
# Test multiple scenarios
dm.viz.match_substructure(
mols... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/nonebot-adapter-ding/nonebot/adapters/ding/utils.py | emicoto/none | 1,757 | 1727874 | import hmac
import base64
import hashlib
from nonebot.utils import logger_wrapper
log = logger_wrapper("DING")
def calc_hmac_base64(timestamp: str, secret: str) -> object:
secret_enc = secret.encode('utf-8')
string_to_sign = '{}\n{}'.format(timestamp, secret)
string_to_sign_enc = string_to_sign.encode('... | 2 | 1 | 0 | 0 | 3 | 0 |
train/meta_optimizers.py | junwoopark92/L2T_ww | 260 | 1727938 | <filename>train/meta_optimizers.py<gh_stars>100-1000
import torch, copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
def _copy(state):
if isinstance(state, torch.Tensor):
return state.cpu().clone()
elif isinstance(state, dict):
new_state = {}
... | 0 | 0 | 0 | 0 | 0 | 0 |
cyvlfeat/sift/tests/phow_test.py | hubutui/cyvlfeat | 103 | 1727941 | <filename>cyvlfeat/sift/tests/phow_test.py
import numpy as np
import pytest
from numpy.testing import assert_allclose
from scipy.misc import face
import cyvlfeat
from cyvlfeat.sift.phow import phow
import pytest
img_rgb = face(gray=False).astype(np.float32)
img_gray = face(gray=True).astype(np.float32)
@pytest.mark... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/docs_snippets_crag/docs_snippets_crag/guides/dagster/graph_job_op/composite_solid_ins_out.py | dbatten5/dagster | 4,606 | 1727973 | from dagster import OutputDefinition, composite_solid, pipeline, solid
from dagster.core.definitions.input import InputDefinition
@solid
def do_something():
pass
@solid
def one() -> int:
return 1
@solid(
input_defs=[InputDefinition("arg1", int)],
output_defs=[OutputDefinition(int)],
)
def do_somet... | 0 | 3 | 0 | 0 | 3 | 0 |
riskslim/loss_functions/build_cython_loss_functions.py | jnirschl/risk-slim | 117 | 1727988 | #!/usr/bin/env python
"""
This script builds loss functions using Cython on a local machine.
To run this script
1. Change to the directory
$REPO_DIR/riskslim/loss_functions
2. Run the following commands in Bash:
python2 build_cython_loss_functions.py build_ext --inplace
python3 build_cython_loss_functions.py build... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/diggext/drivers/devices/consoleservers/__init__.py | thekad/clusto | 216 | 1728008 | <filename>contrib/diggext/drivers/devices/consoleservers/__init__.py
from opengear import *
| 0 | 0 | 0 | 0 | 0 | 0 |
crowdsourcing/migrations/0004_auto_20170731_2150.py | Kyeongan/crowdsource-platform | 138 | 1728039 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-31 21:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('crowdsourcing', '0003_taskworker_attempt'),
]
operations: li... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/server_subscribe_events_test.py | authorizon/fastapi_websocket_pubsub | 125 | 1728074 | <reponame>authorizon/fastapi_websocket_pubsub
import os
import sys
from fastapi_websocket_rpc import logger
from fastapi_websocket_pubsub.event_notifier import EventNotifier
# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/third_party/html5lib/html5lib/tests/test_whitespace_filter.py | ziransun/wpt | 2,479 | 1728115 | from __future__ import absolute_import, division, unicode_literals
from html5lib.filters.whitespace import Filter
from html5lib.constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)
def runTest(input, expected):
output = list(Filter(input))
errorMsg = "\n".join(["\n\nInput:", str(input)... | 0 | 0 | 0 | 0 | 0 | 0 |
Site/cogs/custom commands.py | Shuri2060/Nurevam | 145 | 1728159 | from __future__ import annotations
from flask import Blueprint, render_template, request, redirect, url_for, flash
import logging
import utils
log = logging.getLogger("Nurevam.site")
limit = 25 #original was 10.
blueprint = Blueprint('customcmd', __name__, template_folder='../templates/custom commands')
name = "cu... | 0 | 7 | 0 | 0 | 7 | 0 |
49-image_captioning/Model.py | mhsattarian/class.vision | 103 | 1728178 | from keras.layers import Input, Dense, LSTM, Embedding, Dropout
from keras.layers.merge import add
from keras.models import Model
from keras.utils import plot_model
from nltk.translate.bleu_score import corpus_bleu
from DataUtils import generate_desc
# define the captioning model
def define_model(vocab_size, max_len... | 0 | 1 | 0 | 0 | 1 | 0 |
test-common/integrationtest/libs/clients/tb_cluster.py | lotabout/OpenMLDB | 2,659 | 1728180 | <reponame>lotabout/OpenMLDB<gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# 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.or... | 0 | 0 | 0 | 0 | 0 | 0 |
core/memory.py | R3NI3/pytorch-rl | 851 | 1728194 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from collections import deque, namedtuple
import warnings
import random
from utils.helpers import Experience
def sample_batch_indexes(low, high, size):
if high - low >... | 0 | 0 | 0 | 0 | 0 | 0 |
gfauto/gfauto/cov_new.py | KishkinJ10/graphicsfuzz | 519 | 1728218 | <reponame>KishkinJ10/graphicsfuzz
# -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project 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
#
# https://www.apache.org/lic... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/models/yolos/test_modeling_yolos.py | bugface/transformers | 8,028 | 1728221 | <reponame>bugface/transformers<filename>tests/models/yolos/test_modeling_yolos.py<gh_stars>1000+
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. 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 ma... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/xml/polymorphic_roundtrip.py | edustaff/spyne | 786 | 1728223 | #!/usr/bin/env python3
from __future__ import annotations
from __future__ import print_function, unicode_literals
import sys
from lxml import etree
from spyne.interface.xml_schema.parser import hier_repr
from spyne.util import six
from spyne import ComplexModel, Unicode
from spyne.util.xml import get_object_as_xml_... | 1 | 0 | 6 | 3 | 10 | 0 |
examples/imagenet-transfer-learning/score.py | NunoEdgarGFlowHub/MLOps | 1,068 | 1728248 | import json
import numpy as np
import os
import tensorflow as tf
def read_tensor_from_byte_array(byteArray,
input_height: int=224,
input_width: int=224,
input_mean: float=127.5,
input_std: fl... | 4 | 5 | 0 | 0 | 9 | 0 |
tryalgo/our_std.py | IAbeteEtMechante/tryalgo | 351 | 1728259 | #!/usr/bin/env python3
# coding=utf8
"""\
Our Standards
<NAME> et <NAME> - 2020
"""
from sys import stdin
def readint() -> object:
"""
function to read an integer from stdin
"""
return int(stdin.readline())
def readstr() -> object:
"""
function to read a string from stdin
"""
return ... | 0 | 4 | 0 | 0 | 4 | 0 |
pymagnitude/third_party/allennlp/nn/regularizers/regularizers.py | tpeng/magnitude | 1,520 | 1728266 | <reponame>tpeng/magnitude<gh_stars>1000+
from __future__ import absolute_import
import torch
from allennlp.nn.regularizers.regularizer import Regularizer
class L1Regularizer(Regularizer):
u"""Represents a penalty proportional to the sum of the absolute values of the parameters"""
def __init__(self, alpha ... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/identity/azure-identity/tests/test_live_async.py | rsdoherty/azure-sdk-for-python | 2,728 | 1728294 | <gh_stars>1000+
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
from azure.identity.aio import DefaultAzureCredential, CertificateCredential, ClientSecretCredential
ARM_SCOPE = "https://management.azur... | 0 | 0 | 0 | 0 | 0 | 0 |
src/GridCal/ExecuteGridCal.py | mzy2240/GridCal | 284 | 1728299 | <gh_stars>100-1000
# This file is part of GridCal.g
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distribu... | 0 | 0 | 0 | 0 | 0 | 0 |
nested_admin/tests/nested_delete_validationerrors/models.py | jpic/django-nested-admin | 580 | 1728312 | from __future__ import unicode_literals
from django.db import models
from django.db.models import ForeignKey, CASCADE
from nested_admin.tests.compat import python_2_unicode_compatible
@python_2_unicode_compatible
class Parent(models.Model):
name = models.CharField(max_length=128)
def __str__(self) -> object... | 0 | 3 | 2 | 0 | 5 | 0 |
paas-ce/paas/esb/components/bk/apis/fta/http_relay.py | renmcc/bk-PaaS | 767 | 1728365 | <filename>paas-ce/paas/esb/components/bk/apis/fta/http_relay.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Lic... | 0 | 0 | 0 | 0 | 0 | 0 |
hedgehog/structure.py | h8hw8943/hedgehog | 121 | 1728376 | from __future__ import annotations
import collections
import itertools
import numpy as np
__all__ = ['chow_liu']
def chow_liu(X, root: object | None=None) -> list[object]:
"""Return a Chow-Liu tree.
A Chow-Liu tree takes three steps to build:
1. Compute the mutual information between each pair of var... | 1 | 4 | 0 | 0 | 5 | 0 |
docs/OOPS/static2.py | munyumunyu/Python-for-beginners | 158 | 1728388 | '''
However, the solution of hardcoding the value in the attribute is not a good one.
For example, since this is a limited time discount we should be able to programmatically
enable and disable the discount using functions like this:
'''
class Mobile:
def __init__(self, price, brand):
self.price = price... | 0 | 0 | 0 | 1 | 1 | 0 |
tests/catalyst/runners/test_runner.py | tadejsv/catalyst | 206 | 1728419 | # flake8: noqa
from typing import Tuple
import shutil
import pytest
import torch
from torch import nn, Tensor
from torch.utils.data import DataLoader, Dataset, TensorDataset
from catalyst import dl
from catalyst.core.runner import IRunnerError
from catalyst.dl import Callback, CallbackOrder, SupervisedRunner
class... | 3 | 7 | 2 | 0 | 12 | 0 |
tests/tests_gui.py | insilications/tqdm-clr | 22,617 | 1728439 | """Test `tqdm.gui`."""
from .tests_tqdm import importorskip
def test_gui_import():
"""Test `tqdm.gui` import"""
importorskip('tqdm.gui')
| 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.