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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
41055648946 | from test_tools.example_stubber import ExampleStubber
class AuditManagerStubber(ExampleStubber):
"""
A class that implements stub functions used by Audit Manager unit tests.
"""
def __init__(self, client, use_stubs=True):
"""
Initializes the object with a specific client and configure... | awsdocs/aws-doc-sdk-examples | python/test_tools/auditmanager_stubber.py | auditmanager_stubber.py | py | 6,815 | python | en | code | 8,378 | github-code | 1 |
25299334409 | # coding=utf-8
from selenium import webdriver
import time
import requests
from yundama.dama import indetify
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
# 设置chrome浏览器无界面模式
# 浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败
# chrome_options.add_argument('--headless')
chrome_options.add_argum... | wzqq5517992/pythonReptileBasic | 04study/code/login_douban_wzq.py | login_douban_wzq.py | py | 1,763 | python | en | code | 0 | github-code | 1 |
32059293827 | import json
import urllib
from django.conf import settings
def evaluate_recaptcha(request, errors):
# Google Recaptcha validation
recaptcha_response = request.POST.get('g-recaptcha-response')
url = 'https://www.google.com/recaptcha/api/siteverify'
values = {
'secret': settings.GOOGLE_RECAPTCH... | DjangoMeetup/public-website | public_website/apps/formality/views.py | views.py | py | 687 | python | en | code | 1 | github-code | 1 |
32740181245 | import random
# 5 real world lists:
favorite_foods = ['Pizza', 'Beer', 'Pineapple', 'Strawberries', 'Carrots']
favorite_movies = ['Pulp Fiction', 'Blade Runner', 'LOTR', 'Your Highness']
home_depot_list = ['Insulation', 'Garden Pots', '1x4s', 'Kid Project']
pancake_ingredients = ['Flour', 'Egg', 'Baking ... | Ginger-BeardMan/Python3-The-Hard-Way | ex38_pt2.py | ex38_pt2.py | py | 771 | python | en | code | 0 | github-code | 1 |
41147577187 |
def partition(array, low, high):
pivot = array[high]
i = low - 1
for j in range(low, high):
if array[j] <= pivot:
i = i + 1
(array[i], array[j]) = (array[j], array[i])
(array[i + 1], array[high]) = (array[high], array[i + 1])
return i + 1
def ... | akakaklolo/learn_python | quicksort.py | quicksort.py | py | 693 | python | en | code | 0 | github-code | 1 |
34309580961 | from odoo import models, fields, api, tools
from datetime import datetime, timedelta
import json
# ***************** CREAR CIUDADES **********************
class create_city(models.TransientModel):
_name = 'medievol.create_city'
def _default_player(self):
jugador = self.env['res.partner'].browse(self.... | Buffty/ProyectoDAM | modules/medievol/models/wizards.py | wizards.py | py | 10,467 | python | en | code | 0 | github-code | 1 |
24679633820 | # 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 levelOrderBottom(self, root: Optional[TreeNode]) -> List[List[int]]:
q = deque()
... | YosefAyele/Leetcode-and-Codeforces-Problems | 0107-binary-tree-level-order-traversal-ii/0107-binary-tree-level-order-traversal-ii.py | 0107-binary-tree-level-order-traversal-ii.py | py | 846 | python | en | code | 2 | github-code | 1 |
29585688181 | import typing as t
import os.path
import logging
import json
from yaml.error import Mark
from typing_extensions import TypedDict, Protocol, Literal
from schemalint.entity import ErrorEvent, Lookup, Context
from schemalint.errors import (
ParseError,
LintError,
ResolutionError,
ValidationError,
Mes... | podhmo/schemalint | schemalint/formatter.py | formatter.py | py | 7,496 | python | en | code | 0 | github-code | 1 |
2421836667 | import pytz
import logging
from datetime import datetime, timedelta
from odoo import fields, models, api, _
from odoo.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
class MrpDistributeTimesheetLine(models.TransientModel):
_name = 'mrp.distribute.timesheet.line'
_descripti... | decgroupe/odoo-addons-dec | mrp_timesheet_distribution/wizard/mrp_distribute_timesheet.py | mrp_distribute_timesheet.py | py | 8,775 | python | en | code | 2 | github-code | 1 |
7422977067 | import numpy as np
from typing import Union, Optional, Any
from ..utils.vector import Vector
Position = Vector
Action = int
Cost = Union[int, float]
AdjList = dict[int, list[tuple[int, Cost]]]
AdjMatrix = np.ndarray
PosToIdx = dict[Position, int]
TextMaze = list[list[str]]
GameResult = dict[str, Optional[Any]]
Params... | ShkarupaDC/game_ai | src/consts/types.py | types.py | py | 338 | python | en | code | 2 | github-code | 1 |
28392533224 | class Node:
def __init__(self, value):
self.value = value
self.right = None
self.left = None
class BinaryTree:
def __init__(self):
self.root = None
def breadth_first(self,root):
visit=[]
rot=[]
if root!=None:
current = root
... | Essa31/data-structures-and-algorithms | trees/tree_breadth_first.py | tree_breadth_first.py | py | 2,532 | python | en | code | 0 | github-code | 1 |
2847074558 | # Import keras.
import keras as kr
import tensorflow as tf
from keras.models import Sequential
from keras.datasets import mnist
from keras.models import Sequential, load_model
from keras.layers.core import Dense, Dropout, Activation
from keras.utils import np_utils
from keras.models import load_model
import sklearn.pre... | KeithH4666/Jupyter-Notebooks-e.g-iris-classifier-script-Mnist-Dataset-script | Digit Recognition Script/Handwritten.py | Handwritten.py | py | 5,998 | python | en | code | 0 | github-code | 1 |
29252009746 | # # -*- coding:utf-8 -*-
import time
starting_time = time.time()
import warnings
warnings.filterwarnings(action='ignore')
import math
import csv
import pandas as pd
import numpy as np
np.set_printoptions(precision=8, suppress=True)
pd.options.display.float_format = '{:.8f}'.format
from tensorflow... | tjwodud04/Master-Course-Project | Public_Experiment/Working_code/planning.py | planning.py | py | 11,984 | python | en | code | 0 | github-code | 1 |
18323491914 | import logging
from typing import Dict, List
import torch
from torch import nn
from detectron2.config import configurable
from detectron2.utils.events import get_event_storage
from detectron2.modeling import META_ARCH_REGISTRY
from typing import Any
from .meta_one_stage_detector import MetaProposalNetwork
from sylph.... | facebookresearch/sylph-few-shot-detection | sylph/modeling/meta_arch/few_shot_rcnn.py | few_shot_rcnn.py | py | 13,777 | python | en | code | 54 | github-code | 1 |
15850335590 | import os
import requests
import time
from typing import Any
from .core.enums import Chain
from .core.base import Web3Connector
from . import log
__all__ = [
"Etherscan",
"Etherscanner",
]
class ResponseParser:
@staticmethod
def parse(response: requests.Response) -> Any:
content = response.... | idiotekk/unknownlib | lib/unknownlib/evm/etherscan.py | etherscan.py | py | 2,813 | python | en | code | 0 | github-code | 1 |
12449952324 | try:
with open('weather.dat') as f:
lines = f.read().splitlines() #using this ensures we don't include line separators (\n) which come with f.readlines()
# print(lines)
spread, day = list(), list()
#We start at index 2 where actual data starts and we get to the second last... | Austinstevesk/practical-code-solutions | weather/weather.py | weather.py | py | 1,589 | python | en | code | 0 | github-code | 1 |
1077528090 | import keras.models
import sys
import simplejson as json
model = keras.models.load_model('./modeli/prt10.43.hdf5')
#"vreme" , "temperatura", "vlaznost", "pritisak", "brzina", "oblacnost", "dan u nedelji" , "mesec"
args = sys.argv
path_json = args[1]
with open(path_json) as json_file:
data = json.load(json_fi... | mladjan-gadzic/matf-hackathon | ML/mreza.py | mreza.py | py | 892 | python | hr | code | 0 | github-code | 1 |
19842701690 | import json
from backend.util.mapper import to_dict
class Question:
def __init__(self, question: str, options: dict, answer: str, vote: str, dataset_id: int, analysis: str, id=None):
self.id = id
self.question = question
self.options = options
self.answer = answer
self.vot... | PengfeiMiao/smart-qa | backend/entity/question.py | question.py | py | 1,267 | python | en | code | 0 | github-code | 1 |
30217682087 | import requests
import json
import time
import re
import random
from user_agent_tool import *
class converse_post():
def __init__(self):
self._num = 1
self._user_agent_tool = user_agent_tool()
self._session = requests.session()
self._isEnoughStock_response = {
'returnUrl'... | mycodeset/Converse | Selenium下单工具/converse_post.py | converse_post.py | py | 9,396 | python | en | code | 0 | github-code | 1 |
40010379606 | class ListNode:
def __init__(self, key, val):
self.key = key
self.val = val
self.next = None
self.prev = None
#remove the ListNode itself from the doubly linked list
def remove(self):
self.prev.next = self.next
self.next.prev = self.prev
self.ne... | wyy1234567/leetcode_problems | lru_cache.py | lru_cache.py | py | 1,697 | python | en | code | 0 | github-code | 1 |
18061284249 | import gym
import math
import numpy as np
import cv2
import hashlib
import collections
from gym.envs.atari import AtariEnv
from . import utils
from gym.vector import VectorEnv
from typing import Union, Optional
class EpisodicDiscounting(gym.Wrapper):
"""
Applies discounting at the episode level
"""
... | maitchison/PPO | rl/wrappers.py | wrappers.py | py | 59,577 | python | en | code | 14 | github-code | 1 |
20522502354 | """
Test for import machinery
"""
import unittest
import sys
import textwrap
import subprocess
import os
from PyInstaller.lib.modulegraph import modulegraph
class TestNativeImport (unittest.TestCase):
# The tests check that Python's import statement
# works as these tests expect.
def importModule(self, na... | pyinstaller/pyinstaller | tests/unit/test_modulegraph/test_imports.py | test_imports.py | py | 20,640 | python | en | code | 10,769 | github-code | 1 |
20593187659 | import pycurl
from urllib import parse
class LexofficeUpload:
"""
A class for uploading invoice documents
"""
def __init__(self, apiToken: str) -> None:
self.apiUrl = 'https://api.lexoffice.io/v1/files'
self.apiToken = apiToken
def fileUpload(self, tmpFile, fileName: str):
... | Maki-IT/lexoffice-invoice-upload | invoice/uploader/uploader.py | uploader.py | py | 1,243 | python | en | code | 9 | github-code | 1 |
31551435271 | import numpy as np
import yaml
import matplotlib.pyplot as plt
file = 'D:/Projects/PhaseTransistor/Data/Simulation/Phonon/4_D3BJ_FD_vdw/phonon/eigenvectors/band.yaml'
def ReadPhonopyData(band_yaml):
with open(band_yaml) as f:
data = yaml.load(f, Loader=yaml.FullLoader)
return data
def Rear... | MajestyV/VASPWheels | GetVibrationalDisplacement.py | GetVibrationalDisplacement.py | py | 1,160 | python | en | code | 5 | github-code | 1 |
34806501971 | ''' Common pricing methods corresponding to Interest rate Instruments '''
import datetime as dt
#from collections import OrderedDict
import json
import os
import scipy as sci
import numpy as np
import pandas as pd
# import interest_rate_base as intbase
import interest_rate_dates as intdate
import interest_rate_discount... | slpenn13/pythoninterestrates | src/curve_constructor_lorimier.py | curve_constructor_lorimier.py | py | 9,174 | python | en | code | 0 | github-code | 1 |
12644183853 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 13 19:28:40 2023
@author: erica
"""
import csv
#import pandas as pd
def read_data():
# Read input data
f = open('C:/Users/erica/OneDrive/Documents/GitHub/Module3/src/data/input/in.txt', newline='')
data = []
for line in csv.reader(f, quoting=csv.QUOTE_NONNUM... | ericaanderson/Module3 | src/abm6/my_modules_6/io.py | io.py | py | 905 | python | en | code | 0 | github-code | 1 |
32156408206 | import pytest
import six
from pymarketstore import jsonrpc
from unittest.mock import patch
import importlib
importlib.reload(jsonrpc)
@patch.object(jsonrpc, 'requests')
def test_jsonrpc(requests):
requests.Session().post.return_value = 'dummy_data'
cli = jsonrpc.MsgpackRpcClient('http://localhost:5993/rcp'... | alpacahq/pymarketstore | tests/test_jsonrpc.py | test_jsonrpc.py | py | 768 | python | en | code | 101 | github-code | 1 |
25378068112 | # The data updating script
# Brings in query from the file social.sql
# Working from file means the SQL code can be developed and tested
# directly within the Postgres environment and psycopg2 creates access
# to that code from within Python
# Unclear what context would require this psycopg2 setup with no real
# Pytho... | gusmairs/sql-projects | dsi-pyth/daily_update.py | daily_update.py | py | 829 | python | en | code | 0 | github-code | 1 |
1963689320 |
s = input()
ans = ''
stack = []
for c in s :
if c == '(' or c == ')' : #최우선순위
if c == '(' :
stack.append(c)
else :
while stack and stack[-1] != '(' : # 괄호 시작 지점까지 있는 연산자를 모두 ans에 추가해줘야함.
ans+=stack.pop()
stack.pop() # 괄호 시작 제거
elif c == '... | totwjfakd/-algorithm | stack/백준1918_후위 표기식.py | 백준1918_후위 표기식.py | py | 1,112 | python | ko | code | 0 | github-code | 1 |
36202014871 | # coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
ipt = list(map(int, input().split()))
bread_kinds = ipt[0]
query_n = ipt[1]
bread_prices = {}
bread_n = {}
for i in range(bread_kinds):
bread_params = list(map(int, input().split()))
bread_prices[i] = bread_params[0]
bread_n[i] = bread_params[1]
for i in rang... | sadayasu825/mypazzle | paiza/python/B/B076.py | B076.py | py | 1,041 | python | en | code | 0 | github-code | 1 |
41728221583 | #!/usr/bin/env python
"""
This scrapes Streak for the Cash information from ESPN and writes it to an Excel spreadsheet.
It uses BeautifulSoup 4 and xlsxwriter.
In order to use this, you will need to download bs4, lxml, and xlsxwriter.
Prop array format: [Sport, League, Prop, Active Picks %, Winner, Winner %, Loser, ... | keveleigh/espn-sftc | props.py | props.py | py | 4,060 | python | en | code | 0 | github-code | 1 |
25376970593 | import os
from pypcd import pypcd
from rich.progress import track
class Bin2Pcd:
def __init__(
self,
input,
input_dims,
output,
):
self.input = input
self.input_dims = input_dims
self.output = output
self.file_list = self.get_file_list()
... | windzu/apk | apk/format/bin2pcd/bin2pcd.py | bin2pcd.py | py | 1,398 | python | en | code | 2 | github-code | 1 |
32821607542 | from datetime import datetime
import os.path
import vcr
from csep.utils.comcat import search
HOST = 'webservices.rm.ingv.it'
def get_datadir():
root_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(root_dir, 'artifacts', 'BSI')
return data_dir
def test_search():
datadir = ge... | SCECcode/pycsep | tests/test_bsi.py | test_bsi.py | py | 1,480 | python | en | code | 40 | github-code | 1 |
23090120889 | from pathlib import Path
import os
import subprocess
import time
from urllib.parse import unquote_plus
import httpx
from api.settings import API_TOKEN
# this assumes API server is running at :5000 and that worker is also running
DELAY = 1 # seconds
MAX_RETRIES = 240
API_URL = "http://localhost:5000"
# API_URL = ... | astutespruce/secas-ssa | tests/test_report_api.py | test_report_api.py | py | 3,742 | python | en | code | 0 | github-code | 1 |
15026539313 | import pyrealsense2 as rs
# Import Numpy for easy array manipulation
import numpy as np
# Import OpenCV for easy image rendering
import cv2
# Create a pipeline
pipeline = rs.pipeline()
# Create a config and configure the pipeline to stream
# different resolutions of color and depth streams
config = rs.config()
# Ge... | bub3690/greencamp_vision | realsense/depth_color_align.py | depth_color_align.py | py | 3,833 | python | en | code | 2 | github-code | 1 |
19659631050 | import logging
import shutil
from datetime import datetime, timedelta
from itertools import chain
from pathlib import Path
from zipfile import ZipFile
logger = logging.getLogger(__name__)
MAX_STORAGE_DAYS = 90
FREE_SPACE_PERCENT = 10
def get_file_datetime(path):
year, month, day = path.parent.parts[-3:]
re... | Auranoz/test_storage | index.py | index.py | py | 2,253 | python | en | code | 0 | github-code | 1 |
41547307 | from pathlib import Path
import subprocess
config_path = str((Path(__file__).parent/'sample_config').absolute())
src_path = str((Path(__file__).parent/'empty_article.tex').absolute())
def test_config_file_reading(tmpdir):
"""
Check that config file provided on command line are read.
This is a cli only te... | plastex/plastex | unittests/ConfigFileReading.py | ConfigFileReading.py | py | 729 | python | en | code | 240 | github-code | 1 |
29453264686 | #
from typing import Union
from torch_geometric.typing import Adj, PairTensor, OptTensor
import torch
from torch import Tensor
from torch_geometric.nn.conv import GraphConv
#
class SpatialGraphConv(GraphConv):
r"""
Extension to Pytorch Geometric GraphConv
which is implementing the operator of
`"Weisf... | jokofa/NRR | lib/model/networks/spatial_graph_conv.py | spatial_graph_conv.py | py | 2,077 | python | en | code | 2 | github-code | 1 |
33821090414 | import sys
taskPerPerson = 0
try:
tasks = 32
personStr = input('How many persons ore there in the team? ')
persons = int(personStr)
taskPerPerson = tasks / persons
except ValueError as e: #dzięki dodaniu do zmiennej można np. zapisać error do loga
print('Sorry - You need to enter intiger number: ... | sineczek/NaukaPythona | Obsluga_Bledow/59_instrukcja_except.py | 59_instrukcja_except.py | py | 548 | python | en | code | 0 | github-code | 1 |
1704830618 | import sys
limit_number = 15000
sys.setrecursionlimit(limit_number)
# 모두 같으면 True 아니면 False
def AllSame(x, y, size):
prev = graph[x][y]
for i in range(x, x+size):
for j in range(y, y+size):
if prev != graph[i][j]:
return False
else:
prev = graph... | SunghunKim98/Algorithm_Study | sprint12/KMS/FW/BOJ_1780.py | BOJ_1780.py | py | 830 | python | en | code | 0 | github-code | 1 |
36028396719 | from django.urls import path, include
from .views import main, UserListView, CreateUserView, UserDetailsView, LoginView, RefreshTokenView
urlpatterns = [
path('', main),
path('user', UserListView.as_view()),
path('refresh-token', RefreshTokenView.as_view()),
path('user/<int:id>', UserDetailsView.as_vie... | gabrigomez/django-api | django_project/api/urls.py | urls.py | py | 421 | python | en | code | 0 | github-code | 1 |
12988969224 | class Contact:
def __init__(self, firstname=None, middlename=None, nickname=None, home=None,
email=None):
self.firstname = firstname
self.middlename = middlename
self.nickname = nickname
self.home = home
self.email = email
# firstname="firstname", middlename... | liarodina/python_training | model/contact.py | contact.py | py | 394 | python | en | code | 0 | github-code | 1 |
21035574213 | # Given an array of integers, return indices of the two numbers such that they add up to a specific target.
#
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
# Example:
# Given nums = [2, 7, 11, 15], target = 9,
#
# Because nums[0] + nums[1] = 2 + 7 = 9,
#... | EarthChen/LeetCode_Record | easy/two_sum.py | two_sum.py | py | 1,070 | python | en | code | 0 | github-code | 1 |
73599315234 | import os
import shutil
import unittest
import uuid
import pyodbc
from ..pyodbc_helpers import *
class Test_pyodbc(unittest.TestCase):
@classmethod
def setUpClass(cls):
shutil.rmtree(cls.fix_tmproot())
@staticmethod
def fix_tmproot():
return os.path.realpath(os.path.j... | ivangeorgiev/gems | legacy/src/pyodbc_helpers/tests/test_pyodbc.py | test_pyodbc.py | py | 1,803 | python | en | code | 14 | github-code | 1 |
27006946586 | class TreeNode(object):
"""docstring for TreeNode"""
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def isValidBST(self, root):
def dsf(root, min, max):
if root == None:
return True
if root.val <= min or root.val >= max:
return False
return d... | yiqin/HH-Coding-Interview-Prep | Use Python/ValidateBinarySearchTree.py | ValidateBinarySearchTree.py | py | 704 | python | en | code | 3 | github-code | 1 |
32407624536 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
import math
import numpy as np
# initialize the graph
def initializeGraph():
x = data['x']
y = data['y']
plt.scatter(x, y)
plt.plot(plot1[0], plot1[1], 'go-', label='line 1', linewidth=2)
plt.plot(pl... | franklee809/3d-matplot | main.py | main.py | py | 7,130 | python | en | code | 0 | github-code | 1 |
26743105833 | """
Audio beacon and code transmission of Module 2
"""
import time
import serial
import pyaudio
import numpy as np
import matplotlib.pyplot as plt
import serial.tools.list_ports
# # Sampling data
Fs = 48000
# Time_recording = S # in seconds
# N_mic = 5 # number of mics/channels
# N = Time_recording * Fs # number of... | dlacle/EPO-4 | epo4/Module2/Module2_mic_array/AudioBeacon.py | AudioBeacon.py | py | 6,133 | python | en | code | 3 | github-code | 1 |
17071084396 | from sklearn.linear_model import LogisticRegression
from MyLogisticRegGen import MyLogisticRegGen
from my_cross_val import my_cross_val
from datasets import prepare_digits
from utils import (
report,
wrapper_args
)
import sys
def q4(argv=None):
dataset, method_name, k, latex = wrapper_args(
a... | craigching/csci-5521 | csci-5521-hw3/q4.py | q4.py | py | 1,228 | python | en | code | 2 | github-code | 1 |
30454792138 | from pathlib import Path
import os, sys
from dash import Dash, html, dcc, Input, Output, callback
import pandas as pd
import plotly.express as px
def read_data(src_file):
df = pd.read_csv(src_file)
return df
def create_time_series(data):
fig = px.scatter(data, x='Date', y='Open')
fig.show()
re... | ojudz08/Projects | api/polygon_rest_api/time_series.py | time_series.py | py | 629 | python | en | code | 0 | github-code | 1 |
16805242464 | from parallel_data_processing.parallel_sorting.k_way_merging import k_way_merge
from parallel_data_processing.parallel_sorting.quick_sort import quick_sort
def serial_sorting(dataset, buffer_size): # assume main memory can only hold to buffer_size number of records
if (buffer_size <= 2):
print("Error: bu... | OceanicSix/Python_program | parallel_data_processing/parallel_sorting/sort_merge.py | sort_merge.py | py | 2,499 | python | en | code | 1 | github-code | 1 |
25859782549 | from dataclasses import dataclass
import time
import enum
import logging
from contextlib import contextmanager
import os
from typing import Optional, Any # This is support for type hints
from log_calls import log_calls # For logging errors and stuff
#from setting import SettingDescription
from . import nlp, audio, an... | Halcyox/XRAgents | xragents/scene.py | scene.py | py | 4,448 | python | en | code | 3 | github-code | 1 |
3884911703 |
from ast import Try
import requests
from controllers import buyStock,sortStocks, buyFor
if __name__ == '__main__':
stocks = ['AAPL','GOOGL','AMZN','TSLA','FB','TWTR','UBER','LYFT','SNAP','SHOP']
listPrices = []
for stock in stocks:
url = f'https://financialmodelingprep.com/api... | Franzcod/challenge_trii_backend | main.py | main.py | py | 1,379 | python | en | code | 1 | github-code | 1 |
30296724945 | """ Build HTML examples for the simple Python to WASM compiler.
"""
import os
import wasmfun as wf
from simplepy import simplepy2wasm
for fname in os.listdir('.'):
if fname.startswith('example') and fname.endswith('.py'):
code = open(fname, 'rb').read().decode()
wasm = simplepy2wasm(code... | almarklein/wasmfun | simplepy/build.py | build.py | py | 843 | python | en | code | 35 | github-code | 1 |
21106157201 | #!/usr/bin/env python3
#
# submit_tX_tests.py
# Written: Nov 2018
# Last modified: 2019-11-09 RJH
#
# Python imports
from os import getenv
import sys
import json
import logging
import subprocess
# ======================================================================
# User settings
USE_LOCALCOMPOSE_URL... | unfoldingWord-dev/tools | tx/submit_tX_tests.py | submit_tX_tests.py | py | 5,841 | python | en | code | 8 | github-code | 1 |
170223454 | # -*- coding: utf-8 -*-
'''
/**************************************************************************************************************************
SemiAutomaticClassificationPlugin
The Semi-Automatic Classification Plugin for QGIS allows for the supervised classification of remote sensing images,
provid... | jem0101/BigSwag-SQA2022-AUBURN | TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/semiautomaticgit@SemiAutomaticClassificationPlugin/modules/snap.py | snap.py | py | 2,941 | python | en | code | 2 | github-code | 1 |
23220228123 | from ast import If
import hashlib
def converter():
while True:
my_input = input("Enter the word to convert: ")
x = hashlib.md5(my_input.encode('utf-8')).hexdigest()
print(x)
if my_input == "exit()":
print("Byeeeee!")
break
converter() | CapnSane/picoCTF-practicing | md5.py | md5.py | py | 296 | python | en | code | 0 | github-code | 1 |
38204007026 | from ..settings import LOGGING
from ..httpclient.client import Client
import logging.config
import urllib3, json, os
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
logging.config.dictConfig(LOGGING)
logger = logging.getLogger(__name__)
class Vnfd(object):
"""VNF Descriptor Class.
This c... | sonata-nfv/son-monitor | vnv_manager/app/api/management/commands/osm/nbiapi/vnfd.py | vnfd.py | py | 3,322 | python | en | code | 5 | github-code | 1 |
12623753130 | from .models import Booking
from django import forms
class BookingForm(forms.ModelForm):
class Meta:
model = Booking
fields = (
'guests', 'date', 'time',
'first_name', 'last_name', 'email', 'requirements'
)
widgets = {
'date': forms.DateInput... | lucijahajdu/lucia-trattoria | booking/forms.py | forms.py | py | 699 | python | en | code | 0 | github-code | 1 |
13110433306 | import json
def txt_to_tar_dict(src):
'''
Convert text file with course info into dictionary
File line format: COURSE TITLE/PREREQ1,PREREQ2,.../COREQS/RESTRICTIONS
'''
out = {}
for course in src:
title, prereqs, coreqs, restricts = course.strip().split('/')
#Mark no courses li... | RolandRiachi/PrerequisitesGraph | courseData/coursePages/txt_to_var.py | txt_to_var.py | py | 2,089 | python | en | code | 0 | github-code | 1 |
24058816792 | # Setting the color combinations
from enum import Enum, IntEnum, auto
DARK, LIGHT = range(2)
FG_BLACK, FG_RED, FG_GREEN, FG_YELLOW, FG_BLUE, FG_MAGENTA, FG_CYAN, FG_WHITE = range(30, 37 + 1)
BG_BLACK, BG_RED, BG_GREEN, BG_YELLOW, BG_BLUE, BG_MAGENTA, BG_CYAN, BG_WHITE = range(40, 47 + 1)
LIGHT_BLACK = f"\033[{LIGHT};... | atrox3d/public-passwordcracker | medium/helpers/constants.py | constants.py | py | 1,232 | python | en | code | 0 | github-code | 1 |
33366410555 | import sys
import select
import time
import os
import threading
import time
# Importing tasks and all their dependencies during setup time
print("Loading task dependencies...")
import take_pic
from objectDetector import detectObjects
from face_matcher import face_matcher
# from multiprocessing import Process
#Keepin... | prampey/Pi0-pipeline | src/python/python_manager.py | python_manager.py | py | 3,110 | python | en | code | 0 | github-code | 1 |
34470989030 | def solution(numbers):
stack = []
ans = [-1] * len(numbers)
for i, value in enumerate(numbers):
while stack and numbers[stack[-1]] < value:
ans[stack.pop()] = value
stack.append(i) # 현재 index값 담기
return ans | yeafla530/algorithms | 프로그래머스/연습문제/python/뒤에있는큰수찾기.py | 뒤에있는큰수찾기.py | py | 292 | python | en | code | 0 | github-code | 1 |
19773722015 | import logging
import os
import sys
from abc import ABC
from typing import TextIO
from kivy import metrics
from kivy.app import App
from kivy.base import EventLoop
from kivy.config import Config
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.metrics import dp
from kivy.resources import res... | n2qzshce/ham-radio-sync | src/ui/app_window.py | app_window.py | py | 16,444 | python | en | code | 9 | github-code | 1 |
40995339242 | '''
Created on Oct 16, 2014
@author: I042416
'''
import sys
import re
def update_count(current):
global max_count
global min_count
if current > max_count:
max_count = current
if current < min_count:
min_count = current
def handleLine(x):
word_array = x.split(' ')
... | js1972/KnowlegeRepository | python/003_word_count_jerry.py | 003_word_count_jerry.py | py | 1,550 | python | en | code | 3 | github-code | 1 |
26799682088 | import streamlit as st
from PIL import Image
import pandas as pd
import matplotlib.pyplot as plt
add_selectbox = st.sidebar.selectbox(
"목차",
("체질량 계산기", "갭마인더", "마이페이지")
)
if add_selectbox == "체질량 계산기":
#체질량 치수 구하는 랩
#몸무게, 키입력받기
st.write('#체질량 치수 계산기')
height = st.number_input('키를 입력하시오.(cm)... | Dongkka912/smartMobility | home.py | home.py | py | 2,234 | python | ko | code | 0 | github-code | 1 |
70463600353 | # writing a file................................
my_file = open('test.txt','w')
my_file.write('I love my country so much.\nI want to do good thing for my country!')
my_file= open('test.txt','a')
my_file.write('\nWe must be proud for loving my country!')
my_file.close()
new_file = open('test.txt','r')
output ... | hasnatosman/python_recap | file_menipulations.py | file_menipulations.py | py | 477 | python | en | code | 0 | github-code | 1 |
24929247076 | def isValidSudoku(board) -> bool:
seen = set()
rows = len(board)
cols = len(board[0])
for row in range(rows):
for col in range(cols):
if board[row][col] != '.':
curr = board[row][col]
if (curr, row) in seen or (col, curr) in seen or (row//3, col//3, cu... | cha1690/Data-Structures-and-Algoritms | Medium Must Do's/validSudoku.py | validSudoku.py | py | 506 | python | en | code | 2 | github-code | 1 |
9639292454 | import base64
import json
import rsa
import sympy
from fastapi import APIRouter, Depends, HTTPException, WebSocket, Header
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import joinedload
from starlette import status
from starlette.responses import Response
from starl... | coplant/di-secured-chat | src/chat/router.py | router.py | py | 14,181 | python | en | code | 0 | github-code | 1 |
1538742126 | import numpy as np
import matplotlib.pylab as plt
from scipy.stats import norm
from src.MiniProjects.DeltaHedging.SingleVariableDeltaHedgingValuator import SingleVariableDeltaHedgingValuator
from src.SolverMC.SingleVariableSimulator import SingleVariableSimulator
__author__ = 'frank.ma'
class SingleVariableDeltaHed... | frankma/Finance | src/MiniProjects/DeltaHedging/SingleVariableDeltaHedging.py | SingleVariableDeltaHedging.py | py | 2,917 | python | en | code | 0 | github-code | 1 |
17960395799 | import numpy as np
from scipy.integrate import solve_ivp
from utilities import *
import shelve
nInfectiousStates = [5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 1000]
tauR = 21
threshold = 0.0
maxRate = 1
timeToMaxRate = 4
n = 10000
R0 = 3
tmax = 100
initialFractionInfected = 0.01
time_SIR = list()
tim... | nwlandry/time-dependent-infectiousness | Theory/run_peak_difference.py | run_peak_difference.py | py | 2,372 | python | en | code | 2 | github-code | 1 |
40046312707 | # flow_packet = {1:F1_0, 2:F1_1,....}
class TimeTable:
def __init__(self):
self.time_table = {}
self.fail_flows = []
def put_path_and_time_list_to_table(self, flow, path, time_list):
temp_dict = {}
for time, flow_packet_dict in time_list.items():
temp_dict[time] = ... | lingyun888/Schedule_V4 | scheduler/Timetable.py | Timetable.py | py | 1,567 | python | en | code | 0 | github-code | 1 |
7178934887 | """This module contains the likes API."""
from flask_jwt_extended import (
get_jwt_identity,
jwt_required,
)
from flask_restful import (
marshal_with,
reqparse,
Resource,
)
from sqlalchemy.exc import IntegrityError
from . import db_client
from .fields import quote_fields, quotes_fields
from .utils... | bertdida/devquotes-flask | devquotes/routes/like.py | like.py | py | 2,152 | python | en | code | 1 | github-code | 1 |
16779095834 | #1) Mostrar las iniciales de los nombres con un punto, luego un espacio y finalmente el apellido
#completo de todas las personas.
#2) Decir cuál es el nombre de pila más largo.
#3) Mostrar el promedio de edad de las mujeres. (Pueden usar el módulo edad.py que está subido en el Classroom)
nombres = [
"To... | pablokan/23prog1 | practicos/pr01/practico01_cuello natalia.py | practico01_cuello natalia.py | py | 1,760 | python | es | code | 0 | github-code | 1 |
24280233463 | ########################################################
# $File: config.py
# $Date: 14/08/2022
# $Creator: Pedro Cantarutti
########################################################
import os
basedir = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = os.urandom(32)
DEBUG = True
SQLALCHEMY_DATABASE_URI = '... | pedrocantarutti/bcrud | src/config.py | config.py | py | 406 | python | de | code | 0 | github-code | 1 |
72348982114 | # pylint: disable=abstract-method
"""
Input schema for Kemux.
This is the schema that is used to validate incoming messages.
"""
import dataclasses
import types
import dateutil.parser
import faust
import faust.models.fields
import kemux.data.schema.base
# pylint: disable=protected-access
@dataclasses.dataclass
cl... | kamilrybacki/Kemux | kemux/data/schema/input.py | input.py | py | 3,496 | python | en | code | 1 | github-code | 1 |
2525113933 | import json
import requests
from django.shortcuts import render, get_object_or_404
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.models import User
from django.db import ... | rcorrei4/cs50w-ibdb | books/views.py | views.py | py | 17,098 | python | en | code | 1 | github-code | 1 |
1842114863 | from bs4 import BeautifulSoup
import requests
import pandas as pd
import numpy as np
def get_title(soup):
try:
# Outer Tag Object
title = soup.find("h1", attrs={"class":'DrugHeader__title-content___2ZaPo'})
# Inner NavigatableString Object
title_value = title.text
... | jhachirag7/Mediscan | prescribtion_system/mgscrap.py | mgscrap.py | py | 2,475 | python | en | code | 0 | github-code | 1 |
3176997772 | import os
import tweepy
api_handle = None
def get_authorization():
TWITTER_API_KEY = os.getenv('TWITTER_API_KEY', None)
TWITTER_API_SECRET = os.getenv('TWITTER_API_SECRET', None)
auth = tweepy.AppAuthHandler(TWITTER_API_KEY, TWITTER_API_SECRET)
return auth
def get_api():
global api_handle
... | amtsh/vdeos.me | app/models/twitter/auth.py | auth.py | py | 670 | python | en | code | 0 | github-code | 1 |
13094457575 | import torch
import torch.nn as nn
def calc_iou(a, b):
area = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1])
iw = torch.min(torch.unsqueeze(a[:, 3], dim=1), b[:, 2]) - torch.max(torch.unsqueeze(a[:, 1], 1), b[:, 0])
ih = torch.min(torch.unsqueeze(a[:, 2], dim=1), b[:, 3]) - torch.max(torch.unsqueeze(a[:, 0], 1)... | sugarocket/object-detection-retinanet | nets/retinanet_training.py | retinanet_training.py | py | 10,231 | python | en | code | 1 | github-code | 1 |
72263104354 |
import sys
import pygame
import keyboard
from pygame.locals import *
from time import sleep
pygame.init()
deadband = 0.1
keepPlaying = True
print("example4")
# pygame.init()
pygame.display.set_caption('game base')
screen = pygame.display.set_mode((500, 500), 0, 32)
clock = pygame.time.Clock()
#
# pygame.joystick.... | Aragon-Robotics-Team/test-materov-2021 | GUI/joystick.py | joystick.py | py | 5,378 | python | en | code | 0 | github-code | 1 |
10602955285 | import sys
sys.stdin = open("그래프경로.txt")
def prin(a):
for i in range(len(a)):
print(*a[i])
# def dfs(start):
# global G, visited, V, E, result
# visited[start] = 1
# result.append(start)
#
# for w in range(V+1):
# if G[start][w] == 1 and visited[w] == 0:
# dfs(w)
T = i... | nopasanadamindy/Algorithms | 08. Stack1/02. Stack1 실습/그래프경로_풀기2.py | 그래프경로_풀기2.py | py | 835 | python | en | code | 0 | github-code | 1 |
12340533789 | from flask import Blueprint, request, url_for, jsonify
from PIL import Image
from delete_processed_images.views import delete_images
import numpy as np
gray_to_binary = Blueprint('gray_to_binary', __name__, template_folder='templates')
@gray_to_binary.route('/gray_to_binary', methods=['GET', 'POST'])
def im2bw():
... | Narcissimillus/appweb-edimg | gray_to_binary/views.py | views.py | py | 1,469 | python | en | code | 0 | github-code | 1 |
41690801080 | # У нас есть два предмета мебели: коричневый деревянный стол и красный кожаный диван. Заполните пробелы после создания каждого экземпляра класса Furniture, чтобы функция description_furniture могла отформатировать предложение, описывающее эти предметы, следующим образом: «Этот предмет мебели сделан из {цвета} {материал... | pers5not/my_rep | Google/crash_python/week_5/ex_5_3.py | ex_5_3.py | py | 1,068 | python | ru | code | 0 | github-code | 1 |
36286082579 | # Impordime vajalikud moodulid
import pygame
import sys
pygame.init() # alustame pygame mooduli
# Seadistame värvid
red = [255, 0, 0]
green = [0, 255, 0]
blue = [0, 0, 255]
pink = [255, 153, 255]
lGreen = [153, 255, 153]
lBlue = [153, 204, 255]
# Seadistame ekraani seaded
screenX = 640
screenY = 480
... | TorrenTamm/Tarkvaraarenduse-projekt | Tamm_yl5/Tamm_yl5.py | Tamm_yl5.py | py | 2,548 | python | et | code | 0 | github-code | 1 |
39354409559 | from sqlalchemy import func, desc, select, and_, distinct
from module_7.myconf.models import Grade, Teacher, Student, Group, Subject
from module_7.myconf.db import session
def select_01():
result = (
session.query(
Student.id,
Student.fullname,
func.round(func.avg(Grad... | KarinaNester/GoIT_homework_ | module_7/hw/query.py | query.py | py | 2,476 | python | en | code | 0 | github-code | 1 |
31265768032 | #!/usr/bin/env python
import os, sys
import argparse
import toml
import asteval
from collections import namedtuple
import math
import numpy as np
import lmfit
from scipy.linalg import norm
import h5py
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plot
from pbpl import common
from pbpl import compt... | ucla-pbpl/pbpl-compton | pbpl/compton/calc_energy_scale.py | calc_energy_scale.py | py | 4,897 | python | en | code | 2 | github-code | 1 |
14155606002 |
import tensorflow as tf
import sugartensor as stf
@stf.sg_layer_func
def seq_causal_aconv1d(tensor, opt):
r"""Applies 1-D atrous (or dilated) convolution.
Args:
tensor: A 3-D `Tensor` (automatically passed by decorator).
opt:
size: A positive `integer` representing `[kernel width]`. As a... | AndreasMadsen/master-thesis | code/tf_operator/convolution/seq_causal_aconv1d.py | seq_causal_aconv1d.py | py | 1,893 | python | en | code | 9 | github-code | 1 |
32017383453 | """Base Template For the API"""
import cherrypy
from api.base import APIBase
from libs.scraper import Scraper
@cherrypy.expose
class APIScraperSearchMovie(APIBase):
"""Base Template For the API"""
def GET(self, **kwargs) -> str:
"""POST Function"""
if "name" not in kwargs:
retur... | GaryTheBrown/Tackem | api/scraper/search_movie.py | search_movie.py | py | 762 | python | en | code | 0 | github-code | 1 |
13042981558 | import sys
from time import time
from typedargs import type_system
class ProgressBar:
"""A simple progress bar that updates itself in the console.
If the program is being run in interactive mode, display the progress_bar
otherwise do not display it
"""
def __init__(self, title, count=100):
... | iotile/coretools | iotilecore/iotile/core/utilities/console.py | console.py | py | 2,349 | python | en | code | 14 | github-code | 1 |
10576811082 | import json
from flask import Flask,render_template,request
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import requests
app = Flask(__name__)
url = "https://devapi.endato.com/PersonSearch"
scope = ['https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.co... | arunthakur007/Flask_Api | main.py | main.py | py | 3,450 | python | en | code | 0 | github-code | 1 |
3116790102 | import unittest
import get_paper_info
import pandas as pd
class TestGetPaperInfo(unittest.TestCase):
def setUp(self):
df = pd.read_csv('test_papers_jq.csv')
self.url_titles = df[['Paper title', 'URL']].values
def test_nature(self):
#nature article
url = self.url_titles[1][1]
... | nasa-petal/data-collection-and-prep | tests/test_get_paper_info.py | test_get_paper_info.py | py | 2,454 | python | en | code | 1 | github-code | 1 |
32808547513 | from math import factorial
from decimal import Decimal, getcontext
import time
def classic(n):
getcontext().prec = n
t= Decimal(0)
pi = Decimal(0)
deno= Decimal(0)
k = 0
for k in range(n):
t = ((-1)**k)*(factorial(6*k))*(13591409+545140134*k)
deno = factorial(3*k)*(factorial(k)*... | StephenH69/Python-Scripts | Pi Calculator/picalc.py | picalc.py | py | 1,272 | python | en | code | 1 | github-code | 1 |
25060266040 | # --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
#New record
new_record=np.array([[50, 9, 4, 1, 0, 0, 40, 0]])
#Code starts here
data_file= path
data=np.genfromtxt(data_file, delimiter= ",", skip_header=1)
print('\ndata: \n', d... | sunilpal97/ga-learner-dsb-repo | Census/code.py | code.py | py | 1,842 | python | en | code | 0 | github-code | 1 |
9658243428 | # -*- coding: utf-8 -*-
import os
import telebot
import time
import random
import threading
from emoji import emojize
from telebot import types
from pymongo import MongoClient
import traceback
token = os.environ['TELEGRAM_TOKEN']
bot = telebot.TeleBot(token)
client=MongoClient(os.environ['database'])
db=client.futur... | egor5q/futuremessages | bot.py | bot.py | py | 5,881 | python | ru | code | 0 | github-code | 1 |
22380953501 |
import pytest
from dawa import API
def test_vejstykke_initial():
api = API()
vejstykke = api.replicate('vejstykke')
for obj in vejstykke:
assert len(obj) != 0
break
def test_vejstykke_changes():
api = API()
vejstykke = api.replicate('vejstykke', txidfra=3432423, txidtil=3432... | Fredehagelund92/dawa-sdk | tests/test_vejstykke.py | test_vejstykke.py | py | 395 | python | da | code | 1 | github-code | 1 |
15885760206 | from typing import Dict, Optional
import torch
import torch.nn as nn
from vc_tts_template.fastspeech2.fastspeech2 import FastSpeech2
from vc_tts_template.fastspeech2wContexts.context_encoder import ConversationalContextEncoder
from vc_tts_template.fastspeech2wContexts.prosody_model import PEProsodyEncoder
from vc_tts... | YutoNishimura-v2/vc_tts_template | vc_tts_template/fastspeech2wContexts/fastspeech2wContextswPEProsody.py | fastspeech2wContextswPEProsody.py | py | 12,920 | python | en | code | 2 | github-code | 1 |
29728137134 | """
This creates Figure 2.
"""
import numpy as np
from statsmodels.multivariate.pca import PCA
from .common import subplotLabel, getSetup
from ..tensor import perform_CMTF, calcR2X, tensor_degFreedom
from ..dataImport import createCube
from ..impute import flatten_to_mat
from matplotlib.ticker import ScalarFormatter
... | meyer-lab/systemsSerology | syserol/figures/figure2.py | figure2.py | py | 2,785 | python | en | code | 3 | github-code | 1 |
73725948512 | import requests, dateutil.parser
from bs4 import BeautifulSoup
from datetime import datetime
#send email function
def sendEmail(title):
requests.post(
"https://api.eu.mailgun.net/v3/YOUR-DOMAIN/messages",
auth=("api", "YOUR-API-KEY"),
data={"from": "YOUR-NAME <YOUR-EMAIL-ADDRESS>",
"to": [... | adamxszabo/eloqua-announcements | eloqua-announcements.py | eloqua-announcements.py | py | 1,480 | python | en | code | 0 | github-code | 1 |
70686473635 | # -*- coding: utf-8 -*-
# @Time : 2021/3/9 0009
# @Author : yang
# @Email : 2635681517@qq.com
# @File : 46.py
"""Python 查找列表中最小元素"""
list1 = [1, 2, 3]
print(list1)
# print(min(list1))
if __name__ == "__main__":
lst = [5, 6, 3, 4]
lst.sort()
print(lst[:1][0])
# minn(lst)
| Futureword123456/Interview | Interview/5/46.py | 46.py | py | 308 | python | en | code | 0 | github-code | 1 |
25484145484 | #!/usr/bin/env python3
def main():
for a in range(1,1000):
for b in range(a,1000):
for c in range(b,1000):
if a + b + c == 1000 and a**2 + b**2 == c**2:
return a * b * c
if __name__ == '__main__':
print(main())
| pineman/code | chall/EULER/EULER 9.py | EULER 9.py | py | 229 | python | en | code | 1 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.