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 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/makeinstancesufo_test.py | NetaP495L/afdko | 732 | 3355593 | import argparse
import os
import pytest
from shutil import rmtree, copytree
from afdko.makeinstancesufo import (
main as mkinstufo,
get_options,
_split_comma_sequence,
updateInstance,
)
from runner import main as runner
from differ import main as differ
from test_utils import get_input_path
TOOL = 'ma... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/hasjob1/hasjob.py | fakeNetflix/uber-repo-focuson | 260 | 3355611 | <gh_stars>100-1000
@app.route('/archive')
def sortarchive(blah):
current_order_by = request.args.get('order_by')
reverse = request.args.get('reverse')
order_by = {
'date': JobPost.datetime,
'headline': JobPost.headline,
'company': JobPost.company_name,
'location': JobPost.lo... | 0 | 0 | 0 | 0 | 0 | 0 |
finrl_meta/env_future_trading/wt4elegantrl/wtpy/monitor/WtBtMon.py | eitin-infant/FinRL-Meta | 214 | 3355613 | '''
Descripttion: 回测管理模块
version:
Author: Wesley
Date: 2021-08-11 14:03:33
LastEditors: Wesley
LastEditTime: 2021-09-02 14:18:50
'''
import os
import json
import subprocess
import platform
import sys
import psutil
import hashlib
import datetime
import shutil
import json
import threading
import time
from wtpy import W... | 99 | 28 | 0 | 9 | 136 | 0 |
pygrim/formulas/symbolic_expressions.py | mezzarobba/fungrim | 102 | 3355652 | <filename>pygrim/formulas/symbolic_expressions.py
# -*- coding: utf-8 -*-
from ..expr import *
def_Topic(
Title("Symbolic expressions"),
Section("Introduction"),
Description("""
Formulas in Fungrim are represented using symbolic expressions
that encode mathematical objects and operations in a semantic way... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/W2D4_DynamicNetworks/solutions/W2D4_Tutorial2_Solution_5d1fcb72.py | eduardojdiniz/CompNeuro | 2,294 | 3355655 |
"""
- Phase plane portraits allows us to visualize out of all possible states which
states a system can take. For example in this demo you see that the among all
possible pairs of values for r1 and r2, this system can take only a limited number
of states (those that lie on the black line).
- There are other things we... | 0 | 0 | 0 | 0 | 0 | 0 |
test/functional/test_account.py | fossabot/swift-1 | 1,802 | 3355660 | <filename>test/functional/test_account.py<gh_stars>1000+
#!/usr/bin/python
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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.ap... | 0 | 0 | 0 | 0 | 0 | 0 |
sendgrid/version.py | sendgrid/sendgrid-python | 1,268 | 3355662 | <reponame>sendgrid/sendgrid-python
__version__ = '6.8.3'
| 0 | 0 | 0 | 0 | 0 | 0 |
scrounger/modules/analysis/android/permissions.py | noraj/scrounger | 217 | 3355672 | from __future__ import annotations
from scrounger.core.module import BaseModule
# helper functions / modules
from scrounger.modules.misc.android.app.manifest import Module as ManifestModule
from scrounger.utils.config import Log
class Module(BaseModule):
meta: dict[str,int | str] = {
"author": "RDC",
... | 0 | 1 | 2 | 0 | 3 | 0 |
jactorch/functional/linalg.py | dapatil211/Jacinle | 114 | 3355689 | <gh_stars>100-1000
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : linalg.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 02/04/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
__all__ = ['normalize']
def normalize(tensor, p=2, dim=-1, eps=1e-8):
r"""
Normali... | 0 | 0 | 0 | 0 | 0 | 0 |
perf-tests/test_memory_memoization.py | pombredanne/Arpeggio | 127 | 3355716 | <gh_stars>100-1000
#-*- coding: utf-8 -*-
#######################################################################
# Purpose: Testing memory consumption with memoization enabled.
# Author: <NAME> <<EMAIL>>
# Copyright: (c) 2016 <NAME> <<EMAIL>>
# License: MIT License
#####################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
test/python/mymodule.py | markhend/seq | 625 | 3355717 | def multiply(a,b) -> object:
return a*b
def print_args(a,b,c,d,e) -> tuple[dict[str,float], tuple[int, float]]:
t = (a,b,c,d,e)
if t != ((4, 5), {'a': 3.14, 'b': 2.123}, True, {'ACGT'}, [['abc'], ['1.1', '2.2'], []]):
raise ValueError('TEST FAILED!')
return ({'a': 3.14, 'b': 2.123}, (222, 3.14)... | 1 | 4 | 0 | 0 | 5 | 0 |
data/transcoder_evaluation_gfg/python/NUMBER_OF_BINARY_TREES_FOR_GIVEN_PREORDER_SEQUENCE_LENGTH.py | mxl1n/CodeGen | 241 | 3355724 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold(n) -> object:
BT = [0] * (n + 1)
BT[0] = BT[1] = 1
for i in range(2, n + 1):
for j in range(i):
... | 0 | 1 | 0 | 0 | 1 | 0 |
benchmarks/operator_benchmark/pt/hardsigmoid_test.py | jsun94/nimble | 206 | 3355745 |
import operator_benchmark as op_bench
import torch
import torch.nn as nn
"""
Microbenchmarks for the hardsigmoid operator.
"""
# Configs for hardsigmoid ops
hardsigmoid_configs_short = op_bench.config_list(
attr_names=[
'N', 'C', 'H', 'W'
],
attrs=[
[1, 3, 256, 256],
[4, 3, 256,... | 0 | 1 | 0 | 0 | 1 | 0 |
DPGAnalysis/Skims/python/logErrorSkim_cff.py | ckamtsikis/cmssw | 852 | 3355767 | from FWCore.Modules.logErrorFilter_cfi import *
logerrorseq=cms.Sequence(logErrorSkimFilter)
logerrormonitorseq=cms.Sequence(logErrorFilter)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/openwisp2/sample_x509/admin.py | MiHiR151203/django-x509 | 410 | 3355817 | from django_x509 import admin # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
portfolio.py | mr-lanholmes/FinanceOps | 585 | 3355824 | ########################################################################
#
# Classes for optimizing and allocating portfolios of stocks.
#
# This version is for SINGLE-OBJECTIVE optimization. It has a lot of
# code in common with portfolio_multi.py but it is probably easier to
# read, understand and modify the code whe... | 4 | 9 | 0 | 0 | 13 | 0 |
src/genie/libs/parser/iosxe/show_avc.py | balmasea/genieparser | 204 | 3355864 | from __future__ import annotations
import re
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Any, Optional
# =====================================
# Schema for:
# * 'show avc sd-service info summary'
# =====================================
class ShowAvcSdServiceInfoSummarySche... | 1 | 1 | 2 | 0 | 4 | 0 |
tests/test_dashboard.py | hugocool/explainerdashboard | 1,178 | 3355868 | import unittest
from pathlib import Path
from sklearn.ensemble import RandomForestClassifier
from explainerdashboard import ClassifierExplainer, ExplainerDashboard
from explainerdashboard.datasets import titanic_survive, titanic_names
from explainerdashboard.custom import ShapDependenceComposite
class DashboardTest... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/interop/net/loadorder/t6.py | aisk/ironpython3 | 1,872 | 3355880 | # 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.
from iptest.assert_util import *
import clr
clr.AddReferenceToFileAndPath(testpath.rowan_root + r"\Test\Clr... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/363776_ExtendedIfElse/recipe-363776.py | tdiprima/code | 2,023 | 3355890 | def doLoginAction(self) -> None:
"""Try to actually log the user in."""
class PasswordAccepted(Exception): pass
try:
if check_password(): # This may raise KeyError.
raise PasswordAccepted
do_more_expensive_work()
and_even_more_expensive_work()
if check_othe... | 0 | 1 | 0 | 0 | 1 | 0 |
models/vision/detection/awsdet/models/mask_heads/__init__.py | kevinyang8/deep-learning-models | 129 | 3355893 | # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
from .mask_head import MaskHead
__all__ = ['MaskHead']
| 0 | 0 | 0 | 0 | 0 | 0 |
guillotina/interfaces/common.py | rboixaderg/guillotina | 173 | 3355897 | <filename>guillotina/interfaces/common.py
from zope.interface import Interface
class IMapping(Interface):
"""Simplest readable mapping object
"""
def __getitem__(key): # noqa: N805
"""Get a value for a key
A KeyError is raised if there is no value for the key.
"""
def get(k... | 0 | 0 | 0 | 0 | 0 | 0 |
scenes/python_effector.py | tdapper/cinema4d_py_sdk | 113 | 3355905 | # This is the Python code used in the Python Effector in python_effector.c4d
#############################################################
## CINEMA 4D SDK ##
#############################################################
## (c) 1989-2011 MAXON Computer GmbH, all rights reserved... | 0 | 1 | 0 | 0 | 1 | 0 |
35-dense-shallow-under-control/tf-35.py | cyyeh/exercises-in-programming-style | 1,821 | 3355909 | from keras.models import Sequential
from keras.layers import Dense
import numpy as np
import sys, os, string
characters = string.printable
char_indices = dict((c, i) for i, c in enumerate(characters))
indices_char = dict((i, c) for i, c in enumerate(characters))
INPUT_VOCAB_SIZE = len(characters)
def encode_one_hot(... | 0 | 4 | 0 | 0 | 4 | 0 |
pillow/join-in-rows-and-columns/main-wand.py | whitmans-max/python-examples | 140 | 3355910 | <reponame>whitmans-max/python-examples
#!/usr/bin/env python3
#!/usr/bin/env python3
# date: 2019.11.26
#
from wand.image import Image
img1 = Image(filename='square-1.png')
img2 = Image(filename='square-2.png')
img3 = Image(filename='square-3.png')
img4 = Image(filename='square-4.png')
w1, h1 = img1.size
w2, h2 ... | 0 | 0 | 0 | 0 | 0 | 0 |
telegram_bot_examples/pagination/example_as_images.py | gil9red/SimplePyScripts | 117 | 3355916 | <reponame>gil9red/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
# pip install python-telegram-bot
from telegram import Update, ParseMode, InputMediaPhoto
from telegram.ext import MessageHandler, CommandHandler, Filters, CallbackContext, CallbackQueryHandler
# pip... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_acl_queue.py | jccardonar/trigger | 380 | 3355932 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test the functionality of `~trigger.acl.queue` (aka task queue)
Only tests SQLite for now.
"""
import datetime
import os
import tempfile
from trigger.conf import settings
# Override the DB file we're going to use.
_, db_file = tempfile.mkstemp('.d... | 0 | 0 | 0 | 0 | 0 | 0 |
ansible/roles/lib_gcloud/build/lib/network.py | fahlmant/openshift-tools | 164 | 3355934 | # pylint: skip-file
# pylint: disable=too-many-instance-attributes
from __future__ import annotations
class Network(GCPResource):
'''Object to represent a gcp Network'''
resource_type: str = "compute.v1.network"
# pylint: disable=too-many-arguments
def __init__(self,
rname,
... | 0 | 3 | 1 | 0 | 4 | 0 |
examples/yin_yang.py | doc22940/gizeh | 435 | 3355941 | <filename>examples/yin_yang.py
"""
This generates a Yin Yang.
"""
import gizeh as gz
from math import pi
L = 200 # <- dimensions of the final picture
surface = gz.Surface(L, L, bg_color=(0 ,.3, .6)) # blue background
r = 70 # radius of the whole yin yang
yin_yang = gz.Group([
gz.arc(r, pi/2, 3*pi/2, fill = (1,1... | 0 | 0 | 0 | 0 | 0 | 0 |
server/photos/management/commands/import_flickr.py | paulu/opensurfaces | 137 | 3355978 | <reponame>paulu/opensurfaces
import os
from optparse import make_option
from clint.textui import progress
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from photos.models import PhotoSceneCategory, FlickrUser
from photos.add import add_photo
#from licenses.models imp... | 0 | 0 | 0 | 0 | 0 | 0 |
webvirtcloud/ldapbackend.py | Thr0TT1e/webvirtcloud | 1,246 | 3355997 | from __future__ import annotations
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.conf import settings
from accounts.models import UserAttributes, UserInstance, UserSSHKey
from django.contrib.auth.models import Permission
from logs.models import Logs
import... | 4 | 5 | 0 | 0 | 9 | 0 |
chromium/tools/telemetry/telemetry/wpr/archive_info_unittest.py | wedataintelligence/vivaldi-source | 925 | 3356002 | # Copyright 2012 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 __future__ import annotations
import json
import os
import shutil
import tempfile
import unittest
from catapult_base import cloud_storage
from telemetry... | 1 | 0 | 0 | 0 | 1 | 0 |
pyroma/pypidata.py | hugovk/pyroma | 126 | 3356003 | <gh_stars>100-1000
import tempfile
import os
import logging
import requests
import xmlrpc.client
from pyroma import distributiondata
def _get_project_data(project):
# I think I should be able to monkeypatch a mock-thingy here... I think.
response = requests.get(f"https://pypi.org/pypi/{project}/json")
if... | 0 | 0 | 0 | 0 | 0 | 0 |
colossalai/amp/amp_type.py | RichardoLuo/ColossalAI | 1,630 | 3356014 | <filename>colossalai/amp/amp_type.py<gh_stars>1000+
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from enum import Enum
class AMP_TYPE(Enum):
APEX = 'apex'
TORCH = 'torch'
NAIVE = 'naive'
| 0 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_apis/H2O_Module/pyunit_h2ocreate_frame.py | ahmedengu/h2o-3 | 6,098 | 3356020 | from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
import random
from h2o.utils.typechecks import assert_is_type
from h2o.frame import H2OFrame
def h2ocreate_frame():
"""
Python API test: h2o.create_frame(frame_id=None, rows=10000, cols=10,... | 0 | 0 | 0 | 0 | 0 | 0 |
metadata-ingestion/tests/unit/test_allow_deny.py | pramodbiligiri/datahub | 3,586 | 3356025 | from datahub.configuration.common import AllowDenyPattern
def test_allow_all() -> None:
pattern = AllowDenyPattern.allow_all()
assert pattern.allowed("foo.table")
def test_deny_all() -> None:
pattern = AllowDenyPattern(allow=[], deny=[".*"])
assert not pattern.allowed("foo.table")
def test_single_... | 0 | 4 | 0 | 0 | 4 | 0 |
Array/linear_regression.py | monocilindro/qgis-earthengine-examples | 646 | 3356040 | import ee
from ee_plugin import Map
# Simple regression of year versus NDVI.
# Define the start date and position to get images covering Montezuma Castle,
# Arizona, from 2000-2010.
start = '2000-01-01'
end = '2010-01-01'
lng = -111.83533
lat = 34.57499
region = ee.Geometry.Point(lng, lat)
# Filter to Landsat 7 im... | 0 | 1 | 0 | 0 | 1 | 0 |
tensorflow_federated/python/simulation/datasets/celeba.py | zhihansh/federated-oss | 1,918 | 3356059 | # Copyright 2021, The TensorFlow Federated 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... | 3 | 3 | 0 | 0 | 6 | 0 |
freeze/freezeScript.py | l33tlinuxh4x0r/pyzo | 235 | 3356071 | #!/usr/bin/env python3
""" FREEZING Pyzo WITH PYINSTALLER
Pyzo is frozen in such a way that it still uses the plain source code.
This is achieved by putting the Pyzo package in a subdirectory called
"source". This source directory is added to sys.path by __main__.py.
In case we need better support for older MacOS:
h... | 0 | 1 | 0 | 0 | 1 | 0 |
angulardjango/urls.py | nnja/tweeter | 111 | 3356074 | <filename>angulardjango/urls.py
from django.conf.urls import patterns, include, url
from rest_framework.routers import DefaultRouter
from django.contrib import admin
from tweeter import views
admin.autodiscover()
router = DefaultRouter()
router.register(r'tweets', views.TweetViewSet)
router.register(r'users', views... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_aaa.py | randy3k/ride | 1,051 | 3356084 | <reponame>randy3k/ride
def test_aaa(terminal):
# just make sure radian has started.
terminal.current_line().assert_startswith("r$>", timeout=10)
| 0 | 0 | 0 | 0 | 0 | 0 |
TIDALDL-PY/tidal_dl/lang/__init__.py | moisespr123/Tidal-Media-Downloader | 2,003 | 3356097 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : __init__.py
@Time : 2020/08/19
@Author : Yaronzz
@Version : 1.0
@Contact : <EMAIL>
@Desc :
'''
| 0 | 0 | 0 | 0 | 0 | 0 |
designate/storage/impl_sqlalchemy/migrate_repo/versions/097_add_services.py | mrlesmithjr/designate | 145 | 3356173 | <reponame>mrlesmithjr/designate
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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/LICE... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/Test_DQN_HER.py | p-christ/Deep-Reinforcement-Learning-PyTorch-Algorithms | 4,461 | 3356176 | import random
from collections import Counter
import pytest
from agents.DQN_agents.DQN_HER import DQN_HER
from agents.DQN_agents.DDQN import DDQN
from agents.DQN_agents.DDQN_With_Prioritised_Experience_Replay import DDQN_With_Prioritised_Experience_Replay
from agents.DQN_agents.DQN_With_Fixed_Q_Targets import DQN_Wit... | 0 | 0 | 0 | 0 | 0 | 0 |
src/client/conditions.py | ZackPashkin/toloka-kit | 153 | 3356184 | __all__ = [
'RuleConditionKey',
'RuleCondition',
'ComparableRuleCondition',
'IdentityRuleCondition',
'AcceptedAssignmentsCount',
'AcceptedAssignmentsRate',
'AssessmentEvent',
'AssignmentsAcceptedCount',
'CorrectAnswersRate',
'FailRate',
'FastSubmittedCount',
'GoldenSetAns... | 0 | 0 | 57 | 0 | 57 | 0 |
src/cities_light/contrib/ajax_selects_lookups.py | krectra/django-cities-light | 198 | 3356204 | """
Couples cities_light and django-ajax-selects.
Register the lookups in settings.AJAX_LOOKUP_CHANNELS, add::
'cities_light_country': ('cities_light.lookups', 'CountryLookup'),
'cities_light_city': ('cities_light.lookups', 'CityLookup'),
"""
from ajax_select import LookupChannel
from django.db.models import... | 0 | 6 | 0 | 0 | 6 | 0 |
ceilometer/agent.py | yi-cloud/ceilometer | 239 | 3356205 | #
# Copyright 2013 Intel Corp.
# Copyright 2014 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 0 | 5 | 0 | 0 | 5 | 0 |
cfgov/v1/models/banners.py | Colin-Seifer/consumerfinance.gov | 156 | 3356210 | <filename>cfgov/v1/models/banners.py
from django.core.validators import RegexValidator
from django.db import models
from django.utils.safestring import mark_safe
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core.blocks import StreamBlock
from wagtail.core.fields import StreamField
... | 0 | 0 | 0 | 0 | 0 | 0 |
ur_driver/test_io.py | Hugal31/universal_robot | 749 | 3356211 | #!/usr/bin/env python
from __future__ import print_function
import time
from ur_driver.io_interface import *
if __name__ == "__main__":
print("testing io-interface")
get_states()
print("listener has been activated")
set_states()
print("service-server has been started")
while(True):
set_... | 0 | 0 | 0 | 0 | 0 | 0 |
jc/parsers/ls_s.py | shaikustin/jc | 3,215 | 3356212 | <gh_stars>1000+
"""jc - JSON CLI output utility `ls` and `vdir` command output streaming parser
> This streaming parser outputs JSON Lines
Requires the `-l` option to be used on `ls`. If there are newline characters in the filename, then make sure to use the `-b` option on `ls`.
The `jc` `-qq` option can be used to ... | 0 | 0 | 0 | 0 | 0 | 0 |
sudo_rm_rf/dnn/losses/sisdr.py | ishine/sudo_rm_rf | 134 | 3356218 | from __future__ import annotations
"""!
@brief SISNR very efficient computation in Torch. PArts have been used from
asteroid for values cross checking.
@author <NAME> {<EMAIL>}
@copyright University of illinois at Urbana Champaign
"""
import torch
import torch.nn as nn
import itertools
from torch.nn.modules.loss impo... | 36 | 18 | 0 | 2 | 56 | 0 |
samples/RDStoS3/setup/Teardown.py | pushpeshg/data-pipeline-samples | 277 | 3356243 | <gh_stars>100-1000
from RDStoS3Sample import RDStoS3Sample
from Utilities import check_working_directory
import argparse
if __name__ == '__main__':
check_working_directory()
parser = argparse.ArgumentParser(description='Teardown for RDS to S3 pipeline sample')
parser.add_argument('--s3-path', action="st... | 0 | 0 | 0 | 0 | 0 | 0 |
src/awkward/_v2/operations/io/to_json_file.py | scikit-hep/awkward-1.0 | 519 | 3356255 | <reponame>scikit-hep/awkward-1.0
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def to_json_file():
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/ticktock.py | bdowning/aiotools | 121 | 3356283 | <filename>examples/ticktock.py
import aiotools
import asyncio
async def mytick(interval):
print('tick')
async def run():
t = aiotools.create_timer(mytick, 1.0)
await asyncio.sleep(4)
t.cancel()
await t
if __name__ == '__main__':
loop = asyncio.new_event_loop()
asyncio.set_event_loop(lo... | 0 | 0 | 0 | 0 | 0 | 0 |
python_solutions/chapter_01_arrays_and_strings/problem_01_06_string_compression.py | isayapin/cracking-the-coding-interview | 560 | 3356294 | <gh_stars>100-1000
"""
Chapter 01 - Problem 06 - String Compression - CTCI 6th Edition page 91
Problem Statement:
Implement a method to perform basic string compression using the counts of repeated characters. For example,
the string aabcccccaaa would become a2b1c5a3. If the "compressed" string would not become smalle... | 0 | 0 | 0 | 0 | 0 | 0 |
torchgeo/losses/__init__.py | remtav/torchgeo | 678 | 3356304 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""TorchGeo losses."""
from .qr import QRLoss, RQLoss
__all__ = ("QRLoss", "RQLoss")
# https://stackoverflow.com/questions/40018681
for module in __all__:
globals()[module].__module__ = "torchgeo.losses"
| 0 | 0 | 0 | 0 | 0 | 0 |
integration_tests/files/example-utf8.py | s-weigand/darglint | 405 | 3356323 | # -*- coding: utf-8 -*-
def main():
"""Runs the main program.
Returns:
The return code for the program.
"""
print('Hello, world!')
if __name__ == '__main__':
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
framework/Optimizers/gradients/SPSA.py | rinelson456/raven | 159 | 3356329 | <filename>framework/Optimizers/gradients/SPSA.py<gh_stars>100-1000
# Copyright 2017 Battelle Energy Alliance, 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/lic... | 0 | 0 | 0 | 0 | 0 | 0 |
stacks_queues/queue_list/queue_list.py | rubenparedes0796/interactive-coding-challenges | 27,173 | 3356334 | <gh_stars>1000+
class Node(object):
def __init__(self, data):
self.data = data
self.next = None
class Queue(object):
def __init__(self):
self.head = None
self.tail = None
def enqueue(self, data):
node = Node(data)
# Empty list
if self.head is None... | 0 | 0 | 0 | 0 | 0 | 0 |
videos/management/commands/upload_to_s3.py | annevandalfsen/screenbird | 121 | 3356362 | import time
import datetime
import os
from django.conf import settings
from django.core.management.base import NoArgsCommand
from amazon.models import S3UploadQueue
from amazon.utils import purge_queue
class Command(NoArgsCommand):
help = "Uploads video to s3 and deletes it from the server."
def handle_noar... | 0 | 0 | 0 | 0 | 0 | 0 |
tasks/copy_memory/utils.py | hugoych/keras-tcn | 1,473 | 3356364 | <filename>tasks/copy_memory/utils.py
import numpy as np
def data_generator(t, mem_length, b_size):
"""
Generate data for the copying memory task
:param t: The total blank time length
:param mem_length: The length of the memory to be recalled
:param b_size: The batch size
:return: Input and tar... | 0 | 0 | 0 | 0 | 0 | 0 |
gtts/tests/test_tts.py | scottgigante/gTTS | 1,627 | 3356374 | # -*- coding: utf-8 -*-
import os
import pytest
from mock import Mock
from six.moves import urllib
from gtts.tts import gTTS, gTTSError
from gtts.langs import _main_langs
from gtts.lang import _extra_langs
# Testing all languages takes some time.
# Set TEST_LANGS envvar to choose languages to test.
# * 'main': Langu... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/tests/test_alternatives.py | haithcockce/insights-core | 121 | 3356381 | import doctest
import pytest
from insights.tests import context_wrap
from insights.parsers import alternatives
from insights.parsers.alternatives import AlternativesOutput, JavaAlternatives
from insights.parsers.alternatives import PythonAlternatives
from insights.core import ParseException
ALT_MTA = """
mta - status... | 0 | 0 | 0 | 0 | 0 | 0 |
modeller/interaction.py | SunGuo/500lines | 134 | 3356385 | from collections import defaultdict
from OpenGL.GLUT import glutGet, glutKeyboardFunc, glutMotionFunc, glutMouseFunc, glutPassiveMotionFunc, \
glutPostRedisplay, glutSpecialFunc
from OpenGL.GLUT import GLUT_LEFT_BUTTON, GLUT_RIGHT_BUTTON, GLUT_MIDDLE_BUTTON, \
GLUT_WINDOW... | 0 | 0 | 0 | 3 | 3 | 0 |
examples/dogpile_caching/advanced.py | lxl0928/timi_sqlalchemy | 5,079 | 3356406 | """Illustrate usage of Query combined with the FromCache option,
including front-end loading, cache invalidation and collection caching.
"""
from .caching_query import FromCache
from .caching_query import RelationshipCache
from .environment import Session
from .model import cache_address_bits
from .model import Perso... | 1 | 1 | 0 | 0 | 2 | 0 |
src/pykeen/models/unimodal/compgcn.py | sbonner0/pykeen | 750 | 3356428 | # -*- coding: utf-8 -*-
"""Implementation of the Comp-GCN model."""
from typing import Any, Mapping, Optional
import torch
from class_resolver import Hint
from ..nbase import ERModel
from ...nn.emb import CombinedCompGCNRepresentations, EmbeddingSpecification
from ...nn.modules import DistMultInteraction, Interacti... | 5 | 0 | 1 | 0 | 6 | 0 |
python/python-core/datetimes - date.py | josephobonyo/sigma_coding_youtube | 893 | 3356445 | <reponame>josephobonyo/sigma_coding_youtube<gh_stars>100-1000
"""
Python offers the capability for manipulating, time, date, and datetime objects. All the manipulation you'll need to do is through the `datetime` library.
In this tutorial, we will explore the `date` object, the `time` object and the `datetime` ... | 0 | 0 | 0 | 0 | 0 | 0 |
Pyto/Samples/Numpy/boolean_arrays.py | snazari/Pyto | 701 | 3356461 | <gh_stars>100-1000
"""
An example of indexing with boolean arrays
"""
import numpy as np
a = np.arange(12).reshape(3,4)
b = a > 4
print(b) # b is a boolean with a's shape
print(a[b]) # 1d array with the selected elements
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_gcp/cloudscheduler/outputs.py | sisisin/pulumi-gcp | 121 | 3356466 | <filename>sdk/python/pulumi_gcp/cloudscheduler/outputs.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, M... | 0 | 0 | 0 | 0 | 0 | 0 |
allennlp/interpret/attackers/__init__.py | MSLars/allennlp | 11,433 | 3356486 | <reponame>MSLars/allennlp<gh_stars>1000+
from allennlp.interpret.attackers.attacker import Attacker
from allennlp.interpret.attackers.input_reduction import InputReduction
from allennlp.interpret.attackers.hotflip import Hotflip
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/nnapi/specs/V1_2/exp_1D_float_nnfw.mod.py | periannath/ONE | 255 | 3356489 | # model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{4}") # a vector of 4 float32s
i2 = Output("op2", "TENSOR_FLOAT32", "{4}") # a vector of 4 float32s
model = model.Operation("EXP", i1).To(i2)
# Example 1. Input in operand 0,
input0 = {i1: # input 0
[3.0, 4.0, 5.0, 6.0]}
output0 = {i2: # output 0
... | 0 | 0 | 0 | 0 | 0 | 0 |
blackmamba/lib/rope/contrib/generate.py | oz90210/blackmamba | 239 | 3356499 | <reponame>oz90210/blackmamba
import rope.base.evaluate
from rope.base import libutils
from rope.base import (change, pyobjects, exceptions, pynames, worder,
codeanalyze)
from rope.refactor import sourceutils, importutils, functionutils, suites
def create_generate(kind, project, resource, offset... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorial/stage1/example.py | cloudmatrix/esky | 190 | 3356515 | <reponame>cloudmatrix/esky<filename>tutorial/stage1/example.py
from __future__ import print_function
print ("HELLO WORLD")
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/61_FAA_Aligner/30_Gather_LDC_For_Inference.py | plandes/amrlib | 103 | 3356526 | #!/usr/bin/python3
import setup_run_dir # this import tricks script to run from 2 levels up
import os
from glob import glob
from amrlib.graph_processing.amr_loading_raw import load_raw_amr
# Extract the setence and one-line graph from a full amr string
def get_graph_sent(amr_strings) -> object:
entries = {... | 0 | 1 | 0 | 0 | 1 | 0 |
stix_shifter_utils/modules/base/stix_translation/base_results_translator.py | nkhetia31/stix-shifter | 129 | 3356533 | from __future__ import annotations
from abc import ABCMeta, abstractmethod
import os
from stix_shifter_utils.utils import logger
from stix_shifter_utils.utils.file_helper import read_json as helper_read_json
from stix_shifter_utils.stix_translation.src.utils.transformer_utils import get_module_transformers
class Base... | 2 | 1 | 0 | 1 | 4 | 0 |
tests/pytests/unit/beacons/test_smartos_imgadm.py | tomdoherty/salt | 9,425 | 3356536 | <filename>tests/pytests/unit/beacons/test_smartos_imgadm.py
# Python libs
import pytest
# Salt libs
import salt.beacons.smartos_imgadm as imgadm
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {imgadm: {"__context__": {}, "__salt__": {}}}
@pytest.fixture
d... | 0 | 0 | 0 | 0 | 0 | 0 |
questions/interleaving-string/Solution.py | achow113/LeetCode | 141 | 3356554 | from __future__ import annotations
"""
Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.
An interleaving of two strings s and t is a configuration where they are divided into non-empty substrings such that:
s = s1 + s2 + ... + sn
t = t1 + t2 + ... + tm
|n - m| <= 1
The interleav... | 3 | 2 | 0 | 0 | 5 | 0 |
python/ql/test/2/query-tests/Classes/new-style/property_old_style.py | vadi2/codeql | 4,036 | 3356557 | <filename>python/ql/test/2/query-tests/Classes/new-style/property_old_style.py
#Property in old-style class
class OldStyle:
def __init__(self, x):
self._x = x
@property
def piosc(self):
return self._x | 0 | 0 | 0 | 0 | 0 | 0 |
repo-infra/vendor/github.com/bazelbuild/buildifier/core/build_defs.bzl | mkontak/external-storage | 2,426 | 3356581 | from __future__ import annotations
_GO_TOOL = "@io_bazel_rules_go//go/toolchain:go_tool"
def go_yacc(src, out, visibility: object | None=None):
native.genrule(
name = src + ".go_yacc",
srcs = [src],
outs = [out],
tools = [_GO_TOOL],
cmd = ("export GOROOT=$$(dirname $(location " + _GO_TOOL + "))/.... | 1 | 0 | 0 | 0 | 1 | 0 |
e2e_tests/tests/template/test_template.py | shiyuann/determined | 1,729 | 3356586 | import pytest
import yaml
from tests import command as cmd
from tests import config as conf
from tests import template as tpl
@pytest.mark.e2e_cpu
def test_set_template() -> None:
template_name = "test_set_template"
template_path = conf.fixtures_path("templates/template.yaml")
tpl.set_template(template_n... | 0 | 4 | 0 | 0 | 4 | 0 |
Tools/unicode/listcodecs.py | shawwn/cpython | 52,316 | 3356627 | <gh_stars>1000+
""" List all available codec modules.
(c) Copyright 2005, <NAME> (<EMAIL>).
Licensed to PSF under a Contributor Agreement.
"""
import os, codecs, encodings
_debug = 0
def listcodecs(dir):
names = []
for filename in os.listdir(dir):
if filename[-3:] != '.py':
continu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/deprecated_gallery/test_formats.py | nrrpinto/construct | 629 | 3356655 | <reponame>nrrpinto/construct
from tests.declarativeunittest import *
from construct import *
from construct.lib import *
from deprecated_gallery import *
def test_png():
commondumpdeprecated(png_file, "sample.png")
def test_emf():
commondumpdeprecated(emf_file, "emf1.emf")
def test_bitmap():
commondum... | 0 | 0 | 0 | 0 | 0 | 0 |
common/py_utils/py_utils/expectations_parser_unittest.py | tingshao/catapult | 1,894 | 3356661 | <filename>common/py_utils/py_utils/expectations_parser_unittest.py
# Copyright 2017 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 __future__ import absolute_import
from __future__ import division
from __future__ im... | 0 | 0 | 0 | 0 | 0 | 0 |
jni-build/jni/include/tensorflow/python/kernel_tests/init_ops_test.py | rcelebi/android-elfali | 680 | 3356670 | # Copyright 2015 The TensorFlow 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 applica... | 0 | 7 | 0 | 0 | 7 | 0 |
ML/dblp/filter_and_statistic.py | saneravi/ML_Stuff | 209 | 3356679 | <reponame>saneravi/ML_Stuff<filename>ML/dblp/filter_and_statistic.py
"""Filter and summarize dataset."""
import codecs
from collections import Counter, OrderedDict
import matplotlib.pyplot as plt
import numpy as np
import ujson
from nltk import word_tokenize
from tqdm import tqdm
# top 10 journals
journals = [
"I... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/twisted/wamp/work/newapi/test_newapi4.py | rapyuta-robotics/autobahn-python | 1,670 | 3356684 | <reponame>rapyuta-robotics/autobahn-python
from twisted.internet.task import react
from twisted.internet.defer import inlineCallbacks as coroutine
from autobahn.twisted.wamp import Session
from autobahn.twisted.connection import Connection
def make_session(config):
@coroutine
def on_join(session, details):
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/capturedVariable1.py | martindemello/pyright | 4,391 | 3356703 | # This sample tests the code flow analysis used to determine
# whether it is safe to narrow the type of a captured variable.
from typing import Optional
def get_optional_int() -> Optional[int]:
...
v1 = get_optional_int()
if v1 is not None:
lambda: v1 + 5
v2 = get_optional_int()
if v2 is not None:
# T... | 2 | 1 | 5 | 0 | 8 | 0 |
fbrp/src/fbrp/runtime/base.py | ali-senguel/fairo | 669 | 3356706 | <filename>fbrp/src/fbrp/runtime/base.py
import asyncio
from fbrp import life_cycle
from fbrp.process import ProcDef
import a0
import argparse
import asyncio
import contextlib
import psutil
import json
class BaseLauncher:
def __init__(self):
pass
async def run(self, name: str, proc_def: ProcDef, args:... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdet3d/ops/group_points/__init__.py | Guangyun-Xu/mmdetection3d | 2,216 | 3356727 | <filename>mmdet3d/ops/group_points/__init__.py
from .group_points import GroupAll, QueryAndGroup, grouping_operation
__all__ = ['QueryAndGroup', 'GroupAll', 'grouping_operation']
| 0 | 0 | 0 | 0 | 0 | 0 |
fbpic/utils/threading.py | wilds9/fbpic | 131 | 3356728 | <filename>fbpic/utils/threading.py<gh_stars>100-1000
# Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines a set of generic functions for multithreaded CPU execution.
"""
import os, sys
import war... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/debug/lib/session_debug_multi_gpu_test.py | EricRemmerswaal/tensorflow | 190,993 | 3356738 | # Copyright 2017 The TensorFlow 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 applica... | 0 | 0 | 0 | 0 | 0 | 0 |
gamefixes/638970.py | manueliglesiasgarcia/protonfixes | 213 | 3356754 | """ Game fix for Yakuza 0
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" Disable FSYNC
"""
# Disable fsync to fix saving issues
util.disable_fsync()
| 0 | 0 | 0 | 0 | 0 | 0 |
ddtrace/provider.py | p7g/dd-trace-py | 308 | 3356756 | import abc
from typing import Any
from typing import Callable
from typing import Optional
from typing import Union
import six
from . import _hooks
from .context import Context
from .internal.compat import contextvars
from .internal.logger import get_logger
from .span import Span
log = get_logger(__name__)
_DD_CON... | 0 | 6 | 0 | 0 | 6 | 0 |
actions/list_resource_groups.py | syncurity-exchange/stackstorm-azure | 164 | 3356772 | <filename>actions/list_resource_groups.py
from azure.mgmt.resource.resources import (
ResourceManagementClient,
ResourceManagementClientConfiguration)
from lib.base import AzureBaseResourceManagerAction
class ListResourceGroupsAction(AzureBaseResourceManagerAction):
def run(self, subscription_id):
... | 0 | 0 | 0 | 0 | 0 | 0 |
lncrawl/bots/test/__init__.py | mesmerlord/lncrawler | 710 | 3356784 | # -*- coding: utf-8 -*-
"""
The purpose of this bot is to test the application and crawlers
"""
import traceback
from random import random
from cloudscraper.exceptions import CaptchaException, CloudflareException
from requests import RequestException
from urllib3.exceptions import HTTPError
from ...core.sources impor... | 0 | 1 | 1 | 0 | 2 | 0 |
src/tests/postmodeling_tests/test_model_group_evaluator.py | josephbajor/triage_NN | 160 | 3356793 | <reponame>josephbajor/triage_NN
from triage.component.postmodeling.contrast.model_group_evaluator import ModelGroupEvaluator
import pandas as pd
import pytest
from tests.utils import assert_plot_figures_added
@pytest.fixture(scope="module")
def model_group_evaluator(finished_experiment):
return ModelGroupEvaluato... | 0 | 0 | 0 | 0 | 0 | 0 |
src/poliastro/core/spheroid_location.py | Carlosbogo/poliastro | 634 | 3356803 | """ Low level calculations for oblate spheroid locations """
import numpy as np
from numba import njit as jit
@jit
def cartesian_cords(_a, _c, _lon, _lat, _h) -> tuple[object, object, object]:
"""Calculates cartesian coordinates.
Parameters
----------
_a: float
Semi-major axis
_c: float
... | 0 | 8 | 0 | 0 | 8 | 0 |
toolkit/amd_data_generation_toolkit/classification/scripts/step-2.py | asalmanp/MIVisionX | 153 | 3356846 | # Copyright (c) 2018 - 2020 Advanced Micro Devices, Inc. All rights reserved.
#
# 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
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main/python/pybuilder/_vendor/virtualenv/activation/nushell/__init__.py | Mattlk13/pybuilder | 1,419 | 3356855 | from __future__ import absolute_import, unicode_literals
import os
from ...util.path import Path
from ...util.six import ensure_text
from ..via_template import ViaTemplateActivator
class NushellActivator(ViaTemplateActivator):
def templates(self):
yield Path("activate.nu")
yield Path("deactivat... | 0 | 1 | 0 | 0 | 1 | 0 |
workalendar/africa/benin.py | taiyeoguns/workalendar | 405 | 3356869 | from ..core import IslamoWesternCalendar, SAT, SUN
from ..registry_tools import iso_register
@iso_register('BJ')
class Benin(IslamoWesternCalendar):
"Benin"
# Civil holidays
include_labour_day: bool = True
# Christian holidays
include_easter_monday: bool = True
include_ascension: bool = True
... | 0 | 0 | 11 | 0 | 11 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.