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
src/python/pants/backend/docker/util_rules/docker_build_context_test.py
pantsbuild/pants
1,806
14300
<gh_stars>1000+ # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from textwrap import dedent from typing import Any, ContextManager import pytest from pants.backend.docker.goals import package_image ...
1.765625
2
build_you/models/company.py
bostud/build_you
0
14301
<reponame>bostud/build_you import enum from sqlalchemy import Column, ForeignKey, String, JSON, Integer, Enum from sqlalchemy.orm import relationship from build_you.models.base import BaseModel from build_you.database import Base class Company(BaseModel, Base): __tablename__ = 'company' class Status(enum.En...
2.53125
3
deeplab_resnet/__init__.py
tramper2/SIGGRAPH18SSS
390
14302
from .model import DeepLabResNetModel from .hc_deeplab import HyperColumn_Deeplabv2 from .image_reader import ImageReader, read_data_list, get_indicator_mat, get_batch_1chunk, read_an_image_from_disk, tf_wrap_get_patch, get_batch from .utils import decode_labels, inv_preprocess, prepare_label
1.234375
1
ESPNet/commons/general_details.py
sanket1414/Priority-Based-Alert-System
1
14303
<reponame>sanket1414/Priority-Based-Alert-System<gh_stars>1-10 # classification related details classification_datasets = ['imagenet', 'coco'] classification_schedulers = ['fixed', 'clr', 'hybrid', 'linear', 'poly'] classification_models = ['espnetv2', 'dicenet', 'shufflenetv2'] classification_exp_choices = ['main', 'a...
1.414063
1
resources/dot_PyCharm/system/python_stubs/-762174762/win32profile.py
basepipe/developer_onboarding
1
14304
# encoding: utf-8 # module win32profile # from C:\Python27\lib\site-packages\win32\win32profile.pyd # by generator 1.147 # no doc # no imports # Variables with simple values PI_APPLYPOLICY = 2 PI_NOUI = 1 PT_MANDATORY = 4 PT_ROAMING = 2 PT_TEMPORARY = 1 # functions def CreateEnvironmentBlock(*args, **kwargs): # re...
2.3125
2
app/web/obtain_url.py
gpp0725/EchoProxy
0
14305
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/3/4 0004 2:09 # @Author : Gpp # @File : obtain_url.py from app.web import api from flask_restful import Resource from flask import make_response, send_from_directory, jsonify from app.helper.encrypt import two_encrypting from app.crud.proxy_crud i...
2.546875
3
oshino/run.py
CodersOfTheNight/oshino
6
14306
<reponame>CodersOfTheNight/oshino import logging from argparse import ArgumentParser from dotenv import load_dotenv, find_dotenv from .config import load from .core.heart import start_loop logger = logging.getLogger(__name__) try: load_dotenv(find_dotenv()) except Exception as ex: logger.error("Error while...
2.171875
2
sendmail_win_cs.py
Fatman13/gta_swarm
0
14307
<gh_stars>0 #!/usr/bin/env python # coding=utf-8 import glob import click import os import json import datetime import re import csv from requests.exceptions import ConnectionError from exchangelib import DELEGATE, IMPERSONATION, Account, Credentials, ServiceAccount, \ EWSDateTime, EWSTimeZone, Confi...
2.5
2
utilities/access_concatenate_daily.py
pizzathief/PyFluxPro
1
14308
""" Purpose: Reads the hourly ACCESS files pulled from the BoM OPeNDAP site and concatenates them into a single file. This script file takes a control file name on the command line. The control file lists the sites to be processed and the variables to be processed. Normal usage is to process all files in a monthl...
2.734375
3
AMAO/apps/Avaliacao/views/exibir.py
arruda/amao
2
14309
# -*- coding: utf-8 -*- from django.http import HttpResponse from django.contrib.auth import login from django.shortcuts import redirect, get_object_or_404 from django.contrib.auth.decorators import login_required from Aluno.views.utils import aluno_exist from annoying.decorators import render_to from django.contrib...
2.109375
2
avem_theme/functions/sanitize.py
mverleg/django-boots-plain-theme
0
14310
<gh_stars>0 try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse from django.conf import settings DEFAULT_NOSCR_ALLOWED_TAGS = 'strong:title b i em:title p:title h1:title h2:title h3:title h4:title h5:title ' + \ 'div:title span:title ol ul li:title a:href:title:rel img:src:alt...
2.5625
3
plotDiff_log.py
kmoskovtsev/Electrons-on-Helium-Scripts
0
14311
from __future__ import division import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import matplotlib.ticker as mticker import gsd import gsd.fl import numpy as np import os import sys import datetime import time import pickle from shutil import copyfile import inspect import md_tools...
2.203125
2
backuppy/cli/put.py
drmorr0/backuppy
4
14312
<reponame>drmorr0/backuppy import argparse import staticconf from backuppy.args import add_name_arg from backuppy.args import subparser from backuppy.manifest import lock_manifest from backuppy.manifest import Manifest from backuppy.stores import get_backup_store def main(args: argparse.Namespace) -> None: stat...
2.3125
2
OnePy/feeds/feedbase.py
sibuzu/OnePy
0
14313
<reponame>sibuzu/OnePy from abc import abstractmethod, ABCMeta import csv from datetime import datetime import funcy as fy from OnePy.barbase import Current_bar, Bar from OnePy.event import events, MarketEvent class FeedMetabase(metaclass=ABCMeta): dtformat = "%Y-%m-%d %H:%M:%S" tmformat = "%H:%M:%S" t...
2.375
2
conanfile.py
hsdk123/corrade
0
14314
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile, CMake, tools from conans.errors import ConanException import os import shutil def sort_libs(correct_order, libs, lib_suffix='', reverse_result=False): # Add suffix for correct string matching correct_order[:] = [s.__add__(lib_suffix)...
2.078125
2
tests/test_null.py
StephenNneji/python-fastjsonschema
0
14315
import pytest from fastjsonschema import JsonSchemaException exc = JsonSchemaException('data must be null', value='{data}', name='data', definition='{definition}', rule='type') @pytest.mark.parametrize('value, expected', [ (0, exc), (None, None), (True, exc), ('abc', exc), ([], exc), ({}, exc...
2.578125
3
server/api/python/comprehension.py
DigitalCompanion/trustometer
8
14316
import boto3 import json def init(ACCESS_KEY, SECRET_KEY): return boto3.client(service_name='comprehend', region_name="us-west-2", aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY) def get_entities(client, title): return client.detect_entities(Text=title, LanguageCode='en').get('Entitie...
2.15625
2
checkrightrotate.py
parasshaha/Python-
0
14317
<filename>checkrightrotate.py def checkrot(str1,str2): if len(str1)==len(str2): str3=str1+str1 ad=str3.__contains__(str2) if ad==True: print("it is right rotate") else: print("It is not right rotate ") else: print("It is invalid string.Out of range") def main(): str1=input(" Enter the first String...
4.03125
4
bot.py
Fido2603/WatchDog
0
14318
import discord from discord.ext import commands from discord import Embed, Permissions from Util import logger import os import database # Import the config try: import config except ImportError: print("Couldn't import config.py! Exiting!") exit() # Import a monkey patch, if that exists try: import mo...
2.4375
2
connect/eaas/exceptions.py
bdjilka/connect-extension-runner
0
14319
# # This file is part of the Ingram Micro CloudBlue Connect EaaS Extension Runner. # # Copyright (c) 2021 Ingram Micro. All Rights Reserved. # class EaaSError(Exception): pass class MaintenanceError(EaaSError): pass class CommunicationError(EaaSError): pass class StopBackoffError(EaaSError): pass
1.140625
1
tests/i18n/patterns/urls/wrong_namespace.py
Yoann-Vie/esgi-hearthstone
0
14320
from django.conf.urls import url from django.conf.urls.i18n import i18n_patterns from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView view = TemplateView.as_view(template_name='dummy.html') app_name = 'account' urlpatterns = i18n_patterns( url(_(r'^register...
1.648438
2
gsheetsdb/url.py
JagritiG/gsheet-db-api-plus
0
14321
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from collections import OrderedDict from moz_sql_parser import parse as parse_sql import pyparsing import re from six.moves.urllib import parse FROM_REGEX = re.compile...
2.15625
2
weechat/.weechat/python/autoload/weechat_bot2human.py
CoelacanthusHex/dotfiles
10
14322
# -*- coding:utf-8 -*- # Bot2Human # # Replaces messages from bots to humans # typically used in channels that are connected with other IMs using bots # # For example, if a bot send messages from XMPP is like `[nick] content`, # weechat would show `bot | [nick] content` which looks bad; this script # make weecaht displ...
2.53125
3
MS-thesis/excel-format/sir/Updated/New folder/test.py
iffishells/Pushto-TTS-FYP
2
14323
import xlrd import pandas as pd from openpyxl import load_workbook from xlrd import open_workbook import nltk from nltk.tree import Tree from nltk.parse.generate import generate from nltk.tree import * import os from nltk.tokenize import word_tokenize from nltk.tokenize import sent_tokenize import xml.etree....
2.453125
2
RFEM/SpecialObjects/intersection.py
Dlubal-Software/RFEM_Python_Client
16
14324
<filename>RFEM/SpecialObjects/intersection.py from RFEM.initModel import Model, clearAtributes class Instersection(): def __init__(self, no: int = 1, surface_1: int = 1, surface_2: int = 2, comment: str = '', params: dict = None, ...
2.8125
3
tests/test_storage.py
HumanCellAtlas/data-store
46
14325
#!/usr/bin/env python # coding: utf-8 import os import sys import string import unittest from uuid import uuid4 from unittest import mock from random import random, randint from datetime import datetime, timedelta pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa sys.path.insert(0, pkg...
2.046875
2
headless/ches_prod_test_titles_headless.py
sherrli/Testing-Automation
1
14326
<gh_stars>1-10 #!/usr/local/bin/python # coding=utf-8 # Headless firefox title test for jenkins build. intro=""" ---------------------------------------------------------------- File : ches_prod_test_titles_headless.py Description : Headless firefox title test for ches prod sites. Author : <NAME> --------...
2.28125
2
pyteiser/matchmaker.py
goodarzilab/pyteiser
6
14327
<reponame>goodarzilab/pyteiser<filename>pyteiser/matchmaker.py import numba import time from . import glob_var from . import structures # for some reason, caching of this function fails the run on Columbia HPC and it doesn't really affect the speed # since it only needs to compile once but it's getting called so ma...
2.046875
2
clean.py
stephtdouglas/k2spin
0
14328
<filename>clean.py """Basic cleanup on lightcurves (trimming, sigma-clipping).""" import logging import numpy as np import matplotlib.pyplot as plt import k2spin.utils as utils from k2spin import detrend def trim(time, flux, unc_flux): """Remove infs, NaNs, and negative flux values. Inputs ------ t...
2.484375
2
nested ternary.py
ps2809/Python-Examples
1
14329
<filename>nested ternary.py<gh_stars>1-10 a=int(input('enter a:')) b=int(input('enter b:')) c=int(input('enter c:')) min_value= a if a<b and a<c else b if b<c else c print(min_value)
3.59375
4
pylinsql/timing.py
hunyadi/pylinsql
0
14330
<filename>pylinsql/timing.py import asyncio import functools import time def _log_func_timing(f, args, kw, sec: float): print("func: %r args: [%r, %r] took: %2.4f sec" % (f.__name__, args, kw, sec)) def timing(f): "Decorator to log" if asyncio.iscoroutinefunction(f): @functools.wraps(f) ...
2.796875
3
examples/wsgi_usage/apache_modwsgi_server_example.py
digimatspa/python-jsonrpc
97
14331
#!/usr/bin/env python # coding: utf-8 # BEGIN --- required only for testing, remove in real world code --- BEGIN import os import sys THISDIR = os.path.dirname(os.path.abspath(__file__)) APPDIR = os.path.abspath(os.path.join(THISDIR, os.path.pardir, os.path.pardir)) sys.path.insert(0, APPDIR) # END --- required only f...
2.140625
2
dicomToProjection/convertDicoms.py
tarolangner/mri_biometry
0
14332
<filename>dicomToProjection/convertDicoms.py import os import sys import io import time import zipfile import pydicom import numpy as np import scipy.interpolate import numba_interpolate from skimage import filters import nrrd import cv2 c_out_pixel_spacing = np.array((2.23214293, 2.23214293, 3.)) c_resample_tol...
2.359375
2
ffttest.py
teslaworksumn/Reactor
0
14333
# From http://julip.co/2012/05/arduino-python-soundlight-spectrum/ # Python 2.7 code to analyze sound and interface with Arduino import pyaudio # from http://people.csail.mit.edu/hubert/pyaudio/ import serial # from http://pyserial.sourceforge.net/ import numpy # from http://numpy.scipy.org/ import audioop import ...
2.796875
3
monitoring/perf-monitor-test.py
abhisheksawarkar/gcp-ml-ops
30
14334
# Copyright (c) 2021 NVIDIA Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
1.984375
2
daemon/core/gui/dialogs/throughput.py
montag451/core
0
14335
""" throughput dialog """ import tkinter as tk from tkinter import ttk from typing import TYPE_CHECKING from core.gui.dialogs.colorpicker import ColorPickerDialog from core.gui.dialogs.dialog import Dialog from core.gui.themes import FRAME_PAD, PADX, PADY if TYPE_CHECKING: from core.gui.app import Application c...
2.59375
3
backend/api/tests/unit_tests/test_cards.py
hieutt99/aidudu
3
14336
from django.test.client import BOUNDARY from api.tests.unit_tests.utils import * class CardTest(APITestCase): # url = reverse('card-detail') def setUp(self): hook_init_APITestCase(self) self.test_workspace = Workspace.objects.create( name='test_workspace', # default va...
2.4375
2
mouse.py
Ra-Na/android-mouse-cursor
7
14337
import socket def getch(): # define non-Windows version import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) ret...
2.90625
3
routes/process_tag.py
PowerSaucisse/QuarKEY-api-server
5
14338
<filename>routes/process_tag.py<gh_stars>1-10 from utils.security.auth import AccountAuthToken import falcon, uuid, datetime from routes.middleware import AuthorizeResource from utils.base import api_validate_form, api_message from utils.config import AppState class ProcessTag: def __init__(self) -> None: ...
2.25
2
players/human.py
pikatyuu/deep-learning-othello
0
14339
class Human(): def __init__(self, name="Human"): self.name = name def action(self, game): safe_input = False while not safe_input: pos = input("choose a position: ") if pos == "draw": game.draw() elif pos == "exit": imp...
3.71875
4
HackerEarth/Python/BasicProgramming/InputOutput/BasicsOfInputOutput/SeatingArrangement.py
cychitivav/programming_exercises
0
14340
#!/Usr/bin/env python """ Akash and Vishal are quite fond of travelling. They mostly travel by railways. They were travelling in a train one day and they got interested in the seating arrangement of their compartment. The compartment looked something like So they got interested to know the seat number facing them ...
4.25
4
vault_password.py
RMuskovets/empireofcode
1
14341
def golf(p): return len(p)>9 and p!=p.lower() and p!=p.upper() and any('0'<=l and l<='9' for l in p)
3.296875
3
analysis/marc_verification_sharp.py
maxschalz/studious_potato
0
14342
#!/usr/bin/env python3 import matplotlib matplotlib.use('pgf') import matplotlib.pyplot as plt import numpy as np from multi_isotope_calculator import Multi_isotope import plotsettings as ps plt.style.use('seaborn-darkgrid') plt.rcParams.update(ps.tex_fonts()) def main(): plot() #figure5() def figure1(): ...
2.546875
3
clase6/clases.py
Tank3-TK3/codigo-basico-Python
7
14343
class Animals: def comer(self): print("Comiendo") def dormir(self): print("Durmiendo") class Perro: def __init__(self, nombre): self.nombre = nombre def comer(self): print("Comiendo") def dormir(self): print("Durmiendo") def ladrar(self): print("Ladrando") print("----------------------...
3.6875
4
homeworks_advanced/homework2_attention_in_seq2seq/modules.py
BiscuitsLayer/ml-mipt
1
14344
<reponame>BiscuitsLayer/ml-mipt<filename>homeworks_advanced/homework2_attention_in_seq2seq/modules.py import random import torch from torch import nn from torch.nn import functional as F class Encoder(nn.Module): def __init__(self, input_dim, emb_dim, hid_dim, n_layers, dropout): super().__init__() ...
2.796875
3
zipselected/__init__.py
raguay/ZipSelected
6
14345
<reponame>raguay/ZipSelected from fman import DirectoryPaneCommand, show_alert import os import zipfile from fman.url import as_human_readable from fman.url import as_url def zipdir(rootZip, path, ziph): numf = 0 # ziph is zipfile handle for root, dirs, files in os.walk(path): for file ...
2.828125
3
functions/aurora_check_status.py
aws-samples/aws-stepfunctions-aurora-clone
7
14346
import boto3 client = boto3.client('rds') def lambda_handler(event, context): target_db_cluster_identifier=event['TargetDBClusterIdentifier'] payload = event.copy() try: response = client.describe_db_clusters(DBClusterIdentifier=target_db_cluster_identifier) payload...
2.015625
2
smellCatalog/InputProcessor.py
neilernst/smells
0
14347
<filename>smellCatalog/InputProcessor.py import re from Smell import Smell from SmellCategory import SmellCategory from Reference import Reference SMELL = "\[smell\]" SMELL_ID = "\[smell-id\]" SMELL_NAME = "\[smell-name\]" SMELL_END = "\[smell-end\]" SMELL_DES = "\[smell-description\]" SMELL_AKA = "\[smell-aka\]" SMEL...
2.65625
3
YorForger/modules/redis/afk_redis.py
Voidxtoxic/kita
0
14348
<reponame>Voidxtoxic/kita from YorForger import REDIS # AFK def is_user_afk(userid): rget = REDIS.get(f"is_afk_{userid}") return bool(rget) def start_afk(userid, reason): REDIS.set(f"is_afk_{userid}", reason) def afk_reason(userid): return strb(REDIS.get(f"is_afk_{userid}")) def end_afk(userid)...
2.140625
2
mini_event.py
shubhamjain/earphone-event
6
14349
<reponame>shubhamjain/earphone-event import threading class mini_event: BUTTON_DOWN = 1 BUTTON_UP = 2 BUTTON_HOLD = 3 subscribers = { BUTTON_DOWN: [], BUTTON_UP : [], BUTTON_HOLD: [] } trigger_hold_stop = False # This value should be turned to True if the hold event callback needs to be stopped. ...
3.0625
3
tin/utils.py
balazsdukai/tin2stardb
0
14350
<gh_stars>0 # -*- coding: utf-8 -*- """Various utility functions for handling geometry etc.""" import math from statistics import mean from typing import Tuple, Union, Iterable, Generator, Mapping import logging MODULE_MATPLOTLIB_AVAILABLE = True try: import matplotlib.pyplot as plt import matplotlib.lines a...
2.53125
3
tfworker/cli.py
objectrocket/terraform-worker
6
14351
<gh_stars>1-10 #!/usr/bin/env python # Copyright 2020 <NAME> (<EMAIL>) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
2.03125
2
shs/input/dialogs/ac_init.py
ansobolev/shs
1
14352
import wx from wx.lib.agw.floatspin import FloatSpin from shs.input.fdf_options import ChoiceLine, MeasuredLine, NumberLine, ThreeNumberLine try: from geom import Geom except ImportError: from shs.geom import Geom class Bravais(ChoiceLine): label = 'Composition' choices = ['BCC', 'FCC', 'SC'] o...
2.125
2
mgs/v1.0/data_server.py
vt-rocksat-2017/dashboard
1
14353
#!/usr/bin/env python ######################################### # Title: Rocksat Data Server Class # # Project: Rocksat # # Version: 1.0 # # Date: August, 2017 # # Author: <NAME>, KJ4QLP # # Comment: Initial Version # ########...
2.390625
2
handledata.py
bioPunkKitchen/climate.local
1
14354
#!/usr/bin/env python3 import datetime import time import os import matplotlib.pyplot as plt import matplotlib.dates as md import numpy as np class handle_data: data_file = "./data/data.log" data_list = [] def __init__(self): pass def insert_data(self, timestamp, temp, state_onoff, state_light, state_cool...
2.859375
3
day01/python/beckel/solution.py
clssn/aoc-2019
22
14355
import math def fuel_needed(mass): return math.floor(int(mass)/3 - 2) def fuel_needed_recursive(mass): fuel_needed_i = fuel_needed(mass) if (fuel_needed_i <= 0): return 0 return fuel_needed_i + fuel_needed_recursive(fuel_needed_i) total_fuel = 0 total_fuel_recursive = 0 with open("input.txt"...
3.84375
4
arraytool_rc.py
zinka/arraytool_gui
11
14356
<filename>arraytool_rc.py<gh_stars>10-100 # -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt4 (Qt v4.8.7) # # WARNING! All changes made in this file will be lost! from PySide import QtCore qt_resource_data = "\ \x00\x00\x03\x97\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x0...
1.359375
1
xinyu/python/node/graphicNode/turtle/base_graphics.py
xzhuah/codingDimension
1
14357
# Created by <NAME> on 2021/6/6, 21:08 from turtle import Turtle import turtle def draw_rectangle(turtle: Turtle, llx, lly, width, height): turtle.up() turtle.goto(llx, lly) turtle.begin_fill() turtle.down() turtle.goto(llx + width, lly) turtle.goto(llx + width, lly + height) turtle.goto(...
3.9375
4
deform_conv/cnn.py
lone17/deform-conv
0
14358
<gh_stars>0 from __future__ import absolute_import, division from keras.layers import * from deform_conv.layers import ConvOffset2D def get_cnn(): inputs = l = Input((None, None, 1), name='input') # conv11 l = Conv2D(32, (3, 3), padding='same', name='conv11')(l) l = Activation('relu', name='conv11_...
2.640625
3
perf/unit/ledger_rest.py
jancajthaml-openbank/e2e
0
14359
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- from unit.common import Unit from helpers.eventually import eventually from helpers.shell import execute import string import time import os class LedgerRest(Unit): def __init__(self): (code, result) = execute([ "systemctl", "start", 'ledger-res...
2.3125
2
pythonneat/neat/Population.py
SananR/PythonNEAT
2
14360
from pythonneat.neat.Species import Species import pythonneat.neat.Speciation as Speciation import pythonneat.neat.utils.Parameters as Parameters current_genomes = [] def add_genome(genome): """Adds genome to the species list based on its compatability distance to already existing species Inputs: ge...
2.890625
3
container_service_extension/pksclient/api/__init__.py
tschoergez/container-service-extension
0
14361
<reponame>tschoergez/container-service-extension from __future__ import absolute_import # flake8: noqa # import apis into api package from container_service_extension.pksclient.api.cluster_api import ClusterApi from container_service_extension.pksclient.api.plans_api import PlansApi from container_service_extension.p...
0.984375
1
examples/applications/clustering/agglomerative.py
SahanJayasinghe/sentence-transformers
2
14362
""" This is a simple application for sentence embeddings: clustering Sentences are mapped to sentence embeddings and then agglomerative clustering with a threshold is applied. """ from sentence_transformers import SentenceTransformer from sklearn.cluster import AgglomerativeClustering import numpy as np embedder = Se...
3.765625
4
generated-libraries/python/netapp/vserver/vserver_aggr_info.py
radekg/netapp-ontap-lib-get
2
14363
<reponame>radekg/netapp-ontap-lib-get<gh_stars>1-10 from netapp.netapp_object import NetAppObject class VserverAggrInfo(NetAppObject): """ Assigned aggregate name and available size. """ _aggr_availsize = None @property def aggr_availsize(self): """ Assigned aggregate avail...
2.1875
2
sample4.py
vswamy/python
0
14364
<filename>sample4.py #Learning Python import os list = [1,2,3] ##using list as a queue print(list) list.pop(0) print(list) list.append(5) print(list)
3.421875
3
python/hongong/ch05/05_2.py
gangserver/py_test
0
14365
import pandas as pd wine = pd.read_csv('https://bit.ly/wine-date') # wine = pd.read_csv('../data/wine.csv') print(wine.head()) data = wine[['alcohol', 'sugar', 'pH']].to_numpy() target = wine['class'].to_numpy() from sklearn.model_selection import train_test_split train_input, test_input, train_target, test_target ...
3.015625
3
junk/dot_classifier_tf/potential.py
jpzwolak/quantum-ml
4
14366
# Module to build a potential landscape import numpy as np def gauss(x,mean=0.0,stddev=0.02,peak=1.0): ''' Input: x : x-coordintes Output: f(x) where f is a Gaussian with the given mean, stddev and peak value ''' stddev = 5*(x[1] - x[0]) return peak*np.exp(-(x-mean)**2/(2*stddev**2)) d...
3.234375
3
src/data/879.py
NULLCT/LOMC
0
14367
from sys import stdin input = stdin.readline from collections import deque N, Q = map(int, input().split()) tree = [[] for _ in range(N + 1)] level = [0] * (N + 1) for _ in range(N - 1): a, b = map(int, input().split()) tree[a].append(b) tree[b].append(a) visited = [False] * (N + 1) def bfs(st): glo...
3.28125
3
objectfactory/nested.py
devinaconley/py-object-factory
4
14368
""" nested field implements marshmallow field for objectfactory nested objects """ # lib import marshmallow # src from .serializable import Serializable from .factory import create class NestedFactoryField( marshmallow.fields.Field ): def __init__( self, field_type=None, **kwargs ): super().__init__( ...
2.8125
3
spacy/cli/__init__.py
g4brielvs/spaCy
2
14369
<reponame>g4brielvs/spaCy from wasabi import msg from ._util import app, setup_cli # noqa: F401 # These are the actual functions, NOT the wrapped CLI commands. The CLI commands # are registered automatically and won't have to be imported here. from .download import download # noqa: F401 from .info import info # no...
1.960938
2
code/example code/introducing-python-master/1st_edition/art/panda1.py
ChouHsuan-Cheng/Learning_Python_Base
0
14370
<reponame>ChouHsuan-Cheng/Learning_Python_Base<gh_stars>0 from direct.showbase.ShowBase import ShowBase class MyApp(ShowBase): def __init__(self): ShowBase.__init__(self) # Load the environment model. self.environ = self.loader.loadModel("models/environment") # Reparent the model ...
3.015625
3
btclib/ssa.py
giubby84/btclib
0
14371
<filename>btclib/ssa.py #!/usr/bin/env python3 # Copyright (C) 2017-2020 The btclib developers # # This file is part of btclib. It is subject to the license terms in the # LICENSE file found in the top-level directory of this distribution. # # No part of btclib including this file, may be copied, modified, propagated,...
1.84375
2
13. REST API using OpenAPI, Flask & Connexions/source_code/test-api/src/test_api/core/pets.py
Edmartt/articles
31
14372
import json def get_all_pets(): pets = read_from_file() pets_in_store = [] for k, v in pets.items(): current_pet = {"id": k, **v} pets_in_store.append(current_pet) return pets def remove_pet(id): pets = read_from_file() del pets[id] write_to_file(pets) def update_pet(i...
3.15625
3
CodeWars/8 Kyu/Price of Mangoes.py
anubhab-code/Competitive-Programming
0
14373
<reponame>anubhab-code/Competitive-Programming<gh_stars>0 def mango(quantity, price): return (quantity - quantity // 3) * price
2.4375
2
car-number-plate.project/car number plate.py
SumanthKumarS/mrucode-car-numberplate-detection-
0
14374
<filename>car-number-plate.project/car number plate.py<gh_stars>0 import matplotlib.pyplot as plt import cv2 import imutils import pytesseract as pt from tkinter import * from tkinter import messagebox # ploting the images def plot_img(img1, img2, title1="", title2=""): fig = plt.figure(figsize=[5, 5]) ...
3.109375
3
IBMWatson_Examples/WatsonNLU.py
sptennak/TextAnalytics
4
14375
<filename>IBMWatson_Examples/WatsonNLU.py # -*- coding: utf-8 -*- """ Created on Fri May 18 22:15:35 2018 @author: <NAME> References: [1] https://www.ibm.com/watson/developercloud/natural-language-understanding/api/v1/ """ from watson_developer_cloud import NaturalLanguageUnderstandingV1, WatsonException, WatsonApiEx...
2.109375
2
invenio_drafts_resources/resources/records/resource.py
fenekku/invenio-drafts-resources
0
14376
# -*- coding: utf-8 -*- # # Copyright (C) 2020 CERN. # Copyright (C) 2020 Northwestern University. # # Invenio-Drafts-Resources is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Invenio Drafts Resources module to create REST APIs.""...
2.203125
2
pyscreener/preprocessing/gypsum_dl/Steps/SMILES/dimorphite_dl/dimorphite_dl.py
futianfan/pyscreener
28
14377
# Copyright 2020 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
2.125
2
src/visuanalytics/tests/analytics/transform/transform_test_helper.py
mxsph/Data-Analytics
3
14378
<filename>src/visuanalytics/tests/analytics/transform/transform_test_helper.py from visuanalytics.analytics.control.procedures.step_data import StepData from visuanalytics.analytics.transform.transform import transform def prepare_test(values: list, data, expected_data: dict, config=None): if config is None: ...
1.828125
2
configs/diseased/resnet50_cancer_adddata.py
jiangwenj02/mmclassification
0
14379
_base_ = [ '../_base_/models/resnet50.py', '../_base_/datasets/cancer_bs32_pil_resize.py', '../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py' ] model = dict( head=dict( num_classes=2, topk=(1,)) ) data = dict( train=dict( data_prefix='/data3/zzhang/tmp...
1.59375
2
polyaxon/scheduler/dockerizer_scheduler.py
vfdev-5/polyaxon
0
14380
<filename>polyaxon/scheduler/dockerizer_scheduler.py import logging import traceback from kubernetes.client.rest import ApiException from django.conf import settings import auditor from constants.jobs import JobLifeCycle from db.models.build_jobs import BuildJob from docker_images.image_info import get_tagged_image...
2.03125
2
test/test_pyini.py
limodou/uliweb3
16
14381
<filename>test/test_pyini.py #coding=utf8 from uliweb.utils.pyini import * def test_sorteddict(): """ >>> d = SortedDict() >>> d <SortedDict {}> >>> d.name = 'limodou' >>> d['class'] = 'py' >>> d <SortedDict {'class':'py', 'name':'limodou'}> >>> d.keys() ['name', 'class'] >>...
2.46875
2
src/game.py
cwainwright/think-inside-the-box
0
14382
import threading from queue import Queue from blessed import Terminal FPS = 60 class Game: """The top level class for the game""" def __init__(self, manager_cls: type): self.manager_cls = manager_cls def run(self) -> None: """The run method for the game, handling the TUI""" ter...
2.796875
3
alice_scripts/skill.py
borzunov/alice_scripts
27
14383
<reponame>borzunov/alice_scripts import logging import threading import flask from .requests import Request __all__ = ['Skill'] class Skill(flask.Flask): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._sessions = {} self._session_lock = threading.RLock() ...
2.25
2
src/main/fileextractors/fileextractor.py
michael-stanin/Subtitles-Distributor
1
14384
import logging from main.fileextractors.compressedfile import get_compressed_file from main.utilities.fileutils import dir_path from main.utilities.subtitlesadjuster import ArchiveAdjuster class FileExtractor: def __init__(self, subname, movfile): self.sn, self.mn = subname, movfile self.subzip = ...
2.640625
3
cjson/body.py
tslight/cjson
0
14385
import curses from get_json import get_json def body(screen): div = curses.newwin(curses.LINES - 2, curses.COLS, 1, 0) div.box() # draw border around container window # use a sub-window so we don't clobber the the container window's border. txt = div.subwin(curses.LINES - 5, curses.COLS - 4, 2, 2) ...
3.03125
3
SDis_Self-Training/plotting/createScatterPlot.py
mgeorgati/DasymetricMapping
0
14386
import sys, os, seaborn as sns, rasterio, pandas as pd import numpy as np import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from config.definitions import ROOT_DIR, ancillary_path, city,year attr_value ="totalpop" gtP = ROOT_DIR + "/Evaluation/{0}_groundT...
2.3125
2
codepack/service/delivery_service/delivery_service.py
ihnokim/codepack
2
14387
import abc from codepack.service.service import Service class DeliveryService(Service, metaclass=abc.ABCMeta): def __init__(self): super().__init__() @abc.abstractmethod def send(self, id, serial_number, item=None, timestamp=None): """send item""" @abc.abstractmethod def receive(...
3.25
3
nengo/tests/test_learning_rules.py
pedrombmachado/nengo
0
14388
import numpy as np import pytest import nengo from nengo.builder import Builder from nengo.builder.operator import Reset, Copy from nengo.builder.signal import Signal from nengo.dists import UniformHypersphere from nengo.exceptions import ValidationError from nengo.learning_rules import LearningRuleTypeParam, PES, BCM...
2
2
joplin_web/api.py
foxmask/joplin-web
382
14389
# coding: utf-8 """ joplin-web """ from django.conf import settings from django.http.response import JsonResponse from django.urls import reverse from joplin_api import JoplinApiSync from joplin_web.utils import nb_notes_by_tag, nb_notes_by_folder import logging from rich import console console = console.Console() ...
2.15625
2
blousebrothers/confs/management/commands/update_stats.py
sladinji/blousebrothers
1
14390
import numpy as np from django.core.management.base import BaseCommand from oscar.core.loading import get_classes StatsSpe, StatsItem, Test, Speciality, Item, Conference = get_classes( 'confs.models', ( "StatsSpe", "StatsItem", "Test", "Speciality", "Item", "Conference" ) ) class Command(BaseCo...
2.046875
2
ssd_project/functions/multiboxloss.py
ilijagjorgjiev/SSD_FascadeParsing
1
14391
<filename>ssd_project/functions/multiboxloss.py import torch import torch.nn as nn import torch.nn.functional as F from math import sqrt as sqrt import collections import numpy as np import itertools from ssd_project.utils.utils import * from ssd_project.utils.global_variables import * device = DEVICE class MultiBoxLo...
2.46875
2
glitter2/tests/app.py
matham/glitter2
0
14392
<filename>glitter2/tests/app.py<gh_stars>0 import trio from kivy.config import Config Config.set('graphics', 'width', '1600') Config.set('graphics', 'height', '900') Config.set('modules', 'touchring', '') for items in Config.items('input'): Config.remove_option('input', items[0]) from glitter2.main import Glitte...
2.171875
2
Gateway/WSService/Controller.py
reability/BruteScanner
0
14393
from aiohttp import web from aiohttp import WSMsgType from Settings import log class WebSocket(web.View): async def get(self): ws = web.WebSocketResponse() await ws.prepare(self.request) self.request.app['websockets'].append(ws) async for msg in ws: if msg.type == WS...
2.5625
3
data/kbqa/parse_kbqa.py
UKPLab/TWEAC-qa-agent-selection
9
14394
import json import os def qald(in_folder, out_folder): train = json.load(open(os.path.join(in_folder, "qald-7-train-en-wikidata.json"))) test = json.load(open(os.path.join(in_folder, "qald-7-test-en-wikidata-withoutanswers.json"))) train_q = [] test_q = [] for qs in train["questions"]: fo...
2.609375
3
flink_rest_client/common.py
frego-dev/flink-rest-client
0
14395
<filename>flink_rest_client/common.py import requests class RestException(Exception): """ Exception to catch REST API related exceptions. """ def __init__(self, *args: object) -> None: super().__init__(*args) def _execute_rest_request( url, http_method=None, accepted_status_code...
2.796875
3
functions.py
emiliozamorano15/arvato-udacity-capstone
0
14396
<reponame>emiliozamorano15/arvato-udacity-capstone<filename>functions.py import pandas as pd import numpy as np def missing_dict(df): ''' Function to build a dictionary of indicators of missing information per feature INPUT: df: pandas dataframe with features, description, and values that mean "unknow...
4.125
4
PYTHON_POO/AFmain.py
davihonorato/Curso-python
0
14397
<reponame>davihonorato/Curso-python # Criar uma base de dados. O usuário pode adicionar, excluir e listar clientes (que possuem id e nome). # *utilizar encapsulamento. class Clientes: def __init__(self): self.__lista = {} # Recomenda-se estritamente não modificar essa variável def adicionar_cliente(...
3.78125
4
env/lib/python3.4/site-packages/jsonrpc/tests/test_utils.py
Organizational-Proof-Of-Work/clearinghoused_build
0
14398
""" Test utility functionality.""" import datetime import decimal import json import sys if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest from mock import patch from ..utils import JSONSerializable, DatetimeDecimalEncoder class TestJSONSerializable(unittest.TestCase): ""...
2.859375
3
neutron/db/migration/alembic_migrations/versions/14be42f3d0a5_default_sec_group_table.py
osic-neutron/neutron-ipcapacity
1
14399
<reponame>osic-neutron/neutron-ipcapacity # Copyright 2015 OpenStack Foundation # # 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...
1.890625
2