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 |
|---|---|---|---|---|---|---|
test/dialect/mssql/test_compiler.py | gujun4990/sqlalchemy | 1 | 1000 | # -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from... | 2.296875 | 2 |
sdk/python/pulumi_kubernetes/coordination/v1/_inputs.py | polivbr/pulumi-kubernetes | 277 | 1001 | <reponame>polivbr/pulumi-kubernetes
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... ... | 2.125 | 2 |
Components/Align All Components.py | davidtahim/Glyphs-Scripts | 1 | 1002 | <reponame>davidtahim/Glyphs-Scripts<filename>Components/Align All Components.py
#MenuTitle: Align All Components
# -*- coding: utf-8 -*-
__doc__="""
Fakes auto-alignment in glyphs that cannot be auto-aligned.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # a... | 2.328125 | 2 |
SC101Lecture_code/SC101_week4/draw_basic.py | Jewel-Hong/SC-projects | 0 | 1003 | <gh_stars>0
#!/usr/bin/env python3
"""
Stanford CS106AP
TK Drawing Lecture Exercises
Courtesy of <NAME>
"""
import tkinter as tk
# provided function, this code is complete
def make_canvas(width, height):
"""
Creates and returns a drawing canvas
of the given int size, ready for drawing.
"""
top =... | 4.03125 | 4 |
audio/audio_server.py | artigianitecnologici/marrtino_apps | 0 | 1004 | <reponame>artigianitecnologici/marrtino_apps<gh_stars>0
# Only PCM 16 bit wav 44100 Hz - Use audacity or sox to convert audio files.
# WAV generation
# Synth
# sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bip.wav synth 0.25 sine 800
# sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wa... | 2.359375 | 2 |
torchvision/datasets/kinetics.py | sh1doy/vision | 0 | 1005 | from .video_utils import VideoClips
from .utils import list_dir
from .folder import make_dataset
from .vision import VisionDataset
class Kinetics400(VisionDataset):
"""
`Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_
dataset.
Kinetics-400 is an action recogn... | 3.015625 | 3 |
venv/lib/python2.7/site-packages/sphinx/builders/qthelp.py | CharleyFarley/ovvio | 0 | 1006 | <reponame>CharleyFarley/ovvio<gh_stars>0
# -*- coding: utf-8 -*-
"""
sphinx.builders.qthelp
~~~~~~~~~~~~~~~~~~~~~~
Build input files for the Qt collection generator.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
im... | 1.59375 | 2 |
scripts/scrape_sciencedirect_urls.py | UWPRG/BETO2020 | 4 | 1007 | """
This code is used to scrape ScienceDirect of publication urls and write them to
a text file in the current directory for later use.
"""
import selenium
from selenium import webdriver
import numpy as np
import pandas as pd
import bs4
from bs4 import BeautifulSoup
import time
from sklearn.utils import shuffle
def s... | 3.515625 | 4 |
superset/typing.py | GodelTech/superset | 7 | 1008 | <filename>superset/typing.py<gh_stars>1-10
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, V... | 1.835938 | 2 |
log_system_information.py | ibaiGorordo/depthai | 476 | 1009 | #!/usr/bin/env python3
import json
import platform
def make_sys_report(anonymous=False, skipUsb=False, skipPackages=False):
def get_usb():
try:
import usb.core
except ImportError:
yield "NoLib"
return
speeds = ["Unknown", "Low", "Full", "High", "Super",... | 2.375 | 2 |
patch.py | silverhikari/romtools | 5 | 1010 | """
Utils for creating xdelta patches.
"""
import logging
from subprocess import check_output, CalledProcessError
from shutil import copyfile
from os import remove, path
class PatchChecksumError(Exception):
def __init__(self, message, errors):
super(PatchChecksumError, self).__init__(message)
class Patc... | 2.71875 | 3 |
enigma.py | fewieden/Enigma-Machine | 1 | 1011 | from rotor import Rotor
import sys
import getopt
class Enigma:
def __init__(self, key, rotors):
self.key = list(key)
self.rotors = []
for i in range(0, len(rotors)):
self.rotors.append(Rotor(self.key[i], rotors[i]))
def encrypt(self, word):
cipher = ''
for ... | 3.328125 | 3 |
andersoncd/group.py | idc9/andersoncd | 0 | 1012 | <gh_stars>0
import time
import numpy as np
from scipy import sparse
from numba import njit
from numpy.linalg import norm
from scipy.sparse.linalg import svds
from andersoncd.lasso import dual_lasso
def primal_grp(R, w, alpha, grp_size):
return (0.5 * norm(R) ** 2 + alpha *
norm(w.reshape(-1, grp_siz... | 2.296875 | 2 |
textattack/search_methods/greedy_word_swap_wir.py | dheerajrav/TextAttack | 0 | 1013 | """
Greedy Word Swap with Word Importance Ranking
===================================================
When WIR method is set to ``unk``, this is a reimplementation of the search
method from the paper: Is BERT Really Robust?
A Strong Baseline for Natural Language Attack on Text Classification and
Entailment by Jin et... | 3.484375 | 3 |
lemur/deployment/service.py | rajatsharma94/lemur | 1,656 | 1014 | from lemur import database
def rotate_certificate(endpoint, new_cert):
"""
Rotates a certificate on a given endpoint.
:param endpoint:
:param new_cert:
:return:
"""
# ensure that certificate is available for rotation
endpoint.source.plugin.update_endpoint(endpoint, new_cert)
endpo... | 2.65625 | 3 |
pype/celery.py | h2020-westlife-eu/VRE | 1 | 1015 | # coding: utf-8
# Copyright Luna Technology 2015
# <NAME> <<EMAIL>>
from __future__ import absolute_import
import os
from celery import Celery
# Set the default Django settings module for the 'celery' program
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pype.settings')
from django.conf import settings
from ce... | 1.953125 | 2 |
train/general_train_example/1_parse.py | ss433s/sosweety | 0 | 1016 | <reponame>ss433s/sosweety<gh_stars>0
import os, sys
import json
# 获取当前路径, 通过anchor文件获取项目root路径
this_file_path = os.path.split(os.path.realpath(__file__))[0]
this_path = this_file_path
root_path = this_file_path
while this_path:
if os.path.exists(os.path.join(this_path, 'sosweety_root_anchor.py')):
... | 2.359375 | 2 |
ruleex/hypinv/model.py | rohancode/ruleex_modified | 18 | 1017 | from gtrain import Model
import numpy as np
import tensorflow as tf
class NetForHypinv(Model):
"""
Implementaion of the crutial function for the HypINV algorithm.
Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv
"""
def __init__(self, weights):
self... | 2.671875 | 3 |
py_tdlib/constructors/get_chat_member.py | Mr-TelegramBot/python-tdlib | 24 | 1018 | from ..factory import Method
class getChatMember(Method):
chat_id = None # type: "int53"
user_id = None # type: "int32"
| 1.796875 | 2 |
src/phrase_manager/phrase_manager.py | Franco7Scala/GeneratingNaturalLanguageAdversarialExamplesThroughParticleFiltering | 0 | 1019 | import numpy
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from src.support import support
class PhraseManager:
def __init__(self, configuration):
self.train_phrases, self.train_labels = self._read_train_phrases()
self.test_phrases, self.test_labels = se... | 2.796875 | 3 |
setup.py | fonar/paypalhttp_python | 0 | 1020 | from setuptools import setup
version = "1.0.0"
long_description = """
PayPalHttp is a generic http client designed to be used with code-generated projects.
"""
setup(
name="paypalhttp",
long_description=long_description,
version=version,
author="PayPal",
packages=["paypalhttp", "paypalhttp/testu... | 1.4375 | 1 |
ooobuild/csslo/xml/__init__.py | Amourspirit/ooo_uno_tmpl | 0 | 1021 | <reponame>Amourspirit/ooo_uno_tmpl<filename>ooobuild/csslo/xml/__init__.py
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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
#
# h... | 1.054688 | 1 |
bluebottle/tasks/migrations/0012_merge.py | terrameijar/bluebottle | 10 | 1022 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-09-27 15:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0011_auto_20160919_1508'),
('tasks', '0011_auto_20160920_1019'),
]
operatio... | 1.359375 | 1 |
bat_train/evaluate.py | bgotthold-usgs/batdetect | 59 | 1023 | import numpy as np
from sklearn.metrics import roc_curve, auc
def compute_error_auc(op_str, gt, pred, prob):
# classification error
pred_int = (pred > prob).astype(np.int)
class_acc = (pred_int == gt).mean() * 100.0
# ROC - area under curve
fpr, tpr, thresholds = roc_curve(gt, pred)
roc_auc ... | 2.296875 | 2 |
azure-mgmt/tests/test_mgmt_network.py | SUSE/azure-sdk-for-python | 2 | 1024 | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... | 2 | 2 |
Networks/Threading/server.py | polbebe/PinkPanther | 0 | 1025 | import gym
import gym.spaces as spaces
import sys
import socket
from _thread import *
import os
import numpy as np
import pandas as pd
import math as m
import time
import random
class NetEnv(gym.Env):
def __init__(self):
# Robot State values that will be bounced with client
self.robot_state = None
self.p... | 2.71875 | 3 |
backend/app/app/db/session.py | zhkuo24/full-stack-fastapi-demo | 7 | 1026 | <reponame>zhkuo24/full-stack-fastapi-demo<gh_stars>1-10
# -*- coding: utf-8 -*-
# @File : session.py
# @Author : zhkuo
# @Time : 2021/1/3 9:12 下午
# @Desc :
from sqlalchemy import create_engine
# from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from app.core.config import settin... | 2.09375 | 2 |
src/tkdialog/dialog.py | KosukeMizuno/tkdialog | 0 | 1027 | <reponame>KosukeMizuno/tkdialog
from pathlib import Path
import pickle
import tkinter as tk
import tkinter.filedialog
def open_dialog(**opt):
"""Parameters
----------
Options will be passed to `tkinter.filedialog.askopenfilename`.
See also tkinter's document.
Followings are example of frequently u... | 3.484375 | 3 |
cinder/tests/unit/fake_group_snapshot.py | lightsey/cinder | 571 | 1028 | <filename>cinder/tests/unit/fake_group_snapshot.py
# Copyright 2016 EMC 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/LICE... | 1.992188 | 2 |
src/tree_visualizer.py | szymanskir/msi | 0 | 1029 | <gh_stars>0
import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
def display_resolution_tree(resolution_tree: nx.classes.DiGraph):
_draw_resolution_tree_(resolution_tree)
plt.show()
def _draw_resolution_tree_(tree: nx.classes.DiGraph, enable_edge_label... | 2.5625 | 3 |
setup.py | SilicalNZ/canvas | 7 | 1030 | <filename>setup.py
import setuptools
setuptools.setup(
name = 'sili-canvas',
version = '0.0.1',
license = 'MIT',
url = 'https://github.com/SilicalNZ/canvas',
description = 'A series of easy to use classes to perform complex 2D array transformations',
long_description = '',
author = 'Silica... | 1.101563 | 1 |
tests/viz_tests.py | theoretical-olive/incubator-superset | 2 | 1031 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1.617188 | 2 |
chord_sim/modules/taskqueue.py | ryogrid/FunnelKVS | 8 | 1032 | # coding:utf-8
from typing import Dict, List, Optional, cast, TYPE_CHECKING
from .chord_util import ChordUtil, InternalControlFlowException, NodeIsDownedExceptiopn
if TYPE_CHECKING:
from .chord_node import ChordNode
class TaskQueue:
JOIN_PARTIAL = "join_partial"
def __init__(self, existing_node : 'Chor... | 2.5 | 2 |
surname_rnn/surname/containers.py | sudarshan85/nlpbook | 0 | 1033 | #!/usr/bin/env python
import pandas as pd
from pathlib import Path
from torch.utils.data import DataLoader
class ModelContainer(object):
def __init__(self, model, optimizer, loss_fn, scheduler=None):
self.model = model
self.optimizer = optimizer
self.loss_fn = loss_fn
self.scheduler = scheduler
cl... | 2.515625 | 3 |
AudioLib/__init__.py | yNeshy/voice-change | 11 | 1034 | <reponame>yNeshy/voice-change
from AudioLib.AudioEffect import AudioEffect
| 0.96875 | 1 |
programs/buck_logging.py | lakshmi2005/buck | 1 | 1035 | #!/usr/bin/env python
from __future__ import print_function
import logging
import os
def setup_logging():
# Set log level of the messages to show.
level_name = os.environ.get('BUCK_WRAPPER_LOG_LEVEL', 'INFO')
level_name_to_level = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
... | 2.484375 | 2 |
CONTENT/DS-n-Algos/ALGO/__PYTHON/celeb.py | Web-Dev-Collaborative/DS-ALGO-OFFICIAL | 11 | 1036 | <reponame>Web-Dev-Collaborative/DS-ALGO-OFFICIAL<gh_stars>10-100
def orangesRotting(elemnts):
if not elemnts or len(elemnts) == 0:
return 0
n = len(elemnts)
m = len(elemnts[0])
rotten = []
for i in range(n):
for j in range(m):
if elemnts[i][j] == 2:
... | 3.109375 | 3 |
official/cv/c3d/src/c3d_model.py | leelige/mindspore | 77 | 1037 | <gh_stars>10-100
# Copyright 2021 Huawei Technologies Co., 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-2.0
#
# Unless required by applicable... | 1.953125 | 2 |
blmath/geometry/apex.py | metabolize/blmath | 6 | 1038 | <filename>blmath/geometry/apex.py
import numpy as np
from blmath.numerics import vx
def apex(points, axis):
'''
Find the most extreme point in the direction of the axis provided.
axis: A vector, which is an 3x1 np.array.
'''
coords_on_axis = points.dot(axis)
return points[np.argmax(coords_on_... | 3.34375 | 3 |
examples/client/main.py | TheFarGG/Discode | 3 | 1039 | <filename>examples/client/main.py<gh_stars>1-10
import os
import discode
TOKEN = os.environ.get("TOKEN")
# The token from the developer portal.
client = discode.Client(token=TOKEN, intents=discode.Intents.default())
@client.on_event("ready")
async def on_ready():
print(client.user, "is ready!")
# The ready l... | 2.890625 | 3 |
timm/models/layers/__init__.py | kkahatapitiya/pytorch-image-models | 0 | 1040 | <reponame>kkahatapitiya/pytorch-image-models<filename>timm/models/layers/__init__.py
from .activations import *
from .adaptive_avgmax_pool import \
adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d
from .blur_pool import BlurPool2d
from .classifier import ClassifierHead, cre... | 1.460938 | 1 |
riccipy/metrics/bondi_2.py | cjayross/riccipy | 4 | 1041 | """
Name: Bondi
References: Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964)
Coordinates: Spherical
Symmetry: Spherical
Notes: Outgoing Coordinates
"""
from sympy import Function, diag, sin, symbols
coords = symbols("r v theta phi", real=True)
variables = ()
functions = symbols("C M", cls=Function)
r, v, th, ph = co... | 2.5625 | 3 |
cfgov/ask_cfpb/tests/test_views.py | atuggle/cfgov-refresh | 0 | 1042 | from __future__ import unicode_literals
import json
from django.apps import apps
from django.core.urlresolvers import NoReverseMatch, reverse
from django.http import Http404, HttpRequest, QueryDict
from django.test import TestCase, override_settings
from django.utils import timezone
from wagtail.wagtailcore.models i... | 1.835938 | 2 |
setup.py | bcongdon/instapaper-to-sqlite | 1 | 1043 | import os
from setuptools import setup
VERSION = "0.2"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="instapaper-to-sqlite",
description="Save data from In... | 1.820313 | 2 |
pybm/commands/compare.py | nicholasjng/pybm | 12 | 1044 | from typing import List
from pybm import PybmConfig
from pybm.command import CLICommand
from pybm.config import get_reporter_class
from pybm.exceptions import PybmError
from pybm.reporters import BaseReporter
from pybm.status_codes import ERROR, SUCCESS
from pybm.util.path import get_subdirs
class CompareCommand(CLI... | 2.28125 | 2 |
dddm/recoil_rates/halo.py | JoranAngevaare/dddm | 0 | 1045 | """
For a given detector get a WIMPrate for a given detector (not taking into
account any detector effects
"""
import numericalunits as nu
import wimprates as wr
import dddm
export, __all__ = dddm.exporter()
@export
class SHM:
"""
class used to pass a halo model to the rate computation
must cont... | 3.046875 | 3 |
picket/rvae/train_eval_models.py | rekords-uw/Picket | 10 | 1046 | <filename>picket/rvae/train_eval_models.py<gh_stars>1-10
#!/usr/bin/env python3
import torch
from torch import optim
import torch.nn.functional as F
import argparse
from sklearn.metrics import mean_squared_error
import numpy as np
import json
from . import utils
from .model_utils import get_pi_exact_vec, rnn_vae_for... | 1.992188 | 2 |
setup.py | nopipifish/bert4keras | 1 | 1047 | <gh_stars>1-10
#! -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='bert4keras',
version='0.8.4',
description='an elegant bert4keras',
long_description='bert4keras: https://github.com/bojone/bert4keras',
license='Apache License 2.0',
url='https://github.com/bojone/... | 1.171875 | 1 |
sztuczna_inteligencja/3-lab/backtrackingSolve.py | Magikis/Uniwersity | 12 | 1048 | <reponame>Magikis/Uniwersity
# import cProfile
# import pstats
# import io
from picture import *
# pr = cProfile.Profile()
# pr.enable()
def out(p):
for i in range(2):
print([len(x) for x in p.perms[i]])
if __name__ == '__main__':
p = Picture()
p.genPerms()
p.detuctAll()
p.backtrackLoop... | 2.328125 | 2 |
benchmark/generate_examples_strprose.py | HALOCORE/SynGuar | 1 | 1049 | # imports
import os
import json
import subprocess
abs_join = lambda p1, p2 : os.path.abspath(os.path.join(p1, p2))
# constants
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
SEED_RELPATH = "./strprose/example_files/_seeds.json"
SEED_FULLPATH = abs_join(SCRIPT_DIR, SEED_RELPATH)
SEED_INFO = None
with open(SEE... | 2.0625 | 2 |
mmtbx/regression/tls/tst_u_tls_vs_u_ens_03.py | rimmartin/cctbx_project | 0 | 1050 | from __future__ import division
from mmtbx.tls import tools
import math
import time
pdb_str_1 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C
"""... | 2.203125 | 2 |
elliesite/context_processors.py | davidkartuzinski/ellieplatformsite | 1 | 1051 | import sys
from django.urls import resolve
def global_vars(request):
return {
'GLOBAL_TWITTER_ACCOUNT': '@open_apprentice',
'ORGANIZATION_NAME': 'Open Apprentice Foundation',
'ORGANIZATION_WEBSITE': 'https://openapprentice.org',
'ORGANIZATION_LOGO': '/static/img/ellie/open-apprenti... | 1.914063 | 2 |
tools/train_net_step.py | va1shn9v/Detectron.pytorch | 0 | 1052 | """ Training script for steps_with_decay policy"""
import argparse
import os
import sys
import pickle
import resource
import traceback
import logging
from collections import defaultdict
import numpy as np
import yaml
import torch
from torch.autograd import Variable
import torch.nn as nn
import cv2
cv2.setNumThreads(0... | 2.046875 | 2 |
Lib/site-packages/astroid/brain/brain_numpy_core_multiarray.py | punithmadaiahkumar/try-django | 4 | 1053 | # Copyright (c) 2019-2020 hippo91 <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
"""Astr... | 2.046875 | 2 |
tests/asp/weakConstraints/testcase13.bug.weakconstraints.gringo.test.py | bernardocuteri/wasp | 19 | 1054 | <filename>tests/asp/weakConstraints/testcase13.bug.weakconstraints.gringo.test.py
input = """
2 18 3 0 3 19 20 21
1 1 1 0 18
2 23 3 0 3 19 24 25
1 1 2 1 21 23
3 5 21 19 20 24 25 0 0
6 0 5 5 21 19 20 24 25 1 1 1 1 1
0
21 a
19 b
20 c
24 d
25 e
28 f
0
B+
0
B-
1
0
1
"""
output = """
COST 1@1
"""
| 1.484375 | 1 |
whoPay.py | susurigirl/susuri | 0 | 1055 | <reponame>susurigirl/susuri
import random
names_string = input("내기를 할 친구들의 이름을 적습니다. 콤마(,)로 분리해서 적습니다.\n")
names = names_string.split(",")
print(names)
n = random.randint(0, len(names))
print(f"오늘 커피는 {names[n]}가 쏩니다!")
| 3.328125 | 3 |
jp.atcoder/abc056/arc070_b/26725094.py | kagemeka/atcoder-submissions | 1 | 1056 | import sys
import typing
import numpy as np
def solve(a: np.ndarray, k: int) -> typing.NoReturn:
n = len(a)
def compute_dp(a: np.ndarray) -> np.ndarray:
dp = np.zeros((n + 1, k), np.bool8)
dp[0, 0] = True
for i in range(n):
dp[i + 1] = dp[i].copy()
... | 2.578125 | 3 |
MicroPython_BUILD/components/micropython/esp32/modules_examples/mqtt_example.py | FlorianPoot/MicroPython_ESP32_psRAM_LoBo | 838 | 1057 | import network
def conncb(task):
print("[{}] Connected".format(task))
def disconncb(task):
print("[{}] Disconnected".format(task))
def subscb(task):
print("[{}] Subscribed".format(task))
def pubcb(pub):
print("[{}] Published: {}".format(pub[0], pub[1]))
def datacb(msg):
print("[{}] Data arrived... | 2.625 | 3 |
mlb/game/migrations/0009_game_game_type.py | atadams/mlb | 0 | 1058 | <filename>mlb/game/migrations/0009_game_game_type.py
# Generated by Django 2.2.8 on 2019-12-14 19:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0008_auto_20191214_1019'),
]
operations = [
migrations.AddField(
mo... | 1.929688 | 2 |
backend/main/chapters/c06_lists.py | Vman45/futurecoder | 0 | 1059 | # flake8: NOQA E501
import ast
import random
from textwrap import dedent
from typing import List
from main.exercises import generate_list, generate_string
from main.text import ExerciseStep, MessageStep, Page, Step, VerbatimStep, search_ast
from main.utils import returns_stdout
class IntroducingLists(Page):
clas... | 4.375 | 4 |
redisSeed.py | bigmacd/miscPython | 0 | 1060 | <filename>redisSeed.py
import time
import redis
import json
import argparse
""" Follows the StackExchange best practice for creating a work queue.
Basically push a task and publish a message that a task is there."""
def PushTask(client, queue, task, topic):
client.lpush(queue, task)
client.publish(to... | 3.09375 | 3 |
app/celery.py | TIHLDE/Lepton | 7 | 1061 | <reponame>TIHLDE/Lepton<filename>app/celery.py
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
app = Celery("app")
# Using a string here me... | 2.03125 | 2 |
src/garage/core/__init__.py | researchai/unsupervised_meta_rl | 1 | 1062 | <reponame>researchai/unsupervised_meta_rl<filename>src/garage/core/__init__.py
from garage.core.serializable import Serializable
from garage.core.parameterized import Parameterized # noqa: I100
__all__ = ['Serializable', 'Parameterized']
| 1.164063 | 1 |
formidable/forms/boundfield.py | jayvdb/django-formidable | 0 | 1063 | <reponame>jayvdb/django-formidable
from django.forms import forms
class FormatBoundField(forms.BoundField):
"""
The format field skips the rendering with the label attribute
in the form level (i.e => form.as_p() doesn't have to generate any label
for format field).
This boundfield has this main go... | 2.890625 | 3 |
algorithm_training/abc87.py | hirotosuzuki/algorithm_training | 0 | 1064 | <filename>algorithm_training/abc87.py
class TaskA:
def run(self):
V, A, B, C = map(int, input().split())
pass
class TaskB:
def run(self):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for a in range(A+1):
... | 3.53125 | 4 |
serveur/serveurDroit.py | PL4typus/SysNetProject17 | 0 | 1065 | <gh_stars>0
#!/usr/bin/python
import socket,sys,os
TCP_IP = '127.0.0.1'
TCP_PORT = 6262
BUFFER_SIZE = 1024
s= socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((TCP_IP,TCP_PORT))
s.listen(5)
conn, addr = s.accept()
print('Connection entrante :', addr)
data = conn.recv(BUFFER_SIZE)
if data == "m" :
os.... | 2.78125 | 3 |
BE/common/helpers.py | kosior/ngLearn-1 | 1 | 1066 | <gh_stars>1-10
from rest_framework_jwt.utils import jwt_decode_handler
from users.models import User
from users.serializers import UserSerializer
def jwt_response_payload_handler(token, user=None, request=None):
return {
'token': token,
'user': UserSerializer(user, context={'request': request}).d... | 2.4375 | 2 |
src/finn/util/basic.py | quetric/finn-base-1 | 0 | 1067 | <reponame>quetric/finn-base-1
# Copyright (c) 2020 Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | 0.960938 | 1 |
mainmenu.py | jeffrypaul37/Hospital-Management-System | 0 | 1068 | <reponame>jeffrypaul37/Hospital-Management-System
from tkinter import *
from tkcalendar import Calendar
from datetime import datetime
from datetime import date
import tkinter as tk
from tkinter import ttk
from tkinter.messagebox import askyesno
import re
import sqlite3
import tkinter.messagebox
import pan... | 3.359375 | 3 |
chia_tea/discord/commands/test_wallets.py | Tea-n-Tech/chia-tea | 6 | 1069 | <gh_stars>1-10
import os
import tempfile
import unittest
from datetime import datetime
from google.protobuf.json_format import ParseDict
from ...monitoring.MonitoringDatabase import MonitoringDatabase
from ...protobuf.generated.computer_info_pb2 import ADD, UpdateEvent
from ...protobuf.generated.monitoring_service_pb... | 2.125 | 2 |
render/PC_Normalisation.py | sun-pyo/OcCo | 158 | 1070 | <reponame>sun-pyo/OcCo<gh_stars>100-1000
# Copyright (c) 2020. <NAME>, <EMAIL>
import os, open3d, numpy as np
File_ = open('ModelNet_flist_short.txt', 'w')
if __name__ == "__main__":
root_dir = "../data/ModelNet_subset/"
for root, dirs, files in os.walk(root_dir, topdown=False):
for file in files:
... | 2.109375 | 2 |
pymatgen/apps/battery/insertion_battery.py | adozier/pymatgen | 18 | 1071 | <filename>pymatgen/apps/battery/insertion_battery.py
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
This module is used for analysis of materials with potential application as
intercalation batteries.
"... | 2.75 | 3 |
python/GafferUI/ColorSwatchPlugValueWidget.py | ddesmond/gaffer | 561 | 1072 | ##########################################################################
#
# Copyright (c) 2013, <NAME>. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | 0.933594 | 1 |
NewsPaperD7(final)/NewsPaper/News/migrations/0001_initial.py | GregTMJ/django-files | 1 | 1073 | <reponame>GregTMJ/django-files<gh_stars>1-10
# Generated by Django 3.2 on 2021-04-15 18:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependenc... | 1.867188 | 2 |
osh/cmd_exec_test.py | rhencke/oil | 1 | 1074 | #!/usr/bin/env python
# Copyright 2016 <NAME>. 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
"""
cmd_exec_test.py: Tests ... | 2.34375 | 2 |
blitz_api/migrations/0020_auto_20190529_1200.py | MelanieFJNR/Blitz-API | 3 | 1075 | # Generated by Django 2.0.8 on 2019-05-29 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blitz_api', '0019_merge_20190524_1719'),
]
operations = [
migrations.AlterField(
model_name='exportmedia',
name='fil... | 1.375 | 1 |
archiveis/__init__.py | palewire/archiveis | 6 | 1076 | #!/usr/bin/env python
from .api import capture
__version__ = "0.0.7"
__all__ = ("capture",)
| 0.976563 | 1 |
temp/discrete_a2c_agent.py | linklab/link_rl | 0 | 1077 | <filename>temp/discrete_a2c_agent.py
import numpy as np
import torch
import torch.nn.functional as F
from codes.d_agents.a0_base_agent import float32_preprocessor
from codes.d_agents.on_policy.on_policy_agent import OnPolicyAgent
from codes.e_utils import rl_utils, replay_buffer
from codes.d_agents.actions import Prob... | 2.28125 | 2 |
edmundbotadder/cogs/webhook.py | thebeanogamer/edmund-botadder | 0 | 1078 | <filename>edmundbotadder/cogs/webhook.py
from discord.ext.commands import Bot, Cog
class Webhook(Cog):
"""
Webhook functionality
"""
def __init__(self, bot: Bot):
self.bot = bot
def setup(bot):
bot.add_cog(Webhook(bot)) | 2.3125 | 2 |
apps/core/forms.py | allexvissoci/djangoecommerce | 0 | 1079 | <reponame>allexvissoci/djangoecommerce
from django import forms
from django.core.mail import send_mail
from django.conf import settings
class ContactForm(forms.Form):
name = forms.CharField(label='Nome', required=True)
email = forms.EmailField(label='E-mail')
message = forms.CharField(label='Mensagem', w... | 1.9375 | 2 |
Fchat/Gui/AddFriendWidget.py | jamesaxl/FreeSnake | 2 | 1080 | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, Gdk
class AddFriendWidget(Gtk.Box):
def __init__(self, main_window, fchat_prv, friend_list):
Gtk.Box.__init__(self, spacing=7, orientation = Gtk.Orientation.VERTICAL)
self.fchat_prv = fchat_prv
self.main_window... | 2.34375 | 2 |
python01/game.py | liyan2013/hogwarts | 0 | 1081 | <filename>python01/game.py
import random
def game():
# 我的血量
my_hp = 1000
# 敌人的血量
enemy_hp = 1000
while True:
# 我受到随机的攻击,减少血量
my_hp = my_hp - random.randint(0, 50)
# 敌人收到随机的攻击,减少血量
enemy_hp = enemy_hp - random.randint(0, 50)
if my_hp <= 0:
# 如果我... | 3.65625 | 4 |
petstore/api/api_response.py | andrii-grytsenko/io.swagger.petstore3.testing | 0 | 1082 | from enum import Enum
class ApiResponseType(Enum):
error = "Error"
warning = "Warning"
info = "Info"
ok = "OK"
too_busy = "Too busy"
class ApiResponse:
def __init__(self, code: int, response_type: ApiResponseType, message):
self.code = code
self.type = response_type
s... | 3.359375 | 3 |
test/integration/component/test_browse_templates2.py | ycyun/ablestack-cloud | 1,131 | 1083 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1.648438 | 2 |
tests/components/ozw/test_websocket_api.py | pcaston/core | 1 | 1084 | """Test OpenZWave Websocket API."""
from unittest.mock import patch
from openzwavemqtt.const import (
ATTR_CODE_SLOT,
ATTR_LABEL,
ATTR_OPTIONS,
ATTR_POSITION,
ATTR_VALUE,
ValueType,
)
from openpeerpower.components.ozw.const import ATTR_CONFIG_PARAMETER
from openpeerpower.components.ozw.lock im... | 2.015625 | 2 |
tests/test_formatters.py | samueljacques-qc/notification-utils | 0 | 1085 | <filename>tests/test_formatters.py
import pytest
from flask import Markup
from notifications_utils.formatters import (
unlink_govuk_escaped,
notify_email_markdown,
notify_letter_preview_markdown,
notify_plain_text_email_markdown,
sms_encode,
formatted_list,
strip_dvla_markup,
strip_pipe... | 2.453125 | 2 |
ProgramFlow/functions/banner.py | kumarvgit/python3 | 0 | 1086 | <reponame>kumarvgit/python3
def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print("EEK!!")
print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH")
if text == "*":
print("*" * screen_width)
else:
centred_text = text.center(screen_width - 4)
... | 3.6875 | 4 |
Adafruit_BluefruitLE/interfaces/__init__.py | acoomans/Adafruit_Python_BluefruitLE | 415 | 1087 | <reponame>acoomans/Adafruit_Python_BluefruitLE
from .provider import Provider
from .adapter import Adapter
from .device import Device
from .gatt import GattService, GattCharacteristic, GattDescriptor
| 1.234375 | 1 |
axju/generic/__init__.py | axju/axju | 0 | 1088 | from axju.generic.basic import BasicWorker
from axju.generic.execution import ExecutionWorker
from axju.generic.template import TemplateWorker
| 1.132813 | 1 |
objectstoreSiteMover.py | nikmagini/pilot | 13 | 1089 | <filename>objectstoreSiteMover.py<gh_stars>10-100
#!/usr/bin/env python
# Copyright European Organization for Nuclear Research (CERN)
#
# 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:/... | 1.984375 | 2 |
codigos_videos/Exemplo_2.py | Miguel-mmf/Biblioteca_Dash_em-Python | 1 | 1090 | <filename>codigos_videos/Exemplo_2.py
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Esse arquivo possui algumas modificações em relação ao arquivo apresentado no vídeo do YouTube
# Não deixe de assistir o víde... | 2.359375 | 2 |
Lab 2/javaccflab/formatter.py | tochanenko/MetaProgramming | 0 | 1091 | import re
import datetime
from javaccflab.lexer import parse
from javaccflab.java_token import TokenType, Token, update_token_value
class Formatter:
def __init__(self, files):
self.__files = files
self.__file = None
self.__tokens = []
self.__to_fix = dict()
def process(self):
... | 2.734375 | 3 |
src/secml/adv/attacks/evasion/c_attack_evasion_pgd_exp.py | zangobot/secml | 63 | 1092 | <filename>src/secml/adv/attacks/evasion/c_attack_evasion_pgd_exp.py
"""
.. module:: CAttackEvasionPGDExp
:synopsis: Evasion attack using Projected Gradient Descent.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from secml.adv.attacks.evasion import CAttackEvasionPGDLS
class CAttackEvasionPGDExp(CAttackEvasionPGDLS):
... | 2.59375 | 3 |
mail_log_parser/data_manager.py | kinteriq/mail-log-parser | 0 | 1093 | import sqlite3
class ManageData:
def __init__(self, queue_tracker_db, email_tracker_db, delivery_tracker_db):
self.queue_tracker_db = queue_tracker_db
self.email_tracker_db = email_tracker_db
self.delivery_tracker_db = delivery_tracker_db
def manage_queue_tracker(self, fields):
... | 3.25 | 3 |
Util/training_util.py | lychenyoko/content-aware-gan-compression | 47 | 1094 | import math
def g_path_regularize(fake_img, latents, mean_path_length, decay=0.01):
noise = torch.randn_like(fake_img) / math.sqrt(
fake_img.shape[2] * fake_img.shape[3]
)
grad, = autograd.grad(
outputs=(fake_img * noise).sum(), inputs=latents, create_graph=True
)
path_lengths = tor... | 2.234375 | 2 |
app/configs/development_settings.py | DIS-SIN/FlaskShell | 0 | 1095 | <gh_stars>0
######################################################## FLASK SETTINGS ##############################################################
#Variable used to securly sign cookies
##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD
SECRET_KEY = "dev"
############... | 1.460938 | 1 |
autoarray/structures/grids/two_d/grid_2d_util.py | caoxiaoyue/PyAutoArray | 0 | 1096 | import numpy as np
from typing import Tuple, Union, Optional
from autoarray.structures.arrays.two_d import array_2d_util
from autoarray.geometry import geometry_util
from autoarray import numba_util
from autoarray.mask import mask_2d_util
@numba_util.jit()
def grid_2d_centre_from(grid_2d_slim: np.ndarray) ... | 3.046875 | 3 |
Proxies/Proxies.py | crown-prince/proxies | 2 | 1097 | # coding: utf-8
import requests, math
import gevent
from gevent.queue import Queue
from gevent import monkey; monkey.patch_all()
from pyquery import PyQuery
class Proxies():
def __init__(self):
self.domestic_gn_url = 'http://www.kuaidaili.com/free/inha/{0}/'
self.domestic_pt_url = 'http://www.kuai... | 2.609375 | 3 |
parallelformers/policies/base/auto.py | Oaklight/parallelformers | 454 | 1098 | <filename>parallelformers/policies/base/auto.py
# Copyright 2021 TUNiB inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 1.617188 | 2 |
main/upper_air_humidity.py | RyosukeDTomita/gcmPlot | 0 | 1099 | # coding: utf-8
"""
Name: upper_air_humidity.py
Make upper level weather chart.
Usage: python3 upper_air_humidity.py --file <ncfile>
Author: <NAME>
Date: 2022/01/07
"""
import argparse
from ncmagics import fetchtime, japanmap, meteotool
def parse_args() -> dict:
"""parse_args.
set file path.
Args:
... | 3.203125 | 3 |