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
10815957206
day = "Friday" temperature = 30 raining = False if day == "Saturday" and temperature > 27 and not raining: print("Go swimming") else: print("Learn Python") if (day == "Saturday" and temperature > 27) or not raining: print("Go swimming") else: print("Learn Python") #() are added because and has higher ...
btemovska/Section4
TrueFalse.py
TrueFalse.py
py
368
python
en
code
0
github-code
90
18331860249
n = int(input()) l = sorted(map(int, input().split())) cnt = 0 m = n-1 g = [] for i in range(n): for j in range(i): g.append(l[i]+l[j]) g = sorted(g,reverse = True) for i in g: while l[m] >= i: m-=1 cnt += n-m-1 print(n*(n-1)*(n-2)//6-cnt)
Aasthaengg/IBMdataset
Python_codes/p02888/s621464113.py
s621464113.py
py
253
python
en
code
0
github-code
90
6137487690
from pathlib import Path import numpy as np import xarray as xr from datetime import timedelta # params max_nan_consecutive = 31 # 最大连续缺测 max_nan_rate = 0.05 # 最大缺测占比 time_period = [1961, 2020] # 提取时间段 path = Path.cwd() filename_output = 'observation_interpolation' + '_' + str(max_nan_consecutive) + '_' + str( ...
Koni2020/SWFU
Python/Spatial analysis/Batch extraction/extract_observation.py
extract_observation.py
py
1,487
python
en
code
2
github-code
90
18107941959
def insertionSort(A, n, g): cnt = 0 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 cnt += 1 A[j+g] = v return cnt def shellSort(A, n): cnt = 0 nn = n G = [] g = 1 while g <= ...
Aasthaengg/IBMdataset
Python_codes/p02262/s138951593.py
s138951593.py
py
614
python
en
code
0
github-code
90
18032767219
import heapq n,m = map(int,input().split()) abc = [list(map(int,input().split())) for _ in range(m)] edges = [[] for _ in range(n)] for a,b,dis in abc: edges[a-1].append((b-1, dis)) edges[b-1].append((a-1, dis)) def dijkstra(edges, s): hq = [] d = [-1] * n d[s] = 0 heapq.heappush(hq, (0, s)) ...
Aasthaengg/IBMdataset
Python_codes/p03837/s142308561.py
s142308561.py
py
686
python
en
code
0
github-code
90
1442175997
import boto3 from typing import Tuple from enum import Enum from datetime import datetime from time import mktime from config import Config from aws_xray_sdk.core import xray_recorder ddb_client = boto3.client('dynamodb', region_name=Config.REGION_NAME) class DownloadStatus(Enum): NONE='NONE', ERROR='ERROR' IN_...
dr-natetorious/Dissertation
cdk/src/pipeline/collection/status.py
status.py
py
3,958
python
en
code
0
github-code
90
26288444464
class Solution: def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ last = -1 index = 0 if len(nums) == 0: return 0 for i in range(len(nums)): if index + 1 == len(nums): break ...
wwg377655460/DataStructureToLeetCode
problem_26.py
problem_26.py
py
619
python
en
code
0
github-code
90
2442490155
class Solution(object): def isSubsequence(self, s, t): """ :type s: str :type t: str :rtype: bool """ dp = [[0 for i in xrange(len(t)+1)] for j in xrange(len(s)+1)] for j in xrange(len(t)+1): dp[0][j] = 1 for i in xrange(1, len(s)+1): for j in xrange(1, len(t)+1): if s[j-1] == t[i-1]: dp...
sangreal/PyLintcode
py/IsSubsequence.py
IsSubsequence.py
py
433
python
en
code
0
github-code
90
20616060295
from itertools import product text = input() k,l,t = map(int,input().split(" ")) chars = "ACGT" def doesFormClump(pattern): for i in range(0,len(text)-l+1): subText = text[i:i+l] freq = subText.count(pattern) if freq>=t: return True return False for i in product(chars,re...
Shadat-tonmoy/BioinformaticsRosalindProblems
Lab Tasks/Day - 03/Subtask1.py
Subtask1.py
py
399
python
en
code
0
github-code
90
18301530499
from collections import deque N = int(input()) A = deque(list(map(int, input().split()))) ans = 0 cnt = 1 while A: a = A.popleft() if cnt == a: cnt += 1 continue else: ans += 1 if ans == N: print(-1) else: print(ans)
Aasthaengg/IBMdataset
Python_codes/p02832/s064507519.py
s064507519.py
py
261
python
en
code
0
github-code
90
32819140385
import pygame from pygame.locals import * from random import randint def randpoint (screen): h,w = screen.get_size() return randint(0, w-1), randint(0, h-1) def main(): pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("My first drawing.") screen.fill((200, ...
geofmatthews/csci321
PygameDemos/0100lines/drawlines.py
drawlines.py
py
819
python
en
code
2
github-code
90
35865584214
import datetime import csv def parseLog(filename, searchToken): results={} file = open(filename) # open log file for line in file: # for each in the file - read the line if searchToken in line: components = line.split(":") date = components[0] results[date] = resul...
Garethh-M/Bug-Counter
bug finder.py
bug finder.py
py
1,218
python
en
code
0
github-code
90
18103285418
from google.colab import drive drive.mount('/content/drive') import numpy as np import matplotlib.pyplot as plt # here we are working on Tensorflow version 2.1.0 so we need to write tensorflow.keras. #keras is in built function in Tensorflow. import os import tensorflow import tensorflow as tf from tensorflow.keras.p...
sanal-l-s/handwritten_equation_solver
Backend/Model/CNN_VGG16_Hand_written.py
CNN_VGG16_Hand_written.py
py
4,384
python
en
code
0
github-code
90
41900913864
from collections import deque import sys def maxcost(graph, src, t): used = set() ldag = deque() def topological_sort(u): used.add(u) for v, c in graph[u]: if v not in used: topological_sort(v) ldag.append(u) topological_sort(src) cost = [-1]*len(...
SingularityUrBrain/math-programming
MaxCostPath/solution.py
solution.py
py
886
python
en
code
2
github-code
90
13674482940
""" The "report.py" saves the optimization results in given path as spreadsheet """ __author__ = "Zhengjie You" __copyright__ = "2020 TUM-EWK" __credits__ = [] __license__ = "GPL v3.0" __version__ = "1.0" __maintainer__ = "Zhengjie You" __email__ = "zhengjie.you@tum.de" __status__ = "Development" from datetime import...
tum-ewk/OpenTUMFlex
opentumflex/optimization/report.py
report.py
py
1,087
python
en
code
20
github-code
90
33672553649
from collections import OrderedDict from cab_driver import CabDriver from cab_rider import CabRider if __name__ == "__main__": # Suppose entries are comma separated values # Take Data inputs entries = int(input()) drivers = OrderedDict() users = OrderedDict() for _ in range(entries): ...
jalotra/Youtube-LLD
src/main.py
main.py
py
1,409
python
en
code
0
github-code
90
21459071176
from importlib.resources import is_resource import astropy.io.ascii as asc import pandas as pd import numpy as np from scipy.stats import norm import astropy.units as u import dgf.galaxy_utils.isochrone as isochroneModel from IPython import embed # ------- DEFAULT VARIABLES ------- # # ic_file = "Isochrones/iso_age_1...
jaybaptista/satellites
dgf/galaxy_utils/generate.py
generate.py
py
5,080
python
en
code
0
github-code
90
74049300457
import unittest import onitama as oni import ai from constants import * from evaluators import * class TestGame(unittest.TestCase): def setUp(self): self.game = oni.Game([oni.TIGER, oni.TIGER, oni.TIGER, oni.TIGER, oni.TIGER]) self.ai = ai.create_ai(version='unmove', game=self.game) self.ai...
arduy/onitama
aitests.py
aitests.py
py
5,248
python
en
code
4
github-code
90
29102168171
from discord.ext import commands import time class Utility(commands.Cog): def __init__(self, client): self.client = client @commands.command() async def ping(self, ctx): start = time.perf_counter() message = await ctx.send("Ping...") end = time.perf_counter() dura...
nipunrautela/KoDS-Bot
cogs/utility.py
utility.py
py
537
python
en
code
1
github-code
90
25168395565
import csv from decimal import Decimal from django.contrib.auth.decorators import login_required from django.template.loader import get_template from django.views.generic import ListView from .models import * from .forms import * from django.shortcuts import render, get_object_or_404 from django.shortcuts import redir...
lgkiemde/Maverick-Food-Service
crm/views.py
views.py
py
8,040
python
en
code
0
github-code
90
18443597469
def gcd(x,y): if x < y: x,y = y,x if x%y == 0: return y return gcd(y,x%y) n=int(input()) a=list(map(int,input().split())) ans=a[0] for i in range(1,len(a)): ans = gcd(ans,a[i]) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03127/s086401964.py
s086401964.py
py
239
python
en
code
0
github-code
90
37930850394
from typing import List class Solution: # Time Complexity: # O(logn) in best case, and O(n) in worst case. # With duplicates, sometimes we do not know which way to explore. # Worst Case: All equal in nums and target does not belong to nums. # Space Complexity: O(1). def search(self, nums...
saubhik/leetcode
problems/search_in_rotated_sorted_array_ii.py
search_in_rotated_sorted_array_ii.py
py
1,999
python
en
code
3
github-code
90
17634544917
import re,urllib from resources.lib.libraries import client def resolve(url): try: id = url.split("?v=")[-1].split("/")[-1].split("?")[0].split("&")[0] result = client.request('http://www.youtube.com/watch?v=%s' % id) message = client.parseDOM(result, 'div', attrs = {'id': 'unavailable-su...
mrknow/filmkodi
plugin.video.fanfilm/resources/lib/resolvers/youtube.py
youtube.py
py
1,569
python
en
code
66
github-code
90
72092532776
from kiwoom import Kiwoom from dbwrapper import MongoDB from pdreader import PDReader from webscraper import SejongScraper from processtracker import ProcessTracker, timeit from PyQt5.QtWidgets import * from PyQt5.QAxContainer import * from PyQt5.QtCore import * import os, time, json import _pickle as pickle from path...
ppark9553/safer
Gobble/gobble.py
gobble.py
py
3,706
python
en
code
0
github-code
90
18259187209
def main(): s = str(input()) q = int(input()) lst = [list(map(str, input().split())) for _ in range(q)] switch = 0 # 0が通常 1が前 str_lst = [s] front_lst = [] for i in range(q): if lst[i][0] == '1': switch = 1 - switch else: f = lst[i][1] c...
Aasthaengg/IBMdataset
Python_codes/p02756/s556793551.py
s556793551.py
py
899
python
en
code
0
github-code
90
37118900793
class Solution(object): def search(self, array, target): """ input: int[] array, int target return: int """ # write your solution here if len(array) == 0: return -1 left, right = 0, len(array)-1 while left+1 < right: mid = left+...
nanw01/python-algrothm
Python Algrothm Advanced/practice/050104findinrotatedarray copy 2.py
050104findinrotatedarray copy 2.py
py
915
python
en
code
1
github-code
90
25521928885
import webob from oslo_config import cfg from oslo_log import log as logging from guts.api import extensions from guts.api.openstack import wsgi from guts import exception from guts import objects from guts import rpc LOG = logging.getLogger(__name__) CONF = cfg.CONF authorize = extensions.extension_authorizer('mi...
th3architect/guts
guts/api/v1/instances.py
instances.py
py
2,220
python
en
code
null
github-code
90
13656489605
# -*- encoding:utf-8 -*- """ This script provides an exmaple to wrap UER-py for classification. """ import torch import json import random import argparse import collections import torch.nn as nn from uer.utils.vocab import Vocab from uer.utils.constants import * from uer.utils.tokenizer import * from uer.model_buil...
LuoXukun/Bert_LSTM_CRF
run_classifier.py
run_classifier.py
py
20,048
python
en
code
3
github-code
90
43356924871
from typing import List from enum import Enum, auto from time import time import random from Models.RL.blackjack_simple import MCAgent from Models.RL.Envs.blackjack_splitting import BlackjackEnvSplit, sum_hand, usable_ace from Game_Engines.base_engine import BaseEngine class BJStates(Enum): """ State-machine...
dragosconst/licenta
code/Game_Engines/bj_enginge.py
bj_enginge.py
py
12,215
python
en
code
0
github-code
90
20594109817
from transitions import Machine from ClassDiagramWally import* from Robot_Wally import* accionamiento=Robot_Wally() states=['home','exploracion','reconocimiento_objetos','deteccion','posicionar_garra','orientar_garra','medir_distancia','mover_garra','agarrar','depositar','verificar_reecoleccion','siguiente_cate...
AndresFp22/Robot_Wally_AyJ
STM_Wally.py
STM_Wally.py
py
2,157
python
es
code
1
github-code
90
45139472113
from kivy.core.window import Window from kivy.utils import get_color_from_hex as hex from kivy.uix.button import Button from kivymd.uix.screen import MDScreen from kivymd.uix.floatlayout import MDFloatLayout from kivymd.uix.textfield import MDTextField from kivymd.uix.label import MDLabel from kivymd.uix.button ...
Rodrigo-Duarte-8128/expenses-tracker
screens/transfers_screens/edit_recurring_transfer_screen.py
edit_recurring_transfer_screen.py
py
17,765
python
en
code
0
github-code
90
18314932079
from collections import defaultdict as dd N, K = map(int, input().split()) a = list(map(int, input().split())) b = [val-1 for val in a] c = [0]*(N+1) for i,val in enumerate(a): c[i+1] = (c[i] + val-1)%K dic = dd(int) K2 = min(N,K-1) right = K2 for k,val in enumerate(c[1:K2+1]): dic[val] += 1 res = 0 # 左端を動かしてい...
Aasthaengg/IBMdataset
Python_codes/p02851/s670937893.py
s670937893.py
py
523
python
en
code
0
github-code
90
18383026739
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, X, *L = map(int, read().split()) ans = 1 d = 0 for l in L: d += l if d <= X: ans += 1 el...
Aasthaengg/IBMdataset
Python_codes/p03000/s033764393.py
s033764393.py
py
413
python
en
code
0
github-code
90
33411077577
from flask import Flask, request, render_template # from random import choice, sample from flask_debugtoolbar import DebugToolbarExtension from stories import Story app = Flask(__name__) app.config['SECRET_KEY'] = "oh-so-secret" debug = DebugToolbarExtension(app) @app.route('/') def index(): """Return homepage....
ninadel/Springboard-SWE-Exercises
ex_24-2_flaskjinja/flask-madlibs/app.py
app.py
py
926
python
en
code
0
github-code
90
26500992130
game_board = [] start = None goal = None # read 12.txt into game_board, the board should be a list of characters # each line should be a list of characters with open('12.txt', 'r') as f: for line in f: game_board.append(list(line.strip())) if 'S' in line: start = (len(game_board) - 1, l...
hallis21/AOC22
12/12.py
12.py
py
3,334
python
en
code
0
github-code
90
27654386035
from typing import List import os import logging from commons import utils, bq_client from inference.nn_model_training import net_training_fn from sklearn.compose import ColumnTransformer from sklearn.preprocessing import OneHotEncoder, StandardScaler, OrdinalEncoder, LabelEncoder from sklearn.impute import SimpleImp...
thorrester/ML_EXAMPLE
entry_points/inference/training.py
training.py
py
7,243
python
en
code
0
github-code
90
46181672270
'''chat_client.py.''' import sys import socket import select def chat_client(): '''Client.''' if len(sys.argv) < 3: print("Usage : python chat_client.py hostname port") sys.exit() host = sys.argv[1] port = int(sys.argv[2]) soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
dhanraju/python
sock_prog/cli_serv/chat_app/chat_client.py
chat_client.py
py
1,597
python
en
code
0
github-code
90
39767488242
from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, BooleanField, SelectField from wtforms.validators import InputRequired, URL, Optional, NumberRange class AddPetForm(FlaskForm): name = StringField('Pet Name', validators=[InputRequired(message="Name is required")]) species = Select...
TaraDenniston/adopt
forms.py
forms.py
py
801
python
en
code
0
github-code
90
9891821008
import time from dataclasses import dataclass from email.utils import formatdate, mktime_tz, parsedate_tz from typing import Iterable, Mapping, Optional, Tuple, Union from seleniumwire.thirdparty.mitmproxy.coretypes import multidict from seleniumwire.thirdparty.mitmproxy.net.http import cookies, status_codes, message ...
wkeeling/selenium-wire
seleniumwire/thirdparty/mitmproxy/net/http/response.py
response.py
py
6,967
python
en
code
1,689
github-code
90
18174441449
import os import sys import math import heapq from decimal import * from io import BytesIO, IOBase from collections import defaultdict, deque def r(): return int(input()) def rm(): return map(int,input().split()) def rl(): return list(map(int,input().split())) def chk(mid,a,n,k): cuts=0 for i in a:...
Aasthaengg/IBMdataset
Python_codes/p02598/s531270698.py
s531270698.py
py
631
python
en
code
0
github-code
90
21358537955
# requires: gtts import os from gtts import gTTS from telethon.tl.types import DocumentAttributeAudio from telethon.errors import MessageEmptyError, TimeoutError from telethon import events from .. import loader, utils def register(cb): cb(SayTextMod()) class SayTextMod(loader.Module): strings = {"name": "S...
nickname0q/Friendly_Telegram
SayText.py
SayText.py
py
1,662
python
ru
code
0
github-code
90
70764020136
import pygame as pg import pytmx # import sys # from os import path # # ---- # # import pygame # import pytmx # # import cv2 # # ---- # # # from strings import * # # # ---- # # # def collide_hit_rect(one, two): # return one.hit_rect.colliderect(two.rect) class TiledMap: def __init__(self, filename): tm ...
AnthonyMc0525/PokemonGame
src/tiledmap.py
tiledmap.py
py
1,414
python
en
code
0
github-code
90
9178615925
import sys import os import os.path as osp import math import time import requests import zipfile, tarfile, gzip import torch from glob import glob from tqdm import tqdm def download_file(url, filepath): """Downloads a file from the given URL.""" print("Downloading %s..." % url) r = requests.get(url, stre...
atomicoo/Tacotron2-PyTorch
utils/common.py
common.py
py
3,274
python
en
code
12
github-code
90
28042448127
'''Display images and predicted masks using streamlit''' import torch import torchvision.transforms as transforms import numpy as np import streamlit as st import os import argparse import skimage.io as io import src.utils as utils import torch import numpy as np from PIL import Image from src.models import ResNetMode...
HongshanLi/TreeDetector
streamlit_proj.py
streamlit_proj.py
py
5,284
python
en
code
5
github-code
90
4317804831
class Graph(): def __init__(self,v,g): self.v = v self.g = g def dijkstra(self,src): dist=[9999]*self.v mst=[False]*self.v dist[src]=0 for cout in range(self.v-1): u = self.mindist(dist, mst) mst[u] = True for...
saikat519/Algorithms
dijkstra.py
dijkstra.py
py
1,526
python
en
code
0
github-code
90
71183789737
''' Sorts title candidates for a given document ''' # built-in import os import argparse import pdb import json import pickle import logging # external import pandas as pd # customs import data import engine import utils logging.basicConfig(level=logging.DEBUG) def main( data_path, train_data_path, va...
yoshihikoueno/TitleEstimator
main.py
main.py
py
3,642
python
en
code
0
github-code
90
35788935275
# from kinematic import * # from DDkinematic_final import * from uproot import open from os import listdir from fnmatch import filter from numpy import ravel, unique, array, empty, concatenate, ones, logical_and from numpy import abs as np_abs from numpy.random import choice # from DD_utils_final import isolate_int, co...
DimaPdemler/HNLclassifier
utils/DD_data_extractor_git.py
DD_data_extractor_git.py
py
63,747
python
en
code
0
github-code
90
28062940628
#!/usr/bin/env python # coding: utf-8 # In[ ]: class Customer(object): def __init__(self, first_name = '', last_name = '', phone_num = None, zip_code = None, freq_mil_num = None): self.first_name = first_name self.last_name = last_name self.phone_num = phone_num se...
les1smore/Pizza-Ordering-in-OOP
5_Customer.py
5_Customer.py
py
1,113
python
en
code
2
github-code
90
72318645418
from django.conf.urls import patterns, url from sharetools import views urlpatterns = patterns('sharetools.views', #User/Profile ----------------------------------------------------------- url(r'^register/$', views.RegisterView.as_view(), name='register'), url(r'^login/$', views.LoginView.as_view(), name='login')...
dxslly/toolshare
sharetools/urls.py
urls.py
py
1,886
python
en
code
0
github-code
90
30200516846
import hashlib # for hashlib.md5 key = 'bgvyzdsv' i = 0 while True: encoded = (key + str(i)).encode('utf-8') digest = hashlib.md5(encoded).hexdigest() # if digest[0:6] == '000000': # part2 if digest[0:5] == '00000': # part1 break i += 1 print(f'The answer is {i}')
MarcinKozak005/AdventOfCode
2015/04.py
04.py
py
297
python
en
code
0
github-code
90
18321277789
class Factorial(): def __init__(self, mod=10**9 + 7): self.mod = mod self._factorial = [1] self._size = 1 self._factorial_inv = [1] self._size_inv = 1 def fact(self, n): ''' n! % mod ''' if n >= self.mod: return 0 if self._size < n+1: ...
Aasthaengg/IBMdataset
Python_codes/p02862/s518924964.py
s518924964.py
py
1,937
python
en
code
0
github-code
90
71740963498
def pal(n): temp=n rev=0 while n!=0: d=n%10 rev=rev*10+d n=n//10 if rev==temp: print(rev," is palindrome") else: print("not a palindrome") return rev num=int(input("enter a number")) result=pal(num) print()
gollabharadwaj/python
palindrome or not.py
palindrome or not.py
py
306
python
en
code
0
github-code
90
2934501919
import os import numpy as np import tensorflow as tf from tensorflow.python.platform import resource_loader from tflite_micro.python.tflite_micro.signal.ops import framer_op from tflite_micro.python.tflite_micro.signal.utils import util class FramerOpTest(tf.test.TestCase): _PREFIX_PATH = resource_loader.get_pat...
tensorflow/tflite-micro
python/tflite_micro/signal/ops/framer_op_test.py
framer_op_test.py
py
4,721
python
en
code
1,398
github-code
90
29486972827
t1 = ("Ayush", "Tripathi") t2 = ("Sakshi", "Shete") list1 = [] for i in range(0, 2): list1.append(t1[i]) for i in range(0, 2): list1.append((t2[i])) def Convert(a): it = iter(a) res_dct = dict(zip(it, it)) return res_dct print(Convert(list1))
ayush-t02/python-practice
tuple-list-dict.py
tuple-list-dict.py
py
285
python
en
code
0
github-code
90
3013248906
import importlib import inspect from typing import Callable, Mapping, TypedDict, TypeVar ArgType = TypeVar("ArgType") ReturnType = TypeVar("ReturnType") FunctionType = Callable[[ArgType], ReturnType] __all__ = ["build_fn_kwargs", "smart_instantiate"] def _is_var_kwargs(p: inspect.Parameter): return p.kind == in...
shichao-wang/CRNet-ISWC2022
src/molurus/functions.py
functions.py
py
2,128
python
en
code
0
github-code
90
15469135351
import cv2 from keras.models import load_model import numpy as np model = load_model('keras_model.h5') capture = cv2.VideoCapture(0) data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32) while True: ret, frame = capture.read() resized_frame = cv2.resize(frame, (224, 224), interpolation=cv2.INTER_ARE...
kumar2020/RPS
RPS_model.py
RPS_model.py
py
671
python
en
code
0
github-code
90
21473387425
# Shows example of SimpleSpriteSheetAnimation object # 1 - Import library import pygame from pygame.locals import * import sys import pygwidgets from SimpleSpriteSheetAnimation import * # 2 Define constants SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 FRAMES_PER_SECOND = 30 BGCOLOR = (0, 128, 128) # 3 - Initialize the wor...
IrvKalb/Object-Oriented-Python-Code
Chapter_14/SimpleSpriteSheetAnimation/Main_SimpleSpriteSheetAnimation.py
Main_SimpleSpriteSheetAnimation.py
py
1,315
python
en
code
207
github-code
90
26112034269
from libqtile import bar, layout, widget from libqtile.config import Click, Drag, Group, Key, Match, Screen from libqtile.lazy import lazy #from libqtile.utils import guess_terminal import subprocess import os # ================================ CONSTANTES SECTIONS =================================================== #...
moiseR29/.dotfiles
.config/qtile/config-old.py
config-old.py
py
15,375
python
en
code
0
github-code
90
27020818406
import csv import importlib import subprocess import webbrowser import os import random import requests import re import sys import pandas as pd import numpy as np from PyQt5.QtWidgets import (QTableView, QHeaderView , QMessageBox, QApplication, QMainWindow, QFileDialog, QAction, QTableWidget, QTextEdit, QTableWidgetIt...
GeoPyTool/GeoPyLite
Basement.py
Basement.py
py
10,729
python
en
code
0
github-code
90
5969801161
# This sample code uses the Appium python client v2 # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python from appium import webdriver from appium.webdriver.common.appiumby import AppiumBy from time import sleep # For W3C actions from selenium.webdriver.common.action_chain...
xiaocongsen/MakeDown_File
python/测试软件Appium学习/签到/肯德基.py
肯德基.py
py
3,461
python
en
code
0
github-code
90
9512471902
from __future__ import print_function """ base class for generating code appropriate to the selected backend """ from ctree.visitors import NodeVisitor from ctree.util import flatten class CodeGenVisitor(NodeVisitor): """ Return a string containing the program text. """ def __init__(self, indent=0):...
mbdriscoll/ctree
ctree/codegen.py
codegen.py
py
1,809
python
en
code
3
github-code
90
16687355563
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # Time: O(n) # Space: O(1) # https://leetcode.com/problems/same-tree class Solution: def isSameTree(self, p: Optional[Tree...
jpal91/leetcode
Python/same-tree.py
same-tree.py
py
1,068
python
en
code
0
github-code
90
34372456680
#controllers/backend/categories/edit.py import config from bottle import template from copy import deepcopy from models.categorydb import editdb def call(id): kdict = deepcopy(config.kdict) kdict['pageTitle'] = 'ទំព័រ​កែប្រែ' kdict['route'] = 'category' kdict['edit'] = True categories,...
Sokhavuth/khmerweb-multimedia
controllers/backend/categories/edit.py
edit.py
py
553
python
en
code
0
github-code
90
33696424710
from typing import Any, List, Tuple import numpy as np import tensorflow as tf import tensorflow.keras as keras def convolution( features: int, k_size: int, strides: int = 1, bias: bool = True, name: str = None ): return keras.layers.Conv2D( features, k_size, strides, use_bias=bias, padding="same", na...
dblincoe/csds-438-super-resolution
models/common.py
common.py
py
5,858
python
en
code
1
github-code
90
72289509418
import warnings import copy import sys class Node: def __init__(self, name, neighbors=[], occupant=None, occupiable=True): self.name = name self.neighbors = set(neighbors) self.occupant = occupant self.occupiable = occupiable def connect(self, neighbor): self.neighb...
jlazear/advent2021
day23/amphipods.py
amphipods.py
py
8,096
python
en
code
0
github-code
90
12848491465
from fastapi_pagination import Params, paginate from loguru import logger from clients.remote_component_client import remote_component_client from core.enum.component_enum import is_state from database.session import SessionClass from repository.application.application_repo import application_repo from repository.comp...
wutong-paas/wutong-console
service/mnt_service.py
mnt_service.py
py
11,761
python
en
code
6
github-code
90
23585174541
from matplotlib import pyplot as plt variance = [1, 2, 4, 8, 16, 32, 64, 128, 256] bias_squared = [256, 128, 64, 32, 16, 8, 4, 2, 1] # Суммарная ошибка total_error = [x + y for x, y in zip(variance, bias_squared)] xs = [i for i, _ in enumerate(variance)] print(xs) plt.plot(xs, variance, 'g-', label='дисперсия') plt...
1mmo/data-science-learning
LineGraphs.py
LineGraphs.py
py
640
python
ru
code
0
github-code
90
19921171426
import os import json import sys import copy import torch import argparse from tqdm import tqdm sys.path.append('../../../') sys.path.append('../../../python_parser') from python_parser.run_parser import get_identifiers, remove_comments_and_docstrings, get_example_batch from utils import _tokenize from trans...
tianzhaotju/CODA
test/CloneDetection/dataset/get_reference.py
get_reference.py
py
8,676
python
en
code
5
github-code
90
7593781060
# coding = utf-8 import sys import os from PyQt5 import QtWidgets from PyQt5.QtWidgets import (QApplication, QMenuBar, QGridLayout, QPushButton, QDialog, QLabel, QTableView, QHeaderView, QLineEdit, QFormLayout, QMessageBox, QFileDialog) from PyQt5.QtGui import QPixmap, QFont, QImage from Py...
ULTRAMANSE/maxface
UIface.py
UIface.py
py
27,958
python
en
code
0
github-code
90
2334871256
import pandas as pd import numpy as np from model.gmf import GMFEngine from model.mlp import MLPEngine from model.neumf import NeuMFEngine from data import SampleGenerator import os import torch torch.cuda.is_available() import argparse # procedures on training each model def train_model(model, config): engine =...
sleung852/tdc-product-recommendation
train_v3.py
train_v3.py
py
5,202
python
en
code
0
github-code
90
18582683919
import sys Q = int(input()) pair = [] MAX = 0 for i in range(Q): l, r = map(int, input().split()) MAX = max(MAX, l, r) pair.append((l, r)) N = 101010 N = 25 N = MAX + 1 is_prime = [1 for i in range(N)] is_prime[0] = is_prime[1] = 0 # sieve for i in range(2, N): if not is_prime[i]: # 0, 1, ...
Aasthaengg/IBMdataset
Python_codes/p03476/s437285248.py
s437285248.py
py
818
python
en
code
0
github-code
90
14012231198
import json import os import deepspeed import torch from deepspeed.ops.adam import DeepSpeedCPUAdam, FusedAdam from transformers.modeling_utils import no_init_weights from elixir.kernels.attn_wrapper import wrap_attention from elixir.utils import get_model_size from example.common.models import get_model def train_...
hpcaitech/Elixir
example/common/ds.py
ds.py
py
1,995
python
en
code
8
github-code
90
22436531168
import asyncio import logging import os import time from datetime import datetime from PyDictionary import PyDictionary from userbot import TEMP_DOWNLOAD_DIRECTORY, bot from userbot.events import register from userbot.utils import progress @register(outgoing=True, pattern=r"^\.def(?: |$)(.*)") async def _(event): ...
niteshraj2310/RemixGeng
userbot/modules/test.py
test.py
py
7,557
python
en
code
9
github-code
90
71795060137
import scrapy from design.items import DesignItem import json data = { 'channel': 'laisj', 'evt': 3, } class DesignCaseSpider(scrapy.Spider): name = 'laisj' allowed_domains = ['www.laisj.com'] page = 1 def start_requests(self): yield scrapy.FormRequest( u...
LIMr1209/Internet-worm
design/design/spiders/laisj.py
laisj.py
py
2,114
python
en
code
0
github-code
90
14013963706
from django.shortcuts import render,redirect from django.contrib import messages from .forms import Productaddform from .models import ProductForCustomer,CustomerCheckout from Home.models import UserData from django.contrib.auth.decorators import login_required import razorpay from django.conf import settings from dja...
pramodthundathil/Smartfarm
Products/views.py
views.py
py
7,268
python
en
code
0
github-code
90
40239596698
# -*- coding: utf-8 -*- """ Created on Sun Jan 3 15:34:06 2021 @author: SethHarden """ import sys class Solution(object): fp = 0 def read(buf, n): """ :type buf: Destination buffer (List[str]) :type n: Number of characters to read (int) :rtype: The number of ac...
sethmh82/SethDevelopment
Practice/Read-Buffer.py
Read-Buffer.py
py
708
python
en
code
1
github-code
90
10544729886
import config from other.colors import bcolors as bcolors def enter(BuySell): if config.mode == 'live': direction = True if BuySell == "S": direction = False try: config.con.open_trade(symbol=config.currency, is_buy=direction, amount=config.amount, ...
SillyDEV/Market-Finance-Introduction-Forex
update/buyAndSell.py
buyAndSell.py
py
3,769
python
en
code
0
github-code
90
32452926319
from sys import stdin import sys sys.setrecursionlimit(10000) stdin = open("input.txt", "r") row_max, col_max = map(int, stdin.readline().split()) height_ary = [list(map(int, stdin.readline().split())) for _ in range(row_max)] check = [[-1] * col_max for _ in range(row_max)] check[row_max - 1][col_m...
choekko/algorithm
Python/inJungle/4주차/시험2tmp.py
시험2tmp.py
py
1,972
python
ko
code
0
github-code
90
44996270049
#Module_Name: initProject #Author: Dahir Muhammad Dahir #Date: 27-February-2018 #About: this module initialize the projects, allows the user # to choose what the want to do. from startNewProject import startNewProject from continueExistingProject import continueExistingProject from updateExistingProject import u...
Ethic41/codes
python/dmcrawl/modules/initProject.py
initProject.py
py
2,058
python
en
code
1
github-code
90
86592238498
import decimal import re from enum import Enum from typing import Optional, Union from boto3.dynamodb.conditions import Key from boto3.dynamodb.types import TypeSerializer, TypeDeserializer from botocore.exceptions import ClientError from typhoon.aws.boto3_helper import boto3_session from typhoon.aws.exceptions impor...
typhoon-data-org/typhoon-orchestrator
typhoon/aws/dynamodb_helper.py
dynamodb_helper.py
py
6,091
python
en
code
29
github-code
90
18895315715
def one_binary_function(key, string): string_ord = [] binary_ord = [] cipher_list = [] final_list = [] for c in string: string_ord.append(ord(c)) for i in string_ord: binary_ord.append(bin(i)) binary_key = bin(key) counter = 0 for b in binary_ord:...
Patchyst/XOR-Encryption-GUI
encryption1function.py
encryption1function.py
py
581
python
en
code
1
github-code
90
18386900339
#https://atcoder.jp/contests/diverta2019-2/submissions/11229318 n = int(input()) t = [tuple(map(int, input().split())) for _ in range(n)] s = set(t) cnt = 0 for i in range(n-1): for j in range(i+1,n): u,v = t[i] x,y = t[j] p = u-x; q = v-y c = sum((x-p, y-q) in s for x,y in t) if cnt < c: cnt = c ...
Aasthaengg/IBMdataset
Python_codes/p03006/s835988517.py
s835988517.py
py
333
python
en
code
0
github-code
90
13266318402
# !/user/bin/env python # -*- coding:utf-8 -*- # author:Zfy date:2021/9/4 17:46 import math def func(m, n): sum = 0 for i in range(n): sum += m m = math.sqrt(m) return round(sum, 2) print(func(2, 2))
feiyu7348/python-Learning
普通练习/数列和.py
数列和.py
py
235
python
en
code
0
github-code
90
20432301020
import functools arr = ['fab', 'fed', 'f', 'ed','e'] ab = {'f':10,'e':11,'d':12,'c':13,'b':14,'a':15} def comparator(a,b): s_a = '' s_b = '' for i in a: s_a += str(ab[i]) for i in list(b): s_b += str(ab[i]) print(s_a,s_b) if s_a > s_b: return 1 else: ...
NyeongB/python_2
test1.py
test1.py
py
401
python
en
code
0
github-code
90
18067766809
N = int(input()) l = list(map(int,input().split())) l_ans = [[] for _ in range(201)] for i in range(-100,101): sum = 0 for j in range(N): sum = sum + (i-l[j])**2 l_ans[i+100] = sum print(min(l_ans))
Aasthaengg/IBMdataset
Python_codes/p04031/s485808660.py
s485808660.py
py
222
python
en
code
0
github-code
90
42986062636
from math import * # tính tổng hai class phân số trong python class P: def __init__(po,tu=None,mau=None): po.tu = tu po.mau = mau # hàm __str__ là hàm có sẵn, xác định kiểu chuỗi trả vè dc hiển thị như thế nào def __str__(po): return f'{po.tu}/{po.mau}' # khi goi a+b thif nó...
nguyenkien0703/python_ptit
PY04004.py
PY04004.py
py
759
python
vi
code
0
github-code
90
19644717354
from AlorPy import AlorPy # Работа с Alor OpenAPI V2 from Config import Config # Файл конфигурации if __name__ == '__main__': # Точка входа при запуске этого скрипта apProvider = AlorPy(Config.UserName, Config.RefreshToken) # Подключаемся к торговому счету. Логин и Refresh Token берутся из файла Config.py ...
KlimShaman/trading
Examples/02 - Accounts.py
02 - Accounts.py
py
4,351
python
ru
code
0
github-code
90
27144426678
def calculate_tax(yearly_salary): tax_brackets = [ (0, 22000, 0.1), (22001, 89450, 0.12), (89451, 190750, 0.22), (190751, 364200, 0.24), (364201, 462500, 0.32), (462501, 693750, 0.35), (693750, float('inf'), 0.37) ] tax_owed = 0 salary_remaining ...
Zrebric/Python
main.py
main.py
py
818
python
en
code
0
github-code
90
2805535329
from django.urls import path from .import views app_name = 'foncier' urlpatterns = [ path('DimFoncier/', views.DimFon, name='DimFoncier'), path('DimFoncierGouvernanc/', views.DFG, name='DimFoncierGouvernanc'), # path('DimGeographie/', views.DG, name='DimGeographie'), # path('FactFoncier/', views.FF, n...
ndire92/daroukhoudosse
foncier/urls.py
urls.py
py
739
python
fr
code
0
github-code
90
1911866221
class Portfolio: def __init__(self, asset, fiat, interest_asset = 0, interest_fiat = 0): self.asset =asset self.fiat =fiat self.interest_asset = interest_asset self.interest_fiat = interest_fiat def valorisation(self, price): return sum([ self.asset * price, ...
ClementPerroud/Gym-Trading-Env
src/gym_trading_env/utils/portfolio.py
portfolio.py
py
3,092
python
en
code
141
github-code
90
20667958391
import pytest from lxml.builder import ElementMaker from podcast_dl import rss_parsers as rspa def _make_item(url, title, episode=None, link=None): episode_ns = "http://www.itunes.com/dtds/podcast-1.0.dtd" E = ElementMaker(nsmap={"itunes": episode_ns}) item = E.item( E.enclosure(url=url, length="...
kissgyorgy/simple-podcast-dl
tests/test_filename_parsers.py
test_filename_parsers.py
py
5,936
python
en
code
51
github-code
90
30287519438
def print_file(): with open("class.txt", mode="r", encoding="utf-8") as f: num = 0 summ = 0 for line in f: l = line.split(" ") grade = int(l[2]) num += 1 summ += grade if grade < 3: print(line) print("Средний...
nikita26078/Python-exercises
ex10/4.py
4.py
py
368
python
en
code
0
github-code
90
23943886195
# fungsi type() untuk mengetahui type-type data a = 10 # tipe data int b = "bejo" # tipe data str c = 17.5 # tipe data float d = True # tipe data boolean print("Nilai data a adalah",type(a)) print("NIlai data b adalah",type(b)) print("Nilai data c adalah",type(c)) print("Nilai data d adalah", type(d)) ## tipe data k...
Mfadlyp/Python_Basic
2. Tipe data/Main.py
Main.py
py
497
python
id
code
0
github-code
90
18804705682
import torch import torch.nn as nn import torch.nn.functional as F from model.model_utils import _get_padding_mask, _get_visibility_mask from cadlib.macro import CMD_ARGS_MASK class CADLoss(nn.Module): def __init__(self, cfg): super().__init__() self.n_commands = cfg.n_commands self.args_...
ChrisWu1997/DeepCAD
trainer/loss.py
loss.py
py
1,456
python
en
code
167
github-code
90
35351353057
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import json import requests from datetime import datetime,date,timede...
sreyansb/Vaccine_notifier
api_in_python.py
api_in_python.py
py
4,427
python
en
code
6
github-code
90
38107239073
import pandas as pd from magicPlanAPI import MagicPlanAPI class DataCentre: def __init__(self): """ Instance to simulate a Cache by storing values in files and reading at the start of the program into variables """ self.paths = { 'plans': 'resources/data/plans.json', ...
jkleinau/aufmassConverterPy
dataCentre.py
dataCentre.py
py
3,146
python
en
code
0
github-code
90
31381940634
from socket import * from time import * import os host = '' port = 520 bufsize = 1024 addr = (host, port) sersock = socket(AF_INET, SOCK_STREAM) sersock.bind(addr) sersock.listen(5) def getstatus(cmd): info = os.popen(cmd) info_text = info.read() info_status = info.close() return info_text, info_sta...
xahiddin/MyPython
sockets/server.py
server.py
py
733
python
en
code
0
github-code
90
72555633897
# Chapter 9 Case study: Word play > Think python import csv import textwrap fin = open('words.txt') fin.readline() 'a\ar\n' line = fin.readline() word = line.strip() print(word) ''' fin = open('words.txt') for line in fin: word = line.strip() print(word) ''' # Inner exercises # 9-1 ''' fin = open('words....
joakor89/Think-Python
chapter_9.py
chapter_9.py
py
6,283
python
en
code
0
github-code
90
18543226999
a,b,c,x,y = map(int,input().split()) ans = 0 ab = min(a+b,c*2) temp = min(x,y) ans += ab*temp x -= temp y -= temp ans += min(a,c*2)*x ans += min(b,c*2)*y print(ans)
Aasthaengg/IBMdataset
Python_codes/p03371/s621425941.py
s621425941.py
py
165
python
en
code
0
github-code
90
34371232724
import os from flask import Flask, render_template, request import memcache mc = memcache.Client(['127.0.0.1:11211'], debug=0) mc.set("Issledovanie_matematiki", "Ivanov,2000,publons/1") mc.set("Issledovanie_fiziki", "Petrov,2001,publons/2") mc.set("Issledovanie_himii", "Ivanov,2002,pubmed/1") mc.set("Issledova...
moevm/nosql2h21-papers-memcached
main.py
main.py
py
2,140
python
en
code
0
github-code
90