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
17998434749
import sys from collections import Counter read=sys.stdin.read n,m=map(int,input().split()) a=list(map(int,read().split())) c=Counter(a) ans="YES" for i in c.values(): if i%2: ans="NO" print(ans)
Aasthaengg/IBMdataset
Python_codes/p03724/s595818377.py
s595818377.py
py
201
python
en
code
0
github-code
90
43793506404
"""intron_health_migration_script Revision ID: 7e6b8fa444d3 Revises: Create Date: 2020-02-02 16:36:25.380587 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '7e6b8fa444d3' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### co...
oloyedeolad/health_task
intron_health_migrations/versions/7e6b8fa444d3_intron_health_migration_script.py
7e6b8fa444d3_intron_health_migration_script.py
py
1,020
python
en
code
0
github-code
90
18440732619
def B10N(X,B): if X//B!=0: return B10N(X//B,B)+str(X%B) return str(X%B) N,A,B,C = (int(X) for X in input().split()) Li = [int(input()) for X in range(0,N)] CostM = pow(10,9) for T in range(0,pow(4,N)): Cho = list(B10N(T,4).zfill(N)) if Cho.count('1')>0 and Cho.count('2')>0 and Cho.count('3')>0: ...
Aasthaengg/IBMdataset
Python_codes/p03111/s553944943.py
s553944943.py
py
668
python
en
code
0
github-code
90
26848096196
import streamlit as st import os from PyPDF2 import PdfReader from PyPDF2 import PdfFileReader import PyPDF2 import docx import pandas as pd from io import StringIO import string import re import nltk from nltk.corpus import stopwords from Sastrawi.Stemmer.StemmerFactory import StemmerFactory from Sastrawi.StopWordRemo...
MahzuzH/document-comparison
test/reading_path.py
reading_path.py
py
3,897
python
en
code
0
github-code
90
20614680251
from django.shortcuts import render from rest_framework.views import APIView from django.contrib.auth import get_user_model from StudentHouse.organization.models import * from rest_framework.response import Response from StudentHouse.organization.serializers import * # Create your views here. class UserDetails(APIView...
root123-bot/STUDENT-HOUSE
StudentHouse/user/views.py
views.py
py
1,288
python
en
code
0
github-code
90
2510237892
from pyspark.sql import SparkSession, DataFrame, Row import pyspark.sql.types as st import pyspark.sql.functions as sf spark = ( SparkSession .builder .master("local[*]") .getOrCreate() ) schema = st.StructType([ st.StructField("stable_column", st.StringType(), True), st.StructField("currency"...
VladyslavPodrazhanskyi/learn_spark
code/my_practice/21.when.py
21.when.py
py
816
python
en
code
0
github-code
90
10353516537
DUMMYMODE = True # False for gaze contingent display, True for dummy mode (using mouse or joystick) # DISPLAY SCREENNR = 0 # number of the screen used for displaying experiment DISPTYPE = 'psychopy' # either 'psychopy' or 'pygame' DISPSIZE = (1920,1080) # canvas size MOUSEVISIBLE = False # mouse visibility BGC = (125...
NEUREM3/recording-code-for-eyetracked-multi-modal-translation
src/defaults.py
defaults.py
py
1,007
python
en
code
1
github-code
90
16566741429
import os from io import BytesIO import requests from uuid import uuid4 from pathlib import Path import json import utils.config as cfg from utils.helper import Singleton # # EVENTS # EVENT_SUCCESS = 0 EVENT_FAILED = 1 # Auth events EVENT_DEVICE_TOKEN_FAILED = 2 EVENT_USER_TOKEN_FAILED = 3 EVENT_ONETIMECODE_NEEDED ...
peerdavid/remapy
api/remarkable_client.py
remarkable_client.py
py
8,589
python
en
code
172
github-code
90
18355669439
k, x = map(int, input().split()) dif = k - 1 if dif == 0: print(x) else: mini = x - dif maxi = x + dif a = [] for i in range(mini, maxi + 1): a.append(str(i)) s = ' '.join(a) print(s)
Aasthaengg/IBMdataset
Python_codes/p02946/s092963894.py
s092963894.py
py
219
python
en
code
0
github-code
90
8323093704
import cv2 import numpy as np from os import listdir from os.path import isfile, join def getC(u,v): if u == 0 and v == 0: return (0.5) elif (u==0 and v>0) or (u>0 and v==0): return (1/np.sqrt(2)) else: return 1 def dct(Color): F = [[0 for _ in range(16)] for _ in range(16)] for v in range(16): ...
sgu0927/Numerical-Analysis
DCT encoding/DCT_encoding.py
DCT_encoding.py
py
2,875
python
en
code
0
github-code
90
18458212239
import bisect def solve(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) if sum(A) < sum(B): return -1 C = [a - b for a, b in zip(A, B)] C.sort() mid = bisect.bisect_left(C, 0) minus = sum(C[:mid]) if minus >= 0: ...
Aasthaengg/IBMdataset
Python_codes/p03151/s220294753.py
s220294753.py
py
503
python
en
code
0
github-code
90
73795556458
"""empty message Revision ID: f1aaf899424d Revises: Create Date: 2018-04-14 00:03:16.490169 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'f1aaf899424d' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
paulsulli/MiningLedger
migrations/versions/f1aaf899424d_.py
f1aaf899424d_.py
py
1,763
python
en
code
0
github-code
90
36127469166
"""Make team enrollment revisable Revision ID: a0c708394373 Revises: 19efd09533ca Create Date: 2020-03-19 17:12:42.598485 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "a0c708394373" down_revision = "19efd09533ca" branch_labels = None depends_on = None def ...
MTES-MCT/mobilic-api
migrations/versions/a0c708394373_make_team_enrollment_revisable.py
a0c708394373_make_team_enrollment_revisable.py
py
1,133
python
en
code
1
github-code
90
20902157862
from __future__ import absolute_import from __future__ import division from __future__ import print_function import paddle.fluid as fluid import math import warnings def initial_type(name, input, op_type, fan_out, init="google", use_b...
PaddlePaddle/Research
CV/PaddleReid/reid/model/layers.py
layers.py
py
7,959
python
en
code
1,671
github-code
90
34292703405
# -*- coding: utf-8 -*- # @Author: Blakeando # @Date: 2020-08-13 14:24:11 # @Last Modified by: Blakeando # @Last Modified time: 2020-08-13 14:24:11 import asyncio import hashlib import io import json import random import re import urllib.parse import aiohttp import aiosqlite import discord import inflect from bs4 ...
kapsikkum/MechaDon
nsfw/danbooru.py
danbooru.py
py
5,568
python
en
code
0
github-code
90
18452243129
n = int(input()) a = input() b = input() c = input() ans = 0 for i in range(n): if a[i] == b[i] and b[i] == c[i]: # すべて同じなので操作しなくて良い continue if a[i] != b[i] and a[i] != c[i] and b[i] != c[i]: # すべて異なるので操作2回 ans = ans + 2 continue # 1つ異なる ans = ans + 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03140/s801569917.py
s801569917.py
py
357
python
en
code
0
github-code
90
28241309071
from django.contrib.auth.decorators import login_required from django.shortcuts import render from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from .models import Room, Message @login_required def rooms(request): rooms = Room.objects.all() return render(req...
Bhumika07092001/Django_application
src/room/views.py
views.py
py
2,668
python
en
code
0
github-code
90
70841377896
import subprocess import os import re TCP_LIMIT = 1000 # limite per pacchetti TCP UDP_LIMIT = 10000 # limite per pacchetti UDP INTERFACE = 'eth0' tcp_ip_counts = {} udp_ip_counts = {} blocked_ips = set() ssh_client_ip = os.environ.get('SSH_CLIENT', '').split(' ')[0] if 'SSH_CLIENT' in os.environ else None ip_patte...
Loki-it/Packet-Limiter
main.py
main.py
py
1,675
python
en
code
0
github-code
90
36437556073
import os import unittest import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * import logging import re import numpy ######################################################################################### #### #### ###...
mnarizzano/SEEGA
GMPIComputation/GMPIComputation.py
GMPIComputation.py
py
22,278
python
en
code
25
github-code
90
39916350224
from app.models import db, Location def seed_locations(): location1 = Location( user_id = 1, city = 'Tampa', state = 'Florida', country = 'United States', name = 'Cozy AF Tiny-House Oasis', amenities = '2 guests, 1 bedroom, 1 bed, 1 bath', description = 'Awar...
mehendaleo/GetAway
app/seeds/location.py
location.py
py
12,866
python
en
code
1
github-code
90
1438668318
# 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. # Find the sum of all numbers which are equal to the sum of the factorial of their digits. # Note: as 1! = 1 and 2! = 2 are not sums they are not included. import math result = 0 for i in range (0,10000001): sums = 0 for j in range (0,len(str(i)))...
okadaakihito/ProjectEuler
Problem_34.py
Problem_34.py
py
552
python
en
code
0
github-code
90
6338306949
#!/usr/bin/python3 """ Script that uses JSONPlaceholder API to get information about employee """ import requests import sys if __name__ == "__main__": url = 'https://jsonplaceholder.typicode.com/' user = '{}users/{}'.format(url, sys.argv[1]) res = requests.get(user) json_o = res.json() print("Em...
luischaparroc/holberton-system_engineering-devops
0x15-api/0-gather_data_from_an_API.py
0-gather_data_from_an_API.py
py
738
python
en
code
153
github-code
90
33956324358
"""Adding balance and total_references to user Revision ID: a9078a30a48e Revises: 8355ab728b72 Create Date: 2020-02-10 11:41:28.821496 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'a9078a30a48e' down_revision = '8355ab728b72' branch_labels = None depends_on ...
Rencode/referral_program
alembic/versions/a9078a30a48e_adding_balance_and_total_references_to_.py
a9078a30a48e_adding_balance_and_total_references_to_.py
py
811
python
en
code
1
github-code
90
17068668525
import random from xml.dom.minidom import Document,Node from PyQt5.QtWidgets import * from PyQt5.QtGui import * class Diagram: """ Information for a diagram view of a L{psychsim.world.World} """ def __init__(self,args=None): self.x = {} self.y = {} self.color = {} if isi...
pynadath/psychsim
psychsim/ui/diagram.py
diagram.py
py
2,725
python
en
code
26
github-code
90
18718741352
import pandas as pd import numpy as np from matplotlib import pyplot as plt from sklearn import linear_model import statsmodels.api as sm def pacf(x, tau): x = x.to_numpy() n = x.shape[0] y0 = x[tau:] y1 = x[:n-tau] xx = np.zeros([n - tau, tau - 1]) for k in range(1, tau): xx[:, k-1] =...
cruiseryy/boot_camp
hw4/arma_test.py
arma_test.py
py
2,967
python
en
code
1
github-code
90
3493325288
from flask import Flask, render_template from flask_wtf.csrf import CSRFProtect from forms import QueryServices import requests app = Flask(__name__) app.secret_key = b'ksdfglbvlsdfbos' csrf = CSRFProtect(app) BASE = 'http://service:5001/' @app.route("/", methods=['GET', 'POST']) def home(): form = QueryService...
johnlindsay93/istio_tutorial
homepage/app.py
app.py
py
647
python
en
code
0
github-code
90
4536154818
#!/usr/bin/env python # -*- coding: utf-8 -*- # # author: JianGe, created on: 2018/10/25 from .xpinyin import Pinyin p = Pinyin() def allPinyin(inputStr): res = '' for item in p.get_pinyin(inputStr, u""): res += item return res def allInitials(inputStr): return p.get_initials(inputStr, u""...
laozeng1982/workoutDB
utilities/Chinese.py
Chinese.py
py
526
python
en
code
0
github-code
90
38321524550
""" GravMag: 3D forward modeling of total-field magnetic anomaly using polygonal prisms """ from fatiando import logger, mesher, gridder, gravmag from fatiando.vis import mpl, myv log = logger.get() log.info(logger.header()) log.info(__doc__) log.info("Draw the polygons one by one") bounds = [-5000, 5000, -5000, 5000...
fatiando/v0.1
_static/cookbook/gravmag_mag_polyprism.py
gravmag_mag_polyprism.py
py
1,115
python
en
code
0
github-code
90
20382780731
import argparse import pyaudio import wave import numpy as np from scipy.io import wavfile import matplotlib.pyplot as plt from pydub import AudioSegment def main(args): if args.r: print("Record Sound") p = pyaudio.PyAudio() info = p.get_host_api_info_by_index(0) numdevices = info.g...
DanielQu1108/forJaime
main.py
main.py
py
4,508
python
en
code
0
github-code
90
17959973129
N = int(input()) P = list(map(int, input().split())) def swap(i, j): return j, i now = P[0] count = 0 for i in range(N-1): after = P[i+1] if now == i+1: now, after = swap(now, after) count += 1 now = after if now == N: count += 1 print(count)
Aasthaengg/IBMdataset
Python_codes/p03612/s932400470.py
s932400470.py
py
290
python
en
code
0
github-code
90
29292760126
#!/usr/bin/python # -*- coding: utf-8 -*- #CSV:xpelan03 """ " Soubor: csv.py " Datum: 2015/04/18 " Autor: Lukas Pelanek, xpelan03@stud.fit.vutbr.cz " Projekt: CSV2XML " Popis: Program nacte zdrojovy soubor zapsany ve formatu CSV a prevede jej do formatu XML """ import params import sys path=sys.path[:] sys.path...
Mike-CZ/VUT-FIT
2BIT/IPP/Projekt 2/csv.py
csv.py
py
6,849
python
cs
code
0
github-code
90
17064092835
import logging from yolodeck.buttons.base_button import BaseButton class BaseScreen(BaseButton): def __init__(self, key_no): self._logger = logging.getLogger('yolodeck') self._screen_manager = None self.buttons = {} self.screen_buttons() super().__init__(key_no) def s...
lamaral/yolodeck
yolodeck/screens/base_screen.py
base_screen.py
py
2,513
python
en
code
1
github-code
90
74457547817
from graphviz import Digraph class BlockDiagram(): def __init__(self, chip): self.chip = chip g = Digraph(self.chip.name, graph_attr={"rankdir": "LR"}) sources = {} sinks = {} for instance in self.chip.instances: for port, wire in instance.inputs.iteritems(...
dawsonjon/Chips-2.0
chips/utils/block_diagram.py
block_diagram.py
py
1,969
python
en
code
225
github-code
90
18535781079
S, k = open(0).read().split() k = int(k) x = set(sorted(S)[:min(k, len(S))]) A = set() for i, c in enumerate(S): if c in x: s = '' for j in range(i, min(i+k, len(S))): s += S[j] A.add(s) print(sorted(A)[k-1])
Aasthaengg/IBMdataset
Python_codes/p03353/s321410962.py
s321410962.py
py
252
python
en
code
0
github-code
90
44855394670
from typing import List from aiogram.types import KeyboardButton, ReplyKeyboardMarkup, InlineKeyboardButton, InlineKeyboardMarkup from aiogram.utils.keyboard import InlineKeyboardBuilder from aiogram.filters.callback_data import CallbackData from core import schemas class BotFactory(CallbackData, prefix="bot"): ...
HungryStudent/multi_support_bot
keyboards/user.py
user.py
py
1,951
python
en
code
0
github-code
90
19414412932
import cv2 import numpy as np cap = cv2.VideoCapture("run1.mp4") while cap.isOpened(): ret,frame = cap.read() #if Frame is read correctly ret is True if not ret: print('Cant find the file check it once again..') break gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) ...
Pavankunchala/Deep-Learning
Open-CV_Basics/playing_video_openCV.py
playing_video_openCV.py
py
531
python
en
code
31
github-code
90
709331225
results = {} while True: print("0-Exit,1-Add, 2-Search, 3-Delete") n = int(input("Option\n")) if n == 0: break elif n == 1: print("Add") rollno = int(input("Roll no\n")) getter = results.get(rollno) if getter is not None: print('Already exits') ...
Varanasi-Software-Junction/pythoncodecamp
dictionaries/marksheet.py
marksheet.py
py
1,242
python
en
code
10
github-code
90
34845057314
import pandas as pd import re import json from typing import Optional,Tuple import numpy as np import random import matplotlib.pyplot as plt import seaborn as sns import warnings import os warnings.filterwarnings('ignore') class CallfunctionalFi(): def __init__(self, df, fix_sites...
ZhengCQ/brrAB
bin/callrisk.py
callrisk.py
py
8,420
python
en
code
1
github-code
90
13471579010
import sys, json import csv from matching.games import HospitalResident def parse_student_csv(file_p): # student_preferences: Dict(str(student_id): ['section1', 'section2', ... (amount depending on student's availability -- varies)]) # section_preferences: Dict(str(section_name): ['01', '02', ... (section choo...
MohamedElgharbawy/p-cubed
python/run_assign.py
run_assign.py
py
6,690
python
en
code
0
github-code
90
42363991910
import re from lark import Token from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck from checkov.common.models.enums import CheckResult, CheckCategories class ForbiddenResources(BaseResourceCheck): def __init__(self): name = "Make sure no forbidden resources are being cr...
jensskott/tf-compliance
checkov/GC_04_forbidden_resource.py
GC_04_forbidden_resource.py
py
837
python
en
code
0
github-code
90
33687090409
# Here is the a TIP CALCULATOR that uses various Arithmetic Operator. print("==>","\033[35m","TIPS CALCULATOR","\033[0m","<==") print() bill = float(input("How much did you Spend: ")) percent = float(input("What percentage do you want to tip: ")) people = float(input("How many people in your group: ")) ps = (percent /...
Innocentsax/Python_Series
Day_10.py
Day_10.py
py
417
python
en
code
29
github-code
90
13607991602
from nose.tools import assert_equal import scrumble cases = [ ["1/1990", {'year': 1990, 'month': 1}], ["31 January 2013", {'year': 2013, 'month': 1, 'day': 31}], ["2012 10", {'year': 2012, 'month': 10}], ["Mar 2012", {'year': 2012, 'month': 3}], [None, {}], ["", {}], ["not a date", None] ] ...
scraperwiki/scrumble
test/test_real_dates.py
test_real_dates.py
py
546
python
en
code
4
github-code
90
23856157148
import cv2 import winsound import argparse from extraction_original import extract_parameters from segmentation import segment_image from extraction_single_image import search_borders, get_smallest_shape_scrambled from solution import solve_puzzle from result import * from matching import * # play background sound wi...
Laurens-VG/Puzzle-Solver
code/main.py
main.py
py
2,316
python
en
code
0
github-code
90
28355693244
from prettytable import PrettyTable x = PrettyTable() class TreeNode: def __init__(self,data): self.data=data self.children=[] self.child=None self.parent=None def add_children(self, children): children.parent = self self.children.append(children) def add_...
FalgunMakadia/project-data-warehousing
Project/InsertOperation.py
InsertOperation.py
py
3,081
python
en
code
0
github-code
90
40098167258
class Ticket: tikcount = 0 def __init__(self, name, numlist): self.name = name self.num1 = numlist[0] self.num2 = numlist[1] self.num3 = numlist[2] self.num4 = numlist[3] self.num5 = numlist[4] self.num6 = numlist[5] Ticket.tikcount += ...
mcain84/powerball_project
ticket.py
ticket.py
py
323
python
en
code
0
github-code
90
41978329299
import ctypes import pytest c_lib = ctypes.CDLL('../solutions/1512-good-pair/good-pair.so') @pytest.mark.parametrize('function', [c_lib.numIdenticalPairsSpace, c_lib.numIdenticalPairsTime]) def test_good_pair(function): array = [1,2,3,1,1,3] arr = (ctypes.c_int * len(arra...
msztylko/2020ify-leetcoding
tests/test_1512.py
test_1512.py
py
386
python
en
code
0
github-code
90
15069221041
import time from collections import namedtuple TrackedSegment = namedtuple('TrackedSegment', ['expectedACKNum', 'sendTime']) # Named tuple for currently tracked segment class Timer: def __init__(self, estimatedRTT=0.5, devRTT=0.25, gamma=4): # Default values self.estimatedRTT = estimatedRTT ...
AntFace/COMP3331-assignment
ass/timer.py
timer.py
py
2,714
python
en
code
0
github-code
90
32800092340
from selenium import webdriver import os from time import sleep GOOGLE_CHROME_BIN = '/app/.apt/usr/bin/google_chrome' CHROMEDRIVER_PATH = '/app/.chromedriver/bin/chromedriver' def run(df, msg): chrome_options = webdriver.ChromeOptions() chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN") ...
debajyotiguha11/AutoText
AutoScrips/scripts.py
scripts.py
py
1,406
python
en
code
1
github-code
90
74065744616
import torch.nn as nn import torch.nn.functional as F import torchvision.models as vmodels from base import BaseModel import copy class MnistModel(BaseModel): def __init__(self, num_classes=10): super().__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, k...
learningman7777/CNN-CatClassification
model/model.py
model.py
py
1,601
python
en
code
0
github-code
90
3225619020
# coding: utf-8 # 导入相关函数库 import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # CNN 前向传播参数 num_channels = 1 conv1_size = 3 conv1_deep = 32 conv2_size = 3 conv2_deep = 64 fc1_nodes = 128 num_classes = 10 # CNN 前向传播过程 def cnn_inference(input_x): """ conv -> pool...
doer-lab/MNIST
cnn_inference_by_function.py
cnn_inference_by_function.py
py
3,725
python
en
code
0
github-code
90
354332007
from aiohttp import web routes = web.RouteTableDef() @routes.get('/root', name='root') async def handler(request): return web.Response(text='Whats up?') url = request.app.router['user-info'].url_for(user='john_doe') url_with_qs = url.with_query("a=b") assert url_with_qs == '/john_doe/info?a=b' app = web.App...
JaviMerino-11/tutorial_API
named_resources.py
named_resources.py
py
404
python
en
code
0
github-code
90
434426678
# -*- coding: utf-8 -*- """ Created on Wed Oct 30 16:31:59 2019 @author: agos6 """ import numpy as np inputFile = "C:/Users/agos6/Desktop/Aurore/SD/texte.txt" class node(): "Define tree by root, nodes, leaves, and links, which are splitting criteria" nodes_numbers = 0 def __init__(self...
auroregosmant/SD201---Mining-of-Large-Datasets
decision trees q3.py
decision trees q3.py
py
4,436
python
en
code
0
github-code
90
18364947249
n = int(input()) a, b = [list(map(int, input().split())) for _ in range(2)] tmp, cnt = 0, 0 for i in range(n): tmp = min(a[i] - tmp, b[i]) cnt += tmp tmp = min(a[i + 1], b[i] - tmp) cnt += tmp print(cnt)
Aasthaengg/IBMdataset
Python_codes/p02959/s646368610.py
s646368610.py
py
220
python
en
code
0
github-code
90
35716364381
""" Simple Code Example on how to use the CompanyIndexReader """ import pandas as pd from secfsdstools.c_index.companyindexreading import CompanyIndexReader pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000) def indexreader(): """ CompanyIndexRe...
HansjoergW/sec-fincancial-statement-data-set
secfsdstools/x_examples/example_companyindexreader.py
example_companyindexreader.py
py
672
python
en
code
12
github-code
90
72201307818
# | [2235](https://leetcode.com/problems/add-two-integers/description/) | [Add Two Integers](/LeetCode/Easy/2235.%20Add%20Two%20Integers/) | [Python](/LeetCode/Easy/2235.%20Add%20Two%20Integers/2235.%20Add%20Two%20Integers.py) | [Facebook](/Facebook/), [Google](/Google/), [Amazon](/Amazon/), [Apple](/Apple/)| Math | ...
ArmanTursun/coding_questions
generate_readme.py
generate_readme.py
py
3,926
python
en
code
0
github-code
90
22719441242
from copy import deepcopy from typing import Dict import cv2 import numpy as np import open3d as o3d def get_aruco_masks(image: np.ndarray) -> Dict[int, np.ndarray]: # Define the ArUco dictionary and detector parameters dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_6X6_50) parameters = cv...
vinceHuyghe/MRAC_ur_commander
capture_manager/scripts/marker.py
marker.py
py
7,003
python
en
code
2
github-code
90
34731092857
#!/usr/bin/env python3 """ Trains a Deep Q-Network (DQN) to play Atari's "Breakout." """ import gym from keras import layers, models, optimizers from rl import agents, memory, policy total_training_steps = 10_000 memory_limit = 100_000 game_environment = gym.make( "ALE/Breakout-v5", disable_env_checker=True,...
keysmusician/holbertonschool-machine_learning
reinforcement_learning/0x01-deep_q_learning/train.py
train.py
py
1,733
python
en
code
1
github-code
90
17963881699
import collections _=input() a=list(map(int,input().split())) c=collections.Counter(a) l=sorted(c.items(), key=lambda x: x[0]) x=0 for i in l[::-1]: if i[1]>3: if x: print(i[0]*x) exit(0) else: print(i[0]*i[0]) exit(0) elif i[1]>1: if x: ...
Aasthaengg/IBMdataset
Python_codes/p03625/s800696038.py
s800696038.py
py
406
python
en
code
0
github-code
90
44000437349
fat_percent=int(input())/100 proteins_percent=int(input())/100 carbons_percent=int(input())/100 calories_total=int(input()) water_percentage=int(input())/100 fat_grams=(fat_percent*calories_total)/9 proteins_grams=(proteins_percent*calories_total)/4 carbons_grams=(carbons_percent*calories_total)/4 sum_grams=fat_grams+p...
HBall88/SoftUni-Python
python_basics_exam/1.py
1.py
py
495
python
en
code
1
github-code
90
18263835529
class SegmentTree(object): """ セグメントツリー (0-indexed) 1. 値の更新 O(logN) 2. 区間クエリ O(logN) """ def __BinOp(self, x, y): """ セグ木で使用する二項演算 """ return x | y def __init__(self, init_ele, N:int): """ セグ木を構築する init_ele: 単位元 N: 要素数 """ s...
Aasthaengg/IBMdataset
Python_codes/p02763/s369010697.py
s369010697.py
py
2,013
python
ja
code
0
github-code
90
18509292649
import sys def input(): return sys.stdin.readline()[:-1] def main(): N = int(input()) # A, B, C = map(int,input().split()) # S = input() if N < 1200: print("ABC") elif N < 2800: print("ARC") else: print("AGC") if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03288/s500898753.py
s500898753.py
py
298
python
en
code
0
github-code
90
38853106205
import numpy as np from sources.base_source import BaseSource from models import modelw2v, W2V_SIZE class Word2VecAvgSource(BaseSource): def get_generator(self, X, y, batch_size=32): def generator(): idx = 0 batch_x = [] batch_y = [] while True: ...
anssar/Sber-ml
sources/word2vec_avg_source.py
word2vec_avg_source.py
py
1,094
python
en
code
0
github-code
90
5026431525
from api_manager.Project.Database import Worker as worker class DatabaseManager: def __init__(self): self.worker=worker.DatabaseWorker() self.products=[] self.request_texts="" self.updateProducts() self.updateRequestTexts() def updateProducts(self): data=self.worker.select('SELECT name FROM "Product"') ...
Sunests/ml_system_design_2023
api_manager/Project/Database/Manager.py
Manager.py
py
3,310
python
en
code
0
github-code
90
26217498327
import smtplib import pprint def send_email(message): sender = "ivankosarev07@gmail.com" pasword = "310970qq" server = smtplib.SMTP("smtp.gmail.com", 587) server.starttls() try: server.login(sender, pasword) server.sendmail(sender,sender,message) return "отп...
vankosarev/vankosarev
nachalo.py
nachalo.py
py
561
python
en
code
0
github-code
90
18166592029
import sys input = sys.stdin.buffer.readline H, W, M = map(int, input().split()) X = [0] * W Y = [0] * H Map = [] for _ in range(M): h, w = map(int, input().split()) h -= 1 w -= 1 Y[h] += 1 X[w] += 1 Map.append((h, w)) MX = max(X) MY = max(Y) ans = MX + MY Xans = set() Yans = set() for i...
Aasthaengg/IBMdataset
Python_codes/p02580/s854446335.py
s854446335.py
py
569
python
en
code
0
github-code
90
25238868181
# This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. from tqdm import tqdm import time import progressbar from tkinter import * from tkinter import ttk import time import threading from t...
Mortimo1996/Stauraumplanung_vcs
Archiv/main.py
main.py
py
7,685
python
de
code
0
github-code
90
2149818242
import random from sys import argv from PyDictionary import PyDictionary from rearrange import anagramizer def get_file_lines(filename): file = open(filename, 'r') all_lines = file.readlines() all_lines = [line.strip() for line in all_lines] file.close() return all_lines def random_di...
omarsagoo/tweet_gen_app
static/code/dictionary_words.py
dictionary_words.py
py
1,747
python
en
code
0
github-code
90
36518105590
import time from scraper import Scraper start = time.time() facebook = Scraper( 'Facebook', 'https://www.facebook.com/careers/jobs/?page=1&results_per_page=100&offices[0]=Dublin%2C%20Ireland#search_result') data = facebook.start() end = time.time() hours, rem = divmod(end-start, 3600) minutes, seconds = divmod...
ConanKeaveney/JobHub-Scrapers
companies/Facebook/test.py
test.py
py
446
python
en
code
0
github-code
90
17922226966
#!/usr/bin/env python import os from trackutil.confutil import get_config from trackutil.ioutil import jsonload from trackutil.logger import INFO from trackutil.pathutil import get_datafiles_in_dir, mkdir from trackutil.pathutil import get_storyline_module_dir def main(): cfg = get_config() root = cfg['data...
shiguangwang/storyline
storyline/summarize.py
summarize.py
py
3,419
python
en
code
0
github-code
90
34731364547
#!/usr/bin/env python3 """ Defines `inception_network` """ import tensorflow.keras as K inception_block = __import__('0-inception_block').inception_block def inception_network(): """ Builds the inception network as described in Going Deeper with Convolutions (2014). Returns: A Keras Model of the Ince...
keysmusician/holbertonschool-machine_learning
supervised_learning/0x08-deep_cnns/1-inception_network.py
1-inception_network.py
py
2,073
python
en
code
1
github-code
90
31466939260
import numpy as np import os import argparse from tqdm import tqdm from multiprocessing import Process, Queue from importlib.machinery import SourceFileLoader import logging import pickle import imp import matplotlib.pyplot as plt from PIL import Image import collections def get_array_of_modes(cf, seg): """ ...
sylqiu/modal_uncertainty
model_evaluator.py
model_evaluator.py
py
24,589
python
en
code
2
github-code
90
19233814559
from tanka.predule import Variable def test_rosenbrock(): def rosenbrock(x0, x1): y = 100 * (x1 - x0 ** 2) ** 2 + (1 - x0) ** 2 return y x0 = Variable(0.0) x1 = Variable(2.0) lr = 0.001 iters = 10_0 for _ in range(iters): print(x0, x1) y = rosenbrock(x0, x1) ...
ashigirl96/tanka
tests/tanka/test_optimization.py
test_optimization.py
py
512
python
en
code
0
github-code
90
43262091528
from rest_framework.test import APITestCase from content.models import Word from content.tests.factory import TextFactory class TextDetailTest(APITestCase): def setUp(self): self.url = "/api/texts/1/" self.text = TextFactory() def test_GET(self): res = self.client.get(self.url) ...
charliewhu/Dj_Linguify
api/tests/test_endpoints.py
test_endpoints.py
py
1,184
python
en
code
0
github-code
90
37070467415
import json import time import uuid import pytest import requests import redis from allocation import config def random_ref(prefix): return prefix + '-' + uuid.uuid4().hex[:10] def post_to_add_batch(ref, sku, qty, eta): url = config.get_api_url() r = requests.post( f'{url}/add_batch', jso...
mchoplin/python-leap-exs
tests/e2e/test_external_events.py
test_external_events.py
py
2,423
python
en
code
0
github-code
90
10425821051
import json from typing import Optional from confluent_kafka import Consumer, KafkaError from geniusrise import Spout, State, StreamingOutput class Kafka(Spout): def __init__(self, output: StreamingOutput, state: State, **kwargs): r""" Initialize the Kafka class. Args: output...
geniusrise/geniusrise-listeners
geniusrise_listeners/kafka.py
kafka.py
py
4,288
python
en
code
1
github-code
90
195234569
import pynput, numpy, sys, cv2, os if (os.getcwd() != os.path.dirname(__file__)): if (os.path.dirname(__file__).replace(" ", "").__len__()): os.chdir(os.path.dirname(__file__)) from typing import Callable, Iterator, Tuple, Union, Type, List from keywizardUtilities.mob_utils.wizard_settings import Wi...
keyywind/keywiz
Mob-Farmer.py
Mob-Farmer.py
py
30,532
python
en
code
0
github-code
90
35383484954
# -*- coding: utf-8 -*- from flask import request, jsonify from application import app from application.api import interface as InterfaceAPI from application.api import use_case as UseCaseAPI from application.util.parameter import search_parameter from application.util.exception import try_except from application.cont...
cnboysliber/AutoTest
application/controller/interface.py
interface.py
py
5,087
python
en
code
4
github-code
90
43484105377
# -*- conding:utf-8 -*- __author__ = "snake" """ Appium的二次封装 """ from appium import webdriver from appium.webdriver.common.mobileby import MobileBy from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC class Config(): """ AppiumDe...
testjie/PyAppium
pyappium.py
pyappium.py
py
7,175
python
en
code
1
github-code
90
16445702103
# TASK: # # Write a random tester for the Queue class. # The random tester should repeatedly call # the Queue methods on random input in a # semi-random fashion. for instance, if # you wanted to randomly decide between # calling enqueue and dequeue, you would # write something like this: # # q = Queue(500) # if (r...
spanners/udacity-homeworks
cs258/unit3/bounded_queue.py
bounded_queue.py
py
4,061
python
en
code
0
github-code
90
18107974239
class solve: def __init__(self, n): pass def insertionsort(self, A, n, g): for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j + g] = A[j] j = j - g self.cnt += 1 A[j + g] = v ...
Aasthaengg/IBMdataset
Python_codes/p02262/s189015222.py
s189015222.py
py
808
python
en
code
0
github-code
90
21286930000
import os import pickle from django import forms from django.conf import settings from django.contrib import messages from django.contrib.auth import update_session_auth_hash from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import PasswordChangeForm from django.contrib.auth.mode...
Tospaa/OzerLastikDjango
dashboard/views.py
views.py
py
16,256
python
tr
code
0
github-code
90
34444118120
import os import sys assert sys.version_info.major == 3, ('Python {0} is not supported, ' 'please use Python 3.'.format( sys.version_info.major)) def change_vcxproj(filename): print('Processing {filename}...'.format(**locals())) with...
Hoshino19680329/traKmeter
Builds/visual_studio_fix.py
visual_studio_fix.py
py
1,086
python
en
code
0
github-code
90
70032305258
import os from PIL import Image directory = 'C:/Users/mousu/Documents/university/3.5 - Year 2022-23/Term 2/CV/Coursework/OwnData/ownDataset/ownTest/images' for filename in os.listdir(directory): if filename.endswith('.jpg'): img_path = os.path.join(directory, filename) with Image.open(img_path) as...
MousufCZ/face-mask-identification-models
Personal_Dataset/Data_Prep/changeJPGtoJPEG.py
changeJPGtoJPEG.py
py
408
python
en
code
0
github-code
90
23642700271
import logging from json import JSONDecodeError import requests from django.conf import settings from utils.exceptions import APIHttpException, APIJsonException from .resources import ( ActionPlanMilestoneResource, ActionPlanResource, ActionPlanStakeholderResource, ActionPlanTaskResource, Barrier...
uktrade/market-access-python-frontend
utils/api/client.py
client.py
py
3,986
python
en
code
5
github-code
90
8473416356
n = int(input()) nums = list(map(int, input().split(' '))) res = 0 for i in nums: cnt = 0 if i == 1 : continue for j in range(2, i+1): if(i % j == 0): cnt+=1 if(cnt == 1): res += 1 print(res)
ji-hun-choi/Baekjoon
08.기본_수학2/01978.py
01978.py
py
244
python
en
code
1
github-code
90
73822511017
# coding=utf-8 import numpy as np from sklearn import datasets from sklearn.cross_validation import train_test_split from sklearn.metrics import mean_squared_error from sklearn.neighbors import KNeighborsRegressor import pandas as pd from sklearn.preprocessing import StandardScaler cali = datasets.california_housing...
helloexp/ml
ml/data_scince/c_thrid/b_knn/knn_regressor.py
knn_regressor.py
py
1,936
python
en
code
0
github-code
90
26437263184
from typing import List, Any from talipp.indicators.Indicator import Indicator from talipp.ohlcv import OHLCV class VWMA(Indicator): """ Volume Weighted Moving Average Output: a list of floats """ def __init__(self, period: int, input_values: List[OHLCV] = None): super().__init__() ...
nardew/talipp
talipp/indicators/VWMA.py
VWMA.py
py
722
python
en
code
177
github-code
90
71868302057
import socket import json # 获取本地ip def get_local_ip(): try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('8.8.8.8', 80)) ip = s.getsockname()[0] return ip except Exception: print("未联网或ip获取失败,ip将被置为空字符串") return '' finally: s.close(...
liblikewhen/common_util
system_util/system_util.py
system_util.py
py
622
python
en
code
1
github-code
90
18446144899
def resolve(): a = [] b = [] for i in range(3): A, B = map(int, input().split()) a.append(A) a.append(B) for j in range(1, 5): b.append(a.count(j)) if b.count(2) == 2 and b.count(1) == 2: print("YES") else: print("NO") resolve()
Aasthaengg/IBMdataset
Python_codes/p03130/s225811738.py
s225811738.py
py
300
python
en
code
0
github-code
90
582629615
from objectClass import * import bisect import os import struct from math import log10 import math from huff import * def computeScore(frequency, total, num): return (1+log10(frequency))*(log10(total/num)) class invertedIndex: def __init__(self): self.invertedList = invertedObject() self.filename = "./invert...
arikj/textIndexing
InvertedFile_compressed/invertedIndex.py
invertedIndex.py
py
5,858
python
en
code
0
github-code
90
28524888951
"""preProcessing.py: some tools for doing preprocessing on OpenFOAM cases, updating dictionaries and writing scripts to execute OpenFOAM cases on a computing cluster.""" import os import numpy as np def update_blockMeshDict(path, domain, mindist=None, nx=100, ny=100): """Replaces the minimum and maximum ...
bramvanderhoek/GrainSizeAnalysis
Python_Lib/preProcessing.py
preProcessing.py
py
15,103
python
en
code
0
github-code
90
71805399657
from typing import Dict, List import operation_loader import sys from gfsm.transition import Transition from gfsm.state import State from gfsm.action import fsm_action class FsmBuilder(): def __init__(self, config: Dict, definition: Dict): self._config = config self._definition = definition self._actio...
ekarpovs/gfsm
gfsm/fsm_builder/fsm_builder.py
fsm_builder.py
py
4,490
python
en
code
0
github-code
90
2461844791
class Solution(object): def checkValid(self, matrix): """ :type matrix: List[List[int]] :rtype: bool """ transposed = zip(*matrix) rng = list(range(1, len(matrix) + 1)) transposed = list(map(lambda x: list(x), transposed)) for i in xrange(len(matrix)):...
petrosDemetrakopoulos/Leetcode
code/Python/2133-CheckIfEveryRowAndColumnContainsAllNumbers.py
2133-CheckIfEveryRowAndColumnContainsAllNumbers.py
py
600
python
en
code
0
github-code
90
40307766672
#!/usr/bin/env python-sirius """.""" import sys from siriuspy.search import PSSearch from siriuspy.namesys import SiriusPVName from siriuspy.pwrsupply.data import PSData def get_all_psnames(): """.""" pss = PSSearch() # psn = pss.get_psnames() + li_psnames psn = pss.get_psnames() psnames = [Siriu...
lnls-sirius/scripts
bin/sirius-script-app-ps-pvsprint.py
sirius-script-app-ps-pvsprint.py
py
2,476
python
en
code
0
github-code
90
932784150
import requests # go here to create a token for your app # https://www.yammer.com/client_applications token = "MYTOKENGOESHERE" # this is the community ID groupID = "78686445568" page = 1 pagesize = 50 endpoint = "https://www.yammer.com/api/v1/users/in_group/{}.json?page={}".format(groupID,page) headers = {"Authoriza...
vivamau/vivamau_scripts
yammer_UsersInACommunity.py
yammer_UsersInACommunity.py
py
889
python
en
code
0
github-code
90
11552315040
#! /usr/bin/python3 from collections import defaultdict class Graph: def __init__(self): ''' using default dict to store edges & weights of initialized graph ''' self.graph = defaultdict(dict) def addEdge(self, u, v, weight=1): ''' adding edges u->v with weight or 1 otherwise ''' ...
naveenrajm7/py-algo-ds
graph/dijkstra.py
dijkstra.py
py
2,456
python
en
code
0
github-code
90
22665969340
SHARE_DEFAULT_FIELDS = [ 'dynamics.wrf_core', 'domains.max_dom', 'domains.timespan.start_date', 'domains.timespan.end_date', 'running.input.interval_seconds', ('geogrid.io_form', 'io_form_geogrid'), ] GEOGRID_DEFAULT_FIELDS = [ 'domains.parent_id', 'domains.geometry.parent_grid_ratio', ...
tdm-project/tdm-tools
tdm/wrf/constants.py
constants.py
py
7,254
python
en
code
0
github-code
90
18269083719
l=input("").split(" ") a=int(l[0]) b=int(l[1]) c=int(l[2]) if(a==b and a==c): print("No") elif((a-b)*(b-c)*(c-a)==0): print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p02771/s839843245.py
s839843245.py
py
160
python
en
code
0
github-code
90
18476426229
def is_753(n): n = str(n) return(n.count("7") >= 1 and n.count("3") >= 1 and n.count("5") >= 1) n = int(input()) v = [7, 5, 3] li = [] prev = [7, 5, 3] for i in range(9): tmp = [] for j in v: for k in prev: tmp.append(k * 10 + j) prev = tmp li = li + prev li = [x for x ...
Aasthaengg/IBMdataset
Python_codes/p03212/s766035094.py
s766035094.py
py
366
python
en
code
0
github-code
90
71248172137
from collections import deque from sys import maxsize def citire(orientat=False,nume_fisier="b4.in"): n=0 la=[] with open(nume_fisier) as f: linie=f.readline() n,m=(int(z) for z in linie.split()) la=[[] for i in range(n+1)] for i in range(m): x,y=(int(z) for z i...
DanNimara/FundamentalAlgorithms-Graphs
Lab1/B4.py
B4.py
py
1,537
python
en
code
0
github-code
90