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
74377298215
import key_transformator import random import string # header: 137, 80, 78, 71, 13, 10, 26, 10 # encrypted: 200, 10, 1, 3, 79, 81, 74, 79 # key: 65, 90, 79, 68, 66, 91, 80, 69 key_length = 4 def generate_initial_key(): return ''.join(random.choice(string.ascii_uppercase) for _ in ra...
zvikam/Checkpoint-CSA
2018/png++/encrypt.py
encrypt.py
py
994
python
en
code
1
github-code
90
632553252
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: Arne F. Meyer <arne.f.meyer@gmail.com> # License: GPLv3 """ Run motion registration on video file(s) """ from __future__ import print_function import click import sys import os import os.path as op import glob import numpy as np import matplotlib.pyplot a...
arnefmeyer/mousecam
mousecam/scripts/motion_registration.py
motion_registration.py
py
6,890
python
en
code
21
github-code
90
18103826259
import math def prime_array(n=1000): List = [2] i = 3 while i <= n: judge = True for k in List : if math.sqrt(i) < k : break if i%k == 0: judge = False break if judge : List.append(i) i += 2 return List def main(): cnt=0 prime_List=prime_array(10**4) n=input() for i in range(n): a...
Aasthaengg/IBMdataset
Python_codes/p02257/s053793174.py
s053793174.py
py
568
python
en
code
0
github-code
90
70098420777
# -*- coding: utf-8 -*- import requests import re import scrapy from ..items import MJItem from bs4 import BeautifulSoup from scrapy.loader import ItemLoader class onem3point(scrapy.Spider): # 注释-必须字段,爬虫名,scrapy list命令行会列出name name = 'mj_spider' # 注释-必须字段,允许的爬取的url域名,如果url中域名不是这段不进行爬取。这里是python的列表类型,可以...
emmazh507/1m3Spider
onem3_spider/spiders/1m3spider.py
1m3spider.py
py
2,940
python
en
code
0
github-code
90
15410568513
#!/usr/bin/env python # coding: utf-8 # In[195]: import requests from bs4 import BeautifulSoup import pandas as pd import json import gspread from datetime import date # In[196]: def update(value_df): sheet_id = '1x4A_IVSNKxa08qvViYp4KuG9Of7UuEbqcWllPk0i7fk' sheet_name = 'tripadvisor' gc = gspread.s...
Popoben240/cashback
shopback.py
shopback.py
py
2,439
python
en
code
0
github-code
90
16830417920
import unittest import zipfile from StringIO import StringIO import tempfile import shutil import boto3 import dill import moto import mock import pip from easy_lambda.deployment import Lambda, DeploymentPackage @moto.mock_lambda class Test(unittest.TestCase): def setUp(self): super(Test, self).setUp() ...
ZhukovAlexander/lambdify
tests/test_lambda.py
test_lambda.py
py
1,951
python
en
code
50
github-code
90
9914016198
# -*- coding: UTF-8 -*- # Interstitial Error Detector # Version 0.2, 2013-08-28 # Copyright (c) 2013 AudioVisual Preservation Solutions # All rights reserved. # Released under the Apache license, v. 2.0 # Created on May 14, 2014 # @author: Furqan Wasi <furqan@avpreserve.com> from PySide.QtCore import * from ...
WeAreAVP/interstitial
GUI/DirsHandlerGUI.py
DirsHandlerGUI.py
py
7,085
python
en
code
9
github-code
90
74785440937
from collections import defaultdict class Graph(): def __init__(self): self.graph=defaultdict(list) def addEdge(self,u,v): self.graph[u].append(v) self.graph[v].append(u) def findWeight(self,node,visited): visited[node]=True net_weighht=0 to_return=-9999999...
codejigglers/leetcodes
preparation/Graphs/city_problem_find_max_of_all.py
city_problem_find_max_of_all.py
py
910
python
en
code
0
github-code
90
4949564708
import sys from collections import deque input = sys.stdin.readline d = [(0,1),(0,-1),(1,0), (-1,0)] if __name__ == '__main__': t = int(input()) for _ in range(t): v,e = map(int, input().split()) print(2-v+e)
sumi-0011/algo
백준/Bronze/10569. 다면체/다면체.py
다면체.py
py
250
python
en
code
0
github-code
90
36678324523
import responses from django.test import TestCase from django.contrib.auth import get_user_model from django.db.models.signals import post_save from unicoremc.managers.infrastructure import ( GeneralInfrastructureManager, InfrastructureError) from unicoremc.models import Project, AppType, publish_to_websocket fr...
universalcore/unicore-mc
unicoremc/tests/test_infrastructure_manager.py
test_infrastructure_manager.py
py
5,006
python
en
code
0
github-code
90
17544018347
import numpy as np def sk_50_rand_params(): """hyperparameters for random sk graph with size N=50""" sk_50_rand_dic = { "num_runs" : 1, "num_timesteps_per_run" : 2500, "cac_time_step" : 0.04, "cac_r" : 0.3, "cac_alpha" : 0.7, "cac_beta" : 0.25, "cac_gamma...
mcmahon-lab/cim-optimizer
cim_optimizer/optimal_params.py
optimal_params.py
py
3,248
python
en
code
21
github-code
90
73616381098
# coding=utf-8 # --------------------------------------------------------------- # Desenvolvedor: Arannã Sousa Santos # Mês: 12 # Ano: 2015 # Projeto: pagseguro_xml # e-mail: asousas@live.com # --------------------------------------------------------------- import loggin...
arannasousa/pagseguro_xml
pagseguro_xml/tests/test_classes_assinatura/test_requisicao_v2.py
test_requisicao_v2.py
py
6,104
python
en
code
0
github-code
90
5250675231
import argparse from utils.atari_util import * from utils.utils import * from models.self_attn_cnn_gru import * import torch import yaml import gym.wrappers import os def parse_args( ) -> argparse.Namespace: parser = argparse.ArgumentParser() parser.add_argument("--config_path", type=str, default=None, help=...
phesla/pomdp_rnn_for_atari_games
cli/test.py
test.py
py
2,014
python
en
code
1
github-code
90
10865477422
""" documents.py Created by Zongsi Zhang, 09/12/2017 """ import copy import math import operator class Document(object): """ One Document correspondes to a web page, it stores a dictionary of words' count Attributes: term_dict: a dictionary records terms and its count in webpage links: a list of url current pa...
zongsizhang/TopicExtracter
documents.py
documents.py
py
3,964
python
en
code
0
github-code
90
24726867189
# which is a neural network model for the sentiment evaluation, which based on a deeply cleaned token list # deprecated # begin crafting the neural models # in order to represent a meaningful model, a lower-level framework should be used TRAIN_PICK='train.pickle'; TEST_PICK='test.pickle'; NORM_TRAIN_PICK='norm_tr...
ravenSanstete/duality
duality/nn_model.py
nn_model.py
py
3,278
python
en
code
0
github-code
90
18473808859
N, x = map(int, input().split()) n = [1] p = [1] for i in range(1, N+1): n.append(n[-1] * 2 + 3) p.append(p[-1] * 2 + 1) lev = N n1 = [0, 1, 2, 3, 3] ans = 0 while lev >= 0: if lev ==0: ans += 1 break if n[lev]//2 + 2 <= x: ans += p[lev-1] + 1 x -= n[lev-1] + 2 ...
Aasthaengg/IBMdataset
Python_codes/p03209/s473964939.py
s473964939.py
py
452
python
en
code
0
github-code
90
72587044776
# -*- coding: utf-8 -*- import torch import torch.nn as nn from .other.layers import unetConv2 class UNet3plus(nn.Module): ''' UNet 3+ ''' def __init__(self, in_channels=3, n_classes=1, feature_scale=4, is_deconv=True, is_batchnorm=True): super(UNet3plus, self).__init__() self.is_deconv = is_d...
FengheTan9/Medical-Image-Segmentation-Benchmarks
src/network/conv_based/UNet3plus.py
UNet3plus.py
py
12,072
python
en
code
36
github-code
90
18496641579
def main(): n = int(input()) data = [input() for _ in range(n)] ok = True if len(set(data)) != n: ok = False for i in range(n-1): if data[i][-1] != data[i+1][0]: ok = False print("Yes" if ok else "No") main()
Aasthaengg/IBMdataset
Python_codes/p03261/s847915531.py
s847915531.py
py
255
python
en
code
0
github-code
90
38421845489
import os import sys from tqdm import tqdm from tensorboardX import SummaryWriter import shutil import warnings warnings.filterwarnings('ignore') import argparse import logging import torch.nn as nn from torch.nn.modules.loss import CrossEntropyLoss import torch.optim as optim from torchvision import transforms import ...
ortonwang/PLGDF
code/train.py
train.py
py
18,053
python
en
code
1
github-code
90
70035545577
"""Test both structuring and unstructuring.""" from dataclasses import MISSING, dataclass, fields, make_dataclass from typing import Optional, Union import pytest from hypothesis import assume, given from hypothesis.strategies import sampled_from from convclasses import Converter, UnstructureStrategy, mod from . imp...
zeburek/convclasses
tests/metadata/test_roundtrips.py
test_roundtrips.py
py
4,087
python
en
code
3
github-code
90
19981809252
import xlrd def read_excel(): f = xlrd.open_workbook('D:\\IPsave.xls') mysheet = f.sheets() mysheet1 = mysheet[0] mycol = mysheet1.col_values(0) mycol.pop(0) print(mycol) if __name__ == '__main__': read_excel()
yaunsine/Python3
read_IP.py
read_IP.py
py
253
python
en
code
1
github-code
90
25749040204
#!encoding:utf-8 import scrapy import re import os import json import pymysql from datetime import datetime from sina_crawler.items import SinaCrawlerItem from scrapy.selector import Selector class SinaCrawlerSpider(scrapy.Spider): '''Spider: crawling financial news starting from sina The SinaCrawlerSp...
wzyxwqx/OriginalTech
Crawler/sina_crawler/sina_crawler/spiders/sina_crawler_spider.py
sina_crawler_spider.py
py
5,234
python
en
code
0
github-code
90
18362593499
n,k=map(int,input().split()) a=list(map(int,input().split())) s=sum(a) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors l=make_d...
Aasthaengg/IBMdataset
Python_codes/p02955/s770273402.py
s770273402.py
py
709
python
en
code
0
github-code
90
18211724849
from collections import deque n,m = map(int,input().split()) load = [list(map(int,input().split())) for _ in range(m)] goal = [[] for _ in range(n)] for i in load: goal[i[0]-1].append(i[1]-1) goal[i[1]-1].append(i[0]-1) q = deque([0]) ans = [-1 for _ in range(n)] ans[0] = 0 while q: check = q.popleft() ...
Aasthaengg/IBMdataset
Python_codes/p02678/s761170327.py
s761170327.py
py
521
python
en
code
0
github-code
90
19349296177
import numpy as np import plotly.graph_objects as go import plotly.express as px from . import plot_utils ####################################################################################################################### def scatter_geo(ds, prop="pressure", stat="count", title=None, cmap="ylorrd"): """ P...
udiy/udidata
udidata/plot/plot.py
plot.py
py
5,542
python
en
code
0
github-code
90
28171479357
""" Django settings for electron_pdf project. """ import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '%f=rv%f*qgq%k@14-l9f5si6e98pp0+p9jvsf*nfc-9q3x=7oq' DEBUG = True # Application definition INSTALLED_A...
namespace-ee/django-electron-pdf
electron_pdf/settings.py
settings.py
py
1,299
python
en
code
7
github-code
90
19324354423
from flask import Flask, render_template, request, redirect, url_for from store_management_system import StoreManagementSystem app = Flask(__name__) inventory_file = "inventory.json" store = StoreManagementSystem(inventory_file) @app.route("/", methods=["GET"]) def index(): inventory = store.display_in...
sarthaknimbalkar/Store-Management-system
app.py
app.py
py
1,958
python
en
code
0
github-code
90
4880499024
from fileinput import filename import json from fpdf import FPDF pdf = FPDF('P', 'mm', 'Letter') pdf.add_page() with open('resume.json') as resume: data = json.load(resume) pdf.ln(5) pdf.set_font("times", 'B', 16) pdf.cell(200, 6, data['Name'], ln=1) pdf.set_font("times", '', 11) pdf.cell(0, 5, data['ContactNo'...
yanlahlopez/Assignment-9
resume1.py
resume1.py
py
2,008
python
en
code
1
github-code
90
13872908025
# -*- coding: utf-8 -*- """ PHYS 512 Assignment 2 Problem 1 @author: James Nathan White (260772425) """ #I always import this stuff import matplotlib.pyplot as plt import random as r import glob import numpy as np from scipy.stats import chi2 import scipy.optimize as opt from scipy.stats import norm impor...
jwhitebored/PHYS-512
Assignment 2/PHYS 512 Assignment 2 P1 Draft Final.py
PHYS 512 Assignment 2 P1 Draft Final.py
py
6,803
python
en
code
0
github-code
90
23535041085
B1 = (2,2,3) B2 = (1,0,4) Bs = [B1,B2] start_i = B1[i][1] start_j = B2[j][1] j = cont i = cont + 1 rooms_i = Bs[i][0] rooms_j = Bs[j][0] while i + j < 2*len(Bs): # Inicializacao # use start from some, walk in the same if start_j < start_i: if start > start_j: # keep same start pass else: start ...
vitorpbarbosa7/mit_6.006
psets/ps2-template/book_test.py
book_test.py
py
569
python
en
code
0
github-code
90
13245430630
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import math, copy from torch.autograd import Variable #from utils import * import torch import torch.nn as nn import numpy as np import torch np.random.seed(1337) torch.manual_seed(1337) torch.backends.cudnn.deterministic = True tor...
sergsb/IUPAC2Struct
transformer.py
transformer.py
py
8,020
python
en
code
25
github-code
90
2409144919
import json a = { "data_center_id": 1, "id": 12, "cus_brand_id": 63, "cus_brand_name": "0427 - 品牌 - 文琦", "cus_id": 111, "cus_name": "IP_带宽_机柜_01", "contact_id": 141, "contact_name": "IP_带宽_机柜_01", "contact_phone": "13454564522", "service_content": "设备 SN : 6F010311 设.位宜: R720 JJ...
ZainLiu/YXtest
客服工单/创建工单数据.py
创建工单数据.py
py
983
python
en
code
0
github-code
90
23470322307
# reverse_string.py s1 = "Forever Young" print(s1) s2 = "" for i in range(len(s1) - 1, -1, -1): s2 = s2 + s1[i] print(s2) s3 = "" for c in s1: s3 = c + s3 print(s3) print(s1[::-1])
dbiersach/scicomp101
Session 08 - Histograms and Code Breaking/instructor/reverse_string.py
reverse_string.py
py
193
python
en
code
0
github-code
90
18458661469
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) dif=sum(a)-sum(b) if dif<0: print(-1) elif dif==0: cnt=0 for i in range(n): if a[i]!=b[i]: cnt+=1 print(cnt) else: difference=[] count_0=0 for i in range(n): if a[i]-b[i]>0...
Aasthaengg/IBMdataset
Python_codes/p03151/s766024025.py
s766024025.py
py
651
python
en
code
0
github-code
90
18208617899
n = int(input()) a = list(map(int, input().split())) if a[0] != 0: if n == 0 and a[0] == 1: print(1) else: print(-1) exit() ruiseki = a[::-1] for i in range(1, n+1): ruiseki[i] += ruiseki[i-1] ruiseki = ruiseki[::-1] node = [1] komoti = [1] for i in range(1, n+1): ai = a[i] if...
Aasthaengg/IBMdataset
Python_codes/p02665/s930806016.py
s930806016.py
py
487
python
en
code
0
github-code
90
23881424246
class KeyStream(): def __init__(self): self.N = 256 self.key = [i for i in range(self.N)] self.i = 0 self.j = 0 self.counter = 0 self.factor = 256 def print(self): print(self.key) def reset(self): self.key = [i for i in range(self.N)] ...
farishasim/StegoRC4
cipher/rc4.py
rc4.py
py
2,430
python
en
code
0
github-code
90
1563919940
from SciStreams.config import validate_md def test_validate_md(): ''' Test it runs with some data we expect to test. Note validation is created from external yml file ''' vdict = dict( # name, type detector_SAXS_x0_pix="number", detector_SAXS_y0_pix="number", motor_...
CFN-softbio/SciStreams
SciStreams/tests/test_validate_data.py
test_validate_data.py
py
1,765
python
en
code
0
github-code
90
42717971776
import socket import os from tqdm import tqdm class Server: def __init__(self): self.connectionOpen = False self.connection = '' self.clientAddr = '' self.address = '' def close(self): self.connection.close() def listening(self, port, ip = ''): ...
Luksmito/mini_ftp_server
Classes/Servidor.py
Servidor.py
py
2,187
python
en
code
1
github-code
90
27968220352
import uuid import json import random from django.core.management.base import BaseCommand from users import models as user_models from locations import models as location_models from notifications import models as notification_models from django_seed import Seed from django.db.models.expressions import RawSQL from loca...
plusbeauxjours/pinner-backend
pinner/users/management/commands/mega_seed.py
mega_seed.py
py
23,337
python
en
code
0
github-code
90
35698852635
# This file computes the square root of a number x, with a given precision. x=19023192.0 # Debug value precision=0.000001 # Precision requested if x<0: print("Error: x<0") exit() if x==0: print("square root: 0") exit() error=1000.0 # 1st term Taylor series truncation approximation (iterative method) ### # A...
Pozidriv/Square-Root
sq_root.py
sq_root.py
py
1,145
python
en
code
0
github-code
90
3833273959
import pandas as pd from omnivector.abstraction import AbstractDB class LanceDB(AbstractDB): """ LanceDB is a vector database that uses Lance to store and search vectors. """ def __init__(self): super().__init__() def create_index(self): # not sure how to do this in Lance p...
vinid/omnivector
omnivector/lancedb.py
lancedb.py
py
1,303
python
en
code
0
github-code
90
40328493195
# -*- coding: utf-8 -*- # 安装mysql数据库:zy@ubuntu:~$ sudo apt-get install mysql-server mysql-client # 中间会让设置一次root用户的密码 # 安装python包:zy@ubuntu:~$ sudo pip3 install PyMySQL # http://www.runoob.com/python3/python3-mysql.html # 创建数据库 # 使用客户端Navicat for MySQL连接mysql数据库; # 新建数据库:file-> New Database # 设置数据库的名字: Database Name:...
gswyhq/hello-world
mysql/使用python3操作MySQL.py
使用python3操作MySQL.py
py
9,569
python
zh
code
9
github-code
90
31291403310
import os from tqdm import tqdm import csv import io from PIL import Image import numpy as np import matplotlib.pyplot as plt import zipfile from pathlib import Path import numpy as np import cv2 def load_data(file_path): with open(file_path, 'r') as csvfile: rows = list(csv.reader(csvfile, delimite...
southjohn64/ex2_dl
data_loader.py
data_loader.py
py
11,048
python
en
code
0
github-code
90
46067153669
import csv import pandas as pd tournaments = pd.read_csv('C:/Users/garye/Downloads/finaldf.csv') prize_money = pd.read_csv('C:/Users/garye/Downloads/prize_money.csv', encoding = 'latin1') #print(tournaments) #print(prize_money.title) count =0 csv_file = open('tournamentIndex.csv','w', newline=''...
GaryKellyIT/Visualising-Data
Data_Vis_Assignment1/Python/indexMatcher.py
indexMatcher.py
py
805
python
en
code
0
github-code
90
19949440636
import psycopg2 , csv from config import host,database,user,password conn = psycopg2.connect( host= host ,user= user ,password=password ,database=database ) conn.autocommit = True cur = conn.cursor() cur.execute("""CREATE TABLE IF NOT EXISTS PhoneBook( id SERIAL PRIMARY KEY ,name VARCHAR(50) ...
dosymzhvnn/pp2-22B030169
tsis11/phonebook2.py
phonebook2.py
py
4,351
python
en
code
0
github-code
90
15456581036
from collections import namedtuple # Use with https://github.com/nidefawl/cpp-indexer cpp_index_file = "cpp-index.class.csv" def getDepthInTree(cpp_class_list, cpp_class): """ Calculate depth of hierarchy """ if len(cpp_class.baseclasses) == 0: return 0 depth = 0 for baseclass in cpp_class.ba...
nidefawl/bass-studio
scripts/cpp-index-find-final-classes.py
cpp-index-find-final-classes.py
py
4,048
python
en
code
74
github-code
90
22875896861
#! python3 # printTable.py - Takes a list of list of strings and displays it in # a well organised table (right-justified) tableData = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] def printTable(tableData): colWidth...
ssamjang/automatePython
printTable.py
printTable.py
py
952
python
en
code
0
github-code
90
18823863859
''' 指定した項目を更新する。 rating属性を削除する。 [Notes] rating属性が存在していなくてもエラーは吐かれない。(そのままスルー。) ''' from decimal import Decimal from pprint import pprint import json import boto3 def update_book(isbn, dynamodb=None): if not dynamodb: dynamodb = boto3.resource( 'dynamodb', endpoint_url="http://lo...
makes-trail/application-sample
dynamodb/crud/BooksItemUpdate04.py
BooksItemUpdate04.py
py
926
python
ja
code
0
github-code
90
25908853037
from pyModbusTCP.server import ModbusServer, DataBank from time import sleep from random import uniform #Create an Instance of ModbusServer server=ModbusServer("127.0.0.1",502,no_block=True) try: print("Server Starting....") server.start() print("Server is online") state = [0] while True: co...
meen2nont/ModbusSimulator_SDM230
Modbus_server.py
Modbus_server.py
py
442
python
en
code
1
github-code
90
9856339905
from tkinter import * import tkinter.ttk as ttk import os import time from tkinter import messagebox import tkinter.messagebox import sqlite3 import pyttsx3 conn = sqlite3.connect('database1.db') c = conn.cursor() root = Tk() root.title("HOSPITAL MANAGEMENT SYSTEM") root.configure(width=1500,height=600,bg='BLACK') ro...
MuhammadZubair786/Hospital-Management-Project-In-Python
hospital/new.py
new.py
py
13,480
python
en
code
1
github-code
90
35580438835
import requests import sys import csv from interfaces import BalanceResponse # Normally I'd create a .env file and secrets from there # but this is a test token API_KEY = 'D6HFJ69KZZ23JN8EP86KJPBVE3NKHP5BSR' BASE_URL = 'https://api.etherscan.io/api' def get_crypto_balance_by_address(address: str, tag: str="latest")...
carkod/elliptic-challenge
main.py
main.py
py
1,812
python
en
code
0
github-code
90
3139988258
import math import copy import random import numpy as np import pandas as pd import matplotlib.pyplot as plt genres = ["Action","Adventure","Animation","Children's","Comedy","Crime","Documentary","Drama","Fantasy", "Film-Noir","Horror","Musical","Mystery","Romance","Sci-Fi","Thriller","War","Western"] genre...
ohouens/3i026
iads/engineering.py
engineering.py
py
15,218
python
en
code
0
github-code
90
45836426910
from django.shortcuts import render,redirect from django.contrib.auth.models import User from django.core.mail import send_mail from .models import Email,News from django.contrib import messages from django.template.loader import render_to_string import smtplib from zeal.settings import EMAIL_HOST_USER from dj...
sanujsood/Zeal
newsletter/views.py
views.py
py
1,831
python
en
code
0
github-code
90
12593584447
import argparse import math from datetime import datetime import numpy as np import tensorflow as tf import socket import importlib import zipfile import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = BASE_DIR sys.path.append(BASE_DIR) sys.path.append(os.path.join(ROOT_DIR, 'utils')) imp...
Salingo/RPM-Net
code/test.py
test.py
py
5,642
python
en
code
25
github-code
90
26679597213
class Sandwich: def __init__(self, type='sandwich', bread='white', price = 0.00, *args): """ Initialize this sandwich with provided type, bread, fillings """ self.type = type #type of sandwich, ie sandwich, hot-dog, taco self.bread = bread #type of bread, ie wheat, rye, corn ...
toomeyDev/SandwichShop
sandwich_shop/sandwich.py
sandwich.py
py
1,237
python
en
code
0
github-code
90
3820991495
from random import shuffle #تابع ایجاد دست def deal(numhands , n = 5): deck = [r+s for r in "23456789TJQKA" for s in "SHDC"] shuffle(deck) return(list(deck[n*i : n*(i+1)] for i in range(numhands))) # تابع RANK def card_ranks(hand): return sorted(['--23456789TJQKA'.index(r) for r,s in hand ],reverse...
Fahime-omd/poker.py
poker.py
poker.py
py
1,754
python
en
code
0
github-code
90
28734020310
# This is the train script for CNN - Deep_Learning_Basics import tensorflow as tf from tensorflow.keras.preprocessing.image import ImageDataGenerator import matplotlib.pyplot as plt # Define the root directory where your data is located data_dir = r"C:\Users\jaiva\Desktop\kode\image\data" # Replace with your data dir...
jaivanth07/ORIGINAL
temp.py
temp.py
py
2,897
python
en
code
0
github-code
90
42323421410
def danger(board, row, col): for (i,j) in board: if row == i or col ==j or abs(row-i) == abs(col-j): return True return False def place(board, left): if not left: return (True, board) row = left[0] for col in range(1, 9): if not danger(board, row, col): ...
rawgni/empireofcode
place_queens.py
place_queens.py
py
976
python
en
code
0
github-code
90
18249739929
N = int(input()) A = list(map(int,input().split())) # print('A:',A) #まず、一気に数えてしまおう! num = [0]*N for i in range(N): num[A[i]-1]+=1 # print('num:',num) #その数のペアはいくつ? C = [0]*N cnt=0 #1つも抜かさない時の選び出す場合の数 for i in range(N): if num[i]!=0 and num[i]!=1: dammy = (num[i] * (num[i]-1))//2 cnt+=dammy ...
Aasthaengg/IBMdataset
Python_codes/p02732/s871086688.py
s871086688.py
py
613
python
ja
code
0
github-code
90
25201141089
import pandas as pd # read csv file df = pd.read_csv('filename.csv') column1=df['GeneIDs'] print("temp:",column1) # select the column you want to split column2 = df['Seq'] # split the column by the newline character split_column = column2.str.split('\n', expand=True) # access the first part of the split column fir...
flyfir248/UPGMA-Gene-analysis-test
splitgeneheader.py
splitgeneheader.py
py
1,087
python
en
code
0
github-code
90
36295247157
"""Modele mediante una funcion matematica y diseñe un programa recursivo sin cadenas, tuplas o listas que retorne el primer digito de un numero natural n (leído de izquierda a derecha). Por ejemplo, primero(86420) = 8.""" def qdigit(m, counter): if m//10==0: return counter+1 else: co...
RosanaR2017/PYTHON
6.first_digit.py
6.first_digit.py
py
375
python
es
code
0
github-code
90
1120403662
import gym import numpy as np from ray.rllib.env import MultiAgentEnv from src.SimulatorParameters import sim_params from src.Environment import Environment class PredatorEnv(gym.Env, MultiAgentEnv): def __init__(self): self.action_space = gym.spaces.Discrete(5) self.observation_space = gym.spac...
WouterHuygen/multi-agent-reinforcement-learning
src/PredatorEnvironment.py
PredatorEnvironment.py
py
1,588
python
en
code
0
github-code
90
29703351052
""" new:创建并返回,静态方法 init:初始化 """ class UserInfo: case = None # 类属性 例子初始值为空 isinit = False # 类属性 默认没有初始化 # 判断创建次数 def __new__(cls, *args, **kwargs): if cls.case is None: cls.case = object.__new__(cls) return cls.case def __init__(self): if UserInfo.isinit is False: self.name = '李大爷' UserInf...
Bngzifei/PythonNotes
学习路线/1.python基础/练习/单例模式.py
单例模式.py
py
648
python
en
code
1
github-code
90
20671414960
from text.models import TextFile from django.utils.timezone import now SOFT_MAX_LENGTH: int = 300 def split_text(text: str): tmp_paras: list[str] = text.split("\n") merged_paras: list[str] = [] current_para: str = "" for tmp_para in tmp_paras: current_para += tmp_para if len(current_p...
pxxgogo/misscut_overwatch
misscut_overwatch/text/ops.py
ops.py
py
1,290
python
en
code
0
github-code
90
35985423635
import os import cv2 import torch import torch.nn as nn import numpy as np from argparse import ArgumentParser from model import Model from para import Parameter from data.utils import normalize, normalize_reverse from os.path import join, exists, isdir, dirname, basename if __name__ == '__main__': par...
zzh-tech/ESTRNN
inference.py
inference.py
py
4,098
python
en
code
273
github-code
90
18417321549
import bisect N = int(input()) S = '0'+input()+'0' lst1 = [] lst2 = [0]*(N+2) for i in range(1,N+1): if S[i] == '#': lst1.append(i) if S[N+1-i] == '.': lst2[N+1-i] = lst2[N+2-i] + 1 else: lst2[N+1-i] = lst2[N+2-i] if len(lst1) == N or lst2[1] == N: print(0) exit() rlt = N+1 for i in ...
Aasthaengg/IBMdataset
Python_codes/p03069/s484414640.py
s484414640.py
py
415
python
en
code
0
github-code
90
24859704684
x_wins = False o_wins = False game_on = True turn = 1 players_turn = 1 grid_dict = {0: " ", 1: " ", 2: " ", 3: " ", 4: " ", 5: " ", 6: " ", 7: " ", 8: " "} grid_disp = f" {grid_dict[0]} | {grid_dict[1]} | {grid_dict[2]} 1 | 2 | 3 \n" \ f"----------- -----------\n" \ f" {grid_dict[3]} | {...
Gstclair1/tic-tac-toe
main.py
main.py
py
3,165
python
en
code
0
github-code
90
23553292821
from django.urls import path from . import views urlpatterns = [ path("messages/", views.messages, name='messages'), path("delete_message/<int:pk>/", views.delete_message, name='delete_message'), path("chat/<int:pk>/", views.chat, name='chat'), path("edit_chat/<int:pk>/", views.edit_chat, name='edit_ch...
SLDem/followerr
chats/urls.py
urls.py
py
850
python
en
code
1
github-code
90
1814907776
# -*- coding: utf-8 -*- """ Created on Wed Jan 22 10:21:59 2020 @author: Rajesh """ """ Name: Intersection Filename: Intersection.py Problem Statement: With two given lists [1,3,6,78,35,55] and [12,24,35,24,88,120,155] Write a program to make a list whose elements are intersection of the above...
Rajesh-sharma92/FTSP_2020
Python_CD6/Intersection.py
Intersection.py
py
537
python
en
code
3
github-code
90
39443133501
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: # Merge the two sorted arrays merged = [] i, j = 0, 0 while i < len(nums1) and j < len(nums2): if nums1[i] < nums2[j]: merged.append(nums1[i]) i ...
ady1210/ArraySolutions
median_of_two_sorted_arrays.py
median_of_two_sorted_arrays.py
py
670
python
en
code
4
github-code
90
38465835060
# -*- coding: utf-8 -*- """ Created on Sun May 3 22:14:59 2020 @author: shaurya """ import turtle tur = turtle.Turtle() for i in range(50): tur.forward(50) tur.right(144) turtle.done()
shauryasharma30/Python-Scripts
Spirals/SpiralTraversing#.py
SpiralTraversing#.py
py
223
python
en
code
0
github-code
90
34899675156
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np """ Super Class """ class Optimizer(object): """ This is a template for implementing the classes of optimizers """ def __init__(self, net, lr=1e-4): self.net = net ...
snehabandi/Deep-Learning-and-its-Applications
assignment1/lib/optim.py
optim.py
py
4,006
python
en
code
1
github-code
90
75166967976
from PIL import Image import os, glob, numpy as np from sklearn.model_selection import train_test_split from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential, Model from keras.layers import Input from keras.layers import Conv2D, MaxPooling2D, Dense, Flatten, Dropout, BatchNormaliz...
lynhyul/AIA
project/CNN2_ResNet50.py
CNN2_ResNet50.py
py
9,576
python
en
code
3
github-code
90
5126838547
#import scipy, scipy.ndimage #import sparseconvnet as scn from torch.nn.modules.module import Module import torch import numpy as np from torch.autograd import Variable import torch.nn.functional as F from torch.autograd import Function class PcNormalizeFunction(Function): @staticmethod def forward(ctx, point...
feihuzhang/LiDARSeg
code/data_utils/transform.py
transform.py
py
3,306
python
en
code
62
github-code
90
26487760020
import os path = os.path.join(os.path.dirname('input.txt')) def get_monkey_decisions(path_to_file): with open(path_to_file) as file: monkeys = [monkey.split("\n") for monkey in file.read().strip().split("\n\n")] decisions = [] for monkey in monkeys: decisions.append([])...
HagayHaut/advent-of-code
2022/day-11/script.py
script.py
py
2,202
python
en
code
1
github-code
90
24603896449
import sys import json import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning class IBMXforce: def checkIBMxForce(self, domain): print('[*] IBM xForce Check: {}'.format(domain)) s = requests.Session() # Hack to prevent cert warnings requests.package...
l0gan/domainCat
modules/ibmxforce.py
ibmxforce.py
py
1,652
python
en
code
62
github-code
90
5995200135
import numpy as np import matplotlib.pyplot as plt def stacked_bar(data, series_labels=None, category_labels=None, show_values=False, value_format="{}", y_label=None, grid=True, reverse=False, y_limit=None, size_plot=None, use_dataframe=False, throw_zeros=False,dict_colors={}): """...
Lammlab/Resic
Experiments/forontiers_jupyter/bar_utils.py
bar_utils.py
py
5,634
python
en
code
3
github-code
90
39248509237
""" Created on October 20, 2023 Helper functions for the L2O project """ # Modules # ============================================================================= from __future__ import annotations # Standard from abc import abstractmethod from ty...
bessagroup/3dasm_course
Projects/L2O/l2o.py
l2o.py
py
10,704
python
en
code
10
github-code
90
1873046825
# Discord Bot using python3 to send command to the Pokecatcher channel. import random import discord from discord.ext import tasks # Init the discord client discord_client = discord.Client() channel_id = 000000000000000000 # Replace with your channel ID # Set the channel object using our channel ID number channel ...
olivier987654/A_Year_Of_Python
2022-10-26/2022_10_26.py
2022_10_26.py
py
2,129
python
en
code
0
github-code
90
18543799969
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def calc_max(A): Amax = [0] * len(A) cal = 0 for i, (x, v) in enumerate(A): cal += v if i == 0: Amax[i] = max(cal - x, 0...
Aasthaengg/IBMdataset
Python_codes/p03372/s242279835.py
s242279835.py
py
1,043
python
en
code
0
github-code
90
20135881766
# -*- coding: utf-8 -*- # Author: XuMing <xuming624@qq.com> # Brief: import os ################## for text classification ################## # sample # train_path = "../data/nn/sample_training.csv" # train_seg_path = "../data/nn/sample_train_seg.txt" # test_seg_path = "../data/nn/sample_test_seg.txt" # sentence_pat...
shirleywan/nlp-project
文本分析/classifier-in-action-master/neural_network/config.py
config.py
py
1,809
python
en
code
2
github-code
90
18204061039
import sys 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]) if temp!=1: arr.append([temp, 1]) if arr==[]: ...
Aasthaengg/IBMdataset
Python_codes/p02660/s286068246.py
s286068246.py
py
691
python
zh
code
0
github-code
90
31658225000
def Anagram(s1,s2): str1=sorted(s1) str2=sorted(s2) if len(str1)!=len(str2): return False else: for i in range(len(str1)): if str1[i]!=str2[i]: return False return True if __name__=='__main__': #s1 = ['l', 'h', 'u', 'v', 'o'] #s2 = ['h', 's...
mahdis4092/Python-Data-structure-and-Algorithms
Array Problem solve/Anagram problem solution.py
Anagram problem solution.py
py
406
python
kn
code
0
github-code
90
41266359003
import csv import os import shutil from PIL import Image def attribute(i): if int(i) ==0: return "sepal length in cm" if int(i) ==1: return "sepal width in cm" if int(i)==2: return "petal length in cm" if int(i) ==3: return "petal width in cm" def draw_ori_tree(): csvfile=open("dec_tree.csv","r") reade...
AKUMA58/Decision-Tree-Visualization-with-Iris-Dataset
ori_tree.py
ori_tree.py
py
2,034
python
en
code
0
github-code
90
42799887584
import json import numpy as np import torch import math class TokenClassifier: def __init__(self): self.vocab = [ 'ศูนย์', 'หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า', 'หก', 'เจ็ด', 'แปด', 'เก้า', 'สิบ', 'ลบ', 'ลิงกั้ว', 'ลิงกัว', 'บัคคัล', 'บัคคอล', 'มีเสี้ยว', 'ดิสทัล', 'ทั้งหมด', ...
kracker71/dentist-voice-assistant-capstone-v2
backend_ner/utils/model.py
model.py
py
5,372
python
th
code
0
github-code
90
38218120951
import numpy as np import scipy.integrate import warnings if scipy.__version__.startswith('1.4'): from scipy.integrate.quadrature import AccuracyWarning else: from scipy.integrate._quadrature import AccuracyWarning from SWESimulators import CDKLM16, Common class DoubleJetPerturbationType: """ An ...
metno/gpu-ocean
gpu_ocean/SWESimulators/DoubleJetCase.py
DoubleJetCase.py
py
17,378
python
en
code
10
github-code
90
25290952120
import tempfile import unittest from pimlicotest import example_path class PipelineConfigTest(unittest.TestCase): def setUp(self): # Get a basic local config file so Pimlico doesn't go looking for one on the system self.local_conf_path = example_path("examples_local_config") # Create a tem...
markgw/pimlico
src/test/python/pimlicotest/core/config.py
config.py
py
1,560
python
en
code
6
github-code
90
30020744147
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QDialog,QInputDialog,QLineEdit,QMessageBox import pyodbc from decimal import Decimal import Vasa import os import sys from Odbc_Connection import Add_Odbc_Connection class Ui_New_product_dialog(object): def setupUi(self, New_product_dialog): ...
rvssankar/vasa_studio
Add_Function_Product.py
Add_Function_Product.py
py
18,294
python
en
code
0
github-code
90
18550317839
#!/usr/bin/env python3 import sys def main(): S = input() T = 'abcdefghijklmnopqrstuvwxyz' if len(S) < 26: U = set(T) - set(S) print(S + sorted(U)[0]) else: if S == T[::-1]: print(-1) else: count = 1 for i in range(25): ...
Aasthaengg/IBMdataset
Python_codes/p03393/s376274470.py
s376274470.py
py
644
python
en
code
0
github-code
90
27362383849
import numpy as np import numpy.linalg as linalg import math import random # utils def is_row_vector(vector): return vector.shape[0] == 1 def is_col_vector(vector): return vector.shape[1] == 1 def matrix_dimensions_match(first, second): return first.shape[1] == second.shape[0] # functions def portfo...
Hubertus444/investments
basics.py
basics.py
py
4,204
python
en
code
0
github-code
90
18455635219
from operator import itemgetter from itertools import accumulate n,k = map(int, input().split()) sushi = [list(map(int, input().split())) for i in range(n)] sushi.sort(key=itemgetter(1)) sushi.reverse() # 各ネタ最大美味しさの寿司 a = [] # それ以外の寿司 b = [] # aにすでに入っているネタ = 1 in_a = [0]*(n+1) for i in range(n): t,d = sushi...
Aasthaengg/IBMdataset
Python_codes/p03148/s012977204.py
s012977204.py
py
656
python
en
code
0
github-code
90
28348946727
import pytest import json from humps import decamelize from eth_account import Account, messages from siwe.siwe import SiweMessage, ValidationError BASE_TESTS = "tests/siwe/test/" with open(BASE_TESTS + "parsing_positive.json", "r") as f: parsing_positive = decamelize(json.load(fp=f)) with open(BASE_TESTS + "par...
0xdaem0n/siwe-py
tests/test_siwe.py
test_siwe.py
py
2,910
python
en
code
null
github-code
90
19263579254
#!/usr/bin/python3 from flask import Flask, jsonify, request, make_response, abort import psycopg2 import psycopg2.extras from . import * app = Flask(__name__) config = load_configuration('/var/www/robodoge/config.yml') try: merger = Robodoge(config) except ConfigurationError as err: print(err.msg) sys.exi...
rnicoll/robodoge
robodoge/coordinator.py
coordinator.py
py
6,901
python
en
code
0
github-code
90
70762201898
""" Proyecto Python MySQL: - Abrir aistente - Login o registro - Si elegimos registro, creará un usuario en la base de datos - Si elegimos login, identificará al usuario y nos preguntará - Crear nota, mostrar nota, borrarlas """ # carpeta archivo from usuarios import acciones print(""" Acciones disponible: ...
AlexSR2590/curso-python
20-proyecto-python/main.py
main.py
py
550
python
es
code
0
github-code
90
13088364217
import os class Pajaro: alas = True def __init__(self, tipo, color): self.t = tipo self.c = color @classmethod def volar(cls): print(f"Las aves tienen alas: {cls.alas}") def cantidad_huevos(self): if self.t =="Canario": return "3" else: ...
jimymora1965/Practica-POO-dia-8-Udemy
pajaro_huevos_metodoDeClase.py
pajaro_huevos_metodoDeClase.py
py
570
python
es
code
0
github-code
90
683154915
#!/usr/bin/env python import requests from solar.core.resource import virtual_resource as vr from solar.events.api import add_event from solar.events.controls import React discovery_service = 'http://0.0.0.0:8881' bareon_partitioning = 'http://0.0.0.0:9322/v1/nodes/{0}/partitioning' bareon_repos = 'http://0.0.0.0:93...
Mirantis/solar
examples/provisioning/provision.py
provision.py
py
2,363
python
en
code
8
github-code
90
25201143779
import requests import xml.etree.ElementTree as ET import pandas as pd def fetch_fasta_sequence(transcript_id): try: # Send GET request to the NCBI e-utilities server r = requests.get( f"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id={transcript_id}&rettype...
flyfir248/UPGMA-Gene-analysis-test
task 1 final.py
task 1 final.py
py
2,838
python
en
code
0
github-code
90
29362482320
import matplotlib.pyplot as plt import numpy as np import enems if __name__ == "__main__": # ## LOAD DATA ################################################################################################### # test_data_obs = enems.load_data_obs().values test_data_df = enems.load_data_75() ...
adlzanchetta/en-ems
test/test_plot_with_obs.py
test_plot_with_obs.py
py
3,535
python
en
code
0
github-code
90
18422306119
from itertools import permutations from math import ceil times = list(int(input()) for _ in range(5)) orders = list(permutations(times, 5)) minimum = sum(ceil(time/10)*10 for time in times) for order in orders: cnt = order[0] for i in range(1, 5): cnt += ceil(order[i]/10)*10 minimum = min(minimum,...
Aasthaengg/IBMdataset
Python_codes/p03076/s673792187.py
s673792187.py
py
341
python
en
code
0
github-code
90
40540311795
from __future__ import print_function # Add local python path to the global path and import standard library modules... import os import sys; sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), "..", "lib", "Python")) import time import re import multiprocessing as mp # RDKit imports... try: from rdkit...
sirimullalab/redial-2020
mayachemtools/bin/RDKitRemoveSalts.py
RDKitRemoveSalts.py
py
25,643
python
en
code
5
github-code
90