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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
7180333833 | '''
Command line tool to use Github's API for automation.
Usage: githubot [--version] <command> [<args>...]
options:
-h --help Show this message and exit.
-v --version Show version.
Subcommand:
config Config management.
release Releases management.
file Files management.
'''
import sys
... | WqyJh/githubot | githubot/githubot.py | githubot.py | py | 1,256 | python | en | code | 1 | github-code | 13 |
11792188193 | from dataclasses import dataclass, field
from sql import session_scope, engine_named, safe_check_dot_db
from sql.helpers import query_stmt, db_add_or_merge, ss_result_to_namedtuples
from sql.models import (
AcadDocumentBase,
DesignError,
AcDbAttributeBase,
TitleBlockEtc,
AcDbBlockReferenceBase,
... | cobujo/tieint-remote | processing/pkg.py | pkg.py | py | 8,735 | python | en | code | 0 | github-code | 13 |
3082718515 | import pytest
from company.tests import factories
from exportplan import serializers
@pytest.mark.django_db
def test_company_exportplan_serializer_save():
company = factories.CompanyFactory.create(number='01234567')
export_commodity_codes = [{'commodity_name': 'gin', 'commodity_code': '101.2002.123'}]
ex... | uktrade/directory-api | exportplan/tests/test_serializers.py | test_serializers.py | py | 2,365 | python | en | code | 3 | github-code | 13 |
5290815776 | #!/usr/bin/env python3
#
# Python module that knows where all the data, models, and protocols are, and
# can load them.
#
from __future__ import division, print_function
import inspect
import myokit
import numpy as np
import os
# Get root of this project
try:
frame = inspect.currentframe()
ROOT = os.path.dirn... | CardiacModelling/FourWaysOfFitting | python/data.py | data.py | py | 8,572 | python | en | code | 4 | github-code | 13 |
15392761267 | import copy
import sys
import time
from .module import Module
import numpy
import numpy as np
import importlib.util as imp
if imp.find_spec("cupy"):
import cupy
import cupy as np
na = np.newaxis
# -------------------------------
# Sequential layer
# -------------------------------
class Sequential(Module):
... | sebastian-lapuschkin/lrp_toolbox | python/modules/sequential.py | sequential.py | py | 15,100 | python | en | code | 311 | github-code | 13 |
16817073036 | from django.db import models
from django.urls import reverse
from django.utils.html import format_html
from itertools import chain
from overview.make_gantt import *
class Group(models.Model):
""" Модель, описывающая группы туристов """
group_name = models.CharField(max_length=50,
... | n1energy/tourist | tourists/models.py | models.py | py | 12,160 | python | ru | code | 0 | github-code | 13 |
8151351202 | import csv
from flask.ext.script import Command
from flask.ext.script import Option
from knotmarker.models import PolygonType, User
class TypesImporter(Command):
option_list = (
Option('--types', '-t', dest='types_csv',
help='File with types definition'),
)
def run(self, types_c... | TruePositiveLab/knotmarker | knotmarker/commands/import_types.py | import_types.py | py | 646 | python | en | code | 0 | github-code | 13 |
20182828121 | n=int(input())
lis=input().split(" ")
lis1=[]
lis2=[]
for i in lis:
if i=="0":
lis1.append(int(i))
else:
lis2.append(int(i))
num=""
num0=""
lis1.sort()
for y1 in lis1:
num0+=str(y1)
lis2.sort()
for y2 in lis2:
num+=str(y2)
num=num[0]+num0+num[1:]
print(int(num)) | Chonapatcc/beta-programming-thailand | numbers/Main.py | Main.py | py | 300 | python | en | code | 0 | github-code | 13 |
5776113398 | import torch
from torch import nn
import numpy as np
import torchvision.transforms as transforms
from torchvision import models
from torchvision.models import resnet50,ResNet50_Weights
from PIL import Image
i2l = { '1000': 'ЗА',
'0100': 'ПРОТИВ',
'0010': 'ВОЗДЕРЖАЛСЯ',
'0001': 'НЕГОЛОСОВАЛ',
... | terrainternship/Pragmatick_OCR_g | YURI_KOBYZEV/SITE/votemodels/votemodel.py | votemodel.py | py | 4,515 | python | en | code | 0 | github-code | 13 |
43702697672 | """
Run the shift algo by supplying a directory name
"""
# External Packages
import datetime as dt
import helper_functions as hf
import logging
import logging_config
import numpy as np
import os
import re
# Internal Packages
from . import shift_algo
from algorithm import auto_shift
# Set logger for this module
loggin... | Lilyheart/LILAC | tests/shift_by_files.py | shift_by_files.py | py | 10,087 | python | en | code | 0 | github-code | 13 |
6792115640 | # import external libraries
import pandas as pd
import sys
import os
from cmath import nan
# import internal classes
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '.')))
from model import Model
from project import Project
from structuralMaterial import StructuralMaterial
from structuralCro... | dogukankaratas/safpy | safpy/structure.py | structure.py | py | 24,850 | python | en | code | 0 | github-code | 13 |
30361059047 | import socket
from rhizome.protocol.client import RhizomeClient
from rhizome.protocol.messages import BroadcastMessage
if __name__ == '__main__':
# Create client
sender_id = socket.gethostname()
rhizome_client = RhizomeClient(sender_id)
# Create message
message = BroadcastMessage(sender_id, socke... | scottbarnesg/rhizome | rhizome/run_client.py | run_client.py | py | 476 | python | en | code | 0 | github-code | 13 |
73488257297 | # https://leetcode.com/problems/number-of-valid-words-in-a-sentence/
# A sentence consists of lowercase letters ('a' to 'z'), digits ('0' to '9'), hyphens ('-'), punctuation marks ('!', '.', and ','),
# and spaces (' ') only. Each sentence can be broken down into one or more tokens separated by one or more spaces ' '... | aslamovamir/LeetCode | number_of_valid_words_in_a_sentence.py | number_of_valid_words_in_a_sentence.py | py | 2,981 | python | en | code | 0 | github-code | 13 |
73709421457 | # -*- coding: utf-8 -*-
import math
from pgmagick import CompositeOperator as co, Geometry
from pgmagick.api import Image as pgai, Draw
__author__ = 'myth'
LEFT_TOP = 'lt'
LEFT_BOTTOM = 'lb'
RIGHT_TOP = 'rt'
RIGHT_BOTTOM = 'rb'
WIDTH_GRID = 30.0
HEIGHT_GRID = 30.0
def dotted_line(start, end, step=5):
"""
... | ederrafo/bottle | util/thumbnail/watermark.py | watermark.py | py | 6,283 | python | en | code | 0 | github-code | 13 |
13527458682 | from figuras.cuadrado import area_cuadrado, perimetro_cuadrado
from figuras.circulo import area_circulo, perimetro_circulo
lado = 4
cuadrado = {
"lado": lado,
"area": area_cuadrado(lado), #Al importar nos permite ejecutar las funciones que contienen
"perimetro": perimetro_cuadrado(lado)
}
print("cuadrado:... | alberto006-esp/curso-python-esencial | main.py | main.py | py | 534 | python | pt | code | 0 | github-code | 13 |
39778396552 | import constants as c
import shared_build_steps as u
def add_java_build_step(platform_config):
# after the maven build is complete, copy the JAR artifact to the central output directory
__add_maven_step(platform_config, c.build_j2v8_java, u.java_build_cmd, [u.copyOutput])
def add_java_test_step(platform_confi... | eclipsesource/J2V8 | build_system/java_build_steps.py | java_build_steps.py | py | 2,560 | python | en | code | 2,446 | github-code | 13 |
20033826330 | import heapq
import queue
"""
Nhận xét :
Với mỗi một two-way road proposed, tính chi phí đường đi từ S->T. Chi phí nào có đường đi ngắn nhất thì đó chính là kết quả.
Lưu ý: Để làm được việc này thì mỗi lần gắn đường đi hai chiều vào bạn phải chạy lại thuật toán Dijkstra. Việc này sẽ làm bài bạn bị quá thời gian (TLE)... | luffy2106/bigO_coding | Lecture8_Dijkstra/TrafficNetwork.py | TrafficNetwork.py | py | 3,096 | python | vi | code | 0 | github-code | 13 |
35311452489 | from ast import Break
from asyncio.windows_events import NULL
import random
opcion = 0
numEscogido = 0
numAleatorio = 0
#----------------------------------------------------------------
def ahorcado():
with open("juego_penjat.txt","r") as file:
alltext=file.read()
words = list(map... | AdriaRodriguez/Actividad-1-PRogramacion | ACTIVIDAD1.py | ACTIVIDAD1.py | py | 5,221 | python | es | code | 0 | github-code | 13 |
1025455033 |
from typing import List
from .metadata import MetaData
from ..utils import get_yes_no_input
from .analogy import evaluate_analogy_folder
from .similarity import evaluate_similarity_folder
def add_metadata_file(folder: str, file_type: str, extension: str, attributes: List[str]):
with MetaData(
fo... | Turkish-Word-Embeddings/Word-Embeddings-Repository-for-Turkish | evaluation/package/experiment/__init__.py | __init__.py | py | 1,303 | python | en | code | 1 | github-code | 13 |
19904999357 | class Solution(object):
def arrayPairSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
return sum(nums[::2])
s = Solution()
a = s.arrayPairSum([1,4,3,2])
print(a) | littleliona/leetcode | easy/561.Array_partition_I.py | 561.Array_partition_I.py | py | 246 | python | en | code | 0 | github-code | 13 |
17122484874 | # -*- coding: utf-8 -*-
# base
# data science
import numpy as np
import pandas as pd
from scipy.stats import levene, ttest_ind, f_oneway
#from scipy.stats import ttest_rel, mannwhitneyu, skew, kurtosis
#from scipy.stats.mstats import kruskalwallis
#from statsmodels.formula.api import ols
#from statsmodels.stats.anova i... | Lukaschen1986/Udacity-Capstone-Project | 3-script/func_detail.py | func_detail.py | py | 21,156 | python | en | code | 0 | github-code | 13 |
5455567620 | from .models import Paciente
import django
import sys
def imagen_usuario(request):
try:
imagen = None
usuario = request.usuario
up = Perfil.objects.get(perfil_usuario=usuario)
#print up
imagen = 'http://localhost:8000/media/%s'%up.imagen
except:
imagen = 'http://localhost:8000/media/debian.jpg'
return ... | guille1194/Django-Practices | practica23/demo/apps/home/processors.py | processors.py | py | 611 | python | es | code | 0 | github-code | 13 |
33246234689 | num = [4,3,2,7,9,2,3,1]
n = len(num)
num = set(num)
output = list()
for i in range(1, n):
if i in num:
continue
else:
output.append(i)
print(output)
| Narek-Papyan/ml | Practical_5/find-all-numbers-disappeared-in-an-array.py | find-all-numbers-disappeared-in-an-array.py | py | 173 | python | en | code | 0 | github-code | 13 |
44993182135 | # -*- coding: utf-8 -*-
"""
Author: whung
This is the main script to run the fire spread model.
"""
import numpy as np
import pandas as pd
import os
'''Settings'''
namelist = pd.read_csv('./input/namelist', header=None, delimiter='=')
namelist = namelist[1]
## input/ouput files
frp_input = namelist[0].replace('... | angehung5/fire-spread-model | src/fire_model.py | fire_model.py | py | 4,099 | python | en | code | 0 | github-code | 13 |
28298767939 | def check_rhythm(poem):
syllables = []
for phrase in poem.split():
phrase_syllables = []
for word in phrase.split('-'):
num_syllables = count_syllables(word)
phrase_syllables.append(num_syllables)
syllables.append(phrase_syllables)
return all(phrase == syllabl... | AndreiZaRich/python_1 | Task_34.py | Task_34.py | py | 970 | python | en | code | 0 | github-code | 13 |
10573975877 | from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
import scipy.io as sio
import numpy as np
# Process images of this size. A number which make impact to entire model
# architecture.
IMAGE_SIZE = 24
# Global constants describing the CIFAT-10 data set
NUM_CLASSES =... | ccuulinay/udacity_deep_learning | svhn/svhn_input.py | svhn_input.py | py | 7,186 | python | en | code | 0 | github-code | 13 |
29294167278 | from collections import defaultdict
import math
input_file = 'day-20/input.txt'
def get_divisors(n):
small_divisors = [i for i in range(1, int(math.sqrt(n)) + 1) if n % i == 0]
large_divisors = [n / d for d in small_divisors if n != d * d]
return small_divisors + large_divisors
def part1(input):
target = int... | stevenhorsman/advent-of-code-2015 | day-20/infinite_elves.py | infinite_elves.py | py | 833 | python | en | code | 0 | github-code | 13 |
16541950589 | '''
* no. of inputs: 4
- 1 string (f) [the function which will be integrated]
- 3 numbers
- n [count of points in Gauss formula which may have value of 2 or 3 only]
- 2 limits of integration which may have values from -1e9 (negative infinity) to 1e9 (infinity)
* no. of outputs: 1 [Valu... | NumericalA/Numerical | Team 7 - Integration with Gauss-Legendre.py | Team 7 - Integration with Gauss-Legendre.py | py | 2,054 | python | en | code | 1 | github-code | 13 |
75077652176 | import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Flatten
def dice_coefficient(y_true, y_pred,smooth = 100):
y_true_flatten = K.flatten(y_true)
y_pred_flatten = K.flatten(y_pred)
intersection = K.sum(y_true_flatten * y_pred_flatten)
union = K... | Vampaxx/brain_tumor_Unet | src/brain_tumor/utils/loss_functions.py | loss_functions.py | py | 1,159 | python | en | code | 0 | github-code | 13 |
74011888656 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 2 11:09:42 2021
@author: dingxu
"""
import numpy as np
from sklearn.cluster import KMeans,DBSCAN,AgglomerativeClustering
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import mixture
from matplotlib.pyplot import MultipleLocator
from sklearn.preprocess... | dingxu6207/NGC4337 | NGC4337/RDP.py | RDP.py | py | 2,517 | python | en | code | 0 | github-code | 13 |
42081421416 | def solution(array):
answer = 0
max_ = 0
visit = [0] * 1000
for i in array:
visit[i] += 1
for i in range(1000):
if visit[i] > max_:
max_ = visit[i]
answer = visit.index(max_)
if visit.count(max_)>1:
answer = -1
return answer | HotBody-SingleBungle/HBSB-ALGO | HB/pysrc/프로그래머스/레벨0/Day3/최빈값_구하기.py | 최빈값_구하기.py | py | 315 | python | en | code | 0 | github-code | 13 |
5074443035 |
import logging
from .url import UrlMgr
from .helper import urldecode, normalize_title
log = logging.getLogger(__name__)
# maintains lowlevel information about the video file
# basically name, title and stream object
class VideoInfo(object):
def __init__(self, url):
self.subdir = ""
self.flv_url ... | balrok/Flashget | flashget/videoinfo.py | videoinfo.py | py | 3,500 | python | en | code | 6 | github-code | 13 |
22295443747 | import json
import unittest
import ddt
import requests
from common import requests_handler
from middleware.handler import Handler
# 初始化
logger = Handler.logger
test_data = Handler.excel.read_data("shop_register")
env_data = Handler()
@ddt.ddt
class RegTestCase(unittest.TestCase):
@classmethod
def setUpClas... | indyix/auto_interface | tests/1test_reg.py | 1test_reg.py | py | 2,496 | python | en | code | 0 | github-code | 13 |
36441370954 | import justpy as jp
def app():
# Create the Quasar webpage
wp = jp.QuasarPage()
# Create QDiv components linked to the webpage
h1 = jp.QDiv(a=wp, text="Analysis of Course Reviews", classes="text-h3 text-center")
# Typography classes list in https://quasar.dev/style/typography
p1 = jp.QDiv(a=wp... | daniel-ob/python-mega-course | app8_DataVisualisationWebApp/0-simple-app.py | 0-simple-app.py | py | 408 | python | en | code | 1 | github-code | 13 |
163708056 | import json
from PIL import Image, ImageDraw, ImageFont
from PIL import ImagePath
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
import pandas as pd
import sys
from matplotlib.backends.backend_pdf import PdfPages
import explore as ex
def get_font(fontsize=40):
... | CnrLwlss/manannan | src/annotation.py | annotation.py | py | 8,461 | python | en | code | 0 | github-code | 13 |
33596572108 | import matplotlib as mpl
import matplotlib.pyplot as plt
from random import randint
import time
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111)
points = []
Ttime=0
for i in range(0,50):
start = time.time()
Fib = 0
temp = 0
num = 1
num2 = 1
in1 = i
inp = in1-2
while inp>0:... | miacastroco/Iphyton | fibonacciPython.py | fibonacciPython.py | py | 664 | python | en | code | 0 | github-code | 13 |
13520881726 | """
Run like this : `AWS_DEFAULT_REGION='us-east-1' pytest`
"""
import os
import json
import sys
import zipfile
import io
import logging
import mock
import socket
import boto3
import sure
from moto import mock_autoscaling, mock_ec2, mock_iam, mock_lambda
sys.path.append('..')
logger = logging.getLogger()
logger.set... | 1debit/alternat | functions/replace-route/tests/test_replace_route.py | test_replace_route.py | py | 6,218 | python | en | code | 873 | github-code | 13 |
12663723982 | from bs4 import BeautifulSoup
def html(name, clean):
with open(name, "r") as file:
contents = file.read()
soup = BeautifulSoup(contents, 'lxml')
title = soup.text
file = open(clean, 'w')
file.write(title)
file.close()
return soup
name = input("Absolute path ot file: ")
clean = input("Name of cleaned ... | ls500pymaster/Python_Basics | py_basic_HM/Clear html in file_HW_31.py | Clear html in file_HW_31.py | py | 355 | python | en | code | 0 | github-code | 13 |
16184452473 | """
미확인 도착지(https://www.acmicpc.net/problem/9370)
- 입력 : 테스트 케이스의 개수 T(1 <= T <= 100)
첫번째 줄에 3개의 정수 n, m, t(2 <= n <= 2,000, 1 <= m <= 50,000, 1 <= 1t <= 100)
각각 교차로, 도로, 목적지 후보의 개수
두번째 줄에 3개의 정수 s, g, h(1 <= s, g, h <= n)
s는 예술가들의 출발지, g, h는 지나간 교차로의 사... | akana0321/Algorithm | BaekJoon/Shortest Path/unidentified_destination_9370.py | unidentified_destination_9370.py | py | 2,588 | python | ko | code | 0 | github-code | 13 |
25550895192 | player = {
"Move Forward": [glass.Key.UP, ord("W")],
"Move Backward": [glass.Key.DOWN, ord("S")],
"Move Left": [glass.Key.LEFT, ord("A")],
"Move Right": [glass.Key.RIGHT, ord("D")],
"Jump": [glass.Key.SPACE, glass.Key.LEFT_CONTROL,glass.Key.RIGHT_CONTROL],
"Sprint": [glass.Key.LEFT_SHIF... | biggeruniverse/srdata | client/game/settings/default_bindactions.py | default_bindactions.py | py | 3,814 | python | en | code | 1 | github-code | 13 |
35165339951 | from Person import *
from Car import *
class Employee(Person):
employeesNum = 0
def __init__(self, id, car, email, salary, distanceToWork):
self.id = id
self.car = car
self.email = email
self.salary = salary
self.distanceToWork = distanceToWork
Employee.employe... | Mohamadmahgoub910/Lab-4-Py | Employee.py | Employee.py | py | 1,290 | python | en | code | 0 | github-code | 13 |
20612544772 | import unittest
from work_file import reverse
class TestReverse(unittest.TestCase):
def test_if_empty_string_will_return_empty_output(self):
# Arrange
my_string = ''
#Act
result = reverse(my_string)
# Assert
self.assertEqual(result, "")
def test_i... | cholards/training2023Jan | test_work_file.py | test_work_file.py | py | 513 | python | en | code | 0 | github-code | 13 |
38148380288 | # imports
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.metrics import mean_squared_error, r2_score, explained_variance_score
from sklearn.linear_model import LinearRegression
from sklearn.feature_selection import f_regression
from math import sqrt
import ... | o0amandagomez0o/regression-exercises | evaluate.py | evaluate.py | py | 3,661 | python | en | code | 0 | github-code | 13 |
74638008656 | if __name__ == '__main__':
records = []; # 전체를 받을 배열입니다.
scores = []; # 점수를 받을 배열입니다.
for _ in range(int(input())):
name = input()
score = float(input())
records.append([name, score]) # 이름과 점수를 입력받아 배열에 넣습니다.
scores.append(score) # 점수만 넣습니다.
scores = list(... | Coding-Test-Study-Group/Coding-Test-Study | Cobluesky/hackerrank - nested_list.py | hackerrank - nested_list.py | py | 1,109 | python | ko | code | 4 | github-code | 13 |
5591423461 | import tkinter as tk
class BudgetYearMonthMenu:
def __init__(self, root, budzety):
self.root = root
self.root.title("Budget Year Month Menu")
self.budzety = budzety
self.budget_label = tk.Label(root, text="Select Budget:")
self.budget_label.pack()
self.budget_var =... | Melkorn/MoneyTracker | gui.py | gui.py | py | 2,184 | python | en | code | 0 | github-code | 13 |
30739832655 | def is_diagonal(matrix):
for i in range(len(matrix)):
for j in range(len(matrix)):
if i != j and matrix[i][j] != 0:
return False
return True
def list(row, column):
matrix = []
ilist = []
for i in range(1, row+1):
ilist = []
for j in range(1, column+1):
... | rnlifts/semester2 | New folder/diagonal_matrix.py | diagonal_matrix.py | py | 823 | python | en | code | 0 | github-code | 13 |
34785880288 | from rct229.rulesets.ashrae9012019.ruleset_functions.get_hvac_zone_list_w_area_dict import (
get_hvac_zone_list_w_area_dict,
)
from rct229.schema.config import ureg
from rct229.schema.schema_utils import quantify_rmr
from rct229.schema.validate import schema_validate_rmr
TEST_RMR = {
"id": "test_rmr",
"bui... | pnnl/ruleset-checking-tool | rct229/rulesets/ashrae9012019/ruleset_functions/get_hvac_zone_list_w_area_dict_test.py | get_hvac_zone_list_w_area_dict_test.py | py | 3,020 | python | en | code | 6 | github-code | 13 |
23029063132 | from sklearn import preprocessing
import numpy as np
class ScalerToolkit(object):
def __init__(self, data_train):
self.__data_train = data_train
def __show_result(func):
def inner(*args, **kwargs):
result = func(*args, **kwargs)
print(f"结果:\n{result}")
prin... | IBNBlank/toy_code | ai_tool_lesson/sklearn/scaler_toolkit.py | scaler_toolkit.py | py | 2,393 | python | en | code | 0 | github-code | 13 |
4568620818 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def invertTree(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
if not root:
... | Weikoi/OJ_Python | leetcode/easy/easy 201-400/226_翻转二叉树.py | 226_翻转二叉树.py | py | 912 | python | en | code | 0 | github-code | 13 |
7223508335 | import PySimpleGUI as sg
import numpy as np
import xlsxwriter
from tabulate import tabulate
from ctypes import windll
windll.shcore.SetProcessDpiAwareness(1) # убирает размытость!!!
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
def fill_xml(arr_rows_xml):
with xlsxwriter.Workbook('credit_calc_op... | IgelSchnauze/bank-informatics | credit_calculator_v3.py | credit_calculator_v3.py | py | 8,428 | python | ru | code | 0 | github-code | 13 |
23439446949 | # 86. Crie um programa que crie uma matriz de dimensão 3x3 e preencha com
# valores lidos pelo teclado.
'''
_____
0 |_|_|_|
1 |_|_|_|
2 |_|_|_|
0 1 2
'''
# No final, mostre a matriz na tela, com a formatação correta.
# Definimos o esqueleto com os "0" para não ter que usar o append
matriz = [[0, 0, 0... | rafaelribeiroo/scripts_py | Mundo 03: Estruturas Compostas/26. Exercícios: Listas II/86. Matriz em python.py | 86. Matriz em python.py | py | 918 | python | pt | code | 2 | github-code | 13 |
42090513609 | from glob import glob
import cv2
import os
import io
import random
import zipfile
import requests
import numpy as np
# set random seed for reproducibility
random.seed(10)
cv2.setRNGSeed(10)
# path to the downloaded zip file
noisy_office_zip_path = "NoisyOffice.zip"
with zipfile.ZipFile(noisy_office_zip_path, 'r') as... | kwcckw/Converted_noisy_office | conversion_code.py | conversion_code.py | py | 2,994 | python | en | code | 0 | github-code | 13 |
13238455935 | """
Concrete CollectorStrategy classes for the GitHub built-in module
"""
import re
from anchorhub.collector import CollectorStrategy
import anchorhub.builtin.regex.markdown as mdrx
class MarkdownATXCollectorStrategy(CollectorStrategy):
"""
Concrete collector strategy used to parse ATX style headers that hav... | samjabrahams/anchorhub | anchorhub/builtin/github/cstrategies.py | cstrategies.py | py | 5,978 | python | en | code | 6 | github-code | 13 |
28124975030 | import sys
sys.path.append('/workspace/classification/code/') # zjl
import torchvision
from torchvision import transforms
from torch.utils.data import DataLoader
from configs import config
def load_images(data_type):
assert data_type in ['train', 'test']
if data_type == 'train':
transform_train =... | LIRUIJIE0330/model-doctor6 | loaders/svhn_loader.py | svhn_loader.py | py | 1,732 | python | en | code | 0 | github-code | 13 |
38587939933 | from sys import argv
if len(argv) != 2:
print('Usage: ' + argv[0] + ' <VCF file>')
exit(1)
vcffilename = argv[1]
def hwe_chi_squared(gt0, gt1, gt2):
total = gt0 + gt1 + gt2
pfreq = (gt0 + 0.5 * gt1) / total
qfreq = (gt2 + 0.5 * gt1) / total
exp_gt0 = max(pfreq * pfreq * total, 0.00000000000... | kehrlab/PopDel-scripts | polaris_kids_cohort/plots/hwe.py | hwe.py | py | 1,301 | python | en | code | 2 | github-code | 13 |
30784575425 | from fail2ban.server.actions import ActionBase
import requests, json
class telegramAction(ActionBase):
def __init__(self, jail, name):
self.installpath = '/etc/fail2ban/action.d/'
try: self.config = json.loads(open(self.installpath + 'telegram_config.json', 'r').read())
except Exception as ... | Pyenb/fail2telegram | telegram.py | telegram.py | py | 2,122 | python | en | code | 1 | github-code | 13 |
27110575919 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cryptapp', '0003_auto_20151014_1244'),
]
operations = [
migrations.AddField(
model_name='fback',
nam... | aditi73/cryptic-mining | cryptapp/migrations/0004_fback_email.py | 0004_fback_email.py | py | 413 | python | en | code | 2 | github-code | 13 |
10923971676 | import pandas as pd
import pipit.trace
from pipit.graph import Graph, Node
class MetaReader:
# adds new context id and return new nid
def _add_context_id(self, context_id) -> int:
self.nid_to_ctx[self.current_nid] = context_id
self.current_nid += 1
return self.current_nid - 1
def ... | hpcgroup/pipit | pipit/readers/hpctoolkit_reader.py | hpctoolkit_reader.py | py | 55,684 | python | en | code | 20 | github-code | 13 |
38256141882 | import numpy as np
from image_processing.image_processing import imageSumAlongY
from karabo.middlelayer import (
AccessMode, Assignment, Configurable, DaqDataType, DaqPolicy, Device,
Double, InputChannel, Node, OutputChannel, QuantityValue, Slot, State,
Unit, VectorDouble, VectorInt32, VectorString, get_ti... | European-XFEL/imageProcessor | src/imageProcessor/ImageNormRoi.py | ImageNormRoi.py | py | 6,044 | python | en | code | 0 | github-code | 13 |
24000199053 | from collections import defaultdict, deque
from itertools import accumulate
from typing import IO, Deque, Dict, Generic, Hashable, Iterable, TypeVar
H = TypeVar("H", bound=Hashable)
class RollingWindow(Generic[H]):
def __init__(self, size: int):
self.size = size
self.q: Deque[H] = deque()
... | mattHawthorn/advent_of_code_2022 | solutions/day06.py | day06.py | py | 1,547 | python | en | code | 1 | github-code | 13 |
17061317154 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class VehicleDashboardResult(object):
def __init__(self):
self._class_name = None
self._label = None
self._score = None
@property
def class_name(self):
return s... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/VehicleDashboardResult.py | VehicleDashboardResult.py | py | 1,749 | python | en | code | 241 | github-code | 13 |
16788282154 | """
This is a basic class to create a carla env.
"""
# ==================================================
# import carla module
from train.gym_carla.config.carla_config import version_config
carla_version = version_config['carla_version']
root_path = version_config['root_path']
import glob
import os
import sys
car... | liuyuqi123/ComplexUrbanScenarios | train/gym_carla/envs/BasicEnv.py | BasicEnv.py | py | 10,264 | python | en | code | 37 | github-code | 13 |
27732617006 | """Module for generating test data and adding them to database"""
import random
import string
from typing import Optional, Union
from app.db import Student, Group, Course, db_session
# 20 first names.
FIRST_NAME = ['Monica', 'Rachel', 'Phoeby', 'Daniela', 'Rebecca', 'Eva',
'Alexandra', 'Katherine', 'Lis... | SvyatElkind/students-courses | app/db/test_data.py | test_data.py | py | 6,550 | python | en | code | 0 | github-code | 13 |
33391965432 | # This is the main script used two identify cpt url from NZGD.
# Make sure you get authorization to download data from NZGD, you need username and password to login.
# Charles Wang
# updated Aug 02, 2017
import requests
import numpy as np
from bs4 import BeautifulSoup as bs
import selenium
from selenium import webdr... | charlesxwang/NZGD-DataHack | hackNZGDReally.py | hackNZGDReally.py | py | 3,695 | python | en | code | 0 | github-code | 13 |
74087814739 | # CRISTIAN ECHEVERRÍA RABÍ
import wx
from cer.widgets import cw
import cer.widgets.propeditor as pe
#-----------------------------------------------------------------------------------------
class Cuenta(object):
def __init__(self, banco, numero):
self.banco = banco
self.numero = nume... | cer1969/py-cer-widgets | propeditor/test/pe_test.py | pe_test.py | py | 3,775 | python | es | code | 1 | github-code | 13 |
41632153560 | from django.db import models
from datetime import date
# Create your models here.
class EventType(models.Model):
"""
A list of event types that will be associated with
public documents. This will be used to create a picklist
for ChurchEvents.
"""
eventType = models.CharField(max_length=30)
... | redmanr/whuc | whuc/church/models.py | models.py | py | 2,014 | python | en | code | 0 | github-code | 13 |
41768211071 | import discord
import requests
import asyncio
import configparser
import sqlite3
from time import sleep
def get_last_rate():
try:
nano = requests.get("https://nanex.co/api/public/ticker/grlcnano", timeout=10)
except requests.Timeout:
return None
else:
last_rate = float(nano.json(... | GarlicoinForum/NanexBot | price_watcher.py | price_watcher.py | py | 4,549 | python | en | code | 3 | github-code | 13 |
25155734092 | def set_permission(cfg, team, repo, permission):
cfg.increase_rate_counter()
team_handle = cfg.org_handle.get_team_by_slug(team)
cfg.increase_rate_counter()
repo_handle = cfg.org_handle.get_repo(repo)
# check if team is already added to repo
tmp_list = []
cfg.increase_rate_counter()
for... | tibeer/ghom | ghom/team_repos.py | team_repos.py | py | 4,183 | python | en | code | 4 | github-code | 13 |
41011347486 | # 원화(₩)에서 달러($)로 변환하는 함수
def krw_to_usd(krw):
count = 0
while count < len(krw):
krw[count] = round(krw[count] / 1000, 1)
count += 1
return krw
# 달러($)에서 엔화(¥)로 변환하는 함수
def usd_to_jpy(usd):
count = 0
while count < len(usd):
usd[count] = round(usd[count] / 8 * 1000, 1)
... | kyumin1227/python-codeit | 3_프로그래밍과-데이터-in-Python/환전 서비스.py | 환전 서비스.py | py | 962 | python | ko | code | 0 | github-code | 13 |
72731801937 | from watson import text_to_trees
from knowledge import Noun, Verb
import unittest
from concurrencytest import ConcurrentTestSuite, fork_for_tests
def text_to_obj(text, constructor):
tree = text_to_trees(text)[0]
return constructor(tree)
def text_to_verb(text, subj_str, obj_str):
noun_subj = text_to_obj(subj_str, N... | AxelUlmestig/chatterbot | test/test_util.py | test_util.py | py | 765 | python | en | code | 0 | github-code | 13 |
35183198780 | #インポート
import streamlit as st
#データ加工
import pandas as pd
import re
#モデル
import lightgbm as lgb
#保存
import pickle
#スクレイピング
import requests
from bs4 import BeautifulSoup
#その他
import os
import datetime
# サイドバー
date = st.sidebar.date_input("日付を選択", datetime.date.today())
formatted_date = date.strftime('%Y%m%d')
url =... | kawamottyan/horse_racing | app/app.py | app.py | py | 15,908 | python | en | code | 0 | github-code | 13 |
2032636850 | # 1. 처음 위치에서 더 싼곳이 나올 때까지 거리를 계속 더한다.
# 2. 더 싼 곳이 나오면 처음 위치의 리터당 가격 * 이동 거리를 계산하고 더 싼 주유소의 가격으로 1번을 반복한다.
# 3. 도착했을 경우 최종 값 출력
n = int(input())
_meter = list(map(int, input().split()))
_price = list(map(int, input().split()))
_min = _price[0]
_sum = 0
_now = 0
for i in range(0, n-1):
_now += _meter[i]
if _pri... | YeonHoLee-dev/Python | BAEKJOON/[13305] 주유소.py | [13305] 주유소.py | py | 621 | python | ko | code | 0 | github-code | 13 |
72338023699 | import torch
from torch.utils.data import Dataset
from torchvision import transforms
from PIL import Image
import numpy as np
import pandas as pd
from torch.utils.data.sampler import SequentialSampler, RandomSampler
# =============================================================================
# def get_dataloader(cs... | lepoeme20/daewoo | utils/build_dataset_imbalanced.py | build_dataset_imbalanced.py | py | 3,577 | python | en | code | 0 | github-code | 13 |
8571488855 | from enum import Enum
from queue import PriorityQueue
import numpy as np
import time
def create_grid(data, drone_altitude, safety_distance):
"""
Returns a grid representation of a 2D configuration space
based on given obstacle data, drone altitude and safety distance
arguments.
"""
# minimum ... | seyfig/3DMotionPlanning | planning_utils.py | planning_utils.py | py | 6,335 | python | en | code | 3 | github-code | 13 |
18019446647 | # Задайте список из вещественных чисел.
# Напишите программу, которая найдёт разницу между
# максимальным и минимальным значением дробной части элементов.
# Пример:
# - [1.1, 1.2, 3.1, 5, 10.01] => 0.19
list = [1.1, 1.2, 3.1, 5, 10.01]
print(list)
def dif(list):
dif_max_min =[]
for i in range(len(list)):
... | Boris-1980/Python_homework | 013.py | 013.py | py | 561 | python | ru | code | 3 | github-code | 13 |
20669887400 | #!/usr/bin/env python3.6
import numpy as np
from Point import Point
from Ride import Ride
from Problem import Problem
from Vehicle import Vehicle
import time
import sys
"""
Main project for hashcode
"""
def read_file(f):
all_data = np.loadtxt(f, dtype=int, delimiter = " ", skiprows = 0)
first_row = all_data... | Recognition2/HashCode2018 | main.py | main.py | py | 2,153 | python | en | code | 0 | github-code | 13 |
27551133556 | #!/usr/bin/python3
"""Module is an introduction to networking with requests in Python."""
import sys
import requests
def url_fetch():
"""Displays id for given GitHub credentials using the GitHub API."""
if len(sys.argv) < 2:
return
url = 'https://api.github.com/users/{}'.format(sys.argv[1])
... | adobki/alx-higher_level_programming | 0x11-python-network_1/10-my_github.py | 10-my_github.py | py | 498 | python | en | code | 0 | github-code | 13 |
25093447143 | import itertools
import operator
from ast import literal_eval
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import ScalarFormatter
SQLITE_FILE = '../benchmarks.db'
GENERAL_PLOTS_PATH = './graphs/memory/general/'
BAR_PLOTS_PATH = './graphs/memory/'
PS_PLOTS_PATH = './graphs/memory/processsys... | alcestes/effpi | scripts/gc_memory_vs_size.py | gc_memory_vs_size.py | py | 7,981 | python | en | code | 47 | github-code | 13 |
70505870099 | import torch
import torch.nn as nn
from spec_unet import get_model as get_spec_unet
from audio_unet import get_model as get_audio_unet
class HybridUnet(nn.Module):
def __init__(self, spec_unet, wav_unet):
super().__init__()
self.spec_unet = spec_unet
self.wav_unet = wav_unet
def for... | bob80333/audio_bandwidth_extension | hybrid_unet.py | hybrid_unet.py | py | 794 | python | en | code | 1 | github-code | 13 |
1652760245 | # 一开始一直错,生成数组长度都一样,终于发现原因了..
# [[]]是一个含有一个空列表元素的列表,所以[[]]*3表示3个指向这个空列表元素的引用,修改任何一个元素都会改变整个列表:
# 应该这样创建多维数组:lists = [[] for i in range(3)]
# 改了果然可以了,c双重循环都能超过88%(36ms)..
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
an... | fire717/Algorithms | LeetCode/python/_118.Pascal'sTriangle.py | _118.Pascal'sTriangle.py | py | 834 | python | zh | code | 6 | github-code | 13 |
73958536016 | import numpy as np
def get_angular_letter(total_l_string):
#translates L into the coresponding symbol.
total_l = int(total_l_string)
angular_dictionary = ['S','P','D','F','G','H']
num = len(angular_dictionary)-1
if total_l > num:
return str(total_l)
else:
return angular_dic... | LeoMul/adf04_to_kurucz | parsing_adf04.py | parsing_adf04.py | py | 4,889 | python | en | code | 0 | github-code | 13 |
32294916083 | import random
max_integer_number = 2*10**5
def random_integer_numbers__iterator(steps, min_number, max_number, number_count=2) -> tuple:
for i in range(steps):
numbers = []
for _ in range(number_count):
numbers.append(get_random_integer_number(min_number=min_number, max_number=max_nu... | boloninanajulia/challanges | tests/code_quality_score/generate_datasets.py | generate_datasets.py | py | 1,744 | python | en | code | 0 | github-code | 13 |
39594766394 | spendings = [140, 30, 999, 145, 538, 878, 901, 613, 471, 286, 147, 90]
income = [300, 40, 0, 4000, 8911, 73, 85, 0, 9000, 941, 658, 190]
def func(list_1, list_2):
coeff_year = 0
new_list = []
for month in range(12):
try:
coeff = list_1[month] / list_2[month]
new_list.append... | Sultan1488/homework_2_5 | code_2_5_3.py | code_2_5_3.py | py | 658 | python | en | code | 0 | github-code | 13 |
42617409293 | from vidar.utils.types import is_seq
def invert_intrinsics(K):
"""Invert camera intrinsics"""
Kinv = K.clone()
Kinv[:, 0, 0] = 1. / K[:, 0, 0]
Kinv[:, 1, 1] = 1. / K[:, 1, 1]
Kinv[:, 0, 2] = -1. * K[:, 0, 2] / K[:, 0, 0]
Kinv[:, 1, 2] = -1. * K[:, 1, 2] / K[:, 1, 1]
return Kinv
def scale... | bingai/vidar | vidar/geometry/camera_utils.py | camera_utils.py | py | 831 | python | en | code | 1 | github-code | 13 |
10000847163 | from notion.client import NotionClient
from notion.block import *
from progress.bar import Bar
# Insert the URL of the page you want to edit (Open Notion is browser)
page_url = "Insert url"
# Obtain the `token_v2` value by inspecting your browser cookies on a logged-in (non-guest) session on Notion.so
tok_v2 = "Insert... | moscars/anki2notion | main.py | main.py | py | 4,963 | python | en | code | 0 | github-code | 13 |
26057758534 | # Imports
from PyQt5.QtCore import QSize, Qt
from PyQt5.QtWidgets import QWidget, QPushButton, QStyle, QHBoxLayout, \
QSlider, QSizePolicy, QSpinBox, QLineEdit, QLabel, QMenu, QInputDialog
from PyQt5.QtMultimedia import QMediaPlayer
from PyQt5.QtGui import QIntValidator
# Constants
ICON_SIZE = QSize(16, 16)
INITIA... | Benjymack/video-tracker | video_tracker/video_display/control_bar.py | control_bar.py | py | 8,964 | python | en | code | 2 | github-code | 13 |
31662645034 | dic= {
"album_name": "The Dark Side of the Moon",
"band": "Pink Floyd",
"year": 1973,
"songs": (
"Speak to Me",
"Breathe",
"On the Run",
"Time",
"The Great Gig in the Sky",
"Money",
"Us and Them",
"Any Colour You Like",
"Brain Damage",
"Eclipse"
)
}
for key, value in dic.items... | kungfumanda/30DaysOfPython | exercises/day10.py | day10.py | py | 427 | python | en | code | 0 | github-code | 13 |
42231792222 | import sys
file_name = "text.txt"
def temperature(file_name):
try:
with open(file_name, 'r') as f:
lines = f.readlines()
except IOError:
print("Error occurred opening the file")
dict_france = {}
dict_sweden = {}
dict_germany = {}
for i, k in enumerate(lines):
... | tszabad/ibs-2020-10-coding-fundamentals-normal-exam | avgtemp/avgtemp.py | avgtemp.py | py | 1,212 | python | en | code | 0 | github-code | 13 |
35691584566 | #!/usr/bin/env python3
from gi.repository import Gtk, WebKit
import os, re
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
class WebWindow(Gtk.Window):
def __init__(self, html="", tpl={}):
Gtk.Window.__init__(self, title='Progress bar')
self.view = WebKit.WebView()
self.add(self.vi... | daneshih1125/pygtk | webkit/gtkprogress.py | gtkprogress.py | py | 1,761 | python | en | code | 0 | github-code | 13 |
31713510244 | __author__ = 'guang'
from bst import TreeNode
class Codec:
def is_leaf(self, node):
return node and node.left is None and node.right is None
def serialize(self, root):
"""Encodes a tree to a single string.
:type root: TreeNode
:rtype: str
>>> codec = Codec()
>... | gsy/leetcode | serialize_and_deserialize_tree.py | serialize_and_deserialize_tree.py | py | 2,954 | python | en | code | 1 | github-code | 13 |
43656671877 | from typing import List
from interface0718.api.base_api import BaseApi
class ContactApi(BaseApi):
def add(self, userid, name, department: List[int], **kwargs):
path = f"/cgi-bin/user/create?access_token={self.token}"
data = {
"userid": userid,
"name": name,
"de... | dg961111/homework | interface0718/api/contact.py | contact.py | py | 1,224 | python | en | code | 0 | github-code | 13 |
15448392963 | from django.shortcuts import render, redirect
from django.urls import reverse
from django.db import connection
from .forms import PollingUnitResultForm
from django.db import connection
from django.utils import timezone
import os
from .utils import get_client_ip
from django.contrib import messages
def polling_unit_resu... | ifekel/Election-Polling | election_results_app/views.py | views.py | py | 3,739 | python | en | code | 0 | github-code | 13 |
27341641648 | import argparse
import torch
import numpy as np
import torch.nn as nn
import tensorflow as tf
from resnet import get_resnet, name_to_params
parser = argparse.ArgumentParser(description='SimCLR converter')
parser.add_argument('tf_path', type=str, help='path of the input tensorflow file (ex: model.ckpt-250228)')
parse... | Separius/SimCLRv2-Pytorch | convert.py | convert.py | py | 4,943 | python | en | code | 96 | github-code | 13 |
2251925569 | from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from channels.layers import get_channel_layer
from asgiref.sync import async_to_sync
import logging
from django.conf import settings
import sys
import boto3
import json
from client.consumers import WsConsumer, emit_message_... | gonzalo123/django_reactive_users | client/client/management/commands/listener.py | listener.py | py | 3,167 | python | en | code | 1 | github-code | 13 |
4827778194 | from django.http import HttpResponse
from django.contrib.auth.models import User, Group
from .models import Student, Faculty
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import redirect, render
from .forms import StudentForm, FacultyForm, UserRegistration
from django.contrib.auth.fo... | nayeemsweb/CSE499-Spring21-Project | Code/Backend/classroom/accounts/views.py | views.py | py | 5,100 | python | en | code | 0 | github-code | 13 |
7033712506 | from django.shortcuts import render
from AppAirsoft.models import *
from AppAirsoft.forms import *
# Creamos nuestras views
def vista_inicio(request):
return render(request, "Airsoft\index.html")
def vista_registro(request):
if request.method == "POST":
formulario = UsuarioForm(request.POST)
... | AngeloPettinari/Prueba | AppAirsoft/views.py | views.py | py | 1,820 | python | es | code | 0 | github-code | 13 |
7397890083 | class Node:
def __init__(self, val, next):
self.val = val
self.next = next
class Queue:
def __init__(self):
self.head=None
self.tail=None
def enqueue(self,v):
if self.head==None:
self.head=Node(v,None)
self.tail=self.head
else:
... | NandhniV25/Data-Structures | 03_Queue/03_queue_optimize.py | 03_queue_optimize.py | py | 883 | python | en | code | 0 | github-code | 13 |
13143905125 | """
Scrapes data from a CSV file of marriage certificates mined from the Royal BC Museum's
genealogy database.
"""
import csv
from datetime import datetime
from db.db_models import MarriageCert, Person
from scraping.utils import extract_name_fields
from utils.bcmuseum_miner import FIELDS
def scrape_marriagecerts_csv... | ajdeziel/your-name-here | scraping/marriagecerts.py | marriagecerts.py | py | 1,414 | python | en | code | 0 | github-code | 13 |
26963933265 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 16 13:14:01 2022
@author: elect
"""
i=int(input('enter the limit:'))
sum=0
k=1
while k<=i:
sum+=k
k+=1
print('sum is =',sum)
| Syamkrishna123/MyPythonProgramming_practice | while.py | while.py | py | 186 | python | en | code | 1 | github-code | 13 |
9533082967 | # -*- coding: utf-8 -*-
import json
import scrapy
from lianjia.items import LianjiaItem
from scrapy import Request
from scrapy_redis.spiders import RedisSpider
class LianjiacrawlSpider(RedisSpider):
name = 'lianjiacrawl'
allowed_domains = ['cd.lianjia.com']
# 新盘
# start_urls = 'https://cd.fang.lian... | simonzhao88/practice | scrapy_pro/lianjia/lianjia/spiders/lianjiacrawl.py | lianjiacrawl.py | py | 4,432 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.