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
32954738112
from ast import Num from tkinter import Image from cv2 import Mat, addWeighted # def brightnessContrast(source: Mat, brightness: int, contrast: int): # clone = source.copy() # result: Mat # result = brightness(source, brightness) # if contrast != 0: # f = 131 * (contrast + 127) / (127 * (131 ...
TheColorRed/image-editor
image-processor/Source/filters/brightness.py
brightness.py
py
922
python
en
code
0
github-code
13
7831720020
import random from faker import Faker from faker.providers import BaseProvider from juriscraper.lib.string_utils import titlecase from reporters_db import REPORTERS from cl.custom_filters.templatetags.text_filters import oxford_join fake = Faker() class LegalProvider(BaseProvider): def random_id(self) -> str: ...
freelawproject/courtlistener
cl/tests/providers.py
providers.py
py
3,442
python
en
code
435
github-code
13
22645886082
from threadlocal_aws.resources import s3_Bucket as bucket_r from ec2_utils.utils import prune_array, delete_selected def prune_s3_object_versions( bucket=None, prefix="", ten_minutely=288, hourly=168, daily=30, weekly=13, monthly=6, yearly=3, dry_run=False, ): time_func = lambd...
NitorCreations/ec2-utils
ec2_utils/s3.py
s3.py
py
1,036
python
en
code
1
github-code
13
71397740498
import ahocorasick ''' function substring_intersect (substrings text[], search_strings text[)** A fast, multi-string to joining 2 datasets using a 'like %pattern%' - returns substrings and what they matched - substring text, matched_search_strings text[] ''' def substring_intersect(substrings, search_strings): ...
jmfn/py-substring-intersect
substring_intersect.py
substring_intersect.py
py
1,647
python
en
code
0
github-code
13
32276755893
# exercise 12: Distance Between Two Point on Earth import math t1 = float(input('enter latitude 1: ')) t2 = float(input('enter latitude 2: ')) g1 = float(input('enter longitude 1: ')) g2 = float(input('enter longitude 2: ')) # converting into radians t1 = math.radians(t1) t2 = math.radians(t2) g1 = math.radians(g1...
sara-kassani/1000_Python_example
books/Python Workbook/introduction_to_programming/ex12.py
ex12.py
py
539
python
en
code
1
github-code
13
73654501139
from setuptools import setup with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup(name='random-brain', version='0.1.2', description='Python Random Brain Module', long_description=long_description, long_description_content_type="text/markdown", author='Ethan N...
einelson/Random-brain
setup.py
setup.py
py
947
python
en
code
0
github-code
13
24550906423
import time, copy from smbus import SMBus from RPiSensors.BMP280 import BMP280 from RPiSensors.MPU9250 import MPU9250 class SensorChannel: def __init__(self, sample, period, coefficients, bands, secondary_duration): self.sample_func = sample self.period = period self.coefficients = coeffi...
Maker42/openEFIS
RPiSensors/sensors.py
sensors.py
py
8,358
python
en
code
13
github-code
13
31773626554
import requests import socket import json from uuid import getnode as get_mac url = "http://18.235.27.33/api/user/login" payload = "email=jfbauer%40oakland.edu&password=432234" headers = {'Content-Type': 'application/x-www-form-urlencoded'} response = requests.request("POST", url, data=payload, headers=heade...
mblaul/skypi
pi/py/register.py
register.py
py
955
python
en
code
1
github-code
13
35290099459
import yagmail from smtplib import SMTPAuthenticationError from os import path from typing import Optional from tempfile import mkdtemp from ovos_utils.log import LOG, log_deprecation from ovos_config.locations import get_xdg_config_save_path from ovos_config.config import Configuration from neon_utils.file_utils impo...
NeonGeckoCom/neon_email_proxy
neon_email_proxy/email_utils.py
email_utils.py
py
3,042
python
en
code
0
github-code
13
14934780693
import os import base64 import random from flask import Flask, request, jsonify from predict import Tampering_Detection_Service ELA_EXT = ".ela.png" TMP_EXT = ".temp.jpg" # instantiate flask app app = Flask(__name__) @app.route("/predict", methods=["POST"]) def predict(): """ """ file_name = request.fi...
carlosagil/ela
server/flask/server.py
server.py
py
1,199
python
en
code
1
github-code
13
32307868435
def level_averages(root): if root is None: return [] results = [] levels = [] stack = [(root, 0)] while stack: curr_node, level = stack.pop() if len(levels) == level: levels.append([curr_node.val]) else: levels[level].append(curr_node.val) if curr_node.right: stack.a...
kabszac/dsandalgo
binarytree/levelaverages.py
levelaverages.py
py
541
python
en
code
0
github-code
13
35451451042
# -*- coding:utf-8 -*- import requests from scrapy.selector import Selector import pymysql headers = { "Host": "www.xicidaili.com", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.360", "Accept": "text/html,application/xhtml+xml...
SatoKoi/BilibiliSpider
tools/getIp.py
getIp.py
py
3,641
python
en
code
15
github-code
13
72870809939
class Solution: def isValid(self, s: str) -> bool: opening = "([{" closing = ")]}" parens = dict(zip(opening, closing)) stack = [] for ch in s: if ch in opening: stack.append(ch) elif ch in closing: if not stack or ch !=...
dahui-sharon-kim/algorithms
stack/valid_parentheses02.py
valid_parentheses02.py
py
618
python
en
code
0
github-code
13
74332251538
import json import random from collections import Counter class AgenteAdivinhacaoPalavras: def __init__(self, palavras): self.palavras = palavras self.palavra = random.choice(palavras) self.palavra_oculta = ['_' for _ in self.palavra] self.palavras_tentadas = set() def adivinha...
HianPraxedes/Adivinhador-de-palavras
adivinharPalavras.py
adivinharPalavras.py
py
2,329
python
pt
code
0
github-code
13
68716082
import datetime import csv import pandas as pd import ipaddress WAIT=2 #タイムアウトがこの回数を超えたとき故障とみなす WAIT=2なら3回連続でタイムアウトした時に故障と判定される PING_OVER=100 #平均がこの値を越えたら過負荷状態とみなす AVE_RANGE=3 #平均をとる範囲 df = pd.read_csv("server_log_subnet.csv",index_col=["server_address"]) df= df.sort_values(["server_address","datetime"]) allserver...
TNishikubo/programming_exam
設問4.py
設問4.py
py
5,254
python
ja
code
0
github-code
13
11611697077
import unittest from factoryMethod import pessoa __author__ = 'Bruno' class Test(unittest.TestCase): def test_customer(self): customer = pessoa.PersonFactory().build_person("customer") customer.name = "Bruno" customer.say_hello() self.assertTrue(isinstance(customer, pessoa.Custome...
brunodmartins/PythonPatterns
factoryMethod/test_factoryMethod.py
test_factoryMethod.py
py
594
python
en
code
2
github-code
13
35604571139
import numbers import warnings import networkx as nx import numpy as np from queueing_tool.graph.graph_functions import _test_graph, _calculate_distance from queueing_tool.graph.graph_wrapper import QueueNetworkDiGraph from queueing_tool.union_find import UnionFind def generate_transition_matrix(g, seed=None): ...
djordon/queueing-tool
queueing_tool/graph/graph_generation.py
graph_generation.py
py
14,578
python
en
code
60
github-code
13
2503835996
# -*- coding: utf-8 -*- """ Created on Wed Mar 11 10:13:13 2015 @author: droz DO NOT USE - DEPRECIATED """ from DataManager import NewsSource, News from MessageManager import MessageManager import datetime import time def hasAnyofTheresKeywords(keywords, text): for word in keywords: if(word in text): ...
wdroz/TM_2014-2015S2
src/ReutersNewsSource.py
ReutersNewsSource.py
py
5,711
python
en
code
1
github-code
13
27216179938
import glob import logging import os import random import types from collections import namedtuple from enum import Enum, auto import numpy as np import pandas as pd import mne from config import LABELED_ROOT, PROJ_ROOT, DATA_ROOT, CHANNEL_NAMES from data.utils import (get_index, get_trial, df_from_tdt, df_from_fif, ...
mirgee/thesis_project
src/data/data_files.py
data_files.py
py
7,560
python
en
code
0
github-code
13
35652549979
from splinter import Browser from bs4 import BeautifulSoup import re import time import requests import datetime as dt from flask import Flask from flask_pymongo import PyMongo app = Flask(__name__) app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app" mongo = PyMongo(app) @app.route("/") ...
avillalobosd/web-scraping-challenge
scrape_mars.py
scrape_mars.py
py
3,080
python
en
code
0
github-code
13
26187440655
from time import sleep import unittest from androidparent import * class AndroidTestApiDemos(AndroidParentTest): def changeDesiredCaps(self): self.desired_caps['appPackage'] = 'io.appium.android.apis' self.desired_caps['appActivity'] = 'io.appium.android.apis.ApiDemos' def test_find_elements...
tdeuren/Appium_android_test_setup
android/androidtest1.py
androidtest1.py
py
1,472
python
en
code
0
github-code
13
28374545049
import numpy as np from . import VecEnvWrapper class VecMonitor(VecEnvWrapper): def __init__(self, venv): VecEnvWrapper.__init__(self, venv) self.eprets = None self.eplens = None self.epcount = 0 def reset(self): self.eprets = np.zeros(self.num_envs, "f") self...
ASzot/rl-utils
rl_utils/envs/vec_env/vec_monitor.py
vec_monitor.py
py
1,064
python
en
code
3
github-code
13
17552702055
from PIL import Image """ useful link for mixing image https://defpython.ru/prostoe_nalozhenie_izobrazhenii_v_Python """ img = Image.open("image/SZE3.png") watermark = Image.open("image/6363.png") secondmark = Image.open("image/123333.png").convert("RGBA") img.paste(watermark, (500,100), watermark) img.paste(secondm...
IDDeltaQDelta/crpyt
mixer.py
mixer.py
py
417
python
en
code
0
github-code
13
74855045777
# coding:utf-8 __author__ = 'ym' import json import pymysql import jieba import pygal from wordcloud import WordCloud class XmComment(object): def __init__(self): self.conn = pymysql.connect(user='root', password='123', db='test') self.cursor = self.conn.cursor() def get_dict(self, num): ...
Ewenwan/python_study
tutorial/爬虫考试/taobao.py
taobao.py
py
5,419
python
en
code
1
github-code
13
26993751915
''' Implement the total_words() function which will find the total number of words in a trie. ''' from Trie import Trie from TrieNode import TrieNode # TrieNode => {children, is_end_word, char, # mark_as_leaf(), unmark_as_leaf()} def total_words(root): num = 1 if root.is_end_word else 0 for...
myers-dev/Data_Structures
trie/total_num_words.py
total_num_words.py
py
424
python
en
code
1
github-code
13
21582346356
from django import template register = template.Library() @register.filter def agenda_width_scale(filter_categories, spacer_scale): """Compute the width scale for the agenda filter button table Button columns are spacer_scale times as wide as the spacer columns between categories. There is one fewer ...
ietf-tools/old-datatracker-branches
ietf/meeting/templatetags/agenda_filter_tags.py
agenda_filter_tags.py
py
608
python
en
code
5
github-code
13
9925371231
from maya import cmds from zUtils import attributes from .tags import ZIVA_MUSCLES class Muscles(object): def __init__(self, root, character=None): # define variables self._root = root # validate character if not character and not self.character: raise RuntimeError("De...
jonntd/maya-ziva-dynamics-utils
scripts/zMuscles/base.py
base.py
py
2,122
python
en
code
0
github-code
13
31629219282
#!/usr/bin/python # -*- coding: utf-8 -*- import MoNeT_MGDrivE as monet import matplotlib.pyplot as plt import mating_auxiliary as aux import numpy as np plt.rcParams.update({'figure.max_open_warning': 0}) ############################################################################## # Notes ########################...
Chipdelmal/MoNeT
DataAnalysis/MatingEfficiency/mating_main.py
mating_main.py
py
5,320
python
en
code
7
github-code
13
11680095890
from flask import Flask, jsonify, request app = Flask(__name__) import sqlite3 import datetime from datetime import timedelta import pdb from gevent.pywsgi import WSGIServer DATABASE = "/home/pi/greenhouse/data.db" def rounder(t): """ Rounds the time down to the minute """ return t.replace(second=0,...
juatabot/greenhouse
server.py
server.py
py
3,212
python
en
code
0
github-code
13
30998817591
#!/urs/bin/python3.8 import turtle as tt from turtle import * import sys import random from sys import stdin import time from random import randint as rand import math # el orden de los factores si altera el producto colors =[ '#FFFFFF' , '#F01bc4', '#000000' , '#11E511', '#1bc3F7' , '#1e1f11', ...
Ron4-kw0rk3r/GVphjs_practice
Pjct_V-gphs/attemp002.py
attemp002.py
py
1,338
python
en
code
1
github-code
13
29136008833
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('assessment', '0125_trackapp'), ] operations = [ migrations.DeleteModel( name='G_Form_ID', ), mig...
ilewis01/SimeonAcademy
SimeonAcademy/assessment/migrations/0126_auto_20160720_0510.py
0126_auto_20160720_0510.py
py
999
python
en
code
0
github-code
13
6475994992
import toolutils class Hostapd(object): ''' basic hostapd conf file handling ''' def __init__(self, path, backup_path=None): self._config = {} self._path = path if not backup_path: self.backup_path = path + ".bak" else: self.backup_path = backup_path ...
dggreenbaum/debinterface
hostapd.py
hostapd.py
py
5,110
python
en
code
26
github-code
13
15458709307
# -*- coding: utf-8 -*- from AWSScout2.configs.regions import RegionalServiceConfig, RegionConfig ######################################## # DirectConnectRegionConfig ######################################## class DirectConnectRegionConfig(RegionConfig): """ DirectConnect configuration for a single AWS reg...
nccgroup/Scout2
AWSScout2/services/directconnect.py
directconnect.py
py
1,299
python
en
code
1,729
github-code
13
6312838424
import cx_Oracle from config.config import * from population.helper import noApos ORACLE_CONN_STRING = sql_login SQL_STATEMENT = ( "WITH {} " "SELECT DISTINCT lnm0.movie_id, lnm0.title, lnm0.release_date, lnm0.budget, lnm0.revenue, lnm0.popularity, lnm0.rating_average, lnm0.rating_cou...
chasefarmer2808/ReposiMovie-API
queries/adv_search.py
adv_search.py
py
4,098
python
en
code
0
github-code
13
18029119882
from Products.CMFCore.utils import getToolByName from Products.CMFPlomino.PlominoForm import PlominoForm from Products.CMFPlomino.PlominoDocument import PlominoDocument from Products.CMFPlomino.index import PlominoIndex from Products.CMFPlomino.exceptions import PlominoScriptException #from Products.CMFPlomino.Plomino...
gisweb/gisweb.utils
src/gisweb/utils/plomino_addons.py
plomino_addons.py
py
10,213
python
en
code
1
github-code
13
41822896269
import datetime import sys import logging import os from enum import Enum from datetime import date import json import traceback from cookie import ws_key_to_pt_key # 封装UserInfo # 方便扩展修改维护 import requests class LoginStatus(Enum): # ck 更新过 NEED_CHECK = 0 # 上次检查登陆有效 LAST_LOGINED = 1 # 上次检查是无效登陆 ...
imwcc/jd_imwcc
pythonProjects/ck_manager/UserInfo.py
UserInfo.py
py
14,176
python
en
code
2
github-code
13
73525333137
# -*- coding: utf-8 -*- """ Created on Wed Jul 19 12:02:20 2017 @author: lenovo """ class Setting(): #储存游戏的设置信息 def __init__(self): self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230,230,230) #飞船静态设置 self.ship_limit = 3 ...
funiazi/Alien-Game
setting.py
setting.py
py
1,355
python
en
code
0
github-code
13
35981797802
#!/usr/bin/python # -*- coding: UTF-8 -*- # author:@Jack.Wang # time :2018/8/14 17:57 from vnctpmd import MdApi import time import os import pandas as pd from data_get_save.PostgreSQL import PostgreSQL import datetime from data_get_save.futures_time import futures_time from data_get_save.futures_info_process import fu...
wangyundlut/Futures_Quant
ctp/md_api_mine.py
md_api_mine.py
py
7,633
python
en
code
1
github-code
13
12117567713
""" 爬取某人抖音账号中所有短视频信息 """ import time from pandas import DataFrame from selenium.webdriver.common.by import By from common.selenium_tools import SeleniumHelper with SeleniumHelper() as driver: driver.get( "https://www.douyin.com/user/MS4wLjABAAAAb4b5X-nNL8bEJv1WtUAfxVPdLOFNZftqHYPk5_FZqJXj2AhqfcyvX0mv...
15149295552/Code
Month07/day18_python/demo04.py
demo04.py
py
1,338
python
en
code
1
github-code
13
41882953210
def determine_bfs(start, edges, seen): found_vertices = 0 previous = -1 current = start while current != start or previous == -1: if current not in edges: return False seen.add(current) found_vertices += 1 tmp = previous previous = current cu...
danherbriley/acm4
01/split_into_two_sets.py
split_into_two_sets.py
py
1,754
python
en
code
0
github-code
13
73924062739
"""" lists """ import random # I learnt to access a nested list you have to access the row you want first then the element in the list. # Think of each list in a nested list as a row # Some people pass 13 meaning column 1 row 3. # =======================================================================================...
kvngdre/100DaysofPythonCode
Day4.py
Day4.py
py
1,661
python
en
code
0
github-code
13
25191683254
""" Advent of Code 2015 Day 3: Perfectly Spherical Houses in a Vacuum (Part Two) """ with open("./input.txt", encoding="utf-8") as file: data = file.read() class Houses: def __init__(self) -> None: self._grid = {} self._x = 0 self._y = 0 def _add(self) -> None: try: ...
pedroboechat/adventofcode
2015/Day 03/part_two.py
part_two.py
py
1,055
python
en
code
0
github-code
13
73599058577
import copy def calculate_occupied(rows): next_round = rows while True: current_sp = next_round.copy() next_round = [] for row in range(len(rows)): new_row = '' for seat in range(len(rows[row])): occ_count = 0 # Top Left ...
mereszd/aoc2020
11_01.py
11_01.py
py
2,305
python
en
code
0
github-code
13
4970127523
n = int(input()) a = list(map(int, input().split())) cnt = [0] * 100001 l = res = count = 0 for r in range(n): if (cnt[a[r]] == 0): count += 1 cnt[a[r]] += 1 while count > 2: cnt[a[l]] -= 1 if cnt[a[l]] == 0: count -= 1 l += 1 res = max(res, r...
truclycs/code_for_fun
algorithms/python/python_blue/L02/B._Approximating_a_Constant_Range.py
B._Approximating_a_Constant_Range.py
py
345
python
en
code
7
github-code
13
75079112976
# -*- coding: UTF-8 -*- from flask import Flask, request import cloudscraper app = Flask(__name__) # 默认路由/,支持GET方法 @app.route('/', methods=['GET']) def index(): return 'Hello World!' @app.route('/proxy', methods=['GET']) def proxy(): url = request.args.get('url') UserAgent_str = request.args.get('User-...
tridiamondli/forwardrequest
forwardrequest.py
forwardrequest.py
py
931
python
en
code
0
github-code
13
36925151312
# -*- coding: utf-8 -*- """ Created on Sun Nov 18 10:00:10 2018 @author: WakeSurfin1 @ created 2018-11-18 parse a .csv file, skip the header row calculate age based on dob out put year of service and age to scatter chart """ from datetime import datetime from logger_class import Logger from configpa...
WakeSurfin1/Python
Parse_Csv_to_ScatterChart.py
Parse_Csv_to_ScatterChart.py
py
2,670
python
en
code
0
github-code
13
73912920979
from cement import App, TestApp, init_defaults from cement.core.exc import CaughtSignal from .core.exc import DotBakError from .controllers.base import Base # configuration defaults CONFIG = init_defaults('dotbak') CONFIG['dotbak']['suffix'] = '.bak' CONFIG['dotbak']['timestamps'] = True class DotBak(App): """Do...
datafolklabs/dotbak
dotbak/main.py
main.py
py
1,810
python
en
code
2
github-code
13
2609948517
import turtle import random names = [] a = turtle.textinput("Name of Student", "Enter a student's name, click enter to exit") while a != " ": names.append(a) a = turtle.textinput("Name of Student", "Enter a student's name, click space and enter to exit") for x in range(len(names)): print(x + 1, ".", names[...
Aadhithr/Personal
PythonWork/PythonCourse/homework/uses_random/random name genarator.py
random name genarator.py
py
386
python
en
code
0
github-code
13
13642456081
import os import subprocess locations = [ "C:\\Program Files (x86)\\Proxifier\\Proxifier.exe", ] def start_proxifier(): for l in locations: if os.path.isfile(l): subprocess.Popen(l) return True, None return False, "INSTALLATION_NOT_FOUND" def close_proxifier(): subpr...
sandbox-pokhara/proxifier-cli
proxifier_cli/process.py
process.py
py
443
python
en
code
0
github-code
13
8242375230
from __future__ import print_function, division import numbers import random import copy from . import tools class MeshBin(object): def __init__(self, cfg, coo, bounds): self.cfg = cfg self.coo = coo self.bounds = bounds self.elements = [] def add(self, e, metad...
benureau/explorers
explorers/meshgrid.py
meshgrid.py
py
5,920
python
en
code
0
github-code
13
15567006016
from datetime import date year = [i for i in xrange(1006, 1997) if ((i%4 == 0 or i%400 == 0) and i%100 != 0) and str(i)[-1] == '6'] birthday = [] for i in year: if date(i, 1, 27).weekday() == 1: birthday.append(i) print(birthday)
YoTro/Python_repository
Pygame/15.py
15.py
py
247
python
en
code
2
github-code
13
9557462620
#!/usr/bin/env python2 import rospy from math import atan2, degrees, radians, fmod from nav_msgs.msg import Path from geometry_msgs.msg import PoseStamped from swc_msgs.msg import Control, RobotState, Gps # Path data desired_path = None # State data robot_state = None # Control data ctrl = Control() ctrl_pub = r...
jkleiber/SCR-Software-Challenge-2020
swc_ws/src/kleiber_control/src/basic_control_node.py
basic_control_node.py
py
3,831
python
en
code
0
github-code
13
41888166430
# question 1 def maximum(L): n = len(L) maxi = L[0] for i in range(1, n): if L[i] > maxi: maxi = L[i] return maxi def maximum_pos(L): n = len(L) maxi = L[0] for i in range(1, n): if L[i] > maxi: maxi = L[i] return maxi, i pri...
danhab05/InformatiquePrepa
Mpsi/TD1/ex2.py
ex2.py
py
753
python
en
code
0
github-code
13
33257653737
#By Sujay Sundar from tkinter import * import tkinter as tk from tkinter.scrolledtext import * from PIL import Image, ImageTk #Open Help menu screen in a new window, so user is able to refer to Help Contents as the user continues to use the FBLA Quiz application def openhelp(): #Creating the Help GUI window ...
sujaysundar/FBLAQuiz
fblaquiz/help.py
help.py
py
5,631
python
en
code
0
github-code
13
10022420966
#!/usr/bin/python3 def multiply_by_2(a_dictionary): copy_dict = a_dictionary.copy() # Makes a copy of the dictionary lst = list(copy_dict.keys()) # Convert dictionary to a list for i in lst: # Itterate over the dictionary copy_dict[i] *= 2 return copy_dict
Jay-Kip/alx-higher_level_programming
0x04-python-more_data_structures/9-multiply_by_2.py
9-multiply_by_2.py
py
287
python
en
code
1
github-code
13
24534118320
from time import time class Solution: def isPalindrome_v1(self, s: str): s_strip = [char.lower() for char in s if char.isalnum()] s_rev = s_strip[::-1] return bool(s_strip == s_rev) def isPalindrome_v2(self, s: str): def isalnum(num): return bool(48 <= num < 58 or 6...
Hintzy/leetcode
Easy/125_valid_palindrome/valid_palindrome.py
valid_palindrome.py
py
1,749
python
en
code
0
github-code
13
16079722615
# -*- mode: python -*- a = Analysis(['./src/htpc-updater.py'], hiddenimports=[], hookspath=None, runtime_hooks=None) a.datas.append(('cacert.pem', 'cacert.pem', 'DATA')) a.binaries = [x for x in a.binaries if x[0].lower() != 'kernel32.dll'] pyz = PYZ(a.pure) exe = EXE(pyz, ...
nikola/htpc-updater
htpc-updater.spec
htpc-updater.spec
spec
593
python
en
code
20
github-code
13
34308768634
import pandas as pd; import numpy as np; from sklearn.ensemble import RandomForestClassifier digitDf=pd.read_csv('C:\Kaggle\\DigitRecog\\train.csv'); subDf=pd.read_csv('C:\Kaggle\\DigitRecog\\sample_submission.csv') #print digitDf.head(); X_test=digitDf[[0]].values.ravel(); X_train=digitDf.iloc[:,1:].values; te...
sridharRavi/CheebsRepo
MachLearningandDataAnalysis/DigitRecog/digitanalysis.py
digitanalysis.py
py
587
python
en
code
0
github-code
13
73654039377
import logging import os import time import uuid from decimal import * # Logger from dynamo_operation import DynamoOperation from rest.parsers.grafana_parser import GrafanaParser from rest.parsers.slackbot_parser import SlackbotParser from rest.parsers.winston_parser import WinstonParser from rest.builders.grafana_bui...
gorillalogic/ns-alert-api
handler.py
handler.py
py
3,332
python
en
code
0
github-code
13
41130611233
import pygame from utilidades import get_surface_form_sprite_sheet class Kame: ''' Representa al poder kame hame ha, para la ultima instancia del juego. lo puede usar el personaje como el enemigo. ''' def __init__(self, screen : pygame.Surface,ancho_bar : int, alto_bar: int,poder_enemigo : int, pode...
HoracioxBarrios/mi_juego_final_limpio
class_kame.py
class_kame.py
py
5,767
python
es
code
2
github-code
13
23325248463
############################# ## DEMO PARAMETERS ############################# # params = { # 'project': { # 'directory_project': '/media/rich/bigSSD/analysis_data/face_rhythm/demo_faceRhythm_svoboda/fr_run_20221013_new_script1/', # 'overwrite_config': False, # 'initialize_visualization': ...
RichieHakim/face-rhythm
scripts/pipeline_basic.py
pipeline_basic.py
py
22,787
python
en
code
2
github-code
13
37991093302
from logging import getLogger import flask from app import drones from app.drones.message import FromDrone from app.drones.drone import State # Drone API; Requests: POST; Response: json drone_api = flask.Blueprint('drone_api', __name__, url_prefix='/drone_api') # received a message from the drone; authenticated by...
Dronesome-Archive/server
app/blueprints/drone_api.py
drone_api.py
py
1,315
python
en
code
0
github-code
13
69970215058
from discord.ext import commands from assets.functions import initembed class Ping(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() async def ping(self, ctx): e = initembed(ctx, ":ping_pong: Pong!") e.add_field(name="Latency", value=f"`{round(self.bot.lat...
ThatOtherAndrew/ThatOtherBot-Old
cogs/tools/stats.py
stats.py
py
416
python
en
code
0
github-code
13
29848231963
# Date - Friday August 31, 2018 # This system is built as part of the reasonableness monitoring system # Author - LHG import rdflib from rdflib import Graph from rdflib import URIRef import pprint import os from datetime import date # Noun is the actor - by default def write_rdf(noun, verb, object, context, phrase_di...
lgilpin/adaptable-monitoring
process.py
process.py
py
6,394
python
en
code
0
github-code
13
35831956838
import copy from ..bag import Bag from ..items import Items from ..equipment import Equipment from ..item_set_general import Item_sets from simul_items import Item_model,Item_update_table from simul_item_builder import Item_builder,Item_set_stage_builder,Item_set_item_model from simul_sets import Item_set from simul_...
MariusSilviuHriscu/python_the_west
the_west_inner/simulation_data_library/load_items_script.py
load_items_script.py
py
1,949
python
en
code
2
github-code
13
73155240336
# -*- coding: utf-8 -*- """ Created on Mon Oct 7 13:48:17 2019 @author: danaukes """ #derived from https://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html import PIL import numpy import scipy.fftpack as fft from PIL.Image import Image import matplotlib.pyplot as plt import os import yaml import...
danb0b/code_file_sorter
python/file_sorter/images.py
images.py
py
3,998
python
en
code
0
github-code
13
24770249019
import wx from pug.syswx.wxconstants import * class AguiLabelSizer(wx.BoxSizer): """AguiLabelSizer(parent, label='', line=True, font=None) parent: the parent window label: the text to display line: if True, create a line at the bottom of the sizer font: a font object to be used for the font... defaults to defaul...
sunsp1der/pug
pug/syswx/agui_label_sizer.py
agui_label_sizer.py
py
1,481
python
en
code
0
github-code
13
27302631165
SECTION = "section" CHAPTER = "chapter" class SectionItem(object): def __init__(self, section_name, section_type=SECTION, exercise=False, exercise_path='', line_pos=0): self.contains_exercises = None self.section_type = section_type self.section_name = section_name self.exercise = ...
codio/book-converter
converter/guides/item.py
item.py
py
883
python
en
code
2
github-code
13
38148684454
import os from pathlib import Path from tqdm import tqdm DATA_DIR = Path(__file__).parents[2] / 'data/stpp' def gen_bar_updater(): pbar = tqdm(total=None) def bar_update(count, block_size, total_size): if pbar.total is None and total_size: pbar.total = total_size progress_bytes ...
mbilos/neural-flows-experiments
nfe/experiments/stpp/data/download_utils.py
download_utils.py
py
1,011
python
en
code
73
github-code
13
29520988185
#!/usr/bin/env python # -*- coding: utf-8 -*- import http.cookiejar import os import urllib.request import urllib.parse import urllib.error cookie_filename = "cookies" class SimpleScraper(): def __init__(self): self.cj = http.cookiejar.MozillaCookieJar(cookie_filename) if os.access(cookie_filena...
in-rolls/indian-politician-bios
get_data/archive_india_gov/scraper.py
scraper.py
py
1,485
python
en
code
12
github-code
13
33038182016
import sys sys.stdin = open('input.txt') def dfs(index, sm): global N, ans # 종료 조건 if index == N: # 갱신 if ans < sm: ans = sm return # return 조건 if index > N-1: return # 순회 추가 조건 # if lst[index][0] not in visited: dfs(index+1, sm) df...
Seobway23/Laptop
Algorithm/May/퇴사/퇴사.py
퇴사.py
py
545
python
en
code
0
github-code
13
72213359059
import argparse, logging, copy from types import SimpleNamespace from contextlib import nullcontext import torch from torch import optim import torch.nn as nn import numpy as np from fastprogress import progress_bar from utils import * from modules import UNet_conditional #,EMA #best results achieved ...
ShreyaSridhar5/DiffusionModels
ddpm_conditional.py
ddpm_conditional.py
py
9,150
python
en
code
0
github-code
13
6606408792
__author__ = "Heta Rekilä \n Sami Voutilainen" __version__ = "2.0" import time import widgets.input_validation as iv import widgets.gui_utils as gutils from PyQt5 import uic from PyQt5 import QtWidgets from widgets.scientific_spinbox import ScientificSpinBox class TargetInfoDialog(QtWidgets.QDialog): """ ...
JYU-IBA/potku
dialogs/simulation/target_info_dialog.py
target_info_dialog.py
py
3,852
python
en
code
7
github-code
13
23845828026
from collections import defaultdict def _star1() -> int: nums = sorted([int(line.strip()) for line in open("../../inputs/day10.txt")]) num_one_jolts, num_three_jolts = 1, 1 for i, n in enumerate(nums[:-1]): if (nums[i] + 1) == nums[i + 1]: num_one_jolts += 1 if (nums[i] + 3) =...
henryjetmundsen/AdventOfCode
src/2020/python/src/solutions/day10.py
day10.py
py
773
python
en
code
0
github-code
13
17783237833
from itertools import islice from math import prod def day16(inp): bits = f'{int(inp.strip(), 16):b}' padded_len = -(-len(bits) // 4) * 4 bits = bits.zfill(padded_len) it = iter(bits) metadata = parse_packet(it) part1, part2 = compute_scores(metadata) return part1, part2 def parse_pack...
adeak/AoC2021
day16.py
day16.py
py
2,406
python
en
code
1
github-code
13
3285189623
__all__ = ["init", "current_export_schema_ver"] import atexit import sys import colorama from packaging.version import Version from . import command_impl_core from . import completions from . import locks from . import sequence_impl_core from . import shared from . import shortcuts __version__ = "0.3.0.dev0" IN...
neogeographica/chaintool
src/chaintool/__init__.py
__init__.py
py
5,958
python
en
code
0
github-code
13
70273468178
from __future__ import print_function import tensorflow as tf import random import sys,glob if './360video/' not in sys.path: sys.path.insert(0, './360video/') # from mycode.dataLayer import DataLayer from mycode.dataLayer2 import DataLayer import mycode.cost as costfunc from mycode.provide_hidden_state import mult...
ChengeLi/LongTerm360FoV
mycode/lstm.py
lstm.py
py
41,993
python
en
code
13
github-code
13
31475961828
import socket import random import sys import os server_address = ('127.0.0.1', 5000) server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind(server_address) filenamestart = 'receivedfile_' filecount = 0 try: w...
Erlangga28/Assignment-NetworkProgramming-UDP
Challenge1/server1.py
server1.py
py
1,606
python
en
code
0
github-code
13
24463309259
from dataclasses import dataclass, field import numpy as np import cv2 from supermarket_simulation import Supermarket from create_supermarket_map import main as create_supermarket_map from path_finder import main as run_pathfinder from config import ( CUSTOMER_ARRIVAL_RATE, Locations, MARKET, PATH_SUPER...
MichlF/projects
data_science/supermarket_markov_simulation/visualize_supermarket_simulation.py
visualize_supermarket_simulation.py
py
4,651
python
en
code
1
github-code
13
19288276609
''' This is used to create a multivariable linear regression. ''' import pandas as pd import numpy as np import matplotlib.pyplot as plt import datetime import pprint import pymongo import statsmodels.api as sm # establish Mongo database connection client = pymongo.MongoClient() # set up CMSC455 database and movies...
philliard3/455Project
multivariable_linear.py
multivariable_linear.py
py
4,549
python
en
code
0
github-code
13
73458342099
#!/usr/bin/python3 # -*- coding: UTF-8 -*- # # This script converts a .CUCX files to be .CUC (old format) # import sqlite3 import datetime import time import sys import os import kpilot import json import math import pycountry import config #--------------------------------------------------------------------------...
acasadoalonso/SWiface-PHP
ccucxtocuc.py
ccucxtocuc.py
py
11,451
python
en
code
2
github-code
13
29862139367
import os import unittest import intelmq.lib.test as test import intelmq.lib.utils as utils from intelmq.bots.parsers.shadowserver.parser import ShadowserverParserBot with open(os.path.join(os.path.dirname(__file__), 'testdata/event4_honeypot_ddos_amp.csv')) as handle: EXAMPLE_FILE = handle.read() EXAMPLE_LINES =...
certtools/intelmq
intelmq/tests/bots/parsers/shadowserver/test_honeypot_ddos_amp.py
test_honeypot_ddos_amp.py
py
3,576
python
en
code
856
github-code
13
24622081324
# needs transformers # path to the intermediate dataset folder: inter_path # generalized few shot learning parameter: generalized = True import os import random import pandas as pd import numpy as np import csv import tensorflow as tf import torch from sklearn.model_selection import train_test_split import textwrap imp...
Observeai-Research/NLI-FSL
proto-train.py
proto-train.py
py
9,261
python
en
code
0
github-code
13
27237331599
#!/usr/bin/env python # -*- coding: utf-8 -*- from zope.interface import implements from plone.portlets.interfaces import IPortletDataProvider from plone.app.portlets.portlets import base from zope import schema from zope.formlib import form from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile f...
ComUCA/EssaiSite
Plone/zinstance/src/unice.portlet.telechargement/unice/portlet/telechargement/telechargementportlet.py
telechargementportlet.py
py
4,592
python
en
code
0
github-code
13
32778984379
from telegram import Update from telegram.ext import ContextTypes """Обрабатываем входное сообщение. При возможности выполняем вычисления и возвращаем результат.""" async def calculate(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: msg = update.message.text user_name = update.effective_user.first...
AlekseyNizhnikov/Home_Work_Python
Work_9/app/view/bot_command.py
bot_command.py
py
767
python
ru
code
0
github-code
13
41996003156
from todoist import TodoistAPI import pandas as pd class TodoistExtractor: def __init__(self, token, pages, limit): self.token = token self.api = TodoistAPI(self.token) self.api.sync() self.pages = pages self.limit = limit def get_todoist_activities(self): act...
clovisguerim/todoist-extractor
todoist_extractor/todoist_extractor.py
todoist_extractor.py
py
1,071
python
en
code
0
github-code
13
41115703251
import os import zlib import struct import logging import datetime from array import array from io import StringIO from mogul.media import localize _ = localize() from mogul.media import (MediaContainer, MediaEntry, MediaStream, Tag, TagTarget, TagGroup, MediaHandlerError) from mogul.media.image import Image fro...
sffjunkie/media
src/media/png.py
png.py
py
13,159
python
en
code
0
github-code
13
24334579415
import numpy as np V = np.zeros(101) policy = np.zeros(99) ph = 0.25 theta = 10**-100 action_value = np.zeros(1) sweep = 0 Value = np.zeros((99, 4)) def Iteration(): global V, theta, sweep loop = True while loop == True: delta = 0 for s in range(1, 100): list1 = [] v...
NormanZhou123/Reinforcement_Learning_Practice
A3/part1/part1.py
part1.py
py
1,147
python
en
code
0
github-code
13
21736886850
import discord from discord.ext import commands class main_S(commands.Cog): def __init__(self, bot): self.bot = bot self.bot.application_command(name="info", cls=discord.SlashCommand)(self.joke_slash) @commands.slash_command(name="info") async def userinfo(self, ctx): await ctx.respond(f"{ctx.aut...
jasonchanjj123/waifu-bot
commands/user.py
user.py
py
375
python
en
code
1
github-code
13
27682679843
from datetime import date, datetime, timedelta def get_birthdays_per_week(users): if len(users) == 0: return {} # Визначаємо поточну дату today = date.today() # Визначаємо поточний день тижня (0 - понеділок, 1 - вівторок, ..., 6 - неділя) current_weekday = today.weekday() # Формуємо...
mikekuian/hw8
main.py
main.py
py
1,881
python
uk
code
0
github-code
13
4819385393
#! python3 # resizeAndAddLogo.py - Resizes all images in current working directory to # fit in 300x300 square, and adds logo.png to the lower-right corner import os from PIL import Image os.chdir('C:\\Users\\ElHassen\\Desktop\\Python\\learningpy\\Maniplating images') SQUARE_FIT_SIZE = 300 LOGO_FILENAME = 'logo.png' ...
Elhasssen/Python_learning_path
Maniplating images/resizeAndAddLogo.py
resizeAndAddLogo.py
py
1,731
python
en
code
0
github-code
13
36697698262
import functools as ft from dataclasses import dataclass from typing import Any import jax from .deprecated import deprecated from .filters import combine, is_array, partition, validate_filters from .module import Module, static_field class _Static(Module): value: Any = static_field() @ft.lru_cache(maxsize=40...
codeaudit/equinox
equinox/jitf.py
jitf.py
py
5,896
python
en
code
null
github-code
13
39243239879
# -*- coding: utf-8 -*- # 我的方法是首先去寻找了树的根结点 # 进行中序遍历,然后输出结果 # class TreeLinkNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None class Solution: def __init__(self): self.lst=[] def GetNext(s...
RellRex/Sword-for-offer-with-python-2.7
test57_二叉树的下一个结点.py
test57_二叉树的下一个结点.py
py
997
python
en
code
2
github-code
13
26680068426
# # 13 - Tendo dado de entrada a altura (h) de uma pessoa, construa um algortimo que calcule seu peso ideal, utilizando as seguinte fórmulas: # a. para homens: (72.7*h) - 58 # b. para mulheres: (62.1*h) - 44.7 sexo = int(input('Selecione opção 1 se for do sexo Masculino / Selecione opção 2 se for do sexo feminino:...
gabswyl/logicapython
Lógica de programação Python/Estrutura Sequencial/Altura & Peso 2/python.py
python.py
py
673
python
pt
code
0
github-code
13
25933109225
#!/usr/bin/python3 #_*_coding=utf-8 _*_ import sys print("计算1/x的值") while True: try: number = int(input("enter a number:")) if number == 0: sys.stderr.write("除以0 error\n") else: a = "1/%d = %s" % (number,1/number) sys.stdout.write(a+"\n") except ValueError: print("请输入正整数")...
Ahead180-103/ubuntu
python/shell.py/sys1.py
sys1.py
py
358
python
en
code
0
github-code
13
35498394229
import os from unittest import mock from datetime import datetime, timezone import pytest from fyle_rest_auth.models import User, AuthToken from rest_framework.test import APIClient from apps.partner.models import PartnerOrg from tests.fixture import fixture def pytest_configure(): os.system('sh ./tests/sql_fixt...
fylein/fyle-partner-dashboard-api
tests/conftest.py
conftest.py
py
2,420
python
en
code
0
github-code
13
39701750576
import networkx as nx import numpy as np import connectome_utils as utl from multiplex import MultiplexConnectome import os import bct import multiprocessing as mp try: from metrics.shared import set_seeds, push_exceptions except (ImportError, SystemError): from shared import set_seeds, push_exceptions set_see...
clbarnes/connectome_paper
metrics/file_tools.py
file_tools.py
py
8,988
python
en
code
0
github-code
13
32752689523
import tkinter as tk from tkinter import Frame, BOTH class MatrixtableGUI(Frame): def __init__(self): self.height = 500 self.width = 450 self.food = None self.rectangles = [] self.rectangles_coordinates = [] self.canvas = None self.show_window() def sho...
rapunzeeel/Snake-game
Projekat/GUI/MatrixtableGUI.py
MatrixtableGUI.py
py
1,053
python
en
code
0
github-code
13
18074327919
# The docstring in this module is written in rst format so that it can be # collected by sphinx and integrated into django-genes/README.rst file. """ This command can be used to populate database with WormBase identifiers. It takes 3 arguments: * (Required) wb_url: URL of wormbase xrefs file; * (Optional...
greenelab/django-genes
genes/management/commands/genes_load_wb.py
genes_load_wb.py
py
2,575
python
en
code
2
github-code
13
14129744392
from selenium import webdriver 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.webdriver.chrome.options import Options from time import time import threading from queue import Queue def st...
GedizUcar/control-bot
demo.py
demo.py
py
4,309
python
en
code
0
github-code
13