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
14366507238
from pymongo import MongoClient import datetime """ this module contains methods for connecting to a mongodb database server, adding individual games to the database, adding a group of games from a file, updating overall stats, updating individual player stats, and updating player vs player stats.""" ...
laxnumber13/pingpong-Python
pingpong.py
pingpong.py
py
18,945
python
en
code
1
github-code
13
41490232045
import sqlite3 from . import connect async def get_user_list(program: str) -> [int]: table_query = f"""SELECT * from {program}""" cursor, connection = await connect.make_connection("hseabitbot/user/sending.db") try: cursor.execute(table_query) content = cursor.fetchall() finally: ...
playerr17/hseabitbotv2
hseabitbot/db_commands/get_info.py
get_info.py
py
788
python
en
code
0
github-code
13
21538827442
def solution(s): rk = '' list = s.split(" ") for i in list: for j in range(len(i)): if j % 2 == 0: rk += i[j].upper() else: rk += i[j].lower() rk += " " return rk[0:-1] #์ถœ์ฒ˜: ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ ์—ฐ์Šต, https://programmers.co.kr/learn/challeng...
CKtrace/Programmers
Programmers Level 1/์ด์ƒํ•œ_๋ฌธ์ž_๋งŒ๋“ค๊ธฐ.py
์ด์ƒํ•œ_๋ฌธ์ž_๋งŒ๋“ค๊ธฐ.py
py
352
python
ko
code
0
github-code
13
3845365899
from random import choice from data import question_data from question_model import Question from quiz_brain import QuizBrain def play_quiz(): question_bank = [] for question in question_data: new_question = Question(question['question'], question['correct_answer']) question_bank.append(new_q...
gteachey/100daysofcode_python
day017/main.py
main.py
py
665
python
en
code
0
github-code
13
37942049415
from turtle import Turtle from random import choice, randint COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] STARTING_MOVE_DISTANCE = 5 MOVE_INCREMENT = 10 class CarManager: def __init__(self): self.step = STARTING_MOVE_DISTANCE self.car_list = [] self.append_cars() ...
Lukasz2506/The_Turtle_Crossing_Capstone
car_manager.py
car_manager.py
py
872
python
en
code
0
github-code
13
31831512579
from collections import deque import pygame from Point import Point class Snake: def __init__(self, startPointX, startPointY): self.snakeStartPoint = Point(startPointX, startPointY) self.headcolor = None self.bodyColor = None self.body = Body(self.snakeStartPoint) self.sn...
ftherien99/_SnA.I.ke
dev/Snake.py
Snake.py
py
2,812
python
en
code
0
github-code
13
25403483279
import csv try: from urllib.request import Request, urlopen from urllib.error import URLError except ImportError: from urllib2 import Request, urlopen, URLError from codecs import iterdecode import smf def query_morningstar(self, exchange, symbol, url_ending): """Query Morningstar for the data we want"...
madsailor/SMF-Extension
src/morningstar.py
morningstar.py
py
8,048
python
en
code
27
github-code
13
1288838401
from langdetect import detect def sent_detection(sent, direct): '''Language ID adaptred for fasttext model''' lang_id = detect(sent) src_id, tgt_id = direct.split('-') black_list = [tgt_id, 'uk', 'bg', 'cs', 'mk'] return (lang_id == src_id or lang_id not in black_list) if __name__ == '__main__'...
eleldar/Translator
OpenAPI/api/tools/language_detection.py
language_detection.py
py
393
python
en
code
0
github-code
13
11505751522
# The sum of the squares of the first ten natural numbers is, # 1^2 + 2^2 + ... + 10^2 = 385 # # The square of the sum of the first ten natural numbers is, # (1 + 2 + ... + 10)^2 = 55^2 = 3025 # # Hence the difference between the sum of the squares of the # first ten natural numbers and the square of the sum is # 30...
rflynn/euler
06.py
06.py
py
659
python
en
code
1
github-code
13
43243582029
import os import asyncio import glob import unittest from unittest.mock import (AsyncMock, patch) from merge_files.mergers.async_ import AsyncFileMerger from merge_files.utils import list_files class TestAsyncFileMerger(unittest.TestCase): """ A test suite for the AsyncFileMerger cl...
redrussianarmy/file-merger
tests/test_async.py
test_async.py
py
3,705
python
en
code
2
github-code
13
34262000291
from flask import Flask, request, render_template, redirect, url_for import datetime import mysql.connector from mysql.connector import Error app = Flask(__name__, template_folder="templates") def create_table(): connection = mysql.connector.connect( host='localhost', user='dina', password...
dinywka/flask_todo
main.py
main.py
py
5,510
python
en
code
0
github-code
13
6142130941
""" Module information """ class Checkout: class Discount: def __init__(self, numItems: int, price: float): self.numItems = numItems self.price = price def __init__(self): self.prices = {} self.discounts = {} self.items = {} def addItemPrice(self, it...
michael-c-hoffman/TestDrivenDevelopmentPythonPytest
checkout/checkout/__init__.py
__init__.py
py
1,674
python
en
code
0
github-code
13
35375611874
from functools import partial from typing import Callable, Dict, Optional, Union import torch import torch.nn as nn from ray.air.checkpoint import Checkpoint from ray.air.config import DatasetConfig, RunConfig, ScalingConfig from ray.data.preprocessor import Preprocessor from ray.train.torch import TorchTrainer as Tor...
vivym/x2r
x2r/trainers/pytorch/trainer.py
trainer.py
py
2,019
python
en
code
1
github-code
13
41257186491
import csv from datetime import datetime import matplotlib.pyplot as plt filename = "data/sitka_weather_2018_simple.csv" with open(filename) as f: reader = csv.reader(f) header_row = next(reader) for index, column_header in enumerate(header_row): print(index, column_header) # Get date and ra...
fadiabji/data_science
stika_rainfall.py
stika_rainfall.py
py
816
python
en
code
0
github-code
13
4163030691
import random import pygame from pygame.locals import* pygame.init() screen=(pygame.display.set_mode((600,600))) pygame.display.set_caption('ria') red=(255,0,0) green=(0,255,0) blue=(0,0,255) white=(250,250,250) yellow=(255,255,0) birdx=300 birdy=300 xtop=400 ytop=0 toplen=200 xdown=400 score=0 birdonscreen=0 toppipe=0...
RiaShitole/Coding-Python
flappy bird.py
flappy bird.py
py
2,478
python
en
code
0
github-code
13
30500131944
class EmptyQueueError: pass class Node: def __init__(self,value,pr): self.info=value self.priority=pr self.link=None class PriorityQueue: def __init__(self): self.start=None def is_empty(self): return self.start==None def size(self): ...
jamwine/Data-Structures-and-Algorithm
DataStructures/PriorityQueue.py
PriorityQueue.py
py
1,336
python
en
code
1
github-code
13
24512065612
""" PATTERNS Character Description Example Pattern Code Exammple Match \d A digit file_\d\d file_25 \w Alphanumeric \w-\w\w\w A-b_1 \s White space a\sb\sc a b c \D A non digit \D\D\D ABC \W Non-alphanumeric \W\W\W\W\W *-+=) \S Non-whitespace \S\S\S\S Yoyo """ import re text = "My telephone number is 809-434-4322" pho...
rajivpaulsingh/python-zero-to-hero
Advanced Python Modules/regex2.py
regex2.py
py
847
python
en
code
0
github-code
13
14816022387
import data_reader,resources #CATMAP = event_dao.get_all_categories() def get_domains_ids(): DOMAIN_TO_ID = dict() ID_TO_DOMAIN = dict() domains = data_reader.get_domains(resources.DOMAIN_PATH) for domain in domains: new_id = len(DOMAIN_TO_ID) DOMAIN_TO_ID[domain] = new_id ID_TO_...
mrtamb9/eventracking
static_resources.py
static_resources.py
py
437
python
en
code
0
github-code
13
18883886300
import numpy as np def AbsorptionMarkov(): # 1.1 Transition matrix P_matrix = [[1, 0, 0, 0], [0.22, 0.11, 0.58, 0.09], [0.15, 0.27, 0.20, 0.38], [0.19, 0.57, 0.19, 0.05]] vector = [0.1, 0.3, 0.2, 0.4] def printMatrix ( matrix ): for i in range ( len(matrix) ): ...
YaroslavaMykhailenko/laboratory_3_Mykhailenko
laboratory_3.py
laboratory_3.py
py
5,002
python
en
code
0
github-code
13
35340235685
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Repository', fields=[ ('id', models.AutoField(v...
frewsxcv/lop.farm
app/repository/migrations/0001_initial.py
0001_initial.py
py
528
python
en
code
7
github-code
13
26882240651
from __future__ import print_function import sys from .interface import CDB OK=0 BAD_ARGS = 1 BAD_VERB = 2 BAD_KEY = 3 def usage(): print("Usage:", file=sys.stderr) print("\tpython -m cdb.tool DBNAME get KEY", file=sys.stderr) print("\tpython -m cdb.tool DBNAME set KEY VALUE", file=sys.stderr) print...
shitianfang/SkipList-DataBase
tool.py
tool.py
py
1,151
python
en
code
0
github-code
13
41668656858
# TEMPORARY: # cd I:/Users/welfj/Documents/Programming/Python/python-lua-dithering import os import time import sys from math import floor import cv2 from PIL import Image sys.path.append('libs/') import dithering # from python-lua-dithering.libs import dithering # import libs.dithering # from libs.dithering import ...
MyNameIsTrez/python-lua-dithering
main.py
main.py
py
14,612
python
en
code
0
github-code
13
72114123857
from django.shortcuts import render, redirect, get_object_or_404 from .models import * from django.contrib.auth.decorators import login_required from .forms import * # Create your views here. @login_required(login_url='/accounts/login/') def home(request): ''' returns the homepage of the application ''' ...
damunza/hood-ip
app/views.py
views.py
py
4,374
python
en
code
0
github-code
13
29613459522
import io import os from boto3.session import Session from boto3.s3.transfer import TransferConfig from LoraLogger import logger logger = logger(__name__, "INFO") with open('../es-syns-config/config.yaml', 'r') as f: config = yaml.safe_load(f) logger = logger(__name__, config['LOGGERS']['main']) config = ...
adrwong/ModelMeshSystem
user_toolkit/s3access.py
s3access.py
py
3,582
python
en
code
0
github-code
13
4699844295
''' [๋ฌธ์ œ] [์กฐ๊ฑด1] ๋ฆฌ์ŠคํŠธ์— ๋žœ๋ค์ˆซ์ž(1~100) 5๊ฐœ๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. [์กฐ๊ฑด2] ๋ฆฌ์ŠคํŠธ์˜ ์ˆซ์ž์ค‘ 50๋ณด๋‹ค ํฐ๊ฐ’๋“ค๋งŒ ์ถœ๋ ฅ [์กฐ๊ฑด3] ์œ„์กฐ๊ฑด์˜ ๊ฐ’๋“ค์˜ ๋ˆ„์ ํ•ฉ์„ ์ถœ๋ ฅ [์กฐ๊ฑด4] ์œ„์กฐ๊ฑด์˜ ๊ฐœ์ˆ˜ ์ถœ๋ ฅ [์˜ˆ์‹œ] a = [1, 83, 22, 77 ,19] ๋น„๊ต = 50 ์ถœ๋ ฅ : 83, 77 ํ•ฉ : 160 ๊ฐœ์ˆ˜ : 2 ''' import random a = [] count = 0 total = 0 i=0 while i...
Songmsu/python
H์ผ์ฐจ๋ฐฐ์—ด/์ผ์ฐจ๋ฐฐ์—ด3_๋ฌธ์ œ_๋ˆ„์ ํ•ฉ_๊ฐœ์ˆ˜/์ผ์ฐจ๋ฐฐ์—ด3_๋ฌธ์ œ01_๋น„๊ต_๋ฌธ์ œ.py
์ผ์ฐจ๋ฐฐ์—ด3_๋ฌธ์ œ01_๋น„๊ต_๋ฌธ์ œ.py
py
631
python
ko
code
0
github-code
13
72935272978
import copy from typing import List, Tuple def bfs(r: int, c: int, maps: List, target: str) -> Tuple[int, int, int]: maps = copy.deepcopy(maps) queue = [[r, c, 0]] H, W = len(maps), len(maps[0]) while queue: r, c, cnt = queue.pop(0) if r in [-1, H] or c in [-1, W] or maps[r][c] == "X": ...
Zeka-0337/Problem-Solving
programmers/level_2/๋ฏธ๋กœ ํƒˆ์ถœ.py
๋ฏธ๋กœ ํƒˆ์ถœ.py
py
919
python
en
code
0
github-code
13
36588392906
class Solution: def killProcess(self, pid: List[int], ppid: List[int], kill: int) -> List[int]: dag = defaultdict(list) root = -1 for i in range(len(pid)): if ppid[i] != 0: dag[ppid[i]].append(pid[i]) else: root = pid[i] ...
ysonggit/leetcode_python
0582_KillProcess.py
0582_KillProcess.py
py
593
python
en
code
1
github-code
13
10057342546
def quine(): #returns the code of this function import inspect lines = inspect.getsource(quine) return lines[len('def quine(): '):] #prints its code def example(): s = 's = %r\nprint(s %% s)' print(s % s) print(quine()) print("\n\n") example()
th3spis/basilisk
unlockInfosec/self_print.py
self_print.py
py
268
python
en
code
0
github-code
13
74564296338
#!/usr/bin/env python """ _DeleteJobs_ MySQL implementation for creating a deleting a job """ from WMCore.Database.DBFormatter import DBFormatter class DeleteJobs(DBFormatter): """ _DeleteJobs_ Delete jobs from bl_runjob """ sql = """DELETE FROM bl_runjob WHERE id = :id """ def execut...
dmwm/WMCore
src/python/WMCore/BossAir/MySQL/DeleteJobs.py
DeleteJobs.py
py
746
python
en
code
44
github-code
13
29283590393
from typing import List, Union from structures import Order, TradingSessionModel, Transaction, Error, OrderStatus from uuid import UUID, uuid4 from order_book import OrderBook from traders import Trader from datetime import datetime, timezone from utils import utc_now class TradingSession: def __init__(self): ...
chapkovski/trader_london
session.py
session.py
py
5,558
python
en
code
0
github-code
13
13670911003
DOCUMENTATION = r""" --- module: secretsmanager_secret version_added: 1.0.0 short_description: Manage secrets stored in AWS Secrets Manager description: - Create, update, and delete secrets stored in AWS Secrets Manager. - Prior to release 5.0.0 this module was called C(community.aws.aws_secret). The usage did ...
ansible-collections/community.aws
plugins/modules/secretsmanager_secret.py
secretsmanager_secret.py
py
24,718
python
en
code
174
github-code
13
23876222138
import datetime import random import string from typing import Optional, Literal, List import pymongo from database import MongoSingleton from features.schedule.models import Event, DatetimeGranularity, GuildScheduleConfig from .AbstractScheduleDB import AbstractScheduleDB class ScheduleDB(AbstractScheduleDB): ...
HuzzNZ/Onigiri
features/schedule/database/ScheduleDB.py
ScheduleDB.py
py
6,754
python
en
code
0
github-code
13
14606159537
from flask import Flask, redirect, url_for, render_template,request,session from datetime import timedelta #initiallize flask app=Flask(__name__) app.secret_key="H3!!0" app.permanent_session_lifetime=timedelta(minutes=2) #first page just on ip, route is '/' , used render_template, created a templates folder, with index...
marsalan06/flask
tutorial_5th.py
tutorial_5th.py
py
1,310
python
en
code
0
github-code
13
2495236150
from fuzzywuzzy import process with open(r"d:\indian_cities_data.txt","r") as f: cities=f.read().split('\n') def get_cities(query,database,limit=5): return process.extract(query=query,choices=database,limit=limit) print("Enter city name") cname = input() r_cities=get_cities(cname,cities) rank = r_cities[0][...
MuskanChaddha/-Fuzzy-String-Matching
code.py
code.py
py
388
python
en
code
0
github-code
13
17054888054
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class KoubeiMerchantOperatorRoleCreateModel(object): def __init__(self): self._auth_code = None self._role_id = None self._role_name = None @property def auth_code(self...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/KoubeiMerchantOperatorRoleCreateModel.py
KoubeiMerchantOperatorRoleCreateModel.py
py
1,854
python
en
code
241
github-code
13
13498890977
import bitstring # Get input file name def getFilename(): print("Insira o arquivo que sofrerรก compressรฃo (com extensรฃo):") filename = input() return filename def getN(): print("Insira o tamanho do lado de cada bloco (N): ") N = int(input()) return N def getM(): print("Insira a quantidade ...
EduardoLR10/imageCompressors
ciqa/my_io.py
my_io.py
py
1,200
python
en
code
1
github-code
13
6867672446
#!/usr/bin/env python # -*- encoding:utf-8 -*- import inference import cv2 import numpy as np image = cv2.imread('./test_data/00.0.jpg') image = cv2.resize(image, (64, 64)) # np.save('test_inference.npy', image) result = inference.predict(image) rank = result['rank'] i = 0 for r in rank: i += 1 print('{} : {}'...
keydepth/facedetect
bin/stub_inference.py
stub_inference.py
py
477
python
en
code
0
github-code
13
27546057433
"""Collect JHU Cases/Deaths data""" import os import sys import pandas as pd import numpy as np from termcolor import colored from cowidev import PATHS from cowidev.utils.utils import export_timestamp from cowidev.jhu._parser import _parse_args from cowidev.jhu.shared import ( load_population, load_owid_contin...
ovenprint/pandemic-project
data/covid-19-data-master 16.5.22/scripts/src/cowidev/jhu/__main__.py
__main__.py
py
15,505
python
en
code
0
github-code
13
16755994085
"""Breuer state.""" import numpy as np from toqito.perms import symmetric_projection from toqito.states import max_entangled def breuer(dim: int, lam: float) -> np.ndarray: r""" Produce a Breuer state [HPBreuer]_. Gives a Breuer bound entangled state for two qudits of local dimension :code:`dim`, with t...
vprusso/toqito
toqito/states/breuer.py
breuer.py
py
1,734
python
en
code
118
github-code
13
15884686944
# for i in range(0,50): # if i/2 !=0: # return i # def linear_search(arr, target): # for i in range(0,len(arr)): # if arr[i]==target: # print(arr[i],'is present in array') # array=[1,2,3,4,5,6,7,8,9,10] # linear_search(array,4) def binary_search(arr,target): low=0 high=le...
ahmedsharabasy/opp-and-data-structure
code python/review.py
review.py
py
720
python
en
code
0
github-code
13
1954976364
# -*- coding: utf-8 -*- """ Created on Mon Mar 1 18:52:40 2021 Problem 66: Diophantine equation https://projecteuler.net/problem=66 @author: Admin """ import math def solvePell(n): x = int(math.sqrt(n)) y, z, r = x, 1, x << 1 e1, e2 = 1, 0 f1, f2 = 0, 1 while True: y = r * z - y ...
KubiakJakub01/ProjectEuler
src/Problem66.py
Problem66.py
py
813
python
en
code
0
github-code
13
70368405458
bot_template = "BOT : {0}" user_template = "USER : {0}" def respond(message): bot_msg = "I can hear, you said " + message return bot_msg def send_message(message): print(user_template.format(message)) response = respond(message) print(bot_template.format(response)) while True: a=input() send...
bhatnagaranshika02/ChatBots
EchoBot.py
EchoBot.py
py
332
python
en
code
2
github-code
13
18908037123
import os import torch import matplotlib.pyplot as plt from sklearn.decomposition import PCA def visualize_embeddings_from_checkpoint(checkpoint_path, save_path): """ Load the checkpoint, extract token embeddings, and visualize them using PCA. Args: checkpoint_path (str): Path to the saved checkp...
Gallifantjack/llama2_prebias
vizualisations/visualize_embd.py
visualize_embd.py
py
1,221
python
en
code
0
github-code
13
20978107790
import subprocess import pyautogui import io import sys import platform import socket import re import uuid import json import psutil import logging import random import os import requests import webbrowser from pyrogram import Client, filters from PIL import ImageGrab, Image from io import BytesIO from win10toast impo...
quaxxido/pyrogram-cmdline
main.py
main.py
py
14,175
python
en
code
1
github-code
13
26777352361
""" imgur A package for putting images on imgur @category silly @version $ID: 1.1.1, 2015-02-19 17:00:00 CST $; @author KMR, Jason @licence GNU GPL v.3 """ import re import pyimgur from PIL import Image, ImageFont, ImageDraw class imgur: conf = None imagePath = None def __i...
Zeppelin-and-Pails/A858_Image
imgur.py
imgur.py
py
2,930
python
en
code
1
github-code
13
36146872446
import logging import pytest # Explicitly import package-scoped fixtures (see explanation in pkgfixtures.py) from pkgfixtures import host_with_saved_yum_state @pytest.fixture(scope="package") def host_with_hvm_fep(host): logging.info("Checking for HVM FEP support") if 'hvm_fep' not in host.ssh(['xl', 'info', ...
xcp-ng/xcp-ng-tests
tests/xen/conftest.py
conftest.py
py
1,846
python
en
code
3
github-code
13
25686750956
import torch import torch.nn as nn import os class DnCNN_RL(nn.Module): def __init__(self, channels, num_of_layers=17): super(DnCNN_RL, self).__init__() self.dncnn = DnCNN(channels=channels, num_of_layers=num_of_layers) def forward(self, x): noise = self.dncnn(x) return noise...
majedelhelou/BUIFD
Training/models.py
models.py
py
4,188
python
en
code
13
github-code
13
11371426462
from google.cloud import bigquery from MySQLdb import connect, cursors import os, json # writeable part of the filesystem for Cloud Functions instance gc_write_dir = "/tmp" def get_file_mysql(mysql_configuration): """ Querying data using Connector/Python via *host* MySQL server. The function retur...
OWOX/BigQuery-integrations
mysql/main.py
main.py
py
3,847
python
en
code
46
github-code
13
25320300329
import re from itertools import product in_file = "input.txt" def read_input_lines(): with open(in_file, 'r') as fh: in_string = fh.read().replace("\n", " ") return in_string.split("mask = ")[1:] def format_input(): data = read_input_lines() pattern = re.compile("mem\[(\d+)\] = (\d+)") ...
voidlessVoid/advent_of_code_2020
day_14/dominik/main.py
main.py
py
2,103
python
en
code
0
github-code
13
41431592643
import numpy as np import scipy import scipy.io as sio import sys import os import casadi as cas import casadi.tools as ct from typing import Union, List, Dict, Tuple, Optional, Callable from abc import ABC from dataclasses import dataclass from enum import Enum, auto import copy import pdb # sys.path.append(os.path....
4flixt/2023_Stochastic_MSM
blrsmpc/smpc/ss_smpc.py
ss_smpc.py
py
3,147
python
en
code
6
github-code
13
3746250048
import json import logging import os import re import sys from multiprocessing import Pool from mwm import Mwm from mwm.ft2osm import read_osm2ft class PromoIds(object): def __init__(self, countries, cities, mwm_path, types_path, osm2ft_path): self.countries = countries self.cities = cities ...
organicmaps/organicmaps
tools/python/post_generation/inject_promo_ids.py
inject_promo_ids.py
py
4,244
python
en
code
7,565
github-code
13
34823949171
# Find simplified formula for bank balance sheet change as a result of # ELA collateral seizure # Christopher Gandrud # MIT License ################################################################################ # Import SymPy import sympy as sp from sympy.abc import eta, gamma # Define symbols (eta and gamma import...
christophergandrud/ela_fiscal_costs
formal_modelling/ela_balance_sheet_effects.py
ela_balance_sheet_effects.py
py
653
python
en
code
2
github-code
13
43285290370
# Python3 # 14-3-21 # Documentation # Here it goes: from tkinter import * import configparser class salary: def __init__(self, root): self.config = configparser.ConfigParser() self.config.read('main_config.ini') # To show all sections of config file. # print(self.config.sections(...
AdityaSawant0912/Salary_Management_v2
main.py
main.py
py
636
python
en
code
0
github-code
13
14849260021
import requests import pymongo import pandas as pd from selenium import webdriver from scrapy.http import TextResponse import getpass import time import re class instagram_crawling(): def __init__(self): login_url = "https://www.instagram.com/accounts/login/?source=auth_switcher" self.driver ...
yeejun007/instagram_crawling
insta_crawling.py
insta_crawling.py
py
10,398
python
en
code
0
github-code
13
31171795542
from turtle import left num = list(map(int, input().split())) type = 0 for i in num : if i > 10000 or i < 1 : print("์ž…๋ ฅ ์˜ค๋ฅ˜") type = 1 else : None if type == 0 : f = num[0] * num[3] f1 = num[2] * num[1] mom = num[1] * num[3] son = f - f1 left = 2 while True : ...
64542/-
05.py
05.py
py
573
python
en
code
0
github-code
13
25680771087
import numpy as np import pandas as pd from flask import Flask, render_template, request from sklearn.feature_extraction.text import CountVectorizer from sklearn.metrics.pairwise import cosine_similarity def create_sim(): data = pd.read_csv('data.csv') cv = CountVectorizer() count_matrix = cv.fit_transfor...
rahulbhadja/movie-recommendation-webapp
main.py
main.py
py
1,390
python
en
code
3
github-code
13
4670797862
# ะะปะณะพั€ะธั‚ะผั‹ ั ัƒัะปะพะฒะธะตะผ x = int(input('ะ’ะฒะตะดะธั‚ะต ั…: ')) if x > 0: y = 2 * x - 10 elif x == 0: y = 0 else: y = 2 * abs(x) - 1 # abs - ั„ัƒะฝะบั†ะธั, ะบะพั‚ะพั€ะฐั ะฝะฐั…ะพะดะธั‚ ะผะพะดัƒะปัŒ ั‡ะธัะปะฐ print(f'y = {y}')
mutedalien/PY_algo_interactive
less_1/task_3.py
task_3.py
py
258
python
ru
code
0
github-code
13
1127895517
import hashlib import urllib.parse import logging import mimetypes from ckan.plugins.toolkit import request, requires_ckan_version from ckan.lib.munge import munge_tag import ckanext.geodatagov.model as geodatagovmodel from ckan import __version__ as ckan_version requires_ckan_version("2.9") from . import blueprint...
GSA/ckanext-geodatagov
ckanext/geodatagov/plugin.py
plugin.py
py
22,178
python
en
code
34
github-code
13
24147737484
input_text = open("text.txt", "r") alfabit = "abcdefghijklmnopqrstuvwxyz" sym_dict = dict() # ะกะพัั‚ะฐะฒะปะตะฝะธะต ัะปะพะฒะฐั€ั ั ะบะพะปะธั‡ะตัั‚ะพะฒะพะผ ะฑัƒะบะฒ ะฒ ั‚ะตะบัั‚ะต for i_line in input_text: for sym in i_line.lower(): if sym in alfabit: if sym in sym_dict: sym_dict[sym] += 1 else: ...
ilnrzakirov/Python_basic
Module22/08_frequency_analysis/main.py
main.py
py
1,813
python
ru
code
0
github-code
13
26216522140
import os import urllib.request from abc import ABC, abstractmethod from typing import Iterable import numpy as np import pandas as pd from sklearn.model_selection import StratifiedGroupKFold from lrbenchmark.typing import TrainTestPair, XYType class Dataset(ABC): @abstractmethod def get_splits(self, seed: ...
NetherlandsForensicInstitute/lr-benchmark
lrbenchmark/dataset.py
dataset.py
py
7,311
python
en
code
0
github-code
13
44150359402
""" Task: Remove duplicate words from the given string. Example: 'alpha beta beta gamma gamma gamma delta alpha beta beta gamma gamma gamma delta' returns => 'alpha beta gamma delta' """ """ Steps: 1) split the string based on " " 2) iterate over the splitted list of strings 3) c...
oris-96/Python-Algorithms
remove_duplicate_words.py
remove_duplicate_words.py
py
805
python
en
code
0
github-code
13
12861907040
"""ะะตะพะฑั…ะพะดะธะผะพ ัะพะทะดะฐั‚ัŒ ั‚ั€ะธย ัะปะพะฒะฐั€ัย ะธ ะฝะฐะฟะธัะฐั‚ัŒ ั„ัƒะฝะบั†ะธัŽ, ะบะพั‚ะพั€ะฐั ัะผะพะถะตั‚ ะฑั€ะฐั‚ัŒ ัะปะพะฒะฐั€ะธ ะธ ะฟั€ะพะธะทะฒะพะดะธั‚ัŒ ะธั…ย ัะปะธัะฝะธะตย ะฒ ะพะดะธะฝ""" def fun_dict(x, y, z): """fun_dict merges three given dictionaries""" d = {**x, **y, **z} return d d1 = dict(a=1, b=2, c=3) d2 = dict(d=4, e=5, f=6) d3 = dict(g=7, h=8, i=9) print("Dicti...
nestelementary/Contacts
G117_Nesteruk_DZ_5_Dictionaries.py
G117_Nesteruk_DZ_5_Dictionaries.py
py
539
python
ru
code
0
github-code
13
18168416245
import glob import os import re import shutil import subprocess import warnings from distutils.dir_util import copy_tree from distutils.file_util import copy_file, move_file from shutil import rmtree from setuptools import Distribution, Extension, find_packages, setup from setuptools.command.build_ext import build_ext...
Xilinx/PYNQ-Utils
setup.py
setup.py
py
1,825
python
en
code
1
github-code
13
20132804697
import torch from torch.utils.data import Dataset import os import h5py ''' Define a class to contain the data that will be included in the dataloader sent to the 3D-CNN ''' class CNN_Dataset(Dataset): def __init__(self, hdf_path, feat_dim=22): super(CNN_Dataset, self).__init__() self.hdf_path = hdf_path self...
caiyingchun/HAC-Net
src/CNN/CNN_dataset.py
CNN_dataset.py
py
900
python
en
code
null
github-code
13
4762871099
from colorsys import hls_to_rgb #conversion between different color models from cmath import phase #cmath also has a lot of cool complex functions you can graph from math import pi, floor from PIL import Image, ImageDraw #The below method translates the native coordinates of an image's pixels #so that (0, 0) is at th...
MattBroe/complex-function-grapher
complex_grapher.py
complex_grapher.py
py
1,568
python
en
code
0
github-code
13
42834664258
# Logging tests import unittest import calipertest as cat class CaliperLogTest(unittest.TestCase): """ Caliper Log test cases """ def test_log_verbose(self): target_cmd = [ './ci_test_basic' ] env = { 'CALI_LOG_VERBOSITY' : '3', 'CALI_LOG_LOGFILE' : 'stdout' } ...
LLNL/Caliper
test/ci_app_tests/test_log.py
test_log.py
py
2,652
python
en
code
300
github-code
13
23327230990
class Solution_recur: def __init__(self): self.record={} self.max_palindrome='' def longestPalindrome(self, s: str) -> str: # print(self.max_palindrome) length=len(s) if length < 2 or self.testPalindrome(s): if len(s) > len(self.max_palindrome): ...
vincentX3/Leetcode_practice
medium/005LongestPalindromicSubstring.py
005LongestPalindromicSubstring.py
py
3,403
python
en
code
2
github-code
13
39751079792
from typing import Dict, Union # Third Party Imports from sqlalchemy import Column, Integer, String # RAMSTK Local Imports from .. import RAMSTK_BASE from .baserecord import RAMSTKBaseRecord class RAMSTKMethodRecord(RAMSTK_BASE, RAMSTKBaseRecord): # type: ignore """Class to representramstk_method in the RAMSTK...
ReliaQualAssociates/ramstk
src/ramstk/models/dbrecords/commondb_method_record.py
commondb_method_record.py
py
1,432
python
en
code
34
github-code
13
13039855737
import os import shutil import csv def organizeFolderGAPED(original, pos, neg, neut): # Copies each image in the GAPED database to the corresponding folder # Make a dictionary of file names to valence dict = {} files = os.listdir(original) for file in files: if '.txt' in file and 'SD' not in file and '...
harrysha1029/organize_images_GAPED_OASIS
organize.py
organize.py
py
2,241
python
en
code
3
github-code
13
34421041078
# coding=utf-8 """Tools used for solving the Day 16: Proboscidea Volcanium puzzle.""" # Standard library imports: import itertools import re from typing import Iterable # Third party imports: from aoc_tools.algorithms.a_star_search import Node, a_star_search class Room(Node): """Location within the volcano's tu...
JaviLunes/AdventCode2022
src/aoc2022/day_16/tools.py
tools.py
py
11,399
python
en
code
0
github-code
13
3710607553
import numpy as np import tensorflow as tf DEBUG = True def reshape_in(x): ''' as the input format is cat( (bs_normal , ncrops , 32 , feat) , (bs_abnormal , ncrops , 32 , feat) ) reshape so model processes all arrays of features ''' bs, ncrops, ts, feat = x.shape if DEBUG: tf.prin...
zuble/zudeepmil00
train.py
train.py
py
3,988
python
en
code
0
github-code
13
14382415898
# View Pulls Data from models.py during runtime and then process/calculate it and then it send that calculated data to a template. from django.conf import settings from django.contrib import messages from django.core.mail import send_mail # -->send_mail is a function that allows us to send an E-mail with the respect...
Bhupendrachouhan19/Mass_Emailing
sendemail/views.py
views.py
py
2,725
python
en
code
1
github-code
13
13490202276
from __future__ import absolute_import from __future__ import print_function import os import sys import optparse import random from numpy import inf import time import matplotlib.pyplot as plt from heapq import * #priorityqueue import math from copy import deepcopy # we need to import python modules from the $SUMO_H...
neimandavid/traffic-routing
shortlong2_16782/runnerQueue.py
runnerQueue.py
py
24,757
python
en
code
1
github-code
13
26597388590
import xml.etree.ElementTree as ET import utils unwantedTags = utils.construct_unwanted_tags() def main(): tree = ET.parse('test-data2.data') root = tree.getroot() contexts = root.findall("./lexelt/instance/context") for context in contexts: context.text = utils.process_string(context.text, ...
fever324/NLP-Projects
Project2/preprossing.py
preprossing.py
py
511
python
en
code
0
github-code
13
7528379482
from torch import distributed as dist import torch import os import signal import asyncio from functools import wraps from torch import multiprocessing as mp from torch.nn.parallel import DistributedDataParallel as DDP from contextlib import contextmanager from torch.nn.parallel.distributed import _find_tensors from .c...
andyljones/megastep
rebar/processes.py
processes.py
py
8,724
python
en
code
117
github-code
13
30741215229
from statistics import mean, median, mode from time import sleep import request import solver from datetime import date, timedelta import matplotlib.pyplot as plt d1 = date(2022,6,1) d2 = date(2022,7,31) score = [] for i in range((d2-d1).days + 1): d = d1 + timedelta(i) print(d) eq_pos = request.get_precon...
NapoliN/mushikui-solver
measurement.py
measurement.py
py
2,844
python
en
code
0
github-code
13
29113383146
import time def simple_watch(i): if i == 0: simple_watch.start = time.time() return 0 start = simple_watch.start elapsed = time.time() - start return elapsed def to_str(t): t = int(t) m, s = divmod(t, 60) h, m = divmod(m, 60) if h > 0: return "{}h{}m".format(h...
Kumamoto-Hamachi/daily_useful_py
timer/simple_watch.py
simple_watch.py
py
482
python
en
code
1
github-code
13
23727349660
# %% from typing import List class Solution: def minRefuelStops(self, target: int, startFuel: int, stations: List[List[int]]) -> int: queue = [] res = 0 i = 0 n = len(stations) while startFuel < target: while i < n and startFuel >= station...
HXLH50K/Leetcode
871.py
871.py
py
656
python
en
code
0
github-code
13
26819057931
import json import os import requests # Read Trello API auth credentials from local # The credential is store in a local JSON file whose location is defined in a system environment variable called # "TRELLO_API_CONFIG_PATH" # The credential file is a JSON map of the form # { # "key": "<API key>" # "token": <t...
QubitPi/peitho-data
peitho_data/trello_api.py
trello_api.py
py
3,118
python
en
code
0
github-code
13
74363229138
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Film', fields=[ ('id', models.AutoField(verbose...
TeamMoRe/MoRe
bdd/migrations/0001_initial.py
0001_initial.py
py
700
python
en
code
1
github-code
13
17061080434
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class UnavailablePeriodInfo(object): def __init__(self): self._end_day = None self._start_day = None @property def end_day(self): return self._end_day @end_day.set...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/UnavailablePeriodInfo.py
UnavailablePeriodInfo.py
py
1,338
python
en
code
241
github-code
13
30268859195
import numpy as np import pylab as plt time = np.arange(-10,10,0.01) zeros = np.zeros(len(time)) y = np.sinh(time) plt.plot(time,y) plt.plot(time,zeros,'black') plt.plot(zeros,y,'black') plt.xlabel('Voltage V') plt.ylabel('dg/dt') plt.xticks([]) plt.yticks([]) plt.show()
zzyxzz/code-stuff
desktop/threhold.py
threhold.py
py
293
python
en
code
2
github-code
13
1376333261
from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager class SeleniumWebDriver: def __init__(self, download_path=None): self.web_driver = None self.download_path = download_path @property def options(se...
Parth971/github-domain-scraper
src/github_domain_scraper/driver.py
driver.py
py
801
python
en
code
0
github-code
13
33300642625
def linha (): print () print ('_' *42) print () print('=' * 10,'CALCULADORA DE TROCO','=' * 10) print () valorDaCompra = float(input('Digite o valor da sua compra: ')) linha () valorRecebido = float(input('Agora digite o valor o recebido pela compra: ')) linha () valorTroco = valorRecebido -...
JosePaulodeLima/APLICATIVOSENAI
SA_3_v.1.0.3.4.py
SA_3_v.1.0.3.4.py
py
1,688
python
pt
code
0
github-code
13
12134926278
import json from json import JSONDecodeError def get_posts_all(): """ะ—ะฐะณั€ัƒะถะฐะตั‚ ั„ะฐะนะป ั ะฟะพัั‚ะฐะผะธ ะธ ะฟั€ะตะพะฑั€ะฐะทัƒะตั‚ ะธะท ั„ะพั€ะผะฐั‚ะฐ JSON""" try: with open('static/data/posts.json', 'r', encoding='utf-8') as file: data = json.load(file) return data except FileNotFoundError: print('ะคะฐ...
porublevnik/Porublev_Course_3
utils/utils.py
utils.py
py
4,238
python
ru
code
0
github-code
13
74854962577
# -*- coding: utf-8 -*- import scrapy class MingyanSpiderSpider(scrapy.Spider): name = 'mingyan_spider' # allowed_domains = ['mingyan.com'] def start_requests(self): urls = [ 'http://lab.scrapyd.cn/page/1/', 'http://lab.scrapyd.cn/page/2/', ] for url in url...
Ewenwan/python_study
tutorial/L48scrapy/mingyan/mingyan/spiders/mingyan_spider.py
mingyan_spider.py
py
640
python
en
code
1
github-code
13
8678311356
import numpy as np import pandas as pd import os from PIL import Image, ImageOps from keras.models import Sequential, load_model from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D from keras.preprocessing import image from sklearn.model_selection import train_test_split from tqdm import tqdm def ...
akshay772/predict_deep_fashion_attributes
multi_label_CNN.py
multi_label_CNN.py
py
6,745
python
en
code
1
github-code
13
31666564361
from pyspark.sql import SparkSession from pyspark.sql.functions import from_json, col, window, collect_list, count, avg, min, max from pyspark.sql.types import StructType, StructField, StringType, FloatType, TimestampType, IntegerType from kafka import KafkaProducer import json import sys topic = sys.argv[1] spark = ...
tushar-bhat/Stock-Market-Analysis-DBT-Project
sparkstream.py
sparkstream.py
py
3,232
python
en
code
1
github-code
13
27630819230
import numpy as np import theano import theano.tensor as T import theano.sandbox.cuda as cuda from theano.misc.pycuda_utils import to_gpuarray import scikits.cuda from scikits.cuda import fft from scikits.cuda import linalg from scikits.cuda import cublas import pycuda.gpuarray import theano.misc.pycuda_init impo...
benanne/theano_fftconv
fftconv.py
fftconv.py
py
13,289
python
en
code
50
github-code
13
42680145475
import sys # exiting nicely import copy # copying KeyCombo's over import re # parsing files import evdev # I/O from functools import reduce # necessary grabbing of keyboard so that keymasks can be formulated kb = evdev.InputDevice('/dev/input/event0') KB_CAPABILITIES = kb.capabilities()[1] # list of ecodes ...
mszegedy/claccord
claccord.py
claccord.py
py
22,788
python
en
code
0
github-code
13
73102066896
import numpy as np import pathlib import glob import os import sys import shutil import uuid class Fld: """Create folders automatically to be used as stand-alone application or along PySoftK. Examples -------- """ def __init__(self): pass def fxd_name(self, testname)...
alejandrosantanabonilla/pysoftk
pysoftk/folder_manager/folder_creator.py
folder_creator.py
py
4,800
python
en
code
13
github-code
13
33250522550
import time import tensorflow as tf import numpy import muct_input import os import matplotlib.pyplot as plt from tensorflow.python.framework.ops import GraphKeys from tensorflow.python.framework.ops import convert_to_tensor from tfobjs import * config = tf.ConfigProto() config.gpu_options.per_process_gpu_mem...
htkseason/CNN-Facial-Points-Localization
cnn_muct.py
cnn_muct.py
py
5,034
python
en
code
0
github-code
13
16184721473
""" ๋ณผ๋ง๊ณต ๊ณ ๋ฅด๊ธฐ - ์ž…๋ ฅ : ๋ณผ๋ง๊ณต์˜ ๊ฐœ์ˆ˜ N(1 <= N <= 1,000), ๊ณต์˜ ์ตœ๋Œ€ ๋ฌด๊ฒŒ M(1 <= M <= 10) ๊ฐ ๋ณผ๋ง๊ณต์˜ ๋ฌด๊ฒŒ K๊ฐ€ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋Œ€์–ด ์ฃผ์–ด์ง(1 <= K <= M) - ์ถœ๋ ฅ : ๋‘ ์‚ฌ๋žŒ์ด ๋ณผ๋ง๊ณต์„ ๊ณ ๋ฅด๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜ """ from sys import stdin n, m = map(int, stdin.readline().split()) balls = list(map(int, stdin.readline().split())) # 1๋ถ€ํ„ฐ 10๊นŒ์ง€์˜ ๋ฌด๊ฒŒ๋ฅผ ๋‹ด์„ ์ˆ˜ ์žˆ๋Š” ๋ฆฌ์ŠคํŠธ array =...
akana0321/Algorithm
์ด๊ฒƒ์ด ์ฝ”๋”ฉํ…Œ์ŠคํŠธ๋‹ค with ํŒŒ์ด์ฌ/Previous_Question_by_Algorithm_Type/ball_choice.py
ball_choice.py
py
852
python
ko
code
0
github-code
13
6793433632
# -*- coding: UTF-8 -*- #Original code from: #http://ankitvad.github.io/blog/visualizingwhatsappchathistory.html ## def hasNumbers(inputString): return any(char.isdigit() for char in inputString) # Define inputs whatsappfile="WhatsApp Chat with Misha Imtiaz.txt" #Whatsapp text file as made by whatsapp. na...
Sid281088/Whatstat
WhatStat_group.py
WhatStat_group.py
py
2,343
python
en
code
0
github-code
13
33524135788
#-*- coding:utf-8 -*- from utils import run_cmd, run_adb_cmd, RunCmdError, list_snapshots, CacheDecorator from config import getConfig import os, subprocess import sys import time import re class AVD: def __init__(self, name, device, path, target, base, tag, optional_pairs): self.name = name self....
sjoon2455/smartMonkey_login
emulator.py
emulator.py
py
12,803
python
en
code
0
github-code
13
22635526997
import torch from torch import Tensor from torch.nn.parameter import Parameter class ExtendibleLinear(torch.nn.Linear): def updateUniverseSize(self, n): f_to_add = n - self.in_features self.weights = torch.cat( (self.weights, Parameter(torch.Tensor(self.out_features, f_to_add))), 1) ...
tchordia/ML
transfer/transfer.py
transfer.py
py
1,677
python
en
code
0
github-code
13
12336173358
if __name__ == "__main__": n = int(input()) coins = list(map(lambda i : int(i), input().split(' '))) coins = sorted(coins, reverse=True) total_value = 0 coin_count = 0 for value in coins: total_value += value count = 0 value = 0 for val in coins: value += val count += 1 if value...
Shaharafat/Problem-Solving
codeforces/twins.py
twins.py
py
377
python
en
code
0
github-code
13
3634448380
# Given a JSON file with several dictionaries in it, find the value for a given key. # The key will always be in one of the dictionaries. # Remember, post an explanation with your code. # [{"Fruit": "Apples", "Lock": 4, "Code": "Python"}, # {"Market": "Bazaar", "Funny": true, "Math": 0.003, "Fly": false}, # {"Animal":...
ashish-kumar-hit/python-qt
python/practice-questions-code/find-dict-value.py
find-dict-value.py
py
824
python
en
code
0
github-code
13
41148948963
from datos import insertRow,readOrder from pantallas_class import * from datos import * def partida(): game = Partidas() higescore=0 salir=False while not salir: game = Partidas() salir=game.menu_pp() if not salir: salir=game.pantalla_juego(higescore) hig...
Aisengar/THE_QUEST_NAVE
THE_QUEST/controlador.py
controlador.py
py
950
python
es
code
1
github-code
13
5438787482
#!/usr/bin/env python # coding: utf-8 # # 9์žฅ. ์ง€๋ฆฌ ์ •๋ณด ๋ถ„์„ (1) ์ฃผ์†Œ๋ฐ์ดํ„ฐ๋ถ„์„+๋งต # # 1. ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ # ### ๋ฐ์ดํ„ฐ ํŒŒ์ผ ์ฝ์–ด์˜ค๊ธฐ # In[1]: import pandas as pd CB = pd.read_csv('./DATA/CoffeeBean.csv', encoding='CP949', index_col=0, header=0, engine='python') CB.head() #์ž‘์—… ๋‚ด์šฉ ํ™•์ธ์šฉ ์ถœ๋ ฅ # # 2. ๋ฐ์ดํ„ฐ ์ค€๋น„ ๋ฐ ํƒ์ƒ‰ # ## ์‹œ/๋„ ํ–‰์ •๊ตฌ์—ญ ์ด๋ฆ„ ์ •๊ทœํ™” # In[2]: # ๋‹จ์–ด๋ณ„๋กœ ๋ถ„๋ฆฌ addr...
devamateur/bigdata
week08/09์žฅ_์ฃผ์†Œ๋ฐ์ดํ„ฐ๋ถ„์„.py
09์žฅ_์ฃผ์†Œ๋ฐ์ดํ„ฐ๋ถ„์„.py
py
3,768
python
ko
code
0
github-code
13