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
16483457321
from flask import Blueprint, g from flask_graphql import GraphQLView from flask_cors import CORS from .schema import schema api = Blueprint('api', __name__) CORS(api, supports_credentials=True) # Enables CORS with cross origin cookies class CustomGraphQlView(GraphQLView): def dispatch_request(self): resp...
AlexEshoo/poll_app_graphql
poll_app_graphql/api/__init__.py
__init__.py
py
672
python
en
code
0
github-code
36
15000533019
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Jan 12 15:36:15 2018 @author: chrelli added unix time stamps to the first camera! Ways to slim down the data: no unix time stamps? no color frame showing? - yes, helps a lot! no png compression? Totally fine at 30 fps! Majow to do list: ...
chrelli/3DDD_social_mouse_tracker
recording/record_calib_npy.py
record_calib_npy.py
py
15,418
python
en
code
5
github-code
36
10680492541
import time import tensorflow.compat.v1 as tf # tf.disable_eager_execution() tf.config.run_functions_eagerly(True) tf.enable_eager_execution() from utils import * from models import RGCN import random import pandas as pd from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernel...
zzheng18/CSPC680RGCNV
src/train_gpc.py
train_gpc.py
py
4,973
python
en
code
0
github-code
36
15017549955
def cleaning_digor_eng(): with open('Дигорско-английский.txt', 'r', encoding='utf-8') as f: lines = list(map(lambda x: x.rstrip("\n").lower().replace('æ', 'ӕ'), f.readlines())) # bad_letters = 'eyopakxc' # good_letters = 'еуоракхс' # for i in range(len(bad_letters)): # lines = [i.replace...
Lana-Dzuceva/translation_script
cleaning and union dictionaries.py
cleaning and union dictionaries.py
py
21,163
python
en
code
0
github-code
36
3585781734
from __future__ import absolute_import, division, print_function # Local Imports from modeling import ArgStrModel from arguments import TrainingArguments from training import ArgStrTrainer from processors import get_datasets from utils import Data_Collator, set_seed # Standard Imports import os import random # Third...
The-obsrvr/ArgStrength
Hyper-parameter-optimization/src/retraining.py
retraining.py
py
6,077
python
en
code
0
github-code
36
26236313252
import csv import json # Save .csv file from dict List [{}] def save_file(results, filename, format): if(format=='csv'): if(len(results) > 0): with open(f'{filename}.csv', 'w', encoding='utf8', newline='') as output_file: output_file.write('sep=,\n') ...
cristianmacedo/crawliexpress
crawliexpress/lib/helpers.py
helpers.py
py
648
python
en
code
8
github-code
36
30332494769
import streamlit as st import pandas as pd import numpy as np import re import emoji import io from collections import Counter import datetime import plotly.express as px from numpy import random from multiprocessing.dummy import Pool as ThreadPool from wordcloud import WordCloud, STOPWORDS from vaderSentiment.vaderSen...
RawRapter/Chat-Analytics-Dashboard
chat_analyze.py
chat_analyze.py
py
11,100
python
en
code
0
github-code
36
6830029168
import sys sol_list = {} #to reduce the recursive computation #really nice trick def sol(num): if num <= 11: return num if num in sol_list.keys(): return sol_list[num] else: sol_list[num] = sol(int(num/2)) + sol(int(num/3)) + sol(int(num/4)) return sol_list[num] try: while True: i = int(input()) ...
thirstycode/competitive-programming
Problems/Bytelandian gold coins/sol.py
sol.py
py
361
python
en
code
1
github-code
36
21025379752
from models.video_model import VideoModel class PublicationModel: def __init__(self, publication_url: str, publication_id: str, author_unique_id: str, desc: str, like_count: int, comment_count: int,view_count: int, share_count: int, category: int, created_at: int, hashtags: list[...
MAG135/robot
models/publication_model.py
publication_model.py
py
1,303
python
en
code
0
github-code
36
75034732264
import logging from handlers.detectors import detect_is_admin from keyboards.default.start import start_admin from keyboards.inline.admin.success_payment import withdraw_money_balance from loader import dp, bot, db from data.config import ADMINS from keyboards.default.back import back from states.balance import Balan...
uzbsobirov/Money-grow-bot
handlers/users/balance/withdraw_money.py
withdraw_money.py
py
6,079
python
en
code
0
github-code
36
24856816686
def contact_name(name, family_name, symbol): result = name + symbol + family_name print(result) name = input() last_name = input() bond = input() contact_name(name, last_name, bond) # Second version fist_name = input() last_name = input() delimiter = input() print(f'{fist_name}{delimi...
BorisAtias/SoftUni-Python-Fundamentals-course
Data Types and Variables - Lab/01. Concat Names.py
01. Concat Names.py
py
337
python
en
code
0
github-code
36
7165663160
def smallestRangeI(nums: list[int], k: int) -> int: max_nums = max(nums) - k min_nums = min(nums) + k result = max_nums - min_nums return result if result >= 0 else 0 nums = [1, 3, 6] # nums = [10, 0] # nums = [1] k = 3 # k = 2 # k = 0 print(smallestRangeI(nums, k))
SafonovVladimir/mornings
05 may/04.py
04.py
py
288
python
en
code
0
github-code
36
37037529431
# File: CheckTags.py """ This program checks that tags are properly matched in an HTML file. This version of the program runs in Python; the checktags version runs directly from the command line. """ import html.parser import urllib.request import urllib.error def CheckTags(): """Reads a URL from the user and th...
katthomp/networks
checktags.py
checktags.py
py
3,070
python
en
code
0
github-code
36
11952114818
from datetime import datetime import backtrader as bt import tushare as ts import pandas as pd class MyStrategy1(bt.Strategy): params = (('maperiod', 20), ('printlog', False),) def __init__(self): # 指定价格序列 self.dataclose = self.datas[0].close # 初始化交易指令、买卖价格和...
Cui-Yusong/NUS_proj
backtest_sma.py
backtest_sma.py
py
8,940
python
en
code
1
github-code
36
15506027054
# https://medium.com/analytics-vidhya/computer-vision-and-deep-learning-part-2-586b6a0d3220 --- main # https://github.com/Esri/raster-deep-learning/blob/master/docs/writing_deep_learning_python_raster_functions.md import cv2 import numpy as np from matplotlib import pyplot as plt cv_image= cv2.imread("/home/jameshu...
hssaccord/myTEST
main.py
main.py
py
1,348
python
en
code
0
github-code
36
6733918320
def getClickData(clickData): point = CSafePoint(clickData) pointData = point.getPoint() log.print(pointData.get('lat')) log.print(pointData.get('lon')) log.print(pointData.get('customdata')) log.print(pointData.get('pointIndex')) log.print(pointData.get('pointNumber')) log.print(pointDat...
aleksProsk/HydroOpt2.0
user001/scripts/dash/screens/test5/callbacks.py
callbacks.py
py
1,737
python
en
code
0
github-code
36
74147866345
import pygame, humans, sys, menu from random import randint scan_delay = 300 coll_delay = 300 move_delay = 300 menu.valmynd() skra = open("settings/exit.txt", "r") for line in skra: if line == "True": sys.exit() skra.close() settings = (open("settings/settings.txt", "r").read()).split() fps = int(setting...
Zepeacedust/skolasim
main.py
main.py
py
1,408
python
en
code
1
github-code
36
70188062823
#animation ICMECAT rose scatter plot with HI CME circles and in situ data from scipy import stats import scipy.io from matplotlib import cm import sys import os import matplotlib import matplotlib.pyplot as plt import matplotlib.dates as mdates import numpy as np import sunpy.time import time import pickle import sea...
cmoestl/heliocats
scripts/icmecat_anim_circles_insitu_final_full.py
icmecat_anim_circles_insitu_final_full.py
py
23,948
python
en
code
10
github-code
36
31802278489
# /usr/bin/python3.6 # -*- coding:utf-8 -*- class Solution(object): def alphabetBoardPath(self, target): """ :type target: str :rtype: str """ board = ["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"] m = {} for i, row in enumerate(board): for j...
bobcaoge/my-code
python/leetcode/1138_Alphabet_Board_Path.py
1138_Alphabet_Board_Path.py
py
1,230
python
en
code
0
github-code
36
18391614264
import requests from bs4 import BeautifulSoup import wikipedia class unotes: def __init__(self,*args): self.data_list = [a.replace(' ','_')for a in args] self.content = {} self.links = {} def __str__(self): return f"unotes for {self.data_list}" def search(self): co...
UtsabKafle/unotes
src/unotes.py
unotes.py
py
4,021
python
en
code
0
github-code
36
26613636857
import numpy as np import cv2 from imgutil import read_img from scipy.optimize import minimize from mathutil import Rx, Ry, Rz in_size = (1080//2, 1920//2) fov_factor = 1 marks = [ (1, 2, [((925, 1080//2 - 338), (1131 - 1920//2, 1080//2 - 383)), ((946, 1080//2 - 321), (1156 - 1920//2, 1080//2 - 375)),...
42Ar/cube_mapper
marker_calc.py
marker_calc.py
py
2,039
python
en
code
0
github-code
36
15955214108
#! python3 # sendDuesReminders.py - sends emails based on payment status in spreadsheet import smtplib import openpyxl wb = openpyxl.load_workbook('C:\\Users\\daize\\Desktop\\pythontest\\Automate\\duesRecords.xlsx') sheet = wb.get_sheet_by_name('Sheet1') lastCol = sheet.max_column latestMonth = sheet.cell(row=1, col...
sdz0716/myPython
act16-email_message/sendDuesReminders.py
sendDuesReminders.py
py
1,218
python
en
code
0
github-code
36
72718761064
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Created on Fri Mar 10 12:54:45 2023 """ import numpy as np from pyGITR.math_helper import * from typing import Callable import matplotlib.pyplot as plt import pydoc import netCDF4 import os def Gaussian(x: np.ndarray = np.linspace(-15000, 15000, 100000), sigma: float =...
audide12/DIIIDsurface_pyGITR
pyGITR/importance_sampling_1.py
importance_sampling_1.py
py
2,626
python
en
code
1
github-code
36
24490756111
# class rest_get_action_queue(rest_get_table_handler): def __init__(self): desc = [ "List service and node actions posted in the action_queue.", ] examples = [ "# curl -u %(email)s -o- https://%(collector)s/init/rest/api/actions?query=status=R", ] q = q_f...
opensvc/collector
init/models/rest/api_action_queue.py
api_action_queue.py
py
9,175
python
en
code
0
github-code
36
37362500325
import os import sys from pathlib import Path from typing import Optional import tempfile import time import queue import subprocess import threading class IPythonInterpreter: _END_MESSAGE = "__ INTERPRETER END OF EXECUTION __" _INTERPRETER_PROMPT = ">>> " _LAST_VAR = "_INTERPRETER_last_val" def __in...
silvanmelchior/IncognitoPilot
services/services/interpreter/ipython_interpreter.py
ipython_interpreter.py
py
5,216
python
en
code
364
github-code
36
39399879426
from pyspark import SparkConf, SparkContext import random import numpy as np import time def mapper1(line): matrix_name, row, col, num = line.split(",") row, col, num = int(row), int(col), int(num) mapList = [] for idx in range(MATRIX_SIZE): if matrix_name == 'M': key = (row, idx, ...
uuuChen/NTHU-Course-BIGDATA
bigData_hw1/hw1.py
hw1.py
py
2,829
python
en
code
0
github-code
36
74434198503
import json #to impost post.json from blog.models import Post # instance of opening and loading json data with open('post.json') as f: posts_json = json.load(f) # Loop through JSON data for post in posts_json: """ input: title: the title of the json element content: the cotent of the json ...
YusufBritton1990/Django_tutorial_backup
django_project/shell_posting.py
shell_posting.py
py
837
python
en
code
0
github-code
36
1379120770
import os import cv2 import dlib import numpy as np from eye import Eye from calibration import Calibration class EyeTracking(object): """ This class tracks the user's gaze. It provides useful information like the position of the eyes and pupils and allows to know if the eyes are open or closed ""...
dead4s/SpaHeron_MachineLearning_UXIS
eye_tracking/eye_tracking.py
eye_tracking.py
py
9,108
python
en
code
3
github-code
36
8060696161
# Lint as: python3 """CoQA: A Conversational Question Answering Challenge""" # partially taken from https://github.com/NTU-SQUAD/transformers-coqa/blob/2dfd58b70956e935e370989fa421f34bb83bff08/data/processors/coqa.py from __future__ import absolute_import, division, print_function import json import logging import os...
HLTCHKUST/CAiRE_in_DialDoc21
utils/coqa.py
coqa.py
py
9,844
python
en
code
11
github-code
36
1923472018
#!/usr/bin/env python #coding=utf-8 import json from lib.sqs import zhihufav_sqs from lib.tasks import add_note def get_sqs_queue(): sqs_info = zhihufav_sqs.get_messages(10) for sqs in sqs_info: sqs_body = sqs.get_body() receipt_handle = sqs.receipt_handle sqs_json = json.loads(sqs_bo...
youqingkui/zhihufav
do_tasks.py
do_tasks.py
py
553
python
en
code
0
github-code
36
18692006503
import json import logging import sys from z3 import z3 from teether.constraints import check_model_and_resolve from teether.evm.exceptions import IntractablePath from teether.evm.state import LazySubstituteState, SymRead from teether.project import Project from teether.util.z3_extra_util import concrete def set_bala...
t-hermanns/coercer
bin/set_balanceOf.py
set_balanceOf.py
py
4,086
python
en
code
1
github-code
36
24592548396
"""6. Write a program that takes a string as input and returns the string with all vowels removed.""" import tests import time vowels = ['a', 'e', 'o', 'u', 'y', 'i', 'A', 'E', 'O', 'U', 'Y', 'I'] my_str = tests.cases[0] #my_str = input('Enter any string: ') my_str = my_str.strip() def branch(number_of_repeats=10000...
MikitaTsiarentsyeu/Md-PT1-69-23
Tasks/Hatsak/Task3/Task3_6.py
Task3_6.py
py
2,032
python
en
code
0
github-code
36
70062415785
'''input 4 dwight jello 51430 creed beans 263 stanley pretzels 45121 pam brushtool 941 ''' n = int(input()) gifts = {} while n > 0: s = input().split() k = ' '.join(s[:-1]).strip() v = int(s[-1]) gifts[k] = v n-=1 gifts = {k: v for k, v in sorted(gifts.items(), key=lambda item: item[1])} for k, v in gifts.item...
teamcodedevs/beecrowd-christmas-contest-2021
AdrianoAlmeida/g.py
g.py
py
344
python
en
code
0
github-code
36
19250130553
import http import requests import tenacity from bs4 import BeautifulSoup from tenacity import retry_if_exception_type, stop_after_attempt from .exceptions import BadRequest, NetworkError, NotClientError, NotFound, ServerError from .utils import cache @tenacity.retry( reraise=True, retry=retry_if_exception_...
macoyshev/weather_CLI
weather/weather_parser.py
weather_parser.py
py
1,336
python
en
code
0
github-code
36
74246420903
import pandas as pd import glob from openpyxl import load_workbook import os class DataFile: def __init__(self, file_path): self.file_path = file_path @staticmethod def read_csv_file(file_path): """ reads a *.csv file and returns a pandas DataFrame of the file :param fil...
DimaZimin/invoice_status_check
datafile.py
datafile.py
py
2,386
python
en
code
0
github-code
36
28981514805
from django.conf.urls import patterns, url, include from django.contrib import admin admin.autodiscover() urlpatterns = patterns( 'sokoban.views', url(r'^$', 'index', name='index'), url(r'^dashboard/$', 'dashboard', name='dashboard'), url(r'^home/$', 'home', name='home'), url(r'^403/$', 'alert_log...
BusyJay/sokoban
src/sokoban/urls.py
urls.py
py
978
python
en
code
3
github-code
36
11535743077
import os import time requivalente=0.0 fora=True while(fora): os.system("clear") resistores=[0.0,0.0,0.0] requivalente=0.0 print("Cálculo de 3 resistores em Série.") print("Se um dos valores do resistore for 0 o programa será encerrado.") for i in range(0,len(resistores)): print("Dibite...
oidanieldantas/ProjetosComPythonEArduino
pratica1_4.py
pratica1_4.py
py
668
python
pt
code
0
github-code
36
30144105909
import os from playhouse.sqlite_ext import CSqliteExtDatabase from peewee import DatabaseProxy class PDatabaseFactory: def __init__(self, config): self.cfg = config self.instances = {} self.defaut_instance = self.cfg.get('db', 'database') self.sqlite_db_path = self.cfg.get('sqlite...
prise6/medias-trends
mediastrends/database/peewee/PDatabaseFactory.py
PDatabaseFactory.py
py
1,277
python
en
code
2
github-code
36
1165567212
class Solution(object): def findRelativeRanks(self, nums): """ :type nums: List[int] :rtype: List[str] """ # clone num input nums_clone = nums[:] # create a map to store rank res_dict = {} for num in nums: res_dict[num] = '' ...
acharyarajiv/leetcode
easy/python/relative-ranks.py
relative-ranks.py
py
1,368
python
en
code
0
github-code
36
35351359576
# -*- coding: utf-8 -*- # original author: Ethosa # modified by: x2nie import re from retranslator import Translator class CSharpToPython(Translator): def __init__(self, codeString="", extra=[], useRegex=False): """initialize class Keyword Arguments: codeString {str} -- source code on...
x2nie/PyProceduralSokoban
cs2py.py
cs2py.py
py
20,455
python
en
code
0
github-code
36
2962500565
from prettytable import PrettyTable import sympy as sp sp.init_printing(use_unicode=True) def raices_multiples(x0, tolerancia, niter): x = sp.symbols('x') #f = x**4 - 18*x**2+81 f = x**3 - x**2 - x + 1 + sp.sin(x-1)**2 tabla = PrettyTable(['i', 'xn', 'f(xn)', 'df(xn)', 'ddf(xn)', 'ErrorAbs', 'ErrorRel...
jvalen92/Analisis-Numerico
SolucionEcuancionesUnaVariable/raices_multples.py
raices_multples.py
py
1,051
python
en
code
1
github-code
36
27688934832
import sys import pandas as pd import numpy as np from sklearn.preprocessing import RobustScaler from sklearn.tree import DecisionTreeClassifier from evaluate_model import evaluate_model dataset = sys.argv[1] num_param_combinations = int(sys.argv[2]) random_seed = int(sys.argv[3]) np.random.seed(random_seed) pipelin...
rhiever/sklearn-benchmarks
model_code/random_search/DecisionTreeClassifier.py
DecisionTreeClassifier.py
py
1,283
python
en
code
204
github-code
36
37662096318
from PyQt5.QtWidgets import QLineEdit, QToolButton, QWidget, QFileDialog, QDialog, QTreeWidget, QRadioButton, QTreeWidgetItem, QTabWidget, QLabel, QCheckBox, QPushButton, QMessageBox from pulse.utils import error from os.path import basename from PyQt5.QtGui import QIcon from PyQt5.QtGui import QColor, QBrush from PyQt...
atbrandao/OpenPulse_f
pulse/uix/user_input/plotAcousticFrequencyResponseInput.py
plotAcousticFrequencyResponseInput.py
py
13,604
python
en
code
null
github-code
36
24222902053
import pandas as pd import corrAnaModule as cam import numpy as np pd.options.mode.chained_assignment = None def count_ratio_every_col_obj(df_raw:pd.DataFrame): new_col=[] total=df_raw.shape[0] for _ in df_raw.columns: a=pd.value_counts(df_raw[_]) df_=a/total # print(_,max(df_)) ...
samzzyy/RootCauseAnalysisOfProductionLineFailure
RootCauseAna.py
RootCauseAna.py
py
3,482
python
en
code
5
github-code
36
6679921790
#!/usr/bin/env python """ Download the given htmx version and the extensions we're using. """ import argparse import subprocess from typing import List, Optional def main(argv: Optional[List[str]] = None) -> int: parser = argparse.ArgumentParser() parser.add_argument("version", help="e.g. 1.0.1") args = p...
hernantz/django-htmx-demo
download_htmx.py
download_htmx.py
py
1,146
python
en
code
5
github-code
36
33873457342
import tkinter as tk import tkinter.font as font from PIL import Image, ImageTk import QuikSpace as qs import Add_Task_School_Work as atsw import Review_Task_School_Work as rtsw window="" def quikSpace(): global window window.destroy() qs.quikspace() def ADD_Task_School_Work(): global window wind...
math12345678/QuikSpace
School_Work.py
School_Work.py
py
2,133
python
en
code
0
github-code
36
74952188583
# -*- coding: utf-8 -*- """ Created on Sat Jul 24 16:58:30 2021 @author: HP """ def genPrimes(): n=2 primes = [2] yield primes[0] while True: n += 1 for p in primes: if (n%p) == 0: break else: primes.append(n) ...
FHL-08/Python-Projects
Prime Number Generator.py
Prime Number Generator.py
py
339
python
en
code
0
github-code
36
33293843048
import pandas as pd import requests from io import StringIO import plotly.express as px import plotly.graph_objects as go import seaborn as sns import streamlit as st from sklearn.metrics import confusion_matrix from sklearn.model_selection import train_test_split from sklearn.svm import SVC from sklearn....
Tudor1415/mlsandbox
main.py
main.py
py
8,562
python
en
code
0
github-code
36
37272086828
# https://blog.csdn.net/qq_32149483/article/details/112056845 import imgaug as ia from imgaug import augmenters as iaa import numpy as np from typing import Tuple, List class Img_Aug: def __init__(self, prob=0.2, crop=True, blur=True, superpixel=True, space_trans=True, sharpen=True, embo...
SuperbTUM/machine-learning-practice
Text Recognition/data_aug.py
data_aug.py
py
3,722
python
en
code
0
github-code
36
8648504297
from django.shortcuts import render, HttpResponse from .forms import UserForm from sms_alert.models import User def index(request): if request.method == 'POST': name = request.POST.get('name') phone_number = request.POST.get('phone_number') country = request.POST.get('country') ...
prajjwalsinghzz14/Amnesia--Twilio-Notifiactions
Amnesia/sms_alert/views.py
views.py
py
2,300
python
en
code
0
github-code
36
35411324967
from requests import get from webapp.db import db from webapp.question_service.models import Question_answer def get_question_jservice(questions_quantity: int=1) -> dict: """ После получения колличества запрашиваемых вопросов сервис, в свою очередь, запрашивает с публичного API (англоязычные во...
Straigan/webapp_question_service
webapp/services/jservice_service.py
jservice_service.py
py
2,084
python
ru
code
0
github-code
36
10006400064
""" Given a set of non-negative integers, and a value sum, determine if there is a subset of the given set with sum equal to given sum. Examples: set[] = {3, 34, 4, 12, 5, 2}, sum = 9 Output: True //There is a subset (4, 5) with sum 9. """ def subset_sum(numbers, total): if total == 0: return True ...
juanjoneri/Bazaar
Interview/Practice/Dynamic-Programming/subset-sum.py
subset-sum.py
py
771
python
en
code
0
github-code
36
34141163457
from flask_restful import Resource from pymongo import MongoClient from api.starta_flode import MONGODB_CONNECTION from statistics import median class Statistik(Resource): def getFlodeStatistics(self, subjects, flode=None): allData = [r for r in subjects.find(flode and {'flode': flode} or {})] tid...
svanis71/fkhack-back
api/statistik.py
statistik.py
py
1,059
python
en
code
0
github-code
36
43694284198
import glob def browar(name): print("Pracuje nad " + name) plik = open(name, "r") # n - liczba miast do analizy n = int(plik.readline()) dane = plik.read().splitlines() tab = [] flat_tab = [] for element in dane: tab.append(element.split(" ")) for sublist i...
antoniusz22/Script-languages
python1.py
python1.py
py
2,008
python
en
code
0
github-code
36
42775151544
from .models import ( ActionList, Action, ExpectList, Expect, ExportDict, SkipIfList, SkipIf, ) from .validators import validate_boolean, validate_conditionals,validate_export_dict class ArgType: type = lambda value: value # noqa value = None class UsingArgType(ArgType): typ...
rochacbruno/ansible-test
ansible-test/plugins/module_utils/arg_types.py
arg_types.py
py
4,795
python
en
code
2
github-code
36
2941292608
class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: res = [] path = [] nums = range(1, 10) def backtrack(n, k, sp): if sum(path) > n: # cut branch to speed up return if len(path) == k and sum(path) == n: ...
kai0456/algo_prac
216_Combination_Sum_III.py
216_Combination_Sum_III.py
py
594
python
en
code
0
github-code
36
17169367130
# Program make a simple calculator that can add, subtract, multiply and divide using functions # This function adds two numbers def add(x, y): return x + y # This function subtracts two numbers def subtract(x, y): return x - y # This function multiplies two numbers def multiply(x, y): return x * y # This...
erkanredzheb/Simple-Python-Calculator
SimpleCalc.py
SimpleCalc.py
py
1,468
python
en
code
0
github-code
36
42366591652
from email.mime import base from AES_encipher import CTR_Mode from OAEP import * from RSA_key_gen import AES_key_gen from utility import bit_size import base64 from math import ceil class data_msg: """ Class that holds the values used in the data transfer. """ def __init__(self, signature: bytes = None, msg: ...
Cezari0o/Gerador-Assinaturas-RSA
data_msg.py
data_msg.py
py
3,301
python
en
code
0
github-code
36
42936594523
import random from words import words import string def get_valid_word(words): word = random.choice(words) while '-' in word or ' ' in word: word = random.choice(words) return word.upper() def hangman(): word = get_valid_word(words) word_letters = set(word) alpha...
MartinBesko/12
12 projects/pici.py
pici.py
py
1,320
python
en
code
0
github-code
36
29290165497
import glob import os import subprocess import tempfile rescompilerPath = 'build-desktop/bin/rescompiler.exe' containerPath = 'data/build/game.dat' excludeFiles = glob.glob('data/build/**/*', recursive=True) + glob.glob('data/sources/**/*', recursive=True) dataFiles = [os.path.abspath(f) for f in glob.glob('data/**/*...
Valax321/GAWFramework
rescompile.py
rescompile.py
py
777
python
en
code
0
github-code
36
29024831808
from src.algo import rpq from src import Config from tests.simple_test import simple_test import json import pytest import os import random MAIN_TEST_DIR = \ os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tests') TEST_DIRS = list(map( lambda dir_name: os.path.join(MAIN_TEST_DIR, dir_name), ...
SergeyKuz1001/formal_languages_autumn_2020
tests/rpq/test.py
test.py
py
2,155
python
en
code
0
github-code
36
35798383779
from time import perf_counter import numpy as np import matplotlib.pyplot as plt #The program uses the Velocity Verlet method to simulate the #perihelion percession of Mercury over TT years divided into n #time steps. In order to avoid problems with insuficient compter #memory, one year at the time is simulated. When...
abjurste/A19-FYS4150
Project5/Project5g.py
Project5g.py
py
7,275
python
en
code
0
github-code
36
21618567791
from __future__ import absolute_import import logging import time import unittest from hamcrest.core.core.allof import all_of from nose.plugins.attrib import attr from apache_beam.examples import wordcount from apache_beam.testing.pipeline_verifiers import FileChecksumMatcher from apache_beam.testing.pipeline_verifi...
a0x8o/kafka
sdks/python/apache_beam/examples/wordcount_it_test.py
wordcount_it_test.py
py
2,483
python
en
code
59
github-code
36
22604025236
def calculate_division(percentage): if percentage >= 75: return "1st Division" elif percentage >= 60: return "2nd Division" elif percentage >= 40: return "3rd Division" else: return "Fail" while True: print("Menu:") print("1. Calculate division or res...
Chiro2002/SEM_5_SE
python_and_bash/divisionMarks.py
divisionMarks.py
py
1,126
python
en
code
1
github-code
36
32422202346
import wolframalpha import pprint import json class WolframAlpha: def __init__(self, appId): self.__client = wolframalpha.Client(appId) self.__prettyPrinter = pprint.PrettyPrinter() self.__pp = self.__prettyPrinter.pprint def question(self, query): if len(query.strip()) == 0: return "Ask me a question...
IntercraftMC/InterCraftBot_Deprecated
src/modules/wolframalpha.py
wolframalpha.py
py
1,122
python
en
code
0
github-code
36
29247550428
# Asynchronous pipe example using chained Popen import sys, subprocess, traceback, platform import asyncoro import asyncoro.asyncfile def writer(apipe, inp, coro=None): fd = open(inp) while True: line = fd.readline() if not line: break yield apipe.stdin.write(line.encod...
pgiri/asyncoro
examples/pipe_grep.py
pipe_grep.py
py
1,985
python
en
code
51
github-code
36
31728760633
""" These settings are here to use during tests, because django requires them. In a real-world use case, apps in this project are installed into other Django applications, so these settings will not be used. """ DEBUG = True TEST_MODE = True TRANSACTIONS_MANAGED = {} USE_TZ = False TIME_ZONE = {} SECRET_KEY = 'SHHHHH...
openedx/edx-milestones
settings.py
settings.py
py
660
python
en
code
4
github-code
36
3458969657
class Solution(object): def minNumber(self, nums): """ :type nums: List[int] :rtype: str """ if not nums: return [] nums = self.merge_sort(nums) res = "" for ele in nums: res += str(ele) return res def merge_sort(s...
pi408637535/Algorithm
com/study/algorithm/offer/剑指 Offer 45. 把数组排成最小的数.py
剑指 Offer 45. 把数组排成最小的数.py
py
1,188
python
en
code
1
github-code
36
75220903145
import argparse from . import test_data from .. import music from .. import key_recognition def parse_args(): parser = argparse.ArgumentParser( description='Test getting key from sounds') parser.add_argument('--verbose_factor_threshold', '-Vft', required=False, ...
JakubBilski/tonations-recognition
src/tests/key_from_sounds_test.py
key_from_sounds_test.py
py
2,381
python
en
code
1
github-code
36
25552501869
import turtle import random import time print('Welcome to Flappy Bird') print('Press UP arrow or w to jump') print('Press Space Bar to pause / play') print('Press Esc to exit anytime') try: f = open('flappy_bird.txt', 'x') f.close() f = open('flappy_bird.txt', 'w') f.write('0') f.c...
tank-king/My-Games
python-turtle/flappy bird/bird.py
bird.py
py
11,072
python
en
code
4
github-code
36
8513285906
from flet import *; def settings_subview(page): # from ..components.title import title; from ..components.label_field import label_field; from ..components.fill_btn import fill_btn; from ..methods.color_method import inverse_color_method; from ..alerts.change_color_alert import change_color_al...
On3l7d15h/Flet_EWallet
functions/subviews/settings_subview.py
settings_subview.py
py
1,385
python
en
code
1
github-code
36
73476726505
'''simple port scan to scan all 65353 ports Developed by iamth3g33k17 ''' import socket sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) host = input("[*] Please enter your host: ") def Portscanner(port): if sock.connect_ex((host,port)): print("[-]Port is %d closed" %(port)) else: pri...
Dave360-crypto/Practical-Security
Ethical_ hackin/Vulnerability_scanning/Port_Scanning/port_scanner_to_scan_all_tcp_ports.py
port_scanner_to_scan_all_tcp_ports.py
py
404
python
en
code
0
github-code
36
39268376088
class Solution: # @param s, a string # @return an integer def minCut(self, s): n = len(s) if (n == 0): return -1 isP = [[False for _ in range(n)] for _ in range(n)] # isP[i,j] represent wether s[i:j+1] is Palindrome for i in range(n): ...
JessCL/LintCode
108_palindrome-partitioning-ii/palindrome-partitioning-ii.py
palindrome-partitioning-ii.py
py
1,026
python
en
code
0
github-code
36
506094790
""" Analise de vizinhanca """ def slope_neighbor(dem_folder, neightable, cellid, neighbor, outfolder): """ Join file with neighbor files """ import os from glass.pys.oss import lst_ff, fprop from glass.rd import tbl_to_obj from glass.rst.mos import rsts_to_mosaic dems = lst_ff(d...
jasp382/glass
glass/dtt/neigh.py
neigh.py
py
1,043
python
en
code
2
github-code
36
73065938023
# Script: 14 - Python Malware Analysis # Author: Robert Gregor # Date of latest revision: 302030FMAR23 # Objectives # Perform an analysis of the Python-based code given below # Insert comments into each line of the script explaining in your own words what the virus is doing on this line # Insert co...
RobG-11/Ops301-Code-Challenges
14_malware_analysis.py
14_malware_analysis.py
py
4,617
python
en
code
0
github-code
36
11342229951
import io import os import random from PIL import Image import imageio import requests import seventv def get_response(message: str): p_message = message.lower() if p_message[:3] == ("add"): url = p_message.split(" ")[1] return addGif(url) if p_message == "help": return helpText(...
JimenezJC/discord-7tv-emoji-app
responses.py
responses.py
py
1,667
python
en
code
1
github-code
36
39056132329
from numpy import genfromtxt,linspace, meshgrid,c_,where from mudpy.view import plot_grd from matplotlib import pyplot as plt from scipy.interpolate import griddata fault=genfromtxt('/Users/dmelgar/Slip_inv/Melinka_usgs/output/inverse_models/models/gsi_vr2.6.0011.inv.total') grdfile='/Users/dmelgar/code/GMT/Melinka/l...
Ogweno/mylife
Melinka/get_avg_locking.py
get_avg_locking.py
py
1,173
python
en
code
0
github-code
36
19452480257
class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if not matrix or not matrix[0]: return False m, n = len(matrix), len(matrix[0]) i, j = m - 1, 0 while i >= ...
whocaresustc/Leetcode-Summary
240. Search a 2D Matrix II.py
240. Search a 2D Matrix II.py
py
537
python
en
code
0
github-code
36
5216881963
#!/usr/bin/env python3 import sys from functools import reduce import math def sum(nums): return reduce(lambda x, y: x + y, nums, 0) def avg(nums): return sum(nums) / len(nums) def stddev(nums): numerator = reduce(lambda x, y: (y - avg(nums))*(y - avg(nums)) + x, nums, 0) return math.sqrt(numerator / (len(n...
lawrencetheabhorrence/Data-Analysis-2020
hy-data-analysis-with-python-2020/part02-e05_summary/src/summary.py
summary.py
py
759
python
en
code
0
github-code
36
15193992527
__author__ = "Mathijs Maijer" __email__ = "m.f.maijer@gmail.com" class PropertyFunction(object): ''' Class used to specify property functions, that are meta analysis functions that can be ran during any iteration to run custom values. E.g: Calculate the network cluster coeffecient every 5 iterat...
Tensaiz/DyNSimF
dynsimf/models/components/PropertyFunction.py
PropertyFunction.py
py
1,121
python
en
code
4
github-code
36
27632896757
import socket import gui.main_gui as main_gui import configparser import lib.package from PyQt5 import QtWidgets from PyQt5.QtWidgets import QMessageBox from game_class import Game_class """ Загрузка параметров """ config = configparser.ConfigParser() config.read("config.ini") #Главное окно class MainApp(QtWidgets.QM...
Arrakktur/game
client_game/main_class.py
main_class.py
py
4,540
python
ru
code
0
github-code
36
22355127515
import ast import os import pathlib import tempfile from typing import Tuple from mlrun import MLClientCtx from mlrun.package.packagers.python_standard_library_packagers import ( BoolPackager, BytearrayPackager, BytesPackager, DictPackager, FloatPackager, FrozensetPackager, IntPackager, ...
mlrun/mlrun
tests/package/packagers_testers/python_standard_library_packagers_testers.py
python_standard_library_packagers_testers.py
py
27,189
python
en
code
1,129
github-code
36
14075716492
import matplotlib matplotlib.rc('text', usetex = True) from pylab import * import os #Use the dt distributions from Crescent City #tide gauge to make example plots d = loadtxt('cumulative_probs.yearly.100.txt') figure(1,(12,9)) clf() axes((.1,.1,.8,.38)) #Add 1.13 to get s referenced to MSL s = d[:,0] - 2. +1.13 p...
rjleveque/pattern-method-paper
programs/tidepofzeta_dt.py
tidepofzeta_dt.py
py
1,796
python
en
code
0
github-code
36
37760975497
from rest_framework import renderers from teslacoil.encoders import TeslaEncoder class TeslaRenderer(renderers.JSONRenderer): encoder_class = TeslaEncoder def render(self, data, accepted_media_type=None, renderer_context=None): model = renderer_context['view'].model model_admin = renderer_co...
celerityweb/django-teslacoil
teslacoil/renderers.py
renderers.py
py
614
python
en
code
5
github-code
36
6689931275
import json import os from signal import SIGKILL from statistics import mean from typing import List, Optional from sebs.cache import Cache from sebs.local.function import LocalFunction from sebs.storage.minio import Minio, MinioConfig from sebs.utils import serialize, LoggingBase class Deployment(LoggingBase): ...
spcl/serverless-benchmarks
sebs/local/deployment.py
deployment.py
py
4,773
python
en
code
97
github-code
36
34983405141
#!/usr/bin/env python3 import pyowm from pyowm.exceptions import OWMError import sys, argparse from datetime import datetime import os #os.environ['OPENWEATHER_API_KEY'] = 'aa1ab6974298fc6bf7303d6a22e073f9' #os.environ['CITY_NAME'] = 'Honolulu' def main(argv): parser = argparse.ArgumentParser() parser.add_arg...
vasooo/pannet
exercise_1/getweather.py
getweather.py
py
1,169
python
en
code
0
github-code
36
34102793225
import pyperclip, shelve, sys mcbShelf = shelve.open('mcb') #сохранятся содержимое буфера обмена if len(sys.argv)==3 and sys.argv[1].lower() == 'save': mcbShelf[sys.argv[2]] = pyperclip.paste() print(sys.argv) elif len(sys.argv) == 2: if sys.argv[1].lower() == 'list': pyperclip.copy(str(list(mcbS...
alex3287/PyCharmProjects
a_b_s/bufer.py
bufer.py
py
555
python
ru
code
1
github-code
36
24974716765
#!/usr/bin/python3 """Defines a rectangle class which inherits from Base.""" from models.base import Base class Rectangle(Base): """A rectangle class""" def __init__(self, width, height, x=0, y=0, id=None): """Initiates an instance of the rectangle class. Args: width (int): the w...
Ikechukwu-Miracle/alx-higher_level_programming
0x0C-python-almost_a_circle/models/rectangle.py
rectangle.py
py
4,224
python
en
code
0
github-code
36
5134070317
from PyQt5.QtWidgets import QListWidget, QListWidgetItem from PyQt5.QtWidgets import QWidget, QVBoxLayout from whispering_assistant.window_managers.windows.base_window_template import BaseWindowTemplate class ChoiceWindow(BaseWindowTemplate): def __init__(self, parent=None, choices=[], process_cb=None): ...
engrjabi/WhisperingAssistant
whispering_assistant/window_managers/windows/choice_window.py
choice_window.py
py
1,535
python
en
code
2
github-code
36
16733527950
def teste(b): global a # nao crie uma variavel a, utilize o 'a' global a = 8 # aqui estou adicionando a variavel A dentro do escopo local b += 4 # 5 + 4 = 9 c = 2 print(f'Var A dentro vale {a}') print(f'Var B dentro vale {b}') print(f'Var C dentro vale {c}') a = 5 teste(a) print(f'Var A for...
TiagoFar/PythonTeste
Aula 21 D.py
Aula 21 D.py
py
458
python
pt
code
0
github-code
36
11527788837
a = "" started = False while True: a = input("command: ").lower() if a == "start": if started: print("Car already started..") else: started = True print("Car Started..") elif a == "stop": if not started: print("Car already s...
wahyudewo/Python-Project
car game.py
car game.py
py
644
python
en
code
0
github-code
36
494409517
# pylint doesn't understand pytest fixtures # pylint: disable=unused-argument from click.testing import CliRunner from dagster_airflow.cli import scaffold def test_build_dags(clean_airflow_home): '''This test generates Airflow DAGs for several pipelines in examples/toys and writes those DAGs to $AIRFLOW_HOME...
helloworld/continuous-dagster
deploy/dagster_modules/dagster-airflow/dagster_airflow_tests/test_build_dags.py
test_build_dags.py
py
1,760
python
en
code
2
github-code
36
15548149698
from sys import stdin n = None def solve(G,s): visited = [0 for _ in range(n)] stack,ans = list(),list() stack.append(s) while len(stack)!=0: u = stack.pop() #print("u: ",u) for v in G[u]: if not visited[v]: #print("v: ",v) stack.append(v) ; visited[v] = 1 fo...
jhoanseb/UvaJudge
vertex.py
vertex.py
py
1,003
python
en
code
0
github-code
36
37635441110
# Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. # Example 1: # Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] # Output: 6 # Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1...
sunnyyeti/Leetcode-solutions
42 Trapping Rain Water.py
42 Trapping Rain Water.py
py
1,147
python
en
code
0
github-code
36
14369897418
from compilador.sintactico import Sintactico codigo = input('Ingresa una expresion: ') sin = Sintactico(codigo=codigo) if sin.PROGRAMA() and len(sin.errores.coleccion) == 0: print('Programa valido') else: print('Programa invalido') for error in sin.errores.coleccion: print(error)
dannyX21/compilador
test.py
test.py
py
302
python
es
code
0
github-code
36
15719814735
from PyQt5.QtWidgets import QCheckBox, QDialog, QDialogButtonBox, QTextEdit from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont from src.logic import QFrameBase, error_dialog from src.frames.default import Ui_FrameDefault from src.frames.utils.info import Ui_FrameInfo from src.frames.utils.kde import Ui_FrameKd...
qooteen/health-weather_correlation-master
src/logic/utils.py
utils.py
py
17,580
python
ru
code
0
github-code
36
10367871599
def ad(p, arr, arr2): i = 0 j = 0 s = 0 l = len(arr) while(i < l): if(i+p < l): j = i while(j<=i + p): s += arr[j] j += 1 arr2.append(s) s = 0 i += 1 def arr_prep(at): arr = at arr2 = [] x = 0 ...
ayushmanbt/MyPythonStuff
COMPETETIVE CHALLANGES/GOOGLE CODE JAM KICKSTART/2018 Round Practice/Sum Of Sums - (Unsolved)/main.py
main.py
py
1,129
python
en
code
0
github-code
36
71354347625
#!/bin/python # =========================================================== # Created By: Richard Barrett # Organization: DVISD # DepartmenT: Data Services # Purpose: Test Score & 3rd Party Website Data Pull Automation # Date: 02/12/2020 # =========================================================== import pandas as pd...
aiern/ITDataServicesInfra
Python/Analyses/Pandas/student_missing_eoc_discovery.py
student_missing_eoc_discovery.py
py
473
python
en
code
0
github-code
36
23403442036
import random import pygame from pygame.locals import * import logging import numpy as np import itertools # logging.basicConfig(filename = 'Result.log', level=logging.INFO) # copy Rohit Agrawal's work and modify for py_game version. It doesn't work really well but the concept has been applied. pygame.init() BLUE =...
nguyenkhanhhung91/Python_ReinforcementLearning
HumanVsQlearningBot.py
HumanVsQlearningBot.py
py
6,564
python
en
code
0
github-code
36
23007605938
# -*- coding: utf-8 -*- """ Created on Wed Apr 1 22:37:54 2020 @author: GGX """ # 输出1~n的全排列(深度优先搜索) class Solution(): def __init__(self, x): self.n = x self.book = [1 for _ in range(x)] self.res = [-1 for _ in range(x)] def fun(self, step): if step == self.n:...
xmu-ggx/coding-in-offer
aha算法/dfs.py
dfs.py
py
643
python
en
code
0
github-code
36