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
73816196028
import numpy as np import matplotlib.pyplot as plt import difuzija as di import sys sys.getdefaultencoding() def rho(x): if x >= 2.0 and x <= 5.0: return 5.5 else: return 0.0 j = [0, 100, 200, 300, 400] t = [0.5*J for J in j] P1 = [0.0, 20.0, 0.0, t[0]] #pocetni uvjeti P2 = [0.0, 20.0, 0....
FabjanJozic/MMF3
Predavanje12_PDJ/Zadatak1.py
Zadatak1.py
py
1,404
python
en
code
0
github-code
6
74927169786
''' The photon Project ------------------- File: read_conf.py This file reads the configuration file @author: R. THOMAS @year: 2018 @place: ESO @License: GPL v3.0 - see LICENCE.txt ''' #### Python Libraries import configparser import os class Conf: """ This Class defines the arguments to be calle to use...
astrom-tom/Photon
photon/read_conf.py
read_conf.py
py
3,134
python
en
code
3
github-code
6
29578754560
# -*- coding: utf-8 -*- """ https://note.nkmk.me/python-listdir-isfile-isdir/ Created on Wed Oct 31 11:45:21 2018 @author: Akitaka """ import os path = "./testdir" files = os.listdir(path) print(type(files)) # <class 'list'> print(files) # ['dir1', 'dir2', 'file1', 'file2.txt', 'file3.jpg'] #...
nakanishi-akitaka/python2018_backup
1031/python_listdir_isfile_isdir.py
python_listdir_isfile_isdir.py
py
652
python
en
code
5
github-code
6
74182045309
"""feature for malware.""" import os.path from abc import ABC, abstractmethod import numpy as np import filebrowser import lief from capstone import * class Feature(ABC): """interface for all feature type.""" def __init__(self): super().__init__() self.dtype = np.float32 self.name =...
dagrons/try
feature/feature.py
feature.py
py
3,314
python
en
code
0
github-code
6
9380859967
import numpy as np import time, glob, cv2 from pymycobot import MyCobotSocket from pymycobot import PI_PORT, PI_BAUD from single_aruco_detection import marker_detecting from forward_kinematics import F_K from inverse_kinematics import I_K import matplotlib.pyplot as plt from scipy.linalg import orthogonal_procrustes ...
zzZzzccHEnn/Visual_Tracking
evaluation.py
evaluation.py
py
3,833
python
en
code
0
github-code
6
19425798857
# Token types # # EOF (end-of-file) token is used to indicate that # there is no more input left for lexical analysis # RESERVED WORDS PROGRAM = 'PROGRAM' BEGIN = 'BEGIN' END = 'END' VAR = 'VAR' IO = 'IO' WAYPOINT = 'WAYPOINT' TRUE = 'TRUE' FALSE ...
TimTrudeau/T3001
SRC/token_types.py
token_types.py
py
1,346
python
en
code
1
github-code
6
18262895650
from __future__ import print_function from __future__ import unicode_literals import sys import subprocess def str_chunk(input_str, width): """divide string to chunks with fixed width/size. """ return (input_str[0+i:width+i] for i in range(0, len(input_str), width)) def str_is_hex(input_str): """check...
WeilerWebServices/Facebook
openbmc/tests/common/i2cUtils.py
i2cUtils.py
py
4,008
python
en
code
3
github-code
6
31273368548
# Escreva um programa que recebe um numero e # printa o dobro, o triplo e a raiz desse número n1 = int(input('Insira aqui um número ')) dobro = n1*2 triplo = n1*3 raiz = n1**(1/2) print('O dobro é {} \n' 'O triplo é {} \n' 'A raiz é {} \n' .format(dobro, triplo, raiz))
fcoxico/Python-Projects
DobroTriploQuadruplo.py
DobroTriploQuadruplo.py
py
296
python
pt
code
0
github-code
6
36914067207
from django.urls import path from rest_framework import routers from user_accounts import views router = routers.DefaultRouter() # router.register('users', user_viewsets) urlpatterns = [ path('create_user/', views.create_user.as_view(), name='create_user'), path('login_user/', views.login_user.as_view(), name...
AmbeyiBrian/ELECTRONIC-SCHOOL-MANAGER-KENYA
elimu_backend/user_accounts/urls.py
urls.py
py
649
python
en
code
0
github-code
6
18215167051
import BinarySearchTreeMap def create_chain_bst(n): chain_bst = BinarySearchTreeMap.BinarySearchTreeMap() for i in range(1,n+1): chain_bst.insert(i) return chain_bst def create_complete_bst(n): bst = BinarySearchTreeMap.BinarySearchTreeMap() add_items(bst, 1, n) return bst def add_ite...
andrew-qu2000/Schoolwork
cs1134/aq447_hw8/aq447_hw8_q2.py
aq447_hw8_q2.py
py
563
python
en
code
0
github-code
6
36406902723
#!/usr/bin/env python # -*- coding: utf-8 -* import os import csv import cloudpickle import numpy as np import pandas as pd from scipy.integrate import quad from scipy.stats import ( gaussian_kde, ks_2samp, t ) from sklearn.feature_selection import SelectorMixin from sklearn.base import Tr...
mcrts/dmatch
dmatch/utils.py
utils.py
py
11,860
python
en
code
1
github-code
6
23595304281
import os import re import time from option import Option import pandas as pd import wget as wget from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait import download __author__ = 'Song Hui' # 作者名 def get_options_from_command_line(): ...
songofhawk/simplerpa
test/test_selenium/facebook_download.py
facebook_download.py
py
4,871
python
en
code
15
github-code
6
41707501948
import tensorflow as tf from config import cfg def detect_loss(): def get_box_highest_percentage(arr): shape = tf.shape(arr) reshaped = tf.reshape(arr, (shape[0], tf.reduce_prod(shape[1:-1]), -1)) # returns array containing the index of the highest percentage of each batch # wher...
burnpiro/tiny-face-detection-tensorflow2
model/loss.py
loss.py
py
1,942
python
en
code
27
github-code
6
10966555857
import json class Config(dict): def __init__(self, path=None, section='default', *args, **kwargs): super().__init__(*args, **kwargs) if path is not None: self.read(path, section) def read(self, path, section='default'): '''read config from config file. will...
lycsjm/acgnmanager
src/lib/config.py
config.py
py
1,751
python
en
code
0
github-code
6
13348518622
import argparse import datetime import pathlib import subprocess import sys import time import run_all_utils command = ''' python ../modules/S3segmenter/large/S3segmenter.py --imagePath "{}" --stackProbPath "{}" --outputPath "{}" --probMapChan {probMapChan} --area-max 50000 -...
Yu-AnChen/orion-scripts
processing/command-s3seg.py
command-s3seg.py
py
2,454
python
en
code
0
github-code
6
18777503409
from flask import Flask from flask import render_template from pymongo import MongoClient import json from bson import json_util from bson.json_util import dumps import random import numpy as np import ast import pandas as pd from sklearn import preprocessing from sklearn.cluster import KMeans from sklearn.metrics.pair...
rbadri91/N.C.-Crime-Data-Visualization
app.py
app.py
py
11,214
python
en
code
1
github-code
6
32749134758
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import confusion_matrix, classification_report def main(): # the g...
AleksandarPav/Decision-Tree-and-Random-Forest
main.py
main.py
py
3,272
python
en
code
0
github-code
6
8632528934
from multiprocessing import cpu_count from deepsecrets.core.utils.fs import path_exists QUOTA_FILE = '/sys/fs/cgroup/cpu/cpu.cfs_quota_us' PERIOD_FILE = '/sys/fs/cgroup/cpu/cpu.cfs_period_us' CGROUP_2_MAX = '/sys/fs/cgroup/cpu.max' class CpuHelper: def get_limit(self) -> int: multiproc_limit = self._by...
avito-tech/deepsecrets
deepsecrets/core/utils/cpu.py
cpu.py
py
1,763
python
en
code
174
github-code
6
30357845811
import unittest from traits.api import Enum, HasTraits, Int, Str, Instance from traitsui.api import HGroup, Item, Group, VGroup, View from traitsui.menu import ToolBar, Action from traitsui.testing.api import Index, IsVisible, MouseClick, UITester from traitsui.tests._tools import ( create_ui, requires_toolkit...
enthought/traitsui
traitsui/qt/tests/test_ui_panel.py
test_ui_panel.py
py
8,436
python
en
code
290
github-code
6
40170866347
import os import numpy as np import cv2 import imutils import sys np.set_printoptions(threshold=sys.maxsize) corner_shapes_map = { 3: "triangle", 4: "rectangle", 5: "pentagon", 6: "hexagon" } model_prediction_map = { 0: "triangle", 1: "rectangle", 2: "circle" } def get_corners_in_canva...
nirajsrimal/UWB_2FA
BackEnd/solver.py
solver.py
py
2,434
python
en
code
1
github-code
6
41648714624
import unittest from PIL import Image import numpy as np from texture.analysis import CoOccur class MyTestCase(unittest.TestCase): def test_offset_slices(self): slices = CoOccur._offset_slices(4, 225) self.assertEqual(slices, ([[None, -3], [3, None]], [[3, None], [None, -3]])) pixels = np...
MatteoZanella/siv-texture-analysis
tests/test_com.py
test_com.py
py
2,951
python
en
code
1
github-code
6
37682605519
""" Challenge 24: Create a function that will merge two arrays and return the result as a new array """ def mergeArray(array1, array2): """empty array to hold the new values""" new_array = [] for i in array1: new_array.append(i) for j in array2: new_array.append(j) return sorted(ne...
mofirojean/50-Coding-Challenge
50 Coding Challenge Part I/Python/Challenge24.py
Challenge24.py
py
430
python
en
code
2
github-code
6
171133983
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from rp_ui_harness import RequestPolicyTestCase from marionette import SkipTest URLS = { 1: ["http://www.maindomai...
RequestPolicyContinued/requestpolicy
tests/marionette/tests/menu/test_settings_buttons.py
test_settings_buttons.py
py
7,155
python
en
code
253
github-code
6
22509106375
import numpy as np import logging from pathlib import Path #Output folder setup output = Path('./output/log').expanduser() output.mkdir(parents=True, exist_ok=True) en_log = logging.getLogger(__name__) en_log.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s:%(name)s:%(message)s') file_handler = logg...
amuthankural/square_cavity_Natural_Convection
energy.py
energy.py
py
4,354
python
en
code
4
github-code
6
73016396668
# TODO save output in a set to remove duplicated warnings import sys import time import subprocess import linecache rules = { "false":[ "PyArg_ParseTuple" ], "NULL":[ "Py_BuildValue", "PyLong_FromLong", #"PyBytes_FromStringAndSize", #"PyBytes_AsString", #"Py...
S4Plus/pyceac
checkers/2/checker.py
checker.py
py
4,376
python
en
code
3
github-code
6
5191593918
from utils import * forest = read_day(3) width = len(forest[0]) right = 3 down = 1 x = 0 y = 0 n_trees = 0 while y < len(forest): line = forest[y] cur = line[x%width] n_trees += cur == "#" x += right y += down print(n_trees) def count_slope_trees(forest, right, down): x = 0 y = 0 ...
nibrivia/aoc-2020
day-3.py
day-3.py
py
658
python
en
code
0
github-code
6
1539518044
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 27 09:55:08 2018 @author: kartini """ import numpy import io from itertools import permutations def read_dataset(fname): sentences = [] tags = [] with open(fname) as f: content = f.readlines() # you may also want to remove ...
kartininurfalah/NLP
1301154577_postagger.py
1301154577_postagger.py
py
8,547
python
en
code
0
github-code
6
4637946235
"""Connects to Fiscal DB and provides functions for database utility: Retrieving, updating values""" import os import mysql.connector import sys from src.vault_actions import FISCAL_VAULT fiscal_dict = FISCAL_VAULT.dict_all('secret') class MySQLConnectionError(Exception): """Custom exception for errors encounter...
danlhennessy/fiscal-dash
src/database.py
database.py
py
2,555
python
en
code
0
github-code
6
571836273
from os import remove alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] first_ten = alphabet[0:9] vowel = ['a','e','i','o','u'] consonant = alphabet.remove(vowel) print(consonant) print(vowel) print(first_ten) last_ten = alphabet[-10:-1] print(l...
olamide16/ATS_Training
week 1/last_alphabet.py
last_alphabet.py
py
329
python
en
code
0
github-code
6
22704968084
""" INSERT 1. The insert method takes a single argument, val, which is the value to be inserted into the binary search tree. 2. The method first checks whether the root node of the tree is None. If the root node is None, then the method creates a new node with the value val and sets it as the root of the tree. ...
AvishekC-st/pythonDSA-basics
python algo examples/Trees-BST_insert_and_remove.py
Trees-BST_insert_and_remove.py
py
5,338
python
en
code
0
github-code
6
73503551228
from .space.space import Space from .vqspace.space import Space as VQSpace from .qrspace.space import Space as QRSpace # from .vqspace.space import Space as VQSpace __all__ = ['get_model'] def get_model(cfg): """ Also handles loading checkpoints, data parallel and so on :param cfg: :return: """ ...
albertcity/OCARL
space/model/__init__.py
__init__.py
py
645
python
en
code
1
github-code
6
2962541494
# TomoPy recon on Cyclone: compare different algorithms import tomopy import dxchange import numpy as np import os import logging from time import time def touint8(data, quantiles=None): # scale data to uint8 # if quantiles is empty data is scaled based on its min and max values if quantiles == None: ...
SESAME-Synchrotron/BEATS_recon
tests/Cyclone/tomopy_testCyclone_recon_algorithms_comparison.py
tomopy_testCyclone_recon_algorithms_comparison.py
py
2,975
python
en
code
0
github-code
6
24990905758
from tkinter import * from PIL import ImageTk, Image import mysql.connector root = Tk() root.geometry("400x500") mydb = mysql.connector.connect( host = "localhost", user = "root", passwd = "password123", database = "codemy", ) # print(mydb) my_cursor = mydb.cursor() #creation de la base de donn...
miraceti/tkinter
gui_28tk_CRm_Db_tools.py
gui_28tk_CRm_Db_tools.py
py
6,059
python
en
code
2
github-code
6
18390234941
from django import template from photos.models import GalleryCustom register = template.Library() @register.filter def stripgallery(title): """ Remove gallery prefix from photo titles of the form gallery__mytitle. """ idx = title.find("__") if idx < 0: return title return title[idx+...
ria4/tln
photos/templatetags/photos_extras.py
photos_extras.py
py
1,682
python
en
code
3
github-code
6
25607545289
def palindrom(p, case_sensitive=True): """Tells if param is palindrome Parameters ---------- p : str or int or list input parameter case_sensitive : bool case sensitive or not Raises ------ TypeError if type is not str, i...
ciprianstoica/python-samples
palindrome2.py
palindrome2.py
py
1,343
python
en
code
0
github-code
6
30755556995
class AlarmClock : def __init__(self) : self.current_time = 0 self.alarm_is_on = True self.alarm_time = 0 self.toggle_result = '' def set_current_time(self): self.current_time = input('What is the current time?') print(self.current_time) def set_alarm_o...
StevenSisavath/ClassesAndObjects
alarm_clock.py
alarm_clock.py
py
935
python
en
code
0
github-code
6
16090817554
from django.urls import path from . import api_endpoints as views from .api_endpoints.Contacts.ContactsList.views import ContactListAPIView app_name = 'about' urlpatterns = [ path('addresses/', views.AddressListAPIView.as_view(), name='address_list'), path('company_stats/', views.CompanyStatListAPIView.as_vi...
bilolsolih/decormax
apps/about/urls.py
urls.py
py
863
python
en
code
0
github-code
6
39607752443
import logging import os from django.conf import settings from django.core.management.base import BaseCommand from core.management.commands import configure_logging from core.models import Batch, OcrDump configure_logging("dump_ocr_logging.config", "dump_ocr.log") _logger = logging.getLogger(__name__) class Comma...
open-oni/open-oni
core/management/commands/dump_ocr.py
dump_ocr.py
py
1,024
python
en
code
43
github-code
6
15399778008
from BayCab4BEM.downSampler import DownSampler from Util.io import getFileDir, getFileName import numpy as np import os import csv simDataFile = './iwCabData/config_16/dataFromSim/raw/DEBUG_D_sim_org.csv' fieldDataFile = './iwCabData/config_16/dataFromSim/raw/DEBUG_D_field_org.csv' bins = 30; qualityThres = 0.90; outp...
zhangzhizza/BayCab4BEM
src/downSampleData.py
downSampleData.py
py
1,671
python
en
code
3
github-code
6
30793138915
from tkinter import * window = Tk() window.title("Entry in tkinter") window.minsize(width=500,height=300) # Label my_label = Label(text="Type below to change text", font=("Arial", 24, "bold")) # places the label on to the screen and automatically centers it my_label.pack() # Entry (basically just input) input = E...
shrijanlakhey/100-days-of-Python
027/entry_in_tkiner.py
entry_in_tkiner.py
py
747
python
en
code
0
github-code
6
17642557437
import os from flask import Flask, request, jsonify from flask_pymongo import PyMongo from bson import ObjectId import bcrypt import jwt import ssl import datetime from functools import wraps from dotenv import load_dotenv load_dotenv('.env') app = Flask(__name__) app.config['MONGO_URI'] = os.environ.get('MONGO_URI')...
abhi1083/simple_crud_ops
main.py
main.py
py
6,831
python
en
code
0
github-code
6
22555751097
from flask_app.config.mysqlconnection import connectToMySQL from flask import flash class Product: db = "my_solo" def __init__(self, data): self.id = data['id'] self.wood = data['wood'] self.thickness = data['thickness'] self.description = data['description'] self.crea...
tsu112/solo_project
flask_app/models/product.py
product.py
py
2,288
python
en
code
1
github-code
6
8519707697
import bs4 as bs import requests import regex as re import pandas as pd from src.config import * def get_page_body(url: str): try: response = requests.get(url, timeout=10) if response.status_code == 200: page = bs.BeautifulSoup(response.text) return page.body except req...
bakalstats/py_project
src/scraping_utils.py
scraping_utils.py
py
2,826
python
en
code
0
github-code
6
15409655756
""" 一个网站域名,如"discuss.leetcode.com",包含了多个子域名。作为顶级域名,常用的有"com",下一级则有"leetcode.com",最低的一级为"discuss.leetcode.com"。当我们访问域名"discuss.leetcode.com"时,也同时访问了其父域名"leetcode.com"以及顶级域名 "com"。 给定一个带访问次数和域名的组合,要求分别计算每个域名被访问的次数。其格式为访问次数+空格+地址,例如:"9001 discuss.leetcode.com"。 接下来会给出一组访问次数和域名组合的列表cpdomains 。要求解析出所有域名的访问次数,输出格式和输入格式相同,...
Octoberr/letcode
easy/811subdomainvisitcount.py
811subdomainvisitcount.py
py
1,796
python
zh
code
1
github-code
6
6448028292
import datetime import time import MySQLdb import cv2, os cascadePath = ("haarcascade_frontalface_default.xml") faceCascade = cv2.CascadeClassifier(cascadePath) recognizer = cv2.face.LBPHFaceRecognizer_create() recognizer.read('dataTrain/train.yml') now = datetime.datetime.now() def getProfile(id): db = MySQLdb....
Kuroboy/Presensi-Face
faceRec.py
faceRec.py
py
1,634
python
en
code
0
github-code
6
45333966266
from markdown import markdown from unittest import TestCase from markdown_vimwiki.extension import VimwikiExtension class TestExtension(TestCase): def test_default_config(self): source = """ Hello World =========== * [-] rejected * [ ] done0 * [.] done1 * [o] done2 * [O] done3 * [X] done...
makyo/markdown-vimwiki
markdown_vimwiki/tests/test_extension.py
test_extension.py
py
1,499
python
en
code
0
github-code
6
5896021463
import torch import torch.utils.data as data import numpy as np from collections import defaultdict from tqdm import tqdm from copy import deepcopy import config_data as conf import random infor_train_data_path = np.load('/content/drive/MyDrive/DASR-WGAN/data/dianping/version3/infor_train.npy', allow_pickle = True).t...
PeiJieSun/AAAI-submission
DataModule_domain_infor.py
DataModule_domain_infor.py
py
19,566
python
en
code
0
github-code
6
12215224198
# -*- coding: utf-8 -*- # vim: set ts=2 sw=2 sts=2 tw=80 et: # pylint: disable=missing-docstring import tensorflow as tf def mlp(inputs, mode="train", batch_norm=True, dropout=True, weight_decay=0.0, layer_sizes=None, activations=None, trainables=None, model_prefix=''): """ """ layer_sizes = laye...
siwendy/interestGraph
models/mlp.py
mlp.py
py
3,215
python
en
code
0
github-code
6
29792580081
#!/usr/bin/env python3 import sys import rospy from demo_interface import DemoInterface from geometry_msgs.msg import Point DEBUG = True if __name__ == "__main__": d = DemoInterface() if sys.argv[0] == 'rosrun' and len(sys.argv) > 2: point_topics = sys.argv[3:] rospy.loginfo(f"Showing points...
dwya222/end_effector_control
scripts/test_scripts/show_at_point.py
show_at_point.py
py
932
python
en
code
0
github-code
6
74992084668
import cv2 import numpy as np import os import sys import json import math import time import argparse from enum import Enum import platform class Config: @classmethod def init(cls): if platform.system() == "Windows": cls.QUIT_KEY = ord("q") cls.CONTINUE_KEY = 2555904 #right...
galatolofederico/manim-presentation
manim_presentation/present.py
present.py
py
11,126
python
en
code
153
github-code
6
74531208506
""" Solutions to exam tasks for modul 1 for exam 2021-10-25 """ import random import time import math # Task A1 def length_longest(lst): # Variant 1: Iteratively in the 'width' direction if type(lst) != list: return 0 result = len(lst) for x in lst: result ...
bupa8694/programming2
Exams/2021-11-25/Exam_1TD722_20211025_solutions/Exam_1TD722_20211025_solutions/m1_sol.py
m1_sol.py
py
3,519
python
en
code
1
github-code
6
70075663868
#!/usr/bin/env python3 """ Funtion that lists all documents in a collection""" def list_all(mongo_collection): """ return an empty list if no documento in the collection """ documents = mongo_collection.find() documents_list = [doc for doc in documents] if documents_list.count == 0: re...
lemejiamo/holbertonschool-backend-storage
0x01-NoSQL/8-all.py
8-all.py
py
354
python
en
code
1
github-code
6
3453773218
fileName = "word.txt" f = open(fileName,'r') wordcount={} for str in f.read().split(): if str not in wordcount: wordcount[str] = 1 else: wordcount[str] += 1 print("Output written in file") print(wordcount, file=open("count.txt", "w"))
sravan9393/SummerSemester_Python
ICP2_Python/wordcount_file.py
wordcount_file.py
py
269
python
en
code
0
github-code
6
5005373290
from typing import Any, Iterable, MutableMapping from typing_extensions import TypeAlias from .. import etree from .._types import Unused, _AnyStr, _ElemClsLookupArg, _FileReadSource from ._element import HtmlElement _HtmlElemParser: TypeAlias = etree._parser._DefEtreeParsers[HtmlElement] # # Parser # # Stub versio...
abelcheung/types-lxml
lxml-stubs/html/_parse.pyi
_parse.pyi
pyi
5,211
python
en
code
23
github-code
6
13350264318
#!/usr/bin/python3 """https://www.hackerrank.com/challenges/find-the-median/problem?isFullScreen=true""" def partition(arr, low, high): pivot = arr[high] i = low - 1 for j in range(low, high): if arr[j] <= pivot: i += 1 arr[i], arr[j] = arr[j], arr[i] ...
Velin-Todorov/HackerRank-Leetcode
Find_the_Median.py
Find_the_Median.py
py
747
python
en
code
0
github-code
6
21569825740
#!/usr/bin/env python from prl_tsid.commander import PathFollower import rospy rospy.init_node("TSID_example", anonymous=True) # Plan a trajectory using HPP from prl_hpp.ur5 import planner, robot, commander_left_arm, commander_right_arm pi = 3.1415926 planner.lock_grippers() planner.lock_right_arm() planner.set_velo...
inria-paris-robotic-lab/prl_hpp_tsid
prl_tsid/scripts/example_ur5_hpp.py
example_ur5_hpp.py
py
929
python
en
code
0
github-code
6
20426981888
""" All rights reserved. --Yang Song (songyangmri@gmail.com) --2021/1/7 """ import os import pickle import random from abc import abstractmethod from lifelines import CoxPHFitter, AalenAdditiveFitter from lifelines.utils.printer import Printer from lifelines import utils from SA.Utility import mylog from SA.DataConta...
salan668/FAE
SA/Fitter.py
Fitter.py
py
2,221
python
en
code
121
github-code
6
25818064734
#!/usr/bin/env python3 # ============================================================================= # Author: Julen Bohoyo Bengoetxea # Email: julen.bohoyo@estudiants.urv.cat # ============================================================================= """ Description: A set of tools for semantic image segmentati...
julenbhy/biomedical_segmentation
tools/segmentation_utils.py
segmentation_utils.py
py
23,075
python
en
code
0
github-code
6
30353773151
from mayavi.filters.filter_base import FilterBase from mayavi.components.common import convert_to_poly_data ###################################################################### # `PolyDataFilterBase` class. ###################################################################### class PolyDataFilterBase(FilterBase): ...
enthought/mayavi
mayavi/filters/poly_data_filter_base.py
poly_data_filter_base.py
py
1,003
python
de
code
1,177
github-code
6
40194290799
import tweepy import time print('Starting bot....') CONSUMER_KEY = "Cqw4pXPk4lz2EEUieSDKjKuQT" CONSUMER_SECRET = "AhQZvxkBNS2bmXdUOX8tu5SoZi9vYdNimwmTuzkE9ZJJuzTEk5" ACCES_KEY = "1323551878483865600-LVgJ1466OXyOnZqKNt4H3k0hBBQlmO" ACCES_SECRET = "yWdPUmakm5Cn4eMURajaZkNkbeaXgLhzvD7msCsB5Ipxw" auth = tweepy.OAuthHandl...
byte-exe/bot-reply-back_tweets
twt_bot.py
twt_bot.py
py
1,355
python
en
code
0
github-code
6
39432945596
import sys import os.path current_dir = os.path.dirname(os.path.relpath(__file__)) analysis_dir = current_dir[0:-7] + "Analysis" sys.path.append(analysis_dir) import check def printSummary(data): print("Summary:") unique_list = check.findUnique(data) for i in unique_list: print(f"{i} (1)") fo...
svrohith9/100-days-python
Bonus/Ass4/Summary/dataOutput.py
dataOutput.py
py
581
python
en
code
0
github-code
6
30366690531
""" Example of how to use a DataView and bare renderers to create plots """ from numpy import linspace, sin, cos # Enthought library imports. from chaco.api import ( DataView, ArrayDataSource, ScatterPlot, LinePlot, LinearMapper, ) from chaco.tools.api import PanTool, ZoomTool from enable.api impo...
enthought/chaco
chaco/examples/demo/data_view.py
data_view.py
py
2,098
python
en
code
286
github-code
6
43078051498
import time from datadog import initialize from datadog import api as dogapi from datadog.dogstatsd.base import DogStatsd from datadog.dogstatsd.context import TimedContextManagerDecorator from flask import g, request class TimerWrapper(TimedContextManagerDecorator): def __init__(self, statsd, *args, **kwargs): ...
sky107/python-lab-project-sky
pyprojectbackend/lib/python3.9/site-packages/flask_datadog.py
flask_datadog.py
py
13,019
python
en
code
0
github-code
6
21141343602
import asyncio import math import sys from collections import Counter, defaultdict from pprint import pprint import aiohttp import async_timeout import click import matplotlib.pyplot as plt import numpy as np import pandas as pd from pyecharts import Bar as Line from pyecharts import Overlap from lucky.commands impor...
onecans/my
mystockservice/lucky/commands/min_max_counter.py
min_max_counter.py
py
3,486
python
en
code
2
github-code
6
35817144385
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Automatic electric field computation ------------------------------------ :download:`examples/auto_efield.py` demonstrates how drift can be added self-consistently by calculating the electric field generated from the concentration profile of charged species. :: $ p...
chemreac/chemreac
examples/auto_efield.py
auto_efield.py
py
7,622
python
en
code
14
github-code
6
16930544030
from __future__ import absolute_import from .dataset_iter import default_collate, DatasetIter from .samplers import RandomSampler, SequentialSampler import torch import os import os.path import warnings import fnmatch import math import numpy as np try: import nibabel except: warnings.warn('Cant import nib...
huiyi1990/torchsample
torchsample/datasets.py
datasets.py
py
12,057
python
en
code
null
github-code
6
26552249009
#!/usr/bin/env python3 import fnmatch import os import re import ntpath import sys import argparse # handle x64 python clipboard, ref https://forums.autodesk.com/t5/maya-programming/ctypes-bug-cannot-copy-data-to-clipboard-via-python/m-p/9197068/highlight/true#M10992 import ctypes from ctypes import wintypes CF_UNICO...
acemod/ACE3
tools/search_undefinedFunctions.py
search_undefinedFunctions.py
py
5,461
python
en
code
966
github-code
6
41310847925
import os from abc import ABC from keras import Model, layers from keras.layers import Conv2D, BatchNormalization, Add, MaxPool2D, GlobalAveragePooling2D, Flatten, Dense, Rescaling import tensorflow as tf class ResnetBlock(Model, ABC): """ A standard resnet block. """ def __init__(self, channels: in...
beishangongzi/graduation_internship
utils/Resnet.py
Resnet.py
py
3,958
python
en
code
0
github-code
6
21202048829
from kivy.uix.label import Label from kivy.uix.textinput import TextInput from kivy.uix.gridlayout import GridLayout from kivy.uix.scrollview import ScrollView from app.main import ShowcaseScreen from app.widgets.heartfelt_hellos_button import HeartfeltHellosButton from app.widgets.heartfelt_hellos_step_progression_but...
JelindoGames/HeartfeltHellos
app/data/screen_types/deprecated/idea_creation_screen.py
idea_creation_screen.py
py
4,316
python
en
code
0
github-code
6
72789313789
import numpy as np import time from scipy import ndimage from .toolkit import vectools from .toolkit.colors import Colors as _C import matplotlib.pyplot as plt import matplotlib import math import cv2 import sys import os __location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__))) cla...
lspgl/csat
sectorImage/core/image.py
image.py
py
12,778
python
en
code
0
github-code
6
19239438392
# 문자열 내 마음대로 정렬하기 # 12915 def solution(strings, n): words = [] answer = [] strings.sort() for i in range(len(strings)): words.append((strings[i][n], i)) words.sort() for w in words: answer.append(strings[w[1]]) return answer # strings n return # ["sun", "bed", "car"] 1 ["...
sdh98429/dj2_alg_study
PROGRAMMERS/level1/문자열_내_마음대로_정렬하기.py
문자열_내_마음대로_정렬하기.py
py
415
python
en
code
0
github-code
6
15873196557
from datetime import datetime def unix_to_dt(time): return datetime.utcfromtimestamp(time).strftime('%Y-%m-%d %H:%M:%S') class event(): def __init__(self, events): self.type = events['type'] self.empty = False if self.type == 'None': self.empty = True elif self.type...
theTrueEnder/GroupMe-Export-Parser
Python_Scripts/events.py
events.py
py
4,193
python
en
code
2
github-code
6
33626128629
import jsonlines import os from pathlib import Path from xml_handler import XmlHandler from google_cloud_storage_client import GoogleCloudStorageClient def main(event, context): # Retrieve file from GCS input_filename = event.get("name") input_bucket_name = event.get("bucket") output_bucket_name = os...
MeneerBunt/MarjolandHarvestData
src/convert_xml_to_json/main.py
main.py
py
1,202
python
en
code
0
github-code
6
39627862945
""" Text formatting script. Alice in Wonderland, obtained from: https://www.gutenberg.org/ebooks/28885 """ import string def format_book(file_in, file_out): with open(file_in) as f: text = f.read() text = text.replace('\r', ' ').replace( '\n', ' ').replace('\t', ' ').replace('-', ' ') te...
jmmanso/deepseries
examples/text_analytics/format_text.py
format_text.py
py
737
python
en
code
4
github-code
6
30367024091
from bisect import bisect from math import ceil, floor, log10 from numpy import abs, argmin, array, isnan, linspace # Local imports from .formatters import BasicFormatter __all__ = [ "AbstractScale", "DefaultScale", "FixedScale", "Pow10Scale", "LogScale", "ScaleSystem", "heckbert_interva...
enthought/chaco
chaco/scales/scales.py
scales.py
py
19,821
python
en
code
286
github-code
6
3727746961
### This file is meant to run from pc, *not* from the server. It extracts the # data from the datafile, posts it to the database and finally runs the day # command to add the day to the data. import math import pandas as pd import requests day_of_month = 6 def upload_data(fname): data = extract_data(fname) ...
simgeekiz/ApplabAPI
group2api/utils/UploadData.py
UploadData.py
py
1,592
python
en
code
0
github-code
6
72035219069
#!/usr/bin/env python3 from bcc import BPF from http.server import HTTPServer, BaseHTTPRequestHandler import sys import threading clone_ebpf = """ #include <uapi/linux/ptrace.h> #include <linux/sched.h> #include <linux/fs.h> #define ARGSIZE 128 BPF_PERF_OUTPUT(events); struct data_t { u32 pid; // PID as in t...
madhusudanas/ebpf-mac-python
misc/hello_world1.py
hello_world1.py
py
1,927
python
en
code
0
github-code
6
39120803262
def busca_profundidade(grafo, inicio, destino, visitados=None): if visitados is None: visitados = [inicio] if inicio == destino: return visitados for proximo in grafo[inicio]: if proximo not in visitados and destino not in visitados: visitados = busca_profundidade(gra...
AlbertoFelix/AgentesDeBusca
buscaProfundidade.py
buscaProfundidade.py
py
387
python
pt
code
0
github-code
6
13395399902
from PIL import Image def brighten_Image(pixelList): pix_len = len(pixelList) for i in range(pix_len): #assigns each part of tuple to a variable current_pixel = pixelList[i] #then will brigthen each by 50 red = current_pixel[0] green = current_pixel[1] blue = current_pixel[2] #this is not the best way, ex...
tommulvey/CSC15_python
10_3/brightenImage.py
brightenImage.py
py
1,001
python
en
code
0
github-code
6
12789805626
from errno import EIO, ENOSPC, EROFS import sys import os import traceback import glob from decimal import Decimal, getcontext getcontext().prec = 6 assert sys.platform == 'linux', 'This script must be run only on Linux' assert sys.version_info.major >= 3 and sys.version_info.minor >= 5, 'This script requires Pytho...
skazanyNaGlany/amipi400
amiga_disk_devices.py
amiga_disk_devices.py
py
56,855
python
en
code
0
github-code
6
24282938220
from application import app, db from flask import redirect, render_template, request, url_for, flash from application.child.models import Child from application.quotes.models import Quote from application.likes.models import Likes from application.child.forms import ChildForm, MakeSureForm from datetime import datetime...
millalin/Kids-Say-the-Darndest-Things
application/child/views.py
views.py
py
4,587
python
en
code
1
github-code
6
73814836346
class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ if(len(strs) == 1): return strs[0] infoDict = dict() for words in strs: key = "" for letters in words: ...
davidyip50/WallBreakers
stringManipulation/longestCommonPrefix.py
longestCommonPrefix.py
py
846
python
en
code
0
github-code
6
33560481799
"""Function to get time of execution of a function.""" # import time # a = input("Ente a value:") # def multiply_by_2(a): # a = a * 2 # result = multiply_by_2(a) from time import process_time # importing time def main_function(decorator_function): # function to call decorator def sub_function(): st...
alenantony/Alokin-Task
Day4/decorator.py
decorator.py
py
933
python
en
code
0
github-code
6
4635541375
import numpy as np import tensorflow as tf import json from util import Dataset, load_data from random import randint import os eid = 'e100-b50-h512-adam' n_epochs = 100 batch_size = 50 show_steps = 1 input_dim = 784 latent_dim = 100 hidden_dim = 512 statistics = { 'architechture': '3 layers, {}-{}-{}/{}'.format...
ChiWeiHsiao/Deep-Learning-Assignment
6-AAE/aae.py
aae.py
py
9,201
python
en
code
3
github-code
6
14837490064
from django.urls import path from . import views urlpatterns = [ path('products/', views.product_list, name='product_list'), path('product/<int:product_pk>/', views.product_detail, name='product_detail'), path('basket/', views.product_basket, name='product_basket'), path('product/<int:product_pk>/add_t...
meeeeeeeh/djangoblog
shop/urls.py
urls.py
py
855
python
en
code
0
github-code
6
24930679414
from datetime import datetime, timedelta from email import message from django.contrib.auth.models import User from django.contrib import messages from django.shortcuts import redirect, render from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect, JsonResponse from .mode...
SachinBhattarai0/QueAns
answers/views.py
views.py
py
3,662
python
en
code
0
github-code
6
26140999116
arr = list(map(int, input().split())) found = [] for n in arr: flag = True for f in found: if n == f: flag = False if flag: found.append(n) print("Yes" if len(found) == 2 else "No")
tomon9086/atcoder
python/abc155/abc155_a/Main.py
Main.py
py
203
python
en
code
0
github-code
6
16208817026
#-*- coding: UTF-8 -*- ''' @author: chenwuji 读取原始文件 将脚本保存为按照天的文件 ''' import tools alldata = {} map_dict = {} global_count = 1 def read_data(filename): f = open(filename) for eachline in f: if(len(eachline.split('values (')) < 2): continue eachline = eachline.decode('GBK').encode('U...
chenwuji91/vehicle
src_1_sql_to_day_data/data_process.py
data_process.py
py
1,769
python
en
code
0
github-code
6
41945752494
# usually big companies in Hollywood watermark their script with usually an actor's name. # So if that actor leaks the script well they'll know that that person has their name on the script and # they're the ones that leaked it. # so we are going to use this watermark throgh out all the pdf. import PyPDF2 template = ...
hyraja/python-starter
12.scripting python (projects)/pdf with python/03.pdf watermark.py
03.pdf watermark.py
py
702
python
en
code
0
github-code
6
3439984211
class Solution(object): def anagramMappings(self, A, B): """ :type A: List[int] :type B: List[int] :rtype: List[int] """ dic = {} for i, num in enumerate(B): if num in dic: dic[num].append(i) else: dic[nu...
cuiy0006/Algorithms
leetcode/760. Find Anagram Mappings.py
760. Find Anagram Mappings.py
py
487
python
en
code
0
github-code
6
70422466107
from linked_list import MyList, ListNode from myclass import Circle a=Circle(10,1,2) b=Circle(8,2,2) c=Circle(12,3,1) lst = MyList() lst.enqueue(a) lst.enqueue(b) lst.enqueue(c) print("obj is added") for i in lst: i.values() lst.dequeue() print("Dequeued") for i in lst: i.values()
meruert111/seminar3
main.py
main.py
py
290
python
en
code
0
github-code
6
5528516422
from datetime import datetime from finnhub import Client from settings.constants import FINHUB_API_KEY class FinhubFetcher: def __init__(self, symbol: str) -> None: self.symbol = symbol def _init_client(self) -> None: return Client(FINHUB_API_KEY) def _get_params(self, resolution: str)...
VladisIove/darkstore
portfolio_manager/services/fetchers/finnhub.py
finnhub.py
py
949
python
en
code
0
github-code
6
1720170439
from wazirx_sapi_client.rest import Client from wazirx_sapi_client.websocket import WebsocketClient import time import websocket,json, pprint from websocket import create_connection from time import sleep import logging import pandas as pd import asyncio import socket, threading import json, sys, os, time, csv, reque...
deysanjeeb/wazirX-trailstop
trail.py
trail.py
py
9,134
python
en
code
0
github-code
6
15799665340
#7,7 map --> https://etc.usf.edu/clipart/42600/42671/grid_42671_lg.gif class Map(object): def __init__(self, max_size=[6,6], monster_locations=[[2, 2],[4, 4]], players={}): self.size = {'X':[0,max_size[0]],'Y':[0,max_size[1]]} self.players = players self.monster_locations = monster_locati...
aragaod/yaDnD
main.py
main.py
py
4,206
python
en
code
0
github-code
6
8708126012
from __future__ import unicode_literals import datetime import logging import os import tweepy as tp from twiker.modules.tauth import Auth class Engine(object): """ The main engine class for the Twiker Bot.This class includes all the api methods Copyright (c) 2021 The Knight All rights reserve...
Twiker-Bot/twiker
twiker/modules/engine.py
engine.py
py
26,243
python
en
code
1
github-code
6
38504427534
import requests from scraper.get_strava_access_token import refreshed_access_token BASE_URL = 'https://www.strava.com' ACCESS_TOKEN = refreshed_access_token() def get_starred_segments(): print('Getting segement list') request_dataset_url = BASE_URL + '/api/v3/segments/starred' # check https://developers.st...
ADV-111/Srodunia
scraper/request_dataset_through_api.py
request_dataset_through_api.py
py
1,312
python
en
code
0
github-code
6
1662811500
import csv import os import numpy as np import json from pyexcel_ods import get_data PATTERN_TYPE = '1' COURSE_TYPE = 'speed' DATA_DIR = os.path.join(PATTERN_TYPE, COURSE_TYPE) fieldnames = ['min_speed','max_speed','delay','spacing','min_angle','max_angle','num_rows','min_b_scale','max_b_scale','clear_threshold','har...
gebgebgeb/bdt
courses/write_speed_courses.py
write_speed_courses.py
py
3,180
python
en
code
0
github-code
6
38269743748
import socket import ssl # Server'ın IP adresi ve portu HOST = "127.0.0.1" PORT = 3131 # SSL sertifikalarının yolunu belirtin ssl_cert = "server.crt" # Soketi oluşturun client_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ssl_context.load_verify_loca...
Varp0s/private_chat
client.py
client.py
py
798
python
tr
code
0
github-code
6
42663409589
import copy import math #needed for calculation of weight and bias initialization import numpy as np import pandas as pd from torch.utils.data import Dataset, DataLoader import torch, torch.nn as nn, torch.nn.functional as F import torchvision from torchvision import transforms, models, utils #Set seeds np.random.see...
rachellea/explainable-ct-ai
src/models/custom_models_mask.py
custom_models_mask.py
py
21,512
python
en
code
3
github-code
6
34839501596
import numpy as np import torch import torchvision import PIL import os def save_video(img,outdir, drange,fname="video0.mp4", normalize=True): _, C ,T ,H ,W = img.shape # print (f'Saving Video with {T} frames, img shape {H}, {W}') img = img.cpu().xdetach().numpy() if normalize: lo, hi = drang...
interiit-Team10/HP_BO_DIGAN
src/scripts/__init__.py
__init__.py
py
979
python
en
code
0
github-code
6