max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
LAMA/megatron_11b/models.py | leeyy2020/P-tuning | 411 | 55971 | from fairseq.models.transformer_lm import *
from torch.nn import CrossEntropyLoss
from typing import Any, Dict, List, Optional, Tuple
from torch import Tensor
class TransformerLanguageModelWrapper(TransformerLanguageModel):
@classmethod
def build_model(cls, args, task):
"""Build a new model instance.... |
tests/offline/test_logix_driver.py | amrhady2/ABB_Pycomm | 185 | 55975 | """Tests for the logix_driver.py file.
The Logix Driver is beholden to the CIPDriver interface. Only tests
which bind it to that interface should be allowed here. Tests binding
to another interface such as Socket are an anti-pattern.
There are quite a few methods in the LogixDriver which are difficult to
read or test... |
dynaconf/vendor/ruamel/yaml/scalarint.py | RonnyPfannschmidt/dynaconf | 2,293 | 55984 | from __future__ import print_function,absolute_import,division,unicode_literals
_B=False
_A=None
from .compat import no_limit_int
from .anchor import Anchor
if _B:from typing import Text,Any,Dict,List
__all__=['ScalarInt','BinaryInt','OctalInt','HexInt','HexCapsInt','DecimalInt']
class ScalarInt(no_limit_int):
def __n... |
green/suite.py | jwaschkau/green | 686 | 55991 | from __future__ import unicode_literals
from __future__ import print_function
from fnmatch import fnmatch
import sys
from unittest.suite import _call_if_exists, _DebugResult, _isnotsuite, TestSuite
from unittest import util
import unittest
from io import StringIO
from green.config import default_args
from green.outpu... |
lnbits/extensions/tipjar/views_api.py | fusion44/lnbits | 258 | 56044 | <gh_stars>100-1000
from quart import g, jsonify
from http import HTTPStatus
from lnbits.decorators import api_validate_post_request, api_check_wallet_key
from lnbits.core.crud import get_user
from . import tipjar_ext
from .helpers import get_charge_details
from .crud import (
create_tipjar,
get_tipjar,
cr... |
sonarqube/community/project_branches.py | ckho-wkcda/python-sonarqube-api | 113 | 56067 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: <NAME>
from sonarqube.utils.rest_client import RestClient
from sonarqube.utils.config import (
API_PROJECT_BRANCHES_LIST_ENDPOINT,
API_PROJECT_BRANCHES_DELETE_ENDPOINT,
API_PROJECT_BRANCHES_RENAME_ENDPOINT,
API_PROJECT_BRANCHES_SET_PROTECTION_ENDPO... |
community/dm-scaffolder/providers/pubsub.py | shan2202/deploymentmanager-samples | 930 | 56072 | <reponame>shan2202/deploymentmanager-samples
# Copyright 2018 Google Inc. 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/LIC... |
enteletaor_lib/modules/brute/cmd_brute_main.py | Seabreg/enteletaor | 159 | 56091 | # -*- coding: utf-8 -*-
#
# Enteletaor - https://github.com/cr0hn/enteletaor
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of con... |
sdk/python/pulumi_gcp/projects/default_service_accounts.py | sisisin/pulumi-gcp | 121 | 56115 | <reponame>sisisin/pulumi-gcp
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, U... |
poco/__init__.py | HBoPRC/Poco | 1,444 | 56119 | # coding=utf-8
from .pocofw import Poco
|
paperboy/resources/job.py | chris-aeviator/paperboy | 233 | 56143 | <gh_stars>100-1000
import json
from .base import BaseResource
class JobResource(BaseResource):
def __init__(self, *args, **kwargs):
super(JobResource, self).__init__(*args, **kwargs)
def on_get(self, req, resp):
'''List all job instances'''
resp.content_type = 'application/json'
... |
evalml/pipelines/components/transformers/samplers/__init__.py | Mahesh1822/evalml | 454 | 56150 | <filename>evalml/pipelines/components/transformers/samplers/__init__.py<gh_stars>100-1000
"""Sampler components."""
from .undersampler import Undersampler
from .oversampler import Oversampler
|
pylearn2/scripts/tutorials/tests/test_dbm.py | ikervazquezlopez/Pylearn2 | 2,045 | 56246 | <gh_stars>1000+
"""
This module tests dbm_demo/rbm.yaml
"""
import os
from pylearn2.testing import skip
from pylearn2.testing import no_debug_mode
from pylearn2.config import yaml_parse
@no_debug_mode
def train_yaml(yaml_file):
train = yaml_parse.load(yaml_file)
train.main_loop()
def train(yaml_file_path... |
utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py | kpdev/llvm-tnt | 1,073 | 56256 | # RUN: %{python} %s
from __future__ import print_function
import time
import sys
print("Running infinite loop")
sys.stdout.flush() # Make sure the print gets flushed so it appears in lit output.
while True:
pass
|
python/_args_parser.py | gglin001/poptorch | 128 | 56309 | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import copy
import inspect
import torch
# Do not import any poptorch.* here: it will break the poptorch module
from . import _impl
from ._logging import logger
class ArgsParser:
class Args:
def __init__(self):
self._args = []
... |
scripts/graph.py | maurizioabba/rose | 488 | 56323 | #!/usr/bin/env python
#
###############################################################################
#
# Author: <NAME>
# Date: 8/24/2006
# File: graph.py
# Purpose: Plots ROSE performance data
#
###############################################################################
import sys
import os
import string
impo... |
PhysicsTools/PatAlgos/python/recoLayer0/duplicatedElectrons_cfi.py | ckamtsikis/cmssw | 852 | 56356 | import FWCore.ParameterSet.Config as cms
# Remove duplicates from the electron list
electronsNoDuplicates = cms.EDFilter("DuplicatedElectronCleaner",
## reco electron input source
electronSource = cms.InputTag("gsfElectrons"),
)
|
Algo and DSA/LeetCode-Solutions-master/Python/single-number.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 56412 | <reponame>Sourav692/FAANG-Interview-Preparation<gh_stars>1000+
# Time: O(n)
# Space: O(1)
import operator
from functools import reduce
class Solution(object):
"""
:type nums: List[int]
:rtype: int
"""
def singleNumber(self, A):
return reduce(operator.xor, A)
|
openverse_api/catalog/api/migrations/0025_auto_20200429_1401.py | ritesh-pandey/openverse-api | 122 | 56421 | # Generated by Django 2.2.10 on 2020-04-29 14:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0024_auto_20200423_1601'),
]
operations = [
migrations.AlterField(
model_name='imagereport',
name='status',
... |
tests/test_validators.py | jonwhittlestone/streaming-form-data | 107 | 56422 | import pytest
from streaming_form_data.validators import MaxSizeValidator, ValidationError
def test_max_size_validator_empty_input():
validator = MaxSizeValidator(0)
with pytest.raises(ValidationError):
validator('x')
def test_max_size_validator_normal():
validator = MaxSizeValidator(5)
f... |
setup.py | ceys/django-tracking | 112 | 56427 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sys, os
import tracking
setup(
name='django-tracking',
version=tracking.get_version(),
description="Basic visitor tracking and blacklisting for Django",
long_description=open('README.rst', 'r').read(),
... |
src/amuse/test/suite/ext_tests/test_boss_bodenheimer.py | rknop/amuse | 131 | 56435 | import sys
import os
import numpy.random
from amuse.test import amusetest
from amuse.units import units, nbody_system
from amuse.ext.boss_bodenheimer import bb79_cloud
numpy.random.seed(1234567)
class BossBodenheimerTests(amusetest.TestCase):
def test1(self):
numpy.random.seed(1234)
mc=bb79_cloud... |
devel/toolkitEditor/createRopDialog/createRopDialog.py | t3kt/raytk | 108 | 56455 | from raytkTools import RaytkTools
# noinspection PyUnreachableCode
if False:
# noinspection PyUnresolvedReferences
from _stubs import *
from ..ropEditor.ropEditor import ROPEditor
iop.ropEditor = ROPEditor(COMP())
class CreateRopDialog:
def __init__(self, ownerComp: 'COMP'):
self.ownerComp = ownerComp
def _s... |
test/tests/tutorial_notebook_tests.py | jameszhan/swift-jupyter | 624 | 56528 | <reponame>jameszhan/swift-jupyter
# TODO(TF-747): Reenable.
# """Checks that tutorial notebooks behave as expected.
# """
#
# import unittest
# import os
# import shutil
# import tempfile
#
# from flaky import flaky
#
# from notebook_tester import NotebookTestRunner
#
#
# class TutorialNotebookTests(unittest.Test... |
code/parse-commonsenseQA.py | salesforce/cos-e | 138 | 56530 | <filename>code/parse-commonsenseQA.py
import jsonlines
import sys
import csv
expl = {}
with open(sys.argv[2], 'rb') as f:
for item in jsonlines.Reader(f):
expl[item['id']] = item['explanation']['open-ended']
with open(sys.argv[1], 'rb') as f:
with open(sys.argv[3],'w') as wf:
wfw = csv.writer(... |
test/test-tool/openmldb-case-gen/auto_gen_case/gen_case_yaml_main.py | jasleon/OpenMLDB | 2,659 | 56549 | <reponame>jasleon/OpenMLDB<filename>test/test-tool/openmldb-case-gen/auto_gen_case/gen_case_yaml_main.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... |
parser/reader/__init__.py | cheery/better_web_language | 136 | 56597 | from stream import CStream
from tokenizer import L2
from data import Expr, Literal, Position
#import space
#table = {
# u'(': u'lp', u')': u'rp',
# u'[': u'lb', u']': u'rb',
# u'{': u'lc', u'}': u'rc',
# u'and': u'and', u'or': u'or', u'not': u'not',
# u'=': u'let', u':=': u'set',
# u'<': u'chain',
# ... |
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/common/__init__.py | jeikabu/lumberyard | 123 | 56618 | <filename>dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/common/__init__.py
"""In this module are stored generated bindings for standard schema
like WSDL or SOAP."""
|
scale.app/scripts/msvc2org.py | f4rsh/SCALe | 239 | 56621 | #!/usr/bin/env python
# Scrubs the output of msvc and prints out the dianostics.
#
# The only argument indicates the file containing the input.
#
# This script can produce lots of messages per diagnostic
#
# Copyright (c) 2007-2018 Carnegie Mellon University. All Rights Reserved.
# See COPYRIGHT file for details.
im... |
tests/test_test1.py | sharmavaruns/descriptastorus | 118 | 56673 | import unittest
from descriptastorus import MolFileIndex
import os, shutil
import logging
import datahook
TEST_DIR = "test1"
class TestCase(unittest.TestCase):
def setUp(self):
if os.path.exists(TEST_DIR):
shutil.rmtree(TEST_DIR, ignore_errors=True)
index = self.index = MolFileIndex.M... |
howdy/src/cli/remove.py | matan-arnon/howdy | 3,552 | 56678 | <filename>howdy/src/cli/remove.py
# Remove a encoding from the models file
# Import required modules
import sys
import os
import json
import builtins
from i18n import _
# Get the absolute path and the username
path = os.path.dirname(os.path.realpath(__file__)) + "/.."
user = builtins.howdy_user
# Check if enough ar... |
data_gen/tts/txt_processors/en.py | ishine/DiffSinger-1 | 288 | 56692 | <reponame>ishine/DiffSinger-1
import re
from data_gen.tts.data_gen_utils import PUNCS
from g2p_en import G2p
import unicodedata
from g2p_en.expand import normalize_numbers
from nltk import pos_tag
from nltk.tokenize import TweetTokenizer
from data_gen.tts.txt_processors.base_text_processor import BaseTxtProcessor
cl... |
tools/console/plugins/plugin_package/helper/package_helper.py | rh101/engine-x | 321 | 56742 |
import os
import os.path
import json
import urllib2
import re
import cocos
from MultiLanguage import MultiLanguage
from functions import *
from local_package_database import LocalPackagesDatabase
from zip_downloader import ZipDownloader
def convert_version_part(version_part):
tag = '(\d+)(\D*.*)'
match = re... |
src/actions/actions/logit-events/__init__.py | anderson-attilio/runbook | 155 | 56847 | <gh_stars>100-1000
#!/usr/bin/python
######################################################################
# Cloud Routes Bridge
# -------------------------------------------------------------------
# Actions Module
######################################################################
import rethinkdb as r
from reth... |
tests/client/test_auth.py | Camille-cmd/python-amazon-sp-api | 213 | 56857 | <filename>tests/client/test_auth.py
from sp_api.base import AccessTokenClient
from sp_api.base import Credentials, CredentialProvider
from sp_api.base import AuthorizationError
from sp_api.base.credential_provider import FromCodeCredentialProvider
refresh_token = '<refresh_token>'
lwa_app_id = '<lwa_app_id>'
lwa_client... |
Skype4Py/lang/tr.py | low456high/Skype4Py | 199 | 56868 | apiAttachAvailable = u'API Kullanilabilir'
apiAttachNotAvailable = u'Kullanilamiyor'
apiAttachPendingAuthorization = u'Yetkilendirme Bekliyor'
apiAttachRefused = u'Reddedildi'
apiAttachSuccess = u'Basarili oldu'
apiAttachUnknown = u'Bilinmiyor'
budDeletedFriend = u'Arkadas Listesinden Silindi'
budFriend = u'Arkadas'
bu... |
src/masonite/stubs/middlewares/Middleware.py | cercos/masonite | 1,816 | 56875 | <filename>src/masonite/stubs/middlewares/Middleware.py
from masonite.middleware import Middleware
class __class__(Middleware):
def before(self, request, response):
return request
def after(self, request, response):
return request
|
tests/test_APITokenCommands.py | sc979/jenkins-attack-framework | 451 | 56910 | import random
import string
import unittest
import warnings
from libs import jenkinslib
from libs.JAF.BaseCommandLineParser import BaseCommandLineParser
from libs.JAF.plugin_CreateAPIToken import CreateAPIToken, CreateAPITokenParser
from libs.JAF.plugin_DeleteAPIToken import DeleteAPIToken, DeleteAPITokenParser
from l... |
streamdeck-plugin/src/browser_websocket_server.py | andrewachen/streamdeck-googlemeet | 124 | 56968 | import asyncio
import json
import logging
from typing import List, Set
import websockets
class BrowserWebsocketServer:
"""
The BrowserWebsocketServer manages our connection to our browser extension,
brokering messages between Google Meet and our plugin's EventHandler.
We expect browser tabs (and our ... |
scihub_eva/globals/preferences.py | zlgenuine/scihub | 859 | 56971 | # -*- coding: utf-8 -*-
# System
SYSTEM_LANGUAGE_KEY = 'System/Language'
SYSTEM_THEME_KEY = 'System/Theme'
SYSTEM_THEME_DEFAULT = 'System'
# File
FILE_SAVE_TO_DIR_KEY = 'File/SaveToDir'
FILE_SAVE_TO_DIR_DEFAULT = ''
FILE_FILENAME_PREFIX_FORMAT_KEY = 'File/FilenamePrefixFormat'
FILE_FILENAME_PREFIX_FORMAT_DEFAULT = ... |
test_haystack/test_app_with_hierarchy/__init__.py | nakarinh14/django-haystack | 2,021 | 56998 | <filename>test_haystack/test_app_with_hierarchy/__init__.py<gh_stars>1000+
"""Test app with multiple hierarchy levels above the actual models.py file"""
|
aicsimageio/tests/readers/test_default_reader.py | brisvag/aicsimageio | 110 | 57001 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Tuple
import numpy as np
import pytest
from aicsimageio import exceptions
from aicsimageio.readers.default_reader import DefaultReader
from ..conftest import get_resource_full_path, host
from ..image_container_test_utils import run_image_file_checks
... |
remote_flow/metaflow/model.py | JSpenced/you-dont-need-a-bigger-boat | 356 | 57021 | <reponame>JSpenced/you-dont-need-a-bigger-boat
import json
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.models import model_from_json
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.python.client import device_lib
from sklearn.model_... |
applications/ORE/add_unknown_pseudo_labels.py | kylevedder/mvits_for_class_agnostic_od | 114 | 57061 | """
The script expects the MViT (MDef-DETR or MDETR) detections in .txt format. For example, there should be,
One .txt file for each image and each line in the file represents a detection.
The format of a single detection should be "<label> <confidence> <x1> <y1> <x2> <y2>
Please see the 'mvit_detections' for referenc... |
src/genie/libs/parser/iosxe/tests/ShowLacpNeighborDetail/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 57100 | expected_output = {
"interfaces": {
"Port-channel1": {
"name": "Port-channel1",
"protocol": "lacp",
"members": {
"GigabitEthernet0/0/1": {
"activity": "Active",
"age": 18,
"aggregatable": True,
... |
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/cameras/tests/test_app.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 57134 | """App utilites tests.
"""
import sys
import pytest
from django.apps import apps
from ..models import Camera
pytestmark = pytest.mark.django_db
@pytest.mark.parametrize(
"testargs, output",
[
[["python", "manage.py", "runserver"], 4],
[["python", "manage.py", "makemigration"], 0],
[... |
tools/convert_cocomodel_for_init.py | MAYURGAIKWAD/meshrcnn | 1,028 | 57237 | <filename>tools/convert_cocomodel_for_init.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
r"""
Convert coco model for init. Remove class specific heads, optimizer and scheduler
so that this model can be used for pre-training
"""
import argparse
import torch
def main()... |
crafters/image/CenterImageCropper/__init__.py | strawberrypie/jina-hub | 106 | 57263 | <reponame>strawberrypie/jina-hub<gh_stars>100-1000
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from typing import Tuple, Dict, Union
import numpy as np
from jina.executors.decorators import single
from jina.executors.crafters import BaseCrafter
from .helper ... |
notebook/requests_download.py | vhn0912/python-snippets | 174 | 57272 | import requests
import os
url_image = 'https://www.python.org/static/community_logos/python-logo.png'
r_image = requests.get(url_image)
print(r_image.headers['Content-Type'])
# image/png
filename_image = os.path.basename(url_image)
print(filename_image)
# python-logo.png
with open('data/temp/' + filename_image, 'w... |
monitorrent/rest/settings_notify_on.py | DmitryRibalka/monitorrent | 465 | 57297 | import falcon
import six
from monitorrent.settings_manager import SettingsManager
# noinspection PyUnusedLocal
class SettingsNotifyOn(object):
def __init__(self, settings_manager):
"""
:type settings_manager: SettingsManager
"""
self.settings_manager = settings_manager
def on_... |
python/spinn/models/fat_classifier.py | stanfordnlp/spinn | 200 | 57337 | <reponame>stanfordnlp/spinn<gh_stars>100-1000
"""From the project root directory (containing data files), this can be run with:
Boolean logic evaluation:
python -m spinn.models.fat_classifier --training_data_path ../bl-data/pbl_train.tsv \
--eval_data_path ../bl-data/pbl_dev.tsv
SST sentiment (Demo only, model... |
backend/book/models/__init__.py | Mackrage/worm_rage_bot | 216 | 57439 | from .book import Book
|
tools/bin/ext/figleaf/__init__.py | YangHao666666/hawq | 450 | 57451 | <gh_stars>100-1000
"""
figleaf is another tool to trace Python code coverage.
figleaf uses the sys.settrace hook to record which statements are
executed by the CPython interpreter; this record can then be saved
into a file, or otherwise communicated back to a reporting script.
figleaf differs from the gold standard o... |
5]. Projects/Machine Learning & Data Science (ML-DS)/Python/Deep Learning Projects/Computer Vision/010]. Real Time Object Detection/Real_Time_Object_Detection.py | MLinesCode/The-Complete-FAANG-Preparation | 6,969 | 57502 | import cv2
import numpy as np
thres = 0.45
nms_threshold = 0.2
#Default Camera Capture
cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
cap.set(10, 150)
##Importing the COCO dataset in a list
classNames= []
classFile = 'coco.names'
with open(classFile,'rt') as f:
classNames = f.read().rstrip('\n').spli... |
ahmia/ahmia/forms.py | donno2048/ahmia-site | 185 | 57545 | <reponame>donno2048/ahmia-site
"""Forms used in Ahmia."""
import logging
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.utils.translation import ugettext as _
from .validators import validate_onion_url, validate_status
logger = logging.getLogger("ahmia")... |
Squest/api/authentication.py | LaudateCorpus1/squest | 112 | 57587 | <gh_stars>100-1000
from rest_framework import authentication, exceptions
from profiles.models import Token
class TokenAuthentication(authentication.TokenAuthentication):
"""
A custom authentication scheme which enforces Token expiration times.
"""
model = Token
keyword = 'Bearer'
def authent... |
lib/python/import_util.py | leozz37/makani | 1,178 | 57629 | <reponame>leozz37/makani
# Copyright 2020 Makani Technologies LLC
#
# 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 ap... |
Validation/HcalRecHits/python/NoiseRatesClient_cfi.py | ckamtsikis/cmssw | 852 | 57631 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
noiseratesClient = DQMEDHarvester("NoiseRatesClient",
# outputFile = cms.untracked.string('NoiseRatesHarvestingME.root'),
outputFile = cms.untracked.string(''),
DQMDirName = cms.string(... |
code/zoltar_scripts/create_validated_files_db.py | eycramer/covid19-forecast-hub | 428 | 57639 | import hashlib
import os
import pickle
from zoltpy.quantile_io import json_io_dict_from_quantile_csv_file
from zoltpy import util
from zoltpy.connection import ZoltarConnection
from zoltpy.covid19 import COVID_TARGETS, covid19_row_validator, validate_quantile_csv_file
import glob
import json
import sys
UPDATE = False
... |
tests/test_imports.py | ethan-jiang-1/ahrs | 184 | 57645 | # -*- coding: utf-8 -*-
"""
Test module imports
===================
"""
import sys
def test_module_imports():
try:
import ahrs
except:
sys.exit("[ERROR] Package AHRS not found. Go to root directory of package and type:\n\n\tpip install .\n")
try:
import numpy, scipy, matplotlib
... |
opacus/tests/grad_samples/group_norm_test.py | iamgroot42/opacus | 195 | 57677 | <reponame>iamgroot42/opacus
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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/... |
aliyun-python-sdk-market/aliyunsdkmarket/request/v20151101/DescribeCommoditiesRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 57683 | # 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"); you may not u... |
Algo and DSA/LeetCode-Solutions-master/Python/shift-2d-grid.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 57697 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/shift-2d-grid.py
# Time: O(m * n)
# Space: O(1)
class Solution(object):
def shiftGrid(self, grid, k):
"""
:type grid: List[List[int]]
:type k: int
:rtype: List[List[int]]
"""
def rotate(grids, k):
d... |
nvchecker_source/hackage.py | trathborne/nvchecker | 320 | 57728 | <filename>nvchecker_source/hackage.py
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <<EMAIL>>, et al.
HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json'
async def get_version(name, conf, *, cache, **kwargs):
key = conf.get('hackage', name)
data = await cache.get_json(HACKAGE_URL % key)
re... |
cvlib/utils.py | SunNy820828449/cvlib | 547 | 57738 | <filename>cvlib/utils.py
import requests
import progressbar as pb
import os
import cv2
import imageio
from imutils import paths
import numpy as np
def download_file(url, file_name, dest_dir):
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
full_path_to_file = dest_dir + os.path.sep + file_name... |
test/test_template_params.py | amizzo87/bernstein-stack | 358 | 57754 | <gh_stars>100-1000
import re
from cfn_tools import dump_yaml
from templates import ALL, MASTER, CLUSTER, SCHEDULER, WEBSERVER, WORKERSET
def test_if_important_properties_are_specified():
for template in ALL:
for specs in template["Parameters"].values():
assert "Description" in specs
... |
package_control/deps/oscrypto/version.py | evandrocoan/package_control | 3,373 | 57761 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
__version__ = '1.2.1'
__version_info__ = (1, 2, 1)
|
eosfactory/core/checklist.py | tuan-tl/eosfactory | 255 | 57783 | '''
'''
import sys
import json
import argparse
import eosfactory.core.utils as utils
import eosfactory.core.config as config
IS_ERROR = 2
IS_WARNING = 1
class Checklist():
def __init__(self, is_html=False, error_codes=""):
self.is_html = is_html
self.html_text = ""
self.is_error = False
... |
opendeep/models/container/__init__.py | vitruvianscience/OpenDeep | 252 | 57832 | from __future__ import division, absolute_import, print_function
from .prototype import *
from .repeating import *
|
notebook/numpy_matrix_inv.py | vhn0912/python-snippets | 174 | 57857 | import numpy as np
arr = np.array([[2, 5], [1, 3]])
arr_inv = np.linalg.inv(arr)
print(arr_inv)
# [[ 3. -5.]
# [-1. 2.]]
mat = np.matrix([[2, 5], [1, 3]])
mat_inv = np.linalg.inv(mat)
print(mat_inv)
# [[ 3. -5.]
# [-1. 2.]]
mat_inv = mat**-1
print(mat_inv)
# [[ 3. -5.]
# [-1. 2.]]
mat_inv = mat.I
print(mat_... |
test/jpypetest/test_customizer.py | pitmanst/jpype | 531 | 57858 | # *****************************************************************************
#
# 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
#
# ... |
python_submitty_utils/submitty_utils/db_utils.py | zeez2030/Submitty | 411 | 57894 | <filename>python_submitty_utils/submitty_utils/db_utils.py
"""Utilities for interacting with databases"""
def generate_connect_string(
host: str,
port: int,
db: str,
user: str,
password: str,
) -> str:
conn_string = f"postgresql://{user}:{password}@"
if not host.startswith('/'):
co... |
vnpy/app/algo_trading/base.py | funrunskypalace/vnpy | 19,529 | 57908 | EVENT_ALGO_LOG = "eAlgoLog"
EVENT_ALGO_SETTING = "eAlgoSetting"
EVENT_ALGO_VARIABLES = "eAlgoVariables"
EVENT_ALGO_PARAMETERS = "eAlgoParameters"
APP_NAME = "AlgoTrading"
|
Visual Tracking/LapSRN-tensorflow-master/main.py | shikivi/- | 120 | 57968 | #! /usr/bin/python
# -*- coding: utf8 -*-
import os, time, random
import numpy as np
import scipy
import tensorflow as tf
import tensorlayer as tl
from model import *
from utils import *
from config import *
###====================== HYPER-PARAMETERS ===========================###
batch_size = config.train.batch_siz... |
tests/test_apdu/__init__.py | amih90/bacpypes | 240 | 57973 | #!/usr/bin/python
"""
Test BACpypes APDU Module
"""
from . import test_max_apdu_length_accepted, test_max_segments_accepted
|
loggroup-lambda-connector/test/test_loggroup_lambda_connector.py | langmtt/sumologic-aws-lambda | 152 | 57982 | <reponame>langmtt/sumologic-aws-lambda
import subprocess
import time
import unittest
import boto3
from time import sleep
import json
import os
import sys
import datetime
import cfn_flip
# Modify the name of the bucket prefix for testing
BUCKET_PREFIX = "appdevstore"
AWS_REGION = os.environ.get("AWS_DEFAULT_REGION", "... |
DiffAugment-biggan-imagenet/compare_gan/gans/modular_gan_tpu_test.py | Rian-T/data-efficient-gans | 1,902 | 57997 | # coding=utf-8
# Copyright 2018 Google LLC & <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 law o... |
macros/_chrome.py | swipswaps/code-by-voice | 139 | 58012 | <gh_stars>100-1000
from dragonfly import (Grammar, AppContext, MappingRule, Dictation, Key, Text, Integer, Mimic)
context = AppContext(executable="chrome")
grammar = Grammar("chrome", context=context)
noSpaceNoCaps = Mimic("\\no-caps-on") + Mimic("\\no-space-on")
rules = MappingRule(
name = "chrome",
mapping ... |
scripts/datasets.py | HPG-AI/bachbot | 380 | 58019 | <gh_stars>100-1000
import click
import json, cPickle
import requests, zipfile
import os, glob
from music21 import analysis, converter, corpus, meter
from music21.note import Note
from constants import *
@click.group()
def datasets():
"""Constructs various datasets."""
pass
@click.command()
@click.option('-... |
OracleWebCenterContent/dockerfiles/12.2.1.4/container-scripts/setTopology.py | rmohare/oracle-product-images | 5,519 | 58050 | #!/usr/bin/python
# Copyright (c) 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
#
# ==============================================
import sys
admin_name = os.environ['ADMIN_USERNAME']
admin_pass = os.environ['ADMIN_PASSWORD'... |
examples/fred_series_to_bigquery_example.py | Ressmann/starthinker | 138 | 58055 | ###########################################################################
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... |
src/lib/searchio/cmd/__init__.py | cgxxv/alfred-searchio | 304 | 58087 | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2016-12-17
#
"""CLI program sub-commands."""
|
evaluation.py | unluckydan/deep_metric_learning | 169 | 58107 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 27 12:47:00 2017
@author: sakurai
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import AffinityPropagation
from sklearn.metrics import f1_score
from sklearn.metrics import normalized_mutual_info_score
from sklearn.preprocessing import LabelE... |
__other__/parser/parser.py | whitmans-max/python-examples | 140 | 58123 | import sys
#print sys.argv[0], len( sys.argv )
if len(sys.argv) > 1:
with open(sys.argv[1], 'r') as f_in:
result = 0
for line in f_in:
data = line.strip().split()
# print('data:', data)
if data[0] == "+":
result += float(data[1])
... |
tests/core/transaction-utils/conftest.py | ggs134/py-evm | 1,641 | 58175 | import pytest
# from https://github.com/ethereum/tests/blob/c951a3c105d600ccd8f1c3fc87856b2bcca3df0a/BasicTests/txtest.json # noqa: E501
TRANSACTION_FIXTURES = [
{
"chainId": None,
"key": "c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4",
"nonce": 0,
"gasPrice": 1... |
tools/convert_datasets/lasot/lasot2coco.py | BigBen0519/mmtracking | 2,226 | 58188 | <reponame>BigBen0519/mmtracking<filename>tools/convert_datasets/lasot/lasot2coco.py
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
from collections import defaultdict
import mmcv
from tqdm import tqdm
def parse_args():
parser = argparse.ArgumentParser(
des... |
semantic_seg_synthia/synthia_dataset_chained_flow.py | HarmoniaLeo/meteornet | 127 | 58218 | <reponame>HarmoniaLeo/meteornet
'''
Provider for duck dataset from <NAME>
'''
import os
import os.path
import json
import numpy as np
import sys
import pickle
import copy
import psutil
from pyquaternion import Quaternion
import class_mapping
class SegDataset():
def __init__(self, root='processed_pc', \
... |
smr/test/integrated/test_mem_disk_change.py | lynix94/nbase-arc | 176 | 58285 | <reponame>lynix94/nbase-arc
#
# Copyright 2015 Naver Corp.
#
# 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... |
src/hg/encode/encodeCharts/encodeStatus.py | andypohl/kent | 171 | 58319 | #!/hive/groups/recon/local/bin/python
# Requires Python 2.6, current default python on hgwdev is 2.4
"""CGI script that outputs the ENCODE status based upon a specified
field.
"""
import cgi, cgitb
import datetime
import json
import sys
# Import local modules found in "/hive/groups/encode/dcc/charts"
sys.path.append... |
amadeus/namespaces/_reference_data.py | minjikarin/amadeus-python | 125 | 58391 | <filename>amadeus/namespaces/_reference_data.py<gh_stars>100-1000
from amadeus.client.decorator import Decorator
from amadeus.reference_data._urls import Urls
from amadeus.reference_data._location import Location
from amadeus.reference_data._locations import Locations
from amadeus.reference_data._airlines import Airlin... |
tiny_benchmark/maskrcnn_benchmark/layers/sigmoid_focal_loss.py | ucas-vg/TinyBenchmark | 495 | 58455 | <reponame>ucas-vg/TinyBenchmark
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from maskrcnn_benchmark import _C
# TODO: Use JIT to replace CUDA implementation in the future.
class _SigmoidFocalLoss(Function):
@staticmethod
def for... |
reddit2telegram/channels/~inactive/r_hqdesi/app.py | mainyordle/reddit2telegram | 187 | 58471 | <reponame>mainyordle/reddit2telegram
#encoding:utf-8
subreddit = 'HQDesi'
t_channel = '@r_HqDesi'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
setup.py | Mahima-ai/ALEPython | 107 | 58516 | # -*- coding: utf-8 -*-
from setuptools import find_packages, setup
with open("README.md") as f:
long_description = f.read()
with open("requirements.txt", "r") as f:
required = f.read().splitlines()
setup(
name="alepython",
description="Python Accumulated Local Effects (ALE) package.",
author="<... |
tproxy/__init__.py | romabysen/tproxy | 170 | 58535 | <reponame>romabysen/tproxy<filename>tproxy/__init__.py
# -*- coding: utf-8 -
#
# This file is part of tproxy released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 5, 4)
__version__ = ".".join(map(str, version_info))
|
env/lib/python3.8/site-packages/plotly/graph_objs/layout/template/data/_histogram.py | acrucetta/Chicago_COVI_WebApp | 11,750 | 58545 | <reponame>acrucetta/Chicago_COVI_WebApp<gh_stars>1000+
from plotly.graph_objs import Histogram
|
tests/model/create_model_repr_test.py | Timothyyung/bravado-core | 122 | 58589 | <reponame>Timothyyung/bravado-core
# -*- coding: utf-8 -*-
import pytest
import six
def test_success(user):
expected = "User(email=None, firstName=None, id=None, lastName=None, password=<PASSWORD>, phone=None, userStatus=None, username=None)" # noqa
assert expected == repr(user)
def test_allOf(cat, cat_spe... |
py-polars/polars/eager/__init__.py | elferherrera/polars | 1,595 | 58591 | <reponame>elferherrera/polars<gh_stars>1000+
# flake8: noqa
from . import frame, series
from .frame import *
from .series import *
__all__ = frame.__all__ + series.__all__
|
pydlm/dlm.py | onnheimm/pydlm | 423 | 58603 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
===============================================================================
The code for the class dlm
===============================================================================
This is the main class of the Bayeisan dynamic linear model.
It provides the modeli... |
Calibration/HcalAlCaRecoProducers/python/alcaiterphisym_cfi.py | malbouis/cmssw | 852 | 58606 | <reponame>malbouis/cmssw
import FWCore.ParameterSet.Config as cms
# producer for alcaiterativephisym (HCAL Iterative Phi Symmetry)
import Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi
IterativePhiSymProd = Calibration.HcalAlCaRecoProducers.alcaEcalHcalReadoutsProducer_cfi.alcaEcalHcalReadoutsProd... |
testsuite/databases/pgsql/utils.py | okutane/yandex-taxi-testsuite | 128 | 58615 | import pathlib
import typing
import urllib.parse
_PLUGIN_DIR = pathlib.Path(__file__).parent
PLUGIN_DIR = str(_PLUGIN_DIR)
CONFIGS_DIR = str(_PLUGIN_DIR.joinpath('configs'))
SCRIPTS_DIR = str(_PLUGIN_DIR.joinpath('scripts'))
def scan_sql_directory(root: str) -> typing.List[pathlib.Path]:
return [
path
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.