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
5785098674
import numpy as np from nnlib.propagation import propagation from nnlib.sl import load_parameters from nnlib.dataset import load_dataset, flatten, normalization import matplotlib.pyplot as plt train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, label = load_dataset( "datasets/train.h5", "datasets/test.h5" ...
scripe2022/machine-learning
catvsnoncat_snn/predict.py
predict.py
py
1,209
python
en
code
0
github-code
36
5347720873
from operator import mul from functools import reduce def combinations_count(n, r): r = min(r, n - r) numer = reduce(mul, range(n, n - r, -1), 1) denom = reduce(mul, range(1, r + 1), 1) return numer // denom N, L = map(int, input().split()) l = N%L cnt = 0 for l in range(N//L+1): x = N-L*l cnt ...
hrkhrkhrk/Atom
kyopro_educational_90/50_StairJump.py
50_StairJump.py
py
371
python
en
code
0
github-code
36
39723147483
from fastapi import Response, HTTPException from odmantic import Field from pydantic import BaseModel from pydantic.main import ModelMetaclass from starlette.background import BackgroundTask import typing from dojo.shared.supported_services import SupportedServices if typing.TYPE_CHECKING: from dojo.shared.error_m...
ms7m/dojo
dojo/shared/response.py
response.py
py
3,595
python
en
code
0
github-code
36
10139864507
import bpy import os import random from os.path import isfile output_fname_tpl = os.getenv('FRAME_FNAME','frame%06d') def frame_done(n): return isfile(output_fname_tpl % n + ".png") def frames_todo(): all_frames = range(bpy.context.scene.frame_start, bpy.context.scene.frame_end+1) return [n for n in all_frames...
emanaev/render-test
blender/script.py
script.py
py
869
python
en
code
1
github-code
36
39826357335
import logparser import numpy as np from matplotlib import pyplot as plt access_log = open("access.log","r") dt_counter = {} for line in access_log: logDict = logparser.parser(line) dat = logDict['time'][:11] if dat not in dt_counter: dt_counter[dat] = 1 else: dt_counter[da...
SaneshSabu/Visualisation-of-Log-file-using-Python-and-Matplotlib
hits_date_line_graph.py
hits_date_line_graph.py
py
797
python
en
code
0
github-code
36
9273754357
import os import gym import time import argparse import numpy as np import matplotlib.pyplot as plt from EA_components_OhGreat.EA import EA from EA_components_OhGreat.Recombination import * from EA_components_OhGreat.Mutation import * from EA_components_OhGreat.Selection import * from src.Evaluation import * from src.N...
OhGreat/es_for_rl_experimentation
train_model.py
train_model.py
py
9,142
python
en
code
0
github-code
36
18433473447
"""H1st IoT Maintenance Operations: URL configs.""" from django.conf.urls import include, url from rest_framework.routers import DefaultRouter from aito.iot_mgmt.maint_ops.views import ( EquipmentInstanceDailyRiskScoreViewSet, EquipmentProblemTypeViewSet, EquipmentInstanceAlarmPeriodViewSet, Equipme...
aitomatic/contrib
src/aito/iot_mgmt/maint_ops/urls.py
urls.py
py
1,124
python
en
code
2
github-code
36
12315654775
import pygame pygame.init() default_display = 320, 240 max_display = pygame.display.Info().current_w, pygame.display.Info().current_h scale = 1 fullscreen = False draw_surface = pygame.Surface(default_display) scale_surface = pygame.Surface(default_display) game_display = pygame.display.set_mode(default_d...
philorfa/FDTD_2D
pythonProject/Functions/delete later.py
delete later.py
py
1,880
python
en
code
0
github-code
36
40367902920
# importing required modules import tkinter as tk from tkinter import filedialog import xlsxwriter from init_row_data import init_row_data from compute_B import compute_B from compute_A import compute_A # console interface print("Power bills data extractor in txt\nver.: 1.0, 10/03/2022\nAuthor: Fellipe Filgueira"...
fellipefilgueira/power-bill-data-txt-extractor
Source/main.py
main.py
py
2,315
python
en
code
0
github-code
36
19842008557
# 백준 4485. 녹색 옷 입은 애가 젤다지? # 시간 제한 1초 / 메모리 제한 256MB from collections import deque dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def bfs(): global dist queue = deque() queue.append((0, 0)) dist[0][0] = graph[0][0] while queue: x, y = queue.popleft() for d in range(4): ...
eundeok9/algorithm-study
백준/Gold/4485. 녹색 옷 입은 애가 젤다지?/녹색 옷 입은 애가 젤다지?.py
녹색 옷 입은 애가 젤다지?.py
py
966
python
en
code
0
github-code
36
475267315
from helpers.agent.multi_agent import MultiAgent from helpers.env.env_utils import Init_Env from itertools import count import numpy as np import torch import glob import time import os import gc import sys LEAVE_PRINT_EVERY_N_SECS = 300 class Env_Agent_Mix: # initializerrrrrrr def __init__(self, filename:str,...
Oreoluwa-Se/MultiAgent-SAC-Tennis
helpers/env_agent_interact.py
env_agent_interact.py
py
14,372
python
en
code
1
github-code
36
1290956082
# -*- coding: utf-8 -*- """ Created on Sat Jul 16 12:27:12 2022 @author: Delaeyram """ import streamlit as st import cv2 st.markdown("Built by Eyram Dela") run = st.checkbox("Run") FRAME_WINDOW = st.image([]) video = cv2.VideoCapture(0) net = cv2.dnn.readNet("dnn_model/yolov4-tiny.weights","dnn_model/yol...
eyradel/hybrid
hybrid.py
hybrid.py
py
1,119
python
en
code
0
github-code
36
13988025178
from sys import maxsize as maxint class Solution: def removeInvalidParentheses(self, s): n = len(s) min_dels = maxint min_sols = set() def rec(i, cnt, dels): nonlocal min_dels, min_sols if i == n: if cnt == 0: sol = "".jo...
dariomx/topcoder-srm
leetcode/first-pass/remove-invalid-parentheses/Solution.py
Solution.py
py
1,178
python
en
code
0
github-code
36
14114742850
import sys input = sys.stdin.readline N = int(input()) stacks = [] for _ in range(N): stacks.append(int(input())) high = 0 count = 0 for _ in range(N): newbar = stacks.pop() if newbar > high: count += 1 high = newbar print(count)
nashs789/JGAlgo
Week02/Q17608/Jisung.py
Jisung.py
py
243
python
en
code
2
github-code
36
39241072582
""" Calculate rates with various fitting functions """ import numpy as np def calc_sse_and_mae(calc_ks, fit_ks): """ (1) get the sum of square error (SSE) useful when determining which double plog routine will be used to initialize the nonlinear solver (2) also get the mean absolu...
sjklipp/interfaces_1219
ratefit/err.py
err.py
py
3,984
python
en
code
0
github-code
36
6368201900
def hackerrank(s): counter = 0 hack = 'hackerrank' for i in range(len(hack)): for j in range(len(s)): if s[j] == hack[i]: s = s[j + 1:] counter += 1 break if counter == 10: print('YES') else: print('NO') hackerrank...
dimoka777/Part-5-task-6
hackerrank_string.py
hackerrank_string.py
py
334
python
en
code
0
github-code
36
29730548092
import setuptools # with open("README.md", "r") as fh: # long_description = fh.read() long_description = 'https://github.com/suckmybigdick/flask-wechat-utils' setuptools.setup( name = "flask-wechat-utils", version="0.1.16", auth="Huang Xu Hui", author_email="13250270761@163.com", description="flask-wechat-tu...
synctrust/flask-wechat-utils
setup.py
setup.py
py
908
python
en
code
0
github-code
36
14566681748
from django.urls import path, re_path from django.contrib.auth.decorators import permission_required from django.views.generic import RedirectView from .feeds import PublishTrackFeed from . import views urlpatterns = [ path('', RedirectView.as_view(url='catalogue/', permanent=False)), path('images/', views.i...
fnp/redakcja
src/documents/urls.py
urls.py
py
3,056
python
en
code
4
github-code
36
709130702
#!/usr/bin/env python import os from setuptools import setup # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(...
artss/geweb
setup.py
setup.py
py
1,350
python
en
code
1
github-code
36
35401554885
from django.conf.urls import url,include from . import views as app_v from django.contrib.auth import views from app.forms import LoginForm urlpatterns = [ url(r'^$',app_v.index, name='home'), url(r'^login/$', views.login, {'template_name': 'app/login.html', 'authentication_form': LoginForm}, name='login'),...
vigzmv/LetsPay
app/urls.py
urls.py
py
1,050
python
en
code
2
github-code
36
29963289578
"""demo1 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/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') Class-based v...
yahiaelpronc/Django_Project
Project/crowdFund/urls.py
urls.py
py
2,261
python
en
code
0
github-code
36
71912087784
from pico2d import * import random Width, Height = 1280, 960 open_canvas(Width, Height) handImg = load_image('hand_arrow.png') backGroundImg = load_image('TUK_GROUND.png') boy = load_image('animation_sheet.png') p1 = [Width // 2, Height //2] p2 = [Width // 2, Height //2] dir = True frame = 0 loop = True def mouse_e...
Lucianne0424/Drill05
Drill05.py
Drill05.py
py
1,373
python
en
code
0
github-code
36
71075503145
class Solution: def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int: intervals = sorted(intervals, key=lambda x:x[1]) current = intervals[0] count = 0 for i in intervals[1:]: if i[0] < current[1]: coun...
nango94213/Leetcode-solution
435-non-overlapping-intervals/435-non-overlapping-intervals.py
435-non-overlapping-intervals.py
py
419
python
en
code
2
github-code
36
13161856150
#coding: utf-8 import os import time import random import jieba import numpy as np import matplotlib.pyplot as plt from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import classification_report from sklearn import tree, metrics from sklearn import feature_extraction, model_selection # 导入文本特征向量转化模块 from...
ilray88/python_ShuJuWaJueShiJian
章节9-数据挖掘在中文文本分类中的应用/News-classification-master/News-classification-master/script/6.py
6.py
py
7,285
python
en
code
0
github-code
36
11837509966
#Q1: Write a function to compute 5/0 and use try/except to catch the exceptions. import sys a = 5 b = 0 try: division = a/b except ZeroDivisionError as v: print("Error : ",v) finally: print("""Note : 1.If it showing any error in program please solve it\ 2.If it showing deserved outpute Pro...
Viru9029/Advanced_Python_Programming
Solved_Questions/Q83.py
Q83.py
py
684
python
en
code
2
github-code
36
22530319238
import numpy as np import pytest import gym from gym.wrappers import FrameStack try: import lz4 except ImportError: lz4 = None @pytest.mark.parametrize("env_id", ["CartPole-v1", "Pendulum-v1", "CarRacing-v2"]) @pytest.mark.parametrize("num_stack", [2, 3, 4]) @pytest.mark.parametrize( "lz4_compress", ...
openai/gym
tests/wrappers/test_frame_stack.py
test_frame_stack.py
py
1,457
python
en
code
33,110
github-code
36
23972756418
#!/usr/bin/env python # coding: utf-8 from selenium.webdriver import Chrome from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options import time import pymysq...
shandongbd/lagou-boss-zhilian-data
zhilian_yun.py
zhilian_yun.py
py
8,531
python
en
code
3
github-code
36
28938445312
import os import torch import functools import yaml import torch from torch import nn from torch.nn import init import torch.nn.functional as F from torch.utils import model_zoo from networks.swinir import SwinIR from networks.convnext import ConvNeXt from networks.convnext import model_urls import segmentation_mod...
thisisiron/dacon-sr
networks/__init__.py
__init__.py
py
3,921
python
en
code
3
github-code
36
74611383785
#sum of elements of list def sumOfList(l): ans = 0 #l=[1,2,3] ans = 6 # i for i in l: #[1,2,3] ans = ans + i # 3 + 3 return ans n = eval(input("Enter the number of element:- ")) #n = 4 l = [] for i in range(1,n+1): #[1,2,3,4] x = eval(input("Enter element:- ")) ...
jobanjit-singh/Python-Code
seven/sumOfElements.py
sumOfElements.py
py
383
python
en
code
0
github-code
36
41245528707
import numpy as np import torch.nn from transformers import LukeTokenizer, LukeForEntityClassification, LukeConfig, TrainingArguments, Trainer, AutoTokenizer from transformers import DataCollatorForTokenClassification, DataCollatorWithPadding from tqdm import trange from datasets import ClassLabel, load_dataset import ...
joseMalaquias/tese
Agosto/OpenEntity/evaluate_simple.py
evaluate_simple.py
py
3,520
python
en
code
0
github-code
36
2735889585
debug = True from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize from Cython.Compiler.Options import get_directive_defaults import numpy as np numpy_include_dir = np.get_include() #cy_options = { # 'annotate': True, # 'compiler_directives': { # ...
cwcurtis/Python_FMM_Project
setup.py
setup.py
py
2,002
python
en
code
0
github-code
36
23769330454
import time import os #import RPi.GPIO as GPIO from os import listdir from os.path import isfile, join #GPIO.setwarnings(False) #GPIO.setmode(GPIO.BOARD) #GPIO.setup(22,12, GPIO.OUT, initial=GPIO.LOW) def does_file_exist_in_dir(path): return any(isfile(join(path, i)) for i in listdir(path)) def list_file(listas)...
tadela/The_best_project
check.py
check.py
py
918
python
en
code
0
github-code
36
39245610548
from flask import Flask, request,Response from config.settings import format_url from flask_sqlalchemy import SQLAlchemy from schema.models import db def create_app(): app = Flask(__name__) app.config.from_object('config.settings') app.config['SQLALCHEMY_DATABASE_URI'] = format_url('postgresql') ...
OKULLO/flask_api
app/run.py
run.py
py
577
python
en
code
0
github-code
36
36364117589
import os import re import openpyxl.drawing.image from openpyxl import * from openpyxl.drawing.image import Image import OpenEXR class ExcelCreater: def __init__(self): self.wb = Workbook() self.ws = self.wb.active self.ws.title = 'Shot' self._input_path = None self._ou...
shotgrid-starter/crazy_fork
dev_hj/python/execl_created/excel_creater_mix.py
excel_creater_mix.py
py
8,542
python
en
code
null
github-code
36
15227915962
''' Tag Frequency Analysis Author: Audrey Yang Date: October 23, 2022 ''' import nltk from nltk.corpus import brown tagged_words_uni = brown.tagged_words(categories="news", tagset = "universal") tagged_words_brown = brown.tagged_words(categories="news",) ttable = nltk.FreqDist() # get the frequency of e...
vagorsol/computational-linguistics
Assignment 4/tag_analysis.py
tag_analysis.py
py
4,188
python
en
code
0
github-code
36
44141408017
from torch.utils.data import Dataset import numpy as np from PIL import Image import random from torchvision import transforms from options import utils_option import os import math from lib import utils_image as util class BaseDataset(Dataset): def __init__(self): super(BaseDataset, self).__init__() ...
chqwer2/Multi-view-Self-supervised-Disentanglement-Denoising
data/dataset_base.py
dataset_base.py
py
5,678
python
en
code
99
github-code
36
71104023784
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by i@BlahGeek.com at 2015-07-31 import yaml import sys if __name__ == '__main__': data = yaml.load(open(sys.argv[1]).read(), Loader=yaml.FullLoader) body = open(sys.argv[2]).read() data['body'] = body with open(sys.argv[1], 'w') as f: f.w...
blahgeek/blog.blahgeek.com
scripts/posts_addbody.py
posts_addbody.py
py
368
python
en
code
8
github-code
36
16608477822
import requests import json import sqlite3 # მოაქვს მარსზე გადაღებული ფოტოები კონკრეტული თარიღის მითითებისას. მონაცემები იწერება json ფაილსა და მონაცემთა ბაზაში. key = '6A7O2ghhDhKe1fBnNVDuVglIz04poXa3c1VJDlm7' date = input("Enter the date in YYYY-M-D format: ") payload = {'earth_date': date, 'api_key': key} u...
AnaGagnidze/Quiz3
Quiz3. AG.py
Quiz3. AG.py
py
2,374
python
ka
code
1
github-code
36
34604241513
import pandas as pd import numpy as np import matplotlib.pyplot as plt import os from math import sqrt import cv2 import imutils import random from nltk import flatten def get_neighborhood(data, features, y1, y2, image, dictionary): feature_in_layer = [] for name in features: globals()[n...
elahesalari/Porosity_Prediction_DED_Additive_Manufacturing
Data_Processing/Get points on pbject.py
Get points on pbject.py
py
3,264
python
en
code
3
github-code
36
9186533792
"""Contains pathfinding and maze generation algorithms""" # Handles how much C++ the the program should use from src.pathfinding.cpp_or_py import use_square_h if use_square_h: from src.pathfinding.cpp.modules import Square else: from src.pathfinding.py.square import Square from lib.timer import sleep from th...
ShanaryS/algorithm-visualizer
src/pathfinding/py/algorithms.py
algorithms.py
py
24,976
python
en
code
0
github-code
36
72721076263
from django.conf.urls import url, include from rest_framework import routers from .views import (UserViewSet, GroupViewSet, GenderList, GenderDetail, CountryList, CountryDetail, LanguageList, LanguageDetail, CredentialList, CredentialDetail, PersonList, PersonDetail, CategoryList, ...
fortena/GakktuServer
gakktu/urls.py
urls.py
py
2,163
python
en
code
0
github-code
36
9193917776
import torch import torch.nn as nn def _get_simclr_projection_head(num_ftrs: int, out_dim: int): """Returns a 2-layer projection head. Reference (07.12.2020): https://github.com/google-research/simclr/blob/master/model_util.py#L141 """ modules = [ nn.Linear(num_ftrs, num_ftrs), #...
tibe97/thesis-self-supervised-learning
lightly/models/simclr.py
simclr.py
py
3,319
python
en
code
2
github-code
36
18924234195
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver import ActionChains import time class MouseHovering(): def test1(self): baseUrl = "https://letskodeit.teachable.com/pages/practice" driver = webdriver.Firefox() driver.maximize_window() ...
PacktPublishing/-Selenium-WebDriver-With-Python-3.x---Novice-To-Ninja-v-
CODES/S24 - Selenium WebDriver -_ Working With Actions Class/1-mouse-hovering.py
1-mouse-hovering.py
py
1,053
python
en
code
11
github-code
36
4732410271
import csv from functions import procces, write_to_csv class Place: places = [] def __init__(self, name, website, address, phone_no, categories, ratings, services_offered, search_query): self.name = name self.website = website self.address = address self.phone_no = ...
JvgRansika/Google-Map-Scraper
place.py
place.py
py
796
python
en
code
0
github-code
36
5257479378
from bs4 import BeautifulSoup from lxml import etree from collections import defaultdict skipping_th = ["<th>Strecke</th>", "<th>Zeit</th>", "<th>Punkte</th>", "<th>Details</th>", "<th>Stadt</th>", "<th>Monat</th>"] def chunks(lst, n): n = max(1, n) return list((lst[i:i+n] for i in range(0, len(lst), n))) ...
ESBUINBOO/swimMember
backend/app/bs4_handler/bs4_handler.py
bs4_handler.py
py
1,917
python
en
code
0
github-code
36
72665635624
class TabelaDispersao: def __init__(self, tamanho_tabela): self.tamanho_tabela = tamanho_tabela self.tabela = [None] * tamanho_tabela def hash_int(self, item): return item % self.tamanho_tabela def hash_string(self, item): soma = 0 for pos in range(len(item)): ...
alexaugusto23/Codigos-em-Python-3
Estrutura de dados/Espalhamento/TAD TabelaDispersao_ac05.py
TAD TabelaDispersao_ac05.py
py
2,896
python
pt
code
0
github-code
36
42461293105
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Reddening functions used when simulating observations. """ from __future__ import (print_function, division) import six from six.moves import range import sys import os import warnings import math import numpy as np import warnings __all__ = ["_madau_t1", "_madau_t...
joshspeagle/frankenz
frankenz/reddening.py
reddening.py
py
2,544
python
en
code
17
github-code
36
7796729088
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : 移除链表元素.py # @Author: smx # @Date : 2020/2/9 # @Desc : # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def removeElements(self, head, val): if not head:...
20130353/Leetcode
target_offer/链表/移除链表元素.py
移除链表元素.py
py
1,087
python
en
code
2
github-code
36
71859054825
# -*- coding: utf-8 -*- """ Created on Thu Dec 2 08:47:36 2021 @author: pcondon """ file = open(r"C:\Users\Padraig\Desktop\Development\AdventOfCode\P2\P2.txt", 'r') file = file.readlines() file = [x.split(' ') for x in file] #Part 1 vertical_pos = 0 horizontal_pos = 0 for i in range(len(file)): ...
Pad094/AoC-2021
P2.py
P2.py
py
1,317
python
en
code
0
github-code
36
814974039
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.animation as animation fig = plt.figure() ax=fig.add_subplot(projection='3d') line, = ax.plot([], [], []) ax.set_xlim(-1,1) ax.set_ylim(-1,1) ax.set_zlim(0,3) n_points = 1001 tf = 3 f = 1 fps = int(np.ceil(n_p...
mattwilliams06/AppliedControlSystems2
animated_spiral.py
animated_spiral.py
py
835
python
en
code
1
github-code
36
24299507932
import os, time import skfuzzy as fuzz, numpy as np from matplotlib import pyplot as plt X = np.arange(0,1.0001,0.0001) X = np.asarray([np.round(i,4) for i in X]) FS1 = ['unimportant','average','important'] FS2 = ['L','M','H'] lab1 = dict([(i,j) for j,i in enumerate(FS1)]) lab2 = dict([(i,j) for i,j in en...
deyanarajib/DM_Summarization-of-News-Articles-Using-Fuzzy-Logic-Scoring
3.fuzzy scoring.py
3.fuzzy scoring.py
py
4,389
python
en
code
1
github-code
36
8828118129
import tkinter as tk import numpy as np import time class trianglePoly(object): def __init__(self,canvas,x,y,size,angle): self.canvas = canvas self.x = x self.y = y self.size = size self.angle = angle def rotate(self,x,y): th = self.angle * np.pi /180 ...
ThibaudMZN/GeneralWork
GeneticVehicules/GeneticVehicules.py
GeneticVehicules.py
py
1,326
python
en
code
0
github-code
36
40187237048
from selenium import webdriver from datetime import datetime import time browser=webdriver.Chrome(r"C:\Users\FZL\Desktop\Blast Betting Game Predictor\Dependencies\chromedriver.exe") #go to site browser.get("http://1fifa90.com/games/crash/index") #login time.sleep(5) browser.find_element_by_id("mail").se...
alifzl/Blast-Betting-Game-Predictor
First things First (Data Collecting)/myBot.py
myBot.py
py
2,122
python
en
code
0
github-code
36
18913132573
import sys class Solution: def find132pattern(self, nums: list[int]) -> bool: stack: list[tuple[int, int]] = [] min_so_far = sys.maxsize for x in nums: while stack and stack[-1][0] <= x: stack.pop() if stack and stack[-1][1] < x < stack[-1][0]: ...
lancelote/leetcode
src/_132_pattern.py
_132_pattern.py
py
454
python
en
code
3
github-code
36
21201257329
# -*- coding: utf-8 -*- from libs.base_strategy import Strategy from collections import deque import time import math import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.dates as mdates import matplotlib.pyplot as plt class MyStrategy(Strategy): #-------------------------------...
PP-lib/BFS
BFS-X/strategy/mm_volume2.py
mm_volume2.py
py
9,867
python
ja
code
2
github-code
36
31474181781
#!/home/apollo/anaconda3/bin/python3 #-*- coding: utf-8 -*- #****************************************************************************** # Author : jtx # Create : 2020-03-31 19:05 # Last modified: 2020-04-09 14:18 # Filename : company_kbp.py # Description : 企业清洗库转移到企业知识库,处理:产业/产业领域标签添加、企业标签schema添加 ...
RogerJTX/KbpPipeline_ExpertSystem
conference/conference_relation.py
conference_relation.py
py
12,777
python
en
code
3
github-code
36
17497506686
import json import random def calculate_prf(n_golds, n_preds, n_inters): p = (n_inters * 1.0 / n_preds) * 100 if n_preds != 0 else 0 r = (n_inters * 1.0 / n_golds) * 100 if n_golds != 0 else 0 f = 2.0 * p * r / (p + r) if (p + r) != 0 else 0 p = round(p, 2) r = round(r, 2) f = round(f, 2) ...
JorgenWan/NestedNER
scripts/eval_dif_len_ner.py
eval_dif_len_ner.py
py
2,516
python
en
code
1
github-code
36
16662100384
from typing import Optional from pythongame.core.ability_effects import register_ability_effect, AbilityWasUsedSuccessfully, AbilityResult from pythongame.core.buff_effects import get_buff_effect, AbstractBuffEffect, register_buff_effect, \ StatModifyingBuffEffect from pythongame.core.common import AbilityType, Mi...
gx-55/pygame-for-5725
pythongame/game_data/abilities/ability_stealth.py
ability_stealth.py
py
4,293
python
en
code
1
github-code
36
75162654824
import numpy as np import roughpy as rp rng = np.random.default_rng(1635134) # Sample times # should be approximately in [0, 1) times = np.cumsum(rng.exponential(0.1, 10)) # Moderate length 2D paths p1_data = rng.uniform(-1, 1, (10, 2)) p2_data = rng.uniform(-1, 1, (10, 2)) interval = rp.RealInterval(0, 1) print("The...
datasig-ac-uk/RoughPy
examples/signature-kernel-by-signature-dot.py
signature-kernel-by-signature-dot.py
py
697
python
en
code
11
github-code
36
24074204297
import unittest import numpy as np from data_utils import clean_x_test from data_utils import clean_y_test from data_utils import get_confusion_matrix from data_utils import clean_prediction class TestDataUtilsMethods(unittest.TestCase): def test_clean_x_test(self): binary_words = np.array([ ...
jean-ma/word_gender
tests/test_data_utils_methods.py
test_data_utils_methods.py
py
1,551
python
en
code
0
github-code
36
1127767165
def ipva_estado(estado): ''' Retorna o percentual cobrado de IPVA para um veículo. O parâmetro "estado" é a sigla do estado desejado. ''' # Converte a sigla do estado para maiúsculo estado = estado.upper() if (estado == 'ES'): return 1.0 elif (estado in ['AC', 'AM',...
quitaiskiluisf/TI4F-2021-LogicaProgramacao
atividades/50.py
50.py
py
1,247
python
pt
code
0
github-code
36
15587146625
import random def play(): user_choice = input("'r' for rock, 's' for scissor, 'p' for paper : ") computer_choice = random.choice(["r", "s", "p"]) if computer_choice == user_choice: return "its a tie." if user_win(user_choice, computer_choice): return "congrats you have won" retu...
hartikkakka/Projects
small games python/rock_paper_scissor.py
rock_paper_scissor.py
py
544
python
en
code
0
github-code
36
11604375733
import configparser COMMENT_PREFIX = ";#*" COMMENT_KEY = "__COMMENTS__" class TABConfigParser(configparser.RawConfigParser): """ This class is used to override the Python built-in ConfigParser, because TA builder needs to support: 1. Read/write .conf files with comments 2. Additional comment pref...
splunk/addonfactory-splunk-conf-parser-lib
addonfactory_splunk_conf_parser_lib.py
addonfactory_splunk_conf_parser_lib.py
py
7,985
python
en
code
6
github-code
36
11479624297
#Creates balance and sets it equal to 20.0 balance = 20.0 #Creates purchasePrice and sets it equal to 19.0 purchasePrice = 19.0 #Creates salesTax and sets it equal to 1.08 salesTax = 1.08 #Checks if balance is greater than or equal #to purchasePrice times salesTax if balance >= purchasePrice * salesTax: print("Pur...
ahmedBou/Gtx-computing-in-python
conditional/if-then-elif/relationalMathematicalOperators.py
relationalMathematicalOperators.py
py
394
python
en
code
0
github-code
36
2847481543
# Qus:https://leetcode.com/problems/candy/ class Solution(object): def candy(self, ratings): """ :type ratings: List[int] :rtype: int """ # out[i] = max continuous subsequence ending at i out = [1] for i in range(1, len(ratings)): if(ratings[i] > ...
mohitsinghnegi1/CodingQuestions
leetcoding qus/Candy.py
Candy.py
py
885
python
en
code
2
github-code
36
6274269793
import os from rostran.providers import CompatibleTerraformTemplate from tests.conf import TERRAFORM_PROVIDER_DIR, TERRAFORM_ALICLOUD_DIR def test_template_with_1_file(): path = os.path.join(TERRAFORM_ALICLOUD_DIR, "main.tf") template = CompatibleTerraformTemplate.initialize(path) ros_template = template...
aliyun/alibabacloud-ros-tool-transformer
tests/providers/terraform/test_compatible_terraform.py
test_compatible_terraform.py
py
1,258
python
en
code
16
github-code
36
6217946633
""" Export an object that will handle all the communication with the Walabot. """ import json import select import socket from threading import Thread from tinydb import Query from DBHandler import DBHandler as TinyDB from config import DB_PATH, UTF_FORMAT, ROOM_FIELD, NUMBER_OF_PEOPLE_FIELD, ROOMS_DATA_TABLE, MAX_P...
Walabot-Projects/Walabot-MeetingRoom
server/FreeRoomsServer.py
FreeRoomsServer.py
py
6,324
python
en
code
1
github-code
36
26456403830
string = "" count = 100 while count < 204: if count % 7 == 0 and count % 5 != 0: string = string + str(count) + ", " count += 1 print(string) num = 100 list = [] while num in range(100, 204): if num % 7 == 0 and num % 5 != 0: list.append(num) num += 1 print(list)
jakesjacob/FDM-Training-3
Exercises/11_7 and 5.py
11_7 and 5.py
py
304
python
en
code
0
github-code
36
41397645518
class Solution: def insert(self, intervals: list[list[int]], newInterval: list[int]) -> list[list[int]]: res = [] for i in range(len(intervals)): if (newInterval[1] < intervals[i][0]): res.append(newInterval) return res + intervals[i:] elif (ne...
zhiyiyi/leetcode-practice
src/Solution57.py
Solution57.py
py
820
python
en
code
0
github-code
36
7548657447
from lina import lina import argparse import os def reverse(dispersed_dir, output_file, original_size): filenames = os.listdir(dispersed_dir) filenames.sort() dispersed_data_list = [] for filename in filenames: f = open(dispersed_dir + "/" + filename, "rb") dispersed_data_list.append(""...
TakutoYoshikai/mist-dispersion
mist_dispersion/mist_dispersion.py
mist_dispersion.py
py
2,069
python
en
code
0
github-code
36
75051245544
from argparse import ArgumentParser from json import dump, dumps, load, loads from logging import INFO, basicConfig, getLogger from subprocess import run from emoji import emojize from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update from telegram.ext import (CallbackContext, CallbackQueryHandler, ...
GarikFirst/PyParkingBot
parking_bot.py
parking_bot.py
py
15,861
python
en
code
3
github-code
36
15559523087
#!/usr/bin/env python3 """ Module defines functions for tasks assignment to students. Author: Tomas Bambas xbamba01@stud.fit.vutbr.cz """ import random import copy import datamodel import logger def random_assign(tasks): """ Get list with tuples (tasks, number) tasks is list with datamodel.Task objects...
conyx/isjtests
util/tasksassign.py
tasksassign.py
py
2,414
python
en
code
0
github-code
36
20407034990
import os import torch from torch import nn from torch.utils.data import DataLoader from torchvision import datasets, transforoms device = 'cuda' if torch.cuda.is_available() else 'cpu' print('Using {} device'.format(device)) class NeuralNetwork(nn.Module): def __init__(self): self.flatten = nn...
a1key/VisionAssignment2
test/Module.py
Module.py
py
2,569
python
en
code
0
github-code
36
17262201723
import requests import json class Geolocation: def __init__(self, ip_address): ''' Initializes url with user inputted IP address. args: (str) IP address return: none ''' self.url = f'https://geolocation-db.com/jsonp/{ip_address}' def get(self): ''' Requests and pulls API through URL ...
bucs110a0spring22/final-exam-fujikashimada
IPGeolocationAPI.py
IPGeolocationAPI.py
py
782
python
en
code
0
github-code
36
17579834132
from __future__ import annotations import os from pathlib import Path from typing import Any ALLOWED_HOSTS: list[str] = [] BASE_DIR = Path(__file__).resolve().parent DEBUG_ENV = os.environ.get("DEBUG") DEBUG = DEBUG_ENV == "True" DATABASE_NAME = ":memory:" if not DEBUG else BASE_DIR / "db.sqlite3" DATABASES: dict...
valberg/django-view-decorator
tests/settings.py
settings.py
py
1,235
python
en
code
45
github-code
36
43162877389
# 用卷积神经网络训练cifar10数据集: # 搭建一个一层卷积 两层全连接的网络: # 使用6个5*5的卷积核,过一个步长为2且大小为2*2的池化核,过128个神经元的全连接层, # 因label是10分类,过10个神经元的全连接层。 # 1) 5*5 conv, filters=6 2)2*2 pool, strides=2 3)Dense 128 4)Dense 10 # C:(核:6*5*5, 步长:1, 填充:same) # B:(Yes) # A:(relu) # P:(max, 核:2*2, 步长:2, 填充:same) # D:(0.2) # Flatten ...
Demonya/tensorflow_basic
P5/P5.10:卷积神经网络搭建示例.py
P5.10:卷积神经网络搭建示例.py
py
3,454
python
en
code
0
github-code
36
73706222505
from django.urls import path from .views import addVehiculo, registroView, loginView, listarVehiculo, logoutView from . import views # from . import views <-- do the same of line above urlpatterns = [ path('add/', addVehiculo, name='addVehiculo'), # path('vehiculo/add/', addVehiculo, name='addVehiculo'), ...
daus2020/dj_cars
vehiculo/urls.py
urls.py
py
761
python
en
code
0
github-code
36
28309754653
#!/usr/bin/env python """ Springboard compiler :author: Athanasios Anastasiou :date: Mar 2022 """ import os import pyparsing import click import urllib class SpringboardError(Exception): pass class SymbolRedefined(SpringboardError): pass class SymbolUndefined(SpringboardError): pass class CircularD...
aanastasiou/springboard
sbc.py
sbc.py
py
8,586
python
en
code
1
github-code
36
11686474471
import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler from torch.autograd import Variable import numpy as np import torchvision from torchvision import datasets, models, transforms import matplotlib.pyplot as plt import time import os import copy from torch.utils.data impo...
Tea-Script/HandwritingRecognition
datasets.py
datasets.py
py
9,114
python
en
code
0
github-code
36
845112798
import fileinput numStrings = -1 set = 1 index = 0 pairIndex = 0 for line in fileinput.input(): data = line.rstrip('\n') if numStrings == -1: numStrings = int(data) strings = [None] * numStrings else: if pairIndex == 0: strings[index] = str(data) pairIndex +...
saarthak24/competitive-programming
Problem Set 2/SymmetricStrings/SymmetricStrings.py
SymmetricStrings.py
py
683
python
en
code
0
github-code
36
74509507304
# -*- coding: utf-8 -*- """ Created on Fri Jun 25 10:59:09 2021 @author: gw """ from tkinter import * from tkinter.tix import Tk,Control,ComboBox #升级的组合控件包 from tkinter.messagebox import showinfo,showwarning,showerror #各种消息提示框 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg #画布 from matplotlib.figure ...
1135063213/Machine_Learning_GDAL_Interface
神经网络_GDAL_tkinter.py
神经网络_GDAL_tkinter.py
py
13,873
python
en
code
1
github-code
36
475740830
from . import memory_backend class FileBackend(memory_backend.MemoryBackend): _tables = None _silent_on_missing_tables = False def create_table(self, model): model = self.cheez_model(model) file_name = model.table_name() if file_name in self._tables: return wi...
cmancone/clearskies
src/clearskies/backends/file_backend.py
file_backend.py
py
1,752
python
en
code
5
github-code
36
73631480103
import argparse import random import sys from game import * class OpeningBook(): """ Very, very simple opening book to give the bot some direction. """ def __init__(self, game): self.game = game def findMove(self): """ . . . / \ . |wG1| . \ / . . ...
tylerxprice/hive-framework
randy.py
randy.py
py
4,060
python
en
code
3
github-code
36
16048365956
# -*- coding: UTF-8 -*- """ Name: gui_app.py Porpose: bootstrap for Vidtuber app. Compatibility: Python3, wxPython Phoenix Author: Gianluca Pernigotto <jeanlucperni@gmail.com> Copyleft - 2023 Gianluca Pernigotto <jeanlucperni@gmail.com> license: GPL3 Rev: March.17.2023 Code checker: flake8, pylint This file is part of...
jeanslack/Vidtuber
vidtuber/gui_app.py
gui_app.py
py
9,442
python
en
code
2
github-code
36
27024295019
import openai openai.api_base = 'http://localhost:1234/v1' openai.api_key = '' # 'Llama2 Chat' prompt format: prefix = "[INST]" suffix = "[/INST]" def get_completion(prompt, temperature=0.0): formatted_prompt = f"{prefix}{prompt}{suffix}" response = openai.ChatCompletion.create( model...
lmstudio-ai/examples
Poor-Man's_Vector-Database/chat.py
chat.py
py
497
python
en
code
139
github-code
36
36049807319
import traceback from asyncio import sleep from logging import getLogger from typing import Dict, List from aiohttp import ClientSession from common.enums import EmailResult from email_client.integrations.web.abstract import AbstractWebClient logger = getLogger(__name__) class WebClient(AbstractWebClient): de...
MFrackowiak/sc_r_mailmarketing
email_client/integrations/web/client.py
client.py
py
1,584
python
en
code
0
github-code
36
25210861203
class Function: name = "" value = None osc_client = None cc_number = None osc_url = None max_value = 1 min_value = 0 mode = "push" def __init__(self, osc_client, midi_client, name, cc_number): self.value = 0 self.name = name self.osc_client = osc_client ...
wall0404/LightShark-Bridge
Functions.py
Functions.py
py
2,387
python
en
code
0
github-code
36
13000663213
import os import pytest import yaml @pytest.fixture def zuul_data(): data = {} with open('/home/zuul/src/github.com/opentelekomcloud-infra/system-config/inventory/base/gate-hosts.yaml') as f: inventory = yaml.safe_load(f) data['inventory'] = inventory zuul_extra_data_file = os.environ.ge...
opentelekomcloud-infra/system-config
testinfra/conftest.py
conftest.py
py
531
python
en
code
6
github-code
36
5407159052
from django.urls import path from . import views from django.conf import settings from django.conf.urls.static import static urlpatterns=[ path('' , views.dashboard , name='dashboard'), path('teachers', views.teachers, name ='teachers'), path('students', views.students, name='students'), path('staff', ...
eliki-hue/school_DBMS
myschool/urls.py
urls.py
py
701
python
en
code
0
github-code
36
15169034619
""" This module contains functions for creating transformer models that operate on grid-like inputs. Functions: - grid_transformer: returns a callable transformer model constructor that can operate on grid-like inputs. """ from typing import Optional, Tuple, Callable, Union import core_tools.ops as K import tensorfl...
jakubkwiatkowski/compositional_transformer
grid_transformer/tokenizer.py
tokenizer.py
py
4,891
python
en
code
0
github-code
36
26612458702
import logging from django.conf import settings class ShowDatabaseQueries(logging.Filter): def filter(self, record): return settings.DATABASE_DEBUG LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.Re...
codecraft63/django-base
settings/system/logging.py
logging.py
py
2,031
python
hi
code
0
github-code
36
37915846775
# %% from pathlib import Path import csv import matplotlib.pyplot as plt from datetime import datetime path = Path("weather_data/en_climate_daily_ON_6158355_2023_P1D.csv") lines = path.read_text().splitlines() reader = csv.reader(lines) header_row = next(reader) # Extract the percipitation. dates, percips = [], [] ...
hharpreetk/python-toronto-weather-data-viz
percip_visual.py
percip_visual.py
py
1,060
python
en
code
0
github-code
36
70175969705
import datetime from pandas_datareader import data as pdr import queue import threading from pprint import pprint def pullHistoricalData(holdings, benchmarks, start_date, end_date): def assign_data_to_ticker(holdings, benchmarks, data): for ticker in list(holdings.keys()): holdings[ticker]['hi...
lamothe-hub/gsif-portfolio-risk-platform
gsif/dashboards/calculations/dataAccess.py
dataAccess.py
py
4,579
python
en
code
1
github-code
36
3587710302
# we will create a new node at the end of the linked list # we will change last item's address and tail. # we have edge case when linke dlist is empty. class Node: def __init__(self, value): self.value = value self.next = None class Section4: def __init__(self, value): # create new node ...
rohith274/PythonSolvesAnything
DSA/Section4/Append.py
Append.py
py
1,188
python
en
code
0
github-code
36
73302038824
import pymongo import csv from csv import writer from pymongo import MongoClient import pandas as pd # Conexão try: myclient = pymongo.MongoClient( "mongodb+srv://teste:teste123@cluster0.1ylmc4y.mongodb.net/test") mydb = myclient["prova2"] print("\nConectado com sucesso\n") except...
LuWroblewski/FaculdadePython
prova2Banco/crud1.py
crud1.py
py
5,222
python
en
code
0
github-code
36
29442744987
from brownie import network, accounts, config, MockV3Aggregator from web3 import Web3 DECIMALS = 8 STARTING_PRICE = 200000000000 # you can see all env of brownie by running "brownie networks list" in terminal LOCAL_BLOCKCHAIN_ENVIRONMENT = ["development", "ganache-local"] FORKED_LOCAL_ENVIRONMENT = ["mainnet-fork"] ...
PremMehta01/web3_brownie_fundMe
scripts/helpful_scripts.py
helpful_scripts.py
py
1,163
python
en
code
0
github-code
36
38037219571
import logging import re class ColorUtil: @staticmethod def ShadeColor(hexColor, percent): try: hexNum = int(hexColor[1:], 16) t = 0 if percent < 0 else 255 p = percent * -1 if percent < 0 else percent R = hexNum >> 16 G = hexNum >> 8 & 0x00...
bhavesh-jadav/Power-BI-Theme-Generator
src/main/python/Util.py
Util.py
py
1,158
python
en
code
8
github-code
36
40567890811
import numpy as np import torch def calculate_tp(pred_boxes, pred_scores, gt_boxes, gt_difficult, iou_thresh = 0.5): """ calculate tp/fp for all predicted bboxes for one class of one image. 对于匹配到同一gt的不同bboxes,让score最高tp = 1,其它的tp = 0 Args: pred_boxes: Tensor[N, 4], 某张图片中某类别的全部预测...
BIGcucumber/FEFD-yolov5
Helmet detection based on YOLOV5/utils/get_ap.py
get_ap.py
py
5,476
python
en
code
0
github-code
36
15492848684
"""pip/setuptools packaging Based off https://github.com/pypa/sampleproject/blob/master/setup.py """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path, remove import shutil from malboxes._version import __v...
GoSecure/malboxes
setup.py
setup.py
py
4,016
python
en
code
1,015
github-code
36
70797637225
# Classic Game Resource Reader (CGRR): Parse resources from classic games. # Copyright (C) 2014 Tracy Poff # # This file is part of CGRR. # # CGRR 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...
sopoforic/cgrr-gameboy
gameboy.py
gameboy.py
py
4,463
python
en
code
6
github-code
36