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
32710979605
import gym import pytest @pytest.mark.skip(reason='suspected as slow, > 5min. TODO (peterz) fix') def test_treechop_smoke(): with gym.make('minerl:MineRLTreechop-v0') as env: env.reset() for _ in range(10): env.step(env.action_space.sample())
sihangw/minerl
tests/env_smoke_test.py
env_smoke_test.py
py
277
python
en
code
null
github-code
50
21238320601
from datetime import datetime from typing import List from json import load, dump from os.path import exists from nextcord import Embed, Member, Message from nextcord.ext.commands import Cog, Context from pytz import timezone from ..bot import RF from ..utils import Moderation class Log(Cog): def __init__(self,...
codacy-badger/RF-911-Bot
RF/cogs/Log.py
Log.py
py
5,272
python
en
code
0
github-code
50
13567613364
import scrapy import re #import BaseSpider import sys sys.path.append('/home/shige/sg/sg') from sg.items import SgItem #import Selector from scrapy.selector import Selector class NewsSpider(scrapy.Spider): name = "news" # allowed_domains = ["http://news.hitwh.edu.cn/"] start_urls = ['http://news.hitwh.ed...
hitwhsg/hitwhsg
news.py
news.py
py
984
python
en
code
0
github-code
50
42634935603
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '12/18/2020 11:28 AM' class Solution: def exchange(self, nums): left, right = 0, len(nums) - 1 while left < right: while left < len(nums) and nums[left] % 2 != 0: left += 1 while right >= ...
AaronYang2333/CSCI_570
records/12-18/asd223.py
asd223.py
py
618
python
en
code
107
github-code
50
4443340570
from google_images_search import GoogleImagesSearch import zipfile import os # you can provide API key and CX using arguments, # or you can set environment variables: GCS_DEVELOPER_KEY, GCS_CX gis = GoogleImagesSearch( 'AIzaSyBpIAcN5IIIcmfLwGq3j6fAV5QkW6vn4N0', '2e5dded9ae895e14b', validate_images=True) ...
raj-chinagundi/Piccauto
searching.py
searching.py
py
1,123
python
en
code
0
github-code
50
2338189529
# team.images.utils.py from team.images import app_config def list_to_str(lst): '''Creates string from string list separated using default separator''' list_as_string = '' if isinstance(lst, str) is False: for iterator in range(0, len(lst)): if iterator == 0: list_as_str...
slobodz/team.images
team/images/service/utils.py
utils.py
py
2,543
python
en
code
0
github-code
50
32086595559
import sys from collections import defaultdict input = lambda:sys.stdin.readline() graph=defaultdict(list) N = int(input()) for _ in range(N-1): u, v = map(int, input().split()) graph[u].append(v) graph[v].append(u) q = int(input()) for _ in range(q): t, k = map(int, input().split()) if t == 1: ...
sami355-24/2023SummerVacationCodingTestCamp
lsm/230922-lsm-14675.py
230922-lsm-14675.py
py
442
python
en
code
0
github-code
50
40993511170
""" Errors terminates the python code been executed - Syntax error - shows the error with ^ - most IDE catches this error - exceptions: errors that occur during execution - code is syntactically correct - but error occurs when you try to execute it exception handling: Try: block...
PavelKo41/SDAtraining
venv/exceptions.py
exceptions.py
py
1,647
python
en
code
0
github-code
50
1685923786
import math import numpy as np import paddle import paddle.nn as nn import paddle.nn.functional as F from paddle3d.apis import manager from paddle3d.models.common import pointnet2_stack as pointnet2_stack_modules from paddle3d.models.heads.roi_heads.roi_head_base import RoIHeadBase from paddle3d.models.layers import ...
PaddlePaddle/Paddle3D
paddle3d/models/heads/roi_heads/pvrcnn_head.py
pvrcnn_head.py
py
7,124
python
en
code
479
github-code
50
17194158385
""" This scripts receives OSC messages via the pyOSC library and controls APA102 LEDs with the Adafruit DotStar library. It is used for displaying video or test data on LED stripes. """ import os import OSC import time from subprocess import call from dotstar import Adafruit_DotStar """ Setup DotStar strip for us...
DFortmann/Wireless-LEDs
oscServer3.py
oscServer3.py
py
4,792
python
en
code
3
github-code
50
261175975
""" Here the calculations for the forcasts and the tomorrow value will be calculated. """ from datetime import datetime, timedelta, timezone import pandas class Forecasts: def __init__(self, csv_location="weather.csv"): self.weather_dataframe = pandas.read_csv(csv_location) def get_forecast(self, ...
GustaafL/weather_forecast
src/weather_forecast/forecasts.py
forecasts.py
py
2,673
python
en
code
0
github-code
50
69892425115
from django.shortcuts import render from django.http import HttpResponse from . import mqtt as mqtt_module import time MQTT_HOST = "77.234.202.168" MQTT_PORT = 1883 MQTT_KEEPALIVE_INTERVAL = 60 def index(request): return HttpResponse("<h2>QR_Reader module is loaded here</h2>") def qr_reader(request): # this loa...
itmo-swm/SGB-Simulation
qr_reader/views.py
views.py
py
2,484
python
en
code
0
github-code
50
24893180562
#숫자 카드 import sys N=int(input()) N_list = list(map(int, sys.stdin.readline().strip().split())) M=int(input()) M_list=list(map(int, sys.stdin.readline().strip().split())) N_list.sort() for i in M_list: MIN, MAX = 0, len(N_list) while True: if MIN > MAX: MAX = MAX+1 break ...
AlPomo/AlgorithmReview
Baekjoon/Week04/10815_G.py
10815_G.py
py
687
python
en
code
0
github-code
50
18608030
from __future__ import division from __future__ import print_function from astropy.io import fits import argparse import numpy as np import re import sys def readfits(infile, iext=0): """Read FITS file. Parameters ---------- infile : string Input file name to be read. iext : int E...
criscabe/CIRCE
code/Data_reduction/median_of_ramps.py
median_of_ramps.py
py
5,633
python
en
code
2
github-code
50
18051536698
# importando as lib necessárias import pandas as pd import zipfile # Descompactando arquivo 'dados.zip' with zipfile.ZipFile('dados.zip', 'r') as zip_dados: zip_dados.extractall('C:\\Users\\Asus\\PycharmProjects') # Criando dataframes com os arquivos cvs descompactados df_origem = pd.read_csv('C:\\Users\\Asus\\Py...
gustavofranco88/pandas
criar_arquivo_sql.py
criar_arquivo_sql.py
py
1,713
python
pt
code
0
github-code
50
74418461276
# https://stackoverflow.com/questions/34588464/python-how-to-capture-image-from-webcam-on-click-using-opencv import cv2 import opencv.gridReaderFinal as gr def screenshot(size: int): '''Returns the grid from the captured image. If no image was captured, returns empty string. NOTE: Save path changes depend...
TimTwigg/Research
opencv/gridcapture.py
gridcapture.py
py
1,620
python
en
code
2
github-code
50
36363999649
from flask import Blueprint from CTFd.plugins.challenges import BaseChallenge from .models import DynamicInstanceChallenges class DynamicInstanceChallenge(BaseChallenge): id = "dynamic_instance" # Unique identifier used to register challenges name = "dynamic_instance" # Name of a challenge type template...
PeronGH/CTFd-DCI
CTFd-DCI/challenge_type.py
challenge_type.py
py
1,219
python
en
code
0
github-code
50
3950322746
import speech_recognition as sr r = sr.Recognizer() # Define audio file audio = 'peacock.wav' # Process the audio file speech to text with sr.AudioFile(audio) as source: audio = r.record(source) print('Done') try: text = r.recognize_google_cloud(audio) print(text) except Exception as e: print(e...
MichaelZLai/interactive_notetaking
quick_stt.py
quick_stt.py
py
321
python
en
code
0
github-code
50
4893132817
def solve(ds): n, m = [int(i) for i in ds[0].split(' ')] fib = [1, 1] for i in range(2, n, 1): if 0 <= i - (m+1) < len(fib): # takes into account dying rabbits temp = fib[i-2] + fib[i-1] - fib[i - (m+1)] elif i == m: # first batch of dying rabbits temp = fib[i-2] + ...
Plezo/rosalind_solutions
FIBD.py
FIBD.py
py
567
python
en
code
0
github-code
50
44561341438
#!/usr/bin/env python3 import pyquil.api as api from classical import rand_graph, classical, bitstring_to_path, calc_cost from pyquil.paulis import sI, sZ, sX, exponentiate_commuting_pauli_sum from scipy.optimize import minimize from pyquil.api import WavefunctionSimulator from pyquil.gates import H from pyquil import...
murphyjm/cs269q_radzihovsky_murphy_swofford
quantum.py
quantum.py
py
4,285
python
en
code
5
github-code
50
42088448727
# -*- coding: utf-8 -*- import logging import sys from loguru import logger class InterceptHandler(logging.Handler): """ Intercept logging messages and reroute them to the loguru. """ def emit(self, record): # Get corresponding Loguru level if it exists try: level = logger.level...
caracal-pipeline/crystalball
crystalball/logger_init.py
logger_init.py
py
1,423
python
en
code
2
github-code
50
72242345115
import pytest from flask import session from conftest import create_test_game from assassin_server.db_models import Players, Games, db, table_to_dict #For this test we'll run a 10 person game def test_mock_game(client, app): game_size = 10 # Now we'll start the game! players_info = create_test_game(client...
grahamammal/comp225-server
tests/test_example_game.py
test_example_game.py
py
7,923
python
en
code
1
github-code
50
29597226637
from .views import * from django.urls import path urlpatterns = [ path('seller_blank_pages/', seller_blank_pages, name='seller_blank_pages'), path('seller_bootstrap_alert/', seller_bootstrap_alert,name='seller_bootstrap_alert'), path('seller_bootstrap_badge/',seller_bootstrap_badge,name='seller_bootstrap_...
JenilAnghan/Project
seller/urls.py
urls.py
py
4,052
python
en
code
0
github-code
50
42241845977
import multiprocessing import ConfigParser import sys import os CONF_FILE = "config.conf" def get_physical_mem_size(): mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') mem_gib = round(mem_bytes/(1024.**3)) return mem_gib def get_worker_threads_count(): cpu_count = multiprocessi...
amit-pub/tasks
image-downloader/download-to-local-FS/util.py
util.py
py
933
python
en
code
1
github-code
50
8100032419
__author__ = "Noreddine Kessa" __copyright__ = "!" __license__ = "MIT License" from NKTransitions import * from NKTransition import * class NKConfigToTransitions: def __init__(self, ConfigPath=""): self.ConfigPath =ConfigPath self.transitions = NKTransitions(Name="" , initia...
knor12/NKFSMCompiler
NKFSMCompiler/NKConfigToTransitions.py
NKConfigToTransitions.py
py
2,837
python
en
code
0
github-code
50
15715570292
data = input() # 0이나 1일 경우에는 더하는게 맞다. answer = int(data[0]) for index in range(1, len(data)): num = int(data[index]) if num <= 1 or answer <= 1: answer += num else: answer *= num print(answer)
BTOCC24/Algorithm
This is codingTest/그리디/곱하기 혹은 더하기/곱하기 혹은 더하기.py
곱하기 혹은 더하기.py
py
248
python
ko
code
1
github-code
50
28596250625
"""Implementation of the Skeleton model """ import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../src'))) from classes import BaseModelImpl from torch import nn from layers.causalcall import CausalCallConvBlock class CausalCallModel(BaseModelImpl): """CasualCall Mo...
marcpaga/basecalling_architectures
models/causalcall/model.py
model.py
py
2,462
python
en
code
5
github-code
50
19601138102
from __future__ import annotations from typing import Dict, TYPE_CHECKING, Union, Type from assistants.deployments.aws.api_endpoint import ApiEndpointWorkflowState from assistants.deployments.aws.api_gateway import ApiGatewayResponseWorkflowState from assistants.deployments.aws.cloudwatch_rule import ScheduleTriggerW...
refinery-labs/refinery
api/assistants/deployments/aws/new_workflow_object.py
new_workflow_object.py
py
2,966
python
en
code
2
github-code
50
33862318363
class Solution: def maxProfit(self, prices: List[int]) -> int: dp = [0 for _ in range(len(prices) + 1)] for i in range(1,len(prices)): if dp[i]: return dp[i] dp[i] = max(0, dp[i-1] + prices[i] - prices[i-1]) return max(dp)
mykoabe/Competetive-Programming
All collections/121-best-time-to-buy-and-sell-stock/121-best-time-to-buy-and-sell-stock.py
121-best-time-to-buy-and-sell-stock.py
py
304
python
en
code
1
github-code
50
86766993796
# Django from django.shortcuts import render_to_response, redirect, HttpResponseRedirect from django.contrib.auth import authenticate, login from django.contrib import messages from django.conf import settings from django.contrib.auth.decorators import login_required # Apps from misc.utils import * #Import miscellaneo...
The-WebOps-Club/fest-api
apps/home/views.py
views.py
py
3,170
python
en
code
12
github-code
50
5112566879
import http.client domainFootballApi = "v3.football.api-sports.io" keyFootballApi = "..." headers = { 'x-apisports-key': keyFootballApi } def getRequest(queryLine): connection = http.client.HTTPSConnection(domainFootballApi) if (queryLine[0] != "/"): queryLine = "/" + queryLine connection.request("GET", queryL...
petartotev/PT_Library_Python_UltimatePythotev
libraries/pythotev_library_http_football_api.py
pythotev_library_http_football_api.py
py
696
python
en
code
0
github-code
50
40158298450
import FWCore.ParameterSet.Config as cms process = cms.Process("TEST") process.options = cms.untracked.PSet( numberOfStreams = cms.untracked.uint32(1) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(3) ) process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring('fil...
cms-sw/cmssw
FWCore/Integration/test/DetSetVectorThinningTest2_cfg.py
DetSetVectorThinningTest2_cfg.py
py
1,656
python
en
code
985
github-code
50
11237801787
import os import transformers import pandas as pd from utils import text_to_dataloader from bert_embedding import BertEmbeddingExtractorVanilla HEADER_CONST = "# sent_id = " TEXT_CONST = "# text = " STOP_CONST = "\n" WORD_OFFSET = 1 LABEL_OFFSET = 3 NUM_OFFSET = 0 def txt_to_dataframe(data_path): ''' read UD...
ErezSC42/bert_pos_analysis
test_embedding_extractor.py
test_embedding_extractor.py
py
2,169
python
en
code
0
github-code
50
1171679180
from launch import LaunchDescription from ament_index_python.packages import get_package_share_directory from launch_ros.actions import Node from launch.actions import ExecuteProcess import os.path def generate_launch_description(): ld = LaunchDescription() sim_node = Node( package="robot_projects_sim...
lessthantrue/RobotProjects2
robot_projects_ekf_localization/launch/make_evaluate_bag.launch.py
make_evaluate_bag.launch.py
py
1,144
python
en
code
0
github-code
50
40577424537
import torch from torch import optim # Text text processing library and methods for pretrained word embeddings import torchtext from torchtext.vocab import Vectors, GloVe # Named Tensor wrappers from namedtensor import ntorch, NamedTensor from namedtensor.text import NamedField # Our input $x$ TEXT = NamedField(names...
mtensor/cs287
ps1/logistic_regression.py
logistic_regression.py
py
4,453
python
en
code
0
github-code
50
24833699202
#öyle bir fonksiyon yazın ki kullanıcının adını gönderdiğinizde hoşgeldin isim yazsın. isim=input("İsminizi yazın. :") print("Hoşgeldin", isim) #kendisine girilen sayının karesinin karesini hesaplasın. sayi=int(input("Sayı gir:")) def hesapla(a): print(a*a*a*a) hesapla(sayi) #girilen bu sayının çi...
progamerofTR/bilsem2
fonksiyon uygulama 2.py
fonksiyon uygulama 2.py
py
536
python
tr
code
0
github-code
50
27576108554
# -*- coding: utf-8 -*- """ Created on Thu Dec 2 12:41:14 2021 @author: hp """ from flask import Flask, render_template, request from wtforms import Form, TextAreaField, validators import pickle import sqlite3 import os import numpy as np import joblib loaded_model=joblib.load(r"D:/ML_Project\model.p...
ankitaanjali1202/Twitter-Senti-Meter
app.py
app.py
py
1,464
python
en
code
1
github-code
50
31023238558
import pygame import time import random from pygame.locals import* from time import sleep ############################ ########## Mario ########### ############################ class Mario(): def __init__(self, model): self.model = model self.x = 0 self.y = 0 self.model.scrollPos = self.x - 350 self.prev_x...
wws002/pyMario
game.py
game.py
py
9,260
python
en
code
0
github-code
50
23781955007
from cube import Config from cube.activities.utils import Utils import subprocess, os from shutil import copyfile # the alignment file probably needs to be checked class Conservationist: def __init__(self, upload_handler): # directories self.job_id = upload_handler.job_id self.workdir = "{}/{}".format(...
ivanamihalek/cube_server
cube/activities/conservation.py
conservation.py
py
8,595
python
en
code
0
github-code
50
10860308596
from AsyncDjangoApp.celery import app from App.models import Tasks from time import sleep import random @app.task(bind=True) def process(self, job_name=None): b = Tasks(task_id=self.request.id, job_name=job_name) b.save() self.update_state(state='Dispatching', meta={'progress': '33'}) sleep(random.r...
mahdi-ghelichi/AsyncDjangoApp
App/tasks.py
tasks.py
py
671
python
en
code
7
github-code
50
17169184421
from collections import OrderedDict import json from .logger import Logger from .handlers import ConsoleHandler, JsonFileHandler json_serializer = json.dumps STR_FMT_DICT = dict( progress=' [{0: <20}]', metrics=' [{0: <28}]', default=' [{0: <10}]' ) def get_str_format(key): if key not in STR_FMT_DI...
Deep-Spark/DeepSparkHub
cv/semantic_segmentation/unet3d/pytorch/ixpylogger/training_logger.py
training_logger.py
py
1,769
python
en
code
28
github-code
50
28333036923
# A* Search Algorithm # # let openList equal empty list of nodes # let closedList equal empty list of nodes # put startNode on the openList (leave it's f at zero) # while openList is not empty # let currentNode equal the node with the least f value # remove currentNode from the openList # add currentNode to...
PROxZIMA/Academic-Codes
Semester 6/LP2/A2/A2.py
A2.py
py
4,343
python
en
code
47
github-code
50
886111389
import os import subprocess import math import random as rd import numpy as np import automated_compiling as autcom NbDim = 8 # 5 elts in a solution (n1,n2,n3,nb_t,nb_it,tblk1,tblk2,tblk3) (opt and simdType not used yet) size = 256 lmin = [32, 32, 32, 1, 100, 16, 16,...
MarcelKondo/Proj-intel-repo
mpi_HillClimbing.py
mpi_HillClimbing.py
py
2,327
python
en
code
1
github-code
50
20397466874
import os import json import datetime as dt import logging import pika import psycopg2 from sqlalchemy import create_engine from sqlalchemy import Column, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from database import DataBaseConnection logging.basi...
WolfusFlow/Virtual_data_generator
orchestrator/MqItemConsumer.py
MqItemConsumer.py
py
2,275
python
en
code
0
github-code
50
23334016212
#!/usr/bin/python3 import xml.etree.ElementTree import argparse import sys import os.path import pprint import logging def process_cmdline(): parser = argparse.ArgumentParser() parser.add_argument('-f', '--fsroot', help='fsroot that was given to dar create') parser.add_argument('files', metavar='FILE', na...
ncsa/pdbkup
bin/dar_parse_xml.py
dar_parse_xml.py
py
1,598
python
en
code
0
github-code
50
38131098194
# this is to keep mypy happy from .pyrosetta_import import pyrosetta import warnings from typing import List, Tuple class _IgorBase: def __init__(self): warnings.warn('Virtual only method: THIS METHOD SHOULD NOT BE RUN. CALL `Igor`', category=SyntaxWarning) self.pose = pyrosetta.Pose() self...
matteoferla/Fragmenstein
fragmenstein/igor/_igor_base.py
_igor_base.py
py
817
python
en
code
132
github-code
50
1745617578
# -*- coding: utf-8 -*- """ Created on Wed Mar 30 17:36:17 2022 @author: noemie """ import xarray as xr import numpy as np #import pandas as pd import os import random #import pyproj as proj from sklearn.decomposition import PCA import copy as cp from sklearn.decomposition import KernelPCA from sklearn.preprocessing ...
noemieplanat/Clustering_Lagrangian_particles
Scripts/All_functions_ML.py
All_functions_ML.py
py
18,619
python
en
code
0
github-code
50
25193341516
# Creating a dictionary of 20 countries Countries = dict({'1': 'Argentina', '2': 'Australia', '3': 'Brazil', '4': 'Colombia', '5': 'Egypt', '6': 'France', '7': 'Germany', '8': 'Greece', ...
CT673/End-of-Module-Assignment
Config.py
Config.py
py
1,313
python
en
code
0
github-code
50
3120828974
from jupyter_client.manager import start_new_kernel import thebe.core.file as File import thebe.core.constants as Constant import thebe.core.output as output import thebe.core.logger as Logger import thebe.core.database as Database import thebe.core.html as Html from pygments import highlight from pygments.lexers impo...
hotsoupisgood/Thebe
thebe/core/jupyter_wrapper.py
jupyter_wrapper.py
py
19,967
python
en
code
0
github-code
50
27157479985
import pandas as pd import numpy as np import logging import math logging.basicConfig(format="%(asctime)s %(name)s:%(levelname)s:%(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO) def varStats(dataframe,round=2): format_str = "{" + "0:,." + str(round) + "f}" data=dataframe list_role = [] l...
leeoo/pyminer
pyminer2/extensions/packages/data_miner/data_miner/features/statistics/basic_stats.py
basic_stats.py
py
4,475
python
en
code
null
github-code
50
17009503445
# -*- coding: utf-8 -*- import os import argparse from datetime import datetime, timedelta from dataclasses import asdict from typing import List import uuid import const from logging import Logger import logger from mq import MQ, MQMsgData import ysapi def _send_msg(send_data: MQMsgData, queue_name: ...
pro-top-star/python-stock-out
app/stockout_yshop_producer.py
stockout_yshop_producer.py
py
4,722
python
en
code
2
github-code
50
25290415553
from matplotlib import pyplot as plt from matplotlib import cm def plot_by_num_and_group(sequences_in, numcol, groupcols): seq = sequences_in.copy() g = seq.groupby(groupcols) n_col = 4 n_row = len(g) // n_col + len(g) % n_col f, axes = plt.subplots(n_row, n_col, figsize=[20, 15], sharex=True, shar...
teddygroves/football_on_paper
plotting.py
plotting.py
py
2,214
python
en
code
0
github-code
50
8231560009
# Environment to play #environment = 'LunarLanderContinuous-v2' environment = 'Pendulum-v0' #environment = 'CartPole-v1' # environment = 'Acrobot-v1' # environment = 'MountainCar-v0' # Continuous Action if true #continuous_action = False continuous_action = True # Number of Episodes max_episodes = 100000 #Summaries ...
KatayamaLab/tf-rl
config.py
config.py
py
754
python
en
code
0
github-code
50
43949326095
# -*- coding: utf-8 -*- """ Created on Fri Oct 25 09:32:01 2019 @author: benja """ import pandas as pd import re import numpy as np import os from itertools import permutations import multiprocessing as mp import utils import string import json import sys from functools import partial def fn...
bubalis/ae_sysreview
author_work.py
author_work.py
py
45,236
python
en
code
0
github-code
50
42931306467
#!/usr/bin/python3 def weight_average(my_list=[]): if(len(my_list) == 0): return 0 suma = 0 divisor = 0 for i in my_list: suma += i[0] * i[1] for i in my_list: divisor += i[1] return suma / divisor
valerepetto14/holbertonschool-higher_level_programming
0x04-python-more_data_structures/100-weight_average.py
100-weight_average.py
py
248
python
en
code
0
github-code
50
36348384155
import json from .generalhandle import GeneralHandle from .generalhandle import BaseHandle from .converter import api2mc from .converter import mc2api import tornado.httpclient import logging logger = logging.getLogger('API') APIVersion = 'V5.1.0.1.0.20170421' CM_MAU_MQ = { 'ex': 'mau.cmmau.ex', 'key': 'mau....
github188/dest
80-moservice/vcapi/src/v1/vchandle.py
vchandle.py
py
54,755
python
en
code
0
github-code
50
23240011506
import pandas as pd import talib as ta import tushare as ts from tqdm import tqdm pd.set_option('display.max_columns', None) # set token ts.set_token('303f0dbbabfad0fd3f9465368bdc62fc775bde6711d6b59c2ca10109') # initialize pro api pro = ts.pro_api() def get_transform_data(path): df = pd.read_csv(path, index_col...
HuifengJin/Quant_project
solutions/week2/solution_panel.py
solution_panel.py
py
1,862
python
en
code
0
github-code
50
70969694234
# geeksforgeeks-practice def gcd(a, b): if a<b: small=a else: small=b for x in range(1,small+1): if ((a%x==0) and (b%x==0)): g=x return g
ArunimaGupta1/geeksforgeeks-practice
GCD.py
GCD.py
py
187
python
en
code
0
github-code
50
21540899903
# -*- coding: utf-8 -*- """ Created on Sun Oct 13 14:46:27 2019 @author: emili """ ##Importing Keras Libraries from keras.models import Sequential from keras.layers import Convolution2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense ##Initializing the CNN classif...
tresstogo/Deep_Learning
cnn_M.py
cnn_M.py
py
2,830
python
es
code
0
github-code
50
70307591194
# Databricks notebook source # MAGIC %md # Population vs. Median Home Prices # MAGIC #### *Linear Regression with Single Variable* # COMMAND ---------- # MAGIC %md ### Load and parse the data # COMMAND ---------- # Use the Spark CSV datasource with options specifying: # - First line of file is a header # - Automa...
AdamPaternostro/Azure-Databricks-Dev-Ops
notebooks/MyProject/Pop. vs. Price LR.py
Pop. vs. Price LR.py
py
4,598
python
en
code
61
github-code
50
15660309619
import json import shutil from tempfile import mkdtemp class ExperimentalEnvironment(object): UNREL_GRAPH = "unrelated_graph" UNREL_RULE_GRAPH = "thermometer" UNREL_RULE_RULE = "temperature_rule" NOT_FEASIBLE_RULE = "light2_rule" MAIN_GRAPHS = ["facts.n3"] MAIN_RULE = ["light3_rule.n3"] ...
gomezgoiri/actuationInSpaceThroughRESTdesc
ScnImpl/wot2013/evaluation/environment.py
environment.py
py
4,472
python
en
code
0
github-code
50
35116740678
from collections import namedtuple def coll_namedtuple(): City = namedtuple('City', 'name country population coordinates') tokyo = City('Tokyo', 'JP', population=36.99, coordinates=(35.66, 139.69)) print(tokyo) print(City._fields) LatLong = namedtuple('LatLong', 'lat long') delhi_data =('Delhi NCR', 'IN',...
alexIGit/practics
py_luchano/tuple.py
tuple.py
py
626
python
en
code
0
github-code
50
17538298267
import pandas as pd import numpy as np # pandas分组 # -聚合 计算汇总统计 # -转换 执行一些特定于组的操作 # -过滤 再某些情况下丢弃数据 d = { 'Name': pd.Series(['Tom', 'James', 'Ricky', 'Vin', 'Steve', 'Minsu', 'Jack' 'Lee', 'David', 'Gasper', 'Betina', 'Andres']), 'Year' : pd.Series([2015, 2016, 2013, 2015, 2019, 2016, ...
yruns/Machine_Learning
DataAnalysis/Pandas/groupBy.py
groupBy.py
py
1,931
python
zh
code
0
github-code
50
68087887
import operator W= input('Please enter a string ') d=dict() def most_frequent(string): for key in string: if key not in d: d[key] = 1 else: d[key] += 1 return d print (most_frequent(W)) sorted_d = dict( sorted(d.items(), key=operator.itemgetter(1),reverse=True)) print('D...
Divyanaik74/Xyz.py
Most_frequent.py
Most_frequent.py
py
373
python
en
code
0
github-code
50
71122609754
import http.server import socketserver PORT = 8000 MAX_OPEN_REQUESTS = 5 class TestHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): print("GET received") print("Request line:" + self.requestline) print(" Cmd: " + self.command) print(" Path: " + self.path) ...
baasi/2018-19-PNE-practices
P5/webserver.py
webserver.py
py
1,460
python
en
code
0
github-code
50
39435831697
from PyQt6.QtCore import Qt, QSortFilterProxyModel, QModelIndex from PyQt6.QtWidgets import QHeaderView import Fandom from AbstractModel import AbstractModel class ItemModel(AbstractModel): def __init__(self): self.what = 'ALL' super().__init__([ AbstractModel.Column('ID', lambda x: x...
mcondarelli/DDDAedit
ItemModel.py
ItemModel.py
py
2,591
python
en
code
0
github-code
50
13004426895
"""According to the question we need to maintain count of likes and dislikes such that from a set of numbers(Second line of input) if a particluar number exist in set A(Third line of input) then the happiness count will be 1, if it exist in (Forth line of input)B the happiness count will be -1 and if neither of the set...
TLE-MEC/Hack-CP-DSA
Hackerrank/No Idea!/Solution.py
Solution.py
py
1,246
python
en
code
180
github-code
50
13287888443
from fastapi import FastAPI, File, UploadFile import uvicorn import numpy as np from io import BytesIO from PIL import Image import tensorflow import cv2 from tensorflow.keras.applications.inception_v3 import preprocess_input app = FastAPI() model = tensorflow.keras.models.load_model("gender_model.h5") @app.get("/pin...
raghuadloid/character_creation
gender.py
gender.py
py
1,422
python
en
code
0
github-code
50
23447294801
import unittest from city_functions import city_country from city_functions import city_country_people class CityFunctionsTestCase(unittest.TestCase): """Тесты для city_functions.py""" def test_city_country(self): """Работает ли связка Santiago Chile""" formatted_name = city_country("santiago...
91nickel/python
tests.py/test_cities.py
test_cities.py
py
1,054
python
en
code
0
github-code
50
19935741898
#Problem 10 def is_prime(n): if n == 1: return False for i in range(2,int(n**(0.5))+1): if n%i==0: return False count = 0 total = 0 n = 1 while n < 2000000: n += 1 if is_prime(n) != False: count += 1 total += n print(total)
jasmineseah-17/euler
10_Summation_of_primes.py
10_Summation_of_primes.py
py
286
python
en
code
0
github-code
50
73324525275
import argparse from attrdict import AttrDict from deriva.core import ErmrestCatalog, get_credential, DerivaPathError from deriva.utils.catalog.manage.update_catalog import CatalogUpdater, parse_args from deriva.core.ermrest_config import tag as chaise_tags import deriva.core.ermrest_model as em groups = { 'pbccon...
informatics-isi-edu/betacell-consortium
catalog-configs/pbcconsortium.isrd.isi.edu_1.py
pbcconsortium.isrd.isi.edu_1.py
py
6,612
python
en
code
2
github-code
50
25533080487
import re import time def text_del(): srcFiles = open('test.txt', 'r') begin_flag = False ip_flag = False llc_flag = False l = [] show_list = [] dst = "" src = "" protocol = "" for file_path in srcFiles: file_path = file_path.rstrip() if file_path == "Ethernet(": ...
egoistor/sniff
test.py
test.py
py
2,375
python
en
code
0
github-code
50
21830967871
from flask_wtf import FlaskForm from wtforms import HiddenField, DecimalField, SubmitField, SelectField, FloatField from wtforms.validators import DataRequired, NumberRange from wtforms.widgets.html5 import NumberInput from wtforms_html5 import AutoAttrMeta from app.constants import MINIMUM_CONSUMPTION, MAXIMUM_CONSUM...
GustaveCoste/110surautoroute
app/forms.py
forms.py
py
2,468
python
en
code
0
github-code
50
41390829547
import json import pickle import nmslib import requests import numpy as np questions_stored = r'D:\Archive\Voibot\qabot\data\question.pickle' answers_stored = r'D:\Archive\Voibot\qabot\data\answer.pickle' features_stored = r'D:\Archive\Voibot\qabot\data\feature.npy' index_stored = r'D:\Archive\Voibot\qabot\data\featu...
yaohsinyu/voibot
qabot/search.py
search.py
py
1,650
python
en
code
0
github-code
50
37632079064
class Solution: def moveZeroes(self, nums: List[int]) -> None: p,q=0,0 while q<len(nums): if nums[q]==0: q=q+1 else: nums[p],nums[q]=nums[q],nums[p] p=p+1 q=q+1
amanueldemirew/Competitive-Programming
0283-move-zeroes/0283-move-zeroes.py
0283-move-zeroes.py
py
280
python
en
code
0
github-code
50
9960952936
import logging from collections import Collection from math import isclose from multipledispatch import dispatch from bn.b_network import BNetwork from bn.values.value import Value from datastructs.assignment import Assignment from inference.approximate.sampling_algorithm import SamplingAlgorithm from inference.exact...
KAIST-AILab/PyOpenDial
test/common/inference_checks.py
inference_checks.py
py
7,930
python
en
code
9
github-code
50
42572707827
import math from typing import Tuple from PIL import Image def resize_crop(image: Image, size: Tuple[int, int]) -> Image: """Crop the image with a centered rectangle of the specified size""" img_format = image.format image = image.copy() old_size = image.size left = (old_size[0] - size[0]) / 2 ...
apockill/portrayt
portrayt/renderers/crop_utils.py
crop_utils.py
py
1,134
python
en
code
53
github-code
50
71449673754
#!/usr/bin/env python3 ''' FSMScorer - A class to assign scores to FSMs based on how well they classify strings through their output. Classes: FSMScorer - scores ''' import logging import automata class FSMScorer(object): '''A class to score FSMs based on their outputs against a reference set of s...
tonyzoltai/FSM-Evolution
FSMScorer.py
FSMScorer.py
py
4,639
python
en
code
0
github-code
50
38260145636
#!/usr/bin/env python import time import rospy import RPi.GPIO as GPIO from system_state.msg import WorkerState from remote_command.msg import DualshockInputs STATE_NAME_MAP= { 0: 'CHARGING/INACTIVE', 1: 'MANUAL CONTROL', 2: 'AUTONOMOUS CONTROL' } STATE_PINS = { 0: 22, ## Red 1: 18, ## Yellow 2: 17 ## Green ...
grodriguez78/amr_redux
src/system_state/src/worker_state_machine.py
worker_state_machine.py
py
2,374
python
en
code
0
github-code
50
28569533617
from typing import List # Solution class Solution: def containsDuplicate(self, nums: List[int]) -> bool: # Initialise an empty set hashset = set() for number in nums: # Duplicate found if number in hashset: return True # add the unique number to hashset else: hashset.add(n...
aakashmanjrekar11/leetcode
1. Array and Hashing/217. Contains Duplicate.py
217. Contains Duplicate.py
py
371
python
en
code
0
github-code
50
22539325683
#Course: CS2302 - Spring 2019 #Author: Solomon Davis #Lab Number: 4 #Instructor: Olac Fuentes #Last Modified: March 24, 2019 #Due Date: March 15, 2019 #Description: This code will use b-trees to carry out specific tasks. These #tasks include commputing the height of the tree,extracting items from a b-tree #into a sor...
Solomond10/CS2302
LAB4/Lab 4.py
Lab 4.py
py
10,519
python
en
code
0
github-code
50
21753251086
from bunch import Bunch import datetime import numpy as np model_params = {"alpha_default": 0.3, # default alpha for all items "alpha_min": 0.1, # minimum possible alpha "alpha_max": 0.5, # maximum possible alpha "de...
slavov-vili/ba_thesis
activation_code/act_alg_semi_pseudo_old.py
act_alg_semi_pseudo_old.py
py
22,650
python
en
code
0
github-code
50
5936441245
from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse,JsonResponse from django.db import connection from django.db import models from .models import Users from django.contrib import auth from django.utils.decorators import method_decorator from django.views.decorators.csrf import c...
Dongkw324/CodeDokDok_Baekend
User_Function/views.py
views.py
py
2,223
python
ko
code
0
github-code
50
4197431456
def solution(T): """ [73,74] [1, 0] at index i = 0 have to wait 1 day at index i = 1 is the end [73, 74, 75] [1, 1, 0] we could find the # of days but subtracting the index of the warmer day - previous colder day we could process one day by a time in a stack to keep track which has been looked up ye...
Prakort/competitive_programming
daily-temperatures.py
daily-temperatures.py
py
795
python
en
code
0
github-code
50
26563775466
from panpipelines.utils.util_functions import * from panpipelines.scripts.panscript import * import os import glob # TEST #from panpipelines.scripts import * #SCRIPT="fmriprep_panscript" #panscript=eval("{}.{}".format(SCRIPT,SCRIPT)) #labels_dict={"COMM": "ls"} #pancomm = panscript(labels_dict) #pancomm.run() class ...
MRIresearch/PANpipelines
src/panpipelines/scripts/fmriprep_panscript.py
fmriprep_panscript.py
py
1,772
python
en
code
0
github-code
50
38297049752
from __future__ import print_function import argparse import os from pprint import pprint import multiprocessing import numpy as np import torch import torch.optim as optim import torch.backends.cudnn as cudnn import torch.nn as nn cudnn.benchmark = True import datasets import util import packing def train(model...
BradMcDanel/column-combine
train.py
train.py
py
6,643
python
en
code
26
github-code
50
73677829594
from django.shortcuts import render from rest_framework import generics, status from django.views.decorators.csrf import csrf_exempt from rest_framework.views import APIView from rest_framework.response import Response #send custom response from view from .serializers import TeamSerializer, CreateTeamSerializer from...
ivanManzalez/FY3
teams/views.py
views.py
py
3,366
python
en
code
0
github-code
50
34884647599
class Solution: def backspaceCompare(self, s: str, t: str) -> bool: s_list = list(s) t_list = list(t) def f(str_list): stack = [] for item in str_list: if not stack and item == "#": continue else: ...
Dong98-code/leetcode
codes/Stack/844.比叫含退格的字符串.py
844.比叫含退格的字符串.py
py
680
python
en
code
0
github-code
50
22361452008
import discord from asyncpraw.models import Submission class Embeds: @staticmethod def post(submission: Submission) -> discord.Embed: embed = discord.Embed() embed.title = submission.title embed.set_author(name=submission.author.name, icon_url=submission.author.icon_img) embed....
AltF02/fwp-bot
src/embeds.py
embeds.py
py
475
python
en
code
0
github-code
50
20025439990
import datetime from enum import IntEnum from typing import List from pydantic import validator from .base import BaseScheduleObject from .lesson import Lesson __all__ = ['Day', 'Weekday'] class Weekday(IntEnum): monday = 0 tuesday = 1 wednesday = 2 thursday = 3 friday = 4 saturday = 5 ...
Bobronium/aiospbstu
aiospbstu/types/day.py
day.py
py
2,252
python
en
code
0
github-code
50
34733859527
class Solution(object): def duplicateZeros(self, arr): """ :type arr: List[int] :rtype: None Do not return anything, modify arr in-place instead. """ # Store old length oldLen = len(arr) i = 0 while i < oldLen : # Insert 0 into li...
nabbott98/LeetCode
duplicate-zeros/duplicate-zeros.py
duplicate-zeros.py
py
492
python
en
code
0
github-code
50
31069762113
#!/bin/python import math import os import random import re import sys ''' Given a set of distinct integers, print the size of a maximal subset of S where the sum of any 2 numbers in S' is not evenly divisible by K. For example, the array [19,10,12,10,24,25,22] and k=4. One of the arrays that can be created is [10,12...
haroldmei/GeneralProgramming
interview/nonDivisibleSubset.py
nonDivisibleSubset.py
py
932
python
en
code
2
github-code
50
7619208294
""" FludServer.py (c) 2003-2006 Alen Peacock. This program is distributed under the terms of the GNU General Public License (the GPL), version 3. flud server operations """ import threading, binascii, time, os, stat, httplib, gc, re, sys, logging, sets from twisted.web import server, resource, client from twisted.we...
alenpeacock/flud
flud/protocol/FludServer.py
FludServer.py
py
2,131
python
en
code
12
github-code
50
21542368532
from os import P_WAIT import openpyxl import random import docx from docx.enum.text import WD_PARAGRAPH_ALIGNMENT from docx.shared import Pt, RGBColor wb = openpyxl.load_workbook('工资统计.xlsx') sheet = wb['工作量汇总'] lst = [] for index, values in enumerate(sheet.rows, 1): t = list(map(lambda x: x.value, values)) l...
hurttttr/MyPythonCode
文件操作/2906-制作word表格.py
2906-制作word表格.py
py
1,057
python
en
code
3
github-code
50
26082749703
def get_loop_size(public_key: int) -> int: initial_subject_number = 7 divider = 20201227 value = 1 loop = 0 while value != public_key: value *= initial_subject_number value %= divider loop += 1 return loop def calculate_encryption_key(card_public_key: int, door_public_k...
tosoba/Grind
advent_of_code_2020/d25_encryption_key.py
d25_encryption_key.py
py
623
python
en
code
0
github-code
50
1812305371
import functools from typing import Tuple import chex import jax import jax.numpy as jnp from jumanji import specs from jumanji.env import Environment from jumanji.types import TimeStep, restart, termination, transition from matrax.types import Observation, State class MatrixGame(Environment[State]): """JAX imp...
instadeepai/matrax
matrax/env.py
env.py
py
6,417
python
en
code
5
github-code
50
17264620320
''' Created on 27 Dec 2016 @author: af ''' ''' Created on 22 Apr 2016 @author: af ''' import pdb import numpy as np import sys from os import path import scipy as sp import theano import theano.tensor as T import lasagne from lasagne.regularization import regularize_layer_params_weighted, l2, l1 from lasagne.regulari...
afshinrahimi/geographconv
mlp.py
mlp.py
py
18,612
python
en
code
67
github-code
50
34025219462
import sys import os import pytest sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) from cvxpy import installed_solvers from hysut.utils.defaults import ModelSettings def test_ModelSettings(): settings = ModelSettings() # wrong solver output = settings.validate_solver("d...
HySUT/hysut
tests/test_defaults.py
test_defaults.py
py
833
python
en
code
0
github-code
50
27386073504
from tkinter import * def submit(): print("It is " + str(scale.get()) + " degrees C.") window = Tk() #placed at top hotImage = PhotoImage(file = "GUI_Icon.png") #placeholder for fire image hotLabel = Label(image=hotImage) hotLabel.pack() scale = Scale(window, from_=100, #sets range for scale ...
18gwoo/Python-Practice
BroCode70_GUI_Scale.py
BroCode70_GUI_Scale.py
py
1,136
python
en
code
0
github-code
50
38189202195
import re from SymbolTable import SymbolTable class CodeWriter: CONVERT_KIND = { 'ARG': 'ARG', 'STATIC': 'STATIC', 'VAR': 'LOCAL', 'FIELD': 'THIS' } ARITHMETIC = { '+': 'ADD', '-': 'SUB', '=': 'EQ', '>': 'GT', '<': '...
abarat256/JACK_Compiler
CodeWriter.py
CodeWriter.py
py
14,451
python
en
code
0
github-code
50