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
4248917006
import os def removeComments(filename): savedFile = filename.replace('.txt', 'Copy.txt') os.rename(filename, savedFile) with open(filename, 'w') as new_file: with open(savedFile) as old_file: for line in old_file: if '#' not in line and line != '\n': ...
guilyx/rm-comments-cmakelists
lib/rm_comments.py
rm_comments.py
py
357
python
en
code
0
github-code
13
26870146605
from itertools import cycle def pan(s): if len(s)!=9: return False for d in "123456789": if not d in s: return False return True def cp(i,n): ps=[] for mp in range(1,n+1): ps.append(str(i*mp)) return "".join(ps) for i in range(1,999999): cps=map(cp,cycle([...
zydiig/PESolution
38.py
38.py
py
424
python
en
code
0
github-code
13
33621487085
from fastapi import APIRouter, Security from fastapi.security import APIKeyHeader from fastapi.responses import JSONResponse import requests from settings import DB_SERVER_URL from src.utils.base_utils import raise_exception from src.validation_models.user_model import UserCredentialsIn router = APIRouter() ...
iulianag/disertatie
business_logic/src/endpoints/authorization.py
authorization.py
py
1,608
python
en
code
0
github-code
13
74001434899
#!/usr/bin/python import sys import re from printer import Printer def GetComment(line): what = re.compile(".*//(.*)").match(line) if what != None and len(what.groups()) > 0: return what.groups()[0] else: return "" def Transform(filename, out): lines = open(filename).readline...
tiance7/CardDoc
sixcube/tools/packetc/src/windowIdTool.py
windowIdTool.py
py
1,858
python
en
code
0
github-code
13
4682706303
__struct_classes = {} from sydpy.types._type_base import TypeBase from sydpy import ConversionError from collections import OrderedDict from itertools import islice def Struct(*args): vals = [] names = [] for a in args: names.append(a[0]) vals.append(a[1]) # s_tuple = tuple(names)...
bogdanvuk/sydpy
sydpy/types/struct.py
struct.py
py
5,625
python
en
code
12
github-code
13
13102772244
""" Genome language: C(P),c : command, where C is a current state, P is a previous state (() if there is no condition), c is a condition on the number of connections Command language: ++X - grow an adjacent cell in X state --X - remove adjacent cell in X state +X - connect to the closest cell in X state -X - disconn...
olya-d/growing-graph
automata/genome.py
genome.py
py
2,515
python
en
code
0
github-code
13
13538875132
from django.test import TestCase from scoreboard.models import ScoreBoard class ScoreBoardTest(TestCase): """ Test module for Puppy model """ def setUp(self): ScoreBoard.objects.create(name='Johhny', score='100') ScoreBoard.objects.create(name='Bravo', score=75) def test_puppy_breed(self)...
emerengg/reaction-time-based-game
server/src/scoreboard/tests/test_models.py
test_models.py
py
543
python
en
code
0
github-code
13
39947161962
#!/usr/bin/env python3 import csv def parse_csv(data, has_header=False): """ Parses the CSV data into a list of dictionary objects Throws an exception if the CSV is badly formatted Arguments data -- a string containing the CSV data has_header -- parse the first row as a header or not """ ...
jtmpu/latedit
latedit/csv.py
csv.py
py
1,273
python
en
code
0
github-code
13
1514991995
with open("sinav_veri_seti.txt", "r") as f: liste = f.readlines() f.close() def change_label(label): if "#0#" in label: return "Olumsuz" elif "#1#" in label: return "Olumlu" else: return "Tarafsız" etiketler = [] gorusler = [] for k in liste: if ";; " not in k: ...
sandiklibilgisayarprogramlama/bilgisayarlaveriisleme-2023
hafta 13/duygu_siniflandirma.py
duygu_siniflandirma.py
py
566
python
en
code
0
github-code
13
5471601
import matplotlib.pyplot as plt import numpy as np from scipy.integrate import solve_ivp import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import sys sys.path.append('..') import neural_ode.NeuralODE import neural_ode.ODESolvers tf.keras.backend.set_floatx('float64') class Si...
IvanPles/Neural-ODE
neural_ode/Test_second_deriv.py
Test_second_deriv.py
py
1,596
python
en
code
2
github-code
13
9984085861
# -*- coding: utf-8 -*- ############################################### #created by : lxy #Time: 2018/12/3 14:09 #project: Face detect #company: #rversion: 0.1 #tool: python 2.7 #modified: #description face detect testing caffe model #################################################### import numpy as np def bbo...
jimeffry/ssh-tensorflow
src/utils/boxes_overlap.py
boxes_overlap.py
py
1,862
python
en
code
5
github-code
13
20974188269
import random import requests import time HOSTS = [ 'us-east', 'eu-north', 'ap-south', 'ap-south-alpine', ] VEHICLES = [ 'bike', 'scooter', 'car', ] if __name__ == "__main__": print(f"starting load generator") time.sleep(3) while True: host = HOSTS[random.randint(0, le...
grafana/pyroscope
examples/dotnet/rideshare/load-generator.py
load-generator.py
py
591
python
en
code
8,798
github-code
13
38391354543
import numpy as np import cv2 class ConcatenateImages: def __init__(self, imgpath1, imgpath2, imgpath3, imgpath4): self.img1 = cv2.imread(imgpath1) self.img2 = cv2.imread(imgpath2) self.img3 = cv2.imread(imgpath3) self.img4 = cv2.imread(imgpath4) def concatenate(self): ...
mharunturkmenoglu/ComputerVision
ExtendImage/concatenateImages.py
concatenateImages.py
py
515
python
en
code
0
github-code
13
6538031578
import socket import sys from config import * # Create a UDP socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: while True: message = raw_input() print('sending "{}"'.format(message)) sent = sock.sendto(message, (SERVER_ADDRESS, SERVER_PORT)) finally: print('closing so...
IzzyBrand/ledvis
old/led_test_client.py
led_test_client.py
py
343
python
en
code
40
github-code
13
2290666842
#!/usr/bin/python #!/usr/bin/python -tt # -*- coding: utf-8 -*- # (c) 2012, Red Hat, Inc # Based on yum module written by Seth Vidal <skvidal at fedoraproject.org> # (c) 2014, Epic Games, Inc. # Written by Lester Claudio <claudiol at redhat.com> # # Ansible is free software: you can redistribute it and/or modify # it ...
claudiol/buildah-ansible
library/buildah_commit.py
buildah_commit.py
py
5,597
python
en
code
3
github-code
13
17050584054
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class CreditPayChargePricingVO(object): def __init__(self): self._actual_charge = None self._actual_charge_rate = None self._charge_code = None self._charge_name = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/CreditPayChargePricingVO.py
CreditPayChargePricingVO.py
py
3,760
python
en
code
241
github-code
13
41408536548
def pegarmax(lista): tei = max(lista) deish = lista.index(tei) return deish zenti = [] while True: try: cadeia = [] entrada= input() entrada = [int(x) for x in entrada.split(" ")] entrada1= input() if entrada1 == "": ...
BrunoVirgu/LProg2017.2
LAB_PROG/src/quebrando.py
quebrando.py
py
1,158
python
pt
code
0
github-code
13
36550054919
from rest_framework import serializers from .models import Adv, PrivatPaymentModel, YandexPaymentModel from django.contrib.auth.models import User from rest_framework_simplejwt.serializers import TokenObtainPairSerializer class AdvSerializer(serializers.HyperlinkedModelSerializer): owner = serializers.ReadOnlyFie...
alpine-cat/back
getmoney/getmoney/serializers.py
serializers.py
py
1,885
python
en
code
0
github-code
13
3406729119
"""Experiment definition abstraction class.""" import contextlib import dateutil.parser from jacquard.utils import check_keys from jacquard.buckets import NUM_BUCKETS from jacquard.constraints import Constraints, ConstraintContext class Experiment(object): """ The definition of an experiment. This is ...
prophile/jacquard
jacquard/experiments/experiment.py
experiment.py
py
6,722
python
en
code
7
github-code
13
40837608259
import discord import logging from discord.ext import commands import random # Log SetUp logging.basicConfig(level=logging.INFO, filename='bot.log', filemode="w") def filterOnlyOnline(member): return member.status != discord.Status.offline and not member.bot class Features(commands.Cog): def __init__(self, ...
Viri0x/DiscordBot
cogs/features.py
features.py
py
3,097
python
en
code
0
github-code
13
38426087823
from __future__ import annotations import itertools from typing import Any, Iterable, Iterator, MutableMapping import toml from packaging.utils import NormalizedName from packaging.utils import canonicalize_name as canonicalize_project_name from pants.backend.python.macros.common_fields import ( ModuleMappingFiel...
bryanwweber/pants-dependency-tracking
pants-plugins/pep621/pep621_requirements.py
pep621_requirements.py
py
7,186
python
en
code
0
github-code
13
20464043218
# 1929 import sys # 소수 리스트 max_n = 1000001 prime = [True] * max_n end = int(max_n ** 0.5) for i in range(2, end + 1): if prime[i]: for j in range(i+i, max_n, i): prime[j] = False # 입력 m, n = map(int, sys.stdin.readline().split()) m = 2 if m == 1 else m prime_list = [i for i in range(m, n+1) ...
mhseo10/Baekjoon-Algorithm
basic/math/math_1929.py
math_1929.py
py
382
python
ko
code
0
github-code
13
74048168979
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'first_project.settings') import django django.setup() ## FAKE POP SCRIPT import random from first_app.models import AccessRecord, Webpage, Topic from faker import Faker fakegen = Faker() topics=['Search', 'Social', 'Marketplace', 'News', 'Games'] def add_to...
ChristinaGaitan/django_first_project
populate_first_app.py
populate_first_app.py
py
1,193
python
en
code
0
github-code
13
73730926096
import subprocess import os # Nome do pacote do aplicativo que estamos controlando eat_venture_package = 'com.hwqgrhhjfd.idlefastfood' # Função para iniciar o aplicativo def open_app(): try: # Abrir o aplicativo usando o comando adb # cmd: adb shell monkey -p com.hwqgrhhjfd.idlefastfood -c android...
JoaoBoll/eatventure-bot
adb_utils/adb_utils.py
adb_utils.py
py
5,539
python
pt
code
0
github-code
13
21092793163
from setup.graph import Graph import random from math import sqrt import pandas as pd import numpy as np from sklearn.cluster import spectral_clustering from setup.load_streets import Map import os data_path = os.path.join(os.path.abspath('../..'), 'Data') def cluster_graph(street_map, number_clusters): A = np.ar...
thomaspendock/Analyze-Boston
src/setup/clustering.py
clustering.py
py
3,143
python
en
code
1
github-code
13
72289565459
try: import polyinterface except ImportError: import pgc_interface as polyinterface import requests import json import node_funcs LOGGER = polyinterface.LOGGER @node_funcs.add_functions_as_methods(node_funcs.functions) class SensorNode(polyinterface.Node): # class variables id = 'aqi' hint = [0,0...
bpaauwe/udi-purpleair-poly
nodes/sensor.py
sensor.py
py
7,199
python
en
code
0
github-code
13
32763231633
import os import sys os.environ['SPARK_HOME'] = "/usr/hdp/3.0.1.0-187/spark2" os.environ['HIVE_HOME'] = "/usr/hdp/3.0.1.0-187/hive" os.environ["HADOOP_USER_NAME"] = "spark" os.environ['PYSPARK_SUBMIT_ARGS'] = '--master yarn --deploy-mode client ' \ '--num-executors 11 --executor-m...
shhan1987/redeyesofangel
pySpark_1.py
pySpark_1.py
py
692
python
en
code
0
github-code
13
5847705059
#!/usr/bin/env python3 """ A derivative of the requests module, which handles caching and allows a cache-only mode for testing (because Python makes it so difficult to mock requests). Overrides get, post, and head all of which also take an additional, optional, cachetime (secs). Also adds ftp_get(server, dir, fil...
akkana/billtracker
billtracker/bills/billrequests.py
billrequests.py
py
14,794
python
en
code
5
github-code
13
3100795310
# Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html import os import sys from collections import defaultdict from itemadapter import ItemAdapter # useful for handling different item types with a sing...
ch3rub1m/game_ratings
game_ratings/pipelines.py
pipelines.py
py
1,017
python
en
code
0
github-code
13
5036699642
# Famous Quote Program # Author: hifza zafar # Date: 10november2023 # Store the famous person's name in a variable famous_person = "Albert Einstein" # Store the quote in a variable quote = "The only real valuable thing is intuition." # Compose the message message = f'{famous_person} once said, "{quote}"' ...
hif-zafar/piaic_class1_assignment
question10.py
question10.py
py
651
python
en
code
0
github-code
13
26836898012
import turtle import random def screenClick(x, y): r=random.random() g=random.random() b=random.random() R=random.random() G=random.random() B=random.random() #선과 거북이 색 랜덤 angle = random.randrange(0, 360) #각도 0~360 사이 랜덤 t_size = random.randrange(2,8) #크기 2~8사이 랜덤 turtle.left(...
inte168/OpenProject1
2weak/ch02-1.py
ch02-1.py
py
896
python
ko
code
0
github-code
13
15806378353
from __future__ import division import os import rospkg from python_qt_binding import loadUi from python_qt_binding.QtCore import Qt, QTimer, qWarning, Slot from python_qt_binding.QtWidgets import QAction, QMenu, QWidget import rospy from rostopic import get_topic_class from rqt_py_common.topic_helpers import find_sl...
jincheng-ai/ros-melodic-python3-opencv4
xacro/rqt_pose_view/src/rqt_pose_view/pose_view_widget.py
pose_view_widget.py
py
12,345
python
en
code
5
github-code
13
36134062566
import requests import os import http.cookiejar as cookielib import re session = requests.session() session.cookies = cookielib.LWPCookieJar(filename='cookies.txt') try: session.cookies.load(ignore_discard = True) print('Load Cookie') except: print("Cannot load Cookie") agent = 'Mozilla/5.0 (Macintosh...
codescracker/web_crawler
ArticleSpider/utils/zhihu_login_requests.py
zhihu_login_requests.py
py
2,657
python
en
code
0
github-code
13
7985163004
import contextlib import sys from enum import IntEnum, IntFlag import bluetooth import app_args from config import set_default_bt, get_default_bt from label_rasterizer import encode_png, rasterize STATUS_OFFSET_ERROR_INFORMATION_1 = 8 STATUS_OFFSET_ERROR_INFORMATION_2 = 9 STATUS_OFFSET_MEDIA_WIDTH = 10 STATUS_OFFSET...
SkoZombie/pt-p710bt-label-maker
label_maker.py
label_maker.py
py
11,344
python
en
code
null
github-code
13
31346198814
import random import math class Graph(object): def __init__(self, points, cost_matrix, rank): """ :param points: list of tuples for the coordinates of points :param cost_matrix: matrix of distance among locations, 2d array :param rank: number of locations, int """ ...
mingzhang1998/Travel_Salesman
ACO.py
ACO.py
py
5,487
python
en
code
0
github-code
13
34346033012
from aioredis_cluster.speedup.ensure_bytes import encode_command as cy_encode_command from aioredis_cluster.speedup.ensure_bytes import ( iter_ensure_bytes as cy_iter_ensure_bytes, ) from aioredis_cluster.util import py_encode_command, py_iter_ensure_bytes from . import run_bench ds = [ ( b"XADD", ...
DriverX/aioredis-cluster
benchmarks/cythonize/ensure_bytes.py
ensure_bytes.py
py
1,847
python
en
code
24
github-code
13
32554221516
from unicodedata import category from django.shortcuts import render from .models import Location, Image, Category # Homepage view function def index(request): all_images = Image.objects.all() all_locations = Location.objects.all() all_categories = Category.objects.all() homepage ={"all_images": all_i...
CosBett/Mi-Galeria
photos/views.py
views.py
py
1,997
python
en
code
0
github-code
13
24629104915
#!/usr/bin/env python import os import pandas as pd import pysam import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns from looper.models import Project # Set settings pd.set_option("date_dayfirst", True) sns.set(context="paper", style="white", palette="pastel", color_codes=True)...
epigen/crop-seq
src/assign_gRNA_cells.py
assign_gRNA_cells.py
py
19,998
python
en
code
25
github-code
13
8142501106
"""" This file contains functions used in of preprocess downloaded crypto close data """ #python packages from datetime import datetime import pandas as pd import yfinance as yf import pandas as pd '''Function:datecheck this function is used to check to make sure that the last date is not tomorrows date. Yahoo F...
MattChinchilla/DATA_SCIENCE
TimeSeries/prophet_funcs_v1.py
prophet_funcs_v1.py
py
1,325
python
en
code
0
github-code
13
44692179396
#_author: #date: import socket import subprocess # 创建socket对象 sk=socket.socket() # 为socket对象提供ip地址和端口,然后绑定 adress=("127.0.0.1",8000) sk.bind(adress) # 监听设置端口 等待客户端的请求 sk.listen(2) while True: print("waiting.....") conn, addr = sk.accept() print(addr) while True: try: data=conn.recv(1024...
liangliang115715/pythonStudyNote
studyNote/python-2/cmd_serve.py
cmd_serve.py
py
778
python
en
code
0
github-code
13
17038567824
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayCommerceTransportIntelligentizeDataSyncModel(object): def __init__(self): self._data = None self._data_type = None self._request_id = None self._sync_type = ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayCommerceTransportIntelligentizeDataSyncModel.py
AlipayCommerceTransportIntelligentizeDataSyncModel.py
py
2,334
python
en
code
241
github-code
13
8863765236
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 18 19:46:04 2020 @author: josegrau """ #xor classification problem with neural network import numpy as np import matplotlib.pyplot as plt #no usamos softmax al ser clasificación binaria #usamos en ambas capas la función sigmoide como activación ...
JoseGrau/Curso_Deep_Learning_Python
CursoDeepLearningPython/xor.py
xor.py
py
2,254
python
en
code
0
github-code
13
16027326694
def print_subset(bit, arr, n): total = 0 for i in range(n): if bit[i]: total += arr[i] print(bit, total) arr = [1, 2, 3, 4] bit = [0, 0, 0, 0] for i in range(2): bit[0] = i for j in range(2): bit[1] = j for k in range(2): bit[2] = k for l...
joonann/ProblemSolving
python/202308/03/test/test.py
test.py
py
926
python
ko
code
0
github-code
13
29863016307
from intelmq.lib.bot import OutputBot from intelmq.lib.test import BotTestCase from unittest import TestCase from json import dumps RAW = {"__type": "Event", "raw": "Cg=="} DICT = {"foo": "bar", "foobar": 1} OUTPUT_DICT = {"__type": "Event", "output": dumps(DICT, sort_keys=True)} STRING = "foobar!" OUTPUT_STRING = {"...
certtools/intelmq
intelmq/tests/lib/test_bot_output.py
test_bot_output.py
py
3,605
python
en
code
856
github-code
13
21042170146
from django import forms from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render, redirect from django.utils.safestring import mark_safe from openpyxl import load_workbook from pan...
0passion0/project_html1.0
app/views.py
views.py
py
6,430
python
en
code
0
github-code
13
17795197483
import requests #pasa los datos del archivo txt a una lista bidimencional def read_data(): dts=[] with open("files/Clientes.txt") as data: for lines in data: character=lines.replace("\n","") #borra el \n del salto de linea dts.append(character.split(", ")) #los datos est...
iamoscarb/python_java
files.py
files.py
py
3,074
python
en
code
0
github-code
13
17093739639
import logging import grpc import scowl_pb2 import scowl_pb2_grpc def getGeneratorID(stub): """Request a 32-bit id. Today, this is a 32-bit hash given an input of an IPv4 address. For the next few decades the number of generators will be relatively low (e.g., hundres to low-thousands), so 32-...
jamesryancoleman/scowl
bootstrap_client.py
bootstrap_client.py
py
1,926
python
en
code
0
github-code
13
43575393614
import pandas as pd from spotify.spotify_client import SpotifyClient import time import numpy as np tracks_df = pd.read_csv("../output/spotify_artists_albums_tracks_output_full.csv") print(f'{len(tracks_df)} tracks before deduplication') tracks_df = tracks_df.drop_duplicates(subset=['track uri']) print(f'{len(tracks_d...
Haydart/MusicRecommender
spotify/extract_features_pipeline.py
extract_features_pipeline.py
py
2,933
python
en
code
0
github-code
13
24101544716
import RPi.GPIO as GPIO import matplotlib.pyplot as plt import time dac = [26, 19, 13, 6, 5, 11, 9, 10] leds = [21, 20, 16, 12, 7, 8, 25, 24] value_list = [] def dec2bin(dec): return [int(bit) for bit in bin(dec)[2:].zfill(8)] def dec2leds(dec): GPIO.output(leds,dec2bin(dec)) def adc(): ans = 0 for ...
MrDoodler007/volkov-repo
Zameri/Zamerii.py
Zamerii.py
py
2,026
python
en
code
0
github-code
13
28989683683
""" 线程Event 同步互斥 """ from threading import Event from threading import Thread s = None # 用于通信 e = Event() # 事件对象 def fun01(): print("杨子荣前来拜山头") global s s = '天王盖地虎' e.set() # 操作完成共享 e 设置 # 创建线程对象 t = Thread(target=fun01) t.start() print("说对口令就是自己人") e.wait() # 阻塞等待 if s == '天王盖地虎': print(...
SmileAnage/Thread
thread_event.py
thread_event.py
py
524
python
en
code
0
github-code
13
34738643999
from __future__ import print_function import sys from ortools.linear_solver import pywraplp from collections import namedtuple import math import numpy as np from timeit import default_timer as timer def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) Point = namedtuple("Point", ['x', 'y']) Fac...
s0mth1ng/Discrete_Optimization
week6/facility/mip.py
mip.py
py
8,368
python
en
code
0
github-code
13
43061162451
import matplotlib.pyplot as plt import torch import torch.nn import torchvision import numpy as np __all__ = ['show_prob','show_image'] def show_prob(y_tup,y_true): """ :param y_tup: we want to get numpy tuple :param y_true: we want to get numpy array instead of tensor :return: """ num_comp =...
psr6275/adv_kl
utils/visualize.py
visualize.py
py
1,324
python
en
code
1
github-code
13
41490266819
#!/usr/bin/env python # coding: utf-8 # Explain the assumptions required to use ANOVA and provide examples of violations that could impact # the validity of the results. # # ANOVA (Analysis of Variance) is a statistical technique used to test for differences in means between two or more groups. ANOVA is based on sev...
Rach2312/Python
13 Mar_AssQ.py
13 Mar_AssQ.py
py
14,924
python
en
code
0
github-code
13
65862183
import numpy as np import scipy as sp from scipy.optimize import leastsq import matplotlib.pyplot as plt def real_fun(x): return np.sin(2*np.pi*x) def fit_fun(p,x): f = np.poly1d(p) return f(x) def res_fun(p,x,y_real): ret = fit_fun(p, x)-y_real return ret def res_fun_addregular(p,x,y_real): r...
HitAgain/Machine-Learning-practice
Least_Suqare_Method/Lsq_no_regular.py
Lsq_no_regular.py
py
1,466
python
en
code
2
github-code
13
13335225805
from fastapi.testclient import TestClient from main import app # test to check the correct functioning of the /ping route def test_ping(): with TestClient(app) as client: response = client.get("/ping") # asserting the correct response is received assert response.status_code == 200 a...
swapnam77/PGCSEDS-IIITH-hackathon-3
test_app.py
test_app.py
py
362
python
en
code
0
github-code
13
72839134418
from .model_pomm import PommNet from .model_generic import CNNBase, MLPBase from .policy import Policy def create_policy(obs_space, nn_kwargs={}, train=True): obs_shape = obs_space.shape nn = PommNet(obs_shape=obs_shape, **nn_kwargs) if train: nn.train() else: nn.eval() policy = ...
JacobPjetursson/Pommerman_Project
src/models/factory.py
factory.py
py
350
python
en
code
1
github-code
13
27733012523
from vsc.utils import fancylogger from easybuild.tools.build_log import EasyBuildError _log = fancylogger.getLogger('easyconfig.default', fname=False) # we use a tuple here so we can sort them based on the numbers ALL_CATEGORIES = { 'HIDDEN': (-1, 'hidden'), 'MANDATORY': (0, 'mandatory'), 'CUSTOM': (1,...
ULHPC/modules
easybuild/easybuild-framework/easybuild/framework/easyconfig/default.py
default.py
py
9,225
python
en
code
2
github-code
13
28568754981
import sqlalchemy from pibble.database.orm import ( ORMObjectBase, ORMBuilder, ORMEncryptedStringType, ORMVariadicType, ORMEncryptedVariadicType, ORM, ) from pibble.util.log import DebugUnifiedLoggingContext from pibble.util.helpers import Assertion, expect_exception from pibble.api.exceptions ...
painebenjamin/pibble
test/2_orm.py
2_orm.py
py
7,027
python
en
code
1
github-code
13
1732091140
""" Genius Thin wrapper around the Genius API """ from __future__ import print_function from functools import wraps import requests def textformat(func): "Add text_format value to kwargs if not supplied" @wraps(func) def inner(*args, **kwargs): "Add text_format to kwargs" try: ...
emilkloeden/py-genius
py_genius/py_genius.py
py_genius.py
py
5,449
python
en
code
1
github-code
13
72775411537
from tgtg import TgtgClient from json import load, dump import requests import schedule import time import os # For remote deployment, the credentials are stored as environment variables in Heroku # Try to load the credentials remotely first. If this false, look for a local file # Try to first load credentials from en...
AukiJuanDiaz/TGTG_Watchbot
watch_script.py
watch_script.py
py
8,171
python
en
code
6
github-code
13
47725754174
import torch import soundfile as sf import torch.nn as nn import torch.nn.functional as F from peft import LoraConfig, TaskType, get_peft_model from transformers import ( WhisperFeatureExtractor, WhisperModel, LlamaForCausalLM, LlamaTokenizer ) import librosa from beats.BEATs import BEATsConfig, BEATs f...
bytedance/SALMONN
model.py
model.py
py
9,164
python
en
code
623
github-code
13
26412983707
'''Valid Hexadecimal Representation of Number''' s=input() i=0 for i in range(len(s)): if (s[i]<'0' or s[i]>'9') and (s[i]<'A' or s[i]>'F'): print("no") print("yes")
PREMSAI2K1/code1
hexadecimal.py
hexadecimal.py
py
222
python
en
code
0
github-code
13
40963002804
from tkinter import CENTER from turtle import Turtle ALIGNMENT = 'center' FONT = ('Courier New', 18, 'normal') class Scoreboard(Turtle): def __init__(self) -> None: super().__init__() self.current_score = 0 self.clear() self.hideturtle() self.penup() self.color('whi...
jjbondoc/learning-python
hundred-days-of-code/day_020_snake/scoreboard.py
scoreboard.py
py
729
python
en
code
0
github-code
13
38036774878
def getText(node): s = '' for n in node.childNodes: if n.nodeType == node.TEXT_NODE: s += n.data return s def getSingleNodeText(node, tag): nodes = node.getElementsByTagName(tag) snode = nodes[0] return getText(snode)
rushioda/PIXELVALID_athena
athena/Tools/RunTimeTester/testsuite/src/parseHelpers.py
parseHelpers.py
py
290
python
en
code
1
github-code
13
42304085971
# -*- coding: utf-8 -*- """ Created on Sun Mar 12 21:59:20 2017 @author: Mateusz """ def variable(i, j): '''Funkcja tworzaca zmienna znakowa o zadanych subskryptach i, j.''' result = "x" result += str(i) result += "." result += str(j) return result def hetmani(n): '''Metaprogram tworza...
RioJack01/-optymalizacja-
lab2/hetmani.py
hetmani.py
py
2,597
python
en
code
0
github-code
13
22151854134
import copy import torch import torch.nn as nn from .layers import SublayerWrapper, PositionalEncoding, MultiHeadAttention, FeedForwardLayer from ..datasets.utils import Vocab class TransformerDecoderLayer(nn.Module): def __init__(self, dim, self_attn, src_attn, ffn, dropout): super().__init__() ...
enhuiz/transformer-pytorch
torchnmt/networks/decoders.py
decoders.py
py
2,052
python
en
code
1
github-code
13
86458979000
#%% # langugae list, character dictionary set and other helper functions LanguageList = [ 'HEBREW', 'ARABIC', 'PORTUGUESE', 'ITALIAN', 'FRENCH', 'SPANISH', 'GERMAN', 'ENGLISH', 'RUSSIAN', 'FINNISH', 'VIETNAMESE', 'KOREAN', 'CHINESE', 'JAPANESE' ] g1 = ['HEBREW','...
wuqi0704/MasterThesis_Tokenization
bilstm_crf.py
bilstm_crf.py
py
11,910
python
en
code
0
github-code
13
60312629
import logging import os from treescript.gecko import mercurial as vcs from treescript.gecko.android_l10n import android_l10n_import, android_l10n_sync from treescript.gecko.l10n import l10n_bump from treescript.gecko.merges import do_merge from treescript.gecko.versionmanip import bump_version from treescript.excepti...
mozilla-releng/scriptworker-scripts
treescript/src/treescript/gecko/__init__.py
__init__.py
py
3,464
python
en
code
13
github-code
13
31625595769
""" I want to see what the distance between the ends of the peptide are for a bunch of pMHC complexes. I want to know if the ends should be treated as fixed. Given: A list of PDB entries, presumably pMHC complexes. I assume the smallest chain in each is the peptide. Print distance between first and last alpha atom of...
mrForce/honorsThesis
measureDistance.py
measureDistance.py
py
1,663
python
en
code
0
github-code
13
38584009841
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import torch import torchvision.transforms as transforms import torchvision.datasets as datasets import torchvision.models as models import torch.nn as nn import torch.optim as optim import numpy as np from PIL import Image ...
JonathanMairena/Otoscope-Automation-and-Enhancement
classifier.py
classifier.py
py
4,153
python
en
code
0
github-code
13
29827290315
from numpy import asarray def add(A, B): n = len(A) result = [[0 for i in range(0, n)] for j in range(0, n)] for i in range(0, n): for j in range(0, n): result[i][j] = A[i][j] + B[i][j] return result def subtract(A, B): n = len(A) result = [[0 for i in range(0, n)] for j ...
VaishakVellore/Python-Simple-Examples
Strassen.py
Strassen.py
py
3,555
python
en
code
0
github-code
13
33697568262
import logging import os import time import configparser import sqlalchemy from sqlalchemy import INT, TIMESTAMP, Boolean, Column, String, Table, func from sqlalchemy.ext.compiler import compiles from sqlalchemy.schema import MetaData from sqlalchemy.sql.expression import delete, insert, text, update logger = logging...
payt0nc/news_crawler
HK01/HK01/database.py
database.py
py
3,054
python
en
code
0
github-code
13
6609553409
import Parser from os import listdir import time import re import json class DocumentProcessing: def __init__(self, directory_path, indexfile): # directory containint files, files # containing many documents self.directory_path = directory_path # store dict, posting_list as ...
Dwijesh522/Information_Retrieval_Assns
assn1/DocumentProcessing.py
DocumentProcessing.py
py
4,006
python
en
code
0
github-code
13
944330105
#!/usr/bin/env python # coding: utf-8 # In[ ]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #get_ipython().run_line_magic('matplotlib', 'inline') import streamlit as st from collections import defaultdict # ### Check out the Data # https://www.youtube.com/watch?v=JwS...
benadaba/LR
LinearRegressionHousingPrediction.py
LinearRegressionHousingPrediction.py
py
6,886
python
en
code
0
github-code
13
31564013684
# File with a collection of functions from larda import numpy as np import matplotlib import matplotlib.pyplot as plt from scipy import stats import datetime from copy import copy def test_function(file): print(file) def argnearest(array, value): """find the index of the nearest value in a sorte...
ti-vo/calibrate_Wband
function_library.py
function_library.py
py
13,311
python
en
code
0
github-code
13
8868690619
# -*- coding: utf-8 -*- """ Created on Sun Dec 6 02:07:37 2020 @author: apmle """ '''This is a code to calculated the weighted average of grades of a student ''' grades=[] weight_list=[] product=[] name=input("What is the student name?\n") i=1 while True: grade=float(input(f"What is the stud...
FabioRochaPoeta/Python-v1-Ana
Weighted average of grades.py
Weighted average of grades.py
py
712
python
en
code
1
github-code
13
38013008730
import os class Color: # ANSI color codes BLACK = "\033[30m" RED = "\033[31m" GREEN = "\033[32m" YELLOW = "\033[33m" BLUE = "\033[34m" MAGENTA = "\033[35m" CYAN = "\033[36m" WHITE = "\033[37m" RESET = "\033[0m" NAMES = { "black": BLACK, "red": RED, ...
AbdulWahab321/HyperDS
examples/__init__.py
__init__.py
py
1,230
python
en
code
2
github-code
13
42675693334
import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.svm import SVR from sklearn.metrics import roc_curve from sklearn.ensemble import RandomForestRegressor import lightgbm as lgb import xgboost as xgb import numpy as np def extract_base_feat(): user_info_train = pd.read_csv('../d...
squirrelmaster/rong360-8
src/base/extract_base.py
extract_base.py
py
5,230
python
en
code
0
github-code
13
3647024217
#!/usr/bin/env python # encoding: utf-8 """ ============================================== objectName: InsterAutoTest_w fileName: log_pane Author: Hang Date: 2020/4/13/013 description: ============================================== """ import sys from time import sleep from...
HangAndy/InsterAutoTest_w
log_pane.py
log_pane.py
py
1,368
python
en
code
0
github-code
13
37000097300
from flask import redirect, render_template, request, flash, url_for, abort, jsonify from . import bp from belka.models import db, Api, Field, Data @bp.get('/<api_name>') def items(api_name): """ ?search.{field} ?page ?pagesize """ q = db.select(Api).filter_by(active=True, name=api_name) ...
uisky/belka
belka/api/views.py
views.py
py
2,156
python
en
code
0
github-code
13
21794102963
class Calculator: def __init__(self, num): self.num = num self.buffer = [] def plus(self, value): self.buffer.append( ('plus', value) ) return self def minus(self, value): self.buffer.append( ('minus', value) ) return...
lokosuns/working_list
test.py
test.py
py
590
python
en
code
0
github-code
13
327661051
from pathlib import Path from filesystem import FileSystem if __name__ == "__main__": terminal_text = Path("input.txt").read_text() fs = FileSystem(terminal_text) free_space_required = 30000000 space_to_free = free_space_required - fs.free_space # Find candidate directories to delete deleti...
grey-area/advent-of-code-2022-copilot
day07/part2.py
part2.py
py
516
python
en
code
1
github-code
13
12740620233
from torch import nn from torchvision.models import ResNet from torchvision.models.resnet import BasicBlock import torch.utils.model_zoo as model_zoo import torch model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch.org/models/resnet34-3...
AlbertoCastelo/bayesian-dl-medical-diagnosis
deep_gp/models/resnet18.py
resnet18.py
py
2,415
python
en
code
0
github-code
13
6773161788
#!/home/dh_nfjxcr/opt/python-3.8.2/bin/python3 import sys, os #INTERP = os.path.join(os.environ['HOME'], 'opt', 'python-3.8.2', 'bin', 'python3') INTERP = os.path.join(os.environ['HOME'], 'artishan.io', 'venv', 'bin', 'python3') if sys.executable != INTERP: print("Adding Path") os.execl(INTERP, INTERP,...
jordanbene/artishan
passenger_wsgi.py
passenger_wsgi.py
py
802
python
en
code
0
github-code
13
25499341242
email_one = open("email_one.txt", "r").read() email_two = open("email_two.txt", "r").read() email_three = open("email_three.txt", "r").read() email_four = open("email_four.txt", "r").read() proprietary_terms = ["Helena", "she", "personality matrix", "sense of self", "self-preservation", "learning algorithm", "her", "h...
randy-python/Censor_Dispenser
censor_dispenser_final.py
censor_dispenser_final.py
py
5,666
python
en
code
0
github-code
13
34799559042
import os import glob import cv2 import matplotlib.pyplot as plt # images_path = '/home/zx/博士VOC/train/' num = 0 list = os.listdir(images_path) #改 dir = 'img1' namelist = [] def text_save(content,filename,mode='a'): # Try to save a list variable in txt file. file = open(filename, mode) for i in range(len(c...
Xiehuaiqi/python_script
gt2xml/change_name.py
change_name.py
py
1,240
python
en
code
0
github-code
13
24268082516
import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import pydicom from PIL import Image #load image from disk and convert to array def image2array(full_path,shape=(224,224,3)): h,w,d=shape grayscale=d==1 # raise Exception("Stopped for no reason") if type(full_path)==bytes: f...
pmwaniki/perch-analysis
data/preprocess_image.py
preprocess_image.py
py
5,999
python
en
code
0
github-code
13
18629334203
from parameters import * from schemes import * import numpy as np import matplotlib.pyplot as plt def ensemble(Tmid, hmid, dT, dh, mu0, n_cycles=5,f_ann=0.,f_ran=0.,epsilon=0., mu_ann=0.): """ Perturbs T and h at start of each forecast in increments of dT and dh around Tmid and hmid""" T = np.arange(Tmid-2*dT,...
lm2612/mtmw14
project1/ensemble.py
ensemble.py
py
1,191
python
en
code
0
github-code
13
70930412178
from odoo import models, fields, api class StockPicking(models.Model): _inherit = 'stock.picking' def add_qty_done_by_sale_line(self, sale_order_line_id, qty_done): self.ensure_one() found = False for move in self.move_ids_without_package: if move.sale_line_id.id == sale...
erickabrego/piedica_pruebas_nov
mrp_operations_qrcode/models/.ipynb_checkpoints/stock_picking-checkpoint.py
stock_picking-checkpoint.py
py
899
python
en
code
0
github-code
13
23988876649
import numpy as np import cv2 as cv import os # Lee imagen img = cv.imread(os.path.dirname(__file__) + '\Star.jpg') # Transforma a escala de grises imgGris = cv.cvtColor(img, cv.COLOR_BGR2GRAY) # Especifica valor de umbral umbral = 127 # Transforma a imagen binaria ret, imgBin = cv.threshold(imgGris,umbral,255,0) ...
Atrabilis/UACH
Vision artificial/Tarea 3/Codigo de ayuda/Tarea 3 P6.py
Tarea 3 P6.py
py
708
python
es
code
1
github-code
13
30133458149
import csv from slugify import slugify from core.models import CSV, Tag TAG_HEADER = ['title', 'slug'] def process_csv_tag_file(instance_id): instance = CSV.objects.get(id=instance_id) reader = csv.DictReader(instance.file.read().decode('utf-8').splitlines()) header_ = reader.fieldnames if TAG_HE...
guilehm/expense-control-system
utils/tag_importer.py
tag_importer.py
py
744
python
en
code
1
github-code
13
9341632972
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from sklearn.datasets import load_iris, load_wine, fetch_california_housing import zipfile import os import pandas as pd import numpy as np import wget DATASETS = ['iris', 'wine', 'california', 'parkinsons', \ 'climate_model_crashes', 'concrete_c...
SamsungSAILMontreal/ForestDiffusion
data_loaders.py
data_loaders.py
py
21,003
python
en
code
41
github-code
13
70261454739
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 5 10:56:13 2023 @author: philipp """ import streamlit as st import numpy as np import pandas as pd import matplotlib.pyplot as plt import math from scipy import stats import plotly.express as px import datetime as dt from datetime import datet...
philwenkch/stock_analysis_V1
stock_analysis_main_V2.py
stock_analysis_main_V2.py
py
30,241
python
en
code
0
github-code
13
17675629576
import re import numpy as np import pandas as pd import support from sklearn.model_selection import KFold, cross_validate from sklearn.svm import SVC, SVR from sklearn.gaussian_process import GaussianProcessClassifier, GaussianProcessRegressor from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor from...
sigu1011/ensemble_learning
baseline.py
baseline.py
py
4,972
python
en
code
0
github-code
13
72396573779
from django.urls import path from . import views urlpatterns = [ path('', views.index), path('inquiries', views.inquiries, name="inquiries"), path('responses', views.responses, name="responses"), path('applications', views.applications, name="applications"), path('login', views.loginPage, name="login"), pa...
DeanNandi/Agcrm
crmpage/urls.py
urls.py
py
426
python
en
code
0
github-code
13
70351295378
import operator from functools import reduce def deep_get(path, obj): try: return reduce(operator.getitem, path, obj) except: return None def apply_projection(projection, obj): if isinstance(projection, Mapper): return projection.apply(obj) elif isinstance(projection, list): ...
J7DpeBK0Wt/backend
mapper.py
mapper.py
py
2,238
python
en
code
0
github-code
13
711109795
n = int(input()) l1 = list(map(int,input().split())) ma = pow(10,7) ind1= [0]*(ma) ind2 = [0]*(ma) temp=0 for i in range(n): r = sum(l1) l = 0 for j in range(i,n): l+= l1[j] r = r - l1[j] if(n== j-i+1 or l/(j-i+1)>r/(n-j+i-1)): #print(r) ind1[temp] = i+1 ...
parasjain-12/HackerEarth-Solution
Finding the Subarrays.py
Finding the Subarrays.py
py
485
python
en
code
162
github-code
13
14575695096
from decimal import * def getset(n): getcontext().prec = 1000 return {x:str(Decimal(1)/Decimal(x)) for x in xrange(1,n+1)} def cyclic(p): b = 10 t = 0 r = 1 n = 0 while True: t += 1 x = r*b d = int(x/p) r = x % p n = n*b+d if r == 1: ...
kryptn/euler
p26.py
p26.py
py
390
python
en
code
0
github-code
13
12787366950
from .helper import in_to_mm, lbf_to_newtons import matplotlib.pyplot as plt import numpy as np class SpecimenTest(object): ''' SpecimenTest object - combines a specimen with a material and test data. ''' class TestResults(object): def __init__(self, Jc = None, KJc = None, KJc_valid_1T ...
btcross26/astm_e1921_analysis-Python-3-Package
astm_e1921_analysis/SpecimenTest.py
SpecimenTest.py
py
6,312
python
en
code
0
github-code
13
9203536446
def translate_class_to_module(class_name): translation = { "SlurmAPIResource": "slurm_api_resource", "LocalResource": "local_resource", "LocalFileSystemStorage": "local_file_system_storage", "HubmapLocalFileSystemStorage": "hubmap_local_file_system_storage", "GlobusUserAuthen...
hubmapconsortium/user_workspaces_server
src/user_workspaces_server/utils.py
utils.py
py
1,068
python
en
code
0
github-code
13