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 |
|---|---|---|---|---|---|---|---|---|---|---|
parsl/tests/configs/local_threads_checkpoint_task_exit.py | cylondata/parsl | 323 | 3294483 | <filename>parsl/tests/configs/local_threads_checkpoint_task_exit.py
from parsl.config import Config
from parsl.executors.threads import ThreadPoolExecutor
config = Config(
executors=[
ThreadPoolExecutor(
label='local_threads_checkpoint_task_exit',
)
],
checkpoint_mode='task_exit... | 0 | 0 | 0 | 0 | 0 | 0 |
pyyoutube/models/video.py | w3Abhishek/python-youtube | 156 | 3294486 | from __future__ import annotations
"""
These are video related models.
"""
from dataclasses import dataclass, field
from typing import Optional, List
import isodate
from isodate import ISO8601Error
from pyyoutube.error import ErrorCode, ErrorMessage, PyYouTubeException
from .base import BaseModel
from .common imp... | 0 | 1 | 113 | 0 | 114 | 0 |
mhp_extension/detectron2/projects/DensePose/densepose/data/dataset_mapper.py | Veronica1997/Human-segmantation | 707 | 3294491 | <reponame>Veronica1997/Human-segmantation
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import torch
from fvcore.common.file_io import PathManager
from detectron2.data import MetadataCatalog
from detectron2.data import detection_utils as utils
from detectro... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/wordlist_gen.py | Lola224/hakkuframework | 250 | 3294516 | # Copyright (C) 2015 – 2021 <NAME> (4shadoww)
from __future__ import annotations
from core.hakkuframework import *
from core import colors
import threading, queue
import itertools
from os.path import relpath
from core import getpath
conf = {
"name": "wordlist_gen", # Module's name (should be same as file name)
... | 0 | 3 | 5 | 1 | 9 | 0 |
mailchimp3/entities/landingpageaction.py | michaelwalkerfl/python-mailchimp | 311 | 3294521 | # coding=utf-8
"""
The Landinge Page actions API endpoint
Documentation: https://mailchimp.com/developer/reference/landing-pages/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class LandingPageAction(BaseApi):
"""
Manage your Landing Pages, including publishing and unpub... | 0 | 2 | 0 | 2 | 4 | 0 |
library/goldsrc/mdl_v4/structs/model.py | anderlli0053/SourceIO | 199 | 3294527 | <reponame>anderlli0053/SourceIO
from typing import List
import numpy as np
from .mesh import StudioMesh
from .....library.utils.byte_io_mdl import ByteIO
class StudioModel:
vertex_dtype = np.dtype([
('id', np.uint32, (1,)),
('pos', np.float32, (3,)),
])
def __init__(self):
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
Codes/Liam/561_array_partition_I.py | liuxiaohui1221/algorithm | 256 | 3294530 | # 执行用时 : 432 ms
# 内存消耗 : 15.7 MB
# 方案:排序后 相邻两个最小的就是奇数
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
sum = 0
for i in range(0, len(nums), 2):
sum += nums[i]
return s... | 1 | 1 | 0 | 0 | 2 | 0 |
examples/advanced/boids.py | minuJeong/moderngl-window | 142 | 3294533 | from pathlib import Path
import random
import numpy
from pyrr import matrix44
import moderngl
import moderngl_window
from moderngl_window.opengl.vao import VAO
class Boids(moderngl_window.WindowConfig):
"""
An attempt to make something boid-list with GL3.3.
Not currently working as intended,... | 2 | 0 | 1 | 0 | 3 | 0 |
design/trackplan/trackplan.py | ParikhKadam/cycloid | 156 | 3294534 | # racetrack route planner
# based on apex cone locations and track widths, get a
from __future__ import annotations
import numpy as np
maxv = 10
laterala = 8
maxk = 1.5
bw_v = np.pi*2*0.7
bw_w = np.pi*2*1.5
# track is a set of points and radii (positive or negative if track goes CCW/CW
# around each point)
# so fir... | 0 | 5 | 0 | 0 | 5 | 0 |
sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_iot_hub_client_enums.py | rsdoherty/azure-sdk-for-python | 2,728 | 3294535 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 0 | 2 | 70 | 0 | 72 | 0 |
problems/euler/27/euler_math.py | vidyadeepa/the-coding-interview | 1,571 | 3294543 | <reponame>vidyadeepa/the-coding-interview<gh_stars>1000+
def primes_upto(n):
"""
Sieve of Drathostenes
"""
multiples = set()
yield 2
# Optimization: Add the even numbers
multiples.update(range(4, n, 2))
for p in range(3,n,2):
if p not in multiples:
# Found a prime!
... | 0 | 0 | 0 | 0 | 0 | 0 |
dev.py | oraluben/pyperformance | 255 | 3294549 | # A script for running pyperformance out of the repo in dev-mode.
from __future__ import annotations
import os.path
import sys
REPO_ROOT = os.path.dirname(os.path.abspath(__file__))
VENVS = os.path.join(REPO_ROOT, '.venvs')
def resolve_venv_root(kind: str='dev', venvsdir=VENVS) -> str:
import sysconfig
if ... | 4 | 2 | 0 | 0 | 6 | 0 |
clients/python/consume.py | villcore/jafka | 600 | 3294554 | #!/usr/bin/env python3
import jafka
consumer = jafka.Consumer('localhost',9092)
offsets = consumer.getoffsetsbefore('demo',0,-2,100)
print('offsets',offsets)
ms = consumer.fetch('demo',0,offsets[0],1024)
for offset,message in ms:
print(offset,message.decode('utf-8'))
| 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/integration/util.py | dimagilg/commcare-hq | 471 | 3294555 | from __future__ import annotations
import hashlib
from corehq.apps.integration.models import (
DialerSettings,
GaenOtpServerSettings,
HmacCalloutSettings,
)
def domain_uses_dialer(domain) -> bool | object:
try:
settings = DialerSettings.objects.get(domain=domain)
return settings.is_en... | 0 | 6 | 0 | 0 | 6 | 0 |
GUI/Basic-train/QtPandas/qtpandas/__init__.py | muyuuuu/PyQt-learn | 132 | 3294603 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from qtpandas.models.DataFrameModel import (DataFrameMod... | 0 | 0 | 0 | 0 | 0 | 0 |
Autohome/setting.py | wangzhenjjcn/SZZT_SPIDERS | 103 | 3294606 | #!/usr/bin/env python
# encoding: utf-8
# 伪装配置
headers = {
"Accept-Encoding":"gzip",
"Cache-Control": "max-age=0",
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36',
"Accept-Language": "zh-CN,zh;q=0.8,en;q=0.6,en-... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pytorch/name_entity_recognition/line_graph_construction.py | cminusQAQ/graph4nlp | 1,269 | 3294612 | <reponame>cminusQAQ/graph4nlp
import copy
import itertools
from collections import Counter
from graph4nlp.pytorch.data.data import GraphData
from graph4nlp.pytorch.modules.graph_construction.base import StaticGraphConstructionBase
class LineBasedGraphConstruction(StaticGraphConstructionBase):
"""
Line ba... | 0 | 0 | 0 | 0 | 0 | 0 |
osxphotos/photosdb/photosdb_utils.py | finestream/osxphotos | 656 | 3294617 | <reponame>finestream/osxphotos
""" utility functions used by PhotosDB """
import logging
import plistlib
from .._constants import (
_PHOTOS_5_MODEL_VERSION,
_PHOTOS_6_MODEL_VERSION,
_PHOTOS_7_MODEL_VERSION,
_TESTED_DB_VERSIONS,
)
from ..utils import _open_sql_file
def get_db_version(db_file):
""... | 0 | 0 | 0 | 0 | 0 | 0 |
config/custom_components/huesyncbox/config_flow.py | LRvdLinden/homeassistant-config | 288 | 3294648 | <filename>config/custom_components/huesyncbox/config_flow.py<gh_stars>100-1000
"""Config flow for Philips Hue Play HDMI Sync Box integration."""
import asyncio
import logging
import voluptuous as vol
from homeassistant import core, config_entries, exceptions
from homeassistant.core import callback
from .const import... | 0 | 0 | 0 | 0 | 0 | 0 |
moya/context/expression.py | moyaproject/moya | 129 | 3294665 | from __future__ import annotations
"""
Parse and evaluate Moya expressions
This module contains some quite shocking micro-optimizations to offset the extra work when compared to Python expressions.
The optimizations were guided by the mandel.xml benchmark which has improved by many orders of magnitude since the first... | 6 | 67 | 42 | 2 | 117 | 0 |
lib/python/treadmill/tests/api/scheduler_test.py | vrautela/treadmill | 133 | 3294677 | <reponame>vrautela/treadmill
"""Scheduler reports API tests.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import bz2
import unittest
import mock
import pandas as pd
from treadmill.api import scheduler # pyli... | 0 | 0 | 0 | 0 | 0 | 0 |
src/amuse/ic/_limepy/limepy.py | silviatoonen/amuse | 131 | 3294690 | <filename>src/amuse/ic/_limepy/limepy.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import numpy
import scipy
from scipy.interpolate import BPoly, interp1d, UnivariateSpline
from numpy import exp, sqrt, pi, sin, cos, log10
from scipy.special import gamma, gammainc, hyp1f1
from scipy.integrate import ode, simps, quad
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tfi/parse/html.py | ajbouh/tfi | 160 | 3294700 | from __future__ import annotations
import re
from bs4 import BeautifulSoup
from bs4.element import Comment
def visible_text_for(html) -> bool | object:
def visible(element) -> bool:
if element.parent.name in ['style', 'script', '[document]', 'head', 'title']:
return False
elif isinstanc... | 0 | 2 | 0 | 0 | 2 | 0 |
DQM/PixelLumi/python/PixelLumiDQM_cfi.py | Purva-Chaudhari/cmssw | 852 | 3294716 | import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
pixel_lumi_dqm = DQMEDAnalyzer('PixelLumiDQM',
pixelClusterLabel = cms.untracked.InputTag("siPixelClusters"),
includePixelClusterInfo = cms.untracked.bool... | 0 | 0 | 0 | 0 | 0 | 0 |
cctbx/omz/tardy_adaptor.py | dperl-sol/cctbx_project | 155 | 3294719 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
class potential_object(object):
def __init__(O, f_obs, xray_structure):
O.f_obs = f_obs
O.xray_structure = xray_structure
O.last_sites_moved = None
O.f = None
def e_pot(O, sites_moved):
if ( O.last_sites_move... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_voice.py | HabtamuDes/africastalking-python | 110 | 3294758 | <gh_stars>100-1000
"""
Voice
call(phoneNumber: String): Initiate a phone call
fetchQueuedCalls(phoneNumber: String): Get queued calls
uploadMediaFile(phoneNumber: String, url: String): Upload voice media file
ActionBuilder: Build voice xml when callback URL receives a POST from the voice API
say(text: String)
... | 0 | 0 | 0 | 0 | 0 | 0 |
nearpy/hashes/unibucket.py | samyoo78/NearPy | 624 | 3294771 | # -*- coding: utf-8 -*-
# Copyright (c) 2013 <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, modify, merg... | 1 | 2 | 0 | 1 | 4 | 0 |
hubconf.py | khy0809/WeightNet | 163 | 3294774 | from shufflenet_v2 import (
shufflenet_v2_x0_5,
shufflenet_v2_x1_0,
shufflenet_v2_x1_5,
shufflenet_v2_x2_0,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
indra/tests/test_pysb_assembler.py | johnbachman/belpy | 136 | 3294791 | <gh_stars>100-1000
import xml.etree.ElementTree as ET
from indra.assemblers.pysb import PysbAssembler
import indra.assemblers.pysb.assembler as pa
from indra.assemblers.pysb.assembler import Policy, Param
from indra.assemblers.pysb.preassembler import PysbPreassembler
from indra.assemblers.pysb.export import export_cm_... | 0 | 0 | 0 | 0 | 0 | 0 |
aliyun-python-sdk-unimkt/aliyunsdkunimkt/request/v20181212/ScanCodeNotificationRequest.py | jia-jerry/aliyun-openapi-python-sdk | 1,001 | 3294812 | <reponame>jia-jerry/aliyun-openapi-python-sdk
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
fedjax/models/shakespeare.py | dedsec-9/fedjax | 143 | 3294834 | <gh_stars>100-1000
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 0 | 0 | 0 | 0 | 0 | 0 |
hummingbot/logger/application_warning.py | BGTCapital/hummingbot | 3,027 | 3294880 | #!/usr/bin/env python
from typing import (
NamedTuple,
Tuple,
Optional
)
class ApplicationWarning(NamedTuple):
timestamp: float
logger_name: str
caller_info: Tuple[str, int, str, Optional[str]]
warning_msg: str
@property
def filename(self) -> str:
return self.caller_info[... | 0 | 4 | 4 | 0 | 8 | 0 |
tools/site_compare/scrapers/chrome/__init__.py | kjthegod/chromium | 2,151 | 3294889 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Selects the appropriate scraper for Chrome."""
def GetScraper(version):
"""Returns the scraper module for the given version.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gausskernel/dbmind/tools/predictor/python/certs.py | opengauss-mirror/openGauss-graph | 360 | 3294890 | <filename>src/gausskernel/dbmind/tools/predictor/python/certs.py
"""
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON A... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/utils.py | Misterion777/ConceptFlow | 107 | 3294896 | #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
def padding(sent, l) -> object:
return sent + ['_EOS'] + ['_PAD'] * (l-len(sent)-1)
def padding_triple_id(entity2id, triple, num, l) -> object:
newtriple = []
f... | 0 | 3 | 0 | 0 | 3 | 0 |
doc/examples/scripts/structure/ku_superimposition_pymol.py | danijoo/biotite | 208 | 3294910 | <filename>doc/examples/scripts/structure/ku_superimposition_pymol.py
import numpy as np
from matplotlib.colors import to_rgb
import biotite
import biotite.structure as struc
import ammolite
PNG_SIZE = (1000, 750)
# General configuration
ammolite.cmd.set("cartoon_oval_length", 0.8)
ammolite.cmd.set("depth_cue", 0)
#... | 0 | 0 | 0 | 0 | 0 | 0 |
env/lib/python3.7/site-packages/scipy/optimize/_trustregion_constr/tests/test_canonical_constraint.py | MarcoMancha/BreastCancerDetector | 366 | 3294937 | from __future__ import annotations
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_equal, assert_equal
from scipy.optimize._constraints import (NonlinearConstraint, Bounds,
PreparedConstraint)
from scipy.... | 0 | 4 | 0 | 0 | 4 | 0 |
chap05/plot_t3.py | maru-n/alife_book_src | 183 | 3294966 | <reponame>maru-n/alife_book_src
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
from t3 import T3
"""
t3.pyの出力をプロットします.
実行するにはmatplotlibが必要です.
インストール方法
$ pip install matplotlib
"""
fig = plt.figure()
ax = plt.axes(xlim=(0, 1), yli... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gluonts/model/lstnet/_network.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 3294977 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 33 | 8 | 0 | 0 | 41 | 0 |
sikuli-script/src/test/python/old/test-mouse.py | mgrundy/sikuli | 1,292 | 3294996 | <gh_stars>1000+
# Copyright 2010-2011, Sikuli.org
# Released under the MIT License.
from sikuli.Sikuli import *
mouseDown(Button.RIGHT)
mouseUp()
mouseMove(Location(0,0))
mouseDown(Button.LEFT)
mouseUp()
| 0 | 0 | 0 | 0 | 0 | 0 |
Typos/stage1_1.py | halcyondude/datasets | 283 | 3295002 | import lzma
import re
import sys
from tqdm import tqdm
typosre = re.compile(
r"((fix|correct)(|ed)\s+(|a\s+|the\s+)(typo|misprint)s?\s+.*(func|function|method|var|variable|cls|class|struct|identifier|attr|attribute|prop|property|name))|(^s/[^/]+/[^/]+)",
re.IGNORECASE)
typosblackre = re.compile(r"filename|fil... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/sample_code/linear_regression.py | bwcsswcx/docs | 288 | 3295008 | """Linear Regression Tutorial
This sample code is applicable to CPU, GPU and Ascend.
"""
import numpy as np
from mindspore import dataset as ds
from mindspore.common.initializer import Normal
from mindspore import nn, Model, context
from mindspore.train.callback import LossMonitor
context.set_context(mode=context.GRAP... | 4 | 2 | 0 | 0 | 6 | 0 |
visualizations/xkcd-roc-curve/main.py | PepSalehi/algorithms | 209 | 3295014 | <gh_stars>100-1000
import matplotlib.pyplot as plt
import numpy as np
csfont = {'fontname': 'Humor Sans'}
with plt.xkcd():
xs = np.linspace(0, 1, 50)
plt.plot(xs, xs**0.2)
plt.plot(xs, xs**0.5)
plt.plot(xs, xs**0.8)
plt.plot(xs, xs, 'r--')
plt.title('ROC Curve', **csfont)
plt.xlabel('False... | 0 | 0 | 0 | 0 | 0 | 0 |
xclim/testing/tests/test_bootstrapping.py | UCL/xclim | 169 | 3295018 | from typing import Callable
import numpy as np
import pytest
from xarray.core.dataarray import DataArray
from xclim.core.calendar import percentile_doy
from xclim.indices import (
cold_spell_duration_index,
days_over_precip_thresh,
fraction_over_precip_thresh,
tg10p,
tg90p,
tn10p,
tn90p,
... | 5 | 1 | 0 | 0 | 6 | 0 |
tools/accuracy_checker/accuracy_checker/postprocessor/normalize_recomendation.py | APrigarina/open_model_zoo | 1,031 | 3295037 | <reponame>APrigarina/open_model_zoo
"""
Copyright (c) 2018-2021 Intel Corporation
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... | 0 | 0 | 0 | 0 | 0 | 0 |
test/units/test_oci_db_version_facts.py | slmjy/oci-ansible-modules | 106 | 3295046 | # Copyright (c) 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
import logging... | 0 | 5 | 0 | 0 | 5 | 0 |
leetcode.com/python/889_Construct_Binary_Tree_from_Preorder_and_Postorder_Traversal.py | vansh-tiwari/coding-interview-gym | 713 | 3295058 | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left: None = None
self.right: None = None
# The first value of 'pre' and last value of 'post' is 'root'.
# Find the second value of 'pre' in 'post' as it is the left child of 'root'.
# Fro... | 0 | 1 | 0 | 2 | 3 | 0 |
pyscf/cc/test/test_eom_gccsd.py | QuESt-Calculator/pyscf | 501 | 3295069 | #!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | 0 | 1 | 0 | 0 | 1 | 0 |
modules/git_self_serve/files/repocron.py | isabella232/infrastructure-puppet | 121 | 3295079 | #!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
# 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... | 2 | 1 | 0 | 0 | 3 | 0 |
examples/strategy_demo.py | hadrianl/huobi | 177 | 3295095 | #!/usr/bin/python
# -*- coding:utf-8 -*-
"""
@author:Hadrianl
该demo主要用于展示一个简单的策略应该如何编写,其中核心部分是实现一个handler
"""
from huobitrade.handler import BaseHandler
from huobitrade.utils import logger
import pymongo as pmo
class DemoHandler(BaseHandler):
def __init__(self, symbol, _ktype: str='1min'):
self._type ... | 1 | 0 | 0 | 1 | 2 | 0 |
train/tasks/segmentation/decoders/aspp_residual.py | hamzaMahdi/bonnetal | 231 | 3295101 | # This file is covered by the LICENSE file in the root of this project.
from __future__ import annotations
from __future__ import print_function
import torch.nn as nn
import torch
from common.layers import *
class Decoder(nn.Module):
def __init__(self, input_size: list[int]=[224, 224, 3], OS: int=32, feature_depth... | 7 | 2 | 0 | 0 | 9 | 0 |
Src/StdLib/Lib/site-packages/win32/lib/mmsystem.py | cwensley/ironpython2 | 1,078 | 3295105 | # Generated by h2py from d:/msdev/include/mmsystem.h
MAXPNAMELEN = 32
MAXERRORLENGTH = 256
MAX_JOYSTICKOEMVXDNAME = 260
MM_MICROSOFT = 1
MM_MIDI_MAPPER = 1
MM_WAVE_MAPPER = 2
MM_SNDBLST_MIDIOUT = 3
MM_SNDBLST_MIDIIN = 4
MM_SNDBLST_SYNTH = 5
MM_SNDBLST_WAVEOUT = 6
MM_SNDBLST_WAVEIN = 7
MM_ADLIB = 9
MM_MPU401_MIDIOUT = 1... | 0 | 13 | 0 | 0 | 13 | 0 |
PythonLinearNonlinearControl/plotters/animator.py | Geonhee-LEE/PythonLinearNonlinearControl | 425 | 3295112 | from __future__ import annotations
import os
from logging import getLogger
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
logger = getLogger(__name__)
class Animator():
""" animation class
"""
def __init__(self,... | 2 | 2 | 0 | 4 | 8 | 0 |
lib/west_tools/westtools/dtypes.py | poharrison/westpa | 140 | 3295119 |
'''Numpy/HDF5 data types shared among several WESTPA tools'''
import numpy
# Pick up a few data types from the WEST core if possible
try:
from west.data_manager import n_iter_dtype, seg_id_dtype, weight_dtype
except ImportError:
n_iter_dtype = numpy.uint32
seg_id_dtype = numpy.int64
weight_dtype = nu... | 0 | 0 | 0 | 0 | 0 | 0 |
models/maskrcnn/bbox_post_processing.py | happywu/simpledet-1 | 3,195 | 3295142 | import mxnet as mx
import numpy as np
from operator_py.nms import py_nms_wrapper
def multiclass_nms(nms, cls_score, bbox_xyxy, min_det_score, max_det_per_image) -> object:
# remove background
cls_score = cls_score[:, 1:]
# TODO: the output shape of class_agnostic box is [n, 4], while class_aware box is [n... | 0 | 6 | 0 | 0 | 6 | 0 |
myvenv/lib/python3.5/site-packages/IPython/frontend.py | tuvapp/tuvappcom | 652 | 3295151 | """
Shim to maintain backwards compatibility with old frontend imports.
We have moved all contents of the old `frontend` subpackage into top-level
subpackages (`html`, `qt` and `terminal`), and flattened the notebook into
just `IPython.html`, formerly `IPython.frontend.html.notebook`.
This will let code that was maki... | 0 | 0 | 0 | 0 | 0 | 0 |
fsspec/implementations/tests/test_jupyter.py | drorspei/filesystem_spec | 306 | 3295157 | <filename>fsspec/implementations/tests/test_jupyter.py<gh_stars>100-1000
import os
import shlex
import subprocess
import time
import pytest
import fsspec
pytest.importorskip("notebook")
requests = pytest.importorskip("requests")
@pytest.fixture()
def jupyter(tmpdir):
tmpdir = str(tmpdir)
os.environ["JUPYT... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | jamesdarke/gwader | 309 | 3295160 | <reponame>jamesdarke/gwader
"""Configuration for the pytest test suite."""
import json
import os
import random
import subprocess
import sys
import time
from pathlib import Path
import pytest
import requests
from aria2p import API, Client, enable_logger
from . import CONFIGS_DIR, SESSIONS_DIR
@pytest.fixture(autou... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/underwater/maneuver1.py | TUBSAPISS2018/DroneSimLab | 122 | 3295168 | #!/usr/bin/env python
from std_msgs.msg import Float64MultiArray
import sys, os
import rospy
#import services
from std_srvs.srv import Empty
#if len(sys.argv) != 4:
# sys.exit("Usage: "+sys.argv[0]+" <thrusters_topic>")
thrusters_topic='/g500/thrusters_input'
pub = rospy.Publisher(thrusters_topic, Float64Multi... | 0 | 1 | 0 | 0 | 1 | 0 |
syhelpers/strings.py | larrycameron80/outis | 129 | 3295194 | <reponame>larrycameron80/outis
import re
import base64
import string
from Crypto.Random import random
def random_string(length=-1, charset=string.ascii_letters):
"""
Returns a random string of "length" characters.
If no length is specified, resulting string is in between 6 and 15 characters.
A charac... | 0 | 0 | 0 | 0 | 0 | 0 |
imageai/Prediction/Custom/__init__.py | Tufail114/ImageAi-Project-Software | 7,141 | 3295209 | <reponame>Tufail114/ImageAi-Project-Software
from ...Classification.Custom import ClassificationModelTrainer, CustomImageClassification
class ModelTraining(ClassificationModelTrainer):
"""
Deprecated!
Replaced with 'imageai.Classification.Custom.ClassificationModelTrainer'
"""
def __call__(sel... | 0 | 0 | 0 | 0 | 0 | 0 |
pyro/distributions/transforms/utils.py | patrickeganfoley/pyro | 4,959 | 3295218 | <gh_stars>1000+
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
def clamp_preserve_gradients(x, min, max):
# This helper function clamps gradients but still passes through the gradient in clamped regions
return x + (x.clamp(min, max) - x).detach()
| 0 | 0 | 0 | 0 | 0 | 0 |
image_test/configuration/linux/debian.py | zoran15/compute-image-tools | 186 | 3295231 | #!/usr/bin/env python3
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 0 | 6 | 0 | 0 | 6 | 0 |
trick_sims/ODE/SIM_ode_ball/RUN_test/input.py | gilbertguoze/trick | 647 | 3295236 | <gh_stars>100-1000
import trick
def main():
trick.sim_control_panel_set_enabled(True)
trick.real_time_enable()
trick.itimer_enable()
trick.exec_set_software_frame(0.05)
trick.exec_set_freeze_frame(0.05)
trick.exec_set_freeze_command(True)
trick.frame_log_set_max_samples(100)
trick.fr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/files/foo.py | cromulencellc/asn1tools | 198 | 3295266 | EXPECTED = {'Foo': {'extensibility-implied': False,
'imports': {},
'object-classes': {},
'object-sets': {},
'types': {'Answer': {'members': [{'name': 'id', 'type': 'INTEGER'},
{'name': 'answer',
'typ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/spline_as_lines.py | neonkingfr/TinySpline | 660 | 3295282 | from tinyspline import *
from tkinter import *
spline = BSpline(7)
ctrlp = spline.control_points
ctrlp[0] = 120 # x0
ctrlp[1] = 100 # y0
ctrlp[2] = 270 # x1
ctrlp[3] = 40 # y1
ctrlp[4] = 370 # x2
ctrlp[5] = 490 # y2
ctrlp[6] = 590 # x3
ctrlp[7] = 40 # y3
ctrlp[8] = 570 # x4
ctrlp[9] = 490 # y4
ctrlp[10] =... | 0 | 0 | 0 | 0 | 0 | 0 |
chart/tests/test_pre_spawner.py | thliang01/primehub | 294 | 3295283 | import unittest
from unittest import mock
import copy
from tornado import gen
from tornado import testing
from jupyterhub_profiles import PrimeHubSpawner, OIDCAuthenticator
import jupyterhub
def mock_spawner() -> object:
return PrimeHubSpawner(_mock=True)
class AuthStateBuilder(object):
def __init__(self)... | 0 | 18 | 0 | 3 | 21 | 0 |
python/dynamic/num_paths_nm_matrix.py | MacSimmy/algo-and-data-structure | 11,393 | 3295305 | <reponame>MacSimmy/algo-and-data-structure
"""
Problem Statement
=================
Count the number of Paths from 1,1 to N,M in an NxM matrix.
Analysis
--------
* Dynamic Programing Solution: O(rows * cols)
* Recursive: O(2^rows) if rows > cols else O(2^cols)
References
----------
* http://www.geeksforgeeks.org/co... | 0 | 0 | 0 | 0 | 0 | 0 |
python/dgl/nn/pytorch/explain/__init__.py | ketyi/dgl | 9,516 | 3295338 | """Torch modules for explanation models."""
# pylint: disable= no-member, arguments-differ, invalid-name
from .gnnexplainer import GNNExplainer
__all__ = ['GNNExplainer']
| 0 | 0 | 0 | 0 | 0 | 0 |
wa/framework/target/assistant.py | robF8/workload-automation | 159 | 3295344 | # Copyright 2018 ARM Limited
#
# 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... | 7 | 2 | 2 | 12 | 23 | 0 |
billiard/common.py | gopackgo90/billiard | 278 | 3295364 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
This module contains utilities added by billiard, to keep
"non-core" functionality out of ``.util``."""
from __future__ import absolute_import
import os
import signal
import sys
import pickle
from .exceptions import RestartFreqExceeded
from time import m... | 2 | 4 | 0 | 0 | 6 | 0 |
ALGORITHMS/Sorting/Bubble Sort/bubbleSort.py | anishsingh42/CodeChef | 127 | 3295394 | def bubbleSort(arr):
n = len(arr)
ctr = 0
for i in range(n-1):
for j in range(0, n-i-1):
if arr[j] > arr[j + 1] :
arr[j], arr[j + 1] = arr[j + 1], arr[j]
ctr += 1
print(ctr)
lst = [1, 2, 3, 5, 4]
bubbleSort(lst)
# since lists are mutable
# the main list ... | 0 | 0 | 0 | 0 | 0 | 0 |
dm_control/composer/variation/base.py | h8907283/dm_control | 2,863 | 3295422 | # Copyright 2018 The dm_control 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 or agreed to i... | 9 | 17 | 0 | 0 | 26 | 0 |
contlearn/gettrainer.py | csinva/intro_continual_learning | 288 | 3295433 | from __future__ import annotations
from copy import deepcopy
import torch
from torch import nn
from torch.nn import functional as F
from torch.autograd import Variable
from torch import optim
import torch.utils.data
def var2device(t: torch.Tensor, use_cuda: bool=True, **kwargs) -> object:
if torch.cuda.is_availa... | 9 | 4 | 0 | 0 | 13 | 0 |
qiskit/providers/ibmq/api/exceptions.py | yoshida-ryuhei/qiskit-ibmq-provider | 199 | 3295449 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# 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 derivat... | 2 | 0 | 0 | 0 | 2 | 0 |
proxybroker/__init__.py | askvrtsv/ProxyBroker | 3,157 | 3295450 | """
Copyright © 2015-2018 Constverum <<EMAIL>>. 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 la... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/tools/html_functions.py | thisisgopalmandal/opencv | 163 | 3295480 | <gh_stars>100-1000
from __future__ import print_function
import sys
import logging
import os
import re
from pprint import pprint
import traceback
try:
import bs4
from bs4 import BeautifulSoup
except ImportError:
raise ImportError('Error: '
'Install BeautifulSoup (bs4) for adding'
... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/py4j-0.9/src/py4j/java_collections.py | kokosing/hue | 5,079 | 3295481 | # -*- coding: UTF-8 -*-
from __future__ import annotations
"""
Module responsible for converting Java collection classes to Python collection
classes. This module is optional but loaded by default.
Created on Jan 22, 2010
:author: <NAME>
"""
from __future__ import unicode_literals, absolute_import
from collections ... | 3 | 47 | 0 | 1 | 51 | 0 |
test/tests/rackhd11/test_rackhd11_api_nodes.py | arunrordell/RackHD | 451 | 3295499 | <filename>test/tests/rackhd11/test_rackhd11_api_nodes.py
'''
Copyright 2016, EMC, Inc.
Author(s):
<NAME>
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
# Local methods
NODECATALOG = fit_common.node_select()
# Select test group here using @attr
from nose.plugins... | 0 | 0 | 0 | 0 | 0 | 0 |
mlcomp/migration/manage.py | sUeharaE4/mlcomp | 166 | 3295504 | import os
import migrate.versioning.api as api
from migrate.exceptions import DatabaseAlreadyControlledError
from mlcomp import SA_CONNECTION_STRING
def migrate(connection_string: str = None):
folder = os.path.dirname(__file__)
connection_string = connection_string or SA_CONNECTION_STRING
try:
a... | 1 | 0 | 0 | 0 | 1 | 0 |
examples/102-dedupe-pipeline.py | zewelor/argo-dataflow | 173 | 3295515 | <gh_stars>100-1000
from argo_dataflow import pipeline, kafka
if __name__ == '__main__':
(pipeline("102-dedupe")
.owner('argoproj-labs')
.describe("""This is an example of built-in de-duplication step.""")
.step(
(kafka('input-topic')
.dedupe()
.kafka('output-topic'))
)
... | 0 | 0 | 0 | 0 | 0 | 0 |
eggs/ZODB-4.1.0-py2.7.egg/ZODB/tests/testPersistentWeakref.py | salayhin/talkofacta | 514 | 3295536 | ##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | 0 | 1 | 0 | 0 | 1 | 0 |
function_scheduling_distributed_framework/publishers/local_python_queue_publisher.py | fakegit/distributed_framework | 333 | 3295561 | <filename>function_scheduling_distributed_framework/publishers/local_python_queue_publisher.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 13:07
from queue import Queue
from function_scheduling_distributed_framework.publishers.base_publisher import AbstractPublisher
local_pyh... | 0 | 0 | 0 | 0 | 0 | 0 |
bio_embeddings/extract/light_attention/__init__.py | kvetab/bio_embeddings | 219 | 3295563 | <reponame>kvetab/bio_embeddings
from bio_embeddings.extract.light_attention.light_attention_annotation_extractor import (
LightAttentionAnnotationExtractor,
)
from bio_embeddings.extract.light_attention.light_attention_model import LightAttention
__all__ = ["LightAttentionAnnotationExtractor", "LightAttention"]
| 0 | 0 | 0 | 0 | 0 | 0 |
geopandas/tools/tests/test_tools.py | raphacosta27/geopandas | 2,914 | 3295584 | <reponame>raphacosta27/geopandas<filename>geopandas/tools/tests/test_tools.py<gh_stars>1000+
from distutils.version import LooseVersion
from shapely.geometry import LineString, MultiPoint, Point
import pyproj
from pyproj import CRS
from geopandas import GeoSeries
from geopandas.tools import collect
from geopandas.too... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gamesbyexample/hexapawn.py | spp2/PythonStdioGames | 736 | 3295599 | """Hexapawn, by <NAME> <EMAIL>
A pawn-only chess variant where you must try to move one of your
pawns to the opposite end of the board. You also win if you block
your opponent from making a move. The original Hexapawn had a 3x3
board with six pawns, but this program lets you use boards of any
size. Based on Martin Gard... | 0 | 9 | 0 | 0 | 9 | 0 |
tests/test_cli/test_dev.py | RobertCraigie/prisma-client-py | 518 | 3295603 | <reponame>RobertCraigie/prisma-client-py<filename>tests/test_cli/test_dev.py
import re
import sys
import time
import signal
import threading
import subprocess
from typing import List
import pytest
from _pytest.monkeypatch import MonkeyPatch
from prisma.http import client
from prisma.utils import temp_env_update
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
coinbase/wallet/compat.py | SebastiaAgramunt/coinbase | 564 | 3295606 | <reponame>SebastiaAgramunt/coinbase
# coding: utf-8
import six
if six.PY2:
from itertools import imap
from urllib import quote
from urlparse import urljoin, urlsplit
from urlparse import urlparse
elif six.PY3:
imap = map
from urllib.parse import quote
from urllib.parse import urljoin, urlspl... | 0 | 0 | 0 | 0 | 0 | 0 |
caffe_code/script/test/test_model.py | shurans/sscnet | 324 | 3295608 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import caffe
import h5py
import numpy as np
from os.path import join
def test_model():
caffe.set_mode_gpu()
caffe.set_device(0)
root_path = '../../../'
########### testing on SUNCG use uncommoent the follo... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/library-tests/exprs/ast/exprs_test.py | vadi2/codeql | 4,036 | 3295642 |
1
(2,3)
[4, 5]
__debug__
x = 6
x
[7, 8].len()
[9, 10][11]
func(**arg)
| 0 | 0 | 0 | 0 | 0 | 0 |
apps/participants/migrations/0005_remove_participantteam_challenge.py | kaustubh-s1/EvalAI | 1,470 | 3295646 | <filename>apps/participants/migrations/0005_remove_participantteam_challenge.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-02 15:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("participants", "0004_add_crea... | 0 | 0 | 0 | 0 | 0 | 0 |
common/amundsen_common/log/auth_caller_retrieval.py | defendercrypt/amundsen | 2,072 | 3295663 | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import getpass
from flask import current_app as flask_app
from amundsen_common.log.caller_retrieval import BaseCallerRetriever
class AuthCallerRetrieval(BaseCallerRetriever):
def get_caller(self) -> str:
if flask_ap... | 0 | 1 | 0 | 0 | 1 | 0 |
Packs/GoogleChronicleBackstory/Scripts/ChronicleAssetEventsForMACWidgetScript/ChronicleAssetEventsForMACWidgetScript_test.py | diCagri/content | 799 | 3295667 | <filename>Packs/GoogleChronicleBackstory/Scripts/ChronicleAssetEventsForMACWidgetScript/ChronicleAssetEventsForMACWidgetScript_test.py
from unittest.mock import patch
import ChronicleAssetEventsForMACWidgetScript
def test_main_success(mocker):
"""
When main function is called, set_arguments_for_widget_vi... | 0 | 0 | 0 | 0 | 0 | 0 |
module/SpamMail.py | cyberlimit/DarkWEB | 199 | 3295674 | #!/usr/bin/python2
import sys, os
import smtplib as s
print "\n=========================================="
print " Spammer Khusus Gmail"
print "=========================================="
username = raw_input("Name GmailMu: ")
password = raw_input("<PASSWORD>: ")
obj = s.SMTP("smtp.gmail.com:587")
obj.starttls()
... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/chromite/cbuildbot/stages/afdo_stages_unittest.py | zipated/src | 2,151 | 3295682 | <gh_stars>1000+
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for updating Chrome ebuild stages."""
from __future__ import print_function
from chromite.cbuildbot import afdo
from chromi... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdet3d/models/middle_encoders/identity_middle_encoder.py | collector-m/SST | 217 | 3295685 | <filename>mmdet3d/models/middle_encoders/identity_middle_encoder.py<gh_stars>100-1000
import torch.nn as nn
from ..builder import MIDDLE_ENCODERS
@MIDDLE_ENCODERS.register_module()
class IdentityMiddleEncoder(nn.Module):
"""
Keep consistency with DynamicVoxelNet and for future usage.
"""
def __init__(... | 0 | 0 | 0 | 0 | 0 | 0 |
blackjax/optimizers/__init__.py | Gautam-Hegde/blackjax | 274 | 3295700 | from .dual_averaging import dual_averaging
__all__ = ["dual_averaging"]
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_2_csv.py | ivoupton/sheet2dict | 208 | 3295726 | def test_empty_object(worksheet):
ws = worksheet
sheet_items = ws.sheet_items
assert sheet_items == []
def test_parse_csv_header(worksheet):
ws = worksheet
path = "tests/inventory.csv"
csv_file = open(path, "r", encoding="utf-8-sig")
ws.csv_to_dict(csv_file=csv_file, delimiter=";")
ws_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_netmotion.py | ccDev-Labs/splunk-connect-for-syslog | 143 | 3295728 | <gh_stars>100-1000
# Copyright 2019 Splunk, Inc.
#
# Use of this source code is governed by a BSD-2-clause-style
# license that can be found in the LICENSE-BSD2 file or at
# https://opensource.org/licenses/BSD-2-Clause
from jinja2 import Environment
from .sendmessage import *
from .splunkutils import *
from .timeutil... | 0 | 0 | 0 | 0 | 0 | 0 |
dbcArchives/2021/000_6-sds-3-x-dl/057_DLbyABr_04b-Hands-On-MNIST-CNN.py | r-e-x-a-g-o-n/scalable-data-science | 138 | 3295731 | <filename>dbcArchives/2021/000_6-sds-3-x-dl/057_DLbyABr_04b-Hands-On-MNIST-CNN.py
# Databricks notebook source
# MAGIC %md
# MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html)
# MAGIC
# MAGIC This is a 2019-2021 augmentat... | 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.