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
37700794816
# -*- coding: utf-8 -*- from socket import socket, AF_INET, SOCK_DGRAM from threading import Timer import os import sys import subprocess import re bl_power_file = "/sys/class/backlight/rpi_backlight/bl_power" def singleton(cls): # https://stackoverflow.com/questions/31875/is-there-a-simple-elegant-way-to-defi...
ThomasHangstoerfer/pyHomeCtrl
utils.py
utils.py
py
4,427
python
en
code
0
github-code
36
27048685248
import pygame class Berry(pygame.sprite.Sprite): def __init__(self, x, y): width = height = 16 red = (255, 0, 0) self.image = pygame.Surface((width, height)) self.image.fill(red) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y def IsEat...
JoeZlonicky/Snake
Source/Berry.py
Berry.py
py
478
python
en
code
0
github-code
36
34755072497
def solution(k, tangerine): # 빈도수 딕셔너리 만들기 dic = dict() for i in tangerine: dic[i] = dic.get(i,0) + 1 # 내림차순 정렬 arr = sorted(dic.items(), key = lambda x : x[1], reverse = True) # 종류 count ans=1 for i in arr: k-=i[1] if k > 0: ans+=1 return ans
dwkim8155/Algorithm
Algorithm/Implementation/[programmers] level2 귤 고르기.py
[programmers] level2 귤 고르기.py
py
355
python
ko
code
1
github-code
36
1412535950
from smartiot import app from smartiot.bin.config.db_config import mysql from flask import Flask,render_template,flash,redirect,session,url_for,logging,request,Blueprint,json,session from flask_json import FlaskJSON, JsonError, json_response, as_json email ="" permission ="" def getPermissions(fUserId,fEn...
Singh-Kiran-P/smart-iot-python-api
smartiot/routes/route_Permissions/userPermissions.py
userPermissions.py
py
1,319
python
en
code
0
github-code
36
5420673678
# How to get the visual length of a text string in python # https://stackoverflow.com/questions/32555015/how-to-get-the-visual-length-of-a-text-string-in-python import ctypes import cairo class SIZE(ctypes.Structure): _fields_ = [("cx", ctypes.c_long), ("cy", ctypes.c_long)] hdc = ctypes.windll.user32.GetDC(0) ...
Hansimov/tikzpy
src/z_test_text_extents.py
z_test_text_extents.py
py
1,582
python
en
code
4
github-code
36
2723106803
def mergeSort(nums): if len(nums) == 1: return nums mid = len(nums) >> 2 L_num = nums[:mid] R_num = nums[mid:] return merge(mergeSort(L_num), mergeSort(R_num)) def merge(left, right): res = [] while len(left) > 0 and len(right) > 0: if left[0] > right[0]: res.a...
ZhengLiangliang1996/Leetcode_ML_Daily
sort/mergetsort.py
mergetsort.py
py
607
python
en
code
1
github-code
36
43807404173
""" -*- coding: utf-8 -*- @Software: PyCharm @Site: @File: rrt.py @Author: HBlank @E-mail: hehaowei@126.com @Time: 4月 03, 2020 @Des:实现rrt """ from src.rrt_base import RRTBase class RRT(RRTBase): def __init__(self, X, Q, x_init, x_goal, max_samples, r, prc): super().__init__(X, Q, x_init, x_goal, max_sa...
WUSTBlank/rrt-test
src/rrt.py
rrt.py
py
874
python
en
code
0
github-code
36
6435161442
def flip(num): tostring = str(num) if "3" in tostring or "4" in tostring or "7" in tostring: return num flippednum = tostring[::-1] if "6" in flippednum: return int(flippednum.replace("6","9")) elif "9" in flippednum: return int(flippednum.replace("9","6")) else: ...
DongjiY/Kattis
src/addemup.py
addemup.py
py
993
python
en
code
1
github-code
36
1702730464
# %% from itertools import combinations import spacy # Load spaCy's pre-trained word embedding model nlp = spacy.load("en_core_web_sm") # Input text containing words for similarity comparison text = ( "funny comedy music laugh humor song songs jokes musical hilarious" ) # Process the input text wit...
NewDonkCity/Portfolio
word_embedding.py
word_embedding.py
py
1,598
python
en
code
0
github-code
36
18284253607
# 用xpath爬取糗事百科里面段子的详情,存储为json格式 # https://www.qiushibaike.com/8hr/page/1/ # 每个段子 //div[contains(@id,"qiushi_tag_")] # 用户名 ./div/a/h2 # 图片链接 ./div/a/img[@class="illustration"]/@src # 段子内容 ./a/div[@class="content"]/span # 点赞数 ./div/span/i[@class="number"] # 评论数 ./div/span/a/i[@class="number"] import requests from lxml...
longyincug/crawler
12_xpath_json_demo.py
12_xpath_json_demo.py
py
2,016
python
en
code
0
github-code
36
14147663072
import inspect from pathlib import Path import torch import yaml from comfy import model_detection, model_management from comfy.sd import CLIP, VAE, load_model_weights from comfy.model_patcher import ModelPatcher from comfy.utils import calculate_parameters from folder_paths import models_dir as comfy_models_path from...
s1dlx/comfy_meh
meh.py
meh.py
py
7,524
python
en
code
13
github-code
36
10665105745
import datetime from flask.ext.jwt import current_identity, jwt_required from flask_restplus import Namespace, Resource, fields, reqparse from packr.models import Order, Role, User api = Namespace('lookup', description='Operations related to looking up an order') lookup = api.model('Lookup', { '...
ZeroEcks/packr
packr/api/lookup.py
lookup.py
py
4,547
python
en
code
0
github-code
36
4393524173
# 만들 수 없는 금액 # n = int(input()) # data = list(map(int, input().split())) # data.sort() # result = set() # sum = 0 # for i in range(len(data)): # result.add(data[i]) # sum += data[i] # result.add(sum) # sum2 = 0 # for j in range(i + 1, len(data)): # result.add(data[i] + data[j]) # ...
sjjam/Algorithm-Python
Book/Greedy/Q4.py
Q4.py
py
701
python
en
code
0
github-code
36
13621561097
import tkinter as tk from tkinter import ttk,messagebox from tkinter.filedialog import askopenfilename import receta class buscarReceta(ttk.Frame): def __init__(self, parent): super().__init__(parent) parent.title("Buscar una Receta") parent.iconbitmap('img\chef.ico') #parent.geome...
Loboxos/proyectoRecetasUpateco
busqueda.py
busqueda.py
py
4,532
python
es
code
0
github-code
36
4802363819
def add_numbers(num1,num2): sum=num1+num2 print(sum) add_numbers(5,9) # function return type def square_numbers(num): result=num*num return result print(square_numbers(3)) # square root # def squareroot(): # import math # square_root=math.sqrt(4) # print(square_root()) # squareroot() # calculate the ...
Angeth-Herjok/Revision-python
ass.py
ass.py
py
1,484
python
en
code
0
github-code
36
26478265364
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('api', '0004_auto_20150623_1841'), ] operations = [ migrations.AlterField( model_name='element', name...
protocolbuilder/sana.protocol_builder
src-django/api/migrations/0005_auto_20150703_2228.py
0005_auto_20150703_2228.py
py
608
python
en
code
0
github-code
36
4511367599
import openpyxl import pandas from collections import Counter from difflib import SequenceMatcher from collections import OrderedDict import time import numpy import igraph import sys pathTest = "E:\\Pham Thanh Quyet - 23.12.2022\\DSKH 22.12.23\\VRS VRH\\Book1.XLSX" path = "E:\\Pham Thanh Quyet - 23.12.2022\\DSKH 22....
ChinhTheHugger/vscode_python
excel_graph_test.py
excel_graph_test.py
py
2,397
python
en
code
0
github-code
36
43281589774
#!/usr/bin/env python from sys import argv import boto3 import logging logging.basicConfig(level=logging.INFO) session = boto3.Session() sqs = session.client('sqs') sts = session.client('sts') def queue_transfer(from_queue, to_queue): logging.info(f"Transfer from {from_queue} to {to_queue}") from_queue_url ...
bhoven/sqs-util
sqs_util.py
sqs_util.py
py
2,405
python
en
code
0
github-code
36
43102936048
from collections import namedtuple from playment.utilities import Decodable class JobResult(Decodable): def __init__(self, job_id: str = None, batch_id: str = None, project_id: str = None, reference_id: str = None, status: str = None, tag: str = None, priority_weight: int = None, result: str = No...
crowdflux/playment-sdk-python
playment/jobs/job_result.py
job_result.py
py
703
python
en
code
0
github-code
36
44101908061
from flask import Flask, request, send_from_directory from PIL import Image import pathlib import os import urllib S3_BUCKET_URL = "https://s3-us-west-2.amazonaws.com/makersdistillery/" IMAGES_PATH = pathlib.Path("images") app = Flask(__name__) @app.route("/images/<path:image_path>") def images(image_path): file...
akb/image-resize-service
image-resize.py
image-resize.py
py
2,004
python
en
code
0
github-code
36
23540887587
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Language Detector is a RESTful web service for detecting the language of arbitrary text. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import os...
NLPKit/LanguagePredictor
language_predictor.py
language_predictor.py
py
2,386
python
en
code
2
github-code
36
26010207985
import argparse import os import re import subprocess import sys import test_common parser = argparse.ArgumentParser() parser.add_argument("files", nargs="*") args = parser.parse_args() here = os.path.dirname(os.path.realpath(__file__)) codes = {} for s in open(os.path.join(here, "..", "src", "etc.h")).readlines():...
russellw/ayane
test/test.py
test.py
py
1,339
python
en
code
0
github-code
36
3269636790
# # # import time from .external import getid from .types import MissingParamException from .utils import StopException, TaskRunner def genarid() -> str: return getid() def makearfsfromdisk(disk: str) -> int: runner = TaskRunner() try: runner.setvalue("disk", disk) for step in ( ...
toppk/saveme
lib/saveme/block.py
block.py
py
1,345
python
en
code
2
github-code
36
20583496296
import cv2 import numpy as np #COLOR PICKER RANGE green = np.uint8([[[40, 40, 255]]]) #here insert the bgr values which you want to convert to hsv hsvGreen = cv2.cvtColor(green, cv2.COLOR_BGR2HSV) print(hsvGreen) lowerLimit = hsvGreen[0][0][0] - 10, 150, 150 upperLimit = hsvGreen[0][0][0] + 10, 255, 255 print(upperL...
Altair115/OpenCV2-Workshop
Opdrachten/Op3.py
Op3.py
py
1,498
python
en
code
0
github-code
36
9626703877
import json import re import os import time import logging from collections import namedtuple from paddle.fluid import core import paddle.fluid as fluid import numpy as np Doc = namedtuple("Document", ("id", "title", "content")) SegDoc = namedtuple("Seg_Document",("id", "title", "content", "seg_content")) def read_o...
hanguantianxia/model
utils.py
utils.py
py
8,186
python
en
code
0
github-code
36
39930433596
import math def readQueries(): n = int(input("Enter n:")) x = [float(i) for i in input("Enter x as space seperated integers:").split()] y = [float(i) for i in input("Enter y as space seperated integers:").split()] z = [float(i) for i in input("Enter z as space seperated integers:").split()] q = in...
sociallyencrypted/CSE101
A2_2021066/A2_2021066_2.py
A2_2021066_2.py
py
2,768
python
en
code
0
github-code
36
73490872105
from selenium.webdriver.common.action_chains import ActionChains from urllib.parse import urljoin import time import pytest @pytest.fixture def catalog_url(baseurl_option): return urljoin(baseurl_option, '/index.php?route=product/category&path=20') def test_login_catalog(catalog_url, browser): browser.get(c...
astretcova/Otus-lessons
hw_8/catalog_test.py
catalog_test.py
py
1,503
python
en
code
0
github-code
36
27187725961
# -*- coding : utf-8 -*- ### IMPORTATION PYTHON # General management import os import sys # Data analysis ans wrangling import numpy as np import math import pandas as pd import random as random # Data visualization import seaborn as sns import matplotlib.pyplot as plt # --- load data path = os.path.dirname(os.path....
fkimmig/Titanic
baseline_solution_fk.py
baseline_solution_fk.py
py
3,215
python
en
code
0
github-code
36
42319613433
def aVeryBigSum(ar): bsum=0 for i in range(0,len(ar)): bsum= bsum + ar[i] return bsum # Write your code here if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') ar_count = int(input().strip()) ar = list(map(int, input().rstrip().split())) result = aV...
VedantShahi/Assignment-3.1
A Very Big Sum.py
A Very Big Sum.py
py
389
python
en
code
1
github-code
36
8674468084
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2022/10/25 15:03 # @Author : Hanchiao # @File : antColony.py import numpy as np from enum import Enum from itertools import count import statistics import matplotlib.pyplot as plt import sys import time def _custom_create(custom_generate, pool): ini...
Timber-Ye/intl-opt
AntColony/knapsack-problem/antColony.py
antColony.py
py
8,503
python
en
code
0
github-code
36
37938305677
import tkinter as tk from tkinter import ttk class New_Punkt(tk.Toplevel): def __init__ (self, main): self.main = main super().__init__ (self.main) self.Punkts = self.main.Punkts self.bind('<Escape>', lambda e: self.destroy()) self.init_new_punkt() def on_entry_click(...
SpIIIII/ProTech
windows/New_punkt.py
New_punkt.py
py
10,928
python
en
code
0
github-code
36
2594269249
# This is purely the result of trial and error. import os import sys import codecs import subprocess from setuptools import setup from setuptools import find_packages import aiowrpr INSTALL_REQUIRES = [ 'aiodns==2.0.0', 'aiohttp[speedups]>=3.7.4', 'aiohttp-apispec==2.1.0', 'apispec==3.2.0', 'asyn...
ishirshov/aiowrpr
setup.py
setup.py
py
2,821
python
en
code
0
github-code
36
23677049937
import warnings warnings.filterwarnings('ignore') import numpy as np import pandas as pd #import matplotlib as plt import matplotlib.pyplot as plt from pyFTS.common import Util from pyFTS.benchmarks import Measures from pyFTS.partitioners import Grid, Entropy from pyFTS.models import hofts from pyFTS.common import Mem...
minhazul-alam/Fuzzy_Systems
FuzzyPracticeCodes/solarfts.py
solarfts.py
py
1,382
python
en
code
1
github-code
36
1411699424
import os from vk import VK from ya_disk import YaDisk import json from datetime import datetime from tqdm import tqdm from dotenv import load_dotenv def main(): vk_user_id = input('Enter VK user ID (only digits): ') num_photos = int(input('Enter the number of photos to save (default is 5): ') or 5) load...
kanadass/photo_backup_cw
main.py
main.py
py
1,466
python
en
code
0
github-code
36
70536824424
''' Balanced strings are those that have an equal quantity of 'L' and 'R' characters. Given a balanced string s, split it into some number of substrings such that: Each substring is balanced. Return the maximum number of balanced strings you can obtain. ''' class Solution(object): def balancedStringSplit(sel...
ChrisStewart132/LeetCode
1221. Split a String in Balanced Strings.py
1221. Split a String in Balanced Strings.py
py
559
python
en
code
0
github-code
36
955739042
pkgname = "python-pygments" pkgver = "2.16.1" pkgrel = 0 build_style = "python_pep517" hostmakedepends = [ "python-build", "python-installer", "python-flit_core", "python-wheel", ] depends = ["python"] pkgdesc = "Generic syntax highlighter written in Python" maintainer = "q66 <q66@chimera-linux.org>" li...
chimera-linux/cports
main/python-pygments/template.py
template.py
py
615
python
en
code
119
github-code
36
21753084092
# -*- coding: utf-8 -*- import os import tensorflow as tf from PIL import Image writer = tf.python_io.TFRecordWriter("train.tfrecords") images_path = "./snow/" classes = {'snow'} for index, name in enumerate(classes): for img_name in os.listdir(images_path): img_path = images_path + img_name im...
crayhuang/TGOTPeopleRecognition
ImageHandler.py
ImageHandler.py
py
1,094
python
en
code
0
github-code
36
14525183113
# Implementation of classic arcade game Pong import simplegui import random # initialize globals - pos and vel encode vertical info for paddles WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 PAD_WIDTH = 8 PAD_HEIGHT = 80 HALF_PAD_WIDTH = PAD_WIDTH / 2 HALF_PAD_HEIGHT = PAD_HEIGHT / 2 LEFT = False RIGHT = True score...
jovanibrasil/interactive-python
courseraprojects/mini_project_4.py
mini_project_4.py
py
4,754
python
en
code
0
github-code
36
38985342452
######################################################### ### Train & Register Insurance Claims Model ### ######################################################### ################### ### Credentials ### ################### import keyring import getpass import runpy import os from pathlib import Path import...
christopher-parrish/sas_viya
python/tweedie_regressor_python/insurance_claims_auto/pure_premium_python_insuranceclaimsauto.py
pure_premium_python_insuranceclaimsauto.py
py
17,181
python
en
code
1
github-code
36
11991246092
''' 3 PARTES: 1 - ENTRAR DATOS 2 - PROCESARLOS 3 - MOSTRAR/SALIDA DATOS ''' ''' LOS DATOS LOS GUARDO EN VARIABLES (ESPACIOS DE MEMORIA CON NOMBRE) TIPOS DE DATOS: DATOS SIMPLES: numericos (enteros, reales --- int , float, decimal) alfanumericos (palabras --- str) logicos (Verdedore o Falso --- bool) DATOS COMPLEJOS...
Nykolas/INFO2023
semana1/clase1.py
clase1.py
py
1,516
python
es
code
4
github-code
36
24556338376
import hashlib import json import os import argparse import sys import hmac import re import signal from multiprocessing import Process from flask import request import requests from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives.ciphers.algorithms import AES...
tolojo/bank-SA-22-23
Phase 1/Client/Client.py
Client.py
py
12,283
python
en
code
0
github-code
36
37728423811
from tkinter import * import pyttsx3 import PIL.ImageOps from PIL import Image import numpy as np from PIL import EpsImagePlugin import tensorflow as tf import matplotlib.pyplot as plt import threading import random import time oldtext = "" physical_devices = tf.config.experimental.list_physical_devices('GPU') if len(...
galbb12/quick-draw-full-python-tkinter
quick draw.py
quick draw.py
py
10,113
python
en
code
1
github-code
36
25130446182
import os import pandas as pd # hardcoded data_folders = ['cat', 'car', 'dog', 'lion' ] data_folders # array of arrays, containing the list files, grouped by folder filenames = [os.listdir(f) for f in data_folders] [print(f[1]) for f in filenames] [len(f) for f in filenames]
neskwoe/color
image/imagelist.py
imagelist.py
py
281
python
en
code
0
github-code
36
4352028229
import sys import csv import json # Converts the JSON output of a PowerBI query to a CSV file def extract(input_file, output_file): input_json = read_json(input_file) data = input_json["results"][0]["result"]["data"] dm0 = data["dsr"]["DS"][0]["PH"][0]["DM0"] columns_types = dm0[0]["S"] columns = ...
ondata/covid19italia
webservices/vaccini/puntiSomministrazione.py
puntiSomministrazione.py
py
2,598
python
en
code
207
github-code
36
11065813459
def binary_search(keys, query): '''Дано 2 массива keys - массив чисел где мы ищем (с дупликатами!!! для них правильный индекс - первое вхождение в массив); query - массив чисел, по порядку все из которых мы должны найти в массиве keys и вывести их индексы, если нет, то -1''' #Failed case # 54/57: time...
Maksim-Rudenko/PycharmProjects
pythonProject/Coursera/Algorithmic Toolbox/week 4/binary_search_duplicates.py
binary_search_duplicates.py
py
2,326
python
ru
code
0
github-code
36
20028159089
from boto3 import client from flask import Flask, jsonify, request, make_response from .utils import get_timestamp from .constants import FAVOURITE_COMPANIES_TABLE, FAVOURITE_ORG_ID, ORG_ID app = Flask(__name__) app.config["JSONIFY_PRETTYPRINT_REGULAR"] = True client = client("dynamodb", region_name="eu-west-1") h...
AndreuJove/serverless_training
app/app.py
app.py
py
2,942
python
en
code
0
github-code
36
23552489654
from re import I import numpy as np import gym import random """ 常に観測値として1を返す環境 環境に対して取るべき行動が周期的に切り替わり、 それに応じて報酬が決定される。 """ class StaticCyclicEnv0(gym.Env): def __init__(self, cycle, cycle_cnt_max, action_num, noise): super().__init__() self.cycle = cycle assert self.cycle % action_num == ...
kato-mahiro/periodic_task_experiment
myenvs/myenvs.py
myenvs.py
py
2,339
python
en
code
0
github-code
36
18659247749
import numpy as np import pandas as pd from sklearn.model_selection import KFold, train_test_split from sklearn.preprocessing import LabelEncoder,OneHotEncoder from keras.utils import np_utils import tensorflow as tf from MB_nn import MB_nn from keras.utils.np_utils import to_categorical from sklearn.metrics import ...
EricXue92/MB_NN
main.py
main.py
py
5,247
python
en
code
0
github-code
36
41217197786
# coding=utf-8 __author__ = 'zjutK' '''循环变量的默认参数比较''' def make_action(): acts = [] for i in range(5): acts.append(lambda x, i=i: i ** x) # i=i为了让i的值能够传递给嵌套作用域 return acts if __name__ == '__main__': ss = make_action() print(ss[2](2))
kzrs55/learnpython
function/make_action.py
make_action.py
py
318
python
en
code
0
github-code
36
469424801
#!/usr/bin/env python from setuptools import setup VERSION = "0.2" REPO = "https://github.com/duedil-ltd/python-sloq" README = "README.rst" with open(README) as f: long_description = f.read() setup( name="sloq", version=VERSION, description="Rate-limited Queue", author="Paul Scott, Duedil Limited...
duedil-ltd/python-sloq
setup.py
setup.py
py
617
python
en
code
3
github-code
36
16774999516
from django_cas_ng import views as cas_views from django_cas_ng.models import ProxyGrantingTicket, SessionTicket from django_cas_ng.utils import get_protocol, get_redirect_url, get_cas_client from django_cas_ng.signals import cas_user_logout from django.http import JsonResponse, HttpRequest, HttpResponse, HttpResponseR...
ferenica/sipraktikum-backend
authentication/cas_wrapper.py
cas_wrapper.py
py
3,330
python
en
code
0
github-code
36
15058607422
# Importing the ChoiceMC class import sys import os try: from ChoiceMC import ChoiceMC, loadResult except ModuleNotFoundError: sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))) from ChoiceMC import ChoiceMC, loadResult import matplotlib.pyplot as plt import time import num...
AndrewBright34/ChoiceMC
Parametric_Sweeps/ChoiceMC_Sweep_Entanglement.py
ChoiceMC_Sweep_Entanglement.py
py
6,148
python
en
code
0
github-code
36
15130212540
# A brief script to convert GIF files to RAW with Vector's screen dimensions. Use GIF files that are 184x96 for best results. # Expected Python Version is 3.9. import os,sys #import struct import array from PIL import Image #import Image SCREEN_WIDTH,SCREEN_HEIGHT = 184,96 #240,240 #180,240 SIZE = (SCREEN_WIDTH,SCREE...
digital-dream-labs/oskr-owners-manual
examples/change_boot_anim/gif_to_raw.py
gif_to_raw.py
py
2,400
python
en
code
35
github-code
36
21098832887
#!/usr/bin/python3 import os import sys import argparse import re if __name__ == '__main__': infile_format = '' cmd_opts = [] id_pat = r'' alt_id_pat = r'' parser = argparse.ArgumentParser(description = """ """) parser.add_argument('-i', '--infile', help = f'Speciefies path to input...
jonasfreimuth/dbp-exercises
templates/cli_template.py
cli_template.py
py
1,556
python
en
code
0
github-code
36
36189617286
import requests url_f = "https://shiqianjiang.cn/home/image/bg" url_e = ".webp" headers = { 'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8', 'Accept-Language': 'zh-CN,zh;q=0.9', 'Connection': 'keep-alive', 'Referer': 'https://shiqianjiang.cn/home/', 'Sec-Fetch-Dest': '...
wuheyouzi/code
PycharmProjects/test/shiqianjiang/shiqianjiang.py
shiqianjiang.py
py
1,346
python
en
code
0
github-code
36
22280407323
from django.shortcuts import render, redirect from django.http import HttpResponse from django.http import JsonResponse # Create your views here. from server.settings import TENCENT_KEY from app01.models import User def index(request): is_login = request.session.get('is_login', None) print(f'is_login: {is_lo...
LincolnBurrows/my-wechat-mini-program
server/app01/views.py
views.py
py
2,661
python
en
code
0
github-code
36
1942428451
class Solution: def selfDividingNumbers(self, left: int, right: int) -> List[int]: def check(n: int) -> bool: s = str(n) if "i" in s: return False for ch in s: if n % int(ch) != 0: return False return True ...
hellojukay/leetcode-cn
src/self-dividing-numbers.py
self-dividing-numbers.py
py
457
python
en
code
3
github-code
36
29207926658
def isPossible(weights, load, days): cnt = 1 weigtAllocated = 0 for i in range(len(weights)): if(weigtAllocated > load): return False weigtAllocated += weights[i] if(weigtAllocated > load): cnt += 1 weigtAllocated = weights[i] return cnt <= day...
sakshi5250/6Companies30Days
INTUIT/Question7.py
Question7.py
py
750
python
en
code
0
github-code
36
2496533389
#!/usr/bin/env python import rospy,actionlib from iiwa_msgs import msg, srv import actionlib_msgs.msg import demo_msgs.srv def create_movement(link,position_x,position_y,position_z,orientation_x,orientation_y,orientation_z,orientation_w): movement=msg.CartesianPose() movement.poseStamped.header.seq = 1 moveme...
andresOchoaHernandez/demoKukaLBR
demo/src/demo.py
demo.py
py
6,225
python
en
code
0
github-code
36
36584541657
import logging from datetime import datetime from pymongo import MongoClient, UpdateOne class UrlRepository: def __init__(self): mongo_client = MongoClient('mongodb://mongodb:27017/') mongo_db = mongo_client['crawler_db'] self.collection = mongo_db['urls'] try: self.co...
HarrYoha/url_explorer
src/repositories/url_repository.py
url_repository.py
py
838
python
en
code
0
github-code
36
11934438668
from collections import Counter from typing import Counter def main(): t = int(input()) for i in range(t): n = int(input()) nums = list(map(int, input().split())) count = Counter(nums) print(count) main()
Misganaw-Berihun/CONTESTS
After_study_contest_4/Equalize_the_Array.py
Equalize_the_Array.py
py
245
python
en
code
0
github-code
36
26336332994
import pytest from ui.locators import basic_locators from base import BaseCase class Test_Target(BaseCase): @pytest.mark.UI def test_login(self): self.log_in('alena1997999@gmail.com', 'tWz+H@&Gws#Yj7L') assert 'Кампании' in self.driver.title @pytest.mark.UI def test_logout(self): ...
penguin7707/demo
code/test_hm1.py
test_hm1.py
py
1,317
python
en
code
0
github-code
36
74537088743
# stdlib imports import asyncio import time # project imports import asyncio_cpu import asyncio_io if __name__ == "__main__": start_time = time.time() loop = asyncio.get_event_loop() io_start = time.time() api_data = loop.run_until_complete(asyncio_io.get_data()) print(f"\nDone. IO bound time: {...
bdelate/talk-python-async
src/asyncio_main.py
asyncio_main.py
py
592
python
en
code
2
github-code
36
37941848319
from kivy.uix.screenmanager import ScreenManager, Screen from tasks.tsks import A class Scrn_manger: sm = ScreenManager() name = "" sc = Screen(name="tasks") # main.right.dodBtn.bind(on_press=main.dod) def to_lists(self, sc, a): self.sm.current = "lists" self.sm.remove_widget(sc)...
domenSedlar/ToDoAppClient
scrn_mangr.py
scrn_mangr.py
py
874
python
en
code
0
github-code
36
71666162024
# The following code was adapted from Week 3 Programming Assignment 1 in the Sequence Models course by DeepLearning.AI offered on Coursera # https://www.coursera.org/learn/nlp-sequence-models/home/week/3 from tensorflow.keras.layers import Bidirectional, Concatenate, Permute, Dot, Input, LSTM, Multiply from tensorfl...
AndrewZhang126/Neural-Networks
Attention_Model.py
Attention_Model.py
py
5,043
python
en
code
1
github-code
36
29087134899
import sys, copy # order is: 2 4 0 1 3 input = open(sys.argv[1]).read() numWords = int(sys.argv[2]) extractPos = int(sys.argv[3]) data = [float(tmp.split()[extractPos]) for tmp in input.split('\n')[:-1]] tmp = copy.deepcopy(data) data[0] = tmp[2] data[1] = tmp[4] data[2] = tmp[0] data[3] = tmp[1] data[4] = tmp[3] s...
tobzed/appgpu20
project/results_large/format.py
format.py
py
462
python
en
code
0
github-code
36
24498767090
#Name- Tanubrata Dey #Date- 8 April 2018 #This program prints: Parking ticket import pandas as pd csvFile = input('Enter CSV file name: ') tickets = pd.read_csv(csvFile) attribute = input("Enter name of attribute: ") print(tickets[attribute].value_counts()[:10])
tanubrata/Introduction-to-Python-
parking ticket.py
parking ticket.py
py
280
python
en
code
0
github-code
36
35863495139
# Writes a function that takes seconds as a input and displays the time in hours, min , second #eg. if the user input 3700 s it should display 1 hour 1 min and 40 sec def time(sec): sec1 = int(sec / 3600) sec2 = int((sec % 3600)/60) sec3 = int((sec % 3600)%60) print(sec1,"hour", sec...
codexmuneer/python-beginning-work
Lab5taskc.py
Lab5taskc.py
py
411
python
en
code
0
github-code
36
8097764457
import os # use CPU only os.environ["CUDA_VISIBLE_DEVICES"] = "" import pickle import argparse import numpy as np from math import ceil from tqdm import tqdm import tensorflow as tf from shutil import rmtree np.random.seed(1234) def split(sequence, n): """ divide sequence into n sub-sequence evenly """ k, m = ...
bryanlimy/CalciumGAN
dataset/generate_tfrecords.py
generate_tfrecords.py
py
8,641
python
en
code
2
github-code
36
21518532065
""" Script for converting json annotations in to csv format for training Only takes into consideration tool boundary boxes # Re-implementation from new git clone surgery tool detection # """ import csv import json import argparse from pathlib import Path from PIL import Image DATA_DIR = str(Path(__file__).resolve(...
egoodman92/semi-supervised-surgery
MULTITASK_FILES/RETINANET_FILES/src/util/convert_data2.py
convert_data2.py
py
5,607
python
en
code
0
github-code
36
15317253550
import string def hello() -> int: return "hello" age: int = "20" name = "Antal" apples = [1,2,5,7] print(age) print(type(apples)) print(hello()) brand = "amigoscode" print("code" not in brand) text = f""" Hello {name} How are yout? I am {age} years old. """ print(text.format(name, age))
Psychol0g1st/ScriptLanguages
Python crash course/hello.py
hello.py
py
297
python
en
code
0
github-code
36
34211985705
# 19.09.28 COL_CHESS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] LEN_CHESS = len(COL_CHESS) bishops1 = ['D5'] bishops2 = ['D5', 'E8', 'G2'] def can_move_to(r,c, dir): if dir=='ul': return 0<=r-1<LEN_CHESS and 0<=c-1<LEN_CHESS elif dir=='ur': return 0<=r-1<LEN_CHESS and 0<=c+1<LEN_CHESS eli...
chankoo/problem-solving
brute-force/prog_1909_2.py
prog_1909_2.py
py
2,106
python
en
code
1
github-code
36
11672647873
import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import random fig = plt.figure(figsize=(16,12)) ax = fig.add_subplot(111,projection='3d') x1 = np.arange(-5,5,0.5) x2 = np.arange(-5,5,0.5) x1,x2 = np.meshgrid(x1,x2) ax.set_xlim(-5,5) ...
akaranjkar/PSO
plot.py
plot.py
py
929
python
en
code
0
github-code
36
27182569232
import asyncio async def num(number): print("before calling coroutine") await asyncio.sleep(1) print('after calling coroutine') return str(number) loop = asyncio.get_event_loop() # n = num(5) l= loop.run_until_complete(num(5)) print(l) loop = asyncio.get_event_loop() # c = loop.create_task(num(5)) #...
sivanagarajumolabanti/Chromata
asyncbasic/asyncfuture.py
asyncfuture.py
py
364
python
en
code
0
github-code
36
29774357428
import numpy as np import sys import os from random import shuffle from sklearn.externals import joblib import gzip def build(filename, list_file): with gzip.open(filename, "wt") as file_zip: for line in list_file: file_zip.write(line) file_zip.close() if __name__ == '__...
rajathpatel23/joint-kge-fnet-lm
KGE_LM/preprocess/build_dataset_random.py
build_dataset_random.py
py
807
python
en
code
3
github-code
36
30391214782
from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.core.exceptions import PermissionDenied from django.shortcuts import render, get_object_or_404 from .models import * fr...
sikkzz/cloudprogramming
shop/views.py
views.py
py
3,758
python
en
code
0
github-code
36
34715529563
from torchvision import datasets, transforms from base import BaseDataLoader from torch.utils.data import Dataset, ConcatDataset from data_loader import EcalDataIO import torch import random from pathlib import Path import numpy as np from collections import Counter CSV_LEN = 25410 # --------------------------------...
elihusela/LUXE-project-master
data_loader/data_loaders_backup.py
data_loaders_backup.py
py
15,351
python
en
code
0
github-code
36
16002420757
#!/usr/bin/python3 import os import cv2 def Smoothing(image_name): res_dir = os.environ["PY_IMG"] if res_dir is None: print("[ERROR] Resources path isn't defined") # Convertimos a escala de grises original_image = cv2.imread(res_dir + "/" + image_name, cv2.IMREAD_GRAYSCALE) if original_ima...
Madophs/Image-Processsing
filters/Smoothing.py
Smoothing.py
py
1,790
python
en
code
0
github-code
36
7971934328
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from nnAudio import Spectrogram from .constants import * from .Unet_blocks import * import sys import abc from .normalization import Normalization from torchvision.models import resnet18 batchNorm_momentum = 0.1 num_instruments = 1 ...
w4k2/automatic_music_transcription
model/instrument_recognition_model.py
instrument_recognition_model.py
py
6,038
python
en
code
0
github-code
36
27704235551
#!/usr/bin/python3.6 # -*- coding: utf-8 -*- # Generators module import re, sys from decimal import Decimal from random import * from util import * from names import * from gen import * import misc from title.characters import * import title.chargenerator as char import title.misc as titmisc import title.titletemplate...
zadieblack/naughtybot3
title/generators.py
generators.py
py
351,700
python
en
code
5
github-code
36
38555784326
import os import sys import docx2python # Program to convert MS-Word pastes into a less # annoying text file layout. # Certain unicode symbols can be annoying to work with. TRANSLATION_TABLE = [ ("“", "\""), ("”", "\""), ("„", "\""), ("’", "'"), ("–", "-"), ("…", "..."), ("•", "*"), ] def write_output(...
TeilzeitTaco/flesh-network-blog
src/tools/indenter.py
indenter.py
py
4,906
python
en
code
0
github-code
36
28956742527
import argparse from pickle import NONE import random from wordfreq import zipf_frequency from constants import * def get_difficulty_to_words_map(difficulty=None): difficulty_to_words_map = {} for word in WORDS: difficulty = get_word_difficulty(word) if difficulty not in difficulty_to_words_map...
ravaan/wordle
utils.py
utils.py
py
3,121
python
en
code
0
github-code
36
26458087607
import unittest import sys import importlib from math import sqrt import BaseTypes import model class TestChromosome(unittest.TestCase): def setUp(self): self.naturalNumberN = model.Nucleotide(domain=BaseTypes.IntInterval(0,9)) self.lessThan100N = model.Nucleotide(domain=BaseTypes.IntInterval(0,99)...
rtorres19/pyevalres
test_Chromosome.py
test_Chromosome.py
py
1,705
python
en
code
0
github-code
36
8365459714
import pytest from .. import * # this is not necessary but mypy complains if it's not included from .. import CompileOptions options = CompileOptions() def test_cond_one_pred(): expr = Cond([Int(1), Int(2)]) assert expr.type_of() == TealType.uint64 cond1, _ = Int(1).__teal__(options) pred1, _ = In...
gconnect/voting-dapp-pyteal-react
venv/lib/python3.8/site-packages/pyteal/ast/cond_test.py
cond_test.py
py
3,458
python
en
code
6
github-code
36
2847753233
# Qus:https://leetcode.com/problems/next-greater-element-i/ class Solution(object): def nextGreaterElement(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ stack = [] d = {} for num in nums...
mohitsinghnegi1/CodingQuestions
leetcoding qus/Next Greater Element I.py
Next Greater Element I.py
py
720
python
en
code
2
github-code
36
38016425871
# Import the image data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) from tensorflow.contrib.session_bundle import exporter import tensorflow as tf # Start a session sess = tf.InteractiveSession() # Input Data x = tf.placeholder(tf.float32...
FrozenPandaz/tensorflow-tuts
src/mnist/mnist.py
mnist.py
py
1,262
python
en
code
0
github-code
36
15442890070
import os from . import exceptions from .master import CURRENT as MASTER def task(prefix, parsed_args, **kwargs): return [x["id"] for x in MASTER.tasks(prefix)] def slave(prefix, parsed_args, **kwargs): return [s["id"] for s in MASTER.slaves(prefix)] def file(prefix, parsed_args, **kwargs): files = s...
mesosphere-backup/mesos-cli
mesos/cli/completion_helpers.py
completion_helpers.py
py
1,018
python
en
code
116
github-code
36
6554352748
from __future__ import annotations # IMPORTS # =======> # noinspection PyUnresolvedReferences import typing from util.formatter.TextColor import * from util.formatter.TextEffects import * from dataclasses import dataclass, field from copy import deepcopy # EXPORTS # =======> __all__ = [ 'FormatString' ] # MAI...
ButterSus/KiwiPreview
util/formatter/FormatString.py
FormatString.py
py
6,736
python
en
code
0
github-code
36
30800487358
import time, datetime from screener import Screener import os, yaml def log(msg): print(f"[{datetime.datetime.now()}] - {msg}") config = yaml.safe_load(open("config.yaml","r")) folder_left = config['folder_left'] folder_substats = config['folder_substats'] sec_between_screenshot = co...
FrenchieTucker/RPGgearDetection
main_scraper.py
main_scraper.py
py
1,035
python
en
code
0
github-code
36
21217260203
import sqlite3 as sq from others import funcs as f def sql_start(): global base, cur base = sq.connect('bd_crypto_users.db') cur = base.cursor() if base: print('BD connected') base.execute('CREATE TABLE IF NOT EXISTS {}(id PRIMARY KEY, USDT,BTC,ETH)'.format('data')) base.commit() def...
AKAMElmf/crypto_trade_bot
database/sqlite_bd.py
sqlite_bd.py
py
2,756
python
en
code
0
github-code
36
13870980492
# 수집할 정보에 대응하는 CSS선택자를 각각 문자열 하나로 만들고, 이들을 딕셔너리 객체에 모아서 BeautifulSoup select함수와 사용하는 기법 # Content는 \ import requests from bs4 import BeautifulSoup class Content: ''' 글/페이지 전체에 사용할 기반 클래스 ''' def __init__(self, url, title, body): self.url = url self.title = title self.body = body...
hye0ngyun/PythonPractice
books/webScraping/chap04/chap04Ex2.py
chap04Ex2.py
py
2,936
python
ko
code
0
github-code
36
38666647232
from requests.adapters import BaseAdapter from requests.compat import urlparse, unquote from requests import Response, codes import errno import os import stat import locale import io from six import BytesIO class FileAdapter(BaseAdapter): def __init__(self, set_content_length=True): super(FileAdapter, s...
JimmXinu/FanFicFare
included_dependencies/requests_file.py
requests_file.py
py
4,729
python
en
code
664
github-code
36
19365768268
import telebot import re import pymongo from datetime import datetime from telebot import types from bson.objectid import ObjectId from config import * bot = telebot.TeleBot(TOKEN) db = pymongo.MongoClient('mongodb://localhost:27017/').kunyn_team working_obj = {} for player in db.players.find(): working_obj[play...
andrii-porokhnavets/telegram_bots
scoring/main.py
main.py
py
11,279
python
en
code
0
github-code
36
22783009608
# # @lc app=leetcode id=324 lang=python3 # # [324] Wiggle Sort II # # https://leetcode.com/problems/wiggle-sort-ii/description/ # # algorithms # Medium (30.59%) # Likes: 1341 # Dislikes: 654 # Total Accepted: 96.8K # Total Submissions: 314.6K # Testcase Example: '[1,5,1,1,6,4]' # # Given an integer array nums, r...
Zhenye-Na/leetcode
python/324.wiggle-sort-ii.py
324.wiggle-sort-ii.py
py
1,515
python
en
code
17
github-code
36
3285109512
#本范例会用list、if及wheil技巧,以传入list及目标参数,找出list中,最接近目标参数的值 def fun1(list,ss) : max=len(list) i=1 rult=ss while i<max: if list[i]>ss: print('%s %d'%(list[i],rult)) #print多参数 if list[i] >rult or list[i]>ss: if rult>ss and rult<list[i]: rult=rult...
millerhome/Python-code
samplecode/ex1.py
ex1.py
py
614
python
zh
code
0
github-code
36
2248843568
import os import glob import subprocess import pandas as pd from PIL import Image import datetime datetime.timedelta.min def get_date_taken(path): return Image.open(path)._getexif()[36867] #enter in the directory of your images in the line below os.chdir('D:/mgickdemo/images') cwd = os.getcwd() #unfortunately yo...
Owen-Duncan/LeafAreaQuant
Main.py
Main.py
py
2,123
python
en
code
0
github-code
36
4867507385
#!/usr/bin/python3 import numpy as np import pickle import matplotlib.pyplot as plt from matplotlib.patches import FancyArrowPatch from mpl_toolkits.mplot3d import proj3d from mpl_toolkits.mplot3d import axes3d # defining the class for later 3D arrow plots class Arrow3D(FancyArrowPatch): def __init__(self, xs, y...
Schlabonski/LennardJonesGas
plotting.py
plotting.py
py
4,026
python
en
code
0
github-code
36
40047690606
import csv import os import datetime from datetime import date, datetime, timedelta import matplotlib.pyplot as plt from rich.console import Console console = Console() current_date = date.today().strftime("%d/%m/%Y") # Generates unique ID for each new line in each csv file def generate_id(file_name): with open(...
Juliazijd/winc_superpy
superpy/helpers/buy_sell_products.py
buy_sell_products.py
py
6,563
python
en
code
0
github-code
36
324210528
import yaml from airflow.models import DAG from airflow.operators.python_operator import PythonOperator from airflow.operators.bash_operator import BashOperator def run(script): execFile('/root/airflow/runtime/{}'.format(script)) def create_python_task(task, dag): if 'executor_config' in task: t = P...
Nanjo-Naoto/450
parser.py
parser.py
py
1,565
python
en
code
0
github-code
36
31748626437
import matplotlib.pyplot as plt from random_walk import RandomWalk """make a random walk and plot points as long as the program is active""" while True: rw = RandomWalk() rw.fill_walk() """set size of plot window""" plt.figure(figsize=(10, 6)) point_numbers = list(range(rw.num_points))...
Javataru/data_visualizations
data_graph/data_visualizations/rw_display.py
rw_display.py
py
876
python
en
code
0
github-code
36