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 |
|---|---|---|---|---|---|---|
loldib/getratings/models/NA/na_khazix/na_khazix_sup.py | koliupy/loldib | 0 | 16400 | from getratings.models.ratings import Ratings
class NA_Khazix_Sup_Aatrox(Ratings):
pass
class NA_Khazix_Sup_Ahri(Ratings):
pass
class NA_Khazix_Sup_Akali(Ratings):
pass
class NA_Khazix_Sup_Alistar(Ratings):
pass
class NA_Khazix_Sup_Amumu(Ratings):
pass
class NA_Khazix_Sup_Anivia(Ratings):
... | 1.335938 | 1 |
tests/data/expected/main/main_jsonschema_ids/id.py | roadsync/datamodel-code-generator | 0 | 16401 | # generated by datamodel-codegen:
# filename: Organization.schema.json
# timestamp: 1985-10-26T08:21:00+00:00
from __future__ import annotations
from pydantic import BaseModel, Field
class Schema(BaseModel):
__root__: str = Field(..., description='Identifier string of this object.')
| 2.34375 | 2 |
tablo/migrations/0006_alter_geom_col_type.py | consbio/tablo | 4 | 16402 | <filename>tablo/migrations/0006_alter_geom_col_type.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from tablo import GEOM_FIELD_NAME, WEB_MERCATOR_SRID
forward_sql = """
DO
$$
DECLARE
table_name name;
BEGIN
FOR table_name IN
... | 1.921875 | 2 |
tests/test_atise.py | tkg-framework/TKG-framework | 0 | 16403 | <reponame>tkg-framework/TKG-framework<filename>tests/test_atise.py<gh_stars>0
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.functional as F
from torch.nn.init import xavier_normal_
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.pat... | 2.0625 | 2 |
tests/security_test.py | smarkets/bravado-core | 0 | 16404 | <filename>tests/security_test.py
# -*- coding: utf-8 -*-
import pytest
from six import iteritems
def test_security_definition_property_extraction(security_dict, security_spec):
security_definitions = security_dict['securityDefinitions']
for security_name, security_spec_dict in iteritems(security_definitions):... | 2.4375 | 2 |
The Core/At the Crossroads/willYou.py | shanemichaelarcaro/codesignal | 0 | 16405 | def willYou(young, beautiful, loved):
return loved != (young and beautiful) | 1.164063 | 1 |
training/data_splits.py | ethansaxenian/RosettaDecode | 0 | 16406 | import json
from typing import Union, Optional, Tuple, List
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer, TfidfTransformer
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import Stan... | 2.65625 | 3 |
GAPP.py | timhartley/GAPP | 0 | 16407 | #!/usr/bin/python
#Sorts based on top 50 CMetric, all callPaths - CMetric
#, all call paths - call path count and all samples
from __future__ import print_function
from bcc import BPF, PerfType, PerfSWConfig
from bcc import BPF
import sys
import ctypes as ct # For mapping the 'C' structure to Python
import argparse #... | 2.28125 | 2 |
data/activitynet_feature_cuhk/data_process.py | NEUdeep/BSN | 1 | 16408 | # -*- coding: utf-8 -*-
import random
import numpy as np
import scipy
import pandas as pd
import pandas
import numpy
import json
def resizeFeature(inputData,newSize):
# inputX: (temporal_length,feature_dimension) #
originalSize=len(inputData)
#print originalSize
if originalSize==1:
inputData=... | 2.421875 | 2 |
examples/cloud-test.py | Ferris-Labs/ferris-cli | 0 | 16409 | <gh_stars>0
from cloudevents.sdk.event import v03
import json
from ferris_cli.ferris_cli import CloudEventsAPI
import uuid
import os
import consul
from ferris_cli.ferris_cli import ApplicationConfigurator
from datetime import datetime
def send_direct_loading_event(hdfs_path):
data = {"file_location": hdfs_path }... | 1.992188 | 2 |
REL_dashboarSERVIDORES.py | tiagotouso/TALENTOS_HUMANOS | 0 | 16410 | <reponame>tiagotouso/TALENTOS_HUMANOS<gh_stars>0
'''
GERADOR DE RELATÓRIO DOS SERVIDORES (DASHBOARD SERVIDORES)
'''
from SQL import sqlpandas
from MENSAGEM import mensagemInformacao, mensagemErro
from AUXILIAR import salvarPandas
def dashboardServidores():
'''
FUNÇÃO PARA CRIAR OS DASHDOARD
ENTRA
... | 2.703125 | 3 |
pyroombaadapter/__init__.py | ymollard/PyRoombaAdapter | 0 | 16411 | from pyroombaadapter.pyroombaadapter import PyRoombaAdapter
| 1.101563 | 1 |
torchkit/head/localfc/curricularface.py | sarvex/TFace | 764 | 16412 | <gh_stars>100-1000
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
from torch.nn import Parameter
import math
from torchkit.util.utils import l2_norm
from torchkit.head.localfc.common import calc_logits
class CurricularFace(nn.Module):
""" Implement of Curr... | 2.609375 | 3 |
lmsapi/api_cash/views.py | orkasolutions-develop/lms-api-new | 0 | 16413 | <gh_stars>0
from core.views import BaseViewSet
from .models import Cash
from .serializers import CashSerializer
class CashViewSet(BaseViewSet):
"""
- Vybirame jen typ 4 coz jsou platby z Banky
- Setridime nenovejsim datem na zacatek
"""
queryset = Cash.objects.all().filter(type=4).order_by('-time'... | 1.96875 | 2 |
front_end/migration_scripts/1_to_2.py | zacheliason/CodeBuddy | 0 | 16414 | import atexit
import sqlite3
import traceback
#################
import sys
sys.path.append('/app')
from helper import *
settings_dict = load_yaml_dict(read_file("/Settings.yaml"))
conn = sqlite3.connect(f"/database/{settings_dict['db_name']}", isolation_level=None, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_C... | 2.390625 | 2 |
examples/example_tbl.py | alexmaragko/pyPAHdb | 4 | 16415 | #!/usr/bin/env python3
"""
example.py
Example of using pypahdb to decompose an astronomical PAH spectrum.
"""
import pkg_resources
from pypahdb.decomposer import Decomposer
from pypahdb.observation import Observation
if __name__ == '__main__':
# The sample data (IPAC table).
file_path = 'resources/sample_... | 2.484375 | 2 |
homeassistant/components/zha/core/registries.py | headcode/home-assistant | 0 | 16416 | """
Mapping registries for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
from .const import (
DEVICE_CLASS, SINGLE_INPUT_CLUSTER_DEVICE_CLASS,
SINGLE_OUTPUT_CLUSTER_DEVICE_CLASS, COMPONENT_CLUSTERS, HUMIDITY,
... | 2.125 | 2 |
contrib/EISeg/eiseg/data/base.py | haoyuying/PaddleSeg | 1 | 16417 | <filename>contrib/EISeg/eiseg/data/base.py
import random
import pickle
import cv2
import numpy as np
import paddle
import paddleseg.transforms as T
from .points_sampler import MultiPointSampler
def get_unique_labels(x, exclude_zero=False):
obj_sizes = np.bincount(x.flatten())
labels = np.nonzero(obj_sizes)[... | 2.125 | 2 |
handler/createThumbnail.py | brainlife/ezbids | 7 | 16418 | <reponame>brainlife/ezbids<gh_stars>1-10
#!/usr/bin/env python3
"""
Created on Wed Feb 17 08:32:55 2021
Deface anatomical image(s)
@author: dlevitas
"""
import os, sys
import nibabel as nib
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('dark_background')
from math import fl... | 2.203125 | 2 |
IPython/core/events.py | pyarnold/ipython | 1 | 16419 | """Infrastructure for registering and firing callbacks on application events.
Unlike :mod:`IPython.core.hooks`, which lets end users set single functions to
be called at specific times, or a collection of alternative methods to try,
callbacks are designed to be used by extension authors. A number of callbacks
can be r... | 2.5625 | 3 |
api/routes/topic.py | quyenthucdoan/CUSTOMER-EMOTION-ANALYSIS-SYSTEM-BASED-ON-VIETNAMESE-COMMENTS | 0 | 16420 | <gh_stars>0
from app import app
from services import TopicServices
from flask import jsonify, request
@app.route('/topic/terms', methods=['GET'])
def getTerms():
numOfTerms = request.args.get("numOfTerms")
results = TopicServices.getTerms(numOfTerms)
return jsonify({ 'results': results }) | 2.25 | 2 |
test/functional/feature_uaclient.py | syedrizwanmy/bitcoin-abc | 1,266 | 16421 | #!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uaclientname and -uaclientversion option."""
import re
from test_framework.test_framework import Bitc... | 2.1875 | 2 |
tests/test_dispersion_formulas.py | mnishida/refractiveindex.info-Pandas | 1 | 16422 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import unittest
import numpy as np
import numpy.testing as npt
import pandas as pd
from riip.material import RiiMaterial
class KnownValues(unittest.TestCase):
known_values = [
(1, [0.0 for _ in range(17)], 1... | 2.0625 | 2 |
neutron/tests/unit/services/logapi/rpc/test_server.py | mcadariu/neutron | 1 | 16423 | # Copyright (c) 2017 Fujitsu Limited
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 1.757813 | 2 |
src/ipyradiant/tests/test_servicepatch_rdflib.py | sanbales/ipyradiant | 0 | 16424 | """ Unit Tests for Service Patch
"""
# Copyright (c) 2021 ipyradiant contributors.
# Distributed under the terms of the Modified BSD License.
import ipyradiant
import rdflib
LINKEDDATA_QUERY = """
SELECT DISTINCT ?s ?p ?o
WHERE {
SERVICE <http://linkeddata.uriburner.com/sparql>
{
... | 2.140625 | 2 |
tests/plugins/project/test_git.py | cloudblue/connect-cli | 12 | 16425 | <filename>tests/plugins/project/test_git.py
import subprocess
from collections import OrderedDict
import pytest
from connect.cli.plugins.project import git
@pytest.mark.parametrize(
('str', 'result'),
(
('0.0.0', True),
('0.0.4', True),
('1.0.0', True),
('1.2.0', True),
... | 2.3125 | 2 |
src/dao/user.py | lokaimoma/Flask-QR-Code-Web-APP | 2 | 16426 | # Created by Kelvin_Clark on 3/5/2022, 6:37 PM
from typing import Optional
from src.models.entities.user import User
from src import database as db
class UserDao:
@staticmethod
def get_user_by_email(email: str) -> Optional[User]:
return User.query.filter_by(email=email).first()
@staticmethod
... | 2.828125 | 3 |
dmoj/dmpg18g1.py | pi-guy-in-the-sky/competitive-programming | 0 | 16427 | <gh_stars>0
# Problem ID: dmpg18g1
# By <NAME> 2019-12-09
# Solved
import sys
FILLED = -1
EMPTY = 0
data = sys.stdin.read().split('\n')
n, k = map(int, data[0].split())
chairs = [FILLED for _ in range(n)]
for j in map(int, data[1].split()):
chairs[j-1] = EMPTY
for i, j in enumerate(map(int, data[2].split())):
... | 3.25 | 3 |
tests/test_base.py | tailhook/trafaret | 0 | 16428 | <gh_stars>0
# -*- coding: utf-8 -*-
import unittest
import trafaret as t
from collections import Mapping as AbcMapping
from trafaret import extract_error, ignore, DataError
from trafaret.extras import KeysSubset
class TestAnyTrafaret(unittest.TestCase):
def test_any(self):
self.assertEqual(
(t... | 2.734375 | 3 |
libdesktop/desktopfile.py | bharadwaj-raju/libdesktop | 12 | 16429 | <filename>libdesktop/desktopfile.py<gh_stars>10-100
# coding: utf-8
# This file is part of libdesktop
# The MIT License (MIT)
#
# Copyright (c) 2016 <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
#... | 2.3125 | 2 |
losses.py | abhinav-2912/Polyp-Segmentation | 0 | 16430 | <filename>losses.py
import os
import cv2
import keras
import numpy as np
import albumentations as A
import tensorflow as tf
from keras import backend as K
def jaccard_distance(y_true, y_pred, smooth=100):
intersection = K.sum(K.abs(y_true * y_pred), axis=-1)
sum_ = K.sum(K.abs(y_true) + K.abs(y_pred), axis=-1)... | 2.765625 | 3 |
opsramp/monitoring.py | gauravphagrehpe/python-opsramp | 6 | 16431 | <gh_stars>1-10
#!/usr/bin/env python
#
# A minimal Python language binding for the OpsRamp REST API.
#
# monitoring.py
# Classes related to monitoring templates and similar things.
#
# (c) Copyright 2019-2021 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... | 1.78125 | 2 |
tests/sources/doctest/load_test.py | akshitdewan/ok-client | 30 | 16432 | <filename>tests/sources/doctest/load_test.py
from client import exceptions as ex
from client.sources import doctest
from client.sources.doctest import models
import mock
import unittest
import os.path
class LoadTest(unittest.TestCase):
VALID_FILE = 'valid.py'
VALID_MODULE = os.path.splitext(VALID_FILE)[0]
... | 2.359375 | 2 |
lib/python3.8/site-packages/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_info.py | cjsteel/python3-venv-ansible-2.10.5 | 0 | 16433 | <filename>lib/python3.8/site-packages/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_info.py
#!/usr/bin/python
#
# Copyright (c) 2019 <NAME>, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, ... | 1.929688 | 2 |
process.py | seiferteric/readon | 0 | 16434 |
from rdflib import Graph
import json
import glob
books = {}
rdf_files = glob.glob("gutindex/cache/epub/*/*.rdf")
i = 1
for rdf_file in rdf_files:
g = Graph()
g.parse(rdf_file)
for s,p,o in g:
if 'title' in p:
books[str(o)] = str(s)
print(i, str(o))
i+=1
with open("g... | 2.5 | 2 |
qrand/caches/cache.py | LaurentAjdnik/qrand | 18 | 16435 | <filename>qrand/caches/cache.py<gh_stars>10-100
## _____ _____
## | __ \| __ \ AUTHOR: <NAME>
## | |__) | |__) | ---------------------------------
## | ___/| _ / DATE: May 18, 2021
## | | | | \ \ ---------------------------------
## |_| |_| \_\ https://github.com/pedrorrivero
##
... | 1.976563 | 2 |
logger/logger.py | BraunPhilipp/sentiment-analyzer | 4 | 16436 |
"""
Log multiple instances to same file.
"""
def log(msg):
f = open('error.log', 'a')
f.write(msg+'\n')
f.close()
def clear():
f = open('error.log', 'w')
f.write('')
f.close()
| 2.921875 | 3 |
Stream/TransportStream.py | SeuSQ/SimpleShark | 1 | 16437 | <filename>Stream/TransportStream.py<gh_stars>1-10
from Stream.Stream import Stream
class TransportStream(Stream):
"""
传输层流对象
代表一个传输层流,包含这个流中的所有数据包以及流的基本信息
protocol: 传输层的具体协议,UDP或TCP
side_a: A端IP地址(流的第一条报文的src)
side_b: B端IP地址(流的第一条报文的dst)
port_a: A端端口号
port_b: B端端口号
packets:流的报文列表
... | 2.9375 | 3 |
cea_calibration/validation.py | cooling-singapore/CalibCEA | 1 | 16438 | """
This tool compares measured data (observed) with model outputs (predicted), used in procedures of calibration and validation
"""
from __future__ import division
from __future__ import print_function
import os
from math import sqrt
import pandas as pd
from sklearn.metrics import mean_squared_error as calc_mean_squar... | 2.703125 | 3 |
apps/jobs/settings/config.py | rainydaygit/testtcloudserver | 349 | 16439 | <gh_stars>100-1000
try:
from public_config import *
except ImportError:
pass
HOST = '0.0.0.0'
PORT = 9038
SERVICE_NAME = 'jobs'
SERVER_ENV = 'prod'
SQLALCHEMY_POOL_SIZE = 10
SQLALCHEMY_POOL_RECYCLE = 3600
JOBS = [
{ # 任务 信用积分每日检查, 每周一到每周五 早上 10:30 分运行
# 检查每个设备的借用日期是否超时 :发送提醒邮件,扣除信用分 1分
... | 1.726563 | 2 |
exercieses/openInventory/mouseTrial.py | SimSam115/orsr_bbb | 0 | 16440 | <reponame>SimSam115/orsr_bbb<filename>exercieses/openInventory/mouseTrial.py
import pyautogui, pygetwindow, time
screen = pygetwindow.getWindowsWithTitle('Old School RuneScape')[0]
centerRatio = (2.8,2.8)
def move(direction,spaces):
vel = [0,0]
if direction == "up": vel[1] = 0.32;
if direction == "down... | 2.609375 | 3 |
cmake/make_geant4_env.py | hschwane/offline_production | 1 | 16441 | <reponame>hschwane/offline_production<gh_stars>1-10
#!/usr/bin/python
'''
Produces POSIX commands to setup the environment variables for Geant4.
Required command line arguments:
1: Location of geant4.sh script.
2: Version of Geant4.
'''
import os
import sys
import re
import subprocess as subp
from codecs import encod... | 2.34375 | 2 |
bin/run_server.py | syedwaseemjan/EXIFExtractor | 0 | 16442 | #! /usr/bin/env python
from __future__ import absolute_import
import os
import sys
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(PROJECT_DIR)
sys.path.append(os.path.abspath(os.path.join(PROJECT_DIR, "app")))
if __name__ == "__main__":
from app.main import Mai... | 2.3125 | 2 |
src/python/nimbusml/internal/core/feature_extraction/image/pixelextractor.py | justinormont/NimbusML-1 | 2 | 16443 | <reponame>justinormont/NimbusML-1
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# ... | 2.046875 | 2 |
leetcode/17.py | 1005281342/learn | 1 | 16444 | <gh_stars>1-10
#
# @lc app=leetcode.cn id=17 lang=python3
#
# [17] 电话号码的字母组合
#
# https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/description/
#
# algorithms
# Medium (47.70%)
# Total Accepted: 18K
# Total Submissions: 37.5K
# Testcase Example: '"23"'
#
# 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。
#
#... | 3.125 | 3 |
mujoco/setup1/re_split_demo.py | EvieQ01/Learning-Feasibility-Different-Dynamics | 0 | 16445 | <reponame>EvieQ01/Learning-Feasibility-Different-Dynamics<filename>mujoco/setup1/re_split_demo.py
import random
import argparse
from ast import Global
from dis import dis
from glob import glob
from itertools import count
from math import dist
from logger import *
import json
import gym
from matplotlib.pyplot import axi... | 2.09375 | 2 |
slicer/bin/Python/tpycl/tpycl.py | pabloduque0/WMH_AttGatedUnet_CustomLoss | 0 | 16446 | <reponame>pabloduque0/WMH_AttGatedUnet_CustomLoss<filename>slicer/bin/Python/tpycl/tpycl.py
#!/usr/bin/env python
#
# tpycl.py is the python support code to allow calling of python-wrapped
# vtk code from tcl scripts
#
# the main class is tpycl, and scripts can
#
import sys
import os
import Tkinter
from __main__ impo... | 2.0625 | 2 |
0171 [Easy] Hex to Bmp/script.py | jwthomson/dailyprogrammer | 0 | 16447 | <filename>0171 [Easy] Hex to Bmp/script.py<gh_stars>0
hex_strings = [
"FF 81 BD A5 A5 BD 81 FF",
"AA 55 AA 55 AA 55 AA 55",
"3E 7F FC F8 F8 FC 7F 3E",
"93 93 93 F3 F3 93 93 93",
]
def hex_data_to_image(hex_data):
for hex_pair in hex_data:
for divisor in reversed(range(len(hex_data))):
print("X" if ... | 3.15625 | 3 |
core/kryptos/scripts/strat.py | czr1803/kryptos | 45 | 16448 | import click
from kryptos.scripts import build_strategy, stress_worker, kill_strat
@click.group(name="strat")
def cli():
pass
cli.add_command(build_strategy.run, "build")
cli.add_command(stress_worker.run, "stress")
cli.add_command(kill_strat.run, "kill")
| 1.617188 | 2 |
scripts/album_times.py | TypicalFence/lainonlife | 48 | 16449 | #!/usr/bin/env python3
"""Radio scheduling program.
Usage:
album_times.py [--host=HOST] PORT
Options:
--host=HOST Hostname of MPD [default: localhost]
-h --help Show this text
Prints out the last scheduling time of every album.
"""
from datetime import datetime
from docopt import docopt
from mpd import M... | 3.375 | 3 |
pico-examples/usb/device/dev_lowlevel/dev_lowlevel_loopback.py | TheMindVirus/tinyusb | 0 | 16450 | #!/usr/bin/env python3
#
# Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# sudo pip3 install pyusb
import usb.core
import usb.util
# find our device
dev = usb.core.find(idVendor=0x0000, idProduct=0x0001)
# was it found?
if dev is None:
raise ValueE... | 2.34375 | 2 |
aiidalab_sssp/inspect/subwidgets/summary.py | aiidalab/aiidalab-sssp | 0 | 16451 | <filename>aiidalab_sssp/inspect/subwidgets/summary.py
import ipywidgets as ipw
import traitlets
from IPython.display import clear_output
class SummaryWidget(ipw.VBox):
"""output the convergence summary"""
selected_pseudos = traitlets.Dict(allow_none=True)
def __init__(self):
# Delta mesure
... | 2.09375 | 2 |
src/ska_pst_lmc/management/management_device.py | ska-telescope/ska-pst-lmc | 0 | 16452 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# This file is part of the SKA PST LMC project
#
# Distributed under the terms of the BSD 3-clause new license.
# See LICENSE for more info.
"""This module implements the PstManagement device."""
from __future__ import annotations
from typing import Optional
from ska_tango_base... | 2.125 | 2 |
change_mac_ip.py | Anon123-tech/WiFi_Pentest_Guide | 0 | 16453 | <filename>change_mac_ip.py
import sys,os
import argparse as arg
import nmap
import urllib2
parser = arg.ArgumentParser()
parser.add_argument("-a", "--address", help="IP address", required=True)
parser.add_argument("-i", "--interface", help="Interface", required=True)
argument = parser.parse_args()
def scan_(ip):
di... | 3.109375 | 3 |
cartografo/argument_parser.py | mendrugory/cartografo | 4 | 16454 | import argparse
from cartografo import DEFAULT_OBJECT, DEFAULT_TARGET
def __get_argparser():
__parser.add_argument('--k8s-object', help='Output Kubernetes objet: secrets or configmap')
__parser.add_argument('--target', help='Target file. If it exists, it will be modified')
__parser.add_argument('files_fo... | 2.5 | 2 |
Python_lxf/Python_Basic_Operation/Python_Basic/basicValueAndFunc/slice.py | QAlexBall/Learning_Py | 2 | 16455 | <gh_stars>1-10
L = ['michael', 'sarah', 'tracy', 'bob', 'jack']
# 取前N个元素
r = []
n = 3
for i in range(n):
r.append(L[i])
print(r)
# python提供slice操作符简化.
m = 0
print(L[m:n], L[:n], L[-n:-1])
L = list(range(100))
print(L[:10], '\r', L[-10:], '\r', L[10:20], '\r', L[:10:2], '\r', L[::5])
print((0, 1, 2, 3, 4, 5)[:3])
pri... | 3.515625 | 4 |
test/test_timematcher.py | magus0219/clockwork | 0 | 16456 | <gh_stars>0
'''
Created on Feb 17, 2014
@author: magus0219
'''
import unittest,datetime
from util.dateutil import DateUtil
from core.timematcher import TimeMatcher
from core.timepattern import TimePattern
class TimeMatcherTest(unittest.TestCase):
@unittest.expectedFailure
def testUnvaidValueNotInt(self):
... | 2.578125 | 3 |
pets/api/urls.py | tekodan/DaleLaPata | 1 | 16457 | <reponame>tekodan/DaleLaPata<filename>pets/api/urls.py
from django.conf.urls import url
from api import views
urlpatterns = [
url(r'^pets/$', views.ListPets.as_view(), name='list_pets'),
url(r'^cities/$', views.CityList.as_view(), name='city-list'),
url(r'^states/$', views.StateList.as_view(), name='state... | 1.742188 | 2 |
app-engine-utility-service/toggleIndex.py | isabella232/gov-meetings-made-searchable | 26 | 16458 | #!/usr/bin/env python
# This is not an officially supported Google product, though support
# will be provided on a best-effort basis.
# 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 co... | 1.984375 | 2 |
app.py | Jianghuchengphilip/Master-art-punk | 37 | 16459 | <reponame>Jianghuchengphilip/Master-art-punk<filename>app.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""=================================================
@Author :蒋虎成
@Date :2021/9/22 17:04
@Desc :主接口
=================================================="""
from colors import ColorMultiImage
import settings
from... | 2.4375 | 2 |
indivsims-dist.py | LohmuellerLab/Forward_Neanderthal | 3 | 16460 | <gh_stars>1-10
#! /usr/bin/env python
"""
usage: demoselsim.py outfilename popn h pct
"""
import numpy
import sys
def pnext(AC, N, Nout, h, s):
AC = float(AC); N = float(N); h = float(h); s = float(s)
p = AC/(2*N)
w11 = 1+s; w12 = 1+h*s; w22 = 1
wbar = ((p**2) * w11) + (2*p*(1-p)*w12) + (((1-p)**2) * w22)
pdet ... | 2.484375 | 2 |
core/modules.py | egecakmak/SAnD | 43 | 16461 | <reponame>egecakmak/SAnD<filename>core/modules.py
import math
import torch
import numpy as np
import torch.nn as nn
class PositionalEncoding(nn.Module):
def __init__(self, d_model, seq_len) -> None:
super(PositionalEncoding, self).__init__()
self.d_model = d_model
pe = torch.zeros(seq_le... | 2.40625 | 2 |
samcli/commands/local/cli_common/options.py | trenton/aws-sam-cli | 1 | 16462 | <reponame>trenton/aws-sam-cli
"""
Common CLI options for invoke command
"""
import click
from samcli.commands._utils.options import template_click_option, docker_click_options, parameter_override_click_option
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
def get_application_dir... | 2.171875 | 2 |
Leetcode/week_6/multi_threaded_merge_sort.py | SamSamhuns/wallbreakers_projekts | 1 | 16463 | import threading
def merge_sort(arr):
def _merge(arr1, arr2):
i, j = 0, 0
l1, l2 = len(arr1), len(arr2)
arr_sorted = [0] * (l1 + l2)
idx = 0
while i < l1 and j < l2:
if arr1[i] < arr2[j]:
arr_sorted[idx] = arr1[i]
i += 1
... | 3.78125 | 4 |
examples/reactjs-nodejs/deploy.py | py-mina-deploy/py-mina | 7 | 16464 | <filename>examples/reactjs-nodejs/deploy.py
"""
Deploy NodeJs application
https://github.com/react-boilerplate/react-boilerplate
"""
from py_mina import *
from py_mina.subtasks import git_clone, create_shared_paths, link_shared_paths, rollback_release
# Settings - shared
set('verbose', True)
set('shared_dirs', [... | 2.140625 | 2 |
altair_saver/savers/_saver.py | RoyalTS/altair_saver | 0 | 16465 | <reponame>RoyalTS/altair_saver
import abc
import json
from typing import Any, Dict, IO, Iterable, List, Optional, Union
import altair as alt
from altair_saver.types import Mimebundle, MimebundleContent, JSONDict
from altair_saver._utils import (
extract_format,
fmt_to_mimetype,
infer_mode_from_spec,
m... | 2.0625 | 2 |
tests/conftest.py | s0undt3ch/mommas-cookbook | 2 | 16466 | # Import our project so that our custom logging gets setup early enough
from __future__ import annotations
import mcookbook # noqa: F401 # pylint: disable=unused-import
| 1.109375 | 1 |
shoottikala/privileges.py | conikuvat/shootti-ilmo | 0 | 16467 | <reponame>conikuvat/shootti-ilmo
from .exceptions import AccessDenied
class AccessControlMixin(object):
def user_can_edit(self, user):
return (user.is_superuser or self.user == user)
def check_write_privileges(self, user):
if not self.user_can_edit(user):
raise AccessDenied()
... | 2.234375 | 2 |
scrape-scripts/co2-coalition.py | ClimateMisinformation/infrastructure | 0 | 16468 | import os
from bs4 import BeautifulSoup
import html2text
import pandas
data_dir = 'co2-coalition'
data_text_dir = os.path.join(data_dir, 'text')
data_file_name = 'co2-coalition.csv'
def make_file_name(index):
return f'{index:02d}'
def save_text(data_dir, file_path, content):
f = open(os.path.join(data_dir, file... | 2.984375 | 3 |
tareas/3/FranciscoRodrigo-SanchezBeatriz/common/random_proc.py | Miguelp-rez/sistop-2019-2 | 0 | 16469 | <gh_stars>0
import random
def rand_proc(num_proc):
procesos = []
for j in range(0,num_proc):
t_0 = random.randint(1,10+1)
t =random.randint(1,10+1)
procesos.append([j,t_0,t])
return procesos
| 2.671875 | 3 |
fooof/tests/test_analysis.py | anchandm/fooof | 1 | 16470 | """Test functions for FOOOF analysis."""
import numpy as np
from fooof.analysis import *
###################################################################################################
###################################################################################################
def test_get_band_peak_fm(t... | 2.375 | 2 |
dary_heap.py | fepz/AyCC | 0 | 16471 | import math
# The code is based on from http://www.cs.cmu.edu/~ckingsf/class/02713-s13/src/mst.py
# Heap item
class HeapItem(object):
"""Represents an item in the heap"""
def __init__(self, key, value):
self.key = key
self.pos = None
self.value = value
# d-ary Heap
cl... | 3.921875 | 4 |
S1c_Option2.py | tatytita20/TatianaOrtizG | 0 | 16472 | #!/usr/bin/env python
# coding: utf-8
# In[5]:
import cv2
import numpy as np
imagen = cv2.imread('wheel.png')
gray = cv2.cvtColor(imagen,cv2.COLOR_BGR2GRAY)
_,th = cv2.threshold(gray,100,255,cv2.THRESH_BINARY)
#Para versiones OpenCV3:
img1,contornos1,hierarchy1 = cv2.findContours(th, cv2.RETR_EXTERNAL,cv2.CHAIN_AP... | 3.046875 | 3 |
PythonFSDAM/combine_works.py | MauriceKarrenbrock/PythonFSDAM | 0 | 16473 | <reponame>MauriceKarrenbrock/PythonFSDAM
# -*- coding: utf-8 -*-
#############################################################
# Copyright (c) 2020-2021 <NAME> #
# #
# This software is open-source and is distributed under the #
# BSD 3-Clause "New"... | 2.4375 | 2 |
modules/pointrnn_cell_impl.py | hehefan/PointRNN-PyTorch | 35 | 16474 | <reponame>hehefan/PointRNN-PyTorch<filename>modules/pointrnn_cell_impl.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
import pointnet2_utils
import pytorch_utils as pt_utils
from typing import ... | 2.46875 | 2 |
rssplus/forms.py | Davidhw/infocatch | 0 | 16475 | from django import forms
class URLForm(forms.Form):
siteUrl = forms.CharField(label='Website Address', max_length=100,required=True)
'''
javascriptChoices = ((2,"Keep Javascript",),(1,"Remove Some Javascript"),(0,"Remove All Javascript"))
keepJavascript = forms.ChoiceField(choices=javascriptChoices,label="... | 2.234375 | 2 |
wsgi.py | FlexMeasures/flexmeasures | 12 | 16476 | from flexmeasures.app import create as create_app
application = create_app()
| 1.234375 | 1 |
mbus/MBusAddress.py | droid4control/python-mbus | 23 | 16477 | <reponame>droid4control/python-mbus<filename>mbus/MBusAddress.py
from ctypes import Structure, Union, c_int, c_byte, c_char_p
# Inner union
class MBusAddressInternal(Union):
_fields_ = [
('primary', c_int),
('secondary', c_char_p),
]
class MBusAddress(Structure):
_fields_ =... | 2.640625 | 3 |
settings_template.py | Pierre-Thibault/memberCardGenerator | 2 | 16478 | <filename>settings_template.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# Copy this file and renamed it settings.py and change the values for your own project
# The csv file containing the information about the member.
# There is three columns: The name, the email and the member type: 0 regular, 1 life time
CSV_FILE = "... | 2.078125 | 2 |
korea_client_prospect.py | DataFinnovation/api-demos-python | 1 | 16479 | <filename>korea_client_prospect.py
"""the names of companies which filed fields with certain words in them"""
from df_wrappers import facts_stringquery
def main():
"""example code lives in one function"""
# this one is easier in the script language
query_string = """
filingsource:"Korea FSS" AND
... | 3.390625 | 3 |
libs/CacheSimulator.py | architecture-helper/architecture-helper-python | 2 | 16480 | DEBUG = False
from typing import List, Tuple
class LRU:
_values:List
_lastIndex:int
def __init__(self, ways):
#values = 3,2,1,0, so the cache will use 0 as the first
self._values = list(range(ways-1,-1,-1))
self._lastIndex = ways -1
def getLeastRecentlyUsed(self):
ret... | 3.234375 | 3 |
src/db_triggers.py | serong/saypy | 0 | 16481 | <reponame>serong/saypy
"""
db_triggers.py
~~~~~~~~~~~~~~
:aciklama:
Veritabanina veri girisi ve gerekli triggerlar icin
:yazar: github.com/serong
"""
import sqlite3
import db as saydb
class SayisalDBT(object):
def __init__(self, week, the_date, numbers):
self.db_name = "sayisal... | 2.53125 | 3 |
phathom/utils.py | chunglabmit/phathom | 1 | 16482 | <filename>phathom/utils.py<gh_stars>1-10
import contextlib
import os
import pickle
import numpy as np
from itertools import product, starmap
import multiprocessing
import tqdm
import sys
if sys.platform.startswith("linux"):
is_linux = True
import tempfile
else:
is_linux = False
import mmap
# import pyi... | 2.75 | 3 |
ys_code/src/skin_mb/data/diff_abun.py | sverbanic/ps2-npjBM | 0 | 16483 | <reponame>sverbanic/ps2-npjBM
from .result import Result
import numpy as np
import pandas as pd
class DiffAbunRes(Result):
def __init__(self, otu_table, transform_pipe=None, percent=False, **kwargs):
super().__init__()
self.pre_vs_skin = diff_rel_abun(otu_table, compare='pre_vs_skin', transform_... | 2.265625 | 2 |
while.py | egriswol/astr-119-hw-1 | 0 | 16484 | <gh_stars>0
i = 0
while (i<119):
print(i)
i+=10
| 2.4375 | 2 |
coremltools/test/neural_network/test_graph_passes.py | domcorvasce/coremltools | 65 | 16485 | import numpy as np
import unittest
import coremltools.models.datatypes as datatypes
from coremltools.models import neural_network as neural_network
from coremltools.models import MLModel
from coremltools.models.neural_network.printer import print_network_spec
from coremltools.converters.nnssa.coreml.graph_pass.mlmodel_... | 2.453125 | 2 |
accounting_tech/migrations/0018_auto_20190403_1456.py | Tim-Ilin/asup_corp_site | 0 | 16486 | # Generated by Django 2.1.7 on 2019-04-03 11:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounting_tech', '0017_auto_20190403_1434'),
]
operations = [
migrations.AlterField(
model_nam... | 1.390625 | 1 |
tests/bgzip_test.py | Swiffers/puretabix | 1 | 16487 | <gh_stars>1-10
from puretabix import get_bgzip_lines_parallel
class TestBlockGZip:
def test_get_lines(self, vcf_filename, vcf_gz):
lines = tuple(sorted(map(bytes.decode, vcf_gz.readlines())))
lines_parsed = tuple(sorted(get_bgzip_lines_parallel(vcf_filename)))
for line_in, line_out in zip... | 2.453125 | 2 |
setup.py | Eawag-SWW/datapool_client | 0 | 16488 | <filename>setup.py
from setuptools import find_packages, setup
setup(
name="datapool_client",
version="1.0",
description="Designed to access the datapool software developed by ETH Zurich - SIS and Eawag. "
"Find out more under https://datapool.readthedocs.io/en/latest/.",
author="<NAME>... | 1.398438 | 1 |
mandaw/examples/window.py | mandaw2014/MandawEngineSDL | 0 | 16489 | from mandaw import *
mandaw = Mandaw("Window!", width = 800, height = 600, bg_color = (0, 0, 0, 255))
mandaw.loop() | 2.1875 | 2 |
bio-info/bio-info5.py | kyamada101/Python | 0 | 16490 | <filename>bio-info/bio-info5.py<gh_stars>0
import numpy as np
with open("./dice.txt",'r') as f:
input_str = f.read()
input_data=list(map(int,input_str))
inf = -float('inf')
class box():
def __init__(self):
self.v = inf
self.root = -1
def __repr__(self):
return str(self.v)
def... | 2.65625 | 3 |
src/tests/scheduling/schedule_config_test.py | Ket3r/script-server | 0 | 16491 | from unittest import TestCase
from parameterized import parameterized
from scheduling.schedule_config import ScheduleConfig
from utils import date_utils
def to_datetime(short_datetime_string):
dt_string = short_datetime_string + ':0.000000Z'
return date_utils.parse_iso_datetime(dt_string.replace(' ', 'T'))
... | 2.5625 | 3 |
mojo/python/tests/bindings_constants_unittest.py | zbowling/mojo | 1 | 16492 | <filename>mojo/python/tests/bindings_constants_unittest.py
# Copyright 2014 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 math
import unittest
# Generated files
# pylint: disable=F0401
import sample_service_mojom... | 1.835938 | 2 |
home/pi/blissflixx/lib/chanutils/chanutils.py | erick-guerra/Royalbox | 1 | 16493 | import requests, lxml.html, re
import htmlentitydefs, urllib, random
from lxml.cssselect import CSSSelector
from StringIO import StringIO
import cherrypy
import requests
from cachecontrol import CacheControl
_PROXY_LIST = None
_HEADERS = {
'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*... | 2.125 | 2 |
test/07-text-custom-field-list-test.py | hklarner/couchdb-mango | 39 | 16494 | # 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, software
# distributed under the ... | 2.5625 | 3 |
tests/test_reviews_rest.py | miw-upm/betca-tpv-customer-support | 1 | 16495 | from http import HTTPStatus
from unittest import TestCase, mock
import jwt
from fastapi.testclient import TestClient
from src.api.review_resource import REVIEWS
from src.config import config
from src.main import app
from src.models.article import Article
from src.models.review import Review
def _bearer(**payload):
... | 2.515625 | 3 |
python/dset/write_dataset_W1BS.py | spongezhang/vlb | 11 | 16496 | import json
sequence_name_list = ['A','G','L','map2photo','S']
description_list = ['Viewpoint Appearance','Viewpoint','ViewPoint Lighting','Map to Photo','Modality']
label_list = [
['arch', 'obama', 'vprice0', 'vprice1', 'vprice2', 'yosemite'],
['adam', 'boat','ExtremeZoomA','face','fox','graf','mag','... | 2.171875 | 2 |
salman.py | Fayad-hub/Fayad-hub | 0 | 16497 | <gh_stars>0
<html> salman.py
<html/>
| 0.980469 | 1 |
broadcast.py | InukaRanmira/Image-to-pdf | 1 | 16498 | <filename>broadcast.py<gh_stars>1-10
from pyrogram import Client ,filters
import os
from helper.database import getid
ADMIN = int(os.environ.get("ADMIN", 1696230986))
@Client.on_message(filters.private & filters.user(ADMIN) & filters.command(["broadcast"]))
async def broadcast(bot, message):
if (message.reply_to_mes... | 2.28125 | 2 |
scripts/calibration/cal_methods.py | jielyugt/calibration | 0 | 16499 | <reponame>jielyugt/calibration
# Calibration methods including Histogram Binning and Temperature Scaling
import numpy as np
from scipy.optimize import minimize
from sklearn.metrics import log_loss
import pandas as pd
import time
from sklearn.metrics import log_loss, brier_score_loss
from tensorflow.keras.losses impor... | 2.609375 | 3 |