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
14485940599
from boggle import Boggle from flask import Flask, request, render_template, session, jsonify boggle_game = Boggle() app = Flask(__name__) app.config["SECRET_KEY"] = "Chicken fears Maximus" # default page / board @app.route("/") def homepage(): """Creating a new board for the game""" board = boggle_game...
shaunwo/19-flask-boggle
app.py
app.py
py
1,600
python
en
code
0
github-code
1
940085232
# _*_coding:utf-8_*_ # __author: duancong # __date: 4/20/23 1:35 PM # __filename: train_config.py.py from pythonUtils import * sys.path.append('labelfolder') #优化器选择S # SGD = {"name": "SGD", "lr": 0.0001, "weight_decay": 0.001, "momentum": 0.9} # Adam = {"name": "Adam", "lr": 0.001, "weight_decay": 0.001} #数据...
congduan-HNU/SSoftmax
trainAcrossDatasets/train_config.py
train_config.py
py
2,444
python
en
code
2
github-code
1
26383762180
# -*- coding: utf-8 -*- """ ETM """ import numpy as np import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, RegexpTokenizer from nltk.corpus import wordnet from nltk.stem import WordNetLemmatizer lemmatizer = WordNetLemmatizer() from sklearn.feature_extraction import DictVectorizer f...
anoopkdcs/REDAffectiveLM
Baselines/emotion_term_model.py
emotion_term_model.py
py
9,858
python
en
code
0
github-code
1
72000249953
import time import math from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By import pytest def calc(): return str(math.log(int(time.time()))) @pytest.fixture(scope="function...
lexeg/stepik---auto-tests-course
part#3/lesson-6_step-3.py
lesson-6_step-3.py
py
1,482
python
en
code
0
github-code
1
19037842932
import re import numpy as np import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.impute import SimpleImputer from imblearn.under_sampling \ import (RandomUnderSampler, TomekLinks, InstanceHardnessThreshold)...
vcerqueira/activity_monitoring_mimic
experiments_workflows/workflows.py
workflows.py
py
9,133
python
en
code
0
github-code
1
29069366892
#blibliotheque import json from datetime import datetime #variable liste_taches = [] tache = { "nom" :'', "deadline" : '', "statut" : '', } utilisateurs = {} #///////LOGIN//////// nom_utilisateur = input("Entrez votre nom s'il vous plait :") if nom_utilisateur in ut...
DTC-Formation/test-1-3-Woutnak
tp.py
tp.py
py
2,680
python
fr
code
0
github-code
1
9463578883
def main(): f = open("input.txt", "r") trees = [] for x in f: trees.append([int(tree) for tree in x.strip()]) visible = getVisible(trees) print(visible) def getVisible(trees): visible = 0 for i, row in enumerate(trees): for j, tree in enumerate(row): if i == 0 o...
anthonydinino/advent-of-code-2022
day8/part1.py
part1.py
py
1,421
python
en
code
0
github-code
1
7272065384
''' Description: test Author: Hejun Xie Date: 2022-04-07 19:12:11 LastEditors: Hejun Xie LastEditTime: 2022-05-20 16:31:11 ''' import glob import numpy as np from innoRad import innoRad import pickle if __name__ == '__main__': innotbs_mwi_scatt = [] innotbs_mwi_direct = [] # DA_DIRS = glob.glob('./2019...
Usami-Renko/observation-error-cloud-precipiation
test_innoRad.py
test_innoRad.py
py
3,394
python
en
code
0
github-code
1
29018358936
""" Sensors - Publishes configuration data on DBus - Intercept "Din", "Dout", "Ain" DBus signals, perform a look-up in the configuration data, map the result to "/Sensors/State/Changed" @author: jldupont Created on 2010-02-24 """ __all__=[] from system.mbus import Bus """ s...
jldupont/phidgets-dbus
src/phidgetsdbus/phidget/sensors.py
sensors.py
py
2,601
python
en
code
1
github-code
1
71940530913
# -*- coding: utf-8 -*- """Tests for the LifeScan OneTouch Ultra 2 driver.""" __author__ = 'Diego Elio Pettenò' __email__ = 'flameeyes@flameeyes.eu' __copyright__ = 'Copyright © 2013, Diego Elio Pettenò' __license__ = 'MIT' import os import sys import unittest import mock sys.path.append(os.path.dirname(os.path.dir...
hrishioa/Juventas
Code/glucometerutils/test/test_otultra2.py
test_otultra2.py
py
2,392
python
en
code
3
github-code
1
1585935309
from typing import Optional, List from highcharts_core.options.series.base import SeriesBase from highcharts_core.options.series.data.treegraph import TreegraphData from highcharts_core.options.plot_options.treegraph import TreegraphOptions from highcharts_core.utility_functions import mro__to_untrimmed_dict class T...
highcharts-for-python/highcharts-core
highcharts_core/options/series/treegraph.py
treegraph.py
py
6,249
python
en
code
40
github-code
1
20495855214
import torch from typing import Tuple def precompute_freqs_cis(dim: int, end: int, theta: float) -> torch.Tensor: freqs = 1.0 / (theta ** (torch.arange(0, dim, 2)[: (dim // 2)].float() / dim)) t = torch.arange(end, device=freqs.device) # type: ignore freqs = torch.outer(t, freqs).float() # type: ignore ...
mistralai/mistral-src
mistral/rope.py
rope.py
py
882
python
en
code
4,296
github-code
1
31726207265
# -*- coding: utf-8 -*- # @Time : 2021/11/25 20:35 # @Author : Meng Jianing # @FileName: request.py # @Software: PyCharm # @Versions: v0.1 # @Github :https://github.com/NekoSilverFox # -------------------------------------------- class Request: """请求""" num_request = 0 # 累计生成请求的数量 num_cancel_request...
NekoSilverFox/CMO
model/request.py
request.py
py
1,459
python
zh
code
0
github-code
1
71546539875
class Node: def __init__(self,key,value) : self.key = key self.value = value self.next = None class Seperatechaining : def __init__(self,capacity) : self.capacity =capacity self.size = 0 self.table = [None] * capacity def hashh(self,key) : capacity =...
ssijup/DSA-2
collosionhandlingusingseperatechaining.py
collosionhandlingusingseperatechaining.py
py
2,173
python
en
code
0
github-code
1
44610024134
import random class Maze: def __init__(self, width, height): self.width = width // 2 * 2 + 1 self.height = height // 2 * 2 + 1 self.cells = [ [True for x in range(self.width)] for y in range(self.height) ] def set_path(self, x, y): self.cells[y][x] = False...
endersonmenezes/hackathon-minotauro
pydata/models/maze.py
maze.py
py
1,184
python
en
code
0
github-code
1
24881402559
import queue import shlex import ssl import subprocess import sys import time from abc import ABC, abstractmethod from shutil import copyfileobj from threading import Thread from typing import Tuple, Union from urllib.error import URLError from urllib.request import urlopen from downloader.constants import K_DOWNLOADE...
theypsilon-test/downloader
src/downloader/file_downloader.py
file_downloader.py
py
25,141
python
en
code
0
github-code
1
24881547819
from pathlib import Path from downloader.config import default_config, UpdateLinuxEnvironment from downloader.constants import K_DATABASES, K_DB_URL, K_SECTION, K_VERBOSE, K_CONFIG_PATH, K_USER_DEFINED_OPTIONS, \ K_COMMIT, K_UPDATE_LINUX_ENVIRONMENT, K_FAIL_ON_FILE_ERROR, K_UPDATE_LINUX from downloader.full_run_se...
theypsilon-test/downloader
src/test/fake_full_run_service.py
fake_full_run_service.py
py
5,295
python
en
code
0
github-code
1
16631062446
# -*- coding: utf-8 -*- """ @author: ali_shehzad """ """Finger exercise 13: Implement a function that meets the specification below. Use a try-except block.""" def sumDigits(s): """Assumes s is a string Returns the sum of the decimal digits in s For example is s is 'a2b3c' it r...
alishehzad2017/MIT6.00.1x---Introduction-to-Computer-Science-and-Programming-using-Python
Week4- Good Programming Practices/Lecture8- Exceptions and Assertions/Summing Digits in a String.py
Summing Digits in a String.py
py
521
python
en
code
39
github-code
1
22273310545
import urllib.request import json import os import ssl from decouple import config def allowSelfSignedHttps(allowed): # bypass the server certificate verification on client side if ( allowed and not os.environ.get("PYTHONHTTPSVERIFY", "") and getattr(ssl, "_create_unverified_context", ...
dhrumilpatel30/MachineLearingDemo
mlapp/mlconfigration.py
mlconfigration.py
py
1,901
python
en
code
1
github-code
1
32838489808
from enum import Enum users = [] class Account(Enum): USD = "USD" KZT = "KZT" RUB = "RUB" EUR = "EUR" class BankAccount: name: str surname: str amount: int = 0 account: Account = 'KZT' def __init__(self, name:str, surname:str, account:Account) -> None: self...
akmaral0519/lab3
task1.py
task1.py
py
5,153
python
en
code
0
github-code
1
22963801181
from __future__ import unicode_literals import unittest import os import dxfgrabber filename = os.path.join(os.path.dirname(__file__), "assure_3d_coords.dxf") DWG = dxfgrabber.readfile(filename, {"assure_3d_coords": True}) pcoords = [(1., 1., 0.), (-3., 2., 0.), (7., -1., 0.), (10., 10., 0.)] class TestAssure3dC...
mozman/dxfgrabber
tests/test_assure_3d_coords.py
test_assure_3d_coords.py
py
1,159
python
en
code
63
github-code
1
32973108172
import numpy as np import matplotlib.pyplot as plt import ipywidgets as wd import pandas as pd from IPython.display import display, update_display, Javascript, HTML from inspect import signature from graphviz import Digraph import scipy.stats as sp import plotly.express as px import plotly.graph_objects as go import wa...
sensesensibilityscience/datascience
old/causality_simulation2.py
causality_simulation2.py
py
45,718
python
en
code
2
github-code
1
22545016509
import pygame from levels import * from constants import * from player import Player from sounds import Sound class Game: def __init__(self): pygame.init() self.background_sound = Sound() pygame.key.set_repeat(50, 50) size = [SCREEN_WIDTH, SCREEN_HEIGHT] self.screen = pyg...
gustavooquinteiro/mathgame
mathgame/game.py
game.py
py
10,259
python
en
code
0
github-code
1
9980427418
from helpers import * import cv2 import tensorflow as tf import json import sys # Checking for incorrect usage if len(sys.argv) != 2: print("Usage: python main.py path_to_image") exit(-1) image_file = sys.argv[1] # These are set to the default names from exported models, update as needed. INPUT_T...
AdvaitTahilyani/plant-health-classifier
main.py
main.py
py
6,144
python
en
code
0
github-code
1
17713082668
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 19 11:54:08 2020 @author: dohertyguirand """ from bert import Ner import urllib.request import io import PyPDF2 as p2 import sys sys.stdout = open('ex13', 'w') url = 'https://pdf.usaid.gov/pdf_docs/PA00WPD5.pdf' open = urllib.request.urlopen(ur...
yoditgetahun/decevals
decevals/findingtitles.py
findingtitles.py
py
1,688
python
en
code
0
github-code
1
16991129528
import dash_bootstrap_components as dbc import pandas as pd import plotly.express as px from dash import html, dcc import plotly.io as pio pio.templates.default = "simple_white" class FastViewCo2(object): def __init__(self, data): self.df_co2 = data Un_Kt = 1000 co2_country = data.groupby(...
apinzonf/ds4a-carbon-market-project
app/fast_view_co2.py
fast_view_co2.py
py
6,124
python
en
code
0
github-code
1
70126169955
class TLRuleFrench0001 (TLRuleAbstract): profile = 1 def createTitleDescription(self): self.title="An non-breakable space before [;], [:], [!], [?], and closing "+\ "guillemets." self.description= \ "Put an non-breakable space [⎵] before some ponctuation : [;], [:], "+\ "[!], [?] or [%s]. The exepctions ...
grumpfou/AthenaWriter
TextLanguages/languages/French.py
French.py
py
6,418
python
en
code
0
github-code
1
71864036835
from django.forms import ModelForm from django.http import HttpResponse, HttpResponseNotFound, HttpResponseGone from django.shortcuts import render, redirect, get_object_or_404 import datetime from app.models import Book class BookForm(ModelForm): class Meta: model = Book fields = ['name', 'pages...
AshtonIzmev/crud-datatables-django
app/views.py
views.py
py
1,879
python
en
code
1
github-code
1
3196976313
class Solution(object): def largestNumber(self, cost, target): """ :type cost: List[int] :type target: int :rtype: str """ res = self.dfs(cost, target, {}) return str(res) if res > 0 else '0' def dfs(self, cost, t, dp): if t == 0: retu...
niufenjujuexianhua/Leetcode
form-largest-integer-with-digits-that-add-up-to-target/form-largest-integer-with-digits-that-add-up-to-target.py
form-largest-integer-with-digits-that-add-up-to-target.py
py
613
python
en
code
0
github-code
1
25076669833
class Solution: def vowelStrings(self, words: List[str], queries: List[List[int]]) -> List[int]: n = len(words) vowels = {'a', 'e', 'i', 'o', 'u'} pre = [0 for _ in range(n)] if words[0][0] in vowels and words[0][-1] in vowels: pre[0] = 1 for i in range(1, n): ...
sanial2001/prefix-sum
count vowel string in ranges.py
count vowel string in ranges.py
py
674
python
en
code
0
github-code
1
70862066275
from .models import Comment, Post from django import forms from django.utils.text import slugify from PIL import Image import io class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ('body', 'image') widgets = { 'image': forms.FileInput(attrs={'class': 'btn,...
lukaszglowacz/norton-innovation-platform
blog/forms.py
forms.py
py
2,244
python
en
code
0
github-code
1
40147521188
# -*- coding: utf-8 -* # author: unknowwhite@outlook.com # wechat: Ben_Xiaobai # from os import add_dll_directory import sys # from threading import Event # from traceback import print_exception sys.path.append("./") sys.setrecursionlimit(10000000) from configs import admin,kafka import time from component.public_func...
white-shiro-bai/ghost_sa
component/access_control.py
access_control.py
py
10,985
python
en
code
256
github-code
1
19457690233
import random, copy from space_objects import Bullet, RocketBaseAction, Asteroid,Rocket, AsteroidSize from constants import * import pygame import time import math from dto import collides, Space_object_DTO, copy_object from enum import Enum import tensorflow as tf import numpy as np class Agent(): def __init__(...
PremekBasta/Asteroids
agents.py
agents.py
py
72,666
python
en
code
0
github-code
1
4454586278
import json from django.test import TestCase from wagtail.models import Site from ..models import GeneralPage class TestGeneral(TestCase): def setUp(self): root = Site.objects.get().root_page self.general_page = GeneralPage( title="General page", teaser_text="test", ...
nationalarchives/ds-wagtail
etna/generic_pages/tests/test_models.py
test_models.py
py
802
python
en
code
8
github-code
1
20186012943
def triangle(x): for i in range(x,0,-1): for y in range(0,i): print('*', end=' ') print() triangle(5) def top_right_triangle_while(age_length): x = age_length while x > 0: y = 0 while y < x: print('*', end=' ') y += 1 print() ...
karlosgevorgyan/python_homework
python/Homework/Triangles.py
Triangles.py
py
1,401
python
en
code
0
github-code
1
32156093476
import torch def xform_transpose(xform): s = list(range(len(xform.shape))) s[-1], s[-2] = s[-2], s[-1] return xform.permute(*s) def xform_fk_vel(lxform, lpos, lvrt, lvel, parents): gr, gp, gt, gv = [lxform[..., :1, :, :]], [lpos[..., :1, :]], [lvrt[..., :1, :]], [lvel[..., :1, :]] for...
ubisoft/ubisoft-laforge-ZeroEGGS
ZEGGS/anim/txform.py
txform.py
py
1,378
python
en
code
331
github-code
1
18484741445
'''8. Nota para frequência. Existem algumas diferenças entre as escolas latina e anglo-saxônica de música. A mais conhecida é a diferença no nome das notas musicais. Na escola latina temos Dó, Ré, Mi, Fá, Sol, Lá e Si. Os nomes correspondentes na escola anglo-saxônica são C, D, E, F, G, A e B (do dó ao si, respectivame...
fabiomigueldp/Algoritmos_Lista3
FMDP-03-Ex08.py
FMDP-03-Ex08.py
py
3,609
python
pt
code
0
github-code
1
6095050503
''' created on 09 June 2019 @author: Gergely ''' import random def run_game(env, policy, display=True, should_return=True): env.reset() episode = [] done = False while not done: s = env.env.s if display: env.render() timestep = [s] action = po...
imimali/ReinforcementLearningHeroes
td/sarsa.py
sarsa.py
py
2,768
python
en
code
0
github-code
1
15685597208
import math x = eval(input("输入一个数:")) y = 1.0 n = 0 while abs(pow(y, 2) - x) >= 1e-8: y = (y + x / y) / 2 n += 1 print("一共迭代了{}次".format(n)) print("通过牛顿迭代法{}的算数平方根为:{}".format(x, y)) print("通过平方根函数计算结果为:{}".format(math.sqrt(x)))
MsSusai/Python_Practice
Python_Practice/书本练习杂项/16_牛顿迭代法.py
16_牛顿迭代法.py
py
318
python
ja
code
1
github-code
1
73116282595
class Solution: def addBinary(self, a: str, b: str) -> str: a_pos, b_pos = len(a) - 1, len(b) - 1 carry = 0 res = "" while a_pos >= 0 or b_pos >= 0: op1 = int(a) if a_pos >= 0 else 0 op2 = int(b) if b_pos >= 0 else 0 tmp = (op1 + op2 + carry) ...
eliteGoblin/sky_ladder
sessions/chatgpt_simple_top_50/67.py
67.py
py
504
python
en
code
0
github-code
1
39332262964
import os import webbrowser import shapely from folium import Map, Marker, CircleMarker from folium.plugins import MarkerCluster from folium.features import PolygonMarker from utility_functions import get_state_contours, get_state_fullname class SpatialPlotter: ''' A class helps visualize commonly used spatial...
HaigangLiu/spatial-temporal-py
visualize_spatial_info.py
visualize_spatial_info.py
py
6,009
python
en
code
0
github-code
1
39308886865
import os import re import sys import urllib import urllib.request """Logpuzzle exercise Given an apache logfile, find the puzzle urls and download the images. Here's what a puzzle url looks like: 10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jpg HTTP/1.0" 302 528 "-" "Mozilla/5.0 (Windows...
scottszy/google-python-exercises
logpuzzle/logpuzzle.py
logpuzzle.py
py
3,235
python
en
code
0
github-code
1
20169614876
import logging import sqlite3 import __init__ # noqa pylint: disable=W0611 from time import sleep logger = logging.getLogger(__name__) class Inventory: def __init__(self): # noqa logger.info("Connecting to database") self.connection = sqlite3.connect("products.db") self.connection.set_...
logistic-bot/product
main.py
main.py
py
6,962
python
en
code
0
github-code
1
28957556961
from django.urls import path from .views import PostList, PostSearch, CreatePost, EditPost, UserPostDetail, DeletePost urlpatterns = [ path('posts/', PostList.as_view()), path('search/', PostSearch.as_view()), path('user/create/', CreatePost.as_view(), name="create_post"), path('user/edit/posts/<int:pk>...
prakash472/DjangoRestFrameworkBasics
blogs/urls.py
urls.py
py
468
python
en
code
0
github-code
1
5169114836
#(Sum the digits in an integer using recursion) Write a recursive function that computes #the sum of the digits in an integer. def sumDigits(n): sum = 0 if n!= 0: ext = n%10 sum = sumDigits(n//10) + ext return sum else: return 0 def main(): num = eval(input("enter a num...
manu-raghuvanshi/solutions_intro_to_python_liang
Ch15Q01.py
Ch15Q01.py
py
405
python
en
code
1
github-code
1
22895278898
# This is a sample Python script. import yfinance as yf import pandas as pd import numpy as np import math as math def get_stock_info(name): # Use a breakpoint in the code line below to debug your script. stock = yf.Ticker(name) return stock.history(period="1y") def get_change(current, previous): if c...
DIGVIJAYMALI/initStockPro
main.py
main.py
py
13,911
python
en
code
0
github-code
1
14191657465
# -*- coding: utf-8 -*- from numpy.testing import assert_array_almost_equal from pmdarima.preprocessing import LogEndogTransformer from pmdarima.preprocessing import BoxCoxEndogTransformer def test_same(): y = [1, 2, 3] trans = BoxCoxEndogTransformer(lmbda=0) log_trans = LogEndogTransformer()...
jose-dom/bitcoin_forecasting
env/lib/python3.9/site-packages/pmdarima/preprocessing/endog/tests/test_log.py
test_log.py
py
658
python
en
code
10
github-code
1
39895078211
import numpy as np size = int(input("Enter size (single number): ")) arr = np.ones((size, size)) arr[1:-1, 1:-1] = 0 print(arr) arr2 = np.zeros((size, size)) arr2[[0, -1], :] = 1 arr2[:, [0, -1]] = 1 print(arr2)
jansowa/numpy-exercises
arrays/ex8.py
ex8.py
py
225
python
en
code
0
github-code
1
38592569457
import sys import os from urllib.request import urlretrieve from zipfile import ZipFile if not os.path.isdir('../data'): os.mkdir('../data') def reporthook(blocknum, blocksize, totalsize): bytesread = blocknum * blocksize if totalsize > 0: percent = bytesread * 1e2 / totalsize s = "\r%5.1f...
hoffstadt/pilotlight
scripts/download_assets.py
download_assets.py
py
1,329
python
en
code
67
github-code
1
22711304236
'''@file decoder_factory.py contains the decoder factory''' from nabu.neuralnetworks.decoders import ctc_decoder from nabu.neuralnetworks.decoders import beam_search_decoder from nabu.neuralnetworks.decoders import attention_visualizer from nabu.neuralnetworks.decoders import lm_confidence_decoder def factory(conf, ...
JeroenBosmans/nabu
nabu/neuralnetworks/decoders/decoder_factory.py
decoder_factory.py
py
1,575
python
en
code
0
github-code
1
20046232564
from io import BytesIO import multiprocessing import streamlit as st from XOR_file_enc_threading import XOR_encryption, XOR_decryption # streamlit run app.py 2>NUL st.title('XOR Cipher') st.header('FILE ENCRYPTION USING XOR CIPHER') st.write(""" File encryption using the XOR cipher is a method of securing the conten...
githubgithub101/project
app.py
app.py
py
3,488
python
en
code
0
github-code
1
25735493789
def to_decimal(num): return_value = 0 for n, value in enumerate(list(map(int, num))[::-1]): return_value += value * (3 ** n) return return_value def in_triple(now_location, triple_num): if now_location == len(triple_num): return # 현재 위치가 틀렸다고 가정 # 현재 위치에 올 수 있는 숫...
KSoonYo/SW_Expert_Arcademy_problem
4366_은행업무/s1.py
s1.py
py
1,769
python
ko
code
0
github-code
1
71108423073
def rotate_matrix(x): lenx = len(x) resultd = [] for i in range(lenx): d = [] for j in range(lenx): d.append(0) resultd.append(d) for i in range(lenx): for j in range(lenx): resultd[j][i] = x[i][j] return resultd for i in range(10): N = in...
bcking92/TIL
01_Algorithm/Week7/서울1반8월16일김병철/1215.py
1215.py
py
735
python
en
code
0
github-code
1
4691161197
import os import sys import subprocess from setuptools import find_packages, setup from setuptools.command.build_py import build_py class Build(build_py): def run(self): make_runsolver = ["make", "runsolver"] runsolver_dir = os.path.join( os.path.dirname(__file__), "runsolver", "runso...
rkkautsar/runsolver-py
setup.py
setup.py
py
690
python
en
code
0
github-code
1
12836997597
#!/usr/bin/env python import sys import os import django import pytz from datetime import datetime print("I am alive!.") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pim.settings") django.setup() from web.models import ProductData #Some mappings for readability EanCode=0 ProductDescription=1 NutritionDescript...
hackcasa/zappa_final
import_coreproductdata.py
import_coreproductdata.py
py
1,623
python
en
code
1
github-code
1
16557603845
# https://www.acmicpc.net/problem/3052 # Solved Date: 20.04.05. import sys read = sys.stdin.readline NUM = 10 MOD = 42 def main(): # set을 쓰거나 in연산자와 list를 사용할 수 있다. remainder = set() for _ in range(NUM): remainder.add(int(read().strip()) % MOD) print(len(remainder)) if __name__ == '__main_...
imn00133/algorithm
BaekJoonOnlineJudge/SolvedACClass/Class1/baekjoon_3052.py
baekjoon_3052.py
py
365
python
en
code
0
github-code
1
10004379077
""" Cedric Pereira, Steven Hurkett, Zack Bowles-Lapointe December 6 2023 Weather App - User Interaction """ import sqlite3 import json from datetime import datetime from scrape_weather import WeatherScraper from db_operations import DBOperations from plot_operations import PlotOperations class WeatherProcessor: "...
Steeeeeeeve/PythonWeather
weather_processor.py
weather_processor.py
py
7,254
python
en
code
0
github-code
1
6422286310
def h(n): return (2*n + 3 ) % 9 def ingresar(A, k): i = h(k) j= 0 if A[i][j] == -1: A[i][j] = k else: A[i].append(k) return (A) def BUSCAR_HASH (A,k): i = h(k) esta = False for s in (A[i]): if (k == s): esta = True if esta: print("el...
patrickmurphym/EDA
Estructura de Datos y Algoritmos/04 Abril 12/Actividad en Clase.py
Actividad en Clase.py
py
607
python
pt
code
0
github-code
1
26399582069
from translate import Translator translator= Translator(to_lang="pt") try: with open('C:/Users/LENOVO/Desktop/Translator/tarans.txt',mode = 'r') as my_file: text= my_file.read() translation = translator.translate(text) print(translation) with open('C:/Users/LENOVO/Desktop/Translator/tarans-ja.txt',mode='w' ) a...
sonalambadesonal/background-genrator
transscript.py
transscript.py
py
428
python
en
code
0
github-code
1
10995923935
""" 给定四个包含整数的数组列表 A , B , C , D ,计算有多少个元组 (i, j, k, l) ,使得 A[i] + B[j] + C[k] + D[l] = 0。 为了使问题简单化,所有的 A, B, C, D 具有相同的长度 N,且 0 ≤ N ≤ 500 。所有整数的范围在 -2^28 到 2^28 - 1 之间,最终结果不会超过 2^31 - 1 。 例如: 输入: A = [ 1, 2] B = [-2,-1] C = [-1, 2] D = [ 0, 2] 输出: 2 解释: 两个元组如下: 1. (0, 0, 0, 1) -> A[0] + B[0] + C[0] + D[1] = 1 + (-...
bendanwwww/myleetcode
code/lc454.py
lc454.py
py
1,471
python
en
code
1
github-code
1
72920705315
from django.conf import settings from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin from django.http.response import HttpResponseRedirect from django.urls.base import reverse from django.views.generic.edit import ProcessFormView from edc_appointment.models.appointment import A...
botswana-harvard/edc-subject-dashboard
edc_subject_dashboard/views/requisition_print_actions_view.py
requisition_print_actions_view.py
py
6,976
python
en
code
0
github-code
1
25431182159
from collections import deque import sys input = sys.stdin.readline dx = [0,1,-1,0] dy = [1,0,0,-1] def bfs(hx, hy, ex, ey): queue = deque() queue.append([hx,hy,0]) visited = [[[-1]*m for _ in range(n)] for __ in range(2)] visited[0][hy][hx] = 0 while queue: x,y,use = queu...
reddevilmidzy/baekjoonsolve
백준/Gold/14923. 미로 탈출/미로 탈출.py
미로 탈출.py
py
1,231
python
en
code
3
github-code
1
28426222784
import cv2 import numpy as np import time import imutils from pyimagesearch.panorama import Stitcher left =cv2.VideoCapture("http://192.168.43.1:8080/video") right =cv2.VideoCapture("http://192.168.43.180:8080/video") while True: start = time.time() left_check, left_frame = left.read() right_check, right_f...
prince001996/Vision
feed and stitch.py
feed and stitch.py
py
1,076
python
en
code
0
github-code
1
13417303225
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed May 8 20:32:44 2019 @author: kamini """ import sys import wave import matplotlib.pyplot as plt import numpy as np import struct import scipy import scipy.io.wavfile as wav from scipy import signal import pdb def melFilter(Fs,Nfft): flow=0 fhi...
sujoyrc/multimodal_raga_analysis
Code/Kamini_Code/energyContoursfunc.py
energyContoursfunc.py
py
13,877
python
en
code
0
github-code
1
38681288341
import numpy as np import sklearn.metrics import matplotlib.pyplot as plt import tqdm def prcurve_from_similarity_matrix(GT_MAP, SIM_MAP, nintervals, visualize = False): GTP = np.sum(GT_MAP) alt_GTP = np.sum(np.sum(GT_MAP,axis=1) > 0) precisions = [] recalls = [] alt_precisions = [] alt_recall...
ivano-donadi/sdpr
lib/utils/eval_utils.py
eval_utils.py
py
5,345
python
en
code
0
github-code
1
21046525109
from src.api_classes import HeadHunterAPI, SuperJobAPI from src.json_class import WorkFile def job_selection(): vacancy = input(f'Выберите нужную вакансию: ').lower() return vacancy def data_search(vacancy): """Загрузка информации с сайтов для поиска работы """ user_input = input(f'Выберите нужный ...
mariabuzina3000/job_parser
main.py
main.py
py
3,088
python
ru
code
0
github-code
1
21620611456
# -*- coding: utf-8 -*- import scrapy from power_market.items import CurrentItem from power_market.items import PdfItem class EvnSpider(scrapy.Spider): name = 'EVN' allowed_domains = ['en.evn.com.vn'] start_urls = ['https://en.evn.com.vn/c3/gioi-thieu-l/Annual-Report-6-13.aspx'] base_url = "https://en...
realAYAYA/power_market
power_market/spiders/EVN.py
EVN.py
py
2,139
python
en
code
0
github-code
1
8550810852
import os import launch import launch_ros from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription, TimerAction from launch.launch_description_sources import PythonLaunchDescriptio...
JinkaiQiu/Poop-Detection-ROS-robot-src
CRAP_navigation/launch/gazebo_commander.launch.py
gazebo_commander.launch.py
py
2,162
python
en
code
1
github-code
1
2340154996
from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) tasks = [] class Task: def __init__(self, description): self.description = description self.completed = False @app.route('/') def index(): return render_template('index.html', tasks=tasks)...
Thymester/Todo-Site
app.py
app.py
py
1,030
python
en
code
0
github-code
1
23620492131
import SuperClass as sc import tkinter as tk from PIL import Image,ImageTk class Entity(sc.SpaceInvader): def __init__(self): sc.SpaceInvader.__init__(self) self.canvas.bind("<Configure>", self.update) self.vie = 1 self.sprite = Image.open("media/image/male_sprite_model.png") ...
12dorian12/projet_Space_Invader
Entity.py
Entity.py
py
2,295
python
en
code
0
github-code
1
33382878650
# This code is based on the following example: # https://discordpy.readthedocs.io/en/stable/quickstart.html#a-minimal-bot import discord from discord.ext import commands import os import spotipy from spotipy.oauth2 import SpotifyClientCredentials client_id = os.getenv('SPOTIPY_CLIENT_ID') client_secret = os.getenv('S...
jjneutron/BAST.bot
main.py
main.py
py
1,699
python
en
code
0
github-code
1
17626284356
import os import pandas as pd import numpy as np import pickle import json from uuid import uuid4 from time import time from importlib import import_module from sklearn.pipeline import Pipeline from sklearn.model_selection import GridSearchCV from sklearn.metrics import make_scorer from params import Params # input f...
MurreyCode/completion_rate_case_study
pipeline/src/search_n_train.py
search_n_train.py
py
3,720
python
en
code
0
github-code
1
36666876289
# -*- coding: utf-8 -*- action = 'action' code = 'code' comment = 'comment' duration = 'duration' indexProfit = 'indexProfit' indexCost = 'indexCost' j = 'j' lastBuy = 'lastBuy' lastSell = 'lastSell' name = 'name' previousChange = 'previousChange' price = 'price' profit = 'profit' position = 'position' regression = '...
cosmosdreamer/tapestar
stock/keys.py
keys.py
py
447
python
en
code
0
github-code
1
22418667308
from enum import Enum class InsertType(Enum): """Type of inserted in google suite.""" TEXT = "text" TABLE = "table" GRAPH = "graph" IMAGE = "image" class ScopeType(Enum): """Type of scopes for google suite. PRESENTATION_EDITABLE: Allows read/write access to the user's presentations and...
ktro2828/py2gsuite
py2gsuite/utils/types.py
types.py
py
2,031
python
en
code
1
github-code
1
14266536126
import numpy as np from sklearn.metrics.pairwise import cosine_similarity def calculate_hit_rate(left_out_dict, user_ids_lst, top_20_recommended_ids): ''' Claculate hit rate for top 20 using left-one-out set ''' hit_rate = 0 total_users = len(user_ids_lst) for user, ids_lst in zip(user_id...
ShalyginaA/30Music-artist-recommendation
utils/CF_recommender_utils.py
CF_recommender_utils.py
py
2,547
python
en
code
1
github-code
1
28164614904
import math r=int(input('Coloque o valor do raio da circuferencia: ')) while r>1000: r=int(input('Valor muito alto. coloque um valor menor:')) else: d=2*r diametro=d round(diametro, 2) p=2*r*math.pi perimetro=p round(perimetro, 2) print('Utilizando o raio {}, você obterar o diamet...
Mikael-Kobama/Projeto_TestePython
Python_Learn/Testing_Projects/Formula_Diametro00.py
Formula_Diametro00.py
py
491
python
pt
code
0
github-code
1
26844513548
import itertools import string # lstrip, replace import pymongo import re from util import store from util import fetch from util import gather from util import text FEATURED_SUFFIX = '_featured' STARRED_SUFFIX = '_starred' def get_all_featured(stream_root): hashtags = get_hashtags(stream_root) # return [ge...
marklar/massiu
util/featured.py
featured.py
py
1,972
python
en
code
0
github-code
1
15623826738
from rest_framework import serializers from books.models import Book, Book_Review from users.models import CustomUser class CustomUserModelSerializer(serializers.ModelSerializer): class Meta: model = CustomUser fields = ('username', 'first_name', 'last_name', 'email') class BookModelSeria...
ubaydulloh1/goodreads
api/serializers.py
serializers.py
py
897
python
en
code
1
github-code
1
30576627522
import pygame class Obstacle: def __init__(self,x,y,width,height): self.x = x self.y = y self.width = width self.height = height def collision(self,dot): #Assume a class called dot with positions x and y if (dot.pos.x > self.x) and (dot.pos.x < self.x + self.width) and (dot.pos.y > self.y) and (dot.pos....
MoMus2000/Genetic-Algorithm
Obstacles.py
Obstacles.py
py
624
python
en
code
0
github-code
1
36082116020
# Use the get() method to retrieve the value associated with the key "salary" from a dictionary employee without raising an error. # Create a dictionary inventory with items and quantities. Use the update() method to add new items and quantities to the dictionary. employee = { 'salary' : 2000 } print(employee.g...
Arsalanahmed7999/Problem-Solving
Dict/day9.py
day9.py
py
472
python
en
code
0
github-code
1
38762448159
import os Import("env") srcfile = os.path.join(env.subst('$BUILD_DIR'), 'firmware.bin') dstfile = os.path.join(env.subst('$PROJECTBUILD_DIR'), 'firmware_%s.bin' % env['PIOENV']) # create a target action for copying output binary copy_action = env.Alias('copy', 'buildprog', Copy(dstfile, srcfil...
openscopeproject/HP34401a-OLED-FW
pio_post_script.py
pio_post_script.py
py
456
python
en
code
43
github-code
1
31992094934
import re from typing import Optional, Tuple, Union from snake.utils import format_number def get_episode_tag(number: Union[int, str], leading_zeroes: int = 2) -> str: return f"E{format_number(number, leading_zeroes=leading_zeroes)}" def extract_episode_tag(filename: str, return_as_upper: bool = True) -> Tuple...
ajutras/plexsnake
snake/utils/tv.py
tv.py
py
1,213
python
en
code
0
github-code
1
18484736065
'''6. Classifique o triângulo. Baseado nos comprimentos dos seus lados, um triângulo pode ser classificado como equilátero (quando os três lados tem o mesmo tamanho), isósceles (quando apenas dois lados são iguais) ou escaleno (quando os três lados são diferentes). Escreva um programa Python que recebe do usuário os co...
fabiomigueldp/Algoritmos_Lista3
FMDP-03-Ex06.py
FMDP-03-Ex06.py
py
1,403
python
pt
code
0
github-code
1
8885931053
""" A module with auxiliary functions for working with all around numbers """ import itertools import math from collections import deque from pzeug.number.prime import sieve_of_eratosthenes def reverse(n): reversed_n = 0 while n > 0: reversed_n = 10 * reversed_n + (n % 10) n //= 10 retu...
inteldict/pzeug
number/number.py
number.py
py
4,389
python
en
code
1
github-code
1
14928155080
"""Some useful type aliases relevant to this project.""" import pathlib from typing import AbstractSet, Callable, List, Mapping, Optional, Tuple, Union import torch Layer = Union[int, str] Unit = Tuple[Layer, int] PathLike = Union[str, pathlib.Path] TensorPair = Tuple[torch.Tensor, torch.Tensor] TensorTriplet = Tup...
evandez/neuron-descriptions
src/utils/typing.py
typing.py
py
960
python
en
code
59
github-code
1
4062440867
# Smallest multiple # Problem 5 # 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. # What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? # https://projecteuler.net/problem=5 def GetDividers(n): m = n k = 2 ...
IgorKon/ProjectEuler
005.py
005.py
py
900
python
en
code
0
github-code
1
1401309942
import numpy as np from core.transforms_3D import rot_y_matrix, translation_matrix, transform class Box2D: # Modes CORNER_CORNER = 0 CORNER_DIM = 1 CENTER_DIM = 2 def __init__(self, values, mode, cls=None, confidence=None, text=None): self.cls = cls self.confidence =...
YahyaAlaaMassoud/Sensor-Fusion
core/boxes.py
boxes.py
py
4,664
python
en
code
1
github-code
1
35826985836
from django.urls import path from events.apps import EventsConfig from events import views app_name = EventsConfig.name urlpatterns = [ path('', views.EventListView.as_view(), name='list'), path('create/', views.EventCreateView.as_view(), name='create'), path('<int:pk>/', views.EventGetView.as_view(), na...
raymanzarek1984/tikoExercise
events/urls.py
urls.py
py
706
python
en
code
1
github-code
1
22941199712
import logging import os import time from concurrent.futures import ThreadPoolExecutor from dicomweb_client import DICOMwebClient from pydicom.dataset import Dataset from pydicom.filereader import dcmread from monailabel.utils.others.generic import md5_digest, run_command logger = logging.getLogger(__name__) def g...
Project-MONAI/MONAILabel
monailabel/datastore/utils/dicom.py
dicom.py
py
4,693
python
en
code
472
github-code
1
39011959286
# -*- coding: utf-8 -*- """ Created on Thr Jan 10 09:13:24 2018 @author: takata@innovotion.co.jp @author: harada@keigan.co.jp """ import argparse import sys import os import pathlib from time import sleep current_dir = pathlib.Path(__file__).resolve().parent sys.path.insert(0, str(current_dir) + '/../') # give 1st pr...
keigan-motor/pykeigan_motor
examples/usb-torque-control.py
usb-torque-control.py
py
3,090
python
en
code
10
github-code
1
23765967333
""" [删除字符串中的所有相邻重复项](https://leetcode-cn.com/problems/remove-all-adjacent-duplicates-in-string/) 利用栈数据结构,和单调栈有点异曲同工之妙 """ def removeDuplicates(S) -> str: stack = list() for s in S: if stack and stack[-1] == s: stack.pop() else: stack.append(s) return "".join(stack)
Flyraty/leetcode_200
algorithm/Stack/remove_all_adjacent_duplicates_in_string.py
remove_all_adjacent_duplicates_in_string.py
py
388
python
en
code
1
github-code
1
2020300464
from flask import request, jsonify, make_response, abort, Blueprint from app import db import uuid import copy import datetime from .helpers import remove_item_from_location, add_item_to_location, change_item_location, get_unassigned #Blueprints user_bp = Blueprint("user", __name__, url_prefix="/users") game_bp = Blue...
DeeJMWilliams/nodwick-back-end
app/routes.py
routes.py
py
12,154
python
en
code
0
github-code
1
2657548095
#!/usr/bin/env python3 import requests import spacy url = "https://query.wikidata.org/sparql" url_api = "https://www.wikidata.org/w/api.php" params_entity = {'action': 'wbsearchentities', 'language': 'en', 'format': 'json'} params_prop = {'action': 'wbsearchentities', 'language': 'en', 'format': 'json', 'type':...
Liya7979/LanguageTechnologyProject
Dueto.py
Dueto.py
py
2,700
python
en
code
0
github-code
1
29744661722
list = [] n = int(input("Enter number of elements : ")) for i in range(0, n): l = int(input()) list.append(l) print("INPUT",list) print("Output") for num in list: if num >= 0: print(num, end = " ")
UltraGoku/Positive-Number
list.py
list.py
py
239
python
en
code
0
github-code
1
19751365526
import csv from dataclasses import dataclass from typing import List # def load_sales(sales_path='./sales.csv'): # sales = [] # with open(sales_path, encoding='utf-8') as f: # for sale in csv.DictReader(f): # # 値の変換 # try: # sale['price'] = int(sale['price']) # ...
yoshikikasama/python
best_practice/code_implementation/unittest/case2/sales.py
sales.py
py
2,084
python
en
code
0
github-code
1
21003686863
import service.control from . import actions from .actions import ( create_index, delete_entities, search_v2, update_entities, track_recent, get_recents, delete_recent, ) class Server(service.control.Server): service_name = 'search' actions = { 'create_index': create_inde...
getcircle/services
search/server.py
server.py
py
646
python
en
code
0
github-code
1
25158830328
import os import json import time import h5py import logging import numpy as np from annoy import AnnoyIndex from tensorflow.keras import optimizers from tensorflow.keras.models import Model from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.vgg16 import VGG16 from tensorflow.keras.app...
SteveVu2212/Image-to-Image-Search
Code/Image_Search.py
Image_Search.py
py
5,742
python
en
code
0
github-code
1
72101922274
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 28 13:35:15 2022 @author: andres """ #El procesamiento de la información fue realizado en python y las estimaciiones en R #Librerias utilizadas para el preprocesamiento import pandas as pd import numpy as np from datetime import datetime, timede...
AOchoaArangoA/Public_Opinion
Preparacion_Datos_Grado.py
Preparacion_Datos_Grado.py
py
17,665
python
es
code
0
github-code
1
71015635875
# Self Number # https://www.acmicpc.net/problem/4673 from functools import reduce numbers = list(range(1, 10001)) def d(n): return n + reduce(lambda x, y: x + y, list(map(int, list(str(n))))) for i in numbers: if i != 0: next = d(i) # numbers.remove(1) while True: ...
yskang/AlgorithmPractice
baekjoon/python/selfNumber.py
selfNumber.py
py
487
python
en
code
1
github-code
1
19830801226
import serial import time import calendar connected = False ser = serial.Serial("COM3", 9600) ser.close() ser.open() while not connected: serin = ser.read() connected = True #ser.write("1") #while ser.read() == '1': # ser.read() while True: string = "T" + str(calendar.timegm(time.localtime())) + "\n" se...
IRQBreaker/arduino_info_display
sync.py
sync.py
py
368
python
en
code
0
github-code
1