seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
803719719
# encoding : utf-8 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 or later of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARR...
bdonnette/PACHA
View_Machine.py
View_Machine.py
py
2,355
python
en
code
4
github-code
6
13131048154
import psycopg2 import datetime import time import sys import requests import scipy.io.wavfile import json import vokaturi.Vokaturi as Vokaturi Vokaturi.load("./vokaturi/OpenVokaturi-3-3-linux64.so") from ms_text_analysis import * from cassandra_test import * MSSp = MSSpeechToText() MST = MSTextAnalysis() MSAD = M...
raid-7/SmartDiary
backend/main.py
main.py
py
9,127
python
en
code
1
github-code
6
17609833661
# encoding: utf-8 from django.urls import reverse from rest_framework import serializers from mainsite.serializers import StripTagsCharField from mainsite.utils import OriginSetting class ExternalToolSerializerV1(serializers.Serializer): name = StripTagsCharField(max_length=254) client_id = StripTagsCharFi...
reedu-reengineering-education/badgr-server
apps/externaltools/serializers_v1.py
serializers_v1.py
py
1,636
python
en
code
2
github-code
6
70267343229
import epyk as pk import __init__ page = pk.Page() __init__.add_banner(page, __file__) page.body.style.globals.font.size = 20 site_reference = page.ui.texts.paragraph( "Inspired by [W3School](https://www.w3schools.com/howto/howto_css_coming_soon.asp) and using:  ", width="auto", options={"markdown": True})...
epykure/epyk-templates
websites/template_coming_soon_countdown.py
template_coming_soon_countdown.py
py
2,398
python
en
code
17
github-code
6
37530746951
from django.core.management.base import BaseCommand from assessment.models.assessment_model import AssessmentType class Command(BaseCommand): help = 'Creates initial Assessment Types' def handle(self, *args, **options): # Creating 'Homework' AssessmentType homework, created = AssessmentType.ob...
markoco14/student-mgmt
assessment/management/commands/create_assessment_types.py
create_assessment_types.py
py
959
python
en
code
0
github-code
6
42896231712
import math from functools import partial from typing import Any, Callable import jax import jax.numpy as jnp from chex import ArrayTree from jax import tree_map, vmap from jax.scipy.special import logsumexp from ..resamplings import multinomial STATE = Any @partial(jax.jit, static_argnums=(2, 3, 4), donate_argnum...
AdrienCorenflos/aux-ssm-samplers
aux_samplers/_primitives/csmc/pit/operator.py
operator.py
py
5,444
python
en
code
7
github-code
6
24199916637
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def longestUnivaluePath(self, root): """ Args: root: TreeNode Return: int """ ...
AiZhanghan/Leetcode
code/687. 最长同值路径.py
687. 最长同值路径.py
py
1,692
python
en
code
0
github-code
6
21247144104
from datetime import timedelta from airflow import DAG from airflow.operators.dummy import DummyOperator from airflow.providers.docker.operators.docker import DockerOperator from airflow.sensors.filesystem import FileSensor from directories import ( VOLUME_PATH, LAST_MODEL_DIR, PREDICTIONS_DIR, RAW_DATA_DIR, ...
made-ml-in-prod-2021/truengineer
airflow_ml_dags/dags/predict_daily.py
predict_daily.py
py
1,982
python
en
code
0
github-code
6
197603537
from time import sleep import pygame from bullet import Bullet from alien import Alien import aliens_functions as af # 检测精灵碰撞 def check_bullet_alien_collisions(ai_settings, screen, stats, sb, ship, aliens, bullets): """响应子弹和外星人的碰撞""" # 检查是否有子弹击中了外星人 # 如果是这样,就删除相应的子弹和外星人 collisions = pygame.s...
wanwan2qq/alien_invasion
collisions_functions.py
collisions_functions.py
py
2,042
python
en
code
0
github-code
6
7266791731
import hosties.hosties as hosties, es, gamethread, playerlib, random, popuplib sv = es.ServerVar def unload(): for delay in ['view loop', 'check idle']: gamethread.cancelDelayed(delay) es.addons.unregisterClientCommandFilter(_cc_filter) class RussianRoulette(hosties.RegisterLastRequest): def __init__(self): s...
kmathiasen/source-engine
python/hosties/lastrequests/russianroulette/russianroulette.py
russianroulette.py
py
5,260
python
en
code
0
github-code
6
30357049571
from .basic_editor_factory import BasicEditorFactory from .context_value import CV, CVFloat, CVInt, CVStr, CVType, ContextValue from .editor import Editor from .editor_factory import EditorFactory try: from .editors.api import ArrayEditor except ImportError: # ArrayEditor depends on numpy, so ignore if nump...
enthought/traitsui
traitsui/api.py
api.py
py
3,614
python
en
code
290
github-code
6
17609874011
# encoding: utf-8 from django.core.management import BaseCommand from issuer.models import BadgeClass class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( '--limit', type=int, help='Number of model instances to process in a batch', ...
reedu-reengineering-education/badgr-server
apps/issuer/management/commands/populate_image_hashes.py
populate_image_hashes.py
py
1,279
python
en
code
2
github-code
6
70818525948
import speech_recognition as sr import multiprocessing as mp import os import time def func(n): print("Task {} convert successfully".format(n)) speechToText() time.sleep(2) #simulate processing or server return time print("Task {} has been done now.".format(n)) def speechToText(): r = sr....
CHAODENG/Project4
project4.py
project4.py
py
1,144
python
en
code
0
github-code
6
37598101859
import pytz from sqlalchemy.orm import Session import models import schemas def create_module_build(db: Session, build: schemas.ModuleBuild): print(build) db_build = models.ModuleBuild( module=build.module, build_time=build.build_time, result=build.result, finished_at=build.f...
fresch/maven-build-tracker
crud/CreateBuild.py
CreateBuild.py
py
555
python
en
code
0
github-code
6
17423112690
from phxd.constants import * from phxd.packet import HLPacket from phxd.permissions import * from phxd.server.config import conf from phxd.server.decorators import * from phxd.server.signals import * @packet_handler(HTLC_HDR_MSG) @require_permission(PRIV_SEND_MESSAGES, "send messages") def handleMessage(server, user,...
dcwatson/phxd
phxd/server/handlers/message.py
message.py
py
1,078
python
en
code
6
github-code
6
16312390211
from typing import NamedTuple import tensorflow.compat.v2 as tf import tensorflow_datasets as tfds class LanguageDataset(NamedTuple): records: tf.data.Dataset vocab_size: int def load(batch_size: int, sequence_length: int) -> LanguageDataset: """Load LM1B dataset, returning it and vocab_size.""" ds, ds_inf...
ChrisWaites/data-deletion
src/adaptive_deletion/nlp/transformer/dataset.py
dataset.py
py
1,313
python
en
code
5
github-code
6
8899398458
#!/usr/bin/env python3 import os def main(): d_ucsc = "/users/qchen/Programs/UCSC/"; d_raw = "/dcs04/lieber/ds2a/QChen/Projects/LIBD/Postmortem/Raw/"; d_batch = d_raw + "LIBD_postmortem_2.5M/" f_list = d_batch + "batch_list.txt" try: LIST = open(f_list, "r") except IOError: print("Cannot open " + LIST + ...
dannyqchen/Imputation_QCs
Pre_Imputation_QCs/step02.ped2bed.py
step02.ped2bed.py
py
690
python
en
code
0
github-code
6
40087266458
import os from meteo_ist.models import meteo_data, range_data from django.utils.dateparse import parse_date def upload_db(data): for i in range(0, len(data['datetime'])): date = parse_date(data['datetime'][i]) # parse string do date format pp = data['data']['pp'][i] pres = data['data'][...
sandroferreira97/meteo_ist
meteo_ist/services.py
services.py
py
632
python
tr
code
0
github-code
6
70777898428
import torch import numpy as np from sklearn.preprocessing import MinMaxScaler, StandardScaler from torch import optim, nn from DQN import DQN import torch.nn.functional as F class Agent: def __init__(self, input_size, output_size, device='cpu', learning_rate= 0.001, gamma=0.99, epsilon=0.6, epsilon_min=0.01, epsi...
stefanos50/DQN-Trading-Agent
Agent.py
Agent.py
py
4,449
python
en
code
0
github-code
6
43566450593
import requests from pprint import pprint import os SHEET_ENDPOINT = "https://api.sheety.co/a65d37e4e4c4751b050905bbc69d2c13/myFlightDeals/prices" HEADERS = { "Authorization":os.environ.get("AUTH"), "Content-Type":"application/json", } USR_ENDPOINT = os.environ.get("SHEET_ENd") class DataManager: #This cl...
HazorTremz/FlightDealFinder
data_manager.py
data_manager.py
py
1,077
python
en
code
0
github-code
6
74341979708
from collections import deque count = int(input()) dataDeque = deque(list(range(1, count+1))) while True: if len(dataDeque) == 1: print(dataDeque[0]) break dataDeque.popleft() dataDeque.append(dataDeque.popleft())
KingPiggy/PS
Baekjoon/큐, 덱/2164번 카드2.py
2164번 카드2.py
py
255
python
en
code
0
github-code
6
5792679797
import json import os import magic from io import BytesIO from django.conf import settings from django.core.exceptions import ValidationError from django.core.files.base import ContentFile from django.core.files.storage import default_storage as storage from django.db import models from django.db.models.fields.related...
lotrekagency/camomilla
camomilla/models/media.py
media.py
py
7,378
python
en
code
8
github-code
6
44018209186
import numpy as np from modAL.models import ActiveLearner from modAL.multilabel import SVM_binary_minimum from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC n_samples = 500 X = np.random.normal(size=(n_samples, 2)) y = np.array([[int(x1 > 0), int(x2 > 0)] for x1, x2 in X]) n_initial ...
modAL-python/modAL
tests/example_tests/multilabel_svm.py
multilabel_svm.py
py
981
python
en
code
2,058
github-code
6
30918805074
""" Template for generic Benchmark Test Case Workflow """ import sys import json import copy from datetime import datetime import pandas as pd def build_iterator(**kwargs): """ For building the iterator of the benchmark """ iterator = [(2,'dummy'), (2, 'dummy2'), (4, 'dummy'), (2, 'dummy4')] ret...
NEASQC/WP3_Benchmark
tnbs/templates/my_benchmark_execution.py
my_benchmark_execution.py
py
8,070
python
en
code
0
github-code
6
17996187527
# -*- coding:utf-8 -*- # 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 # 说明: # 必须在原数组上操作,不能拷贝额外的数组。 # 尽量减少操作次数。 class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ ...
shirleychangyuanyuan/LeetcodeByPython
283-移动零.py
283-移动零.py
py
612
python
zh
code
0
github-code
6
20615061350
'''test conf''' import os import datetime from tokenleaderclient.rbac import wfc from flexflow.configs.config_handler import Configs from flexflow.dbengines.sqlchemy.models import dbdriver test_data_path = os.path.join(os.path.dirname(__file__), os.pardir, 'tests', 'testdata') tes...
BhujayKumarBhatta/flexflow
flexflow/configs/testconf.py
testconf.py
py
2,682
python
en
code
1
github-code
6
18842937658
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import random from collections import deque import gym from gym.envs.registration import register import math import DQN as dqn register( id='CartPole-v1565', entry_point='gym.envs.classic_control:CartPoleEnv', # 'wrapper_config.TimeLimit.m...
craclog/DQN_Cartpole
DQN_Cartpole.py
DQN_Cartpole.py
py
4,122
python
en
code
1
github-code
6
5786304430
scores = { "A": 1, "B": 2, "C": 3, "X": 1, "Y": 2, "Z": 3 } score = 0 with open("input.txt", "r") as f: for line in f.readlines(): m, t = line.strip().split(" ") m, t = scores[m], scores[t] draw = t == m win = (t - m) % 3 == 1 loss = (m - t) % 3 ==...
chrisvander/advent-of-code
2022/day-02/prob1.py
prob1.py
py
465
python
en
code
0
github-code
6
17215982737
# coding: utf-8 import cv2 import dlib import sys import face_recognition import numpy as np import os def getdemo(face_file_path): # 导入人脸检测模型 print("当前检测图片为:",face_file_path) predicter_path ='shape_predictor_68_face_landmarks.dat' detector = dlib.get_frontal_face_detector() # 导入检测人脸特征点的模型 sp =...
u19900101/ImgManage
pythonModule/python/saveFace.py
saveFace.py
py
2,892
python
en
code
2
github-code
6
35002911026
# ======= Basic Usage ======== # 第1步,引入 eave 包内组件 from eave import Doc, Note, Api, PP, QP, BP # 也可以使用 * 方式完全引入 from eave import * # 第2步,创建一个 doc 对象,并指定文档的标题和接口调用地址 doc = Doc(title='My Api Document', host='www.myapi.com') # 第3步,如果需要的话,为文档添加描述信息,描述信息会出现在标题下方(支持 markdown 语法) doc.description = """ the content of desc...
taojy123/eave
best_practice.py
best_practice.py
py
2,980
python
zh
code
25
github-code
6
33208629801
from django.shortcuts import render from django.views.generic.base import View from .models import course from pure_pagination import Paginator, PageNotAnInteger, EmptyPage # Create your views here. class CourseListView(View): def get(self, request): all_course = course.objects.all() fav_course = ...
LittleBirdLiu/MXonline_Task
apps/course/views.py
views.py
py
1,955
python
en
code
0
github-code
6
12772858510
import argparse import os import logging import numpy as np import pandas as pd import tensorflow as tf from .model import ( rnn_regression_model, rnn_classification_model, compile_regression_model, compile_classification_model, ) from .transform import ( sequence_embedding, normalize, denor...
srom/rna_learn
rna_learn/archive/rnatemp_main.py
rnatemp_main.py
py
6,687
python
en
code
0
github-code
6
22426413086
from flask import Flask, request, jsonify import requests import json import os import feedparser from dotenv import load_dotenv import random from datetime import date load_dotenv() app = Flask(__name__) @app.route("/", methods=["GET", "POST"]) def root_post(): print(request) return jsonify(text="リクエスト成功") ...
tamanobi/benri-slackbot
index.py
index.py
py
2,926
python
en
code
0
github-code
6
31180641489
import dash import math from flask import Markup from flask import render_template import matplotlib.pyplot as plt from flask import Flask, jsonify, request from dash.dependencies import Output, Event, Input import dash_core_components as dcc import dash_html_components as html import plotly import random import plotly...
ravirajsingh-knit/real-time-twitter-sentiment-analysis
main task/api2.py
api2.py
py
1,656
python
en
code
1
github-code
6
39288037935
def div_two_args(arg_1, arg_2): """Возвращает результат деления двух чисел""" try: div = arg_1 / arg_2 except ZeroDivisionError as f: print(f) return else: return div def input_number(number_index): """Запрашивает у пользователя число и проверяет корректность ввода ...
zalex7/python-remote
lesson_3/task_1.py
task_1.py
py
864
python
ru
code
0
github-code
6
7314418114
import random import Guess_number def play(): print("********************************") print("Bem vindo ao jogo de adivinhação!") print("********************************") print("Adivinhe o número secreto!") numero_secreto = random.randrange(1,21) rodada = 1 nivel_do_jogo = 0 while (n...
Rafaelaugusto16/Training_Python
Games/Guess_number.py
Guess_number.py
py
1,848
python
pt
code
0
github-code
6
35015744969
from flask import Flask, render_template, request import scrapper as scrapper import html website = 'WeFashion' def display(): app = Flask(__name__) @app.route('/') def index(): products = scrapper.getProducts('index','mens-footwear-special-shoes','plrty') data = {...
sameerkhanal209/SnapDealScrapper
website.py
website.py
py
2,334
python
en
code
0
github-code
6
7029192101
import argparse import time import os import cv2 import numpy as np from tqdm import tqdm import torch import torch.nn as nn from torchvision.utils import save_image from torch.utils.data import DataLoader from torch.autograd import Variable import models_x class ImageAdaptive3DModel(nn.Module): def __init__(se...
shaunhwq/Image-Adaptive-3DLUT
demo_3dlut.py
demo_3dlut.py
py
5,091
python
en
code
null
github-code
6
43969738146
#!/usr/bin/env python import argparse import sys from Bio import SeqIO from Bio.SeqRecord import SeqRecord from Bio.SeqFeature import FeatureLocation from CPT_GFFParser import gffSeqFeature, gffWrite bottomFeatTypes = ["exon", "RBS", "CDS"] def makeGffFeat(inFeat, num, recName, identifier): if inFeat.type == "R...
TAMU-CPT/galaxy-tools
tools/gbk/gbk_to_gff3.py
gbk_to_gff3.py
py
13,589
python
en
code
5
github-code
6
3919544072
# standard python libraries import os import re import csv import json import operator import statistics import collections from operator import itemgetter # custom libraries from webxray.Analyzer import Analyzer from webxray.Utilities import Utilities class Reporter: """ Manages the production of a number of CSV ...
thezedwards/webXray
webxray/Reporter.py
Reporter.py
py
30,709
python
en
code
1
github-code
6
31235810811
from django.urls import path, include from rest_framework import routers from aluraflix.views import VideoViewSet, CategoriaViewSet, CategoriaVideosViewSet, VideosFreeViewSet router = routers.DefaultRouter() router.register('videos', VideoViewSet, basename='videos') router.register('categorias', CategoriaViewSet, bas...
diegoamferreira/challange_alura_be1
aluraflix/urls.py
urls.py
py
580
python
en
code
0
github-code
6
1741943302
import typing from typing import Optional, Tuple, Any, Type, Dict import numpy as np from .mode import Q from piquasso.core import _mixins from piquasso.api.exceptions import PiquassoException, InvalidProgram if typing.TYPE_CHECKING: from piquasso.api.program import Program class Instruction(_mixins.DictMixin,...
Budapest-Quantum-Computing-Group/piquasso
piquasso/api/instruction.py
instruction.py
py
5,969
python
en
code
19
github-code
6
72999750909
import re import json import requests from bs4 import BeautifulSoup from lxml import etree from pyquery import PyQuery as pq from Alion_Crawl.CRAW_FUNCTION.request import * headers = { 'User-Agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 M...
if-always/Alion-Crawl
CRAW_FUNCTION/all_functions.py
all_functions.py
py
3,822
python
en
code
0
github-code
6
36246067579
from flask import Flask, request, render_template from flask_cors import CORS from waitress import serve def response(code, message, data=None): # code=0 for success, code=1 for fail return {'code': code, 'message': message, 'data': data} class CustomFlask(Flask): jinja_options = Flask.jinja_options.cop...
nofear195/flask-vue-project-template
main.py
main.py
py
1,179
python
en
code
0
github-code
6
7714160246
import sys import os import shutil import string import re import argparse from datetime import datetime, timedelta import urllib3 import requests import json import yfinance as yf verbose = False ameritradeids = [] def ascii(text): return text.decode('ascii', 'ignore') class Stock: name = '' date = 0 iprice = 0...
atomicpunk/scripts
finance.py
finance.py
py
14,573
python
en
code
0
github-code
6
27189531533
# -*- coding: utf-8 -*- """ Created on Wed Apr 11 23:16:08 2018 @author: Chat """ import pip def install(): pip.main(['install', 'beautifulsoup4']) pip.main(['install', 'weather-api']) pip.main(['install', 'urllib3']) import datetime from urllib.request import urlopen from bs4 import B...
jcsumlin/weather-bot
weather_pjt.py
weather_pjt.py
py
3,467
python
en
code
0
github-code
6
36647090017
import pickle import os import sys import pprint import tempfile import warnings import gridfs from pymongo import MongoClient from bson import ObjectId from datetime import datetime import torch from sacred import Experiment from sacred.observers import MongoObserver def add_mongodb(ex: Experiment): uri = get_m...
berleon/mlproject
mlproject/db.py
db.py
py
7,422
python
en
code
1
github-code
6
19345026163
# Importing constants module in order to use its variables from constants import * # Defining an Animator class class Animator: # Constructor method for the Animator class def __init__(self, frames=(), speed=20, loop=True): # Initializing instance variables self.frames = frames # A tuple of an...
DavidSatria29/Game_PAK-MAN
animation.py
animation.py
py
2,243
python
en
code
0
github-code
6
30728272330
import fileinput,re from collections import defaultdict def signum(x): return 1 if x > 0 else (0 if x == 0 else -1) p1, p2 = defaultdict(lambda: 0), defaultdict(lambda: 0) ll = [l.strip() for l in fileinput.input()] for l in ll: x1, y1, x2, y2 = map(int, re.findall("\d+", l)) xx, yy = signum(x2 - x1), sign...
mdaw323/alg
adventofcode2021/5.py
5.py
py
592
python
en
code
0
github-code
6
35449311097
f = open("day1.txt",'r') l = f.read().split("\n\n") dec = [] for i in l: k = map(int,input().split("\n")) dec.append(sum(k)) #solution 1 print(max(dec)) #solution 2 dec.sort() print(dec[-1]+dec[-2]+dec[-3]) f.close()
robinroy03/CompetitiveProgramming
AdventOfCode2022/day1.py
day1.py
py
224
python
en
code
0
github-code
6
73871395706
# movement_swipe_down.py from game_logic import GameLogic class MovementSwipeDown(GameLogic): def swipe(self, swipe_direction): swiped_down = False for y in range(self.board.get_board_length()): y = self.board.get_board_length() - 1 - y for x in range(self.board.get_board...
danikkm/psp_2048
movement_swipe_down.py
movement_swipe_down.py
py
834
python
en
code
0
github-code
6
18575713061
# -*- coding: utf-8 -*- """ Created on Tue May 5 23:45:19 2020 @author: Niki """ # import pickle import os from lettersEnv_2 import LettersEnv import numpy as np from esn_modified import ESN,identity from sklearn.model_selection import train_test_split import time import string # return valid num...
nicoleta-kyo/diss
train_letters_task - Copy/train_esnsole_newenv.py
train_esnsole_newenv.py
py
5,789
python
en
code
0
github-code
6
10693679498
from typing import Union def pizza_before_bh(loop: int) -> str: result: str = '' for _ in range(loop): n_date: str d_people: Union[str, list] [n_date, d_people] = input().split(' ', 1) d_people = list(map(int, d_people.split())) if len(result) == 0: if all(i...
pdaambrosio/python_uri
Beginner/uri2554.py
uri2554.py
py
709
python
en
code
0
github-code
6
42969813970
import cv2 import mediapipe as mp import numpy as np current_image = 'test1.png' mp_drawing = mp.solutions.drawing_utils mp_selfie_segmentation = mp.solutions.selfie_segmentation BG_COLOR = (255, 255, 255) with mp_selfie_segmentation.SelfieSegmentation( model_selection=1) as selfie_segmentation: im...
Pwegrzyn32/image-background-blur
blur2_0.py
blur2_0.py
py
898
python
en
code
0
github-code
6
72151456828
from pynput import keyboard import random print("Please choose Rock, Paper or Scissors by clicking 1, 2 or 3 respectively. To exit the game click escape.") def on_press(key): if key == keyboard.KeyCode(char='1'): userMove = 1 rps(userMove) elif key == keyboard.KeyCode(char='2'): ...
fraserreilly/rockPaperScissors
rockPaperScissors.py
rockPaperScissors.py
py
1,585
python
en
code
0
github-code
6
16630235120
from ke_logic.terminology_extraction import TerminologyExtraction from file_etl import FileETL from ke_root import ROOT_INPUT,ROOT_OUTPUT dict_terms = {} te = TerminologyExtraction() corpus = FileETL.import_xml(ROOT_INPUT,'CorpusBancosWikipedia') print(corpus) dict_terms = te.get_terminology(corpus) dic_terms_frecuen...
EdwinPuertas/KnowledgeExtraction
ke_run/corpus_banco.py
corpus_banco.py
py
1,310
python
en
code
0
github-code
6
26374935080
import os import sys import time import logging import collections import csv import numpy as np from PIL import Image import torch import torch.utils.data as data import torchvision.transforms as transforms __all__ = ['load_partition_data_landmarks_g23k', 'load_partition_data_landmarks_g160k'] logging.basicConfig()...
Jaewoo-Shin/FL_ACT
data_utils/landmark.py
landmark.py
py
11,398
python
en
code
2
github-code
6
4491655960
from imp import find_module from typing import Dict, Set, List from essence import * import pickle import os import json import re from utils import * import subprocess # TODO: # * We're still depending upon no kaslr, remove the need for it. # * Make generation more efficient. KPATCH_BINARY_PATH = "kpatch/kpatch-buil...
ubdussamad/kptemp
main.py
main.py
py
16,547
python
en
code
0
github-code
6
9063639099
import datetime import logging import time import os import torch from atss_core.config import cfg import torch.distributed as dist from atss_core.utils.comm import get_world_size, is_pytorch_1_1_0_or_later from atss_core.utils.metric_logger import MetricLogger stamps = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtim...
Alan-D-Chen/CDIoU-CDIoUloss
atss_core/engine/trainer.py
trainer.py
py
7,619
python
en
code
25
github-code
6
17812917902
import inspect from typing import Type, List, Optional, TypeVar, Dict, Callable from lyrid.api.actor.switch.handle_rule import HandlePolicy, HandleRule from lyrid.api.actor.switch.property_injection import POLICY_PROPERTY, AFTER_RECEIVE_PROPERTY from lyrid.base.actor import Actor from lyrid.core.messaging import Messa...
SSripilaipong/lyrid
lyrid/api/actor/switch/use_switch.py
use_switch.py
py
2,159
python
en
code
12
github-code
6
41058552946
class Poly: def __init__(self,*terms): # __str__ uses the name self.terms for the dictionary of terms # So __init__ should build this dictionary from terms self.terms = {} for term in terms: if type(term[0]) in [int,float] and type(term[1]) == int: ...
solomc1/python
ics 33/solutions/ile2 solutions/Lab 5/ChampagneMarcel/poly.py
poly.py
py
5,292
python
en
code
0
github-code
6
18834168261
# -*- coding: utf-8 -*- # Author:sen # Date:2020/3/9 20:04 from typing import List class Solution: def wiggleSort(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ n = len(nums) a = sorted(nums) j = len(a) - 1 # 错...
PandoraLS/CodingInterview
ProgrammingOJ/LeetCode_python/324_摆动排序2.py
324_摆动排序2.py
py
710
python
en
code
2
github-code
6
74073674428
"""Profile Model related tests.""" # Django from django.test import TestCase # Models from platzigram_api.users.models import ( User ) class ProfileModelTestCase(TestCase): """Profile Model Test case is a class that manages every test related to Profile model.""" def setUp(self) -> None: """Set...
ChekeGT/Platzigram-Api
platzigram_api/users/tests/test_models/test_profiles.py
test_profiles.py
py
2,846
python
en
code
0
github-code
6
21218371819
import os import requests import sys import subprocess def resolve_api_url(): url = os.getenv('GITHUB_REPO_URL') or os.getenv('GITHUB_ORG_URL') if not url: print('Need GITHUB_REPO_URL or GITHUB_ORG_URL!') sys.exit(1) scope = 'repos' if os.getenv('GITHUB_REPO_URL') else 'orgs' name = u...
phoenix-rtos/phoenix-rtos-docker
gh-runner/entry.py
entry.py
py
1,868
python
en
code
0
github-code
6
70210976508
import joblib import sklearn from src.features.missing_indicator import MissingIndicator from src.features.cabin_only_letter import CabinOnlyLetter from src.features.categorical_imputer_encoder import CategoricalImputerEncoder from src.features.median_imputation import NumericalImputesEncoder from src.features.rare_la...
colivarese/Titanic_Pipeline_MLOps_Eq3
src/models/train_model.py
train_model.py
py
3,077
python
en
code
0
github-code
6
19981907937
import re from fake_useragent import UserAgent from bs4 import BeautifulSoup import requests def get_data(): ua = UserAgent() fake_ua = {'user-agent': ua.random} url = 'https://tury.ru/hotel/' req = requests.get(url=url, headers=fake_ua) response = req.text soup = BeautifulSoup(response, 'lxm...
Baradys/scrappers
scrappers/tury/tury_hotels.py
tury_hotels.py
py
1,685
python
en
code
0
github-code
6
21795406403
# (c) 2015-2018 Acellera Ltd http://www.acellera.com # All Rights Reserved # Distributed under HTMD Software License Agreement # No redistribution in whole or part # import simtk.openmm as mm from sys import stdout from simtk import unit from htmd.molecule.molecule import Molecule from htmd.util import tempname from si...
abdulsalam-bande/KDeep
training_with_htmd/htmd/membranebuilder/simulate_openmm.py
simulate_openmm.py
py
4,730
python
en
code
19
github-code
6
8605343733
# 1 — Fibonacci Usando Função Recursiva def fib1(n: int) -> int: if n < 2: return n # caso base else: return fib1(n - 2) + fib1(n - 1) # função recursiva if __name__ == "__main__": print(fib1(10))
tvcastro1/muscle-memory
Problemas de Ciência da Computação em Python/fibonacci_recursive.py
fibonacci_recursive.py
py
236
python
pt
code
0
github-code
6
11409286861
import os from deep_training.data_helper import ModelArguments, TrainingArguments, DataArguments from transformers import HfArgumentParser from data_utils import train_info_args, NN_DataHelper from models import MyTransformer, ChatGLMTokenizer, setup_model_profile, ChatGLMConfig, LoraArguments, global_args, \ Inval...
kavin525zhang/AIGC
pretrained_model/ChatGLM/loan_collection/infer_lora_batch.py
infer_lora_batch.py
py
4,391
python
en
code
0
github-code
6
35004611103
from sys import stdin n = int(input()) deque = [] for command in stdin: words = command.split() if words[0] == 'push_front': deque.insert(0, int(words[1])) elif words[0] == 'push_back': deque.append(int(words[1])) elif words[0] == 'pop_front': if len(deque) == 0: pr...
Inflearn-everyday/study
realcrystal/Boj10866.py
Boj10866.py
py
915
python
en
code
5
github-code
6
23084042766
from pyrfuniverse.envs import RFUniverseGymGoalWrapper from pyrfuniverse.utils import RFUniverseToborController import numpy as np from gym import spaces from gym.utils import seeding import math import pybullet as p class ToborPushPullEnv(RFUniverseGymGoalWrapper): metadata = {"render.modes": ["human"]} def...
mvig-robotflow/pyrfuniverse
pyrfuniverse/envs/tobor_robotics/tobor_push_pull_env.py
tobor_push_pull_env.py
py
10,739
python
en
code
39
github-code
6
39400557947
import os import argparse from typing import Tuple, Union, List, Dict, Any, Optional, Callable import logging import sys import json import pickle import base64 import ast from IPython.display import Image from itertools import combinations import operator from sklearn.compose import ColumnTransformer from sklearn.pre...
YangWu1227/python-for-machine-learning
tree_based/projects/age_related_conditions_sagemaker/src/custom_utils.py
custom_utils.py
py
23,651
python
en
code
0
github-code
6
75385566906
# https://leetcode.com/problems/longest-harmonious-subsequence/ class Solution: def findLHS(self, nums) -> int: count = {} for e in nums: if e not in count: count[e] = 0 count[e] += 1 maxi = 0 for k in count: if k - 1 in count: ...
fortierq/competitions
leetcode/list/longest-harmonious-subsequence.py
longest-harmonious-subsequence.py
py
512
python
en
code
0
github-code
6
26454090982
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Author: VidaWhite # Source: Blog(http://www.jeyzhang.com/tensorflow-learning-notes.html) # Date: 2018/4/18 # Description: Use softmax to classify MNIST dataset. import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.rea...
VidaWhite/NLPAlgorithm
tutorial/tf-softmax-mnist/tfminst.py
tfminst.py
py
1,212
python
en
code
0
github-code
6
15598776252
import os import colorsys import random # Note: data root --- you can change to your own home = os.path.expanduser("~") voc_root = os.path.join(home, "data/VOCdevkit/") annopath = os.path.join(voc_root, 'VOC2007', 'Annotations', '%s.xml') imgpath = os.path.join(voc_root, 'VOC2007', 'JPEGImages', '%s.jpg') imgsetpath =...
AceCoooool/detection-pytorch
dataset/config.py
config.py
py
2,067
python
en
code
24
github-code
6
70720667387
""" Clase que representa una incidencia de un usuario """ class Issues: accumulatedDebt = 0 def __init__(self, key, rule, severity, component, componentId, project, line, textRange, flows, status, message, effort, debt, assignee, author, tags, creationDate, updateDate, typ): self.key...
falimotxo/SonarIssues
data/Issue.py
Issue.py
py
1,665
python
en
code
0
github-code
6
477702523
from Predictor.Base import BaseTrainner import torch as t from tqdm import tqdm import numpy as np class Trainner(BaseTrainner): def __init__(self, args, vocab, model, loss_func, score_func, train_loader, dev_loader, use_multi_gpu=True): super(Trainner, self).__init__(args, vocab, model, loss_func, scor...
CNDPlab/ByteCup2018
Trainner/trainner.py
trainner.py
py
3,810
python
en
code
3
github-code
6
37558604591
import time import uuid from utils.sns_handler import SNSHandler class OrderEventService: def __init__(self): self._sns = SNSHandler() def publish_order(self, _items_complete, _total_items, _order): return self._sns.publish({ 'id': str(uuid.uuid4()), 'timestamp': int...
silassansil/simple-order-eventsourcing-cqrs-app
shared/service/order_event_service.py
order_event_service.py
py
519
python
en
code
0
github-code
6
23561493561
import scipy import datetime import matplotlib.pyplot as plt import sys from loader import DataLoader import numpy as np import os from keras.datasets import mnist from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization from keras.layers import Input, Dense, Reshape, Flatten, Dropout,...
faniyamokhayyeri/C-GAN
cgan.py
cgan.py
py
6,395
python
en
code
12
github-code
6
33227699274
import urllib.request from apscheduler.schedulers.blocking import BlockingScheduler #from cyimapp.views import modifyUbike import datetime sched = BlockingScheduler() """ @sched.scheduled_job('interval', minutes=1) def timed_job(): print('This job is run every one minutes.') """ @sched.scheduled_job('cron', hour=...
lwyuki0524/CYIM-linebot-finalproject
clock.py
clock.py
py
752
python
en
code
0
github-code
6
15077013091
# -*- coding: UTF-8 -*- import xlrd from datetime import date,datetime #author:by Seven #python读取excel表中单元格的内容返回的有5种类型,即ctype: # ctype: 0 empty ,1 string ,2 number,3 date,4 boolean,5 error #读取的文件名 rfile='test1.xlsx' def read_excel(): wb = xlrd.open_workbook(filename=rfile) sheet_list=wb.sheet_names() sheet1=wb.shee...
ByX54192/Common-Script
rxls.py
rxls.py
py
1,232
python
zh
code
1
github-code
6
2160477708
import turtle def draw_square(): window = turtle.Screen() window.bgcolor("red") t = turtle.Turtle() t.shape("turtle") t.color("yellow") t.speed(1) for i in range(1,5): t.forward(100) t.right(90) window.exitonclick() draw_square()
avjgit/archive
udacity_intro/turtle_drawings.py
turtle_drawings.py
py
246
python
en
code
0
github-code
6
30729197690
import json import logging from threading import Thread from collections import deque import pika from .connect import _Connection LOGGER = logging.getLogger(__name__) class Publisher(Thread): """Multithreaded publisher. We use a multithreaded publisher to keep the I/O loop (and heartbeat) alive and maintai...
mdcatapult/py-queue
src/klein_queue/rabbitmq/publisher.py
publisher.py
py
7,234
python
en
code
0
github-code
6
6226428783
# -*- coding: utf-8 -*- import os from flask import request from flask import jsonify from flask import Flask, g from flask import render_template from flask.ext.babel import Babel import PIL import base64 import numpy as np from PIL import Image from io import BytesIO from datetime import datetime import tensorflow...
rafaelnovello/mnist-demo
webapp/app.py
app.py
py
3,112
python
en
code
2
github-code
6
41533674083
class Solution(object): def smallerNumbersThanCurrent(self, nums): list=[0]*(len(nums)) i=0 while i<len(nums): for j in range(len(nums)): if nums[j]<nums[i]: list[i]+=1 i+=1 return list
dani7514/Competitive-Programming-
1365-how-many-numbers-are-smaller-than-the-current-number/1365-how-many-numbers-are-smaller-than-the-current-number.py
1365-how-many-numbers-are-smaller-than-the-current-number.py
py
307
python
en
code
0
github-code
6
355990780
#!/usr/bin/python # -*- coding: utf-8 -*- import wikipedia import re from EmeraldAI.Logic.Singleton import Singleton from EmeraldAI.Config.Config import Config from EmeraldAI.Logic.Logger import FileLogger class Wikipedia(object): __metaclass__ = Singleton def __init__(self): wikipedia.set_lang(Config...
MaxMorgenstern/EmeraldAI
EmeraldAI/Logic/KnowledgeGathering/Wikipedia.py
Wikipedia.py
py
1,830
python
en
code
0
github-code
6
72217056188
#!/usr/bin/python3 """Base Model Module """ import uuid from datetime import datetime class BaseModel: """Base Model Class The base model class is the base for all other classes """ def __init__(self, *args, **kwargs): """Constructor for baseModel""" if len(kwargs) == 0: ...
Ayo-Awe/AirBnB_clone
models/base_model.py
base_model.py
py
1,748
python
en
code
0
github-code
6
43344923713
# coding=utf-8 __author__ = 'Boris Tsema' import time import cPickle from collections import defaultdict import json import re import numpy as np from twisted.internet import defer from twisted.python import log from gorynych.common.infrastructure.persistence import np_as_text from gorynych.common.infrastructure impo...
DmitryLoki/gorynych
gorynych/processor/infrastructure/persistence.py
persistence.py
py
7,403
python
en
code
3
github-code
6
15579268331
import torch import torch.nn as nn import torch.nn.functional as F class cbow(nn.Module): def __init__(self, vocab_size, embedding_dim=20, padding=True): super(cbow, self).__init__() # num_embeddings is the number of words in your train, val and test set # embedding_dim is the dim...
mari756h/The_unemployed_cells
model/cbow.py
cbow.py
py
1,227
python
en
code
3
github-code
6
27603498320
import requests import os import json from json import JSONDecodeError from dotenv import load_dotenv from loguru import logger from requests import Response from typing import Any load_dotenv() X_RAPIDAPI_KEY = os.getenv('RAPID_API_KEY') headers = { "X-RapidAPI-Host": "hotels4.p.rapidapi.com", "X-RapidAPI-K...
Zaborev/hotel_search_bot
botrequests/hotels.py
hotels.py
py
5,072
python
en
code
0
github-code
6
74182200507
def summ(n, l): if n == 0: return 0 elif n == 1: return l[0] else: return summ(n-1, l) + l[n-1] l = [1,2,3,4,5,6,7,8,9] print(summ(len(l),l))
chollsak/KMITL-Object-Oriented-Data-Structures-2D
Recursive/recursive2/test.py
test.py
py
182
python
en
code
0
github-code
6
372413184
import boto3 from boto3.dynamodb.conditions import Key, Attr from botocore.exceptions import ClientError from datetime import datetime import util dynamodb = boto3.resource('dynamodb') def lambda_handler(event, context): # 送られてくるUserId,mochiliMembers,CognitoIdを取得 body = event["Body"] creater_id = body["C...
ryamagishi/mochili_lambda
postMochili/lambda_function.py
lambda_function.py
py
2,016
python
en
code
0
github-code
6
21936779401
import csv import os import argparse from pathlib import Path import torch from transformers import BertTokenizer from dataset import max_seq_length def read_ag_news_split(filepath, n=- 1): """Generate AG News examples.""" texts = [] labels = [] with open(filepath, encoding="utf-8") as csv_fil...
bracha-laufer/pareto-testing
data_utils/process_data.py
process_data.py
py
3,598
python
en
code
0
github-code
6
71476994748
import sys input = sys.stdin.readline # 필요없는 걸 버리는 연습해야겠다.. idx = -1 def Z(n, x, y, dy, dx): global idx if n == 2: if x <= dx+2 and y <= dy+2: for i in range(y, y + (2 ** (n - 1))): for j in range(x, x + (2 ** (n - 1))): idx += 1 i...
YOONJAHYUN/Python
BOJ/1074.py
1074.py
py
711
python
en
code
2
github-code
6
72532173629
# pylint:disable=unused-variable # pylint:disable=unused-argument # pylint:disable=redefined-outer-name # pylint:disable=protected-access # pylint:disable=not-context-manager from typing import Iterator import pytest import respx from fastapi import FastAPI from fastapi.testclient import TestClient from pytest_simco...
ITISFoundation/osparc-simcore
services/catalog/tests/unit/test_services_director.py
test_services_director.py
py
2,261
python
en
code
35
github-code
6
30794578181
# Plattsalat specific python macros import collections import datetime import numbers import types from typing import Any import logging import uno from com.sun.star.lang import Locale from com.sun.star.table.CellVertJustify import CENTER as vertCenter from com.sun.star.table.CellHoriJustify import CENTER as horCenter ...
nilsrennebarth/oodbpyges
Psmacros.py
Psmacros.py
py
21,881
python
en
code
1
github-code
6
9392771404
import datetime import json import os from subprocess import Popen, PIPE, STDOUT from time import clock from flask import Flask, request #, session, g, redirect, url_for, abort, render_template, flash from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_object(__name__) app.config.update(...
will2dye4/restty
restty.py
restty.py
py
2,502
python
en
code
0
github-code
6
36068067635
start = int(input('enter first year\n')) stop = int(input('enter last year\n')) gap = int(input('enter the interval btwn years')) nq = int(input('enter the no of quarters\n')) no_of_yrs = int(((stop-start)/gap)+1) data = [0.0]*(no_of_yrs*nq) totals = [0.0]*nq avgs = [0.0]*nq for i in range(0,no_of_yrs): for j in r...
adis98/Models-for-design-of-experiments
Python_Scripts/seasonal_fluctuations.py
seasonal_fluctuations.py
py
1,211
python
en
code
0
github-code
6
29553788733
from __future__ import absolute_import, division, print_function, unicode_literals from .compat import test_cycle from .schema import ensure_schema def build_dags(schema, dag_class=None, operator_class=None, sensor_class=None): """ :param dict schema: Airflow declarative DAGs schema. :param dag_class: DA...
rambler-digital-solutions/airflow-declarative
src/airflow_declarative/builder.py
builder.py
py
5,284
python
en
code
128
github-code
6
36096958231
import numpy as np from sklearn import datasets from sklearn.metrics import accuracy_score, classification_report from sklearn.model_selection import train_test_split from .base import BaseAlgorithm class NaiveBayes(BaseAlgorithm): def __init__(self): self._classes = None self._mean = None ...
janaSunrise/ML-algorithms-from-scratch
algorithms/naive_bayes.py
naive_bayes.py
py
2,115
python
en
code
5
github-code
6