seq_id stringlengths 7 11 | text stringlengths 156 1.7M | repo_name stringlengths 7 125 | sub_path stringlengths 4 132 | file_name stringlengths 4 77 | file_ext stringclasses 6
values | file_size_in_byte int64 156 1.7M | program_lang stringclasses 1
value | lang stringclasses 38
values | doc_type stringclasses 1
value | stars int64 0 24.2k ⌀ | dataset stringclasses 1
value | pt stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
9021010670 | import json
import time
import datetime
import requests
urla = input("请输入要查询的hash值:")
urlb = "https://apilist.tronscan.org/api/transaction-info?hash="
url = urlb + urla
resp = requests.get(url,verify=False)
#print(f"当前状态为:{resp}")
resp_dict = resp.json()
#print(resp_dict.keys())
print( )
pepo = resp_dict[... | dirb-cll/Odin | tronscan_api.py | tronscan_api.py | py | 1,270 | python | en | code | 0 | github-code | 6 |
19850130214 | # 5.11.2.py
# Ptogram take a 5 point score and converts it into a grade
def main():
print("This program takes a 5 point score and converts it into a Letter Grade.")
score = input("What is your score: ")
# List of Letter grades corresponding with Letter grades
grades = ["F","F","D","C","B","A"]
letS... | mochapup/Python-Programming-2nd-edition-John-Zelle | Ch5/5.11.2.py | 5.11.2.py | py | 440 | python | en | code | 1 | github-code | 6 |
3373952782 |
def get_divisors(number):
divisors = []
for x in range(1, number + 1):
if number % x == 0:
divisors.append(x)
return(divisors)
number = int(raw_input("Enter a number: "))
divisors = get_divisors(number)
# print(str(divisors))
if len(divisors) > 2:
print("This number is not prime.")
else:
print("T... | usman-tahir/python-snippets | python-web-tutorial/check_primality_functions.py | check_primality_functions.py | py | 342 | python | en | code | 0 | github-code | 6 |
4817221286 | import os
import threading
#Main function picture
from main_function_image import open_picture
from main_function_image import show_picture
from main_function_image import save_picture
from main_function_image import to_crop
from main_function_image import write_position
#Background
from picture_operation.... | LeGrosLezard/qu-est-ce-qu-il-y-a-dans-une-salle-a-manger- | v2/main.py | main.py | py | 10,897 | python | en | code | 0 | github-code | 6 |
15134665057 | from _base import *
from os import path
from psychopy.app.builder.experiment import Param
thisFolder = path.abspath(path.dirname(__file__))#the absolute path to the folder containing this path
iconFile = path.join(thisFolder,'code.png')
tooltip = _('Code: insert python commands into an experiment')
_localized = {'Begi... | honeymustard33/experiment_riskdetection | project/psycho/psychopy/app/builder/components/code.py | code.py | py | 3,650 | python | en | code | 0 | github-code | 6 |
71971104189 | import kfserving
import os
from typing import Dict
import torch
import importlib
import sys
PYTORCH_FILE = "model.pt"
class PyTorchModel(kfserving.KFModel):
def __init__(self, name: str, model_class_name: str, model_dir: str):
super().__init__(name)
self.name = name
self.model_class_name ... | kubeflow/kfserving-lts | python/pytorchserver/pytorchserver/model.py | model.py | py | 2,366 | python | en | code | 10 | github-code | 6 |
26829719818 | #!/usr/bin/python
__author__ = "Michael Lienhardt and Jacopo Mauro"
__copyright__ = "Copyright 2017, Michael Lienhardt and Jacopo Mauro"
__license__ = "GPL3"
__version__ = "0.5"
__maintainer__ = "Michael Lienhardt"
__email__ = "michael lienhardt@laposte.net"
__status__ = "Prototype"
def identity(x): return x
#####... | HyVar/gentoo_to_mspl | guest/hyvar/core_data.py | core_data.py | py | 25,599 | python | en | code | 10 | github-code | 6 |
4127628980 | import math
sum=0
number=input("Enter the number")
list=[]
for i in number:
list.append(i)
for i in list:
sum=sum+math.factorial(int(i))
print(sum)
if sum==int(number):
print("It's a strong number")
else:
print("It's not a strong number")
| vijama1/codevita | strong.py | strong.py | py | 260 | python | en | code | 0 | github-code | 6 |
26383863194 | from typing import Tuple
import gym
import numpy as np
class PreprocessEnv(gym.Wrapper): # environment wrapper
def __init__(self, env, if_print=True):
self.env = gym.make(env) if isinstance(env, str) else env
super().__init__(self.env)
self.step = self.step_type
(self.env_name, s... | sbl1996/hrl | hrl/elegant/env.py | env.py | py | 2,648 | python | en | code | 0 | github-code | 6 |
73733786108 | # views.py
import os
from flask import Flask, request, render_template, flash, redirect, url_for, get_flashed_messages, session, abort
from .forms import LoginForm, RegistrationForm, ShoppingListForm, additemsForm
from . import app
from app.modals import User
@app.route('/', methods= ['GET', 'POST'])
def index():
... | Basemera/trailapp | app/views.py | views.py | py | 4,234 | python | en | code | 0 | github-code | 6 |
15932161401 | import datetime
import time
import json
import six
from ..exceptions import HydraError, ResourceNotFoundError
from . import scenario, rules
from . import data
from . import units
from .objects import JSONObject
from ..util.permissions import required_perms
from hydra_base.lib import template, attributes
from ..db.mod... | hydraplatform/hydra-base | hydra_base/lib/network.py | network.py | py | 127,911 | python | en | code | 8 | github-code | 6 |
8659872785 | import argparse
import os
import sys
import time
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler
from watchdog.events import FileSystemEventHandler
#import multiprocessing as mp
from collections import OrderedDict
import re
import copy
import json
import subprocess
#import sched
... | MarkusHaak/dominION | dominion/dominion.py | dominion.py | py | 47,728 | python | en | code | 3 | github-code | 6 |
24293520683 | def shortest_path(file_path):
path_list = file_path.split('/')[1:]
min_path = ['/']
while path_list:
name = path_list.pop(0)
if name == '..':
min_path.pop()
elif name and name != '.':
min_path.append(name+'/')
return "".join(min_path) if min_path else Non... | ckallum/Daily-Interview-Pro | solutions/absolute_path.py | absolute_path.py | py | 460 | python | en | code | 16 | github-code | 6 |
42586362539 | """ Text Preprocessing """
import logging
import re
from functools import lru_cache
from multiprocessing import Pool
from typing import Optional, List
import numpy as np
import pandas as pd
import pymorphy2
from stop_words import get_stop_words
wcoll_morph: Optional[pymorphy2.MorphAnalyzer] = None
g_chunks: Optional[... | vlade89/agrohack2023 | lib/nlp_utils.py | nlp_utils.py | py | 2,935 | python | en | code | 1 | github-code | 6 |
21888978054 | import os
import combat.combat_core as com
import factory.factory_core as fty
import config.config_core as cfg
import expedition.expedition_core as exp
import fleet_switcher.fleet_switcher_core as fsw
import fleet.fleet_core as flt
import nav.nav as nav
import pvp.pvp_core as pvp
import quest.quest_core as qst
import r... | XVs32/kcauto_custom | kcauto/startup/kcauto.py | kcauto.py | py | 13,568 | python | en | code | 5 | github-code | 6 |
19014167036 | import sys
h, w = map(int, input().split())
c = [list(input()) for i in range(h)]
for i in range(h):
for j in range(w):
if c[i][j] == "s":
sx, sy = i, j # スタート
elif c[i][j] == "g":
gx, gy = i, j # ゴール
stack = [[sx, sy]]
visited = [[0 for i in range(w)] for j in range(h)]
vi... | minheibis/atcoder | algorithm/DFS/ATC001A_by_stack.py | ATC001A_by_stack.py | py | 860 | python | en | code | 0 | github-code | 6 |
38831014944 | from keras.callbacks import Callback
from keras import backend as K
from keras.utils import to_categorical
from sklearn.metrics import roc_auc_score
import os
import matplotlib.pyplot as plt
import shutil
import numpy as np
class PerSubjAucMetricHistory(Callback):
"""
This callback for testing model on each su... | bkozyrskiy/NN_hyperopt_search | my_callbacks.py | my_callbacks.py | py | 3,918 | python | en | code | 0 | github-code | 6 |
31299469552 | from django.test import TestCase, Client
from django.urls import reverse
from ecomapp.models import Category, Product, CartItem, Cart, Order, Brand
class TestModels(TestCase):
def setUp(self):
self.category1 = Category.objects.create(
name = 'category1',
slug = 'category-1'
)
self.brand1 = Bran... | hussienalhaj/alhajjj | djangoshop/ecomapp/tests/test_models.py | test_models.py | py | 2,992 | python | en | code | 0 | github-code | 6 |
20366491858 | import parser, compile_lll
def memsize_to_gas(memsize):
return (memsize // 32) * 3 + (memsize // 32) ** 2 // 512
initial_gas = compile_lll.gas_estimate(parser.mk_initial())
function_gas = compile_lll.gas_estimate(parser.parse_func(parser.parse('def foo(): pass')[0], {}))
class Compiler():
def compile(self, c... | 0xc1c4da/viper | compiler_plugin.py | compiler_plugin.py | py | 1,185 | python | en | code | null | github-code | 6 |
43627519034 | class Solution:
"""
Explanation
We have 4 plans:
- kill 3 biggest elements
- kill 2 biggest elements + 1 smallest elements
- kill 1 biggest elements + 2 smallest elements
- kill 3 smallest elements
"""
def minDifference(self, nums: []) -> int:
if len(nums) <=... | MichaelTQ/LeetcodePythonProject | solutions/leetcode_1501_1550/LeetCode1509_MinimumDifferenceBetweenLargestAndSmallestValueInThreeMoves.py | LeetCode1509_MinimumDifferenceBetweenLargestAndSmallestValueInThreeMoves.py | py | 899 | python | en | code | 0 | github-code | 6 |
16814344104 | #!/usr/bin/env python
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name='overcooked_ai',
version='1.1.0',
description='Cooperative multi-agent environment based on Overcooked',
long_description=long_description,
long_des... | samjia2000/HSP | hsp/envs/overcooked_new/setup.py | setup.py | py | 1,135 | python | en | code | 15 | github-code | 6 |
42229692815 | #!/usr/bin/env python
import rospy
from race.msg import drive_param
from nav_msgs.msg import Odometry
from std_msgs.msg import Float64
import math
import numpy as np
from numpy import linalg as LA
from tf.transformations import euler_from_quaternion, quaternion_from_euler
import csv
import os
import copy
# Publisher... | zabrock/Need4Speed-F110-2020 | race_ws/src/need4speed_pure_pursuit/scripts/error_tracking.py | error_tracking.py | py | 3,195 | python | en | code | 0 | github-code | 6 |
19105871775 | from datetime import datetime
from blockCountries import blockCountryList
def minOfGame(isPlaying,isBreak : bool, startPeriod :datetime, startGame :datetime):
'''
:param startPeriod: время начала периода
:param startGame: время начала игры
:return: minOfGame - минута игры, isBreak - перерыв
'''
... | AlexRechnoy/betBot | flashScoreFuncs.py | flashScoreFuncs.py | py | 3,405 | python | en | code | 0 | github-code | 6 |
36004397978 | import collections
class VigenereMethod:
_cipher = ""
def __init__(self, cipherText):
self._cipher = cipherText
def RunMethod(self):
cipher1 = self._cipher
letterFreq = [["A", 8.2], ["B", 1.5], ["C", 2.8], ["D", 4.2], ["E", 12.7], ["F", 2.2],
[... | dhjaekol/cybersecurity | Assignment1/VigenereMethod.py | VigenereMethod.py | py | 3,262 | python | en | code | 0 | github-code | 6 |
21980018417 | import base64
import hashlib
import time
import requests
import tkinter as tk
from tkinter import filedialog
import json
##################
"""
手写文字识别WebAPI接口调用示例接口文档(必看):https://doc.xfyun.cn/rest_api/%E6%89%8B%E5%86%99%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB.html
图片属性:jpg/png/bmp,最短边至少15px,最长边最大4096px,编码后大小不超过4M,识别文字语... | shang-jun123/purchase_management | mepms/ui/ocr_fuction.py | ocr_fuction.py | py | 3,697 | python | en | code | 0 | github-code | 6 |
10420485791 | """
.. attribute:: whole_cache
Used when specifying the scope for a cache invalidation operation to
indicate that the whole cache should be cleared.
.. moduleauthor:: Martí Congost <marti.congost@whads.com>
"""
from typing import Iterable, Union
from cocktail.modeling import (
OrderedSet,
ListWrappe... | marticongost/cocktail | cocktail/caching/scope.py | scope.py | py | 1,282 | python | en | code | 0 | github-code | 6 |
42136460155 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
simlen = 10000
pX = pY = np.ones(6)
pX = pY = pX/6
pZ = np.array([ 1/36, 2/36, 3/36, 4/36, 5/36, 6/36, 5/36, 4/36, 3/36, 2/36, 1/36 ])
possible = np.arange(1,7)
possible_Z = np.arange(2, 13)
X= np.random.choice(possible, simle... | gadepall/digital-communication | ncert/12/13/1/10/codes/die_sim.py | die_sim.py | py | 2,541 | python | en | code | 7 | github-code | 6 |
22762248832 | x = 10
# original version
if x >= 10:
y = 1
else:
y = 0
print("Original version {}".format(x))
# use ternary conditionals instead
y = 1 if x >= 10 else 0
print("Pythonic version {}".format(x)) | ssciwr/Python-best-practices-course | Material_Part5_BetterCoding/examples/ternary.py | ternary.py | py | 206 | python | en | code | 0 | github-code | 6 |
14522883806 | #!/usr/bin/env python3
from flask import Flask, Response, request
from flask_cors import CORS
from PIL import Image
from rembg import new_session, remove
import io
app = Flask(__name__)
CORS(app)
@app.post('/api/rem-bg')
def remBg():
auth = request.headers.get('Authorization', None)
if not auth or not auth.s... | EasySnacks/remove-background-api | main.py | main.py | py | 1,193 | python | en | code | 0 | github-code | 6 |
14418643616 | from django.db.models import fields
from django.shortcuts import render
from django.views.generic import ListView,DetailView,CreateView,UpdateView,DeleteView,RedirectView
from .models import Post
from .forms import PostForm,EditForm
from django.urls import reverse_lazy
# Create your views here.
#def home(request... | AniketShukla14/Interlink_platform | ablog/Theblog/views.py | views.py | py | 1,272 | python | en | code | 2 | github-code | 6 |
26424799614 | import random
import time
import sys
def easy_mode():
score = 100
answerEasy = random.randrange(1,11)
while True:
guess = input('1-10 or q to quit\n')
if guess.isdigit():
if int(guess) == answerEasy:
print('Correct! Your score was', score)
play_again()
elif int(guess) < answerEasy:
print('la... | tbnd88/Guess-the-number | updated_guess_number.py | updated_guess_number.py | py | 2,317 | python | en | code | 0 | github-code | 6 |
72496080189 | """TestProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | Rahmet97/TestProjectBackend | TestProject/urls.py | urls.py | py | 2,302 | python | en | code | 0 | github-code | 6 |
74926945466 | """
Does the work to translate colour/effect names to ANSI codes
"""
# std libs
import numbers
import functools as ftl
# third-party libs
import numpy as np
from matplotlib.colors import to_rgb
# local libs
from recipes.dicts import ManyToOneMap
# relative libs
from .ansi import parse
# source: https://en.wikipe... | astromancer/motley | src/motley/codes.py | codes.py | py | 11,577 | python | en | code | 0 | github-code | 6 |
5308751490 | m, n = map(int, input().split())
key = [list(map(int, input().split())) for _ in range(m)]
lock = [list(map(int, input().split())) for _ in range(n)]
def solution(key, lock):
# 90도 회전
def rotate_90(key):
n = len(key)
rot = [[0]*n for _ in range(n)]
for r in len(n):
for c i... | louisuss/Algorithms-Code-Upload | Python/DongbinBook/simulation/lock_key.py | lock_key.py | py | 1,541 | python | en | code | 0 | github-code | 6 |
18101466174 | from functools import cache
from tkinter import W
from typing import List, Tuple
from unittest import TestCase, main
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
len_x, len_y = len(matrix[0]), len(matrix)
@cache
def dfs(x: int, y: int):
... | hirotake111/leetcode_diary | leetcode/search_2d_matrix_II/solution.py | solution.py | py | 1,686 | python | en | code | 0 | github-code | 6 |
15107122264 | import unittest
import time
from BeautifulReport import BeautifulReport
from base.web_driver import browser
from config.setting import logging
from util.send_email import inser_img,get_time
now = time.strftime("%Y-%m-%d %H_%M_%S")
class StartEnd(unittest.TestCase):
name=''
@classmethod
def setUpClass(cls... | newcaolaing/web_auto | test_case/model/myunit.py | myunit.py | py | 1,237 | python | en | code | 1 | github-code | 6 |
31651316167 | #! /usr/bin/python
from getRoomKitData import send_command, data_to_dict, dict_to_json, start_connect
from dotenv import load_dotenv
import os
load_dotenv()
def get_xconfig(session):
command = "xConfiguration\r"
commandTrimmed = "xConfiguration"
data = send_command(session, command)
# with open('./cal... | ingenium21/getRoomKitData | getRoomKitConfiguration.py | getRoomKitConfiguration.py | py | 590 | python | en | code | 0 | github-code | 6 |
17649871547 |
# IMPORT RANDRANGE FUNCTION FOR COMPUTER MOVEMENTS
from random import randrange
# CREATE THE STARTING BOARD
board = []
n = 1
for row in range(3):
column = [n, n+1, n+2]
n += 3
board.append(column)
board[1][1] = 'X'
# FUNCTIONS
def displayBoard():
# DISPLAY THE CURRENT STATUS OF THE BOARD
p... | antopuli/python-projects | tic-tac-toe.py | tic-tac-toe.py | py | 3,657 | python | en | code | 0 | github-code | 6 |
24987056441 | import csv
import datetime
import time
from datetime import date, timedelta
import netsvc
logger = netsvc.Logger()
if __name__ != '__main__':
from tools import config
else:
config={'addons_path':'/home/quentin/tinydev/cci/code/server/bin/addons'}
partner_dict = {}
partner_dict[''] = ''
dict_partner = {}
de... | factorlibre/openerp-extra-6.1 | account_bob_import/bob_import_step_2.py | bob_import_step_2.py | py | 34,361 | python | en | code | 9 | github-code | 6 |
43975077800 | import mock
import uuid
from contextlib import contextmanager
import webtest
from pyramid.config import Configurator
from cliquet.events import (ResourceChanged, AfterResourceChanged,
ResourceRead, AfterResourceRead, ACTIONS)
from cliquet.storage.exceptions import BackendError
from cliquet... | mozilla-services/cliquet | cliquet/tests/resource/test_events.py | test_events.py | py | 16,885 | python | en | code | 65 | github-code | 6 |
26224854603 | #!/usr/local/bin/python3.7
import cv2
import numpy as np
img = cv2.imread("../test_pic.jpg")
kernel = np.ones((2, 2), np.uint8)
imgCanny = cv2.Canny(img, 100, 200)
imgErosion = cv2.erode(imgCanny, kernel, iterations=1)
cv2.imshow("Edge detection", imgCanny)
cv2.imshow("Erosion Fix", imgErosion)
cv2.waitKey(0) | smoonmare/object_50071 | open_cv/chapter-2/chapter_2_5.py | chapter_2_5.py | py | 313 | python | en | code | 0 | github-code | 6 |
27894174453 | import sys
import collections
#sys.setrecursionlimit(100001)
# bfs로 동작하는 코드: 정확성은 맞지만 시간초과
def bfs_find_root():
while queue:
root = queue.popleft()
for child in tree[root]:
if not visited[child]:
output[child] = root
queue.append(child)
... | SheepEatLion/Algorithms | tree_baekjoon_11725.py | tree_baekjoon_11725.py | py | 1,547 | python | en | code | 0 | github-code | 6 |
72318397308 | import sys
sys.path.append("../SimpleNN")
"""SingleNN potential."""
from fp_calculator import set_sym, calculate_fp
from NN import MultiLayerNet
import torch
from torch.autograd import grad
from Batch import batch_pad
import time
import numpy as np
import pickle
from ase.data import chemical_symbols, atomic_numbers
f... | lmj1029123/SGCMC_Acrolein_AgPd | ML_Models/SNN.py | SNN.py | py | 17,775 | python | en | code | 2 | github-code | 6 |
27427166246 | """
This script has the information for the initialization of the model.
-------------------------------------------------------------------------------
created on:
Thu 3 Mar 2022
-------------------------------------------------------------------------------
last change:
Wed 18 May 2022
-------------------... | frantisek901/PublicOpinion | PythonModel/Generator.py | Generator.py | py | 4,453 | python | en | code | 1 | github-code | 6 |
34829704572 | # -*- coding: utf-8 -*-
"""
animation of global earthquakes locatiopns from 2000-2019
plotted annually
"""
import numpy as np
import matplotlib as plt
from mlp_toolkit.basemat import Basemap as Basemap
#===================================================
# files and parameters
#===... | patrickward110/Astro-199 | Astro119/In Class/Wk 3/global earthquakes.py | global earthquakes.py | py | 1,406 | python | en | code | 0 | github-code | 6 |
33957213827 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 3 17:53:18 2022
@author: yiann
"""
import pandas as pd
import pytz
# eisagwgh tou arxeiou ston kwdika
data_file='Solar_1min_2021.txt'
df=pd.read_csv(data_file, index_col=[0], usecols=[0,6], sep=',', header=None,
parse_dates=True, na_values='"NAN"')
df.columns=['... | ikaitsas/Irradiance-QC-UP | oldstuff/prospathw_na_allaksw_timezones.py | prospathw_na_allaksw_timezones.py | py | 730 | python | en | code | 0 | github-code | 6 |
43394887837 | #!/usr/bin/env python3
"""
zbdump.py
"""
import logging
import subprocess
import sys
import time
import asyncio
from typing import Any, Optional, Union
from scapy.all import Dot15d4FCS # type: ignore
import scapy.all as sp
import datetime as dt
_LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=loggi... | antonio-boiano/IoTScent | core/zbdump.py | zbdump.py | py | 10,906 | python | en | code | 0 | github-code | 6 |
8631487904 | import codecs
import yaml
from typing import Optional
from alert_autoconf.models import Alerts
CLUSTER_NAME_PLACEHOLDER = "{cluster}"
def read_from_file(filename: str, cluster_name: Optional[str]) -> Alerts:
"""
Читает данные из конфиг файла
:param filename: имя файла
:return: словарь конфигурации... | avito-tech/alert-autoconf | alert_autoconf/config.py | config.py | py | 2,092 | python | en | code | 1 | github-code | 6 |
35971477802 | from Tkinter import *
import tkMessageBox
import tkFont
import ttk
import RPi.GPIO as GPIO
import time
import serial
import threading
import Queue
#Start Serial Communication with Arduino Mega in another thread
ser = serial.Serial ("/dev/ttyS0",9600)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(38, GPIO.OUT)
GPIO.setup(37, G... | mschweig/mechatronicPlayground | gui.py | gui.py | py | 3,256 | python | en | code | 0 | github-code | 6 |
1898256439 | import re
from copy import copy
from timeit import default_timer as timer
import numpy as np
DEBUG = True
"""This is the sorts timer. It's a class with all the sorts and a timer function to time how long it takes for the sorting algorithms to sort the list
the user inputs!"""
# This function is used to time the algo... | stevevandijk/sorts | Sortstimer.py | Sortstimer.py | py | 6,452 | python | en | code | 0 | github-code | 6 |
70452853947 | def build(topics):
import html
print('Welcome to trivia night!\n How many questions would you like?')
amount = input('enter a number: ')
url = f'https://opentdb.com/api.php?amount={amount}'
print('Which topic would you like?')
for topic in topics:
name = html.unescape(topic['name'])
print(topic['... | austenc-id/Guild | 1 - Python/14/functions/url.py | url.py | py | 723 | python | en | code | 0 | github-code | 6 |
24793906303 | #!/usr/bin/env python3
import argparse, re
from sys import exit
from os import path
def getCombLayerObject(cell):
"""Return CombLayer object name based on its cell number"""
fname = "ObjectRegister.txt"
if not path.isfile(fname):
fname = path.join("case001", fname);
if not path.isfile(fname)... | kbat/mc-tools | mctools/common/CombLayer/getcell.py | getcell.py | py | 1,577 | python | en | code | 38 | github-code | 6 |
4840987385 | #!usr/local/bin/python
#coding: utf-8
'''
Created on 2016年3月14日
@author: CasparWang
'''
"""
################################################################################
provide type-specific option sets for application
################################################################################
"""
... | Calvin-WangA/learning | learning/GUI/chapter4/mytools.py | mytools.py | py | 1,481 | python | en | code | 0 | github-code | 6 |
36187285700 | from dataclasses import dataclass
import pytest
from pydantic import ValidationError, Json, BaseModel
from typing import Optional
from qwery import Model, Query, JSONB
class ExampleModel(Model):
class Meta:
table_name = "test"
a: int
b: Optional[str]
c: bool
def test_compile_select_query():... | uplol/qwery | qwery/test_qwery.py | test_qwery.py | py | 3,862 | python | en | code | 18 | github-code | 6 |
30394819861 | from strings.games.deckofcards import Deckofcards
from strings.games.player import Player
# from strings.games.card import Card
class Cardgame:
# מאתחל את המשחק קלפים
def __init__(self, player1, player2, number_of_cards_for_all_players = 10):
if type(number_of_cards_for_all_players) == int:
... | arielvaks/games.cards | strings/games/cardgame.py | cardgame.py | py | 2,151 | python | en | code | 0 | github-code | 6 |
9727275592 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 11:39:34 2019
@author: Administrator
"""
#s1 =["ram","ravi","rahul","gopal"]
#s2 ="chandraprakash"
#
#for item in s1:
# print(item)
#
#for item in s2:
# print(item)
#
#index = 0
#for item in s1:
# print(index, item)
# index += 1
... | chandraprakashh/Data_Handling | code_prectics.py | code_prectics.py | py | 2,291 | python | en | code | 0 | github-code | 6 |
42335391035 |
# This program for monthly income and expenses
print("This Program will helps someone create a budget")
# input from user for ask their monthly income and expenses
monthly_income=float(input("How much is your total monthly Income?"))
housing_expenses: float=float(input("How much do you spend on your housing ... | jyotsnaagrawal/prg105 | budget.py | budget.py | py | 2,066 | python | en | code | 0 | github-code | 6 |
19400375604 | from time import sleep
import nmap
import nvdlib
from model.host import Host
from model.port import Port
from model.cve import *
class Scanner:
def __init__(self, network=None):
self._network = network
self._list_content_host = []
self._nmap = nmap.PortScanner()
def info_hosts_networ... | jonassantos1000/tcc | model/scanner.py | scanner.py | py | 4,245 | python | en | code | 0 | github-code | 6 |
27513951023 | import ctypes
from timsconvert.constants import *
# modified from alphatims
def init_bruker_dll(bruker_dll_file_name: str=BRUKER_DLL_FILE_NAME):
bruker_dll = ctypes.cdll.LoadLibrary(os.path.realpath(bruker_dll_file_name))
# Functions for .tsf files
# .tsf Open
bruker_dll.tsf_open.argtypes = [ctypes.c... | orsburn/timsconvert | timsconvert/init_bruker_dll.py | init_bruker_dll.py | py | 7,438 | python | en | code | null | github-code | 6 |
69997094268 | # Class to store parameters while estimating GPFA model
# Usage:
#
# current_params = Param_GPFA_Class(param_cov_type, param_gamma, param_eps,
# param_d, param_C, param_R,
# param_notes_learnKernelParams, param_notes_learnGPNoise,param_notes_RforceDiagonal)
# current_params.param_cov... | harvineet/py-gpfa | core_gpfa/Param_GPFA_Class.py | Param_GPFA_Class.py | py | 1,018 | python | en | code | 5 | github-code | 6 |
74432954107 | from . import views
from django.conf.urls import url, include
urlpatterns = [
url(r'^new$', views.add_new_user),
url(r'^new/process$', views.add_new_user_p),
url(r'^edit$', views.edit_user),
url(r'^edit/process', views.edit_user_p),
url(r'^edit/(?P<u_id>\d+)$', views.edit_user_by_id),
url(r'^ed... | EmilChoparinov/Message-Posting-Website | apps/user_app/urls.py | urls.py | py | 495 | python | en | code | 0 | github-code | 6 |
42649106860 | """
Crawls through the 'source' source and looks for labels starting with 'rancon'.
If such a label is found on a service, then it will register the service in the
'backend'. If the backend supports tag all services will be tagged 'rancon'.
depending on the backend the registration behavior can be influenced by tags
s... | flypenguin/python-rancon | rancon/__init__.py | __init__.py | py | 5,424 | python | en | code | 0 | github-code | 6 |
27625720407 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# In[2]:
import cv2
import numpy as np
import easyocr
import matplotlib.pyplot as plt
# In[3]:
im_1_path = '/Users/abrahamkom/Groupe 3IL 📖/Test/folder/permis4.jpg'
im_2_path = '/Users/abrahamkom/Groupe 3IL 📖/Test/folder/PERMIS.jpg'
print(im_1_path)
# <h1 ... | viannprems99/projet_ocr | old_test.py | old_test.py | py | 1,182 | python | en | code | 0 | github-code | 6 |
14566034034 | from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.views import APIView
from skill_quest_app.models import Course, CourseQuizResult, CourseQuiz, InterestQuiz, CourseEnrollment
from skill_quest_app.serializers import CourseSe... | HemitPatel/Skill_Quest_Backend | skill_quest_app/views.py | views.py | py | 4,263 | python | en | code | 0 | github-code | 6 |
8022084480 | import jieba
from flask import Flask,render_template,request
from peewee import fn
from wordcloud import WordCloud
from src.database import User,Weibo
from src.save import save_user,save_weibo
from src.spider import getuser, getresponse,getweibo
from flask_paginate import get_page_parameter, Pagination
app = Fl... | zuoqian26/weibo_monitor-2.0 | app.py | app.py | py | 4,736 | python | en | code | 0 | github-code | 6 |
37374019551 | #!/usr/bin/env python
"""
ONS Address Index -
===========================================
A simple script to test the data linking.
This is a prototype code aimed for experimentation and testing. There are not unit tests.
The code has been written for speed rather than accuracy, it therefore uses fairly aggressive
b... | ONSdigital/address-index-data | DataScience/Analytics/prototype/PostalAddressesMatching.py | PostalAddressesMatching.py | py | 2,086 | python | en | code | 18 | github-code | 6 |
72255301308 | from __future__ import annotations
import asyncio
import datetime
import re
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
import discord
from dateutil.parser import parse
from discord.ext import commands, menus
from discord.ext.commands import Paginator as CommandPaginator
from ..helpers import ... | LeoCx1000/fish | src/utils/discord_/paginator.py | paginator.py | py | 13,193 | python | en | code | 0 | github-code | 6 |
8320607344 | import urllib.request
import http.cookiejar
import urllib.parse
from bs4 import BeautifulSoup
import os
from People import People
import queue
import io
import gzip
import time
def config_init():
"""initial configuration"""
cookie = http.cookiejar.CookieJar()
cookie_support = urllib.request.HTTPCookieProces... | zhibzeng/PythonCode | zhihuCrawler.py | zhihuCrawler.py | py | 4,001 | python | en | code | 0 | github-code | 6 |
10251169117 | import argparse
import os
import pandas as pd
import json
from pandas.core.frame import DataFrame
from fol.foq_v2 import (concate_n_chains, copy_query,
negation_sink,
binary_formula_iterator,
concate_iu_chains,
decompose_D... | HKUST-KnowComp/EFO-1-QA-benchmark | append_new_normal_form.py | append_new_normal_form.py | py | 2,720 | python | en | code | 17 | github-code | 6 |
13703412898 | # pybutton
# create at 2015/5/28
# autor: qianqians
from tools import argv_instance, tuple_rbg
from pyelement import pyelement
class pybutton(pyelement):
def __init__(self, text, cname, layout, praframe):
# when normal
self.normaltext = text
self.type = "button"
super(pybutton, self).__init__(cname, layout,... | theDarkForce/plask | plask/pybutton.py | pybutton.py | py | 2,060 | python | en | code | 2 | github-code | 6 |
26804076161 | pos = [4, 4]
count = 0
side_len = 1
dist = 1
spiral = [["" for col in range(10)] for row in range(10)]
for num in range(int(input()), int(input()) + 1):
spiral[pos[1]][pos[0]] = str(num)
count += 1
if count <= side_len: pos[1] += dist
elif count > side_len: pos[0] += dist
if count == side_len * 2:
count ... | Stevan-Zhuang/DMOJ | CCC/CCC '01 S2 - Spirals.py | CCC '01 S2 - Spirals.py | py | 471 | python | en | code | 1 | github-code | 6 |
13914688192 | import oneflow as flow
from .recurrent import rnn
def _FullyConnected(input_blob, weight_blob, bias_blob):
output_blob = flow.matmul(input_blob, weight_blob)
if bias_blob:
output_blob = flow.nn.bias_add(output_blob, bias_blob)
return output_blob
class SimpleRNNCell:
def __init__(self, ... | Oneflow-Inc/oneflow_nlp_model | nlp_ops/rnn/simple_rnn.py | simple_rnn.py | py | 5,227 | python | en | code | 0 | github-code | 6 |
73401806269 | import torch
from colorama import Fore as F
def train_step(model, loss_fn, acc_fn, optimizer, dataloader, epochs):
"""
Trains a model for a binary classification task, calculating both loss and accuracy
Args:
model: the model that will be trained
loss_fn: loss function, should be BCEWithLog... | PopeCorn/myr | code/functions.py | functions.py | py | 2,782 | python | en | code | 0 | github-code | 6 |
24547935454 | #!/usr/bin/env python3
import sqlalchemy as sa
import sqlalchemy.exc
import sys
from contextlib import contextmanager
from pathlib import Path
import click
import csv
sys.path.append('tm_navigator')
from tm_navigator.models import *
engine = sa.create_engine('postgresql+psycopg2://postgres@localhost/tm_navigator')
sa... | aplavin/tm_navigator | db_manage.py | db_manage.py | py | 10,341 | python | en | code | 1 | github-code | 6 |
34867843324 | import unittest
from hamcrest import assert_that, instance_of, equal_to, raises, calling
from app.exiftool.s3.object import Object
from app.exiftool.s3.object_iterator import ObjectIterator
from tests.config import Config as TestConfig
class TestS3ObjectIterator(unittest.TestCase):
def setUp(self) -> None:
... | zpieslak/exiftool-aws-lamdba | tests/s3/test_object_iterator.py | test_object_iterator.py | py | 1,358 | python | en | code | 2 | github-code | 6 |
34852034193 | from pyspark.context import SparkContext
import itertools
import collections
from collections import Counter
import time
from operator import add
import os
import sys
def gencomb(freqitem,lenfreqitem):
cand= []
for x in range(0,lenfreqitem-1):
first = freqitem[x]
firstelem = sorted(first)
... | malika-seth/Spark-Data-Mining | HW2_SON_Frequent_Itemsets/malika_seth_task2.py | malika_seth_task2.py | py | 7,640 | python | en | code | 0 | github-code | 6 |
21073364674 | import random
import socket
buf = 1024
timeout = 40
class Packet:
def __init__(self, seq_n, is_ack, data, checksum=None):
self.seq_n = seq_n
self.is_ack = is_ack
self.data = data
self.checksum = checksum
if is_ack == "True":
is_ack = True
if is... | Faranha300/Infracom-CINtofome | rdt.py | rdt.py | py | 2,547 | python | en | code | 0 | github-code | 6 |
24512155771 | import asyncio
from django.core.cache import cache
from apps.integration.models import KotakNeoApi as KotakNeoApiModel
from apps.integration.utils import divide_and_list, get_option_ltp
from apps.integration.utils.broker.dummy import DummyApi
from apps.integration.utils.broker.kotak_neo import KotakNeoApi
from apps.t... | finbyz/trading_child | apps/trade/strategies/__init__.py | __init__.py | py | 8,566 | python | en | code | 0 | github-code | 6 |
29929603258 | from threading import Thread, Lock
from math import ceil
lst = []
NO_THREADS = 8
total_sum = 0
lock = Lock()
class MyThread(Thread):
def __init__(self, index):
Thread.__init__(self)
self.index = index
def run(self):
global total_sum
start = self.index * ceil(l... | florinrm/ASC-Lab-Tutorial | Lab2/sum_list_lock.py | sum_list_lock.py | py | 975 | python | en | code | 0 | github-code | 6 |
32005535437 | import yaml
import os
import logging
from weight import Weight
from schema import Schema, SchemaError, Optional
from typing import Union
_LOGGER = logging.getLogger(__name__)
_LOGGER.setLevel(logging.DEBUG)
class KB_Chaos:
def __init__(self, chaos_path):
self.chaos_path = chaos_path
self.last_cha... | Fengrui-Liu/MicroCBR | microCBR/kb.py | kb.py | py | 9,333 | python | en | code | 6 | github-code | 6 |
14448481028 | from transformers.tokenization_utils import PreTrainedTokenizer
from transformers.utils.dummy_pt_objects import PreTrainedModel
from transformers.data.processors.utils import InputExample, InputFeatures
from .prompts import TemplateGenerator, VerbalizerGenerator
from openprompt import PromptDataLoader, PromptForClassi... | jiachenwestlake/PDA | openprompt/lm_bff_trainer.py | lm_bff_trainer.py | py | 8,021 | python | en | code | 3 | github-code | 6 |
41858644978 | # Faça um programa para o cálculo de uma folha de pagamento,
# sabendo que os descontos são do Imposto de Renda, que depende
# do salário bruto (conforme tabela abaixo) e 3% para o Sindicato
# e que o FGTS corresponde a 11% do Salário Bruto, mas não é descontado
# (é a empresa que deposita). O Salário Líquido corre... | nralex/Python | 2-EstruturaDeDecisao/exercício12.py | exercício12.py | py | 2,019 | python | pt | code | 0 | github-code | 6 |
40110954603 | import os
import random
from urllib.parse import quote
from typing import List, Optional
from dataclasses import dataclass, field
from enum import Enum
from jinja2 import Template
SEAT_NUMBER_MAX_LENGTH = 3
# ascii characters are prohibited :D
ru_alphabet_lower = 'абвгдеёжзиклмопрстуфхцчшщэюя'
names = ['Сергій', 'І... | Tehtehteh/loner-bot | src/bot/models/train_order.py | train_order.py | py | 2,648 | python | en | code | 1 | github-code | 6 |
73477701627 | import functools
import pyopencl as cl
import numpy as np
from .sparsetensor import SparseFunction, SparseTensor
from .densetensor import GPUBuffer, DenseTensor
class GradData:
def __init__(self, data, xidx, yidx, shape):
self.data = data
self.xidx = xidx
self.yidx = yidx
self.shape = shape
def buff... | fpaboim/tinysparse | tinygrad/ops_gpusparse.py | ops_gpusparse.py | py | 32,916 | python | en | code | 9 | github-code | 6 |
11149338597 | def bfs(graph, vis, node, q):
while q:
sz = len(q)
for i in range(sz):
node = q.pop(0)
if vis[node] == True:
continue
print(node, end = " ")
for adj in graph[node]:
q.append(adj)
print()
n = int(input("Enter... | aditya-sar/Sem-6 | AI/bfs.py | bfs.py | py | 649 | python | en | code | 0 | github-code | 6 |
22323641641 | r'''
Python library for standard functions required for numerical methods.
- Method f() - returns value of polynomial at given value.
- Method dof() - returns value of derivative of polynomial at given value.
- Method value() - returns value of expression at given value of x.
'''
import lambdaFunction
... | NotShrirang/Numerical-Methods | StandardFunctions.py | StandardFunctions.py | py | 1,714 | python | en | code | 0 | github-code | 6 |
30418545772 |
from ete3 import Tree , TreeStyle , NodeStyle , faces , AttrFace
import csv
#t = Tree("(A:1,(B:1,(E:1,D:1):0.5):0.5);" )
#t.render("mytree.png", w=183, units="mm")
t = Tree("(0);" )
all_orgs = []
with open('testlineage.csv') as csvfile:
reader = csv.DictReader(csvfile)
for org in reader:
all_orgs.ap... | cgnitash/ded | dedli/pylin.py | pylin.py | py | 2,243 | python | en | code | 0 | github-code | 6 |
34239416344 | """
@author: nabin
This script runs pdb2seq.pl to get sequence from pdb file
"""
import os
import sys
def run_pdb2sec(pdb, density_name, input_path, perl_script_dir):
try:
density_map_dir = os.path.join(input_path, density_name)
pdb_fi = os.path.join(density_map_dir, pdb)
os.system("perl... | BioinfoMachineLearning/cryo2struct | preprocessing/get_pdb_seq.py | get_pdb_seq.py | py | 1,268 | python | en | code | 11 | github-code | 6 |
18200541516 |
'''class is user defined class and used to access more informations'''
class A:
param1= "ras"
param2="rashu"
def fun(self):
print(f'i am {self.param1}')
print(f'i am {self.param2}')
obj= A()
print(obj.param1)
obj.fun() | rashmi-fit/100-daysOf-Python_challenge | season2/userdefinedclass.py | userdefinedclass.py | py | 248 | python | en | code | 2 | github-code | 6 |
43066420004 | import tflearn as tl
import numpy as np
import os,glob,cv2
import sys,argparse
from read_image import read_valid_image
import tensorflow as tf
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data , dropout, fully_connected
# from tflearn.layers.estimator import regression
im... | Eniyanilavan/DogCatIdentification-tensorflow-python | predict1.py | predict1.py | py | 2,021 | python | en | code | 0 | github-code | 6 |
22624757619 | from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases()
import chainer
from chainer import functions as F
import numpy as np... | pfnet-research/capg | clipped_gaussian.py | clipped_gaussian.py | py | 3,811 | python | en | code | 28 | github-code | 6 |
40744293644 | import chess
import math
def scoreCalcBasic(board: chess.Board):
currentScore = 0
for i in range(1,7):
if i == 1:
currentScore += len(board.pieces(i, chess.COLORS[0]))
if i == 2:
currentScore += 3*len(board.pieces(i, chess.COLORS[0]))
if i =... | azkung/AI_Chess_5.5 | python/bots/bot_basic.py | bot_basic.py | py | 3,043 | python | en | code | 0 | github-code | 6 |
9084085834 | import os
import logging, requests
from rdflib import Namespace, Literal, Graph
from rdflib.namespace import DCTERMS, RDF, RDFS
from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore
from rdflib.graph import DATASET_DEFAULT_GRAPH_ID as default
from oslcapi.api.helpers.service_api import get_bucket
log = log... | AlexVaPe/pyOSLC_GCP | oslcapi/api/helpers/service_events.py | service_events.py | py | 2,832 | python | en | code | 1 | github-code | 6 |
30367879511 | from numpy import linspace, sin
from enable.api import ColorTrait, marker_trait
from chaco.api import ArrayPlotData, Plot
from enable.api import ComponentEditor
from traits.api import HasTraits, Instance, Int
from traitsui.api import Group, Item, View
class ScatterPlotTraits(HasTraits):
plot = Instance(Plot)
... | enthought/chaco | examples/tutorials/scipy2008/traits_example.py | traits_example.py | py | 1,759 | python | en | code | 286 | github-code | 6 |
35445381053 | from dexy.tests.utils import assert_output
from dexy.tests.utils import assert_in_output
from dexy.tests.utils import assert_output_cached
from dexy.tests.utils import wrap
from dexy.tests.utils import TEST_DATA_DIR
from dexy.doc import Doc
import os
import shutil
R_SECTIONS = """\
### @export "assign-vars"
x <- 6
y <... | gotosprey/dexy | dexy/tests/plugins/test_subprocess_filters.py | test_subprocess_filters.py | py | 3,617 | python | en | code | null | github-code | 6 |
40866976474 | def Count(value):
Esum=0;
Osum=0;
iDigit=0;
while(value!=0):
iDigit=value%10;
if(iDigit%2==0):
Esum=Esum+iDigit;
else:
Osum=Osum+iDigit;
value=value//10;
return Esum-Osum;
def main():
print("Enter Number");
no=int(input());
ret=Count(no);
print(ret);
if __name__=="__m... | Snehal-Patil72/Development | Python Module/DigitEvenOddSum__Module.py | DigitEvenOddSum__Module.py | py | 337 | python | en | code | 0 | github-code | 6 |
10355901647 | import pandas as pd
MIN_PPL = 125
MAX_PPL = 300
def baseline(data):
# family indexed
choices = data[[col for col in data.columns if "choice_" in col]] # families' preferences
sizes = data["n_people"] # families' sizes
assignments = pd.Series(name="assigned_day") # holds assigned day for each... | remit0/workshop | workshop/models.py | models.py | py | 2,796 | python | en | code | 0 | github-code | 6 |
35207313249 | import shutil
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve
import sys
from PyQt5.QtWidgets import QSlider, QLabel
from PyQt5.QtGui import QFont
from PyQt5.QtCore import QSignalMapper
from classes.FrequencyDomain import *
from classes.TimeGraph import *
from collections import namedtuple
from Dialog import ... | Zoz-HF/Ikoraiza | main.py | main.py | py | 14,129 | python | en | code | 0 | github-code | 6 |
25409835667 | import cv2
import numpy as np
# Load video
cap = cv2.VideoCapture('lift.mp4')
# Define output video properties
output_file = 'output.avi'
fourcc = cv2.VideoWriter_fourcc(*'XVID')
fps = cap.get(cv2.CAP_PROP_FPS)
frame_size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
# Create Vi... | taoofstefan/BB-Tracking | main.py | main.py | py | 2,502 | python | en | code | 0 | github-code | 6 |
39868886992 | '''
Criar um sistema bancário com as operações: sacar, depositar
e visualizar extrato.
'''
import textwrap
def menu():
# Define as opções do menu
menu_options = {
'd': 'Depositar',
's': 'Sacar',
'e': 'Extrato',
'nc': 'Nova conta',
'lc': 'Listar contas',
'nu': '... | iurimega13/banqPy | version_2.0/banqPyRefactored.py | banqPyRefactored.py | py | 7,160 | python | pt | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.