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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
39842661876 | import gzip
import json
import os
import sys
from itertools import islice
from typing import Dict, List
import git # pip3 install gitpython # https://gitpython.readthedocs.io/en/stable/intro.html
# Used if no path is specified in the command line arguments
DEFAULT_REPO_PATH = './linux.git'
def chunks(data, size):
... | GaspardIV/gitvision | tool/tool.py | tool.py | py | 5,468 | python | en | code | 0 | github-code | 50 |
29169938932 | import logging
import unittest
import os
from genedescriptions.commons import Module
from genedescriptions.config_parser import GenedescConfigParser
from genedescriptions.data_manager import DataManager, DataType
from genedescriptions.descriptions_generator import OntologySentenceGenerator
from genedescriptions.gene_d... | alliance-genome/agr_genedescriptions | tests/test_gene_description.py | test_gene_description.py | py | 3,693 | python | en | code | 3 | github-code | 50 |
16174387565 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
- Nombre: pforencoder.py
- Descripción: permite encode/decode de paquetes de enteros a/desde PFor
(NewPFor/OptPFor).
- Autor: Agustín González
- Modificado: 30/05/18
Nota: algoritmo basado en "Performance of Compressed Inverted List Caching
in Search Engines" de Zhang,... | gustingonzalez/ircodecs | pforencoder.py | pforencoder.py | py | 9,705 | python | es | code | 0 | github-code | 50 |
11822346824 | import re
import time
from jarvis.skills.skill import AssistantSkill
class WordSkills(AssistantSkill):
@classmethod
def spell_a_word(cls, voice_transcript, skill, **kwargs):
"""
Spell a words letter by letter.
:param voice_transcript: string (e.g 'spell word animal')
:par... | ggeop/Python-ai-assistant | src/jarvis/jarvis/skills/collection/text.py | text.py | py | 868 | python | en | code | 775 | github-code | 50 |
21416810205 | """
Variable Type 추가 시
1. UI variable_widget.ui에 추가
2. VariableListDialog _btnAddVariableClicked Method에 item으로 추가
3. DeclareVariableDialog popup에 추가
4. VariableWidget setComponent에 추가
5. VariableWidget getVariable에 추가
6. variable getValue에 추가
"""
import os
import re
import pickle
from PyQt5.QtC... | jasonbaek97/test_tool | widgets/variableWidget.py | variableWidget.py | py | 31,317 | python | en | code | 0 | github-code | 50 |
15551055354 | """
Выполнение HTTP-запроса с помощью транспортного механизма и протокола
"""
import asyncio
from asyncio import AbstractEventLoop, Future, Transport
from typing import Optional
class HTTPGetClientProtocol(asyncio.Protocol):
def __init__(self, host: str, loop: AbstractEventLoop):
self._host: str = host
... | hazadus/asyncio-learn | ch8/listing_8_1.py | listing_8_1.py | py | 1,608 | python | en | code | 0 | github-code | 50 |
22226720670 | from tkinter import messagebox
import tkinter as tk
import requests
from threading import Thread
import pyperclip
api=" http://api.quotable.io/random"
quotes=[]
quote_number=0
n=0
window= tk.Tk()
window.geometry("1100x500")
window.title("Quote Generator")
window.grid_columnconfigure(0, weight=1)
window... | Attafii/Quote_Generator | quote.py | quote.py | py | 1,964 | python | en | code | 1 | github-code | 50 |
10038860604 | import yaml
config = {
'site_url': None, # if has site_url, use absolute url
'site_dir': 'site',
'permalink': ':year:/:month:/:day:/:title:.html',
'template_dir': None,
'site_name': 'Your Site Name',
'author': 'Your Name'
}
def load_config(config_file, config):
with open(config_file, 'r'... | tye42/mdsite | mdsite/utils/configparser.py | configparser.py | py | 498 | python | en | code | 0 | github-code | 50 |
16486174667 | # 应用场景 : 多个参数的时候
# import urllib.parse
#
# data = {
# 'wd':'周杰伦',
# 'sex':'男',
# 'location':'中国台湾省'
# }
#
# a = urllib.parse.urlencode(data)
# print(a)
# 获取 网页源码
import urllib.request
import urllib.parse
base_url = 'https://www.baidu.com/s?'
data = {
'wd':'王力宏',
'sex':'男',
'location':'中国台湾省'... | lyy82/pythonPaChong | 058_爬虫_urllib_get请求的urlencode方法.py | 058_爬虫_urllib_get请求的urlencode方法.py | py | 791 | python | en | code | 0 | github-code | 50 |
14437260850 | from copy import copy
import os
from shutil import copyfile
from syscore.dateutils import create_datetime_marker_string
from syscore.fileutils import get_resolved_pathname, files_with_extension_in_pathname
from syscore.objects import (
resolve_function,
)
from syscore.constants import arg_not_supplied, success, fa... | robcarver17/pysystemtrade | sysproduction/data/backtest.py | backtest.py | py | 9,848 | python | en | code | 2,180 | github-code | 50 |
40792864032 | import itertools
import collections
from inlinetesting.TestingAtoms import assert_equal, AssuranceError, AlternativeAssertionError, summon_cactus
from inlinetesting.TestingBasics import assure_raises_instanceof
class ProvisionError(Exception):
pass
class MysteriousError(Exception):
""" don't catch this. ... | JohnDorsey/inlinetesting | PureGenTools.py | PureGenTools.py | py | 12,172 | python | en | code | 0 | github-code | 50 |
17859236671 | import pickle
import pylab as plt
import seaborn as sns
import pathlib
path = pathlib.Path.cwd()
if path.stem == 'ATGC2':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('ATGC2')]
with open(cwd / 'figures' / 'msi' / 'results' / 'latents_sum_new.pkl', 'rb') as f:
latents = pickle.load(f)
... | OmnesRes/ATGC | figures/msi/latent_figure.py | latent_figure.py | py | 2,038 | python | en | code | 3 | github-code | 50 |
12621785148 | """
Only going down
"""
import numpy as np
import pandas as pd
import platform
import os
os.chdir('../')
path = os.getcwd()
if platform.system() == 'Windows':
vnx = pd.read_csv(path + '\\data\\VNX.csv', usecols=["ticker"])
if platform.system() != 'Windows':
vnx = pd.read_csv(path + '/data/VNX.csv', usecol... | zuongthaotn/quant-trading-by-py | GoingDown/filter01.py | filter01.py | py | 942 | python | en | code | 0 | github-code | 50 |
75005510876 | from rest_framework import serializers
from main.models import Event, Category
from app_user.serializers import AppUserDetailsSerializer
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = '__all__'
read_only_fields = ('slug',)
class EventCreateSe... | Kenan7/corvento_backend | main/serializers.py | serializers.py | py | 902 | python | en | code | 1 | github-code | 50 |
70573332315 | import json
import os
import pickle
import random
import cv2 as cv
import torch
from torchvision import transforms
from config import device, im_size, pickle_file_aligned, train_ratio, IMG_DIR
from data_gen import data_transforms
from utils import idx2name
def save_images(full_path, filename, i):
raw = cv.imrea... | foamliu/Face-Attributes-Mobile | demo.py | demo.py | py | 5,080 | python | en | code | 40 | github-code | 50 |
74371008795 | from django import forms
from web.models import *
class NoticeForm(forms.Form):
target_type = forms.ChoiceField(
choices=(("channel", "Channel"), ("stream", "Stream"))
)
action = forms.ChoiceField(
choices=(("add", "Add"), ("remove", "Remove"))
)
target_id = forms.CharField(
... | FuckBrains/VTuberSchedule | notify/forms.py | forms.py | py | 1,661 | python | en | code | 0 | github-code | 50 |
38817252633 | import json
from .models import *
def encode(object):
if isinstance(object, User):
return {
'id': object.id,
'password': object.password,
'email': object.email,
'phone_number': object.phone_number,
'date_creation': str(object.date_creation),
... | VOINTENT/hospital-backend | appointment/serializers.py | serializers.py | py | 3,094 | python | en | code | 0 | github-code | 50 |
42731261890 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import argparse
import sys
import os
# This line is used for deploy to PYTHONPATH
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from KeyFinder.comm.logger import logger
from KeyFinder.workflow import walk_keyword, walk_replace
def get_args... | caohuileon/KeyFinder | KeyFinder/findKey.py | findKey.py | py | 3,327 | python | en | code | 0 | github-code | 50 |
5999645446 | from django.urls import path
from .views import *
urlpatterns = [
# path('list', list_trainees, name='list_trainees'),
path('list', ListTrainees.as_view(), name='list_trainees'),
# path('add', add_trainee, name='add_trainee'),
path('add', AddTrainee.as_view(), name='add_trainee'),
path('update/<in... | AalaaBadr/ITI-Django-school-system | school/trainee/urls.py | urls.py | py | 438 | python | en | code | 0 | github-code | 50 |
75069063835 | from django.shortcuts import render
import datetime
from django.shortcuts import render,redirect
from rest_framework.decorators import api_view,permission_classes,authentication_classes
from rest_framework.permissions import IsAuthenticated
from user.models import Account,UserToken,Categories,District,City
from .models... | imviz/WEDID | weDid/jobportal/views.py | views.py | py | 16,549 | python | en | code | 4 | github-code | 50 |
11980639871 | import constants as c
import subprocess
import hashlib
import logging
import tarfile
import sys
from SRA_submission_tool.submission_db import SubmissionDBService
__author__ = "Amr Abouelleil"
class BamValidator(object):
"""
A class for creating bam validator objects that run ValidateSamFile.
... | broadinstitute/sra_submission_tool | SRA_submission_tool/file_service.py | file_service.py | py | 7,361 | python | en | code | 0 | github-code | 50 |
635341525 | from django import forms
from .models import Posts, Profile, Comments, Likes
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude = ['user']
fields = ['dp','bio', 'phone_number']
class PostsForm(forms.ModelForm):
class Meta:
model = Posts
exclude = ['... | Paul-Ngigi/alaaaa | core/forms.py | forms.py | py | 1,142 | python | en | code | 0 | github-code | 50 |
71356141595 | from bayessb.report import reporter, Result, ThumbnailResult
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from bayessb.multichain import NoPositionsException
import numpy as np
import math
reporter_group_name = "Residuals"
@reporter('Residuals at Maximum Likelihood'... | johnbachman/tBidBaxLipo | tbidbaxlipo/reporters/residuals.py | residuals.py | py | 2,812 | python | en | code | 0 | github-code | 50 |
28570918893 | from collections import defaultdict
from enum import Enum
import functools
from itertools import product
from lark import (
Lark,
Transformer,
v_args,
)
from typing import (
Optional,
Sequence,
Union,
)
class WhereOp(Enum):
AND = 0
OR = 1
@functools.total_ordering
class WhereLiteral:... | robsdedude/proggers | proggers/query.py | query.py | py | 16,544 | python | en | code | 1 | github-code | 50 |
72454025116 | class Solution:
def numberOfLines(self, widths: List[int], S: str) -> List[int]:
ABC = "abcdefghijklmnopqrstuvwxyz"
counter, lines = 0, 1
_dict = {}
for i in range(len(widths)):
_dict[ABC[i]] = widths[i]
for i in S:
counter += _dict[i... | Mayureshd-18/test2 | my-folder/problems/number_of_lines_to_write_string/solution.py | solution.py | py | 462 | python | en | code | 0 | github-code | 50 |
18197122309 | import math
import tkinter as tk
from PIL import Image,ImageTk
janela = tk.Tk()
janela.geometry("680x780")
janela.title("Calculador de Equação do Segundo Grau")
a = tk.Label(text="Informe o a:")
a.grid(column=0,row=1)
b = tk.Label(text="Informe o b:")
b.grid(column=0,row=2)
c = tk.Label(text="Informe o c:")
c.grid(... | Heber3000/Calculadora_de_equa-o_do_segundo_grau | projeto.py | projeto.py | py | 1,825 | python | pt | code | 0 | github-code | 50 |
15823622286 | import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.renderers.default='browser'
from sklearn.metrics import roc_auc_score
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
# read data train
train = train = pd.read_csv(
"C... | aigerimb/Time-Series-Analysis- | riid_prediction.py | riid_prediction.py | py | 9,419 | python | en | code | 0 | github-code | 50 |
24228282534 | from datetime import date
from typing import List, Dict, Union
import requests
import pandas as pd
class Wig20Scraper:
def __init__(self, from_date: date, to_date: date) -> None:
self.from_date = from_date
self.to_date = to_date
def build_url(self) -> str:
base: str = "https://gpwbe... | AleksanderWWW/wig20-prediction-app | app/src/extract.py | extract.py | py | 1,734 | python | en | code | 1 | github-code | 50 |
40136635880 | #!/usr/bin/env python3
from __future__ import print_function
import sys
from ROOT import *
import os
from subprocess import call
import os.path
import shutil
import subprocess
import codecs
import re
import errno
from getGTfromDQMFile_V2 import getGTfromDQMFile
def setRunDirectory(runNumber):
# Don't forget to ad... | cms-sw/cmssw | DQM/SiStripMonitorClient/scripts/TkMap_script_phase1.py | TkMap_script_phase1.py | py | 19,429 | python | en | code | 985 | github-code | 50 |
73709087194 | from django.shortcuts import render_to_response
from django.template import loader,Context
from django.http import HttpResponse
from datetime import datetime
import student as stdent
import game
import django.utils.simplejson as json
def question(request,op):
q = dict()
q['first'] = '3'
q['second'] = '4'
q['questi... | bernardokyotoku/skillplant | game/views.py | views.py | py | 1,053 | python | en | code | 1 | github-code | 50 |
16906175053 | from home.models import Urls
from django.db.models import Q
def buscador(request):
"""CARREGA O BUSCADOR NO TEMPLATE BASE"""
if 'search' in request.GET:
search = request.GET['search']
else:
search = ''
if search == '':
urls = Urls.objects.all().distinct()
... | RafaelMunareto/vet_system_django_puro | vet_system_django_puro/apps/processors/context_processors.py | context_processors.py | py | 1,154 | python | en | code | 0 | github-code | 50 |
27821371989 | from PIL import Image as img
import math
import json
def crop_image(filename):
# This function is called from the main.py and crops the image.
# Once the image is cropped, it is saved to a file on the users
# network.
foto = img.open(filename)
size = width, height = foto.size
foto_stdr_save_lo... | roytouw/bloemenfotografie | crop_foto.py | crop_foto.py | py | 4,414 | python | en | code | 0 | github-code | 50 |
23997195357 | import bpy
import os
class Operator_BlenRig5_Add_Biped(bpy.types.Operator):
bl_idname = "blenrig5.add_biped_rig"
bl_label = "BlenRig 5 Add Biped Rig"
bl_description = "Generates BlenRig 5 biped rig"
bl_options = {'REGISTER', 'UNDO',}
@classmethod
def poll(cls, context)... | JT-a/blenderpython279 | scripts/addons_extern/BlenRig5/blenrig_biped/ops_blenrig_biped_add.py | ops_blenrig_biped_add.py | py | 2,295 | python | en | code | 5 | github-code | 50 |
74974812315 | import sublime
import sublime_plugin
try:
from is_pretext_file import is_pretext_file
except ImportError:
from .is_pretext_file import is_pretext_file
PRETEXT_SYNTAX = 'Packages/PreTeXtual/PreTeXt.sublime-syntax'
class PretextSyntaxListener(sublime_plugin.EventListener):
def on_load_async(self, view):
... | daverosoff/PreTeXtual | pretextSyntaxListener.py | pretextSyntaxListener.py | py | 765 | python | en | code | 1 | github-code | 50 |
37211511047 | import time
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
def get_filters():
"""
Asks user to specify a city, month, and day to analyze.
Returns:
(str) city - na... | omarsherif200/Udacity_Data_Analysis_Nanodegree | Explore US BikeShare Dataset/bikeshare.py | bikeshare.py | py | 8,128 | python | en | code | 0 | github-code | 50 |
75027697113 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from lib.lib_config import get_config_var
from lib.log import log
import logging
from subprocess import Popen, PIPE, STDOUT, call
import sys
import os
from lib.lib_config import get_config_var
level = get_config_var("log_level")
log_path = get_config_var("l... | encodingl/skstack | lib/lib_skdeploy.py | lib_skdeploy.py | py | 4,687 | python | en | code | 4 | github-code | 50 |
38324008926 | import pandas as pd
import pickle
import re
import string
import nltk
from nltk.corpus import wordnet
from wordcloud import WordCloud
from nltk.stem import WordNetLemmatizer
import scattertext as st
import spacy
import numpy as np
import pyLDAvis
import pyLDAvis.sklearn
from textblob import TextBlob
import matplotlib.p... | WSHuusfeldt/PythonSem4Eksamen | Clean_data.py | Clean_data.py | py | 5,207 | python | en | code | 0 | github-code | 50 |
11283935248 | # Herencia
# SUPERCLASE
class Producto:
def __init__(self, referencia, nombre, pvp, descripcion):
self.referencia = referencia
self.nombre = nombre
self.pvp = pvp
self.descripcion = descripcion
def __str__(self):
return """\
REFERENCIA\t{}
NOMBRE\t{}
PVP\t{}
DESCRIPCIÓN... | Nivaniz/Cursos | Python/GeneralCode/ComandosCatorce.py | ComandosCatorce.py | py | 3,193 | python | es | code | 0 | github-code | 50 |
5627607612 | import time
from skimage import measure
from SciProjects.imaging import pull_data, preprocess
from SciProjects.imaging.scrape_info import get_mapping
from SciProjects.imaging.algorithm import *
root = "/home/csa/tmp/PIC/"
oldpics = "/home/csa/Dohany_kepanalizis/"
source = "/home/csa/tmp/jpegs/"
annotpath = "/home/cs... | csxeba/SciProjects | imaging/xperiment.py | xperiment.py | py | 1,963 | python | en | code | 1 | github-code | 50 |
6060998896 |
from flask import Flask
import requests
import json
import os
app = Flask(__name__)
#query to try and purchase a book by its ID if it is available in stock
@app.route("/purchase/<item_number>", methods=['GET'])
def purchaseCatServer(item_number):
# check quantity in stock
url = os.environ['CATALOG']+"/info... | Ahmad-Qerem/DOS_PROJECT | Order/app.py | app.py | py | 1,112 | python | en | code | 0 | github-code | 50 |
29645019753 | import aiohttp
import asyncio
import discord
import re
import sqlite3
import threading
from bs4 import BeautifulSoup
from datetime import datetime
from discord.ext import commands
from ext.utils import utils, checks
from settings import *
class APBDB2:
def __init__(self, bot):
self.bot = bot
sel... | SKaydev/apbdb-discord | ext/apbdb2.py | apbdb2.py | py | 14,874 | python | en | code | 0 | github-code | 50 |
26661597316 | """
Main tests
"""
import unittest
from db.sql.connection.singleton import Database
from main import build_db, upload_csv
class MainTests(unittest.TestCase):
"""
Main Unit Tests
"""
def create_test_db(self):
"""
Setup the test database in RAM
"""
headers = {
... | ThePinkPythons/Database-Project | tests/test.py | test.py | py | 1,517 | python | en | code | 0 | github-code | 50 |
26779225638 | def cm2inch(*tupl):
inch = 2.54
if isinstance(tupl[0], tuple):
return tuple(i/inch for i in tupl[0])
else:
return tuple(i/inch for i in tupl)
# figure size
SMALL_FIGURE_SIZE=cm2inch(6,4.5) #(8,6)
BIG_FIGURE_SIZE=cm2inch(12,6)
# content size
LINE_WIDTH=1
MARKER_SIZE=7
MARKEREDGE... | Si3ver/SVNF | src/figure_style.py | figure_style.py | py | 472 | python | en | code | 24 | github-code | 50 |
13034541438 | #Chris Kopacz
#Python Exercises from Github
#Level 1, question 1
#created: 20 June 2017
"""
Question 1
Level 1
Question:
Write a program which will find all such numbers which are divisible by 7 but are not a
multiple of 5, between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma-separ... | chriskopacz/python_practice | Problems/lev1/lev1_q1.py | lev1_q1.py | py | 552 | python | en | code | 0 | github-code | 50 |
14421032000 | from utils import load_data
###
from sklearn.cluster import KMeans, AgglomerativeClustering, DBSCAN
import numpy as np
from sklearn.preprocessing import Imputer, normalize
from sklearn.metrics import normalized_mutual_info_score
from sklearn.model_selection import GridSearchCV, train_test_split
from sklearn.metrics imp... | Pibborn/mockup-exam | ex1_clustering.py | ex1_clustering.py | py | 2,383 | python | en | code | 0 | github-code | 50 |
20564069413 | import pygame
from sglib import settings
class Button():
def __init__(self,img,but_loc,size):
self.scl_fac = settings.scale_factor()[0]
self.location = (int(but_loc[0]* self.scl_fac), int(but_loc[1]* self.scl_fac))
self.size = int(size * self.scl_fac)
self.img = pygame.image.load(i... | StrayRaider/solargolf | sglib/buttons.py | buttons.py | py | 804 | python | en | code | 1 | github-code | 50 |
1789163298 | DEFAULT_ACE_HIGH = True
SUITS = {
'spade': { 'name': 'Spade', 'symbol': 'S', 'value': 4 },
'heart': { 'name': 'Heart', 'symbol': 'H', 'value': 3 },
'diamond': { 'name': 'Diamond', 'symbol': 'D', 'value': 2 },
'club': { 'name': 'Club', 'symbol': 'C', 'value':... | foole/pokersim | pokersim/deck/card.py | card.py | py | 4,661 | python | en | code | 1 | github-code | 50 |
14838014395 | voucher_price = int(input())
purchase = input()
tickets = 0
other = 0
price = 0
while purchase != "End":
letter_1 = purchase[0]
letter_2 = purchase[1]
if len(purchase) > 8:
price = ord(letter_1) + ord(letter_2)
else:
price = ord(letter_1)
voucher_price -= price
if ... | Pavlina-G/Softuni-Programming-Basics | 07. PB Exams/2019/04_2_cinema_voucher.py | 04_2_cinema_voucher.py | py | 558 | python | en | code | 0 | github-code | 50 |
43192459738 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA, headB):
if headA==None or headB==None:
return None
cur1=headA
cur2=headB
count1=coun... | phoanghuong86/leetcode-daily-challenges | 06Jun-160. Intersection of Two Linked Lists.py | 06Jun-160. Intersection of Two Linked Lists.py | py | 919 | python | en | code | 0 | github-code | 50 |
8026431330 | from PIL import Image
import pytesseract as tess
import pyautogui
import time
import re
import random
tess.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
pyautogui.click(1670, 10, interval=0.4)
# start_time = time.time()
it = 0
while True:
# duration = (time.time() - start_time)
i... | HamidTheDev/Typing-Master | main.py | main.py | py | 1,285 | python | en | code | 1 | github-code | 50 |
33868419356 | # -*- coding: utf-8 -*-
import fastText
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import string
import stop_words
import pathlib
def tokenize(text):
return word_tokenize(text, language='french')
class FeaturesExtractor:... | raphaelreme/SD | SD210/granddebats/src/kmeans_embeddings.py | kmeans_embeddings.py | py | 1,807 | python | en | code | 0 | github-code | 50 |
14606903043 | from random import gauss, random
import scipy as sp
import numpy as np
from scipy.fft import fft
import math
class HurstModel(object):
__instance = None
def __init__(self):
self.filename = ''
self.time_series = []
self.hurst_list = []
self.dim_list = []
if HurstModel._... | Krukrukruzhka/Fractal_dimension | model.py | model.py | py | 3,010 | python | ru | code | 0 | github-code | 50 |
42822512069 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `icenlp_bridge` package."""
import os
import unittest
from icenlp_bridge import init, parse
_SKIP = os.environ.get('ICENLP_DISABLE_TEST') == 'true'
class TestIcenlp_bridge(unittest.TestCase):
"""Tests for `icenlp_bridge` package."""
def test_fail... | sverrirab/icenlp_bridge | tests/test_icenlp_bridge.py | test_icenlp_bridge.py | py | 749 | python | en | code | 3 | github-code | 50 |
11954296623 | '''
https://www.acmicpc.net/problem/11724
'''
from collections import deque
n, m = map(int, input().split())
data = [[] for _ in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
data[a].append(b)
data[b].append(a)
visited = [False] * (n+1)
def dfs(start):
visited[start] = True
... | gogongkong/Python_Study | Month_06/Wk26/0630/백준11724번_DFS_연결요소의갯수.py | 백준11724번_DFS_연결요소의갯수.py | py | 560 | python | en | code | 2 | github-code | 50 |
10495689933 | import pandas as pd
# The absolute path of the csv file.
PATH = r"C:/Users/hzb/Desktop/毕业设计/热塑性材料信息.xlsx"
if __name__ == "__main__":
df = pd.read_excel(PATH, engine='openpyxl')
# 1. Remove all empty columns.
df = df.loc[:, ~df.columns.str.contains('^Unnamed')]
# 2. Fill empty values in TEXT fields.
... | EMUNES/hust-mdb | data-process/csv_data_clean.py | csv_data_clean.py | py | 1,209 | python | en | code | 2 | github-code | 50 |
14257012019 | import collections
import copy
def solution(n, wires):
result = [[] for _ in range(n-1)]
for ind, wire in enumerate(wires) :
graph = collections.defaultdict(list)
wires_ = copy.deepcopy(wires)
wires_.remove(wire)
for wire_ in wires_ :
graph[wire_[0]].append(wire_[1]... | miiiingi/algorithmstudy | bruteforce/6.py | 6.py | py | 1,174 | python | en | code | 0 | github-code | 50 |
23471789937 | #!/usr/bin/env python
#
# License: BSD
# https://raw.github.com/robotics-in-concert/rocon_app_platform/license/LICENSE
#
##############################################################################
# Imports
##############################################################################
# enable some python3 compa... | robotics-in-concert/rocon_app_platform | rocon_app_utilities/tests/test_rapp_repositories.py | test_rapp_repositories.py | py | 2,199 | python | en | code | 8 | github-code | 50 |
26911266975 | import os
VariantDir('build', 'src')
GTEST_HOME = '/home/shanai/oss/gtest-1.6.0'
GTEST_INCLUDE = os.path.join(GTEST_HOME, 'include')
testEnv = Environment(
ENV = os.environ,
CCFLAGS='-O0 -ggdb -Wall -I %s' % (GTEST_INCLUDE),
CFLAGS='-fprofile-arcs -ftest-coverage -std=c99',
LINKFLAGS='-fprofile-arcs ... | wikibook/modern-c-programming | chapter06/valgrind01/SConstruct | SConstruct | 1,054 | python | en | code | 5 | github-code | 50 | |
40161652880 | #-*- coding: utf-8 -*-
#pylint: disable-msg=W0122,R0914
"""
File : utils.py
Author : Valentin Kuznetsov <vkuznet@gmail.com>
Description: Utilities module
"""
from __future__ import print_function
# system modules
from builtins import range
import os
import re
import sys
import pwd
import pprint
import subpr... | cms-sw/cmssw | FWCore/Skeletons/python/utils.py | utils.py | py | 5,307 | python | en | code | 985 | github-code | 50 |
31214484230 | # -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate(use_env=False)
def migrate(cr, version):
# the table exists already, so the ORM doesn't create an id column
cr.execute(
... | kaerdsar/OpenUpgrade | addons/mail/migrations/10.0.1.0/post-migration.py | post-migration.py | py | 1,077 | python | en | code | null | github-code | 50 |
35980714882 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 6 11:37:14 2016
@author: jschepers
"""
import numpy as np
from PIL import Image
from psychopy import visual
import tools
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from PIL import ImageDraw
path_to_fixdur_files, path_to_fixdur_code = tools.paths()... | behinger/fixdur | experiment/experiment2/whole_image.py | whole_image.py | py | 2,056 | python | en | code | 0 | github-code | 50 |
14206036439 | import random
import string
from graph import Vertex, Graph
def get_words(text_path):
with open(text_path, 'r') as reader:
text = reader.read()
text = ' '.join(text.split())
text = text.lower()
text = text.translate(str.maketrans('', '', string.punctuation))
words = text.split... | mostlovedpotato/Random_Composer | main.py | main.py | py | 1,097 | python | en | code | 0 | github-code | 50 |
31771523935 | import Maps
import numpy as np
#CONSTANT DECLARATIONS
SPOTNUM = 20
#Dimensions
TILESIZE = 10
MAPWIDTH = 64
MAPHEIGHT = 64
#Constants representing map resources
NONE = 0
LOW = 1
MED = 2
HIGH = 3
SPOT = 4
WALL = 5
#Class for Wifi hotspots
class Spot:
def __init__(self, x=None, y=None):
#Handling for o... | abtheo/Genetic-Wifi-Optimisation | Genetics.py | Genetics.py | py | 8,253 | python | en | code | 0 | github-code | 50 |
71159428636 | from cv2 import imwrite
import cv2
import numpy as np
from threading import Thread
import get_score
class ThreadWithReturnValue(Thread):
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None):
Thread.__init__(self, group, target, name, args, kwargs, daemon=daemon)
... | VaibhavPatil4240/Image-Size-Reducer-Flask | image_score.py | image_score.py | py | 2,803 | python | en | code | 0 | github-code | 50 |
8936662766 | import json
import os
import re
class Config():
"""Configuration management commands and information.
"""
def __init__(self):
# Checking for data directory
data_path = os.environ.get("TESTER_DATA_DIR_PATH")
# Ensure the data directory path to an absolute path
if data_path ... | redkyn/tester | tester/config.py | config.py | py | 7,094 | python | en | code | 0 | github-code | 50 |
17538209497 | import numpy as np
import matplotlib.pyplot as mp
# 饼状图
# mp.pie(
# values, # 值列表
# spaces, # 扇形之间的间距列表
# labels=[], # 标签列表
# colors=[], # 颜色列表
# '%dd%%', # 标签所占比例格式
# shadow=True, # 是否显示阴影
# startangle=90, # 逆时针绘制饼状图时的起始角度
# ... | yruns/Machine_Learning | DataAnalysis/Matplotlib/Pie.py | Pie.py | py | 867 | python | zh | code | 0 | github-code | 50 |
8861751687 |
from model.database import DatabaseEngine
from controller.member_controller import MemberController
from controller.event_controller import EventController
from controller.liste_controller import ListController
from exceptions import Error
from vue.member_vue import MemberVue
def main():
print("Bienvenue sur Mal... | Thhems/GLPOO-MALIX | MALIX/main_member.py | main_member.py | py | 935 | python | en | code | 0 | github-code | 50 |
4603196508 | from api.utils.subTaskResponse import get_subtask_reponse
from db.models.board import Task
from DTOs.reponseDtos.task import ResponseTask
def get_task_reponse(task: Task) -> ResponseTask:
subtasks = [ get_subtask_reponse(subtask) for subtask in task.subtasks if subtask.isCompleted == False] if len(task.subtasks) >... | JacobSima/trello-backend-fastapi | api/utils/taskResponse.py | taskResponse.py | py | 633 | python | en | code | 0 | github-code | 50 |
70185082714 | c = int(input())
for i in range(c):
# Red, Green, Blue
r = {'points': 0, 'hourly': 'g', 'antihourly': 'b'}
g = {'points': 0, 'hourly': 'b', 'antihourly': 'r'}
b = {'points': 0, 'hourly': 'r', 'antihourly': 'g'}
p = int(input())
for h in range(p):
m, s = input().split()
m = m.lowe... | BrauUu/beecrowd-solutions | python/1875.py | 1875.py | py | 929 | python | en | code | 1 | github-code | 50 |
3193781768 | import requests
import logging
from app import app
from flask import render_template
class Mailer:
def __init__(self, app):
self.url = app.config.get("MAILGUN_URL")
self.auth = ("api", app.config.get("MAILGUN_API_KEY"))
self.sender = app.config.get("MAILGUN_USER")
def send_token(self, ... | nsiregar/pegelinux | app/helper/mail_helper.py | mail_helper.py | py | 997 | python | en | code | 10 | github-code | 50 |
22056831034 | # Samuel Lockton ~ lockton.sam@gmail.com ~ 2022
from dateutil.relativedelta import relativedelta
import datetime
class timeframe(object):
def __init__(self, startTime, intervalLength, priceOpen, priceHigh, priceLow, priceClose):
self.startTime = startTime
self.intervalLength = intervalLength
... | Theshlock/trader-v2 | sandbox/dev/timeframe.py | timeframe.py | py | 1,837 | python | en | code | 1 | github-code | 50 |
12165119996 | import os
images=[]
groundtruth=[]
path1='pictures' #need to have folder call pictures
#path11='pictures/الخليج'
path2='GroundTruth' #need to have folder call Groundtruth
def Num_of_dots(word):
Dictionary_dots = {"ب": 1, "ت": 2, "ث": 3,
"ج": 1, "خ": 1, "ذ": 1, "ز": 1,
... | mohammadyahyaq/Eyfad-Project | ground truth generator/createGroundTruthFile (old version).py | createGroundTruthFile (old version).py | py | 2,538 | python | en | code | 1 | github-code | 50 |
71468012316 |
n, a, b = [int(v) for v in input().split()]
x_list = [int(v) for v in input().split()]
# dp[i][j] := i 個のカード(0~i-1)を使った合計値を A で割った余りが j となるかどうか
dp = [[False] * (a + 1) for _ in range(n + 1)]
dp[0][0] = True
exist_sum_mod_a_is_b = False
# 配る DP
for i in range(n):
x = x_list[i]
for j in range(a):
if d... | ksato-dev/algo_method | 7_dp5/q3_6.py | q3_6.py | py | 693 | python | en | code | 0 | github-code | 50 |
22564313099 | import torch
import numpy as np
class Network(torch.nn.Module):
def __init__(self, lr_network=0.01, lr_likelihood=0.01):
super(Network, self).__init__()
self.fc1 = torch.nn.Linear(28 * 28, 256)
self.fc2 = torch.nn.Linear(256, 128)
self.fc3 = torch.nn.Linear(128, 128)
self... | TolgaOk/Catastrophic-Forgetting | Ideas/use_all/mutable_elasticity/network.py | network.py | py | 2,099 | python | en | code | 1 | github-code | 50 |
7964152452 | import sqlite3
from sqlite3 import Error
class SQLite:
def __init__(self, db_file):
self.db_file = db_file
def connect(self):
try:
conn = sqlite3.connect(self.db_file)
return conn
except Error as e:
print(e)
def execute(self, sql, params=None):
... | harukary/gpt_recipe_app | server/api/core/database.py | database.py | py | 557 | python | en | code | 0 | github-code | 50 |
7470187751 | import json
import requests
def send_to_me_message(access_token: str, template: dict):
"""
나에게 메시지 보내기
"""
header = {"Authorization": 'Bearer ' + access_token}
url = "https://kapi.kakao.com/v2/api/talk/memo/default/send"
data = {"template_object": json.dumps(template)}
return requests.post... | lee-lou2/fastapi | apps/backend/external/kakao/controllers/message.py | message.py | py | 1,135 | python | en | code | 2 | github-code | 50 |
21022434689 | from __future__ import print_function, unicode_literals
import concurrent.futures
import hashlib
import json
import logging
import os
import posixpath
import shutil
import six
PYPI_PREFIX = 'https://pypi.org'
MAX_WORKERS = os.environ.get('PYTEST_PYPI_GATEWAY_MAX_THREAD')
logger = logging.getLogger('pytest.pypi-ga... | uranusjr/pytest-pypi-gateway | src/pytest_pypi_gateway/packages.py | packages.py | py | 5,273 | python | en | code | 0 | github-code | 50 |
16528109002 | import json
import urlparse
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import fetch
data = fetch.fetch()
class Handler(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def parse_path(self, path):
if ... | Akshay666/bagel | backend.py | backend.py | py | 1,252 | python | en | code | 0 | github-code | 50 |
31129942905 | import unittest
from unittest import TestCase
from src.main.python.lib_books import Books
class TestBooks(TestCase):
def test_display_books(self):
try:
self.bk = Books('Hina')
self.bk.display_books()
except FileNotFoundError:
self.assertRaises(FileNotFoundError... | Hinakoushar-Tatakoti/Library-Management-System | src/unittest/python/books_tests.py | books_tests.py | py | 371 | python | en | code | 0 | github-code | 50 |
12274245301 | import cv2
import numpy as np
import pickle
# 模型檔路徑
model_filename = 'main/api/svm_model.pkl'
with open(model_filename, 'rb') as file:
loaded_model = pickle.load(file)
# 預測硬幣圖像
def predict_coin(image):
r_channel = list(image[:, :, 2].reshape(-1)) # 提取R通道
g_channel = list(image[:, :, 1].reshape(-1)) # 提... | San-Zero/EmbeddedSystemDesign | main/api/coinDetect.py | coinDetect.py | py | 5,168 | python | en | code | 0 | github-code | 50 |
2864001216 | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
class PricePrediction:
url = "D:\Projects\ASET\price-monitoring\Data\Bucharest_HousePrice... | Marcel1123/price-monitoring | Python/machine_learning/price_prediction.py | price_prediction.py | py | 5,519 | python | en | code | 0 | github-code | 50 |
24917963449 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from picar_4wd.pwm import PWM
from picar_4wd.adc import ADC
from picar_4wd.pin import Pin
from picar_4wd.motor import Motor
from picar_4wd.servo import Servo
from picar_4wd.ultrasonic import Ultrasonic
from picar_4wd.speed import Speed
from picar_4wd.filedb import FileDB
f... | RASPBERY-PICAR/LAB1_PICAR | examples/helper_functions.py | helper_functions.py | py | 1,476 | python | en | code | 0 | github-code | 50 |
26666511990 | __all__ = ["roll_stalta"]
import os
import numpy as np
import subprocess
from pycheron.util.logger import Logger
from pathlib2 import Path
# Example on how to recomplie seismicRoll lib
# ----------------------
# from numpy import f2py
# with open("/Users/jbobeck/pycheron/rollseis/seismicRoll.f", "r") as myfile:
# ... | sandialabs/pycheron | pycheron/rollseis/roll_stalta.py | roll_stalta.py | py | 8,671 | python | en | code | 20 | github-code | 50 |
18222962327 | from __future__ import print_function
import ast
import atexit # for atexit.register()
import functools
import glob
import operator
import os
import pickle
import re
# replacement for functions from the commands module, which is deprecated.
import subprocess
import sys
import time
try:
from setuptools import ... | ntpsec/gpsd | SConscript | SConscript | 128,460 | python | en | code | 30 | github-code | 50 | |
11335889947 | import re
from collections import defaultdict, Counter
def load(path: str, encoding: str = "utf-8") -> str:
with open(path, encoding=encoding, errors="ignore") as f:
data = f.read()
return data
def preprocess(text: str) -> str:
# добавить энтити рекогнишн
return text
def tokenize(text: st... | BoeingLess/nlp-project | 08.py | 08.py | py | 1,261 | python | en | code | 0 | github-code | 50 |
7122916860 | import httplib2
import os
import json
from apiclient import discovery
from apiclient.http import MediaFileUpload
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
exc... | amsimoes/spiderBet | sheets.py | sheets.py | py | 3,826 | python | en | code | 14 | github-code | 50 |
11147848190 | from django import forms
from django.core import validators
from .models import Comment
error_msg = {
"required": 'این فیلد اجباری است'
}
class CommentAddForm(forms.Form):
subject = forms.CharField(
max_length=120,
widget=forms.TextInput(attrs={"class": 'input-ui pr-2', "placeholder": 'عنوان... | alireza-fa/didikala | comment/forms.py | forms.py | py | 5,625 | python | en | code | 0 | github-code | 50 |
27089425598 | # -*- coding: utf-8 -*-
# ---------------------
# Yolo6d network, include losses
# @Author: Fan, Mo
# ---------------------
# import sys
import numpy as np
import tensorflow as tf
import config as cfg
from utils.utils import (
softmax_cross_entropy,
conf_mean_squared_error,
coord_mean_squared_error,
... | Mmmofan/YOLO_6D | yolo_6d.py | yolo_6d.py | py | 27,080 | python | en | code | 54 | github-code | 50 |
4652076539 | from django.conf import settings
from django.contrib import messages
from django.shortcuts import redirect
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
from ..base import (
fire_form_callbacks,
get_theme,
... | barseghyanartur/django-fobi | src/fobi/integration/processors.py | processors.py | py | 11,441 | python | en | code | 474 | github-code | 50 |
32820225812 | # -*- coding: utf-8 -*-
N = int(input())
i = o = 0
for _ in range(1, N+1):
tmp = int(input())
if tmp in range(10, 21):
i += 1
else:
o += 1
print(i,'in')
print(o,'out')
| carlos3g/URI-solutions | categorias/iniciante/python/1072.py | 1072.py | py | 197 | python | en | code | 1 | github-code | 50 |
13281671821 | import numpy as np
import matplotlib.pyplot as plt
import cv2
import pdb
from skimage import data, color
from skimage.transform import hough_circle
from skimage.transform import hough_ellipse
from skimage.feature import peak_local_max, canny
from skimage.draw import circle_perimeter
from skimage.draw import ellipse_pe... | kimberly-aller/esp-insight | pro/findellipse.py | findellipse.py | py | 11,238 | python | en | code | 0 | github-code | 50 |
7658514654 | from django.conf.urls import include, url
from django.contrib import admin
from guangshuai_test.views import *
urlpatterns = [
# Examples:
# url(r'^$', 'idctools.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
# url(r'^guangshuai_test/',include('guangshuai_test.urls')),
url(r'^adm... | sdgdsffdsfff/idctools | idctools/urls.py | urls.py | py | 672 | python | en | code | 0 | github-code | 50 |
546654986 | # There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai.
# For example, the pair [0, 1], indicates that to take course 0 you have to fi... | tieonster/leetcode | Graphs/Questions/courseSchedule.py | courseSchedule.py | py | 2,195 | python | en | code | 0 | github-code | 50 |
6114938846 | from email.mime.application import MIMEApplication
from flask import Flask, request, jsonify,session
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import JWTManager, create_access_token, jwt_required, get_jwt_identity
from datetime import datetime
from werkzeug.security imp... | vyshakhgnair/Movie-Booker | app-copy.py | app-copy.py | py | 32,091 | python | en | code | 0 | github-code | 50 |
16528695422 |
abuelita=500
juan=200 + abuelita
jose=300 + abuelita
Total=juan+jose
print("\n\n\n 1-Juan y José son hermanos, Juan tiene $200 y José tiene $300,"
"además cada uno recibió $500 de su abuelita, ¿Cuánto dinero "
"tienen entre los 2? \n")
print (" El total es" , Total)
| Alejandro32/ejecicios-python | Problemas/Problemas Basicos/pro1.py | pro1.py | py | 296 | python | es | code | 0 | github-code | 50 |
10756845927 | a = "вЕнЕрА в доМЕ рЫб"
b = "СатУрн В ВОДОлее"
c = "Когда-ТО БуДЕт ЧетВерг"
print(a.title())
print(b.title())
print(c.title())
print("Впереди" + " большие " + "неожиданности")
print(7 == 5, 42 > 13, 144**(1/2))
print(2 * 7 - 10 > 2**4)
# Остаток от деления
z = 42
print("Число z четное?", z % 2 == 0)
y = "2000"
is_l... | would-you-kindly/PythonForWeb | 1/horoscope.py | horoscope.py | py | 3,449 | python | ru | code | 0 | github-code | 50 |
25478403431 |
from biztest.util.easymock.easymock import Easymock
class ScbMock(Easymock):
# 用户中心mock
def update_fk_userinfo(self, id_card_encrypt, full_name_encrypt, no_encrypt):
api = "/tha/individual/getUserInfoByType"
mode = {
"msg": "success",
"data": {
"individ... | xiujingyuan/framework-test | biztest/util/easymock/global_payment/global_payment_scb_mock.py | global_payment_scb_mock.py | py | 15,904 | python | en | code | 0 | github-code | 50 |
13943371507 | import random
from operator import itemgetter
from copy import deepcopy
# Defining a TrieNode type to use to build up the Trie
# This version is slightly modified to construct the Trie for text not multiple patterns
class TrieNode:
# id label counter for inserting nodes
id_count = 0
def __init__(self, char... | kaust-cs249-2020/MOHSHAMMASI-CS249-BIOINFORMATICS | Chapter-9/LongestRepeat_section5.py | LongestRepeat_section5.py | py | 5,905 | python | en | code | 0 | github-code | 50 |
18221299914 | class Node:
def __init__(self, value):
self.value = value
self.next = None
# ***********************************************************************************************************************
class SLL:
def __init__(self):
self.head = None
def append(self,value):
if s... | Kenjilam92/algorithm | April/SLL-Queue-Stack.py | SLL-Queue-Stack.py | py | 8,268 | python | en | code | 0 | github-code | 50 |
75284656475 | # imports
import math
import cv2
import mediapipe as mp
import numpy as np
from keras.models import load_model
from keras.utils.image_utils import img_to_array
import pyaudio
import audioop
import tkinter as tk
# init the audio
audio = pyaudio.PyAudio()
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100... | T4JsaysHello/Facial-Emotion-Recognition | main.py | main.py | py | 8,831 | python | en | code | 0 | github-code | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.