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
25169171416
"""This module defines all the config parameters.""" FEATURE_FORMAT = { "TIMESTAMP": 0, "TRACK_ID": 1, "OBJECT_TYPE": 2, "X": 3, "Y": 4, "CITY_NAME": 5, "MIN_DISTANCE_FRONT": 6, "MIN_DISTANCE_BACK": 7, "NUM_NEIGHBORS": 8, "OFFSET_FROM_CENTERLINE": 9, "DISTANCE_ALONG_CENTERLI...
jagjeet-singh/argoverse-forecasting
utils/baseline_config.py
baseline_config.py
py
2,226
python
en
code
228
github-code
36
946081942
pkgname = "lua5.1-libluv" pkgver = "1.45.0.0" pkgrel = 0 _distver = "-".join(pkgver.rsplit(".", 1)) build_style = "cmake" configure_args = [ "-DLUA_BUILD_TYPE=System", "-DWITH_SHARED_LIBUV=ON", "-DBUILD_MODULE=OFF", "-DBUILD_SHARED_LIBS=ON", "-DWITH_LUA_ENGINE=Lua", ] hostmakedepends = ["cmake", "ni...
chimera-linux/cports
contrib/lua5.1-libluv/template.py
template.py
py
838
python
en
code
119
github-code
36
7373532913
from tornado import ioloop, httpclient as hc, gen, escape from . import _compat as _ from .graphite import GraphiteRecord from .utils import convert_to_format, parse_interval, parse_rule, HISTORICAL, interval_to_graphite, gen_log import math from collections import deque, defaultdict from itertools import islice LOG...
lixiaocheng18/testops
graphite/lib/beacon/alerts.py
alerts.py
py
8,351
python
en
code
0
github-code
36
3292692782
from random import random def randint(a,b): """Our implementation of random.randint. The Python random.randint is not consistent between python versions and produces a series that is different in 3.x than 2.x. So that we can support deterministic testing (i.e., setting the random.seed and expecti...
igorsowa9/vpp
venv/lib/python3.6/site-packages/pyomo/util/modeling.py
modeling.py
py
843
python
en
code
3
github-code
36
35029813116
from pyglossary.plugins.formats_common import * from struct import unpack from zlib import decompress from datetime import datetime enable = True lname = "appledict_bin" format = "AppleDictBin" description = "AppleDict Binary" extensions = (".dictionary", ".data",) extensionCreate = "" singleFile = True kind = "binar...
xiuxi/pyglossary
pyglossary/plugins/appledict_bin.py
appledict_bin.py
py
8,315
python
en
code
null
github-code
36
18444612580
from django.contrib.auth import get_user_model from .models import Chat def create_chat(user_id1, user_id2, room_name): # Get participants participants = get_user_model().objects.filter(id__in=[user_id1, user_id2]) # Get Chat instance chat, _ = Chat.objects.get_or_create(name=room_name) # Add par...
Dosu333/studentity-backend
app/chat/utils.py
utils.py
py
456
python
en
code
0
github-code
36
74612445225
import socket import threading #创建一个socket server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 绑定IP端口 server.bind(('192.168.31.144', 8080)) #绑定监听 server.listen(5) print("服务器启动成功!") ''' print("等待连接....") clientSocket, clientAddress = server.accept() print("新连接") print("IP is %s" % clientAddress[0]) print("po...
hanyb-sudo/hanyb
网络编程(socket通信)/TCP编程/2、客户端与服务端的数据交互/server.py
server.py
py
1,657
python
en
code
0
github-code
36
35829929249
from django.contrib import admin from .models import Page, Carousel class PageAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("title",)} list_display = ( 'pk', 'title', 'slug', 'status', 'updated_at', ) list_filter = ('status', ) list_editable = ( ...
hakanyalcinkaya/kodluyoruz-org-python-ve-django-egitimi
kaft_clone/page/admin.py
admin.py
py
648
python
en
code
81
github-code
36
19167657838
''' Programmer: Jessica Robertson Date Written: 12-1-2022 Problem Link: adventofcode.com/2022/day1 Sources Used: Test file for day 1 of 2022 ''' import day1_2022 as day1 import numpy as np TEST_ARRAY = [6000, 4000, 11000, 24000, 10000] TEST_TOP_CAL = 24000 TEST_TOP_THREE_CAL = 45000 def test_fi...
jrobertson627/adventofcode
year_2022/day1/test_day1_2022.py
test_day1_2022.py
py
536
python
en
code
0
github-code
36
15561174682
import os import platform from build_swift.build_swift import cache_utils from build_swift.build_swift.shell import which from build_swift.build_swift.wrappers import xcrun from . import shell __all__ = [ 'host_toolchain', ] class Toolchain(object): """Represents native host toolchain """ def fin...
apple/swift
utils/swift_build_support/swift_build_support/toolchain.py
toolchain.py
py
6,353
python
en
code
64,554
github-code
36
75174467624
# Task 1.1.1 # 1.Given two whole numbers - the lengths of the legs of a right-angled triangle - output its area. a = int(input()) b = int(input()) area = a * b / 2 print('The area of right angled triangle is equal: ', area) # 2.Input a natural number n and output its last digit. n = int(input()) lastDigit = n%10 p...
ArmineHovhannisyan/Python-Introduction-to-Data-Science
src/first_month/task_1_1_1.py
task_1_1_1.py
py
773
python
en
code
0
github-code
36
12029350008
#!/usr/bin/env python3 import socket import threading import pickle PORT = 6969 SERVER = socket.gethostbyname(socket.gethostname()) ADDR = (SERVER, PORT) #print(SERVER) HEADER = 64 FORMAT = 'utf-8' DISCONNECT_MESSAGE = "gbye" client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(ADDR) def send(m...
NateDreier/Learn_Python
challenges/tcp_client.py
tcp_client.py
py
746
python
en
code
0
github-code
36
26299686956
import mysql.connector from datetime import datetime, timedelta import os import sys from pathlib import Path sql_pass =os.environ["MYSQLPASSWORD"] railway_host =os.environ["MYSQLHOST"] railway_user =os.environ["MYSQLUSER"] railway_database =os.environ["MYSQLDATABASE"] railway_port = int(os.environ["MYSQLPORT"...
uninin3141/task_manage_bot
app/dataset/db.py
db.py
py
2,618
python
en
code
0
github-code
36
71593353703
# Nick Wise # 10/27/2020 # NOTES: Program currently has only been tested with 1 file. # TODO: add validation check for file input, user entered word. # This program will: # ask a user to enter a file/files. # ask user for word to look up in file. # find word and convert it to uppercase and print total occurr...
YcleptInsan/DictionaryConcordance-
Wise-DictionaryConcordance/Wise-concordance.py
Wise-concordance.py
py
5,628
python
en
code
0
github-code
36
72485988903
import logging import sshpubkeys from django.core.exceptions import ValidationError LOGGER = logging.getLogger(__name__) def ssh_public_key_validator(public_key): ''' validate public key string ''' try: key = sshpubkeys.SSHKey(public_key) key.parse() except (sshpubkeys.InvalidKe...
bpereto/borg-hive
src/borghive/lib/validators.py
validators.py
py
495
python
en
code
35
github-code
36
35553862778
from Twitter import * import re class StockAlertInfo(): def __init__(self, alert_info : dict): self.__alert_info : dict = alert_info self.stock = self.__alert_info["stock"] self.buy_price = self.__alert_info["buy_price"] self.option = self.__alert_info["option"] self.alert_t...
gatordevin/TradingBot
v4/Parsers.py
Parsers.py
py
5,539
python
en
code
1
github-code
36
34125354328
import matplotlib.pyplot as pt import math dt = [1e-4, 2e-4, 5e-4, 1e-3, 2e-3, 5e-3, 1e-2] dtl = [math.log(x) for x in dt] dr = [1e-6, 2e-6, 4e-6, 2e-5, 9e-5, 6e-4, 1e-3] dr2 = [2e-2, 7e-2, 1e-1, 5e-1, 1e0, 1e9, 1e9] dr3 = [3e-1, 7e-1, 2e0, 8e0, 1.3e1, 1e9, 1e9] drl = [math.log(x) for x in dr] drl2 = [math.lo...
Platinum-Berlitz/TCCA-CCME
Library/Molecular Simulation/10/10_5.py
10_5.py
py
604
python
en
code
4
github-code
36
27625090373
"""empty message Revision ID: 187613429bc6 Revises: f493fd2f04fa Create Date: 2023-03-11 20:54:05.004095 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '187613429bc6' down_revision = 'f493fd2f04fa' branch_labels = None depends_on = None def upgrade(): # ...
operatorhs/python-flask
flask-stu/migrations/versions/187613429bc6_.py
187613429bc6_.py
py
2,518
python
en
code
0
github-code
36
7813713746
"""add tree_parameters column to groups Create Date: 2022-05-02 21:53:26.704275 """ import enumtables # noqa: F401 import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "20220502_215324" down_revision = "20220502_171903" branch_...
chanzuckerberg/czgenepi
src/backend/database_migrations/versions/20220502_215324_add_tree_parameters_column_to_groups.py
20220502_215324_add_tree_parameters_column_to_groups.py
py
696
python
en
code
11
github-code
36
72184794663
""" This sorting algorithm has time complexity of O(n*log n) but in corner cases (sorted or almost sorted list) can be slower up to O(n^2) 1. Divide and conquer algorithm 2. Can be implemented as In place algorithm, (doesn't create additional sub-lists (still requires some memory for function call stack)) 3. Can be imp...
Delacrua/LearningPython
Algorithms/Sortings/QuickSortHoare.py
QuickSortHoare.py
py
2,794
python
en
code
0
github-code
36
4390242213
from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path("",views.index,name="loginmain"), path("login/",views.login,name="login"), path("logout/",views.logout,name="logout"), path("change/",views.change,name="change"), path("sendcode/",views.se...
Hardik01101/BlogSite-1
login/urls.py
urls.py
py
447
python
en
code
null
github-code
36
70582641703
from sxm_manager.settings import common soft_prefix = '2xfmS1:' ioc_prefix = '2xfm:' cam_prefix = 'MMPAD3x2:cam1:' xfd_prefix = 'dxpXMAP2xfm3:' # Syntax: {pvname: function_name} # When pvname changes function_name will be called with pvname's value callbacks = { soft_prefix+'scan_axes_select.VAL': 'select_sc...
djvine/sxm_manager
sxm_manager/settings/xfm.py
xfm.py
py
6,215
python
en
code
0
github-code
36
22634572785
import numpy import subprocess as sp FFMPEG_BIN = "ffmpeg.exe" command = [ FFMPEG_BIN, '-i', '003_camera_p3.mp4', '-f', 'image2pipe', '-pix_fmt', 'rgb24', '-vcodec', 'rawvideo', '-'] pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8) # read 420*360*3 bytes (= ...
APPLabUofA/Pi_Experiments
GoPro_Visual_Grid/Video_Analysis/Intro_opencv/Read_MP4_Convert_RAW_Save.py
Read_MP4_Convert_RAW_Save.py
py
565
python
en
code
4
github-code
36
74791819944
import click import requests from tabulate import tabulate class github: def __init__(self,ghf): self.ghf=ghf # def repos(self,org): # if self.ghf.debug: click.echo("org:"+org+" token:"+self.ghf.token) # url='https://api.github.com/orgs/'+org+'/repos' # headers=self.ge...
DemandCube/github-flow
src/githubflow/github.py
github.py
py
4,784
python
en
code
5
github-code
36
26431478290
import numpy as np import pandas as pd mashroom = pd.read_csv('mushroom edibility classification dataset.csv') mashroom.head() mashroom.shape mashroom.isnull().sum() mashroom_corr = mashroom.corr() import seaborn as sns sns.heatmap(mashroom_corr, cmap= 'YlGnBu') #removing redundant columns that has no distingui...
Rapheo/Basic-of-ML
Lab_5(data Pre-Processing)/data_preprocessing.py
data_preprocessing.py
py
2,009
python
en
code
0
github-code
36
28798312451
#this program accepts a list of numbers #then takes the list and sqaures each value #I pledge my honor that I have abided by the Stevens Honor System def main(): print("This program accepts a list of numbers and squares them") x = 0 numbers = int(input("Enter the amount of numbers you have: ")) for i ...
Eric-Wonbin-Sang/CS110Manager
2020F_hw5_submissions/vinkdennis/squareslistofnumbers.py
squareslistofnumbers.py
py
526
python
en
code
0
github-code
36
25903248374
# -*- coding: utf-8 -*- # @Time : 2018/3/27 8:18 # @Author : glacier # @Email : 2284711614@qq.com # @File : get_plan_to_md.py # @Software: PyCharm import os,time import pymysql import datetime if __name__ == '__main__': # 格式化 # today = time.strftime('%Y-%m-%d',time.localtime(time.time())) today ...
GlacierBo/python_learn
python_base/get_plan_to_md.py
get_plan_to_md.py
py
1,501
python
en
code
0
github-code
36
30838793023
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 11 18:11:32 2021 @author: mathisagathe """ from pymongo import MongoClient client = MongoClient("10.35.7.4", username = "mathis", password = "MathisM21", authsource = "mathisdb") db=client.mathisdb collection = db["TripAdvisor"] r1 = {"country...
romanelollier/School_Project_BigData
requetes.py
requetes.py
py
1,040
python
fr
code
0
github-code
36
10719930631
import math # i call this solution "the bruce lee". ie: i had to think like water. # ___. __ _____ .__ .___ # \_ |__ ____ __ _ _______ _/ |_ ___________ _____ ___.__. _/ ____\______|__| ____ ____ __| _/ # | __ \_/...
jazzhammer/bruce-lee-water-collection
main.py
main.py
py
7,949
python
en
code
0
github-code
36
74069869225
## Deprecated - see XNATUpload comment. ## from nipype.interfaces.base import ( traits, BaseInterfaceInputSpec, TraitedSpec, BaseInterface, InputMultiPath, File) import qixnat class XNATUploadInputSpec(BaseInterfaceInputSpec): project = traits.Str(mandatory=True, desc='The XNAT project id') subject ...
ohsu-qin/qipipe
qipipe/interfaces/xnat_upload.py
xnat_upload.py
py
3,087
python
en
code
0
github-code
36
28912430156
#The code looks to distinguish between cats and dogs using the AlexNet model set up #This model does not work at high percentage of correctness over 20 epochs due to underfitting as AlexNet is set up to work over larger datasets from sklearn.neural_network import MLPClassifier from sklearn.neighbors import KNeighb...
arulverma/Inspirit-AI-programs
Cat vs Dog AlexNet.py
Cat vs Dog AlexNet.py
py
7,976
python
en
code
0
github-code
36
28613035846
#!/usr/bin/env python """PyQt4 port of the layouts/basiclayout example from Qt v4.x""" from PySide import QtCore, QtGui class Dialog(QtGui.QDialog): NumGridRows = 3 NumButtons = 4 def __init__(self): super(Dialog, self).__init__() self.createMenu() self.createHorizontalGroupBox...
pyside/Examples
examples/layouts/basiclayouts.py
basiclayouts.py
py
3,000
python
en
code
357
github-code
36
12117651948
parameters = command.split () try: if parameters[0] == "divide": print ( "The value of your division is: {0}".format ( float(parameters[1])/float(parameters[2]))) elif parameters[0] == "showfile": file = open ( parameters[1] ) print ( file.read () ) file.close () except...
HOIg3r/LINFO1101-Intro-a-la-progra
Exercices INGI/Session 6/Traitement d'exceptions.py
Traitement d'exceptions.py
py
354
python
en
code
4
github-code
36
35952937567
# coding=utf-8 from utils.dataPreprocess import * if __name__ == "__main__": data_path = "./data/" vocab = build_vocab_list([data_path + 'train.csv', data_path + 'test.csv', data_path + 'val.csv']) with open(data_path + 'vocab_freq.pkl', 'wb') as f: pickle.dump(vocab, file=f) w2i, i2w, i2v = b...
ChemJeff/StoryCloze_ROCStories
data.py
data.py
py
1,061
python
en
code
4
github-code
36
2711278776
from math import sqrt C=50 H=30 def calculate(D): D = int(D) a=str(int(sqrt((2*C*D)/H))) return a D= input("Please eneter a few integars separated by comma: ") D = D.split(",") D=list(map(calculate,D)) print(",".join(D))
dineshgyawali/pythontasks3-7
Task7/Question1.py
Question1.py
py
234
python
en
code
0
github-code
36
37770608391
test_case = int(input()) input_list = [] count = 0 for _ in range(test_case): user_input = input() prev_char = '' appeared = set() isGroup = True for char_idx in range(len(user_input)): current_char = user_input[char_idx] if prev_char == current_char: continue e...
TB2715/python-for-coding-test
BaekJoon/Implement/1316.py
1316.py
py
682
python
en
code
0
github-code
36
12487874050
""" Programming Fundamentals Mid Exam - 30 June 2019 Group 2 Check your code: https://judge.softuni.bg/Contests/Practice/Index/1683#1 SUPyF2 P.-Mid-Exam/30 June 2019/2. - Tasks Planner Problem: Create a program that helps you organize your daily tasks. First, you are going to receive the hours each task takes...
SimeonTsvetanov/Coding-Lessons
SoftUni Lessons/Python Development/Python Fundamentals September 2019/Problems And Files/41 PAST EXAMS/Mid Exams/02. 30 June 2019 Mid Exam Group 2/02.Tasks Planner.py
02.Tasks Planner.py
py
3,555
python
en
code
9
github-code
36
40538429997
#!/usr/bin/python3 """Module def pascal_triangle(n): that returns a list of lists of integers representing the Pascal’s triangle of n:""" def pascal_triangle(n=5): """Implements the pascal's triangle""" pscl = [[0]*i for i in range(1, n+1)] for i in range(n): pscl[i][0] = 1 pscl[i][-1] = 1...
g091/alx-higher_level_programming
0x0B-python-input_output/12-pascal_triangle.py
12-pascal_triangle.py
py
489
python
en
code
1
github-code
36
43776692283
import csv import re from functools import lru_cache from pathlib import Path from rows.fields import slug CITY_DATA_FILENAME = Path(__file__).parent / "data" / "municipios.csv" REGEXP_RS = re.compile("^RIO GRANDE DO SUL (.*)$") STATE_NAMES = { "acre": "AC", "alagoas": "AL", "amapa": "AP", "amazonas...
turicas/autuacoes-ambientais-ibama
autuacoes/cities.py
cities.py
py
3,944
python
en
code
8
github-code
36
16172969453
""" Write a method named getExponent(n,p) that returns the largest integer exponent x such that px evenly divides n. if p<=1 the method should return null/None (throw an ArgumentOutOfRange exception in C#). """ def get_exponent(n, p=None): if p > 1: l, x = [], 0 while abs(n) // (p ** x) >= 1: ...
genievy/codewars
tasks_from_codewars/6kyu/Largest integer exponent.py
Largest integer exponent.py
py
834
python
en
code
0
github-code
36
42324051999
# schedule_post.py # Author: Daniel Edades # Last Modified: 11/21/2017 # Description: Formats a database row intended to represent a post scheduled # for a future time, then inserts that row into a database table for later # retrieval and posting at that actual time. import sqlite3 def schedule_post(tabl...
edadesd/sunrisebot
schedule_post.py
schedule_post.py
py
661
python
en
code
0
github-code
36
70387110823
"Converter with PySimpleGUI" import PySimpleGUI as sg layout = [[sg.Input(key="-INPUT-", size=(40, 40)), sg.Spin(["kilometer to meter", "meter to decimeter", "dosimeter to centimeter"], background_color="black", text_color="white", key="-SPIN-"), sg.Button("convert", key="-CONVERT-", button_color...
HadisehMirzaei/converter-PySimpleGUI
main.py
main.py
py
1,436
python
en
code
0
github-code
36
23268546540
import pytz from datetime import datetime from datetime import timedelta import asyncio class DateError(Exception): pass class TimeError(Exception): pass class DateTimeError(TimeError, DateError): pass class DateTime: @classmethod async def at(cls, date, time): self = DateTime() await (self.init()) awa...
Liyara/Tracker
date_time_handler.py
date_time_handler.py
py
4,172
python
en
code
0
github-code
36
37105984612
import csv import smtplib def mail(email): #function for sending mail to student""" message = "Congratulation are registered!!" server = smtplib.SMTP("smtp.gmail.com", 587) server.starttls() server.login("svraj157@gmail.com","Usa@1234") server.sendmail("svraj157@gmail.com",email,message) def listd...
daksh5/Python-Flask
support.py
support.py
py
500
python
en
code
0
github-code
36
21928235273
#반복문 - for문, while문 ''' 반복적인 작업의 코드로 작성하기 위해 사용 시퀀스 자료형 순서가 있는 자료형 종류 : 리스트, 문자열, range 객체, 튜플, 딕셔너리 for 변수 in 시퀀스 자료 : 명령문 range 명령어 range(숫자) / 0~(숫자-1)까지의 범위 데이터를 만들어줌 range(시작, 끝+1, 단계) / 단계는 생략하면 +1 # while문 - 반복할 횟수가 정해지지 않은 경우 사용! 초기식 while 조건식 : / False가 되면 while 루프를 빠져나온다! 반복할 명령 증감식 e...
sh95fit/Python_study
Python_Basic/PyStudy_06.py
PyStudy_06.py
py
1,529
python
ko
code
1
github-code
36
30527541130
import random import string from fastapi import HTTPException from passlib.context import CryptContext from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import Session from starlette import status from . import models, schemas def get_user(db: Session, user_id: int): return db.query(models.User).fil...
eugenfaust/projectsAPI
sql_app/crud.py
crud.py
py
2,586
python
en
code
0
github-code
36
42542824319
from django.conf.urls import url from cart import views app_name = 'cart' urlpatterns = [ url(r'^$', views.my_cart, name='my_cart'), url(r'^add_cart/$', views.add_cart, name='add_cart'), ]
hikaru32/pro_tt
cart/urls.py
urls.py
py
199
python
en
code
0
github-code
36
29069087850
from config import db from flask import abort, session from models import Recipe, Ingredient,recipes_schema,recipe_schema, RecipeSchema ##### def create_recipe(recipe): name = recipe.get("name") ingredients = recipe.get("ingredients") ingredients_list = [] # check if recipe with same name already exi...
nor5/welshProject
views/recipes.py
recipes.py
py
2,064
python
en
code
0
github-code
36
2723281649
#!/usr/bin/env python3 import html import random trivia= { "category": "Entertainment: Film", "type": "multiple", "question": "Which of the following is NOT a quote from the 1942 film Casablanca? ", "correct_answer": "&quot;Frankly, my dear, I don&#039;t give a damn.&quot;", ...
chadkellum/mycode
challenge57.py
challenge57.py
py
1,284
python
en
code
0
github-code
36
34484792129
import numpy as np from DataUtils import DataUtils import argparse import os import torch from torchvision import datasets, models, transforms if __name__ == "__main__": # setting the hyper parameters parser = argparse.ArgumentParser(description="Analysis Diatoms Research CNR-ISASI") parser.add_argum...
andouglasjr/ProjectDiatoms
analysis.py
analysis.py
py
4,569
python
en
code
0
github-code
36
42233326363
# -*- coding: utf-8 -*- ################################################################ # # # Seth Cram # # ECE351-53 # # Project 9 # # Due: 3/29/2022 # # Any other necessary information needed to navigate the file # # # ################################################################ import numpy as np...
SethCram/Signals-and-Systems-Code
proj10_main.py
proj10_main.py
py
3,559
python
en
code
0
github-code
36
23634749756
from sqlalchemy.orm import sessionmaker from fichero_sql_tablas import Estudiante, create_engine engine = create_engine('sqlite:///estudiantes1.db', echo=True) # crear sesion a la bbdd Session = sessionmaker(bind=engine) # una vez conectados mediante esta sesion creamos las instancias session = Session() # Crear los...
andreagro17/pythonCourseTest
fichero_sql_datos.py
fichero_sql_datos.py
py
639
python
es
code
0
github-code
36
15267569253
from django.shortcuts import render,redirect import book_guide from book_guide.models import Book_guide from book_guide.forms import GuideForm # Create your views here. def guide(request): guides=Book_guide.objects.raw('select * from book_guide') return render(request,"guide/book_guide.html",{'guides':guide...
Marinagansi/3rd-sem-project-django
book_guide/views.py
views.py
py
2,162
python
en
code
0
github-code
36
10322811313
import os import tqdm import argparse import pandas as pd max_row = 0 def trans(value, dict, unknown=0): new_value = dict.get(int(value), unknown) if pd.isna(new_value): new_value = unknown return str(int(new_value)) def transform_paths(row, map_dict): paths_ids = row['path'].split() n...
miaoshenga/APathCS
scripts/share_vocab.py
share_vocab.py
py
6,662
python
en
code
1
github-code
36
15746047617
# -*- coding: utf-8 -*- """ Created on Wed Jul 4 11:43:31 2018 @author: MGGG """ #####For creating a spanning tree import networkx as nx import random from equi_partition_tools import equi_split, almost_equi_split, check_delta_equi_split from projection_tools import remove_edges_map from walk_tools import propose_st...
gerrymandr/ent_walk
tree_sampling_tools.py
tree_sampling_tools.py
py
6,931
python
en
code
1
github-code
36
31298546243
from collections import deque def solution(board): n = len(board) # dir & dx,dy : 0 1 2 3 동 남 서 북 visited = [[[False for _ in range(4)] for _ in range(len(board))] for _ in range(len(board))] dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] def canGo(x, y, d): x2 = x + dx[d] ...
shwjdgh34/algorithms-python
codingTest/2020kakao/블록이동하기.py
블록이동하기.py
py
2,786
python
en
code
2
github-code
36
20052985170
import pandas as pd from src.utils.path import DATA_ROOTPATH POLICY_INDICES = [ 'StringencyIndex', 'GovernmentResponseIndex', 'ContainmentHealthIndex', 'EconomicSupportIndex' ] POLICY_MEASURES = [ 'C1_School_closing', 'C1_Flag', 'C2_Workplace_closing', 'C2_Flag', 'C3_Cancel_public...
Thopiax/pydemic
src/data/covid19/oxford.py
oxford.py
py
1,337
python
en
code
1
github-code
36
16418467084
#!/usr/bin/env python3 import re import random import time import sys from math import ceil from datetime import datetime def get_mem_usage(): pattern = re.compile(r'^(.*):[\s]*([\d]+)[\s]*(.B).*$') mem_total = None mem_free = None bytes_by_units = {'kB': 1024} lines = [line.strip('\n') for line i...
arighi/opportunistic-memory-reclaim
stress-vm.py
stress-vm.py
py
1,894
python
en
code
0
github-code
36
36549687329
from setuptools import setup, find_packages import rbnfrbnf readme = "" setup( name='rbnfrbnf', version=rbnfrbnf.__version__, keywords='parser generation, LR parser, efficient, JIT', description='A best LR parser generator', long_description=readme, long_description_content_type='text/markdown'...
thautwarm/rbnfrbnf
setup.py
setup.py
py
922
python
en
code
4
github-code
36
2705037908
import os from PIL import ImageFont def FindFonts(): fontdir = 'C:\\Windows\\Fonts' files = os.listdir(fontdir) fonts = dict() for f in files: if (f.split('.')[1] == 'ttf'): tmp = ImageFont.truetype(os.path.join(fontdir,f),1) if(tmp.font.style == "Regular"): ...
suever/Date-Stamper
FontFinder.py
FontFinder.py
py
371
python
en
code
0
github-code
36
19815428666
import json import urllib.request url = 'http://ec2-35-158-239-16.eu-central-1.compute.amazonaws.com' post_port = 8000 tracking_port = 8001 headers = {"Content-Type":"application/json"} packet = {'sender_name' : 'Otto Hahn', 'sender_street' : 'Veilchenweg 2324', 'sender_zip' : '12345', '...
CodingCamp2017/pakete
services/tests/test_rest_tracking_service.py
test_rest_tracking_service.py
py
1,711
python
en
code
0
github-code
36
37735076181
from __future__ import division import os import time import math from glob import glob import tensorflow as tf import numpy as np from six.moves import xrange from ops import * from utils import * class DCGAN(object): def __init__(self, sess, input_size=28, batch_size=64, sample_num=64, output_s...
riemanli/UCLA_STATS_232A_Statistical_Modeling_and_Learning_in_Vision_and_Cognition
project4/gan/model_gan.py
model_gan.py
py
11,459
python
en
code
0
github-code
36
35219043762
from itertools import product import sys from bs4 import BeautifulSoup from selenium import webdriver import time import json import re sys.path.append('../../..') from lib import excelUtils from lib import httpUtils from lib import textUtil from lib.htmlEleUtils import getNodeText from lib.htmlEleUtils import getInner...
Just-Doing/python-caiji
src/work/Common/arp1/arp1.py
arp1.py
py
2,360
python
en
code
1
github-code
36
34153413716
import datetime def add_records(obj, db): """ @param obj = JSON object @param db = SQL database """ entries = dict() for o in obj.items(): if str(o[0]) != 'Name' and str(o[0]) != 'Date': entries[int(o[0])] = o[1] for e in entries.items(): e[1]['Event'] = st...
segfaultmagnet/sweet-db
util/sqlloader.py
sqlloader.py
py
1,535
python
en
code
0
github-code
36
2336217386
#!/usr/bin/env python # coding: utf-8 import sys import getopt from classifier import l1c_classifier import os import warnings warnings.filterwarnings('ignore') def error(): print( 'main.py -i <inputdirectory> -o <outputdirectory>') sys.exit() def getRelevantDirectories(argv): inputDir = '' outputDir = '' model...
kraiyani/Sentinel_2_image_scene_classifier
main.py
main.py
py
1,191
python
en
code
0
github-code
36
71749583783
from z3 import substitute, Not, And from collections import defaultdict class Synthesizer: def __init__(self, clauses, model, all_vars, step, prop, hist, length): cond = hist.pc_ante[0] self.all_clauses = set(clauses) self.safe_clauses = set(clauses) self.trigger_clauses = set(clau...
cvick32/ConditionalHistory
src/synthesizer.py
synthesizer.py
py
4,666
python
en
code
5
github-code
36
9395923393
import oci import paramiko import json def submit_hadoop_job(job_params): ssh_client = paramiko.SSHClient() ssh_client.load_system_host_keys() instance_ip = "YOUR_INSTANCE_IP" private_key_path = "/path/to/your/private/key" # Connect to the Hadoop cluster using SSH ssh_client.set_missing_host_...
rclevenger-hm/oci-hadoop-job-automation
function/submit_hadoop_job.py
submit_hadoop_job.py
py
1,588
python
en
code
0
github-code
36
13780268319
import sys from collections import deque n, m = map(int, sys.stdin.readline().strip().split()) paper = [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)] visited = [[0 for _ in range(m)] for _ in range(n)] max_pic = 0 pic_cnt = 0 for i in range(n): for j in range(m): if not visited[i...
Yangseyeon/BOJ
03. Gold/1926.py
1926.py
py
922
python
en
code
0
github-code
36
34016955487
import torch import torch.nn as nn import transformers class BertForSeqClf(nn.Module): def __init__(self, pretrained_model_name: str, num_labels: int): super().__init__() config = transformers.BertConfig.from_pretrained(pretrained_model_name, num_labels...
ayeffkay/Distillation
bert.py
bert.py
py
1,092
python
en
code
1
github-code
36
29050704231
from flask.ext.wtf import Form from wtforms import StringField, BooleanField from wtforms.validators import DataRequired class LoginForm(Form): openid = StringField('openid', validators=[DataRequired()]) remember_me = BooleanField('remember_me', default=False) def __init__(self, *args, **kwargs): ...
AndreasThinks/ASB_DB
app/forms.py
forms.py
py
722
python
en
code
0
github-code
36
26473361587
import cv2 import os import matplotlib.pyplot as plt import numpy as np def show_image(img): plt.imshow(img) plt.show() def show_class(idx): celing = (img[:, :] == [idx, idx, idx]) * 1.0 plt.imshow(celing) plt.show() # input image in order calibration INPUT_DIR = 'data/seg' PATH = os.path.join...
Naxalov/Seg2Dataset
main.py
main.py
py
858
python
en
code
0
github-code
36
3156896101
def verificaTermos(item): if len(item) == 1: l = [] l.append("0") l.append(item) item = ''.join(l) return item vezes = int(input()) cont = 0 while cont < vezes: entrada = input().split() hora = entrada[0] minuto = entrada[1] ocorrencia = entrada[2] hora = verificaTermos(hora) minuto = verificaTermos(...
MarceloBritoWD/URI-online-judge-responses
Iniciante/2152.py
2152.py
py
477
python
pt
code
2
github-code
36
19989928968
# Import Python packages import json import os # Import Bottle import bottle from bottle import Bottle, request, Response, run, static_file import requests from truckpad.bottle.cors import CorsPlugin, enable_cors # Define dirs BASE_DIR = os.path.dirname(os.path.abspath(__file__)) STATIC_DIR = os.path.join(BASE_DIR, '...
IDPLAT/tes-engagement
tes-engagement/app.py
app.py
py
1,373
python
en
code
1
github-code
36
23252374328
"""Convenience functions go here""" import discord # region Constants is_modified = False # Set this to True if you modify the code for your own use. GITHUB_URL = "https://github.com/Mehehehehe82/BotInnit" postmessage = f"It's open source, check it out on github! {GITHUB_URL}" # endregion # region Functions async de...
polypoyo/DiscordBot
conv.py
conv.py
py
999
python
en
code
0
github-code
36
7369258562
from typing import Union import pandas as pd import numpy as np from Functions.date_parser import parse_dates from Functions.data_reader import read_data def get_historical_volatility(main_df: pd.DataFrame, period_start: Union[str], period_end: Union[str...
fhashim/time_series_test
Functions/mvn_historical_volatility.py
mvn_historical_volatility.py
py
4,342
python
en
code
0
github-code
36
37649351161
''' Recommendation Systems: the ML algorithm will learn our likes and recommend what option would be best for us. These learning algorithms are getting accurate as time passes Types: 1)Collaborative Systems: predict what you like based on other similar users have liked in the past 2)Content-Based: predict what y...
ketanp05/MovieRecommendation
app.py
app.py
py
3,004
python
en
code
0
github-code
36
73118984424
import socket def encrypt_word(word): return word def send_encrypted_words(words): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server_socket: server_socket.connect(('localhost', 12345)) encrypted_words = [encrypt_word(word) for word in words] request = ','.join(encrypte...
IlyaOrlov/PythonCourse2.0_September23
Practice/tgridneva/Practica 11client.py
Practica 11client.py
py
630
python
en
code
2
github-code
36
72673672743
from itertools import combinations import numpy as np import copy def converse_to_canonical(var_num, non_neg_rest_num, non_pos_rest_num, eq_rest_num, positive_indexes, func_coefs, rest_coefs, rest_b): ############################# # начальная проверка # проверка количества переме...
Hembos/optimization-method
linear_programming/EnumerationSimplexMethod.py
EnumerationSimplexMethod.py
py
10,391
python
ru
code
0
github-code
36
9232282628
def fizzbuzz(n): ret = "" if not (n % 3): ret += "fizz" if not (n % 5): ret += "buzz" return ret or str(n) def fizzbuzz_test(f): if f(3) == "fizz" and f(5) == "buzz" and f(15) == "fizzbuzz": print("Success!") else: print("Nope. Try again.") fizzbuzz_test(fizzbuz...
seafoodfriedrice/thinkful-python
examples/fizzbuzz_unit_test.py
fizzbuzz_unit_test.py
py
323
python
en
code
0
github-code
36
32349305968
from pythonds.graphs import PriorityQueue, Graph, Vertex def prim(graph, source): pq = PriorityQueue() source.setDistance(0) total_weight = 0 for n in graph: n.setDistance(float('Inf')) n.setPred(None) pq.buildHeap([(n.getDistance(), n) for n in graph]) #(distance, node) while ...
bkim1/algorithms-bonus
src/prim.py
prim.py
py
979
python
en
code
0
github-code
36
70862456745
#! /usr/bin/env python3 import time import rospy from sensor_msgs.msg import LaserScan from geometry_msgs.msg import Twist from wallwalking.srv import FindWall, FindWallResponse class FindWallService(): move = Twist() value_front = int() minimum_position = int() def __init__(self): self.sub...
eugene-elk/ros-basics-rosject
src/find_wall_service_server.py
find_wall_service_server.py
py
2,561
python
en
code
0
github-code
36
26151403562
from player import Player from moves import Moves class Board(Moves): """ The Board class allows the players to setup the game by creating the necessary set of pieces needed for each player. It also extends the class Moves, in which all the allowed moves are calculated based on the current position of all the p...
marcialpuchi/Chess
board.py
board.py
py
1,289
python
en
code
0
github-code
36
2884996289
# coding:utf-8 # @Time : 2020/6/4 14:10 # @Author: Xiawang # Description: import time import pytest from api_script.open_lagou_com.resume import get_resume_list, get_online_resume, get_attachment_resume, get_contact, \ get_interview, get_obsolete from utils.util import assert_equal, assert_in @pytest.mark.incr...
Ariaxie-1985/aria
tests/test_open_api_lagou_com/test_resume.py
test_resume.py
py
2,896
python
en
code
0
github-code
36
10346867984
from PySide.QtGui import QLabel from EncoderTools import EncoderTools from GuiTools import CustomComboBox, CustomHFormLayout from FileAudio import FileAudio from Tools import CustomProcess class EncoderFLACTools(EncoderTools): """Provides Tools like Widgets, methods and objects for the FLAC encoder.""" def __...
gregsanz182/PyRus
src/EncoderFLACTools.py
EncoderFLACTools.py
py
3,935
python
en
code
0
github-code
36
23411369560
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('clientes', '0002_auto_20150927_2202'), ] operations = [ migrations.Cre...
pmmrpy/SIGB
clientes/migrations_2/0003_auto_20150928_0132.py
0003_auto_20150928_0132.py
py
1,491
python
en
code
0
github-code
36
33146570859
import csv import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.cross_validation import StratifiedKFold def training_and_testing(X_inputfile, Y_inputfile): ...
alexwaweru/MovieForests
training_and_testing_gross/training_and_testing.py
training_and_testing.py
py
1,124
python
en
code
0
github-code
36
32181630269
import sys import markdown import json import os import re from bs4 import BeautifulSoup # This is a WIP unused script to # write data back to the GSD database advisories_dir = sys.argv[1] gsd_dir = sys.argv[2] CVE_REGEX = r"CVE-\d{4}-\d{4,7}" FILE_FORMAT = "/Security-Updates-{version}.md" ADVISORY_URL = "https://git...
captn3m0/photon-os-advisories
update.py
update.py
py
3,376
python
en
code
0
github-code
36
35612628358
from flask import Flask, render_template, request from flask_wtf import FlaskForm from wtforms import StringField from wtforms.validators import DataRequired from datetime import datetime from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_security import Security, SQLAlchemyUserDatast...
gmldusdkwk/Big-Data
0727/app.py
app.py
py
5,629
python
en
code
0
github-code
36
36840712959
"""Unit tests for the resmokelib.testing.executor module.""" import logging import threading import unittest import mock from opentelemetry.context.context import Context from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing import job from buildscripts.resmokelib.testing import queue_eleme...
mongodb/mongo
buildscripts/tests/resmokelib/testing/test_job.py
test_job.py
py
13,936
python
en
code
24,670
github-code
36
29620255242
# Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html # useful for handling different item types with a single interface from itemadapter import ItemAdapter import time import codecs import json import o...
hua345/myBlog
python/scrapy/aiqichaDemo/aiqichaDemo/pipelines.py
pipelines.py
py
1,210
python
en
code
0
github-code
36
35883196632
from src.domain.complex import Complex import copy class ComplexServices: def __init__(self): self._stack = [[]] self._complex_numbers = [] ComplexServices.start_up(self) def add_number(self, a, b): """ :param a: the real part of the number we add :param b: the...
Cibu-Clara/University-Projects
Semester1/FP/A5/services/services.py
services.py
py
2,253
python
en
code
2
github-code
36
29965495383
#!/usr/bin/env python # import sys import logging import struct import serial from . import errors from . import fio from . import ops # import settings this as settings_module to avoid name conflicts from . import settings as settings_module logger = logging.getLogger(__name__) logger.addHandler(logging.StreamHan...
braingram/pysump
sump/interface.py
interface.py
py
10,286
python
en
code
1
github-code
36
10507224268
#! /mnt/NewDiskSim/stefano/stefano/CondaInstallation/envs/Experiments/bin/python import os import subprocess import sys import speech_recognition as sr import tensorflow as tf from spellchecker import SpellChecker import pyautogui # from utilities_sm import * # Definire la lista di comandi vocali predefiniti def op...
StefanoMuscat/SpeechRec
Main02.py
Main02.py
py
4,590
python
en
code
0
github-code
36
27102778456
from django.shortcuts import render import json from django.core import serializers from django.http import ( HttpResponse, HttpResponseRedirect, JsonResponse, ) from django.template import loader from django.core.urlresolvers import reverse_lazy from django.contrib.auth.decorators import login_required fro...
IvanVilla1585/RefrescosChupiFlum
ChupiFlum/materiaprima/views.py
views.py
py
5,202
python
en
code
1
github-code
36
7027004421
from cgitb import small from string import ascii_lowercase def createDict(brailleLetters, brailleKey): unicode = [ord(elem) for elem in [char for char in ascii_lowercase]] for key in unicode: for value in brailleLetters: brailleKey[key] = value brailleLetters.remove(value) ...
AllenNotAlan/googleFoobar
brailleSolution.py
brailleSolution.py
py
1,412
python
en
code
0
github-code
36
41649203624
from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render, get_object_or_404, Http404 from django.urls import reverse from app.models import Product, Cart, CartItem, Catego...
arash-ataei-solut/shop-practice
app/views.py
views.py
py
2,928
python
en
code
0
github-code
36
17106762661
import os import copy from typing import Set from collections import defaultdict inputPath = os.path.join(os.path.dirname(__file__), "input") with open(inputPath, "r") as inputFile: lines = [line.strip() for line in inputFile.readlines() if line.strip()] class Pos: def __init__(self, x: int, y: int, z: int...
mmmaxou/advent-of-code
2020/day-17/answer.py
answer.py
py
6,664
python
en
code
0
github-code
36
73881391462
import os from sklearn.feature_extraction.text import CountVectorizer from sklearn.ensemble import RandomForestClassifier import pandas as pd import nltk from KaggleWord2VecUtility import KaggleWord2VecUtilityClass from textblob import TextBlob # if __name__ == '__main__': # Read the data train = pd.read_csv(os.path.j...
Jacques-Ludik/SentimentAnalysis
main.py
main.py
py
3,702
python
en
code
0
github-code
36
6348823299
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. # Press the green button in the gutter to run the script. import requests import bs4 def get_document(url): req = re...
deblur99/getURLsFromBlogger
main.py
main.py
py
1,225
python
en
code
0
github-code
36
11369140618
from http import HTTPStatus from typing import Any import httpx from config import config class UserClient: def __init__(self, url: str): self.url = f'{url}/api/v1/users/' def registrate(self, username: str, tgid: int): users = {'username': username, 'tgid': tgid} response = httpx.p...
learn-python-sfnl/tgbot
tgbot/api.py
api.py
py
2,675
python
en
code
0
github-code
36