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 |
|---|---|---|---|---|---|---|---|---|---|---|
corehq/util/workbook_reading/__init__.py | dimagilg/commcare-hq | 471 | 133832 | <gh_stars>100-1000
from corehq.util.workbook_reading.exceptions import (
CellValueError,
SpreadsheetFileEncrypted,
SpreadsheetFileError,
SpreadsheetFileExtError,
SpreadsheetFileInvalidError,
SpreadsheetFileNotFound,
)
from .datamodels import Cell, Workbook, Worksheet
from .adapters import (
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ut/python/nn/probability/distribution/test_beta.py | PowerOlive/mindspore | 3,200 | 133842 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 | 6 | 0 | 0 | 6 | 0 |
SimG4CMS/Calo/python/APDSimu_cff.py | ckamtsikis/cmssw | 852 | 133845 | import FWCore.ParameterSet.Config as cms
def customise(process) -> object:
# add ECAL and HCAL specific Geant4 hits objects
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
instanceLabel = cms.untracked.string('EcalValidInfo'),
type = cms.string('EcalSimHitsValidProducer'),
verbose = cms.... | 0 | 1 | 0 | 0 | 1 | 0 |
core/ignore.py | RandomRhythm/maltrail | 4,758 | 133846 | #!/usr/bin/env python
"""
Copyright (c) 2014-2021 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
# simple ignore rule mechanism configured by file 'misc/ignore_event.txt' and/or user defined `USER_IGNORELIST`
import ... | 0 | 1 | 0 | 0 | 1 | 0 |
dev/test/genrnd.py | Cam2337/snap-python | 242 | 133851 | <reponame>Cam2337/snap-python<filename>dev/test/genrnd.py
import random
import sys
sys.path.append("../swig")
import snap
def GenRndGnm():
Graph = snap.GenRndGnm_PNGraph(1000,10000)
print "Graph", str(type(Graph)), Graph.GetNodes(), Graph.GetEdges()
# save the graph
FName = "test2.graph"
print "... | 0 | 0 | 0 | 0 | 0 | 0 |
ambari-common/src/main/python/ambari_commons/os_windows.py | likenamehaojie/Apache-Ambari-ZH | 1,664 | 133856 | # !/usr/bin/env python
from __future__ import annotations
'''
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 ... | 20 | 33 | 3 | 1 | 57 | 0 |
raft/node.py | shunliz/raft | 113 | 133876 | <filename>raft/node.py
import os
import json
import time
import random
import logging
from .log import Log
from .rpc import Rpc
from .config import config
# logging.basicConfig(level=logging.INFO,
# format='%(asctime)s %(levelname)s %(name)s %(funcName)s [line:%(lineno)d] %(message)s')
logger = l... | 0 | 0 | 0 | 0 | 0 | 0 |
pkgs/notebook-4.1.0-py27_1/lib/python2.7/site-packages/notebook/tests/test_files.py | wangyum/anaconda | 652 | 133882 | # coding: utf-8
"""Test the /files/ handler."""
import io
import os
from unicodedata import normalize
pjoin = os.path.join
import requests
import json
from nbformat import write
from nbformat.v4 import (new_notebook,
new_markdown_cell, new_code_cell,
new_o... | 0 | 0 | 0 | 0 | 0 | 0 |
extract_ped_per_frame.py | versey-sherry/Towards-Realtime-MOT | 2,158 | 133886 | import argparse
import json
import time
from pathlib import Path
from sklearn import metrics
from scipy import interpolate
import torch.nn.functional as F
from models import *
from utils.utils import *
from torchvision.transforms import transforms as T
from utils.datasets import LoadImages, JointDataset, co... | 7 | 0 | 0 | 0 | 7 | 0 |
projects/DensePose/densepose/modeling/__init__.py | mmabrouk/detectron2 | 21,274 | 133906 | # Copyright (c) Facebook, Inc. and its affiliates.
from .confidence import DensePoseConfidenceModelConfig, DensePoseUVConfidenceType
from .filter import DensePoseDataFilter
from .inference import densepose_inference
from .utils import initialize_module_params
from .build import (
build_densepose_data_filter,
b... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/pylama/lint/pylama_mccabe.py | ShadowLNC/linter-pylama | 463 | 133913 | from __future__ import annotations
"""Code complexity checking."""
from mccabe import McCabeChecker
from pylama.lint import Linter as Abstract
import ast
class Linter(Abstract):
"""Run complexity checking."""
@staticmethod
def run(path, code: object | None=None, params: object | None=None, **meta) -> o... | 2 | 1 | 0 | 0 | 3 | 0 |
tests/syntax/async_def_missing_parens.py | matan-h/friendly | 287 | 133925 | <filename>tests/syntax/async_def_missing_parens.py
async def name:
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
sanic_jwt_extended/decorators.py | devArtoria/Sanic-JWT-extended | 465 | 133930 | from __future__ import annotations
from functools import wraps
from typing import Callable, List, Optional, Tuple
from sanic.request import Request
from sanic_jwt_extended.exceptions import (
AccessDeniedError,
ConfigurationConflictError,
CSRFError,
FreshTokenRequiredError,
InvalidHeaderError,
... | 8 | 14 | 4 | 0 | 26 | 0 |
dojo/rules/views.py | mtcolman/django-DefectDojo | 1,772 | 133955 | # Standard library imports
import json
import logging
# Third party imports
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.con... | 0 | 5 | 0 | 0 | 5 | 0 |
GeneratorInterface/GenFilters/test/test_EMJetHeep_cfg.py | ckamtsikis/cmssw | 852 | 133983 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from Configuration.GenProduction.PythiaUESettings_cfi import *
process = cms.Process("TEST")
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
process.load("Configuration.StandardSequences.Services_cff")
process.load("SimGeneral.HepPDTES... | 0 | 0 | 0 | 0 | 0 | 0 |
diskimage_builder/block_device/level0/localloop.py | fooxlj07/diskimage-builder | 262 | 133996 | # Copyright 2016 <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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 0 | 5 | 0 | 0 | 5 | 0 |
eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/Tools/RecursiveNull.py | bopopescu/phyG | 115 | 134006 | """
Nothing, but in a friendly way. Good for filling in for objects you want to
hide. If $form.f1 is a RecursiveNull object, then
$form.f1.anything["you"].might("use") will resolve to the empty string.
This module was contributed by <NAME>.
"""
class RecursiveNull(object):
def __getattr__(self, attr) -> object:... | 0 | 8 | 0 | 0 | 8 | 0 |
src/genie/libs/parser/iosxe/tests/ShowSpanningTreeMstDetail/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 134033 | <filename>src/genie/libs/parser/iosxe/tests/ShowSpanningTreeMstDetail/cli/equal/golden_output_1_expected.py
expected_output = {
'mst_instances': {
6: {
'bridge_address': '5897.bdff.3b3a',
'bridge_priority': 20486,
'interfaces': {
'GigabitEthernet1/7': {
... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/galaxy_test/api/test_workflows_cwl.py | quacksawbones/galaxy-1 | 1,085 | 134049 | <filename>lib/galaxy_test/api/test_workflows_cwl.py
"""Test CWL workflow functionality."""
from galaxy_test.api.test_workflows import BaseWorkflowsApiTestCase
from galaxy_test.base.populators import CwlPopulator
class BaseCwlWorkflowTestCase(BaseWorkflowsApiTestCase):
allow_path_paste = True
require_admin_use... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/oauth_sqlite3_app_org_level.py | hirosassa/bolt-python | 504 | 134050 | import logging
logging.basicConfig(level=logging.DEBUG)
from slack_bolt import App, BoltContext
from slack_bolt.oauth import OAuthFlow
from slack_sdk import WebClient
app = App(oauth_flow=OAuthFlow.sqlite3(database="./slackapp.db"))
@app.use
def dump(context, next, logger):
logger.info(context)
next()
@... | 2 | 0 | 0 | 0 | 2 | 0 |
xt/agent/muzero/mcts.py | TianQi-777/xingtian | 240 | 134057 | """MCTS module: where MuZero thinks inside the tree."""
import math
import random
import numpy as np
from xt.agent.muzero.default_config import PB_C_BASE, PB_C_INIT
from xt.agent.muzero.default_config import ROOT_DIRICHLET_ALPHA
from xt.agent.muzero.default_config import ROOT_EXPLORATION_FRACTION
from xt.agent.muzer... | 1 | 4 | 0 | 0 | 5 | 0 |
plugins/base64_plugin/lib/Base64.py | MrT3acher/Android-Malware-Sandbox | 218 | 134069 | <filename>plugins/base64_plugin/lib/Base64.py<gh_stars>100-1000
import datetime
from lib.model.database.Database import Database
from sqlalchemy import Column, Integer, String, Date, DateTime, ForeignKey
Base = Database.get_declarative_base()
class Base64(Base):
__tablename__ = 'base64'
id = Column(Intege... | 0 | 0 | 0 | 0 | 0 | 0 |
extensions/cauchy/test_cauchy.py | NathanYanJing/state-spaces | 513 | 134094 | <filename>extensions/cauchy/test_cauchy.py
import math
import torch
import pytest
from einops import rearrange
from cauchy import cauchy_mult_torch, cauchy_mult_keops, cauchy_mult
def generate_data(batch_size, N, L, symmetric=True, device='cuda'):
if not symmetric:
v = torch.randn(batch_size, N, dtype=... | 0 | 0 | 0 | 0 | 0 | 0 |
akshare/air/air_zhenqi.py | NovelResearchInvestment/akshare | 721 | 134111 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2022/2/24 14:50
Desc: 真气网-空气质量
https://www.zq12369.com/environment.php
空气质量在线监测分析平台的空气质量数据
https://www.aqistudy.cn/
"""
import json
import os
import re
import pandas as pd
import requests
from py_mini_racer import py_mini_racer
from akshare.utils import demjson
... | 11 | 7 | 0 | 0 | 18 | 0 |
build/scripts/build_java_with_error_prone.py | jochenater/catboost | 6,989 | 134121 | <gh_stars>1000+
import sys
import os
ERROR_PRONE_FLAGS = [
'-Xep:FunctionalInterfaceMethodChanged:WARN',
'-Xep:ReturnValueIgnored:WARN',
]
JAVA10_EXPORTS = [
'--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'--add-... | 0 | 0 | 0 | 0 | 0 | 0 |
bpython/autocomplete.py | gpotter2/bpython | 2,168 | 134145 | # The MIT License
#
# Copyright (c) 2009-2015 the bpython authors.
# Copyright (c) 2015-2020 <NAME>
#
# 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 li... | 110 | 49 | 5 | 1 | 165 | 0 |
tests/st/ops/gpu/test_in_top_k.py | PowerOlive/mindspore | 3,200 | 134178 | <filename>tests/st/ops/gpu/test_in_top_k.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 0 | 0 | 0 | 0 | 0 | 0 |
leet/sorting/rankTeams.py | peterlamar/python-cp-cheatsheet | 140 | 134181 | <reponame>peterlamar/python-cp-cheatsheet
class Solution:
def rankTeams(self, votes: List[str]) -> str:
# Create 2D data structure A : 0, 0, 0, 'A', C: 0, 0, 0, 'B'
rnk = {v:[0] * len(votes[0]) + [v] for v in votes[0]}
# Tally votes in reverse because sort defaults ascending
for v i... | 0 | 0 | 0 | 0 | 0 | 0 |
source/code/troubleshooter/modules/syslog_tst/syslog.py | akenamon/OMS-Agent-for-Linux | 252 | 134192 | <filename>source/code/troubleshooter/modules/syslog_tst/syslog.py<gh_stars>100-1000
from error_codes import *
from errors import is_error, print_errors
from helpers import geninfo_lookup, check_service_controller
from install.check_oms import get_oms_version
from install.install ... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/final5.py | Jasha10/pyright | 3,934 | 134200 | <reponame>Jasha10/pyright
# This sample tests that instance variables declared as Final within
# a dataclass do not need to have an explicit assignment because
# the generated __init__ method will assign them.
from dataclasses import dataclass
from typing import Final
class Foo1:
x: Final[int]
def __init__(... | 0 | 0 | 0 | 0 | 0 | 0 |
cctbx/geometry_restraints/flags.py | dperl-sol/cctbx_project | 155 | 134239 | <reponame>dperl-sol/cctbx_project<gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from libtbx import adopt_init_args
import sys
class flags(object):
def __init__(self,
bond=None,
nonbonded=None,
angle=None,
dihedral=None,
reference_coordinat... | 0 | 0 | 0 | 0 | 0 | 0 |
src/research/CIM/cim_to_matpower/test/test.py | mzy2240/GridCal | 284 | 134250 |
import CIM2Matpower
# from scipy.io import savemat
cim_to_matpower_filename = 'CIM_to_Matpower_import'
cimfiles = ['./UCTE10_20090319_modified_EQ.xml',
'./UCTE10_20090319_modified_TP.xml',
'./UCTE10_20090319_modified_SV.xml']
boundary_profiles = []
mpc = CIM2Matpower.cim_to_mpc(cimfiles, b... | 0 | 0 | 0 | 0 | 0 | 0 |
PDF/check_type.py | saneravi/ML_Stuff | 209 | 134261 | import pprint
import click
import fitz # pip install pymupdf
@click.command()
@click.argument("filepath", type=click.Path(exists=True))
def entrypoint(filepath):
pp = pprint.PrettyPrinter(indent=4)
with fitz.open(filepath) as doc:
pp.pprint(doc.metadata)
print(f"Scanned pages: {get_scanned_p... | 1 | 1 | 0 | 0 | 2 | 0 |
Chapter13/webapp/babel/controllers.py | jayakumardhananjayan/pythonwebtut | 135 | 134272 | from flask import Blueprint, session, redirect, url_for
babel_blueprint = Blueprint(
'babel',
__name__,
url_prefix="/babel"
)
@babel_blueprint.route('/<string:locale>')
def index(locale) -> object:
session['locale'] = locale
return redirect(url_for('blog.home'))
| 0 | 1 | 0 | 0 | 1 | 0 |
extraPackages/matplotlib-3.0.3/examples/images_contours_and_fields/contourf_demo.py | dolboBobo/python3_ios | 130 | 134287 | <gh_stars>100-1000
"""
=============
Contourf Demo
=============
How to use the :meth:`.axes.Axes.contourf` method to create filled contour plots.
"""
import numpy as np
import matplotlib.pyplot as plt
origin = 'lower'
delta = 0.025
x = y = np.arange(-3.0, 3.01, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-X**2 - Y... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/binary-tree-coloring-game.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 134289 | # Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
from __future__ import annotations
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left: None = None
self.right: None = None
class Solution(object):
def btreeGameWinningMove(self, root, n, x) -> int | ob... | 0 | 2 | 0 | 2 | 4 | 0 |
examples/hello_coroutine.py | haypo/trollius | 175 | 134290 | """Print 'Hello World' every two seconds, using a coroutine."""
import trollius
from trollius import From
@trollius.coroutine
def greet_every_two_seconds():
while True:
print('Hello World')
yield From(trollius.sleep(2))
if __name__ == '__main__':
loop = trollius.get_event_loop()
try:
... | 0 | 0 | 0 | 0 | 0 | 0 |
dashboard/dashboard/edit_anomaly_configs.py | Martijnve23/catapult | 1,894 | 134293 | # Copyright 2015 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.
"""Provides the web interface for editing anomaly threshold configurations."""
from __future__ import print_function
from __future__ import division
from __fu... | 0 | 3 | 0 | 0 | 3 | 0 |
python/oneflow/compatible/single_client/layers.py | wangyuyue/oneflow | 3,285 | 134294 | <gh_stars>1000+
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 134299 | # 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 |
test/torchaudio_unittest/datasets/vctk_test.py | popcornell/audio | 1,718 | 134328 | <reponame>popcornell/audio<gh_stars>1000+
import os
from pathlib import Path
from torchaudio.datasets import vctk
from torchaudio_unittest.common_utils import (
TempDirMixin,
TorchaudioTestCase,
get_whitenoise,
save_wav,
normalize_wav,
)
# Used to generate a unique transcript for each dummy audio ... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/update_mir_test_checks.py | arunkumarbhattar/llvm | 4,812 | 134332 | #!/usr/bin/env python
from __future__ import annotations
"""Updates FileCheck checks in MIR tests.
This script is a utility to update MIR based tests with new FileCheck
patterns.
The checks added by this script will cover the entire body of each
function it handles. Virtual registers used are given names via
FileChe... | 6 | 11 | 0 | 0 | 17 | 0 |
src/tests/migration/test_bookkeeping_migration.py | mv-idatalytics/jenkins-byro | 114 | 134337 | import pytest
from django.db.models import Q
from helper import TestMigrations
class TestWithShackdataBase(TestMigrations):
app: str = "bookkeeping"
migrate_fixtures: list[str] = ["tests/fixtures/test_shackspace_transactions.json"]
migrate_from: str = "0012_auto_20180617_1926"
@pytest.mark.xfail
@pytest... | 0 | 0 | 5 | 0 | 5 | 0 |
Autocoders/Python/src/fprime_ac/generators/writers/GTestWriterBase.py | SSteve/fprime | 9,182 | 134339 | <filename>Autocoders/Python/src/fprime_ac/generators/writers/GTestWriterBase.py<gh_stars>1000+
# ===============================================================================
# NAME: GTestWriterBase.py
#
# DESCRIPTION: A base class for GTest writers
#
# AUTHOR: <NAME>
# EMAIL: <EMAIL>
# DATE CREATED : July 8, 2019
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | truthiswill/intellij-community | 229 | 134355 | <gh_stars>100-1000
# This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
# print('Startup LLDB in Python!')
import lldb
try:... | 0 | 0 | 0 | 0 | 0 | 0 |
esp32/frozen/_boot.py | peterson79/pycom-micropython-sigfox | 198 | 134363 | <reponame>peterson79/pycom-micropython-sigfox
# _boot.py -- always run on boot-up, even during safe boot
import os
from machine import UART
os.dupterm(UART(0, 115200))
| 0 | 0 | 0 | 0 | 0 | 0 |
common/ops/gather_ops.py | vahidk/TensorflowFramework | 129 | 134375 | <filename>common/ops/gather_ops.py
"""Gather ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from common.ops import shape_ops
def batch_gather(tensor, indices):
"""Gather in batch from a tensor of arbitrary size.
In ps... | 0 | 0 | 0 | 0 | 0 | 0 |
PYTHON/pattern.py | ayushyado/HACKTOBERFEST2021-2 | 125 | 134399 | # Python program to draw square
# using Turtle Programming
import turtle
skk = turtle.Turtle()
for i in range(4):
skk.forward(50)
skk.right(90)
turtle.done()
# Python program to draw star
# using Turtle Programming
import turtle
star = turtle.Turtle()
star.right(75)
star.forward(100)
for i in range(4):
star.r... | 0 | 0 | 0 | 0 | 0 | 0 |
Allura/allura/tests/scripts/test_delete_projects.py | rohankumardubey/allura | 113 | 134400 | <filename>Allura/allura/tests/scripts/test_delete_projects.py
# coding=utf-8
# 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 A... | 0 | 0 | 0 | 0 | 0 | 0 |
src/storage-preview/azext_storage_preview/vendored_sdks/azure_storagev2/fileshare/v2020_02_10/_serialize.py | Mannan2812/azure-cli-extensions | 207 | 134418 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: ... | 0 | 5 | 0 | 0 | 5 | 0 |
examples/wmf_example.py | carmanzhang/cornac | 597 | 134432 | <gh_stars>100-1000
# Copyright 2018 The Cornac 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 requ... | 0 | 0 | 0 | 0 | 0 | 0 |
train.py | JJinIT/som-dst | 139 | 134435 | <filename>train.py
"""
SOM-DST
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
from model import SomDST
from pytorch_transformers import BertTokenizer, AdamW, WarmupLinearSchedule, BertConfig
from utils.data_utils import prepare_dataset, MultiWozDataset
from utils.data_utils import make_slot_meta, domain2id, OP... | 0 | 0 | 0 | 0 | 0 | 0 |
intro/numpy/solutions/2_2_data_statistics.py | rossbar/scipy-lecture-notes | 2,538 | 134458 | <filename>intro/numpy/solutions/2_2_data_statistics.py<gh_stars>1000+
import numpy as np
data = np.loadtxt('../../../data/populations.txt')
year, hares, lynxes, carrots = data.T
populations = data[:,1:]
print(" Hares, Lynxes, Carrots")
print("Mean:", populations.mean(axis=0))
print("Std:", populations.std(axis=... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test006.py | takipsizad/pyjs | 739 | 134471 | from __future__ import annotations
import DOM
class UIObject:
def getElement(self) -> object:
return self.element
def setElement(self, element):
self.element = element
def setStyleName(self, style):
DOM.setAttribute(self.element, "className", style)
class Widget(UIObject):
... | 1 | 1 | 0 | 0 | 2 | 0 |
src/tests/test_mas.py | francesco-p/FACIL | 243 | 134489 | from tests import run_main_and_assert
FAST_LOCAL_TEST_ARGS = "--exp-name local_test --datasets mnist" \
" --network LeNet --num-tasks 3 --seed 1 --batch-size 32" \
" --nepochs 3" \
" --num-workers 0" \
" --approach mas"
def t... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/apitests/python/test_push_cnab_bundle.py | PushkarJ/harbor | 12,706 | 134524 | from __future__ import absolute_import
import sys
import unittest
from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import harbor_server
from testutils import TEARDOWN
import library.repository
import library.cnab
from library.project import Project
from library.user import User
from library... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/numpy/ma/tests/test_deprecations.py | rocketbot-cl/recognition | 353 | 134534 | <filename>libs/numpy/ma/tests/test_deprecations.py
"""Test deprecation and future warnings.
"""
import numpy as np
from numpy.testing import assert_warns
from numpy.ma.testutils import assert_equal
from numpy.ma.core import MaskedArrayFutureWarning
class TestArgsort:
""" gh-8701 """
def _test_base(s... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ploomber/sources/interact.py | MarcoJHB/ploomber | 2,141 | 134553 | from __future__ import annotations
"""
One of Ploomber's main goals is to allow writing robust/reliable code in an
interactive way. Interactive workflows make people more productive but they
might come in detriment of writing high quality code (e.g. developing a
pipeline in a single ipynb file). The basic idea for this... | 1 | 25 | 0 | 1 | 27 | 0 |
python/tvm/relay/op/nn/utils.py | XiaoSong9905/tvm | 4,640 | 134557 | <gh_stars>1000+
# 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
# "License"... | 0 | 0 | 0 | 0 | 0 | 0 |
app.py | nickk/awesome-panel | 179 | 134585 | # pylint: disable=redefined-outer-name,protected-access,missing-function-docstring
"""In this module we configure our awesome-panel.org app and serve it using the
awesome_panel.application framework.
The awesome_panel.application framework provides
- Templates: One or more Templates to layout your app(s). A tem... | 0 | 0 | 0 | 0 | 0 | 0 |
idaes/dmf/commands.py | eslickj/idaes-pse | 112 | 134604 | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | 0 | 0 | 0 | 0 | 0 | 1 |
cpmpy/jobs_puzzle.py | tias/hakank | 279 | 134645 | <gh_stars>100-1000
"""
Jobs puzzle in cpmpy.
(This is a standard problem in Automatic Reasoning.)
From http://www-unix.mcs.anl.gov/~wos/mathproblems/jobs.html
'''
Jobs Puzzle
There are four people: Roberta, Thelma, Steve, and Pete.
Among them, they hold eight different jobs.
Each holds exactly two jobs.
The jobs... | 0 | 0 | 0 | 0 | 0 | 0 |
ch2-hello-world-app/pages/urls.py | balazskiss1985/djangoforbeginners | 781 | 134649 | <gh_stars>100-1000
from django.urls import path
from .views import homePageView
urlpatterns = [
path('', homePageView, name='home'),
]
| 0 | 0 | 0 | 0 | 0 | 0 |
src/dispatch/plugins/dispatch_core/config.py | roor0/dispatch | 3,417 | 134655 | <reponame>roor0/dispatch
import logging
from starlette.config import Config
log = logging.getLogger(__name__)
config = Config(".env")
| 0 | 0 | 0 | 0 | 0 | 0 |
furniture/scripts/download_demos.py | KejiaChen/assembly | 364 | 134671 | import gdown
import os
from zipfile import ZipFile
demos = {
"Sawyer_chair_agne_0007_00XX.zip": "1-lVTCH4oPq22cLC4Mmia9AKqzDIIVDO0",
'Sawyer_table_dockstra_0279_00XX': '1QAchFmYpQGqa6zaZ2QeZH5ET-iuyerU0',
"Sawyer_bench_bjursta_0210_00XX.zip": "12b8_j1mC8-pgotjARF1aTcqH2T7FNHNF",
"Sawyer_table_bjorkudde... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_dataset/test_ocr_dataset.py | yuexy/mmocr | 2,261 | 134681 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import os.path as osp
import tempfile
from mmocr.datasets.ocr_dataset import OCRDataset
def _create_dummy_ann_file(ann_file):
ann_info1 = 'sample1.jpg hello'
ann_info2 = 'sample2.jpg world'
with open(ann_file, 'w') as fw:
for ann_info i... | 0 | 1 | 0 | 0 | 1 | 0 |
textworld/gym/envs/utils.py | JohnnySun8/TextWorld | 307 | 134689 | from typing import Iterable, Any
from numpy.random import RandomState
def shuffled_cycle(iterable: Iterable[Any], rng: RandomState, nb_loops: int = -1) -> Iterable[Any]:
"""
Yield each element of `iterable` one by one, then shuffle the elements
and start yielding from the start. Stop after `nb_loops` loo... | 3 | 1 | 0 | 0 | 4 | 0 |
code/iccp.py | timgates42/pypng | 329 | 134696 | <gh_stars>100-1000
#!/usr/bin/env python
# iccp
#
# International Color Consortium Profile
#
# Tools for manipulating ICC profiles.
#
# An ICC profile can be extracted from a PNG image (iCCP chunk).
#
#
# Non-standard ICCP tags.
#
# Apple use some (widespread but) non-standard tags. These can be
# displayed in Apple'... | 0 | 0 | 0 | 0 | 0 | 0 |
nose2/tests/functional/test_util.py | deeplow/nose2 | 637 | 134699 | # -*- coding: utf-8 -*-
import six
from nose2 import util
from nose2.tests._common import TestCase, support_file
class UtilTests(TestCase):
def test_name_from_path(self):
test_module = support_file("scenario/tests_in_package/pkg1/test/test_things.py")
test_package_path = support_file("scenario/te... | 0 | 0 | 0 | 1 | 1 | 0 |
rlpyt/spaces/gym_wrapper_schema.py | traffic-lights/rlpyt | 2,122 | 134724 |
from __future__ import annotations
import numpy as np
from gym.spaces.dict import Dict as GymDict
from rlpyt.utils.collections import NamedTupleSchema, NamedTuple
from rlpyt.spaces.composite import Composite
class GymSpaceWrapper:
"""Wraps a gym space to match the rlpyt interface; most of
the functionality ... | 5 | 15 | 0 | 1 | 21 | 0 |
venv/Lib/site-packages/toolz/tests/test_curried.py | ajayiagbebaku/NFL-Model | 3,749 | 134732 | from __future__ import annotations
import toolz
import toolz.curried
from toolz.curried import (take, first, second, sorted, merge_with, reduce,
merge, operator as cop)
from collections import defaultdict
from importlib import import_module
from operator import add
def test_take():
asse... | 0 | 3 | 0 | 0 | 3 | 0 |
finvizfinance/__init__.py | lit26/finvizfinance | 167 | 134744 | <reponame>lit26/finvizfinance
"""
.. module:: __init__
:synopsis: finvizfinance package general information
.. moduleauthor:: <NAME> <<EMAIL>>
"""
__version__ = "0.10"
__author__ = "<NAME>"
| 0 | 0 | 0 | 0 | 0 | 0 |
bin/gftools-builder.py | yanone/gftools | 150 | 134777 | #!/usr/bin/env python3
# Copyright 2020 The Google Font Tools Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_watcher.py | hiyongz/uiautomator2 | 4,493 | 134778 | # coding: utf-8
#
import uiautomator2 as u2
def test_watch_context(sess: u2.Device):
with sess.watch_context(builtin=True) as ctx:
ctx.when("App").click()
sess(text='Menu').click()
assert sess(text='Inflate from XML').wait()
def teardown_function(d: u2.Device):
print("Teard... | 2 | 0 | 0 | 0 | 2 | 0 |
sarpy/io/general/nitf_elements/tres/unclass/ACCVTB.py | bombaci-vsc/sarpy | 119 | 134797 |
from ..tre_elements import TREExtension, TREElement
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
class PT(TREElement):
def __init__(self, value):
super(PT, self).__init__()
self.add_field('LON', 's', 15, value)
self.add_field('LAT', 's', 15, value)
class ACVT(TREElement):
... | 0 | 0 | 1 | 0 | 1 | 0 |
ais/stream/checksum.py | andyvan-trabus/libais | 161 | 134812 | <filename>ais/stream/checksum.py
"""Utilities for working with NMEA strings."""
import re
import sys
import time
nmeaChecksumRegExStr = r"""\,[0-9]\*[0-9A-F][0-9A-F]"""
nmeaChecksumRE = re.compile(nmeaChecksumRegExStr)
def checksumStr(data):
"""Take a NMEA 0183 string and compute the checksum.
@param data: ... | 0 | 0 | 0 | 0 | 0 | 0 |
experiments/segmentation/utils.py | ElementAI/baal | 575 | 134830 | from __future__ import annotations
from typing import List
import numpy as np
import segmentation_models_pytorch as smp
from segmentation_models_pytorch.base.modules import Activation
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets
from torchvision.transforms imp... | 11 | 2 | 0 | 0 | 13 | 0 |
pyfakefs/tests/patched_packages_test.py | yarikoptic/pyfakefs | 422 | 134832 | <reponame>yarikoptic/pyfakefs<gh_stars>100-1000
# 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 agre... | 0 | 0 | 0 | 0 | 0 | 0 |
ngym_shaping/utils/tasktools.py | manuelmolano/ngym_shaping | 112 | 134838 | <filename>ngym_shaping/utils/tasktools.py<gh_stars>100-1000
from __future__ import division
from collections import OrderedDict
import numpy as np
def to_map(*args):
"produces ordered dict from given inputs"
if isinstance(args[0], list):
var_list = args[0]
else:
var_list = args
od = O... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/jet_bridge_base/jet_bridge_base/fields/integer.py | bokal2/jet-bridge | 1,247 | 134888 | <reponame>bokal2/jet-bridge<filename>packages/jet_bridge_base/jet_bridge_base/fields/integer.py
import six
from jet_bridge_base.fields.field import Field
class IntegerField(Field):
field_error_messages = {
'invalid': 'not a valid integer'
}
def to_internal_value_item(self, value):
if val... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/module_utils/oci_identity_custom_helpers.py | slmjy/oci-ansible-collection | 108 | 134895 | # Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
from __fu... | 0 | 23 | 0 | 0 | 23 | 0 |
python/ql/test/2/library-tests/PointsTo/imports/test.py | vadi2/codeql | 4,036 | 134900 |
from package import foo as myfoo
| 0 | 0 | 0 | 0 | 0 | 0 |
models/stylegan_tf_official/run_metrics.py | CV-IP/interfacegan | 855 | 134901 | # Copyright (c) 2019, <NAME>. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain View, CA 940... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/nntool/importer/onnx/handlers/backend/split.py | mfkiwl/gap_sdk | 118 | 134911 | <gh_stars>100-1000
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ve... | 0 | 0 | 0 | 0 | 0 | 0 |
body tracking/python/cv_viewer/tracking_viewer.py | khanfarhan10/zed-examples | 472 | 134925 | import cv2
import numpy as np
from cv_viewer.utils import *
import pyzed.sl as sl
#----------------------------------------------------------------------
# 2D VIEW
#----------------------------------------------------------------------
def cvt(pt, scale) -> object:
'''
Function that scales point coordin... | 0 | 1 | 0 | 0 | 1 | 0 |
h2o-py/tests/testdir_algos/word2vec/pyunit_word2vec_to_frame.py | vishalbelsare/h2o-3 | 6,098 | 134942 | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.word2vec import H2OWord2vecEstimator
def word2vec_to_frame():
print("Test converting a word2vec model to a Frame")
words = h2o.create_frame(rows=... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/python/chart-studio/chart_studio/api/v2/dash_apps.py | sgn/plotly.py | 11,750 | 134976 | """
Beta interface to Plotly's /v2/dash-apps endpoints.
"""
from __future__ import absolute_import
from chart_studio.api.v2.utils import build_url, request
RESOURCE = "dash-apps"
def create(body) -> object:
"""Create a dash app item."""
url = build_url(RESOURCE)
return request("post", url, json=body)
... | 0 | 3 | 0 | 0 | 3 | 0 |
tools/odrive/tests/integration_test.py | deafloo/ODrive | 1,068 | 134986 | <filename>tools/odrive/tests/integration_test.py
# this test runs the motor using CAN
# TODO - run a motor using all common use cases (uart, step/dir, pwm)
import test_runner
import struct
import can
import asyncio
import time
import math
from fibre.utils import Logger
from odrive.enums import *
from test_runner imp... | 0 | 0 | 0 | 0 | 0 | 0 |
auth0/v3/authentication/revoke_token.py | akmjenkins/auth0-python | 340 | 135023 | from __future__ import annotations
from .base import AuthenticationBase
class RevokeToken(AuthenticationBase):
"""Revoke Refresh Token endpoint
Args:
domain (str): Your auth0 domain (e.g: username.auth0.com)
"""
def revoke_refresh_token(self, client_id, token, client_secret: object | None=No... | 1 | 1 | 0 | 0 | 2 | 0 |
cctbx/dmtbx/boost_python/tst_dmtbx.py | dperl-sol/cctbx_project | 155 | 135036 | <filename>cctbx/dmtbx/boost_python/tst_dmtbx.py<gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from cctbx import dmtbx
from cctbx import sgtbx
from cctbx.array_family import flex
from libtbx.test_utils import approx_equal
def exercise_triplet_generator():
sg = sgtbx.space_group_in... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/assertType1.py | Jasha10/pyright | 3,934 | 135045 | # This sample tests the assert_type call.
from typing import Any, Literal
from typing_extensions import assert_type
def func1():
# This should generate an error.
assert_type()
# This should generate an error.
assert_type(1)
# This should generate an error.
assert_type(1, 2, 3)
# This sh... | 2 | 0 | 0 | 0 | 2 | 0 |
python/dgl/ops/spmm.py | ketyi/dgl | 9,516 | 135086 | <filename>python/dgl/ops/spmm.py
"""dgl spmm operator module."""
import sys
from ..backend import gspmm as gspmm_internal
from ..backend import gspmm_hetero as gspmm_internal_hetero
from .. import backend as F
__all__ = ['gspmm']
def reshape_lhs_rhs(lhs_data, rhs_data):
r""" Expand dims so that there will be no ... | 0 | 0 | 0 | 0 | 0 | 0 |
Object_Classification/DFASAFN/DFASAFN_Home/utils/data_load.py | lindagaw/Emotion-Detection | 121 | 135094 | <gh_stars>100-1000
import torch
import torch.utils.data as data
from PIL import Image
import os
import numpy as np
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def is_image_file(filename):
return any(filename.endswith(extension) for extension in I... | 0 | 0 | 0 | 0 | 0 | 0 |
lexicon/providers/googleclouddns.py | nextgens/lexicon | 1,184 | 135095 | <reponame>nextgens/lexicon
"""
Implements the Google Cloud DNS provider.
This API is quite complicated to use, as it used some unique
concepts compared to other providers.
First of all, it uses a full-fledged OAuth2 authentication,
involving signing a JWT and retrieve a Bearer token.
This hard work is done in the authe... | 0 | 0 | 0 | 0 | 0 | 0 |
libraries/botbuilder-core/botbuilder/core/cloud_adapter_base.py | andreikop/botbuilder-python | 388 | 135104 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from abc import ABC
from asyncio import sleep
from copy import Error
from http import HTTPStatus
from typing import Awaitable, Callable, List, Union
from botbuilder.core.invoke_response import InvokeResponse
from botbuilder... | 29 | 9 | 6 | 0 | 44 | 0 |
gazpacho/utils.py | maxhumber/gazpacho | 659 | 135113 | <filename>gazpacho/utils.py
import re
from xml.dom.minidom import parseString as string_to_dom
from xml.parsers.expat import ExpatError
def format(html, fail=False):
"""\
Indent and format html
Arguments:
- html: string to format
- fail: allowed to fail as a boolean
Example:
```
htm... | 0 | 0 | 0 | 0 | 0 | 0 |
h1st/model/ensemble/randomforest_classifier_stack_ensemble.py | Adatao/H1st | 796 | 135115 | <reponame>Adatao/H1st
from typing import List
from sklearn.ensemble import RandomForestClassifier
from h1st.model.ensemble.classifier_stack_ensemble import ClassifierStackEnsemble
from h1st.model.model import Model
class RandomForestClassifierStackEnsemble(ClassifierStackEnsemble):
"""
A ready to use StackE... | 0 | 0 | 0 | 0 | 0 | 0 |
airflow/utils/code_utils.py | ChaseKnowlden/airflow | 15,947 | 135118 | <filename>airflow/utils/code_utils.py
# 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, Versio... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoParticleFlow/Configuration/test/analyzePFChargedHadrons_cfg.py | ckamtsikis/cmssw | 852 | 135123 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
process = cms.Process("ANALYSIS")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(100)
)
process.source = cms.Source (
"PoolSource",
fileNames = cms.untracked.vstring(
'rfio:/castor/cern.ch/user/p/pjanot/CMSSW390p... | 0 | 0 | 0 | 0 | 0 | 0 |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/EGL/EXT/create_context_robustness.py | ShujaKhalid/deep-rl | 210 | 135152 | <reponame>ShujaKhalid/deep-rl
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant impor... | 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.