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
9891659608
import contextlib import pprint import sys import traceback import types import typing from seleniumwire.thirdparty.mitmproxy import controller, eventsequence, exceptions from seleniumwire.thirdparty.mitmproxy import flow from . import ctx def _get_name(itm): return getattr(itm, "name", itm.__class__.__name__.l...
wkeeling/selenium-wire
seleniumwire/thirdparty/mitmproxy/addonmanager.py
addonmanager.py
py
8,065
python
en
code
1,689
github-code
90
31362422000
# n = 4 # 1 # 2 1 # 3 2 1 # 4 3 2 1 n = int(input()) row = 1 while row <= n: col = 1 val = row while col <= row: print(val, end="") val -= 1 col += 1 row += 1 print("")
xambassador/DSA
Patterns/python/pattern13.py
pattern13.py
py
213
python
en
code
6
github-code
90
14280217068
n=int(input()) lst=list(map(int, input().split())) lst.sort() print('Sorted List:') print(lst) lst2=[] for i in range (0,n-1): v=lst[i+1]-lst[i] lst2.append(v) print('Sequence of increments:') print(lst2)
ViciousAndDelicious/SRM-ELab
Python/Level 1/Searching and Sorting/Find increment sequence.py
Find increment sequence.py
py
208
python
en
code
6
github-code
90
24552724577
from ... import core as c from ... import ctrlstru as cs from ... import eudlib as sf def InlineCodifyBinaryTrigger(bTrigger): """ Inline codify raw(binary) trigger data. For minimal protection, eudplib make some of the trig-triggers to eudplib trigger. This function makes eudplib trigger out of raw ...
phu54321/eudplib
eudplib/maprw/inlinecode/btInliner.py
btInliner.py
py
1,770
python
en
code
13
github-code
90
24808379571
""" Hourglass network inserted in the pre-activated Resnet Use lr=0.01 for current version (c) Yichao Zhou (VanishingNet) (c) Yichao Zhou (LCNN) (c) YANG, Wei """ import torch import torch.nn as nn import torch.nn.functional as F __all__ = ["HourglassNet", "hg"] class Bottleneck2D(nn.Module): ''' bn-relu-con...
PJLab-ADG/SensorsCalibration
SensorX2car/camera2car/auto_calib/models/hourglass_pose.py
hourglass_pose.py
py
6,582
python
en
code
1,730
github-code
90
14252184650
from django.contrib import admin from .models import Question, Choice #copying template from 'C:\Users\LCM\pythonprojects\django\env\lib\python3.6\site-packages\django\contrib\admin\templates\admin' # class ChoiceInline(admin.StackedInline): # model = Choice # extra = 3 # make this more compact -> TabularInlin...
viridis45/Python_CodingExercise
forms/django_review/testdjango/polls/admin.py
admin.py
py
1,088
python
en
code
0
github-code
90
28122104488
from django.core.exceptions import ObjectDoesNotExist from django.db import transaction from django.utils import timezone from django.utils.encoding import smart_text from rest_framework import serializers from rest_framework.validators import UniqueTogetherValidator from haleygg.models import League from haleygg.mod...
10cheon00/-deprecated--haleygg_server_v2
haleygg/serializers.py
serializers.py
py
11,438
python
en
code
0
github-code
90
18259224869
s = input() q = int(input()) f1 = 1 f2 = 2 cnt = 0 st = "" se = "" for _ in range(q): q = input().split() if int(q[0]) == 1: cnt += 1 elif int(q[0]) == 2: if cnt % 2 == 0: if int(q[1]) == 1: st = q[2] + st elif int(q[1]) == 2: se += q...
Aasthaengg/IBMdataset
Python_codes/p02756/s597300656.py
s597300656.py
py
593
python
en
code
0
github-code
90
11201571244
from collections import defaultdict from typing import cast from unittest.mock import patch import pytest from aioqzone.type.internal import PersudoCurkey from aioqzone_feed.type import FeedContent from qqqr.utils.net import ClientAdapter from qzemoji.utils import build_html from telegram import Bot from telegram.erro...
aioqzone/Qzone2TG
test/bot/test_queue.py
test_queue.py
py
4,376
python
en
code
27
github-code
90
3363285227
"""Tests.""" from typing import List, Tuple import pytest from hash_chunker import HashChunker @pytest.mark.parametrize( "chunk_size, all_items_count, expected", [ (1000, 2000, [("", "8000000000"), ("8000000000", "ffffffffff")]), ( 500, 1500, [ ...
whysage/hash_chunker
tests/test_hash_chunker.py
test_hash_chunker.py
py
2,159
python
en
code
2
github-code
90
25793914865
import numpy as np from scipy.constants import * import cmath import math def func(a): if a > 0: return 2, 3 else: return "no" if __name__ == '__main__': print(func(-2)) print(func(6)) val = func(6) a, b = val print(a) print(b)
psusarla95/RL_MIMO
trail.py
trail.py
py
279
python
en
code
0
github-code
90
18055107669
n,a,b = list(map(int,input().split())) s = list(input()) ok = 0 rank = 1 for i in s: if ok >= a+b: print('No') elif i == 'a': print('Yes') ok += 1 elif i == 'b': if rank <= b: print('Yes') rank += 1 ok += 1 else: print('...
Aasthaengg/IBMdataset
Python_codes/p03971/s824710840.py
s824710840.py
py
354
python
en
code
0
github-code
90
70762276138
""" Hacer una funciรณn que reciba un nรบmero y que nos indique si es un nรบmero capicรบa o no. El nรบmero capicรบa se lee igual de derecha a izquierda y viceversa. Ejemplo: nombreFuncion(3003)//Devuelve: Es capicรบa nombreFuncion(2023)//Devuelve: No es capicรบa """ def verificaCapicua(numero): resultado = "" numero_in...
AlexSR2590/logica_python
3-Ejercicios-logica/ejercicio29.py
ejercicio29.py
py
718
python
es
code
0
github-code
90
23241704653
from sys import stdin, stdout def solve(): children: list = [i for i in range(1, 31)] for _ in range(28): children.remove(int(stdin.readline().rstrip())) for num in children: stdout.write("%d\n" % num) if __name__ == "__main__": solve()
anothel/CodeKata
๋ฐฑ์ค€/Bronze/5597.โ€…๊ณผ์ œโ€…์•ˆโ€…๋‚ด์‹ โ€…๋ถ„๏ผŽ๏ผŽ๏ผŸ/๊ณผ์ œโ€…์•ˆโ€…๋‚ด์‹ โ€…๋ถ„๏ผŽ๏ผŽ๏ผŸ.py
๊ณผ์ œโ€…์•ˆโ€…๋‚ด์‹ โ€…๋ถ„๏ผŽ๏ผŽ๏ผŸ.py
py
259
python
en
code
1
github-code
90
4737237694
#!/usr/bin/kivy import kivy kivy.require('1.0.6') from cg_graphics_audio import * from kivy.app import App class CuriosityApp(App): cg = None float_layout = None root = None def build(self): self.cg = CuriosityGame(self) self.root = CuriosityWidget() self.float_layout = self....
curiosity-lab/curiosity_game_graphics_audio
main.py
main.py
py
545
python
en
code
0
github-code
90
26392246038
import os import django_heroku # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURI...
AlexXG0152/django-landing
dja2/settings.py
settings.py
py
5,120
python
en
code
0
github-code
90
15171672382
import requests from bs4 import BeautifulSoup url = "https://www.cricbuzz.com/cricket-match/live-scores" live_match = [] live_match_links = [] completed_match = [] completed_match_links = [] all_matches = [] ongoing_matches = "" finished_matches = "" live_match_len = 0 completed_match_len = 0 def match(...
sathvikrijo/Cricket-Score_TelegramBOT
cricket.py
cricket.py
py
5,292
python
en
code
4
github-code
90
22139046682
import numpy as np import matplotlib.pyplot as plt def sinusGenerator(amplitudo, frekuensi, tAkhir, theta): t = np.arange(0, tAkhir, 0.1) y = amplitudo * np.sin(2*frekuensi*t + np.deg2rad(theta)) return t,y # 1. membuat data t1,y1 = sinusGenerator(1,1,4,0) t2,y2 = sinusGenerator(1,1,4,90) t3,y3 = sinusG...
tobialbertino/belajar-code
Belajar_Python/LearnMatplotlib/4_SetProperties.py
4_SetProperties.py
py
686
python
en
code
2
github-code
90
40239615528
# -*- coding: utf-8 -*- """ Created on Mon Jan 4 11:42:47 2021 @author: SethHarden """ from collections import Counter class Solution: def solve(self, str1, str2, edges): possible = len(str1) #setup our graph its an array for everything in our possible range graph = [[] ...
sethmh82/SethDevelopment
Practice/Solve-Using-Graphing.py
Solve-Using-Graphing.py
py
1,266
python
en
code
1
github-code
90
19299993857
import logging from django.http import JsonResponse, HttpResponseBadRequest from django.views.generic.base import TemplateResponseMixin from .bases import LoggedInView from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_protect from common.functions import get_model_pk_na...
jcarswell/hris-integration
hris_integration/hris_integration/views/core.py
core.py
py
7,412
python
en
code
0
github-code
90
30946098767
from django.urls import path from . import views urlpatterns = [ path('crews/', views.list_crew_members, name='crew_list'), path('crews/<int:id>/', views.crew_detail, name='crew_detail'), path('crews/new/', views.create_crew_member, name='create_crew'), path('crews/<int:id>/edit/', views.update_crew_me...
Ashrayergso/Disposition-v4
app_name/urls.py
urls.py
py
1,588
python
en
code
0
github-code
90
14528291554
""" Contains the source editor widget """ from __future__ import print_function import logging, sys from astviewer.qtpy import QtCore, QtGui, QtWidgets logger = logging.getLogger(__name__) # The widget inherits from a Qt class, therefore it has many # ancestors public methods and attributes. # pylint: disable=R090...
titusjan/astviewer
astviewer/editor.py
editor.py
py
3,595
python
en
code
103
github-code
90
72672277738
""" ้€™้‚ŠๆŠŠsocketๆ‰“ๅŒ…ๆˆไธ€ๅ€‹ๆจกๅกŠ๏ผŒ่ฒ ่ฒฌ่ˆ‡ESP32้€š่จŠ """ import socket import convert as con s = socket.socket() def read_vol(): client, addr = s.accept() while True: content = client.recv(32) if len(content) == 0: break else: print(con.cvt(content)) return con.cvt(con...
harry123180/adaptive_control
Python/ESP32/WIFI.py
WIFI.py
py
415
python
en
code
0
github-code
90
23893228038
# Knapsack Problem with Dynamic Programming def dynamic_0_1_knapsack(value, weight, n, total_weight): for w in range(total_weight): value[0][w] = 0 for i in range(1, n): value[i][0] = 0 for w in range(1, total_weight): if weight[i] > w: value[i][w] = value[i - 1][w] keep[i][w] = 0 else: value...
Subrata2402/Algorithms
Knapsack Problem/dynamic_programming.py
dynamic_programming.py
py
556
python
en
code
0
github-code
90
33375706684
import smbus2 from time import sleep class AccelerometerSensor: i2c_bus_num = 1 # bus 1 is connected to the breakout adapter address = 0x18 # Assumes SDO pad left unconnected def __init__(self): #init sensor #Create a bus instance self.bus = smbus2.SMBus(self.i2c_bus_num) #Selec...
tianyilim/Not-Lionel-s-CW1
rpi_interface/accelerometer.py
accelerometer.py
py
2,791
python
en
code
1
github-code
90
16041096515
from collections.abc import Iterable class Demo: def __init__(self, x): self.x = x self.count = -1 def __iter__(self): # ๅช่ฆ้‡ๅ†™ไบ†ไบ†__iter__ๆ–นๆณ•ๅฐฑๆ˜ฏไธ€ไธชๅฏ่ฟญไปฃๅฏน่ฑก return self def __next__(self): self.count += 1 if self.count < self.x: # ๆฏไธ€ๆฌกfor...in้ƒฝไผš่ฐƒ็”จไธ€ๆฌก__next__ๆ–นๆณ•๏ผŒ่Žทๅ–...
EricWord/PythonStudy
18-iterator/iter_demo.py
iter_demo.py
py
890
python
zh
code
0
github-code
90
37381337271
#!/usr/bin/env python # -*- coding=utf-8 -*- import math import re import traceback import logger from public.logger import simple_log logger = simple_log() def contains_chinese(contents): zhPattern = re.compile(u'[\u4e00-\u9fa5]+') match = zhPattern.search(contents) if match: return True els...
soldiers1989/poi_server
public/tools.py
tools.py
py
3,083
python
en
code
0
github-code
90
70373915818
from .airtable_api_base import AirtableAPIBase import json import urllib import urllib.parse from datetime import datetime from pytz import timezone, utc import pytz from currency_converter import CurrencyConverter import re from pprint import pprint class FinFit(AirtableAPIBase): def __init__(self, api_key, arg):...
sterlingsms/sterling_finfit
finfit/airtable_api.py
airtable_api.py
py
6,147
python
en
code
0
github-code
90
14065517561
import numpy as np import pytest from numpy.testing import assert_almost_equal from improver.synthetic_data.set_up_test_cubes import set_up_probability_cube from improver.utilities.probability_manipulation import ( comparison_operator_dict, invert_probabilities, to_threshold_inequality, ) def test_compar...
metoppv/improver
improver_tests/utilities/test_probability_manipulation.py
test_probability_manipulation.py
py
3,753
python
en
code
95
github-code
90
38685971129
import tweepy from textblob import TextBlob def get_most_talked_about_stocks(): # Replace these with your own Twitter API keys and tokens consumer_key = 'YOUR_CONSUMER_KEY' consumer_secret = 'YOUR_CONSUMER_SECRET' access_token = 'YOUR_ACCESS_TOKEN' access_token_secret = 'YOUR_ACCESS_TOKEN_SECRET' ...
kzhekov/Idea-Pod
twitter/most_mentioned_tickers.py
most_mentioned_tickers.py
py
1,500
python
en
code
0
github-code
90
16448381270
import torch import os import yaml from typing import Dict import numpy as np import re def compute_advantage(gamma, lmbda, td_delta): td_delta = td_delta.detach().numpy() advantage_list = [] advantage = 0.0 for delta in td_delta[::-1]: advantage = gamma * lmbda * advantage + delta adv...
noobHuKai/arl
arl/utils/utils.py
utils.py
py
974
python
en
code
0
github-code
90
37894115828
import nmrglue as ng import numpy as np import matplotlib.pyplot as plt path = "C:/Users/s4548361/Desktop/Full/f2_proc.sec" path2 = "C:/Users/s4548361/Desktop/Subsampled/f2_proc_sub.sec" path3 = 'C:/Users/s4548361/Desktop/ML_test_data_easy_hsqc.tar/ML_test_data_easy_hsqc/Exp_Easy_HSQC/MaxEnt/maxent.sec' path4 =...
Shawn-S-ong/MRS-Script
LW_MRS/show2d.py
show2d.py
py
2,879
python
en
code
1
github-code
90
18569389939
import sys import math from collections import defaultdict from bisect import bisect_left, bisect_right sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(input()) def LI(): return list(map(int, input().split())) def LIR(row,col): if row <= 0: ...
Aasthaengg/IBMdataset
Python_codes/p03439/s982427545.py
s982427545.py
py
1,137
python
en
code
0
github-code
90
70069393576
#---------------------------ๅ†’ๆณกๆŽ’ๅบ-------------------------------- def Bubble_sort(li): for i in range(0, len(li)-1): #ๅพช็Žฏ่ถŸๆ•ฐ๏ผŒๆฏ่ถŸๅฏไปฅๆŽ’ๅ‡บไธ€ไธชๆœ€ๅคงๆ•ฐ exchange = False for j in range(0, len(li)-i-1): #ๆฏ่ถŸ้œ€่ฆไบคๆขๅคšๅฐ‘ๆฌก if li[j] > li[j+1]: li[j], li[j+1] = li[j+1], li[j] exchange =...
czjdsg/Note
pyๆ–‡ไปถ/็ฎ€ๅ•ๆŽ’ๅบ.py
็ฎ€ๅ•ๆŽ’ๅบ.py
py
1,378
python
en
code
0
github-code
90
5449622326
import os from zipfile import ZipFile import appdirs import requests from .utils import get_members class ReleaseDownloader: """Represents a basic release downloader.""" name = None release = None vcs = None url = None _download_type = None _slug_type = None def __init__(self): ...
DanielOaks/vagrirc
virc/base.py
base.py
py
4,596
python
en
code
2
github-code
90
42744024355
def get_input(): with open('inputs/input1.txt', 'r') as f: data = sorted([int(line) for line in f.readlines()]) return data def part1(data, target): start = 0 end = len(data)-1 while (start < end): csum = data[start] + data[end] if csum == target: break ...
argfrot/aoc2020
day01.py
day01.py
py
907
python
en
code
0
github-code
90
12985313004
from scrapy import Request import re from sumaq.spiders import BaseSpider from sumaq.items import PostItem class ForosPeruSpider(BaseSpider): name = "forosperu" base_url = "https://www.forosperu.net" max_section_pagination = 1 max_forum_pagination = 1 paginated_url_pattern = "https://www.forosper...
comjoueur/cloud-scraper-ucsp
sumaq/spiders/forosperu.py
forosperu.py
py
4,081
python
en
code
0
github-code
90
13224370621
from __future__ import annotations import warnings from typing import Any import pandas as pd from sklearn.impute import SimpleImputer as sk_SimpleImputer from safeds.data.tabular.containers import Table from safeds.data.tabular.transformation._table_transformer import TableTransformer from safeds.data.tabular.typin...
Safe-DS/Library
src/safeds/data/tabular/transformation/_imputer.py
_imputer.py
py
9,805
python
en
code
11
github-code
90
29737788345
import json from datetime import datetime from io import BytesIO from typing import List from objectiv_backend.common.config import get_collector_config, SnowplowConfig from objectiv_backend.common.types import EventDataList from objectiv_backend.schema.validate_events import EventError from objectiv_backend.snowplo...
massimo1220/objectiv-analytics-main
backend/objectiv_backend/end_points/extra_output.py
extra_output.py
py
3,443
python
en
code
5
github-code
90
31052270375
import numpy as np import matplotlib.pyplot as plt class OptimizationProblem: """Base Optimization Problem""" def __init__(self, max_iterations=50, learning_rate=0.002, tolerance=10 ** -4): self.max_iterations = max_iterations self.learning_rate = learning_rate self.tolerance = toleranc...
jacksonCurry6464/StandardGradientDescent
Final Package/gdtest/solvers.py
solvers.py
py
5,022
python
en
code
0
github-code
90
38723674249
import mysql.connector from faker import Faker import random conn = mysql.connector.connect( host="localhost", user="root", password="", database="userboard" ) cursor = conn.cursor() Faker.seed(random.randint(1, 1000)) fake = Faker() IT_list = ['Java', 'Python', 'Programming', 'React JS', 'Socket', '...
WarriorsSami/CRUD-PHP
pythonGenerators/pythonScripts/projects&teams_names.py
projects&teams_names.py
py
2,630
python
en
code
1
github-code
90
15640238099
from dataclasses import dataclass @dataclass class Instruction: op: str arg: int visited: bool def parse_input(filename): program = [] with open(filename) as f: for line in f.readlines(): op, arg = line.strip().split(" ") program.append(Instruction(op, int(arg), F...
swarthout/AdventOfCode20
day8/main.py
main.py
py
1,927
python
en
code
0
github-code
90
9666304927
#! /usr/bin/python import re import os import sys import numpy as np import pandas as pd import scanpy as sc import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns def loadMetaData(fn): df = pd.read_csv(fn,sep='\t',header=None,index_col=0) df.index = list(map(lambda x: '...
JialiUMassWengLab/Misc
2022/addAnno2H5AD.py
addAnno2H5AD.py
py
2,411
python
en
code
0
github-code
90
38252854230
import sys input = sys.stdin.readline v, e = map(int, input().split()) start = int(input()) INF = sys.maxsize graph = [[] for _ in range(v+1)] visit = [True] + [False for _ in range(v)] res = [INF for _ in range(v+1)] for _ in range(e): a, b, w = map(int, input().split()) graph[a].append([b, w]) vi...
Z1Park/baekjoon
๋ฐฑ์ค€/Gold/1753.โ€…์ตœ๋‹จ๊ฒฝ๋กœ/์ตœ๋‹จ๊ฒฝ๋กœ.py
์ตœ๋‹จ๊ฒฝ๋กœ.py
py
809
python
en
code
0
github-code
90
15094706093
import psutil import plugins MEM_DEFAULTS = {'title': 'RAM', 'problem': 85} class PluginThread(plugins.PluginThreadCommon): def __init__(self, config): super(PluginThread, self).__init__(config, MEM_DEFAULTS) def main(self): mem_stat = psutil.virtual_memory() if mem_stat.percent > s...
vdrandom/vdstatus
plugins/mem.py
mem.py
py
573
python
en
code
0
github-code
90
18436622299
a, b, k = list(map(int, input().split())) def divisor(n): i = 1 table = [] while i * i <= n: if n%i == 0: table.append(i) table.append(n//i) i += 1 table = set(table) return table ablist = sorted(list(divisor(a) & divisor(b)),reverse=True) print(ablist[k-1])
Aasthaengg/IBMdataset
Python_codes/p03106/s460532720.py
s460532720.py
py
318
python
en
code
0
github-code
90
35855181990
from __future__ import annotations import json import time import textwrap from pathlib import Path as P from unittest.mock import patch from typing import Any, Iterable, Optional import click import jwt import pytest import responses from commodore.config import ( Config, set_fact_value, parse_dynamic...
projectsyn/commodore
tests/test_config.py
test_config.py
py
12,639
python
en
code
43
github-code
90
18111202239
from collections import deque x = input() A = 0 S1 = deque() S2 = deque() for i in range(len(x)): if x[i] == "\\": S1.append(i) elif x[i] == "/" and len(S1) > 0 : j = S1.pop() A += i - j a = i - j while len(S2) > 0 and S2[-1][0] > j: a += S2[-1][1] ...
Aasthaengg/IBMdataset
Python_codes/p02266/s187798353.py
s187798353.py
py
570
python
en
code
0
github-code
90
6173520082
#Author: Brandon Gier #Email: gier.b@husky.neu.edu #Uses forward chaining to reason about percepts to demonstrate how knowledge-based agents work. kb = [] #Loads initial knowledge base. Path is the name of the file to be loaded. #Assumes path is in the same directory def loadInitialKB(path): f = open(path) f...
GierB/Artificial-Intelligence-Samples
ForwardChainPL.py
ForwardChainPL.py
py
1,658
python
en
code
2
github-code
90
18588814429
n = int(input()) a_list = list(map(int, input().split())) status = True execute = 0 while status: for i in range(n): if a_list[i] % 2 == 1: status = False break else: a_list[i] = a_list[i] / 2 if status: execute += 1 print(execute)
Aasthaengg/IBMdataset
Python_codes/p03494/s040740173.py
s040740173.py
py
301
python
en
code
0
github-code
90
36833230935
# 1-D array arr_1d = [1, 2, 3, 4, 5] print("1-D Array:") for value in arr_1d: print(f"Element {value} has memory address: {id(value)}") # 2-D array arr_2d = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print("\n2-D Array:") for i in range(len(arr_2d)): for j in range(len(arr_2d[i])): value = arr_2d[i][j] ...
asifurrahmanbubt/CSE-232-Data-Structure-Lab-Code
Lab Report 4/1-D and 2-D array element Address finding.py
1-D and 2-D array element Address finding.py
py
400
python
en
code
1
github-code
90
18566780639
from queue import Queue dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] H, W = map(int, input().split()) S = [input() for _ in range(H)] dist = [[-1] * W for _ in range(H)] que = Queue() # ๅˆๆœŸๆกไปถ dist[0][0] = 0 que.put((0, 0)) # ๅน…ๅ„ชๅ…ˆๆŽข็ดข while not que.empty(): x, y = que.get() for dir in range(4): x2, y2 = x + dx[d...
Aasthaengg/IBMdataset
Python_codes/p03436/s741585188.py
s741585188.py
py
736
python
en
code
0
github-code
90
23561260514
""" - Author: Sharif Ehsani - Date: June 2020 - https://github.com/sharifehsani """ # gets a value (age) from the user and converts the value of year (string) to int value year = input("Enter your birth year and I tell how old you are! ") age = int(year) print("You'r " , 2020 - age , " years old!. ") # The following ...
sharifehsani/starting-out-with-python
chapter2/type_conversion.py
type_conversion.py
py
481
python
en
code
0
github-code
90
42927888698
import os from setuptools import setup with open('requirements.txt') as f: requirements = f.read().splitlines() setup( name="ssh2ec2", version="0.5", author="Mike Ryan", author_email="mike@awssystemadministration.com", description="SSH into EC2 instances via tags and metadata filters", lic...
micahhausler/ssh2ec2
setup.py
setup.py
py
580
python
en
code
1
github-code
90
19542645306
from re import sub if __name__ == "__main__": inp = "" repeat = int(input()) for i in range(repeat): inp += input() if i != repeat -1: inp += "\n" inp = sub(r"\s{1}&&(?=[\s]{1})", " and", inp) print(sub(r"\s{1}\|\|(?=[\s]{1})", " or", inp))
AutonomousFactory/eWendesiya
Task_94.py
Task_94.py
py
301
python
en
code
0
github-code
90
13076794523
from __future__ import division, print_function, absolute_import import numpy as np import cv2 import os import glob import re import matplotlib.pyplot as plt def group_converter(in_dir, in_format, key, mark, out_dir): """convert file format in directory Args: in_dir (str): input directory i...
WEIIEW97/imgprocess
src/misc.py
misc.py
py
6,458
python
en
code
0
github-code
90
4921244458
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import numpy.linalg as linalg from numpy import dot, zeros, eye class FixedLagSmoother(object): """ Fixed Lag Kalman smoother. DO NOT USE: NOT DEBUGGED. Computes a smoothed seq...
ocastell/pyMovMind
filterpy/kalman/fixed_lag_smoother.py
fixed_lag_smoother.py
py
3,301
python
en
code
0
github-code
90
33359510280
""" Populate's Mongo DB from CSV """ from pymongo import MongoClient import pandas as pd import json def populate_csv(): #Connects to MongoDBs cursor = MongoClient('localhost', 27017) db = cursor["movie_db"] collection = db["movie_stats"] #Loads data from CSV into a dataframe frame = pd.read_...
mfarazahmad/DataMovie
data/populate_db.py
populate_db.py
py
591
python
en
code
0
github-code
90
69929071018
""" Is an anonymous letter constructible: EPI 12.2 """ import collections def is_constructible(magazine, letter): char_count = collections.Counter() for char in magazine: char_count[char] += 1 for char in letter: char_count[char] -= 1 if char_count[char] < 0: return F...
annguyenict172/coding-exercises
exercises/hash_tables/is_letter_constructible.py
is_letter_constructible.py
py
432
python
en
code
1
github-code
90
18561868699
from itertools import combinations n=int(input()) cnt=[0]*26 for i in range(n): s=input() cnt[ord(s[0])-ord('A')]+=1 ans=0 for c1,c2,c3 in combinations(["M","A","R","C","H"],3): c1=ord(c1)-ord("A") c2=ord(c2)-ord("A") c3=ord(c3)-ord("A") ans+=cnt[c1]*cnt[c2]*cnt[c3] print(ans)
Aasthaengg/IBMdataset
Python_codes/p03425/s652385661.py
s652385661.py
py
307
python
en
code
0
github-code
90
23216367625
class TrieNode: #Trie node data structure def __init__(self): self.prefix=0 self.word=0 self.paths={} class Trie: #Trie Tree def __init__(self): self.head=TrieNode() def add(self, word): #add a word to the Trie word=word.lower() self.addToTrie(word, self.head) def addToTrie(self, word, no...
wudanny/BoggleSolver
python/trie.py
trie.py
py
1,528
python
en
code
0
github-code
90
74933485096
# weather_api.py from flask import Flask, request app = Flask(__name__) # Example dictionary to store weather information for zip codes weather = { '10001': 'Description : Clear Sky, Temperature: 72, Humidity:30, Main:Clear', '60601': 'Description : Freezing Rain, Temperature: 50, Humidity:20, Main:Rainy', ...
jesalshah14/CloudComputing_Homework-1-Build-your-own-Dockerfile-Image-and-Container
Service2/service2.py
service2.py
py
854
python
en
code
0
github-code
90
18380568079
import math def solve(a,c,d): x=a+1 x-=a//c+1 x-=a//d+1 x+=a//(c*d//math.gcd(c,d))+1 return x A,B,C,D=map(int,input().split()) print(solve(B,C,D)-solve(A-1,C,D))
Aasthaengg/IBMdataset
Python_codes/p02995/s995372059.py
s995372059.py
py
184
python
en
code
0
github-code
90
34537173369
import collections class Solution: def minWindow(self, s: str, t: str) -> str: need = collections.defaultdict(int) # needไธญ็ปŸ่ฎกไบ†c็š„ไธชๆ•ฐ for c in t : need[c]+=1 needCnt = len(t) start = 0 res=(0,float('inf')) for end ,c in enumerate(s): # ไธ€ๅ…ฑ...
zhengyaoyaoyao/leetcodePython
leetcode/hard/76. Minimum Window Substring.py
76. Minimum Window Substring.py
py
1,177
python
zh
code
0
github-code
90
37845749710
from .embedding import WordEmbedding from .data import load_data from .hash_str import hash_str, get_csci_salt from .cosine_sim import cosine_similarity # from .find_friends import ( # calculate_distance, # print_distancefile, # salted_hash, # return_vector, # ) import pandas as pd import os def main...
patchcasey/2019fa-pset-3-patchcasey
pset_3/cli.py
cli.py
py
5,041
python
en
code
0
github-code
90
1681126008
#ฮตฮนฯƒฮฑฮณฯ‰ฮณฮฎ ฮฑฯ€ฮฑฯฮฑฮฏฯ„ฮทฯ„ฯ‰ฮฝ ฮฒฮนฮฒฮปฮนฮฟฮธฮทฮบฯŽฮฝ import numpy as np import cv2 import tkinter as tk from tkinter import filedialog from PIL import ImageTk,Image from tkinter import messagebox import filetype def object_det_MobileNetSSD(): modelConfiguration = "MobileNetSSD_deploy.prototxt.txt" modelWeights = "M...
Manolisp52/Object_detection
2model_objectdetection-v4.py
2model_objectdetection-v4.py
py
23,444
python
el
code
0
github-code
90
12243072148
import datetime from django.utils import timezone from utils import * RCD_PER_PAGE = 8 def user_own_events(request, userid): context = {} context['user_info'] = get_object_or_404(UserInfo, user__username=userid) event_list = Event.objects.filter(topic__user__exact=context['user_info'].user).order_by("-time_period...
zhubw91/biyemaijianbing
src/cmubbs/views/views_event.py
views_event.py
py
8,481
python
en
code
0
github-code
90
18021418109
N,Ma,Mb=map(int,input().split()) a,b,c=map(list,zip(*[list(map(int,input().split())) for i in range(N)])) ma,mb=sum(a),sum(b) MAX=5000 dp=[[[MAX]*(mb+1) for i in range(ma+1)] for j in range(N+1)] dp[0][0][0]=0 for i in range(N): for j in range(ma): for k in range(mb): dp[i+1][j][k]=min(dp[i][j][...
Aasthaengg/IBMdataset
Python_codes/p03806/s093620850.py
s093620850.py
py
580
python
en
code
0
github-code
90
684895195
open_list = ['(', '[', '{'] close_list = [')', ']', '}'] def is_balanced(string): stack = list() for i in string: if i in open_list: stack.append(i) elif i in close_list: pos = close_list.index(i) if len(stack) > 0 and stack[-1] == open_list[pos]: ...
YogeshUpdhyay/python-datastructures
stacks/balanced_parenthese.py
balanced_parenthese.py
py
580
python
en
code
0
github-code
90
18228741789
from collections import Counter # forใ‚’้€†ใ‹ใ‚‰ๅ›žใ—ใฆไธ‹ใ‹ใ‚‰็ด ็›ดใซmodใ‚’ๅ–ใ‚‹ใจTLEใ ใฃใŸ # ็ดฏ็ฉๅ’Œ็š„ใช่จˆ็ฎ—ใง้ซ˜้€ŸๅŒ–ใ€ใ‚„ใ‚Šใ‚„ใ™ใใ™ใ‚‹ใŸใ‚ใซreverse S = input()[::-1] # ex. 1817181712114 โ†’ 4112171817181 # print(S) # 0ๆก็›ฎใพใงใฎMODใ‚’0ใจใ™ใ‚‹ใ“ใจใงใ€ # 1ๆก็›ฎใ‚’ๅซใ‚€ๆ•ฐใŒ2019ใฎๅ€ๆ•ฐใฎๆ™‚ใซ้ƒฝๅˆใŒ่‰ฏใใชใ‚‹ X = [0] # 4,14,114,2114,12114,...ใฎmod2019ใ‚’่จˆ็ฎ— # pow(a,b,c)ใฏๆ™ฎ้€šใซMODใ™ใ‚‹ใ‚ˆใ‚Š้€Ÿใ„ # ๆ™ฎ้€šใซใ‚„ใฃใŸใ‚‰TLEใ ใฃใŸ for i, s in enumera...
Aasthaengg/IBMdataset
Python_codes/p02702/s852815139.py
s852815139.py
py
778
python
ja
code
0
github-code
90
18474567439
import sys stdin = sys.stdin ni = lambda: int(ns()) ns = lambda: stdin.readline().rstrip() na = lambda: list(map(int, stdin.readline().split())) # code here X = ni() print('YES' if X in [3, 5, 7] else 'NO')
Aasthaengg/IBMdataset
Python_codes/p03210/s452757294.py
s452757294.py
py
210
python
en
code
0
github-code
90
27566250962
import sys from os import listdir from random import sample from sklearn.svm import SVC from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.metrics import precision_score, recall_score, accuracy_score, roc_auc_score, fbeta_score, matthews_corrcoef, balanced_accuracy_...
juandamdc/MFA_WTMM
main_train.py
main_train.py
py
3,493
python
en
code
1
github-code
90
6834544621
from django.shortcuts import render from django.http import JsonResponse from django.http import HttpResponse from datetime import date, timedelta import os import random import folium from uszipcode import SearchEngine import pandas as pd import matplotlib matplotlib.use('PS') import matplotlib.pyplot as plt import se...
RembertoNunez/EdisonTrendsCapstone
edisontracker/views.py
views.py
py
13,583
python
en
code
0
github-code
90
4052183468
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 19 12:58:01 2017 @author: ricardo """ import pandas import matplotlib.pyplot as plt import numpy as np # Leer el archivo consolidado file = pandas.read_csv("consolidado.csv", skiprows = 0, sep = ';', header=0) # Para obtener el promedio de exito...
hagarciag/Trabajo_Inteligencia_Colectiva
categorias.py
categorias.py
py
5,940
python
es
code
0
github-code
90
22881513586
import PCR_Vic3D_elem import os vic3d_data_path = [r".\Test_res\def_init_vic3d.csv", r".\Test_res\def_final_vic3d.csv"] ansys_cdb_path = r".\Test_res\mesh.cdb" # UNZIP THE MESH FILE IN "TEST_RES" FOLDER BEFORE RUNNING THE SCRIPT ansys_deformations_path = [r".\Test_res\MaxPrincipalStrain_meshSurface.txt"] dirs...
MarcG-LBMC-Lyos/PCR_Vic3D
test.py
test.py
py
2,090
python
en
code
0
github-code
90
44699242934
from tensorflow.examples.tutorials.mnist import input_data from keras.models import Sequential from keras.layers import Dense, Dropout, Convolution2D, MaxPool2D, Flatten from keras.optimizers import Adam from keras.utils.vis_utils import plot_model import matplotlib.pyplot as plt mnist = input_data.read_data_sets("../...
PierreVon/Learning-python
Keras-NN-/10-1 Drawing net constructure.py
10-1 Drawing net constructure.py
py
1,659
python
en
code
0
github-code
90
18413534029
n = int(input()) v = input().split(" ") c = input().split(" ") for i in range(n): v[i] = int(v[i]) c[i] = int(c[i]) sum = 0 for i in range(n): if(v[i] > c[i]): sum += v[i] - c[i] print(sum)
Aasthaengg/IBMdataset
Python_codes/p03060/s816449061.py
s816449061.py
py
214
python
en
code
0
github-code
90
26036692595
def gcd(a, b): while b != 0: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) def solve(m, n, x, y): l = lcm(m, n) add, base = (m, x) if m > n else (n, y) for k in range(base, lcm(m,n)+1, add): if (k-1) % m == x-1 and (k-1) % n == y-1: return k ...
yeonghoey/boj
6064/main.py
main.py
py
439
python
en
code
2
github-code
90
5830200765
from rdkit import Chem import numpy as np import pandas as pd def mol2bit(MOLS): BIT = [] FP = [] for i, mol in enumerate(MOLS): if mol is not None: bit = {} fp = Chem.RDKFingerprint(mol, bitInfo=bit) BIT.append(bit) FP.append(fp) else: ...
TeddyGlass/Fingerprint
smiles2fp.py
smiles2fp.py
py
1,039
python
en
code
0
github-code
90
5752567519
# -*- coding: utf-8 -*- import sys, os # -- General configuration ----------------------------------------------------- extensions = ['sphinx.ext.todo', 'sphinxcontrib.spelling', 'sphinx.ext.graphviz'] spelling_lang='en_AU' spelling_word_list_filename='OK_wordlist.txt' spelling_show_suggestions=True templates_path =...
CanberraUAV/SAR-Scenarios
conf.py
conf.py
py
932
python
en
code
3
github-code
90
9497103856
import requests, json, time from transformers import AutoTokenizer model_id = "daekeun-ml/Llama-2-ko-instruct-13B" tokenizer = AutoTokenizer.from_pretrained(model_id) def chat(prompt:str): payload = {"prompt": prompt} settings = {"max_new_tokens": 400, "beams": 3, "beam_length": 3, "in_beam_search": True} ...
bibekyess/ko-llama-serving
exllama_sandbox/exllama/client_exllama.py
client_exllama.py
py
1,287
python
en
code
0
github-code
90
18183477159
from itertools import combinations as cmb import copy H,W,K = map(int,input().split()) C = [] ans = 0 for i in range(H): C.append(list(input())) for i in range(H):#้ธใถๅˆ—ๆ•ฐ for j in range(W):#้ธใถ่กŒๆ•ฐ for hs in cmb(range(H),i):#้ธใถๅˆ—ๆ•ฐใฎ็ต„ใฟๅˆใ‚ใ› for ws in cmb(range(W),j):#้ธใถ่กŒๆ•ฐใฎ็ต„ใฟๅˆใ‚ใ› tmpC = copy.deepcopy(C)...
Aasthaengg/IBMdataset
Python_codes/p02614/s795861064.py
s795861064.py
py
697
python
en
code
0
github-code
90
18036188899
n=int(input()) a=list(map(int,input().split())) flg = True if n%2==0: if 0 in a or len(set(a))!=n//2: flg=False else: if len([0 for i in a if i==0])!=1 or len(set(a))!=n//2+1: flg=False if flg: print(2**(n//2)%(10**9+7)) else: print(0)
Aasthaengg/IBMdataset
Python_codes/p03846/s434143232.py
s434143232.py
py
253
python
fa
code
0
github-code
90
39634276829
def summa(key, value): assert len(key) == len(value) res = [x + y for x, y in zip(key, value)] return res if __name__ == '__main__': a = [1, 2, 3] b = [7, 8, 9] print(summa(a, b))
SamimiesGames/itslearning
osa-4/4/summalista.py
summalista.py
py
209
python
en
code
3
github-code
90
16268186248
"""Tests for the string_reverser function in the copies module of the text package.""" import pytest from speedsurprises.text import string_reverser @pytest.mark.benchmark def test_string_reverser_benchmark(benchmark): """Benchmark the mcopies_of function.""" reversed_bnch_string = benchmark( string...
Tada-Project/speed-surprises
tests/test_string_reverser.py
test_string_reverser.py
py
1,025
python
en
code
3
github-code
90
74061419176
""" It is a quadratic time worse case Insertion Sort it in-place , which in turn means it doesn't use any extra space Insertion sort is always good for small arrays Best case is when the array is already sorted, worst case is it is inversely sorted """ def insertion_sort_own(input_array): """ Here in the in...
GowravTata/DSA
5.sorting/5.insertion_sort.py
5.insertion_sort.py
py
1,530
python
en
code
0
github-code
90
18306205719
N = int(input()) A = [0 for n in range(N)] XY = [0 for n in range(N)] count_max = 0 for i in range(N): A[i] = int(input()) xy = [] for j in range(A[i]): x_y = list(map(int,input().split())) xy.append(x_y) XY[i] = xy for i in range(2 ** N): op = [0]*N for j in range(N): # ใƒใ‚คใƒณใƒˆ๏ผ‘ if ((i >> j) & ...
Aasthaengg/IBMdataset
Python_codes/p02837/s865332748.py
s865332748.py
py
611
python
en
code
0
github-code
90
18196894879
import sys x, y = map(int, input().split()) ans = 0 for i in range(x+1): if y == i*2 + (x - i)* 4: ans = 1 break if ans == 1: print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p02640/s377864421.py
s377864421.py
py
193
python
en
code
0
github-code
90
18356780411
import argparse from os import listdir, path, makedirs from random import shuffle from shutil import rmtree import extract_turns def main(in_root_folder, in_result_folder, in_trainset_ratio): dstc_files = [filename for filename in listdir(in_root_folder) if 'task6' in filenam...
ishalyminov/babi_tools
make_echo_dataset.py
make_echo_dataset.py
py
1,959
python
en
code
14
github-code
90
33075860383
# -*- coding: utf-8 -*- # @Time : 2019/7/16 ไธ‹ๅˆ3:18 # @Author : Ryan # @File : 5-nearest_neighbor.py import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # limit mnist data Xtr, Ytr = mnist.train.next...
jayzhou2468/TensorFlow-basic-grammar
learn_TensorFlow/5-nearest_neighbor.py
5-nearest_neighbor.py
py
1,529
python
en
code
2
github-code
90
71795059177
# -*- coding: utf-8 -*- import scrapy from design.items import DesignItem # ไธญๅ›ฝๅฎถๅ…ท่ฎพ่ฎก้‡‘็‚นๅฅ– data = { 'channel': 'jiagle', 'name': '', 'color_tags':'', 'brand_tags': '', 'material_tags': '', 'style_tags': '', 'technique_tags': '', 'other_tags': '', 'user_id': 0, 'kind': ...
LIMr1209/Internet-worm
design/design/spiders/jindian.py
jindian.py
py
2,331
python
en
code
0
github-code
90
41379562357
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from django import forms __all__ = ("AutocompleteWidget",) class AutocompleteInputWidget(forms.TextInput): """ renders the autocomplete *inner* `<input>` field """ def __init__(self, lookup_model, *args, **kwargs): ...
digris/openbroadcast.org
website/apps/search/forms/widgets.py
widgets.py
py
1,952
python
en
code
9
github-code
90
18020272169
n,m = map(int,input().split()) a = [] b = [] for _ in range(n): a.append(input()) for _ in range(m): b.append(input()) for i in range(n-m+1): if b[i] in a[i]: for x in range(m-1): if b[i+x] not in a[i+x]: print("No") exit() print("Yes") exit() else: print("No") exit()
Aasthaengg/IBMdataset
Python_codes/p03804/s641451151.py
s641451151.py
py
318
python
en
code
0
github-code
90
35224931129
""" Wrappers for controls used in widgets """ import logging import sys import warnings import weakref from collections.abc import Sequence import math import numpy as np from AnyQt import QtWidgets, QtCore, QtGui from AnyQt.QtCore import Qt, QSize, QItemSelection, QSortFilterProxyModel from AnyQt.QtGui import QColor...
biolab/orange3
Orange/widgets/gui.py
gui.py
py
28,085
python
en
code
4,360
github-code
90
40615653470
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 25.05.2021 @author: Feliks Kiszkurno """ import matplotlib.pyplot as plt import numpy as np import slopestabilitytools def plot_depth_true_estim(ml_results, *, batch_name=''): fig, ax = plt.subplots() colors = ['red', 'green', 'orange', 'blue',...
felikskiszkurno/SlopeStability
slopestabilityML/plot_depth_true_estim.py
plot_depth_true_estim.py
py
2,070
python
en
code
4
github-code
90
70172693736
#Warnungen deaktivieren. Muss fรผr TF geladen werden import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #Datset laden mnist = tf.keras.datasets.mnist (train_images, train_labels), (test_images, test_labels) = mnist.load_data() #Pixelwerte von...
Starhammer/Tensorflow_Test_Live
Pythn_KI_GUI/Pythn_KI_GUI.py
Pythn_KI_GUI.py
py
3,396
python
en
code
0
github-code
90
18315927379
from heapq import heappush, heappop N, M = map(int, input().split()) s = input() q = [(0,N)] INF = 10**9 dic = {} for i in range(N-1, -1, -1): cnt, j = q[0] while j-i>M: heappop(q) cnt, j = q[0] heappush(q, (cnt,j)) cnt += 1 if s[i]!='1' else INF heappush(q, (cnt,i)) dic[i] = j if cnt>=INF: print...
Aasthaengg/IBMdataset
Python_codes/p02852/s888061853.py
s888061853.py
py
392
python
en
code
0
github-code
90
33457982954
# Definition for a binary tree node. from typing import List, Optional class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def __init__(self): self.subtrees = set() self.duplicates = [] def dfs(...
Samuel-Black/leetcode
find-duplicates-subtrees.py
find-duplicates-subtrees.py
py
1,384
python
en
code
0
github-code
90
43663369583
# Code for creating figure 11 in the report. # Makes a linear scatter plot with noise to illustrate concept # of optimal iterations import matplotlib.pyplot as plt import numpy as np import matplotlib font = {'family' : 'normal', 'weight' : 'bold', 'size' : 22} matplotlib.rc('font', **...
Snoeprol/stochastic_simulations
Assignment_code/further_research_example.py
further_research_example.py
py
873
python
en
code
0
github-code
90
17680296521
#!/usr/bin/env python import logging import subprocess import argparse import sys import tempfile import string import shutil def run_command(command=str): logging.info("Running: %s" % (command)) run=subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) (stdout,stderr)=run.communic...
ucscCancer/icgc-pcap-tools
bwamem.py
bwamem.py
py
2,553
python
en
code
0
github-code
90