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
25062222468
# word doc binay search def read_words (document): # read in the article file with open(document) as doc: words = [] # loop through the article line by line for line in doc : words.append(line.strip('\n')) return words def binary_search_word(value): my_list = read_words ("wordlist.txt") print (my_list)...
Janteby1/binary_search-copy
binary-search.py
binary-search.py
py
4,067
python
en
code
0
github-code
36
73895256743
import numpy as np import torch from torch.utils.data import Dataset import pickle as pkl def valence_map(elements: list, valences: list): """ ## Given a list of elements and their corresponding valences, create a dictionary mapping each element to its valence. ### Args: - elements: a list of ele...
Airscker/DeepMuon
DeepMuon/dataset/XASData.py
XASData.py
py
4,337
python
en
code
1
github-code
36
21115457088
"""Django FilterSet classes for Nautobot.""" import django_filters from nautobot.apps.filters import BaseFilterSet, NautobotFilterSet, SearchFilter from nautobot_chatops.choices import PlatformChoices from nautobot_chatops.models import CommandLog, AccessGrant, ChatOpsAccountLink, CommandToken class CommandLogFilte...
nautobot/nautobot-plugin-chatops
nautobot_chatops/filters.py
filters.py
py
1,773
python
en
code
47
github-code
36
20145639624
""" Cobweb plot function """ import numpy as np import matplotlib.pyplot as plt __all__ = [ 'cobweb' ] def cobweb(func, initial_conditon, nsteps, limits, args=(), ax=None): """ Plot cobweb diagram for onedimensional iterated functions ``x[n+1] = func(x[n])``. Parameters ---------- func ...
antonior92/dynamic-system-plot
dynplt/cobweb.py
cobweb.py
py
1,586
python
en
code
1
github-code
36
35896409907
from typing import NamedTuple, Optional, List, Dict, Any, Union from enum import Enum, auto import pysam def _build_filter(rec: pysam.VariantRecord) -> List[Union[str, int]]: return [f for f in rec.filter] def _build_info(rec: pysam.VariantRecord) -> Dict[str, Any]: info = dict() for key, value in rec....
EUCANCan/variant-extractor
src/variant_extractor/variants.py
variants.py
py
8,031
python
en
code
3
github-code
36
35584359150
from zipfile import ZipFile import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split, cross_val_score from sklearn.preprocessing import StandardScaler i...
Kamkas/Bike-Sharing-Data-Analysis
lr.py
lr.py
py
2,416
python
en
code
0
github-code
36
70503976105
from __future__ import division class EstadisticaIII: def __init__(self,X,Y=[]): self.X = X self.Y = Y self.n = len(X) def Fn(self,y): return len([x for x in self.X if x<=y])/self.n def KS(self,F): Xi = sorted(self.X) Dn = [] for i in range(self.n): ...
aleespa/Estadistica-III-2019
Cรณdigo python/Clase.py
Clase.py
py
776
python
en
code
0
github-code
36
32892688817
import pickle import pandas as pd import mixmod from mixmod import gm # gm contains global constants (enum items etc.) def persist_strategy(): # -------------------------------------- # Strategy example : # - nbTry = 5 # - algo 1 : SEM (nb_iteration = 80) # - algo 2 : EM (epsilon=0.0001) # ...
mixmod/mixmod
Pymixmod/examples/persistence/persist_strategy.py
persist_strategy.py
py
1,692
python
en
code
3
github-code
36
31412134180
import sys input = sys.stdin.readline result = 0 def merge_sort(s, e):# ๋ณ‘ํ•ฉ์ •๋ ฌ global result if e-s < 1: return m = int(s+(e-s) / 2) merge_sort(s, m) merge_sort(m+1, e) for i in range(s, e+1): tmp[i] = A[i] k = s #A๋ฐฐ์—ด์—์„œ ์–ด๋А ์œ„์น˜์— index๊ฐ€ ๋“ค์–ด๊ฐ€๋Š”์ง€ index1 = s in...
ZzinB/Algorithm_Study
๋ฐฑ์ค€/Platinum/1517.โ€…๋ฒ„๋ธ”โ€…์†ŒํŠธ/๋ฒ„๋ธ”โ€…์†ŒํŠธ.py
๋ฒ„๋ธ”โ€…์†ŒํŠธ.py
py
1,121
python
ko
code
0
github-code
36
71910544423
from collections import OrderedDict from Models.Utils.FRRN_utils import * class FRRNet(nn.Module): """ implementation table A of Full-Resolution Residual Networks """ def __init__(self, in_channels=3, out_channels=21, layer_blocks=(3, 4, 2, 2)): super(FRRNet, self).__init__() # 5ร—5 ...
akshatgarg99/FRR-Net
Models/FRRN.py
FRRN.py
py
2,658
python
en
code
0
github-code
36
13320431649
import os import re clear = lambda: os.system('clear') data = "AAAX---aaax---111" exp = "\w+(?=X), \w+, \w+(?=\w)" txt='''\ \w+ : ๋ฌธ์ž(\w),1์ด์ƒ(+) (?=X) : ๋’ค์— ๋”ฐ๋ผ์˜ค๋Š”(?=) X๋ผ๋Š” ๊ฒƒ์„ ๋ฌธ์ž์—ด ๊ฒ€์ƒ‰์— ์“ฐ์ง€๋งŒ ๋งค์น˜๋Š” ๋˜์ง€ ์•Š์Œ \w+(?=X) : AAAX์—์„œ ๋ฌธ์ž๋“ค์ด ๋งค์น˜๋˜์ง€๋งŒ AAA๋งŒ ๋งค์น˜๋จ X๋Š” ์ œ์™ธ ์‹œํ‚ด X๋Š” X ์•ž์˜ ๋‹จ์–ด AAA๋ฅผ ์ฐพ๋Š”๋ฐ๋Š” ๊ธฐ์—ฌํ–ˆ์ง€๋งŒ ์ž์‹ ์€ ๋งค์น˜๋˜์ง€ ์•Š์Œ \w+ : (?=X)์—†์ด ํ•˜๊ฒŒ๋˜๋ฉด AAAX,aaax,111๊ณผ ๋งค์น˜๋จ \...
ipcoo43/pythonthree
lesson150.py
lesson150.py
py
855
python
ko
code
0
github-code
36
31981774021
#!/usr/bin/python3 def list_division(my_list_1, my_list_2, list_length): new_list = [] for n in range(list_length): try: a = my_list_1[n] / my_list_2[n] except(ZeroDivisionError): print("division by 0") a = 0 except(TypeError, ValueError): ...
osamuflair/alx-higher_level_programming
0x05-python-exceptions/4-list_division.py
4-list_division.py
py
506
python
en
code
0
github-code
36
37664896770
from page.E_confirm_order_page import ConfirmOrderPage class MyOrderPage(ConfirmOrderPage): """ๆˆ‘็š„่ฎขๅ•้กต้ข""" order_sn_loc = ('id', 'com.tpshop.malls:id/order_sn_tv') # ่ฎขๅ•็ผ–ๅท to_be_received_loc = ('id','com.tpshop.malls:id/status_receive_tv') # ๅพ…ๆ”ถ่ดง back_loc = ('id','com.tpshop.malls:id/title_back_img') # ...
15008477526/-
APP_aaaaaaaa/page/F_my_order.py
F_my_order.py
py
2,633
python
en
code
0
github-code
36
25947138248
# Definition for a Node. class Node: def __init__(self, val = 0, neighbors = None): self.val = val self.neighbors = neighbors if neighbors is not None else [] class Solution: def cloneGraph(self, node: 'Node') -> 'Node': if not node: return node stack = [node] ...
dzaytsev91/leetcode-algorithms
medium/133_clone_graph.py
133_clone_graph.py
py
694
python
en
code
2
github-code
36
4940941702
import pandas as pd dataPath = 'data/' # maps for converting BPS points scoringBpsMap = {'FWD': {'GKP': -12, 'DEF': -12, 'MID': -6, 'FWD': 0}, 'MID': {'GKP': -6, 'DEF': -6, 'MID': 0, 'FWD': 6}, 'DEF': {'GKP': 0, 'DEF': 0, 'MID': 6, 'FWD': 12}, 'GKP': {'GKP':0, 'DEF':...
vaastav/Fantasy-Premier-League
new_position_checker.py
new_position_checker.py
py
4,137
python
en
code
1,277
github-code
36
7803255026
import pprint def log(file_name="default.log", msg="Default text"): """ Logs the specified message to specified file. Overwrites the whole file each time """ f = open(file_name, "w+") pretty = pprint.pformat(msg) f.write(pretty) f.close() def perm_log(file_name="default.log", title="De...
errnox/ncurses-shenanigans
logger.py
logger.py
py
564
python
en
code
0
github-code
36
34998353566
""" Created on Thu Mar 17 16:34:46 2022 โ€‹ @author: svein """ import speech_recognition as sr import sounddevice as sd from scipy.io.wavfile import write import os import ffmpeg from scipy.io import wavfile import numpy as np def Speech_to_text(): myfile="output.wav" ## If file exists, delete it ## if os.p...
klarahi/Fuzzy_project
voice_recognition.py
voice_recognition.py
py
1,245
python
en
code
0
github-code
36
30629658909
#!/usr/bin/env python # coding: utf-8 # In[1]: import json, urllib import plotly.graph_objects as go import pandas as pd import numpy as np # In[2]: asi_measures = pd.read_csv('final-data.csv') asi_measures.head() # In[4]: all_nodes = asi_measures.Category.values.tolist() + asi_measures.ASI.values.tolist() s...
nikolamedi/sankey-diagram
Sankey diagram with plotly.py
Sankey diagram with plotly.py
py
912
python
en
code
0
github-code
36
38807417619
import csv ''' def leer_parque(nombre_archivo, parque): f = open(nombre_archivo) filas = csv.reader(f) data = [] encabezado = next(filas) for fila in filas: registro = dict(zip(encabezado, fila)) if registro['espacio_ve'] == parque: data.append(registro) return data...
AxelBelbrun/TP_LaboDeDatos
ejercicio_1&4.py
ejercicio_1&4.py
py
1,766
python
es
code
0
github-code
36
73550814184
#-*- coding: utf-8 -*- ''' 1. ๆทปๅŠ ็ณป๏ผšadddepartment 2. ๆทปๅŠ ็ญ็บง๏ผšaddclass 3. ๅˆ ้™ค็ณป๏ผšdeldepartment 4. ๅˆ ้™ค็ญ็บง๏ผšdelclass 5. ็ผ–่พ‘็ณป๏ผšeditdepartment 6. ็ผ–่พ‘็ญ็บง๏ผšeditclass ''' from django.shortcuts import render_to_response from django.template import RequestContext, Template, Context from classes.models import Class, Department from teachers.mo...
Luokun2016/QuickSort
classes/views.py
views.py
py
7,941
python
en
code
0
github-code
36
7822031293
import sys import heapq input = sys.stdin.readline N = int(input()) arr = [] #์ž…๋ ฅ for _ in range(N): arr.append(list(map(int, input().split()))) #ํšŒ์˜์‹œ๊ฐ„ ๊ธฐ์ค€ ์ •๋ ฌ arr.sort(key=lambda x: x[0]) rooms = [0] answer = 1 for s, e in arr: # ๊ฐ€์žฅ ๋น ๋ฅธ ํšŒ์˜ ์ข…๋ฃŒ ์‹œ๊ฐ„๋ณด๋‹ค array์˜ ํšŒ์˜ ์‹œ์ž‘ ์‹œ๊ฐ„์ด ๋Šฆ๊ฑฐ๋‚˜ ๊ฐ™๋‹ค๋ฉด if s >= rooms[0]: # ๊ทธ ํšŒ์˜...
Drizzle03/baekjoon_coding
20230123/19598_heapq.py
19598_heapq.py
py
736
python
ko
code
0
github-code
36
12685785417
import itertools from itertools import izip, cycle import os import string import glob from moduleBaseClass import ModuleBaseClass class XorStuff: def __init__(self, filepath=None): """Constructor : set xored file (optional) """ self.file_type = None self.list_types = self.load_f...
tengwar/xorstuff
xorstuff.py
xorstuff.py
py
4,032
python
en
code
0
github-code
36
10663941067
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Oct 21 16:38:00 2016 @author: Neo Oct 25, 2016: updated by Niu. """ import numpy as np import matplotlib.pyplot as plt res_dir = '../results/' dat_fil = ['OVrot.dat', 'GRrot.dat'] #glide for the three special catalog w3 = np.loadtxt(res_dir + 'Speci...
Niu-Liu/thesis-materials
sou-selection/progs/RotationPlot.py
RotationPlot.py
py
5,084
python
en
code
0
github-code
36
14432743893
print("genera lo numero del 1 al 10: ") input() lista = [0,1,2,3,4,5,6,7,8,9] numero = 1 range = (10) for numero in lista: print(numero)
toshio3024/programacion_visual
modulo1/ciclo_for/lista1_10.py
lista1_10.py
py
149
python
it
code
0
github-code
36
9896960203
#!/usr/bin/env python3 #-*- coding: utf-8 -*- import os import sys import rospy import numpy as np import cv2 from sensor_msgs.msg import Image, CompressedImage from cv_bridge import CvBridge, CvBridgeError from darknet_ros_msgs.msg import BoundingBoxes, ObjectCount class Bridge(object): """์••์ถ•๋œ ์ด๋ฏธ์ง€๋ฅผ ์„ผ์„œ ๋ฉ”์„ธ์ง€ ํ˜•ํƒœ๋กœ ...
Taemin0707/minibot_control
pedestrian_tracking/src/visualizing.py
visualizing.py
py
2,884
python
en
code
0
github-code
36
39642904721
""" CONTROLLER.PY The site controller controlls the production of the response for requests to the website. The controller creates and interacts with both, the SiteModel and the SiteViews. A call to the controller calls start_response and returns the contents of the response. Upgrade to multi-s...
berthoud/webfitsviewer
webfitsviewer/src/controller.py
controller.py
py
16,483
python
en
code
1
github-code
36
16539248084
import markovify import sys import argparse import configparser import twitter model_depth_default = 2 model_depth = model_depth_default def main(): arg_parser = argparse.ArgumentParser(description="Generate text with Markov chains based on a source corpus.") subparser = arg_parser.add_subparsers(dest="subparser_na...
nanovad/poorlytrained
poorlytrained.py
poorlytrained.py
py
2,216
python
en
code
0
github-code
36
42184120980
# encoding = utf-8 class FirstClass(): name = 'javaAndBidata' def javaAndBigdata_method(self): ''' ๆ–นๆณ•ๅฎšไน‰็š„ๆ—ถๅ€™ๅฟ…้กปๅญ˜ๅœจไธ€ไธชๅฝขๅ‚๏ผŒ้ป˜่ฎคไธบself๏ผŒๅฆๅˆ™ไผšๆŠฅ้”™ selfๅณไธบๅฏน่ฑกๆœฌ่บซ :return: ''' print("this is javaAndBigdata's method!!!") return self.name # ่กจๆ˜Žselfไธบๅฏน่ฑกๆœฌ่บซ @classmethod def...
helleboyboy/2022_pythonProj
com/study/MyFirstClass.py
MyFirstClass.py
py
793
python
en
code
0
github-code
36
39675510369
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from tensorflow.keras.applications.resnet_v2 import ResNet152V2, preprocess_input, decode_predictions from tensorflow.keras.preprocessing import image import numpy as np def classifyImg(img_path): img = image.load_img(img_path, target_size=(224, 224)) x = ima...
puneet4321/MachineLearning-DeepLearning
DeepLearning/TransferLearning.py
TransferLearning.py
py
852
python
en
code
0
github-code
36
22353260658
import torch from .logger_utils import get_logger import matplotlib.pyplot as plt import numpy as np import itertools logger = get_logger() def prediction(*, test_data, model, device): """Predict on test data and generate confusion matrix. Args: test_data (torch.utils.data.Dataset): Test dataset. ...
abhijitramesh/hpc-demo
utils/prediction_utils.py
prediction_utils.py
py
1,910
python
en
code
0
github-code
36
39154979229
from typing import Callable def format_number(number: int) -> str: num = float(f"{number:.3g}") magnitude = 0 format_human: Callable[[float], str] = lambda x: f"{x:f}".rstrip("0").rstrip(".") while abs(num) >= 1000: magnitude += 1 num /= 1000.0 return f"{format_human(num)}{['', ...
SkyLissh/skylet-discord
app/utils/format_number.py
format_number.py
py
358
python
en
code
0
github-code
36
8036114944
from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.urls import reverse from django.views import generic #from django.template import loader # no longer needed b/c of render shortcut from .models import Question, Choice # Create your views here. class Index...
Alex-Bishka/Languages
Django/mysite/polls/views.py
views.py
py
3,562
python
en
code
0
github-code
36
15193997907
from enum import Enum from dynsimf.models.helpers.ConfigValidator import ConfigValidator from dynsimf.models.components.conditions.Condition import Condition __author__ = "Mathijs Maijer" __email__ = "m.f.maijer@gmail.com" class UpdateType(Enum): ''' An Enum to specify the type of the update ''' STAT...
Tensaiz/DyNSimF
dynsimf/models/components/Update.py
Update.py
py
4,795
python
en
code
4
github-code
36
19199461708
from torch.utils.data import Dataset import numpy as np from pathlib import Path import pandas as pd import torch from dpipe.io import load_numpy class BraTSDataset(Dataset): def __init__(self, meta: pd.DataFrame, source_folder: [str, Path], nonzero_mask=False, transform=None): if isinstance(source_folder...
kurmukovai/hse_projects
2020/Anvar/data_loader.py
data_loader.py
py
1,392
python
en
code
1
github-code
36
11473243619
import os import zipfile from abc import ABCMeta from pathlib import Path from typing import Optional, Union from urllib.request import urlretrieve class BaseDownloader(metaclass=ABCMeta): """Base downloader for all Movielens datasets.""" DOWNLOAD_URL: str DEFAULT_PATH: str def __init__(self, zip_pa...
smartnews/rsdiv
src/rsdiv/dataset/base.py
base.py
py
876
python
en
code
7
github-code
36
22889942490
#!/usr/bin/env python import os import re import glob def printPackages(): paths = glob.glob(os.path.join('/usr/share', 'cmake*/Modules')) modules = [package for path in paths for package in os.listdir(path)] [print(module[4:-6]) for module in modules if re.search("^Find", module) and module[4:-6] != ''] ...
FredeEB/cmake-list-packages
cmake-list-packages.py
cmake-list-packages.py
py
392
python
en
code
0
github-code
36
41366597699
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os def MyPlotSO(CompMethod,trials,MaxFuncEvals,method,problem): ##% Plot figcount=0 Convergence = np.zeros((int(CompMethod.shape[0]/trials), MaxFuncEvals)) count=-1 for i in range(0,int(Co...
KZervoudakis/Mayfly-Optimization-Algorithm-Python
plotting.py
plotting.py
py
5,858
python
en
code
4
github-code
36
22968808073
import pickle import pandas as pd from rs import recommend_system def main(): data = pd.read_csv('data/ratings_train.csv') users = data.userId.tolist() items = data.movieId.tolist() ratings = data.rating.tolist() rec_sys = recommend_system(100) rec_sys.fit(users, items, ratings) with o...
kotsmile/test_task_repo
main1.py
main1.py
py
424
python
en
code
0
github-code
36
25374663372
def soma_vetores(vetor1: list, vetor2:list) -> list: vetor_soma = [] maior = max(len(vetor1), len(vetor2)) for i in range(maior): valor1 = vetor1[i] if i < len(vetor1) else 0 valor2 = vetor2[i] if i < len(vetor2) else 0 vetor_soma.append(valor1 + valor2) return vetor_soma l1 =...
ProfessorDudarts/Unasp-HT-2023.2
algoritmos_II/especial/ex02.py
ex02.py
py
384
python
pt
code
0
github-code
36
8366866522
import numpy as np import sofacontrol.utils as scutils from sofacontrol.mor import pod class LinearROM(): """ Linear ROM, written for compatibility with TPWL class """ def __init__(self, data, dt, Cf=None, Hf=None): if not isinstance(data, dict): data = scutils.load_data(data) ...
mdubied/soft-robot-control
sofacontrol/baselines/rompc/rompc_utils.py
rompc_utils.py
py
4,166
python
en
code
1
github-code
36
75162395624
import os class SwitchGenerator: _path = "src" _default_spec = { #letters_range : max_depth (2, 2) : 20, (3, 3) : 10, (4, 4) : 6, (5, 6) : 6, (7, 9) : 5, (10, 16) : 4, (17, 25) : 2, #(41, 128) : 2 } indent_str = " " endln = "\n...
datasig-ac-uk/esig
tools/switch_generator.py
switch_generator.py
py
7,018
python
en
code
37
github-code
36
21662366530
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @Time: 2020/4/5 21:14 # @Author: qyh import matplotlib.pyplot as plt import numpy.random as rdm import networkx as nx node_num = 100 probability = 0.01 er_graph = nx.erdos_renyi_graph(node_num, probability) susceptible = 'S' infected = 'I' recovered = 'R' ...
QCloudHao/COVID19
development.py
development.py
py
2,014
python
en
code
0
github-code
36
4063170648
from tkinter import * window = Tk() window.title("DOW") Label(window, text="", width=1).grid(row=0, column=0) Label(window, text=" Company:").grid(row=0, column=3, sticky=W) Label(window, text=" Industry:").grid(row=3, column=3, sticky=W) Label(window, text="Exchange:").grid(row=6, column=4, sticky=E) Label(window,...
guoweifeng216/python
python_design/pythonprogram_design/Ch8/8-2-E22.py
8-2-E22.py
py
1,340
python
en
code
0
github-code
36
22450428766
""" Team 46 Haoyue Xie 1003068 @Melbourne Jiayu Li 713551 @Melbourne Ruqi Li 1008342 @Melbourne Yi Zhang 1032768 @Melbourne Zimeng Jia 978322 @Hebei, China """ import json path = "E:/Unimelb/2020semester1/COPM90024 Cluster and Cloud Computing/assignment2/code/" filename = path + 'SA4_2016_AUST.json' with open(file...
yzzhan4/COMP90024-AuzLife
Create City_GeoJSON file/coordinates for cities.py
coordinates for cities.py
py
19,866
python
en
code
0
github-code
36
10586396443
class Option: def __init__(self, symbols, value): self.beats = None self.symbols = symbols self.value = value def score(self, other): if other == self: return self.value + 3 if self.beats == other: return self.value + 6 if other.beats == s...
chiptopher/advent-of-code-2022
day-2/part1.py
part1.py
py
986
python
en
code
0
github-code
36
19112292097
import torch as T import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np class DeepQNetwork(nn.Module): def __init__(self, lr, input_dims, fc1_dims, fc2_dims, n_actions): super(DeepQNetwork, self).__init__() self.input_dims = input_dims self.fc...
miczed/learny-mc-learnface
DQN/Examples/DQN_Lunar_MLwithPhil.py
DQN_Lunar_MLwithPhil.py
py
5,392
python
en
code
0
github-code
36
6671044786
from sense_hat import SenseHat from PIL import Image from random import randint import time sense = SenseHat() amount_of_pics = 3 while True: pic_nr = str(randint(1, amount_of_pics)) img = Image.open('pic'+pic_nr+'.png') byteList = list(img.getdata()) pixels = [] for index, byte in enumerate(byte...
gdmgent-IoT-1920/labo-2-sensehat-hansvertriest
avatar_animated.py
avatar_animated.py
py
425
python
en
code
0
github-code
36
73313388265
# %% import csv import sys import numpy as np import pandas as pd import os from matplotlib import pyplot as plt # plt.rcParams['font.sans-serif'] = ['Times New Roman'] # ๆ‰พๅˆฐๅ…จๅฑ€ๆœ€ไผ˜ 10 20 41 # ไธๆ–ญๆ‰พๅˆฐๆœ€ไผ˜ 15 34 filename1 = "results/Cifar10-center/LeNet/record_sgd weight.csv" filename2 = "results/Cifar10-center/LeNet/recor...
zhengLabs/FedLSC
painting/painting_weight_change.py
painting_weight_change.py
py
1,279
python
en
code
1
github-code
36
18482251122
import math import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(inplanes, inplanes, 1, stride, bias=False) self.bn1 = nn....
TWSFar/DSSD
model/decoder.py
decoder.py
py
3,824
python
en
code
8
github-code
36
27912151130
import boto3 import pg8000 import datetime import json import time # Create an S3 client s3 = boto3.client('s3') # Create a CloudWatch client cloudwatch = boto3.client('cloudwatch') def ingest_database_to_s3(bucket_name): # Retrieve the database connection details from AWS Secrets Manager secretsmanager = bo...
vasilecondrea/lake-cabin-project
extract/src/extract.py
extract.py
py
4,151
python
en
code
1
github-code
36
15065246438
import asyncio import base64 import collections import json import struct import sys import aiohttp import pytest import six from pytest_httpserver import RequestHandler import consul import consul.aio Check = consul.Check @pytest.fixture def local_server(httpserver): from pytest_httpserver import RequestHandl...
poppyred/python-consul2
tests/test_aio.py
test_aio.py
py
10,482
python
en
code
125
github-code
36
15083780449
import ray import numpy as np import gym import tensorflow as tf import tensorflow.contrib.slim as slim import time import sys sys.path.insert(0, "/home/ubuntu/pong_py") from pongjsenv import PongJSEnv ray.init(num_workers=0) n_obs = 8 # dimensionality of observations n_h = 256 # number of h...
robertnishihara/ray-tutorial-docker
rl_exercises/pong_py_no_git/pong_py/parallel_train.py
parallel_train.py
py
4,946
python
en
code
8
github-code
36
23751441892
import os import argparse import matplotlib.pyplot as plt from matplotlib import cm import torch import numpy as np import statistics as st import csv import seaborn as sns from timeseries import EchoCard from quality_classification import predict_single as predict_acq from quality_classification import CardioNet fro...
HelmholtzAI-Consultants-Munich/Echo2Pheno
Module I/run4single.py
run4single.py
py
25,479
python
en
code
1
github-code
36
9135106371
#!/usr/bin/env python3 import sqlite3 def nice_print(sql_table): """ used to show information in a slightly more readable fashion""" for row in sql_table: row_string = map(str,row) pretty_row = '\t\t'.join(list(row_string)) print(pretty_row) conn = sqlite3.connect('northwind.sqlite3'...
Tclack88/Lambda
DS-3-2-SQL-and-Databases/sc/northwind.py
northwind.py
py
2,024
python
en
code
0
github-code
36
39842034728
class Node(object): def __init__(self, connections, status, distance): self.connections = connections self.status = status self.distance = distance def merge(self, other): self.connections.union(other.connections) self.distance = min(self.distance, other.distance) ...
mingruilyu/spark-examples
social-networks/node.py
node.py
py
716
python
en
code
0
github-code
36
40066321475
import pandas as pd from decouple import config import numpy as np import os import nilearn.image as img from nilearn.glm.second_level import non_parametric_inference import nibabel import argparse def options() -> dict: ''' Function to accept accept command line flags. Needs -t for task name and -p for n...
WMDA/socio-emotion-cognition
task_fmri/modelling/nilearn_notebooks/second_level_group_differences_nilearn.py
second_level_group_differences_nilearn.py
py
5,119
python
en
code
0
github-code
36
7413102812
"""Sorts duplicate photos/files and places all copies in their own folder.""" import click import halo from hashlib import sha256 from pathlib import Path from shutil import copyfile, move """ Return the SHA256 sum of the provided file name. :param file_name - Name of the file to check :return Hexdigst of SHA sum "...
poiriermike/sort_dup_photos
sort_dupes.py
sort_dupes.py
py
1,698
python
en
code
0
github-code
36
33531980673
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Lucas Sinclair and Paul Rougieux JRC biomass Project. Unit D1 Bioeconomy. """ # Built-in modules # # Third party modules # # First party modules # import autopaths from autopaths import Path from autopaths.auto_paths import AutoPaths from aut...
xapple/cbmcfs3_runner
cbmcfs3_runner/scenarios/base_scen.py
base_scen.py
py
4,131
python
en
code
2
github-code
36
14975602029
import os import codecs try: from setuptools import (setup, find_packages) except ImportError: from distutils.core import (setup, find_packages) VERSION = (0, 2, 0) __version__ = '.'.join(map(str, VERSION[:3])) + "".join(VERSION[3:]) __package_name__ = 'pelican-readtime' __description__ = 'Plugin for Pelica...
JenkinsDev/pelican-readtime
setup.py
setup.py
py
2,230
python
en
code
11
github-code
36
21811338637
from elasticsearch import Elasticsearch from services.caption_processor import split_captions es = Elasticsearch() def index_captions(captions, video_id): for ctime, ctext in split_captions(captions): doc = { 'time': ctime, 'text': ctext, 'video': video_id } ...
veotani/youtube-caption-search
server/services/caption_indexator.py
caption_indexator.py
py
696
python
en
code
0
github-code
36
17122612080
# import the packages import matplotlib.pyplot as plt import networkx as nx # Define the data structures of vertices and edges vertices = range(1, 10) edges = [(7, 2), (2, 3), (7, 4), (4, 5), (7, 3), (7, 5), (1, 6), (1, 7), (2, 8), (2, 9)] # Let's first instantiate the graph G = nx.Graph() # let's draw the gr...
amrmabdelazeem/40-Algorithms-to-Know
Fraud Analytics.py
Fraud Analytics.py
py
1,258
python
en
code
0
github-code
36
3984159879
from django.http import HttpResponse from django.shortcuts import render from .models import * def home_view(request): names = ['Jitendra', 'Rimaljit', 'Mohit', 'Deepak'] address = ['Chandigarh', 'Ludhiana', 'Ludhiana', 'Ludhian'] info = zip(names, address) data = { 'info': info }...
jitendra5581/cms-training
studentapp/views.py
views.py
py
1,601
python
en
code
0
github-code
36
31061471225
from ..utils import Object class GetLanguagePackStrings(Object): """ Returns strings from a language pack in the current localization target by their keys. Can be called before authorization Attributes: ID (:obj:`str`): ``GetLanguagePackStrings`` Args: language_pack_id (:obj:`str`...
iTeam-co/pytglib
pytglib/api/functions/get_language_pack_strings.py
get_language_pack_strings.py
py
1,077
python
en
code
20
github-code
36
29265995758
"""Tools for looking for instances of godaddy cookie stuffing in individual and collections of BroRecords.""" import re from .affiliate import AffiliateHistory, FULL_DOMAIN class ClickCashAffiliateHistory(AffiliateHistory): @classmethod def checkout_urls(cls): """Returns a list of strings, each of w...
pes10k/bro-tools
stuffing/clickcash.py
clickcash.py
py
1,492
python
en
code
0
github-code
36
14489788093
# Lab 24 - Rain Data import datetime import matplotlib.pyplot as plt def open_file(): """opens the file and returns its contents as a list separated by each row""" with open('lab24_ankeny_rain.txt', 'r') as data: return data.read().split("\n") def get_dates(data): """accepts data and returns a list of just...
mjhcodes/pdxcodeguild
python/lab24.py
lab24.py
py
2,881
python
en
code
0
github-code
36
69864473703
from deep_introspection import network, synthesis, utils import numpy as np import matplotlib.pyplot as plt def test_synthesise_loss_is_low(): net = network.CaffeNet('deep_introspection/test/VGG.prototxt', 'deep_introspection/test/VGG_ILSVRC_16_layers.caffemodel') img, offset, resFac, newSize = utils.imgPrepro...
onorton/deep_introspection
deep_introspection/test/test_synthesis.py
test_synthesis.py
py
1,610
python
en
code
0
github-code
36
29432851011
from asyncore import read #JMP:xkalou03 __author__ = 'xkalou03' import sys import argparse import re import reader import table def checkParameters(): parser = argparse.ArgumentParser(description = 'Projekt do IPP.', add_help = False) parser.add_argument('--help', action = "count", default = 0, help = 'P...
Strihtrs/IPP_Projects
JMP/jmp.py
jmp.py
py
4,768
python
en
code
0
github-code
36
184316917
# coding: utf-8 # device: Mi8SE # screen: 2244x1080 # adb support # open USB debugging and allow simulating input via USB debugging import os import time fir_in_button_x, fir_in_button_y = 1485, 870 # first button, click to start check_in_button_x, check_in_button_y = 1400, 750 # dialog๏ผš่‹ฑ้›„ไธ่ถณไธ‰ไธชๆ˜ฏๅฆ็ปง็ปญ time_waiting = 13...
qlindazm/coinCollector
coinCollector.py
coinCollector.py
py
2,423
python
en
code
1
github-code
36
6543350552
#Avoid Duplicates print("Enter a list of words; press the enter button twice to finish>>") words = []#List while True:#Collects words from the user. word = input() if word not in words:#If the word entered doesn't already exist in the list, append it to the list. words.append(word) ...
law35/bitwisetechtips-final
media/python/files/duplicates.py
duplicates.py
py
437
python
en
code
0
github-code
36
12718727003
a="" # infix to postfix conversion def infix_to_postfix(infix): prec = {} prec["*"] = 3 prec["/"] = 3 prec["+"] = 2 prec["-"] = 2 prec["("] = 1 op_stack = [] postfix_list = [] token_list = infix.split() for token in token_list: if token in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" or...
beetrandahiya/python-upes
stackappln.py
stackappln.py
py
988
python
en
code
2
github-code
36
2404877114
''' This library is compouse of the units that we are going to adopt for the different magnitudes ''' # Magnitudes r = 10**10 #cm (radius) P = 10**15 #din cmโˆ’2 (pressure) T = 10**7 #K (temperatura) M = 10**33 #g (mass) L = 10**33 #erg sโˆ’1 (luminosity) rho = 1 #g cmโˆ’3 (density) epsilon = 1 #erg gโˆ’1 sโˆ’1 (en...
javiisebas/TFG
python-scripts/Initial_Parameters.py
Initial_Parameters.py
py
773
python
en
code
0
github-code
36
30684906195
""" Python data structures and algo practice """ class Node: """ Basic node object type left_node ==> memory pointer for binary tree example right_node ==> memory pointer for binary tree example next_node ==> memory pointer for queue / stack examples data ==> simple value (int) """ def __init__(self...
keeganridgley107/CompSci-Py
main.py
main.py
py
5,520
python
en
code
0
github-code
36
15783422482
# -*- coding: utf-8 -*- """ Created on Sat May 8 12:16:46 2021 @author: tamon """ import csv import numpy as np from scipy.interpolate import griddata from scipy.interpolate import interp1d import matplotlib.pyplot as plt radius = [] angles = [] points = [] result = [] with open('angrad.csv', new...
Maselko/individual-project
Angrad.py
Angrad.py
py
4,228
python
en
code
0
github-code
36
21195656811
import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='snmpdesk', version='0.0.91', description='Scripts for easy get snmp data', author='Svintsov Dmitry', author_email='spam@19216801.ru', url='http://github.c...
uralbash/snmpdesk
setup.py
setup.py
py
927
python
en
code
5
github-code
36
31026501229
board=["-","-","-","-","-","-","-","-","-"] current_player='X' game_is_on=True winner=None print('WELCOME') print("Let's play Tic Tac Toe") print('Plz give the reqiured detail') player1=input('Player 1 name:') player2=input('Player 2 name:') current_name=player1 print(player1 + ' has been assigned with X')...
meetshah129/py
Project.py
Project.py
py
3,835
python
en
code
0
github-code
36
73479278505
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2016, Daisuke Cato <daisuke.cato@gmail.com>' __docformat__ = 'restructuredtext en' try: fr...
dcato/bibi_calibre
config.py
config.py
py
1,698
python
en
code
0
github-code
36
16128248265
import functools from importlib import import_module from pyws.public import InvalidPath def route(path): def wrapper(func): @functools.wraps(func) def _wrapper(*args, **kwargs): return func(*args, **kwargs) _wrapper.__route__ = path return _wrapper return wrapp...
czasg/ScrapyLearning
czaSpider/dump/bootstrap_test/blogs_v1/pyws/route.py
route.py
py
1,042
python
en
code
1
github-code
36
6410410688
import random import os import argparse from typing import DefaultDict # from paper "Learning Unknown from Correlations: # Graph Neural Network for Inter-novel-protein Interaction Prediction" standard_acids = [ ('A', 1), ('C', 6), ('D', 5), ('E', 7), ('F', 2), ('G', 1), ('H', 4), ('I', 2), ('K', 5), ...
LtECoD/PPITrans
data/dscript/builddataset.py
builddataset.py
py
5,962
python
en
code
4
github-code
36
25046698571
#!/usr/bin/python import json import re import os import sys # Get data.json from Twitter for # Followers: https://oauth-playground.glitch.me/?id=usersIdFollowers&params=%28%27user.fields%21%27description%27%29_ # Followings: https://oauth-playground.glitch.me/?id=usersIdFollowing&params=%28%27user.fields%21%27descr...
tjosten/twitter-mastodon-finder
finder.py
finder.py
py
983
python
en
code
0
github-code
36
36947645839
__revision__ = "src/engine/SCons/Tool/JavaCommon.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan" import os import os.path import re import glob java_parsing = 1 default_java_version = '1.4' # a switch for which jdk versions to use the Scope state for smarter # anonymous inner class parsing....
mongodb/mongo
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/JavaCommon.py
JavaCommon.py
py
17,551
python
en
code
24,670
github-code
36
27194927025
import logging import numpy as np from sklearn.model_selection import train_test_split, StratifiedKFold from utils import logging as lg from heatmap_tutorial import utils as ht_utils lg.set_logging() def get_mnist(dataset, dir_path='./data/mnist'): if dataset == 'train': prefix = 'train' elif dat...
p16i/thesis-designing-recurrent-neural-networks-for-explainability
src/utils/data_provider.py
data_provider.py
py
17,506
python
en
code
14
github-code
36
28555182089
# This is a sample Python script. # Press โŒƒR to execute it or replace it with your code. # Press Double โ‡ง to search everywhere for classes, files, tool windows, actions, and settings. import sys import asyncio import datetime import time import collections import json # function to execute aws cli 'iam' command async...
SeungwookE/InvalidAccessKeyDetector
main.py
main.py
py
3,645
python
en
code
0
github-code
36
11130997604
import csv import os from flask import Blueprint, redirect, render_template, request import sqlalchemy from forms.addTeacherForm import AddTeacherForm from models import GroupOfTeacher, Teacher, TeacherInGroup, db from forms.editForm import EditTeacherForm ROWS_PER_PAGE = 5 teachers_blueprint = Blueprint("teachers_b...
IngNoN/School_App
controllers/teachers.py
teachers.py
py
4,762
python
en
code
0
github-code
36
22706853086
import code import gym import torch from tqdm import trange import numpy as np import components.prioritized_memory import components.memory from components.filesys_manager import ExperimentPath class BaseTrainer: def __init__(self, args): # init experiment hyper-parameters self.args = args ...
APM150/Continuous_Envs_Experiments
mujoco/trainers/base_trainer.py
base_trainer.py
py
10,727
python
en
code
0
github-code
36
39055642818
#!/usr/bin/env python from __future__ import print_function import os, sys, json import numpy as np from ase.build import bulk, surface from ase.units import Rydberg, Bohr from ase.io import read from ase.visualize import view from ase.spacegroup import crystal from ase.calculators.espresso import Espresso infile...
marshallmcdonnell/sno2_ase_espresso
surfaces/surfaces_sno2.py
surfaces_sno2.py
py
2,092
python
en
code
0
github-code
36
71038521063
import numpy as np try: import mc except Exception: pass import cv2 import os from PIL import Image import torch from torch.utils.data import Dataset import torchvision.transforms as transforms import utils from . import reader class PartialCompDataset(Dataset): def __init__(self, config, phase): ...
XiaohangZhan/deocclusion
datasets/partial_comp_dataset.py
partial_comp_dataset.py
py
6,088
python
en
code
764
github-code
36
27521291277
from pyspark.sql import SparkSession from pyspark.sql import functions as fs spark= SparkSession.builder.appName("word_count").getOrCreate() data= spark.read.text("book.txt") pro_data= data.select(fs.explode(fs.split(data.value,"\\W+")).alias("words")) pro_data.filter(pro_data.words !="") a=pro_data.select("words")...
AmanSolanki007/Pyspark_problems
word_count_dataframe.py
word_count_dataframe.py
py
353
python
en
code
0
github-code
36
74120455144
import pygame from constantes import * from auxiliar import Auxiliar class Background: ''' Clase para representar un fondo en un juego utilizando Pygame. Attributes: x (int): La coordenada x de la esquina superior izquierda del fondo. y (int): La coordenada y de la esquina superior izquier...
valverdecristian/cristian_valverde_tp_pygame
background.py
background.py
py
1,080
python
es
code
0
github-code
36
33066511083
""" enums.py Contains the different types of objects for the application. """ # Import modules and libraries from enum import Enum class UserType(Enum): """ Represents the different types of users in the application. """ admin = "admin" manager = "manager" inspector = "inspector" maintenan...
Xata/cis4050-spring2023-prototipo
backend/app/enums.py
enums.py
py
1,280
python
en
code
0
github-code
36
71534616424
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from icalendar import Calendar, Event from datetime import * from dateutil.parser import parse from pytz import UTC # timezone cal_file = '/Users/gyyoon/Desktop/pentaa.ics' MEETING_STR = '[ํšŒ์˜]' TEATIME_STR = '[Tea-Time]' WORK_STR = '[์—…๋ฌด]' NONWORK_STR = '[๋น„์—…๋ฌด]' LUNCH_ST...
Dry8r3aD/ics_parser
run.py
run.py
py
8,555
python
en
code
0
github-code
36
3383079371
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: output = [] q = collections.deque() # index l = r = 0 # O(n) O(n) while r < len(nums): # pop smaller values from q while q and nums[q[-1]] < nums[r]: q.p...
neetcode-gh/leetcode
python/0239-sliding-window-maximum.py
0239-sliding-window-maximum.py
py
582
python
en
code
4,208
github-code
36
2760395481
import os from datetime import datetime, timedelta from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials import googleapiclient.discovery import googleapiclient.errors import httplib2.error import youtube_dl import log...
vachau/youtube-restreamer
utils/apis.py
apis.py
py
12,777
python
en
code
6
github-code
36
30055311792
from collections import defaultdict import os import pandas as pd path = '/home/djf/djf/POI/CDRF/data/Foursquare_NYC.txt' dic = defaultdict(int) f = open(path, 'r') lines = f.readlines() for line in lines: user, t, lat, lon, POI = line.strip().split('\t') dic[int(POI)] += 1 counts = [item[1] for item in...
Mediocre250/CTMR
long_tail.py
long_tail.py
py
462
python
en
code
0
github-code
36
16154091028
from django.contrib import admin from .models import InstrumentItem # Register your models here. class InstrumentItemAdmin(admin.ModelAdmin): search_fields = ['definition'] list_filter = ['instrument'] list_display = ['definition','instrument','discrimination','difficulty','guessing','upper_asymptote'] ad...
langcog/web-cdi
webcdi/cdi_forms/cat_forms/admin.py
admin.py
py
375
python
en
code
7
github-code
36
37213151621
#!/usr/bin/env python3 import argparse from pprint import pprint import json import hlib def check_temp(cl, device_id): device_name = None # first, try and find the device as a device url = f"/clip/v2/resource/device/{device_id}" resp = cl.get(url) if resp.status_code == 200: ...
parlaynu/hue-utilities
bin/check-temp.py
check-temp.py
py
2,946
python
en
code
0
github-code
36
10423506179
# coding: utf-8 import xlrd def getProgramList(filepath): program_list = dict() program_list[u'็ฝ‘็ปœๅ‰ง'] = [] program_list[u'็ฝ‘็ปœ็”ตๅฝฑ'] = [] program_list[u'็ฝ‘็ปœ็ปผ่‰บ'] = [] data = xlrd.open_workbook(filepath) table = data.sheet_by_name(u'็ฝ‘็ปœๅ‰ง') nrows = table.nrows ncols = table.ncols for i in range(2, nrows): one_p...
LayneIns/CrawlerProject
crawl2/dataHelper/fetchProgram.py
fetchProgram.py
py
1,465
python
en
code
1
github-code
36
41896395893
import cv2 import numpy as np import csv import math img = cv2.imread(".//new_dataset//250.jpg") img = cv2.GaussianBlur(img , (5 , 5) , 0) n = 64 div = 256//n #n is the number of bins, here n = 64 rgb = cv2.split(img) q = [] for ch in rgb: vf = np.vectorize(lambda x, div: int(x//div)*div) quanti...
kumar6rishabh/cbir-search-engine
ccv_searcher.py
ccv_searcher.py
py
1,968
python
en
code
0
github-code
36
15733506905
__docformat__ = "reStructuredText" __author__ = "davidh" import logging import os import re import sys from collections import namedtuple from datetime import datetime, timedelta from glob import glob LOG = logging.getLogger(__name__) FILENAME_RE = r"HS_H08_(?P<date>\d{8})_(?P<time>\d{4})_(?P<band>B\d{2})_FLDK_(?P<r...
ssec/sift
uwsift/project/organize_data_topics.py
organize_data_topics.py
py
6,413
python
en
code
45
github-code
36
5741967370
import os import pandas as pd from sklearn.model_selection import KFold, train_test_split root_path = os.path.dirname(__file__) asset_path = os.path.join(root_path, '../assets') # load the full titanic example data data = pd.read_csv(os.path.join(root_path, '../data/train.csv')) # train / test split train_data, tes...
Esadruhn/owkin_elixir_hackathon
substra_materials/titanic_example/titanic/scripts/generate_data_samples.py
generate_data_samples.py
py
1,475
python
en
code
1
github-code
36
14940809637
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys try: import petsclinter as pl except ModuleNotFoundError as mnfe: try: petsc_dir = os.environ['PETSC_DIR'] except KeyError as ke: raise RuntimeError('Must set PETSC_DIR environment variable') from ke sys.path.insert(0, os.path.join(pets...
firedrakeproject/slepc
lib/slepc/bin/maint/slepcClangLinter.py
slepcClangLinter.py
py
3,156
python
en
code
2
github-code
36