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
18020334039
def input_li(): return list(map(int, input().split())) def input_int(): return int(input()) N, M = input_li() A_LI = [] B_LI = [] for _ in range(N): A_LI.append(input()) for _ in range(M): B_LI.append(input()) for i in range(N - M + 1): for j in range(N - M + 1): is_ok = True for c...
Aasthaengg/IBMdataset
Python_codes/p03804/s734935461.py
s734935461.py
py
612
python
en
code
0
github-code
90
74769273896
from vpython import * # Criar o Sol e planetas sun = sphere(pos=vector(0, 0, 0), radius=2, color=color.yellow) earth = sphere(pos=vector(10, 0, 0), radius=1, color=color.blue) mars = sphere(pos=vector(15, 0, 0), radius=0.8, color=color.red) venus = sphere(pos=vector(7, 0, 0), radius=0.9, color=color.orange) mercury = ...
becegato/modelo-3D-de-um-sistema-solar-simples
sis_solar_3D.py
sis_solar_3D.py
py
1,349
python
en
code
0
github-code
90
36841346747
from django.shortcuts import render,redirect from django.urls import reverse from django.core.files.storage import FileSystemStorage from .models import Gallery fs = FileSystemStorage() # Create your views here. def home(request): gallery = Gallery.objects.all() return render(request,"multipleimagesapp/home.ht...
skprasad117/Multiple_Image_Upload
multipleimagesapp/views.py
views.py
py
4,169
python
en
code
0
github-code
90
32798381577
#basic modules import requests import datetime import json import time import sys #sqlalchemy essentials from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy import func #modules from requests specifically from requests.adapters import HTTPAdapter from requests.packages.urllib3...
wolflex888/CryptoDB
src/CoinMetrics.py
CoinMetrics.py
py
8,367
python
en
code
1
github-code
90
12976710314
import os from tqdm import tqdm from time import time import requests from lxml import html from bs4 import BeautifulSoup from utils import get_path_of_all_xml_file, walkData input_file_lst = get_path_of_all_xml_file() nctid_lst = [file.split('/')[-1].split('.')[0] for file in input_file_lst] nctid = 'NCT03469336' ...
futianfan/HINT
src/collect_publication.py
collect_publication.py
py
1,510
python
en
code
0
github-code
90
18262017089
import sys N,M = map(int,input().split()) s = [0] * M c = [0] * M a = ["-1"] * (N) if N == 1 and M == 0: print(0) sys.exit() for i in range(M): s[i],c[i] = map(int,input().split()) for j in range(M): if s[j] == 1 and c[j] == 0 and N != 1: print(-1) sys.exit() elif a[s[j]-1] == "-1":...
Aasthaengg/IBMdataset
Python_codes/p02761/s091691597.py
s091691597.py
py
569
python
en
code
0
github-code
90
8367357728
import logging import math import json from dynamodb_json import json_util as jsonDB import boto3 from datetime import datetime, timedelta from zoneinfo import ZoneInfo #Needed because Lambda runs on a different timezone time_zone = ZoneInfo("Canada/Eastern") table_names = ['Weather_API_toronto', 'Weather_API_kingston...
Randerd/Weather-statistics
AWS/dynamoDB/get_statistics.py
get_statistics.py
py
5,242
python
en
code
0
github-code
90
34813565410
# Cara mengakses nilai Entry from tkinter import* def Click(): ouput_entry = inputen.get() tulisan2 = Label(root, text = ouput_entry) tulisan2.pack() print(ouput_entry) root = Tk() tulisan1 = Label(root, text = 'Masukan inputan anda !') tulisan1.pack() inputen = StringVar() inputan1 = Entry(root, wi...
ekawahanaputra/Belajar_Python
3_Tkinter/8_Akses_Nilai_Entry.py
8_Akses_Nilai_Entry.py
py
1,283
python
id
code
0
github-code
90
11799894491
from PIL import Image from cStringIO import StringIO class ImageRotater(object): def __init__(self, raw_data, quality=65): self.raw_data = raw_data self._quality = quality @classmethod def from_raw_string(cls, raw_data): try: return cls(raw_data) except IOErro...
slobdell/blimp-client
blimp_client/common/image_rotater.py
image_rotater.py
py
832
python
en
code
0
github-code
90
46371473283
import numpy as np import pickle import unmask import ann import pca from PIL import Image, ImageFilter import os #Must be odd! region_dim = 7 img_dither_folder = "./data/dither/" img_orig_folder = "./data/orig/" def mirror_load(img_in): img_file = Image.open(img_in) img_file = unmask.unmask(img_file) wi...
liampulles/WITS_Repo
brain_undither/code/brain.py
brain.py
py
6,118
python
en
code
0
github-code
90
73261279018
import nextcord from nextcord.ext import commands from config import teal,msglogs import datetime class Delete(commands.Cog): def __init__(self, client): self.client = client @commands.Cog.listener() async def on_message_delete(self, message): if message.author.bot: return ...
Moaz-07/Nebula
events/message/on_message_delete.py
on_message_delete.py
py
815
python
en
code
0
github-code
90
18961909201
from django.contrib import admin from .models import Repeater, RepeaterLocation, RepeaterDigitalModes, RepeaterLinkModes class RepeaterLocationInlineAdmin(admin.TabularInline): model = RepeaterLocation extra = 0 class RepeaterLinkModesInlineAdmin(admin.TabularInline): model = RepeaterLinkModes extra...
kamodev/repeater_list
repeaters/admin.py
admin.py
py
703
python
en
code
0
github-code
90
73875791978
import argparse import sys import os import torch import torch.nn.parallel from torch.autograd import Variable import torch.optim as optim BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.abspath(os.path.join(BASE_DIR, '../../'))) sys.path.append(os.path.abspath(os.path.join(BASE_DIR, '.....
ArthLeu/beta-capsnet
main/latent_processes/decode_and_viz.py
decode_and_viz.py
py
3,536
python
en
code
0
github-code
90
7542740918
import math import csv import pandas as pd import matplotlib.pyplot as plt N = 30 # полное число испарившихся частиц L = 900 # ML - длина НП dL_count = 20 # число разбиений всей длины НП dL = L/dL_count # длина одного фрагмента длины НП a = 70 # а.м. - расстояние между НП dx_count = 70 # число разбиений расстояния м...
nastalla/Reevaporation
Reevaporation.py
Reevaporation.py
py
1,711
python
ru
code
0
github-code
90
23855385118
# ( (C1 ^ (p-1-d) mod p) * (C2 mod p) ) mod p = m def blockDecrypt(cpair, keys): """ :param cpair: tuple of ciphertext ints :param keys: dictionary with p and d :return: one block of plaintext integer form """ print("\n\n", cpair, "\n\n") cOne = cpair[0] cTwo = cpair[1] p = keys['p...
laurenschneider/Public-Key-Crypto
decrypt.py
decrypt.py
py
956
python
en
code
0
github-code
90
74094140456
import matplotlib.pyplot as plt from time import time from gem.utils import graph_util, plot_util from gem.evaluation import visualize_embedding as viz from gem.evaluation import evaluate_graph_reconstruction as gr from gem.embedding.gf import GraphFactorization from gem.embedding.hope import HOPE from...
GarrettMerz/Projects
RollerDerby/GEM/examples/run_derby.py
run_derby.py
py
6,090
python
en
code
0
github-code
90
18265293509
n, k = map(int, input().split(" ")) def calc(n, k): r = "" while n > 0: n, remainder = divmod(n, k) r += str(remainder) return r[::-1] print(len(calc(n, k)))
Aasthaengg/IBMdataset
Python_codes/p02766/s159393095.py
s159393095.py
py
189
python
en
code
0
github-code
90
24830754832
from django.urls import path from . import views urlpatterns = [ path('signup/', views.SignUp.as_view(), name='signup'), path('superuser_required/', views.SuperuserRequired.as_view(), name="superuser_required"), path('verify_account/<uidb64>/<token>/', views.verify_account, name="verify_account"), # ...
p-flis/dinofood
accounts/urls.py
urls.py
py
410
python
en
code
2
github-code
90
4683642066
import numpy as np import cv2 # 画像ファイルをカラーで読み込み org_img = cv2.imread('yorkie.png', cv2.IMREAD_COLOR) # cv2.copyToでコピーする mask = np.full(org_img.shape, 255, np.uint8) cv_copy_img = cv2.copyTo(org_img, mask) # numpy.ndarray.copyでコピーする numpy_copy_img = org_img.copy() # shallow copyでコピーする shallow_copy_img = org_img # コ...
ghmagazine/opencv_dl_book
ch3/3.2/copy_image.py
copy_image.py
py
730
python
ja
code
33
github-code
90
2234017928
# Start, mid, end # Every iteration # End, and mid will move # # abbaa # <>abbaa # <a>bbaa # <a|b>baa # <abb>aa # <ab|ba>a # <abbaa> # a<bb|aa> # ab<baa> class Solution: def countSubstrings(self, s: str) -> int: s = '$#' + '#'.join(list(s)) + '#@' i, c, r, mir = 1, 1, 1, 1 n = len(s) ...
vyshor/LeetCode
Palindromic Substrings.py
Palindromic Substrings.py
py
1,663
python
en
code
0
github-code
90
5911538370
import datetime import io import pathlib from faker import Faker import pytest from isic.stats.models import GaMetrics, ImageDownload from isic.stats.tasks import ( _cdn_access_log_records, collect_google_analytics_metrics_task, collect_image_download_records_task, ) fake = Faker() data_dir = pathlib.Pa...
ImageMarkup/isic
isic/stats/tests/test_tasks.py
test_tasks.py
py
4,598
python
en
code
3
github-code
90
18235706199
from collections import Counter def solve(): N = int(input()) S = list(input()) c = Counter(S) ans = c['R']*c['G']*c['B'] for i in range(N): for j in range(i+1,N): k = j*2-i if k>N-1: break if S[i]!=S[j] and S[j]!=S[k] and S[i]!=S[k]: ans -= 1 return ans print(solve())
Aasthaengg/IBMdataset
Python_codes/p02714/s452562527.py
s452562527.py
py
320
python
en
code
0
github-code
90
20206491579
from gf import Gf from block_gf import BlockGf from block2_gf import Block2Gf def map_block(fun, G): """ Map function f(Gf)->Gf to every element of a BlockGf or Block2Gf """ if isinstance(G, BlockGf): block_list = [fun(bl) for name, bl in G] if isinstance(block_list[0], Gf): ...
parcollet/mda1
pytriqs/gf/map_block.py
map_block.py
py
890
python
en
code
0
github-code
90
27367895742
# -*- coding: utf-8 -*- from src.utilities import time_modification from src.market_understanding import futures_analysis def test_combining_individual_futures_analysis(): index_price = 10.0 expiration = "2023-02-01 00:00:00" expiration_timestamp = time_modification.convert_time_to_unix(expiration) fu...
venoajie/MyApp
tests/test_mkt_undrstg_fut_anlys.py
test_mkt_undrstg_fut_anlys.py
py
1,214
python
en
code
2
github-code
90
42842064090
__author__ = 'dev' # for i in range(10): # print('i is now {}'.format(i)) # i = 0 # while i < 10: # print('i is now {}'.format(i)) # i +=1 # availableExits = ['east', 'north east', 'south'] # # chosenExits ='' # while chosenExits not in availableExits: # chosenExits = input('Please choose a direction...
ChristopherDaigle/Learning_and_Development
Udemy/Learn_Python_Programming_Masterclass/While/while.py
while.py
py
1,830
python
en
code
0
github-code
90
209574958
import os import subprocess import sys import time import uuid import boto3 import yaml def upload_video(): """ Upload the video to S3 Bucket. """ s3_client = boto3.client("s3") # Create the bucket if not exists (idempotent). s3_client.create_bucket(Bucket=s3_bucket_name) s3_client.upload...
ileoyang/dolphin-subtitle-generator
dolphin.py
dolphin.py
py
2,110
python
en
code
0
github-code
90
31850250810
from vpython import color, cross, gcurve, graph, mag, norm, rate, sphere, vector G = 6.67e-11 RES = 1.5e11 MS = 2e30 ME = 5e29 ve = 3.4e4 g1 = graph(xtitle="t [s]", ytitle="Lz [kg*m^2/s]", width=450, height=200, ymin=0) fp = gcurve(color=color.blue) fs = gcurve(color=color.red) ft = gcurve(color=color.green) sun = ...
marcbaetica/Physics-Simulations
planetary_angular_momentum/planetary_angular_momentum.py
planetary_angular_momentum.py
py
1,140
python
en
code
0
github-code
90
36985159372
# Node class SLNode: # - Constructor # -val # - next def __init__(self, value): self.value = value self.next = None # SinglyLinkList # -Constructor # - head class SList: def __init__(self): self.head = None # - addFront(val) # - add a new...
SaudiWebDev2020/Wijdan_Kuddah
algorithms/weekSix/dayTwo.py
dayTwo.py
py
3,454
python
en
code
0
github-code
90
74014288296
#!/usr/bin/env python import xml.etree.ElementTree as ET import ipdb it = ET.iterparse("full_data/simplewiki.xml") tagprefix = "{http://www.mediawiki.org/xml/export-0.10/}" class Ctx: def __init__(self): self.idx = 0 def fname(self, page): return f"full_data/articles/article_{self.idx}.txt"...
rsepassi/chat
wikidump.py
wikidump.py
py
1,138
python
en
code
1
github-code
90
36507673617
""" This module contains the selenium master functionality that controls the selenium web drivers. """ import typing as t import logging import abc import time from seproxer.selenium_extensions import webdriver_factory from seproxer.selenium_extensions import states from seproxer.selenium_extensions import validators ...
Rastii/seproxer
seproxer/selenium_extensions/controller.py
controller.py
py
4,736
python
en
code
8
github-code
90
40319783059
import numpy as np from scipy.stats.mstats import gmean from gnuradio import gr import random class SynchronizeAndEstimate(gr.sync_block): def __init__(self, case, num_bins, diagnostics, freq_offset, bin_selection, buffer_on, buffer_size, seed_value): self.case = 0 self.case = case self.n...
akyerr/5GWifi_GNURadio
gr-RX_OFDM/python/SynchronizeAndEstimate.py
SynchronizeAndEstimate.py
py
22,846
python
en
code
2
github-code
90
14154241743
t = int(input('')) l = [] for i in range(t): a, b = input().split() a = int(a) b = int(b) l.append(a+b) for j in range(t): print(l[j]) ''' c언어도 마음만 먹으면 배열로 지정하여 한번에 입력받고, 한번에 출력할 수 있지만 파이썬 리스트로 구현해보고 싶어서 리스트를 활용함. '''
suyeon0305/backjoon
210801_백준_#10950.py
210801_백준_#10950.py
py
349
python
ko
code
0
github-code
90
32346959149
guesTList = ['00-CC-00','01-CC-01','02-CC-02','03-CC-03','04-CC-04', '05-CC-05','06-CC-06','07-CC-07','08-CC-08','09-CC-09'] parklist = [] countEntrada = 0 matricula = "" def parkManager(matricula,movimento): global countEntrada if movimento.upper() == "E": parklist.append(matricula) countEntr...
lisboaab/AED-refaz-exs
testes anteriores/normal22-23/pt1-estacionamento.py
pt1-estacionamento.py
py
1,393
python
pt
code
0
github-code
90
31109925067
from base import Animation import math class Positional(Animation): def __init__(self, config): super(Positional, self).__init__(config) self.brightness = 1.0 # Look at the range of notes assigned to this animations # In order to determine the min and max self.min = min(se...
mykolasmith/sierra
animation/positional.py
positional.py
py
2,065
python
en
code
4
github-code
90
35372275723
from Nodes import Nodes class HillClimbing: def __init__(self, state): super().__init__() self.start_node = Nodes(state) def first_choice(self, max_sidesteps=0): current_node = self.start_node current_cost = current_node.get_cost() moves = 0; side_steps = 0 whil...
S-r-e-e-V/8Queens
Hill.py
Hill.py
py
1,642
python
en
code
0
github-code
90
19385839829
import json import github_util import requests_cache import requests config = None getters = __import__("repository_getters") token = None def carregar_ambiente(): global config with open('config.json') as config_file: config = json.load(config_file) if(config == None): print("[!] Arquivo de configuração não de...
pabloufrn/visual-artefatos
terminal_interface.py
terminal_interface.py
py
1,601
python
en
code
0
github-code
90
42785883519
from tkinter import messagebox import roll import stats_and_mods from roll import Roller, roll_skill, roll_initiative, roll_damage, roll_to_hit from gui_helpers import toggle_active_disabled, autocheck_checkboxes, depress_button, \ release_button, display_roll_result import skill_check # TODO: main menu: display ...
bdyson556/DnDRoller
gui.py
gui.py
py
12,914
python
en
code
0
github-code
90
73088523177
import itertools as it from dataclasses import dataclass from functools import cache, reduce from typing import TextIO, override from advent.common import BaseAdventDay cached_ord = cache(ord) @dataclass class Day3(BaseAdventDay[list[str]]): def get_score(self, letter: str) -> int: o = ord(letter) ...
DavideCanton/advent-of-code-2022
advent/day3.py
day3.py
py
1,305
python
en
code
0
github-code
90
18318130489
h,w,k=map(int,input().split()) s=[] ans=[] for i in range(h): s.append(list(input())) ans.append(['1']*w) cnt=0 flag=0 flag2=0 for i in range(h): if flag2==0: cnt+=1 if s[i].count('#')>0: flag = s[i].count('#')+cnt-1 for j in range(w): ans[i][j]=str(cnt) i...
Aasthaengg/IBMdataset
Python_codes/p02855/s635012935.py
s635012935.py
py
741
python
en
code
0
github-code
90
34244434047
# -*- coding: utf-8 -*- """ .. module:: TorController :synopsis: Small wrapper for sending requests to website using Twisted over the tor network (optionally) .. moduleauthor:: Adam Drakeford <adamdrakeford@gmail.com> """ import txtorcon import functools from twisted.python import log from mamba.utils im...
dr4ke616/LazyTorrent
application/lib/ext_services/tor_controller.py
tor_controller.py
py
1,618
python
en
code
0
github-code
90
19454771155
from PIL import Image, ImageDraw from random import randint def stega_encrypt(): text = input('text: ') keys = [] img = Image.open(input("img: ")) draw = ImageDraw.Draw(img) width = img.size[0] height = img.size[1] pix = img.load() f = open('text.txt','w') for elem in...
jeka10293847/img
Hide text.py
Hide text.py
py
597
python
en
code
0
github-code
90
18109833029
n,q = map(int, input().split()) name = [] time = [] for i in range(n): x = input().split() name.append(x[0]) time.append(int(x[1])) t = 0 n_end = [] t_end = [] while(len(time) > 0): if time[0] <= q: t += time[0] n_end.append(name.pop(0)) time.pop(0) t_end.append(t) e...
Aasthaengg/IBMdataset
Python_codes/p02264/s531381968.py
s531381968.py
py
515
python
en
code
0
github-code
90
33783736648
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re import os import sys import requests import traceback from selenium import webdriver from multiprocessing import Pool, cpu_count, freeze_support from selenium.webdriver.common.desired_capabilities import DesiredCapabilities def validatetitle(title): rstr =...
Packedcat/comic-crawler
comic.py
comic.py
py
6,012
python
en
code
0
github-code
90
21179647576
def solve(n,a): odd = sorted(a[i] for i in range(n) if a[i] % 2) even = sorted(a[i] for i in range(n) if a[i] % 2 == 0) odd.sort() even.sort() sorted_array = [] even_idx = 0 odd_idx = 0 for num in a: if num % 2 == 0: sorted_array.append(even[even_idx]) ...
Tettey1/A2SV
contest_11/C_Parity_Sort.py
C_Parity_Sort.py
py
630
python
en
code
0
github-code
90
18541064239
N = int(input()) Ai = list(map(int,input().split())) #print(Ai) def create_list(): MAXI = N sn = [0 for _ in range(MAXI+1)] judge = 0 for i in range(1,MAXI+1): #print(str(i)+'+1 when '+S[i-1]) sn[i] = sn[i-1] + Ai[i-1] return sn def iCj(i, j): mot = 1 chi = 1 for x in range(j): ...
Aasthaengg/IBMdataset
Python_codes/p03363/s884270247.py
s884270247.py
py
862
python
en
code
0
github-code
90
18352301559
a1=int(input()) a2=input() res1=[i for i in a2.split()] res=[i for i in a2.split()] for x in res: if int(x)<1 or int(x)>1000: res.remove(x) empty=0 sum_all=0 if 1<=a1<=100: if len(res1)==len(res): for x in res: empty=sum_all sum_all=empty+(1/int(x)) print((1/sum_a...
Aasthaengg/IBMdataset
Python_codes/p02934/s964641528.py
s964641528.py
py
324
python
en
code
0
github-code
90
22139229602
import numpy as np import matplotlib.pyplot as plt import cv2 # fungsi histogram def histogram(name, img): # jumlah bin = 256 plt.figure(name) plt.title(name) plt.hist(img.ravel(), 256, [0, 256]) # plt.savefig('{}.png'.format(name.lower())) return plt.show() # histogram untuk plot array 1D...
tobialbertino/belajar-code
Belajar_Python/PCD_prak/p3/LKP3.py
LKP3.py
py
3,493
python
en
code
2
github-code
90
36120346046
import streamlit as st import pandas as pd import datetime as dt from utils.data_gather import get_tdg_latest_version def display_tdg_stats(df_tdg: pd.DataFrame): st.write("### Statistiques de déploiement de bornes en France") st.write("#### WORK IN PROGRESS") # IRVE COUNT irve_count = df_tdg["id_...
MTES-MCT/qualicharge-geoviz-public
src/assets/pages/About.py
About.py
py
1,852
python
fr
code
0
github-code
90
18240854859
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) K = int(input()) ans = set() def dfs(last, lis): ans.add(int(''.join(lis))) if len(lis)==11: return dfs(last, lis+str(last)) if last!=0: dfs(last-1, l...
Aasthaengg/IBMdataset
Python_codes/p02720/s851328816.py
s851328816.py
py
475
python
en
code
0
github-code
90
25687874984
""" Test / Example file for OpenDistro Secuity API TODO : Implement with unittest """ import os import sys this_file_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.abspath(this_file_dir+'/../lib/opendistrosecurity')) from opendistrosecurity import * from tenants import * from roles import ...
chrousto/opendistrosecurity-py
tests/examples.py
examples.py
py
5,624
python
en
code
0
github-code
90
37370289518
from datetime import datetime from django.conf import settings from django.db import models from .excel_models import CarrierExcel HELP_TEXT = ''' <h3>Only xls files with following structure</h3> #6. column: Company <br/> #15. column: Town <br/> ''' class MatchingRequest(models.Model): user = models.ForeignKey...
rsiera/matcher
matcher/carriermatcher/models.py
models.py
py
623
python
en
code
0
github-code
90
33721223660
import charts import pandas as pa def run(): continent = input('Continent ==> ') df = pa.read_csv('data.csv') df = df[df['Continent'] == continent] countries = df['Country'].values percentages = df['World Population Percentage'].values charts.generate_pie_chart(countries, percentages) print('Generado p...
krif07/curso-python-pip
app/main.py
main.py
py
388
python
en
code
0
github-code
90
25275325830
# import flask from flask import Flask # tell flask this is the file where it launches from app = Flask(__name__) # Create a function that displays 'hello world' on our home page # The @app decorator tells the function the path to launch from # "/" means lauching from the home page # Instead of writing html code ins...
karianjahi/thinema
application.py
application.py
py
1,557
python
en
code
0
github-code
90
5813154306
import json from typing import Optional, Self, Callable from fastapi import FastAPI tags_metadata = [ { "name": "auth", "description": "Авторизация/регистрация пользователей.", }, { "name": "admin", "description": "Администрирование ресурса" }, { "name": "cat...
KalbinVV/PodcastAPI
api_singleton.py
api_singleton.py
py
1,429
python
en
code
0
github-code
90
73309926057
# -*- coding: utf-8 -*- from openerp import models, fields, api from datetime import datetime, timedelta from openerp.exceptions import UserError, ValidationError class FinancieraComision(models.Model): _name = 'financiera.comision' name = fields.Char('Nombre') # active = fields.Boolean("Activa", default=True) s...
levislibra/financiera_comision
models/models.py
models.py
py
13,246
python
en
code
0
github-code
90
19733102767
""" File handles the class Troop and functions tied to it. Troop handles both offencive and defencive units, and strategies. """ from typing import Callable from workplace import * class Troop: """A collection of military units.""" __target: Point2D # Common target for all units in troop # ___Job_list_...
antwg/tdde25
armies.py
armies.py
py
28,084
python
en
code
0
github-code
90
30402148487
import ctypes import sys import pygame as pg import sdl2 import sdl2.ext import os from sdl2 import surface, SDL_GetColorKey, SDL_SetColorKey from sdl2.ext.compat import isiterable from sdl2.sdlimage import IMG_Load from PIL import Image class SoftwareRenderer(sdl2.ext.SoftwareSpriteRenderSystem): ...
Reznnov/osu
main.py
main.py
py
5,961
python
en
code
1
github-code
90
40959838967
from dotenv import load_dotenv import os load_dotenv() import base64 import json from termcolor import colored import requests from requests import post def get_spotify_credentials(): client_id = os.getenv('CLIENT_ID') client_secret = os.getenv('CLIENT_SECRET') return client_id, client_secret def get_toke...
enmareynoso/spotify-track-search
main.py
main.py
py
2,910
python
en
code
0
github-code
90
25310650992
import numpy as np import pandas as pd import warnings warnings.filterwarnings('ignore') ''' Question 1 Import the data from fraud_data.csv. What percentage of the observations in the dataset are instances of fraud? This function should return a float between 0 and 1. ''' def answer_one(): df = pd.read_csv('frau...
PavelBLab/machine_learning
assignment_3/assignment_3.py
assignment_3.py
py
7,146
python
en
code
0
github-code
90
14285121003
# _*_ coding : UTF-8 _*_ # 开发人员 : ChangYw # 开发时间 : 2019/7/19 10:40 # 文件名称 : Test.PY # 开发工具 : PyCharm city = { "北京" : { "朝阳区" : ["朝阳公园","工体","朝阳大厦"], "海淀区" : ["颐和园","香山公园","玉泉山"], "丰台区" : ["园博园","卢沟桥文化旅游区","世界公园"] }, "上海" : { "杨浦区": ["杨浦公园", "工体", "朝阳大厦"], "...
wenzhe980406/PythonLearning
day05/Test.py
Test.py
py
726
python
en
code
0
github-code
90
18463850479
from sys import stdin, setrecursionlimit as srl from threading import stack_size srl(int(1e9)+7) stack_size(int(1e8)) def get(i, value, vis): if vis[i]: return value[i] vis[i] = True ans = 0 for j in adj[i]: ans = max(ans, 1+get(j, value, vis)) value[i] = ans return ans n, m =...
Aasthaengg/IBMdataset
Python_codes/p03166/s172913418.py
s172913418.py
py
635
python
en
code
0
github-code
90
33888963993
import string import json import urllib import urllib2 import ssl import certifi import requests import datetime NAME = 'KIJK 2.0' ICON = 'icon-default.png' ART = 'art-default.jpg' PREFIX = '/video/kijk' CHANNELS = [ { 'name': 'Net5', 'slug': 'net5', }, { 'name': 'SBS6', 'slug': 'sbs6' }, { 'nam...
mentosmenno2/Kijk.bundle
Contents/Code/__init__.py
__init__.py
py
18,416
python
en
code
2
github-code
90
70243711977
import time from numpy import random import matplotlib.pyplot as plt pivot_index = [] def swap(arr, a, b): arr[a],arr[b] = arr[b],arr[a] def findMedian(arr, l, n): lis = arr[l:l+n] # Sort the array lis.sort() # Return the middle element return lis[n // 2] def partiti...
tryambakbhunya/tryambakbhunya
9.PY
9.PY
py
2,736
python
en
code
0
github-code
90
73968071335
import numpy as np class Realization: def __init__(self, preyBirthRate, hawkHuntingRate, hawkDeathRate): self.timeOfEvent = [] self.hawkNumber = [] self.preyNumber = [] self.preyBirthRate = preyBirthRate self.hawkHuntingRate = hawkHuntingRate self.hawkDeathRate = h...
mark1ry/advanced_statistical
gillespie_algorithm/realization.py
realization.py
py
4,286
python
en
code
0
github-code
90
41654009449
import math def is_prime(num): x = True for i in range(2, num): if num%i == 0: return False else: x = True return x def first_divisor(num): for f in range(2, 2000): if num%f == 0: return f return None def is_jamcoin(base...
DaHuO/Supergraph_exp
test_input/CJ_0/16_0_3_adityamohta21_main.py
16_0_3_adityamohta21_main.py
py
1,993
python
en
code
0
github-code
90
10583624448
from django.contrib.auth.views import LoginView, LogoutView from django.urls import path from accountapp.views import AccountCreateView, AccountDetailView, AccountUpdateView, AccountDeleteView app_name = "accountapp" urlpatterns = [ # create같은 경우는 특정 View 상속 받아서, 파라미터 설정하고 그랬었는데 #login,logout은 거창한 것이 필요 없어서...
dooli1971039/Pinterest_django
accountapp/urls.py
urls.py
py
1,180
python
ko
code
0
github-code
90
43965908511
import os, shutil, cv2 import numpy as np import argparse def randomTransform(img): x, y, c = img.shape new_img = img + 1.5 * np.random.randn(x, y, c) new_img = new_img.astype(np.uint8) return new_img def sharp(img): kernel = np.array([[0, -0.05, 0], [-0.05, 1.2, -0.05], [0, -0.05, 0]], np.float32...
Frostmoune/FaseSR
dataset/CelebA/trainsform.py
trainsform.py
py
1,819
python
en
code
0
github-code
90
22696772611
file = open('puzzle3.in') map = [] slopes = [ [1, 1], [3, 1], [5, 1], [7, 1], [1, 2] ] for line in file: map.append(line.strip()) treeproduct = 1; for slope in slopes: right, down = slope trees = 0 x = 0 y = 0 while y < len(map): if map[y][x] == '#': trees += 1 y = y + down ...
vimtaai/aoc
2020/day03/puzzle3.py
puzzle3.py
py
412
python
en
code
0
github-code
90
42785835099
import json import logging import os import urllib.request from datetime import datetime import aiofiles from mojang_api import Player logger = logging.getLogger('utils.prices') # Skyblock Price Table # Features autocorrect, string eval, full sanitizer # Three methods of loading files for prices. def lJVL(fna...
DjagaMC/Pit-scammer-list
utils/prices.py
prices.py
py
2,599
python
en
code
0
github-code
90
39186405359
#!/usr/bin/python from psana import * import numpy as np import argparse import sys import os def test_args(args): """Checks a couple of the args to make sure they are correct""" assert(args.year in [2015,2016]) assert(args.run is not None) def get_processing_by_year(year): """Simple database of para...
scott-c-jensen/LCLS_Analysis
Step1_Process_Raw_Data_MnCl2/submitBatchPhotonCounting.py
submitBatchPhotonCounting.py
py
4,420
python
en
code
0
github-code
90
7345695658
import numpy as np import cv2 import cv2 as cv from glob import glob import os face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') count = 0 for root, dirs, files in os.walk("./sidharth"): for filename in files: count = count + 1 img ...
milangeorge2000/face_recognition
face_detection.py
face_detection.py
py
728
python
en
code
0
github-code
90
18362152339
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def divisors(n): # 約数列挙 divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n //...
Aasthaengg/IBMdataset
Python_codes/p02955/s191021998.py
s191021998.py
py
1,044
python
en
code
0
github-code
90
23430453816
''' String Rotation:Assume you have a method isSubstring which checks if oneword is a substring of another. Given two strings, sl and s2, write code to check if s2 is a rotation of sl using only one call to isSubstring (e.g., "waterbottle" is a rotation of"erbottlewat"). ''' import unittest def isSubstring(s1,s2): ...
sharonpamela/coding_challenges
ctci/1_string_rotation.py
1_string_rotation.py
py
1,101
python
en
code
0
github-code
90
18180606929
n = int(input()) x = list(input()) def popcount(n): bin_n = bin(n)[2:] count = 0 for i in bin_n: count += int(i) return count cnt = 0 for i in range(n): if x[i] == '1': cnt += 1 plus = [0 for i in range(n)] # 2^index を cnt+1 で割った時のあまり minus = [0 for i in range(n)] # 2^index を cnt-...
Aasthaengg/IBMdataset
Python_codes/p02609/s210975603.py
s210975603.py
py
1,026
python
en
code
0
github-code
90
14993107492
import numba import numpy as np from utils.base import BaseWorker @numba.jit(nopython=True) def _mandel(real: np.float64, imag: np.float64, max_iterations: np.int8) -> np.int8: """determines if a point is in the Mandelbrot set based on deciding if, after a maximum allowed number of iterations, the absolute v...
jimhendy/mandelbrot_cython
src/workers/numba_python/worker.py
worker.py
py
1,829
python
en
code
0
github-code
90
42384591935
import unittest from unittest import TestCase from rosetta.rosetta_validations import Validations class TestsPlugins(TestCase): def test_not_null(self): validators = Validations() assert validators.not_null(val='').items() <= ({'result': False, 'msg': "Invalid empty string value"}).items() ...
RoySegall/BismarckValidator
rosetta/tests/test_validations.py
test_validations.py
py
7,090
python
fa
code
1
github-code
90
17964554199
n=int(input()) s1=input() s2=input() l=[] old="hoge" for i in range(n): if s1[i]==s2[i]: l.append(0) elif s1[i]!=old: l.append(1) old=s1[i] ans=1 flag=2 INF=10**9+7 for i in l: if flag==1: if i==1:ans=ans*3%INF elif flag==0:ans=ans*2%INF else: if i==0:ans*=3 ...
Aasthaengg/IBMdataset
Python_codes/p03626/s637285365.py
s637285365.py
py
356
python
en
code
0
github-code
90
16645951084
import os import Skills_extract from flask import * app = Flask(__name__) @app.route('/') def home_page(): return render_template('index.html') @app.route('/results', methods=['GET', 'POST']) def results_skills(): if request.method == 'POST': f_path = request.files['file'].filename path = ...
gagankarthik/MajorProject
app.py
app.py
py
1,036
python
en
code
0
github-code
90
19018318655
class Solution: def optimalStrategyOfGame (self, arr, N): dp = [[0 for i in range(N + 1)] for j in range(3)] for i in range(N - 1, -1, -1): dp[0][i] = arr[i] for j in range(i + 1, N): take_left = arr[i] + min(dp[2][j], dp[1][j - 1]) take_right ...
Tejas07PSK/lb_dsa_cracker
Dynamic Programming/Optimal Strategy for a Game/solution3.py
solution3.py
py
522
python
en
code
2
github-code
90
20974607554
# 10-dars. If-else # Yangi cars = ['toyota', 'mazda', 'hyundai', 'gm', 'kia'] degan ro'yxat tuzing, ro'yxat elementlarining birinchi harfini katta qilib konsolga chqaring. GM uchun ikkala harfni katta qiling. cars = ['toyota', 'mazda', 'hyundai', 'gm', 'kia'] for car in cars: if car == "gm": print(car.uppe...
javaxirabdullayev/python.dasturlash-asoslari
10-dars. If-else.py
10-dars. If-else.py
py
1,793
python
en
code
0
github-code
90
18499094859
import sys input = sys.stdin.readline def main(): K = int(input()) n_odd = 0 n_even = 0 for i in range(1, K + 1): if i % 2 == 0: n_even += 1 else: n_odd += 1 ans = n_odd * n_even print(ans) if __name__ == "__main__": main()
Aasthaengg/IBMdataset
Python_codes/p03264/s853418541.py
s853418541.py
py
299
python
en
code
0
github-code
90
6741462549
""" Even & Odd Create a program in Python that will accept a positive integer from the user and determine if that number is even or odd. The program will keep asking the user for a number until they enter Q for quit. When a number is determined to be even or odd, the program needs to print that to the screen. The ...
VictorOwinoKe/UoM-DESIGN-THINKING-
Advanced Loops/even_odd.py
even_odd.py
py
1,053
python
en
code
1
github-code
90
21334583505
from sys import argv, stdout import struct, zlib f=file(argv[1]).read() if len(argv)>2: out=file(argv[2], 'w') else: out=stdout l=struct.unpack('<I', f[:4])[0] doc=zlib.decompress(f[4:l+4]) out.write(doc)
gic888/MIEN
tools/extract_xml.py
extract_xml.py
py
208
python
en
code
2
github-code
90
18215531199
# import sys input=sys.stdin.readline def main(): N,K=map(int,input().split()) A=list(map(lambda x: int(x)-1,input().split())) latest=[-1]*N latest[0]=0 now=0 while(K>0): K-=1 to=A[now] if latest[A[now]]!=-1: K%=latest[now]-latest[A[now]]+1 latest[A[...
Aasthaengg/IBMdataset
Python_codes/p02684/s495551540.py
s495551540.py
py
417
python
en
code
0
github-code
90
6185409882
# 1부터 10까지의 정수 중에서 짝수의 총합과 홀수의 총합을 각각 구해 보세요. odd = even = 0 for idx in range(1, 11): if idx % 2 == 0: even += idx else: odd += idx print(f'홀수 총합 : {odd}') print(f'짝수 총합 : {even}') # 1부터 50까지의 정수 중에서 3의 배수가 아닌 수 # sumA = 1 + 2 + 4 + 5 + 50 # sumB = 3 + 6 + 9 + 48 # sumA - sumB sumA = sumB = 0 for idx in...
super1947/AICourse
DAY03/for02.py
for02.py
py
571
python
ko
code
0
github-code
90
1400058671
# -*- coding: utf-8 -*- import ast class Flake8Deprecated(object): name = 'flake8_deprecated' version = '1.2' message = 'D001 found {0:s} replace it with {1:s}' checks = { 'assertEqual': ('failUnlessEqual', 'assertEquals', ), 'assertNotEqual': ('failIfEqual', ), 'assertTrue': (...
dougcpr/deep-purple
.local/lib/python3.6/site-packages/flake8_deprecated.py
flake8_deprecated.py
py
1,797
python
en
code
0
github-code
90
18483834489
from collections import deque N = int(input()) A = [int(input()) for _ in range(N)] A.sort() q = deque([A[0]]) i = 1 j = N-1 while i <= j: temp = max(abs(A[i]-q[0]), abs(A[j]-q[0]), abs(A[i]-q[-1]), abs(A[j]-q[-1])) if temp == abs(A[i]-q[0]): q.appendleft(A[i]) i += 1 elif temp == abs(A[j]-...
Aasthaengg/IBMdataset
Python_codes/p03229/s931860545.py
s931860545.py
py
568
python
en
code
0
github-code
90
33626799434
# -*- coding: utf-8 -*- from PyQt5 import QtCore, QtGui, QtWidgets from Validation import Validation from PyQt5.QtWidgets import QMessageBox from PyQt5.QtGui import * import pygame import smtplib import os import pymysql from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mim...
saudshaikh724/Smart-Security
SendMail.py
SendMail.py
py
13,709
python
en
code
0
github-code
90
13010418702
import random import torch import datasets from transformers import AutoModel, GlueDataset, GlueDataTrainingArguments, AutoTokenizer, AutoFeatureExtractor from transformers.testing_utils import torch_device def make_config(config_class, **kwargs): return staticmethod(lambda: config_class(**kwargs)) class Ada...
adapter-hub/adapter-transformers
tests_adapters/test_adapter.py
test_adapter.py
py
4,205
python
en
code
1,700
github-code
90
31921950066
# https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html import argparse import copy import datetime import json import os import torch import torch.nn as nn import torch.optim as optim import wandb from utils import (configure_cudnn, configure_wandb, get_model, load_checkpoint, prepar...
motokimura/pytorch_quantization
train.py
train.py
py
7,173
python
en
code
0
github-code
90
73490488937
def print_value_and_type(items: list) -> None: """ The function prints the values and type of each item in the list (the list is an argument to the function). :param items: :return: None """ for item in items: print(item) print(type(item)) print('-' * 80) VAR_1 = 'разра...
AnastasiaYurko/Client-server_apps
lesson1/test.py
test.py
py
751
python
en
code
0
github-code
90
17956174849
n,m,r=map(int,input().split()) r=list(map(int,input().split())) import sys INF=float('inf') road=[[INF]*n for _ in range(n)] for _ in range(m): a,b,c=map(int,input().split()) road[a-1][b-1]=c road[b-1][a-1]=c #経由地 for k in range(n): #出発地 for s in range(n): #goal for g in range(n)...
Aasthaengg/IBMdataset
Python_codes/p03608/s197547926.py
s197547926.py
py
658
python
en
code
0
github-code
90
7738737092
# -*- encoding: utf-8 -*- import numpy as np import torch import torch.nn as nn import torch.nn.functional as F def _layer_init(layer, w_scale=1.0): # nn.init.orthogonal_(layer.weight.data) fan_in = layer.weight.data.size()[0] lim = 1. / np.sqrt(fan_in) layer.weight.data.uniform_(-lim, lim) layer....
moliqingwa/DRLND
p3_collab-compet/model.py
model.py
py
3,642
python
en
code
1
github-code
90
44762261569
from flask import Flask from os.path import join, dirname from dotenv import load_dotenv import firebase_admin import pyrebase import ast import os dotenv_path = join(dirname(__file__), '.env') load_dotenv(dotenv_path) certi = ast.literal_eval(os.environ["FIREBASE_CREDS"]) PYREBASE_CONFIG = { "apiKey" ...
Movies-By-the-Sea/mbts-archives
Frontend/v3.0/modules/__init__.py
__init__.py
py
1,346
python
en
code
1
github-code
90
40374771956
from datetime import timedelta from datetime import datetime import time from pymongo import MongoClient import atexit client = MongoClient("localhost", 27017) db = client.WDMOV def exit_handler(): client.close() atexit.register(exit_handler) current_avg_pipeline = [ { "$match": { "la...
8uurg/WDMOV
mongo/streaming/current-avg-delay.py
current-avg-delay.py
py
1,153
python
en
code
0
github-code
90
36806293360
from twilio.rest import Client import time # Your Account Sid and Auth Token from twilio.com/console # DANGER! This is insecure. See http://twil.io/secure # Make sure to add security // I assume these will require an API call and be given based on the user permissions account_sid = 'ACb3cc029d14a5c2dccfaa71b9036309bc'...
jhatkins999/autodialer_tests
send_sms.py
send_sms.py
py
1,267
python
en
code
0
github-code
90
42648354578
import argparse import os from transformers import AutoTokenizer from config import ICLPretrainConfig, ParseKwargs from data_icl import ICLPretrainDataForEncDec from trainer import Trainer from utils import seed_everything, init_logger, load_dataset_names, expand_dataset_to_prompts def run(logger, config): # tr...
INK-USC/FiD-ICL
encdec/run_icl.py
run_icl.py
py
1,755
python
en
code
10
github-code
90
24384588747
#!/usr/bin/env python3.3 import argparse import fastn parser = argparse.ArgumentParser( description = 'Splits a fasta/q file into separate files. Does not split sequences. Puts up to max_bases into each split file. The exception is that any sequence longer than max_bases is put into its own file. No sequences are...
MagdalenaZZ/Python_ditties
fastn_split_by_seq_sizes.py
fastn_split_by_seq_sizes.py
py
925
python
en
code
0
github-code
90
18241535429
def resolve(): def sub(s): cur = 0 last = -(C + 1) res = [0] * (N + 1) for i in range(N): if i - last > C and s[i] == "o": cur += 1 last = i res[i + 1] = cur return res N, K, C = map(int, input().split()) S = i...
Aasthaengg/IBMdataset
Python_codes/p02721/s725402807.py
s725402807.py
py
560
python
en
code
0
github-code
90
29940700351
from bs4 import BeautifulSoup import requests import os import dotenv dotenv.load_dotenv() URL = os.getenv('URL') headers = os.getenv('HEADERS') def check(): s = [] PAGE = requests.get(URL).text soup = BeautifulSoup(PAGE, 'html.parser') name = soup.find('h1', class_='rf-pdp-title').text price = s...
ironnicko/online-price-tracker
new_iphone_price.py
new_iphone_price.py
py
403
python
en
code
0
github-code
90