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 |
|---|---|---|---|---|
aliyun/log/etl_core/trans_comp/trans_base.py | topdown618/aliyun-log-python-sdk | 130 | 11092592 | <filename>aliyun/log/etl_core/trans_comp/trans_base.py
import json
import six
from ..etl_util import u
from ..etl_util import get_re_full_match, get_set_mode_if_skip_fn
import logging
logger = logging.getLogger(__name__)
class trans_comp_base(object):
@property
def __name__(self):
return str(type(sel... |
MNIST_with_centerloss.py | jxgu1016/MNIST_with_centerloss.pytorch | 346 | 11092603 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
import torch.optim.lr_scheduler as lr_scheduler
from CenterLoss import CenterLoss
import matplotlib.pyplot as plt
class Net(nn.Module):
... |
idaes/commands/examples.py | carldlaird/idaes-pse | 112 | 11092671 | <filename>idaes/commands/examples.py<gh_stars>100-1000
#################################################################################
# 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 (... |
tests/test_simulator.py | eugenpt/seagull | 162 | 11092673 | # -*- coding: utf-8 -*-
# Import modules
import pytest
import numpy as np
from matplotlib import animation
# Import from package
from seagull import lifeforms as lf
import seagull as sg
def test_simulator_run():
"""Test if the run() method returns the computed statistics"""
board = sg.Board(size=(10, 10))
... |
sharppy/sharptab/params.py | skovic/SHARPpy | 163 | 11092730 | <filename>sharppy/sharptab/params.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
''' Thermodynamic Parameter Routines '''
from __future__ import division
import numpy as np
import numpy.ma as ma
from sharppy.sharptab import interp, utils, thermo, winds
from sharppy.sharptab.constants import *
'''
This file ... |
instagram_scraper/endpoints.py | luengwaiban/instagram-python-scraper | 139 | 11092733 | # -*- coding:utf-8 -*-
import urllib.parse
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
BASE_URL = 'https://www.instagram.com'
LOGIN_URL = 'https://www.instagram.com/accounts/login/ajax/'
ACCOUNT_MEDIAS = "http://www.instagram.com/gr... |
cd4ml/problems/groceries/problem.py | camila-contreras/CD4ML-Scenarios | 113 | 11092771 | from cd4ml.problems.problem_base import ProblemBase
import cd4ml.problems.groceries.splitting as splitting
import cd4ml.problems.groceries.readers.stream_data as data_streamer
import cd4ml.problems.groceries.download_data.download_data as dd
import logging
from cd4ml.utils.utils import create_lookup
class Problem(Pr... |
config/oktoberkite/rotors.py | leozz37/makani | 1,178 | 11092783 | <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... |
tacker/sol_refactored/conductor/conductor_v2.py | h1r0mu/tacker | 116 | 11092786 | <reponame>h1r0mu/tacker<filename>tacker/sol_refactored/conductor/conductor_v2.py
# Copyright (C) 2021 Nippon Telegraph and Telephone Corporation
# 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 obt... |
manopth/argutils.py | BiggerBinBin/e3d_handpose_x-master | 544 | 11092807 | <reponame>BiggerBinBin/e3d_handpose_x-master
import datetime
import os
import pickle
import subprocess
import sys
def print_args(args):
opts = vars(args)
print('======= Options ========')
for k, v in sorted(opts.items()):
print('{}: {}'.format(k, v))
print('========================')
def sav... |
core/dataset/loader_multi_realdata.py | hyunynim/DIST-Renderer | 176 | 11092811 | <reponame>hyunynim/DIST-Renderer<filename>core/dataset/loader_multi_realdata.py
import numpy as np
import os, sys
import copy
import json
import torch
import trimesh
import torch.utils.data
import cv2
import easydict
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))
from common.geom... |
detection_img.py | tingyumao94/groupsoftmax-simpledet | 153 | 11092822 | <reponame>tingyumao94/groupsoftmax-simpledet<gh_stars>100-1000
import os
from core.detection_module import DetModule
from core.detection_input import Loader
from utils.load_model import load_checkpoint
from operator_py.nms import py_nms_wrapper
from utils import callback
from mxnet.base import _as_list
from ... |
mayan/apps/document_signatures/migrations/0011_rename_signaturebasemodel_field.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11092827 | <filename>mayan/apps/document_signatures/migrations/0011_rename_signaturebasemodel_field.py
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('documents', '0057_auto_20200916_1057'),
('document_signatures', '0010_auto_20191201_0146')
]
operations = ... |
src/visitpy/mpicom/py_src/__init__.py | visit-dav/vis | 226 | 11092833 | # Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
###############################################################################
# file: __init__.py... |
blesuite/entities/gatt_include.py | jreynders/BLESuite-1 | 198 | 11092843 | <reponame>jreynders/BLESuite-1<filename>blesuite/entities/gatt_include.py
import blesuite.utils.att_utils as att_utils
class BLEInclude(object):
""" BLEInclude is used to represent an included service located on a BTLE device
:var handle: Handle of attribute. Type int
:var included_service_att_ha... |
towhee/trainer/models/utils/pretrained_utils.py | ThyeeZz/towhee | 365 | 11092856 | <reponame>ThyeeZz/towhee
# Copyright 2021 Zilliz. 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 b... |
isserviceup/services/pagerduty.py | EvgeshaGars/is-service-up | 182 | 11092864 | <filename>isserviceup/services/pagerduty.py
from isserviceup.services.models.statuspage import StatusPagePlugin
class PagerDuty(StatusPagePlugin):
name = 'PagerDuty'
status_url = 'https://status.pagerduty.com/'
icon_url = '/images/icons/pagerduty.png'
|
qiskit/transpiler/passes/scheduling/padding/base_padding.py | itoko/qiskit-terra | 1,456 | 11092883 | <reponame>itoko/qiskit-terra<gh_stars>1000+
# This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# 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 directory
# of this source tree or at http://www.apache.org/licenses/LICENSE... |
Toxicity/toxic.py | UmaTaru/run | 163 | 11092895 | import re, string
import numpy as np
import pandas as pd
import pickle
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1... |
tools/ops/script_runner/lib/custom_commands/management/commands/estimate_concurrent_users.py | yetsun/hue | 5,079 | 11092906 | <reponame>yetsun/hue
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (th... |
ranking/management/modules/adventofcode.py | aropan/clist | 166 | 11092921 | <gh_stars>100-1000
#!/usr/bin/env python
import html
import json
import re
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta, timezone
from urllib.parse import urljoin
import arrow
from ranking.management.modules import conf
from ranking.management.modules.common import REQ, B... |
yasql/libs/RenderColumns.py | Fanduzi/YaSQL | 443 | 11092934 | <reponame>Fanduzi/YaSQL
# -*- coding:utf-8 -*-
# edit by fuzongfei
def render_dynamic_columns(render_columns):
try:
columns = []
for x in render_columns:
col = {'title': x['value'],
'dataIndex': x['key'],
'key': x['key'],
'scoped... |
tcapy/conf/celeryconfig.py | Ahrvo-Trading-Systems/tcapy | 189 | 11092940 | __author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2017 Cuemacro Ltd. - http//www.cuemacro.com / @cuemacro
#
# See the License for the specific language governing permissions and limitations under the License.
#
"""Has the configuration settings for celery. The main thing that needs to be changed is the broke... |
mac/pyobjc-framework-Quartz/PyObjCTest/test_ikimageeditpanel.py | albertz/music-player | 132 | 11092970 | <reponame>albertz/music-player
from PyObjCTools.TestSupport import *
from Quartz import *
class TestIKImageEditPanelHelper (NSObject):
def thumbnailWithMaximumSize_(self, sz): return None
def hasAdjustMode(self): return 1
def hasEffectsMode(self): return 1
def hasDetailsMode(self): return 1
class Tes... |
urls.py | wuzhongdehua/SinaWeibo-Emotion-Classification | 137 | 11093002 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
import time, json, base64, logging, hashlib
from datetime import datetime, tzinfo, timedelta
from transwarp.web import ctx, get, post, route, seeother, forbidden, jsonresult, Template
from transwarp import db
from weibo import APIError, APIClient
i... |
keepercommander/importer/lastpass/attachment_reader.py | Keeper-Security/commander | 151 | 11093003 | from base64 import b64decode
from io import RawIOBase, BufferedReader, TextIOWrapper
from Cryptodome.Cipher import AES
# Chunk size must be a multiple of 256
# Two b64 decodes each requiring a multiple of four times multiple of 16 needed for AES decryption (4 * 16 * 4 = 256)
CHUNK_SIZE = 8 * 1024
def decode_aes256... |
tests/run_tests.py | CurrySoftware/style-elements | 493 | 11093006 | # Run tests via selenium, either locally or on saucelabs
#
# Compile elm test code
# Open up a browser
#
#
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# This is the only code you need to edit in... |
tests/test_album.py | jack-debug/LyricsGenius | 692 | 11093011 | <gh_stars>100-1000
import unittest
import os
import warnings
from . import genius
from lyricsgenius.types import Album
class TestAlbum(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("\n---------------------\nSetting up Album tests...\n")
warnings.simplefilter("ignore", ResourceW... |
pyanomaly/networks/meta/pcn_parts/pcm.py | YuhaoCheng/PyAnomaly | 102 | 11093017 | <filename>pyanomaly/networks/meta/pcn_parts/pcm.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchsnooper
from pyanomaly.networks.parts.base.commonness import Conv2dLeakly
from pyanomaly.networks.parts.base.commonness import DoubleConv, Down, Up, OutConv, BasicConv2d
from .convolu... |
vincent/scales.py | ahlusar1989/vincent | 1,052 | 11093064 | <reponame>ahlusar1989/vincent
# -*- coding: utf-8 -*-
"""
Scales: Classes to define Vega scales
"""
from .core import grammar, GrammarClass
from ._compat import str_types
class DataRef(GrammarClass):
"""Definitions for how data is referenced by scales
Data can be referenced in multiple ways, and sometimes ... |
chemberta/utils/roberta_regression.py | BogdanDidenko/bert-loves-chemistry | 183 | 11093107 | import math
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.utils.checkpoint
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import PreTrainedModel, RobertaModel
from transformers.file_utils import ModelOutput
from transf... |
dnachisel/biotools/bowtie.py | simone-pignotti/DnaChisel | 124 | 11093122 | import subprocess
import tempfile
import os
def run_process(name, parameters):
process = subprocess.run(
parameters,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
if process.returncode:
error = process.stderr.decode()
raise OSError("%s failed:\n\n%s" % (name, erro... |
hashtable/linear_probing.py | x899/algorithms | 472 | 11093155 | <reponame>x899/algorithms
class LinearProbing:
def __init__(self):
self.size = 10
self.arr = [None for _ in range(self.size)]
def get_hash(self, key):
hash_value = 0
for char in key:
hash_value += ord(char)
return hash_value % self.size
def put(self, key... |
google_or_tools/send_more_money_scalar_product_sat.py | tias/hakank | 279 | 11093156 | # Copyright 2021 <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 writin... |
nussl/separation/base/separation_base.py | JTTurner/nussl | 259 | 11093160 | import copy
import warnings
import numpy as np
from ... import AudioSignal, play_utils
class SeparationBase(object):
"""Base class for all separation algorithms in nussl.
Do not call this. It will not do anything.
Parameters:
input_audio_signal (AudioSignal). AudioSignal` object.
T... |
homeassistant/components/youless/const.py | MrDelik/core | 30,023 | 11093195 | """Constants for the youless integration."""
DOMAIN = "youless"
|
tests/e2e/scale/noobaa/test_scale_obc_creation_repsin_noobaa_pods.py | annagitel/ocs-ci | 130 | 11093203 | import logging
import pytest
from ocs_ci.ocs import constants, scale_noobaa_lib
from ocs_ci.framework.testlib import scale, E2ETest
from ocs_ci.ocs.resources.objectconfigfile import ObjectConfFile
from ocs_ci.framework.pytest_customization.marks import on_prem_platform_required
log = logging.getLogger(__name__)
@py... |
tests/test_api/test_paste.py | cipherboy/modern-paste | 271 | 11093217 | <filename>tests/test_api/test_paste.py
# coding=utf-8
import json
import random
import time
import mock
from sqlalchemy.exc import SQLAlchemyError
import config
import constants.api
import database.attachment
import database.paste
import database.user
import util.cryptography
import util.testing
from uri.authenticat... |
src/lime_python/__init__.py | mirlarof/lime-python | 400 | 11093227 | <reponame>mirlarof/lime-python
from .protocol import *
|
apex/pyprof/prof/base.py | oyj0594/apex | 6,523 | 11093254 | <reponame>oyj0594/apex<filename>apex/pyprof/prof/base.py
from abc import ABC, abstractmethod
class OperatorLayerBase(ABC):
"""
Base class for all layers and operators.
Every derived class should have the following functions.
"""
@abstractmethod
def tc(self):
"""
Tensor core usage by the kernel.
Return "1"... |
docx/enum/table.py | thebongy/MakeMyOutputs | 169 | 11093287 | # encoding: utf-8
"""
Enumerations related to tables in WordprocessingML files
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from .base import (
Enumeration, EnumMember, XmlEnumeration, XmlMappedEnumMember
)
class WD_TABLE_ALIGNMENT(XmlEnumeration):
"""
... |
Python/interview-questions/rotateImage.py | saneravi/ML_Stuff | 209 | 11093303 | def rotateImage(a):
"""
>>> rotateImage([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
[[7, 4, 1], [8, 5, 2], [9, 6, 3]]
"""
return transpose(flip(a))
def flip(a):
"""
>>> flip([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
[[7, 8, 9], [4, 5, 6], [1, 2, 3]]
"""
# n = len(a)
# for x in range(n // 2... |
senseact_mod/test/test_rtrl_base_env.py | homayoonfarrahi/cycle-time-study | 188 | 11093309 | <gh_stars>100-1000
# Copyright (c) 2018, The SenseAct Authors.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import copy
import numpy as np
import unittest
import time
import psutil
from multiprocessing import ... |
Validation/HGCalValidation/python/simhitValidation_cff.py | ckamtsikis/cmssw | 852 | 11093371 | import FWCore.ParameterSet.Config as cms
from Validation.HGCalValidation.hgcalSimHitValidationEE_cfi import *
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
dd4hep.toModify( hgcalSimHitValidationEE, fromDDD = False )
hgcalSimHitValidationHEF = hgcalSimHitValidationEE.clone(
DetectorName = cms.stri... |
deepscm/datasets/morphomnist/__init__.py | mobarakol/deepscm | 183 | 11093375 | import os
from typing import Tuple
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
from deepscm.morphomnist import io
def _get_paths(root_dir, train):
prefix = "train" if train else "t10k"
images_filename = prefix + "-images-idx3-ubyte.gz"
labels_filename = prefi... |
dbReports/iondb/product_integration/tests/ThermoFisherCloudAccountTests.py | konradotto/TS | 125 | 11093380 | <filename>dbReports/iondb/product_integration/tests/ThermoFisherCloudAccountTests.py
# Copyright (C) 2017 Ion Torrent Systems, Inc. All Rights Reserved
from django.test import TestCase
from iondb.product_integration.models import ThermoFisherCloudAccount
class ThermoFisherCloudAccountTest(TestCase):
"""This will ... |
tf_agents/utils/xla.py | Francis777/agents | 3,175 | 11093413 | # coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
alipay/aop/api/response/AlipayDataDataexchangeSfasdfResponse.py | snowxmas/alipay-sdk-python-all | 213 | 11093435 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.AlipayItemGoodsList import AlipayItemGoodsList
class AlipayDataDataexchangeSfasdfResponse(AlipayResponse):
def __init__(self):
super(AlipayDataDataexchan... |
exadata/exastat.py | nenadnoveljic/tpt-oracle | 483 | 11093502 | #!/usr/bin/env python
################################################################################
##
## File name: exastat.py (v1.0)
## Purpose: Show cumulative exadata metrics from CELLCLI and their deltas
## in multicolumn format
##
## Author: <NAME> ( <EMAIL> | @tanelpoder | blog.tanelpo... |
mistral/tests/unit/engine/test_task_pause_resume.py | soda-research/mistral | 205 | 11093504 | # Copyright 2015 - StackStorm, Inc.
# Copyright 2016 - Brocade Communications Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LIC... |
sigal/plugins/encrypt/__init__.py | Lucas-C/sigal | 648 | 11093559 | """
Plugin to protect gallery by encrypting image files using a password.
Options::
encrypt_options = {
'password': 'password',
'ask_password': False,
'gcm_tag': 'randomly_generated',
'kdf_salt': 'randomly_generated',
'kdf_iters': 10000,
}
- ``password``: The password ... |
gunnery/event/tests/test_models.py | timgates42/gunnery | 314 | 11093569 | <filename>gunnery/event/tests/test_models.py
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from account.tests.fixtures import UserFactory
from core.tests.fixtures import ApplicationFactory, DepartmentFactory
from event.models import NotificationPreferences
class TestNotif... |
Game24/modules/endInterface.py | dwlcreat/dsf | 4,013 | 11093570 | '''
Function:
游戏结束界面
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import sys
import pygame
'''游戏结束界面'''
def endInterface(screen, cfg):
font_size_big = 60
font_size_small = 30
font_color = (255, 255, 255)
font_big = pygame.font.Font(cfg.FONTPATH, font_size_big)
font_small = pygame.font.Font(c... |
src/openfermion/linalg/wave_fitting_test.py | Emieeel/OpenFermion | 1,291 | 11093582 | # 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
# distribu... |
anipose/label_videos_3d.py | SjoerdBruijn/anipose | 230 | 11093586 | #!/usr/bin/env python3
from mayavi import mlab
mlab.options.offscreen = True
import numpy as np
from glob import glob
import pandas as pd
import os.path
import cv2
import sys
import skvideo.io
from tqdm import tqdm, trange
import sys
from collections import defaultdict
from matplotlib.pyplot import get_cmap
from .co... |
docs/introduction/codeexamples/twistdPlugin.py | tristanlatr/klein | 643 | 11093621 | <filename>docs/introduction/codeexamples/twistdPlugin.py
from klein import Klein
app = Klein()
@app.route("/")
def hello(request):
return "Hello, world!"
resource = app.resource
|
doc/example8.py | ajschumacher/plac | 233 | 11093665 | <filename>doc/example8.py
# example8.py
def main(command: ("SQL query", 'option', 'c'), dsn):
if command:
print('executing %s on %s' % (command, dsn))
# ...
if __name__ == '__main__':
import plac; plac.call(main)
|
autocolorize/__init__.py | gustavla/autocolorizer | 234 | 11093677 | from __future__ import division, print_function, absolute_import
from .extraction import (extract_sparse, extract, load_classifier,
load_default_classifier, colorize)
from .color import match_lightness
from . import image
from .datasets import load_image_list
from .checker import checker_main
... |
flatdata-generator/flatdata/generator/app.py | gferon/flatdata | 140 | 11093692 | <reponame>gferon/flatdata
'''
Copyright (c) 2017 HERE Europe B.V.
See the LICENSE file in the root of this project for license details.
'''
import argparse
import logging
import os.path
import sys
# check that requirements are installed here
try:
# pylint: disable=unused-import
import pyparsing
import j... |
vstruct/defs/pe.py | rnui2k/vivisect | 716 | 11093717 | <reponame>rnui2k/vivisect
import vstruct
from vstruct.primitives import *
class IMAGE_BASE_RELOCATION(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.VirtualAddress = v_uint32()
self.SizeOfBlock = v_uint32()
class IMAGE_DATA_DIRECTORY(vstruct.VStruct):
def... |
tests/backend/topology/conftest.py | goncalogteixeira/pyswarns | 959 | 11093725 | <reponame>goncalogteixeira/pyswarns<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Fixtures for tests"""
# Import modules
import numpy as np
import pytest
# Import from pyswarms
# Import from package
from pyswarms.backend.swarms import Swarm
@pytest.fixture(scope="module")
def swarm():
"""A... |
tests/gdata_tests/apps/organization/data_test.py | gauravuniverse/gdata-python-client | 483 | 11093727 | #!/usr/bin/python
#
# Copyright 2011 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/LICENSE-2.0
#
# Unless required b... |
OpenAttack/attackers/pso/__init__.py | e-tornike/OpenAttack | 444 | 11093737 | from typing import List, Optional
import numpy as np
import copy
from ..classification import ClassificationAttacker, Classifier, ClassifierGoal
from ...text_process.tokenizer import Tokenizer, get_default_tokenizer
from ...attack_assist.substitute.word import WordSubstitute, get_default_substitute
from ...utils impor... |
pyroomacoustics/transform/tests/test_stft_timing.py | Womac/pyroomacoustics | 915 | 11093779 | <reponame>Womac/pyroomacoustics<filename>pyroomacoustics/transform/tests/test_stft_timing.py
from __future__ import division, print_function
import numpy as np
import pyroomacoustics as pra
from pyroomacoustics.transform import STFT
import time
import warnings
# test signal
np.random.seed(0)
num_mic = 25
signals = np... |
nncf/version.py | MaximProshin/nncf | 136 | 11093785 | __version__ = '2.1.0'
BKC_TORCH_VERSION = '1.9.1'
BKC_TORCHVISION_VERSION = '0.10.1'
BKC_TF_VERSION = '2.5.*'
|
backend/services/tools/push_notify.py | sleepingAnt/viewfinder | 645 | 11093796 | # Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Manual push notification facility.
"""
__author__ = '<EMAIL> (<NAME>)'
from tornado import options
from viewfinder.backend.services.apns import APNS
from viewfinder.backend.services.push_notification import PushNotification
from viewfinder.backend.www import w... |
tests/test_soap_bridge.py | rexyeah/jira-cli | 125 | 11093847 | <filename>tests/test_soap_bridge.py
"""
"""
import os
import tempfile
import unittest
import jiracli
from jiracli.bridge import JiraSoapBridge
from jiracli.utils import Config
from .common_bridge_cases import BridgeTests, jiravcr
class SoapBridgeTests(unittest.TestCase, BridgeTests):
def setUp(self):
t... |
grr/client/grr_response_client/unprivileged/windows/sandbox.py | khanhgithead/grr | 4,238 | 11093851 | <reponame>khanhgithead/grr
#!/usr/bin/env python
"""Interface to Windows Sandboxing for the `process` module.
Adds support for global sandbox initialization and handles checks for whether
sandboxing is supported by the current platform.
"""
import logging
import platform
from typing import Iterable, Optional
_sandbo... |
glue/plugins/dendro_viewer/state.py | HPLegion/glue | 550 | 11093881 | # -*- coding: utf-8 -*-
from glue.core import BaseData
from glue.viewers.matplotlib.state import (MatplotlibDataViewerState,
MatplotlibLayerState,
DeferredDrawCallbackProperty as DDCProperty,
... |
tests/test_fetch_cord_computer.py | TabulateJarl8/FetchCord | 286 | 11093887 | import unittest
from fetch_cord.computer.Computer import Computer
def make_orderer():
order = {}
def ordered(f):
order[f.__name__] = len(order)
return f
def compare(a, b):
return [1, -1][order[a] < order[b]]
return ordered, compare
ordered, compare = make_orderer()
unitte... |
api/core/agent.py | zaxtyson/anime-api | 543 | 11093901 | <reponame>zaxtyson/anime-api
from typing import Callable, Coroutine
from api.config import Config
from api.core.anime import *
from api.core.cache import CacheDB
from api.core.danmaku import *
from api.core.proxy import AnimeProxy
from api.core.scheduler import Scheduler
from api.iptv.iptv import TVSource, get_sources... |
mmdet3d/core/utils/__init__.py | Guangyun-Xu/mmdetection3d | 2,216 | 11093903 | # Copyright (c) OpenMMLab. All rights reserved.
from .gaussian import draw_heatmap_gaussian, gaussian_2d, gaussian_radius
__all__ = ['gaussian_2d', 'gaussian_radius', 'draw_heatmap_gaussian']
|
HLTrigger/Configuration/python/extend_argparse.py | ckamtsikis/cmssw | 852 | 11093907 | import argparse as _argparse
import textwrap as _textwrap
# argparse's formatters remove newlines from comand descriptions, so we define a new one
class HelpFormatterRespectNewlines(_argparse.HelpFormatter):
"""Help message formatter which retains line breaks in argument descriptions.
Only the name of this cl... |
bindings/python/cntk/ops/tests/transpose_test.py | shyamalschandra/CNTK | 17,702 | 11093944 | # ==============================================================================
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
imp... |
elfi/examples/bignk.py | diadochos/elfi | 166 | 11093992 | <gh_stars>100-1000
"""Implementation of the bivariate g-and-k example model."""
from functools import partial
import numpy as np
import scipy.stats as ss
import elfi
from elfi.examples.gnk import euclidean_multiss, ss_robust
def BiGNK(A1, A2, B1, B2, g1, g2, k1, k2, rho, c=.8, n_obs=150, batch_size=1, random_state... |
tests/lifecycles/test_real_invocation.py | tavaresrodrigo/kopf | 855 | 11093994 | <gh_stars>100-1000
import logging
import pytest
import kopf
from kopf._cogs.structs.bodies import Body
from kopf._cogs.structs.ephemera import Memo
from kopf._cogs.structs.patches import Patch
from kopf._core.actions.progression import State
from kopf._core.engines.indexing import OperatorIndexers
from kopf._core.int... |
api/organisations/permissions/permissions.py | mevinbabuc/flagsmith | 1,259 | 11094025 | <gh_stars>1000+
from django.conf import settings
from rest_framework.exceptions import PermissionDenied
from rest_framework.permissions import BasePermission
from organisations.models import Organisation
CREATE_PROJECT = "CREATE_PROJECT"
ORGANISATION_PERMISSIONS = (
(CREATE_PROJECT, "Allows the user to create pr... |
03-adversarial-examples/dataset.py | PeiqinSun/tf-tutorials | 184 | 11094029 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import cv2
import numpy as np
import pickle
from common import config
class Dataset():
dataset_path = '../../cifar10-dataset/'
def __init__(self, dataset_name):
self.ds_name = dataset_name
self.minibatch_size = config.minibatch_size
... |
src/datasets/packaged_modules/text/text.py | rpatil524/datasets | 3,395 | 11094040 | <gh_stars>1000+
from dataclasses import dataclass
from io import StringIO
from typing import Optional
import pyarrow as pa
import datasets
from datasets.features.features import require_storage_cast
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
class TextCon... |
open/users/migrations/0006_auto_20200812_0936.py | lawrendran/open | 105 | 11094059 | # Generated by Django 2.2.13 on 2020-08-12 13:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("users", "0005_add_created_modified_to_user"),
]
operations = [
migrations.AlterModelOptions(name="user", options={"ordering": ["-id"]},),
]
|
tests/unit/test_merchant_account.py | futureironman/braintree_python | 182 | 11094064 | <reponame>futureironman/braintree_python
from tests.test_helper import *
class TestMerchantAccount(unittest.TestCase):
def test_create_new_merchant_account_with_all_params(self):
params = {
"id": "sub_merchant_account",
"status": "active",
"master_merchant_account": {
... |
examples/plot_5_unicode_everywhere.py | andriyor/sphinx-gallery | 309 | 11094072 | # -*- coding: utf-8 -*-
"""
Using Unicode everywhere 🤗
===========================
This example demonstrates how to include non-ASCII characters, mostly emoji 🎉
to stress test the build and test environments that parse the example files.
"""
from __future__ import unicode_literals
# 🎉 👍
# Code source: <NAME>
# Li... |
ztag/annotations/common_smtp.py | justinbastress/ztag | 107 | 11094089 | from ztag.annotation import *
class CommonSMTP(Annotation):
protocol = protocols.SMTP
subprotocol = protocols.SMTP.STARTTLS
port = None
def process(self, obj, meta):
s_banner = obj["banner"][4:]
if "Postfix" in s_banner:
meta.local_metadata.product = "Postfix"
... |
src/pymap3d/vallado.py | scivision/pymap3d | 108 | 11094102 | """
converts right ascension, declination to azimuth, elevation and vice versa.
Normally do this via AstroPy.
These functions are fallbacks for those wihtout AstroPy.
Michael Hirsch implementation of algorithms from <NAME>
"""
from __future__ import annotations
from datetime import datetime
from .mathfun import sin,... |
aliyun-python-sdk-alb/aliyunsdkalb/request/v20200616/ListLoadBalancersRequest.py | leafcoder/aliyun-openapi-python-sdk | 1,001 | 11094121 | # 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... |
split_folder/__init__.py | Nivratti/split-folders | 292 | 11094127 | __version__ = "0.4.3"
from .split import *
|
src/WebApp/App_Data/jobs/continuous/DatabricksAndSimulatedDevicesSetup/simulated_devices_setup.py | Azure/AI | 110 | 11094146 | import os
import json
import random
from iot_hub_helpers import IoTHub
def create_device(iot_hub, device_id, simulation_parameters):
iot_hub.create_device(device_id)
tags = {
'simulated': True
}
tags.update(simulation_parameters)
twin_properties = {
'tags': tags
}
... |
server/actor_libs/database/orm/utils.py | goodfree/ActorCloud | 173 | 11094155 | from datetime import datetime
from typing import List, Dict
from flask import g, request
from sqlalchemy import asc, desc, inspect, or_
from sqlalchemy.sql.sqltypes import Integer, String
from actor_libs.cache import Cache
from actor_libs.errors import ParameterInvalid
def dumps_query_result(query_result, **kwargs)... |
libcity/model/traffic_speed_prediction/Seq2Seq.py | moghadas76/test_bigcity | 221 | 11094186 | import torch
import torch.nn as nn
import random
from logging import getLogger
from libcity.model import loss
from libcity.model.abstract_traffic_state_model import AbstractTrafficStateModel
class Encoder(nn.Module):
def __init__(self, device, rnn_type, input_size, hidden_size=64,
num_layers=1, d... |
venv/lib/python3.8/site-packages/cloudinary/cache/storage/key_value_storage.py | Joshua-Barawa/My-Photos | 199 | 11094197 | from abc import ABCMeta, abstractmethod
class KeyValueStorage:
"""
A simple key-value storage abstract base class
"""
__metaclass__ = ABCMeta
@abstractmethod
def get(self, key):
"""
Get a value identified by the given key
:param key: The unique identifier
:re... |
examples/metapath2vec/utils/config.py | zbmain/PGL | 1,389 | 11094213 | # Copyright (c) 2021 PaddlePaddle 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... |
util/make_ascii.py | wenq1/duktape | 4,268 | 11094233 | #!/usr/bin/env python2
#
# Paranoia escape input file to be printable ASCII.
#
import os, sys
inp = sys.stdin.read().decode('utf-8')
for c in inp:
if (ord(c) >= 0x20 and ord(c) <= 0x7e) or (c in '\x0a'):
sys.stdout.write(c)
else:
sys.stdout.write('\\u%04x' % ord(c))
|
tests/python/contrib/test_ethosu/cascader/test_propagator.py | XiaoSong9905/tvm | 4,640 | 11094235 | # 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... |
mythril/analysis/module/__init__.py | kalloc/mythril | 1,887 | 11094284 | <reponame>kalloc/mythril<filename>mythril/analysis/module/__init__.py<gh_stars>1000+
from mythril.analysis.module.base import EntryPoint, DetectionModule
from mythril.analysis.module.loader import ModuleLoader
from mythril.analysis.module.util import (
get_detection_module_hooks,
reset_callback_modules,
)
|
python/242_Valid_Anagram.py | dvlpsh/leetcode-1 | 4,416 | 11094295 | class Solution(object):
# def isAnagram(self, s, t):
# """
# :type s: str
# :type t: str
# :rtype: bool
# """
# # sort
# return sorted(s) == sorted(t)
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
... |
dm_main.py | david-gpu/deep-makeover | 267 | 11094309 | import os
# Disable Tensorflow's INFO and WARNING messages
# See http://stackoverflow.com/questions/35911252
if 'TF_CPP_MIN_LOG_LEVEL' not in os.environ:
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import numpy as np
import numpy.random
import os.path
import random
import tensorflow as tf
import dm_celeba
import dm... |
train.py | kanchen-usc/QRC-Net | 117 | 11094314 | <filename>train.py
import tensorflow as tf
import os, sys
import numpy as np
import time
from dataprovider import dataprovider
from model import ground_model
from util.iou import calc_iou
from util.iou import calc_iou_by_reg_feat
from util.nms import nms
import argparse
parser = argparse.ArgumentParser()
parser.add_a... |
tests/test_compat.py | KazakovDenis/django-extensions | 4,057 | 11094322 | <reponame>KazakovDenis/django-extensions
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.test.utils import override_settings
from django_extensions.compat import get_template_setting
class CompatTests(TestCase):
@override_settings(TEMPLATES=None)
def test_should_return_None_by_default_i... |
ipypublish/port_api/plugin_to_json.py | parmentelat/ipypublish | 220 | 11094325 | <reponame>parmentelat/ipypublish<filename>ipypublish/port_api/plugin_to_json.py<gh_stars>100-1000
""" a module to convert between the old (Python script) plugin format,
and the new (JSON) one
"""
from typing import Dict, Tuple # noqa: F401
import ast
import json
def assess_syntax(path):
with open(path) as file_... |
api/src/opentrons/protocol_engine/commands/pick_up_tip.py | knownmed/opentrons | 235 | 11094349 | """Pick up tip command request, result, and implementation models."""
from __future__ import annotations
from pydantic import BaseModel
from typing import Optional, Type
from typing_extensions import Literal
from .pipetting_common import BasePipettingData
from .command import AbstractCommandImpl, BaseCommand, BaseComm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.