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
utilities.py
aws-samples/real-time-churn-prediction-with-amazon-connect-and-amazon-sagemaker
0
12783751
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # # 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...
1.890625
2
Codes/Files to SQL/communes.py
ThibaultLanthiez/Projet-observatoire-UNICAEN
0
12783752
<reponame>ThibaultLanthiez/Projet-observatoire-UNICAEN import sqlite3 import csv conn = sqlite3.connect('data.db') c= conn.cursor() with open('villes_france.csv', newline='') as csvfile: csvfile.readline() spamreader = csv.reader(csvfile, delimiter=',', quotechar='\"') for row in spamreader : requ...
3.234375
3
net_io.py
Kaslanarian/welt-net
4
12783753
import numpy as np from net import Net from functional import * from os import remove temp_path = "./model/param" def save_model(net: Net, name: str): ''' 将网络信息保存 parameters ---------- net : 神经网络类 name : 文件名,文件将被保存到model文件夹中的指定名称文件中 return ------ 1 : 表示保存成功 ''' path = "....
2.421875
2
First_Example/Basic_Truss.py
johnkour/Openseespy_projects
0
12783754
# Basic truss example in Openseespy: import openseespy.opensees as ops import openseespy.postprocessing.Get_Rendering as opsplt ############################################################################## ##### Define units in SI ##### #########################...
2.65625
3
magpie.py
kratos-batteries/data_extract
1
12783755
from __future__ import print_function import pandas as pd import json import sys import requests _api_version = str('0.0.1') class MagpieServer: """Object to store how to connect to a server running Magpie""" _url = None """ URL of server """ _models = None """ Cached information about models...
3.296875
3
djangocms_moderation/__init__.py
Aiky30/djangocms-moderation
2
12783756
__version__ = "1.0.28" default_app_config = "djangocms_moderation.apps.ModerationConfig"
1.039063
1
src/mesh_edit.py
mbirkholzupc/hmd
259
12783757
<filename>src/mesh_edit.py import numpy as np from scipy import sparse from scipy.sparse.linalg import lsqr, cg, eigsh import matplotlib.pyplot as plt import scipy.io as sio import pickle import sparseqr import time WEIGHT = 1.0 ############################################################## ## Laplac...
2.953125
3
netpyne/sim/gather.py
FernandoSBorges/netpyne
0
12783758
<filename>netpyne/sim/gather.py<gh_stars>0 """ Module for gathering data from nodes after a simulation """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals from __future__ import absolute_import from builtins import zip from future import standard_library ...
2.203125
2
alembic/versions/0184d8fc0100_map_stats.py
FlorianSW/hll_rcon_tool
49
12783759
<filename>alembic/versions/0184d8fc0100_map_stats.py<gh_stars>10-100 """map stats Revision ID: 0184d8fc0100 Revises: <KEY> Create Date: 2021-04-11 13:25:34.188212 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '0184d8fc0100' down_revision = '<KEY>' branch_labe...
1.875
2
pocean/tests/dsg/trajectory/test_trajectory_cr.py
axiom-data-science/pocean-core
13
12783760
#!python # coding=utf-8 import os import unittest import tempfile from os.path import join as jn from os.path import dirname as dn import pytest from pocean.dsg import ContiguousRaggedTrajectory, get_calculated_attributes from pocean.tests.dsg.test_new import test_is_mine import logging from pocean import logger logg...
2.09375
2
share/python/repo/packages.py
globus/globus-release-tools
0
12783761
<filename>share/python/repo/packages.py # Copyright 2014-2015 University of Chicago # # 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 # # Unle...
2.140625
2
src/agent/dora/specifier.py
abagaria/opiq
13
12783762
from .maze_conv import DQN as maze_conv def get_net(name): nets = { "maze": maze_conv, } return nets[name]
2
2
src/nitsm/debug.py
ni/nitsm-python
4
12783763
<reponame>ni/nitsm-python import os import tkinter.messagebox def prompt_attach_debugger() -> None: """ Pauses the Python interpreter and displays the process ID (PID). The PID can be used by an IDE such as PyCharm to attach to the process for debugging. This is useful for stepping into nitsm code mod...
3.203125
3
src/rctgen/__init__.py
mballance/pyrctgen
1
12783764
<reponame>mballance/pyrctgen<gh_stars>1-10 from .activity_stmts import * from .decorators import * from .claims_refs import * from .types import *
1.085938
1
testplan/common/entity/__init__.py
ymn1k/testplan
0
12783765
<reponame>ymn1k/testplan """Common entity implementations.""" from .base import (Entity, RunnableManager, RunnableManagerConfig, Resource, ResourceStatus, ResourceConfig, Environment, Runnable, RunnableStatus, RunnableConfig, RunnableResult, FailedAction)
0.984375
1
adv/benchmark.py
hcc123915/dl
0
12783766
<filename>adv/benchmark.py import adv_test from adv import * import mikoto def module(): return Mikoto class Mikoto(mikoto.Mikoto): conf = { "mod_a2" : ('crit' , 'chance' , 0.08) , } def pre(this): if this.condition('hp70'): this.conf['mod_a'] = ('crit' , 'passive', 0...
2.46875
2
tests/tod/test_tod_world_script_metrics.py
twstewart42/ParlAI
1
12783767
<gh_stars>1-10 #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Tests tod world metrics in the full script, *without* making the script properly set up the agents on...
2.09375
2
example/plugins/microservices/processors/legacy_processor.py
enricouniurb/Satosa-Saml2Spid
0
12783768
import re from satosa.micro_services.processors.base_processor import BaseProcessor class LegacyProcessor: @staticmethod def codice_fiscale_rs(schacpersonaluniqueids=[], nationprefix=False, nationprefix_sep=':'): if isinstance(schacpersonaluniqueids, str): schacpersonaluniqueids = [schacpe...
2.296875
2
test/test3.py
astraw/svg_stack
91
12783769
#!/usr/bin/env python from __future__ import print_function import subprocess # stack two Inkscape generated files subprocess.check_call( '../svg_stack.py --direction=h --margin=100 red_ball.svg blue_triangle.svg > shapes_test.svg', shell=True) # Inkscape files don't pass xmllint -- don't test print('You sh...
2.359375
2
pyglidein/config.py
xs5871/pyglidein
6
12783770
<reponame>xs5871/pyglidein<filename>pyglidein/config.py try: from configparser import SafeConfigParser except ImportError: from ConfigParser import SafeConfigParser import os import ast class Config(dict): def __init__(self, path, default=os.path.join(os.path.dirname(os.path.abspath(__file__)), ...
2.046875
2
workspaces/tests.py
marcphilippebeaujean-abertay/recur-notion
2
12783771
<reponame>marcphilippebeaujean-abertay/recur-notion from unittest import mock from django.contrib.auth import get_user_model from django.test import TestCase from .models import NotionWorkspace, NotionWorkspaceAccess from .service import create_access_workspace_from_user_code OLD_WORKSPACE_CODE = "54321" OLD_WORKSPA...
2.34375
2
src/parser.py
vistrcm/gsclparser
0
12783772
<gh_stars>0 import logging from typing import Dict, NewType import bs4 from bs4 import BeautifulSoup logger = logging.getLogger(__name__) # some additional types defined BS4ResultSet = NewType("BS4ResultSet", bs4.element.ResultSet) def _parse_attrgroups(attrgroups: BS4ResultSet) -> Dict[str, str]: """parse att...
3.046875
3
libra/ledger_info.py
MoveOnLibra/libra-core
5
12783773
<filename>libra/ledger_info.py from canoser import Struct, BytesT, RustEnum from libra.account_address import Address from libra.block_info import BlockInfo, OptionEpochInfo from libra.epoch_info import EpochInfo from libra.hasher import HashValue, LCSCryptoHash from libra.crypto.ed25519 import ED25519_SIGNATURE_L...
2.203125
2
socket_futures.py
wefner/experiments
1
12783774
#!/usr/bin/env python3 import os import concurrent.futures from time import time from utils import load_csv, write_results, check_open_port # https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor-example start = time() results = {} top_sites = f'{os.path.dirname(os.path.realpath(__file__))}/...
3.125
3
exploit.py
soezayzay/AP-Finder
0
12783775
<reponame>soezayzay/AP-Finder import requests import time import os #Author:SoeZayZay #Github:https://github.com/soezayzay banner = """\033[1;34m _ ____ _____ _ _ / \ | _ \ | ___(_)_ __ __| | ___ _ __ / _ \ | |_) | | |_ | | '_ \ / _` |/ _ \ '__| / ...
2.78125
3
packages/watchmen-rest-doll/src/watchmen_rest_doll/system/external_writer_router.py
Indexical-Metrics-Measure-Advisory/watchmen
0
12783776
from typing import List, Optional from fastapi import APIRouter, Body, Depends from watchmen_auth import PrincipalService from watchmen_meta.common import ask_meta_storage, ask_snowflake_generator from watchmen_meta.system import ExternalWriterService from watchmen_model.admin import UserRole from watchmen_model.comm...
1.921875
2
cardano-node-tests/cardano_node_tests/utils/cli_coverage.py
MitchellTesla/Cardano-SCK
6
12783777
<gh_stars>1-10 """Functionality for CLI coverage data collected by the `clusterlib`.""" import json import logging import shutil from pathlib import Path from typing import Optional from _pytest.config import Config from cardano_clusterlib import clusterlib from cardano_node_tests.utils import helpers LOGGER = loggi...
2.046875
2
rsa_implementation_test.py
thalees/RSA-implementation
0
12783778
<reponame>thalees/RSA-implementation<filename>rsa_implementation_test.py import base64 import binascii from rsa_implementation import (encrypt, dencrypt) def is_base64(s): try: base64.decodebytes(s) return True except binascii.Error: return False public_key_mock = (1577603813908858290...
2.765625
3
detect_conv_roi.py
sc2h6o/DT
0
12783779
import cv2 import os import sys sys.path.append("/home/syc/py-faster-rcnn/caffe-fast-rcnn/python") import caffe import numpy as np import random import time from math import * from utils import * from DataBase import DataBase video_dir = '/media/syc/My Passport/_dataset/tracking2013/' video_name = "Liquor...
2.125
2
webrcon/connector.py
LewdNeko/WebRcon
3
12783780
import asyncio import json import websockets from .exceptions import InvalidServer, ConnectionClosed from .utils import maybe_await # noinspection SpellCheckingInspection class RconConnector: # noinspection PyTypeChecker def __init__(self, host, port, password, message_callback=None, console_callback=None): ...
2.296875
2
scripts/test_endpoints.py
onerandomusername/pixels
0
12783781
<gh_stars>0 import colorsys import math import multiprocessing import random import httpx import requests from PIL import Image from decouple import config api_token = config("API_TOKEN") base_url = config("BASE_URL", default="https://pixels.pythondiscord.com") HEADERS = { "Authorization": f"Bearer {api_token}" ...
2.65625
3
doc/notebooks/frefine.py
rrjudd/jvsip
10
12783782
<reponame>rrjudd/jvsip<filename>doc/notebooks/frefine.py def frefine(a,rs): """ % f = frefine(a,rs); % refine local minima and maxima of H using Newton's method % H : H = a(1)+a(2)*cos(w)+...+a(n+1)*cos(n*w) % rs : initial values for the extrema of H % see also : frefine.m, frefine_e.m """ ...
2.859375
3
src/dominh/constants.py
gavanderhoorn/dominh
25
12783783
<filename>src/dominh/constants.py # Copyright (c) 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 applic...
1.289063
1
lesson13n2_projects/house3n2/data/state_gen_conf.py
muzudho/py-state-machine-practice
0
12783784
"""State Generator""" from lesson12_projects.house3.data.const import ( MY_ROOM, OUT, CLOSE_DOOR, OPEN_DOOR, STAIRS, ) from lesson13n2.states.myroom import MyroomState from lesson13n2.states.out import OutState from lesson13n2.states.out_closedoor import OutClosedoorState from lesson13n2.states.out_...
2.4375
2
main.py
panvlas/pr2
0
12783785
<gh_stars>0 import sys from PyQt5 import QtGui from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import * from PyQt5.uic import loadUi # Основной класс программы class Main(QDialog): def __init__(self): super(Main, self).__init__() loadUi('form.ui', self) # Загрузка формы из файла...
2.53125
3
bootcamp/wiki/plugins/globalhistory/views.py
basiltiger/easy_bootcamp
0
12783786
from __future__ import unicode_literals from django.contrib.auth.decorators import login_required from django.db.models import F from django.utils.decorators import method_decorator from django.views.generic import ListView from wiki import models from wiki.core.paginator import WikiPaginator class GlobalHistory(Lis...
2.046875
2
test/layer/test_patching.py
ControlNet/tensorneko
9
12783787
import unittest from torch import rand from tensorneko.layer import PatchEmbedding2d class TestPatching(unittest.TestCase): # TODO pass class TestPatchEmbedding2d(unittest.TestCase): def test_simple_patching(self): # test input for 64x64 RGB image batches b, c, h, w = (8, 3, 64, 64) ...
2.84375
3
app/ini_utils.py
mbroz/feel-the-streets
5
12783788
<filename>app/ini_utils.py import configparser def ini_file_to_dict(ini_file_path): parser = configparser.ConfigParser() parser.read(ini_file_path) result = {} for section, values in parser.items(): result[section] = {} result[section].update(values) return result def di...
3.0625
3
viewer.py
facerecon/finddash
0
12783789
<filename>viewer.py import cv2 import zmq import base64 import numpy as np ip = input("please enter ip: ") # ip ='10.19.129.177' context = zmq.Context() footage_socket = context.socket(zmq.SUB) footage_socket.setsockopt_string(zmq.SUBSCRIBE, np.unicode('')) footage_socket.connect('tcp://' + ip + ':5555') while True: ...
2.59375
3
models/nlp/electra/utils.py
kevinyang8/deep-learning-models
129
12783790
<reponame>kevinyang8/deep-learning-models from colorama import Fore, Style def colorize(token: str, color: str) -> str: return f"{color}{token}{Style.RESET_ALL}" def colorize_gen(tokenizer, true_ids, gen_ids, mask): gen_ids = gen_ids.numpy() true_ids = true_ids.numpy() mask = mask.numpy() tokens...
2.875
3
onto_app/models.py
Remorax/SemValidator
0
12783791
from flask_sqlalchemy import SQLAlchemy from onto_app import db from onto_app.helper import add_new_ontologies class users(db.Model): __tabelname__ = 'users' id = db.Column(db.String, primary_key=True) username = db.Column(db.String(200), unique=True, nullable=False) # password = db.Column(db.String(20...
2.484375
2
django/first_project/first_app/models.py
SandraCoburn/python-django
0
12783792
from django.db import models ''' SuperUser information: User: Sandra Email: <EMAIL> Password: <PASSWORD> ''' # Create your models here. class Topic(models.Model): top_name = models.CharField(max_length=264, unique=True) def __str__(self) -> str: return self.top_name class Webpage(models.Model): topic...
2.546875
3
step1/paddle/pd_forward.py
rainyBJ/fast-transformer-paddle
0
12783793
<filename>step1/paddle/pd_forward.py import paddle from fast_transformer_pd import FastTransformer import numpy as np from reprod_log import ReprodLogger reprod_logger = ReprodLogger() seed = 42 paddle.seed(seed) model = FastTransformer( num_tokens=20000, dim=512, depth=2, max_seq_len=4096, absolu...
2.28125
2
restaurant_tracker/urls.py
psmith150/restaurant-tracker
0
12783794
<filename>restaurant_tracker/urls.py from django.urls import path from . import views app_name = 'restaurant_tracker' urlpatterns = [ # ex: /restaurants/ path('', views.IndexView.as_view(), name='index'), # ex: /restaurants/1/ path('<int:pk>/', views.RestaurantDetailView.as_view(), name='detail'), ...
1.9375
2
blst/config.py
collinmutembei/II
0
12783795
import os from flask.ext.dotenv import DotEnv BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class Config(object): """Main configuration class""" DEBUG = False TESTING = False CSRF_ENABLED = True SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') SQLALCHEMY_TRACK...
2.140625
2
zmb.py
grm34/ZenMaxBuilder
0
12783796
# -*- coding: utf-8 -*- """ ZenMaxBuilder Copyright © 2021 darkmaster@grm34 https://github.com/grm34 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/l...
1.65625
2
scenarios/dispute_list/executable.py
timgates42/balanced-python
12
12783797
<filename>scenarios/dispute_list/executable.py import balanced balanced.configure('ak-test-<KEY>') disputes = balanced.Dispute.query
1.328125
1
diving_in_python/week_5/client.py
assassinen/coursera_mfti_python
0
12783798
<reponame>assassinen/coursera_mfti_python import socket import time class Client: def __init__(self, host, port, timeout=None): # sock = socket.socket() # sock.connect(("127.0.0.1", 10001)) # sock.sendall("ping".encode("utf8")) # sock.close() # более короткая запись ...
3.25
3
qub/mask_encoding.py
mksarker/data_preprocessing
0
12783799
<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import cv2 import imageio import numpy as np import cv2 as cv import scipy import xmltodict from pycocotools import mask as mask_util ...
2.296875
2
SLpackage/private/pacbio/pythonpkgs/pbcommand/lib/python2.7/site-packages/pbcommand/common_options.py
fanglab/6mASCOPE
5
12783800
"""Common options and utils that can me used in commandline utils""" import logging import argparse import sys RESOLVED_TOOL_CONTRACT_OPTION = "--resolved-tool-contract" EMIT_TOOL_CONTRACT_OPTION = "--emit-tool-contract" def add_debug_option(p): p.add_argument("--pdb", action="store_true", default=False, ...
3.03125
3
stable_nalu/layer/gumbel_nalu.py
wlm2019/Neural-Arithmetic-Units
147
12783801
from .gumbel_nac import GumbelNACLayer from .gumbel_mnac import GumbelMNACLayer from ._abstract_nalu import AbstractNALULayer from ._abstract_recurrent_cell import AbstractRecurrentCell class GumbelNALULayer(AbstractNALULayer): """Implements the Gumbel NALU (Neural Arithmetic Logic Unit) Arguments: i...
2.59375
3
src/clincoded/upgrade/annotation.py
ClinGen/clincoded
30
12783802
from contentbase.upgrader import upgrade_step @upgrade_step('annotation', '1', '2') def annotation_1_2(value, system): # https://github.com/ClinGen/clincoded/issues/453 value['status'] = 'in progress' @upgrade_step('annotation', '2', '3') def annotation_2_3(value, system): # https://github.com/ClinGen/c...
2.09375
2
python_code/easy/111_Minimum_Depth_of_Binary_Tree_easy/solution.py
timshenkao/interview_coding_exercises
0
12783803
# Copyright (c) 2021 - present, <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 # # Unless required by applicable ...
3.921875
4
crawler/crawler.py
manhph2211/SentimentAnalysis
4
12783804
import multiprocessing as mp import pandas as pd from selenium import webdriver from time import sleep import config import json from utils import access_url import argparse def crawler(cate_name,item_links): driver = webdriver.Chrome() fb_li = [] counter = 0 for item_link in item_links: access_url(driver,item_...
2.890625
3
run_continuation.py
RasmooL/dqn-tf
1
12783805
""" Copyright 2016 <NAME> This software may be modified and distributed under the terms of the MIT license. See the LICENSE.txt file for details. """ import sys import time from sacred import Experiment from core.ALEEmulator import ALEEmulator from continuation.OriginalNet import OriginalNet from core.ScreenBuffer i...
2.109375
2
speechtotext/speech_to_text/speech_to_text.py
jonathanvanleeuwen/speech_to_text
0
12783806
<gh_stars>0 import logging import time import traceback import azure.cognitiveservices.speech as speechsdk from pathlib import Path from typing import Union logger = logging.getLogger(__name__) def set_logging_level(level: str) -> None: if logger.hasHandlers() is False: handler = logging.StreamHandler()...
2.703125
3
mmderain/models/backbones/spdnet.py
biubiubiiu/derain-toolbox
4
12783807
from functools import partial from typing import List, Sequence, Tuple import einops import torch import torch.nn.functional as F from pytorch_wavelets import DWTForward, DWTInverse from torch import nn from mmderain.models.common import get_rcp, make_layer, sizeof from mmderain.models.layers import SELayer from mmde...
2.3125
2
start.py
aiidalab/aiidalab-manage-structures
0
12783808
import ipywidgets as ipw def get_start_widget(appbase, jupbase): #http://fontawesome.io/icons/ template = """ <table> <tr> <th style="text-align:center"></th> <th style="width:70px" rowspan=2></th> <th style="text-align:center"></th> <th style="width:70px" rowspan=2></th...
2.703125
3
src/FFEAT/test/strategies/mutation/ReplaceWithNormalTest.py
PatrikValkovic/MasterThesis
0
12783809
############################### # # Created by <NAME> # 3/16/2021 # ############################### import unittest import torch as t import ffeat from ffeat.strategies import mutation class ReplaceWithNormalTest(unittest.TestCase): def test_norm(self): m = mutation.Replace(t.distributions.Normal(0.0, 5.0...
2.25
2
noxfile.py
astrogewgaw/priwo
7
12783810
<reponame>astrogewgaw/priwo<gh_stars>1-10 import nox py_versions = [ "3.6", "3.7", "3.8", "3.9", ] @nox.session def lint(session): """ Lint all files in priwo. """ session.install("black") session.run("black", ".") @nox.session( python=py_versions, reuse_venv=True, ) ...
2.15625
2
transactions/apps/discounts.py
cnds/wxdemo
0
12783811
<gh_stars>0 from flask import request, jsonify from .base import Base from .json_validate import SCHEMA class Discounts(Base): def get(self): params = request.args.to_dict() is_valid, tag = self.validate_dict_with_schema(params, SCHEMA['disco...
2.515625
3
Basset/pretrained_model_reloaded_th.py
Luma-1994/lama
137
12783812
<reponame>Luma-1994/lama import torch import torch.nn as nn from functools import reduce from torch.autograd import Variable class LambdaBase(nn.Sequential): def __init__(self, fn, *args): super(LambdaBase, self).__init__(*args) self.lambda_func = fn def forward_prepare(self, input): ...
2.40625
2
src/olymptester/cpp_template.py
jrojer/easy-stdio-tester
1
12783813
cpp_template = '''\ #include<iostream> #include<algorithm> #include<functional> #include<vector> #include<unordered_map> #include<unordered_set> #include<map> #include<set> #include<string> #include<cstdlib> #include <math.h> #define int int64_t using namespace std; #define verify(condition) { \ if(!(condition))...
2.359375
2
eikonapi/views.py
royaljs/refinitiv-eikon-proxy-server
2
12783814
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status import eikon as ek from pandas import DataFrame import json from datetime import datetime import os import dateutil #### SET EIKON APP KEY #### ek.set_app_key('SET_APP_KEY_HERE') ##### NEWS ##### cl...
2.53125
3
jinja/app_v0.py
patrickdinneen/python101
0
12783815
from flask import Flask from dataclasses import dataclass, field from typing import List, Dict app = Flask(__name__) @dataclass class Human: name: str pets: List[str] = field(default_factory=list) def get_humans() -> Dict[str, Human]: humans = [ Human('<NAME>', pets=['Bork the Dog', ...
3.328125
3
dcs/utils.py
racker/python-dcs
0
12783816
# Copyright 2012 Rackspace, 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 by applicable law or agreed to in writi...
2.515625
3
lib/neuralmetrics/setup.py
mohammadbashiri/bashiri-et-al-2021
2
12783817
<reponame>mohammadbashiri/bashiri-et-al-2021 #!/usr/bin/env python from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) setup( name="neuralmetrics", version="0.0.0", description="Metrics for evaluation and comparison of neural prediction models", ...
1.234375
1
ex2/operations/operations.py
hentt30/lab7-ces22
0
12783818
""" Interface for operations that the system can perform """ from abc import ABC, abstractclassmethod,abstractmethod class Operation(ABC): """ Abstract class representing a generic operation """ @abstractmethod def execute(self): """ Execute operation """ pass
3.390625
3
cryptor.pyw
MiserableHating/KinterCryptor
0
12783819
import os from Crypto.Cipher import AES from Crypto.Hash import SHA256 from Crypto import Random from tkinter import * from tkinter.messagebox import * from tkinter.ttk import Label import sys import time from threading import Thread import webbrowser import tkinter as tk Kinter = tk() Kinter.title("Kinter Cryptor") ...
2.921875
3
host/bin/nrfsvc.py
eblot/tde-base
0
12783820
<reponame>eblot/tde-base #!/usr/bin/env python3 """Nordic service call extractor for CLANG/LLVM toolchain """ from argparse import ArgumentParser from collections import namedtuple, OrderedDict from os import environ, rename, walk from os.path import (basename, dirname, isdir, join as joinpath, normpath, ...
2.078125
2
example/artists/models.py
moshthepitt/django-vega-admin
4
12783821
""" Module for vega-admin test models """ from django.db import models from django.utils.translation import ugettext as _ class Artist(models.Model): """ Artist Model class """ name = models.CharField(_("Name"), max_length=100) class Meta: ordering = ["name"] verbose_name = "Arti...
2.5
2
tests/codec.py
axsguard/sstp-server
223
12783822
<reponame>axsguard/sstp-server #!/usr/bin/env python3 import os import timeit from sstpd.codec import escape, PppDecoder decoder = PppDecoder() def get_enscaped(): frames = [os.urandom(1500) for i in range(2)] return b''.join([escape(f) for f in frames]) def prof_unescape(): return timeit.timeit('decod...
2.5625
3
skmob/utils/tests/test_gislib.py
FilippoSimini/scikit-mobility
489
12783823
from skmob.utils import gislib import math class TestClustering: def setup_method(self): self.point_1 = (43.8430139, 10.5079940) self.point_2 = (43.5442700, 10.3261500) self.decimal = 43.8430139 self.DMS = (43, 50, 34.85) def test_get_distance(self): output = gislib....
2.4375
2
script.py
AndreasLochwitz/twine2json
1
12783824
# -*- coding: utf-8 -*- import re import json def getTitle(storyContent): pattern = re.compile("[^:\ ][A-Za-zäöüßÄÖÜ\d\ .\[\|\]\"\']*") result = pattern.search(storyContent) return result.group(0) def getContent(storyContent): pattern = re.compile("^[A-Za-z]{2}[A-Za-zäüößÄÖÜ\w\s\.\:]*", re.M...
2.96875
3
python/paddle/v2/framework/tests/test_minus_op.py
yu239/Paddle
0
12783825
import unittest import numpy as np from gradient_checker import GradientChecker, create_op from op_test_util import OpTestMeta class MinusOpTest(unittest.TestCase): __metaclass__ = OpTestMeta def setUp(self): self.type = "minus" self.inputs = { 'X': np.random.random((32, 84)).asty...
3
3
web/smt/Mydata.py
wzh191920/MyData
7
12783826
<reponame>wzh191920/MyData from ctypes import windll, POINTER, c_int, c_longlong, c_char, c_char_p, Structure, c_short, c_float,\ c_double ll = windll.LoadLibrary lib = ll("MyDataAPI.dll") PI = POINTER(c_int) PCH = POINTER(c_char) PSH = POINTER(c_short) PLL = POINTER(c_longlong) PF = POINTER(c_float) P...
2.28125
2
webapp/routes.py
LSanten/mixbase_live
0
12783827
from flask import render_template, url_for, flash, redirect from webapp import app, db, bcrypt from webapp.forms import RegistrationForm, LoginForm, PairForm, SingleForm from webapp.models import User, Pair from flask_login import login_user, current_user from sqlalchemy import func, desc import time @app.route('/', ...
2.5625
3
tudo/ex109/teste.py
Ramon-Erik/Exercicios-Python
1
12783828
from moeda import * preço = float(input('Informe um valor R$')) resp = str(input('Você deseja apreentar o preço como R$? ')).lower() if resp == 's': resp = True else: resp = False print('=' * 30) print(f'A metade de {moeda(preço)} é {metade(preço, resp)}') print(f'A dobro de {moeda(preço)} é {dobro(preço, re...
3.46875
3
doajtest/unit/test_models.py
glauberm/doaj
0
12783829
<reponame>glauberm/doaj import json import time from datetime import datetime from portality import constants from doajtest.fixtures import ApplicationFixtureFactory, JournalFixtureFactory, ArticleFixtureFactory, BibJSONFixtureFactory, ProvenanceFixtureFactory, BackgroundFixtureFactory from doajtest.helpers import Doa...
2.0625
2
src/binancema/indicators.py
emrementese/binance-ema
16
12783830
<reponame>emrementese/binance-ema<filename>src/binancema/indicators.py # -*- coding: utf-8 -*- ''' Created by <NAME> on 24/01/2022 Coding with Python. ''' from binancema.coininfo import price class indicator: def __init__(self,client): self.client = client def SMA(self,series,length) -> float: ...
3.140625
3
panqec/decoders/sweepmatch/_deformed_decoder.py
ehua7365/bn3d
0
12783831
<reponame>ehua7365/bn3d from typing import Tuple, Dict import numpy as np from pymatching import Matching from panqec.codes import StabilizerCode from panqec.decoders import BaseDecoder from panqec.error_models import BaseErrorModel, PauliErrorModel from .. import ( SweepDecoder3D, Toric3DMatchingDecoder, RotatedPl...
2.203125
2
src/build_rindex/redis_index.py
ethanjperez/semanticRetrievalMRS
61
12783832
<reponame>ethanjperez/semanticRetrievalMRS import heapq import json import redis from tqdm import tqdm from typing import List import config from build_rindex.build_rvindex import IndexDB, load_from_file class RedisScoreIndexOld: """ The inverted index is basically a dictionary, with key: term, value {docid:...
2.65625
3
applications/Sist01/controllers/produto.py
BetinRibeiro/web2py_crediario
2
12783833
# -*- coding: utf-8 -*- # tente algo como def listar_merc_envio(): proj = db.projeto(request.args(0, cast=int)) rows = db(db.mercadoria_enviada.projeto == request.args(0, cast=int)).select() return locals() def inserir_merc_envio(): proj = db.projeto(request.args(0, cast=int)) db.mercadoria_enviada.projeto.defau...
2.65625
3
aparent/losses/__init__.py
johli/aparent-resnet
20
12783834
<reponame>johli/aparent-resnet from aparent.losses.aparent_losses import *
1.015625
1
schedgym/scheduler/easy_scheduler.py
renatolfc/sched-rl-gym
2
12783835
<filename>schedgym/scheduler/easy_scheduler.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- """easy_scheduler - A scheduler that uses easy backfilling. """ from typing import List, Tuple, Optional from schedgym.job import Job, JobStatus from schedgym.scheduler import Scheduler from schedgym.event impo...
3.25
3
loans/migrations/0003_auto_20200617_0103.py
minsystems/minloansng
0
12783836
<reponame>minsystems/minloansng<filename>loans/migrations/0003_auto_20200617_0103.py # Generated by Django 3.0.2 on 2020-06-17 08:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('loans', '0002_auto_20200518_0655'), ] operations = [ mi...
1.460938
1
clipkit/args_processing.py
JLSteenwyk/ClipKIT
28
12783837
import logging import os.path import sys from .modes import TrimmingMode logger = logging.getLogger(__name__) def process_args(args) -> dict: """ Process args from argparser and set defaults """ input_file = args.input output_file = args.output or f"{input_file}.clipkit" if not os.path.isfi...
2.8125
3
lowfat/migrations/0051_auto_20160804_1425.py
elena-kolomeets/lowfat
6
12783838
<reponame>elena-kolomeets/lowfat # -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-08-04 14:25 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('lowfat', '0050_auto_20160720_1533'), ] operations = [ ...
1.390625
1
comments_microservice/comments_microservice/urls.py
RolesFGA/2018.2-Roles_Comments
1
12783839
from django.contrib import admin from django.urls import include, path from django.conf.urls import url from votes import urls urlpatterns = [ path('admin/', admin.site.urls), path('', include('comments.urls')), path('api-auth/', include('rest_framework.urls')), url(r'^', include(urls)), ]
1.71875
2
seek.py
printNoahKemp/Seek
0
12783840
"""Seek behaviour in Pygame""" import pygame import numpy as np import math WIDTH,HEIGHT = 700,400 screen = pygame.display.set_mode((WIDTH,HEIGHT)) class Seeker(): def __init__(self,x,y): super().__init__() self.pos=np.array([x,y]) self.vel=np.array([0,0]) self.acc=n...
3.6875
4
pipenv/vendor/pythonfinder/cli.py
mlhamel/pipenv
1
12783841
<reponame>mlhamel/pipenv #!/usr/bin/env python # -*- coding=utf-8 -*- import click import crayons import sys from . import __version__ from .pythonfinder import PythonFinder # @click.group(invoke_without_command=True, context_settings=CONTEXT_SETTINGS) @click.command() @click.option('--find', default=False, nargs=1,...
2.375
2
mongodb_consistent_backup/Common/Util.py
cprato79/mongodb_consistent_backup
1
12783842
import socket from dateutil import parser from mongodb_consistent_backup.Errors import OperationError def config_to_string(config): config_vars = "" for key in config: config_vars += "%s=%s, " % (key, config[key]) return config_vars[:-1] def is_datetime(string): try: parser.parse(st...
2.6875
3
utils.py
Ahmednull/L2S-Net
21
12783843
<filename>utils.py<gh_stars>10-100 import numpy as np import torch import torch.nn as nn import os import scipy.io as sio import cv2 import math from math import cos, sin from pathlib import Path import subprocess import re from model import L2CS import torchvision import sys def atoi(text): return...
2.46875
2
movingpandas/tests/test_geometry_utils.py
DeemanOne/movingpandas
0
12783844
<reponame>DeemanOne/movingpandas # -*- coding: utf-8 -*- import pytest from math import sqrt from shapely.geometry import MultiPoint, Point from movingpandas.geometry_utils import ( azimuth, calculate_initial_compass_bearing, angular_difference, mrr_diagonal, measure_distance_geodesic, measure_...
2.578125
3
bin/changebootloader.py
peterferrie/anti-m
31
12783845
#!/usr/bin/env python3 import sys import os.path target_disk_image, bootloader = sys.argv[1:] ext = os.path.splitext(target_disk_image)[-1].lower() assert(ext in (".dsk", ".do", ".po", ".2mg")) if ext == ".2mg": offset = 64 else: offset = 0 with open(bootloader, 'rb') as f: boot = f.read() assert(len(boot...
2.359375
2
reframe/core/containers.py
jacwah/reframe
0
12783846
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause import abc import reframe.core.fields as fields import reframe.utility.typecheck as typ from reframe.core.exceptions import C...
1.898438
2
salesforce_client/util.py
pylab-bd/salesforce-api-client
0
12783847
def date_to_iso8601(date): """Returns an ISO8601 string from a date""" datetimestr = date.strftime('%Y-%m-%dT%H:%M:%S') timezone_sign = date.strftime('%z')[0:1] timezone_str = '%s:%s' % ( date.strftime('%z')[1:3], date.strftime('%z')[3:5], ) return f'{datetimestr}{timezone_sign}...
3.328125
3
fast_tmp/depends/pageing.py
Chise1/fast-tmp2
1
12783848
<reponame>Chise1/fast-tmp2<filename>fast_tmp/depends/pageing.py # -*- encoding: utf-8 -*- """ @File : pageing.py @Time : 2021/1/18 10:11 @Author : chise @Email : <EMAIL> @Software: PyCharm @info :分页 """ from pydantic.main import BaseModel class PageDepend(BaseModel): # 分页 perPage: int = 10 page: ...
2.0625
2
application/__init__.py
stadibo/friseur-manager
0
12783849
<reponame>stadibo/friseur-manager<gh_stars>0 import os from flask import Flask from flask_bcrypt import Bcrypt from flask_wtf.csrf import CSRFProtect from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager, current_user from functools import wraps from config ...
2.15625
2
osiris/urls.py
fboerman/coursebrowser
0
12783850
from django.urls import path, re_path, include from . import views app_name = 'osiris' url_patterns_v2 = [ path('courses/all/', views.get_all_courses, name='getallcourses'), ] urlpatterns = [ path('', views.index, name='index'), path('api/unicodes/', views.unicodes, name='unicodes'), path('api/<slug:...
2.109375
2