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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
42843816488 | import pytest
import logging
import json
from work_order_tests.work_order_tests import work_order_get_result_params, \
work_order_request_params
from automation_framework.work_order_submit.work_order_submit_utility \
import verify_work_order_signature, decrypt_work_order_response
from automation_framework.utili... | manojsalunke85/avalon0.6_automaiton | tests/validation_suite/work_order_tests/get/test_work_order_submit_get_outData.py | test_work_order_submit_get_outData.py | py | 2,427 | python | en | code | 0 | github-code | 36 |
15057824639 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import home_logs.utils.unique
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | tsaklidis/LogingAPI | home_logs/property/migrations/0001_initial.py | 0001_initial.py | py | 3,232 | python | en | code | 8 | github-code | 36 |
37278669262 | from typing import cast
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions as EC, wait
from selenium.webdriver.common.by import By
from chessEngine import Chess
from mov... | julianpjp/Lichess-Bot | getBoard.py | getBoard.py | py | 5,496 | python | en | code | 0 | github-code | 36 |
70876552105 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 13 09:12:14 2022
@author: Santiago Pinzon-Cortes
@contact: sanpinzoncor@unal.edu.co
"""
"""
Functions modified by functions made by Natalia Gomez-Perez (BGS) ngp@nerc.ac.uk
The functions are readers for data from WDC database and INTERMAGNET databa... | sanhbk/Dst-index-proxies-LDi | Readers.py | Readers.py | py | 5,270 | python | en | code | 0 | github-code | 36 |
8649453711 | """
============================
Author:柠檬班-木森
Time:2020/5/6 10:03
E-mail:3247119728@qq.com
Company:湖南零檬信息技术有限公司
============================
"""
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdri... | huchaoyang1991/py27_web | web_06day(鼠标和下拉选择框)/task_05day.py | task_05day.py | py | 3,284 | python | en | code | 0 | github-code | 36 |
34972774203 |
import sys
import os
DATA_TYPES = ("str", "int")
DATA_TYPE_STR = ", ".join(DATA_TYPES)
HOME_DIR = os.path.expanduser("~").replace("\\", "/")
def explode(inPath, outPath):
inLoc = os.path.expanduser(inPath)
outLoc = os.path.expanduser(outPath)
if not os.path.exists(inLoc):
return f"No such file... | aarek-eng/txtpy | txtpy/convert/tf.py | tf.py | py | 8,081 | python | en | code | 1 | github-code | 36 |
43914363858 | # 플로이드 워셜 알고리즘
INF = int(1e9)
# 입력
num_nodes = int(input())
num_edges = int(input())
# 2차원 리스트 기본 값 초기화
graph = [[INF] * (num_nodes + 1) for _ in range(num_nodes + 1)]
for start_node in range(1, num_nodes + 1):
for end_node in range(1, num_nodes + 1):
if start_node == end_node:
graph[start_no... | yesjuhee/study-ps | Hi-Algorithm/week7/floyd-warshall.py | floyd-warshall.py | py | 976 | python | en | code | 0 | github-code | 36 |
4897651596 | '''
Assignments
1)Write a Python program to sort (ascending and descending) a dictionary by value. [use sorted()]
2)Write a Python program to combine two dictionary adding values for common keys.
d1 = {'a': 100, 'b': 200, 'c':300}
d2 = {'a': 300, 'b': 200, 'd':400}
Sample output: Counter({'a': 400, 'b': 400, 'd': 400,... | Deepak10995/node_react_ds_and_algo | assignments/week03/day1-2.py | day1-2.py | py | 901 | python | en | code | 0 | github-code | 36 |
21346552302 | from django.shortcuts import render, redirect
from django.core.mail import send_mail
from django.contrib import messages
from django.conf import settings
# Create your views here.
# Paypal email id[to donate] :- testingofshopkproject2@gmail.com & password :- Shopk@4994
def home(request):
return render(req... | Kiran4949/Donation | app/views.py | views.py | py | 1,234 | python | en | code | 0 | github-code | 36 |
34547399185 | file = open("input.txt", "r")
raw_input = list()
[raw_input.append(i[:-1]) for i in file.readlines()]
f = 0
d = 0
for elem in raw_input:
print(elem)
t = elem.split(" ")
print(t)
if t[0] == "forward":
f += int(t[1])
elif t[0] == "down":
d += int(t[1])
elif t[0] == "up":
... | marin-jovanovic/advent-of-code | 2021/02/part_one.py | part_one.py | py | 361 | python | en | code | 0 | github-code | 36 |
16514949152 | from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.index),
url(r'^about', views.mail_form),
url(r'^api', views.api),
url(r'^score/today', views.today),
url(r'^score/(?P<date_id>\d{8})/$', views.feedjson),
url(r'^admin/... | h2r4t/npbapi | npbapi/urls.py | urls.py | py | 439 | python | en | code | 0 | github-code | 36 |
15154019133 | import pandas as pd
from textblob import TextBlob
import multiprocessing as mp
import time
def calc(review):
review_blob = TextBlob(str(review))
polarity = review_blob.sentiment.polarity
if polarity > 0:
return "Positive"
elif polarity < 0:
return "Negative"
else:
return "N... | philipsFarraj/ParallelProject | project.py | project.py | py | 626 | python | en | code | 0 | github-code | 36 |
70003672425 | import asyncio, config, aiohttp
import logging
from .utils import instance_tools
log = logging.getLogger()
class StatHandler:
def __init__(self, bot):
self.bot = bot
self.has_started = 0
async def postloop(self):
if not self.has_started == 1:
self.has_started = 1
... | harumaki4649/nekobot | modules/unused/stat_handler.py | stat_handler.py | py | 3,136 | python | en | code | 0 | github-code | 36 |
5547014999 | """
Voting 12/05/2023.
Lido V2 (Shapella-ready) protocol upgrade
1. Update `WithdrawalVault` proxy implementation
2. Call `ShapellaUpgradeTemplate.startUpgrade()`
3. Publish new `Lido` implementation in Lido app APM repo
4. Update `Lido` implementation
5. Publish new `NodeOperatorsRegistry` implementation in NodeOper... | lidofinance/scripts | archive/scripts/upgrade_shapella.py | upgrade_shapella.py | py | 12,033 | python | en | code | 14 | github-code | 36 |
38214358765 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 19 3:15 2019
@author: deepnikajain
"""
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from astropy.table import Table
from penquins import Kowalski
from Coadding.keypairs import get_keypairs
DEFAULT_AUTHs = ge... | Deepnika/Assembling-lightcurves-SLSNe | query_kowalski.py | query_kowalski.py | py | 4,748 | python | en | code | 0 | github-code | 36 |
2201109453 | import numpy as np
import subprocess
import os
import sys
from Bio import SeqIO
from Bio import PDB
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.Polypeptide import PPBuilder
from joblib import Parallel, delayed
import multiprocessing as mp
import time
import re
from joblib import Parallel, delayed
import concur... | alschaap/master-thesis | scripts/energy_calc_pipeline.py | energy_calc_pipeline.py | py | 16,561 | python | en | code | 0 | github-code | 36 |
39838938631 | def get_square():
l1=[x**2 for x in range(0,21) if ((x%2 == 0) and (x%3 != 0 ))]
return l1
print(get_square())
def list_of_even_odds():
l1 = [x for x in range(0,21) if x%2 == 0]
l2 = [y for y in range(0,21) if y%2 != 0]
return [l1, l2]
print(list_of_even_odds())
# write an entire expression in a... | ronaldboodram/educative_python | full_speed_python/basic_data_type.py | basic_data_type.py | py | 1,807 | python | en | code | 0 | github-code | 36 |
1411710184 | import requests
class YaDisk:
base_url = 'https://cloud-api.yandex.net/v1/disk/'
def __init__(self, token):
self.token = token
def get_headers(self):
return {
'Content-Type': 'application/json',
'Authorization': f'OAuth {self.token}'
}
def create_fol... | kanadass/photo_backup_cw | ya_disk.py | ya_disk.py | py | 1,510 | python | en | code | 0 | github-code | 36 |
15905142289 | import random
import time
import tweepy
import pandas
import logging
from config import consumer_key, consumer_secret, access_token, access_token_secret
#Declare variables
timer = 10800 # three hours
df = pandas.read_csv('quotes.csv', delimiter='*')
index = df.index
number_of_rows = len(index)
logger = logging.getLog... | dannymccaslin/MotivatorBot | motivator.py | motivator.py | py | 2,587 | python | en | code | 0 | github-code | 36 |
12885361900 | """
problem 15
Starting in the top left corner of a grid and
moving only down and right, there are 6 routes to the bottom right corner.
How many routes are there through a 20x20 grid?
"""
def route_num(cube_size):
L = [1] * cube_size
for i in range(cube_size):
for j in range(i):
... | HunterJohnson/Interviews | project_euler/python/015.py | 015.py | py | 405 | python | en | code | 1 | github-code | 36 |
37298905972 | # -*- coding: utf-8 -*-
import json
import requests
def get_proxy():
response = requests.get('')
res = json.loads(response.text)
if res['code'] == 0:
try:
ip = res['data']['IP']
port = res['data']['PORT']
proxy = {}
proxy['http'] = ip+":"+port
... | LogicJake/bilibili_user | function.py | function.py | py | 393 | python | en | code | 1 | github-code | 36 |
72166511464 | # -*- coding: utf-8 -*-
from instrument import Instrument
import instruments
import numpy
import types
import logging
class virtual_period(Instrument):
'''
This is the driver to handle period.
'''
def __init__(self, name, pulser):
'''
Initialize the virtual instru... | QCoherence/python_drivers | virtual_period.py | virtual_period.py | py | 5,286 | python | en | code | 2 | github-code | 36 |
73497717544 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch, numpy as np, os
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers imp... | Aveygo/WordsAreWorth16x16Pixels | models/pacing_model.py | pacing_model.py | py | 8,183 | python | en | code | 3 | github-code | 36 |
18502054835 | kaas1 = input ("Is de kaas geel? ")
if kaas1 == "ja":
ask1 = input ("Zitten er gaten in? ")
if ask1 == "ja":
ask2 = input("Is de kaas belachelijk duur? ")
if ask2 == "ja":
print("Emmenthaler")
elif ask2 == "nee":
... | LaraMol/meten-is-weten | geneste/geneste.py | geneste.py | py | 1,128 | python | nl | code | 0 | github-code | 36 |
35062345982 | import turtle
import numpy as np
m = int(input())
turtle.shape('turtle')
turtle.penup()
turtle.forward(200)
turtle.pendown()
turtle.left(90)
def hcircle (n, r):
for i in range(n//2):
turtle.forward(2*np.pi*r/n)
turtle.left(360/n)
for i in range (m):
hcircle (100,50)
hcircle(50,10)
| sophiepistachio/MIPT_bestuzheva2020 | lesson2/lesson2#12.py | lesson2#12.py | py | 311 | python | en | code | 0 | github-code | 36 |
495133127 | from collections import namedtuple
from dagster import check
from dagster.core.definitions.logger import LoggerDefinition
from dagster.core.definitions.pipeline import PipelineDefinition
class InitLoggerContext(
namedtuple('InitLoggerContext', 'logger_config pipeline_def logger_def run_id')
):
'''Logger-spec... | helloworld/continuous-dagster | deploy/dagster_modules/dagster/dagster/core/execution/context/logger.py | logger.py | py | 1,419 | python | en | code | 2 | github-code | 36 |
17928724445 | import sys
import bleAdapter
from bleAdapter import bleAdapter
import time
import testutils
import dbus.mainloop.glib
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
# Config for enable/disable test case
ENABLE_TC_AFQP_SECONDARY_SERVICE = 0
class runTest:
mainloop = G... | aws/amazon-freertos | libraries/abstractions/ble_hal/test/ble_test_scipts/testClass.py | testClass.py | py | 36,737 | python | en | code | 2,543 | github-code | 36 |
75220902185 | from . import music
def change_key(sounds, diff):
"""Transpose all sounds a chosen number
of halftones up
Parameters:
sounds (list[Sound]) : Sounds to transpose
diff (int) : Chosen number of halftones
Returns:
(list[Sound]) : Transposed sounds
"""
sounds1 = []
for s in sounds... | JakubBilski/tonations-recognition | src/sounds_manipulation.py | sounds_manipulation.py | py | 483 | python | en | code | 1 | github-code | 36 |
37974946074 | day = 27
weight = 59.5
month = 'February'
library_is_open = False
if library_is_open:
print('Hurrayyy!!!')
print("it's Open")
else:
print(':(')
gold_rate = 4600
if gold_rate > 5000:
print("We cannot Buy it now")
else:
print("We're Buying!!!")
age = 16
if age >= 18:
print('Adult')
else:
print('Child'... | ShivaniKiran95/PythonPracticCode | Beginner/BooleansandIf.py | BooleansandIf.py | py | 322 | python | en | code | 0 | github-code | 36 |
15974641193 | # *-* coding: utf-8 *-*
"""
Created on mar 23 fév 2021 09:14:21 UTC
@author: vekemans
"""
import math as mt
import numpy as np
from math import pi as π
from numpy.fft import fft,fftshift,ifft
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import animation
nfig = 1
def dft(func, start,end,N, or... | abbarn/lmeca2300 | homeworks/fft3.py | fft3.py | py | 4,093 | python | en | code | 0 | github-code | 36 |
34342251813 | # import asyncio
import time
from evdev import InputDevice, categorize, ecodes
source_device = None
target_device = None
# Init dev reference
while source_device is None and target_device is None:
try:
source_device = InputDevice('/dev/input/event1')
target_device = InputDevice('/dev/hidg0')
except Except... | c4software/raspberry-pi-hid-proxy | sample.py | sample.py | py | 804 | python | en | code | 1 | github-code | 36 |
31187115675 | # #1. 분할 정복
# def bs(A, l, r, k):
# if l>r:
# return None
# m=(l+r)//2
# if A[m]>k:
# return bs(A, l, m-1, k)
# elif A[m] < k:
# return bs(A, m+1, r, k)
# else:
# return m
#A에 이중리스트로 주어진 값 저장
n, k = map(int, input().split()) #4, 16
A=[] #[[2, 5, 10, 19],[3, 8, 16, 19],[7, 20, 20, 32],[13, 25,... | Ha3To/2022_2nd | python_workspace/Divide_&_Conquer.py | Divide_&_Conquer.py | py | 4,148 | python | ko | code | 0 | github-code | 36 |
72448270504 | import numpy as np
import tensornetwork as tn
np_vec = np.array([[0], [1]])
tn_vec1 = tn.Node(np_vec)
tn_vec2 = tn.Node(np_vec)
# Contracting the first index gives matrix with 1 element
tn_outer = tn.contract(tn_vec1[0] ^ tn_vec2[0])
# Contracting the second index gives matrix
tn_outer1 = tn.contract(tn_vec1[1] ^ tn... | Zshan0/TensorSimulations | src/dummy/matrix.py | matrix.py | py | 953 | python | en | code | 0 | github-code | 36 |
44448619471 | from pathlib import Path
import sqlite3
from datetime import datetime
from pymongo import ASCENDING
import pandas as pd
from utils.many_utils import PATH, get_collection
def inserisci_scadenza(
st,
nome,
data_scadenza,
dettagli,
importo,
stato,
categoria,
frequenza,
notifiche=Fal... | piopy/solexiv | src/logica_applicativa/Scadenze.py | Scadenze.py | py | 6,066 | python | it | code | 0 | github-code | 36 |
6267092868 | # -*- coding: utf-8 -*-
import scrapy
import re
import datetime
from scrapy.http import Request
from urllib import parse
from ..items import JobBoleArticleItem
from ..utils.common import get_md5
class JobboleSpider(scrapy.Spider):
name = 'jobbole'
allowed_domains = ['blog.jobbole.com']
start_urls = ['htt... | jasonxu510/scrapypro | ArticleSpider/ArticleSpider/spiders/jobbole.py | jobbole.py | py | 3,319 | python | en | code | 0 | github-code | 36 |
35520934329 | # 숫자 맞추기 게임
import random
com = random.randint(1, 10)
cnt = 0
while True :
cnt += 1
user = int(input('1부터 10까지의 숫자를 입력하세요. >> '))
if user == com :
print(f'정답! {cnt}번 만에 맞췄습니다!')
break
else :
print('오답! 다시 시도해보세요.')
# 숫자 찍기
for i in range(1, 6) :
print(str(i) * 5)
for i in... | DahyeonS/Java_Python_Lecture | 20231130/python_ex.py | python_ex.py | py | 2,599 | python | en | code | 0 | github-code | 36 |
71859082343 | import logging
import os
from io import StringIO
import boto3
import pandas as pd
from botocore.exceptions import ClientError
AWS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID")
AWS_SECRET = os.environ.get("AWS_SECRET_ACCESS_KEY")
bucket = "kiwi-bot"
# key = "ordersDB.csv"
prefix = "data/"
filename = "https... | edward0rtiz/clustering-demand-scm | lib/data_engine/s3_get_object.py | s3_get_object.py | py | 717 | python | en | code | 0 | github-code | 36 |
4628312590 | #
# Title:pid_lock.py
# Description:ensure only a single instance runs
# Development Environment:OS X 10.15.5/Python 3.7.6
# Author:G.S. Cole (guycole at gmail dot com)
#
import os
class PidLock:
def lock_test(self, file_name: str) -> bool:
"""
return True if active lock noted
"""
... | guycole/mellow-elephant | src/pid_lock.py | pid_lock.py | py | 1,502 | python | en | code | 2 | github-code | 36 |
70183485543 | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
from decouple import config
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'senda.settings')
enviroment = config("ENVIROMENT")
if enviroment == "stag... | UNPSJB/SendaAlquiler | backend/manage.py | manage.py | py | 1,129 | python | en | code | 1 | github-code | 36 |
35849079519 | import tkinter as tk
from tkinter import ttk
import s_probe
class Treev(ttk.Treeview):
def __init__(self, master = None):
self.master = master
self.tree = ttk.Treeview(master, columns=('val', 'max'), height=30, padding=[2,2])
try:
# initiate sProbe static class, decide windows ... | jmerc141/batterypy | tree.py | tree.py | py | 12,087 | python | en | code | 0 | github-code | 36 |
25282880574 | import entrypoints
import mimetypes
def open(*args, **kwargs):
"""
Dispatch to a compatible PIMS reader.
"""
# Dispatch using the first argument which is assumed to be a file buffer,
# filename, or filename glob.
reader = _dispatch(args[0])
return reader(*args, **kwargs)
def _dispatch(fi... | danielballan/pims2-prototype | pims/__init__.py | __init__.py | py | 1,750 | python | en | code | 1 | github-code | 36 |
3763224892 | import cv2 as cv
import pandas as pd
df = pd.read_csv("Set03_video01.csv")
cam = cv.VideoCapture("Set03_video01.h264")
frame = 0
# initBB = (int(df.iloc[0]['x']),int(df.iloc[0]['y']),int(df.iloc[0]['w']),int(df.iloc[0]['h']))
# tracker = cv.TrackerCSRT_create()
# tracking = False
# while True:
# _ret, img = cam.re... | aaravpandya/optic_flow | tracker.py | tracker.py | py | 2,532 | python | en | code | 0 | github-code | 36 |
14575147176 | from collections import defaultdict
from sys import stdin
def rec(graph, v, visited, visited2):
if v == 'end':
return 1
if v.islower():
if v not in visited:
visited.add(v)
else:
visited2.add(v)
res = 0
for to in graph[v]:
if not to.islower() or... | vfolunin/archives-solutions | Advent of Code/2021/12.2.py | 12.2.py | py | 758 | python | en | code | 0 | github-code | 36 |
12730428499 | """
The main, core program. A CLI program.
For now: whilst this is just a CLI program, you must edit any key settings with the file:
C:\Potts' Software\Fortnite Exploit\fe-sett.ini
Changing this file is permitted, I'm not the best at efficient programming. Work away.
Written by Elliot Potts,
https://w... | vbuckgartuit/Fornite-Parachute-Exploit | cli/main.py | main.py | py | 5,224 | python | en | code | 1 | github-code | 36 |
570245906 | import logging
import math
from .geomsmesh import geompy
from .triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
def ellipsoideDefaut(minRad,allonge):
"""Le bloc contenant la fissure est un ellipsoide construit centre a l'origine,
contenant le tore elliptique de fissure
@param minRad :petit rayon
... | luzpaz/occ-smesh | src/Tools/blocFissure/gmu/ellipsoideDefaut.py | ellipsoideDefaut.py | py | 1,044 | python | en | code | 2 | github-code | 36 |
14017935134 | '''
this module makes helix curve
'''
import math
import maya.cmds as cmds
def helix(radius, pitch, sr, sp, ncvs,*args):
'''
create helix curve
'''
deg = 3
spas = ncvs - deg
knots = ncvs + deg -1
points = []
points.append((radius, 0, 0.5))
#cmds.joint(p=(0,0,0))
d = 1
fo... | s-nako/MayaPythonTools | ModelingTools/curves/do_helix.py | do_helix.py | py | 1,471 | python | en | code | 0 | github-code | 36 |
41416155472 | from Domain.cheltuiala import getSuma, getTip
def celeMaiMariCheltuieli(lista):
'''
Determina cele mai mari cheltuieli pentru fiecare tip de cheltuiala.
:param lista: lista de cheltuieli
:return: cele mai mari cheltuieli pentru fiecare tip de cheltuiala
'''
rezultat = {}
for cheltuiala in ... | AP-MI-2021/lab-567-ZarnescuBogdan | Logic/functionalitate3.py | functionalitate3.py | py | 564 | python | ro | code | 0 | github-code | 36 |
74552235943 | import json
import datetime, time
import itertools
import pyverdict
import decimal
import os
import multiprocessing
from multiprocessing import Queue
from common import util
import pandas as pd
import numpy as np
import queue
import threading
from threading import Thread
#logger = logging.getLogger("idebench")
class I... | leibatt/crossfilter-benchmark-public | drivers/verdictdb.py | verdictdb.py | py | 7,794 | python | en | code | 3 | github-code | 36 |
1417006794 | """
A simple text-based adventure game called: Maze Trap
try and find the key and reach to the exit
you may need tools like a torch
Available commands include:
go <compass direction>
take <object>
drop <object>
inventory
quit
"""
# current location: hallway, lounge or bedroom
state = "maze"
# t... | Kaizuu08/PythonShowcase2023Semester1 | Week 7/text_game_multiple.py | text_game_multiple.py | py | 7,522 | python | en | code | 0 | github-code | 36 |
42917266933 | from apps.horizons import Horizons
hztn = Horizons()
def test_connect():
""" Test connection to the JPL telnet service """
assert None == hztn.tn
hztn.connect()
assert None != hztn.tn
def test_bodies_list():
""" Test the get bodies and JPL ID lists methods """
barycenters = hztn.get_barycent... | nlantoing/Astrarium | tests/apps/test_horizons.py | test_horizons.py | py | 1,088 | python | en | code | 0 | github-code | 36 |
28068259902 | # 나이순 정렬
# https://www.acmicpc.net/problem/10814
def solution() :
n = int(input())
member_list = []
for i in range(n) :
age, name = input().split()
age = int(age)
member_list.append([i, age, name])
sorted_list = sorted(member_list, key = lambda x : (x[1], x[0]))
for i i... | hwanginbeom/algorithm_study | 1.algorithm_question/8.Sort/152.Sorting_wooseok.py | 152.Sorting_wooseok.py | py | 385 | python | en | code | 3 | github-code | 36 |
27787353861 | #v.2.0.0
import json, os, time
import resources.config_server as config
from resources.lib.xlogger import Logger
from resources.lib.blasters import *
from resources.lib.websocket_server import WebsocketServer
class Main:
def __init__( self, thepath ):
"""Start IguanaIR Blaster Server."""
self.RO... | pkscout/iguana-blaster | resources/lib/server.py | server.py | py | 2,443 | python | en | code | 0 | github-code | 36 |
32751323841 | from raspberry_pi.adapter import Adapter
from raspberry_pi.human_sensor import HumanSensor
from raspberry_pi.humidity_sensor import HumiditySensor
from raspberry_pi.target import Target
from raspberry_pi.temperature_sensor import TemperatureSensor
import json
# 根据不同的key,获取需要被适配的类
def get_adaptee_class(key):
adapte... | qihonggang/leetcode | python_code/raspberry_pi/main.py | main.py | py | 902 | python | en | code | 1 | github-code | 36 |
40729675478 | from typing import Dict, List, Optional
from fuzzly.models.post import PostId, PostIdValidator
from fuzzly.models.tag import TagGroupPortable
from fuzzly.models.user import UserPortable
from pydantic import BaseModel
class LookupRequest(BaseModel) :
tag: Optional[str]
class TagsRequest(BaseModel) :
_post_id_conv... | kheina-com/tagger | models.py | models.py | py | 1,142 | python | en | code | 0 | github-code | 36 |
17895710010 | r"""Train toy segmenter model on cityscapes.
"""
# pylint: enable=line-too-long
import ml_collections
batch_size = 128
_CITYSCAPES_TRAIN_SIZE_SPLIT = 146
# Model spec.
STRIDE = 4
mlp_dim = 2
num_heads = 1
num_layers = 1
hidden_size = 1
target_size = (128, 128)
def get_config(runlocal=''):
"""Returns the config... | google/uncertainty-baselines | experimental/robust_segvit/configs/cityscapes/toy_model.py | toy_model.py | py | 3,338 | python | en | code | 1,305 | github-code | 36 |
16725608494 | #!/usr/bin/env python
import cPickle
import fasttext
import numpy as np
import os
import sys
from mlfutil import CharEncoder, draw_progress
data_file = sys.argv[1]
cencoder = CharEncoder()
def title_encoding(title):
chars = []
for char in title.decode('utf8'):
idx = cencoder.cat2idx(char)
... | kn45/tf-models | rnn_regressor/3_Feature.py | 3_Feature.py | py | 1,063 | python | en | code | 0 | github-code | 36 |
27360781667 | from struct import unpack
from numpy import zeros, uint8, ravel
def imagefeatures_and_labels (datatype):
input_data = ''
input_labels = ''
if(datatype == 'train'):
input_data = open('train-images.idx3-ubyte', 'rb')
input_labels = open('train-labels.idx1-ubyte', 'rb')
if(datatype =... | OzgeAkin/MachineLearningPraktikum | week1/datasetpreparation.py | datasetpreparation.py | py | 1,533 | python | en | code | 0 | github-code | 36 |
30775454289 | def main():
mayores:list[str] = []
nombre:str
edad:int
for i in range(10):
edad = int(input(f"Ingrese la edad del alumno {i+1}: "))
nombre = input("Ingrese su nombre: ")
if edad >= 18: mayores.append(nombre)
print(mayores)
if __... | GermanMorini/Programacion1 | GTP2/gtp8.py | gtp8.py | py | 357 | python | es | code | 1 | github-code | 36 |
33517425176 | #from typing_extensions import runtime
from manim import *
#####################################################################################
###################### Norma inducida y bases ortonormales ########################
#####################################################################################... | animathica/alganim | 2/NIyBO_E4.py | NIyBO_E4.py | py | 21,964 | python | en | code | 6 | github-code | 36 |
15056294029 | import os
import sqlite3
import subprocess as sp
import sys
from pathlib import Path
db_path = Path(Path.home() / '.mypycheck.sqlite3')
def _create_files_table(con: sqlite3.Connection) -> None:
con.execute('''CREATE TABLE IF NOT EXISTS files (
id INTEGER PRIMARY KEY,
name ... | dlsloan/mypycheck | src/mypycheck/__init__.py | __init__.py | py | 2,041 | python | en | code | 0 | github-code | 36 |
2403591134 | import time
import pygame
from pygame.locals import *
import random
from os import environ
# Class for creating a window structure for the simulation
class WindowStructure:
def __init__(self, win_pos=(0, 0), state=0):
self.y_origin, self.x_origin = win_pos
self.state = state
# Me... | Time2bImmortal/Heart_of_the_swarm | Simulator_ver_02/VirtualSimulation.py | VirtualSimulation.py | py | 11,078 | python | en | code | 0 | github-code | 36 |
20981029783 | """
Created on Mon Feb 10 03:29:54 2020
@author: Luthfi (lsaif.github.com)
"""
from flask import Flask, render_template, request
import csv
import re
with open('litho_dict.csv', newline='') as infile:
reader = csv.reader(infile)
next(reader)
litholist = dict(reader)
def translate(desc,transdict):
... | luthfigeo/MudLog-Translator | MudLogTranslator.py | MudLogTranslator.py | py | 1,117 | python | en | code | 3 | github-code | 36 |
35356970921 | def BiggerGreater(line: str) -> str:
magic = list(line)
for i, char in enumerate(magic[::-1]):
index = find_index_with_value_less_than_the_current(magic[:len(magic) - 1 - i], char)
if index is not None:
magic[len(magic) - 1 - i], magic[index] = magic[index], magic[len(magic) - 1 - i]... | vladkostikov/HSP | entrance/bigger_greater.py | bigger_greater.py | py | 648 | python | en | code | 0 | github-code | 36 |
29290630775 | #!/usr/bin/env python
"""
Given the name of an ACS association, create the DAG for processing it (meaning
running CALACS on each exposure of the visit and multidrizzle on the total
output of CALACS) and submit it to the grid.
Variables used by the job/workflow templates are
code_root path to the root of... | fpierfed/owl | example/acs_simple/bin/process_acs_simple.py | process_acs_simple.py | py | 6,869 | python | en | code | 5 | github-code | 36 |
10094330881 | from filters.filter import FilterReplicator
class TopkFilter(FilterReplicator):
def __init__(self, input_workers, config):
super(TopkFilter, self).__init__(
"shot_result=SCORED",
"filter-topk",
input_workers,
c... | PatricioIribarneCatella/nba-statistics | src/filters/topk.py | topk.py | py | 402 | python | en | code | 0 | github-code | 36 |
11504622560 | """
This module contains the Distribution class which defines a standard
interface for distributions It also provides several implemented
distributions, which inherit from Distribution Any user-specified
distributions should inherit from Distribution
"""
import numpy as np
from .utils import overrides, package_path... | rueberger/MJHMC | mjhmc/misc/distributions.py | distributions.py | py | 16,295 | python | en | code | 24 | github-code | 36 |
7135815082 | # -*- coding: utf-8 -*-
# ***************************************************
# * File : main.py
# * Author : Zhefeng Wang
# * Email : wangzhefengr@163.com
# * Date : 2023-04-11
# * Version : 0.1.041123
# * Description : description
# * Link : link
# * Requirement : 相关模块版本需求(例如: nu... | wangzhefeng/tsproj | models/todo/FeedForwardNetwork.py | FeedForwardNetwork.py | py | 4,869 | python | en | code | 0 | github-code | 36 |
74694208105 | '''
select_subhalos
library of functions for selecting subhalos (for purpose of cw reconstruction) and padding
set of positions in periodic cube (to counteract disperse's problems with boundary conds.)
Chris J Duckworth cduckastro@gmail.com
'''
import numpy as np
import groupcat as gc
def return_stel_tracers(bas... | Chris-Duckworth/disperse_TNG | lib/select_subhalos.py | select_subhalos.py | py | 1,858 | python | en | code | 3 | github-code | 36 |
18394694315 | import os
import numpy as np
import pytest
from numpy.testing import assert_array_equal
import tiledb
def test_schema_evolution(tmp_path):
ctx = tiledb.default_ctx()
se = tiledb.ArraySchemaEvolution(ctx)
uri = str(tmp_path)
attrs = [
tiledb.Attr(name="a1", dtype=np.float64),
tiledb... | TileDB-Inc/TileDB-Py | tiledb/tests/test_schema_evolution.py | test_schema_evolution.py | py | 6,667 | python | en | code | 165 | github-code | 36 |
8594392164 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Scripts to plot Figure 2, co-occurrence and spearman rho for top 1000 videos in terms of views and watch times.
Usage: python plot_intersection_spearman_top1000.py
Time: ~2M
"""
from __future__ import division, print_function
import os
from scipy import stats
import ... | avalanchesiqi/yt-longevity | engagement_plots/plot_intersection_spearman_top1000.py | plot_intersection_spearman_top1000.py | py | 5,027 | python | en | code | 2 | github-code | 36 |
3419488617 | from spectractor import parameters
from spectractor.config import set_logger
import matplotlib.pyplot as plt
import pandas as pd
import os
import numpy as np
class LogBook:
"""Class to load_image and analyse observation logbook csv files."""
def __init__(self, logbook="./tests/data/ctiofulllogbook_jun2017_v... | LSSTDESC/Spectractor | spectractor/logbook.py | logbook.py | py | 5,793 | python | en | code | 13 | github-code | 36 |
7426499074 | from maltego_trx.transform import DiscoverableTransform
from db import db
from utils import row_dict_to_conversation_email
class DomainToEnronUsers(DiscoverableTransform):
"""
Given a maltego.Domain Entity, return a list of Users for this Domain.
"""
@classmethod
def create_entities(cls, request... | crest42/enron | transforms/DomainToEnronUsers.py | DomainToEnronUsers.py | py | 528 | python | en | code | 0 | github-code | 36 |
32793914547 | import torch
import torch.nn as nn
from conf import device
class Encoder(nn.Module):
def __init__(self, vocab_size, hidden_size=256):
super(Encoder, self).__init__()
self.hidden_size = hidden_size
self.embedding = nn.Embedding(vocab_size, hidden_size)
self.gru = nn.GRU(hidden_size,... | junix/gen_poem | encoder.py | encoder.py | py | 622 | python | en | code | 0 | github-code | 36 |
6790152771 | import csv
from datetime import datetime
from django.conf import settings
from django.core.management import BaseCommand
from exo_accounts.models import EmailAddress
from exo_certification.tasks import HubspotCertificationDealSyncTask
from ...models import ExOCertification, CertificationRequest
class Command(BaseC... | tomasgarzon/exo-services | service-exo-core/exo_certification/management/commands/generate_certification_requests_free_coaches.py | generate_certification_requests_free_coaches.py | py | 2,647 | python | en | code | 0 | github-code | 36 |
41831305861 | from typing import Optional
from cartes import COEUR, COULEURS, CarteBelote, CarteSetBelote, Couleur, Pli
class Annonce:
VALID_SCORES = list(range(80, 170, 10)) + [0, 1000, 2000]
def __init__(self, atout, score_a_faire, joueur):
if int(score_a_faire) not in self.VALID_SCORES:
raise Value... | slim0/pyContree | joueurs.py | joueurs.py | py | 6,836 | python | fr | code | 0 | github-code | 36 |
40155422506 | import os, sys, time, datetime
# Additional packages
import numpy as np
# ARL Env
from dVRK.PSM_cartesian_ddpg_env import PSMCartesianDDPGEnv
# Stable baselines algorithms
from stable_baselines.ddpg.policies import MlpPolicy
from stable_baselines import HER, DDPG
from stable_baselines.common.noise import NormalActio... | WPI-AIM/ambf_rl | scripts/dVRK/PSM_cartesian_ddpg_algorithm.py | PSM_cartesian_ddpg_algorithm.py | py | 4,942 | python | en | code | 8 | github-code | 36 |
37313862527 | # Control flow allows you to build logic into your programs
# Your program can run block of code based on a given condition
phone_balance = 3
bank_balance = 0
if phone_balance < 5:
phone_balance += 10
bank_balance -= 10
season = ''
# Example of if, elif and else statements
if season == 'spring':
print('pla... | e87/ai_nanodegree | intro_to_python/control_flow/control_flow_operators.py | control_flow_operators.py | py | 1,798 | python | en | code | 0 | github-code | 36 |
36728435043 | def isprime(n):
for i in range(2,n):
if(n%i==0):
return False
else:
return True
def difference(n):
if(n==0):
return 0
elif(n==1):
return 1
elif(isprime(n)):
return 0
a=0
b=0
n1=n+1
while(True):
if(isprime(n1)):
a... | 21A91A05B8/codemind-python | Minimum_absolute_difference_of_a_number_and_its_closest_prime.py | Minimum_absolute_difference_of_a_number_and_its_closest_prime.py | py | 585 | python | en | code | 0 | github-code | 36 |
21678597993 |
# You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.
# Example 1:
# coins = [1, 2, 5], amount = 11
# return... | WangsirCode/leetcode | Python/coin-change.py | coin-change.py | py | 1,029 | python | en | code | 0 | github-code | 36 |
4833395496 | import os
import torch
import genova
from torch import nn, optim
import torch.distributed as dist
from torch.utils.data import DataLoader
from torch.cuda.amp import autocast, GradScaler
from torch.nn.parallel import DistributedDataParallel as DDP
from .optimal_path_inference import optimal_path_infer
from .seq_generat... | AmadeusloveIris/GraphNovo | genova/task/task.py | task.py | py | 10,916 | python | en | code | 6 | github-code | 36 |
506538640 | """
Projections in SQL
"""
def sql_proj(dbname, tbl, otbl, oepsg, cols=None, geomCol=None,
newGeom=None, whr=None, new_pk=None):
"""
Reproject geometric layer to another spatial reference system (srs)
"""
from glass.pys import obj_to_lst
from glass.sql.q import q_to_ntbl
geomCol = 'g... | jasp382/glass | glass/prj/sql.py | sql.py | py | 1,106 | python | en | code | 2 | github-code | 36 |
42210310728 | # 管理员登录session键名
SESSION_LOGIN = "SESSION_LOGIN"
# 用户头像地址
SESSION_HEAD_PORTRAIT = "SESSION_HEAD_PORTRAIT"
# 登录账号
SESSION_USER_ID = 'session_user_id'
# 用户是否为开发者
SESSION_IS_DEVELOPER = "SESSION_IS_DEVELOPER"
# 用户类型
SESSION_USER_TYPE = "SESSION_USER_TYPE"
# 登录重定向uri
SESSION_REDIRECT_URI = "SESSION_REDIRECT_URI"
# 登... | 292887172/open | conf/sessionconf.py | sessionconf.py | py | 930 | python | zh | code | 0 | github-code | 36 |
20134586245 | # coding=utf-8
madlib_template = """I enjoy long, {0} walks on the beach, getting {1} in the rain and serendipitous encounters with {2}.
I really like pina coladas mixed with {3}, and romantic, candle-lit {4}.
I am looking for {5} and beauty in the form of a {6} goddess.
I would prefer if she knew how to cook, clean, ... | DavidColson/SimuLab-Lessons | Intro3_RockPaperScissors/MadlibFunctions.py | MadlibFunctions.py | py | 899 | python | en | code | 0 | github-code | 36 |
6320198920 | import pathlib2
import os
import wx
from option_loader import OptHandle
class EditFrame(wx.Frame):
def __init__(self, opt_instance:OptHandle):
super().__init__(parent = None, title="Edit Panel")
self.opt_handle = opt_instance
self.setup_panel()
self.SetSize(0, 0, 500, 750)
... | Nickiel12/Church-Programs | WX-StreamController/edit_gui.py | edit_gui.py | py | 2,034 | python | en | code | 0 | github-code | 36 |
6044172734 | from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse_lazy
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from . import views
from models import Entry
urlpatterns = patterns(
'',
url(r'^(?P<slug>\S+)/copy/$', views.copy_blog, name='blog_copy'),
url... | lowmanb/cs3240-f14-team01 | blog/urls.py | urls.py | py | 2,245 | python | en | code | 0 | github-code | 36 |
28299898397 | from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import os
import random
import matplotlib.pyplot as plt
from PIL import Image
import torch
from torchvision.models import resnet18, ResNet18_Weights
import torch.nn as nn
import numpy as np
class Mydata(Dataset):
def __init__(self... | kienptitit/Dog_Cat_Classification | train.py | train.py | py | 6,096 | python | en | code | 0 | github-code | 36 |
36837923429 | from __future__ import annotations
from dataclasses import dataclass
import bson.json_util as json
__all__ = ['Node', 'build_execution_tree']
@dataclass
class Node:
"""Represent SBE tree node."""
stage: str
plan_node_id: int
total_execution_time: int
n_returned: int
n_processed: int
chil... | mongodb/mongo | buildscripts/cost_model/execution_tree.py | execution_tree.py | py | 5,185 | python | en | code | 24,670 | github-code | 36 |
1151371916 | import json
from pprint import pprint
with open('rpPurchases.json') as f:
data = json.load(f)
l = []
for idx in data:
l.append((idx["amount"],idx["paymentType"]))
rp = 0
for a in l:
rp += a[0]
print(rp)
| kickass9797/Testing | rand/omg.py | omg.py | py | 239 | python | en | code | 0 | github-code | 36 |
22353446265 | from typing import List, Tuple, Union
import lightgbm as lgb
import numpy as np
import pandas as pd
import mlrun.errors
from .._ml_common import AlgorithmFunctionality, MLTypes, MLUtils
class LGBMTypes(MLTypes):
"""
Typing hints for the LightGBM framework.
"""
# A union of all LightGBM model base ... | mlrun/mlrun | mlrun/frameworks/lgbm/utils.py | utils.py | py | 7,707 | python | en | code | 1,129 | github-code | 36 |
36081264181 | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
a = 2
#b = 1
def plotter(b):
func = lambda x : a - b*x - np.exp(-x)
guess = a/b
max_x = fsolve(func, guess)
x = np.arange(0.0, max_x*1.05, 0.01)
y1 = a - b*x
y2 = np.exp(-x)
y3 = y1 - y2
null = 0*x
plt.figure()
plt.fill_bet... | chrberrig/SEIR_age_diff | programming/sir_dynsys.py | sir_dynsys.py | py | 1,555 | python | en | code | 0 | github-code | 36 |
27097993038 | import logging
class CustomFormatter(logging.Formatter):
"""Logging Formatter to add colors and count warning / errors"""
cyan = "\u001b[36m"
green = "\u001b[32m"
yellow = "\u001b[33m"
red = "\u001b[35m"
bold_red = "\u001b[31m"
reset = "\u001b[0m"
debug_format = "%(asctime)s... | Beatson-Institute-Digital-Pathology/reinhard-wsi-normalisation | reinhard_wsi/logging.py | logging.py | py | 1,711 | python | en | code | 2 | github-code | 36 |
8589141283 | from forum.models import Post, Comment
from django import forms
from tinymce.widgets import TinyMCE
class PostForm(forms.ModelForm):
class Meta:
model = Post
exclude = ['author', 'slug', 'course']
title = forms.CharField(
label='Title',
max_length=50,
widget=forms.Text... | rafidirg/forum-saas-kowan | forum/forms.py | forms.py | py | 689 | python | en | code | 0 | github-code | 36 |
73192051625 | import argparse
import os
from distutils.util import strtobool
import random
import time
import numpy as np
import torch
import gym
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
import torch.optim as optim
from stable_baselines3.common.buffers import ReplayBuff... | ChufanSuki/cfrl | examples/c51.py | c51.py | py | 12,157 | python | en | code | 0 | github-code | 36 |
4654671965 | #!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
from utilities import functional_annotation
from utilities import toGFF3
from utilities import clustering
from utilities import mapping
from utilities import mergeAll_to_gff
def main():
parser = argparse.ArgumentParser()
parser.add_ar... | compgenomics2019/Team1-FunctionalAnnotation | FA_pipeline_final.py | FA_pipeline_final.py | py | 5,822 | python | en | code | 0 | github-code | 36 |
71778077224 | import xml.etree.ElementTree as Tree
import unittest
import os
# Clear Screen
def clear_screen():
if os.name == 'posix': # Linux
os.system('clear')
elif os.name in ('nt', 'dos', 'ce'): # Windows
os.system('CLS')
class ETLTool:
# Constructor
def __init__(self):
self.tree = N... | rkaushik29/xml_etl | etl_tool.py | etl_tool.py | py | 5,037 | python | en | code | 0 | github-code | 36 |
26610403483 | import pandas as pd
from simulation_model.create_params_grid import default_params, path_experiment_table
from utilities.small_functions import mkDir_if_not
import os
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from simulation_model.gather_results import bilinear_name
def get_results_expe... | paolamalsot/optirank | simulation_model/plot_results.py | plot_results.py | py | 5,116 | python | en | code | 0 | github-code | 36 |
32232966229 | def lengthOfLIS(nums):
dp = [1]*len(nums)
for i in range(1,len(nums)):
longestSoFar = 1
for j in range(i):
if nums[i] > nums[j]:
longestSoFar = max(longestSoFar,1+dp[j])
dp[i] = longestSoFar
return max(dp)
nums = [10,9,2,5,3,7,101,18]
print(lengthOfLIS(nums))
| Gale6/leetcode--codes | lengthOfLIS.py | lengthOfLIS.py | py | 279 | python | en | code | 0 | github-code | 36 |
24682883982 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common import NoSuchElementException
from pages.utils import write_file
class BasePage:
def __init__(self,... | Flibustyer/TicketsBoard | pages/base.py | base.py | py | 3,434 | python | en | code | 0 | github-code | 36 |
36391585173 | from .method import get_json_ret, json_response_zh
class AuthMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request, *args, **kwargs):
if "application/json" in request.headers.get("Content-Type"):
import json
r... | CryptoCompetition2019-RNG/AuthServer | AuthServer/middleware.py | middleware.py | py | 1,435 | python | en | code | 0 | github-code | 36 |
11687518350 | import numpy as np
import matplotlib
#matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from skimage import data, img_as_float
from skimage.metrics import structural_similarity as ssim
from skimage.metrics import mean_squared_error
from skimage.transform import rescale, resize, downscale_local_mean
from skimage... | aditi741997/robotics_project | plot_nav2d_mapQuality.py | plot_nav2d_mapQuality.py | py | 2,399 | python | en | code | 1 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.