max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
examples/gto/10-atom_info.py | umamibeef/pyscf | 501 | 76529 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
Access molecule geometry.
Mole.natm is the total number of atoms. It is initialized in Mole.build()
function.
'''
from pyscf import gto
mol = gto.M(
atom = '''
O 0.000000 0.000000 0.117790
H 0.000000 0.755453 -... |
convert.py | andreasjansson/VQMIVC | 168 | 76534 | import hydra
import hydra.utils as utils
from pathlib import Path
import torch
import numpy as np
from tqdm import tqdm
import soundfile as sf
from model_encoder import Encoder, Encoder_lf0
from model_decoder import Decoder_ac
from model_encoder import SpeakerEncoder as Encoder_spk
import os
import random
from glob... |
release/stubs.min/System/Windows/Forms/__init___parts/ListView.py | htlcnn/ironpython-stubs | 182 | 76538 | class ListView(Control,IComponent,IDisposable,IOleControl,IOleObject,IOleInPlaceObject,IOleInPlaceActiveObject,IOleWindow,IViewObject,IViewObject2,IPersist,IPersistStreamInit,IPersistPropertyBag,IPersistStorage,IQuickActivate,ISupportOleDropSource,IDropTarget,ISynchronizeInvoke,IWin32Window,IArrangedElement,IBindableCo... |
models/fpcnn_s3dis.py | lyqun/FPConv | 129 | 76555 | import torch
import torch.nn as nn
from fpconv.pointnet2.pointnet2_modules import PointnetFPModule, PointnetSAModule
import fpconv.pointnet2.pytorch_utils as pt_utils
from fpconv.base import AssemRes_BaseBlock
from fpconv.fpconv import FPConv4x4_BaseBlock, FPConv6x6_BaseBlock
NPOINTS = [8192, 2048, 512, 128]
RADIUS =... |
tests/custom_ops_attributes_test.py | gglin001/poptorch | 128 | 76571 | <reponame>gglin001/poptorch
#!/usr/bin/env python3
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import collections
import ctypes
import pathlib
import random
import sys
import pytest
import torch
import poptorch
import helpers
myso = list(pathlib.Path("tests").rglob("libcustom_*.*"))
assert myso, "Failed... |
tensorflow2/datasets/seg_dataset.py | naviocean/imgclsmob | 2,649 | 76572 | <reponame>naviocean/imgclsmob
import random
import threading
import numpy as np
from PIL import Image, ImageOps, ImageFilter
from tensorflow.keras.preprocessing.image import ImageDataGenerator, DirectoryIterator
class SegDataset(object):
"""
Segmentation base dataset.
Parameters:
----------
root ... |
tasks/R2R/follower.py | zhangybzbo/speaker_follower | 117 | 76586 | ''' Agents: stop/random/shortest/seq2seq '''
import json
import sys
import numpy as np
import random
from collections import namedtuple
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.distributions as D
from utils import vocab_pad_idx, vocab_eos_id... |
twitch/twitch_models.py | Flame442/Trusty-cogs | 148 | 76608 | from dataclasses import dataclass
import discord
@dataclass(init=False)
class TwitchProfile:
def __init__(self, **kwargs):
self.id = kwargs.get("id")
self.login = kwargs.get("login")
self.display_name = kwargs.get("display_name")
self.acc_type = kwargs.get("acc_type")
self... |
libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/prompt_options.py | Fl4v/botbuilder-python | 388 | 76626 | <filename>libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/prompt_options.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List
from botbuilder.schema import Activity
from botbuilder.dialogs.choices import Choice, ListStyle
class PromptOption... |
Chapter2/stddev.py | buiksat/Learn-Algorithmic-Trading | 449 | 76627 | import pandas as pd
from pandas_datareader import data
start_date = '2014-01-01'
end_date = '2018-01-01'
SRC_DATA_FILENAME = 'goog_data.pkl'
try:
goog_data2 = pd.read_pickle(SRC_DATA_FILENAME)
except FileNotFoundError:
goog_data2 = data.DataReader('GOOG', 'yahoo', start_date, end_date)
goog_data2.to_pickle(SRC... |
falcon/bench/nuts/nuts/controllers/root.py | RioAtHome/falcon | 8,217 | 76641 | import random
import pecan
from pecan import expose, response, request
_body = pecan.x_test_body
_headers = pecan.x_test_headers
class TestController:
def __init__(self, account_id):
self.account_id = account_id
@expose(content_type='text/plain')
def test(self):
user_agent = request.he... |
fingerprint/feature_extractor.py | claraeyoon/FAST | 126 | 76648 | ########################################################################################################
## pyFAST - Fingerprint and Similarity Thresholding in python
##
## <NAME>
## 11/14/2016
##
## (see Yoon et. al. 2015, Sci. Adv. for algorithm details)
##
############################################################... |
hnsw/helper.py | Tumao727/covidex | 128 | 76657 | import csv
import os
def remove_if_exist(path):
if os.path.exists(path):
os.remove(path)
def load_metadata(path):
res = {}
headers = None
with open(path, newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
if head... |
urbansim/models/relocation.py | waddell/urbansim | 351 | 76658 | """
Use the ``RelocationModel`` class to choose movers based on
relocation rates.
"""
import logging
import numpy as np
import pandas as pd
from . import util
logger = logging.getLogger(__name__)
def find_movers(choosers, rates, rate_column):
"""
Returns an array of the indexes of the `choosers` that are ... |
feudal_networks/policies/feudal_policy.py | zqcchris/feudal_networks | 141 | 76698 | <reponame>zqcchris/feudal_networks
import distutils.version
import numpy as np
import tensorflow as tf
import tensorflow.contrib.rnn as rnn
import feudal_networks.policies.policy as policy
import feudal_networks.policies.policy_utils as policy_utils
from feudal_networks.models.models import SingleStepLSTM
from feu... |
etl/parsers/etw/Microsoft_Windows_Sdstor.py | IMULMUL/etl-parser | 104 | 76699 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-Sdstor
GUID : afe654eb-0a83-4eb4-948f-d4510ec39c30
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.pars... |
Algo and DSA/LeetCode-Solutions-master/Python/maximum-vacation-days.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 76718 | <gh_stars>1000+
# Time: O(n^2 * k)
# Space: O(k)
class Solution(object):
def maxVacationDays(self, flights, days):
"""
:type flights: List[List[int]]
:type days: List[List[int]]
:rtype: int
"""
if not days or not flights:
return 0
dp = [[0] * len... |
py_entitymatching/matcherselector/mlmatchercombinerselection.py | kvpradap/py_entitymatching | 165 | 76719 | <gh_stars>100-1000
"""
This module contains functions for ML-matcher combiner selection.
Note: This is not going to be there for the first release of py_entitymatching.
"""
import itertools
import six
from py_entitymatching.matcherselector.mlmatcherselection import select_matcher
from py_entitymatching.matcher.ensemb... |
xdfile/tests/test_utils.py | jmviz/xd | 179 | 76721 | """unit tests for utils.py"""
import os
from xdfile import utils
TEST_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
def test_find_files():
mygen = utils.find_files(TEST_DIRECTORY)
for fullfn, contents in mygen:
# It should throw out anything starting with '.'
assert not fullfn.start... |
DiffAugment-biggan-imagenet/compare_gan/gans/abstract_gan.py | Rian-T/data-efficient-gans | 1,902 | 76743 | # coding=utf-8
# Copyright 2018 Google LLC & <NAME>.
#
# 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... |
RecoBTag/PerformanceDB/python/measure/Pool_btagMuJetsWpNoTtbar.py | ckamtsikis/cmssw | 852 | 76767 | import FWCore.ParameterSet.Config as cms
from CondCore.DBCommon.CondDBCommon_cfi import *
PoolDBESSourcebtagMuJetsWpNoTtbar = cms.ESSource("PoolDBESSource",
CondDBCommon,
toGet = cms.VPSet(
#
# working points
#
cms.PSet(
record = cms.stri... |
tests/test_labels.py | long-long-float/py-videocore | 783 | 76805 | 'Test of label scope and label exporter'
import numpy as np
from videocore.assembler import qpu, get_label_positions
from videocore.driver import Driver
@qpu
def given_jmp(asm):
mov(ra0, uniform)
mov(r0, 0)
L.entry
jmp(reg=ra0)
nop()
nop()
nop()
iadd(r0, r0, 1)
L.test
iadd... |
kratos/tests/test_gid_io_gauss_points.py | lkusch/Kratos | 778 | 76808 | <reponame>lkusch/Kratos
from KratosMultiphysics import *
import KratosMultiphysics.KratosUnittest as UnitTest
import KratosMultiphysics.kratos_utilities as kratos_utils
try:
from KratosMultiphysics.FluidDynamicsApplication import *
have_fluid_dynamics = True
except ImportError:
have_fluid_dynamics = False... |
btrack/__init__.py | dstansby/BayesianTracker | 196 | 76869 | # __all__ = ['core','utils','constants','render']
from .core import BayesianTracker, __version__
|
tests/hubstorage/test_jobsmeta.py | pardo/python-scrapinghub | 163 | 76888 | """
Test job metadata
System tests for operations on stored job metadata
"""
from ..conftest import TEST_SPIDER_NAME
from .conftest import start_job
def _assertMetadata(meta1, meta2):
def _clean(m):
return dict((k, v) for k, v in m.items() if k != 'updated_time')
meta1 = _clean(meta1)
meta2 = _c... |
platypush/message/response/printer/cups.py | RichardChiang/platypush | 228 | 76893 | from typing import Optional, List
from platypush.message.response import Response
class PrinterResponse(Response):
def __init__(self,
*args,
name: str,
printer_type: int,
info: str,
uri: str,
state: int,
... |
bert-quantization/bert-tf-quantization/ft-tensorflow-quantization/ft_tensorflow_quantization/python/layers/utils.py | dujiangsu/FasterTransformer | 777 | 76897 | ################################################################################
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License... |
api/collections/nodeman.py | brookylin/bk-sops | 881 | 76910 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... |
example/RunModel/Abaqus_Example/abaqus_input.py | marrov/UQpy | 132 | 76911 | <gh_stars>100-1000
# -*- coding: mbcs -*-
# Do not delete the following import lines
from abaqus import *
from abaqusConstants import *
import __main__
import numpy as np
def time_temperature_curve(qtd=None):
# Define the other parameters of the curve
O = 0.14
b = 1500
typ = 'medium'
# Heating pha... |
setup.py | Andrej1A/underwear | 112 | 76918 | <reponame>Andrej1A/underwear<filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('... |
days/97-99-online-game-api/demo_app/web/game_logic/game.py | aarogyaswamy/100daysofpython | 1,858 | 76925 | <reponame>aarogyaswamy/100daysofpython
from collections import defaultdict
from game_logic import game_service, game_decider
from game_logic.game_decider import Decision
from game_logic.models.player import Player
from game_logic.models.roll import Roll
class GameRound:
def __init__(self, game_id: str, player1:... |
io/swig/io/vexport.py | ljktest/siconos | 137 | 76932 | <reponame>ljktest/siconos
#!/usr/bin/env @PYTHON_EXECUTABLE@
"""
Description: Export a Siconos mechanics-IO HDF5 file in VTK format.
"""
# Lighter imports before command line parsing
from __future__ import print_function
import sys
import os
import getopt
#
# a replacement for vview --vtk-export
#
def usage(long=Fal... |
panel/tests/io/test_state.py | datalayer-contrib/holoviz-panel | 1,130 | 76935 | <filename>panel/tests/io/test_state.py
from panel.io.state import state
def test_as_cached_key_only():
global i
i = 0
def test_fn():
global i
i += 1
return i
assert state.as_cached('test', test_fn) == 1
assert state.as_cached('test', test_fn) == 1
state.cache.clear()
... |
criterion.py | ash368/FaceParsing | 138 | 76936 | # -*- coding: utf-8 -*-
# @Author: luoling
# @Date: 2019-12-06 10:41:34
# @Last Modified by: luoling
# @Last Modified time: 2019-12-18 17:52:49
import torch
import torch.nn.functional as F
import torch.nn as nn
def cross_entropy2d(input, target, weight=None, reduction='none'):
n, c, h, w = input.size()
n... |
pydis_site/apps/api/migrations/0056_allow_blank_user_roles.py | Transfusion/site | 700 | 76949 | <filename>pydis_site/apps/api/migrations/0056_allow_blank_user_roles.py
# Generated by Django 3.0.8 on 2020-07-14 20:35
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
import pydis_site.apps.api.models.bot.user
class Migration(migrations.Migration):
d... |
tools/perf/core/results_merger_unittest.py | zealoussnow/chromium | 14,668 | 76965 | # Copyright 2020 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.
import json
import unittest
from core import results_merger
class ResultMergerTest(unittest.TestCase):
def setUp(self):
self.sample_json_string = '''... |
examples/gallery/lines/linestyles.py | jbusecke/pygmt | 326 | 76967 | <gh_stars>100-1000
"""
Line styles
-----------
The :meth:`pygmt.Figure.plot` method can plot lines in different styles.
The default line style is a 0.25-point wide, black, solid line, and can be
customized with the ``pen`` parameter.
A *pen* in GMT has three attributes: *width*, *color*, and *style*.
The *style* attr... |
build/util/lib/results/result_types.py | zealoussnow/chromium | 14,668 | 76985 | <gh_stars>1000+
# Copyright 2021 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.
"""Module containing base test results classes."""
# The test passed.
PASS = 'SUCCESS'
# The test was intentionally skipped.
SKIP = 'SKIPPED... |
analyze.py | rachmadaniHaryono/zsh-history-analysis | 179 | 76986 | <reponame>rachmadaniHaryono/zsh-history-analysis
#!/usr/bin/env python3
from collections import Counter, defaultdict
from itertools import groupby
import argparse
import os
import shutil
import statistics
import sys
import time
import warnings
try:
from termgraph.termgraph import chart
except ImportError:
cha... |
sample/sample-python/sample-filter-tables-log.py | George-/tsduck | 542 | 77028 | #!/usr/bin/env python
#----------------------------------------------------------------------------
#
# TSDuck sample Python application running a chain of plugins:
# Filter tables using --log-hexa-line to get binary tables in a Python class.
#
# See sample-filter-tables-event.py for an equivalent example using plugin
... |
python/ray/util/collective/tests/distributed_multigpu_tests/test_distributed_multigpu_reducescatter.py | 77loopin/ray | 21,382 | 77065 | """Test the collective reducescatter API on a distributed Ray cluster."""
import pytest
import ray
import cupy as cp
import torch
from ray.util.collective.tests.util import \
create_collective_multigpu_workers, \
init_tensors_for_gather_scatter_multigpu
@pytest.mark.parametrize("tensor_backend", ["cupy", "t... |
tests/test_efs/test_file_system.py | gtourkas/moto | 5,460 | 77067 | import re
from os import environ
import boto3
import pytest
from botocore.exceptions import ClientError
from moto import mock_efs
from tests.test_efs.junk_drawer import has_status_code
ARN_PATT = r"^arn:(?P<Partition>[^:\n]*):(?P<Service>[^:\n]*):(?P<Region>[^:\n]*):(?P<AccountID>[^:\n]*):(?P<Ignore>(?P<ResourceType... |
MuonAnalysis/MomentumScaleCalibration/test/MuScleFitMuonProducer_cfg.py | ckamtsikis/cmssw | 852 | 77101 | # -*- coding: utf-8 -*-
import FWCore.ParameterSet.Config as cms
process = cms.Process("MUSCLEFITMUONPRODUCER")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1000)
)
process.source = cms.Source("PoolSource",
fileNames = cms.untrac... |
opytimizer/spaces/search.py | anukaal/opytimizer | 528 | 77151 | """Traditional-based search space.
"""
import copy
import opytimizer.utils.logging as l
from opytimizer.core import Space
logger = l.get_logger(__name__)
class SearchSpace(Space):
"""A SearchSpace class for agents, variables and methods
related to the search space.
"""
def __init__(self, n_agents... |
src/datasets/get_dataset.py | Immocat/ACTOR | 164 | 77185 | <filename>src/datasets/get_dataset.py
def get_dataset(name="ntu13"):
if name == "ntu13":
from .ntu13 import NTU13
return NTU13
elif name == "uestc":
from .uestc import UESTC
return UESTC
elif name == "humanact12":
from .humanact12poses import HumanAct12Poses
r... |
Autocoders/Python/src/fprime_ac/utils/ArrayGenerator.py | SSteve/fprime | 9,182 | 77197 | #!/usr/bin/env python3
# ===============================================================================
# NAME: EnumGenerator.py
#
# DESCRIPTION: A generator to produce serializable enum's
#
# AUTHOR: jishii
# EMAIL: <EMAIL>
# DATE CREATED : May 28, 2020
#
# Copyright 2020, California Institute of Technology.
# ALL ... |
tests/test_metrics/test_accuracy.py | Naoki-Wake/mmaction2 | 648 | 77222 | import os.path as osp
import random
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal, assert_array_equal
from mmaction.core import (ActivityNetLocalization,
average_recall_at_avg_proposals, confusion_matrix,
get_weighted_score, ... |
training/layers.py | BrandoZhang/alis | 176 | 77261 | <reponame>BrandoZhang/alis
from typing import Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
import torch.nn.functional as F
import numpy as np
from omegaconf import OmegaConf, DictConfig
from torch_utils import persistence
from torch_utils.ops import bias_act
from torch_utils import... |
examples/pybullet/gym/pybullet_envs/minitaur/robots/quadruped_base.py | felipeek/bullet3 | 9,136 | 77265 | <reponame>felipeek/bullet3
# Lint as: python3
"""The base class for all quadrupeds."""
from typing import Any, Callable, Dict, Sequence, Tuple, Text, Union
import gin
import gym
import numpy as np
from pybullet_utils import bullet_client
from pybullet_envs.minitaur.envs_v2.sensors import sensor as sensor_lib
from pybu... |
skeleton/OUTPUT-skel.py | tt1379/mastiff | 164 | 77268 | #!/usr/bin/env python
"""
Copyright 2012-2013 The MASTIFF Project, All Rights Reserved.
This software, having been partly or wholly developed and/or
sponsored by KoreLogic, Inc., is hereby released under the terms
and conditions set forth in the project's "README.LICENSE" file.
For a list of all contributors... |
tests/views/test_admin_statistics.py | priyanshu-kumar02/personfinder | 561 | 77278 | # Copyright 2019 Google 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,... |
submit/base_submission.py | ABCDa102030/GoBigger-Challenge-2021 | 121 | 77292 | class BaseSubmission:
def __init__(self, team_name, player_names):
self.team_name = team_name
self.player_names = player_names
def get_actions(self, obs):
'''
Overview:
You must implement this function.
'''
raise NotImplementedError
|
pyEX/timeseries/__init__.py | brandonhawi/pyEX | 335 | 77326 | # *****************************************************************************
#
# Copyright (c) 2021, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from .timeseries import (
timeSeries,
... |
hendrix/contrib/concurrency/signals.py | bliedblad/hendrix | 309 | 77347 | <reponame>bliedblad/hendrix
"""
Signals for easy use in django projects
"""
try:
from django import dispatch
short_task = dispatch.Signal(providing_args=["args", "kwargs"])
long_task = dispatch.Signal(providing_args=["args", "kwargs"])
message_signal = dispatch.Signal(providing_args=["data", "di... |
bin/plist.py | NaturalHistoryMuseum/inselect | 128 | 77361 | <filename>bin/plist.py
#!/usr/bin/env python3
"""Alter Inselect's existing plist file
"""
# https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCConcepts/LSCConcepts.html#//apple_ref/doc/uid/TP30000999-CH202-CIHHEGGE
import plistlib
import sys
import inselect
plist = plis... |
dapper/mods/Lorenz63/__init__.py | yoavfreund/DAPPER | 225 | 77362 | """The classic exhibitor of chaos, consisting of 3 coupled ODEs.
The ODEs are derived by modelling, with many simplifications,
the fluid convection between horizontal plates with different temperatures.
Its phase-plot (with typical param settings) looks like a butterfly.
See demo.py for more info.
"""
import numpy... |
python/shopping/content/accounts/add_user.py | akgarchi/googleads-shopping-samples | 149 | 77372 | <filename>python/shopping/content/accounts/add_user.py
#!/usr/bin/python
#
# Copyright 2016 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://ww... |
vec4ir/base.py | bees4ever/vec4ir | 211 | 77401 | <reponame>bees4ever/vec4ir<gh_stars>100-1000
#!/usr/bin/env python
# coding: utf-8
"""
File: base.py
Author: <NAME>
Email: <EMAIL>
Github: https://github.com/lgalke
Description: Base classed for (embedding-based) retrieval.
"""
from timeit import default_timer as timer
from abc import abstractmethod
from collections ... |
Trakttv.bundle/Contents/Libraries/Shared/plex_database/models/media_part.py | disrupted/Trakttv.bundle | 1,346 | 77404 | from plex_database.core import db
from plex_database.models.directory import Directory
from plex_database.models.media_item import MediaItem
from peewee import *
class MediaPart(Model):
class Meta:
database = db
db_table = 'media_parts'
media_item = ForeignKeyField(MediaItem, null=True, rela... |
python/task_worker.py | renato145/zmq.rs | 748 | 77407 | # encoding: utf-8
#
# Task worker - design 2
# Adds pub-sub flow to receive and respond to kill signal
#
# Author: <NAME> (brainsik) <spork(dash)zmq(at)theory(dot)org>
#
import sys
import time
import zmq
context = zmq.Context()
# Socket to receive messages on
receiver = context.socket(zmq.PULL)
receiver.connec... |
arviz/data/io_json.py | sudojarvis/arviz | 1,159 | 77413 | <filename>arviz/data/io_json.py
"""Input and output support for data."""
from .io_dict import from_dict
try:
import ujson as json
except ImportError:
# Can't find ujson using json
# mypy struggles with conditional imports expressed as catching ImportError:
# https://github.com/python/mypy/issues/1153
... |
terminus/event_listeners.py | timfjord/Terminus | 1,216 | 77425 | <gh_stars>1000+
import sublime
import sublime_plugin
import logging
import difflib
from random import random
from .clipboard import g_clipboard_history
from .recency import RecencyManager
from .terminal import Terminal
logger = logging.getLogger('Terminus')
class TerminusCoreEventListener(sublime_plugin.EventListe... |
rl/rl_utils/optimization.py | luanagbmartins/cavia | 122 | 77430 | <gh_stars>100-1000
import torch
def conjugate_gradient(f_Ax, b, cg_iters=10, residual_tol=1e-10):
p = b.clone().detach()
r = b.clone().detach()
x = torch.zeros_like(b).float()
rdotr = torch.dot(r, r)
for i in range(cg_iters):
z = f_Ax(p).detach()
v = rdotr / torch.dot(p, z)
... |
experimental/dang/esp32/script_test_nmpc_qpoases/test_nmpc_qpoases.py | mindThomas/acados | 322 | 77444 | #!/usr/bin/env python
# Tested with both Python 2.7.6 and Python 3.4.3
#
# This Python code collects the source code for testing acados
# on microcontrollers, putting all the necessary C files in
# one directory, and header files in the sub-directory include.
#
# The idea is that when compiling the testing code of aca... |
lib-src/lv2/lv2/waflib/extras/objcopy.py | joshrose/audacity | 7,892 | 77459 | #!/usr/bin/python
# <NAME> 2010
"""
Support for converting linked targets to ihex, srec or binary files using
objcopy. Use the 'objcopy' feature in conjunction with the 'cc' or 'cxx'
feature. The 'objcopy' feature uses the following attributes:
objcopy_bfdname Target object format name (eg. ihex, srec, binary).
... |
Hinting/Add TTF Autohint Control Instructions for Current Glyph.py | justanotherfoundry/Glyphs-Scripts | 283 | 77471 | <reponame>justanotherfoundry/Glyphs-Scripts
#MenuTitle: Add TTF Autohint Control Instructions for Current Glyph
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
try:
from builtins import str
except Exception as e:
print("Warning: 'future' module not installed. Run 'sudo pip in... |
tests/r/test_grunfeld1.py | hajime9652/observations | 199 | 77479 | <reponame>hajime9652/observations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.grunfeld1 import grunfeld1
def test_grunfeld1():
"""Test module grunfeld1.py by downloading
grunfeld1.csv a... |
tests/unit2/test_physics_engine_platformer.py | yegarti/arcade | 824 | 77502 | <filename>tests/unit2/test_physics_engine_platformer.py
import arcade
CHARACTER_SCALING = 0.5
GRAVITY = 0.5
def test_physics_engine(window):
arcade.set_background_color(arcade.color.AMAZON)
character_list = arcade.SpriteList()
character_sprite = arcade.Sprite(":resources:images/animated_characters/femal... |
python/cuml/test/dask/test_coordinate_descent.py | Nicholas-7/cuml | 2,743 | 77519 | <reponame>Nicholas-7/cuml
# Copyright (c) 2020, NVIDIA 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 by a... |
examples/rel_client.py | mrkeuz/websocket-client | 2,372 | 77523 | <filename>examples/rel_client.py
import websocket, rel
addr = "wss://api.gemini.com/v1/marketdata/%s"
if __name__ == "__main__":
rel.safe_read()
for symbol in ["BTCUSD", "ETHUSD", "ETHBTC"]:
ws = websocket.WebSocketApp(addr % (symbol,), on_message=lambda w, m : print(m))
ws.run_forever(dispatc... |
tests/test_visitors/test_ast/test_complexity/test_access/test_access.py | cdhiraj40/wemake-python-styleguide | 1,931 | 77540 | import pytest
from wemake_python_styleguide.violations.complexity import (
TooDeepAccessViolation,
)
from wemake_python_styleguide.visitors.ast.complexity.access import (
AccessVisitor,
)
# boundary expressions
subscript_access = 'my_matrix[0][0][0][0]'
attribute_access = 'self.attr.inner.wrapper.value'
mixed... |
src/quantum/azext_quantum/vendored_sdks/azure_quantum/models/_quantum_client_enums.py | ravithanneeru/azure-cli-extensions | 207 | 77542 | <gh_stars>100-1000
# 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 Genera... |
guillotina/json/__init__.py | rboixaderg/guillotina | 173 | 77544 | # make sure configure registrations are executed
from . import deserialize_content # noqa
from . import deserialize_value # noqa
from . import serialize_content # noqa
from . import serialize_schema # noqa
from . import serialize_schema_field # noqa
from . import serialize_value # noqa
|
PyFlow/Packages/PyFlowBase/Tools/LoggerTool.py | luzpaz/PyFlow | 1,463 | 77547 | <filename>PyFlow/Packages/PyFlowBase/Tools/LoggerTool.py
## Copyright 2015-2019 <NAME>, <NAME>
## 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... |
deepctr/layers/utils.py | dzzxjl/DeepCTR | 6,192 | 77549 | <gh_stars>1000+
# -*- coding:utf-8 -*-
"""
Author:
<NAME>,<EMAIL>
"""
import tensorflow as tf
from tensorflow.python.keras.layers import Flatten
from tensorflow.python.ops.lookup_ops import TextFileInitializer
try:
from tensorflow.python.ops.lookup_ops import StaticHashTable
except ImportError:
from tens... |
data_collection/gazette/spiders/pi_teresina.py | kaiocp/querido-diario | 454 | 77575 | <filename>data_collection/gazette/spiders/pi_teresina.py
import datetime
from urllib.parse import urlencode
import scrapy
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class PiTeresina(BaseGazetteSpider):
TERRITORY_ID = "2211001"
name = "pi_teresina"
allowed_domain... |
tests/layer_tests/tensorflow_tests/test_tf_LogSoftmax.py | ryanloney/openvino-1 | 1,127 | 77577 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from distutils.version import LooseVersion
import numpy as np
import pytest
from common.layer_test_class import check_ir_version
from common.tf_layer_test_class import CommonTFLayerTest
from common.utils.tf_utils import permute_nchw_to_... |
src/oci/optimizer/models/update_enrollment_status_details.py | Manny27nyc/oci-python-sdk | 249 | 77580 | <filename>src/oci/optimizer/models/update_enrollment_status_details.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache Licens... |
src/oddt/build/lib/oddt/shape.py | annacarbery/VS_ECFP | 264 | 77615 | import logging
import numpy as np
from numpy.linalg import norm
from scipy.stats import moment
from scipy.special import cbrt
def common_usr(molecule, ctd=None, cst=None, fct=None, ftf=None, atoms_type=None):
"""Function used in USR and USRCAT function
Parameters
----------
molecule : oddt.toolkit.M... |
examples/maml_toy.py | Brikwerk/learn2learn | 1,774 | 77655 | #!/usr/bin/env python3
"""
This script demonstrates how to use the MAML implementation of L2L.
Each task i consists of learning the parameters of a Normal distribution N(mu_i, sigma_i).
The parameters mu_i, sigma_i are themselves sampled from a distribution N(mu, sigma).
"""
import torch as th
from torch import nn, ... |
apex/amp/lists/torch_overrides.py | oyj0594/apex | 6,523 | 77675 | import torch
from .. import utils
MODULE = torch
FP16_FUNCS = [
# Low level functions wrapped by torch.nn layers.
# The wrapper layers contain the weights which are then passed in as a parameter
# to these functions.
'conv1d',
'conv2d',
'conv3d',
'conv_transpose1d',
'conv_transpose2d'... |
celer/datasets/libsvm.py | Badr-MOUFAD/celer | 137 | 77679 | # Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
import warnings
import libsvmdata
def fetch_libsvm(dataset, replace=False, normalize=True, min_nnz=3):
"""
This function is deprecated, we now rely on the libsvmdata package.
Parameters
----------
dataset: string
Name of the dataset.
... |
src/python/test/test_alpha_complex.py | m0baxter/gudhi-devel | 146 | 77694 | <gh_stars>100-1000
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
Author(s): <NAME>
Copyright (C) 2016 Inria
Modification(s):
- YYYY/MM Author: Descrip... |
openfermioncirq/experiments/hfvqe/molecular_example_odd_qubits.py | unpilbaek/OpenFermion-Cirq | 278 | 77720 | <reponame>unpilbaek/OpenFermion-Cirq<gh_stars>100-1000
import os
from typing import Tuple
import numpy as np
import openfermion as of
import scipy as sp
import openfermioncirq.experiments.hfvqe as hfvqe
from openfermioncirq.experiments.hfvqe.gradient_hf import rhf_minimization
from openfermioncirq.experiments.hfvqe.o... |
binance_d/model/commissionrate.py | vinayakpathak/Binance_Futures_python | 640 | 77743 | <gh_stars>100-1000
"""
return the taker/maker commission rate
"""
class CommissionRate:
def __init__(self):
self.symbol = ""
self.makerCommissionRate = 0.0
self.takerCommissionRate = 0.0
@staticmethod
def json_parse(json_data):
result = CommissionRate()
result.symbo... |
tests/test_describe_graph_line.py | winbo/GitSavvy | 2,058 | 77751 | from unittesting import DeferrableTestCase
from GitSavvy.tests.parameterized import parameterized as p
from GitSavvy.core.commands.log_graph import describe_graph_line
examples = [
(
"|",
{},
None
),
(
"● a3062b2 (HEAD -> optimize-graph-render, origin/optimize-graph-render... |
tensorflow/python/keras/_impl/keras/layers/__init__.py | M155K4R4/Tensorflow | 522 | 77797 | # 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... |
src/test/tests/unit/atts_assign.py | visit-dav/vis | 226 | 77837 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: atts_assign.py
#
# Tests: Behavior of assignment for attribute objects. Ensures good cases
# succeed and bad cases fail with specific python exceptions. Tests variety
# of types present in members of V... |
fireant/tests/queries/test_build_sets.py | gl3nn/fireant | 122 | 77858 | from unittest import TestCase
from pypika import (
Table,
functions as fn,
)
import fireant as f
from fireant.tests.dataset.mocks import test_database
test_table = Table("test")
ds = f.DataSet(
table=test_table,
database=test_database,
fields=[
f.Field("date", definition=test_table.date, ... |
reddit2telegram/channels/~inactive/r_hermitcraft/app.py | CaringCat/reddit2telegram | 187 | 77877 | #encoding:utf-8
subreddit = 'HermitCraft'
t_channel = '@r_HermitCraft'
def send_post(submission, r2t):
return r2t.send_simple(submission, min_upvotes_limit=100)
|
datasets/wiki_hop/wiki_hop.py | zidingz/datasets | 10,608 | 77914 | # coding=utf-8
# Copyright 2020 The HuggingFace Datasets 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 app... |
tatsu/tokenizing.py | bookofproofs/TatSu | 259 | 77915 | <reponame>bookofproofs/TatSu
from __future__ import annotations
from .util._common import _prints
from .exceptions import ParseError # noqa
class Tokenizer:
def error(self, *args, **kwargs):
raise ParseError(_prints(*args, **kwargs))
@property
def filename(self):
raise NotImplementedErr... |
allennlp/fairness/bias_utils.py | MSLars/allennlp | 11,433 | 77918 | import torch
import json
from os import PathLike
from typing import List, Tuple, Union, Optional
from allennlp.common.file_utils import cached_path
from allennlp.data import Vocabulary
from allennlp.data.tokenizers.tokenizer import Tokenizer
def _convert_word_to_ids_tensor(word, tokenizer, vocab, namespace, all_case... |
bin/train_neural_net.py | dbdean/DeepOSM | 1,365 | 77925 | #!/usr/bin/env python
"""Train a neural network using OpenStreetMap labels and NAIP images."""
import argparse
from src.single_layer_network import train_on_cached_data
def create_parser():
"""Create the argparse parser."""
parser = argparse.ArgumentParser()
parser.add_argument("--neural-net",
... |
thermo/eos_alpha_functions.py | RoryKurek/thermo | 380 | 77929 | <filename>thermo/eos_alpha_functions.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# pylint: disable=E1101
r'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2018, 2019, 2020 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this... |
fastmri_recon/models/subclassed_models/vnet.py | chaithyagr/fastmri-reproducible-benchmark | 105 | 77944 | <gh_stars>100-1000
import tensorflow as tf
from tensorflow.keras.layers import Layer, Conv3D, LeakyReLU, PReLU, UpSampling3D, MaxPooling3D, Activation
from tensorflow.keras.models import Model
from ..utils.complex import to_complex
from ..utils.fourier import AdjNFFT
class Conv(Layer):
def __init__(self, n_filte... |
thop/vision/onnx_counter.py | jinmingyi1998/pytorch-OpCounter | 3,444 | 77945 | import torch
import numpy as np
from onnx import numpy_helper
from thop.vision.basic_hooks import zero_ops
from .counter import counter_matmul, counter_zero_ops,\
counter_conv, counter_mul, counter_norm, counter_pow,\
counter_sqrt, counter_div, counter_softmax, counter_avgpool
def onnx_counter_matmul(diction,... |
foresight/mysql/rand.py | abdulmohit/foresight | 193 | 77946 | """ Predicts outputs of the MySQL 'rand' function. For example,
mysql> CREATE TABLE t (i INT);
mysql> INSERT INTO t VALUES(1),(2),(3);
mysql> SELECT i, RAND() FROM t;
+------+------------------+
| i | RAND() |
+------+------------------+
| 1 | 0.61914388706828 |
| 2 | 0.93... |
tests/test_04_online.py | vanheeringen-lab/genomepy | 146 | 77955 | <filename>tests/test_04_online.py
import os
import urllib.error
import urllib.request
from tempfile import NamedTemporaryFile
import pytest
import genomepy.online
from tests import linux, travis
def test_download_file():
# HTTP
tmp = NamedTemporaryFile().name
assert not os.path.exists(tmp)
url = "ht... |
common.py | johnding1996/UMD-CMSC726-Project | 118 | 77960 | from torch import nn
class FeedForwardNet(nn.Module):
def __init__(self, inp_dim, hidden_dim, outp_dim, n_layers, nonlinearity, dropout=0):
super().__init__()
layers = []
d_in = inp_dim
for i in range(n_layers):
module = nn.Linear(d_in, hidden_dim)
self.rese... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.