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
37785219536
from pylab import * import matplotlib def n(j,xc,x): n = 1 for i in arange(j): n *= (xc-x[i]) return n def a(j,l,x,y): if j==0: return y[0] elif j-l==1 : return (y[j]-y[l])/(x[j]-x[l]) else: return (a(j,l+1,x,y)-a(j-1,l,x,y))/(x[j]-x[l]) def N(xc,x,y):...
pdelfino/numerical-analysis
lista-3/example-2.py
example-2.py
py
671
python
en
code
0
github-code
13
39090698159
from selection_sort import selection_sort from insertion_sort import insertion_sort from merge_sort import merge_sort from quick_sort import quick_sort selection_unsorted = [99, 77, 44, 16, 1000, 7, 4, 8, 22, 3, 16, 99, 205, 33, 1, 100, 19, 12, 55] insertion_unsorted = [99, 77, 44, 16, 1000, 7, 4, 8, 22, 3, 16, 99, 20...
aconstantinou123/sorting_algorithms
main.py
main.py
py
1,059
python
en
code
0
github-code
13
22678679872
from __future__ import print_function import numpy as np from pysnptools.snpreader import Bed data_dir = '/groups/price/hilary/ibd/data' bedfile = data_dir+'/1000G.EUR.QC.22' outfile = bedfile+'.f2snps' bed = Bed(bedfile) x = bed.read() b = np.array([sum(x.val[:,i]) in [2,976] and 1 in x.val[:,i] for i in range(len(x...
hilaryfinucane/ibd
find_f2.py
find_f2.py
py
398
python
en
code
0
github-code
13
31514826840
import datetime from django.db import models from main.globals import UNSW_LATITUDE, UNSW_LONGITUDE class Message(models.Model): text = models.EmailField(max_length=100) time = models.DateTimeField(auto_now_add=True) sentFrom = models.ForeignKey('registration.FingrUser', related_name='sent_from_fingruser'...
joelbrady/unswfingr
main/models.py
models.py
py
1,253
python
en
code
0
github-code
13
24610691866
class MyList(): def __init__(self, list1, list2): self.list1 = list1 or [0] self.list2 = list2 or [0] def chack_digits(self) -> bool: """ Submitted list's numbers must be upper from 0 and lower from 9 :return: """ joinded_lists = self.list1 + self.lis...
aliabdullahsadikov/E24-test-task
main.py
main.py
py
1,942
python
en
code
0
github-code
13
7147413529
import csv import hashlib import inspect import logging from numbers import Number from namespace import * import codecs import os import petl as etl import re from loader.prefixes import PREFIX_LANGUAGE, PREFIX_MULTIMEDIA from lxml import etree from petl.util.base import Table from rdflib import Literal, RDF, RDFS, ...
gwu-libraries/vivo-load
loader/utility.py
utility.py
py
12,977
python
en
code
1
github-code
13
19482061515
import logging from hashlib import shake_128 from typing import Optional, List, Dict, Union import os from flask import current_app from sqlalchemy.dialects import postgresql from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.sql.elements import TextClause from sqlalchemy.sql.selectable import Se...
ooni/backend
api/ooniapi/database.py
database.py
py
3,111
python
en
code
43
github-code
13
30796309117
#!/usr/bin/env python3 __version__ = "0.1.0" from nlp_00 import nlp_005 """ 05. n-gram 与えられたシーケンス(文字列やリストなど)からn-gramを作る関数を作成せよ. この関数を用い,”I am an NLPer”という文から単語bi-gram,文字bi-gramを得よ. """ def test_char_bi_gram(): arg = "I am an NLPer" expected = ["I ", " a", "am", "m ", " a", "an", "n ", " N", "NL", "LP", "Pe...
bulldra/nlp100
tests/nlp_00/test_nlp_005.py
test_nlp_005.py
py
734
python
en
code
0
github-code
13
33346152130
class Solution: def search(self, nums: List[int], target: int) -> int: left, right = 0, len(nums) - 1 while left < right: mid = left + (right - left) // 2 if (nums[0] <= target) ^ (nums[0] <= nums[mid]) ^ (target <= nums[mid]): ...
BradleyGenao/LeetCode-Solutions
33-search-in-rotated-sorted-array/33-search-in-rotated-sorted-array.py
33-search-in-rotated-sorted-array.py
py
447
python
en
code
0
github-code
13
7517027682
from contextlib import contextmanager from functools import wraps import threading T = threading.local() def check(ret): if ret is not None: raise ValueError('A deferred call returned a value; this should never happen') @contextmanager def defer(): try: T.QUEUE = [] yield finally:...
andyljones/boardlaw
pavlov/stats/deferral.py
deferral.py
py
644
python
en
code
29
github-code
13
2449043287
class Solution: def pivotIndex(self, nums: List[int]) -> int: pivot = -1 temp = 0 length = len(nums) presum = [0] # building presum for num in nums: temp += num presum.append(temp) # finding the pivot for i in range(1,length+1):...
asnakeassefa/A2SV_programming
0724-find-pivot-index/0724-find-pivot-index.py
0724-find-pivot-index.py
py
445
python
en
code
1
github-code
13
3083151605
import os import io import json import base64 import shutil import tempfile import logging as logger import urllib.request import urllib.error from urllib.parse import quote from PIL import Image from datetime import date, datetime from wsgiref.handlers import format_date_time import docker WAYBACK_TS_FORMAT = '%Y%m%d...
ukwa/webrender-api
webrender/puppeteer/docker.py
docker.py
py
12,353
python
en
code
0
github-code
13
7189285960
from pathlib import Path from auto_argparse import parse_args_and_run_dec from .planner import convert_to_pddl @parse_args_and_run_dec def convert_pdkbddl(pdkbddl_path: str): """ Convert a PDKBDDL file to PDDL domain and problem files. The output files will be named {name}_domain.pddl and {name}_prob.pd...
neighthan/pdkb-planning
pdkb/scripts.py
scripts.py
py
728
python
en
code
0
github-code
13
3617463718
# Euclid's Extended Algorithm computes GCD # and the coefficents of Bezout's identity def eucalg(a, b): # make a the bigger one and b the lesser one swapped = False if a < b: a, b = b, a swapped = True # ca and cb store current a and b in form of # coefficients with initial a and b # a' = ca[0] * a + ca[1] * ...
ThomasNJordan/GCI-Cryptography
EEuclid.py
EEuclid.py
py
686
python
en
code
0
github-code
13
7900261139
import numpy as np import tensorflow as tf from network import neural_network from load_2d_dataset import load_2d_dataset from matplotlib import pyplot as plt dataset = load_2d_dataset() x_arr = np.around(np.arange(-1, 1.001, 0.01), decimals=2) res_img = np.zeros([x_arr.shape[0], x_arr.shape[0]]) t_d = np.zeros([x_a...
4m4npr33t/UnifiedANN_PDE
test_2d_model.py
test_2d_model.py
py
1,379
python
en
code
1
github-code
13
21469519685
global db_autor, db_user, db_prest, db_libro, db_categoria #funzioni per creare i vari dizionari def autor(): db_autor = { "nome": [], "cognome": [], "anno": [], "note": [], "id": [] } return db_autor def user(): db_user = { "nome": [], "cognome": [], ...
Sbeir/Python_SQLite_Exam
esame_ufs01/Biblio/create_db.py
create_db.py
py
994
python
uz
code
0
github-code
13
41985444811
def tester(ls, targ1, targ2): for i in range(len(ls)-1): if ls[i] == targ1 and ls[i+1] == targ2 or ls[i] == targ2 and ls[i+1] == targ1: return True return False print("should be False: ", tester([3,1,0,19,4], 19, 5)) print("should be True: ", tester([3,1,0,19], 19, 0)) def tester2...
ToddGallegos/CodingTemple
week_3_day_4/whiteboard.py
whiteboard.py
py
621
python
en
code
2
github-code
13
72340130899
import importlib, webbrowser, datetime, logging, script from time import sleep from keyboard import read_key try: import save except ModuleNotFoundError: with open('save.py', 'w') as save: save.write(script.data) exit() class LogHandler(): def __init__(self): self.day = datetime.date.to...
Glitcher85/web-shortcut
code/web-shortcut.py
web-shortcut.py
py
2,826
python
en
code
4
github-code
13
73006058259
#!/usr/bin/python import sys import math import copy import random sys.setrecursionlimit(10000) class player: def __init__(self,PlayerSymbol): self.PlayerSymbol=PlayerSymbol def GetPlayerSymbol(self): return self.PlayerSymbol class board: def __init__(self): self.grid = [['-' for x in range(3)] for y in r...
hammadwaseem3/Tic-tac-tow-Monte-Carlo-Tree-Search-
tic-tac-tow.py
tic-tac-tow.py
py
5,216
python
en
code
0
github-code
13
21989017677
import os from kedro.pipeline import Pipeline, node, pipeline #import kedro #import numpy as np import re #import h5py from tqdm import tqdm import torch import torch.nn as nn import yaml import pytorch_lightning as pl from pytorch_lightning.callbacks import LearningRateMonitor, EarlyStopping, ModelCheckpoint from pyt...
RolandGit95/FromSurface2DepthKedro
src/pydiver/pipelines/training/pipeline.py
pipeline.py
py
4,298
python
en
code
1
github-code
13
42221756020
""" Author: Corey R. Randall (08 June 2018) Description: This is an external function that calculates fluxes with the Dusty Gas Model approach. It was written to be used in 2D_NRSupport_FluxModel. """ def Flux_Calc(SV,Nx,dX,Ny,dY,Nspecies,BC_in,inlet_BC,gas,phi_g,tau_g,d_p): impor...
decaluwe/2D-porous-flux-model
DGM_func.py
DGM_func.py
py
2,991
python
en
code
7
github-code
13
21293391739
import math people = int(input()) tax = float(input()) deck_chair_price = float(input()) umbrella_price = float(input()) all_tax = people * tax deck_chair_total_price = math.ceil(people * 0.75) * deck_chair_price umbrella_total_price = math.ceil(people / 2) * umbrella_price total_sum = all_tax + deck_chair_total_pri...
SJeliazkova/SoftUni
Programming-Basic-Python/Exams/Exam_6_7_July_2019/01. Pool Day.py
01. Pool Day.py
py
376
python
en
code
0
github-code
13
22984465728
import setuptools with open("README.md", "r") as fh: long_description = fh.read() with open("requirements.txt", "r") as f: requirements = f.read().splitlines() setuptools.setup( name="apluslms_file_transfer", version="0.1", author="Qianqian Qin", author_email="qianqian.qin@outlook.com", d...
apluslms/apluslms-file-transfer
setup.py
setup.py
py
952
python
en
code
0
github-code
13
1946591821
# Write a program that receives a number and creates the following pattern. The number represents the largest # count of stars on one row. # * # ** # *** # ** # * biggest_row = int(input()) for i in range(biggest_row + 1): print("*"*i) for i in range(biggest_row - 1, 0, -1): print("*"*i)
dnkirkov/SoftUni_Python_Fundamentals
Patterns.py
Patterns.py
py
311
python
en
code
0
github-code
13
42000005782
# # @lc app=leetcode.cn id=13 lang=python3 # # [13] 罗马数字转整数 # 先计算其他位的结果, 最后单独处理最后一位 # Time: O(n) Space: O(1) # @lc code=start class Solution: def romanToInt(self, s: str) -> int: # 算是题目给出的条件, 不计入空间复杂度 roman = { "I": 1, "V": 5, "X": 10, "L": 50, ...
WeiS49/leetcode
Solution/其他/其他/13. 罗马数字转整数/哈希表.py
哈希表.py
py
786
python
zh
code
0
github-code
13
23111482040
# -*- coding: utf-8 -*- """ Created on Fri May 31 11:50:54 2019 @author:Pablo La Grutta pablo.lg@hotmail.com.ar """ import tkinter as tk from tkinter import ttk, StringVar,scrolledtext as st from tkinter.ttk import Style from tkinter.filedialog import askopenfilename, askdirectory from tkinter.messagebox import showi...
pablolagrutta127/DAT_Mastikator
DAT_Cnv_1.0.py
DAT_Cnv_1.0.py
py
3,914
python
en
code
0
github-code
13
72859193298
import struct import time import numpy as np import matplotlib.pyplot as plt #fig,ax = plt.subplots(2,5) #ax=ax.flatten() def Normalize(data): m = np.mean(data) mx = max(data) mn = min(data) return np.array([(float(i) - m) / (mx-mn) for i in data]) def loadmnist(): with open("/home/vr/mnist/t...
fishfreetaken/orange
pyspider/learnmnist.py
learnmnist.py
py
3,021
python
en
code
1
github-code
13
17127060565
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('university_dashboard', '0001_initial'), ] operations = [ migrations.AlterField( model_name='university', ...
LuisBosquez/student-net-2015
src/university_dashboard/migrations/0002_auto_20150221_1631.py
0002_auto_20150221_1631.py
py
455
python
en
code
0
github-code
13
15076793671
from morse import * message1 = "abcdefghijklmnopqrstuvwxyz" message2 = "Live long and prosper!" message3 = "May the force be with you!" message4 = "Never give up, never surrender!" texts = [message1,message2,message3,message4] Done = False count = 0 compthink() #computer thinking docode("hello") #sa...
mrklingon/neotrinkey
DoMorse.py
DoMorse.py
py
822
python
en
code
0
github-code
13
4682781622
''' Print largest word from the sentence. Input: Sentence(string) Output: Largest word from the string. ''' # output = max(input("Enter your sentence: ").split(sep=" ")) # print(output) #using function def largestword(sentence): words = sentence.split(sep=" ") stringlen...
SatyasaiNandigam/competitive-coding-solutions
Wipro CodingQuestions/5.py
5.py
py
529
python
en
code
0
github-code
13
28127519852
from .Player import Player import sys import random sys.path.append('../') from streamy import stream from const import * from rule_checker import rule_checker, get_opponent_stone, get_legal_moves from board import make_point, board, get_board_length, make_empty_board, parse_point from utils import * def generate_ran...
MicahThompkins/go_project
Deliverables/10/10.1/tournament/player_pkg/GenericPlayer.py
GenericPlayer.py
py
9,178
python
en
code
0
github-code
13
33211985692
import json import xmltodict import os import argparse def convert_xml_to_json(xml_file_path): # Derive JSON file path from XML file path base = os.path.splitext(xml_file_path)[0] json_file_path = base + '.json' with open(xml_file_path, 'r') as xml_file: xml_dict = xmltodict.parse(xml_file.rea...
MultiREM/multiREM
utils/convert_xml_to_json.py
convert_xml_to_json.py
py
840
python
en
code
2
github-code
13
26710901295
import pygame,sys,random from Tkinter import * from pygame.locals import * import time black=(0,0,0) white=(255,255,255) blue=(0,0,255) green=(0,255,0) red=(255,0,0) cyan=(0,255,255) mixed_cyan=(60,255,255) gray=(230,230,230) navyBlue=( 60, 60, 100) lightNavyBlue=(130,130,200) yellow=(255,255,0) purple=(255,0,255) ora...
saqib1707/pyGame
memoryPuzzle.py
memoryPuzzle.py
py
12,814
python
en
code
1
github-code
13
74509166097
""" https://www.pyimagesearch.com/2015/11/16/hog-detectmultiscale-parameters-explained/ --image switch is the path to our input image that we want to detect pedestrians in. --win-stride is the step size in the x and y direction of our sliding window. --padding switch controls the amount of pixels the ROI is padded...
ilkayDevran/Traffic_Sign_Recognition
HOG implementation/main_hog.py
main_hog.py
py
3,671
python
en
code
0
github-code
13
19734569129
import bpy from bpy.types import Operator from bpy.props import FloatVectorProperty, FloatProperty, BoolProperty from bpy_extras.object_utils import AddObjectHelper, object_data_add from mathutils import Vector def add_object(self, context): if self.use_plane: verts = [ Vector((0, 0, 0)), ...
AnastasiiSh/AnastasiiSh.github.io
IfcOpenShell/src/ifcblenderexport/blenderbim/bim/module/model/wall.py
wall.py
py
2,032
python
en
code
0
github-code
13
11286045860
""" N x N maze game find a path between upper left and bottom right """ from pprint import pprint class MazeGame(object): def __init__(self, matrix): self.matrix = matrix self.N = len(matrix) self.sol_matrix = self._get_original_maze() def sol_maze(self, i, j): """ solve maze Args: i (int): the row...
zikangyao/algorithm
backtracking/n_x_n_maze.py
n_x_n_maze.py
py
1,399
python
en
code
0
github-code
13
13020928892
""" ## Part 3: Data Preparation In this section the raw data is prepared and reshaped to be fed into the different models. Furhtermore, the distribution of the input data is visualized to check if the data set is balanced. The data is converted into two main variables X (patiens and the coresponding protein quantities)...
cewinharhar/BECS2_dataChallenge
part3.py
part3.py
py
1,540
python
en
code
0
github-code
13
71808976338
from typing import Union from django.forms import TextInput, NumberInput from django.db.models.aggregates import Max from django.test import TestCase from online_store.forms import AddDeliveryForm, AddOrderInBasket, OrderCreationMultiForm, OrderForm from online_store.models import Product, Collection, TypeClothing, Or...
ALEXsawb/CHEAP.P
CheapSh0p/tests/test_online_store/test_forms.py
test_forms.py
py
9,762
python
en
code
0
github-code
13
16601843445
calculation_to_units = 24 name_of_unit = "hours" def calculation(a): if a > 0: return (f"{a} days are {calculation_to_units * a} {name_of_unit}") if a == 0: return "You entered 0. Please enter a valid number." else: return ("You entered a negative value") user_input = input("En...
Zeeshan1920/python_practice
YouTube Course/conditions.py
conditions.py
py
412
python
en
code
0
github-code
13
27706521315
import re regexes = [re.compile(p) for p in ['this','that']] text = "Does this text match the partten" for regex in regexes: print('Seeking "{}" ->'.format(regex)) if regex.search(text): print('match!') else: print('no match')
Highsir/Python3_stdlib
Python3标准库/First_text/1_17.re_simple_compiled.py
1_17.re_simple_compiled.py
py
258
python
en
code
0
github-code
13
17934668505
from django.contrib import admin from django.urls import path, include from .views import PostList, PostDetail, PostListDetailfilter,CreatePost,AdminPostDetail,EditPost,DetelePost,CommentDetail app_name = 'blog_api' urlpatterns = [ path('posts/', PostDetail.as_view(), name='detailcreate'), path('', PostList.as_...
hungthe-opn/thehung.github.io
blog_api/urls.py
urls.py
py
794
python
en
code
0
github-code
13
42081303056
def solution(str1, str2): answer = 2 for i in range(len(str1)-len(str2)+1): a=len(str2) for j in range(len(str2)): if str1[i+j]==str2[j]: a-=1 else: break if a==0: answer =1 return answer
HotBody-SingleBungle/HBSB-ALGO
HB/pysrc/프로그래머스/레벨0/Day18/문자열안에_문자열.py
문자열안에_문자열.py
py
304
python
de
code
0
github-code
13
29524767639
#In enumerate function show the index value with the item in listor topple items=['alu','potol','shak'] for index,item in enumerate(items): print(f"{index}->{item}") #you have to sent a one list and one string then if you find the that string in this list then return the list position . #if you not find then retur...
milton9220/Python-basic-to-advance-tutorial-source-code
enumerate_function.py
enumerate_function.py
py
526
python
en
code
0
github-code
13
5718603886
#!/usr/bin/env python # -*- coding: UTF-8 -*- import sublime import sublime_plugin from io import StringIO import tokenize import argparse import json import sys import os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import local_keywords def __collect_name(name_stack, names): if len(name_stack)...
qiuxfeng1985/geecode-sublime-plugin
geecode_keywords.py
geecode_keywords.py
py
3,660
python
en
code
0
github-code
13
4177898318
from datetime import datetime import uuid from sqlalchemy.orm.session import Session from src.schemas.log_info import LogInfo from ..models.log_info import LogInfoModel, model_to_entity, entity_to_model from ..models.raw_log import RawLogModel class LogInfoRepository: session: Session def __init__(self, se...
KeepError/TenderHackKazan23-Backend
src/postgres/repositories/log_info.py
log_info.py
py
1,962
python
en
code
0
github-code
13
13985248163
# 8 puzzle import copy import time class Node: size = 3 empty = '0' last_info = [] def __init__(self, info): self.info = info # cheia nodului self.h = self.estimate_cost() # estimarea pentru nod self.suc = [] # lista de succesori self.index = self.find_empty_index(...
Loila11/fmi
Licenta 2/AI/8-puzzle/main.py
main.py
py
5,392
python
en
code
0
github-code
13
25297163640
from django.urls import path, re_path from species.api_views.upload_species import ( SaveCsvSpecies, SpeciesUploader, UploadSpeciesStatus, ) from .views import ( TaxonFrontPageListAPIView, TaxonListAPIView, TaxonTrendPageAPIView ) urlpatterns = [ path('api/species/front-page/list/', TaxonF...
kartoza/sawps
django_project/species/urls.py
urls.py
py
944
python
en
code
0
github-code
13
31321754974
from abc import ABC, abstractmethod from jabberjaw import utils from jabberjaw.utils import mkt_classes from jabberjaw.utils.mkt_classes import MktCoord, get_coord_default_source from jabberjaw.data_manager import mkt_data_manager as dm import datetime import dpath.util as dp class Marketiser(ABC): """ a class use...
imry-rosenbuam/jabberjaw
jabberjaw/data_manager/marketiser.py
marketiser.py
py
3,327
python
en
code
0
github-code
13
8029146998
# Will create an xml file for a whole folder of pictures (.jpg, .png, and .bmp) import os #===========================<Function library>================================== def initXML(ofile, loc): ofile.write('<background>\n\n\t<starttime>\n\t\t<hour>0</hour>') ofile.write('\n\t\t<minute>00</minute>\n\t\t<seco...
adutta/bgSlideshow
delbg.py
delbg.py
py
2,240
python
en
code
2
github-code
13
73488229457
# There is an ATM machine that stores banknotes of 5 denominations: 20, 50, 100, 200, and 500 dollars. Initially the ATM is empty. # The user can use the machine to deposit or withdraw any amount of money. # When withdrawing, the machine prioritizes using banknotes of larger values. # For example, if you want to w...
aslamovamir/LeetCode
design_an_ATM_machine.py
design_an_ATM_machine.py
py
4,845
python
en
code
0
github-code
13
1615180940
from openpyxl import load_workbook import pandas as pd import geopandas import matplotlib.pyplot as plt import sys,os sys.path.insert(1, os.path.join(sys.path[0], '..')) import funcs years=["schools2018.xlsx","schools2019.xlsx"] base = geopandas.read_file('../Ireland.GeoJSON') for year in years: wb = load_workbo...
euanleith/schools
graphs/map.py
map.py
py
1,238
python
en
code
0
github-code
13
30968477274
import getpass import os import sys import time import pandas as pd import tms_login as tms from datetime import date, datetime, timedelta from selenium import webdriver from selenium.webdriver.common.keys import Keys # check if on citrix ('nt') or pi if os.name == 'nt': #set to chrome defualt download folder - B...
boalogistics/auto-report
loadsinvoiced.py
loadsinvoiced.py
py
3,493
python
en
code
0
github-code
13
32136811328
import pickle import tensorflow import pandas as pd import re from tensorflow.keras.preprocessing.sequence import pad_sequences # read the model objects for predictions with open("./models/recomm.pickle", "rb") as file: recomm_matrix = pickle.load(file) with open("./models/tokenizer.pickle", "rb") as file: to...
abhishek-74/capstone
model.py
model.py
py
2,911
python
en
code
0
github-code
13
19220660665
""" Various fitness functions to control the specimen selection in the reproduction stage """ import abc import math from path_finder.chromosome import Chromosome from path_finder.grid import GridWrapper from path_finder.point import distance class Fitness(abc.ABC): """ A fitness function """ def __i...
galbash/genetic-algo-grid-path
path_finder/fitness.py
fitness.py
py
4,450
python
en
code
0
github-code
13
28596924770
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 28 16:11:03 2023 @author: Dartoon """ import numpy as np import astropy.io.fits as pyfits import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") import glob, pickle from galight.tools.cutout_tools import psf_clean from as...
dartoon/my_code
projects/2022_COSMOSweb/0_build_PSF_library.py
0_build_PSF_library.py
py
6,988
python
en
code
0
github-code
13
10472743106
import sys import PyQt5.QtWidgets as QtWidgets from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QApplication, QMessageBox, QAction, QFileDialog from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor import vtk from models import model from models_bezier import model_bezier class MainWindow(o...
James0231/Data-Visualization-PJ
GUI.py
GUI.py
py
13,920
python
en
code
5
github-code
13
19334297026
import bz2 import csv import errno import os from typing import Any, List def ensure_exists(file_path: str) -> None: path: str = os.path.dirname(file_path) try: os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: raise def file_exists(path: str) -> bool: r...
mhowell234/robinhood_commons
robinhood_commons/util/io_utils.py
io_utils.py
py
989
python
en
code
0
github-code
13
1246720985
""" Read server.py first, and heed the warning there """ import asyncio from threading import Lock import queue import logging import itertools from .server import Room, GameScheduler from .utils import generate_id from .othello_core import BLACK, WHITE, EMPTY, OUTER from ..apps.tournament.models import GameModel, Se...
duvallj/othello_tourney
othello/gamescheduler/tournament_server.py
tournament_server.py
py
16,101
python
en
code
1
github-code
13
6478526201
from turtle import Turtle, Screen t = Turtle() t.shape("turtle") for sides in range(3, 11): angles = 360 /sides for i in range(sides): t.forward(100) t.right(angles) screen = Screen() screen.exitonclick()
Mohammad-Shiblu/Python_project
python turtle graphics/Drawing_different_shape.py
Drawing_different_shape.py
py
241
python
en
code
0
github-code
13
3713001752
import numpy as np try: import cm #dev except: import cloudmrhub.cm as cm #runtime import matplotlib.pyplot as plt import scipy from types import MethodType class cm2DRecon(cm.cmOutput): """ Python implementation of the cm2DRecon MATLAB class :author: Dr. Eros Montin, Ph.D. <eros.m...
cloudmrhub-com/cloudmrhub
cloudmrhub/cm2D.py
cm2D.py
py
38,909
python
en
code
0
github-code
13
30478730301
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Importing libraries # import tensorflow as tf import os import time import numpy as np import pickle # load and show an image with Pillow from PIL import Image # import flask, flask_bootstrap, werkzeug from flask import Flask, request, redirect, url_for, render_templat...
fabiogeraci/heroku
app.py
app.py
py
3,660
python
en
code
0
github-code
13
19770400014
""" An example model that has double the number of convolutional layers that DeepSEA (Zhou & Troyanskaya, 2015) has. Otherwise, the architecture is identical to DeepSEA. When making a model architecture file of your own, please review this file in its entirety. In addition to the model class, Selene expects that `crite...
snwessel/NeuralNetworksForGWAS
models/deeplift.py
deeplift.py
py
2,176
python
en
code
0
github-code
13
74936008656
import os import sys import click from flask import Flask,render_template from flask_sqlalchemy import SQLAlchemy WIN=sys.platform.startswith('win') if WIN: #如果是windows系统 prefix='sqlite:///' else: #其它系统 prefix='sqlite:////' app=Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = prefix + os.path.join(a...
Tensiont/dictionary
app.py
app.py
py
2,733
python
en
code
0
github-code
13
28560367752
__all__ = [ 'HasLayout', 'MatchesAncestry', 'ContainsNoVfsCalls', 'ReturnsUnlockable', 'RevisionHistoryMatches', ] from bzrlib import ( osutils, revision as _mod_revision, ) from bzrlib import lazy_import lazy_import.lazy_import(globals(), """ from bzrlib.smart.request import reques...
ag1455/OpenPLi-PC
pre/python/lib/python2.7/dist-packages/bzrlib/tests/matchers.py
matchers.py
py
6,664
python
en
code
19
github-code
13
23028283029
rule_file = open("grammar_wsj_cnf_top_2500.txt") rule_file_nt = open("grammar_wsj_cnf.txt") rules_orig = [] for r in rule_file.readlines(): rules_orig.append(r) rules_nt = [] for r in rule_file_nt.readlines(): rules_nt.append(r) rule_map = {} for idx,r in enumerate(rules_orig): if r in rules_nt: ...
anshuln/Diora_with_rules
rulesets/data_preprocessing/Basic-CYK-Parser/map_non_terminal_rules.py
map_non_terminal_rules.py
py
508
python
en
code
4
github-code
13
15706684074
from django.db import models from django.contrib.auth.models import AbstractUser from utils.models import BaseModel # Create your models here. class User(AbstractUser): mobile = models.CharField(max_length=11, unique=True, verbose_name='手机') # 这里外键关联的是下面定义的,如果不用引号则会陷入循环调用不到的,因为他们2个彼此调用对方,所以用引号可以解决这问题。 def...
juehuan182/MeiduoShopping
meiduo_mall/users/models.py
models.py
py
2,811
python
en
code
0
github-code
13
20399789982
#!/usr/bin/env python3 import json import numpy from types import SimpleNamespace import subprocess import pandas as pd class Empty(SimpleNamespace): def __getattr__(self, name): setattr(self, name, Empty()) return getattr(self, name) class OrbitalElements: def __init__(self, semiMajorAxis:float...
przecze/pytudat
pytudat.py
pytudat.py
py
2,308
python
en
code
0
github-code
13
31576091782
import numpy as np arr =[ [1,2,0,0,0], [1,0,0,0,0], [1,0,0,0,0], [1,0,0,0,0], [0,0,0,0,0] ] arr_n = np.array(arr) arr_n90 = np.rot90(arr_n) arr_n180 = np.rot90(arr_n90) arr_n270 = np.rot90(arr_n180) arr_n_lr = np.fliplr(arr_n) arr_n90_lr = np.fliplr(arr_n90) arr_n180_lr...
gyeomii/DDITBasicAI
day25/myaug.py
myaug.py
py
514
python
en
code
0
github-code
13
30842082157
import copy import ctypes import os import pickle import struct from collections import OrderedDict from ctypes import cdll import numpy as np from sklearn.model_selection import train_test_split from torchvision import datasets, transforms import torch from sampling import cifar_iid, cifar_noniid, mnist_iid, mnist_n...
MJXXGPF/SecureAggregation_GPF
client/utils.py
utils.py
py
14,040
python
en
code
0
github-code
13
22592578539
import subprocess import logging import os logger = logging.getLogger(__name__) def get_cmd_stdout(cmd, log_func=print, check=True, cmd_dir=None, cmd_env=None, quiet=False): is_shell = isinstance(cmd, str) cmd_str = ' '.join(cmd) if not is_shell else cmd if not quiet: logger.info('run shell comm...
JackonYang/web-shell
utils/shell_runner.py
shell_runner.py
py
4,018
python
en
code
0
github-code
13
17045553754
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOverseasTravelFliggyShopTransferModel(object): def __init__(self): self._data = None self._open_id = None self._unique_id = None self._user_id = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayOverseasTravelFliggyShopTransferModel.py
AlipayOverseasTravelFliggyShopTransferModel.py
py
2,774
python
en
code
241
github-code
13
37655061384
import tensorflow.compat.v1 as tf import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import tensorflow as tf import matplotlib.pyplot as plt import numpy as np class lg_dataset: def __init__(self): self.train_size=2000 self.train_param1=tf.random.uniform([100],minval=2,maxval=10) self.train...
DextroLaev/Machine-Learning-And-Deep-Learning
Basic ML ALgo/SVM/svm.py
svm.py
py
3,814
python
en
code
1
github-code
13
36724937202
from core.robot import get_robot_wrapper, Shelf from py_trees.behaviour import Behaviour from core.logger import log, LogLevel from py_trees.common import Status import numpy as np """ Drive forward until the object is within grabbing range. """ class DriveToWithinRangeOfTarget(Behaviour): def __init__(self, nam...
tannerleise/RoboticsFinal
final_project/controllers/grocery_shopper/behavior/drive_to_within_range_of_target.py
drive_to_within_range_of_target.py
py
1,554
python
en
code
0
github-code
13
25213558328
import numpy as np import pandas as pd import re from pitci.base import LeafNodeScaledConformalPredictor import pitci import pytest from unittest.mock import Mock class DummyLeafNodeScaledConformalPredictor(LeafNodeScaledConformalPredictor): """Dummy class inheriting from LeafNodeScaledConformalPredictor so it'...
richardangell/pitci
tests/base/test_LeafNodeScaledConformalPredictor.py
test_LeafNodeScaledConformalPredictor.py
py
19,186
python
en
code
7
github-code
13
10438095906
# #START_LICENSE########################################################### # # # This file is part of the Environment for Tree Exploration program # (ETE). http://etetoolkit.org # # ETE is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the...
dongzhang0725/PhyloSuite
PhyloSuite/ete3/parser/fasta.py
fasta.py
py
4,449
python
en
code
118
github-code
13
35554795465
import requests from pyquery import PyQuery as pq from flask import Flask import re import time import json sess = requests.session() def search_company(keywords, longi=None, lati=None, dis=None, biztype=None, beginPage=1)...
weiyinfu/java-python-crawler
tao/使用requests.py
使用requests.py
py
2,500
python
en
code
4
github-code
13
14547996265
# -*- coding: utf-8 -*- # @Time : 2020/11/22 12:56 # @Author : ooooo from typing import * class Solution: def isAnagram(self, s: str, t: str) -> bool: m = dict() for i in s: if i in m: m[i] += 1 else: m[i] = 1 for i in t: ...
ooooo-youwillsee/leetcode
0000-0500/0242-Valid-Anagram/py_0242/solution1.py
solution1.py
py
670
python
en
code
7
github-code
13
10441630462
from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class InitializingWP(WaitPage): wait_for_all_groups = True class ScoreWP(WaitPage): def after_all_players_arrive(self): self.group.sum_score() self.group.ranking_for_groups(...
manumunoz/Switch_Ranking_ES
given_type/pages.py
pages.py
py
513
python
en
code
0
github-code
13
42231041902
# filebot.py import os import json from difflib import get_close_matches from unidecode import unidecode import logging class FileBot: def __init__(self, qa_pairs_file='qa_pairs.json'): self.qa_pairs_file = qa_pairs_file self.qa_pairs = self.load_qa_pairs() def preprocess_text(self, text): ...
gustavojskk/chat-bot
filebot.py
filebot.py
py
3,102
python
pt
code
0
github-code
13
70038531218
import cv2 import numpy as np import AIT1000_walkman def box_bounding_to_box_center(box_bounding): """ 用于把输入的边界值转换为中心点的xy坐标以及box的高度和宽度 box_bounding:[left, top, right, bottom] :param box_bounding: 边界值 :return: 中心点的xy坐标以及box的高度和宽度 """ center_x = (int(box_bounding[0]) + int(box_bounding[2])) ...
fromthefox/Pedestrian-distance-prediction-based-on-Kalman-filtering
AIT1000_kalman.py
AIT1000_kalman.py
py
11,951
python
zh
code
1
github-code
13
38659326962
import pickle import numpy as np import os import matplotlib.pyplot as plt import cv2 from scipy import misc def map_loss(dot_org_img,x,y,size,feature_value): return np.sum(dot_org_img[x:x+size,y:y+size]) - feature_value channel_map_list = pickle.load(open('feature_map_list.p','rb')) final = np.zer...
pohanchi/2018_DSP_FINAL_Mosaic
DSP/DSP/mapping.py
mapping.py
py
2,184
python
en
code
0
github-code
13
28188254585
from misc import allstrings,functions from misc.dbfunctions import WebtyDb import datetime,ntplib,time,os,sys from PyQt4 import QtGui,QtCore class TimeMonitor(): def __init__(self): self.currentTime = '' self.allowedTimeBackdatedInSeconds = functions.calculateAllowedTimeInSeconds(numOfMins=20) ...
brownharryb/webtydesk
time_monitor.py
time_monitor.py
py
3,529
python
en
code
0
github-code
13
30753449238
import json import pymysql import boto3 def get_meme_by_id(event, context): # Fetch RDS connection details from Parameter Store parameter_store = boto3.client('ssm') rds_host = parameter_store.get_parameter(Name='memify-db-url')['Parameter']['Value'] username = parameter_store.get_parameter(Name='memif...
AjdinBajric/memify-backend
memes/get-by-id/handler.py
handler.py
py
2,283
python
en
code
0
github-code
13
7858934564
# -*- coding: utf-8 -*- """ A helper module to work with CloudWatch Logs Group, Stream, put log events, and query logs insights. Requirements: - Python: 3.7+ - Dependencies: # content of requirements.txt boto3 func_args>=0.1.1,<1.0.0 Usage: .. code-block:: python from aws_cloudwatch_logs_insights...
MacHu-GWU/fixa-project
fixa/aws/aws_cloudwatch_logs_insights_query.py
aws_cloudwatch_logs_insights_query.py
py
16,721
python
en
code
0
github-code
13
73295909776
from collections import defaultdict from datetime import datetime, timedelta, timezone from connect.client import ConnectClient, R TCR_UPDATE_TYPE_MAPPING = { 'setup': 'new', 'update': 'update', 'adjustment': 'update', } def remove_properties(obj: dict, properties: list): for prop in properties: ...
cloudblue/extension-xv-datalake
connect_ext_datalake/services/payloads.py
payloads.py
py
7,774
python
en
code
1
github-code
13
12051054872
#!/usr/bin/env python # coding: utf-8 # In[2]: import numpy as np import sklearn as sk from sklearn import ensemble from sklearn import tree from sklearn.metrics import accuracy_score import graphviz import pandas as pd import seaborn as sns import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', ...
sawantprajakta/Machine_Learning
MachineLearning/Supervised_Algorithms/EnsembleAlgorithm_RandomForest(using mails dataset).py
EnsembleAlgorithm_RandomForest(using mails dataset).py
py
3,446
python
en
code
0
github-code
13
70160337937
# coding=utf8 """Finite analog input task with a reference trigger. Demo script for acquiring a finite (but unknown) number of analog values with a National Instruments DAQ device, where both the start and end of the acquisition is given by triggers. To test this script, the NI MAX (Measurement & Automation Explorer...
itom-project/plugins
niDAQmx/demo/demo_ai_finite_ref_trigger.py
demo_ai_finite_ref_trigger.py
py
4,233
python
en
code
1
github-code
13
34794687539
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #Reference: https://github.com/rm-hull/luma.examples from pathlib import Path from PIL import Image from luma.core.interface.serial import i2c from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106 import time import threading try: serial = i2c(port=1, addre...
adeept/adeept_OLED
2_pi_logo.py
2_pi_logo.py
py
1,113
python
en
code
2
github-code
13
73961871056
import json from ast import literal_eval from pathlib import Path import numpy as np from minibuilder.file_config.parts import load_json def find_vertices(mesh, *args): li = [] if len(args[0]) == 3: for i, (x, y, z) in enumerate(mesh.vertices): for value in args: check =...
LeoGrosjean/minibuilder_old
minibuilder/utils/mesh_config.py
mesh_config.py
py
5,904
python
en
code
3
github-code
13
31015613953
#-*- codeing=utf-8 -*- #@time: 2020/8/19 12:52 #@Author: Shang-gang Lee import build_model import ProcessingData import training import pandas as pd import torch if __name__ == '__main__': # data train_data = pd.read_csv(r'.\data\raw\in_domain_train.tsv', delimiter='\t'...
shanggangli/Research-in-NLP
BertForSenquenceClassification/main.py
main.py
py
1,317
python
en
code
0
github-code
13
25306710446
""" This script allows plotting the surface of the bed. """ import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import random # With reset of probe points = [{'Y': 0.0, 'X': 0.0, 'Z': 0.0}, {'Y': 0.0, 'X': 50.0, 'Z': -3.7500000000000207e-05}, {'Y': 50.0, 'X': 0.0, 'Z': 4.99999...
Sciumo/redeem
tools/bed_compensation.py
bed_compensation.py
py
1,480
python
en
code
0
github-code
13
19442373257
from past.builtins import basestring import json import logging import pika # This module provides functions and constants to implement the core protocol # used by the timer, dispatcher, and ETL services. ANNOUNCE_SERVICE_EXCHANGE = 'mettle_announce_service' ANNOUNCE_PIPELINE_RUN_EXCHANGE = 'mettle_announce_pipeline...
yougov/mettle-protocol
mettle_protocol/messages.py
messages.py
py
10,076
python
en
code
0
github-code
13
19496235018
#!/usr/bin/env python3 import argparse, urllib.request, os, sys sqli = ["'", "\"", "`", "and 1=0", "or 1=0", "' and 1=0", "' or 1=0", "\" and 1=0", "\" or 1=0", "`and 1=0", "` or 1=0"] xss = ["'<SCRIPT>alert(0)</SCRIPT>#", "'<SCRIPT>alert(0)</SCRIPT>//", "';alert(String.fromCharCode(88,83,83))//",...
dxeheh/noctule
noctule.py
noctule.py
py
6,335
python
en
code
0
github-code
13
10275853932
from django.db.models.functions import Coalesce from rest_framework import status from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import IsAuthenticated, IsAdminUser from rest_framework.response import Response from django.core.paginator import Paginator, EmptyPage, Pa...
barserkaua/Django_React_ecommerce_project
backend/base/views/product_views.py
product_views.py
py
7,638
python
en
code
0
github-code
13
31269619999
# -*- coding: utf-8 -*- """ Symbolic differentiation of prefix expressions This code calculates derivatives in prefix notation This code only accepts strings of expressions in prefix notation with proper spacing and nested parenthesis indicating the order of operations Expression operators, functions and argumen...
josephcoveai/Projects
derivative calculator.py
derivative calculator.py
py
8,426
python
en
code
0
github-code
13
18028014195
from __future__ import print_function from sklearn import datasets import matplotlib.pyplot as plt import math import numpy as np # Import helper functions from ravdl.neural_networks import NeuralNetwork from ravdl.neural_networks.layers import Conv2D, Dense, Dropout, BatchNormalization, Activation, Flatten from ravd...
7enTropy7/raven_hybrid
CNN_example.py
CNN_example.py
py
2,658
python
en
code
0
github-code
13
29294016638
from collections import Counter input_file = 'day-01/input.txt' def part1(input): counter = Counter(input) return counter['('] - counter[')'] def part2(input): floor = 0 for i, c in enumerate(input, 1): floor += {"(": 1, ")": -1}[c] if floor == -1: return i if __name__ == "__main__": with op...
stevenhorsman/advent-of-code-2015
day-01/not_quite_lisp.py
not_quite_lisp.py
py
426
python
en
code
0
github-code
13
3392894450
import pandas as pd from faker import Faker from IPython.display import display from collections import defaultdict import random from datetime import datetime fake = Faker() select_data = defaultdict(list) pCSV = pd.read_csv("peliculas.csv") pId = list(pCSV["id"]) sCSV = pd.read_csv("sala.csv") sID = li...
alexandermoralesp/Cinemania-BD
Data-Generator/funcion.py
funcion.py
py
1,439
python
en
code
0
github-code
13
37832596001
import numpy as np import pandas as pd from matplotlib import cm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D train = pd.read_json('./data/train.json') test = pd.read_json('./data/test.json') X_band_1 = np.array([np.array(band).astype(np.float32).reshape(75,75) for band in train['band_1']]) ...
p768lwy3/ml_selfstudy
Kaggle/StatoilCCOREIcebergClassifierChallenge/data_visulization.py
data_visulization.py
py
953
python
en
code
0
github-code
13
1071365353
import json import threading import kafka from kafka.client_async import selectors import kafka.errors from oslo_log import log as logging from oslo_utils import eventletutils import tenacity from oslo_messaging._drivers import base from oslo_messaging._drivers import common as driver_common from oslo_messaging._driv...
ualberta-smr/PyMigBench
data/codefile/openstack@oslo.messaging__5a842ae__oslo_messaging$_drivers$impl_kafka.py.source.py
openstack@oslo.messaging__5a842ae__oslo_messaging$_drivers$impl_kafka.py.source.py
py
13,641
python
en
code
3
github-code
13