seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
20494000483
import random class CaraCoroa: def __init__(self): self.lado = 'Cara' def lancar(self): if random.randint(0, 1) % 2 == 0: self.lado = 'Cara'.upper() return self.lado else: self.lado = 'Coroa'.upper() return self.lado class Dado: de...
Adriano1976/Curso-de-Python
Secao04-Introducao-a-POO/Aula097-Classes/Jogo - Cara Coroa e Dados.py
Jogo - Cara Coroa e Dados.py
py
776
python
pt
code
0
github-code
6
25208341216
#/usr/bin/python3 from pwn import * context.arch = 'amd64' PATH = 'src/chall' HOST = '54.179.233.189' PORT = 8001 GDBSOURCE = ['~/peda/peda.py', '~/pwndbg/gdbinit.py'] LIBC_DBG = { '16.04' : ['~/debug/ubuntu-16.04/dbg64/', '~/debug/ubuntu-16.04/dbg64/libc-2.23.so'], '18.04' : ['~/debug/ubuntu-18.04/dbg64/...
bl33dz/ForestyCTF
Binary Exploitation/bof/solve.py
solve.py
py
1,854
python
en
code
1
github-code
6
20181255699
# -*- coding: utf-8 -*- """ Created on Wed Apr 5 12:37:51 2017 @author: vital """ import pickle import networkx as nx import codecs import re from morph import dictionaries as dic from morph import lemmas_dict as lem from config import basedir from app import models, db G = pickle.loads(models.Graph.query.filter_by(...
vetka925/oldturkicmorph-web
morph/morph_analysis.py
morph_analysis.py
py
5,750
python
en
code
0
github-code
6
14839168624
from django.contrib.auth import get_user_model from django.shortcuts import get_object_or_404, render, redirect from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator from django.conf import settings from .forms import PostForm, CommentForm from .models import Post, Group...
Medbrat4669/yatube_project
yatube/posts/views.py
views.py
py
4,552
python
en
code
0
github-code
6
36802074369
#! /usr/bin/python3 import sqlite3 import pandas as pd pd.set_option('display.max_columns', 500) path = '/home/mayijun/CITI2017/' # Calculate station days conn = sqlite3.connect(path + 'CITI2017.sqlite3') sql = """SELECT DISTINCT startstationid AS stationid,startdate AS date FROM trip WHERE startweekday NOT IN ('S...
NYCPlanning/td-citibike
2017/stationdays.py
stationdays.py
py
1,726
python
en
code
1
github-code
6
29969194613
from src import EventManager, ModuleManager, utils TAGS = { utils.irc.MessageTag(None, "inspircd.org/bot"), utils.irc.MessageTag(None, "draft/bot") } class Module(ModuleManager.BaseModule): @utils.hook("received.376") @utils.hook("received.422") def botmode(self, event): if "BOT" in event[...
xfnw/bitbot
modules/ircv3_botignore.py
ircv3_botignore.py
py
756
python
en
code
null
github-code
6
12960752319
import warnings warnings.filterwarnings('ignore') from popsycle import synthetic import numpy as np import matplotlib.pyplot as plt from astropy.table import Table import h5py def test_h5_output(ebf_file, reference_h5_file, extra_col= False): """" Parameters ---------- ebf_file : str Name of t...
jluastro/PopSyCLE
popsycle/tests/output_test_synthetic.py
output_test_synthetic.py
py
4,102
python
en
code
13
github-code
6
25993094849
from datetime import datetime from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, TextAreaField, SelectField, FloatField from wtforms.validators import DataRequired, Length, Regexp class NewOrderForm(FlaskForm): description = TextAreaField("Опис: ", valid...
1Lorde/orders-tracker
orders_tracker/forms.py
forms.py
py
4,563
python
en
code
0
github-code
6
16760366561
from django.shortcuts import render,redirect,get_object_or_404 # CSRF from django.views.decorators.csrf import csrf_exempt from django.utils.http import urlsafe_base64_encode,urlsafe_base64_decode from django.utils.encoding import force_bytes from django.core.mail import EmailMessage from django.utils.encoding import ...
suna-ji/RockJiggu
RockJiggu/views.py
views.py
py
2,535
python
en
code
0
github-code
6
13956703300
from django.db.models import Field from . import forms from . import validators from .ipv6cidr import clean_ipv6_cidr from django.utils.translation import gettext_lazy as _, ngettext_lazy class GenericIPNetworkField(Field): """ Support CIDR input ipv4 0.0.0.0/0 ipv6 ::::/0 """ empty_strings_...
MilkBotttle/BFP
fields/cidr.py
cidr.py
py
2,978
python
en
code
0
github-code
6
31228319050
#coding=utf-8 from thuproxy.alipay_api import * from thuproxy.proxy_account_views import * import datetime import uuid import urllib.request from django.views.decorators.csrf import csrf_exempt from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect from djan...
flyz1360/scholarcloud
thuproxy/pay_views.py
pay_views.py
py
14,990
python
en
code
1
github-code
6
74550779386
import torch from torch import Tensor, nn import torchvision import os import numpy as np class Normalize: def __init__(self, n_channels, expected_values, variance): self.n_channels = n_channels self.expected_values = expected_values self.variance = variance assert self.n_channels...
Mr-Ace-1997/SGBA-A-Stealthy-Scapegoat-Backdoor-Attack-against-Deep-Neural-Networks
utils_universal_trigger.py
utils_universal_trigger.py
py
10,352
python
en
code
0
github-code
6
10502382952
class Solution: # @param A : string # @return an integer def atoi(self, s): s = s.strip() # strips all spaces on left and right if not s: return 0 sign = -1 if s[0] == '-' else 1 val, index = 0, 0 if s[0] in ['+', '-']: index = 1 while index < len(s) and s[i...
anojkr/help
interview_bit/string/atoi.py
atoi.py
py
542
python
en
code
0
github-code
6
26191759535
import requests import json import re import time import csv import MySQLdb as mdb from bs4 import BeautifulSoup import numpy as np import pandas as pd from helpers import * """ This script scrapes and stores the fantasy points achieved by each player for the 2013 season. The data is stored in a .csv file. """ def mai...
kwheeler27/insight_datasci
data/actual_fantasy_pts.py
actual_fantasy_pts.py
py
1,604
python
en
code
1
github-code
6
26829757478
#!/usr/bin/python import json import utils import logging import os import subprocess import smt_encoding import pysmt.shortcuts import re import requests import core_data import hyportage_pattern import hyportage_db from pysmt.smtlib.parser import SmtLib20Parser import cStringIO """ This file contains all the f...
HyVar/gentoo_to_mspl
host/scripts/reconfigure.py
reconfigure.py
py
16,982
python
en
code
10
github-code
6
31215041211
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('siteScrape', '0001_initial'), ] operations = [ migrations.AddField( model_name='teacher', name='aver...
anikan/Classify
migrations/0002_auto_20150910_1439.py
0002_auto_20150910_1439.py
py
755
python
en
code
0
github-code
6
38465761430
from Christiaan.csvLoading.CSVLoader import read_csv_tableau from Christiaan.dataCleaning.dataCleaner import cleanTechColumn import pandas as pd import numpy as np def readTechCSV(filename): df = read_csv_tableau(filename, filename) df = df[['Employee Number', 'Firstname Firstname', 'Lastname Lastname', 'Level...
chrike-platinum/training-recommender
Ade/visualisationPrep.py
visualisationPrep.py
py
3,541
python
en
code
0
github-code
6
648818691
from argparse import ArgumentParser from inference import Infer parser = ArgumentParser() parser.add_argument("modelname", help="name of model to use") parser.add_argument("imagepath", help="relative path to image") parser.add_argument("--use_gpu", help="use gpu or not", nargs="?", default=False, const=True, type = ...
Deepesh22/Crowd-Counting
cli.py
cli.py
py
482
python
en
code
0
github-code
6
27213329955
import sys from collections import deque dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] INF = 1e9 N, M = map(int, sys.stdin.readline().rstrip().split()) maps = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(N)] hospital_comb = [] answer = INF def dfs(hospital_list, pick_list, idx): if idx == len(h...
hammii/Algorithm
CodeTree_python/바이러스_백신.py
바이러스_백신.py
py
1,804
python
en
code
2
github-code
6
38852384412
from django.core import validators from rest_framework import serializers from django.utils.translation import gettext_lazy as _ from degvabank.apps.account.models import Account from degvabank.apps.card.models import CreditCard from degvabank.apps.transaction.utils import is_our_number from .models import Transactio...
Vixx-X/DEGVABank-backend
degvabank/degvabank/apps/transaction/serializers.py
serializers.py
py
5,507
python
en
code
0
github-code
6
35721608965
import os import json import numpy as np import preprocessing as preprocessing from tensorflow import keras def init(): global model global vocab global max_len model = keras.models.load_model(os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'model'), compile=False) with open(os.path.join(os.getenv('AZ...
luisespriella9/disastersLocator
src/scoring.py
scoring.py
py
809
python
en
code
0
github-code
6
29520352035
import requests from bs4 import BeautifulSoup as bs import csv from itertools import chain def get_urls(): """ Skilar lista sem inniheldur slóðir á allar undirsíður með kosningaúrslitum """ main_page = requests.get("http://www.kosningastofnun.in/") page_soup = bs(main_page.content, "html.parse...
flother/data-acq-viz
2018/kosningaskrapari-lausn.py
kosningaskrapari-lausn.py
py
2,713
python
is
code
1
github-code
6
72588123388
from numpy.testing import * import numpy import numpy.random from adolc import * from adolc.cgraph import * from adolc.tangent import * class TangentOperationsTests(TestCase): def test_constructor(self): t1 = Tangent(1,2) t2 = Tangent(adouble(1),2) def test_float_tangent_float_tangent(self): ...
b45ch1/pyadolc
adolc/tests/test_tangent.py
test_tangent.py
py
3,503
python
en
code
43
github-code
6
29875084962
## ~~~~~~~~~~~~~~~~~~ # Deep Willy Network ## ~~~~~~~~~~~~~~~~~~ import numpy as np, json, sys, os sys.path.append(os.path.dirname(__file__)) from willies import * class DeepWilly(object): _willy_classes = {'connected': ConnectedWilly, 'dropout': DropoutWilly, '...
gavarela/willyai
willyai/deepWilly.py
deepWilly.py
py
6,171
python
en
code
0
github-code
6
50051591
from typing import * # 一个较长的字符串肯定不会是一个较短字符串的子序列,那么只需要从长到短判断,每一个字符串是否为其他长度不小于它的字符串的子序列就行了 # When we add a letter Y to our candidate longest uncommon subsequence answer of X, it only makes it strictly harder to find a common subsequence. # Thus our candidate longest uncommon subsequences will be chosen from the group ...
code-cp/leetcode
solutions/522/main.py
main.py
py
1,198
python
en
code
0
github-code
6
44632376656
# coding:utf-8 from bs4 import BeautifulSoup import urllib.request as req import sqlite3 from contextlib import closing url="http://su-gi-rx.com/2017/07/16/python_4/" dbname='database.db' conn=sqlite3.connect(dbname) c=conn.cursor() table_name = 'test' def get_html(): #urlopen()でデータ取得 res=req.ur...
riku-nagisa/python1
html_ren.py
html_ren.py
py
1,261
python
en
code
0
github-code
6
34183765672
def convert_rank(num): rank = 6 - num + 1 if rank >= 6 : rank = 6 return rank def solution(lottos, win_nums): match, zero = 0, 0 for num in lottos : if not num : zero += 1 if num in win_nums: match += 1 return [convert_rank(match+zero), convert_ra...
study-for-interview/algorithm-study
hanjo/개인용/programmers/완전탐색/L1_로또의최고순위와최저순위/solution.py
solution.py
py
578
python
en
code
8
github-code
6
25018521367
model_cfg = { "high_level_parameters": { # parameters common to all models, e.g. how much data to get, debugging parameters etc. "data_period": ("2020-01-01", "2023-01-01"), "parameter2": 60, "parameter3": 20, }, "low_level_parameters": { "model1_parameters": { "...
hviidhenrik/my-sample-data-science-structure
core/config/model_config.py
model_config.py
py
488
python
en
code
0
github-code
6
73995685309
# from game import random # from game import np from game import Game from agent import Agent import pandas as pd class GameAnalysis: def __init__(self, imported_game: Game): self.game = imported_game def print_data(self): rows = [] for rob in self.game.robots: rows.append...
Jayordo/thymio_aseba_install
lang_game_2/game_analysis.py
game_analysis.py
py
3,884
python
en
code
0
github-code
6
6771398570
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql class ProxyPoolCrawlerPipeline(object): def process_item(self, item, spider): return item # 存储到mys...
ShawnRong/proxy-pool-crawler
proxy_pool_crawler/pipelines.py
pipelines.py
py
2,136
python
en
code
0
github-code
6
2721248561
import copy, random, datetime suppliesDataSets = [ [ { "labels": [], #food "data": [] }, { "labels": [], #drink "data": [] }, { "labels": [], #medicine "data": [] } ] ] now = datetime.datetime...
e1833-tomohiro/Kadai
backend/store.py
store.py
py
680
python
en
code
0
github-code
6
8384623961
from __future__ import print_function from __future__ import absolute_import import sys import math import heapq import gzip import warnings from xml.sax import handler, parse from copy import copy from collections import defaultdict from itertools import chain import sumolib from . import lane, edge, netshiftadaptor,...
ngctnnnn/DRL_Traffic-Signal-Control
sumo-rl/sumo/tools/sumolib/net/__init__.py
__init__.py
py
35,544
python
en
code
17
github-code
6
72345890107
data = [] count = 0 with open ('reviews.txt', 'r') as f: for line in f: data.append(line) count += 1 if count % 1000 == 0: print(len(data)) print('Files finished reading, we have total', len(data), 'reviews') sum_len = 0 for d in data: sum_len = sum_len + len(d) print('The ...
bealeebrandt/reviews-analytics
read.py
read.py
py
373
python
en
code
0
github-code
6
27009702338
import numpy as np import run as r ''' [id] 115 [name] BayesianRidge [input] x_train 训练集 训练集标签数据集 二维数组 必须 定数 y_train 测试集 测试集数据集 二维数组 必须 定数 x_test 训练集标签 训练集标签标签 一维数组 必须 定数 y_test 测试集标签 测试集标签 一维数组 必须 定数 n_iter n_iter 默认为300,最大迭代次数。应该大于或等于1,可选整数 整数 不必须 定数 tol tol 默认为1e-3,如果w收敛,则停止算法,可选浮点数 浮点数 不必须 定数 alpha_1 alpha_1 默认...
lisunshine1234/mlp-algorithm-python
machine_learning/regression/linear_models/BayesianRidge/main.py
main.py
py
5,830
python
zh
code
0
github-code
6
38696958854
# coding=utf-8 import requests class Airbnb(object): """Interface to get data from airbnb api. You can use : api_instance = Airbnb() api_instance.get_logement("Paris") api_instance.get_review(logement_id) api_instance.get_logement_details(logement_id)""" def get_user_infos(self, us...
pablo-a/airbnb
airbnb_api.py
airbnb_api.py
py
6,552
python
en
code
1
github-code
6
3200862039
def getOpCode(i): return int(str(i)[-2:]) def getParaModes(i): modes = list(map(lambda x: int(x), str(i)[:-2])) while len(modes) < 2: modes.insert(0,0) return modes def getOperand(program, addr, mode): operand = None try: operand = program[addr] if mode == 1 else program[program[addr]] e...
Sebastian-/advent-of-code-2019
day05/sol.py
sol.py
py
1,784
python
en
code
0
github-code
6
73264632828
from game_objects.projectile import Projectile from game_objects.player import Player from pyglet import clock from widgets.event_window import EventWindow import pyglet import cv2 as cv import time window = EventWindow(fullscreen=True) # soul_image = pyglet.image.load('soul.png') # soul = pyglet.sprite.Sprite(soul_im...
KimPalao/Headshot
collision_test.py
collision_test.py
py
1,686
python
en
code
0
github-code
6
40176582534
#import gevent.monkey #gevent.monkey.patch_all() import os import sys import time import pprint import logging import requests import grequests import threading import urllib.parse from bs4 import BeautifulSoup import db import parse logger = logging.getLogger('scraper') logger.setLevel(logging.DEBUG) SRC_DIR = os....
JohnMcAninley/beer-goggles
scraper/src/scraper.py
scraper.py
py
7,113
python
en
code
0
github-code
6
41095556533
import sqlite3 conn = sqlite3.connect("tickets5.db") cur = conn.cursor() def displayAllTickets(): sql = "SELECT * FROM tickets" cur.execute(sql) results = cur.fetchall() if results: printStuff(results) else: print("No data found") print() def addTicket(): actual_sp...
LilGotit/brain-drizzle
TicketsDatabase/ticketDatabase.py
ticketDatabase.py
py
2,130
python
en
code
0
github-code
6
43627424884
from typing import List class Solution: def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int: employees = {} for i, m in enumerate(manager): if i != headID: employees[m] = employees.get(m, []) + [i] queue = [[headID, info...
MichaelTQ/LeetcodePythonProject
solutions/leetcode_1351_1400/LeetCode1376_TimeNeededToInformAllEmployees.py
LeetCode1376_TimeNeededToInformAllEmployees.py
py
1,290
python
en
code
0
github-code
6
42535314476
# OKANCAN COSAR # 12253018 import Helper import Constant import Step import sys populasyon = [] def Calculate(populasyonlar): # for i in Helper.populasyonDict(populasyonlar): # # guzel yazdirma # ff = "" # for ix in i[0]: # ff = ff + str(ix) # print("(", ff, "),", i[1...
OkancanCosar/01-Knapsack-with-GA
python/index.py
index.py
py
1,827
python
tr
code
2
github-code
6
69817132988
#!/usr/bin/env python3 class PIDController: """ """ def __init__(self, kp, ki, kd, dt): self.__kp = kp # Proportional weight. self.__ki = ki # Integral weight. self.__kd = kd # Differential weight. self.__dt ...
derekdecost/Differential-Drive-Robot
packages/pid_controller/src/pid_controller.py
pid_controller.py
py
1,392
python
en
code
0
github-code
6
26531291291
from pyhpecfm import system from lib.actions import HpecfmBaseAction class eventLookup(HpecfmBaseAction): def run(self): cfm_audits = system.get_audit_logs(self.client) if isinstance(cfm_audits, list): # Create a empty list for alarms event_data = [] # Loop throu...
HewlettPackard/stackstorm-hpe-cfm
actions/get_events.py
get_events.py
py
1,125
python
en
code
1
github-code
6
10251411217
""" Configuration reader for the population_gravity model @author Chris R. Vernon @email: chris.vernon@pnnl.gov License: BSD 2-Clause, see LICENSE and DISCLAIMER files """ import datetime import os import simplejson import rasterio import yaml import pandas as pd import population_gravity.downscale_utilitie...
IMMM-SFA/population_gravity
population_gravity/read_config.py
read_config.py
py
26,485
python
en
code
4
github-code
6
7206670163
assert __name__ == "__main__" import sys import os import subprocess import shutil from . import config os.chdir('node-{}'.format(config.nodeVersion)) configureArgvs = config.configFlags if config.nodeTargetConfig == 'Debug': configureArgvs = configureArgvs + ['--debug-nghttp2', '--debug-lib'] ...
MafiaHub/building-node
scripts/build.py
build.py
py
1,694
python
en
code
0
github-code
6
26302348125
import frappe, requests from frappe.model.document import Document class DjangoProperty(Document): def db_insert(self): d = self.get_valid_dict(convert_dates_to_str=True) res = requests.post(f'{self.get_url()}/propertycreate/', data=dict(d)) return res.json() def load_from_db(self): print(self.doctype, ...
mymi14s/estate_app
estate_app/estate_app/doctype/djangoproperty/djangoproperty.py
djangoproperty.py
py
1,046
python
en
code
16
github-code
6
30906490211
import requests, re def scrape_images(link): # define our user headers headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36" } gallery_append = 'media?id=media0&ref=photoCollage&channel=RES_BUY' link_...
GregorMonsonFD/holmly_sourcing_legacy
scripts/python/pdfGen/rightmove_image_extract.py
rightmove_image_extract.py
py
717
python
en
code
0
github-code
6
70829089789
import logging.config DEFAULT_LEVEL = logging.WARNING DEFAULT_FMT = '%(asctime)s | %(levelname)-8s | %(message)s' def install(level=DEFAULT_LEVEL, fmt=DEFAULT_FMT): logging.basicConfig(level=level, format=fmt) try: import sys import colorlog formatter = colorlog.ColoredFormatter( ...
Arcensoth/pymcutil
pymcutil/logging/__init__.py
__init__.py
py
799
python
en
code
3
github-code
6
27392276941
connections = {} with open("Day12.txt", 'r') as INPUT: data = INPUT.read().split("\n") for i in data: caves = i.split("-") if caves[1] != "start": if caves[0] in connections: connections[caves[0]].append(caves[1]) else: connections...
stepheneldridge/Advent-of-Code-2021
Day12.py
Day12.py
py
1,813
python
en
code
0
github-code
6
70143221629
# First sight solution # PART ONE class Solution: def findRequirementsForMass(self, the_mass): module_mass = int(the_mass) dividedByThree = module_mass / 3 rounded_minus_two = int(dividedByThree) - 2 return rounded_minus_two def findSolution(self, inputfile): total_fue...
StephenClarkApps/AdventOfCode2019
DayOne/DayOne.py
DayOne.py
py
1,637
python
en
code
0
github-code
6
2231582526
def state_machine(demanded_state): switcher = { 0: menu, 1: cycling, 2: settings, 3: exit } func = switcher.get(demanded_state, "Not found!") return func() def allowed_transition(demanded_state, allowed_states = []): for i in allowed_states: if(...
frigodaw/pi-gps
python/stubs.py
stubs.py
py
3,026
python
en
code
1
github-code
6
73185311228
nums = [0,0,1,1,1,2,2,3,3,4] count = 1 for i in range(1, len(nums)): if (nums[i] != nums[i - 1]): nums[count] = nums[i] count = count + 1 print(count) for i in range(count, len(nums)): nums.remove(nums[count ]) print(nums)
xuchenxing/MyLeetcode
junior/DeleteRepeatFromSortedList.py
DeleteRepeatFromSortedList.py
py
249
python
en
code
0
github-code
6
26417087384
# Nesting - Store a set of dictionaries in a list or a list of # items as a value in a dictionary. A power feature ! # An empty list for storing aliens # At range() returns a set of numbers that teills Python how many # times we want the lop to repeat. Each time the loop runs we # create a new alien...
wenlarry/CrashPython
dict_nesting.py
dict_nesting.py
py
3,383
python
en
code
0
github-code
6
19181221365
"""Add agreed to TOS int field Revision ID: 51398a87b2ef Revises: 95c58503e9c0 Create Date: 2020-12-02 09:43:04.949189 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "51398a87b2ef" down_revision = "95c58503e9c0" branch_labels = None depends_on = None def upgr...
Almenon/couchers
app/backend/src/couchers/migrations/versions/51398a87b2ef_add_agreed_to_tos_int_field.py
51398a87b2ef_add_agreed_to_tos_int_field.py
py
696
python
en
code
null
github-code
6
10120432429
""" Library and Wrapper for DHT11 and DHT22 sensors. Based on https://github.com/JurassicPork/DHT_PyCom/tree/pulses_get Extensions: Renamed module filename to dht (from dth.py) and added wrapper function For hardware connection: YELLOW/WHITE: PIN1 VCC through GPIO, PIN2: DATA through GPIO, PIN3: NC, PIN4: G...
insighio/insighioNode
insighioNode/lib/sensors/dht.py
dht.py
py
3,993
python
en
code
5
github-code
6
42300472031
# -*- coding: utf-8 -*- """ Created on Fri Jun 14 12:43:40 2019 @author: Minh """ import json import requests import tweepy import base64 import sys import time import os import csv from AlarmDialogUtil import showAlertDialog class TwitterMonitor(): twitter_public = twitter_private = access_tok...
BeePete/SBV1
twitter_monitor.py
twitter_monitor.py
py
2,214
python
en
code
0
github-code
6
37395020380
import subprocess # Start gameLibrary.py in a subprocess game_process = subprocess.Popen(["python", "gameLibrary.py"]) # Start highscoreChecker.py in a subprocess highscore_checker_process = subprocess.Popen(["python", "highscoreChecker.py"]) # Start highscoreDisplay.py in a subprocess highscore_process = s...
Tsukaiyo/cat6Dist
cat6/main.py
main.py
py
545
python
en
code
0
github-code
6
43243448951
import logging from functools import wraps from io import BytesIO from PIL import Image try: from PIL import ImageCms # pylint: disable=ungrouped-imports except ImportError: ImageCms = None DEFAULT_SRGB_PROFILE = None TRANSFORM_FLAGS = 0 else: DEFAULT_SRGB_PROFILE = ImageCms.ImageCmsProfile( ...
thumbor/thumbor
thumbor/utils.py
utils.py
py
4,272
python
en
code
9,707
github-code
6
36043542856
pessoas = [] media = cont = 0 while True: pessoas.append({"nome":input("Nome: ").title().strip()}) pessoas[cont]["sexo"] = input("Sexo [F/M]: ").upper().strip() while pessoas[cont]["sexo"] not in "FM": print("ERRO! Por favor, digite apenas M ou F.") pessoas[cont]["sexo"] = input("Sexo...
amandasales/Cadastro
cadastro.py
cadastro.py
py
1,185
python
pt
code
0
github-code
6
2026784639
import msvcrt import zipfile import threading from selenium import webdriver from selenium.webdriver.edge.options import Options from bs4 import BeautifulSoup from concurrent.futures import ThreadPoolExecutor,wait, FIRST_COMPLETED, ALL_COMPLETED resultList = [] unfoundList = [] alltask = [] def main(): file = 'C...
Nienter/mypy
personal/getNewestVersion.py
getNewestVersion.py
py
3,123
python
en
code
0
github-code
6
23261593645
import pygame import math import random #CONST SCREENWIDTH=1280 SCREENHEIGHT=720 # pygame setup pygame.init() screen = pygame.display.set_mode((SCREENWIDTH,SCREENHEIGHT)) clock = pygame.time.Clock() running = True dt = 0 FPS=60 pygame.display.set_caption('TANK') #variables x_target=[] y_target=[] checkVar =1 showHelp...
stefanstojkoviic/Tenkici
game.py
game.py
py
8,210
python
en
code
0
github-code
6
72136709947
#Plots import re import plotly.express as px #DASHBOARD import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output import dash_bootstrap_components as dbc import dash_table from dash.exceptions import PreventUpdate import tweepy #####...
balasubramaniamniit/StockMarket-Insights
app.py
app.py
py
30,384
python
en
code
0
github-code
6
26345492918
class Technology: def __init__(self, language, course_name, participants): self.language = language self.course_name = course_name self.participants = participants self.course = {self.course_name: int(self.participants)} self.total_participants = int(participants) def ad...
YovchoGandjurov/Python-Fundamentals
Exam Preparation/04.Course_Stats.py
04.Course_Stats.py
py
1,962
python
en
code
1
github-code
6
39176120423
array = [1,2,3,4] array2 = [1,1,1,1,1] def runningSum(array): sum = 0 new_array = [] for i in range(0 , len(array)): sum = sum + array[i] new_array.append(sum) return new_array print(runningSum(array2))
adnantabda/Competitive-Programming
easy/running_sum_of_1D_array.py
running_sum_of_1D_array.py
py
238
python
en
code
0
github-code
6
6428337601
#! /user/bin/env python # -*- coding:utf-8 -*- from python_http_runner.src.common.utils import get_data_from_yml from python_http_runner.src.common.utils import get_url def common_get(*args): data = { "env": "TEST", "key1": "value1", "key2": "value2", "url": "" } file = "....
liuxu263/PythonHttpRunner
python_http_runner/src/testsuites/debugtalk.py
debugtalk.py
py
1,019
python
en
code
0
github-code
6
16731268894
from abc import ABC, ABCMeta, abstractmethod from datetime import datetime from pprint import pprint from typing import Dict try: from dialogflow_v2 import SessionsClient from dialogflow_v2.proto.session_pb2 import ( DetectIntentResponse, QueryInput, QueryResult, TextInput, ...
autogram/Botkit
botkit/builtin_services/nlu/nluservice.py
nluservice.py
py
3,231
python
en
code
10
github-code
6
30544609936
# stemming # e.g. stemming will convert ["python","pythoner","pythoning","pythoned","pythonly"] to python # e.g. stemming will convert ["interesting","interested"] to interest # stemming may create some words that do not exits from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize ps = PorterStemm...
limingwu8/ML
NLP/demo03.py
demo03.py
py
669
python
en
code
1
github-code
6
71885865788
#! /usr/bin/env python import sys from collections import defaultdict from intcode import IntCode lines = [] for line in sys.stdin: lines.append(line.rstrip('\n')) class Robot(): program=None direction=(0,1) position=(0,0) panels=None def __init__(self, line) -> None: self.program = ...
albatros69/aoc-2019
day-11/paint.py
paint.py
py
1,580
python
en
code
0
github-code
6
19167010026
#!/usr/bin/env python3 """OpenCV-based frame viewer that replays recordings and assign time-based labels""" import argparse from pathlib import Path import time import cv2 import numpy as np import derp.util class Labeler: """OpenCV-based frame viewer that replays recordings and assign time-based labels""" d...
notkarol/derplearning
bin/label.py
label.py
py
11,483
python
en
code
40
github-code
6
6131848495
import numpy as np from PIL import Image radar = np.load('./origin_data/radars_2020-11-01_2022-12-31.npy') color_image = Image.open('./cool_data/mask.png') mask = np.array(color_image.convert('L')) for i in range(825): for j in range(200): if mask[i, j] > 200: mask[i, j] = 0 ...
Ronningen/DDIN1
ice_mask_generation.py
ice_mask_generation.py
py
720
python
en
code
1
github-code
6
40071013592
class Solution: def findNthDigit(self, n): """ :type n: int :rtype: int """ if n <= 9 : return n digit = 1 count = 9 while n > digit*count: n -= digit*count digit+=1 count*=10 start = ...
lucy9215/leetcode-python
400_NthDigit.py
400_NthDigit.py
py
734
python
en
code
0
github-code
6
73510522747
class Node: def __init__(self,val): self.val = val self.next = None class MyLinkedList: def __init__(self): self.dummy = Node(-1) def get(self, index: int) -> int: count = 0 current = self.dummy.next while current and count != index: ...
yonaSisay/a2sv-competitive-programming
0707-design-linked-list/0707-design-linked-list.py
0707-design-linked-list.py
py
1,616
python
en
code
0
github-code
6
7261113141
import matplotlib matplotlib.use('TkAgg') import cv2 import numpy as np import time from matplotlib import pyplot as plt def main(): #img= cv2.imread('primeiroFrame.jpg',0) img= cv2.imread('primeiroFrame.jpg',cv2.IMREAD_COLOR) print(img.shape) #nomaliza a imagem img = histogramaNormalizadoColor(i...
felipemateus/vis-oCompEstudo
histogram.py
histogram.py
py
5,685
python
en
code
0
github-code
6
37958731395
import sys from datetime import datetime class DateGenerator: def __init__(self, starting, ending, display, separator): self.__year_range = range(int(starting), int(ending)) self.__display = display self.__separator = separator self.__display_array = { '0': self.ymd, '1': self.dmy, '2': ...
vjgiri/date
dateext.py
dateext.py
py
1,356
python
en
code
0
github-code
6
24535937994
# html def create_html(header, body): html = '<!DOCTYPE html>' html += '<html><head>' + header + '</head>' html += '<body>' + body + '</body>' html += '</html>' return html # link def add_ttf_font(location, name): html = '<style>' html += '@font-face {' html += 'font-family:' + name + ';' html += 'src: url(' ...
dpenning/Sm4shed
SmashedLobby/html_helper.py
html_helper.py
py
9,669
python
en
code
2
github-code
6
42827733659
from global_collection import * from language_collection import * from thread_collection import * from aiy.cloudspeech import CloudSpeechClient from aiy.board import Board, Led from alzheimer import * from assistant_grpc_demo import * def main(): malddomi = Malddomi() #객체 생성 thread_instance = As...
YuSunjo/bit_project_hyodol
raspberrypi_file/new_test.py
new_test.py
py
3,221
python
en
code
0
github-code
6
43627572834
from typing import List class Solution: def maxBoxesInWarehouse(self, boxes: List[int], warehouse: List[int]) -> int: boxes.sort() p1, p2 = 0, len(warehouse)-1 res = 0 for i in range(len(boxes)-1, -1, -1): if boxes[i] <= warehouse[p1]: p1 += 1 ...
MichaelTQ/LeetcodePythonProject
solutions/leetcode_1551_1600/LeetCode1580_PutBoxesIntoTheWarehouseII.py
LeetCode1580_PutBoxesIntoTheWarehouseII.py
py
918
python
en
code
0
github-code
6
43785018579
from __future__ import print_function import argparse import sys import rospy import os import numpy as np from geometry_msgs.msg import Twist import time import cv2 import tensorflow as tf pre_path = os.path.abspath('../') sys.path.append(pre_path) from utils import imagezmq # ============================== Pretr...
KaiChen1008/Sim-to-Real-Virtual-Guidance-for-Robot-Navigation
control_policy_module/control_policy.py
control_policy.py
py
3,752
python
en
code
72
github-code
6
43356641346
#!/usr/bin/python3 from scipy import stats import numpy as np import matplotlib.pyplot as plt import sys NUM_TRIAL = 2000 def calcPlotData(numSamplings, percentiles, dist): plotXData = np.array([]) plotYData = np.array([]) for percentile in percentiles: tmpPlotXData = np.array([]) tmpPlot...
peng225/blog
230114/percentile.py
percentile.py
py
2,211
python
en
code
0
github-code
6
30789833021
from django.contrib import messages from django.shortcuts import render import random import smtplib from.models import Onlinepayment,Offlinepayment,Onlineapproval,Offlineapproval,Send def home(request): return render(request,'f1.html') def tv(request): return render(request,'tv.html') def mobile(request): ...
Nimishakc/NimishaFinal
eapp/views.py
views.py
py
5,321
python
en
code
0
github-code
6
28968326311
confectionery_dict = {"торт": ["состав - мука, сахар, дрожжи, арахис, шоколад, заварной крем", "цена за 100 гр - ", 1.95, "руб", "вес - ", 3900, "гр"], "пироженое": ["состав - мука, сахар, грецкий орех, разрыхлитель", "цена за 1...
vladalh/Overone-Python
exam2_5.py
exam2_5.py
py
3,354
python
ru
code
0
github-code
6
34332202564
import csv import os save_path = r"/home/riddhi/keystroke/output_numpy/dataset/" csv_file = save_path + r"genuine_user.csv" inputfileloc = save_path + r"genuine.txt" inputfile = open(inputfileloc, 'r') with open(csv_file, 'w') as csvfile: fieldnames = ['user', 'pr', 'pp', 'rp', 'rr', 'total', 'output'] csvwriter = c...
vishaltak/keystroke
txt2csv.py
txt2csv.py
py
859
python
en
code
1
github-code
6
32586118182
class UnionFind: def __init__(self, n): self.par = [-1]*n self.siz = [1]*n #経路圧縮あり def root(self, x): if self.par[x] == -1: return x self.par[x] = self.root(self.par[x]) return self.par[x] #経路圧縮なし """ def root(self, x): if self....
yuyu5510/Union-Find
code/Python/ARC032B.py
ARC032B.py
py
1,216
python
ja
code
1
github-code
6
11691605009
import imp import re from PySide2.QtWidgets import QMainWindow from PySide2.QtCore import Slot from ui_mainwindow import Ui_MainWindow from particulasact.particula import Particula from particulasact.index import Nodo, Lista_ligada class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self)...
arturos8617/actividad06
mainwindow.py
mainwindow.py
py
2,290
python
es
code
0
github-code
6
41746506951
# -*- coding:utf-8 -*- import os os.environ["CHAINER_TYPE_CHECK"] = "0" import numpy as np import chainer import chainer.functions as F import chainer.links as L from chainer import cuda, Variable from chainer.initializers import GlorotNormal class SelectiveGate(chainer.Chain): def __init__(self, hidden_size): ...
rn5l/session-rec
algorithms/RepeatNet/base/selective_gate.py
selective_gate.py
py
1,280
python
en
code
362
github-code
6
5679963414
""" Classes to be used when determining regularisation in unfolding """ from __future__ import print_function, division from array import array import numpy as np import math import os from itertools import chain import ROOT from MyStyle import My_Style from comparator import Contribution, Plot My_Style.cd() impor...
raggleton/QGAnalysisPlotting
unfolding_regularisation_classes.py
unfolding_regularisation_classes.py
py
11,065
python
en
code
0
github-code
6
14637889375
black, white, empty, outer = 1, 2, 0, 3 directions = [-11, -10, -9, -1, 1, 9, 10, 11] class TreeNode: val = None left = None right = None def __init__(self, val, left, right): self.val = val self.left = left self.right = right def setLeft(l): self.left = l def setRight(r): self.right = r def setVal(v)...
caelan/TJHSST-Artificial-Intelligence
Othello/JasmineDragon.py
JasmineDragon.py
py
2,788
python
en
code
0
github-code
6
44914350526
#!/usr/bin/env python3 #/* # Terminal User input # Manual Mode where the coordinate and orientation variables are input # Doesn't use accelerometer #*/ # Import essential libraries import requests #type: ignore import numpy as np #type: ignore import imutils #type: ignore import time import math from datetime import ...
Quark3e/Chromebook-projects
projects/proj_Hexclaw/in rpi/Hexclaw_Main_2.py
Hexclaw_Main_2.py
py
17,353
python
en
code
2
github-code
6
27251458016
""" 文件名: Code/Chapter09/C05_FastText/main.py 创建时间: 2023/7/22 10:31 上午 作 者: @空字符 公众号: @月来客栈 知 乎: @月来客栈 https://www.zhihu.com/people/the_lastest """ import logging from gensim.models import KeyedVectors import fasttext from fasttext.util import reduce_model import sys import os sys.path.append('../../') from utils impo...
moon-hotel/DeepLearningWithMe
Code/Chapter09/C05_FastText/main.py
main.py
py
2,582
python
en
code
116
github-code
6
75386038906
import threading import time def worker(): count = 0 while True: if (count >= 5): # raise RuntimeError() break time.sleep(1) print("I'm working") count += 1 t = threading.Thread(target=worker, name='worker') # 线程对象. t.start() # 启动. print("==End==")
hashboy1/python
MultiThread.py
MultiThread.py
py
332
python
en
code
0
github-code
6
45626436566
import threading import socket class Estatisticas: def __init__(self): self.questoes = {} def atualizar_estatisticas(self, num_questao, acertos, erros): self.questoes[num_questao] = {'acertos': acertos, 'erros': erros} def obter_estatisticas(self): return self.questoes ...
GabsLUZ/Atividade-SD
TCP/servidor.py
servidor.py
py
1,552
python
pt
code
0
github-code
6
8665774694
import os import json from botocore.exceptions import ClientError from unittest import TestCase from unittest.mock import patch from exceptions import YahooOauthError from login_yahoo_authorization_url import LoginYahooAuthorizationUrl class TestLoginYahooAuthorizationUrl(TestCase): @classmethod def setUpClas...
AlisProject/serverless-application
tests/handlers/login/yahoo/authorization_url/test_login_yahoo_authorization_url.py
test_login_yahoo_authorization_url.py
py
2,213
python
en
code
54
github-code
6
2668239466
import multiprocessing from time import ctime def consumer(input_q): print("Into consumer:",ctime()) while True: # 处理项 item = input_q.get() print ("pull",itemm,"out of q")#此处代替为有用的工作 input_q.tast_done()#发出信号通知任务完成 print("Out of consumer:",ctime())##此句末执行,因为q.join()信号后,主进程启动...
Sssssww/pycharm
多线程/22.py
22.py
py
1,065
python
en
code
0
github-code
6
23391926789
from selenium import webdriver from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By import json from pathlib import Path from time import sleep from selm.gales import settings class Gale(): def __init_...
tyutltf/xaioliangzatan
selm/gales/gale.py
gale.py
py
6,838
python
en
code
1
github-code
6
43634658293
from __future__ import division from __future__ import absolute_import #typing #overrides from allennlp.common import squad_eval from allennlp.training.metrics.metric import Metric class SquadEmAndF1(Metric): u""" This :class:`Metric` takes the best span string computed by a model, along with the answer ...
plasticityai/magnitude
pymagnitude/third_party/allennlp/training/metrics/squad_em_and_f1.py
squad_em_and_f1.py
py
1,963
python
en
code
1,607
github-code
6
41244754700
'''Faça um programa que leia três numeros e mostre qual é o maior e qual é o menor''' n1 = int(input('Digite um número: ')) n2 = int(input('Digite um número: ')) n3 = int(input('Digite um número: ')) maior = n1 if n2 > n1: maior = n2 if n3 > maior: maior = n3 menor = n1 if n2 < n1: menor = 2 if n3 <...
andrematos90/Python
CursoEmVideo/Módulo 1/Desafio 033.py
Desafio 033.py
py
628
python
pt
code
0
github-code
6
13301338601
from bson.objectid import ObjectId from flask import Blueprint, jsonify from assets.extensions import mongo from assets.decors import errorhandler, tokenrequired accounts = Blueprint("accounts", __name__, url_prefix="/accounts") # STATUS @accounts.route("/<account_id>/status", methods=["GET"]) @tokenrequired @errorh...
TreyThomas93/tos-python-web-app-server
api/accounts/__init__.py
__init__.py
py
1,434
python
en
code
0
github-code
6
14471424043
''' There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the target node, and w is the time it takes for a signal to travel from source to target. Now, we send a signal from a certain node K. How long will it take for ...
loganyu/leetcode
problems/743_network_delay_time.py
743_network_delay_time.py
py
3,027
python
en
code
0
github-code
6
40017302365
# import streamlit as st # import threading import time # # 定义共享变量 # is_running = True # # 定义线程函数 # def thread_function(): # a = 0 # st.text(f'in to thread') # global is_running # while is_running: # # 线程执行的逻辑 # a += 1 # st.text(a) # time.sleep(1) # st.text(f'out thr...
YuTheon/NUS_AIOT_web2
test.py
test.py
py
2,927
python
en
code
0
github-code
6
22425229606
import typing from pydantic import BaseModel, root_validator from candid import CandidApiEnvironment from candid.client import CandidApi, AsyncCandidApi from candid.resources.auth.client import AuthClient, AsyncAuthClient from candid.resources.auth.resources.v_2 import AuthGetTokenRequest from candid.resources.billin...
candidhealth/candid-python
src/candid/candid_api_client.py
candid_api_client.py
py
2,650
python
en
code
0
github-code
6