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
19350701790
import logging import json from scraper.components import * #https://coralogix.com/log-analytics-blog/python-logging-best-practices-tips/#id.1ksv4uv #https://gist.github.com/nguyenkims/e92df0f8bd49973f0c94bddf36ed7fd0 #https://towardsdatascience.com/get-your-own-data-building-a-scalable-web-scraper-with-aws-654feb9fd...
bilalansari-fr/aws_codepipeline
scraper/__init__.py
__init__.py
py
1,517
python
en
code
0
github-code
50
4593109013
from __future__ import division, print_function, absolute_import import math import hypothesis.internal.conjecture.utils as d import hypothesis.internal.conjecture.floats as flt from hypothesis.control import assume from hypothesis.internal.compat import int_from_bytes from hypothesis.internal.floats import sign from...
pareksha/Friend-recommendation-system
pyta/hypothesis/searchstrategy/numbers.py
numbers.py
py
5,357
python
en
code
14
github-code
50
4641407882
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix class ClassificationBinary(object): def __init__(self, X, Y): self.X = X ...
mibrahimniz/eeg-python
classification/ClassificationSklearn.py
ClassificationSklearn.py
py
1,729
python
en
code
0
github-code
50
21917817328
from weakref import WeakKeyDictionary class NonNegativeInteger(object): def __init__(self): self.data = WeakKeyDictionary() def __get__(self, instance, owner): if instance is None: return self return self.data[instance] def __set__(self, instance, value): if n...
mattjegan/describing-descriptors
slide39_errormessages.py
slide39_errormessages.py
py
791
python
en
code
5
github-code
50
15055409438
import random moves = ['rock', 'paper', 'scissors'] class Player: def __init__(self): self.my_move = None self.their_move = None def move(self): return 'rock' def learn(self, my_move, their_move): self.my_move = my_move self.their_move = their_move def beats(on...
mohamedszaina/Udacity-RPS-Game-Project
rps.py
rps.py
py
3,420
python
en
code
0
github-code
50
2484807979
from anime_module import M3U8, Myself, MyselfAnime, MyselfAnimeTable from configs import MYSELF_URL from swap import VIDEO_QUEUE from asyncio import gather, create_task from pydantic import BaseModel, Field from typing import Literal class CacheData(BaseModel): from_cache: bool = Field(True, alias="from-cache") ...
AloneAlongLife/MyselfAnimeDownloader_WebUI
api/api.py
api.py
py
5,338
python
en
code
4
github-code
50
35548426584
from coinmarketcap import Market from tkinter import * from tkinter import font as tkfont import pandas as pd from tkinter import ttk from PIL import Image, ImageTk test = [] #############################################FRONTEND#############################################################################...
Cryptovisor/CryptoVisor
CryptoVisor-main.py
CryptoVisor-main.py
py
6,924
python
en
code
2
github-code
50
21452619484
# -*- coding: utf-8 -*- import datetime import json import logging import os.path import Var from Broker import Rest logger = logging.getLogger() class indicateur(object): """ docstring for indicateur: temps = datetime Midpoint= Milieu Bid/ask """ ...
boulton/IGTradingAlgo
Algorithme/Indicateur.py
Indicateur.py
py
9,911
python
en
code
4
github-code
50
36694404235
#!/usr/bin/env python3 import getpass ## required if prompting for XIQ crednetials import json import requests from colored import fg, bg, attr ############################################################################################################ ## written by: Mike Rieben ## e-mail: mrieben@extremenetw...
MibenSmmod/Multicast-Detector
XIQ-MulticastDetector.py
XIQ-MulticastDetector.py
py
13,717
python
en
code
0
github-code
50
25417265230
"""Data models""" import flask_wtf import wtforms UPLOAD_FOLDER = r'uploads/' ALLOWED_EXTENSIONS = {'py'} class Code(): """Code object to store code""" def __init__(self, code) -> None: self.code = code class FormFile(flask_wtf.FlaskForm): """Form""" file = wtforms.FileField('Python file t...
Benzy-Louis/pyflowchart-gui
pyflowchart_web/app/models.py
models.py
py
1,134
python
en
code
0
github-code
50
35787425005
from linguist.models import Word, GlobalWord, Language, Category from random import randint, choice from linguist.utils import LinguistTranslator class LinguistHQ: def __init__(self, student=None): self.student = student self.langs = Language.objects.all() self.global_words = GlobalWord.ob...
stPhoenix/project_osirius
linguist/core.py
core.py
py
6,139
python
en
code
0
github-code
50
73508785434
# # (c) 2023 RENware Software Systems # cosana system # # ============================================ # ADS General Data # import json, os, sys from flask import jsonify import sqlalchemy as sa from sqlalchemy.orm import declarative_base, relationship, backref from libutil.utils import genpk, getusr import pendulum...
petre-renware/cosana
data_models/ads_general_data_data_models.py
ads_general_data_data_models.py
py
3,126
python
en
code
1
github-code
50
22427357015
from socket import * s = socket () mensagem = "https://github.com/mjoaojr/Sistemas-Distribuidos.git" IP="10.10.13.1" PORTA=8753 CONVERTER = str.encode(mensagem, "UTF-8") s.connect((IP,PORTA)) while True: s.send(CONVERTER) while True: x = s.recv (4096) if not x: break print(x.decode("UTF-8")) respos...
M4theusz/Projetos_Faculdade
Python_Sistemas_Distribuidos/con2.py
con2.py
py
401
python
en
code
0
github-code
50
2745813376
from itertools import product import networkx as nx default_nodes = ['Stephen', 'Sinnie', 'Elaine'] default_edges = [('Stephen', 'Sinnie', 0.2), ('Sinnie', 'Stephen', 0.2), ('Sinnie', 'Elaine', 0.3), ('Elaine', 'Sinnie', 0.2), ('Stephen', 'Elaine',...
stephenhky/GraphFlow
graphflow/simvoltage/SocialNetworkSimVoltage.py
SocialNetworkSimVoltage.py
py
7,928
python
en
code
8
github-code
50
15134237198
import re from pprint import pprint import nltk import spacy from detoxify import Detoxify from nltk.sentiment import SentimentIntensityAnalyzer from nltk.corpus import stopwords from langdetect import detect #nltk.download([ # "names", # "stopwords", # "state_union", # "twitter_samples", # "movie...
Eggoser/SuperFlexMessengerAssistant
backend/app/neural_english.py
neural_english.py
py
2,979
python
en
code
2
github-code
50
22452949747
import sys, os import math from lxml import etree import numpy as np from sklearn.pipeline import Pipeline, FeatureUnion try: #to ease the use without proper Python installation import TranskribusDU_version except ImportError: sys.path.append( os.path.dirname(os.path.dirname( os.path.abspath(sys.argv[0]) )) )...
Transkribus/TranskribusDU
TranskribusDU/tasks/TablePrototypes/DU_ABPTableRG2.py
DU_ABPTableRG2.py
py
8,726
python
en
code
21
github-code
50
1713453289
import array as arr def predictCoord(point0, point1, timeDiff): xVel = (point1[0]-point0[0])/timeDiff yVel = (point1[1]-point0[1])/timeDiff a = -9.81 time1 = (-yVel - (yVel*yVel - 2 * a * point1[1]) ** 0.5)/a time2 = (-yVel + (yVel*yVel - 2 * a * point1[1]) ** 0.5)/a time = time1.real ...
Yangmchuyue/ITrash
TargetTrajectoryTracker.py
TargetTrajectoryTracker.py
py
500
python
en
code
1
github-code
50
71826171356
from pymongo import MongoClient import json import jsonpickle import time def loadFromDB(): stocks = [] client = MongoClient('localhost', 27017) db = client["test"] coll = db['stocks'] results = coll.find({}, {'_id': 0}) strValues = [] for r in results: ...
fengwu2004/stock
serialization.py
serialization.py
py
503
python
en
code
0
github-code
50
1247897561
import webapp2 import datetime from collections import defaultdict from google.appengine.ext.webapp import blobstore_handlers from models import Entry, Attachment, ToDo from templates import (attachmentTemplate, indexTemplate, entryEditTemplate, backupTemplate) from mail import EntryReminder, M...
Mononofu/infinite-diary
diary.py
diary.py
py
6,006
python
en
code
4
github-code
50
71016801114
from django.core.management.base import BaseCommand, CommandError import pandas as pd import re import requests import json from blog.models import latest_transactions,last_blocks class Command(BaseCommand): def handle(self, *args, **options): def get_blocks(): sats_conversion = 100000000 ...
spookiestevie/my-django-site
blog/management/commands/get_blocks_cmd.py
get_blocks_cmd.py
py
2,234
python
en
code
0
github-code
50
3310309804
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from typing import List from cdp_backend.pipeline.ingestion_models import EventIngestionModel from cdp_scrapers.legistar_utils import LegistarScraper ############################################################################### def get_e...
CouncilDataProject/long-beach
python/cdp_long_beach_backend/scraper.py
scraper.py
py
1,357
python
en
code
0
github-code
50
37510404975
from Crypto.Cipher import AES from Crypto.Util.Padding import pad def random_bytes(range): with open("/dev/urandom", 'rb') as f: return f.read(range) def encrypt_aes_ecb(data, key): cipher = AES.new(key, AES.MODE_ECB) ciphertext = cipher.encrypt(data) return ciphertext def encrypt_aes_cbc(...
iliayg/cracking-bytes
6.py
6.py
py
2,127
python
en
code
0
github-code
50
10203246578
# -*- coding: utf-8 -*- """ Created on Sun Sep 14 16:15:01 2014 @author: Eric Houses all plot functions for county_data_analysis Suffixes at the end of variable names: a: numpy array b: boolean d: dictionary df: pandas DataFrame l: list s: string t: tuple Underscores indicate chaining: for instance, "foo_t_t" is a t...
EricMichaelSmith/county_data_analysis
plotting.py
plotting.py
py
13,967
python
en
code
0
github-code
50
38813537744
from flask import Flask, app, render_template, request, redirect # from collections import defaultdict from uuid import uuid4 from db import VoteDB from model import db,Votes,Topics app = Flask(__name__) # db = VoteDB() @app.route('/') def index(): # topics = db.get_topic_name() topics = list(Topics.select()...
Slth1811/vote-app
app.py
app.py
py
1,811
python
en
code
0
github-code
50
41907756053
import re import textwrap class Color: '''A representation of a single color value. This color can be of the following formats: - #RRGGBB - rgb(r, g, b) - rgba(r, g, b, a) - $other_color - rgb($other_color_rgb) - rgba($other_color_rgb, a) NB: The color components that refer to ot...
RSATom/Qt
qtwebengine/src/3rdparty/chromium/tools/style_variable_generator/color.py
color.py
py
3,714
python
en
code
50
github-code
50
26210543538
import logging from typing import List import re import sys import tiktoken import openai from .base import Engine from .mixin.openai import OpenAIMixin from .settings import SYMAI_CONFIG from ..strategy import InvalidRequestErrorRemedyChatStrategy from ..utils import encode_frames_file logging.getLogger("openai").s...
kpister/prompt-linter
data/scraping/repos/ExtensityAI~symbolicai/symai~backend~engine_gptX_chat.py
symai~backend~engine_gptX_chat.py
py
12,371
python
en
code
0
github-code
50
32489181037
import asyncio import traceback from duckysvc.duckysvc import DuckySvc async def amain(args): try: dsvc = DuckySvc(args.server_ip, args.server_port, lang = args.lang, keyboard_device = args.device) print('DuckySvc running %s:%s' % (args.server_ip, args.server_port)) await dsvc.run() except: traceback.print_e...
skelsec/duckysvc
duckysvc/__main__.py
__main__.py
py
920
python
en
code
4
github-code
50
31081910231
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder, StandardScaler from sklearn.model_selection import train_test_split, KFold, cross_val_score from sklearn.linear_model import Line...
ARRathod/Medical-Insurance-Cost
Untitled.py
Untitled.py
py
5,109
python
en
code
0
github-code
50
9881334201
class DVD: def __init__(self, title, year, director) -> None: self.title = title self.year = year self.director = director def disclose(self): print(self.title + "," + self.director ) mydvd1 = DVD ("Avengers", 2018, "Hulk") mydvd2 = DVD ("Avengers", 2018, "Iron Man") dvdColle...
francman/dailies
python/dvdbox.py
dvdbox.py
py
388
python
en
code
0
github-code
50
41901975280
# -*- coding: utf-8 -*- from five import grok from z3c.form import group, field from zope import schema from zope.interface import invariant, Invalid from zope.schema.interfaces import IContextSourceBinder from z3c.relationfield.schema import RelationList, RelationChoice from plone.formwidget.autocomplete import Au...
crdistefano/sinanet.gelso
sinanet/gelso/scheda_progetto.py
scheda_progetto.py
py
10,254
python
it
code
0
github-code
50
14435176102
import csv import sqlite3 import urllib.request from datetime import datetime import numpy as np import pandas as pd import checkDB # Crea la BD donde se guardaran los datos en caso de que aún no exista la BD. print('Verificando la base de datos...') con = sqlite3.connect('covid.sqlite') cur = con.cursor() cur.execute...
iepenaranda/Capstone-Retrieving-Processing-and-Visualizing-Data-with-Python
leer2.py
leer2.py
py
2,561
python
es
code
1
github-code
50
1870837114
import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder import json from sklearn.preprocessing import MinMaxScaler from sklearn import svm, datasets from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier import os import re import string from te...
shrouk535r/Movie_Popularity_Prediction
preprocessing.py
preprocessing.py
py
18,715
python
en
code
0
github-code
50
72014085594
from django.urls import path from .views import * urlpatterns=[ path('superregister/',superRegister), path('superlogin/',superLogin), path('superprofile/',superProfile), path('adminregister/',adminRegister), path('verify/<auth_token>',verify), path('adminlogin/',adminLogin), path('a...
AshikR7/zybo
zybo/zyboapp/urls.py
urls.py
py
896
python
de
code
0
github-code
50
30205180047
import os from flask import Flask, render_template, request, url_for, send_file, redirect, flash from iok import AwesomeClient, KnowledgeGraph, NodeType, ResourceType from networkx.readwrite import json_graph import networkx as nx import matplotlib.pyplot as plt from flask_github import GitHub from dotenv import load_d...
indexofknowledge/iok
legacy/main.py
main.py
py
3,579
python
en
code
9
github-code
50
38021332858
""" *packageName : * fileName : 11728.배열 합치기(2) * author : ipeac * date : 2022-10-05 * description : * =========================================================== * DATE AUTHOR NOTE * ----------------------------------------------------------- * 2022-10-0...
guqtls14/python-algorism-study
박상준/solved/투포인터/11728.배열 합치기(2).py
11728.배열 합치기(2).py
py
1,068
python
en
code
0
github-code
50
38627596872
# thanks to www.cs.uml.edu/~cgao import smbus import sys import getopt import time import pigpio servos = [23, 24] u = 1.2 x = 600 y = 1900 limit_y_bottom = 1900 limit_y_top = 1300 limit_y_level = 1900 limit_x_left = 600 limit_x_right = 2400 pi = pigpio.pi() def head(y): while y > limit_y_top: pi.set_...
chutasano/laser_controller
pi.py
pi.py
py
1,456
python
en
code
0
github-code
50
20223870527
from django.urls import path from cafe.api import views as api_views urlpatterns = [ path('urunler/',api_views.UrunListCreateAPIView.as_view(),name='urun-listesi'), path('urunler/<int:pk>',api_views.UrunDetailAPIView.as_view(),name='urun-bilgileri'), path('siparisler/',api_views.SiparisListCreateAPIView.a...
hasanbakirci/django-heroku-deploy
cafe/api/urls.py
urls.py
py
454
python
en
code
0
github-code
50
40653836761
import argparse import json import os import os.path as osp import numpy as np from cityscapesscripts.preparation.json2labelImg import json2labelImg from PIL import Image def convert_json_to_label(json_file): label_file = json_file.replace('_polygons.json', '_labelTrainIds.png') json2labelImg(json_file, labe...
brdav/refign
tools/convert_cityscapes.py
convert_cityscapes.py
py
3,645
python
en
code
66
github-code
50
42634397603
import time import queue import threading q = queue.Queue(10) def productor(i): while True: q.put("厨师 {} 做的包子!".format(i)) time.sleep(2) def consumer(j): while True: print("顾客 {} 吃了一个 {}".format(j, q.get())) time.sleep(1) for i in range(3): t = threading.Thread(target=...
AaronYang2333/CSCI_570
records/07-24/productor_customer.py
productor_customer.py
py
470
python
en
code
107
github-code
50
39326730641
''' https://www.practicepython.org/exercise/2014/03/12/06-string-lists.html Exercise 6 (and Solution) Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.) ''' value = str(input("Enter a beautiful string: ")) ...
0xhuesca/PracticePython
06-string-lists.py
06-string-lists.py
py
452
python
en
code
0
github-code
50
10510692099
#!/usr/bin/env python #-*- coding: utf-8 -*- """TermFeed 0.0.11 Usage: feed feed <rss-url> feed -b feed -a <rss-url> [<category>] feed -d <rss-url> feed -t [<category>] feed -D <category> feed -R feed (-h | --help) feed --version Options: List feeds from the ...
iamaziz/TermFeed
termfeed/feed.py
feed.py
py
6,913
python
en
code
249
github-code
50
35808692145
from enum import Enum Color = Enum("Color", "WHITE GREY BLACK") class Vertex: color = Color.WHITE def __init__(self, n): self.name = n def search(vList, vListItem, v:Vertex): v.color = Color.GREY for vi in vListItem: if vi.color == Color.WHITE: return str(v.name)+ " " + search(vList...
stPhoenix/algoritms_lab2
main.py
main.py
py
772
python
en
code
0
github-code
50
21161588387
USE_LATEX = False import sys if USE_LATEX: sys.path.append("../FresnelFDTD/") import mplLaTeX import matplotlib as mpl mpl.rcParams.update(mplLaTeX.params) from matplotlib import pyplot as plt import numpy as np from scipy import stats import json def computeKy( data, fdir ): y = np.array( d...
davidkleiven/OptiX
SlabGuide/analyse.py
analyse.py
py
2,539
python
en
code
1
github-code
50
74367003354
# This is just a basic pyspark "smoke" test import os from pyspark.sql import SparkSession # os.environ['SPARK_MASTER_IP'] = "127.0.0.1" os.environ['SPARK_LOCAL_IP'] = "127.0.0.1" # os.environ['HADOOP_HOME'] = '' spark = SparkSession\ .builder\ .getOrCreate() print("Let's sum the numbers from...
ivangeorgiev/pytest_dbconnect
try_pyspark.py
try_pyspark.py
py
410
python
en
code
2
github-code
50
39722434942
# Carter Strate # CSCI 102 - Section D # Week 10 Lab # References: None # Time: 40 minutes import csv l = [] with open('formations.csv','r') as file: fileReader = csv.reader(file) for row in fileReader: l.append(row) for line in l: if line == l[0]: line.insert(1,'Start Depth') line.i...
cjstrate/IntroToPython
102/Depth/Week10-depth_range.py
Week10-depth_range.py
py
812
python
en
code
0
github-code
50
26378238100
# ''' 1. 아이디어 : 2. 시간복잡도 : 3. 자료구조 : ''' """ # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children if children is not None else [] """ class Solution: def cloneTree(self, root: 'Node') -> 'Node': if not root: ...
724thomas/CodingChallenge_Python
LeetCode/1490CloneNaryTree.py
1490CloneNaryTree.py
py
695
python
en
code
0
github-code
50
21745678736
# Microsoft Cognitive services # # https://azure.microsoft.com/en-us/services/cognitive-services/ # Get API key: https://azure.microsoft.com/en-us/try/cognitive-services/?api=computer-vision # CV API Documentation: https://goo.gl/sc2Rb3 import json import os import requests api_key = "xx" api_url = "https://westeurop...
Slawecky/Python
Day_15/ms_cv.py
ms_cv.py
py
1,657
python
en
code
0
github-code
50
75130563355
# Standard imports import numpy as np import cv2 winName = "Cell fish" def onTunaFishTrackbar(im, brightness, useEqualize=1, blursSize=21, th1=None): winName = "Cell fish" tmp = brightness if (blursSize >= 3): blursSize += (1 - blursSize % 2) tmp = cv2.GaussianBlur(tmp, (blursSize, blursS...
jev26/Hackuarium-GenomicIntegrity-2018
NucleusDetection/Trash/Tuna.py
Tuna.py
py
3,394
python
en
code
0
github-code
50
42093156148
import gtk import gtkhex import gobject from umit.pm.core.i18n import _ from umit.pm.core.logger import log class HexDocument(gtkhex.Document): __gtype_name__ = "PyGtkHexDocument" __gsignals__ = { 'changed' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ...
umitproject/packet-manipulator
umit/pm/gui/widgets/pygtkhexview.py
pygtkhexview.py
py
5,865
python
en
code
16
github-code
50
5111657659
import os from logging import ERROR import boto3 import pytest from _pytest.logging import LogCaptureFixture from app.src.env import Env, get_env, get_env_by_key from moto import mock_ssm @pytest.fixture def set_env() -> None: os.environ["LINE_CHANNEL_SECRET"] = "lcs" os.environ["LINE_CHANNEL_ACCESS_TOKEN"] ...
pep299/dbd_line_bot
app/tests/test_env.py
test_env.py
py
2,116
python
en
code
2
github-code
50
42258636998
#This file contains the python implementation of shadow detector for satellite imagery #Author: Bhavan Vasu import cv2 as cv2 from skimage import io, color import numpy as np import matplotlib.pyplot as plt from PIL import Image filename1='./Im7.tiff' rgb = Image.open(filename1) rgb = np.asarray(rgb) plt.figure() plt....
vbhavank/Shadow-detection-using-LAB-color-space
lab.py
lab.py
py
1,322
python
en
code
16
github-code
50
29776638837
import json from defi_services.lending_pools.cream_service import CreamService if __name__ == "__main__": cream = CreamService("0x38", "https://bsc-dataseed1.binance.org/") pool_token = cream.get_pool_token() wrapped_native_token = cream.get_wrapped_native_token() apy = cream.get_apy_defi_app(pool_tok...
phamvietbang/defi-services-lib
examples/lending_pools/bsc/cream.py
cream.py
py
957
python
en
code
0
github-code
50
12522666835
import os from tumor_utils.wsi import WSI # custom WSI class from tumor_utils.tile import Tile # custom Tile class def tile_wsi_list(wsi_file_list:list, tile_dir:str, tile_size:int=256, level:int=0): # generate a WSI object for each WSI in list for wsi_file in wsi_file_list: print(f"\nTiling file:...
amcrabtree/tumor-finder
scripts/tumor_utils/tiling.py
tiling.py
py
771
python
en
code
1
github-code
50
3547406521
import logging from threading import TIMEOUT_MAX import boto3 from botocore.exceptions import ClientError import os import argparse import sys import json import time sys.path.append('../') from arg_satcomp_solver_base.sqs_queue.sqs_queue import SqsQueue class SolverTimeoutException(Exception): pass class S...
aws-samples/aws-batch-comp-infrastructure-sample
docker/satcomp-images/satcomp-solver-resources/arg_satcomp_solver_base/satcomp_solver_driver.py
satcomp_solver_driver.py
py
6,975
python
en
code
8
github-code
50
39673132700
from PIL import Image, ImageDraw import numpy as np import os # 指定要处理的目录和查找的关键字 directory = "../111" search_keyword1 = "1.2m_2.5m" search_keyword2 = "1.5m_2.5m" # 循环遍历目录中的所有文件 for filename in os.listdir(directory): if filename.endswith(".jpg") or filename.endswith(".JPG"): if search_keyword2 in filename: ...
HunterCQu/python_tools
python4image/add_a_cover.py
add_a_cover.py
py
1,164
python
en
code
0
github-code
50
6312277173
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 INFORMATIONAL_SEVERITY_COLOR = "rgb(64,65,66)" # Black LOW_SEVERITY_COLOR = "rgb(29,184,70)" # Green MEDIUM_SEVERITY_COLOR = "rgb(209,125,0)" # Orange HIGH_SEVERITY_COLOR = "rgb(209,60,60)" # Red CRITICAL_SEVERITY_COLOR = "...
demisto/content
Packs/Campaign/Scripts/ShowCampaignHighestSeverity/ShowCampaignHighestSeverity.py
ShowCampaignHighestSeverity.py
py
2,242
python
en
code
1,023
github-code
50
75131560155
products = { "shelf_one": "beer", "shelf_two": "coffee", "shelf_three": "water", "shelf_four": "banana" } products_values = products.values() products_keys = products.keys() items = products.items() print(f"declaration: {products}") print(f"type: {type(products)}") print(f"values: {products_values}") ...
hotequil/learning-python
dictionaries.py
dictionaries.py
py
1,385
python
en
code
0
github-code
50
40160477350
from __future__ import absolute_import import sys from builtins import range from .Mixins import _ConfigureComponent, PrintOptions from .Mixins import _Labelable, _Unlabelable from .Mixins import _ValidatingParameterListBase from .ExceptionHandling import * from .OrderedSet import OrderedSet class _HardDependency(obj...
cms-sw/cmssw
FWCore/ParameterSet/python/SequenceTypes.py
SequenceTypes.py
py
128,875
python
en
code
985
github-code
50
40905109656
import datetime import os import re import sys from collections import OrderedDict import numpy from . import units from .colormap import ColorMap from .Point import Point from .Qt import QtCore GLOBAL_PATH = None # so not thread safe. class ParseError(Exception): def __init__(self, message, lineNum, line, fil...
pyqtgraph/pyqtgraph
pyqtgraph/configfile.py
configfile.py
py
5,806
python
en
code
3,463
github-code
50
10166043804
''' 去重和排序: 随机生成1~10之间的20个随机数,存入列表中 先输出原始的列表数据 对列表进行去重、排序后输出新列表 ''' import random my_list = [] for n in range(20): rand = random.randint(1,10) my_list.append(rand) # append在末尾添加一个元素 #输出原始列表 for n in my_list: print(n,end=' ') #去重 my_list2 = [] for n in my_list: if n not in my_list2: # 判断是否不存在 my_l...
evynlau/pythonDemo
day4/列表案例2.py
列表案例2.py
py
646
python
zh
code
0
github-code
50
591733928
import h5py import os import numpy as np import cv2 import glob import h5py import keras from sklearn.model_selection import train_test_split Normal_dir = './Normal/' Glaucoam_dir = './Glaucoma/' INPUT_DATA = './RIM-ONE2/' test_DATA = './RIM-ONE2_test/' def create_image_lists(): # f = h5py.File("...
manal-asdg/CNNs_medical
TCNN/finetune_alexnet_with_tensorflow/input_data_3.py
input_data_3.py
py
2,169
python
en
code
0
github-code
50
28322419385
import math def mean(list_of_x): sum_of_x = sum(list_of_x) length_of_x = len(list_of_x) return sum_of_x/length_of_x def variance(list_of_x, mean): mean = mean(list_of_x) new_list = [] for i in list_of_x: new_list.append((i - mean)**2) return sum(new_list)/len(new_list) def sta...
jesulonse/Measures-of-Central-Tendency
Mean,Variance and Standard Deviation.py
Mean,Variance and Standard Deviation.py
py
642
python
en
code
0
github-code
50
15074034885
from .convert import * from .compute_cache import compute_and_store_cached_data import os class StandaloneExporter(DarwinExporter): DRW_CONVERT_FILE = os.path.abspath(os.path.splitext(__file__)[0] + ".drw") def __init__(self, root, name, **kwargs): os.environ["DARWIN_BROWSERDATA_PATH"] = os.path.absp...
DessimozLab/pyoma
pyoma/browser/convert_omastandalone.py
convert_omastandalone.py
py
7,853
python
en
code
0
github-code
50
9828160975
import math import random import pygame from pygame import mixer # Intialize the pygame pygame.init() # create the screen screen = pygame.display.set_mode((800, 600)) # Background background = pygame.image.load('back.png') # # Sound # mixer.music.load("background-music.wav") # mixer.music.play(-1) # Caption and I...
paulknulst/ghost-invader
main.py
main.py
py
4,972
python
en
code
0
github-code
50
42244092128
import sys from itertools import count grid = [list(row.strip()) for row in sys.stdin.readlines()] def step(): moves = False for C, (DX, DY) in [('>', (1, 0)), ('v', (0, 1))]: tries = ( ((x, y), ((x+DX)%len(row), (y+DY)%len(grid))) for y, row in enumerate(grid) for x, c in enumerate(row) i...
ShuP1/AoC
src/2021/25.py
25.py
py
641
python
en
code
0
github-code
50
38349050173
""" Description: Given an array of integers , Find the minimum sum which is obtained from summing each Two integers product . """ def min_sum(arr): arr.sort() end = len(arr) sum = 0 # print(arr[:end // 2], arr[-1:end // 2 - 1:-1]) for pair in zip(arr[:end // 2], arr[-1:end // 2 - 1:-1]): su...
MaximSinyaev/CodeWars
c7kyu/minimize-sum-of-array-array-series-number-1.py
minimize-sum-of-array-array-series-number-1.py
py
416
python
en
code
0
github-code
50
42584067781
import os, stat import numpy as np import utils.run_analysis as ana import datatable as dt def read_match_timestamps(base_dir, target_fps, subject, trial, num_cameras=1): ''' Readin timestamps from all devices and match them to a common timestamp, repeating frames if needed. NOTE: You may need to fix ...
vdutell/st-bravo_analysis
read_match_timestamps.py
read_match_timestamps.py
py
5,221
python
en
code
0
github-code
50
19811541836
# -*- coding: utf-8 -*- # Author: Yiqiao Wang # Date: 27.02.2022 import mne import os import numpy as np import scipy.io def read_raw_edf(path): """ load in raw data that stored in the given path :param path: string, path of raw data :return: """ raw = mne.io.read_raw_edf(path, preload=Tru...
yqwang306/code
util/eeg_utils.py
eeg_utils.py
py
5,922
python
en
code
1
github-code
50
13511664055
# -*- coding: UTF-8 -*- # Roll- drone left-right tilt. (must be in [-100:100]) # Pitch- drone front-back tilt. (must be in [-100:100]) # Gaz- drone vertical speed. (must be in [-100:100]) # Yaw- drone angular speed. (must be in [-100:100]) import olympe from olympe.messages.ardrone3.Piloting import TakeOff, moveBy,...
Duke-XPrize-Anafi-GUI/DukeXPrizeAnafiGUI
misc/control_test.py
control_test.py
py
1,570
python
en
code
5
github-code
50
12849727794
import boto.rds import boto.ec2 import datetime import time import argparse import collections from datetime import date, timedelta from boto.exception import BotoServerError def getSnapshots(): "Lists all snapshots that were created using this script" snapshotList = [] for snapshot in dbSnapshots: ...
mminges/cf-scripts
pcf-db-script.py
pcf-db-script.py
py
8,425
python
en
code
0
github-code
50
32345763727
from pathlib import Path import pandas as pd from config import CsvCube, CsvCubeConfig import csvwtools hmrc_ots_cn8_config = CsvCubeConfig.from_info_json(Path("info.json"), "hmrc-ots-cn8") hmrc_ots_cn8_cube = CsvCube(hmrc_ots_cn8_config) # Alternatively we could have something like # hmrc_ots_cn8_cube = csvwtools...
robons/cubes-chunk-proposal
example.py
example.py
py
1,399
python
en
code
0
github-code
50
25457278941
from tkinter import * from tkinter import font import psutil from psutil import disk_partitions, disk_usage, virtual_memory, cpu_percent from tabulate import tabulate window = Tk() window.geometry("1024x768") window.title("CPU - RAM - DISK USAGE") # Función para mostrar información de la CPU def show_cpu_info(): ...
JuanDQuintero/SO-FinalProject
cpu.py
cpu.py
py
4,889
python
en
code
0
github-code
50
14880553944
from pathlib import Path from typing import List, Tuple class InfoBase: """ InfoBase to construct the project Attributes: licenses: list of license paths """ def __init__(self): self._root = Path(__file__).parent self.templates = self._root.joinpath('templates') s...
pradyparanjpe/pyprojstencil
pyprojstencil/read_templates.py
read_templates.py
py
1,115
python
en
code
0
github-code
50
28138894249
import requests # define the api url url = 'https://jsonplaceholder.typicode.com/users' # api call response = requests.get(url) # get the data from the response data = response.json() # giving the user wanted to find options = '\n*** id - name - username - website - email - address - phone - company *** \n' input = inp...
aliakbarzohour/python-api
api.py
api.py
py
914
python
en
code
0
github-code
50
21874387158
from typing import List # https://leetcode.com/problems/word-search/ class Solution79: def exist(self, board: List[List[str]], word: str) -> bool: # O(m*n* 3^L) m, n = len(board), len(board[0]) nw = len(word) seen = set() directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] de...
sunjianbo945/leetcode
src/data_structure/search/dfs_find_specific_path.py
dfs_find_specific_path.py
py
3,033
python
en
code
0
github-code
50
26176041593
import numpy as np from Averages import * class LCFS: ''' Klasa odpoweidzialna za policzenie czasu oczekiwania (metoda waitingTime) i czasu przetwarzania (metoda processing time) dla algorytmu LCFS ''' def __init__(self,arr,wt,pt): ''' Konstruktor klasy przyjmuje 4 argumenty, odpowi...
BartoszSochacki/Process-scheduling-simulation
LCFS.py
LCFS.py
py
2,639
python
pl
code
0
github-code
50
18018350288
""" URLs for `admin_dashboard.applications` app """ from django.urls import include, path from openedx.adg.admin_dashboard.applications.views import ApplicationDetailView, ApplicationListingView from openedx.adg.lms.applications.models import UserApplication from .views import ApplicationsDashboardView urlpatterns =...
OmnipreneurshipAcademy/edx-platform
openedx/adg/admin_dashboard/applications/urls.py
urls.py
py
1,106
python
en
code
null
github-code
50
16548413203
import pandas as pd import matplotlib.pyplot as plt from tabulate import tabulate import statsmodels.api as sm import numbers def print_tabulate(df: pd.DataFrame): print(tabulate(df, headers=df.columns, tablefmt='orgtbl')) # Regresión Linear def transform_variable(df: pd.DataFrame, x:str)->pd.Series: if isin...
JuanD254/Mineriadatos
Practica6Regresion.py
Practica6Regresion.py
py
1,350
python
en
code
0
github-code
50
29007126713
filename = 'pi_million_digits.txt' with open(filename) as file_object: # open()返回的对象只在with代码块内可用 lines = file_object.readlines() pi_string = '' for line in lines: pi_string += line.strip() # print(len(pi_string)) birthday = input("Please input your birthday, in the form mmddyy: ") if birthday in pi_string: ...
wngq/PythonCrashCourse
chapter10/pi_birthday.py
pi_birthday.py
py
384
python
en
code
0
github-code
50
9076575089
#services/users/manage.py import unittest import coverage # new from flask.cli import FlaskGroup from project import create_app, db # new from project.api.models import User, Document, Documententity, Entity # new COV = coverage.coverage( branch=True, include='project/*', omit=[ 'project/tests/...
Poeteta/Aplication_Arq
services/documents/manage.py
manage.py
py
2,623
python
en
code
0
github-code
50
74906671835
from io import BytesIO import xlsxwriter def get_format(workbook, bold=False): f = workbook.add_format() if bold: f.set_bold() f.set_font_name('Arial') f.set_font_size(11) f.set_align('left') f.set_align('vcenter') f.set_font_color('black') return f def build_sheet(workbook,...
Haner27/open-box
open_box/xlsx/writer.py
writer.py
py
1,160
python
en
code
1
github-code
50
8083088150
#!/usr/bin/env python # -*- coding: utf-8 -*- import math import numpy as np # def fun(x,y,z,d,a1,a2): # pass def getDistanceAngle(pixel_x, pixel_y, real_z): camera_fx = 383.599 camera_fy = 383.599 camera_cx = 320.583 camera_cy = 238.327 z = np.float(real_z) x = (pixel_x-camera_cx)*z/ca...
Kester-Broatch/DroneAlgos
CA_functions.py
CA_functions.py
py
767
python
en
code
0
github-code
50
33543354383
import cv2 import matplotlib.pyplot as plt # Matching 2 Images better than simple template matching template = cv2.imread('Pic-11.png') img = cv2.imread('Pic-12.png') orb = cv2.ORB_create() kp1, des1 = orb.detectAndCompute(template, None) kp2, des2 = orb.detectAndCompute(img, None) bf = cv2.BFMatcher(cv...
MordredGit/OpenCV-Codes
10. featureMatchingUsingOrb.py
10. featureMatchingUsingOrb.py
py
553
python
en
code
0
github-code
50
14063219075
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from DDPG_agent import * from ReplayBuffer import * from configs import * class MADDPG_agent: def __init__(self,env,brain_name,buffer_size = BUFFER_SIZE,batch_size = BATCH_SIZE,update_every = UPDATE_EVERY, learn...
mojishoki/DRL-Multi-Agent-Collaboration-Competition-P3
MADDPG/MADDPG_agent.py
MADDPG_agent.py
py
5,990
python
en
code
0
github-code
50
18445820766
from pymongo import MongoClient from bson import ObjectId import os client = MongoClient('localhost', 27017) root = client.root print("Connected to db") basedir = os.getcwd() for dir in os.listdir(basedir): if dir != 'insert-image-names.py': print(dir) dbQuery1 = root.grounds.find({'_id': ObjectId(dir)}) gr...
nishank-jain/profile
migrations/insert-image-names.py
insert-image-names.py
py
759
python
en
code
0
github-code
50
19348907679
from flask import Flask, jsonify from flask import request from flask_cors import CORS import util.personal_opinion as personal_opinion # configuration DEBUG = True app = Flask(__name__) app.config.from_object(__name__) CORS(app, resources={r'/*': {'origins': '*'}}) @app.route('/extract-opinion', methods=['POST']) d...
LiamWahahaha/opinion-extraction
server/app.py
app.py
py
531
python
en
code
0
github-code
50
13449476635
import numpy as np import pandas as pd import streamlit as st st.set_page_config(page_title='Titanic Survival Prediction App', layout='wide') import csv st.title("App to Predict Survival Chances in Titanic") def mode(lum): train = pd.read_csv('C:/Users/rocki/OneDrive/Desktop/mlapp/train.csv') ...
ravi3507/titanic_prediction_app
titanic.py
titanic.py
py
6,860
python
en
code
0
github-code
50
32403932172
# time complexity = O(nk) from collections import deque def max_in_sliding_window_1(array, k): if not array: return [] if len(array) < k: return [max(array)] result = [] for i in range(len(array) - k + 1): max_in_array = array[i] for j in range(i, i + k): ...
sudhirsinghshekhawat/problem_solving
algoexpert/maxinslidingwindow.py
maxinslidingwindow.py
py
974
python
en
code
0
github-code
50
18223839390
def palabras(lista): lista.sort() texto = "Las palabras ordenadas son:\n" for i in range (0,len(lista)): if i != len(lista)-1: texto = texto + lista[i] + ", " else: texto = texto + lista[i] print(texto) if __name__ == "__main__": lista = [] palabra = input("Ingrese palabra: (ingreso vacio terminara la ...
PedroArr/info175_-Pedro_Arriagada-
Ejercicio2.py
Ejercicio2.py
py
435
python
es
code
0
github-code
50
42372133362
import tensorflow as tf import numpy as np import argparse import sys from flask import Flask, request, Response, jsonify app = Flask(__name__) predict = None def pre_processing(pixels): #standarize pixels # pixels = pixels - pixels.mean(axis=1).reshape(-1, 1) # pixels = np.multiply(pixels, 100.0/255.0) ...
Whoseop-Song/Emotion-Reader-Service
predict.py
predict.py
py
1,764
python
en
code
0
github-code
50
11310958908
import numpy as np def dimensional_stacking(data, x_dims, y_dims): """ Stack an n-dimensional ndarray in two dimensions according to the dimensional ordering expressed by x_dims and y_dims. See LeBlanc, Ward, Wittels 1990, 'Exploring N-Dimensional Databases'. * data: n-dimensional ndarray (e....
epiasini/dimstack
core.py
core.py
py
1,009
python
en
code
3
github-code
50
536115605
import time import requests import hashlib import hmac import datetime as dt import os api_key = os.getenv('binance_api_key') secret_key = os.getenv('binance_secret_key') BALANCE_URL = 'https://fapi.binance.com/fapi/v2/balance?{}&signature={}' ACCOUNT_URL = 'https://fapi.binance.com/fapi/v2/account?{}&signature={}' P...
99products/MyBinanceBot
mybinance.py
mybinance.py
py
3,726
python
en
code
1
github-code
50
71994980635
num = [[],[]] p = 's' for i in range(0,6): no = int(input('Valor:')) if no % 2 == 0: num[0].append(no) else: num[1].append(no) print(f'Todos os valores {sorted(num)}') print(f'Numeros pares {sorted(num[0])}') print(f'Numeros ímpares {sorted(num[1])}')
ArthPx/learning-code
d 85.py
d 85.py
py
292
python
pt
code
0
github-code
50
5916683078
import requests import json ENDPOINT: str = 'https://api.spacexdata.com/v5/launches/latest' my_request = requests.get(ENDPOINT) status_code: int = my_request.status_code message: str = json.loads(my_request.content) if (status_code == 200): print("THE API WORKS") else: print(':*(') print(message) print(mes...
KCarey91/python-practice
APIs/test.py
test.py
py
453
python
en
code
0
github-code
50
17904977429
# *Input a collection of employee names with their salary, calculate average salary in organisation, # get the employee with highest salary, get the employee with lowest salary print results. employee = {'Anny': 60000, 'Avo': 50000, 'Vars': 25000, 'Sed': 100000} limit = int(input('Input a limit count for employee`s len...
TatevAgh/Python_lessons
homeworks/Python homework 6/Ex5.py
Ex5.py
py
766
python
en
code
0
github-code
50
40825386129
import os import collections import random import numpy as np import torch from torch import optim from torch.utils.tensorboard import SummaryWriter from typing import Optional, List from agents.spectral.configs import get_laprepr_args from agents.spectral.utils import torch_tools, timer_tools, summary_tools from agen...
LucasCJYSDL/Scalable_MAOD_based_on_KP
continuous/MADO_n_agent_force/agents/spectral/learners/laprepr.py
laprepr.py
py
17,869
python
en
code
0
github-code
50
3212200237
from flask import render_template, redirect, session, url_for, request from flask.views import View from src.models import User from src.config import db, app, mail, lang from flask_login import login_user, current_user, login_required from wtforms.validators import InputRequired from src.models import User, Particip...
invite-me/invite.me
src/declarate/create/views.py
views.py
py
3,651
python
en
code
0
github-code
50
8652550275
import sys sys.stdin = open("input3.txt", "r") from pandas import DataFrame # 기본 남 북 동 서 # 0 1 3 0 0 # 4 1 5 4 2 5 4 0 5 1 5 3 3 4 1 # 2 3 1 2 2 # 3 0 2 4 5 def move(go, dice): ...
TValgoStudy/algo_study
쌔피맨조/다은/BOJ14499/BOJ14499.py
BOJ14499.py
py
1,670
python
ko
code
3
github-code
50
5965945056
import numpy as np import json def compute_bounding_box_dimensions(vertices): min_coords = np.min(vertices, axis=0) max_coords = np.max(vertices, axis=0) dimensions = max_coords - min_coords return dimensions def load_obj(file_path): vertices = [] with open(file_path, 'r') as obj_file: ...
puiyu11/Hackathon
bounding_box_dimensions.py
bounding_box_dimensions.py
py
1,534
python
en
code
0
github-code
50
70344464474
# -*- coding: utf-8 -*- """ Created on Tue May 12 14:56:26 2020 @author: jvan1 """ import matplotlib.pyplot as plt from sklearn import datasets from sklearn.linear_model import LinearRegression from sklearn.cluster import KMeans def bostonCoefficient(): data = datasets.load_boston() x = data.data y = da...
Vansantj/FE595-SKLearn
sklearn_introduction.py
sklearn_introduction.py
py
1,325
python
en
code
0
github-code
50