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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
6135984234 | import sympy
def perturbed_quants(terms, order):
ep = sympy.symbols('epsilon', real=True)
replacements = []
new_vars = []
for term in terms:
raw = str(term)
expanded = [ raw+'%d'%expand for expand in range(order+1)]
symbs = sympy.symbols(' '.join(expanded), real=True)
to... | wolfram74/worked_problems | docs/summer_19/week_2019_07_08/scratch2.py | scratch2.py | py | 1,660 | python | en | code | 0 | github-code | 1 |
70398745635 | trip_price = float(input())
puzzle_count = int(input())
doll_count = int(input())
bear_count = int(input())
minions_count = int(input())
truck_count = int(input())
order_sum = puzzle_count * 2.6 + doll_count * 3 + bear_count * 4.1 \
+ minions_count * 8.2 + truck_count * 2
#print(order_sum)
number_toys = puz... | bozhimirov/softuni_basics | programming_basics/conditional_statements_exercise/4_toy_shop.py | 4_toy_shop.py | py | 672 | python | en | code | 2 | github-code | 1 |
72083112354 | from tkinter import filedialog as fd
from tkinter import messagebox
from PIL import Image
import customtkinter as ctk
import requests
from io import BytesIO
from PIL import Image
import os
def select_file():
filetypes = (
('All files', '*.*'),
('text files', '*.txt'),
)
file_path = fd.ask... | gumartinslopes/TI-VI | interface/utils/file_handle.py | file_handle.py | py | 2,691 | python | en | code | 0 | github-code | 1 |
28796011783 | """
Nが200,000もある
2つを選ぶと10**10となり間に合わない
Nの時間計算量で求める必要がある
"""
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = 0
for combi in [(100,400), (200,300)]:
l, r = combi
ans += C[l] * C[r]
print(ans) | bun913/math_and_algorithm | 018/main.py | main.py | py | 323 | python | ja | code | 0 | github-code | 1 |
73951420832 | number = 1
while number < 5:
print(number)
# number++ #py中没有num++运算符号
number += 1
# number = number+1
prompt = 'Tell me a num'
prompt += '\nEnter quit to end the program '
message = ''
while message != 'quit': # 等于quit就退出
message = input(prompt)
message != 'quit' and print(message) # python中与操... | daheige/python3 | while_test.py | while_test.py | py | 366 | python | en | code | 0 | github-code | 1 |
1908888817 | import torch
import torch.nn.functional as F
import math
"""
DISCLAIMER: most of these functions were implemented by me (Vaclav Vavra)
during the MPV course in the Spring semester of 2020, mostly with the help
of the provided template.
"""
def get_gausskernel_size(sigma, force_odd = True):
ksize = 2 * math.ceil(si... | vicsyl/extreme_two_view_matching_research | image_processing.py | image_processing.py | py | 3,933 | python | en | code | 0 | github-code | 1 |
74732843554 | import configparser
from tkinter import ttk
import datetime
from datetime import timedelta
import tkinter as tk
import os
from distutils.dir_util import copy_tree
from datepicker import Datepicker
# import win32print
class Data(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, par... | AleLuzzi/PyInsta | data.py | data.py | py | 2,921 | python | en | code | 0 | github-code | 1 |
15870050682 | import gym
import sys
import itertools
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from queue import Queue
from agent import Agent
def is_int(string):
try: return int(string) > 0
except: return False
def process(state):
batch = []
for frame in state:
image = Image.... | gareth618/car-race | main.py | main.py | py | 3,389 | python | en | code | 0 | github-code | 1 |
73113782435 | import math
from sys import stdin
from collections import defaultdict
class exist_negative_cycle(Exception):
pass
inf = float('inf')
# ベルマンフォード
# O(E + V)
def bellman_ford(g, size, start=0):
d = [inf] * size
d[start] = 0
for _ in range(size):
for u in g:
for v, d in g[u]:
... | elzup/algo-py | graph/bellmanford.py | bellmanford.py | py | 836 | python | en | code | 0 | github-code | 1 |
72316114274 | from lxml import html
from lxml.etree import XPath
TBODY_XPATH = XPath('//table[@class="observations"]/tbody')
OBSERVATION_XPATH = XPath('./td//text()[normalize-space()]')
DETAILS_XPATH = XPath('./td/div/table/tbody/tr/td//text()')
def _clean_cell(value):
"""
Removes dashes and strips whitespace from the gi... | zsiciarz/pyaavso | pyaavso/parsers/webobs.py | webobs.py | py | 1,906 | python | en | code | 1 | github-code | 1 |
9363150509 | from conan.tools.files import copy
from conan.tools.cmake import CMakeDeps
from conan.tools.cmake import CMakeToolchain
from conan import ConanFile
from os.path import join
class Pkg(ConanFile):
settings = "os", "compiler", "build_type", "arch"
def requirements(self):
self.requires("fmt/10.1.1")
... | thomasw04/GrizzlyBear-Engine-Public | conanfile.py | conanfile.py | py | 1,854 | python | en | code | 1 | github-code | 1 |
70427983394 | import pandas as pd
import matplotlib.pyplot as plt
import os
class CoefficientAnalyzer:
def __init__(self, data_file):
"""
Initialize the CoefficientAnalyzer class.
"""
# Load the data for all trials from the CSV
self.data = pd.read_csv(data_file)
def calculate_coeffic... | NolanTrem/phys1494 | experiment1/motion_analyzer.py | motion_analyzer.py | py | 4,688 | python | en | code | 1 | github-code | 1 |
40529127357 | import bpy
from bpy.types import NodeSocket
from . import ProkitekturaContainerNode
class ProkitekturaDemoAdvancedAttr(ProkitekturaContainerNode, bpy.types.Node): # make ProkitekturaNode the first super() in multiple inheritance
# Optional identifier string. If not explicitly defined, the python class na... | vvoovv/blosm-nodes | node/demoNode.py | demoNode.py | py | 4,620 | python | en | code | 1 | github-code | 1 |
73550063392 | ##################################################################################
# Your goal is to follow the comments and complete the the tasks asked of you.
#
# Good luck designing your proportional derivative controller!
##################################################################################
class PD... | camisatx/RoboticsND | projects/controls/examples/pd_controller/pd_controller.py | pd_controller.py | py | 3,008 | python | en | code | 57 | github-code | 1 |
40894999462 | from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.webdriver.firefox.webdriver import WebDriver
from django.conf import settings
import os
SCREEN_DUMP_LOCATION = os.path.join(settings.BASE_DIR, "screendumps")
class StatusViewsTests(StaticLiveServerTestCase):
@classmethod
de... | why-pengo/sprinkler | status/tests/status_views_test.py | status_views_test.py | py | 829 | python | en | code | 0 | github-code | 1 |
7351651718 | # -*- coding:utf-8 -*-
from flask import Blueprint, render_template, session, request, redirect, flash, url_for, jsonify
from flask_login import login_user, login_required, logout_user, current_user
from app.email import send_confirm_email, send_reset_email
from app.message.models import Message, Pri_letter
from app.me... | NilsGuo/0tinn | app/member/views.py | views.py | py | 6,733 | python | en | code | 0 | github-code | 1 |
70742294433 | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
import os
import re
import time
from os.path import dirname, basename, join
from u... | huangweiwei99/scrapy | robertocavallihomeinteriors/robertocavallihomeinteriors/pipelines.py | pipelines.py | py | 3,291 | python | en | code | 0 | github-code | 1 |
16895758445 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description: Analyze the reopening type of a user since the beginning of his
# work to now.
# Usage:
# $ python analyze_reopening_reason.py tms-production {user login}
import erppeek
from operator import itemgetter
from collections import OrderedDict
import os
import re... | TinPlusIT05/tms | erppeek/analyze_reopening_reason.py | analyze_reopening_reason.py | py | 6,456 | python | en | code | 0 | github-code | 1 |
72382526114 | from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = [ ]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': B... | Gentility01/my-folio1 | folio/settings/dev.py | dev.py | py | 865 | python | en | code | 0 | github-code | 1 |
19156243369 | from tkinter import *
from tkinter import messagebox
from tkinter import ttk
import tkinter
import main
import egram
class AAIRparameter(tkinter.Frame):
def __init__(self,master=None):
super().__init__(master)
self.master=master
self.place(x=0,y=57,relheight=0.9,relwidth=1)
self.wri... | pans27/DCM | aair.py | aair.py | py | 14,427 | python | en | code | 1 | github-code | 1 |
707287337 | """Collection of AWS service implementations"""
import time
import os
import base62
import random
class Database:
"""Database mock"""
def __init__(self, dynamodb):
self.dynamodb = dynamodb
self.urls = dynamodb.Table(os.environ['DYNAMODB_URLS_TABLE'])
def insert(self, _id, data):
... | dimiro1/shortly-serverless | lib/services/aws.py | aws.py | py | 937 | python | en | code | 0 | github-code | 1 |
751021182 | import numpy as np
import re
def feature_loading(tag_wordtoix, tag_ixtoword):
img_feats = []
with open('./_features.txt', 'r') as f:
for line in f:
tmp1 = line.strip().split(" ")
tmp2 = [float(l) for l in tmp1]
img_feats.append(tmp2)
img_feats = np... | vyshor/4Dgen | hackntu/utilities.py | utilities.py | py | 1,844 | python | en | code | 0 | github-code | 1 |
10379903084 | from selenium import webdriver
from selenium.webdriver.common.by import By
import urllib.parse
from flask import Flask,jsonify, request
from flask_restful import Api, Resource
import time
app = Flask(__name__)
api = Api(app)
PATH = ".chromedriver.exe"
def get_first_image_url_from_google(delay, search_term):
wd... | Chaitanyarai899/Video-Rendering-Service-backend | scraper.py | scraper.py | py | 1,384 | python | en | code | 0 | github-code | 1 |
30331506653 | import os
import datetime
import shutil
import sys
import pathlib
p = pathlib.Path(__file__).resolve().parent
p = p.parent.joinpath("pysrc")
sys.path.insert(0, str(p))
from service import delete_some
"""删除文件测试"""
conf = "D:/"
disk = "E:/"
dst_folder = f"{disk}LT-VIDEO-SS91456-北京蓝天多维"
def get_free():
"""剩余空间"... | soda92/NVRTool | test/delete_file_test_d.py | delete_file_test_d.py | py | 1,539 | python | en | code | 0 | github-code | 1 |
8251155538 | import pandas as pd
from bs4 import BeautifulSoup
import requests
df = pd.read_csv('Lists/2015_jeju_test.tsv', sep='\t',encoding='utf8')
def search(keyword1,keyword2,keyword3, category, city, name):
sd= "20150101"
ed= "20191231"
query= keyword1 +"+"+ "%7c" + "+" +keyword2 + "+" + "%7c"+ "+" +keyword3 + ... | vyvydkf628/PythonWebCrawler | count blogs/countBlogs.py | countBlogs.py | py | 3,757 | python | en | code | 0 | github-code | 1 |
44649184984 | class Tuple:
'''
What will be the output of the following code block?
A. <class ‘tuple’>
B. <class ‘str’>
C. <class ‘list’>
D. <class ‘function’>
'''
def check_type_tuple(self):
init_tuple = ('Python') * 3
print(type(init_tuple))
if __name__ == "__main__":
print(... | TarakaKoda/Python-Data-Structures-and-Algorithms | 12 - Tuple/Tuple Quiz/08. Question.py | 08. Question.py | py | 385 | python | en | code | 0 | github-code | 1 |
28706496477 |
def average(iterable_object):
temp = 0
sum = 0
for i in iterable_object:
sum += i
temp += 1
return sum/temp
def catch_ball_time_calculate(info_1, info_2, member):
"""
统计单个球员单次接球传球的时间。
Args:
info_1,info_2:信息条目。
member:成员标识名。
Return:
bool:该球员是... | hzfzzzi/competetion | util.py | util.py | py | 4,270 | python | en | code | 0 | github-code | 1 |
41574708832 | MENU = {
"espresso": {
"ingredients": {
"water": 50,
"coffee": 18,
},
"cost": 1.5,
},
"latte": {
"ingredients": {
"water": 200,
"milk": 150,
"coffee": 24,
},
"cost": 2.5,
},
"cappuccino": {
... | dawidperla/Coffee_Machine | main.py | main.py | py | 2,301 | python | en | code | 0 | github-code | 1 |
42214197070 | import os
import chardet
folder_path = 'txt_data'
stopwords_files = ['baidu_stopwords.txt']
stopwords_list = ["的", "了", "在", "是", "我", "有", "和", "就",
"不", "人", "都", "一", "一个", "上", "也", "很", "到", "说", "要", "去", "你", "会", "着", "没有", "看", "好", "自己", "这",
"罢", "这", '在', '又', '在', '得',... | 9aLucky/DL_NLP_2022_HW | HW4/preprocessor.py | preprocessor.py | py | 2,312 | python | en | code | 1 | github-code | 1 |
3758809888 | from notion.client import NotionClient
from notion.collection import NotionDate
from datetime import datetime, timedelta
from math import ceil
class todo_list_mgr:
def __init__(self, client, page_to_update):
assert(isinstance(client, NotionClient))
self.target_view = client.get_collection_view(pa... | hanbo1990/notion_automation | todo_list_mgr.py | todo_list_mgr.py | py | 3,813 | python | en | code | 0 | github-code | 1 |
71807437474 | import argparse
import datetime
import json
import sys
import time
import colorama
import requests
session = requests.Session()
def get_changes(auth_creds, query):
auth = requests.auth.HTTPDigestAuth(*auth_creds)
result = session.get('https://review.openstack.org/a/changes/',
params... | gibizer/gerrit-review-dashboard | dashboard.py | dashboard.py | py | 5,084 | python | en | code | 0 | github-code | 1 |
9715594221 | class InterpreteYolov5Result:
def __init__(self,torch_result):
try:
self.np_xyxy = torch_result.cpu().numpy()
except:
self.np_xyxy = torch_result.numpy()
self._total = len(self.np_xyxy)
def get_coordinates(self,array):
x0,y0 = array[0... | GirinChutia/fastapi_object_detection | postprocessing.py | postprocessing.py | py | 1,190 | python | en | code | 0 | github-code | 1 |
1538871246 | import logging
import numpy as np
from src.Utils.Types.VolType import VolType
__author__ = 'frank.ma'
logger = logging.getLogger(__name__)
class SABRModel(object):
def __init__(self, t: float, alpha: float, beta: float, nu: float, rho: float):
self.t = t
self.alpha = alpha
self.beta = ... | frankma/Finance | src/SABRModel/SABRModel.py | SABRModel.py | py | 2,640 | python | en | code | 0 | github-code | 1 |
18991897731 | from genericpath import exists
import aiohttp
from aiohttp import web
from aiohttp.client_exceptions import ClientConnectionError
import asyncio
import pprint
import traceback
import time
async def reverse_proxprox_websocket(ws_proxying, ws_client, connection_id):
from proxy import msg_pack
#print("PROXPROX")
... | sjdv1982/cloudless | reverse_proxy.py | reverse_proxy.py | py | 6,042 | python | en | code | 0 | github-code | 1 |
1272262655 | import torch
import librosa
import numpy as np
import matplotlib.pyplot as plt
from specAugment.spec_augment_pytorch import spec_augment
# Borrowed from: https://github.com/DemisEom/SpecAugment
if __name__ == "__main__":
# Get example mel
audio, sampling_rate = librosa.load(librosa.util.example_audio_file(),... | HudsonHuang/yata | yata/spectaug.py | spectaug.py | py | 1,119 | python | en | code | 6 | github-code | 1 |
36448088007 | import sys
import logging
FORMAT = '%(levelname) - %(asctime)s -AutoClicker %(message)s'
FORMAT = ("%(levelname) %(message)s")
FORMAT = ("%(asctime)s %(name)s %(levelname)s %(message)s")
logger = logging.getLogger('otog')
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter(FORMAT)
console = logging.Stre... | cnhy-nero-diskard/AutoClicker_quizlet | test_debug.py | test_debug.py | py | 767 | python | en | code | 0 | github-code | 1 |
3356348223 | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from sqlalchemy.orm import sessionmaker
from scrapy.exceptions import DropItem
from minimalist_scrapy.models import (
Quote, Author, Tag, db_conne... | pace-noge/minimalist-scrapy | minimalist_scrapy/pipelines.py | pipelines.py | py | 2,995 | python | en | code | 0 | github-code | 1 |
71147371553 | import os
import re
import numpy as np
def decompose_path(lines: str, root_fashion_dir: str):
# 1. Decompose the file name
lines = lines[7:] # Remove the fashion vocabulary.
FLAG = True if 'WOMEN' in lines else False
if FLAG:
result = re.search(r'(WOMEN)(.+)(id\d{8})(.+\.jpg)', lines)
file_name = [result.g... | zylwithxy/CLIP_ADGAN | tool/generate_fashion_datasets_new.py | generate_fashion_datasets_new.py | py | 3,083 | python | en | code | 1 | github-code | 1 |
30841945004 | class Solution:
def maxProfit(self, prices: List[int]) -> int:
buy_pointer = 0
profit = 0
for i in range(0, len(prices)):
if prices[i] < prices[buy_pointer]:
buy_pointer = i
profit = max(profit, prices[i] - prices[buy_pointer])
return profit
... | yshim1/pythonprac | DSA/array/best_time_to_buy_and_sell_stock.py | best_time_to_buy_and_sell_stock.py | py | 612 | python | en | code | 0 | github-code | 1 |
13883453328 | #This script lists all *.txt files in the folder that you choose (assuming that they are the Slim output files).
#The script creates 2 output files- one for counts and one for frequency.
#How to run:
#python get_sfs_from_full_output_general_reps.py -input_folder /path/to/intput/folder -output_folder /path/to/output -ou... | paruljohri/Perspective_Statistical_Inference | CalculateStatisticsTestSet/get_sfs_from_full_output_general_reps.py | get_sfs_from_full_output_general_reps.py | py | 4,176 | python | en | code | 1 | github-code | 1 |
26104190475 | # coding: utf-8
from __future__ import absolute_import
from flask import json
from six import BytesIO
from swagger_server.models.image import Image # noqa: E501
from swagger_server.models.image_id_body import ImageIdBody # noqa: E501
from swagger_server.test import BaseTestCase
class TestImageController(BaseTest... | JakubKuderski/Programowanie_Zespolowe | server/swagger_server/test/test_image_controller.py | test_image_controller.py | py | 2,607 | python | en | code | 0 | github-code | 1 |
32807094996 | import torch
from YOLOX.yolox.data.data_augment import preproc
from YOLOX.yolox.data.datasets import COCO_CLASSES
from YOLOX.yolox.exp.build import get_exp_by_name
from YOLOX.yolox.utils import postprocess
from utils.visualize import vis
class Detector():
def __init__(self, model='yolox-m', ckpt='自己训练的yolox检测模... | Leonlww/YOLOX_DeepSort_stu | objdetector.py | objdetector.py | py | 1,985 | python | en | code | 1 | github-code | 1 |
37195453316 | import pandas as pd
import numpy
from collections import OrderedDict
def union(A,B):
result_set = dict()
for A_key, B_key in zip(A,B):
A_value = A[A_key]
B_value = B[B_key]
if A_value > B_value:
result_set[A_key] = A_value
else:
result_set[B_key] = B_val... | MajaSt1/ML-exercises | movie_grouping.py | movie_grouping.py | py | 3,297 | python | en | code | 0 | github-code | 1 |
26639968536 | def solution(fees, records):
temp = dict()
r = dict()
for rcd in records:
(t, n, st) = rcd.split(" ")
if st == "IN":
temp[n] = t
if n not in r.keys():
r[n] = 0
else:
time = calc(t, temp[n])
del temp[n]
r... | Coding-Test-Break/algorithm_python | programmers_lv2/주차요금계산/주차요금계산.py | 주차요금계산.py | py | 1,134 | python | en | code | 1 | github-code | 1 |
71301321634 | #!/usr/bin/env python
# Test: finite-field calculation of transition dipole moments
# in the rubidium atom (the 0h1p Fock space sectors)
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from minitest import Test, Filter, execute, DIRAC_PATH
# obtain transformed integrals
dirac_inp... | aoleynichenko/EXP-T | test/ff_tdm_0h1p/test.py | test.py | py | 1,312 | python | en | code | 12 | github-code | 1 |
14374176573 | import os
from flask import Flask, render_template, request
from plot import plot_graph
from download import options, download, set_download_config
from shell import reboot_stable_diffusion, set_shell_config
import json
app = Flask(__name__)
CONFIG_PATH = '../../config/config.json'
HOST = {'host': 'localhost', 'port'... | chun92/my_home_server_manager | src/web/app.py | app.py | py | 1,480 | python | en | code | 0 | github-code | 1 |
7414775356 | from __future__ import unicode_literals, print_function, division
__author__ = "mozman <mozman@gmx.at>"
import os
import zipfile
import random
from datetime import datetime
from .xmlns import etree, CN
from .manifest import Manifest
from .compatibility import tobytes, bytes2unicode, is_bytes, is_zipfile
from .compati... | T0ha/ezodf | ezodf/filemanager.py | filemanager.py | py | 7,721 | python | en | code | 61 | github-code | 1 |
26807469463 | #!/usr/bin/env python3
import requests
import socket
from utils import logger
moviePage_url = 'https://trailers.apple.com/'
movieSearch_url = 'https://trailers.apple.com/trailers/home/scripts/quickfind.php'
log = logger.get_log(__name__)
class Apple():
def __init__(self, min_resolution, max_resolution):
... | jsaddiction/TrailerTech | providers/apple.py | apple.py | py | 4,381 | python | en | code | 10 | github-code | 1 |
39070299927 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Created on Sun Oct 4 05:08:15 2020."""
import threading
import os , sys
import CSVTest
import ThinkSpeakTest
from PiPerformance import performance
#threadLock = threading.Lock()
# temp , pres , hum , pm , CH4 , CO , O3 , NH4 , CO2 = perf.data()
# csvlist = []
# thi... | shahanHasan/SPEC-DGS-ULPSM--MQX-PM-BME280-DHT-sensors-python-Implementation | Thread.py | Thread.py | py | 2,925 | python | en | code | 1 | github-code | 1 |
11373411713 | # -*- coding: utf-8 -*-
"""Implementation of the Airfield class."""
import logging
import random
import math
import pygame
from airportgame.runway import Runway
from airportgame.utilities import vec2tuple, distance_between
class Airfield():
"""
Airfield that contains runways.
"""
FIELD_HEIGHT = 200... | soikkea/airportgame | airportgame/airfield.py | airfield.py | py | 8,706 | python | en | code | 0 | github-code | 1 |
31899827759 | # -*- coding: utf-8 -*-
"""
@File : T3.py
@Author : wenhao
@Time : 2023/4/9 10:27
@LC :
"""
import bisect
from typing import List
from collections import Counter
from bisect import bisect_left
# 最大化最小值 == 二分答案
# 二分 mx
# 尽量多的选下标对 使得选出来的对数 >= p
# 如果下标不影响答案 那么可以排序
# 贪心 如果前两个数可以选 那么必选
#
class Solution:
... | callmewenhao/leetcode | contests/weekly-contest-340/T3.py | T3.py | py | 1,601 | python | zh | code | 0 | github-code | 1 |
17519684943 | from collections import defaultdict
import pandas as pd
import datetime
from lode.utilities.util import parse_date
from itertools import izip
def create_date_limited_sql(master_table, dates=None,
begin_date=None, end_date=None,
date_col="trading_date", range_bre... | NigelCleland/lode | lode/database/query_builders.py | query_builders.py | py | 10,563 | python | en | code | 1 | github-code | 1 |
23468598421 | # MS MARCO Document: Script for plotting leaderboard over time scatter plots
import datetime
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import pandas as pd
df = pd.read_csv('../leaderboard/leaderboard.csv', parse_dates=['date'])
# Plot all the runs
ax = df.plot(x='d... | Whem2020/MSMARCO-Document-Ranking-Archive | analysis/plot_leaderboard_over_time.py | plot_leaderboard_over_time.py | py | 947 | python | en | code | null | github-code | 1 |
42999666219 | '''
Problem 844 | Backspace String Compare
https://leetcode.com/problems/backspace-string-compare/
'''
class Solution:
def backspaceCompare(self, s: str, t: str) -> bool:
s_stack, t_stack = [], []
for i in s:
if i == '#':
if len(s_stack):
s... | davijit868/Programming-Solutions | Data Structures/Stack/Backspace String Compare.py | Backspace String Compare.py | py | 725 | python | en | code | 2 | github-code | 1 |
21521915533 | class Solution:
def equalPairs(self, grid):
element_map = {}
result = 0
for row in grid:
row_element = ",".join(map(str, row))
element_map[row_element] = element_map.get(row_element, 0) + 1
# prepare col_element
col_elements = []
for c in range... | yihsuanhung/leetcode | 2352. Equal Row and Column Pairs/main.py | main.py | py | 753 | python | en | code | 0 | github-code | 1 |
36412878597 | import cv2
import os
import glob
import argparse
import time
parser = argparse.ArgumentParser()
parser.add_argument("--video_dir", type=str,
help="Dataset directory", default='/home/park/0808_capture/video/trade_tower/')
parser.add_argument("--video_result_dir", type=str,
hel... | chansoopark98/Tensorflow-Keras-Semantic-Segmentation | data_augmentation/capture_from_video.py | capture_from_video.py | py | 1,663 | python | en | code | 12 | github-code | 1 |
69965144353 | import tkinter as tk
from tkinter import *
class Calculator(tk.Frame):
def __init__(self, **kw):
super().__init__(**kw)
self.place()
self.create_frame_and_listbox()
self.create_button()
self.expression = ''
def choose(self, char):
self.expressi... | jcblanc24/calculatrice | main.py | main.py | py | 7,722 | python | en | code | 0 | github-code | 1 |
21246389591 | '''
Faça um programa que leia um vetor de 10 números. Leia um número x. Conte os múltiplos de um número inteiro x num
vetor e mostre-os na tela.
'''
vetor = []
multiplos = []
dicionario = {0:'primeiro', 1:'segundo', 2:'terceiro', 3:'quarto', 4:'quinto',
5:'sexto', 6:'sétimo', 7:'oitavo', 8:'nono', 9:'décimo'}
while ... | higor-gomes93/curso_programacao_python_udemy | Sessão 7.1 - Exercícios/ex18.py | ex18.py | py | 751 | python | pt | code | 0 | github-code | 1 |
72536633633 | class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
#time complexity = 0(N+K) = O(N)
#space complexity = O(K) = O(N)
# O(k) space, k = unique numbers in list
num_count = []
majority_... | bji6/Practice_Problems | LeetCoder_problems/Part2/find_majority_element.py | find_majority_element.py | py | 748 | python | en | code | 0 | github-code | 1 |
2888543777 | def accept_one_row():
input_str = input().strip()
input_list = input_str.split()
return input_list
def convert_list_mem_to_int(target_list):
return list(map(int, target_list))
if __name__ == "__main__":
score_list = accept_one_row()
score_list = convert_list_mem_to_int(score_list)
N, X = s... | Kumamoto-Hamachi/atcoder_pr | abc_contest/abc184/b/b.py | b.py | py | 507 | python | en | code | 1 | github-code | 1 |
73948967712 | """Import the compiled Python for .Net module"""
import clr
import sys
print()
print ('clr version = {}'.format(str(clr.__version__)))
"""Import the Keysight automated test app remote library DLL"""
sys.path.append(r'C:\ProgramData\Keysight\DigitalTestApps\Remote Toolkit\Version 6.3\Tools')
clr.AddReference("Keysight... | GuyMcBride/TxCompliancePythonExample | simple.py | simple.py | py | 745 | python | en | code | 1 | github-code | 1 |
22591486437 | import math
def get_divisors(n):
ret = set()
for d in range(1, int(math.ceil(math.sqrt(n)))):
if n % d == 0:
ret.add(d)
ret.add(n//d)
return ret
def check_slice(start, end):
size = (end[0] - start[0] + 1) * (end[1] - start[1] + 1)
if size > H:
re... | timower/hashcode2017 | pizza.py | pizza.py | py | 1,008 | python | en | code | 0 | github-code | 1 |
20690024884 | familia = {
'pai': 'Fulano de Tal',
'mae': 'Beltrana de Tal',
'filho': 'Celtrano de Tal',
'filha': 'Deltrana de Tal',
}
print(familia)
copia_familia = familia.copy()
print(f"Compia da Familia: {copia_familia}")
itens = familia.items()
print(f"Itens: {itens}")
for item in itens:
print(item)
ch... | weslley281/curso-python | Dominando Dicionários/metodosDeDicionarios.py | metodosDeDicionarios.py | py | 502 | python | pt | code | 0 | github-code | 1 |
42999451019 | '''
Problem 844 | Backspace String Compare
https://leetcode.com/problems/backspace-string-compare/
'''
class Solution:
def backspaceCompare(self, s: str, t: str) -> bool:
def function(seq):
skip = 0
for i in reversed(seq):
if i == '#':
s... | davijit868/Programming-Solutions | Algorithms/Two Pointers/Backspace String Compare.py | Backspace String Compare.py | py | 530 | python | en | code | 2 | github-code | 1 |
23466715421 | #!/usr/bin/python3
from brownie import CallMeChallenge
from scripts.deploy import deploy
from scripts.helpful_scripts import get_account
from colorama import Fore
# * colours
green = Fore.GREEN
red = Fore.RED
blue = Fore.BLUE
magenta = Fore.MAGENTA
reset = Fore.RESET
def print_colour(target, solved=False):
if so... | Aviksaikat/Blockchain-CTF-Solutions | capturetheether/warmup/CallMe_DONE/scripts/hack.py | hack.py | py | 1,151 | python | en | code | 1 | github-code | 1 |
24349296351 | import json
from pprint import pprint
import requests
import logbook
from log_book import init_logger
logger = logbook.Logger(__file__)
def main():
init_logger('movie-app.log')
logbook.info("Starting the omdb search app...")
logbook.debug("Getting user's input...")
movie_name = get_user_input()
... | pgmilenkov/100daysofcode-with-python-course | days/40-42-json-data/omdb_parse.py | omdb_parse.py | py | 1,714 | python | en | code | null | github-code | 1 |
4538885674 | # Helper functions for stochastic raytracer
import numpy as np
import pickle
import matplotlib.pyplot as plt
from scipy import interpolate
from sklearn import preprocessing
# Create a linear interpolant in each of the x, y, z directions
def create_interpolant(xyz, g):
fx = interpolate.RegularGridInterpo... | Bryden38/579_project_code | stochastic_raytracer_helper.py | stochastic_raytracer_helper.py | py | 7,495 | python | en | code | 0 | github-code | 1 |
40891981374 | # Python program to simulate a secret auction
# Able to import utilities module from helpers package since PYTHONPATH env var is set to "myPythonLearnings" folder
from helpers import utilities
def get_highest_bidder(bid_dictionary):
max_bid = 0
max_bidder = ""
for bidder in bid_dictionary:
curren... | hornet33/myPythonLearnings | 01Beginner/Day 09/assignment09.py | assignment09.py | py | 918 | python | en | code | 0 | github-code | 1 |
73910447714 | __author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import os
import codecs
import datetime
from processing.tools.system import userFolder
from processing.core.ProcessingConfig im... | nextgis/nextgisqgis | python/plugins/processing/core/ProcessingLog.py | ProcessingLog.py | py | 4,717 | python | en | code | 27 | github-code | 1 |
25376879137 | import psutil
from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider, ValueObserver
from opentelemetry.sdk.metrics.export import ConsoleMetricsExporter
metrics.set_meter_provider(MeterProvider())
meter = metrics.get_meter(__name__)
metrics.get_meter_provider().start_pipeline(meter, Cons... | NathanielRN/clone-opentelemetry-python | docs/examples/basic_meter/observer.py | observer.py | py | 1,140 | python | en | code | 0 | github-code | 1 |
70513024673 | class Sequence:
def __init__(
self,
label='',
bbox_scale=1.0,
tracker_name='kcf',
anchor_bbox=[], # x, y, w, h
anchor=0,
insert=0,
exit=0,
grayscale=False
):
self.label = label
self.bbox_scale = bbox_scale
self.t... | xiedidan/gui-annotators | trackCropTool/model.py | model.py | py | 706 | python | en | code | 0 | github-code | 1 |
19233059011 | import random
import math
import py_osm_cluster.util.geom as geom
from py_osm_cluster.util.coords import Coords as C
#util below
def distance(a,b):
return math.sqrt(math.pow(a[0]-b[0],2)+math.pow(a[1]-b[1],2))
#end util
def gauss_point(coords,sigma):
return [random.gauss(0,sigma)+coords[x] for x in range(2)]
def ... | jakubwida/py_osm_cluster_bachelors | py_osm_cluster/generator/trivial_gen.py | trivial_gen.py | py | 9,112 | python | en | code | 0 | github-code | 1 |
73559634272 | # 11724
import sys
sys.setrecursionlimit(10**9) #최대 재귀 수 설정
n, m = map(int, sys.stdin.readline().split())
graph = [[] for i in range(n+1)]
result = [0 for i in range(n+1)]
count = 0
for i in range(m):
u, v = map(int, sys.stdin.readline().split())
graph[u].append(v)
graph[v].append(u)
def findComponent(v)... | devjoonn/algorithm | 백준/Python/Daily/11724.py | 11724.py | py | 618 | python | en | code | 0 | github-code | 1 |
11992165432 | from Wordle_Agent import Wordle_Agent
class Wordle_Agent_LetterFreq(Wordle_Agent):
"""
An agent to play Wordle, which extends the Wordle_Agent class.
This agent will attempt to calculate the next guess based on the frequency
of letters in the word list.
"""
import re
import sys
def __in... | evans-dan/yawi | Wordle_Agent_LetterFreq.py | Wordle_Agent_LetterFreq.py | py | 9,100 | python | en | code | 0 | github-code | 1 |
73286444834 |
from koza.cli_runner import koza_app
from loguru import logger
source_name = "mimtitles"
row = koza_app.get_row(source_name)
map = koza_app.get_map(source_name)
###
# From OMIM
# An asterisk (*) before an entry number indicates a gene.
#
# A number symbol (#) before an entry number indicates that it is a descrip... | monarch-initiative/monarch-ingest | src/monarch_ingest/maps/mimtitles.py | mimtitles.py | py | 2,943 | python | en | code | 11 | github-code | 1 |
37257030182 | # Python dictionaries are similar to lists in that they can store multiple
# values in a single variable. However, they are different in that there is no
# real order to the data stored in a dictionary and the data is accessed with
# the use of a key (or label) instead of its order in the list. You could think
# of a l... | caseywschmid/python_for_everybody | Notes_Chapter 09_dictionaries.py | Notes_Chapter 09_dictionaries.py | py | 5,759 | python | en | code | 0 | github-code | 1 |
6468869212 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
def coin():
return random.randrange(0,2)
def coins20():
X = []
for i in range(0,20):
X.append(coin())
return X
def mili():
E = []
for i in range(0,1000000):
E.append(coins20()... | Testosterol/Machine-Learning---Python-2 | Assign2.py | Assign2.py | py | 5,960 | python | en | code | 0 | github-code | 1 |
33402238582 | import functools
words=input().split()
def validate(word):
letters=[]
for i in word:
if i.upper() not in letters:
letters.append(i.upper())
if len(letters)>3:
return True
return False
if __name__=='__main__':
answer1=list(filter(validate, words))
print(list(map(lambda... | Bulka148/IsmagilovB_11105 | task004.py | task004.py | py | 472 | python | en | code | 0 | github-code | 1 |
16863389589 | import re
from urllib.parse import parse_qsl, unquote
from oio.common.amqp import (
AMQPError,
ExchangeType,
AmqpConnector,
DEFAULT_EXCHANGE,
DEFAULT_QUEUE_ARGS,
)
from oio.common.json import json
from oio.event.evob import Event, EventError, RetryableEventError
from oio.event.beanstalk import Bean... | open-io/oio-sds | oio/event/filters/notify.py | notify.py | py | 11,013 | python | en | code | 621 | github-code | 1 |
24594487163 | import numpy as np
def getPeaks(signal, fs, min_distance, impulse_distance=0):
"""
signal: samples
min_distance: distance of peaks
fs: sample frecuency
"""
power_signal = np.power(signal, 2)
# Consideramos que la señal no variara considerablemente en al menos 10 periodos del filtro
st... | taomasgonzalez/Electrocardiogram-RLS | Código/ARF_test/getPeaks.py | getPeaks.py | py | 993 | python | en | code | 1 | github-code | 1 |
17360106168 | from datetime import datetime
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import Integer, Text, Date, Boolean
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Follower(Base):
__tablename__ = 'follower'
id = Column(Integer, primary_key=True)
name = C... | MickaelBergem/unfollower | models.py | models.py | py | 573 | python | en | code | 6 | github-code | 1 |
28416232124 | #!/usr/bin/env python2
# [Ordered Dictionary for Py2.4 « Python recipes « ActiveState Code]
# (http://code.activestate.com/recipes/576693/)
from collections import OrderedDict
od = OrderedDict()
od["a"] = 1
od["b"] = 2
od["c"] = 4
od["d"] = 5
del od["a"]
od["a"] = 3
for k, v in od.iteritems():
print("{},{}".fo... | 10sr/junks | python/ordereddict.py | ordereddict.py | py | 627 | python | en | code | 0 | github-code | 1 |
13810000086 | import numpy as np
class ScrapBooker:
@staticmethod
def crop(array, dimensions, position = (0, 0)):
"""
array -> numpy array
dimensions -> dimensions of the crop
position -> cordinates of top left corner for the crop
return cropped array
"""
... | nestoralonsovina/bootcamp_python | day03/ex02/ScrapBooker.py | ScrapBooker.py | py | 1,137 | python | en | code | 0 | github-code | 1 |
244144573 | __author__ = 'nipunbatra'
import numpy as np
import pandas as pd
def read_df():
df = pd.read_csv("../data/input/main-data.csv",index_col=0)
dfc = df.copy()
df = df.drop(871)
df = df.drop(1169)
w=df[['aggregate_%d' %i for i in range(1,13)]]
df = df.ix[w[w>0].dropna().index]
feature... | nipunbatra/Gemello | code/create_df.py | create_df.py | py | 7,664 | python | en | code | 18 | github-code | 1 |
34573074614 | import os
from os import getenv
from dotenv import load_dotenv
if os.path.exists("local.env"):
load_dotenv("local.env")
API_ID = int(getenv("API_ID", "6435225")) #optional
API_HASH = getenv("API_HASH", "") #optional
SUDO_USERS = list(map(int, getenv("SUDO_USERS", "").split()))
OWNER_ID = int(getenv("OWNER_ID"))... | ITZ-ZAID/ZAID-USERBOT | config.py | config.py | py | 1,235 | python | en | code | 167 | github-code | 1 |
23270541963 | """
Detection Recipe - 12.0.4.17
References:
(1) 'Asteroseismic detection predictions: TESS' by Chaplin (2015)
(2) 'On the use of empirical bolometric corrections for stars' by Torres (2010)
(3) 'The amplitude of solar oscillations using stellar techniques' by Kjeldson (2008)
(4) 'An absolutely calibrated Teff sca... | Fill4/tess-yield | tess-yield/TASC_detection_recipe.py | TASC_detection_recipe.py | py | 22,339 | python | en | code | 0 | github-code | 1 |
39605975671 | import pygame as pg
from pygame.math import Vector2
from src.camera import Camera
from src.game_objects.abstract.tile import Tile
from src.game_objects.movable_tile import MovableTile
from src.game_objects.selection_box import SelectionBox
from src.game_objects.static_tile import StaticTile
from src.graphics import Sp... | tmcgroul/GPD-4X | src/game_core.py | game_core.py | py | 5,377 | python | en | code | 1 | github-code | 1 |
42447368963 | """ Preprocess the ISBI data set.
"""
__author__ = "Mike Pekala"
__copyright__ = "Copyright 2015, JHU/APL"
__license__ = "Apache 2.0"
import argparse, os.path
import numpy as np
from scipy.stats.mstats import mquantiles
import scipy.io
import emlib
def get_args():
"""Command line parameters for the 'deploy'... | iscoe/coca | Experiments/CcT/preprocess.py | preprocess.py | py | 3,303 | python | en | code | 6 | github-code | 1 |
39038738058 | number_of_names = int(input())
odd_set = set()
even_set = set()
for num in range(1, number_of_names + 1):
name = input()
name_value = 0
for ch in name:
name_value += ord(ch)
total_value = name_value // num
if total_value % 2 == 0:
even_set.add(total_value)
else:
odd_set.... | StanVas/Python_Advanced_September_2022 | advanced/02_exercises/06_tuples_and_sets/06_battle_of_names.py | 06_battle_of_names.py | py | 777 | python | en | code | 0 | github-code | 1 |
17828467348 | from django.contrib import admin
from django.urls import path,include
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('',views.index,name='Home'),
path('aboutus/',views.aboutus,name='aboutUs'),
path('product/<int:prodId>',views.prodDetails,name='prodDetails'),
path('emptyC... | aman1100/thcProject | thcProject/thcProducts/urls.py | urls.py | py | 421 | python | en | code | 1 | github-code | 1 |
5530540643 | import config
from db import db_config
from db import db_users
#from calendar import cal
from flask import Flask, render_template, request
from pymessager.message import Messager
client = Messager(config.facebook_access_token)
import os
import json
from msg_handlers import main_handler, notification_handler, responses... | kartikye/sch | run.py | run.py | py | 2,339 | python | en | code | 0 | github-code | 1 |
29973174530 | import random
def es_primo(numero):
condicion = 1
divisores = 0
while condicion <= numero:
if numero % condicion == 0:
divisores += 1
condicion += 1
if divisores == 2:
return True
return False
def es_fibonacci(numero):
num1 = 0
num2 = 1
secuencia = 0... | AndHak/Universidad-Semestre1-Python | 00Promedios matriz.py | 00Promedios matriz.py | py | 2,422 | python | es | code | 2 | github-code | 1 |
39974834021 | from tensorflow import keras
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import seaborn as sns
import numpy as np
from custom_models import custom_model, old_model
from data_preprocessing import Preprocessing
from data_augmentation import DataAugmentation
from config import ... | AnaChikashua/Georgian-OCR | model/train_ocr.py | train_ocr.py | py | 1,997 | python | en | code | 0 | github-code | 1 |
17114049075 | from django.urls import reverse_lazy
from django.views.generic.edit import FormView
from forum.forms import ContactForm
class ContactView(FormView):
template_name = 'pages/contact.html'
form_class = ContactForm
success_url = reverse_lazy('forum:home')
def form_valid(self, form):
form.send_em... | Projectca-r/it | itacademy-django/forum/views/contact.py | contact.py | py | 366 | python | en | code | 0 | github-code | 1 |
18061408079 | from pathlib import Path
from tensorflow.keras import layers
from tensorflow.keras import models
from tensorflow.keras import optimizers
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
from solve_cudnn_error import solve_cudnn_error
solve_cudnn_error()
base_dir = Path('cats... | enrongtsai/Horovod-practice | original_cat_dog.py | original_cat_dog.py | py | 3,594 | python | en | code | 2 | github-code | 1 |
15427212046 | import random
import requests
from currency_converter import CurrencyConverter
from forex_python.converter import CurrencyRates
def get_guess_from_user():
while True:
try:
guess = float(input("Enter your guess for the value in ILS: "))
break
except ValueError:
pr... | Almonk777/WorldOfGame | CurrencyRouletteGame.py | CurrencyRouletteGame.py | py | 1,720 | python | en | code | 0 | github-code | 1 |
37181675132 | name1=raw_input("Enter your name:")
name2=raw_input("Enter your boyfriend's/girlfriend's name:")
calculate=len(name1)+len(name2)
if len(name1)>len(name2):
calculate-=5
else:
calculate+=3
calculate*=42
calculate=calculate/(100+len(name2))
if calculate>10:
calculate=10
else:
round(calculate,0)
print ("... | fadimezhan/Python | randomName/loveCounting.py | loveCounting.py | py | 384 | python | en | code | 2 | github-code | 1 |
3477761372 | from flask import Flask, jsonify, request, make_response
import torch
from transformers import BertTokenizer, BertModel
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np
import pandas as pd
app=Flask(__name__)
# @app.route('/<string:text1>/<string:text2>')
@app.route('/post_json',me... | daringsingh22/sementicsimilar | app.py | app.py | py | 1,487 | python | en | code | 0 | github-code | 1 |
32688078632 | usrInput = input("Enter your binary number:")
t = usrInput[::-1]
length=len(usrInput)
total=0
exp=0
while length > 20:
print("Error")
quit()
while exp < length:
if t[exp] =="1":
total+=2**int(exp)
exp+=1
print(total)
| aarthymurugappan101/binary-to-decimal-conversion-python | btd1.py | btd1.py | py | 242 | python | en | code | 0 | github-code | 1 |
25393075704 | def money_change(n: int):
coins = [10, 5, 1]
n_of_coins = 0
remaining = int(n)
for coin in coins:
n_of_coins += remaining//coin
remaining = remaining % coin
if remaining == 0:
break
assert remaining == 0
return n_of_coins
if __name__ == "__main__":
n =... | XaviPeiro/algorithms_toolbox_coursera | tasks/greedy_algorithims/money_change.py | money_change.py | py | 362 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.