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 |
|---|---|---|---|---|---|---|---|---|---|---|
DQM/L1TMonitorClient/python/L1TOccupancyClient_cff.py | ckamtsikis/cmssw | 852 | 1605203 | import FWCore.ParameterSet.Config as cms
from DQM.L1TMonitorClient.L1TOccupancyClient_cfi import *
| 0 | 0 | 0 | 0 | 0 | 0 |
src/python/twitter/common/java/perfdata/bin/jammystat.py | zhouyijiaren/commons | 1,143 | 1605205 | <filename>src/python/twitter/common/java/perfdata/bin/jammystat.py
# ==================================================================================================
# Copyright 2013 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the... | 0 | 0 | 0 | 0 | 0 | 0 |
core_scripts/op_manager/conf.py | Nijta/project-NN-Pytorch-scripts | 150 | 1605227 | <reponame>Nijta/project-NN-Pytorch-scripts
#!/usr/bin/env python
"""
config.py
Default configurations for optimizer
Note: these default configs only apply when input argument
doesn't specify the parameters
"""
from __future__ import absolute_import
import os
import sys
__author__ = "<NAME>"
__email__ = "<EMAIL>"
_... | 0 | 0 | 0 | 0 | 0 | 0 |
denoise.py | dumpmemory/En-transformer | 108 | 1605276 | import torch
import torch.nn.functional as F
from torch import nn
from torch.optim import Adam
from einops import rearrange, repeat
import sidechainnet as scn
from en_transformer.en_transformer import EnTransformer
torch.set_default_dtype(torch.float64)
BATCH_SIZE = 1
GRADIENT_ACCUMULATE_EVERY = 16
def cycle(loader... | 1 | 0 | 0 | 0 | 1 | 0 |
mmflow/models/flow_estimators/flownet.py | hologerry/mmflow | 481 | 1605295 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, Optional, Sequence, Tuple, Union
from mmcv.utils import Config
from numpy import ndarray
from torch import Tensor
from ..builder import FLOW_ESTIMATORS, build_encoder
from .pwcnet import PWCNet
@FLOW_ESTIMATORS.register_module()
class FlowNetS... | 15 | 7 | 0 | 0 | 22 | 0 |
04-text-byte/stdout_check.py | SeirousLee/example-code-2e | 990 | 1605304 | <filename>04-text-byte/stdout_check.py
import sys
from unicodedata import name
print(sys.version)
print()
print('sys.stdout.isatty():', sys.stdout.isatty())
print('sys.stdout.encoding:', sys.stdout.encoding)
print()
test_chars = [
'\N{HORIZONTAL ELLIPSIS}', # exists in cp1252, not in cp437
'\N{INFINITY}... | 0 | 0 | 0 | 0 | 0 | 0 |
stix_shifter_utils/stix_translation/src/json_to_stix/json_to_stix.py | pyromaneact/stix-shifter | 129 | 1605310 | <reponame>pyromaneact/stix-shifter<gh_stars>100-1000
import json
import importlib
from stix_shifter_utils.modules.base.stix_translation.base_results_translator import BaseResultTranslator
from stix_shifter_utils.stix_translation.src.utils.exceptions import LoadJsonResultsException, TranslationResultException
# Concret... | 0 | 0 | 0 | 0 | 0 | 0 |
foreman/data_refinery_foreman/foreman/management/commands/import_external_sample_attributes.py | AlexsLemonade/refinebio | 106 | 1605336 | <reponame>AlexsLemonade/refinebio
"""
This command will import metadata that has been supplied by an external
contributor in our JSON format and apply it to our samples. NOTE: It assumes
that the metadata is properly formatted, so for some sources we might have to
write some glue code to put it into the correct format ... | 0 | 0 | 0 | 0 | 0 | 0 |
SMPyBandits/Policies/GreedyOracle.py | balbok0/SMPyBandits | 309 | 1605349 | """
author: <NAME>
Oracle and near-minimax policy for rotting bandits without noise.
Reference: [Heidari et al., 2016, https://www.ijcai.org/Proceedings/16/Papers/224.pdf]
Tight Policy Regret Bounds for Improving and Decaying Bandits.
<NAME>, <NAME>, <NAME>.
International Joint Conference on Artificial Intelligence (... | 0 | 3 | 0 | 0 | 3 | 0 |
server.py | flipkart-incubator/optimus | 123 | 1605391 | <filename>server.py<gh_stars>100-1000
from collections import OrderedDict
import json
from flask import Flask, request
import sys
import numpy
from cnn_text_trainer.rw.datasets import clean_str
__author__ = 'devashish.shankar'
#General refactoring, comments, etc.
app = Flask(__name__)
app.config['SECRET_KEY'] = 'F... | 0 | 0 | 0 | 0 | 0 | 0 |
findatapy_examples/eikondata_example.py | DT021/findatapy | 1,205 | 1605417 | <gh_stars>1000+
__author__ = 'saeedamen' # <NAME>
#
# Copyright 2016-2020 Cuemacro
#
# 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 |
Python/Clipboard/db.py | saurabhcommand/Hello-world | 1,428 | 1605424 | from datetime import datetime
from peewee import SqliteDatabase, CharField, DateTimeField, Model
db = SqliteDatabase("clipboard.db")
class Paste(Model):
text = CharField()
date = DateTimeField()
class Meta:
database = db
db.create_tables([Paste])
def save_new_paste(text):
paste = Paste(t... | 0 | 2 | 0 | 0 | 2 | 0 |
adet/modeling/fcpose/fcpose_framework.py | isolution911/AdelaiDet | 2,597 | 1605430 | <reponame>isolution911/AdelaiDet
import math
from typing import List, Dict
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.modeling.proposal_generator.build import PROPOSAL_GENERATOR_REGISTRY
from detectron2.layers import ShapeSpec, NaiveSyncBatchNorm
from adet.modeling.fcos impor... | 0 | 0 | 0 | 0 | 0 | 0 |
health_check/contrib/celery_ping/__init__.py | anushbmx/django-health-check | 739 | 1605441 | default_app_config = 'health_check.contrib.celery_ping.apps.HealthCheckConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
ott/tools/gaussian_mixture/gaussian_mixture.py | theouscidda6/ott | 110 | 1605486 | # coding=utf-8
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 28 | 33 | 0 | 0 | 61 | 0 |
refinery/bnpy/bnpy-dev/tests/allocmodel/TestMixModel.py | csa0001/Refinery | 103 | 1605488 | '''
Unit-tests for MixModel.py
'''
import numpy as np
import bnpy
from bnpy.allocmodel import MixModel
from bnpy.suffstats import SuffStatBag
class TestMixModelEMUnifAlpha(object):
def shortDescription(self):
return None
def setUp(self):
'''
Create a stupid simple case for making sure we're calculatin... | 0 | 0 | 0 | 0 | 0 | 0 |
syzygy/py/etw_db/etw_db/module.py | nzeh/syzygy | 343 | 1605523 | #!python
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 0 | 6 | 0 | 2 | 8 | 0 |
downstream/votenet/lib/utils/io3d.py | ut-amrl/ContrastiveSceneContexts | 135 | 1605530 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import math
import numpy as np
import trimesh
# color palette for nyu40 labels
def create_color_palette(... | 2 | 8 | 0 | 0 | 10 | 0 |
jenkinsapi_utils/simple_post_logger.py | ChandlerSwift/jenkinsapi | 556 | 1605539 | from __future__ import print_function
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
from http.server import SimpleHTTPRequestHandler
try:
import SocketServer as socketserver
except ImportError:
import socketserver
import logging
import cgi
PORT = 8080
class ServerH... | 0 | 0 | 0 | 0 | 0 | 0 |
analysis/sys_id/make_sine_waveform.py | leozz37/makani | 1,178 | 1605570 | #!/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 |
idea/__init__.py | mikiec84/idea-box | 111 | 1605582 | <reponame>mikiec84/idea-box
from django.contrib.comments.signals import comment_was_posted
from django.dispatch import receiver
@receiver(comment_was_posted)
def send_idea_notifications(sender, comment, request, **kwargs):
# If installed in collab
try:
from core.notifications.models import Notificatio... | 0 | 0 | 0 | 0 | 0 | 0 |
PWG/MCLEGO/Therminator2/apply_custom_config.py | maroozm/AliPhysics | 114 | 1605585 | #!/usr/bin/python
from os import environ as env
import os
import subprocess
from sys import argv
model_to_file = {
"KrakowSFO": "krakow.ini",
"BlastWave": "blastwave.ini",
"BWAVT": "bwa.ini",
"BWAVTDelay": "bwa.ini",
"BWAVLinear": "bwa.ini",
"BWAVLinearDelay": "bwa.ini",
"BWAVLinearFormati... | 0 | 1 | 0 | 0 | 1 | 0 |
misc/python/materialize/optbench/__init__.py | guylapid/materialize | 3,840 | 1605606 | # Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | 2 | 6 | 0 | 0 | 8 | 0 |
src/ingestion/task.py | monosidev/monosi | 156 | 1605681 | from dataclasses import dataclass
from typing import Any, List
@dataclass
class TaskUnit:
request: Any
def run(self, extractor):
yield extractor.run(self)
@dataclass
class MultiTaskUnit(TaskUnit):
request: Any
def run(self, extractor) -> object:
return extractor.run_multiple(self)
... | 1 | 2 | 4 | 0 | 7 | 0 |
scripts/artifacts/fitbitSleep.py | Krypterry/ALEAPP | 187 | 1605688 | <reponame>Krypterry/ALEAPP<filename>scripts/artifacts/fitbitSleep.py
import sqlite3
import textwrap
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, open_sqlite_db_readonly
def get_fitbitSleep(files_found, report_folder, seeker, wrap_tex... | 0 | 0 | 0 | 0 | 0 | 0 |
models/models_2_3.py | 1202kbs/Understanding-NN | 324 | 1605698 | from tensorflow.python.ops import nn_ops, gen_nn_ops
import tensorflow as tf
class MNIST_NN:
def __init__(self, name):
self.name = name
def __call__(self, X, reuse: bool=False) -> tuple[list[object], object]:
with tf.variable_scope(self.name) as scope:
if reuse:
... | 4 | 8 | 0 | 0 | 12 | 0 |
homeassistant/components/imap_email_content/__init__.py | domwillcode/home-assistant | 30,023 | 1605710 | <reponame>domwillcode/home-assistant
"""The imap_email_content component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
334 Increasing Triplet Subsequence py3.py | krishna13052001/LeetCode | 872 | 1605714 | #!/usr/bin/python3
"""
Given an unsorted array return whether an increasing subsequence of length 3
exists or not in the array.
Formally the function should:
Return true if there exists i, j, k
such that arr[i] < arr[j] < arr[k] given 0 ≤ i < j < k ≤ n-1 else return false.
Note: Your algorithm should run in O(n) time... | 1 | 1 | 0 | 0 | 2 | 0 |
usaspending_api/etl/tests/test_helpers.py | g4brielvs/usaspending-api | 217 | 1605718 | <filename>usaspending_api/etl/tests/test_helpers.py
import contextlib
import csv
import os
import tempfile
@contextlib.contextmanager
def mutated_csv(filename, mutator):
"""Returns tempfile copied from filename, but mutated.
If `filename` points to a CSV, then we load it,
apply the `mutator` function to ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/pingen.py | otherbeast/hackers-tool-kit | 393 | 1605752 | #!/usr/bin/env python
#
# Calculates the default WPS pin from the BSSID/MAC of many D-Link routers/APs.
#
# <NAME>
# Tactical Network Solutions
class WPSException(Exception):
pass
class WPS(object):
def checksum(self, pin) -> object:
'''
Standard WPS checksum algorithm.
@pin - A 7 di... | 0 | 3 | 0 | 0 | 3 | 0 |
leetcode.com/python/92_Reverse_Linked_List_II.py | vansh-tiwari/coding-interview-gym | 713 | 1605772 | """""
The problem follows the In-place Reversal of a LinkedList pattern. We can use a similar approach as discussed in Reverse a LinkedList. Here are the steps we need to follow:
1. Skip the first p-1 nodes, to reach the node at position p.
2. Remember the node at position p-1 to be used later to connect with the re... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/portfolio.py | Ying1123/pysmt | 435 | 1605803 | <reponame>Ying1123/pysmt
# Portfolio solving makes it possible to run multiple solvers in
# parallel. As soon as the first solver completes, all other solvers
# are stopped. Current support for portfolio is mostly focused on
# one-shot calls, with only functional incrementality: the interface
# looks incremental, but... | 0 | 0 | 0 | 0 | 0 | 0 |
test/nn/models/test_rev_gnn.py | rusty1s/pytorch-geometric | 2,350 | 1605810 | import pytest
import torch
from torch_geometric.nn import GraphConv, GroupAddRev, SAGEConv
from torch_geometric.nn.dense.linear import Linear
@pytest.mark.parametrize('num_groups', [2, 4, 8, 16])
def test_revgnn_forward_inverse(num_groups):
x = torch.randn(4, 32)
edge_index = torch.tensor([[0, 1, 2, 3], [0, ... | 0 | 0 | 0 | 0 | 0 | 0 |
virl/cli/ssh/commands.py | tombry/virlutils | 133 | 1605850 | import click
from virl.api import VIRLServer
from subprocess import call
from virl import helpers
from virl.helpers import get_mgmt_lxc_ip, get_node_from_roster, get_cml_client, get_current_lab, safe_join_existing_lab, get_node_mgmt_ip
from virl2_client.exceptions import NodeNotFound
@click.command()
@click.argument(... | 0 | 1 | 0 | 0 | 1 | 0 |
Python/stable-marriage-pairing.py | iam-abbas/cs-algorithms | 239 | 1605858 | <filename>Python/stable-marriage-pairing.py
import random # Used in illustrative text case
# ---------------------------------------functions------------------------------------
class UnstableTableError(Exception):
""" Error for unstable table when no stable pairings are possible. """
def make_proposals(prefe... | 0 | 0 | 0 | 0 | 0 | 0 |
ufora/FORA/python/PurePython/BinaryOperators_test.py | ufora/ufora | 571 | 1605878 | # Copyright 2015 Ufora 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 i... | 0 | 7 | 0 | 0 | 7 | 0 |
micro-benchmark/snippets/returns/imported_call/to_import.py | WenJinfeng/PyCG | 121 | 1605879 | <filename>micro-benchmark/snippets/returns/imported_call/to_import.py
def return_func():
pass
def func():
return return_func
| 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/migrations/0063_auto_20210407_0045.py | mouse-reeve/fedireads | 270 | 1605888 | # Generated by Django 3.1.6 on 2021-04-07 00:45
import bookwyrm.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("bookwyrm", "0062_auto_20210406_1731"),
]
operations: list[object] = [
migrations.AddField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
moonlight/tools/export_kmeans_centroids.py | lithomas1/moonlight | 288 | 1605889 | <filename>moonlight/tools/export_kmeans_centroids.py<gh_stars>100-1000
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICE... | 0 | 0 | 0 | 0 | 0 | 0 |
Longest Palindromic Substring.py | RijuDasgupta9116/LintCode | 321 | 1605909 | """
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000,
and there exists one unique longest palindromic substring.
Example
Given the string = "abcdzdcab", return "cdzdc".
Challenge
O(n^2) time is acceptable. Can you do it in O(n) time.
"""
__author__ = '... | 0 | 1 | 0 | 0 | 1 | 0 |
fit_lmk3d.py | Rubikplayer/flame-fitting | 394 | 1605928 | from __future__ import annotations
'''
Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V. (MPG) is holder of all proprietary rights on this computer program.
Using this computer program means that you agree to the terms in the LICENSE file (https://flame.is.tue.mpg.de/modellicense) included
with the FLAME... | 3 | 1 | 0 | 0 | 4 | 0 |
tacotron/synthesize.py | begeekmyfriend/Tacotron-2 | 168 | 1605930 | from __future__ import annotations
import argparse
import os
import re
import time
import numpy as np
from time import sleep
from datasets import audio
import tensorflow as tf
from hparams import hparams, hparams_debug_string
from infolog import log
from tacotron.synthesizer import Synthesizer
from tqdm import tqdm
d... | 1 | 0 | 0 | 0 | 1 | 0 |
tests/utils/fmt.py | sjmudd/mysql-operator | 206 | 1605969 | <reponame>sjmudd/mysql-operator<gh_stars>100-1000
# Copyright (c) 2020, Oracle and/or its affiliates.
#
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
def red(*args):
s = " ".join(args)
return "\033[0;31m%s\033[0m" % s
def lred(*args):
s = " ".j... | 0 | 0 | 0 | 0 | 0 | 0 |
feapder/commands/create/create_setting.py | RuixiangS/feapder | 876 | 1605990 | # -*- coding: utf-8 -*-
"""
Created on 2021/4/23 13:20
---------
@summary: 生成配置文件
---------
@author: mkdir700
@email: <EMAIL>
"""
import os
import shutil
class CreateSetting:
def create(self) -> None:
if os.path.exists("setting.py"):
confirm = input("配置文件已存在 是否覆盖 (y/n). ")
if co... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/import/import-from.test/import-oven.py | nanolikeyou/pysonar2 | 2,574 | 1606009 | # from kitchen import a module oven
from kitchen import oven
pizza = oven.Pizza()
print pizza.size
bread = oven.Bread()
print bread.size
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cwl/tests/test_fsaccess.py | rpatil524/arvados | 222 | 1606027 | <reponame>rpatil524/arvados
# Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
import functools
import mock
import sys
import unittest
import json
import logging
import os
import arvados
import arvados.keep
import arvados.collection
import arvados_cwl
from cwltool.pathm... | 0 | 0 | 0 | 0 | 0 | 0 |
lightnlp/base/tool.py | CNLPT/lightNLP | 889 | 1606049 | <filename>lightnlp/base/tool.py
from abc import ABCMeta, abstractclassmethod
class Tool(metaclass=ABCMeta):
@abstractclassmethod
def get_dataset(cls, *args, **kwargs):
pass
@abstractclassmethod
def get_vocab(cls, *args, **kwargs):
pass
@abstractclassmethod
def get_vectors(cls... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/npm_conf.py | uphold-forks/node-oauth2-server | 2,947 | 1606070 | <reponame>uphold-forks/node-oauth2-server<filename>docs/npm_conf.py
# -*- coding: utf-8 -*-
""" Helper module for sphinx' conf.py.
Useful when building documentation for npm packages.
"""
import json
import re
from datetime import datetime
def load_package_json(path):
""" Loads package.json from 'path'.
... | 0 | 0 | 0 | 0 | 0 | 0 |
build/deps.py | li0ard/leaflet-plugins-1 | 435 | 1606097 | <filename>build/deps.py
#!/usr/bin/env python
# vim: sts=4 sw=4 et
import os, sys
printed = set()
def includes(f):
d = os.path.dirname(f)
for l in open(f):
if l.startswith('//#include'):
yield os.path.join(d, l.strip().split(None, 1)[1].strip(""""'"""))
work = list(sys.argv[1:])
while w... | 0 | 0 | 0 | 0 | 0 | 0 |
aries_cloudagent/vc/ld_proofs/suites/__init__.py | spgrammatakis/aries-cloudagent-python | 247 | 1606258 | from .linked_data_proof import LinkedDataProof
from .linked_data_signature import LinkedDataSignature
from .jws_linked_data_signature import JwsLinkedDataSignature
from .ed25519_signature_2018 import Ed25519Signature2018
from .bbs_bls_signature_2020 import BbsBlsSignature2020
from .bbs_bls_signature_proof_2020 import B... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/md_viz/statdist.py | faradaymahe/VASPpy | 225 | 1606272 | <reponame>faradaymahe/VASPpy<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy.linalg import norm
from vaspy.iter import XdatCar, AniFile
fixed_coord = [0.00000000, 1.92610195, 10.69285799]
O_index = 1
max_x = 0.5
max_y = 0.5
def pdc_coord(coord):
''' Process the coor... | 0 | 0 | 0 | 0 | 0 | 0 |
app/extensions/orm_admin/config.py | Allen7D/mini-shop-server | 533 | 1606280 | <reponame>Allen7D/mini-shop-server<filename>app/extensions/orm_admin/config.py
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2020/4/13.
"""
__author__ = 'Allen7D'
# flask-admin配置
FLASK_ADMIN_SWATCH = 'cerulean'
# all model by module for flask-admin
ALL_MODEL_BY_MODULE = {
'user': ['User'],
'identity': [... | 0 | 0 | 0 | 0 | 0 | 0 |
carbonserver/carbonserver/api/domain/runs.py | nikhil153/codecarbon | 346 | 1606287 | import abc
from carbonserver.api import schemas
class Runs(abc.ABC):
@abc.abstractmethod
def add_run(self, run: schemas.RunCreate):
raise NotImplementedError
| 1 | 0 | 0 | 0 | 1 | 0 |
src/enamlnative/widgets/calendar_view.py | codelv/enaml-native | 237 | 1606319 | """
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import (
Typed, ForwardTyped, Range, Instance, observe, set_default
)
from datetime import datetime
from... | 0 | 0 | 0 | 0 | 0 | 0 |
bimpy/app.py | torss/bimpy | 183 | 1606340 | <gh_stars>100-1000
# Copyright 2017-2020 <NAME>. All rights reserved.
# License: https://raw.githubusercontent.com/podgorskiy/bimpy/master/LICENSE.txt
import bimpy
class App:
r"""A base class for the application.
.. note::
You need to implement your own application class that derives from this class... | 0 | 0 | 0 | 0 | 0 | 0 |
torch_glow/tests/nodes/size_test.py | YaronBenAtar/glow | 2,838 | 1606357 | # Copyright (c) Glow Contributors. See CONTRIBUTORS file.
#
# 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 ... | 0 | 1 | 0 | 0 | 1 | 0 |
lenskit/data/sampling.py | keener101/lkpy | 210 | 1606398 | <filename>lenskit/data/sampling.py
import numpy as np
from numba import njit
@njit
def sample_unweighted(mat):
"""
Candidate sampling function for use with :py:func:`neg_sample`.
It samples items uniformly at random.
"""
return np.random.randint(0, mat.ncols)
@njit
def sample_weighted(mat):
... | 0 | 0 | 0 | 0 | 0 | 0 |
utime/dataset/queue/__init__.py | learning310/U-Time | 138 | 1606404 | <filename>utime/dataset/queue/__init__.py
from .study_loader import StudyLoader
from .limitation_queue import LimitationQueue
from .lazy_queue import LazyQueue
from .eager_queue import EagerQueue
| 0 | 0 | 0 | 0 | 0 | 0 |
Py Apple Dynamics V6.8/Py Apple Dynamics V6.8 固件及程序/V6.8 源代码/main.py | Musyue/py-apple-quadruped-robot | 495 | 1606494 | <reponame>Musyue/py-apple-quadruped-robot
import _thread
import padog
import time
from machine import Timer
from machine import UART
from padog import g,m
#
from machine import time_pulse_us
from machine import Pin
#run_mode=0:web遥控模式
#run_mode=1:OpenMV 巡线模式
#run_mode=2:OpenMV 颜色识别模式
#run_mode=3:调试模式
run_mode=0
uar... | 0 | 0 | 0 | 0 | 0 | 0 |
Problem028/Python/solution_1.py | drocha87/ProjectEuler | 167 | 1606551 | <gh_stars>100-1000
#!/usr/bin/env python
# coding=utf-8
# Python Script
#
# Copyleft © <NAME>
#
#
"""
Number spiral diagonals
Problem 28
Starting with the number 1 and moving to the right in a
clockwise direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 ... | 0 | 0 | 0 | 0 | 0 | 0 |
hill_cipher/hillCipher.py | tre3x/awesomeScripts | 245 | 1606586 | <reponame>tre3x/awesomeScripts<filename>hill_cipher/hillCipher.py
import numpy as np
def convertToNumbers(string):
string = string.strip().replace(" ", "")
if len(string) % 2:
string = string + 'z'
result = [ord(i) - 97 for i in string]
return np.reshape(result, (len(result) // 2, 2))
def ge... | 0 | 0 | 0 | 0 | 0 | 0 |
DQM/L1TMonitor/python/L1TRPCTPG_cfi.py | ckamtsikis/cmssw | 852 | 1606587 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
l1trpctpg = DQMEDAnalyzer('L1TRPCTPG',
disableROOToutput = cms.untracked.bool(True),
rpctpgSource = cms.InputTag("rpcunpacker"),
rpctfSource = cms.InputTag("l1GtUnpack"),
verbose = cms.u... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functions/test_get_hybrid_properties.py | jarkkorantala/sqlalchemy-utils | 879 | 1606606 | import pytest
import sqlalchemy as sa
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy_utils import get_hybrid_properties
@pytest.fixture
def Category(Base) -> object:
class Category(Base):
__tablename__ = 'category'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.... | 0 | 3 | 0 | 0 | 3 | 0 |
setup.py | KamitaniLab/pyHSICLasso | 122 | 1606640 | <reponame>KamitaniLab/pyHSICLasso
#!/usr/bin/env python
# coding: utf-8
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "R... | 0 | 0 | 0 | 0 | 0 | 0 |
production_tests/conftest.py | mepsd/CLAC | 126 | 1606653 | <filename>production_tests/conftest.py
from .util import ProductionTestCase
def pytest_addoption(parser):
parser.addoption('--origin', dest='origin',
default='https://calc.gsa.gov',
help='origin of production server')
def pytest_configure(config):
ProductionTestCase... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/selfsup/byol/byol_resnet50_8xb32-accum16-coslr-300e_in1k.py | mitming/mmselfsup | 355 | 1606686 | _base_ = 'byol_resnet50_8xb32-accum16-coslr-200e_in1k.py'
# runtime settings
runner = dict(type='EpochBasedRunner', max_epochs=300)
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | wasimakh2/self-driving-desktop | 536 | 1606714 |
import setuptools
with open('README.md', 'r') as f:
long_description = f.read()
setuptools.setup(
name='self-driving-desktop',
version='0.0.7',
author='Hofstadter, Inc.',
author_email='<EMAIL>',
description='Desktop Automation Framework. Drive your keyboard and mouse with text files.',
lo... | 0 | 0 | 0 | 0 | 0 | 0 |
testcases/elichika_tests/chainercv_model/transforms/bbox/resize_bbox.py | vermashresth/chainer-compiler | 1,600 | 1606774 | <gh_stars>1000+
def resize_bbox(bbox, in_size, out_size):
"""Resize bounding boxes according to image resize.
Args:
bbox (~numpy.ndarray): See the table below.
in_size (tuple): A tuple of length 2. The height and the width
of the image before resized.
out_size (tuple): A tup... | 0 | 0 | 0 | 0 | 0 | 0 |
doubleml/tests/test_irm_tune.py | SvenKlaassen/doubleml-for-py | 103 | 1606804 | import numpy as np
import pytest
import math
from sklearn.base import clone
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestRegressor
import doubleml as dml
from ._utils import draw_smpls
from ._utils_irm_manual import fit_irm, boot_irm, tune_nuisance_irm
@pytest.fixtu... | 0 | 7 | 0 | 0 | 7 | 0 |
tests/test_end_to_end/test_gen_entities.py | rubmz/bootleg | 160 | 1606827 | """Test generate entities."""
import os
import shutil
import unittest
import emmental
import numpy as np
import torch
import ujson
import bootleg.extract_all_entities as extract_all_entities
import bootleg.run as run
from bootleg.utils import utils
from bootleg.utils.parser import parser_utils
class TestGenEntities... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/packerlicious/test_provisioner_breakpoint.py | thor/packerlicious | 109 | 1606867 | import packerlicious.provisioner as provisioner
class TestBreakpointProvisioner(object):
def test_no_required_fields(self):
b = provisioner.Breakpoint()
b.to_dict()
| 0 | 0 | 0 | 0 | 0 | 0 |
thred/util/log.py | panxuemiao111/THRED | 102 | 1606921 | from __future__ import annotations
import sys
import time
import tensorflow as tf
def print_time(s, start_time) -> object:
"""Take a start time, print elapsed duration, and return a new time."""
print("%s, time %ds, %s." % (s, (time.time() - start_time), time.ctime()))
# sys.stdout.flush()
return ti... | 3 | 1 | 0 | 0 | 4 | 0 |
test/programytest/parser/test_aiml_parser.py | cdoebler1/AIML2 | 345 | 1606922 | from __future__ import annotations
import os
import unittest
from programy.utils.parsing.linenumxml import LineNumberingParser
import xml.etree.ElementTree as ET # pylint: disable=wrong-import-order
from programy.parser.aiml_parser import AIMLParser
from programy.dialog.sentence import Sentence
from programy.parser.pa... | 1 | 1 | 0 | 2 | 4 | 0 |
h2o-py/tests/testdir_algos/glm/pyunit_PUBDEV_7481_lambda_search_alpha_array_validation_large.py | vishalbelsare/h2o-3 | 6,098 | 1606951 | <reponame>vishalbelsare/h2o-3<filename>h2o-py/tests/testdir_algos/glm/pyunit_PUBDEV_7481_lambda_search_alpha_array_validation_large.py<gh_stars>1000+
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator as glm
# with lambda_sea... | 0 | 0 | 0 | 0 | 0 | 0 |
sensor/bme280/test.py | ianhom/mpy-lib | 116 | 1606957 | '''
BME280 demo
Author: shaoziyang
Date: 2018.2
http://www.micropython.org.cn
'''
from machine import I2C
import time
import bme280
b = bme280.BME280(I2C(1))
while True:
time.sleep_ms(500)
print(b.get())
| 0 | 0 | 0 | 0 | 0 | 0 |
example/pyctp2/testbed/mthread.py | mmmaaaggg/pyctp_lovelylain | 358 | 1606976 | <filename>example/pyctp2/testbed/mthread.py
# -*- coding:utf-8 -*-
from threading import Thread,get_ident,Event
from queue import Queue
from time import time,sleep
from ..common.base import BaseObject
'''
测试线程队列的消耗
'''
rlist = []
def worker():
while True:
item = q.get()
#print(get_ident(),t... | 0 | 0 | 0 | 0 | 0 | 0 |
vit/formatter/end.py | kinifwyne/vit | 179 | 1606978 | from vit.formatter import DateTime
class End(DateTime):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
design_patterns__examples/Observer/example_2.py | DazEB2/SimplePyScripts | 117 | 1606984 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: Design Patterns: Observer — Наблюдатель
# SOURCE: https://ru.wikipedia.org/wiki/Наблюдатель_(шаблон_проектирования)
# SOURCE: https://ru.wikipedia.org/wiki/Наблюдатель_(шаблон_проектирования)#Python
from abc import ABC, abstractmethod... | 6 | 7 | 0 | 1 | 14 | 0 |
libs/handlers.py | mehrdad-shokri/lightbulb-framework | 497 | 1606988 | <filename>libs/handlers.py
"""
This file contains all the handlers that will be used by
the GOFA and SFADiff modules. The handlers can be new
implementations (e.g. BurpHTTPHandler) or just interfaces
to the lightbulb's handlers (that allow us to perform
small changes.
"""
from lightbulb.core.utils.rawhttphandler import... | 0 | 0 | 0 | 0 | 0 | 0 |
cyclegan/task_launcher_faceswap.py | dingyanna/DepthNets | 114 | 1607015 | from __future__ import annotations
import numpy as np
import torch
import glob
import os
import pickle
import argparse
from torch.utils.data import DataLoader
from torch.utils.data.dataset import (TensorDataset,
ConcatDataset)
from i2i.cyclegan import CycleGAN
from util import (con... | 1 | 4 | 0 | 0 | 5 | 0 |
StockAnalysisSystem/core/Utility/CollectorUtility.py | SleepySoft/StockAnalysisSystem | 138 | 1607017 | import pandas as pd
from os import path
from .common import *
from .time_utility import *
# Tushare access limit, as fetch times per minute.
# If fetch data from tushare gets error message like: "抱歉,您每分钟最多访问该接口x次"
# Fill the x to the corresponding entry of this table
# This config is for 5000 scores. The number in c... | 24 | 14 | 0 | 0 | 38 | 0 |
tests/file_io/vshadow_file_io.py | dfjxs/dfvfs | 176 | 1607043 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the file-like object implementation using pyvshadow."""
import os
import unittest
from dfvfs.file_io import vshadow_file_io
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver ... | 0 | 0 | 0 | 0 | 0 | 0 |
auto_derby/imagetools_test.py | DoctrineAlanK/auto-derby | 235 | 1607058 | <reponame>DoctrineAlanK/auto-derby
import pytest
from . import imagetools
@pytest.mark.parametrize(
"a,b,expected",
[
(0, 0, 1),
(0, 255, 0),
((0, 0, 0), (0, 0, 0), 1),
((0, 0, 0), (255, 255, 255), 0),
((0, 0, 0), (10, 10, 10), 0.9320764389188676),
((0, 0, 0), (... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/tests/test_slabinfo.py | lhuett/insights-core | 121 | 1607075 | <gh_stars>100-1000
import doctest
import pytest
from insights.parsers import slabinfo, SkipException
from insights.parsers.slabinfo import SlabInfo
from insights.tests import context_wrap
PROC_SLABINFO = """
slabinfo - version: 2.1
# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tu... | 0 | 0 | 0 | 0 | 0 | 0 |
quarkchain/experimental/diff.py | anshulkusa/pyquarkchain | 237 | 1607080 | #!/usr/bin/python3
# Simple moving average difficulty
class MADifficultyCalculator:
def __init__(
self, ma_samples: int=16, target_interval_sec: int=1, bootstrap_samples: int=0, slide_size: int=1
):
self.ma_samples = ma_samples
self.target_interval_sec = target_interval_sec
se... | 4 | 2 | 0 | 0 | 6 | 0 |
neutron/objects/local_ip.py | congnt95/neutron | 1,080 | 1607081 | <reponame>congnt95/neutron
# Copyright 2021 Huawei, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/agent/common/util/ps.py | dp92987/nginx-amplify-agent | 308 | 1607086 | <reponame>dp92987/nginx-amplify-agent
# -*- coding: utf-8 -*-
from hamcrest import *
from test.base import RealNginxTestCase, future_test
from amplify.agent.managers.nginx import NginxManager
from amplify.agent.managers.system import SystemManager
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All... | 0 | 0 | 0 | 0 | 0 | 0 |
Trescope4Python/library/src/trescope/core/Input.py | aaabbb2021/Trescope | 105 | 1607095 | <filename>Trescope4Python/library/src/trescope/core/Input.py
from trescope.controller import ControllerNode
class Input(object):
"""
Input for adding control , only works for display output . By adding control , you can input user information to control program
execution to complete some jobs , such as la... | 0 | 0 | 0 | 0 | 0 | 0 |
exchange_rates/banki_ru.py | DazEB2/SimplePyScripts | 117 | 1607137 | <reponame>DazEB2/SimplePyScripts<filename>exchange_rates/banki_ru.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def exchange_rate(currency_id, timestamp=None):
if timestamp is None:
from datetime import datetime
timestamp = int(datetime.today().timest... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/~inactive/r_system32comics/app.py | mainyordle/reddit2telegram | 187 | 1607166 | #encoding:utf-8
subreddit = 'System32Comics'
t_channel = '@r_System32Comics'
def send_post(submission, r2t) -> object:
return r2t.send_simple(submission)
| 0 | 1 | 0 | 0 | 1 | 0 |
park/envs/circuit/simulator/utility/io/serial.py | utkarsh5k/park | 180 | 1607172 | <reponame>utkarsh5k/park
import json
import numpy as np
import dill
__all__ = ['load_dill', 'dump_dill',
'loads_dill', 'dumps_dill',
'load_json', 'dump_json',
'loads_json', 'dumps_json',
'load_pickle', 'dump_pickle',
'loads_pickle', 'dumps_pickle',
'loa... | 0 | 0 | 0 | 0 | 0 | 0 |
scale.app/scripts/blint2org.py | f4rsh/SCALe | 239 | 1607235 | #!/usr/bin/env python
# Script takes a B::lint text output file and extracts its diagnostic
# information
#
# The only argument indicates the file containing the input.
# The data should be produced from a build process using B::Lint.
#
# This script never produces more than one message per diagnostic
#
# Copyright (c... | 0 | 0 | 0 | 0 | 0 | 0 |
m2-modified/ims/common/agentless-system-crawler/crawler/plugins/systems/diskio_host_crawler.py | CCI-MOC/ABMI | 108 | 1607251 | from __future__ import annotations
import logging
import time
import psutil
from icrawl_plugin import IHostCrawler
from utils.features import DiskioFeature
logger = logging.getLogger('crawlutils')
class DiskioHostCrawler(IHostCrawler):
'''
Plugin for crawling disk I/O counters from host and
computing th... | 0 | 2 | 0 | 2 | 4 | 0 |
rbac/context.py | eldorplus/simple-rbac | 219 | 1607253 | from __future__ import annotations
from __future__ import absolute_import
import functools
__all__ = ["IdentityContext", "PermissionDenied"]
class PermissionContext(object):
"""A context of decorator to check the permission."""
def __init__(self, checker, exception: object | None=None, **exception_kwargs)... | 4 | 10 | 0 | 1 | 15 | 0 |
extra_tests/test_pyrepl/test_reader.py | nanjekyejoannah/pypy | 381 | 1607274 | <reponame>nanjekyejoannah/pypy
def test_process_prompt():
from pyrepl.reader import Reader
r = Reader(None)
assert r.process_prompt("hi!") == ("hi!", 3)
assert r.process_prompt("h\x01i\x02!") == ("hi!", 2)
assert r.process_prompt("hi\033[11m!") == ("hi\033[11m!", 3)
assert r.process_prompt("h\x... | 0 | 0 | 0 | 0 | 0 | 0 |
brave/overlays/overlay.py | datagutt/brave | 572 | 1607275 | <reponame>datagutt/brave
from gi.repository import Gst
from brave.inputoutputoverlay import InputOutputOverlay
import brave.exceptions
class Overlay(InputOutputOverlay):
'''
An abstract superclass representing an overlay.
'''
def __init__(self, **args):
source_uid = None
if 'source' i... | 0 | 0 | 0 | 0 | 0 | 0 |
software/firmware/sched/sched.py | andreacorbo/Buoy_Controller_Async_v1 | 443 | 1607326 | <filename>software/firmware/sched/sched.py
# sched.py
# Copyright (c) 2020 <NAME>
# Released under the MIT License (MIT) - see LICENSE file
import uasyncio as asyncio
from sched.primitives import launch
from time import time
from sched.cron import cron
async def schedule(func, *args, times=None, **kwargs):
fcron... | 0 | 0 | 0 | 0 | 0 | 0 |
lsassy/output/grep_output.py | kaisaryousuf/lsassy | 1,212 | 1607369 | from lsassy.output import IOutput
class Output(IOutput):
"""
Returns output in greppable format
"""
def get_output(self) -> object:
credentials = set()
for cred in self._credentials:
line = "{}\t{}\t{}\t{}\t{}\t{}\t{}".format(cred["ssp"], cred["domain"], cred["use... | 0 | 1 | 0 | 0 | 1 | 0 |
core/run/metric_logger/_local.py | zhangzhengde0225/SwinTrack | 143 | 1607418 | from miscellanies.torch.metric_logger import MetricLogger, SmoothedValue
import copy
from core.run.event_dispatcher.register import EventRegister
def _load_metric_definitions(metric_definitions, logger: MetricLogger):
name_check = set()
for metric_definition in metric_definitions:
window_size = 20
... | 5 | 2 | 0 | 3 | 10 | 0 |
cort/test/multigraph/__init__.py | leonardoboliveira/cort | 141 | 1607445 | <reponame>leonardoboliveira/cort
__author__ = 'martscsn'
| 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.