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 |
|---|---|---|---|---|---|---|---|---|---|---|
meta-genivi-dev/meta-genivi-dev/lib/oeqa/runtime/cases/devpackages.py | naminyeop/genivi-dev-platform | 103 | 3275782 | <gh_stars>100-1000
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
# Make sure that dev-pkgs are not installed unless explicitly enabled
# in IMAGE_FEATURES
class DevPackages(OERuntimeTestCase):
@OETestID(2001)
... | 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/non_response.py | hajime9652/observations | 199 | 3275809 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def non_response(path) -> tuple[object, object]:
"""Non-Response Survey D... | 0 | 1 | 0 | 0 | 1 | 0 |
quickai/yolo/train.py | xhabara/quickai | 139 | 3275840 | <filename>quickai/yolo/train.py<gh_stars>100-1000
import os
class YOLOV4_Train:
def __init__(
self,
train_data_path="data/obj/",
test_data_path="data/test/",
data_file="data/obj.data",
cfg_file="cfg/yolov4-obj.cfg",
weights="./yolov4.conv.137... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/minimum-one-bit-operations-to-make-integers-zero.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 3275846 | <gh_stars>1000+
# Time: O(logn)
# Space: O(1)
# reference: https://en.wikipedia.org/wiki/Gray_code
class Solution(object):
def minimumOneBitOperations(self, n):
"""
:type n: int
:rtype: int
"""
def gray_to_binary(n):
result = 0
while n:
... | 0 | 0 | 0 | 0 | 0 | 0 |
etc/pending_ugens/FFTTrigger.py | butayama/supriya | 191 | 3275855 | from __future__ import annotations
import collections
from supriya.enums import CalculationRate
from supriya.ugens.PV_ChainUGen import PV_ChainUGen
class FFTTrigger(PV_ChainUGen):
"""
::
>>> ffttrigger = supriya.ugens.FFTTrigger.ar(
... buffer_id=buffer_id,
... hop=0.5,
... | 7 | 4 | 2 | 0 | 13 | 0 |
reddit2telegram/channels/r_indiantiktokgonewildd/app.py | mainyordle/reddit2telegram | 187 | 3275873 | #encoding:utf-8
subreddit = 'Indiantiktokgonewild'
t_channel = '@r_Indiantiktokgonewildd'
def send_post(submission, r2t) -> object:
return r2t.send_simple(submission)
| 0 | 1 | 0 | 0 | 1 | 0 |
MMunsuperseg-beta/PiCIE/tools/prepare_histogram.py | GeoAI4EO/MMUnsupervisedSeg | 113 | 3275881 | <reponame>GeoAI4EO/MMUnsupervisedSeg<filename>MMunsuperseg-beta/PiCIE/tools/prepare_histogram.py
import os
import sys
import argparse
import logging
import time as t
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from module import fpn
from commons import *
from utils import... | 0 | 0 | 0 | 0 | 0 | 0 |
hooks/run-all-in-dir.py | RomaKoks/druid | 5,813 | 3275936 | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | 0 | 0 | 0 | 0 | 0 | 0 |
zentral/contrib/filebeat/views.py | gwhitehawk/zentral | 634 | 3275937 | <gh_stars>100-1000
import json
import logging
from django.core.exceptions import SuspiciousOperation
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404, redirect
from django.views.generic import DetailView, ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/backend/common/manipulators/event_team_manipulator.py | ofekashery/the-blue-alliance | 266 | 3275959 | from typing import List
from backend.common.cache_clearing import get_affected_queries
from backend.common.manipulators.manipulator_base import ManipulatorBase
from backend.common.models.cached_model import TAffectedReferences
from backend.common.models.event_team import EventTeam
class EventTeamManipulator(Manipula... | 4 | 2 | 0 | 0 | 6 | 0 |
datasets/build_cars196.py | Mithilesh1609/assembled-cnn | 363 | 3276001 | <filename>datasets/build_cars196.py
#!/usr/bin/env python
# coding=utf8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""CAR196 를 생성한다.
example:
CUDA_VISIBLE_DEVICES="" python build_cars196.py \
--data_dir=cars196 \
--output_dir=cars196/tfrecord_cls \
--us... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter09/9-10.py | alberthao/Python-Crash-Course-Homework | 138 | 3276013 | from restaurant import Restaurant
channel_club = Restaurant('the channel club', 'steak and seafood')
channel_club.describe_restaurant()
channel_club.open_restaurant() | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/partial2.py | martindemello/pyright | 3,934 | 3276014 | <filename>packages/pyright-internal/src/tests/samples/partial2.py
# This sample tests the functools.partial support for keyword parameters.
from functools import partial
from typing import Protocol
def func1(a: int, b: int, x: str) -> str:
return x
class Proto1(Protocol):
def __call__(self, x: str) -> str:... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | d136o/fauxtograph | 248 | 3276015 | from setuptools import setup
setup(
name='fauxtograph',
version='1.0.3',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
description='Python module for training unsupervised deep, generative models on images.',
packages=['fauxtograph'],
long_description='Python module for traini... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils/test_Utils.py | ankitshah009/dcase_util | 122 | 3276023 | """ Unit tests for Utils """
import nose.tools
import dcase_util
from dcase_util.utils import get_parameter_hash, SimpleMathStringEvaluator
def test_get_parameter_hash():
data = {
'field1': {
'1': [1, 2, 3],
'2': 1234,
},
'field2': {
'sub_field1': 1234
... | 0 | 0 | 0 | 0 | 0 | 0 |
Surface_mesh_topology/benchmark/Surface_mesh_topology/graphs/plot-res.py | ffteja/cgal | 3,227 | 3276027 | <filename>Surface_mesh_topology/benchmark/Surface_mesh_topology/graphs/plot-res.py
import matplotlib.pyplot as plt
import numpy as np
# exec(open("./plot-res.py").read())
x = [10, 10, 10, 20, 20, 20, 30, 30, 30, 100, 100, 100, 200, 200, 200, 300, 300, 300, 1000, 1000, 1000, 2000, 2000, 2000, 3000, 3000, 3000, 10000, 1... | 0 | 0 | 0 | 0 | 0 | 0 |
src/betterproto/_version.py | hsh-nids/python-betterproto | 708 | 3276028 | <gh_stars>100-1000
from pkg_resources import get_distribution
__version__ = get_distribution("betterproto").version
| 0 | 0 | 0 | 0 | 0 | 0 |
demo-network/ws-rpcping.py | easye/emotiq | 109 | 3276043 | #!/usr/bin/env python3
import asyncio
import websockets
import sys
from jsonrpc_websocket import Server
if len(sys.argv) > 1:
node_offset = int(sys.argv[1])
else:
node_offset = 1
async def main():
server = Server("ws://localhost:%d/wallet" % (4144+node_offset))
try:
await server.ws_connect()
... | 0 | 0 | 0 | 0 | 0 | 0 |
basic/19-brownie/Brownie/tests/exchange/test_token_to_eth.py | yingjingyang/Dapp-Learning | 634 | 3276068 | <filename>basic/19-brownie/Brownie/tests/exchange/test_token_to_eth.py
from brownie import accounts
import brownie
def test_token_to_eth_swap(w3, HAY_token, hay_token_exchange):
HAY_token.approve(hay_token_exchange, 10 * 10 ** 18, {"from": accounts[0]})
# step 1: initialize exchange
hay_token_exchange.in... | 0 | 0 | 0 | 0 | 0 | 0 |
pulsar/__init__.py | PyCN/pulsar | 1,410 | 3276104 | # -*- coding: utf-8 -
"""Event driven concurrent framework for Python"""
from .utils.version import get_version
VERSION = (2, 0, 2, 'final', 0)
__version__ = version = get_version(VERSION)
__author__ = "<NAME>"
DEFAULT_PORT = 8060
ASYNC_TIMEOUT = None
SERVER_NAME = 'pulsar'
JAPANESE = b'\xe3\x83\x91\xe3\x83\xab\x... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdet3d/core/bbox/assigners/__init__.py | XuyangBai/mmdetection3d | 109 | 3276121 | <reponame>XuyangBai/mmdetection3d<gh_stars>100-1000
from mmdet.core.bbox import AssignResult, BaseAssigner, MaxIoUAssigner
from .hungarian_assigner import HungarianAssigner3D, HeuristicAssigner3D
__all__ = ['BaseAssigner', 'MaxIoUAssigner', 'AssignResult', 'HungarianAssigner3D', 'HeuristicAssigner']
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/api/endpoints/test_shared_upload_links.py | MJochim/seahub | 420 | 3276143 | import json
from django.utils.dateformat import DateFormat
from seahub.share.models import UploadLinkShare
from seahub.test_utils import BaseTestCase
class SharedUploadLinksTest(BaseTestCase):
def tearDown(self):
self.remove_repo()
def test_can_list(self):
ls = UploadLinkShare.objects.create... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter04/4-7.py | alberthao/Python-Crash-Course-Homework | 138 | 3276146 | threemul = [value*3 for value in range(1,7)]
print(threemul)
threechu = [value/3 for value in range(3,31)]
print(threechu) | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayOverseasFundInstitutionschoolinfCreateModel.py | antopen/alipay-sdk-python-all | 213 | 3276149 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOverseasFundInstitutionschoolinfCreateModel(object):
def __init__(self):
self._attr_code: None = None
self._bussess_adr: None = None
... | 0 | 39 | 0 | 37 | 76 | 0 |
test/test_helper_email.py | neerajv18/SecureTea-Project | 257 | 3276217 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from securetea.lib.notifs.aws.helper_email import Email
import unittest
try:
# if python 3.x.x
from unittest.mock import patch
except ImportError: # python 2.x.x
from mock import patch
class TestSecureTeaHelperEmail(unittest.TestCase):
"""
Test class fo... | 0 | 0 | 0 | 0 | 0 | 0 |
dymos/transcriptions/__init__.py | kaushikponnapalli/dymos | 104 | 3276240 | from .explicit_shooting.explicit_shooting import ExplicitShooting
from .pseudospectral.gauss_lobatto import GaussLobatto
from .pseudospectral.radau_pseudospectral import Radau
from .solve_ivp.solve_ivp import SolveIVP
| 0 | 0 | 0 | 0 | 0 | 0 |
integrations/opsgenie/oecAlertaExecutor.py | sainivinit/alerta-contrib | 114 | 3276304 | <filename>integrations/opsgenie/oecAlertaExecutor.py
#!/usr/bin/env python3
import argparse
import json
import logging
import sys
import requests
parser = argparse.ArgumentParser()
parser.add_argument('-payload', '--queuePayload', help='Payload from queue', required=True)
parser.add_argument('-apiKey', '--apiKey', hel... | 0 | 0 | 0 | 0 | 0 | 0 |
middleware/session_keys.py | goztrk/django-htk | 206 | 3276312 | DJANGO_TIMEZONE = 'django_timezone'
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/gpio.py | gumbald/photobooth | 105 | 3276320 | #!/usr/bin/env python
import RPi.GPIO as GPIO
from time import sleep
import atexit
#Variables to change as needed
led_pin = 7 # LED pin
btn_pin = 18 # pin for the button
debounce = 0.3 # how long to debounce the button. Add more time if the button triggers too many times.
#GPIO setup
GPIO.setmode(GPIO.BOARD)
GP... | 0 | 0 | 0 | 0 | 0 | 0 |
scale/vault/test/test_secrets_handler.py | kaydoh/scale | 121 | 3276358 | from __future__ import unicode_literals
import json
import requests
from mock import patch, MagicMock
import django
from django.conf import settings
from django.test import TestCase, TransactionTestCase
from error.models import Error
from vault.secrets_handler import SecretsHandler
from vault.exceptions import Inva... | 0 | 11 | 0 | 0 | 11 | 0 |
LeafNATS/modules/utils/PositionwiseFeedForward.py | haophancs/TREQS | 149 | 3276383 | '''
@author <NAME>
Please contact <EMAIL>
https://github.com/codertimo/BERT-pytorch.git
https://github.com/namisan/mt-dnn
https://github.com/dhlee347/pytorchic-bert.git
'''
import math
import torch
def gelu(x) -> object:
'''
GELU activation function.
'''
return x * 0.5 * (1.0 + torch.erf(x / math.sq... | 0 | 2 | 0 | 0 | 2 | 0 |
sentdex_data_analysis/pandas_joiningData.py | yull1860outlook/Data-Analysis | 4,358 | 3276391 | <reponame>yull1860outlook/Data-Analysis<filename>sentdex_data_analysis/pandas_joiningData.py
import pickle
import pandas as pd
import quandl
import matplotlib.pyplot as plt
from matplotlib import style
style.use("seaborn")
quandl.ApiConfig.api_key = "rFsSehe51RLzREtYhLfo"
def mortgage_30yr():
df = quandl.get("F... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Unittest/Fixtures/init_db.py | Gjacquenot/training-material | 115 | 3276425 | #!/usr/bin/env python
from argparse import ArgumentParser
import sqlite3
import sys
def execute_statement(cursor, sql_statement, is_verbose: bool=False):
'''execute SQL statement if it is non-empty'''
if len(sql_statement):
if is_verbose:
print('executing:\n{0}'.format(sql_statement), fil... | 2 | 0 | 0 | 0 | 2 | 0 |
tests/compat/mock.py | chriscasey/django-rest-swagger | 2,470 | 3276438 | # pylint: disable=W0614,W0401
from __future__ import absolute_import
try:
from unittest.mock import *
except ImportError:
from mock import *
| 0 | 0 | 0 | 0 | 0 | 0 |
Python3/130.py | rakhi2001/ecom7 | 854 | 3276455 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 140 ms submission
from collections import deque
class Solution:
def solve(self, board: List[List[str]]) -> None:
"""
Do not return anything, modify board in-place inste... | 0 | 0 | 0 | 0 | 0 | 0 |
GPIO/orangepi_PC_gpio_pyH3-master/examples/read_key_PG7.py | RetroJamo/RetrOrangePi | 140 | 3276456 | #!/usr/bin/env python
"""Read button.
Make gpio input and enable pull-up resistor.
"""
import os
import sys
if not os.getegid() == 0:
sys.exit('Script must be run as root')
from time import sleep
from pyA20.gpio import gpio
from pyA20.gpio import connector
from pyA20.gpio import port
__author__ = "<NAME>"
__co... | 0 | 0 | 0 | 0 | 0 | 0 |
onnx_tf/handlers/backend/range.py | malisit/onnx-tensorflow | 1,110 | 3276460 | <gh_stars>1000+
import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import tf_func
@onnx_op("Range")
@tf_func(tf.range)
class Round(BackendHandler):
@classmethod
def version_11(cls, node, **kwargs):
re... | 0 | 0 | 0 | 0 | 0 | 0 |
python/01-detect-text-local.py | vucetica/amazon-textract-code-samples | 291 | 3276489 | <filename>python/01-detect-text-local.py
import boto3
# Document
documentName = "simple-document-image.jpg"
# Read document content
with open(documentName, 'rb') as document:
imageBytes = bytearray(document.read())
# Amazon Textract client
textract = boto3.client('textract')
# Call Amazon Textract
response = te... | 0 | 0 | 0 | 0 | 0 | 0 |
tpu/backup.py | acheketa/cwavegan | 107 | 3276504 | <filename>tpu/backup.py
from __future__ import print_function
from google.cloud import storage
import sys
def copy_blob(bucket_name, blob_name, new_bucket_name, new_blob_name):
"""Copies a blob from one bucket to another with a new name."""
storage_client = storage.Client()
source_bucket = storage_client.g... | 0 | 0 | 0 | 0 | 0 | 0 |
visualize_collect.py | 3keepmovingforward3/suiron | 800 | 3276513 | import sys
import json
from suiron.core.SuironVZ import visualize_data
from suiron.utils.file_finder import get_latest_filename
# Load image settings
with open('settings.json') as d:
SETTINGS = json.load(d)
# Visualize latest filename
filename = get_latest_filename()
# If we specified which file
if len(sys.arg... | 0 | 0 | 0 | 0 | 0 | 0 |
weibo_spider/weibo_spider/pipelines.py | wen-fei/SinaWeiboSpider | 227 | 3276529 | <reponame>wen-fei/SinaWeiboSpider
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
from scrapy.exceptions import DropItem
from pymongo.helpers import DuplicateKe... | 0 | 0 | 0 | 0 | 0 | 0 |
sigopt-beats-vegas/predictor/read_data.py | meghanaravikumar/sigopt-examples | 213 | 3276566 | <filename>sigopt-beats-vegas/predictor/read_data.py
import json
import datetime
from team_stats import TeamStats
from box_score_helpers import get_total_points_from_boxscore
from constant import TEAM_ID_TO_NAME
def read_box_scores(file_name='../boxscores/all_boxscores.json'):
try:
with open(file_name, 'r') as f... | 0 | 0 | 0 | 0 | 0 | 0 |
Z - Tool Box/LaZagne/Windows/lazagne/softwares/multimedia/eyecon.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 3276601 | <filename>Z - Tool Box/LaZagne/Windows/lazagne/softwares/multimedia/eyecon.py<gh_stars>1000+
# -*- coding: utf-8 -*-
import codecs
try:
import _winreg as winreg
except ImportError:
import winreg
from lazagne.config.module_info import ModuleInfo
from lazagne.config.winstructure import *
class EyeCON(ModuleIn... | 0 | 0 | 0 | 0 | 0 | 0 |
fairness/data/objects/TwoGaussians.py | yashwarlord/fairness-comparison | 146 | 3276605 | from fairness.data.objects.Data import Data
import numpy as np
import pandas as pd
import math
##############################################################################
TOTAL_ITEMS = 200
class TwoGaussians(Data):
def __init__(self, percent_pos):
Data.__init__(self)
self.dataset_name = 'two-... | 0 | 1 | 0 | 7 | 8 | 0 |
correios/update_wsdl.py | Gikeda2016/Correios-olist | 154 | 3276641 | <filename>correios/update_wsdl.py
# Copyright 2016 <NAME>
#
# 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 | 0 | 0 | 0 | 0 | 0 |
examples/from_source/index.bzl | kriswuollett/rules_nodejs | 645 | 3276667 | """Example package for generating stardoc from rules_nodejs at source"""
load("@build_bazel_rules_nodejs//packages/typescript:index.bzl", "ts_project")
def custom_ts_project(name, deps: list[object] = [], **kwargs):
"""
Helper wrapper around ts_project adding default attributes and dependencies
Args:
... | 1 | 0 | 0 | 0 | 1 | 0 |
kobo-book-downloader/Globals.py | Nebopolis/kobo-book-downloader | 146 | 3276673 | <filename>kobo-book-downloader/Globals.py
class Globals:
Kobo = None
Settings = None | 0 | 0 | 0 | 0 | 0 | 0 |
code/chapter-9/image-to-json.py | dnaveenr/Practical-Deep-Learning-Book | 564 | 3276691 | <reponame>dnaveenr/Practical-Deep-Learning-Book<filename>code/chapter-9/image-to-json.py<gh_stars>100-1000
import numpy as np
from PIL import Image
import json
import argparse
def resize_image(img):
max_dimension = 256
width, height = img.size
if width < max_dimension and height < max_dimension:
r... | 0 | 0 | 0 | 0 | 0 | 0 |
PyFin/Math/Distributions/__init__.py | rpatil524/Finance-Python | 325 | 3276693 | # -*- coding: utf-8 -*-
u"""
Created on 2015-7-23
@author: cheng.li
"""
from PyFin.Math.Distributions.NormalDistribution import NormalDistribution
from PyFin.Math.Distributions.NormalDistribution import CumulativeNormalDistribution
from PyFin.Math.Distributions.NormalDistribution import InverseCumulativeNormal
__all... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/grammar/test_transformer.py | AlexandreH/securify2 | 258 | 3276699 | import unittest
from pprint import pprint
from securify.grammar import Grammar
from securify.grammar.transformer import DictTransformer
from tests.grammar.grammars import simple
class DictTransformerTest(unittest.TestCase):
grammar = Grammar.from_modules(simple)
transformer = DictTransformer(
gramma... | 0 | 0 | 0 | 0 | 0 | 0 |
CTFd/schemas/pages.py | omertuc/CTFd | 3,592 | 3276711 | from __future__ import annotations
from marshmallow import pre_load, validate
from marshmallow_sqlalchemy import field_for
from CTFd.models import Pages, ma
from CTFd.utils import string_types
class PageSchema(ma.ModelSchema):
class Meta:
model = Pages
include_fk: bool = True
dump_only: t... | 1 | 0 | 2 | 0 | 3 | 0 |
tools/tool_utils.bzl | TimNN/rules_rust | 349 | 3276718 | from __future__ import annotations
"""A helper module for the various targets in the `@rules_rust//tools` package"""
def aspect_repository() -> object | str:
"""Determines the repository name to use in Bazel commands that use aspects.
Some tools (`//tools/rustfmt` `//tools/rust_analyzer`) make calls to Bazel
... | 0 | 1 | 0 | 0 | 1 | 0 |
learn/libs/xml/xml_etree.py | mauroere/opencv | 568 | 3276743 | <gh_stars>100-1000
import urllib.request
import xml.etree.ElementTree as ET
#########################
## ElementTree XML API ##
#########################
# Reference: http://docs.python.org/3/library/xml.etree.elementtree.html
# CONVERT A WELL-FORMED XML FILE INTO AN OBJECT
# Obtain an XML file from internet
respo... | 0 | 0 | 0 | 0 | 0 | 0 |
image_synthesis/modeling/models/unconditional_dalle.py | buxiangzhiren/VQ-Diffusion_office | 236 | 3276755 | <gh_stars>100-1000
# ------------------------------------------
# VQ-Diffusion
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# written By <NAME>
# ------------------------------------------
import torch
import math
from torch import nn
from image_synthesis.utils.misc import instantiate_from_... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/1289.py | rakhi2001/ecom7 | 854 | 3276785 | __________________________________________________________________________________________________
sample 232 ms submission
import math
class Solution:
def minFallingPathSum(self, arr: List[List[int]]) -> int:
R = len(arr)
C = len(arr[0])
assert C >= 2 # no possible shift
pm1 = pm2 ... | 0 | 0 | 0 | 0 | 0 | 0 |
dash_docs/chapters/dash_core_components/Input/index.py | joelostblom/dash-docs | 379 | 3276828 | <reponame>joelostblom/dash-docs<gh_stars>100-1000
# -*- coding: utf-8 -*-
import dash_core_components as dcc
import dash_html_components as html
from dash_docs import styles
from dash_docs import tools
from dash_docs import reusable_components as rc
examples = tools.load_examples(__file__)
layout = html.Div(childre... | 0 | 0 | 0 | 0 | 0 | 0 |
bigbench/benchmark_tasks/chess_state_tracking/scripts/generate_tasks.py | dimmollo/BIG-bench | 460 | 3276829 | <reponame>dimmollo/BIG-bench
import argparse
import random
import os
import chess
import json
from os import path
from collections import OrderedDict
from typing import List
PREFIX_SIZE_TO_RANGE = {'short': (1, 50), 'medium': (51, 100), 'long': (101, 200)}
def get_info_from_game_prefix(uci_prefix):
piece_type_... | 0 | 0 | 0 | 0 | 0 | 0 |
metadata-ingestion/examples/library/lineage_job_dataflow_new_api_simple.py | ShubhamThakre/datahub | 1,603 | 3276830 | import uuid
from datetime import datetime
from datahub.api.entities.datajob import DataFlow, DataJob
from datahub.api.entities.dataprocess.dataprocess_instance import (
DataProcessInstance,
InstanceRunResult,
)
from datahub.emitter.rest_emitter import DatahubRestEmitter
emitter = DatahubRestEmitter("http://lo... | 0 | 0 | 0 | 0 | 0 | 0 |
xfer/__init__.py | 0xflotus/xfer | 244 | 3276835 | # 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://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | 0 | 0 | 0 | 0 | 0 | 0 |
opendeep/data/standard_datasets/__init__.py | vitruvianscience/OpenDeep | 252 | 3276845 | from __future__ import division, absolute_import, print_function
from .image import *
from .midi import *
| 0 | 0 | 0 | 0 | 0 | 0 |
Python-3/basic_examples/strings/string_to_float.py | ghiloufibelgacem/jornaldev | 1,139 | 3276889 | <reponame>ghiloufibelgacem/jornaldev
s = '10.5674'
f = float(s)
print(type(f))
print('Float Value =', f)
input_1 = input('Please enter first floating point value:\n')
input_1 = float(input_1)
input_2 = input('Please enter second floating point value:\n')
input_2 = float(input_2)
print(f'Sum of {input_1} and {input... | 0 | 0 | 0 | 0 | 0 | 0 |
packshaders.py | iwaken71/hello-webxr | 248 | 3276923 | import glob, os.path, time, sys
def pack():
output = open('./src/lib/shaders.js', 'wt')
files = glob.glob('./src/shaders/*.glsl')
output.write('export var shaders = {\n')
for file in files:
f = open(file, 'rt')
shader = f.read()
f.close()
var = '_'.join(os.path.basename(file).split('.')[:-1]... | 0 | 0 | 0 | 0 | 0 | 0 |
Manipulating DataFrames with pandas/Chapter 2 - Advanced indexing.py | nabeelsana/DataCamp-courses | 464 | 3276938 | #Chapter 2 - Advanced indexing
#Changing index of a DataFrame
# Create the list of new indexes: new_idx
new_idx = [sales.upper() for sales in sales.index]
# Assign new_idx to sales.index
sales.index = new_idx
# Print the sales DataFrame
print(sales)
#Changing index name labels
# Assign the string 'MONTHS' to sales.... | 0 | 0 | 0 | 0 | 0 | 0 |
chrome/app/policy/PRESUBMIT.py | Scopetta197/chromium | 212 | 3276950 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# If this presubmit check fails or misbehaves, please complain to
# <EMAIL>, <EMAIL> or <EMAIL>.
from __future__ import annotations
def _CheckPolicyTem... | 0 | 5 | 0 | 0 | 5 | 0 |
samples/server/petstore/python-aiohttp/tests/test_store_controller.py | MalcolmScoffable/openapi-generator | 11,868 | 3276975 | <reponame>MalcolmScoffable/openapi-generator
# coding: utf-8
import pytest
import json
from aiohttp import web
from openapi_server.models.order import Order
async def test_delete_order(client):
"""Test case for delete_order
Delete purchase order by ID
"""
headers = {
}
response = await cli... | 0 | 0 | 0 | 0 | 0 | 0 |
grow/pods/messages.py | denmojo/pygrow | 335 | 3277003 | from protorpc import messages
class Kind(messages.Enum):
RENDERED: int = 1
STATIC: int = 2
SITEMAP: int = 3
class RouteMessage(messages.Message):
path = messages.StringField(1)
kind = messages.EnumField(Kind, 2)
locale = messages.StringField(3)
class Format(messages.Enum):
YAML: int = ... | 0 | 0 | 13 | 0 | 13 | 0 |
backpack/extensions/secondorder/hbp/flatten.py | jabader97/backpack | 395 | 3277074 | from backpack.core.derivatives.flatten import FlattenDerivatives
from backpack.extensions.secondorder.hbp.hbpbase import HBPBaseModule
class HBPFlatten(HBPBaseModule):
def __init__(self):
super().__init__(derivatives=FlattenDerivatives())
| 0 | 0 | 0 | 0 | 0 | 0 |
safeopt/tests/test_swarm.py | adrianpaeckel/SafeOpt | 107 | 3277084 | <reponame>adrianpaeckel/SafeOpt<filename>safeopt/tests/test_swarm.py
"""Test the SafeOptSwarm method"""
from __future__ import division
import GPy
import numpy as np
import pytest
from safeopt import SafeOptSwarm
def test_empty_safe_set():
"""Make sure an error is raised with an empty safe set."""
x = np... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/704_Binary_Search.py | XSoyOscar/Algorithms | 713 | 3277105 | <reponame>XSoyOscar/Algorithms<gh_stars>100-1000
# https://leetcode.com/problems/binary-search/
class Solution:
def search(self, nums, target):
l, r = 0, len(nums) - 1
while l <= r:
mid = (l + r) // 2
if nums[mid] < target:
l = mid
elif nums[mid]... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/QRadar/Scripts/QRadarGetOffenseCorrelations/QRadarGetOffenseCorrelations.py | diCagri/content | 799 | 3277148 | import demistomock as demisto
from CommonServerPython import *
def get_query(cre_name_null) -> object:
if cre_name_null == "False":
query = "SELECT *,\"CRE Name\",\"CRE Description\",CATEGORYNAME(highlevelcategory) " \
"FROM events WHERE \"CRE NAME\" <> NULL AND INOFFENSE({0}) START '{1}'"... | 0 | 1 | 0 | 0 | 1 | 0 |
BitTornado/Application/ConfigDir.py | crossbrowsertesting/BitTornado | 116 | 3277210 | """Manage application-specific configuration and caches
"""
import BitTornado
import sys
import os
import time
from binascii import hexlify, unhexlify
from .inifile import ini_write, ini_read
from BitTornado.Meta.bencode import bencode, bdecode
from .parseargs import defaultargs
DIRNAME = '.' + BitTornado.product_nam... | 0 | 0 | 0 | 0 | 0 | 1 |
tests/cosrlibtests/test_ranker.py | commonsearch/cosr-back | 141 | 3277212 |
def test_get_global_document_rank_url(ranker) -> object:
def rank(url) -> object:
r, _ = ranker.client.get_global_url_rank(url)
return r
# Google isn't in our wikidata dump
assert 1 >= rank("http://google.com") > 0.5
# Facebook isn't in our DMOZ dump
assert rank("http://google.co... | 0 | 2 | 0 | 0 | 2 | 0 |
eth_tester/utils/formatting.py | PabloLefort/eth-tester | 215 | 3277240 | <gh_stars>100-1000
from __future__ import absolute_import
import functools
from cytoolz.functoolz import (
curry,
)
from eth_utils import (
to_dict,
to_list,
)
def hex_to_integer(value):
return int(value, 16)
@curry
@to_list
def apply_formatter_at_index(formatter, at_index, value):
if at_inde... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/vulnerable_app/views/basic.py | bbhunter/fuzz-lightyear | 169 | 3277261 | <filename>testing/vulnerable_app/views/basic.py
"""
Basic, straight forward endpoints for MVP testing.
"""
from flask_restplus import Resource
from ..core.extensions import api
from ..parsers.basic import number_query_parser
from ..util import get_name
from .models.basic import session_model
from .models.basic import ... | 0 | 0 | 0 | 0 | 0 | 0 |
grobidTagger.py | tantikristanti/delft | 333 | 3277275 | # -*- coding: utf-8 -*-
from __future__ import annotations
import argparse
import json
import time
from sklearn.model_selection import train_test_split
from delft.sequenceLabelling import Sequence
from delft.sequenceLabelling.models import *
from delft.sequenceLabelling.reader import load_data_and_labels_crf_file
fr... | 19 | 3 | 4 | 0 | 26 | 0 |
elpis/engines/common/objects/fsobject.py | guillaume-wisniewski/elpis | 118 | 3277289 | import json
import time
from abc import ABC, abstractclassmethod, abstractmethod
from pathlib import Path
from elpis.engines.common.utilities import hasher
# Design constraint
# Since there are four classes that must have their states saved to the
# operating system, this single class was made to provide some common
#... | 6 | 14 | 1 | 0 | 21 | 0 |
voice2json/utils.py | CvH/voice2json | 913 | 3277307 | <filename>voice2json/utils.py
"""Utility methods for voice2json."""
import asyncio
import collections
import io
import logging
import os
import platform
import random
import ssl
import sys
import typing
import wave
from collections import deque
from pathlib import Path
import aiofiles
import aiohttp
import pydash
_LO... | 0 | 0 | 0 | 0 | 0 | 0 |
build/android/pylib/utils/test_options_parser.py | nagineni/chromium-crosswalk | 231 | 3277325 | <reponame>nagineni/chromium-crosswalk
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Parses options for the instrumentation tests."""
import os
# TODO(gkanwar): Some downstream scripts current r... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/Vitis-AI-Runtime/VART/vart/trace/vaitrace/tracer/xir.py | hito0512/Vitis-AI | 848 | 3277345 | <gh_stars>100-1000
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Copyright 2019 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
# http://www.apache.org/licenses/LICENSE-2.0
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
k_nearest_neighbors/k_nearest_neighbors.py | suitnecniv/dota2 | 127 | 3277346 | import numpy as np
import pickle, os
NUM_HEROES = 108
NUM_FEATURES = NUM_HEROES * 2
NUM_IN_QUERY = 0
# Lower this value to speed up recommendation engine
TRAINING_SET_SIZE = 10000
def my_distance(vec1,vec2) -> object:
'''Returns a count of the elements that were 1 in both vec1 and vec2.'''
return np.sum(np.lo... | 1 | 7 | 0 | 0 | 8 | 0 |
scripts/35-mkwww-diffs.py | jmviz/xd | 179 | 3277353 | <reponame>jmviz/xd
#!/usr/bin/env python3
#
#
import difflib
import datetime
from xdfile import utils
from xdfile.html import mktag, mkhref, grid_diff_html
from xdfile.utils import info, warn
from xdfile.utils import get_args, open_output, find_files, log, debug, get_log, COLUMN_SEPARATOR, EOL, parse_tsv, progress, p... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractThousandsilentstarsCom.py | fake-name/ReadableWebProxy | 193 | 3277380 | <reponame>fake-name/ReadableWebProxy
def extractThousandsilentstarsCom(item):
'''
Parser for 'thousandsilentstars.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('otouto wo suki ni narimashi... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sol/handle_wormhole.py | terra-dashboard/staketaxcsv | 140 | 3277382 | <filename>src/sol/handle_wormhole.py<gh_stars>100-1000
from common.ExporterTypes import TX_TYPE_SOL_WORMHOLE_NOOP
from common.make_tx import make_simple_tx, make_transfer_in_tx, make_transfer_out_tx
from sol.handle_simple import handle_unknown_detect_transfers
def handle_wormhole(exporter, txinfo):
transfers_in, ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_compile_errors.py | leonardt/magma | 167 | 3277411 | <reponame>leonardt/magma
import pytest
from magma import *
from magma.uniquification import MultipleDefinitionException
@pytest.mark.skip("Multiple Definitions no longer supported because we cache on names")
def test_multiple_definitions_are_same():
class Circ1(Circuit):
name = "same"
io = m.IO(I=... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter01/22_return_statement.py | add54/ADMIN_SYS_PYTHON | 116 | 3277412 | <filename>Chapter01/22_return_statement.py
def return_value(a):
if a >= 0:
return a
else:
return -a
print(return_value(2))
print(return_value(-4))
| 0 | 0 | 0 | 0 | 0 | 0 |
src/visualizers/panels/TensorPlotter/explorer_helpers.py | JSTransformationBenchmarks/deepforge | 726 | 3277429 | import json
def metadata(name, data) -> object:
info = {}
info['name'] = name
if type(data) is dict:
info['entries'] = [metadata(k, v) for (k, v) in data.items()]
else:
info['shape'] = data.shape
return info
def tolist(array) -> object:
depth = len(array.shape)
if depth ==... | 0 | 6 | 0 | 0 | 6 | 0 |
src/python/nimbusml/tests/preprocessing/schema/test_columnduplicator.py | michaelgsharp/NimbusML | 134 | 3277493 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
import unittest
import pandas
from... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/480_Sliding_Window_Median.py | vansh-tiwari/coding-interview-gym | 713 | 3277496 | <reponame>vansh-tiwari/coding-interview-gym<filename>leetcode.com/python/480_Sliding_Window_Median.py
from heapq import *
import heapq
# Solution from https://leetcode.com/problems/find-median-from-data-stream/
class MedianFinder(object):
def __init__(self):
"""
initialize your data structure her... | 0 | 0 | 0 | 0 | 0 | 0 |
python/examples/aws.py | zcjtom/cm_api | 329 | 3277515 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_callbacks.py | ZvonimirBandic/QuCumber | 163 | 3277575 | # Copyright 2019 PIQuIL - All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed ... | 0 | 0 | 0 | 0 | 0 | 0 |
env/lib/python3.6/site-packages/scipy/special/tests/test_zeta.py | anthowen/duplify | 6,989 | 3277626 | <gh_stars>1000+
from __future__ import division, print_function, absolute_import
import scipy.special as sc
import numpy as np
from numpy.testing import assert_, assert_equal, assert_allclose
def test_zeta():
assert_allclose(sc.zeta(2,2), np.pi**2/6 - 1, rtol=1e-12)
def test_zeta_1arg():
assert_allclose(sc... | 0 | 0 | 0 | 0 | 0 | 0 |
malwareconfig/common.py | BA7JCM/RATDecoders | 905 | 3277649 | import string
class Decoder(object):
decoder_name: str = ""
decoder_version: int = 1
decoder_author: str = ""
decoder_description: str = ""
file_info = object
def set_file(self, file_info):
self.file_info = file_info
def get_config(self):
pass
class PreProcessor(object)... | 0 | 1 | 8 | 0 | 9 | 0 |
src/models/layers/__init__.py | microsoft/vision-longformer | 169 | 3277652 | # Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license.
# Written by <NAME>, <EMAIL>
from .longformer2d import Long2DSCSelfAttention
from .performer import FastAttention, PerformerSelfAttention
from .linformer import LinformerSelfAttention
from .srformer import SRSelfAttention
| 0 | 0 | 0 | 0 | 0 | 0 |
example/app/integrations/fps_integration.py | litchfield/merchant | 332 | 3277655 | from billing.integrations.amazon_fps_integration import AmazonFpsIntegration as Integration
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
import urlparse
class FpsIntegration(Integration):
def transaction(self, request) -> object:
"""Ideally at this method, you w... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/hls/test_errors.py | bogdanvuk/pygears | 120 | 3277680 | import pytest
from pygears.hls.translate import translate_gear
from pygears import gear, find
from pygears.typing import Uint, Tuple
from pygears.hls import HLSSyntaxError
from pygears.lib import const
# Should report that this is unsupported
# @gear
# def test() -> Uint[8]:
# yield -1
# def test_out_cast_fail()... | 0 | 0 | 0 | 0 | 0 | 0 |
transpyle/fortran/parser.py | EraYaN/transpyle | 107 | 3277700 | """Fortran Parser which simply delegates the work to Open Fortran Parser XML generator."""
import pathlib
import xml.etree.ElementTree as ET
import open_fortran_parser
from ..general import Parser
from ..general.tools import summarize_completed_process
class FortranParser(Parser):
def _parse_scope(self, code:... | 2 | 1 | 0 | 0 | 3 | 0 |
scattertext/features/FeatsFromGeneralInquirer.py | shettyprithvi/scattertext | 1,823 | 3277723 | <gh_stars>1000+
from collections import Counter
from re import split
from sys import version_info
import pandas as pd
from scattertext.Common import GENERAL_INQUIRER_URL
from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc
class FeatsFromGeneralInquirer(FeatsFromSpacyDoc):
def __init__(self,
... | 0 | 0 | 0 | 0 | 0 | 0 |
igibson/examples/demo/cleaning_demo_loader.py | suresh-guttikonda/iGibson | 360 | 3277741 | <reponame>suresh-guttikonda/iGibson<filename>igibson/examples/demo/cleaning_demo_loader.py
from igibson import object_states
from igibson.scenes.igibson_indoor_scene import InteractiveIndoorScene
from igibson.simulator import Simulator
def main():
s = Simulator(mode="gui", device_idx=0)
scene = InteractiveInd... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_compression/python/layers/initializers_test.py | Faizullah877/compression | 636 | 3277742 | <filename>tensorflow_compression/python/layers/initializers_test.py
# Copyright 2021 Google LLC. 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... | 0 | 0 | 0 | 0 | 0 | 0 |
tock/hours/migrations/0037_remove_timecardprefilldata_user.py | mikiec84/tock | 134 | 3277745 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-12-29 20:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hours', '0036_timecardprefill-to-employee'),
]
operations = [
mi... | 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.