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
21946827715
import datetime import time from constants import STARTED def get_uptime(): delta = datetime.datetime.utcnow() - STARTED hours, remainder = divmod(int(delta.total_seconds()), 3600) minutes, seconds = divmod(remainder, 60) days, hours = divmod(hours, 24) uptime = ("{} days, {:0=2}:{:0=2}:{:0=2}".for...
iamtakagi-lab/ai
src/uptime.py
uptime.py
py
452
python
en
code
2
github-code
13
20221311264
import json import boto3 import base64 def lambda_handler(event, context): client = boto3.resource("dynamodb") #Da acesso aos recursos do DynamoDB table = client.Table("Secrets") #Da acesso a tabela "Secrets" #Try e Except para capturar e tratar Exceções que possam ocorrer try: i...
ayrtonmarinho/getmysecret
back-end/gmsGetSecret/lambda_function.py
lambda_function.py
py
1,519
python
pt
code
0
github-code
13
23617487370
from __future__ import unicode_literals import os from django.db import models from django.conf import settings from django.utils.safestring import mark_safe from django.template.defaultfilters import truncatechars from django.db.models.signals import * from django.dispatch import receiver # monitoring.tools.pathAnd...
BangHeru/p2kacehtengah
monitoring/submodels/monitoringModels.py
monitoringModels.py
py
6,309
python
en
code
0
github-code
13
36553240073
# 다중분류는 이진분류와 달리 y 레이블의 범주 수가 3개 이상 import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv('Fvote.csv', encoding='utf-8') X = data[data.columns[1:13]] y = data[['parties']] from sklearn.model_selection import train_test_split X_t...
reasonmii/ref_DataScience
certificate_BigDataAnalytics/08_multiclassification.py
08_multiclassification.py
py
2,783
python
en
code
14
github-code
13
74469111058
from django.conf.urls import url from django.views.generic import TemplateView from . import views app_name = 'heartrisk' urlpatterns = [ url(r'^index/', views.index, name='index'), url(r'^get_probability/', views.get_probability, name='get_probability'), url(r'^final_probability/', views.final_probability, name='fi...
himanshumangla/hackData
heartrisk/urls.py
urls.py
py
476
python
en
code
0
github-code
13
17084752434
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.PetProfiles import PetProfiles class AlipayInsSceneInsassetprodPetprofilelistQueryResponse(AlipayResponse): def __init__(self): super(AlipayInsSceneInsas...
alipay/alipay-sdk-python-all
alipay/aop/api/response/AlipayInsSceneInsassetprodPetprofilelistQueryResponse.py
AlipayInsSceneInsassetprodPetprofilelistQueryResponse.py
py
1,126
python
en
code
241
github-code
13
17636562699
""" Advent of Code 2022 - Day 3 """ with open("day3.txt", "r") as file: input = file.read().split("\n") input = [(sack[0:len(sack)//2], sack[len(sack)//2:]) for sack in input] #split in half def getPriority(letter): """ Calculate the priority of a letter char """ return ord(letter)-ord("...
lab57/Advent-of-Code
day3.py
day3.py
py
592
python
en
code
0
github-code
13
41719963422
import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision from torchvision import datasets from torch.utils.data import DataLoader from torchvision.utils import make_grid transform = transforms.Compose([ transforms.Resize((32,32)), transforms.ToTensor(), ]) def ...
celestialxevermore/DL_Implementations
Autoencoders/ConvolutionalVAE/dataloaders/data_dataloader.py
data_dataloader.py
py
1,169
python
en
code
0
github-code
13
29881900000
import socket import os from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World! Hostname: {hostname} | Version: {version}'.format( hostname=socket.gethostname(), version=open('./VERSION.md').read().rstrip('\n') ) if __name__ == '__main_...
michaltrmac/docker-first-steps
example/docker/python-simple-app/src/app.py
app.py
py
364
python
en
code
0
github-code
13
14880477577
''' https://docs.python.org/3/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields ''' import collections import sys # print(*(i for i in dir(collections) if not i.startswith("_")), sep = "\n") Point = collections.namedtuple('Point', ['x', 'y']) # Returns a new tuple subclass named Po...
ekomissarov/edu
py-basics/stdlib/namedtuple.py
namedtuple.py
py
726
python
en
code
0
github-code
13
72569725459
import cv2 import numpy as np import matplotlib.pyplot as plt def create_vert_alpha_matte(dims, f_width, f_location) -> np.ndarray: """ dims: (height, width) f_width: width f_location: (height, width) b_width: (height, width) b_location: (height, width) """ mask = np.zeros...
christian-armstrong25/lab-compositing
alpha_blending.py
alpha_blending.py
py
1,547
python
en
code
0
github-code
13
40857471411
import pandas as pd from debal_scrap.models import Debal def app(): debal = Debal() group = debal.select_group() data = list(group.expenses()) df = pd.DataFrame(data) df.to_csv(input("save as <filename.csv>: "))
tewfik/debal_scrap
debal_scrap/app.py
app.py
py
236
python
en
code
0
github-code
13
19505765793
import spotipy from sys import argv from pprint import pprint from spotipy.oauth2 import SpotifyOAuth # ########################### # ON REPEAT PLAYLIST IDS # ########################### # OMRI - 37i9dQZF1Epk3rCnDbRzoW # RYAN - 37i9dQZF1EpjwNta6kRS75 # JACK - 37i9dQZF1EpkeEt7H42BOM # JORDAN - 37i9dQZF1EprSmFIIwNCNf # ...
noahgorstein/spotify_scripts
concatenate_playlists.py
concatenate_playlists.py
py
2,654
python
en
code
1
github-code
13
28363776980
"""Тут код, результаты в result.json""" import json import pandas as pd from yargy import Parser, rule, or_ from yargy.pipelines import morph_pipeline, caseless_pipeline from yargy.interpretation import fact from yargy.predicates import in_ data = pd.read_csv('pristavki.csv', header=None, names=['text']) Game = fac...
OneAdder/compling2019
hm_yargy/1/extract_games.py
extract_games.py
py
3,256
python
en
code
0
github-code
13
30902870779
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Finetuning torchvision models for the purpose of predicting # Tinder swipes, left or right # # Based on https://pytorch.org/tutorials/beginner/finetuning_torchvision_models_tutorial.html # # Lots of things could be tweaked here: # - NN ar...
abreu4/wing-man
libido.py
libido.py
py
12,755
python
en
code
0
github-code
13
25566125873
size = int(input()) territory = [] alice_position = [] for row in range(size): territory.append(input().split()) if "A" in territory[row]: alice_position = [row, territory[row].index("A")] territory[alice_position[0]][alice_position[1]] = "*" moves = { "up": (-1, 0), "down": (1, 0),...
mustanska/SoftUni
Python_Advanced/Multidimensional Lists/alice_in_wonderland.py
alice_in_wonderland.py
py
1,122
python
en
code
0
github-code
13
72545300499
# create by fanfan on 2019/11/14 0014 import tensorflow as tf from tensorflow.contrib.rnn import GRUCell,LSTMCell,DropoutWrapper,ResidualWrapper,MultiRNNCell def create_single_cell(num_units,keep_prob,use_residual,cell_type='lstm'): if cell_type == 'lstm': cell = LSTMCell(num_units) else: cell =...
fanfanfeng/nlp_research
dialog_system/attention_seq2seq/tf_model/encoder.py
encoder.py
py
2,797
python
en
code
8
github-code
13
32053558525
"""The 4Heat integration switch.""" from __future__ import annotations # from collections.abc import Callable from dataclasses import dataclass from typing import Any from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription from homeassistant.config_entries import ConfigEntry from homeassista...
anastas78/homeassistant-fourheat
custom_components/fourheat/switch.py
switch.py
py
3,045
python
en
code
0
github-code
13
36223362496
from cx_Freeze import setup, Executable executables = [Executable('hrtfmixer.py', base='Win32GUI')] build_exe_options = {'packages': ['pysofaconventions', 'scipy.spatial', 'matplotlib.pyplot','mpl_toolkits.mplot3d','scipy.signal','numpy','pyaudio','wave','time','pygame'], 'include_files': ['resources/THK_FFHRIR/HRIR_L...
aechoi/hrtfmixer
setup.py
setup.py
py
501
python
en
code
28
github-code
13
28905150348
#!/usr/bin/python # -*- coding: utf-8 -*- import sqlite3 read_file = "../data/twitter_id_append.txt" f = open(read_file,"r") # how many program finished s = 0 sep_point = 0 count = 0 lines = f.readlines() conn = sqlite3.connect('./sqlite.db') cur = conn.cursor() try: cur.execute("""CREATE TABLE corr2(post_id serial...
pauwau/workspace
get_tweet/old_src/post_comment.py
post_comment.py
py
2,484
python
en
code
0
github-code
13
17191480786
def is2k_arr(arr): sum1 = 0 sum2 = 0 if len(arr) % 2 ==0 : for i in range(len(arr)//2): sum1 += int(arr[i]) sum2 += int(arr[len(arr)-i-1]) if sum1 == sum2: return True return False if __name__ == '__main__': times = int(input()) for i in rang...
yzgqy/myacm
acm/kt3/m1.py
m1.py
py
927
python
en
code
0
github-code
13
6881894476
import tkinter as tk import tkinter.font as tkFont from Model import Model from Objective1 import Objective1 from Objective2 import Objective2 from Objective3 import Objective3 from Objective4 import Objective4 from Objective5 import Objective5 from Objective6 import Objective6 class Home: def __init__(self,roo...
RakshithJKashyap/PySpark
DesktopApp/Home.py
Home.py
py
4,892
python
en
code
0
github-code
13
41687513952
import csv import cv2 import os import numpy as np from PIL import Image import cv2 import imutils import time # counting the numbers def is_number(s): try: float(s) return True except ValueError: pass try: import unicodedata unicodedata.num...
SoniyaN/LookBasedMediaPlayer
create_data.py
create_data.py
py
5,684
python
en
code
0
github-code
13
16816284964
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # NASA Jet Propulsion Laboratory # California Institute of Technology # (C) 2008-2011 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~~~~~~~~~~~...
hysds/hysds
hysds/pymonitoredrunner/commons/thread/AbstractInterruptableThread.py
AbstractInterruptableThread.py
py
4,981
python
en
code
15
github-code
13
5455497762
from rest_framework import serializers from rest_framework.fields import EmailField, CharField from course.models import Course, Tutor class TutorSerializer(serializers.ModelSerializer): name = CharField(allow_blank=True, max_length=254, required=False) email = EmailField(allow_blank=True, max_length=254,...
adds68/mmu-course-api
api/serializers.py
serializers.py
py
1,895
python
en
code
0
github-code
13
6699081987
import base64 import json import re import sys def extract_vmess_info(vmess_address): """ Extract information from VMESS address """ """ Regular expression pattern to match the base64-encoded JSON payload """ pattern = r"vmess://(.*)" match = re.match(pattern, vmess_address) if m...
jayxin/vmess_2_v2ray_config
py/vmess_2_server_info.py
vmess_2_server_info.py
py
1,435
python
en
code
0
github-code
13
42318394189
import tornado.web import sqlite3 import json import logging from config import * from webserver.utils import * # the read-only sqlite connection for this server # "?mode=ro" requires the newest sqlite python3.4 wrappers to be enabled dbcon = sqlite3.connect(DBPREFIX + 'media.db?mode=ro', uri=True) dbcur = dbcon.curso...
BeamNG/mediashare
webserver/media_ro.py
media_ro.py
py
2,645
python
en
code
0
github-code
13
20695012191
# app.py from flask import Flask, render_template, request, send_file import cv2 import numpy as np import io from boundingBoxDrawer import boundingBoxDrawer from ensembleModel import ensembleModel from objDetectionRCNN import objDetectionRCNN from objDetectionY8 import objDetectionY8 app = Flask(__name__) @app.rout...
AAchintha97/objDetection
app.py
app.py
py
1,761
python
en
code
0
github-code
13
35871715038
from typing import Union, cast import kachery_p2p as kp import numpy as np class VectorField3D: def __init__(self, arg: Union[dict, str]): if isinstance(arg, str): x = kp.load_json(arg) if not x: raise Exception(f'Unable to load: {arg}') arg = cast(dict,...
scratcharchive/surfaceview2
src/python/surfaceview2/vectorfield3d/vectorfield3d.py
vectorfield3d.py
py
1,962
python
en
code
0
github-code
13
35230357062
#!/usr/bin/python3 """ This is the "5-text_indentation" module for the Holberton School Higher Level Programming track. The 5-text_indentation module supplies one function, matrix_divided(). """ def text_indentation(text): """ Prints a text with 2 new lines after each of these characters: ., ? and : """...
fernandogmo/holbertonschool-higher_level_programming
0x07-python-test_driven_development/5-text_indentation.py
5-text_indentation.py
py
686
python
en
code
1
github-code
13
16101328592
from datetime import datetime import json import os import re import csv from lxml import etree import requests BASE_URL = 'https://s.weibo.com' TXT_DIR = './txt' def getHTML(url, needPretty=False): ''' 获取网页 HTML 返回字符串 Args: url: str, 网页网址 needPretty: bool, 是否需要美化(开发或测试时可用) Returns: ...
Runner1027/Weibo_Hot_Search
weibo.py
weibo.py
py
2,963
python
en
code
3
github-code
13
2625039415
# -*- coding: utf-8 -*- import pytz import datetime import json from pyramid.view import view_config from stalker import db, Project, Status, Budget, BudgetEntry, Good, Entity, \ Type, Studio, StatusList, Task from stalker.db.session import DBSession import transaction from webob import Response import stalker_...
eoyilmaz/stalker_pyramid
stalker_pyramid/views/budget.py
budget.py
py
30,411
python
en
code
6
github-code
13
41567798191
def solution(number, limit, power): answer = [] for i in range(1, number+1): count = 0 for j in range(1, int(i**0.5)+1): if i % j == 0: if j * j == i: count +=1 else: count += 2 answer.append(count) f...
bnbbbb/Algotithm
프로그래머스/unrated/136798. 기사단원의 무기/기사단원의 무기.py
기사단원의 무기.py
py
436
python
en
code
0
github-code
13
30534620434
import PyPDF2 with open('dummy.pdf', 'rb') as file: reader = PyPDF2.PdfFileReader(file) #PyPDF have method .pdfreader to read pdf but it can only read binary page = reader.getPage(0) #Pypdf needs to know which pdf page to rotate page.rotateCounterClockwise(180) writer = PyPDF2.PdfFileWriter() writer.addPa...
AmanVgit/PDFrotator
PDF_rotator.py
PDF_rotator.py
py
410
python
en
code
0
github-code
13
40229622635
#!/usr/bin/env python # coding: utf8 import math import numpy as np import json import gi gi.require_version('Gtk', '3.0') gi.require_version('PangoCairo', '1.0') from gi.repository import Gio, Gtk, Gdk, GLib from gi.repository import Pango, PangoCairo from gi.repository.GdkPixbuf import Pixbuf, PixbufRotation, Inte...
rtgiskard/snake
lib/snakeapp.py
snakeapp.py
py
30,136
python
en
code
0
github-code
13
31512454451
import tkinter as tk from PIL import ImageTk from camera import Camera from imageTransformers import IImageTransformer, ImageTransformerBuilder from imageSavers import IImageSaver class App: def __init__(self, title: str, webcam: Camera, default_image_transformer: IImageTransformer, image_saver: IImageTransformer)...
WWykret/Webcam-Image-Transformer
ui.py
ui.py
py
3,401
python
en
code
0
github-code
13
14549949296
import re import pandas as pd import collections import nltk import string import pickle import numpy as np import sys # Apply the function LIWC_detect to a text. It removes punctuation, tokenizes and matches # the tokens to LIWC with the help of the star_check function and the nstar_liwc_dict and # star_liwc_dict. ...
dgarcia-eu/DavidsUsefulScripts
Prosocial_French_Script.py
Prosocial_French_Script.py
py
2,592
python
en
code
3
github-code
13
16316698257
# Python ## Part 1 with open("data.txt") as f: moves = list(map(int, f.read().splitlines())) def move_numbers(moves: list[int], rounds: int = 1, decryption_key: int = 1) -> int: decrypted_moves = [m * decryption_key for m in moves] indices = list(range(len(decrypted_moves))) for i in indices * rounds...
moritzkoerber/adventofcode
2022/day20/day20.py
day20.py
py
667
python
en
code
0
github-code
13
21092013063
import socket import pickle import time import random from Send.send_api import * from Encryption import encryption from Compression import compression from Data.data import get_myname, get_myaddr from Receive import recv # State graph DATAKEY = 'data' CODEKEY = 'code' METADATA = 'metadata' def set_data(packet,...
thomaspendock/Wormhole
src/Send/send.py
send.py
py
2,385
python
en
code
0
github-code
13
33754693001
## NAME: # THREEDtoTWOD.py ## PURPOSE: # Takes a 3D healpix map and plots the 2D projection centered on a particular RA and dec # Interactive mode: 2D image rotates (RA changes) #------------------------------------------------------------------------------------------------ import aipy impo...
HERA-Team/hera_sandbox
ctc/code/THREEDtoTWOD.py
THREEDtoTWOD.py
py
1,900
python
en
code
1
github-code
13
28609522123
#Question Link: https://takeuforward.org/data-structure/remove-n-th-node-from-the-end-of-a-linked-list/ #Solution Link (Python3): https://leetcode.com/submissions/detail/656748126/ class Node: def __init__ (self, data): self.data = data self.next = None def removeKthNode(head, k): i...
AbhiWorkswithFlutter/StriverSDESheet-Python3-Solutions
Striver SDE Sheet/Day 5/Remove N-th node from the end of a Linked List.py
Remove N-th node from the end of a Linked List.py
py
1,350
python
en
code
3
github-code
13
2250518699
"""Soft Q Imitation Learning (SQIL) (https://arxiv.org/abs/1905.11108). Trains a policy via DQN-style Q-learning, replacing half the buffer with expert demonstrations and adjusting the rewards. """ from typing import Any, Dict, List, Optional, Type, Union import numpy as np import torch as th from gymnasium import s...
HumanCompatibleAI/imitation
src/imitation/algorithms/sqil.py
sqil.py
py
8,709
python
en
code
1,004
github-code
13
32227612386
#! /usr/bin/python3 # coding: utf8 # # ----------------------------------------------------------- # | "Pysenhower" | # ----------------------------------------------------------- # # Python3.2-Programm, mit dem Aufgaben entsprechend ihrer # Prioritäten organisiert werden kö...
P9k/pysenhower_ger
pysenhower.py
pysenhower.py
py
7,364
python
de
code
0
github-code
13
25345562203
from flask_restplus import Namespace, Resource, fields from app.main.models.user import User api = Namespace('users') user = api.model('User', { 'id': fields.Integer, 'first_name': fields.String, 'last_name': fields.String, 'pseudo': fields.String }) @api.route('/<int:identifiant>') @api.response(...
aissaelouafi/twitter-api
app/apis/users.py
users.py
py
513
python
en
code
0
github-code
13
29237072036
import dash_bootstrap_components as dbc import dash_html_components as html from views.layout.controls import indicators_controls top_menu = dbc.Navbar([ html.H1('Furni', className='flex-field'), dbc.Nav([ dbc.NavItem(dbc.NavLink('Indicadores generales', className='btn btn-primary round',href='/in...
JuanMaVelezPa/DS4A_Project
views/layout/menus.py
menus.py
py
1,561
python
en
code
1
github-code
13
14619679476
# Preprocesses NVD data import re name_pattern = r'(nvdcve-1.1-){1}(\d){4}' # Listing JSON files from os import listdir from os.path import isfile, join path = join('data', 'extracted') data_files = [f for f in listdir(path) if isfile(join(path, f))] print('{} files identified'.format(len(data_files))) for item in dat...
agu3rra/nvd
pre-processor.py
pre-processor.py
py
1,044
python
en
code
0
github-code
13
36121390161
from typing import Optional, Dict, Tuple from itertools import accumulate import numpy as np from gym.wrappers.time_limit import TimeLimit import matplotlib.pyplot as plt import seaborn as sns import torch from tqdm import tqdm from .agents.utils import Agent from .agents.DQN import DQNAgent from .agents.VPG impo...
RedTachyon/rl_robotics
train_eval.py
train_eval.py
py
5,250
python
en
code
0
github-code
13
370937772
''' 手写数字识别 ''' import matplotlib.pyplot as plt from sklearn import datasets from sklearn import svm from sklearn.neighbors import KNeighborsClassifier #1.加载数据 data = datasets.load_digits() print(type(data)) print(data) #总的图像数目是1797个图像,每个图像是8*8的图 print(data.images.shape) print(data.data.shape) print(data.target.sh...
yyqAlisa/python36
自学/sklearn self-study/SVM/手写数字识别.py
手写数字识别.py
py
1,281
python
en
code
0
github-code
13
73053295377
def findRestaurant(list1, list2): dict1 = dict() answer = [] for i in range(0, len(list1)): if list1[i] in list2: dict1.update({list1[i]: (list1.index(list1[i]) + list2.index(list1[i]))}) for key, value in dict1.items(): if min(dict1.values()) == value: answer.app...
liv-apuzzio/my_leetcode_solutions
python/599_Minimum_Index_Sum_of_Two_Lists.py
599_Minimum_Index_Sum_of_Two_Lists.py
py
346
python
en
code
1
github-code
13
15056855396
def med(arr): arr.sort() return arr[len(arr) // 2] def mod(arr): return max(arr, key=arr.count) def fun(): n = int(input()) medi = [] modi = [] nums = [] for _ in range(n): num = list(map(int, input().split())) nums.extend(num) medi.append(med(num)) mo...
mishutka200101/Python-Practice-2
task_15.4.py
task_15.4.py
py
466
python
en
code
0
github-code
13
73837308498
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('WeekPlanner', '0005_auto_20150915_1900'), ] operations = [ migrations.RenameField( model_name='educationalactivi...
yarkinsv/PYW
WeekPlanner/migrations/0006_auto_20150918_1735.py
0006_auto_20150918_1735.py
py
817
python
en
code
0
github-code
13
15647544617
import numpy from matplotlib import pyplot from scipy import interpolate nx = 41 dx = 2./(nx-1) nt = 50 dt = .01 c = 1 x = numpy.linspace(0,2,nx) xp = x.copy() u = numpy.ones(nx) u[10:20] = 2 up = u.copy() for n in range(nt): un = u.copy() for i in range(1,nx-1): u[i] = un[i]-c*dt/dx*(un[i]-un[i-1]) ...
gear/HPSC
lec_code/pm/step01.py
step01.py
py
620
python
en
code
0
github-code
13
1680792736
#!/usr/bin/env python3 #encoding=utf-8 #----------------------------------------- # Usage: python3 first_example.py # Description: Function definition and call #----------------------------------------- def intersect(seq1, seq2): res = [] for x in seq1: if x in seq2: res.append(x) r...
mindnhand/Learning-Python-5th
Chapter16.FunctionBasics/first_example.py
first_example.py
py
626
python
en
code
0
github-code
13
28494556710
import boto3 import json import logging from botocore.client import Config from botocore.vendored.requests.exceptions import ReadTimeout from traceback import format_exc logger = logging.getLogger(__name__) class stepfunctions(object): def __init__(self, session=None): config = Config(read_timeout=70) ...
matthewhanson/boto3-utils
boto3utils/stepfunctions.py
stepfunctions.py
py
1,901
python
en
code
5
github-code
13
42663822361
# import uwebsockets.client import urequests import ujson import time import machine import dht with open('secret') as f: secret_key = f.read().strip() def main(): uri = 'http://35.244.13.244/iot/post' # uri = 'http://192.168.225.201:8000/iot/post' # for testing # uri = 'ws://echo.websocket.org/' # f...
sajankp/iot_project_esp8266
server.py
server.py
py
2,355
python
en
code
0
github-code
13
73817130577
from flask import * app = Flask(__name__) @app.route('/') def homepage(): return "Hello me!" users = { 'thuhuongvan98': { "Name": "Van Nguyet Thu Huong", "Age": 21, "Address": "Hahaha" }, 'baohoa96' : { "Name": "Hoa Hoang Bao Hoa", "Age": 23, "Address": "Complicated"...
thuhuongvan98/Huong-Van
Lesson 10/web_practice.py
web_practice.py
py
1,923
python
en
code
0
github-code
13
70196260818
import os from datetime import datetime from flask import Flask, flash, json, render_template, redirect, request, url_for # ----------------------------# # Split answer file function # # ----------------------------# def split_answer_file(filename): answers = {} with open(filename,"r") as file: for l...
bennettpe/practical-python-website
test_get_correct_answers.py
test_get_correct_answers.py
py
860
python
en
code
0
github-code
13
25837813290
import matplotlib.pyplot as plt import pandas as pd import numpy as np from tqdm import tqdm from sklearn.metrics import mean_absolute_error from scipy.optimize import curve_fit class LinearInterpolator: def __init__(self, engagement_col: str='engagements'): self.engagement_col = engagement_col ...
botelhoa/C4D-blogs
Data Wrangling: Missing Engagement Interpolation/code/interpolation.py
interpolation.py
py
8,125
python
en
code
0
github-code
13
29102173909
# from scopus import ScopusSearch import os import pandas as pd import numpy as np import logging from urllib import parse, request import urllib.error import json from pprint import pprint as pp BASE_DIR = os.path.abspath(os.path.realpath(__file__)) BASE_DIR = os.path.join(os.path.dirname(BASE_DIR), '..', '..') os.c...
gnukinad/scival
src/book_count/get_aff_book_count.py
get_aff_book_count.py
py
9,102
python
en
code
1
github-code
13
16508174953
import json from PyQt5.QtCore import pyqtSlot, QTime from PyQt5.QtGui import QColor from PyQt5.QtWidgets import ( QMainWindow, QColorDialog, QTableWidgetItem, QApplication, QHBoxLayout, QLabel, QPushButton, QTableWidget, QVBoxLayout, QWidget, QFileDialog, QTableWidgetSelecti...
pmineev/GradientScreensaver
settings_window.py
settings_window.py
py
9,097
python
en
code
0
github-code
13
299063578
num = 2 sum = 0 while num <= 2480058: p = 5 val = 0 for c in str(num): val = val + pow(int(c),p) if val == num: sum = sum + num num = num + 1 print(sum)
LeStarch/euler-solutions
euler30.py
euler30.py
py
189
python
en
code
0
github-code
13
29214874341
import argparse import json import logging import os import sys import boto3 from botocore.config import Config from botocore import UNSIGNED from e2e_common.util import ( xrun, atexitrun, firstFromS3Prefix, hassuffix, ) logger = logging.getLogger(__name__) def main(): ap = argparse.ArgumentPar...
algorand/indexer
e2e_tests/src/e2e_common/get_test_data.py
get_test_data.py
py
2,340
python
en
code
111
github-code
13
33700228760
import bge bge.render.showMouse(True) def fix_text(): objs = bge.logic.getCurrentScene().objects for o in objs: try: o.resolution = 1.25 except AttributeError: pass def update_resource_meters(): objs = bge.logic.getCurrentScene().objects gd = bge.logic.gl...
gandalf3/The-Queen-s-Workers
GUI.py
GUI.py
py
1,822
python
en
code
2
github-code
13
9844660475
# -*- coding: utf-8 -*- from secp256k1 import PublicKey, ALL_FLAGS from raiden.utils import sha3, GLOBAL_CTX def recover_publickey(messagedata, signature): if len(signature) != 65: raise ValueError('invalid signature') key = PublicKey( ctx=GLOBAL_CTX, flags=ALL_FLAGS, # FLAG_SIGN is...
utzig/raiden
raiden/encoding/signing.py
signing.py
py
1,170
python
en
code
null
github-code
13
17659538181
from collections import Counter n = int(input()) arr = list(map(int, input().split())) gap = [[0 for j in range(n)] for i in range(n)] MAX = -1 #i번째 원소 기준으로 공차d를 구한 후 최빈값의 등장 횟수를 기록 for i in range(n): d = [] for j in range(n): if i!=j : d.append((arr[j] - arr[i]) / (j-i)) ...
ryuwldnjs/BOJ
백준/Silver/25401. 카드 바꾸기/카드 바꾸기.py
카드 바꾸기.py
py
516
python
ko
code
0
github-code
13
37154207403
"""Custom template tags for metabase embedding.""" import logging import time from datetime import date from datetime import datetime import jwt from django import template from django.conf import settings from django.template.loader import render_to_string log = logging.getLogger(__name__) # noqa register = templa...
abhay340/ethical-ads
adserver/templatetags/metabase.py
metabase.py
py
1,516
python
en
code
0
github-code
13
44040860266
#val=int(input("enter a number")) #if val >100: # val = val/2 #else: # val=val*2 #print("the result is", val) #to print in online val=int(input("enter a number")) val=val/2 if val>100 else val * 2 print("the result is", val) name= input("enter ur name") print("very good") if name.isalpha() else print("not good...
itzzyashpandey/python-data-science
basics/onliner.py
onliner.py
py
322
python
en
code
0
github-code
13
14769143752
#Simple run this file by call function crawl_r() import requests from data import * def crawl_api_main(): http = [] socks4 = [] socks5 = [] for i in http_api: res = requests.get(i) http.append(res.text) for i in socks4_api: res = requests.get(i) socks4.append(res.text) for i in socks5_a...
pEvk/proxy-crawl
crawl_api.py
crawl_api.py
py
690
python
en
code
0
github-code
13
22191448242
import inspect import json from copy import deepcopy from dataclasses import dataclass from functools import lru_cache from pathlib import Path from typing import Any, Dict, Iterable, Union import jsonschema import yaml from jsonschema.exceptions import best_match from linkml_runtime import SchemaView from linkml_runt...
linkml/linkml
linkml/linter/linter.py
linter.py
py
4,984
python
en
code
228
github-code
13
1044279742
""" 如果保存的是模型参数 """ import torch import torchvision.models as models torch_model = torch.load("test.pth") # pytorch模型加载 model = models.resnet50() model.fc = torch.nn.Linear(2048, 4) model.load_state_dict(torch_model) batch_size = 1 #批处理大小 input_shape = (3, 244, 384) #输入数据,改成自己的输入shape # #set the model to inferenc...
songjiahao-wq/untitled
Work/convert onnx/two.py
two.py
py
970
python
en
code
1
github-code
13
6660684922
################################################################### ## Written by Eli Pugh and Ethan Shen ## ## {epugh}, {ezshen} @stanford.edu ## ## Translated from Matlab written by Jiantao Jiao ## ## https://github.com/EEthinker/Universal_direc...
elipugh/directed_information
directed_information/ctwalgorithm.py
ctwalgorithm.py
py
2,998
python
en
code
2
github-code
13
4970009163
n = int(input()) a = list(map(int, input().split())) cnt_num = [0] * (10 ** 5 + 1) max_length = 0 distinct_num = 0 left = 0 for i in range(n): cnt_num[a[i]] += 1 if cnt_num[a[i]] == 1: distinct_num += 1 while left < i and distinct_num > 2: cnt_num[a[left]] -= 1 if cnt_num[a[lef...
truclycs/code_for_fun
algorithms/python/intermediate/algorithmic_complexity/Approximating a Constant Range.py
Approximating a Constant Range.py
py
488
python
en
code
7
github-code
13
20169845997
#Jose Tomas Martinez Lavin from matplotlib.pylab import * from scipy.integrate import odeint m= 1. f= 1. chi= 0.2 w= 2.*pi*f wd= w * sqrt(1.-chi**2) k= m*w**2 c= 2.*chi*w*m def eulerint(zp, z0, t, Nsubdivisiones=1): Nt = len(t) Ndim = len(z0) z = zeros((Nt, Ndim)) z[0,:] = z0[0] z[1,:] = z0...
JoseTomasMartinez/MCOC2020-P1
entrega4.py
entrega4.py
py
1,314
python
en
code
0
github-code
13
38342907645
import argparse import sys parse = argparse.ArgumentParser() parse.add_argument("-o",default="color") parse.add_argument("-emoji",nargs='?',const=True,default=False) parse.add_argument("-i",type=float,default=1.0) parse.add_argument("-minframes",type=int,default=24) parse.add_argument("-output",default="\\Desktop\\out...
nlcsdev/rgbif.py
arg_handler.py
arg_handler.py
py
910
python
en
code
1
github-code
13
72221887377
import os from django.shortcuts import render, get_object_or_404, redirect from django.http import HttpResponse, JsonResponse from django.urls import reverse, reverse_lazy from django.contrib.auth.decorators import login_required from books.models import Book, Category def home(request): books = Book.objects.all(...
devmedtz/sogea
books/views/books.py
books.py
py
1,370
python
en
code
2
github-code
13
23360183298
''' Feb-04-2021 594. Longest Harmonious Subsequence Difficulty: Easy Link: https://leetcode.com/problems/longest-harmonious-subsequence/ ''' class Solution: def findLHS(self, nums: List[int]) -> int: myMap = collections.Counter(nums) keys = set(nums) ansMap = {} for key in keys: if key-1 not in...
iwajef/leetcode-daily-challenge
Feb-2021/02.04.py
02.04.py
py
497
python
en
code
0
github-code
13
2553654886
from .dataset import Dataset import artm import os import re import sys import shutil import subprocess import numpy as np import pandas as pd from tqdm import tqdm class DatasetCooc(Dataset): """ Class prepare dataset in vw format for WNTM model """ def __init__( self, data_path: st...
machine-intelligence-laboratory/TopicNet
topicnet/cooking_machine/dataset_cooc.py
dataset_cooc.py
py
9,968
python
en
code
138
github-code
13
12527631313
def exercise_2(): with open('Hamlet.txt', 'r') as f: lines = 0 words = 0 characters = 0 for line in f.readlines(): characters += len(line) lines += 1 if line == '': continue line.strip() words_unfiltered = ...
RohanBKhatwani/AI-PythonDocstring-Generator
test-files/wordCount.py
wordCount.py
py
2,972
python
en
code
0
github-code
13
30812696493
import pytest from lagom import Container, bind_to_container, injectable class MyDep: value: str def __init__(self, value="testing"): self.value = value container = Container() @bind_to_container(container) def example_function(message: str, resolved: MyDep = injectable) -> str: return resol...
meadsteve/lagom
tests/test_explicit_partial_functions.py
test_explicit_partial_functions.py
py
923
python
en
code
216
github-code
13
23154261305
import sys from PyQt5 import QtGui, QtWidgets from matplotlib import image import run_graphsage_cora as rg from PyQt5.QtCore import pyqtSignal, QThread from PyQt5.QtWidgets import QApplication, QMainWindow, QGraphicsPixmapItem, QGraphicsScene from demo import Ui_MainWindow import cv2 class MyThread(QThread): sign...
Boomerl/Graduation-project
src/run_ui.py
run_ui.py
py
3,746
python
en
code
0
github-code
13
4359561978
from bs4 import BeautifulSoup import datetime DATE_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ' def extract_stops(bs_data): ''' Recebe o objeto BeautifulSoup e processa as paradas presentes no KML ''' # Extraindo as Paradas stops_kml = bs_data.find_all('Placemark') del stops_kml[-1] # Remover a últ...
mateusolorenzatti/gtfs-farroupilha-manager
apps/gtfs/helpers/gps2gtfs/KML_helper.py
KML_helper.py
py
3,005
python
en
code
0
github-code
13
33596617943
# -*- coding: utf-8 -*- """ Created on Wed Mar 6 09:55:58 2019 @author: ajseshad """ import numpy as np import matplotlib.pyplot as plt import pandas as pd from ClassificationLib import FeatureScaling, LogReg, KNN, SVM, KernelSVM, NaiveBayes, DecisionTree, RandomForest # dataset text can inherently cont...
seshajay/FunWithML
nlp.py
nlp.py
py
3,362
python
en
code
0
github-code
13
12305066287
import pygtk import gtk, gobject, cairo class Screen(gtk.DrawingArea): __gsignals__ = {"expose-event":"override"} def do_expose_event(self, event): cr = self.window.cairo_create() cr.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) cr.cli...
malaania/kurs_pythona
try_gtk.py
try_gtk.py
py
733
python
en
code
0
github-code
13
15976991416
import pytest from cityjson2ifc_cli.convert import cityjson2ifc @pytest.mark.parametrize("input_model", ["input_model_5907", "input_model_68dn2"]) def test_lod_select(request, input_model, tmp_dir): """Can we extract a specific LoD?""" cm = request.getfixturevalue(input_model) outfile = tmp_dir / "outfil...
3DGI/cityjson2ifc
tests/test_convert.py
test_convert.py
py
1,461
python
en
code
2
github-code
13
6731703617
import numpy as np import pandas as pd from PIL import Image from typing import Tuple import torch from torch.utils.data import Dataset from transformers.models.bert_japanese.tokenization_bert_japanese import BertJapaneseTokenizer class MMBTClipDsataset(Dataset): def __init__( self, df: pd...
ryota0051/boke-ai
src/models/MMBT_with_CLIP_encoder/dataset.py
dataset.py
py
3,911
python
en
code
0
github-code
13
4825967632
# -*- mode: python ; coding: utf-8 -*- block_cipher = None added_files = [ ('./core', 'core'), ('./resources', 'resources'), # ('./config_user/config.json', 'config_user'), ('./packages/marina', 'packages/marina'), ('./packages/launcher', 'packages/launcher'), ('./packages/atlantis', ...
Knufflebeast/armada-pipeline
pyinst_macos.spec
pyinst_macos.spec
spec
1,911
python
en
code
27
github-code
13
27556101794
import os.path from loguru import logger from providers import provider as provider_module from modules.worker import Worker, handle_tasks from modules.utils import zipdir from config import MAX_THREAD, MANGA_STORAGE_PATH, CBZ_STORAGE_PATH class Fetcher: manga_name = None def __init__(self, provider, url):...
wongpinter/manga-dl
app/fetcher.py
fetcher.py
py
1,417
python
en
code
0
github-code
13
38630974551
from rest_framework import serializers from .models import Project from authentication.models import User class ProjectSerializer(serializers.ModelSerializer): class Meta: model = Project fields = ['id', 'name', 'description', 'type', 'created_time', 'author'] read_only_fields = ('author',...
DomninBenoit/SoftDesk_Support
SoftDesk/projects/serializers.py
serializers.py
py
1,377
python
en
code
0
github-code
13
37619133742
#!/usr/bin/env python2 import rospy from visualization_msgs.msg import Marker from geometry_msgs.msg import Point from msgs.msg import LaneEvent class Node: ground_z = -3.1 x1_min_ = 1.0 x1_max_ = 71.0 x1_center_ = (x1_min_ + x1_max_) / 2 x1_scale_ = x1_max_ - x1_min_ y1_min_ = 1.5 # right...
wasn-lab/Taillight_Recognition_with_VGG16-WaveNet
src/detection_viz/scripts/gen_lane_event_grid.py
gen_lane_event_grid.py
py
6,691
python
en
code
2
github-code
13
26893452765
import os import subprocess from make_enc import* from testGUI import first_GUI # ----- GATHERING PATH INFO ----- output = subprocess.getoutput( 'cd' ) full_path = '' + output # ----- GETTING USERNAME ----- LHS_start = output.find('Users') + len('Users') + 1 user = output[LHS_start:] RHS_end = user.fi...
mwmorale/StoringEncryptionData
OS_manip.py
OS_manip.py
py
1,900
python
en
code
2
github-code
13
18274948226
from assemblyline.al.common.result import ResultSection, Tag, TAG_WEIGHT, Classification, TAG_USAGE, TAG_TYPE class VirusHitSection(ResultSection): def __init__(self, virus_name, score, embedded_filename='', detection_type=''): if embedded_filename: title = 'Embedded file: %s was identified a...
deeptechlabs/cyberweapons
assemblyline/assemblyline/al/common/av_result.py
av_result.py
py
2,116
python
en
code
78
github-code
13
37132413130
age = int(input('Введите ваш возраст: ')) # простой вариант преобразования строки (str) в целое число (int) #int_age = int(age) # второй вариант более сложный и занимает больше строк if age < 28: print('Поздравляю, Вы - Молодой козлик!') else: print('Увы, но вы - Старикашка!') # Цикл ...
lis5662/Hangman-
Test.py
Test.py
py
934
python
ru
code
0
github-code
13
1434394303
print('='*20,'欢迎使用好友系统','='*20) print() hy=[] while True : print('''\ 1:\t添加好友 2:\t删除好友 3:\t修改备注 4:\t展示好友 5:\t退出 ''') print('-' * 58) print('请选择要做得操作') xz=input() if xz =='1' : print('输入要添加的好友') name_hy=input() if name_hy in hy: print(f'{na...
sk0606-sk/python
python1/python3/练习/1/好友管理系统.py
好友管理系统.py
py
2,658
python
zh
code
0
github-code
13
23836488255
from datetime import time, date from random import choice from time import sleep import os from discord.ext import tasks, commands import discord from poll import send_poll_req, create_poll import utils TOKEN = os.environ["TOKEN"] CHAN_ID = int(os.environ["CHAN_ID"]) ADMIN = int(os.environ["ADMIN"]) JOB_TIME = time...
EarlPitts/badminbot-v2
bot.py
bot.py
py
4,409
python
en
code
0
github-code
13
23243413194
import numpy as np import torch import torch.nn.functional as F from item_to_genre import item_to_genre import pandas as pd from sklearn.preprocessing import normalize from topK import topK, hrK class XEval(object): """ evaluate the explainability """ def __init__(self, dataset='100k'): """ ...
pd90506/AMCF
evaluate.py
evaluate.py
py
8,358
python
en
code
15
github-code
13
11836791086
# main -> controller -> db_controller import json from controller import controller from controller.db_controller import config from controller import json_writer ask_for_dbs = True crud_choice = "" dbs_choice = "" json_writer.connect() def getOverview(): jsonFile = open('Schema/main/main.json') data = json....
joshelboy/db2_a1
main.py
main.py
py
6,350
python
en
code
0
github-code
13
3900675070
import sys from flask_restful import Resource, reqparse from flask import jsonify from flask_jwt_simple import create_jwt, jwt_required, get_jwt_identity from server import bcrypt from server.models.GradeDistribution import GradeDistribution from server.models.User import User from server.models.Lecturer import Lectu...
alitolga/ITU-CS-Database-Project
server/resources/admin.py
admin.py
py
13,050
python
en
code
0
github-code
13
42116011928
import sys lines=sys.stdin.readlines() N=int(lines[0].split()[0]) e=[[] for i in range(N)] for line in lines[1:]: [a,b,w]=[int(x) for x in line.split()] e[a-1].append((b-1,w)) mx=[{} for i in range(N)] mx[0][0]=0 for k in range(N): for (t,w) in e[k]: for (n,s) in mx[k].items(): if (not n...
Kodsport/swedish-olympiad-2018
final/trevligvag/submissions/partially_accepted/par_slow.py
par_slow.py
py
474
python
en
code
0
github-code
13
12458347774
from rest_framework import serializers from veterinarian_information.models import AcademicInformation class AcademicInformationSerializer(serializers.ModelSerializer): title = serializers.CharField( max_length=256, required=True, error_messages={ 'required': 'Por favor, ingrese un título', ...
Eliana-Janneth/vetapp-backend
veterinarian_information/serializers/academic_information.py
academic_information.py
py
1,517
python
es
code
0
github-code
13
7729389650
from bokeh.plotting import figure from bokeh.embed import components from bokeh.io import output_file, show from bokeh.layouts import row import datetime import sqlite3 plant_data_db = '/var/jail/home/team07/plant_data.db' def request_handler(request): if request['method'] == "GET": id = req...
zjohhson/Projects
You Grow Girl!/plant_data_grapher.py
plant_data_grapher.py
py
3,716
python
en
code
0
github-code
13