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 |
|---|---|---|---|---|---|---|
model_compression_toolkit/keras/quantizer/gradient_ptq/utils.py | eladc-git/model_optimization | 0 | 3500 | <filename>model_compression_toolkit/keras/quantizer/gradient_ptq/utils.py<gh_stars>0
# Copyright 2021 Sony Semiconductors Israel, 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 th... | 2.125 | 2 |
pygments/lexers/tnt.py | btashton/pygments | 1 | 3501 | <filename>pygments/lexers/tnt.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
pygments.lexers.tnt
~~~~~~~~~~~~~~~~~~~
Lexer for Typographic Number Theory.
:copyright: Copyright 2019-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer impor... | 2.25 | 2 |
contacts/urls.py | cheradenine/Django-CRM | 2 | 3502 | <filename>contacts/urls.py
from django.urls import path
from contacts.views import (
ContactsListView, CreateContactView, ContactDetailView,
UpdateContactView, RemoveContactView,
GetContactsView, AddCommentView, UpdateCommentView,
DeleteCommentView, AddAttachmentsView, DeleteAttachmentsView)
app_name =... | 2.234375 | 2 |
windows/winobject/network.py | marpie/PythonForWindows | 1 | 3503 | import windows
import ctypes
import socket
import struct
from windows import winproxy
import windows.generated_def as gdef
from windows.com import interfaces as cominterfaces
from windows.generated_def.winstructs import *
from windows.generated_def.windef import *
class TCP4Connection(MIB_TCPROW_OWNER_PID):
"""A... | 2.4375 | 2 |
LIM_scripts/func_curry.py | Bhare8972/LOFAR-LIM | 3 | 3504 | #!/usr/bin/env python3
# Coded by <NAME>, 2012.
#
# - Thanks to b49P23TIvg for suggesting that I should use a set operation
# instead of repeated membership tests.
# - Thanks to <NAME> for pointing out that
# - "minArgs = None" is better than "minArgs = -1",
# - "if args" is better than "if len(args)", and... | 2.859375 | 3 |
src/messages.py | Ewpratten/chat | 0 | 3505 | greeting = """
--------------- BEGIN SESSION ---------------
You have connected to a chat server. Welcome!
:: About
Chat is a small piece of server software
written by <NAME> to allow people to
talk to eachother from any computer as long
as it has an internet connection. (Even an
arduino!). Check out the project at:... | 2.546875 | 3 |
Prediction.py | khayam-hafezi/CRNN-keras-persian | 0 | 3506 | <reponame>khayam-hafezi/CRNN-keras-persian
import cv2
import itertools, os, time
import numpy as np
from Model import get_Model
from parameter import letters
import argparse
from keras import backend as K
K.set_learning_phase(0)
Region = {"A": "서울 ", "B": "경기 ", "C": "인천 ", "D": "강원 ", "E": "충남 ", "F": "대전 ",
... | 2.0625 | 2 |
torcharrow/_interop.py | OswinC/torcharrow | 0 | 3507 | # Copyright (c) Facebook, Inc. and its affiliates.
from typing import List, Optional, cast
# Skipping analyzing 'numpy': found module but no type hints or library stubs
import numpy as np # type: ignore
import numpy.ma as ma # type: ignore
# Skipping analyzing 'pandas': found module but no type hints or library stu... | 2.515625 | 3 |
research/gan/image_compression/eval.py | jdavidagudelo/tensorflow-models | 1 | 3508 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.976563 | 2 |
source/dump_query_results.py | CheyenneNS/metrics | 0 | 3509 | <reponame>CheyenneNS/metrics
#!/usr/local/bin/python
import os
import mysql.connector as mysql
metrics_mysql_password = os.environ['METRICS_MYSQL_PWD']
sql_host = os.environ['SQL_HOST']
metrics = os.environ['QUERY_ON']
def dump_query_results():
"""
This is a simple SQL table dump of a given query so we ... | 2.671875 | 3 |
desktop_local_tests/windows/test_windows_packet_capture_disrupt_force_public_dns_servers.py | UAEKondaya1/expressvpn_leak_testing | 219 | 3510 | <reponame>UAEKondaya1/expressvpn_leak_testing
from desktop_local_tests.local_packet_capture_test_case_with_disrupter import LocalPacketCaptureTestCaseWithDisrupter
from desktop_local_tests.windows.windows_dns_force_public_dns_servers_disrupter import WindowsDNSForcePublicDNSServersDisrupter
class TestWindowsPacketCapt... | 1.835938 | 2 |
kivy/loader.py | geojeff/kivy | 1 | 3511 | '''
Asynchronous data loader
========================
This is the Asynchronous Loader. You can use it to load an image
and use it, even if data are not yet available. You must specify a default
loading image for using a such loader::
from kivy import *
image = Loader.image('mysprite.png')
You can also load i... | 3.515625 | 4 |
Season 01 - Intro to Python/Episode 13 - Join.py | Pythobit/Python-tutorial | 3 | 3512 | # 13. Join
# it allows to print list a bit better
friends = ['Pythobit','boy','Pythoman']
print(f'My friends are {friends}.') # Output - My friends are ['Pythobit', 'boy', 'Pythoman'].
# So, the Output needs to be a bit clearer.
friends = ['Pythobit','boy','Pythoman']
friend = ', '.join(friends)
print(f'My friend... | 4.25 | 4 |
buildsettings.py | randomizax/polygon-label | 0 | 3513 | # settings file for builds.
# if you want to have custom builds, copy this file to "localbuildsettings.py" and make changes there.
# possible fields:
# resourceBaseUrl - optional - the URL base for external resources (all resources embedded in standard IITC)
# distUrlBase - optional - the base URL to use for update c... | 1.882813 | 2 |
osaka/storage/sftp.py | riverma/osaka | 2 | 3514 | <filename>osaka/storage/sftp.py
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import int
from future import standard_library
standard_library.install_aliases()
import os
import os.path
import stat
imp... | 2.71875 | 3 |
thesis/pettingzoo/butterfly/cooperative_pong/cake_paddle.py | heavenlysf/thesis | 0 | 3515 | import os
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "hide"
import pygame
RENDER_RATIO = 2
class CakePaddle(pygame.sprite.Sprite):
def __init__(self, speed=12):
# surf is the right-most (largest) tier of the cake
self.surf = pygame.Surface((30 // RENDER_RATIO, 120 // RENDER_RATIO))
self.... | 3.015625 | 3 |
src/internal_representation_analysis/decoder/StateDataset.py | aidkilda/understanding-drl-navigation | 0 | 3516 | <filename>src/internal_representation_analysis/decoder/StateDataset.py
import random
from internal_representation_analysis.network import ActorCriticFFNetwork
from internal_representation_analysis.scene_loader import THORDiscreteEnvironment as Environment
from internal_representation_analysis.constants import MINI_BA... | 2.265625 | 2 |
test_dataset_model.py | ferrine/PerceptualSimilarity | 0 | 3517 | <filename>test_dataset_model.py
import numpy as np
from models import dist_model as dm
from data import data_loader as dl
import argparse
from IPython import embed
parser = argparse.ArgumentParser()
parser.add_argument("--dataset_mode", type=str, default="2afc", help="[2afc,jnd]")
parser.add_argument(
"--datasets"... | 2.234375 | 2 |
plotter.py | StrangeTcy/pathnet-pytorch | 86 | 3518 | import argparse
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
parser = argparse.ArgumentParser(description='PyTorch MNIST Example')
parser.add_argument('--mnist', action='store_true', default=False,
help='open mnist result')
args = parser.parse_a... | 2.671875 | 3 |
kindler/solver/optimizer.py | mingruimingrui/kindler | 0 | 3519 | <reponame>mingruimingrui/kindler
import torch
def make_sgd_optimizer(
model,
base_lr=0.001,
bias_lr_factor=2.0,
momentum=0.9,
weight_decay=0.0005,
weight_decay_bias=0.0,
):
params = []
for key, value in model.named_parameters():
if not value.requires_grad:
continue
... | 2.46875 | 2 |
platypus/tests/test_operators.py | sctiwari/EZFF_ASE | 2 | 3520 | <gh_stars>1-10
# Copyright 2015-2018 <NAME>
#
# This file is part of Platypus, a Python module for designing and using
# evolutionary algorithms (EAs) and multiobjective evolutionary algorithms
# (MOEAs).
#
# Platypus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | 2.796875 | 3 |
fusion_net/bilinear_sampler.py | ClovisChen/LearningCNN | 0 | 3521 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-are not covered by the UCLB ACP-A Licence,
from __future__ import absolute_import, division, print_function
import tensorflow as tf
def bilinear_sampler_1d_h(input_images, x_offset, wrap_mode='border', name='bilinear_sampler', **kwargs):
'''
一维双线性采样: x_... | 1.96875 | 2 |
Supernovae.py | adamamiller/iptf16hvw-1 | 0 | 3522 | <filename>Supernovae.py
#import relevant libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from astropy.io import ascii
import json
from IPython.display import display, Image
from specutils import Spectrum1D
from astropy import units
from scipy.optimize import curve_fit
from scipy.interpo... | 2.765625 | 3 |
userbot/plugins/alive.py | iraqis1/irqis | 0 | 3523 | """Check if userbot alive. If you change these, you become the gayest gay such that even the gay world will disown you."""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME
from userbot.utils import admin_cm... | 2.640625 | 3 |
connector/ADBConnector.py | qiutongxue/ArknightsAutoHelper | 1 | 3524 | import os
import logging.config
from random import randint
import zlib
import struct
import socket
import time
from PIL import Image
import config
# from config import ADB_ROOT, ADB_HOST, SCREEN_SHOOT_SAVE_PATH, ShellColor, CONFIG_PATH,enable_adb_host_auto_detect, ADB_SERVER
from .ADBClientSession import ADBClientSes... | 2.140625 | 2 |
redshift_upload/base_utilities.py | douglassimonsen/redshift_upload | 0 | 3525 | import inspect
import os
from pathlib import Path
class change_directory:
"""
A class for changing the working directory using a "with" statement.
It takes the directory to change to as an argument. If no directory is given,
it takes the directory of the file from which this function was call... | 3.6875 | 4 |
main.py | Gloriel621/MgallManager | 9 | 3526 | import sys
from PyQt5.QtWidgets import QApplication
from gui import MgallManager
def main():
app = QApplication(sys.argv)
ex = MgallManager()
app.aboutToQuit.connect(ex.ExitHandler)
sys.exit(app.exec_())
if __name__ == "__main__":
main()
| 2.390625 | 2 |
utils/src/adventofcode/utils/Point3D.py | dh256/adventofcode | 0 | 3527 | <gh_stars>0
class Point3D:
def __init__(self,x,y,z):
self.x = x
self.y = y
self.z = z
'''
Returns the distance between two 3D points
'''
def distance(self, value):
return abs(self.x - value.x) + abs(self.y - value.y) + abs(self.z - value.z)
def __eq__(self, valu... | 3.5 | 4 |
pysc2/lib/actions.py | javierrcc522/starcraft2_api_machineLear | 2 | 3528 | <filename>pysc2/lib/actions.py
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 2.109375 | 2 |
pywick/meters/aucmeter.py | ashishpatel26/pywick | 2 | 3529 | <reponame>ashishpatel26/pywick
import numbers
from . import meter
import numpy as np
import torch
class AUCMeter(meter.Meter):
"""
The AUCMeter measures the area under the receiver-operating characteristic
(ROC) curve for binary classification problems. The area under the curve (AUC)
can be interprete... | 3.15625 | 3 |
homeassistant/components/zha/core/channels/lighting.py | liangleslie/core | 30,023 | 3530 | """Lighting channels module for Zigbee Home Automation."""
from __future__ import annotations
from contextlib import suppress
from zigpy.zcl.clusters import lighting
from .. import registries
from ..const import REPORT_CONFIG_DEFAULT
from .base import ClientChannel, ZigbeeChannel
@registries.ZIGBEE_CHANNEL_REGISTR... | 2.15625 | 2 |
pf/queue.py | PiRAT4/py-pf | 0 | 3531 | """Classes to represent Packet Filter's queueing schedulers and statistics."""
import pf._struct
from pf._base import PFObject
from pf.constants import *
from pf._utils import rate2str
__all__ = ["ServiceCurve",
"FlowQueue",
"PFQueue",
"PFQueueStats"]
class ServiceCurve(PFObject):
... | 2.65625 | 3 |
sdk/python/pulumi_azure_native/labservices/v20181015/__init__.py | pulumi-bot/pulumi-azure-native | 0 | 3532 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .environment import *
from .environment_setting import *
from .gallery_image imp... | 1.570313 | 2 |
servicedirectory/src/sd-api/users/tests/tests_serializers.py | ealogar/servicedirectory | 0 | 3533 | '''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... | 1.992188 | 2 |
Web/notifyXAPI/app/src/users/views.py | abs0lut3pwn4g3/RootersCTF2019-challenges | 14 | 3534 | ''' User views '''
from datetime import timedelta
from flask import request, jsonify, make_response, redirect, json, render_template
from flask_jwt_extended import (create_access_token, jwt_required)
from flask_restful import Resource
from flask_login import login_user, current_user
from sqlalchemy.exc import Integrit... | 2.53125 | 3 |
querybuilder/tests/window_tests.py | wesokes/django-query-builder | 110 | 3535 | <reponame>wesokes/django-query-builder<filename>querybuilder/tests/window_tests.py<gh_stars>100-1000
from querybuilder.fields import (
RankField, RowNumberField, DenseRankField, PercentRankField, CumeDistField, NTileField, LagField,
LeadField, FirstValueField, LastValueField, NthValueField, NumStdDevField
)
fro... | 2.1875 | 2 |
emoji/coffee.py | wbprice/ojimoji | 0 | 3536 | <reponame>wbprice/ojimoji
import numpy
h = .25
s = 1
bitmap = numpy.array([
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0],
[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],
[0,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0],
[0,0,... | 2.625 | 3 |
dumpcode/npzbdt.py | gkfthddk/keras | 0 | 3537 | import numpy as np
from sklearn.model_selection import RandomizedSearchCV, GridSearchCV
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import KFold
import scipy.stats as sts
import xgboost as xgb
from xiter import *
import pandas as pd
import a... | 2.09375 | 2 |
rlenv/StockTradingEnv0.py | watchsea/RL-Stock | 0 | 3538 | import random
import json
import gym
from gym import spaces
import pandas as pd
import numpy as np
MAX_ACCOUNT_BALANCE = 2147483647
MAX_NUM_SHARES = 2147483647
MAX_SHARE_PRICE = 5000
MAX_VOLUME = 1000e8
MAX_AMOUNT = 3e10
MAX_OPEN_POSITIONS = 5
MAX_STEPS = 20000
MAX_DAY_CHANGE = 1
INITIAL_ACCOUNT_BALANCE = 10000
DATA... | 2.890625 | 3 |
processing/manager.py | mrfleap/us-population-heatmap | 0 | 3539 | import json
import os
import pathlib
import time
from tqdm import tqdm
from aggregator import aggregate
from download import DOWNLOAD_PATH, download_files, unzip_files
from tqdm.contrib.concurrent import process_map
def main():
start = time.time()
# print("Downloading files...")
# download_files()
#... | 2.46875 | 2 |
gen_data.py | kshoji6011/vehicleai | 0 | 3540 | from PIL import Image
import os, glob
import numpy as np
from sklearn import model_selection
classes = ["car", "bycycle", "motorcycle", "pedestrian"]
num_class = len(classes)
image_size = 50
# 画像の読み込み
X = []
Y = []
for index, classlabel in enumerate(classes):
photos_dir = "./" + classlabel
files = glob.glob... | 2.96875 | 3 |
app/main.py | immortel32/Sword_Sorcery_Story_Generator | 2 | 3541 | <reponame>immortel32/Sword_Sorcery_Story_Generator
from services import waypoint_scenarios, quest_scenarios
from services.build_campaign import Campaign
from log_setup import log
if __name__ == "__main__":
number_waypoint_scenario = waypoint_scenarios.get_number_of_waypoint_scenarios()
log.info(f"We have {numb... | 2.328125 | 2 |
tests/test-recipes/metadata/ignore_some_prefix_files/run_test.py | mbargull/conda-build | 0 | 3542 | <filename>tests/test-recipes/metadata/ignore_some_prefix_files/run_test.py
import os
pkgs = os.path.join(os.environ["ROOT"], "pkgs")
info_dir = os.path.join(pkgs, "conda-build-test-ignore-some-prefix-files-1.0-0", "info")
has_prefix_file = os.path.join(info_dir, "has_prefix")
print(info_dir)
assert os.path.isfile(has_... | 2.546875 | 3 |
distill.py | Lukeming-tsinghua/Interpretable-NN-for-IBD-diagnosis | 0 | 3543 | <filename>distill.py
import os
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import classification_report
from torch.optim import Adam
from tqdm import tqdm
from data import DataIteratorDistill
from loss import FocalLoss
from model import CN... | 2.34375 | 2 |
tests/TALTests/HTMLTests/TALAttributesTestCases.py | janbrohl/SimpleTAL | 5 | 3544 | #!/usr/bin/python
# -*- coding: iso-8859-1 -*-
# Copyright (c) 2016, <NAME> <<EMAIL>>
# All rights reserved.
# See LICENSE.txt
# Copyright (c) 2004 <NAME> (http://www.owlfish.com/)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are pe... | 1.523438 | 2 |
iseq_prof/fasta.py | EBI-Metagenomics/iseq-prof | 0 | 3545 | from pathlib import Path
from typing import List
from fasta_reader import FASTAItem, FASTAWriter, read_fasta
__all__ = ["downsample"]
def downsample(infile: Path, outfile: Path, size: int, random):
targets: List[FASTAItem] = list(read_fasta(infile))
if size > len(targets):
raise ValueError("Size is ... | 3.28125 | 3 |
src/data_settings.py | DhruvSrikanth/TSLA-React | 0 | 3546 | # API keys
# YF_API_KEY = "<KEY>" # yahoo finance api key
TICKER = "TSLA"
INTERVAL = "1m"
PERIOD = "1d"
LOOK_BACK = 30 # hard limit to not reach rate limit of 100 per day | 1.4375 | 1 |
ymir/backend/src/ymir_controller/controller/utils/invoker_mapping.py | phoenix-xhuang/ymir | 64 | 3547 | from controller.invoker import (
invoker_cmd_branch_checkout,
invoker_cmd_branch_commit,
invoker_cmd_branch_create,
invoker_cmd_branch_delete,
invoker_cmd_branch_list,
invoker_cmd_evaluate,
invoker_cmd_filter,
invoker_cmd_gpu_info,
invoker_cmd_inference,
invoker_cmd_init,
inv... | 1.546875 | 2 |
tests/utils/date_utils.py | asuol/worky | 0 | 3548 | <filename>tests/utils/date_utils.py
from datetime import datetime, timedelta
due_date_format = '%Y-%m-%d'
datepicker_date_format = '%m%d%Y'
def current_date():
return datetime.utcnow().strftime(due_date_format)
def datepicker_current_date():
return datetime.utcnow().strftime(datepicker_date_format)
def ... | 2.671875 | 3 |
numba/roc/tests/hsapy/test_gufuncbuilding.py | luk-f-a/numba | 76 | 3549 | <reponame>luk-f-a/numba
import numpy as np
from numba.roc.vectorizers import HsaGUFuncVectorize
from numba.roc.dispatch import HSAGenerializedUFunc
from numba import guvectorize
import unittest
def ufunc_add_core(a, b, c):
for i in range(c.size):
c[i] = a[i] + b[i]
class TestGUFuncBuilding(unittest.Tes... | 2.171875 | 2 |
server/form/mongo.py | SRM-IST-KTR/ossmosis | 6 | 3550 | import os
from pymongo import MongoClient
from dotenv import load_dotenv
def database_entry(data):
try:
load_dotenv()
mongo_string = os.getenv('MONGODB_AUTH_URI')
client = MongoClient(mongo_string)
database = client[os.getenv('MONGODB_DB')]
col = database['users']
c... | 2.34375 | 2 |
control-flow/solution/file_hosts.py | giserh/book-python | 1 | 3551 | FILE = r'../src/etc-hosts.txt'
hostnames = []
try:
with open(FILE, encoding='utf-8') as file:
content = file.readlines()
except FileNotFoundError:
print('File does not exist')
except PermissionError:
print('Permission denied')
for line in content:
if line.startswith('#'):
continue
... | 3.0625 | 3 |
zindi/docs/utils/n_subimissions_per_day.py | eaedk/testing-zindi-package | 6 | 3552 | def n_subimissions_per_day( url, headers ):
"""Get the number of submissions we can make per day for the selected challenge.
Parameters
----------
url : {'prize', 'points', 'knowledge' , 'all'}, default='all'
The reward of the challenges for top challengers.
headers : dictionary ,
T... | 3.28125 | 3 |
algo/test/test_maximum_cut.py | ssavinash1/Algorithm_stanford | 24 | 3553 | # -*- coding: utf-8 -*-
import unittest
from src.graph import Graph
from src.maximum_cut import maximum_cut, maximum_cut_for_bipartite_graph
class MaximumCut(unittest.TestCase):
def test_maximum_cut_for_bipartite_graphs(self):
""" Given the following bipartite graph.
(a)-----(b)
... | 3.671875 | 4 |
gdb/print-avs-rbtree.py | kemonats/avs_commons | 4 | 3554 | <filename>gdb/print-avs-rbtree.py
# -*- coding: utf-8 -*-
#
# Copyright 2021 AVSystem <<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.34375 | 2 |
hour17/PythonGroup.py | sampx/mongodb-practice | 0 | 3555 | from pymongo import MongoClient
def displayGroup(results):
for result in results:
print (result)
def firstIsALastIsVowel(collection):
key = {'first' : True, "last" : True}
cond = {'first' : 'a', 'last' :
{'$in' : ["a","e","i","o","u"]}}
initial = {'count' : 0}
red... | 3.140625 | 3 |
packnet_sfm/models/model_utils.py | pection/packnet-sfm | 1 | 3556 | # Copyright 2020 Toyota Research Institute. All rights reserved.
from packnet_sfm.utils.image import flip_lr, interpolate_scales
from packnet_sfm.utils.misc import filter_dict
from packnet_sfm.utils.types import is_tensor, is_list, is_numpy
def flip(tensor, flip_fn):
"""
Flip tensors or list of tensors base... | 2.234375 | 2 |
utils/stg/min_jerk_traj.py | dgerod/more-dmps | 7 | 3557 | '''
Created on 25.07.2012
@author: karl
'''
def trajectory(start, goal, duration, delta_t):
traj = []
# inital values
t, td, tdd = start, 0, 0
for i in range(int(2 * duration / delta_t)):
try:
t, td, tdd = _min_jerk_step(t, td, tdd, goal, duration - i * delta_t, delta_t)
except:
break
... | 2.953125 | 3 |
tests/__init__.py | karanrampal/triplet-loss | 0 | 3558 | <gh_stars>0
# To make directory as a python package
| 1.046875 | 1 |
orthoexon/tests/test_util.py | jessicalettes/orthoexon | 0 | 3559 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_orthoexon
----------------------------------
Tests for `orthoexon` module.
"""
import os
import pytest
@pytest.fixture
def exon_id_with_quotes():
return "'ENSE00001229068.1'"
@pytest.fixture
def exon_id():
return "ENSE00001229068.1"
def test_separate_... | 2.21875 | 2 |
predict_recognition.py | yeyupiaoling/Kersa-Speaker-Recognition | 42 | 3560 | <filename>predict_recognition.py
import argparse
import os
import shutil
import time
import numpy as np
from utils import model, utils
from utils.record import RecordAudio
parser = argparse.ArgumentParser()
parser.add_argument('--audio_db', default='audio_db/', type=str, help='音频库的路径')
parser.add_a... | 2.59375 | 3 |
cubedash/_product.py | vconrado/datacube-explorer | 0 | 3561 | <reponame>vconrado/datacube-explorer
import logging
from datetime import timedelta
from flask import Blueprint, Response, abort, redirect, url_for
from cubedash import _model, _utils, _utils as utils
_LOG = logging.getLogger(__name__)
bp = Blueprint("product", __name__)
@bp.route("/about.csv")
def legacy_about_csv... | 2.09375 | 2 |
litex_boards/platforms/sipeed_tang_nano.py | ozbenh/litex-boards | 0 | 3562 | #
# This file is part of LiteX-Boards.
#
# Copyright (c) 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
# Board diagram/pinout:
# https://user-images.githubusercontent.com/1450143/133655492-532d5e9a-0635-4889-85c9-68683d06cae0.png
# http://dl.sipeed.com/TANG/Nano/HDK/Tang-NANO-2704(Schematic).pdf
from ... | 1.546875 | 2 |
nm_cavia/rl/metalearner.py | anon-6994/nm-metarl | 0 | 3563 | import torch
from torch.distributions.kl import kl_divergence
from torch.nn.utils.convert_parameters import (vector_to_parameters,
parameters_to_vector)
from rl_utils.optimization import conjugate_gradient
from rl_utils.torch_utils import (weighted_mean, detach_distributi... | 2.484375 | 2 |
request/management/commands/purgerequests.py | hramezani/django-request | 373 | 3564 | from datetime import timedelta
from dateutil.relativedelta import relativedelta
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from ...models import Request
DURATION_OPTIONS = {
'hours': lambda amount: timezone.now() - timedelta(hours=amount),
'days': lamb... | 2.234375 | 2 |
tests/test_crypto.py | kimtaehong/PythonForWindows | 0 | 3565 | import pytest
import windows.crypto
import windows.generated_def as gdef
import windows.crypto.generation
from .pfwtest import *
pytestmark = pytest.mark.usefixtures('check_for_gc_garbage')
TEST_CERT = b"""
<KEY>"""
## Cert info:
# Name: PythonForWindowsTest
# Serial: '1b 8e 94 cb 0b 3e eb b6 41 39 f3 c9 09 b1 6... | 2.109375 | 2 |
cdci_data_analysis/analysis/plot_tools.py | andreatramacere/cdci_data_analysis | 0 | 3566 | from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object, map, zip)
__author__ = "<NAME>"
import numpy as np
from astropy import wcs
from bokeh.layouts import row, widgetbox,gridplot
from bokeh... | 2.015625 | 2 |
test/unit/test_testaid_unit_pathlist.py | RebelCodeBase/testaid | 17 | 3567 | from pathlib import Path
from testaid.pathlist import PathList
def test_testaid_unit_pathlist_roles_blacklist(testvars_roles_blacklist):
assert testvars_roles_blacklist is not None
def test_testaid_unit_pathlist_roles_whitelist(testvars_roles_whitelist):
assert testvars_roles_whitelist is not None
def tes... | 2.40625 | 2 |
tests/unit/zhmcclient/test_hba.py | vkpro-forks/python-zhmcclient | 0 | 3568 | <filename>tests/unit/zhmcclient/test_hba.py<gh_stars>0
# Copyright 2016-2017 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
#
# http://www.apache.org/licens... | 2.046875 | 2 |
compiler-rt/test/asan/TestCases/Windows/lit.local.cfg.py | medismailben/llvm-project | 2,338 | 3569 | def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
# We only run a small set of tests on Windows for now.
# Override the parent directory's "unsupported" decision until we can handle
# all of its tests.
if root.host_os in ['Windows']:
config.unsuppo... | 2.546875 | 3 |
Lib/test/libregrtest/utils.py | oskomorokhov/cpython | 5 | 3570 | <filename>Lib/test/libregrtest/utils.py
import math
import os.path
import sys
import textwrap
from test import support
def format_duration(seconds):
ms = math.ceil(seconds * 1e3)
seconds, ms = divmod(ms, 1000)
minutes, seconds = divmod(seconds, 60)
hours, minutes = divmod(minutes, 60)
parts = []
... | 2.671875 | 3 |
efetch_server/plugins/fa_sqlite/fa_sqlite_ajax.py | Syrkadian/efetch | 38 | 3571 | """
AJAX for SQLite Viewer plugin
"""
from yapsy.IPlugin import IPlugin
from flask import Response, jsonify
import json
import logging
import sqlite3
class FaSqliteAjax(IPlugin):
def __init__(self):
self.display_name = 'SQLite Ajax'
self.popularity = 0
self.cache = True
self.fast ... | 2.390625 | 2 |
raspagem/random/lista_cidades.py | sslppractice/propython | 0 | 3572 | <filename>raspagem/random/lista_cidades.py
import requests, json
url = 'http://educacao.dadosabertosbr.com/api/cidades/ce'
cidades = requests.get(url).content
cidades = cidades.decode('utf-8')
cidades = json.loads(cidades)
for cidade in cidades:
codigo, nome = cidade.split(':')
print(nome)
| 2.84375 | 3 |
mezzanine/__init__.py | startupgrind/mezzanine | 0 | 3573 | <reponame>startupgrind/mezzanine
__version__ = "4.3.1.post1"
| 1.078125 | 1 |
src/autonomous/purepursuit.py | Sloomey/DeepSpace2019 | 0 | 3574 | import math
from constants import Constants
from utils import vector2d
from wpilib import SmartDashboard as Dash
from autonomous import pursuitpoint
class PurePursuit():
"""An implementation of the Pure Pursuit path tracking algorithm."""
def __init__(self, path):
self.path = path
self.pursui... | 3.09375 | 3 |
esphome/voluptuous_schema.py | TheEggi/esphomeyaml | 0 | 3575 | <gh_stars>0
import difflib
import itertools
import voluptuous as vol
from esphome.py_compat import string_types
class ExtraKeysInvalid(vol.Invalid):
def __init__(self, *arg, **kwargs):
self.candidates = kwargs.pop('candidates')
vol.Invalid.__init__(self, *arg, **kwargs)
def ensure_multiple_inv... | 2.296875 | 2 |
semisupervised/DensityPeaks.py | dpr1005/Semisupervised-learning-and-instance-selection-methods | 3 | 3576 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Filename: DensityPeaks.py
# @Author: <NAME>
# @Time: 5/3/22 09:55
# @Version: 4.0
import math
from collections import defaultdict
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier, NearestNeighbors
from sklearn.... | 2.75 | 3 |
N-aryTreeLevelOrderTraversal429.py | Bit64L/LeetCode-Python- | 0 | 3577 | """
# Definition for a Node.
"""
class TreeNode(object):
def __init__(self, val, children):
self.val = val
self.children = children
class Solution(object):
def levelOrder(self, root):
"""
:type root: Node
:rtype: List[List[int]]
"""
if root is None:
... | 3.71875 | 4 |
plugin.video.team.milhanos/websocket/_core.py | akuala/REPO.KUALA | 2 | 3578 | <reponame>akuala/REPO.KUALA
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 <NAME>(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version... | 2.296875 | 2 |
vaccine_card/logistic/models.py | Unanimad/lais_046_2020_etapa_2 | 0 | 3579 | from django.db import models
from vaccine_card.vaccination.models import Vaccine
class State(models.Model):
name = models.CharField(max_length=20, verbose_name='Nome')
class Meta:
verbose_name = 'Unidade Federativa'
def __str__(self):
return self.name
class City(models.Model):
nam... | 2.078125 | 2 |
test/test_rimuhosting.py | shenoyn/libcloud | 1 | 3580 | <reponame>shenoyn/libcloud
# 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.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (... | 1.765625 | 2 |
tests/base_tests/polygon_tests/test_contains.py | lycantropos/gon | 10 | 3581 | <gh_stars>1-10
from typing import Tuple
from hypothesis import given
from gon.base import (Point,
Polygon)
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.polygons)
def test_vertices(polygon: Polygon) -> None:
assert al... | 2.875 | 3 |
easyidp/core/tests/test_class_reconsproject.py | HowcanoeWang/EasyIDP | 0 | 3582 | import os
import numpy as np
import pytest
import easyidp
from easyidp.core.objects import ReconsProject, Points
from easyidp.io import metashape
module_path = os.path.join(easyidp.__path__[0], "io/tests")
def test_init_reconsproject():
attempt1 = ReconsProject("agisoft")
assert attempt1.software == "metash... | 2.046875 | 2 |
withings_api/const.py | tiloc/python_withings_api | 0 | 3583 | <gh_stars>0
"""Constant values."""
STATUS_SUCCESS = (0,)
STATUS_AUTH_FAILED = (100, 101, 102, 200, 401)
STATUS_INVALID_PARAMS = (
201,
202,
203,
204,
205,
206,
207,
208,
209,
210,
211,
212,
213,
216,
217,
218,
220,
221,
223,
225,
227... | 1.859375 | 2 |
examples/canvas/bezier.py | sirpercival/kivy | 2 | 3584 | #!/usr/bin/env python
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.slider import Slider
from kivy.graphics import Color, Bezier, Line
class BezierTest(FloatLayout):
def __init__(self, points=[], loop=False, *args, **kwargs):
super(BezierTest, self).__init__(*args, *... | 3.046875 | 3 |
tests/bugs/core_6489_test.py | reevespaul/firebird-qa | 0 | 3585 | <filename>tests/bugs/core_6489_test.py<gh_stars>0
#coding:utf-8
#
# id: bugs.core_6489
# title: User without ALTER ANY ROLE privilege can use COMMENT ON ROLE
# decription:
# Test creates two users: one of them has no any rights, second is granted with 'alter any role' privilege.
# ... | 1.4375 | 1 |
utils/utils_bbox.py | MasoonZhang/FasterRConvMixer | 0 | 3586 | <reponame>MasoonZhang/FasterRConvMixer
import numpy as np
import torch
from torch.nn import functional as F
from torchvision.ops import nms
def loc2bbox(src_bbox, loc):
if src_bbox.size()[0] == 0:
return torch.zeros((0, 4), dtype=loc.dtype)
src_width = torch.unsqueeze(src_bbox[:, 2] - src_bbox[:, 0... | 2.046875 | 2 |
lib/python/test/__init__.py | woozhijun/cat | 17,318 | 3587 | #!/usr/bin/env python
# encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8") | 1.414063 | 1 |
tests/test_pyclipper.py | odidev/pyclipper | 0 | 3588 | <filename>tests/test_pyclipper.py<gh_stars>0
#!/usr/bin/python
"""
Tests for Pyclipper wrapper library.
"""
from __future__ import print_function
from unittest2 import TestCase, main
import sys
if sys.version_info < (3,):
integer_types = (int, long)
else:
integer_types = (int,)
import pyclipper
# Example po... | 2.390625 | 2 |
imageproc_OE_IF_quant/2_annotate_extracted_cells.py | hshayya/2022_Shayya_UPR_Guidance | 0 | 3589 | <filename>imageproc_OE_IF_quant/2_annotate_extracted_cells.py
import xml.etree.ElementTree as ET
import csv
import os
import re
from ij import IJ
from loci.plugins.in import ImporterOptions
from loci.plugins import BF
from ij.plugin import ImagesToStack
from ij import io
#Records metadata (x,y location) for cells that... | 1.9375 | 2 |
MAEnv/env_SingleCatchPigs/test_SingleCatchPigs.py | Abluceli/Multi-agent-Reinforcement-Learning-Algorithms | 5 | 3590 | <reponame>Abluceli/Multi-agent-Reinforcement-Learning-Algorithms
from env_SingleCatchPigs import EnvSingleCatchPigs
import random
env = EnvSingleCatchPigs(7)
max_iter = 10000
env.set_agent_at([2, 2], 0)
env.set_pig_at([4, 4], 0)
for i in range(max_iter):
print("iter= ", i)
env.render()
action = random.rand... | 3.03125 | 3 |
eust/tables/data.py | rasmuse/eust | 1 | 3591 | <filename>eust/tables/data.py
# -*- coding: utf-8 -*-
import re
import gzip
import pandas as pd
import numpy as np
from eust.core import _download_file, conf
_DIMENSION_NAME_RE = re.compile(r"^[a-z_0-9]+$")
_YEAR_RE = re.compile(r"^(1|2)[0-9]{3}$")
def _is_valid_dimension_name(s: str) -> bool:
return bool(_D... | 2.65625 | 3 |
utils.py | fatemehtd/Echo-SyncNet | 6 | 3592 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from config import CONFIG
import json
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top
import io
import math
import os
import time
from absl i... | 2.3125 | 2 |
UnityPy/classes/Sprite.py | dblack2056/UnityPy | 0 | 3593 | from enum import IntEnum
from .Mesh import BoneWeights4, SubMesh, VertexData
from .NamedObject import NamedObject
from .PPtr import PPtr, save_ptr
from ..export import SpriteHelper
from ..enums import SpriteMeshType
from ..streams import EndianBinaryWriter
class Sprite(NamedObject):
@property
def image(self)... | 2.265625 | 2 |
eazy/filters.py | albertfxwang/eazy-py | 0 | 3594 | <filename>eazy/filters.py
import numpy as np
import os
from astropy.table import Table
from . import utils
__all__ = ["FilterDefinition", "FilterFile", "ParamFilter"]
VEGA_FILE = os.path.join(utils.path_to_eazy_data(),
'alpha_lyr_stis_008.fits')
VEGA = Table.read(VE... | 2.421875 | 2 |
LeetCode/106.py | KevinTMtz/CompetitiveProgramming | 1 | 3595 | <reponame>KevinTMtz/CompetitiveProgramming
#
# LeetCode
#
# Problem - 106
# URL - https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/
#
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# ... | 3.8125 | 4 |
evalml/automl/automl_search.py | skvorekn/evalml | 0 | 3596 | import copy
import time
from collections import defaultdict
import cloudpickle
import numpy as np
import pandas as pd
import woodwork as ww
from sklearn.model_selection import BaseCrossValidator
from .pipeline_search_plots import PipelineSearchPlots
from evalml.automl.automl_algorithm import IterativeAlgorithm
from ... | 1.890625 | 2 |
graphql_social_auth/mutations.py | deepsourcelabs/django-graphql-social-auth | 1 | 3597 | import graphene
from graphql_jwt.decorators import setup_jwt_cookie
from . import mixins, types
from .decorators import social_auth
class SocialAuthMutation(mixins.SocialAuthMixin, graphene.Mutation):
social = graphene.Field(types.SocialType)
class Meta:
abstract = True
class Arguments:
... | 2.40625 | 2 |
yellowbrick/regressor/base.py | Juan0001/yellowbrick-docs-zh | 20 | 3598 | <reponame>Juan0001/yellowbrick-docs-zh
# yellowbrick.regressor.base
# Base classes for regressor Visualizers.
#
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
# Created: Fri Jun 03 10:30:36 2016 -0700
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: base.py [7d3f5... | 1.726563 | 2 |
contrib/stack/stripmapStack/crossmul.py | falkamelung/isce2 | 0 | 3599 | #!/usr/bin/env python3
import os
import argparse
import logging
import isce
import isceobj
from components.stdproc.stdproc import crossmul
from iscesys.ImageUtil.ImageUtil import ImageUtil as IU
def createParser():
'''
Command Line Parser.
'''
parser = argparse.ArgumentParser( description='Generat... | 2.328125 | 2 |