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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
73445869543 | from Edge import Edge
from Vertex import Vertex
def parse_file(filename):
data = []
start = None
end = None
with open(filename) as f:
for index, line in enumerate(f.readlines()):
if index == 0:
start = line.strip('\n')
elif index == 1:
en... | feldmatias/TeoriaDeAlgoritmos-FlujoMaximo-CorteMinimo | initialization.py | initialization.py | py | 1,339 | python | en | code | 0 | github-code | 36 |
22534561279 | import pandas as pd
### Feature Encoding
### ----------------
### ****************
## One-Hot Encoding
## ****************
# Function to convert a column into one-hot encoding using get_dummies
def convert_col_one_hot_series(series, drop_first=False, method='get_dummies'):
# If already a float or int, then simpl... | vabbybansal/mle_applications | Libs/Helpers/data_manipulation.py | data_manipulation.py | py | 3,387 | python | en | code | 0 | github-code | 36 |
25587181346 | import torch
from tqdm import tqdm, trange
from utils_squad_evaluate import EVAL_OPTS, main as evaluate_on_squad, plot_pr_curve
from utils_squad import (read_squad_examples, convert_examples_to_features,
RawResult, write_predictions,
RawResultExtended, write_predictions... | markjluo/DL-Project-A-Deep-Learning-Based-Chatbot | evaluate.py | evaluate.py | py | 2,255 | python | en | code | 2 | github-code | 36 |
29714838332 | # core python programming p395
import os
import pickle
class FileDescr(object):
saved = []
def __init__(self, name=None):
self.name = name
def __get__(self, obj, typ=None):
if self.name not in FileDescr.saved:
raise AttributeError("%r used before assigment" % self.name)
... | huajh/python_start | descr.py | descr.py | py | 1,847 | python | en | code | 0 | github-code | 36 |
25282953204 | # -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
def main():
#--- 取得URLの決定
url = 'https://github.com/librariapj'
#--- requestsでdom取得
response = requests.get(url)
#--- 取得結果の表示
print(response)
# print(response.text)
#--- BS4に取得内容を格納
soup = BeautifulSoup(response.c... | librariapj/SampleProject | src/hello.py | hello.py | py | 535 | python | en | code | 0 | github-code | 36 |
13069484239 |
import os
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from scipy.ndimage import label
from config import cfg
import labels
def benchmark_vis(iou_ar, fn):
pred_pgt_ar = np.zeros_like(iou_ar)
structure = np.ones((3, 3), dtype=int)
segment_ar = label(iou_ar, structure)[0]
for idx in... | mrcoee/Automatic-Label-Error-Detection | src/visualization.py | visualization.py | py | 4,667 | python | en | code | 0 | github-code | 36 |
6530887784 | # FLASK: location API functions
from flask import Flask, jsonify, request
import pymysql
from __main__ import app
from helpers.location import *
from db_connect.db_connection import connect
# Open database connection
db = connect()
cursor = db.cursor()
# New payment or get payments to a tutor
@app.route("/location... | judgyknowitall/DataBaseProject | venvProject/apis/location_route.py | location_route.py | py | 897 | python | en | code | 0 | github-code | 36 |
5487070944 | # from ADBInterface import
from Common import CommonFunction, AssertResult, ADBCommand, DealAlert
from Common.Log import MyLog, OutPutText
import re
from Conf.Config import Config
from ADBInterface import simplify_interface_code
from ADBInterface.Qualcomm import QualcommChip
import time
import datetime
meta_alert = De... | wmm98/Telpo_TPS469_Automation | ADBInterface/Qualcomm/Android_Versions/Qualcomm_Android_11.py | Qualcomm_Android_11.py | py | 7,148 | python | en | code | 0 | github-code | 36 |
10858226319 | import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from sockets import sio_app
app = FastAPI()
app.mount('/', app=sio_app)
app.add_middleware(
CORSMiddleware,
allow_origins=['*'],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.... | jrdeveloper124/socketio-app | server/main.py | main.py | py | 468 | python | en | code | 9 | github-code | 36 |
26765982477 | import requests
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///weather.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KE... | thenileshunde/weatherly | app.py | app.py | py | 2,509 | python | en | code | 1 | github-code | 36 |
38067689301 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 14:25:12 2020
@author: akash
"""
import numpy as np
import csv
import sys
import pickle
from validate import validate
def import_dataset(train_X_filepath,train_Y_filepath):
train_X = np.genfromtxt(train_X_filepath, delimiter=',', dtype=np.fl... | AKASHHMISHRA1/identify-fake-passport | predict.py | predict.py | py | 5,383 | python | en | code | 0 | github-code | 36 |
25465846204 | from drf_yasg.utils import swagger_auto_schema
from rest_framework.generics import ListCreateAPIView
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.parsers import MultiPartParser
from service_objects.services import ServiceOutcome
from api.constants import *
f... | sasha-pipec/mentor_project | api/views/comment/views.py | views.py | py | 3,808 | python | en | code | 1 | github-code | 36 |
74362482985 | from group_class import FacebookGroups
from scraper import scrape
from db_handler import init_mongo
from datetime import datetime
from rich import print
import config
import time
import random
import os
import sys
# Sleep for the desired time and restart for the sake of establishing new requests session
def sleep_and... | itamark87/Project-Ekron | main.py | main.py | py | 2,648 | python | en | code | 0 | github-code | 36 |
31902881705 | #Provjera da li je druga cifra trocifrenog broja parna ili neparna
x= int(input("Unesite trocifren broj: "))
x=x//10
y=x%10
if y%2!=0 :
print("Neparan")
elif y==0:
print("Naisli smo na nulu.")
else:
print("Paran")
| Tijana24/Django | Vjezba/zadatak1.py | zadatak1.py | py | 242 | python | hr | code | 0 | github-code | 36 |
32698917361 | from __future__ import annotations
import os
from typing import Union, TYPE_CHECKING
if TYPE_CHECKING:
from api.python.script_building.dag import DAGNode
from api.python.operator.nodes.matrix import Matrix
from api.python.operator.nodes.frame import Frame
from api.python.operator.nodes.scalar import Sc... | daphne-eu/daphne | src/api/python/utils/consts.py | consts.py | py | 1,109 | python | en | code | 51 | github-code | 36 |
32187650489 | import inkex
from typing import List
from common_utils import append_verify, BaseFillExtension
class EnsureClosed(BaseFillExtension):
def __init__(self):
BaseFillExtension.__init__(self, self.close_paths)
def close_paths(self, node):
_svgpath = node.path.to_svgpathtools()
if not _svgp... | CatherineH/inkscape_extensions | ensure_closed.py | ensure_closed.py | py | 1,508 | python | en | code | 2 | github-code | 36 |
6762090600 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
# Importing the dataset
dataset = pd.read_csv('Ads_CTR_Optimisation.csv')
#Implementing the UCB(from scratch.!!)
#we need to consider this number for each ad i. We're going to create a vector that will contain each of those memb... | raja17021998/Exciting-Machine-Learning-Journey-on-Python-and-R | Part 6 - Reinforcement Learning/Section 32 - Upper Confidence Bound (UCB)/UCB/upper_confidence_bound_wd.py | upper_confidence_bound_wd.py | py | 1,845 | python | en | code | 0 | github-code | 36 |
38871001211 | """
Solution of Codechef Problem - A Big Sale
Problem Code - BIGSALE
Link - https://www.codechef.com/problems/BIGSALE
"""
def calculate_loss(a,b,c):
d = a + a*c/100
d = d - d*c/100
return (a-d)*b
testcases = int(input())
while testcases > 0:
n = int(input())
total_loss = 0
for i in range(0,n):
arg = list(map(... | karanm97/codingProblems | bigsale.py | bigsale.py | py | 435 | python | en | code | 0 | github-code | 36 |
74157719464 | from torch import nn
class AE_Deconv(nn.Module):
def __init__(self, input_dim: int = 63, latent_dim: int = 16):
super().__init__()
assert latent_dim < 32
self.encoder = nn.Sequential(
nn.Linear(input_dim, 32),
nn.BatchNorm1d(32),
nn.ReLU(True),
... | DanBigioi/Sign2Speech | src/models/components/autoencoder.py | autoencoder.py | py | 2,475 | python | en | code | 1 | github-code | 36 |
71919299305 | #!/usr/bin/python3
#-*- coding: utf-8 -*-
"""
The use case of this script is the following:
Put all movies (radarr) or series (sonarr) with a certain tag in a collection in plex
Requirements (python3 -m pip install [requirement]):
requests
Setup:
Fill the variables below firstly, then run the script with -h to see ... | Casvt/Plex-scripts | sonarr/tag_to_collection.py | tag_to_collection.py | py | 6,013 | python | en | code | 285 | github-code | 36 |
27421411737 |
while(True):
from random import randint
from time import sleep
#meu objetivo é criar dois jogadores, um que será usuário e outro que será o pc
#crio uma lista com as jogadas
lis=['Pedra','Papel','Tesoura']
a=randint(0,len(lis)-1)
print("""Faça sua jogada no Jô-Ken-Pô:
[0] Pedra
[1] ... | Gabriel-boop-deep/ProcessoSeletivo | JoKenPo.py | JoKenPo.py | py | 1,060 | python | pt | code | 0 | github-code | 36 |
34848563515 | """1.1 Implement an algorithm to determine if a string has all unique
characters. What if you cannot use additional data structures?"""
def is_unique(input_string):
"""determines if a string has all unique characters"""
from collections import Counter
counter = Counter(input_string)
for char, values ... | stonecharioteer/blog | source/code/books/ctci/01_arrays_and_strings/ex_1x1_unique.py | ex_1x1_unique.py | py | 1,001 | python | en | code | 5 | github-code | 36 |
23992990502 | '''
286. Walls and Gates
https://leetcode.com/problems/walls-and-gates/
'''
from typing import List
from collections import deque
# The key is to recognize that if we search from gates to empty rooms
# We are guaranteed to find the shortest path by using BFS
class Solution:
def wallsAndGates(self, rooms: List[Lis... | asset311/leetcode | bfs/walls_and_gates.py | walls_and_gates.py | py | 1,621 | python | en | code | 0 | github-code | 36 |
7244240814 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# Dependencies
import os
import pandas as pd
from splinter import Browser
from bs4 import BeautifulSoup
from webdriver_manager.chrome import ChromeDriverManager
# In[2]:
def init_browser():
#set the chromedriver path
executable_path = {"executable_path": "chr... | mshi2/web-scraping-challenge | Missions_to_Mars/scrape_mars.py | scrape_mars.py | py | 3,178 | python | en | code | 0 | github-code | 36 |
9457147888 | """
62. Unique Paths
Medium
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
How many possible un... | juliazakharik/ML_algorithms | algorithms/WEEK8/Unique Paths.py | Unique Paths.py | py | 1,292 | python | en | code | 1 | github-code | 36 |
11022741249 | from hexToBinary import hex_to_binary
from binaryToDec import binary_to_dec
from decToBase64 import dec_to_base64
while True:
hexadecimal = input("Enter hexadecimal value to be converted to base64:\n\n")
if len(hexadecimal) % 2 == 0:
break
else:
print("Input must be hexadecimal string")
bi... | akahardzzz0011/hexToBase64 | main.py | main.py | py | 853 | python | en | code | 0 | github-code | 36 |
23843055382 | from django.urls import path
from .views import Frontpage, Shop, Signup, Login, MyAccount, EditMyAccount
from product.views import ProductDetailView
from django.contrib.auth.views import LogoutView
urlpatterns = [
path('', Frontpage.as_view(), name='frontpage'),
path('signup/', Signup.as_view(), name='signup'... | DenisVasil/Django-Tailwind-Shop | core/urls.py | urls.py | py | 774 | python | en | code | 0 | github-code | 36 |
28959351830 | from cfg import constants
import torch
import numpy as np
import trimesh
import pyrender
import cv2
import os
def render_smpl(vertices, faces, image, intrinsics, pose, transl,
alpha=1.0, filename='render_sample.png'):
img_size = image.shape[-2]
material = pyrender.MetallicRoughnessMateri... | yohanshin/Pseudo-SMPL-GT | utils/visualization.py | visualization.py | py | 3,955 | python | en | code | 0 | github-code | 36 |
29116967159 | import pandas as pd
import glob
# List all files in folder with gz extension
extension = 'csvs/*.gz'
all_files = glob.glob(extension)
# Read and concatenate dataframes
df = pd.concat([pd.read_csv(f, sep='\t', header=0, na_values='-')
for f in all_files], ignore_index=True)
# Filter data from Atlántic... | rodianf/DS4A-data-source | data_process.py | data_process.py | py | 2,131 | python | en | code | 1 | github-code | 36 |
30148740705 | class Prepro:
def __init__(self,file:str = None) -> None:
self.file:str = file
self.code:str = None
def open(self)->None:
if self.file.split(".")[-1] == "gst":
with open(self.file, 'r') as f:
self.code = f.read()
else:
raise Exception("Not... | matheus-1618/GuardScript | Interpreted/modules/prepro.py | prepro.py | py | 850 | python | en | code | 0 | github-code | 36 |
16313788421 | import unittest
import dictcom
class MainTest(unittest.TestCase):
def word_check_helper(
self,
word,
should_have_pronunciation,
should_have_pronunciation_audio
):
parsed = dictcom.get_word(word)
self.assertIsInstance(parsed, dictcom.models.Word)
self.ass... | mradlinski/dictcom | tests/main_test.py | main_test.py | py | 2,358 | python | en | code | 5 | github-code | 36 |
38093193093 | import typing
import pytest
from forml import project
from forml.io import dsl, layout
from forml.io._input import extract
class TestSlicer:
"""Slicer unit tests."""
@staticmethod
@pytest.fixture(scope='session')
def features(project_components: project.Components) -> typing.Sequence[dsl.Feature]:
... | formlio/forml | tests/io/_input/test_extract.py | test_extract.py | py | 2,136 | python | en | code | 103 | github-code | 36 |
3094662956 | sys.stdin = StringI0(test_input1)
numbers_list = input().split(", ")
result = 0
for i in range (numbers_list):
number = numbers_list[i + 1]
if number < 5:
result *= number
elif number > 5 and number > 10:
result /= number
print (result)
print (f'''Expected:
20
10
1''') | ivn-svn/SoftUniPythonPath | Programming OOP and Advanced with Python/Advanced/error_handling/lab/1_so_many_exceptions.py | 1_so_many_exceptions.py | py | 298 | python | en | code | 1 | github-code | 36 |
41674825810 | '''
--- Changes for this version ---
- change to save in txt format, as saved format no longer a valid json format
- removed the open and end line, only take tweet object
'''
# used material: workshop solution from past course in UniMelb (COMP20008): https://edstem.org/au/courses/9158/lessons/25867/slides/185032/solut... | Juaneag/COMP90024-Assignment2-Team39 | twitter/preprocess.py | preprocess.py | py | 5,927 | python | en | code | 0 | github-code | 36 |
34717450162 | from bottle import route
from bottle import run
from bottle import request
from bottle import HTTPError
import album
@route("/albums/<artist>")
def albums(artist):
""" в переменную albums_list записываем таблицу найденных альбомов
для этого обращаемся к функции find(), которую мы написали
в модуле ... | zpa1986/-zpa1986-skillfactory-module-11-zaykin_B6-Practice | album_server.py | album_server.py | py | 1,730 | python | ru | code | 0 | github-code | 36 |
15391664489 | import tensorflow as tf
from tf_agents.networks import actor_distribution_network
from tf_agents.networks import actor_distribution_rnn_network
from tf_agents.networks import value_network
from tf_agents.networks import value_rnn_network
import ppo.my_ppo_agent as my_ppo_agent
def create_ppo_agent(env, global_step,... | Ricechrispi/sc2_academy | sc2_academy/custom_tf_agents.py | custom_tf_agents.py | py | 6,864 | python | en | code | 1 | github-code | 36 |
30381880481 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 30 09:32:26 2018
@author: jon
"""
import cmath
import math
import numpy as np
import matplotlib.pyplot as plt
from pynufft import NUFFT_cpu
def expectedIFT(img, X, u, v):
N = img.shape[0]//2
for x in range (-N, N):
for y in range... | lord-blueberry/p8-pipeline | sandbox/first_runs/pynufft/BUG.py | BUG.py | py | 915 | python | en | code | 0 | github-code | 36 |
1813313668 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 18/8/25 上午12:19
# @Author : Lihailin<415787837@qq.com>
# @Desc :
# @File : log.py
# @Software: PyCharm
import conf
from common_import import *
def genLogDict(logDir, logFile):
'''
配置日志格式的字典
'''
logDict = {
"version": 1,
... | hailinli/accessCsdn | log.py | log.py | py | 1,957 | python | en | code | 5 | github-code | 36 |
11038838210 | #!/usr/bin/env python
# coding: utf-8
# # Filter #1: Broken Frame 🔨
# My broken_frame() function creates a fractured effect in the image below that I liken in appearance to the Distorted Glass filter in Photoshop.
import PIL.ImageOps
from PIL import Image
def broken_frame(image):
length = image.size[1]
... | mars-aria/vfx-filters | broken-frame filter/broken-frame_filter.py | broken-frame_filter.py | py | 677 | python | en | code | 0 | github-code | 36 |
74490472425 | class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
for i in range(int(len(matrix))-1, -1, -1):
for e in range(len(matrix)):
matrix[e].append(matrix[i][e])
... | BenVN123/LeetCode | 48-rotate-image/48-rotate-image.py | 48-rotate-image.py | py | 410 | python | en | code | 0 | github-code | 36 |
30097509663 | """Script for demonstrating polynomial regression.
Data obtained from: https://www.kaggle.com/karthickveerakumar/salary-data-simple-linear-regression
"""
import csv
import numpy as np
import matplotlib.pyplot as plt
NUM_ITERS = 250
ALPHA = 0.01
def main():
X, y = load_data()
X, stds = scale_features(X)
... | JhihYangWu/ML-Practice | 03 Polynomial Regression/polynomial_regression.py | polynomial_regression.py | py | 2,912 | python | en | code | 1 | github-code | 36 |
23480037190 | from typing import List
class Solution:
def combinationSum(candidates: List[int], target: int) -> List[List[int]]:
answer = []
# 주어진 target에 candidates로 주어진 원소들을 빼나가면서 0이 나오면 정답에 추가하는 식으로 로직 구현
# 원소들의 조합의 합이 target이 되는지를 판단해야 하기 때문에 dfs를 이용
def dfs(cur_sum, cur_index, sub_answer):... | raddaslul/basic_algoritm | hikers/combination_sum.py | combination_sum.py | py | 1,231 | python | ko | code | 0 | github-code | 36 |
11737753941 | import pandas as pd
import numpy as np
from rdkit import Chem
# 1. sdfファイルの名前を指定
# ex. ChemCupid_Namiki.sdf
filename = 'ChemCupid_Namiki'
# -----------------------------------------
def main():
mols = [mol for mol in Chem.SDMolSupplier(
f'{filename}.sdf') if mol is not None]
smiles = [Chem.MolToSmil... | yuito118/share-chemo | sdfToSmiles.py | sdfToSmiles.py | py | 488 | python | en | code | 0 | github-code | 36 |
73157455464 | """ Test tifffile plugin functionality.
"""
import datetime
import io
import warnings
from copy import deepcopy
import numpy as np
import pytest
from conftest import deprecated_test
import imageio.v2 as iio
import imageio.v3 as iio3
from imageio.config import known_extensions, known_plugins
tifffile = pytest.import... | imageio/imageio | tests/test_tifffile.py | test_tifffile.py | py | 11,873 | python | en | code | 1,339 | github-code | 36 |
69903435304 | #!/usr/bin/env python
#
# A script that check fulltextsearch queue in nextcloud
# This works only for Postgres Backend
#
#
# Main Author
# - Filip Krahl <filip.krahl@t-systems.com>
#
# USAGE
#
# See README.md
#
from optparse import OptionParser
import sys
import time
import re
import os
import numbers
try:
im... | FLiPp3r90/nextcloud_fulltextsearch_pg | nextcloud_fulltextsearch_pg.py | nextcloud_fulltextsearch_pg.py | py | 5,947 | python | en | code | 1 | github-code | 36 |
71508824103 | from wsgiref import simple_server
from flask import Flask, request, render_template,url_for, app
from flask import Response
from flask_cors import CORS, cross_origin
from logistic_deploy import predObj
import os
import json
app = Flask(__name__)
CORS(app)
app.config['DEBUG'] = True
class ClientApi:
def __ini... | amitranjasahoo12/logistics-regression | app.py | app.py | py | 2,548 | python | en | code | 0 | github-code | 36 |
18315390523 | # This script does the following:
#
# 1. Steps through all of the shapefiles associated with the aerial photos and
# determines whether the shapefile falls entirely within in the fjord. Photos
# that don't fall entirely within the fjord are excluded from analysis. A file
# titled 'input_files.npy' is created that conta... | ojiving/iceberg_segmentation | s1_image_segmentation_parallel_with_shapefiles.py | s1_image_segmentation_parallel_with_shapefiles.py | py | 6,975 | python | en | code | 0 | github-code | 36 |
27780510600 | T = "I DO NOT LIKE SEVENTY SEV BUT SEVENTY SEVENTY SEVEN"
P = "SEVENTY SEVEN"
b = [None]*(len(P)+1) # KMP back table
def kmpPreprocess():
# initialization
i = 0
j = -1
b[0] = -1
# preprocess pattern
while i < len(P):
# different, reset j using b
pi = P[i]
pj = P[j]
... | live-abhishek/ds-algo | string-algo/kmp.py | kmp.py | py | 881 | python | en | code | 0 | github-code | 36 |
40794902663 |
with open("input.txt") as f:
data = f.read().splitlines(keepends=False)
DISK_SPACE = 70_000_000
NEEDED_SPACE = 30_000_000
file_system = {}
total_sizes = {}
cd = []
def change_dir(dir):
global cd
if dir == "..":
cd = cd[:-1]
else:
cd.append(dir)
def add_files():
global file_syst... | BIGZ221/AOC_2022 | Day7/day7_part2.py | day7_part2.py | py | 1,423 | python | en | code | 0 | github-code | 36 |
7047886953 | import base64
import json
import boto3
import uuid
from botocore.client import Config
def lambda_handler(event, context):
config = Config(connect_timeout=15, retries={'max_attempts': 3})
sqs = boto3.resource('sqs', config=config)
queue = sqs.get_queue_by_name(
QueueName='eks-notification-canada-c... | cds-snc/notification-lambdas | sesemailcallbacks/ses_to_sqs_email_callbacks.py | ses_to_sqs_email_callbacks.py | py | 1,971 | python | en | code | 0 | github-code | 36 |
8757344295 | # -*- coding: utf-8 -*-
from odoo import models, fields, api
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.model_cr_context
def _auto_init(self):
cr = self._cr
# Fonction à effacer : transition de many2one à many2many pour la relation sale_order - purchase_order
cr.... | odof/openfire | of_purchase_fusion/models/of_purchase_fusion.py | of_purchase_fusion.py | py | 5,420 | python | en | code | 3 | github-code | 36 |
2954317677 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Python標準ライブラリ
import cv2
from cv_bridge import CvBridge, CvBridgeError
# Python追加ライブラリ
import mediapipe as mp
# ROSに関するライブラリ
import rospy
from sensor_msgs.msg import CompressedImage
class HandDetection():
def __init__(self):
# MediaPipeが提供しているhandsの値を読み込... | Shoichi-Hasegawa0628/mediapipe_ros | src/main_ros.py | main_ros.py | py | 2,503 | python | en | code | 0 | github-code | 36 |
41287113420 | # Big O
# Complexity
"""
To calculate Big O you need to go through every single (excutable)line of code and calculate how much time/space it takes.
- Calculate against number of items
- So no actual time (no seconds), and no actual space (no KBites)
- For lists, always call number of items (n) - but you can use n,m, ... | LTUC/amman-python-401d7 | class-06/big_o.py | big_o.py | py | 1,388 | python | en | code | 2 | github-code | 36 |
3866986259 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 20:47:36 2020
@author: mixmp
"""
import random
import math
import numpy as np
import mpmath
def nearest_neighbour_for_TPS(path):
###################function for reading the tps document########################33
def read_tps(path):
with ... | michaelampalkoudi/Master-projects | HW_9_Computational_optimization.py | HW_9_Computational_optimization.py | py | 8,857 | python | en | code | 0 | github-code | 36 |
1616572613 | # check if below string is a palindrome
city = 'cccco'
# way 1: this code is good but we end up comparing letters more than we need
for i in range(0, len(city)):
if city[i] != city[(i+1) * -1]:
is_palindrome1 = 'No'
break
print(is_palindrome1)
# way 2: this code is longer but it is faster
stoppe... | rayzcodz/CodingPy | strings/palindrome_tester.py | palindrome_tester.py | py | 573 | python | en | code | 0 | github-code | 36 |
74768118503 | from django.http import HttpRequest
from djaveAllowed.models import Allowed
from djaveAllowed.credentials import UserCredentials
from djaveAPI.get_instance import get_instance
from djaveAPI.problem import Problem
from djaveClassMagic.find_models import model_from_name
def get_request_ajax_obj(request, model=None, pk=... | dasmith2/djaveAPI | djaveAPI/get_request_variable.py | get_request_variable.py | py | 2,142 | python | en | code | 0 | github-code | 36 |
43911039109 | import numpy as n
import matplotlib.pyplot as plt
v0 = float(input("Podaj V0: "))
katpierwszy = float(input("Podaj kat: ")) * n.pi / 180
kat = katpierwszy* n.pi / 180
time = 2 * v0 * n.sin(kat) / 9.81
hmax = v0**2 * n.sin(kat)**2 / (2 * 9.81)
zasieg = 2 * v0**2 * n.sin(kat)**2 / 9.81
punkty = 100
t = n.lin... | AWyszynska/JSP2022 | lista9/zadanie3.py | zadanie3.py | py | 796 | python | pl | code | 0 | github-code | 36 |
506102860 | """
Split Raster's into tiles
"""
import os
from osgeo import gdal
def nrsts_fm_rst(rst, rows, cols, out_fld, bname):
"""
Split raster into several rasters
The number of new rasters will be determined by the extent of the
raster and the maximum number of rows and cols that the new
rasters could... | jasp382/glass | glass/dtt/rst/split.py | split.py | py | 3,146 | python | en | code | 2 | github-code | 36 |
36050038659 | from typing import Optional
from tornado.template import Loader
from web.controllers.utils.errors import handle_errors
from web.controllers.utils.validated import ValidatedFormRequestHandler
from web.schemas import template_schema
from web.services.email.abstract import AbstractEmailService
from web.validation import... | MFrackowiak/sc_r_mailmarketing | web/controllers/template.py | template.py | py | 2,346 | python | en | code | 0 | github-code | 36 |
12028774277 | import pdb
import unittest
from app import app as flickrlive_app
class FlickrLiveTestCase(unittest.TestCase):
def setUp(self):
flickrlive_app.config['TESTING'] = True
self.app = flickrlive_app.test_client()
def test_homepage_shows_initial_flickr_feed(self):
""" The homepage should b... | cr8ivecodesmith/flickrlive | tests.py | tests.py | py | 1,395 | python | en | code | 1 | github-code | 36 |
2623856397 | import discord
import logging
import os
from discord.ext import commands
logger = logging.getLogger('serverlinker')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
initial_extensions... | Kelwing/DiscordLinkerBot | main.py | main.py | py | 1,599 | python | en | code | 2 | github-code | 36 |
43328947226 | from bs4 import BeautifulSoup
#from requests import Session as R
import requests as R
import time
import random
import os
import json
from fake_useragent import UserAgent
from stem import Signal
from stem.control import Controller
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
fro... | naturalkind/simpleparsing | build_parse_drive2/dr4_1.py | dr4_1.py | py | 9,278 | python | en | code | 0 | github-code | 36 |
72597561384 | from torch import nn
import torch
class OrderPredictor(nn.Module):
def __init__(self, model_dim):
super().__init__()
self.disc_linear = nn.ModuleList([
nn.Linear(2 * model_dim, model_dim) for _ in range(3)
])
self.final_linear = nn.Linear(3 * model_dim, 6)
def forw... | AwalkZY/CPN | model/sub_modules/auxiliary.py | auxiliary.py | py | 937 | python | en | code | 10 | github-code | 36 |
72871581863 | demo_config_data = {
'num_epochs': 30,
'num_train_iter': 400,
'num_val_iter': 60,
'start_save': 2,
'save_freq': 10,
'eval_freq': 5,
'batch_size': 32,
'batch_size_val': 16,
'learning_rate': 1e-4,
'num_fourier_comp': 3,
'img_size': (224, 224),
'mlp_layers': [256]*2,
'ra... | LDenninger/se3_pseudo_ipdf | config/demo_set/config.py | config.py | py | 590 | python | en | code | 0 | github-code | 36 |
14710820018 | # -*- coding: utf-8 -*-
"""
Lib to manage toolbars which appear on mousedown and stay visible a few seconds
"""
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from ...basic.utils.toolbar import ToolbarManager as BasicToolbarManager
class ToolbarManager(BasicToolbarManager):
def __init__(self, *args, *... | twidi/GRead | packaging/fremantle/src/opt/GRead/views/mobile/utils/toolbar.py | toolbar.py | py | 896 | python | en | code | 4 | github-code | 36 |
70947874665 | def power(x, n):
# calculate x^n
if n == 1:
return x
else:
return x * power(x, n-1)
def power2(x, n):
if n == 1:
return x
else:
partial = power2(x, n//2)
result = partial * partial
if n % 2 == 1: result *= x
return result | luke-mao/Data-Structures-and-Algorithms-in-Python | chapter4/example_power.py | example_power.py | py | 308 | python | en | code | 1 | github-code | 36 |
12780519052 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from core.modules import RNNCell, SequenceWise, ConvLayer
def im2col(x, K, P):
N, C, H, W = x.shape
L = N * H * W
CK2 = C * K ** ... | etienne87/torch_object_rnn | core/convs/plastic_conv.py | plastic_conv.py | py | 4,185 | python | en | code | 9 | github-code | 36 |
72596154985 | from command.control_commands.control_command import ControlCommand
from terminal.confirm import Confirm
class QuitCommand(ControlCommand):
def __init__(self):
super().__init__()
self.__confirm = Confirm()
def execute(self, *args):
sequences = self.get_all_sequences()
modified... | AyalaGottfried/DNA-Analyzer-System | command/control_commands/quit_command.py | quit_command.py | py | 1,209 | python | en | code | 2 | github-code | 36 |
30874171906 | import argparse
import os
import time
import gym
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from PPO import PPO
from unity_wrapper_zzy import UnityWrapper
parser = argparse.ArgumentParser(description='Train or test neural net motor controller.')
parser.add_argument('--train', dest='trai... | TreeletZhang/CarVerification | main.py | main.py | py | 7,123 | python | en | code | 0 | github-code | 36 |
28088800649 | from .base import (
ScraperModel,
Price,
Title,
Description,
Tags,
Longitude,
Latitude,
PictureURL,
PostTime,
PostID
)
from ...shared.models.furniture import FurnitureDAO
class FurnitureScraperModel(ScraperModel):
DB_MODEL = FurnitureDAO
def __init__(self, soup, url):
... | philipk19238/klarity | api/app/scraper/models/furniture.py | furniture.py | py | 878 | python | en | code | 1 | github-code | 36 |
31414356277 | """Module test user information reource."""
import json
from unittest import mock
from flask import Response
from .base_test import BaseTestCase, Center, Cohort, Society
from api.utils.marshmallow_schemas import basic_info_schema
def info_mock(status_code, society=None, location=None, cohort=None, data=None):
"... | andela/andela-societies-backend | src/tests/test_user_information.py | test_user_information.py | py | 7,480 | python | en | code | 1 | github-code | 36 |
25717533361 | from typing import Type, TypeVar, MutableMapping, Any, Iterable
from datapipelines import (
DataSource,
PipelineContext,
Query,
NotFoundError,
validate_query,
)
from .common import RiotAPIService, APINotFoundError
from ...data import Platform, Region
from ...dto.staticdata.version import VersionLis... | meraki-analytics/cassiopeia | cassiopeia/datastores/riotapi/spectator.py | spectator.py | py | 3,558 | python | en | code | 522 | github-code | 36 |
72308209705 | '''
|||||||||||||||||||| | n_flanges_top
|||||||||||||||||||| | h_flange
|||| ||||
|||| |||| ------------------- centroidal axis | n_webs
|||| |||| ... | groverud/Beam_Bridge_Model | main.py | main.py | py | 5,438 | python | en | code | 0 | github-code | 36 |
1952962326 | from multiprocessing import Process,Queue,Pipe
from slave import serialize
import time
def timer(*args, f=None):
before = time.time()
f(*args)
after = time.time()
return after - before
big_str = ' '.join(['abcdeftghijklmnopq\n' for y in range(1000000)]) + ' '
print(len(big_str))
parent_conn,child_... | brokenpath/generator | master.py | master.py | py | 484 | python | en | code | 0 | github-code | 36 |
22349295595 | import sys
import os
from npbgpp.npbgplusplus.modeling.refiner.unet import RefinerUNet
from pytorch3d.io import load_obj, load_ply, save_obj
import cv2
import numpy as np
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import trimesh
import yaml
from .quad_rasterizer import QuadRaste... | SamsungLabs/NeuralHaircut | src/hair_networks/strands_renderer.py | strands_renderer.py | py | 6,865 | python | en | code | 453 | github-code | 36 |
7799631669 | # encoding=utf-8
# encoding=utf-8
import data_input
import tensorflow as tf
import numpy as np
import sequence_model
from sklearn import metrics
import warnings
warnings.filterwarnings("ignore")
filename = "../Data/29_1.txt"
train_eval_split_line = 0.9
batch_size = 9600
show_step = 200
filemark = "" # "" default te... | feizhihui/Malicious-URL-Detection | model/url_detection.py | url_detection.py | py | 1,454 | python | en | code | 0 | github-code | 36 |
9747404267 | # Author: Ranjodh Singh
import requests
from bs4 import BeautifulSoup as bs
import os
url = "http://www.thehindu.com/archive/"
html = requests.get(url)
soup = bs(html.__dict__['_content'], "html5lib")
container = soup.select("#archiveTodayContainer")
for link in container[0].find_all("a"):
resp = requests.get(li... | singhranjodh/the-hindu-archive-scraper | script.py | script.py | py | 1,304 | python | en | code | 7 | github-code | 36 |
9084660899 | import numpy as np
class Stack:
def __init__(self):
self.arr = np.array([0] * 2, dtype="<U10")
self.end = 0
self.capacity = 2
def push(self, a):
self.arr[self.end] = a
self.end += 1
if self.end == self.capacity:
self.resize(self.capacity * 2)
... | sidh26/Data-Structures-and-Algorithms | python/Stack Queue/Shunting Yard Algorithm.py | Shunting Yard Algorithm.py | py | 1,235 | python | en | code | 0 | github-code | 36 |
21362019800 | connected_nodes = [[0, 2], [0, 3], [1, 2], [1, 4], [2, 3], [2, 5], [3, 4], [4, 5]]
num_nodes = 6 # max(max(x) for x in connected_nodes) + 1
nodes = list(range(num_nodes))
# This is wrong. see:
# https://docs.python.org/2/faq/programming.html#how-do-i-create-a-multidimensional-list
# matrix = [[0]*num_nodes]*num_nodes... | abhiroyg/islanddetection | redundant/experiment/get_connection_matrix.py | get_connection_matrix.py | py | 482 | python | en | code | 0 | github-code | 36 |
27588646191 | class TST(object):
class Node(object):
def __init__(self, c):
self.value = None
self.c = c
self.left = None
self.middle = None
self.right = None
def __init__(self):
self.__root = None
def put(self, key, value):
self.__root... | igor-dulger/learn_algorithms | tree/tries/tst.py | tst.py | py | 2,869 | python | en | code | 0 | github-code | 36 |
38509693865 | import math
from django.shortcuts import render, get_object_or_404, redirect, reverse
from django.utils import timezone
from authentication.models import UserProfile
from issue_tracker.models import Issue, Comment
from django.contrib.auth.models import User
from issue_tracker.forms import IssueForm, CommentForm
from dj... | itoulou/unicorn-attractor | issue_tracker/views.py | views.py | py | 5,517 | python | en | code | 1 | github-code | 36 |
35401059925 | import numpy as np
def checkerboard(n):
if n%2!=0:
return
array=np.zeros((n,n),dtype=int)
for i in range(1-n,n,2):
array+=np.eye(n,k=i,dtype=int)
return array
print(checkerboard(int(input("Enter the even no of Rows : "))))
print("thank you")
| PranitRohokale/My-programs | checkerboard.py | checkerboard.py | py | 290 | python | en | code | 0 | github-code | 36 |
2708712516 | from src import Constants
from src.Objects.GenericObject import GenericObject
class Item(GenericObject):
def __init__(self, itemConfig):
super().__init__(itemConfig)
self.effect = itemConfig[Constants.effect]
def activate(self, user, isCrit):
return {
Constants.description... | dndiscord/dndiscord | src/Objects/Item.py | Item.py | py | 908 | python | en | code | 0 | github-code | 36 |
36189547346 | from concurrent.futures.thread import ThreadPoolExecutor
import requests
# url = "http://www.eversunshine.cn/"
# url = "https://static-4c89007f-af34-418a-909e-be456bf03b70.bspapp.com/#/"
# url = "https://www.baidu.com/"
def DOS():
# resp = requests.get(url, timeout=3)
# print(resp.text)
# print(data)
... | wuheyouzi/code | PycharmProjects/dos/main.py | main.py | py | 495 | python | en | code | 0 | github-code | 36 |
20944122981 | import tkinter as tk
#import sys
#import os
#if os.environ.get('DISPLAY','') == '':
# print('no display found. Using :0.0')
# os.environ.__setitem__('DISPLAY', ':0.0')
venster=tk.Tk()
tekst=tk.Label(venster, text="Demo")
tekst.pack()
venster.mainloop()
| Nicholas-Osei/RaspberryPi-Programming | Python_Oefeningen/Oef5.py | Oef5.py | py | 263 | python | en | code | 0 | github-code | 36 |
35940617435 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 16:21:28 2018
@author: bob.lee
"""
from src.model_test import image_cnn
from PIL import Image
import sys
def image_main(image_name):
image = Image.open(image_name)
image = image.flatten() / 255
predict_text = image_cnn(image)
return pre... | lidunwei12/Verification_code | main.py | main.py | py | 420 | python | en | code | 1 | github-code | 36 |
71245259624 | # -*- coding: utf-8 -*-
# pylint: disable-msg=W0403,W0603,C0111,C0103,W0142,C0301
""" partialy stolen from python locale tests ;)
requires nose (easy_install nose)
nosetests -v --with-coverage --cover-package=localization test_localization.py
"""
from django.conf import settings
settings.configure(DEBUG=True,
... | shula/citytree | contrib/nesh/localization/test_localization.py | test_localization.py | py | 7,157 | python | en | code | 2 | github-code | 36 |
25287870424 | import threading
import json
import os
from astar_model import AStarModel
from tkinter.ttk import Progressbar
from tkinter import (Tk, Frame, Button, Label, Entry, Checkbutton, Scale, Canvas, messagebox, filedialog,
StringVar, IntVar,
DISABLED, NORMAL,
W, S... | Mackaronii/astar-search-visualizer | astar_gui.py | astar_gui.py | py | 31,617 | python | en | code | 1 | github-code | 36 |
5100700802 | #!/bin/env python
import streamlit as st
import pandas as pd
import os
import yaml
################################################################
def _main():
_filenames = os.listdir()
_filenames = [e for e in _filenames if os.path.splitext(e)[1] == '.json']
_filenames = [os.path.splitext(e)[0] for e ... | anciaux/graph-tool-sgc-tc | plot_best_match.py | plot_best_match.py | py | 3,429 | python | en | code | 0 | github-code | 36 |
20593599782 | # coding:utf-8
"""
Create by Wangmeng Song
July 21,2017
"""
import shapefile as sf
from shapely.geometry import Polygon, Point
import os
import inspect
import numpy as np
import json
filedir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + "/" + "area"
pingchearea = u'pincheArea.dbf' # 拼... | Octoberr/Auto_Schedule | recomTimeOnTheBus/eastandwestside.py | eastandwestside.py | py | 7,983 | python | en | code | 6 | github-code | 36 |
32033249960 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@author:ai
@file:sendOrder.py
@time:2020/05/28
"""
import sys
import pandas as pd
from configs.Database import DEV
from tradingSystem.CATS.catsserverapi.catsConfig import CatsTypeTotradeAcct
from tradingSystem.CATS.catsserverapi.models.Account import LocalOsInfo
from tr... | Joey2634/MultiFactorFramework | tradingSystem/CATS/catsserverapi/sendOrder.py | sendOrder.py | py | 1,350 | python | en | code | 0 | github-code | 36 |
32226927177 | import streamlit as st
import requests
import json
from dbnomics import fetch_series
import pandas as pd
from pandas.api.types import (
is_categorical_dtype,
is_datetime64_any_dtype,
is_numeric_dtype,
)
import altair as alt
st.set_page_config(page_title="DB Nomics Marco Data Vizualizer", layout="wide")
s... | Silvan-Fischer/MacroDataViz | MarcoDataViz.py | MarcoDataViz.py | py | 8,039 | python | en | code | 0 | github-code | 36 |
3271118820 | #!/usr/bin/env python3
"""
Sample Input
10 4
1
2
-1
-2
2
Sample Output
0.7696
"""
# if speeds[i] == 0:
def strangeClock(L, T, speeds):
if not speeds or L == 0:
print("{0:0.7f}".format(0))
elif T == 0:
failProb = ((L-1)/L) ** len(speeds)
print("{0:0.7f}".format(1 - failProb))
else... | ysyesilyurt/CclubCompetition19 | clock.py | clock.py | py | 908 | python | en | code | 0 | github-code | 36 |
72718749224 | import numpy as np
#from pyGITR.math_helper import *
from typing import Callable
import matplotlib.pyplot as plt
import pydoc
import netCDF4
import os
class Sputtering_and_reflection():
def ShowAvailableProjectiles(self):
for D in ['H', 'D', 'T', 'He4', 'Si', 'C', 'W']:
print(D)
... | audide12/DIIIDsurface_pyGITR | pyGITR/Physical_Sputtering.py | Physical_Sputtering.py | py | 15,097 | python | en | code | 1 | github-code | 36 |
12605526420 | import fcntl
import os
import socket
import struct
from threading import Thread
from time import sleep
import time
import sys
import re
import errno
from discovery.discovery_report import DiscoveryReport
RUNNING = True
MCAST_GRP = '239.255.255.250'
detected_bulbs = {}
bulb_idx2ip = {}
scan_socket = None
listen_socket... | giuliapuntoit/RL-framework-iot | discovery/yeelight_analyzer.py | yeelight_analyzer.py | py | 6,351 | python | en | code | 8 | github-code | 36 |
1946073401 | #dfs
import sys
sys.setrecursionlimit(10**5)
def dfs(v, graph, visited):
visited[v] = 1 # 방문 처리
for i in graph[v]:
if visited[i] == 0: # 아직 방문을 하지 않음
dfs(i, graph,visited)
def solution(n,m,graph):
answer = 0
visited = [0]*(n+1)
for i in range(1, n+1):
if visited[i] == 0... | hellokena/2022 | DFS & BFS/11724 연결 요소의 개수 DFS.py | 11724 연결 요소의 개수 DFS.py | py | 780 | python | en | code | 0 | github-code | 36 |
34415435950 | from timeit import timeit
def caesarCipherEncryptor(string, key):
# Write your code here.
res = []
key %= 26
for char in string:
newCode = (ord(char) + key - 97) % 26 + 97
res.append(chr(newCode))
return "".join(res)
def caesarCipherEncryptor_sol1(string, key):
# Write your c... | serb00/AlgoExpert | Strings/Easy/011_caesar_cipher_encryptor.py | 011_caesar_cipher_encryptor.py | py | 1,336 | python | en | code | 0 | github-code | 36 |
29752162238 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 23 02:22:23 2018
@author: RAJAT
"""
import numpy as np
from time import time
from keras.models import Sequential
from keras.layers import Dense, Dropout , Activation,Flatten,Convolution2D, MaxPooling2D ,AveragePooling2D
from keras.callbacks import TensorBoard
... | rajatkb/STU-NET-Stupid-Neural-Net | edition 1 CNN= = = softmax/model.py | model.py | py | 3,722 | python | en | code | 3 | github-code | 36 |
3458942753 | import collections
import pandas as pd
import re
import pdftotext
import requests
from static.constants import FILE_PATH
class DrugsFDA:
def __init__(self, fda_app_num):
self.FDA_Application_Number = None
drugs_fda_df = pd.read_csv(FILE_PATH.DRUGSFDA_ORIGIN_DOCS, encoding="ISO-8859-1", delimiter=... | Yiwen-Shi/drug-labeling-extraction | core/drugsfda.py | drugsfda.py | py | 13,945 | python | en | code | 0 | github-code | 36 |
6319273494 | import theano
import theano.tensor as T
from .utils import floatX
from .layers import l2norm
# ------------------------
# Regularization
# ------------------------
def clip_norm(grad, clip, norm):
if clip > 0:
grad = T.switch(T.ge(norm, clip), grad * clip / norm, grad)
return grad
def clip_norms(grads... | maym2104/ift6266-h17-project | lib/updates.py | updates.py | py | 8,249 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.