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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
28818465036 | from src.base.base_model import BaseModel
import tensorflow as tf
class DiscriminatorModel(BaseModel):
def __init__(self, config):
super().__init__(config)
self.is_training = None
self.x1 = None
self.x2 = None
self.y = None
self.train_step = None
self.saver... | JungleEngine/Intelligent_Frame_Skipping_Network | src/models/discriminator_model.py | discriminator_model.py | py | 5,002 | python | en | code | 0 | github-code | 1 |
10299512434 | # The root of a number is
# - the sum of its digit if it(the sum) is less than 10
# - the root of the sum of its digits otherwise.
# Let’s consider 78996. The sum of its digits is 39. Since it’s not less than 10, we have to find the root of 39.
# The sum of its digits is 12. Still not less than 10, so repeating again... | lusineduryan/ACA_Python | Basics/Homeworks/Homework_3/Exercies_1_root of number.py | Exercies_1_root of number.py | py | 664 | python | en | code | 1 | github-code | 1 |
10976806014 | import datetime
import calendar
import configparser
import os
class Utils:
@staticmethod
def get_business_date():
today = datetime.datetime.now()
if today.isoweekday() == 6 or today.isoweekday() == 7:
while today.isoweekday() == 6 or today.isoweekday() == 7:
one_day... | ZehanLi/Roboadvisor | src/Utils.py | Utils.py | py | 634 | python | en | code | 0 | github-code | 1 |
29309465531 | from io import BytesIO
import re
import sys
import requests
import img2pdf
import PyPDF4
from rich.console import Console
from rich.progress import track
console = Console()
INPUT_SESSION = console.input("🍪 Your '_reader_session' key: ")
ENDPOINT_SCUOLABOOK = "https://webapp.scuolabook.it/books"
HEADER = {'X-Reques... | alessionossa/Scuolabook-Downloader-2 | download.py | download.py | py | 5,967 | python | en | code | 13 | github-code | 1 |
71526899233 | # -*- coding: utf-8 -*-
"""{{ cookiecutter.repo_name }} URL Configuration
https://docs.djangoproject.com/en/1.8/topics/http/urls/
"""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.s... | athomasoriginal/starterkit-wagtail | {{cookiecutter.repo_name}}/src/config/urls.py | urls.py | py | 2,192 | python | en | code | 52 | github-code | 1 |
22918921227 | import zipfile
import os
import torchvision.transforms as transforms
# once the images are loaded, how do we pre-process them before being passed into the network
# by default, we resize the images to 64 x 64 in size
# and normalize them to mean = 0 and standard-deviation = 1 based on statistics collected from
# the ... | bastiendechamps/MVA_ORCV | A3_DECHAMPS_Bastien/data.py | data.py | py | 1,504 | python | en | code | 1 | github-code | 1 |
38420721323 | from django.contrib.auth.models import User
from django.db import models
class Location(models.Model):
name = models.CharField(max_length=255)
world = models.CharField(max_length=255)
description = models.TextField()
image = models.ImageField(upload_to='photos/')
author = models.ForeignKey(User, o... | asylburkitbayev/rickmorty | main/models.py | models.py | py | 1,656 | python | en | code | 0 | github-code | 1 |
644470377 | import aiohttp
import asyncio
import json
from . import errors
async def json_or_text(response):
text = await response.text(encoding="utf-8")
try:
if "application/json" in response.headers["Content-Type"]:
return json.loads(text)
except KeyError:
# Thanks Cloudflare
pa... | Snaptraks/aiotenor | aiotenor/http.py | http.py | py | 3,424 | python | en | code | 0 | github-code | 1 |
2666099432 | '''Functions used in river_tracker1.py
Author: guangzhi XU (xugzhi1987@gmail.com; guangzhi.xu@outlook.com)
Update time: 2019-05-10 11:03:36.
'''
from __future__ import print_function
import numpy as np
import pandas as pd
import networkx as nx
from skimage import measure
from skimage import morphology
from scipy impo... | Clynie/AR_tracker | river_tracker1_funcs.py | river_tracker1_funcs.py | py | 40,512 | python | en | code | null | github-code | 1 |
71491666593 | import os
import tensorflow as tf
import time
import numpy as np
import data_loader
import matplotlib.pyplot as plt
from tqdm import trange
class DNN:
"""DNN模型训练"""
def __init__(self, path=None, sheet_name="Sheet2",
save_model_path="./model/model-1/", batch_size=32,
learning... | xucong053/Fault-Classification | main.py | main.py | py | 10,108 | python | en | code | 5 | github-code | 1 |
21103763023 | from typing import Dict, List, Union, Tuple
from urllib.parse import urljoin
import requests
from PIL import Image
from bs4 import BeautifulSoup
from email_validator import validate_email, EmailNotValidError
from plan_ilan.data_mining.staff.lookup_parameters import StaffLookup, StaffLookupAnswer
from plan_ilan.apps.w... | matanm28/PlanIlan | plan_ilan/data_mining/staff/staff_crawler.py | staff_crawler.py | py | 4,615 | python | en | code | 0 | github-code | 1 |
28201890311 | import json
import logging
import os
import random
import re
import time
from datetime import datetime
import boto3
import requests
from dateutil import tz
from dateutil.parser import parse
from selectolax.parser import HTMLParser
from utils import headers
logger = logging.getLogger()
logger.setLevel(logging.INFO)
d... | miztch/sasha | functions/sasha/index.py | index.py | py | 5,239 | python | en | code | 0 | github-code | 1 |
39549222223 | import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from bs4 import BeautifulSoup
import csv
import random
linkas = input("Autopliuso masinu linkas: ")
def randomlaikas():
_sleep = random.randint(3,10)
time.sleep(_slee... | erikonasz/APliusTel | main.py | main.py | py | 2,286 | python | en | code | 0 | github-code | 1 |
24418281496 | import qiskit as qk
from qiskit import QuantumProgram
qp = QuantumProgram()
qr = qp.create_quantum_register('qr', 2)
cr = qp.create_classical_register('cr',2)
qc = qp.create_circuit('qc', [qr], [cr])
circuit = qp.get_circuit('qc')
quantum_r = qp.get_quantum_register('qr')
classical_r = qp.get_classical_register('cr')
... | zillerium/shoro | test1.py | test1.py | py | 697 | python | en | code | 0 | github-code | 1 |
37573481705 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 25 19:52:38 2021
@author: Eliu
"""
#pip install keyboard
import keyboard
from time import sleep
def free_fire(cx, cy, w):
res_x = 640
res_y = 480
time_release = 0.1
sleep(0.001)
no_move = w/3 #Divisor hace efecto en la sensibilidad
if cx>(r... | EliuPineda/FreeFire_Sensor | FreeSensor.py | FreeSensor.py | py | 1,438 | python | en | code | 0 | github-code | 1 |
7443437305 | import pandas as pd
from tqdm import tqdm
import utilities as ut
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
from sklearn.ensemb... | hilakatz/Extranodal-lymphoma-project | Extranodal_lymphoma_project.py | Extranodal_lymphoma_project.py | py | 13,919 | python | en | code | 0 | github-code | 1 |
13720433941 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 18 08:53:40 2020
@author: Mathew
"""
# These are the packages we are using.
from skimage.io import imread
import matplotlib.pyplot as plt
from skimage import filters,measure
image=imread("/Users/Mathew/Desktop/Axioscan/apt.tif")
# This is jus... | orie1876/axioscan | Quick_Anal.py | Quick_Anal.py | py | 2,970 | python | en | code | 0 | github-code | 1 |
26918149608 | # 20221122 - Python - Python OOP - Decorators
# Note 01 - Execution Time
import time
start = time.time()
time.sleep(3)
end = time.time()
print(f'The time between start and end is {end - start} seconds!')
| theterminal/python_04_python_oop_2022 | 20221122_20_E_Decorators/L20_Notes/L20_note_01.py | L20_note_01.py | py | 209 | python | en | code | 0 | github-code | 1 |
30564337002 | from pluginfiles import HelperLibrary
from pluginfiles.plugin import Plugin
import numpy as np
import math
import time
from PIL import Image, ImageFile
class LaplacianEdgeDetectionFilter(Plugin):
kernal = None
filteredImage = None
masksize = None
weight = None
img_data = None
def setkernal(se... | gatescn/imageProcessingApp | pluginfiles/LaplacianEdgeDetectionFilter.py | LaplacianEdgeDetectionFilter.py | py | 2,529 | python | en | code | 0 | github-code | 1 |
1527930933 | import logging
from metadrive.constants import Semantics
import math
from typing import List, Dict
from panda3d.bullet import BulletBoxShape, BulletGhostNode
from panda3d.core import Vec3, LQuaternionf, Vec4, TextureStage, RigidBodyCombiner, \
SamplerState, NodePath, Texture, Material
from metadrive.base_class.ba... | metadriverse/metadrive | metadrive/component/block/base_block.py | base_block.py | py | 15,032 | python | en | code | 471 | github-code | 1 |
27076133308 | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, BLOB, DateTime
base = declarative_base()
class ConfigNmap(base):
__tablename__ = 'config_nmap'
id = Column(Integer, primary_key=True)
property = Column(String(255), nullable=False)
value = Column(S... | Annihilat0r/JP-python | nmaper_jp/tables_config.py | tables_config.py | py | 842 | python | en | code | 0 | github-code | 1 |
72620362594 | import mcpi.minecraft as minecraft
import math
craft = minecraft.Minecraft.create()
cor = craft.player.getTilePos()
x=cor.x+2
y=cor.y
z=cor.z+2
# Создание модели зеркала (отражающей поверхности)
craft.setBlocks(x-5, y-1,z-5, x+10, y-1, z+5, 79)
# падающий луч света
for i in range(20):
y1 =... | Antipat/Physics_in_minecraft | Svet1.py | Svet1.py | py | 560 | python | ru | code | 1 | github-code | 1 |
17341574832 | from pathlib import Path
from experimaestro.compat import cached_property
import importlib
import os
import hashlib
import logging
import inspect
import json
from experimaestro.mkdocs.metaloader import Module
import pkg_resources
from typing import Iterable, Iterator, List, Dict
from .utils import CachedFile, downloadU... | experimaestro/datamaestro | src/datamaestro/context.py | context.py | py | 13,210 | python | en | code | 12 | github-code | 1 |
20146709528 | """
Author: Henry, henrylu518@gmail.com
Date: May 8, 2015
Problem: Valid Palindrome
Difficulty: Easy
Source: http://leetcode.com/onlinejudge#question_125
Notes:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a ... | henrylu518/LeetCode | Valid Palindrome.py | Valid Palindrome.py | py | 1,007 | python | en | code | 0 | github-code | 1 |
25885622776 | from pymongo import MongoClient
import requests
from watson_service import WatsonService
from data_service import DataService
def main():
data_service = DataService()
news_journals = data_service.get_known_online_news_journals()
news_journal_articles = []
for news_journal in news_journals:
... | Thaumat/AkashicRecords | gather-data.py | gather-data.py | py | 4,034 | python | en | code | 0 | github-code | 1 |
35577719590 | # Program for Connection Setup
# Depreciated
raise DeprecationWarning
import os
from Crypto.PublicKey import RSA
from Crypto import Random
import hashlib
from Crypto.Cipher import PKCS1_OAEP, AES
import select
from TSE import tse
from Flags import flags
from Chromos import Chromos
o = Chromos()
class Connection():... | devanshshukla99/Juno-ReDesign-Sockets-Communication | Connection/connection.py | connection.py | py | 6,157 | python | en | code | 0 | github-code | 1 |
16957265295 | # -*- encoding: UTF-8 -*-
##############################################################################
from openerp import fields, api
from openerp.addons.field_secure import models # @UnresolvedImport
import logging
_logger = logging.getLogger(__name__)
AVAILABLE_PRIORITIES = [
('0', 'Bad'),
('1', 'Below... | TinPlusIT05/tms | project/tms_modules/model/hr/hr_applicant.py | hr_applicant.py | py | 11,774 | python | en | code | 0 | github-code | 1 |
42426607543 | from collections import deque
n=int(input())
sea=[list(map(int,input().split())) for _ in range(n)]
d=[(1,0),(-1,0),(0,1),(0,-1)]
def bfs(q,shark):
global cnt
checklist=[]
checkpoint=n**2
while q:
x,y,t=q.popleft()
if t>checkpoint:
sea[shark[0]][shark[1]]=0
c... | jhchoy00/baekjoon | 16236.py | 16236.py | py | 1,349 | python | en | code | 0 | github-code | 1 |
20841732899 | from flask import Flask, jsonify, request, render_template
from datetime import datetime
from db import despesas, tipos_de_pagamento, categorias, Pagamento, Categoria
app = Flask(__name__)
# criar os tipos de pagamento // importada do banco de dados
# criar as categorias // importada do banco de dados
# pagina inici... | pachla/desafio-muralis | Muralis/app.py | app.py | py | 3,943 | python | pt | code | 0 | github-code | 1 |
71223308835 | # O(log(n))
# The guess API is already defined for you.
# @param num, your guess
# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0
# def guess(num: int) -> int:
class Solution:
def guessNumber(self, n: int) -> int:
start = 0
end = n + 1
while start < end:
... | ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck | problems/LC374.py | LC374.py | py | 592 | python | en | code | 0 | github-code | 1 |
73690461152 | """
This problem was asked by Facebook.
Given a list of integers, return the largest product that can be made by multiplying any three integers.
For example, if the list is [-10, -10, 5, 2], we should return 500, since that's -10 * -10 * 5.
You can assume the list has at least three integers.
"""
import nu... | bilgekisi96/My_Data_Science_Advanture | Great_Questions/Facebook_question.py | Facebook_question.py | py | 699 | python | en | code | 0 | github-code | 1 |
29300330214 |
# stanford_corenlp 所在的路径,绝对路径
stanford_corenlp = "D:\stanford-corenlp-full-2018-10-05"
expect_train_file_num = 287227
expect_test_file_num = 11490
expect_val_file_num = 13368
# 正常情况下,一个文件对应一个样本,但是有些文件中没有文章,或者没有摘要,就去掉了
expect_train_sample_num = 287113
expect_test_sample_num = 11490
expect_val_sample_num = 13368
... | hquzhuguofeng/New-Pointer-Generator-Networks-for-Summarization | point-generate-en/en_config.py | en_config.py | py | 725 | python | en | code | 17 | github-code | 1 |
5263649507 | MOD = 10 ** 9 + 7
def solve(N, A):
A.sort()
two = [0] * (N + 1)
for i in range(N + 1):
two[i] = 2 ** i
ans = 0
for i in range(N):
l = i
r = N-i-1
now = two[r]
if r != 0:
now += two[r-1] * r
now *= two[l]
now *= A[i]
ans +=... | KushibikiMashu/at-coder-try | AtCoder_Beginner_Contest/150/E.py | E.py | py | 681 | python | en | code | 0 | github-code | 1 |
24349070486 | from mxnet.gluon.data import dataset, DataLoader
import numpy as np
import mxnet.ndarray as ndarray
from utils.augmentations import *
class MyTransform:
def __init__(self, im, opts):
if opts.is_val:
transforms_list_idx = [0, 14, 1]
else:
transforms_list_idx = [0, ] + [opts.... | minhto2802/T2_ADC | ProstateSegmentation/utils/custom_dataset.py | custom_dataset.py | py | 3,802 | python | en | code | 0 | github-code | 1 |
33385668182 | import os
import random
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.datasets import load_iris, load_breast_cancer, load_wine, make_blobs
from sklearn.model_selection import train_test_split
project_dir = os.path.dirname(os.getcwd())
# This file describes utility functions for ... | WVLeeuw/BC_Unsupervised_FL | utils/data_utils.py | data_utils.py | py | 12,027 | python | en | code | 2 | github-code | 1 |
27950267715 | #coding:utf-8
import os
import codecs
import math
from operator import itemgetter
from deal_config import caption,domain,catlist,catnamelist,catnamedict,project
postdict={}
#该篇日志对应发表时间
tagdict={}
#该篇日志对应标签字符串
catdict={}
#该篇日志对应中文分类名称字符串
for catpage in catlist:
tmppage=codecs.open('./'+project+'/category/'+catpage+'... | Plumes/simple-blog | make_index.py | make_index.py | py | 2,982 | python | en | code | 0 | github-code | 1 |
16438824114 | # python3 통과
import sys
sys.stdin=open('../input.txt','r')
def BFS(now,fire):
cnt=0
while now:
new_fire=[]
new_now=[]
cnt+=1
for k in fire:
i,j=k
if i<h-1 and building[i+1][j]=='.':building[i+1][j]='*';new_fire.append((i+1,j))
if i>0 and buildi... | ttppggnnss/CodingNote | 2003/0325/boj 5427-5.py | boj 5427-5.py | py | 1,420 | python | en | code | 0 | github-code | 1 |
74246108192 | game_369 = ['3', '6', '9']
def game(number):
result = [0] * number
for i in range(1, number+1):
game_ct = 0
for num in str(i):
if num in game_369:
game_ct += 1
if game_ct == 0:
result[i - 1] = i
else:
result[i - 1] = '-' * game... | jinyoong/SWEA | problem/D2/1926. 간단한 369게임.py | 1926. 간단한 369게임.py | py | 375 | python | en | code | 0 | github-code | 1 |
14282248517 | from flask import Flask
from app.extensions import db, migrate, login_manager
from app.user import user
def create_app():
app = Flask(__name__)
app.config.from_pyfile('config.py')
db.init_app(app)
migrate.init_app(app, db)
login_manager.init_app(app)
app.register_blueprint(user, url_prefix='... | saviogodinho2002/Programacao-Web-Flask | app/__init__.py | __init__.py | py | 344 | python | en | code | 0 | github-code | 1 |
35840992661 |
# coding: utf-8
# In[1]:
import requests
import json
from pprint import pprint
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# In[2]:
def view_imdb_data_votes(season_number,episode_number):
url="http://www.omdbapi.com/?t="
season="&Season="+str(season_number)
episode="&Episo... | totopi/Retro-Fireballs | Nikki/IMdb+Requests+for+project (2).py | IMdb+Requests+for+project (2).py | py | 9,697 | python | en | code | 0 | github-code | 1 |
27939316545 | class Solution:
def letterCombinations(self, digits: str) -> List[str]:
if not digits:
return []
# Define mapping of digits to letters
mappings = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
... | yash-codes02/Leetcode-Solutions | Letter Combinations of a Phone Number.py | Letter Combinations of a Phone Number.py | py | 1,119 | python | en | code | 0 | github-code | 1 |
9795403739 | import pandas as pd
items = pd.read_csv('items.csv',sep = ',')
signup = pd.read_csv('signup.csv',sep = ',')
# 第一步连接两个表,默认内连接就可以
df = pd.merge(left = items,right = signup,on = 'item_id')
# 限定同时满足两个条件,注意item_name是javelin,题目里写错了多了一个n,坑死了!之前复制一直报错
df1 = df[(df['department'] == 'functional')&(df['item_name'] == 'j... | 081327/python-zhongji | niuke41.py | niuke41.py | py | 822 | python | zh | code | 0 | github-code | 1 |
5869163132 | """
power or exponential of a number base by another number exp is
obtained by recursively multiplying the same number base , exp number of times
"""
def power(base, exp):
# contraint case
assert isinstance(base,int) and base >= 0 and int(base) == base,f'Base {base} should be a positive integer'
assert isinstan... | gopinathrajamanickam/python_dsa | recursion/power_recur.py | power_recur.py | py | 804 | python | en | code | 0 | github-code | 1 |
69795468514 |
debug_flag=True
import base64
import hmac
import secrets
import time
import traceback
import flask
from Application.Api.UserContext import UserContext
from Application.Util.ParamsBinder import bind_optional_params, bind_params
from Application.Api.ApiError import ApiError
from Application.App import A... | byldocoder/VK-Clone | Application/Api/ApiImp/Audios.py | Audios.py | py | 8,336 | python | en | code | 0 | github-code | 1 |
40926512907 | #!/usr/bin/env python
import argparse
import os
import subprocess
def main():
# arguments
parser = argparse.ArgumentParser()
parser.add_argument('-top_dir', help='top level directory of chromo grouped mafs', required=True)
parser.add_argument('-ref', help='Reference species name', required=True)
... | henryjuho/sal_enhancers | genome_alignment/roast_fish.py | roast_fish.py | py | 1,545 | python | en | code | 1 | github-code | 1 |
74927988514 | from relati.types import RELATI_RECEIVER, RELATI_REPEATER
from relati_perf.actions import placePiece
from relati_perf.rules import isPlaceable, isRelatiPlaceable, reEnablePieces
def isPlaceableOrReceiver(grid):
return isPlaceable(grid) or grid.status == RELATI_RECEIVER
def getUnmergedPlaceableAreas(board):
... | fixiabis/relati-py | relati_perf/evaluations.py | evaluations.py | py | 6,130 | python | en | code | 1 | github-code | 1 |
32054311947 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0004_auto_20151210_1426'),
]
operations = [
migrations.AlterModelOptions(
name='region',
... | djangoplicity/djangoplicity-contacts | djangoplicity/contacts/migrations/0005_auto_20151214_1357.py | 0005_auto_20151214_1357.py | py | 647 | python | en | code | 0 | github-code | 1 |
14989070306 | # Import tensorflow library
# Reference it as tf for ease of calling
import tensorflow as tf
# Let's create two matrices, a 3x1 and another 1x3 matrix for multiplication
mat_a = tf.constant([[1., 3., 5.]], name='mat_a')
mat_b = tf.constant([[7.], [11.], [13.]], name='mat_b')
# Let's matrix multiply the two ma... | karthikmswamy/TFTutorials | TensorFlow_Tutorials/TF_Devices_Graphs_Sessions.py | TF_Devices_Graphs_Sessions.py | py | 1,246 | python | en | code | 51 | github-code | 1 |
1355144247 | #!/usr/bin/env python
"""
Measure phase ghosts by taking the ratio of the phase background to the frequency background.
"""
import sys
import nibabel
import argparse
import labels
import _utilities as util
import numpy
def nii_4d(in_nii):
pass
def cummean_nii(in_nii, scale=1, verbose=False):
# Read in NI... | kchawla-pi/tic_modules | ~archive/tools/cummean_nii.py | cummean_nii.py | py | 1,762 | python | en | code | 0 | github-code | 1 |
43764449457 | '''
date: 2019/10/28
path: ../数组/11....md
email: yiouejv@126.com
'''
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
# 题目的意思:两个数组元素的下标相减再乘以这两个数组元素的较小值。找出最大的值。
# 方法一:暴力遍历
# 求出所有的情况,取最大,
... | yiouejv/leetcode | leetcode/代码/11.py | 11.py | py | 1,502 | python | zh | code | 1 | github-code | 1 |
24613096759 | from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
MAN = "man"
WOMEN = "women"
SEX = [(MAN, MAN), (WOMEN, WOMEN)]
sex = models.CharField(max_length=6, choices=SEX, default=MAN)
class Meta:
verbose_name = "Пользователь"
verbo... | bazoy789/todolist | core/models.py | models.py | py | 408 | python | en | code | 0 | github-code | 1 |
33586487448 | import folium, pandas, ast
import json
# -*- coding: utf-8 -*-
locations_p = []
geos_p = []
files = 'tweets_#gopatriots.txt'
# get geo data only from rows with non-empty values
with open(files,'r') as ifile:
for line in ifile.readlines():
tweet = json.loads(line)
if tweet['tweet']['geo']... | qinyiyan/EE239AS | proj4/part6/map/map_patriot&hawks.py | map_patriot&hawks.py | py | 1,213 | python | en | code | 0 | github-code | 1 |
2675159524 | # Example factorial with use recursive
# Let us to take famous example the factorial.
def factorial(x):
if x == 1:
return 1
else:
return x * factorial(x - 1)
# call the function
factorial(5) # output >>> 120
| mohammadjadallah/recursive-and-some-problems | factorialrecursion.py | factorialrecursion.py | py | 226 | python | en | code | 6 | github-code | 1 |
24867904144 | '''
pg. 31
Merge(A, p, q, r)
n1 = q - p + 1
n2 = r - q
let L[1..n1 + 1] and R[1..n2+1] be new arrays
for i = 1 to n1
L[i] = A[p+i-1]
for j = 1 to n2
R[j] = A[q+j]
L[n1+1] = infinity
R[n2+1] = infinity
i = 1
j = 1
for k = p to r
if L[i] <= R[j]
A[k] = L[i]
i = i+1
else A[... | jonroby/grok | introductionToAlgorithms/lecture_3_merge_sort.py | lecture_3_merge_sort.py | py | 1,153 | python | en | code | 0 | github-code | 1 |
2109062302 | from foaflib.helpers.basehelper import BaseHelper
from foaflib.utils.activitystreamevent import ActivityStreamEvent
class Twitter(BaseHelper):
def __init__(self):
BaseHelper.__init__(self)
try:
import twitter
self.twitter = twitter
import time
self.t... | lmaurits/foaflib | foaflib/helpers/twitter_.py | twitter_.py | py | 1,365 | python | en | code | 0 | github-code | 1 |
898726482 | #coding=utf8
#author : veritas501
from pwn import *
_IO_FILE_plus_size = {
'i386':0x98,
'amd64':0xe0
}
_IO_FILE_plus = {
'i386':{
0x0:'_flags',
0x4:'_IO_read_ptr',
0x8:'_IO_read_end',
0xc:'_IO_read_base',
0x10:'_IO_write_base',
0x14:'_IO_write_ptr',
0x18:'_IO_write_end',
0x1c:'_IO_buf_base',
0x20... | Cossack9989/SEC_LEARNING | PWN/pwnable/pwnable.tw_250-seethefile/FILE.py | FILE.py | py | 2,812 | python | en | code | 13 | github-code | 1 |
10299579684 | # Type the name, age and height, so that the height number is 2 digits precised.
name = input()
age = int(input())
height = float(input())
height_format = '{:04.2f}'.format(height)
print(f"Hi, my name is {name}. My age is {age} and my height is {height_format}.")
print("Hi, my name is %s. My age is %d and my height... | lusineduryan/ACA_Python | Basics/Workshops/Workshop_2/Classwork_4_formating.py | Classwork_4_formating.py | py | 353 | python | en | code | 1 | github-code | 1 |
42320457538 | import h5py
import os
import shutil
import argparse
from genome import *
parser = argparse.ArgumentParser()
parser.add_argument("read_basedir", help="base directory of resquiggled fast5 files")
parser.add_argument("output_dir", help="directory to copy files to (must exist)")
parser.add_argument("reference", help="fast... | baklazan/thesis | filter_reads.py | filter_reads.py | py | 1,897 | python | en | code | 0 | github-code | 1 |
43337974242 | import numpy as np
import sys
def algo(s):
s = list(s)
convert_dict = {
'0': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
'a': 10,
'b': 11,
'c': 12,
'... | ruofan-he/pfn2021 | task1/code.py | code.py | py | 745 | python | en | code | 0 | github-code | 1 |
34634869215 | from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.utils.functional import cached_property
from database.utils import translate_doc
from database.models.data_collections.data_collections import Collection
@translate_doc
... | CONABIO-audio/irekua | irekua/database/models/users/users.py | users.py | py | 2,397 | python | en | code | 0 | github-code | 1 |
39206263192 | #!/bin/python3
__author__ = "Adam Karl"
"""Starting with 1 and moving out in a spiral, that is the sum of the diagonals in an N x N spiral"""
#https://projecteuler.net/problem=28
#NOTES
#top right of nxn is n**2
#bottom left of nxn is (n**2 + (n-2)**2)/2 This is also the average of top left, bot left, and bot right
#... | adamkkarl/ProjectEuler | 28/euler28.py | euler28.py | py | 810 | python | en | code | 0 | github-code | 1 |
29522459651 | # Activate
# |- Linear
# |- ReLU
# |- Sigmoid
# |- Softmax
# |- Tanh
# Regularize
# |- L2
# |- Dropout
# Initialize (variance)
# |- Constant
# |- He
# |- Xavier
# Optimize
# |- EMA
# |- RMSprop
# |- Adam
# Normalization/ standardization
# Grad checking
import numpy as np
... | Duckchoy/AI-algos | ANN/utils.py | utils.py | py | 13,448 | python | en | code | 0 | github-code | 1 |
19323504885 | """
Python3.6+ only
"""
import re
from pathlib import Path
from pie import *
class env(env):
@classmethod
def _parse_lines(cls,ls):
"""Parses lines and returns a dict."""
d={}
for i,l in enumerate(ls,1):
l=l.strip()
# skip blank lines and comments
... | bizcubed/intergov | pie_env_ext.py | pie_env_ext.py | py | 1,497 | python | en | code | 0 | github-code | 1 |
24013985334 | # Linked Lists (with a tail reference) + relevant primary methods
# Node Class
class Node:
def __init__(self, value = None):
self.value = value
self.next = None
# Method which returns the value of a node
# Time Complexity => O(1)
# Space Complexity => O(1)
def getValue(self):
... | Mahalinoro/python-ds-implementations | linked lists/singly_linked_list.py | singly_linked_list.py | py | 7,309 | python | en | code | 0 | github-code | 1 |
10926941572 | import sublime
import sublime_plugin
import re
class ReactExpanderAutocomplete(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
sn = view.scope_name(locations[0])
is_ok = False
if "meta.block.tsx" in sn or "meta.block.jsx" in sn:
is_ok = True
if not is_ok:
retur... | gebeto/python | ReactExpander.py | ReactExpander.py | py | 509 | python | en | code | 2 | github-code | 1 |
29343515477 | import common, sql
import os, json
import subprocess, shlex
from dateutil import parser as dt
import dateutil
import requests, json
import logging, coloredlogs
coloredlogs.install()
ecosystem = 'Composer'
from packaging import version as PythonVersion
def isValidVersion(v):
try:
v = PythonVersion.Version(v... | nasifimtiazohi/secrel | data_explore/composer.py | composer.py | py | 3,367 | python | en | code | 0 | github-code | 1 |
35575769245 | from selenium.webdriver.common.by import By
from behave import given, when, then
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
ADD_TO_CART = (By.CSS_SELECTOR, "button[type='submit'].product-form__submit.button.button--secondary")
ADD_TO_CART_CONFIRM = (By.CSS_SELECTOR, "h3.lab... | brightihegworo/internship--project | features/steps/product_page.py | product_page.py | py | 1,159 | python | en | code | 0 | github-code | 1 |
20488127015 | # 迪菲-赫尔曼密钥交换流程
import random
def eve(func):
def _func(*args):
ans = []
for i in args:
if type(i) == int:
ans.append(i)
print("eve knows", *ans)
return func(*args)
return _func
class Peer:
def __init__(self):
self.secret = -1
s... | mmooyyii/mmooyyii | codes/dhm.py | dhm.py | py | 1,033 | python | en | code | 10 | github-code | 1 |
1474225083 | # Install Python Packages
#!pip install openai tiktoken
# Import Python Packages
import platform
import os
import openai
import tiktoken
import time
print('Python: ', platform.python_version())
# Count the Number of Tokens
def count_tokens(filename):
encoding = tiktoken.get_encoding("gpt2")
with open(filenam... | rayborg/textSummarize_GPT | recursiveSummaryLongFiles.py | recursiveSummaryLongFiles.py | py | 5,974 | python | en | code | 0 | github-code | 1 |
4346085126 | # Author: Xinshuo Weng
# email: xinshuo.weng@gmail.com
import numpy as np, os, matplotlib.pyplot as plt, colorsys, random, matplotlib.patches as patches
import matplotlib.collections as plycollections
from matplotlib.patches import Ellipse
from skimage.measure import find_contours
# from scipy.stats import norm, chi2
... | xinshuoweng/Xinshuo_PyToolbox | xinshuo_visualization/geometry_vis.py | geometry_vis.py | py | 29,886 | python | en | code | 61 | github-code | 1 |
21104650721 | from flask import Flask
from flask_restful import Api
import logging as log
from api.config.apiconf import config
from api.views import VRStats,VRTopPlaces,\
VRClassifPlaces,VRClassifPlacesAccuracy,VRTop10Places
app = Flask(__name__)
ap = Api(app)
ap.add_resource(VRStats, '/api/stats')
ap.ad... | asiaat/mxresto | apirestful/main.py | main.py | py | 912 | python | en | code | 0 | github-code | 1 |
33721536282 | import os, signal, time
def traitant(s, _):
print("signal", s, "capté")
signal.signal(signal.SIGINT, traitant)
print(os.getpid())
#time.sleep(30)
signal.pause()
# signal.pause(): à la réception d'un signal: termine.
# time.sleep(n):
# - Python 3.4- : à la reception d'un signal: termine => on n'est jamais
# assu... | gando537/L2-Systeme-Python | TP/TP3/src_corr/sleep_pause.py | sleep_pause.py | py | 504 | python | fr | code | 0 | github-code | 1 |
671152388 | """ Documentation checker
A command-line tool for checking source code documentation requirements.
Authors:
- Ogunniyi Owamamwen
- Sheyla Norton
-
"""
from tictactoe import player_control, create_player_board, player_winner, player_draw, display_board, start_tictactoe
# The main function call other functions ... | snsb08/cse210-02 | tic-tac-toe/__main__.py | __main__.py | py | 890 | python | en | code | 0 | github-code | 1 |
1149116969 | from unittest.mock import MagicMock, patch
import torch.nn as nn
from mmcv.device.mlu import MLUDataParallel, MLUDistributedDataParallel
from mmcv.parallel import is_module_wrapper
from mmcv.utils import IS_MLU_AVAILABLE
def mock(*args, **kwargs):
pass
@patch('torch.distributed._broadcast_coalesced', mock)
@p... | rawalkhirodkar/egohumans | egohumans/external/mmcv/tests/test_device/test_mlu/test_mlu_parallel.py | test_mlu_parallel.py | py | 948 | python | en | code | 16 | github-code | 1 |
18151751727 | import torch
from src.test_statistics import *
from src.utils import get_W_matrix,KMM_weights_for_W_matrix
from sklearn.preprocessing import KBinsDiscretizer
from sklearn.base import clone
import numpy as np
import random
import math
def get_binned_weights(weights, n_bins):
binner = KBinsDiscretizer(n_bins=n_bins... | Jakefawkes/DR_distributional_test | src/test.py | test.py | py | 8,221 | python | en | code | 0 | github-code | 1 |
14351233649 | import requests, uuid, json, argparse, sys, os
import langcodes
def main():
# get credentials
credentials = get_Credentials()
key = credentials["key"]
endpoint = credentials["endpoint"]
location = credentials["location"]
# If program is run without any command-line arguments
if len(sys.arg... | SonuLohani-1/MyTranslator | functions.py | functions.py | py | 4,586 | python | en | code | 0 | github-code | 1 |
15828920588 | import numpy as np
import pandas as pd
from tabulate import tabulate
df = pd.read_excel('Database.xlsx')
df2 = pd.read_excel('Daftar Pickup.xlsx')
df_baru = df.dropna()
Harga = df_baru.drop('kode', axis =1)
Harga2 = df2.drop('No', axis =1)
#untuk fungsi cekKota dan ceKotaAsal, dilakukan pencarian apakah input ada di ... | yasminzulfa/22-TeamProject-Prokom | Modul.py | Modul.py | py | 3,063 | python | id | code | 0 | github-code | 1 |
43762004245 | import cv2
import numpy as np
import os
import uuid
import copy
def rotateImage(image, angle):
l = len(image.shape)
image_center = tuple(np.array(image.shape[:2]) / 2)
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2.warpAffine(image, rot_mat, image.shape[:2], flags=cv2.INTER_L... | DREAMS-lab/mask_rcnn_pytorch | ndarray_augmentor.py | ndarray_augmentor.py | py | 7,082 | python | en | code | 3 | github-code | 1 |
2422961087 | from odoo import fields, models, api, _
from odoo.exceptions import UserError
AUTO_INC_CHAR = '#'
class RefReferenceLine(models.Model):
""" Description """
_name = 'ref.reference.line'
_description = 'Reference line'
_rec_name = 'value'
_order = 'sequence'
reference_id = fields.Many2one(
... | decgroupe/odoo-addons-dec | product_reference/models/ref_reference_line.py | ref_reference_line.py | py | 1,717 | python | en | code | 2 | github-code | 1 |
41489295874 | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-01-17 19:53
import os
import tempfile
from typing import Iterable
import torch
from elit.utils.io_util import merge_files
from elit.utils.time_util import CountdownTimer
class FileCache(object):
def __init__(self, filename=None, delete=True) -> None:
... | emorynlp/seq2seq-corenlp | elit/common/cache.py | cache.py | py | 3,538 | python | en | code | 13 | github-code | 1 |
29480630063 | """
Digita endpoint.
You must declare environment variable DIGITA_URL to activate this plugin.
"""
import os
import json
import logging
import binascii
import dateutil
import pytz
from django.conf import settings
from django.conf.urls import url
from django.http import HttpResponse
from django.views.decorators.csrf ... | aapris/IoT-Web-Experiments | iotendpoints/endpoints/plugins/digita.py | digita.py | py | 9,963 | python | en | code | 1 | github-code | 1 |
38354447792 | '''module for building state machines to search through TokenSets'''
import re
from functools import reduce
from typing import List
import networkx as nx
from networkx.drawing.nx_agraph import to_agraph
import auto_types as T
import random
class Spec:
def __init__(self, name: str):
self.name = name
... | maxsun/SemanticScribe | AutoLang/automata.py | automata.py | py | 3,723 | python | en | code | 1 | github-code | 1 |
42617379561 | #!/usr/bin/python3
#-*- coding: utf-8 -*-
import math
print("Precalculating squares")
precalc = []
for i in range(0, 10000000):
s = str(i)
tmp = 0
for c in s:
tmp += int(c)**2
precalc.append(tmp)
print("Iterating")
at89 = 0
for i in range(2, 10000000):
if i % 100000 == 0:
print(i... | emilnorman/euler | problem092.py | problem092.py | py | 448 | python | en | code | 0 | github-code | 1 |
16626978852 | # -----------------------------------------------------------
#Cafedev.vn - Kênh thông tin IT hàng đầu Việt Nam
#@author cafedevn
#Contact: cafedevn@gmail.com
#Fanpage: https://www.facebook.com/cafedevn
#Group: https://www.facebook.com/groups/cafedev.vn/
#Instagram: https://instagram.com/cafedevn
#Twitter: https://twit... | Vantoancodegym/python_json_ex | 2 bt voi json/baitap doc json/read_json_file_thong_ke.py | read_json_file_thong_ke.py | py | 1,169 | python | en | code | 0 | github-code | 1 |
74913549472 | """"
Wrapper class for the FPDF.
Enables use of HTML.
@author Chase Fleming
4/23/17
"""
from fpdf import FPDF
from operator import itemgetter
title = "Participant Schedule"
def converter(interval):
times = {110.0: "10:00 am", 110.5: "10:30 am", 111.0: "11:00 am", 111.5: "11:30 am", 112.0: "12:00 pm",
... | cflemi12/NHFSchedule | sample/FPDFClass.py | FPDFClass.py | py | 3,708 | python | en | code | 0 | github-code | 1 |
18801031649 | import matplotlib.pyplot as plt
import numpy as np
import datetime
from dragen.utilities.InputInfo import RveInfo
from dragen.utilities.Helpers import HelperFunctions
class Tesselation3D(HelperFunctions):
def __init__(self, grains_df):
super().__init__()
self.grains_df = grains_df
self.a... | ibf-RWTH/DRAGen | dragen/generation/DiscreteTesselation3D.py | DiscreteTesselation3D.py | py | 9,700 | python | en | code | 10 | github-code | 1 |
19374789813 | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 11 15:32:52 2017
@author: Sidney
"""
with open('D:\ISTD\Term 6\Machine Learning\Project\EN\EN\\dev.in', 'r') as testSet:
testSetString = testSet.read()
print(testSetString)
#Part 2.3
#Aim: create a dictionary in the style of {entity: sentiments}
#Or add into an array;... | Sidney2408/SentimentAnalysis | Part2.3.py | Part2.3.py | py | 1,400 | python | en | code | 1 | github-code | 1 |
14437464114 | from django.shortcuts import render,redirect
from .forms import UserCreateForm,SignUpForm
from django.contrib.auth.forms import UserCreationForm,AuthenticationForm
from django.contrib.auth import login,logout
# Create your views here.
def signup_view(request):
#get 요청 시 HTML 응답
if request.method=='GET':
... | Heeville/likelion_backend_lecture | liongram/accounts/views.py | views.py | py | 1,642 | python | en | code | 0 | github-code | 1 |
12656420663 | from textblob import TextBlob
import nltk
#nltk.download("stopwords") ##3 downloadsa file of common stop words
# only do this once
from nltk.corpus import stopwords
from pathlib import Path
import pandas as pd
stops = stopwords.words("english")
blob= TextBlob("Today is a beautiful day") ### we are going to use a l... | ericakaze/NLP | nlp_3.py | nlp_3.py | py | 2,610 | python | en | code | 0 | github-code | 1 |
7681903193 | # 5 Даны два файла, в каждом из которых находится запись многочлена.
# Задача - сформировать файл, содержащий сумму многочленов.
# Открываем 2 наших записанных файла txt, выводим на печать
with open('D:\GB\PYTHON\Seminar4\HOMEWORK\\new_equation_k.txt', 'r') as filek:
second2 = filek.read()
with open('D:\GB\PYTHO... | Zabaluna/HW-Python | Seminar4/HOMEWORK/Task5HW.py | Task5HW.py | py | 2,238 | python | ru | code | 0 | github-code | 1 |
73709085154 | import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder, MinMaxScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegressionCV, LogisticRegression
from sklearn.model_selection import StratifiedKFold, RandomizedSearchCV
from sklearn.metrics i... | JuliCou/ML_3A_p2 | initial_predict.py | initial_predict.py | py | 15,151 | python | en | code | 0 | github-code | 1 |
72506235235 | # --------------------------------------------------------------------
# async.py
#
# Author: Lain Musgrove (lain.proliant@gmail.com)
# Date: Thursday February 16, 2023
#
# Distributed under terms of the MIT license.
# --------------------------------------------------------------------
import asyncio
import base64
im... | lainproliant/bivalve | bivalve/aio.py | aio.py | py | 9,490 | python | en | code | 1 | github-code | 1 |
72856173474 | import unittest
import itertools
from bisect import bisect
import operator
import sys
if sys .version_info >=(3 ,):
xrange =range
class LebesgueSet (object ):
_inf =float ('infinity')# can be tested with math.isinf()
_minf =-_inf
UNION ,INTER ,XOR =range (3 )
def __init__ (self ,points ,left_infinite =... | heathkh/iwct | snap/deluge/lebesgueset.py | lebesgueset.py | py | 7,673 | python | en | code | 5 | github-code | 1 |
74702175393 | from postgres import Postgres
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import json
import pandas
import os
import sys
from math import ceil
import argparse
parser = argparse.ArgumentParser()
# Run control arguments
parser.add_argument("--schema", type=str, help="The name of the schema", defaul... | carl24k/fight-churn | extras/metric-framework/py/metric_calc.py | metric_calc.py | py | 8,677 | python | en | code | 227 | github-code | 1 |
4607138870 | import tkinter as tk
import tkinter.ttk as ttk
from tkinter import filedialog
from PIL import Image, ImageTk, ImageFile
import subprocess
import os
import json
from constants import *
from logic import get_page_maps
ImageFile.LOAD_TRUNCATED_IMAGES = True
class ToolBar(tk.Frame):
def __init__(self, master, vars... | BigShuang/ra3-map-browser | board.py | board.py | py | 15,216 | python | en | code | 0 | github-code | 1 |
21889904761 | import os
import glob
import cv2 as cv
X_path = glob.glob(os.path.join('DiretorioEscolhido/NomePasta', '*'))
X = []
for f in X_path:
try:
cv.imwrite(f,cv.resize(cv.imread(f), (224, 224), interpolation=cv.INTER_AREA))
except:
print(f)
| GuilhermeNakahata/ResizeImage | main.py | main.py | py | 264 | python | en | code | 0 | github-code | 1 |
28415632337 | import copy
from collections import defaultdict
from game_board import GameBoard
########################################################################################################################
# PUBLIC INTERFACE
#################################################################################################... | gondsm/sudoku | solvers.py | solvers.py | py | 8,668 | python | en | code | 0 | github-code | 1 |
21057583879 | def helper(n, newDict) -> int:
sum = 0
temp = n
while n > 0:
sum += (n % 10) ** 2
n = n // 10
if temp not in newDict:
newDict[temp] = sum
if sum == 1:
return True
if sum in newDict:
return False
return helper(sum, newDict)
class Sol... | yashmantri20/Problem-Solving-Python | Two Pointers/isHappy.py | isHappy.py | py | 440 | python | en | code | 0 | github-code | 1 |
8092338015 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""BMP 室温気圧センサー."""
import logging
from datetime import datetime
import Adafruit_BMP.BMP085 as BMP085
from db import MongoDB
class Bmp(MongoDB):
"""BMP180 IO."""
def __init__(self):
"""イニシャライザ."""
super().__init__()
# センサー
sel... | akiraseto/airwatch | sensors/models/bmp.py | bmp.py | py | 1,152 | python | en | code | 0 | github-code | 1 |
25160202408 | import numpy as np
import plotly.offline as pyo
import plotly.graph_objs as go
np.random.seed(56)
# data
x_values = np.linspace(0,1,100)
y_values = np.random.randn(100)
# edited this to make a line chart
trace0 = go.Scatter(x=x_values, y=y_values+5,
mode='markers+lines',
... | eugeniosp3/udemy_plotly_course | linecharts_plotly.py | linecharts_plotly.py | py | 672 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.