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
22766548519
import os import settings import flask from flask import send_file, request, abort, render_template from functools import wraps import bucket import image app = flask.Flask(__name__) app.config["DEBUG"] = True def require_api_key(view_function): @wraps(view_function) def decorated_function(*args, **kwargs): ...
Seagate/cortx
doc/integrations/images-api/api.py
api.py
py
2,198
python
en
code
631
github-code
90
39130751949
from __future__ import unicode_literals import frappe from frappe.utils import flt from frappe import _ import frappe.defaults def execute(filters=None): if not filters: filters = {} columns = get_columns() data = get_recheck_purchase_invoice(filters) return columns, data def get_columns(): return [ _("Stat...
andiyan1/checking
checking/checking/report/recheck_purchase_invoice/recheck_purchase_invoice.py
recheck_purchase_invoice.py
py
3,767
python
en
code
0
github-code
90
36115716480
import mysql.connector conn = mysql.connector.connect( host="localhost", user="root", password="", database="python_practical" ) cursor = conn.cursor() cursor.execute(''' CREATE TABLE company ( ID INT PRIMARY KEY NOT NULL, name VARCHAR(255) NOT NULL, age INT NOT N...
Mr-Yash-beldar/Python-Learning
Practical/database/mysqldemo.py
mysqldemo.py
py
1,196
python
en
code
0
github-code
90
31731236984
from fastapi import FastAPI, Query from pydantic import Required app = FastAPI() @app.get("/email/") async def validate_email(email: str = Query(default=Required, # also: default=..., min_length=5, max_length=50, ...
diegochine/ITTS-TPSIT
webdev/3_validation.py
3_validation.py
py
594
python
en
code
2
github-code
90
26823767917
#coding=utf-8 from poco.drivers.std import StdPoco from until.openid import openid import time poco=StdPoco() class publicLogin(): def SelectCity(self): poco("Layout")[1].offspring("city_list").child("root")[0].offspring("btn_1").click() poco("Layout")[1].offspring("btn_yes_city").click() ti...
fendoucg2019/ownerAuto
until/publicLogin.py
publicLogin.py
py
476
python
en
code
1
github-code
90
18404899129
N, K = map(int, input().split()) ans = 0.0 for i in range(1, N + 1): num = i t = 0 while num < K: t += 1 num *= 2 ans += 1 / 2 ** t print(ans / N)
Aasthaengg/IBMdataset
Python_codes/p03043/s169933111.py
s169933111.py
py
186
python
en
code
0
github-code
90
16625948247
#encoding:utf-8 RED = '\033[31m' CYAN = '\033[36m' GREEN = '\033[92m' ENDC = '\033[0m' import urllib import urllib.request import json import sys import pandas as pd from time import sleep import csv def scrape_serps(key,maxrank,df_api,api_counter,j,try_cnt): phrase = urllib.parse.quote(key) try: ...
DisneyAladdin/kenkyu
program/ohkawabata/2_googleAPI.py
2_googleAPI.py
py
5,055
python
en
code
1
github-code
90
25239156011
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor, ExtraTreesRegressor, GradientBoostingRegressor from Data_operations.Prepare_data import DataOperations from sklearn.model_selection ...
MortinerAzohen/Fifaproj
Predictions/train_test_split_tkapp.py
train_test_split_tkapp.py
py
3,476
python
en
code
0
github-code
90
18060159489
def gen(s): yield int(s) for i in range(len(s)-1): l = s[:i+1] r = s[i+1:] x = int(l) for y in gen(r): yield x + y s = input() print(sum(gen(s)))
Aasthaengg/IBMdataset
Python_codes/p04001/s107405411.py
s107405411.py
py
197
python
en
code
0
github-code
90
32041361700
from __future__ import print_function import os from PIL import Image import numpy as np import mxnet as mx import random from ..utils import normalize_img_array from .multiproc_data import MPData class SimpleBatch(object): def __init__(self, data_names, data, label_names=list(), label=list()): self._da...
E1223even12011/OCR-Project
cnocr/data_utils/data_iter.py
data_iter.py
py
10,243
python
en
code
5
github-code
90
71721972136
def sumar(num1,num2): return num1+num2 def restar(num1,num2): return num1-num2 def multiplicar(num1,num2): return num1*num2 def dividir(num1,num2): return num1/num2 def pedirNum(): try: n1=int(input("primer numero: ")) n2=int(input("segundo numero: ")) return n1,n2 ex...
juanPabloCesarini/cursoPYTHON2021
Seccion 8/excepciones_multiples.py
excepciones_multiples.py
py
1,213
python
es
code
0
github-code
90
17940163969
import sys def input(): return sys.stdin.readline().strip() def resolve(): s=input() ans='No' for i in range(len(s)-1): if s[i]=='A' and s[i+1]=='C': ans='Yes' print(ans) resolve()
Aasthaengg/IBMdataset
Python_codes/p03567/s400034672.py
s400034672.py
py
218
python
en
code
0
github-code
90
18398219859
# ABC128 D from collections import deque N,K=map(int,input().split()) V=list(map(int,input().split())) V=V[:]+V[:] def check(k): res=0 # 連続する k(K,K-1,...)個の宝石をとる # K-k個まで捨ててよい for i in range(k+1): if k<N: v=V[N-k+i:N-k+i+k] else: v=V[:N] v.sort(reverse=Tr...
Aasthaengg/IBMdataset
Python_codes/p03032/s864513335.py
s864513335.py
py
675
python
en
code
0
github-code
90
13994802761
import cv2 import glob # Gather Images images = glob.glob("*.jpg") # Resize Image for image in images: rawImage = cv2.imread(image, 0) resizedImage = cv2.resize(rawImage, (100, 50)) cv2.imshow(image, rawImage) cv2.waitKey(500) cv2.destroyAllWindows() cv2.imwrite('resized_' + image, resizedImage) print("D...
SimpleIdeaLabs/simple-open-cv-python
app.py
app.py
py
343
python
en
code
0
github-code
90
17374607456
from prompto.declaration.BaseDeclaration import BaseDeclaration from prompto.error.SyntaxError import SyntaxError from prompto.type.CategoryType import CategoryType class CategoryDeclaration(BaseDeclaration): def __init__(self, name, attributes=None): super().__init__(name) self.attributes = attr...
prompto/prompto-python3
Python3-Core/src/main/prompto/declaration/CategoryDeclaration.py
CategoryDeclaration.py
py
7,753
python
en
code
4
github-code
90
71270137257
# !/usr/bin/env python # -*- coding: utf-8 -*- from Tkinter import * from tkinter import * import tkinter as tk from tkinter import ttk from tkinter import messagebox as mb from tkinter import scrolledtext as st from googletrans import Translator class Traductor: def __init__(self): self.ventana1=...
fckfck97/traductor-con-interfaz-grafica
traductor.py
traductor.py
py
5,268
python
es
code
0
github-code
90
26208997855
""" benders decomposition reference: 1. COPT reference manual 2.《运筹优化常用模型、算法及案例实战——Python+Java实现》 刘兴禄,熊望祺,臧永森,段宏达,曾文佳 2022年,清华大学出版社 """ import numpy as np import sys import coptpy as cp from coptpy import COPT EPSILON = 0.001 # design our benders cut class benders_cut_callback(cp.CallbackBase): """ Customize...
chiangwyz/Operation-Research-Algo
benders decomposition/complete version.py
complete version.py
py
7,872
python
en
code
2
github-code
90
6436771551
import scipy.stats as stats conversion_rates_A = [0.12, 0.15, 0.11, 0.14, 0.13, 0.16, 0.17, 0.10, 0.12, 0.14] conversion_rates_B = [0.10, 0.09, 0.11, 0.08, 0.12, 0.09, 0.13, 0.11, 0.10, 0.12] t_statistic, p_value = stats.ttest_ind(conversion_rates_A, conversion_rates_B) alpha = 0.05 if p_value < alpha: conc...
nampallimohith/f-o-d-s
fod 20.py
fod 20.py
py
577
python
en
code
0
github-code
90
6741554009
#Create a program that will keep track of the number of tokens won in a game. #The program will ask the user for the number of tokens after 7 games and print #those values to the screen. It will also determine the total number of tokens #and the average. Finally the program will determine what is the highest token...
VictorOwinoKe/UoM-DESIGN-THINKING-
Arrays/tokens.py
tokens.py
py
1,849
python
en
code
1
github-code
90
152789061
import dataclasses import datetime from typing import TYPE_CHECKING import attr import inject from returns.maybe import Nothing from returns.pipeline import flow from returns.pointfree import bind_result from returns.result import Success from action_logger.repositories import ChangelogRepo from board.entities import...
pmisters/django-code-example
board/usecases/_update_room_close.py
_update_room_close.py
py
9,333
python
en
code
0
github-code
90
36215937730
dictionary = [] def recursion(p, step): if step == 6: return if p != '': dictionary.append(p) for c in ['A', 'E', 'I', 'O', 'U']: recursion(p+c, step+1) def solution(word): answer = 0 recursion('', 0) for i in range(len(dictionary)): if dictionary[i] == word: ...
nbalance97/Programmers
위클리 챌린지/[ 5주차 ] 모음 사전.py
[ 5주차 ] 모음 사전.py
py
383
python
en
code
0
github-code
90
1433624492
import unittest # loading settings from .env file in root of project directory from dotenv import load_dotenv load_dotenv() class QRTest(unittest.TestCase): """Tests for GeekTechStuff Grafana API Python""" ''' def test_admin_name_is_string(self): admin_username = main.get_username() self.a...
agentroj/ajc-integritas
tests/test_main.py
test_main.py
py
1,609
python
en
code
0
github-code
90
6547470506
# -*- coding:utf-8 -*- class Node(): def __init__(self,data=None): self.data = data self.next = None class LinkedList(): def __init__(self): self.head = None def print_list(self): node1 = self.head while node1: print(node1.data) node1 = node...
Hacksdream/Leetcode_Training
2.LinkList/linked_del_node.py
linked_del_node.py
py
1,046
python
en
code
0
github-code
90
38260574451
import numpy as np import matplotlib.pyplot as plt def draw(x1, x2): """Draw line between x1 and x2""" line = plt.plot(x1, x2) plt.pause(0.00001) line[0].remove() def sigmoid(score): """Calculate sigmoid of score""" return 1 / (1 + np.exp(-score)) def calculate_error(line_parameters, points, ...
tylerlum/neural_network
logistic_regression.py
logistic_regression.py
py
2,241
python
en
code
0
github-code
90
36363597214
from logging import getLogger from typing import Dict, Any, List from datetime import date import math from botocore.client import BaseClient from botocore.exceptions import BotoCoreError, ClientError from collections import defaultdict from src.data.aws_scanner_exceptions import CostExplorerException class AwsCost...
hmrc/platsec-aws-scanner
src/clients/aws_cost_explorer_client.py
aws_cost_explorer_client.py
py
2,713
python
en
code
3
github-code
90
25501788856
import time class Song: def __init__(self, name, performer, duration, plays=0, **kwargs): self.name = name self.performer = performer self.duration = duration self.plays = plays self.name_album = None for key,value in kwargs.items(): setattr(self, key, value) def __str__(self): return f'{self.na...
Omniben/spotipy
models/song.py
song.py
py
1,018
python
es
code
0
github-code
90
10880500987
import spacy nlp = spacy.load("en_core_web_sm") def get_entities(text): doc = nlp(text) entities = [] for ent in doc.ents: entities.append(ent.text) return entities if __name__ == "__main__": text = "Reliance Jio launches video conferencing app JioMeet to take on Zoom App" print(get...
raja-1996/tweet_sentiment
modules/spacy_nlp.py
spacy_nlp.py
py
337
python
en
code
1
github-code
90
31241872180
import numpy as np import matplotlib.pyplot as plt import os import json from pycocotools.coco import COCO import pandas as pd from objectpath import * def get_coco(dataDir, dataType): annFile = '{}/annotations/instances_{}2017.json'.format(dataDir, dataType) # initialize the COCO api for instance annotations c...
Abhishek-TyRnT/Instance_Segmentation
generate_masks.py
generate_masks.py
py
2,239
python
en
code
0
github-code
90
25682503053
"""Test computation of emodulus""" import pathlib import tempfile from PyQt5 import QtCore, QtWidgets import dclab import h5py import numpy as np from shapeout2.gui.main import ShapeOut2 from shapeout2 import session import pytest datapath = pathlib.Path(__file__).parent / "data" def make_dataset(medium="CellCarri...
ZELLMECHANIK-DRESDEN/ShapeOut2
tests/test_gui_emodulus.py
test_gui_emodulus.py
py
10,327
python
en
code
7
github-code
90
2868806815
import json from base64 import b64decode, b64encode from dataclasses import asdict, dataclass from datetime import datetime, timedelta, timezone from socket import socketpair @dataclass class User: id: str login: str created: datetime icon: bytes = b'' def to_json(self): return json.dumps...
tebeka/talks
pyconil-2022/code/users.py
users.py
py
2,103
python
en
code
47
github-code
90
18231601259
N, K = map(int, input().split()) ans = 0 mod = 10 ** 9 + 7 for k in range(K, N + 2): max_range = int(k * (2 * N - k + 1) / 2) min_range = int((k-1) * k / 2) tmp = (max_range - min_range + 1) % mod ans += tmp ans %= mod print(ans)
Aasthaengg/IBMdataset
Python_codes/p02708/s471807939.py
s471807939.py
py
251
python
en
code
0
github-code
90
2675522090
inp = input("请输入文件名:") infile=open(inp,'r') inp = inp[:-1] + "txt" outfile=open(inp,"w",encoding='utf-8') tableName='' output='' flag=True for line in infile.readlines(): if flag and line[:6]=='struct': tableName = line[8:] output += tableName if tableName[3]=='P': ...
ThehopeofZC/earthquake_code_generation
readH.py
readH.py
py
1,094
python
en
code
0
github-code
90
26857979256
from __future__ import absolute_import, print_function, annotations import fnmatch import importlib import inspect import pydoc import re import typing from functools import lru_cache, total_ordering from types import ModuleType from typing import ( Any, List, Optional, Hashable, Mapping, Tuple...
LumaPictures/cg-stubs
pyside/stubgen_pyside.py
stubgen_pyside.py
py
24,524
python
en
code
93
github-code
90
20370780560
import requests import datetime, dateutil import sys, os import json import time def sync_query_history(dbx_token, workspace_url, warehouse_ids, start_ts_ms, query_sink_fn, sink_batch_size, end_ts_ms=None, user_ids=None, statuses=None, stop_fetch_limi...
AbePabbathi/lakehouse-tacklebox
40-observability/dbsql-query-history-sync/src/dbsql_query_history_sync/queries_api.py
queries_api.py
py
3,813
python
en
code
21
github-code
90
29431238564
data = input('Текст кричалки:') userSet ={"ё","у","е","э","о","а","ы","я","и","ю"} def glas(x): res = list() for i in x: sum = 0 for j in i: j = j.lower() if j in userSet: sum = sum + 1 res.append(sum) return res if len(set(glas(data.split('...
AntonBuzynnikov/hw19_05_23_python
Example34/Example.py
Example.py
py
433
python
en
code
0
github-code
90
5030539154
#!/usr/bin/python import sys, os cmd_start = 'vnc4server -depth 24 -geometry %s :51' cmd_stop = 'vncserver -kill :51' cmd = '' n = len(sys.argv) if n == 2: if sys.argv[2] == 'startbig': cmd = cmd_start % ('1920x1080',) elif sys.argv[2] == 'startsmall': cmd = cmd_start % ('1080x608',) elif ...
pengsun/CatVSDog
myvnc.py
myvnc.py
py
411
python
en
code
0
github-code
90
37413655007
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 14 11:22:43 2018 @author: raviteja """ import re import os import config import glob import libRSE import sys from time import sleep import time import pexpect def rsu_upgrade(device, img_path, sys_dtils=None): os.chdir(img_path) imgs = gl...
sirajece2010/safe
libs/sysupgrade.py
sysupgrade.py
py
3,314
python
en
code
1
github-code
90
33722533763
# ------------------------------------------------------- # Cifrado RSA # ------------------------------------------------------- # Andy castillo # Marco Fuentes # Jose Block # Gian Luca Rivera # Francisco Rosal # ------------------------------------------------------- import random import base64 def menu(): prin...
UVG-Teams/uvg-cifrado
lab6-public-key-encryption/rsa_implementation.py
rsa_implementation.py
py
5,957
python
es
code
0
github-code
90
43960808351
class Solution: def restoreString(self, s: str, indices: List[int]) -> str: output = ['']*len(s) # Initialize an empty string of same length as 's' for i in range(len(s)): # Iterate over the string 's' output[indices[i]] = s[i] # Assign the character...
innomatics-research-labs/Problem-Solving-with-Data-Structures-and-Algorithms-with-Python
Python Solutions/D13P1_LeetCode_1528.py
D13P1_LeetCode_1528.py
py
450
python
en
code
3
github-code
90
32670926691
import os import signal from typing import Tuple import cv2 import numpy as np from multiprocessing import Queue from .pyfakewebcam import FakeWebcam from .types import CommandQueueDict from .bodypix_functions import BodypixScaler, to_mask_tensor FHD = (1080, 1920) HD = (720, 1280) NTSC = (480, 720) cvNet = cv2.dn...
diddlesnaps/fakecam
src/fakecam/capture.py
capture.py
py
6,501
python
en
code
44
github-code
90
35430307171
from typing import Optional, List, Tuple, Dict import os import sys import random import threading import logging import shutil import boto3 import botocore from botocore.exceptions import ClientError from pepper.utils import create_if_not_exist def sample_images_v1(source_dir: str, target_dir: str, n_samples: int...
Franck-PepperLabs/pepper_cloud_based_model
modules/fruits/storage_utils.py
storage_utils.py
py
23,604
python
en
code
0
github-code
90
16288014230
#V10 class Solution: def removedupString(self,s): # nlogn #s = sorted(s) if the input is disordered slist = [i for i in s] idx_n = 0 for i in range(len(slist)): if i == len(slist)-1 or slist[i+1] != slist[i]: slist[idx_n] = slist[i] ...
vivicheerup/Algorithm
Stringcompression.py
Stringcompression.py
py
1,758
python
en
code
0
github-code
90
43454577163
from tkinter import * from tkinter import messagebox from PIL import ImageTk, Image # Tk sınıfını 'window'a atadık. window = Tk() # Pencere Başlığı window.title("DOCTOR GUI") # Pencerenin yeniden boyutlandırılmasını engelledik window.geometry('1000x500') resim = ImageTk.PhotoImage(Image.open("D...
unsatisfieddeveloper/doctor-gui-without-sql
login-doc.py
login-doc.py
py
1,208
python
en
code
0
github-code
90
18538002864
def hourglassSum(arr): ''' Calculates all hourglass sums and return the largest. input: an array arr[i][j] constraints: 0<= i, j <= 5 -9 <= arr[i][j] <= 9 output: print the largest hourglass sum. ''' i_max, j_max = len(arr), len(arr[0]) max_sum = None ...
ophd/HackerRankProblems
Interview Prep Kit/Arrays/2D Array - DS.py
2D Array - DS.py
py
1,131
python
en
code
0
github-code
90
18493039669
def mi(): return map(int, input().split()) def main(): S = input() T = input() ds = {} dt = {} for i in range(len(S)): if not S[i] in ds: ds[S[i]] = 0 if not T[i] in dt: dt[T[i]] = 0 ds[S[i]] += 1 dt[T[i]] += 1 ls = sorted(list(ds.val...
Aasthaengg/IBMdataset
Python_codes/p03252/s346779299.py
s346779299.py
py
446
python
en
code
0
github-code
90
19115266262
import pandas as pd import sys import json def process_file(file_path, file_type): # Dictionary to store different pandas read functions based on file type read_functions = { 'csv': pd.read_csv, 'json': pd.read_json, 'xml': pd.read_xml, 'excel': pd.read_excel, # Add more...
nikunjs21/adonis-js-api-boilerplate
process_file.py
process_file.py
py
1,190
python
en
code
0
github-code
90
495489681
import json import requests import xlwt # https://api.smb.museum/search/?q=Rembrandt+Harmensz+van+Rijn+&lang=de&limit=15&offset=0 url = 'https://api.smb.museum/search/?q=Adolph+Menzel&lang=de&limit=15&offset=' book = xlwt.Workbook(encoding='utf-8', style_compression=0) sheet = book.add_sheet('馆藏信息', cell_overwrite_ok...
xglds99/pythonSpider
spider/de.py
de.py
py
4,673
python
en
code
0
github-code
90
4951977706
# 왕실의 나이트 # # 내 풀이 (정말 돌아가게만 짠 코드) # s = input() # # 갈 수 있는 좌표를 리스트에 튜플 형식으로 저장하기(힌트 받음) # steps = [(-2, -1), (-2, 1), (2, -1), (2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2)] # count = 0 # s[0] = ord(s[0]) # s[1] = int(s[1]) # for step in steps: # s[0] += step[0] # s[1] += step[1] # if s[0] < ord("a") or s[0...
jsj0718/til-study-legacy
Algorithm/CodingTest/Implementation/knight.py
knight.py
py
1,564
python
ko
code
0
github-code
90
42356199056
SYMBOLS = { "R0": "0", "R1": "1", "R2": "2", "R3": "3", "R4": "4", "R5": "5", "R6": "6", "R7": "7", "R8": "8", "R9": "9", "R10": "10", "R11": "11", "R12": "12", "R13": "13", "R14": "14", "R15": "15", "SP": "0", "LCL": "1", "ARG": "2", "THIS...
dd-dreams/nand2tetris
projects/06/scripts/symboltable.py
symboltable.py
py
954
python
en
code
4
github-code
90
6229318827
# balanced Binary Tree (leetcode 110) # given a binary tree, determine if it's height-balanced # a binary tree in which the left and the right subtrees of # every node differ in height by no more than one # a brute-force solution could be to find # the heights of the two brances and compare them. class TreeNode: ...
kseniiako/dsa
BalancedBinTree.py
BalancedBinTree.py
py
3,840
python
en
code
1
github-code
90
17594827150
from optparse import make_option from contrib.commands import BaseCommand from oracle.models import CardSet class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('-s', '--sort', dest='sort', default='name', help='Sorting method: name, acronym, release ' ...
satyrius/mtgforge
backend/oracle/management/commands/list_sets.py
list_sets.py
py
713
python
en
code
0
github-code
90
18856813664
import pyglet from game import texturePacks from game import textures from game import units class Animation(): def __init__(self): self.time = [] self.texturePack = None self.index = 0 self.indexCount = 0 self.sprite = None def animate(self, sprite, texturePack, n...
lucasmence/gameengine-python
models.py
models.py
py
3,248
python
en
code
0
github-code
90
39169818660
import time; print(time.localtime(time.time())) #Formatted time print(time.asctime(time.localtime(time.time()))) #We can use time.sleep(#no of seconds) to delay the execution time.sleep(10) import datetime; #returns the current datetime object print(datetime.datetime.now()) import calendar cal = calendar.month(20...
swaroop9ai9/problemsolving
basic_time.py
basic_time.py
py
359
python
en
code
1
github-code
90
4563536253
#Exercicio nome =str (input('Digite seu Nome:')) idade=int (input('Digite sua idade:')) peso =float (input('Digite seu peso:')) altura =float (input('Digite sua altura :')) ano= 2022 imc= peso / ( altura **2 ) data_nasc = ano - idade print(f'{nome} sua idade é {idade} , nascido no ano de {data_nasc}, com altura {a...
caiozenke/curso_python_udemy
Modulo1/aula8/aula8.py
aula8.py
py
369
python
pt
code
2
github-code
90
18406244129
import sys from collections import deque input = sys.stdin.readline def main(): N = int(input()) G = [[] for _ in range(N)] for i in range(N - 1): u, v, w = map(int, input().split()) u -= 1 v -= 1 G[u].append((v, w)) G[v].append((u, w)) ans = [-1] * N ans[...
Aasthaengg/IBMdataset
Python_codes/p03044/s821838482.py
s821838482.py
py
703
python
en
code
0
github-code
90
1989623358
# -*- coding: utf-8 -*- """ Created on Fri Feb 26 16:58:49 2021 @author: chernir """ #from PIL import Image, ImageDraw import numpy as np from matplotlib import pyplot as plt from matplotlib.widgets import RectangleSelector MAX_ITER = 555 def mandelbrot(c): z = 0 n = 0 while abs(z) <= 2 and...
yxrmz/MandelbrotMPL
mandelbrot.py
mandelbrot.py
py
2,200
python
en
code
0
github-code
90
21522313075
import re, subprocess def tracertIP(ip): p = subprocess.Popen(['tracert', ip], stdout=subprocess.PIPE) while True: line = p.stdout.readline() if not line: break print(line) if __name__ == '__main__': tracertIP('192.168.2.1')
MisterZhouZhou/pythonThreeSpider
useable/tracertip.py
tracertip.py
py
274
python
en
code
2
github-code
90
607641088
from typing import Tuple import torch from allennlp.common import Registrable from torch.nn import Module, Linear, Softmax class Attention(Module, Registrable): def __init__(self, hidden_size: int, bidirectional: bool) -> None: super().__init__() if bidirectional: self.num_directions ...
blodstone/Salience_Sum
pointer_generator_salience/module/attention.py
attention.py
py
3,628
python
en
code
2
github-code
90
17152112176
class ArrayStack: def __init__(self): self.data = [] def size(self): return len(self.data) def is_empty(self): if len(self.data)==0: return True else: return False def push(self, getdt): self.data.append(getdt) return ...
BallThanapat/DataStructures
lab3333.py
lab3333.py
py
897
python
en
code
0
github-code
90
70805207657
# 37. Write a Python program to multiply all the items in a dictionary. # def mul_(dic1): # mul=1 # for i in dic1: # mul=mul*dic1[i] # return dic1 # print("The multiplication is:",mul_({'a':6,'p':7,'p':8,'l':9,'e':3})) my_dict = {'d1':10,'d2':5,'d3':4} res=1 for i in my_dict: res=res * my_di...
bhatkrishna/assignment
assignment/problem37.py
problem37.py
py
337
python
en
code
0
github-code
90
37388500817
firstname="Zahra" lastname="Isiaho" age="Eighteen" gender="Girl" x=5 #int y=6 #int print("My name is "+firstname+" "+lastname) print("My age is "+age) print("I am a "+gender) print(x,y)
zahraisiaho/Python
strings.py
strings.py
py
186
python
en
code
0
github-code
90
27446163901
import os from django.shortcuts import render_to_response, get_object_or_404 from django.conf import settings from django.contrib.auth.decorators import login_required import models import sip_task @login_required def restart_dashboard(request): st = sip_task.SipTask() code,stdout,stderr = st.cmd_execute_...
europeana/tools
sip_manager/sip_manager/apps/sipmanager/views.py
views.py
py
1,819
python
en
code
2
github-code
90
23409789309
import logging import json from django.core.mail import send_mail from django.shortcuts import render from django.http import HttpResponse from .models import Answer from django.http import JsonResponse logger = logging.getLogger('django') def index(request): return render(request, 'index.html') def test(request...
AnaVasquezA/nave-ds-acceptance-model
zavic/views.py
views.py
py
2,687
python
en
code
0
github-code
90
15729642868
# Задача: Вывести уникальные символы в строке. String = "Мама мыла раму и ела борщь" X = set(String) MS = {} for Y in X: C = String.count(Y) MS[Y] = C print(MS) for X in MS: if MS[X] == 1: print("Symbol "+ X + " is unique")
uaboss/learn_python
lesson_11.py
lesson_11.py
py
307
python
ru
code
0
github-code
90
26054990049
# %% load modules import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns pd.set_option( "display.max_rows", 8, "display.max_columns", None, "display.width", None, "display.expand_frame_repr", True, "display.max_colwidth", None, ) np.set_pr...
pb6191/isIsThisCredibleCredible
src/analyze.py
analyze.py
py
1,485
python
en
code
0
github-code
90
46421156
# ask questions and print out response. import sqlite3 as lite import sys import datetime def class_name_lookup(id): cur = con.cursor() cur.execute( "SELECT class_id, class_name FROM Classes where class_id={0}".format(id)) row = cur.fetchone() return row[1] def get_players_from_mythic(dungeo...
JasonAMartin/wow-mythic-fetch
report.py
report.py
py
5,993
python
en
code
0
github-code
90
18965500512
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="firsttest", version="0.0.3", author="dalongrong", author_email="1141591465@qq.com", description="firsttest package", long_description=long_description, install_requires=['hashids'], ...
rongfengliang/pytest-tox-demo
setup.py
setup.py
py
581
python
en
code
0
github-code
90
10678051517
#!/usr/bin/env python3 from os import execl from time import sleep # libraries for commented functions #from time import sleep, time #from datetime import datetime, timedelta #from psutil import cpu_percent, virtual_memory from telegram.ext import CommandHandler, MessageHandler, Filters from share.data import owner f...
nejni-marji/Nenmaj_Bot_v3
modules/creator.py
creator.py
py
2,410
python
en
code
0
github-code
90
72767268456
import tensorflow as tf NUM_EPOCHS = 100 # Input --> Placeholder X = tf.placeholder(tf.float32, [None, 3]) Y = tf.placeholder(tf.float32, [None, 1]) # Paramters --> Variables, create tf.Variables(s) W = tf.get_variable("weights", [3, 1], initializer=tf.random_normal_initializer()) b = tf.get_variable("intercept", [1...
tsonglew/Daily-Ex
TensorFlowEx/tensorflow-DL-demo/tf-HousingPrice.py
tf-HousingPrice.py
py
954
python
en
code
8
github-code
90
3382263258
from os import listdir import py_wick PATH = "D:\\Games\\Fortnite\\FortniteGame\\Content\\Paks" AES = "F941D9809A67D9BD104273E3C649F4395B6B6A874D16515F404B50D6A9FFA5A4" query = input("Query: ") for FileName in filter(lambda i: i.endswith(".ucas"), listdir(PATH)): FileName = FileName.replace(".ucas", "") Path...
Kyiro/py-wick
examples/test.py
test.py
py
897
python
en
code
1
github-code
90
18368971489
#coding: utf-8 N = int(input()) A = [0] + list(map(int, input().split())) B = [0 for _ in range(N+1)] ans = [] for i in range(N, 0, -1): v = 0 j = i while j <= N: v += B[j] j += i if A[i] != v % 2: ans.append(i) B[i] = 1 ans.sort() print(len(ans)) if len(ans) != 0: p...
Aasthaengg/IBMdataset
Python_codes/p02972/s607571365.py
s607571365.py
py
330
python
en
code
0
github-code
90
13549677695
from turtle import Turtle class Scoreboard(Turtle): def __init__(self): super().__init__() self.color("white") self.penup() self.hideturtle() self.l_score = 0 self.r_score = 0 self.display_score() def increase_score(self, player): if player == "...
clerisyutsav47/Pong-Game
scoreboard.py
scoreboard.py
py
697
python
en
code
3
github-code
90
36248971008
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button from constraint_penalties.relaxed_barrier_penalty import RelaxedBarrierPenalty # The parametrized function to be plotted def function(t, amplitude, frequency): return amplitude * np.sin(2 * np.pi * frequency * t) t ...
manumerous/soft_constraint_param_selector
main.py
main.py
py
1,914
python
en
code
0
github-code
90
40581579236
""" 119. Pascal's Triangle II Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note that the row index starts from 0. In Pascal's triangle, each number is the sum of the two numbers directly above it. Example: Input: 3 Output: [1,3,3,1] Follow up: Could you optimize y...
venkatsvpr/Problems_Solved
LC_Pascals_Triangle2.py
LC_Pascals_Triangle2.py
py
1,420
python
en
code
3
github-code
90
8922318179
import tkinter as Tk import tkinter.ttk as ttk from pubsub import pub try: from Frames.Plot2D_Frame import * except: from Plot2D_Frame import * """ Logger GUI Frame """ #TODO : Graph should ask logger for selected var class Logger_Frame(ttk.LabelFrame): def __init__(self,parent,model,**kwargs): ...
DanFaudemer/TFC
Python/GUI remi Vus/Frames/Logger_Frame.py
Logger_Frame.py
py
8,792
python
en
code
2
github-code
90
34945456266
class Solution: def removeDuplicates(self, nums: List[int]) -> int: right=1 left=0 nums.sort() while right<len(nums): if nums[left]==nums[right]: nums.remove(nums[right]) else: left+=1 right+=1
redietamare/competitive-programming
0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.py
0026-remove-duplicates-from-sorted-array.py
py
310
python
en
code
0
github-code
90
18277594879
#!/usr/bin/env python3 def main(): N, K = map(int, input().split()) H = sorted([int(x) for x in input().split()]) if K == 0: print(sum(H)) elif N > K: print(sum(H[:-K])) else: print(0) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02785/s400645056.py
s400645056.py
py
270
python
en
code
0
github-code
90
12935744308
import os import sys import click import importlib from scrapy.crawler import CrawlerProcess from loguru import logger from pathlib import Path from edscrapers.scrapers.base import config as scrape_config from edscrapers.scrapers.base import helpers as scrape_base from edscrapers.scrapers.base import helpers as scrap...
CivicActions/edscrapers
edscrapers/cli.py
cli.py
py
6,991
python
en
code
11
github-code
90
7927873521
import wx import wx.lib.sized_controls as sc # dummy I18N wrapper _ = lambda x: x # TODO: remove this ugly direct copy ASAP!!! # this issue is not as serious as a FIXME so downgraded it LOGINTYPE_CERTNO = 'cert_no' LOGINTYPE_BARNO = 'bar_no' LOGINTYPE_EMAIL = 'email' class UserInfoDialog(sc.SizedDialog): def __i...
xen0n/gingerprawn
gingerprawn/shrimp/librarian/librarian_userinfo_dlg.py
librarian_userinfo_dlg.py
py
3,567
python
en
code
1
github-code
90
43509181473
from __future__ import print_function from optparse import OptionParser import time, sys import numpy as np import matplotlib.pyplot as plt import pylab as pl import math import os from convertFiles import parseFileNames, textToArray ############################# ## SINGLE OFFSET HISTOGRAM ## ########################...
UCDFPGALab/muon_telescope
histogram.py
histogram.py
py
2,474
python
en
code
1
github-code
90
12672589829
from time import sleep from selenium import webdriver #instead of this >> driver = webdriver.Chrome('/Applications/chromedriver') options = webdriver.ChromeOptions() options.add_argument("start-maximized") options.add_argument("lang=ko_KR") options.add_argument('headless') options.add_argument('window-size=1920x1080')...
ksouth0413/autofill
python_autofill.py
python_autofill.py
py
1,275
python
en
code
0
github-code
90
18336938969
from collections import Counter def prime_factorize(n): f = 2 primes = [] while f * f <= n: if n % f != 0: f += 1 continue primes.append(f) n //= f if n > 1: primes.append(n) return list(set(primes)) a, b = map(int, input().split()) ab_primes =...
Aasthaengg/IBMdataset
Python_codes/p02900/s904123155.py
s904123155.py
py
460
python
en
code
0
github-code
90
12859969769
""" A robot that can exert force in cardinal directions. The robot's goal is to reach the origin and it experiences zero-mean Gaussian Noise. State representation is (x, y, z). Action representation is (dx, dy, dz). """ import os import pickle import os.path as osp import numpy as np import matplotlib.pyplot as plt f...
yh2371/Navigation-Recovery-RL
env/navigation3.py
navigation3.py
py
9,933
python
en
code
0
github-code
90
10771921909
# -*- coding: utf-8 -*- """ Created on Tue Sep 1 21:11:52 2020 @author: Amanda """ import itertools, copy from csp import * def arc_consistent(csp): """Takes a CSP object and returns a new CSP object that is arc consistent (and also consequently domain consistent). """ csp = copy.deepcopy(csp)...
amanda-pullan/COSC367-Artificial-Intelligence
Labs/6 Constraint satisfaction problems/arc_consistent.py
arc_consistent.py
py
1,747
python
en
code
0
github-code
90
70128093736
import cartopy.io.shapereader as shpreader import cartopy.crs as ccrs from scipy.ndimage.filters import maximum_filter, minimum_filter import numpy as np def drawcnmap(ax): #画带中国省界的地图 shpname1 = './shpfiles/bou2_4p.shp' sr1 = shpreader.Reader(shpname1) proshp1 = list(sr1.geometries()) shpname2 = './shpfiles/con...
lecay/EC-micpas-chart
mapfunc.py
mapfunc.py
py
1,774
python
en
code
1
github-code
90
15237658002
from django.urls import path from . import views from apps.comentarios import views as views_c app_name = "productos" urladmin = [ path("Admin/Listar/", views.ListarAdmin.as_view(), name="admin_listar"), path("Admin/Nuevo/", views.Crear.as_view(), name="admin_nuevo"), path("Admin/Editar/<int:pk>/", views....
carrizojuan/CarriSneakers
src/apps/productos/urls.py
urls.py
py
994
python
en
code
0
github-code
90
18236744539
Big=10**9+7 _=list(map(int,input().split(" "))) N=_[0] K=_[1] gcd_list=[0 for _ in range(K)] for i in range(K): s=K-i-1 gcd_list[s]=(pow(K//(K-i), N, Big)-(sum(gcd_list[2*s+1::s+1]))%Big)%Big answer=[(x+1)*gcd_list[x]%Big for x in range(K)] print(sum(answer)%Big)
Aasthaengg/IBMdataset
Python_codes/p02715/s767730450.py
s767730450.py
py
267
python
en
code
0
github-code
90
15553076795
#!/usr/bin/env python3 import argparse import os import shutil import subprocess import sys import tempfile def sh(script): subprocess.check_call(['bash', '-c', 'set -ex\n' + script]) def cd(path): os.chdir(path) def build(): sh('cargo build --release --bin come_boy') def save_state(): pass def pe...
bobbobbio/come_boy
perf/perf_and_flamegraph.py
perf_and_flamegraph.py
py
2,813
python
en
code
3
github-code
90
28388048651
from bank import BankAccount class Transaction: def __init__(self, from_account: BankAccount, to_account: BankAccount, amount: float): self.__to_account = to_account self.__from_account = from_account self.amount = amount if amount <= from_account.balance: to_account.de...
nicholasjamesbaker/Nick-CP1895
Assignment 2/classtransaction.py
classtransaction.py
py
440
python
en
code
0
github-code
90
18423013507
from django.urls import path from app_ecommerce_store.views import * app_name = 'app_ecommerce_store' urlpatterns = [ # Login page path('login/', LogInView.as_view(), name="login"), # Logout page path('logout/', LogOutView.as_view(), name="logout"), # Register page path('register/', registe...
Bogdan1Yaroslav/Ecommerce_store
ecommerce_store/app_ecommerce_store/urls.py
urls.py
py
1,050
python
en
code
0
github-code
90
21942827320
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Ip', fields=[ ('id', models.Aut...
KiteCoder/portscanner
scanner/migrations/0001_initial.py
0001_initial.py
py
1,531
python
en
code
0
github-code
90
9632806358
import logging from Abpair import Abpair import numpy as np logger = logging.getLogger(__name__) ch = logging.StreamHandler() formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch) def mnabuilder(componentList): for comp in componentLis...
taoyilee/pysim
pysim/mnabuilder.py
mnabuilder.py
py
453
python
en
code
0
github-code
90
34888312442
from scraperx import Scraper, run_cli, Dispatch, Extract class MyDispatch(Dispatch): def submit_tasks(self): return {'url': 'https://www.imdb.com/chart/top/'} class MyExtract(Extract): def extract(self, raw_source, source_idx): yield self.extract_task( name='products', ...
xtream1101/scraperx
examples/qa_results.py
qa_results.py
py
1,382
python
en
code
53
github-code
90
21956758911
#!/usr/local/bin/python # This is a macro for creating time files for the REAS runs import csv, os, sys from os import path import numpy as np filename = sys.argv[1]; outputfilename = sys.argv[2]; newfilename = filename.split('/') fileuse = newfilename[-1] fileinterest = fileuse.split('-') datafile = np.genfromtxt(...
NBCLab/PhysicsLearning
learning/fmri-processing-scripts/subject-level-scripts/ti/make-REAS.py
make-REAS.py
py
1,684
python
en
code
4
github-code
90
11028754883
""" Add TeamSync table. Revision ID: be8d1c402ce0 Revises: a6c463dfb9fe Create Date: 2017-02-23 13:34:52.356812 """ # revision identifiers, used by Alembic. revision = "be8d1c402ce0" down_revision = "a6c463dfb9fe" import sqlalchemy as sa from util.migrate import UTF8LongText def upgrade(op, tables, tester): #...
quay/quay
data/migrations/versions/be8d1c402ce0_add_teamsync_table.py
be8d1c402ce0_add_teamsync_table.py
py
2,024
python
en
code
2,281
github-code
90
72952291818
import numpy as np import matplotlib.pyplot as plt numpy_str = np.linspace(0,10,20) #random 20 tane float sayı oluştur 0 dan 10 a kadar print(numpy_str) numpy_str1 = numpy_str ** 3 #2 tane grafiği yan yana gösterme plt.subplot(1,2,1) #1 sıra olucak 2 kolon olucak 1. grafik plt.plot(numpy_str,numpy_str1,"g*-"...
berkayberatsonmez/Matplotlib
Matplotlib/subplot.py
subplot.py
py
474
python
tr
code
0
github-code
90
18490866149
n = int(input()) V = list(map(int, input().split())) from collections import Counter even = Counter(V[0::2]) even["0"]=0 even = sorted(even.items(), key=lambda x:x[1], reverse=True) odd = Counter(V[1::2]) odd["-1"]=0 odd = sorted(odd.items(), key=lambda x:x[1], reverse=True) i=0 even_top2, odd_top2 = [], [] for (e, o) ...
Aasthaengg/IBMdataset
Python_codes/p03244/s650918051.py
s650918051.py
py
601
python
en
code
0
github-code
90
20128193751
from decimal import Decimal from open_exchange_rates import OpenExchangeRates import click import logging import os from datetime import datetime, timedelta import django import json # Configure Django for using models outside app. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stock_exchange_django.settings") djang...
marco-calderon/stock_exchange_django
scrap.py
scrap.py
py
5,853
python
en
code
0
github-code
90
40886119436
import datetime import os.path import tempfile from shutil import which from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import QSize from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import QWidget from PyQt5.uic import loadUi from networkx import MultiGraph, draw_networkx_labels, draw_networkx_nodes, kamada_...
BioComputingUP/ring-pymol
main_window.py
main_window.py
py
46,046
python
en
code
15
github-code
90
18483667709
N = int(input()) A = [int(input()) for _ in range(N)] A.sort() answer = 0 if N%2 == 0: lower = A[:N//2] upper = A[N//2:] x = 2 * sum(upper) - upper[0] y = 2 * sum(lower) - lower[-1] answer = x - y else: mid = A[N//2] lower = A[:N//2] upper = A[N//2 + 1:] r1 = 2 * sum(upper) - mid - (...
Aasthaengg/IBMdataset
Python_codes/p03229/s713265565.py
s713265565.py
py
449
python
en
code
0
github-code
90