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
40425932994
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Feb 6 12:42:12 2019 @author: paul """ import numpy as np class player(object): def __init__(self,strategy=None): """ The player class holds all variables that belong to one person. Namely the current strategy and the last...
pjpetersik/public_goods_game
pgg.py
pgg.py
py
10,641
python
en
code
3
github-code
90
37565852366
#! /usr/bin/env python # Chinese CCGbank conversion # ========================== # (c) 2008-2012 Daniel Tse <cncandc@gmail.com> # University of Sydney # Use of this software is governed by the attached "Chinese CCGbank converter Licence Agreement" # supplied in the Chinese CCGbank conversion distribution. If the LICE...
jogloran/cnccgbank
rmconj.py
rmconj.py
py
702
python
en
code
12
github-code
90
28609661611
# Main code to data acquisition import socket import FaBo9Axis_MPU9250 import sys from datetime import datetime import time mpu9250 = FaBo9Axis_MPU9250.MPU9250() loop_control = True s = socket.socket() conn_esp32 = False athlete = ['0', 'description'] _input = input("Insert the athlete's ID and a description: ") ath...
Virgulinox/TCC-2019
Raspberry-files/program.py
program.py
py
1,672
python
en
code
0
github-code
90
29339063026
"""Message model tests.""" # run these tests like: # # python -m unittest test_user_model.py import os from unittest import TestCase from uuid import uuid1 from sqlalchemy import exc from models import db, User, Message, Follows # BEFORE we import our app, let's set an environmental variable # to use a different...
ivy1130/SpringboardUnit26
test_message_model.py
test_message_model.py
py
2,752
python
en
code
0
github-code
90
35582800660
from datetime import datetime from networks.loop import Crawler if __name__ == '__main__': crawler = Crawler() crawler.login() if crawler.login_status == True: if crawler.mode == 'monitor': crawler.monitor_treehole() elif crawler.mode == 'day': crawler.craw_treehole(...
yxwucq/Holemonitor
main.py
main.py
py
330
python
en
code
1
github-code
90
33457732938
from PIL import Image, ImageDraw, ImageFont import json import base64 import math from io import BytesIO import sys tile_images = Image.open('./mahjong_tiles/tiles.png') xsize, ysize = tile_images.size tile_width = xsize // 10 tile_height = ysize // 4 tile_names = ['1m','2m','3m','4m','5m','6m','7m','8m','9m','0m', ...
nvize/wwyd-bot
scripts/createGameStatePicture.py
createGameStatePicture.py
py
10,969
python
en
code
0
github-code
90
28006429107
""" Nombre: Sofía Torres Ramírez. Código: 202014872 Nombre: Juan Camilo Neira Campos Código: 201922746 Nombre: Juan David Briceño Morales Código: 201812887 """ from pkg_resources import compatible_platforms import collections import sys def alfabeto_pandora(palabras): grafo= construir_grafo(palabras) ...
storres21/Proyecto-2-DALGO
proyecto2.py
proyecto2.py
py
2,988
python
en
code
0
github-code
90
41154931060
from meebot.chatbot.entities.recognition.product import ProductNER from meebot.chatbot.entities.linking.product import ProductNEL from meebot.chatbot.entities.recognition.sale import SaleNER # shared import os import pendulum from string import Template from bson.objectid import ObjectId from meebot.chatbot.helper im...
somosmee/business-assistant-AI
meebot/chatbot/entities/__init__.py
__init__.py
py
7,013
python
en
code
0
github-code
90
14253268648
#!/usr/bin/python3 # -*- coding: utf-8; -*- import os try: from test.support import EnvironmentVarGuard except ImportError: from test.support.os_helper import EnvironmentVarGuard import unittest from gi.repository import Gtk import mock from ubiquity import i18n, plugin_manager def side_effect_factory(real...
linuxmint/ubiquity
tests/test_language.py
test_language.py
py
4,192
python
en
code
43
github-code
90
15632039058
import unittest import login_elements import login_logout import add_project import os # Import the HTMLTestRunner Module import HtmlTestRunner # Get the Present Working Directory since that is the place where the report # would be stored current_directory = os.getcwd() class HTML_TestRunner_TestSuite(unittest.Test...
asa8080/webtest
test_html_runner.py
test_html_runner.py
py
1,263
python
en
code
0
github-code
90
70826499496
import cv2 import numpy as np import matplotlib.pyplot as plot def LabelColor(data): height, width, channel = data.shape for i in range(height): for j in range(width): if data[i,j,0] == 1: # people data[i,j] = [255, 0, 0] elif data[i,j,0] == 2: # car ...
jsgaobiao/RoadSegmentation_IV2019
FCN_tensorflow/visual.py
visual.py
py
1,533
python
en
code
7
github-code
90
39728789902
#fonction carreau : place "image" dans le canvas "dessin" (/!\ pas le bon nom) # aux coordonées NW (x, y) """def self.carreau(self, image, x, y): im = Image.open(image) logo = ImageTk.PhotoImage(im, master=fen) dessin.create_image(x, y, anchor = tk.NW, image = logo) #ptet ajouter state = ...
RadioGnu/decomposition-images
src/testcouleurs.py
testcouleurs.py
py
1,452
python
fr
code
0
github-code
90
157466893
import logging # Importing models and REST client class from Community Edition version from tb_rest_client.rest_client_ce import * # Importing the API exception from tb_rest_client.rest import ApiException import time from datetime import datetime import paho.mqtt.client as mqtt logging.basicConfig(level=logging.DEBU...
BenSisk/IoT-Project
Sensor Codes/lightControl.py
lightControl.py
py
3,137
python
en
code
0
github-code
90
26693106392
""" Lagrange's Interpolation class File - from scypy """ from scipy.interpolate import lagrange import numpy as np import sympy as sp from time import process_time as timer class LagrangeScipy: def __init__(self): self.P = 0 self.time_ellapsed = 0 self.x = np.array([]) self.y = np...
VdeThevenin/Lagrange-Neville
LagrangeScipy.py
LagrangeScipy.py
py
1,950
python
en
code
0
github-code
90
34871798529
from collections import defaultdict, Counter # List of tuples: number is the user ID, and interest interests = [ (0, "Hadoop"), (0, "Big Data"), (0, "HBase"), (0, "Java"), (0, "Spark"), (0, "Storm"), (0, "Cassandra"), (1, "NoSQL"), (1, "MongoDB"), (1, "Cassandra"), (1, "HBase"), (1, "Postgres"), (2, "...
ilirsheraj/DataScienceScratch
Chapter1_Introduction/data_scientists_you_know.py
data_scientists_you_know.py
py
2,471
python
en
code
0
github-code
90
28298420387
import mindspore from mindspore import Tensor # from mindspore import numpy as np from mindspore import nn, ops from mindspore.ops import operations as P from ..model_utils.bounding_box import Boxes from .mask import SegmentationMask from ..model_utils.bbox_ops import cat_boxlist, cat_boxlist_gt import cv2 import rand...
TianTianSuper/MaskTextSpotter-MindSpore
src/masktextspotter/inference.py
inference.py
py
10,481
python
en
code
1
github-code
90
70904640937
def init(node, start, end): if start == end: tree[node] = data[start] return tree[node] mid = (start + end) // 2 tree[node] = init(node * 2, start, mid) + init(node * 2 + 1, mid + 1, end) return tree[node] def update(node, start, end, target, diff): if target < start or target > end...
dohun31/algorithm
2021/week_11/210918/2042.py
2042.py
py
1,302
python
en
code
1
github-code
90
71696182697
"""Tests of the log-probability calculations.""" # _logprob.py import jax.numpy as jnp import jax.random as random import pytest import pyggdrasil.tree_inference._logprob as logprob import pyggdrasil as yg from pyggdrasil.tree_inference._tree import Tree import pyggdrasil.tree_inference._tree as tr def test_mutatio...
cbg-ethz/PYggdrasil
tests/tree_inference/test_logprob.py
test_logprob.py
py
14,027
python
en
code
3
github-code
90
32967058105
import os def Borrar(): Agente = input("Introduzca el agente que sera eliminado:") with open("Agentes.txt") as myfile: total = sum(1 for line in myfile) agentes_txt = open("Agentes.txt", "r") file = open("Agentesupdate.txt", "w") print(total) for i in range(total): linea_a = age...
CloudTliltik/Practica_1
Borrar_agente.py
Borrar_agente.py
py
756
python
es
code
0
github-code
90
18203235209
A,B = input().split() from decimal import Decimal A = Decimal(A) B = Decimal(B) ans = A*B ans = str(ans) n = len(ans) s = '' for i in range(n): if ans[i] == '.': break s += ans[i] print(s)
Aasthaengg/IBMdataset
Python_codes/p02659/s201305492.py
s201305492.py
py
204
python
en
code
0
github-code
90
1157243124
lista = [20, 50, "Curso", "Python", 3.14]; print(lista); valor1 = input("Ingrese primer valor: "); valor2 = input("Ingrese el segundo valor: "); lista[0] = valor1; lista[1] = valor2; print("El nuevo valor de la lista es: {}".format(lista));
Jaikelly/CursoPython
Listas, diccionarios y tuplas/Ejercicio_1.1.py
Ejercicio_1.1.py
py
245
python
es
code
0
github-code
90
43718267111
# NestedForLoopExample--- Find Pythagorian numbers for the number entered from math import sqrt number = int(input("Enter number:")) for a in range(1, number + 1): for b in range(a, number): c_square = a ** 2 + b ** 2 c = int(sqrt(c_square)) if ((c_square - c ** 2) == 0): ...
KrishnakanthSrikanth/Python_Simple_Projects
NestedFor.py
NestedFor.py
py
341
python
en
code
0
github-code
90
2442127006
import time import boto3 import json from pherrorlayer import * ''' 这个函数实现两件事情: 1. 将错误的信息写入 notification 中 2. 将错误的被删除的 index 重新写回 dynamodb 中 所有的信息都在 result 中存放 args: event = { "traceId.$": "ce1e04bfa52446c5ab2a1c8fe2b075b0", "projectId.$": "ggjpDje0HUC2JW", "owner.$": "test_owner", ...
PharbersDeveloper/phlambda
processor/async/resourcedeletion/phresdeletionfailedcleanup/src/main.py
main.py
py
14,805
python
en
code
0
github-code
90
17929621859
def actual(n): s = str(n) if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]: return 'Yes' return 'No' # if len(set(str(n))) <= 2: # return 'Yes' # # return 'No' s = input() print(actual(s))
Aasthaengg/IBMdataset
Python_codes/p03543/s304815891.py
s304815891.py
py
230
python
en
code
0
github-code
90
17895273166
# -*- coding: utf-8 -*- import unittest import os # noqa: F401 import json # noqa: F401 import time import requests from os import environ try: from ConfigParser import ConfigParser # py2 except: from configparser import ConfigParser # py3 from pprint import pprint # noqa: F401 from biokbase.workspace.c...
briehl/narrative_job_mock
test/narrative_job_mock_server_test.py
narrative_job_mock_server_test.py
py
3,531
python
en
code
0
github-code
90
15801554705
# -*- coding: utf-8 -*- """ 1122. Relative Sort Array Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that don't appear in arr2 should be placed at...
tjyiiuan/LeetCode
solutions/python3/problem1122.py
problem1122.py
py
876
python
en
code
0
github-code
90
30072281780
import time import pytest import faker from unified_log.log_process import * from base_app.models import Device from base_app.factory_data import DeviceFactory from base_app.serializers import DeviceRetrieveSerializer from unified_log.unified_error import LogProcessError, LogPreProcessError from unified_log...
liushiwen555/unified_management_platform_backend
unified_log/tests/test_log_process.py
test_log_process.py
py
11,208
python
en
code
0
github-code
90
73844678376
""" # Exercise 6 | Support Vector Machines """ from plotData import plotData from svmModel import SVMModel from visualizeBoundary import visualizeBoundary from dataset3Params import dataset3_params import scipy.io as sio import matplotlib.pyplot as plt import numpy as np def pause(): input("") print('Loading ...
hzitoun/machine_learning_from_scratch_matlab_python
algorithms_in_python/week_7/ex6/ex6.py
ex6.py
py
4,124
python
en
code
30
github-code
90
17374717746
from prompto.expression.IExpression import IExpression from prompto.expression.PredicateExpression import PredicateExpression from prompto.parser.Dialect import Dialect from prompto.runtime.Context import Context from prompto.runtime.Variable import Variable from prompto.error.SyntaxError import SyntaxError from functo...
prompto/prompto-python3
Python3-Core/src/main/prompto/expression/ArrowExpression.py
ArrowExpression.py
py
6,453
python
en
code
4
github-code
90
18413932071
from math import sqrt def golden_section_search(lower, upper, epsilon, func): """ Do a golden section search for minimum between lower and upper to epsilon precision using func to do evaluation :param lower: :param upper: :param epsilon: :param func: :return: """ phi = (-1.0 + sqrt(5))...
emanuelev/supereight
se_apps/scripts/_util.py
_util.py
py
725
python
en
code
194
github-code
90
36447412233
__author__ = "Moggio Alessio" __license__ = "Public Domain" __version__ = "1.0" import sys import datetime import os.path import re from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure from PyQt5.Qt import QFont, Qt, QSize from PyQt5.QtWidgets import (QM...
mnarizzano/se20-project-16
src/classes/GUI.py
GUI.py
py
49,456
python
en
code
0
github-code
90
14064336651
import warnings from itertools import product from typing import List, Optional, Union import cf_units as unit import iris import numpy as np from cf_units import Unit from iris.cube import Cube from numpy import ndarray from improver.ensemble_copula_coupling.constants import BOUNDS_FOR_ECDF def concatenate_2d_arra...
metoppv/improver
improver/ensemble_copula_coupling/utilities.py
utilities.py
py
14,687
python
en
code
95
github-code
90
35088053168
import pymongo # used to edit the list of recommended games def recHelper(helpList, developer, name): maxGames = 5 # remove the game itself from the recommended games list for x in helpList: if x["name_lower"] == name: helpList.remove(x) # games from the same developer get put at t...
Dino-Yang/Iprop
main.py
main.py
py
9,285
python
en
code
0
github-code
90
72797033898
def len(iterable) -> int: length = 0 for _ in iterable: length += 1 return length def is_odd(num) -> bool: if not isinstance(num, int): raise TypeError return num % 2 == 1 def is_even(num) -> bool: if not isinstance(num, int): raise TypeError return num % 2 == 0 ...
azraelgnosis/danger_noodle_101
higher-order_functions/nested-functions.py
nested-functions.py
py
2,361
python
en
code
0
github-code
90
2921573860
def es_palindromo(palabra): # Elimina espacios en blanco y convierte la palabra a minúsculas palabra = palabra.replace(" ", "").lower() # Comprueba si la palabra es igual a su inversa if palabra == palabra[::-1]: return True else: return False def main(): palabra = input("Ingr...
jossmay/practica1_grupo2
Palabra_Palidroma.py
Palabra_Palidroma.py
py
524
python
es
code
0
github-code
90
30129231691
import numpy as np import matplotlib.pyplot as plt import cv2 from scipy.ndimage import convolve import os from numpy.fft import fft2, fftshift, ifft2, ifftshift from scipy.ndimage import convolve import matplotlib.pyplot as plt from scipy.ndimage import convolve, rotate # Ensure the folders for saving images exist ...
eyobodega/Image-Analysis
sticks-spatial/experiment.py
experiment.py
py
14,361
python
en
code
0
github-code
90
43345610644
import re from pprint import pprint from .code_parser import code_parser as cprsr class MethodParser(cprsr.CodeParser): def parse_methods(self): self.__find_methods() for path, data in self.smalis['data'].items(): for method, mdata in data['methods'].items(): self.par...
SaitoLab-Nitech/VTDroid
smalien/core/smali_handler/parser/method_parser/method_parser.py
method_parser.py
py
3,685
python
en
code
2
github-code
90
13793294939
from flask import jsonify from dbconnect import connection import gc import json def addCor(response): response.headers.add('Access-Control-Allow-Origin', '*'); response.headers.add('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE'); response.headers.add('Access-Control-Allow-Headers', 'Content-Type'); retur...
Nesrider/keithmaverick-backend
db.py
db.py
py
1,734
python
en
code
0
github-code
90
21507273283
import requests import sys import os # Define a function to process API requests and make sure that the script does not break due to throttling. If any other status code is returned by the API, the script breaks and returns the status code def make_request(url, headers): request_get = requests.get(url, heade...
dab1ca/Python-Scripts
StartStop/start-stop.py
start-stop.py
py
4,559
python
en
code
0
github-code
90
18411726349
from collections import deque h,w=map(int,input().split()) maze=[list(input()) for i in range(h)] dx=[1,-1,0,0] dy=[0,0,1,-1] Q=deque() for i in range(h): for j in range(w): if maze[i][j]=='#': Q.append((i,j,0)) while Q: x,y,z=Q.popleft() for i in range(4): nx=x+dx[i] ny=y+dy[i] if ...
Aasthaengg/IBMdataset
Python_codes/p03053/s605201240.py
s605201240.py
py
425
python
en
code
0
github-code
90
24784745150
# pylint: disable=invalid-name, bad-continuation import uuid import pytest from photonpump import connect, messages, messages_pb2, exceptions from . import data @pytest.mark.asyncio async def test_single_event_publish(event_loop): stream_name = str(uuid.uuid4()) async with connect(username="test-user", pass...
epoplavskis/photon-pump
test/write_test.py
write_test.py
py
2,560
python
en
code
49
github-code
90
18013705879
w,a,b = map(int,input().split()) aw = a + w bw = b + w if a == bw or b == aw or a == b: print(0) elif a < b < aw or b < a < bw: print(0) else: if aw < b: print(b-aw) if bw < a: print(a-bw)
Aasthaengg/IBMdataset
Python_codes/p03778/s546084592.py
s546084592.py
py
220
python
en
code
0
github-code
90
27329272721
from tkinter import * from tkinter import ttk root = Tk() frm = ttk.Frame(root, padding=400) global counter counter = 0 def click(): global counter counter += 1 mButton1.config(text = counter) mButton1 = Button(text = counter, command = click, fg = "darkgreen", bg = "white") mButton1....
YolianBoister/Python-stuff
Help/Integer test.py
Integer test.py
py
347
python
en
code
0
github-code
90
35275586367
''' Created on Apr 24, 2017 @author: Sneha Mule ''' import environment import state class Search: def __init__(self,initial_state,env): self.env=env self.initial_state=initial_state def heuristic(self,xCurr,yCurr,envirornment): tempValue=abs(envirornment.en...
snehamule/Efficient_Path_Finder
Astar_Algo.py
Astar_Algo.py
py
8,308
python
en
code
0
github-code
90
1881528246
from analyticsclient.constants import enrollment_modes from django.conf import settings from django.core.cache import cache from waffle import switch_is_active from analytics_dashboard.courses.presenters import BasePresenter class CourseSummariesPresenter(BasePresenter): """ Presenter for the course enrollment d...
openedx/edx-analytics-dashboard
analytics_dashboard/courses/presenters/course_summaries.py
course_summaries.py
py
4,087
python
en
code
72
github-code
90
74667653415
import streamlit as st import pandas as pd import numpy as np import plotly.express as px # st.set_page_config( # page_title="FE. Final Project", # layout="wide", # ) st.title("MCD. Ingeniería de características. Proyecto final") st.subheader( "Relación entre presupuesto a la educación...
elgiroma/MCD.-FE-Final-project
pages/Presupuesto&Salario.py
Presupuesto&Salario.py
py
4,178
python
en
code
0
github-code
90
24849896873
import cv2 print(cv2.__version__) dispW=640 dispH=480 flip=2 from adafruit_servokit import ServoKit kit=ServoKit(channels=16) pan=90 tilt=90 kit.servo[1].angle=pan kit.servo[0].angle=tilt face_cascade=cv2.CascadeClassifier('/home/pi/Desktop/Face Tracking/cascade/face.xml')#파일은 로컬에 별도로 저장 #eye_cascade=cv2.CascadeClass...
Strayfox45/AI_Dataset
face tracking/face track test1.py
face track test1.py
py
1,811
python
en
code
0
github-code
90
18476818969
import sys import collections input_methods=['clipboard','file','key'] using_method=0 input_method=input_methods[using_method] tin=lambda : map(int, input().split()) lin=lambda : list(tin()) mod=1000000007 #+++++ def main(): n = int(input()) #b , c = tin() #s = input() if n <= 9: return 0 counter = collect...
Aasthaengg/IBMdataset
Python_codes/p03213/s255521406.py
s255521406.py
py
1,686
python
en
code
0
github-code
90
2878571434
# -*- encoding: utf-8 -*- ''' @File : 66. 加一.py @Time : 2020/04/21 20:16:35 @Author : windmzx @Version : 1.0 @Desc : For leetcode template ''' # here put the import lib from typing import List class Solution: def plusOne(self, digits: List[int]) -> List[int]: l=len(digits) if l...
windmzx/pyleetcode
66. 加一.py
66. 加一.py
py
669
python
en
code
0
github-code
90
20388109621
class Solution: def RemoveElement(self,nums,val): ##判断数组是否为空 if len(nums) !=0: length = len(nums) for i in range(length-1): if nums[i] == val: nums.remove(nums[i]) return len(nums) else: return 0 if __name_...
Confucius-hui/LeetCode
移除元素.py
移除元素.py
py
464
python
en
code
0
github-code
90
73844673896
import numpy as np def polyFeatures(X, p): """Maps X (1D vector) into the p-th power [X_poly] = POLYFEATURES(X, p) takes a data matrix X (size m x 1) and maps each example into its polynomial features where X_poly(i, :) = [X(i) X(i).^2 X(i).^3 ... X(i).^p]; """ X_poly = np.zeros((X.sh...
hzitoun/machine_learning_from_scratch_matlab_python
algorithms_in_python/week_6/ex5/polyFeatures.py
polyFeatures.py
py
495
python
en
code
30
github-code
90
8605438792
#sum using while loop sum1=0 n=0 q=input("Would you like to add more numbers?") while q=="Yes" or "yes": n=int(input("Enter a number :")) sum1+=n if n<0: print("Can't add negative numbers") break print("The sum of the numbers is",sum1) q=input("Would you like to add more n...
Pabsthegreat/python-class-11
Q2.py
Q2.py
py
405
python
en
code
0
github-code
90
21441777242
#Script that replaces ASCII textual emojies with actual emojies from pynput.keyboard import Key, Listener , Controller import ctypes import keyboard import time import pyperclip import sys import ctypes # An included library with Python install. ctypes.windll.user32.MessageBoxW(0, "EmojiBot started looking fo some ...
OussEmaDevCode/pythonPlay
emojie.py
emojie.py
py
1,603
python
en
code
0
github-code
90
30607080758
from asyncio import sleep from datetime import datetime from telethon import Button from telethon.tl.functions.account import GetPrivacyRequest, UpdateProfileRequest from telethon.tl.types import InputPrivacyKeyStatusTimestamp, PrivacyValueAllowAll from . import ( BOTLOG, BOTLOG_CHATID, PM_LOGGER_GROUP_ID...
aykhan026/DogeUserBot
userbot/plugins/afk.py
afk.py
py
12,414
python
en
code
0
github-code
90
17942130359
from collections import deque s = input() s = deque(s) ans = 0 while len(s) > 0: if s[0] == s[-1]: if len(s) == 1: s.popleft() else: s.popleft() s.pop() elif s[0] == "x": s.popleft() ans += 1 elif s[-1] == "x": s.pop() a...
Aasthaengg/IBMdataset
Python_codes/p03569/s793084728.py
s793084728.py
py
384
python
en
code
0
github-code
90
13997635258
import cv2 import numpy as np def warpTriangle(img1, img2, t1, t2, times = 1): r1 = cv2.boundingRect(np.float32([t1])) r2 = cv2.boundingRect(np.float32([t2])) #find the bounding rectangle to conver the triangle t1_off = [[t1[i][0] - r1[0], t1[i][1] - r1[1]] for i in range(0, 3)] t2_off = [[t2[i][0]...
Jeret-Ljt/average_face
utils.py
utils.py
py
2,011
python
en
code
1
github-code
90
46546013933
import datetime import pandas_datareader.data as web import matplotlib.pyplot as plt from matplotlib import style style.use('ggplot') start = datetime.datetime(2018, 1, 1) end = datetime.datetime.now() print (start) print (end) df = web.DataReader("XOM", "morningstar", start, end) #it reset index show the numeric ...
gauravsaxena1997/pycode
pandas/1.basic.py
1.basic.py
py
487
python
en
code
0
github-code
90
18654364198
# Heather Fryling # 3/10/2021 from collections import deque from digraph import * # PURPOSE # Traverse a graph in a depth-first manner and return the traversal. # SIGNATURE # dfs_recursive :: DiGraph, Integer => List # TIME COMPLEXITY # O(m) -- checking each edge in the traversal. # SPACE COMPLEXITY # O(n) -- the tra...
HeatherFryling/AlgoStudy
GraphAlgos/DFS/basic_dfs/basic_dfs.py
basic_dfs.py
py
2,337
python
en
code
1
github-code
90
8109451292
import unittest from datastruct.linkedlist import LinkedList class LinkedListTest(unittest.TestCase): def test_init_empty(self): ll = LinkedList() self.assertEqual([], list(ll)) def test_init_from_array(self): lst = [1, 2, 3, 4, 5] ll = LinkedList(lst) self.assertEqu...
alberto-re/algorithms
python/test/datastruct/test_linkedlist.py
test_linkedlist.py
py
912
python
en
code
1
github-code
90
35748821921
from itertools import permutations #dictionaries to store probabilities probs = {} #read probabilities database file def readfile(): #open database database = open("database.txt", "r") for line in database: if len(line.split()) != 2: # not interested in this line continue (key, val) = line.sp...
hanskw4267/code_snippets
Python/EE2102 lab/trial (1).py
trial (1).py
py
802
python
en
code
0
github-code
90
12600301303
#!/usr/bin/env python import sys from os.path import isdir, join from datetime import datetime as dt import numpy as np import matplotlib.pyplot as plt import opm.io from opm.io.parser import Parser, ParseContext from opm.io.ecl_state import EclipseState from opm.io.schedule import Schedule def plotswof(ecl): ...
OPM/opm-common
python/examples/swofplt.py
swofplt.py
py
1,885
python
en
code
27
github-code
90
10581413340
import csv import subprocess def throughput(row): return (float(2130537436) / float(row[3])) * (10**9 / 1024 / 1024) def avg(l): l = [ float(x) for x in l ] return sum(l, 0.0) / len(l) with open('blocks.csv', 'r') as csvfile: reader = csv.reader(csvfile) rows = [row for row in reader] output...
wojtekzozlak/Mgr
benchmark/plot/blocks.py
blocks.py
py
691
python
en
code
0
github-code
90
29347474810
from src.dbService import esService from flask import current_app as app import pandas as pd from src.util import agencyIdRetriver def getResponse(requestType, startTime, endTime): df = getData(requestType, startTime, endTime) app.logger.info(f'df from es data for request {requestType}\n{df}') formatedDf ...
mahmudur-rahman-dev/flask-elasticsearch-caching
src/reportGenerator/requestTypeReport.py
requestTypeReport.py
py
3,364
python
en
code
0
github-code
90
18033162649
import numpy as np from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson from scipy.sparse import csr_matrix n, m = map(int, input().split()) ma = [[0]*n for _ in range(n)] list_ABC = [ list(map(int,input().split(" "))) for i in range(m)] for a, b, c in list_ABC: ma[a-1][b...
Aasthaengg/IBMdataset
Python_codes/p03837/s600493835.py
s600493835.py
py
483
python
en
code
0
github-code
90
73257368618
import csv import numpy as np import argparse import json import re # Paths IDs = {"Left": "/u/cs401/A1/feats/Left_IDs.txt", "Center": "/u/cs401/A1/feats/Center_IDs.txt", "Right": "/u/cs401/A1/feats/Right_IDs.txt", "Alt": "/u/cs401/A1/feats/Alt_IDs.txt"} FEATS = {"Left": "/u/cs401/A1/feats/Left_f...
dabandaidai/CSC401
A1/code/a1_extractFeatures.py
a1_extractFeatures.py
py
9,305
python
en
code
0
github-code
90
18958051895
from enum import auto, IntEnum from typing import Any, Dict, List from constrainedrandom import RandObj from constrainedrandom.utils import unique from .. import testutils def plus_or_minus_one(listvar): val = listvar[0] for nxt_val in listvar[1:]: if nxt_val == val + 1 or nxt_val == val - 1: ...
imaginationtech/constrainedrandom
tests/features/rand_list.py
rand_list.py
py
22,701
python
en
code
10
github-code
90
26036410146
from xml.sax import saxutils import ctypes import logging import os import platform import plistlib import re import struct import subprocess import time from utils import tools from api.platforms import common from api.platforms import gpu try: import Quartz except ImportError: Quartz = None try: import objc...
luci/luci-py
appengine/swarming/swarming_bot/api/platforms/osx.py
osx.py
py
27,105
python
en
code
74
github-code
90
18158091629
import sys input = sys.stdin.readline def main(): S = int(input()) dp = [0]*(S+1) dp[0] = 1 M = 10**9 + 7 for i in range(1, S+1): for j in range(0,i-2): dp[i] += dp[j] dp[i] %= M print(dp[S]) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02555/s328601826.py
s328601826.py
py
286
python
en
code
0
github-code
90
18310856729
N,*A = map(int, open(0).read().split()) group = [0] * 3 ans = 1 for x in A: ans = (ans*group.count(x)) % 1000000007 if ans == 0: print(0) break else: group[group.index(x)] += 1 else: print(ans)
Aasthaengg/IBMdataset
Python_codes/p02845/s588626559.py
s588626559.py
py
233
python
en
code
0
github-code
90
43957542611
import numpy as np import pandas as pd import matplotlib.pyplot as plt def readCoronaCases(): """ Read english coronavirus cases from csv file """ cases = pd.read_csv("data_2020-Sep-02.csv") return cases def readFTSEData(): FTSEData = pd.read_csv("FTSE 100 Historical Data (1).csv") ...
CalumHarvey/coronavirus-and-FTSE-comparison
main.py
main.py
py
2,313
python
en
code
0
github-code
90
7246862361
# f = open('/Users/michael/test.txt', 'r') 不存在的情况 f=open('io.txt','r') s=f.read() f.close() # 不准确 一旦程序出错 就不能执行到该语句 print(s) print("引入try 避免文件不能关闭") try: f1 = open('io.txt', 'r') print(f1.read()) finally: if f1: f1.close() print("但是每次都这么写实在太繁琐,所以,Python引入了with语句来自动帮我们调用close()方法:") with open('io.tx...
wusankai/Python_Study
study/mycompany/mytest/io.py
io.py
py
1,018
python
zh
code
0
github-code
90
74340461737
import numpy as np import scipy.integrate as integrate import scipy.special as special import scipy.optimize as opt import matplotlib.pyplot as plt kp = 1.0 # # kp = 2.e6 eta = 1.0 P0 = 1.0 # P0 = 0.0205 #* 0.8602150 def ddf(x, a): if x == a: return np.inf else: return 0.0 def TransferFunction(k, t): ...
cjoana/GREx
PBH-tools/dcrit.py
dcrit.py
py
6,172
python
en
code
1
github-code
90
71447844136
# @author Simon Stepputtis <sstepput@asu.edu>, Interactive Robotics Lab, Arizona State University import tensorflow as tf import pathlib from model_src.attention import TopDownAttention from model_src.glove import GloveEmbeddings from model_src.dmp import DynamicMovementPrimitive from model_src.basismodel import Basis...
eyusd/LP
model_src/model.py
model.py
py
4,151
python
en
code
1
github-code
90
18368091859
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C # CreatedDate: 2020-09-10 18:27:16 +0900 # LastModified: 2020-09-10 18:35:34 +0900 # import os import sys # import numpy as np # import pandas as pd from collections import Counter def main(): n = int(input()) A = [] for _ in range(n): ...
Aasthaengg/IBMdataset
Python_codes/p02971/s521319266.py
s521319266.py
py
715
python
en
code
0
github-code
90
42280077517
#!/usr/bin/env python3 ''' This script simply configures a system with compressibilty and ensures that it flags a warning if the user attempts to use a penalty solver. ''' import underworld as uw from underworld import function as fn mesh = uw.mesh.FeMesh_Cartesian("Q1/DQ0", (2,2), (0.,0.), (1.,1.)) velocityField =...
underworldcode/underworld2
docs/test/solver_penalty_test.py
solver_penalty_test.py
py
1,069
python
en
code
140
github-code
90
73992752936
from mysql.connector.errors import ProgrammingError from bd import nova_conexao selecionar_grupo = 'SELECT id FROM grupos WHERE descricao = %s' atualizar_contato = 'UPDATE contatos SET grupo_id = %s WHERE nome = %s' contato_grupo = { 'Joel': 'Futebol', 'Rafael': 'Trabalho', 'Joana': 'Trabalho', ...
lucasbiancogs/python
banco_dados/associar_grupo_contato.py
associar_grupo_contato.py
py
1,144
python
pt
code
1
github-code
90
42660473108
import timeit import time from lpfgopt.leapfrog import LeapFrog from . import * def _f_test(x, offset): return 2.0 * x[0]**2 + x[1]**2 + offset _g1 = lambda x: x[0] + 3 _intvls = [ [-10.0, 10.0], [-10.0, 10.0]] _starting_points = [ [-3.269716623, -7.930871], [-0.301065303, 2.3311285], ...
flythereddflagg/lpfgopt
tests/test_unit.py
test_unit.py
py
3,364
python
en
code
2
github-code
90
43213087794
# 14888 연산자 끼워넣기 # 백트래킹 idea : 현재 숫자가 max보다 작은데 남은데 //, -밖에 없다면 pass # 마찬가지로 min보다 큰데 남은게 *, +밖에 없으면 pass # 그냥 조합 쓰는게 백트래킹효과를 냄. # https://velog.io/@kimdukbae/BOJ-14888-%EC%97%B0%EC%82%B0%EC%9E%90-%EB%81%BC%EC%9B%8C%EB%84%A3%EA%B8%B0-Python 참고 from itertools import combinations import sys, copy n = int(input()) lst = l...
siejwkaodj/Problem-Solve
Baekjoon/Backtracking/14888_연산자 끼워넣기.py
14888_연산자 끼워넣기.py
py
1,789
python
ko
code
1
github-code
90
17971066689
H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) D = {} for i in range(N): D[i + 1] = A[i] C = [] for k, v in D.items(): [C.append(k) for _ in range(v)] h = 0 while True: h += 1 for i in range(W): print(C[i], end=' ') print('') [C.pop(0) for _ in rang...
Aasthaengg/IBMdataset
Python_codes/p03638/s705624303.py
s705624303.py
py
503
python
en
code
0
github-code
90
74405109417
from re import A import h5py import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import pandas as pd import tables from eheanalysis import weighting n_gen = 10000 * 150 livetime = 86400 * 365 # 1 year he_file = '/disk20/users/brian/IceCube/juliet/mu_high_energy_merged_1k.hdf5' with ...
clark2668/ehe_studies
studies/2022.07_cuts/weighting_debugging/weight_juliet.py
weight_juliet.py
py
2,553
python
en
code
0
github-code
90
4296809382
from pdf2image import convert_from_path from PIL import Image, ImageDraw, ImageFont # Convert PDFs to images images_a = convert_from_path('/home/sardor/1-THESE/2-Robotic_Fish/2-DDPG/deepFish/other/temp/loss.pdf') images_b = convert_from_path('/home/sardor/1-THESE/2-Robotic_Fish/2-DDPG/deepFish/other/temp/mean_ep_lengt...
ss555/deepFish
thesis-src/three_pdfs_combine.py
three_pdfs_combine.py
py
2,847
python
en
code
0
github-code
90
22883041655
import _thread import random import time from threading import Lock import matplotlib from PyQt5 import QtCore, QtGui, QtWidgets import hj_func import hj_ui from PyQt5.QtCore import QTimer, QThread, pyqtSignal from PyQt5.QtWidgets import QMainWindow, QGridLayout from matplotlib.backends.backend_qt5agg imp...
echo-wen/AirTrack
temp.py
temp.py
py
6,218
python
en
code
1
github-code
90
6185065566
#!/usr/bin/env python import ROOT import re import argparse from array import array is_datadriven=1 def add_lumi(year): lowX=0.55 lowY=0.835 lumi = ROOT.TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC") lumi.SetBorderSize( 0 ) lumi.SetFillStyle( 0 ) lumi.SetTextAlign( 12 ) lu...
cecilecaillol/MyNanoAnalyzer
LocalCodeCecile/Draw_nPUtracks.py
Draw_nPUtracks.py
py
7,748
python
en
code
0
github-code
90
73206512298
import log logger = log.get_logger(__name__) import socket import traceback import struct import numpy as np import serial import sthread import time import meamer import sthread import warnings import threading sensor_distance = 1500 sensor_distances = [] is_object_close = False prediction_event = threading.Event(...
lasseaeggen/SiNRI
demo_receiver.py
demo_receiver.py
py
5,136
python
en
code
1
github-code
90
12685028389
import math import re import cv2 import numpy as np import glob import os import json from pathlib import Path from scipy.spatial.distance import cdist from tqdm import tqdm from preprocessing.preprocess import Preprocess from metrics.evaluation_recognition_train_test import Evaluation class EvaluateAll: def _...
hrosc/Assignment3
run_recognition_evaluation.py
run_recognition_evaluation.py
py
3,802
python
en
code
0
github-code
90
14561004721
from collections import defaultdict import re class APError(Exception): def __init__(self, message, lineNumber): super().__init__(message) # 1-based line number self.lineNumber = lineNumber class Pattern(object): def __init__(self, name, regex): self.name = name self.p...
msiddalingaiah/EE
Sequencer/Parser.py
Parser.py
py
12,508
python
en
code
0
github-code
90
43375687619
from flask import Flask, render_template from escpos.printer import Network import datetime senha = 0 kitchen = Network("192.168.10.31") app = Flask(__name__) @app.route("/") def homepage(): return render_template("homepage.html") @app.route("/rodar", methods=["post","get"]) def rodar(): global senha ...
ThiagoCuckaszz/Senhas_Exames
app.py
app.py
py
803
python
en
code
1
github-code
90
15924517296
"""pizza table Revision ID: 47cf8144c2bb Revises: Create Date: 2021-03-05 05:29:06.627455 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '47cf8144c2bb' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto genera...
Brayoh-ux/BryKv-Pizza
migrations/versions/47cf8144c2bb_pizza_table.py
47cf8144c2bb_pizza_table.py
py
2,812
python
en
code
0
github-code
90
72255839656
from argparse import Namespace from enum import Enum from dataclasses import dataclass from io import TextIOWrapper from typing import List EXTRA_LIST_TOKENS = ['-'] @dataclass class Section: """A section in a list. For example: 1. This is a top level section 2. A sub section 3. Another sub s...
estebangarcia21/markdown-list-reader
parse.py
parse.py
py
3,282
python
en
code
3
github-code
90
17944578259
from collections import defaultdict def main(): N, M = list(map(int, input().split(' '))) adj_nodes = defaultdict(list) edges = list() for _ in range(M): a, b = list(map(int, input().split(' '))) a -= 1 b -= 1 edges.append((a, b)) adj_nodes[a].append(b) ...
Aasthaengg/IBMdataset
Python_codes/p03575/s890644989.py
s890644989.py
py
942
python
en
code
0
github-code
90
41476491044
def target_word_count(filename, *words): result = {} with open(filename, 'r') as f: for line in f: for word in line.split(): if word in words: result[word] = result.get(word, 0) result[word] += 1 return result print(target_word_cou...
blessedby-clt/python_workout
5장.파일/Ex20-1.py
Ex20-1.py
py
372
python
en
code
0
github-code
90
8292164086
from bs4 import BeautifulSoup import requests from time import sleep from csv import DictWriter # url = "http://quotes.toscrape.com" # response = requests.get(url).text # soup = BeautifulSoup(response, 'html.parser') # quotes = soup.select('.quote') # arr = [] # for quote in quotes: # quote_text = quote.select('....
yfove/python_quote-scraper
scraper.py
scraper.py
py
2,039
python
en
code
0
github-code
90
18527404419
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque #from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq...
Aasthaengg/IBMdataset
Python_codes/p03330/s949262200.py
s949262200.py
py
1,132
python
en
code
0
github-code
90
18182056839
n = int(input()) l = [0, 0, 0, 0] for _ in range(n): s = input() if s == 'AC': l[0] += 1 elif s == 'WA': l[1] += 1 elif s == 'TLE': l[2] += 1 else: l[3] += 1 print("AC x " + str(l[0])) print("WA x " + str(l[1])) print("TLE x " + str(l[2])) print("RE x " + str(l[3]))
Aasthaengg/IBMdataset
Python_codes/p02613/s001538407.py
s001538407.py
py
292
python
en
code
0
github-code
90
86345516611
import os import numpy as np import copy # 文件夹下直接为类别文件夹 def createTxt(root,filename): data_path = root dirs = os.listdir(data_path) # dirs.sort() print(dirs) with open(filename, "w", encoding="utf-8") as f: label = 0 for c in dirs: img_path = os.path.join(data_path, c) ...
QFaceblue/Driving-Behavior-Recognition
createTxt.py
createTxt.py
py
15,465
python
en
code
3
github-code
90
18283184699
from collections import defaultdict """ N 以下の全ての整数に対して, (先頭, 末尾) を数える. (先頭, 末尾), (末尾, 先頭)の組は, 独立しているので掛け算で求められる. """ n = int(input()) ansl = defaultdict(lambda: 0) for i in range(1,n+1): sentou = int(str(i)[0]) ushiro = int(str(i)[-1]) ansl[(sentou, ushiro)] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10)...
Aasthaengg/IBMdataset
Python_codes/p02792/s252053398.py
s252053398.py
py
463
python
ja
code
0
github-code
90
20937547499
from django.urls import path from .views import TaskList, TaskDetail, TaskCreate, TaskUpdate, DeleteView, CustomLoginView, RegisterPage, TaskReorder,login_view,U_task_list_view,basket_view from django.contrib.auth.views import LogoutView urlpatterns = [ path('login/', CustomLoginView.as_view(), name='login')...
Sunrise9871/proj-repo
base/urls.py
urls.py
py
1,116
python
en
code
0
github-code
90
19300303207
from django.utils.translation import gettext_lazy as _t from hris_integration.forms import Form, MetaBase from extras import widgets from active_directory import validators from common.functions import model_to_choices from user_applications import models class Software(Form): name = _t("Software") list_fiel...
jcarswell/hris-integration
hris_integration/user_applications/forms.py
forms.py
py
1,965
python
en
code
0
github-code
90
38226884895
# Owner(s): ["oncall: aiacc"] import torch import torch.fx.experimental.fx_acc.acc_ops as acc_ops import torch.nn as nn from torch.testing._internal.common_fx2trt import AccTestCase from parameterized import parameterized from torch.testing._internal.common_utils import run_tests class TestNarrowConverter(AccTestCas...
fengbingchun/PyTorch_Test
src/pytorch/test/fx2trt/converters/acc_op/test_narrow.py
test_narrow.py
py
880
python
en
code
14
github-code
90
18107460449
import copy N = int(input()) def hoge(arg): return [arg[0], int(arg[1])] A = list(map(hoge, map(str, input().split()))) A1 = copy.deepcopy(A) A2 = copy.deepcopy(A) def bsort(C, N): for i in range(N): for j in range(N-1, i, -1): if C[j][1] < C[j-1][1]: C[j], C[j-1] = C[j-1...
Aasthaengg/IBMdataset
Python_codes/p02261/s556694860.py
s556694860.py
py
948
python
en
code
0
github-code
90