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
4697971690
from __future__ import print_function, division from helpers import utils from tensorflow.keras.models import Model, load_model, save_model from tensorflow.keras.layers import Input, Dropout, Concatenate, BatchNormalization, LeakyReLU, UpSampling2D, Conv2D, \ Activation, Flatten, Dense from tensorflow.keras.optimi...
ozlia/brightFieldToFlorecent
models/Pix2Pix/model.py
model.py
py
15,295
python
en
code
0
github-code
90
18493618019
from math import factorial n, m = map(int, input().split()) mod = 10**9 + 7 def factorization(n): arr = [] temp = n for i in range(2, int(n**0.5//1+1)): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) ...
Aasthaengg/IBMdataset
Python_codes/p03253/s075723844.py
s075723844.py
py
621
python
en
code
0
github-code
90
18050359819
from itertools import groupby from functools import reduce MOD = 1000000007 def mod_pow(x, k): ret = 1 while k > 0: if k & 1: ret *= x ret %= MOD k >>= 1 x *= x x %= MOD return ret def max_t(): i, t_max = 0, 0 for j, v in enumerate(t): ...
Aasthaengg/IBMdataset
Python_codes/p03959/s959207011.py
s959207011.py
py
1,074
python
en
code
0
github-code
90
36781876144
import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats import sklearn.gaussian_process as gp import scipy.linalg as la from scipy.stats import gaussian_kde def rw_metropolis_hastings(f,llh,lpr,cov,x0,n,burn_in,update=50,verbose=False,debug=False): X = [x0] y = f(x0) loglikelihood = ...
hjrrockies/surrogate-data
sur_data.py
sur_data.py
py
2,655
python
en
code
0
github-code
90
42088221259
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : Xi WenHao # @Email : xiwenhao1994@gmail.com # @Project : qingshan # @Time : 2021/11/8 10:07 # @File : txt2img.py import time from os import remove from os.path import abspath from random import choice from uuid import uuid4 from PIL import Image,...
HowardXi/qingshan_robot
text2image/txt2img.py
txt2img.py
py
5,190
python
en
code
0
github-code
90
17997237699
a,b,c = map(int,input().split()) oldCookies = [] oldCookies.append([a,b,c]) answer = 0 while(True): if a % 2 == 1 or b % 2 == 1 or c % 2 == 1: break after_a = b / 2 + c / 2 after_b = a / 2 + c / 2 after_c = a / 2 + b / 2 a = after_a b = after_b c = after_c cookies = [a,b,c] answer += 1 for i in rang...
Aasthaengg/IBMdataset
Python_codes/p03723/s119353295.py
s119353295.py
py
436
python
en
code
0
github-code
90
16040991605
class Student(object): __slots__ = ("name", "age", "city") # 这个属性直接定义在类里,是一个元组,用来规定对象可以存在的属性 def __init__(self, x, y): self.name = x self.age = y def say_hello(self): print("大家好,我是", self.name) # Student("张三",18)到底做了什么? # 1. 调用__new__方法,用来申请内存空间 # 2. 调用__init__方法,并让self指向申请好的那段内...
EricWord/PythonStudy
15-oop/oop_demo3.py
oop_demo3.py
py
917
python
zh
code
0
github-code
90
38408104811
# Input: gas = [1,2,3,4,5], cost = [3,4,5,1,2] # Output: 3 # Explanation: # Start at station 3 (index 3) and fill up with 4 unit of gas. Your tank = 0 + 4 = 4 # Travel to station 4. Your tank = 4 - 1 + 5 = 8 # Travel to station 0. Your tank = 8 - 2 + 1 = 7 # Travel to station 1. Your tank = 7 - 3 + 2 = 6 # Trave...
sagarsharan11/DSA-Python
LeetCode_Questions/134. Gas Station.py
134. Gas Station.py
py
2,823
python
en
code
1
github-code
90
74626615336
# 기본 풀이 answer = 0 def dfs(idx, value, numbers, target): global answer N = len(numbers) if idx == N and value == target: answer += 1 return if idx == N: return dfs(idx + 1, value + numbers[idx], numbers, target) dfs(idx + 1, value - numbers[idx], numbers, target) de...
tonyw0527/Python-algorithm-notes
Dfs-Bfs/targetNumber.py
targetNumber.py
py
736
python
en
code
0
github-code
90
71125999656
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, Text from sqlalchemy import DateTime from sqlalchemy.orm import relationship, backref from sqlalchemy import func from unidecode import unidecode ''' +++++++++++++++++++++++++++++++++++ Define ...
laironald/thedriver
data_interface/schema.py
schema.py
py
3,758
python
en
code
0
github-code
90
9564477752
import pymunk from pymunk.pygame_util import * from pymunk.vec2d import Vec2d import pygame from pygame.locals import * import math from PIL import Image import numpy as np import os space = pymunk.Space() space.gravity = 0, 900 b0 = space.static_body size = w, h = 800, 500 fps = 30 steps = 10 BLACK = (0, 0, 0) GR...
victorsimrbt/physics_ai
ga_creature_generation/joint.py
joint.py
py
4,246
python
en
code
0
github-code
90
18064143379
# A - Wanna go back home def can_go_home(dir1, dir2): if dir1 > 0 and dir2 > 0: return True elif dir1 == 0 and dir2 == 0: return True else: return False n, w, s, e = 0, 0, 0, 0 for dir in input(): if dir == 'N': n += 1 elif dir == 'W': w += 1 elif dir == 'S': s += 1 else: e += 1 if can_go_home(...
Aasthaengg/IBMdataset
Python_codes/p04019/s029886540.py
s029886540.py
py
381
python
en
code
0
github-code
90
34772171764
import numpy as np import cv2 import argparse import glob import random import os import sys import pandas as pd ### Set up arguments, can accept path to the directory where the images and their masks are stores as # as well as size of the patches the image will be subdivided into argparser = argparse.ArgumentPa...
JuliaHarvie/NN_SVM_Eval
FoldCreation.py
FoldCreation.py
py
4,562
python
en
code
0
github-code
90
35225127499
# Test methods with long descriptive names can omit docstrings # pylint: disable=missing-docstring import unittest from AnyQt.QtCore import Qt from Orange.data import Table from Orange.widgets.model.owrandomforest import OWRandomForest from Orange.widgets.tests.base import ( WidgetTest, DefaultParameterMapping...
biolab/orange3
Orange/widgets/model/tests/test_owrandomforest.py
test_owrandomforest.py
py
2,540
python
en
code
4,360
github-code
90
34872769620
from datetime import timedelta import numpy as np import pytest from pandas._libs.tslibs.period import IncompatibleFrequency from pandas import ( NaT, Period, Timedelta, Timestamp, offsets, ) class TestPeriodArithmetic: def test_add_overflow_raises(self): # GH#55503 per = Ti...
pandas-dev/pandas
pandas/tests/scalar/period/test_arithmetic.py
test_arithmetic.py
py
16,775
python
en
code
40,398
github-code
90
5030983012
import argparse from tests.docker_cluster import DockerCluster from tests.no_hadoop_bare_image_provider import NoHadoopBareImageProvider from tests.product.base_product_case import BaseProductTestCase from tests.product.cluster_types import STANDALONE_BARE_CLUSTER, STANDALONE_PA_CLUSTER, \ STANDALONE_PRESTO_CLUSTE...
prestodb/presto-admin
tests/product/image_builder.py
image_builder.py
py
3,657
python
en
code
169
github-code
90
23046397211
''' 342. Power of Four Easy Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Input: 16 Output: true https://leetcode.com/problems/power-of-four/ ''' class Solution: def isPowerOfFour(self, num: int) -> bool: if num == 1: return True ...
aditya-doshatti/Leetcode
power_of_four_342.py
power_of_four_342.py
py
486
python
en
code
0
github-code
90
18483215789
n = int(input()) a_ls = [] for i in range(n): a_ls.append(int(input())) a_ls.sort() flg = n % 2 == 1 if flg: first = a_ls[:n//2] center = a_ls[n//2] second = a_ls[n//2 + 1:] + [center] best = 0 for ind in range(n//2): best += abs(second[ind] - first[ind]) + abs(second[ind + 1] - first[in...
Aasthaengg/IBMdataset
Python_codes/p03229/s157947514.py
s157947514.py
py
824
python
en
code
0
github-code
90
37460980177
import caffe from tensorflow.contrib.legacy_seq2seq.python.ops import seq2seq import os import collections import numpy as np import tensorflow as tf from tensorflow.python.ops import rnn_cell import time import io import cPickle import matplotlib.pyplot as plt from matplotlib.patches import Rectangle from visual_genom...
xiaosucheng/Densecap-tensorflow
RNN.py
RNN.py
py
6,432
python
en
code
7
github-code
90
31223391885
import boto3 #naming our client ec2 ec2 = boto3.client('ec2') response = ec2.describe_instances() #Parsing the output from response var reservations = response['Reservations'] #This iteration assigns the Dict key 'Instance' to instances var for reservation in reservations: instances = reservation['Instances'] ...
aacedeno/AWS_Automation_Boto3
EC2/list_ami_id.py
list_ami_id.py
py
510
python
en
code
0
github-code
90
41424662899
from rest_framework.test import APITestCase from django.core.files.images import ImageFile from django.urls import reverse from pages import models class MainPageAPITestCase(APITestCase): def setUp(self): self.main_page_1 = models.MainPage.objects.create( title='test', house_titl...
EugeneDenkevich/Web-Travel_pub
backend/src/pages/tests/test_api.py
test_api.py
py
1,283
python
en
code
0
github-code
90
26035231926
from google import protobuf from google.protobuf import descriptor __all__ = [ 'EXCLUDE', 'INCLUDE_ENTIRELY', 'INCLUDE_PARTIALLY', 'Mask', 'STAR', ] # Used in a parsed path to represent a star segment. # See Mask docstring. STAR = object() EXCLUDE = 0 INCLUDE_PARTIALLY = 1 INCLUDE_ENTIRELY = 2 ...
luci/luci-py
appengine/components/components/protoutil/field_masks.py
field_masks.py
py
16,833
python
en
code
74
github-code
90
834913874
import matplotlib.pyplot as plt import numpy as np x=np.arange(-3,3,0.01) y=x**2 x1=np.arange(-3,3,0.01) y1=1-x**2 plt.plot(x,y,color='black') plt.plot(x1,y1) #plt.axis ('equal') plt.show() plt.close()
basousti/Desktop-App
python project/python 1ere math/exercice 1.py
exercice 1.py
py
211
python
en
code
0
github-code
90
18461795317
import googleapiclient.discovery from google.cloud import bigquery PROJECT_ID = "bergqvist-sandbox" VERSION_NAME = "v3" MODEL_NAME = "aclima" service = googleapiclient.discovery.build('ml', 'v1') name = 'projects/{}/models/{}'.format(PROJECT_ID, MODEL_NAME) name += '/versions/{}'.format(VERSION_NAME) def get_seed_v...
dbergqvist/airview-predict
get_predictions/main.py
main.py
py
2,256
python
en
code
0
github-code
90
2201888410
#!/usr/bin/env python3 ''' Demo how your robot can follow an object with Pixy2 for LEGO Mindstorms. NOTE: this demo is for the Pixy2 for LEGO Mindstorms. Use pixy_chaser.py for the first version of Pixy for LEGO Mindstorms. Requirements: Hardware: - LEGO EV3-brick. - Pixy2 ...
KWSmit/Pixy_ev3dev
Pixy2/pixy2_chaser.py
pixy2_chaser.py
py
3,867
python
en
code
10
github-code
90
3144096037
from tkinter.filedialog import askopenfilename as askf from openpyxl import Workbook from subprocess import Popen from tkinter import Tk import pandas as pd import numpy as np bancos={ '11100505' :['BANCOLOMBIA', '325-450229-55'], '11100510' :['BANCO DE BOGOTA', '538-0393-14'], '11100515' :['BANCO DAVIVIEN...
sebastian7584/conciliar-bancos-team-comunicaciones
auxiliar.py
auxiliar.py
py
3,928
python
en
code
0
github-code
90
43418506953
from openerp import api, models, fields from openerp.exceptions import ValidationError class HrTelefoniaWizard(models.TransientModel): _name = 'hr.ateste.telefonia.wizard' mensagem_ateste = fields.Char( string='Mensagem do Ateste', readonly=True, default=u'Atesto as ligações previamen...
odoo-brazil/odoo-brazil-hr
l10n_br_hr_payroll/wizards/hr_ateste_telefonia_wizard.py
hr_ateste_telefonia_wizard.py
py
2,008
python
pt
code
8
github-code
90
5591022177
import dataclasses from typing import Callable import torch.nn from spectral_graph_conv.models.spectral_resnet_block import ( SpectralResnetBlock, SpectralResnetBlockConfig, ) @dataclasses.dataclass class SpectralResnetConfig: n_layers: int filter_approximation_rank: int dtype: torch.dtype d...
KanHarI/HyenaSpectralGraphConv
spectral_graph_conv/models/spectral_resnet.py
spectral_resnet.py
py
1,706
python
en
code
0
github-code
90
31826516936
""" Main file for the PyGame window responsible for both displaying the game board and the state space """ # Modules import math import pygame import numpy as np import random # Model imports from model.TicketToRide import TicketToRide from model.map.City import City from model.config import * # Config in PY_GAME_CO...
lennard134/TicketToRideLAMAS
src/Visualizer.py
Visualizer.py
py
27,330
python
en
code
0
github-code
90
9340048360
# Задайте список из вещественных чисел. Напишите программу, # которая найдёт разницу между максимальным и # минимальным значением дробной части элементов. # # Пример: # # - [1.1, 1.2, 3.1, 5, 10.01] => 0.19 import math if __name__ == '__main__': list_numbers = [1.1, 1.2, 3.1, 5, 10.01] cut_integers = [] f...
frontendLearning-31082022/python_introduction_seminar_3
one_more_3.py
one_more_3.py
py
755
python
ru
code
0
github-code
90
16625870237
#coding:utf-8 PURPLE = '\033[35m' RED = '\033[31m' CYAN = '\033[36m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' import csv import sys import codecs from urllib.parse import urlparse #URL --> Domain from time import sleep dict_web_id = {} dict_url ...
DisneyAladdin/kenkyu
program/demo/Decide-topic-color.py
Decide-topic-color.py
py
7,194
python
en
code
1
github-code
90
11002522082
a, b = map(int, input().split()) #구간 시작 a, 구간 끝 b 입력 arr = [] #문제의 수열 #구간 끝 b까지의 범위에 맞게 문제 수열 채우기 for x in range(1,b+1): for y in range(1,x+1): arr.append(x) ans = arr[a-1:b] #입력받은 구간으로 나누기 print(sum(ans)) #구간의 합 출력
joey0807/CodeStudy
문제풀기/baekjoon/1292.py
1292.py
py
327
python
ko
code
0
github-code
90
30420997241
"""Test du bloc try""" def division(numerateur, denominateur): try: resultat = numerateur / denominateur except NameError: print("La variable numerateur ou denominateur n'a pas été définie.") except TypeError: print("La variable numerateur ou denominateur possède un type incom...
Narvaliton/Learning
Python/OpenClassrooms/exceptions.py
exceptions.py
py
945
python
fr
code
0
github-code
90
14087002585
#Create 15,000-meter buffer around airports.shp items classified as an airports #(based on the FEATURE field) + 7,500-meter buffer around airports.shp items #classified as seaplane base. import arcpy from arcpy import env env.workspace = "C:/EsriPress/Python/Data/Exercise07" air = " \"FEATURE\" = 'Airport'" sea = " \"F...
XJCasper/lab_4
Exer7Chall1.py
Exer7Chall1.py
py
680
python
en
code
0
github-code
90
7272721409
import day06 import unittest class TestDay06(unittest.TestCase): def setUp(self): self.solution = day06.Solution() def test_part_a(self): test_case = [ "COM)B", "B)C", "C)D", "D)E", "E)F", "B)G", "G)H", ...
jonabantao/advent_of_code
2019/day06/test.py
test.py
py
907
python
en
code
0
github-code
90
14274648766
import pandas as pd import os import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument("--tab1", required=True, help="", type=str) parser.add_argument("--tab2", required=True, help="", type=str) args = parser.parse_args() tab1_df = pd.read_excel(os.path.abspath(args.tab1...
elhossary/bioinformatics_analysis_toolbox
TermSeq_transcripts_ncRNA_filter/mark_records.py
mark_records.py
py
1,972
python
en
code
0
github-code
90
40243723224
# imports #-------------------- import random,copy,re,nltk,string,time,numpy,subprocess,regex from nltk.corpus import wordnet as wn from nltk.stem import WordNetLemmatizer from gensim.models import KeyedVectors from dbutils import * from prygress import progress from ngraph import NeumanGraph from sklearn.cluster im...
ilay32/metaphore-substitutes
metsub.py
metsub.py
py
42,199
python
en
code
2
github-code
90
33458044824
# 19/06/2023 come back later and solve again, solved in O(n^2) using bubble sort due to tutorial from typing import List import copy class Solution: def heightChecker(self, heights: List[int]) -> int: originalHeights = copy.deepcopy(heights) heightsLength = len(heights) - 1 sortingComplet...
Samuel-Black/leetcode
height-checker.py
height-checker.py
py
961
python
en
code
0
github-code
90
22346814215
"""Test pysetl.workflow.stage module.""" from tempfile import TemporaryDirectory import pytest from pyarrow.fs import FileType from pyspark.sql.types import StringType from pyspark.sql import Row, SparkSession from typedspark import DataSet, Column, Schema from pysetl.workflow import Stage, Factory from pysetl.workflow...
JhossePaul/pysetl
tests/workflow/test_stage.py
test_stage.py
py
3,783
python
en
code
0
github-code
90
34972759686
#import numpy as np import roles import Infrastructure.graph as graph class Resistor(roles.Connector): def __init__(self, r, *args, **kwargs): super(Resistor, self).__init__(*args, **kwargs) self._resistance = r def _dotRepr(self): nodeName=self._dotName()+"_rect" entries=[] node=...
Matthew-Everitt/LogicSim
src/resistor.py
resistor.py
py
597
python
en
code
0
github-code
90
4907060017
import requests from spacy.language import Language from spacy.tokens import Doc, Span, Token @Language.factory( "corefserve", default_config={ "url": "http://localhost:1080/predictions/tuba10_electra_uncased_512_3" }, ) def statementFactory(nlp, name, url): return CorefServe(url) class Core...
fynnos/quite
quite/corefserve.py
corefserve.py
py
2,674
python
en
code
0
github-code
90
27693431464
""" Dual pointer Time Complexity: O(N) Space Complexity: O(1) """ class Solution: def exchange(self, nums: list) -> list: odd_pointer = 0 even_pointer = len(nums) - 1 while odd_pointer < even_pointer: if nums[odd_pointer] % 2 == 0: if nums[even_pointer] % 2 != ...
xyzacademic/LeetCode
offer100/21InverseOddEven/solution_1.py
solution_1.py
py
653
python
en
code
0
github-code
90
17984683469
s = input() a_z = [chr(i) for i in range(97, 97 + 26)] ans = len(s) for alp in a_z: cnt = 0 step = 0 for char in s: if char == alp: cnt = max(cnt, step) step = 0 else: step += 1 ans = min(max(cnt, step), ans) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03687/s623393943.py
s623393943.py
py
288
python
en
code
0
github-code
90
72071244778
# -*- coding: utf-8 -*- # UTF-8 encoding when using korean """틀림""" import sys from collections import defaultdict, deque def sysinput(): return sys.stdin.readline().rstrip() sysprint = sys.stdout.write n, m, k = map(int, sysinput().split()) islands = defaultdict(list) for _ in range(m): a, b = map(int, sysinput()....
dig04214/python-algorithm
challenge/7/7_3.py
7_3.py
py
840
python
en
code
0
github-code
90
16046210285
# -*- encoding=utf-8 -*- import pygame from pygame.locals import * import config import sys import numpy as np class Game(object): render_ed = False def __init__(self): pygame.init() self.clock = pygame.time.Clock() self.screen = pygame.display.set_mode(config.SCREEN_SIZE) ...
lichengzhang2005/deeplearning-pygame-dqn
dqn/bak.game.py
bak.game.py
py
4,459
python
en
code
0
github-code
90
5359752116
import http.client import logging import json from urllib.parse import urlencode import hashlib import os import time from datetime import date from pymongo import MongoClient, GEO2D API_HOST = "www.map.gortransperm.ru" API_PATH = "/json/" API_REQUEST_RATE = 60 # Per minute HTTP_CLIENT_IDLE = 1000 # In msec HTTP_MA...
code-in-ru/c-trans
collectors/bus_tracking.py
bus_tracking.py
py
3,176
python
en
code
1
github-code
90
74171082537
from dataclasses import dataclass from openpyxl import Workbook wb = Workbook() sheet = wb.active @dataclass class People(): name:str no: int age: int p = [People('steve',1,28), People('Raju',2,34),People('Rahul',3,25)] data = [[p.name,p.no,p.age]for p in p] for d in data: sheet.append(d) print(p) w...
OmPhani/AdvPython
Marksproblem/phani.py
phani.py
py
374
python
en
code
0
github-code
90
16649832682
import torch import torch.nn as nn from utils import lengths_to_masks class CRF(nn.Module): def __init__(self, input_size, num_tags): super(CRF, self).__init__() self.num_tags = num_tags self.emission = nn.Linear(input_size, num_tags) self.transition = nn.Parameter(torch.FloatTenso...
AutismNLP/Semeval2020-Task5-Subtask2
BertCRF/crf.py
crf.py
py
6,335
python
en
code
0
github-code
90
15182410941
__all__ = ["train", "TrainArguments", "Record", "create_loss"] import pprint import random import pathlib import functools import itertools import logging import logging.config from dataclasses import dataclass, field from typing import Optional, Sequence, ClassVar import yaap import inflect import torch import torch...
kaniblu/vhda
train.py
train.py
py
22,118
python
en
code
1
github-code
90
35511639320
# 给钉钉发送通知 """ 这段代码下发给钉钉的消息太单一了 """ from dingtalkchatbot.chatbot import DingtalkChatbot import time def send_message(message): """和钉钉关联起来,给钉钉的群发消息""" # WebHook地址 webhook = '{Webhook 地址}' # 在{Webhook 地址}填入钉钉的Webhook 地址 # 初始化机器人 xiaoding = DingtalkChatbot(webhook) # 当前时间 now_time = time.str...
biao-666/Gittest
daka.py
daka.py
py
881
python
zh
code
0
github-code
90
35169075817
import pandas as pd import numpy as np from matplotlib import image as mpimg import matplotlib.pyplot as plt df = pd.read_csv('GrowLocations.csv') df.columns = ['Serial', 'Longitude','Latitude','Type','SensorType','Code','BeginTime','EndTime'] # printing the dataframe # print(df) #df.to_csv('cleanheader_data.cs...
Midhunomanakuttan/python2assignment
python2final.py
python2final.py
py
1,502
python
en
code
0
github-code
90
72641507496
from app import db, login_manager from flask import Flask,render_template, redirect, url_for, request, Response, make_response, current_app import time, os, copy, datetime, sys, csv, zipfile from io import BytesIO, StringIO def get_records(): from_date_str = request.args.get('from', time.strftime( ...
priyana-pradipta/TugasAkhir_Dashboard
app/home/main.py
main.py
py
7,513
python
en
code
0
github-code
90
636200972
from sklearn.pipeline import Pipeline from pre_processor import * from pre_processor_extended import * # %% Load data from spreadsheet. # prices = pd.read_excel('data/Q2_train_set.xlsx') # pd.to_pickle(prices, 'raw/Q2_train_set.pkl') # %% Load data from binary. car_features = pd.read_pickle('raw/Q1_train_set.pkl') pr...
Grantcheng/2021-Mathor-Cup-A
Q2_pre_processing.py
Q2_pre_processing.py
py
3,703
python
en
code
0
github-code
90
22325614475
# -*- coding: utf-8 -*- 2 from numpy import * def loadDataSet(filename,delim='\t'): fr = open(filename) stringArr = [line.strip().split(delim) for line in fr.readlines()] datArr = [map(float,line) for line in stringArr] return mat(datArr) # dataMat:进行PCA操作的数据集 # topNfeat:可选参数,即应用的N个特征 def pca(dataMat...
shangschun/Machine-Learning
PCA/pca.py
pca.py
py
3,087
python
en
code
0
github-code
90
21318435280
from django.urls import path from . import views app_name = 'TC' urlpatterns = [ path('', views.preprocessing, name='preprocessing'), path('clustering/', views.clustering, name='clustering'), path('classification/', views.classification, name='classification'), path('checker_page/', views.checker_pag...
Adika-13/KP
TC/urls.py
urls.py
py
418
python
en
code
0
github-code
90
2527650178
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #自动将crash处理成对应的人 #现阶段只处理主版的crash import os import sys import time import re from operator import itemgetter, attrgetter #默认地址 #包含各种model的地址 defaultStartPath = ["app/src/main/java/"] pakageName = "pakageName" #获取输入参数 def getPath(): if len(sys.argv) == 1: p...
cuijin007/crashemiter
generateCrash.py
generateCrash.py
py
3,722
python
en
code
9
github-code
90
6635347430
import os import sys import jack_tokenizer as jt import jack_compilation_engine as jce from pathlib import Path import glob class JackCompiler: def __init__(self, jack_file): self.jack_file = jack_file if os.path.isdir(jack_file): self.jack_files = list(glob.glob(f"{jack_file}/*.jack")...
actuary/jack_analyzer
jack_analyzer/jack_compiler.py
jack_compiler.py
py
1,079
python
en
code
0
github-code
90
1087773874
import pymysql class DAOPagos: def connect(self): return pymysql.connect("localhost","root","","uirusu" ) def read(self, id): con = DAOPagos.connect(self) cursor2 = con.cursor() try: if id == None: cursor2.execute("SELECT * FROM pagos order by cvv a...
silas21k/proy
dao/DAOPagos.py
DAOPagos.py
py
1,865
python
en
code
0
github-code
90
38467704609
from __future__ import with_statement import os import time import logging import platform import psutil from supervisor import childutils, states from metrics.metricsconnector import MetricsConnector from txstatsd.process import ( report_file_stats, report_counters, report_system_stats, parse_meminfo, pars...
stevegood/filesync-server
lib/ubuntuone/monitoring/stats_worker.py
stats_worker.py
py
5,055
python
en
code
7
github-code
90
4295918992
""" This script is an example of Sigma VAE training in PyTorch. The code was adapted from: https://github.com/pytorch/examples/blob/master/vae/main.py """ import argparse import os import torch from torch import optim from torch.utils.tensorboard import SummaryWriter from torchvision import datasets, transforms from to...
ss555/deepFish
VAE/vae/train_vae.py
train_vae.py
py
7,415
python
en
code
0
github-code
90
18288344119
#!/usr/bin/env python3 import sys from itertools import chain # import numpy as np # from itertools import combinations as comb # from bisect import bisect_left, bisect_right, insort_left, insort_right # from collections import Counter def solve(N: int, M: int, P: "List[int]", S: "List[str]"): ac = [0] * N w...
Aasthaengg/IBMdataset
Python_codes/p02802/s677795730.py
s677795730.py
py
995
python
en
code
0
github-code
90
14293618800
import enum from collections import namedtuple class Player(enum.Enum): black = 1 white = 2 @property def other(self): return Player.black if self == Player.white else Player.white class Point(namedtuple('Point', 'row col')): def neighbors(self): return [ Point(self....
konstantinche36/go
dlgo/gotypes.py
gotypes.py
py
732
python
en
code
0
github-code
90
42460140658
# Метод __getattr__ выполняет операцию получения ссылки на атрибут. Если говорить # более определенно, он вызывается с именем атрибута в виде строки всякий # раз, когда обнаруживается попытка получить ссылку на неопределенный (несуществующий) атрибут. class empty: def __getattr__(self, attrname): if attrname == 'age...
alex-markov-creator/universal_tools_for_developer
Testing/Tools_example/Перегрузка операторов/__getattr__.py
__getattr__.py
py
618
python
ru
code
0
github-code
90
29880691835
''' 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 你可以假设数组中无重复元素。 示例 1: 输入: [1,3,5,6], 5 输出: 2 示例 2: 输入: [1,3,5,6], 2 输出: 1 示例 3: 输入: [1,3,5,6], 7 输出: 4 示例 4: 输入: [1,3,5,6], 0 输出: 0 ''' # by myself class Solution: def searchInsert(self, nums, target): lens = len(nums) for i in range(l...
PhenixZhang/python-Leetcode
35-Search Insert Position.py
35-Search Insert Position.py
py
1,413
python
en
code
2
github-code
90
39972060206
import socket mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mySocket.connect(('data.pr4e.org', 80)) cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n'.encode() mySocket.send(cmd) while True: data = mySocket.recv(512) if(len(data) < 1): break print(data.decode()) mySocket.close...
aysedemirel/python-journey
freeCodeCamp/01-scientific-computing-with-python/src/10-networking_socket.py
10-networking_socket.py
py
952
python
en
code
3
github-code
90
18444224239
import sys def input(): return sys.stdin.readline()[:-1] def gcd(a,b): if b == 0: return a return gcd(b,a%b) def main(): N = int(input()) A = list(map(int,input().split())) ans = A[0] for e in A[1:]: ans = gcd(ans,e) print(ans) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03127/s860449207.py
s860449207.py
py
315
python
en
code
0
github-code
90
4868098051
import cv2 import imutils import argparse # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--input", required=True, help="name of the image") args = vars(ap.parse_args()) # read the image image = cv2.imread(args["input"]) # resize the image resized = imutil...
yasinturkmenogluu/Image-Processing
Shape_and_Center_Detection/main.py
main.py
py
1,936
python
en
code
0
github-code
90
8530054388
import logging import os from flask import Flask, request, jsonify app = Flask(__name__) app_logger = logging.getLogger(__name__) app_logger.setLevel(logging.DEBUG) @app.route("/api", methods=["GET"]) def Default(): return "Hello Deer" @app.route("/api/save-location", methods=["GET"]) def save_location(): ap...
Alqama-Rao/Portfolio
app.py
app.py
py
1,164
python
en
code
0
github-code
90
44809105146
def read_gfile(g_file: str, limiter: str = None): from pleque.io import _geqdsk import numpy as np import xarray as xr from pleque.core import Equilibrium from scipy.interpolate import UnivariateSpline with open(g_file, 'r') as f: eq_gfile = _geqdsk.read(f) psi = eq_gfile['psi'] ...
kripnerl/pleque
pleque/io/_test_gfile_loader.py
_test_gfile_loader.py
py
2,307
python
en
code
14
github-code
90
18093693030
#!/usr/bin/env python # coding: utf-8 # In[ ]: import csv from typing import final import matplotlib.pyplot as plt import pandas as pd import math import numpy as np from scipy.stats import linregress import scipy import datetime import time col_names = ['Date', 'Time', 'Pressure', ...
mica-92/ICE
Qi2017/Past Files/CDII.py
CDII.py
py
6,000
python
en
code
0
github-code
90
32784353157
from flask import render_template, Blueprint import logging from json import dumps from app.api.criteria import CRITERIONS, get_all_criterions from app.mongo_odm import CriterionDBManager from app.lti_session_passback.auth_checkers import is_admin routes_criterion = Blueprint( 'routes_criterion', __name__, url_p...
OSLL/web_speech_trainer
app/routes/criterions.py
criterions.py
py
1,520
python
en
code
3
github-code
90
2625090045
from datetime import datetime, timedelta class Previsao: def __init__(self,aerodromo): self.aerodromo = aerodromo self.dias = {} def setTurnos(self, turnos, duracao): self.turnos = turnos self.duracao = duracao def parseVoos(self, voos): for voo in voos: ...
saviobatista/siros
lib/previsao.py
previsao.py
py
3,755
python
pt
code
1
github-code
90
18587821819
import collections N = int(input()) a = list(map(int,input().split())) B = collections.Counter(a) ans = 0 for i in set(a): if B[i] < i: ans += B[i] else: ans += B[i]-i print(ans)
Aasthaengg/IBMdataset
Python_codes/p03487/s821729538.py
s821729538.py
py
202
python
en
code
0
github-code
90
31228761122
# -*- coding: utf-8 -*- from numpy import sqrt as npsqrt from .variance import variance from ..utils import get_offset, verify_series def stdev(close, length=None, offset=None, **kwargs): """Indicator: Standard Deviation""" # Validate Arguments close = verify_series(close) length = int(length) if lengt...
RoveAllOverTheWorld512/hyb_ta
build/lib/pandas_ta/statistics/stdev.py
stdev.py
py
1,161
python
en
code
3
github-code
90
18329780879
def main(): n = int(input()) inlis = list(map(int, input().split())) ans = 0 for i in range(n): for j in range(n): if i < j: ans += inlis[i] * inlis[j] print(ans) if __name__ == "__main__": main()
Aasthaengg/IBMdataset
Python_codes/p02886/s053034839.py
s053034839.py
py
272
python
en
code
0
github-code
90
18413980569
import sys import math import itertools import collections from collections import deque from collections import defaultdict sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 MOD2 = 998244353 INF = float('inf') input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split(...
Aasthaengg/IBMdataset
Python_codes/p03061/s374856681.py
s374856681.py
py
845
python
en
code
0
github-code
90
18295865359
import math def prime_check(x): if x == 2: return True limit = math.floor(math.sqrt(x)+1) cnt = 0 for i in range(2,limit): if x%i == 0: cnt += 1 if cnt == 0: return True else: return False X = int(input()) while True: if prime_check(X): print(X) break else: X += 1
Aasthaengg/IBMdataset
Python_codes/p02819/s032052678.py
s032052678.py
py
319
python
en
code
0
github-code
90
43740093771
""" Test the utils module. """ import jax.numpy as np from numpy.testing import assert_array_equal from swarmrl.utils.utils import ( calc_signed_angle_between_directors, gather_n_dim_indices, ) class TestUtils: """ Test suite for the utils. """ def test_gather_n_dim_indices(self): ""...
christophlohrmann/SwarmRL
CI/unit_tests/utils/test_utils.py
test_utils.py
py
4,380
python
en
code
5
github-code
90
18571619949
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) dp=[[0 for i in range(n)] for j in range(2)] dp[0][0]=a[0] for i in range(1,n): dp[0][i]=a[i]+dp[0][i-1] dp[1][0]=dp[0][0]+b[0] for i in range(1,n): dp[1][i]=max(dp[0][i],dp[1][i-1])+b[i] print(dp[1][n-1])
Aasthaengg/IBMdataset
Python_codes/p03449/s744864063.py
s744864063.py
py
296
python
en
code
0
github-code
90
22356423045
#from data import data from operator import itemgetter from functools import wraps from flask import Flask, flash, render_template, redirect, url_for, session, make_response, request, config, jsonify from authlib.integrations.flask_client import OAuth from flask_wtf.csrf import CSRFProtect from flask_cors import CORS, ...
jukkajo/Fullstack-tulospalvelu
Backend/main.py
main.py
py
8,774
python
fi
code
0
github-code
90
23131027382
from django import forms from shop.models import Address from .models import Order class OrderCreateForm(forms.ModelForm): address = forms.ModelChoiceField( widget=forms.RadioSelect, queryset=None, empty_label=None, label='Select your address for shipping', ) ...
chromium7/mangovodo
orders/forms.py
forms.py
py
610
python
en
code
0
github-code
90
12752934667
from flask import Flask,request,jsonify import numpy as np import pickle import json app = Flask(__name__) @app.route("/") def homepage(): return '<h1> I am a Machine Learning Web</h1>' @app.route('/api/',methods =['POST']) def makecalc(): data = request.get_json() prediction = np...
Locchuong96/backend
Flask/flask_MachineLearning/server.py
server.py
py
581
python
en
code
3
github-code
90
42006681901
import math import random from typing import List, Tuple from shor.gates import CNOT, CSWAP, QFT, H, Rx, X from shor.layers import Qubits from shor.quantum import Circuit def factor(N: int) -> Tuple[int, int]: """WIP not currently functioning. The classical part seems to be correct, but the quantum period f...
KhomZ/RSA-encryption-Project
RSA_encrypt_venv/lib/python3.9/site-packages/shor/algorithms/shor.py
shor.py
py
3,553
python
en
code
1
github-code
90
18296580899
# coding: utf-8 from math import sqrt def main(): X = int(input()) for i in range(X, 100004): tmp = int(sqrt(i)) flg = False for j in range(2, tmp + 1): if (i % j == 0): flg = True break if flg == False: ans = i ...
Aasthaengg/IBMdataset
Python_codes/p02819/s904847497.py
s904847497.py
py
383
python
en
code
0
github-code
90
35725644884
from tkinter import Tk from tkinter import ttk from tkinter import StringVar, BooleanVar from tkinter import messagebox from tkinter import simpledialog from tkinter import filedialog from tkinter import OptionMenu import matplotlib matplotlib.use("TkAgg") from matplotlib.figure import Figure from matplotlib.backends....
jatufin/ot-harjoitustyo
src/ui/jaturing_frame.py
jaturing_frame.py
py
27,517
python
en
code
1
github-code
90
12519087585
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' digits = '0123456789' base64_alphabet = ascii_uppercase + ascii_lowercase + digits + '+/' to_encode = input('Enter the Hex string : ') hex_string= to_encode.encode('utf-8').hex() bit_string = (((6 - len(bin(int(hex_string[0]...
oz9un/crypto_basics
conversions/convertHex2base64.py
convertHex2base64.py
py
1,109
python
en
code
7
github-code
90
22217489775
from numpy.random import default_rng import numpy as np from collections import Counter from utils import recommender_file_to_df, rating_file_to_df, read_gender_indicative_file, load_gender_vector def main(**kwargs): global L_m, L_f # items that are most correlated to males and females, respectively L_m, L_f...
ingebjrgb/master_delivery
Obfuscation.py
Obfuscation.py
py
11,000
python
en
code
0
github-code
90
41993162033
from __future__ import print_function, unicode_literals import io import os import sys import shutil import tarfile import tempfile import unittest import warnings import zipfile from reprounzip.common import RPZPack from reprounzip.signals import Signal class TestSignals(unittest.TestCase): def test_make_signa...
VIDA-NYU/reprozip
tests/test_reprounzip.py
test_reprounzip.py
py
9,130
python
en
code
285
github-code
90
41978229769
import ctypes import pytest c_lib = ctypes.CDLL('../solutions/0628-max-product/max-product.so') @pytest.mark.parametrize('array, ans', [([1,2,3], 6), ([1,2,3,4], 24), ([-1,-2,-3], -6)]) def test_max_product(array, ans): arr = (ctypes.c_int ...
msztylko/2020ify-leetcoding
tests/test_0628.py
test_0628.py
py
410
python
en
code
0
github-code
90
27923501707
heaps = [] for i in range(15): print("Enter heap {}: ".format(i)) heaps.append(int(input())) while(True): xored = 0 for i in range(15): xored ^= heaps[i] print(heaps) print(xored) min = 15 for i in range(15): newXored = xored^heaps[i] if (newXored < heaps[i]): ...
arty-hlr/CTF-writeups
2018/XMAS/ultimate_game/nim_sum.py
nim_sum.py
py
713
python
en
code
1
github-code
90
27062626310
import config import numpy as np import tensorflow as tf import matplotlib.pyplot as plt def plot_history(history, key, model_name): #history = history.tolist() # when reading from file fig = plt.figure() fig.suptitle(f'Results for {model_name}', fontsize=15) fig.subplots_adjust(hspace=0.4, t...
mohilbajaj2002/malaria_parasite_detection
utilities.py
utilities.py
py
2,578
python
en
code
0
github-code
90
28437619815
# 딥러닝 기본기 다지기 # ch 10. 모델 설계하기 from keras import metrics import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense import matplotlib.pyplot as plt np.random.seed(3) tf.random.set_seed(3) Data_set = np.loadtxt("https://raw.githubusercontent....
Myul23/Deep-Learning-for-everyone
1-10. 딥러닝 준비 운동/10.py
10.py
py
1,567
python
ko
code
0
github-code
90
34064621064
import rarfile import zipfile import shutil import glob import os import sys def test(): ###ここから下がおかしい ###空のzipファイルができてしまう now_folder = os.getcwd() files = os.listdir(now_folder) files_dirs = [f for f in files if os.path.isdir(os.path.join(now_folder, f))] for files_dir in files_dirs: #prin...
hako85hako/create_zip_from_rar
test.py
test.py
py
796
python
en
code
0
github-code
90
2380727757
brg = [] perintah = 0 while perintah != 7: print('''1.menambah 2.menghapus 3.mengedit 4.menampilkan 5.cari barang 6.cari index 7.keluar''') perintah = int(input("masukkan perintah yang di cari:")) if perintah == 1: while True: msk = input("masukkan barang:") brg.append(msk) print("barang masuk:",b...
amriwahab01/tugas_kuliah
kasusu listt.py
kasusu listt.py
py
1,288
python
id
code
0
github-code
90
41685447638
# LeetCode Problem Title : 14. Longest Common Prefix # LeetCode Problem Link : https://leetcode.com/problems/longest-common-prefix/ # Solution Explanation : https://youtu.be/qyTIu2vfWq4 class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: n = len(strs) if (n < 2): ...
shaheershukur/LeetCode-Python-Solutions
Python Solutions/14. Longest Common Prefix.py
14. Longest Common Prefix.py
py
767
python
en
code
0
github-code
90
17299201376
import win32gui import win32api from win32con import * from ui.core.UIManager import XUIManager XEVT__FIRST = WM_USER + 1 XEVT_MOUSEMOVE = WM_USER + 2 XEVT_MOUSELEAVE = WM_USER + 3 XEVT_MOUSEENTER = WM_USER + 4 XEVT_MOUSEHOVER = WM_USER + 5 XEVT_KEYDOWN = WM_USER + 6 XEVT_KEYUP = WM_USER + 7 XEVT_CHAR = WM_USER + 8 X...
xugangjava/PydUI
ui/control/Base.py
Base.py
py
6,409
python
en
code
2
github-code
90
6945679202
""" 1 - Crie uma função que exibe uma saudação com os parâmetros saudacao e nome. """ def mensagem(saudacao, nome): print(f'{saudacao}, {nome}') mensagem('Olá','Jessica') """ 2 - Crie uma função que recebe 3 números como parâmetros e exiba a soma entre eles; """ def numero(num1, num2, num3): print(num1 + num2 +...
JessicaPortilio/Python-Intermediario
Desafio1/aula2.py
aula2.py
py
1,392
python
pt
code
0
github-code
90
44664792023
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from app.models import Department, Doctor @admin.register(Department) class DepartmentAdminWithCount(admin.ModelAdmin): def doctor_count(self, obj): return obj.doctors.count() list_display = ["name",] list_filter = ...
Evgeniy994/Hospital
app/admin.py
admin.py
py
787
python
en
code
0
github-code
90
36271031627
import requests as r from mtgorp.db.load import Loader as DbLoader from mtgorp.models.persistent.printing import Printing from magiccube.collections.cube import Cube from misccube.cubeload.load import CubeLoader class Pricer(object): @classmethod def price_printing(cls, printing: Printing) -> float: uri = f'h...
guldfisk/misccube
misccube/cubeprice/cubeprice.py
cubeprice.py
py
946
python
en
code
0
github-code
90
22619634015
import pytest from tempfile import NamedTemporaryFile import numpy as np import h5py from foamstream.tomo.app import ( gen_fake_data, gen_index, sentinel, stream_data_file ) def test_gen_index_ordered(): ret = [] for i in gen_index(0, 5): ret.append(i) assert ret == [0, 1, 2, 3, 4] def tes...
zhujun98/foamstream
foamstream/tomo/tests/test_tomo_app.py
test_tomo_app.py
py
3,151
python
en
code
0
github-code
90