seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
4742385486
import sys # insert at 1, 0 is the script path (or '' in REPL) sys.path.insert(1, 'CodeFiles') import WebScraping as FP import pandas as pd """ We want to run this loop until they type 'exit' This is non the GUI version of the application """ while(1): searchTerm = input("What stock are you looking for: ") if...
ndimaria/EE551FinalProject
main.py
main.py
py
679
python
en
code
0
github-code
6
4605424135
import argparse from spherenet import OmniMNIST, OmniFashionMNIST from spherenet import SphereConv2D, SphereMaxPool2D import torch from torch import nn import torch.nn.functional as F import numpy as np class SphereNet(nn.Module): def __init__(self): super(SphereNet, self).__init__() self.conv1 = ...
ChiWeiHsiao/SphereNet-pytorch
example.py
example.py
py
6,671
python
en
code
106
github-code
6
24106546856
import os import cv2 from flask import ( Flask, Response, render_template, request, session, redirect, send_file, url_for, ) from fas.inferer import face_detector, fas_model, infer_img, infer_video, infer_frame # from fas.inferer import face_detector, fas_model, infer_img, infer_video ...
LananhTran302001/face-anti-spoofing-flaskapp
app.py
app.py
py
10,387
python
en
code
2
github-code
6
18674503310
from aocd import lines from aocd import submit shape_score = {'A': 1, 'B': 2, 'C': 3} outcome = { 'A' : {'A': 3, 'B': 6, 'C': 0}, 'B' : {'A': 0, 'B': 3, 'C': 6}, 'C' : {'A': 6, 'B': 0, 'C': 3}} def score(line): shape_coding = {'X': 'A', 'Y': 'B', 'Z': 'C'} he, you = line.split() you = shape_c...
schn27/aoc2022
02.py
02.py
py
705
python
en
code
0
github-code
6
22456923071
from django.core import paginator from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.contrib import messages from .models import * from .forms import * from reacts.forms import CommentForm from .utils import searchTask...
Kyrillos1/Ekhdm
tasks/views.py
views.py
py
3,892
python
en
code
1
github-code
6
73673851706
import time # from seleniumwire import webdriver from selenium import webdriver from selenium.webdriver.edge.service import Service import requests import datetime import lib from fake_useragent import UserAgent from pyvirtualdisplay import Display ua = UserAgent() driver_path = lib.driver_path ex_path = lib.ex_path...
YoimiyaInUSTC/WSJ-Crawler
driver_init.py
driver_init.py
py
2,879
python
en
code
2
github-code
6
420324822
from xfile.base import File, Plugin, PluginResult, PluginResults from rads2file.ads import AppException, AdsAnalyzer class RarAdsPlugin(Plugin): name = 'rarads' def run(self, file: File, results: PluginResults) -> PluginResult: try: ads = AdsAnalyzer(file.as_posix()) streams = a...
juanmera/xfile
xfile/plugin/compression.py
compression.py
py
550
python
en
code
0
github-code
6
18091305999
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('account', '0051_auto_20150130_1145'), ] operations = [ migrations.AlterField( model_name='basicmemberinformation...
hongdangodori/slehome
slehome/account/migrations/0052_auto_20150130_1145.py
0052_auto_20150130_1145.py
py
531
python
en
code
0
github-code
6
24176860716
# coding: utf-8 import re import logging from collections import OrderedDict from copy import copy logger = logging.getLogger(__name__) try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET from lxml import etree def uniq_seq_merge(seq1, seq2): new_seq = copy(s...
felixchr/xml_conf
xmlconf.py
xmlconf.py
py
28,143
python
en
code
0
github-code
6
16408579191
from pyscf import gto, scf import asf import numpy as np from pyscf.mcscf import avas ASF = asf.asf() mol = gto.Mole() mol.atom = """ C 0.00000 0.00000 0.00000 C 0.00000 0.00000 1.20000 """ mol.basis = 'def2-svp' mol.charge = 0 mol.spin = 0 mol.build() # UHF for UNOs mf =...
LDongWang/ActiveSpaceFinder
examples/avas/c2.py
c2.py
py
889
python
en
code
null
github-code
6
6465021088
""" This module takes care of starting the API Server, Loading the DB and Adding the endpoints """ from flask import Flask, request, jsonify, url_for, Blueprint from api.models import db, User, Family from api.utils import generate_sitemap, APIException api = Blueprint('api', __name__) @api.route('/Family', method...
yasRF/apiFamily
src/api/routes.py
routes.py
py
1,551
python
en
code
0
github-code
6
74473555069
"""Вычислить значение суммы S = 1/1! + 1/2! + ... + 1/k! """ number = int(input()) print (number) i = 2 rezult = 1.0 summa = 1.0 while (i<=number): summa =summa/i rezult += summa i+=1 print (summa , rezult) print (rezult)
kvintagav/learning_to_program
Python/rekyrsia.py
rekyrsia.py
py
257
python
hr
code
0
github-code
6
11036089604
import wx import MapDisplay class MapPreviewDialog(wx.Dialog): def __init__(self, parent, id, map): wx.Dialog.__init__(self, parent, id, "iPhone Preview") self.map = map self.display = MapDisplay.MapDisplay(self, -1, map) self.display.SetMinSize((480, 320)) sizer = wx.Bo...
sdetwiler/pammo
editor/source/MapPreviewDialog.py
MapPreviewDialog.py
py
436
python
en
code
0
github-code
6
9679183776
''' some useful spark bot suff ''' import os import requests import json API_TEMPLATE = 'https://api.ciscospark.com/v1/{}' MENTION_REGEX = r'<spark-mention.*?data-object-id="(\w+)".*?spark-mention>' PERSON_ID = os.environ['PERSON_ID'] HEADERS = { "Authorization": "Bearer {}".format(os.environ['TOKEN']), "C...
msiddorn/spark-bot
bot_helpers.py
bot_helpers.py
py
1,510
python
en
code
0
github-code
6
15183208796
#! usr/bin/env python # -*- coding : utf-8 -*- import codecs from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, make_scorer import time import numpy as np np.random.seed(123) from skopt import gp_minimize import matplotlib.pyplot as plt from random import uniform from skopt.acqu...
aggarwalpiush/Hyperparameter-Optimization-Tutorial
model/svm_demo.py
svm_demo.py
py
5,946
python
en
code
3
github-code
6
43901468636
import io from PIL import Image import pytesseract from wand.image import Image as wi pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe" pdf = wi(filename = "AvradeepGupta.pdf", resolution = 300) # To read the pdf file and create a pdf object pdfImage = pdf.convert('jpeg')...
AvradeepGupta/OCR
OCR.py
OCR.py
py
1,516
python
en
code
0
github-code
6
38930994169
# type: ignore from inspect import getmembers, isfunction import re, typing import traceback from typing import Callable from PySide2.QtWidgets import QWidget, QSplitter, QVBoxLayout, QSizePolicy, QMenu, QPushButton, QAction, QScrollArea from PySide2.QtGui import QIcon from PySide2.QtCore import Signal, QSize impo...
subski/DAMAKER
damaker_gui/widgets/FunctionListWidget.py
FunctionListWidget.py
py
6,131
python
en
code
0
github-code
6
30338039407
# 이진탐색은 최솟값과 최고값을 정하는 것을 생각하면서 알고리즘을 짠다 # 각 문제별 조건에 맞게 if문의 조건과 내부 추가된 변수들을 문제에 맞게 변형 def binary(start, end): global ans while start<=end: mid = (start+end)//2 cur = arr[0] count = 1 for i in range(1, len(arr)): if arr[i] >= cur+mid: count += 1 ...
minju7346/CordingTest
backjoon/2110.py
2110.py
py
724
python
ko
code
0
github-code
6
27765054450
from django.test import RequestFactory from django.test import Client from test_plus.test import TestCase from rest_framework.test import force_authenticate from rest_framework.test import APIRequestFactory from semillas_backend.users.factory import UserFactory from wallet.factory import TransactionFactory from wal...
sergimartnez/semillas_backend
wallet/tests/test_views.py
test_views.py
py
3,513
python
en
code
null
github-code
6
8938995188
from django.core.management.base import BaseCommand, CommandError from django.core.cache import cache from utils import cronlog from pom.scrape import laundry, menus, printers class Command(BaseCommand): args = '<modules to scrape>' help = 'Scrapes data and stores in memcached with a timestamp' def handle...
epkugelmass/USG-srv-dev
tigerapps/pom/management/commands/pom_scrape.py
pom_scrape.py
py
992
python
en
code
null
github-code
6
26683133766
#!/usr/bin/python3 def safe_print_list(my_list=[], x=0): '''Prints x elements of a list Args: my_list: list x: number of elements to print Return: Actual number of elements printed ''' length = 0 for i in range(x): try: print(my_list[i], end='') ...
nzubeifechukwu/alx-higher_level_programming
0x05-python-exceptions/0-safe_print_list.py
0-safe_print_list.py
py
424
python
en
code
0
github-code
6
14592805021
def quant_both_func(): config_list = [{ 'quant_types': ['weight'], 'quant_bits': { 'weight': 8, }, #'quant_start_step': 10, #'op_types':['Conv2d', 'Linear', 'GRU', 'LSTM', 'RNN'], 'op_types':['Conv2d', 'GRU', 'LSTM', 'RNN', 'Li...
TrellixVulnTeam/classification_LJ3O
tools/SKDX/algorithms/compression/pytorch/config/quant_configs.py
quant_configs.py
py
1,095
python
en
code
0
github-code
6
2228249565
import os from pathlib import Path import time import random class BuildTools(): def NewPlugin(): a = open('plugin.json', "w") a.write('{\n\n\t"MyAddonName": "TestName",\n\t"LocalDependencies": "KoBashToolkit.engine.enginestart"\n}') a.close() def IDE(ide): """ Determines...
thekaigonzalez/kobash.old
KoBashToolkit/sharedtoolkits/buildTools/cus.py
cus.py
py
1,503
python
en
code
0
github-code
6
72612835709
import pytest from tast5_1 import Task5 import logging @pytest.mark.parametrize('filename, content', [ ('1.txt', 'a\n'), ('2.txt', 'b\n'), ('3.txt', 'c\n'), ('4.txt', 'd\n'), ...
fedepacher/Wazuh-Test
Task_5/test_case_51.py
test_case_51.py
py
591
python
en
code
0
github-code
6
25136195461
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String, DateTime, Float, and_, or_ from sqlalchemy.dialects import postgresql from geoalchemy2 import Geometry from geoalchemy2.functions import GenericFunction, ST_AsMVTGeom, ST_TileEnvelope from sqlalchemy.dialects.postgresql import BYTEA, JSONB...
openhistorymap/tiles-api
app/api copy.py
api copy.py
py
9,634
python
en
code
0
github-code
6
27638557087
def countingSort(inputArray): # Find the maximum element in the inputArray maxEl = max(inputArray) countArrayLength = maxEl + 1 # Initialize the countArray with (max+1) zeros countArray = [0] * countArrayLength # Step 1 -> Traverse the inputArray and increase # the corresponding count for...
SyedZawwarAhmed/Hacktoberfest-2023
Algorithms/Python/countingSort.py
countingSort.py
py
1,194
python
en
code
20
github-code
6
11370330174
from Models import pi_net, weights_init_1st import multiprocessing import torch.optim as optim import torch from torch.distributions import Categorical import torch.nn.functional as F from torch import tanh import numpy as np from utils import get_state_repr_from_int, get_state_from_int, get_state_as_int, get_state_rep...
ssainz/reinforcement_learning_algorithms
fleet_simulator/FleetSimulatorAgentConcurrent.py
FleetSimulatorAgentConcurrent.py
py
5,529
python
en
code
0
github-code
6
34453088360
import random import atexit import sys import argparse import time from tracemalloc import start parser = argparse.ArgumentParser(description='Simulates coin flips') parser.add_argument('--quiet','-q', action='store_true', help='Run in quiet mode. Do not print out new max streaks') parser.add_argument('--total', '-t',...
bwu2018/pointless-coinflip
sim.py
sim.py
py
1,868
python
en
code
0
github-code
6
20831073732
import random from string import ascii_letters from socialnet.models import Account, Post, PostImages, Avatar, Image, Following from posts.models import Comments, Tag, PostTags, Upvote, Downvote from django.core.management.base import BaseCommand, CommandError def random_string(length): return "".join(random.choi...
YevheniiMorozov/social
gramm/socialnet/management/commands/fake_data.py
fake_data.py
py
3,984
python
en
code
0
github-code
6
33973372657
""" Implementation of the CART algorithm to train decision tree classifiers. """ import numpy as np from algorithms.default_algorithm import DefaultClassifier from tree import tree class CART(DefaultClassifier): def __init__(self, max_depth=None, min_samples_stop=0): super().__init__(max_depth, min_...
user-anonymous-researcher/interpretable-dts
algorithms/cart.py
cart.py
py
5,809
python
en
code
0
github-code
6
72296922429
import csv # Функция 1 def option1(count, d): """Функция принимает пустой словарь и счетчик, затем считаывает все строки из файла и выводит словарь с департаментами и отделами в нем """ with open("Corp Summary.csv", encoding='utf-8') as r_file: file_reader = csv.reader(r_file, delimiter=";") ...
janemur/HW2
main.py
main.py
py
4,668
python
ru
code
0
github-code
6
72784514747
# https://www.codewars.com/kata/58c218efd8d3cad11c0000ef def bin_str(s): ss = '0' * len(s) index = s.find('1') for i in range(len(s) * 2): if ss == s: return i s = s[:index] + s[index:].translate(str.maketrans({'0': '1', '1': '0'})) index = s.find('1') return 0
blzzua/codewars
7-kyu/simple_fun_194_binary_string.py
simple_fun_194_binary_string.py
py
315
python
en
code
0
github-code
6
21099019143
# coding: utf-8 import blogSystem.models as blog_models from django.shortcuts import render_to_response, RequestContext import json from django.db.models import Q import time from itertools import chain import jieba from django.core.paginator import Paginator from django.core.paginator import EmptyPage from django.cor...
zzlpeter/blog
blogSystem/search/views.py
views.py
py
2,006
python
en
code
0
github-code
6
18239861293
#!/usr/bin/env python import urllib2 from bs4 import BeautifulSoup def main(): boys_limit = 265 boys_url = 'http://www.muslimnames.info/baby-boys/islamic-boys-names-' girls_limit = 243 girls_url = 'http://www.muslimnames.info/baby-girls/islamic-girls-names-' output_file = open('names.txt', 'a') selector = 'boys'...
amazoedu0/Artificial-Intelligence
muslim-names-crawler-master/muslim-names-crawler-master/muslim_names_crawler.py
muslim_names_crawler.py
py
763
python
en
code
0
github-code
6
22451231028
# -*- coding: utf-8 -*- """ úkol 9. - zpracování HTML """ from html.parser import HTMLParser import re import urllib.request class MyParser(HTMLParser): """ dictionary """ dic = {} mail = set() em = re.compile('[a-z1-9\\.]+@[a-z1-9\\.]+') def __init__(self, page): """constructor""" ...
kbogi/pjp
cv09/scraper.py
scraper.py
py
2,352
python
en
code
0
github-code
6
833710532
import numpy as np import copy n = 3 m = 3 def set_matrix(): return [ np.random.randint(1, 10, (n, m)).astype('float'), np.random.randint(1, 10, n).astype('float'), np.random.randint(1, 10, m).astype('float') ] def find_lead_str(A, b, leadCol): leadStrVal = np.inf for i in ra...
UIIf/Study
3course/Optimization/lab3.py
lab3.py
py
4,755
python
en
code
0
github-code
6
16906656895
'''Создание светофора с помощью класса TrafficLight.''' from time import sleep class TrafficLight: '''Класс реализующий работу светофора''' __color = [('Красный', 7), ('Желтый', 2), ('Зеленый', 2)] def running(self): '''Переключает режим светофора. Вернет строку.''' for i in self.__color:...
AlexLep1n/Python
lesson-7/app_1.py
app_1.py
py
574
python
ru
code
0
github-code
6
71271550269
class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: # Optimal Solution m = len(matrix) n = len(matrix[0]) start = 0 end = (m*n)-1 while(start<=end): mid = start + (end-start)//2 check = matrix[mid//n][mid%n] ...
anubhavsrivastava10/Leetcode-HackerEarth-Solution
Leetcode/March2022/30)74. Search a 2D Matrix.py
30)74. Search a 2D Matrix.py
py
875
python
en
code
9
github-code
6
37788290307
import yaml from sigma.parser.condition import ConditionAND, ConditionOR from sigma.config.exceptions import SigmaConfigParseError from sigma.config.mapping import FieldMapping # Configuration class SigmaConfiguration: """Sigma converter configuration. Contains field mappings and logsource descriptions""" def ...
socprime/soc_workflow_app_ce
soc_workflow_ce/server/translation_script/sigma/tools/sigma/configuration.py
configuration.py
py
9,714
python
en
code
91
github-code
6
1693464120
import discord from discord.ext import commands from discord import app_commands class Ping(commands.Cog): def __init__(self, client): self.client = client @app_commands.command() async def ping(self, interaction: discord.Interaction): """Shows the latency of the bot (doesn't really matter...
megachickn101/nphc-discord-bot
cogs/ping.py
ping.py
py
490
python
en
code
0
github-code
6
32841409829
import sys import pymysql import pymongo import re import itertools import pickle as pkl import pandas as pd from pymongo import MongoClient from collections import defaultdict from util.preprocessing import * client = MongoClient('localhost', 27017) database = client['research'] ptt_posts = database['2018_ptt_posts'...
kartd0094775/IdentifyKOL
preprocess_ptt.py
preprocess_ptt.py
py
1,961
python
en
code
0
github-code
6
27185060813
"""Core of the discord bot.""" import discord from discord.ext import commands from pretty_help import PrettyHelp import config as c __author__ = "Diabolica" intents = discord.Intents.default() intents.members = True startup_extensions = ["config", "commands_miscellaneous", "commands_ticketing", "commands_rob...
Diabolicah/GPO-Bot
main.py
main.py
py
3,653
python
en
code
0
github-code
6
71577995707
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test that the ``Oxentiel`` class loads dictionaries correctly. """ from typing import Dict, Any from hypothesis import given from oxentiel import Oxentiel from oxentiel.tests import strategies # pylint: disable=no-value-for-parameter @given(strategies.settings_dict...
langfield/oxentiel
oxentiel/tests/test_oxentiel.py
test_oxentiel.py
py
1,960
python
en
code
0
github-code
6
18515564727
###### UNIMIB - 2022 Indiegogo ###### import sys import json import pyspark from pyspark.sql.functions import col, collect_list, array_join from awsglue.transforms import * from awsglue.utils import getResolvedOptions from pyspark.context import SparkContext from awsglue.context import GlueContext from awsglue.job i...
mauropelucchi/unimib_masterbi_2022
aws/aws_glue_job.py
aws_glue_job.py
py
2,077
python
en
code
3
github-code
6
34730847071
#!/us/bin/env python3 # countingValleys has the following parameter(s): int steps: the number of steps on the hike string path: a string describing the path # Return: int: the number of valleys traversed def countingValleys(steps, path): # Write your code here valley = 0 seaLevel = 0 for i in range(st...
dejanu/sretoolkit
FunNotFun/HackerRank/CountingValleys.py
CountingValleys.py
py
567
python
en
code
5
github-code
6
20216349442
from model.flyweight import Flyweight from model.static.database import database class Jump(Flyweight): def __init__(self,stargate_id): #prevents reinitializing if "_inited" in self.__dict__: return self._inited = None #prevents reinitializing self.stargate_id =...
Iconik/eve-suite
src/model/static/map/jump.py
jump.py
py
577
python
en
code
0
github-code
6
30477706900
# Trapping Rain Water # Approach 1 def trappingWater(arr, n): left_max = [0] * n right_max = [0] * n left_max[0] = arr[0] for i in range(1, n): left_max[i] = max(arr[i], left_max[i - 1]) right_max[n - 1] = arr[n - 1] for i in range(n - 2, -1, -1): right_max[i] = max(arr[i]...
prabhat-gp/GFG
Arrays/Arrays Medium/6_trp.py
6_trp.py
py
912
python
en
code
0
github-code
6
30063492674
import logs import module_class def help_main(Env): print(Env) print(list(Env.Modules.keys())) print(Env.Current) Mod = Env.Current work(Mod,Env.Modules) def work(Mod,Sons): if list(Mod.parameters.keys())!=[]: logs.log_error("explodeBusses must not encounter parameters") ret...
greenblat/vlsistuff
verpy/pybin3/explodeBusses.py
explodeBusses.py
py
7,355
python
en
code
41
github-code
6
42986734068
# Import modules import tkinter import tkinter.font as tkFont from tkinter import * # Class to create a button that changes color when hovered over # Inherits from tkinter Button class class HoverButton1(tkinter.Button): def __init__(self, **kw): tkinter.Button.__init__(self, **kw) self['bd'] = 1 ...
Jasmined26/JCalc
JCalc.py
JCalc.py
py
8,764
python
en
code
0
github-code
6
32559185862
cijfers = { 'Peter': 2, 'Sjaak': 4, 'Diederik': 10, 'Jan': 9, 'Pieter': 8, 'Andre': 6, 'Ruud': 7, 'Nigel': 10 } for a, b in cijfers.items(): if b > 8: print('{}, {}'.format(a, b))
ruudvenderbosch/python
Week 4/Les 1/Opdracht 3.py
Opdracht 3.py
py
242
python
en
code
0
github-code
6
7538487038
# Problem: Creating a Frequency Counter # Write a Python function called calculate_frequency that takes a list of words as input and returns a dictionary # where the keys are the unique words from the list, and the values are the frequencies of those words in the list. # { # "apple": 3, # "banana": 2, # ...
Shaunc99/Python
dictionary/dictionary1.py
dictionary1.py
py
692
python
en
code
2
github-code
6
74436961468
from matplotlib import colors import matplotlib.pyplot as plt fp = open('out', 'r') lines = list(map(lambda x: [float(y) for y in x.split(':')[1:]], fp.readlines())) lines = list(map(lambda x: [x[0], x[1]*100], lines)) for line in lines: print(line) # For found ns = [lines[x][0] for ...
dipeshkaphle/LabsAndAssignments
CSLR41-AlgosLab/Lab1/plot.py
plot.py
py
912
python
en
code
7
github-code
6
29888933076
from tkinter import * root= Tk() root.title("PARITY CHECKER") label1=Label(root, text=" Enter the data:- ") inp=Entry(root,width=50) label1.grid(column=0,row=0,pady=20) inp.grid(column=1, row=0) def evenBit(): s=inp.get() data="" if(s.count('1')%2==0): data=s+'0' else: ...
aman-tiwari-05/Network-Project
Entry or Input.py
Entry or Input.py
py
946
python
en
code
0
github-code
6
5048789934
from mesa import Agent import random class GameAgent(Agent): """ An agent that is more likely to choose the mean option. """ def __init__(self, unique_id, model, home_cell=None): super().__init__(unique_id, model) self.score = 1 self.home_cell = home_cell self.spouse = None ...
LouisSentinella/AgentBasedModelling
prisoners_dilemma/agents.py
agents.py
py
14,250
python
en
code
0
github-code
6
9767092930
import numpy as np # import networkx as nx from collections import * from itertools import * from functools import * import math import re from common.session import AdventSession session = AdventSession(day=18, year=2020) data = session.data.strip() data = data.split('\n') p1, p2 = 0, 0 def findmatch(expr, i): ...
smartspot2/advent-of-code
2020/day18.py
day18.py
py
1,777
python
en
code
0
github-code
6
8665454584
# -*- coding: utf-8 -*- import os import time from boto3.dynamodb.conditions import Key import settings from db_util import DBUtil from lambda_base import LambdaBase from jsonschema import validate from not_authorized_error import NotAuthorizedError from user_util import UserUtil class MeCommentsDelete(LambdaBase)...
AlisProject/serverless-application
src/handlers/me/comments/delete/me_comments_delete.py
me_comments_delete.py
py
2,706
python
en
code
54
github-code
6
8763913854
import imp from tkinter import * root = Tk() root.geometry('200x300') courselist = ['html', 'css', 'java script', 'php'] var = Variable(value=courselist) lb = Listbox(root ,height=10, width=20, selectmode="multiple", font="Arial 20",listvariable=var, bg='mistyrose') lb.pack() root.mainloop()
Ujjaval07/Python
ListBox.py
ListBox.py
py
310
python
en
code
0
github-code
6
72532113149
# pylint: disable=unused-variable # pylint: disable=unused-argument # pylint: disable=redefined-outer-name import json from copy import deepcopy import httpx import pytest import respx from fastapi import FastAPI from respx import MockRouter from simcore_service_api_server._meta import API_VTAG from simcore_service_...
ITISFoundation/osparc-simcore
services/api-server/tests/unit/_with_db/test_api_user.py
test_api_user.py
py
2,813
python
en
code
35
github-code
6
14350976599
from flask import Flask,request from flask_restful import Resource, Api from tensorflow import keras import numpy as np from flask_cors import CORS COLUMNS = ['temp', 'wind', 'rain', 'FFMC', 'DMC', 'DC', 'ISI', 'RH', 'BUI', 'FWI'] app = Flask(__name__) # CORS(app) # creating an API object api = Api(app) # Load model...
grab-bootcamp/API
app.py
app.py
py
766
python
en
code
0
github-code
6
21251905362
"""Parse the discussion wiki and archive the data in the database.""" import re import pathlib from operator import ior from functools import reduce from string import punctuation from database import DatabaseDiscussion from parser_wiki import Parser, Discussion DISCUSSION_ENTRY_PATH = "src\\queries\\discussion\\add_...
Manitary/r-anime-archive
src/parser_wiki_discussion.py
parser_wiki_discussion.py
py
7,244
python
en
code
0
github-code
6
74874760507
import setuptools # Must be before Cython import import Emma with open("README.md", "r") as fp: long_description = fp.read() try: from Cython.Compiler import Options from Cython.Build import cythonize Options.docstrings = True Options.fast_fail = True extension...
bmwcarit/Emma
setup.py
setup.py
py
3,594
python
en
code
2
github-code
6
1584177491
import os from django.core.files.storage import FileSystemStorage try: FileNotFoundError except: FileNotFoundError = IOError class BaseStorage(FileSystemStorage): def _open(self, name, mode='rb'): try: return super(BaseStorage, self)._open(name, mode) except FileNotFoundError:...
beniwohli/django-localdevstorage
localdevstorage/base.py
base.py
py
1,602
python
en
code
50
github-code
6
1398543214
""" Outlnies the methods to be used for the signUp app. """ from django.shortcuts import render, redirect from django.core.mail import EmailMessage from django.template.loader import render_to_string from django.contrib.sites.shortcuts import get_current_site from django.utils.http import urlsafe_base64_encode from dja...
jjandrew/GroupEngineeringProjectGroup4
technical-documents/source-code/signUp/views.py
views.py
py
3,569
python
en
code
0
github-code
6
71247072827
import time import pandas as pd CITY_DATA = {'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv'} def get_filters(): """ Asks user to specify a city, month, and day to analyze. Returns: (str) city - name of the city to analyze ...
lubocsu/Udacity-Data-Analyst-Project
数据分析入门/项目2/bikeshare.py
bikeshare.py
py
14,417
python
en
code
0
github-code
6
38484654
# Game 1 : Made by Me # print("Welcome to my computer quiz!") # playing = (input("Do you wanna play the game? ")) # if playing.capitalize() == ("Yes"): # NameOfTheGame = input("Enter the name of the game you wanna play: ") # print(f"Opening {NameOfTheGame} .....") # else: # print("Come sometime else bit...
Gaurav-jo1/Python_mini_project
quiz_game.py
quiz_game.py
py
1,294
python
en
code
1
github-code
6
40880843423
import re import dateutil.parser class DateRegex: def __init__( self, pattern, ): self.pattern = pattern def convert( self, date_string, ): match = re.search( pattern=self.pattern, string=date_string, flags=re.IGNOREC...
dhkron/whois
whois/parsers/converter.py
converter.py
py
1,544
python
en
code
0
github-code
6
21925605098
from __future__ import annotations import copy from typing import Optional, Dict from dlgo.gotypes import Player, Point from dlgo import zobrist from dlgo.scoring import compute_game_result from dlgo.utils import MoveAge __all__ = [ 'Board', 'GameState', 'Move', ] neighbor_tables = {} corner_tables = {...
dbradf/dlgo
src/dlgo/goboard_fast.py
goboard_fast.py
py
12,409
python
en
code
0
github-code
6
21223219243
''' An example run script using custom pre- and post-actions. ''' from bueno.public import container from bueno.public import experiment from bueno.public import logger def pre_action(**kwargs): ''' Actions performed before running the experiment (setup). ''' logger.emlog('# Entering pre_action') de...
rbberger/bueno
examples/custom-actions/custom_actions.py
custom_actions.py
py
1,510
python
en
code
null
github-code
6
21971682039
# TESTOS DE CREACIO/REGISTRE from classes.models import Class from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase class ClassRegistrationAPIViewTestCase(APITestCase): def test_one_bad_file_classes(self): """ Test to verify that a post call ...
sergiii24/FitHaus_Backend
app/classes/tests.py
tests.py
py
746
python
en
code
0
github-code
6
5329031446
import torch import copy from torch.quantization.quantize import add_observer_ _RELU_BRANCH = {'son':None,'can_be_fused':True} _BN_BRANCH = {'son': {torch.nn.ReLU:_RELU_BRANCH},'can_be_fused':True} _NN_BRANCH = {'son': {torch.nn.ReLU:_RELU_BRANCH},'can_be_fused':False} _CONV_BRANCH = {'son': {torch.nn.BatchNorm2d:_BN_...
HuDi2018/QTorch
utils/Quant.py
Quant.py
py
1,941
python
en
code
1
github-code
6
23497250977
# coding: utf-8 from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # pylint:disable=redefined-builtin,unused-wildcard-import,wildcard-import,wrong-import-order from collections import deque impor...
alexlyn/stb-tester
_stbt/motion.py
motion.py
py
12,155
python
en
code
null
github-code
6
16551762444
''' Created on May 12, 2015 @author: wohlhart ''' from tnetcore.layers.base import LayerParams, Layer from tnetcore.util import readCfgIntNoneListParam, readCfgIntParam # @UnresolvedImport import theano.tensor as T import numpy class CatLayerParams(LayerParams): ''' Concatenation Layer Parameters ''' ...
paroj/ObjRecPoseEst
src/tnetcore/layers/catlayer.py
catlayer.py
py
3,825
python
en
code
71
github-code
6
31866653355
#python import os import socket import time import csv from pathlib import Path #django modules from django.shortcuts import render, redirect from django.views.generic.edit import CreateView from django.views.generic import DetailView, FormView, ListView #models from apps.start_block.models import Session from apps.a...
MeletChirino/Linky4Teens
new_gui/apps/start_block/views.py
views.py
py
4,720
python
en
code
0
github-code
6
12701253512
def rotated(arr_2d, angle=90): if angle == 90: return list(map(list, zip(*arr_2d[::-1]))) elif angle == 270: return list(map(list, zip(*arr_2d)))[::-1] def getCommandAppliedBoard(board, n, m, locations): a, b, c, d = [0, 0], [n-1, 0], [0, m-1], [n-1, m-1] if locations == [a, b, c, d]: return board ...
MinChoi0129/Algorithm_Problems
BOJ_Problems/17470.py
17470.py
py
3,521
python
en
code
2
github-code
6
71568069948
def calculate_miles_per_gallon(miles_driven, gallons): mpg = miles_driven / gallons mpg = round(mpg, 1) return mpg def input_validate_miles(): miles_driven = float(input("Enter miles traveled? ")) while (miles_driven <= 0): print("Miles cannot be less than or = zero - pls enter a positive ...
Git-Pierce/Week8
MPGFuncs.py
MPGFuncs.py
py
932
python
en
code
0
github-code
6
32452217936
import csv import importlib import logging import os import re import random from abc import ABC, abstractmethod from collections import defaultdict from typing import Dict, List, Union from typing import Optional import jsonlines import pandas as pd from langtest.utils.custom_types import sample from .format import ...
BrunoScaglione/langtest
langtest/datahandler/datasource.py
datasource.py
py
81,422
python
en
code
null
github-code
6
30052972082
from django.conf.urls import include, url from rest_framework import routers from App.views import UserViewSet, GroupViewSet, BookViewSet router = routers.DefaultRouter() router.register('user',UserViewSet) router.register('group',GroupViewSet) router.register('book',BookViewSet) urlpatterns = [ url('^drf/',inc...
chrisyuuuuu/Web-
Django/Drf案例/1-serializers/App/urls.py
urls.py
py
340
python
en
code
0
github-code
6
5008945541
""" This module contains a basic orchestrator for the execution of sequential data transformation stages. """ from __future__ import annotations import typing as t import types from fontai.config.pipeline import Config as PipelineConfig, ConfigHandler as PipelineConfigHandler from fontai.runners.base import Configura...
nestorSag/textfont-ai
src/fontai/fontai/runners/pipeline.py
pipeline.py
py
3,542
python
en
code
1
github-code
6
70640030589
import chainer from chainer import serializers, Variable, cuda from flownets import FlowNetS import cv2 import numpy as np import argparse ### parameter ### INPUT_FILE1 = 'samples/0000000-imgL.ppm' INPUT_FILE2 = 'samples/0000000-imgR.ppm' OUTPUT_FILE = './results/test' ARROW_FREQ = 16 def preprocessing(img): img ...
kou7215/opticalflow
run.py
run.py
py
8,175
python
en
code
1
github-code
6
36768452059
import math def main(): n = int(input()) coord = [list(map(int, input().split())) for _ in range(n)] x, y, z = 0, 0, 0 for i, j, k in coord: x += i y += j z += k ans = math.sqrt((x**2)+(y**2)+(z**2)) print("YES" if ans == 0.0 else "NO") if __name__ == '__main__': ...
arbkm22/Codeforces-Problemset-Solution
Python/YoungPhysicist.py
YoungPhysicist.py
py
327
python
en
code
0
github-code
6
8665069914
import json import os import settings from jsonschema import validate from decimal_encoder import DecimalEncoder from lambda_base import LambdaBase class ArticlesEyecatch(LambdaBase): def get_schema(self): return { 'type': 'object', 'properties': { 'topic': setting...
AlisProject/serverless-application
src/handlers/articles/eyecatch/articles_eyecatch.py
articles_eyecatch.py
py
1,738
python
en
code
54
github-code
6
4565273196
import numpy as np import matplotlib.pyplot as plt import csv import os dirname = os.path.dirname(__file__) t = 1 sig_x_est, sig_y_est, sig_vx_est, sig_vy_est = np.array([0.25, 0.25, 0.1, 0.1]) * 20 sig_x_mea, sig_y_mea, sig_vx_mea, sig_vy_mea = np.array([0.1, 0.1, 1, 1]) * 40 def predict(A, x, y, vx, vy): X ...
C-12-14/AGV-Task-Round
Kalman-Filter/kalman.py
kalman.py
py
2,456
python
en
code
0
github-code
6
8733764327
import mysql.connector DB_CONFIG = {} DB_CONFIG["host"] = "" DB_CONFIG["database"] = "" DB_CONFIG["user"] = "" DB_CONFIG["password"] = "" NO_OF_LINES_AT_ONE_TIME = 40000 NAME_OF_FILE = '' fObj = open(NAME_OF_FILE) fObjw = open('error', 'w') def create_values_part(line): line = line.strip() line = line.replace("\"...
KlwntSingh/connection-visualizer-api
db/db_migrate.py
db_migrate.py
py
1,376
python
en
code
0
github-code
6
37225811351
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import os, sys, glob, pickle import numpy as np import sqlite3 import matplotlib.pyplot as plt from analysis import crosstalk, darknoise from contrib import legend, natsort from ROOT import TH1D, TF1 import ROOT from matplotlib.backends.backend_pdf import P...
ntim/g4sipm
sample/plots/luigi/n_pe.py
n_pe.py
py
4,397
python
en
code
26
github-code
6
17121698120
import cv2 import numpy as np # Load the source and kernel images source_image = cv2.imread('/home/xpirr/workspace/python/DSP/HW2/Resim6_8.jpg', cv2.IMREAD_GRAYSCALE) kernel_image = cv2.imread('/home/xpirr/workspace/python/DSP/HW2/EvrenIspiroglu.py', cv2.IMREAD_GRAYSCALE) # Convert the kernel image to a numpy array o...
ispiroglu/DSP-HW2
Demo3.py
Demo3.py
py
1,091
python
en
code
0
github-code
6
31516633366
#!/usr/bin/env python3 """vanilla autoencoder""" import tensorflow.keras as K def autoencoder(input_dims, hidden_layers, latent_dims): """that creates an autoencoder: Arg: - input_dims: is an integer containing the dims of the model input - hidden_layers: is a list containing the number of no...
macoyulloa/holbertonschool-machine_learning
unsupervised_learning/0x04-autoencoders/0-vanilla_v1.py
0-vanilla_v1.py
py
2,350
python
en
code
0
github-code
6
30753464221
from django.shortcuts import render from fristapp.models import People, Aritcle from django.http import HttpResponse from django.template import Context, Template # Create your views here. def first_try(request): person = People(name='Spork', job="officer") html_string = ''' <html lang="en"> <head> ...
LTMana/code
Python/Django/fristsite/fristapp/views.py
views.py
py
1,123
python
en
code
1
github-code
6
18855352074
from cloud.filestore.tests.python.lib.common import get_nfs_mount_path import os import pytest import shutil import tempfile def pytest_addoption(parser): parser.addoption( "--target-dir", action="store", default="Path to target directory to run tests on", ) @pytest.fixture def targe...
ydb-platform/nbs
cloud/filestore/tools/testing/fs_posix_compliance/suite/python_tests/conftest.py
conftest.py
py
1,362
python
en
code
32
github-code
6
4697384472
import numpy as np from player import Player from territory import Territory from troop import Troop import random from enum import Enum starting_troops = 25 usa_states = {"Alabama":["Mississippi","Tennessee","Florida","Georgia"], "Alaska":["Hawaii","California","Arizona"], "Arizona":["California","Nevada","Utah",...
ZeyadZanaty/risk-game-ai
server/game.py
game.py
py
8,762
python
en
code
4
github-code
6
10432077002
#!/usr/bin/env python # Get a listings of the files in each dataset # see get-dc0-file-lists.sh import json from pytablewriter import MarkdownTableWriter # from https://stackoverflow.com/questions/1094841/get-human-readable-version-of-file-size def sizeof_fmt(num, suffix="B"): for unit in ["", "Ki", "Mi", "Gi", ...
CMB-S4/serverless-data-portal-cmb-s4
buildpr4.py
buildpr4.py
py
3,826
python
en
code
0
github-code
6
24254079862
from base import * from fabric.api import cd, env, run NOTIFICATION_SENDER = os.getenv('NOTIFICATION_SENDER') # See: https://docs.djangoproject.com/en/dev/ref/settings/#managers MANAGERS = ADMINS ########## END MANAGER CONFIGURATION ########## DEBUG CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/set...
toladata/TolaTables
tola/settings/local.py
local.py
py
4,834
python
en
code
2
github-code
6
31249158545
import os from pathlib import Path import random import pandas as pd from music21 import converter from data_preparation import extract_notes from preprocessing.preprocess_midi import preprocess_music21_song from helpers.samplinghelpers import render_token_sequence def prepare_annotations(labels_file: str) -> None: ...
Vitaliy1234/music_generation
data/music_midi/prepare_data.py
prepare_data.py
py
4,890
python
en
code
0
github-code
6
4685123450
from sys import stdin import math from functools import lru_cache class Case(object): def __init__(self): self.lst = [] self.W = 1000 self.largest = self.W self.done = False def setList(self, lst): self.lst=lst def addToLst(self, item): self.lst.append(i...
jonasIshoejNielsen/Algorithms-Kattis-master
3 Dynamic programming/Walrus_Weights.py
Walrus_Weights.py
py
2,251
python
en
code
0
github-code
6
19416806187
"""Determine potential of renewable electricity in each administrative unit. * Take the (only technically restricted) raster data potentials, * add restrictions based on scenario definitions, * allocate the onshore potentials to the administrative units, * allocate the offshore potentials to exclusive economic zones (...
timtroendle/possibility-for-electricity-autarky
src/potentials.py
potentials.py
py
10,162
python
en
code
10
github-code
6
29477833946
import tkinter as tk from pages import * from feature_extractors import FeatureExtractor from dimension_reducers import UMAPReducer class Controller: def __init__(self, *pages): self.batches = None self.feature_extractor = FeatureExtractor((100, 100, 3)) self.reducer = UMAPReducer() ...
CIaran-Lundy/lazy_labeller
app.py
app.py
py
1,094
python
en
code
0
github-code
6
29944782862
from sklearn import datasets digits = datasets.load_digits() # Take the first 500 data points: it's hard to see 1500 points X = digits.data[:500] y = digits.target[:500] print (X.shape, y.shape) from sklearn.manifold import TSNE tsne = TSNE(n_components=2, random_state=0) X_2d = tsne.fit_transform(X) ''' 0 -> formu...
iamjanvijay/Background-Sound-Classification-in-Speech-Audio-Segments
utils/plot_tsne.py
plot_tsne.py
py
914
python
en
code
4
github-code
6
24591311642
import pygame import math class Bat: def __init__(self, screen, startX, startY, speed, width=20, height=80): self.startX = startX-(math.ceil(width/2)) self.startY = startY-(math.ceil(height/2)) self.screen = screen self.speed = speed self.width = width self.height =...
BananenKraft/Pong
bat.py
bat.py
py
706
python
en
code
0
github-code
6
11685423386
import pandas as pd import numpy as np import random import time import os import gc import pickle from sklearn.model_selection import StratifiedKFold from sklearn.preprocessing import StandardScaler from sklearn.metrics import roc_auc_score import lightgbm as lgb import matplotlib.pyplot as plt import seaborn as sn...
leokri89/ml-codebase
models_sample/lightgbm.py
lightgbm.py
py
3,278
python
en
code
1
github-code
6
25320255908
from flask import Flask, render_template, request app = Flask(__name__) ENV = "debug" if ENV == 'debug': app.debug = True app.config['SQLALCHEMY_TRACK_MODIFICATION'] = False # set app source @app.route('/') def index(): return render_template('index.html') if __name__ == '__main__': app.run()
JakeSiewJK64/joekane_site1
app.py
app.py
py
316
python
en
code
0
github-code
6
10129406269
from aiogram import types from aiogram.dispatcher.filters.builtin import CommandHelp from loader import dp @dp.message_handler(CommandHelp()) async def bot_help(message: types.Message): text = ("Список команд: ", "/start - Начать диалог", "/help - Получить справку", "/ref - По...
nekitmish/RefShop
handlers/users/help.py
help.py
py
835
python
ru
code
0
github-code
6