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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
69975743699 | """
1. casing does not matter - done via .lower()
2. do not count punctuation symbols, digits, whitespaces.. - done via regex
3. if you have two or more letters with the same frequency, then return the letter which comes first in the alphabet
"""
# done in 3 hours
import re
from collections import Counter
clean = ... | chicocheco/checkio | home/wanted_letter.py | wanted_letter.py | py | 1,490 | python | en | code | 0 | github-code | 13 |
42794287361 | def arithmetic_arranger(problems, optional=None):
if len(problems) > 5:
return("Error: Too many problems.")
for i in range(len(problems)):
if '+' not in problems[i] and '-' not in problems[i]:
return("Error: Operator must be '+' or '-'.")
for i in range(len(problems)):
... | maanuw/Scientific_Computing_With_Python | arithmetic_arranger/arithmatic_arranger.py | arithmatic_arranger.py | py | 3,447 | python | en | code | 0 | github-code | 13 |
6101140806 | from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
from posts.models import Posts, Users
from django.contrib.auth.models import User
class Genre(MPTTModel):
blog = models.ForeignKey(Posts, on_delete=models.CASCADE, related_name='comment')
name = models.ForeignKey(Users, on_delete=m... | cyberchao/Blog | comment/models.py | models.py | py | 678 | python | en | code | 1 | github-code | 13 |
31923319673 | from flask import Flask, jsonify, request
import flask_cors
from predictors.disease_predictor import disease_predictor, add_data_to_model
from predictors.symptom_predictor import predict_next_symptoms
app = Flask(__name__)
flask_cors.CORS(app)
import pandas as pd
@flask_cors.cross_origin()
@app.route('/symptoms', ... | anjsudh/ml-hack | server/server.py | server.py | py | 2,651 | python | en | code | 2 | github-code | 13 |
32598547336 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# 导入tkinter包,为其定义别名tk
import tkinter as tk
import docx
import xlrd
import time
import sys
import threading
from tkinter import ttk
from docx.shared import Pt
from tkinter import filedialog
from tkinter import messagebox
from docxtpl import DocxTemplate
from PIL import Image, I... | sulmt/py_analysis_word | wordBig V1.0/wordBig.py | wordBig.py | py | 12,209 | python | en | code | 0 | github-code | 13 |
9532276066 | # -*- coding:utf-8 -*-
import helpers
import string_utils
def compute_logs_interval(pattern, base_log, compared_log):
time1 = helpers.get_log_time(base_log, pattern)
time2 = helpers.get_log_time(compared_log, pattern)
if not time1 or not time2:
return None
time_ms1 = string_utils.str_time_long... | LittleOrchid/AndroidLogTools | anlysize/methods/log_interval.py | log_interval.py | py | 407 | python | en | code | 0 | github-code | 13 |
34654113526 | import base64
import httplib
import json
import logging
import os
import flask
from google.appengine.api import mail
import jinja2
app = flask.Flask(__name__)
# The build statuses that will trigger a notification email.
_STATUSES_TO_REPORT = ('SUCCESS', 'FAILURE')
_TAGS_TO_REPORT = frozenset(['feedloader'])
# Get e... | google/feedloader | appengine/build_reporter/main.py | main.py | py | 2,800 | python | en | code | 9 | github-code | 13 |
40131569530 | # -*- coding: utf-8 -*-
import itertools as it
def solution(numbers, target):
answer = 0
for i in range(len(numbers)+1):
tmp = it.combinations(range(len(numbers)), i) #0~len(numbers)만큼 뽑
for j in tmp: #tmp에서 튜플 하나씩 꺼내기
tmp_numbers = numbers[:] #numbers 원본 복사
... | dlwlstks96/codingtest | 프로그래머스/깊이,너비우선탐색_타겟넘버.py | 깊이,너비우선탐색_타겟넘버.py | py | 809 | python | ko | code | 2 | github-code | 13 |
21571675123 | from flask import Flask
import pandas as pd
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
df = pd.read_excel("PrecoMerc.xlsx")
@app.route("/bydate/<date>")
def date(date):
rows = df.loc[(df['Data'] == date) & (df["Sessão"] == 0), "Preço - PT [€/MWh]"]
return rows.tolist()
| luciusvinicius/personal-sauna | EnergyApi/app.py | app.py | py | 303 | python | en | code | 0 | github-code | 13 |
37991160552 | # Oauth/OIDC
OAUTH_SERVERS = ["google"]
# Authlib
GOOGLE_SERVER_METADATA_URL = 'https://accounts.google.com/.well-known/openid-configuration'
GOOGLE_CLIENT_KWARGS = {'scope': 'openid'}
# Globals
MAX_NAME_LENGTH = 16
NEW_USER_KEY_LENGTH = 8
| Dronesome-Archive/server | config.py | config.py | py | 242 | python | en | code | 0 | github-code | 13 |
15153542252 | import pandas as pd
from textblob import TextBlob
#importing the data
ds=pd.read_csv("CEH_exam_negative_reviews.csv")
ds
#converting the csv file to string format
dataset=ds.to_string(index=False)
type(dataset)
dataset
blob = TextBlob(dataset)
print(blob.sentiment)
#data cleaning
import re
data... | pbt12/CHE_model | C.H.E_model.py | C.H.E_model.py | py | 1,602 | python | en | code | 0 | github-code | 13 |
39282126520 | # Created by Qingzhi Ma at 18/11/2019
# All right reserved
# Department of Computer Science
# the University of Warwick
# Q.Ma.2@warwick.ac.uk
# from builtins import print
import category_encoders as ce
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as functional
from qregpy import qre... | qingzma/DBEstClient | dbestclient/executor/test.py | test.py | py | 1,953 | python | en | code | 14 | github-code | 13 |
3966970121 | from datetime import datetime
from django.shortcuts import render, redirect, reverse, get_object_or_404
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from accounts.models import Profile
from products.models import Product
from shopping_cart.models import OrderItem, Order
... | thinh9e/learn-django | shoppingcart/shopping_cart/views.py | views.py | py | 2,967 | python | en | code | 0 | github-code | 13 |
10699216899 | from sklearn.svm import SVC
from sklearn.cross_validation import train_test_split
import numpy as np
from sklearn.preprocessing import StandardScaler
def preProcess(X):
scalar=StandardScaler()
scalar.fit(X)
X=scalar.transform(X)
return X
def trainTest(x_train,x_test,y_train,y_test):
sv... | vineetjoshi253/Image-based-Indian-Monument-Recognition-using-Convoluted-Neural-Networks | Edge_Svm.py | Edge_Svm.py | py | 862 | python | en | code | 1 | github-code | 13 |
31902219311 | """
This module scrapes the lyrics of Etta James and Billy Joel form lyrics.com and saves it as as .csv file
"""
import re
import pandas as pd
import requests
from bs4 import BeautifulSoup
ETTA = 'Etta'
JAMES = 'James'
URL_ETTA = 'https://www.lyrics.com/artist.php?name=Etta-James&aid=387&o=1'
BILLY = 'Billy'
JOEL = ... | helenaEH/Lyrics_classifier_NLP | lyrics_scraper.py | lyrics_scraper.py | py | 1,459 | python | en | code | 0 | github-code | 13 |
71418789459 | # key_vault.py
from azure.identity import ClientSecretCredential
from azure.keyvault.secrets import SecretClient
from config import TENANT_ID, CLIENT_ID, CLIENT_SECRET, KEY_VAULT_NAME
def get_secret_client():
credential = ClientSecretCredential(
tenant_id=TENANT_ID,
client_id=CLIENT_ID,
cl... | crisroco/auzure_key_vault_integration_py | key_vault.py | key_vault.py | py | 704 | python | en | code | 0 | github-code | 13 |
22829551404 | from django.shortcuts import render, redirect, get_object_or_404
from django.utils import timezone
from .models import Post, Profile
from django.contrib.auth import login, authenticate
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from blog.forms import SignUpForm, ImageUpload... | poltimmer/2ID60 | blog/views.py | views.py | py | 6,243 | python | en | code | 0 | github-code | 13 |
26301902842 | import colorlog
handler = colorlog.StreamHandler()
handler.setFormatter(colorlog.ColoredFormatter(
fmt='%(log_color)s %(asctime)s : %(message)s',
datefmt='%m-%d %H:%M:%S'
))
logger = colorlog.getLogger('example')
logger.setLevel('DEBUG')
logger.addHandler(handler)
| naveennvrgup/smart-traffic-light | IOTdevices/logger.py | logger.py | py | 275 | python | en | code | 0 | github-code | 13 |
26002995515 | # Напишите программу, которая принимает на вход вещественное число и показывает сумму его цифр.
x1 = float(input()) + 100 # + 100, чтобы при * 10 не возникало погрешностей .. например: 0.56 * 10 = 5.6000000000000005
sum_number = 0
while x1 != 0:
if x1 - int(x1) == 0:
sum_number += x1 % 10
x1 //= 10... | Pol888/home_work_py_2 | task1.py | task1.py | py | 660 | python | ru | code | 0 | github-code | 13 |
70139884818 |
import unittest
import medsrtqc.qc.history as hist
class TestHistory(unittest.TestCase):
def test_qctests(self):
hexval = hex(2**63 + 2**4)
tests = hist.read_qc_hex(hexval)
self.assertEqual(tests, [4, 63])
qc_arr = hist.qc_array(hexval)
self.assertTrue(qc_arr[hist.test_in... | ArgoCanada/medsrtqc | tests/test_history.py | test_history.py | py | 838 | python | en | code | 0 | github-code | 13 |
7040889528 | """
Code for investigating the effect of recurrent connections in a two-layer hierarchical PCN
i.e. a latent variable model.
Laten variable: x, observations $y \sim N(Wx, \Sigma)$. Goal is to find the most likely x and model parameter W
"""
import torch
import torch.nn as nn
import random
import numpy as np
import ma... | C16Mftang/covariance-learning-PCNs | tests/hierarchical_PCNs.py | hierarchical_PCNs.py | py | 6,699 | python | en | code | 3 | github-code | 13 |
14646824175 | from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Table
from . import metadata
SourceTransactionJson = Table(
"source_transactionjson",
metadata,
Column(
"ach_credit_transfer",
SourceTransactionAchCreditTransferData,
ForeignKey("SourceTransactionAchCreditTransfer... | offscale/stripe-sql | stripe_openapi/source_transaction.py | source_transaction.py | py | 2,567 | python | en | code | 1 | github-code | 13 |
23697861696 | import sys
class Research:
def __init__(self, path_to_the_file):
self.file_path = path_to_the_file
def file_reader(self):
try:
with open(self.file_path) as f:
lines = f.readlines()
if len(lines) < 2:
raise Exception
for line in lines:
if len(line.split(',')) != 2:
raise Exception... | hrema/Python-Data-Science | day02/ex02/first_constructor.py | first_constructor.py | py | 578 | python | en | code | 0 | github-code | 13 |
33935154530 | import numpy as np
class Road():
def __init__(self, DATA, param):
'''
area_num 节点数量
Road_network 路网连接拓扑
Road_length 道路长度
Road_grade 道路等级
Road_capacity 道路通行能力
Road_flow 道路流量
Road_charge 道路充电需求
a_b_n 道路等级对应参数
'''
... | rightyou/- | 需求响应/EVA_SecneGeneration/Road_network.py | Road_network.py | py | 878 | python | en | code | 0 | github-code | 13 |
30850429315 | import time
import pyupbit
import datetime
import schedule
from fbprophet import Prophet
import numpy as np
access = "0hNyHckgUEQ0GpFb97xmHOtLGKx8AevNu7pzz2Vo"
secret = "NtOH4y4d3G2I4gG13G1KVhAYhPck2xWMxLd6xYvd"
def get_target_price(ticker, k):
"""변동성 돌파 전략으로 매수 목표가 조회"""
df = pyupbit.get_ohlcv(ti... | wlsdn031/aitrust | ai.py | ai.py | py | 4,309 | python | en | code | 0 | github-code | 13 |
40113048879 | from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from database import get_db
import schemas
from crud.authentication import get_current_user
import crud.users
router = APIRouter(
prefix="/users",
tags=["users"],
)
# ________________POST________________
@router.post(... | forza111/fastapi_simple_api | routers/users.py | users.py | py | 1,317 | python | en | code | 0 | github-code | 13 |
18989205094 | #Python 3 Example of how to use https://macvendors.co to lookup vendor from mac address
import pandas as pd
url = "https://macvendors.co/api/00:00:00:00:00:00/csv"
#url = "https://macvendors.co/api/00:B2:E8:00:00:00/csv"
df = pd.read_csv(url)
txt = str(len(df.columns))
print(txt)
#Fix: json object must be str, not '... | marzam/python-script-occupation | mac-vendor.py | mac-vendor.py | py | 606 | python | en | code | 0 | github-code | 13 |
36684347796 | from selenium.webdriver.common.by import By
from selenium import webdriver
from bs4 import BeautifulSoup
import requests
import csv
from selenium.common.exceptions import NoSuchElementException, ElementClickInterceptedException
import re
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.... | imaneelbakk/matching_resume | MAROCANNONCESscraping.py | MAROCANNONCESscraping.py | py | 3,154 | python | en | code | 0 | github-code | 13 |
28176017860 | import json
import datetime
import calendar
import logging
import itertools
import threading
import json
from requests_futures.sessions import FuturesSession
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from concurrent.futures import ThreadPoolExecut... | InternetHealthReport/raclette | raclette/atlasrestreader.py | atlasrestreader.py | py | 5,135 | python | en | code | 8 | github-code | 13 |
33961492235 | import requests
from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def get_players_info():
result = ""
if not request.args.get("count") or not request.args.get("players"):
return "no players or count</br>"
players_count = int(request.args.get("count"))
players = request.a... | F0RQU1N/dota_new_hack | !dota_new_hack/core/overwolf_server.py | overwolf_server.py | py | 848 | python | en | code | 10 | github-code | 13 |
8422785657 | x = int(input("Gib die erste Zahl ein: "))
y = int(input("Gib die zweite Zahl ein: "))
operation = input("Wähle eine Rechenart (+, -, *, /): ")
def add(x, y):
print (x + y)
def subtract(x, y):
print (x - y)
def multiplication(x, y):
print (x * y)
def division(x, y):
print (x / y)
if operation == ... | katpol/homework | calculator_functions_hw5.py | calculator_functions_hw5.py | py | 525 | python | de | code | 0 | github-code | 13 |
7260342501 | # Two players are playing a game of Tower Breakers! Player always moves first, and both players always play optimally.The rules of the game are as follows:
# Initially there are towers.
# Each tower is of height .
# The players move in alternating turns.
# In each turn, a player can choose a tower of height and red... | siobhankb/recursion-practice | tower-breakers.py | tower-breakers.py | py | 5,027 | python | en | code | 0 | github-code | 13 |
8119076492 | from __future__ import print_function
from __future__ import division
import di_i2c
import time
# Constants
SYSRANGE_START = 0x00
SYSTEM_THRESH_HIGH = 0x0C
SYSTEM_THRESH_LOW = 0x0E
SYSTEM_SEQUENCE_CONFIG = 0x01
SYST... | DexterInd/DI_Sensors | Python/di_sensors/VL53L0X.py | VL53L0X.py | py | 37,337 | python | en | code | 12 | github-code | 13 |
74527851216 | __author__ = 'Gabor Wnuk'
__date__ = '$Date: 2016-05-07 18:47:03 +0200 (Sat, 7 May 2016) $'
import sqlite3
SQLITE_PATH = '/Users/GaborWnuk/irrigator.db'
"""Geolocation (for weather
"""
LATITUDE_AND_LONGITUDE = (52.227578, 20.986796)
"""Water pump
"""
WATER_PUMP_RELAY_GPIO = 4
WATER_PUMP_LITER_PER_MINUTE = 3.4
"""U... | GaborWnuk/irrigator | src/nuke/irrigator/settings.py | settings.py | py | 1,225 | python | en | code | 0 | github-code | 13 |
18306577335 | import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
class AppLayout(GridLayout):
def __init__(self, **kwargs):
super(AppLayout,self).__init__(**kwargs)
self.cols... | TGITS/programming-workouts | python/kivy/codemy_tutorial/basic_kivy_gui.py | basic_kivy_gui.py | py | 1,282 | python | en | code | 0 | github-code | 13 |
37264406131 | import os
from pathlib import Path
import time
import random
import numpy as np
import parse_intent
import utils
import dataset_io as dio
import parameter_io as pio
import population_funcs
class Universe(object):
"""
Create the universe of the simulation.
"""
def __init__(self,
dat... | blossom-evolution/blossom | blossom/universe.py | universe.py | py | 9,995 | python | en | code | 8 | github-code | 13 |
1589534672 | import os
import sys
import time
while True:
print("==============检测nginx是否正在运行===============")
time.sleep(4)
try:
ret = os.popen('ps -C nginx -o pid,cmd').readlines()
if len(ret) < 2:
print("nginx进程异常退出,4秒后重启")
time.sleep(3)
os.system('service nginx res... | Abeautifulsnow/python_learning | scripts/python/monitor_nginx.py | monitor_nginx.py | py | 535 | python | en | code | 0 | github-code | 13 |
15886489152 | from collections import defaultdict
from random import random
import numpy as np
import pandas as pd
from category_encoders import OrdinalEncoder, TargetEncoder
from joblib import parallel_backend
from matplotlib import pyplot as plt
from matplotlib.font_manager import FontProperties
from scipy.cluster import hierarch... | Lieve2/ADSthesis_multiverse_analysis | utility_functions.py | utility_functions.py | py | 10,034 | python | en | code | 1 | github-code | 13 |
26052190040 | import time
from django.shortcuts import get_object_or_404
from rest_framework import permissions, status, views
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework_simplejwt.tokens import AccessToken
from users.models import User
from .mixins import Retrieve... | grmzk/referral_system | referral_system/api/views.py | views.py | py | 3,016 | python | en | code | 0 | github-code | 13 |
72349910098 | import os
import math
import torch
from torch.nn import BCEWithLogitsLoss
from transformers import XLNetTokenizer, XLNetModel
from keras.preprocessing.sequence import pad_sequences
import numpy as np
import pandas as pd
import sentencepiece
import logging
from logtail import LogtailHandler
"""
Define the classifica... | aiswaryasankar/dbrief | polarityModel/training.py | training.py | py | 4,883 | python | en | code | 1 | github-code | 13 |
33565489268 | import shelve, time
arguments = ["self", "info", "args", "world"]
helpstring = "vote <topic #> <choice #>"
minlevel = 1
def main(connection, info, args, world) :
"""Lets user vote"""
votes = shelve.open("votes.db", writeback=True)
if votes["networks"][connection.networkname][int(args[1]) - 1]["started"] :
... | sonicrules1234/sonicbot | oldplugins/vote.py | vote.py | py | 1,380 | python | en | code | 10 | github-code | 13 |
20602914664 | import pandas as pd
import numpy as np
from preprocessing.indicators import *
coins = ['BCH', 'BTC', 'ETH', 'LTC', 'XRP']
coins_idx = {'BCH': 0, 'BTC': 1, 'ETH': 2, 'LTC': 3, 'XRP': 4}
def process_one(coin):
df = pd.read_csv("./data/Bitstamp_" + coin + "USD.csv", low_memory=False)
data_macd = macd(df)
dat... | sanchitvohra/crypto-bot | preprocessing/create_dataset.py | create_dataset.py | py | 1,190 | python | en | code | 0 | github-code | 13 |
73789561619 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#!pip install nest-asyncio
# In[ ]:
import numpy as np
import pandas as pd
from requests_html import HTMLSession#, AsyncHTMLSession
from bs4 import BeautifulSoup
from datetime import date
import re
import json
from urllib.parse import unquote
# In[ ]:
debug_mode... | mariomirow/scraping_beauty | 01_Scripts/scraper_falabella.py | scraper_falabella.py | py | 7,793 | python | en | code | 0 | github-code | 13 |
38731827941 |
"""
sources:
https://github.com/norabelrose/transformers-plus-performers/
"""
from dataclasses import dataclass
from typing import Callable, Sequence, Optional, Union
from enum import Enum
PerformerKernel = Enum('PerformerKernel', ['cosh', 'exp', 'elu', 'relu'])
OrthogonalFeatureAlgorithm = Enum('OrthogonalFeatureAl... | LuCeHe/pyaromatics | keras_tools/configuration_performer_attention.py | configuration_performer_attention.py | py | 7,658 | python | en | code | 6 | github-code | 13 |
44597138815 | import logging
from django.http import HttpRequest, JsonResponse
from .models import Room
logger = logging.getLogger(__name__)
def index(request: HttpRequest) -> JsonResponse:
return JsonResponse({"message": "Success", "user": str(request.user)})
def room(request: HttpRequest, room_name: str) -> JsonResponse... | martasd/moving-fast-backend | apps/chat/views.py | views.py | py | 651 | python | en | code | 0 | github-code | 13 |
17061056224 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.Money import Money
class TuitionInremitOrder(object):
def __init__(self):
self._alipay_payment_id = None
self._isv_payment_id = None
self._order_creat... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/TuitionInremitOrder.py | TuitionInremitOrder.py | py | 6,122 | python | en | code | 241 | github-code | 13 |
42166207440 | import os
import shutil
from admin import Admin
from autoit import Autoit
from base import Base
from category import Category
from channel import Channel
from clsQrCodeReader import QrCodeReader
import clsTestService
from editEntryPage import EditEntryPage
from entryPage import EntryPage
from general import General
fro... | NadyaDi/kms-automation | web/lib/clsCommon.py | clsCommon.py | py | 19,736 | python | en | code | 0 | github-code | 13 |
13377918791 | import requests
import json
import re
from bs4 import BeautifulSoup
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
import csv
import html
import time
from datetime import datetime
def recent_posts(username,no_of_post = 50):
"""With the input of an account page and number... | tlylt/Social-Media-Dashboard | insta_likes_v1.py | insta_likes_v1.py | py | 2,570 | python | en | code | 1 | github-code | 13 |
70696627219 | import cv2
import numpy as np
frameHeight = 480
frameWidth = 640
cap = cv2.VideoCapture(1)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
while True:
_, img = cap.read()
cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
cv2.imshow("Original", img)
# cv2.imshow("OriginalHsv", imgHsv)
if cv2.waitKey(1) & 0xFF ... | anant-harryfan/Python_basic_to_advance | PythonTuts/Python_other_tuts/murtaza_workshop/open-cv/Tut8_Realtime_Color_Detection.py | Tut8_Realtime_Color_Detection.py | py | 385 | python | en | code | 0 | github-code | 13 |
31740291885 | # encoding: utf-8
"""
@author: nanjixiong
@time: 2020/6/27 16:06
@file: examle7.py
@desc:
"""
from urllib import request,parse
url='http://localhost/post'
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
'Host':''
}
di... | lixixi89055465/py_stu | crawler/urllib/examle7.py | examle7.py | py | 536 | python | en | code | 1 | github-code | 13 |
74176815699 | import requests
from io import BytesIO
import numpy as np
from PIL import Image
import psycopg2
from datetime import datetime
import nongit
def main():
r = requests.get("https://api.tomtom.com/traffic/map/4/tile/flow/relative/11/1136/693.png?key="+nongit.apikey())
stream = BytesIO(r.content)
UL = Image.... | GrzegorzZmuda/korki | tomtomrequest.py | tomtomrequest.py | py | 2,066 | python | en | code | 0 | github-code | 13 |
25296865050 | import mock
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
from sawps.tests.models.account_factory import (
UserF,
)
from population_data.models import AnnualPopulation, AnnualPopulationPerActivity
from species.models import OwnedSpecies
from species.factories import TaxonFac... | kartoza/sawps | django_project/population_data/tests/test_utils.py | test_utils.py | py | 4,431 | python | en | code | 0 | github-code | 13 |
7337615354 | from django.shortcuts import render, redirect, reverse
from django.views import generic
from django.http import HttpResponse
from django.core.mail import send_mail
from .models import Lead, Agent
from .forms import LeadForm, CustomerForm
from django.contrib.auth.decorators import login_required
from django.contrib.auth... | Taoheed-O/CRM_w_Django | TCRM/leads/views.py | views.py | py | 2,941 | python | en | code | 1 | github-code | 13 |
37215916107 | #!/usr/bin/env python
import petl as etl
from datetime import datetime
print("PULSE DATA")
pulse_tab = (
etl
.fromcsv('measurements.csv')
.convert('value', float)
.convert('value', int)
.convert('timestamp', int)
.convert('timestamp', lambda t: datetime.fromtimestamp(int(t/1000.0)))
)
print(pul... | jdgwartney/measurement-debugging | munge.py | munge.py | py | 654 | python | en | code | 0 | github-code | 13 |
32823716282 | #!/usr/bin/env python3
"""
@summary: test Ethereum RPC = helps to identify the correct RPC-address
@version: v60 (26/October/2020)
@since: 26/October/2020
@author: https://github.com/drandreaskrueger
@see: https://github.com/drandreaskrueger/chainhammer for updates
"""
from pprint import pprint
import requests... | drandreaskrueger/chainhammer | hammer/test_RPC.py | test_RPC.py | py | 2,361 | python | en | code | 121 | github-code | 13 |
39109886012 | import tensorflow as tf
import numpy as np
import time
from asynch_mb.logger import logger
class Trainer(object):
"""
Performs steps for MAML
Args:
algo (Algo) :
env (Env) :
sampler (Sampler) :
sample_processor (SampleProcessor) :
baseline (Baseline) :
poli... | zzyunzhi/asynch-mb | asynch_mb/trainers/mb_trainer.py | mb_trainer.py | py | 5,530 | python | en | code | 12 | github-code | 13 |
24898314542 | listcontact= {}
def getname():
name=input("Введите имя контакта: ")
name=name.title()
name=name.strip()
return name
def trans_name(listcontact,name,num):
if name in listcontact:
listcontact[name] = num
print("\nКонтакт успешно изменён\n")
else:
print("Такого контакта н... | BatyrKot/Univer4 | HOME-CLASS-WORK/Phons/Phons.py | Phons.py | py | 2,054 | python | ru | code | 0 | github-code | 13 |
45465882576 | from particles import Particle_Set
from parameters import EPS, dt
import numpy as np
class Interactions:
''' Class to deal with interactions (forces, collisions, ...) '''
def __init__(self, particles):
self.particles = particles
def elastic_collision(self, part1, part2):
''' Update speeds of two particles con... | MaGnaFlo/Brownian | interactions.py | interactions.py | py | 3,117 | python | en | code | 0 | github-code | 13 |
31420537063 |
#TODO add offline mode
from asciimatics.event import KeyboardEvent
from asciimatics.widgets import *
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.exceptions import ResizeScreenError, StopApplication, NextScene
import sys
import os
try:
import magic
except ImportError:
p... | J-CITY/Kitsune | main.py | main.py | py | 5,704 | python | en | code | 9 | github-code | 13 |
39810278621 | import os.path
import jax
import jax.numpy as jnp
import jax.lax as lax
import jax.scipy as jsp
import numpy as np
import einops
from iqa.utils.convert_img import rgb2y, rgb2gray, imresize_half
from typing import Literal, Sequence
from functools import partial
import pickle
def _gamma(x):
"""
There's no ga... | dslisleedh/IQA-jax | iqa/metrics/niqe.py | niqe.py | py | 6,637 | python | en | code | 0 | github-code | 13 |
34051378589 | import os
os.system('cls')
print ('Questão 2\n')
n = int (input('Insira um número para calcular seu quadrado:\n'))
sum = 0
for i in range (1,n+1):
sum = sum + ((2*i)-1)
print ('O quadrado do número %d é %d' % (n,sum)) | ViniciusMaiaM/Python-projects | Desafios e tarefas/prova2.py | prova2.py | py | 225 | python | pt | code | 0 | github-code | 13 |
5919799834 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import pandas as pd
import tensorflow as tf
from tensorflow.keras.utils import to_categorical
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import train_test_split
from mlp import FNC
### Global stuff 🌍
# data path : ... | djaymen/Fake_News | mlp/train.py | train.py | py | 1,645 | python | en | code | 2 | github-code | 13 |
15159099709 | import sympy as sym
import sympy.plotting as syp
import matplotlib.pyplot as plt
sigma,mu,x = sym.Symbol('sigma'),sym.Symbol('mu'),sym.Symbol('x')
sym.pprint(2*sym.pi*sigma)
part1 = 1/(sym.sqrt(2*sym.pi*sigma**2))
part2 = sym.exp(-1*((x-mu)**2)/(2*sigma**2))
gauss_function=part1*part2
sym.pprint(gauss_function)
sym.plo... | oguzbalkaya/ProgramlamaLaboratuvari | sympyveornekleri2.py | sympyveornekleri2.py | py | 673 | python | en | code | 0 | github-code | 13 |
19580658089 | import argparse
import json
import sys
import os.path
import glob
import xml.etree.ElementTree as ET
from FFmpeg import HD_MODEL_NAME, HD_NEG_MODEL_NAME, HD_PHONE_MODEL_NAME ,_4K_MODEL_NAME, HD_PHONE_MODEL_VERSION
from statistics import mean, harmonic_mean
from Vmaf import vmaf
from signal import signal, SIGINT
d... | gdavila/easyVmaf | easyVmaf.py | easyVmaf.py | py | 8,717 | python | en | code | 135 | github-code | 13 |
24760403813 | #Link: https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/
class Solution:
def countNegatives(self, grid: List[List[int]]) -> int:
count = 0
for row in grid:
for cell in row:
if cell < 0 : count += 1
return count
| muradhaji/OlympSolutions | LeetCode/1351.py | 1351.py | py | 299 | python | en | code | 0 | github-code | 13 |
986374720 | from painter.models import Card
from .import_cards import Command as BaseImportCommand
class Command(BaseImportCommand):
help = ('Clears the database of cards, then fills it with the contents of one or' +
' more specified XLSX files. Parses a Laundry character sheet,' +
' looking fo... | adam-thomas/imperial-painter | painter/importers/import_laundry.py | import_laundry.py | py | 5,769 | python | en | code | 0 | github-code | 13 |
31967637232 | #!/usr/bin/python
"""
ZetCode wxPython tutorial
In this example we create a gauge widget.
author: Jan Bodnar
website: www.zetcode.com
last modified: April 2018
"""
import wx
TASK_RANGE = 50
class Example(wx.Frame):
def __init__(self, *args, **kw):
super(Example, self).__init__(*args, **kw)
s... | janbodnar/wxPython-examples | widgets/gauge_wid.py | gauge_wid.py | py | 2,262 | python | en | code | 102 | github-code | 13 |
23449394462 | from util import utils
class PerfectMatch:
def __init__(self,
solver,
matches,
limit):
self.limit = limit
self.matches = matches
self.match = utils.createMatch(self.matches)
self.solver = solver.reset()
def playMatch(self):
... | cestcedric/PerfectMatch | PerfectMatch.py | PerfectMatch.py | py | 1,175 | python | en | code | 0 | github-code | 13 |
74564775698 | #!/usr/bin/env python
# pylint: disable=E1101,C0103,R0902
"""
Component test TestComponent module and the harness
"""
from __future__ import print_function
import os
import threading
import time
import unittest
import nose
from WMCore.Agent.Daemon.Details import Details
from WMCore.Database.Transaction import Transa... | dmwm/WMCore | test/python/WMCore_t/Agent_t/Harness_t.py | Harness_t.py | py | 5,963 | python | en | code | 44 | github-code | 13 |
71158869459 | def reverse_vowels(s):
phrase_list = list(s)
vowels= ['a','e','i','o','u']
vowel_ind = [ind for ind,char in enumerate(phrase_list) if char in vowels]
vowel_char = [char for ind,char in enumerate(phrase_list) if char in vowels]
vowel_char.reverse()
for ind, vow in enumerate(vowel_char):
p... | chrissolo88/PythonPractice | reverse_vowels.py | reverse_vowels.py | py | 830 | python | en | code | 0 | github-code | 13 |
22713332448 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
CSV_FILES = ['/home/dylanz/final_project/eecs598/se_results/supervised_0.05_5_whole.pt_shift_shift',
'/home/dylanz/final_project/eecs598/se_results/supervised-l2_1e-05.pt_shift_shift']
COLORS = ["#fd7f6f", "#7eb0d5", "#b2e061", "#bd7eb... | DylanJamesZapzalka/eecs598 | process_se_results.py | process_se_results.py | py | 1,104 | python | en | code | 0 | github-code | 13 |
6188576375 | # drawShape.py
# Created by Jo Narvaez-Jensen
# program designed to create a window (500x500) that is displaying a rectanle that is 400 x 200 (blue outline, orange filling) with a green oval inside using the same coordinates as the rectanle
from graphics import *
display = GraphWin ("Drawing Window", 500,500)
def ma... | thenobleone/Programming | CSC-110/Chapter 4/draw.py | draw.py | py | 648 | python | en | code | 1 | github-code | 13 |
15734956163 | # This file contains useful functions for manipulating data
from sklearn.preprocessing import MultiLabelBinarizer
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import accuracy_score
from ... | Jincheng-Sun/ciena_hackathon | Preprocessing/utils.py | utils.py | py | 5,022 | python | en | code | 0 | github-code | 13 |
37866933770 | import investpy as inv
from django.core.management.base import BaseCommand
from assets.models.assets import ListAcaoFii
class Command(BaseCommand):
help = 'Create objs in database getting by b3 api'
def handle(self, *args, **options):
ListAcaoFii.objects.all().delete()
df = inv.stocks.get_st... | jorgemustafa/gerenciador-de-investimentos | assets/management/commands/charge_assets_b3.py | charge_assets_b3.py | py | 567 | python | en | code | 0 | github-code | 13 |
13492701283 | # -*- coding: utf8 -*-
from Utils import *
from Utils import GlobalProperty as GP
from OnClickHandler import OnClickHandler
import VideoPlayer
from BaseClasses import *
from WindowManager import wm
import time
from dialogs.DialogBaseInfo import DialogBaseInfo
PLAYER = VideoPlayer.VideoPlayer()
ch = OnClickHandler()
C... | devillinangel/script.huawei | resources/lib/MainMenu.py | MainMenu.py | py | 973 | python | en | code | 0 | github-code | 13 |
17233025149 | import zipfile
import os
import shutil
def RoiRename(Path):
z = zipfile.ZipFile(Path, 'r')
Dirpath = (os.path.splitext(Path))[0]
if os.path.exists(Dirpath):
shutil.rmtree(Dirpath)
# os.remove(Dirpath)
else:
os.mkdir(Dirpath)
z.extractall(Dirpath)
Relation ... | ZhouBo20171229/- | BatchRename.py | BatchRename.py | py | 1,563 | python | en | code | 0 | github-code | 13 |
19059987156 | #! python3
import os
import csv
import requests
import bs4 as bs
import urllib.request
import re
i=1
with open("input.csv") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
url = (row['URL'])
device = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge... | santarini/Monis-Image-Scrape | imageScrapeCSV.py | imageScrapeCSV.py | py | 1,310 | python | en | code | 0 | github-code | 13 |
11029218112 | # Keras
import keras
from keras import regularizers
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential, Model, model_from_json
from keras.layers import Dense, Embedding, LSTM
from keras.layers... | 981526092/Sentiment-Mapping-and-Matching-between-Audio-and-Text-Representation | audioEmbedding/sentiment_until.py | sentiment_until.py | py | 11,427 | python | en | code | 0 | github-code | 13 |
4506901455 | import blog.index as blog
import chat.index as chat
import login
import salutation
from tarantino import Tarantino
from tarantino.authentication import authenticate
from tarantino.http import (
HTTP200Response,
HTTPRequest,
HTTPResponse,
HTTPStatusCode,
JSONResponse,
)
from tarantino.middleware impo... | himanshu-dutta/tarantino | examples/basic-app/index.py | index.py | py | 2,095 | python | en | code | 0 | github-code | 13 |
71430527059 | import spikeextractors as se
import ephys_viz as ev
class examples:
@classmethod
def toy_example(cls):
_, sorting = se.example_datasets.toy_example()
return ev.Autocorrelograms(
title="Autocorrelograms from SpikeExtractors toy example",
sorting=sorting,
max_s... | flatironinstitute/ephys-viz | widgets/Autocorrelograms/examples.py | examples.py | py | 892 | python | en | code | 6 | github-code | 13 |
23511651922 | ROCKS = [
{(2, 0), (3, 0), (4, 0), (5, 0)},
{(2, 1), (3, 0), (3, 1), (4, 1), (3, 2)},
{(2, 0), (3, 0), (4, 0), (4, 1), (4, 2)},
{(2, 0), (2, 1), (2, 2), (2, 3)},
{(2, 0), (2, 1), (3, 0), (3, 1)},
]
EXAMPLE = False
def move(rock, direction):
x, y = direction
return {(i + x, j + y) for (i, ... | alexcosta13/advent-of-code-2022 | day17/main.py | main.py | py | 2,927 | python | en | code | 0 | github-code | 13 |
1340004803 | """
=======================================================================
COMPETITION TUTORIAL #1: Custom model and RL algorithm
=======================================================================
In this tutorial, we customize the default TrackMania pipeline.
To submit an entry to the TMRL competition, we esse... | surasakCH/AIB-TMRL | tmrl/tuto/tuto_competition.py | tuto_competition.py | py | 22,561 | python | en | code | 0 | github-code | 13 |
34649879273 | '''
Museum Price Challenge
The problem statement is as follows. Let's assume that we have a museum that has the following
policy for the admission price based on a full price ticket of $12.50.
The museum is closed on Mondays. Everyone gets half price discount on Tuesday and Thursdays.
If you are age between 13 and... | MarkCrocker/Python | boolean2.py | boolean2.py | py | 2,403 | python | en | code | 0 | github-code | 13 |
4693622431 | import boto3, s3fs
import pandas as pd
from collections import Counter
from boto3 import client
import pandas as pd
import requests
from dynamo_pandas import get_df
############
AUDIO_FOLDER = 'AUDIOS/AUDIO'
def s3_objects():
conn = client('s3') # again assumes boto.cfg setup, assume AWS S3
objects = conn.li... | corfo-parkinsons/corfo-parkinsons-streamlit | aws.py | aws.py | py | 4,434 | python | en | code | 0 | github-code | 13 |
29114609969 | # -*- coding: utf-8 -*-
import copy
import os
import unittest
import shutil
from parameterized import parameterized
import tensorflow as tf
from opennmt import Runner
from opennmt.config import load_model
from opennmt.utils import misc
from opennmt.tests import test_util
test_dir = os.path.dirname(os.path.realpat... | hhmlai/OpenNMT-tf | opennmt/tests/runner_test.py | runner_test.py | py | 7,557 | python | en | code | null | github-code | 13 |
17159235657 | import numpy as np
import matplotlib.pyplot as plt
array1 = np.array([[0,1],
[1,0]]).astype(int)
array2 = np.array([[0,0],
[1,1]])
array3 = np.array([[1,1],
[0,0]])
array4 = np.array([[1,0],
[0,1]])
fig, axs = plt.subplots(2, 2)
axs[0, 0].i... | Phayuth/robotics_manipulator | util/img_index_sequence.py | img_index_sequence.py | py | 499 | python | en | code | 0 | github-code | 13 |
6044247109 | import xmlrpc.client
import json
proxy = xmlrpc.client.ServerProxy("http://127.0.0.1:7778/")
print("menu :")
print("1. tampil semua sensor")
print("2. tampil sensor suhu")
print("3. tampil sensor kelembaban")
print("4. tampil sensor kadar CO")
menu = input("pilih menu no : ")
if menu == "1" :
proxy.getAllsensor()
... | zeddinarief/skt | pengguna.py | pengguna.py | py | 483 | python | en | code | 0 | github-code | 13 |
1456847542 | #!/usr/bin/env python
import sys
if __name__ == "__main__":
dem = str(input("voulez vouz multiplier ou additionner? tapez m pour multiplier ou a pour additionner: "))
if (dem =='a'):
if len(sys.argv)>3:
print("Veillez inserer que deux arguments")
elif len(sys.argv)==3:
x = int( sys.argv[1] )
y = int( ... | Dina64/td3_Dina_Ando | main.py | main.py | py | 1,214 | python | en | code | 0 | github-code | 13 |
11056545631 | from lib.libdata import *
from lib.libcnn import *
import argparse
import matplotlib
import random
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('--seed', metavar='seed', dest='seed', default=1776, type=int, help='RNG seed')
parse... | tmrod/hodgenet | hodgeaggregation/main.py | main.py | py | 8,752 | python | en | code | 1 | github-code | 13 |
18383341780 | import sys
import random
import operator
import numpy as np
from functools import reduce
from datetime import datetime
from sklearn.metrics import auc
import matplotlib.pyplot as plt
from utils.dataset_bands import datasets_bands
from utils.usno import get_usno_projection, get_usno_vector
from utils.panstarr import get... | diegocasmo/ml_blink_evaluation | ml_blink.py | ml_blink.py | py | 8,167 | python | en | code | 1 | github-code | 13 |
18239208780 | from tkinter import *
import tkinter.font
win = Tk()
win.title("Hello world!")
myFont = tkinter.font.Font(family="Helvetica", size=12, weight="bold")
def cmd1():
print("hello")
def close():
win.destroy()
button1 = Button(win, text='Turn on', font=myFont, command=cmd1)
button1.grid(row=0, column=0)
exitB... | jorgevs/MyPythonTestProject | TkinterTest.py | TkinterTest.py | py | 472 | python | en | code | 0 | github-code | 13 |
4341697796 | import sys
import requests
from flask import Flask, jsonify, render_template, request
from flask_flatpages import FlatPages
from flask_frozen import Freezer
import numpy as np
import matplotlib.pyplot as plt
app = Flask(__name__)
pages = FlatPages(app)
freezer = Freezer(app)
@app.route("/")
def index(... | vankhaiphan/covid19 | app.py | app.py | py | 919 | python | en | code | 0 | github-code | 13 |
32952424712 | import glados
import derpibooru
class Derpi(glados.Module):
@glados.Module.command('derpi', '<s|r> [query]', 'Search derpibooru for an image. The first argument is the mode. **s** means **search**, **r** means **random**.')
async def derpi(self, message, args):
args = args.split(' ', 1)
mode =... | TheComet/GLaDOS2 | modules/mlp/derpi.py | derpi.py | py | 1,214 | python | en | code | 4 | github-code | 13 |
17799748864 | # encoding: utf-8
# ================This module is completely inspired by scikit-image================
# https://github.com/scikit-image/scikit-image/blob/master/skimage/data/__init__.py
# ==================================================================================
import os
import shutil
from typing import Tup... | nsmdgr/histolab | src/histolab/data/__init__.py | __init__.py | py | 14,730 | python | en | code | 0 | github-code | 13 |
10945451428 | import sys
from unittest.mock import patch
import pytest
from importlib import reload
import pynamodb.settings
@pytest.mark.parametrize('settings_str', [
"session_cls = object()",
"request_timeout_seconds = 5",
])
def test_override_old_attributes(settings_str, tmpdir):
custom_settings = tmpdir.join("pyn... | pynamodb/PynamoDB | tests/test_settings.py | test_settings.py | py | 643 | python | en | code | 2,311 | github-code | 13 |
21540971462 | """
@author Mrinal Pandey
@date: 12th September, 2019
@day_time Thursday 19:38
"""
def displayData(a, n):
for i in range(n):
print (a[i], end = '\t')
print()
def bubbleSort(a, n):
for i in range(n - 1):
for j in range(n - 1 - i):
if a[j] > a[j + 1]:
a[j], a[j +... | mrinal-pandey/DSC-Codicon | bubble_sort.py | bubble_sort.py | py | 574 | python | en | code | 0 | github-code | 13 |
31723826391 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import pika
import random
import re
class Client(object):
def __init__(self):
self.host_ip= []
self.cmd = ""
credentials = pika.PlainCredentials('sam', 'sam')
self.connection = pika.BlockingConnection(pika.ConnectionParameters('10.100.2... | gaoshao52/pythonProject | 基于RabbitMQrpc实现的主机管理/client.py | client.py | py | 2,649 | python | en | code | 0 | github-code | 13 |
29860493087 | import contextlib
import io
import tempfile
import unittest
from pathlib import Path
from unittest import mock
import termstyle
from intelmq.bin import intelmqdump
from intelmq.lib.test import skip_installation
class TestCompleter(unittest.TestCase):
"""
A TestCase for Completer.
"""
def test_simpl... | certtools/intelmq | intelmq/tests/bin/test_intelmqdump.py | test_intelmqdump.py | py | 8,052 | python | en | code | 856 | github-code | 13 |
30177703264 | class TreeNode:
def __init__(self,data):
self.value = data
self.left = None
self.right = None
self.parent = None
def __repr__(self):
return repr(self.value)
def add_left(self,node):
self.left = node
if node is not None: #node khali ... | faysalf/DSA_by_Python | Data-Structure-main/Tree/Binary search Tree.py | Binary search Tree.py | py | 1,589 | python | en | code | 0 | github-code | 13 |
39983132556 | import requests
import json
host = "https://piopiy.telecmi.com/v1/call/action"
class Hangup:
def __init__(self, appid, secret):
self.appid = appid
self.secret = secret
def hangup(self, uuid):
if isinstance(uuid, str):
data = {'appid': self.appid,
'se... | telecmi/piopiy_python | src/piopiy/hangup.py | hangup.py | py | 601 | python | en | code | 2 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.