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
18033055398
from zeep.client import Client import zeep settings = zeep.Settings(strict=False, xml_huge_tree=True) wsdl = 'http://localhost:7000/ws/EstudianteWebServices?wsdl' cliente = Client(wsdl) ListEstudiantes = cliente.service.getListaEstudiante() def consultar(matricula): Estudiante = cliente.service.getEstudiante(mat...
AndoRoman/Client-SOAP
Main.py
Main.py
py
1,574
python
es
code
0
github-code
1
70521367394
# -*- coding: utf-8 -*- """ A new file. """ import numpy as np from numba import jit, vectorize from utils import timeit from loops import loop1 @timeit def loop(m, n): s = 0 for i in range(1, m + 1): for j in range(1, n + 1): s += 1.0 / i + 1.0 / j return s @tim...
cmjdxy/fundamental-demos
study-parallel-computing/jit_vs_vec.py
jit_vs_vec.py
py
983
python
en
code
0
github-code
1
30298059185
class Nellix2ssdf: def __init__(self,dicom_basedir,ptcode,ctcode,basedir): import imageio #import easygui from stentseg.utils.datahandling import loadvol from stentseg.utils.datahandling import savecropvols, saveaveraged ## Select ...
almarklein/stentseg
nellix/nellix2ssdf.py
nellix2ssdf.py
py
5,174
python
en
code
3
github-code
1
73152580515
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime from math import sin, cos, sqrt, atan2, radians from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from django.core.files.storage im...
donlafranchi/gfcmap
general/views.py
views.py
py
5,156
python
en
code
0
github-code
1
25820215342
from __future__ import absolute_import, division, print_function, unicode_literals import unittest from discogs_client import Client from discogs_client.tests import DiscogsClientTestCase from discogs_client.exceptions import ConfigurationError, HTTPError from datetime import datetime class CoreTestCase(DiscogsClien...
discogs/discogs_client
discogs_client/tests/test_core.py
test_core.py
py
3,753
python
en
code
481
github-code
1
16077958011
from typing import Tuple import numpy as np from env import EnvWithModel from policy import Policy def value_prediction(env: EnvWithModel, pi: Policy, initV: np.array, theta: float) -> Tuple[np.array, np.array]: """ inp: env: environment with model information, i.e. you know transition dynamics and r...
owen8877/Sp22-CS394R
prog2/dp.py
dp.py
py
3,187
python
en
code
2
github-code
1
70062928353
f = open('rosalind_ini5 (1).txt', 'r') i = 0 a = open('outputread.txt', 'w') for line in f: if i%2 == 1: a.write( line + '\n') i = i + 1 a.close() f.close()
chiaramooney/Rosalind
intro/reading-writing.py
reading-writing.py
py
182
python
en
code
0
github-code
1
3516930462
import sys;input=sys.stdin.readline from collections import deque import heapq import math N,K=map(int,input().split()) coins=[0]*N for i in range(N): coins[i]=int(input()) def solve(value,count): h=[] heapq.heappush(h,(count,value)) while h: c,v=heapq.heappop(h) print(c,v,'adsf') ...
leezzangmin/pythonBOJ
파이썬/11047.py
11047.py
py
766
python
en
code
0
github-code
1
12640396333
from capas_proyecto.presentacion.ejecutar_vlc import ejecuta_vlc from capas_proyecto.acceso_a_datos.api import crear_dicc_nombre_ruta from capas_proyecto.logica_proyecto.crear_string_ruta_canciones import crear_string_ruta_canciones RUTA_XML = "archivos_xml\\library.xml" RUTA_VLC = "C:\\Program Files (x86)\\VideoLAN\\...
DanielFernandezR/vlc-random-playlist
script_principal.py
script_principal.py
py
631
python
es
code
0
github-code
1
3584234188
import numpy as np import sqlite3 as sq import datetime as dt import subprocess as sp import glob as gb import os import matplotlib.pyplot as plt from PyFVCOM.grid import vincenty_distance from PyFVCOM.read import FileReader from PyFVCOM.plot import Time, Plotter from PyFVCOM.stats import calculate_coefficient, rmse ...
li12242/PyFVCOM
PyFVCOM/validation.py
validation.py
py
40,160
python
en
code
null
github-code
1
9063102349
#!/usr/bin/python3 """ Rectangle """ BaseGeometry = __import__('7-base_geometry').BaseGeometry class Rectangle(BaseGeometry): """ Rectangle Class inheriting from BaseGeometry Class """ def __init__(self, width, height): """ Init """ try: super().integer_validator("width", width) ...
scisamir/alx-higher_level_programming
0x0A-python-inheritance/9-rectangle.py
9-rectangle.py
py
820
python
en
code
0
github-code
1
28092434211
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division from expyriment import control, stimuli, io, design, misc class Grid: positions_locations = {"TopLeft": (-200,150), "TopMiddle": (0, 150), "TopRight": (200, 150), \ "Left": (-200, 0), "Right": (200, 0), \ ...
noanutke/fMRI_E_Project
BasicTasks/grid.py
grid.py
py
1,763
python
en
code
0
github-code
1
74491944673
class GsmUtil(object): gsm_unicode = ( u"@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞ\x1bÆæßÉ !\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑÜ¿abcdefghijklmnopqrstuvwxyzäöñüà") gsm_ext_unicode = u"^{}\\[~]|€" gsm_all_unicode = gsm_unicode + gsm_ext_unicode @staticmethod def encode_to_gsm(s,...
bage79/nlp4kor
bage_utils/gsm_util.py
gsm_util.py
py
1,377
python
en
code
50
github-code
1
27146035546
import pandas as pd #import numpy as np #ward_g2v = cluster.ward_tree(g2v) #ward_child = ward_g2v[0] #n_samples = g2v.shape[0] #genes = g2v.index def ward_tree_2_label_mat(ward_child, genes): """Create a label matrix from ward tree children array. Create a matrix containing all possible clustering soluti...
IanPellet/clusterian
clusterian/hierarchical.py
hierarchical.py
py
2,020
python
en
code
0
github-code
1
10585779543
import sys,os commands = ['makemigrations', 'migrate', 'shell'] def managecommand(command): for com in command: os.system(f'python manage.py {com}') cd = {1:'makemigrations',2:"migrate", 3:"shell",4:'runserver'} buc = [] for arg in sys.argv: buc.append(arg) buc = buc[1:] print(buc) if buc[0] == '1': ...
Firebreather-heart/compblog
cmu.py
cmu.py
py
652
python
en
code
1
github-code
1
29653268879
from django.contrib import admin as dj_admin from django.contrib import admin from myapp.models import Project, ModelGroup, AutodeskExtractorRule, BimModel, Job from myapp.models import URN, ActiveLink class WorkAdmin(dj_admin.ModelAdmin): list_display = ("id", "name") class ProjectAdmin(admin.ModelAdmin): ...
kishik/ADCM-Scheduler
myapp/admin.py
admin.py
py
1,783
python
en
code
1
github-code
1
29638901594
import os import time import csv from selenium import webdriver from selenium.webdriver.common.keys import Keys from pathlib import Path import Assistant import sys if '..\\..' not in sys.path: sys.path.append("..\\..") if 'Assistant' not in sys.modules: import Assistant class Spain: def __in...
guillermorts/COVID19_Dataset
lib/Spain/Spain.py
Spain.py
py
1,761
python
en
code
0
github-code
1
16158666088
import json import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score import joblib import sys def train_model(): jsondata = json.loads(sys.argv[1]) # Create a dictionary to store models for each variable models = {} for variable_da...
MadakariNayakaHM/FinalYearProject
pythonScripts/new2.py
new2.py
py
1,106
python
en
code
0
github-code
1
34334051893
class Solution: def intToRoman(self, num: int) -> str: roman = {1: "I", 4: "IV", 5: "V", 9: "IX", 10: "X", 40: "XL", 50: "L", 90: "XC", 100: "C", 400: "CD", 500: "D", 900: "CM", 1000: "M"} roman = dict(reversed(list(roman.items()))) res = "" for key, value in r...
siddiqui-sana/Leetcode-Challenge
Leetcode Challenge/Maths/Medium/Integer_to_Roman.py
Integer_to_Roman.py
py
483
python
en
code
1
github-code
1
32068966886
from flask import Flask, request, jsonify from tf_idf import get_text, scrape_google, tf_idf_analysis app = Flask(__name__) @app.route('/get_text') def get_text_endpoint(): url = request.args.get('url') text = get_text(url) return jsonify(text=text) @app.route('/scrape_google') def scrape_google_endpoint...
farahramzy/seopro
python/app.py
app.py
py
657
python
en
code
0
github-code
1
40545797203
hint = "" def display_user_position(player): print("Current Floor: " + str(player[0] + 1) + ", Current Room: " + str(player[1] + 1)) return player def display_user_items(items): print("Current items: " + str(items)) return items def is_invalidate_command(command, valid_commands): if command n...
zoomzoomTnT/TealsLab207TextMonsters
components/GameAPI.py
GameAPI.py
py
4,923
python
en
code
0
github-code
1
17517296310
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: # Time: O(n) | Space: O(n) l, r = 0, 0 hashset = set() max_len = 0 while r < len(s): if s[r] not in hashset: hashset.add(s[r]) max_len = max(max_len, r ...
Eben-Success/A2SVOnboarding
3. Longest Substring Without Repeating Characters.py
3. Longest Substring Without Repeating Characters.py
py
719
python
en
code
0
github-code
1
40402312512
from tests.baseTest import * from lib.random_generator import RandomGenerator from lib.api_requests import RequestManager from grappa import should from api_endpoints.signup_endpoint import SignupMethods from api_endpoints.threads_endpoint import ThreadsMethods from lib.data_encoder import Encoder class ViewThreadsTe...
mdomosla/zadanie2-testy-forum
tests/threads/viewThreads_test.py
viewThreads_test.py
py
3,144
python
en
code
0
github-code
1
9356643217
import random import tensorflow as tf from AI.agent import Agent from AI.ROSEnvironment import ArmControlPlateform from config import get_config flags = tf.app.flags # Model flags.DEFINE_string('model', 'DQN', 'Type of model') # Environment #flags.DEFINE_string('env_name', 'Acrobot-v1', 'The name of gym environment t...
wlwlw/VisualArm
ArmRLAIController.py
ArmRLAIController.py
py
1,111
python
en
code
6
github-code
1
24639708926
from typing import List, Tuple import numpy as np import torch import torch.nn.functional as F from torch import Tensor, nn def get_cnn_output_dim( input_size: int, conv_kernel_size: int, padding_size: int, conv_stride_size: int ) -> int: return (input_size + 2 * padding_size - conv_kernel_size) / conv_strid...
aleksei-mashlakov/m6_competition
src/mv_cnn_model.py
mv_cnn_model.py
py
5,039
python
en
code
2
github-code
1
71795305634
import pygame from random import randint pygame.init() #game window WIDTH = 600 HEIGHT = 400 win = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Shot Clock") pygame.display.set_icon(pygame.image.load('icon.png')) #gmae font pygame.font.init() GAME_FONT = pygame.font.Font('gamera.TTF', 35) #g...
BaboyaChoch/Shot-Clock
main.py
main.py
py
6,568
python
en
code
3
github-code
1
27843256747
# with open("binary", 'bw') as bin_file: # this is writing into a binary file # for i in range(17): # bin_file.write(bytes([i])) # this is passing a single number to bytes function # above code can also be written as shown below # with open("binary", 'bw') as bin_file: # bin...
hkamra/Python
python-masterclass-udemy/FileIO/binary.py
binary.py
py
1,182
python
en
code
0
github-code
1
34190023993
import numpy as np class TrackBall( object ): """ Class used for controlling the rotation of the scene via mouse or joystick, by generating the virtual trackball effect Constructor ========== ========================= Arguments ========== ========================= ...
simon-r/PyParticles
pyparticles/ogl/trackball.py
trackball.py
py
3,530
python
en
code
77
github-code
1
73502727075
# -------------------------------- # Name: plot_sbcape_loop.py # Author: Robert M. Frost # NOAA Global Systems Laboratory # Created: 26 June 2023 # Purpose: Loop to plot 2m dew point # and wind barb comparisons at # different times during forecast runs # -------------------------------- from UFSutils import read_grib ...
robbyfrost/plotting_ufs
plot_td2m_loop.py
plot_td2m_loop.py
py
6,930
python
en
code
0
github-code
1
3840088158
a = [] for i in range(1, 1000): if i % 7 == 0 and i % 4 != 0: a.append(i) t = int(input()) for _ in range(t): n = int(input()) for i in a: if i >= n: print(i) break
ChieloNewctle/chielonewctle.github.io
assets/src/vjudge/367735/g.py
g.py
py
217
python
en
code
0
github-code
1
41489962994
import os import shutil import subprocess import tempfile from typing import List from phrasetree.tree import Tree from elit.metrics.f1 import F1 from elit.metrics.metric import Metric from elit.utils.io_util import get_resource, run_cmd from elit.utils.log_util import cprint class EvalbBracketingScorer(Metric): ...
emorynlp/seq2seq-corenlp
elit/metrics/parsing/evalb_bracketing_scorer.py
evalb_bracketing_scorer.py
py
7,748
python
en
code
13
github-code
1
20522160724
import os app_name = "spec_with_splash" # If set and 'onefile', a onefile project is built instead of onedir one. build_mode = os.environ.get('_TEST_SPLASH_BUILD_MODE', 'onedir') # If set and different from '0', collect tkinter via hidden import. with_tkinter = os.environ.get('_TEST_SPLASH_WITH_TKINTER', '0') if wi...
pyinstaller/pyinstaller
tests/functional/specs/spec_with_splash.spec
spec_with_splash.spec
spec
1,513
python
en
code
10,769
github-code
1
11714358376
import Server import os import socket import threading from tkinter import * from tkinter import filedialog, messagebox import customtkinter as ctk from CTkListbox import * import PIL.Image import PIL.ImageTk from Server import * SIZE = 1024 FORMAT = "utf-8" PORT = 4000 connFlag = [False, 0] def serverLogWindow(f...
Aryan51203/File-Transfer
hostServer.py
hostServer.py
py
5,609
python
en
code
0
github-code
1
15626371570
import requests import re import datetime from dateutil import parser import time from PIL import Image, ImageDraw, ImageFont import urllib.parse from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request import os import pickl...
Peragore/BeoCastingTools
build_ticker.py
build_ticker.py
py
25,854
python
en
code
0
github-code
1
8138880318
from collections import Counter class Solution: def longestPalindrome(self, s: str) -> int: counter = Counter(s) ans = 0 odd = False for k,v in counter.items(): ans += v // 2 * 2 if v % 2: odd = True if odd: ans += 1 return an...
MinecraftDawn/LeetCode
Easy/409. Longest Palindrome.py
409. Longest Palindrome.py
py
321
python
en
code
1
github-code
1
41826551936
import os import streamlit as st import openai from dotenv import load_dotenv def load_guidelines(filepath): with open(filepath, 'r', encoding='utf-8') as f: return f.read() def save_guidelines(filepath, content): with open(filepath, 'w', encoding='utf-8') as f: f.write(content) load_dote...
fhoeg/textReview_gui
app.py
app.py
py
1,490
python
en
code
0
github-code
1
22290768472
from typing import Any, Dict, Optional import httpx from ...client import Client from ...models.wallet_module_response import WalletModuleResponse from ...types import UNSET, Response def _get_kwargs( *, client: Client, did: str, ) -> Dict[str, Any]: url = "{}/wallet/did/local/rotate-keypair".format...
Indicio-tech/acapy-client
acapy_client/api/wallet/patch_wallet_did_local_rotate_keypair.py
patch_wallet_did_local_rotate_keypair.py
py
2,921
python
en
code
6
github-code
1
18088940221
from model import db_connection from helper import id_generator,paginated_results from flask import Flask, request class Contacts: def __init__(self): self.db=db_connection.Database() def record_exists(self,field,data): count = self.db.get_doc_count("contacts",field,data) if count: ...
rahulkaliyath/contact-book-server
controllers/contacts.py
contacts.py
py
4,014
python
en
code
0
github-code
1
26807859600
import os import sys import numpy as np import pytest from numpy.random import rand sys.path.append(os.path.join(os.path.dirname(__file__), "../..")) module = __import__("Models", fromlist=["GPR"]) class TestGPR: @pytest.mark.skip def test_getPredictValue(self, x): ... @pytest.mark.skip def...
mit17024317/2020-0730
Optimizer/Models/test/test_GPR.py
test_GPR.py
py
1,642
python
en
code
0
github-code
1
14309422897
# this is question 2 of the backend asigment given by CHAABI in which we are given extensiontype and some test #that are to beb conducted to determine those types def printfile(extensiontype, test): #we are seprating the values so that we can create pairs of the them to add to ref_dic temp = [num.split("...
Niraj0433/Niraj_Kumar_12006047_CHAABI
Ques2.py
Ques2.py
py
1,396
python
en
code
0
github-code
1
73268729635
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect,JsonResponse from .forms import NameForm from .models import NameFormModel import json, os, requests from datetime import datetime # Create your views here. database = [] def moviemanagerView(requ...
Leeoku/MovieDatabase
moviedb_project/moviemanager/views.py
views.py
py
2,560
python
en
code
0
github-code
1
20731580001
# -*- coding: utf-8 -*- from odoo import models, fields, api from odoo.exceptions import UserError from odoo.fields import first class sale_order_product_pack(models.Model): _inherit = "sale.order" @api.onchange("order_line") def check_pack_line_unlink(self): origin_line_ids = self._...
ezt-togawa/rtw-custom
sale_order_line_product_pack/models/sale_order_line_product_pack.py
sale_order_line_product_pack.py
py
5,567
python
en
code
0
github-code
1
73205815394
people1 = [1, 2, 3, 4, 5] people2 = [2, 1, 2, 3, 2, 4, 2, 5] people3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5] def solution(answers): cnt1, cnt2, cnt3 = 0, 0, 0 answer = [1] cnt_lst = [] for i in range(len(answers)): if answers[i] == people1[i % len(people1)]: cnt1 += 1 cnt_lst.appe...
eunjng5474/Study
week07/P_math.py
P_math.py
py
1,049
python
en
code
2
github-code
1
18279946367
#SNAKE MENU import pygame import time ANSI_HOME_CURSOR = u"\u001B[0;0H\u001B[2" RESET_COLOR = u"\u001B[0m\u001B[2D" def snake_print(position): snake = [" ____", " / . .\ ", " \ ---<", " _________________/ /", " \__________________/"] print(ANSI_HOME_C...
fruitycoders/snake
snake/main.py
main.py
py
1,957
python
en
code
0
github-code
1
10299544714
# https://en.wikipedia.org/wiki/LU_decomposition # https://www.quantstart.com/articles/LU-Decomposition-in-Python-and-NumPy def scal(arg1, arg2): assert len(arg1) == len(arg2) return sum(map(lambda i, j: i * j, arg1, arg2)) def mat_prod(arg1, arg2): assert len(arg1[0]) == len(arg2[0]) return list(map(...
lusineduryan/ACA_Python
Basics/Homeworks/Homework_6/Exercise_2_fast determinant (LU decomposition).py
Exercise_2_fast determinant (LU decomposition).py
py
1,447
python
en
code
1
github-code
1
5232873316
from django.core.mail import EmailMessage TITLE = [ ('Mr', 'Mr'), ('Mrs', 'Mrs'), ('Ms', 'Ms'), ('Dr', 'Dr'), ] EXPERTISE = [ ('UI/UX Design', 'UI/UX Design'), ('Product Design', 'Product Design'), ('AI Design', 'AI Design'), ] MENTORSHIP_AREAS = [ ('Career Advice', 'Career Advice'), ...
bbrighttaer/adplisttest
authentication/utils.py
utils.py
py
840
python
en
code
0
github-code
1
70861870115
"""A modified BFS algorithm for the Android Bubble Sort Puzzle Solver.""" from collections import deque from solver.trie import Trie from solver.state import is_solved_state from solver.state import count_finished_tubes from solver.state import get_next_states class QuantizedDoubleEndedPriorityQueue: """A Quant...
batzilo/android-ball-sort-puzzle-solver
solver/bfs.py
bfs.py
py
1,880
python
en
code
1
github-code
1
4904615211
""" Livestock Animal Pens """ #Django from django.db import models ORIENTATION_CHOICES = ( ('Norte','Norte'), ('Sur','Sur'), ('Este','Este'), ('Oeste','Oeste') ) class LivestockAnimalPens(models.Model): """ Modelo de Corrales de animales de la produccion ganadera """ production_live...
tapiaw38/agrapi
producer/models/livestock_animal_pens.py
livestock_animal_pens.py
py
956
python
en
code
0
github-code
1
22892777110
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np import os import time fig = plt.figure() plt.ion() ax = fig.add_subplot(111, projection='3d') ax.grid(False) for root, folder, files in os.walk("./results/features"): for file in sorted(files): if ".npy" not in fil...
zhuimengshaonian666/view_synthesis
vis.py
vis.py
py
671
python
en
code
0
github-code
1
29388024294
__author__ = 'piyush' k = int(input()) x = [] for i in range(k): x.append(int(input())) def prime(a): sum = [] for num in range(2,a+1): if all(num%i!=0 for i in range(2,num)): sum.append(num) return sum def lcm_upto(N): total = 1 for p in prime(N): x=1 while x*p <= N:...
piyushmaurya23/computation
ProjectEuler/pe05.py
pe05.py
py
415
python
en
code
0
github-code
1
17360305125
"""empty message Revision ID: d21d3839c096 Revises: 0c6b29c57638 Create Date: 2020-01-08 12:54:10.048577 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'd21d3839c096' down_revision = '0c6b29c57638' branch_labels = None depends_on = None def upgrade(): # ...
bcgov/namex
api/migrations/versions/d21d3839c096_.py
d21d3839c096_.py
py
2,035
python
en
code
6
github-code
1
72141463713
#!/usr/bin/env python3 import ev3dev.ev3 as ev3 from time import sleep btn = ev3.Button() gy = ev3.GyroSensor() #Gyro can be reset with changing between modes :) (WTF!) gy.mode = 'GYRO-ANG' gy.mode = 'GYRO-RATE' gy.mode='GYRO-ANG' while not btn.any(): print("Gyro loop") angle = gy.value() print(str(angle)) ...
denisvitez/ev3rvp
gyro.py
gyro.py
py
335
python
en
code
0
github-code
1
2961343069
a=float(input("please enter a: ")) b=float(input("please enter b: ")) c=float(input("please enter c: ")) print(f"P={a}(x^2)+{b}x+{c}") if a==0: if b==0: if c==0: print("p=0") else: print(f"P={c}") elif b==1: if c==0: print(f"P=x") else: ...
negarrezaeinejad/Python-Exercises
Quadratic Equation Solver/quadratic-equation-solver.py
quadratic-equation-solver.py
py
1,746
python
en
code
0
github-code
1
2424112506
# -*- coding: UTF-8 -*- import sys import os folderPath = sys.path[0] suiteName = os.path.realpath(sys.argv[0]).replace(folderPath, "")[1:-3] batPath = folderPath + "/" + suiteName + ".bat" outputFile = open(batPath, "w") outputFile.truncate() list = os.listdir(sys.path[0]) outputFile.write("python ") # outputFile.wr...
nainiuzz/phone_auto
testSuite.py
testSuite.py
py
796
python
en
code
0
github-code
1
39551705017
from dnn_app_utils_v3 import * import numpy as np # this script reads from h5 and output them to npy files dir = "datasets/" train_x_orig, train_y, test_x_orig, test_y, classes = load_data() np.save(dir+"train_x_orig", train_x_orig) np.save(dir+"train_y", train_y) np.save(dir+"test_x_orig", test_x_orig) np.save(dir+"t...
KivenChen/cat-vs-noncat
h5tonpy.py
h5tonpy.py
py
367
python
en
code
0
github-code
1
38467207386
import cv2 import numpy as np import keras emnist_labels = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 1...
Xaosgod/image-text-recognition
Распознование текста дополнительно/main.py
main.py
py
2,500
python
en
code
0
github-code
1
10663386137
import os, yaml, logging, re # external imports import torch from joeynmt.helpers import load_config from subword_nmt import apply_bpe from subword_nmt import apply_bpe from sacremoses import MosesTokenizer, MosesDetokenizer from joeynmt.helpers import load_config, get_latest_checkpoint, \ load_checkpoint from joey...
dsfsi/masakhane-web
src/server/core/model_load.py
model_load.py
py
10,260
python
en
code
34
github-code
1
5863215541
from typing import Any, Dict, List, Type, TypeVar, Union import attr from ..models.share_credential import ShareCredential from ..types import UNSET, Unset T = TypeVar("T", bound="ModifyRepositoryProfileRequest") @attr.s(auto_attribs=True) class ModifyRepositoryProfileRequest: """Model having repository detail...
dell/omivv
Python/omevv/v1/omevv_apis_client/models/modify_repository_profile_request.py
modify_repository_profile_request.py
py
3,461
python
en
code
3
github-code
1
36656178254
#!usr/bin/python import math def fuel_needed(mass): fuel = math.floor(mass/3) - 2 if fuel <= 0: return 0 fuel_for_fuel = fuel_needed(fuel) if fuel_for_fuel <= 0: return fuel return fuel + fuel_for_fuel answer = 0 with open('input.txt') as f: for line in f.readlines(): ...
gerrowadat/adventofcode
2019/1/1-2.py
1-2.py
py
394
python
en
code
1
github-code
1
23096307798
from jinja2 import Template f = open('weather.log', 'r') w = f.readlines() f.close() weather = [] for i in w: weather.append(i[:25].strip().split()) #print(weather) html = open('weth.txt').read() template = Template(html) render = template.render(weather = weather) f = open('weather.h...
AnnPython/-jinja
weth1.py
weth1.py
py
360
python
en
code
1
github-code
1
23765961953
""" [最大连续1的个数 III](https://leetcode-cn.com/problems/max-consecutive-ones-iii/) 转换为最长子序列且序列中 0 的个数 <= K """ def longestOnes(A, K): N = len(A) res = 0 left, right = 0, 0 zeros = 0 while right < N: if A[right] == 0: zeros += 1 while zeros > K: if A[left] == 0: ...
Flyraty/leetcode_200
algorithm/SlidingWindow/max_consecutive_ones_iii.py
max_consecutive_ones_iii.py
py
489
python
en
code
1
github-code
1
26807889190
import os import sys import numpy as np import pytest from numpy.random import normal sys.path.append(os.path.join(os.path.dirname(__file__), "../..")) module = __import__("Acquisition", fromlist=["EI"]) class TestEI: @pytest.mark.parametrize( ("mean", "var", "base"), [(0.0, 1.0, 0.5), (0.8, 0.1...
mit17024317/2020-0730
Optimizer/Search/Acquisition/test/test_EI.py
test_EI.py
py
790
python
en
code
0
github-code
1
11548425803
import hashlib import time import utils import asyncpg import asyncpg.exceptions as asyncpg_exc from config import logger from aiohttp import web from db_wrapper import DbWrapper router = web.RouteTableDef() @router.post('/sign_in') async def sign_in(request: web.Request): body = await request.json() email: ...
ilookhandsometoday/dance-studio-backend
src/routes.py
routes.py
py
7,394
python
en
code
0
github-code
1
53079157
__author__ = 'James DeVincentis <james.d@hexhost.net>' import os import multiprocessing import time import schedule import setproctitle import cif class Feeder(multiprocessing.Process): def __init__(self): multiprocessing.Process.__init__(self) self.backend = None self.logging = cif.log...
Danko90/cifpy3
lib/cif/feeder/feeder.py
feeder.py
py
2,614
python
en
code
0
github-code
1
38924106495
#!/usr/bin/env python3 """Work Log Record work activities and store to a sqlite database Created: 2018 Last Update: 2018-06-05 Author: Alex Koumparos """ import datetime import re # from csv_manager import CsvManager from db_manager import DBManager import wl_settings as settings class Menu: """The user-facing...
Crossroadsman/treehouse-techdegree-python-project4
work_log.py
work_log.py
py
26,340
python
en
code
0
github-code
1
4048633000
import traceback from types import MethodType # # class MyClass(object): # pass # # def set_name(self,name): # self.name=name # # cls = MyClass() # cls.name="kevin" # print(cls.name) # # cls.set_name = MethodType(set_name,cls) # cls.set_name("lara") # print(cls.name) #第二部分:可以看到上面的类可以被随便添加方法和属性,那么怎么实现只能添加指定的属性...
zkc360717118/PYTHON-python-study
7.1 slot和property.py
7.1 slot和property.py
py
6,827
python
en
code
0
github-code
1
12246125727
import re def safe_code1(equation): for i in range(0,10): if str(i) in equation: continue eq = equation.replace('#',str(i)) left_expression = eq.split("=")[0] right_expression = eq.split("=")[1] try: if eval(left_expression) == eval(right_expression...
krkmn/checkio
Escher/safe_code.py
safe_code.py
py
1,583
python
en
code
0
github-code
1
29892888696
""" 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 1. i的水量为min(i左右最大高度lmax[i], rmax[i]) - i高度 2. 遍历取lrmax """ def js(height): if not height: return 0 n = len(height) lmax = [0] * n for i in range(n): if i == 0: lmax[i] = height[i] continue lmax[i] =...
whaso/python-tutorial
leetcode/a220617.py
a220617.py
py
852
python
en
code
0
github-code
1
805703677
import pyaudio import numpy as np import math import struct import simpleaudio as sa from imutils.video import FPS #CHUNK = 1024 CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 RECORD_SECONDS = 0.03 print(int(RATE / CHUNK * RECORD_SECONDS)) volume = 0.1 # range [0.0, 1.0] fs = 44100 # sampl...
matheusbitaraes/VirtualDrum
hearaudio.py
hearaudio.py
py
2,534
python
en
code
0
github-code
1
18343384634
#!/usr/bin/python3 """ Rotation of a 2D matrix """ def rotate_2d_matrix(matrix): """ Rotate a given matrix Args: matrix: List of lists """ n = len(matrix) # for each row for x in range(n): reversedRow = [] # Collect the values from back as a list for y in r...
chibuezeorjinta/alx-interview
0x07-rotate_2d_matrix/0-rotate_2d_matrix.py
0-rotate_2d_matrix.py
py
506
python
en
code
0
github-code
1
25056244488
import argparse import time import re import os import datetime import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.utils.data import Dataset, DataLoader, random_split from torch.nn.utils.rnn import pack_padded_sequence, p...
CAMeL-Lab/camel_morph
camel_morph/sandbox/merger_network.py
merger_network.py
py
12,300
python
en
code
3
github-code
1
41060932108
import pytest import sacrebleu EPSILON = 1e-4 test_sentence_level_chrf = [ ( 'Co nás nejvíc trápí, protože lékaři si vybírají, kdo bude žít a kdo zemře.', ['Nejvíce smutní jsme z toho, že musíme rozhodovat o tom, kdo bude žít a kdo zemře.'], 39.14078509, ), ( 'Nebo prostě n...
mjpost/sacrebleu
test/test_chrf.py
test_chrf.py
py
3,965
python
en
code
896
github-code
1
22824109486
r''' Module with all structures for defining rings with operators. Let `\sigma: R \rightarrow R` be an additive homomorphism, i.e., for all elements `r,s \in R`, the map satisfies `\sigma(r+s) = \sigma(r) + \sigma(s)`. We define the *ring* `R` *with operator* `\sigma` as the pair `(R, \sigma)`. S...
Antonio-JP/dalgebra
dalgebra/ring_w_operator.py
ring_w_operator.py
py
54,589
python
en
code
1
github-code
1
6159457173
class BearDestroysDiv2: def sumUp(self, W, H, MOD): mask = (1 << W) - 1 # prevFallDp[i] is how many ways current row is filled with fall trees. 1 filled, 0 not filled. prevFall = [0 for x in range(mask + 1)] prevFall[0] = 1 result = 0 for row in range(0, H): nextFall = [0 for x in range(mask + 1)] cu...
yabincui/topcoder
dp/BearDestroysDiv2.py
BearDestroysDiv2.py
py
1,358
python
en
code
0
github-code
1
27768711368
import numpy as np import itertools import multiprocessing import threading import subprocess import time import sys import os if len(sys.argv) != 3: print("input data_folder thread_num") exit(0) folder = sys.argv[1] max_spawn = int(sys.argv[2]) if not os.path.exists(folder): os.mkdir(folder) os.chdir(fo...
kodack64/Q3DE
fig10_q3de_throughput/micro_spawn.py
micro_spawn.py
py
2,178
python
en
code
1
github-code
1
6238177421
import os import re from shutil import copyfile import math import random import pandas as pd SOURCE_PATH = "data/aug" DEST_PATH = "data" TRAIN_DIR = os.path.join(DEST_PATH, 'train') TEST_DIR = os.path.join(DEST_PATH, 'test') ratio = 0.1 if not os.path.exists(TRAIN_DIR): os.makedirs(TRAIN_DIR) if not os.path.exi...
Ldixuan/robotic_project
module/split_data.py
split_data.py
py
2,119
python
en
code
0
github-code
1
2453043535
from random import random import matplotlib.pyplot as plt class AlgoritmoGenetico(): def __init__(self, tamanho_populacao): self.tamanho_populacao = tamanho_populacao self.populacao = [] self.geracao = 0 self.melhor_solucao = 0 self.lista_solucoes = [] ...
josuelaiber/Civil_Final_Project
curso/Algoritmos Genéticos em Python/13.py
13.py
py
4,418
python
pt
code
0
github-code
1
28987569197
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from __future__ import annotations import pandas as pd import numpy as np from typing import Iterable, Callable, Any ...
cat-cfs/libcbm_py
libcbm/input/sit/sit_parser.py
sit_parser.py
py
12,741
python
en
code
6
github-code
1
72919576995
from edc_appointment.appointment_creator import AppointmentCreator as BaseAppointmentCreator from ..models import DispenseSchedule from ..print_profile import DispenseProfileSelector class AppointmentCreator(BaseAppointmentCreator): """Creates dispense timepoints and update. """ appointment_model = 'ed...
botswana-harvard/edc-pharmacy
edc_pharmacy/old/scheduler/creators.py
creators.py
py
2,878
python
en
code
0
github-code
1
15162386829
#!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap def down_sample(a): tmp=[] for t in a: tmp.append(t[3::4]) return tmp[3::4] def draw_velocity(time, output_dir, data_dir)...
atom-model/ATOM
utils/draw_atm_velocities.py
draw_atm_velocities.py
py
2,177
python
en
code
13
github-code
1
31890262213
__author__ = 'Advik-B' # advik.b@gmail.com import os import sys from fnmatch import fnmatch # Third party modules from send2trash import send2trash as delete from termcolor import cprint DEL = False try: cwd = sys.argv[1] except IndexError: cwd = os.getcwd() if_allowed_files = os.path.isfile(os.path.join(cw...
Advik-B/GitHub-Utils
cleanup.py
cleanup.py
py
2,264
python
en
code
3
github-code
1
20505915805
# -*- coding: utf-8 -*- # # Copyright (c) 2012 David Townshend # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. ...
aquavitae/norman
tests/test_store.py
test_store.py
py
10,128
python
en
code
1
github-code
1
36924785517
from beewin_module.database.beewinDB import Member, Result from beewin_module.models.dataClass import MemberData from flask_restful import Resource, request, output_json from common.argsParser import uid_parser, member_parser class MemberResource(Resource): def get(self, uid): if uid == 'all': ...
Yicheng-1218/web_module
beewin_api/resource/MemberResource.py
MemberResource.py
py
1,043
python
en
code
0
github-code
1
38639273059
import numpy as np import matplotlib.pyplot as plt import iris.plot as iplt from irise import convert, diagnostics, variable from myscripts.models.um import case_studies import tropopause pvtrop = 3.5 pvname = 'ertel_potential_vorticity' dz = np.linspace(-2000, 2000, 21) def main(cubes): """ """ # Calula...
leosaffin/scripts
myscripts/tropopause/inversion_layer.py
inversion_layer.py
py
1,141
python
en
code
2
github-code
1
5604055738
N, M = map(int, input().split()) mx = [0, 0] for i in range(1, 10): tmp = 0 for j in range(1, N+1): tmp = tmp*10 + i tmp %= M if tmp == 0: mx = max(mx, [j, i]) if mx[0] != 0: print(str(mx[1])*mx[0]) else: print(-1)
yuu246/Atcoder_ABC
practice/recommendation/ARC149_A.py
ARC149_A.py
py
268
python
en
code
0
github-code
1
14285320497
""" Forms Motors. """ from datetime import date from django import forms class MotorForm(forms.Form): """ Formularios para oferta de mobliliarios. """ FUEL_CHOICES = [ ('Nafta', 'Nafta'), ('Diesel', 'Diesel'), ('Alcohol', 'Alcohol'), ('Flex', 'Flex'), ('Eléctrico', 'El...
Seph1986/202306_nemu_market
apps/motor_app/forms.py
forms.py
py
3,469
python
en
code
0
github-code
1
33931275405
# https://www.acmicpc.net/problem/7576 # 토마토 from collections import deque M, N = map(int, input().split()) #col row board = [] for _ in range(N): board.append(list(map(int, input().split()))) def bfs(): global M, N, board queue = deque() for i in range(N): for j in range(M): if ...
progjs/coding_test
백준/7576.py
7576.py
py
960
python
en
code
0
github-code
1
19416966323
import calendar import datetime from math import ceil import numpy as np from aiogram.dispatcher import FSMContext from aiogram.types import Message, ReplyKeyboardRemove, InlineKeyboardMarkup, \ InlineKeyboardButton, CallbackQuery from utils.db_api.models import DBCommands from data.config import days, months from ...
Sanzensekai-mx/cosmetology_bot_example
utils/general_func.py
general_func.py
py
9,053
python
en
code
0
github-code
1
31149492786
from enum import Enum from typing import Optional from discord.ext import commands from .utils import ASPECT_RATIO_ORIGINAL class ResizeFlagDescriptions(Enum): height = "Flag to specify height." width = "Flag to specify width." aspect_ratio = f"Flag to specify width:height aspect ratio when resizing. \ ...
WitherredAway/Yeet
cogs/Image/utils/flags.py
flags.py
py
1,959
python
en
code
16
github-code
1
21007477247
# -*- coding: utf-8 -*- """ Created on Sun Feb 14 18:50:22 2021 @author: Cillian """ import numpy as np from pyDOE import lhs def get_initial_pts(parameter_samples, parameter_ranges, criteria='center' ): """Get initial Latin Hypercube sample points and scale Args: parameter_samples (str): Number o...
CillianHourican/CLS-Project
Deliverable 1/utils.py
utils.py
py
2,294
python
en
code
1
github-code
1
31128572577
#!/usr/bin/env python import lzma import pickle from Bio import SeqIO import os import numpy as np import sys import matplotlib.pyplot as plt from sklearn.feature_extraction.text import CountVectorizer as Cvec from itertools import product from scipy.stats import poisson from scipy.special import softmax dmel_bkg = ...
laiker96/alfree_enhancer_detection
process_fasta_vectorization.py
process_fasta_vectorization.py
py
7,352
python
en
code
0
github-code
1
71015824995
# Title: 3Sum # Link: https://leetcode.com/problems/3sum/ from itertools import combinations from collections import defaultdict class Solution: def three_sum(self, nums: list) -> list: ans = set() ans_dict = set() d = defaultdict(lambda: 0) for n in nums: d[n] += 1 ...
yskang/AlgorithmPractice
leetCode/3_sum.py
3_sum.py
py
1,313
python
en
code
1
github-code
1
17337628519
import pygame, sys, time, random from pygame.locals import * # Установка pygame. pygame.init() mainClock = pygame.time.Clock() # Настройка окна. WINDOWWIDTH = 400 WINDIWHEIGHT = 400 windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDIWHEIGHT), 0, 32) pygame.display.set_caption('Спрайты и звуки') # Настройка ц...
pavel-malin/game_python3
game_python3/spriteAndSounds.py
spriteAndSounds.py
py
4,973
python
en
code
2
github-code
1
23199437019
import math import torch import gpytorch import numpy as np from voltron.means import EWMAMean, DEWMAMean, TEWMAMean from botorch.models import SingleTaskGP from botorch.optim.fit import fit_gpytorch_torch from voltron.rollout_utils import nonvol_rollouts class BasicGP(): def __init__(self, train_x, train_y, kerne...
g-benton/Volt
voltron/models/.ipynb_checkpoints/BasicGPModels-checkpoint.py
BasicGPModels-checkpoint.py
py
2,558
python
en
code
41
github-code
1
27961224000
def most_frequent(s): """Takes a string s and returns list of letters in decreasing order of frequency""" histogram = dict() for letter in s.lower(): histogram[letter] = histogram.get(letter, 0) + 1 freq_letter_pairs = [] for letter, freq in histogram.items(): if letter.isa...
MJC-code/thinkpython
Chapter12/Ex12-1.py
Ex12-1.py
py
1,090
python
en
code
0
github-code
1
72936024995
import gspread import pandas as pd import os import requests from google.oauth2 import service_account # from oauth2client.service_account import ServiceAccountCredentials from bs4 import BeautifulSoup scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] secret_file = os....
arthurnovello/PriceMonitor
app.py
app.py
py
1,467
python
en
code
0
github-code
1
44221187152
import argparse import logging import pdb import sys import traceback from typing import Text, Optional import torch from pyprojroot import here as project_root import os sys.path.insert(0, str(project_root())) from context_model_pretrain import make_model from data.fsmol_task import FSMolTaskSample from data.multi...
cfifty/CAMP
context_modeling_test.py
context_modeling_test.py
py
4,420
python
en
code
0
github-code
1
26904261036
from collections import deque def bfs(graph, root): visited = set() queue = deque([root]) i = 0 while queue: n = queue.popleft() if n not in visited: if i != 0: visited.add(n) queue += set(graph[n]) - set(visited) i += 1 return vi...
habaekk/Algorithm
boj/11403.py
11403.py
py
918
python
en
code
0
github-code
1
39394256532
from django.conf.urls.static import static from django.contrib.auth.decorators import login_required from django.urls import path from . import views from .views import AddPostView, UserSettings, UserProfile from .models import Profile from newsletter.models import NewsLetter urlpatterns = [ path( "", ...
JodyMurray/p4-plant-blog
blog/urls.py
urls.py
py
1,567
python
en
code
0
github-code
1
21521159472
#!/usr/bin/env python3 import argparse """ Script to find complementary subsequences inside of a main sequence. Copyright 2020 Margherita Maria Ferrari. This file is part of ComplSeqUtils. ComplSeqUtils is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License a...
mmferrari/ComplSeqUtils
compl_seq_utils.py
compl_seq_utils.py
py
6,687
python
en
code
0
github-code
1