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
75118121702
""" Objet Contact représentant un contact de l'Annuaire Author: Tristan Colombo <tristan@gnulinuxmag.com> (@TristanColombo) Date: 17-12-2015 Last modification: 17-12-2015 Licence: GNU GPL v3 (voir fichier gpl_v3.txt joint) """ import sqlite3 import pystache import o...
GLMF/GLMF190
Dev/interface_CLI/etape_2/Contact.py
Contact.py
py
4,342
python
en
code
0
github-code
36
33529817847
from tkinter import * import tkinter.messagebox as msg import random import os n1 = random.randint(0, 9999999999999) n2 = random.randint(0, 1000) def file_clearer(): main_folder_clear = open('Mainfoldernames.txt', 'w') main_folder_clear.write('') main_folder_clear.close() sub_folder_clear = open('Sub...
ravisharma87/Python-prohjects
folder maker path version.pyw
folder maker path version.pyw
pyw
4,740
python
en
code
1
github-code
36
23507472501
# implementing pymoo multi-objective optimization with FEniCS FEA objectives import numpy as np import matplotlib.pyplot as plt from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, AnnotationBbox import pathlib from pathlib import Path from pymoo.core.problem import ElementwiseProblem from pymoo.algor...
grohalex/Project2023
Python/main.py
main.py
py
7,557
python
en
code
0
github-code
36
39047349636
'''Tests for the classification module.''' import pytest import torch import torch.nn as nn from torch.utils.data import TensorDataset, DataLoader from sklearn.model_selection import train_test_split from torchutils.classification import Classification @pytest.fixture(params=[1, 10]) def data_num_features(request):...
joseph-nagel/torchutils
tests/test_classification.py
test_classification.py
py
2,598
python
en
code
0
github-code
36
14484717443
import cv2 as cv import numpy as np left_window = 'Task 4 - left' right_window = 'Task 4 - right' # create window for left camera cv.namedWindow(left_window) # create window for right camera cv.namedWindow(right_window) # read in imagaes img_l = cv.imread('imgs/combinedCalibrate/aL09.bmp') img_r = cv.imread('imgs...
mjhaskell/EE_631
HW3/task4.py
task4.py
py
1,954
python
en
code
0
github-code
36
6380032523
from functools import partial import chex import jax import numpy as np import numpy.testing as npt from absl.testing import parameterized from tessellate_ipu import tile_map, tile_put_replicated from tessellate_ipu.lax import scatter_add_p, scatter_max_p, scatter_mul_p, scatter_p class IpuTilePrimitivesLaxScater(c...
graphcore-research/tessellate-ipu
tests/lax/test_tile_lax_scatter.py
test_tile_lax_scatter.py
py
2,847
python
en
code
10
github-code
36
28799587509
import json import os import pickle import numpy as np from pprint import pprint winningRuns, losingRuns, cards, relics, X, Y = None, None, None, None, None, None cwd = os.path.dirname(__file__) pathToData = os.path.join(cwd, '..', 'Data') #Parses the wins and loses from the dump file def loadFromFile(winsPath, ...
kenttorell/MLFinal_StS
Code/LoadData.py
LoadData.py
py
4,299
python
en
code
0
github-code
36
73495691624
import pygame as pg import ChessEngine import os from itertools import cycle from copy import deepcopy pg.init() pg.mixer.init() ROOT_DIR = os.path.dirname(__file__) IMAGE_DIR = os.path.join(ROOT_DIR, 'images') WIDTH = HEIGHT = 512 DIMENSION = 8 SQ_SIZE = HEIGHT // 8 MAX_FPS = 15 IMAGES = {} WHITE = (215,215,215) BLAC...
GracjanPW/Chess
Chess/ChessMain.py
ChessMain.py
py
4,586
python
en
code
0
github-code
36
12365024277
from conv_net.networks.net3 import Network as Net3 from conv_net.networks.net7 import Network as Net7 from conv_net import deep from read_files import Dataset from conv_net.utils import log from conv_net.crossval import crossvalidation import csv if __name__ == "__main__": log("Reading dataset. ") size = 30000...
gozmo/diabetes
diabetes_make_submission.py
diabetes_make_submission.py
py
1,087
python
en
code
0
github-code
36
16775198576
from rest_framework.decorators import api_view, permission_classes from rest_framework import generics from lembaga.models import Lembaga, Institusi, Tema from lembaga.serializers import LembagaSerializer, InstitusiSerializer, TemaSerializer from rest_framework.permissions import AllowAny from rest_framework.response i...
ferenica/sipraktikum-backend
lembaga/views.py
views.py
py
2,986
python
en
code
0
github-code
36
20888932352
def percentage(num_line, den_line): num_parts = num_line.split(',') den_parts = den_line.split(',') #print den_parts[0] + ' , ' + num_parts[0] return 100 * float(num_parts[0]) / float(den_parts[0]) # Open the data files f = open('perf.data', 'r') cf = open('cache-miss-percentage.data', 'w') bf = ope...
bufas/ae14
h2/bench/test.py
test.py
py
1,598
python
en
code
0
github-code
36
73118929704
import os import tempfile class WrapStrToFile: def __init__(self): # здесь инициализируется атрибут filepath, он содержит путь до файла-хранилища self._filepath = tempfile.mktemp() print(self._filepath) @property def content(self): try: with open(self._filepath...
IlyaOrlov/PythonCourse2.0_September23
Practice/mtroshin/Lecture_7/3.py
3.py
py
1,099
python
ru
code
2
github-code
36
3023655025
import os from PIL import Image import PIL.ImageOps import argparse import torchvision as V import matplotlib.pyplot as plt import ujson as json import glob import re from . import configs import rich from rich.progress import track console = rich.get_console() def cifar10_burst(dest: str, split: str): assert(spli...
cdluminate/MyNotes
rs/2022-veccls/veccls/cifar10.py
cifar10.py
py
1,809
python
en
code
0
github-code
36
43131754181
from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor,as_completed,wait from concurrent import futures import time import requests # 官方文档:https://docs.python.org/zh-cn/3.8/library/concurrent.futures.html#module-concurrent.futures urls = ['http://www.tencent.com','http://www.google.com/','http://www.ku...
melody27/python_script
thread_process_futures/concurrent.futures_test.py
concurrent.futures_test.py
py
2,510
python
zh
code
0
github-code
36
38684672986
# These URLs basically points to MIT's conceptnet5 setup for Web API # BASE_LOOKUP_URL = 'http://api.conceptnet.io' # BASE_SEARCH_URL = 'http://api.conceptnet.io/query' # BASE_ASSOCIATION_URL = 'http://api.conceptnet.io/related' # if build locall ,use those BASE_LOOKUP_URL = 'http://127.0.0.1:8084' BASE_SEARCH_URL = '...
zhouhoo/conceptNet_55_client
conf/settings.py
settings.py
py
5,138
python
en
code
3
github-code
36
6913776937
# -*- coding: utf-8 -*- """ Created on Tue Aug 24 19:55:28 2021 @author: jon-f """ import numpy as np import matplotlib.pyplot as plt import os from skimage.transform import resize def binary_array_to_hex(arr): bit_string = ''.join(str(int(b)) for b in arr.flatten()) width = int(np.ceil(len(bit_string)/4)) retur...
triviajon/jonbot
to_hash_thing.py
to_hash_thing.py
py
2,180
python
en
code
0
github-code
36
74517025384
#!/usr/bin/env pythonimport coliche, os import bn.bn def bn2dot(bnfile, outfile, vdfile=None, loners=False, center=None, awfile=None): # give None to outfile to get string back dotbuffer = [] bns = bn.bn.load(bnfile, False) varc = bns.varc arcs = bns.arcs() names = vdfile \ ...
tomisilander/bn
bn/util/bn2dot.py
bn2dot.py
py
1,917
python
en
code
1
github-code
36
129847267
from django.shortcuts import render, get_object_or_404 from .models import Post, Category, User from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from taggit.models import Tag from django.db.models import Count from django.utils import timezone def post_list(request, tag_slug=None): posts =...
open-apprentice/ellieplatform-website
blog/views.py
views.py
py
2,992
python
en
code
1
github-code
36
38622940273
"""Platform for sensor integration.""" import logging from datetime import datetime from .const import ( DOMAIN, MODEM_GATEWAY, EVT_MODEM_CONNECTED, EVT_MODEM_DISCONNECTED, EVT_LTE_CONNECTED, EVT_LTE_DISCONNECTED, SENSOR_LASTUPD ) from homeassistant.components.binary_sensor import ( ...
vladkozlov69/homeassistant_modem
binary_sensor.py
binary_sensor.py
py
5,944
python
en
code
1
github-code
36
1842906521
#every day coding test 2018.07.09 [!] ''' Q : Given an integer N, find the number of possible balanced parentheses with N opening and closing brackets. ''' import copy # DUMMY = [4] DUMMY = [1, 2, 3] G_list = [] G_Question = None def combination_rule(past_list): ''' 1. just condition check. 1. exit c...
jaeyongkim/practice_JY
practice_3_brackets_combination.py
practice_3_brackets_combination.py
py
1,188
python
en
code
1
github-code
36
74512115622
import cv2 import numpy as np import matplotlib.pyplot as plt img1 = cv2.imread('shanghai-11.png') img2 = cv2.imread('shanghai-12.png') img3 = cv2.imread('shanghai-13.png') plt.figure(1) plt.subplot(131), plt.imshow(img1, cmap='gray'), plt.title("Image 1") plt.subplot(132), plt.imshow(img2, cmap='gray'), pl...
costinchican/computer_vision
App2/app2.py
app2.py
py
8,599
python
en
code
0
github-code
36
24788288939
from typing import List """ Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is a contiguous part of an array. """ class Solution: def maxSubArray(self, nums: List[int]) -> int: dp = [nums[0]] # res...
inhyeokJeon/AALGGO
Python/LeetCode/dp/53_maximum_subarr.py
53_maximum_subarr.py
py
680
python
en
code
0
github-code
36
27141705447
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/22 12:54 # @Author : Ryu # @Site : # @File : yibu.py # @Software: PyCharm import asyncio,aiohttp import time import requests async def f1(url): async with aiohttp.ClientSession() as session: async with session.get(url) as resp: ...
yuzhema/crawer
day08/yibu.py
yibu.py
py
805
python
en
code
0
github-code
36
42600271957
import openpyxl import os, string, sys from lib import l DIRS_SOCIUM = ['/media/da3/asteriskBeagleAl/Socium/2017/', '/media/da3/asteriskBeagleAl/Socium/2018/'] def isSNILS(snils): if snils != None: t = str(snils).replace('\n',' ').replace(' ', ' ').replace(' ', ' ').replace(' ', ' ').strip() if...
dekarh/asocium
asocium_loaded.py
asocium_loaded.py
py
6,570
python
en
code
0
github-code
36
2187178006
import numpy as np from scipy.spatial.distance import cdist from scipy.optimize import linprog from functools import partial import itertools def sparse_jump(Y, n_states, max_features, jump_penalty=1e-5, max_iter=10, tol=1e-4, n_init=10, verbose=False): # Implementation of sparse jump model n_o...
Yizhan-Oliver-Shu/continuous-jump-model
regime/.ipynb_checkpoints/sparse_jump-checkpoint.py
sparse_jump-checkpoint.py
py
11,123
python
en
code
3
github-code
36
34701767455
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('login', '0002_usuario_nome'), ] operations = [ migrations.RenameField( model_name='usuario', old_nam...
andersonfantini/example-django-social-login
login/migrations/0003_auto_20150213_1520.py
0003_auto_20150213_1520.py
py
380
python
en
code
1
github-code
36
10084248761
import sys input = sys.stdin.readline def dfs(x, y): stack = [] stack.append((x, y)) while stack: for i in range(8): nx = x + dx[i] ny = y + dy[i] if 0<=nx<h and 0<=ny<w and arr[nx][ny] == '1': stack.append((x, y)) arr[nx][ny] = '...
papillonthor/Cool_Hot_ALGO
jhLim/s2_4963_섬의 개수.py
s2_4963_섬의 개수.py
py
905
python
en
code
2
github-code
36
13960662339
from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect from django.views.decorators.cache import never_cache from helfertool.utils import nopermission from registration.permissions import has_access, ACCESS_CORONA_VIEW, ACCESS_CORONA_EDIT from registration.utils import ...
helfertool/helfertool
src/corona/views/helper.py
helper.py
py
2,339
python
en
code
52
github-code
36
19088343099
from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.views.generic.simple import direct_to_template from django.template import RequestContext from images.models import Image from images.forms import ImageForm def images_a...
queensjournal/queensjournal.ca
apps/images/views.py
views.py
py
2,225
python
en
code
2
github-code
36
3746638257
# Standard Library import argparse import os class EnvDefault(argparse.Action): """ Helper for the CLI argparse to allow setting defaults through environment variables Usage: In an argparse argument, set the Action to this class. Add the extra variable envvar added that has the name of the environ...
abnamro/repository-scanner
components/resc-vcs-scanner/src/vcs_scanner/helpers/env_default.py
env_default.py
py
1,071
python
en
code
137
github-code
36
10138616258
""" called as optimal_model_search.py $TMPDIR $PACKAGEDIR $NPROC $PATTERNDIR $OUTDIR """ import sys import itertools import logging import numpy as np import pandas as pd import pyarrow as pa import pyarrow.parquet as pq from pathlib import Path from sklearn.ensemble import RandomForestClassifier from sklearn.metrics ...
chiemvs/Weave
hpc/inspect_models.py
inspect_models.py
py
5,840
python
en
code
2
github-code
36
17066369564
import pandas as pd from sklearn.linear_model import LinearRegression '''dealing with the data''' def preprocessing(country): rows = data.loc[(data['countriesAndTerritories'] == country)] x = rows['dateRep'].iloc[::-1].reset_index(drop=True) for i in range(x.size): x[i] = i size = x.si...
Amy-Liao/COVID-19-Forecast
model.py
model.py
py
1,577
python
en
code
0
github-code
36
40584544669
import sys from catchException import exception_handler from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from requests import ReadTimeout, ConnectTimeout, HTTPError, Timeout, ConnectionError import pandas as pd import os # import requests # import urllib3 ## handle exception properly ##...
adderbyte/finos_viz
dataValuation.py
dataValuation.py
py
4,312
python
en
code
0
github-code
36
40520294015
from pprint import pprint from functools import reduce from collections import defaultdict data = [l.strip() for l in open("input.txt","r").readlines()] pprint(data) # part 1 # vowels = ["a","e","i","o","u"] # forbidden = ["ab", "cd", "pq", "xy"] # nice = 0 # for line in data: # vows = sum([1 for ch in line if ch...
archanpatkar/advent2015
Day-05/sol.py
sol.py
py
955
python
en
code
0
github-code
36
147445250
#How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? #1 Jan 1900 was a Monday. months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug','sep','oct', 'nov', 'dec'] def make_calendar(year): calendar = {} for i in months: if i == "feb"...
happinessbaby/Project_Euler
count_sundays.py
count_sundays.py
py
1,271
python
en
code
0
github-code
36
73488488423
from requests import get from scrapy import Selector response = get("https://fr.wikipedia.org/wiki/Guerre_d%27Alg%C3%A9rie") source = None if response.status_code == 200 : source = response.text if source : selector = Selector(text=source) titles = selector.css("div.toc ul > li") for title in titles...
LexicoScrap/scrap_test
scrap_test_one.py
scrap_test_one.py
py
484
python
en
code
0
github-code
36
43847888670
import os class Directory: def __init__(self, full_path, pages): self.full_path = full_path self.dirname = os.path.basename(full_path) self.pages = pages self.title = self.dirname.replace('_', ' ').title() # If the index.md file has a title other than Index, use it ...
ad96/diva.js
legacy/docs/src/pages.py
pages.py
py
1,175
python
en
code
null
github-code
36
4408278658
# 移到'Laszlo'并得到他的秘密号码。 hero.moveXY(30, 13) las = hero.findNearestFriend().getSecret() # 向 Laszlo 的数字中加7就能得到 Erzsebet的号码 # 移到'Erzsebet'并说出她的魔法数字。 erz = las + 7 hero.moveXY(17, 26) hero.say(erz) # 将 Erzsebet 的数字除以 4 得到 Simoyi 的数字。 # 去'Simony'并告诉他他的电话号码。 sim = erz / 4 hero.moveXY(30, 39) hero.say(sim) # 将 Simonyi 的数字乘以 ...
elain-lizhe/jikezhanji
20190114巫师之门.py
20190114巫师之门.py
py
592
python
zh
code
0
github-code
36
73424751784
import json from nose.tools import ok_, eq_, assert_is_not_none try: from mock import Mock, patch except ImportError: from unittest.mock import Mock, patch try: from httplib import OK except: from http.client import OK from uuid import uuid4 from time import sleep from config import * from applicat...
belodetek/unzoner-api
src/tests/utils_tests.py
utils_tests.py
py
4,279
python
en
code
3
github-code
36
37194870215
import os import pyautogui import cv2 import numpy as np import time import win32gui import win32con def GetDevicesList(): list = os.popen("adb devices").read().split('\n') deviceList = [] for temp in list: if len(temp.split()) > 1: if temp.split()[1] == 'device': device...
lqgood007/scrcpy-win64-v1.24
adbUtil.py
adbUtil.py
py
2,183
python
en
code
1
github-code
36
30395131421
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 20 21:29:31 2021 @author: skibbe """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.multiprocessing as mp #from . import tools as tls from pw import tools as tls import math #mp.set_start_method(...
febrianrachmadi/BIA_ATLAS2
deep_patchwork/pw/batch_mat.py
batch_mat.py
py
4,678
python
en
code
1
github-code
36
43302353884
""" The format table for standard sizes and alignments. """ # Note: we follow Python 2.5 in being strict about the ranges of accepted # values when packing. import struct from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong from rpython.rlib.rstruct imp...
mozillazg/pypy
rpython/rlib/rstruct/standardfmttable.py
standardfmttable.py
py
13,739
python
en
code
430
github-code
36
42713367720
# JIT (Just in Time) Derleyicisi ile Flax module : class MLP(nn.Module): features: Sequence[int] @nn.compact def __call__(self, inputs): x = inputs for i, feat in enumerate(self.features): # JIT the Module (it's __call__ fn by default.) x = nn.jit(nn.Dense)(feat, name=f'layers_{i}')(x) ...
bukempas/Jax-Flax-Turkiye
Flax/module_derleyecileri.py
module_derleyecileri.py
py
4,397
python
en
code
1
github-code
36
28164322493
from webiopi.clients import * from time import sleep # Create a WebIOPi client client = PiHttpClient("192.168.1.83") #client = PiMixedClient("192.168.1.234") #client = PiCoapClient("192.168.1.234") #client = PiMulticastClient() client.setCredentials("webiopi","Webiopi2016") # RPi native GPIO #gpio = NativeGPIO(clien...
ccc2512/room
python/arx/webiopi-client.py
webiopi-client.py
py
669
python
en
code
0
github-code
36
25622576463
import math def test(): a, b, c = [8, 5, 7] triangle_type(a, b, c) def triangle_type(a: float, b: float, c: float): if a + b > c and a + c > b and b + c > a: cos_a = round(math.degrees(math.acos(float(a**2 + c**2 - b**2) / float(2*a*c)))) cos_b = round(math.degrees(math.acos(float(a**2 +...
SSDD-kosmos/Codewars
6_kyu/Triangle_type/Triangle.py
Triangle.py
py
617
python
en
code
0
github-code
36
15744786007
import errno import filecmp import glob import os import platform import random import re import shutil import stat import subprocess import sys import tarfile import tempfile import time from typing import List, NamedTuple import urllib.parse from color import Coloring from error import DownloadError from error impor...
GerritCodeReview/git-repo
project.py
project.py
py
160,523
python
en
code
267
github-code
36
42243580740
import numpy as np import matplotlib.pyplot as plt import bead_util as bu save_dir = '/processed_data/spinning/pramp_data/20190626/outgassing/' files, lengths = bu.find_all_fnames(save_dir, ext='.txt') times = [] rates = [] for filename in files: file_obj = open(filename, 'rb') lines = file_obj.readline...
charlesblakemore/opt_lev_analysis
scripts/spinning/plot_outgassing_analysis.py
plot_outgassing_analysis.py
py
645
python
en
code
1
github-code
36
8254311544
import numpy as np import pygame from sys import exit #Initializing Parameters pygame.init() displayInfo = pygame.display.Info() screenWidth = displayInfo.current_w screenHeight = displayInfo.current_h display_surface = pygame.display.set_mode((screenWidth, screenHeight-50), pygame.RESIZABLE) pygame.display.set_capt...
bfelson/Python-Game-Engine
engine.py
engine.py
py
4,993
python
en
code
0
github-code
36
43868098541
n = int(input()) a = list(map(int, input().split())) totalMove = 0 maxMove = 0 now = 0 ans = 0 for i in a: totalMove += i maxMove = max(maxMove, totalMove) ans = max(ans, now + maxMove) now += totalMove print(ans)
cocoinit23/atcoder
abc/abc182/D - Wandering.py
D - Wandering.py
py
233
python
en
code
0
github-code
36
3890413470
""" This module is used to calculate the participants scores for their textual answers, based on the scores assigned by three different coders. """ import pandas as pd import os import numpy as np def read_categories(labels): labels = str(labels) labels = labels.split('#') labels = [int(i) for i ...
hcmlab/GANterfactual
SurveyEvaluation/text_analysis.py
text_analysis.py
py
4,734
python
en
code
10
github-code
36
34377485430
""" The :py:mod:`~ahk.script` module, most essentially, houses the :py:class:`~ahk.ScriptEngine` class. The :py:class:`~ahk.ScriptEngine` is responsible for rendering autohotkey code from jinja templates and executing that code. This is the heart of how this package works. Every other major component either inherits f...
Frankushima/LeagueAccountManager
ahk/script.py
script.py
py
7,406
python
en
code
1
github-code
36
71749898023
#! /usr/local/bin/python3 """ Currently active courses that have the WRIC attribute. """ import sys from datetime import datetime # For curric db access import psycopg2 from psycopg2.extras import NamedTupleCursor # CGI stuff -- with debugging import cgi import cgitb from pprint import pprint cgitb.enable(display=0, ...
cvickery/senate-curriculum
Approved_Courses/writing_intensive.py
writing_intensive.py
py
1,695
python
en
code
0
github-code
36
35862806433
import datetime import pytest from lizaalert.users.models import UserRole @pytest.fixture def user(django_user_model): return django_user_model.objects.create_user(username="TestUser", password="1234567", email="test@test.com") @pytest.fixture def user_2(django_user_model): return django_user_model.object...
Studio-Yandex-Practicum/lizaalert_backend
src/tests/user_fixtures/user_fixtures.py
user_fixtures.py
py
1,978
python
en
code
7
github-code
36
73094876263
import numpy as np import matplotlib.pyplot as plt from pathlib import Path from PIL import Image from skimage import io, morphology, measure import pandas as pd class LabelFieldOperations: def __init__(self, labelVol): self.labelVol = labelVol def MaskLabels(self, mask): print('masking inc...
lcubelongren/ElephantTrunkMuscles
VolumeOperations.py
VolumeOperations.py
py
3,323
python
en
code
0
github-code
36
2628241264
from datetime import timedelta from pathlib import Path import environ import os env = environ.Env() BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = env.bool("DJANGO_DEBUG", True) SECRET_KEY = os.getenv( "DJANGO_KEY", default="django-insecure-c1@)8!=axenuv@dc*=agcinuw+-$tvr%(f6s9^9p9pf^7)w+_b", ) #...
mohamedsamiromar/family-tree
family_tree/settings/base.py
base.py
py
3,990
python
en
code
0
github-code
36
72909187624
# Напишите функцию, которая принимает на вход строку — абсолютный путь до файла. # Функция возвращает кортеж из трёх элементов: путь, имя файла, расширение файла. def split_path(path: str) -> tuple: *path, file_name, file_extension = path.replace('.', '\\').split('\\') path = '/'.join(path) return path, f...
TatSoz/Python_GB
Sem_5/HW_5/Task_01.py
Task_01.py
py
601
python
ru
code
0
github-code
36
43205072820
# -*- coding: utf-8 -*- """ @author: Alsaray """ def Breadth_First_Search(graph, start_node): ##Use as a FIFO queue with node as an element frontier =[] #Use for tracking the visited nodes. reached = [] try: reached.append(start_node) frontier.append(start_node) ...
malsaray/knack
Search.py
Search.py
py
1,130
python
en
code
0
github-code
36
8635247821
from django.urls import path from . import apis urlpatterns_api_tables = [ path('table-list/', apis.TableListAPI.as_view()), path('monthly-tables/', apis.MonthlyTableListAPI.as_view()), path('main-page/', apis.MainPageAPI.as_view()), path('make-log/', apis.MakeTableLogAPI.as_view()), path('search/'...
hanoul1124/healthcare2
app/tables/urls.py
urls.py
py
357
python
en
code
0
github-code
36
11089039079
import yaml import praw import time def connect_to_reddit(config): reddit = praw.Reddit(username=config["auth"]["username"], password=config["auth"]["password"], user_agent=config["auth"]["user_agent"], client_id=config["auth"]["client_id"]...
nouveaupg/mass_dm
broadcast_dm.py
broadcast_dm.py
py
2,255
python
en
code
1
github-code
36
7690140597
from collections import defaultdict class Graph: def __init__(self, vertices): self.V = vertices self.graph = defaultdict(list) def addEdge(self, v, w): self.graph[v].append(w) self.graph[w].append(v) def isCyclicUtil(self, v, visited, parent): visited[v] = T...
thisisshub/DSA
Q_graphs/problems/detecting_cycle/A_in_the_undirected_graph.py
A_in_the_undirected_graph.py
py
1,144
python
en
code
71
github-code
36
18423321387
import torch from torch import nn import pytorch_lightning as pl from transformers import AutoTokenizer import os import pandas as pd import numpy as np from config import CONFIG class CommonLitDataset(torch.utils.data.Dataset): def __init__(self, df): self.df = df self.full_text_tokens = df['fu...
alexeyevgenov/Kaggle_CommonLit-Evaluate_Student_Summaries
code/dataset.py
dataset.py
py
2,348
python
en
code
0
github-code
36
70108688104
import yt import matplotlib import matplotlib.pyplot as plt import numpy as np import unyt from unyt import cm, s # 9 different simulations with a few snapshots: # NIF_hdf5_plt_cnt_0* #frames = [000,125,250,275,300,32,350,375,425] ds = yt.load('/scratch/ek9/ccf100/nif/turb_foam_gamma_5_3_3d_1024_50mu_bubbles/NIF_hdf5...
dcollins4096/p68c_laser
script1.py
script1.py
py
2,199
python
en
code
0
github-code
36
28672032992
import math import gym from gym import spaces, logger from random import seed from random import randint from PIL import Image from gym.utils import seeding import numpy as np from numpy import asarray import cv2 def init_map(size, num_obs, border_size): # Drawing a empty map global_map = np.one...
MetalEinstein/Projects
Map_Builder/custom_map_env.py
custom_map_env.py
py
8,308
python
en
code
0
github-code
36
28837909152
from parking.vehicle import Vehicle from parking.parking_lot import ParkingLot # Building Parking Slots and defining Entry Gates def parking_lot_entry_slots_setup(): try: print('Build your parking lot') lot_size = int(input('Enter TOTAL #SLOTS in parking area = ').strip().split()[0]) entry...
mathurprateek/ParkingLot
parking/parking_spot.py
parking_spot.py
py
6,273
python
en
code
0
github-code
36
31762719256
import sys input = sys.stdin.readline def check(_list): _list.sort() standard = _list[0] for j in _list[1:]: if len(standard) < len(j): if standard in j[:len(standard)]: return print("NO") else: standard = j else: ...
4RG0S/2020-Spring-Jookgorithm
이성복/[20.04.06]5052.py
[20.04.06]5052.py
py
533
python
en
code
4
github-code
36
30513085228
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-06-07 22:33:28 # @Author : 曹伟 (caocaosze@qq.com) # @Link : # # @Version : $Id$ import pickle d= dict(name='caowei',age='26',score='80') print(pickle.dumps(d)) f=open('dump.txt','wb') pickle.dump(d,f) f.close() f=open('dump.txt','rb') d=pickle.load(...
maketubuwa/python
test/pickling.py
pickling.py
py
345
python
en
code
0
github-code
36
22784884700
from .common import * import numpy import scipy import scipy.special import scipy.sparse import scipy.sparse.linalg # Datatypes bool = bool float16 = numpy.float16 float32 = numpy.float32 float64 = numpy.float64 uint8 = numpy.uint8 int16 = numpy.int16 int32 = numpy.int32 int64 = numpy.int64 float_fmts.update({ '...
Microno95/desolver
desolver/backend/numpy_backend.py
numpy_backend.py
py
5,706
python
en
code
17
github-code
36
21325799107
from django_mongoengine.queryset import QuerySet from .config import ( HARD_DELETE, DELETED_INVISIBLE, DELETED_ONLY_VISIBLE, DELETED_VISIBLE, DELETED_VISIBLE_BY_FIELD, ) class SafeDeletionQuerySet(QuerySet): """Default queryset for the SafeDeletionQuerySetManager. Takes care of "lazily e...
ngocngoan/django-safedeletion-mongoengine
safedeletion_mongoengine/queryset.py
queryset.py
py
4,946
python
en
code
14
github-code
36
31775281487
class Vector2D: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): return Vector2D(self.x + other.x, self.y + other.y) first = Vector2D(5, 7) second = Vector2D(3, 9) result = first + second print(result.x) print(result.y) """ The __add__ method allows for the d...
priyankabb153/260150_daily_commits
OOP/magic&operator_overloading.py
magic&operator_overloading.py
py
1,489
python
en
code
0
github-code
36
12413589703
# -*- coding: utf-8 -*- """ @author: Gallien FRESNAIS """ import pygame from pygame.locals import * # - Local - # from App.src.pygame_test.app_settings import * # pygame.mixer.init() """ Handles the events from the main pygame program """ def event_handler(): for event in pygame.event.get(): # if the...
gfresnais/Lucky_Number_AI
App/src/pygame_test/app_functions.py
app_functions.py
py
3,020
python
en
code
1
github-code
36
21951988068
# coding: utf-8 __title__ = "Удалить ОП в файлах семейства" __author__ = 'Tima Kutsko' __doc__ = "Удалить общие параметры (ОП) из файлов семейств" from Autodesk.Revit.DB import Transaction, BuiltInParameterGroup,\ TransactionStatus, StorageType from Autodesk.Revit.ApplicationServices im...
bimkpln/Git_Repo_pyKPLN
pyKPLN_MEP/KPLN.extension/pyKPLN_MEP.tab/Координация.panel/Общие параметры.pulldown/4_deleteSharedParameter.pushbutton/script.py
script.py
py
2,821
python
en
code
2
github-code
36
32341335567
#!/usr/bin/env python ''' Here we create a 7 shell module, plot its cross section, and plot a 3D representation. Note: the 3D representation uses polygons to construct the module shells (but within the software, the shells are constructed mathematically to have perfect curvature). Created on Aug 15, 2011 @author: ...
humatic/foxsi-optics-sim
examples/example1.py
example1.py
py
1,040
python
en
code
0
github-code
36
39093187145
import math import random ''' Notes 0-Uninfected, 1-Undiagnosable, 2-Asymptomatic, 3-Symptomatic 4-Recovered, 5-Dead !!! Be careful when adding new states !!! ''' class Person(): day = 7 # cycles for one day standardDay = day # infectionRad = 1 # now an array inside __INIT__() in...
Rr9/outbreakAffect
person.py
person.py
py
11,900
python
en
code
1
github-code
36
72609543784
import requests from bs4 import BeautifulSoup import mysql.connector from mysql.connector import Error class ScraperBol(): lijstMetCategorien = ["video games", "nature", "photo", "sports", "tech", "beauty"] def __init__(self): self.connection = mysql.connector.connect(host='ID362561_suggesto.db.webhost...
ThiboVanderkam/Suggesto
v1/assets/python/scraperClass.py
scraperClass.py
py
5,843
python
en
code
2
github-code
36
75127646504
import sys from cravat import BaseAnnotator from cravat import InvalidData import sqlite3 import os from functools import reduce class CravatAnnotator(BaseAnnotator): """ CravatAnnotator for the Denovo module. Querying attributes (input_data): chrom, pos, ref_base, alt_base Return attributes ...
KarchinLab/open-cravat-modules-karchinlab
annotators/denovo/denovo.py
denovo.py
py
2,269
python
en
code
1
github-code
36
38287171776
import sys import os import numpy as np param_dir = sys.argv[1] strDirIn = param_dir strDirOut = param_dir + '/unclassified' fileExt = '.las' binaryPath = 'D:/lib_build/LAStools_20160906/bin/las2las.exe' if not os.path.isdir(strDirOut): os.mkdir(strDirOut) for file in os.listdir(strDirIn): if file.endswith(...
LancerLiuSong/toolBox
python/las_drop_classIDs_with_input_dir.py
las_drop_classIDs_with_input_dir.py
py
660
python
en
code
0
github-code
36
14558996350
def encrypt(message, shift): output = '' for x in message: if x.isalpha(): if x.isupper(): output += chr((ord(x) + shift - 65) % 26 + 65) else: output += chr((ord(x) + shift - 97) % 26 + 97) else: output += x r...
SeunghooKim/Misc
Caesar cipher encoder and breaker.py
Caesar cipher encoder and breaker.py
py
1,370
python
en
code
0
github-code
36
1048912505
import torch from torch import nn class down_conv(nn.Module): def __init__(self, in_ch, out_ch): super(down_conv, self).__init__() self.conv = nn.Sequential( nn.Conv2d(in_ch, out_ch, 3, 1, 1), nn.ReLU(), nn.Conv2d(out_ch, out_ch, 3, 1, 1), nn.ReLU() ...
lembolov9/u-net-torch
model.py
model.py
py
2,331
python
en
code
0
github-code
36
14031417412
class Node(): def __init__(self,val): self.data=val self.add=None class ll(): def __init__(self): self.head=None self.last=None def insert(self,val): nn=Node(val) if self.head==None: self.head=nn self.last=nn else: ...
aravind225/hackerearth
class13(linked list).py
class13(linked list).py
py
2,260
python
en
code
1
github-code
36
24806134556
import tkinter as tk from tkinter import ttk root = tk.Tk() root.title('Paginas') root.geometry('400x300') cuadroMadre = ttk.Notebook(root) cuadroMadre.pack(pady = 10, expand = True) frame1 = ttk.Frame(cuadroMadre, width = 400, height = 280) frame2 = ttk.Frame(cuadroMadre, width = 400, height = 280) frame1.pack(fil...
alexisflores99/Repo-for-Python
Interfaces Graficas/tk5.py
tk5.py
py
558
python
es
code
0
github-code
36
4084437791
""" Start with streamlit run ./src/streamlit_app.py """ import datetime import logging import streamlit as st import numpy as np from models import train_model as tm import visualization.visualize as vis from preprocessing.pipeline import get_preprocessing_pipeline from filehandler.load_input import l...
BerndSaurugger/SaveBread
src/streamlit_app.py
streamlit_app.py
py
6,014
python
en
code
0
github-code
36
6027123411
import unittest from issues import one_hot_encoder as src class TestTF(unittest.TestCase): def test_tf(self): actual = src.fit_transform(['Moscow', 'New York', 'Moscow', 'London']) expected = [ ('Moscow', [0, 0, 1]), ('New York', [0, 1, 0]), ('Moscow', [0, 0, 1]...
ivkrasovskiy/Intro_to_testing
issue-03.py
issue-03.py
py
1,515
python
en
code
0
github-code
36
70943549223
import socket import pickle import _thread import time import random from phe import paillier from helpers import * ## Alice def Main(): ## Alice's server for initial reshuffling ## Set up server to connect to Bob server_alice = setServer('127.0.0.1', 5006, 2) print("Alice is up for the game.") ...
bablookr/Mental-Poker
Algortihm_1/Implementation_1/alice.py
alice.py
py
4,483
python
en
code
0
github-code
36
13899195903
import pandas as pd import numpy as np import matplotlib.pyplot as plt from math import e import seaborn as sn from sklearn.metrics import confusion_matrix from pretty_confusion_matrix import pp_matrix_from_data # Ryan Filgas # Machine learning def get_distance(a,b,c,d): return pd.DataFrame((a-b)**2 + (c-d)**2)...
rfilgas/ML-AI-CV
ML-K-Means-Classification-Gaussian/kmeans.py
kmeans.py
py
3,690
python
en
code
1
github-code
36
2723009963
class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ target = 0 n = len(nums) seen = set() ans = set() for i in range(n): for j in range(i+1, n): lastNumber = target...
ZhengLiangliang1996/Leetcode_ML_Daily
other/3sum.py
3sum.py
py
548
python
en
code
1
github-code
36
20438077431
import datetime import os from os import path import numpy as np import pandas as pd def check_outlier(data, col): """ :param df: :param col: :return: """ outlier_df = data[((data[col] - data[col].mean()) / data[col].std()).abs() > 6] base_filename = 'outlier.txt' with open(os.path.joi...
c1dc-candidate-48/HMDA-Data-Challenge
src/data_quality.py
data_quality.py
py
4,214
python
en
code
0
github-code
36
74207610663
from turtle import title from flask import Blueprint, render_template, request, session, redirect, flash import mysql.connector from webappfiles import dbconnect from datetime import datetime import os views = Blueprint('views', __name__) cur, con = dbconnect.get_connection() #referring to the default page via the ...
yelenaM4/Mohandyman
webappfiles/views.py
views.py
py
7,945
python
en
code
0
github-code
36
71017122023
from multiprocessing import Lock import dquality.common.constants as const from multiprocessing import Process import importlib from os import path import sys import dquality.realtime.pv_feedback_driver as drv if sys.version[0] == '2': import thread as thread else: import _thread as thread class Result: "...
bfrosik/data-quality
dquality/common/containers.py
containers.py
py
10,484
python
en
code
5
github-code
36
30774528922
import tensorflow as tf import numpy as np import os import time import util class CharRNN: def __init__(self, output_size, batch_size=64, seq_size=50, lstm_size=128, num_layers=1, train_keep_prob=0.5, learning_rate=0.001, grad_clip=5, sampling=False): """ charRNN模型类 :para...
linkseed18612254945/Char-RNN
model.py
model.py
py
9,829
python
en
code
0
github-code
36
30181316679
""" This code allows to compute and evaluate optimal policies for the grid environments. These optimal values are used to normalize the rewards per task. """ import envs, gym, argparse from envs.water.water_world import Ball, BallAgent if __name__ == '__main__': # Examples # >>> python3 test_optimal_policies.py --e...
RodrigoToroIcarte/reward_machines
reward_machines/test_optimal_policies.py
test_optimal_policies.py
py
932
python
en
code
49
github-code
36
22688843536
from Learner import Learner import torch if __name__ == '__main__': learner = Learner(0.001, "Model/goodPolicy.pth") # train # for epoch in range(1000): # learner.trainPolicy(1000, 0.2) # simulate result = learner.simulate(1, 1, True) for i in result: print(i[2])
APM150/CartPole_v0
Main.py
Main.py
py
306
python
en
code
0
github-code
36
485015950
from PIL import Image import time from libsvm.svmutil import svm_predict, svm_train import numpy as np import sys import pandas as pd from libsvm.svm import * from libsvm.svmutil import * train_file = '/Users/aparahuja/Desktop/IITD/ML/Assignment 2/Q2/mnist/train.csv' test_file = '/Users/aparahuja/Desktop/IITD/ML/Assig...
AparAhuja/Machine_Learning
Naive Bayes and SVM/Q2/multi_c.py
multi_c.py
py
4,313
python
en
code
0
github-code
36
28833400649
import time from machine import Pin from discharge_stats import DischargeStats import logging log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) AUTO_DISCHARGE = False class Channel: def __init__( self, channel, discharge_pin, leds_object=None, temperature_sens...
koalacreations/kCharge-firmware
kCharge-firmware/channel.py
channel.py
py
5,242
python
en
code
0
github-code
36
70096457063
# This shall display the Fourier transform of an image. BUT IN COLOUR BITCHES # FIRST al the declarations... imageName = "images/eye.jpg" import numpy, Image, pylab, matplotlib.cm as cm # the circular_mask was copied from http://stackoverflow.com/questions/18352973/mask-a-circular-sector-in-a-numpy-array def circular...
derbedhruv/imageProcessing
ft.py
ft.py
py
2,529
python
en
code
1
github-code
36
28440101289
from tensorboardX import SummaryWriter from multiprocessing import current_process from .abstract_writer import AbstractWriter from .helpers import add_value_wrapper from ..helpers import concurrent class TensorboardWriter(AbstractWriter): def __init__(self, use_hdf_hook=True, **kwargs): AbstractWriter._...
martius-lab/cee-us
mbrl/allogger/writers/tensorboardwriter.py
tensorboardwriter.py
py
2,331
python
en
code
11
github-code
36
25628607275
import numpy as np import matplotlib.pyplot as plt def plot(data, part): x = range(1, data[:, 0].size + 1) x2 = np.array(range(1, data[:, 0].size + 1)) mask = (data[:, 0] < 0.9196246) & (data[:, 1] > 0.919663) y_min = np.maximum(data[:, 1], 0.9196246) y_max = np.minimum(data[:, 0], 0.919663) i...
tronyaginaa/math_statistics
lab3/interval.py
interval.py
py
939
python
en
code
0
github-code
36
75263417065
from dataminer.file import File from dataminer.processor import PROCESSORS, Processor from dataminer.extractor import EXTRACTORS from pathlib import Path from fnmatch import fnmatchcase import os import yaml import time CONFIG = {} def load_config(path: Path): global CONFIG with open(path, "rb") as fd: ...
ReplayCoding/tf2-dataminer
dataminer/build.py
build.py
py
2,671
python
en
code
0
github-code
36
7810152186
import sys import argparse import random import time import numpy as np import server.common.compute.diffexp_generic as diffexp_generic from server.common.config.app_config import AppConfig from server.data_common.matrix_loader import MatrixDataLoader def main(): parser = argparse.ArgumentParser("A command to t...
chanzuckerberg/cellxgene
test/performance/run_diffexp.py
run_diffexp.py
py
3,548
python
en
code
528
github-code
36
40474789974
""" ..................................... DIAGONAL DIFFERENCE (chẩn đoán sự khác biệt) ................................... Cho một ma trận vuông, hãy tính hiệu số tuyệt đối giữa các tổng của các đường chéo của nó. Ví dụ, ma trận vuông được hiển thị bên dưới: 1 2 3 4 5 6 9 8 9 Đường chéo trái sang phải ...
hoangcuong2k1/Multiple-basic-tasks
HR[4]_py_DiagonalDifference.py
HR[4]_py_DiagonalDifference.py
py
2,252
python
vi
code
0
github-code
36
11844140747
import configparser import csv import os # Params: abs file path, file section and its key def get_config_value(conf_file, section, key): config = configparser.ConfigParser() config.read(conf_file) return config[section][key] def get_tickers(table, fn): dirname = os.path.dirname(__file__) path ...
xka155/PFF
core/utils/config.py
config.py
py
563
python
en
code
0
github-code
36