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
37842291992
# ---------------------------------------------------------------------------------------------------------------------- # Implementation of k-Means Machine learning algorithm, tested using synthetic data created in script # # Sean Taylor Thomas # 9/2021 # stth223@uky.edu # ---------------------------------------------...
STaylorT/Machine-Learning
K-Means.py
K-Means.py
py
5,400
python
en
code
0
github-code
6
33386199461
""" File input and output functions """ import ujson as json from dev_funcs import printline, Recorded_Time from comms import Appointment #class to store data imported from local json config file class FileIO: def __init__(self): #build all of the variables from data.json file self.load_local_vars() #print the ...
TotalJTM/DoccoLink-Device-Firmware-V1
file_funcs.py
file_funcs.py
py
11,601
python
en
code
0
github-code
6
72489693947
""" The smallest square (or matrix) large enough to contain the given coordinates has size `x + y +1`. The biggest number in a matrix of size N, with given rules is `n + n-1 + n-2 + ... + 1`. Given the biggest number, we can just subtract y to "move" to the correct id. """ def solution(x, y): matrix_size = x + y -...
curzel-it/foobar
2.2 Bunny Worker Locations/main.py
main.py
py
432
python
en
code
0
github-code
6
24293870265
def count_substring(string, sub_string): sublen = len(sub_string) count = 0 for i in range(len(string)-sublen+1): temp = string[i:i+sublen] if temp == sub_string: count += 1 return count print(count_substring("ABCDCDCD", "CD"))
Tanmoy0077/Python-Experiments
Count_substr.py
Count_substr.py
py
272
python
en
code
0
github-code
6
11323411187
import random import sys from pyfiglet import Figlet import requests import json import os from dotenv import load_dotenv # Setting up TMDB API Key load_dotenv() API_KEY = os.getenv('TMDB_API_KEY') # Retrieve top rated movies in TheMovieDB pages = {'results': []} for i in range(5): page = requests.get(f'https:/...
MaCeleste/Movie-Hangman
project.py
project.py
py
4,490
python
en
code
0
github-code
6
27529865063
import numpy as np import matplotlib.pyplot as plt from scipy import signal def load_data(filename): # 读入数据文件 data = np.loadtxt(filename) return data def plot_signal_waveform(data, fs): # 绘制信号波形 duration = len(data) / fs # 持续时间,单位为秒 time = np.linspace(0, duration, len(data)) plt.subplot(...
huigang39/TENG
Software/dl/signal_analysis.py
signal_analysis.py
py
1,602
python
en
code
2
github-code
6
16824394057
# Noah van der Vleuten (s1018323) # Jozef Coldenhoff (s1017656) import queue from pacman import agents, gamestate, search, util import ass2 class CornersSearchRepresentation(search.SearchRepresentation): def __init__(self, gstate): super().__init__(gstate) self.walls = gstate.walls self....
NoahVl/PacmanEvolution
PacmanEvolution/ass3.py
ass3.py
py
8,377
python
en
code
2
github-code
6
7577852611
from django import forms from models import Attachment class AttachmentForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.user = kwargs.pop('user', None) self.actived = kwargs.pop('actived', False) super(AttachmentForm, self).__init__(*args, **kwargs) def sav...
vicalloy/django-lb-attachments
attachments/forms.py
forms.py
py
616
python
en
code
7
github-code
6
7131301851
# List Comprehensions # quick ways to create lists is python my_list = [] for char in 'hello': my_list.append(char) print(my_list) # there is a quicker way # my_list = [param for param in iterable] my_list = [char for char in 'hello'] print(my_list) # first param can be an expression my_list2 = [num * 2 f...
leerobertsprojects/Python-Mastery
Advanced Python Concepts/Functional Programming/List Comprehensions.py
List Comprehensions.py
py
481
python
en
code
0
github-code
6
25069790009
class Solution: def moveZeroes(self, nums): """ Do not return anything, modify nums in-place instead. """ for index, value in enumerate(nums): if value == 0: nums.pop(index) nums.append(value) print(nums) if __name__=="_...
ankitarm/Leetcode
Python/283.MoveZeros.py
283.MoveZeros.py
py
424
python
en
code
0
github-code
6
38316017126
from flask import Flask from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() #imports routes from .routes import home_blueprint # from .database.model import * def create_app(): app = Flask(__name__) #load config file app.config.from_object("project.config.Config") #routes app.register_bl...
vipin733/flask_boilerplate
services/web/project/__init__.py
__init__.py
py
427
python
en
code
0
github-code
6
18478316296
from block import Block from transaction import Transaction class ConverterToObj(): @staticmethod def chain_to_obj(blockchain): """ Receives a blockchain of dictionaries and converts the blocks into block objects and the transactions into Transactions objects Returns an updated blockchain ...
salvescoding/bockchain_cryptocurrency
app/helpers/converter_to_obj.py
converter_to_obj.py
py
1,249
python
en
code
0
github-code
6
6297668116
try: from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * except ImportError: from PyQt4.QtGui import * from PyQt4.QtCore import * from libs.lib import newIcon, labelValidator BB = QDialogButtonBox class AdjustWindowLevelDialog(QDialog): def __init__(self, text...
RT-Rakesh/label-img
libs/adjustWindowLevelDialog.py
adjustWindowLevelDialog.py
py
2,895
python
en
code
null
github-code
6
8287227022
# encoding: utf-8 from django.test import TestCase from django.db import IntegrityError from subscription.models import Subscription class SubscriptionModelTest(TestCase): def test_create_new_subscription(self): s = Subscription.objects.create( name='Henrique Bastos', cpf='05633165...
rosenclever/Eventex
subscription/tests/test_models.py
test_models.py
py
1,055
python
en
code
2
github-code
6
18552105619
# # Napisać program który wyświetla wykres funkcji kwadratowej o podanych współczynnikach. # # Tworząc wykres należy tak dobrać zakres wyświetlanej osi X aby znalazły się w nim: # # współrzędna wierzchołka oraz miejsca zerowe z marginesem ok 10% # # (dla przykładu: jeżeli miejsca zerowe wynoszą np x1=2 i x2=10 to oś...
TomaszWs/Python-training
UG-training/wykres-funkcji.py
wykres-funkcji.py
py
3,391
python
pl
code
0
github-code
6
9352031238
"""Cleaning Functions These functions define standard text processing functions for cleaning. """ from html import unescape import re import emoji def clean_text(text): """Cleans single data entry of text. Args: text (str): input text for cleaning. Returns: str: output cleaned text. ...
HannahKirk/ActiveTransformers-for-AbusiveLanguage
scripts/0_data_prep/cleaning_functions.py
cleaning_functions.py
py
4,543
python
en
code
3
github-code
6
15018763785
from tkinter import Widget import customtkinter as ctk from customtkinter import ThemeManager from View.GUI.Windows.GraphWindow.ButtonBar import ButtonBar from View.GUI.Windows.GraphWindow.GraphCanvas import GraphCanvas from View.GUI.Windows.WindowInterface import WindowInterface, Position class GraphWindow(WindowI...
Moni5656/npba
View/GUI/Windows/GraphWindow/GraphWindow.py
GraphWindow.py
py
2,319
python
en
code
0
github-code
6
19938577350
import struct class MD4: @staticmethod def digest(input_file): # input_file = input_data def F(x, y, z): return (x & y) | (~x & z) def G(x, y, z): return (x & y) | (x & z) | (y & z) def H(x, y, z): return x ^ y ^ z def left_rotate...
dzakrzew/io-ns
generators/python/hash_functions/md4.py
md4.py
py
2,484
python
en
code
0
github-code
6
787431703
""" Tests for `nameko_cachetools` module. """ import time import pytest from mock import Mock, patch import random import eventlet from nameko.rpc import rpc from nameko.standalone.rpc import ServiceRpcProxy from nameko_cachetools import CachedRpcProxy, CacheFirstRpcProxy from nameko.testing.services import (entrypoin...
santiycr/nameko-cachetools
test/test_nameko_cachetools.py
test_nameko_cachetools.py
py
4,402
python
en
code
9
github-code
6
73477691067
from tinygrad.tensor import Tensor import numpy import os # Format Details: # A KINNE parameter set is stored as a set of files named "snoop_bin_*.bin", # where the * is a number starting at 0. # Each file is simply raw little-endian floats, # as readable by: numpy.fromfile(path, "<f4") # and as writable by: t...
fpaboim/tinysparse
extra/kinne.py
kinne.py
py
2,836
python
en
code
9
github-code
6
10649216487
""" ProjectManager Description: """ import pygame,sys pygame.init() # Defining Image Width get_width = int(input("Image Width: (px)")) get_height = int(input("Image Height: (px)")) get_name = str(input("Project Name: ")) win_size = (get_width,get_height) # Creating Project Script file = get_name + '.txt' with open(f...
LandenTy/GeometricEngine
CustomTexturer/main.py
main.py
py
3,267
python
en
code
0
github-code
6
71319102588
def check(a, b): if a > 0 and b > 0: return True else: return False while True: m = int(input('Введите кол-во экспертов: ')) n = int(input('Введите кол-во целей: ')) if not check(m, n): print('Вы ввели некорректные значения. Повторите попытку!') contin...
jewdash/SAandPIS
САиПИС_4/код.py
код.py
py
2,194
python
ru
code
1
github-code
6
36132885755
from random import choice from time import sleep from colorama import init, Fore init() deck_preset = ("A", *range(2, 11), "J", "Q", "K") deck = [item for item in deck_preset for i in range(4)] del deck_preset class Card: special_names = ["A", "J", "Q", "K"] def __init__(self, name): ...
Rikaisan/100-days-of-code
python-files/11_blackjack.py
11_blackjack.py
py
5,613
python
en
code
1
github-code
6
33153414975
import dgl import torch import torch.nn as nn import torch.nn.functional as F import math import dgl.function as fn from dgl.nn.pytorch import edge_softmax class GCNLayer(nn.Module): def __init__(self, in_feats, out_feats, activation, dropout, ...
raspberryice/ala-gcn
layers.py
layers.py
py
21,424
python
en
code
21
github-code
6
42600676142
import multiprocessing import operator from functools import partial import numpy as np from core import mathlib from core.interact import interact as io from core.leras import nn from facelib import FaceType, XSegNet from models import ModelBase from samplelib import * class XSegModel(ModelBase): def __init__...
ccvvx1/Python_Df
models/Model_XSeg/Model.py
Model.py
py
15,453
python
en
code
0
github-code
6
27519489621
from django.shortcuts import (render, get_object_or_404, get_list_or_404, redirect, HttpResponse) from .models import Total from .serializer import TotalSerializer, Serializer # , UserSerializer from rest_framework.views import APIView from rest_framework.response import Response from res...
Afeez1131/CovidNg-2021
total/views.py
views.py
py
8,441
python
en
code
0
github-code
6
4880169931
#!/usr/bin/env bash """true" '''\' set -e eval "$(${CONDA_EXE:-conda} shell.bash hook)" conda deactivate conda activate audio-lessons exec python "$0" "$@" exit $? ''""" import re from re import Match from chrutils import ced2mco def main() -> None: in_file: str = "data/cll2-v1-vocab-list-ced.txt" out_file: ...
CherokeeLanguage/audio-lessons-generator-python
fix_cll2_v1_vocab_list.py
fix_cll2_v1_vocab_list.py
py
1,306
python
en
code
2
github-code
6
5809207089
# --- # jupyter: # jupytext: # formats: ipynb,py # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.9.1+dev # kernelspec: # display_name: Python [conda env:biovectors] # language: python # name: conda-env-biovectors-...
greenelab/biovectors
multi_model_experiment/04_novel_distance_calculations.py
04_novel_distance_calculations.py
py
14,275
python
en
code
3
github-code
6
33680361650
from django.urls import path, include from rest_framework import routers from .views import ( IndexView, DetailView, ResultsView, vote, QuestionViewSet, ChoiceViewSet, ) router = routers.DefaultRouter() router.register(r"questions", QuestionViewSet) router.register(r"choices", ChoiceViewSet) ...
orvisevans/django-vue-site
backend/polls/urls.py
urls.py
py
630
python
en
code
0
github-code
6
74793669627
class HeaderRepository: def __init__(self): self._type_dict = { "CONNECT": "0x1", "CONNACK": "0x2", "PUBLISH": "0x3", "PUBREC": "0x4", "PUBREL": "0x5", "PUBCOMP": "0x6", "SUBSCRIBE": "0x7", "SUBACK": "0x8", ...
BigKahuna7385/mqttBroker
Utils/HeaderRepository.py
HeaderRepository.py
py
1,684
python
en
code
0
github-code
6
26804363991
input = __import__("sys").stdin.readline num_wiz, num_duels = [int(data) for data in input().split()] graph = [[] for _ in range(num_wiz + 1)] for _ in range(num_duels): adj_vertex, vertex = [int(data) for data in input().split()] graph[vertex].append(adj_vertex) visited = set() endpoint = [0] * (num_wiz + 1...
Stevan-Zhuang/DMOJ
COCI/COCI '18 Contest 4 #2 Wand.py
COCI '18 Contest 4 #2 Wand.py
py
678
python
en
code
1
github-code
6
1245326187
import pandas as pd import pyranges as pr import re def extract_dna_id(filename): pattern = "genomics\/3_vcf\/.*\/(.*)\/.*" dna_id = re.search(pattern, filename).group(1) return dna_id df_anno = pd.read_csv(snakemake.input['sample_anno'], sep='\t') _df_anno = df_anno[ ~df_anno['DNA_VCF_FILE'].isna() ...
gagneurlab/AbSplice_analysis
workflow/scripts/als/junction_annotation/correct_vcf_id_DROP_anno.py
correct_vcf_id_DROP_anno.py
py
574
python
en
code
0
github-code
6
32645650527
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Module that contains functions related with Maya tag functionality for ueGear. """ from __future__ import print_function, division, absolute_import import maya.cmds as cmds import maya.api.OpenMaya as OpenMaya from mgear.uegear import utils, log logger = log.uegea...
mgear-dev/mgear4
release/scripts/mgear/uegear/tag.py
tag.py
py
9,387
python
en
code
209
github-code
6
8267999016
from __future__ import annotations from unittest import mock from kombu.utils.objects import cached_property class test_cached_property: def test_deleting(self): class X: xx = False @cached_property def foo(self): return 42 @foo.deleter...
celery/kombu
t/unit/utils/test_objects.py
test_objects.py
py
2,091
python
en
code
2,643
github-code
6
1584185600
import cv2 def draw_boxes(im, boxes, class_names=None, scores=None, colors=None): scores = [None] * len(boxes) if scores is None else scores colors = [None] * len(boxes) if colors is None else colors class_names = [None] * len(boxes) if class_names is None else class_names for params in zip(boxes, cl...
Guillem96/ssd-pytorch
ssd/viz.py
viz.py
py
991
python
en
code
0
github-code
6
46058474656
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import gettext_lazy as _ from django.utils import timezone from django.db import IntegrityError, transaction from .managers import TopicNotificationQuerySet from spirit.core.conf import settings class TopicNotification(models.Model):...
nitely/Spirit
spirit/topic/notification/models.py
models.py
py
4,758
python
en
code
1,153
github-code
6
5558606800
import os from dotenv import load_dotenv from configparser import ConfigParser conf = ConfigParser() conf.read('model.conf') load_dotenv('.env') def _getenv(key, default): return type(default)(os.getenv(key)) if os.getenv(key) else default SERVER_IP = _getenv('SERVER_IP', '0.0.0.0') # Service IP SERVER_PORT = _get...
rahmanmahbub073/PythonBased_FastAPI_mL_dL_Repo
UnwantedImageDetection_server/config.py
config.py
py
1,241
python
en
code
1
github-code
6
23338785771
import tensorflow as tf import pandas as pd from sklearn.metrics import multilabel_confusion_matrix, confusion_matrix, precision_score, recall_score, f1_score def calculate_output(model, actual_classes, session, feed_dict): actuals = tf.argmax(actual_classes, 1) predictions = tf.argmax(model, 1) actuals = ...
Sam-Mah/PLDNN
tensorflow_confusion_metrics.py
tensorflow_confusion_metrics.py
py
2,817
python
en
code
3
github-code
6
38514794793
import gc import os from pathlib import Path from typing import Any, Dict, cast import mlflow import numpy as np import onnx import torch import transformers from pytorch_lightning import Trainer, seed_everything from pytorch_lightning.callbacks import ModelCheckpoint from transformers.modeling_utils import PreTrained...
crypto-sentiment/crypto_sentiment_demo_app
crypto_sentiment_demo_app/models/train/bert/model.py
model.py
py
4,376
python
en
code
25
github-code
6
28178733296
#!/usr/bin/env python3 user_input = str(input("Please enter a phrase (only characters A-Z): ")) phrase = user_input.split() result = " " for i in phrase: result += str(i[0]).upper() print (result)
R4qun3/Beginner-projects
Acronym.py
Acronym.py
py
211
python
en
code
0
github-code
6
26185607454
"""Rotate Image You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Outp...
01o91939/leetcode
rotateImage.py
rotateImage.py
py
1,441
python
en
code
0
github-code
6
27716822705
import frappe from frappe.model.document import Document class Sales(Document): def before_save(self): total_amount = 0 for item in self.item: item.amount = item.product_price * item.quantity total_amount += item.amount product = frappe.get_doc('Product', item.product_name) # Decrease the product ...
mehedi432/pos
pos/pos/doctype/sales/sales.py
sales.py
py
1,184
python
en
code
0
github-code
6
5361671905
import bottle import json import random from . import DatabaseManager from .product import Product import recommender.vector.arithmetic import recommender.rocchio.algorithm @bottle.route('/product/get/<doc_id:int>') def product_get(doc_id): d = product_manager.get_product(doc_id).as_dictionary() result = {'...
dustywind/bachelor-thesis
impl/recommender/webapi.py
webapi.py
py
8,641
python
en
code
0
github-code
6
22558981666
import math import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation #Dane początkowe k1 = 1 m = 1 h = 0.05 x0 = 10 vx0 = 0 w1 = math.sqrt(k1/m) A1 = math.sqrt((vx0*vx0)/(w1*w1) + (x0*x0)) iloscPunktow = 1000 #oś XY setXl = 0 setXr = 55 setYl = 49.95 s...
OskarLewandowski/My_Learning
Python/Oscylator-energia.py
Oscylator-energia.py
py
4,595
python
pl
code
0
github-code
6
45635574383
from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from .conv_tasnet import TCN, GatedTCN from .lobe.activation import get_activation from .lobe.norm import get_norm from .lobe.rnn import FSMN, ConditionFSMN class Unet(nn.Module): """ Generic_Ar...
mcw519/PureSound
puresound/nnet/unet.py
unet.py
py
26,136
python
en
code
4
github-code
6
39858982363
import os import sys if not "DEVITO_OPENMP" in os.environ or os.environ["DEVITO_OPENMP"] != "1": print("*** WARNING: Devito OpenMP environment variable has not been set ***", file=sys.stderr) import numpy as np from sympy import Matrix, Eq, solve import progressbar from devito import TimeData, Operator, t, x, y,...
gamdow/ACG-feasibility
wrapper_pkg/devito.py
devito.py
py
7,301
python
en
code
0
github-code
6
8337543538
#! /usr/bin/env python import sys import csv import screed import random import argparse import sourmash import sequtils # local import def main(): parser = argparse.ArgumentParser() parser.add_argument('genome') parser.add_argument('-e', '--error-rate', type=float, default=.01) pars...
ctb/2022-sourmash-sens-spec
scripts/make-detection-curve.py
make-detection-curve.py
py
3,926
python
en
code
2
github-code
6
2115320611
# suhaarslan.com from random import randbytes class Client: def keyControl(self, x): # takes first 32 bytes return x[:self.__byte] # Control Funtions def __init__(self, a, b): # a, b 32 bytes public key / a, b string self.__byte = 128 self.public_key_1 = bytes(self.ke...
programmer-666/Cryptography
Asymetric/Diffie-Helman.py
Diffie-Helman.py
py
1,463
python
en
code
0
github-code
6
31463758726
import logging import pathlib import sqlite3 logger = logging.getLogger(__name__) def is_database_exists(db_path): return pathlib.Path(db_path).exists() def open_connection(db_path): if is_database_exists(db_path): logger.debug(f"Connecting to {db_path}") try: return sqlite3.con...
nemeshnorbert/reveal
src/db/utils.py
utils.py
py
1,509
python
en
code
0
github-code
6
28448639940
# __author__ = 'heyin' # __date__ = '2019/2/14 16:03' # google翻译rpc服务端代码 import sys sys.path.append('../') import json import grpc import time from concurrent import futures from rpc_server.fanyi import fanyi_pb2, fanyi_pb2_grpc from rpc_conf import HOST, PORT, ONE_DAY_IN_SECONDS from core import google js = google....
hy89/google-translate
rpc_server/server.py
server.py
py
1,172
python
en
code
0
github-code
6
30086424921
import logging import paddle.fluid as fluid import paddle.fluid.dygraph.nn as nn from utils import build_norm_layer, build_conv_layer, Sequential class BasicBlock(fluid.dygraph.Layer): expansion = 1 def __init__(self, inplanes, planes, stride=1, ...
VIS-VAR/LGSC-for-FAS
models/resnet.py
resnet.py
py
10,152
python
en
code
223
github-code
6
72947597948
from verlib import NormalizedVersion as Ver import numpy as np __author__ = "Balaji Sriram" __version__ = "0.0.1" __copyright__ = "Copyright 2018" __license__ = "GPL" __maintainer__ = "Balaji Sriram" __email__ = "balajisriram@gmail.com" __status__ = "Production" class Criterion(object): def __init__(self, name=...
balajisriram/bcore
bcore/classes/Criterion.py
Criterion.py
py
6,860
python
en
code
1
github-code
6
15156725753
import os import math import numpy as np from tqdm import tqdm import pickle import torch import torch.nn as nn from torch.autograd import Variable from torch.nn import functional as F from models import l2norm ## Memory class Memory(nn.Module): def __init__(self, mem_size=500000, feat_dim=256, margin=1, topk...
toanhvu/learning-to-remember-beauty-products
memory.py
memory.py
py
2,793
python
en
code
1
github-code
6
42073775086
""" Project 2A: Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee's total weekly pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. An employee's total weekly pay equals the hourly wage multiplied ...
KennethHorsman/Eric-s-Revisions
2A-revised.py
2A-revised.py
py
3,105
python
en
code
0
github-code
6
72000465789
from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import datetime import locale import os from tqdm import tqdm from collections import * from typing import Optional,List,Tuple from trident.backend.common import * from trident.backend.pytorch_op...
AllanYiin/trident
trident/models/pytorch_embedded.py
pytorch_embedded.py
py
9,944
python
en
code
74
github-code
6
32203126633
import datetime import random import yaml from requests import get def compute_median(lst): """ Вычисление медианты списка :param lst: входящий список значений :return: медиана """ quotient, remainder = divmod(len(lst), 2) return lst[quotient] if remainder else sum(sorted(lst)[quotient - ...
zombym/devops-tasks
5.5.1.py
5.5.1.py
py
5,538
python
ru
code
0
github-code
6
25359325465
# -*- coding: utf-8 -*- from __future__ import division import scrapy from scrapy import Request # from street_food.items import StreetFoodItem, StreetFoodDatTimeItem from street_food.items import StreetFoodDatTimeItem from street_food.spiders import tools import json from urllib import urlopen # import random from str...
kirimaks/street-food-scraper
street_food/street_food/spiders/offthegrid.py
offthegrid.py
py
3,638
python
en
code
0
github-code
6
36961545751
#!/usr/bin/env python # coding: utf-8 # ## App Creation # # First, import all necessary libraries: # In[1]: #App Libraries import json import dash from dash import html, dcc, Input, Output, State, dash_table import dash_bootstrap_components as dbc #Distributions from scipy.stats import gamma from scipy.stats impo...
annette-bell/SInR-Covid-Dissertation
dash_lambda.py
dash_lambda.py
py
44,277
python
en
code
1
github-code
6
33851174074
''' boss class ''' import pygame class Boss(pygame.sprite.Sprite): def __init__(self,laser): pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load("images/Boss.gif").convert() self.rect = self.image.get_rect() self.rect.x = 500 self.rect.y = 0...
Inviernos/Alien-Lord
boss.py
boss.py
py
1,580
python
en
code
0
github-code
6
43968820856
#!/usr/bin/env python from Bio import SeqIO import argparse import json import os from CPT_GFFParser import gffParse, gffWrite def parse_xmfa(xmfa): """Simple XMFA parser until https://github.com/biopython/biopython/pull/544 """ current_lcb = [] current_seq = {} for line in xmfa.readlines(): ...
TAMU-CPT/galaxy-tools
tools/comparative/xmfa_process.py
xmfa_process.py
py
3,928
python
en
code
5
github-code
6
43953915570
from flask import Flask, request, abort from linebot import ( LineBotApi, WebhookHandler ) from linebot.exceptions import ( InvalidSignatureError ) from linebot.models import * # My Code from util import * app = Flask(__name__) # Channel Access Token line_bot_api = LineBotApi('++7wQ1tXdLomUPrrUbvcKEE12HAh+e...
asianpwnage422/myLineBot
line-bot-kevin/app.py
app.py
py
2,208
python
en
code
0
github-code
6
27318807553
# @PascalPuchtler # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # dis...
iisys-hof/autonomous-driving
car-controller/src/mainController/Controller/MoveController/MoveControllerCommunication.py
MoveControllerCommunication.py
py
3,571
python
en
code
0
github-code
6
27451303499
#!/usr/bin/env python3 import sys if(len(sys.argv) < 2): sys.exit("Usage: makeMetadata.py ebook_title path_to_write_metadata") output = '' output += '---\n' output += 'title: ' + sys.argv[1].split('/')[len(sys.argv[1].split('/'))-1].title() + '\n' output += 'author: ' + 'Kyle Simpson' + '\n' output += 'rights: ' + 'Cr...
aidanharris/You-Dont-Know-JS
makeMetadata.py
makeMetadata.py
py
686
python
en
code
1
github-code
6
73816651386
import unittest from unittest import mock from pydis_core.site_api import ResponseCodeError from bot.exts.backend.sync._syncers import Syncer from tests import helpers class TestSyncer(Syncer): """Syncer subclass with mocks for abstract methods for testing purposes.""" name = "test" _get_diff = mock.As...
python-discord/bot
tests/bot/exts/backend/sync/test_base.py
test_base.py
py
2,317
python
en
code
1,206
github-code
6
30419861071
""" An AI agent that will explore its environment and perform certain tasks (mining, smelting, forging, and buying/selling items) """ import sys from time import sleep import traceback import cv2 import pyautogui from game_map import GameMap import utilities as utils from user_interface import UserInterface fro...
jeffaustin32/game_ai
main.py
main.py
py
1,821
python
en
code
0
github-code
6
2226786256
import pandas as pd import subprocess import os df = pd.read_csv(snakemake.input.predictions, sep="\t") cells_unselected = df.loc[df["prediction"] == 0, "cell"].tolist() # ADDING NEW COLUMN TO CONFIG FILE df_config = pd.read_csv("{data_location}/config/config_df_ashleys.tsv".format(data_location=snakemake.config["data...
friendsofstrandseq/ashleys-qc-pipeline
workflow/scripts/utils/rm_unselected_cells.py
rm_unselected_cells.py
py
1,345
python
en
code
3
github-code
6
26471438721
from math import floor, gcd, isqrt, log2, sqrt def gauss_sum(n: int) -> int: """ Calculates the sum of the first n natural numbers, based on the formula: {n}Sigma{k=1} k = n * (n + 1) / 2 Conversion of very large floats to integers in this formula can lead to large rounding losses, so division by 2 ...
bog-walk/project-euler-python
util/maths/reusable.py
reusable.py
py
12,786
python
en
code
0
github-code
6
32506954132
import csv import numpy as np import os import pydicom from segmentation_models.backbones import get_preprocessing import tensorflow as tf from pneumothorax_segmentation.constants import image_size, folder_path from pneumothorax_segmentation.data_augment import apply_random_data_augment from pneumothorax_segmentation....
benoitkoenig/pneumothorax-segmentation
preprocess.py
preprocess.py
py
4,252
python
en
code
0
github-code
6
24430998404
from sys import stdin def minimum_swaps(arr,n): grafo = {} solucion = [i+1 for i in range(n)] ans = 0 i = 0 while solucion != arr: #print(solucion,arr) #Si no es necesario acomodar el elemento en su lugar if arr[i] != solucion[i]: aux = arr[i] #4 ...
Sim0no/Arenas
arrays/minimum_swaps_2.py
minimum_swaps_2.py
py
666
python
en
code
0
github-code
6
24270752412
import numpy as np import matplotlib.pyplot as plt import os import torch import torchvision import numpy as np from torchvision import transforms from sklearn.metrics import precision_recall_curve, average_precision_score, auc, roc_auc_score, roc_curve import matplotlib.pyplot as plt from config import * import random...
dhaivat1729/detectron2_CL
generative_classifier/maha_dist_analysis.py
maha_dist_analysis.py
py
4,431
python
en
code
0
github-code
6
8022762471
#!/usr/bin/env python # encoding: utf-8 # @Time : 2019-07-31 10:24 __author__ = 'Ted' from PIL import Image, ImageFont, ImageDraw content={ "back_img":"pre/paper.jpg", "001":{ "ad":'老板,买10盒月饼呗', "head":'001.jpg' }, "002": { "ad": '老板,买20盒月饼呗', "head": '002.jpg' }, ...
pengfexue2/friends_ad
create_pics.py
create_pics.py
py
2,590
python
en
code
3
github-code
6
194935106
from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework import serializers from rest_framework import generics from rest_framework import viewsets from rest_framework.decorators import detail_route, list_route from rest_f...
xmaruto/mcord
xos/core/xoslib/methods/cordsubscriber.py
cordsubscriber.py
py
17,144
python
en
code
0
github-code
6
12009423058
from __future__ import annotations from dataclasses import fields from typing import Tuple import numpy as np from napari.layers import Image def update_layer_contrast_limits( layer: Image, contrast_limits_quantiles: Tuple[float, float] = (0.01, 0.98), contrast_limits_range_quantiles: Tuple[float, float...
bkntr/napari-brainways
src/napari_brainways/utils.py
utils.py
py
1,473
python
en
code
6
github-code
6
29943421716
import argparse import yaml from pyspark.sql.functions import udf, when, year class CreateSqlInput: def __init__(self): self.name = 'CalculateStats' @staticmethod @udf def extract_production(dict_string): try: production_array = yaml.load(dict_string, Loader=yaml.FullLoade...
richierichard99/TrueFilmIngest
tfi_etl/CreateSqlInput.py
CreateSqlInput.py
py
2,302
python
en
code
0
github-code
6
12643025727
from playsound import playsound import os import pandas as pd path = "audio/" # path to the dataset files = os.listdir(path) df = pd.DataFrame([], columns = ["file_name", "label"]) for file, i in zip(files, range(len(files))): print("Currently playing " + file) playsound(path + file) label = input("Please, provid...
Barsegh-A/audio-labelling
script.py
script.py
py
556
python
en
code
0
github-code
6
74957082106
# Sinw wave plot tool import numpy as np import matplotlib.pyplot as plt f =0.5 #frequency of sine wave # f =2 A =5# maximum amplitude of sine wave # A = 1 x = np.arange(-6.28, 6.28, 0.01)# array arranged from -pi to +pi and with small increment of 0.01 # x = np.arange(-3.14, 3.14, 0.01) #y = A*np.sin(f*x) y = A*np.ta...
dilshad-geol/IRIS-2022-Seismology-Skill-Building-Workshop
00_UNIX_DataFiles/python/numpy/sine.py
sine.py
py
397
python
en
code
0
github-code
6
34405330102
import matplotlib.pyplot as plt import numpy as np import os, tkinter, tkinter.filedialog, tkinter.messagebox # show the file selection filedialog root = tkinter.Tk() root.withdraw() fTyp = [('','*')] iDir = os.path.abspath(os.path.dirname(__file__)) # tkinter.messagebox.showinfo('簡易プロットプログラムです','どのフォルダのcsvでグラフを作る?') ...
kobashin/GHz-ultrasonic
easy_plot.py
easy_plot.py
py
1,071
python
ja
code
1
github-code
6
38292113901
import cv2 from cv2 import dnn_superres # Create an SR object sr = dnn_superres.DnnSuperResImpl_create() # Read image image = cv2.imread('2.jpg') # ##########Read the desired model #path = "./models/EDSR_x3.pb" path = "./models/LapSRN_x2.pb" sr.readModel(path) # Set the desired model and scale to get correct pre- a...
Hsoleimanii/SuperResolution
super.py
super.py
py
1,013
python
en
code
1
github-code
6
42411313589
# -*- coding: utf-8 -*- # # File: BPDOrganizacion.py # # Copyright (c) 2011 by Conselleria de Infraestructuras y Transporte de la # Generalidad Valenciana # # GNU General Public License (GPL) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Publi...
carrascoMDD/gvSIG-bpd
gvSIGbpd/BPDOrganizacion.py
BPDOrganizacion.py
py
20,894
python
en
code
0
github-code
6
38840281994
from django.shortcuts import render, get_object_or_404, redirect, HttpResponse from django.contrib.auth.decorators import login_required from account.models import User from product.models import Product from .models import Message, MessageRoom @login_required def check_message_room(request, product_id): product ...
bishwopr/creative-poultry
messaging/views.py
views.py
py
2,261
python
en
code
0
github-code
6
9642919839
from tkinter import * from tkinter import messagebox as mbox import socket win=Tk() win.title(' CLIENT ') win.configure(bg='#BC8F8F') win.geometry('320x500') typemsg=Listbox(win,height=25,width=45) typemsg.place(x=10,y=15) udpsocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) ...
vaibhav477/TCP_chat_app
Socket_Programming_GUI/client.py
client.py
py
1,112
python
en
code
0
github-code
6
4822221945
# python 3.6.6 # 0 0 0 ------> no elements selected (0) # 0 0 1 ------> only "c" element has been selected (1) # 0 1 0 ------> only "b" element has been selected (2) # 0 1 1 ------> only "b" and "c" element has been selected (3) # 1 0 0 ------> similarly (4) # 1 0 1 ------> (5) # 1 1 0 ------> (6) # 1 1 1 ------> (7) ...
p039/python
6.00x/optimization-01-knapsack-problem/power_set.py
power_set.py
py
1,147
python
en
code
0
github-code
6
10694085688
def pomekons_battle(bonus: int, player1_pokemons_attack: list[int], player2_pokemons_attack: list[int]) -> str: [player1_ai, player1_di, player1_li] = player1_pokemons_attack [player2_ai, player2_di, player2_li] = player2_pokemons_attack player1_attack: float = (player1_ai + player1_di) / 2.0 player2_at...
pdaambrosio/python_uri
Unknow/uri2221.py
uri2221.py
py
1,049
python
en
code
0
github-code
6
45356075426
import numpy as np from PyQt5.QtCore import QSize from PyQt5.QtGui import QIcon, QColor from PyQt5.QtWidgets import QListWidgetItem, QPushButton from LGEprocess.flags_LGE import * from skimage import exposure, img_as_float import torch.utils.data as Datas from LGEprocess import Network as Network import nibabel as nib ...
JefferyCYH/pyqt_medical
LGEprocess/listWidgetItems_LGE.py
listWidgetItems_LGE.py
py
6,988
python
en
code
0
github-code
6
44248042853
import cv2 import numpy as np import glob import uuid import caffe import skimage.io from util import histogram_equalization from scipy.ndimage import zoom from skimage.transform import resize import random import cv2 import numpy as np from matplotlib import pyplot as plt import dlib from project_face import frontaliz...
juanzdev/TeethClassifierCNN
src/mouth_detector_opencv.py
mouth_detector_opencv.py
py
3,870
python
en
code
3
github-code
6
27082622973
from fastapi import APIRouter, Depends, HTTPException from ...celery.tasks import ExcelParser from ..crud.dishes_crud import DishesCrud from ..crud.menu_crud import MenuCrud from ..crud.submenu_crud import SubmenuCrud parser_router = APIRouter(prefix='/parser', tags=['Parser']) @parser_router.post('/parse-excel') a...
puplishe/testproject
fastapi1/api/routes/excel_router.py
excel_router.py
py
756
python
en
code
0
github-code
6
2075941699
import pandas as pd from datetime import datetime import os def get_csv(source): try: df = pd.read_csv('data/' + source + '.csv') except (OSError, IOError) as e: df = pd.DataFrame() print(e) return df; def get_status(source_name): return ''; def set_status(source_name, status)...
shodnebo/datafetch
csv_helper.py
csv_helper.py
py
1,729
python
en
code
0
github-code
6
72607237949
''' Created on 22 Jul 2018 @author: Paulo ''' from random import sample import pprint class MinesweeperLogic(object): """classdocs""" def __init__(self, rowSize, columnSize, numberMines): ''' Constructor ''' self.NewGame(rowSize, columnSize, numberMines) ...
fonsecapaulo/wxpython_minesweeper
minesweeper/minesweeper_logic.py
minesweeper_logic.py
py
5,407
python
en
code
0
github-code
6
70488599227
# 5. 2520 - самое маленькое число, которое делится без остатка на все числа от 1 до 10. # Какое самое маленькое число делится нацело на все числа от 1 до 20? from Python_introduction.HWSem2.AddTask4 import get_primes # import of the method from another task solved def min_number(n): """ :param n: max_number...
LocusLontrime/Python
Python_introduction/HWSem2/AddTask5.py
AddTask5.py
py
2,480
python
en
code
1
github-code
6
7590990457
class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ if len(nums) in [0, 1]: return nums nonzeroCount = 0 for element in nums: if element != 0: n...
kashyapchaganti/Leetcode-Solutions
0283-move-zeroes/0283-move-zeroes.py
0283-move-zeroes.py
py
976
python
en
code
0
github-code
6
8310320668
from stevedore import extension class Extensions: """Lazy singleton container for stevedore extensions. Loads each namespace when requested for the first time. """ _managers = {} def __init__(self): raise NotImplementedError() @classmethod def get(cls, namespace, name): ...
dwtcourses/SHARE
share/util/extensions.py
extensions.py
py
658
python
en
code
null
github-code
6
72784213307
# https://www.codewars.com/kata/58ad388555bf4c80e800001e def cut_the_ropes(arr): res = [len(arr)] for i in arr: m = min(arr) arr = [x - m for x in arr if x > m] rem = len(arr) - arr.count(0) if rem == 0: return res res.append(rem)
blzzua/codewars
6-kyu/simple_fun_160_cut_the_ropes.py
simple_fun_160_cut_the_ropes.py
py
292
python
en
code
0
github-code
6
21725716579
#program to verify mobile number using regex import re # \w [a-zA-Z0-9] #\W [^a-zA-Z0-9] phn = "412-555a-1212" if(re.search("\d{3}-\d{3}-d{4}", phn)): print("It is a phone number") else: print("Invalid phone number")
ItsSamarth/ds-python
regexToVerifyMobile.py
regexToVerifyMobile.py
py
229
python
en
code
0
github-code
6
40650003765
import re import requests from selenium import webdriver from xvfbwrapper import Xvfb from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.common ...
Foxonn/ytgrabber
ytgrabber.py
ytgrabber.py
py
3,726
python
ru
code
0
github-code
6
7129738963
#!/usr/bin/env python import pandas as pd from collections import defaultdict import argparse def bowtie2bed(fn, fo): """ From a bowtie output (tsv, NOT sam) file, return a BED file. :param fn: string name of bowtie default output tsv file :param fo: string name of bedfile output to...
YeoLab/chim-eCLIP
bin/bowtie2bed.py
bowtie2bed.py
py
1,281
python
en
code
1
github-code
6
12919232280
import datetime categories = ['INACTIVE', 'WEB', 'AUDIO', 'VIDEO', 'GAMING'] inp = raw_input("Clear? Y/N\n") if inp in ["y", "Y"]: with open('log.txt', 'w') as f: f.write("") while True: for i, c in enumerate(categories): print("{}: {}".format(i, c)) cat = raw_input() print("\n") time = date...
noise-lab/ml-networking
activities/lib/interative_log.py
interative_log.py
py
420
python
en
code
8
github-code
6
21204997139
# -*- coding: utf-8 -*- """ This is a prototype script. """ import numpy as np from PIL import Image from PIL import ImageEnhance from scipy.ndimage import gaussian_filter import cv2 from skimage import io as ip frame_rate = 24 #output frame rate vidcap = cv2.VideoCapture('video9.mov') success,image...
PindareTech/video-modding-script
editing_script.py
editing_script.py
py
3,414
python
en
code
0
github-code
6
19579927717
from pymongo import MongoClient from flask import Flask, jsonify from flask_cors import CORS app = Flask(__name__) CORS(app) @app.route("/") def hello(): new_list = [] client = MongoClient() db = client.variables variables = db.variables cursor = variables.find({}) # print(variables) for ...
OlzyInnovation/DaveBot_Forex
server.py
server.py
py
2,308
python
en
code
0
github-code
6
23184643387
#!/usr/bin/env python3 #encoding: UTF-8 # To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. import numpy as np import matplotlib.pyplot as plt import math import TrashCan.Mathieson as mat import ...
grasseau/MCHClustering
src/PyTests/spline_t.py
spline_t.py
py
7,607
python
en
code
0
github-code
6
3660394854
import sqlite3 conn=sqlite3.connect("Stationary_inventt.db") c = conn.cursor() print(" database successful") #using drop table to avoid duplicate copy c.execute("DROP TABLE IF EXISTS Stationery_stock") c.execute(""" CREATE TABLE Stationery_stock( ITEM_ID INTEGER, ITEMS TEXT, COST_PRICE INTEGER, QUANTITY_IN_STOCK INTEG...
debbytech22/module-5-solutions
Lesson_3_solution.py
Lesson_3_solution.py
py
1,271
python
en
code
0
github-code
6