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
7864459463
# Python 2/3 uyumluluk from __future__ import print_function import cv2 import numpy as np import os # Dataset'i klasörden çekilip, belirli bir düzen üzerine başka bir dosyaya kaydediliyor. # Örnek kaydetme: neg/1.jpg def storeImages(): if not os.path.exists('neg'): os.makedirs('neg') pictureNumber = ...
mertalbayrak/car_brand_detection
haar_cascade_create.py
haar_cascade_create.py
py
2,642
python
tr
code
8
github-code
90
18470435599
# -*- coding: utf-8 -*- def main(): S = list(input()) Bcnt = 0 ans = 0 for i in range(len(S)): if S[i] == 'B': Bcnt += 1 else: ans += Bcnt print(ans) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03200/s327308934.py
s327308934.py
py
247
python
en
code
0
github-code
90
8756490442
# -*- coding: utf-8 -*- import logging from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible from vkontakte_api.decorators import fetch_all, atomic from vkontakte_api.mixins import CountOff...
ramusus/django-vkontakte-video
vkontakte_video/models.py
models.py
py
4,845
python
en
code
4
github-code
90
36245872208
#!/usr/bin/env python import rospy import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from apriltag_detect.msg import error from geometry_msgs.msg import PoseStamped from geometry_msgs.msg import TransformStamped import cv2 import numpy as np import time import tf pub = rospy.Publisher('/de...
Kripash/Aerial-Robotics
apriltag_detect/scripts/vicon.py
vicon.py
py
2,098
python
en
code
0
github-code
90
40629022687
from django.contrib.auth.models import User from rest_framework import permissions from django.shortcuts import render from rest_framework import status, serializers from rest_framework.parsers import JSONParser from rest_framework.response import Response from rest_framework.views import APIView from product.models ...
Nurmurok/marketplace
account/views.py
views.py
py
1,425
python
en
code
0
github-code
90
7976904312
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Offer22: def PrintFromTopToBottom(self, root): res=[] # python 0 和 None都可以进行判断作为bool真滴好啊 if root==None: return res mylist=[root] while len(myl...
LordwithGlory/Daily_Python
offer22.py
offer22.py
py
643
python
en
code
0
github-code
90
25599040511
import logging import json from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/getRowsdata') def getRowsdata(): rows = request.args.get('row') print(rows) rows =int(rows) import pandas as pd readfile = pd.read_excel('books.xlsx') df = pd.DataFrame(readfile) js = d...
Indu2509/book-details
serviceapi.py
serviceapi.py
py
1,272
python
en
code
0
github-code
90
17766898375
""" Data-driven tests for references. """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import glob import hashlib import json import os # TODO it may be a bit circular to use pysam as our interface for # accessing reference information, since this is th...
srblum/hackathon-server
tests/datadriven/test_references.py
test_references.py
py
7,572
python
en
code
0
github-code
90
23048188829
#Elly Labay 1/17/18 Takes a given string and prints the string backwards def reverse(astring): r_string = "" num = len(astring) for x in range(num): r_string += astring[num - x - 1] return r_string astring = "hello" print( reverse(astring) )
elabay/cs2
Unit1_strings/Reverse-string.py
Reverse-string.py
py
269
python
en
code
0
github-code
90
32558223757
from django.shortcuts import render from utils.funcs import * from django.shortcuts import redirect from django.contrib.auth.decorators import login_required from datetime import datetime # Create your views here. @login_required def homework(request, class_id): #if not in_class(request.user.id, class_id): ...
tuoyikuan/FRcheck_in
homework/views.py
views.py
py
13,588
python
en
code
3
github-code
90
18355357399
# -*- coding: utf-8 -*- s = input() ans = 1 i = 2 tmp = s[0] tmp2 = 1 while i <= len(s): if s[tmp2:i] != tmp: #print('a', i) tmp = s[tmp2:i] tmp2 = i ans += 1 i += 1 else: #print('b', i) i += 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p02939/s776109308.py
s776109308.py
py
270
python
en
code
0
github-code
90
70929679017
class TreeNode: def __init__(self,data): self.info=data self.left=None self.right=None class BinaryTree: def __init__(self): self.root=None def insert(self,data): if self.root is None: self.root=TreeNode(data) else: cur=self.root while True: if data < cur.info: if cur.left: cur=...
BrundaBR/Practice-DSA
Trees/levelorder.py
levelorder.py
py
1,420
python
en
code
1
github-code
90
23476988128
import datetime import smtplib import unittest from unittest import mock from unittest.mock import mock_open, patch from django.http import HttpRequest from django.test import TestCase from django.utils import timezone import requests from paying_for_college.apps import PayingForCollegeConfig from paying_for_college...
KonstantinNovizky/Financial-System
python/consumerfinance.gov/cfgov/paying_for_college/tests/test_models.py
test_models.py
py
17,096
python
en
code
1
github-code
90
40618520854
#_*_coding:utf-8_*_ ''' 题目: 111 二叉树的最小深度 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明: 叶子节点是指没有子节点的节点。 示例1: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回它的最小深度  2. 输入:root = [3,9,20,null,null,15,7] 输出:2 示例2: 输入:root = [...
LeBron-Jian/BasicAlgorithmPractice
LeetCode_practice/BinaryTree/0111_MinimumDepthOfBinaryTree.py
0111_MinimumDepthOfBinaryTree.py
py
3,790
python
zh
code
12
github-code
90
17939561328
import pandas as pd import pytest from avatars.processors import GroupModalitiesProcessor def test_postprocess_noop(many_dtypes_df: pd.DataFrame) -> None: """Check postprocess doing nothing with high parameter.""" processor = GroupModalitiesProcessor( min_unique=3, global_threshold=1, new_category="o...
octopize/avatar-python
avatars/processors/group_modalities_test.py
group_modalities_test.py
py
3,839
python
en
code
1
github-code
90
42219049491
''' 영단어 하나가 입력된다. 그 단어가 love이면 I love you. 를 출력하시오. 입력 영어 단어 하나가 입력된다. 출력 love가 입력되면 I love you.를 출력하시오. 만약 다른 단어가 입력되면 아무것도 출력하지 않는다. 입력 예시 love 출력 예시 I love you. ''' word = str(input()) while True : if word == 'love' : print('I' + ' ' + word + ' ' +'you.') break ...
TaeYeon-kim-ai/python_basic
01. string/string_05_love.py
string_05_love.py
py
503
python
ko
code
0
github-code
90
20214440453
''' splits data into train and test sets ''' import argparse import json import os import random import time import sys from collections import OrderedDict from constants import DATASETS, SEED_FILES def create_jsons_for(user_files, which_set, max_users, include_hierarchy): """used in split-by-user case""" u...
TalwalkarLab/leaf
data/utils/split_data.py
split_data.py
py
9,200
python
en
code
768
github-code
90
10346869552
'''Defines how the MHS application responds to HTTP requests.''' # For form input validation. from django.contrib.auth.decorators import login_required # user authentication from django.contrib import auth # user authentication from django import http # For creating http.HttpResponse objects from django import template...
kpk1948/impedimenta
web/django/generic_project/mhs/views.py
views.py
py
16,496
python
en
code
0
github-code
90
27708191498
import time import random class SortingMethod: def __init__(self, method_name): self.name = method_name def sort(self, sequence): try: if self.name == 'selection': sequence = self.selection_sort(sequence) elif self.name == 'bubble': seq...
astenstrasser/coursera
USP - Introduction to computer science/more_about_sorting_algorithms.py
more_about_sorting_algorithms.py
py
2,672
python
en
code
0
github-code
90
35122057305
""" Elo is simply a stochastic approximation to logistic regression. So let's just do logistic regression, or linear regression, to infer fighter skill(s) from fight outcomes (depending on the skill type). """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from tqdm import...
John-Curcio/sports
model/exact_elo_model.py
exact_elo_model.py
py
6,246
python
en
code
0
github-code
90
72377240617
import sqlite3 from recommender import * class User: def __init__(self): self.id = 0 #integer self.age = 0 #integer self.books = [] #list of isbns self.rates = {} #dict with isbn:rate def getUser(self, id, conn): self.id = id #connect to database cursor...
astrojneil/bookRec
users.py
users.py
py
4,233
python
en
code
1
github-code
90
5775195796
''' OpenMachineMonitoring This file is part of OpenMachineMonitoring. OpenMachineMonitoring 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 Foundation, either version 3 of the License, or (at your option) any later version....
darius-all-new/open-machine-monitoring
backend/influxdb_functions.py
influxdb_functions.py
py
4,568
python
en
code
1
github-code
90
7534480011
from .serpent_config import(SerpentOperations) from .utils import (keys_exists, read_json) class SerpentCHTCOperations(SerpentOperations): """ Main Class for the Remote HTC operations. """ def __init__(self, config, ignore_mods): self.config = config self.ignore_mod...
DABAKER165/chtc_serpent_v2
serpent_code/mods/htc_operations.py
htc_operations.py
py
44,612
python
en
code
0
github-code
90
2312697742
import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By driver = webdriver.Chrome(service=Service()) driver.get("https://rahulshettyacademy.com/AutomationPractice/") driver.find_element(By.ID, "name").send_keys("Jeff") driver.find_e...
MartianFlow/learning-python-selenium-basics
Notas/SELENIUM/ManejoAlertas.py
ManejoAlertas.py
py
626
python
en
code
1
github-code
90
20375999164
"""Premier exemple avec Tkinter. On crée une fenêtre simple qui souhaite la bienvenue à l'utilisateur. """ # On importe Tkinter from tkinter import filedialog from tkinter import * # On crée une fenêtre, racine de notre interface fenetre = Tk() # On crée un label (ligne de texte) souhaitant la bienvenue # Note : l...
stef-tel/Pilot-Billing-Preview-Tool
screens_test/captureSettings.py
captureSettings.py
py
1,139
python
fr
code
0
github-code
90
42234966068
# -*- coding: utf-8 -*- import logging import os import argparse import shutil import sys import json from datetime import datetime import numpy as np import torch from torch.utils.data import DataLoader from monai.data import list_data_collate from torch.utils.tensorboard import SummaryWriter from monai.config imp...
cosimochetta/mtl-valdo-challenge
train/train_task3_2dpatch.py
train_task3_2dpatch.py
py
8,729
python
en
code
0
github-code
90
40535717347
from oslo_log import log as logging import testtools from tempest import config from tempest.scenario import manager from tempest import test from tempest import exceptions # from tempest.common.utils.linux import remote_client from tempest.common import waiters import time CONF = config.CONF LOG = logging.getLogger...
paulaCrismaru/fii
python/test.py
test.py
py
3,951
python
en
code
0
github-code
90
19231501078
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import re import scipy.stats as stats #GTR Don't really know what this does #JT: This will set the figure size such that it will line up with the text in a LATEX document. I'm not sure it is strictly necessary for pdf's because they should sca...
RichardsGroup/Group_plotting
group_plotting_standard.py
group_plotting_standard.py
py
4,377
python
en
code
0
github-code
90
29945972825
import re import os import sys import subprocess import datetime class ModPoscar: def __init__(self, vol, site=0, idx=0, dev=0): with open('POSCAR_orig') as f: self.lines = f.readlines() self.offset = 6 self.dynamics = ' ' for i, line in enumerate(self.lines[5:9]): ...
kyohei-horikawa/horikawa_work_summary
einstein/bin/einstein_calc.py
einstein_calc.py
py
3,405
python
en
code
0
github-code
90
17955071794
# Description: This module contains functions to call the SolarEdge API and return the data in JSON format (most of the time). #Built-in libraries import requests #3rd party libraries #Custom libraries #Set Constants based on the API documentation QuarterHour = "QUARTER_OF_AN_HOUR" Hour = "HOUR" Day = "DAY" Week =...
AxReds/solaredge
solaredge_exporter/functions.py
functions.py
py
13,854
python
en
code
0
github-code
90
18250097699
# 各行の所属するグループを配列として持たせる実装。列ごと見ていってダメなら垂直線追加していく H, W, K = map(int, input().split()) S = [input() for _ in range(H)] ans = 10**9 for bit in range((1 << (H-1))): vidx = [] gok = True g = 0 gid = [0] * H for i in range(H-1): if (bit >> i) & 1: g += 1 gid[i+1] = g g += 1 ...
Aasthaengg/IBMdataset
Python_codes/p02733/s281647473.py
s281647473.py
py
1,244
python
en
code
0
github-code
90
18435255779
def f(n): num=n%4 if num==0:return n elif num==1:return 1 elif num==2:return n+1 else:return 0 a,b=map(int,input().split()) print(f(a-1)^f(b))
Aasthaengg/IBMdataset
Python_codes/p03104/s725816855.py
s725816855.py
py
164
python
en
code
0
github-code
90
38704489168
longestLength = 0 def longest_palindrome(s): #changed global longestLength test = [] lo = 0 #changed a = list(s) is_palindrome(a, test, lo) return longestLength def is_palindrome(a, test, lo): hi = len(a) #added global longestLength if (lo == hi): teststring = ''...
wude935/CS-313E
Other/palindrome.py
palindrome.py
py
807
python
en
code
0
github-code
90
25765866235
#--------------------------------------------- # CS2900 # # This sample program plays arithmetic games # The user can play as many games as she wants by # entering Yes to the prompt "Do you want to play game?" # When No is entered, terminate the program. # # At the beginning of each game, the user enters # N -...
ZakiRucker/GradSchoolCoding
CS2020/Week5/play_arithmetic_games.py
play_arithmetic_games.py
py
2,969
python
en
code
0
github-code
90
13608631739
# # abc079 c # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout....
mskt4440/AtCoder
abc079/c.py
c.py
py
1,210
python
en
code
0
github-code
90
72223188136
# -*- coding: utf-8 -*- """ Created on Wed Nov 20 11:57:02 2019 @author: deesaw """ import sqlite3 conn = sqlite3.connect("mydatabase.db") cursor = conn.cursor() sql = """ CREATE TABLE books( bid INTEGER PRIMARY KEY, title TEXT, author TEXT ) """ cursor.execute(sql) print("Table created") conn.close()
deesaw/Vimpp
Python/db1.py
db1.py
py
305
python
en
code
0
github-code
90
14105439690
"""Instagram module. Creates datasets and easy-to-use analysis tools for Instagram data. Basic use: - InstagramPost(shortcode, expand=True) - InstagramUser(shortcode, expand=True) - InstagramLocation(shortcode, expand=True) """ __version__ = '2019-04-29' __author__ = 'Kalle Westerling' # STANDARD SETTINGS cfg = {...
kallewesterling/instagram
instagram.py
instagram.py
py
94,419
python
en
code
0
github-code
90
10115978708
"""This module contains the class declaration for the MapViewWidget.""" from PySide6.QtCore import QPointF, Qt from PySide6.QtGui import QColor, QCursor, QKeyEvent, QPainter, QPen, QResizeEvent, QWheelEvent from PySide6.QtWidgets import QApplication, QGraphicsRectItem, QGraphicsScene, QGraphicsView from sailsim.boat....
mfbehrens99/sailsim
sailsim/gui/mapView.py
mapView.py
py
3,867
python
en
code
6
github-code
90
28348944034
import json from datetime import datetime import re bank_file = 'operations.json' def load_json(bank_file, encoding='utf-8'): """ Чтение JSON файла и возврат его содержимого в виде списка словарей. :param bank_file: Путь к JSON файлу. :param encoding: Кодировка файла (по умолчанию utf-8). :return...
zayac880/Bank_cards
main.py
main.py
py
3,494
python
ru
code
0
github-code
90
7509551702
# MAKE SURE THAT IF YOU'RE GOING FROM MATLAB TO PYTHON YOU REMEMBER TO DECREASE YOUR DIMENSION SPECIFICATION BY 1 # FOR EXAMPLE, the Matlab default dimension is 1, and for this Python script it's 0 import numpy as np import scipy from scipy import misc def logsumexp(a, dim=0): #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
LewisPeacockLab/PCITpy
pcitpy/logsum.py
logsum.py
py
2,694
python
en
code
1
github-code
90
25560586956
import os from tkinter import * import datetime import pandas #database as dictionary products = [ {"id":1, "name": "Chocolate Sandwich Cookies", "department": "snacks", "aisle": "cookies cakes", "price": 3.50}, {"id":2, "name": "All-Seasons Salt", "department": "pantry", "aisle": "spices seasonings", "price":...
esl405/point-of-sale-app-esl405
shopping_cart.py
shopping_cart.py
py
5,818
python
en
code
1
github-code
90
42147864017
#! /usr/bin/env python # coding:utf8 from .huobi_exchange import AccountInfoView as HuobiAccountInfoView from .market import (MarketInnerPriceView, MarketMacdCrossGateView, MarketMacdTrendGateView, MarketPriceGateView, MarketPriceView) from .test import ServerTimeView, TestVie...
JackieyQi/AmfSan
apis/__init__.py
__init__.py
py
842
python
en
code
0
github-code
90
6993803378
from enum import Enum from fastapi.responses import FileResponse class ResponseDescription(Enum): BAD_REQUEST = 'Bad Request' UNAUTHORIZED = 'Unauthorized' FORBIDDEN = 'Forbidden, not admin user' NOT_FOUND = 'Not Found' ALREADY_EXISTS = 'Already exists' SUCCESSFUL_RESPONSE = 'Successful Resp...
StrikeBallPassports/server
utils/responses.py
responses.py
py
1,958
python
en
code
0
github-code
90
33378679216
from typing import Callable, Any import functools def debug(func: Callable) -> Callable: @functools.wraps(func) def wrapped_func(*args, **kwargs) -> Any: result = func(*args, **kwargs) print(f'Function name: {func.__name__}{kwargs}.') print(f'Function {func.__name__} returned: {result}'...
SergKrasilnikov/Skill_python
Python_Basic/ex27_decorator/04_debug/main.py
main.py
py
645
python
en
code
0
github-code
90
2027861705
import backtrader as bt import backtrader.feeds as btfeeds from backtrader.indicators import RSI_SMA class Basic_RSI(bt.Strategy): def __init__(self): self.rsi = RSI_SMA( self.data.close, period = 21 ) def next(self): if not self.position: ...
GitHub-Valie/python-algorithms
backtesting/backtrader backtest/strategies.py
strategies.py
py
943
python
en
code
1
github-code
90
17533500525
import csv from itertools import islice from collections import OrderedDict MAINDIR = "./" val = input("Enter name of the PENDEJO you're looking for: ") with open(MAINDIR + 'atp_matches_2022.csv') as mf: readit = csv.reader(mf,delimiter=',') csvdata = list(readit) i = 0 while i < len(csvdata): if val in cs...
alexbenavidesgit/tennis-betting
Python/alex_helloworld_1.py
alex_helloworld_1.py
py
368
python
en
code
1
github-code
90
18245449379
import queue n,x,y=map(int,input().split()) edge=[[i-1,i+1] for i in range(n)] edge[0],edge[-1]=[1],[n-2] edge[x-1].append(y-1) edge[y-1].append(x-1) inf=10**6 ans=[0]*n for i in range(n): q=queue.deque([i]) dist=[inf]*n dist[i]=1 while q: a=q.pop() for e in edge[a]: if dist[...
Aasthaengg/IBMdataset
Python_codes/p02726/s615418321.py
s615418321.py
py
477
python
en
code
0
github-code
90
37814862970
from collections import defaultdict from math import inf class Node: def __init__(self, k) -> None: self.cor = 'branco' self.d = inf self.p = None self.k = k self.f = 0 def __str__(self) -> str: p = ' Sem pai' if self.p is None else self.p.k txt = f...
DyogoBendo/Algoritmo-Teoria-Pratica
Grafos/grafos.py
grafos.py
py
3,355
python
en
code
0
github-code
90
73114690215
import json from math import e import os from tkinter import PhotoImage import tkinter as tk from tkinter import ttk import tkinter.messagebox as messagebox from tkinter import filedialog from InventoryManager import InventoryManager # does nothing currently class CharacterManager: CORE_STATS_LABELS = ["Name...
ryancarolina/ai-dungeon-master
CharacterManager.py
CharacterManager.py
py
9,659
python
en
code
0
github-code
90
74785274857
class Solution(object): def findRadius(self, houses, heaters): minRad=heaters[0] - houses[0] covered=heaters[0] + minRad if(len(heaters)==1): return max(minRad, houses[-1] - heaters[0] ) for i in range(1, len(heaters)): mid=(heaters[i] - heaters[i-1])//2 ...
codejigglers/leetcodes
Array/Heaters.py
Heaters.py
py
614
python
en
code
0
github-code
90
72328528937
import os import json from sphinx.jinja2glue import BuiltinTemplateLoader class TemplateLoader(BuiltinTemplateLoader): def init(self, builder, theme=None, dirs=None): self.piwik_site = builder.config.html_context.get('piwik_site', 0) self.language = builder.config.language self.builder_name...
fpoirotte/test
docs/src/loader.py
loader.py
py
1,598
python
en
code
0
github-code
90
43844019230
""" 给定一个二叉树,返回它的 前序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,2,3] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? """ # 解答:非递归做 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def...
wtrnash/LeetCode
python/144二叉树的前序遍历/144二叉树的前序遍历.py
144二叉树的前序遍历.py
py
772
python
en
code
2
github-code
90
12763032932
from __future__ import print_function print("importing Libraries") import pandas as pd import numpy as np import matplotlib.pyplot as plt from keras.layers.core import Dense, Activation, Dropout from keras.layers.recurrent import LSTM from keras.models import Sequential from keras.models import load_model import statis...
gagankonana/Short-term-load-forecasting
src code/train/lstm.py
lstm.py
py
5,257
python
en
code
0
github-code
90
27126540784
import pandas as pd from datetime import datetime from repositories.SteamInventoryRepository import SteamInventoryRepository from data_models.PandasDataModel import PandasDataModel from data_models.PandasUtils import PandasUtils from data_models.ItemsSteam import ItemsSteam class SteamInventory( PandasDataModel,...
ThiagoLuka/Steam-LevelUp-Service
data_models/SteamInventory.py
SteamInventory.py
py
2,627
python
en
code
0
github-code
90
2428851941
# Logic AI - Chatzitoulousis Petros, Giannakoulas Giorgos import random import copy from itertools import combinations f = open("kb.txt", "w", encoding="utf-8") # Dhmiourgei tyxaia thn vash gnwshs me vash tis parametrous pou dinei o xrhsths. def construct_kb(): kb = [] var_num = int(input("Enter the number...
petroshatt/Logical-Entailment-AI
main.py
main.py
py
8,296
python
en
code
0
github-code
90
30807897330
import numpy as np from qiskit_optimization import QuadraticProgram from qiskit_optimization.converters import QuadraticProgramToQubo def estimate_number_of_qubits_required_for( max_hectares_per_crop=1, hectares_available=3, ): return 4 * np.ceil(np.log2(max_hectares_per_crop + 1)) + np.ceil( np.lo...
seyurlutchminarain/Quantum-Africa-Challenge
1_Introductory/ex1_utils.py
ex1_utils.py
py
353
python
en
code
0
github-code
90
12775896430
import gurobipy as gp from gurobipy import GRB #computers = ['CP1', 'CP1', 'GP3', 'WS1', 'WS2'] computers = [0, 1, 2, 3, 4] price = [60000, 40000, 30000, 30000, 15000] drives = [0.3, 1.7, 0, 1.4, 0] boards = [4, 2, 2, 2, 1] cpu = [2, 1, 1, 1, 1] orderquantity = [0, 500, 0, 500, 400] partsavailable = [7000, 8000, 3000...
KrissiTekkari/bestunaradferdir
test.py
test.py
py
1,419
python
en
code
0
github-code
90
75177182
N = int(input()) board = [-100 for _ in range(N)] # 의미 없는 수로 채우기, 각 행에 어떤 열에 퀸이 놓일지 저장하는 것 def isOkay(idx: int): for i in range(idx): # 위에 것과만 비교하면 되기 때문에 idx로 # 여태껏 정해졌던 값들 중에 하나라도 같은 열 체크, 대각선 체크 if ((board[i] == board[idx]) or ((idx-i) == abs(board[idx]-board[i]))): return 0 ...
YeongHyeon-Kim/BaekJoon_study
1028/9663_NQueen.py
9663_NQueen.py
py
960
python
ko
code
1
github-code
90
2442479396
import json import boto3 from boto3.dynamodb.conditions import Attr, Key from decimal import Decimal ''' 这个函数只做两件事情, # 1. 将所有的错误都提取出来写入到notification中 2. 将创建成功但整体失败的东西会滚 ''' class RollBack: def __init__(self, event): self.event = event self.scenario = event['scenario'] self.trigger = event[...
PharbersDeveloper/phlambda
processor/async/scenarios/phscenariocleanup/src/main.py
main.py
py
8,724
python
en
code
0
github-code
90
9330762324
""" File Navigation Commands """ import os as _vp_os import stat as _vp_stat import ctypes as _vp_ctypes import json as _vp_json def _vp_get_userprofile_path(): """ Get UserProfile Path (Home in Linux) """ if _vp_os.name == 'nt': # windows return _vp_os.getenv('USERPROFILE') else:...
visualpython/visualpython
visualpython/python/fileNaviCommand.py
fileNaviCommand.py
py
6,745
python
en
code
749
github-code
90
190626677
from . import exceptions import pandas as pd import requests import tc_etl_lib as tc import time from typing import Iterable, Optional, Union class SendBatchError(Exception): "SendBatchError is a class that can handle exceptions." def __init__(self, message, original_exception=None, index=None): super(...
telefonicasc/etl-framework
python-lib/tc_etl_lib/tc_etl_lib/iota.py
iota.py
py
2,923
python
en
code
0
github-code
90
18343577889
N = int(input()) Bs = list(map(int, input().split())) ans = [] def solve(acc, xs): head, *tail = xs if not acc: acc.append(head) if not tail: acc.append(head) return acc peek, *_ = tail acc.append(min(head, peek)) return solve(acc, tail) arr = solve([], Bs) print(sum...
Aasthaengg/IBMdataset
Python_codes/p02917/s186411695.py
s186411695.py
py
327
python
en
code
0
github-code
90
18563622493
import entityx from _entityx import Entity from _entityx_components import Sound, CollisionCategory, Destroyed, Body, Physics, Stats, b2BodyType, Renderable from gamemath import vector2 import re import math Vector2 = vector2.Vector2 # CHARACTER LIMIT IS ROUGHLY 50 CHARS EVENT_TEXTS = [ "50CHARS50CHARS50CHARS50CHARS5...
Bablawn3d5/LD36
examples/scripts/action/eventur.py
eventur.py
py
5,608
python
en
code
0
github-code
90
73669074537
import turtle as t t.speed(0) x = 0 y = 0 def red_rectangle(): for i in range(2): t.pencolor("red") t.fillcolor("red") t.begin_fill() t.forward(300) t.right(90) t.forward(15) t.right(90) t.end_fill() for i in range(7): y = y -...
NyanLinnZaw/nlz
US.py
US.py
py
1,422
python
en
code
0
github-code
90
18010381039
N, M = map(int, input().split()) As = [] for _ in range(0, N): x, y = input().split() As.append((int(x), int(y))) Cs = [] for _ in range(0, M): x, y = input().split() Cs.append((int(x), int(y))) for a in As: d = {} minI = -1 minM = float('inf') for i, c in enumerate(Cs): ax, a...
Aasthaengg/IBMdataset
Python_codes/p03774/s426617682.py
s426617682.py
py
469
python
en
code
0
github-code
90
18809840892
from uos_scraper import UoSScraper from cusp_scraper import CUSPScraper from blahaj_wrapper import BlahajWrapper def post_data(uos, blahaj, elective, group, endpoint, groups_created): uos.set_cur_url(endpoint) aknowledge = uos.get_assumed_knowledge() academic_unit = uos.get_unit_academic_unit() code = ...
chriswuaus/2022SYNCSHACK
backend/scraper/blahaj_scraper.py
blahaj_scraper.py
py
2,820
python
en
code
0
github-code
90
36261726909
from django.shortcuts import render, HttpResponse # Create your views here. def bienvenido (resquest, plantilla= "bienvenido.html"): return render(resquest,plantilla) def contactanos(resquest, plantilla= "contactanos.html"): return render(resquest, plantilla) def acercade(resquest, plantilla= "acercade.html"):...
klmanzaba/karlaPr
SistemaCalificaciones/views.py
views.py
py
1,692
python
es
code
0
github-code
90
34873452880
import numpy as np import pytest from pandas import ( DataFrame, DatetimeIndex, Index, MultiIndex, Series, isna, notna, ) import pandas._testing as tm def test_doc_string(): df = DataFrame({"B": [0, 1, 2, np.nan, 4]}) df df.expanding(2).sum() def test_constructor(frame_or_se...
pandas-dev/pandas
pandas/tests/window/test_expanding.py
test_expanding.py
py
24,239
python
en
code
40,398
github-code
90
5741949932
import multiprocessing import time import rclpy from rclpy.node import Node from std_msgs.msg import String from robotarm_interfaces.msg import Sensordeg from robotarm_interfaces.msg import Inversedegrees import firebase_admin from firebase_admin import credentials, firestore import asyncio from aiortc import RTCPeerCo...
TeleoperatedMobileManipulator/ttwn
robotarm_pkg/videocommu.py
videocommu.py
py
15,602
python
en
code
0
github-code
90
21336886069
import sys # enter folder location and change \ to // sys.path.insert(1,'D://bi12-year2//advpython//project//python_prj//mysql_connect') # access connect(model) from connect import get_sql_connection as sql #type: ignore def get_existing_id(type: str): # find the amount of "type" (users, products,...) already in...
anhthai912/python_prj
control/sql_connection.py
sql_connection.py
py
9,728
python
en
code
0
github-code
90
15903008056
import numpy as np import pickle def distflow(system): """ Perform power flow calculations using the DistFlow method. """ # Extract the bus data number_of_buses = system['buses'].shape[0] p_load = system['buses'][:, 1] q_load = system['buses'][:, 2] # Extract the branch data numb...
slazar394/Computer-Methods-in-Power-Systems
Lecture 2/Python/distflow.py
distflow.py
py
2,197
python
en
code
1
github-code
90
33488912645
import grpc import uuid from google.protobuf.timestamp_pb2 import Timestamp from google.protobuf.empty_pb2 import Empty import conversation_pb2 import conversation_pb2_grpc from dev import debug from db import conversations from auth import get_user_from_context class ConversationsServicer(conversation_pb2_grpc.Con...
apptomagic/kittens-prototype-be
src/conversation_service.py
conversation_service.py
py
3,008
python
en
code
0
github-code
90
11029314403
""" List and manage repository vulnerabilities and other security information. """ import logging from enum import Enum, unique import features from app import model_cache, storage from auth.decorators import process_basic_auth_no_pass from data.registry_model import registry_model from data.secscan_model import secs...
quay/quay
endpoints/api/secscan.py
secscan.py
py
3,519
python
en
code
2,281
github-code
90
18463436219
import sys input = sys.stdin.readline s = input()[:-1] t = input()[:-1] dp = [[0]*(len(t)+1) for _ in range(len(s)+1)] for i in range(len(s)): for j in range(len(t)): if s[i]==t[j]: dp[i+1][j+1] = dp[i][j]+1 else: if dp[i+1][j]>dp[i][j+1]: dp[i+1][j+1] = dp[...
Aasthaengg/IBMdataset
Python_codes/p03165/s723345283.py
s723345283.py
py
664
python
en
code
0
github-code
90
72479495658
#! /usr/bin/env python # -*- coding: utf-8 -*- # # pms module detect # by leon@2015-07-09 # # curl -d "{\"value\":50}" -H "U-ApiKey: b06b39d890b39332127b90637f728e64" 'http://api.yeelink.net/v1.1/device/11...
yixiaoyang/pyScripts
pm25/pys.py
pys.py
py
2,775
python
en
code
8
github-code
90
25290007930
from __future__ import absolute_import import sys from future import standard_library standard_library.install_aliases() from builtins import zip from builtins import range import threading from queue import Empty, Queue from pimlico.core.modules.map import ProcessOutput, DocumentProcessorPool, DocumentMapProcessM...
markgw/pimlico
src/python/pimlico/core/modules/map/threaded.py
threaded.py
py
10,887
python
en
code
6
github-code
90
70611675818
""" @author: Rossi @time: 2021-01-26 """ import json import re from Broca.message import UserMessage from Broca.utils import find_class, list_class from .event import AgentTriggered, UserUttered, BotUttered from .skill import DeactivateFormSkill, FormSkill, ListenSkill from .skill import OptionSkill, ReplySkill, Skil...
lawRossi/Broca
Broca/task_engine/agent.py
agent.py
py
6,889
python
en
code
4
github-code
90
27090642738
from spack import * class Ghost(CMakePackage, CudaPackage): """GHOST: a General, Hybrid and Optimized Sparse Toolkit. This library provides highly optimized building blocks for implementing sparse iterative eigenvalue and linear solvers multi- and manycore clusters and on heterogenous CPU/GPU...
matzke1/spack
var/spack/repos/builtin/packages/ghost/package.py
package.py
py
2,315
python
en
code
2
github-code
90
18369824219
import sys from bisect import bisect_left from collections import deque def main(): input = sys.stdin.buffer.readline n = int(input()) a = [int(input()) for _ in range(n)] pile = deque() for i in range(n): index = bisect_left(pile, a[i]) if index == 0: pile.appendleft(a...
Aasthaengg/IBMdataset
Python_codes/p02973/s694471352.py
s694471352.py
py
435
python
en
code
0
github-code
90
18022098679
N, Ma, Mb = map(int, input().split()) abc = [list(map(int, input().split())) for _ in range(N)] inf = float('inf') dp = [[[inf] * 401 for _ in range(401)] for _ in range(N + 1)] dp[0][0][0] = 0 for i in range(N): for j in range(401): for k in range(401): if j - abc[i][0] >= 0 and k - abc[i][1...
Aasthaengg/IBMdataset
Python_codes/p03806/s936332644.py
s936332644.py
py
671
python
en
code
0
github-code
90
40008923891
from flask import Flask from flask_smorest import Api from dbflasksqlalchemy import db from resources.person import blp as PersonBlueprint import model # def create_app(db_url=None): app = Flask(__name__) app.config["API_TITLE"] = "Stores REST API" app.config["API_VERSION"] = "v1" app.config["OPENAPI_VERSION"] = "3.0....
aveave/python-research
rest-service/app.py
app.py
py
1,233
python
en
code
0
github-code
90
7623970928
# -*- coding: utf-8 -*- # takes about 30 mins import os import time as t audio_files_dir = './data/signals/dialogues_mono/' output_files_dir = './data/features/gemaps_features/' audio_files=os.listdir(audio_files_dir) csv_file_list = [ file.split('.')[0]+'.'+file.split('.')[1]+'.csv' for file in audio_files] if not(o...
rohithkodali/lstm_turn_taking_prediction
scripts/extract_gemaps.py
extract_gemaps.py
py
1,106
python
en
code
null
github-code
90
10782095488
# !/usr/bin/env python # -*- coding: utf-8 -*- # Author: huizhi.yang # Time: 2022/2/24 20:01 from flask import Blueprint # template_fold 只能写在这里才有效果 # 另外,即使设置了这个,同名的index.html文件夹依然会有问题,所以还是 app_index_init = Blueprint( 'index', __name__, template_folder="templates", static_folder="statics" ) from app_i...
yanghuizhi/Flask_yhz
app_index/__init__.py
__init__.py
py
448
python
zh
code
1
github-code
90
17083546922
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from ..builder import LOSSES from .utils import weight_reduce_loss from .accuracy import accuracy from ..builder import LOSSES from .utils import weight_reduce_loss def logsumexp(x): alpha=torch.exp(x) return alpha+torch.log...
kostas1515/mmdetection_v2.21_dev
mmdet/models/losses/gumbel_focal_loss.py
gumbel_focal_loss.py
py
5,956
python
en
code
0
github-code
90
43394076457
from django.contrib import admin from .models import * class OrderReviewInline(admin.TabularInline): model = Review @admin.register(Category) class CategoryAdmin(admin.ModelAdmin): list_display = ('name', 'slug') prepopulated_fields = {'slug': ('name',)} @admin.register(Product) class ProductAdmin(ad...
Sleeeepy7/shop
listings/admin.py
admin.py
py
574
python
en
code
4
github-code
90
43701860799
# Detect English module # http://inventwithpython.com/codebreaker (BSD Licensed) # To use, run: # import detectEnglish # detectEnglish.isEnglish(someString) # returns True or False # (There must be a "dictionary.txt" file in this directory with all English # words in it, one word per line.) import re dictionaryFi...
SafetyBits/codebreaker
detectEnglish.py
detectEnglish.py
py
2,223
python
en
code
null
github-code
90
42285282667
import os from PIL import Image import numpy as np CAPTCHA_LEN = 4 CAPTCHA_HEIGHT = 45 CAPTCHA_WIDTH = 95 NUMBER = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] LOW_CASE = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', '...
hellokuls/cnnyzm
getimg.py
getimg.py
py
1,353
python
en
code
171
github-code
90
24384494597
#!/usr/bin/python import os.path import subprocess from collections import defaultdict ''' Functions of general use for NGS pipelines ''' def read_samples(sample_file): ''' Read a tsv file containing the sample name and either one or two fastq files to align to a reference genome ''' samples = defaultdict(list)...
MagdalenaZZ/Python_ditties
end-seq-pipline/ngs.py
ngs.py
py
721
python
en
code
0
github-code
90
18510174969
#104B s = input() c_list = [] c_count = 0 answer = "WA" for i in range(2,len(s)-1): if s[i] == "C": c_list.append(i) if s[i].islower() == False: c_count += 1 if s[0]=="A" and s[1].islower()==True and s[-1].islower()==True and len(c_list)==1 and c_count==1: answer="AC" print(answer)
Aasthaengg/IBMdataset
Python_codes/p03289/s572807545.py
s572807545.py
py
310
python
en
code
0
github-code
90
70454989097
import statsmodels.api as sm def jensen_alpha_beta(risk_returns ,benchmark_returns,Rebalancement_frequency): """ Compute the Beta and alpha of the investment under the CAPM Parameters ---------- risk_returns : np.ndarray benchmark_returns : np.ndarray Rebalance...
EM51641/pyinsurance-
pyinsurance/Regressions/OLS_Basic.py
OLS_Basic.py
py
669
python
en
code
0
github-code
90
18039427659
from collections import Counter from typing import AnyStr class UnionFind: def __init__(self, n): self.table = [-1] * n def _root(self, x): stack = [] tbl = self.table while tbl[x] >= 0: stack.append(x) x = tbl[x] for y in stack: tbl...
Aasthaengg/IBMdataset
Python_codes/p03855/s379290698.py
s379290698.py
py
1,234
python
en
code
0
github-code
90
22207477748
class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. """ i = 0 for num in nums: if num != 0: nums[i] = num i += 1 for j in x...
Eurus-Holmes/LCED
Move Zeroes.py
Move Zeroes.py
py
403
python
en
code
11
github-code
90
13018362345
from shiny.ui import tags from shiny_semantic.elements import container, segment def header(): onclick_callback = """ $('.ui.sidebar') .sidebar({ transition: 'overlay', dimPage: true, blurring: true, }) .sidebar('toggle')...
Appsilon/py_shiny_semantic_examples
semantic-components/app_layout.py
app_layout.py
py
1,856
python
en
code
1
github-code
90
26288829055
from guizero import * import serial import time ## ---------------GLOBAL VARIALBES------------------- window_height = 400 window_width = 700 image_size = 250 ## Calibration constants cc1 = 1 cc2 = 0.98 cc3 = 1.1 cc4 = 1 cc5 = 1.2 cc6 = 1 cc7 = 0.8 cc9 = 0.95 cc10 = 1.02 cc11 = 1.15 cc12 = 1 ## ---------------SERIAL ...
evanbrink/drink-machine
Unused files/ButtonObjectTest.py
ButtonObjectTest.py
py
5,485
python
en
code
0
github-code
90
11732509998
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-03-23 15:15:35 # @Author : Yang Sen (yangsen@zuoyebang.com) # @Link : https://github.com/MagicSen # @Version : 1.0.0 import os #import ConfigParser import configparser as ConfigParser ## ## @brief Class for configuration. ## load con...
LuckDog/luggage_volume_predict
server/Configuration.py
Configuration.py
py
1,335
python
en
code
0
github-code
90
6319678617
import itertools from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as checkpoint from ultralytics.utils.instance import to_2tuple class Conv2d_BN(torch.nn.Sequential): """A sequential container that performs 2D convolution followed by batch...
ultralytics/ultralytics
ultralytics/models/sam/modules/tiny_encoder.py
tiny_encoder.py
py
28,577
python
en
code
15,778
github-code
90
29742684144
from autoconf import CONF import sys, traceback import hashlib class SV(object): def __init__(self, size, buff): self.__size = size self.__value = unpack(self.__size, buff)[0] def _get(self): return pack(self.__size, self.__value) def __str__(self): return "0x%x" % self.__value def __int__(self): ...
kumarak/DexAnalyzer
core/bytecode.py
bytecode.py
py
3,632
python
en
code
5
github-code
90
18103476559
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 147 105 output: 21 """ import sys def gcd(x, y): if x < y: x, y = y, x while y > 0: r = x % y x = y y = r return x if __name__ == '__main__': _input = sys.stdin.readlines() n1, n2 = map(int, _input[0].s...
Aasthaengg/IBMdataset
Python_codes/p02256/s645736253.py
s645736253.py
py
350
python
en
code
0
github-code
90
24197797834
from gluon.serializers import loads_json #json serializa codigo (embebe o codifica) def inicio(): return dict() def museosMarkers(): mases = [] rows = db().select(db.museums.ALL,orderby=db.museums.id) for row in rows: mase = { 'lat': row.lat, 'lng': row.lng, 'title': r...
FiorellaVicentin16/LearningGroup
NuevaPrueba/GuiArtec/controllers/mapaMuseos.py
mapaMuseos.py
py
454
python
en
code
0
github-code
90
23244703931
""" 68 Letter - https://codeforces.com/problemset/problem/43/B """ header = input().replace(" ", "") text = input().replace(" ", "") from collections import defaultdict, Counter c = Counter() d = Counter() for i in header: c[i] += 1 for i in text: d[i] += 1 try: for k, v in d.items(): ...
vendyv/A2OJ-Ladders
A2OJ-11/068_B_Letter.py
068_B_Letter.py
py
457
python
en
code
0
github-code
90