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 |
|---|---|---|---|---|---|---|---|---|---|---|
annotation/run_server.py | seal-git/chABSA-dataset | 107 | 3297297 | <gh_stars>100-1000
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from annotation.application.application import app
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080, threaded=True, debug=True)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_versions.py | seven332/pre-commit-hooks | 164 | 3297314 | <reponame>seven332/pre-commit-hooks
#!/usr/bin/env python
"""Test that --version works for each hook correctly"""
import os
import subprocess as sp
import tests.test_utils as utils
from hooks.clang_format import ClangFormatCmd
from hooks.clang_tidy import ClangTidyCmd
from hooks.cppcheck import CppcheckCmd
from hooks.... | 0 | 0 | 0 | 0 | 0 | 0 |
logging_metrics_performance/enterprise_logging/utils/logtest_verification/verify_logtest_index.py | RH-ematysek/svt | 115 | 3297345 | #!/usr/bin/env python3
from __future__ import annotations
"""Logging index verification tool
This script is meant to help verify ElasticSearch indices after generating logs with logtest clusterloader.
It also has a lot of general helper functions for working with ElasticSearch.
To use this script, you should set up ... | 9 | 8 | 1 | 1 | 19 | 0 |
pixielib/pixie.py | YuliangXiu/PIXIE | 196 | 3297349 | # -*- coding: utf-8 -*-
#
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# Using this computer program means that you agree to the terms
# in the LICENSE file included with this software distribution.
# Any use not explicitly grant... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ostorlab/utils/defintions.py | bbhunter/ostorlab | 113 | 3297361 | <filename>src/ostorlab/utils/defintions.py
"""Common definition types."""
import dataclasses
from typing import Optional, Union
@dataclasses.dataclass
class Arg:
"""Data class holding a definition.
The value is always bytes to support all arg values. The type is defined by the type attribute."""
name: st... | 0 | 0 | 0 | 0 | 0 | 0 |
models/ncsnv2.py | forkbabu/ncsnv2 | 125 | 3297366 | <filename>models/ncsnv2.py
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import torch
from functools import partial
from . import get_sigmas
from .layers import *
from .normalization import get_normalization
class NCSNv2(nn.Module):
def __init__(self, config):
super().__init__()... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/django-1.3/django/contrib/localflavor/uy/forms.py | MiCHiLU/google_appengine_sdk | 790 | 3297370 | <filename>lib/django-1.3/django/contrib/localflavor/uy/forms.py
# -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_l... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/dualtor_io/test_tor_failure.py | lolyu/sonic-mgmt | 132 | 3297389 | import logging
import pytest
import time
from tests.common.dualtor.control_plane_utils import verify_tor_states
from tests.common.dualtor.data_plane_utils import send_t1_to_server_with_action, send_server_to_t1_with_action # lgtm[py/unused-import]
from tests.common.dualtor.dual_tor_uti... | 0 | 2 | 0 | 0 | 2 | 0 |
tensorflow/python/kernel_tests/gradient_correctness_test.py | EricRemmerswaal/tensorflow | 190,993 | 3297405 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 0 | 0 | 0 | 0 | 0 | 0 |
sfaira/data/dataloaders/loaders/d10_1101_2020_10_12_335331/human_blood_2020_10x_hao_001.py | johnmous/sfaira | 110 | 3297410 | import anndata
import gzip
import os
import pandas as pd
import scipy.io
import tarfile
def load(data_dir, **kwargs) -> object:
fn = os.path.join(data_dir, "GSE164378_RAW.tar")
adatas = []
with tarfile.open(fn) as tar:
samples = ['GSM5008737_RNA_3P', 'GSM5008738_ADT_3P']
for sample in samp... | 0 | 1 | 0 | 0 | 1 | 0 |
digest/migrations/0033_auto_20160227_0923.py | PURNA-ROCK/pythondigest | 124 | 3297413 | <reponame>PURNA-ROCK/pythondigest
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('digest', '0032_issue_announcement'),
]
operations = [
migrations.CreateModel(
n... | 0 | 0 | 0 | 0 | 0 | 0 |
reference-impl-py/reference_v2.py | antdigo/ngx_aws_auth | 367 | 3297418 | <reponame>antdigo/ngx_aws_auth
#!/usr/bin/env python
from datetime import datetime
from hashlib import sha1
import hmac
import sys
try:
from urllib.request import Request, urlopen, HTTPError # Python 3
except:
from urllib2 import Request, urlopen, HTTPError # Python 2
'''
Authorization = "AWS" + " " + AWSAc... | 0 | 0 | 0 | 0 | 0 | 0 |
jupyter_micropython_kernel/kernel.py | MatthewCroughan/jupyter_micropython_kernel | 122 | 3297423 | <filename>jupyter_micropython_kernel/kernel.py<gh_stars>100-1000
from ipykernel.kernelbase import Kernel
import IPython
import logging, sys, time, os, re
import serial, socket, serial.tools.list_ports, select
import websocket # only for WebSocketConnectionClosedException
from . import deviceconnector
logger = loggin... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/nntool/graph/matches/matches.py | 00-01/gap_sdk | 118 | 3297500 | # 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 version.
# This progr... | 4 | 9 | 0 | 0 | 13 | 0 |
resotolib/resotolib/baseplugin.py | someengineering/resoto | 126 | 3297529 | from abc import ABC, abstractmethod
from enum import Enum, auto
from resotolib.core.ca import TLSData
from resotolib.graph import Graph
from resotolib.core import resotocore
from resotolib.core.actions import CoreActions
from resotolib.args import ArgumentParser
from resotolib.config import Config
from resotolib.logger... | 7 | 15 | 0 | 3 | 25 | 0 |
e3nn/nn/_dropout.py | claycurry34/e3nn | 385 | 3297544 | <filename>e3nn/nn/_dropout.py<gh_stars>100-1000
import torch
from e3nn import o3
from e3nn.util.jit import compile_mode
@compile_mode('script')
class Dropout(torch.nn.Module):
"""Equivariant Dropout
:math:`A_{zai}` is the input and :math:`B_{zai}` is the output where
- ``z`` is the batch index
- ``a... | 0 | 0 | 0 | 0 | 0 | 0 |
consolemenu/format/menu_margins.py | Tyler887/console-menu | 230 | 3297570 | <reponame>Tyler887/console-menu<filename>consolemenu/format/menu_margins.py
class MenuMargins(object):
"""
Class for menu margins. A margin is the area between the maximum specified dimensions (which is usually
the width and height of the screen) and the menu border.
Args:
top (int): The top ma... | 0 | 0 | 0 | 0 | 0 | 0 |
pythonFiles/testing_tools/adapter/errors.py | JesterOrNot/vscode-python | 634 | 3297588 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class UnsupportedToolError(ValueError):
def __init__(self, tool):
msg = 'unsupported tool {!r}'.format(tool)
super(UnsupportedToolError, self).__init__(msg)
self.tool = tool
class UnsupportedCom... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/SwimmingDEMApplication/python_scripts/field_utilities.py | lkusch/Kratos | 778 | 3297590 | <reponame>lkusch/Kratos
import KratosMultiphysics as Kratos
from KratosMultiphysics import Array3
import KratosMultiphysics.SwimmingDEMApplication as SDEM
import math
class PorosityField:
def __init__(self, real_field_type, fixed_mesh_option):
self.real_field_type = real_field_type
self.fixed_mesh... | 0 | 0 | 0 | 0 | 0 | 0 |
scheduler/tests/query_and_cancel_test.py | Elizaaaaa/deep-learning-containers | 383 | 3297594 | import json
import logging
import sys
from datetime import datetime
import boto3
from job_requester import JobRequester
from job_requester import Message
"""
How tests are executed:
- Put tickets on the request queue, in-progress pool and dead letter queue; create Message objects (request identifiers)
that corresp... | 0 | 0 | 0 | 0 | 0 | 0 |
SoftLayer/CLI/vpn/ipsec/translation/__init__.py | dvzrv/softlayer-python | 126 | 3297595 | <filename>SoftLayer/CLI/vpn/ipsec/translation/__init__.py<gh_stars>100-1000
"""IPSEC VPN Address Translations"""
| 0 | 0 | 0 | 0 | 0 | 0 |
awx/main/tests/unit/scheduler/test_dag_workflow.py | DamoR25/awxnew | 11,396 | 3297602 | <reponame>DamoR25/awxnew<gh_stars>1000+
import pytest
import uuid
import os
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_text
from awx.main.scheduler.dag_workflow import WorkflowDAG
class Job:
def __init__(self, status='successful'):
self.status = statu... | 0 | 0 | 0 | 0 | 0 | 0 |
gallery/spreadsheet/spreadsheet.py | R-fred/awesome-streamlit | 1,194 | 3297609 | """Page to show that its really easy to create a Spreadsheet like application"""
import pandas as pd
import streamlit as st
@st.cache
def get_biostats_data(url) -> pd.DataFrame:
"""A DataFrame of data from https://people.sc.fsu.edu/~jburkardt/data/csv/biostats.csv
Returns:
pd.DataFrame -- [descriptio... | 3 | 4 | 0 | 0 | 7 | 0 |
examples/plot4.py | tgolsson/appJar | 666 | 3297611 | <reponame>tgolsson/appJar
import sys
sys.path.append("../")
from mpl_toolkits.mplot3d import Axes3D
from appJar import gui
with gui("MatPlotLib") as app:
fig = app.addPlotFig("p1", width=3, height=3)
ax = fig.add_subplot(111, projection='3d')
ax.scatter([1,5],[5,2],[3,3])
fig.set_size_inches(10,20,fo... | 0 | 0 | 0 | 0 | 0 | 0 |
pythonFiles/tests/testing_tools/adapter/.data/complex/tests/v/test_spam.py | AlbertDeFusco/vscode-python | 2,461 | 3297614 | <reponame>AlbertDeFusco/vscode-python
from .spam import test_simple
def test_simpler(self):
assert True
| 0 | 0 | 0 | 0 | 0 | 0 |
wordfreq_to_viterbi.py | borisdayma/wikipedia-word-frequency | 103 | 3297630 | #!/usr/bin/env python3
import math
import pickle
import sys
word_uses = {}
for line in sys.stdin:
word, uses = line.split()
word_uses[word] = int(uses)
total_words = sum(word_uses.values())
word_freq_log = {}
for word, uses in word_uses.items():
word_freq_log[word] = math.log(float(uses) / total_words)
pickle.du... | 0 | 0 | 0 | 0 | 0 | 0 |
vec4ir/eqlm.py | bees4ever/vec4ir | 211 | 3297672 | #!/usr/bin/env python3
# coding: utf-8
from __future__ import annotations
from sklearn.base import BaseEstimator
from sklearn.feature_extraction.text import CountVectorizer
try:
from .base import RetrievalBase, RetriEvalMixin
from .utils import argtopk
except (SystemError, ValueError):
from base import Retr... | 8 | 4 | 0 | 0 | 12 | 0 |
third_party/android_testrunner/errors.py | domenic/mojo | 231 | 3297759 | #!/usr/bin/python2.4
#
#
# Copyright 2008, The Android Open Source Project
#
# 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 requir... | 1 | 0 | 0 | 0 | 1 | 0 |
tests/samples/python_obj.py | pichatelli/simple-settings | 213 | 3297777 | <filename>tests/samples/python_obj.py
class MyConfig:
START_URLS = ['https://www.google.com']
AUTO_CONNECT = True
def config_invalid():
START_URLS = ['https://www.google.com']
AUTO_CONNECT = True
| 0 | 0 | 0 | 0 | 0 | 0 |
mmdet3d/models/decode_heads/__init__.py | Guangyun-Xu/mmdetection3d | 2,216 | 3297785 | <filename>mmdet3d/models/decode_heads/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from .paconv_head import PAConvHead
from .pointnet2_head import PointNet2Head
__all__ = ['PointNet2Head', 'PAConvHead']
| 0 | 0 | 0 | 0 | 0 | 0 |
thespian/system/timing.py | dendron2000/Thespian | 210 | 3297797 | <reponame>dendron2000/Thespian
import time
from datetime import timedelta
###
### Time Management
###
# This is the time equivalence range: two time values that are withing
# this period of each other are judged to be equal
time_equivalence = timedelta(microseconds=10)
# Use the function currentTime in this modul... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/changes/api/test_author_build_index.py | vault-the/changes | 443 | 3297799 | from uuid import uuid4
from changes.config import db
from changes.models.author import Author
from changes.testutils import APITestCase
class AuthorBuildListTest(APITestCase):
def test_simple(self):
fake_author_id = uuid4()
project = self.create_project()
self.create_build(project)
... | 0 | 0 | 0 | 0 | 0 | 0 |
panda/crypto/sign.py | shoes22/openpilot | 1,279 | 3297816 | #!/usr/bin/env python3
import os
import sys
import struct
import hashlib
from Crypto.PublicKey import RSA
import binascii
# increment this to make new hardware not run old versions
VERSION = 2
rsa = RSA.importKey(open(sys.argv[3]).read())
with open(sys.argv[1], "rb") as f:
dat = f.read()
print("signing", len(dat)... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/extmod/ujson_dump_separators.py | rxchen/micropython | 13,648 | 3297819 | <reponame>rxchen/micropython
try:
from uio import StringIO
import ujson as json
except:
try:
from io import StringIO
import json
except ImportError:
print("SKIP")
raise SystemExit
for sep in [
None,
(", ", ": "),
(",", ": "),
(",", ":"),
[", ", ": "],... | 0 | 0 | 0 | 0 | 0 | 0 |
userena/contrib/umessages/forms.py | mortenwh/django-userena | 501 | 3297837 | from django import forms
from django.utils.translation import ugettext_lazy as _
from userena.contrib.umessages.fields import CommaSeparatedUserField
from userena.contrib.umessages.models import Message, MessageRecipient
import datetime
class ComposeForm(forms.Form):
to = CommaSeparatedUserField(label=_("To"))
... | 0 | 1 | 0 | 0 | 1 | 0 |
dense_coattn/optim/lr_scheduler/fixed_scheduler.py | cvlab-tohoku/Dense-Co-Attention-Network-for-Visual-Question-Answering | 110 | 3297858 |
from __future__ import annotations
from .lr_scheduler import WrapLRScheduler
class FixedScheduler(WrapLRScheduler):
def __init__(self, args, optimizer):
super(FixedScheduler, self).__init__(args, optimizer)
warmup_end_lr = args.lr[0]
if args.warmup_init_lr < 0:
args.warmup_init_lr = warmup_end_lr
if a... | 1 | 3 | 0 | 0 | 4 | 0 |
neuralqa/utils/data_utils.py | thecloudcircle/neuralqa | 220 | 3297868 | from __future__ import annotations
from elasticsearch import Elasticsearch
import os
import zipfile
import shutil
import urllib.request
import logging
import lzma
import json
import tarfile
import hashlib
logger = logging.getLogger(__name__)
# index settings with analyzer to automatically remove stop words
index_sett... | 3 | 2 | 0 | 0 | 5 | 0 |
tests/test_seed.py | Berk035/SimGlucose | 129 | 3297870 | import gym
import unittest
from datetime import datetime
from gym.envs.registration import register
register(
id='simglucose-adult1-v0',
entry_point='simglucose.envs:T1DSimEnv',
kwargs={'patient_name': 'adult#001'}
)
class TestSeed(unittest.TestCase):
def test_changing_seed_generates_different_result... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/fuction_to_double_string.py | PushpneetSingh/Hello-world | 1,428 | 3297871 | def doubleChar(str) -> object:
new_str = ''
for i in str:
new_str += i*2
return new_str
res = doubleChar()
print(res)
| 0 | 1 | 0 | 0 | 1 | 0 |
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/SSLConfig.py | yuanyi-thu/AIOT- | 128 | 3297878 | class SSLConfig(object):
def __init__(self):
self.selfCertPath: None = None
self.selfCertPwd: None = None
self.trustCAPath: None = None
self.trustCAPwd: None = None
def getSelfCertPath(self) -> object:
return self.selfCertPath
def setSelfCertPath(self, selfCertPath... | 0 | 4 | 0 | 4 | 8 | 0 |
mpBuild/ESP32_HandBit/lib/reset.py | devshop2019/mixlyTest | 118 | 3297893 | import machine
try:
from display import *
display.clear()
except:
pass
try:
import music
music.stop(6)
except:
pass
try:
import neopixel
rgb = neopixel.NeoPixel(machine.Pin(17), 3, timing = True)
rgb[0] = (0, 0, 0)
rgb[1] = (0, 0, 0)
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/examples/integrated/ubus/examples/ubus_example_master_seq_lib.py | bmorris/uvm-python | 140 | 3297896 | #//----------------------------------------------------------------------
#// Copyright 2007-2010 Mentor Graphics Corporation
#// Copyright 2007-2011 Cadence Design Systems, Inc.
#// Copyright 2010 Synopsys, Inc.
#// Copyright 2019 <NAME>
#// All Rights Reserved Worldwide
#//
#// Licensed under the Apache L... | 1 | 0 | 0 | 5 | 6 | 0 |
data/sysmon.py | baronpan/SysmonHunter | 187 | 3297898 | <filename>data/sysmon.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import pandas
import md5
from datetime import datetime
from core.behavior import *
from core.utils import *
from utils.log import *
def machine_id(_str):
return md5.md5(_str).hexdigest()
def pickup_md5(_str):
return _str.split('=')[1]
class... | 0 | 0 | 0 | 0 | 0 | 0 |
vmtkScripts/contrib/vmtkdijkstradistancetopoints.py | michelebucelli/vmtk | 217 | 3297900 | <gh_stars>100-1000
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkdijkstradistancetopoints.py,v $
## Language: Python
## Date: $$
## Version: $$
## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WA... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/apitests/python/test_ldap_ping.py | henderjm/harbor | 12,706 | 3297908 | <reponame>henderjm/harbor
# coding: utf-8
"""
Harbor API
These APIs provide services for manipulating Harbor project.
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
sys.path.append(os.enviro... | 0 | 0 | 0 | 0 | 0 | 0 |
python/src/main/python/pygw/store/data_store_factory.py | radiant-maxar/geowave | 280 | 3297931 | #
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 whic... | 0 | 1 | 0 | 0 | 1 | 0 |
airmozilla/search/migrations/0001_initial.py | mozilla/airmozilla | 115 | 3297937 | <filename>airmozilla/search/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import airmozilla.search.models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf/page_sets/system_health/long_running_stories.py | zipated/src | 2,151 | 3297961 | # Copyright 2016 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.
from page_sets.login_helpers import google_login
from page_sets.system_health import platforms
from page_sets.system_health import system_health_story
IDLE... | 0 | 1 | 10 | 0 | 11 | 0 |
tomviz/python/tomviz/state/_jsonpath.py | danielballan/tomviz | 284 | 3297964 | from jsonpointer import resolve_pointer
def find_pipeline(path) -> object:
from . import pipelines
if len(path) < 2:
raise ValueError("Path doesn't have enough parts.")
obj_type = path.pop(0)
if obj_type != 'dataSources':
raise ValueError("Path doesn't start with 'dataSources'.")
... | 0 | 10 | 0 | 0 | 10 | 0 |
rls/algorithms/single/tac.py | StepNeverStop/RLs | 371 | 3297990 | <gh_stars>100-1000
#!/usr/bin/env python3
# encoding: utf-8
from copy import deepcopy
import numpy as np
import torch as th
import torch.distributions as td
import torch.nn.functional as F
from rls.algorithms.base.sarl_off_policy import SarlOffPolicy
from rls.common.data import Data
from rls.common.decor... | 0 | 0 | 0 | 0 | 0 | 0 |
netket/hilbert/random/base.py | pesvut/netket | 352 | 3298018 | <filename>netket/hilbert/random/base.py
# Copyright 2021 The NetKet Authors - All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | 0 | 0 | 0 | 0 | 0 | 0 |
fcis/core/metric.py | msracver/TA-FCN | 1,420 | 3298050 | <gh_stars>1000+
# --------------------------------------------------------
# Fully Convolutional Instance-aware Semantic Segmentation
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Modified by <NAME>, <NAME>
# --------------------------------------------------------
# Based ... | 0 | 0 | 0 | 0 | 0 | 0 |
pyrival/data_structures/LinkedList.py | MattJDavidson/aoc2021 | 748 | 3298056 | from __future__ import annotations
class Node:
def __init__(self, value):
self.value = value
self.next: None = None
self.prev: None = None
def __repr__(self) -> object:
if not self:
return "{}()".format(self.__class__.__name__)
return "{}({})".format(self.__c... | 2 | 9 | 0 | 3 | 14 | 0 |
qiskit/chemistry/algorithms/excited_states_solvers/excited_states_eigensolver.py | stefan-woerner/aqua | 504 | 3298081 | <reponame>stefan-woerner/aqua<filename>qiskit/chemistry/algorithms/excited_states_solvers/excited_states_eigensolver.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root ... | 0 | 0 | 0 | 0 | 0 | 0 |
mmfewshot/detection/datasets/pipelines/transforms.py | linyq17/mmfewshot | 376 | 3298082 | <gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import math
from typing import Dict, List, Tuple
import mmcv
import numpy as np
from mmdet.datasets import PIPELINES
from mmdet.datasets.pipelines import (Normalize, Pad, RandomCrop, RandomFlip,
Resize)... | 0 | 0 | 0 | 0 | 0 | 0 |
tacker/tests/etc/samples/etsi/nfv/user_data_sample_userdata_timeout/UserData/lcm_user_data_sleeping.py | takahashi-tsc/tacker | 116 | 3298083 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... | 4 | 1 | 0 | 0 | 5 | 0 |
tools/tcmalloc/print-live-objects.py | zealoussnow/chromium | 14,668 | 3298088 | #!/usr/bin/env python
# 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.
"""Symbolizes and prints live objects as recorded by tcmalloc's
HeapProfilerDumpLiveObjects.
"""
from __future__ import print_func... | 0 | 1 | 0 | 0 | 1 | 0 |
library/tests/test_install_helpers.py | fsargent/inky | 402 | 3298089 | <filename>library/tests/test_install_helpers.py
"""Install helper tests for Inky.
These validate that, in case of a missing package, an ImportError is raised.
They don't actually validate that our special message is produced!
"""
import pytest
def test_mock_phat_no_tkinter():
"""Test initialisation of InkyMock... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578319_bubblebabble/recipe-578319.py | tdiprima/code | 2,023 | 3298094 | <filename>recipes/Python/578319_bubblebabble/recipe-578319.py
#!/usr/bin/python
""" A python bubble-babble generator, inspired by
<http://woozle.org/t/bubblebabble.c>.
Here are the original Perl bubble-babble examples, for doctests:
>>> babble('432cc46b5c67c9adaabdcc6c69e23d6d'.decode('hex'))
'xibod-sycik-rila... | 0 | 0 | 0 | 0 | 0 | 0 |
alfred/tests.py | jinfagang/alfred | 643 | 3298122 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2020 JinTian.
#
# This file is part of alfred
# (see http://jinfagang.github.io).
#
# 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 co... | 0 | 2 | 0 | 0 | 2 | 0 |
scitbx/random/__init__.py | dperl-sol/cctbx_project | 155 | 3298127 | from __future__ import absolute_import, division, print_function
import os
import time
import boost_adaptbx.boost.optional # import dependency
import boost_adaptbx.boost.python as bp
bp.import_ext("scitbx_random_ext")
import scitbx_random_ext
def get_random_seed() -> object:
try:
result = (os.getpid() * (2**16... | 0 | 2 | 0 | 1 | 3 | 0 |
CNN2Head_input2.py | Hsintien-Ng/multi-task-learning | 156 | 3298128 | from __future__ import annotations
import numpy as np
import os
import cv2
import scipy
import random
SMILE_FOLDER = './data/smile_data/'
GENDER_FOLDER = './data/gender_data_101/'
AGE_FOLDER = './data/age_data_101/'
NUM_SMILE_IMAGE = 4000
SMILE_SIZE = 48
EMOTION_SIZE = 48
def getSmileImage() -> tuple[object, object]... | 3 | 10 | 0 | 0 | 13 | 0 |
veros/plugins.py | AkasDutta/veros | 115 | 3298130 | from collections import namedtuple
from veros.variables import Variable
from veros.settings import Setting
VerosPlugin = namedtuple(
"VerosPlugin",
[
"name",
"module",
"setup_entrypoint",
"run_entrypoint",
"settings",
"variables",
"diagnostics",
],
)... | 0 | 1 | 0 | 0 | 1 | 0 |
gaphas/tool/zoom.py | gaphor/gaphas | 108 | 3298139 | from gi.repository import Gtk
from gaphas.view import GtkView
class Zoom:
def __init__(self, matrix):
self.matrix = matrix
self.x0: int = 0
self.y0: int = 0
self.sx: float = 1.0
self.sy: float = 1.0
def begin(self, x0, y0):
self.x0 = x0
self.y0 = y0
... | 7 | 3 | 0 | 4 | 14 | 0 |
tests/test_read_with_orm_mode.py | shashankrnr32/fastapi | 53,007 | 3298160 | <gh_stars>1000+
from typing import Any
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel
class PersonBase(BaseModel):
name: str
lastname: str
class Person(PersonBase):
@property
def full_name(self) -> str:
return f"{self.name} {self.lastnam... | 0 | 0 | 0 | 0 | 0 | 0 |
pycharm2020.1.3/script/core/common/tcp_test_srv.py | LaudateCorpus1/realtime-server | 465 | 3298173 | <filename>pycharm2020.1.3/script/core/common/tcp_test_srv.py
import asyncio
class EchoServerProtocol(asyncio.Protocol):
def __init__(self):
self.transport = None
def connection_made(self, transport):
peername = transport.get_extra_info('peername')
print('Connection from {}'.format(pe... | 0 | 0 | 0 | 0 | 0 | 0 |
documentation/test_python/inspect_type_links/inspect_type_links/second.py | Ryan-rsm-McKenzie/m.css | 367 | 3298220 | """Second module"""
from typing import Tuple, List, Any, Callable
import enum
class Enum(enum.Enum):
"""An enum"""
FIRST: int = 1
SECOND: int = 2
def type_enum(a: Enum):
"""Function referencing an enum"""
class Foo:
"""A class in the second module"""
@property
def type_property(self) ... | 17 | 8 | 11 | 0 | 36 | 0 |
test/hummingbot/connector/exchange/kucoin/test_kucoin_api_order_book_data_source.py | pecuniafinance/hummingbot | 542 | 3298226 | <reponame>pecuniafinance/hummingbot
import asyncio
import json
import re
import unittest
from typing import Awaitable, Dict
from unittest.mock import AsyncMock, MagicMock, patch
from aioresponses import aioresponses
from bidict import bidict
from hummingbot.connector.exchange.kucoin import (
kucoin_constants as C... | 0 | 0 | 0 | 0 | 0 | 0 |
pysurvival/utils/optimization.py | awlange/pysurvival | 242 | 3298237 | from __future__ import annotations
import numpy as np
import torch
import torch.nn as nn
import progressbar
import time
import copy
def initialization(init_method, W, is_tensor: bool=True) -> object:
""" Initializes the provided tensor.
Parameters:
-----------
* init_method : str (default = 'glo... | 5 | 3 | 0 | 0 | 8 | 0 |
lib/models/language.py | sibeiyang/sgmn | 130 | 3298261 | <reponame>sibeiyang/sgmn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import to_numpy, to_torch
class RNNEncoder(nn.Module):
def __init__(self, vocab_size, word_embedding_size, hidden_size, bidirectional=False,
input_dropout_p=0, dropout_p=0, n_... | 0 | 0 | 0 | 0 | 0 | 0 |
experiments/wave/main.py | enjalot/adventures_in_opencl | 152 | 3298280 | #basic glut setup learned from here:
#http://www.java2s.com/Open-Source/Python/Game-2D-3D/PyOpenGL/PyOpenGL-Demo-3.0.1b1/PyOpenGL-Demo/NeHe/lesson2.py.htm
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import sys
#helper modules
import glutil
from vector import Vec
#OpenCL code
import wav... | 0 | 0 | 0 | 0 | 0 | 0 |
python/app/plugins/http/Metinfo/Metinfo_Anyfile_Read.py | taomujian/linbing | 351 | 3298291 | <reponame>taomujian/linbing<gh_stars>100-1000
#!/usr/bin/env python3
from app.lib.utils.request import request
from app.lib.utils.common import get_useragent
class Metinfo_Anyfile_Read_BaseVerify:
def __init__(self, url):
self.info = {
'name': 'Metinfo任意文件读取漏洞',
'description': 'Met... | 0 | 0 | 0 | 0 | 0 | 0 |
robustness_metrics/projects/revisiting_calibration/figures/imagenet_c.py | goncaloperes/robustness_metrics | 383 | 3298318 | <filename>robustness_metrics/projects/revisiting_calibration/figures/imagenet_c.py
# coding=utf-8
# Copyright 2021 The Robustness Metrics 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... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unittests/http_functions/accept_json/main.py | gohar94/azure-functions-python-worker | 277 | 3298326 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
import azure.functions
def main(req: azure.functions.HttpRequest) -> object:
return json.dumps({
'method': req.method,
'url': req.url,
'headers': dict(req.headers),
'params': ... | 1 | 1 | 0 | 0 | 2 | 0 |
numberjack/bus_schedule.py | Wikunia/hakank | 279 | 3298390 | #!/usr/bin/python
"""
Bus scheduling in Numberjack.
Problem from Taha "Introduction to Operations Research", page 58.
This is a slightly more general model than Taha's.
Compare with the following models:
* MiniZinc: http://www.hakank.org/minizinc/bus_scheduling.mzn
* Comet : http://www.hakank.org/comet/bus_schedul... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/http/__init__.py | zdresearch/Python-Honeypot | 186 | 3298447 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
def category_configuration() -> dict[str,bool | int | str]:
"""
category configuration
Returns:
JSON/Dict category configuration
"""
return {
"virtual_machine_name": "ohp_httpserver",
"virtual... | 0 | 1 | 0 | 0 | 1 | 0 |
kubernaut/clustergroups/cmd.py | z-jingjie/kubernaut | 120 | 3298467 | <reponame>z-jingjie/kubernaut
import click
from kubernaut import KubernautContext
from kubernaut.util import strip_margin
@click.group(
help=strip_margin("""
| Manage Kubernaut cluster groups
|
| A "cluster group" is an abstraction to group available Kubernetes clusters so that Kubernaut admins can c... | 0 | 0 | 0 | 0 | 0 | 0 |
eventregistry/__init__.py | vishalbelsare/event-registry-python | 160 | 3298478 | <reponame>vishalbelsare/event-registry-python<gh_stars>100-1000
from eventregistry._version import __version__
from eventregistry.Base import *
from eventregistry.EventForText import *
from eventregistry.ReturnInfo import *
from eventregistry.Query import *
from eventregistry.QueryEvents import *
from eventregistry.Q... | 0 | 0 | 0 | 0 | 0 | 0 |
convert_to_onnx.py | RamboQ/pytorch-to-javascript-with-onnx-js | 173 | 3298492 | import torch
from inference_mnist_model import Net
def main():
pytorch_model = Net()
pytorch_model.load_state_dict(torch.load('pytorch_model.pt'))
pytorch_model.eval()
dummy_input = torch.zeros(280 * 280 * 4)
torch.onnx.export(pytorch_model, dummy_input, 'onnx_model.onnx', verbose=True)
if __name__ == '_... | 0 | 0 | 0 | 0 | 0 | 0 |
fkie_node_manager_daemon/tests/test_screen.py | JOiiNT-LAB/multimaster_fkie | 194 | 3298517 | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain th... | 0 | 0 | 0 | 0 | 0 | 0 |
videoanalyst/evaluation/got_benchmark/datasets/nfs.py | TragedyN/SiamFCpp | 737 | 3298533 | from __future__ import absolute_import, print_function, division
import os
import glob
import numpy as np
import six
class NfS(object):
"""`NfS <http://ci2cv.net/nfs/index.html>`_ Dataset.
Publication:
``Need for Speed: A Benchmark for Higher Frame Rate Object Tracking``,
<NAME>, <NAME>, <NA... | 1 | 2 | 0 | 0 | 3 | 0 |
src/electionguard_tools/helpers/serialize.py | thommignot/electionguard-python | 112 | 3298573 | """
Testing tool to validate serialization and deserialization.
WARNING: Not for production use.
Specifically constructed to assist with json loading and dumping within the library.
As a secondary case, this displays how many python serializers/deserializers should be able to take
advantage of the dataclass usage.
""... | 19 | 12 | 2 | 0 | 33 | 0 |
eagerpy/types.py | sandrlom/eagerpy | 624 | 3298600 | <filename>eagerpy/types.py<gh_stars>100-1000
from typing import Union, Tuple, TYPE_CHECKING
if TYPE_CHECKING:
# for static analyzers
import torch # noqa: F401
import tensorflow # noqa: F401
import jax # noqa: F401
import numpy # noqa: F401
Axes = Tuple[int, ...]
AxisAxes = Union[int, Axes]
Sha... | 0 | 0 | 0 | 0 | 0 | 0 |
experimental/ner_spancat/scripts/evaluate.py | apjanco/projects | 823 | 3298601 | from typing import Optional
from pathlib import Path
from spacy.cli.evaluate import evaluate
from spacy.cli._util import Arg, Opt, import_code
import typer
def evaluate_cli(
# fmt: off
model: str = Arg(..., help="Model name or path"),
data_path: Path = Arg(..., help="Location of binary evaluation data in ... | 9 | 0 | 0 | 0 | 9 | 0 |
3]. Competitive Programming/03]. LeetCode/1]. Problems/Python/0008)_String_to_Integer.py | MLinesCode/The-Complete-FAANG-Preparation | 6,969 | 3298610 | class Solution:
def myAtoi(self, str: str) -> int:
str = str.strip()
negative = False
if str and str[0] == '-':
negative = True
if str and (str[0 ] == '+' or str[0] == '-'):
str = str[1:]
if not str:
return 0
digits = {i fo... | 1 | 1 | 0 | 0 | 2 | 0 |
077 Word Search.py | ChiFire/legend_LeetCode | 872 | 3298634 | <gh_stars>100-1000
"""
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or
vertically neighboring. The same letter cell may not be used more than once.
For example,
Given board... | 0 | 0 | 0 | 0 | 0 | 0 |
myia/operations/primitives.py | strint/myia | 222 | 3298640 | <reponame>strint/myia<gh_stars>100-1000
"""Primitive operations.
Primitive operations are handled as constants in the intermediate
representation, with the constant's value being an instance of a `Primitive`
subclass.
"""
###############################################################################
# THIS FILE IS ... | 0 | 0 | 0 | 0 | 0 | 0 |
dependency/Target.py | baidu/broc | 127 | 3298671 | <filename>dependency/Target.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"... | 0 | 0 | 0 | 0 | 0 | 0 |
Beginner/Find the Maximum Value (LOSTMAX)/maximum.py | anishsingh42/CodeChef | 127 | 3298675 | <reponame>anishsingh42/CodeChef
t = int(input())
while t:
N = list(map(int, input().split()))
N.remove(len(N)-1)
print(max(N))
t = t-1 | 0 | 0 | 0 | 0 | 0 | 0 |
scrapy/downloadermiddlewares/downloadtimeout.py | HyunTruth/scrapy | 9,953 | 3298685 | <reponame>HyunTruth/scrapy
"""
Download timeout middleware
See documentation in docs/topics/downloader-middleware.rst
"""
from scrapy import signals
class DownloadTimeoutMiddleware(object):
def __init__(self, timeout=180):
self._timeout = timeout
@classmethod
def from_crawler(cls, crawler):
... | 0 | 0 | 0 | 0 | 0 | 0 |
anuga/utilities/tests/test_plot_utils.py | samcom12/anuga_core | 136 | 3298707 | #!/usr/bin/env python
from __future__ import annotations
import os
import unittest
import anuga
import anuga.utilities.plot_utils as util
import numpy as np
flow_algorithms = ['DE0', 'DE1', '1_5', '2_0', 'tsunami']
verbose = False
class Test_plot_utils(unittest.TestCase):
def setUp(self):
pass
def... | 0 | 7 | 0 | 0 | 7 | 0 |
rules/configuration/rule_wp-xmlrpc.py | TomasTorresB/nerve | 365 | 3298713 | <gh_stars>100-1000
from core.redis import rds
from core.triage import Triage
from core.parser import ScanParser
class Rule:
def __init__(self):
self.rule = 'CFG_B3AB'
self.rule_severity = 1
self.rule_description = 'This rule checks for XML-RPC Enabled interfaces in Wordpress'
self.rule_confirm = ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/component_parser/cfml_properties.py | KamasamaK/sublimetext-cfml | 130 | 3298717 | <filename>src/component_parser/cfml_properties.py
# This module, via index(), takes in a cfml source file string and
# returns a python dict of the property names mapped to a dict
# containing data about the property.
# The structure looks like this:
# {
# "property_name": {
# "type": "any/string/numeric/etc",
#... | 0 | 0 | 0 | 0 | 0 | 0 |
pymilvus/client/blob.py | sarvex/pymilvus | 417 | 3298736 | <reponame>sarvex/pymilvus
import struct
# reference: https://docs.python.org/3/library/struct.html#struct.pack
def boolToBytes(b):
return struct.pack("?", b)
def int8ToBytes(i):
return struct.pack("b", i)
def int16ToBytes(i):
return struct.pack("h", i)
def int32ToBytes(i):
return struct.pack("i", i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_plugins/test_api_hook.py | emicoto/none | 1,757 | 3298738 | <filename>tests/test_plugins/test_api_hook.py
from nonebot.adapters import Bot
@Bot.on_calling_api
async def call(bot: Bot, api: str, data: dict):
print(type(bot), api, data)
| 0 | 0 | 0 | 0 | 0 | 0 |
demo/multi/ops/hello.py | marco-souza/falsy | 127 | 3298744 | <gh_stars>100-1000
def get_it1(name):
return {
'get1': name
}
def get_it2(name):
return {
'get2': name
}
| 0 | 0 | 0 | 0 | 0 | 0 |
sktime/classification/interval_based/tests/test_stsf.py | BINAYKUMAR943/sktime | 5,349 | 3298749 | # -*- coding: utf-8 -*-
"""STSF test code."""
import numpy as np
from numpy import testing
from sktime.classification.interval_based import SupervisedTimeSeriesForest
from sktime.datasets import load_gunpoint, load_italy_power_demand
def test_stsf_on_gunpoint():
"""Test of STSF on gun point."""
# load gunpoi... | 0 | 0 | 0 | 0 | 0 | 0 |
ldap2pg/script.py | dalibo/ldap2pg | 151 | 3298756 | <filename>ldap2pg/script.py
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import pdb
import resource
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import psycopg2
from . import ldap
from .config import Config... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/tutorials/01_introductory/viz_surfaces.py | RajPaliwal10/fury | 149 | 3298760 | """
==================
Visualize surfaces
==================
Here is a simple tutorial that shows how to visualize surfaces using DIPY. It
also shows how to load/save, get/set and update ``PolyData`` and show
surfaces.
``PolyData`` is a structure used by VTK to represent surfaces and other data
structures. Here we sh... | 0 | 0 | 0 | 0 | 0 | 0 |
ztag/annotations/mrvl.py | justinbastress/ztag | 107 | 3298797 | from ztag.annotation import *
class MRV1Server(Annotation):
protocol = protocols.HTTP
subprotocol = protocols.HTTP.GET
port: None = None
def process(self, obj, meta) -> object:
s = obj["headers"]["server"]
if s.startswith("Mrvl"):
meta.local_metadata.product = "Mrvl"
... | 0 | 1 | 1 | 0 | 2 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.