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
21414167412
# -*- coding: utf-8 -*- import tkinter as tk from typing import List from ParseError import ParseError from geometry_syntax import GeometrySyntax from oval_parameters import OvalParameters from preview import Preview class Application(tk.Frame): _syntax_error_tag = "syntax_error" def __init__(self, master,...
paper-lark/pythondev
05_SshAndSmartWidgets/src/application.py
application.py
py
3,767
python
en
code
0
github-code
1
11710769912
#author: Samet Kalkan import numpy as np from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Flatten, Dropout, Dense from keras.utils import np_utils from keras.callbacks import ModelCheckpoint from keras import regularizers from keras import backend as K np.random.seed(0) ...
baker12355/weather_prediction
CNN_train.py
CNN_train.py
py
2,813
python
en
code
0
github-code
1
7565321283
import tempfile import subprocess import os import yaml import codecs import logging class FileService(object): METAPATH_KEY = "_metapath" def __init__(self, logger=None): self.logger = logger or logging.getLogger(__name__) def edit_temp_file(self, initial_text): """Edits a temp file in ...
withrocks/transcribe-cli
transcribe_cli/file_svc.py
file_svc.py
py
2,483
python
en
code
1
github-code
1
24776414641
# coding: utf-8 """ 该文件主要是对数据进行预处理,将评分数据按照8:2分为训练数据与测试数据 """ import pandas as pd import csv import os #将文件中的数据按照userId进行排序,如果userId相同则按照timestamp进行排序 origin_f = open('data/ratings.csv','rt',encoding='utf-8',errors="ignore") new_f= open('data/ratings_sort.csv','wt',encoding='utf-8',errors="ignore",newline="") reader=cs...
wyhluckydog/ML-For-Recommendation
fm/divideData.py
divideData.py
py
3,811
python
en
code
1
github-code
1
933868552
from collections import deque import sys input = sys.stdin.readline n, m = map(int, input().split()) graph = [[]*(n+1) for _ in range(n+1)] visited = [False] * (n+1) for _ in range(m): a, b = map(int, input().split()) graph[a].append(b) graph[b].append(a) cnt = 0 def bfs(v): queue = deque([v]) vis...
jjs0211/problem-solving-with-study
Baekjoon/Class03/11724_연결요소의개수.py
11724_연결요소의개수.py
py
1,228
python
en
code
0
github-code
1
31136763706
# -*- coding: utf-8 -*- """ This model takes the winemag data & filters on the north_america and europe continents. After cleaning and prepping the date, we run two bayesian hierarchical models (one for each continent) on the data using variational inference & pymc3 """ import pandas as pd import numpy as np import py...
wkdaniel3/Bayesian-Analysis-for-Wine
points_regression_hierarchical.py
points_regression_hierarchical.py
py
8,895
python
en
code
0
github-code
1
31602843689
from matplotlib import pyplot as plt from PIL import Image img = Image.open("original.jpg") img2 = Image.open("broken1.png").convert(img.mode) img2 = img2.resize(img.size) img3 = Image.blend(img,img2,0.35) plt.figure(num='BROKEN LENS Failure') plt.subplot(121),plt.imshow(img),plt.title('Original') plt.xticks([]),...
XYZ121212/issre2020
superimposition.py
superimposition.py
py
437
python
en
code
0
github-code
1
10111024127
# coding=utf-8 __author__ = '01053185' """ 该代码实现功能: 1.测试集 与 学习集合的划分 2.测试集的输入文件构造 3.构造学习集的输入文件 """ import os import random class StepOne(): def __init__(self): self.data_dir_in = 'E:\\gitshell\\tianchi2' # 输入文件夹 self.data_dir_out = 'E:\\gitshell\\tianchi3' # 输出文件夹 # 搭配关系重新表示 def my_ShangP...
axuanwu/bayes3
set_partition.py
set_partition.py
py
4,154
python
en
code
0
github-code
1
3181829099
#!/usr/bin/env python3 """ cron: 0 40 22 * * * new Env('明日天气'); """ import sys import requests import json import time from bs4 import BeautifulSoup import os, re # 获取WxPusher appToken WxPusher_appToken if "WxPusher_appToken" in os.environ: if len(os.environ["WxPusher_appToken"]) > 1: WxPusher_appToken = ...
BSSAMA/weather
tomorrow_weather.py
tomorrow_weather.py
py
5,931
python
en
code
0
github-code
1
35990787928
""" Get Options Action for App ID """ from urllib.parse import urlencode from api.api_samples.python_client.ext import requests from common.methods import set_progress from itsm.servicenow.models import ServiceNowITSM import json def get_options_list(field, **kwargs): options = [('', '--- Select an App ID ---')]...
mbomb67/cloudbolt_samples
params/create_tags.py
create_tags.py
py
2,362
python
en
code
2
github-code
1
25577714533
# Copyright (C) 2020 Claudio Marques - All Rights Reserved from enum import Enum class Lists(Enum): VOWEL = 'aeiou' CONSOANT = "bcdfghjklmnpqrstvwxyz" NUMERIC = "0123456789" SPECIALCHAR = "!\"#|\\$%&/()=?«»´`*+ºª^~;,-_@£€{[]}'" class DatesEnum(Enum): SemDados = 0 UmMes = 1 ...
claudioti/dataset-creator
lib/enumerations.py
enumerations.py
py
532
python
en
code
3
github-code
1
29165679484
from django.shortcuts import render # Create your views here. from django.http import HttpResponse from wmh_server.models import LocationData as lc from django.views.decorators.csrf import csrf_exempt import json import datetime as dt from django.conf import settings def index(request): res = "Base Path:{}. This ...
PavloZub/WalkMeHome_SRV
wmh_server/views.py
views.py
py
2,572
python
en
code
0
github-code
1
20491564834
import pandas as pd import numpy as np import matplotlib.pyplot as plt import pywt from sklearn.cluster import KMeans from sklearn.cluster import AgglomerativeClustering import random from scipy.spatial import distance import math from typing import Union DataSources = Union[str,pd.Series,np.ndarray] class TemplateEr...
ZoyaV/ikmeans
ikmeans/dwt_templates.py
dwt_templates.py
py
5,004
python
en
code
1
github-code
1
41919082633
# Sytulacja rzutu dwoma kośćmi. from die import Die from plotly.graph_objs import Bar, Layout from plotly import offline die_1 = Die() die_2 = Die(10) results = [die_1.roll()+die_2.roll() for roll_num in range(50_000)] max_result = die_1.num_sides + die_2.num_sides frequencies = [results.count(value) for value in r...
Jvlia17/Data-Visualization
dice_visual.py
dice_visual.py
py
830
python
pl
code
0
github-code
1
35718199463
# -*- coding: utf-8 -*- """ Course: CS 4365/5354 [Computer Vision] Author: Jose Perez [ID: 80473954] Assignment: Lab 1 Instructor: Olac Fuentes Last Modification: September 2, 2016 by Jose Perez """ from timeit import default_timer as timer from PIL import Image from numpy import * # Page 42-43, exercise 5 # Gradient ...
DeveloperJose/Python-CS4363-Computer-Vision
Lab1/problem1_exercise5.py
problem1_exercise5.py
py
1,877
python
en
code
0
github-code
1
15803733936
import time import csv import osm_bot_abstraction_layer.osm_bot_abstraction_layer as osm_bot_abstraction_layer import osmapi def is_imprecise_ukrainian_name(name_uk, name): if name_uk in ["шкільний комплекс", "професійна школа"]: return True if name_uk == "Загальноосвітній ліцей" and name.lower() != "...
matkoniecz/ua-names
ua.py
ua.py
py
14,623
python
en
code
0
github-code
1
11397164333
from bs4 import BeautifulSoup import requests from rus import send_mail from soc import messages_to_string def parse_hearpwn_page(page): page = requests.get(page) soup = BeautifulSoup(page.text, 'html.parser') messages = soup.find_all('div', itemprop='text') return messages def parse_sa...
komap2017/soc
hearthpwn.py
hearthpwn.py
py
848
python
en
code
0
github-code
1
20667568841
# 케이스를 2가지 밖에 생각 못함 ,이번꺼 안먹은 경우// 이번꺼 먹고 + dp[i-2] # + 추가로 이번꺼 저번꺼 먹은 경우도 생각 해줬어야함 lst[i-2],lst[i-1],dp[i-3] # lst랑 dp랑 인덱스 안맞기때문에 헷갈리는거 조심, 가짓수를 더 생각해보자!!! import sys input=sys.stdin.readline n=int(input()) lst=[] dp=[0]*(n+1) for _ in range(n): lst.append(int(input())) dp[1]=lst[0] if n>1: dp[2]=lst[0]+ls...
jeongkwangkyun/algorithm
dp/2156.py
2156.py
py
788
python
ko
code
0
github-code
1
8496698639
import json import os import socket import sys import threading import time class Server: __instance = None @staticmethod def getInstance(callback=None): if Server.__instance == None: Server(callback) return Server.__instance def __init__(self, callback):...
jaanonim/ISM
server/server.py
server.py
py
6,736
python
en
code
0
github-code
1
43279921183
import ply.yacc as yacc from mathpy.grammar.paranthesis.lexer import tokens precedence = ( ('nonassoc', 'NUMBER'), ('nonassoc', 'SINE', 'COSINE', 'SECANT', 'COSECANT', 'TANGENT', 'COTANGENT', 'LOG', 'EXP', 'ARCSINE', 'ARCCOSINE', 'ARCTANGENT', 'SINEH', 'COSINEH', 'TANGENTH', 'ARCSINEH', 'ARCCOSINEH', 'ARCTANGE...
pritansh/mathpy
mathpy/grammar/paranthesis/parser.py
parser.py
py
2,810
python
en
code
0
github-code
1
70673992353
#!/usr/bin/env python import os import shutil import argparse import subprocess import random import pandas as pd import numpy as np import pickle as pkl import scipy as sp import networkx as nx import scipy.stats as stats import scipy.sparse as sparse from torch import nn from torch import optim from torch.nn import ...
KennthShang/PhaBOX
PhaMer_single.py
PhaMer_single.py
py
7,806
python
en
code
16
github-code
1
17955145003
from __future__ import unicode_literals from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt import numpy as np import pandas as pd from hazm import * import fasttext import string import emoji import hazm import json import os import re # normalizer = Normalizer() def remove_extra_chars(text):...
MinaHajirezaei/Text-classification-with-fasttext
fasttext_classification.py
fasttext_classification.py
py
8,412
python
en
code
1
github-code
1
34519629611
#!/usr/bin/env python3 from Crypto.Util import number from binascii import hexlify, unhexlify from gmpy2 import next_prime, powmod, gcdext, gcd from itertools import count from random import randint class MPRSA(object): def __init__(self): self.public_key = None self.secret_key = None def key...
p4-team/ctf
2017-07-15-ctfzone/mprsa/mprsa.py
mprsa.py
py
1,901
python
en
code
1,716
github-code
1
27827135577
import pytest from thefuck.types import Command from thefuck_contrib_scoop.rules.scoop_unknown_command import get_new_command, match from thefuck_contrib_scoop.scoop import get_aliases, get_commands @pytest.mark.parametrize( "script, output", [ ( "scoop bucke add versions", "s...
beerpiss/thefuck-contrib-scoop
tests/rules/test_scoop_unknown_command.py
test_scoop_unknown_command.py
py
1,453
python
en
code
0
github-code
1
8708358698
from random import randrange def main(): limit = -1 while limit < 1: try: limit = int(input("What is the level of this game? ")) except ValueError: print ("Please input a positive integer!") guess = '' num = randrange(limit) while guess != limit: ...
Motunrayo321/Programming-review
Week 4/Pset 4/4. Guessing Game/game.py
game.py
py
693
python
en
code
0
github-code
1
6104384803
# Import the dependencies. import numpy as np import pandas as pd import datetime as dt import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify ################################################# # Da...
Wheezyotter/sqlalchemy-challenge
SurfsUp/app.py
app.py
py
7,631
python
en
code
0
github-code
1
8139262298
class Solution: def letterCombinations(self, digits: str) -> list: if not digits: return [] nums = {'1':('','',''), '2':('a','b','c'), '3':('d','e','f'), '4':('g','h','i'), '5':('j','k','l'), '6':('m','n','o'), ...
MinecraftDawn/LeetCode
Medium/17. Letter Combinations of a Phone Number.py
17. Letter Combinations of a Phone Number.py
py
666
python
en
code
1
github-code
1
34468401334
# Code source: Jaques Grobler # License: BSD 3 clause # Code from https://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, r2_score from joblib import dump, load...
Wallis16/Docker_Machine_Learning
App/Training/train.py
train.py
py
1,870
python
en
code
0
github-code
1
32486175131
def game(r, c, s): grid[r][c] = s for i in range(8): stack = [] for l in range(1, N): nr = r + delta[i][0] * l nc = c + delta[i][1] * l if 0 <= nr < N and 0 <= nc < N and not grid[nr][nc]: break if 0 <= nr < N and 0 <= nc < N and gr...
CrimsonTheLegoBuilder/MyBaekjoonSolve
hw/sw4615.py
sw4615.py
py
1,181
python
en
code
0
github-code
1
37257135092
# Exercise 2: Write a program to look for lines of the form: # # New Revision: 39772 # # Extract the number from each of the lines using a regular expression and the # findall() method. Compute the average of the numbers and print out the average # as an integer. # # Enter file:mbox.txt # 38549 # # Enter file:m...
caseywschmid/python_for_everybody
exercise_11-02.py
exercise_11-02.py
py
1,129
python
en
code
0
github-code
1
15628978181
import math from statistics import mean,stdev,mode import os import pandas as pd library = pd.read_csv('Z:/Helium_Tan/PTMDIAProject_SpectralLibraries/Pro_12fxnOnly/PTMDIAProject_TimsTOFPro_12fxnOnly.tsv', delimiter= '\t',low_memory = False) # print(len(library)) phospho_library = library[library['IntLabeledPeptide']....
tvashist/PTMDIA
Library_DIA_Overlap.py
Library_DIA_Overlap.py
py
1,423
python
en
code
0
github-code
1
14777550147
import functools import turtle import hangman import words def write_word(word): writer = turtle.Turtle() writer.penup() writer.goto(100, 200) writer.write(word, font=('Arial', 16, 'bold')) writer.hideturtle() # Иницилизация original_word = words.get_random_word() word = '_' * len(original_word...
simo1209/tues_homework
24/game.py
game.py
py
954
python
en
code
5
github-code
1
839842385
# def solution(gems): # size = len(set(gems)) # dic = {gems[0]:1} # temp = [0, len(gems) - 1] # start, end = 0, 0 # # while(start < len(gems) and end < len(gems)): # if len(dic) == size: # if end - start < temp[1] - temp[0]: # temp = [start, end] # if ...
smileostrich/algorithm-practice
problemSolving/company/kakao/2020/2020_suumer_intern/p3.py
p3.py
py
1,218
python
en
code
0
github-code
1
27203130897
from ast import Interactive from typing import Collection import pygame import logging from settings import * from player import Player from overlay import Overlay from sprites import GenericSprites, WaterSprites, TreeSprites, WildFlowerSprites, InteractionSprites, ParticleEffects from pytmx.util_pygame import load_pyg...
lordhelmut/pygame-town
src/level.py
level.py
py
10,702
python
en
code
0
github-code
1
6384058720
# (C) 2021 Victor Suarez Rovere <suarezvictor@gmail.com> #NOTES: """ #test command: $ $ clang -E -I. ../tr_pipelinec.cpp > tr_pipelinec.E.cpp && python3 cflexc.py tr_pipelinec.E.cpp > tr_pipelinec.gen.cpp && clang -c tr_pipelinec.gen.cpp -o tr_pipelinec.gen.o && clang++ -O3 -I.. -fopenmp=libiomp5 -ffast-math `sdl2-co...
suarezvictor/CflexHDL
cflexparser/cflexc.py
cflexc.py
py
4,746
python
en
code
153
github-code
1
35282075051
""" It is a file that crops the mp3 and srt file by the durations which is getting from the srt file. """ import os from ..helper.helper import run_bash, parse_time class CropMp3Srt: """ Gets the mp3 and srt files to crop """ def __init__(self, filepath): self._path = filepath def crop(s...
IoT-Ignite/ArdicSrtCollector
ardicsrtcollector/crop_mp3_srt/crop_mp3_srt.py
crop_mp3_srt.py
py
3,773
python
en
code
1
github-code
1
4340565342
import logging import re from datetime import datetime, timezone from zipfile import ZipFile import pandas from jal.widgets.helpers import g_tr from jal.db.update import JalDB from jal.constants import Setup, DividendSubtype, PredefinedCategory, PredefinedAsset # -----------------------------------------------------...
iliakan/jal
jal/data_import/statement_uralsib.py
statement_uralsib.py
py
13,042
python
en
code
null
github-code
1
72632121635
# Capture multiple Faces from multiple users to be stored on a DataBase (dataset directory) # ==> Faces will be stored on a directory: dataset/ (if does not exist, pls create one) # ==> Each face will have a unique numeric integer ID as 1, 2, 3, etc import cv2 from scripts.database_connection import Connection ...
FoOkySNick/faceRecognition
FaceRecognition/scripts/frontal_face_dataset_with_database.py
frontal_face_dataset_with_database.py
py
3,813
python
en
code
0
github-code
1
29847344408
from app import app from boto.s3.connection import S3Connection from boto.s3.key import Key import json class IneffableStorage(object): def __init__(self): """ Initialize the class """ self.connection = None self.bucket = None def setup_connection(self): """ Setup the connect...
taeram/ineffable
app/controllers/helpers/storage.py
storage.py
py
1,142
python
en
code
8
github-code
1
33274035782
# -- coding: utf-8 -- import tensorflow as tf import pandas as pd import numpy as np import pymysql import sys sys.path.append(sys.path.append('../')) # 导入上一级目录中的包 from settings import * # 查询课程信息 # 课程信息查询,例:离散数学及其应用 # 课程编号,课程名称,公司企业名称,课程编码,课程类别,学分,是否考试,上传时间,标签 def courInfo(courseName): db = pymysql.connect("10.1...
BoolWang/FuXueCase
fuxuecase/case4/case4.py
case4.py
py
6,928
python
en
code
0
github-code
1
74705291873
import numpy as np m1 = ( (1, -1), (1, 2) ) matrix = np.array( m1 ) print(matrix) output = np.array( (0, 8) ) solve = np.linalg.solve(matrix, output) # 线性方程组求解 . print(solve) X = np.arange(-5, 5, 0.25) a1 = np.arange(0, 10, 0.5) print(a1)
carl10086/dm-learning
dm-algebra/it/numpy_test.py
numpy_test.py
py
274
python
en
code
0
github-code
1
24997965734
from __future__ import absolute_import import random from src.event import SignalEvent class TestRandomStrategy(object): def __init__(self, instrument, units, events): self.instrument = instrument self.units = units self.events = events self.ticks = 0 self.invested = False...
LongntLe/Tradingsystem
src/strategy/randomstrategy.py
randomstrategy.py
py
846
python
en
code
2
github-code
1
12747428660
from keras.utils import to_categorical import numpy as np import pandas as pd import time TRAIN_SIZE = 30000 TEST_SIZE = 2 def label_generator(num_of_labels, size): """ Create a two coloum label set :param size1: :param size2: :return: """ lab = np.zeros((size, num_of_labels), dtype=np.float) length_per_label...
odedyec/biological_dnn
dataset_generator.py
dataset_generator.py
py
7,460
python
en
code
0
github-code
1
5987291793
inp = int(input()) fat = 1 soma = 0 for k in range(inp + 1): for i in range( 1, k + 1 ): fat = fat * i soma = soma + fat fat = 1 print (soma)
totoi690/trabalhosuni
SCC0600/exercíciosPy/ex13.py
ex13.py
py
153
python
en
code
0
github-code
1
18709052300
# Program for array rotation # Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. # Input : [1, 2, 3, 4, 5, 6, 7] # Output : 3 4 5 6 7 1 2 print("==========Calling functions============") def leftRotate(arr,d,n): for i in range(d): leftRotateByOne(arr,n) def leftRotateByOne(...
dilipksahu/Python-Programming-Example
Array programs/sumOfElement.py
sumOfElement.py
py
1,027
python
en
code
0
github-code
1
32600971056
#!/usr/bin/python3 from typing import List import json from bplib.butil import TreeNode, arr2TreeNode, btreeconnect, aprint class Solution: def canAttendMeetings(self, intervals: List[List[int]]) -> bool: intervals = sorted(intervals) current_start = -1 current_end = -1 for [start...
negibokken/sandbox
leetcode/252_meeting_rooms/main.py
main.py
py
536
python
en
code
0
github-code
1
3897944753
area_side = int(input()) tile_width = float(input()) tile_height = float(input()) bench_width = int(input()) bench_length = int(input()) area_to_cover = area_side*area_side - bench_length*bench_width tile_area = tile_height*tile_width tiles_needed = area_to_cover/tile_area time = tiles_needed*0.2 print(round(tiles_nee...
LuGeorgiev/PythonSelfLearning
NakovBook/SimpleCalculations/ChangeTiles.py
ChangeTiles.py
py
350
python
en
code
0
github-code
1
31976121540
india = ["mumbai", "banglore", "chennai", "delhi"] pakistan = ["lahore","karachi","islamabad"] bangladesh = ["dhaka", "khulna", "rangpur"] city_name = input("Enter a city name: ") city_name = str(city_name) if city_name in india: print("This city is in India!") elif city_name in pakistan: print("This city is ...
Arkem001209/Python_Testing
exercise_8_1.py
exercise_8_1.py
py
473
python
en
code
0
github-code
1
27016684208
from Supersymmetry_nonBPS_3pt import* from Supersymmetry_nonBPS_3pt_fourier import* def etaP_Mul(amplitude, multiplier=sqrt(2)): result = 0 a = multiplier for susy in amplitude.arr: temp = susy.copy() if '01' in susy.etalist: temp *= a if '02' in susy.etalist: ...
DanielChen86/Supersymmetry
FourierTransformation.py
FourierTransformation.py
py
2,147
python
en
code
0
github-code
1
25316109249
from config import data_db_schema,data_ocr from repositories import DataRepo from utilities import LANG_CODES import logging from logging.config import dictConfig log = logging.getLogger('file') repo = DataRepo() class OcrModel: def __init__(self): self.db = data_db_schema self.col = da...
ishudahiya2001/ULCA-IN-ulca-Public
backend/metric/ulca-utility-service/src/models/ocr.py
ocr.py
py
3,702
python
en
code
0
github-code
1
19658143575
from pyBrainNetSim.generators.network import SensorMoverProperties from pyBrainNetSim.models.individuals import SensorMover class SensorMoverEvolutionarySolver(object): """ An Evolutionary solver to find the best 'SensorMover' for the environment. This simulates I individuals at time 0. Each individual mo...
hurtb777/pyBrainNetSim
pyBrainNetSim/solvers/solver.py
solver.py
py
2,108
python
en
code
0
github-code
1
34576891554
__author__ = "Michael Chambers" __copyright__ = "Copyright 2019, Michael Chambers" __email__ = "greenkidneybean@gmail.com" __license__ = "MIT" from snakemake.shell import shell log = snakemake.log_fmt_shell(stdout=False, stderr=True) shell( "samtools faidx {snakemake.params} {snakemake.input[0]} > {snakemake.ou...
leonqli/snakemake-wrappers
bio/samtools/faidx/wrapper.py
wrapper.py
py
338
python
en
code
null
github-code
1
43564951062
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def trim_fields(apps, schema_editor): trim_extra_account(apps, schema_editor, "facebook") trim_extra_account(apps, schema_editor, "github") trim_extra_account(apps, schema_editor, "twitter") def trim_...
colab/colab
colab/accounts/migrations/0004_auto_20150311_1818.py
0004_auto_20150311_1818.py
py
1,511
python
en
code
23
github-code
1
13761313878
import math def secante(x, y): #x = Xn #y = Xn-1 for i in range(6): aux = x x = (y*f(x) - x*f(y))/(f(x) - f(y)) y = aux return x def f(x): return x**2 + 25600/(((240/math.sqrt(900 - x**2)*x)/30) - x)**2 - 20**2 print("Valor de L aproximadamente: " + str(secante(5, 4)))
martinsspn/Calculo-numerico
tarefa2/questão4/secanteQ4.py
secanteQ4.py
py
317
python
pt
code
1
github-code
1
26165070556
class Headline: ''' Headlines class to define Headlines Objects ''' def __init__(self,id,title,description,urlToImage,publishedAt,author,content,url): self.id =id self.title = title self.description = description self.urlToImage = urlToImage self.publishedAt ...
Muia23/NewsHub
app/models.py
models.py
py
637
python
en
code
0
github-code
1
32204725988
from random import randint import random age = input('how old are you? ') age = int(age) # if condition: # "code that runs if condition if true" - typically 4 spaces of indentation if age >= 21: print('Come on in!') print('*******') print('AFTER THE IF STATEMENT') # this gets printed regardless of True or ...
JLoh17/One-Week-Python
10_Conditionals-Basics.py
10_Conditionals-Basics.py
py
1,391
python
en
code
0
github-code
1
23584376110
# vim: set expandtab: import typing import subprocess import os import pwd import sys import docker import re import socket import psutil import io import pickle import math import threading import time import shutil import uuid from .imageTransient import TransientImageSlurmBackend, list_instances, get_gce_client fr...
getzlab/canine
canine/backends/dockerTransient.py
dockerTransient.py
py
24,264
python
en
code
6
github-code
1
21065266517
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from absl import flags import tensorflow as tf import dataloader import retinanet_model from tensorflow.contrib.tpu.python.tpu import tpu_config from tensorflow.contrib.tpu.python.tpu import tpu_est...
ProjectSidewalk/sidewalk-cv-assets19
old/tf_resnet_tutorial/tpu/models/official/retinanet/retinanet_main.py
retinanet_main.py
py
8,690
python
en
code
4
github-code
1
40355111174
from sqlitedatabase import add_entry,get_entries,create_connection,create_table menu = """ Welcome to the programming diary! Please select one of the following options: 1) Add new entry for today. 2) View entries. 3) Exit. Your selection: """ welcome = "**Welcome to the programing diary!**" # entries = [ # {"c...
manishg2015/python_workpsace
python-postrgress/main.py
main.py
py
1,625
python
en
code
0
github-code
1
4573261188
# n = int(input()) # times = [] # # for _ in range(n): # start, end = map(int, input().split()) # times.append([start, end]) # # times = sorted(times, key=lambda x: x[0]) # times = sorted(times, key=lambda x: x[1]) # # finish_time = 0 # count = 0 # # for start, end in times: # if start >= finish_time: # ...
21CatchStudy/wonhee_repo
greedy/1931 회의실.py
1931 회의실.py
py
745
python
en
code
0
github-code
1
4568639765
from datetime import datetime import scrapy from scrapy.http import Request from maksavit_scrapy.items import ScrapyMaksavitItem from maksavit_scrapy.settings import (CATEGORIES, DOMAIN, LOCATION, MAIN_URL, PROXY) class MaksavitSpider(scrapy.Spider): name = 'maksavit' p...
danlaryushin/parser_scrapy
maksavit_scrapy/spiders/maksavit.py
maksavit.py
py
5,849
python
en
code
0
github-code
1
11745868944
import math from tkinter import * size = 600 radius1 = size / 2.9 #radius orbiti radius2 = size / 100 #radius vrashaushegosya kruga def coords(angle): x = math.cos(angle) * radius1 y = math.sin(angle) * radius1 return x - radius2 + size / 2, y - radius2 + size / 2, x + radius2 + size / 2, y + radi...
GeoYak/Praktikum_tkinter
Yakushchev_ZBPI212/Знакомство с tkinter.py
Знакомство с tkinter.py
py
787
python
en
code
0
github-code
1
4062704487
# Square root digital expansion # Problem 80 # It is well known that if the square root of a natural number is not an integer, then it is irrational. # The decimal expansion of such square roots is infinite without any repeating pattern at all. # The square root of two is 1.41421356237309504880..., and the digital s...
IgorKon/ProjectEuler
080.py
080.py
py
941
python
en
code
0
github-code
1
32990811232
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from cssspy.utils import domains_from_urls, absolute_urls from cssspy.cssscrapy.items import CssFilesItem from scrapy.contrib.linkextractors.htmlparser import HtmlParserLinkExtractor ...
Scorpil/cssspy
cssspy/cssscrapy/spiders/cssspider.py
cssspider.py
py
1,492
python
en
code
0
github-code
1
1707012386
from typing import Dict, List import asana from giges.models.team import Team from giges.slack import SlackClient from giges.tasks.app import app from giges.util import validate_uuid def _add_ds_class_item(custom_field: Dict[str, str]) -> str: """ Returns the slack representation for a Data Science item. ...
tesselo/giges
giges/tasks/asana.py
asana.py
py
4,761
python
en
code
0
github-code
1
22525543773
import json import os import numpy as np import sys import copy import random import jsonlines import time import scipy.stats task = sys.argv[1] model = sys.argv[2] model = f"en_dense_lm_{model}" # !!! replace by your $base_dir/ana_rlt here base_dir = "$base_dir/ana_rlt" ana_rlt_dir = f"{base_dir}/{model}" debug_sca...
microsoft/LMOps
understand_icl/icl_ft/compute_training_example_attn.py
compute_training_example_attn.py
py
8,440
python
en
code
2,623
github-code
1
21499865608
#!/usr/bin/env python import sys from setuptools import find_packages, setup setup_requires = [] # I only release from OS X so markdown/pypandoc isn't needed in Windows if not sys.platform.startswith('win'): setup_requires.extend([ 'setuptools-markdown', ]) setup( name='serplint', author='B...
beaugunderson/serplint
setup.py
setup.py
py
1,362
python
en
code
5
github-code
1
2427076789
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split class TrainTestSplitter: def __init__(self, subjects, labels): """ Initializes the TrainTestSplitter class. Parameters: - subjects (list): List of subjects. - labels (list): List of...
dheerajpr97/Explainable-AI-Non-EEG
src/utils/cross_val.py
cross_val.py
py
5,499
python
en
code
0
github-code
1
9395637463
def solution(people, limit): people = sorted(people, reverse=True) start = 0 end = len(people) - 1 counter = 0 while start <= end: weight_heavy = people[start] weight_light = people[end] if weight_heavy + weight_light <= limit: end -= 1 start += 1 ...
dhsong95/-PRACTICE-Programmers-Algorithm
level 2/구명보트.py
구명보트.py
py
473
python
en
code
0
github-code
1
40738971562
import h2o import numpy as np # Start H2O on your local machine h2o.init ( ip='localhost', port=54321, nthreads=-1, max_mem_size='25g' ) # Import the train_numeric train_numeric = h2o.import_file ( path="/Users/avinashbarnwal/Desktop/Kaggle/Bosch/train_numeric.csv" ) # train_categorical = h2o.import_file(path = "/User...
avinashbarnwal/Bosch-Kaggle
.idea/Code.py
Code.py
py
2,944
python
en
code
0
github-code
1
40363495908
__author__ = 'M_Nour' import numpy as np from scipy import stats from sklearn.semi_supervised import label_propagation from sklearn.metrics import classification_report, confusion_matrix,accuracy_score, f1_score, recall_score import dataset from collections import Counter import matplotlib.pyplot as plt from ...
marjan-nourollahi/PALS
stream_PAL.py
stream_PAL.py
py
11,813
python
en
code
0
github-code
1
17567214725
import torch import torch.nn as nn import numpy as np import pickle from utils.utils import NeighborSampler class MTL(nn.Module): def __init__(self, base_encoder_k, encoder, view_learner, edge_rnn, sample_time_encoder, len_full_edge, train_e_idx_l, train_node_set, train_ts_l, e_feat, device, dim...
ViktorAxelsen/TGSL
GraphMixer+TGSL/MTL.py
MTL.py
py
13,488
python
en
code
9
github-code
1
12533465974
#!/usr/bin/env python3 """ Sales As Code: randomly selects a sales-y buzzword from a google sheet. """ import argparse import logging import os import random import sys import gspread from cachetools import TTLCache from dotenv import load_dotenv from oauth2client.service_account import ServiceAccountCredentials lo...
bblinder/home-brews
SalesAsCode.py
SalesAsCode.py
py
3,610
python
en
code
0
github-code
1
15143070119
#!/usr/bin/env python # coding: utf-8 # # COURSE: Master statistics and machine learning: Intuition, Math, code # ##### COURSE URL: udemy.com/course/statsml_x/?couponCode=202006 # ## SECTION: The t-test family # ### VIDEO: Permutation testing # #### TEACHER: Mike X Cohen, sincxpress.com # In[ ]: # import libraries...
mikexcohen/Statistics_course
Python/ttest/stats_ttest_permutation.py
stats_ttest_permutation.py
py
2,373
python
en
code
18
github-code
1
36108195573
import rclpy from rclpy.node import Node class Talk(Node): def __init__(self,name): super().__init__(name) self.get_logger().info("Hello, I'm %s" % name) def main(args=None): rclpy.init(args=args) node = Talk("Tom") rclpy.spin(node) rclpy.shutdown()
benjaminhuanghuang/ros-study
_projects/py_ws/src/py_study/py_study/ooptalk.py
ooptalk.py
py
292
python
en
code
0
github-code
1
28052011409
from comparison_sol import str_path #from Global_alignment_MM_functions import seq_to_alignement from matplotlib import colors import argparse import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import os # This is a script to visualize SCRaMbLEd chromosomes using an arrow plot. # Created by ...
Mmark94/SCRaMbLE-SIM
arrowplot.py
arrowplot.py
py
7,885
python
en
code
0
github-code
1
73066482913
# -*- coding: utf-8 -*- """ Created on Wed Apr 29 16:40:47 2020 @author: Eric Bianchi """ import shutil import os import numpy as np import tensorflow as tf import cv2 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Try except statements #+++++++++++++++++++++++++++++++++++++++++++++++...
beric7/COCO-Bridge-2021-plus
general_utils/classification_utils.py
classification_utils.py
py
24,182
python
en
code
5
github-code
1
234718894
import RPi.GPIO as GPIO import time import os from numpy import interp class ServoManager(object): # self.current stores rot (degrees) def __init__(self, pin): # init GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) # default to center self.pin = pin self.currentAngle ...
jemgunay/bagel-turret
servo_manager.py
servo_manager.py
py
907
python
en
code
0
github-code
1
8169473685
import math from torch import nn import torch.nn.init as init from .common import AdaptiveFM from .dgr import DGR import torch import torch.nn.functional as F def make_model(args, parent=False): return ESPCN(args) def get_valid_padding(kernel_size, dilation): kernel_size = kernel_size + (kernel_size - 1) * (...
anonymousECCV2022/paper2031_ECCV2022_code
src/model/espcnori.py
espcnori.py
py
3,794
python
en
code
1
github-code
1
20261507881
from django.db.models import Manager from .exceptions import TenantError from .utils import state FIELD_NAME = "shop" class TenantManager(Manager): def __init__(self): self.state = state super().__init__() def get_queryset(self): current_state = self.state.get_state() queryse...
ragsub/smplshop2
smplshop/users/tenant/managers.py
managers.py
py
743
python
en
code
0
github-code
1
27582079263
pref = input("Do you prefer Dogs or Cats? ") def function(dogs, cats, pref): print(f"You have {dogs} dogs") print(f"You have {cats} cats.") print(f"you prefer {pref}.\n") function(10,15,pref) function(10 - 5, 20 - 8,pref) meow = 6 woof = 10 function(woof, meow,pref) function(9,6,pref)
chrisWalker11/Python
exercises/e19/function.py
function.py
py
301
python
en
code
0
github-code
1
27438503281
from __future__ import absolute_import from __future__ import print_function import os import sys import re from builtins import str as text import wx # ----------------------------------------------------------------------------- # Global variables # ---------------- # __author__ = "Pierre Rouleau" __version__ = "$...
thiagoralves/OpenPLC_Editor
editor/i18n/mki18n.py
mki18n.py
py
17,501
python
en
code
307
github-code
1
6411650046
import torch import torchvision from torch import nn from torch.utils.tensorboard import SummaryWriter from torchvision import transforms from torch.utils.data import DataLoader from torch.optim import Adam, SGD from torch.optim.lr_scheduler import ChainedScheduler, LinearLR, MultiStepLR import argparse import os impor...
rishabbala/Layerwise_model_training
extra_files/contrastive_training.py
contrastive_training.py
py
13,603
python
en
code
0
github-code
1
17816136485
from getmac import get_mac_address as gma import sys import os import getopt #varibles mac = None mac_vendor = "" #argv argv = sys.argv[1:] opts, args = getopt.getopt(argv, "i:m:h", ["ip=", "mac=", "help"]) archivo = open("archivo.txt", "r") def getmac(ipadress): mac = gma(ip=ipadress) ...
robot-beep/tarea1-OUILookup
OUILookup.py
OUILookup.py
py
730
python
en
code
0
github-code
1
12171445949
#!/usr/bin/env python3 import rospy from std_msgs.msg import String, Float32MultiArray, Bool import time class small_demo: def __init__(self): rospy.init_node('head_neck_screen_demo') rospy.Subscriber("cmd_frm_tablet", String, self.demo_callback) rospy.Subscriber('/battery_info', Float32Mu...
UsamaArshad16/demos
src/head_demo.py
head_demo.py
py
3,580
python
en
code
0
github-code
1
24869313700
from functools import wraps import numpy as np def handle_0D_1D_input( patched_kwargs: [], patched_argpos: [], return_scalar=False ): """ A decorator that handles 0D, 1D inputs and transforms them to 2D. Parameters ---------- kwarg : list of str The names of the keyword arguments tha...
acerbilab/pyvbmc
pyvbmc/decorators/handle_0D_1D_input.py
handle_0D_1D_input.py
py
2,169
python
en
code
99
github-code
1
34427844204
import pandas as pd import numpy as np import datetime import matplotlib import matplotlib.pyplot as plt from matplotlib import colors import seaborn as sns from sklearn.preprocessing import LabelEncoder, OneHotEncoder, OrdinalEncoder from sklearn.preprocessing import StandardScaler from sklearn.decomposition ...
charanharsha-git/VehicleInsuranceProject
fraud_detection.py
fraud_detection.py
py
5,440
python
en
code
0
github-code
1
13255214663
# count number of items brought in total allGuests = {'Alice': {'apples': 5, 'pretzels': 12}, 'Bob': {'ham sandwiches': 3, 'apples': 2}, 'Carol': {'cups': 3, 'apple pies': 1}} # create definition def totalBrought(guests, product): numBrought = 0 for k, v in guests.items(): n...
simink/py_automatetheboringstuff
code/5_totalBrought.py
5_totalBrought.py
py
541
python
en
code
1
github-code
1
17330037248
import torch import numpy as np from scipy import interpolate def load_pretrained(checkpoint_path, model, simmim): if not simmim: load_pretrained_swin(checkpoint_path, model) else: load_pretrained_simmim(checkpoint_path, model) def load_pretrained_swin(checkpoint_path, model): checkpoint ...
isadrtdinov/ens-for-transfer
models/swin/utils.py
utils.py
py
6,790
python
en
code
0
github-code
1
17218746745
import os import click import requests from .utils import prepare_path, save_list_and_cache, write_to, get_result from .help import BRANDING prepare_path() # @click.group() @click.command() @click.argument('ignore', required=False) @click.version_option(message=BRANDING) @click.option('-a', '--listall', help='Get al...
AzatAI/addignore
addignore/cli.py
cli.py
py
1,397
python
en
code
0
github-code
1
15972604163
#load matplotlib.pyplot as plt import matplotlib.pyplot as plt #load numpy as np import numpy as np #x range: [-pi, pi] x = np.linspace(-np.pi, np.pi, 256, endpoint = True) #y = sin(x) y_sin = np.sin(x) #y = cos(x) y_cos = np.cos(x) #Figure & subplot fig = plt.figure(figsize = (12,8)) ax = fig.add_subplot(1,1,1) #...
SONG-WONHO/start_Matplotlib
07_review.py
07_review.py
py
976
python
en
code
0
github-code
1
8999801447
from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from data_processing.transformers.CommonSimilarity import CommonSimilarity from data_processing.transformers.ToPandas import ToPandas from recommend.transformers.CosSimilarity import CosSimilarity from recommend.transformers.FetchSimil...
arctic-source/game_recommendation
recommend/pipeline.py
pipeline.py
py
3,726
python
en
code
0
github-code
1
22718690979
import cPickle as pickle import scipy.io import numpy as np import theano.tensor as T import theano from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams from utils import * #this scrip is designed to produce prediction results from the pickled #models generated by the utils and cnnlearning scripts...
corentintallec/mlproject2
code/python/generate_results.py
generate_results.py
py
2,841
python
en
code
0
github-code
1
19822983990
from fastapi import FastAPI from models import User, UserBet, VerifyRequest app = FastAPI() @app.post("/server_seed") def get_hashed_server_seed(request: User): resp = request.get_server_seed() return resp @app.post("/bet") def bet(request: UserBet): resp = request.process() return resp @app.pos...
PerryGraham/provably-fair-python
main.py
main.py
py
414
python
en
code
0
github-code
1
15485119752
from datetime import datetime, timedelta import json import threading import logging from enum import Enum from const import CONST from main import send_post import pykka import ledPWM ''' on: time_h=19 photoresistor=50 time_h=18 photoresistor=20 -> nothing time_h=20 photoresistor=60 -> nothing time_h=21 photoresistor...
RyuzakiKK/esls
rpi/lamp.py
lamp.py
py
11,090
python
en
code
0
github-code
1
72116408675
import torch import numpy as np from torch.utils.data import DataLoader import pandas as pd from sklearn.model_selection import train_test_split from keras.datasets import mnist from torch.autograd import Variable import matplotlib.pyplot as plt import torch.nn as nn import warnings warnings.filterwarnings("i...
Berkan352/Machine-Learning
CNN.py
CNN.py
py
3,659
python
en
code
0
github-code
1
42366561365
class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: if len(s2) < len(s1) : return False left = 0 s1Counter = defaultdict(int) s2Counter = defaultdict(int) for i in range(len(s1)): s1Counter[s1[i]] += 1 s2Counter[s2[i]]...
mykelbengineer/LeetCode
permutation-in-string/permutation-in-string.py
permutation-in-string.py
py
782
python
en
code
1
github-code
1
32844015163
from sklearn import preprocessing import pickle import joblib import nltk import pandas as pd from flask import Flask,request """ string = "infection including flu pneumonia immunization diphtheria tetanus child teething \ infant inflammatory disease including rheumatoid arthritis ra crohn disease blood \ ...
azharudh33n/MedConnect
ml/app_api.py
app_api.py
py
1,991
python
en
code
null
github-code
1
22645813504
#!/usr/bin/python3 '''Square Module This module demonstrates how to work with classes. The functionality included in this module is only for demonstration purposes. ''' class Square: '''class Square This is a simple class to demonstrate how to work with properties setters, and getters. It also demonstrat...
Akochieng/alx-higher_level_programming
0x06-python-classes/5-square.py
5-square.py
py
2,159
python
en
code
0
github-code
1
31241017265
from PyQt5.QtWidgets import QWidget, QLabel, QPushButton from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QGridLayout from PyQt5.QtGui import QPixmap, QImage import numpy as np class Panel(QWidget): def __PrivateMethod(self): print("private method, value of") return def __init__(self)...
shane97luo/python_play
face_rec/ui/Panel.py
Panel.py
py
2,168
python
en
code
0
github-code
1