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
13145861341
from model.component.component_specification import ComponentSpecification from model.component.socket.socket_specification import SocketSpecification from model.component.subgraph_component import SubgraphComponentModel from model.module.prototype_specifications import PrototypeSpecifications from model.module.toolbox...
MichSchli/Mindblocks
model/component/component_repository.py
component_repository.py
py
5,570
python
en
code
0
github-code
36
3674524668
#Importing pyplot submodule import matplotlib.pyplot as plt import numpy as np x = np.array(['Apples','Bananas','Lichi','Pineapple']) y = np.array([100,45,60,90]) #using bar() to represent data in bar graph plt.subplot(1,2,2) plt.bar(x,y, width = 0.5) plt.title('Vertical') plt.show() #for showing the...
manudeepsinha/daily_commit
2020/12/Python/23_matplotlib_bar.py
23_matplotlib_bar.py
py
524
python
en
code
0
github-code
36
35383679834
#!/usr/bin/env python3 from sys import exit from collections import Counter import random from statistics import mean from TALinputs import TALinput from multilanguage import Env, Lang, TALcolors import mastermind_utilities as Utilities # METADATA OF THIS TAL_SERVICE: args_list = [ ('max_num_attempts',int), ...
romeorizzi/TALight
example_problems/tutorial/mastermind/services/eval_driver.py
eval_driver.py
py
3,432
python
en
code
11
github-code
36
6884335052
import time import torch torch.set_printoptions(precision=7) from addict import Dict as adict from torch.nn import functional as F from zerovl.core import DistHook, HookMode, WandbHook from zerovl.core.hooks.log import LogHook from zerovl.core.runners.builder import RUNNER from zerovl.core.runners.epoch_runner impor...
zerovl/ZeroVL
zerovl/tasks/clip/clip_bsgs_runner.py
clip_bsgs_runner.py
py
18,843
python
en
code
39
github-code
36
71578877863
# !/usr/bin/env python # -*- coding: utf-8 -*- import vtk def main(): cps = vtk.vtkConvexPointSet() points = vtk.vtkPoints() points.InsertNextPoint(0, 0, 0) points.InsertNextPoint(1, 0, 0) points.InsertNextPoint(1, 1, 0) points.InsertNextPoint(0, 1, 0) points.InsertNextPoint(0, 0, 1) ...
lorensen/VTKExamples
src/Python/GeometricObjects/ConvexPointSet.py
ConvexPointSet.py
py
2,484
python
en
code
319
github-code
36
16157216808
import pandas as pd from django.contrib.auth.decorators import login_required from django.contrib.sites.shortcuts import get_current_site from django.http import HttpResponse from django.urls import reverse from researcher_UI.models import Administration @login_required def download_links(request, study_obj, administ...
langcog/web-cdi
webcdi/researcher_UI/utils/download/download_links.py
download_links.py
py
1,991
python
en
code
7
github-code
36
30952198138
import requests class Polyline: def __init__(self) -> None: self.users = dict() self.polylines = [] self.matches = [] def add(self, ID: int, name: str, ph_no: int, source: list, destination: list) -> None: polyline = Polyline.__get_polyline(source, destination) self.po...
Sivaram46/pool-ride
polyline.py
polyline.py
py
4,465
python
en
code
2
github-code
36
3238104451
import numpy as np import pandas as pd #from sklearn.cluster import KMeans import matplotlib.pyplot as plt import xlwt import KMeans import Visualization plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签 plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 points = [] center_points = [] K = 4 file="D:\\ex...
JiaoZixun/Recommend_By_Canopy-K-means
recommend——豆瓣/对比实验——K-means聚类.py
对比实验——K-means聚类.py
py
1,454
python
en
code
18
github-code
36
30662323647
from datetime import datetime, timedelta from pytz import timezone from dateutil.relativedelta import relativedelta data_1 = datetime(2023, 10, 30, 17, 10, 59) print(data_1) data_str = "2023-10-30 17:18:59" data_str_formatter = "%Y-%m-%d %H:%M:%S" data_2 = datetime.strptime(data_str, data_str_formatter) print(data_...
juannaee/WorkSpace-Python-Intermediario
SEÇÃO 4/datetime/main1.py
main1.py
py
994
python
en
code
0
github-code
36
5547555689
""" Tests for voting 13/01/2022. """ from sys import version from collections import namedtuple from brownie import interface, reverts from scripts.vote_2022_01_13 import start_vote from tx_tracing_helpers import * from utils.config import ( lido_dao_lido_repo, lido_dao_node_operators_registry_repo, ) lido_o...
lidofinance/scripts
archive/tests/xtest_2022_01_13.py
xtest_2022_01_13.py
py
5,965
python
en
code
14
github-code
36
2314864237
# if-elif """ a=int(input("Enter a : ")) b=int(input("Enter b: ")) if(a>b): print("a is greater than b") elif(b>a): print("b is greater than a") else: print("a and b are equal") """ # program for leap year """ year = int(input("Enter year: ")) if(year%4==0): if(year%100==0): if(year%400==0): ...
sudeepsawant10/python-development
basic/7_ifelse.py
7_ifelse.py
py
944
python
en
code
0
github-code
36
18405451718
#!/usr/bin/env python3 import boto3 import argparse import os import base64 from common_functions import getAllInstances, getDynamoDBItems from common_jenkins import triggerJob from common_kms import get_plaintext_key parser = argparse.ArgumentParser() parser.add_argument("-e", "--env", help="Staging or Production", ...
trtruong/utilities
scripts/python/checkOrphanedInstances.py
checkOrphanedInstances.py
py
4,165
python
en
code
0
github-code
36
25305879977
__author__ = 'diegopinheiro' from common.attribute import Attribute import math import numpy class AttributeConverter: @staticmethod def get_representation(attribute=Attribute(), category=None): number_representation = AttributeConverter.get_number_representation(attribute=attribute) categor...
diegompin/genetic_algorithm
common/attribute_converter.py
attribute_converter.py
py
1,144
python
en
code
1
github-code
36
227921979
""" 定义函数,对数字列表进行升序排列 """ def ascending(target): for r in range(len(target) - 1): # 0 1 2 for c in range(r + 1, len(target)): # 123 23 3 if target[r] > target[c]: # 2. 修改可变数据 target[r], target[c] = target[c], target[r] # 3. 无需通过return返回 # 1. ...
testcg/python
code_all/day09/homework/exercise05.py
exercise05.py
py
455
python
zh
code
0
github-code
36
26552867136
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/4/12 23:29 # @Author : DZQ # @File : main.py import sys from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import * import xlrd from threading import Thread import json from BaiduIndexSpider import B...
dzqann/BaiduIndex
main.py
main.py
py
9,586
python
en
code
9
github-code
36
36289714812
from kafka.admin import KafkaAdminClient, ConfigResource, ConfigResourceType TOPIC_NAME = "kafka.client.tutorial" BOOTSTRAP_SERVER_HOST = "kafka_tutorial:9092" # 카프카 클러스터 서버의 host와 port를 지정 admin_client = KafkaAdminClient( bootstrap_servers=BOOTSTRAP_SERVER_HOST ) print("== Get broker information") # return typ...
2h-kim/kafka-personal-study
simple-kafka-admin-client/kafka-admin-client.py
kafka-admin-client.py
py
1,069
python
en
code
0
github-code
36
3835970469
import json import pandas as pd import numpy as np import filenames myjson = { "arm": { "malware": [], "benign": [] }, "mips": { "malware": [], "bening": [] } } df_arm_malware_forpoison = pd.read_csv(filenames.forpoison_arm_malware, header=None, index_col=False) myjso...
ZsZs88/Poisoning
filepicker.py
filepicker.py
py
1,111
python
en
code
0
github-code
36
7436949724
from plot import * merge = pd.read_pickle('./pkl/sig/cap_df_fragment_size.pkl') merge['mtu'] = merge['algo'].str.split('_', expand=True)[1] merge['mtu'] = merge['mtu'].astype(int) cap_size_df = merge[['algo','run','frame_nr','frame_len', 'mtu']].groupby(['algo','run','frame_nr']).agg({'mtu': 'first', 'frame_len': 'fi...
crest42/hostapd
eap_radius_test/scripts/plot_box_fragment_size.py
plot_box_fragment_size.py
py
616
python
en
code
0
github-code
36
15991913621
#!/usr/bin/python from Constants import Constants as cnt from CoinDaemon import CoinDaemon from bitcoinrpc.authproxy import AuthServiceProxy class Wallet: """Provides a high-level abstraction of a coin wallet and simplifies the process of making JSON API RPC calls to the coin wallet daemon""" walletPa...
chriscassidy561/coinScript
Wallet.py
Wallet.py
py
2,828
python
en
code
0
github-code
36
73605974825
class Solution(object): def firstUniqChar(self, s): """ :type s: str :rtype: int """ # 1. Create a hashmap that the character's ascii value as index hashmap = [-1 for j in range(123)] # 2. Go through the string and add 1 in the hashmap once the character appea...
yichenfromhyrule/LeetCode
#387_FirstUniqueCharacterInAString.py
#387_FirstUniqueCharacterInAString.py
py
692
python
en
code
0
github-code
36
34916305882
import numpy as np import matplotlib.pyplot as plt with open("../buildxcode/cte.txt") as f: data = f.read() data = data.split('\n') x = [float(i) for i in data] fig = plt.figure() ax1 = fig.add_subplot(111) ax1.set_title("CTE") ax1.set_ylabel('CTE') ax1.plot(x,...
suprnrdy/CarND-PID-Control-Project-master
src/plotCTE.py
plotCTE.py
py
341
python
en
code
0
github-code
36
28052800472
from pprint import pprint import sys import traceback def print_pretty(obj): pprint(obj) def print_block(string, end="\n"): hash_num = 45 print("\n\n") print("#" * hash_num) mid_hash_num = min((hash_num - len(string) - 2) // 2, 3) mid_hash = "#" * mid_hash_num mid_space = " " * ((hash_n...
Xinyu-Li-123/DefenseEval
DefenseEval/utils/utils.py
utils.py
py
2,237
python
en
code
0
github-code
36
459210709
import requests import json import ntpath class Jira: """Common JIRA API methods. JIRA's REST APIs provide access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. The JIRA REST API uses JSON as its communication format, and ...
mjlabe/python-atlassian-server-api
atlassian_server_api/jira.py
jira.py
py
6,655
python
en
code
0
github-code
36
10183845847
from utils import evaluation_utils, embedding_utils from semanticgraph import io from parsing import legacy_sp_models as sp_models from models import baselines import numpy as np from sacred import Experiment import json import torch from torch import nn from torch.autograd import Variable from tqdm import * import ast...
jack139/gp-gnn_test
train.py
train.py
py
9,172
python
en
code
0
github-code
36
34932827697
maiores = mulheres20 = homens = 0 while True: i = int(input('Digite a idade: ')) s = ' ' while s not in 'MF': s = str(input('Digite o sexo [M/F]: ')).strip().upper()[0] r = ' ' while r not in 'SN': r = str(input('Deseja continuar cadastrando [S/N]? ')).strip().upper()[0] if i > 1...
lucasaguiar-dev/Questoes-Python
Projeto donwload/PythonExercicios/ex069.py
ex069.py
py
620
python
pt
code
0
github-code
36
7774676634
from urllib.request import urlopen from bs4 import BeautifulSoup import ssl # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE url = input('Enter URL: ') count2 = input('Enter count: ') position = input('Enter position: ') count2 = int(count2...
laurmvan/SI206-Fall2017
HW6/HW6_PartB.py
HW6_PartB.py
py
875
python
en
code
null
github-code
36
22536995817
#!/usr/bin/env python3 import rospy from std_msgs.msg import Float64MultiArray, Float64 import time from controller_manager_msgs.srv import SwitchController # To run this file: # roslaunch gazebo_ros empty_world.launch # rosrun gazebo_ros spawn_model -file `rospack find ur5-joint-position-control`/urdf/ur5_jnt_pos_c...
Gaurav37/Tossingbot
ur5-joint-position-control/scripts/trajectory_command.py
trajectory_command.py
py
3,256
python
en
code
1
github-code
36
16793418016
import pygame from battle import time, MOVE_DOWN_FREQ, BOARD_HEIGHT, BOARD_WIDTH, BLANK, POISON, SHAPES, BOX_SIZE, \ TEMPLATE_HEIGHT, TEMPLATE_WIDTH, MOVE_SIDE_WAYS_FREQ from utils import get_new_piece, get_blank_board, calculate_level_and_fall_frequency, is_valid_position from pygame.locals import * BOARD_OFFSET ...
dadisi/battle-tetro
battle/player.py
player.py
py
8,220
python
en
code
0
github-code
36
70537611943
import elasticsearch import json import luigi from elasticsearch.helpers import bulk from luigi.contrib import esindex from nfl import scraper class IngestData(luigi.Task): category = luigi.Parameter() year = luigi.Parameter() def output(self): target = luigi.LocalTarget("output/{0}/{1}.json".f...
jasonmotylinski/luigi-presentation
pipeline-py/luigi/luigipipeline/demo5.py
demo5.py
py
1,753
python
en
code
1
github-code
36
19536790306
""" This module contains numerical method approach to determine heston model price for a set of parameters """ import numpy as np from model.implied_volatility.core.implied_vol import implied_volatility_call def get_heston_price(row): """ Generates simultaneous simulation of stock price and volatility pr...
Karanpalshekhawat/option-pricing-and-implied-volatility-using-NNs
model/implied_volatility/core/heston_model_pricing.py
heston_model_pricing.py
py
3,255
python
en
code
1
github-code
36
26744639927
import argparse import os import time import numpy as np import torch import torch.optim as optim import torch.nn as nn from torch.utils.data import DataLoader from data_loader import CSV_PNG_Dataset, CSV_PNG_Dataset_2D, PNG_PNG_Dataset from netArchitecture.VGG import VGGModel, VGGModel_2D from netArchitecture.ResNe...
yuanlinping/deep_colormap_extraction
train.py
train.py
py
10,586
python
en
code
7
github-code
36
44771327846
def extract_info(corona_list): result = [] for corona in corona_list: info = corona.contents corona_info = { 'city' : info[1].string, 'city_detail' : info[2].string, 'name' : info[3].text, 'phone' : info[4].string } result.append(corona_info) return result
sumins2/homework
session09_crawling/corona.py
corona.py
py
309
python
en
code
0
github-code
36
14433470190
import operator # 알파벳 대소문자로 된 단어가 주어지면,이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. # 단, 대문자와 소문자를 구분하지 않는다. word = input().strip() word = word.upper() count = {} #딕셔너리 사용 list1 = list(word) #print(type(count)) #<class 'dict'> for i in list1 : #알파벳을 하나씩 꺼낸다 try: count[i] += 1 #이미 존재하면 +1 except: count[i] = 1...
pivotCosmos/algorithm
202206/ex0608/1157_mostAlphabet.py
1157_mostAlphabet.py
py
1,331
python
ko
code
0
github-code
36
20341081409
import hashlib class Block: def __init__(self, index, timestamp, data, previous_hash): self.index = index self.timestamp = timestamp self.data = data self.previous_hash = previous_hash self.hash = self._hash_block() def _hash_block(self): sha = hashlib.sha256()...
rdempsey/simple-python-blockchain
spb/lib/block.py
block.py
py
835
python
en
code
0
github-code
36
37569791661
def extract_times(raw_times_dict): """ Extract the actual time values from the data provided by the SRC Run API. """ actual_times = {} if raw_times_dict["realtime"] is not None: actual_times["realtime"] = raw_times_dict["realtime_t"] if raw_times_dict["realtime_noloads"] is not None: ...
JoshSanch/run_migrator
utils/src_conversion_utils.py
src_conversion_utils.py
py
1,836
python
en
code
2
github-code
36
74189117224
#reverses the process of the spritesheetCreator script from PIL import Image import sys #sets all the variables we need to accurately crop the images imageAmount = 0 i = 1 width = 0 height = 0 maxWidth = 0 maxHeight = 0 counter = 0 row = 0 column = 0 #searches for the file saved by the spritesheet script...
IrrationalThinking/portfolio
Example/reversal.py
reversal.py
py
2,172
python
en
code
0
github-code
36
14806312325
class Item: def __init__(self, type, area): self.type = type self.area = area def __str__(self): return '类型:%s,属性:%s' % (self.type, self.area) class Home: def __init__(self, address, area): self.address = address self.area = area self.free_area = area ...
penguinsss/Project
面向对象/练习/家具.py
家具.py
py
895
python
en
code
0
github-code
36
25187912716
# -*- coding: utf-8 -*- # # # TheVirtualBrain-Framework Package. This package holds all Data Management, and # Web-UI helpful to run brain-simulations. To use it, you also need do download # TheVirtualBrain-Scientific Package (for simulators). See content of the # documentation-folder for more details. See also http:/...
suraj1074/tvb-library
tvb/datatypes/local_connectivity_scientific.py
local_connectivity_scientific.py
py
3,029
python
en
code
null
github-code
36
30414663349
# 03.Faça um programa que leia e valide as seguintes informações: # Nome: maior que 3 caracteres; # Idade: entre 0 e 150; # Salário: maior que zero; # Sexo: 'f' ou 'm'; # Estado Civil: 's', 'c', 'v', 'd'; # Use a função len(string) para saber o tamanho de um texto (número de caracteres) in_name = str(input('insira seu...
KIINN666/crispy-umbrella
cadastro_v2.0.py
cadastro_v2.0.py
py
1,222
python
pt
code
0
github-code
36
74088296424
""" Normally step 1 to align trimmed reads e.g. """ import os import sys from tqdm import trange from joblib import Parallel, delayed import re input_root = sys.argv[1] output_root = sys.argv[2] genome_dir = sys.argv[3] subdirs = [] for subdir, dirs, files in os.walk(input_root): for file in files: subdir...
ZhaoxiangSimonCai/BioInfoScripts
RNA_workflows/star_by_folders.py
star_by_folders.py
py
931
python
en
code
0
github-code
36
40571473891
import reflex as rx gradient = "linear(to-l, #7928CA, #FF0080)" background_gradient = "bgGradient='radial-gradient(circle, rgba(238,174,202,1) 0%, rgba(148,187,233,1) 100%);'," shadow = "0 0 5px 5px #FF0080" # Common styles for de app. app_style = dict( bgGradient=background_gradient ) # Common styles...
BortPablo/reflex_portfolio
reflex_test/style.py
style.py
py
1,182
python
en
code
0
github-code
36
3084548560
from datetime import datetime from metloom.pointdata import SnotelPointData from conversions import imperial_to_metric def get_snotel_data(name, site_id, dates): snotel_point = SnotelPointData(site_id, name) df = snotel_point.get_daily_data( dates[0], dates[1], [snotel_point.ALLOWED_VARIABLES....
ZachKeskinen/uavsar-validation
src/funcs/snotel_extract.py
snotel_extract.py
py
762
python
en
code
0
github-code
36
73692413545
import mock import testtools from stackalytics.dashboard import helpers class TestHelpers(testtools.TestCase): @mock.patch('time.time') def test_get_current_company(self, mock_time_time): current_timestamp = 1234567890 mock_time_time.return_value = current_timestamp user = { ...
Mirantis/stackalytics
stackalytics/tests/unit/test_helpers.py
test_helpers.py
py
2,389
python
en
code
12
github-code
36
70679292584
class OrderEvent(Event): """ Signifies event to execute order on stock. """ def __init__(self, symbol, order_type, quantity, direction): self.type = "ORDER" self.symbol = symbol self.order_type = order_type self.quantity = quantity self.direction = direction
kevshi/trading
event/order_event.py
order_event.py
py
276
python
en
code
0
github-code
36
22264746136
class RutaPeligrosa(Exception): # Completar def __init__(self, tipo_peligro, nombre_estrella): super().__init__('¡Alto ahí viajero! Hay una amenaza en tu ruta...') self.tipo_peligro = tipo_peligro self.nombre_estrella = nombre_estrella def dar_alerta_peligro(self): if self.t...
Alzvil/IIC2233-Progra-Avanzada-Tareas-2021-1
Actividades/AF2/excepciones_estrellas.py
excepciones_estrellas.py
py
755
python
es
code
0
github-code
36
73915818985
from .base import RegexVocabulary, left_pad, NoWildcardsVocabulary, NoRangeFillVocabulary, NoCheckVocabulary,\ ProcedureVocabulary, ModifierVocabulary import re from itertools import product _hcpcs_split_regex = re.compile('^([A-Z]*)([0-9]+)([A-Z]*)$') def hcpcs_split(code): match = _hcpcs_split_regex.match(co...
modusdatascience/clinvoc
clinvoc/hcpcs.py
hcpcs.py
py
2,356
python
en
code
8
github-code
36
31521862032
class Solution(object): def findRotateSteps(self, ring, key): """ :type ring: str :type key: str :rtype: int """ # the distance between two points (i, j) on the ring n = len(ring) def dist(i, j): return min(abs(i - j), n - ...
szhu3210/LeetCode_Solutions
LC/514.py
514.py
py
858
python
en
code
3
github-code
36
18433559527
import pygame import random import time import turtle # Class thể hiện đối tượng Câu hỏi # Một đối tượng Question gồm có 2 fields: # - question: đề bài # - answer: đáp án class Question: def __init__(self, question, answer): self.question = question self.answer = answer # Class thể hiện t...
aitomatic/contrib
src/aito/util/finalproject.py
finalproject.py
py
7,485
python
vi
code
2
github-code
36
7796357868
# 这道题和变形词的区别是旋转词只能变化一次,左变换后的部分依然是顺序的! # 存在的问题:因为是拼接得到的,所以在此拼接可以得到原来的结果,所以只要判断s1是否在拼接后的字符串就可以了 # AC def solution(s1, s2, n, m): if n != m or sorted(s1) != sorted(s2): return 'NO' for i in range(n): new_s2 = s2[i:] + s2[:i] if new_s2 == s1: return 'YES' return 'NO' # 得到...
20130353/Leetcode
target_offer/字符串题/字符串变换-旋转词.py
字符串变换-旋转词.py
py
914
python
zh
code
2
github-code
36
74113768742
import click # import pickle # import cv2 from recognize import process, recognize, draw, show @click.command() @click.argument('image') @click.option('--encodings', '-e', default='encodings.pickle', help='path to db of BTS facial encodings.') @click.option('--detection', default='cnn', help='Which face detection mode...
cache-monet/bts_recognition
image.py
image.py
py
741
python
en
code
1
github-code
36
2259081804
import pyperclip as pc names = ["Apple", "Banana", "Cherry", "Dog", "Elephant"] present = [] absent = [] not_audio = [] asking = True number = 0 while asking: question = names[number] answer = input(question + ": ") if answer == "p": present.append(question) if answer == "a": absent.ap...
PythonGeek07/Attendance-_Bot
main.py
main.py
py
1,288
python
en
code
0
github-code
36
40059338303
class Conversion: # Code created by Luke Reddick # Please use inputs of one character, so C, F, K, c, f ,k # for celsius, fahrenheit, and Kelvin respectively convertFrom = str((input("What temperature are you converting from? (C/F/K) : " + "\n"))) convertTo = str((input("What temperatur...
Lukares/Asides
conversionTemp.py
conversionTemp.py
py
2,455
python
en
code
0
github-code
36
13988027867
import numpy as np from scipy.interpolate import interp1d from skfmm import travel_time, distance from scipy.signal import resample def resample2d( x, shape=[] ): if len(shape)==0: raise ValueError('shape should not be empty.') x1=resample(x,shape[0],axis=0) x2=resample(x1,shape[1],axis=1) ...
wsavran/sokrg
krg_utils.py
krg_utils.py
py
5,948
python
en
code
3
github-code
36
7667794703
#Usage: python3 kptable-appendix-11b.py [-h] [--help] import datetime import pathlib import pandas as pd import xlsxwriter from lukeghg.crf.crfxmlconstants import ch4co2eq, n2oco2eq, ctoco2 from lukeghg.crf.crfxmlfunctions import ConvertFloat,ConvertSign, ConvertToCO2, SumTwoValues, SumBiomassLs from lukeghg.crf.crfxml...
jariperttunen/lukeghg
lukeghg/lukeghg/nir/kptableappendix11b.py
kptableappendix11b.py
py
24,795
python
en
code
0
github-code
36
42669964568
import glob import cv2 import numpy as np from tqdm import tqdm class Calibration(object): def __init__(self, targetfilepath): # termination criteria self.criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-5) # prepare object points, like (0,0...
Team-AllyHyeseongKim/vision-utils-calibrator-depth-map-deblur-odometry-
custom_lib/cail/calibrator.py
calibrator.py
py
3,920
python
ko
code
0
github-code
36
7654866561
# -*- coding: utf-8 -*- """ Created on Fri Feb 17 10:15:08 2023 @author: anjan """ import numpy as np def swap_rows(A,p,q): """ Parameters ---------- A: A numpy.ndarry matrix of any dimensions p,q : integers The indices of two rows of the matrix. Returns ---...
anjanmondal/CMI-Coursework
Linear Algebra/LU Decomposition/helper_functions.py
helper_functions.py
py
3,991
python
en
code
0
github-code
36
69826161703
""" General Numerical Solver for the 1D Time-Dependent Schrodinger Equation. Authors: - Jake Vanderplas <vanderplas@astro.washington.edu> - Andre Xuereb (imaginary time propagation, normalized wavefunction For a theoretical description of the algorithm, please see http://jakevdp.github.com/blog/2012/09/05/quantum-pyt...
akapet00/schrodinger
src/scripts/quantum_tunneling.py
quantum_tunneling.py
py
11,191
python
en
code
4
github-code
36
26628181853
import pickle from flask import Flask,request,app,jsonify,url_for,render_template import nltk, re, string from nltk.corpus import stopwords, twitter_samples from sklearn.linear_model import LogisticRegression import pickle from sklearn.feature_extraction.text import CountVectorizer from Utilities import process_tweet f...
Sourav9827/Sentiment-Analysis
app.py
app.py
py
1,224
python
en
code
1
github-code
36
25314716557
import sys input = lambda : sys.stdin.readline().strip() N = int(input()) # # 480 -> 408 : 비트 연산으로 2의 배수 제거 # a = [i&1 for i in range(N+1)] # a[1] = 0 # # 640 -> 480 : 원소 -> 원소 제곱근 # for i in range(3, int(N**0.5)+1, 2): # if a[i]: # # 408 -> 392 : i의 2 배수부터 탐색 -> i의 제곱부터 탐색 # for j in range(i*i,...
soohi0/Algorithm_study
5월_4주/BOJ_소수의연속합/BOJ_소수의연속합_염성현.py
BOJ_소수의연속합_염성현.py
py
1,551
python
ko
code
0
github-code
36
19739912139
from __future__ import unicode_literals import urllib from vigilo.vigiconf.lib.confclasses.validators import arg, String, List from vigilo.vigiconf.lib.confclasses.test import Test from vigilo.common.gettext import l_ class NagiosPlugin(Test): """Test générique pour utiliser un plugin Nagios externe""" @ar...
vigilo/vigiconf
src/vigilo/vigiconf/tests/all/NagiosPlugin.py
NagiosPlugin.py
py
1,918
python
fr
code
3
github-code
36
1653425451
import numpy import matplotlib.pyplot as plt import pylab import dcf import utility as util import logistic_regression as lr import svm from tqdm import tqdm from copy import deepcopy from preprocessing import preprocess_Z_score import matplotlib # ======================================== FEATURES plots ============...
srrmtt/GenderVoiceDetection
plot.py
plot.py
py
19,657
python
en
code
0
github-code
36
13252818491
import math class magicChecker: def __init__(self, square, order): self.square = square self.n = order self.mag_num = int(self.findMagicNumber()) self.square_multi = {} def findMagicNumber(self): summ = (self.n/2.) * (math.pow(self.n,2) + 1) return ...
SiriusTux/MagicSquare
magicChecker.py
magicChecker.py
py
2,131
python
en
code
0
github-code
36
919257196
import requests from bs4 import BeautifulSoup import re from domains import CONTENT_AREA from emoji import emojize from urllib.parse import urlparse # ChatGPT d2ee59b7-b368-4a5f-b3af-2e33b7f33b4a example_url = [ "https://backlinko.com/actionable-seo-tips", "https://www.semrush.com/blog/seo-tips/", "https:/...
syahidmid/seoanalysis
scrapers/scrape.py
scrape.py
py
6,496
python
en
code
0
github-code
36
3985469839
import os from skimage import io import copy import numpy as np import random from glob import glob import json from sklearn.preprocessing import MultiLabelBinarizer import torch import torch.utils.data as data from torchvision import transforms, datasets from src.datasets.root_paths import DATA_ROOTS CLASSES = ['Sea...
jbayrooti/divmaker
src/datasets/bigearthnet.py
bigearthnet.py
py
5,152
python
en
code
3
github-code
36
23184346915
from mcpi.minecraft import Minecraft as MC root = MC.create() my_id = root.getPlayerEntityId("Jooooook") print("my_id: ", my_id) my_pos = root.entity.getPos(my_id) pos_x = {} pos_z = {} pos_y = {} pos_x["Jooooook"] = my_pos.x print(pos_x)
wewo329/workspace
python_workspace/python_study/with_minecraft/getPos.py
getPos.py
py
242
python
en
code
0
github-code
36
5726494392
from flask import Flask, jsonify, request import json import os app = Flask(__name__) # Load data from JSON file if it exists def load_data(): if os.path.exists('investment_funds.json'): with open('investment_funds.json') as file: return json.load(file) else: with open('investment_...
raqif/fund_management_system
app_json.py
app_json.py
py
3,352
python
en
code
0
github-code
36
12814165506
def solution(clothes): answer = 1 clothes_dict = {} for c in clothes: clothes_dict[c[1]] = clothes_dict.get(c[1],[])+[c[0]] for key in clothes_dict.keys(): answer = answer * (len(clothes_dict[key]) + 1) return answer - 1 print(solution([["yellowhat", "headgear"], ["bluesunglasses...
Girin7716/PythonCoding
Programmers/Problem_Solving/42578.py
42578.py
py
762
python
en
code
1
github-code
36
19534802491
from functools import wraps from flask import request, abort, g from app.models import User def login_required(f): """ This decorator ensures that the current user is logged in before calling the actual view. """ @wraps(f) def decorated(*args, **kwargs): if request.method != 'OPTIONS': ...
Zokormazo/ngLlery-backend
app/decorators.py
decorators.py
py
1,456
python
en
code
0
github-code
36
25056282946
from django import forms from django.core.exceptions import ValidationError from manager.models import Accountancy from manager.wallet_operations import wallet_choice, wallet_data_parse, change_wallet_balance class AccountancyForm(forms.ModelForm): class Meta: model = Accountancy fields = () ...
AndriyKy/zlatnic
manager/forms.py
forms.py
py
1,544
python
en
code
1
github-code
36
2986802119
# https://towardsdatascience.com/a-detailed-guide-to-pytorchs-nn-transformer-module-c80afbc9ffb1 import math from datetime import datetime from os import path import torch import torch.nn as nn from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from src.data_management.datasets.better_crnn_datas...
felix-20/gravitational_oceans
src/ai_nets/transformer.py
transformer.py
py
14,567
python
en
code
1
github-code
36
32929404532
#!/usr/bin/env python # coding: utf-8 import csv from config import ADDRESSES_FILE from models import Birthday, get_this_week_list def parse_data_file(in_file=ADDRESSES_FILE): """ :return: [] of {} List of birthdays """ reader = csv.DictReader(open(in_file, "r")) for row in reader: ...
raceup/happy-birthday-bot
hbb/bot.py
bot.py
py
1,857
python
en
code
0
github-code
36
10045098498
import requests import json import datetime,time from kafka import KafkaProducer # Liste des cryptos à récupérer # Configuration du Kafka Producer producer = KafkaProducer(bootstrap_servers=['broker:29092'], value_serializer=lambda x: json.dumps(x).encode('utf-8')) crypto_list = ["bitcoin", "ethereum", "ripple"] st...
stdynv/ARCHIDISTR
CryptoProducer.py
CryptoProducer.py
py
983
python
en
code
0
github-code
36
25289566
#1065번 #수열 판별 먼저 def seq_dcm(num): discriminant = True n = set() for i in range(1, len(num)): temp = int(num[i]) - int(num[i-1]) n.add(temp) if len(n) > 1: discriminant = False return discriminant X = int(input()) count = 0 for i in range(1, X+1): if seq_dcm(str(i)): ...
kmgyu/baekJoonPractice
function/한수.py
한수.py
py
362
python
en
code
0
github-code
36
74221037222
import threading import time import actions from database import * logInstance = log.logger('pinger') plogger = logging.getLogger('pinger') log.logger.init(logInstance, plogger) plogger.info('Pinger started') class Pinger(threading.Thread): """ Pings all connected clients for activity. Drops them when they a...
janlaan/distsys2010
src/pinger.py
pinger.py
py
1,630
python
en
code
5
github-code
36
5216435364
from pydantic import BaseModel, EmailStr from datetime import datetime from typing import Optional class User(BaseModel): user_id : int username : str forenames: str surname : str email : EmailStr bio : Optional[str] display_name : Optional[str] created_at: datetime class UserRegistra...
willpennell/r-shows
user-management-service/app/schemas/user_schemas.py
user_schemas.py
py
802
python
en
code
0
github-code
36
25676926
import math class PriorityQueue: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def size(self): return len(self.items) def clear(self): self.items = [] def enqueue(self, item): self.items.append(item) def findMaxIndex(self): ...
kmgyu/baekJoonPractice
데이터구조및실습수업/0517 PriorityQueue.py
0517 PriorityQueue.py
py
1,844
python
en
code
0
github-code
36
6751769066
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import QWidget from PyQt5.QtGui import QDoubleValidator from PyQt5.QtCore import pyqtSignal, pyqtSlot from selfdefineformat.views.editcheckbox import Ui_Form class EditCheckBoxModule(QWidget, Ui_Form): edited = pyqtSignal() def __init__(self, element, parent=None...
zxcvbnmz0x/gmpsystem
selfdefineformat/modules/editcheckboxmodule.py
editcheckboxmodule.py
py
3,645
python
en
code
0
github-code
36
16032494956
with open(r'C:\Users\oush\Downloads\dataset_3380_5(1).txt') as file: lst_str = file.readlines() d = {str(i): [] for i in range(1, 12)} # print(lst_str) for item in lst_str: item = item.split() print(item) d[item[0]].append(int(item[2])) print(d) with open(r'C:\Users\oush\Downloads\reply_3380_5.txt', 'w'...
oushMusa/project_one
game_table.py
game_table.py
py
553
python
en
code
0
github-code
36
7982812597
# nums = [3,2,3] # nums = [1,1,1,3,3,2,2,2] cnt = {} res = [] for i in nums: if i in cnt: cnt[i] += 1 else: cnt[i] = 1 if cnt[i] > len(nums)//3 and not i in res: res.append(i) print(res)
kyj0701/2020_Summer_Pyton
2020.07/07.20~07.24/07.23/229.py
229.py
py
242
python
en
code
0
github-code
36
34000667448
import json, random, csv, sys def check_input(): out_file = '' if (len(sys.argv) == 3) & (sys.argv[1] == '-i'): coded_file = sys.argv[2] out_file = None elif (len(sys.argv) == 5) & (sys.argv[1] == '-i') & (sys.argv[3] == '-o'): coded_file = sys.argv[2] out_fil...
namdar-nejad/COMP-598
A7/Code/src/analyze.py
analyze.py
py
1,690
python
en
code
0
github-code
36
37435918590
#!/usr/bin/env python # coding: utf-8 # In[5]: import numpy as np # In[1]: import plotly import matplotlib.pyplot as plt # In[3]: #Equations of motion: #y = vt + .5a(t**2) #x = vt #y = x + 0.5a(x**2)/(v**2) # In[6]: #Let intial velocity v = 10 m/s, acceleration a = -9.8 m/s^2, and initial height h = 100 ...
abbychriss/toy-projects
Projectile motion.py
Projectile motion.py
py
679
python
en
code
0
github-code
36
38265076029
from collections import OrderedDict import fnmatch import re IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) DEFAULT_CONFIGS = OrderedDict({ 'ckdn': { 'metric_opts': { 'type': 'CKDN', }, 'metric_mode': 'FR', }, 'lpips': { ...
Sskun04085/IQA_PyTorch
pyiqa/default_model_configs.py
default_model_configs.py
py
6,004
python
hi
code
0
github-code
36
72311226344
import os import subprocess from src.manager.manager.launcher.launcher_interface import ILauncher, LauncherException from src.manager.manager.docker_thread.docker_thread import DockerThread from src.manager.libs.process_utils import wait_for_xserver from typing import List, Any import time class LauncherDronesRos2(ILa...
JdeRobot/RoboticsApplicationManager
manager/manager/launcher/launcher_drones_ros2.py
launcher_drones_ros2.py
py
2,530
python
en
code
2
github-code
36
1147807834
"""empty message Revision ID: b7c0cfa43719 Revises: 25279a0b5c75 Create Date: 2016-11-02 00:02:18.768539 """ # revision identifiers, used by Alembic. revision = 'b7c0cfa43719' down_revision = '25279a0b5c75' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
CodeForProgress/sms-app
src/migrations/versions/b7c0cfa43719_.py
b7c0cfa43719_.py
py
760
python
en
code
1
github-code
36
1322353770
from resizer import * import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "--src", type=str, required=True, help="The directory of the folder with the image to be resized.", ) parser.add_argument( "--width", type=int...
hjk1996/Image-Resizer
main.py
main.py
py
1,243
python
en
code
0
github-code
36
14159948367
"""dividing a given corpus 'test' or 'dev' set into arbitrary sentence lengths""" ### input: .iob file ### ### output: .iob files ### with open("../test.iob", "r", encoding="utf-8") as f: test_split = f.readlines() very_low = list() very_very_low = list() low = list() med = list() high = list() current = "" co...
huspacy/huspacy-resources
scripts/ner_data_analysis/split_set_into_sentence_length.py
split_set_into_sentence_length.py
py
3,021
python
en
code
0
github-code
36
30731206475
####################################################################### # Necessaria a instalacao do biopython (pip install biopython) from Bio import pairwise2 from Bio.pairwise2 import format_alignment from Bio.Seq import Seq def alinhamento(seqt, numseq): nome1 = "guilherme" nome2 = "costa" nome3 = "ol...
GuilhermeC0sta/Alinhamento-Multiplo-de-DNA
CodWithGUI/alinhamento_func.py
alinhamento_func.py
py
3,205
python
en
code
0
github-code
36
16968956587
# -*- coding: utf-8 -*- from django.template.loader import render_to_string from django.contrib.admin.utils import quote def get_mptt_admin_node_template(instance): ''' Get MPTT admin node template name by model instance :param instance: instance of mptt model :return: template name ''' return...
infolabs/django-edw
backend/edw/admin/mptt/utils.py
utils.py
py
1,309
python
en
code
6
github-code
36
2956310970
import socket import struct import subprocess import logging from datetime import datetime # Configuração do cliente MULTICAST_IP = '224.0.0.1' MULTICAST_PORT = 5004 CHUNK_SIZE = 1472 # Tamanho do pacote incluindo 4 bytes para o contador CLIENT_INTERFACE_IP = '0.0.0.0' # Use o IP de interface apropriado se necessári...
gpdolzan/R2LAST
cliente.py
cliente.py
py
4,325
python
pt
code
0
github-code
36
33997460968
from fbchat import * from fbchat.models import * from Credentials import * import json import requests import re import os import time from threading import Thread import socket def finalVerification(url): if re.search("homework-help", url): return True return False def question_id(url): try: ...
namdao2000/MessengerBot
MessengerBot.py
MessengerBot.py
py
5,534
python
en
code
0
github-code
36
30630423030
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 16 19:35:10 2020 @author: isaacparker """ #Load libraries import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd from scipy.stats import lognorm, gaussian_kde # Specify font used in plots font = 'Adobe Myungjo...
PV-Lab/Data-Driven-PV
Figure_1.py
Figure_1.py
py
2,792
python
en
code
4
github-code
36
36663492998
import news_parser as Util import datetime import time import DBHandler from tensorflow.keras.models import load_model import predict CompanyList=[] Headless = True # False : 창띄움, True : 창없음 MakeCompanyList = False # 회사 리스트 갱신 host = '데이터베이스 주소' ID= '계정명' PW='비밀번호' DB_name='DB이름' def GetNewsInfo(driver): headline...
woqls22/StockNews
BackEnd/PythonScripts/main.py
main.py
py
4,929
python
en
code
3
github-code
36
22530303098
import numpy as np import pytest from gym.spaces import Box, Discrete from gym.wrappers import AtariPreprocessing, StepAPICompatibility from tests.testing_env import GenericTestEnv, old_step_fn class AleTesting: """A testing implementation for the ALE object in atari games.""" grayscale_obs_space = Box(low=...
openai/gym
tests/wrappers/test_atari_preprocessing.py
test_atari_preprocessing.py
py
4,102
python
en
code
33,110
github-code
36
505642870
def osm_vs_imd(osmxlsx, osmxml, imd, outfishnet, outshp): #Create a fishnet use raster file while imd: osm_ref_tags = { "TABLE" : osmxlsx, "SHEET" : 'osm_features', "LULC_COL" : 'L4', "KEY_COL" : "key", "...
jasp382/glass
exp/devcode/osm_vs_imd_tst.py
osm_vs_imd_tst.py
py
3,052
python
en
code
2
github-code
36
29394077350
import cv2 import numpy as np import glob from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph.opengl as gl import numpy as np from time import sleep dis_test_label = np.load("D:/PythonFile/NestProject/Nest_Model/pos_process/test_data/dis_test_data_complex_exp_shuffle_3.npy") dis_test_predict = np.load('D:...
yangyongjx/LoRaNet
pos_process/reprojection_img.py
reprojection_img.py
py
2,149
python
en
code
0
github-code
36
3273808823
# This is a sample Python script. #########################################: Please Don't Change :####################################### import logging import os import sys from datetime import datetime sys.path.append( "/home/sonu/workspace/pro/component/" ) sys.path.append( "/home/sonu/workspace/pro/utils/...
rajeshraj124/advanced_logger_with_single_place_credentials
pro_sample/main.py
main.py
py
1,997
python
en
code
0
github-code
36
35388901124
#!/usr/bin/env python3 from sys import stderr, stdout from os import environ from random import randrange, randint from tc import TC from triangolo_lib import Triangolo ############## TESTCASES' PARAMETERS ############################ TL = 1 # the time limit for each testcase MAPPER = {"tiny": 1, "small": 2, "med...
romeorizzi/TALight
tal_algo/private/triangolo_unrank_opt_sol/manager.py
manager.py
py
1,478
python
en
code
11
github-code
36
22869043882
import pygame, sys #기본세팅 import random, time #내가 추가한 것 from pygame.locals import * #Set up pygame. pygame.init() #상수 정의 SCREEN =8 BLACK = (0,0,0) GREEN = (0, 128, 0) WHITE = (255, 255, 255) BLUE = (0,0,255) RED = (255,0,0) YELLOW = (255,204,51) screen = pygame.display.set_mode((600,400), 0,32) pyg...
Choiseungpyo/Othello_Python
Othello.py
Othello.py
py
22,209
python
en
code
0
github-code
36
69912444584
"""Tools for preprocessing Gradebooks before grading.""" from __future__ import annotations import typing import pandas as pd from .core import AssignmentGrouper from ._common import resolve_assignment_grouper # private helper functions ============================================================= def _empty_mas...
eldridgejm/gradelib
gradelib/preprocessing.py
preprocessing.py
py
8,266
python
en
code
6
github-code
36
29101674414
# Debugging script to see how much GPS signal bounced around import csv import math import numpy as np from matplotlib import pyplot as plt ''' # distance between points dx_between_pts = [] prev_lat, prev_long = 0, 0 with open('2_2_23_gps.csv', mode ='r') as f: csv_f = csv.reader(f) for i, line in enumerate(csv_f...
bainro/jackal_melodic
plotGPS.py
plotGPS.py
py
2,117
python
en
code
0
github-code
36