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
33641188094
# # >>> Escriba el codigo del reducer a partir de este punto <<< # import sys temp = {} for line in sys.stdin: # Combine if line != '\n': key, value = line.split(',') value = value.rstrip() if key not in temp: temp[key] = [value] else: temp[key].append(...
analitica-de-grandes-datos/mapreduce-en-python-juferyado
pregunta_06/reducer.py
reducer.py
py
499
python
en
code
0
github-code
90
35272732345
from utils import file from utils.keywords import Keywords import json from typing import Union from types import NoneType def is_content_json(content: str, is_file_path: bool = False): if is_file_path: content = file.read(content) try: json.loads(content) return True except: ...
SubhenduShekhar/cjson
python/cjson/src/utils/_json.py
_json.py
py
4,369
python
en
code
2
github-code
90
38340599338
from rest_framework import serializers from .models import User from django.contrib.auth.models import Group class UserSerializer(serializers.ModelSerializer): # url = serializers.HyperlinkedModelSerializer(label='地址', read_only=True, view_name='user-detail', lookup_field='id') class Meta: model = Us...
RookieWithNoob/django-blog
apps/user/serializers.py
serializers.py
py
560
python
en
code
0
github-code
90
11931696424
""" Test functions in the space of solutions of the Euler Lagrange equations of \int_{-1}^{1} (2/tau) \alpha dq/ds + (2/tau)^5 (1-\alpha) d^3 q / ds^3 dt """ import unittest from scipy.sparse import csc_matrix import numpy as np from gsplines.interpolator.gspline import cSplineCalc from gsplines.basis.basi...
rafaelrojasmiliani/gsplines
tests/gspline.py
gspline.py
py
18,889
python
en
code
4
github-code
90
18815387597
import re from spatula import HtmlListPage, CSS, XPath, URL from openstates.models import ScrapePerson class LegList(HtmlListPage): def process_item(self, item): title_name_party = XPath('.//span[@class="memberName"]/text()').match_one(item) (name, party) = re.search( r"^(?:Senator|Re...
openstates/openstates-scrapers
scrapers_next/wa/people.py
people.py
py
3,903
python
en
code
820
github-code
90
18566420179
from collections import deque H, W = [int(x) for x in input().split()] cell = [list(input()) for i in range(H)] black = 0 stack = deque([[0,0]]) for h in range(H): for w in range(W): if cell[h][w] == '#': black += 1 dp = [[-1]*W for _ in range(H)] dp[0][0] = 0 while len(stack) > 0: y,x = ...
Aasthaengg/IBMdataset
Python_codes/p03436/s300819129.py
s300819129.py
py
661
python
en
code
0
github-code
90
11944966345
''' DFS 기본 문제 DFS는 Stack 알고리즘을 사용합니다. ''' graph = [ [], [2,3,8], [1,7], [1,4,5], [3,5], [3,4], [7], [2,6,8], [1,7] ] visited = [False] * 9 def dfs(graph, v, visited): # 방문처리 visited[v] = True # 들린 곳 출력 print(v, end=' ') # 방문한 곳의 node와 연결된 곳들을 순회 for i in gr...
EcoFriendlyAppleSu/algo
algorithm/bfsAdnadfs/DfsExample.py
DfsExample.py
py
599
python
ko
code
0
github-code
90
19862720334
# Creates our Checklist checklist = [] # Define Functions def create(item): checklist.append(item) def read(index): return checklist[index] def update(index, item): checklist[int(index)] = str(item) def destroy (index): checklist.pop(int(index)) def list_all_items(): index = 0 for list_ite...
GirugaCode/Rainbow-Checklist
checklist.py
checklist.py
py
2,188
python
en
code
0
github-code
90
39299148479
from PyQt5 import QtCore, QtWidgets, QtGui class ClipListModel(QtCore.QAbstractTableModel): def __init__(self): QtCore.QAbstractTableModel.__init__(self, parent=None) self.horizontal_header = ["Type", "Filename", "Start"] self.data = [] def supportedDragActions(self): return Qt...
paddatrapper/top30
top30/clip_list.py
clip_list.py
py
4,507
python
en
code
0
github-code
90
69964893416
import argparse import os from functools import partial import cv2 import numpy as np import pandas as pd from multiprocessing import Pool from tqdm import tqdm from reid.insightface.model import ArcFaceModel def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--mtcnn_path', type=str) ...
amirassov/topcoder-facial-marathon
reid/predict_embeddings.py
predict_embeddings.py
py
2,169
python
en
code
10
github-code
90
18159167545
import re from typing import Union, Dict from ase import units as aseunits from ase.units import Units import numpy as np __all__ = ["convert_units"] # Internal units (MD internal -> ASE internal) __md_base_units__ = { "energy": "kJ / mol", # 能量 "length": "nm", # 长度 "mass": 1.0, # 1 Dalton in ASE refe...
1Bigsunflower/schnetpack
src/schnetpack/units.py
units.py
py
7,104
python
en
code
null
github-code
90
5838634068
import time import nltk from generator.vocabulary import Vocabulary, START_SENTENCE, END_SENTENCE class TimeVocabulary: def time_emma(self): emma_raw_text = nltk.corpus.gutenberg.raw('austen-emma.txt') time_before = time.perf_counter() vocab = Vocabulary() vocab.train([(emma_ra...
LizLian/Shakespearean-Script-Generator
tests/time_vocabulary.py
time_vocabulary.py
py
1,183
python
en
code
0
github-code
90
18443559809
import sys sys.setrecursionlimit(10**9) def mi(): return map(int,input().split()) def ii(): return int(input()) def isp(): return input().split() def deb(text): print("-------\n{}\n-------".format(text)) INF=10**20 def main(): N = ii() A = list(mi()) A.sort() if A[0] == 1: print(1) ex...
Aasthaengg/IBMdataset
Python_codes/p03127/s045460192.py
s045460192.py
py
675
python
en
code
0
github-code
90
18506737149
N = int(input()) flag =0 #yesフラグ ext1 = N // 4 ext2 = N // 7 if ext1 == 0: print("No") else: for i in range(ext1 +1): for j in range (ext2 +1): if i*4 + j*7 ==N: flag +=1 print("Yes"if flag >0 else "No")
Aasthaengg/IBMdataset
Python_codes/p03285/s313005026.py
s313005026.py
py
234
python
en
code
0
github-code
90
15802060425
# -*- coding: utf-8 -*- """ 2367. Number of Arithmetic Triplets You are given a 0-indexed, strictly increasing integer array nums and a positive integer diff. A triplet (i, j, k) is an arithmetic triplet if the following conditions are met: i < j < k, nums[j] - nums[i] == diff, and nums[k] - nums[j] == diff. Return t...
tjyiiuan/LeetCode
solutions/python3/problem2367.py
problem2367.py
py
895
python
en
code
0
github-code
90
73129508138
""" [X] repos [X] branches [X] files for commit [X] tags [X] submodules [ ] bags for changed files """ import shutil, git, os from github import Github import plotly.graph_objects as go if __name__ == '__main__': user = input("Enter username: \n") password = input("Enter password: \n")...
Ais105/kursach
tester.py
tester.py
py
4,867
python
en
code
0
github-code
90
71800454377
from setuptools import setup, find_packages with open('README.md') as file: readme = file.read() setup( name='src', version='0.0.1', description='Selenium tests', long_description=readme, author='Hanna Grodzicka', author_email='226154@student.pwr.edu.pl', url='https://github.com/hvvka/...
hvvka/selenium-testlink
setup.py
setup.py
py
423
python
en
code
1
github-code
90
18057184349
import sys def main(): input = sys.stdin.readline s = input().rstrip() K = int(input()) def c(x): return ord(x) - ord('a') def d(x): return chr(x + ord('a')) ans = [] i = 0 while i < (len(s) - 1): to_a = (26 - c(s[i])) % 26 if to_a <= K: ans.append('a') ...
Aasthaengg/IBMdataset
Python_codes/p03994/s361797301.py
s361797301.py
py
549
python
en
code
0
github-code
90
13719161077
import flask import os from flask import Flask, request, render_template import json from main import load_dependency, predict_type app = Flask(__name__, static_url_path='/static') model, lblencoder, scaler = None, None, None @app.route('/') def index(): return render_template('index.html') @app.route('/predi...
rahulbana/Iris-flower-classification
app.py
app.py
py
1,139
python
en
code
0
github-code
90
5645118156
# coding: utf-8 ''' Event Manager. Pub/Sub style. Subscribe to events by class type. ''' # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- from typing import (TYPE_CHECKING, Opt...
cole-brown/veredi-code
game/ecs/event.py
event.py
py
21,179
python
en
code
1
github-code
90
2066242476
from django.http import HttpResponse from django.shortcuts import render, HttpResponse # Create your views here. layout = """ <h1> Proyecto Web (LP3) | roxana </h1> <hr> <ul> <li> <a href="/intregrantes"> Integrantes</a> </li> <li> <a href="/saludo"> Mensaje de saludo</a> ...
8hannah7/ACT_UC04
act_uc04/miapp/views.py
views.py
py
915
python
es
code
0
github-code
90
27924142011
import torch from .Criterion import Criterion class CosineEmbeddingCriterion(Criterion): def __init__(self, margin=0, sizeAverage=True): super(CosineEmbeddingCriterion, self).__init__() self.margin = margin self.sizeAverage = sizeAverage self.gradInput = [torch.Tensor(), torch.Ten...
sibozhang/Text2Video
venv_vid2vid/lib/python3.7/site-packages/torch/legacy/nn/CosineEmbeddingCriterion.py
CosineEmbeddingCriterion.py
py
3,902
python
en
code
381
github-code
90
371693113
from random import randint list = [] for i in range(7): list.append(randint(-256, 256)) def min(list): if len(list) == 2: return list[0] if list[0] < list[1] else list[1] else: sub_min = min(list[1:]) return list[0] if list[0] < sub_min else sub_min print(sub_min) print(min(...
Torroro2020/20201118
Laba 1.2.py
Laba 1.2.py
py
328
python
en
code
0
github-code
90
44259989992
# %% [markdown] # # ECE449 Small project # %% import torch import torchvision from PIL import Image from torchvision import transforms from torch import nn from torch.utils.data import Dataset,DataLoader from torch.utils.checkpoint import checkpoint import torch.nn.functional as F from torch.optim import Adam from tor...
hujiadfr/Simple-image-classifier
code.py
code.py
py
10,808
python
en
code
0
github-code
90
70996008937
import boto3 import json import logging import datetime ssm = boto3.client('ssm') inspector = boto3.client('inspector') logger = logging.getLogger() logger.setLevel(logging.INFO) # quick function to handle datetime serialization problems enco = lambda obj: ( obj.isoformat() if isinstance(obj, datetime.datetim...
awslabs/amazon-inspector-auto-remediate
lambda-auto-remediate.py
lambda-auto-remediate.py
py
5,110
python
en
code
57
github-code
90
39994209591
import random import pygame t = pygame.display.set_mode([1000, 700]) pygame.init() m = pygame.font.SysFont("arial", 220, True, True) mm = m.render("СЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫЫ", True, [200, 200, 200],[0,255,0]) m2 = pygame.font.SysFont("arial", 60, True, True) mm2 = m2.render("Здраствуйте", True, [200, 200...
GLS-ANDREY/pygame
vysachie_okno.py
vysachie_okno.py
py
949
python
fa
code
0
github-code
90
17965826414
from modules.downloader import Downloader from modules.setup import Setup from modules.menu import Menu import asyncio downloader = Downloader() setup = Setup() menu = Menu() setup.create_folder_struct() asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) async def main(): start = False source ...
Ayuly3851/NsfwImageDownloader
src/main.py
main.py
py
1,108
python
en
code
1
github-code
90
38268773575
from multiprocessing import Process from pyMultiwii import MultiWii import time class DroneControl: # Roll Pitch Yaw Throttle Aux1 Aux2 Aux3 Aux4 rc_data = [1500, 1500, 1500, 1000, 1000, 1000, 1000, 1000] ROLL = 0 PITCH = 1 YAW = 2 THROTTLE = 3 AUX1 = 4 AUX2 = 5 AUX...
initialfx/pyMultiWiiDrDrone
DroneControl.py
DroneControl.py
py
1,409
python
en
code
0
github-code
90
23632758112
import requests import os import subprocess import shutil class client_func: def execute_powershell(cmd): subprocess.run(["powershell", "-Command ", cmd], capture_output=True) def shutdown_computer(): os.system("shutdown /s /t 0") def restart_computer(): os.system("shutdown /r /t...
XampleV/ControlAccess
Networking/Client/client_functions.py
client_functions.py
py
1,723
python
en
code
1
github-code
90
12326203830
""" Text utilities. """ __author__ = "Brian Allen Vanderburg II" __copyright__ = "Copyright (C) 2018 Brian Allen Vanderburg II" __license__ = "Apache License 2.0" __all__ = ["dedent", "striplines", "makesingle"] import textwrap def dedent(text): """ Removing unneeded whitespace, newlines. """ return textw...
brianvanderburg2/python-mrbaviirc-common
mrbaviirc/common/text.py
text.py
py
740
python
en
code
0
github-code
90
17944589019
import heapq N, M = map(int, input().split()) ab = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)] ans = 0 def dijkstra(s, graph, n): dist = [float('inf')]*n dist[s] = 0 num = [0]*n num[s] = 1 q = [[0, s]] heapq.heapify(q) while q: c, u = heapq.heappop(q) if dist[u] < c: c...
Aasthaengg/IBMdataset
Python_codes/p03575/s898579996.py
s898579996.py
py
865
python
en
code
0
github-code
90
36199216846
import argparse import pathlib import typing as t def traverse( path: pathlib.Path, exclude_hidden_files: bool, is_parent_last: bool, depth: int = 0 ) -> None: paths = list(path.iterdir()) for idx, p in enumerate(paths, 1): if exclude_hidden_files and p.name.startswith('.'): ...
overclockworked64/tree
tree/__main__.py
__main__.py
py
1,307
python
en
code
0
github-code
90
12111108741
''' EnigmaSimulator - A software implementation of the Engima Machine. Copyright (C) 2015-2021 Engima Simulator Development Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundati...
SwatKat1977/EnigmaSimulator
enigma_simulator/tests/unittest_plugboard.py
unittest_plugboard.py
py
5,466
python
en
code
1
github-code
90
10751141655
from setuptools import setup def _read(f): """ Reads in the content of the file. :param f: the file to read :type f: str :return: the content :rtype: str """ return open(f, 'rb').read() setup( name="python-image-complete", description="Python3 library for checking whether ima...
waikato-datamining/python-image-complete
setup.py
setup.py
py
945
python
en
code
0
github-code
90
17826035184
import numpy as np import pybullet as p class GetTargetPosAndOrn: def __init__(self, target_id): self._target_id = target_id def __call__(self, obs, reward, done, info): pos, orn = p.getBasePositionAndOrientation(self._target_id) euler = p.getEulerFromQuaternion(orn) info["ta...
kinziro/exenv
exenv/robotics/tasks/observation_filters.py
observation_filters.py
py
2,510
python
en
code
0
github-code
90
23473127977
# -*- coding: utf-8 -*- import os,re,xbmc,xbmcaddon,shutil,json addon = xbmcaddon.Addon(id='plugin.video.animeanime') datapath = xbmc.translatePath('special://profile/addon_data/plugin.video.animeanime') if not os.path.isdir(datapath): os.mkdir(datapath) def get_addon(): return addon def clear...
dbiesecke/plugin.video.animeanime
resources/lib/common.py
common.py
py
2,491
python
en
code
0
github-code
90
21171868097
import matplotlib.pyplot as plt import pandas as pd import argparse import numpy as np from pathlib import Path from datetime import datetime from loadingData import univariateDatasets import os def parse_args(): parser = argparse.ArgumentParser(description='Create plot 1') parser.add_argument('--filepath', '...
JakubBilski/mini-fcm
src/display_statistics.py
display_statistics.py
py
3,148
python
en
code
0
github-code
90
74132085097
def task(): lines = [] with open("day22.txt") as f: lines = [l.strip() for l in f.readlines()] player1cards = [] player2cards = [] flag = True for line in lines: if line == "": flag = False continue if line[0] == "P": co...
klukas17/AoC-2020
day22-part2.py
day22-part2.py
py
1,992
python
en
code
0
github-code
90
71095878377
# https://leetcode.com/problems/path-with-maximum-probability # medium # daily from collections import defaultdict import heapq from typing import List class Solution: def maxProbability(self, n: int, edges: List[List[int]], succProb: List[float], start: int, end: int) -> float: graph = defaultdict(list) ...
gerus66/leetcode
medium/1514_path_with_maximum_probability.py
1514_path_with_maximum_probability.py
py
1,062
python
en
code
0
github-code
90
2598980831
import requests from requests_oauthlib import OAuth1 import re import math import time from textblob import TextBlob from django.conf import settings # Twitter settings API_KEY = settings.API_KEY API_SECRET = settings.API_SECRET ACCESS_TOKEN = settings.ACCESS_TOKEN ACCESS_TOKEN_SECRET = settings.ACCESS_TOKEN_SECRET # ...
deepakbartwal/twitter_analysis
core/utils.py
utils.py
py
6,837
python
en
code
0
github-code
90
23046200841
''' 876. Middle of the Linked List Easy Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. Example 1: Input: [1,2,3,4,5] Output: Node 3 from this list (Serialization: [3,4,5]) The returned node has value 3....
aditya-doshatti/Leetcode
middle_of_the_linked_list_876.py
middle_of_the_linked_list_876.py
py
941
python
en
code
0
github-code
90
3525979045
import ssl import base64 import datetime import os import pickle import pyotp import clipboard import requests import logging import pymongo import pyautogui import time import random import uuid import re import pickle from bs4 import BeautifulSoup from exchangelib import Credentials, Account from googleapiclient.di...
azvnit2003/facebook-tools-new
auto_via/utils.py
utils.py
py
16,835
python
en
code
2
github-code
90
6908613692
#Average Case: Time = O(Log(n)) || Space = O(Log(n)) # Worst Case: Time = O(N) || Space = O(N) """Recursive implementation""" def FindClosestValueinBST(tree,target): return FindingHelper(tree,target,float("inf")) def FindingHelper(tree,target,closest): if tree is None: return closest if abs(target...
Asim-2000/Python-Programming
Easy/ClosestValueInBST.py
ClosestValueInBST.py
py
1,228
python
en
code
0
github-code
90
44285281531
""" Fast Lomb-Scargle Algorithm, following Press & Rybicki 1989 """ from __future__ import print_function, division __all__ = ['LombScargleFast'] import warnings import numpy as np from .lomb_scargle import LombScargle # Precomputed factorials FACTORIALS = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] ...
astroML/gatspy
gatspy/periodic/lomb_scargle_fast.py
lomb_scargle_fast.py
py
16,419
python
en
code
78
github-code
90
73427642538
#program for reversing a string, then replace the occurrence of vowels with “$”. def reverse(string): rev = '' for i in range(len(string)-1, -1, -1):#accessing the string from reverse rev += string[i] print("The string after reversing:", rev) replace(rev) def replace(string): res='' for i in range(len(string)...
Biancaa-R/simple-python-programs-for-absolute-beginers-
Assignment6/reverseAndReplace.py
reverseAndReplace.py
py
580
python
en
code
0
github-code
90
70639621096
import requests from time import sleep print("Create a document") db_name = "my_new_db" doc = { 'name':'Mary', 'age': 18, 'email': 'mary@example.com' } url = 'http://127.0.0.1:5984/{}'.format(db_name) for i in range(100): response = requests.post(url, json=doc) print(response.text) sleep(...
chiangyiyang/couchdb_examples
py_examples/create_doc.py
create_doc.py
py
323
python
en
code
0
github-code
90
42263853977
from .weather_data_eng import * from .runways_flights_eda import * from .best_swim_ETA_ETD import * from kedro.pipeline import Pipeline, node from .nodes import * from kedro.config import ConfigLoader from .nodes import * from .ETD_flight_counts import * from kedro.config import ConfigLoader from .remove_first_position...
nasa/ML-airport-configuration
src/airport_config_prediction/pipelines/data_engineering/pipeline.py
pipeline.py
py
4,464
python
en
code
17
github-code
90
18331306109
n = input() n = input() cnt = 0 a = n[0] for i in range(1,len(n)): if a == n[i]: continue else: cnt += 1 a = n[i] print(cnt + 1)
Aasthaengg/IBMdataset
Python_codes/p02887/s955605245.py
s955605245.py
py
161
python
en
code
0
github-code
90
45577813000
from Classes.Models import Models class ComponentValidator: def validate_models(self, models: Models): if hasattr(models, 'models'): if isinstance(models.models, list): for model in models.models: self.__validate_model(model) def __validate_model(self,...
DejanJovanic/ComponentDSL
ComponentValidator.py
ComponentValidator.py
py
1,666
python
en
code
0
github-code
90
33370490774
import meshio import numpy as np import pytest import pymapping def mesh_unit_interval(N): points = np.linspace(0, 1, N) cells_line = np.array([(i, i + 1) for i in range(len(points) - 1)], dtype=int) cells = {"line": cells_line} return meshio.Mesh(points, cells) mesh_source = mesh_unit_interval(100...
tianyikillua/pymapping
test/test_1d.py
test_1d.py
py
1,179
python
en
code
9
github-code
90
70173631657
#!/usr/bin/python3 def roman_to_int(roman_string): if not isinstance(roman_string, str): return 0 dictionary = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} number = 0 n = 0 for i in reversed(roman_string): n = dictionary[i] number += n i...
Mahmoud-Rehan/alx-higher_level_programming
0x04-python-more_data_structures/12-roman_to_int.py
12-roman_to_int.py
py
363
python
en
code
0
github-code
90
35657520632
import qrcode import logging import discord from discord.ext import commands import ClicksBot from util.logger import path import logging from util import config from datetime import datetime lg = logging.getLogger(__name__) fl = ClicksBot.fl fl.setLevel(logging.INFO) lg.addHandler(fl) class QR_Code(commands.Cog): ...
CuzImClicks/Clicks-Bot
cogs/QR-Code.py
QR-Code.py
py
2,191
python
en
code
1
github-code
90
70378627498
import numpy as np array2 = np.array([[1,2,3], [4,5,6]]) array2 print('array 2의 타입은:', type(array2)) random_array = np.random.randn(3, 3) # 3by3 생성 print("무작위 3by3행렬 만들기 : \n",random_array) seq_array = np.arange(10) print(seq_array) print(seq_array.dtype,seq_array.shape,seq_array.size)
Junsesoon/Project7
test.py
test.py
py
339
python
ko
code
0
github-code
90
18362518179
#56 ABC136E n,k=map(int,input().split()) a=list(map(int,input().split())) s=sum(a) res=[] for d in range(1,int(s**0.5)+1): if s%d==0: res.append(d) res.append(s//d) ans=[] for d in res: r1=[t%d for t in a] r1.sort() r2=[(d-t)%d for t in r1] r2=r2[::-1] x=[r1[0]] _=[x.append(x[-1]+r1[i]) for i in range(1,n)]...
Aasthaengg/IBMdataset
Python_codes/p02955/s653557064.py
s653557064.py
py
518
python
en
code
0
github-code
90
18760630111
import torch import torchmetrics import spade.utils.analysis_utils as au import spade.utils.general_utils as gu class SpadeMetric(torchmetrics.Metric): def __init__(self, n_relation_type, dist_sync_on_step=False): super().__init__(dist_sync_on_step=dist_sync_on_step) # self.add_state("f1", defau...
clovaai/spade
spade/model/metric.py
metric.py
py
1,814
python
en
code
77
github-code
90
12965326230
import sqlite3 while (True): kullanıcı_adı = input("Geçerli bir kullanıcı adı giriniz: ") ad = "admin" sifre = int(input("Sifrenizi giriniz:")) giriş_şifresi = 12345 #eğer kullanıcı adı ve şifre doğruysa break yaz. if giriş_şifresi==sifre and kullanıcı_adı==ad: break else: p...
cerenuludogan/Eczaneotomasyonu
uygulama/eczane.py
eczane.py
py
3,085
python
tr
code
1
github-code
90
6843219798
from django.core.management.base import BaseCommand from course_gather.models import ( College, Course, MTUCourse, Location ) from pathlib import Path import csv class Command(BaseCommand): """ Command class for custom db sync """ def add_arguments(self, parser): """ Ad...
Kiro47/MTU-Transfer-Course-Gatherer
course_gather/management/commands/custom_db_sync.py
custom_db_sync.py
py
6,774
python
en
code
4
github-code
90
23046569371
''' 848. Shifting Letters Medium You are given a string s of lowercase English letters and an integer array shifts of the same length. Call the shift() of a letter, the next letter in the alphabet, (wrapping around so that 'z' becomes 'a'). For example, shift('a') = 'b', shift('t') = 'u', and shift('z') = 'a'. Now fo...
aditya-doshatti/Leetcode
shifting_letters_848.py
shifting_letters_848.py
py
1,301
python
en
code
0
github-code
90
9891925918
import sys DEPRECATED = """ --confdir -Z --body-size-limit --stream --palette --palette-transparent --follow --order --no-mouse --reverse --http2-priority --no-http2-priority --no-websocket --websocket --spoof-source-address --upstream-bind-address --ciphers-client --ciphers-server --client-certs --no-upstream-cert --...
wkeeling/selenium-wire
seleniumwire/thirdparty/mitmproxy/utils/arg_check.py
arg_check.py
py
4,239
python
en
code
1,689
github-code
90
19365495355
#Program for guessing a number between 1 and 30. #Using random import and setting guesses_input = 0 to calculate the times the user entered the numbers. import random guesses_input = 0 number = random.randint(1, 30) #Main Body and asking for the user's imput. print("Hello! What is your name?") user_name = ...
HenriFeinaj/Number_Guesser
PROJECT_2_(NUMBER_GUESSER_2).py
PROJECT_2_(NUMBER_GUESSER_2).py
py
1,251
python
en
code
0
github-code
90
9512719307
import re def process(function, filename="input.txt"): total = 0 with open(filename, 'r') as file: line = file.readline() while line: line = line.strip() n = function(line) total = total + n line = file.readline() return total def extract_c...
iptch/2023-advent-of-code
MRU/day_01/run.py
run.py
py
1,938
python
en
code
2
github-code
90
17977000829
N = int(input()) As = list(map(int, input().split())) sm = [] tmp = 0 for a in As: tmp += a sm.append(tmp) rlt = sum(map(abs, As)) for i in range(N-1): rlt = min(rlt, abs(2*sm[i]-sm[-1])) print(rlt)
Aasthaengg/IBMdataset
Python_codes/p03659/s031975297.py
s031975297.py
py
211
python
en
code
0
github-code
90
12502514428
import struct class MEP: ''' MEP is the "Machine Example Protocol", and this is the class that represents the data for a MEP message ''' def __init__(self, message_id, sender_id, target_id): self.message_id = message_id self.sender_id = sender_id self.target_id = target_id @pr...
lmco/parselab
examples/semantic_conversion/machine_protocol.py
machine_protocol.py
py
872
python
en
code
1
github-code
90
21986486024
''' Given 2 non negative integers m and n, find gcd(m, n) GCD of 2 integers m and n is defined as the greatest integer g such that g is a divisor of both m and n. Both m and n fit in a 32 bit signed integer. Example m : 6 n : 9 GCD(m, n) : 3 NOTE : DO NOT USE LIBRARY FUNCTIONS ''' ''' Refer Euclodean Algorithm! ...
prashik856/cpp
InterviewBit/Maths/6.NumberTheory/1.GreatestCommonDivisor.py
1.GreatestCommonDivisor.py
py
630
python
en
code
0
github-code
90
23135352822
try: from setuptools import setup except ImportError: from distutils.core import setup import sys with open('README.rst') as f: readme = f.read() if sys.version_info < (3,3): dependencies='six chainmap' else: dependencies='six' keywords=''' quantities physical quantity units SI scale factors e...
ulthiel/PicoScope
lib/quantiphy/setup.py
setup.py
py
1,585
python
en
code
0
github-code
90
4255410208
#!/usr/bin/python # Import packages # - Python Native import datetime import glob import sys from sys import stdout # - PySerial import serial # - Numpy import numpy as np BAUDRATE = 9600 def serial_ports(): """Lists serial ports :raises EnvironmentError: On unsupported or unknown platforms :retu...
oscgonfer/sensors_dsp_lectures
02_datalogging/examples/Python/00_Communication/00_LogSerial.py
00_LogSerial.py
py
1,637
python
en
code
6
github-code
90
44902711763
import re from enum import Enum from camelback.lexer import Lexer class CaseStyleEnum(Enum): SNAKE_CASE = 0 MACRO_CASE = 1 CAMEL_CASE = 2 PASCAL_CASE = 3 UNKNOWN_CASE = 4 def case_convert_stream(stream: str, case_style: CaseStyleEnum) -> str: """Process and return the stream, after convertin...
codyd51/camelback
camelback/case_converter.py
case_converter.py
py
7,078
python
en
code
2
github-code
90
40651010674
""" Method that uses the DQN model from stable-baselines3 and targets the RL settings in the tree. """ from dataclasses import dataclass from typing import Callable, ClassVar, Optional, Type, Union import gym from gym import spaces from simple_parsing import mutable_field from simple_parsing.helpers.hparams import log...
lebrice/Sequoia
sequoia/methods/stable_baselines3_methods/dqn.py
dqn.py
py
5,579
python
en
code
185
github-code
90
71734671657
from django.urls import path from marketplace import views urlpatterns = [ path("", views.home, name='home'), path("product/<int:product_id>", views.product, name="view_product"), path("cart", views.view_cart, name="view_cart"), path("cart/remove/<int:cart_item_id>", views.remove_from_cart, name="remov...
anirudhprabhakaran3/ecommerce-website
marketplace/urls.py
urls.py
py
520
python
en
code
0
github-code
90
8024522604
# pyright: reportMissingImports=false import hassapi as hass # type: ignore import adbase as ad import json from datetime import datetime,timedelta #from types import SimpleNamespace as Namespace VER = "2" class PrioritySwitch(hass.Hass): def onoff2bool(self,value): if str(value).lower()=='on': return Tru...
pattisonmichael/hacs_priority_switch
apps/priority_switch/priority_switch.py
priority_switch.py
py
24,613
python
en
code
1
github-code
90
16041949246
import math import agent import copy import board import time ########################### # Alpha-Beta Search Agent # ########################### class AlphaBetaAgent(agent.Agent): """Agent that uses alpha-beta search""" big_negative = -10000000 big_positive = 100000000 # Class constructor. # ...
cmgrier/Project1ConnectN
ConnectN/alpha_beta_agent.py
alpha_beta_agent.py
py
15,884
python
en
code
0
github-code
90
10150042178
import os import tensorflow as tf import tensorflow.contrib as contrib import numpy as np import mnist_inference import linecache rootdir="H:/deep_learning/stripe_surface/deep_learning/Covnet/data/" os.chdir(rootdir) Batch_Size = 100 Learning_Rate_Base = 0.8 Learning_Rate_Decay = 0.99 Regularation_Rate = 0.0001 Trai...
SagacitySucura/Machine_Learning
CNN/mnist_train.py
mnist_train.py
py
2,891
python
en
code
0
github-code
90
18564241279
import sys def input(): return sys.stdin.readline().strip() def main(): n = int(input()) a = int(input()) val = n % 500 if val <= a: print("Yes") else: print("No") if __name__ == "__main__": main()
Aasthaengg/IBMdataset
Python_codes/p03433/s589367921.py
s589367921.py
py
225
python
en
code
0
github-code
90
33458168564
from typing import List from unittest import TestCase class Solution: def majorityElement(self, nums: List[int]) -> int: nums.sort() return nums[len(nums)//2] # currMajority = nums[0] # count = 1 # currMajorityCount = 0 # for i in range(1, len(nums)): # if nums[i] != nums[i-1]: # ...
Samuel-Black/leetcode
majority-element.py
majority-element.py
py
706
python
en
code
0
github-code
90
18631136115
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jun 10 11:59:56 2019 @author: farzaneh """ import datetime #%% Change color order to jet def colorOrder(nlines=30): ##%% Define a colormap from numpy import linspace from matplotlib import cm cmtype = cm.jet # jet; what kind of c...
AllenInstitute/mesoscope_manuscript
def_funs_general.py
def_funs_general.py
py
1,027
python
en
code
0
github-code
90
27323728474
""" https://www.hackerrank.com/challenges/between-two-sets/problem all elements in A are a factor of x x is a factor of all elements in B so x mod ai = 0 for all a and bi mod x = 0 for all b The first line contains two space-separated integers describing the respective values of (the number of elements in set A) a...
mrogove/hackerrank
challenges/algorithms/implementation/3betweenTwoSets.py
3betweenTwoSets.py
py
1,461
python
en
code
0
github-code
90
12448784516
usr=input("Enter username:") i=0 a="kiet" while(i<3): pss=(input("password:")) if pss==a: print("welcome",usr) print("Following are the tasks you can access") print("1.Barcode Generator\n2.Convert text to speech\n3.Extracrt text from pdf\n4.Create your audio book\n5.Download You tube vedio") optn=i...
MYCIN-AI-Club/External-Projects
MultiMediaManager.py
MultiMediaManager.py
py
2,668
python
en
code
5
github-code
90
40329544911
# !/user/bin/env python3 # Created by Trent Hodgins # Created on 09/20/2021 # This is a guessing game program # The user enters in a number between 1 and 100 import random def main(): # this function checks to see if the user guessed the correct number random_number = random.randint(1, 100) # a number b...
trent-hodgins-01/ICS3U-Unit3-03-Python
random_guessing_game.py
random_guessing_game.py
py
656
python
en
code
0
github-code
90
29740954474
from django.http import HttpResponse, HttpResponseRedirect from django.template import Context, loader, RequestContext from cpe400.models import Problem, Answer from django.core.urlresolvers import reverse from django.shortcuts import render_to_response, get_object_or_404 # Create your views here. def index(request): ...
IronTurtle/cpes
cpe400/views.py
views.py
py
1,312
python
en
code
0
github-code
90
39825417465
import aioredis import tornado.httpserver import tornado.autoreload from app import init_app import asyncio import sys import json import os async def main(): config = {} if len(sys.argv) > 1: with open(sys.argv[1]) as json_file: config = json.load(json_file) else: raise Runtim...
vincentoconnell/tornado-skeleton
src/server.py
server.py
py
962
python
en
code
0
github-code
90
13793754778
import argparse from Application.superbench.benchmarks import Platform, Framework, BenchmarkRegistry from Application.superbench.common.utils import logger def run_benchmark(model_name, parameters): parser = argparse.ArgumentParser() parser.add_argument( '--distributed', action='store_true', default=Fa...
chenyiyun573/GPUCostBenchmark
Application/run_models.py
run_models.py
py
1,044
python
en
code
0
github-code
90
13657842675
# -*- coding: utf-8 -*- """ Created on Mon Feb 8 21:27:26 2021 @author: Zhenqin Wu """ import cv2 import numpy as np import os import matplotlib matplotlib.use('AGG') import matplotlib.pyplot as plt import pickle from sklearn.cluster import DBSCAN from copy import copy """ Functions for clustering single cells from...
mehta-lab/dynamorph
SingleCellPatch/instance_clustering.py
instance_clustering.py
py
7,193
python
en
code
11
github-code
90
72620502698
#!/usr/bin/env python3 # !/home/hamster/anaconda3/bin/python # ------------------------------------ for PyCharm / for ROS # from scripts.Max_sum_FMR_TAC import * from CONSTANTS import * from robot import Robot from pure_functions import * from ROS_CONSTANTS import * # ------------------------------------ # ------------...
Arseni1919/max_sum_cells_ROS
scripts/robot_main.py
robot_main.py
py
6,924
python
en
code
0
github-code
90
29751112000
from django.conf import settings from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator from django.shortcuts import get_object_or_404, redirect, render from .forms import CommentForm, PostForm from .models import Follow, Post, User def index(request): post_list = P...
Student2506/hw05_final
yatube/posts/views.py
views.py
py
5,243
python
en
code
0
github-code
90
21897355560
import ecmcJinja2 import ecmcPlc def main(): """ render plc definition to `cli.outFile` based on yaml-config `cli.cfgFile` The script will lint the input and validate the axis against the configured type In case a PLC is defined within the axis config, the PLC will be validated and added to the produc...
paulscherrerinstitute/ecmccfg
scripts/jinja2/plcYamlJinja2.py
plcYamlJinja2.py
py
538
python
en
code
6
github-code
90
72782787818
from __future__ import annotations import json from typing import TypeVar import msgpack from flask.wrappers import Request as FlaskRequest from flask.wrappers import Response import yaml from google.protobuf.json_format import MessageToDict from google.protobuf.json_format import ParseDict from google.protobuf.mess...
got686/open_horadric_lib
open_horadric_lib/proxy/protocol_adapter.py
protocol_adapter.py
py
2,697
python
en
code
0
github-code
90
17293364225
from sportinf import constants import requests import json class SportInfo: def __init__(self, **data): self.__data = data self.raw_info = self.__get_info() def __get_id(self): if self.__data["option"] in ["List all Seasons in a League", "League Details", "Lookup Table by League and S...
AlexBlackHawk/sportinf
sportinf/parse_information.py
parse_information.py
py
5,619
python
en
code
0
github-code
90
72208151658
''' 给你一个整数数组 arr,请你帮忙统计数组中每个数的出现次数。 如果每个数的出现次数都是独一无二的,就返回 true;否则返回 false。   示例 1: 输入:arr = [1,2,2,1,1,3] 输出:true 解释:在该数组中,1 出现了 3 次,2 出现了 2 次,3 只出现了 1 次。没有两个数的出现次数相同。 示例 2: 输入:arr = [1,2] 输出:false 示例 3: 输入:arr = [-3,0,1,-3,1,1,1,-3,10,0] 输出:true   提示: 1 <= arr.length <= 1000 -1000 <= arr[i] <= 1000 ''' from ty...
Asunqingwen/LeetCode
简单/独一无二的出现次数.py
独一无二的出现次数.py
py
942
python
zh
code
0
github-code
90
28437544645
from common import file_to_lines import itertools from typing import Tuple, Set Vector = Tuple[int, int, int, int] # x y z w def get_neighbours(vector: Vector, fourth_dim: bool) -> Set[Vector]: x, y, z, w = vector vectors = [ [x - 1, x, x + 1], [y - 1, y, y + 1], [z - 1, z, z + 1], ...
aboutroots/AoC2020
day17.py
day17.py
py
1,817
python
en
code
0
github-code
90
31272142910
import tensorflow as tf from tensorflow.python.layers.core import Dense def gated_tanh(feat, W, W_prime, scope_name): with tf.name_scope(scope_name) as scope: y_tilda = W(feat) g = tf.nn.sigmoid(W_prime(feat)) y = tf.multiply(g, y_tilda) return y def simple_relu(feat, out_dims, ...
souvikiisc/FinalProjecVQA
Codes/util_module.py
util_module.py
py
803
python
en
code
0
github-code
90
37276755527
import random as r import tkinter as t from tkinter import StringVar, messagebox from tkinter import Tk, filedialog address="" # This Global Variable is used to store the path where we want to store the Text file def select(): root = Tk() root.withdraw() root.attributes('-topmost', True) o...
rajnishtripathi2001/Phone-Number-Generator
main.py
main.py
py
2,555
python
en
code
0
github-code
90
21133589247
""" __api.py Backend API-queries """ import json import requests import threading from time import time, sleep from time import gmtime, strftime import urllib, urllib.request price = 0.0 supply = 0.0 staking = 0.0 raised = False parent_socket = None def error_log(at, error): # Log an API error # Le...
blocknetdx/blocknet-staking
web/server/__api.py
__api.py
py
4,007
python
en
code
0
github-code
90
39199319971
#!/user/bin/env python # -*- coding: utf-8 -*- # @File : analysis_solve.py # @Author: sl # @Date : 2020/10/25 - 下午9:23 import datamining.association_rules.fp_growth_first as fpg import datamining.association_rules.read_data as read_data from pyecharts import options as opts from pyecharts.charts import Graph from ...
CycloneBoy/ml-learn
datamining/association_rules/analysis_solve_better.py
analysis_solve_better.py
py
10,435
python
en
code
2
github-code
90
73126224935
import numpy as np def PolinomioNewton(x, y, z): m = len(x) Delta = np.zeros((m,m)) Delta[:,0] = y for j in range(1,m): for i in range(m-j): Delta[i,j] = (Delta[i+1,j-1] - Delta[i,j-1])/(x[i+j]-x[i]) print(Delta) res = y[0] for j in range(1,m): prod = 1 ...
LorenaMendes/UFMG
AnáliseNumérica/Programas/interpol_newton.py
interpol_newton.py
py
581
python
en
code
0
github-code
90
18349234959
def main(): M,D=map(int,input().split()) ans=0 for i in range(22,D+1): if min(divmod(i,10)) in (0,1): continue q,r=divmod(i,10) if q*r <= M: ans += 1 print(ans) if __name__=="__main__": main()
Aasthaengg/IBMdataset
Python_codes/p02927/s113154087.py
s113154087.py
py
231
python
en
code
0
github-code
90
25007843064
from typing import List, Optional, Any, Dict class Solution: def countAsterisks(self, s: str) -> int: count = 0 isCount = True for char in s: if char == '|': isCount = not isCount elif char == '*' and isCount: ...
hvijaycse/Leetcode
biweekly-contest-81/6104.py
6104.py
py
360
python
en
code
0
github-code
90
7376076672
#!/usr/bin/env python import os, sys from django.conf import settings if not settings.configured: from django import VERSION settings_dict = dict( INSTALLED_APPS=( 'django.contrib.contenttypes', 'model_utils', 'model_utils.tests', ), ) if V...
ryankask/django-model-utils
runtests.py
runtests.py
py
1,321
python
en
code
null
github-code
90
20872446805
"""empty message Revision ID: 397328e0606c Revises: 161789f65770 Create Date: 2022-05-31 09:51:50.096867 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '397328e0606c' down_revision = '161789f65770' branch_labels = None depends_on = None def upgrade(): # ...
Thamirespa/Python_Flask
migrations/versions/397328e0606c_.py
397328e0606c_.py
py
1,335
python
en
code
0
github-code
90
18204814239
from collections import deque import sys input = sys.stdin.readline n = int(input()) a = [0]*n b = [0]*n for i in range(n): a[i], b[i] = map(int, input().split()) a.sort() b.sort() if n%2!=0 : l = a[int(n/2)] u = b[int(n/2)] ans = u - l + 1 else: l = a[int(n/2-1)] + a[int(n/2)] u = b[int(n/2...
Aasthaengg/IBMdataset
Python_codes/p02661/s217368245.py
s217368245.py
py
371
python
en
code
0
github-code
90
18814158267
import os import zipfile import requests import urllib.request from .general import ( ROOTDIR, TIGER_ROOT, ) def download_from_tiger(jurisdiction: str, prefix: str, settings: dict): """ URLs are somewhat hard-coded here... Generally...download three files for each jurisdiction: 1. Federal con...
openstates/openstates-geo
utils/tiger.py
tiger.py
py
3,331
python
en
code
22
github-code
90