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 |
|---|---|---|---|---|---|---|
Forms/index.py | vgeorgo/courses-python-udemy-create-websites-using-flask | 1 | 12787251 | from flask import Flask, render_template,request,session,redirect,url_for,flash
from flask_wtf import FlaskForm
from wtforms import (StringField,SubmitField,BooleanField,DateTimeField,
RadioField,SelectField,TextField,TextAreaField)
from wtforms.validators import DataRequired
app = Flask(__name__)
... | 2.796875 | 3 |
src/core.py | DrAtomic/ECE_Team9_Capstone | 0 | 12787252 | <gh_stars>0
# Project: An Algorithmic Teaching Practices and Classroom Activities Tool to Improve Education
#
# Authors: <NAME>, <NAME>, <NAME>, and <NAME>
#
# Sponsor: <NAME> and teuscher-lab.com
#
# Ownership: See https://github.com/jb-codemaker/ECE_Team9_Capstone for license details
#
#
# This file: Takes in argumen... | 2.6875 | 3 |
synthraw/__init__.py | crowsonkb/synthraw | 1 | 12787253 | <filename>synthraw/__init__.py
from .synthraw import DNG, DNGError
| 1.195313 | 1 |
fill_and_upscale.py | erinxi/chika | 0 | 12787254 | import cv2
import glob
import os
# Fill in the output with upscaled frames.
# Make sure to match scale and interpolation mode.
SCALE = 2
if __name__ == "__main__":
frames = sorted(glob.glob("frames/*.jpg"))
for frame_index, frame in enumerate(frames):
output_frame = "output/{:05d}.png".format(frame_index)
... | 3 | 3 |
analyze/routes.py | GustavoBoaz/aganalyze | 0 | 12787255 | import flask
from flask import Flask, session, render_template,redirect, url_for
from run import server
@server.route('/')
def index():
return render_template("tbases/t_index.html", startpage=True)
#@server.route('/dashboard/')
#def dashboard():
# return render_template("tbases/t_index.html", startpa... | 2.546875 | 3 |
label_studio/data_export/urls.py | cdpath/label-studio | 3 | 12787256 | <filename>label_studio/data_export/urls.py
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
from django.urls import path, include
from . import api
from . import views
app_name = 'data_export'
... | 1.921875 | 2 |
client.py | RaghuA06/ChatBox-Application | 1 | 12787257 | <reponame>RaghuA06/ChatBox-Application
#<NAME>
#May 2021
import socket
import sys
import time
socket_server = socket.socket()
server_host = socket.gethostname()
ip = socket.gethostbyname(server_host)
sport = 8000
print("This is your IP address:{}".format(ip))
server_host = input("Enter server's IP addre... | 3.4375 | 3 |
175 _labs/lab4_q1.py | lzeeorno/Python-practice175 | 0 | 12787258 | <filename>175 _labs/lab4_q1.py
from lab4_input_Stack import Stack
# assign
forwardStack = Stack()
backwardStack = Stack()
current_page = "www.cs.ualberta.ca"
print(current_page)
while(True):
user_command = input()
if(user_command == '>'):
# forward
if (forwardStack.is_empty()):
prin... | 3.421875 | 3 |
utils/communication_benchmark.py | beomyeol/baechi | 4 | 12787259 | # Copyright 2020 University of Illinois Board of Trustees. All Rights Reserved.
# Author: <NAME>, DPRG (https://dprg.cs.uiuc.edu)
# This file is part of Baechi, which is released under specific terms. See file License.txt file for full license details.
# =================================================================... | 2.078125 | 2 |
bourbaki/application/paths.py | bourbaki-py/application | 0 | 12787260 | # coding:utf-8
import os
from pathlib import Path
from io import StringIO, BytesIO, IOBase
from typing import Union
FileTypes = (IOBase,)
FileType = Union[FileTypes]
DEFAULT_FILENAME_DATE_FMT = (
"%Y-%m-%d_%H:%M:%S"
) # Format for dates appended to files or dirs.
# This will lexsort in temporal order.
DEFAULT_FI... | 3.1875 | 3 |
roengine/net/cUDP.py | ROTARTSI82/RoEngine | 1 | 12787261 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
from __future__ import print_function
import rencode
import logging
import socket
from twisted.internet import reactor
from twisted.internet.protocol import DatagramProtocol
from roengine.config import LOG_NO_HANDLERS, LOG_GETS, LOG_SENDS
__all__ = ['ServerUDP', 'EnqueUDPClie... | 2.40625 | 2 |
arcade_solutions/the_core/timed_reading.py | nickaigi/automatic-dollop | 0 | 12787262 | <filename>arcade_solutions/the_core/timed_reading.py
import string
def timed_reading(max_length, text):
count = 0
text = text.translate(str.maketrans('', '', string.punctuation))
for w in text.split(' '):
if w and len(w) <= max_length:
count += 1
return count
if __name__ == '__ma... | 3.3125 | 3 |
PythonVSCode/DP_GFG/LongestPalindromicSubsequence.py | porcelainruler/InterviewPrep | 0 | 12787263 | <filename>PythonVSCode/DP_GFG/LongestPalindromicSubsequence.py<gh_stars>0
from sys import stdin
'''
import java.util.*;
import java.lang.*;
import java.io.*;
class GFG
{
public static int dp(String str1, String str2, int n) {
int[][] dp = new int[n+1][n+1];
for(int i=0 ; i<n+1 ; i++) {
... | 2.546875 | 3 |
Web/field/api/views.py | Pancras-Zheng/Graduation-Project | 37 | 12787264 | import json
from django.shortcuts import render
from django.http import HttpResponse
import config.config as config
import user.models as database
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.csrf import requires_csrf_token
from django.views.decorators.csrf import ensure_csrf_cookie... | 2.0625 | 2 |
tests/test_which_cam.py | waider/gopro-py-api | 1 | 12787265 | import http
from socket import timeout
from goprocam import GoProCamera
from .conftest import GoProCameraTest
class WhichCamTest(GoProCameraTest):
def setUp(self):
super().setUp()
# disable this so we can test it separately
self.monkeypatch.setattr(GoProCamera.GoPro, '_prepare_gpcontrol'... | 2.546875 | 3 |
sendbird/api_endpoints/channel.py | jpbullalayao/sendbird-python | 4 | 12787266 | <reponame>jpbullalayao/sendbird-python
# All endpoint constants that both the OpenChannel and GroupChannel
# resources share
CHANNEL_BAN_USER = "/ban"
CHANNEL_FREEZE = "/freeze"
CHANNEL_LIST_BANNED_USERS = "/ban"
CHANNEL_LIST_MUTED_USERS = "/mute"
CHANNEL_MUTE_USER = "/mute"
CHANNEL_UNBAN_USER = "/ban/{banned_user_id}"... | 1.273438 | 1 |
genart/torch/train_gan.py | dyf/genart | 0 | 12787267 | <reponame>dyf/genart<gh_stars>0
import torch
import os
import numpy as np
import skimage.io
from data import GenartDataSet
from model import GenartGenerator, GenartDiscriminator
from torch.autograd import Variable
from torchvision.utils import save_image
Tensor = torch.FloatTensor
latent_size = 10
n_epochs = 100
im... | 2.1875 | 2 |
Unsupervised Machine Learning/Unsupervised Learning/02 - Image clustering K-means.py | Piraato/Learn-Python | 0 | 12787268 | <filename>Unsupervised Machine Learning/Unsupervised Learning/02 - Image clustering K-means.py<gh_stars>0
# Clustering is not actually good for image recognition,
# but this is a good way of showing how clustering works
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import inp... | 3.640625 | 4 |
aiobook/core/facebook/types/__init__.py | Valenookua/aiobook | 4 | 12787269 | from .buttons import \
UrlButton, CallButton, LogOutButton, LogInButton, PostbackButton, GamePlayButton
from .elements import Element, MediaElement, OpenGraphElement
from .quick_replies import QuickReply
from .templates import\
ButtonTemplate, MediaTemplate, GenericTemplate, OpenGraphTemplate, ListTemplate
| 0.808594 | 1 |
source/data_preparation/vim_label.py | jackie930/yolov3 | 0 | 12787270 | # -*- coding: utf-8 -*-
"""
@File : yolo_label.py
@Author : Jackie
@Description :
"""
import json
import os
from shutil import copyfile
from sys import exit
sets = ['train', 'valid']
classes = ["nie es8","maybach s650","toyota gt8","tesla modelx"] #
def load_vim_label(labelfile):
with open(labelfile,... | 2.5 | 2 |
boxmetrics/core/info/sensors.py | Laurent-PANEK/boxmetrics-cli | 0 | 12787271 | <gh_stars>0
import psutil
from .base import Info
class Sensors(Info):
def __init__(self, *args):
super(Sensors, self).__init__(*args)
def temp(self):
if psutil.WINDOWS:
return dict()
temp = psutil.sensors_temperatures()
for key, data in temp.items():
... | 2.8125 | 3 |
web/app/models.py | henryjr1/DelterAirlinesTeam3 | 0 | 12787272 | # models.py
from app import db
class Passenger(db.Model):
__tablename__ = "passengers"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(30), nullable=False)
dob = db.Column(db.Date, nullable=False)
email = db.Column(db.String(30), unique=True, nullable=False)
address = ... | 2.65625 | 3 |
utils.py | Fork-for-Modify/MetaSCI-CVPR2021 | 0 | 12787273 | <reponame>Fork-for-Modify/MetaSCI-CVPR2021<filename>utils.py
"""
@author : <NAME>, <NAME>
@Email : <EMAIL> <EMAIL>
Description:
Citation:
The code prepares for ECCV 2020
Contact:
<NAME>
<EMAIL>
Xidian University, Xi'an, China
<NAME>
<EMAIL>
Xidian University, Xi'an, China
LICENSE
... | 1.882813 | 2 |
mqtt_performance_tester/analyze.py | lucasimone/mqtt-performance-tester | 0 | 12787274 | import json
import traceback
import sys
from mqtt_performance_tester.mqtt_utils import *
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
### CLASS FOR STORE AN MQTT MESSAGE
class packet():
counter = 0
def __init__(self):
self.protocol = None
self.frame_id = None
... | 2.546875 | 3 |
ephios/core/models/users.py | ephios-dev/ephios | 14 | 12787275 | import datetime
import functools
import secrets
import uuid
from datetime import date
from itertools import chain
import guardian.mixins
from django.contrib.auth import get_user_model
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
from django.contrib.auth.models import Group, PermissionsMi... | 1.921875 | 2 |
model/xgboost_model.py | theBraindonor/chicago-crime-arrests | 1 | 12787276 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Build an XGBoost model of arrests in the Chicago crime data.
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2019, <NAME>"
__license__ = "Creative Commons Attribution-ShareAlike 4.0 International License"
__version__ = "1.0"
import xgbo... | 2.640625 | 3 |
rlintro/bandit.py | adam-page/rlintro | 0 | 12787277 | <reponame>adam-page/rlintro
from abc import ABC
import matplotlib.pyplot as plt
import numpy as np
class Bandit:
"""A simple k-armed bandit."""
def __init__(
self,
arms: int = 10,
qs: np.ndarray = None,
walk: float = None,
):
"""Create the simple k-armed bandit.
... | 3.640625 | 4 |
Poker.py | guptaronav/python-projects | 0 | 12787278 | import random
import time
from collections import Counter
done = 'false'
#here is the animation
def animate():
Count=0
global done
print('loading… |',end="")
while done == 'false':
time.sleep(0.1)
print('/',end="")
time.sleep(0.1)
print('-',end="")
time.sleep(0.1... | 3.609375 | 4 |
products/migrations/0009_alter_product_image.py | susovangarai/SRshoper | 0 | 12787279 | <reponame>susovangarai/SRshoper
# Generated by Django 3.2 on 2021-04-16 05:40
from django.db import migrations, models
import products.models
class Migration(migrations.Migration):
dependencies = [
('products', '0008_alter_shippingaddress_order'),
]
operations = [
migrations.AlterField(... | 1.585938 | 2 |
pinball/workflow/job.py | DotModus/pinball | 1,143 | 12787280 | <reponame>DotModus/pinball
# Copyright 2015, Pinterest, 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 applicab... | 2.046875 | 2 |
python/qicycling/trend.py | zimult/web_md | 0 | 12787281 | #! /usr/bin/python
# encoding:utf-8
import requests
import json
import time
import config
import db
import os
import datetime
import sys
import traceback
from fn import log, db_app, db_wp
from urllib import quote
from urllib import unquote
reload(sys)
sys.setdefaultencoding('utf8')
'''
Google Trend 热词
热词的访问次数是有限制的,... | 1.773438 | 2 |
hw4/hw4_2/mitm.py | dedeswim/com-402-hw | 9 | 12787282 | from netfilterqueue import NetfilterQueue
from scapy.all import *
import socket
import re
def print_and_accept(pkt):
ip = IP(pkt.get_payload())
if ip.haslayer("Raw"):
print("IP packet received")
payload = ip["Raw"].load
if payload[0] == 0x16 and payload[5] == 0x01:
n... | 2.40625 | 2 |
core/iotools.py | pvthinker/pyRSW | 8 | 12787283 | from netCDF4 import Dataset
from dataclasses import dataclass, field
import os
import pickle
import sys
import shutil
import numpy as np
from variables import modelvar
@dataclass
class VariableInfo():
nickname: str = ""
dimensions: tuple = field(default_factory=lambda: ())
name: str = ""
units: str = ... | 2.65625 | 3 |
task0/test_task0.py | 18harsh/Nirikshak-Bot-NB--eyantra | 2 | 12787284 | <gh_stars>1-10
try:
import task0_cardinal
except ImportError:
print("\n\t[ERROR] It seems that task0_cardinal.pyc is not found in current directory! OR")
print("\n\tAlso, it might be that you are running test_task0.py from outside the Conda environment!\n")
exit()
# Main function
if __name__ == '__main... | 1.953125 | 2 |
apigateway/apps/store_point_password_handle.py | cnds/wxdemo | 0 | 12787285 | import requests
from flask import jsonify, request
from .base import BaseHandler
from .json_validate import SCHEMA
class StorePointPassword(BaseHandler):
def get(self, store_id):
api_resp = requests.get(
'{0}/accounts/stores/{1}/point-password'.format(
self.endpoint['accounts... | 2.734375 | 3 |
ML_CW1/assgn_1_part_1/3_regularized_linear_regression/hypothesis_to_vector.py | ShellySrivastava/Machine-Learning | 0 | 12787286 | from calculate_hypothesis import *
def hypothesis_to_vector(X, theta):
hypothesis_vec = np.array([], dtype=np.float32)
for i in range(X.shape[0]):
hypothesis_vec = np.append(hypothesis_vec, calculate_hypothesis(X, theta, i))
return hypothesis_vec | 2.953125 | 3 |
pqb/queries.py | josegomezr/pyqb | 0 | 12787287 | <filename>pqb/queries.py
#encoding=utf-8
from . import statements
from . import grouping
from . import expressions
import json
class Select:
"""SELECT Query Builder"""
def __init__(self, *fields):
"""
Inicializa la consulta SELECT opcionalmente los argumentos pasados serna considerados campos p... | 2.515625 | 3 |
baekjoon/python/why_the_cow_landing_on_information_islands_17128.py | yskang/AlgorithmPractice | 0 | 12787288 | # Title: 소가 정보섬에 올라온 이유
# Link: https://www.acmicpc.net/problem/17128
import sys
sys.setrecursionlimit(10 ** 6)
read_list_int = lambda: list(map(int, sys.stdin.readline().strip().split(' ')))
def solution(n: int, q: int, cows: list, qs: list):
cows = cows + cows
parts = []
for start in range(n):
... | 3.03125 | 3 |
oletools/thirdparty/xglob/__init__.py | maniVix/oletools | 2,059 | 12787289 | <gh_stars>1000+
from .xglob import * | 1.101563 | 1 |
dlapp/dlquery.py | Geeks-Trident-LLC/dlquery | 0 | 12787290 | """Module containing the logic for querying dictionary or list object."""
import re
import operator
from dlapp import utils
from dlapp.argumenthelper import validate_argument_type
from dlapp.argumenthelper import validate_argument_is_not_empty
from dlapp.collection import Element
class DLQueryError(Exception):
""... | 2.921875 | 3 |
src/worker/streamable.py | christopher-dG/osr2mp4-bot | 2 | 12787291 | <gh_stars>1-10
import logging
import os
from datetime import timedelta
from pathlib import Path
import boto3
import requests
from requests import Response
from . import ReplyWith
from ..common import enqueue
def upload(video: Path, title: str) -> str:
"""Upload `video` to Streamable."""
# This technique c... | 2.59375 | 3 |
app/SellerReviews.py | leahokamura/RetailTherapy | 0 | 12787292 | # from __future__ import print_function # In python 2.7
from flask import render_template
from flask_login import current_user
import datetime
#import forms
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, IntegerField
from wtforms.validators import Val... | 2.40625 | 2 |
robosuite/models/grippers/gripper_factory.py | StanfordVL/Lasersuite | 5 | 12787293 | """
Defines a string based method of initializing grippers
"""
from .panda_gripper import PandaGripper
from .wiping_gripper import WipingGripper
from .pr2_gripper import PR2Gripper
from .rethink_gripper import RethinkGripper
from .robotiq_gripper import RobotiqGripper
from .robotiq_three_finger_gripper import RobotiqTh... | 3.453125 | 3 |
crawl/views.py | mannyhappenings/WebCrawler | 0 | 12787294 | from django.shortcuts import render
from crawler import Crawler
from django.http import HttpResponse
crawlers = {}
def index(request, params=''):
post_data = dict(request.POST)
post_data['urls'] = post_data['url[]']
for link in post_data['urls']:
crawlers[link] = Crawler()
crawlers[link].setUrl(lin... | 2.375 | 2 |
lib_bgpstream_website_collector/old_tests/test_data_classes.py | jfuruness/lib_bgpstream_website_collector | 16 | 12787295 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This file contains tests for the data_classes.py file.
For specifics on each test, see the docstrings under each function.
"""
__authors__ = ["<NAME>, <NAME>"]
__credits__ = ["<NAME>, <NAME>"]
__Lisence__ = "BSD"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__statu... | 2.375 | 2 |
Tuples and Sets/04. Parking Lot.py | milenpenev/Python_Advanced | 0 | 12787296 | n = int(input())
cars = set()
for _ in range(n):
command, number = input().split(", ")
if command == "IN":
cars.add(number)
else:
if number in cars:
cars.remove(number)
if not cars :
print("Parking Lot is Empty")
else:
[print(n) for n in cars] | 3.65625 | 4 |
wally/suits/io/fio.py | Mirantis/rally-results-processor | 41 | 12787297 | <filename>wally/suits/io/fio.py<gh_stars>10-100
import os.path
import logging
from typing import cast, Any, List, Union
import numpy
from cephlib.units import ssize2b, b2ssize
from cephlib.node import IRPCNode, get_os
import wally
from ...utils import StopTestError
from ..itest import ThreadedTest
from ...result_cla... | 1.757813 | 2 |
slayer/io/screenshot.py | ajduberstein/slayer | 2 | 12787298 | """
The goal of this module is to ease the creation of static maps
from this package.
Ideally, this is done headlessly (i.e., no running browser)
and quickly. Given that deck.gl requires WebGL, there aren't
lot of alternatives to using a browser.
Not yet implemented.
"""
from selenium import webdriver
# from selenium... | 2.5 | 2 |
paprika/io.py | wwilla7/pAPRika | 3 | 12787299 | import logging as log
import os
import base64
import json
import numpy as np
from paprika.restraints import DAT_restraint
from parmed.amber import AmberParm
from parmed import Structure
# https://stackoverflow.com/questions/27909658/json-encoder-and-decoder-for-complex-numpy-arrays
# https://stackoverflow.com/a/24375... | 2.421875 | 2 |
PINN_Survey/architecture/tf_v1/domain_transformer.py | roman-amici/PINN_Survey | 0 | 12787300 | import PINN_Base.base_v1 as base_v1
import tensorflow as tf
'''
This is an implementation of the (unnamed)
"Improved fully-connected neural architecture" from
UNDERSTANDING AND MITIGATING GRADIENT PATHOLOGIES IN
PHYSICS-INFORMED NEURAL NETWORKS (Wang, 2020).
I have taken the liberty of naming it based on the author... | 3.171875 | 3 |
code/recon/recon-bias.py | modichirag/21cm_cleaning | 1 | 12787301 | import numpy
from scipy.interpolate import InterpolatedUnivariateSpline as interpolate
from scipy.interpolate import interp1d
from cosmo4d.lab import (UseComplexSpaceOptimizer,
NBodyModel, LPTModel, ZAModel,
LBFGS, ParticleMesh)
#from cosmo4d.lab import mapbias as map
f... | 1.6875 | 2 |
tests/integration/examples/abstract/workflows/foo.py | stucox/gadk | 1 | 12787302 | <gh_stars>1-10
from .lib import Service
class FooService(Service):
def __init__(self) -> None:
super().__init__("foo")
def service_name(self) -> str:
return "foo"
| 2.53125 | 3 |
simALModulesWrappers/ALPosture.py | Snoke13/NaoqibulletWrapper | 1 | 12787303 | #!/usr/bin/env python
__author__ = '<NAME>'
__copyright__ = """
Copyright 2019, CPE Lyon, <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.or... | 2.109375 | 2 |
processor/rotary.py | Princeton-Penn-Vents/princeton-penn-flowmeter | 3 | 12787304 | #!/usr/bin/env python3
from __future__ import annotations
from typing import List, Dict, Any, ValuesView, TypeVar, Iterable, ItemsView
from processor.setting import Setting
import threading
T = TypeVar("T", bound="LocalRotary")
class LocalRotary:
def __init__(self, config: Dict[str, Setting]):
self.co... | 2.609375 | 3 |
DataStructures/queue.py | nabiharaza/LabLearnings | 2 | 12787305 | <reponame>nabiharaza/LabLearnings
from node import LinkedNode
class Queue:
__slots__ = "front", "back"
def __init__(self):
""" Create a new empty queue.
"""
self.front = None
self.back = None
def __str__(self):
""" Return a string representation of the contents of... | 4.09375 | 4 |
habitat_sim/utils/__init__.py | shacklettbp/habitat-sim | 1 | 12787306 | <reponame>shacklettbp/habitat-sim
#!/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.
# quat_from_angle_axis and quat_rotate_vector imports
# added for backward compatibili... | 1.21875 | 1 |
src/ds_algs/sorting_algs/bubble_sort.py | E1mir/PySandbox | 0 | 12787307 | <reponame>E1mir/PySandbox<gh_stars>0
def bubble_sort(arr):
for n in range(len(arr) - 1, 0, -1):
for k in range(n):
if arr[k] > arr[k + 1]:
arr[k], arr[k + 1] = arr[k + 1], arr[k]
if __name__ == '__main__':
array = [2, 6, 7, 4, 1, 8, 5, 9, 3, 10, 15, 12, 13, 11, 14]
bubb... | 3.875 | 4 |
api/models.py | DarkbordermanTemplate/fastapi-sqlalchemy | 3 | 12787308 | <gh_stars>1-10
from db import SESSION
from sqlalchemy import INT, VARCHAR, Column
from sqlalchemy.ext.declarative import declarative_base
BASE = declarative_base()
class Fruit(BASE):
__tablename__ = "fruit"
name = Column(VARCHAR, primary_key=True)
count = Column(INT, nullable=False)
def dumps(self... | 2.734375 | 3 |
montagne/collector/event.py | warcy/montagne | 0 | 12787309 | from montagne.common.event import BaseEvent, BaseRequest, BaseReply
dst_to_neutron_collector = 'montagne.collector.neutron_collector'
dst_to_nova_collector = 'montagne.collector.nova_collector'
class GetOVSAgentRequest(BaseRequest):
def __init__(self, msg):
super(GetOVSAgentRequest, self).__init__()
... | 2.21875 | 2 |
backend/chat/loggers.py | dmitriyvek/chat_app | 1 | 12787310 | <gh_stars>1-10
import logging
from django.conf import settings
def get_main_logger():
'''Return file logger for info and errors'''
log_formatter = logging.Formatter(
"%(asctime)s — %(name)s — %(levelname)s — %(message)s")
error_formatter = logging.Formatter(
"%(asctime)s — %(name)s — %(me... | 2.25 | 2 |
Desafios/Desafio 90.py | blopah/python3-curso-em-video-gustavo-guanabara-exercicios | 2 | 12787311 | print('''Faça um programa que leia nome e média de um aluno, guardando também a situação em um dicionário.
No final, mostre o conteúdo da estrutura na tela.''')
aluno = dict()
aluno['nome'] = str(input('Insira o nome: '))
aluno['nota'] = float(input('Insira a nota: '))
if aluno['nota'] < 7:
aluno['nota'] = 'repro... | 3.84375 | 4 |
Ex044.py | raphaeltertuliano/Python | 1 | 12787312 | #Elabore um programa que calcule o valor a ser pago por um produto,
#considerando o o seu preço normal e condição de pagamento:
#- Á vista dinheiro/cheque: 10% de desconto
#- À vista no cartão: 5% de desconto
#- Em até 2x no cartão: preço normal
#- 3x ou mais no cartão: 20% de juros
valor = float(input('Valor do produ... | 3.796875 | 4 |
src/microq_admin/utils.py | Odin-SMR/qqjobs | 0 | 12787313 | from sys import stderr
CONFIG_PATH = '/odin.cfg'
CONFIG_FILE_DOCS = """The configuration file should contain these settings:
ODIN_API_ROOT=https://example.com/odin_api
ODIN_SECRET=<secret encryption key>
JOB_API_ROOT=https://example.com/job_api
JOB_API_USERNAME=<username>
JOB_API_PASSWORD=<password>
It may contain:
... | 2.328125 | 2 |
egs/chime4/wer.py | wbengine/SPMILM | 25 | 12787314 | <reponame>wbengine/SPMILM
import os
import sys
import numpy as np
sys.path.insert(0, os.getcwd() + '/../../tools/')
import wb
def nbest_rmUNK(read_nbest, write_nbest):
f = open(read_nbest, 'rt')
fo = open(write_nbest, 'wt')
for line in f:
fo.write(line.replace('<UNK>', ''))
f.close()
fo.c... | 1.945313 | 2 |
environment/custom/resource_v3/env.py | AndreMaz/transformer-pointer-critic | 5 | 12787315 | from re import L
import sys
from typing import List
from tensorflow.python.ops.gen_array_ops import gather
sys.path.append('.')
import json
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from random import randint, randrange
from environment.base.base import BaseEnvironment
from envi... | 1.789063 | 2 |
Tools/C2EA/c2eaPfinder.py | sme23/OneHourBlitz | 6 | 12787316 | <reponame>sme23/OneHourBlitz<filename>Tools/C2EA/c2eaPfinder.py
import struct
caches = {}
def getOrSetNew(dicToCheck, key, newFunc):
if key not in dicToCheck:
dicToCheck[key] = newFunc()
return dicToCheck[key]
def memoize(name = None):
def decorator(f):
global caches
# If we are gi... | 2.390625 | 2 |
src/Ot2Rec/motioncorr.py | MichaelStubbings/Ot2Rec | 0 | 12787317 | # Copyright 2021 Rosalind Franklin Institute
#
# 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 ... | 2.03125 | 2 |
api/tests/integration/tests/substructure/tau_enumeration.py | f1nzer/Indigo | 0 | 12787318 | <filename>api/tests/integration/tests/substructure/tau_enumeration.py<gh_stars>0
import os
import sys
sys.path.append(
os.path.normpath(
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common")
)
)
from env_indigo import *
indigo = Indigo()
# indigo_inchi = IndigoInchi(indigo);
def testEn... | 2.296875 | 2 |
MNIST/ram2/GlimpseNet.py | mimikaan/Attention-Model | 48 | 12787319 | import tensorflow as tf
from Globals import *
from BaseNet import *
class GlimpseNet(BaseNet):
def __init__(self):
self.imageSize = constants['imageSize']
self.imageChannel = constants['imageChannel']
self.numGlimpseResolution = constants['numGlimpseResolution']
self.glimpseOutput... | 2.390625 | 2 |
test/analysis/classification/test_classifier_summary_builder.py | marta18a/sleep_classifiers | 97 | 12787320 | <gh_stars>10-100
from unittest import TestCase, mock
from unittest.mock import call
from sklearn.linear_model import LogisticRegression
from source.analysis.classification.classifier_summary_builder import SleepWakeClassifierSummaryBuilder
from source.analysis.performance.raw_performance import RawPerformance
from so... | 2.46875 | 2 |
app/migrations/0005_alter_business_options_alter_neighbourhood_options_and_more.py | james-muriithi/neighbourhood | 0 | 12787321 | # Generated by Django 4.0.3 on 2022-03-20 10:33
import cloudinary.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0004_post_slug'),
]
operations = [
migrati... | 1.828125 | 2 |
riverrunner/static/arima_exploration.py | lukeWaninger/RiverRunner | 1 | 12787322 | """
Module for data exploration for ARIMA modeling.
This module contains the back-end exploration of river run flow rate
data and exogenous predictors to determine the best way to create a
time-series model of the data. Note that since this module was only used
once (i.e. is not called in order to create ongoing predi... | 3.046875 | 3 |
tests/http/test_todo.py | fumiya-kubota/sanic-gino-boilerplate | 2 | 12787323 | import pytest
import json
@pytest.mark.usefixtures('cleanup_db')
async def test_todo_api(app, test_cli):
"""
testing todo api
"""
# GET
resp = await test_cli.get('/api/todo')
assert resp.status == 200
resp_json = await resp.json()
assert len(resp_json['todo_list']) == 0
# POST
... | 2.1875 | 2 |
python_scripts/nalu/nrel_5mw_scaling.py | lawsonro3/python_scripts | 0 | 12787324 | import os
import numpy as np
import matplotlib.pyplot as plt
try:
import python_scripts.nalu.io as nalu
except ImportError:
raise ImportError('Download https://github.com/lawsonro3/python_scripts/blob/master/python_scripts/nalu/nalu_functions.py')
if __name__ == '__main__':
root_dir = '/Users/mlawson/Goog... | 2.421875 | 2 |
code/src/plan2scene/crop_select/util.py | madhawav/plan2scene | 305 | 12787325 | <gh_stars>100-1000
from plan2scene.common.image_description import ImageDescription, ImageSource
from plan2scene.common.residence import Room, House
from plan2scene.config_manager import ConfigManager
from plan2scene.texture_gen.predictor import TextureGenPredictor
from plan2scene.texture_gen.utils.io import load_conf_... | 2.109375 | 2 |
barbante/recommendation/tests/TestRecommenderHRChunks.py | hypermindr/barbante | 10 | 12787326 | """ Test module for barbante.recommendation.RecommenderHRChunks class.
"""
import nose.tools
import barbante.tests as tests
from barbante.recommendation.tests.fixtures.HybridRecommenderFixture import HybridRecommenderFixture
class TestRecommenderHRChunks(HybridRecommenderFixture):
""" Class for testing barbante... | 2.015625 | 2 |
TicTak.py | serglit72/Python_exercises | 0 | 12787327 | from random import randint
from IPython.display import clear_output
def display(grid,player_a,player_b):
print("_1_"+'|'+"_2_"+'|'+"_3_")
print("_4_"+'|'+"_5_"+'|'+"_6_"+" Player A ("+player_a+") uses key "+marker+" !! ")
print(" 7 "+'|'+" 8 "+'|'+" 9 "+" Player B ("+player_b+") uses key ... | 3.859375 | 4 |
common/OpTestQemu.py | vaibhav92/op-test-framework | 0 | 12787328 | <reponame>vaibhav92/op-test-framework
#!/usr/bin/env python2
#
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2015,2017
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with th... | 2.5 | 2 |
day10/script.py | SemicolonAndV/AoC2020 | 0 | 12787329 | from collections import defaultdict
with open('day10/input.txt', 'r') as file:
data = sorted([int(x.strip()) for x in file.readlines()])
data = [0] + data
data.append(data[-1] + 3)
jolt_1, jolt_3 = 0, 0
for i in range(len(data)):
current = data[i - 1]
if (data[i] - current) == 1:
jolt_1 += 1
... | 3.40625 | 3 |
LMM/association/networkGWAS_snpSet.py | BorgwardtLab/networkGWAS | 1 | 12787330 | <reponame>BorgwardtLab/networkGWAS
'''
Compared to the original implementation at
https://github.com/fastlmm/FaST-LMM/
this file has been modified by <NAME>
'''
from pysnptools.util.mapreduce1.runner import *
import time
import argparse
import pandas as pd
from IPython import embed
from association import FastLmmSet
f... | 2.328125 | 2 |
examples/horse2zebra.py | tmabraham/unpaired-img2img-translation | 0 | 12787331 | from fastai.vision.all import *
from fastai.basics import *
from upit.models.cyclegan import *
from upit.train.cyclegan import *
from upit.data.unpaired import *
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--experiment_name', type=str, default='... | 2.25 | 2 |
String Functions/palindrome1.py | adrikagupta/Must-Know-Programming-Codes | 13 | 12787332 | <filename>String Functions/palindrome1.py
# to check string is a palindrome ro not
#for easy understanding for the logic of palindrome
def palindrome(word):
#reverse of the string
reverse = rev_string(word)
if (word == reverse):
print('Palindrome')
else:
print('Not a palindrome')
def rev_string(word):
new... | 4.34375 | 4 |
src/cefpython3.wx/__init__.py | donalm/cefpython | 1 | 12787333 | <filename>src/cefpython3.wx/__init__.py<gh_stars>1-10
# This dummy file is overwritten by "__init__.py.template", see:
# cefpython/windows/installer/
# cefpython/linux/installer/
| 1.351563 | 1 |
lib/python/modules/dxxtools/setup.py | tetsuzawa/spatial-research | 0 | 12787334 | <filename>lib/python/modules/dxxtools/setup.py
from setuptools import setup
setup(
name="dxxtools",
version="0.1.4",
description="dxxtools is a package of useful tools for .DXX",
packages=["dxxtools"],
install_requires=["dxx", "numpy", "matplotlib"],
entry_points={
"console_scripts": [
... | 1.414063 | 1 |
estore_project/users/migrations/0003_auto_20210504_1555.py | Jawayria/estore_project | 0 | 12787335 | # Generated by Django 3.1.8 on 2021-05-04 15:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20210504_1433'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='first_name',
... | 1.664063 | 2 |
practice_problems/trees_graphs/bst_sequence.py | YazzyYaz/codinginterviews | 0 | 12787336 | <filename>practice_problems/trees_graphs/bst_sequence.py
import pprint
def bst_sequences(bst):
return bst_sequences_partial([], [bst])
def bst_sequences_partial(partial, subtrees):
if not len(subtrees):
return [partial]
sequences = []
for index, subtree in enumerate(subtrees):
next_pa... | 3.625 | 4 |
PythonTest/clock.py | linux-flower/Python-Clock | 0 | 12787337 | from tkinter import *
from datetime import datetime
# Colors
black: str = "#3d3d3d" # Preto
white: str = "#fafcff" # Branco
green: str = "#21c25c" # Verde
red: str = "#eb463b" # Vermelho
grey: str = "#dedcdc" # Cinza
blue: str = "#3080f0" # Azul
wallpeper: str = white
color = black
window = Tk()
window.title("... | 3.59375 | 4 |
mi-oj/NC30.py | wisesky/LeetCode-Practice | 0 | 12787338 | #
# return the min number
# @param arr int整型一维数组 the array
# @return int整型
#
class Solution:
def minNumberdisappered(self , arr ):
# write code here
# idx = float('inf')
for i, num in enumerate(arr):
if num == 1:
break
else:
return 1... | 3.1875 | 3 |
ninjia/preprocess/align_garbbed_csv.py | taohu88/ninjia | 0 | 12787339 | <gh_stars>0
import sys
import re
from dateutil.parser import parse
EMAIL_REGEX = re.compile(r"[^@]+@[^@]+\.[^@]+")
def is_email_address(txt):
return EMAIL_REGEX.match(txt)
def is_tax_flags(txt):
return txt.endswith("NNNNNNN")
def is_date(txt):
try:
parse(txt)
retur... | 2.8125 | 3 |
panaxea/core/Model.py | DarioPanada/panaxea | 1 | 12787340 | <reponame>DarioPanada/panaxea
import os
import sys
import time
from collections import defaultdict
from panaxea.core.Schedule import Schedule
class Model(object):
"""
Initializes a model object. The model object is the primary
component of each simulation, holding the schedule,
the enviro... | 3.453125 | 3 |
services/real-time-voice-cloning/test_service.py | arturgontijo/dnn-model-services | 26 | 12787341 | <gh_stars>10-100
import sys
import grpc
# import the generated classes
import service.service_spec.voice_cloning_pb2_grpc as grpc_bt_grpc
import service.service_spec.voice_cloning_pb2 as grpc_bt_pb2
from service import registry
TEST_URL = "https://raw.githubusercontent.com/singnet/dnn-model-services/master/" \
... | 2.515625 | 3 |
screenshot.py | lizadaly/a-physical-book | 78 | 12787342 | <filename>screenshot.py
import selenium.webdriver as webdriver
from selenium.webdriver.support.ui import WebDriverWait
import contextlib
import time
CHAPTERS = 590
@contextlib.contextmanager
def quitting(thing):
yield thing
thing.quit()
with quitting(webdriver.Firefox()) as driver:
driver.set_window_si... | 3.1875 | 3 |
notebooks/classic/solution/matplotlib-subplots.py | kmunve/ml-workshop | 3 | 12787343 | fig, ax = plt.subplots(2, sharex='all', figsize=(10, 5))
ax[0].plot(t, s)
ax[0].set_ylabel('voltage (mV)')
ax[0].set_title('Linear')
ax[0].grid(True)
ax[0].set_yscale('linear')
ax[1].plot(t, s)
ax[1].set_xlabel('time (s)')
ax[1].set_ylabel('voltage (mV)')
ax[1].set_title('Log')
ax[1].grid(True)
ax[1].set_yscale('log'... | 2.421875 | 2 |
ton_metrics_push.py | certusone/ton_exporter | 0 | 12787344 | <gh_stars>0
#!/usr/bin/env python3.6
# Quick and dirty metrics exporter for the TON C++ node.
import subprocess
import argparse
import tempfile
import os
import sys
import json
import base64
import binascii
import re
import pathlib
parser = argparse.ArgumentParser()
parser.add_argument('--output', help="node_exporter... | 1.992188 | 2 |
recipe_scrapers/cookingcircle.py | gloriousDan/recipe-scrapers | 0 | 12787345 | import re
from ._abstract import AbstractScraper
from ._utils import get_minutes
class CookingCircle(AbstractScraper):
@classmethod
def host(cls):
return "cookingcircle.com"
def author(self):
return (
self.soup.find("div", {"class": "recipe-author"})
.findChild("s... | 2.421875 | 2 |
coro/dns/stub_resolver.py | mkushnir/shrapnel | 1 | 12787346 | <filename>coro/dns/stub_resolver.py
# -*- Mode: Python -*-
import coro
import coro.dns
import coro.dns.packet as packet
import random
class QueryFailed (Exception):
pass
class stub_resolver:
def __init__ (self, nameservers, inflight=200):
self.nameservers = nameservers
self.inflight = coro.... | 2.28125 | 2 |
validator/utils.py | digital-land/validator | 0 | 12787347 | import codecs
import collections
import sys
import csv
import os
from os.path import basename, dirname
import pandas as pd
import magic
import mimetypes
from cchardet import UniversalDetector
from validator.logger import get_logger
tmp_dir = None
logger = get_logger(__name__)
def extract_data(path, standard):
... | 2.859375 | 3 |
fix-links.py | jounile/jounileino.com | 0 | 12787348 | <filename>fix-links.py
#!/usr/bin/python
from bs4 import BeautifulSoup
"""
Before using this script run the following command:
$ npm run build
Hosting a static website in AWS S3 requires that names of the accessed object is exactly the one that a link points to.
Astro creates a /dist directory with all the HTML page... | 3.3125 | 3 |
tf_quat2rot/tests/test_quat2rot_graph_mode.py | risteon/tf_quat2rot | 1 | 12787349 | # -*- coding: utf-8 -*-
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
import tensorflow as tf
import tf_quat2rot
class TestGraphMode(tf.test.TestCase):
@tf.function
def _run_in_graph(self, batch_shape=(2, 1, 3)):
self.assertTrue(not tf.executing_eagerly())
random_quats = tf_quat2rot.random... | 2.296875 | 2 |
00_Original/42_Insiderwissen/Generatoren_als_Konsumenten/konsumierender_generator_pipeline.py | felixdittrich92/Python3_book | 0 | 12787350 | <filename>00_Original/42_Insiderwissen/Generatoren_als_Konsumenten/konsumierender_generator_pipeline.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def konsument(f):
def h_f(*args, **kwargs):
gen = f(*args, **kwargs)
next(gen)
return gen
return h_f
@konsument
def filter_hebe(stufe, ... | 2.578125 | 3 |