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
src/ml_final_project/utils/evaluators/default.py
yuvalot/ml_final_project
0
1900
<gh_stars>0 def default_evaluator(model, X_test, y_test): """A simple evaluator that takes in a model, and a test set, and returns the loss. Args: model: The model to evaluate. X_test: The features matrix of the test set. y_test: The one-hot labels matrix of the...
2.671875
3
test.py
wangjm12138/Yolov3_wang
0
1901
import random class Yolov3(object): def __init__(self): self.num=0 self.input_size=[8,16,32] def __iter__(self): return self def __next__(self): a = random.choice(self.input_size) self.num=self.num+1 if self.num<3: return a else: raise StopIteration yolo=Yolov3() for data in yolo: print(data)
3.609375
4
utils/dsp.py
huchenxucs/WaveRNN
0
1902
<reponame>huchenxucs/WaveRNN import math import numpy as np import librosa from utils import hparams as hp from scipy.signal import lfilter import soundfile as sf def label_2_float(x, bits): return 2 * x / (2**bits - 1.) - 1. def float_2_label(x, bits): assert abs(x).max() <= 1.0 x = (x + 1.) * (2**bits...
2.40625
2
loldib/getratings/models/NA/na_talon/na_talon_jng.py
koliupy/loldib
0
1903
<filename>loldib/getratings/models/NA/na_talon/na_talon_jng.py from getratings.models.ratings import Ratings class NA_Talon_Jng_Aatrox(Ratings): pass class NA_Talon_Jng_Ahri(Ratings): pass class NA_Talon_Jng_Akali(Ratings): pass class NA_Talon_Jng_Alistar(Ratings): pass class NA_Talon_Jng_Amumu(R...
1.46875
1
utils/turkish.py
derenyilmaz/personality-analysis-framework
1
1904
class TurkishText(): """Class for handling lowercase/uppercase conversions of Turkish characters.. Attributes: text -- Turkish text to be handled """ text = "" l = ['ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç'] u = ['I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç'] def __init__(self, text): self.te...
3.796875
4
app/helpers/geocode.py
Soumya117/finnazureflaskapp
0
1905
import googlemaps gmaps = googlemaps.Client(key='google_key') def get_markers(address): geocode_result = gmaps.geocode(address) return geocode_result[0]['geometry']['location']
2.6875
3
tf/estimators/keras_estimator.py
aspratyush/dl_utils
0
1906
from __future__ import absolute_import from __future__ import division from __future__ import print_function # Imports import os import numpy as np import tensorflow as tf def run(model, X, Y, optimizer=None, nb_epochs=30, nb_batches=128): """ Run the estimator """ if optimizer is None: optim...
2.734375
3
isign/archive.py
l0ui3/isign
1
1907
""" Represents an app archive. This is an app at rest, whether it's a naked app bundle in a directory, or a zipped app bundle, or an IPA. We have a common interface to extract these apps to a temp file, then resign them, and create an archive of the same type """ import abc import biplist from bundle impor...
2.0625
2
conan/tools/env/virtualrunenv.py
dscole/conan
0
1908
from conan.tools.env import Environment def runenv_from_cpp_info(conanfile, cpp_info): """ return an Environment deducing the runtime information from a cpp_info """ dyn_runenv = Environment(conanfile) if cpp_info is None: # This happens when the dependency is a private one = BINARY_SKIP retu...
2.3125
2
src/api/api_lists/models/list.py
rrickgauer/lists
0
1909
<gh_stars>0 """ ********************************************************************************** List model ********************************************************************************** """ from enum import Enum from dataclasses import dataclass from uuid import UUID from datetime import datetime class ListTy...
2.5
2
config/appdaemon/apps/power_alarm.py
azogue/hassio_config
18
1910
<filename>config/appdaemon/apps/power_alarm.py # -*- coding: utf-8 -*- """ Automation task as a AppDaemon App for Home Assistant - current meter PEAK POWER notifications """ import datetime as dt from enum import IntEnum import appdaemon.plugins.hass.hassapi as hass LOG_LEVEL = "INFO" LOG_LEVEL_ALERT = "WARNING" LOG...
2.28125
2
mailmynet/Maildir/proxy_postfix/Twisted-11.0.0/build/lib.linux-x86_64-2.6/twisted/internet/gtk2reactor.py
SPIN-UMass/SWEET
3
1911
# -*- test-case-name: twisted.internet.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ This module provides support for Twisted to interact with the glib/gtk2 mainloop. In order to use this support, simply do the following:: | from twisted.internet import gtk2reactor | ...
2.109375
2
run_mod.py
fpl-analytics/gr_crypto
0
1912
<reponame>fpl-analytics/gr_crypto """ Setup: - Import Libraries - Setup tf on multiple cores - Import Data """ import pandas as pd import numpy as np import tensorflow as tf import seaborn as sns from time import time import multiprocessing import random import os from tensorflow.keras.models import Sequ...
2.09375
2
bot.py
menlen/one
0
1913
<reponame>menlen/one # This example show how to use inline keyboards and process button presses import telebot import time from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton import os, sys from PIL import Image, ImageDraw, ImageFont import random TELEGRAM_TOKEN = '<KEY>' bot = telebot.Tele...
2.8125
3
novice/python-unit-testing/answers/test_rectangle2.py
Southampton-RSG/2019-03-13-southampton-swc
1
1914
<reponame>Southampton-RSG/2019-03-13-southampton-swc from rectangle2 import rectangle_area def test_unit_square(): assert rectangle_area([0, 0, 1, 1]) == 1.0 def test_large_square(): assert rectangle_area([1, 1, 4, 4]) == 9.0 def test_actual_rectangle(): assert rectangle_area([0, 1, 4, 7]) == 24.0
2.6875
3
tests/requestreply.py
unclechu/py-radio-class
0
1915
# -*- coding: utf-8 -*- from unittest import TestCase, TestLoader from radio import (Radio, ListenerNotFound, ReplyHandlerAlreadyBound, HandlerAlreadyBound) def init_radio(f): def wrap(self, *args): self.radio = Radio() return f(self, *args) return wrap class TestRadio...
2.8125
3
mayan/apps/rest_api/exceptions.py
sophiawa/Mayan-EDMS
1
1916
<gh_stars>1-10 class APIError(Exception): """ Base exception for the API app """ pass class APIResourcePatternError(APIError): """ Raised when an app tries to override an existing URL regular expression pattern """ pass
2.03125
2
tests/unit/types/message/test_message.py
Immich/jina
1
1917
<reponame>Immich/jina import sys from typing import Sequence import pytest from jina import Request, QueryLang, Document from jina.clients.request import request_generator from jina.proto import jina_pb2 from jina.proto.jina_pb2 import EnvelopeProto from jina.types.message import Message from jina.types.request impor...
1.859375
2
tabnine-vim/third_party/ycmd/ycmd/tests/python/testdata/project/settings_extra_conf.py
MrMonk3y/vimrc
10
1918
import os import sys DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) ) def Settings( **kwargs ): return { 'interpreter_path': sys.executable, 'sys_path': [ os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' ) ] }
1.960938
2
SmartCache/sim/Utilities/setup.py
Cloud-PG/smart-cache
1
1919
from distutils.core import setup setup( name='utils', version='1.0.0', author='<NAME>', author_email='<EMAIL>', packages=[ 'utils', ], scripts=[], url='https://github.com/Cloud-PG/smart-cache', license='Apache 2.0 License', description='Utils for the SmartCache project',...
1.195313
1
homeassistant/components/eight_sleep/binary_sensor.py
liangleslie/core
2
1920
<gh_stars>1-10 """Support for Eight Sleep binary sensors.""" from __future__ import annotations import logging from pyeight.eight import EightSleep from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.core import HomeAssistant from homeassista...
2.171875
2
ravem/tests/util_test.py
bpedersen2/indico-plugins-cern
0
1921
# This file is part of the CERN Indico plugins. # Copyright (C) 2014 - 2022 CERN # # The CERN Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; see # the LICENSE file for more details. from unittest.mock import MagicMock import pytest from requests.ex...
2.21875
2
apps/organization/urls.py
stormsha/StormOnline
18
1922
# _*_ coding: utf-8 _*_ # --------------------------- __author__ = 'StormSha' __date__ = '2018/3/28 18:01' # --------------------------- # -------------------------django---------------------- from django.conf.urls import url from .views import OrgView, AddUserAskView, OrgHomeView, OrgCourseView, OrgDescView, OrgTeach...
1.875
2
tech_project/lib/python2.7/site-packages/filer/migrations/0010_auto_20180414_2058.py
priyamshah112/Project-Descripton-Blog
0
1923
<filename>tech_project/lib/python2.7/site-packages/filer/migrations/0010_auto_20180414_2058.py<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('fi...
1.484375
1
SLHCUpgradeSimulations/Configuration/python/aging.py
ckamtsikis/cmssw
852
1924
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms # handle normal mixing or premixing def getHcalDigitizer(process): if hasattr(process,'mixData'): return process.mixData if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'): return...
1.820313
2
xml_parser.py
cbschaff/nlimb
12
1925
import numpy as np import xml.etree.ElementTree as ET class Geom(object): def __init__(self, geom): self.xml = geom self.params = [] def get_params(self): return self.params.copy() def set_params(self, new_params): self.params = new_params def update_point(self, p, ne...
2.796875
3
app/http/middleware/LoadUserMiddleware.py
josephmancuso/masonite-forum
11
1926
<filename>app/http/middleware/LoadUserMiddleware.py ''' Load User Middleware''' from masonite.facades.Auth import Auth class LoadUserMiddleware: ''' Middleware class which loads the current user into the request ''' def __init__(self, Request): ''' Inject Any Dependencies From The Service Container ''...
3.046875
3
src/unittest/python/merciful_elo_limit_tests.py
mgaertne/minqlx-plugin-tests
4
1927
<reponame>mgaertne/minqlx-plugin-tests from minqlx_plugin_test import * import logging import unittest from mockito import * from mockito.matchers import * from hamcrest import * from redis import Redis from merciful_elo_limit import * class MercifulEloLimitTests(unittest.TestCase): def setUp(self): ...
2.328125
2
meiduo_mall/celery_tasks/sms/tasks.py
Vent-Any/meiduo_mall_cangku
0
1928
from ronglian_sms_sdk import SmsSDK from celery_tasks.main import app # 写我们的任务(函数) # 任务必须要celery的实例对象装饰器task装饰 # 任务包的任务需要celery调用自检检查函数。(在main里面写。) @app.task def celery_send_sms_code(mobile, sms_code): accId = '<KEY>' accToken = '514a8783b8c2481ebbeb6a814434796f' appId = '<KEY>' # 9.1. 创建荣联云 实例对象 ...
1.890625
2
delphiIDE.py
JeisonJHA/Plugins-Development
0
1929
import sublime_plugin class MethodDeclaration(object): """docstring for MethodDeclaration""" def __init__(self): self._methodclass = None self.has_implementation = False self.has_interface = False @property def has_implementation(self): return self._has_implementation...
2.515625
3
python/test_pip_package.py
syt123450/tfjs-converter
0
1930
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
2.171875
2
script.ezclean/resources/lib/modules/skinz.py
rrosajp/script.ezclean
5
1931
<reponame>rrosajp/script.ezclean<gh_stars>1-10 # -*- coding: UTF-8 -*- import os, re, shutil, time, xbmc from resources.lib.modules import control try: import json as simplejson except: import simplejson ADDONS = os.path.join(control.HOMEPATH, 'addons') def currSkin(): return control.skin def getOld(old): ...
2.21875
2
pyhap/characteristic.py
bdraco/HAP-python
0
1932
<filename>pyhap/characteristic.py """ All things for a HAP characteristic. A Characteristic is the smallest unit of the smart home, e.g. a temperature measuring or a device status. """ import logging from pyhap.const import ( HAP_PERMISSION_READ, HAP_REPR_DESC, HAP_REPR_FORMAT, HAP_REPR_IID, HAP_R...
2.703125
3
configs/_base_/datasets/uniter/vqa_dataset_uniter.py
linxi1158/iMIX
23
1933
<filename>configs/_base_/datasets/uniter/vqa_dataset_uniter.py<gh_stars>10-100 dataset_type = 'UNITER_VqaDataset' data_root = '/home/datasets/mix_data/UNITER/VQA/' train_datasets = ['train'] test_datasets = ['minival'] # name not in use, but have defined one to run vqa_cfg = dict( train_txt_dbs=[ data_ro...
1.546875
2
students/k3340/laboratory_works/laboratory_works/Arlakov_Denis/laboratiry_work_2_and_3/lab/django-react-ecommerce-master/home/urls.py
TonikX/ITMO_ICT_-WebProgramming_2020
10
1934
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include, re_path from django.views.generic import TemplateView urlpatterns = [ path('api-auth/', include('rest_framework.urls')), path('rest-auth/', include('rest_auth.urls...
1.726563
2
20200416_Socialmail/mailserverUi.py
karta1782310/python-docx-automated-report-generation
0
1935
#!/bin/bash # -*- coding: UTF-8 -*- # 基本控件都在这里面 from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog, QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit, ...
2.28125
2
nntools/layers/corrmm.py
317070/nntools
0
1936
""" GpuCorrMM-based convolutional layers """ import numpy as np import theano import theano.tensor as T from theano.sandbox.cuda.basic_ops import gpu_contiguous from theano.sandbox.cuda.blas import GpuCorrMM from .. import init from .. import nonlinearities from . import base # base class for all layers that rely ...
2.71875
3
tests/python/correctness/simple_test_aux_index.py
dubey/weaver
163
1937
<filename>tests/python/correctness/simple_test_aux_index.py #! /usr/bin/env python # # =============================================================== # Description: Sanity check for fresh install. # # Created: 2014-08-12 16:42:52 # # Author: <NAME>, <EMAIL> # # Copyright (C) 2013, Cornell Uni...
2.09375
2
ldtools/helpers.py
dmr/Ldtools
3
1938
<reponame>dmr/Ldtools<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals try: unicode except NameError: basestring = unicode = str # Python 3 import logging import rdflib from rdflib import compare logger = logging.getLogger("ldtools") RESET_SEQ = "\033[0m" COLOR_...
1.960938
2
fakenet/diverters/debuglevels.py
AzzOnFire/flare-fakenet-ng
0
1939
# Debug print levels for fine-grained debug trace output control DNFQUEUE = (1 << 0) # netfilterqueue DGENPKT = (1 << 1) # Generic packet handling DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis DCB = (1 << 3) # Packet handlign callbacks DPROCFS = (1 << 4) # procfs DIPTBLS = (...
2.1875
2
multichannel_lstm/train.py
zhr1201/Multi-channel-speech-extraction-using-DNN
65
1940
<filename>multichannel_lstm/train.py ''' Script for training the model ''' import tensorflow as tf import numpy as np from input import BatchGenerator from model import MultiRnn import time from datetime import datetime import os import matplotlib as mpl mpl.use('Agg') from matplotlib import pyplot as plt sum_dir = '...
2.828125
3
python_modules/dagster/dagster/daemon/cli/__init__.py
elsenorbw/dagster
0
1941
<reponame>elsenorbw/dagster import os import sys import threading import time import warnings from contextlib import ExitStack import click import pendulum from dagster import __version__ from dagster.core.instance import DagsterInstance from dagster.daemon.controller import ( DEFAULT_DAEMON_HEARTBEAT_TOLERANCE_SE...
2.09375
2
tests/exhaustive/nfl_tests.py
atklaus/sportsreference
1
1942
<filename>tests/exhaustive/nfl_tests.py import sys, os sys.path.append(os.path.dirname(os.path.dirname(sys.path[0]))) from sportsreference.nfl.teams import Teams for team in Teams(): print(team.name) for player in team.roster.players: print(player.name) for game in team.schedule: print(game...
2.796875
3
rust-old/python/examples/map_fields.py
SerebryakovMA/quelea
3
1943
import numpy as np import matplotlib import matplotlib.pyplot as plt import sys sys.path.append("../") from quelea import * nx = 217 ny = 133 x0 = 0 x1 = 30 # lambdas y0 = 0 y1 = 20 # lambdas xs = np.linspace(x0, x1, nx) ys = np.linspace(y0, y1, ny) # 2d array of (x, y, z, t) coords = np.array( [ [x, y, 0, 0] for ...
2.390625
2
test.py
t-kaichi/hyperspoof
10
1944
<gh_stars>1-10 import os from absl import app from absl import flags import numpy as np import tqdm from tensorflow.keras import Model from albumentations import ( Compose, HorizontalFlip, RandomBrightness,RandomContrast, ShiftScaleRotate, ToFloat, VerticalFlip) from utils import reset_tf from eval_utils impo...
1.8125
2
generator/apps.py
TheJacksonLaboratory/jaxid_generator
2
1945
from django.conf import settings from suit import apps from suit.apps import DjangoSuitConfig from suit.menu import ParentItem, ChildItem APP_NAME = settings.APP_NAME WIKI_URL = settings.WIKI_URL class SuitConfig(DjangoSuitConfig): name = 'suit' verbose_name = 'Mbiome Core JAXid Generator' site_title = '...
1.898438
2
tiled-lutnet/training-software/MNIST-CIFAR-SVHN/models/MNIST/scripts/lutnet_init.py
awai54st/LUTNet
38
1946
import h5py import numpy as np np.set_printoptions(threshold=np.nan) from shutil import copyfile copyfile("dummy_lutnet.h5", "pretrained_bin.h5") # create pretrained.h5 using datastructure from dummy.h5 bl = h5py.File("baseline_pruned.h5", 'r') #dummy = h5py.File("dummy.h5", 'r') pretrained = h5py.File("pretrained_b...
2.265625
2
pkgs/nltk-3.2-py27_0/lib/python2.7/site-packages/nltk/classify/weka.py
wangyum/anaconda
0
1947
<reponame>wangyum/anaconda # Natural Language Toolkit: Interface to Weka Classsifiers # # Copyright (C) 2001-2015 NLTK Project # Author: <NAME> <<EMAIL>> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ Classifiers that make use of the external 'Weka' package. """ from __future__ impo...
2.21875
2
src/si/data/dataset.py
pg428/SIB
0
1948
import pandas as pd import numpy as np from src.si.util.util import label_gen __all__ = ['Dataset'] class Dataset: def __init__(self, X=None, Y=None, xnames: list = None, yname: str = None): """ Tabular Dataset""" if X is None: raise Exception("Trying ...
3.390625
3
stubs/m5stack_flowui-1_4_0-beta/display.py
RonaldHiemstra/micropython-stubs
38
1949
<reponame>RonaldHiemstra/micropython-stubs """ Module: 'display' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 class TFT: '' BLACK = 0 BLUE = 255 BMP = 2 BOT...
2.125
2
dbclient/__init__.py
dmoore247/db-migration
0
1950
import json, requests, datetime from cron_descriptor import get_description from .dbclient import dbclient from .JobsClient import JobsClient from .ClustersClient import ClustersClient from .WorkspaceClient import WorkspaceClient from .ScimClient import ScimClient from .LibraryClient import LibraryClient from .HiveCli...
1.109375
1
UI/ControlSlider/__init__.py
peerke88/SkinningTools
7
1951
<filename>UI/ControlSlider/__init__.py # -*- coding: utf-8 -*- # SkinWeights command and component editor # Copyright (C) 2018 <NAME> # Website: http://www.trevorius.com # # pyqt attribute sliders # Copyright (C) 2018 <NAME> # Website: http://danieleniero.com/ # # neighbour finding algorythm # Copyright (C) 2...
1.523438
2
homeassistant/components/fritz/sensor.py
EuleMitKeule/core
3
1952
<reponame>EuleMitKeule/core """AVM FRITZ!Box binary sensors.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from datetime import datetime, timedelta import logging from typing import Any, Literal from fritzconnection.core.exceptions import ( FritzActio...
2.046875
2
Ifc/IfcBase.py
gsimon75/IFC_parser
28
1953
from Ifc.ClassRegistry import ifc_class, ifc_abstract_class, ifc_fallback_class @ifc_abstract_class class IfcEntity: """ Generic IFC entity, only for subclassing from it """ def __init__(self, rtype, args): """ rtype: Resource type args: Arguments in *reverse* order, so you can...
2.703125
3
middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/utils/data_collector.py
xe1gyq/stx-utils
0
1954
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (c) 2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import logging import os from io_monitor.constants import DOMAIN from io_monitor.utils.data_window import DataCollectionWindow LOG = logging.getLogger(DOMAIN) class DeviceDataCollec...
2.046875
2
examples/language-modeling/debias_lm_hps_tune.py
SoumyaBarikeri/transformers
1
1955
<filename>examples/language-modeling/debias_lm_hps_tune.py # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ex...
1.921875
2
checksums.py
pgp/RootHelperClientTestInteractions
1
1956
from net_common import * import struct import sys def getDirHashOpts(withNames=False, ignoreThumbsFiles=True, ignoreUnixHiddenFiles=True, ignoreEmptyDirs=True): return bytearray([((1 if withNames else 0) + (2 if ignoreThumbsFiles else ...
2.078125
2
investment_report/migrations/0020_auto_20180911_1005.py
uktrade/pir-api
1
1957
<filename>investment_report/migrations/0020_auto_20180911_1005.py # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-09-11 10:05 from __future__ import unicode_literals import config.s3 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('investme...
1.390625
1
tests/test-scripts/threadpools.py
whalesalad/filprofiler
521
1958
<gh_stars>100-1000 """Validate that number of threads in thread pools is set to 1.""" import numexpr import blosc import threadpoolctl # APIs that return previous number of threads: assert numexpr.set_num_threads(2) == 1 assert blosc.set_nthreads(2) == 1 for d in threadpoolctl.threadpool_info(): assert d["num_th...
2.296875
2
scripts/viewStokespat.py
David-McKenna/AntPat
5
1959
<gh_stars>1-10 #!/usr/bin/env python """A simple viewer for Stokes patterns based on two far-field pattern files. (Possibly based on one FF pattern files if it has two requests: one for each polarization channel.)""" import os import argparse import numpy import matplotlib.pyplot as plt from antpat.reps.sphgridfun.tvec...
2.546875
3
utils.py
lingjiao10/Facial-Expression-Recognition.Pytorch
0
1960
'''Some helper functions for PyTorch, including: - progress_bar: progress bar mimic xlua.progress. - set_lr : set the learning rate - clip_gradient : clip gradient ''' import os import sys import time import math import torch import torch.nn as nn import torch.nn.init as init from torch.autogr...
2.859375
3
string-method/src/analysis/FE_analysis/index_converter.py
delemottelab/gpcr-string-method-2019
0
1961
from __future__ import absolute_import, division, print_function import logging import sys logging.basicConfig( stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s %(name)s-%(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') import numpy as np import utils logger = logging.getLogger("ind...
2.265625
2
Ex029 Aula 11-Cores no Terminal.py
andersontmachado/ExerciciosPython
1
1962
<gh_stars>1-10 print('\033[7;30mOla mundo\033[m!!!')
1.5625
2
cirq-pasqal/cirq_pasqal/pasqal_device.py
pavoljuhas/Cirq
1
1963
# Copyright 2020 The Cirq Developers # # 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 ...
2.109375
2
command_line/show.py
huwjenkins/dials
0
1964
<reponame>huwjenkins/dials import os import sys import numpy as np import iotbx.phil from cctbx import uctbx from dxtbx.model.experiment_list import ExperimentListFactory from scitbx.math import five_number_summary import dials.util from dials.array_family import flex from dials.util import Sorry, tabulate help_mes...
2.25
2
app/config/env_jesa.py
OuissalTAIM/jenkins
0
1965
# -*- coding: utf-8 -*- from enum import Enum, IntEnum, unique import os APP_NAME = "mine2farm" NETWORK_NAME = "CenterAxis" LOG_LEVEL_CONSOLE = "WARNING" LOG_LEVEL_FILE = "INFO" APP_FOLDER = os.getenv("JESA_MINE2FARM_HOME", "C:/GitRepos/mine2farm/") LOG_FOLDER = APP_FOLDER + "app/log/" LOG_FILE = "%(asctime)_" + AP...
2.09375
2
myFirstApp/travello/models.py
cankush625/Django
0
1966
from django.db import models # Create your models here. class Destination(models.Model) : name = models.CharField(max_length = 100) img = models.ImageField(upload_to = 'pics') desc = models.TextField() price = models.IntegerField() offer = models.BooleanField(default = False) class News()...
2.265625
2
app/app.py
Moustique-bot/hands-on-2021
0
1967
import base64 import io import dash import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output import numpy as np import tensorflow as tf from PIL import Image from constants import CLASSES import yaml with open('app.ya...
2.4375
2
books/rakutenapi.py
NobukoYano/LibraryApp
1
1968
<gh_stars>1-10 import json import requests from django.conf import settings class rakuten: def get_json(self, isbn: str) -> dict: appid = settings.RAKUTEN_APP_ID # API request template api = "https://app.rakuten.co.jp/services/api/BooksTotal/"\ "Search/20170404?format=json...
2.5
2
Random-Programs/optimization/root/v4.py
naumoff0/Archive
0
1969
print(int(input(""))**0.5)
2.90625
3
sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py
rsdoherty/azure-sdk-for-python
2,728
1970
# 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 Microsoft (R) AutoRest Code Generator. # Changes may ...
2.03125
2
school/views.py
pa-one-patel/college_managenment
1
1971
<filename>school/views.py from django.shortcuts import render,redirect,reverse from . import forms,models from django.db.models import Sum from django.contrib.auth.models import Group from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required,user_passes_test def home_view(r...
2.15625
2
PaddleCV/tracking/pytracking/features/deep.py
weiwei1115/models
2
1972
<reponame>weiwei1115/models import os import numpy as np from paddle import fluid from ltr.models.bbreg.atom import atom_resnet50, atom_resnet18 from ltr.models.siamese.siam import siamfc_alexnet from ltr.models.siam.siam import SiamRPN_AlexNet, SiamMask_ResNet50_sharp, SiamMask_ResNet50_base from pytracking....
1.914063
2
netesto/local/psPlot.py
fakeNetflix/facebook-repo-fbkutils
346
1973
#!/usr/bin/env python2 import sys import random import os.path import shutil import commands import types import math #gsPath = '/usr/local/bin/gs' gsPath = 'gs' logFile = '/dev/null' #logFile = 'plot.log' #--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage) # class PsPlot(object): def __init__(self...
2.28125
2
physio2go/exercises/migrations/0003_auto_20161128_1753.py
hamole/physio2go
0
1974
<filename>physio2go/exercises/migrations/0003_auto_20161128_1753.py # -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-28 06:53 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('exercises', '0002_auto_20161128_...
1.585938
2
setup.py
pasinskim/mender-python-client
0
1975
# Copyright 2021 Northern.tech AS # # 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 ag...
1.554688
2
Q295-v2.py
Linchin/python_leetcode_git
0
1976
""" 295 find median from data stream hard """ from heapq import * class MedianFinder: # max heap and min heap def __init__(self): """ initialize your data structure here. """ self.hi = [] self.lo = [] def addNum(self, num: int) -> None: heappush(self.lo,...
3.40625
3
raisimPy/examples/newtonsCradle.py
mstoelzle/raisimLib
0
1977
<reponame>mstoelzle/raisimLib import os import numpy as np import raisimpy as raisim import math import time raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim") world = raisim.World() ground = world.addGround() world.setTimeStep(0.001) world.setMaterialPairProp("st...
1.789063
2
nova/virt/hyperv/volumeops.py
viveknandavanam/nova
1
1978
<gh_stars>1-10 # Copyright 2012 <NAME> # Copyright 2013 Cloudbase Solutions Srl # 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.o...
1.679688
2
-Loan-Approval-Analysis/code.py
lakshit-sharma/greyatom-python-for-data-science
0
1979
# -------------- # Importing header files import numpy as np import pandas as pd from scipy.stats import mode # code starts here bank = pd.read_csv(path) categorical_var = bank.select_dtypes(include = 'object') print(categorical_var) numerical_var = bank.select_dtypes(include = 'number') print(numeric...
3.03125
3
others/train_RNN.py
jacobswan1/Video2Commonsense
31
1980
<filename>others/train_RNN.py ''' Training Scropt for V2C captioning task. ''' __author__ = '<NAME>' import os import numpy as np from opts import * from utils.utils import * import torch.optim as optim from model.Model import Model from torch.utils.data import DataLoader from utils.dataloader import VideoDataset fro...
2.296875
2
new-influx-client.py
benlamonica/energy-monitor
0
1981
<filename>new-influx-client.py<gh_stars>0 import influxdb_client from influxdb_client import InfluxDBClient bucket = "python-client-sandbox" org = "Energy Monitor" token = "miQdAvNXHiNDVVzPzV5FpkCaR_8qdQ-L1FlPCOXQPI325Kbrh1fgfhkcDUZ4FepaebDdpZ-A1gmtnnjU0_hViA==" url = "http://localhost:9999" client = InfluxDBClient(u...
2.328125
2
tests/test_agent/test_manhole.py
guidow/pyfarm-agent
0
1982
# No shebang line, this module is meant to be imported # # Copyright 2014 <NAME> # # 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...
1.992188
2
func-button/klSigmode.py
xcgoo/uiKLine
232
1983
<gh_stars>100-1000 # coding: utf-8 """ 插入所有需要的库,和函数 """ #---------------------------------------------------------------------- def klSigmode(self): """查找模式""" if self.mode == 'deal': self.canvas.updateSig(self.signalsOpen) self.mode = 'dealOpen' else: self.canvas.updateSig(self....
2.140625
2
utils/thin.py
BnF-jadis/projet
5
1984
<filename>utils/thin.py # 2020, BackThen Maps # Coded by <NAME> https://github.com/RPetitpierre # For Bibliothèque nationale de France (BnF) import cv2, thinning, os import numpy as np import pandas as pd import shapefile as shp from skimage.measure import approximate_polygon from PIL import Image, ImageDraw from ...
2.859375
3
easy2fa/tests/test_checkinput.py
lutostag/otp
3
1985
from unittest import TestCase from unittest.mock import patch from easy2fa import cli class TestCheckInput(TestCase): @patch('builtins.input') def test_default(self, mock_input): mock_input.return_value = '' self.assertEquals(cli.check_input('prompt', default='one'), 'one') mock_input...
3.1875
3
bert_finetuning/data_loader.py
nps1ngh/adversarial-bert-german-attacks-defense
0
1986
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler from bert_finetuning.data import GermanData class GermanDataLoader: def __init__( self, data_paths, model_name, do_cleansing, max_sequence_length, batch_size=8, ...
2.671875
3
data/dirty_mnist.py
Karthik-Ragunath/DDU
43
1987
<reponame>Karthik-Ragunath/DDU<filename>data/dirty_mnist.py import torch import numpy as np import torch.utils.data as data from torch.utils.data import Subset from data.fast_mnist import create_MNIST_dataset from data.ambiguous_mnist.ambiguous_mnist_dataset import AmbiguousMNIST def get_train_valid_loader(root, bat...
2.6875
3
vantage6/server/resource/recover.py
jaspersnel/vantage6-server
2
1988
# -*- coding: utf-8 -*- import logging import datetime from flask import request, render_template from flask_jwt_extended import ( create_access_token, decode_token ) from jwt.exceptions import DecodeError from flasgger import swag_from from http import HTTPStatus from pathlib import Path from sqlalchemy.orm.e...
2.0625
2
examples/basic_examples/aws_sns_sqs_middleware_service.py
tranvietanh1991/tomodachi
1
1989
import os from typing import Any, Callable, Dict import tomodachi from tomodachi import aws_sns_sqs, aws_sns_sqs_publish from tomodachi.discovery import AWSSNSRegistration from tomodachi.envelope import JsonBase async def middleware_function( func: Callable, service: Any, message: Any, topic: str, context: Dict,...
2.375
2
ex9.py
ThitsarAung/python-exercises
0
1990
<reponame>ThitsarAung/python-exercises types_of_people = 10 x = f"There are {types_of_people} types of people." binary = "binary" do_not = "don't" y = f"Those who know {binary} and those who {do_not}." print(x) print(y) print(f"I said: {x}") print(f"I also said: '{y}'") hilarious = False joke_evaluation = "Isn't th...
4
4
mmdnn/conversion/caffe/writer.py
2yz/MMdnn
3,442
1991
<reponame>2yz/MMdnn import base64 from google.protobuf import json_format from importlib import import_module import json import numpy as np import os import sys from mmdnn.conversion.caffe.errors import ConversionError from mmdnn.conversion.caffe.common_graph import fetch_attr_value from mmdnn.conversion.caffe.utils ...
2.453125
2
week1/85-maximal-rectangle.py
LionTao/algo_weekend
0
1992
<gh_stars>0 """ leetcode-85 给定一个仅包含 0 和 1 , 大小为 rows x cols 的二维二进制矩阵, 找出只包含 1 的最大矩形, 并返回其面积。 """ from typing import List class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: """ 统计直方图然后单调递增栈 """ rows = len(matrix) if rows == 0: return 0 ...
3.484375
3
pandapower/test/opf/test_costs_pwl.py
mathildebadoual/pandapower
1
1993
<reponame>mathildebadoual/pandapower # -*- coding: utf-8 -*- # Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np import pytest from pandapower.optimal_powerflow import OPFNotConverged i...
2.484375
2
cookie_refresh.py
guoxianru/cookie_pool_lite
0
1994
# -*- coding: utf-8 -*- # @Author: GXR # @CreateTime: 2022-01-20 # @UpdateTime: 2022-01-20 import redis import config import cookie_login from cookie_api import app red = redis.Redis( host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDIS_DB, decode_responses=True, ) # 刷新cookie数量 def cooki...
2.703125
3
feemodel/app/__init__.py
bitcoinfees/feemodel
12
1995
from feemodel.app.transient import TransientOnline from feemodel.app.pools import PoolsOnlineEstimator from feemodel.app.predict import Prediction from feemodel.app.simonline import SimOnline __all__ = [ 'TransientOnline', 'PoolsOnlineEstimator', 'Prediction', 'SimOnline' ]
1.1875
1
examples/server/models/image_file_upload.py
ParikhKadam/django-angular
941
1996
# -*- coding: utf-8 -*- from __future__ import unicode_literals # start tutorial from django.db import models from djng.forms import NgModelFormMixin, NgFormValidationMixin from djng.styling.bootstrap3.forms import Bootstrap3ModelForm class SubscribeUser(models.Model): full_name = models.CharField( "<NAME...
2.296875
2
python/tvm/topi/hexagon/slice_ops/add_subtract_multiply.py
yangulei/tvm
4,640
1997
# 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 ...
2.140625
2
python_modules/automation/automation/docker/dagster_docker.py
jrouly/dagster
0
1998
<filename>python_modules/automation/automation/docker/dagster_docker.py import contextlib import os from collections import namedtuple import yaml from dagster import __version__ as current_dagster_version from dagster import check from .ecr import ecr_image, get_aws_account_id, get_aws_region from .utils import ( ...
2.390625
2
chrome/test/telemetry/chromeos/login_unittest.py
Fusion-Rom/android_external_chromium_org
231
1999
# Copyright (c) 2012 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. import json import logging import os import unittest from telemetry.core import browser_finder from telemetry.core import exceptions from telemetry.core ...
2.015625
2