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 |
|---|---|---|---|---|---|---|---|---|---|---|
reinforcement_learning/common/sagemaker_rl/orchestrator/clients/ddb/experiment_db_client.py | jpmarques19/tensorflwo-test | 1,116 | 3325576 | <reponame>jpmarques19/tensorflwo-test
import logging
from boto3.dynamodb.conditions import Key
from orchestrator.exceptions.ddb_client_exceptions import RecordAlreadyExistsException
logger=logging.getLogger(__name__)
class ExperimentDbClient(object):
def __init__(self, table_session):
self.table_session =... | 0 | 0 | 0 | 0 | 0 | 0 |
cliport/models/__init__.py | wx-b/cliport | 110 | 3325588 | from cliport.models.resnet import ResNet43_8s
from cliport.models.clip_wo_skip import CLIPWithoutSkipConnections
from cliport.models.rn50_bert_unet import RN50BertUNet
from cliport.models.rn50_bert_lingunet import RN50BertLingUNet
from cliport.models.rn50_bert_lingunet_lat import RN50BertLingUNetLat
from cliport.model... | 0 | 0 | 0 | 0 | 0 | 0 |
frictionless/server.py | augusto-herrmann/frictionless-py | 247 | 3325632 | <reponame>augusto-herrmann/frictionless-py
class Server:
"""Server representation
API | Usage
-------- | --------
Public | `from frictionless import Schema`
"""
def start(self, port):
"""Start the server
Parameters:
port (int): HTTP port
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
debian/mutate/usr/share/doc/mutate/config/scripts/kill/kill.py | hardyoyo/Mutate | 1,488 | 3325645 | <reponame>hardyoyo/Mutate
#!/usr/bin/python
#text command icon subtext
import subprocess, gio, sys
apps = gio.app_info_get_all()
for i in range(1, len(sys.argv)):
try:
k = subprocess.check_output("ps -A -o pid -o %cpu -o comm | grep -i [^/]" + sys.argv[i] + "[^/]*$", shell = True)
except:
sys.e... | 0 | 0 | 0 | 0 | 0 | 0 |
py2app/recipes/sqlalchemy.py | sorphin/py2app | 193 | 3325647 | <filename>py2app/recipes/sqlalchemy.py
from __future__ import absolute_import
# __import__ in sqlalchemy.dialects
ENGINE_DEPS = {
"asyncpg": ("asyncpg",),
"psycopg2cffi": ("psycopg2cffi",),
"pg8000": ("pg8000",),
"firebird": ("sqlalchemy_firebird",),
"sybase": "sqlalchemy_sybase",
"aiosqlite": ... | 0 | 0 | 0 | 0 | 0 | 0 |
lxmls/sequences/crf_online.py | mtreviso/lxmls-toolkit | 183 | 3325648 | import sys
import numpy as np
from . import discriminative_sequence_classifier as dsc
import pdb
class CRFOnline(dsc.DiscriminativeSequenceClassifier):
""" Implements a first order CRF"""
def __init__(self, observation_labels, state_labels, feature_mapper,
regularizer: float=0.00001,
... | 4 | 1 | 0 | 1 | 6 | 0 |
pymoo/problems/multi/sympart.py | jarreguit/pymoo | 762 | 3325664 | import numpy as np
from numpy import zeros, abs, min, sign, ceil, ones, pi, cos, sin
from pymoo.core.problem import Problem
class SYMPARTRotated(Problem):
"""
The SYM-PART test problem proposed in [1].
Parameters:
-----------
length: the length of each line (i.e., each Pareto subsets), default i... | 8 | 2 | 0 | 0 | 10 | 0 |
src/apps/hello_bokeh_world/app.py | MarcSkovMadsen/awesome-panel-starter | 601 | 3325674 | """Minimal Bokeh Hello World Example"""
from bokeh.models import Div
from bokeh.plotting import curdoc
app = curdoc()
model = Div(text="<h1>Hello Bokeh World from .py Code File</h1>", sizing_mode="stretch_width")
app.add_root(model)
| 0 | 0 | 0 | 0 | 0 | 0 |
src/masonite/tests/__init__.py | cercos/masonite | 1,816 | 3325695 | from .TestCase import TestCase
from .MockInput import MockInput
from .HttpTestResponse import HttpTestResponse
from .DatabaseTransactions import DatabaseTransactions
| 0 | 0 | 0 | 0 | 0 | 0 |
fastapi_plugins/middleware.py | madkote/fastapi-plugins | 211 | 3325740 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# fastapi_plugins.middleware
'''
:author: madkote
:contact: madkote(at)bluewin.ch
:copyright: Copyright 2021, madkote RES
fastapi_plugins.middleware
--------------------------
Middleware utilities and collections
'''
from __future__ import absolute_import
import typ... | 2 | 1 | 0 | 0 | 3 | 0 |
security_monkey/tests/auditors/test_sns.py | boladmin/security_monkey | 4,258 | 3325754 | # Copyright 2017 Netflix, 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 applicable law... | 0 | 0 | 0 | 0 | 0 | 0 |
vkwave/bots/core/dispatching/dp/processing_options.py | krasnovmv/vkwave | 222 | 3325763 | <filename>vkwave/bots/core/dispatching/dp/processing_options.py
# this is in early stage, now useless but created for using in future
from pydantic import BaseModel
class ProcessEventOptions(BaseModel):
do_not_handle: bool
| 0 | 0 | 0 | 0 | 0 | 0 |
src/python/nimbusml/internal/core/preprocessing/filter/takefilter.py | michaelgsharp/NimbusML | 134 | 3325774 | <reponame>michaelgsharp/NimbusML
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# -... | 0 | 0 | 0 | 0 | 0 | 0 |
XBNet/Seq.py | tusharsarkar3/XBNet | 167 | 3325784 | import torch
import numpy as np
from collections import OrderedDict
class Seq(torch.nn.Sequential):
'''
Seq uses sequential module to implement tree in the forward.
'''
def give(self, xg, num_layers_boosted, ep: float=0.001):
'''
Saves various information into the object for further us... | 1 | 1 | 0 | 0 | 2 | 0 |
pinball_ext/job/hive_jobs.py | DotModus/pinball | 1,143 | 3325808 | <reponame>DotModus/pinball
# Copyright 2015, Pinterest, 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 applicab... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/65445_Decorate_output_stream_printlike/recipe-65445.py | tdiprima/code | 2,023 | 3325811 | <reponame>tdiprima/code
class PrintDecorator:
"""Add print-like methods to any file-like object."""
def __init__(self, stream):
"""Store away the stream for later use."""
self.stream = stream
def Print(self, *args, **kw):
""" Print all arguments as strings, separated by spaces.
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/features/migrations/0012_auto_20190424_1555.py | nixplay/bullet-train-api | 1,259 | 3325818 | <filename>src/features/migrations/0012_auto_20190424_1555.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-24 15:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/cli/__main__.py | Ermlab/python-ddd | 308 | 3325832 | <reponame>Ermlab/python-ddd<gh_stars>100-1000
from seedwork.infrastructure.request_context import request_context
from seedwork.infrastructure.logging import logger, LoggerFactory
from config.container import Container
from modules.catalog.domain.repositories import SellerRepository
from modules.catalog.application.que... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/551.py | rakhi2001/ecom7 | 854 | 3325852 | <reponame>rakhi2001/ecom7<filename>Python3/551.py
__________________________________________________________________________________________________
sample 16 ms submission
class Solution:
def checkRecord(self, s: str) -> bool:
s=s.replace('LLL','XX')
return s.count('A')<=1 and s.count('XX') == 0
_... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/TuitionISVStudentInfoDTO.py | antopen/alipay-sdk-python-all | 213 | 3325854 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TuitionISVStudentInfoDTO(object):
def __init__(self):
self._email = None
self._entrance_date = None
self._first_name = None
self._identity_card_... | 0 | 0 | 0 | 0 | 0 | 0 |
L1Trigger/GlobalMuonTrigger/python/gmtDigis_cff.py | ckamtsikis/cmssw | 852 | 3325861 | import FWCore.ParameterSet.Config as cms
from L1TriggerConfig.L1ScalesProducers.L1MuTriggerScalesConfig_cff import *
from L1TriggerConfig.L1ScalesProducers.L1MuTriggerPtScaleConfig_cff import *
from L1TriggerConfig.L1ScalesProducers.L1MuGMTScalesConfig_cff import *
from L1TriggerConfig.GMTConfigProducers.L1MuGMTParame... | 0 | 0 | 0 | 0 | 0 | 0 |
openchem/modules/embeddings/onehot_embedding.py | jmhayesesq/Open-Chem | 466 | 3325892 | import torch
from openchem.modules.embeddings.openchem_embedding import OpenChemEmbedding
class OneHotEmbedding(OpenChemEmbedding):
def __init__(self, params):
super(OneHotEmbedding, self).__init__(params)
if self.padding_idx is not None:
weight = torch.eye(self.num_embeddings - 1)
... | 0 | 1 | 0 | 0 | 1 | 0 |
sdk/python/pulumi_azure/automation/dsc_configuration.py | henriktao/pulumi-azure | 109 | 3325908 | # 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! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 72 | 27 | 0 | 0 | 99 | 0 |
setup.py | dandv/fluxgui | 1,708 | 3325911 | <filename>setup.py
#!/usr/bin/env python3
from distutils.core import setup
from distutils.log import info
import distutils.command.install_data
import os, os.path, subprocess, sys
if os.path.abspath(os.path.curdir) != os.path.abspath(os.path.dirname(__file__)):
print("The 'setup.py' must be run in its containing ... | 0 | 0 | 0 | 0 | 0 | 0 |
booknlp/common/layered_reader.py | ishine/booknlp | 539 | 3325935 | from __future__ import annotations
import numpy as np
import torch
def get_batches(model, sentences, max_batch, tagset, training: bool=True) -> tuple[object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, list[object]] | tuple[object, obj... | 1 | 1 | 0 | 0 | 2 | 0 |
html/semantics/scripting-1/the-script-element/module/dynamic-import/resources/status-changing-script.py | meyerweb/wpt | 14,668 | 3325975 | def main(request, response) -> tuple[object, object, bytes]:
headers = [(b"Content-Type", b"text/javascript"),
(b"Cache-Control", b"private, no-store")]
id = request.GET.first(b"id")
with request.server.stash.lock:
status = request.server.stash.take(id)
if status is None:
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_color_palettes_config.py | rohankumardubey/chartify | 3,111 | 3326012 | <gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2020 Spotify AB
#
# 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 requir... | 0 | 0 | 0 | 0 | 0 | 0 |
scribdl/content/audiobook.py | difiore/scribd-downloader | 182 | 3326034 | from bs4 import BeautifulSoup
import requests
import json
import re
from .base import ScribdBase
from .. import internals
from .. import const
from .. import exceptions
class Track:
"""
A class for an audio chapter in a Scribd audiobook playlist.
Parameters
----------
track: `dict`
A dic... | 0 | 16 | 0 | 6 | 22 | 0 |
corehq/ex-submodules/fluff/management/commands/wipe_fluff_table.py | dimagilg/commcare-hq | 471 | 3326050 | from django.core.management.base import BaseCommand
from fluff.pillow import FluffPillowProcessor
from pillowtop.utils import get_pillow_by_name
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'pillow_name',
)
parser.add_argument(
... | 0 | 1 | 0 | 0 | 1 | 0 |
backend/src/subscriber/aggregation/__init__.py | rutvikpadhiyar000/github-trends | 157 | 3326056 | from src.subscriber.aggregation.user.contributions import get_contributions
from src.subscriber.aggregation.user.follows import get_user_follows
from src.subscriber.aggregation.user.package import get_full_user_data, get_user_data
from src.subscriber.aggregation.wrapped.package import main as get_wrapped_data
__all__ ... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/tests/Rsd/Processor/Tools/XilinxTools/VivadoProjectCreator.py | little-blue/Surelog | 670 | 3326060 | #!/usr/bin/python3
# -*- Coding: utf-8 -*-
import os
import re
import sys
def parse_makefile_for_core_sources() -> object:
file_name = os.environ['RSD_ROOT'] + "/Processor/Src/Makefiles/CoreSources.inc.mk"
sources = []
is_header = False
print("Parsing %s..." % file_name)
with open(file_name) as fi... | 0 | 1 | 0 | 0 | 1 | 0 |
Adafruit_pIRKey/NEC_print_example.py | joewalk102/Adafruit_Learning_System_Guides | 665 | 3326095 | # Simple NEC remote decode-and-print example
# Prints out the 4-byte code transmitted by NEC remotes
import pulseio
import board
import adafruit_dotstar
import adafruit_irremote
led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
pulsein = pulseio.PulseIn(board.REMOTEIN, maxlen=120, idle_state=True... | 0 | 0 | 0 | 0 | 0 | 0 |
scale/job/management/commands/scale_pre_steps.py | kaydoh/scale | 121 | 3326096 | """Defines the command that performs the pre-job steps"""
from __future__ import unicode_literals
import json
import logging
import os
import sys
from django.core.management.base import BaseCommand
from django.utils.text import get_valid_filename
from django.utils.timezone import now
from error.exceptions import Sca... | 0 | 2 | 1 | 0 | 3 | 0 |
projects/airbnb santa clara/pull_addresses.py | amoskowitz14/causalML | 354 | 3326117 | <filename>projects/airbnb santa clara/pull_addresses.py
import pandas as pd
import requests
import matplotlib.pyplot as plt
G_API = '#ADD GOOGLE API KEY'
# reading csv file
def filter_dataframe(df, column_name, value):
return df.loc[df[column_name] == value]
def get_address(lat, long):
URL = 'https://maps.... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Algorithms/Greedy-Algorithms/activity_selection.py | ThunderZ007/Data-Structures-and-Algorithms | 245 | 3326133 | <filename>Python/Algorithms/Greedy-Algorithms/activity_selection.py
import sys
"""Prints a maximum set of activities that can be done by a
single person, one at a time"""
# n --> Total number of activities
# start--> An array that contains start time of all activities
# finish --> An array that contains finish time... | 0 | 0 | 0 | 0 | 0 | 0 |
generate_masks.py | mauriliosalg/Seis_Shift-Net_pytorch | 350 | 3326156 | import torch
# import numpy as np
from options.train_options import TrainOptions
import util.util as util
import os
from PIL import Image
import glob
mask_folder = 'masks/testing_masks'
test_folder = './datasets/Paris/test'
util.mkdir(mask_folder)
opt = TrainOptions().parse()
f = glob.glob(test_folder+'/*.png')
prin... | 0 | 0 | 0 | 0 | 0 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/state/plex_.py | disrupted/Trakttv.bundle | 1,346 | 3326167 | <filename>Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/state/plex_.py
from plugin.modules.core.manager import ModuleManager
from plex_database.library import Library
import elapsed
import logging
log = logging.getLogger(__name__)
class SyncStatePlex(object):
def __init__(self, state):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | fakegit/DEXBot | 249 | 3326172 | from __future__ import annotations
import logging
import os.path
import random
import socket
import string
import time
import uuid
import docker
import pytest
from bitshares import BitShares
from bitshares.account import Account
from bitshares.asset import Asset
from bitshares.exceptions import AccountDoesNotExistsExc... | 2 | 18 | 0 | 0 | 20 | 0 |
Zhihu/NN/one/Test.py | wangjiangtao-NJPI/MachineLearning | 1,107 | 3326190 | from Zhihu.NN.one.Network import *
from Zhihu.NN.Layers import *
from Util.Util import DataUtil
np.random.seed(142857) # for reproducibility
def main():
nn = NNDist()
epoch = 1000
x, y = DataUtil.gen_xor(100)
nn.add(ReLU((x.shape[1], 24)))
nn.add(CrossEntropy((y.shape[1],)))
nn.fit(x, y... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_event_emitter.py | pyGrowler/Growler | 806 | 3326200 | <filename>tests/test_event_emitter.py<gh_stars>100-1000
#
# tests/test_event_emitter
#
import pytest
import asyncio
from unittest import mock
from growler.utils.event_manager import event_emitter, Events
@pytest.fixture
def loop(event_loop):
return event_loop
@pytest.fixture
def mock_func(loop):
return mo... | 0 | 0 | 0 | 0 | 0 | 0 |
drl_grasping/perception/octree.py | Tiamat-Tech/drl_grasping | 126 | 3326235 | from drl_grasping.utils import conversions
from geometry_msgs.msg import Transform
from rclpy.executors import MultiThreadedExecutor
from rclpy.node import Node
from rclpy.parameter import Parameter
from sensor_msgs.msg import PointCloud2
from threading import Thread
from typing import List, Tuple
import numpy as np
im... | 34 | 4 | 0 | 0 | 38 | 0 |
RecoLocalCalo/Castor/python/CastorTowerReco_cfi.py | ckamtsikis/cmssw | 852 | 3326242 | <filename>RecoLocalCalo/Castor/python/CastorTowerReco_cfi.py
import FWCore.ParameterSet.Config as cms
CastorTowerReco = cms.EDProducer('CastorTowerProducer',
inputprocess = cms.string("castorreco"),
towercut = cms.double(0.65), # 4*sigma cut per channel in GeV
mintime = cms.double(-99999.),
maxtime = cms.double... | 0 | 0 | 0 | 0 | 0 | 0 |
genrl/trainers/__init__.py | mehulrastogi/genrl | 390 | 3326314 | <gh_stars>100-1000
from genrl.trainers.bandit import BanditTrainer, DCBTrainer, MABTrainer # noqa
from genrl.trainers.base import Trainer # noqa
from genrl.trainers.classical import ClassicalTrainer # noqa
from genrl.trainers.offpolicy import OffPolicyTrainer # noqa
from genrl.trainers.onpolicy import OnPolicyTrain... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/fasta_generate_regions.py | tprodanov/freebayes | 452 | 3326327 | #!/usr/bin/env python3
from __future__ import annotations
import argparse
from math import ceil
def generate_regions(fasta_index_file, size, chunks: bool=False, chromosomes: object | None=None, bed_files: object | None=None):
if not fasta_index_file.endswith(".fai"):
fasta_index_file = fasta_index_file ... | 3 | 0 | 0 | 0 | 3 | 0 |
saleor/graphql/meta/types.py | eanknd/saleor | 1,392 | 3326358 | <filename>saleor/graphql/meta/types.py
import graphene
from graphene.types.generic import GenericScalar
from ...core.models import ModelWithMetadata
from ..channel import ChannelContext
from ..core.descriptions import ADDED_IN_33, PREVIEW_FEATURE
from ..core.types import NonNullList
from .resolvers import (
check_... | 0 | 0 | 0 | 0 | 0 | 0 |
siamban/tracker/tracker_builder.py | QiangliangHuang/siamban | 216 | 3326359 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from siamban.core.config import cfg
from siamban.tracker.siamban_tracker import SiamBANTracker
TRACKS = {
'SiamBANTracker': SiamBANTracker
}
def bui... | 0 | 1 | 0 | 0 | 1 | 0 |
idangr/ui/__init__.py | IMULMUL/IDAngr | 237 | 3326361 | <filename>idangr/ui/__init__.py<gh_stars>100-1000
######################################################
# Author: <NAME> <<EMAIL>> #
# License: BSD 2-Clause #
######################################################
from connect import *
from panel import *
from addmem import *
from execute... | 0 | 0 | 0 | 0 | 0 | 0 |
src/rdbms-connect/azext_rdbms_connect/vendored_sdks/__init__.py | Mannan2812/azure-cli-extensions | 2,728 | 3326374 | <filename>src/rdbms-connect/azext_rdbms_connect/vendored_sdks/__init__.py
__version__="0.0.1" | 0 | 0 | 0 | 0 | 0 | 0 |
enumfields/drf/serializers.py | shadchin/django-enumfields | 154 | 3326397 | from enumfields.drf.fields import EnumField as EnumSerializerField
from enumfields.fields import EnumFieldMixin
from rest_framework.fields import CharField, ChoiceField, IntegerField
class EnumSupportSerializerMixin:
enumfield_options: dict[object,object] = {}
enumfield_classes_to_replace: tuple[object, objec... | 0 | 1 | 2 | 0 | 3 | 0 |
dns/qcloud.py | rocdk890/letscertbot | 117 | 3326454 | <filename>dns/qcloud.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import time
import urllib
import base64
import hashlib
import hmac
import json
if sys.version_info < (3,0):
import urllib2
import urllib
else:
import urllib.request as urllib2
import urllib.parse as urllib
root... | 0 | 0 | 0 | 0 | 0 | 0 |
sheetmaker/html_builder.py | cosme12/cheet-sheet-maker | 112 | 3326460 | from __future__ import annotations
"""Create html by choosing style, color, blocks, etc.
Uses html comments <!-- example --> to find the places where to append new html
Todo:
*
*
"""
#Fix PATH tests and main program
try: #Path when running tests
import sys
import os
sys.path.insert(0, os.path.ab... | 1 | 7 | 0 | 0 | 8 | 0 |
leetcode/929.unique-email-addresses.py | geemaple/algorithm | 177 | 3326477 | <reponame>geemaple/algorithm<filename>leetcode/929.unique-email-addresses.py
class Solution(object):
def numUniqueEmails(self, emails):
"""
:type emails: List[str]
:rtype: int
"""
ans = set()
for e in emails:
ans.add(self.convert(e))
r... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorials/parallel_distributed/assign.py | lorenzosteccanella/machin | 287 | 3326490 | <gh_stars>100-1000
from machin.parallel.assigner import ModelAssigner
from machin.model.nets.resnet import ResNet
if __name__ == "__main__":
models = [
ResNet(in_planes=9, depth=152, out_planes=1, out_pool_size=[20, 20])
for _ in range(4)
]
# create 4 ResNet as example models
assigner ... | 0 | 0 | 0 | 0 | 0 | 0 |
esky/tests/__init__.py | omnivore/esky | 190 | 3326494 | # Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd.
# All rights reserved; available under the terms of the BSD License.
from __future__ import annotations
"""
esky.tests: support code for testing esky
"""
import sys
import os
import errno
import esky
from esky.sudo import allow_from_sudo
from functools import wr... | 2 | 8 | 0 | 0 | 10 | 0 |
tests/test_gyroscope.py | WeiWeic6222848/PyRep | 505 | 3326565 | import unittest
from tests.core import TestCore
from pyrep.sensors.gyroscope import Gyroscope
class TestGyroscope(TestCore):
def setUp(self):
super().setUp()
self.sensor = Gyroscope('gyroscope')
def test_read(self):
angular_velocities = self.sensor.read()
self.assertEqual(len... | 0 | 0 | 0 | 0 | 0 | 0 |
analysis/aero/hover_model/plot_wake_model.py | leozz37/makani | 1,178 | 3326568 | #!/usr/bin/python
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 0 | 0 | 0 | 0 | 0 | 0 |
elfi/model/tools.py | diadochos/elfi | 166 | 3326595 | <filename>elfi/model/tools.py
"""This module contains tools for ELFI graphs."""
import subprocess
from functools import partial
import numpy as np
from elfi.utils import get_sub_seed, is_array
__all__ = ['vectorize', 'external_operation']
def run_vectorized(operation, *inputs, constants=None, dtype=None, batch_si... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/CommonScripts/Scripts/LanguageDetect/LanguageDetect.py | diCagri/content | 799 | 3326597 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from langdetect import detect_langs
def detect_language(text):
res = detect_langs(text)
md = "### Detected languages (probability):\n"
langs = []
for line in res:
lang = str(line).split(':')[0]
... | 0 | 0 | 0 | 0 | 0 | 0 |
PhysxTests/ThirdParty/PhysX_3.4/PhysX/Tools/PhysXMetaDataGenerator/lib/utils.py | dragonsn/PhysxTests | 1,863 | 3326628 | # general utility module
from __future__ import annotations
from __future__ import print_function
from __future__ import with_statement
import os
import sys
import re
import subprocess
def list_autogen_files(dirPath) -> object:
autogenFiles = []
for (root, subdirs, files) in os.walk(dirPath):
files = filter(lambd... | 1 | 5 | 0 | 0 | 6 | 0 |
sphinx/source/docs/user_guide/examples/tools_poly_edit.py | goncaloperes/bokeh | 15,193 | 3326653 | from bokeh.models import PolyDrawTool, PolyEditTool
from bokeh.plotting import figure, output_file, show
output_file("tools_poly_edit.html")
p = figure(x_range=(0, 10), y_range=(0, 10), width=400, height=400,
title='Poly Edit Tool')
p1 = p.patches([], [], fill_alpha=0.4)
p2 = p.patches([[1, 2, 3]], [[3, 5... | 0 | 0 | 0 | 0 | 0 | 0 |
readthedocs/builds/migrations/0020_migrate_null_hidden_field.py | mforbes/readthedocs.org | 4,054 | 3326669 | # Generated by Django 2.2.12 on 2020-04-29 20:08
from django.db import migrations
def forwards_func(apps, schema_editor):
"""Make all hidden fields not none."""
Version = apps.get_model('builds', 'Version')
Version.objects.filter(hidden=None).update(hidden=False)
class Migration(migrations.Migration):
... | 0 | 0 | 2 | 0 | 2 | 0 |
pyorient/ogm/query_utils.py | spy7/pyorient | 142 | 3326678 | import pyorient.ogm.property
from .element import GraphElement
import pyorient.ogm.what
from .operators import LogicalConnective, ArithmeticOperation
class ArgConverter(object):
"""Convert query function argument to expected string format"""
Label = String = Format = 0
Expression: int = 1
Field: int ... | 0 | 1 | 7 | 0 | 8 | 0 |
data_structures/graphs/cyclic_in_undirected_graph.py | FatiahBalo/python-ds | 1,723 | 3326679 | <reponame>FatiahBalo/python-ds
from collections import defaultdict
class Graph:
def __init__(self, vertices):
self.V = vertices
self.graph = defaultdict(list)
def add_edge(self, u, v):
self.graph[u].append(v)
def is_cyclic_util(self, v, visited, parent):
visited[v] = T... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/682.py | rakhi2001/ecom7 | 854 | 3326712 | __________________________________________________________________________________________________
sample 36 ms submission
class Solution:
def calPoints(self, ops: List[str]) -> int:
history = []
for op in ops:
if op == 'C':
history.pop()
elif op == 'D':
... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/lookup/locales_codes.py | manala/ansible-roles | 138 | 3326732 | <reponame>manala/ansible-roles
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: locales_codes
author: Manala (@manala)
short_description: returns a curated codes list
description:
- Takes a repositories list and returns it curated a... | 0 | 0 | 0 | 0 | 0 | 0 |
synapse/tests/test_model_language.py | ackroute/synapse | 216 | 3326768 | <reponame>ackroute/synapse<filename>synapse/tests/test_model_language.py
import synapse.tests.utils as s_t_utils
class LangModuleTest(s_t_utils.SynTest):
async def test_model_language(self):
async with self.getTestCore() as core:
nodes = await core.nodes('''[
lang:translation=... | 0 | 0 | 0 | 0 | 0 | 0 |
build/tseer_deploy.py | lsqtzj/TSeer | 667 | 3326783 | <reponame>lsqtzj/TSeer
#!/usr/bin/env python
import ConfigParser
import datetime
import sys
import time
from commands import *
from utils.vssh import execute_script
from utils.get_os_info import get_ip
tseer_conf = ConfigParser.ConfigParser()
tseer_conf.read('tseer_deploy.ini')
TIME_STAMP = str(datetime.datetime.now(... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/queue_mover.py | beaglecode/skytools | 116 | 3326800 | #! /usr/bin/env python
"""This script simply mover events from one queue to another.
Config parameters::
## Parameters for queue_mover
src_db = dbname=sourcedb
dst_db = dbname=targetdb
dst_queue_name = dest_queue
"""
import sys, os
import pkgloader
pkgloader.require('skyt... | 0 | 0 | 0 | 0 | 0 | 0 |
py/tests/slice.py | fuz-woo/gpython | 520 | 3326805 | # Copyright 2019 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
doc="slice"
a = slice(10)
assert a.start == None
assert a.stop == 10
assert a.step == None
a = slice(0, 10, 1)
assert a.start == 0
assert a.stop == 10
ass... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pytorch/seal/sampler.py | ketyi/dgl | 9,516 | 3326835 | from __future__ import annotations
import os.path as osp
from tqdm import tqdm
from copy import deepcopy
import torch
import dgl
from torch.utils.data import DataLoader, Dataset
from dgl import DGLGraph, NID
from dgl.dataloading.negative_sampler import Uniform
from dgl import add_self_loop
from utils import drnl_node_l... | 13 | 10 | 0 | 0 | 23 | 0 |
controlimcap/driver/asg2caption.py | SikandarBakht/asg2cap | 169 | 3326848 | <reponame>SikandarBakht/asg2cap<filename>controlimcap/driver/asg2caption.py
import os
import sys
import json
import time
import numpy as np
import torch.utils.data.dataloader as dataloader
import framework.logbase
import framework.run_utils
import caption.models.attention
import controlimcap.readers.imgsgreader as i... | 0 | 0 | 0 | 0 | 0 | 0 |
python/example_code/lookoutvision/train_host.py | cfuerst/aws-doc-sdk-examples | 5,166 | 3326872 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Shows how to create and optionally start an Amazon Lookout for Vision model.
"""
import argparse
import logging
import boto3
from projects import Projects
from datasets import Datasets
from models import Model... | 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/CHANGE_BITS_CAN_MADE_ONE_FLIP.py | mxl1n/CodeGen | 241 | 3326978 | # 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 ( str ) -> object :
zeros = 0
ones = 0
for i in range ( 0 , len ( str ) ) :
ch = str [ i ] ;
... | 0 | 1 | 0 | 0 | 1 | 0 |
airbyte-integrations/bases/source-acceptance-test/unit_tests/test_utils.py | koji-m/airbyte | 6,215 | 3326992 | <filename>airbyte-integrations/bases/source-acceptance-test/unit_tests/test_utils.py<gh_stars>1000+
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import pytest
from source_acceptance_test.utils.compare import serialize
@pytest.fixture(name="not_sorted_data")
def not_sorted_data_fixture():
return [... | 0 | 0 | 0 | 0 | 0 | 0 |
convokit/bag_of_words/bow_transformer.py | Ap1075/Cornell-Conversational-Analysis-Toolkit | 371 | 3327010 | <reponame>Ap1075/Cornell-Conversational-Analysis-Toolkit
from convokit import Corpus, CorpusComponent, Transformer
from typing import Callable
from sklearn.feature_extraction.text import CountVectorizer as CV
import numpy as np
class BoWTransformer(Transformer):
"""
Bag-of-Words Transformer for annotating a C... | 0 | 0 | 0 | 0 | 0 | 0 |
robo/initial_design/init_random_normal.py | lebrice/RoBO | 455 | 3327028 |
from __future__ import annotations
import numpy as np
def init_random_normal(lower, upper, n_points, mean: object | None=None, std: object | None=None, rng: object | None=None) -> object:
"""
Returns as initial design N data points sampled from a normal
distribution.
Parameters
----------
lo... | 3 | 1 | 0 | 0 | 4 | 0 |
saleor/graphql/order/mutations/draft_order_update.py | eanknd/saleor | 1,392 | 3327044 | import graphene
from django.core.exceptions import ValidationError
from ....core.permissions import OrderPermissions
from ....order import OrderStatus, models
from ....order.error_codes import OrderErrorCode
from ...core.types import OrderError
from ..types import Order
from .draft_order_create import DraftOrderCreate... | 0 | 2 | 3 | 0 | 5 | 0 |
src/dataset/vctk_features_dataset.py | roberthoenig/VQ-VAE-Speech | 241 | 3327057 | <reponame>roberthoenig/VQ-VAE-Speech
#####################################################################################
# MIT License #
# #
# Copyright (C) 2019 ... | 0 | 0 | 0 | 0 | 0 | 0 |
vendor/github.com/openshift/origin/images/ipfailover/keepalived/tests/echoserver.py | troy0820/openshift-azure | 213 | 3327058 | <filename>vendor/github.com/openshift/origin/images/ipfailover/keepalived/tests/echoserver.py
#!/usr/bin/env python
""" Echo server - reply back with the received message. """
import os
import signal
import socket
import sys
def sigusr1_handler(signum, frame):
print 'signal %s received, exiting ...' % signum
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_morley.py | hajime9652/observations | 199 | 3327065 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.morley import morley
def test_morley():
"""Test module morley.py by downloading
morley.csv and testing shape of
extracted data has 100 row... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/bin/pythonSrc/pychecker-0.8.18/pychecker2/FormatStringChecks.py | YangHao666666/hawq | 450 | 3327082 | from __future__ import annotations
from pychecker2.Check import Check
from pychecker2.util import BaseVisitor
from pychecker2.Warning import Warning
from compiler import ast, walk
from types import *
import re
class UnknownError(Exception): pass
def _compute_node(node, recurse) -> object:
if isinstance(node, ast.... | 0 | 7 | 0 | 1 | 8 | 0 |
examples/apply_customized_controller.py | pcriadoperez/simglucose | 129 | 3327087 | from simglucose.simulation.user_interface import simulate
from simglucose.controller.base import Controller, Action
class MyController(Controller):
def __init__(self, init_state):
self.init_state = init_state
self.state = init_state
def policy(self, observation, reward, done, **info) -> objec... | 0 | 1 | 0 | 0 | 1 | 0 |
cross3d/softimage/softimagescene.py | vedantirb/cross3d | 129 | 3327097 | ##
# \namespace cross3d.softimage.softimagescene
#
# \remarks The SoftimageScene class provides the implementation of the AbstractScene class as it applies
# to Softimage
#
# \author douglas
# \author Blur Studio
# \date 04/04/11
#
#------------------------------------------------------------------------------... | 44 | 51 | 1 | 2 | 98 | 0 |
gitlabform/gitlab/project_badges.py | barryib/gitlabform | 299 | 3327098 | from gitlabform.gitlab.projects import GitLabProjects
class GitLabProjectBadges(GitLabProjects):
def get_project_badges(self, project_and_group_name) -> object:
badges = self._make_requests_to_api(
"projects/%s/badges",
project_and_group_name,
expected_codes=200,
... | 0 | 4 | 0 | 0 | 4 | 0 |
setup.py | Xlsean/X-Temporal | 492 | 3327107 | <reponame>Xlsean/X-Temporal
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import io
import re
import glob
import os
import subprocess
import numpy as np
import torch
from setuptools import Extension
from setuptools import find_packages
from setuptools impo... | 0 | 0 | 0 | 0 | 0 | 0 |
webapp/graphite/functions/aggfuncs.py | romanek-adam/graphite-web | 4,281 | 3327112 | <filename>webapp/graphite/functions/aggfuncs.py
from graphite.errors import InputParameterError
from graphite.functions import safe
aggFuncs = {
'average': safe.safeAvg,
'avg_zero': safe.safeAvgZero,
'median': safe.safeMedian,
'sum': safe.safeSum,
'min': safe.safeMin,
'max': safe.safeMax,
'diff': safe.s... | 0 | 0 | 0 | 0 | 0 | 0 |
rllab/algos/nop.py | RussellM2020/maml_gps | 1,838 | 3327126 | <filename>rllab/algos/nop.py
from rllab.algos.batch_polopt import BatchPolopt
from rllab.misc.overrides import overrides
class NOP(BatchPolopt):
"""
NOP (no optimization performed) policy search algorithm
"""
def __init__(
self,
**kwargs):
super(NOP, self).__init__(**k... | 0 | 0 | 0 | 0 | 0 | 0 |
mode/examples/Basics/Input/MousePress/MousePress.pyde | timgates42/processing.py | 1,224 | 3327129 | """
Mouse Press.
Move the mouse to position the shape.
Press the mouse button to invert the color.
"""
def setup():
size(640, 360)
noSmooth()
fill(126)
background(102)
def draw():
if mousePressed:
stroke(255)
else:
stroke(0)
line(mouseX - 66, mouseY, mouseX + 66, mouseY)... | 0 | 0 | 0 | 0 | 0 | 0 |
python_packages/jupyterlab_lsp/jupyterlab_lsp/_paths.py | icankeep/jupyterlab-lsp | 1,117 | 3327138 | <reponame>icankeep/jupyterlab-lsp
from pathlib import Path
LAB_EXTENSION_PATH = Path(__file__).parent / "labextensions"
MAIN_PACKAGE_PATH = LAB_EXTENSION_PATH / "@krassowski" / "jupyterlab-lsp"
| 0 | 0 | 0 | 0 | 0 | 0 |
steamctl/commands/clean/cmds.py | rossengeorgiev/steamctl | 138 | 3327160 |
import logging
from steamctl.utils.storage import UserDataDirectory, UserCacheDirectory
from steamctl.utils.format import print_table, fmt_duration
_LOG = logging.getLogger(__name__)
def cmd_clear_cache(args):
_LOG.debug("Removing all cache files")
cache_dir = UserCacheDirectory()
if cache_dir.exists(... | 0 | 0 | 0 | 0 | 0 | 0 |
src/runners/__init__.py | swang423/SpeechVAE | 155 | 3327164 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
import time
from utils import *
SESS_CONF = tf.ConfigProto(allow_soft_placement=True)
SESS_CONF.gpu... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/hello_pygame.py | saurabhcommand/Hello-world | 1,428 | 3327165 | <gh_stars>1000+
# Uses python3 with pygame installed:
import pygame
pygame.init()
def text(screen, text, x, y, size = 50, color = (200, 200, 200)):
text = str(text)
fontobject = pygame.font.Font(None, size)
text = fontobject.render(text, True, color)
screen.blit(text, (x, y))
screen = pygame.disp... | 0 | 0 | 0 | 0 | 0 | 0 |
src/util.py | ShawnyXiao/2017-CCF-BDCI-AIJudge | 241 | 3327169 | <reponame>ShawnyXiao/2017-CCF-BDCI-AIJudge<gh_stars>100-1000
# coding=utf-8
import time
def log(stri):
now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print(str(now) + ' ' + str(stri))
| 0 | 0 | 0 | 0 | 0 | 0 |
asn1tools/source/__init__.py | cromulencellc/asn1tools | 198 | 3327201 | # Source code generators.
| 0 | 0 | 0 | 0 | 0 | 0 |
Python/Algorithm/Sum.py | piovezan/SOpt | 148 | 3327202 | <gh_stars>100-1000
while True:
numero = int(input('Digite um número inteiro e positivo: '))
if numero >= 0:
break
print('O número não pode ser negativo.')
divisor = 1
soma = 0
for divisor in range(divisor, numero):
if numero % divisor == 0:
soma += divisor
print(soma)
#https://pt.stackover... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/onnxruntime/quantization/text-classification/run_glue.py | huggingface/optimum | 414 | 3327203 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 The HuggingFace Team. 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/LI... | 3 | 3 | 24 | 0 | 30 | 0 |
mahotas/tests/__init__.py | odidev/mahotas | 541 | 3327210 | def run(verbose: bool=False) -> object:
from os import path
import pytest
args = [path.dirname(__file__)]
if verbose:
args.append('--verbose')
return pytest.main(args)
| 1 | 1 | 0 | 0 | 2 | 0 |
module/pic_to_vedio.py | makalo/Siamese-RPN-tensorflow | 140 | 3327263 | <filename>module/pic_to_vedio.py
import sys
sys.path.append('./')
import os
import numpy as np
import cv2
from config import cfg
from utils.image_reader_forward import Image_reader
class Pic_vedio():
def __init__(self):
self.reader=Image_reader(img_path=cfg.img_path,label_path=cfg.label_path)
self.v... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_paasta_execute_docker_command.py | sobolevn/paasta | 1,711 | 3327266 | # Copyright 2015-2016 Yelp 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 applicable law or agreed to in writin... | 0 | 0 | 0 | 0 | 0 | 0 |
app/die_information.py | mongodb-labs/disasm | 269 | 3327288 | # Copyright 2016 MongoDB 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 applicable law or agreed to in writing, sof... | 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.