max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
seagrass/hooks/__init__.py | kernelmethod/Seagrass | 0 | 4700 | <filename>seagrass/hooks/__init__.py
# flake8: noqa: F401
from .context_manager_hook import ContextManagerHook
from .counter_hook import CounterHook
from .file_open_hook import FileOpenHook
from .logging_hook import LoggingHook
from .profiler_hook import ProfilerHook
from .runtime_audit_hook import RuntimeAuditHook
fro... | 1.203125 | 1 |
tests/test_internal.py | aschleg/hypy | 40 | 4701 | <reponame>aschleg/hypy<filename>tests/test_internal.py
import pytest
import numpy as np
import pandas as pd
from hypothetical._lib import _build_des_mat
def test_array():
d = np.array([[1., 1.11, 2.569, 3.58, 0.76],
[1., 1.19, 2.928, 3.75, 0.821],
[1., 1.09, 2.865, 3.93, 0.928]... | 2.15625 | 2 |
download.py | JamesWang007/Open3D-PointNet | 120 | 4702 | <reponame>JamesWang007/Open3D-PointNet<gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Download big fil... | 2.234375 | 2 |
ls12/demo5.py | cklwblove/python-100-days-source-code | 0 | 4703 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
将耗时间的任务放到线程中以获得更好的用户体验。
"""
import time
import tkinter
import tkinter.messagebox
def download():
# 模拟下载任务需要花费10秒时间
time.sleep(10)
tkinter.messagebox.showinfo('提示', '下载完成')
def show_about():
tkinter.messagebox.showinfo('关于', '作者:罗浩')
def ma... | 3.4375 | 3 |
hangupsbot/sinks/gitlab/simplepush.py | mygreentour/hangoutsbot | 0 | 4704 | """
GitLab webhook receiver - see http://doc.gitlab.com/ee/web_hooks/web_hooks.html
"""
import asyncio
import json
import logging
from sinks.base_bot_request_handler import AsyncRequestHandler
logger = logging.getLogger(__name__)
try:
import dateutil.parser
except ImportError:
logger.error("missing module p... | 2.453125 | 2 |
evsim/assessor.py | cbchoi/nppsim | 3 | 4705 | <reponame>cbchoi/nppsim<gh_stars>1-10
from evsim.system_simulator import SystemSimulator
from evsim.behavior_model_executor import BehaviorModelExecutor
from evsim.system_message import SysMessage
from evsim.definition import *
import os
import subprocess as sp
class Assessor(BehaviorModelExecutor):
def ... | 2.328125 | 2 |
tei_entity_enricher/interface/postprocessing/gnd_connector.py | NEISSproject/TEIEntityEnricher | 0 | 4706 | import os
from typing import Union, List
from tei_entity_enricher.interface.postprocessing.io import FileReader, FileWriter
from tei_entity_enricher.util.helper import local_save_path, makedir_if_necessary
from tei_entity_enricher.util.exceptions import FileNotFound
class GndConnector:
def __init__(
... | 2.296875 | 2 |
neslter/workflow/__init__.py | WHOIGit/nes-lter-ims | 3 | 4707 | <filename>neslter/workflow/__init__.py
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
logger.level = logging.DEBUG | 1.453125 | 1 |
inference/_archive/render_section.py | emitch/SEAMLeSS | 4 | 4708 | <filename>inference/_archive/render_section.py
from args import get_argparser, parse_args, get_aligner, get_bbox
def render(aligner, bbox, z):
aligner.total_bbox = bbox
aligner.zs = z
aligner.render_section_all_mips(z, bbox)
if __name__ == '__main__':
parser = get_argparser()
args = parse_args(parser)
a... | 2.40625 | 2 |
venv/lib/python3.9/site-packages/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py | qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3 | 0 | 4709 | <reponame>qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3
# -*- coding: utf-8 -*-
#
# 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
#
# htt... | 1.101563 | 1 |
src/ScaleHD/__backend.py | helloabunai/ScaleHD | 3 | 4710 | #/usr/bin/python
__version__ = '1.0'
__author__ = '<EMAIL>'
##
## Imports
import string
import os
import errno
import shutil
import sys
import glob
import datetime
import subprocess
import logging as log
import numpy as np
import csv
from io import StringIO
import PyPDF2
from sklearn import preprocessing
from collecti... | 2.4375 | 2 |
tests/test_models/test_backbones/test_encoder_decoders/test_deepfill_encoder.py | Jian137/mmediting-1 | 1,884 | 4711 | <gh_stars>1000+
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder
from mmedit.models.common import SimpleGatedConvModule
def test_deepfill_enc():
encoder = DeepFillEncoder()
x = torch.randn((2, 5, 256, 256))
outputs =... | 2.1875 | 2 |
mvp/migrations/0004_auto_20201127_0649.py | Wastecoinng/mvp_beta | 0 | 4712 | # Generated by Django 2.2.13 on 2020-11-27 05:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mvp', '0003_hublocation'),
]
operations = [
migrations.RemoveField(
model_name='hublocation',
name='longitude',
... | 1.625 | 2 |
adminapp/migrations/0012_auto_20210714_1155.py | mofresh27/MuseumExperience-Group2-Python-BE-1 | 0 | 4713 | <filename>adminapp/migrations/0012_auto_20210714_1155.py
# Generated by Django 3.2.4 on 2021-07-14 11:55
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('adminapp', '0011_faq'),
]
operations = [
migrations.AddField(
... | 1.632813 | 2 |
scripts/json_parse.py | andrewsimonds14/Capstone | 0 | 4714 | <reponame>andrewsimonds14/Capstone
import json
import os
import nibabel as nib
import csv
from operator import itemgetter
# PATH TO PREPROCESSED DATA
raw_data_path = '/home/lab/nnUNet_data/nnUNet_raw_data_base/nnUNet_raw_data/Task500_BrainMets'
pixdim_ind = [1,2,3] # Indexes at which the voxel size [x,y,z] is stored
... | 2.953125 | 3 |
tests/gen_test.py | tinylambda/tornadio2 | 0 | 4715 | # -*- coding: utf-8 -*-
"""
tornadio2.tests.gen
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 by the <NAME>, see AUTHORS for more details.
:license: Apache, see LICENSE for more details.
"""
from collections import deque
from nose.tools import eq_
from tornadio2 import gen
_queue = None
def init_envir... | 1.992188 | 2 |
DeepBrainSeg/tumor/Tester.py | JordanMicahBennett/DeepBrainSeg | 1 | 4716 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# author: <NAME>
# contact: <EMAIL>
import torch
import SimpleITK as sitk
import numpy as np
import nibabel as nib
from torch.autograd import Variable
from skimage.transform import resize
from torchvision import transforms
from time import gmtime, strftime
from tqdm i... | 2.421875 | 2 |
statsmodels/discrete/tests/test_conditional.py | porcpine1967/statsmodels | 0 | 4717 | import numpy as np
from statsmodels.discrete.conditional_models import (
ConditionalLogit, ConditionalPoisson)
from statsmodels.tools.numdiff import approx_fprime
from numpy.testing import assert_allclose
import pandas as pd
def test_logit_1d():
y = np.r_[0, 1, 0, 1, 0, 1, 0, 1, 1, 1]
g = np.r_[0, 0, 0... | 2.53125 | 3 |
bert_e/workflow/gitwaterflow/utils.py | tcarmet/bert-e | 0 | 4718 | <reponame>tcarmet/bert-e
def bypass_incompatible_branch(job):
return (job.settings.bypass_incompatible_branch or
job.author_bypass.get('bypass_incompatible_branch', False))
def bypass_peer_approval(job):
return (job.settings.bypass_peer_approval or
job.author_bypass.get('bypass_peer_a... | 1.945313 | 2 |
bkt/library/powerpoint/elements.py | pyro-team/bkt-toolbox | 12 | 4719 | <filename>bkt/library/powerpoint/elements.py
# -*- coding: utf-8 -*-
'''
Created on 02.11.2017
@author: fstallmann
'''
from __future__ import absolute_import
from collections import deque
import bkt
from bkt import dotnet
Drawing = dotnet.import_drawing()
from . import helpers as pplib
class TextframeSpinnerBox... | 1.90625 | 2 |
sc2/unit.py | guliverza/AdditionalPylons | 0 | 4720 | <filename>sc2/unit.py
from __future__ import annotations
import warnings
from typing import Any, Dict, List, Optional, Set, Tuple, Union, TYPE_CHECKING
from .cache import property_immutable_cache, property_mutable_cache
from .constants import (
transforming,
IS_STRUCTURE,
IS_LIGHT,
IS_ARMORED,
IS_B... | 2.15625 | 2 |
healthy_candies/load/__init__.py | striantafyllouEPFL/healthy-candies | 1 | 4721 | from .load import load_data, NUTRI_COLS, load_clean_rel_to_nutri
| 1.046875 | 1 |
simglucose/sensor/cgm.py | mia-jingyi/simglucose | 0 | 4722 | <gh_stars>0
# from .noise_gen import CGMNoiseGenerator
from .noise_gen import CGMNoise
import pandas as pd
import logging
logger = logging.getLogger(__name__)
class CGMSensor(object):
def __init__(self, params, seed=None):
self._params = params
self.name = params.Name
self.sample_time = p... | 2.515625 | 3 |
var/spack/repos/builtin/packages/thepeg/package.py | carlabguillen/spack | 1 | 4723 | <reponame>carlabguillen/spack
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Thepeg(AutotoolsPackage):
"""Toolkit for High Energy Physics... | 1.359375 | 1 |
vmca/python/get_cert.py | wfu8/lightwave | 357 | 4724 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright © 2012-2016 VMware, 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... | 2.25 | 2 |
sdk/python/pulumi_gcp/securitycenter/notification_config.py | sisisin/pulumi-gcp | 121 | 4725 | <filename>sdk/python/pulumi_gcp/securitycenter/notification_config.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing i... | 1.835938 | 2 |
malib/agents/tabular/q_learning/base_tabular_agent.py | wwxFromTju/malib | 6 | 4726 | from abc import ABCMeta, abstractmethod
import numpy as np
class Agent(object):
__metaclass__ = ABCMeta
def __init__(self, name, id_, action_num, env):
self.name = name
self.id_ = id_
self.action_num = action_num
# len(env.action_space[id_])
# self.opp_action_space = e... | 3.21875 | 3 |
290.word-pattern.py | Lonitch/hackerRank | 0 | 4727 | #
# @lc app=leetcode id=290 lang=python3
#
# [290] Word Pattern
#
# https://leetcode.com/problems/word-pattern/description/
#
# algorithms
# Easy (35.86%)
# Likes: 825
# Dislikes: 113
# Total Accepted: 164K
# Total Submissions: 455.9K
# Testcase Example: '"abba"\n"dog cat cat dog"'
#
# Given a pattern and a stri... | 3.84375 | 4 |
s1_getting_started/exercise_files/final_exercise/model.py | jaschn/dtu_mlops | 0 | 4728 | from torch import nn
class MyAwesomeModel(nn.Module):
def __init__(self):
super().__init__()
self.cnn = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=5, kernel_size=3),
nn.ReLU(),
nn.Conv2d(in_channels=5, out_channels=3, kernel... | 3.1875 | 3 |
musket_core/tests/coders_test.py | dreamflyer/musket_core | 16 | 4729 | import unittest
from musket_core import coders
import numpy as np
import pandas as pd
import os
import math
fl=__file__
fl=os.path.dirname(fl)
class TestCoders(unittest.TestCase):
def test_binary_num(self):
a=np.array([0,1,0,1])
bc=coders.get_coder("binary",a, None)
self.as... | 2.921875 | 3 |
manage.py | isijara/zulip | 1 | 4730 | #!/usr/bin/env python3
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
if __name__ == "__main__":
if 'posix' in os.name and os.geteuid() == 0:
print("manage.py should not be run as root. Use `su zulip` to drop ro... | 1.96875 | 2 |
core/scripts/fetch_instructions_specs.py | merwaaan/mr.system | 0 | 4731 | <filename>core/scripts/fetch_instructions_specs.py<gh_stars>0
import json, requests
from bs4 import BeautifulSoup
def fetch():
r = requests.get('http://clrhome.org/table/')
if not r.ok:
print('Cannot fetch {})'.format(r.url))
return None
# remove newlines
text = r.text.replace('\n', '')
# Return ... | 2.765625 | 3 |
unittests/tools/test_intsights_parser.py | M-Rod101/django-DefectDojo | 249 | 4732 | from ..dojo_test_case import DojoTestCase
from dojo.models import Test
from dojo.tools.intsights.parser import IntSightsParser
class TestIntSightsParser(DojoTestCase):
def test_intsights_parser_with_one_critical_vuln_has_one_findings_json(
self):
testfile = open("unittests/scans/intsights/ints... | 2.609375 | 3 |
tools/testutils.py | sktollman/p4c | 1 | 4733 | <reponame>sktollman/p4c
#!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
# Copyright 2018 VMware, 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... | 2.390625 | 2 |
AlgorithmsAndDataStructures/mod2/Heap.py | BootyAss/bmstu | 0 | 4734 | <gh_stars>0
class Heap:
def __init__(self):
self.items = dict() # key - (value, index)
self.indexes = [] # index - key // to know indexes
# Usefull functions
def swap(self, i, j):
x = self.indexes[i] # key of 1 item
y = self.indexes[j] # key of 2 item
... | 3.671875 | 4 |
django_comments_xtd/tests/test_api_views.py | Boondockers-Welcome/django-comments-xtd | 1 | 4735 | from __future__ import unicode_literals
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.urls import reverse
from rest_framework.t... | 2.421875 | 2 |
LC/358.py | szhu3210/LeetCode_Solutions | 2 | 4736 | class Solution(object):
def rearrangeString(self, str, k):
"""
:type str: str
:type k: int
:rtype: str
"""
## greedy: count keeps the # of chars, valid keeps the leftmost valid index of a char.
res=[]
# count # of chars
d=coll... | 3.234375 | 3 |
momentumopt/python/momentumopt/kinoptpy/momentum_kinematics_optimizer.py | ferdinand-wood/kino_dynamic_opt | 0 | 4737 | '''
@file momentum_kinematics_optimizer.py
@package momentumopt
@author <NAME> (<EMAIL>)
@license License BSD-3-Clause
@copyright Copyright (c) 2019, New York University and Max Planck Gesellschaft.
@date 2019-10-08
'''
import os
import numpy as np
from momentumopt.kinoptpy.qp import QpSolver
from momentumopt.kinoptp... | 2.265625 | 2 |
gullveig/web/__init__.py | Addvilz/gullveig | 8 | 4738 | <reponame>Addvilz/gullveig
import logging
from gullveig import bootstrap_default_logger
# Configure default logging
def _configure_default_web_logger():
logger = logging.getLogger('gullveig-web')
bootstrap_default_logger(logger)
api_logger = logging.getLogger('gullveig-api')
bootstrap_default_logger... | 1.632813 | 2 |
jupyterhub_http_authenticator/httpauthenticator.py | clockfly/jupterhub_http_authenticator | 0 | 4739 | import json
import urllib
import os
import jupyterhub
from tornado.httpclient import HTTPRequest, AsyncHTTPClient
from traitlets import Unicode
from jupyterhub.auth import Authenticator
from tornado import gen
class HttpAuthenticator(Authenticator):
server = Unicode(
None,
allow_none=True,
... | 2.65625 | 3 |
src/lr_find.py | KushajveerSingh/fastai_without_fastai | 12 | 4740 | import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
# NOT -> ParameterModule
# NOT -> children_and_parameters
# NOT -> flatten_model
# NOT -> lr_range
# NOT -> scheduling functions
# NOT -> SmoothenValue
# YES -> lr_find
# NOT -> plot_lr_find
# NOT TO BE MODIFIED
class ParameterModu... | 2.546875 | 3 |
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py | Polidea/SiriusObfuscator | 427 | 4741 | <gh_stars>100-1000
"""
Test the lldb disassemble command on each call frame when stopped on C's ctor.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class IterateFrameAndDi... | 2.28125 | 2 |
reservedwords.py | irinaid/MAlice | 1 | 4742 | '''
All the reserved, individual words used in MAlice.
'''
A = "a"
ALICE = "Alice"
AND = "and"
ATE = "ate"
BECAME = "became"
BECAUSE = "because"
BUT = "but"
CLOSED = "closed"
COMMA = ","
CONTAINED = "contained"
DOT = "."
DRANK = "drank"
EITHER = "either"
ENOUGH = "enough"
EVENTUALLY = "eventually"
FOUND = "found"
H... | 2.265625 | 2 |
leetcode/0057_Insert_Interval/result.py | theck17/notes | 0 | 4743 | # !/usr/bin/env python3
# Author: C.K
# Email: <EMAIL>
# DateTime:2021-04-12 18:35:15
# Description:
import os
import sys
class Solution:
def insert(self, intervals: List[List[int]],
newInterval: List[int]) -> List[List[int]]:
res, i = [], 0
for interval in intervals:
... | 3.546875 | 4 |
src/pymortests/benchmarks.py | TiKeil/pymor | 1 | 4744 | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from pymortests.base import runmodule
if __name__ == "__main__":
runmodule(filename=__file__... | 1.09375 | 1 |
storage3/_sync/client.py | anand2312/storage-py | 0 | 4745 | <reponame>anand2312/storage-py<gh_stars>0
from ..utils import SyncClient, __version__
from .bucket import SyncStorageBucketAPI
from .file_api import SyncBucketProxy
__all__ = [
"SyncStorageClient",
]
class SyncStorageClient(SyncStorageBucketAPI):
"""Manage storage buckets and files."""
def __init__(self... | 2.484375 | 2 |
repo/script.module.liveresolver/lib/js2py/translators/__init__.py | Hades01/Addons | 3 | 4746 | # The MIT License
#
# Copyright 2014, 2015 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the 'Software'),
# to deal in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | 1.703125 | 2 |
src/test/python/test_scc_pacs.py | xchange11/ttconv-1 | 66 | 4747 | <filename>src/test/python/test_scc_pacs.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2020, Sandflow Consulting LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source co... | 1.375 | 1 |
azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/custom_image_properties_custom.py | NMijat1024/azure-sdk-for-python | 1 | 4748 | <reponame>NMijat1024/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microso... | 2.078125 | 2 |
distance_torch_no_compile/chamfer.py | nicolalandro/softpool | 0 | 4749 | import torch
def expanded_pairwise_distances(x, y):
'''
Input: x is a bxNxd matrix
y is an optional bxMxd matirx
Output: dist is a bxNxM matrix where dist[i,j] is the square norm between x[i,:] and y[j,:]
if y is not given then use 'y=x'.
i.e. dist[i,j] = ||x[i,:]-y[j,:]||^2
... | 3.1875 | 3 |
isiscb/curation/authority_views/relation_views.py | crispzips/IsisCB | 4 | 4750 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict #, HttpResponseForbidden, Http404, , JsonResponse
from django.shortcuts import get_obj... | 1.796875 | 2 |
run_tests.py | silx-kit/silx | 94 | 4751 | #!/usr/bin/env python3
# coding: utf8
# /*##########################################################################
#
# Copyright (c) 2015-2021 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files ... | 1.421875 | 1 |
src/robot/utils/error.py | vprashanth777/Selenium | 1 | 4752 | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | 1.828125 | 2 |
dedupe/_init.py | neozhangthe1/dedupe | 0 | 4753 | from dedupe.api import StaticDedupe, Dedupe
from dedupe.api import StaticRecordLink, RecordLink
from dedupe.api import StaticGazetteer, Gazetteer
from dedupe.core import randomPairs, randomPairsMatch, frozendict
from dedupe.convenience import consoleLabel, trainingDataDedupe, trainingDataLink, canonicalize
| 1.046875 | 1 |
scalability/tests/test_misc.py | ggreif/ic | 941 | 4754 | import unittest
from unittest import TestCase
from misc import verify
class TestVerify(TestCase):
"""Tests misc.py verifies function."""
def test_verify__with_zero_threshold_and_expected_succeeds(self):
"""Test passes when expected rate, actual rate and threshold are all zero."""
result = ve... | 3.578125 | 4 |
mars/tensor/fft/ifft.py | tomzhang/mars-1 | 2 | 4755 | <reponame>tomzhang/mars-1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding 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.ap... | 2.4375 | 2 |
server/api/src/db/migrate/versions/v_2.py | mminamina/311-data | 0 | 4756 |
def migrate():
print('migrating to version 2')
| 1.1875 | 1 |
Physics250-ME29/magAverageEMFinCoil.py | illusion173/Physics250 | 0 | 4757 | <reponame>illusion173/Physics250
import numpy as np
import math
extraNumber = 4 * math.pi * pow(10,-7)
def avgEMF():
turns = input("Input how many turns: ")
radius = input("Input the radius (cm):")
resistance = input("Input resistance (Ω): ")
magField0 = input("Input the first magnetic Field ... | 3.546875 | 4 |
bench_cupy.py | zhouxzh/Jetson_nano_stft_benchmark | 0 | 4758 | <reponame>zhouxzh/Jetson_nano_stft_benchmark
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Computes the spectrogram of a test signal using cupy and cuFFT.
Author: <NAME>
"""
import sys
import os
import timeit
import numpy as np
import cupy as cp
INPUT_ON_GPU = True
OUTPUT_ON_GPU = True
from testfile import ma... | 2.421875 | 2 |
geotrek/appconfig.py | Cynthia-Borot-PNE/Geotrek-admin | 0 | 4759 | from django.apps import AppConfig
from django.contrib.admin.apps import AdminConfig
from django.contrib.auth.apps import AuthConfig
from django.contrib.contenttypes.apps import ContentTypesConfig
from django.contrib.sessions.apps import SessionsConfig
from django.db.models.signals import post_migrate
from django_celery... | 1.804688 | 2 |
dtr_code/shared/run_torch_trial.py | merrymercy/dtr-prototype | 1 | 4760 | <reponame>merrymercy/dtr-prototype<gh_stars>1-10
"""
To avoid any issues of memory hanging around between inputs,
we run each input as a separate process.
A little ugly but effective
"""
import gc
import glob
import json
import os
import random
import time
import numpy as np
import torch
from common import invoke_ma... | 1.835938 | 2 |
pythonTools/downloadPDBsInList.py | rsanchezgarc/BIPSPI | 5 | 4761 | import sys, os
from subprocess import call
try:
from downloadPdb import downloadPDB
except ImportError:
from .downloadPdb import downloadPDB
pdbListFile="/home/rsanchez/Tesis/rriPredMethod/data/joanDimers/117_dimers_list.tsv"
outPath="/home/rsanchez/Tesis/rriPredMethod/data/joanDimers/pdbFiles/rawPDBs"
USE_BIO_... | 2.3125 | 2 |
code/python3/search_facets.py | hsethi2709/xapian-docsprint | 47 | 4762 | <gh_stars>10-100
#!/usr/bin/env python
import json
import sys
import xapian
import support
def search(dbpath, querystring, offset=0, pagesize=10):
# offset - defines starting point within result set
# pagesize - defines number of records to retrieve
# Open the database we're going to search.
db = xap... | 2.671875 | 3 |
iconcollections/serializers.py | plrthink/myicons | 83 | 4763 | import re
from rest_framework import serializers
from .models import Collection, CollectionIcon
class CollectionSerializer(serializers.ModelSerializer):
"""Collections's serializer"""
class Meta:
model = Collection
read_only = ('token', )
class CollectionIconSerializer(serializers.ModelSe... | 2.5 | 2 |
Python/partition-to-k-equal-sum-subsets.py | sm2774us/leetcode_interview_prep_2021 | 0 | 4764 | # Time: O(n*2^n)
# Space: O(2^n)
class Solution(object):
def canPartitionKSubsets(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
def dfs(nums, target, used, todo, lookup):
if lookup[used] is None:
targ = (todo-1)%... | 3.03125 | 3 |
var/spack/repos/builtin/packages/aspell/package.py | jeanbez/spack | 0 | 4765 | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
# See also: AspellDictPackage
class Aspell(AutotoolsPackage, GNUMirrorPackage):
"""GNU A... | 1.125 | 1 |
third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/UnitTestParser.py | Ivy286/cluster_basedfps | 9 | 4766 | <reponame>Ivy286/cluster_basedfps<filename>third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/UnitTestParser.py
#
# Copyright (C) 2001 <NAME>
#
""" unit testing code for compound descriptors
"""
from __future__ import print_function
import unittest
import Parser
from rdkit.six.moves import xrange
class ... | 2.1875 | 2 |
setup.py | maciek3000/data_dashboard | 8 | 4767 | from setuptools import setup, find_packages
import pathlib
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / "readme.md").read_text(encoding="utf-8")
setup(
name="data_dashboard",
version="0.1.1",
description="Dashboard to explore the data and to create baseline Machine Learning m... | 1.5625 | 2 |
test/e2e/tests/test_instance.py | acornett21/ack-ec2-controller | 0 | 4768 | <filename>test/e2e/tests/test_instance.py
# 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... | 2.296875 | 2 |
web/app/forms.py | Devidence7/Break | 0 | 4769 | <reponame>Devidence7/Break
from flask_wtf import FlaskForm
from wtforms import Form, StringField, PasswordField, BooleanField, SubmitField, IntegerField, validators, FileField, \
MultipleFileField, SelectField, RadioField, HiddenField, DecimalField, TextAreaField
from wtforms.fields.html5 import DateField
from wtfo... | 2.828125 | 3 |
hello.py | LMiceOrg/postdoc-voting | 0 | 4770 | #coding: utf-8
import sys
import os
import asyncio
import websockets
import json
import socket
import xlrd
#global vars
phd_data = None
pro_data = None
def get_host_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('192.168.127.12', 65535))
ip = s.getsockname()[0]... | 2.65625 | 3 |
runtime/Python3/src/antlr4/dfa/DFASerializer.py | maximmenshikov/antlr4 | 11,811 | 4771 | #
# Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
#/
# A DFA walker that knows how to dump them to serialized strings.#/
from io import StringIO
from antlr4 import DFA
from antl... | 1.9375 | 2 |
sw/calibrate.py | microsoft/moabian | 13 | 4772 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Calibration Controller
Performs calibration for hue, center of camera position, and servo offsets
"""
import os
import cv2
import time
import json
import argparse
import datetime
import numpy as np
import logging as log
from env import Moa... | 3.03125 | 3 |
marketing/tests_celery_tasks.py | renzyndrome/lits-crm | 1 | 4773 | from datetime import datetime, timedelta
from django.test import TestCase
from django.test.utils import override_settings
from marketing.tasks import (
delete_multiple_contacts_tasks,
list_all_bounces_unsubscribes,
run_all_campaigns,
run_campaign,
send_campaign_email_to_admin_contact,
send_sch... | 2.15625 | 2 |
doc's/3-labels_and_titles.py | andreluispy/py2html | 0 | 4774 | <filename>doc's/3-labels_and_titles.py<gh_stars>0
from py2html.main import *
page = web()
page.create()
# Header Parameters
# text = header text
# n = title level
page.header(text='My Site', n=1)
# Label Parameters
# text = label text
# color = label color
page.label(text='', color='')
page.compile() | 2.59375 | 3 |
JorGpi/tests/test_pickup.py | adujovic/JorG | 1 | 4775 | import unittest
from JorGpi.pickup.pickup import SmartPickUp,Reference,CommandLineOptions
class TestPickupIron(unittest.TestCase):
@staticmethod
def options(*args):
return CommandLineOptions(*args)
def test_iron_001(self):
_input = "test -R _VASP/Fe/noFlip -D _VASP/Fe/flip00000 -E Fe -J1 ... | 2.515625 | 3 |
jwt_auth/admin.py | alaraayan/todo-backend | 0 | 4776 | <reponame>alaraayan/todo-backend<filename>jwt_auth/admin.py
from django.contrib import admin
from django.contrib.auth import get_user_model
User = get_user_model()
admin.site.register(User)
| 1.359375 | 1 |
spotseeker_server/test/search/distance.py | uw-it-aca/spotseeker_server | 5 | 4777 | <reponame>uw-it-aca/spotseeker_server
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.test import TestCase
from django.conf import settings
from django.test.client import Client
from spotseeker_server.models import Spot
import simplejson as json
from decimal import *
... | 2.328125 | 2 |
get_active_LSPs.py | JNPRAutomate/northstar_SDN_controller_automation | 3 | 4778 | # this python script makes a rest call to Juniper Northstar to get active LSPs
# usage: python get_active_LSPs.py
import json
import requests
from requests.auth import HTTPBasicAuth
from pprint import pprint
import yaml
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3... | 2.625 | 3 |
bindings/python/tests/cdef_types.py | mewbak/dragonffi | 0 | 4779 | # Copyright 2018 <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 w... | 2.25 | 2 |
hierarchical_foresight/env/environment.py | deepneuralmachine/google-research | 23,901 | 4780 | <gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 2.328125 | 2 |
trips/migrations/0004_invoice.py | chorna/taxi24 | 0 | 4781 | <gh_stars>0
# Generated by Django 3.2.5 on 2021-07-11 23:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('trips', '0003_alter_trip_state'),
]
operations = [
migrations.CreateModel(
name='In... | 1.679688 | 2 |
src/general_harvester.py | Badger-Finance/python-keepers | 0 | 4782 | <gh_stars>0
import logging
import os
from decimal import Decimal
from time import sleep
import requests
from hexbytes import HexBytes
from web3 import Web3
from web3 import contract
from web3.contract import Contract
from config.constants import BASE_CURRENCIES
from config.constants import GAS_LIMITS
from config.cons... | 1.828125 | 2 |
clickhouse_plantuml/column.py | yonesko/clickhouse-plantuml | 0 | 4783 | <reponame>yonesko/clickhouse-plantuml
#!/usr/bin/env python
# License: Apache-2.0
# Copyright (C) 2020 <NAME>
class Column(object):
"""
Represents ClickHouse column
"""
def __init__(
self,
database: str,
table: str,
name: str,
type: str,
default_kind: ... | 2.4375 | 2 |
contrib/micronet/scripts/file2buf.py | pmalhaire/WireHub | 337 | 4784 | <reponame>pmalhaire/WireHub
#!/usr/bin/env python3
import os
import sys
MAX = 8
fpath = sys.argv[1]
name = sys.argv[2]
with open(fpath, "rb") as fh:
sys.stdout.write("char %s[] = {" % (name,) )
i = 0
while True:
if i > 0:
sys.stdout.write(", ")
if i % MAX == 0:
... | 2.4375 | 2 |
tests/test_observable/test_skip.py | christiansandberg/RxPY | 0 | 4785 | <reponame>christiansandberg/RxPY
import unittest
from reactivex import operators as ops
from reactivex.testing import ReactiveTest, TestScheduler
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = ReactiveTest.subscr... | 2.609375 | 3 |
CF#691/python/A.py | chaitanya1243/CP | 0 | 4786 |
def solve(n, red , blue):
rcount = bcount = 0
for i in range(n):
if int(red[i]) > int(blue[i]):
rcount = rcount +1
elif int(red[i]) < int(blue[i]):
bcount = bcount + 1
print( 'RED' if rcount>bcount else ('BLUE' if bcount>rcount else 'EQUAL'))
if __name__ == "__ma... | 3.359375 | 3 |
shudder/__main__.py | fitpay/shudder | 0 | 4787 | # Copyright 2014 Scopely, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 2.03125 | 2 |
example/hydrogen.py | NLESC-JCER/pyCHAMP | 4 | 4788 | import autograd.numpy as np
from pyCHAMP.wavefunction.wf_base import WF
from pyCHAMP.optimizer.minimize import Minimize
from pyCHAMP.sampler.metropolis import Metropolis
from pyCHAMP.sampler.hamiltonian import Hamiltonian
from pyCHAMP.solver.vmc import VMC
class Hydrogen(WF):
def __init__(self, nelec, ndim):
... | 2.421875 | 2 |
braintree/account_updater_daily_report.py | futureironman/braintree_python | 182 | 4789 | from braintree.configuration import Configuration
from braintree.resource import Resource
class AccountUpdaterDailyReport(Resource):
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if "report_url" in attributes:
self.report_url = attributes.pop("re... | 2.3125 | 2 |
game/ball.py | geoncic/PyBlock | 0 | 4790 | import pygame
import pygame.gfxdraw
from constants import Constants
class Balls(object):
def __init__(self, all_sprites, all_balls):
self.all_sprites = all_sprites
self.all_balls = all_balls
def spawn_ball(self, pos, vel, team):
# Todo: Figure out how to spawn multiple balls with some... | 3.09375 | 3 |
program/eggUI.py | otills/embryocv | 1 | 4791 | <gh_stars>1-10
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
from scipy.spatial import distance as dist
import glob
import re
import os
from PyQt5 import QtGui
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
import cv2
import pandas as pd
from PyQt5.Qt import *
import pyqtgraph as pg
#from P... | 2.4375 | 2 |
Curso em Vídeo/Mundo 2 Estruturas de Controle/Desafios/desafio053.py | henriqueumeda/-Estudo-python | 0 | 4792 | frase = input('Digite uma frase: ').upper().strip().replace(' ', '')
tamanho = int(len(frase))
inverso = ''
#Opção mais simples:
# inverso = frase[::-1]
for contador in range(tamanho-1, -1, -1):
inverso += frase[contador]
print('O inverso de {} é {}'.format(frase, inverso))
if frase == inverso:
print('Temos... | 3.984375 | 4 |
tests/unittest/options/pricing/test_binomial_trees.py | yiluzhu/quant | 1 | 4793 |
from unittest import TestCase
from options.pricing.binomial_trees import BinomialTreePricer
from options.option import OptionType, Option
class BinomialTreeTestCase(TestCase):
def test_basic(self):
"""European option, spot price 50, strike price 52, risk free interest rate 5%
expiry 2 years, vo... | 3.28125 | 3 |
mctimer.py | Sharpieman20/MCtimer | 0 | 4794 | import atexit
import os
import sys
import platform
import json
import glob
import datetime
import time
import threading
import tkinter as tk
from pynput import mouse
from pathlib import Path
from playsound import playsound
from enum import Enum
import copy
#"THE BEER-WARE LICENSE" (Revision 42):
#bleach86 wrote this ... | 2.421875 | 2 |
kafka/structs.py | informatique-cdc/kafka-python | 4,389 | 4795 | """ Other useful structs """
from __future__ import absolute_import
from collections import namedtuple
"""A topic and partition tuple
Keyword Arguments:
topic (str): A topic name
partition (int): A partition id
"""
TopicPartition = namedtuple("TopicPartition",
["topic", "partition"])
"""A Kafka broker... | 2.78125 | 3 |
Vehicle_Counting_colab.py | manolosolalinde/Vehicle-Counting | 0 | 4796 | import cv2
from trackers.tracker import create_blob, add_new_blobs, remove_duplicates
import numpy as np
from collections import OrderedDict
from detectors.detector import get_bounding_boxes
import uuid
import os
import contextlib
from datetime import datetime
import argparse
from utils.detection_roi import get_roi_fra... | 2.5 | 2 |
app/resources/magic_castle_api.py | ComputeCanada/mc-hub | 5 | 4797 | <filename>app/resources/magic_castle_api.py
from flask import request
from resources.api_view import ApiView
from exceptions.invalid_usage_exception import InvalidUsageException
from models.user.user import User
from models.user.authenticated_user import AuthenticatedUser
class MagicCastleAPI(ApiView):
def get(se... | 2.40625 | 2 |
tests/rbac/api/role/propose_member_test.py | kthblmfld/sawtooth-next-directory | 0 | 4798 | # Copyright 2018 Contributors to Hyperledger Sawtooth
#
# 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 ... | 1.9375 | 2 |
f2v.py | ClimberY/video_super_resolution_toolbox | 0 | 4799 | import cv2
import os
import numpy as np
from PIL import Image
def frame2video(im_dir, video_dir, fps):
im_list = os.listdir(im_dir)
im_list.sort(key=lambda x: int(x.replace("_RBPNF7", "").split('.')[0]))
img = Image.open(os.path.join(im_dir, im_list[0]))
img_size = img.size # 获得图片分辨率,im_dir文件夹下的图片分辨率... | 2.75 | 3 |