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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
23012946135 | import pandas as pd
import numpy as np
import geopandas as gpd
from helper_functions import add_subset_address_cols, interpolate_polygon
from data_constants import default_crs, make_data_dict
from name_parsing import combine_names
from address_parsing import clean_parse_address
from helper_functions import make_panel
f... | jfish-fishj/boring_cities | python_modules/clean_address_data.py | clean_address_data.py | py | 15,391 | python | en | code | 0 | github-code | 6 |
70714254267 | from sre_constants import MAX_REPEAT
from .constants import MAX_STACK_DEPTH, MAX_UINT256
class Stack:
def __init__(self, max_depth=MAX_STACK_DEPTH) -> None:
self.stack = []
self.max_depth = max_depth
def push(self, item: int) -> None:
if item < 0 or item > MAX_UINT256:
rai... | karmacoma-eth/smol-evm | src/smol_evm/stack.py | stack.py | py | 1,394 | python | en | code | 165 | github-code | 6 |
42319245603 | from setuptools import setup, find_packages
import codecs
import os
import re
here = os.path.abspath(os.path.dirname(__file__))
import prefetch_generator
# loading README
long_description = prefetch_generator.__doc__
version_string = '1.0.2'
setup(
name="prefetch_generator",
version=version_string,
desc... | justheuristic/prefetch_generator | setup.py | setup.py | py | 1,969 | python | en | code | 260 | github-code | 6 |
72441337147 | # Tip Calculator
# print welcome to the tip calculator
#what was the total bill ?
#what percentage tip would you like to a give ? 10,12,15
#how many people to split the bill ?
#each pearson should pay
print("##Welcome to the tip calculator##")
bill = float(input("what is total bill amount:"))
tip = int(inpu... | pravinpawar17/Python_100_days | day2.2.py | day2.2.py | py | 586 | python | en | code | 0 | github-code | 6 |
32638070044 | def voto(ano):
from datetime import datetime
atual = datetime.now().year
idade = atual - ano
if 16 <= idade <= 17 or idade > 60:
return idade, 'VOTO OPCIONAL!'
elif 18 <= idade < 60:
return idade, 'VOTO OBRIGATÓRIO!'
else:
return idade, 'NÃO VOTA!'
nas = int(input('Em q... | LeoWshington/Exercicios_CursoEmVideo_Python | ex101.py | ex101.py | py | 396 | python | pt | code | 0 | github-code | 6 |
73643617788 | from __future__ import absolute_import
import math
from collections import OrderedDict
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
import torch.utils.model_zoo as model_zoo
from .res2net import res2net50_26w_4s
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 're... | DeepAlchemist/video-person-reID | lib/model/resnet.py | resnet.py | py | 11,011 | python | en | code | 1 | github-code | 6 |
31528905029 | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# $Id: setup.py 30 2005-10-30 07:24:38Z oli $
import os, sys
from setuptools import setup, find_packages
sys.path.insert(0, 'package/lib')
from scapy import VERSION
PACKAGE_NAME = 'scapy'
DESCRIPTION="""Packet manipulation tool, packet generator, network scanner, ... | BackupTheBerlios/gruik-svn | trunk/projects/packaging_scapy/setup.py | setup.py | py | 3,232 | python | en | code | 0 | github-code | 6 |
11165153113 | from uuid import uuid4
from demo.data_loading.data_fetching import get_countries_data
from demo.data_loading.fixes import fix_alpha2_value, fix_alpha3_value, fix_string_value
from demo.server.config import get_pyorient_client
def load_countries_and_regions(countries_df):
graph = get_pyorient_client()
countr... | obi1kenobi/graphql-compiler-cross-db-example | demo/data_loading/orientdb_loading.py | orientdb_loading.py | py | 4,019 | python | en | code | 3 | github-code | 6 |
31498010379 | import os
import string
import Model.Gobject
import Model.Global
import Model.Exceptions
import gettext
t = Model.Global.getTrans()
if t != None:
_= t.gettext
else:
def _(x):
return x
def createTable(dataBase):
db= Database.DbAccess.DbAccess(dataBase)
db.createTable(VatList._tableName, Vat._v... | BackupTheBerlios/gryn-svn | trunk/Model/Vat.py | Vat.py | py | 5,052 | python | en | code | 0 | github-code | 6 |
5821379456 | # Дана последовательность чисел. Определить наибольшую длину монотонно возрастающего фрагмента
# последовательности (то есть такого фрагмента, где все элементы больше предыдущего).
n = int(input('Введите количество чисел '))
m = float(input('Введите первое число '))
prev = m
lenght = 1
max_lenght = 0
for k in range(... | GarryG6/PyProject | 32.py | 32.py | py | 1,354 | python | ru | code | 0 | github-code | 6 |
27264187100 | """
GenT2_Rulebase.py
Created 9/1/2022
"""
from juzzyPython.generalType2zSlices.system.GenT2Engine_Intersection import GenT2Engine_Intersection
from juzzyPython.generalType2zSlices.system.GenT2Engine_Union import GenT2Engine_Union
from juzzyPython.generalType2zSlices.system.GenT2_Rule import GenT2_Rule
from juzzyPython... | LUCIDresearch/JuzzyPython | juzzyPython/generalType2zSlices/system/GenT2_Rulebase.py | GenT2_Rulebase.py | py | 7,915 | python | en | code | 4 | github-code | 6 |
32661723209 | from decimal import Decimal
from fractions import Fraction
from typing import Generator
from numeric_methods.language import TRANSLATE
from numeric_methods.language.docs.one_variable import SECANT_METHOD_DOCS
from numeric_methods.mathematics import compare, convert, widest_type
NUMBER = Decimal | float | Fraction
... | helltraitor/numeric-methods | numeric_methods/one_variable/secant_method.py | secant_method.py | py | 1,013 | python | en | code | 0 | github-code | 6 |
15622117384 | from aws_cdk import (
aws_ec2 as ec2,
aws_ecs as ecs,
cdk,
)
class GhostOnEcsStack(cdk.Stack):
def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, *kwargs)
# Create VPC and Fargate Cluster
# NOTE: Limit AZs to avoid reaching resour... | samkeen/aws-cdk-python-ecs-fargate | ghost_on_ecs/ghost_on_ecs_stack.py | ghost_on_ecs_stack.py | py | 866 | python | en | code | 6 | github-code | 6 |
29963241712 | import os
from BadParser import BadParser
proxies = []
class ProxyWorker(object):
def handler(path):
if os.path.isfile(path=path) != True:
return False
if os.path.splitext(path)[1] != '.txt':
return False
f = open(path, 'r', encoding='utf-8')
line = f.readl... | icYFTL/ShadowServants-Brute-Python | sources/ProxyWorker.py | ProxyWorker.py | py | 1,267 | python | en | code | 0 | github-code | 6 |
5508352220 | import random, os, shutil, yaml, gzip
import pandas as pd
import numpy as np
import prepare.configs as configs
from google.cloud import storage
import pickle
import time
storage_client = storage.Client()
bucket = storage_client.bucket(configs.bucketName)
def encodeConfigs(_confs):
return [
_confs['sim ti... | R-Stefano/betse-ml | prepare/utils.py | utils.py | py | 7,976 | python | en | code | 0 | github-code | 6 |
73730161788 | import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import MNIST
from dae.dae import DAE
from beta_vae.beta_vae import BetaVAE
from history import History
# hyperparameters
num_epochs = 100
batch_size = 128
lr = 1e-4
beta = 4
sa... | BCHoagland/DARLA | train.py | train.py | py | 1,115 | python | en | code | 8 | github-code | 6 |
30354806111 | import sys
# Enthought library imports
from pyface.qt import QtCore, QtGui
# Local imports
from tvtk.util.gradient_editor import (
ColorControlPoint, ChannelBase, FunctionControl, GradientEditorWidget
)
##########################################################################
# `QGradientControl` class.
######... | enthought/mayavi | tvtk/util/qt_gradient_editor.py | qt_gradient_editor.py | py | 19,600 | python | en | code | 1,177 | github-code | 6 |
10609649346 | from createProtocol import ARP, EthernetII
from parseProtocol import Parser
from optparse import OptionParser
from helper import subnet_creator, get_mac_address, get_ip_address
from rich.progress import track
from time import sleep
import socket
import netifaces
import threading
def get_user_parameters():
parse_o... | oguzhan-kurt/Network-Scanner | main.py | main.py | py | 2,295 | python | en | code | 0 | github-code | 6 |
17212386207 | def report(dtgen, predicts, metrics, total_time, plus=""):
"""Calculate and organize metrics and predicts informations"""
e_corpus = "\n".join([
f"Total test sentences: {dtgen.size['test']}",
f"{plus}",
f"Total time: {total_time}",
f"Time per item: {total_time /... | u1956242/GEC | src/lib/utils/report.py | report.py | py | 1,002 | python | en | code | 0 | github-code | 6 |
47036004516 | import time
from sqlalchemy import Column, Integer, String, Float, Boolean, ForeignKey
import sqlalchemy.types as types
from sqlalchemy.orm import relationship
from sqlalchemy.sql.expression import func
from sqlalchemy import or_, and_, desc
from marshmallow import Schema, fields
from database import Base
class KycR... | djpnewton/zap-merchant | models.py | models.py | py | 1,387 | python | en | code | 0 | github-code | 6 |
19809314779 | import os
from PIL import Image
from typing import Dict, List
from preprocessing.image_metadata import ImageMetadata
class ImagesReader:
def __init__(self, base_path: str) -> None:
self.__basePath = base_path
def read_train_images(self) -> Dict[str, List[ImageMetadata]]:
images = {}
d... | sachokFoX/caltech_256 | code/preprocessing/images_reader.py | images_reader.py | py | 1,666 | python | en | code | 0 | github-code | 6 |
71913785148 | import qrcode as qr
from PIL import Image
q=qr.QRCode(version=1,
error_correction=qr.constants.ERROR_CORRECT_H,
box_size=10,
border=4,)
q.add_data("https://youtu.be/NaQ_4ZvCbOE")
q.make(fit=True)
img= q.make_image(fill_color='darkblue', back_color='steelblue')
img.save("x.png") | Xander1540/Python-Projects | QRcode/QRcode.py | QRcode.py | py | 316 | python | en | code | 0 | github-code | 6 |
3037458100 | import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
# 변수 초기화
n, m = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(n)]
dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1]
answer = 0
def dfs(x, y):
for i in range(4):
nx, ny = x+dx[i], y+dy[i]
if 0<=nx<n and 0<=ny<m... | sunyeongchoi/sydsyd_challenge | argorithm/2638_re.py | 2638_re.py | py | 998 | python | en | code | 1 | github-code | 6 |
11016530679 | import os
import discord
import requests
import asyncio
from dotenv import load_dotenv
from discord.utils import get
from discord.ext import commands
compteur = 301
nbConnected = 0
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
SERVER_IP = os.getenv('SERVER_IP')
SERVER_PORT = os.getenv('SERVER_PORT')
CHANNEL_ID = i... | AudricCh/minecraft-discord-bot | bot/main.py | main.py | py | 1,395 | python | en | code | 0 | github-code | 6 |
6166872296 | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 15 09:32:16 2017
@author: Francesco
"""
from sklearn.preprocessing import StandardScaler
import numpy as np
import threading as th
import time
import re
import matplotlib.pyplot as plt
movement_kind = ["wrist up",
"wrist down",
... | FrancesoM/UnlimitedHand-Learning | python_side/utilities.py | utilities.py | py | 16,063 | python | en | code | 1 | github-code | 6 |
18659651890 | import models
import typing
import sqlite3
import os
import sys
class Storage:
def __init__(self):
self._conn = sqlite3.connect('v_store.db')
self._cursor = self._conn.cursor()
self._queries: dict[str, str] = self.read_queries()
def __del__(self):
self._cursor.close()
s... | Ayon-Bhowmick/Vec4Rec | src/storage.py | storage.py | py | 2,150 | python | en | code | 0 | github-code | 6 |
26964335493 | from setuptools import setup
from hostinfo.version import __version__ as VERSION
from build_utils import BuildCommand
from build_utils import PublishCommand
from build_utils import BinaryDistribution
PACKAGE_NAME = 'pimjpeg'
BuildCommand.pkg = PACKAGE_NAME
# BuildCommand.py2 = False
# BuildCommand.py3 = False
Publish... | walchko/mjpeg | setup.py | setup.py | py | 1,527 | python | en | code | 0 | github-code | 6 |
71179089147 | class Solution:
def isPalindrome(self, x: int) -> bool:
l=str(x)
f=""
for i in range(len(l)-1,0,-1):
f=f+l[i]
f=f+l[0]
if(f==l):
return True
else:
return False
| Yoheniy/competitive | leetcode_solution/palindrome-number.py | palindrome-number.py | py | 263 | python | en | code | 0 | github-code | 6 |
36766609482 | # date: 2021/09/06
# link: https://programmers.co.kr/learn/courses/30/lessons/17680
from collections import deque
def solution(cacheSize, cities):
answer = 0
status = deque()
if cacheSize == 0:
answer = len(cities) * 5
else:
for city in cities:
city = city.upp... | jiyoung-dev/Algorithm | Kakao 기출문제/캐시.py | 캐시.py | py | 608 | python | en | code | 0 | github-code | 6 |
39262703446 | from eums import settings_export
from eums.models import Alert
from eums.services.exporter.abstract_csv_exporter import AbstractCSVExporter
class AlertCSVExporter(AbstractCSVExporter):
def __init__(self, host_name, alert_type):
self.export_category = 'alert'
self.export_label = 'Alerts'
se... | unicefuganda/eums | eums/services/exporter/alert_csv_exporter.py | alert_csv_exporter.py | py | 2,737 | python | en | code | 9 | github-code | 6 |
35395847394 | from django.core.paginator import InvalidPage
class AlphabetGlossary(object):
"""Алфавитный глоссарий"""
def __init__(self, object_list, on=None, num_groups=7):
self.object_list = object_list # список объектов
self.count = len(object_list) # количество объектов в списке
self.max_fro... | zarmoose/eastwood_test | employees/glossary.py | glossary.py | py | 5,105 | python | ru | code | 0 | github-code | 6 |
3578166823 | import os
import torch
import csv
import pandas as pd
from config import FoldersConfig
def txt_to_csv(input_path, output_path):
with open(input_path, 'r') as in_file:
stripped = (line.strip() for line in in_file)
lines = (line.split() for line in stripped if line)
with open(output_path, '... | ferran-candela/upc-aidl-2021-image-retrieval | imageretrieval/src/prepare_datasets.py | prepare_datasets.py | py | 2,898 | python | en | code | 3 | github-code | 6 |
13895478896 | ########################################################################################
# Run examples from our paper in RBEF
########################################################################################
import sys
import numpy as np
import matplotlib.pyplot as plt
import multiprocessin... | ViniciusLima94/pyGC | runRBEF.py | runRBEF.py | py | 7,302 | python | en | code | 30 | github-code | 6 |
74795986426 | import openpyxl
import tkinter as tk
def add_data_to_excel(roll_number, name):
# Open the Excel file or create a new one if it doesn't exist
try:
workbook = openpyxl.load_workbook('data.xlsx')
except FileNotFoundError:
workbook = openpyxl.Workbook()
# Select the active sheet ... | Chandravarma2004/Push-the-data-given-to-excel- | project3.py | project3.py | py | 1,441 | python | en | code | 0 | github-code | 6 |
44831632974 | #!/usr/bin/env python3
import json
import re
DEFAULT_PRICE = 9999
DEFAULT_SQFT = 0
def parse(apartment_data, apartment_filters = []):
apartment_list = []
for apartment in apartment_data:
add_apartment = False
for apartment_filter in apartment_filters:
add_apartment = apt_filter(... | juanmaberrocal/apartment-scraper | app/modules/parsedata.py | parsedata.py | py | 1,116 | python | en | code | 0 | github-code | 6 |
14539682858 | class Solution:
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
if x >= 0:
remider = int(str(x)[::-1])
else:
remider = int(str(abs(x))[::-1]) * -1
if remider >= -pow(2, 31) and remider <= pow(2, 31) - 1:
return re... | Rainphix/LeetCode | 007_reverse_integer.py | 007_reverse_integer.py | py | 581 | python | en | code | 0 | github-code | 6 |
31651402247 | """
Ian Dansereau
GroupMeReddit
runBot.py
5/5/16
"""
import sys
from groupmebot.RedditBot import RedditBot as rb
"""
Main method
"""
def main():
if not sys.version_info >= (3, 5):
print("Python 3.5+ is required. This version is %s" % sys.version.split()[0])
try:
bot = r... | imd8594/GroupMeReddit | runBot.py | runBot.py | py | 436 | python | en | code | 3 | github-code | 6 |
1523636284 | '''
Given a password as a character array A.
Check if it is valid or not.
Password should have at least one numerical digit(0-9).
Password's length should be in between 8 to 15 characters.
Password should have at least one lowercase letter(a-z).
Password should have at least one uppercase letter(A-Z).
Password should h... | kartikwar/programming_practice | strings/valid_password.py | valid_password.py | py | 1,209 | python | en | code | 0 | github-code | 6 |
8499225984 | from booleano.exc import InvalidOperationError
from booleano.operations.operands import Operand
__all__ = ["String", "Number", "Arithmetic", "Set"]
class Constant(Operand):
"""
Base class for constant operands.
The only operation that is common to all the constants is equality (see
:meth:`equals`).
Constants ... | MikeDombo/Stock_Backtester | booleano/operations/operands/constants.py | constants.py | py | 15,020 | python | en | code | 3 | github-code | 6 |
26683410836 | #!/usr/bin/python3
'''Defines a Base class
'''
import json
from os import path
class Base:
'''Represents a base class
Attributes:
__nb_objects: holds the number of Base instances created
'''
__nb_objects = 0
def __init__(self, id=None):
'''Instantiates a Base object
Args... | nzubeifechukwu/alx-higher_level_programming | 0x0C-python-almost_a_circle/models/base.py | base.py | py | 2,989 | python | en | code | 0 | github-code | 6 |
9324609377 | from flask import Blueprint, render_template
redspine = Blueprint('redspine',
__name__,
template_folder='./',
static_folder='./',
static_url_path='/')
redspine.display_name = "Redspine"
redspine.published = False
redspine.description =... | connerxyz/exhibits | cxyz/exhibits/redspine/redspine.py | redspine.py | py | 491 | python | en | code | 0 | github-code | 6 |
6387062201 | from jupyterthemes import install_theme, get_themes
from jupyterthemes import stylefx
def install_themes():
themes = get_themes()
for t in themes:
try:
install_theme(theme=t, monofont=mf, nbfont=nf, tcfont=tc)
except Exception:
return False
return True
def install_f... | dunovank/jupyter-themes | tests/test_themes.py | test_themes.py | py | 939 | python | en | code | 9,665 | github-code | 6 |
35175789251 | from django.shortcuts import render
from .models import Book, Shope
def home(request):
# qs = Post.objects.all()
# # The DB query has not been executed at this point
# x = qs
# # Just assigning variables doesn't do anything
# for x in qs:
# print(x)
# # The query is executed at this po... | Azhar-inexture-1/django_practice_models | query_optimization/views.py | views.py | py | 2,036 | python | en | code | 0 | github-code | 6 |
10134904630 | import mysql.connector as ms
db=ms.connect(host="localhost",user="root",passwd="1234",database='school')
cn=db.cursor()
cn.execute("create table students ( rno int(3) not null unique, name char(30), marks int(3), grade char(1) )")
db.commit()
def insert_rec():
while True:
rn=int(input("Enter roll num... | shreykuntal/Cbse-12-project | practical+project/pysql/1/pr.py | pr.py | py | 1,542 | python | en | code | 0 | github-code | 6 |
9270626576 | from dataclasses import dataclass
@dataclass
class block:
name: str
seperatorStart: str
seperatorEnd: str
def getBlock(blocks: list, input: list):
strings = list()
index = 0
offsetindex = 0
foundBlock = False
dontAppend = False
for string in input:
dontAppend = False
... | superboo07/TextAdventure | TAUtilities.py | TAUtilities.py | py | 2,998 | python | en | code | 0 | github-code | 6 |
21325119133 | #!/usr/bin/python3
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
#import matplotlib.pyplot as plt
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()
# Define a simple sequential model
def create_model(... | NJUleo/Software-Testing-Lab-ML | buildModel.py | buildModel.py | py | 780 | python | en | code | 0 | github-code | 6 |
72331238589 | import gc
import numpy as np
import xarray as xr
import scipy.ndimage.filters as conv
from . import dc_utilities as utilities
from datetime import datetime
####################################################
# | TSM |
####################################################
# 0.0001 for the scale of ls7 data.
def _tsmi(... | ceos-seo/Data_Cube_v2 | ui/django_site_v2/data_cube_ui/utils/dc_tsm.py | dc_tsm.py | py | 1,835 | python | en | code | 26 | github-code | 6 |
38907427149 | import tkinter as tk
try:
import pygame
except ImportError:
audio = None
else:
audio = True
import sys
import random
import time
### Stopped Let's code: Tetris episode 19 by TigerhawkT3 at 00:58:42
### Use score_lines or high_score_lines to increase level and speed etc.
class Shape:
def __init__(self... | Jack-Evitts/Pythtris | Tetris.py | Tetris.py | py | 22,949 | python | en | code | 0 | github-code | 6 |
44426650716 | import glob
import re
from test_framework.util import (
assert_equal,
p2p_port,
wait_until,
count_log_msg
)
from test_framework.mininode import (
NetworkThread,
NodeConn,
NodeConnCB,
msg_block,
ToHex
)
from test_framework.test_framework import BitcoinTestFramework, ChainManager
fr... | bitcoin-sv/bitcoin-sv | test/functional/bsv-frozentxo-reindex.py | bsv-frozentxo-reindex.py | py | 8,778 | python | en | code | 597 | github-code | 6 |
86366418129 | import numpy as np
import matplotlib.pyplot as plt
def radial_kernel(x0, X, tau):
return np.exp(np.sum((X - x0) ** 2, axis=1) / (-2 * tau * tau))
def local_regression(x0, X, Y, tau):
# add bias term
x0 = np.r_[1, x0]
X = np.c_[np.ones(len(X)), X]
# fit model: normal equations with kernel
xw ... | MitaAcharya/MachineLeaning | AndrewNG/Week2/Week2_LWR_Extra/LocalWeightedLinearRegression.py | LocalWeightedLinearRegression.py | py | 2,053 | python | en | code | 0 | github-code | 6 |
42154628409 | from Filters.BubbleFilter import BubbleFilter
from Entities.BubbleCandidate import BubbleCandidate
class ShapeFilter(BubbleFilter):
def __init__(self, source_width, source_height, logger, min_ratio_component_area=None, min_pa_ratio=None,
max_pa_ratio=None, w_min=None, w_max=None, h_min=None, h_ma... | lukasvlc3k/comics-text-recognition | Filters/ShapeFilter.py | ShapeFilter.py | py | 3,134 | python | en | code | 0 | github-code | 6 |
17515420038 | from log_parser import LogParser
from producer import KafkaProducer
if __name__ == "__main__":
logFile = LogParser.read_log_file()
logFileGen = LogParser.fetch_log(logFile)
producer = KafkaProducer()
while True:
try:
data = next(logFileGen)
serialized_data = LogParser.se... | BountyHunter1999/Dashboard-App | main.py | main.py | py | 636 | python | en | code | 0 | github-code | 6 |
41913795360 | import logging
from functools import partial
from datasets import load_dataset
from transformers import (
Seq2SeqTrainer,
Seq2SeqTrainingArguments,
WhisperForConditionalGeneration,
WhisperProcessor,
)
from src.callbacks import ShuffleCallback
from src.config import Config, TrainingArgumentsConfig
from... | Giorgi-Sekhniashvili/geo_whisper | train.py | train.py | py | 1,605 | python | en | code | 0 | github-code | 6 |
11941164377 | #!/usr/bin/env python
#
# fast_mr ->
#
# Fast molecular replacement in the spirit of fast_dp, starting from coordinate
# files and using brute force (and educated guesses) to get everything going.
#
# fast_mr - main program.
import os
import sys
import time
import shutil
import math
import traceback
from multiprocessi... | DiamondLightSource/fast_ep | src/fast_mr.py | fast_mr.py | py | 6,927 | python | en | code | 2 | github-code | 6 |
7089066120 |
# import modules
import timeit
import numpy as np
import matplotlib.pyplot as plt
import time
# Question 1 ------
# selection sort
def selectionsort(arr):
for i in range(len(arr)): # outer loop to traverse array
minInd = i # minimum index starts at i
for j in range(i+1,len(arr)): # i... | auyen/CMPS-101 | hw2/hw2.py | hw2.py | py | 9,531 | python | en | code | 0 | github-code | 6 |
8454526301 | # Path to scripts folder
path = "C:/Users/j_ber/root/blender_scripts/blender_modules/panels/"
# Names of python files to import
filenames = ["vertex_tools.py"]
for file in filenames:
exec(compile(open(path + file).read(), path + file, 'exec'))
| jbernrd2/blender-scripts | blender_modules/script_loader.py | script_loader.py | py | 268 | python | en | code | 1 | github-code | 6 |
36484764773 | import cv2
import glob
from matplotlib import pyplot as plt
faceDet = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
faceDet_two = cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml")
faceDet_three = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
faceDet_four = cv2.CascadeClassifier("... | dishavarshney9/uhack | classi.py | classi.py | py | 1,880 | python | en | code | 0 | github-code | 6 |
4818248752 | import random
suits = ('Heart', 'Clubs', 'Diamond', 'Spades')
ranks = ('two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'Jack', 'Queen', 'King', 'Ace')
values = {'two': 2, 'three':3, 'four': 4, 'five': 5, 'six':6, 'seven': 7, 'eight': 8, 'nine': 9, 'ten': 10, 'Jack': 11, 'Queen': 12, 'King':... | slama0077/Games | War.py | War.py | py | 4,172 | python | en | code | 0 | github-code | 6 |
42656181560 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os.path
import argparse
import logging
from tarfile import TarFile
from thirdparty.dagflow import ParallelTask, Task, DAG, do_dag
from ontbc.common import mkdir, touch, read_tsv
from ontbc.parser import add_barcode_parser
from ontbc.config import PORECHO... | FlyPythons/ontbc | ontbc/barcode.py | barcode.py | py | 5,174 | python | en | code | 5 | github-code | 6 |
18218820071 | import argparse
import optparse
from .parser import *
def get_args():
parser = optparse.OptionParser()
parser.add_option('-i', '--html;',
action="store", dest="html",
help="html to parse")
parser.add_option('-o', '--output',
action="store", dest="output",
help="place to out... | Andrew-Pynch/dappi | dappi/__main__.py | __main__.py | py | 769 | python | en | code | 1 | github-code | 6 |
15018029353 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 5 16:56:55 2022
@author: josephbriggs
"""
import pathlib
import argparse
import cv2
def main():
'''
Converts files to greyscale.
'''
parser = argparse.ArgumentParser(description='Convert files to greyscale.')
parser.add_argu... | jhb123/enhance_greyscale | imgs_to_gs.py | imgs_to_gs.py | py | 1,430 | python | en | code | 0 | github-code | 6 |
40471740091 | import os
import cv2
import numpy as np
import shutil
import sys
sys.path.insert(0,os.path.realpath('..'))
sys.path.insert(0,os.path.join(os.path.realpath('..'),'piano_utils'))
from tools.warper import order_points
from config import cfg
from piano_utils.networks import PSPNet
from piano_utils.util import colori... | yxlijun/vision-piano-amt | figures/plt_keyboard.py | plt_keyboard.py | py | 7,430 | python | en | code | 2 | github-code | 6 |
13085423175 | import json
# this will create a tweet, with possiblities of adding medias and replying to other tweets
def create_tweet(tas, message, media_ids = None, reply_ids = None):
payload = {"status": message}
if media_ids != None:
payload["media_ids"] = media_ids
if reply_ids != None:
payload["in_reply_to_status_i... | filming/Twitter | src/Twitter/tweet/tweet.py | tweet.py | py | 723 | python | en | code | 0 | github-code | 6 |
21368565276 | import numpy as np
import time
import matplotlib.pyplot as plt
a=np.loadtxt('meas2/magnitude_0to40.0mA_freq_sweep.csv', delimiter=',')
c=np.loadtxt('meas2/phase_0to40.0mA_freq_sweep.csv', delimiter=',')
b=np.loadtxt('meas2/sweep_feq.csv', delimiter=',')
cstart=0 #start current
cstop=40E-3 # stop current
cs... | physikier/magnetometer | src/plot.py | plot.py | py | 775 | python | en | code | 0 | github-code | 6 |
12598627326 | from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class DataQualityOperator(BaseOperator):
"""
Runs data quality check by passing test SQL
Parameters
redshift_conn_id: Redshift Connection ID
test_s... | ljia-ch/airflow_data_pipeline_project | plugins/operators/data_quality.py | data_quality.py | py | 1,362 | python | en | code | 0 | github-code | 6 |
26581884850 | CODE_OK = 200
CODE_CREATED = 201
CODE_NO_CONTENT = 204
CODE_BAD_REQUEST = 400
CODE_FORBIDDEN = 403
CODE_NOT_FOUND = 404
CODE_METHOD_NOT_ALLOWED = 405
CODE_NOT_ACCEPTABLE = 406
CODE_CONFLICT = 409
response_ok = {
"status": "OK",
"code": CODE_OK,
"error": "",
"data": "",
}
response_fail = {
"status"... | lafenicecc/cello | src/common/error.py | error.py | py | 1,054 | python | en | code | 0 | github-code | 6 |
72988129467 | import numpy as np
def upper_confidence_bound(data):
N = data.shape[0] # number of samples (Example: How many times add was shown, How many times machine was played)
d = data.shape[1] # number of dfferent objects (Examples: Different ads, Bandit machines)
#Ni(n) - the number of times the object 'i' was selected ... | lucko515/ads-strategy-reinforcement-learning | Upper confidence bound/upper_confidence_bound.py | upper_confidence_bound.py | py | 1,321 | python | en | code | 7 | github-code | 6 |
12190600050 | #
# db.py
#
import os
import sqlite3
import time
import datetime
from flask import g
import db_init
def test_db_conn():
dbname = os.environ.get("SEVENS_DB_NAME")
try:
os.remove(dbname)
except OSError:
pass
""" Check if db connection can open, create and init db if doesn't already exist... | tolkamps1/sevens7 | db.py | db.py | py | 3,441 | python | en | code | 0 | github-code | 6 |
30677208057 | #Write a Python program to add 'ing' at the end of a given string (length should be at least 3).
# If the given string already ends with 'ing' then add 'ly' instead if the string length of the given string
# is less than 3, leave it unchanged
def add_string(str1):
length = len(str1)
if length > 2:
... | allen-waker/ASSIGMENT-2 | module - 2/unchangd_string.py | unchangd_string.py | py | 1,082 | python | en | code | 0 | github-code | 6 |
7997489923 | """
Before executing this script make sure that all packages are installed properly
and also select 3 ips from resource pool wiki which are not in use.(check using ping command)
purpose:
-------
This script is for first time setup of dcs vm which includes
accepting eula,changing password,configure the ip and changing ... | Srija-Papinwar/CD | scripts/dcs_fts.py | dcs_fts.py | py | 20,662 | python | en | code | 0 | github-code | 6 |
5759912904 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 20 09:17:19 2019
@author: if715029
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.spatial.distance as sc
import pandas as pd
#%%
data = pd.read_excel('../data/Datos_2015.xlsx',sheet_name='Atemajac')
#%%
data = data.iloc[:,2:7].dropna()
#%%
D1 = sc... | OscarFlores-IFi/CDINP19 | code/p6.py | p6.py | py | 616 | python | en | code | 0 | github-code | 6 |
27055803559 | """empty message
Revision ID: 810e0afb57ea
Revises: 22771e69d10c
Create Date: 2022-01-19 19:59:08.027108
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "810e0afb57ea"
down_revision = "22771e69d10c"
branch_labels = None
depends_on = None
def upgrade():
# #... | CodeForPoznan/codeforpoznan.pl_v3 | backend/migrations/versions/810e0afb57ea_.py | 810e0afb57ea_.py | py | 1,891 | python | en | code | 8 | github-code | 6 |
17345627172 |
import os
import glob
import torch
from torchvision import transforms as T
from torch.utils.data import DataLoader,Dataset
from torch.utils.data.distributed import DistributedSampler
from codes.utils import img_processing
from codes.data import data_utils
import math
import numpy as np
class Load_Data(D... | csxuwu/LRCR_Net | codes/data/data_loader4.py | data_loader4.py | py | 5,103 | python | en | code | 0 | github-code | 6 |
1383718733 | from .base import metadata
from sqlalchemy import Table, Column, BigInteger,\
String, Boolean, DateTime
t_users = Table(
"users",
metadata,
Column('u_id', BigInteger), # telegram id
Column('name', String), # фамилия c инициалами
Column('name_tg', String), # имя по... | oleg-medovikov/eventlog | base/users.py | users.py | py | 618 | python | ru | code | 0 | github-code | 6 |
72680091707 | # Given an array, finds the element that would be at position k of the sorted array
# basically the partition algorithm used in quicksort
# O(n) time
def quick_select(index, array):
p_index, p_val = partition(choose_pivot(array), array)
if p_index == index:
return p_val
if p_index > index:
... | exue026/algos-and-structs | quick-select.py | quick-select.py | py | 1,061 | python | en | code | 0 | github-code | 6 |
18537345589 | # Prob_link: https://www.codingninjas.com/studio/problems/fractional-knapsack_8230767?challengeSlug=striver-sde-challenge&leftPanelTab=0
from os import *
from sys import *
from collections import *
from math import *
def maximumValue(items, n, w):
items.sort(key=lambda x: x[1] / x[0], reverse=True)
... | Red-Pillow/Strivers-SDE-Sheet-Challenge | P46_Fractional_Knapsack.py | P46_Fractional_Knapsack.py | py | 565 | python | en | code | 0 | github-code | 6 |
22951595310 | #!/usr/bin/env python2.7
"""
A tool to update the Product Version and Code of a C# VS2010 setup package (*.vdproj). Intended
to be used with an automated build process.
"""
import re
import uuid
import argparse
import os, shutil
import tempfile
##"ProductCode" = "8:{35424778-8534-431B-9492-5CD84B1EDE03}"
... | wfriedl/pvc_changer | pvc_changer.py | pvc_changer.py | py | 2,183 | python | en | code | 0 | github-code | 6 |
3345758956 |
from tkinter import *
from tkinter import messagebox
import tkinter as tk
import time, sys
from pygame import mixer
from PIL import Image, ImageTk
def alarm():
alarm_time=user_input.get()
if alarm_time=="":
messagebox.askretrycancel("Error Message","Please Enter value")
else:
... | shuchi111/Alarm_clockGUI.py | alarm.py | alarm.py | py | 1,256 | python | en | code | 1 | github-code | 6 |
9512947044 | # encoding=utf-8
import pandas as pd
import numpy as np
import time
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
'''
1.求导的是likelihood function, not cost function
2.注意由于梯度中包含指数操作,所以需要一个很小的学习率。
'''
class logistic_regression(object):
def __init__(self,max_iterati... | guozhiqi14/Statistical-Learning | Logistic Regression/logistic_clf.py | logistic_clf.py | py | 1,422 | python | en | code | 0 | github-code | 6 |
19882708740 | import os
import click
from guardata.utils import trio_run
from guardata.api.protocol import OrganizationID
from guardata.logging import configure_logging
from guardata.cli_utils import spinner, cli_exception_handler
from guardata.client.types import BackendAddr, BackendOrganizationBootstrapAddr
from guardata.client.b... | bitlogik/guardata | guardata/client/cli/create_organization.py | create_organization.py | py | 1,793 | python | en | code | 9 | github-code | 6 |
71066855869 | from manim_express.eager import PlotObj, Size
from examples.example_imports import *
scene = EagerModeScene(screen_size=Size.bigger)
graph = Line().scale(0.2)
# t0 = time.time()
#
# delta_t = 0.5
# for a in np.linspace(3, 12, 3):
# graph2 = ParametricCurve(lambda t: [t,
# 0... | beidongjiedeguang/manim-express | examples/plot/lines.py | lines.py | py | 1,382 | python | en | code | 13 | github-code | 6 |
38126132792 | import pandas as pd
TABLAS_REPORTE_DIARIO = {1: 'CasosConfirmadosNivelNacional', 2: 'ExamenesRealizadosNivelNacional',
3: 'HospitalizacionUCIRegion', 4: 'HospitalizacionUciEtario'}
def regionName(df):
if 'Region' in df.columns:
print('Normalizando regiones')
df['Region'... | gitter-badger/covid19-pdfocr | src/postAwsProcessing.py | postAwsProcessing.py | py | 4,597 | python | es | code | 0 | github-code | 6 |
26971894453 | import logging
import mtcorr
import statistics as stats
import math
import h5py
import numpy
import sys
log = logging.getLogger(__name__)
def load_from_hdf5(filename):
f = h5py.File(filename,'r')
quantiles_dict = {}
stats = {}
if 'quantiles' in f:
quantiles_dict['exp_quantiles'] = f['quanti... | timeu/PyGWAS | pygwas/core/result.py | result.py | py | 9,529 | python | en | code | 20 | github-code | 6 |
10731823816 | import torch
from torch import nn
import torchvision.transforms as T
#######################################################################################
######################################## DRML ########################################
########################################################################... | girishvn/BigSmall | code/neural_methods/model/literature_models.py | literature_models.py | py | 15,138 | python | en | code | 14 | github-code | 6 |
33699952990 | from django.contrib import admin
from django.urls import path
from web.views import home_page
from django.contrib.auth.views import LoginView, LogoutView
from ckt.views import (
CircuitControlView,
CircuitStatusView,
write_api_view,
read_api_view,
to_circuit,
plot_graph,
chartview,
grap... | sumansam312/IOT_Platform | iot/urls.py | urls.py | py | 1,462 | python | en | code | 0 | github-code | 6 |
6306031331 | import math
import socket
import time
import struct
# Задаем адрес сервера
SERVER_ADDRESS = ('192.168.1.208', 5555)
# Настраиваем сокет
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(SERVER_ADDRESS)
server_socket.listen(10)
print('server is running, please, press ctrl+c to stop')... | urb31075/PythonBox | srv.py | srv.py | py | 1,218 | python | en | code | 0 | github-code | 6 |
11707381858 | #!/usr/bin/python
# coding: utf-8
from io import open
import os
import time
import re
import db
from sqlalchemy import or_, and_, not_, asc, desc, func
from datetime import datetime, timedelta
from functools import wraps # We need this to make Flask understand decorated routes.
import hashlib
import subprocess
fr... | retroherna/rhweb2 | rhforum.py | rhforum.py | py | 36,199 | python | en | code | 0 | github-code | 6 |
27592948212 | import serial
inp=input("Enter the port : ")
ser=serial.Serial(inp,baudrate=230400,timeout=None)
data_old=0 # always the first-fixed bit
skipped=0
cntr=0
fl=1
su=0
cx=0
while True:
if (skipped!=0):
data_old=ser.readline().decode('ascii')[0]
data_old=int(data_old)
skipped-=1
continue
... | eclubiitk/Li-Fi-E-Club | Old Codes/non-queue implementation/Receiver.py | Receiver.py | py | 910 | python | en | code | 0 | github-code | 6 |
22938524534 | import cv2
import numpy as np
from model import Model
import math as m
import time
import logging as log
class headPoseEstimation():
def __init__(self, MODEL_PATH, DEVICE):
self.model_loaded = Model(MODEL_PATH, DEVICE)
self.model_loaded.get_unsupported_layer()
self.model_name = ... | SamyTahar/Computer-Pointer-Controller | src/headposeestimation.py | headposeestimation.py | py | 1,885 | python | en | code | 0 | github-code | 6 |
30031301327 | import json
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
import matplotlib
import matplotlib.pyplot as plt
import networkx as nx
def read_details(pd_details):
"""[summary]
Args:
pd_details ([type]): [description]
Returns:
[type]: [description]
"""
... | siv2r/kidney-exchange | global_match/hovering.py | hovering.py | py | 8,711 | python | en | code | 45 | github-code | 6 |
39276815188 | import csv
class Item:
pay_rate=0.8# pay rate after 20% discount
all=[]
def __init__(self,name:str,price:float,quantity=0):# sepecify data types for incoming Input
# assertion for incoming input before they get assigned to instance Attribnues
assert price>=0, f"price {price} is not more th... | menkaraghunathbhapkar/menu--oops-practise | class_methods/main1.py | main1.py | py | 1,437 | python | en | code | 0 | github-code | 6 |
31102897914 | # Sortear números e somar
from random import randint
from time import sleep
def sortearLista(lista):
print('Sorteando 5 valores para a lista: ', end ='')
for cont in range(0, 5):
n = randint(1, 10)
lista.append(n)
print(f'{n}', end = '', flush = True)
sleep(0.3)
print(' Pront... | gslmota/Programs-PYTHON | Exercícios/Mundo 3/ex091.py | ex091.py | py | 569 | python | pt | code | 1 | github-code | 6 |
40684104940 | #!/usr/bin/python3
"""
function that queries the Reddit API
and returns the number of subscribers
"""
import requests
def number_of_subscribers(subreddit):
"""initializate"""
if (type(subreddit) is not str):
return(0)
url_api = ("https://www.reddit.com/r/{}/about.json".format(subreddit))
hea... | manosakpujiha/alx-system_engineering-devops | 0x16-api_advanced/0-subs.py | 0-subs.py | py | 539 | python | en | code | 3 | github-code | 6 |
32763077140 | myfile = open('myfile.txt')
print(myfile.read())
#can aonly read once
myfile.seek(0)
mycontent = myfile.read()
print(mycontent)
#returns a list of lines
myfile.readlines()
#file locations
#need full file path
#pwd
#best practice to close it
myfile.close()
#or
with open('myfile.txt') as my_new_file:
contents = my... | stephen-engler/python_files_io | files_io.py | files_io.py | py | 846 | python | en | code | 0 | github-code | 6 |
24270720132 | import random
import os
import glob
import cv2
import numpy as np
import json
from detectron2.structures import BoxMode
import itertools
import sys
# import some common detectron2 utilities
import pdb
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer ... | dhaivat1729/detectron2_CL | experiments/test_duckietown_detectron.py | test_duckietown_detectron.py | py | 6,268 | python | en | code | 0 | github-code | 6 |
43987570086 | from os.path import join
import numpy as np
from graycart.GraycartWafer import evaluate_wafer_flow
from graycart.utils import plotting
# ----------------------------------------------------------------------------------------------------------------------
# INPUTS
"""
Some important notes:
1. On "Design Lab... | sean-mackenzie/grayscale-cartographer | tests/run_flow.py | run_flow.py | py | 11,973 | python | en | code | 0 | github-code | 6 |
70994878268 | # -*- coding: utf-8 -*-
import PySide2.QtWidgets as qtwidgets
import PySide2.QtCore as qtcore
import PySide2.QtGui as qtgui
import PySide2.QtNetwork as qtnetwork
import os.path
import signal
import socket
class HButtonBar(qtwidgets.QWidget):
layout=qtwidgets.QHBoxLayout
def __init__(self,def_list):
... | chiara-paci/djvueditor | lib/python/djvuedlib/widgets.py | widgets.py | py | 9,581 | python | en | code | 0 | github-code | 6 |
2696828667 | from collections import Counter
from trava.ext.boosting_eval.boosting_logic import CommonBoostingEvalLogic
from trava.ext.boosting_eval.eval_steps import EvalFitSteps
from trava.fit_predictor import FitPredictConfig, FitPredictConfigUpdateStep, FitPredictorSteps
from trava.split.result import SplitResult
from trava.tr... | ityutin/trava | trava/ext/grouped/group_steps.py | group_steps.py | py | 3,781 | python | en | code | 2 | github-code | 6 |
33874326793 | # 507/206 Homework 6 Part 2
import requests
from bs4 import BeautifulSoup
#### Part 2 ####
print('\n*********** PART 2 ***********')
print('Michigan Daily -- MOST READ\n')
### Your Part 2 solution goes here
html = requests.get('https://www.michigandaily.com/').text
soup = BeautifulSoup(html, 'html.parser')
# searc... | xckou/SI507-HW06-xckou | hw6_part2.py | hw6_part2.py | py | 762 | python | en | code | 0 | github-code | 6 |
23552963573 | #########################################################################
# File Name: getKmerFromVCF_REF.py
# Author: yanbo
# mail: liyanbotop@163.com
# Created Time: Thu 09 May 2019 10:45:06 AEST
#########################################################################
#!/bin/bash
import collections
from Bio import ... | yanboANU/VariationCalling | libprism/evaluate/getKmerFromVCF_REF.py | getKmerFromVCF_REF.py | py | 7,794 | python | en | code | 1 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.