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
72442425896
from openerp.tests import common from datetime import datetime as dt from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DTF import logging _logger = logging.getLogger(__name__) from faker import Faker fake = Faker() seed = fake.random_int(min=0, max=9999999) def next_seed(): global seed seed += 1 ...
LiberTang0/odoo-temp
nh_clinical/tests/test_operations.py
test_operations.py
py
9,492
python
en
code
0
github-code
90
43494488694
# coding: utf8 import hmac import hashlib import base64 import requests_async as requests # 签名校验方法 def check_sign(*args, **kwargs): # 从传入参数获取变量 config = kwargs.get('config') headers = kwargs.get('headers') # 生成签名 app_secret = config.get('APP_SECRET') timestamp = headers.get('Timestamp') ...
tm2018/chatbot
utils/utils_dd.py
utils_dd.py
py
1,579
python
en
code
7
github-code
90
18951063275
import os import csv csvpath = os.path.join("PyBank//Resources//budget_data.csv") with open(csvpath) as pybankfile: csvreader = csv.reader(pybankfile, delimiter=',') #List to store data Month=[] Average_Change=[] AverageX=[] header = next(csvreader) total_profit= 0 total_months= ...
opanopio/python-challenge
PyBank/main.py
main.py
py
1,381
python
en
code
1
github-code
90
42240526451
import scattertext as st import spacy from pprint import pprint from scattertext import SampleCorpora from scattertext.CorpusFromPandas import CorpusFromPandas from scattertext import produce_scattertext_explorer import pandas as pd import numpy as np import json import DataManager.collectionsDataManager as collections...
FoodSentimentObservatory/Foobs-interface
Analysis/testScatterText.py
testScatterText.py
py
2,719
python
en
code
0
github-code
90
8982926566
#Maximum def maximum(value1, value2, value3): max_value = value1 if value2 > max_value: max_value = value2 if value3 > max_value: max_value = value3 return max_value print('\n\nThe maximum value using the code provided to find the MAXIMUM of any 3 values =',maximum(12,27,36),'\n') print('The maximum v...
s542932/608-mod3
built-in-min-max.py
built-in-min-max.py
py
1,048
python
en
code
0
github-code
90
5735445586
# Empacotamento permite que vários parâmetros sejam passados por referência sem a necessidade de sobreescrita de função # Neste caso numeros é uma tupla def contador(* numeros): print(numeros) soma = 0 for valor in numeros: soma += valor print(soma) contador(1, 2, 3, 4, 5) contador(2, ...
wzoreck/exercicios_python
Funcoes/funcao2_empacotamento.py
funcao2_empacotamento.py
py
346
python
pt
code
0
github-code
90
32325000756
standard_ticketa = 0 kid_tickets = 0 student_tickets = 0 total_tickets = 0 movie_name = input() while movie_name != "Finish": hall_seats = int(input()) sold_tickects = 0 for free_tickets in range(hall_seats): type_of_ticket = input() if type_of_ticket == "End": # is_finish = True...
VelkovIv/Programing-Basic-July-2022-in-SoftUni
06.nested_loops_exercises/06.cinema_tickets.py
06.cinema_tickets.py
py
1,373
python
en
code
1
github-code
90
8379118491
import math with open("input.txt") as file: parts = file.readlines() times = parts[0].split(':')[1].split() times = [int(v) for v in times] times2 = parts[0].split(':')[1].replace(" ", "").split() times2 = [int(v) for v in times2] dists = parts[1].split(':')[1].split() dists = [int(v) for v in dists] dist2 = ...
Daroshi11260/competitive-programming
AOC/2023/day06/solution.py
solution.py
py
906
python
en
code
1
github-code
90
23240940693
from sys import stdin, stdout def solution(): sum: int = 0 nums: list = [0 for _ in range(1001)] for _ in range(10): n: int = int(stdin.readline().rstrip()) sum += n nums[n] += 1 stdout.write("%d\n" % (sum // 10)) stdout.write("%d\n" % (nums.index(max(nums)))) if __name_...
anothel/CodeKata
백준/Bronze/2592. 대표값/대표값.py
대표값.py
py
352
python
en
code
1
github-code
90
23651340471
"""module contenant les constantes.""" FUNCTION = {} in_functions_dict = lambda f: FUNCTION.setdefault(f.__name__, f) COLOR = {'RED': (237, 41, 57), 'ORANGE': (255, 121, 0), 'YELLOW': (254, 203, 0), 'GREEN': (105, 190, 40), 'CYAN': (0, 159, 218), 'BLUE': (0, ...
periergeia/Simulation-de-croissance-tumorale
module/constant.py
constant.py
py
1,048
python
en
code
0
github-code
90
32668131781
def reinit_env_for_stkbg(dynamic_env, agents): dynamic_env.re_init() dynamic_env.run_full_stackelberg() for agent_name, agt in agents.items(): dynamic_env.set_rl_agent(rl_agent=agt, agent_name=agent_name) dynamic_env.enable_discount() dynamic_env.enable_information() # donot update leade...
alibaba-damo-academy/ai-for-social-science
Stackelberg_Game/stackelberg_env_utils.py
stackelberg_env_utils.py
py
1,513
python
en
code
7
github-code
90
14012064418
from typing import Optional import torch from .core import Chunk, ChunkGroup, TensorBlock, TensorState from .scheduler import ChunkScheduler class ChunkFetcher(object): def __init__(self, scheduler: ChunkScheduler, group: ChunkGroup, overlap: bool = False, ...
hpcaitech/Elixir
elixir/chunk/fetcher.py
fetcher.py
py
6,678
python
en
code
8
github-code
90
74462136615
import os import sys from selenium import webdriver from webdriver_manager.firefox import GeckoDriverManager def size(name, width, height): return {"width": width, "height": height, "name": name} def capture_feature(driver, feature, size, capture_dir="./"): size_name = size["name"] feature_name = featur...
pdmnyberg/selenium-test
test.py
test.py
py
1,582
python
en
code
0
github-code
90
18217540629
import sys n = int(input()) si = [] for _ in range(n): s = input() l = 0 r = 0 count = 0 for i in range(len(s)): if s[i] == "(": count += 1 else: count = max(0, count-1) l = count count = 0 for i in range(len(s)-1, -1, -1): if s[i] == ")": ...
Aasthaengg/IBMdataset
Python_codes/p02686/s979938637.py
s979938637.py
py
1,410
python
en
code
0
github-code
90
31663311945
# 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 # 例如,给出 n = 3,生成结果为: # [ # "((()))", # "(()())", # "(())()", # "()(())", # "()()()" # ] #垃圾循环,在n-1上插入一个"()" class Solution: def generateParenthesis(self, n: int) -> List[str]: if n <= 0: return [] if n == 1: r...
wzwhit/leetcode
22括号生成.py
22括号生成.py
py
2,159
python
en
code
0
github-code
90
73825447978
from bs4 import BeautifulSoup from urllib.parse import quote import requests import re import pymysql def get_pages_from(url,data=None): #有多少页 wb_data = requests.get(url) soup = BeautifulSoup(wb_data.text, 'lxml') try: pages = int(soup.select('#num > span > b > font:nth-of-type(2)')[0].get_text...
shinianzhihou/tools
教务处信息/first.py
first.py
py
3,760
python
en
code
1
github-code
90
26311252977
import datetime import requests import OpenSSL.crypto as crypto crl_url = 'http://cdp.geotrust.com/GeoTrustRSACA2018.crl' response = requests.get(crl_url) crl_data = response.content # Parse the CRL file crl = crypto.load_crl(crypto.FILETYPE_ASN1, crl_data) # Check the validity of the CRL now = datetime.datetime.utc...
f0rkl1ft/chatgpt_code
check_crl_2/check_crl_2.py
check_crl_2.py
py
613
python
en
code
0
github-code
90
73820428457
class Solution: def canReorderDoubled(self, A: List[int]) -> bool: Cnter = collections.Counter(A) if 0 in Cnter and Cnter[0] % 2 == 1: return False while Cnter: min_num = min(Cnter, key=lambda x: abs(x)) nxt_num = 2 * min_num if nxt_num not in...
HarrrrryLi/LeetCode
954. Array of Doubled Pairs/Python 3/solution.py
solution.py
py
584
python
en
code
0
github-code
90
28221798493
class Node: def __init__(self, v): self.value = v self.left = None self.right = None def pastTraverse(self): if self.left != None: self.left.pastTraverse() if self.right != None: self.right.pastTraverse() print(self.value, end="") def ju...
HandsomeLuoyang/LuoGuProblems
P1087FBI树.py
P1087FBI树.py
py
998
python
en
code
0
github-code
90
40474151320
import argparse import itertools import math import os from pathlib import Path from typing import Optional import subprocess import sys import gc import torch import torch.nn.functional as F import torch.utils.checkpoint from torch.utils.data import Dataset from transformers import AutoTokenizer, PretrainedConfig imp...
recoilme/train
train_sdxl.py
train_sdxl.py
py
34,173
python
en
code
5
github-code
90
43576463681
#!/usr/bin/python import os import sys import logging # virtualenv activation if any #activate_this = '/home/envs/supaenv/bin/activate_this.py' #execfile(activate_this, dict(__file__=activate_this)) PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, PROJECT_ROOT) class ReverseProxied(object...
jhalcrow/floto
floto_wsgi.py
floto_wsgi.py
py
1,992
python
en
code
1
github-code
90
5034103486
import os import json import random import argparse import numpy as np from mturk_cores import MTurkManager, print_log from datetime import date from datetime import datetime import copy def load_frontend_setting(html_url): html_layout = open(html_url, 'r').read() QUESTION_XML = """<HTMLQuestion xmlns="http:/...
huashen218/LimitedInk
human_evaluation/mturk_experiment/human_study/step2_main_create_hit.py
step2_main_create_hit.py
py
4,310
python
en
code
3
github-code
90
23173077304
from datetime import datetime import time import github import re import traceback import os # region get Functions def getRepoInfo(data): git = github.Github(os.environ["GITFETCHER_GITHUB_TOKEN"]) repoAddress = data['text'].split(' ')[1] try: repo = git.get_repo(re.search("\.com\/(\S+)", repoAd...
Kwandes/GitFetcher
src/gitAPI.py
gitAPI.py
py
4,109
python
en
code
0
github-code
90
33376860621
from django.shortcuts import render, redirect, HttpResponse import shopify from django.contrib import messages from django.urls import reverse import binascii, os from django.apps import apps # Create your views here. def _new_session(shop_url): api_version = apps.get_app_config('shopify_app').SHOPIFY_API_VERSIO...
akhatri84/shopify_django_integration
shopifyapp/views.py
views.py
py
2,396
python
en
code
0
github-code
90
11388851885
import words def swap(list, left, right): temp = list[left] list[left] = list[right] list[right] = temp def partition(list, lidx, hidx): pivot = lidx i = lidx while i < hidx: if list[i] < list[hidx]: swap(list, i, pivot) pivot += 1 i += 1 swap(list,...
petervenables/sorting-py
quick_sort.py
quick_sort.py
py
718
python
en
code
0
github-code
90
21268509042
import tensorflow as tf import numpy as np from sklearn.model_selection import train_test_split from tqdm import tqdm #lib for cli progress bar from time import time from gc import collect from learning_curves import * #learning curves and graph functions #algorithm import from NaiveBayes import * #CONSTANTS _NUM_...
FaidonVerras/Machine-Learning-Bernoulli-Naive-Bayes
main.py
main.py
py
5,480
python
en
code
0
github-code
90
12198307701
import boto3 import csv from elasticsearch import helpers, Elasticsearch, RequestsHttpConnection import io from requests_aws4auth import AWS4Auth import yaml credentials = boto3.Session().get_credentials() s3 = boto3.client('s3') # read a configuration file with open("prod_config.yml", 'r') as stream: config...
OCLC-Developer-Network/serverless_scheduled_python
titleListImport.py
titleListImport.py
py
2,811
python
en
code
0
github-code
90
19012874095
class Solution: def __method1 (self, n): if (n == -1): return 0 if (n == 0): return 1 if (self.dp[n] != None): return self.dp[n] self.dp[n] = self.__method1(n - 1) + self.__method1(n - 2) return self.dp[n] def __method2 (self, n): self.dp[0], self.dp[1] = 1, 1 ...
Tejas07PSK/fraz-leetcode-hot-250
Dynamic Programming/climbing_stairs.py
climbing_stairs.py
py
812
python
en
code
1
github-code
90
42632730984
import cv2 import numpy as np from pathlib import Path import requests from efficientnet_pytorch import EfficientNet from torchvision import transforms from PIL import ImageFile from PIL import Image import requests from io import BytesIO import torch.nn.functional as nnf import torch.nn as nn import json import ast im...
creeper00/UROP_VBPR
testtopk.py
testtopk.py
py
3,886
python
en
code
2
github-code
90
42255670996
from .external import call_external_api def check_response_greater_than_0_5(): response = call_external_api() if "response_value" not in response: raise KeyError("Response 缺少 Key: response_value") elif response["response_value"] > 0.5: return True else: return False
MingLunWu/pytest_101
src/check_response.py
check_response.py
py
312
python
en
code
0
github-code
90
11106369525
""" A virtual proxy, which uses lazy initialization to defer the creation of a computationally expensive object until the moment it is actually needed """ class LazyProperty: def __init__(self, method): self.method = method self.method_name = method.__name__ print(f"function overriden: {se...
salty-ivy/Advanced-programming-techniques
design-patterns/virtual_proxy.py
virtual_proxy.py
py
1,225
python
en
code
0
github-code
90
38155341657
BOT_NAME = 'guazi' SPIDER_MODULES = ['guazi.spiders'] NEWSPIDER_MODULE = 'guazi.spiders' # HOST = 'your host' # DATABASE = 'your database' # USERNAME = '' # PASSWORD = '' ROBOTSTXT_OBEY = False DOWNLOAD_DELAY = 5 COOKIES_ENABLED = True DOWNLOADER_MIDDLEWARES = { 'guazi.middlewares.GuaziDownloaderMiddleware'...
UZPENG/crawl-scrapy-demo
guazi/settings.py
settings.py
py
414
python
en
code
0
github-code
90
18414378689
from math import gcd from itertools import accumulate n = int(input()) a = list(map(int, input().split())) l = list(accumulate(a, lambda x, y: gcd(x, y))) r = list(accumulate(a[::-1], lambda x, y: gcd(x, y)))[::-1] ans = max(r[1], l[-2]) for i in range(1, n-1): ans = max(ans, gcd(l[i-1], r[i+1])) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03061/s874251831.py
s874251831.py
py
314
python
en
code
0
github-code
90
1039227530
# https://www.thethingsnetwork.org/docs/applications/python/ import time import ttn from influxdb import InfluxDBClient app_id = "app_id" # En Overview, Application ID access_key = "ttn-account-v2..." # Access Keys host='localhost' port=8086 user = 'root' password = 'root' dbname = 'sensores' dbuser = 'greencore' db...
solucionestux/IoT_SNMP
software/ttn2db/ttn2db/ttn2db.py
ttn2db.py
py
5,964
python
en
code
0
github-code
90
10398181377
from selenium import webdriver import unittest from time import sleep class TestBaidu(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "https://www.baidu.com/" def test_baidu(self): driver = self.driver ...
happazk/Seleinum120
teachers_demo_test/thinksns_project/demo/baidu.py
baidu.py
py
602
python
en
code
0
github-code
90
15639455388
#!/bin/python """ Title: The DISEMVOWLER Author: Maxwell Haley Description: Takes in a line of text from stdin, strips it of all vowles, then prints the mangled text and it's vowel remains. Done for /r/DailyProgrammer challenge #149. You can invoke this script in two ways. First, call the script with no arguments and ...
Llewxamris/programming-practice
disemvoweler/disemvowler.py
disemvowler.py
py
856
python
en
code
0
github-code
90
22893430283
from django.http.response import HttpResponse from django.shortcuts import render from .models import Tejido def home(request): lista = Tejido.objects.get_queryset() #Procesamos la lista procesada = procesaLista(lista) template_name = "home/index.html" diccionario = {'lista':lista, 'listaProcesada'...
Melina-Zarate/ReconocimientoDePatrones
home/views.py
views.py
py
843
python
es
code
0
github-code
90
31536782261
#_*_coding:utf-8_*_ #from wtforms import Form from flask.ext.wtf import Form from wtforms import SubmitField,SelectField,StringField,BooleanField from wtforms.validators import Required class NameForm(Form): find_type = SelectField(u'查询类型', choices=[('title', '标题'), ('author', '作者')]) keyword=StringField(unicod...
Moxikai/SmartMedia
app/forms.py
forms.py
py
510
python
en
code
0
github-code
90
17374623596
from prompto.declaration.ConcreteCategoryDeclaration import ConcreteCategoryDeclaration from prompto.declaration.IEnumeratedDeclaration import IEnumeratedDeclaration from prompto.type.EnumeratedCategoryType import EnumeratedCategoryType class EnumeratedCategoryDeclaration ( ConcreteCategoryDeclaration, IEnumeratedDecl...
prompto/prompto-python3
Python3-Core/src/main/prompto/declaration/EnumeratedCategoryDeclaration.py
EnumeratedCategoryDeclaration.py
py
3,563
python
en
code
4
github-code
90
22176671789
#!/usr/bin/env python # coding: utf-8 # # Stop_Words_Removing Excercise # # ## By Nirmani Warakaulla # ### Using NLTK Library # #### import all the modules and libraries you want # In[11]: from nltk.corpus import stopwords from nltk.tokenize import word_tokenize # #### input your sentence or paragraph # In[13...
NirmaniWarakaulla/DevPostExcersice
Stop_Words_Removing.py
Stop_Words_Removing.py
py
1,510
python
en
code
1
github-code
90
18255375479
# H, W = [int(_) for _ in input().split()] import sys S = input() if len(S) % 2 == 0: hi_list = [] for i in range(0, len(S), 2): hi_list.append(S[i:i+2]) if set(hi_list) == {'hi'}: print('Yes') sys.exit(0) print('No')
Aasthaengg/IBMdataset
Python_codes/p02747/s811602338.py
s811602338.py
py
254
python
en
code
0
github-code
90
18494556829
N, x = map(int,input().split()) a = sorted([int(i) for i in input().split()]) count = 0 if sum(a) == x: print(len(a)) else: for i in a: x = x-i if x<0: break count+=1 if count == N: print(N-1) else: print(count)
Aasthaengg/IBMdataset
Python_codes/p03254/s264151022.py
s264151022.py
py
279
python
en
code
0
github-code
90
1709053665
#lambda functions def func(x,y,z): return x+y+z print(func(1,2,3)) myVar = lambda x,y,z:x+y+z print(myVar(1,2,3)) # List of lambdas myVar2 = [lambda x:x**2, lambda x:x**3, lambda x:x+20] for i in myVar2: print(i(2)) # Dictionary of lambdas myCalcDict = {'add': lambda x,y:x+y, ...
kesavadeekshitjedi/python_code
Udemy/functions_lambda_learn.py
functions_lambda_learn.py
py
479
python
en
code
0
github-code
90
5937674410
""" # Definition for a Node. class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left self.right = right self.next = next """ class Solution: def connect(self, root: 'Optional[Node]') -> 'Option...
AlexanderBlake/Data-Structures-and-Algorithms
2023/Leetcode/problem116.py
problem116.py
py
909
python
en
code
89
github-code
90
17950149249
h, w = map(int, input().split()) A = [list(str(input())) for i in range(h)] n = h*w def Find(x, par): if par[x] < 0: return x else: par[x] = Find(par[x], par) return par[x] def Unite(x, y, par, rank): x = Find(x, par) y = Find(y, par) if x != y: if rank[x] < rank[...
Aasthaengg/IBMdataset
Python_codes/p03593/s783459377.py
s783459377.py
py
1,444
python
en
code
0
github-code
90
17978187119
n = int(input()) edges = [[] for i in range(n)] for i in range(n-1): a,b = map(int, input().split()) a -= 1 b -= 1 edges[a].append(b) edges[b].append(a) f = 0 s = 0 from collections import deque ps = [-1] * n used = [False] * n used[0] = True # 始めどこから行くか q = deque([0]) while len(q) > 0: a = q.po...
Aasthaengg/IBMdataset
Python_codes/p03660/s531304487.py
s531304487.py
py
1,356
python
en
code
0
github-code
90
36425550754
from invenio.dbquery import run_sql depends_on = ['invenio_release_1_1_0'] def info(): """Upgrade recipe information.""" return "Updates the collectiondetailedrecordpagetabs to hide 'holdings' for every collection \ except 'Books' without an existing rule." def do_upgrade(): """Upgrade reci...
aw-bib/tind-invenio
modules/miscutil/lib/upgrades/invenio_2015_01_13_hide_holdings.py
invenio_2015_01_13_hide_holdings.py
py
1,001
python
en
code
1
github-code
90
73133609895
import numpy as np import os from PIL import Image from random import shuffle import math from sklearn.decomposition import PCA from sklearn.neighbors import KNeighborsClassifier as KNN from sklearn.model_selection import KFold from sklearn.model_selection import cross_validate current_path = os.path.dirname(__file__)...
LHS1998/Machine-Learning-Project
ML04/source/hw4.py
hw4.py
py
2,202
python
en
code
1
github-code
90
20502058100
import cherrypy from metly.model.Customer import Customer from auth import AuthController from Controller import Controller from UserController import UserController from DeviceController import DeviceController from SearchController import SearchController from SourceController import SourceController from Collector...
mvknowles/metly
metly/web/UIRootController.py
UIRootController.py
py
1,774
python
en
code
0
github-code
90
73965949095
class No: def __init__(self, valor=None): self.valor = valor self.esquerda = None self.direita = None class ArvoreBinaria: def __init__(self): self.raiz = None def inserir_em_nivel(self, valor): if self.raiz is None: self.raiz = No(valor) ...
marizzxxxx/PRATICA-ARVOREBI-PEED
codv2.py
codv2.py
py
3,117
python
pt
code
0
github-code
90
72842662056
from fastapi import FastAPI, Request from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from webvisualization_plots import plot_reported_cases_per_million, get_countries, total_cases_per_million from typing import Optional # create app variable (FastAPI instance) app = ...
MaryamHaideri/prosjekt
webside-python/webvisualization.py
webvisualization.py
py
2,749
python
en
code
0
github-code
90
17053951383
class Binary_Search_Tree: class Song: def __init__(self, index, artist, song): self.index = index self.artist = artist self.song = song class Node: def __init__(self, data): self.data = data self.left = None ...
ghostrider86/data_structure_final
solution_tree.py
solution_tree.py
py
3,574
python
en
code
0
github-code
90
33357785990
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from django.conf.urls import url from . import views urlpatterns = [ url(r'^countries/$', views.list_countries, name='countries_list'), url(r'^reports/$', views.reports, name='reports'), url(r'^report/d...
mfaraji/dfp_portal
src/dfp/urls.py
urls.py
py
819
python
en
code
1
github-code
90
16072695873
#examples/doc.py from autofunccli import cmdfunc from typing import List from functools import reduce def sum(l:List[int],n:bool)->int: """ Sum a list of integer. :param l: List of integer. :param n: if present, multiply the result by -1 :return: The sum of the list """ o = reduce(lambda prev,act:prev+act,l)...
CuadrosNicolas/Python-Command-Function
examples/doc.py
doc.py
py
407
python
en
code
0
github-code
90
33559925879
import numpy as np import copy import math from matplotlib import pyplot as plt from skimage import io from numpy import linalg as LA dicomImage = [] VALUES = 65536 NEIGHBORS = 1 color1 = [0,0,0] #negro color2 = [0,50,0] #verde color3 = [255,0,0]#rojo color4 = [0,0,100]#azul color5 = [255,255,255] #blanco color6 ...
Valeriarm/Project_Images
libFilters.py
libFilters.py
py
7,688
python
en
code
1
github-code
90
11159819757
from sqlalchemy import select from database import engine, readings, sensors def get_readings(conn, store_id): query = select([readings, sensors]) query = query.select_from(readings.join(sensors)) query = query.where(sensors.c.store_id == store_id) return conn.execute(query).fetchall() def get_readi...
EmilioCarrion/emcarrio.multitenancy.rls-cost-analysis
src/implementation_one.py
implementation_one.py
py
632
python
en
code
0
github-code
90
8428657527
import numpy as np import numpy.ma as ma from numpy import genfromtxt from collections import defaultdict import pandas as pd import tensorflow as tf from tensorflow import keras from sklearn.preprocessing import StandardScaler, MinMaxScaler from sklearn.model_selection import train_test_split import tabulate from recs...
SohamSen21/Recommender-System-meets-Mechanism-Design
Movie_recommendation_Content-Based Filtering.py
Movie_recommendation_Content-Based Filtering.py
py
8,008
python
en
code
0
github-code
90
19456054212
# PRELUDE # Compare results between wild type and mutant # coding=utf-8 import numpy as np import pandas as pd import csv from scipy import stats import numpy as np import matplotlib.pyplot as plt def getColumn(filename, column,deli): results = csv.reader(open(filename), delimiter=deli) return [result[column]...
najmacherrad/master_thesis
Prelude/plotcomp1KG_prelude.py
plotcomp1KG_prelude.py
py
5,863
python
en
code
1
github-code
90
12473615832
#-*- coding utf-8 -*- import ee import gee import os import sys import random from datetime import date import copy import math import json import compararTiles_listwithOrb as tiles_Orb # import lsTiles as auxiliar try: ee.Initialize() print('The Earth Engine package initialized successfully!') except ee.EEExceptio...
solkan1201/buildingMosaicSentinel
scripts/joinAllBanstoONEImage.py
joinAllBanstoONEImage.py
py
10,154
python
en
code
1
github-code
90
44858095509
# -*- coding: utf-8 -*- """ Created on Mon Oct 29 23:07:50 2018 @name: watch.py @author: Cma """ from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer import time class ChangeHandler(FileSystemEventHandler): def __init__(self, application): self.application = app...
cma2819/screenshot-viewer
watch.py
watch.py
py
834
python
en
code
1
github-code
90
21617525778
def minSwap (arr, n, k) : #Complete the function nums = 0 for i in arr: if i <= k: nums += 1 if nums == 0: return 0 if nums == len(arr): return 0 swaps = 0 for i in range(0, nums): if arr[i] > k: swaps += 1 ...
sgowdaks/CP_Problems
basics/minimum_swaps_and_k_together.py
minimum_swaps_and_k_together.py
py
648
python
en
code
0
github-code
90
7193880277
data = open("y22\\Day3\\input.txt", "r").read().splitlines() def getPoint(letter): value = ord(letter) if value >= 97: return (value - 96) elif value >= 65: return (value - 38) def splitString(strin): n = len(strin) if n%2 == 0: return (strin[0:n//2], strin[n//2:]) els...
WhyDoWeLiveWithoutMeaning/AdventOfCode
y22/Day3/P1/Main.py
Main.py
py
681
python
en
code
0
github-code
90
21499663428
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth import authenticate, login, logout from django.urls import reverse from .forms import StaffForm, StudentForm from student.models import CustomUser, Staff, Student,attendance from django.contrib import...
bivek1/suman
student/views.py
views.py
py
8,245
python
en
code
0
github-code
90
72758698858
import sys input = sys.stdin.readline S = input().strip() d = set() for i in range(len(S)+1): for j in range(i, len(S)+1): d.add(S[i:j]) print(len(d)-1)
chlendyd7/Algorithm
Algorithm_BackJoon/11478.py
11478.py
py
168
python
en
code
0
github-code
90
5098682236
from panda import Panda from collections import deque class SocialNetwork: def __init__(self): self.graph = {} def _get_graph(self): return self.graph def add_panda(self, panda): self.graph[panda] = set() def has_panda(self, panda): if panda in self.graph.keys(): ...
ruzhaa/Programming101-Python
not_ready/week06/social_network.py
social_network.py
py
2,140
python
en
code
0
github-code
90
43304340671
# Enter your code here. Read input from STDIN. Print output to STDOUT # omega is sample space # res is number of cases at least one of the indices selected contains the letter:'a'. I find the complement of result from itertools import combinations n = int(input()) l = list(map(str, input().split())) k = int(input()) ...
trungtin1998/HackerRank
Python/Iterables_and_Iterators.py
Iterables_and_Iterators.py
py
463
python
en
code
0
github-code
90
41134955121
x = "We can only see a short distance ahead, but we can see plenty there that needs to be done." y = x.split(" s") z = [] for chunk in y: z.append(str(len(chunk) - 1)) phrase = "_".join(z) for word in phrase.split('3_3'): if "0" in word: print(word, word[0:2], z[0], sep="..", end=".")
bharnav/CSC630-Machine-Learning
Python Practice/lib/number_3.py
number_3.py
py
303
python
en
code
0
github-code
90
71799297897
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 31 21:30:32 2022 @author: zhihuang """ # Part 3: apply import os,sys,platform import numpy as np import pandas as pd from PIL import Image, ImageCms Image.MAX_IMAGE_PIXELS = 9933120000 import matplotlib.pyplot as plt from imshowpair import imsh...
huangzhii/IMPRESS
pipeline/p5_part_3_IHC_segmentation.py
p5_part_3_IHC_segmentation.py
py
8,498
python
en
code
8
github-code
90
29543470747
# -*- coding: utf-8 -*- # @Time : 2021/12/28 9:02 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 472. 连接词.py # @Software: PyCharm # =================================== """给你一个 不含重复 单词的字符串数组 words ,请你找出并返回 words 中的所有 连接词 。 连接词 定义为:一个完全由给定数组中的至少两个较短单词组成的字符串。   示...
monijuan/leetcode_python
code/AC3_hard/472. 连接词.py
472. 连接词.py
py
3,742
python
en
code
0
github-code
90
16416200960
from preprocessing.data_preprocessing import parse_data import matplotlib.pyplot as plt from sklearn.dummy import DummyClassifier import numpy as np from sklearn.neural_network import MLPClassifier from sklearn.metrics import multilabel_confusion_matrix from tabulate import tabulate from sklearn.metrics import precisio...
borisflesch/tcd-ml-weekly-assignments
Group project - Impact of sleep and physical activities on academic performances of students/models/mlp_classifier.py
mlp_classifier.py
py
7,880
python
en
code
0
github-code
90
31018093928
from dict import colors class cube: """ DESC: Creates a 2x2x2 cube object with all sides solved. """ def __init__(self): self.cube = [] self.scramble = [] self.cubeSolved = [] self.clean() def clean(self): """ DESC: Creates a solved state cube. ...
MattLucker/IDAStarSearch
puzzle.py
puzzle.py
py
10,725
python
en
code
1
github-code
90
10621588413
import json import requests from core.utils import CloudApiFormatError, CloudApiServerError, CloudApiConnectionError, CloudApiTimeoutError class AwsApi: """Implements access to AWS HTTP APIs""" HTTP_TIMEOUT_SECS = 15 def __init__(self, key: str, url: str): self._api_key = key self._api_ur...
dmatiushkin73/my-kiosk-backend
cloud/aws_api.py
aws_api.py
py
2,209
python
en
code
0
github-code
90
75021154
import math import binascii from urllib.parse import urlparse from tkinter import * from http.server import BaseHTTPRequestHandler, HTTPServer import threading import multiprocessing import cgi import binascii msg = "" msgRecibido = "" ips = [] def getMicropasos( centimetros): stepperResolution =...
alu0101017396/TFG
python/clases.py
clases.py
py
18,411
python
es
code
0
github-code
90
24999684145
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Tree(object): def __init__(self): self.root = None def add(self, item): node = TreeNode(item) if self.root is None: self.root = node return ...
Lycorisophy/LeetCode_python
简单题/剑指 Offer 55 - I & II. 二叉树的深度 & 平衡二叉树.py
剑指 Offer 55 - I & II. 二叉树的深度 & 平衡二叉树.py
py
1,353
python
en
code
1
github-code
90
16363786308
"""RFC 6962 client API.""" import base64 import json from absl import flags as gflags from ct.crypto import verify from ct.proto import client_pb2 import logging import requests import urllib import urlparse FLAGS = gflags.FLAGS gflags.DEFINE_integer("entry_fetch_batch_size", 1000, "Maximum number of " ...
google/certificate-transparency
python/ct/client/log_client.py
log_client.py
py
21,343
python
en
code
862
github-code
90
34717029461
from flask import Flask, render_template, redirect, url_for from flask_bootstrap import Bootstrap from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, SelectField, TimeField from wtforms.validators import DataRequired, URL import csv app = Flask(__name__) app.config['SECRET_KEY'] = '8BYkEfBA6O...
hao134/100_day_python
day62_flask_wtforms_bootstrap_and_csv_coffee_and_wifi_project/Starting+Files+-+coffee-and-wifi/main_day62.py
main_day62.py
py
3,199
python
en
code
2
github-code
90
35505737537
from django.contrib.sessions.models import Session from django.db import models from django.utils import timezone from phonenumber_field.modelfields import PhoneNumberField class TimeModelMixin(models.Model): created_at = models.DateTimeField(auto_now_add=True, verbose_name="Создано") updated_at = models.Date...
mkayander/mobile-repair-cloud
web/models.py
models.py
py
2,554
python
en
code
0
github-code
90
72143521258
#!/usr/bin/env python """This is a script for managing MassPay each week. See documentation here: http://inside.gratipay.com/howto/run-masspay """ from __future__ import absolute_import, division, print_function, unicode_literals import csv import datetime import getpass import os import sys from decimal import...
gratipay/gratipay.com
bin/masspay.py
masspay.py
py
10,656
python
en
code
1,121
github-code
90
13087681040
import os from dotenv import load_dotenv def get_env(get_binance_info=False): """get dot env variables from .env file Returns: tuple: a set of environment variables """ load_dotenv() # take environment variables from .env. CONTRACT_ADDRESS = os.environ.get("CONTRACT_ADDRESS") RINKE...
June911/WithdrawFromBinance
utils.py
utils.py
py
1,248
python
en
code
5
github-code
90
8242167819
import json from scraping.DriverSettings import inizialize, create from selenium.webdriver.common.by import By def searchFilm(code, opt): driver = create(opt) driver.get("https://www.netflix.com/browse?jbv=" + code) film = {} try: cont = driver.find_element(By.CLASS_NAME, "about-container") ...
Tragyt/IR_netflix_primevideo
progetto-GestioneInformazione/scraping/Netflix/filmDetails.py
filmDetails.py
py
2,443
python
en
code
0
github-code
90
23241494833
from sys import stdin, stdout def getCountnumber(n: int) -> int: nCount: int = 1 while n > 10: nCount += 1 n %= 10 return nCount def solve(): while True: numA, numB = list(map(int, stdin.readline().rstrip().split())) if numA == 0 and numB == 0: break nCount: int = 0 for _ in r...
anothel/CodeKata
백준/Bronze/4388. 받아올림/받아올림.py
받아올림.py
py
670
python
en
code
1
github-code
90
19251799745
### Author: Amal Zouaq ### azouaq@uottawa.ca ## Author: Hadi Abdi Ghavidel ## habdi.cnlp@gmail.com import timeit if __name__=='__main__': #If we run the testcases add syspath to fix imports import sys sys.path.append("./../../") import numpy as np import random from searchdir.blindSearch.breadthfirst_sea...
AG3X29M4Nc5DJN0-FNkr5MSgiwR4YxBz/course-AI
assignment1/problems/eightPuzzle/EightPuzzleState.py
EightPuzzleState.py
py
8,443
python
en
code
0
github-code
90
4759812100
import time ## Recursive build function, it takes a number and places it in appropriate array location ## Parent at n, left child at 2n +1, and right child at 2n+2 def build_tree(bst_array, number, current_indeks): if(bst_array[current_indeks]==' '): bst_array[current_indeks] = number current_indek...
emrekilavuz/BinarySearchTree
bst100.py
bst100.py
py
1,955
python
en
code
0
github-code
90
34062539086
import re import pandas as pd import snscrape.modules.twitter as sntwitter from transformers import AutoTokenizer, AutoModelForSequenceClassification from scipy.special import softmax from googletrans import Translator query = 'Convocação da seleção since:2022-11-07 until:2022-11-08' maxTweets = 500 # ...
dougfraga/sentiment-tools
scrape_tweets.py
scrape_tweets.py
py
3,435
python
en
code
0
github-code
90
37156751854
filename = "alice_in_wonderland.txt" file = open(filename, "r") alphabet = ['a', 'b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't','u', 'v', 'w', 'x', 'y', 'z'] letter =[] letterfreq = [] raw = file.read() def count_letters(text): text=text.lower() for char in alphabet: ...
Nessa-Stewart/summer_of_code
week_2/try.py
try.py
py
864
python
en
code
0
github-code
90
35161955460
import torch import torch.nn as nn from tqdm import trange from tqdm.notebook import trange as nbtrange import numpy as np class DefaultOptimizer: def __init__(self, forward_fn, params): """Initialize the optimizer. Parameters ---------- forward_fn Function used to com...
nauralcodinglab/linear-nonlinear-dendrites
training/optimizers.py
optimizers.py
py
2,818
python
en
code
1
github-code
90
3955031426
import argparse import shutil import glob, os parser = argparse.ArgumentParser(description='Sample images from an Oxford Robocar dataset') parser.add_argument('--srcdir', type=str, help='Source directory of complete dataset', required=True) parser.add_argument('--dstdir', type=str, help='Destination directory for samp...
tbabluct/eee4022_code
dataset_samplers/sample_dataset.py
sample_dataset.py
py
1,011
python
en
code
0
github-code
90
30460518797
# This file creates and manages sockets that are used both by the client and the server connections import socket import threading import select import Queue import struct class SocketConnection(object): def __init__(self, packetDispatcher,talk=False): """Creates a socket connection""" self._sock...
kushalm9203/internet_protocol_prpp
SocketManager.py
SocketManager.py
py
4,913
python
en
code
1
github-code
90
18415018755
"""fourth migration Revision ID: 0bcda715f022 Revises: 7c2760a717f8 Create Date: 2022-05-15 10:48:10.181392 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '0bcda715f022' down_revision = '7c2760a717f8' branch_labels = None depends_on = None def upgrade(): ...
paulinenanzala19/E-Blog
migrations/versions/0bcda715f022_fourth_migration.py
0bcda715f022_fourth_migration.py
py
647
python
en
code
0
github-code
90
18397948169
import sys input = sys.stdin.readline def read(): N, K = map(int, input().strip().split()) V = list(map(int, input().strip().split())) return N, K, V def solve(N, K, V): ans = 0 for k in range(min(K, N) + 1): for l in range(0, k+1): s = sorted(V[:l] + V[N-k+l:]) v ...
Aasthaengg/IBMdataset
Python_codes/p03032/s517626416.py
s517626416.py
py
756
python
en
code
0
github-code
90
28337885444
from tkinter import Frame, Label, Entry, Button, YES, BOTH, END, Tk, W, ttk from googletrans import Translator class FrmTranslator: def __init__(self, parent, title): self.parent = parent self.parent.geometry("500x300") self.parent.title(title) self.parent.protocol("W...
Fikriproject/Tugas-PBO
Tugas Pertemuan 7/Translator/FrmTranslator.py
FrmTranslator.py
py
2,360
python
en
code
0
github-code
90
34092171975
from bs4 import BeautifulSoup import re from . import facilities_data def page_scraper_facilities(resHtml, hotelid): # print('hello faci') result_facilities_upz = [] try: soup1 = BeautifulSoup(resHtml, "lxml") except Exception as ex: # print(f"str102___{ex}") return None ...
hotelUpz/upz_main
scrapers_funcs/faciclities_func.py
faciclities_func.py
py
4,212
python
en
code
0
github-code
90
31437631551
import time # This starts the first room of the game def play_game(): player_inventory = ['start'] i = 0 while i == 0: user_move = input('What would you like to do? ') if user_move == 'check desk': print('you found an old brass key!') time.sleep(1) print(...
tvstaticghost/text_game
text_horror_game.py
text_horror_game.py
py
2,039
python
en
code
0
github-code
90
15296437352
import argparse import pandas as pd def write_excel(filename, sheets): writer = pd.ExcelWriter(filename) for sheet_name, sheet_data in sheets.iteritems(): sheet_data.to_excel(writer, sheet_name, index=False) writer.save() def convert_from_v1(args): data = pd.read_excel(args['input_results'],...
molonc/colossus
scripts/smartchipconvert.py
smartchipconvert.py
py
2,582
python
en
code
3
github-code
90
25800357268
from PyQt5 import QtCore class Animation(): @property def center(self): return self._center def animation(self, lb, x_center, y_center, parent): initial_rect = QtCore.QRect( x_center, y_center, 171, 171 ) zoom_factor...
Hanler/Project-bio-beta
animation.py
animation.py
py
819
python
en
code
0
github-code
90
29642285200
#!/usr/bin/env python3 import os, subprocess, time class LED: def blink(iter, interval): for i in range(iter): subprocess.run(f"echo '1' > /sys/class/leds/{LED._get_location()}/brightness", shell=True) time.sleep(interval) subprocess.run(f"echo '0' > /sys/class/leds/{LED...
yumium/tech_notes
missing/blinkr/blinkr.py
blinkr.py
py
1,880
python
en
code
0
github-code
90
1076852558
#!/usr/bin/env python3 """ Process data from Li et al (2017) PNAS This script saves the following files: * `ebola_data_cleaned.csv`: a "cleaned" version of the original data * `ebola_data_votes_cases.csv`: a version converted into ranked votes (showing action ranks) * `ebola_data_votes_str_cases.csv`: a version conv...
p-robot/voting_systems_epi_analysis
src/data/clean_ebola_case_study_data.py
clean_ebola_case_study_data.py
py
3,130
python
en
code
0
github-code
90
30113288136
import tensorflow as tf # machine learning import cv2 # image processing import numpy as np # matrix multiplication import time # record query time import os from flask import Flask, render_template, request, send_from_directory import json app = Flask(__name__, static_url_path="") IMAGE_SIZE = (224, 224, 3) model ...
anish-lakkapragada/Hand-Classification-For-Autism-Diagnosis
demo/app.py
app.py
py
1,781
python
en
code
17
github-code
90
25713120722
''' Quick Sort ''' import random def random_partition(a:list, l:int, r:int): pivot = random.randrange(l, r) a[r], a[pivot] = a[pivot], a[r] return partition(a, l, r) def partition(a:list, l:int, r:int): pivot = a[r] i = l for j in range (l, r): if a[j] <= pivot: a[i], a[j...
HornbillFromMinsk/EPIC
Algos/Homework/hw_sorting_quick_sort.py
hw_sorting_quick_sort.py
py
917
python
en
code
0
github-code
90
38626492537
from collections import deque from colorama import Fore def print_func(some_array): [print(f"[ {', '.join(row)} ]") for row in some_array] def check_indices(c, n): if 0 <= c < n: return True return False def place_symbol(): row = 0 while row != ROWS and playing_boar...
slambeca/SoftUni-Python-Advanced-May-2023
8.1. Workshop - Lab/connect_four.py
connect_four.py
py
3,010
python
en
code
0
github-code
90