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 |
|---|---|---|---|---|
Chapter06/6B_TrendFollowings/6B_1_trendFollowing.py | uyenphuong18406/Hands-On-Artificial-Intelligence-for-Banking | 115 | 12728009 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
QUANDLKEY = '<ENTER YOUR QUANDLKEY HERE>'
"""
Created on Thu Oct 25 23:19:44 2018
@author: jeff
"""
'''*************************************
#1. Import libraries and key varable values
'''
import quandl
import plotly
import plotly.graph_objs as go
import numpy as np
fro... |
example/books/models.py | spapas/django-generic-scaffold | 106 | 12728048 | from __future__ import unicode_literals
try:
from django.core.urlresolvers import reverse
except ModuleNotFoundError:
from django.urls import reverse
from django.db import models
import generic_scaffold
class Book(models.Model):
title = models.CharField(max_length=128)
author = models.CharField(max_l... |
asterocr/text_rec/loss/__init__.py | ankur6ue/aster-ocr | 605 | 12728061 | from __future__ import absolute_import
from .sequenceCrossEntropyLoss import SequenceCrossEntropyLoss
__all__ = [
'SequenceCrossEntropyLoss',
] |
src/sage/crypto/mq/sbox.py | bopopescu/sage | 1,742 | 12728063 | <filename>src/sage/crypto/mq/sbox.py
from sage.misc.lazy_import import lazy_import
lazy_import('sage.crypto.sbox', ['SBox',
'feistel_construction',
'misty_construction'],
deprecation=22986)
|
K8PortScan.py | VCStardust/K8tools | 4,611 | 12728081 | import socket, sys
import threading
import argparse
import time
##Code: https://github.com/k8gege/K8PortScan
##K8portScan 1.0
##Date: 20190530
##Author: K8gege
##Usage:
##IP (IP IP/24 IP/16 IP/8)
##
##python K8PortScan.py -ip 172.16.17.32
##python K8PortScan.py -ip 172.16.17.32 -p 80-89
##python K8PortScan... |
middileware/jboss/jboss_unrce.py | xin053/PocCollect | 340 | 12728107 | <filename>middileware/jboss/jboss_unrce.py
#coding:utf-8
import urllib2
import binascii
import time
from t import T
def readfile(path):
data=None
file_object = open(path,'rb')
try:
data = file_object.read( )
finally:
file_object.close( )
return data
class P(T... |
torchdrift/detectors/partial_mmd.py | TorchDrift/TorchDrift | 200 | 12728129 | <gh_stars>100-1000
from typing import Optional
import torch
from .mmd import GaussianKernel
from .detector import Detector
import torchdrift
import warnings
def partial_kernel_mmd_twostage(x, y, n_perm=None,
kernel=GaussianKernel(),
fraction_to_match=1.0... |
plotdevice/util/readers.py | plotdevice/plotdevice | 110 | 12728133 | <filename>plotdevice/util/readers.py
# encoding: utf-8
import os, sys, re
from operator import attrgetter
PY2 = sys.version_info[0] == 2
# files & io
from io import open, StringIO, BytesIO
from os.path import abspath, dirname, exists, join, splitext
from plotdevice import DeviceError, INTERNAL
text_type = str if not P... |
tests/build_small_spatialite_db.py | eyeseast/datasette | 5,978 | 12728169 | <reponame>eyeseast/datasette<filename>tests/build_small_spatialite_db.py
import sqlite3
# This script generates the spatialite.db file in our tests directory.
def generate_it(filename):
conn = sqlite3.connect(filename)
# Lead the spatialite extension:
conn.enable_load_extension(True)
conn.load_extens... |
extra_tests/snippets/unicode_slicing.py | dbrgn/RustPython | 11,058 | 12728187 | def test_slice_bounds(s):
# End out of range
assert s[0:100] == s
assert s[0:-100] == ''
# Start out of range
assert s[100:1] == ''
# Out of range both sides
# This is the behaviour in cpython
# assert s[-100:100] == s
def expect_index_error(s, index):
try:
s[index]
exce... |
pytorch_blade/torch_blade/algorithm/union_set.py | JamesTheZ/BladeDISC | 328 | 12728242 | # Copyright 2021 The BladeDISC 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 applicable law or ... |
modules/ICMP.py | androdev4u/XFLTReaT | 315 | 12728247 | <gh_stars>100-1000
# MIT License
# Copyright (c) 2017 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
test/tests/python-sqlite3/container.py | sortie/official-images | 5,326 | 12728253 | <reponame>sortie/official-images<filename>test/tests/python-sqlite3/container.py<gh_stars>1000+
import sqlite3
ver = sqlite3.sqlite_version
con = sqlite3.connect(':memory:', 1, sqlite3.PARSE_DECLTYPES, None)
cur = con.cursor()
cur.execute('CREATE TABLE test (id INT, txt TEXT)')
cur.execute('INSERT INTO test VALUES (?... |
src/nsupdate/main/migrations/0006_auto_20141121_1057.py | mirzazulfan/nsupdate.info | 774 | 12728256 | <reponame>mirzazulfan/nsupdate.info
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0005_auto_20141121_1053'),
]
operations = [
migrations.AddField(
mod... |
discomll/tests/chunk_testdata.py | romanorac/discomll | 103 | 12728260 | <filename>discomll/tests/chunk_testdata.py
def chunk_testdata():
import discomll
from disco import ddfs
path = "/".join(discomll.__file__.split("/")[:-2] + ["discomll", "datasets", ""])
tags_chunk = ["test:breast_cancer_cont", "test:breast_cancer_cont_test", "test:breast_cancer_disc",
... |
descarteslabs/workflows/types/primitives/tests/test_string.py | carderne/descarteslabs-python | 167 | 12728262 | <filename>descarteslabs/workflows/types/primitives/tests/test_string.py
import operator
import pytest
from ...containers import Tuple, List
from ..bool_ import Bool
from ..number import Int
from ..string import Str
@pytest.mark.parametrize(
"other, result_type, op, reflected",
[
(Str(""), Str, opera... |
DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cosmics_cff.py | ckamtsikis/cmssw | 852 | 12728276 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMOffline.Trigger.HLTMuonOfflineAnalyzer_cfi import hltMuonOfflineAnalyzer
barrelMuonParams = cms.PSet(
d0Cut = cms.untracked.double(1000.0),
z0Cut = cms.untracked.double(1000.0),
recoCuts = cms.untracked.string("i... |
dbaas/account/serializers.py | didindinn/database-as-a-service | 303 | 12728296 | <reponame>didindinn/database-as-a-service
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services.api import DjangoServiceSerializer
from .models import Team, AccountUser
class TeamSerializer(DjangoServiceSerializer):
class Meta:
model = Team
class UserSeri... |
eeauditor/auditors/aws/Amazon_EC2_Image_Builder_Auditor.py | kbhagi/ElectricEye | 442 | 12728306 | #This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#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 un... |
examples/brtdp_example.py | david-abel/mdps | 230 | 12728315 | # Python imports.
from collections import defaultdict
import copy
# Other imports.
from simple_rl.planning import Planner
from simple_rl.planning import ValueIteration
from simple_rl.tasks import GridWorldMDP
from simple_rl.planning.BoundedRTDPClass import BoundedRTDP
class MonotoneLowerBound(Planner):
def __init... |
tests/test_provider_circonus_labs_circonus.py | mjuenema/python-terrascript | 507 | 12728316 | <reponame>mjuenema/python-terrascript
# tests/test_provider_circonus-labs_circonus.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:13:59 UTC)
def test_provider_import():
import terrascript.provider.circonus_labs.circonus
def test_resource_import():
from terrascript.resource.circonus_labs.c... |
colorsublime/commands.py | adrianebohrer/Colorsublime-Plugin | 495 | 12728318 | """
Collection of functions the plugin can invoke. Most if not all should be
non-blocking (@async) functions to keep the main UI thread from freezing.
These functions should catch all unexpected exceptions so the plugin does not
have to. Unexpected exceptions should return False. Expected exceptions should
be caught b... |
src/textual/views/_grid_view.py | dpoehls/textual | 6,706 | 12728326 | from ..view import View
from ..layouts.grid import GridLayout
class GridView(View, layout=GridLayout):
@property
def grid(self) -> GridLayout:
assert isinstance(self.layout, GridLayout)
return self.layout
|
notebooks/exercise_solutions/n03_kinematics_define-frame.py | pydy/pydy-tutorial-human-standing | 134 | 12728338 | upper_leg_frame = ReferenceFrame('U')
torso_frame = ReferenceFrame('T') |
tests/test_stats.py | almartin82/bayeslite | 964 | 12728355 | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing 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/LICENS... |
jesse/strategies/Test38/__init__.py | noenfugler/jesse | 3,999 | 12728373 | from jesse.strategies import Strategy
# test_average_take_profit_exception
class Test38(Strategy):
def should_long(self) -> bool:
return self.index == 0
def should_short(self) -> bool:
return False
def go_long(self):
qty = 1
self.buy = qty, 2
self.stop_loss = qty,... |
albumentations/augmentations/dropout/mask_dropout.py | Multihuntr/albumentations | 3,893 | 12728403 | import random
from typing import Union, Tuple, Any, Dict
import cv2
import numpy as np
from skimage.measure import label
from ...core.transforms_interface import DualTransform
from ...core.transforms_interface import to_tuple
__all__ = ["MaskDropout"]
class MaskDropout(DualTransform):
"""
Image & mask augm... |
model/central.py | Misterion777/ConceptFlow | 107 | 12728432 | <filename>model/central.py
#coding:utf-8
import torch
import numpy as np
from torch.autograd import Variable
import torch.nn as nn
from torch.nn import utils as nn_utils
from .embedding import WordEmbedding, EntityEmbedding, use_cuda, VERY_SMALL_NUMBER, VERY_NEG_NUMBER
class CentralEncoder(nn.Module):
def __init__... |
AotSharedCacheExtractor/main.py | FFRI/ProjectChampollion | 172 | 12728450 | #
# (c) FFRI Security, Inc., 2021 / Author: FFRI Security, Inc.
#
import mmap
import os
from ctypes import Structure, c_uint32, c_uint64, sizeof
from typing import Iterable, Optional, cast
import typer
app = typer.Typer()
AOT_SHARED_CACHE_MAGIC = 0x6568636143746F41
def show_err(msg: str) -> None:
typer.secho(m... |
sfaira/versions/genomes/__init__.py | theislab/sfaira | 110 | 12728471 | from .genomes import GenomeContainer, GtfInterface
from .utils import translate_id_to_symbols, translate_symbols_to_id
|
moe/__init__.py | misokg/Cornell-MOE | 218 | 12728560 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
#: Following the versioning system at http://semver.org/
#: See also docs/contributing.rst, section ``Versioning``
#: MAJOR: incremented for incompatible API changes
MAJOR = 1
#: MINOR: incremented for adding functionality in a backwards-compatible manner
MINOR = 0
#: PATCH: ... |
mle_monitor/protocol/tables.py | mle-infrastructure/mle-monitor | 107 | 12728581 | <filename>mle_monitor/protocol/tables.py<gh_stars>100-1000
import pandas as pd
from datetime import datetime
from rich import box
from rich.table import Table
from rich.spinner import Spinner
from rich.console import Console
from rich.align import Align
from rich.progress import (
BarColumn,
Progress,
Text... |
src/agent/kubernetes-agent/src/network/__init__.py | hyperledger-gerrit-archive/cello | 865 | 12728602 | <filename>src/agent/kubernetes-agent/src/network/__init__.py
#
# SPDX-License-Identifier: Apache-2.0
#
from .fabric import FabricNetwork
|
src/livestreamer/packages/flashmedia/error.py | jaccarmac/livestreamer | 3,614 | 12728648 | <reponame>jaccarmac/livestreamer<filename>src/livestreamer/packages/flashmedia/error.py<gh_stars>1000+
#!/usr/bin/env python
class FLVError(Exception):
pass
class F4VError(Exception):
pass
class AMFError(Exception):
pass
__all__ = ["FLVError", "F4VError", "AMFError"]
|
src/model/paf_model.py | ParikhKadam/part-affinity | 110 | 12728668 | import torch.nn as nn
from .helper import init, make_standard_block
import torch
class PAFModel(nn.Module):
def __init__(self, backend, backend_outp_feats, n_joints, n_paf, n_stages=7):
super(PAFModel, self).__init__()
assert (n_stages > 0)
self.backend = backend
stages = [Stage(ba... |
atcoder/abc099/b.py | Ashindustry007/competitive-programming | 506 | 12728674 | <gh_stars>100-1000
#!/usr/bin/env python3
# https://abc099.contest.atcoder.jp/tasks/abc099_b
a, b = map(int, input().split())
d = b - a
k = d * (d - 1) // 2
print(k - a)
|
convert.py | onlyrico/RepMLP | 220 | 12728709 | import argparse
import os
import torch
from repmlpnet import *
parser = argparse.ArgumentParser(description='RepMLPNet Conversion')
parser.add_argument('load', metavar='LOAD', help='path to the source weights file')
parser.add_argument('save', metavar='SAVE', help='path to the target weights file')
parser.add_argument... |
env/Lib/site-packages/OpenGL/GLES2/ANGLE/pack_reverse_row_order.py | 5gconnectedbike/Navio2 | 210 | 12728716 | '''OpenGL extension ANGLE.pack_reverse_row_order
This module customises the behaviour of the
OpenGL.raw.GLES2.ANGLE.pack_reverse_row_order to provide a more
Python-friendly API
Overview (from the spec)
This extension introduces a mechanism to allow reversing the order
in which image rows are written into a pack... |
vedastr/models/bodies/rectificators/registry.py | csmasters/vedastr | 475 | 12728758 | from vedastr.utils import Registry
RECTIFICATORS = Registry('Rectificator')
|
python/samples/st7735s.py | robn/spidriver | 142 | 12728793 | <reponame>robn/spidriver<gh_stars>100-1000
#!/usr/bin/env python3
# coding=utf-8
import array
import getopt
import struct
import sys
import time
from PIL import Image
from spidriver import SPIDriver
# Pure Python rgb to 565 encoder for portablity
def as565(im):
rr, gg, bb = [list(c.getdata()) for c in im.convert(... |
napari/_tests/test_multiple_viewers.py | MaksHess/napari | 1,345 | 12728827 | from napari import Viewer
def test_multi_viewers_dont_clash(qapp):
v1 = Viewer(show=False, title='v1')
v2 = Viewer(show=False, title='v2')
assert not v1.grid.enabled
assert not v2.grid.enabled
v1.window.activate() # a click would do this in the actual gui
v1.window._qt_viewer.viewerButtons.g... |
src/lockmgr.py | anbo225/docklet | 273 | 12728833 | #!/usr/bin/python3
'''
This module is the manager of threadings locks.
A LockMgr manages multiple threadings locks.
'''
import threading
class LockMgr:
def __init__(self):
# self.locks will store multiple locks by their names.
self.locks = {}
# the lock of self.locks, is to ensure that ... |
aliyun-python-sdk-cloudphoto/aliyunsdkcloudphoto/__init__.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 12728850 | <filename>aliyun-python-sdk-cloudphoto/aliyunsdkcloudphoto/__init__.py
__version__ = "1.1.19" |
python/src/converters/__init__.py | vvucetic/keyvi | 199 | 12728857 | <reponame>vvucetic/keyvi
from .pykeyvi_autowrap_conversion_providers import *
from autowrap.ConversionProvider import special_converters
def register_converters():
special_converters.append(MatchIteratorPairConverter())
|
openmmtools/data/benzene-toluene-implicit/generate-molecules.py | sroet/openmmtools | 135 | 12728859 | #!/usr/bin/env python
"""
Generate molecules for test system using OpenEye tools.
"""
molecules = { 'BEN' : 'benzene',
'TOL' : 'toluene' }
from openeye import oechem
from openeye import oeomega
from openeye import oeiupac
from openeye import oequacpac
# Create molecules.
for resname in molecules:
... |
src/research/dynamic/dynamic_test.py | mzy2240/GridCal | 284 | 12728889 | from GridCal.Engine.calculation_engine import *
from GridCal.Engine.Simulations.Dynamics.dynamic_modules import *
grid = MultiCircuit()
# grid.load_file('lynn5buspv.xlsx')
grid.load_file('IEEE30.xlsx')
grid.compile()
circuit = grid.circuits[0]
options = PowerFlowOptions(SolverType.NR, verbose=False, robust=False, to... |
src/titiler/core/titiler/core/resources/responses.py | obaid585/rastertile | 288 | 12728924 | <gh_stars>100-1000
"""Common response models."""
from typing import Any
import simplejson as json
from starlette import responses
class XMLResponse(responses.Response):
"""XML Response"""
media_type = "application/xml"
class JSONResponse(responses.JSONResponse):
"""Custom JSON Response."""
def ... |
python/mxnet/_ffi/function.py | mchoi8739/incubator-mxnet | 211 | 12728934 | # 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... |
tests/pytests/functional/states/test_npm.py | markgras/salt | 9,425 | 12728956 | <gh_stars>1000+
import pytest
from salt.exceptions import CommandExecutionError
@pytest.fixture(scope="module", autouse=True)
def install_npm(sminion):
try:
sminion.functions.state.single("pkg.installed", name="npm")
# Just name the thing we're looking for
sminion.functions.npm # pylint: ... |
src/openvr/color_cube_actor.py | risa2000/pyopenvr | 204 | 12728971 | #!/bin/env python
# file color_cube_actor.py
from textwrap import dedent
from OpenGL.GL import * # @UnusedWildImport # this comment squelches an IDE warning
from OpenGL.GL.shaders import compileShader, compileProgram
from openvr.glframework import shader_string
"""
Color cube for use in "hello world" openvr apps
... |
scripts/tacotron_save_spec.py | gioannides/OpenSeq2Seq | 1,459 | 12728989 | %matplotlib inline
# Replace the first box of Interactive_Infer_example.ipynb with this
import IPython
import librosa
import numpy as np
import scipy.io.wavfile as wave
import tensorflow as tf
import matplotlib.pyplot as plt
from open_seq2seq.utils.utils import deco_print, get_base_config, check_logdir,\
... |
sdk/cwl/tests/test_util.py | rpatil524/arvados | 222 | 12729006 | <reponame>rpatil524/arvados
# Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
from builtins import bytes
import unittest
import mock
import datetime
import httplib2
from arvados_cwl.util import *
from arvados.errors import ApiError
class MockDateTime(datetime.datetime... |
atomic_reactor/plugins/fetch_maven_artifacts.py | qixiang/atomic-reactor | 113 | 12729008 | <filename>atomic_reactor/plugins/fetch_maven_artifacts.py
"""
Copyright (c) 2017-2022 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import dataclasses
import functools
import hashlib
import os
from pathlib impor... |
models/res_users.py | wdw139130/wechat-mall | 108 | 12729102 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class ResUsers(models.Model):
_inherit = 'res.users'
sub_domain = fields.Char('子域名', help='用于小程序接口的子域名。', index=True)
@api.model
def create(self, vals):
from uuid import uuid1
vals['sub_domain'] = uuid1(... |
test.py | wu546300070/weiboanalysis | 685 | 12729133 | <gh_stars>100-1000
import re
word="jofwjoifA级哦啊接我金佛安fewfae慰剂serge"
p = re.compile(r'\w', re.L)
result = p.sub("", word)
print(result) |
easytransfer/layers/encoder_decoder.py | johnson7788/EasyTransfer | 806 | 12729136 | <reponame>johnson7788/EasyTransfer
# coding=utf-8
# Copyright (c) 2019 Alibaba PAI team.
#
# 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
#
#... |
runtime/base.py | cheery/lever | 136 | 12729159 | <reponame>cheery/lever<gh_stars>100-1000
from async_io import Event, Queue
from evaluator.loader import from_object
from evaluator.sourcemaps import TraceEntry
from rpython.rlib.objectmodel import specialize, always_inline
from rpython.rlib.rstring import UnicodeBuilder
from rpython.rtyper.lltypesystem import rffi
from... |
advisor_server/suggestion/algorithm/base_hyperopt_algorithm_test.py | silvery107/advisor | 1,498 | 12729163 | from django.test import TestCase
from suggestion.algorithm.abstract_algorithm import AbstractSuggestionAlgorithm
from suggestion.algorithm.base_hyperopt_algorithm import BaseHyperoptAlgorithm
class BaseHyperoptAlgorithmTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_init(self)... |
vkwave/bots/core/dispatching/extensions/callback/__init__.py | krasnovmv/vkwave | 222 | 12729230 | <filename>vkwave/bots/core/dispatching/extensions/callback/__init__.py
from ._aiohttp import AIOHTTPCallbackExtension
|
source/lib/probe.py | WinterWinds-Robotics/pymmw | 144 | 12729240 | <filename>source/lib/probe.py
#
# Copyright (c) 2019, <NAME>
# This file is licensed under the terms of the MIT license.
#
#
# xds110 support
#
import sys
import time
import array
from lib.ports import *
from lib.utility import *
from lib.shell import *
# ------------------------------------------
XDS_USB = (0x04... |
pytest/functional/hs_file_types/test_model_instance_aggregation.py | hydroshare/hydroshare | 178 | 12729245 | import os
import pytest
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from hs_core.hydroshare import add_file_to_resource, ResourceFile, add_resource_files
from hs_core.views.utils import move_or_rename_file_or_folder
from hs_file_types.forms import ModelIn... |
tests/data/expected/parser/openapi/openapi_parser_parse_duplicate_models/output.py | stevesimmons/datamodel-code-generator | 891 | 12729266 | from __future__ import annotations
from typing import List, Optional
from pydantic import BaseModel
class Pet(BaseModel):
id: int
name: str
tag: Optional[str] = None
class Pets(BaseModel):
__root__: List[Pet]
class Error(BaseModel):
code: int
message: str
class Event(BaseModel):
na... |
bcs-ui/backend/container_service/projects/constants.py | laodiu/bk-bcs | 599 | 12729326 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
pretrain/modules/resnet_vlbert_for_attention_vis.py | xiling42/VL-BERT | 671 | 12729339 | <reponame>xiling42/VL-BERT<gh_stars>100-1000
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from external.pytorch_pretrained_bert import BertTokenizer
from common.module import Module
from common.fast_rcnn import FastRCNN
from common.visual_linguistic_bert import VisualLinguisticBert
from ... |
sqlite3__examples/append_image/main.py | DazEB2/SimplePyScripts | 117 | 12729340 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
import sqlite3
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
if __name__ == '__main__':
con = sqlite3.connect('test.sqlite')
cur = con.cursor()
cur.execute('''
CREATE TABLE IF NOT EXISTS I... |
src/pipelinex/extras/ops/ignite/metrics/utils.py | MarchRaBBiT/pipelinex | 188 | 12729409 | <gh_stars>100-1000
import torch
from ignite.utils import to_onehot
class ClassificationOutputTransform:
def __init__(self, num_classes=None):
self._num_classes = num_classes
def __call__(self, output):
if isinstance(output, tuple):
y_pred, y = output
elif isinstance(output... |
qiskit/providers/ibmq/random/cqcextractor.py | dowem/qiskit-ibmq-provider | 199 | 12729412 | # 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 directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
bottery/conf/global_settings.py | romulocollopy/bottery | 250 | 12729531 | TEMPLATES = []
PLATFORMS = {}
MIDDLEWARES = []
|
sfm/message_consumer/test_sfm_ui_consumer.py | Xtuden-com/sfm-ui | 129 | 12729556 | <gh_stars>100-1000
from django.test import TestCase
from ui.models import Harvest, Collection, Group, CollectionSet, Credential, User, Seed, Warc, Export, HarvestStat
import json
from .sfm_ui_consumer import SfmUiConsumer
import iso8601
from mock import patch
from datetime import date
class ConsumerTest(TestCase):
... |
Tests/Frequently_used_code/Polygon_drill_test.py | ScriptBox99/dea-notebooks | 282 | 12729567 | <filename>Tests/Frequently_used_code/Polygon_drill_test.py
import pytest
from pathlib import Path
from testbook import testbook
TEST_DIR = Path(__file__).parent.parent.resolve()
NB_DIR = TEST_DIR.parent
NB_PATH = NB_DIR / "Frequently_used_code" / "Polygon_drill.ipynb"
@pytest.fixture(scope="module")
def tb():
wi... |
slack_bolt/authorization/__init__.py | korymath/bolt-python | 160 | 12729613 | from .authorize_result import AuthorizeResult
|
B03898_10_codes/StockOption.py | prakharShuklaOfficial/Mastering-Python-for-Finance-source-codes | 446 | 12729683 | """
README
======
This file contains Python codes.
======
"""
""" Store common attributes of a stock option """
import math
class StockOption(object):
def __init__(self, S0, K, r, T, N, params):
self.S0 = S0
self.K = K
self.r = r
self.T = T
self.N = max(1, N) # Ensure N h... |
CondTools/Geometry/test/writehelpers/geometryExtended2021DD4hep_writer.py | Purva-Chaudhari/cmssw | 852 | 12729691 | <filename>CondTools/Geometry/test/writehelpers/geometryExtended2021DD4hep_writer.py
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep
process = cms.Process("GeometryWriter", Run3_dd4hep)
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
process.load('C... |
cellphonedb/tools/app.py | BioTuring-Notebooks/CellphoneDB | 278 | 12729742 | import os
from flask import Flask
this_file_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = '{}/data'.format(this_file_dir)
output_dir = '{}/out'.format(this_file_dir)
downloads_dir = '{}/downloads'.format(data_dir)
def create_app():
app = Flask(__name__)
return app
|
valve/vdf.py | Crowbar-Sledgehammer/python-valve | 136 | 12729743 | <reponame>Crowbar-Sledgehammer/python-valve
# -*- coding: utf-8 -*-
# Copyright (C) 2013 <NAME>
"""
Implements a parser for the Valve Data Format (VDF,) or as often
refered KeyValues.
Currently only provides parsing functionality without the ability
to serialise. API designed to mirror that of the bui... |
compiler_gym/envs/llvm/service/passes/common.py | mostafaelhoushi/CompilerGym | 562 | 12729779 | <filename>compiler_gym/envs/llvm/service/passes/common.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import NamedTuple, Optional
class Pass(NamedTuple):
"""The declarat... |
benchmark/tests/test_automatic_test.py | yuanliya/Adlik | 548 | 12729784 | # Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
The test of automatic test.
"""
import unittest
import subprocess
import os
class TestAutomaticTest(unittest.TestCase):
"""
The test of automatic test
"""
@staticmethod
def test_automatic_test():
... |
Search/hash_tables.py | anand722000/algo_ds_101 | 175 | 12729799 | #!/bin/python3
import math
import os
import random
import re
import sys
def flavors(m,a):
prices = {}
for idx, p in enumerate(a):
if m-p in prices:
return prices[m-p], idx
prices[p] = idx
return None
t = int(input().strip())
for a0 in range(t):
m = int(input().strip())
... |
test/integration/samples_in/simple_format.py | Inveracity/flynt | 487 | 12729843 | var = 5
a = "my string {:.2f}".format(var) |
alipay/aop/api/response/AlipayOpenMiniAmpeMobileappBatchqueryResponse.py | antopen/alipay-sdk-python-all | 213 | 12729845 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.MobileAppInfo import MobileAppInfo
class AlipayOpenMiniAmpeMobileappBatchqueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenMiniAmpeMobil... |
problems/tests/test_two_sum_ii_input_array_is_sorted.py | vinta/fuck-coding-interviews | 590 | 12729856 | # coding: utf-8
import unittest
from problems.two_sum_ii_input_array_is_sorted import Solution
class TestCase(unittest.TestCase):
def setUp(self):
self.solution = Solution()
def test(self):
test_data = [
{'numbers': [2, 7, 11, 15], 'target': 9, 'expected': [1, 2]},
{'... |
models/munit_model.py | NguyenHoangAn0511/gan-compression | 1,005 | 12729881 | <reponame>NguyenHoangAn0511/gan-compression
import argparse
import itertools
import ntpath
import os
import numpy as np
import torch
from torch import nn
from tqdm import tqdm
from data import create_eval_dataloader
from metric import create_metric_models, get_fid
from models import networks
from models.base_model im... |
scripts/remove-multilabel-pairs.py | brmson/dataset-factoid-webquestions | 161 | 12729883 | <gh_stars>100-1000
#!/usr/bin/env python3
import csv, sys
file_name = sys.argv[1]
pos = {}
with open(file_name) as f:
r = csv.reader(f, delimiter=',')
for s in r:
if (s[0] == 'qtext'):
continue
key = s[0] + ',' + s[2]
if (s[1] == '1'):
if (key in pos):
... |
alipay/aop/api/response/ZhimaCreditContractBorrowQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 12729904 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class ZhimaCreditContractBorrowQueryResponse(AlipayResponse):
def __init__(self):
super(ZhimaCreditContractBorrowQueryResponse, self).__init__()
self._status = None
... |
web/vultargetspider/management/commands/HackeroneSpider.py | laozhudetui/LSpider | 311 | 12729917 | <reponame>laozhudetui/LSpider<filename>web/vultargetspider/management/commands/HackeroneSpider.py
#!/usr/bin/env python
# encoding: utf-8
'''
@author: LoRexxar
@contact: <EMAIL>
@file: HackeroneSpider.py
@time: 2020/4/22 15:05
@desc:
'''
from django.core.management.base import BaseCommand
from web.vultargetspider.con... |
kmip/core/messages/payloads/delete_attribute.py | ondrap/PyKMIP | 179 | 12729938 | # Copyright (c) 2019 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... |
h2o-hadoop-common/tests/python/pyunit_gcs_import.py | kernelrich/h2o-3 | 6,098 | 12729987 | #! /usr/env/python
import sys
import os
sys.path.insert(1, os.path.join("../../../h2o-py"))
from tests import pyunit_utils
import h2o
def gcs_import():
# Just test the import works - no class clashes, no exception
keys = h2o.import_file(
"gs://gcp-public-data-nexrad-l2/2018/01/01/KABR/NWS_NEXRAD_NXL... |
koku/masu/util/hash.py | rubik-ai/koku | 157 | 12730014 | <filename>koku/masu/util/hash.py
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Hashing utility."""
import hashlib
from masu.exceptions import HasherError
class Hasher:
"""A utility class to create hashes."""
def __init__(self, hash_function, length=None, encoding="utf-8"):
... |
dialogue-engine/test/programytest/storage/stores/sql/dao/test_node.py | cotobadesign/cotoba-agent-oss | 104 | 12730018 | <reponame>cotobadesign/cotoba-agent-oss<gh_stars>100-1000
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitati... |
InvenTree/build/migrations/0030_alter_build_reference.py | carlos-riquelme/InvenTree | 656 | 12730024 | <reponame>carlos-riquelme/InvenTree<filename>InvenTree/build/migrations/0030_alter_build_reference.py
# Generated by Django 3.2.4 on 2021-07-08 14:14
import InvenTree.validators
import build.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('build',... |
test/hummingbot/connector/derivative/binance_perpetual/test_binance_perpetual_web_utils.py | pecuniafinance/hummingbot | 542 | 12730050 | <reponame>pecuniafinance/hummingbot
import asyncio
import unittest
from typing import Awaitable
import hummingbot.connector.derivative.binance_perpetual.binance_perpetual_web_utils as web_utils
import hummingbot.connector.derivative.binance_perpetual.constants as CONSTANTS
from hummingbot.connector.derivative.binance_... |
tests/pyccel/project_rel_imports/runtest.py | dina-fouad/pyccel | 206 | 12730065 | # pylint: disable=missing-function-docstring, missing-module-docstring/
from project.folder2.mod3 import one_hundred_plus_sum_to_n_squared
if __name__ == '__main__':
print(one_hundred_plus_sum_to_n_squared(4))
|
villager-bot/karen.py | Villager-Dev/Villager-Bot | 122 | 12730101 | from concurrent.futures import ProcessPoolExecutor
from collections import defaultdict
from classyjson import ClassyDict
import asyncio
import asyncpg
import psutil
import arrow
from util.ipc import Server, PacketType, PacketHandlerRegistry, handle_packet
from util.setup import load_secrets, load_data, setup_karen_log... |
src/jpeg4py/_py.py | ajkxyz/jpeg4py | 103 | 12730118 | <reponame>ajkxyz/jpeg4py<gh_stars>100-1000
"""
Copyright (c) 2014, Samsung Electronics Co.,Ltd.
All rights reserved.
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 co... |
tasks.py | imkevinxu/django-kevin | 250 | 12730126 | from invoke import task, run
from os.path import dirname, abspath
# Create scripted tasks to run in command-line here
# http://docs.pyinvoke.org/en/latest/
PROJECT_ROOT = '%s/{{ project_name }}' % dirname(abspath(__file__))
@task
def clean():
"""Clean up static, compiled, test, and log files"""
print("De... |
backend/storage/test/server_log_test.py | xuantan/viewfinder | 645 | 12730151 | <reponame>xuantan/viewfinder
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Server log tests.
"""
__author__ = '<EMAIL> (<NAME>)'
import logging
import os
import re
import sys
import tempfile
import time
from functools import partial
from tornado import options, testing
from viewfinder.backend.storage.obj... |
mgz/body/actions.py | Namek/aoc-mgz | 117 | 12730158 | """Actions."""
from construct import (Array, Byte, Const, CString, Flag, Float32l, If,
Int16ul, Int32sl, Int32ul, Padding, Peek, String,
Struct, this, Bytes, Embedded, IfThenElse)
from mgz.body.achievements import achievements
from mgz.enums import (DiplomacyStanceEnum, F... |
tests/system/test_state_manager.py | ajw0100/professional-services-data-validator | 167 | 12730219 | # Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
AutotestFramework/runfunc/ui_initial.py | yangjourney/sosotest | 422 | 12730227 | <gh_stars>100-1000
import logging
import logging.handlers
import socket,os,threading
from core.const.Do import Do
from core.const.GlobalConst import ExecStatus
from core.tools.DBTool import DBTool
from core.tools.TypeTool import TypeTool
from runfunc.initial import init_logging
from runfunc.ui_threadProcess import *
... |
rivalcfg/devices/rival3_wireless.py | Clueninja/rivalcfg | 604 | 12730234 | <gh_stars>100-1000
from .. import usbhid
profile = {
"name": "SteelSeries Rival 3 Wireless",
"models": [
{
"name": "SteelSeries Rival 3 Wireless (2.4 GHz mode)",
"vendor_id": 0x1038,
"product_id": 0x1830,
"endpoint": 3,
},
],
"settings": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.