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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
728123646 | from flask import Flask, render_template, request
import requests
import smtplib
import os
from dotenv import load_dotenv
import logging
import ssl
load_dotenv()
MY_EMAIL = os.getenv("MY_EMAIL")
MY_PASSWORD = os.getenv("MY_PASSWORD")
RECEIVER_EMAIL = os.getenv("RECEIVER_EMAIL")
SMTP_SERVER = os.getenv("SMTP_SERVER")
... | MariuszLepkowski/Blog-with-email-form | main.py | main.py | py | 2,401 | python | en | code | 0 | github-code | 90 |
28948918951 | if __name__ == "__main__":
file_name = input("File name (without extension): ")
lines_to_cut = int(input("How many lines should be cut from the data: "))
first_file = open(file_name + ".txt", "r")
data = first_file.readlines()
for i in range(lines_to_cut):
data.pop(0)
second_file ... | DimitriLyon/ProsodyFeatureWeightGraph | FileProcessor.py | FileProcessor.py | py | 1,896 | python | en | code | 0 | github-code | 90 |
11632156926 | #!/usr/bin/python3
"""Square #2 """
Rectangle = __import__('9-rectangle').Rectangle
class Square(Rectangle):
"""square class, super class is BaseGeometry,Rectangle
"""
def __init__(self, size):
"""instantiation method
"""
super().__init__(size, size)
self.integer_validator(... | Dblay112/alx-higher_level_programming | 0x0A-python-inheritance/11-square.py | 11-square.py | py | 557 | python | en | code | 0 | github-code | 90 |
18535869849 | A="abcdefghijklmnopqrstuvwxyz"
S=input()
k=int(input())
n=len(S)
C=[]
for a in A:
now=""
cnt=0
if not a in S:
continue
for i in range(n):
if S[i]==a:
for j in range(5):
if i+j<n:
C.append(S[i:i+j+1])
else:
... | Aasthaengg/IBMdataset | Python_codes/p03353/s438726818.py | s438726818.py | py | 499 | python | en | code | 0 | github-code | 90 |
4115707900 | import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
ndim = 768
def load_and_anlyze(use_model, use_paired_data):
# load data
paired_data = np.load('./feature/%s_features.npz' % use_paired_data)
caltech_data = np.load('./feature/caltech-256_features.npz')
categorized_data = np.... | Junqi-Zhang/Abstraction-Understanding | Analysis/analyze_gender.py | analyze_gender.py | py | 4,243 | python | en | code | 0 | github-code | 90 |
18150944299 | class UnionFind:
def __init__(self, n=1):
self.parent = [i for i in range(n)]
self.rank = [0] * n
def find(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def union... | Aasthaengg/IBMdataset | Python_codes/p02536/s400863877.py | s400863877.py | py | 882 | python | en | code | 0 | github-code | 90 |
44033080577 | import discord
from discord.ext import commands
class Administration(commands.Cog):
def __init__(self, bot):
self.bot = bot
#bot`s events
@commands.Cog.listener()
async def on_ready(self):
print('Administration is ready')
#bot`s commands
@commands.command()
async def p... | Crying-Soul/discord_bot | cogs/Administration.py | Administration.py | py | 866 | python | en | code | 0 | github-code | 90 |
46181637300 | """Reads the data stored in addressbook format."""
import addressbook_pb2
import sys
def ListPeople(address_book):
'''Iterates through all people in the AddressBook and prints info.'''
for person in address_book.people:
print("Person ID: ", person.id)
print("Name: ", person.name)
if p... | dhanraju/python | protobufs/read_addressbook.py | read_addressbook.py | py | 1,292 | python | en | code | 0 | github-code | 90 |
32526774967 |
# coding=utf-8
"""vertices and indices for a variety of simple shapes"""
import math
__author__ = "Daniel Calderon"
__license__ = "MIT"
# A simple class container to store vertices and indices that define a shape
class Shape:
def __init__(self, vertices, indices, textureFileName=None):
self.vertices = v... | TomasMikula/tomasmikula.github.io | Exercises/e3/basic_shapes.py | basic_shapes.py | py | 4,843 | python | en | code | 0 | github-code | 90 |
18405256899 | N,K = list(map(int,input().split()))
out = 0
for i in range(1,N+1):
t = 0
now = i
while now<K:
now*=2
t+=1
out += 0.5**t
print(out/N)
| Aasthaengg/IBMdataset | Python_codes/p03043/s593743800.py | s593743800.py | py | 166 | python | en | code | 0 | github-code | 90 |
31384173341 | import logging
import torch
from torch import nn
from nlplay.data.cache import DSManager, DS
from nlplay.features.text_cleaner import base_cleaner
from nlplay.models.pytorch.classifiers.linear import SMLinearModel
from nlplay.models.pytorch.dataset import CSRDatasetGenerator
from nlplay.models.pytorch.trainer import Py... | jeremypoulain/nlplay | scripts/tfidf_linear_train_script.py | tfidf_linear_train_script.py | py | 2,070 | python | en | code | 7 | github-code | 90 |
31152954387 | import pandas as pd
from sklearn.model_selection import train_test_split
filepath_to_data_directory = "C:/Users/Pavel_Zharski/IdeaProjects/" \
"learning/python/sklearn-machine-learning/" \
"data/house_renting/"
# Settings to show all columns, not limit them wh... | pzharskiy/sklearn-machine-learning | intermediate_machine_learning/data_exploration.py | data_exploration.py | py | 2,016 | python | en | code | 0 | github-code | 90 |
74004107176 | a = [4,6,'pу','tell',78]
b = [44,"hello",56,"exept",3]
c=a+b
c.insert (3,6)
i=0
while i< len(c) :
print(c[i])
if isinstance(c[i],str) :
del c [i]
else:
i+=1
print(*c) # без квадратных скобок | AlenaKunshtel91/Group_155 | урок 8.py | урок 8.py | py | 245 | python | en | code | 0 | github-code | 90 |
30168408857 | import json
import pandas as pd
import datetime
import sqlite3, glob, subprocess, os, traceback, platform, argparse
filename0 = '0021500575.json'
def import_data(filename):
file = open(filename)
data = json.load(file)
# dict_keys(['gameid', 'events', 'gamedate'])
positions = []
possessions = []
... | luc14/NBA | bball.py | bball.py | py | 12,200 | python | en | code | 0 | github-code | 90 |
34407571782 | from pytest import raises
from desmod.queue import PriorityItem, PriorityQueue, Queue
def test_mq(env):
queue = Queue(env, capacity=2)
def producer(msg, wait):
yield env.timeout(wait)
yield queue.put(msg)
def consumer(expected_msg, wait):
yield env.timeout(wait)
msg = yi... | westerndigitalcorporation/desmod | tests/test_queue.py | test_queue.py | py | 7,342 | python | en | code | 58 | github-code | 90 |
30875394806 | # BOJ_1167_gold2-트리의지름
import sys
from collections import defaultdict, deque
input = sys.stdin.readline
def bfs(idx):
chk = [0, 0]
que = deque()
visited = set()
visited.add(idx)
que.append((idx, 0))
while que:
start, w = que.popleft()
for i in tree[start]:
if i[1] n... | Lee-hanbin/Algorithm | Python/BOJ/Gold/BOJ_1167_gold2-트리의지름/BOJ_1167_gold2-트리의지름.py | BOJ_1167_gold2-트리의지름.py | py | 1,233 | python | ko | code | 3 | github-code | 90 |
18141704149 | # coding: utf-8
while True:
n,x = map(int, input().split())
if n == x == 0:
break
list = [i for i in range(1,n+1)]
count = 0
for i in list:
for j in list[i:]:
k = x - (i + j)
if list[j:].count(k) == 1:
count += 1
... | Aasthaengg/IBMdataset | Python_codes/p02412/s998357005.py | s998357005.py | py | 337 | python | en | code | 0 | github-code | 90 |
70884588138 | import os
import numpy as np
from shutil import copyfile
ESD_path = '/Users/liurui/WorkSpace/DATA_Resource/HLT-ESD/HLT-ESD/'
spklist = ['0011','0012','0013','0014','0015','0016','0017','0018','0019','0020']
emos = ['Angry','Happy','Sad','Angry','Surprise','Neutral']
newdir_path = '/Users/liurui/WorkSpace/OneDrive/SUT... | ttslr/i-ETTS | ESD-sample/copyfile.py | copyfile.py | py | 1,114 | python | en | code | 6 | github-code | 90 |
18526099769 | def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(input()) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
return random.randint(ran1,... | Aasthaengg/IBMdataset | Python_codes/p03329/s306982031.py | s306982031.py | py | 2,112 | python | en | code | 0 | github-code | 90 |
18263752139 | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue
# import numpy as np
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353
... | Aasthaengg/IBMdataset | Python_codes/p02763/s249104090.py | s249104090.py | py | 1,642 | python | en | code | 0 | github-code | 90 |
13680274504 | import time
from appium import webdriver
from selenium.webdriver.common.by import By
# 定义一个字典,用来存放被测手机及app的相关数据
# 需要知道:手机系统,系统版本,手机的设备ID,app包名,app的启动名
from utils import get_element
des_cap = dict()
des_cap["platformName"] = 'android'
des_cap["PlatformVersion"] = '5.1.1'
des_cap["deviceName"] = 'emulator-5554'
des_cap... | Lmina0524/App-appium | day05/02判断元素是否存在.py | 02判断元素是否存在.py | py | 722 | python | zh | code | 0 | github-code | 90 |
36712345105 | import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'AppleGothic'
filename = 'mygraph.csv'
myframe = pd.read_csv(filename, index_col='이름', encoding='utf-8')
myframe.index.name = '이름'
myframe.columns.name = '시험 과목 '
myframe.plot(kind='bar', rot=0, title='학생별 누적 시험 점수', legend=True)
pri... | Hitee8239/allnew | python/pythonDataProces/p239_ex_07.py | p239_ex_07.py | py | 686 | python | en | code | 0 | github-code | 90 |
18231203139 | def solve():
N = int(input())
A = [int(i) for i in input().split()]
counter = {}
for num in A:
counter[num] = counter.get(num, 0) + 1
for i in range(1, N+1):
print(counter.get(i, 0))
if __name__ == "__main__":
solve() | Aasthaengg/IBMdataset | Python_codes/p02707/s917046005.py | s917046005.py | py | 258 | python | en | code | 0 | github-code | 90 |
23990522572 | import os
import argparse
import logging
import shutil
import tempfile
import subprocess
class CheckConfig():
"""check config file"""
def __init__(self, old_rpm, new_rpm, work_path="/var/tmp",
output_file="/var/tmp/config_change.md"):
self.output_file = output_file
self._old_rp... | openeuler-mirror/openEuler-Advisor | advisors/check_conf.py | check_conf.py | py | 9,087 | python | en | code | 3 | github-code | 90 |
20402605956 | import sys
input = sys.stdin.readline
def ccw(p1, p2, p3):
return (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p2[1] - p1[1]) * (p3[0] - p1[0])
def convex_hull(points):
points = sorted(points)
lower = []
for p in points:
while len(lower) >= 2 and ccw(lower[-2], lower[-1], p) < 0:
lower.pop... | taewan2002/ProblemSolving | Baekjoon/convex_hull/4181.py | 4181.py | py | 764 | python | en | code | 4 | github-code | 90 |
17269092360 | #---COMMAND LIST---#
# view_cwd == will show all files in the directory where the file is running
# custom_dir == will show files from custom directory
# download_files == will download files from directory
import os
import socket
s = socket.socket()
port = 8080
host = input(str("Please enter the server ad... | ContentWithEZY/Python-Projects | python-backdoor/slave dir/slave.py | slave.py | py | 1,364 | python | en | code | 0 | github-code | 90 |
41620562147 | import tkinter as tk
from tkinter import messagebox, simpledialog
from tkinter import ttk
import pickle
import os.path
class Produto:
def __init__(self, codigo, descricao, valorUnitario):
self.codigo = codigo
self.descricao = descricao
self.valorUnitario = valorUnitario
def get... | Luiss1569/Orietado-Objetos-I | Trabalhos/Trabalho 15/produto.py | produto.py | py | 4,681 | python | pt | code | 0 | github-code | 90 |
42485574538 | # PACKAGES ---------------------------------------------------------------------
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split, StratifiedKFold
from sklearn.preprocessing import LabelEncoder, StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.li... | nealj1/comp-4730-1st-project | main.py | main.py | py | 12,123 | python | en | code | 0 | github-code | 90 |
18483143159 | from collections import deque
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
d = deque(A)
#print(d)
# ans1[0] < ans1[1] > ans1[2] という大小関係になる配列を作成する
ans1 = []
for i in range(N):
x = d.pop() if i % 2 == 0 else d.popleft()
ans1.append(x)
x = ans1.pop()
ans1 = [x] + ans1
# ans2[0] > ans2[1] < ans... | Aasthaengg/IBMdataset | Python_codes/p03229/s081677767.py | s081677767.py | py | 717 | python | en | code | 0 | github-code | 90 |
33659386097 | #!/usr/bin/env python
#-*-coding:utf-8-*-
# author:lwz
from collections import deque
class TreeNode(object):
def __init__(self, val):
self.val = val
self.left, self.right = None, None
class Solution(object):
def __init__(self):
self.traverse_path = []
self.root = None # 整棵树的根节... | algorithm004-04/algorithm004-04 | Week 02/id_524/LeetCode_94_524.py | LeetCode_94_524.py | py | 1,365 | python | en | code | 66 | github-code | 90 |
28620612519 | import pandas as pd
from tqdm import tqdm
from datetime import datetime
# The length of time in milliseconds after 1970-01-01T00:00:00.000 UTC that
# the first pixel was placed in r/Place 2022.
START_TIME = 1648806250 #begin of place in s
def parse_timestamp(timestamp):
"""Convert a YYYY-MM-DD HH:MM:SS.SSS times... | pietro-sillano/r-place-Network-Analysis | scripts/trimming_csv.py | trimming_csv.py | py | 4,609 | python | en | code | 0 | github-code | 90 |
74405040937 | import numpy as np
import matplotlib.pyplot as plt
data = np.genfromtxt('livetime_vs_time.csv',delimiter=',',skip_header=1,
names=['Year','Month','Date','Sum'])
date = data['Date']
livetime = data['Sum']
start_year=2012
stop_year=2021
fig = plt.figure(figsize=(7,5 ))
ax=fig.add_subplot(1,1,1)
ax.plot(date,livetime,'... | clark2668/ara_plots | talks/2021.04-APS-April/plot_livetime_vs_time.py | plot_livetime_vs_time.py | py | 606 | python | en | code | 0 | github-code | 90 |
2092063859 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 19:15:51 2020
@author: hernan
"""
import numpy as np
import sim
import cv2
class Camara:
"""
Clase para representar una cámara arbitraria
Esta estructura maneja la conversión entre coordenadas de camara y coordenadas del mundo.
... | hernanGuimaraynz/Fisheye-Calib--Simulator | camara2.py | camara2.py | py | 8,088 | python | es | code | 0 | github-code | 90 |
807637362 | import os
import random
from collections import defaultdict, Counter
import onmt
import torch
from autocuda import auto_cuda_index
from findfile import find_file, find_dir
from onmt.bin.build_vocab import build_vocab_main
from onmt.inputters.inputter import _load_vocab, _build_fields_vocab, get_fields
from onmt.opts i... | yangheng95/DaNuoYi | DaNuoYi/deep_learning/translator/translator.py | translator.py | py | 11,392 | python | en | code | 5 | github-code | 90 |
15567263781 | from sys import setrecursionlimit
import threading
setrecursionlimit(10 ** 9)
threading.stack_size(67108864)
def main():
file_input, file_output = open('input.txt', 'r'), open('output.txt','w')
n, m = map(int, file_input.readline().split())
vortex = [list(map(int, file_input.readline().split())) ... | Lopa10ko/ITMO-algo-2021-2022 | problems8/lab8_a.py | lab8_a.py | py | 623 | python | en | code | 0 | github-code | 90 |
74769799977 | import logging
import re
from geopandas import GeoDataFrame, read_file
from glob import glob
from os.path import join
from pandas.api.types import is_numeric_dtype
from shapely.geometry import MultiPolygon
from shapely.validation import make_valid
from topojson import Topology
from zipfile import BadZipFile, ZipFile
f... | b-j-mills/hdx-scraper-global-boundaries | boundaries.py | boundaries.py | py | 13,667 | python | en | code | 0 | github-code | 90 |
34039394324 | # The main thing that we use to run SLAW
# Run like "python Slaw.py 100 2 1 1" for 100 walkers over 2 days moving at 1 m/s with visualization
import FractalPoints as fp
import Walker as w
import ClusterFractalPoints as cfp
class SlawInstance:
area_side = 1000 # meters in each side of our area
num_waypoints = 2... | vcrawford/DeviceCaching | SlawPython/SlawInstance.py | SlawInstance.py | py | 2,190 | python | en | code | 0 | github-code | 90 |
15801632715 | # -*- coding: utf-8 -*-
"""
1260. Shift 2D Grid
Given a 2D grid of size m x n and an integer k. You need to shift the grid k times.
In one shift operation:
Element at grid[i][j] moves to grid[i][j + 1].
Element at grid[i][n - 1] moves to grid[i + 1][0].
Element at grid[m - 1][n - 1] moves to grid[0][0].
Return the 2... | tjyiiuan/LeetCode | solutions/python3/problem1260.py | problem1260.py | py | 1,251 | python | en | code | 0 | github-code | 90 |
18026781969 | """
Nは10**5以下。O(N)なら通る
"""
N = int(input())
A = []
B = []
for i in range(N):
s = list(map(int, input().split()))
A.append(s[0])
B.append(s[1])
count = 0
for i in reversed(range(N)):
if (count + A[i]) % B[i] == 0:
continue
else:
s = B[i] - (count + A[i]) % B[i]
count += s
p... | Aasthaengg/IBMdataset | Python_codes/p03821/s722131629.py | s722131629.py | py | 347 | python | en | code | 0 | github-code | 90 |
9888724818 | import re
import ipinfo
import csv
from collections import Counter
def reader(filename):
regexp = r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
with open(filename) as f:
log = f.read()
ip_list = re.findall(regexp, log)
return ip_list
def count(ip_list):
count = Counter(ip_list)
r... | smerch88/Ip_check | main.py | main.py | py | 1,334 | python | en | code | 0 | github-code | 90 |
2809169516 | # take user's input
# store input as a list of characters
user_input = list(input("Please type in a phrase to be ciphered: "))
cipher_input = []
cipher = {' ':' ', 'a': 'n', 'b': 'o', 'c': 'p', 'd': 'q', 'e': 'r', 'f':'s', 'g': 't', 'h': 'u', "i": 'v', "j": 'w', "k": "x", 'l': 'y', 'm': 'z', 'n': 'a', 'o': 'b', 'p': '... | PdxCodeGuild/class_salmon | code/ross/html/lab05/cipher.py | cipher.py | py | 655 | python | en | code | 5 | github-code | 90 |
13528472430 | from datetime import date
import unittest
from hotel.operations.bookings import (
BookingCreateData,
InvalidDateError,
create_booking,
)
from hotel.operations.errors import UnavailableRoomError
from hotel.operations.interface import DataObject
from test.stub import DataInterfaceStub
class RoomInterface(D... | dominik-air/clean-fastapi-project | backend/test/test_bookings.py | test_bookings.py | py | 2,095 | python | en | code | 0 | github-code | 90 |
8321243138 | from .entity import IEntity
from Box2D import b2
import math
class Buildable(IEntity):
def __init__(self, world, start, end, thickness, density, friction):
mid = start + (end - start)/2
a = mid-start
angle = math.atan2(a[1], a[0])
self.body = world.CreateDynamicBody(
position = mid,
angle = angle,
... | NejsemTonda/Bachelor-thesis- | code/sim/buildable.py | buildable.py | py | 936 | python | en | code | 0 | github-code | 90 |
35731234775 | '''
Created on Feb 24, 2015
@author: hoavu
'''
from collections import Counter
import nltk
import time
import re, math
import requests
import urllib.parse
from urllib.request import urlopen
from nltk.stem.porter import PorterStemmer
import sys,os
sys.path.append(os.path.realpath('..'))
vn_date_dict = {'Thứ sáu' : 'Fri... | hoavt-54/iCrawlerServer | src/crawlerApp/utils.py | utils.py | py | 5,076 | python | en | code | 0 | github-code | 90 |
9391650477 | from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from starlette.responses import JSONResponse
from joblib import load
import pandas as pd
app = FastAPI()
@app.get("/")
def read_root():
strWelcomeMsg = """
<html>
<head>
<title>Pankaj's Beer Style Prediction API</title>... | pankaj1102/assignment2_api | app/main.py | main.py | py | 4,497 | python | en | code | 0 | github-code | 90 |
17550888534 | from django import forms
class PhotoFilterForm(forms.Form):
form = (('jpg', 'JPG'),
('jpeg', 'JPEG'),
('cr', 'Kodak: CR'),
('k25', 'Kodak: K25'),
('kdc', 'Kodak: KDC'),
('crw', 'Canon: CRW'),
('cr2', 'Canon: CR2'),
('cr3', 'Canon: ... | nosovdmitry007/Photo_filter | parserapp/forms.py | forms.py | py | 5,798 | python | ru | code | 0 | github-code | 90 |
18025835089 | n = int(input())
a = sorted(list(map(int,input().split())))
ans = len(set(a))
s = 0
cnt = 1
pre = 0
a.append(10**9)
for x in a:
if x != pre:
s += (cnt+1)%2
cnt = 1
pre = x
else:
cnt += 1
s %= 2
print(ans-s)
| Aasthaengg/IBMdataset | Python_codes/p03816/s578579809.py | s578579809.py | py | 247 | python | en | code | 0 | github-code | 90 |
14064570681 | import operator
from collections import namedtuple
from typing import Dict
from iris.cube import Cube
from iris.exceptions import CoordinateNotFoundError
def comparison_operator_dict() -> Dict[str, namedtuple]:
"""Generate dictionary linking string comparison operators to functions.
Each key contains a dict ... | metoppv/improver | improver/utilities/probability_manipulation.py | probability_manipulation.py | py | 4,965 | python | en | code | 95 | github-code | 90 |
3350720242 | import urllib;
import urllib.parse;
import urllib.request;
import urllib.response;
import common_web;
import re;
import time;
from datetime import date, timedelta;
# http://www.airdates.tv/
def get_date():
#today = date.fromtimestamp(time.time()); # If we were interested in shows aired today...
yesterday =... | TylerD75/tv-autoloader | airdates.py | airdates.py | py | 2,120 | python | en | code | 0 | github-code | 90 |
14352992479 | f=open(input('Enter the file name:'))
count=0
total=0
a=[]
for line in f:
if line.startswith("X-DSPAM-Confidence:"):
n=line.find(':')
b=float(line[n+1:])
a.append(b)
for i in a:
count=count+1
total=total+i
avg=total/count
print('average spam confidence =',avg) | revacprogramming/python101-NithinHD | ActivitySet#1/problem#08.py | problem#08.py | py | 296 | python | en | code | 0 | github-code | 90 |
37930960683 | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
#url(r'^admin/', include(admin.site.urls)),
url(r'^fc/', include('fundclear.urls')),
url(r'^fc2/', include('fundclear2.urls')),
url(r'^fr/', include('fundcodereader.urls')),
url(r'^bot/', include('bankoftaiwan.u... | slee124565/philcop | phicops/urls.py | urls.py | py | 1,116 | python | en | code | 1 | github-code | 90 |
69859729896 | import os
import json
import random
import shutil
import string
import fastapi
import numpy as np
from PIL import Image
from src import config
import face_recognition
from fastapi import Request
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, text
from fastapi.responses import JSONResponse
from... | dfcarrera79/control_asistencia_api | src/routers/selfie.py | selfie.py | py | 4,436 | python | en | code | 0 | github-code | 90 |
17927386469 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,c=map(int,input().split())
STC=[tuple(map(int,input().split())) for _ in range(n)]
STC.sort(lambda x:(x[2],x[0],x[1]))
# 同じチャンネルで連続するものは結合しておく
for i in range(n-1):
... | Aasthaengg/IBMdataset | Python_codes/p03504/s538992190.py | s538992190.py | py | 786 | python | ja | code | 0 | github-code | 90 |
34218012934 | import os
from PIL import Image
from torch.utils import data
from utils.seg.watershed import watershed_seg as seg
class DehazingSet(data.Dataset):
def __init__(self, root, transform, is_train):
self.trans_path = root + '/trans/'
self.gt_imgs_path = root + '/clear/'
self.seg_path = root + '/... | Xiaohan-Wang/dehaze | DehazingSet.py | DehazingSet.py | py | 1,526 | python | en | code | 1 | github-code | 90 |
21874878075 | import os
import cv2
import numpy as np
from processing.detector import ImageProcessor
from scipy.optimize import least_squares
import csv
from utils.utils import (
load_json,
get_project_root,
circle_residuals,
rotate_opencv_point,
dist,
)
from utils.contansts import WHITE, BLACK, BLUE, CYAN, GREEN... | rudrodip/Harmonic-Oscillator-CV | app/processing/video_thread.py | video_thread.py | py | 9,633 | python | en | code | 1 | github-code | 90 |
29796212535 | from enum import Enum
import platform,os
from pathlib import Path
from PyQt5.QtGui import QColorConstants
from gui_client.gui_config import GuiConfigs
OS_NAME=platform.system()
DEFAULT_CONFIG_PATH=Path.home().joinpath(".mmdict_client/configs.ini")
class FRONT_END(Enum):
QTWEBENGINE=1
CONSOLE=2
SOCKET_LOCAT... | zypangpang/mmdict_client | constants.py | constants.py | py | 1,315 | python | en | code | 2 | github-code | 90 |
21554722190 | import numpy as np
import sklearn_extra.cluster
import sys
from .. import Agent
''' Agent that implements a mode heuristic algorithm for the ambulance graph environment'''
class modeAgent(Agent):
def __init__(self, epLen):
'''
epLen - number of steps
data - all data observed so far
... | maxsolberg/ORSuite | or_suite/agents/ambulance/mode_graph.py | mode_graph.py | py | 1,892 | python | en | code | 0 | github-code | 90 |
73180086695 | from sqlalchemy import and_, event, table
from sqlalchemy.orm import Query, relationship
from sqlalchemy_views import CreateView, DropView
from anyblok.common import anyblok_column_prefix
from anyblok.field import Field, FieldException
from .exceptions import ModelFactoryException, ViewException
def has_sql_fields(... | AnyBlok/AnyBlok | anyblok/model/factory.py | factory.py | py | 6,669 | python | en | code | 19 | github-code | 90 |
18221734339 | k=int(input())
a,b= map(int, input().split())
q=0
for i in range(1,1000):
if a<=k*i and k*i<=b:
print('OK')
q=1
break
if q==0:
print('NG') | Aasthaengg/IBMdataset | Python_codes/p02693/s177437594.py | s177437594.py | py | 158 | python | en | code | 0 | github-code | 90 |
29348494165 | import os
import numpy as np
import pandas as pd
import torch
import cv2
from torch.utils.data import Dataset, DataLoader
from torchvision import io
from torchvision.transforms import transforms
class TrafficSignDataset(Dataset):
def __init__(self, csv_file, imgs_dir, transform=None):
self.annotations = p... | hoanshiro/CS406 | dataset.py | dataset.py | py | 2,040 | python | en | code | 0 | github-code | 90 |
18602361117 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 16 09:53:50 2017
@author: Administrator
"""
from openpyxl import load_workbook
from geopy.geocoders import Nominatim
import time
wb = load_workbook(filename = 'api1.xlsx')
ws = wb.get_sheet_by_name('API')
geolocator = Nominatim(scheme='http')
for row in ... | robin0821/geocoding | api_geo.py | api_geo.py | py | 985 | python | en | code | 1 | github-code | 90 |
18108751649 | def do_calc(data):
from collections import deque
s = deque() # ??????????????¨??????????????????
while data:
elem = data[0]
data = data[1:]
if elem == '+' or elem == '-' or elem == '*':
a = s.pop()
b = s.pop()
if elem == '+':
s.app... | Aasthaengg/IBMdataset | Python_codes/p02263/s150512808.py | s150512808.py | py | 757 | python | en | code | 0 | github-code | 90 |
71847117096 | import time
start_time = time.time()
with open("input") as f:
cypher = list(map(int, f.readlines()))
pos = 25
# Part 1
part1 = None
for c in cypher[pos:]:
pre = set(cypher[pos - 25 : pos])
if not any(c - p in pre for p in pre):
part1 = (pos, c)
break
pos += 1
print("Part 1:", part1[... | alfredgamulo/advent_of_code | 2020/09/main.py | main.py | py | 630 | python | en | code | 2 | github-code | 90 |
73218707496 | #!/usr/bin/env python3
class Queue:
def __init__(self):
self.q = []
def __str__(self):
return str(self.q)
def put(self, obj):
self.q.append(obj)
def get(self):
if not self.empty():
next_obj = self.q[0]
self.q = self.q[1:]
return nex... | ctimaeus/practice | graph.py | graph.py | py | 3,414 | python | en | code | 0 | github-code | 90 |
14650966312 | # encoding: utf-8
import math
import random
import torchvision.transforms as T
import torch
def build_transforms(size):
normalize_transform = T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
transforms = T.Compose([
T.Resize(size),
#T.Pad(10),
#T.RandomCrop([256, 128... | oliverck/TCiP | dataset/transforms.py | transforms.py | py | 3,413 | python | en | code | 7 | github-code | 90 |
17118697066 | import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import CountVectorizer
df = pd.read_csv("./api/articles_data.csv", index_col=0)
count_vect = CountVectorizer(stop_words="english")
matrix = count_vect.fit_transform(df["title"])
cos_sim = cosine_sim... | Harshit-Panigrahi/Python | ArticleRecommendation/api/content_based.py | content_based.py | py | 684 | python | en | code | 0 | github-code | 90 |
18257968639 | import math
A,B = map(int,input().split())
ans = 0
AT = 0.08
BT = 0.1
a = A/AT
b = B/BT
aPlus = (A+1)/AT
bPlus = (B+1)/BT
if a == b :
ans = a
elif a < b :
if aPlus <= b :
ans = -1
else :
ans = b
elif b < a :
if bPlus <= a :
ans = -1
else :
ans = a
# print(a,b)
# pr... | Aasthaengg/IBMdataset | Python_codes/p02755/s064721734.py | s064721734.py | py | 358 | python | fr | code | 0 | github-code | 90 |
13622036090 | """Exploratory data analysis of terpenes."""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
from matplotlib.axes import Axes
from matplotlib.patches import ConnectionPatch
import seaborn as sns
from dataclasses import dataclass
from napr.plotting import l... | smortezah/napr | napr/apps/coconut/terpene/explore.py | explore.py | py | 19,013 | python | en | code | 8 | github-code | 90 |
18522210029 | import numpy as np
D, N = map(int, input().split())
def cnt(n):
tmp = 0
n = n*1.0
while n.is_integer():
if (n/100.0).is_integer():
tmp += 1
n = n / 100.0
else:
break
return tmp
coef = 100**D
whole = np.array([i*coef for i in range(1, 150... | Aasthaengg/IBMdataset | Python_codes/p03324/s467423258.py | s467423258.py | py | 404 | python | en | code | 0 | github-code | 90 |
28429278120 | import typing
from core.tasks.producer import AsyncTaskProducer, SyncTaskProducer
class TaskManager:
def __init__(self, broker_url: str,
tasks_config: typing.Dict[str, typing.Dict]):
self.broker_url = broker_url
self.tasks_config = tasks_config
def sync_task(self, task_type... | omusaev/boggle | src/backend/core/tasks/manager.py | manager.py | py | 1,580 | python | en | code | 0 | github-code | 90 |
18558083869 | A,B=map(int,input().split())
count=0
for C in range(A,B+1):
s=str(C)
res=True
for i in range(len(s)//2):
if s[i]!=s[-1-i]:
res=False
break
if res:
count+=1
print(count)
| Aasthaengg/IBMdataset | Python_codes/p03416/s956855896.py | s956855896.py | py | 227 | python | en | code | 0 | github-code | 90 |
31059611308 | #!/usr/bin/env python
"""
https://cryptopals.com/sets/4
Detect single-character XOR
One of the 60-character strings in this file has been encrypted by single-character XOR.
Find it.
(Your code from #3 should help.)
"""
from shared import hex_bytes_xor
from eng_freq import frequency_score
def get_data(filename):
... | mreishus/cryptopals | set1/c4.py | c4.py | py | 1,371 | python | en | code | 0 | github-code | 90 |
31381830344 | import urllib.error
import requests
from time import sleep
def down(url):
ftype = url.split(".")
try:
pic = requests.get(url, timeout=10)
except requests.exceptions.ConnectionError:
print("404")
fp = open('E:/z_user_Image/' + str(i) + "." + ftype[2], 'wb')
fp.write(pic.content)
... | xahiddin/MyPython | PaChong/json.py | json.py | py | 748 | python | en | code | 0 | github-code | 90 |
7311758611 | #!/usr/bin/env python3
# encoding: utf-8
# @author: hoojo
# @email: hoojo_@126.com
# @github: https://github.com/hooj0
# @create date: 2020-10-16
# @copyright by hoojo@2018
# @changelog python3 `asyncio advanced -> signal` example
# ===========================================================================... | hooj0/python-examples | 29_examples_asyncio_advanced/asyncio_advanced_stretch_signal.py | asyncio_advanced_stretch_signal.py | py | 2,332 | python | en | code | 0 | github-code | 90 |
19848901810 | #!/usr/bin/python3
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome()
driver.get('https://cpay.hypayde.com/t_q_code?id=T10251812171057414120')
sleep(2)
driver.get_screenshot_as_file("D:/aaac.png") # 截图存放路径,使用jpg报错png格式可以
sleep(3)
driver.quit() | Tinywan/automated-test | pay/alipay_qrocde.py | alipay_qrocde.py | py | 306 | python | en | code | 3 | github-code | 90 |
28370466728 | # -*- coding: utf-8 -*-
import csv
import os
import re
import json
import logging
import sys
OUTPUT_FOLDER = os.path.join(os.getcwd(), "out")
OUTPUT_CSV_FILE = os.path.join(OUTPUT_FOLDER, "projects_2w.csv") # Path to the CSV file generated as output
OUTPUT_CSV_FILE_CLEAN = os.path.join(OUTPUT_FOLDER, "projects_2w_cl... | zhangmx/reptile | python-request/clean_data.py | clean_data.py | py | 3,919 | python | en | code | 0 | github-code | 90 |
22565379407 | import os
import shutil
import sys
THIS_FILE_PATH: str = os.path.split(os.path.abspath(__file__))[0]
REPO_ROOT_PATH: str = os.path.join(THIS_FILE_PATH, '../..')
SRC_ROOT_PATH: str = os.path.join(REPO_ROOT_PATH, 'src')
TEST_RESOURCES_PATH: str = os.path.join(REPO_ROOT_PATH, 'test', 'resources')
sys.path.append(SRC_ROO... | cwcowell/haircuts-and-oatmeal | test/features/environment.py | environment.py | py | 580 | python | en | code | 0 | github-code | 90 |
3392955924 | from datetime import datetime
from typing import List
import hydra
import numpy as np
import optuna
import torch
from omegaconf import DictConfig
from torch.utils.tensorboard import SummaryWriter
from grid_world.PrioritizedReplay import PrioritizedReplay
from grid_world.gw_pg import GWPgModel
from gym_grid_world.envs... | Akhilez/reward_lab | archives/grid_world/q_learning/gw_q.py | gw_q.py | py | 6,496 | python | en | code | 2 | github-code | 90 |
32400675915 | from typing import Any, Dict, Generic, List, Optional, Type, TypeVar, Union
from fastapi import HTTPException, status
from pydantic import BaseModel
from fastapi.encoders import jsonable_encoder
from sqlalchemy import select, and_, or_
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncS... | lucaslucyk/fastapi-sql-base | src/crud/base.py | base.py | py | 7,324 | python | en | code | 0 | github-code | 90 |
37178871724 | import logging
import boto3
from botocore.exceptions import ClientError
def list_objects_v2():
s3_client = boto3.client('s3')
response = s3_client.list_objects_v2(
Bucket ='dub123'
)
print(response)
def main():
import argparse
parser = argparse.ArgumentParser()
... | Nessa-Kenny/classbackup | S3 stuff/S3_Examples/ListObjects_Detailed.py | ListObjects_Detailed.py | py | 881 | python | en | code | 0 | github-code | 90 |
40040356468 | import os
import sys
import xarray as xr
import numpy as np
import s3fs
import caterva as cat
def open_zarr(year, month, datestart, dateend):
fs = s3fs.S3FileSystem(anon=True)
datestring = "era5-pds/zarr/{year}/{month:02d}/data/".format(year=year, month=month)
s3map = s3fs.S3Map(datestring + "air_pressure... | oscargm98/HDF5-Blosc2-bench | data/fetch_data_air.py | fetch_data_air.py | py | 2,368 | python | en | code | 2 | github-code | 90 |
38629053343 | #!/usr/bin/env python3
"""Compute flow-related values in vector map columns.
Note that this computation is only partial.
Slope is computed in the spatial part.
"""
#%module
#% description: Computes isochrones from collection point in a sewershed
#% keyword: raster
#% keyword: cost surface
#% keyword: time
#% keyword... | ncsu-geoforall-lab/geospatial-nc-wwpatrn | travel_time_flow_columns.py | travel_time_flow_columns.py | py | 2,412 | python | en | code | 0 | github-code | 90 |
23355074788 | import dataselect
import constants as const
# You have to configure this manually to use getweekday/isweekend/nextfewweeks.
firstsaturday = 1
# each group is a tuple (startindex, endindex, data, index, conditionData)
# minDay is the day to start searching from.
def groupUp(data, dataList, minDay = 0):
groups = sp... | Ohohcakester/Charting | grouping.py | grouping.py | py | 6,922 | python | en | code | 0 | github-code | 90 |
22043928355 | import numpy as np
import pandas as pd
from sklearn.impute import SimpleImputer
# Rastgele bir veri seti oluşturuyoruz. Burada bazı değerler eksik (NaN).
veriler = pd.DataFrame({
'yas': [25, np.nan, 30, 35, 40],
'gelir': [50000, 60000, np.nan, 80000, 90000],
'cinsiyet': ['E', 'K', np.nan, 'E', 'K']
})
pri... | erdogancayir/42Piscine-PythonforDataScience | simple_imputer.py | simple_imputer.py | py | 2,617 | python | tr | code | 2 | github-code | 90 |
29737204615 | from os import path
from codecs import open
from setuptools import setup
from .docusaurus_builder import DocusaurusBuilder
here = path.abspath(path.dirname(__file__))
# use README.md to set a long description for the extension
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.re... | massimo1220/objectiv-analytics-main | bach/docs/source/_ext/sphinx_docusaurus_builder/__init__.py | __init__.py | py | 1,363 | python | en | code | 5 | github-code | 90 |
16775412721 | import matplotlib.pyplot as plt
import pandas as pd
import pylab as pl
import numpy as np
from sklearn import linear_model
from sklearn.metrics import r2_score
df = pd.read_csv("FuelConsumptionCo2.csv")
# take a look at the dataset
df.head()
# summarize the data
df.describe()
#Daha fazlasını keşfetme... | oguznrl/MakinaOgrenmesi-MachineLearning | co2salinim.py | co2salinim.py | py | 2,058 | python | tr | code | 0 | github-code | 90 |
19826402727 | #!/usr/bin/env python
#encoding=utf-8
"""
这是一个小强驱动包的假节点。这个节点发布以下几个topic
/xqserial_server/Odom
/xqserial_server/StatusFlag
/xqserial_server/Pose2D
/xqserial_server/Power
位置数据全部为0, 电压数据12V
同时发布odom -> baselink 的 静态tf变换
"""
import rospy
from std_msgs.msg import Int32, Float64
from nav_msgs.msg import Odometry
from geome... | ahuer2435/ros_projects | catkin_ws/src/xqserial_server/src/xqserial_server/fake_node.py | fake_node.py | py | 1,559 | python | en | code | 2 | github-code | 90 |
8007199004 | ### save_hyps.py is a utility python script that is called in the training
### shell script to save the hyperparameters being used in training.
## Not intended to be called on its own, it will be called by a different
## script.
# USAGE: python ./save_hyps.py [DATASET NAME] [DATASET SIZE] [EPOCHS] [HYP]
# Imports
i... | Razzberry7/Yolov5_Scripts | bin/save_hyps.py | save_hyps.py | py | 1,346 | python | en | code | 0 | github-code | 90 |
29571887906 | # Parts of this code were adapted from the pytorch example at
# https://github.com/pytorch/examples/blob/master/reinforcement_learning/actor_critic.py
# which is licensed under the license found in LICENSE.
import os
import random
from collections import namedtuple
# pytype: disable=import-error
import gym
import num... | Surya-77/rl-snn-norse | actor_critic.py | actor_critic.py | py | 8,221 | python | en | code | 0 | github-code | 90 |
23222078413 | import matplotlib.pyplot as plt
import numpy as np
import random
def loadDataSet(fileName):
dataMat = []
labelMat = []
fr = open(fileName)
for line in fr.readlines():
lineArr = line.strip().split('\t')
dataMat.append([float(lineArr[0]), float(lineArr[1])])
labelMat.append(... | Anosy/ML_python | SVM/svmMLiA.py | svmMLiA.py | py | 6,954 | python | en | code | 0 | github-code | 90 |
37363026519 | from datetime import datetime, timedelta
from random import randrange
from task_3_string import capitalize_first_words
from task_10_ODBC import DBConnection
def create_record_lines(class_name, text_to_publish):
return (f'\n{class_name.ljust(40, "-")}\n'
f'{text_to_publish}\n'
f'-----------... | Pheniks7/python_dqe | task_5_classes_wo_init.py | task_5_classes_wo_init.py | py | 3,033 | python | en | code | 0 | github-code | 90 |
21840766032 | from flask import Flask, jsonify, request, redirect
import sqlite3 as sqlitedb
import os
import logging
import random
from hashlib import sha256
from datetime import datetime
logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s',
level=logging.DEBUG)
class DB:
def __init__(sel... | shakeelansari63/random_programs | url_shortner.py | url_shortner.py | py | 3,632 | python | en | code | 0 | github-code | 90 |
22996051251 | import pymongo
client = pymongo.MongoClient(host='localhost', port=27017)
#client = pymongo.MongoClient('mongodb://localhost:27017/')
db = client.test
collection = db.students
results = collection.find().sort('name', pymongo.ASCENDING).skip(1).limit(1)
#skip(1)略过第一个元素,limit(1)取一个元素
print([result['name'] for result in... | kurkol/python3_spider | 存储/MongoDB/skip.py | skip.py | py | 622 | python | en | code | 0 | github-code | 90 |
10068282465 | from tornado import web, gen, ioloop, escape
import pandas as pd
import io
import os
import numpy as np
import settingmain
import uuid
import zipfile
from common import ProteinCollection, analyze2
class BaseHandler(web.RequestHandler):
def set_default_headers(self):
self.set_header("Access-Control-Allow-... | bschulzlab/glypnir | main.web-glycoform.py | main.web-glycoform.py | py | 6,209 | python | en | code | 0 | github-code | 90 |
15689239065 | import torch
from torch import nn, Tensor
import torch.nn.functional as F
class probs(nn.Module):
def __init__(self, latent_dim, categorical_dim):
super(probs, self).__init__()
self.latent_dim = latent_dim
self.categorical_dim = categorical_dim
def reparameterize(self, mu, ... | ritwikbera/PODNet | helpers/probs.py | probs.py | py | 1,026 | python | en | code | 3 | github-code | 90 |
5672055818 | from w2base import *
class W2(W2Base):
def __init__(self,
W2BaseDirDat=None,
):
self.W2BaseDirDat=W2BaseDirDat
self.initW2LocalVars()
self.initW2GlobalVars()
self.initW2VarsSwitches()
self.initW2VarsModule()
self.initW2VarsEnv()
... | tenkiman/wxmap2 | prc/lib/python/w2local.py | w2local.py | py | 411 | python | en | code | 0 | github-code | 90 |
74340490857 | import numpy as np
def make_boxes(cords, box_size=8):
Cx = np.arange(cords[0], cords[3]+1, box_size)
Cy = np.arange(cords[0], cords[3]+1, box_size)
Cz = np.arange(cords[0], cords[3]+1, box_size)
itv = box_size -1
boxes = []
for x in Cx:
for y in Cy:
for z in Cz:
box = [x,y,z,x+itv,y+itv,z+itv]
boxes... | cjoana/GREx | create_data/SFwEM/write_params_1SF_minimal.py | write_params_1SF_minimal.py | py | 7,410 | python | en | code | 1 | github-code | 90 |
18358241079 | import sys
N, M, P = map(int, input().split())
Edge = []
G = [[] for i in range(N)]
G_rev = [[] for i in range(N)]
for i in range(M):
a, b, c = map(int, sys.stdin.readline().split())
a, b = a - 1, b - 1
c = -(c - P)
Edge.append([a, b, c])
G[a].append(b)
G_rev[b].append(a)
# 0とNの両方から辿れない頂点を削除
d... | Aasthaengg/IBMdataset | Python_codes/p02949/s304875885.py | s304875885.py | py | 1,258 | python | en | code | 0 | github-code | 90 |
16646007574 | magicnumber = 28
# this is a single line comment
'''
this is for multi line comments
'''
for x in range(101):
if x == magicnumber:
print(x, " is the magic number!!")
break
else:
print(x)
# to check divisibility by 4
for y in range(magicnumber + 1):
if (y % 4 == 0):
print(... | kusuma-bharath/Python | ex_break_continue.py | ex_break_continue.py | py | 398 | python | en | code | 0 | github-code | 90 |
31078683336 | #!/usr/bin/python
from __future__ import print_function
import cv2 as cv
import numpy as np
import sys
import os
if __name__ == '__main__':
fn = "board.jpg"
image = cv.imread(fn, 0)
a = 90
b = 120
for j in range(6):
y = b + (j * 60 + j)
for i in range(7):
x = a + (i * 71 - i)
if i > 5:
x = x - 2 *... | Sinscerly/ProjectRobo-4onarow | VisionCode/parts/gray.py | gray.py | py | 533 | python | en | code | 1 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.