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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
442805106 | import tensorflow as tf
from PIL import Image
import cv2
import numpy as np
import uuid
import os
from .admin import model_path, label_path
from .utility import load_image_into_numpy_array, calculate_area, delete_and_create_folder, shortest_longest_area
import sys
sys.path.append("../models/research")
from object_det... | krishnakaushik25/Forecasting-Business-KPI | modular_code/src/ML_Pipeline/predict.py | predict.py | py | 5,576 | python | en | code | 0 | github-code | 6 |
32102340399 | from typing import List
class Solution:
def canJump(self, nums: List[int]) -> bool:
if not nums or len(nums) < 2:
return True
max_arrive = nums[0]
for i in range(1, len(nums)):
if max_arrive < i:
return False
max_arrive = max(max_arrive, ... | Eleanoryuyuyu/LeetCode | python/Greedy/55. 跳跃游戏.py | 55. 跳跃游戏.py | py | 398 | python | en | code | 3 | github-code | 6 |
34290631186 | """
1.Cambia el valor 10 en x a 15. Una vez que haya terminado, x ahora debería ser [[5,2,3], [15,8,9]].
2.Cambia el apellido del primer alumno de 'Jordan' a 'Bryant'
3.En el directorio sports_directory, cambia 'Messi' a 'Andres'
4.Cambia el valor 20 en z a 30 """
""" x = [ [5,2,3], [10,8,9] ]
x [1][0] = 15
print(x)... | Dominique-HL/python_fundamentals | funciones_intermediasII.py | funciones_intermediasII.py | py | 2,138 | python | en | code | 0 | github-code | 6 |
33585071155 | __author__ = 'Vivek'
#Search for a target element in rotated array , if element present then return index otherwise -1
def binSearch(A, B) :
"""
Binary Search Algorithm
"""
low = 0
high = len(A) - 1
result = -1
while low <= high :
mid = (low + high)/2
... | viveksyngh/InterviewBit | Binary Search/SEARCHROTATED.py | SEARCHROTATED.py | py | 1,515 | python | en | code | 3 | github-code | 6 |
16128682047 | def get_dist(start):
# BFSで距離を計算する
global N, D
d = [1e9] * (N + 1)
q = [start]
d[start] = 0
while len(q) > 0:
p = q.pop(0)
for t in D[p]:
if d[t] == 1e9:
d[t] = d[p] + 1
q.append(t)
return d
N = int(input())
D = [[] for _ in range... | keimoriyama/Atcoder | Tenkei/003.py | 003.py | py | 692 | python | en | code | 0 | github-code | 6 |
24905708193 | import cadquery as cq
import cadquery.selectors as cqs
import logging
import importlib
import utilities # TODO: Change to a relative import ".utilities" to preempt name clashes.
from types import SimpleNamespace as Measures
from math import sin, cos, radians
# A parametric cover that can be hooked to the top edge of a... | tanius/cadquery-models | lenscover/lens_cover.py | lens_cover.py | py | 23,912 | python | en | code | 11 | github-code | 6 |
41524463636 |
def print_main_menu(menu):
"""
Given a dictionary with the menu,
prints the keys and values as the
formatted options.
Adds additional prints for decoration
and outputs a question
"What would you like to do?"
"""
print('==========================')
print('What would yo... | katieli3/task-organizer | task_functions.py | task_functions.py | py | 22,169 | python | en | code | 0 | github-code | 6 |
21499361084 | import importlib
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import re
import seaborn as sns
import shutil
from datetime import timedelta
from file_read_backwards import FileReadBackwards
from functools import partial
from getpass import getuser
from openpyxl imp... | vicmcl/postpro | utils/misc.py | misc.py | py | 6,902 | python | en | code | 0 | github-code | 6 |
9752254935 | import functools
from flask_login import current_user, LoginManager
from flask import session
from src.model import UserModel
login_manager = LoginManager()
def roles_allowed(func=None, roles=None):
"""
Check if the user has at least one required role
:param func: the function to decorate
:param rol... | GreyTeam2020/GoOutSafe_microservice | gateway/src/auth.py | auth.py | py | 949 | python | en | code | 3 | github-code | 6 |
25131590072 | # /usr/bin/python
#**************TOPOLOGY *******************
# H1----------S1------------
# (10.0.1.10\24) \
# \
# H2---------S2---------CORE SWITCH------------S4---------SERVER(10.0.4.10/24)
# (10.0.1.20\24) / |
# ... | khyatimehta11/SDN-Mininet- | B part/topo and controller file/topob.py.py | topob.py.py | py | 2,384 | python | en | code | 1 | github-code | 6 |
34218162586 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 8 11:01:20 2022
@author: sonne
"""
#0. Imports
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import matplotlib.patches as patches
import matplotlib.animation as animation
import matplotlib.ticker as tick... | tappelnano/molecular_dynamics | 2022_02_13_C5_Molekulardynamik.py | 2022_02_13_C5_Molekulardynamik.py | py | 22,402 | python | de | code | 0 | github-code | 6 |
11961734737 | #!/usr/bin/env python
import unittest
import rospy
import rostest
from pprint import pprint
from rospy_message_transporter.msg import HeartbeatMessage
from rospy_message_transporter.JsonFormatter import JsonFormatter
class TestMessageFormatter(unittest.TestCase):
def test_json_formatter_instanciation(self):
... | mfsriti/rospy_message_transporter | test/test_message_formatter.py | test_message_formatter.py | py | 2,690 | python | en | code | 0 | github-code | 6 |
12260712099 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import pymysql
money_all=56.75+2+938.7+83.2
money_all_str=str(money_all)
print(money_all_str)
money_real=int(money_all)
print(str(money_real))
print(7/3)
print(7//5)
print(35<54)
def sort(x):
return x['price']
mydb=pymysql.connect(
host="localhost",
use... | hedychium/python_learning | erase_zero.py | erase_zero.py | py | 459 | python | en | code | 0 | github-code | 6 |
3037493070 | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
arr = sorted([int(input()) for _ in range(n)])
def sol(m):
i = 1 # 불가능한 시간의 최댓값
M = m*arr[0] # 가능한 시간의 최댓값
if len(arr)== 1:
return M
while M-i>=2:
j = (i+M)//2 # 중간값
s = 0 # 심사 받은 인원의 수
... | sunyeongchoi/sydsyd_challenge | argorithm/3079_gw.py | 3079_gw.py | py | 877 | python | ko | code | 1 | github-code | 6 |
71243441147 | import random
import string
#Image:一个画布
#ImageDraw:一个画笔
#ImageFont:画笔的字体
from PIL import Image,ImageDraw,ImageFont
#Captcha验证码
class Captcha(object):
#生成几位验证码
number = 4
#验证码图片的宽度和高度
size = (100,30)
#验证码字体大小
fontsize = 25
#加入干扰线的条数
line_number = 2
# 构建一个验证码源文件
SOURCE = list(str... | lubocsu/BBS | tool/captcha/__init__.py | __init__.py | py | 2,943 | python | en | code | 23 | github-code | 6 |
39249799524 | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
ans = []
def inorder(root):
if root is not None:
if root.left:
inorder(root.left)
ans.append(root.val)
if root.right:
... | midnightbot/snapalgo | snapalgo/template_generator/inorder.py | inorder.py | py | 369 | python | en | code | 2 | github-code | 6 |
21884337737 | """
Series of galactic operations (doesn't that sound cool?!).
...as in converting coordinates, calculating DM etc.
"""
from datetime import timedelta
import ctypes as C
import math
import numpy as np
import os
import pandas as pd
import random
from frbpoppy.paths import paths
# Import fortran libraries
uni_mods = o... | TRASAL/frbpoppy | frbpoppy/galacticops.py | galacticops.py | py | 22,052 | python | en | code | 26 | github-code | 6 |
72739113148 | from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.platypus import Paragraph
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.enums import TA_JUSTIFY
def generate_prescription(patient_name, doctor_name, medicine_list, logo_p... | kothawleprem/MedConnect | templates/main.py | main.py | py | 4,423 | python | en | code | 0 | github-code | 6 |
42197867431 | from django.test import TestCase
from feedback.forms import FeedbackForm
class TestForms(TestCase):
def test_feedback_form_valid_data(self):
form = FeedbackForm(data={
'titolo': 'Recensione',
'descrizione': 'Una descrizione',
'voto': 5
})
self.assertTr... | lucacasarotti/CineDate | feedback/tests/test_forms.py | test_forms.py | py | 506 | python | en | code | 0 | github-code | 6 |
35729401904 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# from multiprocessing.pool import ThreadPool
import threading
from time import sleep
import requests
from selenium import webdriver
from bs4 import BeautifulSoup
import output as op
class FlaskScraper:
# groupName: webUrl
dictOfNameAndWebUrl = {}
# weburl: webCont
dictO... | clamli/fdatanotice | scraper.py | scraper.py | py | 8,975 | python | en | code | 0 | github-code | 6 |
26826438134 | #! /usr/bin/env python
import sys
import copy
import rospy
import actionlib
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
import numpy as np
from std_msgs.msg import Int32
from policies.policies import Policy, PositionPolicy, GripperCurrentPolicy, TactilePolicy
from tams_tactile_sensor_array.... | TAMS-Group/tams_fabric_grasping | src/grasp_action_server.py | grasp_action_server.py | py | 12,057 | python | en | code | 1 | github-code | 6 |
27267958481 | from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from rest_framework.parsers import JSONParser
from django.http.response import JsonResponse
from viteproject.models import DesignSave
from viteproject.serializers import DesignSaveSerializer
from django.core.files.storage import ... | SurajBhosale003/Osdag-React-Django | backend/viteproject/views.py | views.py | py | 1,795 | python | en | code | 0 | github-code | 6 |
9805159119 | import multiprocessing
# Gunicorn app
# Tell Gunicorn which application to run
wsgi_app = "django_examples.asgi:application"
# Requests
# Restart workers after so many requests, with some variability.
max_requests = 1000
max_requests_jitter = 50
# Logging
# Use stdout for logging
log_file = "-"
# Workers
bind = "0.... | andrewguest/django-alpine-htmx | gunicorn.conf.py | gunicorn.conf.py | py | 425 | python | en | code | 0 | github-code | 6 |
27264200550 | """
Plot.py
Created 21/12/2021
"""
from juzzyPython.generic.Tuple import Tuple
from juzzyPython.generalType2zSlices.sets.GenT2MF_Interface import GenT2MF_Interface
from juzzyPython.type1.sets.T1MF_Interface import T1MF_Interface
from juzzyPython.generalType2zSlices.sets.GenT2MF_Triangular import GenT2MF_Triangular
fro... | LUCIDresearch/JuzzyPython | juzzyPython/generic/Plot.py | Plot.py | py | 12,826 | python | en | code | 4 | github-code | 6 |
23856995507 | from memoizer import Memoizer
import re
import os
import glob
from crawl_utils import RAWDATA_PATH
R = re.compile
MORGUE_BASES = [
[ R(r'cao-.*'), 'http://crawl.akrasiac.org/rawdata' ],
[ R(r'cdo.*-0.4$'), 'http://crawl.develz.org/morgues/0.4' ],
[ R(r'cdo.*-0.5$'), 'http://crawl.develz.org/morgues/0.5' ... | elliptic/dcss_scoring | morgue.py | morgue.py | py | 4,018 | python | en | code | 1 | github-code | 6 |
4998438472 | import re
from odoo import api, fields, models, tools, _
from odoo.exceptions import ValidationError
from odoo.osv import expression
from odoo.exceptions import UserError, ValidationError
import odoo.addons.decimal_precision as dp
class ProductCategory(models.Model):
_inherit="product.category"
@api.mod... | odoocjpl/warehouse_custom | models/product_category.py | product_category.py | py | 5,581 | python | en | code | 0 | github-code | 6 |
13105799926 | class Solution(object):
def sortPeople(self, names, heights):
"""
:type names: List[str]
:type heights: List[int]
:rtype: List[str]
"""
dList = []
for i in range(len(heights)):
temp = [heights[i], [names[i]]]
... | MasoudKarimi4/Leetcode-Submissions | 2418-sort-the-people/2418-sort-the-people.py | 2418-sort-the-people.py | py | 581 | python | en | code | 0 | github-code | 6 |
41562680413 | '''Hash Table
Description: Are used to store [key-value] pairs, they are like arrays, but the
keys are not ordened. Unlike arrays, hash tables are fast for all of the follo
wing operations: finding values, adding new values, or removing values.
Big O: Average Case
Insert: O(1)
Deletion: O(1)
Access: O(1)
'''
WEIRD... | Wainercrb/data-structures | hash-table/main.py | main.py | py | 1,787 | python | en | code | 0 | github-code | 6 |
75254285948 | #/usr/env/python3
"""
This program combines the data directory reference file with
a .words file to create a vardial3 format gold file.
"""
import sys
# list of dialects borrowed from ../scripts/eval.py
langList=['EGY', 'GLF', 'LAV', 'MSA','NOR']
# first set up hash from metadata to dialect number
fr = open('../../... | StephenETaylor/vardial4 | v17/dialectID/data/reference2gold.py | reference2gold.py | py | 764 | python | en | code | 0 | github-code | 6 |
11769598800 | #Calculating tax for multiple state
from my_functions import conv_numbers
while True:
order = conv_numbers(input('Enter your order amount :'))
if order:
break
state = input("Enter your state of residence :")
state = state.lower()
if state == 'wisconsin' or state == 'wi':
county = input("""Enter ... | Kamalabot/Programmers57Challenges | exe20_multiState.py | exe20_multiState.py | py | 812 | python | en | code | 1 | github-code | 6 |
75097112828 | #Adding Elements to a Queue
class Queue:
def __init__(self):
self.queue = list()
def addtoq(self,dataval):
# Insert method to add element
if dataval not in self.queue:
self.queue.insert(0,dataval)
return True
return False
def size(self):
return len(self.queue)
TheQu... | ishita2108/python_ds | queue.py | queue.py | py | 1,661 | python | en | code | 0 | github-code | 6 |
69958752189 |
import time
import pandas as pd
# df = pd.read_csv("trades.csv", header=None, names=["num","time","side","lot","sym","o","c","pip","size","pips"])
df = pd.read_csv("FASTWAY.csv")
# df = pd.read_csv("FASTWAYINETH.csv")
# df = pd.read_csv("NORTHEASTWAYINBTC.csv")
df.drop(columns=["num"], inplace=True)
pd.t... | amirayat/Copyfx-Scraper-Analysis | analysis/analysis.py | analysis.py | py | 1,943 | python | en | code | 1 | github-code | 6 |
36106930014 | import pyperclip
import re
matchPhone = re.compile(r'''(
(\d{3}|\(\d{3}\)) # area code
(\s|-|\.) # separator
(\d{3}) # first 3 digits
(\s|-|\.) # separator
(\d{4}) ... | kaisteussy/AtBS | automate_the_boring_stuff/Chapter 7/phoneAndEmail.py | phoneAndEmail.py | py | 1,355 | python | en | code | 0 | github-code | 6 |
29358742213 | from Qt import QtGui, QtCore, QtWidgets, Qt
from ts2.scenery import abstract, helper
from ts2 import utils
translate = QtWidgets.qApp.translate
class TextItem(abstract.TrackItem):
"""A TextItem is a prop to display simple text on the layout
"""
def __init__(self, parameters):
"""Constructor for ... | ts2/ts2 | ts2/scenery/textitem.py | textitem.py | py | 2,872 | python | en | code | 43 | github-code | 6 |
15068023113 | from os import name
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="home"),
path('about/', views.about, name="about"),
path('join_us/', views.join_us, name="join_us"),
path('hotel_detail/<int:hotel_id>/',
views.hotel_detail, name="hotel_detail"),
... | leenabadgujar/Online_Tiffin_Service | food/urls.py | urls.py | py | 935 | python | en | code | 0 | github-code | 6 |
35396164763 | import codecs
import unittest
from asyncssh.asn1 import der_encode, der_decode
from asyncssh.asn1 import ASN1EncodeError, ASN1DecodeError
from asyncssh.asn1 import BitString, IA5String, ObjectIdentifier
from asyncssh.asn1 import RawDERObject, TaggedDERObject, PRIVATE
class _TestASN1(unittest.TestCase):
"""Unit te... | ronf/asyncssh | tests/test_asn1.py | test_asn1.py | py | 7,788 | python | en | code | 1,408 | github-code | 6 |
71840534267 | # coding=utf8
from validate_email import validate_email
if __name__ == '__main__':
f = open("stargazers_email.txt", "r")
emails = f.readlines()
emails = [line.rstrip('\n') for line in emails]
valid_email = []
for i in range(len(emails)):
is_valid = validate_email(emails[i], verify=True)
print(is_valid)
if ... | haoshuai999/Master-project | validate_stargazers_email.py | validate_stargazers_email.py | py | 494 | python | en | code | 0 | github-code | 6 |
21139527922 | #!/usr/bin/env python3
import time
from pymavlink import mavutil
from trunk import *
#from colored import fg, bg, attr
from colored import fg, bg, attr
#if get_Setting('mainLoopStatus', 'status.json', 0) == "closed":
# print("Warning: Manual override enabled")
# set_Setting('mainLoopStatus', 'manual', 'status.json', 1... | j07rdi/controlzero_testing | mavlink_test.py | mavlink_test.py | py | 3,092 | python | en | code | 1 | github-code | 6 |
24367084112 | import numpy as np
import cv2 as cv
image = cv.imread('lena.jpg')
image = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
img = np.array(image)
height = image.shape[0]
width = image.shape[1]
kernel= np.array([[-1, -1, -1],[-1, 8, -1], [-1, -1, -1]])
#print(kernel)
m= kernel.shape[0]//2
w=h=3
conv= np.zeros(image.shape)
for i ... | maximana99/kernel-python | main.py | main.py | py | 589 | python | en | code | 0 | github-code | 6 |
11046567215 | import urllib.request, json
import pytz
from datetime import datetime
dateTimeStr=datetime.utcnow().replace(tzinfo=pytz.utc)
def jsonReaderScooter(urlToOpen):
with urllib.request.urlopen(urlToOpen) as url:
data = json.loads(url.read().decode())
retStr='lat,lon,isdisabled,time\n'
try:
with op... | hjames034/scooterRecordLA | parseScooter.py | parseScooter.py | py | 941 | python | en | code | 0 | github-code | 6 |
40187735381 | from luigi.contrib.postgres import CopyToTable
from src.utils.general import read_yaml_file
from src.utils.utils import load_df
from src.pipeline.LuigiBiasFairnessTaskRDS import BiasFairnessTask
#from src.pipeline.ingesta_almacenamiento import get_s3_client
from datetime import date
from time import gmtime, strftime
im... | Acturio/DPA-Project | src/pipeline/LuigiBiasFairnessTestTask.py | LuigiBiasFairnessTestTask.py | py | 3,890 | python | en | code | 0 | github-code | 6 |
28792513287 | MENU = {
"espresso": {
"ingredients": {
"water": 50,
"coffee": 18,
},
"cost": 1.5,
},
"latte": {
"ingredients": {
"water": 200,
"milk": 150,
"coffee": 24,
},
"cost": 2.5,
},
"cappuccino": {
... | Mohamed-Rirash/100-days-python-challenge | day15/coffee_machine.py | coffee_machine.py | py | 2,823 | python | en | code | 0 | github-code | 6 |
650134167 | #! /usr/bin/python
import os
import sys
import json
import luigi
import numpy as np
import vigra
import nifty.ufd as nufd
import cluster_tools.utils.volume_utils as vu
import cluster_tools.utils.function_utils as fu
from cluster_tools.cluster_tasks import SlurmTask, LocalTask, LSFTask
#
# Find Labeling Tasks
#
cl... | constantinpape/cluster_tools | cluster_tools/connected_components/merge_assignments.py | merge_assignments.py | py | 4,231 | python | en | code | 32 | github-code | 6 |
42758646277 | #!/usr/bin/env python
import sys, os
from cavan_adb import AdbManager
class AndroidManager(AdbManager):
def __init__(self, verbose = True):
buildTop = self.getEnv("ANDROID_BUILD_TOP")
productOut = self.getEnv("ANDROID_PRODUCT_OUT")
if not buildTop or not productOut:
self.doRaise("please run 'source build/en... | FuangCao/cavan-20150921 | script/python/cavan_android.py | cavan_android.py | py | 2,230 | python | en | code | 0 | github-code | 6 |
41550930434 | import contextlib, os, signal
from . import log, pid_context
SIGNAL_NUMBERS = {k: v for k, v in signal.__dict__.items()
if k.startswith('SIG') and '_' not in k}
SIGNAL_NAMES = {v: k for k, v in SIGNAL_NUMBERS.items()}
STOP_SIGNALS = 'SIGINT', 'SIGTERM'
RESTART_SIGNALS = 'SIGHUP',
HANDLED_SIGNALS = ... | ManiacalLabs/BiblioPixel | bibliopixel/util/signal_handler.py | signal_handler.py | py | 2,465 | python | en | code | 263 | github-code | 6 |
30917930824 | import os
import shutil
import sys
import pandas as pd
import numpy as np
l_sys = sys.path
l_path = l_sys[['tests' in i for i in l_sys].index(True)]
l_path = l_path.replace("tests", '')
l_path = l_path + "/tnbs/"#BTC_03_QPE/"
sys.path.append(l_path)
sys.path.append(l_path+"BTC_04_PH")
from BTC_04_PH.my_benchmark_execu... | NEASQC/WP3_Benchmark | tests/test_btc_04_ph.py | test_btc_04_ph.py | py | 2,857 | python | en | code | 0 | github-code | 6 |
10057572506 |
def unionofList(list1,list2):
list1.extend(list2)
unionList=set(list1)
print(unionList)
def intersection(list1,list2):
size1=len(list1)
size2=len(list2)
if(size1<size2):
size1,size2=size2,size1
for i in list1:
if i not in m:
m[i]=1
else:
m[i]+... | FarhanTahmid/Problem-Solving | Array Problems - Geeks For Geeks/Level 1/problem10.py | problem10.py | py | 858 | python | en | code | 0 | github-code | 6 |
13865138503 | import argparse
import datetime
import json
import os
from itertools import zip_longest
from pathlib import Path
from typing import List, Optional, Tuple
import gpxpy
from rich import box
from hiking.import_export import JSON_IMPORT_EXAMPLE
from hiking.models import Hike
from hiking.utils import DATA_HOME, DEFAULT_BO... | open-dynaMIX/hiking | hiking/arg_parsing.py | arg_parsing.py | py | 10,991 | python | en | code | 0 | github-code | 6 |
41708182518 | from model.siamese.config import cfg
import tensorflow as tf
import numpy as np
import math
from abc import ABC
import os
def create_model(trainable=True):
input_shape = (cfg.NN.INPUT_SIZE, cfg.NN.INPUT_SIZE, 3)
input_tensor = tf.keras.layers.Input(shape=input_shape)
base = tf.keras.applications.MobileNe... | burnpiro/farm-animal-tracking | model/siamese/classification_model.py | classification_model.py | py | 2,228 | python | en | code | 24 | github-code | 6 |
38735062705 | import itertools
import math
from time import sleep
def posible_sums(num):
posibilities = []
divisor = 1
while divisor < num:
current = num / divisor
while not current.is_integer():
divisor += 1
current = num / divisor
divisor +... | acalasanzs/pyeuler | 250/250.py | 250.py | py | 580 | python | en | code | 0 | github-code | 6 |
16132746633 | '''
mobile monkey
'''
import time
from typing import List
from threading import Thread
import config_reader as config
import emulator_manager
import api_commands
from telnet_connector import TelnetAdb
from telnet_connector import GsmProfile
from telnet_connector import NetworkDelay
from telnet_connector import NetworkS... | LordAmit/mobile-monkey | mobile_monkey.py | mobile_monkey.py | py | 8,654 | python | en | code | 4 | github-code | 6 |
43344834943 | import unittest
import mock
import time
from copy import deepcopy
from gorynych.common.domain import events
from gorynych.common.exceptions import DomainError
from gorynych.info.domain.test.helpers import create_contest
from gorynych.info.domain import contest, person, race
from gorynych.common.domain.types import Ad... | DmitryLoki/gorynych | gorynych/info/domain/test/test_contest.py | test_contest.py | py | 10,466 | python | en | code | 3 | github-code | 6 |
11735874338 | import sys
import enum
from sqlalchemy import Column, DateTime, Integer, String, ForeignKey, Table
from sqlalchemy.orm import relationship, backref
from rhinventory.extensions import db
class SimpleAssetAttribute():
name: str
def __str__(self) -> str:
return f"{self.name}"
def asset_n_to_n_table(oth... | retroherna/rhinventory | rhinventory/models/asset_attributes.py | asset_attributes.py | py | 3,448 | python | en | code | 1 | github-code | 6 |
45636612723 | import pytest
from page_objects.sign_in_page_object import SignInPage
from utils.read_excel import ExcelReader
@pytest.mark.usefixtures("setup")
class TestRegistration():
@pytest.mark.parametrize("reg_data", ExcelReader.get_reg_data())
def test_registration_initial_form(self, reg_data):
sign_in_pa... | mcwilk/Selenium_automation | tests/registration_test.py | registration_test.py | py | 544 | python | en | code | 0 | github-code | 6 |
5461750614 | #Gets the longitude and latittude for an address using the Google Maps API
import json
import time
import pandas as pd
import urllib.error
import urllib.parse
import urllib.request
#Gets api key from txt file
with open(r".txt","r") as file:
API_KEY = r"&key=" + file.readline()
GEO_URL = r"https://ma... | randr000/MyPythonScripts | get_lat_lon_Google.py | get_lat_lon_Google.py | py | 1,674 | python | en | code | 0 | github-code | 6 |
2028366431 | #Aiswarya Sankar
#8/5/2015
import webapp2
import jinja2
import os
import logging
import hashlib
import hmac
import re
import string
import random
import time
import math
import urllib2
import json
from google.appengine.ext import db
from google.appengine.api import urlfetch
from google.appengine.api import memcache
... | aiswaryasankar/mock2 | main.py | main.py | py | 17,647 | python | en | code | 0 | github-code | 6 |
26806868269 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 17:29:26 2019
@author: dell
"""
from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup as bs
url = "https://www.google.com/"
browser = webdriver.Chrome("E:\\Study\\Project_4_Web_Scrapping\\chromedriver.exe")
browser.get(url)
... | lavish71/Forsk_2019 | Project_4_Web_Scrapping/Project_4_2/Project_4_2_2.py | Project_4_2_2.py | py | 665 | python | en | code | 0 | github-code | 6 |
25135340045 | from flask import Flask, request, render_template
from chatXYZ import run, run_test
import logging
# API Key
from config import openai_api_key
log_handler = logging.StreamHandler()
log_formatter = logging.Formatter("%(asctime)s - %(message)s")
log_handler.setFormatter(log_formatter)
logger = logging.getLogger()
log... | rikab/ChatXYZ | main.py | main.py | py | 2,111 | python | en | code | null | github-code | 6 |
72274308029 | import datetime
import inspect
import json
import logging
from typing import Callable, Dict, List, Union
_JSON_INDENT = 4
_JSON_SEPERATORS = (",", ": ")
_DEPTH_RECURSION_DEFAULT = 1
_DEPTH_RECURSION_GET_LOGGER = 2
_DEPTH_RECURSION_JSON_LOGGER = 3
_LOGGING_LEVEL = logging.INFO if not __debug__ else logging.DEBUG
_FOR... | novus-inc/pylogger | pylogger/pylogger.py | pylogger.py | py | 9,703 | python | en | code | 0 | github-code | 6 |
27265911454 | import time
import json
from scrape_linkedin.utils import AnyEC
from scrape_linkedin.Profile import Profile
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import Timeout... | DumbMachine/linkedin | person.py | person.py | py | 5,813 | python | en | code | 0 | github-code | 6 |
2732586952 | #-_- coding: utf-8 -_-
from signature import settings
from control.middleware.config import RET_DATA, apple_url
from control.middleware.common import get_random_s
import re
import json
import logging
import datetime
import requests
import random
import time
import jwt
logger = logging.getLogger('djang... | lessknownisland/signature | apple/middleware/api.py | api.py | py | 10,781 | python | en | code | 0 | github-code | 6 |
19670935871 | from konlpy.tag import Kkma, Okt
from pandas import DataFrame as df
from gensim.models.word2vec import Word2Vec
import pandas as pd
import logging
import time
import re
import os
import matplotlib as mpl
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.cl... | gusals6804/TopicModelling | Word2Vec.py | Word2Vec.py | py | 6,481 | python | en | code | 0 | github-code | 6 |
3508415121 | #!/usr/bin/env python3
import sys
if __name__ == "__main__":
repl = {}
poly = {}
for l in open(sys.argv[1] if len(sys.argv) > 1 else '14-input'):
l = l.strip()
if '->' in l:
a, b = l.split(' -> ')
repl[a] = b
elif l:
for i in range(0, len(l) - 1)... | pboettch/advent-of-code | 2021/14.py | 14.py | py | 1,087 | python | en | code | 1 | github-code | 6 |
30763374181 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 26 15:42:17 2016
@author: Shahidur Rahman
"""
import explorers
import stringRecorder
import pandas
from sqlalchemy import create_engine
import random
from mmh3 import hash128
#from sklearn.datasets import load_iris
import warnings
warnings.filterwarnings("... | skshahidur/nlp_paper_implementation | Word-Embedding/mwt_v1.py | mwt_v1.py | py | 4,021 | python | en | code | 0 | github-code | 6 |
33371549713 | #---!/usr/bin/env python
#--- -*- coding: utf-8 -*-
# Librerias
import re
import sys
import json
import string
import random
import operator
import unicodedata
sys.stdout.encoding
'UTF-8'
# Libreria NLTK
import nltk
nltk.download('punkt')
nltk.download('stopwords')
from nltk.tokenize.toktok import ToktokTokenizer
f... | SoraGefroren/Practicas_relacionadas_al_NLP_utilizando_Python | Práctica_04-Wiki/relaciones.py | relaciones.py | py | 6,622 | python | es | code | 0 | github-code | 6 |
27146623453 | from UserSimulator.User import User
from UserSimulator.user_behavior import calculate_session_length, Devices, load_spotify, playback_decision
from datetime import datetime
from datetime import timedelta
import random
import time
from json import load
import pickle
import json
import csv
import requests
from DataPrepro... | dyllew3/Timing-Attacks-Against-Opennym | MillionSongDataset/simulate_user.py | simulate_user.py | py | 12,732 | python | en | code | 0 | github-code | 6 |
38058129584 | from lib.processors import findFaceGetPulse
import networkx as nx
"""
Simple tool to visualize the design of the real-time image analysis
Everything needed to produce the graph already exists in an instance of the
assembly.
"""
#get the component/data dependancy graph (depgraph) of the assembly
assembly = findFaceGe... | noahcse/webcam_pulse_detect | make_design_graph.py | make_design_graph.py | py | 615 | python | en | code | 1 | github-code | 6 |
28541533714 | import aes_new
import os
import sys
def encrypt_img(input, key, aes, iv, mode):
#input = [255, 255, 255, 255, 5, 6, 7, 7, 7, 7, 11, 12, 13, 254, 15, 240]
if mode == 'ECB' or mode == 'CBC':
plaintext = [0, 0, 0, 0]
i = 0
max = (len(input)//16)
ciphertext_arr = [ ]
for i in... | ilshatKam/aes-image-encrypt | test_image.py | test_image.py | py | 1,192 | python | en | code | 0 | github-code | 6 |
2279356920 | import gtk
import mailanie
class Preferences(gtk.Dialog):
def __init__(self):
super(Preferences, self).__init__(
_("Mailanie Preferences"),
buttons=(gtk.STOCK_APPLY, gtk.RESPONSE_APPLY,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, g... | liZe/Mailanie | mailanie/ui/preferences.py | preferences.py | py | 6,586 | python | en | code | 5 | github-code | 6 |
14810439425 | import os, sys
from os.path import join as ospj
import torch
import numpy as np
from PIL import Image
import torch.utils.data as data
import kornia
import argparse
from logger import Logger
class PairedImageDataset(data.Dataset):
def __init__(self, lr_img_path, lr_filelist_path, hr_img_path, hr_filelist_path, args... | mengyuest/satellite2aerial | learn_crop.py | learn_crop.py | py | 5,572 | python | en | code | 0 | github-code | 6 |
11045109174 | def interfaces(interface_list):
header = "{:<12} {:<16} {:<7} {:<4} {:<12} {:<12}".format('Interface', 'IP Address', 'Method', 'OK?', 'Connected', 'Operational')
header += '\n-----------------------------------------------------------------------------\n'
entries = ''
for interface in interface_list:
... | KarimKabbara00/Network-Simulator | network/show_commands/RouterShowCommands.py | RouterShowCommands.py | py | 2,160 | python | en | code | 0 | github-code | 6 |
75136491707 | from dialogic.adapters import VkAdapter
from dialogic.dialog import Response
def test_keyboard_squeeze():
resp = Response(text='не важно', suggests=[
'удалить направление', 'Агропромышленный комплекс', 'Вооружение и военная техника',
'Естественные науки', 'Инженерные науки и технологии', 'Искусств... | avidale/dialogic | tests/test_adapters/test_vk_adapter.py | test_vk_adapter.py | py | 1,089 | python | ru | code | 22 | github-code | 6 |
7807067398 | from metagame_balance.cool_game import BotType
import numpy as np
class CoolGameMetaData:
def __init__(self):
self._winrates = np.zeros((len(BotType), len(BotType)))
# in the ERG formulation, this is a table that you take the entropy of
# in the policy entropy case, you learn a utility fun... | nianticlabs/metagame-balance | src/metagame_balance/cool_game/metadata.py | metadata.py | py | 823 | python | en | code | 3 | github-code | 6 |
42411316279 | # -*- coding: utf-8 -*-
#
# File: BPDParticipante.py
#
# Copyright (c) 2011 by Conselleria de Infraestructuras y Transporte de la
# Generalidad Valenciana
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Publi... | carrascoMDD/gvSIG-bpd | gvSIGbpd/BPDParticipante.py | BPDParticipante.py | py | 25,254 | python | en | code | 0 | github-code | 6 |
43269447803 | """
Django settings for msca_provisioner project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... | uw-it-aca/msca-provisioner | msca_provisioner/settings.py | settings.py | py | 8,632 | python | en | code | 1 | github-code | 6 |
5035337247 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('authentication_module', '0004_auto_20160801_2318'),
]
operations = [
migrations.AddField(
model_name='customuser... | DirectorioTurismoComercio/BackEnd | authentication_module/migrations/0005_customuser_tipo_cuenta.py | 0005_customuser_tipo_cuenta.py | py | 492 | python | en | code | 0 | github-code | 6 |
25068902425 | import unittest
from unittest.mock import patch
import purplship
from purplship.core.utils import DP
from purplship.core.models import RateRequest
from tests.dhl_poland.fixture import gateway
class TestDHLPolandRating(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.RateRequest = Rate... | danh91/purplship | sdk/extensions/dhl_poland/tests/dhl_poland/rate.py | rate.py | py | 2,268 | python | en | code | null | github-code | 6 |
21052465999 |
from pylib.android.log import log
import re
import pylib.basic.re_exp.re_exp as re_exp
class EventLog(log.Log):
def __init__(self, path=None):
log.Log.__init__(self, path)
if self.logs is not None:
self.logs['file'] = 'evnet'
def _match_pids(self, log):
pat = None
... | cttmayi/pylib | pylib/android/log/event_log.py | event_log.py | py | 2,702 | python | en | code | 0 | github-code | 6 |
16701006334 | import os
import sys
from xml.etree import ElementTree
def isPlaylistUpdated(cmusPlaylistFile, jellyfinMusicPathArray) :
cmusMusicPathArray = open(cmusPlaylistFile, 'r').read().splitlines()
if len(cmusMusicPathArray) != len(jellyfinMusicPathArray) :
return True
length = len(cmusMusicPathArray)
... | nate-1/playlist-jellyfin-cmus-interface | main.py | main.py | py | 1,427 | python | en | code | 0 | github-code | 6 |
28377193501 | import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Flatten
from keras.datasets import mnist
from keras.utils import to_categorical
import matplotlib.pyplot as plt
# 载入MNIST数据集
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# 将像素值标准化到 0 到 1 之间
x_train, x_test = ... | Ldh88/112-LiDingHui-ShangHai | 112-李鼎辉-上海/第八周作业/cv_tensorflow_keras.py | cv_tensorflow_keras.py | py | 1,333 | python | en | code | null | github-code | 6 |
35940096218 | import pygame
import random
from typing import Callable
from pygame import Vector2, Rect, Color, Surface
pygame.init()
class Signal:
def __init__(self):
self.handlers = []
def connect(self, handler: callable) -> None:
self.handlers.append(handler)
def disconnect(self, handler:... | cliegc/simple-roguelike-game | main.py | main.py | py | 32,075 | python | en | code | 0 | github-code | 6 |
35912386575 | #coding=utf-8
"""
imgcv
"""
from setuptools import setup
from setuptools import find_packages
install_requires = [
]
setup(
name = "imgcv",
version = "1.0.0",
description = 'image computer visior',
author='Hyxbiao',
author_email="hyxbiao@gmail.com",
packages = find_packages(),
entry_point... | hyxbiao/imgcv | setup.py | setup.py | py | 537 | python | en | code | 0 | github-code | 6 |
16294942824 | import functools
import os
import re
import requests
import csv
import sys
from datetime import time, timedelta
import argparse
#print(response.json())
class event_type:
GOAL = 0
PENALTY = 1
ASSIST = 2
class game_event:
def toPeriod(self, int_period):
int_period = int(int_period)
if... | SolidSnackDrive/hockepy_viaha | hockey.py | hockey.py | py | 8,307 | python | en | code | 0 | github-code | 6 |
856594294 | from __future__ import division
from vistrails.db.domain import DBPEFunction, DBPEParameter
from vistrails.core.paramexplore.param import PEParam
import copy
import unittest
from vistrails.db.domain import IdScope
################################################################################
class PEFunction(DBPE... | VisTrails/VisTrails | vistrails/core/paramexplore/function.py | function.py | py | 5,283 | python | en | code | 100 | github-code | 6 |
2056234872 | import tensorflow as tf
def accuracy(output, target, top_k=(1,)):
"""
output : [10, 6]
target: [10]
"""
max_k = max(top_k)
batch_size = target.shape[0]
pred = tf.math.top_k(output, max_k).indices # [10, 6]
pred = tf.transpose(pred, perm=[1, 0]) # [6, 10] to compare top_1, top_2,... bet... | lykhahaha/Mine | Tf-tutorial/lesson16_topk.py | lesson16_topk.py | py | 863 | python | en | code | 0 | github-code | 6 |
7811594670 | from qiskit import *
from qiskit.visualization import plot_histogram
from qiskit.visualization import plot_state_city, plot_bloch_multivector
from qiskit.visualization import plot_state_paulivec, plot_state_hinton
from qiskit.visualization import plot_state_qsphere
# quantum circuit to make a Bell state
bell = ... | xhaeng06x/quantum_computing | codingproject/whatsyoureta/ETA_3Qiskit 시각화하기/ETA-3 여러가지 시각화 도구main.py | ETA-3 여러가지 시각화 도구main.py | py | 1,705 | python | en | code | 0 | github-code | 6 |
22525757483 | """
Author: Matthew Smith (45326242)
Date: 15/04/2021
Title: AERO4450 Design Report Progress Check
"""
import numpy as np
import matplotlib.pyplot as plt
import math
import scipy.sparse as sps
import scipy.sparse.linalg as splinalg
# Parameters
M_N2 = 28 # g/mol
M_F2 = 44 # g/mol
M_O2 = 32 # g/mol
mdo... | msmit677/AERO4450 | AERO4450_Combustion_Modelling.py | AERO4450_Combustion_Modelling.py | py | 9,866 | python | en | code | 0 | github-code | 6 |
17509582783 | from treenode import TreeNode
from tree_builder import build_tree, get_node
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""use dfs to build path between root and given node"""
def traverse(v, w, a):
a.append(w)
... | soji-omiwade/cs | dsa/before_rubrik/lowest_common_ancestor.py | lowest_common_ancestor.py | py | 1,079 | python | en | code | 0 | github-code | 6 |
38649606721 | import threading
import time
# 使用线程来执行类的成员函数,则类必须定义run方法,并且必须继承threading类
# 调用start的时候,自动调用run方法,run方法结束了,那么线程也结束了
class MyThread(threading.Thread):
def run(seft):
for i in range(3):
time.sleep(1)
msg = "I'm " + seft.name + ' @ ' + str(i)
print(msg)
if __name__ == "__m... | Vieran/network_programming | multi_process_or_thread/thread/demo3.py | demo3.py | py | 475 | python | zh | code | 0 | github-code | 6 |
7143818426 | from player import *
from gameMap import *
from creature import *
from item import *
from treasure import *
import random as r
fullMap = []
newMap = gameMap(20,20, fullMap)
newPlayer = Player(2, 9, 9, 20, 5, "P")
running = True
numCreatures = 10
numTreasure = 30
numLocked = r.randint(0, numTreasure)
numOpen = numTreas... | HydraHYD/OOP-Final | application.py | application.py | py | 7,659 | python | en | code | 0 | github-code | 6 |
33042404005 | """Helpers for tests."""
import json
import pytest
from .common import MQTTMessage
from tests.async_mock import patch
from tests.common import load_fixture
@pytest.fixture(name="generic_data", scope="session")
def generic_data_fixture():
"""Load generic MQTT data and return it."""
return load_fixture("ozw/... | 84KaliPleXon3/home-assistant-core | tests/components/ozw/conftest.py | conftest.py | py | 2,850 | python | en | code | 1 | github-code | 6 |
5309163060 | # 투포인터
def trap(heights):
if not heights:
return 0
volume = 0
left, right = 0, len(heights)-1
left_max, right_max = heights[left], heights[right]
while left <= right:
left_max, right_max = max(heights[left], left_max), max(
heights[right], right_max)
# 더 높은쪽으로 ... | louisuss/Algorithms-Code-Upload | Python/Tips/questions/trapping_rain+.py | trapping_rain+.py | py | 1,182 | python | ko | code | 0 | github-code | 6 |
34608382125 | import sys
import pygame
from setting import Settings
from setting import Ship
import game_functions as gf
def run_game():
# Initialize game and create a screen object.
pygame.init()
ai_settings = Settings()
screen = pygame.display.set_mode(
(ai_settings.screen_width, ai_settings.... | andy-miao-gu/preply_by_umair | old/okbruhpygame.py | okbruhpygame.py | py | 749 | python | en | code | 0 | github-code | 6 |
20859673703 | import pymunk
import pymunk.pygame_util
import pygame
from classes.ammo.ammo_box import AmmoBox
from classes.coin.coin import Coin
import os
import random
import math
from functions.math import get_xys, get_distance
class Enemy:
def __init__(self, game, space, radius, pos):
self.game = game
... | matej-kotrba/python-survival-game | classes/enemies/basic.py | basic.py | py | 5,383 | python | en | code | 3 | github-code | 6 |
9771781643 | #Brownian Motion Simulator
#Simulate first on $R^1$
import numpy as np
import numpy
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
def graph(points):
data = np.array(points)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(data[:,0],data... | ElleNajt/TinyProjects | BrownianMotionSimulator.py | BrownianMotionSimulator.py | py | 2,129 | python | en | code | 4 | github-code | 6 |
44137255205 | #pip3 install wikiepdia-api
#pip3 install elasticsearch
#pip3 install nltk
#pip3 install gensim
#pip3 install pandas
#pip3 install tabulate
import pickle
import wikipediaapi
from model.WikiPage import WikiPage
from elasticsearch import Elasticsearch
import json
from time import sleep
import gensim
from gensim import co... | rAlvaPrincipe/wikipedia-search-engine | Wiki.py | Wiki.py | py | 8,334 | python | en | code | 0 | github-code | 6 |
20634168426 | from .utils import get_colors
def show_help_mess(error: bool = False) -> None:
"""Usage: pytrash <param> [param[, param ...]]
{0}-h, --help{1}
Print this help message and exit.
{0}-d, --del <path> [path[ path ...]]{1}
Move files/dirs to trash (~/.local/share/Trash/).
{0}-f, --find <... | MyRequiem/pytrash | src/helpmess.py | helpmess.py | py | 1,128 | python | en | code | 1 | github-code | 6 |
13067456622 | class TrainedAI:
def __init__(self):
self.playerBase = set()
self.cheaterLobbies = set()
self.cheatedPlayers = set()
self.CheaterData = set()
self.PlayerData = set()
class NaturalSelectionAI:
def __init__(self):
self.Data = set()
self.Iterations = set()
... | MyCodingSpace5/Dual-Symbosis-Model | concept.py | concept.py | py | 583 | python | en | code | 0 | github-code | 6 |
74149674427 | import os
import argparse
import cv2
import numpy as np
from glob import glob
from PIL import Image
def img2video(video_name):
filelist = []
root_dir = video_name
for (root, dirs, files) in os.walk(root_dir):
print("root : " + root)
if len(files) > 0:
for file_dir in files:
... | khw11044/PlenOpticVot_Siamfc_2020 | vot_siamfc_2D/dataloader.py | dataloader.py | py | 1,602 | python | en | code | 0 | github-code | 6 |
13543441403 | import pandas as pd
import numpy as np
import scipy.stats as stats
import pylab as pl
import re
import seaborn as sns
pd.set_option('display.max_columns', 15)
pd.set_option('display.max_rows', 40)
column_types = {
'Account Number':'int32',
'Assessment Year': 'int16',
'Neighbourhood': 'category',
'... | avielchow/Property-Assessment-Analysis | CleanData.py | CleanData.py | py | 4,195 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.