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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
6572953355 | #Launching an Ec2 Instance
import boto3
def launch_instance\
(ami='ami-067d1e60475437da2',
instance_type='t2.micro',
key_name='AWSbigdata',
group_name='AWSbigdata',
ssh_port=32,
cidr='0.0.0.0/0',
... | yaswanth1997/S3 | Ecc.py | Ecc.py | py | 762 | python | en | code | 0 | github-code | 13 |
32448404894 | # _*_ coding:utf-8 _*_
# @Author :ran
# @time :2018-12-06 19:21
# @File :tf_session.py
# @Software :PyCharm
import tensorflow as tf
# create two matrixes
# 矩阵乘的条件是 左列数=右行数
matrix1 = tf.constant([[3, 4],
[2, 3]])
matrix2 = tf.constant([[2, 1, 1],
[1, 2, 3]])
p... | interestudy/pythonstudy | tensorflow/tf_session.py | tf_session.py | py | 663 | python | en | code | 1 | github-code | 13 |
27305017195 | import pandas as pd
from xmhw.stats import (
block_average,
check_variables,
cat_days,
check_coordinates,
)
from xmhw.identify import land_check
from xmhw_fixtures import *
from xmhw.exception import XmhwException
import numpy.testing as nptest
import xarray.testing as xrtest
import pandas.testing as pd... | coecms/xmhw | test/test_stats.py | test_stats.py | py | 2,272 | python | en | code | 19 | github-code | 13 |
29268173999 | # coding=utf-8
"""
made by tuplis 2021
"""
from sopel.plugin import rule
import re
strings = [
{
'rule': 'via dolorosa',
'response': 'https://soundcloud.com/oaklydnb/tommi-lantinen-via-dolorosa-oakly-bootleg'
}
]
@rule(r'.*')
def trigger(bot, trigger):
line = trigger.group(0)
for... | janihy/dsg | plugins/trigger.py | trigger.py | py | 431 | python | en | code | 0 | github-code | 13 |
14947132980 | # 5. Faça um programa que calcule o volume de um cone qualquer, lembrar de utilizar a biblioteca math para usar ovalor de pi.
# Volume = areadabase . altura
pi = float(3.14)
raio = float(input('Raio: '))
alt = float(input('Altura: '))
raio2 = raio**raio
volume1 = (pi*raio2)
volume2 = (volume1*alt)/3
print('Volume... | kocuja/python-1 | python-1/tarefa5.py | tarefa5.py | py | 334 | python | pt | code | 0 | github-code | 13 |
31676783672 | #!/usr/bin/env python
# coding=utf-8
# Author : huzai24601
from pwn import *
from LibcSearcher import *
#context.terminal = ['gnome-terminal', '-x', 'sh', '-c']
context(arch='amd64',os='linux',log_level='debug')
myelf = ELF('./tinypad')
p=process(myelf.path)
libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')
s=lambda data ... | huzai9527/how2heap_work | house_of_einherjar/exp.py | exp.py | py | 2,597 | python | en | code | 0 | github-code | 13 |
38611224490 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('blog', '0001_initial'),
]
operat... | qinchongshuang/mysite | comment/migrations/0001_initial.py | 0001_initial.py | py | 959 | python | en | code | 0 | github-code | 13 |
31067574097 | import numpy as np
# convert an array of values into a dataset matrix
def create_train_data(training_set_scaled, time_step, n_days_ahead):
# Creating a data structure with 60 time-steps and 1 output
X_train = []
y_train = []
# print(training_set_scaled)
for i in range(time_step, len(training_set_sc... | taimoorkhokhar/lstm_stock_prediction | data_prep.py | data_prep.py | py | 1,672 | python | en | code | 0 | github-code | 13 |
74105216339 | FILENAME = r'C:\Users\Administrator\Desktop\hosts.txt'
tabela = []
try:
with open(FILENAME, mode='r', encoding='utf-8') as file:
zawartosc = file.readlines()
except FileNotFoundError:
print('File does not exist')
except PermissionError:
print('Permission denied')
for line in zaw... | kacper1001/Python-podstawy | file_hosts.py | file_hosts.py | py | 630 | python | en | code | 0 | github-code | 13 |
31318650714 | import pandas
import numpy
import copy
file = "day11/input.txt"
def adjacent_seats(row: int, seat: int, seating: list) -> int:
adjacent_seats_counter = 0
if row == 0 and seat == 2:
xx = 1
lst = []
lst2 = []
# the extra one is to remind ourselves that range is not inclusive
for i in r... | imry-rosenbuam/advent-of-code | python/2020/day11/day11.py | day11.py | py | 4,565 | python | en | code | 0 | github-code | 13 |
23235437347 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 2 11:48:15 2022
@author: rzemi
"""
import os
import time
dir=input("path to a dir:")
if os.path.exists(dir) == False:
print("the dir does not exist")
else:
file=input("filename:")
path=os.path.join(dir, file)
if os.path.exists(path) == False:
p... | rzemien94/Python_courses | PythonDlaPoczatkujacych/lesson168.py | lesson168.py | py | 520 | python | en | code | 0 | github-code | 13 |
39179347003 | import argparse
import os
import time
import tabulate
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import ReduceLROnPlateau
from training import utils
from models.glt_models import LinearClassifier
torch.backends.cudnn.benchmark = False
if __name__ == '__main__':
parser = argparse.Argument... | knkeer/sparse-resnet-blocks | train-e2e.py | train-e2e.py | py | 6,920 | python | en | code | 1 | github-code | 13 |
29219638249 | from bs4 import BeautifulSoup
import requests
import types
content = requests.get('https://pokemondb.net/pokedex/all').text
soup = BeautifulSoup(content, "lxml")
prettified = soup.prettify()
f = open('html', 'w+', encoding="utf-8")
f.write(prettified)
f.close()
# Get all root nodes:
tr_list = soup.fin... | gmdvdsp/Pokemon-Teambuilder | src/scraper/pokemon/scraper.py | scraper.py | py | 2,407 | python | en | code | 0 | github-code | 13 |
35184820743 | import numpy as np
import matplotlib.pyplot as plt
Nwalk=1000
Nstep=1000
xpt=np.zeros((Nstep+1,Nwalk))
ypt=np.zeros((Nstep+1,Nwalk))
xpt[0,:]=0
ypt[0,:]=0
for i in range(Nwalk):
for j in range(Nstep):
phi=2*np.pi*np.random.random()
xpt[j+1,i]=xpt[j,i]+np.cos(phi)
ypt[j+1,i]=ypt[j,i]+np.s... | Singond/Nummet-II | 11/random_walk.py | random_walk.py | py | 518 | python | en | code | 0 | github-code | 13 |
37066443459 | import re
from time import time
from typing import List, Dict, Union, Iterator
import yaml
from baiduspider import BaiduSpider, ParseError
from safeSearch.error import QueryTooLongException
SPIDER = BaiduSpider()
LAST_QUERY_TIME = time()
# def build_baidu_url(word: str, sites: list = None) -> str:
# base_url =... | loopyme/safeSearch | src/safeSearch/query.py | query.py | py | 3,732 | python | en | code | 2 | github-code | 13 |
12023191853 | import math
import turtle
def main():
init()
turtle.setx(-160)
star(150, 5)
turtle.setx(160)
star(150, 11)
turtle.hideturtle()
# hold window
turtle.mainloop()
def init():
turtle.shape('turtle')
turtle.up()
def star(radius, n):
angle = 360 / n
side = 2 * radius * m... | davidkirakosyan/MIPT-Python-lab | Lab 2 (Turtle part 1)/Упражнение N14/stars.py | stars.py | py | 725 | python | en | code | 0 | github-code | 13 |
37760746020 | import re
import sys
import ctypes
from ._xml_parser import parse_xml, Node, get_error_prefix
from ._platform import handle_ctypes, basic_ctypes
from pycparser import CParser, c_generator, c_ast, c_lexer
class RegistryParseError(RuntimeError):
@classmethod
def check(cls, condition):
if not condition:
... | Dragiyski/python-vulkan-api | registry/_parser.py | _parser.py | py | 41,869 | python | en | code | 0 | github-code | 13 |
30931866289 | """Command-line interface."""
import datetime
import os
import shutil
from pathlib import Path
import typer
import yaml
from rich.console import Console
from rich.panel import Panel
from rich.progress import Progress, RenderableColumn
from rich.prompt import Confirm
from rich.live import Live
from rich.align import Al... | iamlucasvieira/piemodoro | src/piemodoro/__main__.py | __main__.py | py | 6,000 | python | en | code | 0 | github-code | 13 |
327378601 | import numpy as np
data = np.loadtxt('input', dtype=np.int32)
i = 0
steps = 0
while i < data.size and i >= 0:
jump = data[i]
data[i] += 1
i += jump
steps += 1
print(steps)
| grey-area/advent-of-code-2017 | day05/part1.py | part1.py | py | 191 | python | en | code | 0 | github-code | 13 |
10726200283 | while True:
try:
m = int(input())
somaNotasXCH = 0
chTotal = 0
for i in range(m):
nota, ch = map(int, input().split())
somaNotasXCH += nota * ch
chTotal += ch
IndiceRA = somaNotasXCH / (chTotal * 100)
print(f"{... | PacMan111/ProblemasBeecrowd | Python/2533.py | 2533.py | py | 374 | python | en | code | 0 | github-code | 13 |
70610739857 | import pyscreenshot as ImageGrab
from datetime import datetime
now = datetime.now()
current_time = now.strftime("%H-%M-%S")
# 擷取全螢幕畫面
img = ImageGrab.grab()
imgName = current_time + ".png"
# 儲存檔案
img.save("./screenShots/"+imgName)
| chunyulo-code/sttNLp | screenShots/screenShot.py | screenShot.py | py | 260 | python | en | code | 0 | github-code | 13 |
41267209526 | #Section 3.1.2: Strings
def sec312():
print('C:\some\name') #get rid of this by
print(r'C:\some\name') #using raw string
print("""\
Usage: thingy [OPTIONS]
-h Display this usage message
-H hostname Hostname to connect to
""") #EO... | pforderique/Python-Scripts | Coding_Practice/The_Python_Docs/thepythontutorial.py | thepythontutorial.py | py | 19,041 | python | en | code | 1 | github-code | 13 |
17039807914 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayEbppInvoiceExpensecontrolQuotaQueryModel(object):
def __init__(self):
self._account_id = None
self._agreement_no = None
self._enterprise_id = None
self._owne... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayEbppInvoiceExpensecontrolQuotaQueryModel.py | AlipayEbppInvoiceExpensecontrolQuotaQueryModel.py | py | 6,940 | python | en | code | 241 | github-code | 13 |
1567766999 | import pytest
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_mvn(Command):
assert '3.5.0' in Command.check_output('mvn --version')
def test_mvn_debug(Command):
assert Command('which mvnDebug').rc == 0
@pyt... | Jessevanbekkum/boxes | roles/gantsign.maven/tests/test_role.py | test_role.py | py | 1,447 | python | en | code | 1 | github-code | 13 |
25466816557 | from django import forms
from .models import Todo
class TodoForm(forms.ModelForm):
class Meta:
model = Todo
fields = ('title',)
widgets = {
'title': forms.TextInput(
attrs={
'class': 'form-control',
'placeholder': 'Insert ... | anykate/todo_app_forms | myapps/todos/forms.py | forms.py | py | 529 | python | en | code | 0 | github-code | 13 |
8536451412 | #/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Created on 2017年10月30日
@author: bob
'''
from indictors.ema import ema
import tushare as ts
import matplotlib.pyplot as plt
import matplotlib.finance as mpf
import numpy as np
if __name__ == '__main__':
data = ts.get_k_data('399300', index=True, start="2017-01-01")#, ... | liujinguang/stockquantpro | stock-quant-pro/uts/test_ema.py | test_ema.py | py | 1,407 | python | en | code | 0 | github-code | 13 |
15848605787 | from flask import Flask, request, make_response, redirect, render_template
import json
import requests
from bs4 import BeautifulSoup
from PIL import Image
import urllib2
import random
import io
import cgi
import re
import config
BASE_URL = "http://api.tumblr.com/v2/blog/{blog}/posts/?offset={offset}&api_key=" + config... | murgatroid99/ponify_images | ponify.py | ponify.py | py | 4,661 | python | en | code | 0 | github-code | 13 |
31896731625 | #beta.py: say Hello, wait for greeting
#import socket as s
# a=s.socket(s.AF_INET, s.SOCK_DGRAM)
# a.bind(("155.41.14.50",9002))
# a.sendto(b"Question?", ("128.197.128.9",9001))
# print("sent")
# msg,ca = a.recvfrom(1024)
# print(msg)
# a.sendto(msg, ("128.197.128.9",9001))
# print("sent2")
# msgs,caa = a.recvfrom(102... | pequode/class-projects | ec441_intro_to_computer_networks/functions/beta.py | beta.py | py | 556 | python | en | code | 0 | github-code | 13 |
11097745865 |
import math
number_of_days = int(input())
food_in_kg = int(input())
dog_food_per_day = float(input())
cat_food_per_day = float(input())
turtle_food_per_day = float(input())
dog_food = number_of_days * dog_food_per_day
cat_food = number_of_days * cat_food_per_day
turtle_food = (number_of_days * turtle_food_per_day) / ... | tanchevtony/SoftUni_Python_basic | More exercises/01_Simple_operations_and_calculations/pets.py | pets.py | py | 573 | python | en | code | 0 | github-code | 13 |
17933848240 | import fastapi
from fastapi import APIRouter
import fastapi
from sqlmodel import Session, select
from api.db import get_session
from api.models import Currencies, CurrencyBase
router = APIRouter(prefix="/currencies",
tags=["currencies"],
responses={404: {"description": "Not foun... | Blackstit/p2p-marketplace | api/routers/currencies.py | currencies.py | py | 1,490 | python | en | code | 0 | github-code | 13 |
6564966652 | #!/usr/bin/env python
import os, soya, sys
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
soya.init(title='Head Tracking')
class TrackModel(soya.Body):
def __init__(self, scene, model):
soya.Body.__init__(self, scene, model)
self.move = None
def set_headtracker(... | haldean/headtrack | headtrack-old/gui.py | gui.py | py | 872 | python | en | code | 1 | github-code | 13 |
41077914035 | import os
import json
from google.cloud import bigquery, storage
from glob import glob
from pathlib import Path
from tableauhyperapi import HyperProcess, Telemetry, \
Connection, CreateMode, \
NULLABLE, SqlType, TableDefinition, TableName, \
escape_string_literal, \
HyperException
import tableauserver... | ateneva/Tableau | APIs/00_create_gcp_tableau_hyper_extracts.py | 00_create_gcp_tableau_hyper_extracts.py | py | 10,151 | python | en | code | 2 | github-code | 13 |
33235205685 | import pygame
import os
pygame.mixer.init()
from utility.config import get
from abstractions.ship import Ship
from abstractions.laser import Laser
HEIGHT = get(os.path.join("utility", "settings.json"), "height")
TWINGUN = pygame.image.load(os.path.join("assets", "twingun_player.png"))
YELLOW_LASER = pygame.image.loa... | Eramaloby/ppvis-3 | player_models/twingun.py | twingun.py | py | 2,668 | python | en | code | 0 | github-code | 13 |
38591391113 | import unittest
from function import Shape, ShapeName
class TestShape(unittest.TestCase):
def test_squre(self):
shape1 = Shape(1, 1, "Square")
result1 = shape1.area_and_perimeter_square(2)
self.assertEqual(result1, (8, 4))
def test_rectangle(self):
shape2 = Shape(1,1,"Recta... | Nataleia08/test_tasks_for_work | test_task_for_DiversiPy/test_function.py | test_function.py | py | 676 | python | en | code | 0 | github-code | 13 |
72780985297 | import time
import random
import matplotlib.pyplot as plt
import numpy as np
def merge_sort(numbers):
# If the list has more than one element, we need to split it and merge the sorted halves
if len(numbers) > 1:
# Calculate the middle index of the list
middle_index = len(numbers) // 2
... | rishabh01solanki/Algorithms | bubble_vs_merge.py | bubble_vs_merge.py | py | 2,573 | python | en | code | 0 | github-code | 13 |
9131210517 |
# Notes:
# ......
# 1- This code is based on the orginal code created by scarethetots:
# https://www.instructables.com/Raspberry-Pi-Based-Living-Portrait-Player-Intro/
# 2- Start the server on the Android app before running this code.
# 3- The video, this code and the my_cv_utils_rev0.py file need to be in the same ... | vbookshelf/Scary-TV-Triggered-by-Computer-Vision | scary-tv-folder/scary-tv-code-rev1.py | scary-tv-code-rev1.py | py | 4,228 | python | en | code | 0 | github-code | 13 |
5869324583 | from math import pi
figure_type = input()
if figure_type == "square":
square_side = float(input())
square_area = square_side * square_side
print(f"{square_area:.3f}")
if figure_type == "rectangle":
rec_side_1 = float(input())
rec_side_2 = float(input())
rectangle_area = rec_side_2 * rec_side_1
... | Ilian-Kossev/Conditional_statements_lab | 6_figures_area.py | 6_figures_area.py | py | 665 | python | en | code | 0 | github-code | 13 |
25016548218 | class Player:
def __init__(self, my_player):
self.name = my_player["name"]
self.age = my_player["age"]
self.position = my_player["position"]
self.team = my_player["team"]
@classmethod
def get_team(cls,team_list):
squad=[]
for player in team_list:
... | Code-GeraldGonzales/basketball_dictionaries | basketball_dictionaries.py | basketball_dictionaries.py | py | 1,758 | python | en | code | 0 | github-code | 13 |
15045151202 | from django.conf.urls import include, url
from django.contrib.auth.views import login, logout_then_login
from django.views.generic import TemplateView
from . import views
from .views import *
urlpatterns = [
url(r'^$', login, {'template_name': 'inicio/index.html'}, name='home'),
url(r'^salir/$', logout_then_lo... | juksonvillegas/modasmartphone | inicio/urls.py | urls.py | py | 1,342 | python | es | code | 0 | github-code | 13 |
24423556441 | import torch
import torch.nn as nn
import argparse
import numpy as np
import math
from random import shuffle
import os
import sys
# Disable matplotlib screen support
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from model import SimpleClassifier, NLIClassifier, ESIM_Head, get_device
from da... | VictorZuanazzi/Project_Semantics | code/task.py | task.py | py | 21,538 | python | en | code | 0 | github-code | 13 |
2044456714 | #!/usr/bin/env python
from __future__ import print_function
import itertools
import os.path
import pkgutil
import re
import sys
import types
import zlib
__author__ = 'Hong Minhee <hongminhee' "\x40" 'member.fsf.org>'
__version__ = '1.0.1'
__license__ = 'GPLv3 or later'
__all__ = ('print_inventory', 'scan_objects', 's... | dahlia/sphinx-fakeinv | sphinx_fakeinv.py | sphinx_fakeinv.py | py | 4,608 | python | en | code | 5 | github-code | 13 |
4221890477 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
import xml.etree.cElementTree as et
import collections
import accurev.base
import accurev.element
class Transaction(accurev.base.Base):
@staticmethod
def from_hist(client, out):
for transaction in et.fromstring(out).findall('./e... | grilo/pyaccurev | accurev/transaction.py | transaction.py | py | 1,671 | python | en | code | 1 | github-code | 13 |
25085266953 | import pandas as pd
import pprint as pp
# Import Main Data
mainData = pd.read_csv(r'C:\Users\karan.shah05\PycharmProjects\AirBnB vs Rental in Seattle\Data\AirbnbData\mainData.csv')
# Sort Data According to Listing_id
mainData['date'] = pd.to_datetime(mainData['date'], format='%Y-%m-%d')
listing_ids = main... | karuaan/AirBnBSeattlePractice | PythonBackend/dataParser.py | dataParser.py | py | 2,051 | python | en | code | 1 | github-code | 13 |
22751183442 | import sys
from core.server import WebServerAgent
"""
Usage:
python3 ./app.py [port_number]
Options:
port_number The port number on which http server is listening [default: 8080].
"""
_DEFAULT_PORT = 8080
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = _DEFAULT_PORT
server_agent = WebSer... | tassiLuca/web-server | app.py | app.py | py | 354 | python | en | code | 0 | github-code | 13 |
19188636312 | import argparse
from core.transurc import transurc
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--cpf', '--documento', '--doc', type=str, required=True, help='CPF do titular')
parser.add_argument('--nascimento', type=str, required=True, help='Nascimento do titular (DD/... | sdaviid/cli-transurc-saldo | consultar.py | consultar.py | py | 462 | python | pt | code | 1 | github-code | 13 |
29999216474 | # coding: utf8
import os
import django
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
django.setup()
from blog.models import *
def init_category_action(delete_all=False):
if delete_all:
Category.objects.all().delete()
raw_category = Category(**{
'title': u'默认分类',
'is_fixed': True
... | quietin/myblog | base/django_env_run/init_blog.py | init_blog.py | py | 556 | python | en | code | 0 | github-code | 13 |
35981741312 | # -*- coding: UTF-8 -*-
# author:@Jack.Wang
# time :2018/8/29 19:13
"""
事件驱动型的回测
三部分
一:event_data 负责数据的推送
二:event_strategy 负责收取数据,并推送行情数据和order
三:event_backtest 负责回测数据收集,收集之后,别忘分析
"""
from backtest.Backtest_Data import dataload
from backtest.Backtest_Order_Drive import order_driven_backtest
from EventEngine.EventEn... | wangyundlut/Futures_Quant | backtest/Backtest_EventDriven.py | Backtest_EventDriven.py | py | 6,530 | python | en | code | 1 | github-code | 13 |
28127484800 | """打印二叉树的边界节点
题目:
给定一棵二叉树的头节点head,按照如下标准分别实现二叉树边界节点的逆时针打印
标准一:
1.以头节点为边界节点
2.以叶节点为边界节点
3.如果节点在其所在的层中是最左或者最右的,那么也是边界节点
"""
# 题目解法:
# 1.打印每一次最左的节点
# 2.叶节点中不是最左也不是最右的节点
# 3.打印每一层中最右的节点
class Node(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None... | liruileay/data_structure_in_python | data_structure_python/question/chapter3_binary_tree/question3.py | question3.py | py | 2,808 | python | en | code | 0 | github-code | 13 |
72704221777 | from django.http import HttpResponse, Http404
from django.shortcuts import render
from django.shortcuts import redirect
from datetime import datetime
from django.shortcuts import render, get_object_or_404
from blog.models import Article
from .forms import ContactForm, ArticleForm, ScriptForm, PythonForm
from bit... | alexisbrochec/blockchain | learningDjango/blog/views.py | views.py | py | 4,675 | python | fr | code | 0 | github-code | 13 |
42570724340 | import requests, json, base64, sys, os
from flask import Flask
from flask import request
####################
#
# CONFIGURATION
#
####################
# Determine if script is launched inside container or from shell
if os.environ.get('INCONTAINER'):
host = 'consul'
else:
host = '127.0.0.1'
scheme = 'http'
... | StephaneDci/glpi_docker | api-consul/python_api_v1/restapi.py | restapi.py | py | 3,569 | python | en | code | 0 | github-code | 13 |
35951013546 | from ..codegen import *
from .utility import *
class inst_fma_t(object):
def __init__(self, arch_config):
self.arch_config = arch_config
def __call__(self, reg_c, reg_a, reg_b):
if self.arch_config.data_type == AMDGPU_PRECISION_FP32:
if self.arch_config.arch == AMDGPU_ARCH_GFX906:
... | ROCmSoftwarePlatform/MISA | python/operations/fma_main_loop.py | fma_main_loop.py | py | 13,787 | python | en | code | 29 | github-code | 13 |
28423051236 | from . import ifcopenshell
def FXIIIe_SlabsinFloor(ifc):
Floors=ifc.by_type('IFCBUILDINGSTOREY')
Rels=ifc.by_type('IFCRELCONTAINEDINSPATIALSTRUCTURE')
Slabs=ifc.by_type('IFCSLAB')
DicSlabs_Floor={}
for Rel in Rels:
ClassId=[]
if Rel[len(Rel)-1] in Floors:
Floor=Rel[len(Rel)-1]
ContainsElements=... | abieru/encore-project | django-portal/dj_portal_encore/portal/GeometryExtraction_v10/FXIIIe_SlabsinFloor.py | FXIIIe_SlabsinFloor.py | py | 496 | python | en | code | 0 | github-code | 13 |
405296953 | from comparioApp import comparioAppInstance, login_handler
from flask_login import current_user, login_user
from flask import request, send_file, render_template, jsonify
import json
#
#PAGE LOADING routes
#
#Loads the homepage
@comparioAppInstance.route('/')
def loadHome():
return render_template('homepage.html... | fpspammers/compario | routes.py | routes.py | py | 1,504 | python | en | code | 0 | github-code | 13 |
71139724497 | from flask import render_template,request,redirect,url_for,abort,current_app
from ..models import User,Event,Donor
from . import main
from flask_login import login_required
from .. import db,photos
from .forms import EventForm,DonorForm
from flask_login import current_user
# Views
@main.route('/')
def index():
eve... | Ketsia-a/Charity-online | app/main/views.py | views.py | py | 3,204 | python | en | code | 0 | github-code | 13 |
26930824847 | import unittest
from pathlib import Path
from linguaml._logger import logger
class TestLogger(unittest.TestCase):
def __init__(self, methodName: str = "runTest") -> None:
super().__init__(methodName)
# Reset the log file path
logger.log_filepath = Path(__file__).paren... | midnight-learners/linguAML | tests/logger.py | logger.py | py | 502 | python | en | code | 0 | github-code | 13 |
4538315363 | import os
import time
filepath = input("What is the name of the directory you would like to use for the address book?\n$")
filename = input("What is the name of the address book file?\n$")
completepath = filepath+filename
print(completepath)
def clear():
if (os.name == "posix"):
os.system("clear")
else:
... | lucasacheney/addressbook | addressbook.py | addressbook.py | py | 1,380 | python | en | code | 0 | github-code | 13 |
288376293 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.utils import timezone
from .models import Post, Comment
def comment(request)... | dewale005/blog | personal/src/blog/views.py | views.py | py | 1,179 | python | en | code | 0 | github-code | 13 |
37464133249 | import bpy
import os
from collections import OrderedDict
from math import pi
from mathutils import *
from bpy.props import *
from bpy_extras.io_utils import ImportHelper
from .armature import CArmature
from .utils import *
#
# Global variables
#
#_sourceArmatures = { "Automatic" : None }
_sourceArmatures = {}
_src... | intoro/MakeHumanForBlender | makehuman-1.1.1-win32/blendertools/makewalk/source.py | source.py | py | 5,746 | python | en | code | 7 | github-code | 13 |
31802374493 | import logging
import logging.handlers
from datetime import datetime
import multiprocessing as mp
from random import choice, random, randint
from experiments.parallel.workers import worker
import time
# ---------------------------------------------------------------------------------------------------------------------... | john-james-ai/lab | experiments/nlr/package/project.py | project.py | py | 1,471 | python | en | code | 0 | github-code | 13 |
3280503641 | import random
def funcion_objetivo(x):
return (x/(2**30-1))**2
#El individuo se puede crear a partir de un valor random de x al iniciar la poblacion
#Individuo es un diccionario
def crear_individuo(cromosoma = None, x = None):
individuo = {}
if (cromosoma != None): #Se genera el valor X mediant... | leandroberto2010/AG | tp1/funciones.py | funciones.py | py | 4,497 | python | es | code | 0 | github-code | 13 |
13029840965 | import sys
from collections import deque
dq = deque(sys.stdin.readline().rstrip())
prev = ""
cnt = 0
answer = 0
while dq:
new = dq.popleft()
if new == "(":
cnt += 1
elif new == ")":
cnt -= 1
if prev == "(":
answer += cnt
else:
answer += 1
prev = ... | chaeeun-seo/mysources | BOJ #10799 쇠막대기_my_1.py | BOJ #10799 쇠막대기_my_1.py | py | 346 | python | en | code | 0 | github-code | 13 |
17404087628 |
#import pymongo
#import werkzeug
from connexion import NoContent
from SchedulerJobs.MSSQLQuery import MSSQLQuery
from flask import make_response, abort, jsonify, Response
import json
import crypt
from bson import json_util
from bson.json_util import dumps
from bson.objectid import ObjectId
from scheduler import Schedu... | NTTDATA-EMEA/dynatrace-sql-plugin | src/job.py | job.py | py | 1,289 | python | en | code | 1 | github-code | 13 |
7989173709 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 00:28:59 2021
@author: AKNOUCHE Anis
"""
import pickle
import numpy as np
from Utils import getCVTextsAndLabels, tokenize, vectorization
from sklearn import model_selection
from Classifieurs import SVM, KNN, Aleatoire, Majoritaire, MultinomialNaiveBayes
data_cv = ... | AKNOUCHEanis/PLDAC_ML_CV | main.py | main.py | py | 3,287 | python | fr | code | 0 | github-code | 13 |
22575174160 | import sys
from scripts.ros_controller.scripts.robot_logic_controller import RobotLogicController
try:
import busio
from board import SCL, SDA # import from adafruit_blinka
from adafruit_pca9685 import PCA9685 # import from adafruit-circuitpython-pca9685
from scripts.servo_driver.robo... | tandukion/servorobot_controller | servo_robot.py | servo_robot.py | py | 1,406 | python | en | code | 0 | github-code | 13 |
5131807184 | def solution(order):
answer = 0
order_dict = {"americano" : 4500, "cafelatte" : 5000}
for i in order :
if "ice" in i :
i = i.replace("ice", "")
if "hot" in i :
i = i.replace("hot", "")
if "anything" in i :
i = i.replace("anything", "americano")
... | jeongminllee/ProgrammersCodeTest | 프로그래머스/unrated/181837. 커피 심부름/커피 심부름.py | 커피 심부름.py | py | 580 | python | en | code | 0 | github-code | 13 |
1750372460 | from functions.validação import lerInt
num = lerInt('Digite um número inteiro: ')
if num == 0:
print('O valor 0 é nulo')
exit()
primo = True
if num < 0:
for x in range(num + 1, -1):
if num % x == 0:
primo = False
else:
for x in range(num - 1, 1, -1):
if num % x == 0:
... | Noronha1612/wiki_python-brasil | Estruturas de repetição/ex21.py | ex21.py | py | 441 | python | pt | code | 0 | github-code | 13 |
24309885305 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save
from . import receivers
User = 'auth.User'
class ActiveChannelManager(models.Manager):
def get_queryset(self):
return super().get_queryset()
class Channel(models.Model)... | mushroom2/django_vue_websocket_chat | base/models.py | models.py | py | 1,447 | python | en | code | 0 | github-code | 13 |
10739160795 | import requests
from urllib.parse import urlencode
import os
def get_page(offset):
params = {
'offset':offset,
'format':'json',
'keyword':'游戏',
'autoload':'true',
'count':'20',
'cur_tab':'1',
'from':'search_tab'
}
url = 'https://www.toutiao.com/searc... | parkerhsu/Web_Scraping | Spider/News_today.py | News_today.py | py | 1,463 | python | en | code | 0 | github-code | 13 |
21864669921 | import unittest #2.导入unittest模块
from app import calc #2.导入被测试模块
#3.创建一个继承unittest.TestCase的类
class Tests(unittest.TestCase):
#4.创建test_为前缀的方法,里面用self.assert方法调用被测试的对象
def test_mod_three(self):
self.assertEqual(calc.mod_three(4), 1)
#4.创建test_为前缀的方法,里面用self.assert方法调用被测试的对象
def test_isupper(self... | pythonprogrammingbook/book_codes | ch10/test_app.py | test_app.py | py | 622 | python | zh | code | 6 | github-code | 13 |
70932842578 | import os
import logging
from flask import Flask
from flask import request, jsonify, abort
from urllib.parse import urlparse
import psycopg2
app = Flask(__name__)
# parse connection params using the env variable for PG connection
def get_database_connection_params():
parsed_connection_string = urlparse(str(... | dsandip/bms-auth-webhook-sample | auth-webhook.py | auth-webhook.py | py | 2,766 | python | en | code | 0 | github-code | 13 |
16284224381 | from common.controllers.dbhandles import *
# from tests import test_print_result
# from tests import test_get_user_selection, test_get_integer_input, test_exit
from commontest import * # Common to all tests in nthis repository
# -------------------------------------------------------------------------
# Create a lis... | Nor01/common-savvly | commontest/ria_tests.py | ria_tests.py | py | 7,629 | python | en | code | 0 | github-code | 13 |
70348987858 | import unittest
from mock import patch, Mock
from xivo_dao.data_handler.exception import ElementCreationError
from xivo_dao.data_handler.exception import ElementDeletionError
from xivo_dao.data_handler.exception import ElementEditionError
from xivo_dao.data_handler.voicemail import services as voicemail_services
fro... | jaunis/xivo-dao | xivo_dao/data_handler/voicemail/tests/test_services.py | test_services.py | py | 6,495 | python | en | code | 0 | github-code | 13 |
17413376287 |
def longestCommonPrefix( strs) -> str:
current_longest=strs[0]
lcp(strs,0,len(strs)-1)
def lcp(str_,left,right):
if left==right:
return left
else:
mid=(left+right)/2
lcdleft=lcp(str_,left,mid)
lcdright=lcp(str_,mid+1,right)
ism... | tohsin/Data-structuturess-and-Algorithms | leetcode/python solutions/Divide and conquer/longest_common_prefix.py | longest_common_prefix.py | py | 1,077 | python | en | code | 1 | github-code | 13 |
23607641972 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/5/21 17:24
# @Author : xiezheng
# @Site :
# @File : get_imagePath_list.py
import os
import glob
def fun(path, txt_path):
f = open(txt_path, 'a+')
for fn in glob.glob(path + os.sep + '*'): # '*'代表匹配所有文件
if os.path.isdir(fn): # 如果... | CN1Ember/feathernet_mine | quan_table/insightface_v2/nir_face_dataset/get_feature_txt/get_imagePath_list.py | get_imagePath_list.py | py | 1,320 | python | en | code | 1 | github-code | 13 |
29678807 | def fatorial_exponencial(num):
cont = int(num)
potencia = 1
fatorialExponencial = 1
for l in range(1, cont+1):
potencia *= l
print(potencia)
fatorialExponencial = num ** potencia
return fatorialExponencial
num = input(' digite um numero: ')
if num.isdigit():
... | Sancheslipe/atividades_python_basico_ao_avancado_secao_08 | ex38.py | ex38.py | py | 417 | python | pt | code | 0 | github-code | 13 |
26869535780 | # import random
# # chars = ['0'...'9']
# def encrypt(plain, key):
# encrypted_text = ""
# # 1234 -> 2345 with key of 1
# for char in plain:
# num = int(char)
# shifted_num = (num + key) % 10
# encrypted_text += str(shifted_num)
# return encrypted_text
# def decrypt(encod... | mahmoud-salameh/amman-python-401d5 | class-18/demo/crypto/number_cipher.py | number_cipher.py | py | 1,732 | python | en | code | null | github-code | 13 |
18228161057 | import discord
from discord.ext import commands
intents = discord.Intents.all
client = commands.Bot(command_prefix="!", intents=intents())
support_role = 'staff'
blacklisted_words = [
"whore",
"slut"
]
bot_status = "Support Online"
token = '' | EagleDevsGIT/EagleManager | Config.py | Config.py | py | 273 | python | en | code | 0 | github-code | 13 |
27710497140 | #!/usr/bin/env python
# Author: Paul VIALLARD
#
# This file is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
##############... | paulviallard/NeurIPS21-PB-Robustness | plot/generate_plot.py | generate_plot.py | py | 7,720 | python | en | code | 4 | github-code | 13 |
70023484817 | # sys modules
import numpy as np
import torch
from functools import partial
import cv2
def visual_bbox_mask(image: torch.Tensor,
bboxes: torch.Tensor,
labels: torch.Tensor,
scores: torch.Tensor = None,
gt_bbox: torch.Tensor = None,
... | shineyruan/faster-rcnn-toy | src/utils.py | utils.py | py | 6,876 | python | en | code | 1 | github-code | 13 |
330698066 | CITY_OWNED_PROPERTY_FIELDS = {
"owner_1": [
"CITY OF PHILA",
"PHILA HOUSING AUTHORITY",
"CITY OF PHILADELPHIA",
"PHILADELPHIA HOUSING",
"REDEVELOPMENT AUTHORITY",
"REDEVELOPMENT AUTHORITY O",
"SCHOOL DISTRICT OF PHILA",
"PHILADELPHIA HOUSING AUTH",
... | ssuffian/phillydb | phillydb/labelled_fields.py | labelled_fields.py | py | 2,117 | python | en | code | 1 | github-code | 13 |
29554739619 | #!/usr/bin/python3
delm = ", "
for number in range(1, 100):
if number < 10:
num_str = '0' + str(number)
print("{}".format(num_str), end=delm)
else:
number1 = number
while number1 > 0:
rem = number1 % 10
number1 /= 10
if rem <= int(number1):
... | Yab8702/alx-higher_level_programming | 0x01-python-if_else_loops_functions/6-print_comb3.py | 6-print_comb3.py | py | 586 | python | en | code | 0 | github-code | 13 |
4670851662 | # 1. Написать программу, которая будет складывать, вычитать, умножать или делить два числа.
# Числа и знак операции вводятся пользователем. После выполнения вычисления программа не завершается,
# а запрашивает новые данные для вычислений. Завершение программы должно выполняться при вводе
# символа '0' в качестве знака ... | mutedalien/PY_algo_interactive | less_2/hw_2!/task_1/les_2_task_1.py | les_2_task_1.py | py | 2,162 | python | ru | code | 0 | github-code | 13 |
33758173861 | #! /usr/bin/env python
import aipy as a
import numpy as np
import pylab as pl
pl.rc('text', usetex=True)
pl.rc('font', family='serif')
N = 1024 # number of pixels on one axis
B = 5 # channel BW, in MHz
t = 0.5e6 # integration time, in us, 5 hr
beam_scaling = 0.25
im = a.img.Img(N,0.5)
tx,ty,tz = im.get_top()
omega... | HERA-Team/hera_sandbox | kmk/scripts/hyperion.py | hyperion.py | py | 2,252 | python | en | code | 1 | github-code | 13 |
12581789190 | '''
To get change with minimal currency denominnations
'''
curr_deno = [500,100, 50, 20, 10, 5, 2, 1]
change = []
x = 343
j=1
for i in curr_deno:
print(x//i)
print(x%i)
#while quotient is non zero
if x >= i:
print(i,x)
change.append(str(i)*(x//i))
x = x%i
print(change)... | anupam3693/PracPy | 1-currency_denomination.py | 1-currency_denomination.py | py | 321 | python | en | code | 0 | github-code | 13 |
33652543136 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 15:34:01 2021
@author: fibish
"""
# import the necessary packages
from scipy.spatial import distance as dist
from collections import OrderedDict
import numpy as np
import time
# from datetime import datetime
# import mysql.connector
# mydb = m... | WorkPlaceForMe/algo-to-app | hydrabad_backup/src/use/cent_tracking.py | cent_tracking.py | py | 9,792 | python | en | code | 0 | github-code | 13 |
30607263886 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x06\x1b\
\x69\
\x6d\x70\x6f\x72\x74\x20\x51\x74\x51\x75\x69\x63\x6b\x20\x32\x2e\
\x31\x32\x0d\x... | MetalStrikerXLR/PiControlApp-QML | Assets/QRC/Resources.py | Resources.py | py | 1,139,141 | python | ja | code | 0 | github-code | 13 |
20032664253 | #!/usr/bin/env python3
import pygame
import os
os.chdir(os.path.dirname(__file__))
pygame.init()
screen = pygame.display.set_mode((800, 600))
font = pygame.font.Font(None, 50)
image = pygame.image.load('character2.png')
grassImage = pygame.image.load('grass.png')
wallImage = pygame.image.load('wall.png')
flowerIma... | SpieleentwicklungBodensee/dude | dude.py | dude.py | py | 4,443 | python | en | code | 0 | github-code | 13 |
74387786896 | #! pyhton3
# SpreadSheetCellInverter.py inverts columns and rows in an excel spreadsheet
import openpyxl
from openpyxl.utils import get_column_letter, column_index_from_string
wb = openpyxl.load_workbook("write_formula.xlsx", data_only=True)
sheet = wb['Sheet']
sheet_data = []
for y in range(1, sheet.max_col... | DavGoodman/SpreadSheet-Cell-Inverter | SpreadSheetCellInverter.py | SpreadSheetCellInverter.py | py | 780 | python | en | code | 0 | github-code | 13 |
17054855774 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiMerchantDepartmentShopsQueryModel(object):
def __init__(self):
self._auth_code = None
self._dept_id = None
self._need_sub = None
@property
def auth_code(sel... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/KoubeiMerchantDepartmentShopsQueryModel.py | KoubeiMerchantDepartmentShopsQueryModel.py | py | 1,843 | python | en | code | 241 | github-code | 13 |
24566543583 | from modules.api.query import query
import modules.cache.cache as cache
def get_teams(year, league):
querystring = {"league": league,"season": year}
data = cache.load('team-' + str(league) + '-' + str(year) + '.txt')
if not data:
print('load from api')
data = query("https://api-football-v1... | starbuck007/football_parser | modules/api/team.py | team.py | py | 766 | python | en | code | 0 | github-code | 13 |
13038621027 | import pandas as pd
import numpy as np
from sqlalchemy import create_engine
from math import sqrt
import time
from coords_adj import apply_coords_adjustments as rink_adjust
from db_info import *
def assign_shots(season, play, players, avgs):
# Assign to avgs and player totals (but only for regular season)
if ... | HarryShomer/Shooter-xG-Model | clean_data_xg.py | clean_data_xg.py | py | 21,490 | python | en | code | 8 | github-code | 13 |
31528674960 | # Joan Quintana Compte-joanillo. Assignatura CNED (UPC-EEBE)
'''
Mètode de Brent per trobar l'arrel de x^2 -1
cd /home/joan/UPC_2021/CNED/apunts/python/T1/
PS1="$ "
python3 brentq.py
'''
import os
# ==============
os.system("clear")
titol = 'script ' + os.path.basename(__file__) + '\n'
for i in range(0,len(titol)-1):... | joanillo/CNED | T1/brentq.py | brentq.py | py | 558 | python | en | code | 0 | github-code | 13 |
37445128405 | from shutil import which
import os
import tempfile
# constants
FZF_URL = "https://github.com/junegunn/fzf"
class FzfPrompt:
def __init__(self, executable_path=None):
if executable_path:
self.executable_path = executable_path
elif not which("fzf") and not executable_path:
... | nk412/pyfzf | pyfzf/pyfzf.py | pyfzf.py | py | 1,427 | python | en | code | 164 | github-code | 13 |
73474854739 | #------------------------------------------------------------------------
from sklearn.linear_model import LinearRegression
import numpy as np
import pandas as pd
import os
import time
import math
def find_nearest(a, a0):
# https://stackoverflow.com/a/2566508
"Element in nd array `a` closest to the scalar valu... | EMengiste/data_reduction_scripts | common_scripts/tool_box.py | tool_box.py | py | 14,634 | python | en | code | 0 | github-code | 13 |
36760305516 | import random
import string
BASE_UI_PORT = 8080
BASE_GOSSIP_PORT = 5000
SHARE_DIRECTORY_NAME = '_SharedFiles/'
DOWNLOAD_DIRECTORY_NAME = '_Downloads/'
CHUNK_SIZE = 8192
def gossiper_name_to_port_offset(name: str) -> int:
if len(name) is not 1 or ord(name) < ord('A') or ord(name) > ord('Z'):
raise ValueEr... | Zorvalt/peerster_tests | peerster_objects/common.py | common.py | py | 622 | python | en | code | 0 | github-code | 13 |
18190616816 | from Bio import AlignIO
from Bio.AlignIO import MafIO
import os
import pandas as pd
import sys
from gwf import Workflow
gwf = Workflow()
if not os.path.isdir('../tmp/'):
os.mkdir('../tmp/')
###################### FILTERING OF THE MAF FILE ######################
## Required files: Maffilter stand alone program req... | rivasiker/coalhmm_pipeline | scripts/workflow.py | workflow.py | py | 6,762 | python | en | code | 0 | github-code | 13 |
29026291891 | CAR_NUMBER = "CAR_2014_11_004"
CAR_NAME = "Remote PowerShell Sessions"
CAR_DESCRIPTION = "According to ATT&CK, PowerShell can be used over WinRM to remotely run commands on a host. When a remote PowerShell session starts, svchost.exe executes wsmprovhost.exe"
ATTACK_TACTIC = "Execution, Lateral Movement"
CAR_URL = "htt... | unfetter-discover/unfetter-analytic | analytic-system/src/CAR_2014_11_004.py | CAR_2014_11_004.py | py | 2,040 | python | en | code | 174 | github-code | 13 |
73163205459 | #!/usr/bin/env python3
import pdb
import re
class ParserException(Exception): pass
class Token():
IDENT, BLANK, NUMBER, SYMBOL, EOL, EOF = range(6)
name = ("Identifier", "Blank", "Number", "Symbol", "EOL", "EOF")
def __init__(self, kind, val = None):
self.kind = kind
self.val = val
... | iguerra94/msp430-simulator | parser.py | parser.py | py | 5,902 | python | en | code | 0 | github-code | 13 |
26634838765 | import tensorflow as tf
import numpy as np
import imutils
import os
import sys
from utility import *
from utils import label_map_util
from utils import visualization_utils as vis_util
from PIL import Image
import cv2
import math
import statistics
def bb_intersection_over_union(boxA, boxB):
# determine the (x, y)-coor... | RAIJM/AIMeterReader | final_model.py | final_model.py | py | 8,820 | python | en | code | 2 | github-code | 13 |
17093801594 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.MpcpromoGoodsList import MpcpromoGoodsList
class TechriskInnovateMpcpromoDataQueryResponse(AlipayResponse):
def __init__(self):
super(TechriskInnovateMpc... | alipay/alipay-sdk-python-all | alipay/aop/api/response/TechriskInnovateMpcpromoDataQueryResponse.py | TechriskInnovateMpcpromoDataQueryResponse.py | py | 1,092 | python | en | code | 241 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.