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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
4668807175 | class Budget:
def __init__ (self, a):
ff = (open("budgetsaves.txt").read()).strip()
ff = eval(ff)
b = dict (ff)
if b[a]:
self.a = b[a]
self.dict = b
else:
b[a] = 0
self.a = b[a]
self.dict = b
self... | Code-Tony/classPractice | bugetApp.py | bugetApp.py | py | 1,348 | python | en | code | 0 | github-code | 13 |
36977614387 | # -*- coding: utf-8 -*-
from setuptools import setup
long_description = open("README.md").read()
for line in open('neuroml/__init__.py'):
if line.startswith("__version__"):
version = line.split("=")[1].strip()[1:-1]
setup(
data_files=[("",['neuroml/test/Purk2M9s.nml'])],
name = "libNeuroML",
... | usama57/libNeuroML | setup.py | setup.py | py | 1,193 | python | en | code | null | github-code | 13 |
7716068765 | """
%pip install -U numpy
%pip install -U pandas
%pip install -U requests
%pip install -U bs4
%pip install -U selenium
%pip install -U matplotlib
%pip install -U seaborn
%pip install -U plotly
%pip install -U scikit-learn
%pip install -U python-dateutil
%pip install -U lxml
%pip install -U colorama
%pip install -U date... | joseeneas/RB_Module_24_Project_04 | Notebooks/ML_Complex_API.PY | ML_Complex_API.PY | py | 32,862 | python | en | code | 0 | github-code | 13 |
30669927429 | def reverse(num):
temp = 0
while(num > 0):
temp *= 10
temp += (num % 10)
num = int(num / 10)
return temp
def Lychrel(num):
num += reverse(num)
for i in range(50):
temp = reverse(num)
if (temp == num):
return False
else:
... | menduhkesici/Project_Euler | Problem 55 - Lychrel numbers.py | Problem 55 - Lychrel numbers.py | py | 481 | python | en | code | 0 | github-code | 13 |
12210329673 | import Setup
import os
import sys
from os import environ as environment
from typing import List
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from lib.Common import get_team
from replays.Replay import Replay, Team
from analysis.Replay import get_ptbase_tslice, get_ptbase_tslice_side... | DrCognito/StaticAnalysis | src/StaticAnalysis/tests/ward_newvis2.py | ward_newvis2.py | py | 3,673 | python | en | code | 0 | github-code | 13 |
20434221886 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
class Grid:
def __init__(self, rows, columns, start):
self.rows = rows
self.columns = columns
#current location will be seen through instance variales i and j
self.i = start[0]
self.j = start[1]
#... | aashya/Reinforcement-Learning | Grid_world.py | Grid_world.py | py | 3,775 | python | en | code | 0 | github-code | 13 |
4511030690 | #
# @lc app=leetcode.cn id=765 lang=python
#
# [765] 情侣牵手
#
# https://leetcode-cn.com/problems/couples-holding-hands/description/
#
# algorithms
# Hard (59.81%)
# Likes: 238
# Dislikes: 0
# Total Accepted: 24.1K
# Total Submissions: 36K
# Testcase Example: '[0,2,1,3]'
#
# N 对情侣坐在连续排列的 2N 个座位上,想要牵到对方的手。 计算最少交换座位的... | lagoueduCol/Algorithm-Dryad | 07.UF/765.情侣牵手.py | 765.情侣牵手.py | py | 2,038 | python | zh | code | 134 | github-code | 13 |
21662849895 | class Solution:
def findRelativeRanks(self, score: List[int]) -> List[str]:
place = sorted(score, reverse=True)
medal = {
1: 'Gold Medal',
2: 'Silver Medal',
3: 'Bronze Medal'
}
rank = {s: str(i + 1) if i >= 3 else medal[i + 1] for i, s in enumer... | SkadiArtemis/VSCODE_Project | leetcode_tasks/0506_relative_ranks.py | 0506_relative_ranks.py | py | 372 | python | en | code | 0 | github-code | 13 |
28942856080 | # Shane Hagan
# CodeChef Burgers Problem
# Date: 06/17/2022
# Read the number of test cases.
testCases = int(raw_input())
for i in range(testCases):
# Read integers x, y
(x, y) = map(int, raw_input().split(' '))
# print the min number of either burgers or buns
print(min(x,y))
# ran successfully... | HaganShane/Side-Projects | CodeChef/Burger.py | Burger.py | py | 405 | python | en | code | 0 | github-code | 13 |
10079080434 | ## @file SALst.py
# @title SALst
# @author Jame Tran
# @date Feb.16, 2019
from StdntAllocTypes import *
from AALst import *
from DCapALst import *
## @brief A class containing a list of ('macid', SInfoT) tuples, and methods to add, delete
# and recieve information on. Also contains methods to recieve average and s... | JameTran/Automated-Admissions- | src/SALst.py | SALst.py | py | 5,409 | python | en | code | 0 | github-code | 13 |
11032604827 | from typing import List
import hdbscan
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.style as style
import numpy as np
import pandas as pd
from random import shuffle
from joblib import Parallel, delayed, Memory
from scipy.spatial.distance import cdist
from sklearn.cluster import KMeans... | calvinp0/AL_Master_ChemEng | Cluster.py | Cluster.py | py | 18,764 | python | en | code | 0 | github-code | 13 |
38297309455 | import pandas as pd
import sys
df = pd.read_excel(r'Book.xlsx')
def get_days(code):
column_name4 = 'Code'
df[column_name4].fillna('', inplace=True)
result4 = df[df[column_name4].str.contains(code)]
matching_row_numbers4 = result4.index.tolist()
Day_for_course = []
for i in range(len(matching_r... | STONERJ25/sch | excelread.py | excelread.py | py | 2,720 | python | en | code | 0 | github-code | 13 |
33643918993 | #!/usr/bin/env python
from redis import Redis
redis = Redis()
while True:
print('input member:score> ', end='')
ipt = input()
if ipt == 'show': # command 'show'
ranking = redis.zrange('ranking', 0, 5, withscores=True)[::-1]
for i, m in enumerate(ranking):
values = {
... | nasa9084/samples | sorted_set_ranking.py | sorted_set_ranking.py | py | 609 | python | en | code | 0 | github-code | 13 |
6446606661 |
#!/usr/bin/python
#
#
# Ravikumar , June 14,2023
#
# code referred / studied from many sites /books and implemented my own.
#
#
#This class defined just for testing purpose . used as DB table
#
class notify:
id:int = 0
notification:list ={}
@classmethod
def insertvalue(cls,details,status):
... | Ravianarc/02-automailreports | common_project_libs/notifystaticStorageClass.py | notifystaticStorageClass.py | py | 662 | python | en | code | 0 | github-code | 13 |
19350025644 | import os
import re
import setuptools
NAME = "mmd_twosample"
AUTHOR = "Jacquelyn Shelton"
AUTHOR_EMAIL = "jacquelyn.ann.shelton@gmail.com"
DESCRIPTION = "Various kernel-based statistical hypothesis tests for the two-sample problem"
LICENSE = "GPL"
KEYWORDS = "statistical... | fatflake/mmd-twosample | setup.py | setup.py | py | 1,315 | python | en | code | 0 | github-code | 13 |
13646690147 | import datetime as dt
from datetime import datetime
from airflow import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.utils.dates import days_ago
from airflow.utils.trigger_rule import TriggerRule
from call_back.notify import succes_callb... | Abhinavk1243/airflow-learning | airflow/dags/da_latest_only.py | da_latest_only.py | py | 1,103 | python | en | code | 0 | github-code | 13 |
29566529972 | # Simple convolutional NN based classifier of German road traffic signs
# Import libraries
import streamlit as st
from PIL import Image, ImageOps
import cv2
# Set up the basic md for the webpage that will be generated by streamlit
st.title("German Traffic Sign Classifier")
st.header("German Traffic Sign Classifier")... | rupindeeplearning/DL_TrafficSigns | app.py | app.py | py | 899 | python | en | code | 0 | github-code | 13 |
74058898898 | import html
import re
from typing import Generator, Iterator, List, Optional, Set, Tuple
from mwparserfromhell import nodes, wikicode
from mwparserfromhell.nodes import extras
from mwparserfromhell.string_mixin import StringMixIn
from mwcomposerfromhell.namespace import (
ArticleNotFound,
ArticleResolver,
... | clokep/mwcomposerfromhell | mwcomposerfromhell/composer.py | composer.py | py | 31,587 | python | en | code | 7 | github-code | 13 |
13509691235 | '''
TEST DESCRIPTION
Testing Resource: http://docs.python.org/2/library/unittest.html
Created on )__________(, 2013
@author: Troll
'''
import unittest # This is the main resource
# Example resource to test
# from utils.message.processing import remove_tags as tagRemover
# Testing class: This is the testing s... | Robrowski/TrollUniversity | TrollUniversity/test/testing_template.py | testing_template.py | py | 839 | python | en | code | 1 | github-code | 13 |
6321244588 | import pandas as pd
from git import Repo
import re, signal, sys, time, pwn, pdb, os
def handler_signal(signal, frame):
print('\n\n[!] Out ..........\n')
sys.exit(1)
def extract(url):
repo = Repo(url)
commits = list(repo.iter_commits('develop'))
return commits
def transform(commits, KEY_WORDS):
... | NatLey30/Git-Leaks | git_leaks.py | git_leaks.py | py | 954 | python | en | code | 0 | github-code | 13 |
73325194896 | from rest_framework.permissions import IsAuthenticated
from rest_framework.authentication import TokenAuthentication
from rest_framework import views
from core.permissions import MpinAuthenticated
class AuthRequiredView(object):
"""
Base authentication class to be inherited in every view which required
a... | Ayushverma8/Group-Project_CSCI-5308 | password_vault_backend/core/views.py | views.py | py | 1,926 | python | en | code | 1 | github-code | 13 |
31665103881 | #Print("N^P=", power (N,P))
from collections import defaultdict
import sys
sys.setrecursionlimit(5000)
def def_val():
return False
memo = defaultdict(def_val)
def power(N,P):
if P==0:
return 1
elif P==1:
return N
else:
if N not in memo:
memo[N]= (N*power(N,P-1))
return memo[N]
else:
memo[N]
im... | tuhiniris/Coding-and-Stuff | bsky.py | bsky.py | py | 513 | python | en | code | 0 | github-code | 13 |
22404208413 | import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
from LoadData import DataUtils
sess = tf.InteractiveSession()
def main():
trainFile_x = './MNIST_data/train-images.idx3-ubyte'
trainFile_y = './MNIST_data/train-labels... | IronMastiff/MNIST | Util.py | Util.py | py | 6,907 | python | en | code | 2 | github-code | 13 |
71223525777 | #!/usr/bin/env python3
import sys, string
with open(sys.argv[1]) as f:
data = [ l.strip() for l in f ]
score = 0
for l in data:
a, b = l[:len(l)//2], l[len(l)//2:]
c, = set(a) & set(b)
score += string.ascii_letters.index(c) + 1
print(f"Part 1: {score}")
score = 0
for i in range(0,len(data),3):
... | ivanpesin/aoc | 2022/2022.03/sol.py | sol.py | py | 446 | python | en | code | 0 | github-code | 13 |
22524185294 | import binascii
import glob
import gzip
import itertools
import math
import multiprocessing as mp
import numpy as np
import queue
import random
import shufflebuffer as sb
import struct
import sys
import threading
import time
import unittest
# 16 planes, 1 side to move, 1 x 362 probs, 1 winner = 19 lines
DATA_ITEM_LINE... | leela-zero/leela-zero | training/tf/chunkparser.py | chunkparser.py | py | 17,266 | python | en | code | 5,191 | github-code | 13 |
9825077079 | from django.contrib import admin
from orderapp.models import Order, Cart
# Register your models here.
class OrderAdmin(admin.ModelAdmin):
list_display = ('num', 'title', 'price', 'pay_type', 'pay_status', 'receiver', 'receiver_phone', 'receiver_address')
fields = ('num', 'title', 'price', 'pay_type', 'pay_sta... | heaven1124/hijango | orderapp/admin.py | admin.py | py | 525 | python | en | code | 0 | github-code | 13 |
15623974743 | from flask import jsonify,request,flash,Flask,render_template,redirect,session,url_for,Response,abort,json
from flask_wtf.csrf import CSRFProtect,CSRFError
from flask_sqlalchemy import *
from techmarketplace.Form import RegisterForm, LoginForm,AdminLoginForm,TwoFactorForm
from flask_login import login_user,logout_u... | noobProgrammer35/ASPJ | techmarketplace/AdminApplication.py | AdminApplication.py | py | 2,610 | python | en | code | 0 | github-code | 13 |
73859805138 | from typing import List, Optional
from mev_inspect.classifiers.helpers import get_debt_transfer, get_received_transfer
from mev_inspect.schemas.classifiers import (
ClassifiedTrace,
ClassifierSpec,
DecodedCallTrace,
LiquidationClassifier,
TransferClassifier,
)
from mev_inspect.schemas.liquidations ... | flashbots/mev-inspect-py | mev_inspect/classifiers/specs/aave.py | aave.py | py | 3,128 | python | en | code | 750 | github-code | 13 |
41981264645 | ########################################################################
# Module: Get_ProductionWorker_Info.py
# Exercise: Ch11_Exercise_1.py
# Purpose: Employee and ProductionWorker Exercise #1 in Ch 11
# Last Update Date: 11/28/18
# Author: Lisa Nydick
##########################################################... | lan33-ccac/CIT-119 | Get_ProductionWorker_Info.py | Get_ProductionWorker_Info.py | py | 1,426 | python | en | code | 0 | github-code | 13 |
20449721766 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 12 11:07:17 2020
@author: Jian Cao
"""
## Environment ----------------------------------------------------------------
import os
credential_path = ''
os.system('export GOOGLE_APPLICATION_CREDENTIALS="{}"'.format(credential_path))
os.chdir('/home/jccit_caltech_ed... | jian-frank-cao/MonitoringTwitter | GCP/instance_to_cloud_storage.py | instance_to_cloud_storage.py | py | 3,800 | python | en | code | 6 | github-code | 13 |
71270822417 | import sys
sys.path.append('..')
from enum import Enum
from util.intcode import Intcode
from time import sleep
class Dir(Enum):
UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3
def succ(self):
return Dir((self.value + 1) % 4)
def pred(self):
return Dir((self.value - 1) % 4)
def xy(sel... | Lammatian/AdventOfCode | 2019/11/sol.py | sol.py | py | 2,942 | python | en | code | 1 | github-code | 13 |
19871110834 | #!/usr/bin/python
#
# Block header comment
#
#
import sys, imp, atexit
sys.path.append("/home/courses/cs3214/software/pexpect-dpty/");
import pexpect, shellio, signal, time, os, re, proc_check
#Ensure the shell process is terminated
def force_shell_termination(shell_process):
c.close(force=True)
#pulling in the regu... | NealSchneier/School | shell/group114/esh/src/advanced/single_pipe_test.py | single_pipe_test.py | py | 1,113 | python | en | code | 0 | github-code | 13 |
36187042116 | import os
import numpy as np
import itk
from itk import TubeTK as ttk
#from itkwidgets import view
'''TubeTK Doc: https://public.kitware.com/Wiki/TubeTK/Documentation'''
# Baseline images assisting with brain mask extraction #
N = 8
BaseLineFld = '/media/peirong/PR/TubeTK_Data'
readerList = ["003", "010", "026", ... | uncbiag/D2-SONATA | Preprocess/IXI/itk_utils.py | itk_utils.py | py | 10,702 | python | en | code | 1 | github-code | 13 |
36560968443 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import cgi
import json
import os
import traceback
from autodqm import fetch, compare_hists
from autodqm.cerncert import CernCert
def handle_request(req):
err = None
try:
if req['type'] == "fetch_run":
data = fetch_run(req['series'], req['samp... | reasonablytall/cern | adqmtmp/AutoDQM/index.py | index.py | py | 3,800 | python | en | code | 0 | github-code | 13 |
74660429457 | '''
Author: David Kaplan
Advisor: Stephen Penny
Since the amount of memory that a typical `DataPreprocessing` object is >> 4Gb,
we need to make a custom saving method using netCDF files and separate the
attributes into a different object.
'''
import numpy as np
import time
import math
import os
import pickle
import lo... | dkaplan65/residnet | residnet/data_processing/wrappers.py | wrappers.py | py | 31,423 | python | en | code | 2 | github-code | 13 |
42999784722 | from rostelecom.models import Project
class ProjectManager:
def __init__(self):
self.model = Project
def get_all_project(self):
instances = self.model.objects.all()
result_list = []
for instance in instances:
result = {"uid": instance.guid,
"name": instance.name,
... | kulagind/Hackaton | rostelecom/project_manager.py | project_manager.py | py | 1,431 | python | en | code | 0 | github-code | 13 |
37365009356 | from delft.utilities.Tokenizer import tokenizeAndFilterSimple, tokenizeAndFilter
class TestTokenizer:
def test_tokenizer_filter_simple(self):
input = 'this is a test, but a stupid test!!'
output = tokenizeAndFilterSimple(input)
assert len(output) == 11
assert output == ['this', ... | kermitt2/delft | tests/utils/test_tokenizer.py | test_tokenizer.py | py | 1,889 | python | en | code | 377 | github-code | 13 |
73607347856 | import os
import shutil
import subprocess
import sys
from contextlib import contextmanager
import pytest
import requests
FIXTURES = 'tests/fixtures'
SCRIPT = 'website.py'
BUILDDIR = '_build'
INDEX = os.path.join(BUILDDIR, 'index.html')
CNAME = os.path.join(BUILDDIR, 'CNAME')
SCRIPT_FIXTURES = os.path.join(FIXTURES... | pyvec/elsa | tests/test_commands.py | test_commands.py | py | 15,887 | python | en | code | 27 | github-code | 13 |
35028128350 | # A+B - 5
import sys
ipt = sys.stdin.readline
while 1: # 무한루프
A,B=list(map(int,ipt().rstrip().split()))
if A==B==0: # 0,0이 들어오면 종료
break
else:
print(A+B) | Jehyung-dev/Algorithm | 백준/Bronze/10952. A+B - 5/A+B - 5.py | A+B - 5.py | py | 218 | python | ko | code | 0 | github-code | 13 |
3277097916 | from flask import Flask
from flask import request
import json
app = Flask(__name__)
@app.route('/post', methods=['POST'])
# в учебнике есть эта часть
def main():
response = {
'session': request.json['session'],
'version': request.json['version'],
'response': {
'end_session': F... | lord-protectorx/yandex-Alica | Storehouse/echo.py | echo.py | py | 851 | python | ru | code | 1 | github-code | 13 |
24690073676 | from typing import List, Tuple, Dict, Callable, Optional, cast, Any, Set
from collections import OrderedDict
import uuid
import statistics
import pickle
from holmes_extractor.word_matching.ontology import OntologyWordMatchingStrategy
from tqdm import tqdm
from spacy.tokens import Doc
from thinc.api import Model
from th... | msg-systems/holmes-extractor | holmes_extractor/classification.py | classification.py | py | 44,286 | python | en | code | 386 | github-code | 13 |
41475606514 | if __name__ == '__main__' and __package__ is None:
from os import sys#, path
sys.path.append('../')
import torch
import torch.nn as nn
from utils import get_pad_same
from utils import cal_gan_from_op
class BaseNetwork(nn.Module):
def __init__(self):
super(BaseNetwork, self).__init__()
self... | ShunChengWu/SCFusion_Network | src/networks_base.py | networks_base.py | py | 16,194 | python | en | code | 6 | github-code | 13 |
24775354745 | from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.sites.shortcuts import get_current_site
from rest_framework import status
from rest_framework.response import Response
from django.urls import reverse
from django... | jiteshm17/SportsHub | cart/views.py | views.py | py | 7,453 | python | en | code | 0 | github-code | 13 |
31155558706 |
import EatingContestEnv as ece
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Flatten
from tensorflow.keras.optimizers import Adam
from rl.agents import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
def build_mode... | Foiros/EatingContest | main.py | main.py | py | 1,227 | python | en | code | 0 | github-code | 13 |
25013575854 | import RPi.GPIO as GPIO
import time
import LCD_display
import config
from web_requests import booking_stop_reservation
#Setup a GPIO pin on RPi
GPIO.setup(config.button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def ending_reservation ():
#Function dealing with exding the reseravation after button is pushed for 2 ... | TomasSpusta/pipi_reader | pipi_upload/button.py | button.py | py | 1,563 | python | en | code | 0 | github-code | 13 |
73939383699 | import time
import torch
import esm
import tensorflow as tf
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def get_tensor_shape(tensor, device):
if device == 'cpu':
shape = tensor.numpy().shape
else:
shape = tensor.cpu().detach().nump... | IFilella/PLMAnalysis | scripts/get_ESM_embedding.py | get_ESM_embedding.py | py | 7,764 | python | en | code | 0 | github-code | 13 |
43508380246 | from dsmpy import root_resources
from dsmpy.utils.cmtcatalog import read_catalog
from dsmpy.event import Event
from dsmpy.spc.stf import SourceTimeFunction
from dsmpy.spc.stfcatalog import STFCatalog
import numpy as np
import glob
import os
def get_stf(event):
"""Returns a source time function in time domain.
... | afeborgeaud/dsmpy | dsmpy/utils/scardec.py | scardec.py | py | 2,688 | python | en | code | 10 | github-code | 13 |
3948826070 | import nextcord, os
from nextcord.ext import commands
from cogs.utils import config
class ArchiveCommand(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@nextcord.slash_command(
name="archive",
description="Archive un salon de rando",
)
async def archive_c... | QuentiumYT/RandoBot | cogs/archive.py | archive.py | py | 1,731 | python | en | code | 0 | github-code | 13 |
72190480017 | #!/usr/bin/python3
from gi.repository import Gtk
class MyBuilder(Gtk.Builder):
def __init__(self):
Gtk.Builder.__init__(self)
self.add_from_file("ui.glade")
handlers = {
"encrypt": self.encrypt,
"decrypt": self.decrypt
}
self.connect_signals(hand... | Akus93/AtBash | src/atbash.py | atbash.py | py | 3,244 | python | en | code | 0 | github-code | 13 |
32197425206 | def insertion_sort (arr):
for i in range(1,len(arr)):
j = i
while j > 0 and arr[j] < arr[j-1]:
arr[j], arr[j-1] = arr[j-1], arr[j]
j = j - 1
return arr
def main():
arr1 = [154, 245, 568, 324, 654, 324]
arr2 = ['Mike', 'Bob', 'Sally', 'Jil', 'Jan']
print(inser... | pa-ak/python-algorithm-design-manual-skiena | 1.1_insertion_sort.py | 1.1_insertion_sort.py | py | 378 | python | en | code | 0 | github-code | 13 |
8289307857 | from __future__ import unicode_literals
from django.db import migrations, models
import taggit.managers
from django.conf import settings
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('taggit', ... | dstl/lighthouse | apps/links/migrations/0001_initial.py | 0001_initial.py | py | 2,085 | python | en | code | 10 | github-code | 13 |
1194263293 | import sys
import json
import uuid
import http.client
import time
import os.path
import datetime
from copy import deepcopy
PATH=os.path.dirname(os.path.realpath(__file__))
class TAC_API(object):
def __init__(self,api="app.alcww.gumi.sg",device_id=str(uuid.uuid4()),secret_key=str(uuid.uuid4()),idfa=str(uuid.uuid4()),i... | K0lb3/Ouroboros | utils/The_Alchemist_Code/TAC_API.py | TAC_API.py | py | 24,934 | python | en | code | 5 | github-code | 13 |
71536154259 | import requests
from bs4 import BeautifulSoup
from money import Money
link_base = 'http://www.portaltransparencia.gov.br/copa2014/api/rest/empreendimento'
def run(link):
if link is None:
return
soup = get_html(link)
if soup is None:
return
empreendimentos = soup.find_all('copa:empr... | jaap67/TESI | question_05.py | question_05.py | py | 1,222 | python | pt | code | 0 | github-code | 13 |
70675801938 | # defines the default edit actions for linux
from talon import Module, Context, actions, clip
# ctx = Context()
# ctx.matches = r"""
# os: mac
# and app: chrome
# """
# @ctx.action_class("user")
mod = Module()
@mod.action_class
class seach_actions:
def find_here(search: str):
"""Invoke chrome find, option... | jswett77/swett_talon | apps/chrome/chrome.py | chrome.py | py | 927 | python | en | code | 0 | github-code | 13 |
22256164260 | """add-name
Revision ID: a4e4df6ced25
Revises: bd4ac7853e8e
Create Date: 2022-02-05 21:26:34.241881
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a4e4df6ced25'
down_revision = 'bd4ac7853e8e'
branch_labels = None
depends_on = None
def upgrade():
# ### c... | atulbhai1/fastapimessagingapp | alembic/versions/a4e4df6ced25_add_name.py | a4e4df6ced25_add_name.py | py | 752 | python | en | code | 0 | github-code | 13 |
39438606511 | from typing import List, Union
from PyQt5.QtCore import pyqtSignal, QObject
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QTableWidget, QPushButton, QAbstractItemView, QHeaderView, QHBoxLayout, QWidget, QAbstractSpinBox
class CustomRowField:
"""
Class for custom row fields
:param unique: uni... | atomicplasmaphysics/BCA-GUIDE | TableWidgets/CustomTable.py | CustomTable.py | py | 7,543 | python | en | code | 4 | github-code | 13 |
41238329490 | import math
import numpy as np
def isprime(n):
if n == 1:
return 0
if n == 2:
return 1
if n % 2 == 0:
return 2
for i in range(3,int(math.sqrt(n))+1,2):
if n % i == 0:
return i
return True
def recur(n):
#print (n)
p = isprime(n)
#print (p)
... | tssdavey/maths-problems | project euler/51-100/69.py | 69.py | py | 645 | python | en | code | 0 | github-code | 13 |
30139346642 | import math
from zou.app import app
from zou.app.utils import fields, string
from sqlalchemy import func
def get_query_criterions_from_request(request):
"""
Turn request parameters into a dict where keys are attributes to filter and
values are values to filter.
"""
criterions = {}
for key, va... | cgwire/zou | zou/app/utils/query.py | query.py | py | 2,542 | python | en | code | 152 | github-code | 13 |
74327460178 | import csv
f = open('profiles_stan.csv','r', newline='')
w = open('Stanford Student Profiles/profiles___3.csv','w', newline='')
fr = csv.reader(f)
fw = csv.writer(w)
l = []
for i in fr:
l+=[i]
for j in range(len(l)):
if l[j][1] == '':
l[j][1] = '1450'
if l[j][2] == '':
l[j][2] = '4.2'
i... | tgarg10/College-Admissions-Calculator | Pgm4_Cleaning_Data.py | Pgm4_Cleaning_Data.py | py | 1,172 | python | en | code | 0 | github-code | 13 |
34664698479 | from tema6 import Cerc, Dreptunghi, Angajat, Cont
# Ex 1:
cerc1 = Cerc(5, 'rosu')
cerc1.descrie_cerc()
print("Aria cercului este:", cerc1.aria())
print("Diametrul cercului este:", cerc1.diametru())
print("Circumferinta cercului este:", cerc1.circumferinta())
#Ex 2:
dreptunghi1 = Dreptunghi(10, 5, 'verde')
dreptunghi1... | Nicu0478/Repo1 | tema6main.py | tema6main.py | py | 742 | python | ro | code | 0 | github-code | 13 |
9665048982 | from data.voc.voc_dataset import VocDataset
from torchvision import transforms
import torch
def get_voc_dataloader(split='train', batch_size=32):
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
if split == "train":
train_tran... | wannieman98/RandWireNN | data/voc/voc_dataloader.py | voc_dataloader.py | py | 2,067 | python | en | code | 0 | github-code | 13 |
22516690951 | from collections import defaultdict
from elasticsearch_dsl import Document, Integer, Text, Boolean, Q, Keyword, SF, Date
from elasticsearch_dsl.connections import connections
from elasticsearch.helpers import parallel_bulk
from elasticsearch.exceptions import ConflictError
from flask_sqlalchemy import Pagination
from... | miniyk2012/my_toutiao | models/search.py | search.py | py | 5,972 | python | en | code | 0 | github-code | 13 |
14527495776 | from app.main import main_app
from flask import render_template,request,redirect,session,jsonify,url_for
from app.forms import EditBlogForm
from app.models import Post,Type
import random,base64,os
from functools import wraps
from app import app,db
#访问前验证
def logined_require(func):
@wraps(func)
def inner(*args,... | inkfish1/weblog | app/main/routes.py | routes.py | py | 6,487 | python | en | code | 0 | github-code | 13 |
7020617582 |
"""
This module contains functions to assemble information from multiple different
files relevant to the Mayo Clinic biobanks.
"""
###############################################################################
# Notes
###############################################################################
# Installation a... | tcameronwaller/stragglers | package/mbpdb_assembly.py | mbpdb_assembly.py | py | 27,203 | python | en | code | 0 | github-code | 13 |
20768753079 | """
Metrics class.
"""
from collections import Counter
from nltk.translate import bleu_score
from nltk.translate.bleu_score import SmoothingFunction
import numpy as np
from pycocoevalcap.bleu.bleu import Bleu
from pycocoevalcap.rouge.rouge import Rouge
from pycocoevalcap.cider.cider import Cider
from pycocoevalcap.m... | Kunhao18/image-to-poetry | plato/metrics/metrics.py | metrics.py | py | 3,846 | python | en | code | 0 | github-code | 13 |
7314066995 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
import redis
from scrapy.conf import settings
from AIHR.items import AihrItem, CompanyItem, QcwyPostItem, QcwyCo... | notsayyu/spider | master/AIHR/pipelines.py | pipelines.py | py | 1,442 | python | en | code | 0 | github-code | 13 |
16824411454 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from packaging import version
import elasticsearch
from elasticsearch.exceptions import NotFoundErr... | hysds/hysds_commons | hysds_commons/elasticsearch_utils.py | elasticsearch_utils.py | py | 15,234 | python | en | code | 1 | github-code | 13 |
22477371223 | import tensorflow as tf
import streamlit as st
from module import preprocessing
from sklearn.model_selection import train_test_split
from transformers import AutoTokenizer, TFBertModel
from keras.layers import Dense, Input, GlobalMaxPool1D, Dropout
from keras.models import Model
from keras.optimizers import Adam
from k... | putuwaw/ed-bert | module/bert.py | bert.py | py | 4,155 | python | en | code | 0 | github-code | 13 |
10894962904 | class Cup:
def __init__(self, type, value, number, nextCup, captureCup):
self.type = type
self.value = value
self.nextCup = nextCup
self.captureCup = captureCup
self.number = number
def Sow(self):
self.value = self.value + 1
def Harvest(self):
self.v... | NicholasACTran/Kalah-MiniMax | src/kalah.py | kalah.py | py | 5,286 | python | en | code | 0 | github-code | 13 |
73669065616 | from cpy.symbolic.sym_utils import vec_subs
import sympy
def rk4(dynamics):
q = dynamics['state']
qdot = dynamics['dynamics']
h = sympy.Symbol('h')
h_half = sympy.Rational(1, 2) * h
h_sixth = sympy.Rational(1, 6) * h
k1 = qdot
k2 = vec_subs(qdot, q, q + (h_half * k1))
k3 = vec_subs(... | jpanikulam/cpy | cpy/optimization/dynamics.py | dynamics.py | py | 465 | python | en | code | 4 | github-code | 13 |
9039212600 | import logging
from dialogue_system import bml
from .tcp_sender import TCPSender
logger = logging.getLogger().getChild(__name__)
class UnityBody:
def __init__(self, character_name='ChrBrad'):
self._conn = None
self._character_name = character_name
def __enter__(self):
self._conn = T... | onyalcin/echo_bot | dialogue_system/smart_body/unity_body.py | unity_body.py | py | 1,159 | python | en | code | 3 | github-code | 13 |
10135613377 | from django.db import models
from django.contrib.auth.models import User
class Article(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
image = models.ImageField(null=True)
created = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(User, on_delete=models.CASCA... | aalkhulaifi/Beautiful-designed-blog | main/models.py | models.py | py | 835 | python | en | code | 0 | github-code | 13 |
24129383418 | import pytest
from fastapi import FastAPI
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from redis.asyncio import ConnectionPool
from starlette import status
from car_rental_service.db.dao.reservation_dao import ReservationDAO
from car_rental_service.tests.payloads import CREATE_RESERVA... | d3prof3t/car-rental-service | car_rental_service/tests/test_reservation.py | test_reservation.py | py | 1,606 | python | en | code | 0 | github-code | 13 |
42834718163 | from clients.Client import Client
from getpass import getpass
from datetime import date
import json
#def cliente2():
if __name__ == "__main__":
print("Cliente Extender Arriendo")
keep_alive = True
try:
while(keep_alive):
#fecha = input("Ingrese la nueva fecha de arriendo:... | wolfzart/arquiSoftware | disfraz/backend/cliente2.py | cliente2.py | py | 1,343 | python | es | code | 0 | github-code | 13 |
73393198738 | #! /usr/bin/env python3
from bs4 import BeautifulSoup
import jieba
from urllib.parse import urlparse, ParseResult
from typing import List, Dict
import config
class WebPageAnalyzer(object):
def __init__(self, url:str, html:str) -> None:
self.__url:str = url
self.__html:str = html.replace('\0', '')
... | hubenchang0515/Phosphophyllite | analyzer.py | analyzer.py | py | 2,211 | python | en | code | 2 | github-code | 13 |
38568719882 | import imp
from urllib.parse import urlencode
from urllib import parse
from enum import Enum, unique
import requests
import os,sys
import time
# todo: 可以改成自动获取API_KEY
API_KEY = "your api key" # 替换成你的API_KEY
# todo: 可以改成自己的保存路径
DOWNLOAD_FILE_PATH = '/Users/xxx/Desktop/pixabayDownload/' # 替换成你的保存路径
class Spider():
... | zeku2022/pixbayDownloader | pixabayDownloader.py | pixabayDownloader.py | py | 5,763 | python | en | code | 0 | github-code | 13 |
10968510003 | import requests
import io
import pandas as pd
import math
# url = "https://ldlink.nci.nih.gov/LDlinkRest/ldmatrix"
# rs = [
# "rs12980275",
# "rs8109886",
# "rs4803222",
# "rs111531283",
# "rs8099917",
# "rs7248668",
# "rs35963157",
# "rs955155",
# "rs8101517",
# "rs6508852",
... | labsquare/cutevariant | poc/ldmatrix.py | ldmatrix.py | py | 3,650 | python | en | code | 86 | github-code | 13 |
15596784123 | from ..common import Proxy
from ..common import Utils
from ..common import Model
from ..common import gateway
from copy import copy
class DistributedModel(Model):
def __init__(self, ignite, reader, parser, instances=1, max_per_node=1):
"""Constructs a new instance of distributed model.
Parameters
... | gridgain/ml-python-api | python/ggml/inference/__init__.py | __init__.py | py | 3,485 | python | en | code | 6 | github-code | 13 |
14812885948 | from flask_app.config.mysqlconnection import query_db
from flask import Flask, flash, session
from flask_app.models import product
app = Flask(__name__)
class Arrangement:
def __init__(self, data):
self.id = data['id']
self.size = data['size']
self.price = data['price']
self.invento... | Sal-Nunez/marketplace_schema | flask_app/models/arrangement.py | arrangement.py | py | 2,960 | python | en | code | 1 | github-code | 13 |
3107988376 |
"""
Write a program that asks the user to enter the width and length of a room.
Once these values have been read, your program should compute and display the area of the room.
The length and the width will be entered as floating-point numbers.
Include units in your prompt and output message; either feet or meters,
de... | aleattene/python-workbook | chap_01/exe_003_area_room.py | exe_003_area_room.py | py | 700 | python | en | code | 1 | github-code | 13 |
4338114615 | from transformers import BertTokenizer
from transformers import AdamW
from torch.utils.data import DataLoader
from transformers.optimization import get_linear_schedule_with_warmup
import pytorch_lightning as pl
import pickle
from deepspeed.ops.adam import FusedAdam
from deepspeed.ops.adam import DeepSpeedCPUAdam
import... | LotusDYH/ssl_robust | utils.py | utils.py | py | 15,227 | python | en | code | 2 | github-code | 13 |
28529029252 | """
Script for converting symlinks to normal files
"""
import argparse
import pathlib
def main():
"""
Main function
"""
# pylint: disable=too-many-locals, too-many-statements
args = argparse.ArgumentParser(description='Convert symlink')
# Required
args.add_argument('-p', '--path', type=s... | ag14774/symlink2file | symlink2file.py | symlink2file.py | py | 652 | python | en | code | 0 | github-code | 13 |
9391823092 | # coding: utf8
#
# version: 2020-05-09.10-30
#
# Создатель Permyak_Logy#8606
# По заказу от Daniillazarev#0202 685355179570233344
import discord
from datetime import datetime
import json
import random
import re
config_file_name = 'config.json'
class Obj:
pass
class FastEmoji:
yes = di... | daniillazarev2301/- | main.py | main.py | py | 15,429 | python | ru | code | 0 | github-code | 13 |
9069975447 | def input_to_matrix(rows, columns):
matrix = []
for row_index in range(rows):
# row = [int(n) for n in input().split()]
row_string = input()
row = []
for ch in row_string:
row.append(ch)
matrix.append(row)
return matrix
def count_all_moves(matrix):
m... | vbukovska/SoftUni | Python_advanced/Ex3_multidimentional_lists/knight_game.py | knight_game.py | py | 2,516 | python | en | code | 0 | github-code | 13 |
10422033917 | import cv2
import os
from pathlib import Path
import torch
from .model_download import *
from .PlaneRecNet.planerecnet import PlaneRecNet
from .PlaneRecNet.data.augmentations import FastBaseTransform
from .PlaneRecNet.planerecnet import PlaneRecNet
from .PlaneRecNet.data.config import set_cfg, cfg, COLORS
from .Pla... | raptermeal/cjlearningclass2nd | app/library/inference_PRN.py | inference_PRN.py | py | 11,042 | python | en | code | 0 | github-code | 13 |
71006334737 |
# We arbitrarily defined the value of a winning board as +1.0 and a losing board as −1.0. All other boards would receive values between −1.0 and +1.0, with a neural network favoring boards with higher values.
minimax_win = 1
minimax_lose = -minimax_win
minimax_draw = 0
minimax_empty = -1
import random
class TMCTS... | thien/slowpoke | library/decision/tmcts.py | tmcts.py | py | 4,430 | python | en | code | 1 | github-code | 13 |
18953724080 | import urllib
import deepl
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from django.template import loader
import aai.autosuggest as sgst
import aai.query as query
from aai.log.ArtistRecommendation import ArtistRecommendation
from aai.log.LogLoader import LogLoader
pool = qu... | watzkuh/artoogle | artoogle/views.py | views.py | py | 2,868 | python | en | code | 0 | github-code | 13 |
39837902042 | #Program to convert output from minisat to readable sudoku format and write it to "output.txt"
#to output the result to "output.txt"
import sys
orig_stdout = sys.stdout
f = open('output.txt', 'w')
sys.stdout = f
#reading and storing minisat output in a
input_file=open('minisat_output.txt','r')
a = input_file... | vaibhavjindal/sat_solver | a1/a1.1/decode.py | decode.py | py | 886 | python | en | code | 0 | github-code | 13 |
29026302651 | CAR_NUMBER = "CAR_2016_04_004"
CAR_NAME = "Successful Local Account Login"
CAR_DESCRIPTION = "The successful use of Pass The Hash for lateral movement between workstations would trigger event ID 4624 with an event level of information, from the security log. " \
"This behavior would be a LogonType of 3 using NTLM a... | unfetter-discover/unfetter-analytic | analytic-system/src/CAR_2016_04_004.py | CAR_2016_04_004.py | py | 2,510 | python | en | code | 174 | github-code | 13 |
71251550417 | #!/usr/bin/env python3
# -*- coding: ascii -*-
import pygame
from ..cat.history import History
from scripts.utility import scale
from .Screens import Screens
from scripts.utility import get_text_box_theme
from scripts.cat.cats import Cat
import pygame_gui
from scripts.game_structure.image_button import UIImageButton
f... | Thlumyn/clangen | scripts/screens/CeremonyScreen.py | CeremonyScreen.py | py | 3,208 | python | en | code | 135 | github-code | 13 |
26110907469 | from __future__ import unicode_literals
from hazm import *
import filtering as fl
import openpyxl
def mallet(file_name1, file_name2):
words = []
words_count =[]
delete_list = ["ViviGirl",':',"?" ,"؟" ,"ک","ها","از","در","Mr_Mean","mehraveh_tma","MAminHP","!","ب","ی","یه","FWD","Photo","]","{","[","هاش",".",... | mehraveh/ChatSubjects | mallet_file_gn.py | mallet_file_gn.py | py | 2,151 | python | en | code | 0 | github-code | 13 |
25054883404 | #10162
from sys import stdin
#A = 300, B = 60, C = 10
time = int(stdin.readline())
a = 0
b = 0
c = 0
while time > 0:
if time >= 300:
time -= 300
a += 1
elif time >= 60:
time -= 60
b += 1
else:
time -= 10
c += 1
if time == 0:
print(f"{a} {b} {c}")... | wjsehdlf77/baekjoonpractice | practice42.py | practice42.py | py | 343 | python | en | code | 0 | github-code | 13 |
22800281512 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Authors: Chiheb Trabelsi
#
# Implementation of Layer Normalization and Complex Layer Normalization
#
import numpy as np
from keras.layers import Layer, InputSpec
from keras import initializers, regularizers, constraints
import keras.backend as K
from .bn import Compl... | ChihebTrabelsi/deep_complex_networks | complexnn/norm.py | norm.py | py | 11,241 | python | en | code | 673 | github-code | 13 |
36409314226 | from django.shortcuts import render
from django.http import HttpResponseRedirect
from administrar.models import Tarea # Importa el modelo
from .forms import TareaForm
# Create your views here.
def v_index(request):
if request.method == 'POST':
datos = request.POST.copy()
form = TareaForm(datos)
... | diazalejandra/M7-Lista-Tareas-Django | administrar/views.py | views.py | py | 1,264 | python | en | code | 0 | github-code | 13 |
72927439698 | from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Conv1D, Dropout, MaxPool1D
from keras.utils import to_categorical
from keras.optimizers import SGD
from classify_bubble import get_candidate_signals, is_bubble
import os
from cv2 import imread
import numpy as np
def get_bubble_tr... | zazizizou/gradient_ansatz | bubbleNet1D.py | bubbleNet1D.py | py | 3,112 | python | en | code | 1 | github-code | 13 |
9712414605 | import os
import torch
import torchvision.transforms as transforms
import torchvision.models as models
import torch.nn as nn
from process_test_file import test_eval, _get_test_reults
import warnings
warnings.filterwarnings("ignore")
device = 'cuda' if torch.cuda.is_available() else 'cpu'
test_path = str(os.getcwd())[... | Anindyadeep/Image-Collagination-as-Augmentations | code/run.py | run.py | py | 2,255 | python | en | code | 1 | github-code | 13 |
42756097431 | import logging
from Ant import Ant
logger = logging.getLogger("AntScheduler.MaxMin")
MULTIPLY = 0
ADD = 1
class AntAlgorithm:
""" Class containing Graph representing industrial process and method that runs Ant Colony Optimization on this
graph"""
def __init__(self, _config, _nodes_list):
self.co... | mcalus3/AntScheduler | antscheduler/AntAlgorithm.py | AntAlgorithm.py | py | 4,775 | python | en | code | 5 | github-code | 13 |
70876214418 | import json
import dpath.util
import xmltodict
from fastapi.testclient import TestClient
from parsel import Selector
from .main import app
from .dependencies import BaseResponse, RequestError, ParserError
from .routers.dpath import DpathResponse, DpathRequest
client = TestClient(app)
def test_wake():
response... | avi-perl/Parsel-Selector-API | app/test_main.py | test_main.py | py | 3,090 | python | en | code | 0 | github-code | 13 |
6948127564 | from typing import *
import time
import matplotlib.pyplot as plt
class Solution:
def integerBreak(self, n: int) -> int:
dp = [0] * (n + 1)
for i in range(2, n + 1):
for j in range(i):
dp[i] = max(dp[i], j * (i - j), j * dp[i - j])
return dp[n]
class Solution1:... | Xiaoctw/LeetCode1_python | 动态规划/整数拆分_343.py | 整数拆分_343.py | py | 1,830 | python | en | code | 0 | github-code | 13 |
25940813390 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 17 10:19:16 2020
@author: jhello
"""
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from IOFile import TabOutFile, GridOutFile, DataTabFiles
# time step file
result_dir = 'result/'
result_tmp_dir = result_dir + 'tmp/'
... | jhello/annmhd | test.py | test.py | py | 1,786 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.