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 |
|---|---|---|---|---|
falkon/models/__init__.py | mohamad-amin/falkon | 130 | 12636019 | from .falkon import Falkon
from .logistic_falkon import LogisticFalkon
from .incore_falkon import InCoreFalkon
__all__ = ("Falkon", "LogisticFalkon", "InCoreFalkon", )
|
envi/archs/msp430/const.py | rnui2k/vivisect | 716 | 12636033 | from envi.const import *
from envi import IF_NOFALL, IF_PRIV, IF_CALL, IF_BRANCH, IF_RET, IF_COND
IF_BYTE = 1<<8
# No operand instructions
nocode = [
'.word' # Something is wrong, so return the dirty word
]
# Single operand intructions
scode = [
('rrc', 0), # RRC Rotate right through carry
('swp... |
src/OFS/metadirectives.py | rbanffy/Zope | 289 | 12636044 | from zope.configuration.fields import Bool
from zope.configuration.fields import GlobalObject
from zope.interface import Interface
from zope.schema import ASCII
from zope.security.zcml import Permission
class IDeprecatedManageAddDeleteDirective(Interface):
"""Call manage_afterAdd & co for these contained content ... |
cadence/tests/test_handle_workflow_execution_signaled.py | simkimsia/temporal-python-sdk | 141 | 12636086 | <filename>cadence/tests/test_handle_workflow_execution_signaled.py
import json
from unittest.mock import MagicMock, Mock
import pytest
from cadence.cadence_types import HistoryEvent, WorkflowExecutionSignaledEventAttributes
from cadence.decision_loop import ReplayDecider, WorkflowMethodTask, Status
from cadence.worke... |
_build/jupyter_execute/content/c5/s2/classification_tree.py | curioushruti/mlbook | 970 | 12636088 | <filename>_build/jupyter_execute/content/c5/s2/classification_tree.py
# Classification Trees
The construction of a classification tree is very similar to that of a regression tree. For a fuller description of the code below, please see the regression tree code on the previous page.
## Import packages
import numpy as... |
examples/s3-resource/process.py | dwolfschlaeger/guildai | 694 | 12636093 | <reponame>dwolfschlaeger/guildai<gh_stars>100-1000
import os
import click
import pandas
@click.command()
@click.option(
"--input-dir", metavar="DIR", default=".", help="Path to scan for raw data."
)
@click.option(
"--output-dir",
metavar="DIR",
default=".",
help="Path under which to save processe... |
eval_vr.py | bryant1410/HERO | 173 | 12636096 | """
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
run evaluation of VR
"""
import argparse
import os
from os.path import exists
from time import time
import torch
from torch.utils.data import DataLoader
import numpy as np
from tqdm import tqdm
import pprint
from apex import amp
from horovod imp... |
raspi_install/download_assets.py | theendsofinvention/cartoonify | 1,991 | 12636097 | <gh_stars>1000+
import six.moves.urllib as urllib
from pathlib import Path
import jsonlines
import click
import tarfile
import os
import sys
root = Path(__file__).parent
label_map_path = root / '..' / 'cartoonify' / 'app' / 'label_mapping.jsonl'
download_path = root / '..' / 'cartoonify' / 'downloads'
quickdraw_datas... |
setup.py | edddyeddy/cnsenti | 140 | 12636131 | <filename>setup.py
from setuptools import setup
import setuptools
setup(
name='cnsenti', # 包名字
version='0.0.4', # 包版本
description='中文情感分析库(Chinese Sentiment))可对文本进行情绪分析、正负情感分析。', # 简单描述
author='大邓', # 作者
author_email='<EMAIL>', # 邮箱
url='https://github.com/thunderhit/eventextraction',... |
scrapy/core/downloader/handlers/datauri.py | HyunTruth/scrapy | 9,953 | 12636138 | from w3lib.url import parse_data_uri
from scrapy.http import TextResponse
from scrapy.responsetypes import responsetypes
from scrapy.utils.decorators import defers
class DataURIDownloadHandler(object):
lazy = False
def __init__(self, settings):
super(DataURIDownloadHandler, self).__init__()
@de... |
venv/lib/python3.6/site-packages/dirhunt/tests/test_directory_lists.py | Guillaume-Fernandez/phishfinder | 1,288 | 12636156 | <gh_stars>1000+
import unittest
from bs4 import BeautifulSoup
from dirhunt.directory_lists import ApacheDirectoryList, CommonDirectoryList
from dirhunt.processors import ProcessIndexOfRequest
from dirhunt.tests.base import CrawlerTestBase
class DirectoryListsTestBase(CrawlerTestBase):
html = ''
def get_bea... |
hc/api/migrations/0015_auto_20151022_1008.py | karthikprabhu/healthchecks | 4,813 | 12636172 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [("api", "0014_auto_20151019_2039")]
operations = [
migrations.AlterIndexTogether(
name="check", index_together=set([("status", ... |
lint/queue.py | arcturus140/SublimeLinter | 646 | 12636177 | <reponame>arcturus140/SublimeLinter
import threading
MYPY = False
if MYPY:
from typing import Callable, Dict, Hashable
Key = Hashable
# Map from key to threading.Timer objects
timers = {} # type: Dict[Key, threading.Timer]
def debounce(callback, delay, key):
# type: (Callable[[], None], float, Key) ... |
mamba/setup.py | jjerphan/mamba | 2,262 | 12636230 | <filename>mamba/setup.py
# Copyright (c) 2019, QuantStack and Mamba Contributors
#
# Distributed under the terms of the BSD 3-Clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
here = os.path.dirname(... |
locations/spiders/freshmarket.py | davidchiles/alltheplaces | 297 | 12636243 | # -*- coding: utf-8 -*-
import scrapy
import json
from locations.items import GeojsonPointItem
class FreshMarketSpider(scrapy.Spider):
name = "freshmarket"
item_attributes = { 'brand': "Fresh Market" }
allowed_domains = ['thefreshmarket.com']
start_urls = (
'https://www.thefreshmarket.com/your... |
packages/pyright-internal/src/tests/samples/paramSpec26.py | Jasha10/pyright | 3,934 | 12636263 | # This sample tests the case where a generic class parameterized by a
# ParamSpec is specialized using a Concatenate[] type argument.
from typing import ParamSpec, Concatenate, Generic, Callable, Any
P = ParamSpec("P")
class A(Generic[P]):
def __init__(self, func: Callable[P, Any]) -> None:
...
def fu... |
syfertext/tokenizers/default_tokenizer.py | Dat-Boi-Arjun/SyferText | 204 | 12636269 | class DefaultTokenizer:
def __init__(self, prefixes, suffixes, infixes, exceptions):
self.prefixes = prefixes
self.suffixes = suffixes
self.infixes = infixes
self.exceptions = exceptions
def __call__(self, text: str):
return text.split(" ")
|
src/pipelines/hospitalizations/xx_opencovid.py | alvarosg/covid-19-open-data | 430 | 12636279 | # Copyright 2020 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 to in writing, ... |
dirscan/dirsearch/thirdparty/oset/tests.py | imfiver/Sec-Tools | 144 | 12636284 | #!/usr/bin/env python
# -*- mode:python; tab-width: 2; coding: utf-8 -*-
"""Partially backported python ABC classes"""
import doctest
import unittest
optionflags = (
doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS | doctest.REPORT_ONLY_FIRST_FAILURE
)
TESTFILES = ["pyoset.txt"]
def test_suite():
"""Simpl... |
scripts/glob-search.py | kasymovga/taisei | 573 | 12636291 | #!/usr/bin/env python3
from taiseilib.common import (
DirPathType,
run_main,
)
from pathlib import Path
import fnmatch
def main(args):
import argparse
parser = argparse.ArgumentParser(description='Search directory by multiple glob patterns.', prog=args[0])
parser.add_argument('directory',
... |
dist/server/script/core/colorconsole.py | zhoulhb/teleport | 640 | 12636305 | <filename>dist/server/script/core/colorconsole.py
# -*- coding: utf-8 -*-
import os
import sys
import platform
import traceback
__all__ = ['o', 'v', 'i', 'w', 'e', 'f']
# ======================================
# 颜色
# ======================================
CR_RESTORE = 0 # 恢复正常 - 浅灰色
# BOLD = "[1m" # 高亮显示
# UNDE... |
examples/ridge_regressor_example.py | tushushu/Imilu | 407 | 12636313 | # -*- coding: utf-8 -*-
"""
@Author: tushushu
@Date: 2018-08-21 17:16:29
@Last Modified by: tushushu
@Last Modified time: 2018-08-21 17:16:29
"""
import os
os.chdir(os.path.split(os.path.realpath(__file__))[0])
import sys
sys.path.append(os.path.abspath(".."))
from imylu.linear_model.ridge import Ridge
from imylu.u... |
dynamo/prediction/perturbation.py | xing-lab-pitt/dynamo-release | 236 | 12636322 | <filename>dynamo/prediction/perturbation.py
import numpy as np
from scipy.sparse import csr_matrix
import anndata
from typing import Union, Callable
from ..tools.cell_velocities import cell_velocities
from .utils import (
expr_to_pca,
pca_to_expr,
z_score,
z_score_inv,
)
from ..vectorfield.vector_calc... |
ptgnn/tests/simplemodel/test_model.py | mir-am/ptgnn | 319 | 12636357 | <reponame>mir-am/ptgnn
import tempfile
import unittest
from pathlib import Path
from typing import List, Optional, Tuple
from ptgnn.baseneuralmodel import ModelTrainer
from ptgnn.tests.simplemodel.data import SampleDatapoint, SyntheticData
from ptgnn.tests.simplemodel.model import SimpleRegressionModel
class TestPyt... |
src/e2eflow/core/flownet.py | 3bhady/UnFlow | 281 | 12636359 | <gh_stars>100-1000
import tensorflow as tf
import tensorflow.contrib.slim as slim
import tensorflow.contrib.layers as layers
from ..ops import correlation
from .image_warp import image_warp
from .flow_util import flow_to_color
FLOW_SCALE = 5.0
def flownet(im1, im2, flownet_spec='S', full_resolution=False, train_a... |
nova/tests/functional/test_flavor_extraspecs.py | zjzh/nova | 1,874 | 12636386 | <reponame>zjzh/nova
# Copyright 2020, Red Hat, 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 require... |
registration/urls.py | timgates42/timestrap | 1,758 | 12636389 | <reponame>timgates42/timestrap
from django.urls import path
from django.contrib.auth import views as auth_views
from .forms import TimestrapPasswordResetForm
urlpatterns = [
path(
"password_reset/",
auth_views.PasswordResetView.as_view(form_class=TimestrapPasswordResetForm),
name="passwor... |
recipes/Python/576531_Circle/recipe-576531.py | tdiprima/code | 2,023 | 12636402 | #On the name of ALLAH and may the blessing and peace of Allah
#be upon the Messenger of <NAME>.
#Author :<NAME>
#Date : 08/10/08
#Version : 2.4
""" Class of an equation of a circle of the form Ax^2 + Ay^2 + Dx + Ey + F = 0 (A !=0)
it represents a circle or a point or has no graph , depending of the radius value. And ... |
php_opcache/tests/test_php_opcache.py | divyamamgai/integrations-extras | 158 | 12636428 | <gh_stars>100-1000
import pytest
from datadog_checks.base import ConfigurationError
from datadog_checks.dev.utils import get_metadata_metrics
from datadog_checks.php_opcache import PhpOpcacheCheck
from .common import EXPECTED_METRICS
@pytest.mark.unit
def test_config():
instance = {}
c = PhpOpcacheCheck('ph... |
recipes/Python/578139_Metronome_For_Beginner_Musicians/recipe-578139.py | tdiprima/code | 2,023 | 12636441 | # Metronome3x.py
#
# DEMO simple metronome that exploits a minor flaw in the /dev/audio and /dev/dsp devices inside Linux.
# It can tick at around 30 to 400 beats per minute. This minimal code can be improved upon to give
# greater accuracy, range and appearance on screen if required.
#
# Original copyright, (C)2007-20... |
idaes/core/tests/test_process_base.py | carldlaird/idaes-pse | 112 | 12636463 | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
test/nn/dense/test_mincut_pool.py | NucciTheBoss/pytorch_geometric | 2,350 | 12636479 | import torch
from torch_geometric.nn import dense_mincut_pool
def test_dense_mincut_pool():
batch_size, num_nodes, channels, num_clusters = (2, 20, 16, 10)
x = torch.randn((batch_size, num_nodes, channels))
adj = torch.ones((batch_size, num_nodes, num_nodes))
s = torch.randn((batch_size, num_nodes, n... |
python/paddle_fl/paddle_fl/core/submitter/client_base.py | barrierye/PaddleFL | 379 | 12636481 | <reponame>barrierye/PaddleFL
# Copyright (c) 2020 PaddlePaddle 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... |
examples/gpt-j/prepare_partial.py | lipovsek/PyTorch-LIT | 151 | 12636491 | <reponame>lipovsek/PyTorch-LIT<gh_stars>100-1000
from pytorch_lit import prepare_params, PartialLoader
if __name__ == "__main__":
weights = PartialLoader("../../../lab/gpt-j-6B-f16/pytorch_model.bin")
prepare_params(weights, ".models/gpt-j-6b-lit", dtype="float16")
|
Projects/OLED_Weather Station/weather_station.py | benmcclelland/GrovePi | 482 | 12636499 | <reponame>benmcclelland/GrovePi
# Adapted from home_temp_hum_display.py
'''
The MIT License (MIT)
GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
Copyright (C) 2017 Dexter Industries
Permission is hereby granted, free of charge, to any person obtaining a copy
... |
tests/prune_tests.py | dantaki/svtools | 120 | 12636534 | from unittest import TestCase, main
import os
import sys
import tempfile
import difflib
import svtools.prune
class IntegrationTestPrune(TestCase):
def run_integration_test(self):
test_directory = os.path.dirname(os.path.abspath(__file__))
test_data_dir = os.path.join(test_directory, 'test_data', 'p... |
goless/compat.py | timgates42/goless | 266 | 12636554 | import sys
PY3 = sys.version_info[0] == 3
if PY3:
# noinspection PyShadowingBuiltins
range = range
maxint = sys.maxsize
# noinspection PyUnusedLocal
def reraise(e, v, origex):
raise e(v).with_traceback(origex.__traceback__)
else:
# noinspection PyShadowingBuiltins
range = xrange
... |
autox/autoxserver.py | fanghy06/AutoX | 499 | 12636593 | <reponame>fanghy06/AutoX<gh_stars>100-1000
from autox.autox_server.ensemble import ensemble
from autox.autox_server.feature_engineer import fe_count, fe_onehot, fe_shift, fe_time_diff
from autox.autox_server.feature_engineer import fe_kv, fe_stat_for_same_prefix, fe_frequency
from autox.autox_server.feature_engineer im... |
dreamer/networks/proprio.py | jsikyoon/dreamer-1 | 546 | 12636598 | <filename>dreamer/networks/proprio.py
# Copyright 2019 The Dreamer 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/LICENS... |
fastapi_amis_admin/amis_admin/site.py | amisadmin/fastapi_amis_admin | 166 | 12636631 | <gh_stars>100-1000
"""This package is for compatibility with v0.1.8 and below,v0.3.0 and above will be removed. """
from fastapi_amis_admin.admin.site import (
AdminSite,
DocsAdmin,
FileAdmin,
HomeAdmin,
ReDocsAdmin,
) |
scripts/internal/print_downloads.py | odormond/psutil | 8,285 | 12636659 | #!/usr/bin/env python3
# Copyright (c) 2009 <NAME>'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Print PYPI statistics in MarkDown format.
Useful sites:
* https://pepy.tech/project/psutil
* https://pypistats.org/packages/psutil
* https... |
ykdl/extractors/douyin/__init__.py | netlovehf/ykdl | 1,153 | 12636669 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from ykdl.util.html import get_location, add_header
def get_extractor(url):
if '/v.' in url:
add_header('User-Agent',
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) '
'AppleWebKit/605.1.15 (KHTML, like Gecko) V... |
examples/tucker/make_annotation.py | kvetab/bio_embeddings | 219 | 12636677 | <reponame>kvetab/bio_embeddings<filename>examples/tucker/make_annotation.py<gh_stars>100-1000
"""This script was used to generate tucker_annotations.csv. You shouldn't need to use it"""
from pathlib import Path
import pandas
def class_to_label(cath_class: int) -> str:
"""See http://www.cathdb.info/browse/tree""... |
nova/console/securityproxy/base.py | zjzh/nova | 1,874 | 12636692 | <gh_stars>1000+
# Copyright (c) 2014-2016 Red Hat, 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
#... |
ceilometer/hardware/inspector/__init__.py | maestro-hybrid-cloud/ceilometer | 239 | 12636706 | #
# Copyright 2014 Intel Corp.
#
# 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... |
examples/subgraph_matching/train_single_proc.py | ruth-ann/deepsnap | 412 | 12636737 | <reponame>ruth-ann/deepsnap
"""Train the order embedding model"""
import argparse
from collections import defaultdict
from itertools import permutations
import pickle
from queue import PriorityQueue
import os
import random
import time
from deepsnap.batch import Batch
import networkx as nx
import numpy as np
from sklea... |
tools/dom/new_scripts/compiler.py | omerlevran46/sdk | 8,969 | 12636748 | #!/usr/bin/env python3
# Copyright (C) 2014 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
test/unit_tests/braket/circuits/test_result_type.py | orclassiq/amazon-braket-sdk-python | 151 | 12636757 | # Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompany... |
hiitpi/__init__.py | jingw222/hiitpi | 146 | 12636814 | import sys
import logging
import datetime
import random
import cv2
import pandas as pd
from flask import Response, request, redirect, session
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_caching import Cache
from flask_session import Session
import plotly.express as px
import das... |
tests/test_proportional.py | AlessioMorale/luma.core | 114 | 12636825 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-18 <NAME> and contributors
# See LICENSE.rst for details.
import pytest
from luma.core.legacy.font import proportional, CP437_FONT
def test_narrow_char():
font = proportional(CP437_FONT)
assert font[ord('!')] == [6, 95, 95, 6, 0]
def test... |
mods/screenshot.py | devrix123/SillyRAT | 442 | 12636858 | class SCREENSHOT:
SC_DATA = b""
def __init__(self):
self.generate()
def generate(self):
obj = io.BytesIO()
im = pyscreenshot.grab()
im.save(obj, format="PNG")
self.SC_DATA = obj.getvalue()
def get_data(self):
return self.SC_DATA |
scripts/automation/trex_control_plane/interactive/trex/astf/trex_astf_port.py | timgates42/trex-core | 956 | 12636902 | <reponame>timgates42/trex-core
from .topo import ASTFTopology
from ..common.trex_port import Port
class ASTFPort(Port):
def __init__(self, *a, **k):
Port.__init__(self, *a, **k)
self.topo = ASTFTopology()
self.service_mode = False
self.service_mode_filtered = False
... |
tensorflow_io/python/experimental/sql_dataset_ops.py | lgeiger/io | 558 | 12636958 | <reponame>lgeiger/io<filename>tensorflow_io/python/experimental/sql_dataset_ops.py
# Copyright 2018 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 a... |
thirdparty/som/examples/peptides.py | mkashifn/celosia | 116 | 12636984 | <filename>thirdparty/som/examples/peptides.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from modlamp.sequences import Helices, Random, AMPngrams
from modlamp.descriptors import PeptideDescriptor
from modlamp.datasets import load_AMPvsTM
from som import SOM
# generate some virtual peptide seque... |
preprocess/load_img.py | cvlab-tohoku/Dense-Co-Attention-Network-for-Visual-Question-Answering | 110 | 12637054 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import os
import glob
import re
import sys
import cv2
import h5py
import torch
import numpy as np
import argparse
import json
from threading import Thread, Lock
if sys.version_info[0] == 2:
import Queue as q... |
src/main/resources/assets/openpython/opos/v1.1/lib/micropython/io.py | fossabot/OpenPython | 1,556 | 12637057 | <reponame>fossabot/OpenPython
from uio import *
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
|
tests/unit/utils/test_template.py | shintaii/flower | 4,474 | 12637075 | <reponame>shintaii/flower<gh_stars>1000+
import unittest
from flower.utils.template import humanize, format_time
class TestHumanize(unittest.TestCase):
def test_None(self):
self.assertEqual('', humanize(None))
def test_bool(self):
self.assertEqual(True, humanize(True))
self.assertEqu... |
gcsa/serializers/reminder_serializer.py | gaborantal/google-calendar-simple-api | 139 | 12637080 | from gcsa.reminders import Reminder, EmailReminder, PopupReminder
from .base_serializer import BaseSerializer
class ReminderSerializer(BaseSerializer):
type_ = Reminder
def __init__(self, reminder):
super().__init__(reminder)
@staticmethod
def _to_json(reminder: Reminder):
return {
... |
python/keepsake/console.py | lambdaofgod/keepsake | 810 | 12637104 | import enum
from functools import wraps
import sys
from ._vendor.colors import color
# Parallel of go/pkg/console/
class Level(enum.Enum):
INFO = "INFO"
WARN = "WARN"
ERROR = "ERROR"
def info(s: str):
log(s, Level.INFO)
def warn(s: str):
log(s, Level.WARN)
def error(s: str):
log(s, Lev... |
rl_baselines/hyperparam_search.py | anonymous-authors-2018/robotics-repo | 524 | 12637116 | import argparse
import subprocess
import os
import shutil
import glob
import pprint
import math
import time
import pandas as pd
import numpy as np
import hyperopt
from rl_baselines.registry import registered_rl
from environments.registry import registered_env
from state_representation.registry import registered_srl
f... |
tests/test_PD002.py | dat-boris/pandas-vet | 136 | 12637135 | <reponame>dat-boris/pandas-vet
# stdlib
import ast
from pandas_vet import VetPlugin
from pandas_vet import PD002
def test_PD002_pass():
"""
Test that using inplace=False explicitly does not result in an error.
"""
statement = """df.drop(['a'], axis=1, inplace=False)"""
tree = ast.parse(statement)... |
usaspending_api/references/migrations/0047_add_tas.py | g4brielvs/usaspending-api | 217 | 12637143 | # Generated by Django 2.2.10 on 2020-06-25 19:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_delete_appropriationaccountbalancesquarterly'),
('references', '0046_sf_balances_table'),
]
... |
tests/unit/pytorch/distributions/test_normal.py | chiragnagpal/probflow | 134 | 12637182 | import numpy as np
import pytest
import torch
from probflow.distributions import Normal
tod = torch.distributions
def is_close(a, b, tol=1e-3):
return np.abs(a - b) < tol
def test_Normal():
"""Tests Normal distribution"""
# Create the distribution
dist = Normal()
# Check default params
a... |
python/sparsemap/layers_pt/tests/test_seq_layer.py | mikejqzhang/sparsemap | 101 | 12637239 | from .. import seq_layer
import torch
from torch.autograd import gradcheck, Variable
def test_seq_sparse_decode():
torch.manual_seed(2)
n_vars = 4
n_states = 3
for _ in range(20):
sequence_smap = seq_layer.SequenceSparseMarginals(max_iter=1000)
unary = Variable(torch.randn(n_vars, n_s... |
android/app/src/main/python/electroncash_gui/android/strings.py | christroutner/Electron-Cash | 208 | 12637247 | # This file lists translatable strings used in the Android app which don't appear anywhere else
# in the Electron Cash repository. Some of them only differ in capitalization or punctuation:
# see https://medium.com/@jsaito/making-a-case-for-letter-case-19d09f653c98
#
# Please keep the strings in alphabetical order.
# ... |
src/pfun/functions.py | suned/pfun | 126 | 12637251 | import functools
import inspect
from typing import Any, Callable, Generic, Tuple, TypeVar
from .immutable import Immutable
A = TypeVar('A')
B = TypeVar('B')
C = TypeVar('C')
def identity(v: A) -> A:
"""
The identity function. Just gives back its argument
Example:
>>> identity('value')
'... |
examples/python/gee_score_test_simulation.py | CCHiggins/statsmodels | 6,931 | 12637257 | #!/usr/bin/env python
# coding: utf-8
# DO NOT EDIT
# Autogenerated from the notebook gee_score_test_simulation.ipynb.
# Edit the notebook and then sync the output with this file.
#
# flake8: noqa
# DO NOT EDIT
# # GEE score tests
#
# This notebook uses simulation to demonstrate robust GEE score tests.
# These tests ... |
owo.py | ThePlasmaRailgun/owoScript | 143 | 12637291 | <filename>owo.py<gh_stars>100-1000
from owoi import run_owo_pseudocode
from owoc import owos_to_code
import argparse
if __name__ == '__main__':
argparser = argparse.ArgumentParser(description='Run OwO code in OwO form.')
argparser.add_argument('file', type=argparse.FileType('r'), help='File with OwO code')
... |
Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 12637293 | <filename>Trinkey_QT2040_Enviro_Gadget/u2if/enviro_u2if.py
# SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_scd4x
from adafruit_bme280 import basic as adafruit_bme280
scd = adafruit_scd4x.SCD4X(board.I2C())
scd.start_periodic_measu... |
GeneratorInterface/MCatNLOInterface/test/testSourceAndHadronizer_cfg.py | ckamtsikis/cmssw | 852 | 12637309 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
process = cms.Process('Test')
process.load('Configuration.StandardSequences.Services_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.source = cms.Source("MCatNLOSource",
fileNames = cms.untracked.vst... |
videoanalyst/pipeline/utils/__init__.py | TragedyN/SiamFCpp | 737 | 12637317 | <reponame>TragedyN/SiamFCpp
# -*- coding: utf-8 -*
from videoanalyst.evaluation.vot_benchmark.bbox_helper import cxy_wh_2_rect
from .bbox import (clip_bbox, cxywh2xywh, cxywh2xyxy, xywh2cxywh, xywh2xyxy,
xyxy2cxywh, xyxy2xywh)
from .crop import get_axis_aligned_bbox, get_crop, get_subwindow_trackin... |
tensorflow_gnn/keras/layers/padding_ops_test.py | tensorflow/gnn | 611 | 12637321 | """Tests for padding_ops Keras layers."""
import enum
import os
from absl.testing import parameterized
import tensorflow as tf
from tensorflow_gnn.graph import adjacency as adj
from tensorflow_gnn.graph import graph_tensor as gt
from tensorflow_gnn.graph import preprocessing_common
from tensorflow_gnn.keras import ke... |
testfiles/cmd/cmd.py | mindriot101/pyq | 144 | 12637363 | <gh_stars>100-1000
class Foo(object):
pass
@decorator
class Bar(object):
def foo(self):
pass
def baz(arg1, arg2):
pass
foo() | bar()
|
passwords/passfilter.py | m00tiny/scripts | 877 | 12637376 | <reponame>m00tiny/scripts<filename>passwords/passfilter.py
#!/usr/bin/env python
# Copyright (c) 2012, AverageSecurityGuy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of s... |
applications/tensorflow/sales_forecasting/test_main.py | payoto/graphcore_examples | 260 | 12637414 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import os
from tempfile import TemporaryDirectory
import pytest
from examples_tests.test_util import SubProcessChecker
working_path = os.path.dirname(__file__)
class Test(SubProcessChecker):
""" Test the sales forecasting model """
@classmethod
... |
python_toolbox/misc_tools/proxy_property.py | hboshnak/python_toolbox | 119 | 12637422 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
import re
class ProxyProperty:
'''
Property that serves as a proxy to an attribute of the parent object.
When you create a `ProxyProperty`, you pass in the name of the attribute
(or nested attribute) that it should pr... |
natlas-server/app/api/rescan_handler.py | purplesecops/natlas | 500 | 12637453 | <filename>natlas-server/app/api/rescan_handler.py
from flask import current_app
from app import db
def mark_scan_dispatched(rescan):
rescan.dispatchTask()
db.session.add(rescan)
db.session.commit()
current_app.ScopeManager.update_pending_rescans()
current_app.ScopeManager.update_dispatched_rescans... |
data/dataset_jester.py | Hugo-cheng/ACTION-Net | 146 | 12637477 | <filename>data/dataset_jester.py
import os
import sys
import pickle
import numpy as np
import pandas as pd
import random
import torch
import pdb
from torch.utils.data import Dataset, DataLoader,RandomSampler
import torchvision.transforms as transforms
from torchvision.utils import save_image
from PIL import... |
search-samples/recipe-app-website/main.py | Zhogolev/Languagerecognizer | 591 | 12637500 | # Copyright 2014 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 applicable law or ... |
pypi_server/handlers/api/users.py | jayvdb/pypi-server | 119 | 12637510 | # encoding: utf-8
import re
from tornado.web import HTTPError
from pypi_server.db.users import Users
from pypi_server.handlers import route
from pypi_server.handlers.base import threaded
from pypi_server.handlers.api import JSONHandler
from pypi_server.handlers.api.login import authorization_required
LOGIN_EXP = re.c... |
omnizart/transcribe_all.py | nicolasanjoran/omnizart | 1,145 | 12637517 | # import pretty_midi
# from omnizart.music import app as music_app
# from omnizart.drum import app as drum_app
# from omnizart.chord import app as chord_app
def process(input_audio, model_path=None, output="./"):
pass
|
1.Cnn_Captcha/create_image/cteate_image.py | duyuankai1992/tensorflow-1 | 927 | 12637535 | <gh_stars>100-1000
#coding:utf-8
from captcha.image import ImageCaptcha # pip install captcha
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import random,time
# 验证码中的字符, 就不用汉字了
number = ['0','1','2','3','4','5','6','7','8','9']
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m'... |
mindinsight/debugger/__init__.py | mindspore-ai/mindinsight | 216 | 12637605 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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 agre... |
integration/common/core.py | meldafrawi/longhorn-engine | 160 | 12637610 | import fcntl
import struct
import os
import grpc
import tempfile
import time
import random
import subprocess
import string
import threading
import pytest
from rpc.controller.controller_client import ControllerClient
import common.cmd as cmd
from common.util import read_file, checksum_data
from common.frontend import... |
desktop/core/ext-py/py4j-0.9/src/py4j/finalizer.py | kokosing/hue | 5,079 | 12637615 | # -*- coding: UTF-8 -*-
"""
Module that defines a Finalizer class responsible for registering and cleaning
finalizer
Created on Mar 7, 2010
:author: <NAME>
"""
from __future__ import unicode_literals, absolute_import
from threading import RLock
from py4j.compat import items
class ThreadSafeFinalizer(object):
... |
test/regexp/python11.py | kylebarron/MagicPython | 1,482 | 12637637 | <filename>test/regexp/python11.py<gh_stars>1000+
a = r"""
(?x) # multi-XXXline XXX regexp
foo (?# comm TODOent TODO)
foo # type: int
foo (?# type: int)
"""
a : source.python
: source.python
= : keyword.operator.assignment.python, so... |
research/object_detection/utils/test_case.py | gujralsanyam22/models | 82,518 | 12637642 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
finite_ntk/finite_ntk/lazy/fvp_second_order.py | forgi86/xfer | 244 | 12637648 | # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... |
recipes/Python/578594_Send_Messages__millions_facebook_Users_/recipe-578594.py | tdiprima/code | 2,023 | 12637658 | <reponame>tdiprima/code
#usr/bin/env/python
"""
This script can get the user data from facebook.com.
This is written for better understanding of python
Modules required:BeautifulSoup
Author:<NAME> aka Cybercam
Blog:http://pythonnotesbyajay.blogspot.in/
"""
import smtplib
import email
from email.MIMEMultipart import M... |
testing/slides/examples/fixtures/test_fixtures.py | ramosmaria/school2021 | 252 | 12637662 | import pytest
@pytest.fixture(scope='session')
def some_data():
return [1, 2, 3]
def test_using_fixture(some_data):
assert len(some_data) == 3
def test_also_using_fixture(some_data):
assert some_data[0] == 1
|
mode/examples/Topics/Fractals and L-Systems/PenroseTile/l_system.py | timgates42/processing.py | 1,224 | 12637687 | <filename>mode/examples/Topics/Fractals and L-Systems/PenroseTile/l_system.py
class LSystem(object):
def __init__(self):
self.steps = 0
self.axiom = "F"
self.rule = "F+F-F"
self.startLength = 190.0
self.theta = radians(120.0)
self.reset()
def reset(self):
... |
nucleus/examples/print_tfrecord.py | gaybro8777/nucleus | 721 | 12637697 | <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
cupy_alias/sparse/dia.py | fixstars/clpy | 142 | 12637698 | <gh_stars>100-1000
from clpy.sparse.dia import * # NOQA
|
cpmpy/among.py | hakank/hakank | 279 | 12637714 | <gh_stars>100-1000
"""
Global constraint among in cpmpy.
'''
Requires exactly m variables in x to take one of the values in v.
'''
Model created by <NAME>, <EMAIL>
See also my cpmpy page: http://www.hakank.org/cpmpy/
"""
import sys
import numpy as np
from cpmpy import *
from cpmpy.solvers import *
from cpmpy_hakank ... |
tests/test_cookbook.py | craiga/pyexcel | 1,045 | 12637720 | import os
import pyexcel as pe
from base import clean_up_files
from nose.tools import eq_, raises
class TestSpliting:
def setUp(self):
self.testfile4 = "multiple_sheets.xls"
self.content4 = {
"Sheet1": [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]],
"Sheet2": [[4, 4, 4, 4], [... |
jax-stubs/setup.py | deepmind/tensor_annotations | 117 | 12637721 | #!/usr/bin/env python
# Copyright 2020 DeepMind Technologies Limited. 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
#... |
applications/DEMApplication/python_scripts/processes/apply_forces_and_moments_process.py | lkusch/Kratos | 778 | 12637723 | import KratosMultiphysics
# Import applications
import KratosMultiphysics.DEMApplication as DEM
# Other imports
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
process_setti... |
Python-3/basic_examples/strings/string_encode_decode.py | ghiloufibelgacem/jornaldev | 1,139 | 12637728 | str_original = 'Hello'
bytes_encoded = str_original.encode(encoding='utf-8')
print(type(bytes_encoded))
str_decoded = bytes_encoded.decode()
print(type(str_decoded))
print('Encoded bytes =', bytes_encoded)
print('Decoded String =', str_decoded)
print('str_original equals str_decoded =', str_original == str_decoded)
... |
decode.py | nyu-dl/dl4mt-nonauto | 117 | 12637737 | import copy
import ipdb
import math
import os
import torch
import numpy as np
import time
from torch.nn import functional as F
from torch.autograd import Variable
from tqdm import tqdm, trange
from model import Transformer, FastTransformer, INF, TINY, softmax
from data import NormalField, NormalTranslationDataset, Tr... |
mlcomp/db/report_info/f1.py | sUeharaE4/mlcomp | 166 | 12637749 | import numpy as np
from sklearn.metrics import classification_report
from mlcomp.db.report_info.item import ReportLayoutItem
from mlcomp.utils.plot import figure_to_binary, plot_classification_report
class ReportLayoutF1(ReportLayoutItem):
def plot(self, y: np.array, pred: np.array):
report = classifica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.