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
12078108329
# Created by Yuanbiao Wang # Implements a simple contrastive learning pretrain learner # MoCo: Momentum Contrast for Unsupervised Visual Representation Learning # https://github.com/facebookresearch/moco import jittor as jt import jittor.nn as nn from advance.ssl_utils import * import matplotlib.pyplot as plt from tq...
THU-CVlab/JMedSeg
advance/ssl.py
ssl.py
py
5,168
python
en
code
56
github-code
1
987337770
# -*- encoding: utf-8 -*- ''' @File : test12.py @Time : 2020/04/15 09:07:01 @Author : xdbcb8 @Version : 1.0 @Contact : xdbcb8@qq.com @WebSite : www.xdbcb8.com ''' # here put the import lib # 题目1:匹配出163的邮箱地址,且@符号之前有4到20位,例如hello@163.com import re x=input('输入邮箱:') ret=re.match(r'^[\w]{4,20}@163.com$',x) if ret: pri...
xiayouhong/gitskills
test/test12.py
test12.py
py
452
python
zh
code
0
github-code
1
6668106671
import json from flask import Flask, request, Response import language_tool_python app = Flask(__name__) my_tool = language_tool_python.LanguageTool('en-US') class ResponseData(object): def __init__(self): self.json_data = { "errno": 0, "message": "success", "data": [], ...
robert1ridley/writing_error_correction
application_v2.py
application_v2.py
py
3,050
python
en
code
0
github-code
1
40391810921
""" This program 1) creates job*.sh files for each command responsible for making NANOAOD files from the MINIAOD inputs, 2) creates the submit.sub file responsible for queueing all job*.sh files, and 3) submits the submit.sub file to HTCondor. Currently, the program targets the creation of NANOAOD files co...
raykil/VBF-Trigger
NANOAOD_Production/2023C_NANOAOD_submitJobs.py
2023C_NANOAOD_submitJobs.py
py
3,806
python
en
code
0
github-code
1
71730576035
from ..constants import BAD_FITNESS class Individual: only_positive_fitness = True # Note: when using diversification techniques (e.g. niching), setting this to False and allowing negative fitness values requires verifying/improving diversification formulas. Dividing fitness by similarity (or multiplying by diver...
Mimikkk/2023-amib
src/libs/framspy/evolalg/structures/individual.py
individual.py
py
2,005
python
en
code
0
github-code
1
5154769069
import sys, string class monChemin: def __init__(self): self.numero=0 self.genre=0 self.taille=0 self.x=[] self.y=[] def getXY(self,timer): if timer<self.taille: return ([self.x[timer],self.y[timer]]) else: return([0,0])
thyshimrod/pyshootdoris
chemin.py
chemin.py
py
314
python
en
code
0
github-code
1
38782292285
import logging import itertools import pytz from parsedatetime import Calendar from tzlocal import get_localzone from .dbmanager import get_lastest_problem_id, Submission from .utils import WebsiteSession LOGGER = logging.getLogger(__name__) class ScraperMeta(type): name = 'Scraper' loaded = {} register...
yehzhang/Show-My-Solutions
show_my_solutions/scrapers.py
scrapers.py
py
5,946
python
en
code
0
github-code
1
71223066915
# coding=utf-8 import os.path import tornado.httpserver import tornado.ioloop import tornado.web import tornado.escape from settings import urls import tornado.options import logging.config from tornado.log import app_log as weblog from settings.logConfig import logConfig import warnings warnings.filterwarnings("ignor...
FYPYTHON/PathOfStudy
python/service/imageserver/imageserver_app.py
imageserver_app.py
py
2,078
python
en
code
0
github-code
1
22745833081
from django.urls import path from .views import new_post,post_update,post_delete,post_detail,AddCommentVİew urlpatterns = [ path('newpost/', new_post, name='post_create' ), path('detail/<int:id>', post_detail, name='post_detail' ), path('detail/<int:id>/comment', AddCommentVİew.as_view(), name='add_commen...
aemingenc/blogApp-django
blog/urls.py
urls.py
py
464
python
en
code
0
github-code
1
23923079299
# LAMBDA - small anonymous function ''' - takes any num of args, but can only have one expression - SYNTAX --> lambda arguments : expression ''' # Add 10 to arg a, and return the result x = lambda a : a + 10 print(x(5)) # take any num of arguments x = lambda a, b : a * b print(x(5,6)) # return a lambda functio...
aaron-bowers/python
lambda.py
lambda.py
py
508
python
en
code
0
github-code
1
10048605544
""" Unique Paths III On a 2-dimensional grid, there are 4 types of squares: 1 represents the starting square. There is exactly one starting square. 2 represents the ending square. There is exactly one ending square. 0 represents empty squares we can walk over. -1 represents obstacles that we cannot walk over. Return ...
okaysidd/Interview_material
Others/Unique Paths III.py
Unique Paths III.py
py
2,650
python
en
code
0
github-code
1
73286233314
from benchmarl.algorithms import MappoConfig from benchmarl.environments import VmasTask from benchmarl.experiment import Experiment, ExperimentConfig from benchmarl.models.mlp import MlpConfig if __name__ == "__main__": # WARNING: Configuring tasks is only suggested for debugging. # For benchmarking, you shou...
facebookresearch/BenchMARL
examples/configuring/configuring_task.py
configuring_task.py
py
1,054
python
en
code
60
github-code
1
26235363048
from flask import Flask, request, abort import linebot import os from linebot import ( LineBotApi, WebhookHandler ) from linebot.exceptions import ( InvalidSignatureError ) from linebot.models import * #======這裡是呼叫的檔案內容===== from message import * from new import * from Function import * #===...
morrischen0/-DEMO
linebot_mo2/app.py
app.py
py
5,943
python
en
code
0
github-code
1
23062543092
import practice_mod # Hash out one program to run and vice versa. # Below code changes number to roman numerals. num = int(input("Type a number to convert to Roman Numerals: ")) abc = practice_mod.IntToRoman() retVal = abc.calc(num) print(retVal) # Below code changes roman numerals to numbers. xyz = p...
jsshah93/RomanNums
practice_prog.py
practice_prog.py
py
392
python
en
code
0
github-code
1
1163086234
from cv2 import * import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg # initialize the camera cam = VideoCapture(0) # 0 -> index of camera s, img = cam.read() #imwrite("image.jpg",img) #save image #img = cv2.imread("image.jpg") img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) p...
kgfathur/selfly
campy/crackImages.py
crackImages.py
py
824
python
en
code
0
github-code
1
22847646985
# -*- coding: utf-8 -*- """ Created on Fri Sep 23 08:31:05 2016 @author: stan """ import numpy as np class FitnessSharing: @staticmethod def scale_fitness(population): sharing_domain = population.parameters['sharing.domain'] theta_share = population.parameters['theta.share'] environme...
riiaa/Algortimos_Evolutivos_19
code/fitness_sharing.py
fitness_sharing.py
py
2,087
python
en
code
1
github-code
1
12804462040
from django.shortcuts import render from django.views.generic import ListView, DetailView from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.urls import reverse, reverse_lazy from django.utils.translation import ugettext_lazy from .models import Post class BlogListView(ListView): ...
Nahid-Hassan/fullstack-software-development
courses/backend/Learn Django by Creating Projects/projects/blog/blog/views.py
views.py
py
1,337
python
en
code
0
github-code
1
21086711197
import pygame import globalVariables class EnemyProjectile(pygame.sprite.Sprite): def __init__(self, direction, enemy, window): pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load("images/sprites/bone.png").convert_alpha() self.size = self.image.get_size() self.image ...
NaoufelMaazouzi/jeu-python
enemyProjectile.py
enemyProjectile.py
py
1,145
python
en
code
0
github-code
1
11737097023
import os from werkzeug.utils import secure_filename class Upload: app = None def __init__(self, app): self.app = app def upload(self, destination, ext_conf, files): if type(files) is list: file_names = [] for _file in files: filename = self.upload...
johndoe-dev/Ecodroid
app/flask_helpers/upload.py
upload.py
py
1,164
python
en
code
0
github-code
1
71602513635
# -*- coding: utf-8 -*- """ Converts the Microsoft Band GPS data to the open GPX format. WORK IN PROGRESS """ import json from pprint import pprint import re import matplotlib.pyplot as plt import seaborn as sea import datetime as dt import matplotlib.dates as dates import argparse import isodate import itertools as...
cryptogramber/Microsoft-Band-Utils
Band-Data-Analysis/ConvertBandGPX.py
ConvertBandGPX.py
py
9,152
python
en
code
1
github-code
1
8407358533
from loguru import logger from sqlite3 import Connection class Repo: def __init__(self, db: Connection): self.db = db def create_schema(self): with open('database/init.sql') as f: script = f.read() self.db.executescript(script) def...
hermanguilliman/boorubot
repo.py
repo.py
py
3,078
python
ru
code
0
github-code
1
15243980008
from random import randint def rollDie(die): return randint(1,die) def rollHowManyTimes(n,die): times = n total = 0 results = [] while times > 0: roll= rollDie(die) total += roll results.append(roll) times -=1 return results def rollStat(): stat = 0 ...
jordanforbes/StatRoller
dice.py
dice.py
py
426
python
en
code
0
github-code
1
71721970275
import torch import torch.nn as nn import numpy as np import sys import os sys.path.append(os.path.join(os.getcwd(), "lib")) # HACK add the lib folder from models.backbone_module import Pointnet2Backbone from models.voting_module import VotingModule from models.proposal_module import ProposalModule from models.graph_m...
daveredrum/Scan2Cap
models/capnet.py
capnet.py
py
4,977
python
en
code
89
github-code
1
27847975086
from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QSlider, QPushButton, QLineEdit, QGridLayout from PyQt5.QtCore import Qt import sys import serial #The following line is for serial over GPIO port = 'COM3' ard = serial.Serial(port,9600,timeout=5) class Slider_Control(QWidget): def __init__(self...
zlby/Robotic-Arm
control_UI.py
control_UI.py
py
7,319
python
en
code
0
github-code
1
74474210593
def parse_cookies(cookie_data): request_cookies = {} if cookie_data == '': return {} for i in cookie_data.split(";"): j = i.split("=") request_cookies[j[0].strip()] = j[1].strip() return request_cookies def parse_environ(data): environ = {} for i in data: ...
graham/jitsu
jitsu2/jitsu/server/header_parser.py
header_parser.py
py
2,386
python
en
code
0
github-code
1
29550588888
import video import funkcijos import plotly.graph_objects as go import math dataList = list() eUploader = 0 eAge = 0 eCategory = 0 eLength = 0 eViews = 0 eRate = 0 eRatings = 0 eComments = 0 atributeNames = list() missingValues = list() avarages = list() medians = list() mins = list() maxs = list() cardinalities = l...
winVIP/KTU-stuff
KTU semestras 6/Intelektika/Lab1/mainas.py
mainas.py
py
20,500
python
en
code
0
github-code
1
72869151394
# This script will create all you need for a hunt group and tie it all together # This creates a Line Group, Hunt List, and Pilot # There's also logic to specify if you want calls to rona to a VM box # If you want calls to rona to another number other than a VM box you will need to tweak the code a bit from lxml impor...
jfletcher76/CiscoDEVUC
CUCM/addRequests/addHuntGroup.py
addHuntGroup.py
py
7,503
python
en
code
1
github-code
1
31037849632
from setuptools import setup install_requires = [ # NOTE: Apache Beam tests depend on this library and cannot # currently upgrade their httplib2 version. # Please see https://github.com/googleapis/google-api-python-client/pull/84 "httplib2>=0.9.2,<1dev", "google-auth>=1.16.0", "google-auth-http...
edwinnab/vm-network-migration
setup.py
setup.py
py
724
python
en
code
null
github-code
1
23665017015
from django.shortcuts import render, redirect, reverse from django.contrib.auth import logout from django.contrib.auth.views import LoginView, LogoutView, login_required @login_required(login_url='accounts:login') def logoutview(request): logout(request) return redirect('accounts:login') @login_required(log...
georgeballasdev/chat_app
ChatApp/accounts/views.py
views.py
py
589
python
en
code
0
github-code
1
1758676352
import functools print("******* Recursive and Memoization *******") @functools.lru_cache(maxsize=None) def grid_traveller(m,n): if (m == 1 and n == 1): return 1 elif (m == 0 or n==0 ): return 0 else: return (grid_traveller(m-1,n)+grid_traveller(m,n-1)) print(grid_trave...
ahmetsoguksu/Dynamic-Programming-Python
2-grid_traveller.py
2-grid_traveller.py
py
1,171
python
en
code
0
github-code
1
72387942114
""" Script to install Souma on OsX, Windows, and Unix Usage: python package.py py2app python package.py py2exe """ import ez_setup import numpy # important for py2exe to work ez_setup.use_setuptools() import sys import os from esky.bdist_esky import Executable from setuptools import setup if sys.platform ==...
cafca/souma
package.py
package.py
py
7,972
python
en
code
5
github-code
1
4533274252
import numpy as np def weird_division(x, y): return 0 if y == 0 else x / y def modeleval(save_test_model, var, f): results = np.load(f'data/results/{save_test_model}.npz') inputs, labels, outputs = results['inputs'], results['labels'], results['outputs'] del results n_samples, n_classes, w, h = o...
waterybye/Semantic-segmentation-methods-for-landslide-detection
evaluate.py
evaluate.py
py
1,866
python
en
code
17
github-code
1
36317609380
# coding=utf-8 """Resources API feature tests.""" __copyright__ = 'Copyright (c) 2020, Utrecht University' __license__ = 'GPLv3, see LICENSE' from pytest_bdd import ( given, parsers, scenarios, then, ) from conftest import api_request scenarios('../../features/api/api_resources.feature') @given(...
peer35/irods-ruleset-uu
tests/step_defs/api/test_api_resources.py
test_api_resources.py
py
6,600
python
en
code
null
github-code
1
1146324925
def solution(routes): answer = 0 lst = [] SZ = len(routes) camera = [0]*SZ for index, route in enumerate(routes): lst.append((route[0] , 0 , index)) lst.append((route[1] , 1 , index)) lst.sort() i , j =0, 0 while j<len(lst): if lst[j][1] == 1 and cam...
seoljeongwoo/learn
프로그래머스/단속카메라.py
단속카메라.py
py
654
python
en
code
0
github-code
1
24858642559
# -*- coding: utf-8 -*- import datetime from django.core.paginator import Paginator from django.shortcuts import render, get_object_or_404 from blogs.models import Post def index(request): posts = Post.objects.filter(visible=True).order_by('-created') try: page = int(request.GET.get('page')) ex...
wd5/abakron
abakron/apps/blogs/views.py
views.py
py
681
python
en
code
0
github-code
1
1133256822
#Libray import csv import math import matplotlib.pyplot as plt from sklearn import tree from sklearn.model_selection import KFold #Variables X = [] y = [] Y_series = [] #used to save real values and respective predictions dtr_MADscores = [] dtr_RMSEscores = [] features = ('X','Y','month','day','FFMC','DMC','DC','ISI',...
hyin8/CS4210_project
src/forest_fires_dt.py
forest_fires_dt.py
py
3,966
python
en
code
0
github-code
1
36228823332
class Solution: def fizzBuzz(self, n: int): l = [] for i in range(1, n): if (i % 3) and (i % 5) == 0: ['FizzBuzz'] == l[i] # l[i] == ['FizzBuzz'] elif (i % 3) == 0: l[i] == ['Fizz'] elif (i % 5) == 0: ...
Narayan1089/python-programs
fizzbuzz.py
fizzbuzz.py
py
436
python
en
code
0
github-code
1
3804617895
import sys sys.path.insert(0, 'src/vendor') from imdb import IMDb from imdb import helpers ia = IMDb() h = helpers() def multipleMovies(title, allMoviesWithName, movie): if(len(allMoviesWithName) == 1): movie = ia.get_movie(allMoviesWithName[0].movieID) else: filterBy = input(f'Multiple items named "{title}" ...
allisontharp/laughtrack
backend/datapull/imdbFuncs.py
imdbFuncs.py
py
2,816
python
en
code
0
github-code
1
73498023712
import setuptools from ast import literal_eval name = 'asterion' with open(f'{name}/version.py') as file: # Assuming version.py follows format __version__ = '<version_string>' line = file.readline().strip() version = literal_eval(line.split(' = ')[1]) description = 'Fits the asteroseismic helium-II ionis...
alexlyttle/asterion
setup.py
setup.py
py
1,415
python
en
code
0
github-code
1
29876622273
#!/usr/bin/env python import os import sys import re try: from setuptools import setup setup except ImportError: from distutils.core import setup setup if sys.argv[-1] == "publish": os.system("python setup.py sdist upload") sys.exit() # Handle encoding major, minor1, minor2, release, serial =...
jpdeleon/exoplanet_class
simfit_master/setup.py
setup.py
py
1,456
python
en
code
0
github-code
1
5603227043
################################################################ # Use nmrglue package # latest version (09.06.2021) needs this package commit https://github.com/jjhelmus/nmrglue.git@6ca36de7af1a2cf109f40bf5afe9c1ce73c9dcdc ################################################################ import numpy as np import nmrg...
mobecks/ShimDB
utils_IO.py
utils_IO.py
py
5,216
python
en
code
1
github-code
1
16819999895
from requests import Session from requests.structures import CaseInsensitiveDict class BaseSession(Session): def __init__(self, driver_cookie: dict): super().__init__() self.verify = False self.headers = CaseInsensitiveDict( {'Content-Type': 'application/x-www-form-urlencoded'...
fonbeauty/developer_portal
common/sessions.py
sessions.py
py
408
python
en
code
0
github-code
1
31799149305
# Your message is a string containing space separated words. # You need to encrypt each word in the message using the following rules: # The first letter needs to be converted to its ASCII code. # The second letter needs to be switched with the last letter # Keepin' it simple: There are no special characters in input. ...
katya1242/PythonScripts
CodeWars/Encrypt_This!.py
Encrypt_This!.py
py
937
python
en
code
0
github-code
1
16944439195
import csv with open("emp.csv",'r') as fp: data=csv.reader(fp) for line in data: for j in line[1]: if j[0]=='A': print(line) break #OUTPUT """ python EmployeName.py ['101', 'Anna', '5500'] ['104', 'Alice', '3500'] """
MohdMazher23/PythonAssingment
Day6/EmployeName.py
EmployeName.py
py
300
python
en
code
0
github-code
1
42896814245
from tokenizers import BertWordPieceTokenizer import numpy as np import argparse import torch parser = argparse.ArgumentParser(description="Numerize text into numpy format") parser.add_argument('--vocab', default='path/to/vocab.txt', help="path to vocabulary file") parser.add_argument('--merge', de...
alexa/ramen
code/utils/numerize.py
numerize.py
py
3,426
python
en
code
17
github-code
1
23533446347
from typing import List class UnionFind: """ 유니온 파인드 : 두 노드가 같은 그룹 인지 체크 """ def __init__(self): super().__init__() self.parent: List[int] = [] def union(self, node_count: int, edge_list: List[List[int]]): """ 유니온 연산 : 두 노드의 대표 노드끼리 연결 Args: no...
jinyul80/algorithm_study
python/graph/union_find.py
union_find.py
py
2,253
python
ko
code
0
github-code
1
29062173754
import turtle as tt class Card(): def __init__(self,name = None,suit = None): self.name = name self.suit = suit #diamonds (♦), clubs (♣), hearts (♥) and spades (♠) self.symbols = {'D':'♦','C':'♣','H':'♥','S':'♠'} #dictionary def print_card(self): if self.suit == 'S': ...
poorboygl/DeckofCards
CardRepository.py
CardRepository.py
py
1,516
python
en
code
0
github-code
1
11163252773
T=int(input()) for tc in range(T): N=int(input()) tmp=[] for _ in range(N): tmp.append(list(map(int,input().split()))) alert=[] # 경보기 위치 뽑기 for row in range(N): temp=[] for col in range(N): if tmp[row][col]==1: temp.append((row,col)) if le...
ahrtz/study
혼자하는거/멧돼지밭경보기.py
멧돼지밭경보기.py
py
1,139
python
ko
code
0
github-code
1
31511216914
from pathlib import Path from itertools import zip_longest f = open(Path(__file__).resolve().parent / 'input.txt') # eval would have been easier ... def read_packet(s): def read(s,p): if s[p] == '[': return read_list(s,p) return read_number(s,p) def read_number(s,p): e = p while s[e].isdigit...
andiwand/adventofcode
2022/day13/solution.py
solution.py
py
1,641
python
en
code
1
github-code
1
39721890455
# -*- coding: utf-8 -*- """ Created on Tue Jul 14 20:21:07 2020 @author: gabriel bustamante """ import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt def get_attributes_list(information_level, attributes_description): attributes_list = list(attributes_descri...
gabrielbfs/ArvatoProject_workbook
arvato_project.py
arvato_project.py
py
2,654
python
en
code
0
github-code
1
12861904385
#import constants from constants import * #import necessary classes from space_invaders.game.casting.sound import Sound #import sound class for collision sound from space_invaders.game.scripting.action import Action #import action class as parent class class CollideShipAlienAction(Action): '''checks for and reso...
mhoward09/cse210-06_final
space_invaders/game/scripting/collision_actions/collide_ship_alien_action.py
collide_ship_alien_action.py
py
1,983
python
en
code
0
github-code
1
17441169318
from bs4 import BeautifulSoup import sqlite3 import urllib.request import urllib.error import re import xlwt def main(): baseurl = 'https://www.liepin.com/zhaopin/?sfrom=click-pc_homepage-centre_searchbox-search_new&dqs=010&key=JAVA' datalist = getdata(baseurl) savepath = ".\\职位信息" print(datalist) #...
waji785/py-spide
main/website crawl.py
website crawl.py
py
3,302
python
en
code
0
github-code
1
20088710262
class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ ''' input: array of size n find element that appears more than n/2 times array is non empty, majority element always exists return that element ...
willstauffernorris/csbuild2
majority_element.py
majority_element.py
py
1,189
python
en
code
0
github-code
1
5512792109
from src.common.constants import Constants from src.common.form import Form class Form_13(Form): URL = ConstantsFORM_13 URL_DEBUG = URL + "#debug" CSS_ZASILKOVY_VYDEJ_CR = "[id^='/zasilkovyVydej/zasilkovyVydejCr']" CSS_ZASILKOVY_VYDEJ_ZAHRANICI = "[id^='/zasilkovyVydej/zasilkovyVydejZahranici']" ...
bockino/SUKLUITests
src/forms/phase_1/form13.py
form13.py
py
601
python
en
code
0
github-code
1
12195682849
"""Point cloud generation functions to test benchmarks of rotation invariant functions """ from dataclasses import dataclass from functools import lru_cache import numpy as np import torch from numpy.linalg import norm from scipy.spatial.transform import Rotation from scipy.spatial.transform import Rotation as R def...
ymentha14/se3_molecule_generation
src/ri_distances/pnt_cloud_generation.py
pnt_cloud_generation.py
py
7,508
python
en
code
2
github-code
1
2840901186
import prometheus_client broker_state = prometheus_client.Enum( 'state', 'Kafka broker state (see https://github.com/confluentinc/librdkafka/blob/master/STATISTICS.md)', states=[ # from https://github.com/confluentinc/librdkafka/blob/v2.2.0/src/rdkafka_broker.c#L83 'INIT', 'DOWN', ...
nasa-gcn/gcn-monitor
gcn_monitor/metrics.py
metrics.py
py
595
python
en
code
0
github-code
1
71100325155
import pandas as pd import numpy as np '''Анализ перемещения 3-х подвесок индукторов на разных сортаментах труб. Вопрос: На каком типоразмере трубы больше всех перемещается подвеска?''' # Отображение всех столбцов desired_width = 500 pd.set_option('display.width', desired_width) np.set_printoptions(linewidth=desire...
kirill00724/Data-analysts
Analys_of_moving_inductor/main.py
main.py
py
3,802
python
en
code
0
github-code
1
22078780419
import ast import inspect class Unpacking(ast.AST): _attributes = () _fields = ("value",) def __init__(self, value, counter, starred=False): self.value = value self.counter = counter self.starred = starred class ForTargetPlaceholder(ast.AST): _attributes = () _fields = (...
percevalw/pygetsource
pygetsource/ast_utils.py
ast_utils.py
py
8,107
python
en
code
2
github-code
1
43655547493
from django import views from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render from .forms import ProfileChangeForm class ProfileView(LoginRequiredMixin, views.View): template_name = "LK.html" form_class = ProfileChangeForm def get(self, request, *args, **kwargs):...
Rimasko/touristik_site
ekvatour/users/views.py
views.py
py
1,177
python
en
code
1
github-code
1
37462045764
import numpy def ransac(data,model,n,k,t,d,debug=False,return_all=False): iterations = 0 bestfit = None besterr = numpy.inf best_inlier_idxs = None while iterations < k: maybe_idxs, test_idxs = random_partition(n,data.shape[0]) maybeinliers = data[maybe_idxs,:] test_points ...
zh-plus/SUSTech-CS308
Lab6/ransac.py
ransac.py
py
1,790
python
en
code
18
github-code
1
6493980187
# N -1 # N / k n, k = map(int, input().split()) result = 0 while n > 1: if n % k == 0: n = n/k result += 1 else: n -= 1 result += 1 print(result) """ n의 범위가 커지면 일일히 1씩 빼는건 어려움 한번에 n이 k배수가 되도록 효율적으로 해야 함 """
JoonseoKang/coding_test
Greedy/to_one.py
to_one.py
py
321
python
ko
code
0
github-code
1
22457446346
import os def list_keywords(keywords): if len(keywords) > 0: print("List of search keywords: ") for keyword in keywords: keyword_display = str("- {}").format(keyword) print(keyword_display) def get_keywords_from_txt(): while True: file_path = input("Input file ...
KEN-00/search_freq_booster
search_freq_booster/keyword_helper.py
keyword_helper.py
py
1,463
python
en
code
0
github-code
1
4685574067
import numpy as np import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import make_pipeline from sklearn.linear_model import LinearRegression from plots import plot_series from sunspots import error, get_data, sklearn_formatting class GaussianFeatures(BaseEstimator, Tr...
rkhood/forecasting
linear.py
linear.py
py
1,507
python
en
code
0
github-code
1
72086873633
# # @lc app=leetcode id=3 lang=python3 # # [3] Longest Substring Without Repeating Characters # # https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ # # algorithms # Medium (29.25%) # Likes: 7133 # Dislikes: 422 # Total Accepted: 1.2M # Total Submissions: 4.2M # Testcase Exa...
0xouzm/lc_python
3.longest-substring-without-repeating-characters.py
3.longest-substring-without-repeating-characters.py
py
1,357
python
en
code
0
github-code
1
26786218549
from gi.repository import Gtk class Controls(Gtk.Box): def __init__(self, *args, **kwargs): super().__init__(spacing=10.0, *args, **kwargs) self.reset_btn = Gtk.Button(label="Reset") angle_control_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) angle_control_label = Gtk.Labe...
sgorawski/InformatykaUWr
Kurs_rozszerzony_jezyka_Python/l07/controls.py
controls.py
py
1,346
python
en
code
0
github-code
1
18684839781
#==== MOVIE ADMIN VIEWS ==== from django.shortcuts import render, get_object_or_404 from django.urls import reverse from django.http import HttpResponseRedirect from django.contrib.auth import authenticate from movies.models import * from Metflix.settings import MEDIA_ROOT, MEDIA_URL import os # Create your views ...
nall3n/Metflix
Metflix/movie_admin/views.py
views.py
py
2,226
python
en
code
0
github-code
1
20406431539
# Το τελικό αποτέσμα στο συγκεκριμένο πρόβλημα για να έχει λογική προϋποθέτει # την πώληση όλου του αριθμού των αγορασμένων μετοχών arithmos_metoxon = float(input('Δώσε τον αριθμό των μετοχών που αγόρασες: ')) timi_metoxis = float(input('Δώσε την τιμή της μετοχής ανά μονάδα που ' 'αγό...
bilakos26/Python-Test-Projects
ProgrammaSynallagonMetoxon.py
ProgrammaSynallagonMetoxon.py
py
2,479
python
el
code
0
github-code
1
29243926203
def maxPathSum(tree): # Write your code here. answer = [] maxPathSumHelper(tree,answer) answer.sort(reverse=True) return answer[0] def maxPathSumHelper(node,answer): if node is None: return 0 left = maxPathSumHelper(node.left,answer) right = maxPathSumHelper(node.right,answer) mps = node.value if 0 < lef...
jinlee487/Algorithm
src/algoexpert/hard/MaxPathSum/solution.py
solution.py
py
909
python
en
code
0
github-code
1
8926189595
from django import forms from django.contrib.auth.models import User from django.contrib.auth import authenticate, login from django.core.urlresolvers import reverse from django.shortcuts import render, get_object_or_404 from django.contrib import messages from django.http import HttpResponseRedirect from users.models ...
austin15140/mysite
users/forms.py
forms.py
py
6,567
python
en
code
0
github-code
1
5236687817
inStr = input() std = 'PAT' count = 0 for idx,val in enumerate(inStr): if val != 'P': continue else: tmp = val for j in inStr[idx + 1:]: if std.startswith(tmp+j): tmp += j if tmp == std: count += 1 print(count % 1000000007)
michelya/pat3
1040.py
1040.py
py
312
python
en
code
1
github-code
1
2308940238
from interactions import * class Erreurs(Extension): @listen(disable_default_listeners=True) async def on_command_error(self, event: errors): """ Gère les erreurs du bot Args: event (discord.ext.commands.errors): L'erreur Returns: ...
Axiaaa/PipoBot
utils/erreurs.py
erreurs.py
py
696
python
fr
code
1
github-code
1
36326774381
#!/usr/bin/env python # -*- coding: utf-8 -*- class DiacreticChecker: def __init__(self): self.mapping = {"a": [u"ą"], u"ą": ["a"], "c": [u"ć"], u"ć": ["c"], "e": [u"ę"], u"ę": ["e"], "l": [u"ł"], u"ł": ["l"], "...
gmiejski/natural_language_processing
Lab2/impl/DiacreticChecker.py
DiacreticChecker.py
py
654
python
en
code
0
github-code
1
43792968736
# -*- coding:utf-8 -*- __all__=['getDataGenerator'] import keras from keras.preprocessing.image import ImageDataGenerator,array_to_img from keras.datasets import cifar10 import numpy as np import os import pickle import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt def getDataGenerator(train_phase...
Kexiii/DenseNet-Cifar10
data_input/data_input.py
data_input.py
py
2,951
python
en
code
40
github-code
1
5282218579
from django.urls import path from .views import ( PdfextListView, PdfextDetailView, PdfextCreateView, PdfextUpdateView, PdfextDeleteView, UserPdfextListView, PdfextConvertView, ) from . import views urlpatterns = [ path('', PdfextListView.as_view(), name='pdfext-home'), path('user/<...
perpertuallearner/all_about_pdfs
pdfext/urls.py
urls.py
py
1,070
python
en
code
0
github-code
1
9618399050
from itertools import groupby lis = [1, 2, 2, 3, 4, 4, 4, 4] print(list(groupby(lis))) things = [("animal", "bear"), ("animal", "duck"), ("plant", "cactus"), ("vehicle", "speed boat"), ("vehicle", "school bus")] for key, group in groupby(things, lambda x: x[0]): for thing in group: print("A %s is a %s." %...
hemantkgupta/Python3
itertools/groupby.py
groupby.py
py
518
python
en
code
0
github-code
1
32068119633
from selenium import webdriver import time import math try: browser = webdriver.Chrome() link = "http://suninjuly.github.io/redirect_accept.html" browser.get(link) browser.find_element_by_tag_name("button").click() #confirm = browser.switch_to.alert #confirm.accept() windows = browser.wind...
EkS2018/stepik-selenium
21.py
21.py
py
961
python
en
code
0
github-code
1
26554305585
"""Module containing the classes Contingency and ContingencyType.""" from enum import unique, Enum from copy import deepcopy from collections import defaultdict import logging from typing import Any, Callable, Set as TgSet, Dict, List, Optional from rxncon.core.effector import Effector, StructEquivalences, QualSpec,...
rxncon/rxncon
rxncon/core/contingency.py
contingency.py
py
9,032
python
en
code
9
github-code
1
3733088103
# -*- coding: cp936 -*- import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2*np.pi, 50) plt.subplot(3, 1, 1) # (行,列,活跃区) plt.plot(x, np.sin(x), 'r') plt.subplot(3, 1, 2) plt.plot(x, np.cos(x), 'g') plt.subplot(3, 1, 3) plt.plot(x, np.tan(x), 'b') plt.show() # -*- coding: cp936 -*- imp...
wsgan001/python-2
数据图形/图表.py
图表.py
py
3,281
python
en
code
0
github-code
1
20248498954
import os, time, socket, threading, json import paho.mqtt.client as mqtt import h3.api.numpy_int as h3 import numpy as np from scipy import stats from geodata_toolbox import H3Grids import matplotlib.pyplot as plt class Indicator: def __init__(self, H3, Table=None): self.H3 = H3 self.h3_features = ...
csl-hcmc/SaiGon-Peninsula
Software/L3_SZ_CityScope-main/backend/indicator_toolbox.py
indicator_toolbox.py
py
13,392
python
en
code
2
github-code
1
36189820928
#!/usr/bin/env python3 import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="har2requests", version="0.2.2", author="Louis Abraham", license="MIT", author_email="louis.abraham@yahoo.fr", description="Gener...
louisabraham/har2requests
setup.py
setup.py
py
909
python
en
code
93
github-code
1
36997759739
import sqlite3 from contextlib import closing from typing import List, Dict, Union table_name = "bot" DBEntry = Dict[str, Union[str, int]] def add_to_database(db_name: str, data: List[DBEntry]) -> int: connection = sqlite3.connect(db_name) with closing(connection): cursor = connection.cursor() ...
quietsato/TwitterBotPy
botkun/lib/database.py
database.py
py
3,521
python
en
code
0
github-code
1
413504280
# pylint: disable=W0621,C0114,C0116,W0212,W0613 import pathlib from typing import Optional import pytest from dae.testing.foobar_import import foobar_gpf from dae.studies.study import GenotypeData from dae.testing import setup_pedigree, setup_vcf, vcf_study from dae.utils.regions import Region from dae.genotype_stora...
iossifovlab/gpf
dae/tests/integration/study_query_variants/test_allele_frequency.py
test_allele_frequency.py
py
4,279
python
en
code
1
github-code
1
11548748606
from flask import Blueprint, views, current_app, session, request, redirect, render_template, jsonify from Formclasses.admin_classes import DiaryandAdminPost, AinforClass, UserManage, EmployeeinforClass, PostClass import datetime from .Manager import toNormal import re import random import os Adminbp = Blueprint("admi...
spidereyes/Oracle-
Blueprints/Admin.py
Admin.py
py
28,518
python
en
code
0
github-code
1
4457682469
import subprocess as sp import sys import ctypes import os import random import json import base64 import pathlib import tempfile import functools import operator import time import numpy import pylibsort import libff.invoke # ol-install: numpy # from memory_profiler import profile import cProfile import pstats impor...
NathanTP/fakefaas
examples/sort/worker.py
worker.py
py
4,313
python
en
code
1
github-code
1
12175074674
import sys sys.stdin = open('input.txt', 'r') T = int(input()) for test_case in range(1, T+1): N = int(input()) result = 0 print('#{} {} : {}'.format(test_case, N, result)) # def pow(a, n): # if n == 0: # return 1 # else: # return a * pow(a, n - 1) # T = int(input()) # ans = []...
BonHyuck/Python
SWEA/D4/10908.py
10908.py
py
584
python
en
code
1
github-code
1
21640719384
""" This file """ from textblob import TextBlob import sys user_input = sys.argv if len(user_input) != 2: print("Need a txt file to read") exit() with open(user_input[1], 'r') as f: text = f.read() blob = TextBlob(text) sentiment = blob.sentiment.polarity print(sentiment)
mkPuzon/NLP-Tone-Checker
textAnalysis.py
textAnalysis.py
py
288
python
en
code
0
github-code
1
22475238082
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseBetween(self, head, m, n): """ :type head: ListNode :type m: int :type n: int :rtype: ListNode ...
Brady31027/leetcode
92_Reverse_Linked_List_II/reverse_linked_list_ii.py
reverse_linked_list_ii.py
py
1,089
python
en
code
1
github-code
1
23636970992
#!/usr/bin/python3 """ This module contains a Square class """ from models.rectangle import Rectangle from models.base import Base class Square(Rectangle): """ Square class """ def __init__(self, size, x=0, y=0, id=None): """ Initializes a square class that inherits from rectangle ...
angel19951/holbertonschool-higher_level_programming
0x0C-python-almost_a_circle/models/square.py
square.py
py
2,600
python
en
code
0
github-code
1
31422654214
""" ----------SANTIAGO RIOS GUIRAL-------------------------------------------------- ----------santiago.riosg@udea.edu.co-------------------------------------------- -------------------------------------------------------------------------------- ----------EMMANUEL GOMEZ OSPINA------------------------------------------...
SantiagoGuiral/ress
moves2PGN_parser.py
moves2PGN_parser.py
py
3,680
python
es
code
1
github-code
1
71730197474
import shutil import os import glob2 from tqdm import tqdm train_path = '../data/train/' test_path = '../data/test/' if not os.path.exists(train_path): os.makedirs(train_path) if not os.path.exists(test_path): os.makedirs(test_path) test_num = 0 for filename in tqdm(glob2.glob('../data/dicom-images-test/**/...
kshannon/pneumothorax-segmentation
eda/move_data.py
move_data.py
py
757
python
en
code
1
github-code
1
71928968673
import os from pdfRecognition import pdfRecognition import fitz class pdfToPic(): def __init__(self,filepath,folderPath): self.filepath = filepath self.folderPath = folderPath def pdfToPic(self): pdfDoc = fitz.open(self.filepath) for pg in range(pdfDoc.page_count): ...
Guanguanka/pdfTool
pdfToPic.py
pdfToPic.py
py
979
python
en
code
0
github-code
1
20047483491
import subprocess from sys import exit from itertools import combinations, permutations from math import floor, ceil # Facer lista de nxn coas reglas, para obter as filas e as columnas das regras # Logo, con esto facemos as permutacions de 4 para a segunda regra def filasColumnas(lista): """ :param lista: Lis...
AlejandroFernandezLuces/practicas-SAT
binairo.py
binairo.py
py
8,893
python
en
code
0
github-code
1
7053890236
import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../datasets/")) from mass_spring import get_dataset import torch import torch.nn as nn import pytorch_lightning as pl import numpy as np import torch.utils.data as data from TorchSnippet.energy import HNN from Torc...
yantijin/TorchSnippet
example/energy/hnn_test.py
hnn_test.py
py
2,156
python
en
code
0
github-code
1
29499134745
import os import secrets from PIL import Image from flask import render_template, url_for, flash, redirect, request, abort, jsonify, make_response from app import app, db, bcrypt, mail from forms import * from models import * from flask_login import login_user, current_user, logout_user, login_required from datetime i...
alankhoangfr/NilStock_Inventory
routes/notificationRoutes.py
notificationRoutes.py
py
5,177
python
en
code
0
github-code
1
8369273436
import os import hashlib def getBigFileMD5(filename): ''' 获取文件的MD5值,适用于较大的文件 ''' if not os.path.isfile(filename): return myhash = hashlib.md5() f = open(filename, 'rb') while True: b = f.read(8096) if not b: break myhash.update(b) f.close() ...
tboqi/tbqapps2
python/diff.py
diff.py
py
3,277
python
en
code
0
github-code
1
39000943657
import torch import numpy as np from torchvision import transforms from torch.utils.data import DataLoader from torch.utils.data._utils.collate import default_collate from .datasets import IuxrayMultiImageDataset, MimiccxrSingleImageDataset, KnowledgeDataset class ToPILImage(object): def __init__(self): s...
LX-doctorAI1/GSKET
modules/dataloaders.py
dataloaders.py
py
4,467
python
en
code
20
github-code
1
30540826405
"""A number-guessing game.""" from random import randint def getNum(prompt, start=None, end=None): try: num=int(input(prompt)) except ValueError: print("Invalid number.") num = None if start is not None: if num < start: print ("Number must be greater than {}".fo...
sraisty/hb_guessinggame
game.py
game.py
py
3,518
python
en
code
0
github-code
1
10124506506
#!/root/nsd1905/bin/python '''script for directory and file backup by means of md5 Mon full backup Tue-Sun incremental backup 计划任务,非交互式程序 1.星期几 2.备份方案(增量备和完全备) 完全备: 1.打包压缩目录下所有文件 2.os walk遍历所有文件并得到文件完整路径 3.计算每个文件的md5值 4.写入字典 -key: 路径 value md5 5.将字典pickle.dump到md5file里面 增量备 #压缩包的绝对路径: security_incr_back_20200904.tar....
WilliamFWG/Warehouse
python/PycharmProjects/py02/day01/backup.py
backup.py
py
3,997
python
zh
code
0
github-code
1
36415915522
import copy import mmcv import re import torch import torch.nn as nn import warnings from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init, kaiming_init) from mmcv.cnn.bricks.registry import NORM_LAYERS from mmcv.runner import load_checkpoint from numpy.random import rand from op...
wyzelabs-inc/AdaptiveDistillation
adaptivedistillation/models/classifiers/kd_image.py
kd_image.py
py
12,381
python
en
code
3
github-code
1
74095797154
import sys import os import re import numpy as np import pandas as pd from stock.utils.symbol_util import get_stock_symbols, get_archived_trading_dates, exsymbol_to_symbol from stock.marketdata.storefactory import get_store from stock.lib.finance import get_lrb_data from sklearn import linear_model import matplotlib.py...
shenzhongqiang/cnstock_py
stock/quant/pe.py
pe.py
py
4,429
python
en
code
0
github-code
1