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 |
|---|---|---|---|---|
quarkchain/evm/messages.py | QuarkChain/pyquarkchain | 237 | 12627821 | # Modified from pyethereum under MIT license
from collections import Counter
from fractions import Fraction
from quarkchain.utils import token_id_encode
import rlp
# to bypass circular imports
import quarkchain.core
from quarkchain.evm.utils import (
int256,
safe_ord,
bytearray_to_bytestr,
add_dict,
... |
Python/samples/viewABC.py | PaulDoessel/ExocortexCrate | 105 | 12627833 | <reponame>PaulDoessel/ExocortexCrate
import _ExocortexAlembicPython as alembic
import sys
import argparse
# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
# global variables
show_time = False
show_meta = False
show_size = False
show_vals... |
testing/MLDB-1198-sum-inconsistency-test.py | kstepanmpmg/mldb | 665 | 12627853 | <filename>testing/MLDB-1198-sum-inconsistency-test.py
#
# MLDB-1198-sum-inconsistency-test.py
# Mich, 2015-12-15
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
#
from mldb import mldb
mldb.put('/v1/datasets/ds', {
'type' : 'sparse.mutable'
})
def insert_with_ts(ts):
mldb.post('... |
tests/ptvsd/server/test_attach.py | int19h/ptvsd | 349 | 12627860 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from tests import debug
from tests.debug import runners, targets
fr... |
tools/auto_bisect/bisect_perf_regression.py | google-ar/chromium | 777 | 12627903 | <reponame>google-ar/chromium<filename>tools/auto_bisect/bisect_perf_regression.py
#!/usr/bin/env python
# Copyright 2013 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.
"""Chromium auto-bisect tool
This script bisects a r... |
btk20_src/unit_test/log_power_extractor.py | musiclvme/distant_speech_recognition | 136 | 12627904 | #!/usr/bin/python
"""
Compute log power feature from an audio file
"""
import pickle, numpy
from btk20.common import *
from btk20.stream import *
from btk20.feature import *
D = 160 # 10 msec for 16 kHz audio
fft_len = 256
pow_num = fft_len//2 + 1
input_filename = "../tools/filterbank/Headset1.wav"
output_filename = "... |
gherkin/python/gherkin/inout.py | codemrkay/cucumber | 3,974 | 12627922 | <gh_stars>1000+
from __future__ import print_function
import json
from .parser import Parser
from .token_scanner import TokenScanner
from .pickles.compiler import compile
from .errors import ParserException, CompositeParserException
class Inout(object):
def __init__(self, print_source, print_ast, print_pickles):
... |
env/Lib/site-packages/jedi/inference/docstring_utils.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 4,213 | 12627930 | from jedi.inference.value import ModuleValue
from jedi.inference.context import ModuleContext
class DocstringModule(ModuleValue):
def __init__(self, in_module_context, **kwargs):
super().__init__(**kwargs)
self._in_module_context = in_module_context
def _as_context(self):
return Docst... |
functions/FuzzyMembership.py | mmfink/raster-functions | 173 | 12627939 | import numpy as np
import math
class FuzzyMembership():
def __init__(self):
self.name = "Fuzzy Membership Function"
self.description = ("Reclassifies or transforms the input data to a 0 to 1 "
"scale based on the possibility of being a member of a "
... |
GPU-Re-Ranking/utils.py | TxuanYu/Person_reID_baseline_pytorch | 3,358 | 12627950 | """
Understanding Image Retrieval Re-Ranking: A Graph Neural Network Perspective
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
Project Page : https://github.com/Xuanmeng-Zhang/gnn-re-ranking
Paper: https://arxiv.org/abs/2012.07620v2
==============================================================... |
session-5/libs/celeb_vaegan.py | itamaro/CADL | 1,628 | 12627964 | """
Creative Applications of Deep Learning w/ Tensorflow.
Kadenze, Inc.
Copyright <NAME>, June 2016.
"""
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import gfile
from .utils import download
from skimage.transform import resize as imresize
def celeb_vaegan_download():
"""Download a p... |
plot_line.py | cogitate3/stock | 3,401 | 12627968 | <reponame>cogitate3/stock
# -*-coding=utf-8-*-
import datetime
import os
import random
import time
from optparse import OptionParser
__author__ = 'Rocky'
'''
http://30daydo.com
Contact: <EMAIL>
'''
import pandas as pd
import talib
import tushare as ts
import matplotlib as mpl
from mpl_finance import candlestick2_ochl... |
google_or_tools/post_office_problem2_sat.py | tias/hakank | 279 | 12627972 | # Copyright 2021 <NAME> <EMAIL>
#
# 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... |
models/__init__.py | psui3905/CCT | 308 | 12627990 | from .model import CCT |
tests/test_year_2005.py | l0pht511/jpholiday | 179 | 12628000 | # coding: utf-8
import datetime
import unittest
import jpholiday
class TestYear2005(unittest.TestCase):
def test_holiday(self):
"""
2005年祝日
"""
self.assertEqual(jpholiday.is_holiday_name(datetime.date(2005, 1, 1)), '元日')
self.assertEqual(jpholiday.is_holiday_name(datetime.... |
build.py | ReneNyffenegger/mssql-scripter | 302 | 12628026 | <reponame>ReneNyffenegger/mssql-scripter
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ----... |
e2e_testing/torchscript/cast.py | pashu123/torch-mlir | 213 | 12628034 | <reponame>pashu123/torch-mlir
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Also available under a BSD-style license. See LICENSE.
import torch
from torch_mlir_e2e_... |
proxybroker/errors.py | askvrtsv/ProxyBroker | 3,157 | 12628038 | """Errors."""
class ProxyError(Exception):
pass
class NoProxyError(Exception):
pass
class ResolveError(Exception):
pass
class ProxyConnError(ProxyError):
errmsg = 'connection_failed'
class ProxyRecvError(ProxyError):
errmsg = 'connection_is_reset'
class ProxySendError(ProxyError):
er... |
scripts/pipeline_example.py | Carromattsson/netrd | 116 | 12628063 | """
pipeline_example.py
------------
Example pipeline for netrd
author: <NAME>
email: <EMAIL>othylarock at gmail dot com
Submitted as part of the 2019 NetSI Collabathon
"""
# NOTE: !IMPORTANT! If you want to play and make changes,
# please make your own copy of this file (with a different name!)
# first and edit tha... |
external/lemonade/dist/lemonade/exceptions.py | almartin82/bayeslite | 964 | 12628073 |
class BadGrammarError(Exception):
pass
class EmptyGrammarError(BadGrammarError):
pass
|
src/python/nimbusml/examples/LightLda.py | michaelgsharp/NimbusML | 134 | 12628114 | ###############################################################################
# LightLda
from nimbusml import FileDataStream, Pipeline
from nimbusml.datasets import get_dataset
from nimbusml.feature_extraction.text import NGramFeaturizer, LightLda
from nimbusml.feature_extraction.text.extractor import Ngram
# data i... |
openff/toolkit/utils/toolkit_registry.py | andrew-abimansour/openff-toolkit | 120 | 12628141 | "Registry for ToolkitWrapper objects"
__all__ = ("ToolkitRegistry",)
import inspect
import logging
from openff.toolkit.utils.ambertools_wrapper import AmberToolsToolkitWrapper
from openff.toolkit.utils.base_wrapper import ToolkitWrapper
from openff.toolkit.utils.builtin_wrapper import BuiltInToolkitWrapper
from open... |
InvenTree/stock/migrations/0064_auto_20210621_1724.py | carlos-riquelme/InvenTree | 656 | 12628171 | # Generated by Django 3.2.4 on 2021-06-21 07:24
from django.db import migrations
def extract_purchase_price(apps, schema_editor):
"""
Find instances of StockItem which do *not* have a purchase price set,
but which point to a PurchaseOrder where there *is* a purchase price set.
Then, assign *that* pu... |
examples/parallel/davinci/wordfreq.py | chebee7i/ipython | 748 | 12628177 | """Count the frequencies of words in a string"""
from __future__ import division
from __future__ import print_function
import cmath as math
def wordfreq(text, is_filename=False):
"""Return a dictionary of words and word counts in a string."""
if is_filename:
with open(text) as f:
text = ... |
scripts/astf/res.py | ajitkhaparde/trex-core | 956 | 12628189 | <reponame>ajitkhaparde/trex-core
# many templates,clients/server
# start -f astf/res.py -m 1 -t size=32,clients=65000,servers=65000,templates=100
from trex.astf.api import *
from trex.stl.trex_stl_packet_builder_scapy import ip2int, int2ip
import argparse
# we can send either Python bytes type as below:
http_req =... |
ib/ext/Util.py | LewisW/IbPy | 1,260 | 12628249 | <gh_stars>1000+
#!/usr/bin/env python
""" generated source for module Util """
#
# Original file copyright original author(s).
# This file copyright <NAME>, <EMAIL>.
#
# WARNING: all changes to this file will be lost.
from ib.lib import Double, Integer
#
# * Util.java
#
# package: com.ib.client
# Making sure this w... |
examples/MIDI_to_CAN_example/CANToolz_config/BMW_F10_MUSIC.py | eik00d/CANSploit | 336 | 12628252 | load_modules = {
'hw_USBtin': {'port':'auto', 'debug':2, 'speed':500}, # IO hardware module
'ecu_controls':
{'bus':'BMW_F10',
'commands':[
# Music actions
{'High light - blink': '0x1ee:2:20ff', 'cmd':'127'},
{'TURN LEFT and RIGHT': '0x2fc:7:31000000000000', 'cmd':'126'},
... |
WebMirror/management/rss_parser_funcs/feed_parse_extractCNovelProj.py | fake-name/ReadableWebProxy | 193 | 12628276 | def extractCNovelProj(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Please Be More Serious', 'Please Be More Serious', 'translated'),
('Still Not Wanting to Forget... |
InvenTree/company/migrations/0030_auto_20201112_1112.py | ArakniD/InvenTree | 656 | 12628280 | # Generated by Django 3.0.7 on 2020-11-12 00:12
import InvenTree.fields
import django.core.validators
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('company', '0029_company_currency'),
]
operations = [
migrations.AlterField(
model_... |
disnake_components/__init__.py | LOCUS-TEAM/py-cord-components | 351 | 12628295 | <reponame>LOCUS-TEAM/py-cord-components<filename>disnake_components/__init__.py
from .client import *
from .interaction import *
from .component import *
from .dpy_overrides import *
from .http import *
|
mead/pytorch/exporters.py | shar999/mead-baseline | 241 | 12628297 | import os
import logging
import torch
import torch.nn as nn
from typing import Dict, List
import baseline as bl
from eight_mile.pytorch.layers import (
CRF,
ViterbiBatchSize1,
TaggerGreedyDecoder,
ViterbiLogSoftmaxNormBatchSize1
)
from baseline.utils import (
exporter,
Offsets,
write_json,
... |
lightreid/data/datasets/partial_ilids.py | wangguanan/light-reid | 296 | 12628311 | <reponame>wangguanan/light-reid<filename>lightreid/data/datasets/partial_ilids.py<gh_stars>100-1000
"""
@author: wangguanan
@contact: <EMAIL>
"""
import os, copy
from .reid_samples import ReIDSamples
import torchvision
class PartialILIDS(ReIDSamples):
"""Partial Ilids
Only include query and gallery data... |
models/total3d/modules/layout_estimation.py | Jerrypiglet/Total3DUnderstanding | 288 | 12628312 | <gh_stars>100-1000
# Definition of PoseNet
# author: ynie
# date: March, 2020
import torch
import torch.nn as nn
from models.registers import MODULES
from models.modules import resnet
from models.modules.resnet import model_urls
import torch.utils.model_zoo as model_zoo
@MODULES.register_module
class PoseNet(nn.Modu... |
src/micropython/audio.py | julianrendell/vscode-python-devicesimulator | 151 | 12628316 | from common import utils
from common.telemetry import telemetry_py
from common.telemetry_events import TelemetryEvent
# The implementation is based off of https://microbit-micropython.readthedocs.io/en/v1.0.1/audio.html.
def play(source, wait=True, pin="pin0", return_pin=None):
"""
This function is not imple... |
vega/networks/pytorch/customs/modnas/arch_space/construct/torch/torch.py | This-50m/vega | 724 | 12628318 | <reponame>This-50m/vega<gh_stars>100-1000
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# b... |
la/oblas/data/zgemv01.py | wtsia/gosl | 1,811 | 12628348 | import numpy as np
a = np.array([[0.1 + 3j, 0.2, 0.3 - 0.3j],
[1.0 + 2j, 0.2, 0.3 - 0.4j],
[2.0 + 1j, 0.2, 0.3 - 0.5j],
[3.0 + 0.1j, 0.2, 0.3 - 0.6j]], dtype=complex)
alp = 0.5+1j
bet = 2.0+1j
x = np.array([20, 10, 30])
y = np.array([3, 1, 2, 4])
res = alp*np.dot(a,x) + bet... |
salt/log/mixins.py | tomdoherty/salt | 9,425 | 12628364 | """
:codeauthor: <NAME> (<EMAIL>)
salt.log.mixins
~~~~~~~~~~~~~~~
.. versionadded:: 0.17.0
Some mix-in classes to be used in salt's logging
"""
# pylint: disable=unused-import
from salt._logging.mixins import (
ExcInfoOnLogLevelFormatMixin as ExcInfoOnLogLevelFormatMixIn,
)
from salt._logg... |
venv/Lib/site-packages/imageio/plugins/pillow_info.py | amelliaaas/tugastkc4 | 1,026 | 12628376 | # -*- coding: utf-8 -*-
# styletest: ignore E122 E123 E501
"""
Module that contain info about the Pillow formats. The first part of
this module generates this info and writes it to its own bottom half
if run as a script.
"""
def generate_info(): # pragma: no cover
from urllib.request import urlopen
import ... |
bootstrap_test/conftest.py | lowang-bh/lain-1 | 524 | 12628379 | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import pytest
import time
import subprocess32 as subproc
from config import CONFIG
import app_ctl
@pytest.fixture(scope="session")
def up_node1():
subproc.check_call(['vagrant', 'destroy', '-f', 'node1'])
subproc.check_call(['vagrant', 'up', 'node1', '--no-provi... |
tests/stg_with_known_weights.py | qiaone/GIF | 322 | 12628391 | import sys
sys.path.append('../')
from model import StyledGenerator, Discriminator
import torch
import numpy as np
generator = StyledGenerator(flame_dim=159,
all_stage_discrim=False,
embedding_vocab_size=70_000,
rendered_flame_ascondit... |
extra/python/example.py | ikrima/immer | 12,278 | 12628401 | <reponame>ikrima/immer
#!/usr/bin/env python##
# immer: immutable data structures for C++
# Copyright (C) 2016, 2017, 2018 <NAME>
#
# This software is distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
# include:intro/start
import im... |
exchangelib/services/upload_items.py | RossK1/exchangelib | 1,006 | 12628404 | <reponame>RossK1/exchangelib
from .common import EWSAccountService, to_item_id
from ..properties import ItemId, ParentFolderId
from ..util import create_element, set_xml_value, add_xml_child, MNS
class UploadItems(EWSAccountService):
"""MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-... |
classification/datasets/mnist.py | LittleWat/MCD_DA | 464 | 12628419 | <gh_stars>100-1000
import numpy as np
from scipy.io import loadmat
def load_mnist(scale=True, usps=False, all_use=False):
mnist_data = loadmat('../data/mnist_data.mat')
if scale:
mnist_train = np.reshape(mnist_data['train_32'], (55000, 32, 32, 1))
mnist_test = np.reshape(mnist_data['test_32'],... |
src/schnetpack/nn/initializers.py | giadefa/schnetpack | 713 | 12628422 | <reponame>giadefa/schnetpack<filename>src/schnetpack/nn/initializers.py<gh_stars>100-1000
from functools import partial
from torch.nn.init import constant_
zeros_initializer = partial(constant_, val=0.0)
|
intro/matplotlib/examples/plot_bar.py | junghun73/Learning | 419 | 12628424 | """
Bar plots
==========
An example of bar plots with matplotlib.
"""
import numpy as np
import matplotlib.pyplot as plt
n = 12
X = np.arange(n)
Y1 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n)
Y2 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n)
plt.axes([0.025, 0.025, 0.95, 0.95])
plt.bar(X, +Y1, face... |
tests/regressiontests/mk_complex.py | GCBallesteros/imreg_dft | 167 | 12628426 | import numpy as np
import scipy as sp
import scipy.io
import scipy.signal
np.random.seed(4)
abs_val, phase_val = [sp.rand(13, 20) for _ in range(2)]
phase_val *= 2 * np.pi
shift = (2, 3)
for img in (abs_val, phase_val):
for ax in range(2):
img[:] = sp.signal.resample(img, int(img.shape[ax] * 1.5), axis=... |
airmozilla/manage/views/decorators.py | mozilla/airmozilla | 115 | 12628445 | <gh_stars>100-1000
import functools
import warnings
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.contrib.auth.models import Permission
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
staff_required = user_passes_test(lambd... |
vimiv/main_window.py | karlch/vimiv | 268 | 12628456 | # vim: ft=python fileencoding=utf-8 sw=4 et sts=4
"""Gtk.ScrolledWindow class which is usually the main window of vimiv.
The ScrolledWindow can either include a Gtk.Image in IMAGE mode or a
Gtk.IconView in THUMBNAIL mode.
"""
import os
from gi.repository import Gtk
from vimiv.helpers import listdir_wrapper
from vimi... |
tdc/utils/__init__.py | ypapanik/TDC | 577 | 12628458 | from .load import distribution_dataset_load, \
generation_paired_dataset_load, \
three_dim_dataset_load,\
interaction_dataset_load,\
multi_dataset_load,\
property_dataset_load, \
oracle_load,\
receptor_load,\
bm_group_load
from .split import create_fold,\
create_fold_setting... |
google_or_tools/set_covering_skiena_sat.py | tias/hakank | 279 | 12628502 | <reponame>tias/hakank<gh_stars>100-1000
# Copyright 2021 <NAME> <EMAIL>
#
# 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 ... |
parcels/collection/collectionsoa.py | noemieplanat/Copy-parcels-master | 202 | 12628521 | <gh_stars>100-1000
from datetime import timedelta as delta
from operator import attrgetter
from ctypes import Structure, POINTER
from bisect import bisect_left
from math import floor
import numpy as np
from parcels.collection.collections import ParticleCollection
from parcels.collection.iterators import BaseParticleA... |
demo/MixedPoisson.py | jaisw7/shenfun | 138 | 12628542 | <filename>demo/MixedPoisson.py
r"""Solve Poisson's equation using a mixed formulation
The Poisson equation is
.. math::
\nabla^2 u &= f \\
u(x, y=\pm 1) &= 0 \\
u(x=2\pi, y) &= u(x=0, y)
We solve using the mixed formulation
.. math::
g - \nabla(u) &= 0 \\
\nabla \cdot g &= f \\
u(x, y=\pm ... |
docker/test/integration/minifi/processors/GenerateFlowFile.py | dtrodrigues/nifi-minifi-cpp | 113 | 12628601 | from ..core.Processor import Processor
class GenerateFlowFile(Processor):
def __init__(self, schedule={'scheduling period': '2 sec'}):
super(GenerateFlowFile, self).__init__(
'GenerateFlowFile',
schedule=schedule,
auto_terminate=['success'])
|
supervisor/superlance/timeoutconn.py | jzmq/minos | 365 | 12628614 | <filename>supervisor/superlance/timeoutconn.py
import httplib
import socket
class TimeoutHTTPConnection(httplib.HTTPConnection):
"""A customised HTTPConnection allowing a per-connection
timeout, specified at construction."""
timeout = None
def connect(self):
"""Override HTTPConnection.connect ... |
platypush/plugins/clipboard.py | RichardChiang/platypush | 228 | 12628617 | from platypush.plugins import Plugin, action
class ClipboardPlugin(Plugin):
"""
Plugin to programmatically copy strings to your system clipboard
and get the current clipboard content.
Requires:
* **pyperclip** (``pip install pyperclip``)
"""
@action
def copy(self, text):
... |
mindsdb/api/mongo/responders/list_indexes.py | yarenty/mindsdb | 261 | 12628626 | from mindsdb.api.mongo.classes import Responder
import mindsdb.api.mongo.functions as helpers
class Responce(Responder):
when = {'listIndexes': helpers.is_true}
def result(self, query, request_env, mindsdb_env, session):
return {
'cursor': [{
'v': 2,
'key':... |
util/update_lints.py | fkohlgrueber/rust-clippy-pattern | 1,686 | 12628629 | <filename>util/update_lints.py
#!/usr/bin/env python
import sys
def main():
print('Error: Please use `util/dev` to update lints')
return 1
if __name__ == '__main__':
sys.exit(main())
|
evaluate/gan.py | HappyBelief/ContraD | 168 | 12628673 | <gh_stars>100-1000
import os
import numpy as np
import torch
from torchvision.utils import make_grid
from evaluate import BaseEvaluator
from third_party.fid.inception import InceptionV3
from third_party.fid.fid_score import fid_score
from third_party.fid.fid_score import precompute_stats
device = torch.device("cuda"... |
example/documents.py | closeio/flask-mongorest | 268 | 12628687 | <reponame>closeio/flask-mongorest
from mongoengine import *
class DateTime(Document):
datetime = DateTimeField()
class Language(Document):
name = StringField()
class Person(Document):
name = StringField()
languages = ListField(ReferenceField(Language))
class User(Document):
email = EmailFiel... |
public/pypyjs/modules/pandas.py | inkandswitch/livebook | 195 | 12628710 | <reponame>inkandswitch/livebook
import json
from copy import copy
from math import pow,sqrt
def do_math(func,data):
if len(data) > 0 and (type(data[0]) == int or type(data[0]) == float):
return func(data)
else:
return None
def mean(nums):
return sum(nums)/len(nums)
class IlocIndexer(obje... |
solutions/problem_006.py | ksvr444/daily-coding-problem | 1,921 | 12628712 | <reponame>ksvr444/daily-coding-problem
class Node:
def __init__(self, data):
self.data = data
self.both = id(data)
def __repr__(self):
return str(self.data)
a = Node("a")
b = Node("b")
c = Node("c")
d = Node("d")
e = Node("e")
# id_map simulates object pointer values
id_map = dict()
i... |
server/backend/app/utils.py | jakuta-tech/TinyCheck | 2,054 | 12628746 | <filename>server/backend/app/utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import yaml
import sys
import os
from functools import reduce
def read_config(path):
"""
Read a value from the configuration
:return: value (it can be any type)
"""
dir = "/".join(sys.path[0... |
indra/sources/gnbr/processor.py | johnbachman/belpy | 136 | 12628747 | <filename>indra/sources/gnbr/processor.py
"""This module contains the processor for GNBR. There are several, each
corresponding to different kinds of interactions."""
import re
import itertools as it
from typing import List
from copy import deepcopy
import pandas as pd
from indra.statements import *
from indra.database... |
examples/fall_back_on_default.py | snuderl/apischema | 118 | 12628750 | from dataclasses import dataclass, field
from pytest import raises
from apischema import ValidationError, deserialize
from apischema.metadata import fall_back_on_default
@dataclass
class Foo:
bar: str = "bar"
baz: str = field(default="baz", metadata=fall_back_on_default)
with raises(ValidationError):
... |
custom_components/unifiprotect/button.py | mjdyson/unifiprotect | 546 | 12628763 | <filename>custom_components/unifiprotect/button.py<gh_stars>100-1000
"""Support for Ubiquiti's UniFi Protect NVR."""
from __future__ import annotations
import logging
from typing import Callable, Sequence
from homeassistant.components.button import ButtonDeviceClass, ButtonEntity
from homeassistant.config_entries imp... |
app/quicktime.py | IDAPluginProject/ida-minsc | 211 | 12628768 | <reponame>IDAPluginProject/ida-minsc
'''QuickTime stuff'''
EXPORT = [ 'nameDispatch', 'nameAllDispatches' ]
import idc,idautils
import function,database
import app
def nextMnemonic(ea, mnem, maxaddr=0xc0*0x1000000):
res = idc.print_insn_mnem(ea)
if res == "": return idc.BADADDR
if res == mnem: return ea
... |
autovideo/utils/axolotl_utils.py | datamllab/autovideo | 233 | 12628784 | <reponame>datamllab/autovideo
import os
import uuid
import shutil
import pathlib
import pandas as pd
from d3m.metadata.problem import TaskKeyword, PerformanceMetric
from d3m.metadata import base as metadata_base
from axolotl.utils import pipeline as pipeline_utils
from axolotl.utils import data_problem
from axolotl.b... |
gff/BCBio/__init__.py | bgruening/bcbb | 339 | 12628787 | """BCBio module
"""
|
kitti360scripts/devkits/convertOxtsPose/python/data.py | carloradice/kitti360Scripts | 214 | 12628800 | <reponame>carloradice/kitti360Scripts
import os
import numpy as np
def loadOxtsData(oxts_dir, frames=None):
''' reads GPS/IMU data from files to memory. requires base directory
(=sequence directory as parameter). if frames is not specified, loads all frames. '''
ts = []
if frames==None:
ts = loadTim... |
DeepBind/custom_keras_objects.py | Luma-1994/lama | 137 | 12628805 | import tensorflow as tf
OBJECTS = {"tf": tf}
|
Training Utility/somatictrainer/util.py | ZackFreedman/Somatic | 328 | 12628828 | import logging
import time
import numpy as np
import quaternion
logging.basicConfig(level=logging.INFO)
def lookRotation(forward, up):
"""
Quaternion that rotates world to face Forward, while keeping orientation dictated by Up
See https://answers.unity.com/questions/467614/what-is-the-source-code-of-qua... |
transferLearning_MoleculeNet_PPI/bio/pretrain_graphcl.py | Shen-Lab/GraphCL | 275 | 12628832 | <reponame>Shen-Lab/GraphCL<gh_stars>100-1000
import argparse
from loader import BioDataset_aug
from torch_geometric.data import DataLoader
from torch_geometric.nn.inits import uniform
from torch_geometric.nn import global_mean_pool
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim ... |
glasses/utils/Tracker.py | rentainhe/glasses | 271 | 12628864 | <gh_stars>100-1000
import torch.nn as nn
from torch import Tensor
from dataclasses import dataclass, field
from typing import List
@dataclass
class Tracker:
"""This class tracks all the operations of a given module by performing a forward pass.
Example:
>>> import torch
>>> import torch.nn a... |
setup.py | szaydel/pickledb | 668 | 12628882 | <gh_stars>100-1000
"""
pickleDB
--------
pickleDB is lightweight, fast, and simple database based on Python's own
json module. And it's BSD licensed!
pickleDB is Fun
```````````````
::
>>> import pickledb
>>> db = pickledb.load('test.db', False)
>>> db.set('key', 'value')
>>> db.get('key')
'... |
python/tests/sql/test_aggregate_functions.py | andreicovaliov/incubator-sedona | 747 | 12628887 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
icu_sources.py | plasticity-admin/supersqlite | 687 | 12628900 | icu_sources = [
'utypes.cpp',
'uloc.cpp',
'ustring.cpp',
'ucase.cpp',
'ubrk.cpp',
'brkiter.cpp',
'filteredbrk.cpp',
'ucharstriebuilder.cpp',
'uobject.cpp',
'resbund.cpp',
'servrbf.cpp',
'servlkf.cpp',
'serv.cpp',
'servnotf.cpp',
'servls.cpp',
'servlk.cpp',... |
mopidy_soundcloud/actor.py | Laurentww/mopidy-soundcloud | 161 | 12628913 | <gh_stars>100-1000
import logging
import pykka
from mopidy import backend
from mopidy_soundcloud.library import SoundCloudLibraryProvider
from mopidy_soundcloud.soundcloud import SoundCloudClient
logger = logging.getLogger(__name__)
class SoundCloudBackend(pykka.ThreadingActor, backend.Backend):
def __init__(s... |
migrations/versions/bb816156989f_moss_results.py | chrononyan/ok | 148 | 12628918 | """moss_results
Revision ID: bb816156989f
Revises: c71e52b908e6
Create Date: 2017-09-08 14:01:37.766562
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'c71e52b908e6'
from alembic import op
import sqlalchemy as sa
import server
def upgrade():
# ### commands auto generated by Al... |
vendor/xlsxwriter/chart_stock.py | Lwz1966/QQ-Groups-Spider | 882 | 12628924 | <filename>vendor/xlsxwriter/chart_stock.py
###############################################################################
#
# ChartStock - A class for writing the Excel XLSX Stock charts.
#
# Copyright 2013-2017, <NAME>, <EMAIL>
#
from . import chart
class ChartStock(chart.Chart):
"""
A class for writing th... |
egg/zoo/mnist_vae/train.py | vengalraoguttha/EGG | 254 | 12628934 | # 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.
import pathlib
import torch
import torch.utils.data
from torch import nn
from torch.nn import functional as F
from torchvision import datasets... |
DataServer/const.py | ajransaputra/geoip-attack-map | 299 | 12628938 | <reponame>ajransaputra/geoip-attack-map
META = [{
'lookup': 'city',
'tag': 'city',
'path': ['names','en'],
},{
'lookup': 'continent',
'tag': 'continent',
'path': ['names','en'],
},{
'lookup': 'continent_code',
'tag': 'continent',
'p... |
src/oci/operator_access_control/models/operator_action.py | Manny27nyc/oci-python-sdk | 249 | 12628950 | # 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 License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
finrl_meta/env_execution_optimizing/order_execution_qlib/trade/vecenv.py | eitin-infant/FinRL-Meta | 214 | 12628954 | import gym
import time
import ctypes
import numpy as np
from collections import OrderedDict
from multiprocessing.context import Process
from multiprocessing import Array, Pipe, connection, Queue
from typing import Any, List, Tuple, Union, Callable, Optional
from tianshou.env.worker import EnvWorker
from tianshou.env.u... |
office365/sharepoint/fields/field_thumbnail.py | rikeshtailor/Office365-REST-Python-Client | 544 | 12628970 | from office365.sharepoint.fields.field import Field
class FieldThumbnail(Field):
pass
|
Graphs/ShortesrReachInAGraph.py | WinterSoldier13/interview-preparation-kit | 175 | 12628982 | import queue
import collections
class Graph:
def __init__(self, n):
self.n = n
self.edges = collections.defaultdict(lambda: [])
def connect(self,x,y):
self.edges[x].append(y)
self.edges[y].append(x)
def find_all_distances(self, root):
distances = [-1 f... |
homeassistant/components/volkszaehler/__init__.py | domwillcode/home-assistant | 30,023 | 12629011 | """The volkszaehler component."""
|
picoCTF-web/api/common.py | minhnq1618/picoCTF | 280 | 12629022 | """Classes and functions used by multiple modules in the system."""
import uuid
from hashlib import md5
import bcrypt
from voluptuous import Invalid, MultipleInvalid
def token():
"""
Generate a random but insecure token.
Returns:
The randomly generated token
"""
return str(uuid.uuid4().... |
fedml_experiments/distributed/classical_vertical_fl/main_vfl.py | xuwanwei/FedML | 1,120 | 12629058 | import argparse
import logging
import os
import random
import socket
import sys
from sklearn.utils import shuffle
import numpy as np
import psutil
import setproctitle
import torch
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from fedml_api.model.finance.vfl_classifier import VFLClassif... |
glance/tests/unit/common/test_swift_store_utils.py | daespinel/glance | 309 | 12629072 | <reponame>daespinel/glance<filename>glance/tests/unit/common/test_swift_store_utils.py
# Copyright 2014 Rackspace
#
# 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:... |
plenum/test/simulation/sim_random.py | jandayanan/indy-plenum | 148 | 12629085 | import string
from abc import ABC, abstractmethod
from random import Random
from typing import Any, Iterable, List, Optional
class SimRandom(ABC):
@abstractmethod
def integer(self, min_value: int, max_value: int) -> int:
pass
@abstractmethod
def float(self, min_value: float, max_value: float)... |
Chapter13/lib/ksy/rfp_server.py | feiwang20/DRLHandsOn-Playground | 2,497 | 12629090 | # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
import array
import struct
import zlib
from enum import Enum
from pkg_resources import parse_version
from kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO
if parse_version(ks_version)... |
etl/parsers/etw/Microsoft_Windows_NlaSvc.py | IMULMUL/etl-parser | 104 | 12629106 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-NlaSvc
GUID : 63b530f8-29c9-4880-a5b4-b8179096e7b8
"""
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... |
tests/ignite/handlers/test_stores.py | Juddd/ignite | 4,119 | 12629126 | import pytest
from ignite.engine.engine import Engine, Events
from ignite.handlers import EpochOutputStore
@pytest.fixture
def dummy_evaluator():
def dummy_process_function(engine, batch):
return 1, 0
dummy_evaluator = Engine(dummy_process_function)
return dummy_evaluator
@pytest.fixture
def ... |
tests/_apis/team_fight_tactics/test_SummonerApi.py | TheBoringBakery/Riot-Watcher | 489 | 12629149 | <reponame>TheBoringBakery/Riot-Watcher
from unittest.mock import MagicMock
import pytest
from riotwatcher._apis.team_fight_tactics import SummonerApi
@pytest.mark.tft
@pytest.mark.unit
class TestSummonerApi:
def test_by_account(self):
mock_base_api = MagicMock()
expected_return = object()
... |
lhotse/recipes/commonvoice.py | stachu86/lhotse | 353 | 12629166 | <filename>lhotse/recipes/commonvoice.py
"""
Official description from the "about" page of the Mozilla CommonVoice project
(source link: https://commonvoice.mozilla.org/en/about)
Why Common Voice?
Mozilla Common Voice is an initiative to help teach machines how real people speak.
This project is an effort to bridge the... |
examples/render/render_euler_spiral.py | jkjt/ezdxf | 515 | 12629169 | <reponame>jkjt/ezdxf
# Copyright (c) 2010-2021, <NAME>
# License: MIT License
from pathlib import Path
from math import radians
import ezdxf
from ezdxf.render import EulerSpiral
from ezdxf.math import Matrix44
NAME = "euler_spiral.dxf"
DIR = Path("~/Desktop/Outbox").expanduser()
def four_c(curvature, length, rotatio... |
spytest/tests/routing/BGP/test_bgp_4node.py | shubav/sonic-mgmt | 132 | 12629195 | # BGP 4 node topology test cases
import pytest
from spytest import st, utils
import apis.routing.ip as ipapi
import apis.routing.bgp as bgpapi
import BGP.bgp4nodelib as bgp4nodelib
from spytest.utils import exec_all
from utilities.common import poll_wait
@pytest.fixture(scope="module", autouse=True)
def bgp_module_h... |
converter/ch_ppocr_v2_rec_converter.py | JimEverest/PaddleOCR2Pytorch | 364 | 12629201 | # https://zhuanlan.zhihu.com/p/335753926
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from collections import OrderedDict
import numpy as np
import cv2
import torch
from pytorchocr.base_ocr_v20 import BaseOCRV20
class PPOCRv2RecConverter(BaseOCRV20):
def __init__(s... |
paver/hg.py | timgates42/paver | 270 | 12629220 | <filename>paver/hg.py
"""Convenience functions for working with mercurial
This module does not include any tasks, only functions.
At this point, these functions do not use any kind of library. They require
the hg binary on the PATH."""
from paver.easy import sh
def clone(url, dest_folder, rev=None):
"""Clone ... |
tests/trainers/lightning/test_validation.py | facebookresearch/pythia | 3,252 | 12629227 | <filename>tests/trainers/lightning/test_validation.py
# Copyright (c) Facebook, Inc. and its affiliates.
import gc
import unittest
from typing import Any, Dict, Optional
from unittest.mock import MagicMock, patch
from mmf.common.meter import Meter
from mmf.trainers.callbacks.logistics import LogisticsCallback
from mm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.