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
74525951392
SECS_PER_MIN = 60 SECS_PER_HOUR = SECS_PER_MIN * 60 SECS_PER_DAY = SECS_PER_HOUR * 24 def secs_to_str(secs): days = int(secs) // SECS_PER_DAY secs -= days * SECS_PER_DAY hours = int(secs) // SECS_PER_HOUR secs -= hours * SECS_PER_HOUR mins = int(secs) // SECS_PER_MIN secs -= mins * SE...
acproject/GNNs
NAACL/util.py
util.py
py
1,237
python
en
code
1
github-code
1
6667501503
# pradeep s,p=input().split() a=len(p) for i in range(len(s)): b=s[:a] d=len(s) s=s[-(d-1):] if(p==b): print("yes") break else: print("no")
Pradeepnataraj/pradeep
substring.py
substring.py
py
176
python
en
code
0
github-code
1
34864971721
import os import random import numpy as np from PIL import Image import torch import torch.nn as nn from torch.utils.data import Dataset from torchvision import transforms from torchvision.transforms.functional import InterpolationMode import torchvision.transforms.functional as F class StasDataset(Dataset): de...
travisergodic/T-brain_STAS_Segmentation
data.py
data.py
py
4,933
python
en
code
6
github-code
1
11353408796
Import('QueryEnv') env = QueryEnv.Clone() env.Append(LIBS=['gunit', 'task_test']) env.Prepend(LIBS=['libsandeshflow']) env.Append(LIBPATH=['#/build/lib', Dir(env['TOP']).abspath + '/base/test/']) env.Append(CPPPATH = ['#/'+Dir('.').path , env['TOP'], env['TOP'] + '/base/san...
Juniper/contrail-dev-controller
src/query_engine/test/SConscript
SConscript
3,186
python
en
code
3
github-code
1
9409197844
# -*- encoding=utf8 -*- __author__ = "lacheln" from airtest.core.api import * auto_setup(__file__) ''' assert_equal:判断第一个值和第二个值是否相等 assert_not_equal:判断第一个值和第二个值是否不相等 判断预期结果和实际结果是不是相等的 ''' # exists(Template(r"tpl1670785802536.png", record_pos=(0.002, -0.71), resolution=(1284, 2778))) assert_equal(False, exists(Templ...
chenchao-lacheln/airtest_ios
air_ios_todesk_app2.air/air_ios_todesk_app2.py
air_ios_todesk_app2.py
py
537
python
zh
code
0
github-code
1
31284936895
import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) import json import pandas as pd from urllib.request import Request, urlopen from urllib.error import URLError import json from pathlib import Path import socket from collections import namedtuple ##############################################...
thiloschild/RockLog
RockLog/functions.py
functions.py
py
8,050
python
en
code
0
github-code
1
41465744834
from apis import magichome from jarvis import helper import functools import logging as log bulb = None bulb_addr = None def action( args ): global bulb if bulb == None: bulb = _discover() try: if args[0] in _light_actions: key = args[0] _light_actions[key]( args ) ...
Dimfred/my_jarvis
jarvis_server/jarvis/actions/light.py
light.py
py
3,096
python
en
code
0
github-code
1
43652881788
from enum import Enum from pathlib import Path # server constants SERVER_URL = "http://localhost:5000" TABLE_SCHEMA_PATH = str(Path("app") / "database" / "schema.sql") DEFAULT_DB_PATH = "user.db" FETCH_DELAY_PERIOD = 5 # time period beetween each server data update # other PREFFERED_ENCODING = "utf-8" # crypto con...
michalwilk123/elliot-chat-client
app/config.py
config.py
py
823
python
en
code
0
github-code
1
24252133551
import unittest import inspect import os import numpy as np from nwlattice import base, nw, indices # from nwlattice import utilities # utilities.toggle_printing(True) # create outputs directory if it doesn't exist if not os.path.isdir("./outputs"): os.mkdir("./outputs") # --------------------------------------...
araghukas/nwlattice
tests/test_simple_nanowires.py
test_simple_nanowires.py
py
10,938
python
en
code
1
github-code
1
34640311085
# -*- coding: utf-8 -*- from __future__ import unicode_literals from rest_framework import serializers from database.models import CollectionType from database.models import AnnotationType from rest.serializers.object_types import annotations from . import types MODEL = CollectionType.annotation_types.through # p...
CONABIO-audio/irekua
irekua/rest/serializers/object_types/data_collections/annotations.py
annotations.py
py
2,184
python
en
code
0
github-code
1
17617853804
import cv2 import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import joblib from tensorflow.keras.models import load_model model = load_model('../models/my_model.h5') opencv_dnn_model = cv2.dnn.readNetFromCaffe(prototxt="../models/deploy.prototxt.txt", c...
Core9nvidia/behavioural-assessment
code/utils.py
utils.py
py
2,321
python
en
code
0
github-code
1
32917341954
#Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). # Strings passed in will consist of only letters and spaces. # Spaces will be included only when more than one word is present. def spin_words...
MannyVenegas/my-python-katas
spinWords.py
spinWords.py
py
611
python
en
code
0
github-code
1
11069339322
import pandas as pd class Report: def __init__(self, statements): self.statements = statements self.categories = None self.df_categories = None self.totals = None self.__buildReport() def __mergeStatementDfs(self): dfs = [] for statement in self.statements: dfs.append(statement.d...
rlubin/kjt-bookkeeper
src/Report.py
Report.py
py
3,286
python
en
code
0
github-code
1
72662251235
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: start = 0 end = len(numbers)-1 while start < end : value = numbers[start] + numbers[end] if value == target: return [start+1,end+1] elif value > target: ...
Dushyantm/leetcode_problems
0167-two-sum-ii-input-array-is-sorted/0167-two-sum-ii-input-array-is-sorted.py
0167-two-sum-ii-input-array-is-sorted.py
py
433
python
en
code
0
github-code
1
73412184035
import boto3 import pandas as pd import numpy as np import matplotlib.pyplot as plt def get_sg_simplelist_table(client): # client = boto3.client('ec2', aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) res=client.describe_security_groups() sginfo=res['SecurityGroups'] s...
boomkim/aws-scripts
SecurityGroup/sg_simple_list.py
sg_simple_list.py
py
947
python
en
code
0
github-code
1
3197296423
class Solution(object): def maxHeight(self, A): """ :type cuboids: List[List[int]] :rtype: int """ A = [[0, 0, 0]] + sorted(map(sorted, A)) dp = [0] * len(A) for j in xrange(1, len(A)): for i in xrange(j): if all(A[i][k] <= A[j][k] ...
niufenjujuexianhua/Leetcode
maximum-height-by-stacking-cuboids/maximum-height-by-stacking-cuboids.py
maximum-height-by-stacking-cuboids.py
py
419
python
en
code
0
github-code
1
11159798731
class Node: def __init__(self,key): self.data = key self.next = None class Linkedlist: def __init__(self): self.head = None def append(self,val): new_node = Node(val) if self.head is None: self.head = new_node return temp = self.hea...
srilekha-peace/Linked-List
Rotate a linked list.py
Rotate a linked list.py
py
1,324
python
en
code
0
github-code
1
2059870361
from collections import deque # file = "test12.txt" file = "input12.txt" def get_terrain(): ter = [] start = (0, 0) end = (0, 0) with open(file, "r") as f: for y, line in enumerate(f): l = list(line.strip()) if "S" in l: x = l.index("S") ...
professeurb/AdventOfCode2022
adc12.py
adc12.py
py
1,932
python
en
code
0
github-code
1
15798007027
#!/usr/bin/python3 ''' takes in a URL, sends a request to the URL displays the body of the response (decoded in utf-8). ''' import requests from sys import argv if __name__ == "__main__": myUrl = argv[1] req = requests.get(myUrl) if req.status_code > 400: print("Error code: {}".format(req.status_co...
Just-Akinyi/alx-higher_level_programming
0x11-python-network_1/7-error_code.py
7-error_code.py
py
359
python
en
code
2
github-code
1
2889092537
import sys readline = sys.stdin.buffer.readline map_readline = lambda: map(int, readline().split()) # 嘘解法? if __name__ == "__main__": A, B, C, X, Y = map_readline() # ABなし ans1 = A * X + B * Y # Aを全部ABで ans2 = C * 2 * X rest = Y - X if rest > 0: ans2 += rest * B # Bを全部ABで an...
Kumamoto-Hamachi/atcoder_pr
abc_contest/abc95/c/c.py
c.py
py
627
python
en
code
1
github-code
1
15066641758
from django.db import models from django.contrib.auth.models import User from django.forms import CheckboxInput class Base(models.Model): create = models.DateTimeField(auto_now_add=True) update = models.DateTimeField(auto_now=True) class Modelo(models.Model): modelo = models.CharField(max_length=150) ...
ctedescojr/apontamentos-gestao-visual-producao
home/models.py
models.py
py
6,341
python
pt
code
0
github-code
1
75065179233
__all__ = [ "Model", ] r"""" Adapted from the Robustness Against Backdoors (RAB) repository. See: https://github.com/AI-secure/Robustness-Against-Backdoor-Attacks """ from torch import Tensor import torch.nn as nn import torch.nn.functional as F # noqa from .types import PoisonLearner class Model(PoisonLearne...
ZaydH/target_identification
fig01_cifar_vs_mnist/poison/datasets/_mnist_cnn.py
_mnist_cnn.py
py
2,414
python
en
code
5
github-code
1
23854869141
"""Setup file for package""" from setuptools import setup, find_namespace_packages from os import path __version__ = "1.0.b1" __author__ = "rmflynn" here = path.abspath(path.dirname(__file__)) with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() setup( name="dram2", ...
rmFlynn/collection_of_typical_ocoli_samples
setup.py
setup.py
py
2,806
python
en
code
0
github-code
1
13638859697
#!/usr/bin/env python3 with open('./input/01_input.txt') as input_file: depths = [int(i) for i in input_file.read().splitlines()] trio_depths = [depths[x]+depths[x+1]+depths[x+2] for x in range(len(depths)-2)] counter = 0 for i in range(len(trio_depths)): try: if trio_depths[i] < trio_depths[i+1]: ...
maketakunai/aoc2021
python/01b.py
01b.py
py
378
python
en
code
0
github-code
1
9030843872
import itertools import os import xml.etree.ElementTree as ET from datetime import datetime, timedelta from multiprocessing import Pool, cpu_count from diskcache import Cache from conf import OUTPUT_FOLDER, CACHE_FOLDER, EPG_FILE, DOWNLOAD_EXTRA_INFO, DAYS_TO_DOWNLOAD, DELAYS, HD_CHANNELS from date_time import DateTi...
oscarbc96/epg_generator
epg_generator.py
epg_generator.py
py
8,413
python
en
code
1
github-code
1
31245781337
# response.py import torch from transformers import GPT2LMHeadModel, GPT2Tokenizer tokenizer = GPT2Tokenizer.from_pretrained("gpt2") tokenizer.pad_token = tokenizer.eos_token model = GPT2LMHeadModel.from_pretrained("gpt2") def get_response(user_input): inputs = tokenizer.encode_plus( user_input, add_speci...
Ghassen-bgh/gpt-2-huggingface-chatbot
response.py
response.py
py
844
python
en
code
0
github-code
1
28801028633
import random import uuid from typing import Dict from typing import Union from fastapi import APIRouter from fastapi import HTTPException from fastapi import Request from bowled_match_engine.match_engine.game_simulator import simulate_game from gamelib.team.live_team import get_players_by_team_id from gamelib.team.l...
bunsamosa/bowled_server
rest_server/live/start_game.py
start_game.py
py
4,729
python
en
code
2
github-code
1
31245757127
from fastapi import FastAPI import pandas as pd #from pydantic import BaseModel #from typing import Optional # Ruta al archivo JSON file_path = '../PI MLOps - STEAM/steam_games.json' # Leer el archivo JSON línea por línea y cargar los datos en una lista data_list = [] with open(file_path, 'r') as f: ...
Gio2M/2
main.py
main.py
py
1,792
python
es
code
0
github-code
1
71068940194
import os from copy import copy from logging import DEBUG from logging import INFO from logging import NOTSET from furl import furl from src.typeshed import ConfigDict from src.typeshed import DBConfigDict from src.typeshed import DiscordConfigDict from src.typeshed import FormatterDict from src.typeshed import Logge...
jplhanna/discord_quest_bot
src/config.py
config.py
py
2,666
python
en
code
0
github-code
1
30297857435
"""Writing DICOM from vol in ssdf using pydicom. Module saves 'avgreg' volume to dicom (.dcm) files """ from __future__ import print_function import sys import os.path import dicom from dicom.dataset import Dataset, FileDataset import dicom.UID from stentseg.utils.datahandling import select_dir,loadvol,normalize_sof...
almarklein/stentseg
lspeas/_ssdf2dicom.py
_ssdf2dicom.py
py
10,710
python
en
code
3
github-code
1
22190353631
# Coded By WEYT.MM /*\ 28-05-2020 # https://github.com/WEYTMM/Jadwal-Kencan from datetime import * now = datetime.now() hari_kencan = now.strftime("%A") tanggal = date.today() class main: def __init__(self, kencan): #Edit Sendiri Jadwal Kencan Kalian senin = """Gak ada jadwal kencan hari ini Doi lagi sibuk ke...
WEYTMM/Jadwal-Kencan
kencan.py
kencan.py
py
2,266
python
id
code
0
github-code
1
4622931857
import subprocess import os from combine import Combine def test_combine_build(): site_dir = os.path.join(os.path.dirname(__file__), "site") # Pretend we are in tests/site os.chdir(site_dir) combine = Combine(config_path="combine.yml") combine.build() site_output_dir = os.path.join(site_di...
dropseed/combine
tests/test_build.py
test_build.py
py
622
python
en
code
10
github-code
1
28348419993
from utils.utils import PushableDict class StageDropInfo(dict): dropType = { -1: '攻击奖励', 0: 'UNKNOWN-0', 1: '首次掉落/干员&家具', 2: '常规掉落', 3: '特殊掉落', 4: '额外物资', 5: 'UNKNOWN-5', 6: 'UNKNOWN-6', 7: 'UNKNOWN-7', 8: '首次掉落/至纯源石', 9: 'UNK...
fexli/ArknightsAutoRunner
ArkType/StageExcel.py
StageExcel.py
py
2,763
python
en
code
5
github-code
1
10955676150
import re, math from googletrans import Translator from collections import Counter translator=Translator() WORD = re.compile(r'\w+') lines1=open('C:/Users/Fahim/Desktop/Final_thesis/QUE_Bangla.txt',encoding='utf8').read().split('\n') lines2=open('C:/Users/Fahim/Desktop/Final_thesis/Questions_final2.txt',encoding=...
yousuffahim8/Bengali-Social-Virtual-Robot-
Code/fahim_translation.py
fahim_translation.py
py
2,677
python
en
code
1
github-code
1
12922429389
# De django from django.urls import path # Propios from . import views urlpatterns = [ path('v1',views.v1,name='v1'), path('getstaff',views.getStaff,name='getStaff'), path('getcluster',views.getCluster,name='getCluster'), path('setdata',views.setData, name='setData'), path('active-client',views.cha...
Haziel-Soria-Trejo/GymAdmin
API/urls.py
urls.py
py
475
python
en
code
0
github-code
1
28437687470
import grpc import os import pickle from concurrent import futures from core.inference_service import InferenceService from grpc_health.v1 import health from grpc_health.v1 import health_pb2 from grpc_health.v1 import health_pb2_grpc from grpc_reflection.v1alpha import reflection from protos import inference_pb2 fro...
liupeirong/MLOpsManufacturing
samples/edge-inferencing-and-mlops/grpc_inferencing_service/service/main.py
main.py
py
2,764
python
en
code
21
github-code
1
41027393186
from typing import Dict, List def xyz_args(script_name, arg, current_index, args, _) -> Dict[str, List[str]]: if script_name != 'x/y/z plot': return {}, None if not arg or type(arg) is not list: return {}, None # 10 represent the checkpoint_name option for both img2img and txt2img # ...
awslabs/stable-diffusion-aws-extension
aws_extension/inference_scripts_helper/xyz_helper.py
xyz_helper.py
py
610
python
en
code
111
github-code
1
35080534874
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('event', '0036_auto_20150817_1057'), ] operations = [ migrations.AlterField( model_name='event', name...
smmsadrnezh/bilityab
event/migrations/0037_auto_20150817_2113.py
0037_auto_20150817_2113.py
py
638
python
en
code
2
github-code
1
28419540730
# -*- coding: utf-8 -*- ''' 猫狗分类 ''' # @Time : 2021/4/8 17:14 # @Author : LINYANZHEN # @File : CatDogModel.py import torch.nn as nn class CDNet(nn.Module): def __init__(self): super(CDNet, self).__init__() self.convent = nn.Sequential( nn.Conv2d(in_channels=3, out_channels=8, kernel...
AWSDJIKL/Artificial-Intelligence-and-Neural-Network
CatDogNet/CatDogModel.py
CatDogModel.py
py
2,025
python
en
code
0
github-code
1
4848988793
from datetime import datetime import os from random import randint import tempfile from time import sleep from urllib.parse import parse_qs, urlparse from uuid import uuid1 import tator def test_get_file(host, token, project, video): tator_api = tator.get_api(host, token) video_obj = tator_api.get_media(video...
cvisionai/tator-py
test/test_media.py
test_media.py
py
10,371
python
en
code
4
github-code
1
1104264086
#capitalize first letter in every word a="hello world" b=list(a) space=False for i in range(len(b)): if i==0: b[i]=b[i].upper() elif b[i]==' ': space=True elif space: space=False b[i]=b[i].upper() print(''.join(b)) """b=a.split(" ") for i in range(len(b)): ...
saketh4567/pheonix-global
capitalizefirstletter.py
capitalizefirstletter.py
py
377
python
en
code
0
github-code
1
5976061038
import argparse import csv from collections import defaultdict, OrderedDict import os import pprint import re from ssg.constants import product_directories import ssg.utils import ssg.rule_yaml import ssg.yaml def escape_path(path): return re.sub(r'[-\./]', '_', path) def accounts_password_csv_to_dict(csv_line...
0day-xc-Our/2020-Security-Guide
utils/migrate_template_csv_to_rule.py
migrate_template_csv_to_rule.py
py
33,684
python
en
code
2
github-code
1
25375579863
import os import time import json import requests path = "" # ex. "public/" whitelist_file_path = "/opt/SentinelNetGuard/whitelist.txt" cfg_file_path = "/opt/SentinelNetGuard/config.json" class local_server: def __init__(self, pre_whitelist=None, unid="null", owner="null", lifetime=3600, destruct...
wilarN/SentinelNetGuard_Node-Host_Software
srv_src/useful.py
useful.py
py
10,640
python
en
code
1
github-code
1
36142173052
class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead. """ i=0 for x in range (len(n...
kgurnoor/python_data_structures_daily_practice
Merge_Sorted_Array.py
Merge_Sorted_Array.py
py
488
python
en
code
1
github-code
1
21845667793
class Solution: def adjacent_cells(self, r, c, visited, image, color): max_r = len(image) max_c = len(image[0]) adj_cells = [] if 0 < r < max_r and not visited[r-1][c] and image[r-1][c] == color: adj_cells.append((r-1, c)) if 0 <= r < max_r-1 and not vi...
uditmanav17/leetcode
flood-fill/flood-fill.py
flood-fill.py
py
1,268
python
en
code
0
github-code
1
26103569267
import ast from functools import partial import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.stats import seaborn as sn import torch from tqdm import tqdm pd.set_option("mode.chained_assignment", None) SCALE = 13 HEIGHT_SCALE = 0.5 sn.set(rc={"figure.figsize": (SCALE, int(HEIGHT_SCALE ...
samholt/DeepGenerativeSymbolicRegression
process_results/process_logs.py
process_logs.py
py
8,284
python
en
code
7
github-code
1
39894973301
import numpy as np arr = np.ones(shape=(3, 5), dtype=int) * 2 print(arr) arr2 = np.full((3, 5), 2, dtype=int) print(arr2) arr3 = np.array([2]) arr3 = np.tile(arr3, (3, 5)) print(arr3)
jansowa/numpy-exercises
arrays/ex40.py
ex40.py
py
186
python
en
code
0
github-code
1
34020545749
# coding: utf-8 # In[21]: import json import urllib.request import time user = 'whyisjake' url = 'https://api.github.com/users/%s/repos' % user users = ['elmiram', 'nevmenandr', 'shwars', 'JelteF', 'timgraham', 'arogozhnikov', 'jasny', 'bcongdon', 'whyisjake'] response = urllib.request.urlopen(url) text = response...
aischeveva/hw_python2017
sem071017_json.py
sem071017_json.py
py
1,230
python
en
code
0
github-code
1
38950183255
import logging import os import pickle from scipy import ndimage import numpy import tensorflow logging.basicConfig(format='%(asctime)s : %(levelname)s :: %(message)s', level=logging.DEBUG) # todo fix the image size; our images aren't square image_size = 28 # Pixel width and height. image_height = 28 image_width = ...
mikedelong/machine-learning
tensorflow/make_pickle.py
make_pickle.py
py
16,902
python
en
code
0
github-code
1
25812567758
import matplotlib.pyplot as plt import unittest import numpy as np import smuthi import smuthi.simulation import smuthi.initial_field import smuthi.layers import smuthi.particles import smuthi.postprocessing.far_field as ff import smuthi.utility.optical_constants as opt import io import yaml # for single wavelength d...
semyonbo/particle-scattering
multipoles_TM_dipoles_and_quadrupoles.py
multipoles_TM_dipoles_and_quadrupoles.py
py
5,534
python
en
code
0
github-code
1
24398372709
import tweepy import os consumer_key = os.environ.get('CUTIESINSF_CONSUMER_KEY') consumer_secret = os.environ.get('CUTIESINSF_CONSUMER_SECRET') access_token = os.environ.get('CUTIESINSF_ACCESS_TOKEN') access_token_secret = os.environ.get('CUTIESINSF_ACCESS_TOKEN_SECRET') class TweetPoster(object): def __init__(...
ecalifornica/CutePetsSF
twitter_oauth.py
twitter_oauth.py
py
1,190
python
en
code
3
github-code
1
3210811157
import numpy as np import cv2 import matplotlib.pyplot as plt import torch import AENetwork from cfg import DefaultConfig # import time torch.backends.cudnn.deterministic = True # 因为使用了GPU,需要保证种子固定才能保证每次结果相同 torch.backends.cudnn.benchmark = True # 让cuDNN找到最合适的算法 device = torch.device("cuda" if torch.cuda.is_availabl...
Amoo1121/Graduate
src/AE/Backup/test.py
test.py
py
2,273
python
en
code
1
github-code
1
10753320984
# author:JinMing time:2020-06-02 # -*- coding: utf-8 -*- from tc_data_env.nodata.course import * from tc_data_env.nodata import * teacherid = None def setup(): print('开始执行添加老师初始化') delete_all_teacher() def teardown(): print('开始执行添加老师清除') delete_teacher(teacherid) def test_add_teacher(): print...
chenjinming580/PycharmProjects
untitled/pytest222/day2/auto_test/tc_data_env/nodata/course/test_teacher_mgr.py
test_teacher_mgr.py
py
582
python
en
code
0
github-code
1
15618952456
import torch from torch.autograd import Variable from torch.utils.data import TensorDataset, DataLoader import numpy as np def to_Variables(*args, cuda=False): ret = [] for arg in args: if cuda: ret.append(Variable(arg).cuda()) else: ret.append(Variable(arg)) retur...
davevanveen/fairness_logistic_regression
test/test_fairness_penalty.py
test_fairness_penalty.py
py
2,943
python
en
code
1
github-code
1
3654338359
from PIL import Image from pytesseract import pytesseract, Output import os import spacy import cv2 import streamlit as st pytesseract.tesseract_cmd = r"C:/Program Files/Tesseract-OCR/tesseract.exe" def img_to_txt(file_name): img = Image.open(file_name) print('image is loaded') text = pytesseract.image_to...
jpsanchezg/My-heroes-gene-challenge
streamlit_app.py
streamlit_app.py
py
3,345
python
en
code
0
github-code
1
30801385183
import tensorflow as tf import numpy as np import os import cifar10_input as c from PIL import Image cur_dir = os.getcwd() print("resizing images") print("current directory:",cur_dir) def modify_image(image): flipped_images = tf.image.flip_up_down(image) return flipped_images def read_image(filename_queue): ...
charlieLehman/cifar_isic
bin_test.py
bin_test.py
py
1,016
python
en
code
1
github-code
1
29312453954
from yxsim.action import Action from yxsim.cards.base import Card from yxsim.player import Player from yxsim.resources import Sect, Resource from yxsim.combat import combat import typing class CardType(Card): display_name = 'Escape Plan' phase = 4 sect = Sect.HEPTASTAR qi = 1 def play(self, attac...
Reggles44/YXSim
yxsim/cards/logic/escape_plan.py
escape_plan.py
py
1,288
python
en
code
0
github-code
1
6131440996
n = int(input()) arr = list(map(int,input().split())) m = int(input()) prefix = [0]*(n+1) for i in range(n): prefix[i+1] = arr[i] + prefix[i] amount = [0]*(n) for i in range(n): if i+m <= n: amount[i] = prefix[i+m] - prefix[i] else: amount[i] = prefix[-1] - prefix[i] dp = [[0]*n for _ in...
2020-ASW/kwoneyng-Park
4월 4주차/소형기관차.py
소형기관차.py
py
593
python
en
code
0
github-code
1
23150637820
############################################################################### # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # ...
donovan-h-parks/UniteM
unitem/external/prodigal.py
prodigal.py
py
14,478
python
en
code
16
github-code
1
20747394420
class BankAccount: def __init__(self, int_rate = 0.0345, balance = 100.0): self.rate = int_rate self.acctBalance = balance def deposit(self, amount): self.acctBalance += amount def withdraw(self, amount): self.acctBalance -= amount def display_account_info(self): ...
danieluhr713/Bank-Account-Assignment
bankAccount.py
bankAccount.py
py
944
python
en
code
0
github-code
1
23106661609
import sys from pathlib import Path from typing import Any, Optional import loguru import loguru._logger logger = loguru.logger def setup_logger( output_dir: Optional[Path] = None, bind: dict[str, Any] = {}, stderr_level: str = "INFO", file_level: str = "DEBUG", # ) -> "loguru.Logger": ) -> None...
berleon/savethat
savethat/log.py
log.py
py
1,109
python
en
code
1
github-code
1
30531416686
from src.utils.testmodelutils import test_models_on_batch_and_show from src.utils.Metrics import auc, acc, highest_tpr_thresh, lowest_fpr_thresh from src.utils.ParamTuner import ParamTuner from src.utils.utils import init_folder, make_folder_if_not_there from src.utils.Plotting import make_plot from src.experiments.ut...
dastronmighty/dl-project
src/experiments/RunExperiment.py
RunExperiment.py
py
7,868
python
en
code
0
github-code
1
6479039934
#!/usr/bin/env python3 """ Usage: spack-gen-external-packages.py > /path/to/spack/etc/spack/packages.yaml Requires python 3.3+ You can also save to ~/.spack/packages.yaml, but I prefer using the spack dir because I typically keep multiple spack installs around and I don't want them interfering with each other with co...
wdmapp/wdmapp-config
bin/spack-gen-external-packages.py
spack-gen-external-packages.py
py
6,601
python
en
code
3
github-code
1
21682344443
import pytest import allure @allure.feature('omplogin-分销商登录') class TestDemo8_omplogin(object): @allure.story('omp登录有效类') @allure.title('1111111111111') @allure.severity('Normal') @allure.step('输入正确的用户名和密码') def test_loginYXL(self): ''' 用例描述:输入正确的用户名和密码可正常登录 ''' ...
su9695/myPytestDay
Learning/pytest/test_demo8.py
test_demo8.py
py
1,507
python
zh
code
0
github-code
1
23462710011
# l = [] # def Postfix(p): # d = p.split(",") # for i in range(len(d)): # if d[i] not in ['+', '-', '*', '/']: # l.append(int(d[i])) # # print(l) # else: # a = l.pop(l.index(l[-1])) # b = l.pop(l.index(l[-1])) # if d[i] == "...
AvikSahaRoy/Data-Structure-With-Python
Postfix.py
Postfix.py
py
1,428
python
en
code
0
github-code
1
17144892623
from django.shortcuts import render, get_object_or_404, redirect from .forms import QuestionForm, TestCreateForm from Test_Designing.models import Test,QuestionSet,Question,StudentResult from Result_Analysis.models import Teacher,Student from django.contrib import messages from django.forms import formset_factory from ...
BrijeshBumrela/Scholaris
Scholaris/Test_Designing/views.py
views.py
py
8,626
python
en
code
3
github-code
1
17358919878
#!/usr/bin/env python from pprint import pprint from napalm import get_network_driver import my_devices def task1b(dev): device_type = dev.pop("device_type") driver = get_network_driver(device_type) device = driver(**dev) device.open() print(device,"\n") facts = device.get_facts() ppri...
mickdcsw/PyPlus
class9/class9_task1.py
class9_task1.py
py
519
python
en
code
0
github-code
1
2581022894
from time import time import pysodium import msgpack import logging import re from kafkacrypto.utils import str_shim_eq, str_shim_ne, msgpack_default_pack from kafkacrypto.keys import get_pks, SignPublicKey class ProcessChainError(ValueError): def __init__(self, message, printable): super().__init__(message) ...
tmcqueen-materials/kafkacrypto
kafkacrypto/chain.py
chain.py
py
12,215
python
en
code
14
github-code
1
6744220302
def greet(name = 'Saheed', msg='Good Bye'): print('Hello', name) greet() greet('Oladiipo') greet(name='Python') #print(name, msg) print('######################') def greet(name = 'Saheed', msg='Good Bye'): #print('Hello', name) print('Hello', name, msg) greet() greet('Oladiipo') greet(name='Py...
oladiiposaheed/myproject
Functions/default_fnct.py
default_fnct.py
py
545
python
en
code
0
github-code
1
33352893131
import docker from docker .errors import NotFound, APIError # system import sys, os import pathlib import logging from datetime import datetime # MultiThreading from threading import Thread # Own from arq_decorators.service_decorator import enableFunction from arq_server.services.CoreService import Configuration from a...
RafaelGB/pythonScripts
Arquitectura/arq_server/services/support/DockerTools.py
DockerTools.py
py
4,146
python
en
code
0
github-code
1
70773344034
def foo(L, p, r): if (p==r): return L[p] if(r+1== p): return 1 else: mid = (p+r)//2 leftmid = (p +mid)//2 rightmid = (mid+ r)//2 first = foo(L, p, leftmid) second = foo(L, leftmid+1, mid) third = foo(L, mid + 1, rightmid) ...
baeziy/daa-codes
ass01/task5/divideAndConquer.py
divideAndConquer.py
py
442
python
en
code
0
github-code
1
21588129706
from time import time, sleep from typing import Any def benchmark(method: Any, critical_time: float): """ This is function for time execution calc :param method: Class method :param critical_time: critical time execution value in sec :return: func """ def wrapper(*args, **kwargs): ...
Dimiyss/Itea_training
home_work_3/hw_3_clas_decor.py
hw_3_clas_decor.py
py
2,016
python
en
code
0
github-code
1
10313196557
class Solution: def fizzBuzz(self, n): """ :type n: int :rtype: List[str] """ arr = [] for i in range(1,n+1): if i%3 == 0 and i%5 ==0: arr.append("FizzBuzz") continue if i%3 == 0: arr.append("Fizz...
Ryang20718/Solutions
Easy-/Fizzbuzz.py
Fizzbuzz.py
py
543
python
en
code
1
github-code
1
30933988815
DEPS = struct( bazel_gazelle = struct( sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809", strip_prefix = "", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz", "ht...
dolthub/doltclusterctl
versions.bzl
versions.bzl
bzl
2,708
python
en
code
0
github-code
1
24265607850
import cv2 import numpy as np import matplotlib.pyplot as plt def make_line(image, line_parameters): slope = line_parameters[0] intercept = line_parameters[1] y1 = image.shape[0] #lane detection line starts from bottom of image y2 = int(y1*(3/5)) #lane detection line ends at 3/5 of height o...
praveenvenkat06/Lane_Object_Detection
Lane_Object_Detection_Project/laneDetection.py
laneDetection.py
py
4,971
python
en
code
0
github-code
1
12274171666
import numpy as np import cv2 #Description missing cap = cv2.VideoCapture('cars2.mp4') def make_coordinates(video, line_parameters): slope, intercept = line_parameters y1 = video.shape[0] y2 = int(y1 * 0.5) x1 = ((y1 - intercept) / slope) x2 = ((y2 - intercept) / slope) return np.array([x1, ...
Voyage-Self-Drive/Voyage
LinesAndArea.py
LinesAndArea.py
py
3,121
python
en
code
2
github-code
1
17520414020
import os from setuptools import setup README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-tagconstants', version='0.1', packages=['tagconstants', 'tagconstants.templatetags'], i...
nalourie/django-tagconstants
setup.py
setup.py
py
1,227
python
en
code
2
github-code
1
72092613794
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('main', '0011_city_office'), ] operations = [ migrations.AddField( model_name='scholluser', name='off...
andriyl1993/course_work
main/migrations/0012_scholluser_office.py
0012_scholluser_office.py
py
421
python
en
code
0
github-code
1
1143306668
#과제2 히스토그램 평활화 import numpy as np import matplotlib.pyplot as plt import imageio as io img = io.imread('low_contrast.jpg') des = np.zeros((img.shape), dtype=np.int16) des_value = np.zeros(256, dtype=np.uint8) hist, bins = np.histogram(img.flatten(), 256, [0,256]) cdf = hist.cumsum() print(cdf) for i in range(0, img...
konis123/image_processing_assign
school_190513/190513_4.py
190513_4.py
py
608
python
en
code
0
github-code
1
13026115262
# By submitting this assignment, I agree to the following: # "Aggies do not lie, cheat, or steal, or tolerate those who do." # "I have not given or received any unauthorized aid on this assignment." # # Name: ANDERSON WAYNE LOAN # Section: 574 # Assignment: 4-9 # Date: 17/09/22 # #imports libaries to make code easier f...
AndersonLoan/Calculate-Roots
calculate_roots.py
calculate_roots.py
py
1,026
python
en
code
0
github-code
1
9464396727
from django.shortcuts import render_to_response, get_object_or_404 from ask.models import question, answer from django.contrib.auth.models import User from django.http import HttpResponseRedirect, HttpResponse from ask.forms import questionForm, answerForm import datetime from django.contrib.auth.forms import UserCreat...
Trizalio/alexeyWebProject
ask/views.py
views.py
py
11,017
python
en
code
0
github-code
1
24870682910
"""This class performs session table related database queries and common checks""" __license__ = "GPLv3" class SessionDB: """ This class performs database queries for session table. :Example: from lib.database_lib.session_db import SessionDB from lib.database import Database #...
aces/Loris-MRI
python/lib/database_lib/session_db.py
session_db.py
py
3,784
python
en
code
10
github-code
1
3946316334
# -*- coding: utf-8 -*- """ PAnM-S: Model for autotrophic growth of mixed culture photoautotrophic and photoheterotrophic bacteria with sulfide as electron donor from: F. Egger, T. Hulsen, S. Tait, D. J. Batstone, Autotrophic sulfide removal by mixed culture purple phototrophic bacteria, Water Research 182 (202...
fegger/PPB-MOD-AUT-S
PAnM-S.py
PAnM-S.py
py
14,800
python
en
code
0
github-code
1
72696716193
# Algorithm Question 131 = Add two Number (From LeetCode) """ Add two Number | (It's not Easy, Please go throught the Question) Get the Problem Statement on LeetCode : https://leetcode.com/problems/add-two-numbers/ And get the solution, solved by me, here :} """ # Author = Abhinav # Date = 28 October 2021 # Pou...
Brodevil/Competative-Programming
Python/Solved Questions/practise_set_131.py
practise_set_131.py
py
940
python
en
code
3
github-code
1
22136340954
from typing import List class Solution: def plusOne(self, digits: List[int]) -> List[int]: s=''.join(map(str,digits)) k=str(int(s)+1) k=k.zfill(len(s)) ans=list(map(int,k)) print(ans) return ans plusOne(1,[1,2,3]) a=Solution()
pandey-ankur-au17/Python
coding-challenges/week06/day04/ccQ2.py
ccQ2.py
py
299
python
fa
code
0
github-code
1
69919587553
x1=input("Enter the first string ") x2=input("Enter the second string ") str1="" str2="" l1=[i for i in x1 if(i not in x2)] l1.extend(i for i in x2 if(i not in x1)) #l2=[i for i in x1 if(x1.count(i)==1)] print("the string is {} ".format(str1.join(set(l1))))
ArjunwadkarAjay/Python-Basic-programs
2.py
2.py
py
260
python
en
code
0
github-code
1
23765805849
from cls_settings import cls_org_settings from cls_marine import cls_marine from initialize import Load_Namefile from initialize import Get_Letters from random import randint as rand class cls_chapter_command: def __init__(self, input_company): self.chapter_master = [] self.commanders = [] ...
Charles-Milton-Crowe/fluffbox
cls_org_company.py
cls_org_company.py
py
26,007
python
en
code
0
github-code
1
24254939395
from collections import deque def orangesRotting(self, grid): """ :type grid: List[List[int]] :rtype: int """ rotten = deque() time = 0 freshCount = 0 ROWS = len(grid) COLUMNS = len(grid[0]) for r in range(ROWS): for c in range(COLUMNS): if grid[r][c] == 2:...
NTiger07/Leet75-python
Graphs/994.RottingOranges.py
994.RottingOranges.py
py
1,084
python
en
code
0
github-code
1
42699274096
import random import time import math import matplotlib.pyplot as plt from copy import deepcopy COLORS = ['\33[31m', '\33[35m', '\33[33m', '\33[36m'] # colors in the console MAPCOLORS = {"red": "lightcoral", "green": "seagreen", "blue": "turquoise", "purple": "mediumpurple"} # colors in the graph RESET = '\033[0m' RE...
Nastionagr/Bachelor-University-Projects
Projects (Python)/KNN-algorithm/program.py
program.py
py
8,748
python
en
code
0
github-code
1
72358336355
from typing import List class Solution: def countServers(self, grid: List[List[int]]) -> int: r, c = len(grid), len(grid[0]) rowCnt, colCnt = [0] * r, [0] * c for i in range(r): for j in range(c): if grid[i][j] == 1: rowCnt[i] += 1 ...
lyzsk/leetcode-solutions
python-solutions/1267-count-servers-that-communicate/solution.py
solution.py
py
540
python
en
code
3
github-code
1
4978208409
con = 0 num = 0 while True: n = int(input("Digite um valor[999 para sair]: ")) if n == 999: break con += 1 num += n print(f"Foi digitado um total de {con} números\nA soma entre os números foi {num}")
nicolasdonada/Exerc-ciosEmPython
DESAFIOS/desafio66.py
desafio66.py
py
228
python
pt
code
2
github-code
1
21377441019
from __future__ import annotations from itertools import product import dask.array as da import numpy as np import pandas as pd import xarray as xr from skimage.draw import random_shapes from skimage.measure import regionprops_table def get_data(mode="numpy", shape=(3, 4, 256, 256)): data = np.zeros(shape, dty...
jrussell25/dask-regionprops
tests/util.py
util.py
py
1,699
python
en
code
4
github-code
1
36861341863
import argparse import os import pathlib import shlex import subprocess import tempfile import typing from logzero import logger import pysam import vcfpy from .config import BamExtractConfig, DEFAULT_GENOME_RELEASE from ..common import GenomeRelease, SITES_VCFS from ..exceptions import SampleNameGuessingError from ....
holtgrewe/clin-qc-tk
qctk/bam/extract.py
extract.py
py
8,410
python
en
code
0
github-code
1
10869211389
''' Created on Nov 20, 2017 @author: csantoso @reference : https://github.com/dialogflow/fulfillment-webhook-weather-python ''' from __future__ import print_function from future.standard_library import install_aliases install_aliases() from urllib.parse import urlparse, urlencode from urllib.request import urlopen, R...
ccs1910/elsa-fulfilment
yahoo_weather_api.py
yahoo_weather_api.py
py
1,665
python
en
code
0
github-code
1
38719852186
#!/usr/bin/env python # coding: utf-8 # In[5]: get_ipython().system('pip install opencv-python') # In[2]: import numpy as np import cv2 cap = cv2.VideoCapture(r'C:\Users\ASUS\Desktop\WorldWar.mp4') while(cap.isOpened()): ret, frame = cap.read() gray = cv2.cvtColor(frame,1) cv2.imshow('frame',gray...
mztaljeh/opencv
video .py
video .py
py
999
python
en
code
0
github-code
1
41050298714
"""Benchmarks to check computation time and memory usage for batsim.""" import batsim.stamp as batstamp import batsim.transforms as batforms import galsim import time def time_shear_speed(nn=64, scale=0.2): # create galaxy gal = galsim.Sersic(n=1.5, half_light_radius=1.5, flux=40) # start timing ...
CMacM/BATSim
benchmarks/benchmarks.py
benchmarks.py
py
2,377
python
en
code
5
github-code
1
25376881827
from opentelemetry import metrics from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import ConsoleMetricsExporter from opentelemetry.sdk.metrics.export.aggregate import ( HistogramAggregator, LastValueAggregator, MinMaxSumCountAggregator, SumAggregator, ) from ope...
NathanielRN/clone-opentelemetry-python
docs/examples/basic_meter/view.py
view.py
py
3,090
python
en
code
0
github-code
1
72410673635
import asyncio from argparse import ArgumentParser import datetime as dt from typing import Optional from time import monotonic import aiohttp import pandas as pd import requests from pydantic import BaseSettings, BaseModel class Date(BaseModel): year: int month: int day: int class Config: o...
online-lyceum/async_lyceum_creator
lesson_creator/main2.py
main2.py
py
7,148
python
en
code
0
github-code
1
69905808034
import numpy as np import cv2 import sys def get_click(event, x, y, flags, param): if event == cv2.EVENT_LBUTTONDOWN: print(x, y) def main(): if len(sys.argv) == 1: # pass the device number cap = cv2.VideoCapture(0) else: try: cap = cv2.VideoCapture(int(sys.argv[1])...
tttamaki/lecture_code
ImageProcessing/opencv/2-2-capture_click.py
2-2-capture_click.py
py
897
python
en
code
18
github-code
1
71547250915
import csv def procces_sales_data(file_path): total_transactions = 0 total_revenue = 0 transaction_by_category = {} with open(file_path, 'r') as f: csv_reader = csv.reader(f) for row in csv_reader: try: total_amount = float(row[6]) except Value...
sshevczo/database_project
init/main.py
main.py
py
1,468
python
en
code
0
github-code
1