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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
44875572748 | from papaye.evolve.managers import load_model, context_from_root
@load_model('papaye.evolve.models.snapshot1')
def evolve(root, config=None):
context = context_from_root(root)
repository = context.get('repository', tuple())
for package_name in repository:
package = repository[package_name]
... | Tyarran/papaye | papaye/evolve/evolve4.py | evolve4.py | py | 883 | python | en | code | 10 | github-code | 13 |
34780355134 | # This file contains functions for inference phase
import numpy as np
import cv2
from .umeyama import umeyama
def get_tar_landmarks(img, landmarks_type=68):
"""
img: detected face image
"""
img_sz = img.shape
if landmarks_type == 68:
avg_landmarks = np.array(
[[0.3... | shaoanlu/fewshot-face-translation-GAN | utils/utils.py | utils.py | py | 11,851 | python | en | code | 789 | github-code | 13 |
37774946529 | import webapp2
import jinja2
import json
import os
import logging
from models.connexus_user import ConnexusUser
from models.stream import Stream
from google.appengine.api import urlfetch
from google.appengine.api import users
from google.appengine.ext import blobstore
templates_dir = os.path.normpath(os.path.dirname... | rayolanderos/UT-APT-MiniProject | webapp/controllers/view.py | view.py | py | 2,750 | python | en | code | 0 | github-code | 13 |
70175827538 | """
Node classification Task For Evaluation:
Full explanation for what is done can be found the survey file in our github page.
Code explanation:
For this task, one should have a labeled graph: 2 files are required: Graph edges in '.edgelist' or '.txt' format and
nodes' labels in '.txt' format. For labeled graphs examp... | kfirsalo/New-Graph-ZSL | node_classification.py | node_classification.py | py | 17,661 | python | en | code | 0 | github-code | 13 |
37099514326 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 3 20:26:44 2017
@author: alexander
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
import numpy as np
import tensorflow as tf
import ProcessData
from sklearn import model_s... | lonsas/SoundRecog | whistleCNN.py | whistleCNN.py | py | 4,821 | python | en | code | 0 | github-code | 13 |
28752939278 | # ===================================
# khai bao thu vien
from time import sleep
from urllib import request
from seeed_dht import DHT
# import random as rd
# khai bao thiet bi
# dht = DHT("11",18)
# khai bao channel
channel_ID = "2287342"
def post_http():
api_key = "G3LP8MEPQ6UCKYQS"
url = ... | QuangAnh6723/buoi6 | Buoi6/upload.py | upload.py | py | 715 | python | en | code | 0 | github-code | 13 |
24595732770 | import requests
from bs4 import BeautifulSoup
import spotipy
from spotipy.oauth2 import SpotifyOAuth
import os
import tkinter as tk
def action():
date_parse = e.get().split('/')
date_parse = f'{date_parse[2]}-{date_parse[1]}-{date_parse[0]}'
print(date_parse)
function(date_parse)
# ##### UI #####
wi... | epbfpm/TimeCapsuleJam | main.py | main.py | py | 2,440 | python | en | code | 0 | github-code | 13 |
7544659279 | # author: Nicolo
# few edits by Agnes
# -*- coding: utf-8 -*-
from __future__ import division
import redis
from math import log
import string
import re
from nltk.stem.snowball import SnowballStemmer
from math import log
stemmer = SnowballStemmer("dutch")
def removePunct(txt):
s = string.punctuation
s2 = re.esca... | clouizos/AIR | code_featureExtraction_all/LanguageModels.py | LanguageModels.py | py | 4,444 | python | en | code | 0 | github-code | 13 |
15236437102 | class BinarySearchTree:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def insert(self, data):
if data <= self.data:
if self.left is None:
self.left = BinarySearchTree(data)
else:
self.left.in... | nssathish/python-dsa | codewithmosh-dsa/DSAProblems/DS/BinaryTrees.py | BinaryTrees.py | py | 2,954 | python | en | code | 0 | github-code | 13 |
17146084433 | import setuptools
from dyepy import (
__name__, __author__, __email__, __github__, __version__, __desc__
)
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name=__name__,
version=__version__,
author=__author__,
author_email=__email__,
description=__desc__... | SFM61319/DyePy | setup.py | setup.py | py | 718 | python | en | code | 3 | github-code | 13 |
43850741822 | #!/usr/bin/env python
import argparse
import os
import imp
import contextlib
from uuid import uuid4
import warnings
import shutil
import subprocess
from six.moves import cStringIO as StringIO
try:
from pathlib import Path, PurePath
except ImportError:
from pathlib2 import Path, PurePath
_missing = object()
... | dillonhicks/versioned-protobufs | {{cookiecutter.project_name}}/python/bin/release.py | release.py | py | 10,293 | python | en | code | 0 | github-code | 13 |
12797403340 | import os
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
# This is intended to form a conglomearte of possible commands
# to open my applications on my Mac
d = "/Applications"
records = []
apps = os.listdir(d)
print(apps)
# goes through the list of apps I have on my Mac
# and matches ... | PhelimonSarpaning/AI-Voice-Assistant | commands.py | commands.py | py | 1,246 | python | en | code | 0 | github-code | 13 |
23741722144 | import pygame
import random
class Gem(pygame.sprite.Sprite):
def __init__(self,gem_event):
super().__init__()
self.image = pygame.image.load('assets/assets/gem-lebon.png')
self.image = pygame.transform.smoothscale(self.image,(50,70))
self.rect = self.image.get_rect()
self.v... | lutintmechant/BUSINESS_ADVENTURE | businessadventure-master/Gem.py | Gem.py | py | 1,801 | python | fr | code | 0 | github-code | 13 |
19335251974 | """testcube URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | tobyqin/testcube | testcube/urls.py | urls.py | py | 2,617 | python | en | code | 27 | github-code | 13 |
6761985034 | # Name: 2 Reclassify
# Description: Reclassify rasters as part of the Staging Site Selection Model
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy, os
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
# Define root directory and define geodatabase name
folde... | USEPA/Waste_Staging_Tool | ArcMap/Script/Reclassify.py | Reclassify.py | py | 2,352 | python | en | code | 2 | github-code | 13 |
42223743841 | # figures.py
import tkinter as tk
# Pt, Ln, Eq, Cn share
class Figure:
def __init__(self, root, idf, del_cbk, fig_text):
# root: tk.Frame # root frame to which append the Figure widgets
# idf: int # used when calling del_cbk
# del_cbk: void fn() # delete_callback, for the d... | papanumba/projec_p2 | python/figures.py | figures.py | py | 4,952 | python | en | code | 2 | github-code | 13 |
1177370095 | from tkinter import *
from cell import Cell
from settings import *
root = Tk()
root.geometry(f'{width}x{height}')
root.configure(bg='black')
root.title("Minesweeper")
root.resizable(False, False)
# Creating the frames
top_frame = Frame(
root,
bg='black',
width=width,
height=height/4... | alonshmueli123/Mindsweeper-Game | Minesweeper Game/main.py | main.py | py | 955 | python | en | code | 0 | github-code | 13 |
17109564906 | """
Useful functions associated with mlst.
To use:
from mlst.tools import UTIL1, UTIL2, etc...
"""
import json
from django.db import transaction
from django.db.utils import IntegrityError
from django.core.management.base import CommandError
from staphopia.utils import file_exists, read_json, timeit
from mlst.models... | staphopia/staphopia-web | mlst/tools.py | tools.py | py | 9,187 | python | en | code | 4 | github-code | 13 |
13168905790 | bl_info = {
"name": "Custom Camera",
"author": "Dave Nectariad Rome",
"version": (0, 3, 7),
"blender": (3, 50, 1),
"location": "View3D > Tool Shelf > Custom Camera Add-on",
"description": "Add a custom camera setup",
"warning": "",
"doc_url": "",
"category": "Object",
}
... | mdreece/Custom-Camera-Blender-Add-on | custom_camera.py | custom_camera.py | py | 22,426 | python | en | code | 4 | github-code | 13 |
26370279956 | import logging
from odoo import fields, models
_logger = logging.getLogger(__name__)
class CrmPartnerActionGroup(models.Model):
_name = "crm.partner.action.group"
_description = "Action Group"
name = fields.Char(string="Name of the Group", size=80, required=True)
model_id = fields.Many2one(
... | CITOpenRep/canna-erp-third-party | crm_partner_action/models/crm_partner_action_group.py | crm_partner_action_group.py | py | 802 | python | en | code | 9 | github-code | 13 |
9235259718 | import numpy as np
from pydicom.multival import MultiValue
# This function returns the data array values mapped to 0-256 using window/level parameters
# If provided it takes into account the DICOM flags:
# - Rescale Intercept http://dicomlookup.com/lookup.asp?sw=Tnumber&q=(0028,1052)
# - Rescale Slope http://dicomlook... | tsaiid/femh-dicom | app/dcmconv.py | dcmconv.py | py | 1,962 | python | en | code | 2 | github-code | 13 |
39659692228 | from models.discriminator import Discriminator
from models.generator import Generator, Generator_pert
import torch
import numpy as np
import argparse
import os
from scipy.io import wavfile
from pytorch_mfcc import MFCC
import models
from torch.autograd import Variable
def default_loader(path, sample_rate=16384):
f... | winterwindwang/SpeechAdvGan | test_gan.py | test_gan.py | py | 5,544 | python | en | code | 2 | github-code | 13 |
40240683808 | """
author:
Tomasz Sachanowski,
Aleksander Krzemiński
"""
from osobnik import Osobnik
import numpy as np
from random import sample
from random import random
class Populacja:
def __init__(self, lam, mi, pm, data=None):
"""
lam- liczba generowanych potomkow
mi- liczba osobnikow w k... | Tomaszsachanowski/PSZTY | populacja.py | populacja.py | py | 4,069 | python | pl | code | 0 | github-code | 13 |
34119244680 | # ============ PROBLEM 1 ============
print("ENTERING P. 1: Fibonacci Sequence")
_ = input("Press any key when ready to continue")
def fibs_below(n):
f1 = 0
f2 = 1
if (n < 1):
return
for x in range(0, n):
if(f2 <= n):
print(f2, end=" ")
next = f1 + f2
... | benhg/comp-physics | basic python/fib_seq.py | fib_seq.py | py | 520 | python | en | code | 0 | github-code | 13 |
25285150181 | from pylinal import Matrix, Vector
A = Matrix([
[-1, 0, 0],
[0, 1, 0],
[0, 0, 1]
])
v = Vector([3, -1, 2])
reflection = lambda x: A @ x
motion = lambda x: x + v
affine = lambda x: motion(reflection(x))
x = Vector([1, 1, 1])
assert affine(x) == A @ x + v
| PegasusHunter/pylinal | examples/affine.py | affine.py | py | 272 | python | en | code | 0 | github-code | 13 |
9985417220 | # -*- coding: utf-8 -*-
import sys
import protocol
def main(mds_addr, mds_port, study_state):
p = protocol.Protocol(mds_addr=mds_addr, mds_port=mds_port)
p.launch()
x = p.query1(study_state)
p.finish()
print("receive payload:")
print("{}".format(x))
if __name__ == '__main__':
argc = len... | abrance/mine | wait/autotest.2020.03.16/query1.py | query1.py | py | 670 | python | en | code | 0 | github-code | 13 |
39554190538 | import pandas as pd
import quandl, math, datetime
import numpy as np
from sklearn import preprocessing, cross_validation
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
import pickle # serialization - arrange something in a series
# regression - takes continous data and find best fit
... | lucyji12/Finance_ML | finance.py | finance.py | py | 4,011 | python | en | code | 0 | github-code | 13 |
70744588819 | entradas = int(input())
def fib(numero):
global calls
calls += 1
if numero <= 1:
return numero
else:
return fib(numero-1) + fib(numero-2)
for e in range(entradas):
n = int(input())
calls = 0
resultado = fib(n)
calls = 0 if n<= 1 else calls - 1
print(f"fib({n}) = {... | JoaoVMansur/uri_problems.py | 1029.py | 1029.py | py | 348 | python | pt | code | 0 | github-code | 13 |
17080736264 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.EcocheckYzPolicyCheckDetail import EcocheckYzPolicyCheckDetail
class AlipayCommerceLogisticsCheckPostpolicyQueryResponse(AlipayResponse):
def __init__(self):
... | alipay/alipay-sdk-python-all | alipay/aop/api/response/AlipayCommerceLogisticsCheckPostpolicyQueryResponse.py | AlipayCommerceLogisticsCheckPostpolicyQueryResponse.py | py | 1,747 | python | en | code | 241 | github-code | 13 |
42125916512 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import scipy.sparse as sp
from typing import List, Tuple, Union
from sklearn.metrics import roc_auc_score, roc_curve, average_precision_score, f1_score, accuracy_score
def get_stats(array):
mean = np.mean(np.asarray(array)... | Namkyeong/CGIB | DrugDrugInteraction/utils.py | utils.py | py | 4,412 | python | en | code | 29 | github-code | 13 |
12310454165 | from parsers import page_rank as prp, inv_index as iip
from typing import Dict, List
from firebase_admin import db
from uuid import uuid3
from tqdm import tqdm
import uuid
import json
import db_init
def poblate_pages_and_rank(pages: List, pages_ref: db.Reference,
ranks_ref: db.Re... | sharon1160/buscape | db_population.py | db_population.py | py | 2,016 | python | en | code | 1 | github-code | 13 |
7408106701 | import socket
import threading
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 55555))
nickname = input("Choose the nickname: ")
def recieve():
while True:
try:
message = client.recv(1024).decode('ascii')
if message == 'NICK':
... | PavelUdovichenko/test-projects | DINS/client.py | client.py | py | 908 | python | en | code | 0 | github-code | 13 |
14443279846 | from sklearn.feature_extraction import text
import numpy as np
import re, copy
from nltk.corpus import stopwords
## Import excel data of labels
from openpyxl import load_workbook
import numpy as np
## Global variables
heteronyms, vec, fratio, pi0, pi1 = [],[],[],[],[]
numWords = 10 # number of words to be collected f... | alex-parisi/Heteronymous-Ambiguity-Resolution | bayesian.py | bayesian.py | py | 11,873 | python | en | code | 2 | github-code | 13 |
42000202152 | #
# @lc app=leetcode.cn id=209 lang=python3
#
# [209] 长度最小的子数组
# 滑动窗口
# 1. 初始化
# 2. 左右窗口
# 3. sumx累加nums[end]
# 4. 两个判断合并 - 赋值操作及左窗口移动
# 5. 返回值, 需要考虑特殊情况 - 不存在符合条件的子数组时, 返回0
# Time: O(n), Space: O(1)
# @lc code=start
class Solution:
def minSubArrayLen(self, target: int, nums: List[int]) -> int:
import mat... | WeiS49/leetcode | Solution/哈希表 双指针/滑动窗口/209.长度最小的子数组.py | 209.长度最小的子数组.py | py | 1,351 | python | en | code | 0 | github-code | 13 |
74564806098 | #!/usr/bin/env python
"""
_SizeBased_t_
Size based splitting test.
"""
from builtins import range
import unittest
from WMCore.DataStructs.File import File
from WMCore.DataStructs.Fileset import Fileset
from WMCore.DataStructs.Job import Job
from WMCore.DataStructs.Subscription import Subscription
from WMCore.Data... | dmwm/WMCore | test/python/WMCore_t/JobSplitting_t/SizeBased_t.py | SizeBased_t.py | py | 5,925 | python | en | code | 44 | github-code | 13 |
5619245946 | from .base import BaseHandler
from src.plugins import get_server_info
import requests
import json
import os
from conf import settings
from lib.security import gen_key, encrypt
import time
class AgentHandler(BaseHandler):
def cmd(self, command):
import subprocess
ret = subprocess.get... | wkiii/CMDB-oldboy | auto_client2/src/engine/agent.py | agent.py | py | 1,573 | python | en | code | 0 | github-code | 13 |
8717133337 | '''
This program aims to get the same functionality as the one described
in the book Alfresco One 5.x Developer's guide
Author: Ignacio De Bonis
Date: 19 October 2021
'''
import cmislib
import base64
from cmislib.model import CmisClient
# user credentials
userName = 'admin'
userPass = 'admin'
# connection sett... | Mr-DeBonis/DevelopersGuide_AlfrescoOne | cmis/CmisClient.py | CmisClient.py | py | 3,560 | python | en | code | 1 | github-code | 13 |
34114335244 | from netqasm.logging.glob import get_netqasm_logger
from netqasm.runtime.application import default_app_instance
from netqasm.sdk import EPRSocket
from netqasm.sdk.external import NetQASMConnection, simulate_application
logger = get_netqasm_logger()
num = 10
def run_alice():
epr_socket = EPRSocket("bob")
wi... | QuTech-Delft/netqasm | tests/test_external/test_sdk/test_post_epr.py | test_post_epr.py | py | 1,503 | python | en | code | 17 | github-code | 13 |
18817717495 | """Импорты и переменные(константы)"""
from datetime import datetime
import requests
URL_LIST_OPERATIONS = 'https://s3.us-west-2.amazonaws.com/secure.notion-static.com/d22c7143-d55e-4f1d-aa98' \
'-e9b15e5e5efc/operations.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED' \
... | Javoprav/displays_list_5_operations | utils.py | utils.py | py | 3,452 | python | en | code | 1 | github-code | 13 |
30224146009 | # lotto
# 스크랩은 정보제공을
'''
요청을 해서 응답 받는 것은 h와 .. 같다. ###$$?
일반적인 웹페이지는 HTML. # 방금 받았던 파일들?
파이썬은 json을 글자(str)로만 인지할 것.
의미를 가진 dictionary로 만들어야 한다.
'''
from flask import Flask, render_template, request
import requests
import random
url = 'https://www.dhlottery.co.kr/common.do?method=getLottoNumber&drwNo=1'
#
# request... | haru77/SSAFY2 | day03/dynamic/lotto.py | lotto.py | py | 2,456 | python | ko | code | 0 | github-code | 13 |
10846728425 | import sys
input = sys.stdin.readline
num = int(input())
new_arr = []
for i in range(1000000):
sum = 0
arr = list(str(i))
sum += i
for j in arr:
sum += int(j)
if sum == num:
new_arr.append(i)
break
new_arr.sort()
if new_arr ==... | woorym/python | 백준/Bronze/2231. 분해합/분해합.py | 분해합.py | py | 370 | python | en | code | 0 | github-code | 13 |
72935272658 | from typing import List
import sys
sys.setrecursionlimit(10**5)
def solution(maps: List[str]) -> List[int]:
answer = []
H, W = len(maps), len(maps[0])
visit = [[False] * W for _ in range(H)]
def dfs(r, c):
if r in [-1, H] or c in [-1, W] or visit[r][c] or maps[r][c] == 'X':
return... | Zeka-0337/Problem-Solving | programmers/level_2/무인도여행.py | 무인도여행.py | py | 724 | python | en | code | 0 | github-code | 13 |
33823239581 | import itertools
from collections import ChainMap
from django.contrib.auth import get_user_model
from rest_framework.test import APITestCase
from courses.models import Course
from courses.services import Status, StatusMessage
from courses.tests.base import DatasetMixin, JWTAuthMixin
User = get_user_model()
class R... | StudioAquatan/Saffron | calyx/src/courses/tests/views/test_requirement_status_view.py | test_requirement_status_view.py | py | 3,757 | python | en | code | 0 | github-code | 13 |
38027480928 | from AthenaCommon.AppMgr import ServiceMgr
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc("THistSvc")
#ServiceMgr.THistSvc.Output = ["atlasTest DATAFILE='atlasTest.muons.histo.root' OPT='RECREATE'"];
ServiceMgr.THistSvc.Output = ["truth DATAFILE='RDO_truth.root' OPT='RECREATE'"];
from AthenaCommon... | rushioda/PIXELVALID_athena | athena/Simulation/Tests/DigitizationTests/share/postInclude.RDO_Plots.py | postInclude.RDO_Plots.py | py | 1,221 | python | en | code | 1 | github-code | 13 |
14274678716 | lx.eval("user.defNew scale float momentary")
#Set the label name for the popup we're going to call
lx.eval('user.def scale dialogname "Scale Factor"')
#Set the user names for the values that the users will see
lx.eval("user.def scale username {Scale Factor}")
#The '?' before the user.value call means we are calling ... | Tilapiatsu/modo-tila_customconfig | pp_toolkit/scripts/pp_scale_freeze.py | pp_scale_freeze.py | py | 1,707 | python | en | code | 2 | github-code | 13 |
7835351521 | from ipp import IPPPrinter
def imprimir_via_ipp(ip_impressora_windows, nome_impressora, mensagem):
try:
# Cria uma conexão com a impressora usando o endereço IP
ipp_printer = IPPPrinter("http://" + ip_impressora_windows + "/ipp/print")
# Define os atributos do trabalho de impressão
... | luis-fe/Automacao_WMS_InternoMPL | teste.py | teste.py | py | 1,045 | python | pt | code | 0 | github-code | 13 |
34995842968 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import mplfinance as mpf
import plotly.graph_objects as go
#Creating Dataframe for Historical Prices
dfForPiCycle = pd.read_csv('btcPriceHistory1.csv', index_col='Date', thousands=',', parse_dates=True)
dfForPiDate = pd.read_csv('btcPriceHistory1.c... | webclinic017/stockAnalyzer-2 | CryptoAnalysis/cryptoDataAnalysisTools/piCycleIndicator.py | piCycleIndicator.py | py | 2,912 | python | en | code | 1 | github-code | 13 |
74429541457 | import csv
import os
import re
from time import time, sleep
from datetime import timedelta
from urllib.request import urlopen
from urllib.error import HTTPError
from .helpers import write_csv as write_csv_
from .helpers import read_csv, get_env
from .config import api_parameters
class LoadAlphaVantage(object):
"""... | eenaveis/alpha_vantage_tools | alpha_vantage_tools/av_funcs.py | av_funcs.py | py | 9,124 | python | en | code | 2 | github-code | 13 |
38613403282 | import logging
import requests
import structlog
from flask import current_app
from application.exceptions import RasError, ServiceUnavailableException
log = structlog.wrap_logger(logging.getLogger(__name__))
def get_survey_details(survey_id):
"""
:param survey_id: The survey_id UUID to search with
:ret... | ONSdigital/ras-collection-instrument | application/controllers/service_helper.py | service_helper.py | py | 2,933 | python | en | code | 2 | github-code | 13 |
34182615617 | import geopandas as gpd
import matplotlib.pyplot as plt
import streamlit as st
import plotly.express as px
from streamlit_plotly_events import plotly_events # pip install streamlit-plotly-events
import random
#plotly events inside streamlit - https://github.com/null-jones/streamlit-plotly-events
# #st.set_page_config... | Sarang-Pramode/Vistara | pages/1_Download_Raw_Data.py | 1_Download_Raw_Data.py | py | 10,685 | python | en | code | 0 | github-code | 13 |
71808373778 | from vb2py.vbfunctions import *
# fromx vb2py.vbdebug import *
from vb2py.vbconstants import *
#import mlpyproggen.Prog_Generator as PG
import subprocess
""" M40_ShellAndWait:
~~~~~~~~~~~~~~~~~
Module Description:
~~~~~~~~~~~~~~~~~~~
This module provides a function to call external programs and wait for a certain... | haroldlinke/pyMobaLedLib | python/proggen/M40_ShellandWait.py | M40_ShellandWait.py | py | 10,195 | python | en | code | 3 | github-code | 13 |
69894389458 | #Assignment: Find Characters
# Write a program that takes a list of strings and a string containing a single character, and prints a new list of all the strings containing that character.
char = 'o'
word_list = ['hello','world','my','name','is','Anna']
def findwords(x):
matching = [s for s in x if "o" in s]
... | Jarvis2021/Coding-Dojo | python_stack1/algos/PracticeTest/test5.py | test5.py | py | 438 | python | en | code | 0 | github-code | 13 |
32213758882 | """seq2seq neural machine translation with one layer RNN."""
"""
I borrowed some code from PyTorch Tutorial
http://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html.
"""
import os
import sys
import time
import pickle
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch... | SnowIsWhite/Machine-Translation-in-PyTorch | vanila_rnn/vanila_rnn.py | vanila_rnn.py | py | 9,612 | python | en | code | 0 | github-code | 13 |
17696627813 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 10 16:52:56 2019
@author: vaish
"""
import math
n = int(input("Enter the number: "))
if n < 2:
print("A number should be greater than 2")
quit()
elif n == 2:
print("It's a Prime Number")
quit()
i = 2
limit = int(math.sqrt(n))
while i <= limit:
... | Vaishali1219/Python | EXAMPLES/03_CYCLES/15_Prime or Composite.py | 15_Prime or Composite.py | py | 433 | python | en | code | 0 | github-code | 13 |
73727287057 | from sac3 import llm_models
class Evaluate:
def __init__(self, model):
self.model = model
self.prompt_temp = 'Answer the following question:\n'
def self_evaluate(self, self_question, temperature, self_num):
'''
Inputs:
self_question - original user query
t... | intuit/sac3 | sac3/evaluator.py | evaluator.py | py | 2,350 | python | en | code | 1 | github-code | 13 |
13898818565 | class Biblioteka:
lista_ksiazek = []
lista_egzemplarzy = []
lista_krotek = []
lista_ostateczna = []
czy_jest_w_liscie = False
def __init__(self, limit_wypozyczen):
self.limit_wypozyczen = limit_wypozyczen
def sortuj(self, e):
return e['tytul']
def dostepne_egzemplarze(s... | uep-inz-opr/7_biblioteka1-klakalecka | main.py | main.py | py | 2,423 | python | pl | code | 0 | github-code | 13 |
40986545599 | import argparse
import os
import sys
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
from argoverse.evaluation.eval_forecasting import compute_forecasting_metrics
from argoverse.evaluation.competition_util import generate_forecasting_h5
from data.argoverse.argo_csv_dataset import ArgoCSVDat... | schmidt-ju/crat-pred | test.py | test.py | py | 2,425 | python | en | code | 47 | github-code | 13 |
40566378351 | print('place holder 실습')
import tensorflow as tf
_x = tf.placeholder(tf.float32, shape=[])
three = tf.constant(3)
four = tf.constant(4)
mul = tf.multiply(x, four)
add = tf.add(mul, three)
sess = tf.Session()
y = sess.run(add, feed_dict={_x:10})
print(y)
| ladofa/ky2018 | tensorflow_2.py | tensorflow_2.py | py | 261 | python | en | code | 0 | github-code | 13 |
11669580680 | import json
import boto3
import uuid
import requests
from requests.auth import HTTPBasicAuth
def put_openSearch(payload):
url = 'https://search-test-ed5firxe6hyd5qkuy63q72nvsu.us-east-1.es.amazonaws.com/events/_doc'
headers = {
'Content-Type': 'application/json'
}
req_payload= json.dumps(payload)... | JyothsnaKS/lions-meetup | app/stack/CreateEvents/lambda_function.py | lambda_function.py | py | 6,776 | python | en | code | 0 | github-code | 13 |
36333117285 | from collections import Counter
from itertools import combinations
def solution(orders, course):
answer = []
# sort order each element
for i in range(len(orders)):
orders[i] = ''.join(sorted(orders[i]))
# combination
# 모든 order에 대해 조합을 구하고, Counter로 같은 것들의 숫자를 센다
for c in course:
... | bywindow/Algorithm | src/BruteForce/프로그래머스_메뉴리뉴얼_Lv2.py | 프로그래머스_메뉴리뉴얼_Lv2.py | py | 889 | python | en | code | 0 | github-code | 13 |
9580687888 | import json
import csv
import boto3
import os
import uuid
s3 = boto3.resource('s3', aws_access_key_id=os.environ['ACCESS_KEY'],
aws_secret_access_key=os.environ['SECRET_KEY'])
def main(request):
FILEPATH = os.environ['FILEPATH']
S3_BUCKET_NAME = os.environ['S3_BUCKET_NAME']
fargs = re... | SWEEP-Inc/SWEEP-Workflows | demo-workflows/meadows-demo/tasks/end_wf/main.py | main.py | py | 1,795 | python | en | code | 0 | github-code | 13 |
34852673181 | from urllib import response
from flask import Flask, jsonify
import requests
import json
app = Flask(__name__)
@app.route("/", methods=['GET'])
def index():
url = f'https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/invoice#read-an-invoice'
response = requests.get(url)
... | najimpatel/Api_get_data | app.py | app.py | py | 596 | python | en | code | 0 | github-code | 13 |
14231622577 | import logging
from typing import Any, Dict, List, Optional, Tuple
from backend.common.cache import Cache, CacheEnum, CacheKeyPrefixEnum, cachedmethod
from backend.common.error_codes import error_codes
from backend.component import iam, resource_provider
from backend.service.models.resource import ResourceApproverAttr... | TencentBlueKing/bk-iam-saas | saas/backend/service/resource.py | resource.py | py | 13,159 | python | en | code | 24 | github-code | 13 |
26152058978 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test.py
# @Author : ()
# @Link :
# @Date : 2/13/2019, 1:47:06 PM
import sys
from PyQt5 import QtWidgets, uic
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, uiPath='', parent=None):
super(MainWindow, self).__init__(parent)
# PyQ... | IvanYangYangXi/pyqt_study | study/SimpleWin.py | SimpleWin.py | py | 692 | python | en | code | 0 | github-code | 13 |
74638060816 | import sys
input = sys.stdin.readline
n = int(input())
line = list(map(int, input().split()))
line.sort()
answer = 0
for i in range(n):
answer += sum(line[:i+1])
print(answer) | Coding-Test-Study-Group/Coding-Test-Study | kkkwp/baekjoon/11399_ATM.py | 11399_ATM.py | py | 183 | python | en | code | 4 | github-code | 13 |
8115213652 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re
from collections import namedtuple
from robofab.world import OpenFont
from fontTools.agl import AGL2UV
SMOOTH_THRESHOLD = 0.95
MySegment = namedtuple('MySegment', ('type', 'points', 'segment'))
if __name__ == "__main__":
path = sys.argv[1]
pa... | derwind/misc_scripts | smoothing.py | smoothing.py | py | 2,321 | python | en | code | 0 | github-code | 13 |
16472406213 | """
entrytool models.
"""
import datetime
from django.db.models import fields
from opal.core import subrecords
from django.db.models import Max, DateField, DateTimeField
from opal import models
from opal.core import lookuplists
from django.utils.translation import gettext_lazy as _
class Demographics(models.Demograp... | solventrix/HONEUR_eCRF | entrytool/models.py | models.py | py | 6,545 | python | en | code | 0 | github-code | 13 |
41266792484 | class Solution:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
nums.sort()
output = []
n = len(nums)
def backtrack(index, curr):
output.append(curr[:])
for i in range(index, n):
if i != index and nums[i] == nums[i-1]:
... | AshwinRachha/LeetCode-Solutions | 90-subsets-ii/90-subsets-ii.py | 90-subsets-ii.py | py | 539 | python | en | code | 0 | github-code | 13 |
9892001594 | import cv2
import logging
log_format = '%(created)f:%(levelname)s:%(message)s'
logging.basicConfig(level=logging.DEBUG, format=log_format) # log to file filename='example.log',
TAG = "bg-detect-app:"
def main(data_recv, results_send):
logging.debug(TAG + "inside main")
while True:
data_recv.poll()
... | christhompson/recognizers-arch | apps/examples/bg-detect/app.py | app.py | py | 772 | python | en | code | 1 | github-code | 13 |
15791012880 | import Project5Start
game_data = Project5Start.get_project5_data()
menu_text = """
[1] Find largest total sales
[2] Find latest release
[3] Find oldest release
[4] Find highest price
[5] Add new Game
[6] Exit program
"""
while True:
print(menu_text)
choice = input("please enter the number of your selection:")... | jsantore/whileDemoMorning | Menudemo.py | Menudemo.py | py | 1,233 | python | en | code | 0 | github-code | 13 |
15791553570 |
def findDigits(n):
# Write your code here
c=0
ls = list((str(n)))
for i in range(len(ls)):
if int(ls[i]) != 0 and n % int(ls[i]) == 0:
c+=1
# print(int(ls[i]))
return(c)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
t = int(input().st... | Joshwa034/testrepo | findDigit.py | findDigit.py | py | 478 | python | en | code | 0 | github-code | 13 |
7601843296 | import argparse
import functools
import itertools
import heapq
import operator
import re
import typing
from dataclasses import dataclass
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('input')
return parser.parse_args()
def _read_data(input_file):
with open(input_file) a... | mguryev/advent_of_code_2021 | day16.py | day16.py | py | 5,192 | python | en | code | 0 | github-code | 13 |
41894401852 | import os.path
from zipfile import ZipFile
import subprocess
from subprocess import PIPE, CalledProcessError
import shutil
import sys
import json
if not os.path.exists("scripts/tests/e2e-tests.py"):
sys.exit("This script is intended to be executed from the root folder.")
root = os.getcwd()
if sys.argv[1] == "esr1... | mozilla/firefox-translations | scripts/tests/e2e-tests.py | e2e-tests.py | py | 6,069 | python | en | code | 578 | github-code | 13 |
14087858315 | import utilities.util as util
possible_inputs = {
0: ['None',
'trichar',
'pos',
'unigrams',
'functionwords',
'synchronized_functionwords',
'avg_word',
'english',
'bipos',
'avgcapital',
'numberwords',
'punctuations',
'e... | itstmb/nli-project | utilities/interpreter.py | interpreter.py | py | 2,044 | python | en | code | 0 | github-code | 13 |
22196809410 | # Ref: https://projects.raspberrypi.org/en/projects/build-your-own-weather-station/5
# with wind speed, gust speed and direction
from gpiozero import Button
import time
import math
import wind_direction_byo
import statistics # used to determine wind gusts
store_speeds = []
store_directions = []
# print(adc.value)
wi... | professionalmoment/controller | examples/weather-station/weather_station_byo.py | weather_station_byo.py | py | 2,101 | python | en | code | 0 | github-code | 13 |
38227915526 | #!/usr/bin/env/python3
# -*- coding: utf-8 -*-
__author__='drawnkid@gmail.com'
import json
def loadFile():
f = open("services.sql", encoding='utf-8')
f1 = open("services.json", encoding='utf-8')
s = json.load(f1)
l=f.readline()
print(l.split('|')[1].strip())
while l!= '':
l=f.readline(... | BaliStarDUT/hello-world | code/python/json/diffFile.py | diffFile.py | py | 895 | python | en | code | 4 | github-code | 13 |
3299903839 | import sys
import os
if __name__ == "__main__":
if len(sys.argv) is not 2:
sys.exit()
directory = sys.argv[1]
outdir = os.path.join(directory, 'aliveCount')
if not os.path.exists(outdir):
os.mkdir(outdir)
for filename in os.listdir(directory):
if filename != 'aliveCount':
with open(os.path.join(director... | lamyiowce/tumor-ca | misc/aliveCellCount.py | aliveCellCount.py | py | 540 | python | en | code | 3 | github-code | 13 |
9087204802 | # Based on the pyvirtualcam 'webcam_filter' example with slight changes https://github.com/letmaik/pyvirtualcam
import argparse
import signal
import sys
import threading
import keyboard
import time
import logging
import cv2
import pyvirtualcam
from pyvirtualcam import PixelFormat
parser = argparse.ArgumentParser()
pa... | piotrpdev/CameraFreeze | camera_freeze.py | camera_freeze.py | py | 3,531 | python | en | code | 0 | github-code | 13 |
73493590417 | # Analisando se o Ano é Bissexto
from datetime import date # importa datas, anos
ano = int(input('Coloque um ano para ser analisado: '))
if ano == 0:
ano = date.today().year # Pega o ano atual configurado na máquina
if ano % 4 == 0 and ano % 100 != 0 or ano % 400 == 0:
print('O ano {} é BISSEXTO'.... | damiati-a/CURSO-DE-PYTHON | Mundo 1/ex032.py | ex032.py | py | 396 | python | pt | code | 0 | github-code | 13 |
6009613554 | from django.template import Context, loader
from django.http import HttpResponse, HttpResponseRedirect
from django import forms
from baseApp.models import *
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
fr... | alpharay/ETS | payment/views.py | views.py | py | 1,914 | python | en | code | 2 | github-code | 13 |
14486761196 | from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
class FilmBusinessLogic:
"""
The class contains all the business logic of the film app
"""
@staticmethod
def validate_stock_greater_availability(stock: int, availability: int):
"""
... | Thevic16/trainee-python-week-7 | film/business_logic.py | business_logic.py | py | 1,689 | python | en | code | 0 | github-code | 13 |
15142537462 | #!/usr/bin/env python3
import json
from aws_cdk import core as cdk
from dotted.collection import DottedDict
from infra.data_masking_trigger_stack import DataMaskingTriggerStack
from infra.data_masking_process_stack import DataMaskingProcessStack
config = {}
with open("config.json", "r") as f:
jdata = json.load(f)
... | s4mli/salesforce-data-masking-py | app.py | app.py | py | 1,185 | python | en | code | 0 | github-code | 13 |
22946843471 | import os
from collections import defaultdict
import datetime
import logging
import iso8601
from .api import ParlisAPI
from .cache import ParlisFileCache, ParlisForceFileCache
from .subtree_parser import ParlisSubtreeParser
from .attachment_parser import ParlisAttachmentParser
from .parser import ParlisPar... | openstate/parlis-crawler-new | lib/parlis/crawler.py | crawler.py | py | 6,838 | python | en | code | 0 | github-code | 13 |
26414514208 | import collections
d = collections.defaultdict(list)
with open('input.txt') as f:
for l in f:
s = l.strip().split('-')
d[s[0]].append(s[1])
d[s[1]].append(s[0])
paths = 0
def dfs(c, p):
if c == 'end':
global paths
paths += 1
return
for x in d[c]:
if x == 'start':
... | logangeorge01/advent-of-code-2021 | 12/2.py | 2.py | py | 570 | python | en | code | 0 | github-code | 13 |
34649900793 | import datetime
f = open("meds.txt", "a")
while True:
meds = input("What medicine did you take? :")
time_taken = int(input("enter how many minutes ago you took this: "))
when_to_take = int(input("How many minutes until you take again?: "))
current_time = datetime.datetime.now()
meds_taken = ... | MarkCrocker/Python | meds.py | meds.py | py | 944 | python | en | code | 0 | github-code | 13 |
9473738975 | """
Train the mybag model
"""
# pylint: disable= R0801
from ast import literal_eval
import pandas as pd
from joblib import dump
from sklearn.preprocessing import MultiLabelBinarizer
from src.classification.train import train_classifier
from src.preprocessing.preprocessing_data import preprocess_data
from src.transforma... | Jahb/REMA_Base | src/training_classifier_mybag.py | training_classifier_mybag.py | py | 1,399 | python | en | code | 1 | github-code | 13 |
5869951361 | # coding=utf-8
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
from history import orp_demo
####################### 全局变量#########################
app = QApplication(sys.argv)
class MyWindows(orp_demo.Ui_Form, QMainWindow):
def __init__(self):
super(MyWindows, self).__init__()
se... | Eric76-Z/ORP | history/main.py | main.py | py | 448 | python | en | code | 1 | github-code | 13 |
20746436729 | # Tipo Booleana
permissoes = []
idades = [20, 14, 40]
def verifica_pode_dirigir(idades, permissoes):
for idade in idades:
if idade >= 18:
#Adicionar o valor True na lista de permissoes
permissoes.append(True)
else:
#Adicionar o valor False na lista de permissoes... | HenryJKS/Python | Conhecendo Python/Boolean.py | Boolean.py | py | 671 | python | pt | code | 0 | github-code | 13 |
36298502266 | #IMPORTING LIBRARIES
import cv2
import numpy as np
import math
#CAPTURE THE VIDEO FROM WEBCAM
cap = cv2.VideoCapture(0)
while True: #to run the loop infinitely
#READ EACH FRAME FROM THE CAPTURED VIDEO
_, frame = cap.read() # _ is a boolean which indicates if the frame is captured successfully and... | ISA-VESIT/Image-Processing-2021 | Day2/Hand gestures.py | Hand gestures.py | py | 4,624 | python | en | code | 2 | github-code | 13 |
12870996365 | """
Problem statement:
You have a pointer at index 0 in an array of size arrLen. At each step, you can move 1 position to the left, 1 position
to the right in the array, or stay in the same place (The pointer should not be placed outside the array at any time)
Given two integers steps and a... | Nacriema/Leet-Code | daily_challenges/number-of-ways-to-stay-in-the-same-place-after-some-steps.py | number-of-ways-to-stay-in-the-same-place-after-some-steps.py | py | 3,593 | python | en | code | 0 | github-code | 13 |
26890138595 | import os, datetime
from list import buildList
from file import createFile
from process import processList
cwd = os.getcwd()
# Initialise info
contributor = 'Andy Willis'
year = datetime.date.today().year
# Initialise files
logFile = 'log.txt'
processedLogFile = 'processedFiles.txt'
listFile = 'spotmapsList.txt'
#... | andywillis/spotmaps-pipeline | src/main.py | main.py | py | 800 | python | en | code | 0 | github-code | 13 |
25793213172 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
An implementation of Functions in sympy that allow 'anonymous'
functions that can be evaluated when 'lambdified'.
"""
import sympy
def lambdify(args, expr):
""" Returns function for fast calcula... | Garyfallidis/nipy | nipy/modalities/fmri/aliased.py | aliased.py | py | 4,136 | python | en | code | null | github-code | 13 |
3719761626 | import boto3
import os
# Set your AWS credentials
aws_access_key_id = ''
aws_secret_access_key = ''
def upload_directory_to_s3(local_directory, bucket_name, s3_prefix=''):
s3 = boto3.client('s3', aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key)
for root, dirs, files in os.w... | BloodyOcean/course_work_chemistry | InsertGenerator/json_to_s3.py | json_to_s3.py | py | 895 | python | en | code | 0 | github-code | 13 |
73533713296 | import requests
import argparse
import json
parser = argparse.ArgumentParser(description="test deployed api")
parser.add_argument("--img_path", required=True, help="path to image to predict")
args = parser.parse_args()
# reads image and sends it
img_file = open(args.img_path, "rb")
response = requests.post(
url="... | jsmithdlc/mlflow-cortex-deploy | test_local_api.py | test_local_api.py | py | 494 | python | en | code | 0 | github-code | 13 |
70502521298 | from django.test import TestCase
from src.shared.errors.AppError import AppError
from src.utils.error_messages import PROJECT_NOT_FOUND
from src.utils.test.create_project import create_project
from ....repositories.projects_repository import ProjectsRepository
from ..fetch_project_metrics_use_case import FetchProjectMe... | alyssonbarrera/enterprise-management-api | src/modules/projects/use_cases/fetch_project_metrics/tests/test_fetch_project_metrics_use_case.py | test_fetch_project_metrics_use_case.py | py | 1,763 | python | en | code | 0 | github-code | 13 |
28053084860 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | ethankennerly/predicting-player-retention | plot_classifier_comparison.py | plot_classifier_comparison.py | py | 7,307 | python | en | code | 0 | github-code | 13 |
5885628675 | # ------------------------------------------
#
# Program created by Maksim Kumundzhiev
#
#
# email: kumundzhievmaxim@gmail.com
# github: https://github.com/KumundzhievMaxim
# -------------------------------------------
import matplotlib.pyplot as plt
N = 1000000
S = N - 1
I = 1
beta = 0.6
sus = [] # infected compar... | MaxKumundzhiev/Practices-for-Engineers | NetworkScience/ModelSI.py | ModelSI.py | py | 1,256 | python | en | code | 3 | github-code | 13 |
71129843219 | import requests
import random
import json
import asyncio
from spade.agent import Agent
from spade.behaviour import CyclicBehaviour, FSMBehaviour, State
from spade.message import Message
STATE_TWO = "STATE_TWO"
STATE_THREE = "STATE_THREE"
SPEED = 0.1 # s / step
def choose_random_directions():
"""
:return: R... | patricklanger/multi-agent-example | ant_agent.py | ant_agent.py | py | 5,596 | python | en | code | 0 | github-code | 13 |
72773967379 | import evaluate
import argparse
import os
import glob
import json
import copy
from selfBlue import SelfBleu
bleu = evaluate.load("bleu")
def compute_bleu(sentence, questions):
questions_copy = copy.deepcopy(questions)
questions_copy.remove(sentence)
s = bleu.compute(predictions=sentence, references=questi... | RManLuo/llm-facteval | scripts/question_analysis/diversity.py | diversity.py | py | 2,144 | python | en | code | 6 | github-code | 13 |
43122881726 | import tkinter as tk
root = tk.Tk()
root.title("User choice")
#root.geometry('400*400')
name = StringVar()
mail = StringVar()
music = StringVar()
def takeuserdata():
name = name.get()
print(name)
l1 = tk.Label(root, text="Enter Your Name : ").grid(row=0, column=0)
e1 = tk.Entry(root).grid(row=0, column=1)... | kuntal-samanta/Core_Python | Advanced_Python/Voice-Processing-Application/gui.py | gui.py | py | 655 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.