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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18705309300 | from time import sleep
import csv
import requests
from lxml import etree
from datetime import datetime
import pytz
urls = ['https://www.eclatparis.com/produits',
'https://www.eclatparis.com/produits?offset=200',
'https://www.eclatparis.com/produits?offset=400',
'https://www.eclatparis.com/p... | qingyi-er-san/aprizo_codes | eclat数据爬取/eclat_云端版.py | eclat_云端版.py | py | 3,460 | python | en | code | 0 | github-code | 6 |
27143309324 | #!/usr/bin/env python3
from PIL import Image
import os
path = os.getenv('HOME') + '/supplier-data/images/'
for file in os.listdir(path):
if (file.endswith('.tiff')):
shortFileName = file.rstrip('.tiff')
with Image.open(path + file) as im:
im.resize((600, 400)).convert('RGB').save(pat... | Mark-C-Hall/Google-IT-Automate-Final | changeImage.py | changeImage.py | py | 357 | python | en | code | 0 | github-code | 6 |
3848261767 | #!/bin/python3
import sys
def staircase(n):
for x in range(1, n + 1):
if x < n:
remain = n - x
print(remain * " " + x * "#")
else:
print(x * "#")
if __name__ == "__main__":
n = int(input().strip())
staircase(n)
| pedroinc/hackerhank | staircase.py | staircase.py | py | 280 | python | en | code | 0 | github-code | 6 |
35145658447 | import pytest
from .task import in_component
class Case:
def __init__(self, name: str, n: list, vertices: list, edges: list,
answer: bool):
self._name = name
self.n = n
self.vertices = vertices
self.edges = edges
self.answer = answer
def __str__(self)... | renesat/Base-Graph-Contest | tasks/task4/test_public.py | test_public.py | py | 1,283 | python | en | code | 0 | github-code | 6 |
18483249694 | import pygame
import random
import sys
from pygame.locals import *
from config import (
FPS,
MODIFIER,
WIDTH,
HEIGHT,
LINETHICKNESS,
PADDLESIZE,
PADDLEOFFSET,
BLACK,
GREY,
ORIGIN_X,
ORIGIN_Y,
DIFFICULTY,
MAX_SCORE
)
def drawArena():
DISPLAYSURF.fill((0, 0, 0))
... | samuele-mattiuzzo/pongame | pongame.py | pongame.py | py | 6,281 | python | en | code | 0 | github-code | 6 |
13770141152 | import time
def convert_file(input_file_name, output_file_name, show_xml = False):
input_file = open(input_file_name + ".json", 'r', encoding='utf-8')
output_file = open(output_file_name + ".xml", 'w', encoding='utf-8')
xml = file_to_xml(input_file)
output_file.write(xml)
input_file.close()
ou... | Mekek/informatics_lab4 | main_task.py | main_task.py | py | 1,725 | python | en | code | 0 | github-code | 6 |
72453926907 | # -*- coding: utf-8 -*-
import pymysql
from pymongo import MongoClient
class MiddleTable(object):
def __init__(self):
self.mysql_host = "192.168.10.121"
self.mysql_user = 'hzyg'
self.mysql_password = '@hzyq20180426..'
self.MONGO_HOST = '127.0.0.1'
self.MONGO_PORT = 27017
... | cyndi088/MiddleTables | mongo_to_mysql.py | mongo_to_mysql.py | py | 3,882 | python | en | code | 0 | github-code | 6 |
1073007549 | import traceback
from selenium.webdriver.common.by import By
from traceback import print_stack
import utilities.logger as log
import logging
class SeleniumDriver():
log = log.myLogger(logging.DEBUG)
def __init__(self, driver):
self.driver = driver
def getByType(self, locatorType):
locato... | rchroy/SamsungPhoneTest | base/my_selenium_driver.py | my_selenium_driver.py | py | 3,365 | python | en | code | 0 | github-code | 6 |
38255085940 | from django.shortcuts import reverse
from django.views.generic import TemplateView
from django.utils import timezone
from hknweb.utils import (
method_login_and_permission,
get_semester_bounds,
)
from hknweb.events.constants import ATTR
from hknweb.events.models import Event, EventType
from hknweb.events.utils... | Gabe-Mitnick/hknweb | hknweb/events/views/aggregate_displays/tabular.py | tabular.py | py | 2,679 | python | en | code | null | github-code | 6 |
43627131674 | import heapq
import collections
class Solution:
def assignBikes(self, workers, bikes):
dist_map = collections.defaultdict(list)
m, n = len(workers), len(bikes)
for i in range(m):
for j in range(n):
w = workers[i]
b = bikes[j]
dis... | MichaelTQ/LeetcodePythonProject | solutions/leetcode_1051_1100/LeetCode1057_CampusBikes.py | LeetCode1057_CampusBikes.py | py | 986 | python | en | code | 0 | github-code | 6 |
71477785468 | import sys
sys.stdin = open('input.txt')
'''
#1 5
#2 8
#3 9
'''
# dp로 풀면 안됨 ;;
T = int(input())
for tc in range(1, T+1):
N = int(input())
# print(tc)
# data = [[1000]*(N+1)]+ [[1000]+list(map(int, input().split())) for _ in range(N)]
data = [list(map(int, input().split())) for _ in range(N)]
new_da... | YOONJAHYUN/Python | SWEA/5250_최소비용/sol.py | sol.py | py | 1,170 | python | en | code | 2 | github-code | 6 |
22837988470 | import pandas as pd
import networkx as nx
import pickle
import ast
def save_obj(obj, name ):
with open(name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
def load_obj(name ):
with open(name + '.pkl', 'rb') as f:
return pickle.load(f)
df1 = pd.read_csv('../reading_and_cle... | brooksjaredc/podcast_network_analysis | analyzing_functions/set_top_podcast.py | set_top_podcast.py | py | 2,778 | python | en | code | 1 | github-code | 6 |
17541475306 | #https://www.hackerrank.com/challenges/incorrect-regex/problem
#Solution
# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
T= int(input())
for i in range(T):
S=input()
try:
res = re.compile(S)
print("True")
except Exception:
prin... | AbdullaElshourbagy/Hacker-Rank-Solutions | Python/09 - Errors and Exceptions/02_Incorrect_Regex.py | 02_Incorrect_Regex.py | py | 330 | python | en | code | 0 | github-code | 6 |
21154911963 | from layers.layer import Layer
import os
import hashlib
import csv
class FileOnlineOutputLayer(Layer):
def __init__(self, log_messages, results: dict, filename: str, templates: list, message_headers: list):
self.log_messages = log_messages
self.filename = filename
self.results = results
... | kashanahmed867/ADAL-NN | log_parser/online_logparser/layers/fileonline_output_layer.py | fileonline_output_layer.py | py | 1,784 | python | en | code | 0 | github-code | 6 |
70488684987 | # accepted on coderun
def cards_lost(): # 36.6
n, linears, squares, cubes = get_pars()
# pre-calculations:
whole_linears = (n * (n + 1)) // 2
whole_squares = (n * (n + 1) * (2 * n + 1)) // 6
whole_cubes = ((n * (n + 1)) // 2) ** 2
# constants:
a = whole_linears - linears
b = whole_squ... | LocusLontrime/Python | Yandex_fast_recruit_days/Medium/Maps.py | Maps.py | py | 1,582 | python | en | code | 1 | github-code | 6 |
4311447480 | from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras import backend as K
import numpy as np
###################################
#### Constants #################... | psrikanthm/satellite-image-classification | src/simple_arch.py | simple_arch.py | py | 2,151 | python | en | code | 1 | github-code | 6 |
3715152381 | """
A simple event-sourced user service
"""
import datetime
import functools
import logging
import typing
import aiohttp.web
import faust
import strawberry
import strawberry.asgi.http
import strawberry.asgi.utils
import strawberry.graphql
import strawberry.types.datetime
from faust_avro import App, Record
class Us... | trauter/faust-avro | examples/event_sourced_user.py | event_sourced_user.py | py | 9,993 | python | en | code | 0 | github-code | 6 |
74416691389 | # Ten program pokazuje przykład użycia funkcji range_sum().
def main():
# Utworzenie listy liczb.
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
# Zsumowanie elementów
# o indeksach od 2 do 5.
my_sum = range_sum(numbers, 2, 5)
# Wyświetlenie obliczonej sumy.
print('Suma elementów o indeksach od 2 ... | JeanneBM/Python | Owoce Programowania/R12/04. Recursive3.py | 04. Recursive3.py | py | 747 | python | pl | code | 0 | github-code | 6 |
40126048193 | from openeye import oechem
import pickle
import os
#ifs = oechem.oemolistream(oechem.OEFormat_SDF)
#ofs = oechem.oemolostream(oechem.OEFormat_PDB)
DRUG_DIR = 'Drugs/Lib'
DRUG_DB_OUT = 'Drugs/DB/DB.oeb.gz'
DRUG_TITLE_FILE = 'drug_titles.pickle'
MAX_TAUTOMERS = 100
def count_molecules():
ifs = oechem.oemolistream... | AlexandrNP/BindingScoresDRP | openeye_scripts/map_compound_id.py | map_compound_id.py | py | 1,779 | python | en | code | 0 | github-code | 6 |
43865403849 | from .flags import JobListFlags, JobOutputFlags
from .format_options import format_job_options
from .job_utils import (
create_job,
create_job_link,
create_job_output_item,
get_job,
submit_job_app,
update_job,
)
__all__ = [
"create_job",
"update_job",
"submit_job_app",
"format_j... | No767/Kumiko | Bot/Libs/cog_utils/jobs/__init__.py | __init__.py | py | 445 | python | en | code | 20 | github-code | 6 |
72742543867 | # -*- coding: utf-8 -*-
# @Author : yxn
# @Date : 2022/1/25 11:26
# @IDE : PyCharm(2021.3.1) Python3.98
from pythonds.basic.stack import Stack
def matches(open, close):
opens = "([{"
closer = ")]}"
return opens.index(open) == closer.index(close)
def parCheck(brackets):
s = Stack() ... | yxn4065/Data-structure-and-algorithm-Python- | 04_栈的应用1括号匹配.py | 04_栈的应用1括号匹配.py | py | 1,139 | python | en | code | 0 | github-code | 6 |
19026984837 | from django.shortcuts import render,redirect
import json
from django.conf import settings
import redis
from rest_framework.response import Response
from django.http import HttpResponse
from django.http import JsonResponse
import requests
from .forms import SomeForm
from django.views.decorators.csrf import csrf... | nischithmk/freshworks_assignment | app1/views.py | views.py | py | 2,317 | python | en | code | 0 | github-code | 6 |
1068937513 | import numpy as np
import gymnasium as gym
from pendulum_model import PendulumModel
import cvxpy as cp
dt3g2l = 3 * 10 / (2 * 1) * 0.05
dt = 0.05
dt3ml2 = 3 * 0.05 / (1 * 1 * 1)
class CVX_SQP:
def __init__(self):
self.N = 30
self.theta_cost_weight = 1
self.theta_dot_cost_weight = 0.1
... | CarlDegio/SQP_Pendulum | cvx_main.py | cvx_main.py | py | 4,654 | python | en | code | 0 | github-code | 6 |
16987276200 | import socket
import sys
host = ''
port = 9999
# Create a socket conect computers
def create_socket():
try:
global host, port, s
s = socket.socket()
except socket.error as e:
print("Socket creation error: " + str(e))
# Binding the socket and listening for connections
# create socket... | Pr3d2t0r/reverseShell | server.py | server.py | py | 1,363 | python | en | code | 0 | github-code | 6 |
38238085136 | import csv
from PIL import Image
import numpy as np
import os
X = []
index = 0
for img in os.listdir("base224/"):
if img[-3:] == "jpg":
image = Image.open("base224/" + img)
img2 = image.transpose(Image.FLIP_LEFT_RIGHT)
img2.save("base224flip/" + img, "JPEG", quality=224, optimize=True, prog... | PKUGoodSpeed/FashionAiContest | Kedan/flip_images.py | flip_images.py | py | 395 | python | en | code | 3 | github-code | 6 |
70865858108 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 18 21:54:40 2019
@author: dingxu
"""
from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
from photutils import DAOStarFinder
from astropy.stats import sigma_clipped_stats
from photutils import CircularAperture
import cv2
#import scipy.signal as... | dingxu6207/newcode | newB4SIFT.py | newB4SIFT.py | py | 4,808 | python | en | code | 0 | github-code | 6 |
24739538824 | #!/bin/python
import smtplib, os, sys
def printBanner():
print("*" * 50)
print("* %s " % "Welcome to the SMTP Vrfy enum script.")
print("* python %s %s " % (sys.argv[0], "to start execution."))
print("*" * 50)
def getUserInput(msg="Default message: "):
return raw_input(msg).strip()
def pullFileList(file_pa... | idleninja/smtp_vrfy_enum.py | smtp_vrfy_enum.py | smtp_vrfy_enum.py | py | 1,358 | python | en | code | 0 | github-code | 6 |
14536874544 | # Callbacks
from dash import Input, Output, State
from dash.exceptions import PreventUpdate
def sidebar_callbacks(app, df):
@app.callback(
[
Output("brand_dropdwn", 'options'),
Output("brand_dropdwn", 'value')
],
[
State("date_picker", "start_date"),
... | jmalcovich21/ds4a_tiendareg | callbks/sidebar_calls.py | sidebar_calls.py | py | 1,794 | python | en | code | 0 | github-code | 6 |
74883090107 | N, M = map(int, input().split())
n_switches = []
switches = []
for i in range(M):
ipt = list(map(int, input().split()))
n_switches.append(int(ipt[0]))
switches.append(ipt[1:])
p = list(map(int, input().split()))
ans = 0
# print(n_switches)
# print(switches)
# print(p)
# ランプの光り方のパターンだけ
for i in range(2... | kazuo-mu/at_coder_answers | ABC128/c_switches.py | c_switches.py | py | 954 | python | ja | code | 0 | github-code | 6 |
41978223591 | from pyspark.sql.types import StructType, StructField, StringType, DateType, FloatType
from pyspark.sql import SparkSession
from datetime import datetime
from task_4 import get_min_or_max_by_ppu
import pytest
# create a spark session
spark = SparkSession.builder.appName("task_0").getOrCreate()
# create a... | rkrvchnk/pyspark_tasks | tests/test_task_4.py | test_task_4.py | py | 1,784 | python | en | code | 0 | github-code | 6 |
37430808138 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
name: TRS wcm 6.x版本infoview信息泄露
referer: http://www.wooyun.org/bugs/wooyun-2012-012957
author: Lucifer
description: 文件infoview.do中导致信息泄露。
'''
import sys
import requests
class trs_wcm_infoview_disclosure_BaseVerify:
def __init__(self, url):
self.url = url
... | iceyhexman/onlinetools | scanner/plugins/cms/trs/trs_wcm_infoview_disclosure.py | trs_wcm_infoview_disclosure.py | py | 1,115 | python | en | code | 1,626 | github-code | 6 |
74288480507 | from django.urls import include, path
from rest_framework.routers import DefaultRouter
from seeds.api.views import AudioClipViewSet, BlobViewSet, SuiteViewSet, UserViewSet
from seeds.views import index, register
router = DefaultRouter()
router.register(r"users", UserViewSet, basename="User")
router.register(r"suites"... | jacobshandling/soundseeker | backend/seeds/urls.py | urls.py | py | 697 | python | en | code | 0 | github-code | 6 |
8293013280 | import cv2
import math
path = "img/angle.jpg"
img = cv2.imread(path)
pointsList = []
def mousePoints(event, x, y, flags, params):
if event == cv2.EVENT_LBUTTONDOWN:
size = len(pointsList)
if size != 0 and size % 3 != 0:
cv2.line(img, tuple(pointsList[round((size-1)/3)*3]), (x,y), (0,0,... | Demohack2022/hacktoberfest2022 | Contributors/angle-finder.py | angle-finder.py | py | 1,095 | python | en | code | 8 | github-code | 6 |
29564634745 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
from api.thanos_http import xtthanos_user_http, request_data
from api.http_api import ResultBase
from common.logger import logger
from common.get_signature import generate_auth_info
def adjust_leverage(leverage,positionSide,symbol):
'''调整杠杆倍数'''
result = ResultBase(... | shiqilouyang/thanos_test | operation/contract/client/position/adjust_leverage.py | adjust_leverage.py | py | 1,084 | python | en | code | 0 | github-code | 6 |
35571671171 | import urllib.request as urllib2 #import the library used to query a website
from bs4 import BeautifulSoup #import the Beautiful soup functions to parse the data returned from the website
import pandas as pd #import pandas to convert list to data frame
from openpyxl import load_workbook
# INPUT VARIABLES SPECIFIED BY... | rich-coleman-gh/Html_scraping_project | main.py | main.py | py | 4,466 | python | en | code | 0 | github-code | 6 |
13083798365 | # -*- coding: utf-8 -*-
import re
from setuptools import setup
version = re.search(
'^__version__\s*=\s*"(.*)"',
open('pushscreeps/pushscreeps.py').read(),
re.M
).group(1)
with open("README.rst", "rb") as f:
long_description = f.read().decode("utf-8")
setup(
name="pushscreeps",
packages... | mboehn/pushscreeps | setup.py | setup.py | py | 744 | python | en | code | 0 | github-code | 6 |
25032770232 | #pip install dash dash-renderer dash-html-components dash-core-components plotly
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1("Consumo dos clientes"), #separando elementos dos childs por virgula
dcc.Dropdown(
... | grupoflux/dashboard | dashboard.py | dashboard.py | py | 1,527 | python | en | code | 0 | github-code | 6 |
24354798885 | import os
import torch
import gym
import gym_donkeycar
import time
from env.vae_env import VaeEnv
from vae.vae import VAE
from stable_baselines.sac.policies import MlpPolicy
from stable_baselines import SAC
VARIANTS_SIZE = 32
DONKEY_SIM_PATH = f"/Applications/donkey_sim.app/Contents/MacOS/sdsim"
SIM_HOST="127.0.0.1"... | masato-ka/sac-car-racing | run_donkey.py | run_donkey.py | py | 1,406 | python | en | code | 0 | github-code | 6 |
35813238442 | import typing
from typing import Optional
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine, async_sessionmaker
from sqlalchemy.orm import declarative_base
from backend.services.database import db
if typing.TYPE_CHECKING:
pass
class Database:
def __init__(self, url: str):
... | jendox/tg_bot | backend/services/database/database/base.py | base.py | py | 883 | python | en | code | 0 | github-code | 6 |
34653033371 | import math, os
from dataclasses import dataclass
import pygame
from const import *
@dataclass
class Position:
sector: int
layer: int
index: int
x: float
y: float
def __init__(self, sector, layer, index):
self.sector = sector
self.layer = layer
self.index = index
... | martin-hanekom/persian-silver-2 | src_old/tools.py | tools.py | py | 1,951 | python | en | code | 0 | github-code | 6 |
38890746457 | import dialogflow_v2 as dialogflow
import os
path_key = "C:\wilasinee_pj\pj\python\ggthaluangbot-a6aed6caf27a.json"
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = path_key
#*****************************************************************
project_id = "thaluangbot-lhrv"
session_id = "82d12b78-40b4-4028-a8f7-3a6a479c... | wilasineePE/chatbot | index.py | index.py | py | 1,363 | python | en | code | 0 | github-code | 6 |
41265462253 | import pandas as pd
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
#datamızı okuduk
df = pd.read_csv("C:\projects\intropattern\otu.csv")
#verinin tranzpozasını alarak left ve rightları column hale getirdik.
df=df.T
X = df.... | Haticenurcoskunn/Introduction-to-pattern-term-project | binary_classficiton/boosting_algorithms.py | boosting_algorithms.py | py | 970 | python | tr | code | 0 | github-code | 6 |
38882380606 | from django.db import models
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFill
class ImageList(models.Model):
def __str__(self):
return self.file_name
file_path = models.CharField(
verbose_name='ファイルパス',
max_length=1000,
blank=False,
... | hogendan/SuzuImage | imagelist/models.py | models.py | py | 1,294 | python | ja | code | 0 | github-code | 6 |
20843364345 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import CosineAnnealingLR
from torch.utils.data import DataLoader
from torch.utils.data.sampler import WeightedRandomSampler
import math
from network import Network
from losses import WalkerVisitLosses
from input_pipeline impor... | TropComplique/associative-domain-adaptation | train.py | train.py | py | 4,289 | python | en | code | 7 | github-code | 6 |
5707554791 | '''
activation_key module
'''
from dataclasses import dataclass
from sqlalchemy import Integer, Column, String, ForeignKey
from databases.models.user import User
from config.db import db
@dataclass
class ActivationKey(db.Model): # pylint: disable=too-few-public-methods
'''
activation_key model class... | Dolzhenkov-Andrii/api | databases/models/activation_key.py | activation_key.py | py | 681 | python | en | code | 0 | github-code | 6 |
12569604796 | from rest_framework import permissions
from rest_framework.permissions import BasePermission
# this class will findout if the user has permission to delete or update the post , to check if logged in user and post owner is same or not
class IsOwnerOrReadOnly(BasePermission):
message = "you must be the owner of th... | Maniabhishek/ContentManagementSystem | appcms/api/permissions.py | permissions.py | py | 639 | python | en | code | 0 | github-code | 6 |
30323378836 | #
#
#
import openpyxl
import datetime
import pandas as pd
from Syne_TestReportMapping import EmpId_Name_Mapping
def Emp_Syne_Client_Mapping(inputFormat,empID):
Emp_Syne_Client_Mapping={}
Emp_Syne_Client_Mapping[empID]=EmpID_Mapping(inputFormat,int(empID))
return Emp_Syne_Client_Mapping
def EmpID_Mappin... | Aditi9109/TimeSheet | Emp_Syne_ClientMapping.py | Emp_Syne_ClientMapping.py | py | 1,013 | python | en | code | 0 | github-code | 6 |
11779793970 | import os
from scripts.util import read_supertopics, SuperTopic, get_spottopics, DateFormat, read_temp_dist, smooth
import numpy as np
from plotly.subplots import make_subplots
import plotly.graph_objects as go
BOOST = ['raw', # 0
'retweets', # 1
'replies', # 2
'likes', # 3
'r... | TimRepke/twitter-climate | code/figures/supertopics/stacked_area_charts_interactive_separate.py | stacked_area_charts_interactive_separate.py | py | 3,987 | python | en | code | 1 | github-code | 6 |
3423610291 | import json
from functools import wraps
from flask import request
from flask.ext.restful import reqparse, Api, Resource
from api_json_example import app
# Database? We don't need no stinkin database
db = {}
api = Api(app)
def accept_json(func):
"""
Decorator which returns a 406 Not Acceptable if the cli... | sjl421/thinkful-python-code-examples | flask/api_json_example/api_json_example/api.py | api.py | py | 2,931 | python | en | code | null | github-code | 6 |
6194000945 | import os
import json
from dotenv import load_dotenv
load_dotenv()
chinput = os.getenv('CHATINPUT')
chinput = '-1001799753250 -1001574745581 -1001322515232 -1001725353361'
channel_input = [int(i) for i in chinput.split(' ')]
choutput = os.getenv('CHATOUTPUT')
choutput = '-1001802541407'
channel_output = [int(i) for i... | Lj6890/Forwarded | config.py | config.py | py | 513 | python | en | code | 0 | github-code | 6 |
37431367661 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 14:32:30 2020
@author: zjerma1
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import Ridge
from sklearn.model_selection import cross_val_score
from mlxtend.evalu... | zjermain/Math-7390-Machine-Learning-Jermain | Homework 2-Bias Variance Decomp.py | Homework 2-Bias Variance Decomp.py | py | 2,428 | python | en | code | 0 | github-code | 6 |
14594650315 | import tensorflow as tf
import pathlib
import os
import cv2
import numpy as np
import tqdm
import argparse
class TFRecordsGAN:
def __init__(self,
image_dir="/volumes2/datasets/horse2zebra/trainA",
tfrecord_path="data.tfrecords",
img_pattern="*.jpgg"):
"""... | AhmedBadar512/Badr_AI_Repo | utils/create_gan_tfrecords.py | create_gan_tfrecords.py | py | 5,294 | python | en | code | 2 | github-code | 6 |
21043710164 | from datetime import datetime, time
from typing import Dict
# getting info from administrator
def getting_payload() -> Dict:
"""
this function takes nothing and return a dictionary of the users answers
:return: id, company_name, departure_time, arrival_time
"""
temp_id = int(input("Enter the new p... | Mohamad-Hachem/Airplane_Booking_System | utils/getting_airplane_information.py | getting_airplane_information.py | py | 1,567 | python | en | code | 0 | github-code | 6 |
21617134732 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: GPS Simulator Playback - 10Msps
# Author: Damien Dusha
# GNU Radio version: 3.8.1.0
from gnuradio import analog
from gnuradio import blocks
import pmt
from gnuradio import gr
from gnuradio.filt... | damiendusha/gnss-sim | gnuradio/gnss_sim_playback_10MHz_nogui.py | gnss_sim_playback_10MHz_nogui.py | py | 3,767 | python | en | code | 3 | github-code | 6 |
24526724853 | import json
from arXivo.models import ArXivoUser
from arXivo.serializers import ArXivoUserSerializer, SearchSerializer
from arXivo.utils import get_tokens_for_user
from django.conf import settings
from django.contrib.auth import authenticate
from django.http.response import JsonResponse
from django.middleware import c... | DebadityaPal/arXivo | backend/arXivo/views.py | views.py | py | 6,438 | python | en | code | 1 | github-code | 6 |
23715644007 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from event.models import Event
# Create your models here.
class Episode(models.Model):
event = models.ForeignKey(
Event,
on_delete=models.CASCADE,
related_name='episode')
session_id = models.... | emilarran/channelshowdown | channelshowdown/livestream/models.py | models.py | py | 396 | python | en | code | 0 | github-code | 6 |
30861890052 | #!/usr/bin/env python
# Given an integer k and a string s, find the length of the longest substring
# that contains at most k distinct characters.
#
# For example, given s = "abcba" and k = 2, the longest substring with k distinct
# characters is "bcb".
def longest_substr(s, k):
chars_met = 0
chars = [0] * 2... | mdolmen/daily_coding_problem | 012-longest-substring/solution.py | solution.py | py | 987 | python | en | code | 0 | github-code | 6 |
35395868914 | from django.db import models
from django.urls import reverse
from phone_field import PhoneField
# Create your models here.
class Department(models.Model):
"""Отдел компании"""
name = models.CharField(max_length=200, verbose_name="Название отдела")
class Meta:
db_table = 'department'
orde... | zarmoose/eastwood_test | employees/models.py | models.py | py | 1,894 | python | en | code | 0 | github-code | 6 |
26214436184 | import random
when = ["a few years ago", "once upon a time", "last night", "a long time ago", "yesterday"]
who = [" rabbit", "squirrel", "turtle", "dog", "cat"]
name = ["Ali", "Stan", "Tanisha", "Sehej", "Ram"]
where = ["India", "Germany", "Italy", "Romania"]
went = ["school", "seminar", "class", "laundry", "res... | sehej3/Random-Story-Generator | randomStoryGenerator.py | randomStoryGenerator.py | py | 613 | python | en | code | 0 | github-code | 6 |
35368433605 | import sys
def priority(item):
p = ord(item) - ord("a") + 1
if p > 0 and p <= 26:
return p
return ord(item) - ord("A") + 27
total = 0
for line in sys.stdin:
rucksack = line.rstrip()
compartment_size = len(rucksack)
seen = set()
for i, item in enumerate(rucksack):
if i < com... | tynovsky/advent-of-code-2022 | 03a.py | 03a.py | py | 523 | python | en | code | 0 | github-code | 6 |
30354483311 | import sys
import vtk
from vtk.util import vtkConstants
try:
from vtk.util import numpy_support
except ImportError:
numpy_support = None
import numpy
# Enthought library imports.
try:
from tvtk.array_ext import set_id_type_array
HAS_ARRAY_EXT = True
except ImportError:
HAS_ARRAY_EXT = False
# Us... | enthought/mayavi | tvtk/array_handler.py | array_handler.py | py | 27,563 | python | en | code | 1,177 | github-code | 6 |
19304565869 |
# -*- coding: utf-8 -*-
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from time import sleep
from selenium.webdriver.chrome.options import Options
import pandas as pd
import requests
"""
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argumen... | satoshi-python/109 | train_sele.py | train_sele.py | py | 2,427 | python | en | code | 0 | github-code | 6 |
33068133857 | import sys
import argparse
import importlib
commands = {
'train': {
'script': 'ocr4all_pixel_classifier.scripts.train',
'main': 'main',
'help': 'Train the neural network. See more via "* train --help"'
},
'predict': {
'script': 'ocr4all_pixel_classifier.scripts.predict',
... | OMMR4all/ommr4all-page-segmentation | ocr4all_pixel_classifier/scripts/main.py | main.py | py | 2,358 | python | en | code | 2 | github-code | 6 |
22905238470 | import tensorflow as tf
import argparse
import sys
sys.path.insert(0, "../CycleGAN-TensorFlow")
import model # nopep8
# Transform image bitstring to float tensor
def preprocess_bitstring_to_float_tensor(input_bytes, image_size):
input_bytes = tf.reshape(input_bytes, [])
# Transform bitstring to uint8 tensor... | tmlabonte/tendies | minimum_working_example/export_graph_for_serving.py | export_graph_for_serving.py | py | 6,953 | python | en | code | 37 | github-code | 6 |
38152844484 | from typing import List
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.chrome.options import Options
class PathsParser:
def __init__(self): # if url changed replace it
caps =... | stolzor/test_task | models/paths_parser.py | paths_parser.py | py | 2,546 | python | en | code | 1 | github-code | 6 |
42123297938 | from collections import namedtuple
import numpy as np
from ...utils.interpolation.levels import ( # noqa
LevelsDefinition as ConversionLevelsDefinition,
)
INPUT_REQUIRED_FIELDS = dict(
export_format=str,
levels_method=(None, str),
levels_number=(None, int),
levels_dzmin=(None, float),
levels... | EUREC4A-UK/lagtraj | lagtraj/forcings/conversion/input_definitions.py | input_definitions.py | py | 2,969 | python | en | code | 8 | github-code | 6 |
35004893553 | # programmers 위클리 챌린지 2주차
def solution(scores):
answer = ''
i_len = len(scores)
temp_arr = [0 for _ in range(i_len)]
for i in range(i_len):
for j in range(i_len):
temp_arr[j] = scores[j][i]
max_val = max(temp_arr)
min_val = min(temp_arr)
max_self, min_self = F... | Inflearn-everyday/study | wookiist/programmers/week2.py | week2.py | py | 1,368 | python | en | code | 5 | github-code | 6 |
27577948701 | from django.urls import path
from .views import (HomePageView, MessageView, UserProfile, delete_message,
spam_message, AddReview, AbouUs, ContactUs, ReviewView, SettingsView, EditProfile)
urlpatterns = [
path('', HomePageView.as_view(), name='home'),
path('profile/', UserProfile.as_view(), ... | Afeez1131/Anonymous-v1 | anonymous/urls.py | urls.py | py | 954 | python | en | code | 0 | github-code | 6 |
1068948273 | import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import minimize
import gymnasium as gym
import imageio
from pendulum_model import PendulumModel
# Constants
g = 10.0 # gravitational acceleration
l = 1.0 # length of the pendulum
m = 1.0 # mass of the pendulum
dt = 0.05 # time step
n = 100... | CarlDegio/SQP_Pendulum | scipy_trust.py | scipy_trust.py | py | 4,069 | python | en | code | 0 | github-code | 6 |
12611003899 | from ..utils import *
##
# Minions
class OG_006:
"""Vilefin Inquisitor"""
play = Summon(CONTROLLER, "OG_006b")
class OG_006b:
"""The Tidal Hand"""
requirements = {PlayReq.REQ_NUM_MINION_SLOTS: 1}
activate = Summon(CONTROLLER, "OG_006a")
class OG_221:
"""Selfless Hero"""
deathrattle = GiveDivineShield(RAND... | jleclanche/fireplace | fireplace/cards/wog/paladin.py | paladin.py | py | 1,409 | python | en | code | 645 | github-code | 6 |
859001844 | from __future__ import division
from vistrails.core.modules.vistrails_module import Module
from vistrails.core.modules.module_registry import get_module_registry
from vistrails.core.modules.basic_modules import List, String
from engine_manager import EngineManager
from map import Map
def initialize(*args,**keywords... | VisTrails/VisTrails | vistrails/packages/parallelflow/init.py | init.py | py | 1,195 | python | en | code | 100 | github-code | 6 |
27580622561 | from django.shortcuts import render, HttpResponse, get_object_or_404, HttpResponseRedirect
from .models import fizzURL
from django.views import View
from fiz.utils import create_shortcode
from .forms import SubmitURLForm
class HomeView(View):
'''
for a CBV, post and get function will be written separately, unl... | Afeez1131/shortener | fiz/views.py | views.py | py | 1,203 | python | en | code | 0 | github-code | 6 |
72995173628 | import os
import time
import sys
import pickle
import gzip
#import numpy as np
import zlib
try:
import eosapi
producer = eosapi.Producer()
print('This DL example is not supported anymore, a turly AI on blockchain will not looks like this.')
print('Please make sure you are running the following comm... | learnforpractice/pyeos | programs/pyeos/tests/python/mnist/t.py | t.py | py | 2,645 | python | en | code | 131 | github-code | 6 |
42420354636 | import sqlite3
from tkinter import *
from tkinter import messagebox
#Nombre la Base de Datos
db = "timerSIAT.db"
busca = Tk()
busca.iconbitmap('buscar.ico')
busca.title("Buscar Numero de Serie")
busca.geometry("330x250")
uno=Label(busca, text=" ")
uno.place(x = 30, y = 70)
dos=Label(busca, text=" ")
dos.place(x = 15... | AnaNicoSerrano88/Timmer-SIAT | Buscar_Serie.py | Buscar_Serie.py | py | 2,474 | python | es | code | 0 | github-code | 6 |
34252791072 | import argparse
import json
import os
from flask import Flask, render_template, request
import openai
import requests
import base64
app = Flask(__name__)
# Configure OpenAI API credentials
openai.api_key = 'OPEN_API_KEY'
@app.route('/')
def index():
return render_template('index.html')
@app.route... | Guhan-jb/HippoGPT | Hippo_GPT/main.py | main.py | py | 2,661 | python | en | code | 0 | github-code | 6 |
26826965262 | # Brainfuck interpreter made in Desmos graphing calculator
# https://www.desmos.com/calculator/sfjibaru0n
# This is a python script that converts bf code to the numbers used in Desmos
import re
CODE_MAP = {"+": 0, "-": 1, ">": 2, "<": 3, ".": 4, ",": 5, "[": 6, "]": 7}
with open(f"test.bf", "r") as f:
code = f.r... | idkhow2type/brainfuck | interpreters/desmos.py | desmos.py | py | 459 | python | en | code | 0 | github-code | 6 |
37204853562 | import logging
import logging.config
import os
import yaml
from commons.path import LOG_PATH, CONFIG_PATH
class MyLog:
def __init__(self, file_name, config_path=CONFIG_PATH, handel_name='server', level=logging.INFO):
"""
自定义日志对象
:param config_path: 自定义日志配置文件
:param file_name: 自定义日志... | tangjikuo/pdfHandlerSite | commons/logs.py | logs.py | py | 1,948 | python | en | code | 0 | github-code | 6 |
13919204702 | from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class PublicHolidays(models.Model):
_name = "public.holidays"
_description = "Public Holidays"
@api.depends("date")
def _compute_weekday(self):
"""Compute weekday based on the date."""
for day in self:... | onesteinbv/ProjectManagement | project_team_leave_management/models/public_holidays.py | public_holidays.py | py | 1,197 | python | en | code | 1 | github-code | 6 |
21529723220 | import logging
import sys
import re
import time
import json
def run(ctx):
# Get the ticket data from the context
ticket = ctx.config.get('data').get('ticket')
ticket_srn = ticket.get('srn')
# Create GraphQL client
graphql_client = ctx.graphql_client()
#query ticket endpoint for swimlanes
... | sonraisecurity/sonrai-bots | remediation/azure/add_sonrai_platform_user/bot.py | bot.py | py | 5,348 | python | en | code | 5 | github-code | 6 |
32522069165 | from codigo.funcionesAuxiliares import *
import time
import copy
#Algoritmo principal, realiza las llamadas a las funciones necesarias para obtener la salida esperada.
#Cada una de estas funciones están descritas en el archivo codigo/funcionesAuxiliares.py
def clustering(iteraciones_prueba, datos_entrada, tipo_input, ... | sergioperez1998/ProyectoClusteringIA | codigo/clustering.py | clustering.py | py | 1,446 | python | es | code | 0 | github-code | 6 |
70472477627 | import numpy as np
import matplotlib.pyplot as plt
# data to plot
n_groups = 5
meso4 = (0.5, 0.65, 0.84, 0.7,0.51)
capsule = (0.84, 0.89, 0.96, 0.95, 0.88)
xception = (0.93, 0.97, 0.98, 0.95, 0.88)
gan = (0.72, 0.73, 0.86, 0.86, 0.72)
spectrum = (0.81, 0.83, 0.98, 0.67, 0.57)
headpose = (0.64, 0.64, 0.64, 0.... | phuc180155/GraduationThesis | dfd_benchmark/plot_image/more_bar_chart.py | more_bar_chart.py | py | 981 | python | en | code | 2 | github-code | 6 |
20513626833 | from selenium import webdriver
from time import sleep
# validateText = "Option3"
driver = webdriver.Chrome(executable_path="/home/chaitanya/Documents/software/drivers/chromedriver_linux64/chromedriver")
driver.get("https://rahulshettyacademy.com/AutomationPractice/")
# Positive case
driver.find_element_by_css_selecto... | ChaithanyaRepo/PythonTesting | PythonSelenium/alerts.py | alerts.py | py | 788 | python | en | code | 0 | github-code | 6 |
31355510321 |
import unittest
import pyproj
import simplegrid as sg
class TestNearest(unittest.TestCase):
def test_nearest_sw_corner(self):
geod = pyproj.Geod(ellps='sphere')
mg = sg.gridio.read_mitgridfile('./data/tile005.mitgrid', 270, 90)
i,j,dist = sg.util.nearest(-128.,67.5,mg['XG'],mg['YG'],geo... | nasa/simplegrid | simplegrid/tests/test_nearest.py | test_nearest.py | py | 1,096 | python | en | code | 5 | github-code | 6 |
6545029693 | from sqlalchemy.orm import Session
from . import models, schemas
def get_items(db: Session, skip: int = 0, limit: int = 100):
return db.query(models.Item).offset(skip).limit(limit).all()
def create_objective(db: Session, objective: schemas.ObjectiveBase):
db_objective = models.Objective(**objective.dict())... | yaseralnajjar/Fast-API-Sample | my_app/crud.py | crud.py | py | 949 | python | en | code | 1 | github-code | 6 |
31543780794 | lines = []
print("\n\tEnter lines: \n")
while True :
string = input("\t")
if string == '':
break
lines.append(string)
print("\n\tThe lines you entered are:\n")
for i in lines:
print('\t' + i)
print()
| Shobhit0109/programing | EveryOther/Practical File/python/P9.py | P9.py | py | 232 | python | en | code | 0 | github-code | 6 |
1171875743 | #!/usr/bin/env python
import ROOT
class DefineHistograms:
"""Class to define all histograms to be filled for SMELLIE analysis
Attributes:
t_res (TH1D) : time residual histogram for all events
t_res_beam (TH1D) : time residual histogram for direct beam light
t_res_double (TH1D) : time ... | slangrock/SCUNC | define_histograms.py | define_histograms.py | py | 8,867 | python | en | code | 0 | github-code | 6 |
31280623414 | __author__ = 'Vincent'
from sqlalchemy import *
from threading import Thread
from threading import Event
from gps import *
from utils.bdd import *
from utils.functions import *
class GpsThread(Thread):
def __init__(self, session_db, event):
Thread.__init__(self)
self.db_session = session_db
... | capic/KartTrackerCore | threads/gps_thread.py | gps_thread.py | py | 2,197 | python | en | code | 0 | github-code | 6 |
43627739614 | class Solution:
# ends0: if we meet 0, we can append 0 to all existing ends0 + ends1
# ends0 = ends0 + ends1
#
# ends1: if we meet 1, we can append 1 to all existing ends0 + ends1
# and also adding "1"
# ends1 = ends0 + ends1 + 1
#
# example:
# num 1 0 1 ... | MichaelTQ/LeetcodePythonProject | solutions/leetcode_1951_2000/LeetCode1987_NumberOfUniqueGoodSubsequences.py | LeetCode1987_NumberOfUniqueGoodSubsequences.py | py | 1,320 | python | en | code | 0 | github-code | 6 |
21188009718 | """ Module for city related models. """
from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from data import CONFIG
from models import Base
CONSUMPTION_RATES = CONFIG.get("game.cities.consumption")
class City(Base):
""" Model for tracking city data. """
__tab... | Jordan-Cottle/Game-Design-Capstone | StarcorpServer/starcorp/models/city.py | city.py | py | 2,949 | python | en | code | 1 | github-code | 6 |
41244932240 | '''Crie um programa que tenha uma tupla com várias palavras
(não usar acentos). Depois disso, você deve mostrar, para cada palavra,
quais são as vogais'''
tupla = ('andre', 'camila', 'davi', 'isabella')
for palavra in tupla:
print(f'\nNa palavra {palavra} temos as vogais: ', end='')
for letra in palavra:
... | andrematos90/Python | CursoEmVideo/Módulo 3/Desafio 077.py | Desafio 077.py | py | 1,633 | python | pt | code | 0 | github-code | 6 |
17694953325 | from Transformer import Transformer
from MultiHeadAttention import MultiHeadAttention
from tqdm import tqdm
from Metrics import grad
from Metrics import loss_function
from Metrics import loss_function2
from Metrics import accuracy_function
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing i... | whytheevanssoftware/log-analyzer | training/__main__.py | __main__.py | py | 7,572 | python | en | code | 2 | github-code | 6 |
5504018518 | # https://www.hackerrank.com/challenges/zipped/problem
N, X = map(int, input().split())
data = []
for _ in range(X):
subject_marks = list(map(float, input().split()))
data.append(subject_marks)
tuples = zip(*data)
for element in tuples:
print(sum(element) / X)
| Nikit-370/HackerRank-Solution | Python/zipped.py | zipped.py | py | 275 | python | en | code | 10 | github-code | 6 |
34029348872 | import matplotlib.pyplot as plt
import numpy as np
"""
Plot of success rate for a single NN with different control horizons
"""
# testing_result = [47.74, 52.76, 61.81, 63.82, 50.75]
# baseline_result = [44.72, 45.73, 51.25, 52.26, 46.73]
testing_result = [48, 53, 62, 64, 51]
baseline_result = [45, 46, 51, 52, 47]
... | SFU-MARS/WayPtNav-reachability | executables/Plots_for_papers/Anjian/plot_ctrlhorizon_successful_rate.py | plot_ctrlhorizon_successful_rate.py | py | 1,763 | python | en | code | 3 | github-code | 6 |
42739926570 | # -*- coding = utf-8 -*-
"""
the :mod `dataset` module provides the dataset class
and other subclasses which are used for managing datasets
"""
import pandas as pd
import numpy as np
class Dataset:
"""base class for loading datasets
Note that you should never instantiate the class :class: `Dataset... | Jack-Lio/RecommenderSystem | dataset.py | dataset.py | py | 4,487 | python | en | code | 0 | github-code | 6 |
31101340357 | from django.urls import path
from . import views
app_name = "public"
urlpatterns = [
path("", views.index, name="index"),
path("about", views.about, name="about"),
path("upload_dataset", views.upload_dataset, name="upload_dataset"),
path("train_model", views.train_model, name="train_model"),
path(... | pdagrawal/ml_playground | ml_playground/apps/public/urls.py | urls.py | py | 374 | python | en | code | 0 | github-code | 6 |
11735637618 | """Add md5 and sha256 columns to File
Revision ID: d128b94f9a63
Revises: 59d249ebf873
Create Date: 2021-10-24 14:54:30.381535
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd128b94f9a63'
down_revision = '59d249ebf873'
branch_labels = None
depends_on = None
... | retroherna/rhinventory | alembic/versions/d128b94f9a63_add_md5_and_sha256_columns_to_file.py | d128b94f9a63_add_md5_and_sha256_columns_to_file.py | py | 806 | python | en | code | 1 | github-code | 6 |
38961246021 | #it is used to check the quatitity
import re
p1="a+"#occurance of a ,+ isused tocheck the occurance
p2="a*"#it will check for all a occurance
p3="a?"#it all position of a
p4="a{2}"#it will check only 2 occurances of a
p5="a{2,3}"#it will check min 2 num of a and max 3 num of a
p6="[Kl"
p=re.finditer(p3,"KL38C2280")
co... | Aswin2289/LuminarPython | LuminarPythonPrograms/RegularExper/Quantifiers.py | Quantifiers.py | py | 472 | python | en | code | 0 | github-code | 6 |
8717939176 | from threading import Thread
from time import sleep
from .. import Command, BaseTask
from ... import app_manager
class MeasureWeight(BaseTask):
"""
Measures weight and saves it to database.
Extra parameters:
- 'device_id': str - ID of target device,
- 'sleep_period': float - measurement period
... | SmartBioTech/DeviceControl | app/workspace/tasks/SICS.py | SICS.py | py | 1,134 | python | en | code | 2 | github-code | 6 |
75261205308 | import torch
from tqdm import tqdm
def evaluate(model, loader, device):
"""
Evaluation function to calculate loss and accuracy on Val/test dataset
Args:
model (nn.Module): model to be evaluated on the give dataset
loader (DataLoader): Validation/Test dataloader to evaluate the model on.
... | iMvijay23/Dinov2SSLImageCL | evaluate.py | evaluate.py | py | 1,112 | python | en | code | 7 | github-code | 6 |
42206728289 | import torch
from torch import nn
from torch.autograd import Variable
import torch.functional as F
from torch.optim import Adam
from torchvision.models import resnet50
# self
from vis import Vis
import vars
from data_loader import get_data_loader
from test import test
def train(epoch, model, train_loader, criterion, o... | DragonChen-TW/2018_bba_race | model/train.py | train.py | py | 1,970 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.