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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
11507295486 | # import general python packages
import unittest
import json
from datetime import datetime
import pytz
import logging
# import lusid specific packages
import lusid
import lusid.models as models
from lusid import ApiException
from utilities import InstrumentLoader, IdGenerator
from utilities import TestDataUtilities
fr... | finbourne/lusid-sdk-examples-python | src/tutorials/properties/test_transaction_properties.py | test_transaction_properties.py | py | 6,393 | python | en | code | 2 | github-code | 13 |
8460636455 |
#Iniciar Fibonacci
quantidade = 1
while (quantidade > 0):
quantidade = int(input("Digite um numero inteiro para o calculo do FIBONACCI: "))
contador = 1
numero1 = 0
numero2 = 1
#calculando o fibonacci
while (contador <= quantidade):
print(numero1)
#print(numero2)
numero... | Priscillajessika/Python | Fibonacciwhile.py | Fibonacciwhile.py | py | 445 | python | pt | code | 0 | github-code | 13 |
29487780136 | import sys
import warnings
from collections import Counter
import numpy as np
from sklearn.cluster import KMeans
warnings.filterwarnings("ignore")
class GranularBall:
"""class of the granular ball"""
def __init__(self, data, attribute):
"""
:param data: Labeled data set, the "-2" column is the class label, ... | wcAreYouOk/GBRS | Code/tolls/GranularBall.py | GranularBall.py | py | 2,659 | python | en | code | 0 | github-code | 13 |
39211398454 | import solveutils
import scramble
import cube.vectors as vc
import numpy as np
BUFFERORDER = {
"corner": ["UFR", "UFL", "UBL", "UBR", "DFR", "DFL", "DBR"],
"edge": ["UF", "UB", "UR", "UL", "DF", "DB", "FR", "FL", "DR", "DL", "BR"],
}
PSEUDOS = {
"UFR": ("UF", "UR"),
"UFL": ("UF", "UL"),
"UBR": ("U... | elliottkobelansky/3BLD-Analyzer | 3BLD-Analyzer/solve.py | solve.py | py | 3,144 | python | en | code | 1 | github-code | 13 |
25130614980 | #
# Milking the Goat
# Author: Marcelo Martins
# Source: https://github.com/mmartins000/milkingthegoat
#
# Pre-requisites:
# Python modules GitPython, Docker
# Internet access to download container images and clone Git repos
import time
import datetime
import argparse
import sys
import os
from pathlib import Path
impo... | mmartins000/milkingthegoat | milking_goat.py | milking_goat.py | py | 59,803 | python | en | code | 0 | github-code | 13 |
33565502718 | import re, urllib, urllib2
arguments = ["self", "info", "args"]
helpstring = "wra <math stuff>"
minlevel = 1
def main(connection, info, args) :
encoded = urllib.urlencode({"i":" ".join(args[1:])})
request = urllib2.Request("http://www.wolframalpha.com/input/", encoded)
request.add_header('User-Agent', 'Ope... | sonicrules1234/sonicbot | oldplugins/wra.py | wra.py | py | 965 | python | en | code | 10 | github-code | 13 |
36569740341 | numeros = [1,2,3,4,5,6]
saida = [0,0,0,0,0,0]
total = 1
anterior = 0
for i in range(len(numeros)):
anterior = total
total = total * numeros[i]
saida[i] = anterior
total = 1
anterior = 0
for i in range(len(numeros)-1,-1,-1):
anterior = total
total = total * numeros[i]
saida[i] = saida[i] * a... | ltakuno/arquivos | python/URI/produtorio.py | produtorio.py | py | 357 | python | en | code | 0 | github-code | 13 |
12269757258 | import sys
sys.stdin = open("Ladder1_input.txt", "r")
for testcase in range(1, 11):
input()
matrix = [[] for i in range(100)]
for i in range(100):
matrix[i] = input().split()
end = 0
for i in range(100):
if matrix[99][i] == '2':
end = i
break
now_x , no... | ksinuk/python_open | my_pychram/7 stack/Ladder1.py | Ladder1.py | py | 721 | python | en | code | 0 | github-code | 13 |
25207618914 | import os, pytest, yaml
import blazon
from blazon import Schematic, json
def test_from_file():
class Swagger(Schematic):
__schema__ = json.from_file(
os.path.join(os.path.dirname(__file__), "schemas", "swagger.yaml"), name="Swagger"
)
s = Swagger()
assert not s.validate()
... | DeadWisdom/blazon | tests/test_swagger.py | test_swagger.py | py | 1,527 | python | en | code | 6 | github-code | 13 |
20424029473 | from vedo import Mesh
from math import fabs
import numpy as np
import Sofa.SofaBaseTopology
def find_fixed_box(source_file, scale):
"""
Find the fixed box of the model.
:param str source_file: Mesh file
:param float scale: Scale to apply
:return: Min and max corners of the fixed box.
"""
... | mimesis-inria/DeepPhysX.Sofa | examples/demos/Armadillo/UNet/Environment/utils.py | utils.py | py | 6,015 | python | en | code | 3 | github-code | 13 |
2222927371 | """
practice_sequences.py
Get more practice with sequences
Snehitha Mamidi
February 17, 2020
"""
class Practice(object):
"""
Illustrate methods that transform input sequences
into something else
"""
def months_and_days(self, month_names, month_days):
"""
Create a string with i... | Snehitha98/COMP525-lab3 | problems/practice_sequences.py | practice_sequences.py | py | 2,230 | python | en | code | 0 | github-code | 13 |
2274771630 |
import attr
from ndk.definitions import contactgroup
@attr.s
class ContactGroup(contactgroup.ContactGroupDirective):
alias = attr.ib(type=str,
converter=str,
validator=attr.validators.instance_of(str),
kw_only=True)
@alias.default
def _set_alia... | VunkLai/ndk | ndk/objects/contactgroup.py | contactgroup.py | py | 388 | python | en | code | 0 | github-code | 13 |
31258069222 | import torch
import torch.nn as nn
from layers import *
class GNN_JK(nn.Module):
""" GNN with JK design as a node classification model """
def __init__(self, dim_feats, dim_h, n_classes, n_layers, activation, dropout, gnnlayer_type='gcn'):
super(GNN_JK, self).__init__()
heads = [1] * (n_layers ... | worldinmyfist/Graph_Augmentation | GAugO/model/GNN_JK.py | GNN_JK.py | py | 1,308 | python | en | code | 0 | github-code | 13 |
25811066704 | """
TCP NULL, FIN, and Xmas scans
nmap flags: -sN; -sF; -sX
"""
import socket
from impacket import ImpactPacket, ImpactDecoder
from impacket.ImpactPacket import TCP
src = '10.0.2.15'
dst = '10.0.2.4'
sport = 12345 # Random source port
dport = 81 # Port that we want to probe
# Create a new IP packet and set i... | nandan-desai-extras/nmap-port-scan-works | tcp_null_fin_xmas.py | tcp_null_fin_xmas.py | py | 2,992 | python | en | code | 0 | github-code | 13 |
41182544464 | import os
import pickle
from distutils.util import strtobool
from core import constants
def query_yes_no(question, default="yes"):
print('{question} [y/n]'.format(question=question))
while True:
try:
return strtobool(input().lower())
except ValueError:
print("Please r... | knyghty/linguistic-analysis | la/twtr/select_tweets.py | select_tweets.py | py | 830 | python | en | code | 0 | github-code | 13 |
41903703680 | #A program that counts up to a certain number, and
#only prints out the primes between 1 and that number.
list=[]
for x in range(2,10000):
if x <= 2:
list.append(x)
for n in list:
if any(x % n == 0 for n in list):
continue
elif x % n > 0:
li... | smithevanb/ArgumentClinic | prime.py | prime.py | py | 378 | python | en | code | 0 | github-code | 13 |
16299277620 | from django.conf.urls import url
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from tastypie.utils import trailing_slash
from .models import GitHubUser
class GitHubUserResource(ModelResource):
followers = fields.ToManyField('self', 'followers', use_in='detail'... | matthewcburke/github_users | github_users/github_users/api.py | api.py | py | 3,139 | python | en | code | 0 | github-code | 13 |
33536076698 | #!/usr/bin/env python3
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# NAME: ti.py #
# #
# VERSION: 20230403 ... | southwickIO/cloudy-rabbit | src/ti.py | ti.py | py | 5,516 | python | en | code | 0 | github-code | 13 |
4168297606 | import logging, sys, os
def find():
platform = ''
for char in sys.platform:
if char in '1234567890': break
platform += char
fun = globals().get(platform, None)
if fun is None:
print('Error: unable to get platform for %s' % platform, file=sys.stderr)
sys.exit(1)
log... | arp242/battray | battray/platforms.py | platforms.py | py | 8,123 | python | en | code | 5 | github-code | 13 |
16295369240 | '''
*args,**kwargs(kwargs IS OUT OF CONTEXT RN)(ONLY ARGS)
Exception Handling :
Try Except Else Finally
File Handling :
'''
###EXCEPTION HANDLING
##print(1/0)
try:
div = 1/0
except Exception :
print('you cannot divide by 0')
### this loops infinitely unless user enters a number
while True:
... | shyamgupta196/old-code | BootCamp/day7.py | day7.py | py | 896 | python | en | code | 0 | github-code | 13 |
15551317935 | from pwn import *
from pwn import p64
debug = 1
gdb_is = 1
# context(arch='i386',os = 'linux', log_level='DEBUG')
context(arch='amd64',os = 'linux', log_level='DEBUG')
if debug:
context.terminal = ['/mnt/c/Users/sagiriking/AppData/Local/Microsoft/WindowsApps/wt.exe','nt','Ubuntu','-c']
if not gdb_i... | Sagiring/Sagiring_pwn | 羊城杯/shellcode/pwn_exp.py | pwn_exp.py | py | 847 | python | en | code | 1 | github-code | 13 |
10477087540 | # LALR(1) parser for grammars. This version is based on the LR(1)-automaton
# states merging. If the states share the same LR(0)-items they get merged in a
# unique state with the lookaheads merged together. The future implementation will be
# based on the recursive equatios algorithm invented by Paola Quaglia. The pro... | amathebest/Parser_Project | OLD_lalr1_parser.py | OLD_lalr1_parser.py | py | 23,754 | python | en | code | 3 | github-code | 13 |
13240535109 | import cv2
import numpy as np
import argparse
def infec_region(img_path):
img1 = cv2.imread(img_path)
# '.\\0d2e2971-f1c9-4278-b35c-91dd8a22a64d___RS_Early.B_7581.JPG')
img = cv2.resize(img1, (0, 0), fx=0.5, fy=0.5)
original = img.copy()
neworiginal = img.copy()
blur1 = cv2.GaussianBlur(img, ... | jayeshk-21/Plant-Disease-Detection-And-Cure | PDD/plant_infection.py | plant_infection.py | py | 4,019 | python | en | code | 0 | github-code | 13 |
16408714993 | """
问题51
写一个方法用于计算5 / 0, 并用try/except捕获异常
"""
def devide(x, y):
try:
print(x / y)
print('Division ok.')
except ZeroDivisionError as er:
print(er)
except Exception as der:
print(der)
finally:
print('Division finally.')
while True:
x = int(input())
... | martinleeq/python-100 | day-07/question-051.py | question-051.py | py | 389 | python | en | code | 3 | github-code | 13 |
38613422112 | import logging
from hashlib import sha256
import structlog
from flask import current_app
from google.cloud import storage
from google.cloud.exceptions import NotFound
from application.exceptions import GCPBucketException, RasError
log = structlog.wrap_logger(logging.getLogger(__name__))
class GoogleCloudSEFTCIBuck... | ONSdigital/ras-collection-instrument | application/models/google_cloud_bucket.py | google_cloud_bucket.py | py | 3,049 | python | en | code | 2 | github-code | 13 |
27555144154 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""""
paste.py
~~~~~~~~~~~~~~~~~~~~
:author: wongxinjie
:date created: 2019-08-14 01:04
"""
from flask import request, jsonify
import configs
from api import api
from service.paste import (
srv_create_paste,
srv_get_short_url_content
)
from servi... | wongxinjie/bitly | api/paste.py | paste.py | py | 1,552 | python | en | code | 0 | github-code | 13 |
27876628745 | import os
input_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'input')
cache_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'cache')
full_split = (os.path.join(input_dir, 'clicks_train.csv.gz'), os.path.join(input_dir, 'clicks_test.csv.gz'))
cv1_split = (os.path.jo... | alno/kaggle-outbrain-click-prediction | util/meta.py | meta.py | py | 892 | python | en | code | 77 | github-code | 13 |
28362951255 | from fnmatch import fnmatch
from os import listdir
from unittest import TestCase
from pylegos.core import FileUtils
class TestFileUtils(TestCase):
Sut = FileUtils()
def test_pathUtils(self):
pd = self.Sut.getParentDir(filePath=__file__)
self.assertEqual('/Users/gchristiansen/projects/pyLeg... | velexio/pyLegos | tests/test_FileUtils.py | test_FileUtils.py | py | 2,450 | python | en | code | 0 | github-code | 13 |
40663845019 | #!user/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on 20170528
@author: JohnHuiWB
'''
import numpy as np
class kMeans(object):
def __init__(self):
self._assassment = 0
self._center = 0
self._k = 0
self._data_set = 0
def _cal_euclidean_distance(self, vec1, vec2):
... | JohnHuiWB/SynX-NLP | SynXNLP/cluster/kMeans.py | kMeans.py | py | 5,597 | python | en | code | 0 | github-code | 13 |
25535699383 | import functools as fn
import re
# -- Importing/parsing ---------------------------------------------------------
with open("2023-Python/day-05/input.txt") as input_file:
input = input_file.read().split("\n\n")
seeds = [int(x) for x in re.findall(r"\d+", input[0])]
maps = [
[[int(x) for x in map.split()] for... | wurli/advent-of-code | 2023-Python/day-05/code.py | code.py | py | 1,773 | python | en | code | 0 | github-code | 13 |
11166631296 | from annoying.decorators import render_to
from .models import Record
from .forms import AddRecordForm
from common import common
__author__ = 'Anna Bomersbach'
__credits__ = ['Anna Bomersbach', 'Tomasz Kubik']
__license__ = "GPL"
__version__ = "1.0.1"
__maintainer__ = 'Anna Bomersbach'
__email__ = "184779@student.pwr.... | shaunthesheep/bachelor | rental_service/records/views.py | views.py | py | 1,289 | python | en | code | 0 | github-code | 13 |
13155092748 | """ Python script to process the output of a set of batch jobs, extracting key information to dump to csv
@author Peter Heywood <p.heywood@sheffield.ac.uk>
"""
import argparse
import re
import os
import sys
import csv
import math
import datetime
import subprocess
import pathlib
from distutils.util import strtobool
fr... | ptheywood/flamegpu-instrumentation-extractor | flamegpu_instrumentation_extractor.py | flamegpu_instrumentation_extractor.py | py | 9,966 | python | en | code | 0 | github-code | 13 |
71645247699 | """
Provides Widgets to be used in dialogues and settings, with a standardized function to return the data
"""
from PySide2 import QtWidgets, QtCore
from .widgets import ColorSelectWidget
from utils import style_selector_widgets as styles
class BaseFieldWidget():
def data(self):
pass
class LineEditField... | BoredlyGit/CongressionalAppChallengeEntry | utils/field_widgets.py | field_widgets.py | py | 4,465 | python | en | code | 0 | github-code | 13 |
38036688798 | import os
import uuid
import ROOT
from DCubeUtils import DCubeObject, DCubeException
import unittest
##
# @class DCubePlotter
# @author Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMagh.edu.pl)
# @brief root plotter for DCubeClient package
class DCubePlotter( DCubeObject ):
## DCubePlotter TCanvas
canvas = Non... | rushioda/PIXELVALID_athena | athena/Tools/RunTimeTester/testsuite/DCubeClient-00-00-21/python/DCubePlotter.py | DCubePlotter.py | py | 32,574 | python | en | code | 1 | github-code | 13 |
70549487378 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy import Column, Integer, String, Numeric, DateTime, Boolean, ForeignKey, func
from sqlalchemy.orm import relationship
Base = declarative_base()
Transaction = None
cl... | baverman/taburet | taburet/transactions/model.py | model.py | py | 6,801 | python | en | code | 1 | github-code | 13 |
17042301544 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.DeliveryAgencyMerchantInfo import DeliveryAgencyMerchantInfo
class AlipayMarketingActivityDeliverychannelQueryModel(object):
def __init__(self):
self._belong_merchant... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayMarketingActivityDeliverychannelQueryModel.py | AlipayMarketingActivityDeliverychannelQueryModel.py | py | 2,811 | python | en | code | 241 | github-code | 13 |
20806875648 | from pulp import *
prob = LpProblem("Giapetto", LpMaximize) # Create a LP maximization problem
x1 = LpVariable("x1", lowBound=0) # Create a variable x1 >= 0
x2 = LpVariable("x2", lowBound=0) # Create another variable x2 >= 0
prob += 20*x1 + 30*x2 # Objective function
prob += 1*x1 + 2*x2 <= 100 # Finishing hours... | DigvijayRed/LPP-Problems | LPP1.py | LPP1.py | py | 2,371 | python | en | code | 0 | github-code | 13 |
26789807061 | # -*- coding: UTF-8 -*-
from pyecharts import Map
value =[20, 190, 253, 77, 65]
attr =['汕头市', '汕尾市', '揭阳市', '阳江市', '肇庆市']
map=Map("广东地图示例", width=1200, height=600)
map.add("", [], [], maptype=u'广东', is_visualmap=True, visual_text_color='#000')
map.show_config()
map.render() | forestopen/MapTravelVisualize | 广东市.py | 广东市.py | py | 322 | python | zh | code | 0 | github-code | 13 |
23319881726 | from flask import Flask,Response
import logging
log = logging.getLogger('werkzeug')
log.disabled = True
app = Flask(__name__)
@app.route('/')
def hello():
return Response('hello world', mimetype='text/plain')
if __name__ == "__main__":
app.run(port=8080, debug=False) | siimp/benchmarks | simple/flask-simple/app.py | app.py | py | 285 | python | en | code | 0 | github-code | 13 |
23392019450 | import glob
import os
import setuptools
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.rst'), 'r') as f:
readme = f.read()
setuptools.setup(
name='rpn_calculator',
version='1.2.1.3',
description='RPN calculator for CLI',
long_description=readme,
url='https://github... | massongit/rpn-calculator | setup.py | setup.py | py | 734 | python | en | code | 0 | github-code | 13 |
3027907072 | #!/usr/bin/python
import sys
import re
path = "input.txt"
def day3():
grid = [[' ' for j in range(1000)] for i in range(1000)]
for line in open(path):
id, x, y, lenx, leny = [int(s) for s in re.findall('\d+', line )]
for i in range(leny):
for j in range(lenx):
if g... | MartinsGabrielC/AdventOfCode2018 | 3/day3.py | day3.py | py | 1,103 | python | en | code | 0 | github-code | 13 |
21786347690 | # builtin
import importlib
# site
import colorama
class VoluxDemo:
def __init__(
self, demo_name, demo_method, alias, requirements=[], *args, **kwargs
):
self._name = demo_name
self._method = demo_method
self._alias = alias
self._requirements = requirements # optional... | DrTexx/Volux | volux/demo.py | demo.py | py | 1,683 | python | en | code | 7 | github-code | 13 |
70728396818 | from tkinter import *
class Window(Frame):
def __init__(self, master = None):
Frame.__init__(self, master)
self.master = master
##new function added
self.init_window()
##create function init_window
def init_window(self):
##set the title of the window to GUI
self.master.title("GUI")
##filling up the window a... | LuminousMirage/sendex-tutorial | 1 basic/python 3 tutorial 39 tkinter buttons.py | python 3 tutorial 39 tkinter buttons.py | py | 623 | python | en | code | 0 | github-code | 13 |
32970544554 | from __future__ import unicode_literals
from django.db import models
from django.core.urlresolvers import reverse
# Create your models here.
class Article(models.Model):
title = models.CharField(max_length = 100) #title
category = models.CharField(max_length = 50, blank = True) #categore
date_time = model... | 392110851/django_blog | django_blog/blog/models.py | models.py | py | 772 | python | en | code | 0 | github-code | 13 |
31478111029 | from aiogram import types, Dispatcher
from aiogram.types import ParseMode, InlineKeyboardMarkup, InlineKeyboardButton
from config import bot, dp
#from keyboards import client_kb
#@dp.message_handler(commands=['start'])
async def start_handler(message: types.Message):
await bot.send_message(message.from_user.id,
... | kairatnurmakhan/bot-19 | handlers/client.py | client.py | py | 2,164 | python | en | code | 0 | github-code | 13 |
3114869587 | import logging
import re
from bs4 import BeautifulSoup
from oxint.utils.TimeUtils import TimeUtils
from oxint.utils.URLUtils import URLUtils
class ScrapInfocif:
INFOCIF_URL_BASE = "http://www.infocif.es"
def search_company_by_cif(self, cif: str):
company_info = None
if cif is not None:
... | joaquinOnSoft/oxint | src/oxint/scraping/ScrapInfocif.py | ScrapInfocif.py | py | 7,074 | python | en | code | 0 | github-code | 13 |
29181534483 | '''
Created on Oct 20, 2015
@author: bardya
'''
import os
import argparse
import re
import sys
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(description='Get the ancestral consensus sequence from a hmm file')
parser.add_argument('-i', dest='infilepath', metavar='<hmm_file_path>', ... | ba1/BioParsing | tbl2scores_cutoff.py | tbl2scores_cutoff.py | py | 1,628 | python | en | code | 1 | github-code | 13 |
25502547911 | import numpy as np
import glob
import pickle
import juliet
import matplotlib.pyplot as plt
import ray
ray.shutdown()
ray.init()
def fit_transit_by_transit(P, P_err, t0, t0_err, ecc, omega, GPmodel = 'QP', outpath = 'planetfit', in_transit_length = 0.):
# First, extract both sectors and folders of those sectors ... | gavinxwang/variable-depths | Scripts/utils.py | utils.py | py | 5,873 | python | en | code | 0 | github-code | 13 |
17059859174 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class SignRecordLogVO(object):
def __init__(self):
self._s_version = None
self._status = None
self._trans_date = None
@property
def s_version(self):
return self... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/SignRecordLogVO.py | SignRecordLogVO.py | py | 1,810 | python | en | code | 241 | github-code | 13 |
40397707284 | """
方案一:基于视觉词汇的花卉识别方法
"""
import glob
import cv2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
import matplotlib.mlab as mlab
from sklearn.cluster import KMeans,MiniBatchKMeans
import kNN
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import NullFormatter
from sklear... | xkazm/Pattern-Recognition-Course-Design | test/main.py | main.py | py | 5,260 | python | en | code | 1 | github-code | 13 |
73705961937 | #!python3
# desafio \/
# def dia_semana(dia):
# dias = {
# 1: 'Domingo',
# 2: 'Segunda',
# 3: 'Terça',
# 4: 'Quarta',
# 5: 'Quinta',
# 6: 'Sexta',
# 7: 'Sábado',
# }
# return dias.get(dia)
# if __name__ == '__main__':
#
# dia_informado = int(input('Inform... | EderPBorges/EstudosPython | estruturas_controle/switch_2.py | switch_2.py | py | 1,063 | python | pt | code | 0 | github-code | 13 |
34518432616 | import numpy as np
import itertools
from scipy import stats
class Dynamic_features:
def dynamic_calculation(self,ethsize):
sum_packets = sum(ethsize)
min_packets = min(ethsize)
max_packets = max(ethsize)
mean_packets = sum_packets / len(ethsize)
std_packets = np.std(ethsize)... | Madhav-Malhotra/cicIoT | iot_scripts/feat_extract/Dynamic_features.py | Dynamic_features.py | py | 1,438 | python | en | code | 1 | github-code | 13 |
41503437065 | """Perform JOIN queries on models with relationships."""
from sqlalchemy.orm import Session
from logger import LOGGER
from sqlalchemy_tutorial.part3_relationships.models import Comment, Post, User
def get_all_posts(session: Session, admin_user: User):
"""
Fetch all posts belonging to an author user.
:pa... | hackersandslackers/sqlalchemy-tutorial | sqlalchemy_tutorial/part3_relationships/joins.py | joins.py | py | 1,152 | python | en | code | 67 | github-code | 13 |
70680312979 | import tensorflow as tf
import keras as k
from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import load_model
import numpy as np
import matplotlib.pyplot as plt
import h5py
import os
from PIL import Image
MODEL_FILENAME = 'model_fruit_fresh_rotten'
# PATH_TO_TRAINED_MODEL_FILE = 'model/'+... | trigus00/Fruits | fresh_rotten_fruits-Final /model_test.py | model_test.py | py | 2,001 | python | en | code | 0 | github-code | 13 |
37526401375 | """===============================================================================
FILE: _gstasks/html_formatter.py
USAGE: (not intended to be directly executed)
DESCRIPTION:
OPTIONS: ---
REQUIREMENTS: ---
BUGS: ---
NOTES: ---
AUTHOR: Alex Leontiev (alozz1991@gmail.com)
OR... | nailbiter/pyassistantbot2 | _gstasks/html_formatter.py | html_formatter.py | py | 8,883 | python | en | code | 0 | github-code | 13 |
21676200262 | """
유일성을 만족하는 키들을 모두 구한다.
유일성을 만족하는 키 중 최소성을 만족하는 키를 구하려면 부분집합에 포함되는지를 확인하면 된다.
부분집합을 확인하는데 있어, 가장 적은 키를 포함하는 부분부터 진행해야한다.
아니라면 최소성을 만족시키지 못하는 경우도 발생한다.
"""
from itertools import combinations
def isCandidate(answer_set, cb):
for i in range(1, len(cb)+1):
for c in combinations(cb, i):
if c in a... | SangHyunGil/Algorithm | Programmers/Lv2/후보키(Python).py | 후보키(Python).py | py | 1,121 | python | ko | code | 0 | github-code | 13 |
41504311313 | import re, hoshino, os, json
from . import RSS_class, rsshub
from hoshino import Service, priv
from hoshino.typing import CQEvent
from .config import *
sv_help = '''
- [添加订阅 订阅名 RSS地址(/twitter/user/username)]
- [删除订阅 订阅名]
- [查看所有订阅]
'''.strip()
sv = Service(
name = '推特订阅', #功能名
use_priv = priv.NORMAL, #使用权限... | sanshanya/hoshino_xcw | XCW/Hoshino/hoshino/modules/CQTwitter/CQTwitter.py | CQTwitter.py | py | 4,387 | python | en | code | 231 | github-code | 13 |
36872760771 | """A module containing tools that a discord user might need."""
from enum import Enum
from typing import Union
from discord.ext import commands
from discord import Role, Embed
from src.cogs.base import ConfiguredCog
class RequestAction(Enum):
"""An enumeration class containing all the possible role request acti... | scytail/Manageable | src/cogs/user_tools.py | user_tools.py | py | 9,035 | python | en | code | 1 | github-code | 13 |
31803030853 | from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import Union
from psycopg2 import sql
# --------------------------------------------------------------------------- #
# SQL COMMAND #
# ----------------------------... | john-james-ai/drug-approval-analytics | src/infrastructure/data/sequel.py | sequel.py | py | 22,331 | python | en | code | 0 | github-code | 13 |
30578887074 | # -*- coding: utf-8 -*-
import sys
import appmodel
import cargardata
import os
import pickle
import model
import Noticia
import shutil
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog,QMessageBox,QTableWidgetItem,QWidget,QHeaderView
from PyQt5.QtGui import QImage, QPalette, QBrush
from PyQt5.QtCore im... | Eufalo/Machine-Learning | controlador_Index.py | controlador_Index.py | py | 12,511 | python | es | code | 0 | github-code | 13 |
23248327916 | #!/usr/bin/env python3
# encoding: utf-8
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def get_len(head: ListNode):
it = head
cnt = 0
while it is not None:
it = it.next
cnt += 1
return cnt
def move_to_last_k(head: ListNode... | misaka-10032/leetcode | coding/00061-rotate-list/solution.py | solution.py | py | 971 | python | en | code | 1 | github-code | 13 |
26971581032 | # for loops are used when you know the exact number of iterations going to be happend
sum_ = 0
# for number in range(1, 101):
# sum_ = sum_ + number
# print("Sum of first 100 number:", sum_)
def is_prime(number):
for x in range(2, int(number ** 0.5)):
if number % x == 0:
return False
r... | annup76779/python5tutor | Abdullah/velocity.py | velocity.py | py | 718 | python | en | code | 0 | github-code | 13 |
34487225926 | # 31 - Faça um programa que receba a altura e o peso de uma pessoa. De acordo com a tabela a seguir, verifique e mostre qual a clissificação dessa pessoa
# [Altura ] [Peso ]
# 60 | Entre 60 e 90 | +90
# Menor que 1,20 | A | D | G
# De 1,20 a 1,70 | B | ... | puchunim/curso-geeky-university | 005 - Estruturas lógicas e condicionais/003 - Exercícios/031-043/main.py | main.py | py | 8,186 | python | pt | code | 0 | github-code | 13 |
31702072468 | #############################################################
#Date: 10.02.22 #
#Programmed by: Luka Henig (luka.henig@gmail.com) #
#Curse: 100 Days of Code(udemy) #
#Description: Litle pong game to learn and understand #
#pyth... | LukaHenig/Pong_Game | pong/scoreboard.py | scoreboard.py | py | 1,471 | python | en | code | 0 | github-code | 13 |
1382011846 | import serial
from typing import Type
import tkinter as tk
from tkinter import ttk
from controller import Controller
class ManualFrame(tk.Frame):
def __init__(
self,
master: Type[tk.Frame],
controller: Type[Controller],
ser: Type[serial.Serial] = None,
):
self.master = ... | miqueiasmiguel/cnc_controller | frame_tab_manual.py | frame_tab_manual.py | py | 6,980 | python | en | code | 0 | github-code | 13 |
14693770141 | #!/usr/bin/python3
def safe_print_list_integers(my_list=[], x=0):
num = 0
for elements in my_list[:x]:
try:
print("{:d}".format(elements), end='')
num += 1
except (ValueError, TypeError):
continue
print()
return num
| Ninolincy/alx-higher_level_programming | 0x05-python-exceptions/2-safe_print_list_integers.py | 2-safe_print_list_integers.py | py | 284 | python | en | code | 1 | github-code | 13 |
12214205963 |
# gen code for:
# - Table Record C++ header file
# - C++ Class header file
# - C++ Class source file
from helper import get_field_by_col, get_macro_name
import record_header_codegen
import class_header_codegen
import class_source_codegen
class CRUDCodeGen:
def __init__(self, conn, table_name, c... | dualface/cpp_activerecord | codegen/__init__.py | __init__.py | py | 3,573 | python | en | code | 2 | github-code | 13 |
34199298894 | """Main module."""
import typing
from dataclasses import asdict
import requests
from pydantic import BaseModel
import paddle_api.type_defs as td
T = typing.TypeVar("T", bound=BaseModel)
T_CREATE = typing.TypeVar("T_CREATE", bound=BaseModel)
T_UPDATE = typing.TypeVar("T_UPDATE", bound=BaseModel)
T_INSTANCE = typing.T... | Korben11/paddle_api | paddle_api/paddle_api.py | paddle_api.py | py | 4,688 | python | en | code | 0 | github-code | 13 |
34071206580 | ls = [l for l in iter(input,'')]
ss = []
for l in ls:
ss.append(int(l.replace('F','0').replace('B','1').replace('R','1').replace('L','0'),base=2))
for s in range(9000):
if s+1 in ss and s-1 in ss and s not in ss:
print(s)
| UnrelatedString/advent-of-code-2020 | aoc5-2.py | aoc5-2.py | py | 241 | python | en | code | 1 | github-code | 13 |
33340605164 | import pymysql
import codecs
import csv
def conn_mysql():
conn = pymysql.connect(host='localhost', user='root', password='330324zhs', db='Hot_News', port=3306, autocommit=True)
return conn
def query_all(cur,sql,args):
cur.execute(sql, args)
return cur.fetchall()
def write_into_db(datas,TotalNum):
... | Houzss1/News-hots-discovery-system | NewsWeb/mypackage/db_operate.py | db_operate.py | py | 4,616 | python | en | code | 1 | github-code | 13 |
42208077284 | import pandas as pd
import numpy as np
animals = ["Tiger", "Bear", "Moose"]
#print(pd.Series(animals))
animals = ["Tiger", "Bear", None]
#print(animals[:]) # ":" means "from the first element to the last"
#print(pd.Series(animals))
#Querying a Series
sports = {"Archery": "Bhutan", "Golf": "Scotland", "Sumo": "Jap... | t3rmin41/tribe-of-ai-python | class_D/modules/tribe/ai/coursera/SeriesDatastructure.py | SeriesDatastructure.py | py | 1,509 | python | en | code | 0 | github-code | 13 |
41257103101 | from die import Die
# Create a D6.
die = Die()
# Make some rolls. and store results in a list.
results = []
for roll_num in range(1000):
result = die.roll()
results.append(result)
# Analizing the Results by counting how many times we roll each number
frequences = []
for value in range(1, die.num_sides+1):
... | fadiabji/data_science | die_visual.py | die_visual.py | py | 871 | python | en | code | 0 | github-code | 13 |
16132473603 | """
Purpose: Synchronization with Barriers
- for use by a fixed number of threads that need to wait for each other.
- Each thread tries to pass a barrier by calling the wait() method, which will
block until all of threads have made that call.
As soon as that happens, the threads are released simultaneously.
- The b... | udhayprakash/PythonMaterial | python3/19_Concurrency_and_Parallel_Programming/01_MultiThreading/g_barriers/a_barriers.py | a_barriers.py | py | 1,257 | python | en | code | 7 | github-code | 13 |
38380839333 | from typing import List, Tuple
def parse(input_data: str) -> List[Tuple[str, int]]:
lines = input_data.strip().split('\n')
course = [line.split() for line in lines]
course = [(direction, int(dist)) for direction, dist in course]
return course
def underway(x, z, instruction):
if instruction[0] ==... | mharty3/advent_of_code | 2021/day-02.py | day-02.py | py | 1,557 | python | en | code | 0 | github-code | 13 |
14541325069 | from PyQt5.QtCore import pyqtSlot
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QApplication, QGraphicsScene, QGraphicsPixmapItem, QGraphicsView
from PyQt5.QtGui import QImage, QPixmap
import cv2
class GraphicsView(QGraphicsView):
"""
Class documentation goes h... | zongdai/PerMo | 3D_Tool/widgets.py | widgets.py | py | 2,547 | python | en | code | 1 | github-code | 13 |
6127507994 | import tensorflow as tf
from tframe import console
import core
import model_lib as models
def main(_):
console.start('Task CNN (MEMBRANE)')
th = core.th
th.job_dir = './records_unet_alpha'
th.model = models.unet
th.suffix = '01'
th.batch_size = 2
th.learning_rate = 1e-4
th.epoch = ... | Wuyou98/Image_unet | unet/task_cnn.py | task_cnn.py | py | 820 | python | en | code | 0 | github-code | 13 |
16189388540 | import BitVector
# Problem 1.1
# Is Unique: Implement and algorithm to determine if a string has all unique characters.
# What if you couldn't use additional data structures
def isunique(uniquestring):
lettermap = {}
for letter in uniquestring:
if lettermap.__contains__(letter):
return Fa... | SamRosentel/cracking-the-coding-interview | chapter1problems.py | chapter1problems.py | py | 5,533 | python | en | code | 0 | github-code | 13 |
1110472490 | #!/usr/bin/env python3
import pickle
import re
from collections import OrderedDict
from time import sleep
import zmq
import node
class FuzzyClient:
def __init__(self, ip='localhost', port=5555):
self.ip = ip
self.port = port
self.context = zmq.Context()
self.socket = self.context... | sngjuk/fuzzy-flow | src/client.py | client.py | py | 14,114 | python | en | code | 0 | github-code | 13 |
40262924923 | from datetime import datetime
from typing import Optional, Union
import phonenumbers
from aiogram import Bot, types
from aiogram.dispatcher.filters.state import State, StatesGroup
from aiogram.types import InlineKeyboardMarkup, ReplyKeyboardMarkup, InlineKeyboardButton
from app import config
bot = Bot(token=config.T... | Msakhibullin24/bot | app/states/common.py | common.py | py | 3,978 | python | en | code | 1 | github-code | 13 |
72393855698 | #!/usr/bin/env python
"""
Sum square difference
Problem 6
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^2 = 55^2 = 3025
Hence the difference between the sum of the squares of the first te... | cynful/project-euler | p006.py | p006.py | py | 682 | python | en | code | 0 | github-code | 13 |
12645603953 | #!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
import matplotlib.tri as tri
b=pd.read_csv('pmf-mask-t6.dat', header=None, delim_whitespace=True, comment='#')
b.columns = ['beta', 'alpha', 'pmf','prob']
a=b[b.pmf<9999]
#b.pmf[b... | xinyugu1997/CPEB3_Actin | AWSEM_simulations/zipper/draw.py | draw.py | py | 914 | python | en | code | 0 | github-code | 13 |
15155947110 | # import
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from dotenv import dotenv_values
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from dateti... | daotiennamhl/save_something | relevance/auto_tool/hneu/a.py | a.py | py | 2,465 | python | en | code | 0 | github-code | 13 |
7400359499 | from toy_diffusion_models.state_diffusion_model import main
if __name__ == '__main__':
import jaynes
from ml_logger import logger, instr
from dd_launch import RUN
jaynes.config('tjlab-gpu')
RUN.CUDA_VISIBLE_DEVICES = "3"
thunk = instr(main)
logger.log_text("""
charts:
- yKey: los... | geyang/urop-playground | toy_analysis/state_model/train.py | train.py | py | 552 | python | en | code | 0 | github-code | 13 |
5450488892 | from django.urls import path
from . import views
app_name = "archive"
urlpatterns = [
path('', views.archive_home, name="archive_home"),
path('search/', views.archive_search, name="search"),
path('instrument/', views.instrument_home, name="instrument_home"),
path('instrument/<int:instr_id>/', vie... | Mazen21/musikji | archive/urls.py | urls.py | py | 2,358 | python | en | code | 0 | github-code | 13 |
6623258854 | print('DESAFIO 80'.center(44))
'''
Digitar cinco valores e cadastrar numa lista, já na posição correta de inserção. sem usar sort
no final, exibir a lista ordenada 5 2 4 0 1
'''
print(f" {' ORGANIZADOR DE NÚMEROS ':_^44} ")
numbers = []
for X in range(1, 5+1):
number = int(input(f'\033[1mDigite o {X}º número: \033[... | aa-abnerandrade/cev-desafios-python | des080.py | des080.py | py | 810 | python | pt | code | 0 | github-code | 13 |
30480099620 |
# import the necessary packages
import numpy as np
import argparse
import imutils
import glob
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-t", "--template", required=True, help="Path to template image")
ap.add_argument("-i", "--images", required=... | TeamMoodGitHub/Jonah-Term-1 | match.py | match.py | py | 2,070 | python | en | code | 0 | github-code | 13 |
559302334 | def max_heapify(A,i,size):
l=2*i+1
r=2*i+2
largest=i
if l<size and A[l]>A[i]:
largest=l
if r<size and A[r]>A[largest]:
largest=r
if largest!=i:
A[i],A[largest]=A[largest],A[i]
max_heapify(A,largest,size)
def build_heap(A):
for j in range(len(A)//2,-1,-1):
... | Quasar0007/Competitive_Programming | Heap_sort.py | Heap_sort.py | py | 578 | python | en | code | 0 | github-code | 13 |
73570791696 | t = int(input())
for _ in range(0, t):
n = int(input())
nums = list(map(int, input().split()))
A = nums.index(1)
B = nums.index(n)
A_left = A+1
A_right = n-A_left
B_left = B+1
B_right = n-B_left
A_closed = A_left if B < A else A_right + 1
A_open = n - A_closed + 1
B_clos... | JDSeiler/programming-problems | codeforces/round-725/a-stone-game.py | a-stone-game.py | py | 438 | python | en | code | 0 | github-code | 13 |
31313214139 | import matplotlib.pyplot as plt
from scipy import signal
from scipy.io import wavfile
import numpy as np
import csv
# Extract time samples from wavfile (take single channel)
sample_rate, samples = wavfile.read("data\\piano2_dual.wav")
samples = samples[:,0]
# Plot time series
plt.figure(0)
plt.plot(np.arange(1,len(... | aahmad-p/reservoir-networks | reservoir-networks/create_spectrogram.py | create_spectrogram.py | py | 1,068 | python | en | code | 0 | github-code | 13 |
36974300303 | import sys
sys.path.append('/root/.snap/snap-python')
import os
os.environ.update({"LD_LIBRARY_PATH":"."})
import snappy
from snappy import ProductIO
# ReprojectOp = snappy.jpy.get_type('org.esa.snap.core.gpf.common.reproject.ReprojectionOp')
# in_file = '/home/zy/data_pool/U-TMP/S1A_IW_SLC__1SSV_20150109T112521_2015... | Aaayue/Hello-World | sentinel1_prepro.py | sentinel1_prepro.py | py | 1,466 | python | en | code | 0 | github-code | 13 |
12786412191 | from enum import Enum
from FusionLibrary.libs.cli.cli_base import local_actions
import os
import re
from RoboGalaxyLibrary.utilitylib import logging as logger
from robot.libraries.BuiltIn import BuiltIn
import requests
import string
import threading
import urllib2
import urllib3
import yaml
class StorageSize(Enum):
... | richa92/Jenkin_Regression_Testing | robo4.2/fusion/tests/RIST/BTI/BTIHelpers.py | BTIHelpers.py | py | 3,470 | python | en | code | 0 | github-code | 13 |
21536452172 | from django.urls import path
from . import views
app_name = 'portfolio'
urlpatterns = [
path('', views.index, name='index'),
# individual projects: lowest priority since they're a catchall
path('<path:project_url>/assets/<str:res_url>', views.project_res),
path('<path:project_url>/', views.project,... | ckuhl/ckuhl.com | ckuhl/portfolio/urls.py | urls.py | py | 340 | python | en | code | 0 | github-code | 13 |
21271793837 | from core.common import get_logger
from contracts.opensea import OpenseaContract
from core.chain_account import ChainAccount
from core.chain_network import ChainNetwork
from contracts.erc721 import ERC721Contract
from thirdparty.open_sea_v1.endpoints.client import ClientParams
from thirdparty.open_sea_v1.endpoints.orde... | xiaoxiaoleo/Opensea-Sniper | thirdparty/opensea/utils.py | utils.py | py | 3,305 | python | en | code | 9 | github-code | 13 |
19282041078 | # -*- coding: utf-8 -*-
if 0:
from gluon import *
request, session, response, T, cache = current.request, current.session, current.response, current.t, current.cache
from gluon.dal import DAL
from gluon.tools import Auth, Service, Crud, Storage
db = DAL()
auth = Auth()
service = Service()
crud = Crud()
setting... | szimszon/web2py_mailcaptcha | models/plugin_mailcaptcha.py | plugin_mailcaptcha.py | py | 7,764 | python | en | code | 4 | github-code | 13 |
42219953720 | from __future__ import print_function
import unittest
import os
from shutil import copy2
import olefile
class TestOlefile(unittest.TestCase):
def setUp(self):
self.non_ole_file = "tests/images/flower.jpg"
self.ole_file = "tests/images/test-ole-file.doc"
def test_isOleFile_false(self):
... | decalage2/olefile | tests/test_olefile.py | test_olefile.py | py | 5,695 | python | en | code | 201 | github-code | 13 |
5473329771 | import re
from app import app
from entities.tutor import Tutor
from googleapi.googleapi import GoogleApi
config = app.config['config']
logger = config.get_logger()
all_subjects = [
{'name': 'رياضيات', 'id': 1},
{'name': 'فيزياء', 'id': 2},
{'name': 'لغة عبريّة', 'id': 3},
{'name': 'لغة عربيّة', 'id':... | nadrus-online/nadrus-backend | app/contoller.py | contoller.py | py | 2,935 | python | en | code | 0 | github-code | 13 |
27802177712 | ##문제 1 상하좌우
# n 은 공간의 크기
# n = int(input())
# plan = list(input().split())
# x = 1
# y = 1
# for word in plan:
# if word == 'L':
# if y > 1:
# y -= 1
# elif word == 'R':
# if y < n:
# y += 1
# elif word == 'U':
# if x > 1:
# x -= 1
# elif wor... | tkdgns8234/DataStructure-Algorithm | Algorithm/CodingTest_Study_Book/3_impl.py | 3_impl.py | py | 3,300 | python | ko | code | 0 | github-code | 13 |
41324753815 | """ ShowOspfv3SummaryPrefix.py
IOSXE parser for the following show command:
* show ospfv3 summary-prefix
"""
# python
import re
# metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Any, Or, Optional, Use, Default
# ==========================================... | hsaljuboori/ansible-aljuboori | ansible-aljuboori/.venv/.venv/lib/python3.8/site-packages/genie/libs/parser/iosxe/show_ospfv3.py | show_ospfv3.py | py | 7,779 | python | en | code | 0 | github-code | 13 |
27300274725 | import intake
import xesmf
import xarray
import functools
import pandas
import numpy
import logging
from pkg_resources import resource_filename
@functools.lru_cache
def paramdb():
return intake.cat.nci.ecmwf.grib_parameters.read()
def load_var(cat, chunks={"time": 12}, **kwargs):
"""
Load a single varia... | coecms/era5grib | era5grib/nci.py | nci.py | py | 8,380 | python | en | code | 4 | github-code | 13 |
7042745623 | #paquete utilizados
import requests
import json
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
#funcion main para generar las graficas
def main():
Dataset = read_data("test_tmp.csv")#se leen los datos del fichero creado anteriormente para insertarlo en un Dataset
if Dataset is None:
p... | Witiza99/TFG_SISTEMA_DE_ANALISIS_Y_PREDICCI-N_DE_CONTAMINACION_LUMINICA | SISTEMA_DE_ANALISIS_Y_PREDICCION_DE_CONTAMINACION_LUMÍNICA/cliente/generador_grafica.py | generador_grafica.py | py | 4,134 | python | es | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.