max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
src/super_gradients/examples/cifar10_training_torch_objects/cifar10_training_torch_objects_example.py | Deci-AI/super-gradients | 308 | 1681610 | <gh_stars>100-1000
"""
Cifar10 training with SuperGradients training with the following initialized torch objects:
DataLoaders
Optimizers
Networks (nn.Module)
Schedulers
Loss functions
Main purpose is to demonstrate training in SG with minimal abstraction and maximal flexibility
"""
from super_g... | 0 | 0 | 0 | 0 | 0 | 0 |
pollbot/telegram/job.py | annihilatorrrr/ultimate-poll-bot | 112 | 1681613 | """Handle messages."""
from datetime import date, datetime, timedelta
from sqlalchemy import or_
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import ObjectDeletedError, StaleDataError
from sqlalchemy.orm.scoping import scoped_session
from telegram.error import BadRequest, RetryAfter, Unauthorized
from... | 16 | 7 | 0 | 0 | 23 | 0 |
challenges/NarfRPN/poller/for-release/machine.py | pingjuiliao/cb-multios | 473 | 1681641 | #!/usr/bin/env python
#
# Copyright (C) 2014 Narf Industries <<EMAIL>>
#
# 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,... | 0 | 1 | 0 | 0 | 1 | 0 |
transformations/auxiliary_negation_removal/transformation.py | raft001/NL-Augmenter | 583 | 1681645 | import spacy
from initialize import spacy_nlp
from interfaces.SentenceOperation import SentenceOperation
from interfaces.SentencePairOperation import SentencePairOperation
from tasks.TaskTypes import TaskType
"""
Auxiliary Negation Removal.
Remove auxiliary negations generating a sentence with oposite meaning.
""... | 10 | 3 | 6 | 0 | 19 | 0 |
tests/test_transform_cls.py | Exdenta/torchsat | 316 | 1681659 | <reponame>Exdenta/torchsat
from pathlib import Path
import math
import numpy as np
import pytest
import tifffile
import torch
from PIL import Image
from torchsat.transforms import transforms_cls
tiff_files = [
'./tests/fixtures/different-types/tiff_1channel_float.tif',
'./tests/fixtures/different-types/tiff_... | 0 | 0 | 0 | 0 | 0 | 0 |
king_phisher/templates.py | chachabooboo/king-phisher | 1,143 | 1681677 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/templates.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | 5 | 12 | 3 | 2 | 22 | 0 |
류호석배 알고리즘 코딩 테스트/제3회/4번-공정 컨설턴트 호석/solution.py | rhs0266/FastCampus | 407 | 1681691 | <gh_stars>100-1000
import heapq
n, x = map(int, input().split())
time = list(map(int, input().split()))
start = 1
end = n
while start <= end:
mid = (start + end) // 2
flag = True
heap = [0] * mid
for t in time:
now = heapq.heappop(heap)
if now + t > x:
flag = False
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/tket/conanfile.py | CQCL/tket | 104 | 1681738 | <filename>recipes/tket/conanfile.py
# Copyright 2019-2022 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 0 | 0 | 0 | 0 | 0 | 0 |
ballerinaByExample/vendor/pygments/pygments/lexers/d.py | ayeshLK/ballerina-release | 182 | 1681784 | # -*- coding: utf-8 -*-
"""
pygments.lexers.d
~~~~~~~~~~~~~~~~~
Lexers for D languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, words
from pygments.token import Text, Comment, Ke... | 0 | 0 | 14 | 0 | 14 | 0 |
python-sorting-algorithms/insertion-sort.py | vatsla1601/Hacktoberfest2020-1 | 266 | 1681824 | def insertion_sort(nums):
# Start on the second element as we assume the first element is sorted
for i in range(1, len(nums)):
item_to_insert = nums[i]
# And keep a reference of the index of the previous element
j = i - 1
# Move all items of the sorted segment forward if they are... | 0 | 0 | 0 | 0 | 0 | 0 |
Codes/gracekoo/52_n-queens-ii.py | liuxiaohui1221/algorithm | 256 | 1681835 | <filename>Codes/gracekoo/52_n-queens-ii.py
# -*- coding: utf-8 -*-
# @Time: 2020/2/24 19:35
# @Author: GraceKoo
# @File: 52_n-queens-ii.py
# @Desc:https://leetcode-cn.com/problems/n-queens-ii/
class Solution:
def totalNQueens(self, n: int) -> int:
# 判断当前位置是否可用,由当前列,主对角线,副对角线共同决定
def could_place(ro... | 0 | 0 | 0 | 0 | 0 | 0 |
A3CModel.py | xijunlee/ReinforcementLearning-AtariGame | 147 | 1681866 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def norm_col_init(weights, std: float=1.0) -> object:
x = torch.randn(weights.size())
x *= std / torch.sqrt((x**2).sum(1, keepdim=True))
return x
def weights_init(m):
classname = m.__class__.__name__
if classnam... | 1 | 2 | 0 | 0 | 3 | 0 |
tests/Unit/Evolution/Systems/GeneralizedHarmonic/BoundaryConditions/Outflow.py | nilsvu/spectre | 117 | 1681883 | <filename>tests/Unit/Evolution/Systems/GeneralizedHarmonic/BoundaryConditions/Outflow.py
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def characteristic_speeds(gamma_1, lapse, shift, unit_normal_one_form):
shift_dot_normal = np.dot(shift, unit_normal_one_form)
return... | 0 | 0 | 0 | 0 | 0 | 0 |
SettingComponents/Layouts/SettingsPage.py | Satanepigone/osr2mp4-app | 262 | 1681917 | from BaseComponents.Buttons import Button
from SettingComponents.Layouts.ScrollArea import ScrollArea
def get_arearect(settings) -> tuple[int, int, object, object]:
area_width = settings.default_width
area_height = settings.default_height
middle_x = settings.default_x + settings.default_width/2
middle_y = settin... | 0 | 1 | 0 | 6 | 7 | 0 |
options/options.py | Arka161/cnngeometric_pytorch | 262 | 1681924 | from __future__ import annotations
import argparse
from util.torch_util import str_to_bool
class ArgumentParser():
def __init__(self,mode: str='train'):
self.parser = argparse.ArgumentParser(description='CNNGeometric PyTorch implementation')
self.add_cnn_model_parameters()
if mode=... | 2 | 1 | 0 | 0 | 3 | 0 |
veros/cli/veros.py | AkasDutta/veros | 115 | 1681945 | <filename>veros/cli/veros.py
import click
@click.group("veros")
@click.version_option()
def cli():
"""Veros command-line tools"""
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
mmwave/dsp/utils.py | gimac/OpenRadar | 275 | 1681950 | <gh_stars>100-1000
# Copyright 2019 The OpenRadar 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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
weld-python/weld/error.py | AngleNet/weld | 2,912 | 1681980 | """
Defines errors thrown by this package.
"""
class WeldError(RuntimeError):
"""
An error raised by Weld.
All Weld compilation and runtime errors are converted to a `WeldError`.
"""
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
library/source1/vtx/v7/structs/__init__.py | anderlli0053/SourceIO | 199 | 1681989 | from .....shared.base import Base
from .....utils.byte_io_mdl import ByteIO | 0 | 0 | 0 | 0 | 0 | 0 |
climlab/radiation/absorbed_shorwave.py | nfeldl/climlab | 160 | 1682012 | from __future__ import division, print_function
from climlab.process.energy_budget import EnergyBudget
from climlab import constants as const
class SimpleAbsorbedShortwave(EnergyBudget):
'''A class for the shortwave radiation process in a one-layer EBM.
The basic assumption is that all the shortwave absorptio... | 1 | 0 | 0 | 1 | 2 | 0 |
tests/py/test_payments_for_open_source.py | kant/gratipay.com | 517 | 1682015 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.homepage import _charge
from gratipay.models.payment_for_open_source import PaymentForOpenSource
from gratipay.testing import Harness
from gratipay.testing.images import ORIGINAL,... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/marvin/marvin/testSetupSuccess.py | Codegass/cloudstack | 1,131 | 1682027 | <reponame>Codegass/cloudstack
# 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 (t... | 0 | 0 | 0 | 0 | 0 | 0 |
2009/pyqtris/pyqtris_src/lib/highscoresdialog.py | mikiec84/code-for-blog | 1,199 | 1682043 | from __future__ import annotations
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class HighscoresDialog(QDialog):
def __init__(self, scorelist, parent: object | None=None):
super(HighscoresDialog, self).__init__(parent)
self.setWindowTitle('High Scores')
frame = Q... | 1 | 0 | 0 | 0 | 1 | 0 |
old_py2/datafeeds/parsers/fms_api/tests/test_fms_api_match_tiebreaker.py | ofekashery/the-blue-alliance | 266 | 1682067 | <gh_stars>100-1000
import datetime
import unittest2
import json
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from datafeeds.datafeed_fms_api import DatafeedFMSAPI
from helpers.match_helper import MatchHelper
from helpers.match_manipulator import MatchManipulator
from models.event impo... | 0 | 0 | 0 | 0 | 0 | 0 |
app/src/thirdparty/telemetry/internal/backends/chrome/tab_list_backend.py | ta2edchimp/big-rig | 925 | 1682075 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.internal.backends.chrome_inspector import inspector_backend_list
from te... | 2 | 4 | 0 | 0 | 6 | 0 |
tests/misc/selection_tests.py | ErfanTagh/fiftyone | 1,130 | 1682117 | """
Unit tests for :class:`fiftyone.core.stages.SelectObjects` and
:class:`fiftyone.core.stages.ExcludeObjects`.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import random
import unittest
import fiftyone as fo
import fiftyone.core.dataset as fod
import fiftyone.zoo as foz
class... | 0 | 0 | 0 | 0 | 0 | 0 |
test/ext/mypy/incremental/stubs_14/user.py | bmacphee/sqlalchemy | 5,383 | 1682119 | <reponame>bmacphee/sqlalchemy
from typing import List
from typing import TYPE_CHECKING
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import relationship
from sqlalchemy.orm.decl_api impo... | 0 | 0 | 0 | 0 | 0 | 0 |
pastes/paste/__init__.py | ourobouros/scrapers | 174 | 1682152 | <reponame>ourobouros/scrapers
from .paste import Pastebin
from .paste import Pastie
# from .paste import Site
from .paste import Slexy
| 0 | 0 | 0 | 0 | 0 | 0 |
example/app/views.py | merutak/django-social-auth | 863 | 1682156 | <gh_stars>100-1000
from django.http import HttpResponseRedirect
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render_to_response, redirect
from django.contrib.messages.api import get... | 0 | 0 | 0 | 0 | 0 | 0 |
end_to_end_tests/__init__.py | oterrier/openapi-python-client | 172 | 1682169 | """ Generate a complete client and verify that it is correct """
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_visitors/test_ast/test_functions/test_implicit_primitive.py | cdhiraj40/wemake-python-styleguide | 1,931 | 1682176 | import pytest
from wemake_python_styleguide.violations.refactoring import (
ImplicitPrimitiveViolation,
)
from wemake_python_styleguide.visitors.ast.functions import (
UselessLambdaDefinitionVisitor,
)
@pytest.mark.parametrize('code', [
'lambda x: 0',
'lambda *x: []',
'lambda **x: ()',
'lambd... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoTauTag/HLTProducers/python/TauRegionalPixelSeedGenerator_cfi.py | ckamtsikis/cmssw | 852 | 1682187 | import FWCore.ParameterSet.Config as cms
tauRegionalPixelSeedGenerator = cms.EDProducer("SeedGeneratorFromRegionHitsEDProducer",
OrderedHitsFactoryPSet = cms.PSet(
ComponentName = cms.string('StandardHitPairGenerator'),
SeedingLayers = cms.InputTag('PixelLayerPairs')
),
SeedComparitorPSet =... | 0 | 0 | 0 | 0 | 0 | 0 |
software/glasgow/access/direct/multiplexer.py | whitequark/glasgow | 280 | 1682195 | <filename>software/glasgow/access/direct/multiplexer.py
import logging
from amaranth import *
from .. import AccessMultiplexer, AccessMultiplexerInterface
class _FIFOReadPort(Elaboratable):
"""
FIFO read port wrapper with control enable and data enable signals.
The enable signals are asserted at reset.
... | 0 | 0 | 0 | 0 | 0 | 0 |
ttach/functional.py | choco9966/ttach | 720 | 1682202 | from __future__ import annotations
import torch
import torch.nn.functional as F
def rot90(x, k: int=1) -> object:
"""rotate batch of images by 90 degrees k times"""
return torch.rot90(x, k, (2, 3))
def hflip(x) -> object:
"""flip batch of images horizontally"""
return x.flip(3)
def vflip(x) -> obj... | 10 | 21 | 0 | 0 | 31 | 0 |
akshare/stock/stock_dzjy.py | J-Z-Z/akshare | 721 | 1682215 | <reponame>J-Z-Z/akshare
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2022/1/5 15:31
Desc: 东方财富网-数据中心-大宗交易-市场统计
http://data.eastmoney.com/dzjy/dzjy_sctj.aspx
"""
import pandas as pd
import requests
from akshare.utils import demjson
def stock_dzjy_sctj() -> pd.DataFrame:
"""
东方财富网-数据中心-大宗交易-市场统计
... | 0 | 0 | 0 | 0 | 0 | 0 |
ptan/agent.py | ChengUVa/ptan | 492 | 1682246 | from __future__ import annotations
"""
Agent is something which converts states into actions and has state
"""
import copy
import numpy as np
import torch
import torch.nn.functional as F
from . import actions
class BaseAgent:
"""
Abstract Agent interface
"""
def initial_state(self) -> None:
"... | 8 | 6 | 0 | 0 | 14 | 0 |
py_feature/501_concat.py | weiziyoung/instacart | 290 | 1682257 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 10 04:11:27 2017
@author: konodera
nohup python -u 501_concat.py &
"""
import pandas as pd
import numpy as np
from tqdm import tqdm
import multiprocessing as mp
import gc
import utils
utils.start(__file__)
#======================================... | 1 | 6 | 0 | 0 | 7 | 0 |
kucoin/exceptions.py | deforation/python-kucoin | 291 | 1682264 | <gh_stars>100-1000
# coding=utf-8
import json
# System error codes
# Code Meaning
# 400001 Any of KC-API-KEY, KC-API-SIGN, KC-API-TIMESTAMP, KC-API-PASSPHRASE is missing in your request header
# 400002 KC-API-TIMESTAMP Invalid -- Time differs from server time by more than 5 seconds
# 400003 KC-API-KEY not exists
# 40... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/validate_atlas.py | deep2064/initialization-actions | 426 | 1682275 | <gh_stars>100-1000
import requests
import sys
username = sys.argv[1]
password = sys.argv[2]
query = 'John'
expected_entities_count = 3
if len(sys.argv) > 3:
query = sys.argv[3]
expected_entities_count = int(sys.argv[4])
status_response = requests.get('http://localhost:21000/api/atlas/admin/status')
status = ... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/response/AlipayInsSceneSellerActivityQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 1682293 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.InsSellerActivity import InsSellerActivity
class AlipayInsSceneSellerActivityQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayInsSceneSelle... | 0 | 1 | 0 | 1 | 2 | 0 |
desktop/core/ext-py/Django-1.11/tests/template_tests/syntax_tests/test_if.py | kokosing/hue | 5,079 | 1682299 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import TestObj, setup
class IfTagTests(SimpleTestCase):
@setup({'if-tag01': '{% if foo %}yes{% else %}no{% endif %}'})
def test_if_tag01(self):
output = self.engine.render_to_string('if-tag01', {'foo'... | 0 | 0 | 0 | 0 | 0 | 0 |
python_docs_theme/__init__.py | shaynjay/python-docs-theme | 574 | 1682338 | import os
def setup(app) -> dict[str,bool]:
current_dir = os.path.abspath(os.path.dirname(__file__))
app.add_html_theme(
'python_docs_theme', current_dir)
return {
'parallel_read_safe': True,
'parallel_write_safe': True,
}
| 0 | 1 | 0 | 0 | 1 | 0 |
hs_file_types/raster_meta_extract.py | hydroshare/hydroshare | 178 | 1682341 | <gh_stars>100-1000
"""
Module extracting metadata from raster file to complete part of the required HydroShare Raster
Science Metadata.
The expected metadata elements are defined in the HydroShare raster resource specification.
Reference code:
http://gis.stackexchange.com/questions/6669/converting-projected-geotiff-to-... | 0 | 0 | 0 | 0 | 0 | 0 |
code/sequential/util_out.py | YapengTian/cmu-thesis | 159 | 1682343 | <reponame>YapengTian/cmu-thesis<gh_stars>100-1000
import numpy
from util_f1 import *
from joblib import Parallel, delayed
N_JOBS = 6
def ctc_decode(log_prob):
# Decode log_prob (boundary probabilities, batch * frame * (2n+1)) to frame_pred (boolean event decisions, batch * frame * n)
nSeqs, nFrames, nLabels =... | 0 | 0 | 0 | 0 | 0 | 0 |
leaf/selling/order/settings.py | guiqiqi/leaf | 119 | 1682355 | <gh_stars>100-1000
"""订单相关设置"""
class Events:
"""事件相关设置"""
class Key:
"""导出键设置"""
OperationCode = "code" # 操作码
Time = "time" # 发生时间
Description = "description" # 描述
Extra = "extra" # 额外信息
class ExtraInformation:
"""额外信息描述键"""
CloseReason = "订单关... | 0 | 0 | 0 | 0 | 0 | 0 |
src/py/flwr/server/grpc_server/grpc_bridge.py | Chris-george-anil/flower | 895 | 1682372 | # Copyright 2020 Adap GmbH. 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 ag... | 3 | 8 | 5 | 2 | 18 | 0 |
invoices/api_views.py | jordanm88/Django-CRM | 1,334 | 1682374 | from __future__ import annotations
import pytz
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.db.models import Q
from invoices.models import Invoice
from invoices.tasks import (
send_email,
send_invoice_email,
send_invoice_email_cancel,
create_in... | 6 | 12 | 8 | 0 | 26 | 0 |
MITx-6.00.2x/pset4-modelling-temperatures/pset4_Problem1_curve_fitting.py | Sam-Gao-Xin/Courses- | 622 | 1682393 | # -*- coding: utf-8 -*-
"""
@author: salimt
"""
#Problem 1: Curve Fitting
#15/15 points (graded)
#Implement the generate_models function.
#
#x and y are two lists corresponding to the x-coordinates and y-coordinates of the data samples (or data points); for example, if you have N data points, x = [x1 , x2 , ...... | 0 | 1 | 0 | 0 | 1 | 0 |
get_video/www_trahun_tv.py | DazEB2/SimplePyScripts | 117 | 1682398 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations
__author__ = 'ipetrash'
import re
GET_VIDEO_URL_PATTERN = re.compile('video_url=(.+?)&')
def get_video_url(url) -> object | None:
import requests
rs = requests.get(url)
if not rs.ok:
return
match = GET_VID... | 0 | 1 | 0 | 0 | 1 | 0 |
__scraping__/finance.yahoo.com-quote-spy - requests/main.py | whitmans-max/python-examples | 140 | 1682402 |
# date: 2019.04.23
import requests
from bs4 import BeautifulSoup
import json
url = 'https://finance.yahoo.com/quote/SPY'
result = requests.get(url)
html = BeautifulSoup(result.content, 'html.parser')
script = html.find_all('script')[-3].text
data = script[112:-12]
print(data[:10], data[-5:])
json_data = json.loads(... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/shp_load_test/03_shp_to_pg_geopandas.py | porelli/gnaf-loader | 156 | 1682405 | <reponame>porelli/gnaf-loader
import argparse
import geopandas
import os
import sqlalchemy
# get test number
parser = argparse.ArgumentParser(description="Test load SHP > Postgres")
parser.add_argument("--test", help="the test number")
parser.add_argument("--path", help="path to the input SHP file")
args = parser.pars... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/aggregate/test_aggregate_cpu.py | SamuelCahyawijaya/fast-transformers | 1,171 | 1682421 | #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>
#
import unittest
import os
import time
import torch
from fast_transformers.aggregate import aggregate_cpu, broadcast_cpu
class TestAggregateCPU(unittest.TestCase):
def test_aggregate(self):... | 0 | 0 | 0 | 0 | 0 | 0 |
warm/module.py | adithyavis/pywarm | 194 | 1682447 | <filename>warm/module.py
# 08-27-2019;
"""
Custom modules to enhance the nn Sequential experience.
PyWarm's core concept is to use a functional interface to simplify network building.
However, if you still prefer the classical way of defining child modules in `__init__()`,
PyWarm provides some utilities to help organi... | 0 | 0 | 0 | 0 | 0 | 0 |
downstream/tinypersons/mmdet/models/backbones/ssd_vgg.py | bwconrad/solo-learn | 326 | 1682449 | from __future__ import annotations
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import VGG
from mmcv.runner import BaseModule, Sequential
from ..builder import BACKBONES
@BACKBONES.register_module()
class SSDVGG(VGG, BaseModule):
"""VGG Backbone network for si... | 10 | 3 | 1 | 3 | 17 | 0 |
tests/test_segments.py | francolq/iepy | 813 | 1682455 | <reponame>francolq/iepy
import unittest
from iepy.data.models import TextSegment, EntityOccurrence
from iepy.preprocess.segmenter import RawSegment, SyntacticSegmenterRunner
from .factories import IEDocFactory, EntityFactory, EntityOccurrenceFactory, TextSegmentFactory
from .manager_case import ManagerTestCase
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_probability/python/sts/components/autoregressive_moving_average.py | m5l14i11/probability | 3,670 | 1682477 | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 2 | 6 | 0 | 0 | 8 | 0 |
test/loopvectorize.py | KennethNielsen/llvmpy | 140 | 1682516 | <filename>test/loopvectorize.py<gh_stars>100-1000
from llvm.core import *
from llvm.passes import *
from llvm.ee import *
import llvm
from llvm.tests.support import TestCase
from os.path import dirname, join as join_path
import unittest
import re
class TestLoopVectorizer(TestCase):
def test_loop_vectorizer(self)... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/Exscript/emulators/IOSEmulatorTest.py | saveshodhan/exscript | 226 | 1682527 | <reponame>saveshodhan/exscript
from __future__ import absolute_import
import sys
import unittest
import re
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from .VirtualDeviceTest import VirtualDeviceTest
from Exscript.emulators import IOSEmulator
from Exscript.emulators.ios... | 0 | 0 | 0 | 0 | 0 | 0 |
im2mesh/onet/models/__init__.py | FooVizDevs/occupancy_networks | 801 | 1682529 | <reponame>FooVizDevs/occupancy_networks<filename>im2mesh/onet/models/__init__.py
import torch
import torch.nn as nn
from torch import distributions as dist
from im2mesh.onet.models import encoder_latent, decoder
# Encoder latent dictionary
encoder_latent_dict = {
'simple': encoder_latent.Encoder,
}
# Decoder dict... | 0 | 0 | 0 | 0 | 0 | 0 |
util/checkpoint.py | aiha-lab/lsq-lab | 129 | 1682549 | <filename>util/checkpoint.py
import logging
import os
import torch as t
logger = logging.getLogger()
def save_checkpoint(epoch, arch, model, extras=None, is_best=None, name=None, output_dir='.'):
"""Save a pyTorch training checkpoint
Args:
epoch: current epoch number
arch: name of the networ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/hachoir/parser/misc/mapsforge_map.py | 0x20Man/Watcher3 | 320 | 1682557 | <reponame>0x20Man/Watcher3<filename>lib/hachoir/parser/misc/mapsforge_map.py
"""
Mapsforge map file parser (for version 3 files).
Author: <NAME>
References:
- http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile
- http://mapsforge.org/
"""
from hachoir.parser import Parser
from hachoir.field import (Bi... | 0 | 0 | 0 | 0 | 0 | 0 |
bookmarks/migrations/0010_userprofile_bookmark_link_target.py | voidfun/linkding | 1,312 | 1682587 | <reponame>voidfun/linkding
# Generated by Django 3.2.6 on 2021-10-03 06:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0009_bookmark_web_archive_snapshot_url'),
]
operations = [
migrations.AddField(
model_na... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/harness.py | cwensley/ironpython2 | 1,078 | 1682634 | <gh_stars>1000+
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import sys
from iptest.runner import run_test_pkg
#List of all test packages to be run under I... | 0 | 0 | 0 | 0 | 0 | 0 |
xxhash/__init__.py | charmoniumQ/python-xxhash | 269 | 1682648 | from ._xxhash import (
xxh32,
xxh32_digest,
xxh32_intdigest,
xxh32_hexdigest,
xxh64,
xxh64_digest,
xxh64_intdigest,
xxh64_hexdigest,
xxh3_64,
xxh3_64_digest,
xxh3_64_intdigest,
xxh3_64_hexdigest,
xxh3_128,
xxh3_128_digest,
xxh3_128_intdigest,
xxh3_128_hexd... | 0 | 0 | 0 | 0 | 0 | 0 |
BPR/model.py | jingxiufenghua/rec-model | 1,323 | 1682653 | <gh_stars>1000+
"""
Created on Nov 13, 2020
Updated on Dec 20, 2020
model: BPR: Bayesian Personalized Ranking from Implicit Feedback
@author: <NAME>(<EMAIL>)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Embedding, Input
from tensorflow.keras.regularizers import l2... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/locations/tests/test_site_code.py | dimagilg/commcare-hq | 471 | 1682671 | from django.test import TestCase
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.locations.models import LocationType, make_location
class SiteCodeTest(TestCase):
domain: str = 'test-site-code'
@classmethod
def setUpClass(cls):
super(SiteCodeTest, cls).setUpClass()
... | 0 | 0 | 1 | 0 | 1 | 0 |
blender/hecl/sact/ANIM.py | linkmauve/hecl | 267 | 1682678 | '''
This file provides a means to encode animation key-channels
in an interleaved, sparse array for use by the runtime
'''
import re
import struct
import mathutils
# Regex RNA path matchers
scale_matcher = re.compile(r'pose.bones\["(\S+)"\].scale')
rotation_matcher = re.compile(r'pose.bones\["(\S+)"\].rotation')
loca... | 1 | 1 | 0 | 0 | 2 | 0 |
fastreid/data/samplers/imbalance_sampler.py | NTU-ROSE/fast-reid | 2,194 | 1682688 | <reponame>NTU-ROSE/fast-reid<filename>fastreid/data/samplers/imbalance_sampler.py
# encoding: utf-8
"""
@author: <NAME>
@contact: <EMAIL>
"""
# based on:
# https://github.com/ufoym/imbalanced-dataset-sampler/blob/master/torchsampler/imbalanced.py
import itertools
from typing import Optional, List, Callable
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
core/visualize/profiler.py | YutouTaro/TrianFlow | 226 | 1682691 | <reponame>YutouTaro/TrianFlow
import os
import time
import torch
import pdb
class Profiler(object):
def __init__(self, silent=False):
self.silent = silent
torch.cuda.synchronize()
self.start = time.time()
self.cache_time = self.start
def reset(self, silent=None):
if sil... | 0 | 0 | 0 | 0 | 0 | 0 |
BRATS/data/sampler.py | eanemo/KiU-Net-pytorch | 236 | 1682703 | from __future__ import annotations
import random
import torch
from torch.utils.data.sampler import Sampler
# Adapted from
# https://github.com/pytorch/pytorch/pull/3062/files
class RandomCycleIter(object):
def __init__(self, data):
self.data_list: list[object] = list(data)
self.length = len(self.d... | 6 | 9 | 0 | 2 | 17 | 0 |
dirscan/dirsearch/lib/controller/__init__.py | imfiver/Sec-Tools | 144 | 1682712 | <filename>dirscan/dirsearch/lib/controller/__init__.py
from .controller import * # noqa: F401
| 0 | 0 | 0 | 0 | 0 | 0 |
utilities/pal2png.py | spiffcode/hostile-takeover | 113 | 1682721 | <reponame>spiffcode/hostile-takeover
from PIL import Image
import sys
palfile = sys.argv[1]
pngfile = sys.argv[2]
f = open(palfile)
palbytes = f.read()
f.close()
img = Image.new('RGB', (20,256))
for i in xrange(256):
r = ord(palbytes[2 + i * 3 + 0])
g = ord(palbytes[2 + i * 3 + 1])
b = ord(palbytes[2 + ... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/es/exc_02_07.py | Jette16/spacy-course | 2,085 | 1682752 | <gh_stars>1000+
import spacy
nlp = spacy.load("es_core_news_sm")
doc = nlp("Por Berlín fluye el río Esprea.")
# Obtén todos los tokens y los part-of-speech tags
token_texts = [token.text for token in doc]
pos_tags = [token.pos_ for token in doc]
for index, pos in enumerate(pos_tags):
# Revisa si el token actual ... | 0 | 0 | 0 | 0 | 0 | 0 |
scattertext/diachronic/DiachronicVisualizer.py | shettyprithvi/scattertext | 1,823 | 1682754 | class DiachronicVisualizer(object):
@staticmethod
def visualize(display_df):
raise NotImplementedError() | 0 | 0 | 0 | 0 | 0 | 0 |
plaso/parsers/plist_plugins/spotlight.py | jonathan-greig/plaso | 1,253 | 1682756 | <reponame>jonathan-greig/plaso<gh_stars>1000+
# -*- coding: utf-8 -*-
"""Plist parser plugin for Spotlight searched terms plist files."""
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import plist_event
from plaso.containers import time_events
from plaso.lib import definitions... | 0 | 0 | 0 | 0 | 0 | 0 |
test/deploy/rackhd_package_install.py | arunrordell/RackHD | 451 | 1682775 | <gh_stars>100-1000
'''
Copyright 2016, EMC, Inc.
Author(s):
<NAME>
This script installs RackHD from BIntray packages onto blank Ubuntu 14 or 16 OS via Ansible installer.
If test bed is behind proxy wall, make sure to enter proxy URL in config/install_default.json
This script performs the following functions:
- lo... | 0 | 0 | 0 | 0 | 0 | 0 |
nipy/cli/diagnose.py | rkalahasty/nipy | 236 | 1682787 | <filename>nipy/cli/diagnose.py<gh_stars>100-1000
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
DESCRIP = 'Calculate and write results for diagnostic screen'
EPILOG = \
'''nipy_diagnose will generate a series of diagnostic images for a 4D
fMRI image vol... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test.py | aaaaronlin/TelloPy | 591 | 1682810 | from time import sleep
import tellopy
from tellopy._internal.utils import *
prev_flight_data = None
def handler(event, sender, data, **args):
global prev_flight_data
drone = sender
if event is drone.EVENT_CONNECTED:
print('connected')
drone.start_video()
drone.set_exposure(0)
... | 0 | 0 | 0 | 0 | 0 | 0 |
scale/job/configuration/configuration.py | kaydoh/scale | 121 | 1682886 | <reponame>kaydoh/scale<filename>scale/job/configuration/configuration.py
"""Defines the class that represents a job configuration"""
from __future__ import unicode_literals
from job.configuration.exceptions import InvalidJobConfiguration
from job.execution.configuration.volume import HOST_TYPE, VOLUME_TYPE, Volume
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
razdel/substring.py | averkij/razdel | 203 | 1682928 | <gh_stars>100-1000
from .record import Record
class Substring(Record):
__attributes__ = ['start', 'stop', 'text']
def __init__(self, start, stop, text):
self.start = start
self.stop = stop
self.text = text
def find_substrings(chunks, text):
offset = 0
for chunk in chunks:
... | 0 | 0 | 0 | 0 | 0 | 0 |
parsifal/reviews/migrations/0012_auto_20150708_1234.py | michelav/parsifal | 342 | 1682932 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('reviews', '0011_auto_20150623_1623'),
]
operations: list[object] = [
migrations.AlterModelOptions(
... | 0 | 0 | 2 | 0 | 2 | 0 |
src/_cffi_src/openssl/x509v3.py | jonathanslenders/cryptography | 4,492 | 1682983 | <gh_stars>1000+
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
INCLUDES = """
#include <openssl/x509v3.h>
/*
* This is part of a work-around for the difficulty cffi has in dealing wit... | 0 | 0 | 0 | 0 | 0 | 0 |
pypy/module/_io/interp_bytesio.py | nanjekyejoannah/pypy | 333 | 1683026 | from __future__ import annotations
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.typedef import (
TypeDef, generic_new_descr, GetSetProperty)
from pypy.interpreter.gateway import interp2app, unwrap_spec
from rpython.rlib.rStringIO import RStringIO
from rpython.rlib.rarithmetic impor... | 6 | 14 | 0 | 0 | 20 | 0 |
buildroot/support/testing/tests/boot/test_syslinux.py | superm1/operating-system | 349 | 1683031 | import infra.basetest
class TestSysLinuxBase(infra.basetest.BRTest):
x86_toolchain_config: str = """
BR2_x86_i686=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/downloads... | 0 | 0 | 4 | 0 | 4 | 0 |
tools/nntool/importer/common/handler_options.py | 00-01/gap_sdk | 118 | 1683042 | <filename>tools/nntool/importer/common/handler_options.py
# Copyright (C) 2021 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Lic... | 0 | 0 | 0 | 0 | 0 | 0 |
flaskshop/dashboard/views/site.py | maquinuz/flask-shop | 141 | 1683062 | <reponame>maquinuz/flask-shop
from flask import render_template, redirect, url_for, request, flash
from flaskshop.public.models import MenuItem, Page
from flaskshop.dashboard.models import DashboardMenu, Setting
from flaskshop.product.models import Category, Collection
from flaskshop.checkout.models import ShippingMet... | 0 | 0 | 0 | 0 | 0 | 0 |
daanet/base.py | parksunwoo/daanet | 145 | 1683079 | <gh_stars>100-1000
import json
import os
import tensorflow as tf
from base import base_model
from gpu_env import ModeKeys
from model_utils.helper import LossCounter, get_filename
from utils.eval_4.eval import compute_bleu_rouge
from utils.helper import build_model
# model controller
class RCBase(base_model.BaseMode... | 0 | 0 | 0 | 0 | 0 | 0 |
tasks/package.py | lattwood/datadog-agent | 1,611 | 1683097 | import glob
import os
from invoke import task
from invoke.exceptions import Exit
from .libs.common.color import color_message
def get_package_path(glob_pattern) -> object:
package_paths = glob.glob(glob_pattern)
if len(package_paths) > 1:
raise Exit(code=1, message=color_message(f"Too many files mat... | 0 | 1 | 0 | 0 | 1 | 0 |
train.py | xiuyangleiasp/LSTR | 540 | 1683098 | #!/usr/bin/env python
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import json
import torch
import numpy as np
import queue
import pprint
import random
import argparse
import importlib
import threading
import traceback
from tqdm import tqdm
from utils import stdout_... | 2 | 3 | 0 | 0 | 5 | 0 |
toolset/databases/postgres/postgres.py | xsoheilalizadeh/FrameworkBenchmarks | 5,300 | 1683101 | import json
import psycopg2
import traceback
from colorama import Fore
from toolset.utils.output_helper import log
from toolset.databases.abstract_database import AbstractDatabase
class Database(AbstractDatabase):
@classmethod
def get_connection(cls, config) -> object:
db = psycopg2.connect(
... | 0 | 8 | 0 | 0 | 8 | 0 |
examples/gwtcanvas/GWTCanvasDemo.py | takipsizad/pyjs | 739 | 1683116 | """
* Copyright 2008 Google Inc.
* Copyright (C) 2009 <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 app... | 0 | 1 | 0 | 0 | 1 | 0 |
export.py | jcrussell/smda | 142 | 1683119 | import json
import logging
import os
from smda.Disassembler import Disassembler
def detectBackend() -> tuple[object, object]:
backend = ""
version = ""
try:
import idaapi
import idautils
backend = "IDA"
version = idaapi.IDA_SDK_VERSION
except:
pass
return (... | 0 | 1 | 0 | 0 | 1 | 0 |
Assignments/assignment5/BobOfRivia/highway.py | stxxllbu/CS224n-winter-together | 468 | 1683132 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2019-20: Homework 5
"""
import torch
import torch.nn as nn
class Highway(nn.Module):
# Remember to delete the above 'pass' after your implementation
### YOUR CODE HERE for part 1f
def __init__(self,D_emb):
super(Highway... | 0 | 0 | 0 | 0 | 0 | 0 |
Code/GraphMol/MolEnumerator/Wrap/rough_test.py | kazuyaujihara/rdkit | 1,609 | 1683136 | <gh_stars>1000+
#
# Copyright (C) 2020 <NAME> and T5 Informatics GmbH
# All Rights Reserved
#
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
from rdkit import RDConfi... | 0 | 0 | 0 | 0 | 0 | 0 |
jfrog_platform/datadog_checks/jfrog_platform/check.py | OpeOnikute/integrations-extras | 158 | 1683150 | from __future__ import annotations
from datadog_checks.base import ConfigurationError, OpenMetricsBaseCheck
class JfrogPlatformCheck(OpenMetricsBaseCheck):
"""
Collect metrics from JFrog
"""
def __init__(self, name, init_config, instances: object | None=None):
instance = instances[0]
... | 1 | 0 | 0 | 0 | 1 | 0 |
airflow/providers/amazon/aws/transfers/local_to_s3.py | holly-evans/airflow | 8,092 | 1683161 | #
# 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... | 10 | 0 | 1 | 0 | 11 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/plugin/models/account.py | disrupted/Trakttv.bundle | 1,346 | 1683172 | <reponame>disrupted/Trakttv.bundle<gh_stars>1000+
from plugin.models.core import db
from datetime import datetime, timedelta
from exception_wrappers.libraries.playhouse.apsw_ext import *
import logging
import requests
REFRESH_INTERVAL = timedelta(days=1)
log = logging.getLogger(__name__)
class Account(Model):
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/curt/curt/modules/vision/oakd_object_detection.py | sanyaade-teachings/cep | 108 | 1683177 | from __future__ import annotations
"""
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
from curt.modules.vision.oakd_processing import OAKDProcessingWorker
import depthai as dai
from curt.modules.vision.utils import *
from curt.modules.vision.utils import decode_imag... | 0 | 3 | 0 | 1 | 4 | 0 |
webpy/sample/googlemodules/src/app/helpers/tag_cloud.py | minixalpha/SourceLearning | 118 | 1683193 | # Author: <NAME>
import random, re, sets
stop_words = ['for', 'and', 'any', 'or', 'in', 'of', 'to']
def make_cloud(tags, min_tag_length: int=0, min_count: int=0, max_count: int=0,
plurial: bool=True, normalize: bool=False, randomize: bool=False, alpha: bool=True) -> object:
"""Assumes tags come as an itera... | 7 | 3 | 0 | 0 | 10 | 0 |
tools/Polygraphy/tests/tools/test_script.py | leo0519/TensorRT | 5,249 | 1683198 | <filename>tools/Polygraphy/tests/tools/test_script.py
#
# Copyright (c) 2021, NVIDIA 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 obtain a copy of the License at
#
# http://www.apach... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.