seq_id stringlengths 4 11 | text stringlengths 113 2.92M | repo_name stringlengths 4 125 ⌀ | sub_path stringlengths 3 214 | file_name stringlengths 3 160 | file_ext stringclasses 18
values | file_size_in_byte int64 113 2.92M | program_lang stringclasses 1
value | lang stringclasses 93
values | doc_type stringclasses 1
value | stars int64 0 179k ⌀ | dataset stringclasses 3
values | pt stringclasses 78
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
32560325870 | # coding: utf-8
# author: chenhongqing
from Public.appBase import *
import sys
import unittest
import os
import time
app = appBase()
class tab_download(unittest.TestCase, BasePage):
"""TAB DOWNLOAD下面的功能检查"""
@classmethod
@setupclass
def setUpClass(cls):
cls.d.app_start(app.pkg_name)
@cla... | taylortaurus/android-ui-runner | testsuite/case/test_04_tab_download.py | test_04_tab_download.py | py | 5,615 | python | en | code | 0 | github-code | 36 |
3974726049 | import json
import os
from datetime import datetime
from sys import exit as x
from typing import List
import cv2
import numpy as np
import pandas as pd
import printj # pip install printj
from jaitool.inference import D2Inferer as inferer
from jaitool.inference.models.hook import draw_info_box, draw_inference_on_hook2... | Jitesh17/jaitool | jaitool/inference/models/hook/hook.py | hook.py | py | 25,575 | python | en | code | 0 | github-code | 36 |
7796314828 | #
# 最大公约数:
# 1. 更损相减法
# 2.辗转相除法
# 更损相减法
# def solution(a, b):
# while a != b:
# if a > b:
# a = a - b
# else:
# b = b - a
# return a
# 辗转相除法
def solution(a, b):
if a < b:
a, b = b, a
while b != 0:
t = b
a = a % b
b = t
i... | 20130353/Leetcode | target_offer/大整数+经典算法/最大公约数.py | 最大公约数.py | py | 492 | python | en | code | 2 | github-code | 36 |
73387100264 | import time
from dataclasses import dataclass
from transmitter import sendEmail
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.firefox.options import Options as FFOptions
from selenium.webdriver.common.... | ghazis/auto_flights | backend/flight_scraper/AutoWeb.py | AutoWeb.py | py | 3,652 | python | en | code | 0 | github-code | 36 |
16266301757 | class Solution:
def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]:
def make_graph(n, edges):
g = {v:set() for v in range(n)}
for u,v in edges:
g[u].add(v)
g[v].add(u)
return g
g = make_graph(n, edges... | alexbowe/LeetCode | 0310-minimum-height-trees/0310-minimum-height-trees.py | 0310-minimum-height-trees.py | py | 685 | python | en | code | 5 | github-code | 36 |
74946729704 | '''
Question link: https://leetcode.com/problems/string-to-integer-atoi/
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).
The algorithm for myAtoi(string s) is as follows:
Read in and ignore any leading whitespace.
Check if the next chara... | BhatnagarKshitij/Algorithms | Leetcode/stringToAtoi.py | stringToAtoi.py | py | 2,103 | python | en | code | 2 | github-code | 36 |
32203986950 | import streamlit as st
from recipesnet.api import RecipesApi
from recipesnet.st_helpers import recip_ingr_widget
st.set_page_config("Recipes net", layout="wide")
st.title("Recipes similarity")
st.write(
"""
In this section you can search what recipes are similar to an specific one.
"""
)
with st.spinner("Lo... | jmorgadov/complex-recipes-net | recipesnet/pages/Similarity.py | Similarity.py | py | 1,054 | python | en | code | 0 | github-code | 36 |
70616752744 | import constants
from flask import jsonify, make_response
def getData(request):
body = request.json
outlook = body['outlook']
temp = body['temp']
humidity = body['humidity']
wind = body['wind']
data = [
constants.OUTLOOK_VALUES[outlook],
constants.TEMP_VALUES[temp],
con... | mgstabrani/play-tennis-model-service-python | general.py | general.py | py | 675 | python | en | code | 0 | github-code | 36 |
2114773970 | import time
def lista(N):
L = []
for x in range(N):
L.append(x)
return L
def lista_yield(N):
for x in range(N):
yield x
print(lista(10))
print(lista_yield(10))
Generador = lista_yield(10)
#0 1 2 3 4 5 6 7 8 9
for x in Generador:
print(x)
Generador_2 = lista_yield(15)
print( ... | nicooffee/ay-paradigmas-2020-01 | ejercicios_ayudantia-2020/nico_ejer/2020-05-11/yield.py | yield.py | py | 614 | python | pt | code | 1 | github-code | 36 |
15772164828 | from django.shortcuts import render,redirect
from axf.models import SlideShow, Cart,MainDescription, Product,CategorieGroup,ChildGroup,User,Address,Order
from django.contrib.auth import logout
import random
from axf.sms import send_sms
from django.http import JsonResponse
import uuid
# Create your views here.
def hom... | qwewangjian/Xgd | axf/views.py | views.py | py | 8,953 | python | en | code | 0 | github-code | 36 |
17878539903 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Helper functions for the workflows"""
from distutils.version import StrictVersion
from builtins import range
def _tofloat(inlist):
if isinstance(inlist, (list, tuple)):
return [float(el) fo... | pGarciaS/PREEMACS | scripts/mriqc/mriqc/workflows/utils.py | utils.py | py | 5,355 | python | en | code | 8 | github-code | 36 |
31095405505 | #You'r a robot?
from random import randint, randrange
from PIL import Image, ImageDraw, ImageFont
import os
import textwrap
class CreateCaptcha:
def __init__(self):
self.valido = False
self.l = []
self.width = 300
self.height = 150
self.font_size = 60 # Tamanho ... | Jv131103/ProjectCaptcha | cp.py | cp.py | py | 2,968 | python | pt | code | 0 | github-code | 36 |
4978717366 | #!/usr/bin/python3
from PyQt5 import QtCore
from PyQt5.QtCore import QSize, QUrl
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
from PyQt5.QtMultimediaWidgets import QVideoWidget
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import QMainWindow,QWidget, QPushButton
from PyQt5.QtGui import QIcon, QPixma... | SalomanYu/StudyWithMe | main.py | main.py | py | 15,163 | python | en | code | 1 | github-code | 36 |
42482969055 | from __future__ import print_function
import logging
from optparse import OptionParser
import os
import re
import subprocess
import sys
import tempfile
from threading import Thread, Lock
import time
if sys.version < '3':
import Queue
else:
import queue as Queue
# Append `SPARK_HOME/dev` to the Python path so ... | TIBCOSoftware/snappydata | python/run-snappy-tests.py | run-snappy-tests.py | py | 7,072 | python | en | code | 1,041 | github-code | 36 |
7431120432 | from sqlalchemy import create_engine
from constants import get_nutrient_idx
def load_cache():
db = create_engine('sqlite:///usda.sql3')
cache = {}
query = "SELECT food.id,food.long_desc,food_group.name,nutrient.tagname,nutrition.amount,weight.gm_weight,weight.gm_weight*nutrition.amount/100.0 as gm_amount,wei... | sidowsky/sr_takehome | loaders.py | loaders.py | py | 1,169 | python | en | code | 0 | github-code | 36 |
8272148926 | #!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 17:55:12 2023
@author: Carlos Gómez-Huélamo
"""
# General purpose imports
import sys
import os
import pdb
import git
if str(sys.version_info[0])+"."+str(sys.version_info[1]) >= "3.9": # Python >= 3.9
from math import gcd
else:
from f... | Cram3r95/argo2_TGR | model/models/TFMF_TGR.py | TFMF_TGR.py | py | 53,803 | python | en | code | 4 | github-code | 36 |
1395161242 | #!/usr/bin/env python
# coding: utf-8
# 1. Compare and contrast the float and Decimal classes' benefits and drawbacks.
#
# floats are faster and more memory-efficient, suitable for a wide range of values, but can have precision and rounding issues. Decimals provide precise decimal arithmetic, accurate representatio... | Rajn013/assignment-020 | Untitled83.py | Untitled83.py | py | 3,685 | python | en | code | 0 | github-code | 36 |
973355858 | from pathlib import Path
import unittest
from lispy import reader
from lispy import rep as step6_file
from lispy.env import Env
from lispy.mal_types import MalList, MalAtom, MalInt
from lispy.mal_types import MalSyntaxException, MalString
class TestStep6(unittest.TestCase):
def setUp(self) -> None:
self.... | rectalogic/lispy | tests/test_step6.py | test_step6.py | py | 3,164 | python | en | code | 0 | github-code | 36 |
15062588717 | n = int(input())
l = list(map(int,input().split()))
p = 0
c = 0
for i in range(len(l)):
if i%2!=0:
p+=1
if l[i]%2!=0:
c+=1
if p==c:
print(True)
else:
print(False) | SAIRAJA2005/codemind-python | Strictly_ODD.py | Strictly_ODD.py | py | 202 | python | en | code | 0 | github-code | 36 |
19035164489 | import random
import os
def asOrderedList(d):
ordered = []
for key in d:
ordered.append([key, d[key]])
ordered.sort()
return ordered
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
class Player:
def __init__(self, w):
self.world = w
self.name = input(... | aimalanos/Irtiqa | Player.py | Player.py | py | 64,055 | python | en | code | 0 | github-code | 36 |
31298715713 | class Solution(object):
def maximalSquare(self, matrix):
maximal = 0
m = len(matrix)
n = len(matrix[0])
squreSizeMemo = [[0 for i in range(n+1)] for j in range(m+1)]
for i in range(m-1, -1, -1):
for j in range(n-1, -1, -1):
if (matrix[i][j] == "1... | shwjdgh34/algorithms-python | leetcode/221.py | 221.py | py | 714 | python | en | code | 2 | github-code | 36 |
21091300951 | import streamlit as st
import scraper
stock = ['AAPL', 'AMZN', 'INTC', 'GOOG', 'CSCO']
search_btn = False
if st.sidebar.checkbox("Deseja procurar alguma ação?"):
symbol = st.sidebar.text_input("Dígite o símbolo da ação desejada")
if len(symbol) == 4:
new_company_info = scraper.fetch_info(symbol)
... | rodrigoaqueiroz/laraia-yahoo-finance | main.py | main.py | py | 1,440 | python | pt | code | 0 | github-code | 36 |
19494554547 | from jinja2 import Environment, FileSystemLoader, select_autoescape
env = Environment(
loader=FileSystemLoader('templates'),
autoescape=select_autoescape(['html', 'xml'])
)
def render_run_plan(workout, routes, sunrise_sunset, forecast, dress):
template = env.get_template('run_plan.html')
return templ... | csickelco/runforfun | runforfun/util/template_engine.py | template_engine.py | py | 452 | python | en | code | 0 | github-code | 36 |
15724939255 | import ast
import os
# Third party imports
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
def get_version(module='spyder_reports'):
"""Get version."""
with open(os.path.join(HERE, module, '_version.py'), 'r') as f:
data = f.read()
lines = data.split... | spyder-ide/spyder-reports | setup.py | setup.py | py | 1,820 | python | en | code | 72 | github-code | 36 |
43965888115 | import ast
from django.db.models import Q
from django.db import transaction
from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework.permissions import IsAuthenticated
from rest_framework.exceptions import ValidationError
from rest_framework.generics import ListAPIView
from commo... | BharatPlutus/python-django-sample | services/views/service.py | service.py | py | 16,111 | python | en | code | 0 | github-code | 36 |
13823383640 | import numpy as np
import matplotlib.pyplot as plt
from shapely import geometry
from numpy.linalg import norm
from random import *
import pickle
def reach_set_calc(x_val, reach_range):
"""
:type x_val: list
:type reach_range: float
:return: reach_set: Polygon
Description: With given x and reach_ra... | DRK98519/aCBC | game_play.py | game_play.py | py | 36,021 | python | en | code | 0 | github-code | 36 |
32331250687 | #!/usr/bin/python3
"""
Script that takes in a letter and sends a POST request
to http://0.0.0.0:5000/search_user with the letter as a
parameter.
"""
from sys import argv
import requests
if __name__ == "__main__":
if len(argv) < 2:
q = ""
else:
q = argv[1]
values = {'q': q}
url = "ht... | ammartica/holbertonschool-higher_level_programming | 0x11-python-network_1/8-json_api.py | 8-json_api.py | py | 617 | python | en | code | 0 | github-code | 36 |
22350898838 | import grid
import shapes
import random
class Game:
def __init__(self):
self.gameData = grid.BlockGrid(10, 25, margin=5, swidth=25, sheight=25)
self.jshape = shapes.JShape()
self.lshape = shapes.LShape()
self.lineshape = shapes.LineShape()
self.squareshape = shapes... | chrisgliu/TetrisGame | PyTetris/tetris.py | tetris.py | py | 5,626 | python | en | code | 0 | github-code | 36 |
3735254268 | #!/usr/bin/env python3
#
# get_ad_right_matrix.py
# Export AD User -> Group Matrix to Excel
# Written by Maximilian Thoma 2021
#
import json
import re
import ldap3
import pandas as pd
########################################################################################################################
# NOTE:
# --... | lanbugs/get_ad_right_matrix | get_ad_right_matrix.py | get_ad_right_matrix.py | py | 4,692 | python | en | code | 3 | github-code | 36 |
25108240229 | from zigzag.classes.io.onnx.parser import Parser
from zigzag.classes.io.onnx.utils import get_node_input_output_dimension_shapes
from zigzag.classes.workload.layer_node import LayerNode
import logging
logger = logging.getLogger(__name__)
class SoftmaxParser(Parser):
"""Parser for ONNX Softmax nodes into... | wangxdgg/zigzag_2 | zigzag/classes/io/onnx/softmax2.py | softmax2.py | py | 3,148 | python | en | code | 0 | github-code | 36 |
35042458812 | import pickle
import argparse
import pickle
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--fasta', help='fasta input file')
args = parser.parse_args()
junction_id_to_seq = {}
with open(args.fasta, "r") as f:
while True:
line1 = f.readline()
if not line1:
break
... | salzmanlab-admin/DEEPEST-Fusion | reference_files/create_pickle_file.py | create_pickle_file.py | py | 471 | python | en | code | 5 | github-code | 36 |
42659570407 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 14 08:08:07 2023
@author: jtazioli
TIP CALCULATOR:
input cost of total bill
input percentage of tip
output cost per person
"""
tot_cost = float(input("What is the cost of the bill?\n"))
tip_percent = float(input("What percent do you want to lea... | JTazi/100-Days-of-Code | day2/tip_calculator.py | tip_calculator.py | py | 588 | python | en | code | 0 | github-code | 36 |
28853226017 | import bpy
from bpy.types import Menu
brush_icons = {}
def create_icons():
global brush_icons
icons_directory = bpy.utils.system_resource('DATAFILES', path="icons")
brushes = [
"border_mask",
"border_hide",
"box_trim",
"line_project",
]
import os
for brush in... | jmobley0429/my_pie_menus | menus/sculpt_mode_pies.py | sculpt_mode_pies.py | py | 3,776 | python | en | code | 1 | github-code | 36 |
72692974183 | from ast import literal_eval
import pymongo
# Handles all interactions with the database
class DbManager:
database = None
def __init__(self):
# Client instantiation with the MongoDB Client
self.client = pymongo.MongoClient(
"mongodb+srv://gdp:gdp@propaganda.m00hm.mongodb.net/Tril... | madeleinemvis/original_gdp | BackEnd/functions/dbmanager.py | dbmanager.py | py | 5,836 | python | en | code | 0 | github-code | 36 |
32568853073 | # -*- coding: utf-8 -*-
from logbook import Logger
import numpy as np
import pandas as pd
from zipline.data.bundles import register
from zipline.utils.calendars import get_calendar
EXPORT_FOLDER = '/mnt/data/earnings_calls/export/'
log = Logger('zipline_ingest.py')
def bundle_hf_data(price_file, debug = False)... | olgsfrt/earningscall | backtest/zipline_ingest.py | zipline_ingest.py | py | 4,373 | python | en | code | 0 | github-code | 36 |
19634743961 | """
Usage: negotiator-cli [OPTIONS] GUEST_UNIX_SOCKET
Communicate from a KVM/QEMU host system with running guest systems using a
guest agent daemon running inside the guests.
Supported options:
-c, --list-commands
List the commands that the guest exposes to its host.
-e, --execute=COMMAND
Execute the given ... | htrc/HTRC-DataCapsules | backend/tools/negotiator-cli/negotiator-cli.py | negotiator-cli.py | py | 5,639 | python | en | code | 4 | github-code | 36 |
11820326179 | from abc import ABC, abstractmethod
import ml.optimization.gradient_descent_optimizer as gradient_descent_optimizer
import numpy as np
class BoostedRegressor(ABC):
def __init__(self, pointwise_loss, num_learners, learner_regularizer = 1):
BoostedRegressor.set_params(self, pointwise_loss, num_learners, lea... | jek343/StanfordMedical | ml/model/regression/gradient_boosting/boosted_regressor.py | boosted_regressor.py | py | 2,248 | python | en | code | 0 | github-code | 36 |
7210833797 | # -*- coding: utf-8 -*-
from odoo import api, models, fields, registry
import odoo
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
import json
import logging
_logger = logging.getLogger(__name__)
class pos_call_log(models.Model):
_rec_name = "call_model"
_name = "pos.call.log"
_description = "Log d... | mahmohammed16881688/odoo_12 | addons/pos_retail/models/pos/pos_call_log.py | pos_call_log.py | py | 3,733 | python | en | code | 1 | github-code | 36 |
18393968114 | class Solution:
def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]:
rows = len(heights)
cols = len(heights[0])
# get all cells adjecant to pacific and atlantic
pacific_queue = deque()
atlantic_queue = deque()
for i in ran... | ileenf/Data-Structures-Algos | BFS/pacific_atlantic_water_flow.py | pacific_atlantic_water_flow.py | py | 1,367 | python | en | code | 0 | github-code | 36 |
10704896320 | '''
Created on May 12, 2010
Harvests all PDB structures from PDB database
@author: ed
'''
import urllib, sys, os, random, math
otherProteins = open(sys.argv[1],'r')
otherProts = otherProteins.readlines()
notPDZDomain = []
pdzDomain =[]
pdzIds = []
notPDZIds = []
pdzActives = open(sys.argv[2],'w')
pdzInactives = open(s... | eoc21/Protein-Descriptors | src/csdsML/WebHarvester.py | WebHarvester.py | py | 1,631 | python | en | code | 4 | github-code | 36 |
7696440509 | from django.conf.urls import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^reservar/(?P<id>\d+)/$',Reservrlibros),
url(r'^consultaLibos/$',ConsultaLibros.as_view(), name='ConsultaLibros'),
url(r'^reservaExitosa/$',MostrarReservas),
#url(r'^Verreservas/$',Verreservas),
#url(r'^busq... | juanjavierlimachi/Biblioteca | Biblioteca/Biblioteca/apps/estudiantes/urls.py | urls.py | py | 426 | python | es | code | 0 | github-code | 36 |
18039525483 | from keras import layers,models,optimizers,losses
from keras.datasets import cifar10
import tensorflow as tf
import pandas as pd
import matplotlib.pyplot as plt
(X_train,y_train),(X_test,y_test)=cifar10.load_data()
print(X_train.shape)
print(y_train.shape)
HIDDEN_SIZE=256#要有下划线
NUM_CLASSES=10#要有下划线避免语法... | westbchampion/Python_to_Kaggle | 手写卷积神经网络_test.py | 手写卷积神经网络_test.py | py | 1,540 | python | en | code | 0 | github-code | 36 |
19766387119 | # készíts programot ami egy bevitt mondatban megszámolja a számokat és a betűket (külön)
# és kiírja az eredményt. pl: szia 123 -> betűk: 4, számok: 3
sentence = input('irj be egy mondatot: ')
digits = 0
letters = 0
for c in sentence:
if c.isdigit():
digits = digits + 1
if c.isalpha():
le... | Zatyi94/gyakorlas | 5.py | 5.py | py | 425 | python | hu | code | 0 | github-code | 36 |
30284661095 | # Differential Equations part 1
import numpy as np
g = 9.8
L = 2
mu = 0.1
theta_0 = np.pi/30
theta_dot_0 = 0
def get_theta_double_dot(theta, theta_dot):
return -mu*theta_dot - (g/L) * np.sin(theta)
# Solution to diff eqn
def theta(t):
theta = theta_0
theta_dot = theta_dot_0
delta_t = 0.01
for ... | AaryanChhabra/Training-DS-Python | Python ML/Experiment.py | Experiment.py | py | 539 | python | en | code | 0 | github-code | 36 |
35734197596 | from manage_company import CompanyManager
import sqlite3
class console:
def __init__(self):
self.manager = CompanyManager('database.db')
self.commands = {
"read_command": self.read_command,
"list_employees": self.list_employees,
"add_employee": self.add_employe... | yordanovagabriela/HackBulgaria | week7/company/console.py | console.py | py | 1,951 | python | en | code | 0 | github-code | 36 |
74936854824 | from loguru import logger
import configparser as cfg
import os
def logger_handler(msg: str, mode=2) -> None:
"""
Handles logging of messages
mode: 0 = debug, 1 = info, 2 = error (default)
"""
# construct logger
_log_constructor(mode)
# log message
if mode == 0:
logger.excepti... | Anton0Lashov/dng_extractor | _logger.py | _logger.py | py | 1,503 | python | en | code | 0 | github-code | 36 |
32289074245 | def main():
place = [1,2,3,4,5,6,7,8,9]
turn = 0
while (checkwin):
drawboard(place)
turn += 1
xo = " "
if (turn % 2 == 0):
play = int(input("x's turn to choose a square (1-9):"))
xo = "x"
else:
play = int(input("o's turn to shoos... | dannyfwalter1/personal-python | tictactoe/__main__.py | __main__.py | py | 1,207 | python | en | code | 0 | github-code | 36 |
17354358336 | import typing as t
import numpy as np
from emo_utils import convert_to_one_hot
from emo_utils import predict
from emo_utils import softmax
from tensorflow.keras.layers import LSTM
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
from t... | HarryMWinters/ML_Coursework | Course 6, Sequence Models/Week 2/assignment_2/Emoji_v3a.py | Emoji_v3a.py | py | 8,499 | python | en | code | 0 | github-code | 36 |
26454404997 | import gc
import logging
import os
import glob
import pandas as pd
import sys
# sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
import time
from collections import defaultdict
import torch
import torch.nn as nn
import torch.optim as optim
from math import exp
import numpy as np
torch.backends.cudn... | Vikr-182/ddn-forecasting | vis/infer.py | infer.py | py | 10,164 | python | en | code | 0 | github-code | 36 |
6043631950 | from .dbtest import (
DbTest,
dbconnect
)
import os
from psycopg2.extras import (
RealDictCursor,
RealDictRow
)
PATH_TO_SQL_DIR = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"sql"
)
)
class TestExample(DbTest):
@dbconnect
def test_select_or... | HaithamKhedrSalem/postgis-practices-solution | test/test_example.py | test_example.py | py | 6,115 | python | en | code | 0 | github-code | 36 |
29382149888 | import json
import boto3
from botocore.exceptions import ClientError
import os
region = os.environ['AWS_REGION']
sess = boto3.session.Session(region_name=region)
# def get_bucket_name():
# ssmClient = sess.client('ssm')
# response = ssmClient.get_parameter(
# Name = 'ProserveProject_S3BucketName',... | ferozbaig96/Proserve-project | lambdas/DeleteS3Object.py | DeleteS3Object.py | py | 1,191 | python | en | code | 0 | github-code | 36 |
18065190929 | from __future__ import absolute_import
import logging
import numpy as np
from .import utils
from .import sampling
from sklearn.preprocessing import MultiLabelBinarizer, LabelBinarizer
from sklearn.model_selection import StratifiedShuffleSplit
logger = logging.getLogger(__name__)
class Dataset(object):
def _... | raghakot/keras-text | keras_text/data.py | data.py | py | 4,007 | python | en | code | 422 | github-code | 36 |
26921480455 | from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium import webdriver
import time
'''
제가 실행하면 보이나요
python3 test.py
쳐보실래요??
저만 실행 되나... | sinde530/python | interpark/test.py | test.py | py | 4,841 | python | en | code | 0 | github-code | 36 |
14183098505 | import pygame
import config
import math
from unit import Unit
from unit_move import UnitMove
class Enemy(Unit):
def __init__(self, x, y):
super().__init__(x, y)
self.start_position = [x, y]
self.time_till_damage = 0
self.look = [] # [center_x, center_y, rad... | EdySima/The-Lost-Penguin | enemy.py | enemy.py | py | 4,317 | python | en | code | 0 | github-code | 36 |
37538329416 | import scrapy
class CjSpider(scrapy.Spider):
name = 'cj'
# allowed_domains = ['caijing.com']
start_urls = ['https://www.dyxhw.com/']
def parse(self, response):
typess = response.xpath('//div[@class="nav clearfix"]/a[@class="j_ch_nav _block_news_menu"]/@href').getall()
for one_type in ... | ykallan/caijingguancha | caijingguancha/caijingguancha/spiders/cj.py | cj.py | py | 1,497 | python | en | code | 0 | github-code | 36 |
10084081981 | def bin(l, h):
# dap 이라는 변수에 최종 출력값 담기
global dap
# 종료 조건
if l > h:
return
# 중간 값 설정
mid = (l + h) // 2
# 반복문 돌려서 문제 조건에 따라 절단기 높이 설정 후
# 나무 높이에서 절단기 높이를 빼준 값들을 다 더해서 fin으로 값 받기
fin = 0
for a in trees:
if a > mid:
fin += a - mid
# 가져가... | papillonthor/Cool_Hot_ALGO | gyKwon/s2_2805_나무자르기.py | s2_2805_나무자르기.py | py | 1,114 | python | ko | code | 2 | github-code | 36 |
29754454026 | import sys
from PyQt6 import QtCore, QtGui, QtWidgets
from CurConUi import Ui_MainWindow
from currency_converter import CurrencyConverter
class CurrencyConv(QtWidgets.QMainWindow):
def __init__(self):
super(CurrencyConv, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
... | AdirtKa/CurrencyConverter | main.py | main.py | py | 1,476 | python | en | code | 0 | github-code | 36 |
9299459932 | #Intro
print('This program tells you how far an object will fall in a number of seconds.')
#Input
time = int(input('Enter the falling time in seconds: '))
#Defining Function
def fallingDistance(time):
gravity = 9.8
distance = 1 / 2 * gravity * time**2
return round(distance, 1)
#Loop
while time > 0:
prin... | gazarrillo/Falling-Distance-Calculator | Falling Distance.py | Falling Distance.py | py | 473 | python | en | code | 0 | github-code | 36 |
32041540540 | import torch
import drjit as dr
import mitsuba as mi
import sys,os,json
import importlib
sys.path.append(".")
import cv2
import numpy as np
if torch.cuda.is_available():
device = torch.device("cuda:0")
torch.cuda.set_device(device)
else:
device = torch.device("cpu")
from utils.logger import Logger
from util... | jkxing/EPSM_Mitsuba3 | EPSM/optim.py | optim.py | py | 5,566 | python | en | code | 4 | github-code | 36 |
38488846369 | #!/usr/bin/env python3
#
# 10. Bayesian History Matching technique (advanced use)
#
import os
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import json
from GPErks.constants import DEFAULT_TMP_OUTFILE_DIR
from GPErks.perks.history_matching import Wave
from GPErks.serialization.labels imp... | stelong/GPErks | examples/example_10.py | example_10.py | py | 9,883 | python | en | code | 3 | github-code | 36 |
41191349576 | import sys
sys.path.append('../../preprocess')
from make_pca import load_landmarks
import numpy as np
import tensorflow as tf
from pfld import predict_landmarks as pfld_predict_landmarks
from pfld_custom import predict_landmarks as pfld_custom_predict_landmarks
from skimage.color import rgb2gray
import cv2
import dlib
... | vuamitom/shapenet-tensorflow | model/pfld/eval_pfld.py | eval_pfld.py | py | 11,142 | python | en | code | 1 | github-code | 36 |
30876684301 | # This is necessary to find the main code
import operator
import sys
from Bomberman.bomberman.entity import MonsterEntity
from Bomberman.bomberman.sensed_world import SensedWorld
sys.path.insert(0, '../bomberman')
# Import necessary stuff
from entity import CharacterEntity
from colorama import Fore, Back
from queue i... | ifeeney/CS4341-projects | Bomberman/group10/testcharacter.py | testcharacter.py | py | 20,664 | python | en | code | 0 | github-code | 36 |
41700781621 | def factorial(n):
"""Return th factorial of N, a positive integer."""
if n == 1:
return 1
return n * factorial(n-1)
def recursive_multiplication(m, n):
if n == 1:
return m
return m + recursive_multiplication(m, n-1)
def is_prime(n):
def helper(n, m):
if m == 1:
... | yangzilongdmgy/cs61a | discussion/recursion.py | recursion.py | py | 949 | python | en | code | 1 | github-code | 36 |
41245539467 | from pynvml import *
import logging
from datasets import load_dataset
from datasets import ClassLabel
from transformers import LukeTokenizer, LukeModel, LukeForEntityPairClassification, TrainingArguments, Trainer
import torch
from tqdm import trange
# construir função que converta spans de relativos a frase para globa... | joseMalaquias/tese | DOCRED/classic_obtainJSON.py | classic_obtainJSON.py | py | 17,283 | python | en | code | 0 | github-code | 36 |
9910221737 | import subprocess
import threading
import io
from fcntl import fcntl, F_GETFL, F_SETFL
from os import O_NONBLOCK
import sys
#from flask_socketio import SocketIO
command = "pintos -v -k --qemu --disk cs162proj.dsk -- -q run shell"
class Shell():
def set_flags(self, pipe):
flags = fcntl(pipe, F_GETFL)
... | dietd/webpintos | shell.py | shell.py | py | 1,345 | python | en | code | 0 | github-code | 36 |
38031979552 | import click
from .core import NmapReportParser, NmapReport, CSVFileParser, JsonOutput, BateaModel, MatrixOutput
from defusedxml import ElementTree
from xml.etree.ElementTree import ParseError
from batea import build_report
import warnings
warnings.filterwarnings('ignore')
@click.command(context_settings=dict(help_op... | delvelabs/batea | batea/__main__.py | __main__.py | py | 3,254 | python | en | code | 287 | github-code | 36 |
4517993066 | import os
from django.contrib.auth.views import redirect_to_login
from chat.models import *
from django.db.models.query_utils import Q
from notification.models import *
from user.models import *
from post.models import *
from post.forms import *
from group.models import *
from django.shortcuts import redirect, render
f... | longnp030/SocialNetwork-Py | tomo/views.py | views.py | py | 6,784 | python | en | code | 1 | github-code | 36 |
10125696279 | #!/bin/bash/env python
# coding=UTF-8
# by Tarcisio marinho
# github.com/tarcisio-marinho
import requests,json,os
def minha_localizacao(frase):
url = 'http://freegeoip.net/json/'
try:
requisicao = requests.get('http://freegeoip.net/json/')
dicionario = json.loads(requisicao.text)
if(fra... | tarcisio-marinho/Eliza | modulos/mapa.py | mapa.py | py | 2,562 | python | pt | code | 11 | github-code | 36 |
29198681192 | import pandas as pd
def process(mode, dataframe, column_common, column_data, worksheet_list):
df1 = pd.DataFrame()
df2 = pd.DataFrame()
if mode == "A=<-B":
df1 = dataframe[0].copy()
df1.drop_duplicates(subset=['Serial'], inplace=True)
df1.replace(['NO REGISTRA',"",'NO REIGSTRA','',... | SebIngB/SoftwareClinico | procesamiento/config_consult.py | config_consult.py | py | 1,079 | python | en | code | 0 | github-code | 36 |
30473800469 | from tkinter import *
from tkinter import messagebox
from tkinter import ttk
from globalStyle import *
from View.openConn import *
from View.settings import *
from Model.connectDB import *
from Control.session import *
session = Session()
fonts = Fonts()
class SSCI:
def __init__(self, master=None, theme=None):
... | GuilhermeAnselmi/SQLServerControlInterface | SQLServerControlInterface/View/ssci.py | ssci.py | py | 7,398 | python | en | code | 0 | github-code | 36 |
41673811681 | import os
import shutil
from object2urdf import ObjectUrdfBuilder
from cleanup_tools import get_immediate_subdirectories
import argparse
import shapenet
from glob import glob
import point_cloud_utils as pcu
import numpy as np
import trimesh
def as_mesh(scene_or_mesh):
# Utils function that returns a mesh from a t... | dexterousrobot/obj_urdfs | obj_urdfs/build_shapenet_urdfs.py | build_shapenet_urdfs.py | py | 4,788 | python | en | code | 2 | github-code | 36 |
42243521560 | import numpy as np
import matplotlib.pyplot as plt
import bead_util as bu
import scipy.signal as ss
path = "/data/20180927/bead1/spinning/50s_monitor_5min_gaps"
files = bu.find_all_fnames(path)
index = 0
fdrive = 1210.7
bw = 0.5
bwp = 5.
Ns = 250000
Fs = 5000.
k = 1e-13*(2.*np.pi*370.)**2
df = bu.DataFile()
df.load(f... | charlesblakemore/opt_lev_analysis | scripts/spinning/old_scripts/inst_amp_phase_plot.py | inst_amp_phase_plot.py | py | 1,852 | python | en | code | 1 | github-code | 36 |
41744416176 | from st7920 import ST7920
from random import randint
from time import sleep
import curses
import collections
SCALE = 4
WIDTH = 128/SCALE
HEIGHT = 64/SCALE
score = 0
alive = True
s = ST7920()
def newfoodpos():
return [randint(0,WIDTH-1), randint(0,HEIGHT-1)]
def update():
global headpos, foodpo... | JMW95/RaspiLCDGames | snake.py | snake.py | py | 2,499 | python | en | code | 3 | github-code | 36 |
71846182823 | if __name__ == "__main__":
from ESParserPy.dataFile import DataFile
from ESParserPy.dataWriter import DataWriter
import sys
args = sys.argv
outPath = args[1]
saveFile = DataFile(outPath)
system = args[2]
planet = args[3]
for node in saveFile.Begin():
if node.Token(0) == "system":
node.tokens[1] ... | comnom/ES-tools | teleport.py | teleport.py | py | 789 | python | en | code | 3 | github-code | 36 |
32505694658 | import streamlit as st
# import pandas as pd
import numpy as np
import pydeck as pdk
import plotly.express as px
from ParserXML import *
from ConverterToHTML import *
from VisualTools import *
__all__ = [st, pd, np, pdk, px]
DATE_TIME = "date/time"
local_path = ""
file_name = "Datasets/50k_cleaned_from_xml.csv"
DATA_... | StopFuture/AnalyzerXML | AnalyzerXML.py | AnalyzerXML.py | py | 4,533 | python | en | code | 1 | github-code | 36 |
7619783575 | import time
from pathlib import Path
import torch
import torch.nn as nn
from torch.optim import RMSprop, Adam
from torch.optim.lr_scheduler import ReduceLROnPlateau
from .evaluate import evaluate
from .logger import print_logger
def train_net(net,
dataloaders,
device,
resul... | kimjh0107/2022_Rayence_Medical_Image_processing | src/train.py | train.py | py | 3,042 | python | en | code | 0 | github-code | 36 |
2360946621 | """
【问题描述】
输入n个学生的成绩,按总分从大到小输出。
【输入形式】
第一行输入学生人数n。
后续n行,每一行输入一个学生的学号, 姓名,语文成绩和数学成绩。各字段之间用空格隔开。
【输出形式】
输出n行。每一行给出学生学号,姓名,总分。按总分从大到小排序。若总分相同,则按学号从小到大排序。
【样例输入】
5
355 dj 60 70
665 kk 70 80
g33 He 55 95
l222 Li 60 80
n77 Liu 70 60
【样例输出】
665 kk 150
g33 He 150
l222 Li 140
355 dj 130
n77 Liu 130
"""
n = int(input())
temp =... | xzl995/Python | CourseGrading/6.2.12按总分排序.py | 6.2.12按总分排序.py | py | 1,046 | python | zh | code | 3 | github-code | 36 |
17285744603 | from abc import ABCMeta, abstractmethod
import subprocess
import io
from logging import Logger
class Action(metaclass=ABCMeta):
def __init__(self, action_id, job, **kwargs):
self.id = action_id
self.job = job
@abstractmethod
def to_text(self, logger: Logger) -> str:
pass
class T... | SuperH-0630/HelloEmail | action.py | action.py | py | 1,587 | python | en | code | 0 | github-code | 36 |
3458283707 | class TreeNode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def __init__(self):
self.data = []
def helper(self, root):
if root != None:
self.helper(root.left)
... | pi408637535/Algorithm | com/study/algorithm/bts/Binary Tree Inorder Traversal.py | Binary Tree Inorder Traversal.py | py | 795 | python | en | code | 1 | github-code | 36 |
36830649760 | # To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# # SciKitLearn 机器学习库
# - VScode中, `ctrl + /` 快速注释代码
# %%
# Sklearn 通用的学习模式
# 案例1. 本例鸢尾花数据集,使用KNN模块实现分类
import numpy as np
from sklearn import datasets
# from sklearn.cross_validation import train_test_split # cross... | oca-john/Python3-xi | Python3-ipynb/py3.sklearn.py | py3.sklearn.py | py | 7,841 | python | zh | code | 0 | github-code | 36 |
36168624616 | from enum import Enum, auto
from pathlib import Path
import numpy as np
import pandas as pd
import pendulum
import pytest
from whatsappnalysis.lib.custom_types import ChatDataset, Schema
from whatsappnalysis.lib.data_loader import WhatsappLoader
class TestWhatsappLoader:
""" Tests for ChatDataset """
test_c... | lbartell/whatsappnalysis | tests/test_lib/test_data_loader/test_whatsapp_loader.py | test_whatsapp_loader.py | py | 3,175 | python | en | code | 0 | github-code | 36 |
73915422185 | from flask import Flask, request
import base64
from PIL import Image
from preprocess4 import Pr1
from preprocess2 import test_transforms
import torch
from torchvision import models
import torch.nn as nn
import numpy as np
import cv2
def get_net():
finetune_net = nn.Sequential()
finetune_net.features = models.r... | Moezwalha/Alphabet-SL_Prediction_Service | app.py | app.py | py | 2,494 | python | en | code | 0 | github-code | 36 |
5515751660 | import yaml
class Config:
def __init__(self):
self.load_model_epochs = None
self.debug = None
self.n_epochs = None
self.load_g_model_score = None
self.load_d_model_score = None
self.model_no = None
self.batch_size = None
self.n_split = None
se... | spider-man-tm/pix2pix_gray_to_color | config/config.py | config.py | py | 2,313 | python | en | code | 3 | github-code | 36 |
1102521524 | #对比Java,python的文本处理再次让人感动
#! /usr/bin/python
import os
spath = os.path.join(os.getcwd(), "test.txt")
f = open(spath,"w") # Opens file for writing.Creates this file doesn't exist.
f.write("First line 1.\n")
f.writelines("First line 2.")
f.close()
f=open(spath,"r") # Opens file for reading
for line in f:
print("每... | code4love/dev | Python/demos/practice/文件处理.py | 文件处理.py | py | 540 | python | en | code | 0 | github-code | 36 |
33136179454 | from telebot import types
import telebot, wikipedia, re
from config import *
from base_bot import bot
# Test-bot
IDLE = 0
LISTENING_TO_COMMANDS = 2
bot_state = IDLE
@bot.message_handler(commands=['test'])
def start_message(message):
markup = telebot.types.InlineKeyboardMarkup()
markup.add(telebot.types.Inline... | TheGustOff/telegram_bot_gust_MUIV | test_bot.py | test_bot.py | py | 1,635 | python | en | code | 0 | github-code | 36 |
18347648906 | import pandas as pd
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly.io as pio
from matplotlib import cm
# set defaults for charts
pio.templates.default = "plotly_white"
@np.vectorize
def calculate_tax(income):
brackets = [9950, 40525, 86375, 164925, 209... | robert-sturrock/financial-projections | financial_projections.py | financial_projections.py | py | 5,578 | python | en | code | 0 | github-code | 36 |
25864017409 |
# my solution to https://codility.com/programmers/task/binary_gap/
from nose_parameterized import parameterized
import sys
import unittest
def solution(N):
if N is None:
raise TypeError
max_count = 0
while N / 2 is not 0:
current_count = 0
while N % 4 is not 1:
... | m11m/codility | python2/01-binarygap.py | 01-binarygap.py | py | 1,476 | python | en | code | 0 | github-code | 36 |
71124732903 | import os
clear = lambda: os.system('cls')
clear()
# This alg uses merge sort
def Sort_Array(arr):
# Base Case
if len(arr) <= 1:
return
# Divide into 2 =======
mid_idx = len(arr)//2
L_arr = arr[:mid_idx]
R_arr = arr[mid_idx:]
# =====================
# Recu... | Behtash-BehinAein/Data-Structures-and-Algorithms- | General/Merge Sort O_nlogn.py | Merge Sort O_nlogn.py | py | 1,602 | python | en | code | 0 | github-code | 36 |
27119972934 | #Crie um programa onde o usuário possa digitar sete valores numéricos e cadastre-os em uma lista única que mantenha separados os valores pares e ímpares. No final, mostre os valores pares e ímpares em ordem crescente.
lista = [[], []]
contImpar = contPar = 0
for i in range(1, 8):
n = int(input(f'Digite o {i}º valor... | JoaoFerreira123/Curso_Python-Curso_em_Video | Exercícios/#085.py | #085.py | py | 556 | python | pt | code | 0 | github-code | 36 |
3600506632 | import cv2
img = cv2.imread("sample1.png")
cv2.imwrite("sample2.png", img)
img2 = cv2.imread("sample2.png")
grayImg = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
cv2.imshow("Gray", grayImg)
cv2.waitKey(0)
cv2.destroyAllWindows()
| rohith274/AiGuide | AI/Day1/ReadImage.py | ReadImage.py | py | 226 | python | en | code | 0 | github-code | 36 |
20049305182 | import numpy as np
import cv2
from scipy import ndimage, interpolate
def track(I, J, input_points, total_points, window=(21, 21), min_disp=0.01):
output = []
I_gray = cv2.cvtColor(I, cv2.COLOR_BGR2GRAY)
J_gray = cv2.cvtColor(J, cv2.COLOR_BGR2GRAY)
#normalization
I_norm = I_gray/I_gray.max()
... | ocinemod87/Advanced_Topics_Image_Analysis | Assignment_1/Assignment_1.py | Assignment_1.py | py | 4,477 | python | en | code | 0 | github-code | 36 |
23442339369 | import numpy as np
import math
class SMOTE:
"""
Class for doing Synthetic Minority Oversampling Technique
"""
def __init__(self, p: float, k: int, random_state: int = 1337) -> None:
"""
Parameters:
p: Percentage of the minority class required after oversampling
k: Num... | sharwinbobde/cyber-data-analytics | Part-1/smote.py | smote.py | py | 7,815 | python | en | code | 0 | github-code | 36 |
33014908805 |
#==========================================Librerias=======================================#
import time
from machine import RTC
# synchronize RTC with ntp
import ntptime
import startup
import ufirebase as firebase
from comunicacion import Uaart
#=====================================Conexion internet====... | carloscaste-LV/Hidroponia-IoT-python | comunicacion/Micropython/main.py | main.py | py | 2,551 | python | fr | code | 0 | github-code | 36 |
5644011022 | import agentpy as ap
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.patches as mpatches
import seaborn as sns
def status_stackplot(data, ax):
"""Stackplot of people's condition over time."""
x = data.index.get_level_values("t")
y = [data[var] for v... | jacob-evarts/energyshed-simulation | src/plots.py | plots.py | py | 3,649 | python | en | code | 0 | github-code | 36 |
10731341714 | from os.path import isfile
import json
from db import normalize
from itertools import product
class Settings:
def __init__(self, user_id):
self.user_id = user_id
self.search = {}
self.match = []
@staticmethod
def from_dict(settings: dict) -> tuple:
return (
se... | rychanya/vkinder | src/vkinder/settings.py | settings.py | py | 3,811 | python | en | code | 0 | github-code | 36 |
35397958448 | from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import mox
from pants.base.hash_utils import hash_all, hash_file
from pants.util.contextutil import temporary_file
class TestHashUtils(mox.MoxTestBase):
def setU... | fakeNetflix/square-repo-pants | tests/python/pants_test/base/test_hash_utils.py | test_hash_utils.py | py | 942 | python | en | code | 0 | github-code | 36 |
75188366184 |
def taomang(n):
for i in range(n):
nhapmang = input('nhap mang: ')
arr.append(nhapmang)
nguoc = list(reversed(arr))
return nguoc
nhap = int(input('nhap so luong mang: '))
arr = []
print(taomang(nhap))
| nghia46203/lap-trinh-python | 2113005_lab1/cau2/test.py | test.py | py | 239 | python | en | code | 0 | github-code | 36 |
2063152797 | from flask import Flask, render_template, redirect, url_for, flash, request, Blueprint, abort
from flask_login import LoginManager, current_user, login_user, logout_user, login_required
from flask_migrate import Migrate
from werkzeug.urls import url_parse
from models import *
from forms import *
from flask_admin ... | Dimmj/market12 | market/app.py | app.py | py | 4,672 | python | en | code | 0 | github-code | 36 |
72076483945 | import numpy as np
import torch
from torch.utils.data import Dataset
import matplotlib
from matplotlib import pyplot as plt
import enum
import scipy
from scipy import ndimage, signal
import io
from . import fileloader, util, zernike
from skimage import restoration
@enum.unique
class Augmentation(enum.Enum):
PIXEL_... | kkhchung/smlm-dl | smlm_dl/dataset.py | dataset.py | py | 22,899 | python | en | code | 0 | github-code | 36 |
5919442650 | #!/usr/bin/env python3
heatmap_skeleton = '''$(function () {
$('#container').highcharts({
chart: {
type: 'heatmap',
marginTop: 40,
marginBottom: 40
},
title: {
text: null
},
xAxis: {
categories: [%s],
ti... | TurpIF/tp-markov-chain | filenames2heatmap.py | filenames2heatmap.py | py | 2,949 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.