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 |
|---|---|---|---|---|---|---|
brownie_fund_me/scripts/fund_and_withdraw.py | WangCHEN9/solidity_demos | 0 | 1200 | from brownie import FundMe
from scripts.helpful_scripts import get_account
def fund():
fund_me = FundMe[-1]
account = get_account()
entrance_fee = fund_me.getEntranceFee()
print(f"entrance is {entrance_fee}")
print("funding..")
fund_me.fund({"from": account, "value": entrance_fee})
def withd... | 2.671875 | 3 |
ex019.py | jefernathan/Python | 0 | 1201 | # Um professor quer sortear um dos seus quatro alunos para apagar o quadro. Faça um programa que ajude ele, lendo o nome dos alunos e escrevendo na tela o nome do escolhido.
from random import choice
nome1 = input('Digite um nome: ')
nome2 = input('Digite outro nome: ')
nome3 = input('Digite mais um nome: ')
nome4 = ... | 3.875 | 4 |
contacts/admin.py | liviamendes/agenda-django-project | 0 | 1202 | <filename>contacts/admin.py
from django.contrib import admin
from .models import Categoria, Contact
class ContactAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'last_name', 'phone', 'email', 'creation_date', 'categoria', 'show')
list_display_links = ('id', 'name', 'last_name')
list_filter = ('cate... | 1.921875 | 2 |
upload_from_folder.py | robinrobinzon/fastpic | 0 | 1203 | import datetime
import os
import shutil
import tempfile
from joblib import Parallel, delayed
from fastpic_upload import upload_file_to_fastpic
_n_jobs_for_upload = 20
_root_folders_set = (
'/path/to/folder',
)
_spoiler_for_each_file = True
def process_one_pic(result_key, pic_path, tmp_dir):
pic_url, pic_l... | 2.59375 | 3 |
tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/clip_segmentation_mask.py | TolyaTalamanov/open_model_zoo | 2,201 | 1204 | <gh_stars>1000+
"""
Copyright (c) 2018-2022 Intel Corporation
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 ... | 2.0625 | 2 |
tests/test_utils.py | isabella232/pynacl | 756 | 1205 | <filename>tests/test_utils.py
# Copyright 2013 <NAME> and individual contributors
#
# 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 req... | 2 | 2 |
Solutions/6kyu/6kyu_mister_safetys_treasure.py | citrok25/Codewars-1 | 46 | 1206 | def unlock(m):
return m.lower().translate(
str.maketrans(
'abcdefghijklmnopqrstuvwxyz',
'22233344455566677778889999'
)
)
| 1.882813 | 2 |
guesstheword.py | Cha0sNation/RandomPython | 0 | 1207 | #! /home/cha0snation/anaconda3/bin/python
import random
def setup():
words = ["banana", "apple", "orange", "peach", "grape", "watermelon"]
output = []
word = words[random.randint(0, len(words) - 1)]
playing = True
tries = 5
return [words, output, word, tries, playing]
def check_finished(out... | 4.03125 | 4 |
web_app/index.py | svakulenk0/ArtDATIS | 0 | 1208 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Dec 8, 2019
.. codeauthor: <NAME>
<<EMAIL>>
Index docs into ES
https://qbox.io/blog/building-an-elasticsearch-index-with-python
'''
from settings import *
import glob
import re
# n first characters for the doc preview
LIMIT_START = 100
txts_path = '%s... | 2.828125 | 3 |
src/tokens.py | PythonIsMagic/ponyup | 1 | 1209 | """
A Token is a button or other object on the table that represents a position, a game state, layer state, or some other piece of info
"""
class Token(object):
def __init__(self, name, table):
self.table = table
self.name = name
self.seat = None
| 2.96875 | 3 |
T05-09/program.py | maa76/SSof-Project1920 | 2 | 1210 | <filename>T05-09/program.py<gh_stars>1-10
nis=get('nis')
q1="xpto1"
q2=nis + "xpto2"
query=query1.q2
koneksi=0
q=execute(query,koneksi)
| 1.523438 | 2 |
Chapter09/interpolation_search.py | Xiangs18/Algorithms-with-Python-Second-Edition | 0 | 1211 | def nearest_mid(input_list, lower_bound_index, upper_bound_index, search_value):
return lower_bound_index + (
(upper_bound_index - lower_bound_index)
// (input_list[upper_bound_index] - input_list[lower_bound_index])
) * (search_value - input_list[lower_bound_index])
def interpolation_search(o... | 3.828125 | 4 |
projects/models.py | javixeneize/asvs-1 | 1 | 1212 | from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
from django.urls import reverse
class ProjectQuerySet(models.QuerySet):
def projects_per_user(self, user):
return self.filter(
Q(project_owner=user.username)
)
class Projects(model... | 2.28125 | 2 |
tests/serverless/checks/aws/test_AdminPolicyDocument.py | peaudecastor/checkov | 0 | 1213 | import os
import unittest
from checkov.serverless.checks.function.aws.AdminPolicyDocument import check
from checkov.serverless.runner import Runner
from checkov.runner_filter import RunnerFilter
class TestAdminPolicyDocument(unittest.TestCase):
def test_summary(self):
runner = Runner()
current_di... | 2.25 | 2 |
src/macro_pack.py | lulinsheng/macro_pack | 0 | 1214 | #!/usr/bin/python3
# encoding: utf-8
import os
import sys
import getopt
import logging
import shutil
import psutil
from modules.com_run import ComGenerator
from modules.web_server import ListenServer
from modules.Wlisten_server import WListenServer
from modules.payload_builder_factory import PayloadBuilderFactory
from... | 1.59375 | 2 |
faced/const.py | binhmuc/faced | 0 | 1215 | <reponame>binhmuc/faced
import os
MODELS_PATH = os.path.join(os.path.dirname(__file__), "models")
YOLO_SIZE = 288
YOLO_TARGET = 9
CORRECTOR_SIZE = 50
| 1.382813 | 1 |
etl/load/elasticsearch.py | bilalelhoudaigui/plant-brapi-etl-data-lookup-gnpis | 3 | 1216 | <reponame>bilalelhoudaigui/plant-brapi-etl-data-lookup-gnpis
# Load json bulk files into elasticsearch
import json
import os
import time
import traceback
import elasticsearch
from etl.common.store import list_entity_files
from etl.common.utils import get_folder_path, get_file_path, create_logger, first, replace_templ... | 2.09375 | 2 |
geoplot/crs.py | redfrexx/geoplot | 0 | 1217 | """
This module defines the ``geoplot`` coordinate reference system classes, wrappers on
``cartopy.crs`` objects meant to be used as parameters to the ``projection`` parameter of all
front-end ``geoplot`` outputs. For the list of Cartopy CRS objects this module derives from,
refer to http://scitools.org.uk/cartopy/docs... | 2.71875 | 3 |
api/views/stores/att_handler.py | cderwin/maps | 0 | 1218 | from .default_handler import StoresHandler
class ATTStoresHandler(StoresHandler):
def handle_request(self, **kwargs):
kwargs.update({'provider': 'att'})
return super(ATTStoresHandler, self).handle_request(**kwargs)
def get_url(self, **kwargs):
lat = float(kwargs.get('lat'))
lo... | 2.609375 | 3 |
pythonProject/MUNDO 2/Desafio 54.py | lucasjlgc/Aulas-de-Python- | 0 | 1219 | #Leia o ano de nascimento de 7 pessoas e mostre quantas ja atingiram a maioridade e quantas ainda não
for c in range(1,8):
p=int(input('Qual o ano de seu nascimento? '))
a=2021-p
if a>= 18:
print('A pessoa numero {} já é maior de idade'.format(c))
else:
print('A pessoa numero {} não é... | 3.859375 | 4 |
tmoga/utils/SDE.py | zjg540066169/tmoga | 2 | 1220 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Provide function to calculate SDE distance
@auth: <NAME>
@date: 2021/05/05
"""
def SDE(front, values1, values2):
shifted_dict = {}
for i in front:
shifted_dict[i] = [(values1[i], values2[i])]
shifted_list = []
for j in front:
... | 3.171875 | 3 |
a1.py | pscly/shua_shouji | 0 | 1221 | <filename>a1.py
# -*- encoding=utf8 -*-
__author__ = "pscly"
from airtest.core.api import *
from airtest.cli.parser import cli_setup
# from douyin import *
if not cli_setup():
auto_setup(__file__, logdir=True, devices=[
"android://127.0.0.1:5037/decc8da3?cap_method=MINICAP_STREAM&&ori_method=MINICAPOR... | 1.867188 | 2 |
tests/v3_validation/cattlevalidationtest/core/test_logs_api.py | bmdepesa/validation-tests | 7 | 1222 | from common_fixtures import * # NOQA
import websocket as ws
import pytest
def get_logs(client):
hosts = client.list_host(kind='docker', removed_null=True)
assert len(hosts) > 0
in_log = random_str()
cmd = '/bin/bash -c "echo {}; sleep 2"'.format(in_log)
c = client.create_container(image=TEST_IMAG... | 1.90625 | 2 |
models/psg_seed_resnet.py | VITA-Group/Peek-a-Boo | 2 | 1223 | '''ResNet using PSG in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
from numpy.lib.arraysetops import isin
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
... | 2.71875 | 3 |
drybell/drybell_lfs_spark.py | jsnlp/snorkel-tutorials | 315 | 1224 | <filename>drybell/drybell_lfs_spark.py
from pyspark.sql import Row
from snorkel.labeling.lf import labeling_function
from snorkel.labeling.lf.nlp_spark import spark_nlp_labeling_function
from snorkel.preprocess import preprocessor
from drybell_lfs import load_celebrity_knowledge_base
ABSTAIN = -1
NEGATIVE = 0
POSITIV... | 2.578125 | 3 |
dreamplace/ops/dct/discrete_spectral_transform.py | dongleecsu/DREAMPlace | 12 | 1225 | <gh_stars>10-100
##
# @file discrete_spectral_transform.py
# @author <NAME>
# @date Jun 2018
#
import os
import sys
import numpy as np
import torch
import torch.nn.functional as F
import pdb
""" Discrete spectral transformation leveraging fast fourier transform engine.
The math here mainly uses Prosthaphaeresis p... | 2.484375 | 2 |
py/testdir_multi_jvm/test_many_fp_formats_libsvm_2.py | vkuznet/h2o | 0 | 1226 | <reponame>vkuznet/h2o
import unittest, random, sys, time
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e, h2o_glm
import h2o_util
zeroList = [
'Result0 = 0',
]
# the first column should use this
exprList = [
'Result<n> = sum(<keyX>[... | 2.125 | 2 |
python/influx/database_tables.py | SA-22C-smoothswing/spectrum-protect-sppmon | 0 | 1227 | <filename>python/influx/database_tables.py
"""Provides all database and table structures used for the influx database.
Classes:
Datatype
Database
Table
RetentionPolicy
"""
from __future__ import annotations
from enum import Enum, unique
import re
import json
from typing import Any, Dict, List, Set, Tup... | 3.046875 | 3 |
examples/rpc_server_side.py | calendar42/SleekXMPP--XEP-0080- | 1 | 1228 | <gh_stars>1-10
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 <NAME>
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.plugins.xep_0009.remote import Endpoint, remote, Remote, \
ANY_ALL
import threading
class Thermostat(Endpoint):
... | 1.859375 | 2 |
lib/TelloAPI.py | wuhuikai/DeepDrone | 1 | 1229 | import cv2
import time
import socket
import threading
class Response(object):
def __init__(self):
pass
def recv(self, data):
pass
def pop(self):
pass
def empty(self):
pass
class Command(Response):
def __init__(self):
super(Command, self).__init__()
... | 3.1875 | 3 |
terrascript/resource/sematext.py | mjuenema/python-terrascript | 507 | 1230 | <filename>terrascript/resource/sematext.py
# terrascript/resource/sematext.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:26:36 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.resource.sematext
#
# instead of
#
# >>> import terrascript.resource.sematext.sematext
#
# This i... | 1.21875 | 1 |
eval_encoder.py | lithium0003/Image2UTF8-Transformer | 0 | 1231 | #!/usr/bin/env python3
import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU')
try:
tf.config.experimental.set_memory_growth(physical_devices[0], True)
except:
# Invalid device or cannot modify virtual devices once initialized.
pass
import numpy as np
import os, time, csv
import ... | 2.0625 | 2 |
clipper_admin/clipper_admin/clipper_admin.py | SimonZsx/clipper | 2 | 1232 | from __future__ import absolute_import, division, print_function
import logging
import docker
import tempfile
import requests
from requests.exceptions import RequestException
import json
import pprint
import time
import re
import os
import tarfile
import sys
from cloudpickle import CloudPickler
import pickle
import num... | 1.59375 | 2 |
graph.py | VaniSHadow/tpGenerator | 0 | 1233 | import random
import numpy
import copy
class Graph:
"""n表示图中点的个数,m表示图中边的个数"""
def __init__(self, n, m, edge_weight=1, directed=True, connected='weak', loop=False, weighted=False, trim=True):
"""
n 图中点的个数
m 图中边的个数
edge_weight 边的权值上限
directed 有向性
connected 连通性
loop 有环性
weighted 带权性
trim ... | 3.15625 | 3 |
csv2googlesheets/to_google_sheets.py | AlexSkrn/csv2googlesheets | 0 | 1234 | <filename>csv2googlesheets/to_google_sheets.py
"""This module provides a console interface to convert CSV to Google Sheets."""
from csv2googlesheets.gapi_authorization import auth_with_google
from csv2googlesheets.gapi_create_sheet import create_sheet
from csv2googlesheets.gapi_write_to_sheet import write_to_sheet
fr... | 3.140625 | 3 |
netforce_account/netforce_account/migrations/credit_remain_cur.py | nfco/netforce | 27 | 1235 | <reponame>nfco/netforce<gh_stars>10-100
from netforce.model import get_model
from netforce import migration
from netforce import database
class Migration(migration.Migration):
_name="account.credit_remain_cur"
_version="2.5.0"
def migrate(self):
db=database.get_connection()
db.execute("UPD... | 2.4375 | 2 |
chevah/compat/testing/testcase.py | chevah/compat | 5 | 1236 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2011 <NAME>.
# See LICENSE for details.
"""
TestCase used for Chevah project.
"""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from six import text_type
from six.moves import range
import contextlib
im... | 2 | 2 |
web/snowflake.py | jphacks/C_2118 | 0 | 1237 | <gh_stars>0
import time
class Snowflake:
def __init__(self, init_serial_no=0):
self.machine_id = 0
self.epoch = 0
self.serial_no = init_serial_no
def generate(self):
unique_id = (
((int(time.time() * 1000) - self.epoch) & 0x1FFFFFFFFFF) << 22
| (self.ma... | 2.59375 | 3 |
src/metarl/tf/plotter/__init__.py | icml2020submission6857/metarl | 2 | 1238 | from metarl.tf.plotter.plotter import Plotter
__all__ = ['Plotter']
| 1.148438 | 1 |
generative_deep_learning/build_network.py | slaily/deep-learning-bits | 0 | 1239 | from keras import layers
# Single-layer LSTM model for next-character prediction
model = keras.models.Sequential()
model.add(layers.LSTM(128, input_shape=(maxlen, len(chars))))
model.add(layers.Dense(len(chars), activation='softmax'))
# Model compilation configuration
optimizer = keras.optimizers.RMSprop(lr=0.01)
mod... | 3.28125 | 3 |
tests/test_structure_learning.py | thunderbug1/pyanom | 0 | 1240 | <gh_stars>0
import io
import unittest
import numpy as np
class TestGraphicalLasso(unittest.TestCase):
"""Basic test cases."""
def _getTarget(self):
from pyanom.structure_learning import GraphicalLasso
return GraphicalLasso
def _makeOne(self, *args, **kwargs):
return self._getTar... | 2.453125 | 2 |
examples/MDF/states.py | 29riyasaxena/MDF | 12 | 1241 | """
Example of ModECI MDF - Testing state variables
"""
from modeci_mdf.mdf import *
import sys
def main():
mod = Model(id="States")
mod_graph = Graph(id="state_example")
mod.graphs.append(mod_graph)
## Counter node
counter_node = Node(id="counter_node")
p1 = Parameter(id="increment", v... | 2.359375 | 2 |
gremlin-python/src/main/jython/tests/driver/test_client.py | jseekamp/tinkerpop | 1 | 1242 | <filename>gremlin-python/src/main/jython/tests/driver/test_client.py
'''
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 t... | 2.015625 | 2 |
gaia_tools/xmatch/__init__.py | henrysky/gaia_tools | 44 | 1243 | <reponame>henrysky/gaia_tools
# Tools for cross-matching catalogs
import csv
import sys
import os
import os.path
import platform
import shutil
import subprocess
import tempfile
import warnings
WIN32= platform.system() == 'Windows'
import numpy
import astropy.coordinates as acoords
from astropy.table import Table
from ... | 2.265625 | 2 |
rllib/agents/dqn/dqn_torch_policy.py | ThomasLecat/ray | 0 | 1244 | <reponame>ThomasLecat/ray
from typing import Dict, List, Tuple
import gym
import ray
from ray.rllib.agents.a3c.a3c_torch_policy import apply_grad_clipping
from ray.rllib.agents.dqn.dqn_tf_policy import (
PRIO_WEIGHTS, Q_SCOPE, Q_TARGET_SCOPE, postprocess_nstep_and_prio)
from ray.rllib.agents.dqn.dqn_torch_model im... | 1.921875 | 2 |
formfyxer/__init__.py | SuffolkLITLab/FormFyxer | 1 | 1245 | from .lit_explorer import *
from .pdf_wrangling import *
| 1.007813 | 1 |
Overview/11 - funktsioonid.py | priidupaomets/python_kursus | 1 | 1246 | <reponame>priidupaomets/python_kursus<gh_stars>1-10
"""
funktsioonid.py
Funktsioonide ja protseduuride kasutamine
"""
#
# Protseduur
#
def minu_funktsioon():
print("See on protseduur")
# Kutsume funktsiooni välja
minu_funktsioon()
#
# Funktsioon
#
def liida(num1, num2):
return num1 + num2
sum = liida(3, 5... | 3.25 | 3 |
tests/integration/states/test_cmd.py | l2ol33rt/salt | 0 | 1247 | # -*- coding: utf-8 -*-
'''
Tests for the file state
'''
# Import python libs
from __future__ import absolute_import
import errno
import os
import textwrap
import tempfile
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.paths import TMP_STATE_TREE
from tests.support.mixins impor... | 2.15625 | 2 |
mars/tensor/execution/datastore.py | ChenQuan/mars | 0 | 1248 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 1.726563 | 2 |
fastgc/model/mlp.py | ppmlguy/fastgradclip | 2 | 1249 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
from fastgc.model.penet import PeGradNet
from fastgc.layers.linear import Linear
from fastgc.activation import activation
class MLP(PeGradNet):
def __init__(self, input_size, hidden_sizes, output_size, act_func='sigmoid',
... | 2.90625 | 3 |
05-Environments/hw02/hw02/hw02.py | ericchen12377/CS61A_LearningDoc | 2 | 1250 | """ Homework 2: Higher Order Functions"""
HW_SOURCE_FILE = 'hw02.py'
from operator import add, mul, sub
square = lambda x: x * x
identity = lambda x: x
triple = lambda x: 3 * x
increment = lambda x: x + 1
######################
# Required Questions #
######################
def product(n, f):
"""Return the pr... | 4.5625 | 5 |
test_vector_handlers/src/awses_test_vectors/manifests/full_message/decrypt_generation.py | farleyb-amazon/aws-encryption-sdk-python | 95 | 1251 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | 1.554688 | 2 |
acceptance/test/TestStartStopFeature.py | ismacaulay/qtcwatchdog | 0 | 1252 | from acceptance.harness.acceptance_test import WatchdogAcceptanceTest
class TestStartStopFeature(WatchdogAcceptanceTest):
def test_willStartObserverWhenWatchdogStarted(self):
self.create_and_start_watchdog()
self.assertTrue(self.fs_observer.running)
def test_willStopObserverWhenWatchdogStop... | 2.03125 | 2 |
neural_spline_flows/nde/transforms/transform_test.py | VincentStimper/nsf | 0 | 1253 | import torch
import torchtestcase
from neural_spline_flows.nde.transforms import base
class TransformTest(torchtestcase.TorchTestCase):
"""Base test for all transforms."""
def assert_tensor_is_good(self, tensor, shape=None):
self.assertIsInstance(tensor, torch.Tensor)
self.assertFalse(torch.... | 2.546875 | 3 |
directory-traversal/validate-file-extension-null-byte-bypass.py | brandonaltermatt/penetration-testing-scripts | 0 | 1254 | <filename>directory-traversal/validate-file-extension-null-byte-bypass.py
"""
https://portswigger.net/web-security/file-path-traversal/lab-validate-file-extension-null-byte-bypass
"""
import sys
import requests
site = sys.argv[1]
if 'https://' in site:
site = site.rstrip('/').lstrip('https://')
url = f'''https:/... | 2.859375 | 3 |
atmpro1_vsm2.py | joselynzhao/One-shot-Person-Re-ID-ATM | 3 | 1255 | <reponame>joselynzhao/One-shot-Person-Re-ID-ATM<gh_stars>1-10
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
# @Time : 2020/9/3 上午11:03
# @Author : Joselynzhao
# @Email : <EMAIL>
# @File : atmpro1_vsm2.py
# @Software: PyCharm
# @Desc :
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
# @Time : 2020/9/1 下午7:07... | 2.09375 | 2 |
consumer/tests/test__index_handler.py | eHealthAfrica/aether-elasticsearch-consumer | 0 | 1256 | <filename>consumer/tests/test__index_handler.py<gh_stars>0
# Copyright (C) 2019 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may no... | 1.664063 | 2 |
plans/config.py | datopian/plans | 3 | 1257 | import os
database_url = os.environ.get('DATABASE_URL')
| 1.359375 | 1 |
Assignment Day 2 .py | ShubhamKahlon57/Letsupgrade-python-Batch-7 | 0 | 1258 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#List and function
# In[6]:
# empty list
my_list = []
# list of integers
my_list = [1, 2, 3]
# list with mixed data types
my_list = [1, "Hello", 3.4]
# In[7]:
# nested list
my_list = ["mouse", [8, 4, 6], ['a']]
# In[11]:
# List indexing
my_list = ['p', '... | 4.53125 | 5 |
hackerrank/pickingNumbers.py | irvandindaprakoso/online-test-py | 0 | 1259 | def pickingNumbers(a):
# Write your code here
max = 0
for i in a:
c = a.count(i)
d = a.count(i-1)
e = c+d
if e>max:
max = e
return max
| 3.25 | 3 |
tests/test_api_transaction.py | preston-wagner/authorizesauce | 0 | 1260 | from datetime import date
from six import BytesIO, binary_type, u
from six.moves.urllib.parse import parse_qsl, urlencode
from unittest2 import TestCase
import mock
from authorizesauce.apis.transaction import PROD_URL, TEST_URL, TransactionAPI
from authorizesauce.data import Address, CreditCard
from authorizesauce.e... | 2.21875 | 2 |
build_json.py | sungpyocho/covid19-aichi-tools | 0 | 1261 | <reponame>sungpyocho/covid19-aichi-tools
import csv
import io
import json
import pandas as pd
import sys
from dateutil import tz
from datetime import datetime, date, time, timedelta
# Japan Standard Time (UTC + 09:00)
JST = tz.gettz('Asia/Tokyo')
JST_current_time = datetime.now(tz=JST).strftime('%Y/%m/%d %H:%M')
pat... | 2.671875 | 3 |
dl/models/ssd/modules/utils.py | jjjkkkjjj/pytorch.dl | 2 | 1262 | import torch
from ....data.utils.boxes import centroids2corners, iou
def matching_strategy(targets, dboxes, **kwargs):
"""
:param targets: Tensor, shape is (batch*object num(batch), 1+4+class_labels)
:param dboxes: shape is (default boxes num, 4)
IMPORTANT: Note that means (cx, cy, w, h)
:param kw... | 2.265625 | 2 |
sandroad.py | lancelee82/bluelake | 0 | 1263 | """
Flatpath, go forward forever.
http://codeincomplete.com/posts/javascript-racer/
http://www.extentofthejam.com/pseudo/
http://pixel.garoux.net/screen/game_list
Usage:
* UP/DOWN/LEFT/RIGHT
* SPACE : hide/show road map
* TAB : replay this road
* RETURN : go to a new road
TODO:
* hill road
* more road sprites
* soun... | 2.75 | 3 |
First_course/test5_base.py | laetrid/learning | 0 | 1264 | <reponame>laetrid/learning<filename>First_course/test5_base.py
#!/usr/bin/env python
sw1_show_cdp_neighbors = '''
SW1>show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID ... | 2.09375 | 2 |
scipy/optimize/_numdiff.py | jeremiedbb/scipy | 1 | 1265 | """Routines for numerical differentiation."""
from __future__ import division
import numpy as np
from numpy.linalg import norm
from scipy.sparse.linalg import LinearOperator
from ..sparse import issparse, csc_matrix, csr_matrix, coo_matrix, find
from ._group_columns import group_dense, group_sparse
EPS = np.finfo(n... | 2.890625 | 3 |
tests/models/test_hparams.py | abhinavg97/pytorch-lightning | 1 | 1266 | # Copyright The PyTorch Lightning team.
#
# 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 i... | 2.046875 | 2 |
tests/space_test.py | hadrianmontes/jax-md | 713 | 1267 | <reponame>hadrianmontes/jax-md<gh_stars>100-1000
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | 1.898438 | 2 |
functions/batch-custom-action/status-api/lambda.py | TrollPursePublishing/trollpurse-trollops | 2 | 1268 | <filename>functions/batch-custom-action/status-api/lambda.py
import boto3
batch_client = boto3.client('batch')
def lambda_handler(event, context):
describe_response = batch_client.describe_jobs(
jobs=[ event.get('jobId', '')]
)
return describe_response.get('jobs', [{}])[0].get('status', '')
| 2.09375 | 2 |
app/auth/views.py | ifaraag/app | 0 | 1269 | <reponame>ifaraag/app<filename>app/auth/views.py<gh_stars>0
from flask import Blueprint, render_template, redirect, url_for, request, flash
from flask.ext.login import login_required, login_user, logout_user
from werkzeug import check_password_hash, generate_password_hash
from app import db, login_manager, pubnub, app... | 2.265625 | 2 |
economist/migrations/0003_auto_20170406_1402.py | xingjianpan/news_reader_backend | 1 | 1270 | <filename>economist/migrations/0003_auto_20170406_1402.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-06 06:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('economist', '0002_auto_20170406_11... | 1.640625 | 2 |
test/test_ethereum.py | coinplus-sa/coinplus-solo | 1 | 1271 | import unittest
from coinplus_solo_redeem.common import wif_export_bitcoin, compute_public_key_sec256k1, address_from_publickey_ethereum
class TestEthereum(unittest.TestCase):
"""test of the bitcoin conversion from private key to wif"""
def setUp(self):
self.test_add_vector = [("03cb3e5f30245658e1e3615... | 2.65625 | 3 |
python97/chapter05/list_gen.py | youaresherlock/PythonPractice | 0 | 1272 | #!usr/bin/python
# -*- coding:utf8 -*-
# 列表生成式(列表推导式)
# 1. 提取出1-20之间的奇数
# odd_list = []
# for i in range(21):
# if i % 2 == 1:
# odd_list.append(i)
# odd_list = [i for i in range(21) if i % 2 == 1]
# print(odd_list)
# 2. 逻辑复杂的情况 如果是奇数将结果平方
# 列表生成式性能高于列表操作
def handle_item(item):
return item * item
odd... | 4.0625 | 4 |
src/streamlink/plugin/plugin.py | isqad/streamlink | 1 | 1273 | import ast
import operator
import re
from collections import OrderedDict
from functools import partial
from ..cache import Cache
from ..exceptions import PluginError, NoStreamsError
from ..options import Options
# FIXME: This is a crude attempt at making a bitrate's
# weight end up similar to the weight of a resolut... | 2.40625 | 2 |
tests/cli/conftest.py | Aahbree/reference-data-repository | 0 | 1274 | # This file is part of the Reference Data Repository (refdata).
#
# Copyright (C) 2021 New York University.
#
# refdata is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Fixtures for testing the command-line interface."""
import os
i... | 1.953125 | 2 |
swav/vissl/vissl/data/ssl_transforms/img_patches_tensor.py | lhoestq/DeDLOC | 0 | 1275 | <filename>swav/vissl/vissl/data/ssl_transforms/img_patches_tensor.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import math
from typing import Any, Dict
import numpy as np
from classy_vision.dataset.transforms import register_transform
from classy_vision.dataset.transforms.c... | 2.3125 | 2 |
python/jittor/utils/publish.py | Jittor/Jittor | 4 | 1276 | #!/usr/bin/python3
# ***************************************************************
# Copyright (c) 2022 Jittor. All Rights Reserved.
# Maintainers:
# <NAME> <<EMAIL>>.
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ***********... | 1.882813 | 2 |
prodapt_solutions/config/cliargs.py | DineshDevaraj/interview_answers | 0 | 1277 | <gh_stars>0
import argparse
from helper.metaclasses_definition import Singleton
class CliArgs(metaclass=Singleton):
LogLevel = None
BankName = None
InputFilepath = None
@staticmethod
def init():
my_parser = argparse.ArgumentParser()
my_parser.add_argument('--bank-name', require... | 2.515625 | 3 |
plugins/flytekit-papermill/setup.py | TeoZosa/flytekit | 0 | 1278 | from setuptools import setup
PLUGIN_NAME = "papermill"
microlib_name = f"flytekitplugins-{PLUGIN_NAME}"
plugin_requires = [
"flytekit>=0.16.0b0,<1.0.0",
"flytekitplugins-spark>=0.16.0b0,<1.0.0,!=0.24.0b0",
"papermill>=1.2.0",
"nbconvert>=6.0.7",
"ipykernel>=5.0.0",
]
__version__ = "0.0.0+develop... | 1.304688 | 1 |
2017/third.py | vla3089/adventofcode | 0 | 1279 | #!/usr/bin/env python
input = 368078
size = 1
s_size = size * size # squared size
while (s_size < input):
size += 2
s_size = size * size
bottom_right = s_size
bottom_left = s_size - size + 1
top_left = s_size - 2 * size + 2
top_right = s_size - 3 * size + 3
input_x = -1
input_y = -1
# bottom horizontal lin... | 3.21875 | 3 |
racer/methods/genetic_programming/parameterized.py | max-eth/racer | 1 | 1280 | <filename>racer/methods/genetic_programming/parameterized.py<gh_stars>1-10
import copy
import numpy as np
from racer.utils import load_pickle
from racer.methods.genetic_programming.program_tree import ProgramTree
class ParameterizedTree(ProgramTree):
# This makes the assumption that all children of the underlying... | 2.609375 | 3 |
base/frontends/views.py | danielecook/upvote.pub | 1 | 1281 | <reponame>danielecook/upvote.pub
# -*- coding: utf-8 -*-
"""
"""
import os
import markdown2
from flask import (Blueprint,
request,
render_template,
flash, g,
session,
redirect,
url_for,
a... | 2.296875 | 2 |
Jarvis.py | vijayeshmt/Securitylock | 1 | 1282 | import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import os
import smtplib
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
# To change the voice to female change 0 to 1.
def speak(au... | 3.453125 | 3 |
clients/kratos/python/test/test_v0alpha1_api.py | kolotaev/sdk | 0 | 1283 | """
Ory Kratos API
Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the admini... | 2.140625 | 2 |
osrsapi/__init__.py | XaKingas/osrsapi | 0 | 1284 | from .grandexchange import GrandExchange, GameItemNotFound, GameItemParseError
from .item import Item
from .priceinfo import PriceInfo
from .pricetrend import PriceTrend
| 1.25 | 1 |
utils/data_loader.py | dilum1995/DAugmentor | 1 | 1285 | <gh_stars>1-10
import pandas as pd
import os
import numpy as np
import cv2
from utils import constants as const
import matplotlib.pyplot as plt
class DataLoader:
def load_data():
'''
This function is handling the data loading and pre-processing
:return: (xtrain, ytrain), (xtest, ytest)
... | 3.203125 | 3 |
CompilerPython/LexerPython/main.py | valternunez/Compiler | 0 | 1286 | <filename>CompilerPython/LexerPython/main.py
from lexer import *
import sys
if len(sys.argv) != 2:
print("usage: main.py file")
else:
lex = Lexer(sys.argv[1])
with open(sys.argv[1]) as f:
while True:
c = f.read(1)
if not c:
break
print(lex.scan()... | 2.984375 | 3 |
cms/tests/test_views.py | Ibrahem3amer/bala7 | 0 | 1287 | <reponame>Ibrahem3amer/bala7<filename>cms/tests/test_views.py
from django.core.urlresolvers import resolve
from django.urls import reverse
from django.test import TestCase, RequestFactory
from django.http import HttpRequest, Http404
from django.contrib.auth.models import User
from unittest import skip
from users.models... | 2.390625 | 2 |
3D/Train_Module_3D.py | geometatqueens/RCNN | 1 | 1288 | """The present code is the Version 1.0 of the RCNN approach to perform MPS
in 3D for categorical variables. It has been developed by <NAME> and <NAME> in the
Geometallurygical Group at Queen's University as part of a PhD program.
The code is not free of bugs but running end-to-end.
Any comments and further improv... | 2.484375 | 2 |
feature_flags_project/feature_flags/providers.py | steuke/django_feature_flags_example | 0 | 1289 | import logging
from typing import Dict
from django.http import HttpRequest
logger = logging.getLogger(__name__)
class FeatureFlagProvider:
def is_feature_enabled(self, feature_name: str, user_id: str = None, attributes: Dict = None):
raise NotImplementedError("You must override FeatureFlagProvider.is_fe... | 2.34375 | 2 |
src/app/database/__init__.py | roch1990/aiohttp-blog | 20 | 1290 | <gh_stars>10-100
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base() | 1.1875 | 1 |
src/plottoolbox/functions/kde.py | timcera/plottoolbox | 0 | 1291 | <filename>src/plottoolbox/functions/kde.py
# -*- coding: utf-8 -*-
"""Collection of functions for the manipulation of time series."""
from __future__ import absolute_import, division, print_function
import itertools
import os
import warnings
import mando
import numpy as np
import pandas as pd
from mando.rst_text_for... | 2.09375 | 2 |
src/models/GNN.py | 3verlyn/DL-abstract-argumentation | 6 | 1292 | from collections import OrderedDict
import torch
import torch.nn as nn
from torch_geometric.data.batch import Batch
class GNN(nn.Module):
def __init__(self, mp_steps, **config):
super().__init__()
self.mp_steps = mp_steps
self.update_fns = self.assign_update_fns()
self.readout_fns... | 2.34375 | 2 |
configs/baselines/DACN/GNN/GCN_res_layer.py | vivek-r-2000/BoundaryNet | 17 | 1293 | <reponame>vivek-r-2000/BoundaryNet<gh_stars>10-100
import math
import torch
import torch.nn as nn
from torch.nn.modules.module import Module
from GNN.GCN_layer import GraphConvolution
class GraphResConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init_... | 2.8125 | 3 |
mtools/util/logfile.py | lukasvosyka/mtools | 0 | 1294 | <gh_stars>0
#!/usr/bin/env python3
from __future__ import print_function
import os
import re
import sys
from datetime import datetime
from math import ceil
from mtools.util.input_source import InputSource
from mtools.util.logevent import LogEvent
class LogFile(InputSource):
"""Log file wrapper class. Handles o... | 2.140625 | 2 |
tests/svg.py | Tillsten/pyqtgraph | 0 | 1295 | """
SVG export test
"""
import test
import pyqtgraph as pg
app = pg.mkQApp()
class SVGTest(test.TestCase):
#def test_plotscene(self):
#pg.setConfigOption('foreground', (0,0,0))
#w = pg.GraphicsWindow()
#w.show()
#p1 = w.addPlot()
#p2 = w.addPlot()
#p1.plot([1... | 2.5625 | 3 |
src/api/models/enums/apschedulerevents.py | jedicontributors/pythondataintegrator | 14 | 1296 | <gh_stars>10-100
EVENT_SCHEDULER_STARTED = EVENT_SCHEDULER_START = 2 ** 0
EVENT_SCHEDULER_SHUTDOWN = 2 ** 1
EVENT_SCHEDULER_PAUSED = 2 ** 2
EVENT_SCHEDULER_RESUMED = 2 ** 3
EVENT_EXECUTOR_ADDED = 2 ** 4
EVENT_EXECUTOR_REMOVED = 2 ** 5
EVENT_JOBSTORE_ADDED = 2 ** 6
EVENT_JOBSTORE_REMOVED = 2 ** 7
EVENT_ALL_JOBS_REMOVED ... | 1.164063 | 1 |
scripts/build/build/targets.py | mrninhvn/matter | 2 | 1297 | <filename>scripts/build/build/targets.py
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | 1.234375 | 1 |
src/musegan/data.py | TRINITRONIC/musegan | 0 | 1298 | """This file contains functions for loading and preprocessing pianoroll data.
"""
import logging
import numpy as np
import tensorflow.compat.v1 as tf
from musegan.config import SHUFFLE_BUFFER_SIZE, PREFETCH_SIZE
LOGGER = logging.getLogger(__name__)
# --- Data loader ----------------------------------------------------... | 2.859375 | 3 |
Python/hello-world-pt-BR.py | PushpneetSingh/Hello-world | 1,428 | 1299 | print(u"Ol<NAME>!") | 1.390625 | 1 |