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
43355916513
import sys read = sys.stdin.readline N, M = map(int,read().rstrip().split()) field = [] for _ in range(M): field.append(list(read().rstrip())) def dfs(x,y,flag,color,depth): # 최대 깊이 알아내는 방법 고안! # depth를 return 하면 ?! 최종 녀석의 depth가 return 값이 될 것이다. for dx, dy in (-1,0),(1,0),(0,-1),(0,1): m...
w00sung/Algorithm
BOJ/1303_war.py
1303_war.py
py
1,202
python
en
code
0
github-code
13
70220884178
import torch.nn as nn class Autoencoder(nn.Module): def __init__(self): super(Autoencoder, self).__init__() # define: encoder self.encoder = nn.Sequential( # in_channel, out_channel, kernel_size, stride, padding # nn.Conv2d(3, 8, 3, 2, 1), # nn.Conv2d(8,...
timlee0119/NTU-Machine-Learning-2019
image_clustering/hw4_common.py
hw4_common.py
py
2,537
python
en
code
0
github-code
13
6045355495
""" @author: Ida Bagus Dwi Satria Kusuma - @dskusuma """ import cv2 import numpy as np # Baca gambar img = cv2.imread('gambar1.jpg',1) # Ambil tinggi dan lebar gambar height,width,depth = img.shape # Buat gambar kosong img_ycrcb = np.zeros((height,width,3)) # kalkulasi for i in np.arange(height): for j in np...
MultimediaLaboratory-TelkomUniversity/fg-image-processing
Python/Conversion/RGBtoYCrCb.py
RGBtoYCrCb.py
py
1,073
python
en
code
0
github-code
13
42591671284
""" Missing data filling functionality Transformations for handling missing values, such as simple replacements, and more advanced extrapolations. """ from typing import Any, List, Optional, Literal import multiprocessing as mp import numpy as np # type: ignore import pandas as pd # type: ignore from sklearn.ex...
prio-data/views_transformation_library
views_transformation_library/missing.py
missing.py
py
6,351
python
en
code
0
github-code
13
28075799137
# System imports import sys # Simulation imports import Const import NVTree import ExtCP import InvIdx import ProgressBar import IO class Simulation: def __init__(self, setup): # Get the settings from the setup dictionary ## GENERIC SETTINGS self.Experiment = setup['Experi...
Jubas/index-cost-sim
Simulation.py
Simulation.py
py
3,683
python
en
code
1
github-code
13
3249205493
# Lab 20, credit card validation # user_input = input('Enter your credit card number with a space between each number: ') user_input = '4 5 5 6 7 3 7 5 8 6 8 9 9 8 5 5' #convert input string to list of integers cc = user_input.split(' ') for i in range(len(cc)): cc[i] = int(cc[i]) # cc = [int(i) for i in user_in...
PdxCodeGuild/class_sheep
Code/Lane/python/lab20-credit_card_validation.py
lab20-credit_card_validation.py
py
1,146
python
en
code
1
github-code
13
10639108847
from distutils.version import LooseVersion import os import sys from setuptools import __version__ as setuptools_version from setuptools import find_packages from setuptools import setup from setuptools.command.test import test as TestCommand version = '1.7.0.dev0' # Remember to update local-oldest-requirements.txt ...
akararsse/certbot-dns-desec
setup.py
setup.py
py
4,007
python
en
code
1
github-code
13
18243034156
from numpy.linalg import norm from re import X import threading import cv2 import os from facenet_pytorch import InceptionResnetV1 # import tensorflow as tf import time import torch import cv2 import numpy as np import cv2 from align_faces import warp_and_crop_face, get_reference_facial_points from mtcnn.detector i...
Truyen724/Zalo_liveness_Detection
face_detect_main/detect.py
detect.py
py
2,294
python
en
code
1
github-code
13
37924071948
import AthenaPython.PyAthena as PyAthena trans = PyAthena.cobs('/data/ilija/AOD.067184.big.pool.root','/data/ilija/tmp.pool.root') # trans.mkProject() # resizing BS and adding CL=7 trans.setTreeToSkip('##Links') trans.setTreeToSkip('##Shapes') trans.setTreeToSkip('##Params') trans.setTreeMemory(10*1024,'POOLContainer_...
rushioda/PIXELVALID_athena
athena/Database/AthenaPOOL/RootFileTools/python/full.py
full.py
py
469
python
en
code
1
github-code
13
43986853131
#import the packages import cv2 import matplotlib.pyplot as plt # Load the image using cv2 img = cv2.imread("crazy_full_class.jpg") img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) #Convert to grayscale and apply median blur to reduce image noise grayimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) grayimg = cv2.medianBlur(grayi...
pauldubois98/RefresherMaths2023
Pictures/cartoonify_v0.py
cartoonify_v0.py
py
819
python
en
code
1
github-code
13
74564481938
""" _CountFinishedSubscriptionsByTask_ MySQL implementation of Subscription.CountFinishedSubscriptionsByTask """ from WMCore.Database.DBFormatter import DBFormatter class CountFinishedSubscriptionsByTask(DBFormatter): """ Gets count subscriptions given task """ sql = """SELECT ww.name as workflow, w...
dmwm/WMCore
src/python/WMCore/WMBS/MySQL/Subscriptions/CountFinishedSubscriptionsByTask.py
CountFinishedSubscriptionsByTask.py
py
1,214
python
en
code
44
github-code
13
26228796714
import cx_Freeze import sys import os base = None if sys.platform == 'win32': base == "Win32GUI" os.environ['TCL_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python38\tcl\tcl8.6" os.environ['TK_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python38\tcl\tk8.6" executables = [cx_Free...
NguyAnhQuan/face_recognition_system_eaut
setup.py
setup.py
py
777
python
en
code
1
github-code
13
32670324599
from read_xml import * from sklearn.model_selection import train_test_split from tensorflow.keras.models import Model from tensorflow.keras.applications.resnet50 import ResNet50 from sklearn.metrics import confusion_matrix from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense from tensorflow.ke...
ahmetsalavran/SurgeryData
resnet_last.py
resnet_last.py
py
2,277
python
en
code
0
github-code
13
15227202527
class Node: def __init__(self,value): self.value = value self.right = None self.left = None class BinarySerchTree: def __init__(self): self.root = None def add_val_tree(self,value): new_node = Node(value) if self.root is None:...
yogeskc/DataStructure-Algorithms
PracticeDS/BST.py
BST.py
py
1,457
python
en
code
1
github-code
13
9481130996
from .base import stressModelBase, np from ..base import ts_float class stressModelBase_f(stressModelBase): """ A stress-model base-class that supports setting the stress by controlling the frequency-dependent coherence between velocity components. """ def __new__(cls, turbModel, *args, **kw...
lkilcher/pyTurbSim
pyts/stressModels/stress_freq.py
stress_freq.py
py
4,073
python
en
code
12
github-code
13
26925302366
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: data = {} index = 0 while head: if head not in data: data[head] = index index += 1 ...
hwngenius/leetcode
learning/fast&slow_poionters/142.py
142.py
py
499
python
en
code
1
github-code
13
20214421983
class Human: email = 'jayabhaskarreddy98@.com' address = '560043' def verify(): if Human.address == '560043': print('Correct') else: print('Wrong') def sent_email(): print('email sent') print(Human.email) print(Human.address) Human.sent_e...
Jayabhaskarreddy98/python_practice
oops/sample.py
sample.py
py
364
python
en
code
1
github-code
13
18200513131
#!/usr/bin/env python # coding:utf-8 """ @author: nivic ybyang7 @license: Apache Licence @file: server @time: 2022/10/28 @contact: ybyang7@iflytek.com @site: @software: PyCharm # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻...
iflytek/aiges
grpc/examples/wrapper-python/plugin.py
plugin.py
py
7,114
python
en
code
271
github-code
13
31046745326
import argparse from random import randint class Operation(): PLUS, MINUS, MULT, DIV = range(4) _f = [ lambda x, y: x + y, lambda x, y: x - y, lambda x, y: x * y, lambda x, y: x / y ] _s = [ '+', '-', '*', ...
johntzwei/neural-postfix-calculator
trees.py
trees.py
py
6,576
python
en
code
0
github-code
13
28758316589
import pytest from yahtzee_api.player import Player class TestPlayer: """Class containing all unit tests for the Player class.""" def test_roll_rolls_left(self): """Tests ValueError when roll(to_roll) method is called without any rolls left in the turn. """ p = Player("Tom") ...
TheophileDiot/yahtzee-api
tests/test_player.py
test_player.py
py
2,595
python
en
code
0
github-code
13
33627744023
from __future__ import annotations from pycaputo.grid import Points from pycaputo.logging import get_logger from pycaputo.utils import Array logger = get_logger(__name__) # {{{ Lagrange Riemann-Liouville integral def lagrange_riemann_liouville_integral( p: Points, alpha: float, n: int, *, q: i...
alexfikl/pycaputo
pycaputo/lagrange.py
lagrange.py
py
1,854
python
en
code
1
github-code
13
8055931336
'''Continuized CCG with generalized application, lifting and lowering. ''' from collections import defaultdict from lambekseq.lbnoprod import usecache from lambekseq.lib.cterm import towerSplit, catIden from lambekseq.lib.cterm import unslash, addHypo from lambekseq.lib.tobussccg import toBussCcg Conns = {'/', '\\',...
PterosDiacos/lambekseq
cntccg.py
cntccg.py
py
6,257
python
en
code
15
github-code
13
15734778623
from utils.embeddings import get_embeddings from Implementation.code_vulnerability_detection.dataloader import VulnerabilityDataloader from Models.transformer import TransormerClassifierModel # Load data loader dataloader = VulnerabilityDataloader('data/sample_index.csv','data/sample_index.csv', ...
Jincheng-Sun/Kylearn-pytorch
Implementation/code_vulnerability_detection/training.py
training.py
py
1,605
python
en
code
0
github-code
13
41115654831
from mogul.locale import localize _ = localize.get_translator('mogul.media') __all__ = ['Image'] ID3_IMAGE_TYPE = { 0x00: _('Other'), 0x01: _('32x32 pixels \'file icon\' (PNG only)'), 0x02: _('Other file icon'), 0x03: _('Cover (front)'), 0x04: _('Cover (back)'), 0x05: _('Leaflet page'), 0x...
sffjunkie/media
src/media/attachment.py
attachment.py
py
2,475
python
en
code
0
github-code
13
12935752926
# coding=UTF-8 from natcap.invest.ui import model, inputs from natcap.invest.wind_energy import wind_energy class WindEnergy(model.InVESTModel): def __init__(self): model.InVESTModel.__init__( self, label='Wind Energy', target=wind_energy.execute, validator...
jandrewjohnson/hazelbean
hazelbean/ui/examples/wind_energy.py
wind_energy.py
py
17,234
python
en
code
1
github-code
13
32826183115
# Find out how many cakes Pete could bake considering his recipes. def cakes(recipe, available): whole_cake = [] for ingredient in recipe: if ingredient in available: whole_cake.append(ingredient) else: return 0 max_ingredients = [(available[key] // recipe[k...
RealMrSnuggles/Python
CodeWars/Pete, the baker.py
Pete, the baker.py
py
493
python
en
code
0
github-code
13
28955385995
import six from .test_base import TestBase import b2.utils class TestChooseParts(TestBase): def test_it(self): self._check_one([(0, 100), (100, 100)], 200, 100) self._check_one([(0, 149), (149, 150)], 299, 100) self._check_one([(0, 100), (100, 100), (200, 100)], 300, 100) ten_TB ...
jhill69/Hello-World
test/test_utils.py
test_utils.py
py
1,461
python
en
code
0
github-code
13
29485243556
import sys import numpy as np from keras.models import Sequential from data_helper import load_data, split_data_targets from models import NeuralNetwork, LSTMNetwork, CNNNetwork, CNNNetwork2 # function that uses k-fold cross validation to evaluate a model def cv_k_fold(model_info, k=10, verbose=0): # load data, t...
Flyer4109/mnist-digit-recogniser
cv_model.py
cv_model.py
py
5,300
python
en
code
0
github-code
13
73900101456
import scrapy class QuotesSpider(scrapy.Spider): name = "amzn" start_urls = [ 'https://www.amazon.com/dp/B07FK8SQDQ/ref=twister_B00WS2T4ZA?_encoding=UTF8&th=1', ] def parse(self, response): yield { 'title': response.xpath("div[@id='title_feature_div']/div[@id='titleSection...
AllenSun7/Beary-Chat
scrapy/tutorial/tutorial/spiders/amzn_spider.py
amzn_spider.py
py
496
python
en
code
0
github-code
13
6644937564
"""Test for OT3StateManager object.""" import asyncio from typing import AsyncGenerator, Generator from unittest.mock import Mock, patch import pytest from opentrons.hardware_control.types import Axis from state_manager.messages import MoveMessage from state_manager.ot3_state import OT3State from state_manager.pipet...
Opentrons/ot3-firmware
state_manager/tests/test_ot3_state_manager.py
test_ot3_state_manager.py
py
2,143
python
en
code
15
github-code
13
32873008032
from pyspark.sql import SparkSession from pyspark.sql.functions import from_json, col, udf from pyspark.sql.types import StringType, StructType, IntegerType, StructField, DateType, LongType, FloatType from constants.constants import KAFKA_URI, TOPIC_JOB, TOPIC_USER, CHECKPOINT_PATH def main(): concurrent_job = 3...
vuminhhieucareer172/SparkPushNotification
streaming/job_streaming_example.py
job_streaming_example.py
py
2,151
python
en
code
0
github-code
13
72033327378
from __future__ import annotations from typing import TYPE_CHECKING, List from ..l0.Activity import Activity from ..ns import * if TYPE_CHECKING: from rdflib import Graph, Literal from ..l0.Agent import Agent from .TransparencyActivityTypology import TransparencyActivityTypology from .TransparencyOb...
luca-martinelli-09/ontopia-py
ontopia_py/transparency/TransparencyActivity.py
TransparencyActivity.py
py
1,709
python
en
code
0
github-code
13
38005689238
import ROOT def rebin2 (h, name, gx=1, gy=1): """Rebin the 2D histogram H. Use NAME for the new histogram. Group together GX bins in x and GY bins in y. """ old_nx = h.GetNbinsX() old_ny = h.GetNbinsY() new_nx = old_nx//gx new_ny = old_ny//gy hnew = ROOT.TH2F (name, h.Get...
rushioda/PIXELVALID_athena
athena/PhysicsAnalysis/PyAnalysis/PyAnalysisUtils/python/rebin2.py
rebin2.py
py
873
python
en
code
1
github-code
13
28375139539
#!/usr/bin/python3.6 #-*- coding: utf-8 -*- def zadanie1(s): Liczby= { "jeden" : 1, "dwa" : 2, "trzy" : 3, "cztery" : 4, "pięć" : 5, "sześć" : 6, "siedem" : 7, "osiem" : 8, "dziewięć" : 9, "dziesięć" : 10, "jedenaście" : 11, ...
aszpatowski/JSP2019
lista5/zadanie1.py
zadanie1.py
py
1,258
python
pl
code
0
github-code
13
42482656431
# -*- coding: utf-8 -*- from tqdm import tqdm import json from collections import Counter, defaultdict from models.utils import is_chinese_token, get_token_pinyin from typing import Dict, List, Optional, Tuple def get_frequency( file_path: str, need_pinyin_freq: bool = False ) -> Tuple[Tuple[List[str], Lis...
Peter-Chou/cgec-initialized-with-plm
get_tokens_pinyin_frequency.py
get_tokens_pinyin_frequency.py
py
2,179
python
en
code
3
github-code
13
3455079071
from rdflib import Variable from thesis.graph import PREFIX_REL, InternalNS, internal, RelationNS, BGP from thesis.rewriting import QueryRewriter def singleton_predicate(pred, rid): name = str(pred)[len(str(RelationNS)):] return internal(f"{name}-{rid}") class SingletonQueryRewriter(QueryRewriter): LAS...
johnruth96/semantics-refinement
src/thesis/models/singleton.py
singleton.py
py
2,266
python
en
code
0
github-code
13
13103245684
from sys import stdin def isMixed(notes): for i in range(1, len(notes)): if abs(notes[i] - notes[i-1]) != 1: return True return False notes = [int(i) for i in stdin.readline().split()] if isMixed(notes): print("mixed") else: if notes[0] == 1: print("ascending") else:...
olwooz/algorithm-practice
practice/2022_01/220117_Baekjoon_2920_Notes_Python/220117_Baekjoon_2920_Notes.py
220117_Baekjoon_2920_Notes.py
py
349
python
en
code
0
github-code
13
37909796118
# # set inFileName and outFileName to convert TProfile2D weights to pool # import AthenaCommon.Constants as Lvl from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon.AppMgr import theApp import IOVDbSvc.IOVDb from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from CaloLocalH...
rushioda/PIXELVALID_athena
athena/Calorimeter/CaloLocalHadCalib/share/CaloReadLCWeightsFile.py
CaloReadLCWeightsFile.py
py
1,560
python
en
code
1
github-code
13
43263049552
def main(): v, u = -1, -1 v_cnt = u_cnt = 0 ans = 0 for v, lv in VL: if v == u: ans += min(lv, u_cnt - v_cnt) v_cnt += lv if u_cnt >= v_cnt: continue for u, lu in UL: if u == v: ans += min(lu, v_cnt - u_cnt) ...
Shirohi-git/AtCoder
abc291-/abc294_e.py
abc294_e.py
py
617
python
en
code
2
github-code
13
23606068239
#@ type: compute #@ parents: #@ - func1 #@ - func2 #@ - func3 #@ - func4 #@ corunning: #@ mem1: #@ trans: mem1 #@ type: rdma import struct import threading import time import pickle import sys import copy import codecs import copyreg import collections from base64 import b64encode from collections im...
zerotrac/CSE291_mnist
Mnist/func5.o.py
func5.o.py
py
3,651
python
en
code
2
github-code
13
17531066389
import sys import logging import warnings import re import time import uuid from weakref import ref from weakref import WeakSet from .. import _p4p from .._p4p import (Server as _Server, StaticProvider as _StaticProvider, DynamicProvider as _DynamicProvider, ...
mdavidsaver/p4p
src/p4p/server/__init__.py
__init__.py
py
8,516
python
en
code
20
github-code
13
21251247612
#Name: Shezan Alam #Email: shezan.alam48@myhunter.cuny.edu #Date: October 4th, 2019 #Imports the turtle commands import turtle #Created a turtle, named: taylorS taylor = turtle.Turtle() for i in range(90,0,-2): taylor.forward(25) taylor.left(i)
shezalam29/simple-python-projects
SpiralSA.py
SpiralSA.py
py
262
python
en
code
0
github-code
13
69797748817
from faker import Faker import json def write_json(): fake = Faker() fakedata = [] for detail in range(1000): details = {"name":fake.name(), "age":fake.random_int(min=20, max=65, step=1), "city":fake.city()} fakedata.append(details) wit...
Limookiplimo/json-with-faker
write_json_data.py
write_json_data.py
py
411
python
en
code
0
github-code
13
19057367006
### ML/AI/Geodata utils # from pyrsgis import raster # import torch import numpy as np import matplotlib.pyplot as plt # from torch.utils.data import Dataset, DataLoader # from torchvision import transforms, utils import fiona import rioxarray from rioxarray import merge import rasterio import rasterstats from rasterio...
jakewilliami/scripts
python/geospatial/train.py
train.py
py
12,595
python
en
code
3
github-code
13
70556135058
import os import re from statistics import mean import numpy as np import scipy from conch import analyze_segments from conch.analysis.praat import PraatAnalysisFunction from conch.analysis.segments import SegmentMapping from conch.analysis.formants import PraatSegmentFormantTrackFunction, FormantTrackFunction, \ ...
MontrealCorpusTools/PolyglotDB
polyglotdb/acoustics/formants/helper.py
helper.py
py
11,446
python
en
code
31
github-code
13
13952556588
import os for subdir, dirs, files in os.walk("./"): # print(subdir) # print("--------") for dire in dirs: if dire[0:6] == "result": print(subdir + os.sep +dire) benchmark = subdir[1:] freq = dire[25:31] filepath = "../powertraces"+benchmark+"/"+freq # print("filepath: ", filepath) # print("--------\n...
sudam41/SLICER
benchmarks/HotSniper_Output/test.py
test.py
py
486
python
en
code
0
github-code
13
43105006572
def power(x, n=2): s = 1 while n > 0: n = n - 1 s = s * x return s print(power(5, 3)) print(power(5)) def add_end_e(L=[]): if L is None: L = [] L.append('END') return L print(add_end_e()) print(add_end_e()) def add_end(L=None): if L is None: L = [] ...
JinhaoPlus/LiaoxuefengPython
ch3_function/3.3-funtion-args.py
3.3-funtion-args.py
py
1,120
python
en
code
0
github-code
13
73832684818
import time import pandas as pd import numpy as np from textdistance import levenshtein from lib.config import * df = pd.read_csv("/Users/calvinwalker/Documents/Projects/FPL/data/master_players.csv") df = df[df['avg_xGBuildup'].notna()] df = df[df['kickoff_time'] < '2023-08-10'] spi = pd.read_csv('/Users/calvinwalk...
ucswalker1/FPL
process/clean_previous.py
clean_previous.py
py
3,394
python
en
code
0
github-code
13
17048456264
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AnttechOceanbaseTestplatformTaskSyncModel(object): def __init__(self): self._branch = None self._commit_id = None self._fail_msg = None self._result_type = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AnttechOceanbaseTestplatformTaskSyncModel.py
AnttechOceanbaseTestplatformTaskSyncModel.py
py
4,387
python
en
code
241
github-code
13
23407075490
import unittest import requests from app.malware_api import app class test_malware_api(unittest.TestCase):\ def test_url_get(self): with app.test_client() as testClient: url = "http://127.0.0.1:5000/v1/urlinfo/malware_url?url=http://222.138.204.18:39382/Mozi.m" resp=testClient.get...
enakshi194/url_lookup_service
unit_tests/test_malware_api.py
test_malware_api.py
py
643
python
en
code
0
github-code
13
8630442891
# -*- coding: utf-8 -*- from copy import deepcopy from Products.MeetingCommunes.profiles.testing import import_data as mc_import_data from Products.MeetingLalouviere.config import LLO_ITEM_COLLEGE_WF_VALIDATION_LEVELS, DG_GROUP_ID from Products.MeetingLalouviere.config import LLO_ITEM_COUNCIL_WF_VALIDATION_LEVELS from...
IMIO/Products.MeetingLalouviere
src/Products/MeetingLalouviere/profiles/testing/import_data.py
import_data.py
py
4,680
python
en
code
0
github-code
13
34885434504
import math # Color configuration based on state COLORS = { "STANDARD":(255, 255, 255), "BARRIER":(0, 0, 0), "START":(255, 102, 102), "GOAL":(102, 255, 153), "OPEN":(255, 153, 0), "CLOSED":(0, 153, 204), "PATH":(255, 204, 102) } # Darkens shade of cells with higher weight. Best results in ...
fredrvaa/A-star-Visualizer
cell.py
cell.py
py
2,871
python
en
code
0
github-code
13
74460915538
import sys sys.path.insert(0, "..") import logging import time import os import json from asyncua.sync import Client, ua from softioc import softioc, builder import cothread from functools import partial from dbtoolspy import load_template_file, load_database_file import datetime forceExit = False class SubHandler(...
React-Automation-Studio/OPCUA-EPICS-BRIDGE
opcuaEpicsBridge/bridge.py
bridge.py
py
14,055
python
en
code
0
github-code
13
20319084690
from django.urls import path, include from . import views from django.views.generic.base import TemplateView from rest_framework import routers from django.conf.urls import url router = routers.DefaultRouter() urlpatterns = [ #Path for profile url('profile/', views.ProfileView.as_view()), #path for gett...
djbursch/csuSeer-server
server/insert2DB/urls.py
urls.py
py
1,765
python
en
code
0
github-code
13
42417230059
# -*- coding: utf-8 -*- ''' This module solves a sudoku, This is actually written by Peter Norvig Code and Explanation can be found here : norvig.com/sudoku.html''' def cross(A, B): return [a+b for a in A for b in B] digits = '123456789' rows = 'ABCDEFGHI' cols = digits squares = cross(rows, cols) unitlist = ([c...
shreyanshu/sudoku_project
s.py
s.py
py
722
python
en
code
0
github-code
13
16083305696
import sys all_nodes = [] class Node(object): word = '' path_to = [] letters = [0] * 26 index = -1 # The class "constructor" - It's actually an initializer def __init__(self, word, path_to, letters, index): self.word = word self.path_to = path_to self.letters = letters...
marygee/EDAF05
Labb2/wordladders.py
wordladders.py
py
3,911
python
en
code
0
github-code
13
15127618722
import math as m import os import pyspark from pyspark.sql import SparkSession import pyspark.sql.functions as f from pyspark.sql.types import * def quiet_logs(sc): logger = sc._jvm.org.apache.log4j logger.LogManager.getLogger("org"). setLevel(logger.Level.ERROR) logger.LogManager.getLogger("akka").setLev...
mihajlo-perendija/ASVSP
spark-jobs/crime_rate_by_comuntiy_area.py
crime_rate_by_comuntiy_area.py
py
2,002
python
en
code
0
github-code
13
7151289819
__author__ = "Trevor Maco <tmaco@cisco.com>" __copyright__ = "Copyright (c) 2022 Cisco and/or its affiliates." __license__ = "Cisco Sample Code License, Version 1.1" import sys import random import string from webex_bot.models.command import Command from webex_bot.models.response import Response from webexteamssdk im...
gve-sw/gve_devnet_webex_bot_help_request
app.py
app.py
py
6,360
python
en
code
0
github-code
13
17050928374
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class DatadigitalFincloudFinsaasTenantchannelListBatchqueryModel(object): def __init__(self): self._channel_category = None self._status = None self._tenant_code = None @pr...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/DatadigitalFincloudFinsaasTenantchannelListBatchqueryModel.py
DatadigitalFincloudFinsaasTenantchannelListBatchqueryModel.py
py
2,016
python
en
code
241
github-code
13
297974129
class User(): def __init__(self,first_name,last_name,birth_year): self.first_name = first_name.title() self.last_name = last_name.title() self.birth_year = birth_year self.full_name = first_name.title() + " " + last_name.title() def describe_user(self): print("Fist-Name: ...
ZYC0515/LearnPython
Python编程从入门到实践/第九章学习/代码实现/test_9_3.py
test_9_3.py
py
718
python
en
code
0
github-code
13
27522982511
# coding=utf-8 import simple_salesforce from simple_salesforce import SalesforceMalformedRequest import logging class SalesforceWrapper: def __init__(self, _email, _password, _security_token, _sandbox): self.sf = simple_salesforce.Salesforce(username=_email, password=_password, security_token=_security_t...
NickPl/gis-sync
salesforce_wrapper.py
salesforce_wrapper.py
py
9,017
python
en
code
0
github-code
13
3685907973
import os from setuptools import find_packages, setup __version__ = os.getenv('tinynn', '0.1.0') def setup_tinynn(): requires = [ 'numpy' ] setup( name='tinynn', version=__version__, description='my deep learning study', python_requires='>=3.8', install_re...
yewentao256/TinyNN
setup.py
setup.py
py
468
python
en
code
12
github-code
13
31002320074
from pandas import DataFrame from pandas import read_csv, to_datetime from sklearn import linear_model from sklearn.metrics import mean_squared_error import numpy as np import os import matplotlib.pyplot as plt import seaborn as sns from collections import namedtuple from pandas import concat from operator import item...
mathbeal/p_stock_prediction
main.py
main.py
py
6,882
python
en
code
0
github-code
13
35478816328
import logging import os import uvicorn from fastapi import FastAPI, Request, Response from fastapi.middleware.cors import CORSMiddleware from db.models import database, start_db from schemas.models import ( SearchResult, DatasetInfo, FieldsList, DatasetStat, Baskets, StatusCode, Queries, ...
Diroman/VTB_more_tech_3_2021
backend/main.py
main.py
py
5,562
python
en
code
0
github-code
13
12250553240
class Solution: def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int: grid_t = [[] for i in range(len(grid[0]))] for row in grid: for column in range(len(row)): grid_t[column].append(row[column]) answer = 0 for row in range(len(grid)): ...
wellslu/LeetCode-Python
medium/Max_Increase_to_Keep_City_Skyline.py
Max_Increase_to_Keep_City_Skyline.py
py
649
python
en
code
3
github-code
13
16076532170
import socket import os, sys import hashlib import tqdm import struct import time import shutil #server name goes in HOST HOST = 'localhost' PORT = 5000 UDP_port = 9999 cache_dict={} cache_size=3 dir="./Cachefolder" os.mkdir(dir) def IndexGet(command): sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
AnoushkaVyas/Client-Server-Networking
client.py
client.py
py
9,865
python
en
code
1
github-code
13
70348935698
import unittest from xivo_dao.data_handler.configuration import services from mock import patch from hamcrest.core import assert_that from hamcrest.core.core.isequal import equal_to class TestConfiguration(unittest.TestCase): @patch('xivo_dao.data_handler.configuration.dao.is_live_reload_enabled') def test_g...
jaunis/xivo-dao
xivo_dao/data_handler/configuration/tests/test_services.py
test_services.py
py
1,278
python
en
code
0
github-code
13
15214083392
# -*- coding: utf-8 -*- from odoo import api, models, fields, tools, _ import re from datetime import datetime from lxml import etree, objectify class AccountEdiFormat(models.Model): _inherit = 'account.edi.format' def _is_compatible_with_journal(self, journal): # OVERRIDE self.ensure_one()...
sgrebur/e3a
integreat_mx_edi_extended/models/account_edi_format.py
account_edi_format.py
py
13,829
python
en
code
0
github-code
13
17333165674
"""Module for the Code Completion Provider which handles all code completion requests.""" import os import logging from attr import Factory, attrib, attrs, validators from pygls.lsp import CompletionParams, CompletionList, CompletionItem, CompletionItemKind from pygls.server import LanguageServer from aac.io.parser ...
jondavid-black/AaC
python/src/aac/plugins/first_party/lsp_server/providers/code_completion_provider.py
code_completion_provider.py
py
4,430
python
en
code
14
github-code
13
12054116187
class ListNode: def __init__(self, val = 0, next = None): self.val = val self.next = next def addTwoNumbers(l1, l2): result = ListNode(0) # create a node to store result curr = result carry_next = 0 # initialize carry to 0 while l1 is not None or l2 is not None or carry_next != 0...
Akorex/Algorithms-From-Scratch
Leetcode Challenges/Python/Add_two_numbers.py
Add_two_numbers.py
py
803
python
en
code
0
github-code
13
26660684376
from samaritan import app from flask_sqlalchemy import SQLAlchemy from flask_jwt_extended import JWTManager app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://test:test@db:5432/samaritan' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['JWT_SECRET_KEY'] = 'jwt-secret-string' app.config['JWT...
librowski/Samaritan
samaritan-backend/samaritan/models/db.py
db.py
py
522
python
en
code
0
github-code
13
8855334879
# -*- coding: utf-8 -*- from darkflow.net.build import TFNet import sys import dlib import cv2 from collections import Counter options = {"model": "cfg/tiny-yolo-voc.cfg", "load": "bin/tiny-yolo-voc.weights", "threshold": 0.7, "saveVideo":""} tfnet = TFNet(options) objectTrackers = {} objectNames = {} frameCounter = 0...
leimpengpeng/ComputerVision_script
yolo_count_object.py
yolo_count_object.py
py
5,250
python
en
code
1
github-code
13
20951113448
from controller import Robot, Keyboard TIME_STEP = 64 robot = Robot() keyboard = Keyboard() keyboard.enable(TIME_STEP) ds = [] dsNames = ['ds_right', 'ds_left'] for i in range(2): ds.append(robot.getDevice(dsNames[i])) ds[i].enable(TIME_STEP) wheels = [] wheelsNames = ['wheel1', 'wheel2', 'wheel3', 'wh...
davs28/Webots
webot_works/lesson2/controllers/four_wheeled_collision_avoidance/four_wheeled_collision_avoidance.py
four_wheeled_collision_avoidance.py
py
1,653
python
en
code
0
github-code
13
72913515217
from tabuleiro import * j = Jogo() j.inicio() print("Menu:\n") print("1. Iniciar jogo;") print("2. Visualizar tabuleiro;") print("3. Fazer jogada;") print("4. Retornar para jogo passado;") print("5. Acabar partida; \n") print ("Escolha uma numeração do menu de 1 a 5, para fazer a acao desejada.") escolh...
arturgirao/CampoMinado
principal.py
principal.py
py
622
python
pt
code
0
github-code
13
72106030739
import sys import socket,select port = 11111 socket_list = [] users = {} server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind(('127.0.0.1',port)) server_socket.listen(2) socket_list.append(server_socket) while True: ...
abhishekbvs/cryptography
Assignment3/server.py
server.py
py
1,500
python
en
code
0
github-code
13
70657856978
from django.contrib import admin from django.urls import path from .views import * app_name = 'service' urlpatterns = [ path('', HomeList.as_view(), name='home'), path('services/', ServiceList.as_view(), name='Service_list'), path('last/', LastServiceList.as_view(), name='Last_Service'), path('about/'...
AbdulrahmanElsharef/Logis_Services_Django
service/urls.py
urls.py
py
599
python
en
code
0
github-code
13
15322248101
import numpy as np from sklearn.neighbors import KNeighborsClassifier from sklearn.svm import SVC from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import cross_val_score # context = np.loadtxt("../data/untolerance/Hepatitis.txt") # rows, cols = context.shape # # # attributes = [i for i in range(...
dejiehu/Equivalence_division
classification_accuration/Classification_accuracy2.py
Classification_accuracy2.py
py
3,126
python
en
code
0
github-code
13
37964392358
from TrigMonitorBase.TrigGenericMonitoringToolConfig import defineHistogram, TrigGenericMonitoringToolConfig class SiTrigSpacePointFormatMonitorBase(TrigGenericMonitoringToolConfig): def __init__(self, name="SiTrigSpacePointFormatMonitorBase", type="electron"): super (SiTrigSpacePointFormatMonitorBase, sel...
rushioda/PIXELVALID_athena
athena/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/python/SiTrigSpacePointFormatMonitoring.py
SiTrigSpacePointFormatMonitoring.py
py
3,751
python
en
code
1
github-code
13
35182203370
from django.core.management.base import BaseCommand class Command(BaseCommand): help = 'Displays current time' def handle(self, *args, **kwargs): from diocese.models import Archdiocese from diocese.models import Diocese states_dict = { 'AK': 'Alaska', 'AL': 'Alabama', ...
jplaschke/rcc_abuse
diocese/management/commands/load_db.py
load_db.py
py
5,505
python
en
code
0
github-code
13
12642768795
def calculate_waiting_and_turnaround_times(processes_info, num_processes, burst_times, waiting_times, turnaround_times): # FCFS algorithm waiting_times[0] = 0 for i in range(1, num_processes): waiting_times[i] = burst_times[i - 1] + waiting_times[i - 1] for i in range(num_processes): tu...
sreevalli27/AI_industry
SE20UARI148_Assignment-3/Scheduling-1/scheduling_1.py
scheduling_1.py
py
8,184
python
en
code
0
github-code
13
9050803627
import json import uma_dwh.utils.opsgenie as opsgenie from uma_dwh.utils import date_diff_in_seconds from datetime import datetime from .mssql_db import execute_sp, get_sp_result_set, get_out_arg from .exceptions import SPException from .utils import execute_sp_with_required_in_args, fill_in_sp_in_args def fetch_curr...
pcs2112/UMA-DWH
uma_dwh/db/etl.py
etl.py
py
6,575
python
en
code
0
github-code
13
74261928976
from __future__ import print_function # # @brief The output class (write a file to disk) # class Writer(): # # @brief Write a header file # # @param functions A list of function-objects to write def headerFile(self, functionList): # open the output file for writing output = ope...
jakobluettgau/feign
tools/gen/lib/skeletonBuilder.py
skeletonBuilder.py
py
3,864
python
en
code
0
github-code
13
35441191190
def validSSN(): s = input('Enter a Social Security number: ') if len(s) == 11: a = s.split('-') if len(a[0]) == 3 and len(a[1]) == 2 or len(a[-1]) == 4: for i in a: if i.isdigit(): print('Valid SSN') return True else: ...
minzhou1003/intro-to-programming-using-python
practice3/8_1.py
8_1.py
py
355
python
en
code
0
github-code
13
38637174812
import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import os from model import charLM from utilities import * from collections import namedtuple from test import test def preprocess(): word_dict, char_dict = c...
FengZiYjun/CharLM
train.py
train.py
py
8,706
python
en
code
33
github-code
13
74338529616
from .IRremoteESP8266 import * from .IRutils import * ONCE = 0 # Constants kHeader = 2 # Usual nr. of header entries. kFooter = 2 # Usual nr. of footer (stop bits) entries. kStartOffset = 1 # Usual rawbuf entry to start from. def MS_TO_USEC(x): return x * 1000 # Convert milli-Seconds to micro-S...
kdschlosser/IRDecoder
IRDecoder/IRrecv.py
IRrecv.py
py
49,415
python
en
code
1
github-code
13
6838230393
__author__ = 'Simon' import random import cProfile def merge_sort(array): if len(array) == 1: return array mid = len(array)/2 left = array[:mid] right = array[mid:] left = merge_sort(left) right = merge_sort(right) return merge(left, right) def merge(left, right): merged = [] ...
sosimon/python
merge_sort.py
merge_sort.py
py
1,055
python
en
code
0
github-code
13
13058946855
import os import os.path import numpy as np from pdb import set_trace class TestIOHandler: """This class handles all file I/O for reference and test calculations Attributes ---------- tester : StaticTest/EOSTest etc type object The CONQUEST test object ref : bool Toggle between reference calculation...
Paraquat/ConquestTest
iohandler.py
iohandler.py
py
3,073
python
en
code
0
github-code
13
30583201938
''' ''' from colors_definitions import * import IMP import IMP.display, IMP.core, IMP.atom # # NEEDS : kaki, light_orange, light_green # # # # #protein_color={} ## CORE ------ #protein_color["p_8"] = IMP.display.Color(162/255.0 ,205/255.0 , 90/255.0) # DarkOliveGreen_3 #protein_color["p_5...
dbenlopers/SANDBOX
IMP/HGM-old/display.py
display.py
py
25,380
python
en
code
0
github-code
13
41161336504
def team_lineup(*args): result = '' country_players_dict= {} for player, country in args: if country not in country_players_dict: country_players_dict[country] = [] country_players_dict[country].append(player) country_players_dict = dict(sorted(country_players_dict.items(), ...
lefcho/SoftUni
Python/SoftUni - Python Advanced/Exam/team_lineup.py
team_lineup.py
py
1,316
python
en
code
0
github-code
13
24362189666
import speech_recognition as sr import random hello = ["Привет", "Здравствуй", "Позвольте вас поприветствовать!", "Разрешите вас приветствовать!"] films = ["Крепкий орешек", "Назад в будущее", "Таксист", "Леон", "Богемская рапсодия", "Город грехов", "Мементо", "Отступники", "Деревня"] recognizer = sr.Recognizer() whil...
Den4ik20020/modul4
modul2/lesson7/dz2.py
dz2.py
py
947
python
ru
code
0
github-code
13
3108074456
""" The Program receives from the USER an INTEGER and displays if it’s an ODD or EVEN number. """ # START Definition of FUNCTIONS def valutaIntPositive(numero): if numero.isdigit(): if numero != "0": return True return False def evenOrOdd(number): if number % 2 == 0: return...
aleattene/python-workbook
chap_02/exe_035_even_odd.py
exe_035_even_odd.py
py
943
python
en
code
1
github-code
13
23242837539
import os import numpy as np import pandas as pd import joblib from sklearn.model_selection import ( StratifiedShuffleSplit, cross_val_score, cross_validate, ) from sklearn.multiclass import OneVsRestClassifier from sklearn.metrics import classification_report, accuracy_score, make_scorer from setup import ...
2020-iuc-sw-skku/LSC-Systems
trainer/predict.py
predict.py
py
2,081
python
en
code
7
github-code
13
42809883981
from uuid import UUID from flask import Blueprint, Response, g, jsonify, make_response, request from flask_jwt_extended import jwt_required from common.constants.http import HttpStatusCodeConstants from common.schemas.response import ResponseBaseSchema from teachers.schemas import TeacherInputSchema, TeacherOutputSc...
BorodaUA/practice_api_server
teachers/routers/__init__.py
__init__.py
py
3,930
python
en
code
0
github-code
13
39088968483
import sqlalchemy as sa from sqlalchemy.dialects import ( postgresql as postgresql_types, ) try: from geoalchemy2 import types as geotypes except ImportError: pass from fastapi_users_db_sqlalchemy import GUID from app.db import Base class VehicleBreak(Base): __tablename__ = "vrp_vehicle_break" ...
randyaswin/route-optimization-backend
backend/app/models/vehicle_break.py
vehicle_break.py
py
2,148
python
en
code
0
github-code
13
70414274257
"""USER: removed null constraints and added department field Revision ID: a4e9af45c35b Revises: 40e51195b3fb Create Date: 2023-09-21 00:26:31.199284 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'a4e9af45c35b' down_revision = '40e51195b3fb' branch_labels = No...
Sulayman-ma/IDCard
migrations/versions/a4e9af45c35b_user_removed_null_constraints_and_added_.py
a4e9af45c35b_user_removed_null_constraints_and_added_.py
py
1,600
python
en
code
0
github-code
13
11582142044
#!/usr/bin/env python # -*- coding:utf-8 -*- """ # Author Xu Junkai # coding=utf-8 # @Time : 2021/2/19 18:32 # @Site : # @File : before_request.py # @Software: PyCharm """ import re import json from globals.bp_v1_manage import bp_v1 from flask import request, current_app, g from server.libs.red...
shineyGuang/flask_Cli
globals/before_request.py
before_request.py
py
1,916
python
en
code
0
github-code
13
25661760857
from ast import Delete from django.http import HttpResponse, JsonResponse, Http404 from django.views.decorators.csrf import csrf_exempt from rest_framework.parsers import JSONParser from rest_framework.views import APIView from snippets.models import Snippets from snippets.serializers import SnippetsSerializer from res...
Rahulbeniwal26119/django-rest-tutorial
snippets/views.py
views.py
py
4,735
python
en
code
0
github-code
13
34348836183
import tensorflow as tf import numpy as np import pickle import os import GlobalParameter from tensorflow.contrib.crf import viterbi_decode class Predictor: def __init__(self, model_file, map_file): word2id, tag2id, id2tag = pickle.load(open(map_file, 'rb')) self.word2id = word2id self.tag...
yuhanzhang/WordSegmentation
Predictor.py
Predictor.py
py
3,399
python
en
code
0
github-code
13
5339604404
import sys import os import random class org: def __init__(self, bssid=''): self.bssid = bssid self.org = self.findORG(self.bssid) def findORG(self, bssid): file__ = open(os.getcwd()+'/utils/macers.txt', 'r') for line in file__.readlines(): if line.strip('\n').split(' ~ ')[0].lower() == bssid.lower()[0:...
hash3liZer/WiFiBroot
utils/macers.py
macers.py
py
1,059
python
en
code
873
github-code
13
73703989137
import os from keras.models import load_model from datetime import datetime def export_model(model, settings): foldername = datetime.now().strftime('%Y%m%d_%H-%M-%S') if not os.path.exists("./models/" + foldername): os.makedirs("./models/" + foldername) settings_file = open("./models/" + folderna...
luke-z/SwissGermanToText
export_model.py
export_model.py
py
774
python
en
code
1
github-code
13