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
45291578592
# -*- coding: utf-8 -*- import enum from django.utils.translation import ugettext_lazy as _ class NotifyLevel(enum.IntEnum): involved = 1 all = 2 none = 3 NOTIFY_LEVEL_CHOICES = ( (NotifyLevel.involved, _("Involved")), (NotifyLevel.all, _("All")), (NotifyLevel.none, _("None")), ) class We...
phamhongnhung2501/Taiga.Tina
fwork-backend/tina/projects/notifications/choices.py
choices.py
py
880
python
en
code
0
github-code
1
73654168993
from audioop import mul import math import os import json import re from tokenize import Double from urllib import response from qgis.PyQt import QtWidgets, uic from qgis.PyQt.QtCore import pyqtSignal, Qt from qgis.utils import iface from qgis.core import QgsRectangle from qgis.core import ( QgsProject, ) from q...
danylaksono/GeoKKP-GIS
modules/download_persil_sekitarnya.py
download_persil_sekitarnya.py
py
10,423
python
en
code
2
github-code
1
3134901964
for t in range(int(input())) : n = [ i for i in input()] case = [int(''.join(n))] for i in range(len(n)): for j in range(i): temp = n.copy() temp[i], temp[j] = temp[j], temp[i] if (temp not in case) and (temp[0] != '0') : case.append(int(''.join(temp))) ...
DSCodeLearning/SeoYeon
[220202]SWExpertAcademy_13428.py
[220202]SWExpertAcademy_13428.py
py
385
python
en
code
0
github-code
1
14928889627
import sys AVG_WINDOW = 50 TIMES_LARGER = 4 interesting_dates = [] first_bit = [] moving_avg = 0 counter = 0 with open(sys.argv[1], "r") as dates_in: dates = dates_in.readlines() for date in dates: counter +=1 stuff = date.lstrip().split(" ") count = int(stuff[0]) date = stu...
evijit/hci_updates
code/get_interesting_dates.py
get_interesting_dates.py
py
1,196
python
en
code
1
github-code
1
35505514693
# 0708 # def 연습 z = 3 def func_1 (a, b): y = a + b return y func_1 (2, 3) print() # 리스트 lst = list(range(1, 5)) print('lst = ', lst) lst[0] lst = [[1, 2, 3, 4], [5, 6, 7, 8]] lst # 4까지 더하기 sum = 0 for num in range(5) : sum += num print ("~ 4 =", sum) # 10까지 더하기 sum = 0 for num in range(11) : ...
jeongin97/TIL_PYTHON
Day_by_Day/DAY5_third.py
DAY5_third.py
py
1,345
python
ko
code
0
github-code
1
73426566755
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 5 13:44:09 2017 @author: fransebas """ from vectors import * class Matrix(): @staticmethod def I(n): return Matrix([ [1 if i is j else 0 for j in range(n) ] for i in range(n) ]) @staticmethod def toVector(M): if M...
Fransebas/CoolGraphing
LinearAlgebra/matrix.py
matrix.py
py
5,353
python
en
code
1
github-code
1
14751067098
""" The core idea of the data interface is to separate the PRM model from the relational data soucre. The module :mod:`.datainterface` contains a collection of methods to access the relational data that are used by different algorithms (e.g. CPD learners, inference methods, EM algorithm). Another advantage of this appr...
declerambaul/ProbReM
src/data/datainterface.py
datainterface.py
py
4,902
python
en
code
4
github-code
1
20076303982
# -*- coding: utf-8 -*- import re import scrapy from ..custom_setting import inspect_settings from ..items import InspectItem class InspectSpider(scrapy.Spider): custom_settings = inspect_settings name = 'inspect' allowed_domains = ['jib.xywy.com'] start_urls = [] base_url = 'http://jib.xywy.c...
wxy000/MHKG
Data_Manipulation/Crawler/illness/illness/spiders/inspect.py
inspect.py
py
2,284
python
en
code
0
github-code
1
24870661390
"""This class performs database queries for the physiological_annotation_parameter table""" __license__ = "GPLv3" class PhysiologicalAnnotationParameter: def __init__(self, db, verbose): """ Constructor method for the PhysiologicalAnnotationParameter class. :param db : ...
aces/Loris-MRI
python/lib/database_lib/physiologicalannotationparameter.py
physiologicalannotationparameter.py
py
2,270
python
en
code
10
github-code
1
39997325034
import tensorflow as tf import json from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import f_classif from tensorflow.python.keras import models from tensorflow.python.keras.layers import Dense from tensorflow.python.keras.lay...
cbernecker/THINK2019
trainmodels/MLP/createMLP.py
createMLP.py
py
8,169
python
en
code
0
github-code
1
27825438086
from collections import OrderedDict from rest_framework import serializers from products.serializers import ProductSerializer from .models import Sales class SalesSerializer(serializers.ModelSerializer): active = serializers.BooleanField(default=True) product = ProductSerializer() class Meta: model...
SarvarbekUzDev/amway-workers
sales/serializers.py
serializers.py
py
563
python
en
code
0
github-code
1
25329129022
import cv2 import os import face_recognition import pyaudio import speech_recognition as sr from playsound import playsound import time import pyttsx3 # --------------------------------Declaring Variables ------------------------ engine = pyttsx3.init() engine.setProperty('rate',145) knownfaces_names =...
Joanna314/Python-Exploratorium
AI_Security_Sysystem.py
AI_Security_Sysystem.py
py
5,428
python
en
code
0
github-code
1
10243729904
from os import environ, path from pocketsphinx.pocketsphinx import * from sphinxbase.sphinxbase import * MODEL_DIR = "pocketsphinx/model" DATA_DIR = "pocketsphinx/test/data" config = Decoder.default_config() config.set_string('-hmm', path.join(MODEL_DIR, 'hmm/en-us/hub4wsj_sc_8k')) config.set_string('-lm', path.join(...
cirqueit/twilio
sphinx.py
sphinx.py
py
749
python
en
code
0
github-code
1
24065506828
N = int(input()) budget = list(map(int,input().split())) totalBudget = int(input()) totalAsk = sum(budget) if totalBudget >= totalAsk: print(max(budget)) else: start,end = 0,max(budget) while start <= end: tmpBudget = totalBudget mid = (start + end) // 2 for b in budget: ...
o3od3d/Baekjoon-for-coding-test
2512/budget.py
budget.py
py
524
python
en
code
0
github-code
1
15121945465
import json import math from itertools import groupby import pygal # 将数据加载到一个列表中 filename = 'btc_close_2017_requests.json' with open(filename) as f: btc_data = json.load(f) # 创建5个列表,分别存储日期和收盘价 dates = [] months = [] weeks = [] weekdays = [] close = [] # 每一天信息 for btc_dict in btc_data: dates....
wangming-0215/python-start
chapt_16/btc_close_2017.py
btc_close_2017.py
py
2,978
python
en
code
1
github-code
1
6349720871
import sys import os PREFIX = "/" def searchFile(root, result): for file in os.listdir(root): fullpath = os.path.join(root, file) if os.path.isdir(fullpath): searchFile(fullpath, result) if file.split('.')[-1] == "ttf": result.append(fullpath) return result ...
RyotaUnzai/candybox
resource/createQRCFont.PY
createQRCFont.PY
py
826
python
en
code
0
github-code
1
42944513240
import os, sys import time from . import utesthooks from . import pathutil from .printinfo import TestInformationPrinter from .outpututils import XstatusString, pretty_time def run_batch( batch, tlist, xlist, perms, results_writer, test_dir, qsublimit ): "" numjobs = batch.getNumNotRun() s...
rrdrake/vvtools
vvt/libvvtest/execute.py
execute.py
py
6,853
python
en
code
4
github-code
1
72512667555
from discord.ext import tasks from discord.ext.commands import Cog, command ,cooldown ,BucketType from discord.ext import commands from random import choice import discord import requests from discord import Spotify import pendulum # aiohttp should be installed if discord.py is import aiohttp from discord import Webho...
LazyBuds/tommy-discord
lib/cogs/image.py
image.py
py
33,691
python
en
code
0
github-code
1
32105959868
month = int(input()) first_case = ((month==11) or month == 12) or month == 1 second_case = month == 2 or month == 3 third_case = ((month == 4) or month == 5) or month == 6 fourth_case = month == 7 or month == 8 fifth_case = month == 9 or month == 10 if first_case: print("Winter") elif second_case: print("Sp...
bhupathiraju1998/python-intensive
setSeason.py
setSeason.py
py
437
python
en
code
0
github-code
1
72858496994
import requests import os from twilio.rest import Client from dotenv import load_dotenv load_dotenv() account_sid = os.getenv("ACCOUNT_SID") auth_token = os.getenv("AUTH_TOKEN") twilio_phone = os.getenv("TWILIO_PHONE") my_phone = os.getenv("MY_PHONE") # "lat": -36.848461, # "lon": 174.763336, parameters = { "la...
Developer122436/MyScrips
My Projects on Data Science, Web and more/Section 34 - API Weather/RainUpdatedEveryDay.py
RainUpdatedEveryDay.py
py
1,074
python
en
code
0
github-code
1
2058361275
#syzdavane na klas s ime i svoistvo: class MyFirstClass: x=5 #syzdavane na obekt, baziran na syzdaden klas: MyFirstObject= MyFirstClass() #dostypvane elemntite na klasa: print(MyFirstObject.x) #funkciqta konstructor __init__() class Person: def __init__(self,name,age): self.name=name ...
ahmedgavaz/Python
От мен/Клас.py
Клас.py
py
962
python
sl
code
0
github-code
1
41086325709
"""Utilities to manipulate GW data and rational filters. """ __all__ = ['Data', 'Filter'] import astropy.constants as c import qnm import pandas as pd import numpy as np import scipy.signal as ss T_MSUN = c.M_sun.value * c.G.value / c.c.value**3 class Filter: """Container for rational filters. Attributes ...
GeraintPratten/qnm_filter
qnm_filter/gw_data.py
gw_data.py
py
6,452
python
en
code
null
github-code
1
5130260481
# !/usr/bin/env python. # -*- coding: utf-8 -*- """ Look at pairs of stations (NetAtmo-DWD) Select nearest stations, for one DWD station, aggregate to daily and disaggregate according to relative values of NetAtmo station Check if this gives reasonable Temporal structure or not Save the daily DWD and...
AbbasElHachem/extremes
_17_construct_and_compare_daily_netatmo_dwd_dfs.py
_17_construct_and_compare_daily_netatmo_dwd_dfs.py
py
18,021
python
en
code
0
github-code
1
72555902434
a = int(input("masukkan nilai a : ")) b = int(input("masukkan nilai b : ")) def tambah (a,b): c = a+b return c def kurang (a,b): c = a-b return c def kali (a,b): c = a*b return c def bagi (a,b): c = a/b return c def modulo (a,b): c = a%b return c def ...
Ryanzz06/100DaysCoding
Day037.py
Day037.py
py
996
python
id
code
1
github-code
1
71790061475
from modulos import * class Funcs(): def clean_screen(self): self.code_entry.delete(0, END) self.name_entry.delete(0, END) self.phone_entry.delete(0, END) self.city_entry.delete(0, END) self.city_entry.delete(0, END) self.addr_entry.delete(0, END) self.neig_e...
dpsndroid/tkinter_studies
funcionality.py
funcionality.py
py
4,514
python
en
code
0
github-code
1
18746480958
from domain.flightEntity import Flight, FlightException import datetime class FlightService: def __init__(self, flightFileRepo): self._flightRepo = flightFileRepo @property def getAll(self): return self._flightRepo.getAll def add(self, identifier, departure_city, departure_...
pauladam2001/Sem1_FundamentalsOfProgramming
RaisesExam/service/flightService.py
flightService.py
py
6,335
python
en
code
0
github-code
1
43063758249
from collections.abc import AsyncGenerator from typing import Optional from nonebot import logger from nonebot_plugin_access_control_api.context import context from nonebot_plugin_access_control_api.event_bus import ( EventType, T_Listener, on_event, fire_event, ) from nonebot_plugin_access_control_api...
bot-ssttkkl/nonebot-plugin-access-control
src/nonebot_plugin_access_control/service/_impl/permission.py
permission.py
py
5,726
python
en
code
30
github-code
1
11648461448
import os import logging from fastapi import FastAPI from fastapi.responses import FileResponse app = FastAPI() PORT = os.environ.get('PORT', "NNNN") logger = logging.getLogger("uvicorn.error") logger.info(f"Server started in port {PORT}") IMAGE_PATH = "/volume/image.png" @app.get("/") async def root(): if os....
vinhng10/devops-with-kubernetes
part1/exercise-112-Project-v0.6/backend/app/main.py
main.py
py
458
python
en
code
0
github-code
1
13656565356
import sys import whois def check_whois(): for line in open(sys.argv[1], "r", encoding="utf8"): if line[0]== '#': pass else: try: w = whois.whois(line[:-1]) print(""" =============== Domain: {} ============== Na...
HorusTeknoloji/TR-PhishingList
Araclar/whois_check.py
whois_check.py
py
723
python
en
code
69
github-code
1
39497259321
from collections import deque from sys import stdin INF = 1000000000000000000000000 #경로 path의 유량을 찾는 함수 #경로 path에서 흐를 수 있는 유량은 각 경로를 구성하는 간선이 가지는 잔여 용량들 중 최솟값 def make_flow(s,t,path): c = INF #잔여 용량의 최솟값 #끝점 t부터 시작해서 역으로 돌아가면서 #경로 path의 흐를 수 있는 최소 용량을 찾는다 #즉, 경로 path를 구성하는 간선들의 잔여 용량중 최솟값을 찾는다. ...
yundaehyuck/Python_Algorithm_Note
theory_source_code/network_flow/edmonds_karp.py
edmonds_karp.py
py
3,384
python
ko
code
0
github-code
1
7757279605
import matplotlib.pyplot as plt from randomwalk import RandomWalk while True: rw=RandomWalk(90000) rw.fill_walk() #绘制所有的点 plt.scatter(rw.x_values,rw.y_values,c=rw.y_values,cmap=plt.cm.Blues,s=15,edgecolor='none') #绘制起点 plt.scatter(0,0,c='green',edgecolor='none',s=100) #绘制终点 plt.scatter(...
zXin1112/Python-Practice
DataVisualization/DataVisualization/RandomWalkData/rw_visual.py
rw_visual.py
py
633
python
ja
code
0
github-code
1
40543766337
from base.item import Item from util.blender import createMeshObject, getBmesh, parent_set, assignGroupToVerts, addHookModifier from util.inset import Corner class Extruded(Item): def __init__(self, context, op): super().__init__(context, op) def create(self, controls, parent, profile): ...
vvoovv/prokitektura-studio
item/extruded/__init__.py
__init__.py
py
4,178
python
en
code
2
github-code
1
14923646817
#!/usr/bin/env python # Convert TelcoData file to easier to parse CSV import csv import sqlite3 import os input_file = 'sms-email-ocn.csv' output_file = 'database.sqlite' os.remove(output_file) # open datafile and create database c = csv.reader(open(input_file, 'r'), delimiter=',', quotechar='"') db = sqlite3.conne...
Evidlo/nanpa_lookup
build_database.py
build_database.py
py
697
python
en
code
3
github-code
1
32976357692
users = [ # создаю список с пользователями {'name': "Дима", 'numbers': [19, 8, 5, 26, 32]}, # создаю словарь с именем и цифрами {'name': 'Вова', 'numbers': [99, 98, 97, 0, 0]}, {'name': 'Витя', 'numbers': [99, 21, 44, 0, 0]}, {'name': 'Антон', 'numbers': [55, 99, 89, 0, 0]}, {'name': 'Даня', 'numbers': [92, 82, 99...
PECNAS/For-McPab10
next_elem.py
next_elem.py
py
1,133
python
ru
code
0
github-code
1
4768463640
""" LeetCode 240 """ def search_matrix(matrix, target): def binary_search(sequence, item): start = 0 end = len(sequence)-1 while start <= end: mid = (start + end)//2 if sequence[mid] == item: return True else: if item < sequ...
btjd/coding-exercises
array_strings/search_2d_matrix_2.py
search_2d_matrix_2.py
py
1,266
python
en
code
0
github-code
1
74539416352
"""repo2docker: convert git repositories into jupyter-suitable docker images Images produced by repo2docker can be used with Jupyter notebooks standalone or with BinderHub. Usage: python -m repo2docker https://github.com/you/your-repo """ import getpass import json import logging import os import shutil import s...
jupyterhub/repo2docker
repo2docker/app.py
app.py
py
29,605
python
en
code
1,542
github-code
1
2542432153
import colors as c from utils import ask intro = c.pink + ''' Welcome to the pink fluffy unicorns quiz game!!!!!! ''' + c.reset def q1(): fur = ask(c.orange + 'What is the color of a pink fluffy unicorns fur?' + c.reset) if fur == 'pink': return True return False def q2(): dance = ask(c...
gorroth1/python-1
fluffy.py
fluffy.py
py
669
python
en
code
0
github-code
1
13011382304
import datetime import time import asyncio import pandas as pd from ib_insync import * from sqlalchemy import create_engine, update, TIMESTAMP from sqlalchemy.orm import sessionmaker from sqlalchemy.schema import MetaData import random import os IB_PORT = os.environ.get('IB_PORT') if not IB_PORT: IB_PORT = '4002'...
yakneens/hacking-sandbox
get_first_trade_date.py
get_first_trade_date.py
py
7,503
python
en
code
2
github-code
1
896520587
import os import requests import json from typing import Union, List, Any, Optional from concurrent.futures import ThreadPoolExecutor class Base(object): HEADERS = {"User-Agent": "user@domain.com"} DATA_DIRECTORY_NAME = 'Data' CIKS_FILE_NAME = 'entities.json' CWD = os.path.dirname(__file__) DA...
Arman-Mojaver/SEC-filing-CLI
classes.py
classes.py
py
5,648
python
en
code
0
github-code
1
36953321116
from flask import Flask,Blueprint,render_template,request,Response from dal.dbconnhelper import get_db_connection from dal.dml import insert_data,authenticate,get_data import json doctor_object = Blueprint("doctor_object",__name__,url_prefix="/doctor_module") @doctor_object.route('/login') def doctor_login(): r...
867477075/Hospital
doctor_module/Doctor_Module.py
Doctor_Module.py
py
1,663
python
en
code
0
github-code
1
32673762456
#!/usr/bin/python3 from splinter import Browser from selenium.common.exceptions import StaleElementReferenceException from splinter.exceptions import ElementDoesNotExist import requests import json def leggivotilive(browser, url): # Visit URL browser.visit(url) elems = browser.find_by_css(".btn....
abenassen/holyfootball
downloadvotilive.py
downloadvotilive.py
py
3,128
python
it
code
0
github-code
1
9289498129
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import configparser import os from pymongo import MongoClient path = os.path.dirname(os.path.abspath(__file__)) config = configparser.ConfigParser() config.read(path + '''/../config/configuration.cfg''') def connect_to_mongodb(): client = MongoClient( 'mon...
dantunescost/antunedo
python-crons/lib/mongoConnector.py
mongoConnector.py
py
2,930
python
en
code
0
github-code
1
40077462728
# “Code is more often read than written.” --Guido Van Rossum # author : Simone Azeglio """ *************** hillclimbing.py *************** ================================================== After scoring the first string, the algorithm runs a mission for each string adjacent to the first string in t...
sazio/MineNavigation
algorithms/hillclimbing.py
hillclimbing.py
py
6,302
python
en
code
1
github-code
1
39808968448
import csv with open('enjoysport.csv', 'r') as f: reader = csv.reader(f) your_list = list(reader) h = [['0', '0', '0', '0', '0', '0']] print("Training Data:\n") for i in your_list: print(i) if i[-1] == 'yes': j = 0 for x in i: if x != 'yes': if x != h[0][j] and...
flick-23/SEM-6
AI_ML/Ai ml 1/Salgo.py
Salgo.py
py
552
python
en
code
17
github-code
1
25787644908
import random import time from abc import ABC from collections import Sequence from pathlib import Path from typing import Optional, Union, List from lang_tool.languages.functional import FunctionalLanguage from lang_tool.common.exceptions import NotEnoughTokensError from lang_tool.languages.object_oriented import Obj...
Sarvar17/computer-system-architecture
task-3/lang_tool/container.py
container.py
py
4,292
python
ru
code
1
github-code
1
10551759287
import os import torch from torch.utils.data import random_split, DataLoader from torchvision import datasets from torchvision.transforms import transforms from torch.utils.tensorboard import SummaryWriter writer = SummaryWriter() def get_loaders(data_dir, batch_size, split=0.9): transform = transforms.Compose...
xandernewton/Future-Malware-Prediction-Through-Generative-Modelling
PyTorch-GAN/implementations/utils.py
utils.py
py
3,526
python
en
code
0
github-code
1
17481312093
def nck(n,k): # n choose k return fact(n)/(fact(k)*fact(n-k)) def fact(n): if n <= 1: return 1 else: return n*fact(n-1) #print(nck(2,2)) #print(fact(10)) path = 1 for i in range(20): path *=2*20-i path /= (i + 1) print(path)
pussinboot/euler-solutions
euler_15.py
euler_15.py
py
235
python
en
code
0
github-code
1
38569871151
def read_commands(instructions): cycle = 1 x = 1 log = [None, 1] for ins in instructions: s = ins.split() cmd = s[0] if cmd == "noop": cycle += 1 log.append(x) elif cmd == "addx": cycle += 2 log.append(x) x += ...
linusmoreau/AoC
2022/day10/day10.py
day10.py
py
1,149
python
en
code
0
github-code
1
34303345624
# The first bit (resetting the repository paths) should really # be part of the export_project call, so that this sets up the data # in a state that is know to be good for reading. from memops.general.Io import loadProject class Test1: def __init__(self, projectDir): self._projectDir = projectDir ...
ccpnmrV3/ccpnmr2.4
ccpnmr2.4/python/cambridge/wms/Test1.py
Test1.py
py
562
python
en
code
0
github-code
1
21238209307
import os import fnmatch start_dir = "fortune1" for dirpath, dirs, files in os.walk(start_dir): for single_file in files: if fnmatch.fnmatch(single_file, "*txt"): print("Reading... ", single_file) #if second argument is not passed, then 'r' is assumed f = open(os.path.join(dirpath, single_file)) print...
gnurmatova/Python
lecture4/load_data_from_files.py
load_data_from_files.py
py
373
python
en
code
1
github-code
1
22932217800
# Authors: ## Alexandre Santos 80106 ## Leonardo Costa 80162 import csv import re import Stemmer from collections import defaultdict # Class used to read and store document data such as title and abstract # Files with no title or abstract are ignored # All data is stored in a list with a format like # [(doi , "titl...
tuxPT/RI_Assignment1
ass1_classes.py
ass1_classes.py
py
3,952
python
en
code
1
github-code
1
32821265912
# python imports from datetime import datetime, timedelta, timezone from urllib import request from urllib.error import HTTPError, URLError from urllib.parse import urlparse, urlencode import ssl import json import time from collections import OrderedDict import re from enum import Enum import sys # 3rd-party imports ...
SCECcode/pycsep
csep/utils/comcat.py
comcat.py
py
51,244
python
en
code
40
github-code
1
32250528611
def groupAnagrams(self, strs: List[str]) -> List[List[str]]: strdict = defaultdict(list) for s in strs: count = [0] * 26 for c in s: count[ord(c) - ord('a')] += 1 strdict[tuple(count)].append(s) res = [] for l in strdict: re...
imohamnur/Leetcode-Python-Solutions
arrays and hashing/49. Group Anagrams.py
49. Group Anagrams.py
py
360
python
en
code
0
github-code
1
2769505723
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ### /usr/bin/python ### /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ### #!/usr/bin/python -mtimeit """ This Python script is written by Zhiyang Ong to incrementally test features for performing data analytics operations with my Bib...
eda-ricercatore/bibtex-analytics
incremental_test.py
incremental_test.py
py
9,365
python
en
code
1
github-code
1
73723349475
#python pogram to demonstrate global and local variable x='hello' #global var def my_fun(): global x #global var x='world' y='happy'#local var print(y) my_fun() print(x) #pogram to demonstrate nested functions def my_fun(str): for i in str: print(i) def fun(): ...
Mamitakp/PysparkTasks
tasks1.py
tasks1.py
py
765
python
en
code
0
github-code
1
14825222407
""" CSCI5512 HW2 Problem 2 Calculates the marginal distributions of each variable given: 1) a Bayes Net 2) CPT for each variable in Bayes Net """ import numpy as np def get_parents(G, i): ''' Return the parents of node i in Bayes Net G Inputs: G: n...
joh10963/CSCI5512-HW2
prob1.py
prob1.py
py
17,757
python
en
code
0
github-code
1
72584442595
""" This document contains defintions of additional functions used to analyze results from the appendix. Specifically, it studies the sensitivity to hyper-parameters. """ import numpy as np import pandas as pd import warnings import seaborn as sns import matplotlib.pyplot as plt import matplotlib.colors as...
rsonthal/MixedGeometry
analysis_funcs/additional_analysis.py
additional_analysis.py
py
6,412
python
en
code
2
github-code
1
33769466704
import pytest from pathlib import Path from carg_io.abstracts import Parameter, ParameterSet, units, NaN from carg_io.implementations import MyContainer, Box, BoxResults from carg_io.postprocessing import Analyze from random import randint import numpy as np import itertools __author__ = "eelco van Vliet" __copyright_...
eelcovanvliet/carg-io
tests/test_postprocessing.py
test_postprocessing.py
py
2,195
python
en
code
0
github-code
1
5869146992
# import sys def factorial(n): # print(f'input value {n}') assert n>=0 and int(n) == n,'The number must be positive integer only' if n in [0,1]: return 1 else: return n * factorial(n-1) if __name__ == "__main__": # print(sys.getrecursionlimit()) # by default the limit is 1000 and it tries and exit...
gopinathrajamanickam/python_dsa
recursion/factorial.py
factorial.py
py
543
python
en
code
0
github-code
1
7955180213
import unittest from core.Sendhttp import SendHttp from core import Common class qgSceneTest(unittest.TestCase): def setUp(self): self.LoginUrl = "/common/fgadmin/login" self.AddressListUrl = "/fgadmin/address/list" self.TransportFeeUrl = "/common/getTransportFee" self.Su...
King-BAT/RanZhi
Requests/QingGuo/MultiAPI/shengchunyue_test.py
shengchunyue_test.py
py
5,405
python
en
code
0
github-code
1
30715888816
import random from http import HTTPStatus from typing import Union, List from flask_restful import abort from sqlalchemy import and_ from backend.flaskr.model import Question, M_ID, M_QUESTION, M_ANSWER, M_CATEGORY, M_DIFFICULTY, M_TYPE from backend.flaskr.util import MIN_DIFFICULTY, MAX_DIFFICULTY from .base_servi...
ibuttimer/full-stack-trivia
backend/flaskr/service/question_service.py
question_service.py
py
7,129
python
en
code
0
github-code
1
12158934756
from typing import List from unittest import TestCase from src.chinese_checkers.game.Move import Move from src.chinese_checkers.geometry.Hexagram import Hexagram from src.chinese_checkers.game.GameRuleEngine import GameRuleEngine from src.chinese_checkers.game.Position import Position from src.chinese_checkers.game.Pl...
dakotacolorado/ChineseCheckersGameEngine
tests/chinese_checkers/game/test_GameRuleEngine.py
test_GameRuleEngine.py
py
6,802
python
en
code
0
github-code
1
6923815467
import copy import json import sys from os.path import join from generators import ecs_helpers from schema.cleaner import field_or_multi_field_datatype_defaults from schema.oss import TYPE_FALLBACKS # Composable Template def generate(ecs_nested, ecs_version, out_dir, mapping_settings_file): """This generates a...
NybbleHub/opensearch-ecs
scripts/generators/es_template.py
es_template.py
py
9,907
python
en
code
0
github-code
1
30714640656
import yt import trident import h5py as h5 import sys import yt_functions as ytf import ion_plot_definitions as ipd import romulus_analysis_helper as rom_help output = int(sys.argv[1]) #output = ion_list = ['H I'] ds = ytf.load_romulusC(output, ions = ion_list) cen = rom_help.get_romulus_yt_center('romulusC', ou...
ibutsky/romulusC_analysis
plot_cooling_phase.py
plot_cooling_phase.py
py
2,093
python
en
code
0
github-code
1
28988193277
import tempfile import pandas as pd from libcbm.model.cbm_exn import cbm_exn_model from libcbm.model.cbm_exn.parameters import parameter_extraction from libcbm.model.model_definition.model_variables import ModelVariables from libcbm import resources def test_cbm_exn_integration(): with tempfile.TemporaryDirectory...
cat-cfs/libcbm_py
test/model/cbm_exn/integration_test.py
integration_test.py
py
1,767
python
en
code
6
github-code
1
23206016857
import dgl import matplotlib.pyplot as plt import networkx as nx import torch from dgl.nn.pytorch.factory import KNNGraph kg = KNNGraph(1) x = torch.tensor([[0,1], [1,2]]) g = kg(x) print(g.edges()) options = { 'node_color': 'black', 'node_size': 20, 'width': 1, } G = dgl.to_networkx(g) # plt.figure(figsiz...
taotianli/gin_model.py
examples/pytorch/vgae/visulization.py
visulization.py
py
362
python
en
code
5
github-code
1
22575416377
# 문제 뚊 # 데이터 확인하는 문제 from sys import stdin n,m=list(map(int,stdin.readline().split())) image=[] result=0 for i in range(n*2): image.append(stdin.readline().split()) # print(image) for i in range(n): # print(image[i][0]) # print(image[i+n][0]) for j in range(m): # print(image[i][0][j],image[i+n]...
dydwkd486/coding_test
baekjoon/python/baekjoon11383.py
baekjoon11383.py
py
560
python
en
code
0
github-code
1
7928979524
''' Write a python script to display all prime numbers within a range. # range start = 15 end = 45 ''' start=int(input("enter the starting range: ")) end=int(input("enter the end range: ")) print("prime numbers in the range",start,"to",end) for i in range(start,end+1): flag=0 for j in range(2,i): ...
keshav8825/Assigment10
Assigment10/Question10.py
Question10.py
py
424
python
en
code
0
github-code
1
23648933427
from keras.models import load_model from tkinter import * import tkinter as tk import win32gui from PIL import ImageOps, ImageGrab import numpy as np model = load_model('mnist.h5') def predict_digit(img): #resize image to 28x28 pixels img = img.resize((28,28)) #convert rgb to grayscale im...
phambrya/digitRecognition
gui_digit_recognizer.py
gui_digit_recognizer.py
py
2,653
python
en
code
0
github-code
1
39309163763
import os import json def processDict(k,D): '''Doc string: process top level TTP Dictionary member''' Dkeys = list(D.keys()) print (k, Dkeys) def processList(k,L): '''Doc string: process top level TTP List member''' print (k, 'len=', len(L), "names:\n ") for j in L[:]: if isinstance...
opendaylight/ttp
parser/TTPvalid.py
TTPvalid.py
py
11,779
python
en
code
2
github-code
1
71998182753
''' ID: nathany5 LANG: PYTHON3 TASK: non_transitive_dice ''' import sys first_run_done = False for line in sys.stdin: if not first_run_done: first_run_done = True else: input = list(line.rstrip().split(' ')) is_possible = True diceA = input[:4] diceB = input[4:] ...
ThatNerdSquared/sparring
non_transitive_dice.py
non_transitive_dice.py
py
575
python
en
code
0
github-code
1
72111347874
import unittest import pdb import random from fixtures import big_people_fixture, big_tables_fixture, test_table, test_grouping from ..table_utils import Grouping, Table, make_table_and_grouping_objects, get_table, get_grouping class SeatingTestCase(unittest.TestCase): #noinspection PyPep8Naming def setUp(sel...
akaptur/seating
test/test_table_utils.py
test_table_utils.py
py
4,424
python
en
code
0
github-code
1
37676974073
from . import S3Private, MinioPrivate from ..helper import config from ..logging import logger env = config('APP_ENV') class PrivateBackend: backend = None instance = None def __init__(self): if(env == 'local'): self.backend = MinioPrivate else: self.backend = S3P...
goldnetonline/django-rest-api-test
support/storages/private_backend.py
private_backend.py
py
703
python
en
code
0
github-code
1
32685999266
#Importing Libraries from __future__ import print_function import pyaudio import wave import numpy as np import csv import os import shutil from time import sleep import datetime import librosa from PyQt5.QtCore import * class Thread(QObject): finished = pyqtSignal() def __init__(self): QThread.__init...
Utkarsh07/Rhapsody
AA/Rhapsody_module1_input.py
Rhapsody_module1_input.py
py
6,085
python
en
code
0
github-code
1
7732908289
import random import datetime from .utils.date import timedeltastr, total_seconds class RandomDatetime(object): def __init__(self, pre_days=30, post_days=30, hour_min=6, hour_max=21): self.pre_days = pre_days self.post_days = post_days self.hour_min = hour_min self.hour_max = hou...
tkf/orgviz
orgviz/randomnodes.py
randomnodes.py
py
4,449
python
en
code
12
github-code
1
4722007249
"""AdventOfCode 2020 Day23.""" from typing import List import collections test_input_1 = "389125467" puzzle_input = "925176834" def playing(cups: List[int], move: int): """Playing.""" max_cup = max(cups) min_cup = min(cups) q = collections.deque(cups, maxlen=len(cups)) for round in range(1, move...
jneo8/AdventOfCode
2020/day23.py
day23.py
py
2,292
python
en
code
0
github-code
1
24710652293
from typing import List, Tuple LEFT = 1 RIGHT = -1 def get_pointed_length(pointed_segments: List[Tuple[int, int]]) -> int: """ Функция которая вычисляет длину окрашенной части прямой. :param pointed_segments: список с точками начала и конца окрашенных сегментов :type pointed_segments: List[Tuple[int...
OkhotnikovFN/Yandex-Algorithms
trainings_2.0/division_b/hw_7/task_a/a.py
a.py
py
1,424
python
ru
code
1
github-code
1
41643379155
# import time module import time # time at the start of program execution start = time.time() # counter to count the number of instances counter = 0 # for loop to loop from 1 to 9 for i in range(1, 10): power = 1 while True: if power <= len(str(i ** power)): counter += 1 else: ...
saidatta/Project-euler
lib/Problems_1_100/Euler063.py
Euler063.py
py
533
python
en
code
4
github-code
1
31920366085
#!/usr/bin/env python ############################################################################## # # diffpy.utils by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 The Trustees of Columbia University # in the City of New York. All rights reserve...
diffpy/diffpy.utils
src/diffpy/utils/parsers/resample.py
resample.py
py
4,208
python
en
code
2
github-code
1
74180888354
""" Author: Alejandro Arbelaez (Alejandro.Arbelaez@cit.ie) Math example file: Individual.py """ import random import math class Individual: def __init__(self, _size): """ Parameters and general variables """ self.fitness = 0 self.genes = [] self.genSize = _size ...
Jamesohare1/Optimization-Algorithms
Ind_NQueens.py
Ind_NQueens.py
py
1,564
python
en
code
0
github-code
1
10489838090
import configparser import logging import time import dt_util import sys from pymongo import MongoClient class ProgramConfig(object): def __init__(self, logfileName, environment=None, loglevel = logging.INFO, show_log = False): #Logging today = time.strftime("%Y-%m-%d") log_filename = "Lo...
oelegeirnaert/DzjinTonik
config.py
config.py
py
6,343
python
en
code
1
github-code
1
18787135102
# parse CATH database and extract the domain boundary position information of each sequence. (can also extract fragment information) import csv import re class Seq: def __init__(self): self.name = "" self.dNum = 0 # domain self.fNum = 0 # fragment self.domains = [] ...
Graceyh/DomainPrediction
parser.py
parser.py
py
4,403
python
en
code
1
github-code
1
6792882327
import geocoder import threading import datetime def get_geolocations(): try: g = geocoder.ip('me') my_string=g.latlng longitude=my_string[0] latitude=my_string[1] return longitude,latitude except: print('Could Not Get the Co-ordinates!') def get_time(): ...
abuzneid/IoT-Lab---Spring-2019
miscellaneous/Raspberry-Pi/Location Latitude and Longitude/test.py
test.py
py
706
python
en
code
0
github-code
1
14599197842
import pygame from pygame.locals import * from sys import exit import enum pygame.init() class Board: def __init__(self, color, point): self.color = color self.collision = False self.point = point class COLOR(enum.Enum): GREEN = (0, 165, 0) RED = (153, 0, 0) YELLOW = (220, 2...
pepes7/breakout-lpc-2021
main.py
main.py
py
4,050
python
en
code
0
github-code
1
39497498731
from sys import stdin s = stdin.readline().rstrip() n = len(s) eight = [] three = [] k = 0 #뒤에서부터 3자리씩 읽어서, #각각을 10진수로 만들면, 해당자리의 8진수가 된다. #전부 차례대로 이어 붙여주면 8진수로 변환된다 for i in range(n-1,-1,-1): three.append(s[i]) k += 1 if k == 3: summation = 0 for i in range(2,-1,-1)...
yundaehyuck/Python_Algorithm_Note
theory_source_code/string/change_second_eight.py
change_second_eight.py
py
1,092
python
ko
code
0
github-code
1
1585660929
from typing import Optional from decimal import Decimal from validator_collection import validators from highcharts_core import constants, errors from highcharts_core.decorators import class_sensitive, validate_types from highcharts_core.metaclasses import HighchartsMeta from highcharts_core.options.legend.accessibil...
highcharts-for-python/highcharts-core
highcharts_core/options/legend/__init__.py
__init__.py
py
36,376
python
en
code
40
github-code
1
35947564914
# -*- coding: utf-8 -*- import re import csv import matplotlib.pyplot as plt """ This script is for plotting each node# (force/RMSE & TC(300K) diff from 112.1) with classified color of each data# """ if __name__ == '__main__': datagrp=["2","10","20","40","60"] dlabels=['70','350','700','1400','2100'] no...
s-okugawa/HDNNP-tools
tools/Lmps-MD/plotRMSETCdata-all4.py
plotRMSETCdata-all4.py
py
3,341
python
en
code
0
github-code
1
28964755311
from flask import Flask, flash, get_flashed_messages app = Flask(__name__) app.secret_key = 'jerry' @app.route('/login') def login(): flash('welcome to back!', category='login') flash('admin', category='user') return {'msg': 'ok'} @app.route('/get') def get(): msg = get_flashed_messages(with_categor...
jerry117/sample_test
python_flash.py
python_flash.py
py
432
python
en
code
0
github-code
1
34577550604
__author__ = "Antonie Vietor" __copyright__ = "Copyright 2020, Antonie Vietor" __email__ = "antonie.v@gmx.de" __license__ = "MIT" from snakemake.shell import shell log = snakemake.log_fmt_shell(stdout=True, stderr=True) extra = snakemake.params.get("extra", "") # optional input files and directories fasta = snakemak...
leonqli/snakemake-wrappers
bio/subread/featurecounts/wrapper.py
wrapper.py
py
894
python
en
code
null
github-code
1
19327548033
import os from hashlib import md5 from time import time from os import path as op from PIL import Image # Возвращает массив в 2СС из 10СС from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage def convert_base(num): if num == 0: return [0] res = [int(x) for x in list('{0:b}'.format...
dimnik97/events_all
events_all/helper.py
helper.py
py
3,449
python
en
code
0
github-code
1
32484768261
import sys def combi_2(x): return (x * (x - 1)) // 2 n, m = map(int, sys.stdin.readline().strip().split()) arr = list(map(int, sys.stdin.readline().strip().split())) dp = [0] * (n + 1) cs_mod = [0] * 1001 ans = 0 for i in range(1, n + 1): dp[i] = (dp[i - 1] + arr[i - 1]) % m for j in dp: cs_mod[j] += ...
CrimsonTheLegoBuilder/MyBaekjoonSolve
Python_/bj10986_1.py
bj10986_1.py
py
392
python
en
code
0
github-code
1
10461259533
from django.template.loader import render_to_string from django.core.signing import Signer from website.settings import ALLOWED_HOSTS, DEFAULT_FROM_EMAIL from .tasks import task_send_mail signer = Signer() # Используем для создания цифровой подписи def send_activation_notification(user): """ Отправляе...
darkus007/FlatsWebsite
website/members/utilities.py
utilities.py
py
1,487
python
ru
code
1
github-code
1
30714984976
import yt from yt import YTArray from yt import YTQuantity import sys import os import numpy as np import matplotlib.pylab as plt import palettable import seaborn as sns import plotting_tools as pt def plot_density_fluctuation(output, sim, compare, tctf, beta, cr, diff = 0, stream = 0, heat = 0, ...
ibutsky/thermal_instabilities
analysis/plot_creta_tctf.py
plot_creta_tctf.py
py
6,367
python
en
code
0
github-code
1
840939905
import random def add_letters(word, number): encoded = "" for a in word: adding = "" for b in range(0, number): n1 = random.randint(65,90) n2 = random.randint(97,122) rand_n = random.randint(1,2) if rand_n == 1: n1 = 0 ...
smileone22/18Fall_IntroToProgramming
strings_c.py
strings_c.py
py
1,344
python
en
code
0
github-code
1
22291691142
from typing import Any, Dict, List, Type, TypeVar, Union import attr from ..models.transaction_record import TransactionRecord from ..types import UNSET, Unset T = TypeVar("T", bound="TxnOrRegisterLedgerNymResponse") @attr.s(auto_attribs=True) class TxnOrRegisterLedgerNymResponse: """ Attributes: s...
Indicio-tech/acapy-client
acapy_client/models/txn_or_register_ledger_nym_response.py
txn_or_register_ledger_nym_response.py
py
2,214
python
en
code
6
github-code
1
44648789554
# reverse a string using recursion class recursion: def reverse(self,string): if len(string) == 1: return string else: return string[-1] + self.reverse(string[:-1]) if __name__ == "__main__": print(recursion().reverse("srinu"))
TarakaKoda/Python-Data-Structures-and-Algorithms
04 - Bonus CHALLENGING Recursion Problems/04.06 Reverse.py
04.06 Reverse.py
py
278
python
en
code
0
github-code
1
29100352921
class Warrior: def __init__(self): self.health = 50 self.attack = 5 self.is_alive = 1 def disp(self): print(self.health, self.is_alive) def hit(self): self.attack = 5 return self.attack def alive(self): if self.health <= 0: ...
crebiz76/checkio
python/INCINERATOR/TheWarriors.py
TheWarriors.py
py
2,051
python
en
code
0
github-code
1
34841399248
#coding=utf-8 import itertools import logging import os.path as osp import tempfile import torch import copy import random import mmcv import numpy as np from mmcv.utils import print_log from pycocotools.coco import COCO from pycocotools.cocoeval import COCOeval from terminaltables import AsciiTable from torch.utils.d...
mightyzau/Instant-Teaching
projects/InstantTeaching/datasets/ssl_coco.py
ssl_coco.py
py
15,239
python
en
code
36
github-code
1
44441363739
from django.core.management.base import BaseCommand, CommandError from comics.models import Comic, ComicFile, UploadedComicFile from django.utils.dateparse import parse_date from datetime import datetime from django.conf import settings from twython import Twython, TwythonError class Command(BaseCommand): help = "...
lizwalsh/lah
comics/management/commands/publish.py
publish.py
py
1,062
python
en
code
0
github-code
1
36905508880
import os import torch import numpy as np import torch.utils.data as tud from PIL import Image from torchvision import transforms class ImageClusteringDataset(tud.Dataset): def __init__(self, pos_dir, neg_dir): super(ImageClusteringDataset, self).__init__() self.positive_samples = [os.path.join(po...
RickyDoge/WFGN
dataset/imageClusteringDataset.py
imageClusteringDataset.py
py
1,634
python
en
code
0
github-code
1