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
28984377057
n = int(input()) start = 0 #지수 인덱스 end = int((2**63)**(0.5))+1 target = 0 while start <= end: mid = (start+end)//2 if n > mid**2: start = mid + 1 elif n <= mid**2: target = mid end = mid - 1 print(target)
youkyoungJung/solved_baekjoon
백준/Silver/2417. 정수 제곱근/정수 제곱근.py
정수 제곱근.py
py
265
python
en
code
0
github-code
36
31002250811
import numpy as np def apply_poly(poly, x, y, z): """ Evaluates a 3-variables polynom of degree 3 on a triplet of numbers. Args: poly: list of the 20 coefficients of the 3-variate degree 3 polynom, ordered following the RPC convention. x, y, z: triplet of floats. They may be num...
Kai-46/rpc_triangulation_solver
rpc_model.py
rpc_model.py
py
5,918
python
en
code
14
github-code
36
9288624612
# Given a string S, you need to remove all the duplicates. That means, the output string should contain each character only once. The respective order of characters should remain same, as in the input string. # Input format: # The first and only line of input contains a string, that denotes the value of S. # Output for...
sam-072/data-structure
hash map/remove dublicate.py
remove dublicate.py
py
818
python
en
code
1
github-code
36
38841107343
import re import random from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt import razorpay from django.db.models import Q from operator import itemgetter from django.core.paginator import Paginator import datetime from property_management_system.settings import razorpay_api_key, ra...
karan7864/property_management
pms/views.py
views.py
py
38,362
python
en
code
0
github-code
36
36478211178
from django import forms from ..models import Modelo class ModeloForm(forms.ModelForm): class Meta: model = Modelo fields = ["marca", "nombre"] def __init__(self, *args, **kwargs): super(ModeloForm, self).__init__(*args, **kwargs) for i, (fname, field) in enumerate(self.fields....
xcarlx/Venta
apps/producto/formstotal/modelo.py
modelo.py
py
390
python
en
code
0
github-code
36
16475137310
''' Cognitively Expanding The Game of Life Spring 2023 Term Project CS 6795 Intro to Cognitive Science Team - Swole Member - Scott Pickthorne Member - Zackary Clark-Williams This class is the data form for all the experiments tracking data. Information Currently Tracking: Average Cellurlar Life Sp...
Zclarkwilliams/DiseasedCognitiveGameOfLife
src/conclusion.py
conclusion.py
py
1,681
python
en
code
1
github-code
36
2881063504
import glob import numpy as np from get_c_point import Point, Final_point class File_Parser: """Create an object from datas that is a list of Points objects from the different files fed to it. Attributes: file_names (list): List of the files used to generate datas. list_of_points (list):...
Elesh-Norn/ELISA_QC
Extract_data.py
Extract_data.py
py
3,569
python
en
code
null
github-code
36
70539338983
from intrinsic_types import intrinsic_types, is_float from bitstring import Bits, BitArray import random from tempfile import NamedTemporaryFile import os import subprocess from interp import interpret from compiler import compile from bit_util import * import math import z3 import functools import operator from spec_s...
ychen306/upgraded-succotash
fuzzer.py
fuzzer.py
py
12,802
python
en
code
0
github-code
36
33938514931
import pytest from schema import cities async def test_database(sqlite_database): tables_query = "SELECT * FROM sqlite_master where type='table';" tables = await sqlite_database.fetch_all(query=tables_query) assert len(tables) != 0 city_query = cities.insert( values={"name": 'London', ...
roman808080/route_planner
tests/test_db_manager.py
test_db_manager.py
py
497
python
en
code
0
github-code
36
37457505741
def circle(r): #calculate area of circle s=3.14*r**2 return s def rectangle(length,width): #calculate area of rectangle s=length*width return s def square(side): #calculate area of square s=side**2 return s def triangle(base,height): #calculate area of triangle ...
matinntb/project1
soal 1.py
soal 1.py
py
1,354
python
en
code
0
github-code
36
28613380166
#!/usr/bin/env python #Author velociraptor Genjix <aphidia@hotmail.com> from PySide.QtGui import * from PySide.QtCore import * class LightWidget(QWidget): def __init__(self, colour): super(LightWidget, self).__init__() self.colour = colour self.onVal = False def isOn(self): ret...
pyside/Examples
examples/state-machine/trafficlight.py
trafficlight.py
py
3,483
python
en
code
357
github-code
36
34993761644
#!/usr/bin/env python3 # 深さ優先検索 def walk(f, x, y): # 10*10 のマップ範囲外に出るな!!!!!!禁じられた森に入ってはならん!!! if not (0 <= x < 10 > y >= 0): return i = y * 10 + x # 海歩くな!!!!!!!!! if f[i] == "x": return # 歩いた所を海に書き換えておこ f[i] = "x" # x, y の上下左右を歩いてみよ # 陸続きなら進むけどそうじゃないんだったらそこで止まるで ...
mpses/AtCoder
Contest/ARC031/b/main.py
main.py
py
1,076
python
ja
code
0
github-code
36
5993595252
class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: counter = defaultdict(int) for num in nums: counter[num] += 1 freq = [[] for i in range(len(nums) + 1)] for key, val in counter.items(): freq[val].append(key) result = [] ...
alexneysis/leetcode
347-top-k-frequent-elements/347-top-k-frequent-elements.py
347-top-k-frequent-elements.py
py
479
python
en
code
0
github-code
36
9588266467
import unittest from tests import PluginTest from plugins.basketball import basketball from mock import patch, call import requests import datetime from packages.memory.memory import Memory class BasketballTest(PluginTest): """ Tests For Basketball Plugin !!! test will be executed only if user has added h...
sukeesh/Jarvis
jarviscli/tests/test_basketball.py
test_basketball.py
py
2,571
python
en
code
2,765
github-code
36
7919024721
from __future__ import division import geojson from helper import load_geom, degrees_to_radians, get_coord, PRECISION from math import pow, sqrt, pi, tan, cos, sin from measurement import rhumb_destination from transformation import transform_rotate def ellipse(center, x_semi_axis, y_semi_axis, options={}): steps...
CartoDB/analytics-toolbox-core
clouds/redshift/libraries/python/lib/constructors/ellipse/__init__.py
__init__.py
py
3,027
python
en
code
181
github-code
36
6797122561
import logging import requests from django.urls import reverse from django.conf import settings from django.core.mail import get_connection from django.core.mail.backends.base import BaseEmailBackend from .engine import send_email from mail.models import Message logger = logging.getLogger('mails') def get_admins(...
tomasgarzon/exo-services
service-exo-mail/mail/backend.py
backend.py
py
2,657
python
en
code
0
github-code
36
15618824234
#!/usr/bin/env python3 import argparse from datetime import datetime import json import os import sys import time import uuid from aiosmtpd.controller import Controller import mailparser DATA_PATH = 'messages' class Handler(object): # noinspection PyPep8Naming,PyMethodMayBeStatic async def handle_DATA(self...
OPSnet/PostOffice
smtpd.py
smtpd.py
py
1,929
python
en
code
1
github-code
36
8346930934
import os import random import tempfile from copy import copy from functools import partial from multiprocessing import cpu_count import pickle import numpy as np import tensorflow as tf from joblib import Parallel, delayed from .tokenization import printable_text from .utils import (BOS_TOKEN, EOS_TOKEN, add_special...
hauwenc/bert-multitask-learning
bert_multitask_learning/create_generators.py
create_generators.py
py
20,858
python
en
code
null
github-code
36
21891037955
import json import logging import traceback from django.views import View from django.http import JsonResponse from backend.models import AnnotationCategory, Video # from django.core.exceptions import BadRequest class AnnoatationCategoryCreate(View): def post(self, request): try: if not requ...
TIBHannover/tibava-backend
backend/views/annotation_category.py
annotation_category.py
py
2,854
python
en
code
0
github-code
36
32331024727
#!/usr/bin/python3 """Contains a class named Base""" import json class Base: """Class named Base""" __nb_objects = 0 def __init__(self, id=None): """initialize Base class""" if id is None: Base.__nb_objects += 1 self.id = Base.__nb_objects else: ...
ammartica/holbertonschool-higher_level_programming
0x0C-python-almost_a_circle/models/base.py
base.py
py
1,956
python
en
code
0
github-code
36
74146205863
from flair.data import Sentence from flair.models import SequenceTagger from flair.embeddings import (DocumentPoolEmbeddings, FlairEmbeddings, StackedEmbeddings) from torch import dot, norm, squeeze from pathlib import Path import pickle from odm.nlp.tensors import PCA, plot_embeddings...
ixxie/odm
src/odm/nlp/model.py
model.py
py
2,615
python
en
code
0
github-code
36
34983429354
#!/usr/bin/env python3 # 2次元累積和 S の [x1, x2) × [y1, y2) 総和 def ac2(s, x1, x2, y1, y2): return s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1] import numpy as np _, *d = open(0) n, k = map(int, _.split()) B = np.zeros((2*k, 2*k)) for e in d: *z, c = e.split() x, y = map(int, z) B[x % (2*k)][(y + k * (z ==...
mpses/AtCoder
Contest/ABC086/d/main.py
main.py
py
441
python
en
code
0
github-code
36
13509904582
#!/usr/bin/env python # -*- coding: utf-8 -*- """Resize and add text to videos Usage example: $ python transform.py """ import random import os import shutil from moviepy.editor import * from moviepy.video.tools.subtitles import SubtitlesClip from sqlite import * class VideoTransform: def __init__(self, video...
miguel-faggioni/zap-bot
transform.py
transform.py
py
4,335
python
en
code
0
github-code
36
8415334938
#!/usr/bin/python3 """This is a module for the island func """ def island_perimeter(grid): """This is a function that returns perimeter of the island: traverse the grid to find a 1 and then check all four directions """ peri = 0 xrows = grid if grid != []: ycols = grid[0] ...
logicalperson0/alx-low_level_programming
0x1C-makefiles/5-island_perimeter.py
5-island_perimeter.py
py
918
python
en
code
0
github-code
36
5340113648
from globals import * class MainHandler(webocrat_Request): @need_registered_user def get(self): template_vals = {} self.render_simple_template('HomePage.django.html', template_vals) class HartaCainilorHandler(webocrat_Request): # @need_registered_user def get(self): template...
webocrat/webocrat
py/main.py
main.py
py
1,451
python
en
code
1
github-code
36
36182217190
import os _basedir = os.path.abspath(os.path.dirname(__file__)) DEBUG = True ADMINS = frozenset(['volodymyr.dehtiarenko@gmail.com']) SECRET_KEY = 'This string will be replaced with a proper key in production.' SQLALCHEMY_ECHO = True SQLALCHEMY_DATABASE_URI = "mysql+pymysql://admin:12345@localhost/24servis" SQLALC...
volodymyr-dehtiarenko/webservis
config.py
config.py
py
428
python
en
code
0
github-code
36
35614129449
import msgpack import redis import click import socket import pandas as pd import numpy as np import ujson as json #Extra Functions (for enrichment purpose) df_port_name = pd.read_csv('enrichments/port_name.txt',delimiter=",", names=['port_num','port_name']) df_ip_proto_name = pd.read_csv('enrichments/ip_proto_name.tx...
jdcc2/ddoshackathon
packet_patterns.py
packet_patterns.py
py
17,497
python
en
code
0
github-code
36
18735221514
import scrapy from module.items import HotlineItem class HotlineSpider(scrapy.Spider): name = "hotline" allowed_domains = ["hotline.ua"] start_urls = [f"https://hotline.ua/ua/bt/holodilniki/?p={page}" for page in range(1, 4)] def parse(self, response): catalog = response.xpath('//div[contains...
Ivan7281/Lab-Data-Scraping
Lab7/module/spiders/hotline.py
hotline.py
py
1,258
python
en
code
0
github-code
36
70307229865
import os import requests import json from requests_oauthlib import OAuth1 from dotenv import load_dotenv load_dotenv() CONSUMER_KEY = os.getenv("TWITTER_API_KEY") CONSUMER_SECRET = os.getenv("TWITTER_API_SECRET") ACCESS_TOKEN = os.getenv("TWITTER_ACCESS_TOKEN") ACCESS_TOKEN_SECRET = os.getenv("TWITTER_ACCESS_TOKEN_...
homeGrownCheese/tweet_waka_daily
tweet_stats.py
tweet_stats.py
py
2,688
python
en
code
1
github-code
36
5102702223
"""fask_dj URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') ...
ZompaSenior/fask
fask/src/fask_dj/task/urls.py
urls.py
py
1,085
python
en
code
0
github-code
36
6377162291
from django.db import models import uuid class apiKeys(models.Model): id = models.CharField(max_length=200, null=False, blank=False) key = models.TextField(primary_key=True, default=uuid.uuid4().hex) def __unicode__(self): return self.id class ButtonTable(models.Model): SKRANKE = 0 TELE...
OrakeltjenestenDragvoll/nix
apps/bujumbura/models.py
models.py
py
837
python
en
code
0
github-code
36
20869182211
# coding: utf-8 """ Django settings for testproject project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.jo...
sbaechler/django-multilingual-search
tests/testproject/settings.py
settings.py
py
3,166
python
en
code
21
github-code
36
7551769686
from web3 import Web3, EthereumTesterProvider from etherscan import Etherscan import json class Node: def __init__(self, name, value, address, children=[]): self.name = name self.value = value self.children = children self.searched = False self.address = Web3.toChecksumAddr...
DoominEth/Web3DataSandbox
ContractCompossitionNode.py
ContractCompossitionNode.py
py
3,793
python
en
code
0
github-code
36
7805399024
from Epulet import Epulet epuletek = [] def beolvas(fajlnev): fajl = open(fajlnev, "r", encoding="utf-8") fajl.readline() sorok = fajl.readlines() fajl.close() i = 0 while i < len(sorok): sor = sorok[i].strip().split("$") epulet = Epulet(sor) epuletek.append(epulet) ...
szludora/Szlucska_202302_epuletek
epuletek.py
epuletek.py
py
854
python
hu
code
0
github-code
36
74540930982
# -*- coding: utf-8 -*- from enum import Enum class SolarTerms(Enum): the_beginning_of_spring = "the Beginning of Spring", "立春" rain_water = "Rain Water", "雨水" the_waking_of_insects = "the Waking of Insects", "惊蛰" the_spring_equinox = "the Spring Equinox", "春分" pure_brightness = "Pure Brightness",...
LKI/chinese-calendar
chinese_calendar/solar_terms.py
solar_terms.py
py
4,541
python
en
code
866
github-code
36
17299275140
from django.shortcuts import render, get_object_or_404 from .models import Post, Comment from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from .forms import CommentForm from django.views.decorators.http import require_POST from taggit.models import Tag """ This is the Count aggregation function ...
m-abdelgawad/automagic-developer-django-postgres-docker-compose-stack
automagic-website/blog/views.py
views.py
py
4,620
python
en
code
0
github-code
36
12185429190
# Creating a regression line - aka line of best fit # Y = mx + b from statistics import mean import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use('fivethirtyeight') # defined as numpy arrays xs = np.array([1,2,3,4,5,6], dtype=np.float64) ys = np.array([5,4,6,5,6,7], dtype=np...
Wcdunn3/pythonProjects
MachineLearning/MlLesson9LineFit.py
MlLesson9LineFit.py
py
790
python
en
code
0
github-code
36
15836281042
with open("day3/input.txt") as f: s = 0 for l in f: comp1, comp2 = l[:int(len(l)/2)], l[int(len(l)/2):] common = list(set(comp1).intersection(set(comp2))) val = ord(common[0]) - 38 if common[0].isupper() else ord(common[0]) - 96 s += val print(s) with open("day3/input.txt") ...
jaroddurkin/adventofcode2022
day3/main.py
main.py
py
684
python
en
code
0
github-code
36
19866269667
import numpy as np #=========================# # refine the distribution # #=========================# def refine_distribution(old_mugrid, old_mumid, old_dist, target_resolution): # store moments for comparison old_nmu = len(old_mumid) old_edens = np.sum(old_dist , axis=(1,2,3)) old_flux ...
srichers/neutrino_linear_stability
discrete_ordinates.py
discrete_ordinates.py
py
2,433
python
en
code
3
github-code
36
25300892806
import colorsys import struct import math from pyatem.hexdump import hexdump class FieldBase: def _get_string(self, raw): return raw.split(b'\x00')[0].decode() def make_packet(self): header = struct.pack('!H2x 4s', len(self.raw) + 8, self.__class__.CODE.encode()) return header + self...
seanmichnowski/CalvaryVenturaBroadcast
docs/AtemStatuses.py
AtemStatuses.py
py
108,948
python
en
code
1
github-code
36
23565614159
#!/usr/bin/python3 import sys import pyvips im = pyvips.Image.new_from_file(sys.argv[1], access="sequential") text = pyvips.Image.text(f"<span color=\"red\">{sys.argv[3]}</span>", width=500, dpi=100, align="centre", r...
libvips/pyvips
examples/watermark.py
watermark.py
py
945
python
en
code
558
github-code
36
8024534491
""" Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once. For example, Given ``` board = [ ["ABCE"], ...
cyandterry/Python-Study
Ninja/Leetcode/79_Word_Search.py
79_Word_Search.py
py
1,760
python
en
code
62
github-code
36
20336422398
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.6.2) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x00\xcc\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x40\x0...
NIRVANALAN/TU_rcm
resources.py
resources.py
py
612,926
python
ja
code
2
github-code
36
35478168713
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import argparse import codecs import sys import openapc_toolkit as oat ARG_HELP_STRINGS = { "csv_file": "The csv file where rows should be reordered", "column": "The numerical index of the column to be used as sorting key", "encoding": "The encoding of the C...
OpenAPC/openapc-de
python/csv_row_reorder.py
csv_row_reorder.py
py
6,006
python
en
code
114
github-code
36
5029822148
""" Tuplas- Diferença entre elas e listas é q elas não são modificaveis """ t1 = 1, 3, 4, 5 t2 = 2, 5, 7527, 27, 5 t3 = t1 + t2 print(type(t1)) print(type(t2)) print(t3) t1 = list(t1) t1[2] = 2 t1 = tuple(t1) print(t1, type(t1))
hdtorrad/Estudos-Python3
Aulas & Desafios/Aula020-Tuplas e dicionarios/Tuplas.py
Tuplas.py
py
235
python
pt
code
1
github-code
36
24770123438
#!/usr/bin/python3 import requests # pip3 install requests import sys from lxml import etree # pip3 install lxml import re class Item: category = '' detName = '' detDesc = '' link = '' def __init__(self, category, detName, detDesc, link): self.category = category self.detName = det...
echcz/sak
piratebay-cli.py
piratebay-cli.py
py
10,776
python
en
code
2
github-code
36
34087877175
data = [int(x) for x in open('input.txt').read().split(',')] jump = {1:4, 2:4, 3:2, 4:2} i = 0 while data[i] != 99: opcode = '{:0>4}'.format(data[i]) op = int(opcode[2:]) if op == 1: v1 = (data[data[i+1]] if int(opcode[1]) == 0 else data[i+1]) v2 = (data[data[i+2]] if int(opcode[0]) == 0 e...
ajclarkin/AdventofCode2019
day05/opcode.py
opcode.py
py
848
python
en
code
2
github-code
36
74297991462
from collections import defaultdict from itertools import product, chain class Rule: def __init__(self, registry): self.registry = registry self.or_rules = [] self._generated = None def __iter__(self): for r in self.value: yield r def parse_rule(self, rule): ...
maarten-dp/adventofcode2020
solvers/day19.py
day19.py
py
2,835
python
en
code
2
github-code
36
72225859944
#!/usr/bin/python3 """Tests for 'State' class that inherits from 'BaseModel' with unittest module""" import unittest import models from models.base_model import BaseModel from models.state import State class TestUser(unittest.TestCase): """Testing our methods of 'BaseModel' for 'State'""" def test_doc_modul...
DevPacho/holbertonschool-AirBnB_clone
tests/test_models/test_state.py
test_state.py
py
1,517
python
en
code
0
github-code
36
22143984130
from art import logo def greet(name, location, time): print(f"Hi {name} from {location}. Good {time}.") print(f"Hey {name} from {location}. Good {time}.") print(f"Hello {name} from {location}. Good {time}.") #greet("Angela", location="London", time="evening") def caeser(direction, text, shift): caeser_text ...
tarunchandel/python-ceaser-cipher
main.py
main.py
py
1,367
python
en
code
0
github-code
36
16746507107
import os import sys import gensim import smart_open import collections import random import json import os.path from gensim.models.doc2vec import Doc2Vec, TaggedDocument from gensim.test.utils import get_tmpfile import time from corpus_indexer import CorpusIndexer class CorpusModeler: def __init__(self, model_nam...
kcculhwch/prayer2vec
build/scripts/corpus_modeler.py
corpus_modeler.py
py
5,038
python
en
code
0
github-code
36
24192841460
import requests def check_security_headers(url): headers_to_check = [ 'Strict-Transport-Security', 'Content-Security-Policy', 'X-Content-Type-Options', 'X-Frame-Options', 'X-XSS-Protection', 'Referrer-Policy', 'Permissions-Policy' ] missing_headers =...
hexodotsh/WebSite_Header_Scanner
headers-security-check.py
headers-security-check.py
py
999
python
en
code
0
github-code
36
4242736127
from .__init__ import * def gen_func(maxBase=3, maxVal=8, format='string'): a = random.randint(1, maxVal) b = random.randint(2, maxBase) c = pow(b, a) if format == 'string': problem = "log" + str(b) + "(" + str(c) + ")" solution = str(a) return problem, solution elif forma...
KrishayR/academix
venv/lib/python3.8/site-packages/mathgenerator/funcs/algebra/log.py
log.py
py
577
python
en
code
1
github-code
36
14144674644
import numpy as np from PIL import Image import torch class GenericDataset: def __init__(self): self.patch_width = None self.image_height = None def add(self, dataset): return SummedDataset(self, dataset) def resize_image(self, image): original_width, original_height = i...
EauDeData/oda_ocr
src/dataloaders/summed_dataloader.py
summed_dataloader.py
py
6,678
python
en
code
0
github-code
36
21017643306
class Solution: def addStrings(self, num1: str, num2: str) -> str: res = [] carry = 0 n1 = len(num1) - 1 n2 = len(num2) - 1 while n1 >= 0 or n2 >= 0: x1 = ord(num1[n1]) - ord('0') if n1 >= 0 else 0 x2 = ord(num2[n2]) - ord('0') if n2 >= 0 els...
EveChen/Leetcode_Practice
415_add-strings/solution1.py
solution1.py
py
644
python
en
code
2
github-code
36
1252994742
class UncommonWordsfromTwoSentences(object): def uncommonFromSentences(self, A, B): count = {} for word in A.split(): count[word] = count.get(word, 0) + 1 for word in B.split(): count[word] = count.get(word, 0) + 1 # Alternatively: # count = collectio...
lyk4411/untitled
beginPython/leetcode/UncommonWordsfromTwoSentences.py
UncommonWordsfromTwoSentences.py
py
676
python
en
code
0
github-code
36
30872218901
# -*- coding: utf-8 -*- # from rest_framework.generics import ListAPIView, CreateAPIView, UpdateAPIView, RetrieveAPIView, DestroyAPIView # from django.shortcuts import render # from django.views import View # from rest_framework.views import APIView from rest_framework.authentication import BasicAuthentication, Session...
ietar/huluobei
book_drf/views2.py
views2.py
py
4,527
python
en
code
0
github-code
36
36748155431
from collections import OrderedDict from fudge.index import Index, read_index, write_index from fudge.object import Object, load_object, store_object from fudge.parsing.builder import Builder from fudge.parsing.parser import Parser from fudge.utils import FudgeException class Node(object): def __init__(self, nam...
QuantamKawts/fudge
fudge/tree.py
tree.py
py
3,926
python
en
code
0
github-code
36
24428229816
import numpy as np import matplotlib.pyplot as plt import random class Tuihuo: path = [] def __init__(self, graph, num, value=0): # 初始化类 self.num = num self.graph = graph self.value = 0 def output_graph(self): # 输出初始图 for i in self.graph: for j in i: ...
blue-vegetable/AI_TSP_HOMEWORK
SA.py
SA.py
py
3,558
python
en
code
0
github-code
36
6255434476
# write a program that takes your full name as input and displays the abbreviations of the first and # middle names except the last name whitch is displayed as it is. # for example, if yoy name is Robert Brett Roser, then the output should be R.B.Roser fullName = input("Ingresa tu nombre: ").split(" ") nombre = full...
yonch100/python
ProyectoJavi/Ejercicio21_apellido.py
Ejercicio21_apellido.py
py
472
python
en
code
0
github-code
36
70177206504
# Understanding how computers work with binary currents with bitwise operations AND how arithmatic operations work on that, by developing a calculator that can do the same. # What is binary numbers? => 0 and 1, they are simply like a switch, either on or off, 1 or 0. # What is a bit? => A bit is a single binary digi...
krishna-kush/Bit-Calculator
bit-calculator.py
bit-calculator.py
py
10,410
python
en
code
0
github-code
36
69904854506
from flask import Flask, request, jsonify from config import Config from flask_cors import CORS, cross_origin from database import db def create_app(config_class=Config): app = Flask(__name__) app.config.from_object(config_class) app.config['CORS_HEADERS'] = 'Content-Type' db.init_app(app) # imp...
danme-l/website-v2-backend
app.py
app.py
py
1,479
python
en
code
0
github-code
36
39941333480
z=0.00 cant=input() l1=[] l2=[] def masa(p,h): z = float(p) / float(h)**2 return z for i in range(0,int(cant)): x=0.00 adata=input() p,h=adata.split(" ") x=masa(p,h) if x>=30.0: y="obese" elif x<30.0 and x>=25.0: y="over" elif x<25 and x>=18.5: y="normal" else: y="under" l2.append(y) print (*l2)
carloscondore/python-codeabbey
python/028/condoreca.py
condoreca.py
py
317
python
en
code
1
github-code
36
6357753937
import pandas as pd import functions as fn import numpy as np #USDMXN = fn.descarga_data(["USDMXN"])['USDMXN'] #USDMXN_train = USDMXN[(USDMXN['time'] >= '2020-01-01') & (USDMXN['time'] <='2021-01-01')] #USDMXN_test = USDMXN[(USDMXN['time'] >= '2021-02-01') & (USDMXN['time'] <='2022-02-01')] #EURUSD = fn. descarga_d...
andres1999iteso/ProyectoFinal
data.py
data.py
py
5,597
python
es
code
0
github-code
36
18338901118
import os import wave import numpy as np import calRMSE import dsp import pylab as pl import scipy.signal as signal import numpy as np import cv2 import matplotlib.pyplot as plt import scipy from scipy.fftpack import fft from scipy.io import wavfile as wav from scipy import signal as sig from scipy.signal import window...
wzt1512978386/Surtify
app/src/main/python/DataPreprocessing2.py
DataPreprocessing2.py
py
12,746
python
en
code
1
github-code
36
40660876105
# -*- coding:utf-8 -*- import os import sys import time import tensorflow as tf import seq2seqModel import getConfig import io gConfig = {} gConfig=getConfig.get_config(config_file='seq2seq.ini') vocab_inp_size = gConfig['enc_vocab_size'] vocab_tar_size = gConfig['dec_vocab_size'] embedding_dim=gConfig['embedding_di...
zhangzhiqiangccm/NLP-project
chineseChatbotWeb/execute.py
execute.py
py
4,645
python
en
code
120
github-code
36
18034729277
class Solution: def minDifficulty(self, A: List[int], d: int) -> int: n = len(A) dp = [[float('inf')] * n + [0] for _ in range(d+1)] for d in range(1, d+1): for i in range(n-d+1): maxd = 0 for j in range(i, n-d+1): maxd = max(ma...
LittleCrazyDog/LeetCode
1335-minimum-difficulty-of-a-job-schedule/1335-minimum-difficulty-of-a-job-schedule.py
1335-minimum-difficulty-of-a-job-schedule.py
py
454
python
en
code
2
github-code
36
37338865985
from distutils.core import setup import os.path import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="python_obfuscator", packages=setuptools.find_packages(), version="0.0.2", license="MIT", description="It's a python obfuscator.", author...
davidteather/python-obfuscator
setup.py
setup.py
py
1,182
python
en
code
133
github-code
36
33815850991
from django.shortcuts import get_object_or_404 from rest_framework.decorators import api_view, permission_classes from rest_framework.response import Response from rest_framework import status from rest_framework.permissions import IsAdminUser, IsAuthenticated from .models import Exercise from .serializers import Exerc...
christianbeckham/capstone-app
backend/exercises/views.py
views.py
py
2,944
python
en
code
0
github-code
36
22782711018
# # @lc app=leetcode id=1721 lang=python3 # # [1721] Swapping Nodes in a Linked List # # https://leetcode.com/problems/swapping-nodes-in-a-linked-list/description/ # # algorithms # Medium (66.34%) # Likes: 2015 # Dislikes: 81 # Total Accepted: 116.7K # Total Submissions: 174.9K # Testcase Example: '[1,2,3,4,5]\n...
Zhenye-Na/leetcode
python/1721.swapping-nodes-in-a-linked-list.py
1721.swapping-nodes-in-a-linked-list.py
py
1,454
python
en
code
17
github-code
36
4748854183
#!/usr/bin/env python # coding: utf-8 # In[1]: class Solution(object): def heap_sort(self, nums): """ :type nums: List[int] ex:[3,2,-4,6,4,2,19],[5,1,1,2,0,0] :rtype: List[int] ex:[-4,2,2,3,4,6,19],[0,0,1,1,2,5] """ n = len(nums) for i in range(n-1,-1,-1): ...
samuel80402/sam
HW2/heap_sort_06170224.py
heap_sort_06170224.py
py
877
python
en
code
0
github-code
36
74477215464
from rdflib import Graph, RDF, Literal, RDFS, plugin, OWL, XSD, SKOS, PROV plugin.register('json-ld', 'Serializer', 'rdfextras.serializers.jsonld', 'JsonLDSerializer') import csv import pandas as pd from collections import Counter from nltk.tag import StanfordNERTagger import spacy import jellyfish as jf import json im...
AsaraSenaratne/anomaly-detection-kg
source-files/yago_nodes.py
yago_nodes.py
py
21,397
python
en
code
2
github-code
36
70442787624
#coding: utf-8 # __author__ = jqy import logging class Logger(object): def __init__(self, log_file): """Initialize logging module.""" # disable requests log logging.getLogger("requests").setLevel(logging.DEBUG) logger = logging.getLogger() logger.setLevel(logging.DEBUG) ...
stkaeljason/TjgbSpider
logdealer.py
logdealer.py
py
932
python
en
code
1
github-code
36
25946748198
from data_access_layer.abstract_classes.customer_dao import CustomerDAO from entities.customer import Customer from util.database_connection import connection class CustomerPostgresDAO(CustomerDAO): def create_new_customer(self, customer: Customer) -> Customer: sql = "insert into customer values(%s, %s, ...
dZazulak/Project0
project0/data_access_layer/implementation_classes/customer_postgres_dao.py
customer_postgres_dao.py
py
1,869
python
en
code
0
github-code
36
72172630823
""" Inventarios Componentes v3, CRUD (create, read, update, and delete) """ from typing import Any from sqlalchemy.orm import Session from lib.exceptions import MyIsDeletedError, MyNotExistsError from lib.safe_string import safe_string from ...core.inv_componentes.models import InvComponente from ..inv_categorias.cr...
PJECZ/pjecz-plataforma-web-api-key
plataforma_web/v4/inv_componentes/crud.py
crud.py
py
1,709
python
es
code
0
github-code
36
37853605555
#!/usr/bin/env python # # import common import os, sys, re, random, itertools, functools from atoslib import utils from atoslib import atos_lib from atoslib import generators from atoslib import process TEST_CASE = "ATOS generators - pruning" args = common.atos_setup_args(ATOS_DEBUG_FILE="debug.log") # #########...
atos-tools/atos-utils
tests/test116.py
test116.py
py
9,009
python
en
code
5
github-code
36
6508918488
import numpy as np import csv import chainer import chainer.functions as F import chainer.links as L import sys import matplotlib.pyplot as plt class LaughNeuralNet(chainer.Chain): def __init__(self): super(LaughNeuralNet, self).__init__( l1=L.Linear(None, 200), l2=L.Linear(None, 10...
awkrail/laugh_maker
validation_src/predict.py
predict.py
py
4,519
python
en
code
0
github-code
36
30846787707
# image/views.py from rest_framework.response import Response from rest_framework import generics, status, filters from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from django.core.serializers.json import DjangoJSONEncoder from django.contrib.auth.models import User from django.h...
ngade98/waterlogged_heroku
waterlogged/views.py
views.py
py
16,109
python
en
code
0
github-code
36
71001878825
# Напишите программу, которая на вход принимает два числа A и B, и возводит число А в целую степень B с помощью рекурсии. def exponent(a, b): if b == 0: return 1 else: if b > 0: return a * exponent(a, b-1) else: return 1 / a * exponent(a, b+1) while True: t...
IgorVGoncharov/Python_start
Lesson_5/Task_26.py
Task_26.py
py
726
python
ru
code
0
github-code
36
15442973460
from __future__ import absolute_import, print_function import json import os import tempfile import mock import mesos.cli.cfg import mesos.cli.cmds.config from .. import utils config_path = os.path.normpath(os.path.join( os.path.dirname(__file__), "..", "data", "config.json")) class TestConfig(utils.MockStat...
mesosphere-backup/mesos-cli
tests/integration/test_config.py
test_config.py
py
1,613
python
en
code
116
github-code
36
15958452776
import os #from numpy import where, zeros import re #from itertools import repeat def build_depend_dict(data): depend_dict = {} for (i, d) in data: if d in depend_dict: depend_dict[d].append(i) else: depend_dict[d] = [i] return depend_dict findRoutes = re.compile(r'...
jdmuss/advent_of_code
2018/day_7.py
day_7.py
py
3,022
python
en
code
0
github-code
36
11568085044
### 4 import time import RPi.GPIO as gpio import numpy as np #### initialize GPIO pins #### def init(): gpio.setmode(gpio.BOARD) gpio.setup(31, gpio.OUT) # in 1 gpio.setup(33, gpio.OUT) # in 2 gpio.setup(35, gpio.OUT) # in 3 gpio.setup(37, gpio.OUT) # in 4 gpio.setup(7, gpio....
StrikerCC/RaspberryPi_autonomousRobotics_ENPM809T
A7/encodercontrol04.py
encodercontrol04.py
py
2,306
python
en
code
0
github-code
36
5603104189
import discord cogs_list = [ "help", "unveil", "bet", "account" ] class Dealer(discord.Bot): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for cog in cogs_list: self.load_extension(f"cogs.{cog}") async def on_ready(self): print(f"{...
liang799/rivenDealer
bot.py
bot.py
py
359
python
en
code
1
github-code
36
16237300867
""" This is the place that takes the basic configuration of your LaTeX build project. """ # The name of our main LaTeX source, e. g. 'thesis' or a file 'thesis.tex'. LATEX_PROJECT = 'report' # Default target. DEFAULT_TARGET = 'pdf' # --- Things below should mostly not need touching. --- # Some rather fixed configura...
alexbowe/keyphrase
report/build_config.py
build_config.py
py
758
python
en
code
14
github-code
36
22530028718
"""Implementation of a space that represents textual strings.""" from typing import Any, Dict, FrozenSet, Optional, Set, Tuple, Union import numpy as np from gym.spaces.space import Space alphanumeric: FrozenSet[str] = frozenset( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ) class Text(Spa...
openai/gym
gym/spaces/text.py
text.py
py
7,660
python
en
code
33,110
github-code
36
8919279602
import subprocess import json import argparse import os import requests args = None def main(): global args parser = argparse.ArgumentParser( description='update cloudflare dns records') parser.add_argument('Domain', metavar='domain', type=str, ...
bobbae/examples-2021
Python/cloudflare/update_dns.py
update_dns.py
py
4,011
python
en
code
3
github-code
36
34168133396
from bs4 import BeautifulSoup import requests def wsearch(word): word = word.replace(" ", "-") url = f"https://dictionary.cambridge.org/dictionary/english/{word}" user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge...
Chris4496/TheDictionaryHubAPI
app/scrapers/cambridge.py
cambridge.py
py
3,117
python
en
code
0
github-code
36
4134038538
from random import sample import numpy as np from Dataset import * from Vocabulary import * from Config import * class Generator: @staticmethod def data_generator(voc, gui_path,img_paths,batch_size,generate_binary_sequences=False,verbose=False,loop_only_once=False): assert len(gui_path) == len(img_path...
TismeetSingh14/AutoCode
Generator.py
Generator.py
py
3,060
python
en
code
1
github-code
36
24855579355
from ROOT import TFile, TH3D import numpy as np def SelectParticleMomentumFromHist() : # Open file containing particle momentum distribution file = TFile("threeD.root", "READ") # Retrieve momentum distribution hist = file.Get("threeDHist") # Normalise histogram so that bin height represent probab...
imawby/EventGeneration
momentumFromHist.py
momentumFromHist.py
py
2,093
python
en
code
0
github-code
36
70606542505
import json from wsgiref import simple_server from wsgiref.simple_server import make_server def load_html(file_name,**kwargs): try: with open(file_name,'r',encoding='utf-8') as file: content = file.read() if kwargs: # kwargs = {'username ': 'zhangsan ', 'age':19, 'gender': 'male'} ...
cgyPension/pythonstudy_space
01_base/$05_wsg服务器.py
$05_wsg服务器.py
py
2,943
python
zh
code
7
github-code
36
36041433257
#!/usr/bin/python import httplib import random import argparse import sys #Get options parser = argparse.ArgumentParser( description='Testing vote app') parser.add_argument( '-port', type=int, help='port of server', default=8000) parser.add_argument( '-host', ...
JoseIbanez/testing
redis/p02-vote/client/c02.py
c02.py
py
1,136
python
en
code
3
github-code
36
16252978279
#!/usr/bin/env python3 import time, RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(26, GPIO.OUT) i=0 while True: while i<10: i+=1 LEDon = GPIO.output(26, 1) time.sleep(0.5) LEDoff = GPIO.output(26,0) time.sleep(0.5)
jack23574372/Adafruit_Python_DHT2
blink11.py
blink11.py
py
234
python
en
code
0
github-code
36
27940912517
#!/usr/bin/env python3 """A mere list of phrases that may be used for the game""" #Phrases were taken from: https://wofanswers.com/phrase string_list = [ "ALONE IN A CROWD", "WITHIN THE REALM OF POSSIBILITY", "YOU READ MY MIND", "YOUVE NEVER LOOKED BETTER", "ZERO GRAVITY", ]
Sebastiaan35/Techdegree-developer---Project-3
phrasehunter/phrase_list.py
phrase_list.py
py
313
python
en
code
0
github-code
36
23331780439
from utility_functions import * import matplotlib.pyplot as plt def lemke_optimizer_sparse(eco, payoff_matrix = None, dirac_mode = True): A = np.zeros((eco.populations.size, eco.populations.size * eco.layers)) for k in range(eco.populations.size): A[k, k * eco.layers:(k + 1) * eco.layers] = -1 q ...
jemff/food_web
old_sims/sparse_testing.py
sparse_testing.py
py
4,391
python
en
code
0
github-code
36
43231808566
""" <风格>复古</风格>的旗袍款式 1. 先分词,再标签。 """ import os import re from transformers import BertTokenizer from collections import defaultdict, Counter PATTEN_BIO = re.compile('<?.*>?') def parse_tag_words(subwords): """ HC<领型>圆领</领型><风格>拼接</风格>连衣裙 """ tags = [] new_subwords = [] i = 0 entity = '' wh...
WaveLi123/m-kplug
m_kplug/data_process/bpe_kb_encoder.py
bpe_kb_encoder.py
py
2,910
python
en
code
4
github-code
36
16132606164
# -*- coding: utf-8 -*- """ Created on Tue Feb 18 10:01:52 2020 @author: Ferhat """ from flask import Flask, jsonify, json, Response,make_response,request from flask_cors import CORS # ============================================================================= # from flask_cors import cross_origin # ==============...
RamazanFerhatSonmez/Image-Processing-Python
rest-server.py
rest-server.py
py
4,161
python
en
code
0
github-code
36
10663938377
# -*- coding: utf-8 -*- """ Created on Fri Sep 16 22:56:22 2016 @author: Neo Rotation Componets fitting. Fitting Equation: d_pmRA = -w_x*sin(DE)*cos(RA) - w_y*sin(DE)*sin(RA) + w_z*cos(DE) d_pmDE = +w_x*sin(RA) - w_y*cos(RA) Oct 21 2016: updated by Niu """ import numpy as np sin = np.sin cos =...
Niu-Liu/thesis-materials
sou-selection/progs/RotationFit.py
RotationFit.py
py
4,791
python
en
code
0
github-code
36
4836908641
import socket fwq = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) fwq.bind(('localhost', 9090)) print('Начать чат! ') while True: data, addr = fwq.recvfrom(1024) recvmsg = data.decode('utf-8') if recvmsg == 'exit!': print("Участник" + str(addr) + "добровольно закончил чат с ...
wwatchenjoy/python-practic-2-BogdanovDA
server.py
server.py
py
685
python
ru
code
0
github-code
36
36840226069
"""Test hook for verifying data consistency across a replica set. Unlike dbhash.py, this version of the hook runs continously in a background thread while the test is running. """ import os.path from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.hooks import jsfile from buildscripts.resm...
mongodb/mongo
buildscripts/resmokelib/testing/hooks/dbhash_background.py
dbhash_background.py
py
4,041
python
en
code
24,670
github-code
36
37697513017
import streamlit as st from streamlit_option_menu import option_menu from pages import home, dashboard, login class MultiApp: def __init__(self): self.apps = [] def add_app(self, title, func): self.apps.append({ "title": title, "function": func ...
Ashwani132003/Attendace-Tracker-using-Face-recognition
main.py
main.py
py
976
python
en
code
0
github-code
36