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
36756676223
#!/usr/bin/env python import os import web web.config.debug = True render = web.template.render("templates/") urls = ( "/", "index", '/favicon.ico', 'icon' ) def is_deluged_running(): res = os.system("ps -C deluged") return True if (res == 0) else False def start_deluged(): os.system("/usr/bin...
dbondin/progs
delugedctl/delugedctl.py
delugedctl.py
py
1,036
python
en
code
1
github-code
90
74382013735
import re import spacy nlp = spacy.load('ru_core_news_lg') def find_sents(doc): return list(doc.sents) def get_quotes(sent): return re.findall(r"[«\'\"]([^\"\'«»]*)[»\'\"]", sent) def get_quotes_and_author(content): doc = nlp(content) sentence_list = find_sents(doc) result = [] for se...
zvasia/quote_finder
quote_finder.py
quote_finder.py
py
697
python
en
code
0
github-code
90
20047924231
while True: # Loop infinit try: varsta = int(input("Ce varsta aveti?")) print(varsta) 15/0 raise ValueError("Exceptie aruncata de noi") except ValueError: print("Adaugati o varsta corecta!") # Ajunge aici continue # Continua rularea programului except ZeroDiv...
zewa1999/PythonExamples
1/Cursul 6/3. Exceptii3.py
3. Exceptii3.py
py
529
python
ro
code
0
github-code
90
26870412435
from __future__ import print_function import logging import math import sys import numpy as np import matplotlib.pyplot as plt from .solution import Solution class Animator: def __init__(self, grid, tfinal): self._grid = grid self._tfinal = tfinal plt.ion() self._fig, (self._ax...
dmitry-kabanov/fickettmodel
saf/ffm/nonlinear/animator.py
animator.py
py
3,448
python
en
code
0
github-code
90
33387798236
"""BlobManager: Uploading and downloading blob files""" from __future__ import print_function import datetime import os from azure.storage.blob import ( BlobServiceClient, BlobClient, ContainerClient, __version__, ) class BlobManager: # pylint: disable=too-few-public-methods """Upload and download...
brunoterkaly/azure-batch-etl
etl/src/blob_manager.py
blob_manager.py
py
3,572
python
en
code
0
github-code
90
2442697286
import json import pandas as pd from decimal import Decimal def getResultHTML(result): resultData = ConverResultDataType(result) pd.set_option('display.max_colwidth', 200) columns = ['Index', 'DsName', 'Type', 'StepName', 'RunnerId', 'ShowName', 'Recursive', 'StartTime', 'EndTime', 'Status',...
PharbersDeveloper/phlambda
processor/async/scenariotrigger/phscenariosendemail/src/genHtml.py
genHtml.py
py
4,380
python
en
code
0
github-code
90
75406428456
""" Contains base class from which other classes are derived """ import moneypot.utils as utils class Base(): def __init__(self, config=None ): if config is None: cfg_path = utils.get_config_path() print("no config given, using config at" + cfg_p...
franksh/moneypot
moneypot/base.py
base.py
py
433
python
en
code
1
github-code
90
18016032729
import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) a.sort() cs = [0] * (N + 1) for i in range(N): cs[i + 1] = cs[i] + a[i] #print(cs, a) res = 0 for i in range(1, N): if cs[i] * 2 >= a[i]: res += 1 else: res = 0 print(res + 1)
Aasthaengg/IBMdataset
Python_codes/p03786/s380130811.py
s380130811.py
py
270
python
en
code
0
github-code
90
70780347176
from honeydew import GcpSecretManager from dotenv import load_dotenv import os import argparse parser = argparse.ArgumentParser() parser.add_argument('-p', '--proxy', default='') args = parser.parse_args() CREDS_FILE = os.environ.get('HONEYDEW_CREDS_FILE') HONEYDEW_OUTPUT_DIR = os.environ.get('HONEYDEW_OUTPUT_DIR') PR...
vholti/honeydew
example_secretmanager.py
example_secretmanager.py
py
667
python
en
code
0
github-code
90
5117843112
import scrapy from scrapy.http import HtmlResponse from jobparser.items import JobparserItem class HhruSpider(scrapy.Spider): name = 'hhru' allowed_domains = ['hh.ru'] # вакансии по запросу "аналитик" start_urls = [ 'https://hh.ru/search/vacancy?clusters=true&enable_snippets=true&salary=&st=se...
AlSavva/Pars_Scrap_Crowl_Methods
Lesson6_HomeWork/jobparser/spiders/hhru.py
hhru.py
py
1,217
python
en
code
0
github-code
90
1857606145
from sanic import Sanic from sanic.response import text ,json from dotenv import load_dotenv import os from models.GetCorrelation import GetCorrelation as GetCorrelationModel load_dotenv() port = os.getenv('SERVICE_PORT') app = Sanic("DecidoRecommendService") @app.get("/") async def hello_world(request): return t...
RoyJian/Decido
backend/service/service.py
service.py
py
770
python
en
code
0
github-code
90
2808311406
from django.urls import path from . import views app_name = 'library' urlpatterns = [ path('', views.index, name='index'), path('add-author/', views.add_author, name='add_author'), path('author/<int:id>/', views.author_detail, name='author'), path('add-book/<int:author_id>/', views.add_book, name='add_book'), ...
PdxCodeGuild/class_salmon
code/pete/django/library/library_app/urls.py
urls.py
py
346
python
en
code
5
github-code
90
35033002166
import tensorflow as tf from tensorflow.keras.layers import Conv2D, Conv2DTranspose, Input, Conv2DTranspose from tensorflow.keras.initializers import TruncatedNormal # from tensorflow_examples.models.pix2pix import pix2pix from model.utils import res_block, instance_norm, up_sample, down_sample OUTPUT_CHANNELS = 3 IMA...
s-elo/I-am-a-painter
model/generator.py
generator.py
py
5,160
python
en
code
2
github-code
90
17712398826
import pandas as pd import numpy as np import matplotlib.pyplot as plt #文本和主次刻度(主次刻度不好记,先不练手) s=pd.Series(np.random.randn(100)).cumsum() plt.text(50,0,'abc',fontsize=10) s.plot(figsize=(6,4)) plt.clf() #保存图表 df=pd.DataFrame(np.random.randn(100,4),columns=list('abcd')).cumsum() df.plot(style='--',marker='.',alpha=0.5)...
Gelivabilities/Data-mining
Matplotlib/主次刻度、文本、图表保存.py
主次刻度、文本、图表保存.py
py
694
python
zh
code
5
github-code
90
13608018419
# # abc002 b # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.r...
mskt4440/AtCoder
abc002/b.py
b.py
py
1,217
python
en
code
0
github-code
90
22455458087
import os import math from numbers import Number from tqdm import tqdm import torch from torch.autograd import Variable import numpy as np import lib.dist as dist import lib.flows as flows def estimate_entropies(qz_samples, qz_params, q_dist): """Computes the term: E_{p(x)} E_{q(z|x)} [-log q(z)] and ...
deepstronglens/SLpipe
KDD_Submission/Lens_detection_and_modeling/VIB/elbo_decomposition.py
elbo_decomposition.py
py
11,957
python
en
code
1
github-code
90
42883909804
import unittest from parserfromgary import Parser class ParserTestCase(unittest.TestCase): def setUp(self): self.parser = Parser() def assertParsed(self, wikitext, lines, tags=None): result = self.parser.parse_text(wikitext) self.assertEqual(lines, result['lines']) ...
Trawirr/mwparallelparserfromgary
tests/conftest.py
conftest.py
py
394
python
en
code
2
github-code
90
18000616339
n, W = map(int, input().split()) w1, w2, w3, w4 = [], [], [], [] w, v = map(int, input().split()) w1.append(v) # 4パターンしかない for _ in range(n-1): a, b = map(int, input().split()) if a == w: w1.append(b) if a == w+1: w2.append(b) if a == w+2: w3.append(b) if a == w+3: w...
Aasthaengg/IBMdataset
Python_codes/p03732/s281836278.py
s281836278.py
py
872
python
en
code
0
github-code
90
18485063819
import fractions n,m=map(int,input().split()) s=input() t=input() b=0 for i in range(n): if (i*m)%n==0 and (i*m)//n<m: if not t[(i*m)//n]==s[i]: b=1 if b: print(-1) else: print(n*m//fractions.gcd(n,m))
Aasthaengg/IBMdataset
Python_codes/p03231/s415816600.py
s415816600.py
py
234
python
en
code
0
github-code
90
29027711817
from django.contrib.auth.models import User from django.db import models from mm.models import Contract from pm.models import AnaSubmit class AnaExecute(models.Model): """执行生信分析步骤""" ana_submit = models.OneToOneField( AnaSubmit, verbose_name="子项目编号(分析)", on_delete=models.CASCADE ) analyst = m...
realbioBMS/RealBMS
am/models.py
models.py
py
10,137
python
en
code
0
github-code
90
72952427178
import os from flask import Flask, render_template, flash from content_management import Content app = Flask(__name__) TOPIC_DICT = Content() app.config.from_object(__name__) # load config from this file , flaskr.py # Load default config and override config from an environment variable app.config.update(dict( DA...
anandvsingh/Flask
__init__.py
__init__.py
py
828
python
en
code
0
github-code
90
29211446892
import torch from utils.core_nns import UniLSTMModel, BiLSTMModel from utils.data_utils import Txtfile, Data2tensor from utils.data_utils import SOS, EOS, UNK from utils.data_utils import SaveloadHP class SentiInference: def __init__(self, arg_file="./results/senti_cls_unilstm.args", model_file="./results/senti_c...
devanshmody/NLP-solutions
Devansh_Mody_1130532/predict.py
predict.py
py
3,755
python
en
code
0
github-code
90
27877521463
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ BE523 Biosystems Analysis & Design HW24 - Question 5. Modify code for maximum daily soil temperature Prof. Waller solution. Created on Wed Apr 14 14:55:12 2021 @author: eduardo """ #======================Block 0: Adding Libraries============================= from date...
eduardo-jh/HW24-Interpolation-and-Integration
q5_weather_interpolation.py
q5_weather_interpolation.py
py
4,599
python
en
code
0
github-code
90
36132701215
""" Object models for fees related endpoints args and response. """ import json import requests from coinbaseadvanced.models.error import CoinbaseAdvancedTradeAPIError class FeeTier: """ Fee Tier object. """ pricing_tier: str usd_from: int usd_to: str taker_fee_rate: str maker_fee_r...
KmiQ/coinbase-advanced-python
coinbaseadvanced/models/fees.py
fees.py
py
2,837
python
en
code
22
github-code
90
16414395970
from django import forms from .models import Travel from accounts.models import Account with open('travels/towns.txt') as infile: towns = infile.read().splitlines() TOWNS = [(town, town) for town in towns] DATE_FORMAT = ["%d.%m.%Y %H:%M", ] class TravelForm(forms.ModelForm): owner = forms.ModelChoiceField(...
borisaltanov/TravelTogether
traveltogether/travels/forms.py
forms.py
py
1,050
python
en
code
0
github-code
90
36705418279
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Create on 2018-12-22 17:56:25 @author: lintex9527@yeah.net """ from PyQt5.QtWidgets import QWidget, QApplication, QGridLayout from PyQt5.QtWidgets import QFileDialog, QColorDialog, QFontDialog from PyQt5.QtWidgets import QScrollArea, QTextEdit, QVBoxLayout from PyQt5...
LinTeX9527/PyQtStudy
PyQtStudy/study_PrintDialog.py
study_PrintDialog.py
py
5,297
python
en
code
0
github-code
90
16471335114
from common import config from tqdm import tqdm import torch import argparse from dataset import get_dataloaders from utils import AUCMeter import numpy as np import os from model import resnet50, densenet169, fusenet model_list = ['models/resnet50_b16.pth.tar', 'models/densenet169_b64.pth.tar', ...
ChrisWu1997/MURA
predict.py
predict.py
py
5,694
python
en
code
12
github-code
90
31876236057
from constants.entity import ConversionReportingEntities from domain.entities.conversion import Conversion from domain.entities.conversion_detail import ConversionDetail from domain.entities.transaction import Transaction from domain.entities.transaction_conversion import ConversionTransaction from domain.factory.token...
singnet/snet-converter-services
domain/factory/conversion_factory.py
conversion_factory.py
py
10,872
python
en
code
0
github-code
90
11320415441
# -*- coding: utf-8 -*- """ @author: guardati Ejemplo 1_9. Ejemplos de uso de las funciones flter(), map() y zip(). """ def multiplo_de4(numero): return numero % 4 == 0 def cubo(x): return x ** 3 def es_mayusc(c): return c.isupper() def conv_mayus(c): res = c if c.islower(): ...
ebookscg-python/Libro2-python
Cap1/Ejemplo 1_9.py
Ejemplo 1_9.py
py
2,028
python
es
code
5
github-code
90
26156846974
# -*- coding: utf-8 -*- # 링크 : https://arisel.notion.site/1956-fa4287990e494a8b94110efd03dabd4a from sys import stdin class ExerciseCycle(object): def __init__(self, n_node, n_edge, graph_map): self.inf = int(1e9) self.n = n_node self.m = n_edge self.graph_map = graph_map self.graph = [[self.i...
arisel117/BOJ
code/BOJ 1956.py
BOJ 1956.py
py
1,224
python
en
code
0
github-code
90
4457569162
from enum import Enum from queue import PriorityQueue import numpy as np from bresenham import bresenham from sklearn.neighbors import KDTree def create_grid(data, drone_altitude, safety_distance): """ Returns a grid representation of a 2D configuration space based on given obstacle data, drone altitude a...
xjamundx/fcnd-planning
planning_utils.py
planning_utils.py
py
7,287
python
en
code
0
github-code
90
70714037737
import cocotb from cocotb.clock import Clock from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles, with_timeout @cocotb.test() async def test_start(dut): clock = Clock(dut.clk, 25, units="ns") # 40M cocotb.fork(clock.start()) dut.driver_sel.value = 0b01 # logic analyser dut.RSTB.value =...
efabless/tinytapeout-rca
verilog/dv/scan_controller_la/test_scan_controller.py
test_scan_controller.py
py
1,669
python
en
code
1
github-code
90
42056180596
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import sys import numpy as np import scipy.optimize import matplotlib.pyplot as plt import cv2 import ellipse DEBUG_IMAGES = [] def debug_show(name, src): global DEBUG_IMAGES filename = 'debug{:02d}_{}.pn...
mzucker/unproject_text
unproject_text.py
unproject_text.py
py
14,716
python
en
code
125
github-code
90
37851729495
"""Defines core consumer functionality""" import logging import confluent_kafka from confluent_kafka import Consumer from confluent_kafka.avro import AvroConsumer from confluent_kafka.avro.serializer import SerializerError from tornado import gen logger = logging.getLogger(__name__) class KafkaConsumer: """Defi...
miquelfarre/miquelfarre-udacity-data-streaming-nanodegree
Optimizing_Public_Transportation/consumers/consumer.py
consumer.py
py
2,781
python
en
code
1
github-code
90
3060512361
# # Project Euler Solution # Problem ID: 7 # # By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. # # What is the 10 001st prime number? # def is_prime(n): for i in range(2, n//2+1): if n % i == 0: return False return True def prime(pos): ...
AdriPR/Project-Euler
1-10/problem007.py
problem007.py
py
519
python
en
code
0
github-code
90
1757769485
import time import random def gaSearchCareerPath(careergraph, yearsExp, currjobtitle, careerendpoint): # universalCareerGraph = {'A': ['B',1,'C',2],'B': ['D',3],'C': ['D',3,'E',2],'D': ['G',7],'E': ['F',2],'F': ['G',2]} # yearsOfExperience = {'A':2,'B':3,'C':4,'D':5,'E':6,'F':8,'G':10} universalCareerGrap...
raymondng76/IRS-MR-RS-2019-07-01-IS1FT-GRP-Team10-LevelUp
SystemCode/Level_Up/Level_Up_App/GeneticAlgorithm.py
GeneticAlgorithm.py
py
7,385
python
en
code
2
github-code
90
71546404457
from math import log,floor t=int(input()) while(t): t-=1 x,y=map(int,input().split()) st=1 if(x==1 and y==1): print(st) continue if(x==1 and y!=1): print(1-st) continue ans=log(y)/log(x) if(floor(ans)==ans): print(st) else: print(1-st)
anirudhkannanvp/GeeksForGeeksSolutions
check-if-a-number-is-power-of-another-number.py
check-if-a-number-is-power-of-another-number.py
py
315
python
en
code
0
github-code
90
34483230727
### Extracting sheet info for along from get_residue_dict import * from collections import defaultdict def sheet_info_along(pdb_name,chain,sheet_dict,chain_break_file) : path_to_backbone_info = "allBeta_data/backbone_info/" path_to_output = "allBeta_data/sheets/along/" residue_dict = get_residue_dict(path_to_...
tushargupta14/betaSheets
get_sheet_info_along.py
get_sheet_info_along.py
py
1,317
python
en
code
0
github-code
90
18492958969
import sys s = list(input()) t = list(input()) a = [-1 for _ in range(26)] b = [-1 for _ in range(26)] for i in range(len(s)): num0, num1 = a[ord(s[i])-97], b[ord(t[i])-97] if num0 >= 0: if chr(num0+97) != t[i]: print('No') sys.exit() else: a[ord(s[i])-97] = ord(t[i]...
Aasthaengg/IBMdataset
Python_codes/p03252/s252356785.py
s252356785.py
py
507
python
en
code
0
github-code
90
10608176230
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created 5/29/2020 @author waldo A collection of handy routines that get used in multiple other programs """ import pickle import datetime as dt def read_pickle(fname): """ Read the object stored in the named file. Opens the file, reads the pickle, and retur...
jimwaldo/access_audit
utilities.py
utilities.py
py
998
python
en
code
0
github-code
90
18180819439
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) from functools import lru_cache @lru_cache(maxsize=2*10**5) def f2(x): if x == 0: return 0 y = bin(x).count("1") return 1 + f2(x % y) def resolve(): N = int(input()) W = 16 S = input() cnt0 = S.count("1") ...
Aasthaengg/IBMdataset
Python_codes/p02609/s512831497.py
s512831497.py
py
842
python
en
code
0
github-code
90
18476657569
from collections import defaultdict def factorization(n): global ND temp = n flag = True for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: flag = False cnt=0 while temp%i==0: cnt+=1 temp //= i ND[i] += cnt ...
Aasthaengg/IBMdataset
Python_codes/p03213/s073730796.py
s073730796.py
py
865
python
en
code
0
github-code
90
31221038130
#Write a python program to create a function to check whether a string is an anagram or not def anagram(s1,s2): for i in s2: if i not in s1: print("string",s1,"and",s2,"are NOT anagram strings") break else: print("string",s1,"and",s2,"are anagram strings") ...
Abhishek-Tri/Assignment-20
ans-10.py
ans-10.py
py
398
python
en
code
0
github-code
90
37771527078
__author__ = 'Kristoffer Semelenge' ##Created for Python 3.4.X import urllib.request, time, logging, sys from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from smtplib import SMTP timestring = time.strftime("%m%Y") logstring = time....
Krisem/Scripts
PyFond/Py3Rapport.py
Py3Rapport.py
py
2,623
python
en
code
0
github-code
90
18189917019
''' Created on 2020/08/23 @author: harurun ''' def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write N=int(pin()) ans=0 for i in range(1,N+1): ans+=((N//i)*(N//i+1)*i)//2 print(ans) return main()
Aasthaengg/IBMdataset
Python_codes/p02624/s747574318.py
s747574318.py
py
255
python
en
code
0
github-code
90
28860549680
from typing import Optional, List from b_cfn_lambda_layer.dependency import Dependency class PipInstall: def __init__( self, dependencies: Optional[List[Dependency]] = None, additional_pip_install_args: Optional[str] = None, output_directory: Optional[str] = None ...
Biomapas/B.CfnLambdaLayer
b_cfn_lambda_layer/pip_install.py
pip_install.py
py
1,589
python
en
code
1
github-code
90
34872274660
"""Tests formatting as writer-agnostic ExcelCells ExcelFormatter is tested implicitly in pandas/tests/io/excel """ import string import pytest from pandas.errors import CSSWarning import pandas._testing as tm from pandas.io.formats.excel import ( CssExcelCell, CSSToExcelConverter, ) @pytest.mark.parametr...
pandas-dev/pandas
pandas/tests/io/formats/test_to_excel.py
test_to_excel.py
py
15,320
python
en
code
40,398
github-code
90
35901331545
import equinox as eqx import jax import jax.numpy as jnp import numpy as np from jax.interpreters import pxla from jax.interpreters.pxla import PartitionSpec from jaxtyping import Array from utils import skip_if_not_enough_devices import haliax as hax from haliax import Axis, NamedArray from haliax.partitioning import...
standardgalactic/levanter
tests/haliax/test_partitioning.py
test_partitioning.py
py
3,814
python
en
code
null
github-code
90
32446922395
from brownie import accounts, FundMe, network, config, MockV3Aggregator from scripts.helpful_scripts import ( get_account, deploy_mocks, LOCAL_DEVELOPMENT_BLOCKCHAINS, ) def deploy_contract(): account = get_account() if network.show_active() not in LOCAL_DEVELOPMENT_BLOCKCHAINS: price_fee...
terminator60/brownie_fund_me
scripts/deploy.py
deploy.py
py
840
python
en
code
0
github-code
90
3360947614
# -*- coding: utf-8 -*- #变长参数测试 def multiply(*args): total = 1 for arg in args: total *= arg return total def accept(kwargs): for key,value in list(kwargs.items()): print("%s ==> %r" %(key,value)) dist1 = {"foo" :'bar',"spam" :'eggs'} #单个参数,遍 历Map #多个参数 def accept1...
slieer/py
py-dev-study/src/simple/function_arg_1.py
function_arg_1.py
py
574
python
en
code
1
github-code
90
4230269465
import codecs, sys, datetime, logging from filetail import FileTail if __name__ == "__main__": log = logging.getLogger(__name__) out_hdlr = logging.StreamHandler(sys.stdout) out_hdlr.setFormatter(logging.Formatter('%(asctime)s %(message)s')) out_hdlr.setLevel(logging.INFO) log.addHandler(out_...
Sylnai/xup
xcounter.py
xcounter.py
py
797
python
en
code
4
github-code
90
74540809255
import requests from lxml import etree from sql import mysql import urllib3 import threading headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/92.0.4515.159 Safari/537.36 ' } storeList: list = ['food-cupboard-supplies', 'househol...
shopshipshake/Shopshipshake
djangoWebCrawl/crawl/stage_1/jumia.py
jumia.py
py
3,544
python
en
code
7
github-code
90
70537619497
# -*- coding: utf-8 -*- """ Created on Mon Jan 20 22:20:28 2020 @author: israe Brincando com numeros aleatorios """ import random #lancamento do dado for dado in range(10): print(random.randint(1,6), end = " ") menor = int(input("Entre com um numero pequeno: ")) grande = int(input("Entre com um numero gran...
israeljsf95/python_matlab
PythonGeral/Kenneth_Lambert/chap3_3.py
chap3_3.py
py
1,009
python
pt
code
0
github-code
90
16065091396
from bd import Banco from bson import ObjectId class ProvasDb(Banco): def __init__(self): super().__init__() def buscar_todas_provas(self): return self.provas.find({}) def buscar_prova(self, id_prova: int): return self.provas.find({'_id': ObjectId(id_prova)}) ...
OrlandoBitencourt/python_api_flask_backend_orientado
provas.py
provas.py
py
2,590
python
pt
code
0
github-code
90
26243784933
import os from qgis.PyQt import uic, QtCore from qgis.PyQt.QtWidgets import QDialog FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'road_emission_calculator_dialog_base.ui')) class RoadEmissionCalculatorDialog(QDialog, FORM_CLASS): def __init__(self, parent=None): """Constru...
NPRA/RoadEmissionCalculator
road_emission_calculator_dialog.py
road_emission_calculator_dialog.py
py
1,028
python
en
code
4
github-code
90
43356943701
from typing import List, Tuple import random from Models.RL.Envs.macao_utils import build_deck, draw_cards, draw_card, draw_hand,get_last_5_cards, get_card_suite, same_suite, shuffle_deck,\ check_if_deck_empty class MacaoRandom: def __init__(self, player_hand: List, adv_han...
dragosconst/licenta
code/Models/RL/Envs/macao_random.py
macao_random.py
py
5,073
python
en
code
0
github-code
90
15845689619
""" script inspired from: https://github.com/skyline-dev/skyline/blob/53fdcf4491f445ce27105868a7d83d5da676e202/scripts/genPatch.py """ import os import sys import re import struct import json import warnings from typing import Optional, List, Dict, ClassVar from glob import glob from dataclasses import dataclass from c...
H0neyBadger/Splash
scripts/gen_patch.py
gen_patch.py
py
10,795
python
en
code
1
github-code
90
24983062633
import numpy as np import scipy.stats as stats class KalmanFilter: # not really a kalman filter... def __init__(self, M): self.M = M self.x_est = None self.P = None self.isInitialized = False def initialize(self, x_mean, x_cov): self.x_est = x_mean self.P = x_co...
HiroIshida/snippets
ros/sift_pr2/node_script/kalman_filter.py
kalman_filter.py
py
1,075
python
en
code
6
github-code
90
18311413559
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) SI = lambda : sys.stdin.readline().rstrip() T = LI() ...
Aasthaengg/IBMdataset
Python_codes/p02846/s311202040.py
s311202040.py
py
784
python
en
code
0
github-code
90
9293126608
import pickle import sys from collections import defaultdict import re import string from tweetokenize import * from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk import bigrams import nltk from gensim import corpora, models import gensim from tqdm import tqdm from scipy import spatial from...
rakib062/edtech-scrape
helpers/topic_modeling.py
topic_modeling.py
py
6,428
python
en
code
0
github-code
90
13641820885
#!/usr/bin/python from matplotlib import pyplot as plt from matplotlib import rc as rc from matplotlib.patches import Polygon import atpy, glob from numpy import loadtxt, log10 g_o = [] gmi_o = [] data = [] SDSS_files = glob.glob('SDSS_*.xml') for SDSS_file in SDSS_files: table = atpy.Table(SDSS_file, verbos...
andycasey/papers
2011-sgr/figures/cmd.py
cmd.py
py
3,013
python
en
code
0
github-code
90
23430561416
''' Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). ''' def hammingWeight(n): bits_count = 0 num = n while num > 0: if num%2 == 1: bits_count+=1 num = num >> 1 return bits_count print(hammingWei...
sharonpamela/coding_challenges
leetcode/e_191_number_of_1_bits.py
e_191_number_of_1_bits.py
py
327
python
en
code
0
github-code
90
6229547477
import LL class Solution: def reorderFalse(self, head): # this code works but produces # not the intended result. it was written # because I misunderstood the assignment. if not (head and head.next): return head # find last index the list count = 0 ...
kseniiako/dsa
reorder.py
reorder.py
py
2,151
python
en
code
1
github-code
90
6076435445
import pygame import time import random import math pygame.init() # initialize pygame cannon_sound = pygame.mixer.Sound('cannon_shot.wav') explosion_sound = pygame.mixer.Sound('explosion.wav') # Display variables and display init white = (255,255,255) ...
Shneypa/Tanks
tanks.py
tanks.py
py
32,145
python
en
code
0
github-code
90
42425019941
from flask import Flask, request, jsonify, render_template, make_response import cv2 import tensorflow as tf from tensorflow.keras.models import load_model import numpy as np from werkzeug.utils import secure_filename import os from datetime import datetime import requests import telegram import base64 impor...
Elango-spidy/ACCIDENT-DETECTION-AND-ALERT-SYSTEM
app.py
app.py
py
3,411
python
en
code
0
github-code
90
9027047871
import numpy as np from pymongo import MongoClient from flask_cors import CORS, cross_origin from flask import Flask, jsonify, render_template ################################################# # Database Setup ################################################# mongo = MongoClient('localhost', 27017) db = mongo.school...
emilyshewcraft/project-three
Mongo-Flask/mongo_flask.py
mongo_flask.py
py
1,212
python
en
code
0
github-code
90
73682658535
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data from autoencoder.model import Model from config_AE import config # Import MNIST data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Training Parameters learning_rate =...
y4cj4sul3/Autoencoder
train_AE.py
train_AE.py
py
1,248
python
en
code
0
github-code
90
4169486224
import openai import os # this file is separated because ChatGPT's 2021 training data cutoff does not include new ChatCompletion formatting # the API call is hidden here to prevent ChatGPT from trying to replace it with openai.Completion.create def api_call(engine, history): return openai.ChatCompletion.crea...
RealityAnchor/ries-gpt-ui
gpt.py
gpt.py
py
980
python
en
code
11
github-code
90
23986030429
class Solution: def racecar(self, target: int) -> int: dq = deque([(1, 0)]) visited = set() moves = -1 while dq: moves += 1 L = len(dq) for _ in range(L): speed, pos = dq.popleft() if pos == target: ...
birsnot/A2SV_Programming
race-car.py
race-car.py
py
698
python
en
code
0
github-code
90
33693046069
import argparse from src.json_handler import * ap = argparse.ArgumentParser() ap.add_argument('input_file', action = 'store') ap.add_argument('expected_output_file', action = 'store') ap.add_argument('output_directory', action = 'store') args = vars(ap.parse_args()) def evaluate(): descriptions = json.load(open...
JacobMod/Lego_holes_finder
test.py
test.py
py
1,007
python
en
code
1
github-code
90
16571295597
# 作者:tooooo_the_moon # 链接:https://leetcode-cn.com/problems/implement-strstr/solution/kmpsuan-fa-by-aa694849243/ # 来源:力扣(LeetCode) # 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 """ KMP """ class Solution: def strStr(self, haystack: str, needle: str) -> int: pnext = self.gen_pnext(needle) i, j = 0, 0 ...
superggn/myleetcode
base_string/28-implement-strstr-5.py
28-implement-strstr-5.py
py
1,242
python
en
code
0
github-code
90
73986383655
#!/usr/bin/env python import re field_format = re.compile("(?P<name>[^:]+): (?P<from1>[0-9]+)-(?P<to1>[0-9]+) or (?P<from2>[0-9]+)-(?P<to2>[0-9]+)") field_spec, my, nearby = open('16.input').read().split("\n\n") class Field: def __init__(self, name, from1, to1, from2, to2): self.name = name self...
creideiki/adventofcode2020
16-2.py
16-2.py
py
2,044
python
en
code
0
github-code
90
70974934377
import numpy as np from utils import sigmoid, relu # GLOBAL VALUES ETA = 0.01 ITERATIONS = 5000 NEURONS = 4 X = np.array( [[0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1] ]) operators = [ ('XOR', np.array([[0.], [1.], [1.], [0.]])), ('AND', np.array([[0.], [0.], [0.], [1.]])), ('OR', ...
jsxgod/Python-coursework
python/lista6/z1.py
z1.py
py
2,084
python
en
code
0
github-code
90
20837990682
import sys import re from np_chunker import fetch_np_chunks coref_pattern = re.compile('<COREF ID="(?P<ref_id>.*?)">(?P<text>.*?)</COREF>', re.DOTALL) apostrope_pattern = re.compile("(?P<word>[^ ]*?)'s") def parse_input(filename): in_file = open(filename) text = in_file.read() in_file.close() ac...
arun04ceg/CoreferResolver
final_submission_scripts/parse_input.py
parse_input.py
py
2,056
python
en
code
0
github-code
90
42812947534
def str_in_number(): try: num = input('Enter the number: ') num = int(num) return f'Thank you, you entered {num}' except ValueError: return f'Error: Non-numeric value entered.' print(str_in_number())
DeniDrago/Solutions
Conversion Error.py
Conversion Error.py
py
242
python
en
code
0
github-code
90
2574598676
## Imports import urllib.request import aiohttp_cors import numpy as np import aiortc import json import sys import cv2 import os from mask.detect import inference as detect_masks from mask.utils import write_output_video from server.ConnectionContainer import ConnectionContainer from server.ImageGenerator import Imag...
Prelysium/facemask-backend
server.py
server.py
py
7,542
python
en
code
0
github-code
90
74791355816
from django.urls import path from . import views app_name = "polls" urlpatterns = [ path("", views.InvoiceOfSalesView.as_view(), name="invoice_of_sales"), path("invoice-of-sales/", views.InvoiceOfSalesView.as_view(), name="invoice_of_sales"), path("purchase-order/", views.PurchaseOrderView.as_view()...
WeronikaSieniawska/minishop
polls/urls.py
urls.py
py
1,460
python
en
code
0
github-code
90
15597693136
import os from Class_Organize_Files import Organize_Files working_directory = 'raw' list_all_files = os.listdir(working_directory) print('--> We have ',len(list_all_files),'raw files avaialbale \n') ''' Choose sepecified number of directories to be created ''' director_param = { 'option_directory_...
Ranim-94/Stage_Cense_2020
Database/Client_File_Manipulation.py
Client_File_Manipulation.py
py
677
python
en
code
1
github-code
90
20527699024
from operator import index from unittest import result import numpy as np import streamlit as st from PIL import Image import pickle # import the model pipe = pickle.load(open('pipe.pkl','rb')) df = pickle.load(open('df.pkl','rb')) st.title("Diabetics Predictor") img=Image.open("diabetics.jpg") st.image(img, width=...
PrajjwalSingh05/Diabetics-Prediction
app.py
app.py
py
1,955
python
en
code
0
github-code
90
22890667724
"""nsi Revision ID: 79a2c5634f65 Revises: 39578c6f6be7 Create Date: 2018-12-05 11:59:13.853112 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '79a2c5634f65' down_revision = '39578c6f6be7' branch_labels = None depends_on = N...
htengteng/Ihome
ihome/migrations/versions/79a2c5634f65_nsi.py
79a2c5634f65_nsi.py
py
733
python
en
code
0
github-code
90
17620067421
import sys def solution(): n = int(sys.stdin.readline()) space = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] cur = [] for i in range(n): for j in range(n): if space[i][j] == 9: cur = [i, j] space[i][j] = 0 break ...
Lee-Jiseung/codingtest
boj/16236/solution.py
solution.py
py
1,804
python
en
code
0
github-code
90
43285010328
from threading import Thread import os import cv2 import numpy as np import requests import pyfakewebcam import pafy from datetime import datetime import time def putIterationsPerSec(frame, iterations_per_sec): """ Add iterations per second text to lower-left corner of a frame. """ cv2.putText(frame, "...
skyap/video-conference-background
testing.py
testing.py
py
3,762
python
en
code
0
github-code
90
21145858488
""" Azure object detection """ import os from io import BytesIO import requests from PIL import Image, ImageDraw, ImageFont from azure.cognitiveservices.vision.computervision import ComputerVisionClient from msrest.authentication import CognitiveServicesCredentials SUBSCRIPTION_KEY = os.getenv("SUBSCRIPTION_KEY") END...
KuiMing/triathlon_azure
azure_cognitive_services/azure_object_detection.py
azure_object_detection.py
py
1,675
python
en
code
1
github-code
90
13608833489
# # abc103 a # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.r...
mskt4440/AtCoder
abc103/a.py
a.py
py
1,128
python
en
code
0
github-code
90
26205366355
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 23 17:52:57 2020 Version 06 Mai 2020 19:15 @author: beck """ from lmfit import Parameters, minimize, report_fit import numpy as np import matplotlib.pyplot as plt import matplotlib import sys import time import importlib import builtins from tqdm im...
chribe/PyQENS
Code/0.0.2/PQFit.py
PQFit.py
py
19,055
python
en
code
0
github-code
90
9941739488
# IMPORT LOCAL # IMPORT EXTERNAL from dash import Dash, html, Input, Output, dcc import dash_bootstrap_components as dbc # TAB 3: BEST PERFORMING ####################################################################################################### tab3_content = dbc.Card( dbc.CardBody( [ htm...
SzymkowskiDev/nlp-disaster-tweets
dashboard/src/tabs/tab3_content.py
tab3_content.py
py
6,208
python
en
code
3
github-code
90
17079323463
from collections import namedtuple from typing import Optional, List import aoc data: List[str] = aoc.getLinesForDay(7) # data: List[str] = aoc.getLinesForDay(7, force_filepath="inputs/day07_example.txt") # Define Data Structures File = namedtuple("File", ["name", "size"]) class Folder(object): def __init__(s...
tchapeaux/advent-of-code-2022
day07.py
day07.py
py
2,811
python
en
code
0
github-code
90
17951515769
n = int(input()) k = int(input()) x = [int(x.strip()) for x in input().split()] ans = 0 for i in x: if abs(i-k) > i: ans = ans + i else: ans = ans + abs(i-k) ans += ans print(ans)
Aasthaengg/IBMdataset
Python_codes/p03598/s469540985.py
s469540985.py
py
191
python
fr
code
0
github-code
90
6499513189
from django.shortcuts import render, redirect from .forms import itemsForm, UserCrationForm, AuthForm from django.contrib.auth import login, logout from django.contrib.auth.decorators import login_required from .models import items def view_products(request): item = items.objects.all() form = itemsForm() ...
Nayan-Mahida/Rent_Anything
Rent_Anything/views.py
views.py
py
2,491
python
en
code
0
github-code
90
73244711337
import base64 import hashlib import random from typing import ( List, Tuple, ) from ..http import ( HttpRequest, HttpResponse, ) from .. import ( BasicTransformer, TransformerException, ) __all__ = [ 'SEC_WS_APPEND', 'get_sec_ws_accept', 'get_sec_ws_pair', ] SEC_WS_APPEND = '258E...
kedixa/pykedixa
pykedixa/comm/websocket/websocket_upgrader.py
websocket_upgrader.py
py
2,603
python
en
code
1
github-code
90
25107332641
def convert(number): result = "" #the number doesn't have 3, 5 or 7 as a factor if number%3!=0 and number%5!=0 and number%7!=0: result = str(number) #the number has 3 as a factor if number%3==0: result += "Pling" #the number has 5 as a factor if number%5==0: ...
chivalry/exercism-python
users/The-Heyman/python/raindrops/raindrops.py
raindrops.py
py
442
python
en
code
0
github-code
90
13608933019
# # abc114 c # import sys from io import StringIO import unittest from itertools import product, repeat class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.std...
mskt4440/AtCoder
abc114/c.py
c.py
py
1,292
python
en
code
0
github-code
90
20008235889
from typing import List, Tuple, Type import numpy as np import math from sklearn.base import BaseEstimator from sklearn.linear_model import LinearRegression from sklearn.neighbors import KNeighborsRegressor from sklearn.tree import DecisionTreeRegressor from sklearn.model_selection import cross_validate from sklearn.me...
dwslab/kgreat
shared/dm/regression_task.py
regression_task.py
py
2,733
python
en
code
4
github-code
90
18575388639
# -*- coding: utf-8 -*- #AGC020A import sys #import collections #n= int(input()) tmp = input().split() n,a,b = list(map(lambda a: int(a), tmp)) if((b-a)%2==0): print("Alice") else: print("Borys")
Aasthaengg/IBMdataset
Python_codes/p03463/s451259476.py
s451259476.py
py
202
python
en
code
0
github-code
90
34306045960
""" Average daily user counts """ # Imports from datetime import datetime import os import pandas as pd # Verify file path to trax data is correct trafx_data_file_path = os.path.abspath(os.path.join(os.getcwd(), "..", "..", "data", "raw", "TRAFx_raw.csv")) # Load data trafx_df = pd.read_csv(trafx_data_file_path) # ...
MitchFrankel/WBA
wba-trailcounting/src/data/make_dataset_daily_users.py
make_dataset_daily_users.py
py
2,109
python
en
code
0
github-code
90
42044059524
from random import randint board = [] turns = 0 for x in range(0, 5): board.append(["O"] * 5) def print_board(board): for row in board: print(" ".join(row)) def random_row(board): return randint(0, len(board) - 1) def random_col(board): return randint(0, len(board[0]) - 1) ship_row ...
daryadm/python
Misc/battleship.py
battleship.py
py
1,489
python
en
code
0
github-code
90
20909394035
# -*- coding: utf-8 -*- """ Created on Wed Mar 27 13:19:30 2019 @author: W7SP1 """ import pandas as pd import os import locale from locale import atof import numpy from numpy import random import timeit locale.setlocale(locale.LC_CTYPE, 'bulgarian') os.chdir("C:/Documents/GitHub/Kindergarten-Scraping/kindergarten...
tdamdouni/Raspberry-Pi-DIY-Projects
kindergartens/Probabilities.py
Probabilities.py
py
2,486
python
en
code
135
github-code
90
37012298855
delimiter = ',' # file format : token,timestamp(yyyy-MM-dd-HH-mm),price(INR) def read_data(file_name): try: data = {} with open(file_name, 'r') as f: for line in f: tokens = line.split(delimiter) if len(tokens) == 3: key = tokens[0] +...
bhadreswar-ghuku/CryptoAnalysis
CryptoAnalysis/FileHandler.py
FileHandler.py
py
890
python
en
code
0
github-code
90
17368092343
N = int(input()) A = [] for i in range(0, N): row = list(input()) A.append(row) ok = True for i in range(0, N): for j in range(0, N): # i = jの時は調べない if i != j: if A[i][j] == "W": if A[j][i] != "L": ok = False if A[i][j] == "L": ...
bibitto/algorithm
AtCorder/abc/261/b.py
b.py
py
554
python
en
code
0
github-code
90
17862761832
from flask import render_template, Response, request, redirect, session, flash, url_for from flask_login.utils import login_required, logout_user from forms import LoginForm, Email from models import Usuarios from helpers import * from flask_wtf import FlaskForm from app import db, app #LOGIN @app.route("/", methods=...
alyneperez/cadastro_login
cadastro_login/views.py
views.py
py
6,254
python
pt
code
1
github-code
90