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
7824817343
# emacs: -*- mode: python-mode; py-indent-offset: 2; tab-width: 2; indent-tabs-mode: nil -*- # ex: set sts=2 ts=2 sw=2 et: """ A Neurosynth Dataset """ import logging import re import random import os import numpy as np import pandas as pd from scipy import sparse import mappable from neurosynth.base import mask, i...
jdnc/ml-project
neurosynth/neurosynth/base/dataset.py
dataset.py
py
25,922
python
en
code
1
github-code
1
41202001092
class Animal: def __init__(self, name, number_of_legs): self.name = name self.number_of_legs = number_of_legs def sort_animals(lst): if not lst: return [] sorted_animals = sorted(lst, key=lambda animal: ( animal.number_of_legs, animal.name)) return sorted_animals an...
Kamente/kata
sort_animals.py
sort_animals.py
py
601
python
en
code
0
github-code
1
6423410824
from PyQt5.QtWidgets import QMainWindow, QLabel from PyQt5.QtCore import QPoint, Qt from fuzzyclock import FuzzyClock class SimpleFuzzyClockWindow(QMainWindow): def __init__(self, fuzzy_clock=None, size=(190, 35)): super().__init__() if fuzzy_clock is None: self.fuzzy_clock = FuzzyC...
mkardel/SimpleFuzzyClock
fuzzywindow.py
fuzzywindow.py
py
1,437
python
en
code
0
github-code
1
74495158433
from aiogram import types from aiogram.dispatcher import FSMContext from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton from data.config import admins from keyboards.default.menu_keyboards import menu from keyboards.inline.callback_datas import report_data from loader import dp, db, bot from states.me...
arsavit/av_by_B4L
handlers/users/reports.py
reports.py
py
2,583
python
ru
code
0
github-code
1
70734487714
import sys import pygame from pygame.locals import KMOD_CTRL from pygame.locals import KMOD_SHIFT from pygame.locals import K_ESCAPE from pygame.locals import K_F1 from pygame.locals import K_SLASH from pygame.locals import K_TAB from pygame.locals import K_h from pygame.locals import K_i from pygame.locals import K_...
bounverif/starter-carla-0913
client/app/input_control.py
input_control.py
py
4,044
python
en
code
1
github-code
1
7688472178
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_transformers.modeling_bert import BertPooler, BertSelfAttention, BertConfig from layers.attention import Attention, NoQueryAttention from layers.squeeze_embedding import SqueezeEmbedding class GNN(nn.Module): def _...
wwz58/bert-gcn
models/bert_albert_gcn.py
bert_albert_gcn.py
py
8,282
python
en
code
7
github-code
1
70205747554
''' 문제 정수 4를 1, 2, 3의 합으로 나타내는 방법은 총 4가지가 있다. 합을 나타낼 때는 수를 1개 이상 사용해야 한다. 합을 이루고 있는 수의 순서만 다른 것은 같은 것으로 친다. 1+1+1+1 2+1+1 (1+1+2, 1+2+1) 2+2 1+3 (3+1) 정수 n이 주어졌을 때, n을 1, 2, 3의 합으로 나타내는 방법의 수를 구하는 프로그램을 작성하시오. 입력 첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있고, 정수 n이 주어진다. n은 양수이며 10,000보다 작거나 같다. 출력 각 테스트 케이스마다,...
hanseul-jeong/Coding_test
Backjoon/단계별로풀어보기/15989.py
15989.py
py
978
python
ko
code
0
github-code
1
20175750585
#!/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide import QtGui, QtCore import controller from ventana_nuevacategoria import * class Form_2(QtGui.QWidget): def __init__(self, parent=None): super(Form_2, self).__init__() self.ventana = Ui_ventana_nuevacategoria() self.ventana....
mojedar/Proyecto-final
ProyectoFinalTaller/view_ventana_nuevacategoria.py
view_ventana_nuevacategoria.py
py
1,244
python
es
code
0
github-code
1
37412146341
from django.shortcuts import render # Create your views here. # start game fonk def start_game(request): if request.method == 'POST': name = request.POST.get('name') image = request.FILES.get('image') puzzle = generate_puzzle(image) request.session['name'] = name request.se...
melihamutlu/proje-1-deneme-repo-
myproject/myapp/views.py
views.py
py
6,281
python
en
code
1
github-code
1
22697300099
import altair as alt import math import pandas as pd import streamlit as st from PIL import Image """ # Which German Business Sector are you? Take this personality quiz to find out which part of the Volkswirtschaft is your spirit animal. This uses clustering from the ifo Business Climate Survey taken by thousands of...
merveogretmek/ifoHack-2023
ifoHack2023-ForecastFanatics/website/Quiz.py
Quiz.py
py
7,372
python
en
code
0
github-code
1
8619244280
# https://www.youtube.com/watch?v=8Qk2M1Jy-Mg&t=1641s from tkinter import * from database import * def add(): line = id.get()+'-'+name.get()+'-'+year.get() save(line) show() def show(): sv = read() listbox.delete(0,END) for i in sv: listbox.insert(END,i) def sort(): sv=...
vicuon/quanlihocsinh
main.py
main.py
py
1,548
python
en
code
0
github-code
1
6131591636
def fibonacci(n,zero=0,one=0): if vis[n]: return dp[n] vis[n] = 1 if n == 0: dp[n] = [1,0] return [1,0] if n == 1: dp[n] = [0,1] return [0,1] first = fibonacci(n-1) second = fibonacci(n-2) dp[n][0] = first[0] + second[0] dp[n][1] = first[1] ...
2020-ASW/kwoneyng-Park
연습/1003_피보나치 함수.py
1003_피보나치 함수.py
py
512
python
en
code
0
github-code
1
31900586339
# -*- coding: utf-8 -*- """ @File : balancedString.py @Author : wenhao @Time : 2023/2/13 9:26 @LC : 1234 """ from math import inf from collections import Counter class Solution: ''' 思路: 同向双指针: ''' def balancedString(self, s: str) -> int: cnt, m = Counter(s), len(s) if ...
callmewenhao/leetcode
基础算法精讲/双指针/balancedString.py
balancedString.py
py
662
python
en
code
0
github-code
1
32343761147
#!/usr/bin/env python3 """ trivial strategy """ import archon.config as config import traceback from datetime import datetime #import archon.broker as broker from archon.brokersrv.brokerservice import BrokerService import archon.exchange.exchanges as exc import archon.exchange.bitmex.bitmex as mex import archon.exc...
economicnetwork/marketmaker
simple_maker.py
simple_maker.py
py
7,904
python
en
code
7
github-code
1
70431741475
# -*- coding: utf-8 -*- """ Created on Wed Jan 5 21:46:21 2022 @author: Cumali Atalan """ #%% #gerekli kütüphaneler import edilir. import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from collections import Counter from tensorflow import keras from keras.mo...
cumaliatalan/Yapay-Sinir-Aglari
CNN/CNN.py
CNN.py
py
4,564
python
tr
code
0
github-code
1
31071687221
import copy import sys sys.modules['_decimal'] = None import decimal from decimal import * from decimal import Decimal getcontext().Emin = -10 ** 10000 getcontext().Emax = 10 ** 10000 getcontext().traps[Overflow] = 0 getcontext().traps[Underflow] = 0 getcontext().traps[DivisionByZero] = 0 getcontext().tr...
junem0hack14/INDONESIAN-PROGRAMMERS
Graph Operations/graph_operations.py
graph_operations.py
py
19,720
python
en
code
0
github-code
1
13988952340
# -*- coding: UTF-8 -*- import json from xf import text_tovoice from xf import voice_totext from xf import text_tovoice_totext import time def test1(): print("---start---") start = time.time() voiceResultStr = text_tovoice.init('百度传来了喜讯', "E:/jianguocloud/learn/Python...
lanceNice/base_utils
xf/test.py
test.py
py
1,199
python
en
code
1
github-code
1
43422935125
def part1(): L1 = [1,2,3,4,5] ; L2 = [2,3,4,5,1,0] print(L1<L2) print(L1 != L2) L3 = ['1','2','3','4','5'] #print( L1>L3) results in error. Cant compare string and int print(L1 and L2) print(not L3) print(not[]) L1 = [1,2];L2 = [1,2]; L3 = L1 print(L1 is L2) print(L1 is L3) ...
dipnrip/Python
Python/Labs/299Lab5/lab5Functions.py
lab5Functions.py
py
1,356
python
en
code
0
github-code
1
7461435996
""" Makes it possible to run a game through terminal. """ import sys import threading from bot.step_score_bot import StepScoreBot from game_client.game_loop import game_loop from game_client.server_interaction import GameSession, WrongPayloadFormatError HELP_TEXT = ( "Usage:\n" "python terminal_interface.py ...
VaSeWS/Vangarning-Team
terminal_interface.py
terminal_interface.py
py
2,310
python
en
code
0
github-code
1
42999491369
''' Program 49 | Group Anagrams https://leetcode.com/problems/group-anagrams/ ''' class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: ans = collections.defaultdict(list) for s in strs: key = [0] * 26 for c in s: key[ord(c) - ord('a'...
davijit868/Programming-Solutions
Data Structures/Arrays/Group Anagrams.py
Group Anagrams.py
py
402
python
en
code
2
github-code
1
14617850309
import random from math import sqrt from scipy.interpolate import lagrange from main_folder.smpc_addition.network_nodes.RandPoly import RandPoly class SmpcAdditionNode: def __init__(self) -> None: pass def generate_functions(self, record): all_functions = [] for feature in...
mswartz2/Secure-Multiparty-Computation-Main-Code
main_folder/smpc_addition/network_nodes/SmpcAdditionNode.py
SmpcAdditionNode.py
py
2,734
python
en
code
0
github-code
1
28718464379
# -*- coding: utf-8 -*- """Model Examples.""" import numpy as np import sympy from sympy import symbols from causing.model import Model from causing.simulate import SimulationParams, simulate data_path = __file__.split("causing")[0] def example(): """model example""" X1, X2, Y1, Y2, Y3 = symbols(["X1", "X...
ZJfang-code/Causing
causing/examples/models.py
models.py
py
6,543
python
en
code
null
github-code
1
10178508253
class Process: currentPID = 1 def __init__(self, codefile, dispatcher, processor): self.id = self.currentPID self.dispatcher = dispatcher self.processor = processor Process.currentPID += 1 self.currentLine = 0 self.code = self.fetch_program_code(codefile) ...
GeoffreyKarnbach/JeffOS_
process.py
process.py
py
3,212
python
en
code
0
github-code
1
6033659494
import typing as t """ Tags: Adjacency matrix The algorithm finds all shortest path pairs. The graph needs to be represented as an adjacency matrix. Example graph definition: A B C D A 0 8 INF 1 B INF 0 1 INF C 4 INF 0 INF D INF 2 9 0 The diagonal ^ is 0s because the node's ...
EvgeniiTitov/coding-practice
coding_practice/data_structures/graphs/apsp/floyd_warshall_implementstion_1.py
floyd_warshall_implementstion_1.py
py
2,013
python
en
code
1
github-code
1
13810826097
from selenium import webdriver from selenium.webdriver.common.alert import Alert from random import choice, randint import win32com.client as comclt import win32gui import win32con import time def handle_upload_file_dialog(file_path): sleep = 1 windowsShell = comclt.Dispatch("WScript.Shell") time.sleep(sle...
thespacemanatee/SingHealth-App
__tests__/python test/Staff/CreateThenDeleteNewTenant.py
CreateThenDeleteNewTenant.py
py
2,074
python
en
code
1
github-code
1
17775025297
import sys sys.path.insert(0, './src') # import os # os.getcwd() # os.chdir('../') from importlib import reload import numpy as np np.set_printoptions(suppress=True) import pickle from envs import merge reload(merge) from envs.merge import EnvMerge import os import time import json import matplotlib.pypl...
saArbabi/DriverActionEstimators
src/data/data_collection.py
data_collection.py
py
7,095
python
en
code
4
github-code
1
4876241093
# -*- coding: utf-8 -*- # © 2015 Eficent - Jordi Ballester Alomar # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from openerp.osv import fields, orm from openerp.tools.translate import _ class LocationAnalyticCreate(orm.TransientModel): _name = 'location.analytic.create' _description =...
one2pret/eficent-odoo-addons
analytic_location_manager/wizard/analytic_location_manager.py
analytic_location_manager.py
py
4,916
python
en
code
null
github-code
1
39285481089
import cv2 as cv import sys #loads the using weights and correspding configuration rule def load_model(model_weights="",model_config=""): if model_weights == "" and model_config == "": print("Model config and weights not found!"); sys.exit(0); net = cv.dnn.readNet(model_weights,model_config); return net; de...
PrateekMunjal/Face-detection-webcam-opencv
model.py
model.py
py
495
python
en
code
1
github-code
1
70271092515
from __future__ import absolute_import from pymongo import MongoClient from pymongo.database import Database from pymongo.collection import Collection import six class_to_class_name = { str: 'unicode', six.text_type: 'unicode', bool: 'bool', list: 'list', tuple: 'list', int: 'in...
brainvisa/axon
python/fedji/mongodb_backend.py
mongodb_backend.py
py
2,113
python
en
code
0
github-code
1
72999885153
from bundlewrap.exceptions import BundleError munin_config = node.metadata.get('munin', {}) symlinks = {} actions = {} files = {} pkg_apt = {} svc_systemd = {} trigger_reload = [] if munin_config.get('type', 'c') == 'c': node_type = 'munin-node-c' pkg_apt['munin-node-c'] = { 'installed': True, }...
sHorst/bw.bundle.munin_node
items.py
items.py
py
3,972
python
en
code
0
github-code
1
71178128035
import numpy as np from tensorflow.keras.layers import Input, Flatten, Dense, Reshape, Dropout, Concatenate, Lambda, ReLU, Activation from tensorflow.keras.layers import BatchNormalization from tensorflow.keras.layers import LeakyReLU from tensorflow.keras.models import Model from tensorflow.keras import backend as K ...
alexmarshallbristol/Enhanced_Generative_Networks
VAE.py
VAE.py
py
18,554
python
en
code
0
github-code
1
8767288609
import PySimpleGUI as sg ''' sg.theme('DarkAmber') # Add a touch of color # All the stuff inside your window. layout = [ [sg.Text('Some text on Row 1')], [sg.Text('Enter something on Row 2'), sg.InputText()], [sg.Button('Ok'), sg.Button('Cancel')] ] # Create the Window window = sg.Window('W...
Xianzheng/smallProgram
selenium/simpleGUI.py
simpleGUI.py
py
5,513
python
en
code
0
github-code
1
29932380680
import json import re from collections import Counter, defaultdict from pathlib import Path from typing import Union import arabic_reshaper import demoji import seaborn as sns from hazm import Normalizer, sent_tokenize, word_tokenize from loguru import logger from src.data import DATA_DIR from wordcloud import WordClo...
mohammad-chegini/telegram_statistics
src/chat_statistics/stats.py
stats.py
py
4,142
python
en
code
0
github-code
1
31469922894
class Graph: def __init__(self, vertices): super(Graph, self).__init__() self.V = vertices self.graph = [[0 for _ in range(vertices)] for _ in range(vertices)] def min_dist(self,dist,sptSet): mn = float('inf') mi = -1 for v in range(self.V): if dist[v]<mn and sptSet[v]==False: mn = dist[v] mi =...
Ravi-Maurya/Competitive_Programming
Code_Chef/Feb20/CC_FebAll5.py
CC_FebAll5.py
py
1,253
python
en
code
1
github-code
1
8513594705
""" Utilities module. """ import datetime as dt import pkg_resources import barbante def local_import(name): """ Returns the module *name*. Attributes: name - the name of the module to be imported. Exception: TypeError - if *name* is not a string. ImportErr...
hypermindr/barbante
barbante/utils/__init__.py
__init__.py
py
3,449
python
en
code
10
github-code
1
16401486914
import requests from twilio.rest import Client from decouple import config STOCK_NAME = "TSLA" COMPANY_NAME = "Tesla Inc" FUNCTION = "TIME_SERIES_DAILY" MY_API = config("MY_API", default="") NEW_API = config("NEW_API", default="") TWILIO_SID = config("TWILIO_SID", default="") TWILIO_TOKEN = config("TWILIO_TOKEN", def...
isik-dev/Stock-Price-Monitor
main.py
main.py
py
2,001
python
en
code
0
github-code
1
72402872993
import os import random import torch import torchvision.transforms as T from PIL import Image from torch.utils import data def rreplace(s, old, new, occurrence): li = s.rsplit(old, occurrence) return new.join(li) class ImageAttr(data.Dataset): """Dataset class for the ImageAttr dataset.""" def __in...
hologerry/Attr2Font
dataloader.py
dataloader.py
py
9,937
python
en
code
219
github-code
1
28840383163
# importing other files import color import TestTubeGame # This is the test tube class for the minigame. # Things it should be capable of: # - Drawing itself (It needs to know what colours it has) class TestTube: # This function initializes the variables of the test tube def __init__(self, stack): sel...
MiracleSheep/Python_Pygame_TestTubeGame
tube.py
tube.py
py
3,103
python
en
code
0
github-code
1
30315928956
""" For example, two is written as II in Roman numeral, just two one's added together. Twelve is written as, XII, which is simply X + II. The number twenty seven is written as XXVII, which is XX + V + II. Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not II...
NeerajM999/recap-python
LearnPython/int_to_roman.py
int_to_roman.py
py
2,558
python
en
code
0
github-code
1
41408824426
from pykeyboard import PyKeyboard import paho.mqtt.client as mqtt import re host = 'www.bananalife.top' port = 1883 ''' ctrl+alt+p play/suspend ctrl+alt+H left ctrl+alt+L right ctrl+alt+J down ctrl+alt+K up ''' k = PyKeyboard() netcase = { 'play': [k.control_key, k.alt_key, 'p'], 'left': [k.contro...
zengfu/pytool
keymouse.pyw
keymouse.pyw
pyw
1,257
python
en
code
0
github-code
1
11817995914
from bokeh.plotting import figure from bokeh.io import curdoc from bokeh.models import GeoJSONDataSource, ColorBar from bokeh.models import DatetimeTickFormatter, PrintfTickFormatter, NumeralTickFormatter, NumeralTickFormatter from bokeh.models import HoverTool, WheelZoomTool from bokeh.models import LogColorMapper, Li...
annakuchko/map-app
app/plotting.py
plotting.py
py
2,128
python
en
code
0
github-code
1
44649642284
from Queue import Queue class Binary_Search_Tree: def __init__(self, data): self.data = data self.left_child = None self.right_child = None def insert(root_node, value): if root_node.data is None: root_node.data = value else: if value <= root_node.data: ...
TarakaKoda/Python-Data-Structures-and-Algorithms
19 - Binary Search Tree/Binary Search Tree Practice/05 Deletion in a Binary Search Tree.py
05 Deletion in a Binary Search Tree.py
py
3,799
python
en
code
0
github-code
1
27287177163
""" Imagelab is the core class in CleanVision for finding all types of issues in an image dataset. The methods in this module should suffice for most use-cases, but advanced users can get extra flexibility via the code in other CleanVision modules. """ from __future__ import annotations import random from typing impor...
cleanlab/cleanvision
src/cleanvision/imagelab.py
imagelab.py
py
27,188
python
en
code
725
github-code
1
15432766798
import json from os import PathLike from pathlib import Path from typing import Any, Dict, List, MutableMapping, Union import yaml STRUCTURE = { "Dataset": [ "dataset_name", "dataset_config", "dataset_revision", "labelcolumn", "textcolumn", ], "Training": [ ...
BramVanroy/transformers-finetuner
transformers_finetuner/generate_readme.py
generate_readme.py
py
4,972
python
en
code
0
github-code
1
11313645218
from django.shortcuts import render from django.http import HttpResponse from property.choice import price_choices, bedroom_choices, county_choices from property.models import Property from accounts.models import Owner def index(request): propertys = Property.objects.order_by('-list_date') context = { ...
paulndalila/ComfortHomes
pages/views.py
views.py
py
867
python
en
code
1
github-code
1
641796424
import numpy as np def k_means_init(input,num_clusters): centers=[] for i in range(num_clusters): i=np.random.random(np.size(input[0])) centers.append(i) return centers def classify(input,centers,num_clusters): clusters=[[] for i in range(num_clusters)] num_list=[i for i in range...
sx-zhang/HOZ
graph_generation/my_cluster.py
my_cluster.py
py
1,774
python
en
code
38
github-code
1
38569483791
def add(numbers, x, y, z): numbers[z] = numbers[x] + numbers[y] def multiply(numbers, x, y, z): numbers[z] = numbers[x] * numbers[y] def opcode(sequence): inst_point = 0 while True: op = sequence[inst_point] if op == 99: break pos1 = sequence[inst_point + 1] ...
linusmoreau/AoC
2019/day2.py
day2.py
py
977
python
en
code
0
github-code
1
22905237190
## set up logging import logging, os logging.basicConfig(level=os.environ.get("LOGLEVEL","INFO")) log = logging.getLogger("glam_command_line") import argparse, glob, json, subprocess, sys import glam_data_processing.legacy as glam from datetime import datetime # create temporary directory for shenanigans TEMP_DIR = o...
fdfoneill/glam_data_processing
glam_data_processing/generate_new_stats.py
generate_new_stats.py
py
7,853
python
en
code
1
github-code
1
31868037338
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt df = pd.read_csv (r'Seed Yield.csv') print (df) sns.set_theme(style="whitegrid") # Draw a nested barplot by cultivar and irrigation g = sns.catplot( data=df, kind="bar", x="Cultivar", y="Seed Yield", hue="Irrigation", ci="sd", palette...
Aria-Dolatabadian/Grouped-bar-plots
Code.py
Code.py
py
457
python
en
code
0
github-code
1
2687030494
from torchvision.datasets import CIFAR10, CIFAR100, MNIST, SVHN, FashionMNIST from data.MVTecDataset import getMVTecDataset from data.AdaptiveExposureDataset import getAdaptiveExposureDataset import os import torch import numpy as np import torchvision.transforms as transforms from torch.utils.data import Dataset from ...
Mohammadjafari80/ExposureExperiment
data/data_utils.py
data_utils.py
py
9,035
python
en
code
0
github-code
1
28127538716
import numpy as np def board_to_hash_code(board): '''Converts board to a string for hashing. The hash code will read the board left to right, top to bottom and place a '0' for an empty slot, a '1' for a 1 ('x' plays as 1), and a '2' for a 2 ('o' plays as 2). Example: [[0, 1, 1], [2, 1, 0], [0, 0, 0]] -> '0112...
LilCPuppy/ReinforcementLearning
sutton_and_barto/chapter_one/tic_tac_toe/board_utils.py
board_utils.py
py
1,983
python
en
code
0
github-code
1
31409330642
from time import time import glob from sys import argv import cv2 import pickle import shutil from sklearn.cluster import KMeans from sklearn.linear_model import LogisticRegression from sklearn.metrics import f1_score, confusion_matrix from sklearn import preprocessing, svm import numpy as np ## Inputs k1 = 50 rele...
DavidLebrisse/RecoImgSSII
recoimg5.py
recoimg5.py
py
5,238
python
en
code
0
github-code
1
30417780326
from typing import Optional from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() persons = [{"id": 1, "ad": "Seyma", "soyad": "Sarigil", "meslek": "Gelistirici", "memleket": "Hatay"}, {"id": 2, "ad": "Alp", "soyad": "Kara", "meslek": "Müzisyen", "memleket": "İstanbul"}] class Person...
seymasa/PersonApi
main.py
main.py
py
1,248
python
en
code
1
github-code
1
74874595233
from libreria_grafo import * from grafo import Grafo import sys def itinerario(vertices, n_archivo): grafo = Grafo(True, False) for v in vertices: grafo.agregar_vertice(v) with open(n_archivo) as archivo: linea = archivo.readline() linea = linea.rstrip("\n") linea = linea.split(",") grafo.agregar_arist...
alexis2013/TP3_algo2
wrapper_comandos.py
wrapper_comandos.py
py
2,247
python
es
code
0
github-code
1
70309881313
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer from rest_framework_simplejwt.views import TokenObtainPairView from rest_framework import exceptions class StaffTokenObtainPairSerializer(TokenObtainPairSerializer): def validate(self, attrs): data = super().validate(attrs) ...
Dayroot/Ciclo3_Backend
bookstoreApp/views/staffViews/staffTokenObtainPairView.py
staffTokenObtainPairView.py
py
935
python
en
code
0
github-code
1
35823720174
# geocoding from zope import interface, component from getpaid.core.interfaces import IStoreSettings, IShippableLineItem, IOrder, IOriginRouter from getpaid.core.payment import ContactInformation import interfaces class OriginRouter( object ): " warehouse aware origin router " component.adapts( ...
collective/getpaid.warehouse
src/getpaid/warehouse/router.py
router.py
py
1,956
python
en
code
0
github-code
1
32738239065
from ..binary import BinaryReader, BinaryWriter from ..binary.types import Int8, Int16, Int32, UInt8, UInt16, UInt32 class HKHeader: """Represents Havok file header """ # fmt:off magic0: UInt32 = 0x57E0E057 # 0x00 # Always 0x57E0E057 magic1: UInt32 = 0x10C0C010 # 0x04 # Always 0x10C0C010 ...
krenyy/botw_havok
botw_havok/container/header.py
header.py
py
5,236
python
en
code
4
github-code
1
25186306086
class Home: def __init__(self): self.food = 50 self.cat_food = 30 self.money = 0 self.people = [] self.dirt = 0 def add_peoplе(self, human): self.people.append(human) human.house = self
tuzer69/PythonLearning
Module25/06_cohabitation_2/home.py
home.py
py
252
python
en
code
0
github-code
1
10671644338
# -*- coding: utf-8 -*- """HTTP Endpoint for Netflix session management""" from __future__ import absolute_import, division, unicode_literals import json import BaseHTTPServer from SocketServer import TCPServer import resources.lib.common as common from .nfsession import NetflixSession class NetflixHttpRequestHand...
Toysoft/plugin.video.netflix
resources/lib/services/nfsession/http_server.py
http_server.py
py
1,755
python
en
code
4
github-code
1
24114919338
# -*- coding: utf-8 -*- """Main module.""" import pandas as pd import csv from genedb import cleanerfunc # def removespecchar(test): # import re # if type(test) == str: # test2=re.sub('\t','',test) # test=re.sub('\"','',test2) # return(test) """String Cleaning Function.""" """Function to...
baileyglen/genedb
genedb/genedb.py
genedb.py
py
1,256
python
en
code
0
github-code
1
41507098196
import matplotlib.pyplot as plt import plotly.graph_objs as go from plotly.offline import plot from plotly.subplots import make_subplots def plot_clandlestics(df): fig = go.Figure(data=[go.Candlestick(x=df['date'], open=df['open'], high=df...
luistiagos/stockssignals
plots.py
plots.py
py
2,488
python
en
code
0
github-code
1
28567208455
#!/usr/bin/env python3 # -*- coding: utf-8 -*- "Interval detection: finding flat sections in the signal" import numpy as np from utils import initdefaults from signalfilter import PrecisionAlg, CppPrecisionAlg from .splitting import SplitDetector, PyMultiGradeSplitDetector from .merging import PyMulti...
depixusgenome/trackanalysis
src/eventdetection/detection.py
detection.py
py
2,828
python
en
code
0
github-code
1
25411278935
import logging import psutil import signal from devil.android import device_errors from devil.android import device_utils def _KillWebServers(): for s in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT, signal.SIGKILL]: signalled = [] for server in ['lighttpd', 'webpagereplay']: for p in psutil.proces...
hanpfei/chromium-net
build/android/pylib/utils/test_environment.py
test_environment.py
py
1,425
python
en
code
289
github-code
1
34009029856
import random import time import queue import hashlib from threading import * from treelib import Node, Tree from datetime import timedelta import threading lock = Lock() # Global LOCK (use to mutual exclusion) n = 3 # Network cardinality (number of processes in the network) growth_speed = 0.1 # regulates the growth...
czanacch/blockchain_algorithms
PaLa/PaLa4.py
PaLa4.py
py
12,007
python
en
code
1
github-code
1
26384047491
import os def pdf_to_html(filename:str, pdfname:str): """ filename是路径,到当前目录就可以, pdfname是pdf的名称,需要带后缀pdf, 该方法需要本地安装docker desktop才可使用 目前设置pdf和html都在同一个路径 """ str = "docker run -i --rm -v " second_str = ":/pdf bwits/pdf2htmlex pdf2htmlEX --zoom 1.3 " all_str = str + filename + second_...
NLP-Rocket-Group/OursRepository
PDF-keyword-highlight/DockerPdfToHtml.py
DockerPdfToHtml.py
py
653
python
zh
code
2
github-code
1
12828462305
# pygame python第三方游戏库 .pyd 动态模块(可以导入,但是看不到源码) .py 静态模块 import pygame # 官方推荐这样导入 from pygame.locals import * import sys import time import random # 定义常量记录数据 (常量特点: 字母全大写 一旦定义,不要修改记录的值) WINDOW_H = 768 WINDOW_W = 512 class Bullet: # 子弹类 def __init__(self, img_path, x, y, window): self.img...
OreoCookiesYeah/base2
hm_07_敌机移动.py
hm_07_敌机移动.py
py
5,393
python
zh
code
0
github-code
1
73582809634
import pytest from src.kbt.helpers import divide_by_lines, numbers def test_divide_by_lines_error(): data = [1, 2, 3, 4, 5, 6, 7, 8] with pytest.raises(Exception) as e: divide_by_lines(data, None) assert "Error trying to divide the data in None" in str(e) def test_divide_by_lines_error(): da...
miguelitogemio96/kata_bank_tool
test/test_helpers.py
test_helpers.py
py
1,052
python
en
code
0
github-code
1
43073961333
# -*- coding: utf-8 -*- '''mid 此文件为数据管理程序主界面 用于对历史数据进行检查核对 功能: 1.展示本地数据KLine图形 2.下载远程数据到本地 窗口布局: 1.数据展示主窗口 左侧为本地数据列表 右侧为KLine 左下侧为本地数据操作命令按钮 2.数据下载管理子窗口 左侧为代码表 右侧为待下载代码 程序结构: 为了能够方便的被各种窗体调用嵌入,各个窗体都定义为layout ''' from matplotlib.backends.backend_qt4agg import F...
UpSea/midProjects
histdataUI/Layouts/dataVisualizerLayout.py
dataVisualizerLayout.py
py
15,734
python
en
code
1
github-code
1
36655898494
#!/usr/bin/env python import sys def reindistance(r, secs): reindata = r[1] d = 0 rest = 0 stamina = reindata[1] for i in range(secs): if stamina > 0: stamina -= 1 d += reindata[0] if stamina == 0: rest = reindata[2] else: ...
gerrowadat/adventofcode
2015/14/14-2.py
14-2.py
py
1,331
python
en
code
1
github-code
1
38682966906
import cv2 import argparse ap = argparse.ArgumentParser() ap.add_argument('-i' ,'--image' ,required=True ,help = 'path to the input image') args = vars(ap.parse_args()) image = cv2.imread(args['image']) gray = cv2.cvtColor(image ,cv2.COLOR_BGR2GRAY) blurred = cv2.GaussianBlur(gray ,(5 ,5) ,0) #last argument in blurri...
suhaneshivam/Computer_vision
Image_operations/Center_of_shape/center_of_shape.py
center_of_shape.py
py
994
python
en
code
0
github-code
1
4206675975
"""SmartDevice URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.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-b...
skyu0221/IoT
backend-server/SmartDevice/urls.py
urls.py
py
1,950
python
en
code
0
github-code
1
36866813408
import fnmatch import os import PyPDF2 import openpyxl from PyPDF2 import PdfReader from openpyxl.styles import Border, Side, Font, Alignment from openpyxl.worksheet.worksheet import Worksheet excel_path = os.getcwd() listOfFiles = os.listdir('.') pdf_files = [f for f in listOfFiles if f.endswith('.pdf')] pdf_files....
alekspetrov3009/MACROS
Заполнение служебной записки/zap.py
zap.py
py
5,583
python
ru
code
0
github-code
1
46357130631
import numpy as np import matplotlib.pyplot as plt from control.matlab import * m1 = 0.8 m2 = 0.2 k1 = 100 c1 = 1 c2 = 0.3 Ks = 100 M = np.matrix([[m1, 0],[0, m2]]) C= np.matrix([[c1+c2, -c2],[-c2, c2]]) F = np.matrix([[Ks],[0]]) iM = np.linalg.inv(M) Bp = np.concatenate([np.zeros((2,1)), iM*F]) Cp = [0,1,0,0] Dp ...
RyoheiTK/robust-control
sample/robust_4_1.py
robust_4_1.py
py
1,065
python
en
code
0
github-code
1
17656393605
from keras.preprocessing.image import ImageDataGenerator from keras.applications.inception_v3 import InceptionV3 from keras import backend as K K.set_image_dim_ordering('th') import numpy as np import os #Здесь делаем аугментацию. # Для этого в Keras предусмотрены так называемые ImageDataGenerator. # Они будут брать ...
ValeryShestakovv/keras_incepnionV3_binary_classification
bottleneck_features.py
bottleneck_features.py
py
3,937
python
ru
code
0
github-code
1
4850877077
""" Cli functions to setup scout """ import logging import datetime import yaml import pymongo import click # Adapter stuff from scout.adapter.mongo import MongoAdapter from scout.adapter.client import get_connection from pymongo.errors import (ConnectionFailure, ServerSelectionTimeoutError) # Import the resources t...
gitter-badger/scout
scout/commands/setup/setup_scout.py
setup_scout.py
py
13,127
python
en
code
null
github-code
1
19906847432
import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation from keras.layers import LSTM import string import keras # DONE: fill out the function below that transforms the input series # and window-size into a set of input/output pairs for use with our RNN model def window_tran...
vincentmhhon/aind2-rnn
my_answers.py
my_answers.py
py
2,304
python
en
code
0
github-code
1
12803022896
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 5 20:13:40 2018 @author: liuchuang 线性时间求解 最大子数组 """ def Find_Maxmum_Subarray(A, low, high): left=0 right=0 sum = A[low] tempSum = 0 for i in range(low,high+1): tempSum = max(A[i],tempSum+A[i]) if tempSum>sum: ...
LiuChuang0059/python_practise
graph algorithm/find_maxmum_subarray_lineartime_algr.py
find_maxmum_subarray_lineartime_algr.py
py
531
python
en
code
43
github-code
1
31595782614
from matplotlib import pyplot from matplotlib.patches import Rectangle import imageIO.png import numpy as np import math class Queue: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def enqueue(self, item): self.items.insert(0,item) def dequeu...
iessje/QR-code-detection
QRCodeDetection.py
QRCodeDetection.py
py
13,915
python
en
code
0
github-code
1
72505330915
# -------------------------------------------------------------------- # shell.py: Shell command execution tools, including ShellRecipe. # # Author: Lain Musgrove (lain.proliant@gmail.com) # Date: Thursday, January 2 2020 # # Distributed under terms of the MIT license. # ------------------------------------------------...
lainproliant/panifex
panifex/shell.py
shell.py
py
13,661
python
en
code
1
github-code
1
2418374637
import logging from odoo import api, models, _ from odoo.tools import ormcache from odoo.tools.config import config, to_list _logger = logging.getLogger(__name__) WEB_BASE_URL_FREEZE = 'web.base.url.freeze' class IrConfigParameter(models.Model): _inherit = 'ir.config_parameter' @api.model @ormcache() ...
decgroupe/odoo-addons-dec
base_url_freeze_filtering/models/ir_config_parameter.py
ir_config_parameter.py
py
889
python
en
code
2
github-code
1
32485610231
import sys t = int(sys.stdin.readline().strip()) for _ in range(t): x, y = map(int, sys.stdin.readline().strip().split()) d = y - x b = int((d-1) ** 0.5) if d <= (b**2 + (b+1)**2)//2: print(b * 2) else: print(b * 2 + 1) c = 0 while True: if d <= c * (c + 1): ...
CrimsonTheLegoBuilder/MyBaekjoonSolve
Python_/implementation/bj1011.py
bj1011.py
py
630
python
en
code
0
github-code
1
31278878919
import os import cv2 def count_frames(path, override=False): # grab a pointer to the video file and initialize the total # number of frames read video = cv2.VideoCapture(path) total = 0 # if the override flag is passed in, revert to the manual # method of counting frames if override: total = count_frames_manua...
DimasVeliz/ExtractingFrames
resolvingFrames.py
resolvingFrames.py
py
2,869
python
en
code
0
github-code
1
348772121
# -*- coding: utf-8 -*- """ Created on Thu Jun 21 15:42:31 2018 @author: Ashish Chouhan """ #The optimal values of m and b can be actually calculated with way less effort than doing a linear regression. #this is just to demonstrate gradient descent import numpy as np from matplotlib import pyplot as plt # y = mx +...
achouhan93/Machine_Learning
Linear Regression/GradientDescent_With Plot Feature.py
GradientDescent_With Plot Feature.py
py
2,566
python
en
code
0
github-code
1
18636425161
import datetime as dt from datetime import timedelta from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator def greet(r_date): print('Writing in file') with open('./greet.txt', 'a+', encoding='utf8') as f: now = dt.d...
madhur09/apache_airflow
airflow_home/dags/simple_dag.py
simple_dag.py
py
1,403
python
en
code
0
github-code
1
42922051653
# -*- coding: utf-8 -*- from odoo import models, fields, api class classe(models.Model): _name = 'iut.class' _sql_constraints = { ('name_unique', 'unique(name)', 'Ce nom existe déjà') } name = fields.Char(string="Nom de la classe",required=True) level = fields.Selection([('seconde', 'Seco...
nlthevinh/Gestion-Lyc-e
models/classe.py
classe.py
py
1,050
python
en
code
0
github-code
1
11481603432
import sys,re,difflib,time,datetime import numpy as np from array import array np.set_printoptions(threshold=sys.maxsize) import matplotlib.pyplot as plt import networkx as nx def show_graph_with_labels(adjacency_matrix, mylabels): rows, cols = np.where(adjacency_matrix != 0) edges = zip(rows.tolist(), cols.to...
FabienCharmet/MDPRA
showgraph.py
showgraph.py
py
680
python
en
code
0
github-code
1
33422209146
from google.cloud import aiplatform import numpy as np endpoint_name = "text-classification_endpoint" endpoint = aiplatform.Endpoint.list(filter=f'display_name="{endpoint_name}"')[0] text = "I love going to the movies!" result = endpoint.predict(instances=[{'content': text}]) prediction = result.predictions[0] names =...
MeTaNoV/model-training
test/scripts/inference/text_classification_inference.py
text_classification_inference.py
py
499
python
en
code
0
github-code
1
72920658275
from django.db import models from django.utils.html import mark_safe from edc_base.model_mixins import BaseUuidModel from edc_base.sites.site_model_mixin import SiteModelMixin from edc_base.utils import get_utcnow from edc_consent.field_mixins import VerificationFieldsMixin from edc_identifier.model_mixins import NonUn...
botswana-harvard/edc-odk
edc_odk/models/consent_copies.py
consent_copies.py
py
1,675
python
en
code
0
github-code
1
10594328363
with open("file1.txt") as file_1: f1_list = file_1.readlines() f1 = [int(num.strip("\n")) for num in f1_list] with open("file2.txt") as file_2: f2_list = file_2.readlines() f2 = [int(num.strip("\n")) for num in f2_list] result = list(set(f1) & set(f2)) # Write your code above 👆 print(result)
FirelCrafter/100_days_challenge
day_26/day-26-3-exercise/main.py
main.py
py
318
python
en
code
0
github-code
1
15922680536
import numpy as np import torch from torch.utils.data import Dataset, DataLoader, ConcatDataset import mat73 class MatCovData(Dataset): def __init__(self, snr=10, mode='train', norm=None): super(MatCovData, self).__init__() if mode == 'train': file_path = '/home/External/xr/SDOAnet/doa...
FurryMushroom/DOA_Estimation_machine_learning
dataset.py
dataset.py
py
2,993
python
en
code
1
github-code
1
21451999572
import paho.mqtt.client as mqtt import sqlite3 from datetime import datetime, timedelta # Name of DB file. db_file = "connected_devices.db" # Exceptions classes. class ConnectionToMqttBrokerException(Exception): def __init__(self): pass def __str__(self): message = "MQTT Manager could not connect t...
kosmolub01/Smart-home
Smart_home/app/mqtt_manager.py
mqtt_manager.py
py
9,827
python
en
code
0
github-code
1
73262103715
def main(): try: fuel = input("Fraction: ") x, y = fuel.split(sep="/") error_handling(x , y) percentage = (int(x)/int(y)) * 100 if percentage <= 1: print ("E", end="") elif percentage >= 99: print ("F", end="") else: print (...
pmagalha/CS50-Python
Problem Set 3/fuel/fuel.py
fuel.py
py
673
python
en
code
0
github-code
1
14807809950
from typing import cast, TYPE_CHECKING from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from starlette.requests import HTTPConnection from starlite import ( AbstractAuthenticationMiddleware, AuthenticationResult, NotAuthorizedException, ) from database.model import User from s...
ppkpp/starlite_reactjs
security/auth_middleware.py
auth_middleware.py
py
1,368
python
en
code
0
github-code
1
28684901336
import os import pandas as pd from django.shortcuts import render from django.http import HttpResponseRedirect source_dates = pd.read_csv("us-covid-dates.csv") titles = { "ct": { "title": "CASE RATE REPORTED BY STATE | TOTAL", "subtitle": "TOTAL NUMBER OF CASES | AS OF THE DATE INDICATED" }, ...
andrey-yakovenko/va-project
mysite/polls/views.py
views.py
py
2,703
python
en
code
0
github-code
1
4576712455
import base64 import xml.etree.ElementTree as ET import gimme_aws_creds.common as commondef from . import errors class DefaultResolver(object): """ The Aws Client Class performs post request on AWS sign-in page to fetch friendly names/alias for account and IAM roles """ def __init__(self, ...
Nike-Inc/gimme-aws-creds
gimme_aws_creds/default.py
default.py
py
2,029
python
en
code
884
github-code
1
18054362967
def collatz(number): if number % 2 == 0: return number / 2 elif number % 2 == 1: return number * 3 + 1 while True: try: n = int(input('请输入一个大于零的整数,按enter键确定')) if n <= 0: print('输入错误,请输入一个大于零的整数,按enter键确定,重新输入') continue break except: ...
gouyanzhan/Python
day1/test5.py
test5.py
py
528
python
en
code
0
github-code
1
36377970290
from src.infra.database.sqlite.views.user.user_view import * from src.data.protocols.user.authenticate_user_repository import AuthenticateUserRepository as AuthenticateUserRepositoryInterface from src.data.protocols.user.list_user_account_repository import ListUserAccountRepository as ListUserAccountRepositoryInterface...
pedrohso7/PokeTroca
backend/src/infra/database/sqlite/repository/list_user_account_repository/list_user_account.py
list_user_account.py
py
796
python
en
code
2
github-code
1
3476128370
# -*- coding: utf-8 -*- """ Trains and tests a Rolling Bayesian Ridge Regression model on data @author: Nick """ import warnings import numpy as np import pandas as pd from sklearn.pipeline import Pipeline from sklearn.feature_selection import VarianceThreshold from sklearn.preprocessing import MinMaxScal...
N-ickMorris/Time-Series
elect_rolling_bayes.py
elect_rolling_bayes.py
py
2,128
python
en
code
0
github-code
1
2003100509
from tests import unittest from awscli.customizations.s3.utils import find_bucket_key, find_chunksize from awscli.customizations.s3.constants import MAX_SINGLE_UPLOAD_SIZE class FindBucketKey(unittest.TestCase): """ This test ensures the find_bucket_key function works when unicode is used. """ de...
gthiruva/aws-cli
tests/unit/customizations/s3/test_utils.py
test_utils.py
py
1,705
python
en
code
null
github-code
1
24231412484
import sys from PyQt5 import QtWidgets from PyQt5.QtCore import QThread import pyqtgraph as pg import numpy as np from MainWindow import Ui_MainWindow #from GraphClass import MultiLine # Supposed to improve perforamnce, but with latest pyqtgraph updates maybe not needed anymore from WorkerClass import AcquireData from...
nelsongt/mfiaDLTS2
mfiaMain.py
mfiaMain.py
py
6,880
python
en
code
3
github-code
1