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
12522375989
# Pattern Printing # Input=Integer not # Boolean=True or False # # True # * # ** # *** # **** # False # **** # *** # ** # * #FROM COMMENT TRY NEEL AFTER REVISON print("How Many Row You Want To Print") one= int(input()) print("Type 1 Or 0") two = int(input()) new =bool(two) if new == True: for i in range(1,one+1)...
neelshet007/PythonTuts
exercise4.py
exercise4.py
py
525
python
en
code
0
github-code
36
31070595638
import reddit import socketserver import socketservervideogenerator from time import sleep import database import datetime from threading import Thread def getScripts(): global lastUpdate print("Grabbing more scripts...") info = reddit.getInfo('AskReddit', 45) new_scripts = len([script for ...
drewwebster/Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader
YouTube Bot Server/initserver.py
initserver.py
py
1,512
python
en
code
2
github-code
36
42997186771
import base64 import hashlib import hmac import time import requests import jwt from flask import request class GitHubApp(object): def __init__(self, app=None): self.app = app if app is not None: self.init_app(app) def init_app(self, app): self.webhook_secret = None ...
cabotage/cabotage-app
cabotage/server/ext/github_app.py
github_app.py
py
2,642
python
en
code
21
github-code
36
9689017723
import pep8 # Mixin for testing the pep8 style rules class Pep8ModelTests(object): def test_pep8_conformance_views(self): pep8style = pep8.StyleGuide(quiet=True) result = pep8style.check_files([self.path]) error_message = "" if result.total_errors != 0: error_message ...
Contrast-Security-OSS/DjanGoat
app/tests/mixins/pep8_model_test_mixin.py
pep8_model_test_mixin.py
py
462
python
en
code
69
github-code
36
11111121290
from django.test import TestCase from .models import Producto, Categoria, CategoriaDetalle from django.contrib.auth import get_user_model class Categories(TestCase): def setUp(self): # Crear categorías para la prueba self.cat1 = Categoria.objects.create(nombre='Kit') self.cat2 = Categoria....
is-Campos/ethnicBites
categorias/tests.py
tests.py
py
2,937
python
es
code
0
github-code
36
6284906050
import sys def main(args): lines = [] with open("input6-1") as f: lines = f.readlines() coords = [] for line in lines: line = line.strip() toks = line.split(',') coords.append((int(toks[0]), int(toks[1]))) print(coords) max_x = -1 max_y = -1 for c in c...
alienfluid/aoc2018
day6-1.py
day6-1.py
py
2,418
python
en
code
0
github-code
36
14276105253
#Script used to take a word or phrase and count the inputted letter inside the word or phrase def count_letters(): word=input('enter word: ') x=input('count which letter ?: ') count=0 index=0 for letter in word : if x == word[index] : count=count+1 index = index + 1 ...
OmegaJP/git_practice
python_scripts/Chapter06/Ex_03_C6.py
Ex_03_C6.py
py
365
python
en
code
0
github-code
36
74666999465
import os from math import cos, sin, sqrt, pi import numpy as np import pyvista as pv from planegeometry.geometry import Triangle def Gamma(t, A, nlobes): alpha = np.pi/2 - (np.pi/2-A)*np.cos(nlobes*t) beta = t + A*np.sin(2*nlobes*t) return np.array([ np.sin(alpha) * np.cos(beta), np.sin(alpha) * np.sin...
stla/PyVistaMiscellanous
HopfToriSteinerOrbit.py
HopfToriSteinerOrbit.py
py
3,714
python
en
code
4
github-code
36
23622792802
import os.path import numpy import pickle import streamlit as st import statistics from matplotlib import pyplot as plt import seaborn as sb from PIL import Image from tools.analyse_tool import CompleteAnalysis from objects.training_set import TrainingSet from objects.patient import Patient def warning(): color1...
Data-Challenge-Team-8/data_challenge_team_8
web/categories/sepsis_research.py
sepsis_research.py
py
10,177
python
en
code
1
github-code
36
22689168957
import sqlite3 con = sqlite3.connect('people.db') c = con.cursor() c.execute(""" INSERT INTO users (tag_num, "temp", humidity, light_intensity) VALUES ('13 05 5e 0d', 23, 0, 200)""") con.commit() con.close()
KrikorAstour/IoT
phase4/poop.py
poop.py
py
212
python
en
code
0
github-code
36
28508591217
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from numpy import sometrue, array, ravel, logical_not, zeros, float32, maximum, equal, int32 from numpy import arcsin, sqrt from numpy import ma fro...
psrc/urbansim
biocomplexity/land_cover/shei.py
shei.py
py
4,909
python
en
code
4
github-code
36
36663511828
import os os.environ['KERAS_BACKEND'] = 'tensorflow' from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from konlpy.tag import Okt from tensorflow.keras.layers import Embedding, Dense, LSTM from tensorflow.keras.models import Sequential import pan...
woqls22/StockNews
BackEnd/PythonScripts/train.py
train.py
py
4,385
python
en
code
3
github-code
36
15134742588
from fileinput import filename import logging import logging import os import pandas as pd from ekorpkit import eKonf log = logging.getLogger(__name__) class Quandl: def __init__(self, **args): from fredapi import Fred import nasdaqdatalink self.args = eKonf.to_dict(args) self.a...
entelecheia/ekorpkit
ekorpkit/io/fetch/quandl.py
quandl.py
py
7,608
python
en
code
4
github-code
36
21251148822
#!/usr/bin/env python3 """ Demo of using the pan and tilt servo kit. This demo assumes you have purchased the Pixy pan and tilt kit. You can connect the servos in two places: 1. Just plug the servos into servo ports on the Arduino 3, 9, or 10 (NOT 11!). This demo uses 3 and 10. 2. Plug the servos in on the Pi...
MrYsLab/pymata-aio
examples/sparkfun_redbot/pixy/simple_servo_sweep_config_1.py
simple_servo_sweep_config_1.py
py
3,254
python
en
code
154
github-code
36
2847551483
# QUs:https://leetcode.com/problems/delete-nodes-and-return-forest/ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right from collections import defaultdict class Solution...
mohitsinghnegi1/CodingQuestions
leetcoding qus/Delete Nodes And Return Forest.py
Delete Nodes And Return Forest.py
py
1,780
python
en
code
2
github-code
36
533968659
print("ASSIGNMENT-1\nNAME-SUNPREET SINGH\nSID-21103118\n\n") # QUESTION 1 print("Question 1\n") #Python Program for finding average of three numbers iFirstNo=input("Enter first number\n") iSecondNo=input("Enter second number\n") iThirdNo=input("Enter third number\n") #Average of three numbers fAvg=(in...
GevaterTod/PYTHONASSIGNMENTS
assignment1_21103118_cse.py
assignment1_21103118_cse.py
py
2,806
python
en
code
0
github-code
36
74541858984
from django import forms from users.models import Project, Project_pictures, Comment, Donation, Reply import datetime class AddProjectForm(forms.ModelForm): class Meta: model = Project fields = ( "title", "details", "total_target", "start_date", ...
asaid-0/pyreads
projects/forms.py
forms.py
py
2,835
python
en
code
0
github-code
36
25948284193
import torch # import torch.utils import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms from torchvision.datasets import CIFAR10 import torch.optim as optim torch.manual_seed(1234) ratio = 0.1 device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') transform ...
bbrk13/Ceng499_THE1
task2.py
task2.py
py
2,848
python
en
code
0
github-code
36
12178499748
from odoo.tests.common import TransactionCase class TestUsers(TransactionCase): def test_name_search(self): """ Check name_search on user. """ User = self.env['res.users'] test_user = User.create({'name': 'Flad the Impaler', 'login': 'vlad'}) like_user = User.create({'name': 'Wlad...
akradore/odoo-windows
server/odoo/addons/base/tests/test_res_users.py
test_res_users.py
py
1,338
python
en
code
5
github-code
36
21131376574
import json import requests FB = 'https://graph.facebook.com' """Python client library for the Facebook ads API.""" class AdsAPI(object): """A client for the Facebook Ads API.""" def __init__(self, ad_account_id, access_token=None, expires=None): self.ad_account_id = ad_account_id self.acc...
narrowcast/keywords
ads.py
ads.py
py
3,407
python
en
code
0
github-code
36
6084342501
def reorder_list(head): # we can use 2 pointer approach # find the middle of the list slow, fast = head, head.next while fast and fast.next: slow = slow.next fast = fast.next.next # then we reverse the second half second = slow.next prev = slow.next = None while secon...
phuclinh9802/data_structures_algorithms
blind 75/reorder_list.py
reorder_list.py
py
633
python
en
code
0
github-code
36
20612540072
import networkx as nx import random import matplotlib.pyplot as plt def main(): # Watts Strogatz Ring Graph # do it at various levels ring_lattice = nx.watts_strogatz_graph(100, 4, 0) # nx.draw(ring_lattice) # plt.draw() # plt.show() print("Ring simple ", simple_contagion(ring_lattice, 0))...
nxlouie/complex_contagions
eecs444_project.py
eecs444_project.py
py
4,950
python
en
code
2
github-code
36
26006767642
from time import sleep class Dog: def __init__(self, name, idade, sexo): self.name = name self.idade = idade self.sexo = sexo def latir(self): print("Au Au") def dormir(self): print(f"{self.name} está dormindo...") class Carro: def __init__(self, marca, cor)...
JolyneKo/Code
Python/Testes/Teste 07/index.py
index.py
py
966
python
pt
code
0
github-code
36
19920196010
#result gives the largest distance of values farthest def solution(A): #hash = {} N = len(A) currMax = 0 max = N-1 for i in xrange(N): key = A[i] buffResult = N - 1 - i window = 0 for j in range(N-1,i,-1): curr = A[j] if(key == curr): ...
david19han/pythonPlayground
myprogram.py
myprogram.py
py
498
python
en
code
0
github-code
36
74113986983
from enum import Enum, IntEnum from typing import List, Optional, Set from odmantic import Model import datetime class EntryType (str, Enum): """[summary] An entry performed by the user. [description] A user can record of three types of entries: 1) Traumatic Event 2) Journal En...
blevinscm/patapi
app/data/models.py
models.py
py
2,731
python
en
code
0
github-code
36
37350650967
import pytest from gpaw.utilities import compiled_with_libvdwxc from ase.build import bulk from gpaw import GPAW, Davidson, Mixer, PW from gpaw.xc.libvdwxc import vdw_mbeef from gpaw.test import gen pytestmark = pytest.mark.skipif(not compiled_with_libvdwxc(), reason='not compiled_wi...
f-fathurrahman/ffr-learns-gpaw
my_gpaw/test/vdw/test_libvdwxc_mbeef.py
test_libvdwxc_mbeef.py
py
1,075
python
en
code
0
github-code
36
33167792265
from ast import List import random from typing import Callable, Tuple import functools class Genetics: def __init__(self, domain: tuple, population_len: int, mutation_rate: float = 0, evaluation_cb: Callable[[float, float], float] = lambda x, y: 0, minima=False, seed=None) -> None: self.domain = domain ...
Fairbrook/algoritmo_evolutivo
src/genetics.py
genetics.py
py
4,295
python
en
code
0
github-code
36
8324961764
n, m, v, u = map(int, input().split()) print(v, u) mos = [] for i in range(m): a = list(map(int, input().split())) mos.append(a) print(mos) k = int(input()) if k != 0: zat = list(map(int, input().split())) else: zat = [] print(zat) ways = [] c = False for i in mos: if v in i: ...
gavt45/nti_2017_gornostay
wave_2/ilya_solutions/6-7/6.py
6.py
py
928
python
en
code
1
github-code
36
15954616766
import os, sys import pickle sys.path.append("../../../") from data.otb import * from forecasters import load_forecaster import torch as tc if __name__ == "__main__": dsld = loadOTB("../datasets/otb", 100, bb_format="xyxy") ld_names = ['val1', 'val2', 'test'] lds = [dsld.val1, dsld.val2, dsld.test] ...
sangdon/PAC-confidence-set
demo/conf_set/otb/extract_response.py
extract_response.py
py
1,182
python
en
code
7
github-code
36
12429439023
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score from sklearn.metrics import classification_report import re import string import joblib from sklearn.feature_extraction....
Pj-develop/ML_FAKE_NEW_DETECTION
best_chooser.py
best_chooser.py
py
2,728
python
en
code
0
github-code
36
34325207808
#!/usr/bin/python # -*- coding: utf-8 -*- # #Author: Read AUTHORS file. #License: Read COPYING file. import xml.etree.cElementTree as etree from os import path from pkg import pkg from constants import const from ..lib import eventHandler, listdir, getfile, ratioCalc class pkgdir(object): def __init__(...
pardus-anka/paso
src/engine/packages/packages.py
packages.py
py
2,158
python
en
code
0
github-code
36
13910036602
"""Module to write data classes information.""" # Python packages import yaml import logging as log # write_data_class ------------------------------------------------------------ def write_data_class(data, file='data.yaml'): """Take a data object and write its attributes. Args: data: object with __...
jorgerodriguezveiga/firedecomp
firedecomp/utilities/write.py
write.py
py
1,536
python
en
code
0
github-code
36
33102651292
from datetime import timedelta, datetime import os from airflow import DAG from google.cloud import storage from airflow.utils.dates import days_ago from airflow.operators.dummy_operator import DummyOperator from airflow.operators.bash import BashOperator from airflow.decorators import task, dag from airflow.operators...
Rohitjoshi07/FHVDataAnalysis
airflow/dags/spark-dataproc.py
spark-dataproc.py
py
4,553
python
en
code
0
github-code
36
15991440245
import torch.nn as nn import torch import torch.nn.functional as F up_kwargs = {'mode': 'bilinear', 'align_corners': True} norm_layer = nn.BatchNorm2d class Conv2dReLU(nn.Sequential): def __init__( self, in_channels, out_channels, kernel_size, padding=...
zyxu1996/Efficient-Transformer
models/head/unet.py
unet.py
py
5,457
python
en
code
67
github-code
36
20102072281
import cv2 import numpy as np import os import time label_names = ['scissors'] for label_name in label_names: IMG_SAVE_PATH = 'test_images2' IMG_CLASS_PATH = os.path.join(IMG_SAVE_PATH, label_name) try: os.mkdir(IMG_SAVE_PATH) except FileExistsError: pass try: os.mkdir(IMG_CLASS_P...
miir2709/rock-paper-scissors
imageGenerate/captureImage.py
captureImage.py
py
1,197
python
en
code
0
github-code
36
70322815465
""" TACCJM Hug Server Server for managing instances of TACCJobManager classes via http endpoints using the hug framework. TODO: Add more extensive logging """ import pdb import os import hug import falcon import logging import json from typing import Union, List, Tuple from taccjm.TACCJobManager import TACCJobManager...
cdelcastillo21/taccjm
src/taccjm/taccjm_server.py
taccjm_server.py
py
12,602
python
en
code
2
github-code
36
20145792954
import argparse import inspect def parse_funct_arguments(fn, args=None, free_arguments=None): if free_arguments is None: free_arguments = [] fn_parser = argparse.ArgumentParser() sign = inspect.signature(fn) for pname, pval in sign.parameters.items(): if pname not in free_arguments: ...
antonior92/narx-double-descent
util.py
util.py
py
588
python
en
code
6
github-code
36
31057530307
''' JexoSim 2.0 Recipe 3 with ability to split timeline into chunks - used to test split method ''' from jexosim.modules import exosystem, telescope, channel, backgrounds from jexosim.modules import detector, timeline, light_curve, systematics, noise, output from jexosim.pipeline.run_pipeline import pipeline_stage_1,...
subisarkar/JexoSim
jexosim/run_files/recipe_3a.py
recipe_3a.py
py
17,161
python
en
code
6
github-code
36
14061566995
import time import json from typing import * import prestodb # pip install presto-python-client class PrestoClient: def __init__(self): props = {"enable_hive_syntax": "true"} self.conn = prestodb.dbapi.connect( host="presto.bigo.sg", port=8285, user="baijialuo"...
ThreeBucks/model-deploy
scripts/extract_report_data.py
extract_report_data.py
py
1,588
python
en
code
0
github-code
36
4162697796
import asyncio import aiofiles # Define an async function to write data to a file async def write_to_file(filename, data): # Open the file for writing using async with, which ensures the file is closed # when we're done with it async with aiofiles.open(filename, 'w') as f: # Write the data to the f...
PythonCodeNemesis/Python_Event_Loop
file_update_loop_2.py
file_update_loop_2.py
py
1,482
python
en
code
0
github-code
36
9194759746
from PIL import Image import unittest from lightly.transforms import GaussianBlur class TestGaussianBlur(unittest.TestCase): def test_on_pil_image(self): for w in range(1, 100): for h in range(1, 100): gaussian_blur = GaussianBlur(w * 0.1) sample = Image.new('...
tibe97/thesis-self-supervised-learning
tests/transforms/test_GaussianBlur.py
test_GaussianBlur.py
py
372
python
en
code
2
github-code
36
70167432424
import os import mongoengine BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '6c8+rfm8e6#bt&13$+4#(btshtf7#^)y3e@58=lzrxd5j4%q(m' DEBUG = True ALLOWED_HOSTS = ['*'] REST_FRAMEWORK = { 'UNAUTHENTICATED_USER': None } # Application definition INSTALLED_APPS = [ 'rest_f...
knroy/django-pds
sample/mongo_django/mongo_django/settings.py
settings.py
py
1,169
python
en
code
3
github-code
36
33917629928
# importacao de bibliotecas import requests import csv # import datetime (NAO SERA UTILIZADO E NAO FUNCIONOU NO PYCHARM) from PIL import Image from urllib.parse import quote from time import sleep # recebendo os dados da API url = 'https://api.covid19api.com/dayone/country/brazil' requisicao = requests.get(url) dados_...
gabrieleugeni0/Covid19DataGraphic
covid19.py
covid19.py
py
4,876
python
pt
code
1
github-code
36
950940082
pkgname = "gtar" pkgver = "1.35" pkgrel = 0 build_style = "gnu_configure" configure_args = [ "--program-prefix=g", "gl_cv_struct_dirent_d_ino=yes", ] configure_gen = [] hostmakedepends = ["texinfo"] makedepends = ["acl-devel"] pkgdesc = "GNU tape archiver" maintainer = "q66 <q66@chimera-linux.org>" license = "G...
chimera-linux/cports
main/gtar/template.py
template.py
py
528
python
en
code
119
github-code
36
18109339052
#! /usr/bin/python3 # -*- coding: utf-8 -*- import rospy import subprocess import threading from tkinter import * from geometry_msgs.msg import Twist import subprocess from std_msgs.msg import String import threading class UI: def __init__(self, master=None): self._enable = False self...
DanielFrauAlfaro/Proyecto_Servicios
kinova_UI/scripts/kinova_UI.py
kinova_UI.py
py
6,374
python
es
code
0
github-code
36
6504291760
# import sys from collections import deque # from io import StringIO # # test_input1 = """11, 6, 8, 1 # 3, 1, 9, 10, 5, 9, 1 # """ # # # test_input2 = """10, 9, 8, 7, 5 # 5, 10, 9, 8, 7 # """ # # test_input3 = """12, -3, 14, 3, 2, 0 # 10, 15, 4, 6, 3, 1, 22, 1 # """ # # sys.stdin = StringIO(test_input1) # sys.stdin = S...
gyurel/Python-Advanced-Course
python_advanced_retake_exam_14_april_2021/problem1.py
problem1.py
py
1,221
python
en
code
0
github-code
36
21632921628
import pandas as pd from scipy.stats import spearmanr, pearsonr, kendalltau import os import numpy as np base_path = 'output_alignment/alignment_checkpoint/' dfs = [] for file in os.listdir(base_path): dfs.append(pd.read_csv(os.path.join(base_path, file))) df1 = pd.concat(dfs) # df1 = pd.read_csv('output_alignmen...
maor63/sana_project
compute_spearman_correlation_for_alignments.py
compute_spearman_correlation_for_alignments.py
py
1,962
python
en
code
0
github-code
36
22688875816
from logging import error import random import datetime from app.lessons import LESSONS_BY_ID from flask import jsonify, g, request from app import app, db from app.api.auth import api_admin_login_required, api_login_required, error_response from app.models import Puzzle, PuzzleCompletion, Test from flask_sqlalchemy i...
APM246/Atomic-Chess
app/api/puzzles_api.py
puzzles_api.py
py
5,650
python
en
code
2
github-code
36
8429282748
def main(): """ Matrix is assumed to be like this: A B C D A 0 2 3 7 B 2 0 6 4 C 3 6 0 1 D 7 4 1 0 Sample test files have also been uploaded """ filename = input(" Enter filename (e.g. tree.txt):") #Extraction of data listform = [] myFile = open(filename, "r" ) for Row in myFi...
HassaanAW/Computational-Biology
Phylogenetic Tree.py
Phylogenetic Tree.py
py
4,128
python
en
code
0
github-code
36
15947687332
def process(dae_dir_path, out_dir_path): import os if not os.path.exists(dae_dir_path): print('Path "%s" does not exist' % dae_dir_path) return if not os.path.exists(out_dir_path): os.makedirs(out_dir_path) files = os.listdir(dae_dir_path) for file in files: if file.endswith('.dae'): file = dae_dir_pat...
XinJack/UsefulScripts
collada2gltfWrapper_python/collada2gltf.py
collada2gltf.py
py
751
python
en
code
0
github-code
36
9914536662
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import time import stat import io import ctypes import struct import zlib # https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip.html # https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT # https://en.wikipedia.org/wiki/Zip_(file_format)#File_headers ...
aykevl/python-zipseeker
zipseeker/__init__.py
__init__.py
py
10,783
python
en
code
2
github-code
36
38447232162
@login_required @require_http_methods(['POST']) def update_user_image(request): form = UpdateImageProfileForm(request.POST, request.FILES) data = {'status': 'success'} if form.is_valid(): LOGGER.info('trying to update profile picture') try: (filename, image) = _resize_image(form...
carlos-mtz-arenas/py_utils
django_resize_image_endpoint.py
django_resize_image_endpoint.py
py
1,447
python
en
code
0
github-code
36
2266175166
import dash_core_components as dcc import dash_html_components as html from dash_devices.dependencies import Input, Output, State import numpy as np import pandas as pd import sys import re import num2words from app import app from apps import user_mode sys.path.insert(1, 'C:\\Users\\Antoine\\CloudStation...
antoine-zurcher/master-project
prototype/apps/god_mode.py
god_mode.py
py
37,217
python
en
code
0
github-code
36
34212026055
# 19.09.28 stic1 = [12,12,12,12,12] stic2 = [12,80,14,22,100] def get_maximum(stic): stic_len = len(stic) dp = [0]*stic_len # stic_len 만큼 dp배열 생성 # 초기화 dp[0] = stic[0] dp[1] = max((stic[0], stic[1])) # dp for i in range(2, stic_len): dp[i] = max((stic[i]+dp[i-2], dp[i-1] )) ...
chankoo/problem-solving
dp/prog_1909_3.py
prog_1909_3.py
py
433
python
en
code
1
github-code
36
8087397109
from transformers import BertTokenizer, BertModel import torch class Bert: def __init__(self): self.model = BertModel.from_pretrained("bert-base-uncased", output_hidden_states = True) self.tokenizer = BertTokenizer.from_pretrained("bert-base-uncased") self.device = torch.device('cuda:0' if...
aberenguerpas/inferia
services/embeddings/Bert.py
Bert.py
py
806
python
en
code
0
github-code
36
4354535219
from collections import OrderedDict from datetime import date, datetime from decimal import Decimal, ROUND_DOWN from models import models from peewee import fn from playhouse.shortcuts import model_to_dict from pytz import timezone from time import time import app_config import copytext import simplejson as json impor...
nprapps/elections16
app/utils.py
utils.py
py
11,492
python
en
code
15
github-code
36
71877360104
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import logging from executions import Program def main(): program_name = sys.argv[2] logging.basicConfig(level=logging.DEBUG, format="%(asctime)s [%(levelname)s] %(message)s", filename="process-dtrace.log", filemode='w') logging.debug("Starting wo...
danilchenko-andrey/trace-models
process_dtrace.py
process_dtrace.py
py
1,101
python
en
code
0
github-code
36
469422111
from argparse import ArgumentParser from threading import Thread, current_thread import logging import time from sloq import SlowQueue def main(args=None): prog = ArgumentParser() prog.add_argument("-n", type=int, default=10, metavar="TASK_COUNT", help="The number of tasks") prog.ad...
duedil-ltd/python-sloq
demo_sloq.py
demo_sloq.py
py
2,091
python
en
code
3
github-code
36
33362276648
import cv2 import base64 import json import time import os import numpy class Recognition: """ This class contain everything required to detect, learn or recognize a face """ db_path = "database/" name_list_path = "database/" def __init__(self, haar_cascade_file_path): self.haar_casca...
farshid616/clinet-server_FaceRecognition
recognition.py
recognition.py
py
5,116
python
en
code
3
github-code
36
6797375421
from django.core.management.base import BaseCommand from mailer.models import Message class Command(BaseCommand): help = 'Update server name in emails' def add_arguments(self, parser): # Positional arguments parser.add_argument('from_server', nargs='+', type=str) parser.add_argument(...
tomasgarzon/exo-services
service-exo-mail/mail/management/commands/update_server_name.py
update_server_name.py
py
1,016
python
en
code
0
github-code
36
22056037109
import os import re import sys import time from setuptools import setup HERE = os.path.dirname(__file__) ROOT_DIR = os.path.abspath(os.path.join(HERE, os.pardir)) TEMP_PATH = "target" in_src = os.path.isfile(os.path.join(ROOT_DIR, "pom.xml")) if in_src: pom_file = os.path.join(ROOT_DIR, 'pom.xml') with open(...
piotrszul/sparktest
python/setup.py
setup.py
py
1,848
python
en
code
0
github-code
36
73654029544
from typing import Any, List from common import TestResult from proc import SubprocessAppController from runner import Runner from validation import TestExecutionValidator, validate_all from web import TestGetUrl, TestPostToUrl class NetworkMetricsCollectedValidator(TestExecutionValidator): def __init__(self, a...
criblio/appscope
test/integration/test_runner/nginx.py
nginx.py
py
1,535
python
en
code
248
github-code
36
74877532582
from tkinter import * from tkinter import filedialog from PIL import ImageTk, Image import os from tkinter import messagebox root = Tk() root.minsize(650,650) root.maxsize(650,650) root.configure(background='gray') open_img = ImageTk.PhotoImage(Image.open("open.png")) save_img = ImageTk.PhotoImage(Image.o...
arjun380/P-IDE
P-Ide.py
P-Ide.py
py
1,151
python
en
code
0
github-code
36
15167501320
""" @author: amal machtalay """ import torch from torch import optim from torchvision import models def save_checkpoint(model, optimizer, name, epoch, image_datasets, path): model.class_to_idx = image_datasets['training'].class_to_idx torch.save({'name': name, 'epoch': epoch, ...
amalmach/image_classifier
project_2/save_load_checkpoint.py
save_load_checkpoint.py
py
1,287
python
en
code
0
github-code
36
21841926557
# -*- coding: utf-8 -*- """ Created on Wed Dec 16 17:17:57 2015 Kepler problem and modified equations. Apply the Stoermer-Verlet to the plannar Kepler problem H(q, p) = 1/2p^Tp - 1/||q||, q, p belong to R^2. Use the BCH formular (L + R 5.40) to compute the second-order correction of the mod...
Rhys314/Simulating_Hamiltonian_Dynamics
Section5,5_Ex6.py
Section5,5_Ex6.py
py
1,760
python
en
code
0
github-code
36
33718292699
def solution(bridge_length, weight, truck_weights): answer=1 from collections import deque bridge=deque([0]*bridge_length) total=0 for truck in range(len(truck_weights)): while True: removed=bridge[0] if total-removed+truck_weights[truck]>weight: bridg...
ayocado/algorithm-study
heewon00/스택, 큐/PGS level2 다리를 지나는 트럭.py
PGS level2 다리를 지나는 트럭.py
py
709
python
en
code
0
github-code
36
34499172798
import tkinter as tk from tkinter import messagebox import random #defininindo as configurações do jogo NUM_LINHAS = 4 NUM_COLUNAS = 4 CARTAO_SIZE_W = 10 CARTAO_SIZE_H = 5 CORES_CARTAO = ['red', 'blue', 'green', 'yellow', 'purple', 'orange', 'magenta', 'gray'] COR_FUNDO = "#343a40" COR_LETRA = "#ffffff" F...
Zpkbiel/prog23gabriel
trabalho de progamação 2.py
trabalho de progamação 2.py
py
3,707
python
pt
code
0
github-code
36
27401072653
import subprocess emotions = ['Angry', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise'] distances = ['/home/hamza/AffectiveTDA2/hera/bottleneck/bottleneck_dist', '/home/hamza/AffectiveTDA2/hera/wasserstein/wasserstein_dist'] subsections = [ ('leftEye', 'rightEye', 'leftEyebrow', 'rightEyebrow', 'nose', 'mouth', 'ja...
USFDataVisualization/AffectiveTDA
topological_distance.py
topological_distance.py
py
1,464
python
en
code
1
github-code
36
5812334986
import babel import babel.numbers import babel.plural from typing import Any, Callable, Dict, List, TYPE_CHECKING, Tuple, Union, cast from typing_extensions import Literal from fluent.syntax import ast as FTL from .builtins import BUILTINS from .prepare import Compiler from .resolver import CurrentEnvironment, Messag...
projectfluent/python-fluent
fluent.runtime/fluent/runtime/bundle.py
bundle.py
py
4,408
python
en
code
185
github-code
36
5315481317
import re class Pattern(object): def __init__(self, name, regex): self.name = name self.pattern = re.compile(regex) def match(self, input, index): return self.pattern.match(input, index) class Terminal(object): def __init__(self, name, value): self.name = name...
msiddalingaiah/TDOP
py/TDOP.py
TDOP.py
py
6,660
python
en
code
0
github-code
36
29861997533
from dataclasses import dataclass import aiohttp import time from datetime import datetime import orjson import aiofiles import asyncio import logging _LOGGER = logging.getLogger(__name__) from .const import JSON_CACHE_FILE @dataclass class InverterData: serial_number: str firmware_version: str|None mod...
tmulkern/SolisWifiDataLogger
custom_components/solis_wifi_data_logger/solis_wifi_api.py
solis_wifi_api.py
py
7,146
python
en
code
0
github-code
36
4419557828
import sys import pygame import random pygame.init() pygame.display.set_caption("who is the caption") window = pygame.display.set_mode((500,500)) font = pygame.font.Font("思源黑体.otf",35) wheel_pics = [] for i in range(25): filename = './pics/' + str(i) + '.png' pic = pygame.image.load(filename) ...
Julia1976/python-project
Game Handling/Chosing the name/新的作品-55-1.py
新的作品-55-1.py
py
1,389
python
en
code
0
github-code
36
10121862874
class Standalone(object): """Common class for all standalone applications""" def __init__(self, args, user_options): # stores the arguments self.args = args self.user_options = user_options if len(args) == 1: # shows the help message if no arguments provided ...
cellnopt/cellnopt
cno/core/standalone.py
standalone.py
py
1,405
python
en
code
10
github-code
36
16442940700
def main(): num_emps = int(input('How many employees record to create? ')) with open('employee.txt','w') as emp_file: emp_file.write('Name\t') emp_file.write('ID number\t') emp_file.write('Department\t') emp_file.write('\n') for emp in range(1, num_emps + 1): ...
thanhtugn/python_core_thanhtugn
lesson_08/solution_assignment_05.py
solution_assignment_05.py
py
1,359
python
en
code
1
github-code
36
6212641952
########################################################## # File: Config.py # Author: Jose Perez <josegperez@mail.com> # Version: Model v5 # # Modify this file to your heart's content # Here we have constants used by my code # I put them all in one place so they can be easy to modify # ################################...
DeveloperJose/Python-Multiscale-Cell-Simulation
Simulation/Config.py
Config.py
py
1,359
python
en
code
1
github-code
36
13735356077
import os import sys import numpy as np import PIL import torch import torch.utils.data import torchvision import matplotlib.pyplot as plt import pickle class AkMinitImagenetDataset(torch.utils.data.Dataset): def __init__(self, rootdir_dataset, str_trainortestorinducing): #grab args === self....
blindreviewgtdxjnsd/gpex_blindreview
PaperResults/MiniImagenet/loadminiimagenet.py
loadminiimagenet.py
py
2,624
python
en
code
0
github-code
36
32921124712
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import datetime import re import redis import scrapy from scrapy.loader import ItemLoader from scrapy.loader.processors import TakeFirst, MapCompose, Join, Identity f...
Umi101108/Spider
www.jobbole.com/ArticleSpider/ArticleSpider/items.py
items.py
py
4,739
python
en
code
2
github-code
36
37661910708
import numpy as np from math import pi import time from scipy.sparse.linalg import eigs, eigsh, spsolve, lobpcg class Solution: def __init__(self, stiffness_matrix, mass_matrix, **kwargs): self.stiffness_matrix = stiffness_matrix.tocsc() self.mass_matrix = mass_matrix.tocsc() self.Kr = kw...
atbrandao/OpenPulse_f
pulse/engine/solution.py
solution.py
py
8,010
python
en
code
null
github-code
36
9663828561
import os import pickle from tqdm import tqdm import multiprocessing as mp import itertools import numpy as np import functools from termcolor import colored import time from numba import jit SAVE_DIR = 'iterator_saves' EXPENDABLE_MEMORY = 5 # in Gig class Iterator: def __init__(self, width, height, _print=Fals...
m1a9l9t7e/RoadGenerator
ip/iterative_construction.py
iterative_construction.py
py
12,413
python
en
code
2
github-code
36
6514242070
""" Author: Inigo Hohmeyer Date: May 9th, 2022 Programming Assignment 4: Naive Bayes Text Classification """ import copy import math import re import sys N = 5 # this function updates the current # dictionary with the counts from the current dictionary def update(current_dict, overall): for i in current_dict:...
hohmeyer/AIAssignment4
main.py
main.py
py
7,019
python
en
code
0
github-code
36
33039659569
class Solution(object): def findLengthOfLCIS(self, nums): if len(nums) == 0: return 0 temp = [1]*(len(nums) + 1) for i in range(1, len(nums)): if nums[i] > nums[i - 1]: temp[i] = 1 + temp[i - 1] return max(temp) print(Solution....
NikitaFir/Leetcode
Longest Continuous Increasing Subsequence.py
Longest Continuous Increasing Subsequence.py
py
403
python
en
code
0
github-code
36
17113250880
import string fname = input("Enter a file name: ") try: fhand = open(fname) except: print("File is not found:",fname) counts = dict() for line in fhand: line = line.rstrip() line = line.lower() line = line.translate(line.maketrans('','',string.punctuation)) line = line.translate((line.maketran...
amrmabdelazeem/PythonForEverybody
exercise10.12.3.py
exercise10.12.3.py
py
766
python
en
code
0
github-code
36
40177340538
""" Cultural Evolution Simulation (Yummy_Recipe) Ali Fazeli Final Project of B.sc Level in Computer Engineering Task: Simulate changes in recipes within a population of Agents over several generations depending on different rule sets. """ idA = 0 # All Agents ever cre...
alifzl/Final_B.Sc_Project
second_and_probably_last/Yummy_Recipe/Config.py
Config.py
py
1,183
python
en
code
2
github-code
36
39274579320
import os from ..auth.auth_handler import create_jwt from postmarker.core import PostmarkClient from ..models.attendee import Attendee from fastapi import APIRouter, HTTPException, Depends, Request from pyairtable.api.table import Table from ..dependencies import get_registration_table from email_validator import valid...
LosAltosHacks/api
app/routers/register.py
register.py
py
4,977
python
en
code
0
github-code
36
70562613224
from collections import deque from heapq import heappush, heappop def solution(priorities, location): priority_heap = [] queue = deque() count = 0 for idx, priority in enumerate(priorities): queue.append((priority, idx)) heappush(priority_heap,(-priority, priority)) while queue: ...
zsmalla/algorithm-jistudy-season1
src/Programmers_HighScore_Kit/스택&큐/임지수/프린터_python_임지수.py
프린터_python_임지수.py
py
576
python
en
code
0
github-code
36
30247439502
#!/usr/bin/env python3 from optparse import OptionParser def parse_arguments(): parser = OptionParser(usage='usage: %prog [option]... URL...') parser.add_option('-i', dest='input_file', metavar='FILE', help='Download URLs found in FILE') parser.add_option('-C', dest='cookie_file', de...
b1337xyz/e-hen
args.py
args.py
py
553
python
en
code
1
github-code
36
42298776688
num =[1,32,42] for i in num: print(i) print("\t\tBy iterator built in function:") it=iter(num)#ye ak built in fun ha jo values ko iterate krta ha print(it.__next__())#next valu k liye print(it.__next__()) print(next(it))#ye dono same han =print(it.__next__()) print() class topten: def ...
IbrarShakoor/Python-codes
iterators.py
iterators.py
py
728
python
en
code
1
github-code
36
73522000744
from math import ceil def SimpleLowerBound(items, binSize, className): d1Sum = 0 d2Sum = 0 d3Sum = 0 for item in items: d1Sum += item.getD1() d2Sum += item.getD2() d3Sum += item.getD3() lowerBound = max(ceil(d1Sum/binSize[0]), ceil(d3Sum/binSize[1]), ceil(d3S...
Pityundra/VektorPakolas
resources/simpleLowerBound.py
simpleLowerBound.py
py
919
python
hu
code
0
github-code
36
39835210130
xa=float(input("Zadaj x-ovú súradnicu bodu A:"+"\n")) ya=float(input("Zadaj y-ovú súradnicu bodu A:"+"\n")) xb=float(input("Zadaj x-ovú súradnicu bodu B:"+"\n")) yb=float(input("Zadaj y-ovú súradnicu bodu B:"+"\n")) print() xu=xa-xb yu=ya-yb print("Súradnice vektora AB=["+str(xu)+","+str(yu)+"]") print("Veľkosť vektora...
Rastislav19/programs-learning
Python-EKG/funkcie/funkcie2/6.py
6.py
py
806
python
sk
code
0
github-code
36
34046878888
from pyspark.sql import SparkSession from pyspark.sql.types import StringType,StructField,StructType,IntegerType spark = SparkSession.builder.master("local[*]").appName("romeoJulietWordCount").getOrCreate() sc = spark.sparkContext inprdd = sc.textFile("D:/Spark_Scala/data/wordcount/romeojuliet.txt") #convert to lower...
ZosBHAI/pysparkexamples
wordcount01.py
wordcount01.py
py
940
python
en
code
0
github-code
36
21639598208
from transopt.utils.Register import benchmark_registry from transopt.Benchmark.BenchBase import ( TransferOptBenchmark, RemoteTransferOptBenchmark, ) def construct_test_suits( tasks: dict = None, seed: int = 0, remote: bool = False, server_url: str = None ) -> TransferOptBenchmark: tasks = tasks or {}...
maopl/TransOpt
transopt/Benchmark/construct_test_suits.py
construct_test_suits.py
py
1,336
python
en
code
3
github-code
36
74045387624
#!/usr/bin/env python # coding: utf-8 # """ # Task-3: Design and implement recursive solution for the below mentioned scenarios. # There are n industries, each with a water treatment plant, located along a side of a river. # We will assume that the industries are arranged from left to right. Each industry generates se...
aman2003selwaria/activity
problem 3 (discharge water).py
problem 3 (discharge water).py
py
1,433
python
en
code
0
github-code
36
33525029807
from methods import * testOne = [{'title': 'Evaluation','words': [('bad','good')]}, {'title': 'Potency', 'words': [('weak','strong')]}, {'title': 'Activity', 'words': [('passive','active')]}] testOneAlt = [{'title': 'Evaluation','words': [('bad','good'),('negative','positive')]}, {'title': 'Potency', 'words': [('weak'...
SoliMouse/Semantic-Differential
playground.py
playground.py
py
3,440
python
en
code
1
github-code
36
37977404672
''' Python module containing "Master" classes of easy_gui project. The classes in here are designed to be subclassed in user applications. ''' import tkinter as tk from tkinter import ttk from tkinter import _tkinter from .styles import BaseStyle from . import widgets import os import sys import threading import traceb...
zachbateman/easy_gui
easy_gui/master_classes.py
master_classes.py
py
26,902
python
en
code
1
github-code
36
10507977468
# -*- coding:utf-8 -*- # 016 ファイルをN分割する # 自然数Nをコマンドライン引数などの手段で受け取り,入力のファイルを行単位でN分割せよ.同様の処理をsplitコマンドで実現せよ. # 参考資料 # http://itpro.nikkeibp.co.jp/article/COLUMN/20060227/230888/ # 解答 # split -l 10 hightemp.txt out def split_file(fileName, n): f = open(fileName, 'r') result = [] for line in f: res...
c-su/python_nlp_100practice
chapter2/nlp016.py
nlp016.py
py
923
python
ja
code
1
github-code
36
1912079774
import os from time import sleep #defining the menu def menu(): sleep(1) os.system('cls') print("\nMENU") print("1.Metric") print("2.Imperial") print("3.Quotes") print("4.Quit") #define function to calculate BMI in metric system def metric(): weight=float(input("Please enter your weight...
archeris32/evolution
BMI calculator/bmi_calculator.py
bmi_calculator.py
py
2,306
python
en
code
0
github-code
36
2014711280
# -*- coding:utf-8 -*- import requests import json import os import time start = time.time() respond = requests.get('http://pvp.qq.com/web201605/js/herolist.json') respond = respond.read() respond = respond.encode('utf-8')[3:].decode('utf-8') json_hero = json.loads(respond) x = 0 hero_dir = 'D:\img\\' if not os.pat...
rinuandengfeng/python_study
所有/爬虫.py
爬虫.py
py
1,158
python
en
code
0
github-code
36
31298726473
class Solution(object): def searchInsert(self, nums, target): if len(nums) == 0: return 0 left, right = 0, len(nums) mid = 0 while left < right: mid = (left + right) // 2 if nums[mid] == target: return mid elif nums[mid...
shwjdgh34/algorithms-python
leetcode/35.py
35.py
py
496
python
en
code
2
github-code
36
38746128821
from sqlalchemy import create_engine from config import MYSQL_ROSPARK_DB from db.rospark_db import Base, make_engine try: engine = make_engine(MYSQL_ROSPARK_DB) Base.metadata.drop_all(bind=engine) Base.metadata.create_all(bind=engine, tables=[Base.metadata.tables["parkings"]])...
andxeg/LeadersOfDigital_2020_parking_system
src/recreate_db.py
recreate_db.py
py
374
python
en
code
1
github-code
36
74483870822
""" Implement the functions used when the user chooses either platform (Chess.com or Lichess) """ from collections import OrderedDict def calculate_percentages(moves_dict): """ Calculate the winning, losing and drawing percentages of each position in moves_dict """ for move in moves_...
felaube/chess-games-explorer
helpers.py
helpers.py
py
4,149
python
en
code
0
github-code
36