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
9512060656
import os from pathlib import Path import re import pandas as pd from utils import * AppPath() def reformat_address(df: pd.DataFrame, len_address: int) -> pd.DataFrame: indexes = df.loc[df['len_address_split'] == len_address].index if len_address == 3: columns = ['street', 'district', 'city'] el...
Thangphan0102/RealEstateProject
code/data_pipeline/src/clean.py
clean.py
py
6,806
python
en
code
0
github-code
1
36716719472
from linkedList import ListNode, LinkedList # find kth to last element of a singly linked list def kthToLast(head: ListNode, k: int): p1 = head p2 = head # p1 move forward by k steps, then p1 has n-k steps left to the end of linked list while (k > 0): if (p1 == None): return None p1 = p1.next k -= 1 ...
sophiiae/leetcode
cci/linkedList/kthToLast.py
kthToLast.py
py
596
python
en
code
1
github-code
1
2313803754
import re , os ,sys files = 0 current_path = os.getcwd() current_file = os.listdir(current_path) pattern = re.compile('\) (\/vobs[^\s]+)@@') for C_code_file in current_file: if os.path.splitext(C_code_file)[1] =='.c': f_code_file = C_code_file; if f_code_file == False: print('need put the c cod...
Dachao-Huang/MBD-Tools
split_c_code.py
split_c_code.py
py
1,157
python
en
code
0
github-code
1
20962312145
import atexit import imp import glob import logging import os import shutil import subprocess import tempfile import config import deb # Last config root directory to cleanup on exit __last_config_root = None def __cleanup_last_root(): if should_cleanup() and __last_config_root is not None and \ os....
endlessm/merge-o-matic
tests/testhelper.py
testhelper.py
py
10,038
python
en
code
0
github-code
1
70702970915
#Realsense.py #Created by: Josh Chapman Date: 1/12/2023 #This code contains basic implementation for the Realsense camera #Version 1.0 #Status: Complete #Capabilities: # Camera initialization # Getting frames and storing as np arrays # ouput of a user-readable image # Align depth with color image ...
jdc13/Farm_Roomba
RealSense.py
RealSense.py
py
11,468
python
en
code
0
github-code
1
11208025058
# -*- coding: utf-8 -*- """Tests for obfuscation utilities.""" import textwrap from unittest import TestCase from ddt import data, ddt, unpack from mock import MagicMock, patch import edx.analytics.tasks.util.obfuscate_util as obfuscate_util from edx.analytics.tasks.util.tests.target import FakeTask @ddt class Bac...
openedx/edx-analytics-pipeline
edx/analytics/tasks/util/tests/test_obfuscate_util.py
test_obfuscate_util.py
py
26,191
python
en
code
90
github-code
1
72263102754
import tkinter as tk from tkinter import * import time import sys import os import tkinter.font as font from time import sleep import pygame ##GUI CODE root = tk.Tk() timercanvas = Canvas(root, height = 250, width = 250, bg = "#fff") timercanvas.pack() minute=StringVar() second=StringVar() hours=StringVar() sec = St...
Aragon-Robotics-Team/test-materov-2021
GUI/asfasdf.py
asfasdf.py
py
1,886
python
en
code
0
github-code
1
74558975072
# _*_ coding: utf-8 _*_ """ """ from app.component.db import db from app.libs.enums import ScopeEnum, ClientTypeEnum from app.models.user import User from app.models.identity import Identity class UserDao(): # 获取用户列表 @staticmethod def get_user_list(page, size): paginator = User.query \ ...
danyeer/python-flask-api
app/dao/user.py
user.py
py
622
python
en
code
0
github-code
1
38777081854
nota1 = float(input('Entre com a nota: ')) while nota1 > 10: nota1 = float(input('Nota invalida. Entre com a nota correta: ')) nota2 = float(input('Entre com a segunda nota: ')) while nota2 > 10: nota2 = float(input('Nota invalida. Entre com a nota correta: ')) nota3 = float(input('Entre com a terceira nota: ')...
Ademilson12/Aulas_Digital
Basico/aula2.py
aula2.py
py
849
python
pt
code
0
github-code
1
73033773473
# -*- coding: utf-8 -*- ''' OpenStack Cloud Module ====================== OpenStack is an open source project that is in use by a number a cloud providers, each of which have their own ways of using it. :depends: libcloud >- 0.13.2 OpenStack provides a number of ways to authenticate. This module uses password- based...
shineforever/ops
salt/salt/cloud/clouds/openstack.py
openstack.py
py
30,521
python
en
code
9
github-code
1
8214563373
alphabets = "abcdefghijklmnopqrstuvwxyz" # a normal alphabet key = "bcdefghijklmnopqrstuvwxyza" # a modified alphabet that is shifted by 1 key = key[1:] + key[0] bruteForceStorage1 = [0] * 26 bruteForceStorage2 = [0] * 26 bruteForceStorage3 = [0] * 26 bruteForceStorage4 = [0] * 26 cipher1 = "fqjcb rwjwj vnjax bnkhj w...
DerickBui/Ciphers
Cipher1.py
Cipher1.py
py
2,559
python
en
code
0
github-code
1
9999830291
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import get_object_or_404 from django.test import TestCase from directmessages.apps import Inbox from directmessages.models import Message from django.contrib.auth.models import User from django.test import TestCase, RequestFactory, C...
odmoreno/kalaFitnessApp
fisioterapia/tests.py
tests.py
py
2,814
python
es
code
1
github-code
1
29074773623
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Sigmoid激活函数类 from FullConnectedLayer import * import numpy as np from conv import * from activator import * from pool import * import sys # 神经网络类 class Network(object): def __init__(self): ''' 构造函数 ''' self.layers = [] self.conv...
hxdoit/deep_learn
conv/Network.py
Network.py
py
2,716
python
en
code
1
github-code
1
15494922036
import cv2 import numpy as np import os def get_2type_img(root_path): root=root_path dirlist = [ item for item in os.listdir(root) if os.path.isfile(os.path.join(root, item)) ] print(dirlist) for d in dirlist: img_path = root + d print(img_path) img = cv2.imread(img_path) h,w,c = img.shape t...
LINBOOyuan/cell_counter
count_cell2.py
count_cell2.py
py
1,523
python
en
code
0
github-code
1
15628967421
import pandas as pd import re import math from statistics import mean,stdev,mode import os #Select which instrument you're working on data from # platform = 'Exploris' # platform = 'Exploris_FAIMS' platform = 'TimsTOF_Pro' # platform = 'TimsTOF_SCP' #Select Library library = 'Library_3SS_Spiked' # library = 'Library...
tvashist/PTMDIA
DIANN_phospho_summary.py
DIANN_phospho_summary.py
py
2,564
python
en
code
0
github-code
1
3942267886
from datetime import timedelta from discord import Color, Embed, Message from discord.ext import commands from wavelink import Player, TrackEventType from exceptions import CurrentNotPlaying from .utilities import get_wavelink_player class EmptyNowPlayingManager: def __init__(self) -> None: super(NowPla...
GabrielBarros00/Music-Discord-BOT
utils/nowplaying.py
nowplaying.py
py
5,352
python
en
code
1
github-code
1
44825592664
import os import sys import csv #import numpy as np import random class DataHandler: def __init__(self): pass def get_list(self): data = [] with open('game_titles.csv', newline='', encoding='utf-8') as f: reader = csv.reader(f) data = [item for sublist in list(reader) for item in sublist] return data...
reidtc82/WIPNameGenerator
wip_name_gen.py
wip_name_gen.py
py
2,296
python
en
code
0
github-code
1
33032831725
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from rest_framework.exceptions import NotFound, PermissionDenied from .serializers.common import ReviewSerializer from .models import Review from rest_framework.permissions import IsAuthenticatedOrRe...
florastocks/recipe_book
reviews/views.py
views.py
py
1,989
python
en
code
0
github-code
1
23382287076
"""Combines multiple jars into one jar.""" def combine_jars(name, srcs, **genrule_kwargs): '''Combines multiple jars into one jar. Args: name: Name to be used for this rule. It produces name.jar srcs: List of jars to be combined. genrule_kwargs: Keyword arguments to pass through to the genrule. ''' ...
YFShiftFinance/Android
build_extensions/combine_jars.bzl
combine_jars.bzl
bzl
1,541
python
en
code
3
github-code
1
27568411284
from tkinter import * from tkinter import filedialog from pytube import YouTube from moviepy import * from moviepy.editor import VideoFileClip # Functions def select_folder(): """ Select folder to save files """ folder = filedialog.askdirectory() folder_label.config(text=folder) def download_bes...
C-distin/python-youtube
download.py
download.py
py
2,329
python
en
code
0
github-code
1
74338108512
from solcx import compile_standard, install_solc import json from web3 import Web3 from dotenv import load_dotenv import os load_dotenv() with open("./SimpleStorage.sol", "r") as file: simple_storage_file = file.read() install_solc("0.8.0") compiled_sol = compile_standard( { "language": "Solidity", ...
jassi-singh/blockChainDevCourse
simplstorage/deploy.py
deploy.py
py
2,350
python
en
code
0
github-code
1
44604028122
from fan_class import Fan fan_1 = Fan(3, True, 10.0, "Yellow") fan_2 = Fan(2, False, 5.0, "Blue" ) print("\033[1m" + "\033[94m" + "Fan 1 propeties:") fan_1.display_fan() print("Fan 2 propeties:") fan_2.display_fan()
Kenji1504/FAN_CAR_PET_CLASSES
fan_class/test_fan.py
test_fan.py
py
219
python
en
code
0
github-code
1
3395724366
import os import subprocess from requests import post def fetch(): global text for line in text: os.mkdir(line.replace("://","-")) os.chdir(line.replace("://","-")) mod = line.strip("https://" or "http://") mod = mod.rstrip("\n") p1 = subprocess.run(['dig', '+short', mod], capture_output=True, t...
RogueSMG/Scavenger
PortsAndServices.py
PortsAndServices.py
py
1,796
python
en
code
18
github-code
1
6609884216
import argparse #To get the source directory from command line arguments. import io # To fix encoding issues in Windows import os #To find files from the source. import os.path #To find files from the source and the destination path. cura_files = {"cura", "fdmprinter.def.json", "fdmextruder.def.json"} uranium_files = ...
Ultimaker/Cura
scripts/lionbridge_import.py
lionbridge_import.py
py
9,461
python
en
code
5,387
github-code
1
2034280475
from PyQt5.QtWidgets import QApplication, QWidget, QTableWidget from PyQt5.QtGui import QPainter, QColor, QFont, QBrush, QPen, QPixmap, QTabletEvent from PyQt5.QtCore import QPoint, pyqtSignal, Qt, QTime from nav_msgs.msg import Path import rospy from Data import Data SIZE_ROBOT_WRITING = 4.0 DISTANCE_ROBOT_WRITING_T...
asselbor/choose_adaptive_words
nodes/TactileSurfaceArea.py
TactileSurfaceArea.py
py
5,492
python
en
code
0
github-code
1
19569543042
# ------------------------------------------------------------------------------ # Part of implementation is adopted from CenterNet, # made publicly available under the MIT License at https://github.com/xingyizhou/CenterNet.git # ------------------------------------------------------------------------------ import warn...
RapidAI/TableStructureRec
lineless_table_rec/lineless_table_process.py
lineless_table_process.py
py
13,631
python
en
code
2
github-code
1
26641848850
from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import FTPHandler, ThrottledDTPHandler from pyftpdlib.servers import FTPServer from pyftpdlib.log import LogFormatter import logging logger = logging.getLogger() logger.setLevel(logging.INFO) ch = logging.StreamHandler() fh = logging.Fi...
kinscloud/kinscloud.github.io
Python/DevOps/PyFtpdLibDemo.py
PyFtpdLibDemo.py
py
994
python
en
code
0
github-code
1
69850120995
######################################################################################## # # This script converts the trial list of voxceleb2 to the general format. # # Author(s): Nik Vaessen ######################################################################################## import pathlib import click from dat...
Loes5307/VocalAdversary2022
data_utility-main/voxceleb/fix_trials.py
fix_trials.py
py
1,583
python
en
code
4
github-code
1
22549890962
import requests from pathlib import Path def get_picture(url, path): Path("images").mkdir(parents=True, exist_ok=True) response = requests.get(url) response.raise_for_status() with open(path, 'wb') as file: file.write(response.content)
FOURWORDSALLCAPS/Space_for_everyone
get_picture.py
get_picture.py
py
263
python
en
code
1
github-code
1
18569928188
import pygame import random import math import cv2 import apriltag import numpy as np from pygame.locals import ( K_UP, K_DOWN, K_LEFT, K_RIGHT, K_ESCAPE, KEYDOWN, QUIT, K_s, K_w, ) pygame.init() clock = pygame.time.Clock() SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 class P...
aisilva/ar-pong
main.py
main.py
py
5,994
python
en
code
0
github-code
1
21435367392
import logging import numpy as np def read_input(fname="input.txt"): with open(fname, "r") as f: return f.readlines() def construct_paper(text): instructions = [] dots = [] line_idx = 0 while line_idx < len(text) and text[line_idx] != '\n': coords = [int(val) for val in text[line_i...
mrdkucher/advent_of_code
2021/day13/main.py
main.py
py
2,458
python
en
code
0
github-code
1
39948665528
import os from dotenv import load_dotenv ROOT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) def get_abs_path(file_path: str) -> str: """append ROOT_DIR for relative path""" # Already absolute path if file_path.startswith("/"): return file_path else: return os.path...
pradyumnaym/Champions
app/config.py
config.py
py
827
python
en
code
0
github-code
1
6950680498
import torch import torch.nn as nn from torch.nn import init class ConvLSTM(nn.Module): def __init__(self, input_size, hidden_size, kernel_size): super(ConvLSTM, self).__init__() self.input_size = input_size self.hidden_size = hidden_size padding = kernel_size // 2 self....
Flawless1202/tjevents
tjevents/nn/recurrent/conv_rnn.py
conv_rnn.py
py
2,445
python
en
code
3
github-code
1
19031147613
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import codecs import sys from charset import special_chars, get_chars_encoding, special_chars_BW, get_chars_encoding_BW all_languages = special_chars.keys() def main(): languages = "" char_list = [] lang_args = all_languages if len(sys....
EdgeTX/edgetx
tools/list-utf-8-code-points.py
list-utf-8-code-points.py
py
942
python
en
code
1,243
github-code
1
73866763874
from mmcv.runner import HOOKS, Hook from torch.utils.data import DataLoader from mpa.modules.datasets.samplers.cls_incr_sampler import ClsIncrSampler from mpa.modules.datasets.samplers.balanced_sampler import BalancedSampler from mpa.utils.logger import get_logger logger = get_logger() @HOOKS.register_module() clas...
openvinotoolkit/model_preparation_algorithm
mpa/modules/hooks/task_adapt_hook.py
task_adapt_hook.py
py
2,438
python
en
code
20
github-code
1
72421070114
import time import picodisplay as display CHAR_HEIGHT = 6 CHAR_WIDTH = 5 class Ball: def __init__(self, x, y, r, dx, dy, pen): self.x = x self.y = y self.r = r self.dx = dx self.dy = dy self.pen = pen class Paddle: def __init__(self, x, y, h, w, pen): s...
johnnyruz/PicoPythonPong
pong.py
pong.py
py
7,633
python
en
code
0
github-code
1
24621962822
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2022/3/31 18:49 # @Author : yaomy import cv2 import torch import torch.nn.functional as F import numpy as np def crop_resize_by_warp_affine(img, center, scale, output_size, rot=0, interpolation=cv2.INTER_LINEAR): """ output_size: int or (w, h) N...
yaomy533/pose_estimation
lib/transform/coordinate.py
coordinate.py
py
4,161
python
en
code
0
github-code
1
31498625020
from flask import Flask, jsonify, render_template import jinja2 import datetime import refine_objects from connection import get_connection, get_all_from_table, run_sql_command_one_result app = Flask(__name__) @app.route("/") def show_startPage(): # print(refine_objects.refine_location(get_all_from_table("locati...
DHBW-Event-Planner/Event-Planner
app/app.py
app.py
py
2,024
python
en
code
0
github-code
1
71779727075
from flask import redirect, render_template, request, session, jsonify, json from flask_app import app from flask_app.models.car_models import Car from flask_app.models.user_models import User from flask_app.controllers import user_controllers import os print( os.environ.get("FLASK_APP_API_KEY") ) @app.route("/dashboa...
rseffens/flip_your_whip
flask_app/controllers/car_controllers.py
car_controllers.py
py
3,003
python
en
code
1
github-code
1
11866916341
import http.client import tkinter as tk from tkinter import * import sys win = tk.Tk() win.geometry(f"600x370+100+200") win.title("Task3") # Функція для отримання або оновлення інформації для 5-ох країн def update(): conn = http.client.HTTPSConnection("vaccovid-coronavirus-vaccine-and-treatment-tra...
Aragorant/python_tasks
task3/task3.py
task3.py
py
8,552
python
en
code
0
github-code
1
9300648357
import tweepy import json import time from kafka import KafkaProducer # Configure the authentication keys for the Twitter API bearer_token="AAAAAAAAAAAAAAAAAAAAAMxXkAEAAAAAFC3teGdOH64EKRkhCiWANfWxwvk%3DvPTipAtXE0gr2YHUcBTp0MQ8bYz65LAbRyiiGLFIbCTvw4FZiD" client = tweepy.Client(bearer_token=bearer_token) # Parameters ...
YasTelecom/Twitter-Data-Stream-Sentimental-Analaysis
ingest-tweets.py
ingest-tweets.py
py
1,271
python
en
code
0
github-code
1
10544482751
import re from src.point import * # ============================ Clustering functions ============================ def x7s_directionClustering(pj, sb, inv=False): """ Clusters a pip junction based on the difference vector between its external termination point and the reference switchbox. Args: ...
mortbopet/NetCracker
src/vendor/Xilinx/S7/x7s_clusterings.py
x7s_clusterings.py
py
7,149
python
en
code
11
github-code
1
20458999522
# Wednesday, October 5 Lecture Notes: profs = ["Ackles", "Krebsbach", "Gregg"] for prof in profs: # we can have anything instead of 'prof' print(prof + " is a CMSC professor.") for i, prof in enumerate(profs): # one option for including both index and value in output: enumerate! prof prefers this print(str(i...
ninada25/cmsc140
Desktop/py_scripts/class_lecture_notes/wk4-dicts.py
wk4-dicts.py
py
4,099
python
en
code
0
github-code
1
71016766115
import torch import gpytorch import numpy as np torch.manual_seed(1) np.random.seed(3) class ExactGPModel(gpytorch.models.ExactGP): def __init__(self, z_train, y_train, likelihood): super(ExactGPModel, self).__init__(z_train, y_train, likelihood) self.mean_module = gpytorch.means.ConstantMean() ...
yugaro/LearingETMPCSymbolic
lib/model/gp.py
gp.py
py
2,053
python
en
code
1
github-code
1
11163177453
def sol(k,score): temp_score=[] # diff = dict() temp_idx=[] # print(temp_idx) for i in range(len(score)-1): temp_score.append(score[i]-score[i+1]) temp = set(temp_score) for i in temp: if temp_score.count(i)>=k: temp_idx+=(list(filter(lambda x: temp_score[x]==i,ra...
ahrtz/study
혼자하는거/1009 쿠팡/3.py
3.py
py
794
python
en
code
0
github-code
1
34442469564
from neupy.core.docs import SharedDocs from neupy.utils import format_data __all__ = ('SupervisedLearningMixin', 'UnsupervisedLearningMixin', 'LazyLearningMixin') class SupervisedLearningMixin(object): """ Mixin for Supervised Neural Network algorithms. Methods ------- train(input_tr...
ravisankaradepu/saddle
network/learning.py
learning.py
py
4,174
python
en
code
0
github-code
1
75265308833
from fastapi import FastAPI, Request from evotekaro import models from evotekaro.database import engine from evotekaro.routers import user, authentication, election, votes, candidates from fastapi.middleware.cors import CORSMiddleware import logging logging.basicConfig(level=logging.INFO, format='...
Theganeshpatil/Evotekaro
main.py
main.py
py
1,113
python
en
code
1
github-code
1
8728232324
import nltk class MessageHistory: # Used to track message history to inject back into the queries def __init__(self, max_tokens=4000): # nltk IS NOT THE SAME tokenizer used by GPT, in order to use that we must have torch # to prevent some weird output tokenizer produces when torch isn't install...
JesseDarr/gpt4_shell
modules/message_history.py
message_history.py
py
2,262
python
en
code
0
github-code
1
21004162993
import json import logging from django.conf import settings from itsdangerous import ( BadSignature, Signer, URLSafeSerializer, ) from protobufs.services.user import containers_pb2 as user_containers from protobufs.services.organization.containers import sso_pb2 from saml2 import entity import service.cont...
getcircle/services
users/providers/okta.py
okta.py
py
6,726
python
en
code
0
github-code
1
5618393353
#!/usr/bin/env python import numpy as np import rospy import pyaudio from std_msgs.msg import Float32, Float32MultiArray import sys class ListenMiniMicrophone: def __init__(self): # init rospy node rospy.init_node('listen_mini_microphone', anonymous=True) self.p = pyaudio.PyAudio() ...
708yamaguchi/hitting_sound_classification
scripts/listen_mini_microphone.py
listen_mini_microphone.py
py
3,462
python
en
code
0
github-code
1
10040121110
#The necessary imports import os import sys import copy import math import numpy as np from classes import * from seq_tests import * from con_tests import * from ele_tests import * """ The Helpers needed for the algorithm They consist of functions that extract subseries, positions of series which are numbers etc. """ ...
luca-scharr/IQ-Number-Test-Solver
searchstructure.py
searchstructure.py
py
12,970
python
en
code
0
github-code
1
74490089634
#!/usr/bin/env python3 from faker import Faker # Local imports from app import app from config import db from models import User, Review, Business fake = Faker() with app.app_context(): print("Starting seed...") # Seed code goes here! print('Deleting existing data...') User.query.delete() Review...
chernandez148/yelp_clone_v2
server/seed.py
seed.py
py
1,935
python
en
code
0
github-code
1
21734804742
from xml.dom import minidom class Node: def __init__(self, lb, text=None): self.label = lb self.children = [] self.text = text def is_leaf(): return len(self.children) == 0 def children(self): return self.children def to_s(self): ...
ManhND27/nlp_100_drill_exercises
50_59ex/ex59.py
ex59.py
py
1,473
python
en
code
1
github-code
1
74839925793
import os import glob from openpyxl import load_workbook from openpyxl.utils import get_column_letter import csv asset_tasks = {} for filepath in glob.glob(os.path.join('C:\\Users\\majona\\Desktop\\AA PMs', '*.xls*')): wb = load_workbook(filename = filepath) print(filepath) ws = wb["Main"] new_row ...
jonathanmajh/iko-tools
Python/Assets_JobTasks/main.py
main.py
py
2,073
python
en
code
0
github-code
1
23620656221
from source.helpers.configuration_builder import (DatasetConfigurationBuilder, NeuralNetworkConfigurationBuilder) import pytest @pytest.fixture def mock_configuration_raw_dataset(): return { 'matlab': { 'file_name': 'matlab_file_test.mat', ...
12Diego06Martinez/Python-Furuta-Pendulum
test/test_configuration_builder.py
test_configuration_builder.py
py
2,534
python
en
code
0
github-code
1
43110386622
""" Contains functions for building the forest. Created on Thu May 11 16:30:11 2023 @author: MLechner # -*- coding: utf-8 -*- """ from copy import deepcopy from numba import njit import numpy as np import ray # import pandas as pd from mcf import mcf_forest_data_functions as mcf_data from mcf import mcf_general as ...
MCFpy/mcf
mcf/mcf_forest_add_functions.py
mcf_forest_add_functions.py
py
26,445
python
en
code
12
github-code
1
5683031448
# 8. Write a Python script to print distinct elements along with # their frequencies of occurrence in the list any_list = ['A', 'A', 'B', 'C', 'B', 'D', 'D', 'A', 'B'] frequency = {} for item in any_list: # checking the element in dictionary if item in frequency: # incrementing the counr frequency...
Deepak6203/INEURON
Assignments/Assignment14/Question8.py
Question8.py
py
482
python
en
code
0
github-code
1
13280379613
from django.shortcuts import render, get_object_or_404, redirect from django.contrib.auth.decorators import login_required from django.template.context_processors import request from django import forms from .models import Person, Rolle, Leilighet, Innlegg, Kategori, Kommentar from .forms import InnleggForm, Kommentar...
tbrygge/bolig
bolig/views.py
views.py
py
9,813
python
no
code
0
github-code
1
1593211756
from django.conf.urls import url from . import views urlpatterns = [ #显示添加页面 url(r'^add/$',views.add,name='add'), #执行添加操作 url(r'^do_add/$',views.do_add,name='do_add'), #执行显示操作 url(r'^shuju/$',views.shuju,name='shuju'), url(r'^input_id/$',views.input_id,name='input_id'), #执行删除操作 ur...
Lousm/Python
03_web前端/第11周-后端框架/myshop_2 - 副本/blog/urls.py
urls.py
py
548
python
en
code
0
github-code
1
21144199101
from flask import Flask, request import random import os import logging import ctypes from ctypes import c_char_p, c_int # Initialize logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') # Initialize the Flask application app = Flask(__name__) # Base directory where the...
abadinextsilicon/eli-stream-project
server.py
server.py
py
3,155
python
en
code
0
github-code
1
74436037474
import random from tkinter import * from tkinter import messagebox from PIL import ImageTk, Image def MainConsole(): root.destroy() main = Tk() main.title("Console") main.geometry("600x500") main.iconbitmap("Images/favicon.ico") mainframe = Frame(main, bg="Black") mainframe.place(relheigh...
SamuelDotDoc/OS_Fundacao
ConsoleGUI.py
ConsoleGUI.py
py
11,712
python
en
code
1
github-code
1
1772753121
import requests import config import json flight = 'SKW3871' aero_api_key = config.AeroAPI url = 'https://aeroapi.flightaware.com/aeroapi/flights/SCX262' #payload = {'some': 'data'} headers = {'x-apikey': aero_api_key} r = requests.get(url, headers=headers) aero_json = r.text def extract_json_fields(aero): # ...
nryberg/flights
aero_api.py
aero_api.py
py
1,035
python
en
code
0
github-code
1
26692108806
__author__ = "Matthias Rost, Alexander Elvers (mrost / aelvers <AT> inet.tu-berlin.de)" import abc import copy import time # algorithm results class BaseAlgorithmResult: def __init__(self, alg_name, scenario): self.alg_name = alg_name self.scenario = scenario def __str__(self): ret...
submodular-middlebox-depoyment/submodular-middlebox-deployment
src/algorithms/abstract_algorithm.py
abstract_algorithm.py
py
6,366
python
en
code
3
github-code
1
22390443827
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """K-mean clustering plot functions.""" import matplotlib.pyplot as plt from random import random as rd from k_means_types import * COLORS = [ "red", "yellow", "lime", "orange", "cyan", "purple", "green", "magenta", "maroon", "ol...
tbagrel1/machine_learning
clustering/k_means/k_means_plot.py
k_means_plot.py
py
4,312
python
en
code
0
github-code
1
22575470177
import sys n= int(input()) s=set() for _ in range(n): m=sys.stdin.readline().split() if len(m)==1: if m[0] == 'all': s= set([i for i in range(1,21)]) elif m[0] == 'empty': s=set() else: m1,m2=list(m) if m1=='add': s.add(int(m2)) el...
dydwkd486/coding_test
baekjoon/python/baekjoon11723.py
baekjoon11723.py
py
630
python
en
code
0
github-code
1
12059289004
""" Module containing all the method used in both the octtree and particle mesh simulations and all the global variables """ import multiprocessing import copy import pickle import numpy as np import astropy.units as u import png import pandas as pd import matplotlib.pyplot as plt import grav_field from octtree im...
Lancaster-Physics-Phys389-2020/phys389-2020-project-JimWarner
sim.py
sim.py
py
13,170
python
en
code
0
github-code
1
72625342754
# ░▄▀▀░▄▀▀ c. CS | FAF | FCIM | UTM | Fall 2023 # ░▀▄▄▒▄██ FAF-212 Cristian Brinza lab1 print('') print('░▄▀▀░▄▀▀ c. CS | FAF | FCIM | UTM | Fall 2023') print('░▀▄▄▒▄██ FAF-212 Cristian Brinza lab1 ') print('') # Define a function to display the menu options to the user. def display_menu(): """ Displa...
CristianBrinza/UTM
year3/cs/lab1/main.py
main.py
py
5,432
python
en
code
3
github-code
1
5682980338
# 1. Write a python script to store multiple items in a single variable # ( Items are “Java”,“Python”, “SQL”, “C” ) using list """First Method""" # lists = [] # item = int(input("Enter Numbers How Many Items Store : ")) # for i in range(item): # items = eval(input("Enter Items :")) # lists.append(items) #...
Deepak6203/INEURON
Assignments/Assignment13/Question1.py
Question1.py
py
563
python
en
code
0
github-code
1
11827857546
unpro="123" def f(pro,unpro): if len(unpro) == 0: print(pro) return ch = unpro[0] for i in range(len(pro)+1): first = pro[0:i] second = pro[i:] f(first+ch+second,unpro[1:]) print(f("",unpro)) # creating lists in body unpro="abc" def f(pro,unpro): if len(unpro) ...
Xaheersays/recursion
string/subset/permutations of string/permutuatiuoin.py
permutuatiuoin.py
py
931
python
en
code
0
github-code
1
29554395240
import os from app import app import urllib.request from flask import Flask, flash, request, redirect, url_for, render_template from werkzeug.utils import secure_filename import cv2 import time import subprocess CONFIDENCE_THRESHOLD = 0.2 NMS_THRESHOLD = 0.4 COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, ...
YassinALLANI/finalversion
main.py
main.py
py
3,057
python
en
code
0
github-code
1
75059028192
""" Linear layer with fused activation with PyTorch autodiff support. """ from typing import Optional, Tuple import torch from torch import Tensor from torch import nn from triton import cdiv from .act_kernels import act_func_backward_kernel from .linear_kernels import linear_forward_kernel from .types import Conte...
BobMcDear/attorch
attorch/linear_layer.py
linear_layer.py
py
7,362
python
en
code
1
github-code
1
35990847108
""" Perform teardown and integration logic after executing "constructive" Terraform subcommands (e.g. `init`, `plan`, and `apply`). """ from typing import List import json from accounts.models import Group from cbhooks.models import TerraformStateFile, TerraformPlanHook from infrastructure.models import Environment,...
mbomb67/cloudbolt_samples
terraform/tf_post_provision.py
tf_post_provision.py
py
13,710
python
en
code
2
github-code
1
43351701314
""" This file is part of nand2tetris, as taught in The Hebrew University, and was written by Aviv Yaish. It is an extension to the specifications given [here](https://www.nand2tetris.org) (Shimon Schocken and Noam Nisan, 2017), as allowed by the Creative Common Attribution-NonCommercial-ShareAlike 3.0 Unported [License...
noamkari/nand2tetris-8
CodeWriter.py
CodeWriter.py
py
14,254
python
en
code
0
github-code
1
42029466704
from django.shortcuts import render from django.urls import reverse #we used reverse function to use name instead of a url in urls.py from django.core.files.storage import FileSystemStorage from employee.models import Event,Employee,Student,Comment from django.http import HttpResponse,HttpResponseRedirect from django.d...
AakashkolekaR/NGO-Fundraiser-App
tsechacks/employee/views.py
views.py
py
4,187
python
en
code
0
github-code
1
29372624043
import boto3 dynamodb_client = boto3.client('dynamodb', region_name='us-west-2', endpoint_url='http://localhost:8000') location = 'Trinity' sdate = '20140101' edate = '20140201' response = dynamodb_client.query( TableName='Snotel', KeyConditionExpression='LocationID = :LocationID and SnotelDate BETWEEN :sdat...
MathiasDarr/Snotel
apis/snotel-serverless-api/parse_response_data.py
parse_response_data.py
py
1,111
python
en
code
0
github-code
1
32275241643
from tkinter import Tk, ttk, constants, END from logic.chain_analytics_service import chain_analytics_service class ContractsView: def __init__(self, root): self._root = root self._frame = None self._block_id = None self._current_block_id = str( int(chain_analytics_serv...
tugee/cryptoChainAnalyzer
src/ui/saved_contracts_view.py
saved_contracts_view.py
py
3,792
python
en
code
2
github-code
1
25433425619
from itertools import combinations import sys input = sys.stdin.readline d = [(0,1), (1,0), (-1,0), (0,-1)] def out_of_range(ny:int, nx:int) -> bool: return ny < 0 or nx < 0 or ny >= n or nx >= m def check(s: tuple[int]): res = 0 visited = [[False]*m for _ in range(n)] for i in s: ...
reddevilmidzy/baekjoonsolve
백준/Silver/18290. NM과 K (1)/NM과 K (1).py
NM과 K (1).py
py
752
python
en
code
3
github-code
1
38355857526
from urllib import request import re # https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action=&start=0&limit=20 # https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action=&start=20&limit=20 # https://movie.douban.com/j/chart/top_list?type=11&interval_id=100%3A90&action=&start...
1368334540/Python
电影TOP250爬虫实例.py
电影TOP250爬虫实例.py
py
1,008
python
en
code
0
github-code
1
9553900919
""" Code is partially borrowed from repository https://github.com/sbarratt/inception-score-pytorch/blob/master/inception_score.py # noqa: E501 """ import argparse import logging from pathlib import Path from typing import Dict, Iterable, Optional, Tuple, Union import numpy as np import torch import torch.utils.data i...
svsamsonov/ex2mcmc_new
ex2mcmc/metrics/inception_score.py
inception_score.py
py
7,378
python
en
code
3
github-code
1
34929668909
import random import time t0 = 1 t1 = 100 d = 1 a = [str(x) for x in range(t0,t1 + 1, d)]# a 为列表 b = [] nn = [0] def choice(event): time.sleep(1) rm = random.choice(a) a.remove(rm)#无放回抽签 b.append(rm) if ((len(b)-nn[0])%10 == 0): b.append('\n') nn[0] += 1 bstr = ', '.join(b) #随机输出数字 ctn = wx.TextCtrl(win...
kelvin1020/GUI_draw_dices
draw.py
draw.py
py
1,403
python
en
code
0
github-code
1
72226144995
#----------------------------------------------------------------- # Working with psycopg2 #----------------------------------------------------------------- import psycopg2 import sys from prettytable import PrettyTable def heading(str): print('-'*60) print("** %s:" % (str,)) print('-'*60, '\n') SH...
cmay20/Instagram-Database-Model
simple_query_1.py
simple_query_1.py
py
2,828
python
en
code
0
github-code
1
29040769502
from random import randint from subprocess import call import sys from hexDictionary import hexIndex def throwTheCoins(): hexagram = [0,0,0,0,0,0] for i in reversed(range(len(hexagram))): toss = 0 for x in range(0,3): toss = toss + randint(2,3) hexagram[i] = toss retur...
davidhazardous/iching
ichingpy3.py
ichingpy3.py
py
1,516
python
en
code
3
github-code
1
14029528473
#Python version 3.6.0 import random as r from collections import defaultdict #import numpy as np #from copy import deepcopy class HelperFunctions(): def __init__(self): pass def kill_ship(self,strike_area): self.overall_p_density = self.calculate_strategy() while self.open_...
Brian1441/Battleship_Simulator
HelperClass.py
HelperClass.py
py
8,830
python
en
code
0
github-code
1
18323508054
import logging import math from typing import List, Dict, Optional import torch from adet.layers import DFConv2d, NaiveGroupNorm from adet.utils.comm import compute_locations from detectron2.layers import ShapeSpec, NaiveSyncBatchNorm from detectron2.modeling.proposal_generator.build import PROPOSAL_GENERATOR_REGISTRY...
facebookresearch/sylph-few-shot-detection
sylph/modeling/meta_fcos/fcos.py
fcos.py
py
36,764
python
en
code
54
github-code
1
39828382351
import string import nltk from bs4 import BeautifulSoup from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from nltk.corpus import stopwords from sklearn.feature_extraction.text import TfidfVectorizer import pandas as pd nltk.download('wordnet') nltk.download('omw-1.4') nltk.download('stop...
nzayem/Key-Terms-Extraction
Key Terms Extraction/task/key_terms.py
key_terms.py
py
2,241
python
en
code
0
github-code
1
18738470138
# -*- coding: utf-8 -*- import numpy as np from sklearn.datasets import load_iris import matplotlib.pyplot as plot """ Ejercicio 1 """ matriz = load_iris() a=matriz.data b=matriz.target_names x1=a[0:49,-2:] x2=a[50:99,-2:] x3=a[100:149,-2:] plot.scatter(x1[:,0],x1[:,1],c=[[1,0,0]],label=b[0]) plot.scatter(x2[:,0]...
PaulaCT/AprendizajeAutomatico_UGR
practica0.py
practica0.py
py
1,365
python
en
code
0
github-code
1
23119614056
import argparse import logging from elixir import feedstock __version__ = '0.0.1' def _config_logging(logging_level='INFO', logging_file=None): allowed_levels = { 'DEBUG': logging.DEBUG, 'INFO': logging.INFO, 'WARNING': logging.WARNING, 'ERROR': logging.ERROR, 'CRITICAL'...
scieloorg/elixir
elixir/elixir.py
elixir.py
py
2,335
python
en
code
1
github-code
1
31953600858
import csv import os import sys class Movie: def __inti__(self, movie_id, mov_tittle, zhanra_1, zhanra_2, zhanra_3, zhanra_4, movie_rating, user_id): self.id = movie_id self.tittle = tittle self.zhanra_1 = zhanra_1 self.zhanra_2 = zhanra_2 self.zhanra_3 = zhanra_3 s...
juliojr77/what-to-watch
movie_lib.py
movie_lib.py
py
12,003
python
en
code
0
github-code
1
18929879783
from tkinter import * from tkinter import ttk def main(): window = Window() window.mainloop() class Window(Tk): def __init__(self): super().__init__() # object attributes self.title("Show Grid Contents & Info") # populate mainframe = MainFrame(self) class MainFrame(ttk.Frame): def __init__(self, window...
rontarrant/tkoopython
005_grid/grid_009_info.py
grid_009_info.py
py
2,690
python
en
code
2
github-code
1
32578781072
import torch from torch import nn from torch import optim import torch.nn.functional as F from torchvision import datasets, transforms, models from collections import OrderedDict import time data_dir = './images_category/images_category' train_transforms = transforms.Compose([transforms.RandomRotation(30), ...
Anhtu07/wss_models
resnet101_pytorch.py
resnet101_pytorch.py
py
3,860
python
en
code
0
github-code
1
7580043655
# BOJ_1251 # 단어 나누기 def solution(): def swap(w): out_word = "" for c in range(len(w) - 1, -1, -1): out_word += w[c] return out_word word = input() word_list = list() for i in range(1, len(word) - 1): word_1 = word[:i] for j in range(i + 1, len(word)...
wilderif/PS
BOJ/BOJ_1251.py
BOJ_1251.py
py
556
python
en
code
0
github-code
1
34744486795
""" 移除链表元素 """ from typing import Optional # 定义链表 class ListNode: def __init__(self, val=0, next=None): # 值 self.val = val # 下一个结点 self.next = next class Solution: def removeElements(self, head: ListNode, val: int) -> ListNode: # 构建一个虚拟的头节点 dummy_head = ListN...
PorterZhang2021/LeetCode
2.链表/一刷归档/LeetCode_203_2.py
LeetCode_203_2.py
py
874
python
zh
code
0
github-code
1
8088553187
import csv import pandas as pd import matplotlib.pyplot as plt CSV_LOAD_PATH = "data_C3-C4.csv" ROW_INDEX = { 'name': 0, 'time': 1, 'stim_intensity': 6, 'rep_rate': 8 } def plot_signal(datapoints): plt.plot(datapoints) # plt.title('Max: ', max(datapoints), 'min: ', min(datapoints)) plt.show() def ...
rachelyeslah/ProjectNM
da.py
da.py
py
1,479
python
en
code
0
github-code
1
390426681
prime = 101 def pattern_matching(text, pattern): m = len(pattern) n = len(text) pattern_hash = create_hash(pattern, m - 1) text_hash = create_hash(text, m - 1) for i in range(1, n - m + 2): if pattern_hash == text_hash: if check_equal(text[i-1:i+m-1], pattern[0:]) is True: ...
wusixuan0/practice
rabin_karp.py
rabin_karp.py
py
3,037
python
en
code
0
github-code
1
6535462852
import re from collections import namedtuple from typing import Any, Callable, Union from .common import Position, Range class LexError(Exception): pass Rule = namedtuple('Rule', ['regex', 'callback']) Token = namedtuple('Token', ['type', 'value', 'range']) class Lexer: """A generic lexer Example: ...
joshuaskelly/wick
wick/parser/lexer.py
lexer.py
py
4,942
python
en
code
2
github-code
1
9565341585
#!/usr/bin/env python # coding: utf-8 # @Author : Mr.K # @Software: PyCharm Community Edition # @Time : 2020/1/3 12:19 # @Description: #统计list中出现的元素个数 #参考:https://www.zybang.com/question/2fa278ce7f89fb437759d57ab4b20594.html # numbers=["cc","cc","ct","ct","ac"] # res = {} # for i in numbers: # res[i] = res.get...
LeonardoMrK/Spider_4_TYC
ceshi.py
ceshi.py
py
812
python
en
code
2
github-code
1
42999682359
''' Problem 85 | Maximal Rectangle https://leetcode.com/problems/maximal-rectangle/ ''' class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: if not len(matrix): return 0 for row in range(len(matrix)): for col in range(len(matrix[0])): ...
davijit868/Programming-Solutions
Data Structures/Stack/Maximal Rectangle.py
Maximal Rectangle.py
py
2,287
python
en
code
2
github-code
1
9565427568
# https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-entities.html # https://github.com/aws/amazon-sagemaker-examples/blob/master/sagemaker-lineage/sagemaker-lineage.ipynb import base64 from sagemaker.lineage.artifact import Artifact from sagemaker.lineage.context import Context from sagemaker.lineage.ac...
aws-samples/ml-lineage-helper
ml_lineage_helper/ml_lineage.py
ml_lineage.py
py
26,811
python
en
code
13
github-code
1
36427146353
""" 120. Triangle Medium 1106 120 Favorite Share Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [6,5,7], [4,1,8,3] ] The minimum path sum from to...
fengyang95/OJ
LeetCode/python3/120_Triangle.py
120_Triangle.py
py
2,254
python
en
code
2
github-code
1
41440458922
''' 페이지 교체 알고리즘 OPT 방식 OPT : https://velog.io/@qweadzs/BOJ-1700-%EB%A9%80%ED%8B%B0%ED%83%AD-%EC%8A%A4%EC%BC%80%EC%A4%84%EB%A7%81Python 멀티탭을 모두 사용하고 있을 때, 어떤 코드를 뽑을 것인지 선택하는 문제 - 앞으로 다시 사용하지 않을 코드 위 조건을 만족하는 코드가 없다면 - 가장 나중에 다시 사용할 코드 먼저 사용할 것을 빼버리면, 다시 사용할 때 다시 꽂아야 함. ''' from collections...
aszxvcb/TIL
BOJ/boj1700.py
boj1700.py
py
1,747
python
ko
code
0
github-code
1