seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
25585522305
import os import requests import re import yaml from packaging import version # Update the avalanchego_vms_list variable in roles/node/vars # with new VM versions available and their compatibility with AvalancheGo GITHUB_RAW_URL = 'https://raw.githubusercontent.com' GITHUB_API_URL = 'https://api.github.com' VARS_YAM...
AshAvalanche/ansible-avalanche-collection
scripts/update_vm_versions.py
update_vm_versions.py
py
2,832
python
en
code
10
github-code
6
28923395310
from enums import PositionX, PositionY from constants import AmmoIndicator as Properties from functions import get_surface from models.GameObject import PositionalGameObject import pygame as pg class AmmoIndicator(PositionalGameObject): GROUP_NAME = 'ammo_indicator' def __init__(self, scene, *groups, positio...
Thavin2147483648/shoot_platform
objects/AmmoIndicator.py
AmmoIndicator.py
py
1,946
python
en
code
0
github-code
6
38633504444
def tetration(value, tetronent): """ >>> print(tetration(3,3)) # 3 ** 3 ** 3, or 3^(3^3) 7625597484987 """ if tetronent == 1: return value else: return value ** tetration(value, tetronent-1) number = int(input('Number: ')) tetronent_value = int(input('Tetronent: ')) print(tetrat...
mthezeng/hello-world
tetration.py
tetration.py
py
350
python
en
code
0
github-code
6
37970241909
import cv2 import numpy as np #frame = np.full((360, 480, 3), 0, dtype=int) frame = cv2.imread("/home/pi/Pictures/2020-07-20_1439.jpg") cv2.imshow("Frame", frame) while True: key = cv2.waitKey(1) if key != -1: print("Key", key) if key == ord("q"): # up key break
webbhm/FlaskExperiment
python/test_key.py
test_key.py
py
295
python
en
code
0
github-code
6
19773599717
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- """ Runs IBIES gui """ from __future__ import absolute_import, division, print_function import multiprocessing import utool as ut import ibeis # NOQA import sys CMD = ut.get_argflag('--cmd') # For Pyinstaller #from ibeis.all_imports import * # NOQA def dependencie...
smenon8/ibeis
ibeis/__main__.py
__main__.py
py
5,256
python
en
code
null
github-code
6
72474544829
import sys import cwiid from onewii import oneWii class WiimoteControl: def __init__(self, newWiimote, wid, wnum ): self.wiimote = newWiimote self.wiimote.led = wnum self.wid = wid self.setupDataRead() self.cal = max( self.wiimote.get_acc_cal(cwiid.EXT_NONE) ) self.eventdetector = oneWii() def __del__...
cloew/WiiCanDoIt-Framework
src/ProtocolGame/wiis/wiireader.py
wiireader.py
py
1,008
python
en
code
2
github-code
6
32124013729
import os from gpt_interaction import process_content_with_gpt from web_scraping import scrape_web_content from utils import read_file, convert_pdf_to_text, convert_docx_to_text, convert_excel_to_csv def process_files(input_dir, tmp_dir, output_dir): for root, dirs, files in os.walk(input_dir): for file i...
vontainment/v-openai-data2json
file_handling.py
file_handling.py
py
1,643
python
en
code
0
github-code
6
6757765764
from django.shortcuts import render import subprocess def index(request): if request.method == "POST": link = request.POST["link"] cont = request.POST["cont"] # Baixa o torrent subprocess.run(["transmission-cli", "-w", "./", link]) # Converte arquivos para MP4 subp...
SrTristeSad/Download-torrent
views.py
views.py
py
1,169
python
vi
code
0
github-code
6
12177475498
from django.urls import path from . import views urlpatterns = [ path('', views.homepage, name='home'), path('id<int:id>', views.profile, name='profile'), path('friends<int:user_id>', views.FriendsView.as_view(), name='friends'), path('edit', views.edit_profile, name='edit_profile'), path('friendship_request/<in...
synchro123/LetsTalk
social/apps/main/urls.py
urls.py
py
2,226
python
en
code
0
github-code
6
11844491154
#!/usr/bin/python3 #======================exec.py=====================# #---------------------Encodage---------------------# # -*- coding: utf-8 -*- #--------------------------------------------------# #---------------------Imports----------------------# import sys #--------------------------------------------...
Darius1325/Project_compil
src/erreur.py
erreur.py
py
6,261
python
fr
code
null
github-code
6
39784628011
from unittest.mock import Mock import pytest from juju.action import Action from juju_verify.utils.action import data_from_action @pytest.mark.parametrize( "data, key, exp_value", [ ({"results": {"host": "compute.0", "test": "test"}}, "host", "compute.0"), ({"results": {"test": "test"}}, "ho...
canonical/juju-verify
tests/unit/utils/test_action.py
test_action.py
py
746
python
en
code
2
github-code
6
32094636352
T = int(input()) # 테스트 케이스 수 print(T) for t in range(1, T+1): N = int(input()) # 입력 줄 수 print(N) for s in range(1, N+1): numbers = list(map(int,input().split())) for i in numbers: print(i, end=' ') print('')
doll2gom/TIL
KDT/week3/01.11/practice/06.py
06.py
py
277
python
ko
code
2
github-code
6
3126066655
from unittest import TestCase from player import Player from item import Item from direction import Direction from location import Location from game import Game class TestPlayer(TestCase): def setUp(self): self.north = Direction('north') self.south = Direction('south') self.west = Direct...
ccastiglione/adventure
test_player.py
test_player.py
py
3,437
python
en
code
0
github-code
6
12811416970
# plus, minus, multiply, divide import operator d = { 'plus': operator.add, 'minus': operator.sub, 'multiply': operator.mul, 'divide': operator.truediv } inp = input().strip().split(' ') res = d[inp[1]](int(inp[0]), int(inp[2])) print(res)
sergeymong/Python
Stepik Python tasks/Math interp.py
Math interp.py
py
285
python
en
code
0
github-code
6
5061101951
from ctypes import c_int, create_string_buffer import json import platform if platform.system() == "Linux" : from ctypes import cdll else : from ctypes import windll ID_TIPO_COMPROBANTE_TIQUET = c_int( 1 ).value # "83" Tique ID_TIPO_COMPROBANTE_TIQUE_FACTURA = c_int( 2 ).value # "81"...
martin-ramos/epsonfiscalproxy
epsonproxy.py
epsonproxy.py
py
21,977
python
es
code
0
github-code
6
21681869620
from datetime import date from time import sleep ano=int(input('Que ano quer analisar? Colo que 0 para analisar o ano atual:')) print('Processando...') sleep(2) ################################################################################### if(ano==0): ano=date.today().year if((ano % 4 == 0) and (ano % 100 != 0...
VitorFidelis/Exercicios-Python
Desafio032.py
Desafio032.py
py
448
python
gl
code
2
github-code
6
72532883389
""" Multi-scale rabbit cardiac electrophysiology models Rabbit Soltis-Saucerman model with full b-AR signalling (Rabbit SS 1D cardiac) $ cd examples $ make install-ci $ make .env SEE https://sparc.science/datasets/4?type=dataset """ import os import sys import time from pathlib import Path from time import sleep f...
ITISFoundation/osparc-simcore
tests/public-api/examples/rabbit_cardiac_ss1d.py
rabbit_cardiac_ss1d.py
py
4,184
python
en
code
35
github-code
6
73239039229
""" Program to check the given word is palindrome or not """ # check using reverse method # def is_palindrome(str1): # reverse_string = list(reversed(str1)) # if list(str1) == reverse_string: # return True # else: # return False def is_palindrome(str1): """ Function to check palin...
danny237/Python-Assignment2
palindrome.py
palindrome.py
py
883
python
en
code
0
github-code
6
3013315354
import time import platform import cpuinfo os_version = platform.system() print('CPU: ' + cpuinfo.get_cpu_info().get('brand_raw', "Unknown")) print('Arch: ' + cpuinfo.get_cpu_info().get('arch_string_raw', "Unknown")) print(f'OS: {str(os_version)}') print('\nBenchmarking: \n') start_benchmark = 10000 # change this ...
LopeKinz/raspberry_debug
test.py
test.py
py
1,056
python
en
code
0
github-code
6
70097358589
import random class Move: def __init__(self, name, owner, damage, chance, pp): self.owner = owner self.name = name self.damage = damage self.chance = chance self.pp = pp def attack(self, consolemon): if random.randint(0, 100) < self.chance and self.pp <= 1: ...
IanTheBean/Consolemon
src/classes/moves.py
moves.py
py
588
python
en
code
0
github-code
6
39688256184
# LC Contest 170 # Time: O(n+m), n=len(arr), m= len(queries) # Space: O(n), O(1) excluding output class Solution: def xorQueries(self, arr: List[int], queries: List[List[int]]) -> List[int]: cum_arr = [0] for i in range(len(arr)): cum_arr.append(cum_arr[i]^arr[i]) # print(cum...
cmattey/leetcode_problems
Python/lc_1310_xor_queries_subarray.py
lc_1310_xor_queries_subarray.py
py
448
python
en
code
4
github-code
6
21836856619
import sys sys.stdin = open("../inputdata/swea_5189.txt", "r") def addEnergy(start, d, total): if d == n-1: total += energies[start][0] res_list.append(total) else: for i in range(1, n): if not visited[i]: total += energies[start][i] visited[...
liza0525/algorithm-study
SWEA/swea_5189.py
swea_5189.py
py
680
python
en
code
0
github-code
6
30367005261
from traits.api import Any, Enum, Int, Property, Union from enable.api import NativeScrollBar from .chaco_traits import Optional class PlotScrollBar(NativeScrollBar): """ A ScrollBar that can be wired up to anything with an xrange or yrange and which can be attached to a plot container. """ # T...
enthought/chaco
chaco/plotscrollbar.py
plotscrollbar.py
py
8,287
python
en
code
286
github-code
6
25090333654
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, zSize=10): super(Model, self).__init__() self.zSize = zSize def create(self, opts): self.scale_factor = 8 / (512 / opts.imsize) self.nLatentDims = opts.nLatentDims ...
TylerJost/learnPytorch
autoencoders/aaeGaudenz.py
aaeGaudenz.py
py
3,140
python
en
code
0
github-code
6
71366123387
#!/usr/bin/env python #-*-coding: utf-8 -*- import numpy as np import numpy.linalg as LA import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt def plot_regret(rewards, bestRewards, label, filename): sumRewards = np.cumsum(rewards) sumBestRewards = np.cumsum(bestRewards) regret = (s...
jeppe/Adaptive-Social-Search
linucb/plot_utils.py
plot_utils.py
py
1,894
python
en
code
1
github-code
6
15796410510
"""Евлампия не смогла разобраться с рекурсией! Напишите реализацию алгоритма определения факториала числа с использованием цикла. Формат ввода На вход подается n - целое число в диапазоне от 0 до 22 Формат вывода Нужно вывести число - факториал для n Пример Ввод 3 Вывод 2 """ def fact(number): multiplication = 1...
Ilia-Abrosimov/Algorithms-and-data-structures
4. Recursion/F.py
F.py
py
723
python
ru
code
0
github-code
6
31539804976
from Infrastructura.repos import RepoClienti, RepoFilme, RepoInchirieri from Domain.entitati import Film, Client, Inchiriere from Business.services import ServiceFilme, ServiceClienti, ServiceInchirieri from Validare.validatoare import ValidFilme, ValidClienti, ValidInchirieri from Exceptii.exceptii import ValidErr...
CombatFrog/facultate
FP/InchirieriFilme/Teste/teste.py
teste.py
py
10,764
python
en
code
0
github-code
6
72453729787
from django.conf.urls.defaults import * from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^lsdesign/', include('lsdesign.foo.urls')), url(r'^$', 'django.views.generic...
cyndi/lacey-springs-designs
lsdesign/urls.py
urls.py
py
955
python
en
code
2
github-code
6
20175364599
from decimal import Decimal from django.conf import settings from django.urls import reverse from django.shortcuts import render, get_object_or_404 from core.models import Player, Developer, Payment, Order from django.views.decorators.csrf import csrf_exempt from hashlib import md5 from payments.forms import PaymentFor...
vaarnaa/TheBestGameStore
payments/views.py
views.py
py
4,464
python
en
code
0
github-code
6
1622240991
""" This file contains functions for micro table construction and encoding """ import unicodedata import numpy as np from pattern.text.en import tokenize '''determine the type of a column: string (return False), number (return True)''' def Is_Number_Col(col_cells): threshold = 0.7 num_cell, non_empty = 0, 0 ...
alan-turing-institute/SemAIDA
IJCAI19/SemColHNN_Codes/util/util_micro_table.py
util_micro_table.py
py
7,240
python
en
code
37
github-code
6
71781169789
# Calculate FPS (Frames per second) import cv2 from timeit import default_timer as timer camera = cv2.VideoCapture(0) frame_count = 0 total_time = 0 while camera.isOpened(): start_time = timer() _, frame = camera.read() frame_count += 1 elapsed_time = timer() - start_time total_time += elapsed_ti...
yptheangel/opencv-starter-pack
python/basic/calculate_FPS.py
calculate_FPS.py
py
596
python
en
code
8
github-code
6
9920081347
from django.urls import path from . import views urlpatterns = [ path("", views.index, name="index"), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("register", views.register, name="register"), path("new_listing", views.new_listing, name="new...
SaraRayne/Commerce
commerce/auctions/urls.py
urls.py
py
862
python
en
code
0
github-code
6
36480780883
from models.db import db # from models.role import Role class Feedback(db.Model): id = db.Column(db.Integer, primary_key=True) author_id = db.Column(db.Integer, db.ForeignKey('role.id')) publication_id = db.Column(db.Integer, db.ForeignKey('publication.id')) feedback = db.Column(db.Text, nullable=Fals...
doigl/publicationWorkflow
models/feedback.py
feedback.py
py
1,299
python
en
code
0
github-code
6
3848256387
class PyIfElse: # If is odd, print Weird # If is even and in the inclusive range of 2 to 5, print Not Weird # If is even and in the inclusive range of 6 to 20, print Weird # If is even and greater than 20, print Not Weird def __call__(self, number): if number < 1 or number > 100: ...
pedroinc/hackerhank
problems/pyifelse.py
pyifelse.py
py
742
python
en
code
0
github-code
6
2061507228
from sklearn.preprocessing import OneHotEncoder import numpy as np class CategoricalEncoder: """ if scikit >= 0.20, better use scikit's version instead of this class """ def __init__(self, dense=True): assert dense, "only dense output is supported" def fit(self, X): self._str_to_int = {} ...
rom1mouret/cheatmeal
benchmarks/preproc/categorical_encoder.py
categorical_encoder.py
py
1,011
python
en
code
2
github-code
6
11812216467
from typing import Optional import torch import torch.nn as nn class JaccardLoss(nn.Module): """JaccardLoss optimize mIoU score directly. Args: num_classes (int): A number of unique classes. ignore_index (Optional[int]): Class label to ignore calculating score. eps (float): Used to pr...
yutayamazaki/semantic-segmentation-pytorch
src/losses/jaccard.py
jaccard.py
py
1,507
python
en
code
1
github-code
6
6550444728
import RPi.GPIO as GPIO from time import sleep from API_PostReqs_for_pi import * from API_PostReqs_for_PC import POST_LED_URL from internetinfo import * #GPIO setup GPIO.setmode(GPIO.BCM) LED_ZERO = 19 LED_ONE = 18 LED_TWO = 17 LED_THREE = 16 LED_FOUR = 13 LED_LIST = [LED_ZERO, LED_ONE, LED_TWO, LED_THREE, LED_FOUR] ...
TemplarOfSomething/3D-Minesweeper
GPIO_logic_for_pi.py
GPIO_logic_for_pi.py
py
3,102
python
en
code
0
github-code
6
41858747198
############################################################################################# # Altere o programa de cálculo dos números primos, informando, caso o número não seja # # primo, por quais número ele é divisível. # ######################################...
nralex/Python
3-EstruturaDeRepeticao/exercício22.py
exercício22.py
py
852
python
pt
code
0
github-code
6
5053626556
EXACT = 'yes' EQUIVALENT = 'yes_m' # e.g. yes_modified NO_MATCH = 'no' NULL_SET = frozenset(['NULL','null','', '-', 'p.?', None]) SYN_ALIAS_SET = frozenset(['p.(=)', 'p.=']) COSMIC_NULL = 'p.?' NON_CODING = '-' NULL ...
personalis/hgvslib
hgvslib/constants.py
constants.py
py
2,734
python
en
code
18
github-code
6
21812506780
import re from src.plot_attention import plot_attention from src.evaluate import evaluate def translate(sentence, init_dict): result, sentence, attention_plot = evaluate(sentence, init_dict) print('Input: %s' % (sentence)) print('Predicted translation: {}'.format(result)) result = re.sub('<end>', '...
sksos7/Kor_to_En_translator
src/translate.py
translate.py
py
532
python
en
code
0
github-code
6
14351509220
import mercantile def get_blank_feature_json(lat, lon): ft_dict = {"type": "Feature"} geom_dict = {"type": "Point", "coordinates": [lon, lat]} ft_dict["geometry"] = geom_dict return ft_dict # GET QUADHASH TILE OF A GIVEN COORDINATE def get_quad_tile(lat, lon, precision): ret = mercantile.tile(l...
InsertCoolNameHere/Quby
geo_utils/quadtile_utils.py
quadtile_utils.py
py
2,812
python
en
code
0
github-code
6
17772360699
import streamlit as st import pandas as pd import numpy as np import psycopg2 from streamlit_option_menu import option_menu #------- PAGE SETTINGS------------ page_title = "GHG Emission Calculator" Page_icon = "🌳" layout = "centered" #----------------------------------- st.set_page_config(page_title=page_tit...
sforson14/Data
myfile.py
myfile.py
py
3,457
python
en
code
0
github-code
6
40466717976
import sys from collections import deque input = sys.stdin.readline graph = [] for i in range(8): graph.append(list(input().rstrip())) answer = 0 def bfs(): direction = [[0,0],[0,-1],[0,1],[-1,0],[1,0],[-1,-1],[1,-1],[1,1],[-1,1]] visited = [[0] * 8 for _ in range(8)] dq = deque([7,0,0])
Cho-El/coding-test-practice
백준 문제/BFS/16954_움직이는 미로 탈출.py
16954_움직이는 미로 탈출.py
py
311
python
en
code
0
github-code
6
71889266427
import json import sys max_buy = float('-inf') min_sell = float('inf') for line in sys.stdin: rec = json.loads(line.strip()) if 'price' not in rec: continue if rec['side'] == 'sell': min_sell = min(min_sell, float(rec['price'])) else: max_buy = max(max_buy, float(rec['price']))...
fivetentaylor/intro_to_programming
coinbase/format_wss_feed.py
format_wss_feed.py
py
383
python
en
code
0
github-code
6
72592445948
import yaml from .defaults import METADETECT_CONFIG def load_config(config_path): """Load a config file and return it. Parameters ---------- config_path : str, optional The path to the config file. Returns ------- sim_config : dict A dictionary of the sim config options....
beckermr/metadetect-coadding-sims
coadd_mdetsims/config.py
config.py
py
1,186
python
en
code
0
github-code
6
32156253381
import hashlib from collections import OrderedDict post_data = { 'shop_id': 'D0F98E7D7742609DC508D86BB7500914', 'amount': 100, 'order_id': '123', 'payment_system': 16, 'currency': 'RUB', 'sign': 'e13cd755e9b4632d51ae4d5c74c2f122', } secret = 'GB%^&*YJni677' request_sign = post_data['sign'] ...
Dmitrii-Kopeikin/tegro-docs-python-examples
python_examples/payments/payment_notification.py
payment_notification.py
py
578
python
en
code
1
github-code
6
15042871617
import RPi.GPIO as GPIO import sys import time # When calling the function: # Let 1 indicate the block is in the set # 2 indicate the block is not in the set def inSet( clr ): "This function will flash a green or red light if the block is or is not in the set respectively" GPIO.setmode(GPIO.BC...
Amanda9m/Lego-Sorter
source/driver/LED.py
LED.py
py
1,102
python
en
code
3
github-code
6
14706890571
#!/usr/bin/env python # coding: utf-8 import requests import pymongo import pandas as pd from splinter import Browser from bs4 import BeautifulSoup import time # #### Open chrome driver # open chrome driver browser def init_browser(): executable_path = {'executable_path': 'chromedriver'} return Browser(...
lisaweinst/web-scraping-challenge
scrape_mars.py
scrape_mars.py
py
6,535
python
en
code
0
github-code
6
4491664030
def colored(r, g, b, text): return "\033[38;2;{};{};{}m{}\033[38;2;255;255;255m".format(r, g, b, text) class ProgressCounter: def __init__( self, string: str, max_count: int, precision_digits: int = 2, flush: bool = True ): """ ...
ubdussamad/kptemp
utils.py
utils.py
py
4,022
python
en
code
0
github-code
6
17510610363
def decodeVariations(s: str) -> int: def validate(lo, hi): if lo == -1: return True return 1 <= int(s[lo:hi+1]) <= 26 def decode(lo, hi, tracker, res): if lo == n: ress.append(list(res)) return bool(tracker) count = 0 res.appe...
soji-omiwade/cs
dsa/pramp/decode_variations.py
decode_variations.py
py
2,798
python
en
code
0
github-code
6
42495755382
#First attempt to connect to ethereum mainnet via Infura API import json import web3 from web3 import Web3, HTTPProvider try: w3 = Web3(Web3.HTTPProvider("https://mainnet.infura.io/dPotOByPqLlLN3nx14Pq")) print('w3 HTTPProvider call success') except: print('w3 HTTPProvider call failure') block = w3.eth.getBlock...
KedarJo/ethScan
ethHello.py
ethHello.py
py
1,494
python
en
code
0
github-code
6
18453482266
# Time complexity is O(log n) import random def round_down(value, decimals): factor = 1 / (10 ** decimals) return (value // factor) * factor def binary_search_recursive(nums, target): start_pos = 0 end_pos = len(nums) middle_pos = int((start_pos+end_pos)/2) if start_pos >= end_pos: ...
beharamadhu270405/python-DS
Searching/binary-search.py
binary-search.py
py
2,898
python
en
code
0
github-code
6
648194677
import numpy as np from ._segmentation import compute_mws_clustering, MWSGridGraph from ..affinities import compute_affinities_with_lut # TODO support a data backend like zarr etc. class InteractiveMWS(): def __init__(self, affinities, offsets, n_attractive_channels=None, strides=None, randomize_...
constantinpape/affogato
src/python/module/affogato/segmentation/interactive_mws.py
interactive_mws.py
py
6,247
python
en
code
9
github-code
6
30323152947
import numpy as np import pandas as pd def calculate_rank_probability(df): """ 1着確率を元に、2着と3着の確率を計算する 計算方法にはベンターが提唱する計算式を使用する Parameters ---------- df : pandas.DataFrame レースごとの1着確率を保持しているデータフレーム。 Returns ------- df : pandas.DataFrame レースごとに1着 / 2着 / 3着確率を計算したデータフレー...
keimii/horse-racing-tools
src/probability_calculation.py
probability_calculation.py
py
3,269
python
ja
code
0
github-code
6
655272067
import os import napari import z5py def view_result(sample, checkpoint_name): halo = [25, 512, 512] path = f'./data/{sample}.n5' with z5py.File(path, 'r') as f: ds = f['raw'] bb = tuple(slice(max(sh // 2 - ha, 0), min(sh // 2 + ha, sh)) for sh, ...
constantinpape/torch-em
experiments/unet-segmentation/mitochondria-segmentation/mito-em/challenge/check_result.py
check_result.py
py
2,239
python
en
code
42
github-code
6
38961213741
import functools class Person: def __init__(self,Eid,Ename,Desig,sal): self.Eid=Eid self.Ename=Ename self.Desig=Desig self.sal=int(sal) def PrintValues(self): print("Emp Id",self.Eid) print("Emp name",self.Ename) print("Emp Degnation",self.Desig) p...
Aswin2289/LuminarPython
LuminarPythonPrograms/Oops/empSalReduce.py
empSalReduce.py
py
945
python
en
code
0
github-code
6
17319926912
#!usr/bin/python #split the sequence sequence = open("AJ223353.fasta") sequence = sequence.read().replace("\n","") coding = sequence[28:409] nocoding = sequence[0:28]+sequence[409:] seq_local = open("plain_genomic_seq.txt").read().rstrip().upper() print(sequence) print(seq_local) seq_localdna = seq_local.replace("X"...
DHS123456/exercise
Lecture11/excercise.py
excercise.py
py
1,043
python
en
code
0
github-code
6
17335569332
import pygame import math import random class Bullet(): def __init__(self, health, direction, start, colour, rRange): self.dims: tuple((int, int)) = (20, 20) self.sprite = pygame.Surface((20, 20)) self.sprite.fill(colour) self.sprite.set_colorkey(colour) self.x, self.y = s...
andrewchu16/untitledproject
src/bullet.py
bullet.py
py
1,225
python
en
code
4
github-code
6
21990463619
from flask import Flask, g, render_template,request,redirect,session,url_for,flash import sqlite3 app = Flask(__name__) app.config['SECRET_KEY'] = 'dev' db_path = input("Enter database path: ") # ============================================================================= # /Users/Eugen/Desktop/Final/blog.d...
EugenMorarescu/IS211_Final
Final/final_project.py
final_project.py
py
5,821
python
en
code
0
github-code
6
43464163341
from datetime import timezone import datetime import pytz from .send_mail_view import SendMailView from django.test import RequestFactory import pytest class TestSendMailView: # Test that sending an email with correct parameters returns a 200 OK response. def test_send_mail_with_correct_parameters(self)...
segpy/technical-tests
prote/drf-prote-test/apps/prote_test/views/test_send_mail_view.py
test_send_mail_view.py
py
2,162
python
en
code
0
github-code
6
3438652661
class Solution: def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: boxTypes.sort(key=lambda x:-x[1]) res = 0 count = 0 for [num_b, num_u] in boxTypes: if num_b + count < truckSize: count += num_b res += num_b...
cuiy0006/Algorithms
leetcode/1710. Maximum Units on a Truck.py
1710. Maximum Units on a Truck.py
py
448
python
en
code
0
github-code
6
36222363296
# -*- coding: utf-8 -*- import typing as T import polars as pl from ..importer import ( TsvGzReader, dataframe_to_list_table, ) from ..images import icon_by_portal, image_by_map from .go_cmd import with_teleport_command if T.TYPE_CHECKING: from rstobj import Image, ListTable def lt_list_main_city_gps_a...
MacHu-GWU/wotlkdoc-project
wotlkdoc/docs/gps/main_city.py
main_city.py
py
1,226
python
en
code
8
github-code
6
20066269029
import os import pandas as pd import properties from audio import audio_utils as au from files import file_utils as fu min_fragment_duration_ms = 400 def __build_syncmap_sentences(chapter_audio, chapter_syncmap): sentences = [] for fragment in chapter_syncmap['fragments']: start_time = float(fragme...
arnasRad/speech_dataset
export_dataset.py
export_dataset.py
py
3,322
python
en
code
0
github-code
6
4510033934
class Node : def __init__(self, data = None, next = None): self.data = data self.next = next class LinkedList : def __init__(self): self.head = None def insert_at_beginning(self,data): node = Node(data,self.head) self.head = node return def insert_at...
rajat1994/LeetCode-PythonSolns
Linked Lists/linked_list.py
linked_list.py
py
2,300
python
en
code
0
github-code
6
12503051509
class Card: suit_list = { "Spades", "Hearts", "Clubs", "Diamonds" } rank_list = { "Ace": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "Six": 6, "Seven": 7, "Eight": 8, "Nine": 9, "Ten": 10, ...
fowl-ow/Pythonjack
Card.py
Card.py
py
761
python
en
code
0
github-code
6
36517146950
# A brief description of the project # Date: 17AUG21 # CSC221 M1HW1 – Array Manipulations # Taylor J. Brown # Prompt the user with a menu that has five options. # 1) Create a 3-by-3 Array # 2) Display cube Values for elements in array # 3) Add 7 to every element and display result # 4) Multiply elements by 6...
TaylorBrown96/CSC-221
M1HW1_ArrayManipulation_TaylorBrown.py
M1HW1_ArrayManipulation_TaylorBrown.py
py
3,457
python
en
code
0
github-code
6
19121772365
from rest_framework import status from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.decorators import api_view, action from rest_framework import viewsets, permissions, status from django.http import Http404 from django.shortcuts import render from leaderboard.m...
alex-gmoca/spring
spring/leaderboard/views.py
views.py
py
2,128
python
en
code
0
github-code
6
42368009926
from django.contrib import admin from sign.models import Event, Guest # Register your models here. # EventAdmin类继承admin.ModelAdmin,admin.ModelAdmin类是一个自定义工具,能够自定义一些模块的特征 class EventAdmin(admin.ModelAdmin): # list_display:用于定义显示哪些字段,必须是Event类里定义的字段 list_display = ['id', 'name', 'status', 'address', 'start_time']...
nhan118/learn
guest/sign/admin.py
admin.py
py
786
python
en
code
0
github-code
6
355111105
"""Datasets RegressionDataGenerator, ClassificationDataGenerator2, ClassificationDataGenerator3, load_iris, load_mnist are implemented. """ import numpy as np import os,gzip class RegressionDataGenerator(): """RegressionDataGenerator Create 1-D toy data for regression """ def __init__(self,f)...
hedwig100/PRML
prml/utils/datasets.py
datasets.py
py
6,493
python
en
code
0
github-code
6
72788395069
import csv bidic = {} # bigram dictioary count = 0 with open('./gitignored_files/taiwanese_song_info.csv', 'r') as data: # with open('./gitignored_files/song_info.csv', 'r') as data: reader = csv.reader(data) song_dictionary = list(reader) with open('./gitignored_files/taiwanese_song_bigram.csv', 'w', newlin...
LonEdit120/testing_codes
bigram_test_01.py
bigram_test_01.py
py
1,050
python
en
code
0
github-code
6
14876640371
from django.db import models from django.utils.text import slugify class Pet(models.Model): MAX_LENGTH_NAME = 30 name = models.CharField( max_length=MAX_LENGTH_NAME, null=False, blank=False, ) personal_pet_photo = models.URLField( null=False, blank=False, ...
Ivo2291/petstagram
petstagram/pets/models.py
models.py
py
820
python
en
code
0
github-code
6
74190577788
from tkinter import Tk, Text #Text genera una pantalla de texto multilinea en otros lenguajes en un textarea root = Tk() root.geometry("250x200") root.resizable(False, False) root.title("Escribe aquí") text = Text(root, height=8) text.pack() #insert(linea donde queremos que se ubique el texto, texto) text.insert("1....
alex-claradelrey/ConversorDeDivisas
Ejemplos/Ejemplos Tkinter/Ejemplo7.py
Ejemplo7.py
py
372
python
es
code
0
github-code
6
41061137991
import numpy as np from src.core import Entity, Player PLAYER_COLOR = (31, 120, 10) # dark green class Ball(Entity): def __init__(self, env_width, env_height, position, radius, color, timestep): self.env_width = env_width self.env_height = env_height self.radius = radius sel...
ylajaaski/reinforcement_env
src/envs/collision_v1/entities.py
entities.py
py
2,605
python
en
code
0
github-code
6
15687075462
"""Module that contains reusable functions to interact with azure.""" import os import yaml import json import shutil from typing import Tuple, List, Dict, Union, Optional from azureml.core import Workspace, Model, Dataset, Datastore from azureml.core.compute import ComputeTarget, AmlCompute from azureml.core.compute_...
ReBatch-ML/AnswerSearch
packages/azureml_functions.py
azureml_functions.py
py
9,949
python
en
code
0
github-code
6
25006908635
from git import Repo from logging import info from pathlib import Path from platform import system from shutil import copyfile, rmtree from stat import S_IWRITE from subprocess import check_output, STDOUT, CalledProcessError from tempfile import TemporaryDirectory from twrpdtgen import current_path from twrpdtgen.utils...
DENE-dev/dene-dev
RQ1-data/exp2/969-lobo1978-coder@device-tree-generator-aab7df0a3c0246a5dbe524f1196bedc1b4c05e05/twrpdtgen/utils/aik_manager.py
aik_manager.py
py
4,787
python
en
code
0
github-code
6
8105420751
# coding=utf-8 import re import string def preprocessing_text(text): text = re.sub('\r', '', text) text = re.sub('\n', '', text) # 改行の削除 text = re.sub(' ', '', text) # 半角スペースの削除 text = re.sub(' ', '', text) # 全角スペースの削除 text = re.sub(r'[0-9 0−9]', '0', text) # 数字を全て0に return text def pr...
ys201810/pytorch_work
nlp/sentiment_analysis/script/preprocesser.py
preprocesser.py
py
1,373
python
ja
code
0
github-code
6
26889061222
""" Author: Roman Solovyev, IPPM RAS URL: https://github.com/ZFTurbo Code based on: https://github.com/fizyr/keras-retinanet/blob/master/keras_retinanet/utils/eval.py """ import os import numpy as np import pandas as pd # try: # import pyximport # pyximport.install(setup_args={"include_dirs": np.get_include()}...
inzapp/sbd
map_boxes/__init__.py
__init__.py
py
13,934
python
en
code
0
github-code
6
25958786704
from django.db import models from django.forms import ModelForm from django.utils import timezone class Author(models.Model): NATION_CHOICES = ( (None, 'Nationality'), ('CH', 'China'), ('US', 'America'), ('UK', 'England'), ('GE', 'German'), ('CA', 'Canada'), ) ...
binkesi/blogsgn
models.py
models.py
py
2,015
python
en
code
0
github-code
6
12689186127
import matplotlib.pyplot as plt import requests import numpy as np # Enter Spotify web API access token credentials below # If you don't have them you can get them here: # https://developer.spotify.com/dashboard/applications client_id = "YOUR_CLIENT_ID_HERE" client_secret = "YOUR_SECRET_ID_HERE" # The below code gen...
Oliver343/ArtistSearchAPI
ArtistSearch.py
ArtistSearch.py
py
3,149
python
en
code
0
github-code
6
8480767140
import random import os from shutil import copyfile from shutil import move import sys random.seed(667) def switchFiles(k, inc, out, a): """ k : k random samples inc : incoming image path, abs value (relative to current directory) out : outgoing image path, same as inc csv : name of csv file tha...
lweitkamp/ImageClassificationProject
getRandSample.py
getRandSample.py
py
1,409
python
en
code
0
github-code
6
71567893307
import re text = input() expression = r"(^|(?<=\s))-?([0]|[1-9][0-9]*)(.[0-9]+)?($|(?=\s))" # ^ - старт # | - или # \s - празно място # ? - провери # ?<=\s - разгледай преди това дали има нещо, тоест преди първият знак, има ли такъв символ там. # -? - 0 или един път, значи или има минус или, няма минус, проверка дали ...
lorindi/SoftUni-Software-Engineering
Programming-Fundamentals-with-Python/9.Regular Expressions/04_match_numbers.py
04_match_numbers.py
py
1,835
python
bg
code
3
github-code
6
3987332070
import random import numpy as np from decimal import Decimal def update_belief(belief, expectation, item_to_update, item_to_compare, teacher, item_preferred, reward_vals): ''' Update belief distribution over reward of specified item based on specified query and label Arguments: belief: ...
RachelFreedman/B_select
selection.py
selection.py
py
2,902
python
en
code
0
github-code
6
42749263557
#!/usr/bin/env python # coding=utf-8 # wujian@2018 import os import argparse import numpy as np from libs.utils import istft, get_logger from libs.opts import StftParser from libs.data_handler import SpectrogramReader, WaveWriter from libs.beamformer import DSBeamformer logger = get_logger(__name__) def run(args)...
Fuann/TENET
sptk/apply_ds_beamformer.py
apply_ds_beamformer.py
py
2,731
python
en
code
7
github-code
6
33504817634
from .models.user_tokens import UserTokens from .models.sources_enabled import SourcesEnabled from .searchers.constants import DEFAULT_PAGE_SIZE from .models.results import Results, SourceResult from .searchers import available_searchers from .decorators import immutable import logging from collections import defaultdi...
h4ck3rk3y/link
link/core.py
core.py
py
4,506
python
en
code
1
github-code
6
11295712377
from datetime import datetime import copy filename = "input/day20input.txt" file = open(filename, "r") file = file.readlines() data = [] points = [] for index, f in enumerate(file): if index == 0: lookup = f.replace('\n', '') elif f != '\n': data.append(f.replace('\n', '')) for yindex, y in ...
mykreeve/advent-of-code-2021
day20.py
day20.py
py
1,997
python
en
code
0
github-code
6
40407441083
import sqlite3 as sql def CreateDatabase(): coneccion = sql.connect("./Database/datos.db") coneccion.commit() coneccion.close() CreateInitialTables() print("Se ha creado la base de datos") def SendQuery(query): query = query coneccion = sql.connect("./Database/datos.db") cursor = conec...
Panconquesocl/LAS
Backend/DbUtils.py
DbUtils.py
py
1,566
python
es
code
0
github-code
6
41562701933
'''Singly linked list basics''' #### Big O complexity ### # - Insertion: O(1) # - Removal - it depends: O(1) or O(N) # - Searching: O(N) # - Access: O(N) ### Important! ##### # 1. Singly-list are excellent alternative to arrays when insertion and deletion # at the beginning are frequently required. # 2. Singly-li...
Wainercrb/data-structures
singly-linked-list/main.py
main.py
py
4,676
python
en
code
0
github-code
6
37710422808
from azure.cognitiveservices.vision.customvision.training import training_api from azure.cognitiveservices.vision.customvision.training.models import ImageUrlCreateEntry from azure.cognitiveservices.vision.customvision.prediction import prediction_endpoint from azure.cognitiveservices.vision.customvision.prediction.p...
Guptacos/tartanhacks2018
image_recognition.py
image_recognition.py
py
1,718
python
en
code
2
github-code
6
21011206894
import argparse import pandas as pd import cv2 import mediapipe as mp mp_pose = mp.solutions.pose from pose_embedder import FullBodyPoseEmbedder from pose_classifier import PoseClassifier import numpy as np classifiers = {} def run_classify(csv_path): # initialise Pose estimator for whole video pose = mp_pose.Pos...
insidedctm/pose_knn_classifier
classify.py
classify.py
py
2,471
python
en
code
0
github-code
6
70680774589
from django import forms from crispy_forms.helper import FormHelper from .models import Category from crispy_forms.layout import Submit, Layout, Div, HTML, Field class CategoryForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(CategoryForm, self).__init__(*args, **kwargs) self.helpe...
ifcassianasl/movie-list
category/forms.py
forms.py
py
965
python
en
code
0
github-code
6
40319564097
from ansible.module_utils.basic import AnsibleModule from ansible_collections.ansibleguy.opnsense.plugins.module_utils.base.handler import \ module_dependency_error, MODULE_EXCEPTIONS try: from ansible_collections.ansibleguy.opnsense.plugins.module_utils.helper.main import \ diff_remove_empty from...
ansibleguy/collection_opnsense
plugins/modules/_tmpl_direct.py
_tmpl_direct.py
py
3,679
python
en
code
158
github-code
6
20528489084
import pygame WIDTH = 600 HEIGHT = 700 class Start: def __init__(self): pygame.init() self.display = pygame.display.set_mode((WIDTH, HEIGHT)) self.background = pygame.Surface(self.display.get_size()).convert() self.words = pygame.Surface(self.display.get_size()).convert() s...
dlam15/Emoji-Memorize
Start.py
Start.py
py
2,930
python
en
code
0
github-code
6
40920706579
from django.urls import path from lanarce_portfolio.images.api.views import ImagesCreateListAPI, ImageUpdateDeleteAPI, CommentListAPI app_name = "images" urlpatterns = [ path( "", ImagesCreateListAPI.as_view(), name="images-create-list" ), path( "<uuid:image_id>/", ImageUpdateDeleteAPI.as...
Ari100telll/lanarce_portfolio
lanarce_portfolio/images/urls.py
urls.py
py
465
python
en
code
0
github-code
6
36697861075
import os # ---- TIMEOUT ---- # # The maximum number of subprocesses to run at any given time. max_processes = 5 # The maximum time any subprocess should run, in seconds, and an operation # to be performed when a timeout occurs. # Make sure this is >> than the individual test timeouts # (see pam.py and utils/defau...
ProjectAT/uam
pam/examples/config.py
config.py
py
1,921
python
en
code
4
github-code
6
3774639154
__author__ = 'shixk' import datetime from SearchFiles import SearchFiles class GetData(object): def loadfilterdata(self, query, conf): if query['method'] == "time": return self.filterbydate(query, conf) else: return {'ERROR': 'no method'} def filterbydate(self, query, ...
shinSG/SimplePictureService
HttpService/GetData.py
GetData.py
py
1,285
python
en
code
0
github-code
6
5001311387
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from .models import Question class AnswerFrom(forms.Form): content=forms.CharField(widget=forms.Textarea(attrs={'rows': 6}), label='Trả lời') ...
duonghau/hoidap
question/forms.py
forms.py
py
1,575
python
en
code
0
github-code
6
74668118906
from collections import Counter from itertools import product from operator import add def solve(lines, cycles, dimensions): board = set() for row, line in enumerate(lines): for col, elem in enumerate(line): if elem == '#': cell = dimensions * [0,] cell[0], c...
dionyziz/advent-of-code
2020/17/17.py
17.py
py
1,006
python
en
code
8
github-code
6
70943711868
from pytsbe.data.exploration import DataExplorer def explore_available_datasets(): """ Example of how to launch data exploration. For all datasets in data folder perform calculation of stationary and non-stationary time series and create visualisation of time series. """ explorer = DataExplore...
ITMO-NSS-team/pytsbe
examples/univariate_data_exploration.py
univariate_data_exploration.py
py
486
python
en
code
30
github-code
6
36481324263
def spin_words(sentence): """ Spin five of more letter word in given text. Takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed. Strings passed in will consist of only letters and spaces. Spaces will be included only when more than...
Djet78/Codewars_tasks
Python/kyu_6/stop_gninnips_my_sdrow.py
stop_gninnips_my_sdrow.py
py
743
python
en
code
0
github-code
6
10368918603
import asyncio import re from os import remove from pyUltroid.dB import DEVLIST try: from tabulate import tabulate except ImportError: tabulate = None from telethon import events from telethon.errors import MessageNotModifiedError from telethon.tl.functions.contacts import ( BlockRequest, GetBlockedRe...
TeamUltroid/Ultroid
plugins/pmpermit.py
pmpermit.py
py
29,216
python
en
code
2,615
github-code
6