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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
13498915187 | import math
#import civq.utils as utils
import sys
import civq.utils as utils
class Encoder:
# Codebook's size
M = 0
# Block's area
L = 0
# Stop condition
epslon = 0
# Codebook
codebook = []
# Regions to associate vector with codebook vectors
regions = {}
indexReconstruc... | EduardoLR10/imageCompressors | civq/encoder.py | encoder.py | py | 6,772 | python | en | code | 1 | github-code | 13 |
1652918955 | # 这些真的是easy难度吗...
# 一开始想到位运算,但没细想怎么处理进位,然后百度了下得到一个解法 :
class Solution(object):
def getSum(self, a, b):
"""
:type a: int
:type b: int
:rtype: int
"""
while b:
x = a^b
y = (a&b) << 1 #这里注意下位移运算 优先级高于位运算
a = x
b =... | fire717/Algorithms | LeetCode/python/_371.SumofTwoIntegers.py | _371.SumofTwoIntegers.py | py | 1,238 | python | zh | code | 6 | github-code | 13 |
34785907190 | import pandas as pd
import matplotlib.pyplot as plt
file_path = './directory.csv'
df = pd.read_csv(file_path)
df = df[df['Country'] == 'US']
data = df.groupby('City')['Brand'].count().sort_values(ascending = False).head(25)
_x = data.index
_y = data.values
plt.figure(figsize = (20, 8), dpi = 80)
plt.bar(range(len(... | ScarletSmallRed/LeeML | Visualization/Starbucks/chart2.py | chart2.py | py | 468 | python | en | code | 0 | github-code | 13 |
32029283965 | import base
from ..items.node import Category, Node
from ..items.edge import Edge
class EclubsSpider(base.BaseSpider):
name = 'eclubs'
start_urls = [
'http://entrepreneurship.mit.edu/accelerator/demo-day/'
]
def parse(self, response):
hostname = self.extract_hostname(response)
for l in self.le.ext... | yasyf/vcpr | vcpr/spiders/eclubs.py | eclubs.py | py | 1,579 | python | en | code | 0 | github-code | 13 |
9962084352 | import discord
from discord.ext import commands
import models.functions as func
from models.async_mcrcon import MinecraftClient
class ServerTool(commands.Cog):
"""
ServerTool
"""
def __init__(self, client):
self.client = client
self.minecraftCharArray = ['§0', '§1', '§2', '§3', '... | DmytroFrame/dimoxa-bot | extensions/serverTool.py | serverTool.py | py | 3,465 | python | en | code | 0 | github-code | 13 |
10839457252 | from unittest.mock import MagicMock, AsyncMock
from aiogram.types import CallbackQuery, User
fake_event = AsyncMock()
def make_fake_callback(data: str) -> CallbackQuery:
return CallbackQuery(
from_user=User(id=1, is_bot=False, first_name='user'),
id=1,
chat_instance='1',
data=dat... | DeveloperHackaton2023/tgbot | bot/tests/mocks/message.py | message.py | py | 328 | python | en | code | 0 | github-code | 13 |
23160437348 | # 小明身高1.75,体重80.5kg。请根据BMI公式(体重除以身高的平方)帮小明计算他的BMI指数,并根据BMI指数:
# 低于18.5:过轻
# 18.5-25:正常
# 高于38:严重肥胖
str = input("请输入你的体重: ")
weight = float(str)
if weight < 18.5:
print("你的体重过轻,请加强锻炼")
elif 18.5 <= weight and weight <= 25:
print("你的体重正常")
else:
print("你的体重过于肥胖")
| ywendeng/python_study | If_Else.py | If_Else.py | py | 454 | python | zh | code | 0 | github-code | 13 |
29266963499 | from flask import Flask, render_template, jsonify, request
from predict import predict
from utilities.download_csv_from_current_directory import download_csv_from_current_directory as read_csv
from utilities.find_entries_by_date_station import find_entries_by_date_station
from utilities.label_encoding import label_... | Jayho219/weather-anomalies-dataset | server.py | server.py | py | 1,828 | python | en | code | 0 | github-code | 13 |
5002934854 | import sys
import os
import shutil
import json
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
from config import get_config, create_config_file, remove_config_file, get_shell_profile_path, config_file_exists, FILE_PATH
from network_error_handler import remove_offline_store, submit_offli... | tash-had/TerminalTodo | nirvana_in.py | nirvana_in.py | py | 6,370 | python | en | code | 3 | github-code | 13 |
1721118717 | import os
# noinspection PyUnresolvedReferences
from pybgfx import bgfx
from pybgfx.utils.imgui_utils import ImGuiExtra
from pybgfx.constants import (
BGFX_CLEAR_COLOR,
BGFX_CLEAR_DEPTH,
BGFX_DEBUG_TEXT,
BGFX_RESET_VSYNC,
)
from examples.example_window import ExampleWindow
from examples.helloworld imp... | fbertola/bgfx-python | examples/helloworld/helloworld.py | helloworld.py | py | 2,926 | python | en | code | 117 | github-code | 13 |
19428969076 | import time , RP, math
LCD = RP.LCD_1inch28()
LCD.set_bl_pwm(15535)
cx , cy =120 ,120 #center of watch
def spin( tic , spinLen , color):
now = list(time.localtime())
x = spinLen*math.sin(math.radians(now[tic]*6))
y = spinLen*math.cos(math.radians(now[tic]*6))
LCD.line(cx,cy,int(cx+x),int(cy-y),color)
... | chyijiunn/picoWatch | 12_centerSec.py | 12_centerSec.py | py | 1,578 | python | en | code | 0 | github-code | 13 |
34897410489 | import unittest
import pandas as pd
from parameterized import parameterized
import nose2
colum_names = ['Destination.IP', 'Timestamp', 'Flow.Duration', 'Flow.Bytes.s', 'Average.Packet.Size', 'ProtocolName']
def bytes_transfered(flow_duration, flow_bytes):
bytes_transfered = flow_duration * flow_bytes
return ... | avantgarden/fc_interview | test.py | test.py | py | 3,834 | python | en | code | 0 | github-code | 13 |
15271003703 | #############################
## market visualize seperate sources
############################
import pandas as pd
import matplotlib as plt
import numpy as np
from os import listdir
from cryptocmd import CmcScraper
import pickle
from copy import deepcopy
from string import punctuation
from random import shuffle
impor... | cedricoeldorf/DeepTransferLearning_BTCPricePrediction | models/seperate_market_visualization.py | seperate_market_visualization.py | py | 9,302 | python | en | code | 1 | github-code | 13 |
3189694533 | import pandas as pd
import numpy as np
import scipy as sc
from scipy import optimize
import cvxpy as cp
def project_first_teams(data, columns, numberOfProjects, maxTeamSize, numberOfChoices, significantCols, isCsv = False):
# Initialization, Reading the survey information
if isCsv: ## Needed for the jupyter n... | jojoqjchen/teamFormation | jojoAttempt2/teamFormationCode/project_first.py | project_first.py | py | 4,652 | python | en | code | 1 | github-code | 13 |
29292900398 | # -*- coding: utf-8 -*-
import sys,json
from datetime import datetime
sys.path.append('/root/Project/Api/Class')
sys.path.append('/root/Project/Api/Service')
sys.path.append('/root/Project/Api/Db')
sys.path.append('/root/Project/Api/Util')
sys.path.append('/root/Project/Api/Constant')
#------------------Local Component... | Fipek/SocialIcon-Backend | Service/OfferService.py | OfferService.py | py | 5,209 | python | en | code | 0 | github-code | 13 |
26016353966 | from typing import Sequence
import numpy as np
from sklearn.metrics import accuracy_score, confusion_matrix, recall_score
from audeep.backend.data.data_set import DataSet, Split, Partition
from audeep.backend.learners import LearnerBase, PreProcessingWrapper
from audeep.backend.log import LoggingMixin
def uar_score... | auDeep/auDeep | audeep/backend/evaluation.py | evaluation.py | py | 13,821 | python | en | code | 144 | github-code | 13 |
25273268262 | from tkinter import *
def display():
if(x.get() == 1):
print("You agree")
else:
print("You disagree")
window = Tk()
x = IntVar() #inVar() returns a 1 or a 0
check_button = Checkbutton(window,
text="I agree",
variable= x, #tracks the curre... | Swishxo/VScode | TKinter/checkbox.py | checkbox.py | py | 642 | python | en | code | 0 | github-code | 13 |
25405656718 | from main import *
from skimage import data, color, morphology, img_as_ubyte, measure
from skimage.feature import canny
from skimage.transform import hough_ellipse, hough_circle
from skimage.draw import ellipse_perimeter
import cv2
import matplotlib.pyplot as plt
import numpy as np
from skimage.color import rgb2gray
... | wmatecki97/Python-Notes-Recognition | CirclesDetection.py | CirclesDetection.py | py | 1,712 | python | en | code | 0 | github-code | 13 |
14776934100 | #!/usr/bin/python3
import h5py as h5 # for reading and writing h5 format
import numpy as np # for handling arrays
import os # for directory walking
import subprocess as sp # for executing terminal command from python
"""
This script turns the different outputs from a COMPAS simulation into
a ... | SimonStevenson/COMPAS | defaults/postProcessingDefault.py | postProcessingDefault.py | py | 20,590 | python | en | code | null | github-code | 13 |
473943256 | #write a program that asks for a letter, then prints if it`s a vowel or consonant
while True:
letter = input('Enter a letter: ')
if not letter.isalpha():
print('Enter only letters')
continue
else:
break
vowels = ['a','e','i','o','u']
if letter in vowels:
print('The lett... | Ian-Lohan/Python | List/22.py | 22.py | py | 412 | python | en | code | 0 | github-code | 13 |
341536071 | from flask import Blueprint, render_template, request
import json
import random
from flaskr import puzzle as master_puzzle
random_puzzle_bp = Blueprint('random_puzzle_bp', __name__,
static_folder = 'static', static_url_path = 'static',
template_folder = 'templ... | aegolix/puzzle-slider-web | source/flaskr/random_puzzle/random_puzzle.py | random_puzzle.py | py | 1,359 | python | en | code | 0 | github-code | 13 |
29076721134 | import time
from pyVmomi import vim
from cloudshell.cp.vcenter.exceptions.task_waiter import TaskFaultException
class SynchronousTaskWaiter(object):
def __init__(self):
pass
# noinspection PyMethodMayBeStatic
def wait_for_task(self, task, logger, action_name='job', hide_result=False):
"... | AdamSharon/vCenterShell | package/cloudshell/cp/vcenter/common/vcenter/task_waiter.py | task_waiter.py | py | 1,492 | python | en | code | null | github-code | 13 |
21025717908 | from pythonosc.udp_client import SimpleUDPClient
from pythonosc.dispatcher import Dispatcher
from pythonosc import osc_server
import time
import torch
from torch_models import LSTMMemory
from collections import deque
from typing import List, Any, Union
import random
import numpy as np
from visual.live_plot import Liv... | trian-gles/aloof-machine | live_unit.py | live_unit.py | py | 4,051 | python | en | code | 0 | github-code | 13 |
32276734373 | # exercise 95: Capitalize It
def capitalize(s):
li = list(s)
li[0] = li[0].upper()
c = 1
for c in range(1, len(li)):
if li[c] == 'i' and li[c - 1] == ' ' and li[c + 1] == ' ':
li[c] = li[c].upper()
if li[c] == '.' or li[c] == '!' or li[c] == '?':
if c + 2 < len(l... | sara-kassani/1000_Python_example | books/Python Workbook/functions/ex95.py | ex95.py | py | 555 | python | en | code | 1 | github-code | 13 |
41243246814 | # open() is not supported in Online Python Tutor,
# so use io.StringIO to simulate a file (in Python 3)
import io
# create a multi-line string and pass it into StringIO
Code = io.StringIO('''Cnmzkc Ingm Sqtlo hr sgd 45sg zmc btqqdms Oqdrhcdms ne sgd Tmhsdc Rszsdr, hm neehbd rhmbd Izmtzqx 20, 2017.
Adenqd dmsdqhmf onkh... | gsakkas/seq2parse | src/tests/parsing_test_17.py | parsing_test_17.py | py | 737 | python | en | code | 8 | github-code | 13 |
42159003510 | import re
import time
from threading import Thread
from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtWidgets import QMainWindow, QApplication, QLineEdit, QPushButton, QListWidget, QLabel, QMessageBox, \
QProgressBar
from PyQt5 import uic
import sys
import asyncio
from download_movie import MovieDownloader
from f... | Hannes0730/Kdrama-Downloader | main.py | main.py | py | 6,926 | python | en | code | 0 | github-code | 13 |
30144027050 | train_rust_input_path = "../data/translate/train_rust_input.txt"
train_rule_output_path = "../data/translate/train_rule_output.txt"
test_rust_input_path = "../data/translate/test_rust_input.txt"
test_rule_output_path = "../data/translate/test_rule_output.txt"
val_rust_input_path = "../data/translate/val_rust_input.tx... | trusted-programming/rulegen_2 | scripts/reprocess_data.py | reprocess_data.py | py | 1,605 | python | en | code | 0 | github-code | 13 |
16987979598 | class Solution:
def kthSmallest(self, matrix, k):
"""
:type matrix: List[List[int]]
:type k: int
:rtype: int
"""
import heapq
heap = []
for row in range(len(matrix)):
for col in range(len(matrix[0])):
if len(heap) == k:
... | HzCeee/Algorithms | LeetCode/heap/378_KthSmallestElementInSortedMatrix.py | 378_KthSmallestElementInSortedMatrix.py | py | 551 | python | en | code | 0 | github-code | 13 |
6764537756 | from data import db_session
from data.news import News
from data.jobs import Jobs
from data.users import User
from forms.user import RegisterForm, LoginForm
from forms.news import NewsForm
from flask import Flask, abort, redirect, render_template, request
from flask_login import (
LoginManager,
current_user,
... | genhost/mars | mars/main.py | main.py | py | 6,818 | python | en | code | 0 | github-code | 13 |
72776832977 | from unittest import result
def removeDuplicates(nums):
i = 1
while i < len(nums):
if nums[i] == nums[i - 1]:
nums.pop(i)
else:
i = i + 1
return len(nums)
nums = [1,1,2,2,4,5]
res = removeDuplicates(nums)
print(res)
'''
TRACING:
nums = [1,1,2,2,4,5]
i = 1
whi... | karthik-karalgikar/coding_practice | Day_7_ArrayEasy/LC26removeDuplicates.py | LC26removeDuplicates.py | py | 901 | python | en | code | 0 | github-code | 13 |
33212668864 | from reading_datasets import read_ud_dataset, reading_tb_ner
pos_train = read_ud_dataset(dataset = 'tb', location = '../Datasets/POSTagging/Tweebank/', split = 'train')
pos_val = read_ud_dataset(dataset = 'tb', location = '../Datasets/POSTagging/Tweebank/', split = 'dev')
pos_test = read_ud_dataset(dataset = 'tb', loc... | akshat57/Twitter-Seq-Labelling | Code/reconcile_datasets.py | reconcile_datasets.py | py | 1,343 | python | en | code | 0 | github-code | 13 |
680795996 | #!/usr/bin/env python3
"""
Coin flip exersice from lecture.
"""
import random
class Coin():
"""
Coin class.
"""
def __init__(self):
"""
Constructor method.
"""
self.side_up = "Heads"
self.results = []
def toss_coin(self):
"""
Setter metho... | DMoest/ooPython | kmom01/exercises/coin_flip.py | coin_flip.py | py | 942 | python | en | code | 1 | github-code | 13 |
2098280839 | import streamlit as st
import time
'Starting a long computation...'
# Add a placeholder
latest_iteration = st.empty()
bar = st.progress(0)
for i in range(20):
# Update the progress bar with each iteration.
latest_iteration.text(f'Iteration {(i+1)*5}')
bar.progress((i+1)*5)
time.sleep(0.15)
'...and now we\'r... | jffist/streamlit-sandbox | app_with_progress.py | app_with_progress.py | py | 965 | python | en | code | 0 | github-code | 13 |
40864952114 | """
Implementing Double Linked List.
"""
class Node:
def __init__(self, data):
self.data = data
self.next = None
self.prev = None
class DLL:
def __init__(self):
self.head = None
def print(self):
itr = self.head
while itr is not None:
print(itr... | kundan123456/100DaysCodeChallengeDS | Day2/double-linked-list.py | double-linked-list.py | py | 789 | python | en | code | 0 | github-code | 13 |
39740091057 | #!/usr/bin/env python
from utils import toUnicode, removeDiacritic
import sqlite3
import sys
# Normalize imported database text fields to utf8.
dbFileNameDefault = 'RaceDB.sqlite3'
license_holder_fields = [
'search_text',
'last_name', 'first_name',
'license_code', 'uci_code',
'nationality', 'state_prov', 'city',... | esitarski/RaceDB | core/fix_utf8.py | fix_utf8.py | py | 1,219 | python | en | code | 12 | github-code | 13 |
15912891596 | from __future__ import absolute_import
from mom.security.codec import pem
from mom.security.codec.pem import rsa
from mom.security.codec.pem import x509
__author__ = "yesudeep@google.com (Yesudeep Mangalapilly)"
def public_key_pem_decode(pem_key):
"""
Decodes a PEM-encoded public key/X.509 certificate string i... | gorakhargosh/mom | mom/security/codec/__init__.py | __init__.py | py | 1,413 | python | en | code | 37 | github-code | 13 |
22196298312 | from jsonasobj2 import as_json
from linkml_runtime.utils.compile_python import compile_python
from linkml.generators.pythongen import PythonGenerator
def test_issue_python_ordering(input_path, snapshot):
"""Make sure that types are generated as part of the output"""
output = PythonGenerator(input_path("issue... | linkml/linkml | tests/test_issues/test_issue_134.py | test_issue_134.py | py | 577 | python | en | code | 228 | github-code | 13 |
74039093138 | #Tahmin yapabilen bir sinir ağı kurmanın son parçası,
# her şeyi bir araya getirmektir.
# Öyleyse, compute_weighted_sum ve node_activation işlevlerini
# ağdaki her düğüme uygulayan ve verileri çıktı katmanına sonuna kadar uygulayan ve
# çıktı katmanındaki her düğüm için bir tahmin çıkaran bir fonksiyon oluşturalım.... | erdiacr/Forward-Propagation_Neural_Network | Forward_Propagation_NeuralNetwork/Forward_Propagate_Function.py | Forward_Propagate_Function.py | py | 1,897 | python | tr | code | 0 | github-code | 13 |
8424762609 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 27 09:30:54 2018
@author: lenovo
"""
# 该文件处理需要用_thread 优化一下
from ProcessFunc import ProcessOp, ProcessF
import csv
import pandas as pd
from DateFuture import future_id, date
import _thread
# 根据Option文件夹路径读取期权价格(t,ask1,bid1) 生成PriceForRes文件
def ProcessOp_Res(filename):
... | Lee052/huatai-intern | code/ResProcess.py | ResProcess.py | py | 2,055 | python | en | code | 0 | github-code | 13 |
11097780835 | volume = int(input()) # obem
p1 = int(input()) # debit parva traba
p2 = int(input()) # debit vtora traba
hours = float(input()) # chasovete v koito rabotnikat otsastwa
first_pipe = p1 * hours
second_pipe = p2 * hours
sum_pipes_volume = first_pipe + second_pipe
if sum_pipes_volume <= volume:
pool_percent = (s... | tanchevtony/SoftUni_Python_basic | More exercises/02_Conditional_statements/pipes in pool.py | pipes in pool.py | py | 732 | python | en | code | 0 | github-code | 13 |
43031669204 | # Generic imports
import os
import os.path
import PIL
import math
import scipy.special
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
### ************************************************
### Class defining shape object
class shape:
### *********************************************... | jviquerat/lbm | lbm/src/utils/shapes.py | shapes.py | py | 15,469 | python | en | code | 109 | github-code | 13 |
15061861677 | from django.contrib import admin
from django.urls import path, include
# from django.contrib.auth import views as auth_views
# from django.views.generic.base import TemplateView
from . import views
urlpatterns = [
path('route_list/', views.route_list, name='route_list'),
path('add_route/', views.add_route, na... | DavKle132/route_manager | routes/urls.py | urls.py | py | 734 | python | en | code | 0 | github-code | 13 |
23911469401 | #! /usr/bin/env python3
import rospy
from sensor_msgs.msg import PointCloud2
import sensor_msgs.point_cloud2 as pcl
import std_msgs.msg
pcl_list = []
def pcl_callback(data):
new_pcl = []
header = std_msgs.msg.Header()
header.stamp = rospy.Time.now()
header.frame_id = 'map'
# new_pcl.header = hea... | noorbot/mars-quadcopter | src/point_cloud_modeller.py | point_cloud_modeller.py | py | 971 | python | en | code | 2 | github-code | 13 |
11351552741 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
'''
输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。
示例 1:
输入:head = [1,3,2]
输出:[2,3,1]
'''
class Solution:
def reversePrint(self, head: ListNode) -> List[int]:
res = []
cur ... | DaToo-J/NotesForBookAboutPython | 剑指offer/linkList/6_reversePrint.py | 6_reversePrint.py | py | 515 | python | en | code | 0 | github-code | 13 |
40518488185 | import urllib
import urllib.request
from bs4 import BeautifulSoup as BFS
import os
def make_soup(url):
thepage = urllib.request.urlopen(url)
soupdata = BFS(thepage, "html.parser")
return soupdata
playerdatasaved = ""
soup = make_soup("http://fundamentus.com.br/detalhes.php")
for record in soup.findAll('tr... | sospsbrasil/ImportaPapeis | ImportaPapeis.py | ImportaPapeis.py | py | 753 | python | en | code | 0 | github-code | 13 |
21503295239 | from jax import numpy as jnp
from flax.core.frozen_dict import FrozenDict
from pinn_jax.derivatives import get_batch_jacobian, get_batch_hessian, get_batch_snap
from typing import Callable, Tuple
def get_burgers(u_hat: Callable, nu: float) -> Callable:
batch_jacobian = get_batch_jacobian(u_hat)
batch_hessia... | newalexander/pinn-jax | pinn_jax/equations/simple_pdes.py | simple_pdes.py | py | 7,743 | python | en | code | 0 | github-code | 13 |
1794407761 | import types,string,sys,os
import logs
import traceback
import matches
MathOps = ('/ ** ~| ~& ~^ !^ + - * / ^ % & | && || ! ~ < > << >> >>> == <= >= != ~&').split()
RESERVED = ['int']
class module_class:
def __init__(self,Name,Kind='module'):
self.Module=Name
self.Kind=Kind
self.defines={}
... | greenblat/vhdl2v | llbin/module_class.py | module_class.py | py | 61,604 | python | en | code | 1 | github-code | 13 |
2000596264 | from django.shortcuts import render, redirect
from .forms import ProductAddForm
from django.contrib import messages
from .models import ProductDetail
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required(login_url="SignIn")
def AddProduct(request):
form = ProductAddFo... | AmalMohan487/Ecom | Product/views.py | views.py | py | 2,385 | python | en | code | 0 | github-code | 13 |
21890994178 | l=list()
for i in range(1):
l.append(input("enter the number"))
print(*l)
for x in l:
print(x)
l[0]="hello"
print(l)
l.pop()
l.insert(3,"hai")
l.sort()
l.clear()
print(l)
l1=["hai","hlo"]
l2=["a","b","c"]
l3=["ab","cd","de"]
l4=[l1,l2,l3]
print(l4[2][1])
z=10
x=11
print(f"the value is {z} and {x}")
z=... | joyaldevassy14/python | bascis/list.py | list.py | py | 393 | python | en | code | 0 | github-code | 13 |
15469383031 | import copy
import datetime
import os
import re
import sys
import time
#--------------------------------------------------------------------------------
# Local
from jobsuite import *
from pathlib import Path
keyword_command = [ "nodes", "ppn", "suite", ]
keyword_reserved = [ "system", "modules",
... | TACC/demonspawn | spawn.py | spawn.py | py | 6,750 | python | en | code | 12 | github-code | 13 |
37948066748 | class mass(object):
"""! Particle masses."""
## electron mass
e = 0.00051
## muon mass
mu = 0.1057
## tau mass
tau = 1.777
## down quark mass
d = 0.32
## up quark mass
u = 0.32
## strange quark mass
s = 0.5
## charm quark mass
c = 1.55
## bottom qu... | rushioda/PIXELVALID_athena | athena/Generators/PowhegControl/python/parameters/atlas_common.py | atlas_common.py | py | 1,669 | python | en | code | 1 | github-code | 13 |
24938877053 | """
5) add the choice between a nominal and an effective interest rate
"""
from mortality import *
class Annuity:
def __init__(
self,
table = 'test',
gender = 'female',
interest_rate = 0.03,
interest_compounding = 12,
):
self.table = mortality_tables[table]
qx = mortality_tables[table][gender]
self.p... | nicolasessisbreton/pyzehe | b_basic/sol_5.py | sol_5.py | py | 865 | python | en | code | 3 | github-code | 13 |
17630712060 | from ecom import settings
from django.urls import path
from .views import (
homepage_view,
category_view,
category_gender_view,
category_gender_subcategory_view,
brand_view,
)
from core.models import (
Header,
SubGroup,
GroupItem,
Carousel
)
from products.models import (
Cate... | AarushJuneja/Reppin | ecom/core/urls.py | urls.py | py | 980 | python | en | code | 1 | github-code | 13 |
19270049255 | from django.http import HttpResponse
from django.shortcuts import redirect
from django.views import View
from django.db import transaction
from django.core.mail import send_mail
from django.core.mail import get_connection
from rest_framework.views import APIView
from rest_framework.renderers import TemplateHTMLRendere... | FoxLlik/sus_hr | apps/org/views.py | views.py | py | 14,895 | python | en | code | 0 | github-code | 13 |
25105269793 | # -*- coding: utf-8 -*-
from algorithm import yolov3_slideWindows
from easydict import EasyDict as edict
import argparse
import os
import cv2
import sys
yolov3_path=os.path.expanduser('~/git/gnu/code/yolov3')
if yolov3_path not in sys.path:
sys.path.insert(0,yolov3_path)
from utils.utils import plot_one_box
def i... | ISCAS007/demo | areadetection/main.py | main.py | py | 5,517 | python | en | code | 0 | github-code | 13 |
14278103086 | import bpy
from mathutils import *
bl_info = {
"name": "Tila : Empty Mesh",
"author": "Tilapiatsu",
"version": (1, 0, 0, 0),
"blender": (2, 80, 0),
"location": "View3D",
"category": "Mesh",
}
class TILA_EmptyMeshOperator(bpy.types.Operator):
bl_idname = "object.tila_emptymesh"
bl_label = "TILA: Empty Me... | Tilapiatsu/blender-custom_config | scripts/startup/tila_OP_EmptyMesh.py | tila_OP_EmptyMesh.py | py | 1,541 | python | en | code | 5 | github-code | 13 |
17055504064 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MMemberLevel import MMemberLevel
class MPromoConstraint(object):
def __init__(self):
self._crowd_type = None
self._member_levels = None
self._need_cro... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/MPromoConstraint.py | MPromoConstraint.py | py | 5,252 | python | en | code | 241 | github-code | 13 |
20809205379 | from crypto_tulips.dal.objects.block import Block
from crypto_tulips.dal.objects.transaction import Transaction
from crypto_tulips.dal.objects.pos_transaction import PosTransaction
from crypto_tulips.hashing.crypt_hashing_wif import EcdsaHashing
import time
import json
class GenesisBlockService():
@staticmethod
... | StevenJohnston/py-crypto-tulips | crypto_tulips/services/genesis_block_service.py | genesis_block_service.py | py | 1,595 | python | en | code | 1 | github-code | 13 |
72725038739 | import sys
import requests
import math
import re
#import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from bs4 import BeautifulSoup
from qtpy import QtWidgets
from PyQt5.QtCore import Qt
from ui.mainwindow import Ui_MainW... | JanMarcelKezmann/Web-Crawler-with-PyQt-Widget | main.py | main.py | py | 11,900 | python | en | code | 0 | github-code | 13 |
29635856568 | import sys
import pickle
import neat
import visualize
import pygame
from game import Game
from car import Car
from car import CarAction
MAX_GENOME = None
def run_simulation(genomes, config):
# Create neural networks
nets = []
cars = []
count = 0
for id, genome in genomes:
net = neat.nn.... | lynconEBB/ai-cars | main.py | main.py | py | 2,137 | python | en | code | 0 | github-code | 13 |
26870162745 | from itertools import permutations
def pan(s):
if len(set(s))<len(s):
return False
for d in "0123456789":
if not d in s:
return False
return True
ds=[2,3,5,7,11,13,17]
def fun(n):
for i in range(1,7+1):
if int(str(n)[i:i+3])%ds[i-1]!=0:
return False
re... | zydiig/PESolution | 43.py | 43.py | py | 534 | python | en | code | 0 | github-code | 13 |
35770923422 | import glob
import csv
import os
import pandas as pd
def convert(filenames, filePath):
num = 0
for filename in filenames:
# print(filename)
tweetTexts = []
# tweetTexts.append('text')
tweetIds = []
# tweetIds.append('tweet_id')
i = -1
# prin... | namrata-simha/Slug-MovieBot | DataExtractionAndPreprocess/convertJSON_CSV.py | convertJSON_CSV.py | py | 2,115 | python | en | code | 0 | github-code | 13 |
22036111695 | #
# @lc app=leetcode.cn id=695 lang=python3
#
# [695] 岛屿的最大面积
#
from typing import List
# @lc code=start
# 深度优先(递归)
# class Solution:
# def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
# max_area = 0
# for i, l in enumerate(grid):
# for j, m in enumerate(l):
# ... | revang/leetcode | 695.岛屿的最大面积.py | 695.岛屿的最大面积.py | py | 2,551 | python | en | code | 0 | github-code | 13 |
13713835332 | # -*- coding: utf-8 -*-
from PIL import Image
from chess_board import WHITE
def draw_choose_mask(color):
path = ''
name_queen = '_queen.png'
name_rook = '_rook.png'
name_bishop = '_bishop.png'
name_knight = '_knight.png'
if color == WHITE:
name_color = 'white'
else... | AleshinAndrei/Chess | draw_mask_of_choose.py | draw_mask_of_choose.py | py | 914 | python | en | code | 0 | github-code | 13 |
17052633834 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class HospitalDTO(object):
def __init__(self):
self._hospital_id = None
self._hospital_name = None
self._level = None
self._ownership = None
@property
def hospi... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/HospitalDTO.py | HospitalDTO.py | py | 2,346 | python | en | code | 241 | github-code | 13 |
23551633400 | import os
import asyncio
import logging
from aiogram import Dispatcher, Bot, types
from aiogram.fsm.storage.memory import MemoryStorage
from src.modules import modules
from src.start import START
def create_dispatcher() -> Dispatcher:
storage = MemoryStorage()
dispatcher = Dispatcher(storage=storage)
di... | ktp0li/summus | src/__main__.py | __main__.py | py | 858 | python | en | code | 3 | github-code | 13 |
23440544469 | # imports os module
from os import *
# file operators
# w for write, r for read, a for appending
file = open("myfile.txt", "w") # writing to a file that doesn't exist make a new file
# closing the file stream and flushes/closes it
file.close()
file.flush() # flushes the stream but the file is still open
# if you don... | Sashe-Bashe/NeuralNine_PCAP | Notes For Begginer Lessons/9.py | 9.py | py | 620 | python | en | code | 0 | github-code | 13 |
24159777926 | import numpy as np
from scipy import ndimage
import torch
import torch.nn as nn
import torch.nn.functional as F
class WingLoss(nn.Module):
def __init__(self, omega=10.0, epsilon=2.0):
super(WingLoss, self).__init__()
self.omega = omega
self.epsilon = epsilon
def forward(self, predic... | ChoiDM/Adaptive-Wing-Loss | awing_loss.py | awing_loss.py | py | 2,146 | python | en | code | 0 | github-code | 13 |
25980523169 | import random
word_list = ["aardvark", "baboon", "camel"]
chosen_word = random.choice(word_list)
# Testing code
print(f'Pssst, the solution is {chosen_word}.')
display = []
for letter in chosen_word:
display += "_"
print(display)
end_game = False
while not end_game:
guess = input("Guess a letter: ").lower()
... | rizkiabdillahazmi/100Days_Code_Python | 007-day7/replacing-blank.py | replacing-blank.py | py | 567 | python | en | code | 1 | github-code | 13 |
38406937816 | # import libraries
from segmentation_model import get_model
from classification_model import classification_model
from coef_and_loss import dice_coef, dice_loss
import pandas as pd
import numpy as np
import cv2 as cv
import tensorflow as tf
# read our data
train = pd.read_csv('train_ship_segmentations_v2.csv')
# dec... | daniltomashi/AirbusShipDetection | train_models.py | train_models.py | py | 3,690 | python | en | code | 0 | github-code | 13 |
2747611762 | from telegram import ParseMode, Update
from telegram.ext import CallbackContext
from tgbot.handlers.vpn import static_text
from tgbot.handlers.utils.info import extract_user_data_from_update
from users.models import User
from payment.utils import create_payment_for_user
from tgbot.handlers.vpn.keyboards import make_ke... | amirshabanics/vpn-hiddify-telegram-bot | tgbot/handlers/vpn/handlers.py | handlers.py | py | 3,724 | python | en | code | 4 | github-code | 13 |
71045582417 | from rest_framework import serializers
from .models import Video, Comment, Like
class VideoSerializer(serializers.ModelSerializer):
video = serializers.FileField()
class Meta:
model = Video
fields = ('user', 'title', 'video', 'slug', 'created_at', 'updated_at',)
read_only_fields = ('us... | devbobnwaka/video_streaming_app_drf | backend/videos/serializers.py | serializers.py | py | 779 | python | en | code | 0 | github-code | 13 |
13431904405 | chains = [0] * (10 ** 6 + 2)
def colatz(n):
if n == 1:
return 1
elif len(chains) > n and not chains[n] == 0:
return chains[n]
elif n % 2 == 1:
return (1 + colatz(n * 3 + 1))
else:
return (1 + colatz(n // 2))
def solve(target):
longest = [1, 1]
for i in range(1... | thindo/projecteuler | python/pe014.py | pe014.py | py | 537 | python | en | code | 0 | github-code | 13 |
73607329616 | import functools
import logging
import logging.config
from contextlib import contextmanager
from logging import getLogger
from logging.handlers import QueueHandler, QueueListener
from trollflow2 import MP_MANAGER
DEFAULT_LOG_CONFIG = {'version': 1,
'disable_existing_loggers': False,
... | pytroll/trollflow2 | trollflow2/logging.py | logging.py | py | 4,241 | python | en | code | 7 | github-code | 13 |
8619185158 | import numpy as np
import xarray as xr
import argparse
import configparser
import pickle
import image_generator
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callbacks import TensorBoard, ReduceLROnPlateau, ModelCheckpoint, EarlyStopping
from model import leveeNet
parser = argparse.ArgumentParser... | windsor718/leveeNet | model/cnn/test.py | test.py | py | 2,505 | python | en | code | 4 | github-code | 13 |
44435806066 |
import re
# read the file
mobydick = open('moby_dick.txt').read()
# remove crap
mobydick = mobydick.lower()
mobydick = re.sub('[\*\.\!\"\;\?,\d]','',mobydick)
mobydick = re.sub("[\-\(\)\']",' ',mobydick)
# chop it into a list of words.
words = mobydick.split()
out = "Moby Dick contains %8i words."%(l... | krother/Python3_Basics_Tutorial | challenges/count_words/count_words.py | count_words.py | py | 684 | python | en | code | 32 | github-code | 13 |
73306389779 | from math import sqrt
def is_prime(x):
if x < 2:
return False
for i in range(2, int(sqrt(x)) + 1):
if x % i == 0:
return False
return True
# syntax -> expr(item) for item in iterable if predicate(item)
# note that the most simple expression for the comprehension can be the ow... | diego-guisosi/python-norsk | 01-fundamentals/chapter08/filtering_comprehensions.py | filtering_comprehensions.py | py | 529 | python | en | code | 0 | github-code | 13 |
3094417427 | #encoding = utf-8
import torch
import os
import copy
from PIL import Image
import shutil
import numpy as np
import dlib
import cv2
import sys
from config_mask import config
import torchvision.transforms as transforms
from torch.nn.modules.distance import PairwiseDistance
pwd = os.path.abspath(__file__+'../../')
os.envi... | ZouJiu1/Mask_face_recognitionZ | compare.py | compare.py | py | 8,530 | python | en | code | 29 | github-code | 13 |
6269857607 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 19 22:20:58 2019
@author: E442282
"""
import numpy as np
import cv2
import os,sys
from matplotlib import pyplot as plt
from numpy.lib.stride_tricks import as_strided
def getColorSpaces(image):
rgb = cv2.cvtColor(image,cv2.COLOR_RGB2BGR)
gray = cv2.cvtColor(imag... | ddurgaprasad/DIP | Assignment2/src/Q5.py | Q5.py | py | 8,234 | python | en | code | 0 | github-code | 13 |
9521163577 | from __future__ import absolute_import, unicode_literals
import logging
from dataclasses import dataclass
from datetime import datetime, timedelta
from decimal import Decimal
from django.apps import apps
from fractions import Fraction
from functools import reduce
from typing import Tuple, List
from annoying.function... | silverapp/silver | silver/models/subscriptions.py | subscriptions.py | py | 56,720 | python | en | code | 292 | github-code | 13 |
16824599754 | """Schema for database name-space."""
from marshmallow import Schema, post_load
from marshmallow.fields import Float, Integer, List, Nested, String
from hyrisecockpit.api.app.database.model import (
AvailableWorkloadTables,
Database,
DetailedDatabase,
WorkloadTables,
)
class DatabaseSchema(Schema):
... | hyrise/Cockpit | hyrisecockpit/api/app/database/schema.py | schema.py | py | 2,903 | python | en | code | 14 | github-code | 13 |
74079555856 | from bs4 import BeautifulSoup
import requests
import time
#url = 'http://jimo.baixing.com/ershouqiche/a1184041036.html'
# 获取一页的网页信息
def get_links_from():
urls = []
list_view = 'http://qingdao.baixing.com/ershouqiche/'
wb_data = requests.get(list_view)
soup = BeautifulSoup(wb_data.text,'lxml')
html... | HanChanXiaMing/Crawler | baixinwang.py | baixinwang.py | py | 1,058 | python | en | code | 0 | github-code | 13 |
14766814210 | # preprocess data
from sklearn.svm import SVC
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from keras.models import load_model
from .Scraper import *
class PreProcess:
def __init__(self, url):
self.url = url
def process(self):... | aaditkapoor/Rate-My-Professor-Sentiment-Analysis | rmpsentiment/preprocess.py | preprocess.py | py | 900 | python | en | code | 1 | github-code | 13 |
7165417781 | import os
import argparse
import json
import numpy as np
import pandas as pd
from flask import Flask, render_template, request, redirect, send_file
from flask_talisman import Talisman
from plots.climate import get_PM25_plot, get_NO2_plot, get_PM25_plot_diff, get_NO2_plot_diff
from plots.dark import get_cases_plot, ge... | mayukh18/covidexplore | app.py | app.py | py | 2,849 | python | en | code | 5 | github-code | 13 |
72842986578 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import os
import sys
import configparser
from slackclient import SlackClient
try:
syspath = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.path.pardir))
sys.path.insert(0, syspath)
from settings import LACK_BOT_TOKEN as TOKEN
excep... | gra230434/slackbot_smartone | Functions/trustuser.py | trustuser.py | py | 8,698 | python | en | code | 0 | github-code | 13 |
37482029634 | '''
기준 값을 몇으로 둘것이냐 ?
--> 배열의 최소값과 최대값사이에 모든 값들(X)
--> 0부터 최대값 사이에 모든 값들(O)
'''
import sys
sys.setrecursionlimit(100000)
rainList = [] # 기준 장마 리스트
resultList = [] # 각 영역마다 리스트
maxs = 0 # 장마 리스트 안의 최대값
N = int(input())
for i in range(N):
val = list(map(int,input().split()))
if max(val) > maxs:
max... | Choi-Seong-Hyeok/Algorithm | DFS/안전영역(rt).py | 안전영역(rt).py | py | 1,560 | python | ko | code | 0 | github-code | 13 |
71497060499 | # 언어 : Python
# 날짜 : 2021.09.21
# 문제 : KOREATECH JUDGE > 쉬운 수학, 어려운 프로그래밍 (2020년도 F번 문제)
# 풀이 : 이분 탐색으로 풀어야지 풀리는 문제..
# ========================================================================
import math
import sys
def solution():
available = []
num = 1
low, high = 0, math.pow(2, 32) - 1
while low ... | eunseo-kim/Algorithm | Koreatech Judge/F_이 회사의 순이익이 궁금해.py | F_이 회사의 순이익이 궁금해.py | py | 846 | python | ko | code | 1 | github-code | 13 |
33436027531 | import cv2 as cv
import numpy as np
from tkinter import *
from PIL import ImageTk, Image
from copy import deepcopy
class MainSolution():
def __init__(self):
self.image = cv.imread("Adams_The_Tetons_and_the_Snake_River.jpg")
self.imgray = None
self.trsh1 = None
self.trsh2 = None
... | NikitaMantush/PCG_2022 | Laba 3/Code/Laba3.py | Laba3.py | py | 9,407 | python | en | code | 0 | github-code | 13 |
14386187385 | #
# @lc app=leetcode.cn id=102 lang=python3
#
# [102] 二叉树的层序遍历
#
from typing import List
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def ... | largomst/leetcode-problem-solution | 102.二叉树的层序遍历.2.py | 102.二叉树的层序遍历.2.py | py | 1,060 | python | en | code | 0 | github-code | 13 |
21660436864 | import jax
import jax.numpy as jnp
import functools
import psutil
import diffrax as dfx
import sys, gc
def value_and_jacfwd(f, x):
"""Create a function that evaluates both fun and its foward-mode jacobian.
Only works on ndarrays, not pytrees.
Source: https://github.com/google/jax/pull/762#issuecomment-100226712... | fhchl/quant-comp-ls-mod-ica22 | src/jaxutil.py | jaxutil.py | py | 1,395 | python | en | code | 7 | github-code | 13 |
3995532547 | # Aumentos Múltiplos
sal = float(input('Digite o Valor do seu Salário: '))
if sal >= 1250.0:
aum10 = sal + (sal * 0.10)
#aum10 = sal + (sal * 10 / 100)
print(f'Seu Salário de R${sal} receberá um aumento de 10%, você receberá {aum10} ')
else:
aum15 = sal + (sal * 0.15)
#aum15 = sal + (sal * 15 / 10... | PatrickPortes/ProjetoAulasPython | cursoemvideo/mundo1/exercicios/ex034.py | ex034.py | py | 420 | python | pt | code | 0 | github-code | 13 |
26948285633 | import pyrebase
import json
class DBhandler:
def __init__(self):
with open('flask-server/authentication/firebase_auth.json') as f:
config = json.load(f)
firebase = pyrebase.initialize_app(config)
self.db = firebase.database()
firebaseEmailAuth = firebase.auth()
#회원가입... | euWna/osp_project | flask-server/database.py | database.py | py | 8,697 | python | en | code | 0 | github-code | 13 |
40445255722 | def proteins(strand):
my_dict = dict(AUG='Methionine', UUU='Phenylalanine',
UUC='Phenylalanine', UUA='Leucine', UUG='Leucine',
UCU='Serine', UCC='Serine', UCA='Serine',
UCG='Serine', UAU='Tyrosine', UAC='Tyrosine',
UGU='Cysteine', UGC='Cyst... | CatalinPetre/Exercism | python/protein-translation/protein_translation.py | protein_translation.py | py | 669 | python | en | code | 0 | github-code | 13 |
3079757015 | #4) Go to https://catalog.umkc.edu/course-offerings/graduate/comp-sci/ and fetch the course name and overview of
# course. Hint:Use BeautifulSoup package.
from bs4 import BeautifulSoup
import requests
# Enter URL to fetch the data
url = requests.get("https://catalog.umkc.edu/course-offerings/graduate/comp-sci/... | adtmv7/CS5590-490-Python-Deep-Learning | LAB1/Source/Lab1_Q4.py | Lab1_Q4.py | py | 823 | python | en | code | 2 | github-code | 13 |
29330455573 | import random
import math
import copy
import numpy as np
from config.slam_settings import unitGridSize
from config.ik_settings import MOVING_FRONT_SAFE_DISTANCE, MOVING_REAR_SAFE_DISTANCE
from matplotlib import pyplot as plt
class Node():
def __init__(self, x, y):
self.x = x
self.y = y
se... | Nickel-nc/Sprite | scripts/path_finding/rrt_star.py | rrt_star.py | py | 13,289 | python | en | code | 0 | github-code | 13 |
70327376979 | import sys
import math
import re
import os
import base64
import streamlit as st
def amorpm(temp):
log_0_h = int(temp[0][0])
log_0_m = int(temp[0][1])
log_1_h = int(temp[1][0])
log_1_m = int(temp[1][1])
m=0
if(log_0_h == 12):
if(log_1_h != 12):
log_1_h = log_1_... | kingcv/tlparser | main.py | main.py | py | 5,451 | python | en | code | 0 | github-code | 13 |
72951884177 | import json
from collections import Counter
def is_balanced(inp_str):
'''
Check if input string has balanced number of brackets e.g.:
{[()]} - balanced
{{[ }}] - unbalanced
{()}[]() - balanced
:return: bool: returns True if string could be considered as balanced
'''
c = Cou... | broHeryk/test_fwrks | pytest_samples/logic_functions.py | logic_functions.py | py | 789 | python | en | code | 0 | github-code | 13 |
16980065514 | import socket
client = socket.socket()
client.connect(("localhost", 20000))
while True:
cmd = input(">>:")
if not len(cmd): continue
client.send(cmd.encode("utf-8"))
data_size = client.recv(1024).decode()
client.send(b"1")
data = b""
data_size = int(data_size)
print(data_size)
... | nehzx/PythonStudy | study/day7/new_ssh/client_ssh.py | client_ssh.py | py | 497 | python | en | code | 0 | github-code | 13 |
71065924498 | import nasapy
import os
import pandas
from datetime import date, timedelta
import urllib.request
from database import Image, db
key = "3pdvIP08fK1EEb7QJ1HaJliJVaahITfuWeJ36hkF"
nasa = nasapy.Nasa(key = key)
start_date = date(2019, 1, 1)
end_date = date(2020, 1, 1)
delta = timedelta(days=1)
while start_date <= end_d... | EstebanLeiva/AstronomyAPI | src/image_population.py | image_population.py | py | 662 | python | en | code | 0 | github-code | 13 |
9384350177 |
from distutils.core import setup, Extension
import sys
if sys.version_info[0] > 2:
swig_opts = ['-py3']
else:
swig_opts = ['-DPYTHON2']
# 'build_ext' must be run before 'build_py' to create 'corpustools.py'
for i in range(1, len(sys.argv)):
if sys.argv[i] == 'build_ext':
break
if sys.argv[i] ... | rug-compling/Alpino | Suites/ChildesDutch/setup.py | setup.py | py | 987 | python | en | code | 19 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.