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
28388831357
# -*- coding: utf-8 -*- from RestUtil import RestUtil #http://legis.senado.leg.br/dadosabertos/docs/ui/index.html#!/PlenarioService/resource_PlenarioService_listaVotacoesSessaoXml_GET_0 class Votacao: url = 'http://legis.senado.leg.br/dadosabertos/plenario/lista/votacao' @staticmethod def get(data_votac...
senadores-votos/senado
webcrawler/dadosabertos_plenario_lista_votacao.py
dadosabertos_plenario_lista_votacao.py
py
642
python
pt
code
0
github-code
90
20487744605
""" Author: Andrew Washburn UNR CS791 Robotics Fall 2020 Instructor: Christos Papachristos This program imports a STL polyhedron mesh file and computes an optimal set of viewpoints that observe the entire object. Idea credited to "Planning Robot Motions for Range-Image Acquisition and Automatic 3D Model Construction" ...
Bscout2011/Structural-Inspection-Planner
viewpoint_generation.py
viewpoint_generation.py
py
48,856
python
en
code
0
github-code
90
18328626869
import sys input = lambda : sys.stdin.readline().rstrip() n, k = map(int, input().split()) a = list(map(int, input().split())) f = list(map(int, input().split())) a.sort() f = sorted(f, reverse=True) cost = [] for i in range(n): cost.append(a[i]*f[i]) left = -1 right = max(cost) def solve(x): cnt = 0 for i...
Aasthaengg/IBMdataset
Python_codes/p02883/s598046909.py
s598046909.py
py
644
python
en
code
0
github-code
90
27992734165
import os import numpy as np import matplotlib.pyplot as plt from ranky import rankz from PyAnEn.utils_ss import binned_spread_skill from PyAnEn.utils_verify import iou_determ from PyAnEn.utils_verify import ens_to_prob from PyAnEn.utils_verify import rank_histogram from PyAnEn.utils_verify import reliability_diagram...
Weiming-Hu/PyAnEn
tests/test_UtilsVerify.py
test_UtilsVerify.py
py
6,044
python
en
code
3
github-code
90
10400486628
# -*- coding: utf-8 -*- """ Created on Thu Jul 18 15:07:05 2019 @author: admin """ ''' ๅฏน้“พ่กจ่ฟ›่กŒๆ’ๅ…ฅๆŽ’ๅบใ€‚ ๆ’ๅ…ฅๆŽ’ๅบ็š„ๅŠจ็”ปๆผ”็คบๅฆ‚ไธŠใ€‚ไปŽ็ฌฌไธ€ไธชๅ…ƒ็ด ๅผ€ๅง‹๏ผŒ่ฏฅ้“พ่กจๅฏไปฅ่ขซ่ฎคไธบๅทฒ็ป้ƒจๅˆ†ๆŽ’ๅบ๏ผˆ็”จ้ป‘่‰ฒ่กจ็คบ๏ผ‰ใ€‚ ๆฏๆฌก่ฟญไปฃๆ—ถ๏ผŒไปŽ่พ“ๅ…ฅๆ•ฐๆฎไธญ็งป้™คไธ€ไธชๅ…ƒ็ด ๏ผˆ็”จ็บข่‰ฒ่กจ็คบ๏ผ‰๏ผŒๅนถๅŽŸๅœฐๅฐ†ๅ…ถๆ’ๅ…ฅๅˆฐๅทฒๆŽ’ๅฅฝๅบ็š„้“พ่กจไธญใ€‚ ย  ๆ’ๅ…ฅๆŽ’ๅบ็ฎ—ๆณ•๏ผš ๆ’ๅ…ฅๆŽ’ๅบๆ˜ฏ่ฟญไปฃ็š„๏ผŒๆฏๆฌกๅช็งปๅŠจไธ€ไธชๅ…ƒ็ด ๏ผŒ็›ดๅˆฐๆ‰€ๆœ‰ๅ…ƒ็ด ๅฏไปฅๅฝขๆˆไธ€ไธชๆœ‰ๅบ็š„่พ“ๅ‡บๅˆ—่กจใ€‚ ๆฏๆฌก่ฟญไปฃไธญ๏ผŒๆ’ๅ…ฅๆŽ’ๅบๅชไปŽ่พ“ๅ…ฅๆ•ฐๆฎไธญ็งป้™คไธ€ไธชๅพ…ๆŽ’ๅบ็š„ๅ…ƒ็ด ๏ผŒๆ‰พๅˆฐๅฎƒๅœจๅบๅˆ—ไธญ้€‚ๅฝ“็š„ไฝ็ฝฎ๏ผŒๅนถๅฐ†ๅ…ถๆ’ๅ…ฅใ€‚ ้‡ๅค็›ดๅˆฐๆ‰€ๆœ‰่พ“ๅ…ฅๆ•ฐๆฎๆ’ๅ…ฅๅฎŒไธบๆญขใ€‚ ย  ็คบไพ‹ 1๏ผš ่พ“ๅ…ฅ...
k8godzilla/-Leetcode
1-100/L147.py
L147.py
py
2,561
python
zh
code
0
github-code
90
33667558235
import requests from bs4 import BeautifulSoup from time import sleep import json file_name = 'shop_by_parse.json' data = {'planshety': []} url = 'https://shop.by/planshety/' page = 1 while True: r = requests.get(f'https://shop.by/planshety/?page_id={page}') # print(r.status_code) sleep(1) soup = Beau...
AlesyaSeliazniova30032012/parse_bot_shop.by
main.py
main.py
py
1,161
python
en
code
0
github-code
90
18815409117
from spatula import URL, JsonListPage import logging from openstates.models import ScrapeCommittee import requests import re class UnknownSubCommFound(BaseException): def __init__(self, com_name): super().__init__(f"unknown for subcommittee found: {com_name}") class CommitteeList(JsonListPage): year...
openstates/openstates-scrapers
scrapers_next/wy/committees.py
committees.py
py
2,799
python
en
code
820
github-code
90
71479641898
from PyQt5.QtWidgets import * from PyQt5.QtGui import QPixmap, QIcon from PyQt5 import uic import os import time import subprocess import json class YtGui(QMainWindow): def __init__(self): # noinspection PyArgumentList super(YtGui, self).__init__() uic.loadUi("UI/design.ui", self) # Loads...
akshatdodhiya/Youtube-Trimmer-and-Downloader
main.py
main.py
py
15,643
python
en
code
1
github-code
90
6102205645
# coding=utf-8 import os import html from io import StringIO from lxml import etree from prodtools import _ from prodtools.utils import fs_utils from prodtools.utils import encoding NAMESPACES = ( 'xmlns:xml="http://www.w3.org/XML/1998/namespace"', 'xmlns:xlink="http://www.w3.org/1999/xlink"', 'xmlns:mm...
scieloorg/PC-Programs
src/scielo/bin/xml/prodtools/utils/xml_utils.py
xml_utils.py
py
20,006
python
en
code
7
github-code
90
18678913288
import json import uuid import time from ax.devops.axdb.axdb_client import AxdbClient from ax.exceptions import AXIllegalArgumentException class AXWorkflow(object): SUSPENDED = 'SUSPENDED' ADMITTED = 'ADMITTED' ADMITTED_DEL = 'ADMITTED_DEL' RUNNING = 'RUNNING' RUNNING_DEL = 'RUNNING_DEL' RUNN...
zhan849/argo
devops/src/ax/devops/workflow/ax_workflow.py
ax_workflow.py
py
15,486
python
en
code
null
github-code
90
2511165857
from time import sleep from machine import Pin import utime from micropython import const class Stepper_Motor_28BYJ_48: """A 28BYJ-48 geared stepper motor.""" # The 28BYJ-48 has 32 full steps per revolution (so 64 half-steps per revolution). # Gearing is 32/9 * 22/11 * 26/9 * 31/10 = 51584 / 810 = 25792 ...
martinbudden/HollowClock
software/main.py
main.py
py
5,949
python
en
code
1
github-code
90
18592771419
n=int(input()) x=n n=str(n) f=0 for i in range(len(n)): y=int(n[i]) f+=y if x%f==0: print('Yes') else: print("No")
Aasthaengg/IBMdataset
Python_codes/p03502/s953893198.py
s953893198.py
py
123
python
en
code
0
github-code
90
70522769898
from test import test # D. verbing # Given a string, if its length is at least 3, # add 'ing' to its end. # Unless it already ends in 'ing', in which case # add 'ly' instead. # If the string length is less than 3, leave it unchanged. # Return the resulting string. def verbing(s): if len(s) >= 3: if s.ends...
fpecek/python-exercise
python_exc_1/string2.py
string2.py
py
2,517
python
en
code
0
github-code
90
37418437831
def name(): list1 = ['i','t','a','y'] len_list1 = len(list1) for letter in range(len_list1): if letter%2==0: print(list1[letter].upper(),end = "") else: print(list1[letter].lower(),end = "") name() def division(): num1 = int(input("enter a number:",)) num2 = int(input("ent...
ZENEVA66/python_hw
hm_lesson7.py
hm_lesson7.py
py
617
python
en
code
0
github-code
90
11570230441
from urllib.request import urlopen from transliterate import translit, get_available_language_codes import pickle import certifi # local imports from .. import utils class GibPool(list): """ dict class that represents a pool of words or syllables of a specific language """ def __init__(self, lang, *a...
brisvag/gibberify
gibberify/generate/syllables.py
syllables.py
py
6,213
python
en
code
18
github-code
90
41210154150
# A program that asks the user how much they paid for a meal, what percentage # they would like to tip, and then prints out a detailed summery of their purchase # including the 7% sales tax. # 6/8/2017 # CTI-110 M2HW2 - Tip Tax Total # Allie Beckman print('Hello, please enter the cost of your meal.') while Tru...
Amarix/cti110
M2HW2_TipTaxTotal_Beckman.py
M2HW2_TipTaxTotal_Beckman.py
py
1,660
python
en
code
0
github-code
90
3742957137
import matplotlib.pyplot as plt from dataset_bias import * from multinomial_pdf import * BIAS_LIMIT = 5 sex_bias = PDF(distribution_sex, GLOBAL_SEX, len(dir)) * 100 race_bias = PDF(distribution_race, GLOBAL_RACE, len(dir)) * 100 iqa_sex_bias = max(iqa_sex) - min(iqa_sex) iqa_race_bias = max(iqa_race) - min(iqa_race) ...
rheabhutani/bias_in_ai
input_bias_testing/utk/dataset_bias_plots.py
dataset_bias_plots.py
py
2,198
python
en
code
0
github-code
90
32888956490
import tkinter as tk import AdminPage class UserSettings(tk.Frame): def __init__(self, master, ID): tk.Frame.__init__(self, master) tk.Label(self, text="Welcome to the User Settings page").pack(side="top", fill="x", pady=10) tk.Button(self, text="Create user", command=lambda: master.switc...
YoonAddicting/Beverage-Python
Settings/UserSettings.py
UserSettings.py
py
3,646
python
en
code
0
github-code
90
34873412530
import numpy as np import pytest from pandas.util._validators import validate_inclusive import pandas as pd @pytest.mark.parametrize( "invalid_inclusive", ( "ccc", 2, object(), None, np.nan, pd.NA, pd.DataFrame(), ), ) def test_invalid_inclusive(in...
pandas-dev/pandas
pandas/tests/util/test_validate_inclusive.py
test_validate_inclusive.py
py
896
python
en
code
40,398
github-code
90
37240184824
''' ไฝฟ็”จarrayๅŽปๅ–ไปฃๆ•ธๅ€ผ ''' ans=[0]*100 def fib(n): if n==0: return 0 elif n==1: return 1 else: ans[0]=0 ans[1]=1 for i in range(2,n+1): ans[i]=ans[i-1]+ans[i-2] return ans[n],ans print(fib(5))
billy0603/Algorithm
DPA.py
DPA.py
py
270
python
en
code
0
github-code
90
20306618684
import os import json from flask import Flask, render_template, request, flash #import flask object from flask module #request handles finding out method used and contains form object when we've posted it #flash..flash messages are temp messages that go on refresh app = Flask(__name__) app....
tom1mol/flask
run.py
run.py
py
2,891
python
en
code
0
github-code
90
9121184502
import sqlite3, os, openpyxl from sqlite3 import Error DBFILE = "Test.db" conn = sqlite3.connect(DBFILE) cursor = conn.cursor() book = openpyxl.Workbook() sheet = book.active cursor.execute("SELECT * FROM Student") results = cursor.fetchall() i = 0 for row in results: i += 1 j = 1 for col in row: ...
robot-eng/SQL
export.py
export.py
py
469
python
en
code
1
github-code
90
3939031390
import re import numpy as np def load_input(path): with open(path) as f: vent_lines = [] exp = re.compile(r"([0-9]+),([0-9]+) -> ([0-9]+),([0-9]+)") for line in f: m = re.search(exp, line) vent_lines.append([int(coord) for coord in m.groups()]) return vent_line...
95ep/AoC
y2021/day05.py
day05.py
py
2,393
python
en
code
0
github-code
90
44575169293
from pynput import mouse from PIL import ImageGrab import tkinter as tk class ScreenCapture: def __init__(self): self.root = tk.Tk() self.root.attributes('-fullscreen', True) self.root.attributes('-topmost', True) self.root.attributes('-alpha', 0.5) self.root.configure(bg=...
mattyamonaca/LCM_i2i_PoC
capture.py
capture.py
py
1,618
python
en
code
42
github-code
90
15666234253
import unittest import six from ..api import read_notebook from ..execute import _parameterize_notebook from . import get_notebook_path PYTHON = 'python2' if six.PY2 else 'python3' class TestNotebookParametrizing(unittest.TestCase): def test_not_preserving_tags(self): # test that other tags on the para...
cHYzZQo/papermill
papermill/tests/test_parameterize.py
test_parameterize.py
py
1,851
python
en
code
null
github-code
90
35517175336
from django.contrib import admin # Register your models here. from .models import Log class LogAdmin(admin.ModelAdmin): fieldsets = ( ('Expand', { 'classes': ('collapse',), 'fields': (('from_sheet', 'to_sheet', 'from_tab', 'to_tab', 'updated_row', 'updated_col', 'updated_range'),...
SnehaCredR/Sheets
googleSheets/sheets_io/admin.py
admin.py
py
657
python
en
code
0
github-code
90
22589565196
#this parser was written specifically to handle txt files with #tab and/or new line delimited files such as #https://onlinecourses.science.psu.edu/stat501/sites/onlinecourses.science.psu.edu.stat501/files/data/skincancer.txt import os import sys import pandas as pd import numpy as np import xlwt from collections impo...
atomicwest/VisualStudioTutoring
misc/txt_to_xls.py
txt_to_xls.py
py
1,175
python
en
code
0
github-code
90
73445602855
#Question Link: https://leetcode.com/explore/learn/card/fun-with-arrays/525/inserting-items-into-an-array/3253/ def mergeList(nums1: [int], m: int, nums2: [int], n: int) -> None: x = m - n for num in nums2: nums1.insert(x, num) x += 1 nums1 = sorted(nums1) print(nums1) return None ...
aniyaz/Leet-Practice
mergeList.py
mergeList.py
py
472
python
en
code
0
github-code
90
41839740580
# ๊ทธ๋ž˜ํ”„์™€ ์ˆœํšŒ # DFS์™€ BFS๋ฅผ ๋ชจ๋‘ ๊ตฌํ˜„ํ•˜๋Š” ๋ฌธ์ œ import sys from collections import deque def dfs(graph, v, visited): visited[v] = True print(v, end=" ") for i in graph[v]: if not visited[i]: dfs(graph, i, visited) def bfs(graph, v, visited): queue = deque([v]) visited[v] = True while qu...
96Jerry/BaekJun-problem
dfs_and_bfs/1260.py
1260.py
py
1,731
python
en
code
0
github-code
90
74676134695
# pair-wise classifer for within-document event coreference. import keras from keras.layers import Input, Dense, Concatenate, Subtract, Dropout, LSTM from keras.models import Model def get_model(silent=False, hidden_size=[100, 30], activation_fx='relu'): # embed event lemma and PoS. Dense_lemma_layer = Dense(...
leslie071564/EventCoreference
models/WithinDocumentClassifier.py
WithinDocumentClassifier.py
py
1,731
python
en
code
2
github-code
90
29288485716
import pytest import math from enum import Enum from dataclasses import dataclass from brownie.network.contract import ProjectContract from brownie.network.account import LocalAccount from typing import Callable from utils.helpers import calculate_offer_fee, calculate_royalty_fee from brownie import reverts, Wei, chain...
Mike-CZ/artion-v3-contracts
tests/erc721_marketplace/test_ERC721_listing.py
test_ERC721_listing.py
py
14,884
python
en
code
2
github-code
90
19790703661
from collections import deque def permutations(nums): result = [] permutations = deque() nums_len = len(nums) if nums_len == 0: return result permutations.append([]) #basically initialize with a value so we have something to start with for curr_num in nums: perm_len = len(permutations) for _ in...
willgorick/grokking-coding
subsets/generate_permutations.py
generate_permutations.py
py
1,356
python
en
code
0
github-code
90
27015494824
import sys from collections import deque n=int(sys.stdin.readline()) queue=deque() limit_five=0 limit_three=0 while (5*limit_five)<=n: limit_five+=1 while (3*limit_three)<=n: limit_three+=1 for i in range(limit_five): for j in range(limit_three): if n==5*i+3*j: queue.a...
oliver0922/algorithms_Baekjoon
2839.py
2839.py
py
411
python
en
code
0
github-code
90
18375258019
def actual(n, P): count = 0 for i in range(1, n - 1): a, b, c = P[i - 1], P[i], P[i + 1] if (a < b < c) or (a > b > c): count += 1 return count n = int(input()) P = list(map(int, input().split())) print(actual(n, P))
Aasthaengg/IBMdataset
Python_codes/p02988/s454367847.py
s454367847.py
py
261
python
en
code
0
github-code
90
44067474839
from ..models.pose_net import PoseNet from ..criterions.pose_net_criterion import PoseNetCriterion from ..criterions.se3_criterion import SE3Criterion from ..criterions.poe_se3_criterion import POESE3Criterion from ..criterions.parametrized_poe_se3_criterion import ParametrizedPOESE3Criterion from torchvision import mo...
MisterMap/lie-pose-net
lieposenet/factories/model_factory.py
model_factory.py
py
1,800
python
en
code
1
github-code
90
18546417339
import copy N = int(input()) X = [int(i) for i in input().split()] Y = copy.deepcopy(X) Y = sorted(Y, key= lambda x: -x) c = int(N/2) for i in range(N): a = X[i] if a >= Y[c-1]: print(Y[c]) else: print(Y[c-1])
Aasthaengg/IBMdataset
Python_codes/p03379/s480915773.py
s480915773.py
py
239
python
en
code
0
github-code
90
31073913966
#!/usr/bin/env python # coding: utf-8 # Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. # # Note that elements beyond the length of the original array are not written. # # Do the above modifications to the input array in place, do not retur...
sicktrick-237/Leetcode-Solutions
1089. Duplicate Zeros.py
1089. Duplicate Zeros.py
py
966
python
en
code
0
github-code
90
33422776232
class Node: def __init__(self, data: int, next=None): self.data = data self.next = next class LinkedList: def __init__(self): self.root = None def push_back(self, value: int) -> int: if not self.root: self.root = Node(value) else: last_nod...
zero-shubham/data-structures
LinkedList/linked_list.py
linked_list.py
py
1,943
python
en
code
1
github-code
90
681831288
import cv2 from scipy.stats import gaussian_kde import scipy.signal from CODE.MouseImageInput import * from CODE.ParticleFilterTracking import * from CODE.WDT import * from CODE.config import * import os dirname = os.path.dirname(os.path.dirname(__file__)) """ This function gets an input video and a kern...
sagicohen81/video-processing-project
CODE/BackgroundSubtractionAndMatting.py
BackgroundSubtractionAndMatting.py
py
18,411
python
en
code
0
github-code
90
6292821658
valid = False #ย Condicional IF 1 if valid : print("Es {}".format(True)) else: print("Es {}".format(False)) valid = True # Condicional IF 2 mensaje = "Es {}".format(True) if valid else "Es {}".format(False) print(mensaje) # pass para no construir retorno product = "Gorro" if product == "Pera": print("Es...
Linuxallan/Python
proyectos/Curso Python 3 Youtube Codigo facilito/condiciones.py
condiciones.py
py
1,821
python
es
code
0
github-code
90
8381103557
import cv2 import numpy as np cap = cv2.VideoCapture(0) ret,frame1 = cap.read() ret,frame2 = cap.read() while cap.isOpened(): diff = cv2.absdiff(frame1,frame2) gray = cv2.cvtColor(diff,cv2.COLOR_BGR2GRAY) gblur = cv2.GaussianBlur(gray,(5,5),0) _ , thr = cv2.threshold(gblur,30,255,cv2.THRESH_BINARY) ...
navin7470/Opencv-Projects
opencv_motion_detector.py
opencv_motion_detector.py
py
933
python
en
code
1
github-code
90
24830284239
from flask import Blueprint from flask_restful import Api, Resource, reqparse, marshal import json from flask_jwt_extended import create_access_token, get_jwt_identity, jwt_required, get_jwt_claims from blueprints.client.model import Clients bp_auth = Blueprint('auth', __name__) api = Api(bp_auth) class CreateTokenRe...
farizap/Pair_project_restful
rest_svc/blueprints/auth/__init__.py
__init__.py
py
1,899
python
en
code
0
github-code
90
70762271018
""" Hacer una funciรณn que reciba un string y un nรบmero, y que devuelva el string, repetido el nรบmero de veces. Ejemplo: repetirCadena("Hola mundo", 3)//Devuelve: Hola mundoHola mundoHola mundo. """ def repetirCadena(texto, repetir): frase_repetida = texto * repetir return frase_repetida frase = "Hola mundo" nu...
AlexSR2590/logica_python
3-Ejercicios-logica/ejercicio14.py
ejercicio14.py
py
377
python
es
code
0
github-code
90
41236037253
# -*- coding: utf-8 -*- """ Created on Fri Jun 23 15:11:42 2023 @author: shwet """ import PIL import csv #import json file import json f=open('input.json') data=json.load(f) width=data['die']['width'] height=data['die']['height'] img1=PIL.Image.open("wafer_image_1.png") img2=PIL.Image.open("wafer...
ShwethaSureshKumar/KLA-Workshop
Level_2_Input_Data/mainv3.py
mainv3.py
py
764
python
en
code
0
github-code
90
26884596890
# Libraries import json # Function def write_notification(email: str, message: str): with open("email.json", "r+", encoding="utf-8") as f: content = json.loads(f.read()) if email not in content: content[email] = [] content[email].append(message) # Overwrite ...
sholguinc/twitter-api-fastapi
background.py
background.py
py
388
python
en
code
0
github-code
90
18109800749
import collections #ใƒ‡ใƒผใ‚ฟใฎๅ…ฅๅŠ› a=input().split() number=int(a[0]) quantum=int(a[1]) #ไฟๆŒใƒ‡ใƒผใ‚ฟใฎไฝœๆˆ time=0 #ใ‚ญใƒฅใƒผใฎไฝœๆˆ name=[] name=collections.deque() q=[] q=collections.deque() #็ป“ๆžœใฎไฟๆŒ result=[[0 for i in range(2)]for j in range(number)] endednumber=0 totaltime=0 for i in range(number): b=input().split() name.append(...
Aasthaengg/IBMdataset
Python_codes/p02264/s493572280.py
s493572280.py
py
829
python
zh
code
0
github-code
90
26758035077
import argparse import collections import json import logging import os import xml.etree.ElementTree __author__ = "Rafael Ferreira da Silva" logger = logging.getLogger(__name__) def _configure_logging(debug): """ Configure the application's logging. :param debug: whether debugging is enabled """ ...
pegasus-isi/panorama-pegasus-kickstart-parser
pegasus-kickstart-parser.py
pegasus-kickstart-parser.py
py
6,892
python
en
code
0
github-code
90
15329311685
""" Note: Currently, the GUI code is some of the oldest code in the library -- in particular much of it was developed before the network infrastructure was mature. As a result, a lot of modules are interdependent (eg. pass objects between each other). This will be corrected before v1.0 These classes i...
pauljerem/autopilot
autopilot/core/gui.py
gui.py
py
120,888
python
en
code
null
github-code
90
69851067176
'''Escribir una funciรณn que reciba una cadena y devuelva un diccionario con la cantidad de apariciones de cada palabra en la cadena.''' def contar_palabras(cadena): lista = cadena.split(' ') palabras = set(lista) palabrasRep = {} totalPalabras = {} for i in palabras: repeticiones =...
patoflyer/python_proyect_one
Ejercicios_Compu1/ContarPalabras.py
ContarPalabras.py
py
1,310
python
es
code
0
github-code
90
20906916472
import math import numpy import paddle import paddle.fluid as fluid from paddle.fluid import layers import random import sys import time import os from common import * class Constgat(object): """ model class """ def __init__(self, method, base_lr=0.05, fc_lr=0.01, reg=0.0001, is_fleet=False): ...
PaddlePaddle/Research
ST_DM/KDD2020-ConSTGAT/constgat.py
constgat.py
py
14,426
python
en
code
1,671
github-code
90
41332901620
class person: def __init__(self,name,age): self.name=name self.age=age @classmethod #======================ACTING AS ONE KIND OF A CONSTRUCTOR................... def fromstr(cls,string): name,age=string.split(",") return cls(name,int(age)) string="john,34" e=person.f...
rohit9098singh/python_programming
ch29_3_classmethod_as_constructor.py
ch29_3_classmethod_as_constructor.py
py
372
python
en
code
0
github-code
90
19300693258
import seaborn as sb import json import pandas as pd import matplotlib.pyplot as plt def plot_figure(data_name, baseline_run_data, ours_run_data, start_generations): row_list = [] for summary in [(baseline_run_data, "baseline"), (ours_run_data, "Improved")]: for round_data in summary[0][data_name]["mi...
ZZwarn1998/MTSP_NSGA_II
summary_figure/plot_figure.py
plot_figure.py
py
1,443
python
en
code
1
github-code
90
71095884777
# https://leetcode.com/problems/minimum-penalty-for-a-shop # medium # practice missed contest - biweekly 92 class Solution: def bestClosingTime(self, customers: str) -> int: open_penalties = [0 if ch == 'Y' else 1 for ch in customers] prev_open = 0 for i, ch in enumerate(customers): ...
gerus66/leetcode
medium/2483_minimum_penalty_for_a_shop.py
2483_minimum_penalty_for_a_shop.py
py
1,112
python
en
code
0
github-code
90
17952236689
a, b, c, d, e, f = map(int, input().split()) max_nodo = 0 ans = [100*a, 0] for i in range(30//a+1): for j in range(30//b+1): mizu = 100*i*a + 100*j*b if mizu > f: break if mizu == 0: continue maxi = (i*a + j*b) * e for k in range(maxi//c+1): for l in range(maxi//...
Aasthaengg/IBMdataset
Python_codes/p03599/s332603246.py
s332603246.py
py
617
python
en
code
0
github-code
90
27925955071
import heapq class Trainer(object): def __init__(self, model=None, criterion=None, optimizer=None, dataset=None): self.model = model self.criterion = criterion self.optimizer = optimizer self.dataset = dataset self.iterations = 0 self.stats = {} self.plugin...
sibozhang/Text2Video
venv_vid2vid/lib/python3.7/site-packages/torch/utils/trainer/trainer.py
trainer.py
py
2,490
python
en
code
381
github-code
90
18306684539
import sys input = sys.stdin.readline from collections import defaultdict, deque n, s, res, MOD = int(input()), list(map(int, input().split())), 0, int(1e9) + 7 for i in range(61): x, c = int(pow(2, i, MOD)), [0, 0] for j in range(n): c[1 if s[j] & 1 << i else 0] += 1 x = (x * c[0]) % MOD; x = (x * c[1]) %...
Aasthaengg/IBMdataset
Python_codes/p02838/s416898728.py
s416898728.py
py
358
python
en
code
0
github-code
90
2845137428
from enum import Enum from django.db.models import Case, TextChoices, Value, When from django.db.models.expressions import Expression class OrderedTextChoices(TextChoices): @classmethod def order(cls, field_name: str) -> Expression: return Case(*( When(**{field_name: attribute.label}, the...
logikal-io/django-logikal
django_logikal/models.py
models.py
py
482
python
en
code
2
github-code
90
20548344777
## Created by Tapani Hopkins, 2021 ## Partly based on code by Adrian Rosebrock: ## https://www.pyimagesearch.com/2017/02/06/faster-video-file-fps-with-cv2-videocapture-and-opencv/ ## CC0 (i.e. free to use) as far as Tapani is concerned. ## Adrian Rosebrock's code is free to use EXCEPT if you are developing a course, bo...
tapani-hopkins/analyse-videos
analyse.py
analyse.py
py
4,543
python
en
code
0
github-code
90
4195931688
from collections import OrderedDict import dash_html_components as html import dash_core_components as dcc from dash_cytoscape import Cytoscape import networkx as nx from propnet.core.graph import Graph from propnet.web.utils import graph_conversion, GRAPH_LAYOUT_CONFIG, \ GRAPH_STYLESHEET, GRAPH_SETTINGS, propn...
materialsintelligence/propnet
propnet/web/layouts_models.py
layouts_models.py
py
5,873
python
en
code
66
github-code
90
30007468840
import sys from scapy.config import Conf from scapy.utils import rdpcap from scapy.layers.dot15d4 import Dot15d4FCS, Dot15d4Data from scapy.layers.zigbee import ZigbeeNWK, ZigbeeSecurityHeader from Cryptodome.Cipher import AES from binascii import unhexlify import struct from struct import pack, unpack import json # Z...
mingqian/zigbee-viewer
zigbee-viewer.py
zigbee-viewer.py
py
6,731
python
en
code
9
github-code
90
39064836187
import pprint, sys, os from PfsenseFauxapi.PfsenseFauxapi import PfsenseFauxapi from dotenv import load_dotenv load_dotenv() hostip = os.getenv("HOST_IP") apikey = os.getenv("API_KEY") apisecret = os.getenv("API_SECRET") PfsenseFauxapi = PfsenseFauxapi(hostip, apikey, apisecret) ########## Script starts here ######...
nasirhafeez/pfsense-fauxapi-scripts
get_interface_stats.py
get_interface_stats.py
py
392
python
en
code
0
github-code
90
36217038016
''' Created on Nov 9, 2017 @author: pshastri ''' from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import time driver=webdriver.Firefox() driver.get("https://www.netiq.com/") driver.maximize_window() support= driver.find_element_by_xpath("//*[@id='nav_service']") ActionC...
pshastri/Selenium
src/NetIQ.py
NetIQ.py
py
503
python
en
code
0
github-code
90
41457268234
import contextlib import logging import os from collections import defaultdict from random import random from ex_2 import INPUT_FILE, DATASET, SAMPLE_RATE, CORRECT_LABEL, INCORRECT_LABEL, ALGORITHM from ex_2.evaluation import initialize_stats logger = logging.getLogger(__name__) def add_words(phrase, dictionary): ...
aserpi-uni/msecs-ml
ex_2/data_preprocessing.py
data_preprocessing.py
py
1,682
python
en
code
1
github-code
90
2674349254
# Sample code from the TorchVision 0.3 Object Detection Finetuning Tutorial # http://pytorch.org/tutorials/intermediate/torchvision_tutorial.html #benchmark reference on VOC #https://github.com/jwyang/faster-rcnn.pytorch import os import numpy as np import torch from PIL import Image import torch.nn.functional as F i...
manoja328/rodeo
train_better.py
train_better.py
py
11,703
python
en
code
25
github-code
90
20040082796
#!/usr/bin/env python3 import serial, threading, time, os, socket, queue, math from housepy import config, log, timeutil class ESPListener(threading.Thread): def __init__(self, port=23232, message_handler=None, blocking=False): super(ESPListener, self).__init__() self.daemon = True self....
brianhouse/templeton_esp
dev/esp_link.py
esp_link.py
py
3,042
python
en
code
0
github-code
90
70361686056
import numpy as np from l2_distance import l2_distance def run_knn(k, train_data, train_labels, valid_data): """Uses the supplied training inputs and labels to make predictions for validation data using the K-nearest neighbours algorithm. Note: N_TRAIN is the number of training examples, N_V...
yimingkang/CSC411_hw1
csc411_2515_a1/python/run_knn.py
run_knn.py
py
1,414
python
en
code
4
github-code
90
27242146152
"""1 - Um usuรกrio (diabรฉtico) de insulina rรกpida precisa fazer uso do medicamento sempre que for realizar uma refeiรงรฃo. Assim, faรงa um programa que receba do usuรกrio sua glicemia do momento (mg/dl),meta prรฉ-refeiรงรฃo (em geral รฉ 100 mg/dl), fator de sensibilidade (valor inteiro entre 20 a 60). A partir desses valo...
joaovritter/python-basico
Quantificando Preposiรงรตes - Aula 10.08 e 17.08/exercicio1.py
exercicio1.py
py
926
python
pt
code
0
github-code
90
13002453768
# ๋ฌธ์ž์—ด๋กœ ํ’€์–ด์„œ ์‹œ๊ฐ„์ดˆ๊ณผ๊ฐ€ ์ƒ๊ธด๋“ฏํ•˜๋‹ค ''' n = input() if len(n) == 1: n = '0'+ n count = 0 while True: sum = str(int(n[0]) + int(n[1])) new = n[1] + sum[-1] count += 1 if new == n: break print(count) ''' # ์ˆซ์ž๋กœ ํ‘ผ ํ’€์ด ์•Œ์•„๋‘๊ธฐ num = n = int(input()) count = 0 while True: ten = num //10 one ...
hyeinkim1305/Algorithm
Bronze/1110๋ฒˆ/1110.py
1110.py
py
516
python
ko
code
0
github-code
90
9034647280
# -*- coding: utf-8 -*- import tkinter as tk import os from Transmission import fileRead dir_path = os.getcwd() def crash_call_back(): # Crashไธ‹่ฝฝ็š„็ช—ๅฃ def get_crash(*args): indexs = crash_list_box.curselection()[0] out_name = crash_list_box.get(indexs) return out_name ...
you282507/adb-tools-tk
Crash.py
Crash.py
py
2,110
python
en
code
0
github-code
90
42007058506
from typing import List, Optional from pandera.errors import SchemaErrors from pandas_type_checks.errors import PandasTypeCheckError def pandera_schema_errors_to_type_check_errors(schema_errors: SchemaErrors) -> List[PandasTypeCheckError]: """ Transform a Pandera ``SchemaErrors`` exception into the...
mzuber/pandas-type-checks
src/pandas_type_checks/pandera_support.py
pandera_support.py
py
1,154
python
en
code
1
github-code
90
35667890584
import logging import os import re import subprocess import traceback from cros.factory.utils import file_utils from cros.factory.utils import service_utils RETRY_COUNT = 3 class CpufreqManager: """Manager for CrOS-specific services that mess with cpufreq. If disabled, we disable CrOS-specific cpufreq managem...
modevans2100/factory
py/test/utils/cpufreq_manager.py
cpufreq_manager.py
py
5,135
python
en
code
0
github-code
90
19208888938
from Levenshtein import distance from core import config import logging from pprint import pprint logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def _title_comparator(listEntry, torrentCollection): try: collection_values = torrentCollection.synonymns + [torrentCollection.title] ...
twissell-/rui
rui/core/selector.py
selector.py
py
3,696
python
en
code
0
github-code
90
18534931039
x = int(input()) ans = 0 for i in range(1,32): for p in range(2,10): y = i**p if y > 1000: break if ans < y <= x: ans = y print(ans)
Aasthaengg/IBMdataset
Python_codes/p03352/s255588006.py
s255588006.py
py
185
python
en
code
0
github-code
90
8472482926
import sys sys.setrecursionlimit(10**3) def d(n): sn = n while n != 0: sn += n%10 n //= 10 if sn > 10000: return lst[sn] = 1 return d(sn) lst = [ 0 for _ in range(10001)] for i in range(1, 10001): if lst[i] == 0: print(i) d(i)
JHW0900/Problem_Sloving
BOJ/4673.py
4673.py
py
257
python
en
code
0
github-code
90
24471311732
import scapy.all as scapy from termcolor import colored import time import subprocess import os def get_mac(ip): arp_request = scapy.ARP(pdst=ip) broadcast_MAC = scapy.Ether(dst='ff:ff:ff:ff:ff:ff') arp_request_broadcast_MAC = broadcast_MAC/arp_request ans_list = scapy.srp(arp_request_broadcast_MAC, t...
we-re-wolf/Network-Security
Spoofers/arp_spoof.py
arp_spoof.py
py
1,590
python
en
code
0
github-code
90
19444511415
from apps.common.func.CommonFunc import * from apps.common.func.LanguageFunc import * from django.shortcuts import render, HttpResponse from urllib import parse from apps.common.config import commonWebConfig from apps.common.func.WebFunc import * from apps.ui_globals.services.global_textService import global_textServic...
LianjiaTech/sosotest
AutotestWebD/apps/ui_globals/views/global_text_conf.py
global_text_conf.py
py
6,342
python
en
code
489
github-code
90
18225890309
import pdb import pytest import json from main import create_app, db ticket = { "ticket_id": 2, "subject": " And had in was fabled seraphs nor it beyond", "phone": 2547900000, "intents": "['test', 'test2']" } patch_ticket = { "ticket_id": 2, "subject": " And had in was fabled seraphs nor it b...
sylviawanjiku/Jacaranda
test_jacaranda.py
test_jacaranda.py
py
3,263
python
en
code
0
github-code
90
1442232487
from tempfile import gettempdir from pathlib import Path from json import loads, dumps from config import Config from payload import Payload from aws import AWS from uuid import uuid4 from skeletal_extract import SkeletonExtractor from status import StatusTable, AnalyzeStatus from aws_xray_sdk.core import xray_recorder...
dr-natetorious/Dissertation
cdk/src/pipeline/openposer/handler.py
handler.py
py
3,077
python
en
code
0
github-code
90
23774168635
from functools import partial from typing import Any, Optional import logging from pysmt.fnode import FNode from pysmt.shortcuts import simplify, FALSE, TRUE, Real, Symbol from pysmt.typing import BOOL, REAL from .operation import Multiplication, Summation from .decision import Decision from pywmi.smt_math import Pol...
weighted-model-integration/pywmi
pywmi/engines/pyxadd/resolve.py
resolve.py
py
16,161
python
en
code
17
github-code
90
5129436937
from django.conf.urls import url from . import views app_name = 'django_airavata_admin' urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^applications/', views.app_catalog, name='app_catalog'), url(r'^credentials/', views.credential_store, name='credential_store'), url(r'^experiment-statisti...
unlhcc/rna-nanostructures-2021
django_airavata/apps/admin/urls.py
urls.py
py
719
python
en
code
0
github-code
90
13490729036
def fibo(n): a=0;b=1 print(a,'\n',b) for i in range(2,n): c=a+b print(c) a=b b=c n=int(input("Enter no. of elements(please enter more than 2):")) fibo(n)
rajmanchale/DataStructures-Algorithms
fibonacci.py
fibonacci.py
py
164
python
en
code
0
github-code
90
5719426636
import os, sys scriptPath = os.path.abspath(__file__) scriptDir = os.path.dirname(scriptPath) relPath = 'listManage' reqPath = os.path.join(scriptDir, relPath) sys.path.append(reqPath) import arcpy, listManager2 def main(): infile = sys.argv[1] field = sys.argv[2] if __name__ == '__main__': main()
Johanson20/Python4Geoprocessing
ch16/exercises/listUniqueValues.py
listUniqueValues.py
py
315
python
en
code
0
github-code
90
4717576487
import sys INF = int(1e9) n, m = map(int, sys.stdin.readline().split()) graph = [[INF] * (n + 1) for _ in range(n + 1)] for _ in range(m): a, b, c = map(int, sys.stdin.readline().split()) graph[a][b] = c for a in range(n + 1): graph[a][a] = 0 for k in range(1, n + 1): for a in range(1, n + 1): ...
ambosing/PlayGround
Python/Problem Solving/ETC_algorithm_problem/8-12 Floyd-Warshaall.py
8-12 Floyd-Warshaall.py
py
668
python
en
code
0
github-code
90
9788603167
#!/usr/bin/python from matplotlib import pyplot import main @main.command def layers(offset=4, *positions): "Plots grid with offset positions" positions = set(int(p) for p in positions) positions.add(0) radius = 3 * 12 R = list(range(radius + 1)) def marked(p, x, y): return (x + of...
fritzo/kazoo
test/chords.py
chords.py
py
1,078
python
en
code
5
github-code
90
18497852079
import sys def solve(): input = sys.stdin.readline H, W = map(int, input().split()) A = [[int(a) for a in input().split()] for _ in range(H)] Ans = [] for n in range(H * W - 1): h, w = n // W, n % W if A[h][w] % 2 == 1: if w < W - 1: Ans.append((h+1, w+1,...
Aasthaengg/IBMdataset
Python_codes/p03263/s303110335.py
s303110335.py
py
656
python
en
code
0
github-code
90
19663759951
from __future__ import annotations from enum import Enum from typing import Any from valohai_yaml.lint import LintResult from valohai_yaml.objs.base import Item from valohai_yaml.objs.utils import ( check_type_and_listify, consume_array_of, ) from valohai_yaml.objs.variant_parameter import VariantParameter fr...
valohai/valohai-yaml
valohai_yaml/objs/task.py
task.py
py
2,756
python
en
code
3
github-code
90
44215858005
import logging import sys import argparse import yaml from src.data.process_media import process_media from src.data.label import run_labeling, apply_mirror_labels from src.features.extract_landmarks import extract_landmarks_for_videos, extract_landmarks_for_photos from src.features.make_features import extract_feature...
SloughJE/aerial_straps_classifier
run_pipelines.py
run_pipelines.py
py
3,864
python
en
code
1
github-code
90
36437150039
import pygame from src.components.SpriteSheet import SpriteSheet from src.components.Coin import Coin from src.components.Enemy import Enemy from src.components.Finish import Finish from src.utils.getDataFromJSON import getDataFromJSON class Level: def __init__( self, screen, colors, camera, solid_tiles, walls...
Luc4r/Rectov
src/components/Level.py
Level.py
py
4,872
python
en
code
0
github-code
90
30961711377
import sys def main(): prisms = [(3, 1, 5, 7), (3, 3, 4, 9), (2, 4, 7, 8)] print('The following is the tuples for prisms:') print_prisms(prisms) print_densities(prisms) def density_formula(mass, length, width, height): density = mass / (length * width * height) return density def calc_den...
zolangi/complang-course
samplefinal/density.py
density.py
py
1,203
python
en
code
0
github-code
90
3721041708
import os from . import database as db def __check_primers(db1, db2): if db1.trim_primers != db2.trim_primers: print("!! WARNING !! Please, before merging make sure primers are kept or trimmed for both database.") exit() return def is_SA(taxon): if taxon.split("_")[1][:2] == "SA": ...
cplessis/ASVmaker
src/asvmaker/merge.py
merge.py
py
6,838
python
en
code
1
github-code
90
29988504421
###็‰นๆฎŠๆ–นๆณ• class student: def __init__(self, name, age): self.name = name self.age = age def __add__(self, other): return self + other stu1 = student('zhangsan', 10) stu2 = student('lisi', 20) s = stu1.name.__add__(stu2.name) print(s)
gaoleifx/Python_project
Study/16class.py
16class.py
py
274
python
en
code
0
github-code
90
30875419016
# BOJ_12015_gold2-๊ฐ€์žฅ๊ธด์ฆ๊ฐ€ํ•˜๋Š”๋ถ€๋ถ„์ˆ˜์—ด2 import sys from bisect import bisect_left input = sys.stdin.readline n = int(input()) lst = list(map(int, input().split())) seq = [lst[0]] ans = 1 for num in lst[1:]: # ์ˆ˜์—ด์˜ ๋ ๊ฐ’๊ณผ ๋น„๊ตํ•ด์„œ ๋” ํฌ๋ฉด ๋‹ด๋Š”๋‹ค if seq[-1] < num: seq.append(num) ans += 1 # ์ˆ˜์—ด์˜ ๋ ๊ฐ’๊ณผ ๋น„๊ตํ•ด์„œ ๋”...
Lee-hanbin/Algorithm
Python/BOJ/Gold/BOJ_12015_gold2-๊ฐ€์žฅ๊ธด์ฆ๊ฐ€ํ•˜๋Š”๋ถ€๋ถ„์ˆ˜์—ด2/BOJ_12015_gold2-๊ฐ€์žฅ๊ธด์ฆ๊ฐ€ํ•˜๋Š”๋ถ€๋ถ„์ˆ˜์—ด2.py
BOJ_12015_gold2-๊ฐ€์žฅ๊ธด์ฆ๊ฐ€ํ•˜๋Š”๋ถ€๋ถ„์ˆ˜์—ด2.py
py
580
python
ko
code
3
github-code
90
25576917947
a, b, c = map(int, input().split(" ")) d = list(range(b, c+1)) if a in d: print(a) else: _prev = d[0] _prevm = min(abs(a-d[0]), abs(d[0]-a)) del d[0] for i in d: _temp = min(abs(a-i), abs(i-a)) if _temp < _prevm: _prev = i _prevm = _temp print(_prev)
MisileLab/h3
projects/xobusy/bojs/problems/BronzeIV/18414.py
18414.py
py
316
python
en
code
2
github-code
90
13503748637
import subprocess import time import re import numpy as np from kernel_tuner.observers import BenchmarkObserver, ContinuousObserver try: import pynvml except ImportError: pynvml = None class nvml(): """Class that gathers the NVML functionality for one device""" def __init__(self, device_id=0, nvidia...
webclinic017/kernel_tuner
kernel_tuner/nvml.py
nvml.py
py
16,970
python
en
code
null
github-code
90
17068359182
t = int(input()) def baby_gin(player_card): for i in range(len(player_card)): if player_card[i] >=3: # Triplet return True if i <= 7: # run ๊นŒ์ง€ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ๋Š” ์ƒํ™ฉ์ด๋ผ๋ฉด if player_card[i] > 0 and player_card[i+1] > 0 and player_card[i+2] > 0: # run ์ฒดํฌ return True ret...
sudo-bin/algorithm_study
solved/swea/5203_๋ฒ ์ด๋น„์ง„_๊ฒŒ์ž„.py
5203_๋ฒ ์ด๋น„์ง„_๊ฒŒ์ž„.py
py
966
python
en
code
0
github-code
90
44664684423
from itertools import count, cycle counter = 0 for i in cycle('123'): if counter > 15: break print(i) counter += 1 for i in count(7): if i > 10: break print(i) var = '123' for i in count(): if i >= 3: break for number, j in enumerate(cycle(var)): if numb...
evgeniy879/python.lesson
lesson4/task6.py
task6.py
py
372
python
en
code
0
github-code
90
43890542703
# # Straightforward generator to produce Fibonacci numbers using the following rule: # f(0) = 1 # f(1) = 1 # f(n) = f(n-1) + f(n-2) where n>=2 # def fibonacci(): a = 0 b = 1 while True: yield b a, b = ( b, a + b, ) # Use Python's clever way of swapping va...
keberlin/JazzNetworks
code.py
code.py
py
2,724
python
en
code
0
github-code
90
2331344665
import pytest def test_file1_method1(): x=5 y=6 assert x+1 == y,"test failed" assert x == y,"test failed" def test_file1_method2(): x=5 y=6 assert x+1 == y,"test failed" #Pytest Fixtures: Fixtures are used when we want to run some code before every test method. So instead of repeating the same code in every t...
hemanthmathengineer/194407_UST_SDET_Training
Python/PythonSeleniumPrograms/PytestExample1.py
PytestExample1.py
py
600
python
en
code
1
github-code
90
12222151940
import random from datetime import datetime import time # set time to start the journey start = "22/05/2021 06:00:00" print(f'Start date is {start}') d = datetime.strptime(start, "%d/%m/%Y %H:%M:%S") t0 = time.mktime(d.timetuple()) fuel_burn_rate = 0.009 / 10000 # Information about the journey of the spaceship in sp...
tuananh131001/pythonassignment3
basic_info.py
basic_info.py
py
3,486
python
en
code
0
github-code
90
1730508952
from models import User from models import Weibo from models import Comment from response import session from response import template from response import response_with_headers from response import redirect from response import error from utils import log def current_user(request): session_id = request.cookies...
wangweikang/XiaoGua
class012/routes_weibo.py
routes_weibo.py
py
5,436
python
en
code
6
github-code
90