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
73605360338
# !/usr/bin/python3 # -*- coding: utf-8 -*- from typing import List # @Author: 花菜 # @File: 46全排列.py # @Time : 2022/11/2 23:09 # @Email: lihuacai168@gmail.com class Solution: def permute(self, nums: List[int]) -> List[List[int]]: def backtracking(nums, used, path, paths): if len(path) == len(...
lihuacai168/LeetCode
排列组合/46全排列.py
46全排列.py
py
1,079
python
en
code
4
github-code
13
11670484523
from requests import * # import pymongo import time import json key = "" mongo = None db = None request_counter = 0 # DONE def get_secrets(filename: str): with open(filename) as file: global key key = file.readline().strip("\n") username = file.readline().strip("\n") password = fi...
jackwilmerding/polisee
PoliSee.py
PoliSee.py
py
13,231
python
en
code
2
github-code
13
26890649594
from bs4 import BeautifulSoup import pandas as pd import requests, os from selenium import webdriver from selenium.webdriver.firefox.options import Options import pymongo import geckodriver_autoinstaller from webdriver_manager.firefox import GeckoDriverManager from flask import jsonify # profile = webdriver.Firefox...
DMVance/web-scraping-challenge
Missions_to_Mars/scrape_mars.py
scrape_mars.py
py
5,170
python
en
code
0
github-code
13
19103188367
import numpy as np import seaborn as sns from tensorflow.keras import Model from matplotlib import pyplot as plt from sklearn.metrics import confusion_matrix from tensorflow.keras.layers import Input, Dense, Flatten, Conv1D, MaxPooling1D, Reshape, LSTM, TimeDistributed from tensorflow.keras.callbacks import Early...
G4ll4rd0/Examen-TEMA3_MNLP
utils.py
utils.py
py
5,793
python
en
code
0
github-code
13
30631573517
""" MAIN FUNCTION """ from machine import Pin, SPI, I2C, PWM, Timer import time import rp2 # DRIVERS import gc9a01 as lcd from imu import MPU6050 from rotary_irq_rp2 import RotaryIRQ # HELPER import italicc import NotoSansMono_32 as font print("BOOTING", end='') i2c = I2C(0, sda=Pin(0), scl=Pin(1)...
Negative-light/advanced-palmadoro-timer
test_code/main.py
main.py
py
5,131
python
en
code
1
github-code
13
17231994875
# -*- coding: utf-8 -*- """ Created on Sun Mar 24 18:31:37 2019 从txt里读取数据 写入excel @author: Administrator """ import numpy as np import openpyxl import os,sys sys.path.append('D:/Refresh/py36') import support_pie def check_data(data): for i in range(data.shape[0]-1): if data[i+1,1]-data[i,1] <...
hz12zfyb/PlotCode
数据处理方法/认色素读写excel/4读取txt数据写入excel.py
4读取txt数据写入excel.py
py
2,243
python
en
code
0
github-code
13
21538617524
''' Example: Countdown ''' def countdown_to_one(n): if n == 0: # base case return countdown_to_one(n-1) # recursive call and moving towards a "base case" print(n) countdown_to_one(3) ''' Example: Double Countdown ''' def countdown(n): if n == 0: return print(n) countdown(n-1) ...
Mark-McAdam/cs_lambda
recursive-sorting/basic_recursion.py
basic_recursion.py
py
802
python
en
code
0
github-code
13
13377926967
from flask import render_template, make_response, request from flask_restful import Resource, reqparse from flask import json from pymongo import ASCENDING, DESCENDING from common.util import mongo from bson.json_util import dumps, default class CategoriesResource(Resource): """Returns list of categories""" de...
andrehadianto/50043_isit_database
server/resources/categories.py
categories.py
py
2,807
python
en
code
0
github-code
13
12090915193
""" 练习:创建两个分支线程,一个用于打印1-52这52个数字 另一个用于打印 A-Z这26个字母。要求最终打印顺序为 12A34B56C .... 5152Z """ from threading import Thread,Lock lock1 = Lock() lock2 = Lock() def print_num(): for i in range(1,53,2): lock1.acquire() print(i) print(i+1) lock2.release() def print_chr(): for i in range(65...
15149295552/Code
Month03/day16/exercise01.py
exercise01.py
py
646
python
en
code
1
github-code
13
25005850090
import pandas as pd import requests base_url = 'https://fantasy.premierleague.com/api/' def get_bootstrap_data(data_type): resp = requests.get(base_url + 'bootstrap-static/') if resp.status_code != 200: raise Exception('Response was status code ' + str(resp.status_code)) data = resp.json() tr...
timyouell-servian/fantasy_premier_league
fpl_functions.py
fpl_functions.py
py
1,012
python
en
code
0
github-code
13
28778771542
from math import sqrt def prime_sieve(max_num): primes = [] primality = [True] * (max_num+1) primality[0] = False primality[1] = False for i in range(2, int(sqrt(max_num)) + 1): if primality[i]: for j in range(i*i, max_num+1, i): primality[j] = False for i in...
Pineci/ProjectEuler
Problem47.py
Problem47.py
py
1,566
python
en
code
0
github-code
13
27282122598
def save_file(boy, girl, count): file_name_boy = 'boy_' + str(count) + '.txt' file_name_girl = 'girl_' + str(count) + '.txt' boy_file = open(file_name_boy, 'w') girl_file = open(file_name_girl, 'w') boy_file.writelines(boy) girl_file.writelines(girl) boy_file.close() girl_f...
DodgeV/learning-programming
books/python/零基础入门学习Python(小甲鱼)全套源码课件/029文件:一个任务(课件+源代码)/课堂练习/test_2.py
test_2.py
py
930
python
en
code
3
github-code
13
20573561380
from language import choose_language from modifiers import draconic_lines, clearscreen, validate_choice from spells import single_spell_select class Race: def __init__(self, level=None): self.name = '' self.intelligence = 0 self.dexterity = 0 self.wisdom = 0 self...
brian-chalfant/CharacterBuilder
Race.py
Race.py
py
15,442
python
en
code
1
github-code
13
3281297110
from pytrends.request import TrendReq from google_trends.models import Trend from .serializers import TrendSerializer from rest_framework import generics, decorators class TrendsView(generics.ListAPIView): queryset = Trend.objects.all().order_by('-created_on')[:10] serializer_class = TrendSerializer def ge...
gicu-90/phemecheck
google_trends/views.py
views.py
py
690
python
en
code
0
github-code
13
11603524851
# # @lc app=leetcode.cn id=167 lang=python3 # # [167] 两数之和 II - 输入有序数组 # # @lc code=start class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: def bin_search(x): l, r = 0, len(numbers) while l < r: mid = l + (r - l) // 2 # p...
RGBRYANT24/LeetCodePractice_PY
167.两数之和-ii-输入有序数组.py
167.两数之和-ii-输入有序数组.py
py
1,166
python
en
code
0
github-code
13
30545073878
# https://github.com/huggingface/transformers/blob/master/examples/pytorch/question-answering/run_qa_no_trainer.py import re import copy def overflow_to_sample_mapping(tokens, offsets, idx, max_len = 384, doc_stride = 128): fixed_tokens = [] fixed_offsets = [] sep_index = tokens.index(-100) question =...
ARBML/nmatheg
nmatheg/preprocess_qa.py
preprocess_qa.py
py
12,624
python
en
code
21
github-code
13
7676923882
import sympy def number_of_ways(arr, total): dp = [0 for _ in range(total + 1)] dp[0] = 1 for i in range(len(arr)): for j in range(arr[i], total + 1): dp[j] += dp[j - arr[i]] return dp[total] primes = list(sympy.sieve.primerange(1, 100000)) array = [] n = 10 ...
notBlurryFace/project-euler
PE077.py
PE077.py
py
631
python
en
code
1
github-code
13
17794939140
ANSIBLE_METADATA = {'status': ['stableinterface'], 'supported_by': 'community', 'metadata_version': '1.1'} DOCUMENTATION = ''' --- module: oneview_appliance_device_snmp_v3_trap_destinations short_description: Manage the Appliance Device SNMPv3 Trap Destinations. description: ...
bryansullins/baremetalesxi-hpesynergyoneview
library/oneview_appliance_device_snmp_v3_trap_destinations.py
oneview_appliance_device_snmp_v3_trap_destinations.py
py
5,767
python
en
code
1
github-code
13
71964744978
# -*- coding: utf-8 -*- """ Django settings for VideoPair project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os....
avrybintsev/VideoPair
VideoPair/settings.py
settings.py
py
4,115
python
en
code
0
github-code
13
20941913846
''' A B C D E F G H I J K L M N O ''' s = int(input('Enter the number:')) asciiValue = 65 m = (2 * s) - 2 for i in range(0, s): for j in range(0, m): print(end=" ") m = m - 1 for j in range(0, i + 1): alphabate = chr(asciiValue) print(alp...
Rohit-saxena125/Python-code
Loop/pattern16.py
pattern16.py
py
374
python
en
code
0
github-code
13
35931640253
from collections import deque M, N, H = map(int, input().split()) graph = [[list(map(int, input().split())) for _ in range(N)] for _ in range(H)] dx = [-1, 1, 0, 0, 0, 0] dy = [0, 0, -1, 1, 0, 0] dz = [0, 0, 0, 0, -1, 1] queue = deque() def bfs(): while queue: z, x, y= queue.popleft() ...
YJeongs/Backjoon
백준/Gold/7569. 토마토/토마토.py
토마토.py
py
1,148
python
en
code
0
github-code
13
44974392676
from .objects import Ray, Sphere, Triangle, Point, Vector import numpy as np def intersect(first_object, second_object): ... def _intersect_ray_with_sphere(ray, sphere): ray._origin = ray._origin._point ray._direction = ray._direction._vector sphere._center= sphere._center._point nabla = (np.dot(...
neo0311/pygeo_64845
src/pygeo/intersect.py
intersect.py
py
1,954
python
en
code
0
github-code
13
12343974255
# Program to check if the given binary tree is height balanced or not. # Height Balanced Tree means for every node difference bewteen height of left subtree and right subtree should be atmost 1. # If height of left sub tree is h1, if height of right sub tree is h2, then at every node, |h1 - h2| <= 1. # IDEA: so, logic ...
souravs17031999/100dayscodingchallenge
binary trees/check_Height_balanced_binary_tree.py
check_Height_balanced_binary_tree.py
py
2,450
python
en
code
43
github-code
13
42302036384
n = int(input()) total = 0 graph = [[0]*101 for _ in range(101)] # 가로세로 100 크기의 그래프를 생성한다 for _ in range(n): a,b = map(int,input().split()) for i in range(a,a+10): # 해당 범위에 가로세로를 10씩 더한값에 for j in range(b,b+10): # 값을 1로 바꿔준다 graph[i][j] = 1 for i in range(1,101): cnt = graph[i].count(...
Lee-GS/Algorithm-with-python
구현/색종이_2563.py
색종이_2563.py
py
503
python
ko
code
0
github-code
13
13103756784
# https://school.programmers.co.kr/learn/courses/30/lessons/87946 def solution(k, dungeons, num_dungeons=0): if len(dungeons) == 0: return num_dungeons cur_max = num_dungeons for i in range(len(dungeons)): if k >= dungeons[i][0] and k >= dungeons[i][1]: cur_max = max(c...
olwooz/algorithm-practice
practice/2022_12/221204_Programmers_Dungeons/221204_Programmers_Dungeons.py
221204_Programmers_Dungeons.py
py
420
python
en
code
0
github-code
13
21658524374
import json import urllib import os import driver_helper import consts import logger class Tab4uCrawler: def __init__(self): self.my_driver = None self.crush_msg = "unknown error: session deleted because of page crash" self.skipped_artists = [] def handle_crash(self, url, e): ...
yuvallhv/ChordsAnalizer
tab4u_crawl.py
tab4u_crawl.py
py
33,634
python
en
code
0
github-code
13
8525097026
import os import numpy as np import pathlib import pandas as pd import keras.api._v2.keras as keras from sklearn.metrics import confusion_matrix, classification_report from keras.api._v2.keras import layers, \ losses, regularizers, optimizers, applications from keras.api._v2.keras.preprocessing.image import ImageDa...
NCcoco/kaggle-project
Bird-Species/train-py-ViT.py
train-py-ViT.py
py
12,952
python
en
code
0
github-code
13
73777584019
import random import numpy as np from math import * import cv2 import matplotlib.pyplot as plt import scipy as sc import scipy.optimize as opt from sklearn.linear_model import LinearRegression lidarGeneratedData = [] pic = cv2.imread("whiteboard.png") #lidarinput keeps distance to each point at each degree with step...
l3cire/path-planning
lidar.py
lidar.py
py
9,056
python
en
code
0
github-code
13
6114216890
def frequency(data, cols): rows = 2 freq = [[0 for i in range(cols)] for j in range(rows)] for line in data: if len(line) >= digit_count: stripped = line.rstrip() for i in range(digit_count): if stripped[i] == '1': freq[1][i] += 1 ...
iceaway/advent-of-code-2021
day3/day3.py
day3.py
py
2,719
python
en
code
0
github-code
13
29102227709
import numpy as np import pandas as pd import pymongo import os import errno import logging from urllib import parse, request # from urllib.error import HTTPError from func import get_InstitutionSearch, get_aff_id, read_credentials from my_scival import InstitutionSearch, MetricSearch import pickle as pk from pprint ...
gnukinad/scival
src/get_aff_ids.py
get_aff_ids.py
py
6,792
python
en
code
1
github-code
13
35297246598
# @nzm_ort # https://github.com/nozomuorita/atcoder-workspace-python # import module ------------------------------------------------------------------------------ from collections import defaultdict, deque, Counter import math from itertools import combinations, permutations, product, accumulate, groupby, chain from ...
nozomuorita/atcoder-workspace-python
abc/abc146/B/answer.py
answer.py
py
760
python
en
code
0
github-code
13
33100022424
from oled.device import sh1106 from oled.render import canvas from PIL import ImageDraw, ImageFont from datetime import datetime FONT_FILE0 = 'Roboto-BoldCondensed.ttf' FONT_FILE1 = 'wwDigital.ttf' class SSPMeteoOled: oled = sh1106() font0 = ImageFont.truetype(FONT_FILE0, 30) font1 = ImageFont.truetype(F...
sersope/sspmeteo2
sspmeteo2_oled.py
sspmeteo2_oled.py
py
2,091
python
en
code
0
github-code
13
31440268213
#!/usr/bin/env python3 # This file is part of krakenex. # Licensed under the Simplified BSD license. See `examples/LICENSE.txt`. # Demonstrate use of json_options(). from types import SimpleNamespace import krakenex kraken = krakenex.API().json_options(object_hook=lambda kv: SimpleNamespace(**kv)) response = krake...
veox/python3-krakenex
examples/json-options.py
json-options.py
py
513
python
en
code
688
github-code
13
39667073784
__author__ = 'rsimpson' from constraintSatisfaction import * from math import sqrt # This variable defines the size of the grids within the Sudoku puzzle - N x N x N (N grids, each with NxN cells) # This value needs to have an integer square root, i.e., 4, 9, 16, 25... gridSize = 4 class CSPGraphSudoku(CSPGraph): ...
richs1000/Constraint-Satisfaction
sudokuBig.py
sudokuBig.py
py
5,149
python
en
code
1
github-code
13
39140780576
from typing import Optional, Union from sqlalchemy import select from sqlalchemy.orm import Session from ...models import CalculatedPotential, ScoreBest, ScoreCalculated from .account import AndrealImageGeneratorAccount class AndrealImageGeneratorApiDataConverter: def __init__( self, session: Se...
283375/arcaea-offline
src/arcaea_offline/external/andreal/api_data.py
api_data.py
py
3,161
python
en
code
21
github-code
13
2334554298
from typing import List class Solution: def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]: result = [] for idx, val in enumerate(candies): candies[idx] = val + extraCandies if max(candies) <= val + extraCandies: result.append(Tru...
k1m743hyun/algorithm-in-python
LeetCode/1431. Kids With the Greatest Number of Candies.py
1431. Kids With the Greatest Number of Candies.py
py
779
python
en
code
0
github-code
13
7397871253
class Node: def __init__(self,val,next): self.val=val self.next=next def printfn(self): dummy=self while dummy!=None: print(dummy.val,end="->") dummy=dummy.next print() def insert_At(self,v,position): dummy=self ind=0 if...
NandhniV25/Data-Structures
01_linked_list/04_insert_at_position_and_length_of_the_node.py
04_insert_at_position_and_length_of_the_node.py
py
1,210
python
en
code
0
github-code
13
74481971538
import time import argparse import hashlib import json import logging import os import signal import sys # Status Constants FILE_KNOWN_UNTOUCHED = "FILE_KNOWN_UNTOUCHED" FILE_KNOWN_TOUCHED = "FILE_KNOWN_TOUCHED" FILE_UNKNOWN = "FILE_UNKNOWN" # List of dangerous file extensions dangerous_extensions = set([ "DMG", ...
NVISOsecurity/binsnitch
binsnitch.py
binsnitch.py
py
7,175
python
en
code
155
github-code
13
71292261778
import numpy as np import tensorflow as tf import os import cv2 from model import vgg VIEWS = 6 # Total views # loads the evaluation images def load_eval(dimension): images0 = [] images1 = [] images2 = [] images3 = [] images4 = [] images5 = [] ls = 200 # change before running f...
balashanmugam/mix-match-part-assembler
MVCNN/evaluate_sample.py
evaluate_sample.py
py
2,664
python
en
code
1
github-code
13
17060017884
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class SpecEntity(object): def __init__(self): self._id = None self._shop_id = None self._spec_name = None self._system = None @property def id(self): re...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/SpecEntity.py
SpecEntity.py
py
2,134
python
en
code
241
github-code
13
70349005458
from datetime import datetime, timedelta from xivo_dao import cel_dao from xivo_dao.alchemy.cel import CEL from xivo_dao.helpers.cel_exception import CELException from xivo_dao.tests.test_dao import DAOTestCase def _new_datetime_generator(step=timedelta(seconds=1)): base_datetime = datetime.now() cur_datetim...
jaunis/xivo-dao
xivo_dao/tests/test_cel_dao.py
test_cel_dao.py
py
4,667
python
en
code
0
github-code
13
31495553094
from advent_day import AdventDay class Day(AdventDay): test_files = {"data/day24/example.txt": [18, 54]} data_file = "data/day24/data.txt" clock = ["<", "^", ">", "v"] directions = {"<": (0, -1), ">": (0, 1), "^": (-1, 0), "v": (1, 0)} def parse_file(self, data): data = data.split("\n")[...
lukap3/adventofcode2022
days/day24.py
day24.py
py
3,832
python
en
code
0
github-code
13
28003112649
#Faça um programa que, leia uma matriz 5x2 com os números de telefones dos clientes, as linhas representam os clientes, as colunas representam os telefones. E uma lista de 5 elementos com os nomes dos clientes. Depois de preenchidos a lista e a matriz, deverá ser feito uma busca pelo nome do cliente, se o nome existir,...
felipefporto/FATEC-Itapetininga
Linguagem-de-Programacao/aula_19_05_22_exer_2.py
aula_19_05_22_exer_2.py
py
1,477
python
pt
code
0
github-code
13
38586411930
""" Return a dictionary representing the header block - a block in JSON representing metadata about the file. """ from ..util import chunk_sequence, hasher import datetime import os import pathlib def metadata(desc, source): stat = os.stat(source) block_count, rem = divmod(stat.st_size, desc.qr.block_size) ...
rec/hardback
hardback/book/metadata.py
metadata.py
py
1,300
python
en
code
1
github-code
13
6188635555
# birthdaySingAlong_cc.py # Created by Jo Narvaez-Jensen # Project 2C # This program inputs a user's name and sings them happy birthday with a bouncing ball. from graphics import * from random import * # textFormat method, standardizes all initial values for any graphic text and # creates an assoicated shadow def ...
thenobleone/Programming
CSC-110/Project2/birthdaySingAlongCC.py
birthdaySingAlongCC.py
py
5,139
python
en
code
1
github-code
13
73845779858
import argparse from gdl_apps.EMOCA.utils.io import save_obj, save_images, save_codes, test import os import gc import librosa import PIL.Image as Image import numpy as np from pathlib import Path import torch import math import tgm ### rotational conversion def angle_axis_to_quaternion(angle_axis: torch.Tensor) -> t...
Daksitha/ReNeLib
IVA/fastApi_backend/rotation_conversion.py
rotation_conversion.py
py
7,098
python
en
code
3
github-code
13
72393229459
import pandas as pd import numpy as np from matplotlib import pyplot as plt import random #Read file data = pd.read_csv('linear_regression_data.csv') #Split data to training data & testing data by random def train_test_split(dataset): list = [] size = len(dataset) a = int(len(dataset) * 0.8) tra...
starfishda/Data-Science
DS - 실습4/linear_regression.py
linear_regression.py
py
1,681
python
en
code
0
github-code
13
11898007221
""" Created on Mon Feb 23 20:10:35 2015 @author: Rodolfo Viana """ # In this program it is possible search for tweets that say anything (bad or not bad) about Apple at Times Square. import twitter import sys import json reload(sys) sys.setdefaultencoding("utf-8") # Load twitter api with consumer key...
RodolfoViana/NeuralNetwork
code/search_query.py
search_query.py
py
2,269
python
en
code
0
github-code
13
25296515350
from frontend.tests.base_view import RegisteredBaseViewTestBase from frontend.views.home import HomeView class TestHomeView(RegisteredBaseViewTestBase): view_name = 'home' view_cls = HomeView def test_organisation_selector(self): self.do_test_anonymous_user() self.do_test_superuser() ...
kartoza/sawps
django_project/frontend/tests/test_home_view.py
test_home_view.py
py
543
python
en
code
0
github-code
13
72413614738
inventario = [] resposta = "S" while resposta == "S": inventario.append(input("Equipamento: ")) #O append tem por funcção adicionar um objeto à lista inventario.append(float(input("Valor: "))) inventario.append(int(input("Número Serial: "))) inventario.append(input("Departamento: ")) resposta=input("Digite \"S\" p...
castrogh/lists_python
listas.py
listas.py
py
700
python
pt
code
0
github-code
13
42000091862
# # @lc app=leetcode.cn id=746 lang=python3 # # [746] 使用最小花费爬楼梯 # Time: O(n) 单层循环 # Space: O(n) 辅助空间长度为给定数组长度 # @lc code=start class Solution: def minCostClimbingStairs(self, cost: List[int]) -> int: # 这里dp保存的是从到达第i格消耗的最佳cost # 题目规定可以走1、2格 # 根据题意判断, 从起点出发不消耗cost # 所以从起点开始, 能够到达第0格, ...
WeiS49/leetcode
Solution/动态规划/一维/746. 最小花费爬楼梯/动态规划_逆.py
动态规划_逆.py
py
913
python
zh
code
0
github-code
13
30964794665
##Useful physical constants and unit conversions. #Note: This file is all in mks. #@author Alexander Adams #edited for psi=6894.757 Juha Nieminen 5/11/1014 h = 6.62606957e-34 #planck's constant kb = 1.3806488e-23#boltzman constant Runiv = 8.3144621e3#J/kmolK universal gass constant Navo = 6.022e23#avagadros nu...
USCLiquidPropulsionLaboratory/Engine-sizing-snake
physical_constants.py
physical_constants.py
py
1,467
python
en
code
2
github-code
13
5525343423
import json import logging import os import datetime import boto3 logger = logging.getLogger() logger.setLevel(logging.INFO) dynamodb_client = boto3.client('dynamodb') def lambda_handler(event, context): logger.info('Event: {}'.format(event)) user_table = os.environ["USERS_TABLE"] if event['triggerSour...
ParthTrambadiya/congito-iac-sf
functions/confirm_user_signup.py
confirm_user_signup.py
py
1,428
python
en
code
1
github-code
13
44193953541
from .exceptions import NotificationKeyError from .exceptions import RegistrationError from .exceptions import CallbackFailed from .callback import Callback import logging def id_generator(): x = 0 while True: x += 1 yield x class NotificationManager: """Manages invocation of callback fun...
mikemayer67/pynm
pynm/manager.py
manager.py
py
8,715
python
en
code
0
github-code
13
12918122580
import sys f = open( sys.argv[1] ) ls = f.readlines( ) f.close( ) x1 = None for l in ls : x2, y2 = map( float, l.split( ) ) y2 *= 3 if( x1 is not None ) : print("\drawline(%s, %s)(%s, %s)" % (x1, y1, x2, y2)) x1, y1 = x2, y2
LLNL/gidiplus
numericalFunctions/Doc/Misc/pointsToLatexCurve.py
pointsToLatexCurve.py
py
242
python
en
code
10
github-code
13
74319495379
import re from unittest import mock import httpx import pytest from fedora.clients.fasjson import FasjsonClient from fedora.exceptions import InfoGatherError @pytest.mark.parametrize( "groupname,membership_type,expected_url", [ ("sysadmin-main", "members", "groups/sysadmin-main/members"), ("...
fedora-infra/maubot-fedora
tests/clients/test_fasjson.py
test_fasjson.py
py
5,509
python
en
code
0
github-code
13
1289680287
from collections import deque temp = deque([a for a in range(1,int(input())+1)]) while(True): if len(temp) == 1: break temp.popleft() temp.rotate(-1) print(temp[0])
junhaalee/Algorithm
problems/2164.py
2164.py
py
189
python
en
code
0
github-code
13
42945492450
from datetime import date, datetime, timedelta, timezone from django.contrib.auth import authenticate, login, logout from django.http import HttpResponse from django.shortcuts import render, redirect from django.views import View from django.contrib.auth.models import User from .forms import MessageForm from .models ...
zawadzkijakub/taskmanager
taskmanagerenv/taskmanager/MyApp/views.py
views.py
py
7,530
python
en
code
0
github-code
13
29314503873
from sys import exit import pandas as pd import numpy as np import matplotlib.pyplot as plt import yfinance as yf import scipy.signal as sps gme_info = yf.Ticker('GME') gme_df_2y = gme_info.history(period='2y', interval='1h', actions=False) gme_2y = gme_d...
nickeisenberg/Phython
Notebook/gme_peaks.py
gme_peaks.py
py
997
python
en
code
1
github-code
13
17053908894
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.UserAssetInfoVO import UserAssetInfoVO class JointAccountBillDetailDTO(object): def __init__(self): self._account_id = None self._amount = None self._...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/JointAccountBillDetailDTO.py
JointAccountBillDetailDTO.py
py
6,968
python
en
code
241
github-code
13
72139298578
import pandas as pd import random import time import boto3 import json import os AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID") AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY") AWS_REGION = os.getenv("AWS_REGION") # Carregar o arquivo CSV csv_file = '../data/streaming_data/olist_order_reviews_dataset.c...
lucas-placido/E-CommerceProject
files/scripts/kinesis_data_producer.py
kinesis_data_producer.py
py
1,338
python
pt
code
0
github-code
13
14646767685
from sqlalchemy import Column, ForeignKey, Identity, Integer, String, Table from . import metadata SetupIntentPaymentMethodOptionsMandateOptionsBlikJson = Table( "setup_intent_payment_method_options_mandate_options_blikjson", metadata, Column( "expires_after", Integer, comment="Dat...
offscale/stripe-sql
stripe_openapi/setup_intent_payment_method_options_mandate_options_blik.py
setup_intent_payment_method_options_mandate_options_blik.py
py
776
python
en
code
1
github-code
13
28311782079
# Imports import gradio as gr import spacy from spacy.lang.en.stop_words import STOP_WORDS from string import punctuation from heapq import nlargest from textblob import TextBlob stop_words = list(STOP_WORDS) nlp = spacy.load('en_core_web_sm') # Adding "\n" to the puctuation list to remove it punctuation = punctuati...
MeghanshBansal/Text-Summarizer
main.py
main.py
py
2,531
python
en
code
0
github-code
13
42658536509
######################## ## Created by Cue Hyunkyu Lee ## Date Nov 28 2017 ## ## import import os, time import numpy as np output_file = sys.argv[1] n_argv = int(sys.argv[2]) main_argv = list(map(float,sys.argv[3:])) cors=[x-1 for x in main_argv] print("output will be generated at: {}".format(output_file)) ## defi...
cuelee/regen
06_2_intercept_matrix.py
06_2_intercept_matrix.py
py
701
python
en
code
1
github-code
13
33651768326
from django.shortcuts import render,get_object_or_404 from django.views.generic.list import ListView from .models import MainMarket, Sport, League, Event from django.core import serializers from django.views.generic.base import TemplateResponseMixin, View import re import json from django.http import JsonResponse def ...
asavitsky/Bets
odds/views.py
views.py
py
4,544
python
en
code
0
github-code
13
1046224612
from abc import abstractmethod from vec3 import * from ray import * class hit_record: def __init__(self): self.p = point3() self.normal = vec3() self.mat_ptr = None self.t = 0.0 self.front_face = True def copy(self, rec): self.p = rec.p self.normal = re...
songjiahuan/a_slow_ray_tracer
hittable.py
hittable.py
py
767
python
en
code
0
github-code
13
30968461135
import os import shutil import json import gzip import csv import sys from collections import defaultdict import glob import warnings import pandas as pd import pyrallel from config import config, get_logger from common import exec_sh import re # ldc_kg = None # df_wd_fb = None # kb_to_fb_mapping = None kgtk_labels =...
usc-isi-i2/gaia-ta2pipeline
pipeline2/importer.py
importer.py
py
39,036
python
en
code
1
github-code
13
8163149349
""" File: Game File Authors: Spencer Wheeler, Benjamin Paul, Troy Scites Description: Set of API classes for post/get methods for game information """ import sqlite3 from User import User from flask_restful import Resource, reqparse #using reqparse despite its depreciated status class total_games(Resource)...
benp23/Spazzle-clone
Spazzle/Game.py
Game.py
py
11,997
python
en
code
0
github-code
13
37993694528
import ROOT import cppyy import AthenaROOTAccess.transientTree import sys from AthenaROOTAccess.dumpers import Evdump, try_autokey if not globals().has_key ('onlykeys'): onlykeys = [] if not globals().has_key ('onlytypes'): onlytypes = [] class Files: def __init__ (self, f, fout_base): self.f = f ...
rushioda/PIXELVALID_athena
athena/PhysicsAnalysis/AthenaROOTAccess/test/ara_dumper_common.py
ara_dumper_common.py
py
3,036
python
en
code
1
github-code
13
37165115543
import contextlib import os import threading import time from .test_utils import ( TempDirectoryTestCase, skip_unless_module, skip_without_drmaa, restartable_pulsar_app_provider, integration_test, ) from pulsar.manager_endpoint_util import ( submit_job, ) from pulsar.managers.stateful import Ac...
galaxyproject/pulsar
test/integration_test_state.py
integration_test_state.py
py
9,859
python
en
code
37
github-code
13
37647319374
from typing import Optional, Any from pathlib import Path from fastapi import FastAPI, APIRouter, Query, HTTPException, Request from fastapi.templating import Jinja2Templates from models import Recipe, RecipeSearchResults, RecipeCreate from recipes_data import RECIPES BASE_PATH = Path(__file__).resolve().parent TEMPLA...
kev-luo/fast_api_playground
main.py
main.py
py
2,064
python
en
code
0
github-code
13
21793277130
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isCousins(self, root: Optional[TreeNode], x: int, y: int) -> bool: queue = [(root,None,0)] ...
HyoungwooHahm/Leetcode
0993-cousins-in-binary-tree/0993-cousins-in-binary-tree.py
0993-cousins-in-binary-tree.py
py
858
python
en
code
0
github-code
13
18902673263
from django.forms import ModelForm, ModelMultipleChoiceField from django.forms.fields import ( BooleanField, CharField, ChoiceField, IntegerField, ) from django.forms.widgets import PasswordInput from .models import MassMail from django_summernote.widgets import SummernoteWidget from django.contrib.admi...
GabCas28/Agenda-Movilidad
src/mailsender/forms.py
forms.py
py
4,180
python
en
code
0
github-code
13
17956901457
from pickle import TRUE from unicodedata import category from lifestore_file import lifestore_searches, lifestore_sales, lifestore_products """ La info de LifeStore_file: lifestore_searches = [id_search, id product] lifestore_sales = [id_sale, id_product, score (from 1 to 5), date, refund (1 for true or 0 to false)] l...
lalo0596/PROYECTO-01-JAVIER-EDUARDO
PROYECTO-01-JAVIER-EDUARDO.py
PROYECTO-01-JAVIER-EDUARDO.py
py
7,112
python
es
code
0
github-code
13
30552721443
from flask import Flask from flask import jsonify from datetime import date import urllib.request import json app = Flask(__name__) @app.route("/getExchangeRate/<fromCurrency>/<toCurrency>") def profile(fromCurrency, toCurrency): print("From currency: " + fromCurrency) print("To currency: " + toCurrency) ...
wojciodataist/currency-service
application.py
application.py
py
572
python
en
code
0
github-code
13
31178606432
import json from flask import Flask, redirect, url_for, session, request, jsonify from flask_oauthlib.client import OAuth from . import weibo_bp from .. import app,utils oauth = OAuth(app) weibo = oauth.remote_app( 'weibo', consumer_key='', consumer_secret='', request_token_params={'scope': 'email,stat...
memkeytm/OnepayShop
app/social_login/weibo.py
weibo.py
py
2,353
python
en
code
0
github-code
13
73291332816
import base64 import hashlib import itertools import json import struct import time import uuid import cloudant from hamcrest import * def b64url(val): term = chr(131) + chr(109) + struct.pack("!I", len(val)) + str(val) md5 = hashlib.md5(term).digest() b64 = base64.b64encode(md5) return b64.rstrip("...
cloudant/quimby
internal_replication/1000-basic-internal-rep-test.py
1000-basic-internal-rep-test.py
py
2,571
python
en
code
0
github-code
13
17114353194
"""ondelete_cascade_on_tags Revision ID: 5471c0ac2e0a Revises: 6b245dc1afdc Create Date: 2022-08-25 22:16:20.171838 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '5471c0ac2e0a' down_revision = '6b245dc1afdc' branch_labels = None depends_on = None def upgrad...
alliance-genome/agr_literature_service
alembic/versions/5471c0ac2e0a_ondelete_cascade_on_tags.py
5471c0ac2e0a_ondelete_cascade_on_tags.py
py
1,370
python
en
code
1
github-code
13
14131385203
# poissionian distribution import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.special import factorial excel_1 = "lab1.xlsx" df_first = pd.read_excel(excel_1,sheet_name = "Sheet5") x1 = list(df_first['Count Rate']) plt.hist(x1, bins = 200, rwidth= 0.7) # the mean = 815.45, probab...
gsrakib/Fitting-data-with-distribution
FItting data with different distribution.py
FItting data with different distribution.py
py
1,119
python
en
code
0
github-code
13
6971439003
student_score={ "Harry":81, "Pranav":99, "Jhon":78, "SRK":74, "Tiger":10 } print(student_score) student_grade={} # creating an empty dictionary for key in student_score: score=student_score[key] if(score>=91 and score<=100): grade="Outstanding" elif(score>=81 an...
malpani2003/100_days_Python_bootcamp
Code_Challenge/challenge_grade_program.py
challenge_grade_program.py
py
530
python
en
code
0
github-code
13
31467127762
# coding=utf-8 class State: ''' state 抽象状态类,定义一个接口以封装与context的 一个特定状态相关的行为 ''' def write_program(self, w): pass class Work: ''' context 维护一个具体状态子类的实例,这个实例 定义当前的状态 ''' def __init__(self): self.hour = 9 self.current = ForenoonState() def set_sta...
hflyf123/Python_design_mode
State.py
State.py
py
1,208
python
en
code
0
github-code
13
4537486650
''' NAME: VAIBHAV SUDHAKAR BHAVSAR TE-B ROLL NO: 08 ASSIGNMENT NO: 4 PROBLEM STATEMENT: Write a program using TCP socket for wired network for following Calculator (Arithmetic) : client side ''' import socket import sys sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost',23000)) sock.li...
IamVaibhavsar/Third_Year_Lab_Assignments
Computer Networks Lab/A4TCPSocket/Calculator/calculator_server.py
calculator_server.py
py
728
python
en
code
20
github-code
13
31806646115
from aiogram import types from aiogram.dispatcher import FSMContext from aiogram.dispatcher.filters import Command from aiogram.types import ReplyKeyboardRemove from create_bot import dp, bot, db from keyboards.adminbuttons import adminpanelcontinue, startposting, adminpanelmenu from states.moderator_states import Mod...
jackflaggg/telegram-bot-barbershop
handlers/rassilka.py
rassilka.py
py
5,169
python
en
code
0
github-code
13
17090562834
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.AlipayUserCustIdentifyActivity import AlipayUserCustIdentifyActivity class AlipayUserCustomerIdentifyResponse(AlipayResponse): def __init__(self): super(...
alipay/alipay-sdk-python-all
alipay/aop/api/response/AlipayUserCustomerIdentifyResponse.py
AlipayUserCustomerIdentifyResponse.py
py
1,458
python
en
code
241
github-code
13
12304649248
# https://developers.google.com/accounts/docs/OAuth2ForDevices import sys import urllib import httplib2 import os.path import json import time from oauth2client import client from datetime import datetime, timedelta class DeviceOAuth: def __init__(self, client_id, client_secret, scopes): self.client_id =...
guyc/py-gaugette
gaugette/oauth.py
oauth.py
py
5,387
python
en
code
120
github-code
13
42402720391
#! /usr/bin/env python # # Generalize rotation curve plotter in order to compare rotation curves # # -u rotcur format # -i ringfit format # -s velfitss07 format [not activated yet] # # -r keep in radio format (or whichever format it was) # -o convert from radio to optical convention (needs vsys) # # -p po...
teuben/nemo
src/scripts/python/rotcur2.py
rotcur2.py
py
9,965
python
en
code
53
github-code
13
27264462749
#%% import pandas as pd import torch from tqdm import tqdm import ijson from transformers import pipeline #%% datasets_root = r"E:\social-bot-data\datasets\Twibot-20" tmp_files_root = r"E:\social-bot-data\code\First-HGT-Detector\twibot-20\preprocess\tmp-files" #%% node2id_list = pd.read_csv(rf"{datasets_root}\node2id.c...
jbk-xiao/First-HGT-Detector
twibot-20/preprocess/gen_tweets.py
gen_tweets.py
py
1,841
python
en
code
1
github-code
13
1070663263
import fnmatch from pathlib import Path import yaml from core.Constants import MigrationKey, LibPairKey DataItem = dict[str, any] class Db: migrations: dict[str, DataItem] lib_pairs: dict[str, DataItem] _mapping: dict[str, dict[str, DataItem]] def __init__(self, data_root: str): self.data_...
ualberta-smr/PyMigBench
code/db/Db.py
Db.py
py
1,945
python
en
code
3
github-code
13
20428398138
from Cells import * import config import random import time import math from tkinter import messagebox def all_children(wid): lister = wid.find_all() #print(len(lister)) def getCoordinates(event): x = event.x // config.SquareSize y = event.y // config.SquareSize return (x,y) def clearWalls()...
Chris-Abboud/Pathfinding-Maze-Generation-Visualizer
Helpers.py
Helpers.py
py
33,930
python
en
code
1
github-code
13
30490235532
import time from openerp.osv import osv, fields from openerp.tools.translate import _ class account_invoice(osv.Model): _inherit="account.invoice" def invoice_print(self, cr, uid, ids, context=None): ''' This function prints the invoice and mark it as sent, so that we can see more easi...
genpexdeveloper/tax_invoice_qweb_report
account_invoice_extended.py
account_invoice_extended.py
py
971
python
en
code
0
github-code
13
75052932176
from mock import patch from mock import MagicMock from device_notifications.tests.utils import DeviceNotificationTestCase from device_notifications.tests.utils import ConcreteTestDevice from device_notifications.spi.gcm import gcm_send_message class FakeGCMResponse(object): canonical = [] not_registered = [...
roverdotcom/django-device-notifications
device_notifications/tests/gcm_tests.py
gcm_tests.py
py
1,200
python
en
code
4
github-code
13
24150158393
import numpy as np prob_dict = np.load('shields_RAL/Qmax_values_0_td.npy', allow_pickle = True).item() # prob_dict = np.load('shields/state_action_values_1_td.npy', allow_pickle = True).item() print(prob_dict.keys()) # print(prob_dict[((0, 0, 6, 7, 0, 1), 0)]) print(type(prob_dict)) num_xbins=8 def convert_state_to_int...
sharachchandra/context-driven-control-modulation
discrete_toy_examples/grid_world_2d/gym_gridworld/build/lib/gym_gridworld/envs/print_shield_np.py
print_shield_np.py
py
506
python
en
code
0
github-code
13
42670655062
import re from collections import deque from pathlib import Path def read_input() -> list[str]: filepath = Path(__file__).resolve() filename_no_ext = filepath.name.split(".")[0] filedir = filepath.parent input_file = filedir / f"../inputs/{filename_no_ext}.txt" with open(input_file) as infile: ...
dlstadther/advent_of_code_2022
solutions/05.py
05.py
py
3,187
python
en
code
0
github-code
13
12117379413
""" 3. 需求: 定义函数,在电影列表中删除阿凡达2 定义函数,在汽车列表中删除雅阁 步骤: -- 根据需求,写出函数。 -- 因为主体逻辑相同,核心算法不同. 所以使用函数式编程思想(分、隔、做) 创建通用函数delete_single -- 在当前模块中调用 """ from common.iterable_tools import IterableHelper class Car: def __init__(self, brand="", price=0, rank=""...
15149295552/Code
Month07/day14_python/homework/exercise02.py
exercise02.py
py
2,080
python
en
code
1
github-code
13
12355796803
import json def split_by_brackets(str1): try: result = str1.split('{')[1] except: result = '' return result def get_ydas_data(file): f = open(file,'r') content = f.read() f_content_list = content.split('}') f_content_list = list(map(lambda x: split_by_brackets(x), f_cont...
hjl092868/hjl
gz_subway_test/station_ydas_statistic.py
station_ydas_statistic.py
py
2,010
python
en
code
0
github-code
13
37529462510
# Question 1) - Your function will take N arrays as Arguments and a string X, Integer Y, # you must return a final list of all possible elements from all Arrays ; # - Whose length is greater than length of string X by at-least twice, # - Whose value contains the pattern strin...
valliammai-tech/Python
pythonProject/PythonEx1.py
PythonEx1.py
py
1,081
python
en
code
0
github-code
13
38925663965
def read_parquet() -> None: import pandas as pd path = 'utils/parquet/parquet_sample_files/COINBASE-BCH-USD-l2_book-1614500246.parquet' # table = pq.read_table(path) # meta = pq.read_metadata(path) # pandas = pq.read_pandas(path) # print(pandas) df = pd.read_parquet(path) print(df.head(...
dirtyValera/svoe
utils/parquet/parquet_test.py
parquet_test.py
py
652
python
en
code
12
github-code
13
26863182105
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.contrib.postgres.fields class Migration(migrations.Migration): dependencies = [ ('countries', '0003_auto_20150903_0156'), ] operations = [ migrations.AlterField( ...
sentinel-project/sentinel-app
sentinel/countries/migrations/0004_auto_20150903_0156.py
0004_auto_20150903_0156.py
py
532
python
en
code
0
github-code
13
9801550536
# -*- coding: utf-8 -*- """ Created on Tue Oct 18 11:11:54 2022 @author: 983045 """ from rdkit import Chem test_mol = Chem.MolFromSmiles("CC(=O)NC1=C(C=C(C=C1)O)O") def get_bonds(mol): all_bonds = [] for b in mol.GetBonds(): a = (b.GetBeginAtomIdx(),b.GetEndAtomIdx(), b.GetB...
DanielYyork/MChem-
functions.py
functions.py
py
5,459
python
en
code
0
github-code
13
15309381938
import numpy as np import pandas as pd import datetime as dt from util.data_operations import get_dataset from util.distance_operations import harversine, distance_df from util.trip_enhancement import TripEnhancer, SNAP_TO_ROAD_KEY from conf.settings import FilesConfig TRIP_DEFINITON = 7 * 60 * 1000 TRIP_RELEVANCE ...
RHDZMOTA/gmaps-data-analysis
main.py
main.py
py
3,029
python
en
code
1
github-code
13