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 |
|---|---|---|---|---|
src/hieroglyph/tests/test_builder.py | wescpy/hieroglyph | 115 | 11142715 | import glob
from unittest import TestCase
from bs4 import BeautifulSoup
from sphinx_testing import (
TestApp,
)
from hieroglyph.tests import util
from hieroglyph.tests.util import with_app
import hieroglyph.builder
class SlideBuilderTests(TestCase):
@with_app()
def test_get_theme_options(self, app, *arg... |
datasets.py | GongXinyuu/AutoGAN | 364 | 11142737 | # -*- coding: utf-8 -*-
# @Date : 2019-07-25
# @Author : <NAME> (<EMAIL>)
# @Link : None
# @Version : 0.0
import torch
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from torch.utils.data import Dataset
class ImageDataset(object):
def __init__(self, args, cur_img_size=... |
lidar_to_depth.py | jytime/Deep-SfM-Revisited | 126 | 11142752 | <filename>lidar_to_depth.py
import numpy as np
import os
import glob
import cv2
import pykitti
# Export Lidar Data to Depth Maps
# Change this to the directory where you store KITTI data
basedir = '/PATH/TO/YOUR/KITTIVO/DATA'
for sequence in ['00','01','02','03','04','05','06','07','08','09','10']:
# Specify t... |
src/cloudant/document.py | inuyasha82/python-cloudant | 187 | 11142758 | <reponame>inuyasha82/python-cloudant<gh_stars>100-1000
#!/usr/bin/env python
# Copyright © 2015, 2021 IBM Corp. 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
#
# ht... |
acp/message.py | 6sibilings/daniel-Allen | 133 | 11142783 | <filename>acp/message.py
import logging
import struct
import zlib
from .exception import ACPMessageError
from .keystream import *
def _generate_acp_header_key(password):
"""
Encrypt password for ACP message header key field
Note:
Truncates the password at 0x20 bytes, not sure if this is the right thing to use... |
src/oci/nosql/models/index_key.py | Manny27nyc/oci-python-sdk | 249 | 11142803 | <filename>src/oci/nosql/models/index_key.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://ww... |
b-tool/dec/b-tool.py | shyamjangid07/Reverse-Engineering | 337 | 11142811 | <filename>b-tool/dec/b-tool.py<gh_stars>100-1000
# Deobfuscated BY HTR-TECH | <NAME>
# Github : https://github.com/htr-tech
# Instagram : https://www.instagram.com/tahmid.rayat
# Facebook : https://fb.com/tahmid.rayat.oficial
# Messenger : https://m.me/tahmid.rayat.oficial
import os,sys,time
##### LOGO #####
... |
tests/test_misc.py | Hellowlol/bw_plex | 371 | 11142819 | import math
import pytest
from conftest import misc
def test_to_sec():
assert misc.to_sec(1) == 1
assert misc.to_sec('00:01') == 1
assert misc.to_sec('10:59') == 659
def test_get_valid_filename():
assert misc.get_valid_filename('M*A*S*H') == 'MASH'
def test_ignoreratingkey(film, episode):
as... |
ops/_private/yaml.py | r-f-g/operator | 147 | 11142824 | <filename>ops/_private/yaml.py
# Copyright 2021 Canonical 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... |
tests/ut/datavisual/mock.py | fapbatista/mindinsight | 216 | 11142826 | # Copyright 2019 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 agreed to... |
input/gcamdata/exec/run-xml-tests.py | cmcormack/gcam-core | 157 | 11142833 | <gh_stars>100-1000
#! /usr/bin/env python3
"""
Compare the GCAM xml files in olddir with their counterparts in newdir.
Usage: run-xml-tests.py [-v] olddir newdir
Discrepancies will be reported to stdout; all other messages (progress indicators,
etc.) will be written to stderr
"""
import sys
import os
import glob... |
src/_cffi_src/openssl/ocsp.py | ceridwen/cryptography | 333 | 11142847 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <openssl/ocsp.h>
"""
TYPES = """
typedef ... OCS... |
observations/r/film.py | hajime9652/observations | 199 | 11142891 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def film(path):
"""Film
Film data from Maltin's Movie and Video Guide
... |
tests/test_estimators/test_basics.py | kaipoethkow/scikit-lego | 784 | 11142951 | <reponame>kaipoethkow/scikit-lego
import pytest
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklego.dummy import RandomRegressor
from sklego.linear_model import DeadZoneRegressor
from sklego.mixture import (
GMMClassifier,
BayesianGMMClassifier,
GMMOutlierDete... |
test/test_rbql_sqlite.py | mechatroner/RBQL | 178 | 11142955 | <reponame>mechatroner/RBQL
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import unittest
import os
import sys
import json
import random
import tempfile
import time
import shutil
import sqlite3
import rbql
from rbql import rbql_engine
from rbql import rbql_sqlite... |
python/fate_flow/scheduling_apps/initiator_app.py | hubert-he/FATE | 3,787 | 11142986 | #
# Copyright 2019 The FATE 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 appli... |
tests/parsers/olecf_plugins/automatic_destinations.py | roshanmaskey/plaso | 1,253 | 11142998 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the .automaticDestinations-ms OLECF parser plugin."""
import unittest
from plaso.lib import definitions
from plaso.parsers.olecf_plugins import automatic_destinations
from tests.parsers.olecf_plugins import test_lib
class TestAutomaticDestinationsOLECFPlu... |
online_status/middleware.py | r26zhao/django-easy-comment | 318 | 11143003 | import datetime
from django.utils import timezone
from django.core.cache import cache
from django.utils.deprecation import MiddlewareMixin
from . import settings
from .models import OnlineStatus
class OnlineStatusMiddleware(MiddlewareMixin):
def process_request(self, request):
if request.user.is_authen... |
sydent/config/http.py | clmnin/sydent | 220 | 11143004 | <reponame>clmnin/sydent<gh_stars>100-1000
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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
... |
alipay/aop/api/domain/AntLinkeDevopsMobiledeviceReturnModel.py | antopen/alipay-sdk-python-all | 213 | 11143013 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AntLinkeDevopsMobiledeviceReturnModel(object):
def __init__(self):
self._device_id = None
self._remote_host = None
@property
def device_id(self):
return self._dev... |
tests/test_code/py/init/init.py | FreddyZeng/code2flow | 2,248 | 11143040 | <gh_stars>1000+
from the_import import ProvincialClass as pc, imported_func
class Abra():
def __init__(self):
self.cadabra()
def cadabra(self):
print("cadabra")
def b():
Abra()
b()
pc()
HiddenClass() # this is probably too defensive
imported_func()
|
mayan/apps/sources/wizards.py | eshbeata/open-paperless | 2,743 | 11143049 | <reponame>eshbeata/open-paperless
from __future__ import unicode_literals
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.http import urlencode
from django.utils.translation import ugettext_l... |
asterioids-pygame-project/source_code_step_4/space_rocks/models.py | syberflea/materials | 3,682 | 11143084 | from pygame.math import Vector2
class GameObject:
def __init__(self, position, sprite, velocity):
self.position = Vector2(position)
self.sprite = sprite
self.radius = sprite.get_width() / 2
self.velocity = Vector2(velocity)
def draw(self, surface):
blit_position = self... |
example/Al2O3/Al2O3.py | ladyteam/phonopy | 127 | 11143097 | """Example by <NAME>."""
import numpy as np
import phonopy
phonon = phonopy.load(
unitcell_filename="POSCAR-unitcell", supercell_matrix=[2, 2, 1], log_level=1
)
print("Space group: %s" % phonon.symmetry.get_international_table())
# Example to obtain dynamical matrix
dmat = phonon.get_dynamical_matrix_at_q([0, 0,... |
setup.py | maxschommer/pcbdl | 117 | 11143106 | #!/usr/bin/env python3
# Copyright 2019 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/LICENSE-2.0
#
# Unless required by applicable law o... |
pymagnitude/third_party_mock/parsimonious/nodes/__init__.py | tpeng/magnitude | 1,520 | 11143118 | class Node:
pass
class NodeVisitor:
def generic_visit(self, node, visited_children):
pass |
deon/__main__.py | NitronBeenGrinding/deonedits | 223 | 11143140 | <gh_stars>100-1000
from .cli import main
if __name__ == "__main__":
main(prog_name="python -m deon")
|
homeassistant/components/tautulli/sensor.py | andersop91/core | 22,481 | 11143173 | """A platform which allows you to get information from Tautulli."""
from __future__ import annotations
from typing import Any
from pytautulli import PyTautulli
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_API_KEY,
CO... |
tests/parsers/sqlite_plugins/chrome_cookies.py | roshanmaskey/plaso | 1,253 | 11143185 | <gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Google Chrome cookie database plugin."""
import unittest
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import chrome_cookies
from tests.parsers.sqlite_plugins import test_lib
class Chrome17CookiesPluginTest(test_l... |
tagulous/checks.py | nschlemm/django-tagulous | 307 | 11143188 | <filename>tagulous/checks.py
from django.core.checks import Warning, register
SERIALIZATION_MODULES_EXPECTED = {
"xml": "tagulous.serializers.xml_serializer",
"json": "tagulous.serializers.json",
"python": "tagulous.serializers.python",
"yaml": "tagulous.serializers.pyyaml",
}
WARNING_W001 = Warning(... |
rpython/translator/backendopt/gilanalysis.py | nanjekyejoannah/pypy | 381 | 11143202 | <gh_stars>100-1000
from rpython.translator.backendopt import graphanalyze
# This is not an optimization. It checks for possible releases of the
# GIL in all graphs starting from rgc.no_release_gil.
class GilAnalyzer(graphanalyze.BoolGraphAnalyzer):
def analyze_direct_call(self, graph, seen=None):
... |
vimfiles/bundle/vim-python/submodules/pylint/tests/test_import_graph.py | ciskoinch8/vimrc | 463 | 11143208 | <reponame>ciskoinch8/vimrc
# Copyright (c) 2006-2008, 2010, 2013 LOGILAB S.A. (Paris, FRANCE) <<EMAIL>>
# Copyright (c) 2012 <NAME> <<EMAIL>>
# Copyright (c) 2014-2018, 2020 <NAME> <<EMAIL>>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015 <NAME> <<EMAIL>>
# Copyright (c) 2016 <NAME> <<EMAIL>>
# Copyright (c) 201... |
tutorials/W1D3_ModelFitting/solutions/W1D3_Tutorial4_Solution_89324713.py | eduardojdiniz/CompNeuro | 2,294 | 11143229 |
mse_list = []
order_list = list(range(max_order + 1))
for order in order_list:
X_design = make_design_matrix(x, order)
# Get prediction for the polynomial regression model of this order
y_hat = X_design @ theta_hats[order]
# Compute the residuals
residuals = y - y_hat
# Compute the MSE
mse = np.mean... |
nucleus/io/python/vcf_reader_wrap_test.py | google/nucleus | 721 | 11143278 | <reponame>google/nucleus
# 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... |
tests/random/random_random.py | Fryguy/py2rb | 124 | 11143281 | <reponame>Fryguy/py2rb
import random
x = random.random()
if 0 < x < 1:
print("OK")
else:
print("NG")
|
pcan/models/roi_heads/refine_heads/hr_em_match_head.py | SysCV/pcan | 271 | 11143326 | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import force_fp32, auto_fp16
from mmcv.cnn import ConvModule, build_upsample_layer
from mmdet.core import bbox_rescale
from mmdet.models.builder import HEADS, build_loss
from mmdet.models.roi_heads.mask_... |
PyEMD/tests/test_all.py | jurg96/PyEMD | 583 | 11143358 | <filename>PyEMD/tests/test_all.py
import unittest
import sys
if __name__ == '__main__':
test_suite = unittest.defaultTestLoader.discover('.', '*test*.py')
test_runner = unittest.TextTestRunner(resultclass=unittest.TextTestResult)
result = test_runner.run(test_suite)
sys.exit(not result.wasSuccessful())... |
modules/zip_cracker.py | Lola224/hakkuframework | 250 | 11143369 | <gh_stars>100-1000
# Copyright (C) 2015 – 2021 <NAME> (4shadoww)
from core.hakkuframework import *
from core import colors
import zipfile
import threading, queue
from core import getpath
from os.path import relpath
import sys
conf = {
"name": "zip_cracker", # Module's name (should be same as file name)
"versi... |
solvers/cns/cnsAnimation.py | mfkiwl/libparanumal | 102 | 11143376 | #### cnsAnimation.py
#### usage: pvbatch pvbatch cnsAnimation.py 1 ../examples/cnsTri2D/foo foo
#### import the simple module from the paraview
from paraview.simple import *
import glob
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
Ndatasets = int(sys.argv[1])
data... |
packages/opal-common/opal_common/sources/base_policy_source.py | permitio/opal | 106 | 11143381 | import asyncio
import os
from functools import partial
from typing import Callable, Coroutine, List, Union
from git.objects.commit import Commit
from opal_common.logger import logger
OnNewPolicyCallback = Callable[[Commit, Commit], Coroutine]
OnPolicyFailureCallback = Callable[[Exception], Coroutine]
class BasePoli... |
python/basic_api.py | APinkLemon/Learn-Carla | 148 | 11143389 | <filename>python/basic_api.py
"""
In this script, we are going to learn how to spawn a vehicle on the road and make it autopilot.
At the same time, we will collect camera and lidar data from it.
"""
import carla
import os
import random
def main():
actor_list = []
sensor_list = []
try:
# First of... |
pyscf/pbc/dft/test/test_krkspu.py | QuESt-Calculator/pyscf | 501 | 11143395 | #!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... |
tensorflow_ranking/python/keras/metrics.py | sarvex/tensorflow-ranking | 2,482 | 11143402 | <filename>tensorflow_ranking/python/keras/metrics.py<gh_stars>1000+
# Copyright 2021 The TensorFlow Ranking Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.... |
test/integration/component/test_bigswitch_bcf.py | Codegass/cloudstack | 1,131 | 11143425 | <gh_stars>1000+
# 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"... |
preprocessing/compute_pixel_distance.py | enviromachinebeast/head2head | 206 | 11143428 | import cv2
import os
import numpy as np
import argparse
import collections
import torch
import itertools
from tqdm import tqdm
import util.util as util
IMG_EXTENSIONS = ['.png']
def is_image_file(filename):
return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)
def get_image_paths_dict(dir):
... |
tests/__init__.py | dtardoin/airflow | 150 | 11143430 | <reponame>dtardoin/airflow
from __future__ import absolute_import
from .core import *
|
zipline/pipeline/classifiers/classifier.py | lv-cha/zipline-chinese | 606 | 11143434 | <filename>zipline/pipeline/classifiers/classifier.py
"""
classifier.py
"""
from numbers import Number
from numpy import where, isnan, nan, zeros
from zipline.lib.quantiles import quantiles
from zipline.pipeline.term import ComputableTerm
from zipline.utils.input_validation import expect_types
from zipline.utils.numpy... |
third_party/google-endpoints/Crypto/SelfTest/Random/Fortuna/test_FortunaAccumulator.py | tingshao/catapult | 2,151 | 11143449 | # -*- coding: utf-8 -*-
#
# SelfTest/Random/Fortuna/test_FortunaAccumulator.py: Self-test for the FortunaAccumulator module
#
# Written in 2008 by <NAME> <<EMAIL>>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent th... |
test/test_jieba.py | honmaple/flask-search | 213 | 11143453 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ********************************************************************************
# Copyright © 2018 jianglin
# File Name: test_jieba.py
# Author: jianglin
# Email: <EMAIL>
# Created: 2018-05-18 13:22:46 (CST)
# Last Update: Tuesday 2018-12-18 11:32:46 (... |
migrations/versions/c3dbfdaeb45b_.py | muellermartin/moa | 238 | 11143463 | """empty message
Revision ID: c3dbfdaeb45b
Revises: <PASSWORD>
Create Date: 2019-12-01 16:12:12.484573
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c3dbfdaeb45b'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### ... |
discovery-provider/src/model_validator.py | atticwip/audius-protocol | 429 | 11143489 | import os.path
import json
import copy
from typing import Dict, Any
import logging # pylint: disable=C0302
from jsonschema import Draft7Validator, ValidationError, SchemaError
logger = logging.getLogger(__name__)
# https://app.quicktype.io/ -- JSON schema generator
class ModelValidator:
"""
{key: value} :
... |
Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Deepak and Primes.py | cnm06/Competitive-Programming | 994 | 11143490 | def SieveOfEratosthenes(n):
prime = [True for i in xrange(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * 2, n+1, p):
prime[i] = False
p += 1
ans = []
for p in xrange(2, n):
if prime[p]:
ans.append(p... |
dragonfly/nn/unittest_cp_nn_gp.py | hase1128/dragonfly | 675 | 11143498 | <filename>dragonfly/nn/unittest_cp_nn_gp.py
"""
Unittests for Cartesian product GP with NN domains. Testing these separately since
we do not need to have nn dependencies in the gp module.
-- <EMAIL>
"""
# pylint: disable=invalid-name
# pylint: disable=no-member
import os
import numpy as np
import unittest
# Loc... |
src/beanmachine/ppl/inference/tests/sampler_test.py | horizon-blue/beanmachine-1 | 177 | 11143521 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import beanmachine.ppl as bm
import torch
import torch.distributions as dist
class SampleModel:
@bm.random_variable
def foo(self):... |
contrib/stack/topsStack/sentinelApp.py | yuankailiu/isce2 | 1,133 | 11143531 | #!/usr/bin/env python3
########################
#Author: <NAME>, <NAME>
# For Geocoding SLCs
#######################
import os, sys, glob
import argparse
import configparser
import datetime
import numpy as np
import isce
import isceobj
from isceobj.Sensor.TOPS.Sentinel1 import Sentinel1
from Stack import config, run... |
sdk/python/tests/unit/test_feature_view.py | kevjumba/feast | 810 | 11143533 | # Copyright 2022 The Feast Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
pandas/tests/series/methods/test_pct_change.py | CJL89/pandas | 1,738 | 11143540 | import numpy as np
import pytest
from pandas import Series, date_range
import pandas._testing as tm
class TestSeriesPctChange:
def test_pct_change(self, datetime_series):
rs = datetime_series.pct_change(fill_method=None)
tm.assert_series_equal(rs, datetime_series / datetime_series.shift(1) - 1)
... |
tests/ui/test_nodegraphhooks.py | Hengle/Houdini-Toolbox | 136 | 11143550 | <reponame>Hengle/Houdini-Toolbox
"""Test the python3.7libs/nodegraphhooks.py module."""
# ==============================================================================
# IMPORTS
# ==============================================================================
# Standard Library
import importlib.util
spec = importlib... |
core/polyaxon/polyflow/run/patch.py | admariner/polyaxon | 3,200 | 11143584 | <filename>core/polyaxon/polyflow/run/patch.py
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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/... |
tests/test_search.py | nateprewitt/jmespath.py | 1,549 | 11143603 | import sys
import decimal
from tests import unittest, OrderedDict
import jmespath
import jmespath.functions
class TestSearchOptions(unittest.TestCase):
def test_can_provide_dict_cls(self):
result = jmespath.search(
'{a: a, b: b, c: c}.*',
{'c': 'c', 'b': 'b', 'a': 'a', 'd': 'd'},
... |
benchmarks/operator_benchmark/pt/qtensor_method_test.py | jsun94/nimble | 206 | 11143606 | import operator_benchmark as op_bench
import torch
# Configs for pointwise and reduction unary ops
qmethods_configs_short = op_bench.config_list(
attr_names=['M', 'N'],
attrs=[
[32, 32],
],
cross_product_configs={
'dtype': [torch.quint8],
'contig': [False, True],
},
tags... |
convokit/prompt_types/promptTypes.py | Ap1075/Cornell-Conversational-Analysis-Toolkit | 371 | 11143635 | import numpy as np
import pandas as pd
import os
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.preprocessing import normalize
from sklearn.decomposition import TruncatedSVD
from sklearn.cluster import KMeans
import joblib
from convokit.transformer import Transformer
class PromptTypes(Transf... |
demos/rpc/jsonrpc_sync_client.py | mstojcevich/cyclone | 254 | 11143638 | <reponame>mstojcevich/cyclone<filename>demos/rpc/jsonrpc_sync_client.py
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2010 <NAME>
# based on the original Tornado by Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You m... |
enn/networks/categorical_ensembles.py | MaxGhenis/enn | 130 | 11143643 | # python3
# pylint: disable=g-bad-file-header
# Copyright 2021 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... |
pkgs/os-specific/linux/kernel/hardened/update.py | siddhantk232/nixpkgs | 9,717 | 11143646 | <filename>pkgs/os-specific/linux/kernel/hardened/update.py
#! /usr/bin/env nix-shell
#! nix-shell -i python -p "python38.withPackages (ps: [ps.PyGithub])" git gnupg
# This is automatically called by ../update.sh.
from __future__ import annotations
import json
import os
import re
import subprocess
import sys
from dat... |
sofi/ui/tablehead.py | screamingskulls/sofi | 402 | 11143669 | <gh_stars>100-1000
from .element import Element
from .tablerow import TableRow
from .tablecell import TableCell
class TableHead(Element):
"""Implements the <thead> tag"""
def __init__(self, cl=None, ident=None, style=None, attrs=None):
super().__init__(cl=cl, ident=ident, style=style, attrs=attrs)
... |
consolemenu/console_menu.py | ahauser31/console-menu | 230 | 11143692 | <filename>consolemenu/console_menu.py
from __future__ import print_function
import platform
import threading
import os
from consolemenu.menu_formatter import MenuFormatBuilder
from consolemenu.screen import Screen
class ConsoleMenu(object):
"""
A class that displays a menu and allows the user to select an ... |
guppy/heapy/RM.py | odidev/guppy3 | 251 | 11143742 | # Start a remote monitoring enabling thread,
# unless I am that thread myself.
from guppy.heapy.Remote import on
on()
|
src/bronkerbosch.py | baoe/FLAS | 146 | 11143747 | <gh_stars>100-1000
#!/usr/bin/env python
#by bao: to let runFLAS.py use this script directly
# Finds all maximal cliques in a graph using the Bron-Kerbosch algorithm. The input graph here is
# in the adjacency list format, a dict with vertexes as keys and lists of their neighbors as values.
# https://en.wikipedia.org/... |
RecoJets/JetProducers/python/hltPUIdAlgo_cff.py | ckamtsikis/cmssw | 852 | 11143770 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
####################################################################################################################
full_74x_wp = cms.PSet(
#4 Eta Categories 0-2.5 2.5-2.75 2.75-3.0 3.0-5.0
#Tight Id
... |
src/primify/__init__.py | borea17/primify | 455 | 11143772 | # -*- coding: utf-8 -*-
from pkg_resources import get_distribution, DistributionNotFound
import logging
from rich.console import Console
console = Console()
FORMAT = "%(message)s"
logging.basicConfig(level="DEBUG", format=FORMAT, datefmt="[%X]", filename="logs.txt")
try:
# Change here if project is renamed and d... |
test/ut/tools/annotation/test_annotation.py | dutxubo/nni | 9,680 | 11143774 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from nni.tools import annotation
import ast
import json
from pathlib import Path
import shutil
import tempfile
import pytest
cwd = Path(__file__).parent
shutil.rmtree(cwd / '_generated', ignore_errors=True)
shutil.copytree(cwd ... |
deprecated/software/Navigator/DiscreteGridUtils.py | mfkiwl/GAAS | 2,111 | 11143841 | #encoding=utf-8
class DiscreteGridUtils:
def __init__(self,grid_size = 0.3):
self.grid_size = grid_size
def continuous_to_discrete(self,pos): # pos:x,y,z
#print (((pos[0] - (self.grid_size * 0.5)) / self.grid_size),
# ((pos[1] - (self.grid_size * 0.5)) / self.grid_size),
# ((po... |
presidio-analyzer/app.py | vtols/presidio | 1,408 | 11143887 | <gh_stars>1000+
"""REST API server for analyzer."""
import json
import logging
import os
from logging.config import fileConfig
from pathlib import Path
from typing import Tuple
from flask import Flask, request, jsonify, Response
from werkzeug.exceptions import HTTPException
from presidio_analyzer.analyzer_engine impo... |
alipay/aop/api/domain/AlipayFundTransAacollectBatchCreateModel.py | snowxmas/alipay-sdk-python-all | 213 | 11143901 | <reponame>snowxmas/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayFundTransAacollectBatchCreateModel(object):
def __init__(self):
self._batch_memo = None
self._channel = None
self._ext_param... |
websauna/tests/static/test_static_asset.py | stevepiercy/websauna | 286 | 11143904 | # Standard Library
import os
import shutil
# Pyramid
from pyramid.config import Configurator
import pytest
# Websauna
from websauna.system.devop.cmdline import init_websauna
from websauna.system.http.static import DefaultStaticAssetPolicy
from websauna.tests.cookiecutter.scaffold import execute_command
from websauna... |
ncclient/logging_.py | doesitblend/ncclient | 498 | 11143917 | <gh_stars>100-1000
import logging
class SessionLoggerAdapter(logging.LoggerAdapter):
"""Logger adapter that automatically adds session information to logs."""
def process(self, msg, kwargs):
if 'session' not in self.extra or self.extra['session'] is None:
return msg, kwargs
session... |
scalene/scalene_arguments.py | barseghyanartur/scalene | 1,708 | 11143945 | <filename>scalene/scalene_arguments.py
import argparse
class ScaleneArguments(argparse.Namespace):
def __init__(self) -> None:
super(ScaleneArguments, self).__init__()
self.cpu_only = False
self.cpu_percent_threshold = 1
# mean seconds between interrupts for CPU sampling.
s... |
flexget/plugins/cli/filters.py | astrotee/Flexget | 1,322 | 11143976 | <gh_stars>1000+
import inspect
from flexget import options
from flexget.event import event
from flexget.terminal import TerminalTable, console, table_parser
from flexget.utils.template import get_filters
def do_cli(manager, options):
header = ['Name', 'Description']
table = TerminalTable(*header, table_type=... |
Algo and DSA/LeetCode-Solutions-master/Python/minimum-number-of-arrows-to-burst-balloons.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11143986 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/minimum-number-of-arrows-to-burst-balloons.py
# Time: O(nlogn)
# Space: O(1)
class Solution(object):
def findMinArrowShots(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
if not points:
ret... |
examples/nas/oneshot/pfld/train.py | ggzhang0071/nni | 9,680 | 11144015 | <reponame>ggzhang0071/nni<filename>examples/nas/oneshot/pfld/train.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from __future__ import absolute_import, division, print_function
import argparse
import logging
import os
import torch
import torchvision
import numpy as np
from datasets im... |
Misc/SumOfAllDigits/solution1.py | gbrls/CompetitiveCode | 165 | 11144032 | a, b = map(int, input().split())
# Find sum of digits of a number
def sumDigits(n):
tot = 0
while(n > 0):
tot += n % 10
n //= 10
return tot
# Recursively find sum of digits till the number is single digit
def sumOfDigits(n):
k = sumDigits(n)
if k > 9:
return sumOfDigits(k)
... |
insights/parsers/installed_product_ids.py | lhuett/insights-core | 121 | 11144097 | """
Installed product IDs
=====================
InstalledProductIDs - command ``find /etc/pki/product-default/ /etc/pki/product/ -name '*pem' -exec rct cat-cert --no-content '{}' \;``
---------------------------------------------------------------------------------------------------------------------------------------... |
share/lib/python/neuron/tests/test_rxd.py | niltonlk/nrn | 203 | 11144109 | from neuron import h
import neuron
import unittest
import sys
from multiprocessing import Process
try:
import multiprocessing as mp
mp.set_start_method("spawn")
except:
pass
scalar_bistable_data = [
4.666144368739553e-24,
2.888704007378294e-23,
1.986504953195841e-22,
1.341708879755938e-21... |
tests/unit/test_gp_repurposer.py | apaleyes/xfer | 244 | 11144122 | <gh_stars>100-1000
# Copyright 2018 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... |
getsub/__version__.py | pzgz/GetSubtitles | 793 | 11144138 | __version__ = "1.7.9"
|
lintreview/tools/pytype.py | jsoref/lint-review | 271 | 11144142 | import hashlib
import os
import re
import logging
import lintreview.docker as docker
from lintreview.tools import Tool, extract_version
from lintreview.review import IssueComment
buildlog = logging.getLogger('buildlog')
class Pytype(Tool):
name = 'pytype'
def version(self):
output = docker.run('py... |
PyFin/Env/Settings.py | rpatil524/Finance-Python | 325 | 11144212 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
u"""
Created on 2015-8-14
@author: cheng.li
"""
from PyFin.DateUtilities import Date
from PyFin.Utilities import require
class SettingsFactory(object):
def __init__(self):
self._evaluationDate = None
self._includeToday = None
@property
def eval... |
chrome/installer/tools/shortcut_properties.py | google-ar/chromium | 2,151 | 11144224 | # Copyright 2015 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.
"""Dumps a Windows shortcut's property bag to stdout.
This is required to confirm correctness of properties that aren't readily
available in Windows UI.
"""... |
app/controllers/api/records.py | grepleria/SnitchDNS | 152 | 11144243 | from . import bp
from app.lib.base.decorators import api_auth
from app.lib.api.records import ApiRecords
from flask_login import current_user
@bp.route('/zones/<string:zone>/records', methods=['GET'])
@api_auth
def zone_records(zone):
user_id = None if current_user.admin else current_user.id
domain = None
... |
challenge_2/python/bryantpq/search_item.py | rchicoli/2017-challenges | 271 | 11144265 | <gh_stars>100-1000
def search_item(a):
d = {}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
if 1 not in d.values():
print("No unique values found!")
return
for k, v in d.items():
if v == 1:
print("Unique value is " + str(k))... |
azure-devops/azext_devops/devops_sdk/v5_1/project_analysis/models.py | keithlemon/azure-devops-cli-extension | 326 | 11144272 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------------------------------------... |
bazel/deps.bzl | mway/prototool | 4,922 | 11144274 | <gh_stars>1000+
load("@bazel_gazelle//:deps.bzl", "go_repository")
def prototool_deps(**kwargs):
go_repository(
name = "co_honnef_go_tools",
importpath = "honnef.co/go/tools",
sum = "h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=",
version = "v0.0.1-2019.2.3",
)
go_reposito... |
tests/api/v1/teams/test_scoring.py | nox237/CTFd | 3,592 | 11144284 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from CTFd.models import Users
from CTFd.utils import set_config
from tests.helpers import create_ctfd, destroy_ctfd, gen_award, gen_team, login_as_user
def test_api_team_place_hidden_if_scores_hidden():
"""/api/v1/teams/me should not reveal team place if scores aren'... |
simulation/decai/simulation/contract/classification/ncc_module.py | boost-entropy-python/0xDeCA10B | 445 | 11144290 | from decai.simulation.contract.classification.ncc import NearestCentroidClassifier
from decai.simulation.contract.classification.scikit_classifier import SciKitClassifierModule
class NearestCentroidClassifierModule(SciKitClassifierModule):
def __init__(self):
super().__init__(
_model_initializ... |
hummingbot/connector/exchange/coinflex/coinflex_exchange.py | cardosofede/hummingbot | 542 | 11144310 | <reponame>cardosofede/hummingbot
import asyncio
import logging
import time
from decimal import Decimal
from typing import (
Any,
AsyncIterable,
Dict,
List,
Optional,
)
from async_timeout import timeout
import hummingbot.connector.exchange.coinflex.coinflex_constants as CONSTANTS
import hummingbot.... |
test/hummingbot/connector/exchange/coinzoom/test_coinzoom_auth.py | BGTCapital/hummingbot | 3,027 | 11144320 | from unittest import TestCase
from hummingbot.connector.exchange.coinzoom.coinzoom_auth import CoinzoomAuth
class CoinzoomAuthTests(TestCase):
def setUp(self) -> None:
super().setUp()
self._api_key = 'testApiKey'
self._secret_key = 'testSecretKey'
self._username = 'testUserName'
... |
models/nvidia_pn.py | cclauss/DBNet | 188 | 11144328 | <gh_stars>100-1000
import os
import sys
import tensorflow as tf
import scipy
import numpy as np
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(BASE_DIR, '../utils'))
import tf_util
import pointnet
def placeholder_inputs(batch_size, img_rows=66, img_cols=200, points=16384, separa... |
semantic_release/helpers.py | Agilicus/python-semantic-release | 445 | 11144333 | import functools
from typing import Union
from requests import Session
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
def format_arg(value):
if type(value) == str:
return f"'{value.strip()}'"
else:
return str(value)
def build_requests_sessio... |
machine-learning/optical-character-recognition/extracting_text.py | caesarcc/python-code-tutorials | 1,059 | 11144345 | import pytesseract
import cv2
import matplotlib.pyplot as plt
import sys
from PIL import Image
# read the image using OpenCV
# from the command line first argument
image = cv2.imread(sys.argv[1])
# or you can use Pillow
# image = Image.open(sys.argv[1])
# get the string
string = pytesseract.image_to_string(image)
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.