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 |
|---|---|---|---|---|---|---|
tests/test_bip69_bip49.py | hkrugersa/nowallet | 63 | 12790651 | <reponame>hkrugersa/nowallet<filename>tests/test_bip69_bip49.py
# pylint: disable=W0621
import random
import pytest
from pycoin.serialize import b2h
from pycoin.tx.TxOut import TxOut
from pycoin.tx.Spendable import Spendable
from connectrum.svr_info import ServerInfo
from nowallet import bip49
@pytest.fixture
def s... | 1.984375 | 2 |
tests/conftest.py | jeremyjordan/flower-classifier | 6 | 12790652 | import os
import pytest
import torch
import torchvision
from flower_classifier.datasets.csv import CSVDataset
from flower_classifier.datasets.oxford_flowers import OxfordFlowers102Dataset, OxfordFlowersDataModule, split_dataset
from flower_classifier.datasets.random import RandomDataModule
from tests.datasets import ... | 2.359375 | 2 |
Pzzzzz/plugins/rss/__init__.py | Pzzzzz5142/animal-forest-QQ-group-bot | 5 | 12790653 | <reponame>Pzzzzz5142/animal-forest-QQ-group-bot
from nonebot import on_command, CommandSession, on_startup
from nonebot.plugin import perm
from nonebot.command import Command, call_command
from nonebot.message import unescape, escape
import asyncio
import asyncpg
import nonebot
from aiocqhttp.exceptions import Error as... | 2.109375 | 2 |
day 5/1-poisson.py | JackRab/10-days-of-statistics | 0 | 12790654 | """
Objective
In this challenge, we learn about Poisson distributions.
Task
A random variable, X, follows Poisson distribution with mean of 2.5.
Find the probability with which the random variable X is equal to 5.
"""
from math import exp, factorial
def poisson(lam=2.5, k=5):
"""
Return the probability of X=... | 3.890625 | 4 |
tasks.py | bixind/JohnReboot | 2 | 12790655 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import weather.weather as weather
import audio.audio as audio
import aliases.aliases as aliases
import instrate.instrate as instrate
import history.history as history
import pollanalyse.pollanalyse as pollanalyse
import imageprocessing.imageprocessing as images
from time import *... | 2.21875 | 2 |
backend/apps/common/utils.py | sebastien-prudhomme/models-web-app | 0 | 12790656 | """Common utils for parsing and handling InferenceServices."""
import os
from kubeflow.kubeflow.crud_backend import api, helpers, logging
log = logging.getLogger(__name__)
KNATIVE_REVISION_LABEL = "serving.knative.dev/revision"
FILE_ABS_PATH = os.path.abspath(os.path.dirname(__file__))
INFERENCESERVICE_TEMPLATE_YAM... | 2.265625 | 2 |
apps/trade/migrations/0042_auto_20190326_1424.py | lianxiaopang/camel-store-api | 12 | 12790657 | <reponame>lianxiaopang/camel-store-api<filename>apps/trade/migrations/0042_auto_20190326_1424.py
# Generated by Django 2.1.7 on 2019-03-26 06:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trade', '0041_auto_20190313_1418'),
]
operations = ... | 1.539063 | 2 |
main.py | wur3/music-theor | 1 | 12790658 | from note import Note
from majorScale import MajorScale
from minorScale import MinorScale
print("Hi welcome to my app.\n")
note = None
scale = None
while(True):
# if no scale is chosen
if scale is None:
# choose a note
if note is None:
note = input("Choose a note: ")
menu = (... | 3.6875 | 4 |
display.py | majidaldo/boweb | 2 | 12790659 | #this could be in a repo on its own should have used a
#obj oriented approach
"""manages GTK3 broadwayd displays
.. and to minimize bash scripting ugggh
usage:
>displynum, port =display.add()
>display.app('gedit',displaynum) #where gedit is a gtk3 app
you may want to set the limits after import
>import display
>di... | 2.4375 | 2 |
trace_river/graph.py | andrew-houghton/river-flow-3 | 0 | 12790660 | from collections import UserDict
class Graph(UserDict):
"""Graph for holding which points are merged and connected
Keys are tuple of tuples eg ((1,2), (2,2))
Values are sets of keys eg {((1,2), (2,2)), ((4,2), (1,4))}
Relationships should be maintained in both directions
"""
def __delitem__(s... | 3.515625 | 4 |
sorts/kth_smallest_ele.py | ami1708/Python | 0 | 12790661 | # //using pivot element and partition and merge sort basically
import random
def swap(A, i, j):
A[i], A[j] = A[j], A[i]
def partition(A, lo, hi):
pivot = A[lo]
i = lo + 1
j = hi
while True:
while A[i] < pivot:
i += 1
if i == hi:
break
while ... | 3.78125 | 4 |
test/end-to-end/Exceptions/Python/main.py | HighSchoolHacking/GLS-Draft | 30 | 12790662 | try:
raise Exception("Oh no!")
except Exception as error:
print("Found an error.")
finally:
# ...
| 2.375 | 2 |
util/api/core.py | IRIS-Team/tchecker | 17 | 12790663 | <gh_stars>10-100
import cfscrape, requests, json, os, sys, threading
from bs4 import BeautifulSoup as bs
from requests.adapters import HTTPAdapter
from fake_headers import Headers
from urllib3.util.ssl_ import create_urllib3_context
from util.core import *
from util.emails.core import *
from util.scraper.core import *... | 2.546875 | 3 |
gs_energy-prediction/scripts/reoptimize_ucc.py | cgyurik/qml_for_qchem | 0 | 12790664 | <reponame>cgyurik/qml_for_qchem<gh_stars>0
import os
import sys
import json
# pylint: disable=wrong-import-position
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__))))
sys.path.append(ROOT_DIR)
from convoQC.scripts.optimize_ucc import optimize_ucc
from convoQC.utils import loa... | 2.25 | 2 |
pywinutiltools/__init__.py | riag/pywinutiltools | 0 | 12790665 | <filename>pywinutiltools/__init__.py
__version__ = '0.1.0'
from pywinutiltools import powershell
| 1.109375 | 1 |
aiosqlite/__version__.py | PikalaxALT/aiosqlite | 7 | 12790666 | __version__ = "0.16.1"
| 1.039063 | 1 |
ProLib.py | marromlam/quick-memos | 0 | 12790667 | <reponame>marromlam/quick-memos
# -*- coding: UTF-8 -*-
##########################################################################################
# Importing packages. ####################################################################
import numpy as np
import csv
import re
import os
import ast
import math
import... | 2.015625 | 2 |
app/services/vaccine_availability_timeslot.py | rayraykay/VaxFinder-backend | 31 | 12790668 | <gh_stars>10-100
from typing import List, Optional, Type, Union
from uuid import UUID
from loguru import logger
from app.schemas.vaccine_availability import (
VaccineAvailabilityTimeslotCreateRequest,
VaccineAvailabilityTimeslotCreateSprocParams,
VaccineAvailabilityTimeslotResponse,
VaccineAvailabilit... | 2.125 | 2 |
30os.py | Ulyssesss/Learn-Python | 1 | 12790669 | import os
print(os.name)
print(os.uname())
print(os.environ)
print(os.environ.get('PATH'))
p = os.path.join('.', 'test_dir')
print(p)
os.mkdir(p)
os.rmdir(p)
| 2.421875 | 2 |
azext_concierge/concierge/common/shell.py | egineering-llc/azure-cli-concierge-extension | 1 | 12790670 | import os, subprocess
def execute_shell_process(message, command):
print(message)
env_copy = os.environ.copy()
output = subprocess.run(command, env=env_copy, shell=True)
if output.returncode == 0:
print("Success!")
else:
print("Oops! Please try again.") | 2.75 | 3 |
tpot/models/df_caso_3_3_tpot_pipeline.py | nachovazquez98/COVID-19_Paper | 0 | 12790671 | <reponame>nachovazquez98/COVID-19_Paper
import numpy as np
import pandas as pd
from sklearn.linear_model import SGDClassifier
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from sklearn.svm import LinearSVC
from tpot.builtins import StackingEstimator
# NOTE:... | 2.765625 | 3 |
rates/updater/updater.py | luisparravicini/backtesting-learning | 0 | 12790672 | <reponame>luisparravicini/backtesting-learning
from datetime import datetime
import ccxt
import time
import re
from .db import Database
from .exchange import build_exchange, timestamps_to_seconds, secs_to_millis
class Updater:
def __init__(self, exchange_name, symbol, db_base_path):
self.exchange = build_... | 2.625 | 3 |
rlpython/embed.py | ukleinek/rlpython | 4 | 12790673 | <reponame>ukleinek/rlpython<gh_stars>1-10
import inspect
import logging
import os
def embed(single_threaded=False, bind='', permissions='600',
multi_session=False, started_from_cmd_line=False, print=print,
debug=False, **repl_kwargs):
from rlpython.frontend import start_frontend
from rlpy... | 2.109375 | 2 |
jsonconf/tests/commandLineTests.py | bponsler/jsonconf | 0 | 12790674 | from unittest import TestCase
from jsonconf import CommandLineParser
class ConfigTests(TestCase):
def setUp(self):
pass
def test_constructor(self):
parser = CommandLineParser()
self.assertTrue(parser is not None)
self.assertEqual(parser.getKeywordArguments(), {})
self... | 3.125 | 3 |
tests/test_sfm2cldf.py | clld/pydictionaria | 1 | 12790675 | import unittest
import pydictionaria.sfm2cldf as s
import clldutils.sfm as sfm
class SplitMarkersWithSeparators(unittest.TestCase):
def test_lump_everything_together_if_seperator_isnt_found(self):
sep = 'sep'
input_markers = [
('marker1', 'value1'),
('marker2', 'value2')]
... | 2.921875 | 3 |
ANLY-501-INTRO/LAB5-cluster/00-TWO-VARIABLE-NORMAL-DIST.py | rexarski/ggtown-ds | 0 | 12790676 |
##-------------------------------------------
## 2 VARIABLE NORMAL DISTIBUTION
##-------------------------------------------
import matplotlib.pyplot as plt
import numpy as np
#USER INPUTS
FUNC=2
FS=18 #FONT SIZE
CMAP='hsv' #'RdYlBu'
#normal distribution param
ux=0.5; uy=0.0
sx=2.0; sy=1.0 #STD-DEV
rho=0.5... | 2.875 | 3 |
monhorn/console.py | EntySec/Monhorn | 0 | 12790677 | <reponame>EntySec/Monhorn<gh_stars>0
"""
MIT License
Copyright (c) 2020-2022 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
t... | 1.875 | 2 |
irida_uploader_cl/parsers/miniseq/__init__.py | duanjunhyq/irida_uploader_cl | 0 | 12790678 | <reponame>duanjunhyq/irida_uploader_cl
from irida_uploader_cl.parsers.miniseq.parser import Parser
| 1.039063 | 1 |
ETM/ETM.py | BlackmanWhite/Easy-Text-Menu-ETM | 2 | 12790679 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
__author__ = ('<NAME> (<NAME>)')
__version__ = ('3.5')
__license__ = ('GNU General Public License v3.0')
opt = []
index = 1
class Menu():
def __init__(self, title, character, char_length):
self.title = title
self.character = character
... | 3.546875 | 4 |
tests/test_engine.py | adithyavis/pywarm | 194 | 12790680 | <reponame>adithyavis/pywarm<filename>tests/test_engine.py
# 08-31-2019;
"""
Test cases for warm.engine.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).parent.parent))
from warm import engine
def test_set_get_def... | 2.140625 | 2 |
reviewboard/extensions/tests/test_filediffacl_hook.py | pombredanne/reviewboard | 0 | 12790681 | """Unit tests for reviewboard.extensions.hooks.FileDiffACLHook."""
import kgb
from djblets.features.testing import override_feature_check
from reviewboard.extensions.hooks import FileDiffACLHook
from reviewboard.extensions.tests.testcases import BaseExtensionHookTestCase
from reviewboard.reviews.features import DiffA... | 2.203125 | 2 |
vega/trainer/callbacks/hccl.py | This-50m/vega | 724 | 12790682 | <filename>vega/trainer/callbacks/hccl.py<gh_stars>100-1000
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it wi... | 1.953125 | 2 |
sentencia for.py | slack333/Python | 0 | 12790683 | numeros = [1,2,3,4,5,6,7,8,9,10]
indice = 0
while(indice < len(numeros)):
print(numeros[indice])
indice += 1
for numero in numeros:
print(numero)
for numero in numeros:
numero *= 10
numeros = [1,2,3,4,5,6,7,8,9,10]
indice = 0
for numero in numeros:
numeros[indice] *= 10
indice += 1
print (n... | 3.96875 | 4 |
main.py | HisenZhang/WRPI-auto | 1 | 12790684 | <gh_stars>1-10
import headless
import argparse
import threading
import sys
import logging
import py_cui
from modules.tui import TUI
from modules.util import configManager
def runSchedule(station):
logging.info("Scheduler started.")
while station.mixer.get_init():
station.scheduleRun()
def runTUI(mai... | 2.375 | 2 |
botcmd.py | JuEeHa/oonbotti2 | 0 | 12790685 | import eliza
import threading
import random
import re
import time
concmd=['/q', '/lt', '/st', '/lg', '/lm', '/sm']
blacklist = []
doctor = eliza.eliza()
# channel: [user1, user2, ..., userN]
trusted = {}
trustedlock = threading.Lock()
gods = {}
godslock = threading.Lock()
# receiver: [(sender1, origin1, message1),... | 2.265625 | 2 |
models.py | Geson-anko/VoiceBand | 0 | 12790686 | import torch
import torch.nn as nn
import torch.nn.functional as F
import pytorch_lightning as pl
from torchsummaryX import summary
from torch.nn.utils import weight_norm, remove_weight_norm
from utils import get_padding, get_conv1d_outlen, init_weights, get_padding_down, get_padding_up,walk_ratent_space
from typing im... | 2.15625 | 2 |
perceptron_pacman.py | Tskken/classification | 0 | 12790687 | """Perceptron implementation for apprenticeship learning in pacman.
Author: <NAME>, <NAME>, and <NAME>
Class: CSI-480-01
Assignment: PA 5 -- Supervised Learning
Due Date: Nov 30, 2018 11:59 PM
Certification of Authenticity:
I certify that this is entirely my own work, except where I have given
fully-documented refere... | 2.53125 | 3 |
generated-libraries/python/netapp/storage_array/__init__.py | radekg/netapp-ontap-lib-get | 2 | 12790688 | from netapp.connection import NaConnection
from storage_array_config_summary import StorageArrayConfigSummary # 8 properties
from storage_array_port_stats import StorageArrayPortStats # 13 properties
from storage_array_stats_info import StorageArrayStatsInfo # 6 properties
from arrayfailovertype import Arrayfailovertyp... | 2.015625 | 2 |
LSTM_test.py | xingshulicc/xingshulicc | 10 | 12790689 | # -*- coding: utf-8 -*-
from __future__ import print_function
"""
Created on Tue Oct 6 16:23:04 2020
@author: Admin
"""
import numpy as np
import pandas as pd
import math
import os
from keras.layers import Dense
from keras.layers import LSTM
from keras.optimizers import Adam
from sklearn.preprocessing i... | 3.265625 | 3 |
mmseg/models/segmentors/__init__.py | yoyoyoohh/SAR_build_extract_v2 | 0 | 12790690 | '''
Author: <NAME>
Created Date: 2021-08-08
Last Modified: 2021-08-28
content:
'''
from .base import BaseSegmentor
from .cascade_encoder_decoder import CascadeEncoderDecoder
from .encoder_decoder import EncoderDecoder
from .semi import Semi
from .semi_v2 import SemiV2
from .reco import ReCo
# __all__ = ['BaseSegment... | 1.1875 | 1 |
simplemooc/forum/admin.py | KelsonMaciel/simplemooc- | 0 | 12790691 | from django.contrib import admin
from .models import Thread, Reply
class ThreadAdmin(admin.ModelAdmin):
list_display = ['title', 'author', 'created', 'modifield']
search_fields = ['title', 'author__email', 'body']
prepopulated_fields = {'slug':('title',)}
class ReplyAdmin(admin.ModelAdmin):
list... | 1.914063 | 2 |
bin/points_to_features.py | digital-land/dataset | 1 | 12790692 | #!/usr/bin/env python3
import sys
import json
# add parent directory
sys.path.append(".")
from utils import get
from digital_land_frontend.render import wkt_to_json_geometry
sample_file = "docs/brownfield-land/organisation/local-authority-eng/HAG/sites.json"
def create_feature_collection(features):
return {"t... | 2.578125 | 3 |
bsbetl/alltable_calcs/_2StVols_SlowDailyVols.py | t0rus1/bsbetl | 0 | 12790693 | from bsbetl import ov_helpers
import logging
import math
from datetime import date, datetime
from numpy.core.numeric import NaN
from pandas.core.indexes.base import Index
import pandas as pd
from bsbetl.alltable_calcs import Calculation
from bsbetl.alltable_calcs.at_params import at_calc_params
from bsbetl.calc_helper... | 2.171875 | 2 |
yeast_mrcnn/model.py | Hekstra-Lab/yeast-mrcnn | 0 | 12790694 | __all__ = [
"make_mrcnn",
"mrcnn",
]
import torch
from torchvision.models.detection import MaskRCNN, maskrcnn_resnet50_fpn
from torchvision.models.detection.backbone_utils import resnet_fpn_backbone
from torchvision.models.detection.rpn import AnchorGenerator
from torchvision.models.detection.transform import ... | 2.125 | 2 |
get_article.py | Astruj/Regional-English-Wiki | 0 | 12790695 | <filename>get_article.py
import kdap
knol = kdap.knol()
knol.get_wiki_article('Citizenship (Amendment) Act, 2019','/home/akash/Desktop/pro')
a=kdap.analysis.knol()
| 1.5 | 2 |
SQLFileManager.py | whde/Movie | 1 | 12790696 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import threading
mu = threading.Lock()
def create_sql_file():
open('sql.txt', 'w+', encoding='utf-8')
def lock_test(sql):
if mu.acquire(True):
write_to_file(sql)
mu.release()
def write_to_file(sql):
fp = open('sql.txt', 'a+')
print('wri... | 3.109375 | 3 |
Beecrowd/Python/2152 Pepe, I Already Took the Candle!.py | nazmul629/OJ-Problem_Solution | 0 | 12790697 | for i in range(int(input())):
H,M,O =map(int,input().split())
if H <10:
H='0'+str(H)
if M <10:
M='0'+str(M)
if O<1:
print(f"{H}:{M} - A porta fechou!")
else:
print(f"{H}:{M} - A porta abriu!")
| 3.21875 | 3 |
pyramid_sms/outgoing.py | timgates42/pyramid_sms | 6 | 12790698 | """Outgoing SMS API."""
import logging
import pkg_resources
from pyramid.renderers import render
from pyramid.settings import asbool
from pyramid_sms.utils import get_sms_backend
try:
pkg_resources.get_distribution('websauna')
from websauna.system.http import Request
from websauna.system.task.tasks impor... | 2.5 | 2 |
labelprop/lightning_model.py | nathandecaux/labelprop | 0 | 12790699 | import torch
from torch import nn
import torch.nn.functional as F
import pytorch_lightning as pl
import kornia
from .voxelmorph2d import VxmDense,NCC,Grad,Dice
from monai.losses import BendingEnergyLoss,GlobalMutualInformationLoss,DiceLoss,LocalNormalizedCrossCorrelationLoss
from kornia.filters import sobel, gaussian_b... | 2.140625 | 2 |
MapHeightEval.py | hal-lab-u-tokyo/GenMap | 0 | 12790700 | # This file is part of GenMap and released under the MIT License, see LICENSE.
# Author: <NAME>
from EvalBase import EvalBase
import networkx as nx
import os
import signal
import math
main_pid = os.getpid()
class MapHeightEval(EvalBase):
def __init__(self):
pass
@staticmethod
def eval(CGRA, ap... | 2.171875 | 2 |
sdk/python/pulumi_gcp/iot/outputs.py | dimpu47/pulumi-gcp | 0 | 12790701 | <reponame>dimpu47/pulumi-gcp
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, Dict, List, Mapping, Optional,... | 1.585938 | 2 |
LeetCode/Weekly Contests/Biweekly Contest 36/Find Servers That Handled Most Number of Requests.py | UtkarshPathrabe/Competitive-Coding | 13 | 12790702 | <filename>LeetCode/Weekly Contests/Biweekly Contest 36/Find Servers That Handled Most Number of Requests.py
from sortedcontainers import SortedList
class Solution:
def busiestServers(self, k: int, arrival: List[int], load: List[int]) -> List[int]:
requestCounter, priorityQueue, serverList, maxRequestHandle... | 3.421875 | 3 |
benchmarks/vision/cifar_10.py | tongh18/df-dn-paper | 0 | 12790703 | """
Coauthors: <NAME>
<NAME>
"""
from toolbox import *
import argparse
import random
from sklearn.ensemble import RandomForestClassifier
import torchvision.models as models
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from sklearn.model_selection import ParameterSampl... | 2.25 | 2 |
COVID-Tracker.py | Lal-Jr/COVID-Tracker | 0 | 12790704 | <reponame>Lal-Jr/COVID-Tracker<filename>COVID-Tracker.py
from covid import Covid
import matplotlib.pyplot as pyplot
country = input("Enter Country Name : ")
covid = Covid()
data = covid.get_status_by_country_name(country)
cadr = {
key: data[key]
for key in data.keys() & {"confirmed","active","deaths","recovered... | 3.59375 | 4 |
tests/cache/test_cache.py | limber-project/limberframework | 3 | 12790705 | <filename>tests/cache/test_cache.py
from datetime import datetime
from unittest.mock import AsyncMock, Mock
from pytest import fixture, mark, raises
from limberframework.cache.cache import Cache
from limberframework.cache.exceptions import CacheLockError
@fixture
def mock_store():
return AsyncMock()
@mark.asy... | 2.40625 | 2 |
packages/watchmen-auth/src/watchmen_auth/__init__.py | Indexical-Metrics-Measure-Advisory/watchmen | 0 | 12790706 | from .auth_helper import authorize, authorize_token
from .authentication import AuthenticationDetails, AuthenticationManager, AuthenticationProvider, AuthenticationScheme
from .authorization import AuthFailOn401, AuthFailOn403, Authorization
from .principal_service import PrincipalService
| 1.070313 | 1 |
vjemmie/db/__init__.py | PederHA/vjemmie | 1 | 12790707 | from typing import Dict
from pathlib import Path
from discord.ext import commands
from ..config import MAIN_DB
from .db import DatabaseConnection
# Maybe this is a little clumsy?
_CONNECTIONS: Dict[str, DatabaseConnection] = {}
def add_db(path: str, bot: commands.Bot) -> DatabaseConnection:
if path not in _CON... | 3.046875 | 3 |
get_stats.py | kdrag0n/gci-stats | 1 | 12790708 | #!/usr/bin/env python3
import sys
import graphyte
import requests
def get_orgs():
with requests.get("https://codein.withgoogle.com/api/program/current/organization/") as resp:
if resp.status_code != 200:
print(f"Received status code {resp.status_code}: {resp.text}")
exit(1)
... | 2.765625 | 3 |
aiomisc/iterator_wrapper.py | vasiliykovalev/aiomisc | 0 | 12790709 | <gh_stars>0
import asyncio
import inspect
import threading
import typing as t
from collections import deque
from concurrent.futures import Executor
from typing import Awaitable
from weakref import finalize
from aiomisc.counters import Statistic
T = t.TypeVar("T")
R = t.TypeVar("R")
GenType = t.Generator[T, R, None]... | 2.34375 | 2 |
Chapter 11/Organizing clusters as a hierarchical tree/program1.py | fagaiera/python-machine-learning-book-3rd-edition-examples | 0 | 12790710 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist, squareform
from scipy.cluster.hierarchy import linkage, dendrogram
from sklearn.cluster import AgglomerativeClustering
# # Organizing clusters as a hierarchical tree
# ## Grouping clusters in bottom-up fas... | 3.328125 | 3 |
CodeChallange.py/codeone.py | jvillalp/Leetcodepractice | 0 | 12790711 | <reponame>jvillalp/Leetcodepractice<filename>CodeChallange.py/codeone.py
from collections import Counter #dict subclass for counting hashable objects {(Key, value)}
#It is a collection where elements are stored as dictionary keys and
# their counts are stored as dictionary values.
#we want to return the first time t... | 3.6875 | 4 |
examples/helloworld/helloworld.py | pyrelease/PyRelease | 1 | 12790712 | <reponame>pyrelease/PyRelease
from __future__ import print_function
import sys
__version__ = "0.1.1" # This will set the version
__license__ = "MIT" # This sets the license
# The package description comes from the docstring of the
# first function in __all__
__all__ = ["main"]
def say_hello(name):
print("... | 2.328125 | 2 |
pyxrd/generic/gtk_tools/dummy_gtk.py | PyXRD/pyxrd | 27 | 12790713 | # coding=UTF-8
# ex:ts=4:sw=4:et
# Copyright (c) 2013, <NAME>
# All rights reserved.
# Complete license can be found in the LICENSE file.
from mvc.support.utils import get_new_uuid
__all__ = [
"gobject",
"GtkTreeIter",
"GenericTreeModel"
"TREE_MODEL_LIST_ONLY"
]
TREE_MODEL_LIST_ONLY = 0x00
TREE_MOD... | 1.835938 | 2 |
Month 03/Week 01/Day 06/d.py | KevinKnott/Coding-Review | 0 | 12790714 | # Random Pick with Weight: https://leetcode.com/problems/random-pick-with-weight/
# You are given an array of positive integers w where w[i] describes the weight of ith index (0-indexed).
# We need to call the function pickIndex() which randomly returns an integer in the range [0, w.length - 1]. pickIndex() should ret... | 3.921875 | 4 |
author/forms.py | vindeolal/pari | 0 | 12790715 | from django import forms
from wagtail.wagtailimages.widgets import AdminImageChooser
from .models import Author
class AuthorAdminForm(forms.ModelForm):
class Meta:
model = Author
# TODO: Ability to add author image
exclude = ['image', 'slug', 'bio']
| 1.828125 | 2 |
lambda/automations/update_tag.py | hyperglance/aws-rule-automations | 0 | 12790716 | <filename>lambda/automations/update_tag.py
"""Tags an EC2 Resource
This automation attempts to fix a tag in for an EC2 resource, identified as above or below the configured threshold
by Hyperglance Rule(s)
This automation will operate across accounts, where the appropriate IAM Role exists.
"""
import processing.aut... | 2.546875 | 3 |
dossiers/forms.py | adrienlachaize/dezede | 0 | 12790717 | from django.forms import BooleanField, ModelForm
from tree.forms import TreeChoiceField
from .models import DossierDEvenements
class DossierDEvenementsForm(ModelForm):
statique = BooleanField(required=False)
class Meta(object):
model = DossierDEvenements
exclude = ()
field_classes = ... | 2.125 | 2 |
sbin/db_mgmt_cwe.py | AlexFaraino/cve-search | 377 | 12790718 | <gh_stars>100-1000
#!/usr/bin/env python3
#
# Import script of NIST CWE Common Weakness Enumeration.
#
# Until now, the import is only import Weakness description.
#
# The format is the following:
#
# { "_id" : ObjectId("52b70521b261026f36818515"), "weaknessabs" : "Variant",
# "name" : "ASP.NET Misconfiguration: Missin... | 1.84375 | 2 |
relex/modules/offset_embedders/offset_embedder.py | DFKI-NLP/RelEx | 16 | 12790719 | <reponame>DFKI-NLP/RelEx
import torch
from allennlp.common import Registrable
class OffsetEmbedder(torch.nn.Module, Registrable):
"""
"""
default_implementation = "relative"
def get_output_dim(self) -> int:
"""
Returns the final output dimension that this ``OffsetEmbedder`` uses to ... | 2.640625 | 3 |
history/admin.py | fahimfarhan/cancer-web-app | 0 | 12790720 | <gh_stars>0
from django.contrib import admin
# Register your models here.
from history.models import HistoryModelFile
admin.site.register(HistoryModelFile)
| 1.289063 | 1 |
example_code/selection_problem.py | dbwebb-se/python-slides | 0 | 12790721 | import random
import time
n = 10000000
random_list = random.sample(range(n * 10), n)
start = time.time()
median = sorted(random_list, reverse=True)[n // 2]
end = time.time()
print(median)
print(end - start)
| 3.296875 | 3 |
CATS/cleaning_empty_rows.py | janetvanbilsen/Twitter-Mining-Raspberry_Pi | 0 | 12790722 | #!/usr/bin/env python3
import pandas as pd
dataset = pd.read_csv('Dataset.csv')
dataset.to_csv('Dataset.csv', index=False)
| 2.390625 | 2 |
crawl_data/crawl_data/spiders/companies_spider.py | huynhnhathao/job_recommender | 0 | 12790723 | import scrapy
class CompaniesSpider(scrapy.Spider):
"""This spider wil crawl all the company link available in itviec and save it
to a json line file.
"""
name = "companies"
start_urls = [
'https://itviec.com/companies',
]
def parse(self, response):
all_compan... | 3.25 | 3 |
PFM_CP/matcreate.py | DylanAgius/PFM-CP | 0 | 12790724 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 15:19:55 2020
@author: mi19356
"""
import numpy as np
import os
import pandas as pd
from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree
import random
import math
from scrape import vtk_scrap
from dataconversions import data_reco... | 2.15625 | 2 |
src/PhoneBook.py | Seniru/at.py | 0 | 12790725 | <filename>src/PhoneBook.py
"""
MIT License
Copyright (c) 2021 <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
in the Software without restriction, including without limitation the rights
to use, copy, mod... | 2.890625 | 3 |
challenger_bot/car_controllers.py | twobackfromtheend/challenger | 0 | 12790726 | <reponame>twobackfromtheend/challenger<filename>challenger_bot/car_controllers.py
from enum import Enum
class CarController(Enum):
AGENT = 0
DS4 = 1
| 1.796875 | 2 |
scripts/bulkLoadGeojson2elasticsearch.py | wkhchow/opendrr-api | 0 | 12790727 | <filename>scripts/bulkLoadGeojson2elasticsearch.py
# =================================================================
#
# Authors: <NAME> <<EMAIL>>
#
# =================================================================
import os
for eqScenario in ['sim6p8_cr2022_rlz_1']:
for retrofitPrefix in ['b0']: #,'r1','r2'... | 2.171875 | 2 |
release/src-rt-6.x.4708/router/samba3/source4/scripting/devel/speedtest.py | zaion520/ATtomato | 2 | 12790728 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Unix SMB/CIFS implementation.
# This speed test aims to show difference in execution time for bulk
# creation of user objects. This will help us compare
# Samba4 vs MS Active Directory performance.
# Copyright (C) <NAME> <<EMAIL>> 2010
#
# This program is free software... | 1.921875 | 2 |
Abstract_Factory/furniture_factory.py | edgardeng/design-patterns-in-python | 0 | 12790729 | <reponame>edgardeng/design-patterns-in-python<gh_stars>0
"""
抽象工厂 代码实例
Abstract Factory Code Demo
家具工厂
"""
from __future__ import annotations
from abc import ABC, abstractmethod
class Chair(ABC):
"""
product interface 1: Chair
"""
@abstractmethod
def sit_on(self) -> str:
pass
class ... | 4.25 | 4 |
HomeLab/homepage/views.py | amalik18/HomeLab | 0 | 12790730 | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import render
from django.http import Http404
# Create your views here.
def index(request):
return render(request=request, template_name='homepage.html')
| 1.734375 | 2 |
SHS4py/setup.py | YukiMitsuta/shs4py | 2 | 12790731 | <gh_stars>1-10
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright 2019.12.19 <NAME>
# Distributed under terms of the MIT license.
from distutils.core import setup
from Cython.Build import cythonize
import numpy
from distutils.extension import Extension
from Cython.Distutils import build_e... | 1.882813 | 2 |
tests/test_acdh_geonames_utils.py | acdh-oeaw/acdh_geonames_utils | 0 | 12790732 | #!/usr/bin/env python
"""Tests for `acdh_geonames_utils` package."""
import os
import unittest
from click.testing import CliRunner
from acdh_geonames_utils import acdh_geonames_utils as gn
from acdh_geonames_utils import cli
good_country_code = 'YU'
bad_country_code = 'BAAAD'
good_ft_code = "en"
bad_ft_code = "de"... | 2.703125 | 3 |
pptag.py | dsm1212/ppTag | 0 | 12790733 | <filename>pptag.py
#!/usr/bin/env python
## python 3
# pip install watchdog
import sys
import getopt
import logging
import urllib
import time
import os
import threading
from datetime import datetime, date, timedelta
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from ... | 2.296875 | 2 |
data/livecode/fill_ts.py | james94/driverlessai-recipes | 0 | 12790734 | """Add any missing Group by Date records and fill with a default value - additional columns will be null for the default values"""
# Column names in our dataset
ts_column = "Date"
group_by_columns = ["Store", "Dept"]
target_column = "Weekly_Sales"
default_missing_value = 0
# check the datatype of user-defined input v... | 3.515625 | 4 |
anondolok_library/admin_panel/migrations/0017_wish_list_is_wished.py | Horraira/anondolokLibrary | 0 | 12790735 | # Generated by Django 3.2.1 on 2021-08-08 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('admin_panel', '0016_wish_list'),
]
operations = [
migrations.AddField(
model_name='wish_list',
name='is_wished',
... | 1.554688 | 2 |
src/postprocessing/put_softmax_in_subject_space.py | LucasFidon/feta-inference | 0 | 12790736 | """
Use this script to post-process the predicted softmax segmentation.
This script performs rigid register of the softmax prediction to the subject space.
@author: <NAME> (<EMAIL>)
"""
import os
from argparse import ArgumentParser
import numpy as np
import nibabel as nib
parser = ArgumentParser()
parser.add_argumen... | 2.671875 | 3 |
PiBlynk-py/oled96/__init__.py | BLavery/PyBlynk | 12 | 12790737 | <reponame>BLavery/PyBlynk<filename>PiBlynk-py/oled96/__init__.py
#!/usr/bin/env python
# USAGE:
# from oled96 import oled
# or
# import oled96
# oled = oled96.OLED(0x3c) or 3d
from PIL import Image, ImageDraw, ImageFont
from smbus import SMBus
font1 = ImageFont.truetype('/usr/share/fonts/truet... | 2.1875 | 2 |
Python/Courses/Python-Tutorials.Telusko/02.Miscellaneous/24.zip.py | shihab4t/Books-Code | 0 | 12790738 | <gh_stars>0
names = ["Navin", "Kiran", "Harsh", "Navin"]
comps = ["Dell", "Apple", "MS", "Dell"]
zipped = zip(names, comps)
for a, b in zipped:
print(a, b)
| 3.1875 | 3 |
LeetCode/python/211-240/225-implement-stack-using-queues/solution.py | shootsoft/practice | 0 | 12790739 | class Stack:
# initialize your data structure here.
def __init__(self):
self.q1 = []
self.q2 =[]
self.switch = 1
self.length = 0
# @param x, an integer
# @return nothing
def push(self, x):
if self.switch == 1:
self.q1.append(x)
while(l... | 3.90625 | 4 |
chapter14_OOP/2019/Number.py | motazsaad/WDMM1405 | 4 | 12790740 | <reponame>motazsaad/WDMM1405<filename>chapter14_OOP/2019/Number.py
class Number:
def __init__(self, num):
self.number = num
def __str__(self):
return str(self.number)
def __add__(self, other):
self.number += other
return Number(self.number)
# class
n = Number(10)
print(n)... | 3.953125 | 4 |
pseudo/middlewares/standard_middleware.py | mifieldxu/pseudo-lang | 661 | 12790741 | from pseudo.middlewares.middleware import Middleware
from pseudo.pseudo_tree import Node
class StandardMiddleware(Middleware):
'''
changes standard_iterable_call in return to a special type
used by go
'''
@classmethod
def process(cls, tree):
return cls().transform(tree)
def trans... | 2.65625 | 3 |
sample.py | tecdan/NCE_Alias_Sampling | 0 | 12790742 | """A minimal sample script for illustration of basic usage of NCE module"""
import torch
from nce import IndexLinear
class_freq = [0, 2, 2, 3, 4, 5, 6] # an unigram class probability
freq_count = torch.FloatTensor(class_freq)
print("total counts for all tokens:", freq_count.sum())
noise = freq_count / freq_count.sum... | 2.875 | 3 |
aybtools/minitest.py | abc1035/aiyubin-task1 | 0 | 12790743 | """this file is aimed to generate a small datasets for test"""
import json
f = open("/home/ayb/UVM_Datasets/voc_test3.json", "r")
line = f.readline()
f.close()
dic = eval(line)
images = dic['images']
new_images=[]
for image in images:
if "ten" in image['file_name']:
continue
else:
new_images.ap... | 2.8125 | 3 |
ex011.py | mateusguida/ExerciciosPython | 0 | 12790744 | <reponame>mateusguida/ExerciciosPython
larg = float(input("Largura da parede: "))
alt = float(input("Altura da parede: "))
area = larg * alt
print(f'SUa parede tem a dimensão de {larg:.2f}x{alt:.2f} e sua área é de {area:.3f}m².')
print(f'Para pintar essa parede, você precisará de {area/2} litros de tinta') | 3.8125 | 4 |
movielist_app/tests.py | rhedwan/BuildingDjangoAPI | 0 | 12790745 | <reponame>rhedwan/BuildingDjangoAPI
from django.contrib.auth.models import User
from django.http import response
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.authtoken.models import Token
from movielist_app.api import serializers
fro... | 2.53125 | 3 |
Flask/15.py | Pendragon21/FlaskExercises | 0 | 12790746 | import os
from flask import Flask, g
from flask_sijax import sijax
path = os.path.join('.', os.path.dirname(__file__), 'static/js/sijax/')
app = Flask(__name__)
app.config['SIJAX_STATIC_PATH'] = path
app.config['SIJAX_JSON_URI'] = '/static/js/sijax/json2.js'
flask_sijax.Sijax(app)
@app.route('/')
def ind... | 2.390625 | 2 |
wtforms_dynamic_fields/wtforms_dynamic_fields.py | Timusan/wtforms-dynamic-fields | 20 | 12790747 | import re
import sys
from wtforms.form import FormMeta
class WTFormsDynamicFields():
""" Add dynamic (set) fields to a WTForm.
Instantiating this class will merely create a configuration
dictionary on which you can add fields and validators using
the designated methods "add_field" and "add_validat... | 3.0625 | 3 |
conf.py | evhub/coconut | 3,624 | 12790748 | <reponame>evhub/coconut<gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------------------------------------------------
# INFO:
# ------------------------------------------------------------------------------------------------------... | 1.445313 | 1 |
Clase01/hipoteca.py | qagustina/python-exercises | 0 | 12790749 | # 1.7: La hipoteca de David
# 1.9: Calculadora de adelantos
# 1.10: Tablas
# 1.7
saldo = 500000.0
tasa = 0.05
pago_mensual = 2684.11
total_pagado = 0.0
mes = 0
# 1.9
pago_extra_mes_comienzo = 61
pago_extra_mes_fin = 108
pago_extra = 1000
mes_adelantado = 0
while saldo > 0:
saldo = saldo * (1+tasa/12)
... | 3.5625 | 4 |
Python/easy/0977_squares_of_a_sorted_array.py | CalmScout/LeetCode | 0 | 12790750 | <filename>Python/easy/0977_squares_of_a_sorted_array.py
"""
Given an array of integers A sorted in non-decreasing order,
return an array of the squares of each number, also in sorted non-decreasing order.
Example 1:
Input: [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Example 2:
Input: [-7,-3,2,3,11]
Output: [4,9,9,49,121]
... | 4.21875 | 4 |