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
35069305556
from enum import unique from flask_sqlalchemy import SQLAlchemy from .utils import utcnow db = SQLAlchemy() class Home(db.Model): __tablename__ = "home" id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(120), unique=False, nullable=False) content = db.Column(db.String(250), uniq...
jgustavoj/midwestern-project
src/api/models.py
models.py
py
1,995
python
en
code
0
github-code
6
72492706428
from xdist.scheduler import LoadScheduling class XDistScheduling(LoadScheduling): def __init__(self, config, log, test_order): super().__init__(config, log) self.test_order = test_order def schedule(self): assert self.collection_is_completed # Initial distribution already ha...
JaurbanRH/pytest-persistence
pytest_persistence/XDistScheduling.py
XDistScheduling.py
py
1,428
python
en
code
0
github-code
6
22927248113
import rclpy import math from rclpy.node import Node from sensor_msgs.msg import LaserScan from geometry_msgs.msg import Twist from rclpy.qos import qos_profile_sensor_data class MinimalSubscriber(Node): def __init__(self): super().__init__('minimal_subscriber') self.lin_vel = 0 self.rot...
Anth0o0/02-Robotics_team2
subscriber_member_function.py
subscriber_member_function.py
py
3,418
python
en
code
0
github-code
6
75385541946
for i in range(int(input())): a = int(input()) i_last = -1 last = "F" dp = [0] s = input() for j, c in enumerate(s): if c != "F" and s[i_last] != "F" and c != last: dp.append((dp[i_last + 1] + i_last + 1)) else: dp.append(dp[-1]) if c != "F": ...
fortierq/competitions
fb_hacker_cup/2021/round1/2/weak_typing.py
weak_typing.py
py
412
python
en
code
0
github-code
6
37663232255
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 02:55:11 2021 @author: Anato """ from pathlib import Path source_path = Path(__file__).resolve() source_dir = source_path.parent main_dir = str(source_dir.parent) info_dir = main_dir + '/info/' def open_info(file_name, mode): return open(info_dir + file_name + ...
Anatoly7/codeforces-spider
tutorial/spiders/codeforces_spider.py
codeforces_spider.py
py
1,714
python
en
code
0
github-code
6
25692788695
# !/urs/bin/env python3 # -*- coding: utf-8 -*- """ Project: LAGOU Spider @author: Troy @email: ots239ltfok@gmail.com """ # 项目构架: # p1: 依据搜索关键词 城市 职业, 爬取索引页, 解析并获取相关岗位url接连 # p2: 解析url链接, 获取数据 # p3: 存储到MongoDB # 技术路径: requests urllib json re pq pymongo import requests from requests.exceptions import ConnectionError...
Troysps/spider
lagou/spider.py
spider.py
py
6,376
python
en
code
1
github-code
6
24796364963
from __future__ import division import os import re import sys import struct import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np def load(fname): color = None width = None height = None scale = None endian = None file = open(fname) header = file.readline().rstrip() i...
kbatsos/CBMV
pylibs/pfmutil.py
pfmutil.py
py
1,781
python
en
code
52
github-code
6
33213038710
# 반복문 : while문 # while 조건식 : # 조건식이 참인 경우에 실행될 문장 # 1~100까지 홀수, 짝수의 합을 구하는 프로그램 i = 1; odd = even = 0 while i<=100: if i%2 == 0: even += i else: odd += i i += 1 print('1~100까지 홀수의 합 : ', odd) print('1~100까지 짝수의 합 : ', even)
lilacman888/pythonExam
src/2020_06_02/while03.py
while03.py
py
357
python
ko
code
0
github-code
6
74604827388
import sys a, b, v = map(int, sys.stdin.readline().rstrip().split()) res = v //(a-b) tempV = v %(a-b) res = (v-a) // (a-b) if (v-a) % (a-b) > 0: res += 2 else: res += 1 print(res)
LimTurtle/BasicAlgorithm
Baekjoon/2869.py
2869.py
py
190
python
es
code
0
github-code
6
29852193126
def menu(water,milk,beans,cup,money): print("The Coffee machine has :") print(str(water)+" of water") print(str(milk)+" of milk") print(str(beans)+" of coffee beans") print(str(cup)+" of disposable cups") print(str(money)+" of money") def fill(water,water_add,milk,milk_add,beans,beans_a...
karnthiLOL/myFirstPythonHW
Other/Coffee Cal the great Origins.py
Coffee Cal the great Origins.py
py
3,000
python
en
code
0
github-code
6
12918395650
#!/usr/bin/env python3 """ Import build-in and custom modules to check system utilization and connection""" import shutil import psutil import network site_name = "http://www.google.com" # Verifies that there's enough free space on disk. def check_disk_usage(disk): du = shutil.disk_usage(disk) free = du.free /...
TyapinIA/Coursera_Google_IT_Automation_with_Python
psutil_shutil/health_check.py
health_check.py
py
803
python
en
code
0
github-code
6
4669072111
from Bio.Seq import Seq def get_pattern_count(text, pattern): seq = Seq(text) return seq.count_overlap(pattern) with open('rosalind_ba1e.txt') as file: genome = file.readline().rstrip() k, l, t = map(lambda x: int(x), file.readline().rstrip().split(' ')) genome_len = len(genome) clump = [] for i ...
Partha-Sarker/Rosalind-Problems
Lab Assignment - 1/chapter 1/ba1e Find Patterns Forming Clumps in a String.py
ba1e Find Patterns Forming Clumps in a String.py
py
802
python
en
code
0
github-code
6
12987469517
#A python program to find anagrams of a given word. import sys allLengthAnagrams = [] def findAnagrams(aWord) : anagrams = [] if( len(aWord) == 2 ) : anagrams.append( aWord[0] + aWord[1] ) anagrams.append( aWord[1] + aWord[0] ) return anagrams for i in range(len(aWord)) : ...
CodeSpaceIndica/Python
ep6_anagrams/Anagrams.py
Anagrams.py
py
1,286
python
en
code
4
github-code
6
33062616710
import pandas as pd def agg_count(row): count_x = getattr(row, 'Count_x', 0) count_y = getattr(row, 'Count_y', 0) count = getattr(row, 'Count', 0) row.Count = count + count_x + count_y return row def top3(list_year, PATH): cols = ['Name', 'Gender', 'Count'] names_all = None for yea...
swetlanka/py3
4-1/test.py
test.py
py
1,504
python
en
code
0
github-code
6
3977389831
import psycopg2 import csv from db.create_connection import create_connection as create_connection def import_menu_from_csv(): conn = create_connection() cursor = conn.cursor() with open("menu.csv", mode="r", encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) ...
Tolik1923/restaurantordertaker
Back-end/db/exsport_menu.py
exsport_menu.py
py
1,024
python
en
code
0
github-code
6
30950783677
import numpy as np import sys import matplotlib.pyplot as plt sys.path.append('../../analysis_scripts') from dumpfile import DumpFile from pickle_dump import save_obj, load_obj from spatialcorrelations import calculate_items if __name__ == "__main__": rho = sys.argv[1] fps = np.array([0])#,1,5,10,20,4...
samueljmcameron/ABPs_coarse_graining
experiments/2020_03_19/correlations/plot_correlations.py
plot_correlations.py
py
686
python
en
code
0
github-code
6
34196938558
#!/user/bin/env python # -*- coding:utf-8 -*- import numpy as np import matplotlib.pyplot as plt import h5py #一个HDF5文件就是一个容器,用于储存两类对象:datasets,类似于数组的数据集合;groups,类似于文件夹的容器,可以储存datasets和其它groups。 from lr_utils import load_dataset train_set_x_orig , train_set_y , test_set_x_orig , test_set_y , classes = load_dataset() # i...
CheQiXiao/cfair
fc_net.py
fc_net.py
py
11,968
python
zh
code
0
github-code
6
4374705477
""" Author: Walfred Cutaran Problem: Given a time in -hour AM/PM format, convert it to military (24-hour) time. Note: - 12:00:00AM on a 12-hour clock is 00:00:00 on a 24-hour clock. - 12:00:00PM on a 12-hour clock is 12:00:00 on a 24-hour clock. """ # # Complete the 'timeConversion' function below. # # The function...
walfredcutaran/Hackerrank-Solutions
Solutions/Time Conversion.py
Time Conversion.py
py
951
python
en
code
1
github-code
6
9031625453
import random print("Input 2 numbers and guess the random number the computer chose") def guess_game(): # Lets the user choose lower limit, higher limit and number of tries try: first_num = int(input("Input the lower limit number: ")) second_num = int(input("Input the higher limit numb...
KWenYuan/randompython
numberguess.py
numberguess.py
py
1,744
python
en
code
0
github-code
6
3755198481
import os import csv #Create file path variable budget_csv = os.path.join("Resources", "budget_data.csv") #Create empty lists to store data as we iterate through the CSV file. date = [] profitLoss = [] monthlyChange = [] #Open CSV file and create reader. with open(budget_csv, encoding='utf8', newline='') as csvfile:...
Mattyapolis/Data_Analytics__Homework_2019
03-Python/PyBank/main.py
main.py
py
2,483
python
en
code
0
github-code
6
19715632836
# [https://www.yahoo.com/somerandomstring, http://www.yahoo.com/some/random/string, http://www.google.com] import re def condense(arr): d = {} output = [] domain = re.compile(r'www.\w*.\w*') cleanarr = domain.findall(''.join(arr)) for i in cleanarr: if i in d: d[i] += 1 ...
Nohclu/General
OathQuizQuestion/domains.py
domains.py
py
559
python
en
code
0
github-code
6
3661651084
def sequential_search(data, key): for item in data: if item == key: return True return False my_list = [3, 6, 2, 9, 4, 7] key = 6 found = sequential_search(my_list, key) if found: print("elemen ditemukan.") else: print("elemen tidak ditemukan")
debbypermatar/SequencialSearch_BinarySearch
sequential_search.py
sequential_search.py
py
297
python
en
code
1
github-code
6
28187322584
import sys input = sys.stdin.readline input_num = int(input()) ops = [0 for _ in range(input_num+1)] for i in range(2, input_num+1): ops[i] = ops[i-1]+1 if i % 3 == 0: ops[i] = min(ops[i], ops[i//3] + 1) if i % 2 == 0: ops[i] = min(ops[i], ops[i//2] + 1) print(ops[input_num])...
Bandi120424/Algorithm_Python
백준/Silver/1463. 1로 만들기/1로 만들기.py
1로 만들기.py
py
322
python
en
code
0
github-code
6
44701138323
import os import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.gridspec as gridspec def plot(samples): x_dim=samples.shape[1] color=samples.shape[3] fig = plt.figure(figsize=(4, 4)) gs = gridspec.GridSpec(4, 4) gs.update(wspa...
adityagarg/improvedWGANs
utils.py
utils.py
py
2,488
python
en
code
0
github-code
6
69900225789
import enum from PySide2 import QtCore from PySide2.QtCore import QPoint from PySide2.QtGui import QColor, QFont, QFontDatabase from PySide2.QtWidgets import QGraphicsSceneMouseEvent, QGraphicsItem class NodeState(enum.Enum): normal = 0 used = 1 highlight = 2 class Node(QGraphicsItem): Type = QGrap...
JIuH4/KB_V2
ui_elements/graph_items/node.py
node.py
py
2,560
python
en
code
0
github-code
6
21325562870
import pytest from pysyncgateway import Database, Query @pytest.fixture def database(admin_client): """ Returns: Database: 'db' database written to Sync Gateway. """ database = Database(admin_client, 'db') database.create() return database @pytest.fixture def query(database): ""...
constructpm/pysyncgateway
tests/query/conftest.py
conftest.py
py
3,136
python
en
code
1
github-code
6
3037885810
def solution(n): answer = [] triangle = [[0] * n for _ in range(n)] num = 1 x, y = -1, 0 for i in range(n): for j in range(i, n): if i % 3 == 0: x += 1 elif i % 3 == 1: y += 1 elif i % 3 == 2: x -= 1 ...
sunyeongchoi/sydsyd_challenge
argorithm/trianglesnail.py
trianglesnail.py
py
606
python
en
code
1
github-code
6
17034031092
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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 Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
satishgoda/fluid-designer-scripts
scripts/startup/fluid_ui/space_fluid_view3d_tools.py
space_fluid_view3d_tools.py
py
7,224
python
en
code
1
github-code
6
13231283002
""" @Author : Hirsi @ Time : 2020/7/3 """ """ 思路(线程池) 1.定义变量,保存源文件夹,目标文件夹所在的路径 2.在目标路径创建新的文件夹 3.获取源文件夹中所有的文件(列表) 4.便利列表,得到所有的文件名 5.定义函数,进行文件拷贝 文件拷贝函数 参数(源文件夹路径,目标文件夹路径,文件名) 1.拼接源文件和目标文件的具体路径 2.打开源文件,创建目标文件 3.读取源文件的内容,写入到目标文件中(while) """ import os import multiprocessing ...
gitHirsi/PythonNotes02
day07-多任务-进程/10-文件夹拷贝器_多进程版.py
10-文件夹拷贝器_多进程版.py
py
2,139
python
zh
code
0
github-code
6
24143273312
from selenium.webdriver import Chrome,ChromeOptions from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import xlsxwriter opts = ChromeOptions() opts.add_experimental_option("detach", True) driver = Chrome(chrome_options=opts) driver.get("https://google.com") driver.maximize_...
keremguzel/selenium-excel-import
main.py
main.py
py
2,595
python
en
code
0
github-code
6
39654504754
import os from .register import register_cityscapes_segmentation, register_voc_context_segmentation_dataset from .seg_builtin_meta import get_segmentation_builtin_meta_data _CITYSCAPES_SPLITS = {} _CITYSCAPES_SPLITS['cityscapes'] = { 'cityscapes_train': ('cityscapes/leftImg8bit/train', 'cityscapes/gtFine/train')...
lqxisok/llSeg
datasets/segmentation/seg_builtin.py
seg_builtin.py
py
1,519
python
en
code
2
github-code
6
24826000762
import numpy as np import pandas as pd def main(): df1 = pd.DataFrame() print(df1) time_vals = np.arange(1628610738, 1628611738) data_vals = np.ones(1000) s1 = pd.Series(data_vals, time_vals) df1['S1'] = s1 print(df1) dv2 = np.random.uniform(10, 20, 1000) s2 = pd.Series(dv2, time_v...
dantesdoesthings/danteswebsite
sandbox/dataframe_testing.py
dataframe_testing.py
py
785
python
en
code
0
github-code
6
5272336888
import gradio as gr import pytesseract from langchain import PromptTemplate from langchain.chains import RetrievalQA from langchain.chat_models import ChatOpenAI from langchain.embeddings import OpenAIEmbeddings from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain.vectorstores import Chroma...
motomk/pdf_gpt
main.py
main.py
py
2,156
python
ja
code
0
github-code
6
34373278865
import os from unittest import TestCase import jinja2 from apply.issue.issure_js_auto_code.db_util import res_to_dict from config.db_conf import localhost_oa_engine from util.str_util import to_lower_camel, to_snake, to_upper_camel class Form: @staticmethod def get_tables(db): sql = "select TABLE_N...
QQ1134614268/PythonTemplate
src/apply/issue/issure_js_auto_code/js_auto_code_v0.py
js_auto_code_v0.py
py
3,508
python
en
code
2
github-code
6
7657570760
#!/usr/bin/python3 """ The function "add_integer" adds two integers """ def add_integer(a, b=98): """ Check if arguments are of the required type, else raise TypeError """ if a is None and b is None: raise TypeError("add_integer() missing 1 required" "positional argumen...
frace-engineering/alx-higher_level_programming
0x07-python-test_driven_development/0-add_integer.py
0-add_integer.py
py
738
python
en
code
0
github-code
6
58242642
try: from zohocrmsdk.src.com.zoho.crm.api.exception import SDKException from zohocrmsdk.src.com.zoho.crm.api.util import Constants except Exception: from ..exception import SDKException from ..util import Constants class Backup(object): def __init__(self): """Creates an instance of Backup""" self.__rrule = ...
zoho/zohocrm-python-sdk-5.0
zohocrmsdk/src/com/zoho/crm/api/backup/backup.py
backup.py
py
4,949
python
en
code
0
github-code
6
32585270834
import cv2 import numpy as np from .base import BaseTask class BlurAndPHash(BaseTask): def __init__(self): super().__init__(taskID=4, taskName='BlurAndPHash') self.thresholdLaplacian = 120 self.thresholdDiffStop = 120 self.thresholdDiffPre = 25 self.hashLen = 32 se...
Cloudslab/FogBus2
containers/taskExecutor/sources/utils/taskExecutor/tasks/blurAndPHash.py
blurAndPHash.py
py
2,292
python
en
code
17
github-code
6
3831338977
# encoding=utf-8 import logging import logging.config import os import sys import time import traceback import datetime def init_log(name='root'): path = os.path.dirname(__file__) config_file = path + os.sep + 'logger.conf' log_path = os.path.join(os.path.abspath(__file__ + ('/..' * 3)), 'zz_logs') i...
charliedream1/ai_quant_trade
tools/log/log_util.py
log_util.py
py
3,053
python
en
code
710
github-code
6
37446574229
from metux.util.task import Task, TaskFail from metux.util.git import GitRepo """Task: clone an git repo w/ initial checkout""" class GitCloneTask(Task): def do_run(self): spec = self.param['spec'] repo = GitRepo(spec['path']) repo.initialize() for remote in spec['remotes']: ...
LibreZimbra/librezimbra
deb_autopkg/util/tasks_git.py
tasks_git.py
py
1,389
python
en
code
4
github-code
6
51383141
from typing import * import random class Solution: def partition(self, nums, left, right): pivot = random.randint(left, right) nums[pivot], nums[right] = nums[right], nums[pivot] i = left for j in range(left, right): if nums[j] <= nums[right]: nums...
code-cp/leetcode
solutions/961/main2.py
main2.py
py
1,550
python
en
code
0
github-code
6
7437025622
"""Module containing class `UntagClipsCommand`.""" import logging import random import time from django.db import transaction from vesper.command.clip_set_command import ClipSetCommand from vesper.django.app.models import Job, Tag, TagEdit, TagInfo import vesper.command.command_utils as command_utils import vesper....
HaroldMills/Vesper
vesper/command/tag_clips_command.py
tag_clips_command.py
py
7,835
python
en
code
47
github-code
6
29685980647
import re import pep8 import six """ Guidelines for writing new hacking checks - Use only for Octavia specific tests. OpenStack general tests should be submitted to the common 'hacking' module. - Pick numbers in the range O3xx. Find the current test with the highest allocated number and then pick the next va...
BeaconFramework/Distributor
octavia/hacking/checks.py
checks.py
py
7,161
python
en
code
1
github-code
6
45413329386
import os import pathlib import pandas as pd import keyring import dropbox from dropbox.exceptions import AuthError # Directory BASE_DIR = os.path.dirname(os.path.abspath(__file__)) dropbox_home = "https://www.dropbox.com/home/" dropbox_app = "MAD_WahooToGarmin" dropbox_app_dir = "/Apps/WahooFitness/" DROPBOX_ACCESS_...
michaeladavis10/WahooToGarmin
dropbox_utils.py
dropbox_utils.py
py
2,994
python
en
code
0
github-code
6
42399945606
"""empty message Revision ID: a5cfe890710d Revises: 7352c721e0a4 Create Date: 2023-05-28 16:47:42.177222 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'a5cfe890710d' down_revision = '7352c721e0a4' branch_labels = None depends_on = None def upgrade(): # ...
RBird111/capstone-yelp-clone
migrations/versions/20230528_164742_.py
20230528_164742_.py
py
1,132
python
en
code
1
github-code
6
39688530564
# Time: O(n) # Space: O(n) # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def pathSum(self, root: TreeNode, sum: int) -> int: """ Use cumulative sum, in each root to l...
cmattey/leetcode_problems
Python/lc_437_path_sum_iii.py
lc_437_path_sum_iii.py
py
960
python
en
code
4
github-code
6
32166211761
import requests from bs4 import BeautifulSoup import json def get_description(url): response = requests.get(url) if response is not None: soup = BeautifulSoup(response.text, 'html.parser') description = {} l1 = [] l2 = [] for item in soup.find_all("span", class_="adPage__content__fea...
Drkiller325/PR_Lab2
homework.py
homework.py
py
1,157
python
en
code
0
github-code
6
30534890966
import re import sys import subprocess class INA3221: I2C_ADDR = 0x40 MANUFACTURER_ID_VALUE = 0x5449 #Texas Instruments DIE_ID_VALUE = 0x3220 #INA 3221 class Reg: MANUFACTURER_ID = 0xFE DIE_ID = 0xFF CH1_SHUNT = 0x1 CH1_BUS = 0x2 ShiftChannel = 0x2 @staticmethod def read(bus, register): reved = bus....
galkinvv/galkinvv.github.io
nvidia-sensors.py
nvidia-sensors.py
py
3,340
python
en
code
29
github-code
6
14471351413
''' Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account. Now, we would like to merge these accounts. Two accounts definitely belong to the same person if there is some email th...
loganyu/leetcode
problems/721_accounts_merge.py
721_accounts_merge.py
py
2,893
python
en
code
0
github-code
6
30804267516
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression if __name__ == '__main__': # 将csv数据读取为pandas对象 fund = pd.read_csv('./csv/001112.csv', dtype={'fcode': str}) # 转化时间字符串为时间 fund['fdate'] = pd.to_datetime(fund['fdate']) #...
bobchi/learn_py
23.py
23.py
py
1,416
python
en
code
0
github-code
6
25805435139
import random from models.storage import * ########################## # Monte-Carlo Prediction # ########################## # Source : Reinforcement Learning : an introcuction, Sutton & Barto, p.92 class MCPrediction: def __init__(self, game, gamma=0.8, default_q=999): self.V = {} self.Returns = S...
AMasquelier/Reinforcement-Learning
models/solo.py
solo.py
py
9,650
python
en
code
0
github-code
6
40033463881
import json from pathlib import Path import numpy as np import torch import torch.utils.data from PIL import Image from panopticapi.utils import rgb2id from utils.utils import masks_to_boxes from dataset.utils import make_coco_transforms city2int = { "aachen": 0, "bremen": 1, "darmstadt": 2, "erfurt"...
adilsammar/detr-fine
archived/dataset/cts_dataset.py
cts_dataset.py
py
5,196
python
en
code
4
github-code
6
38368937564
import string, itertools ascii_lowercases = list(string.ascii_lowercase) MAX_WORD_LENGTH = 5 for i in range(1, MAX_WORD_LENGTH + 1): charlist = [[x for x in ascii_lowercases]] * i for combinations in itertools.product(*charlist): combinations = "".join(combinations) with open("../wordlist.tx...
1LCB/hash-cracker
complement/wordlist generator.py
wordlist generator.py
py
407
python
en
code
2
github-code
6
17466316782
#!/usr/bin/env python # -*- coding: UTF-8 -*- # File: cifar-convnet.py # Author: Yuxin Wu <ppwwyyxxc@gmail.com> import tensorflow as tf import argparse import numpy as np import os from tensorpack import * import tensorpack.tfutils.symbolic_functions as symbf from tensorpack.tfutils.summary import * from tensorpack.ut...
jxwufan/NLOR_A3C
tensorpack/examples/cifar-convnet.py
cifar-convnet.py
py
5,549
python
en
code
16
github-code
6
6363984731
# This program reads data from a CD catalog data set # and builds arrays for the catalog items # Each array contains the title, artist, country, price, and year # At the bottom, the total number of items and average price is # displayed # References: datacamp.com, stackoverflow.com # References: datacamp.com, stackove...
Prowler01/CIS106_ThomasLam
Final Project/Final Project.py
Final Project.py
py
3,748
python
en
code
0
github-code
6
20894068105
import cv2 import math import monta import numpy as np import matcompat from scipy import signal import matplotlib.pyplot as plt lammbda=6 pi = math.pi theta = np.arange(0, (np.pi-np.pi/8)+(np.pi/8), np.pi/8) psi = 0 gamma = np.linspace(.4,1,4) gamma = np.arange(.4, 1.2, .2) b = 4 sigma = (1/pi)*math.sqrt((math.log(2)...
ErickJuarez/AtencionSelectiva
Python/main.py
main.py
py
2,566
python
en
code
0
github-code
6
36030730386
"""Timezones lookup.""" import concurrent.futures import os import shutil import subprocess import sys import time import traceback from datetime import datetime from multiprocessing import cpu_count from pathlib import Path import pytz import requests import tzlocal from fuzzywuzzy import process import pycountry i...
ppablocruzcobas/Dotfiles
albert/timezones/__init__.py
__init__.py
py
7,290
python
en
code
2
github-code
6
36653559534
#!/usr/bin/python3 # Codeforces - Round 640 # Problem A - Sum of Round Numbers def read_int(): n = int(input()) return n def read_ints(): ints = [int(x) for x in input().split(" ")] return ints #--- def solve(n): s = str(n) l = len(s) sol = [] for i in range(l): val = s[i] if val != '0': si = va...
thaReal/MasterChef
codeforces/round_640/round.py
round.py
py
495
python
en
code
1
github-code
6
7985866436
import numpy as np import cv2 import time def my_padding(src, filter): (h, w) = src.shape if isinstance(filter, tuple): (h_pad, w_pad) = filter else: (h_pad, w_pad) = filter.shape h_pad = h_pad // 2 w_pad = w_pad // 2 padding_img = np.zeros((h+h_pad*2, w+w_pad*2)) ...
201402414/CG
[CG]201402414_장수훈_5주차_과제/[CG]201402414_장수훈_5주차_과제/integral_image_report.py
integral_image_report.py
py
8,317
python
en
code
0
github-code
6
37055851732
from unittest.runner import TextTestRunner import urllib.request import unittest from typing import TypeVar, Callable, List T = TypeVar('T') S = TypeVar('S') ################################################################################# # EXERCISE 1 #################################################################...
saronson/cs331-s21-jmallett2
lab03/lab03.py
lab03.py
py
8,672
python
en
code
2
github-code
6
8670124375
import pandas as pd import pickle df=pd.read_csv(r'C:/Users/SAIDHANUSH/spam-ham.csv') df['Category'].replace('spam',0,inplace=True) df['Category'].replace('ham',1,inplace=True) x=df['Message'] y=df['Category'] from sklearn.feature_extraction.text import CountVectorizer cv=CountVectorizer() x=cv.fit_tra...
dhanush77777/spam-messages-classification-app
nlp_model.py
nlp_model.py
py
770
python
en
code
0
github-code
6
15917643475
from django.shortcuts import render, redirect, get_object_or_404 from django.shortcuts import render, get_object_or_404 from .models import * from .forms import * from .models import Product from .forms import ProductUpdateForm from .models import Category from django.http import JsonResponse # libraries for Im...
elumes446/Store-Management-System
Store Managment System/main/views.py
views.py
py
7,245
python
en
code
0
github-code
6
71830613309
def for_P(): for row in range(7): for col in range(6): if col==0 or (row%3==0 and col<5 and row<6) or (col==5 and row%3!=0 and row<3): print("*",end=" ") else: print(end=" ") print() def while_P(): i=0 while i<7: j...
Ashokkommi0001/patterns
Alp/cap_alp/P.py
P.py
py
560
python
en
code
2
github-code
6
23682024390
import datetime def rest_sec_of_day(): """ :return: 截止到目前当日剩余时间 """ today = datetime.datetime.strptime(str(datetime.date.today()), "%Y-%m-%d") tomorrow = today + datetime.timedelta(days=1) nowTime = datetime.datetime.now() return (tomorrow - nowTime).seconds # 获取秒
peacefulyin/gh
BackEnd/util/common.py
common.py
py
339
python
en
code
0
github-code
6
40411312041
#!/usr/bin/env python3 """ Name: bgp_neighbor_prefix_received.py Description: NXAPI: display bgp neighbor summary info """ our_version = 109 script_name = "bgp_neighbor_prefix_received" # standard libraries import argparse from concurrent.futures import ThreadPoolExecutor # local libraries from nxapi_netbox.args.args_...
allenrobel/nxapi-netbox
scripts/bgp_neighbor_prefix_received.py
bgp_neighbor_prefix_received.py
py
4,416
python
en
code
0
github-code
6
32990866297
import tensorflow as tf def cast_float(x, y): x = tf.cast(x, tf.float32) return x, y def normalize(x, y): x = tf.reshape(x, (-1, 28, 28, 1)) x = x / 255.0 return x, y def augment(x, y): x = tf.image.random_flip_left_right(x) x = tf.image.random_flip_up_down(x) return x, y def ...
christophstach/ai-robotics
src/excercise_1/src/dataset.py
dataset.py
py
1,250
python
en
code
0
github-code
6
26189029070
import datetime import table import restaurant class Restaurant: def __init__(self): self.tables = [] self.name = "Restaurant Dingo" for i in range(8): self.tables.append(table.Table(i)) def get_tables(self): return self.tables def print_tables(self): for i in range(8):...
jemmajh/Reservation_system_Y2
restaurant.py
restaurant.py
py
560
python
en
code
0
github-code
6
73526892347
#!/usr/bin/python3 import os filename = os.path.basename(__file__) # 如果鲁迅也炒股 textStr = '我家门前有两棵树,一棵是绿枣树,另一棵也是绿枣树。' voiceArr = ['YunjianNeural'] for v in voiceArr: shell = f'edge-tts --text {textStr} --voice zh-CN-{v} --write-media ./audios/{filename}.{v}.mp3' os.system(shell)
zhouhuafei/edge-tts-case
scripts/20230421.1.py
20230421.1.py
py
348
python
en
code
0
github-code
6
42928428434
class Solution: def maxOnesRow(self,arr, n, m): i, j, ans = 0, m-1, -1 while i < n: while j >= 0 and arr[i][j] == 1: ans = i j -= 1 i += 1 return ans obj = Solution() arr, n, m = [[0, 1, 1, 1], [0, 0, 1, 1], [1, 1, 1, 1], [0, 0, 0, 0...
shwetakumari14/Leetcode-Solutions
Array/GFG/Row with max 1s.py
Row with max 1s.py
py
371
python
en
code
0
github-code
6
41058762766
class Poly: def __init__(self,*terms): # __str__ uses the name self.terms for the dictionary of terms # So __init__ should build this dictionary from terms self.terms = {} for i in terms: assert type(i[0]) in (int,float) assert type(i[1]) == int,...
solomc1/python
ics 33/solutions/ile2 solutions/Lab 6/VegaHector/poly.py
poly.py
py
5,121
python
en
code
0
github-code
6
41211987806
import matplotlib.pyplot as plt import librosa import librosa.display import os import torch from torch.distributions.beta import Beta import numpy as np from pytorch_lightning.callbacks import Callback import torch.nn as nn from einops import rearrange from tqdm import tqdm from helpers import nessi image_folder = "...
CPJKU/cpjku_dcase22
helpers/utils.py
utils.py
py
4,903
python
en
code
18
github-code
6
70103613629
#!/usr/bin/env python3 """ Example for Implied Volatility using the NAG Library for Python Finds implied volatilities of the Black Scholes equation using specfun.opt_imp_vol Data needs to be downloaded from: http://www.cboe.com/delayedquote/QuoteTableDownload.aspx Make sure to download data during CBOE Trading Hours. ...
cthadeufaria/passport
investing/impliedVolatility.py
impliedVolatility.py
py
9,398
python
en
code
0
github-code
6
20775589752
import numpy as np class StaticFns: @staticmethod def termination_fn(obs, act, next_obs): assert len(obs.shape) == len(next_obs.shape) == len(act.shape) == 2 height = next_obs[:, 0] angle = next_obs[:, 1] not_done = (height > 0.8) \ * (height < 2.0) \ ...
duxin0618/CDA-MBPO
static/walker2d.py
walker2d.py
py
756
python
en
code
0
github-code
6
34268489867
'''Проверка гипотезы Сиракуз''' # Гипотеза Сиракуз гласит, что любое натуральное число сводится к единице при следующих # действиях над ним: а) если число четное, то разделить его пополам, б) если число нечетное, # то умножить его на 3, прибавить 1 и результат разделить на 2. Над вновь полученным # числом вновь повтори...
ziGFriedman/My_programs
Testing_the_Syracuse_hypothesis.py
Testing_the_Syracuse_hypothesis.py
py
920
python
ru
code
0
github-code
6
34228406110
from pymongo.collection import Collection from bson.objectid import ObjectId def insert_object(obj: dict, collection: Collection): """Вставка объекта в коллекцию""" obj['fields'] = list(obj['fields'].items()) return collection.insert_one(obj).inserted_id def delete_object(object_id: str, collection: Col...
AKovalyuk/test-task
app/db/crud.py
crud.py
py
1,341
python
ru
code
0
github-code
6
35717342742
import torch import torch.nn as nn from utils.resnet_infomin import model_dict import torch.nn.functional as F from collections import OrderedDict class RGBSingleHead(nn.Module): """RGB model with a single linear/mlp projection head""" def __init__(self, name='resnet50', head='linear', feat_dim=128): ...
VirtualSpaceman/ssl-skin-lesions
utils/build_backbone_infomin.py
build_backbone_infomin.py
py
10,323
python
en
code
7
github-code
6
437075340
#[3.2, [[1, 0, 1, 0, 2], [330, 0, 220, 180, 20], [190, 120, 190, 120, 290], [[230, 800, 530, 800, 430], [350, 480, 350, 50, 680]]], [[2, 1, 1], [0, 1, 0], [2, 1, 0], [0, 1, 1], [3, 0, 0]], [False, False, False, False, False]] # consecutive classes longest consecutive class time time after counter ...
iam4722202468/GuelphScheduler
python/finalRating.py
finalRating.py
py
3,051
python
en
code
0
github-code
6
39441402911
from mlearn import base from functools import reduce from datetime import datetime from mlearn.data.dataset import GeneralDataset from mlearn.data.batching import Batch, BatchExtractor from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer de...
zeeraktalat/mlearn
mlearn/utils/pipeline.py
pipeline.py
py
2,898
python
en
code
2
github-code
6
74377247228
''' @Author: Never @Date: 2020-06-13 11:02:05 @Description: @LastEditTime: 2020-07-14 15:20:19 @LastEditors: Never ''' #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/4/27 19:47 # @Author : Shark # @Site : # @File : lepin1.py # @Software: PyCharm import csv import requests import json import ...
gitxzq/py
lepin1.py
lepin1.py
py
2,131
python
en
code
0
github-code
6
27986132061
# dataset settings dataset_type = 'DIORVOCDataset' data_root = 'data/DIOR_VOC/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(...
cenchaojun/mmd_rs
DOTA_configs/_base_/datasets/DIOR_VOC.py
DIOR_VOC.py
py
2,196
python
en
code
1
github-code
6
19274830613
#!/usr/bin/env python ''' Created on Jun 28, 2016 @author: isvoboda ''' from __future__ import print_function import sys import multiprocessing import logging import yaml import argparse from collections import OrderedDict import cnn_image_processing as ci import signal signal.signal(signal.SIGINT, lambda x, y: sys...
DCGM/cnn-image-processing
bin/train_cnn.py
train_cnn.py
py
5,210
python
en
code
0
github-code
6
8773605987
import streamlit as st from utils import get_modelpaths from Scripts.video_processor import webcam_input def main(): model_list = ["AnimeGANv2_Hayao","AnimeGANv2_Shinka","AnimeGANv2_Paprika"] st.title("Real-time Anime to Anime Converter") model_name = st.selectbox("Select model name", model_list) mod...
avhishekpandey/RealTime_video-to-anime
app.py
app.py
py
427
python
en
code
0
github-code
6
19203747427
try: import usocket as socket except: import socket import re from tof_i2c import TOF10120 tof=TOF10120() import Site import network from machine import Pin from neopixel import NeoPixel import time import math from Site import WebPage from Distance import DistanceMethods from Sides import SidesMethods from Brak...
TomD14/HoReCaRobot
Horizontal Led strip User Test/main.py
main.py
py
3,920
python
en
code
0
github-code
6
21672470765
#!/usr/bin/python #coding:utf-8 """ Author: Andy Tian Contact: tianjunning@126.com Software: PyCharm Filename: get_heatMap_html.py Time: 2019/2/21 10:51 """ import requests import re def get_html(): ''' 获取百度热力图demo的源代码 :return: h5代码 ''' url = "http://lbsyun.baidu.com/jsdemo/demo/c1_15.htm" he...
tianzheyiran/HeatMap
get_heatMap_html.py
get_heatMap_html.py
py
2,229
python
en
code
1
github-code
6
74693961467
import torch import time import torch.nn.functional as F def train(model, device, train_loader, optimizer, epoch): # 训练模型 model.train() best_acc = 0.0 for batch_idx, (x1, x2, x3, y) in enumerate(train_loader): start_time = time.time() x1, x2, x3, y = x1.to(device), x2.to(device), x3.to(d...
Huasheng-hou/r2-nlp
src/utils.py
utils.py
py
2,866
python
en
code
0
github-code
6
27259799820
"""We are the captains of our ships, and we stay 'till the end. We see our stories through. """ """257. Binary Tree Paths """ class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None class Solution: def dfs(self, root, curr_path): if not roo...
asperaa/back_to_grind
Trees/binary_tree_paths.py
binary_tree_paths.py
py
777
python
en
code
1
github-code
6
35347629144
import json with open('mahasiswa.json', 'r') as file: a = json.load(file) b = dict() c = int(input("Masukkan Jumkah Mahasiswa baru : ")) for i in range(c): nm = input("Masukkan nama anda: ") hb = [] untuk_hobi = int(input("Masukkan jumlah hobi: ")) for j ...
TIRSA30/strukdat_04_71210700
ug4.py
ug4.py
py
705
python
en
code
0
github-code
6
28924320598
import os from flask import Flask, request, abort, jsonify from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS import random from sqlalchemy import func from models import setup_db, Question, Category QUESTIONS_PER_PAGE = 10 # Create APP and settings cors headers def create_app(test_config=None): ...
steffaru/udacity-trivia-api-project
starter/backend/flaskr/__init__.py
__init__.py
py
8,097
python
en
code
1
github-code
6
20914243110
"""added columns to Places Revision ID: cba44d27f422 Revises: 061ea741f852 Create Date: 2023-06-28 15:56:11.475592 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'cba44d27f422' down_revision = '061ea741f852' branch_labels = None depends_on = None def upgrade...
choihalim/halfway
server/migrations/versions/cba44d27f422_added_columns_to_places.py
cba44d27f422_added_columns_to_places.py
py
1,294
python
en
code
0
github-code
6
16816563467
import json import requests from django.http import JsonResponse from django.shortcuts import render import numpy as np # Create your views here. from django.template.defaultfilters import upper from django.template.loader import render_to_string from apps.utils.cases import get_scenario_on_day from apps.utils.dat...
Akijunior/corona-relatorio
src/apps/core/views.py
views.py
py
2,580
python
en
code
0
github-code
6
42951183100
class Address: def __init__(self, obj): """ See "https://smartystreets.com/docs/cloud/us-reverse-geo-api#address" """ self.street = obj.get('street', None) self.city = obj.get('city', None) self.state_abbreviation = obj.get('state_abbreviation', None) self.zip...
smartystreets/smartystreets-python-sdk
smartystreets_python_sdk/us_reverse_geo/address.py
address.py
py
398
python
en
code
25
github-code
6
36014041676
import torch.nn as nn import tqdm import torch class ANN(nn.Module): def __init__(self, input=4): super().__init__() # self.relu1 = nn.ReLU(inplace=True) self.liner1 = nn.Linear(input,128) self.relu = nn.ReLU() self.liner2 = nn.Linear(128,8) self.liner3 = nn.Linear(8...
infinity-linh/Bot_Inf
scripts/model_ANN.py
model_ANN.py
py
539
python
en
code
0
github-code
6
74525063866
import argparse from datetime import datetime import os import sys import time import random from Classifier_3d_v1 import Classifier import tensorflow as tf from util import Visualizer import numpy as np from dataset_classifier import LungDataset import torch from ops import load,save,pixelwise_cross_entropy import tor...
jimmyyfeng/Tianchi-1
Tianchi_tensorflow/train_classifier.py
train_classifier.py
py
3,980
python
en
code
5
github-code
6
24890875535
#!/bin/env python # -*- coding: UTF-8 -*- import wx import os import sys import shutil import re import math from bqList import MyBibleList from exhtml import exHtmlWindow class MyApp(wx.App): path = None def __init__(self, *args, **kwds): wx.App.__init__ (self, *args, **kwds) def OnInit(self): self....
noah-ubf/BQTLite
pybq.py
pybq.py
py
19,493
python
en
code
1
github-code
6
26293955207
import os import shutil #path that this script is in path = os.path.dirname(os.path.realpath(__file__)) #r = root, d = directories, f = files for r, d, f in os.walk(path): for file in f: if '.c' in file: #joins the root and file to make file p...
rijaasif/2SH4
FILE_SCRIPTS/GET_TXT.py
GET_TXT.py
py
803
python
en
code
0
github-code
6
2778228066
import types from imp import reload def print_status(module): print(f'reloading {module.__name__}') def try_reload(module): try: reload(module) except Exception as e: print(f'FAILED {e.__repr__()} : {module}') def transitive_reload(module, visited): if not module in visited: p...
Quessou/quessoutils
qssmodules/reloadall.py
reloadall.py
py
967
python
en
code
0
github-code
6
14159066621
import tkinter as tk from tkinter import ttk import pyautogui import pygetwindow # The app was developed by Tom Girshovksi. class CenterWindowGUI: def __init__(self, master): self.master = master master.title("Center Window") # Create the frame self.frame = ttk.Frame(master, paddin...
R1veltm/WindowCenterizer
main.py
main.py
py
3,398
python
en
code
2
github-code
6
43447079150
import sys, re from argparse import ArgumentParser #import the library parser = ArgumentParser(description = 'Classify a sequence as DNA or RNA') #create one ArgumentParser parser.add_argument("-s", "--seq", type = str, required = True, help = "Input sequence") #add the first argument parser.add_argument("-m", "--mot...
stepsnap/git_HandsOn
seqClass.py
seqClass.py
py
1,881
python
en
code
0
github-code
6
10996457940
import time import pyrealsense2 as rs import numpy as np import cv2 import os import open3d as o3d intrinsics = np.array([ [605.7855224609375, 0., 324.2651672363281, 0.0], [0., 605.4981689453125, 238.91090393066406, 0.0], [0., 0., 1., 0.0], [0., 0., 0., 1.],]) ROOT_DIR ...
midea-ai/CMG-Net
utils/get_points.py
get_points.py
py
6,789
python
en
code
3
github-code
6
20182818588
# File: utils.py # Name: Sergio Ley Languren """Utility for wordle program""" from WordleDictionary import FIVE_LETTER_WORDS from WordleGraphics import CORRECT_COLOR, PRESENT_COLOR, MISSING_COLOR, UNKNOWN_COLOR, N_COLS, N_ROWS, WordleGWindow from random import choice from typing import Type, Union, Optional from copy...
SLey3/Project-1
utils.py
utils.py
py
4,316
python
en
code
0
github-code
6
43011396057
"""Calculate various statistics for the CEA playerbase, and stores in a spreadsheet. Attributes: counts (Counter): counting number of games EXTRA_GAMES_FILE (str): File to be used if we need to input extra games K (int): K-value used for elo ratings. """ import csv import json import os import re...
carsonhu/cea-elo
calculate_elo.py
calculate_elo.py
py
16,986
python
en
code
3
github-code
6