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
74606059388
from __future__ import unicode_literals try: from urllib2 import Request except ImportError: from urllib.request import Request from mock import MagicMock, patch from requests_kerberos import HTTPKerberosAuth from grafana_dashboards.client.connection import (KerberosConnection, ...
jakubplichta/grafana-dashboard-builder
tests/grafana_dashboards/client/test_connection.py
test_connection.py
py
3,770
python
en
code
141
github-code
6
36031012834
# Recursive def maxSum(n, arr): # Write your code here. def recurse(idx): if idx == 0: return arr[idx] if idx < 0: return 0 pick = arr[idx] + recurse(idx-2) not_pick = recurse(idx-1) return max(pick, not_pick) return recurse...
aad17/Striver-Dynamic-Programming
maxnonadjecentsum.py
maxnonadjecentsum.py
py
1,479
python
en
code
0
github-code
6
2523947822
import argparse import torch from model import Pretrain_SegmentationNet, DPRAN import os from data.dataloader import create_dataloader from train import net_Pretrain, DPRAN_Train import segmentation_models_pytorch as smp def main(): parser = argparse.ArgumentParser(description='DPRAN') parser.add_argument('--...
wanpeng16/DpRAN
main.py
main.py
py
3,242
python
en
code
1
github-code
6
19147556064
'''PROGRAM ANALISIS VARIANSI (Rata-Rata n Populasi -- Kalo Variansi sama dari uji Levene test)''' import scipy.stats as st print(" H0 : miu sampe n sama semua") print(" H1 : Ada miu yang tidak sama\n") alfa = input("Tingkat Signifikansi : ") jumlah_populasi = int(input("Jumlah Populasi : ")) data_populasi ...
fstevenm/Project-Statistics
Statistic Method/Analisis Variansi Satu Arah.py
Analisis Variansi Satu Arah.py
py
5,809
python
en
code
0
github-code
6
35841585660
# from time import sleep import os # from reply1024 import postreply1024 # import time from datetime import datetime, timedelta tday = datetime.now()+timedelta(hours = 8) print(tday.hour) tday.strftime("%Y-%m-%d %H:%M:%S") print(tday) if os.path.isdir("tmp")==0: os.mkdir("tmp") with open("./tmp/test.txt","r+") as...
Mmingdev/reply-1024
test.py
test.py
py
630
python
en
code
0
github-code
6
8855989929
# Importamos Pillow from PIL import Image import glob # Importamos Pandas import pandas as pd import csv # TIME import time import datetime from time import gmtime, strftime # Importamos Pytesseract import pytesseract import os path = "./output/media" for root,dirs,files in os.walk(path): ...
bisite/Telegram-History-dump
telegram/img_ocr.py
img_ocr.py
py
1,331
python
en
code
0
github-code
6
29790002949
users={} name = input("What is your Name : ") age = input("What is your age : ") fav_movies=input("Enter your fav movies seprated by , ").split(',') fav_songs=input("Enter your fav songs seprated by , ").split(',') users['name']=name users['age']=age users['fav_movies']=fav_movies users['fav_songs']=fav_songs print(u...
chiragkuk/Learningpython
Chapter7/exercise2.py
exercise2.py
py
424
python
en
code
1
github-code
6
28026928602
# -*- coding: utf-8 -*- """ Created on Mon Jun 22 11:31:56 2020 @author: admin """ from __future__ import print_function import os, sys, time, argparse from sensapex import SensapexDevice, UMP, UMPError parser = argparse.ArgumentParser( description="Test for sensapex devices; prints position and status updates...
bsbrl/Amey_microinjection
Sensapex_Manipulator/test.py
test.py
py
1,293
python
en
code
0
github-code
6
35327101756
# -*- coding: utf-8 -*- """ Created on Fri Apr 14 15:00:34 2017 @author: rsotoc """ import numpy as np import pandas as pd import time import re import nltk from nltk.corpus import stopwords from nltk.util import ngrams from sklearn.model_selection import train_test_split from bs4 import BeautifulSoup from sklearn...
rsotoc/pattern-recognition
Data sets/ngrams.py
ngrams.py
py
4,516
python
en
code
14
github-code
6
72143905788
from typing import Dict, List, Union import csv import os from unittest import result def load_csv( file_path: str, delimiter: str = ',', has_header: bool = True, try_casting: bool = True ) -> List[Dict]: ''' This function laods a csv file from the given path. It accepts both csv with head...
levensworth/udesa-pc-tutorial
mini-proyectos/song_recommendation/text_processing.py
text_processing.py
py
1,864
python
en
code
2
github-code
6
70756306748
__author__ = 'jacopobacchi' import RPi.GPIO as GPIO import time import shlex import subprocess # Define Buttons PREV = 4 NEXT = 17 PLAY = 27 REPEAT = 22 GPIO.setmode(GPIO.BCM) GPIO.setup(PREV, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(NEXT, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(PLAY, GPIO.IN, pull_up_down=...
jacopobac/PiPod
buttonsControl.py
buttonsControl.py
py
1,926
python
en
code
0
github-code
6
3035685345
# find the minimum length of the subarray whose values sum # to a value greater than or equal to a target. assume all # array entries are positive import numpy as np vec = np.array([2,3,1,2,4,3]) target = 7 L=0 R=0 min_length = np.inf cur_length = np.inf cur_sum = 0 for R,n in enumerate(vec): cur_sum += n whi...
estimatrixPipiatrix/decision-scientist
key_algos/moving_window.py
moving_window.py
py
537
python
en
code
0
github-code
6
18200259066
''' . Isomorphic Strings All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself. ''' # def reduce(s): # result = [] # lookup = {} # for i, c in enumerate(s): # ...
rashmi-fit/100-daysOf-Python_challenge
Isomorphic_Strings.py
Isomorphic_Strings.py
py
1,110
python
en
code
2
github-code
6
11812609282
"""empty message Revision ID: 08084a992d8b Revises: Create Date: 2018-03-23 09:28:07.017990 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '08084a992d8b' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
victorjambo/WeConnect
migrations/versions/08084a992d8b_.py
08084a992d8b_.py
py
2,922
python
en
code
2
github-code
6
31066666255
from django.urls import path from . import views urlpatterns = [ path('', views.loginView, name='login'), path('register/', views.registerView, name='register'), path('logout/', views.logoutView, name='logout'), path('akun/', views.update_akunView, name='update_akun'), path('register/berhasil', vie...
mugiwara35/smart-plant
akun/urls.py
urls.py
py
512
python
en
code
0
github-code
6
25022233496
import sys sys.stdin = open('input.txt') T = int(input()) for t in range(T): N, M, L = map(int, input().split()) tree = [0] * (N+1) for i in range(M): node, val = map(int, input().split()) tree[node] = val for i in range(N, 0, -1): if tree[i] == 0 and 2*i + 1 < N+1: ...
pepper999/TIL
algorithm_lecture/05_tree_Jiheon/5178_sumofnodes/sol.py
sol.py
py
446
python
en
code
2
github-code
6
42934168844
from pyherc.ports import set_action_factory from pyherc.data import Model from pyherc.test.builders import ActionFactoryBuilder from pyherc.test.cutesy import (Arrows, Bow, Club, Dagger, LeatherArmour, PlateMail, Rune, ScaleMail, Sword, Warhammer, LightBoo...
tuturto/pyherc
src/pyherc/test/bdd/features/helpers/context.py
context.py
py
5,476
python
en
code
43
github-code
6
33250585794
#Dependencies import os import csv csvpath = os.path.join('..', 'Resources', 'election_data.csv') # Open the file using "write" mode. Specify the variable to hold the contents with open(csvpath, newline='') as csvfile: #set variable vote_count= [] candidatelist = [] unique_candidate= [] vote_perc...
beau-nguyen/Python_Challenge
PyPoll/Solved/main.py
main.py
py
1,385
python
en
code
0
github-code
6
39914923603
import cv2 import pickle import numpy as np import random import threading import warnings from ..utils.image import read_image_bgr import numpy as np from PIL import Image from six import raise_from import csv import sys import os.path import keras from ..utils.anchors import ( anchor_targets_bbox_centers, ...
kocurvik/retinanet_traffic_3D
keras_retinanet/preprocessing/centers_generator.py
centers_generator.py
py
18,123
python
en
code
24
github-code
6
35395933423
import functools import ipaddress import re import socket from pathlib import Path, PurePath from random import SystemRandom from types import TracebackType from typing import Any, AsyncContextManager, Awaitable, Callable, Dict from typing import Generator, Generic, IO, Mapping, Optional, Sequence from typing import T...
ronf/asyncssh
asyncssh/misc.py
misc.py
py
22,888
python
en
code
1,408
github-code
6
35841499580
from .gameunit import GameUnit class Explosion(GameUnit): def __init__(self): super().__init__() self.health = 1 def expand_calc(self): factor = 1 + 0.01*(self.factor - self.health) self.size[0] = int((self.origin_size[0])*factor) self.size[1] = int((self.orig...
MMiirrkk/Galaxy_Shooter_I
objects/explosion.py
explosion.py
py
978
python
en
code
0
github-code
6
19875373112
import sys import os from Model.Pairwise.Embedding import RelationEmbedding from typing import List, Dict, Tuple BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(BASE_DIR) class InputExample(object): """A single training/test example for simple sequence clas...
EnernityTwinkle/KBQA-QueryGraphSelection
RankingQueryGraphs/Model/common/InputExample.py
InputExample.py
py
1,494
python
en
code
5
github-code
6
35694943116
from enum import Enum, unique @unique class Move(Enum): THE_SAME = 0, LEFT = 1, TOP = 2, RIGHT = 3, DOWN = 4, LEFT_TOP = 5, RIGHT_TOP = 6 LEFT_DOWN = 7, RIGHT_DOWN = 8 class P: Left = 0.2 Right = 0.4 Top = 0.3 Down = 0.2 Vertical_Same = 0.5 Horizontal_Same...
yuryybk/bulbacon_2019_task
Task.py
Task.py
py
4,012
python
en
code
0
github-code
6
5960535728
#!/usr/bin/env python3 # # File: tidal_perturbation_in_circular_binary.py # Author: Timothy Van Reeth <timothy.vanreeth@kuleuven.be> # License: GPL-3+ # Description: Calculating the observed flux variations of a tidally # distorted g-mode pulsation in a circular, synchronised # binary system ...
colej/eb_mapping
run_model.py
run_model.py
py
14,587
python
en
code
0
github-code
6
27973693497
import json import urllib.request # read the model into a variable with open ("../src/test/gene-filter-example-2.xml", "r") as f: model=f.read() # encode the job job = { "export": { "network_type":"en", "network_format":"sbml" }, "filter": { "species": ["h2o", "atp"], "re...
binfalse/GEMtractor
clients/PythonClient.py
PythonClient.py
py
1,081
python
en
code
2
github-code
6
73733113787
from schedule import Scheduler from session.manager import SessionManager class GlobalObjectClass: def __init__(self): self.text: str = "" self.database: str = "" self.session_manager: SessionManager | None = None self.scheduler: Scheduler | None = None globalObject = GlobalObjec...
fkxxyz/chatgpt-session
server/common.py
common.py
py
329
python
en
code
1
github-code
6
27466130779
# Dictionary capitals = { # "key": value, "Canada": "Ottawa", "France": "Paris", "Kazakhstan": "Astana", "Russia": "Moscow" } continents = { "Canada": "North America", "France": "Europe", "Kazakhstan": "Asia", "Russia": ["Asia", "Europe"] # Dictionary data type can contain anothe...
00009115/CSF.CW1.00009115
dictionaries/dictionaries.py
dictionaries.py
py
3,143
python
en
code
1
github-code
6
41383190209
import math from abc import ABC, abstractmethod from dataclasses import dataclass from hvac import Quantity from hvac.fluids import Fluid from hvac.refrigerant_piping.copper_tubing import CopperTube from hvac.fluid_flow import Pipe, Circular Q_ = Quantity @dataclass class RefrigerantCycleData: rfg: Fluid T_...
TomLXXVI/HVAC
hvac/refrigerant_piping/sizing.py
sizing.py
py
10,022
python
en
code
8
github-code
6
35417197808
import csv from dataclasses import dataclass, field from itertools import count from ..configs import Configs from ..utils import add_bytes, stringify from .actions import MONSTER_ACTIONS, Action from .autoabilities import AUTOABILITIES from .characters import CHARACTERS, Character from .constants import ( Element...
coderwilson/FFX_TAS_Python
tracker/ffx_rng_tracker/data/monsters.py
monsters.py
py
18,996
python
en
code
14
github-code
6
764666346
# Django初期化 import os, django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") django.setup() # views.py from datetime import date from django.db.models import Count, Q from app.models import Staff today = date(2023, 2, 14) # 動作検証用 qs = ( Staff.objects .values("pk", "name") # group byのキー ...
shimizukawa/pycon-apac-2023-django-orm-dojo
src/try/try2-after.py
try2-after.py
py
1,811
python
en
code
0
github-code
6
39443369301
def main(): dim = int(input("Enter odd number of rows/columns: ")) while dim % 2 != 1: dim = int(input("Enter odd number of rows/columns: ")) # create rows grid = [] for i in range(dim): row = [] for j in range(dim): row.append(0) grid.append(row) count = dim ** 2 grid[dim // 2][dim //...
ZeerakA/CS303E
challenge_spiral.py
challenge_spiral.py
py
930
python
en
code
0
github-code
6
9484548824
import pygame import sys #define bird class class Bird(object): def __init__(self): self.birdRect = pygame.Rect(65,50,50,50) self.birdStatus = [pygame.image.load("flappybirdassets/assets/1.png"), pygame.image.load("flappybirdassets/assets/2.png"), ...
hxg10636/flappygame
flappybird.py
flappybird.py
py
3,693
python
en
code
0
github-code
6
16637468602
# Write Text command, sends one or multiple text field class WriteSpecialFunctions: code = b"E" def __init__(self): self.label = b"" self.data = b"" # Memory configs self.memory_configs = [] # Checksum? self.checksum = False # Each special function has it'...
prototux/python-alphasign
alphasign/command/write_special_functions.py
write_special_functions.py
py
3,829
python
en
code
0
github-code
6
12464441939
import argparse import os import shutil import socket import time import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.parallel import torch.optim as optim import torch.utils.data import torchvision.utils as vutils import torchvision.transforms as transforms from tensorboardX import...
changminL/stegano
main.py
main.py
py
26,162
python
en
code
0
github-code
6
14539725898
# class Solution: # 作弊解法 # def permute(self, nums): # import itertools # return list(itertools.permutations(nums)) class Solution: def permute(self, nums): res = [] if len(nums) == 1: # 结束条件 return [nums] if len(nums) == 2: # 结束条件 return [nums,...
Rainphix/LeetCode
046_permutations.py
046_permutations.py
py
682
python
en
code
0
github-code
6
34472580214
import numpy as np import matplotlib.pyplot as plt def optimum_cf (gamma, P_exit_pa, mean_Pc_pa, ): cf = lambda p2_p3, p3_p1: np.sqrt((2 * (gamma ** 2) / (gamma - 1)) * ((2 / (gamma + 1)) ** ((gamma + 1) / (gamma - 1))) * (1 - (p2_p3 * p3_p1) ** ((gamma - 1) / gamma))) + (p2_p3 * p3_p1 - p3_p1) \ ...
rescolarandres/Coding_venture_projects
Rocket Nozzle Optimization in Python/optimum_cf.py
optimum_cf.py
py
972
python
en
code
0
github-code
6
70101586109
from SlackClient import SlackClient class SlackFiles(SlackClient): def __init__(self): self.file = None self.id = None self.count = None self.cursor = None self.limit = None self.page = None self.channel = None self.show_files_hidden_by_limit = Non...
cthacker-udel/Python-Slack-API
SlackFiles.py
SlackFiles.py
py
4,086
python
en
code
1
github-code
6
25068498925
from uuid import uuid4 from typing import Tuple, List from asendia_us_lib.shipping_request import ShippingRequest, Item from asendia_us_lib.shipping_response import PackageLabel from purplship.core.units import CustomsInfo, Packages, Options, Weight from purplship.core.utils import Serializable, DP from purplship.core....
danh91/purplship
sdk/extensions/asendia_us/purplship/providers/asendia_us/shipment/create.py
create.py
py
5,068
python
en
code
null
github-code
6
10414559833
import collections from typing import Any, List import torch from executorch.exir.dialects.edge.arg.model import BaseArg from executorch.exir.dialects.edge.arg.type import ArgType def extract_return_dtype( returns: Any, sample_returns: List[BaseArg] ) -> List[torch.dtype]: """Extract the dtype from a return...
pytorch/executorch
exir/dialects/edge/dtype/utils.py
utils.py
py
1,125
python
en
code
479
github-code
6
19325547874
from pandas import read_csv from sklearn.metrics import mean_absolute_percentage_error from math import sqrt from matplotlib import pyplot as plt from pandas import concat import numpy as np import scipy.stats as stats import pandas as pd def persistence_one_step_ln(train_log, teste_log, show_results=False, plot_...
gsilva49/timeseries
H/python_code/persistence_one_step_ln.py
persistence_one_step_ln.py
py
1,509
python
en
code
0
github-code
6
73859053626
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objects as go import pandas as pd import plotly.express as px # Read data from a csv z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/...
juakonap/dash-3d
app/app.py
app.py
py
1,941
python
en
code
0
github-code
6
6604263556
#!/usr/bin/env python3 '''conda create -n pytorch-env python=3.9 shap pandas optuna=2.10.1 xgboost scikit-learn sklearn-pandas rdkit pytorch torchvision torchaudio pytorch-cuda=11.6 cairosvg dgllife dgl=0.9.1 dgl-cuda11.6 ipython -c pytorch -c nvidia -c dglteam''' import pandas as pd import numpy as np import datetime,...
JianyongYuan/sklearn-scripts
Scikit-learn/Predictions/sklearn_evaluation.py
sklearn_evaluation.py
py
8,232
python
en
code
0
github-code
6
70403733947
import mysql.connector import const file='192.168.2.txt' src='192.168.5.89' query="INSERT INTO packet(srcip,dstip,dstport,service) values(%s,%s,%s,%s)" conn = mysql.connector.connect( host='localhost', port='3306', user='root', password=const.password, database='ics' ) cur = conn.cursor() f =...
gamzattirev/icsrisk
tools/python/nmap.py
nmap.py
py
821
python
en
code
0
github-code
6
31179240116
#!/usr/bin/env python # coding: utf-8 # In[1]: demand = [990,1980,3961,2971,1980] d=0 # d% shortage allowance Y_b = [1.3086,1.3671,1.4183,1.4538,1.5122] # Fabric yield (consumption rate) rate per garment of size 饾浗 U = 0.85 l_max= 20 e= .07 # Fabric end allowance f= 2.90 # Fabric cost if len(dema...
sharif8410/COP_Doc
PSO Clean notebook-Heuristic import.py
PSO Clean notebook-Heuristic import.py
py
18,651
python
en
code
0
github-code
6
18537103489
# Prob_link: https://www.codingninjas.com/studio/problems/construct-binary-tree-from-inorder-and-postorder-traversal_8230837?challengeSlug=striver-sde-challenge&leftPanelTab=0 class TreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def constr...
Red-Pillow/Strivers-SDE-Sheet-Challenge
P131_Construct_Binary_Tree_from_Inorder_and_Postorder_Traversal.py
P131_Construct_Binary_Tree_from_Inorder_and_Postorder_Traversal.py
py
906
python
en
code
0
github-code
6
4243718619
from fastapi import APIRouter, HTTPException, status, Query from datetime import timedelta from datetime import datetime from github import Github import random router = APIRouter() github = Github() @router.get("/repo/health") def repo_health_check(): return {"status": "OK"} # return each contributor with thei...
sweng-project-tcd/dashboard-back
router/repo/repo.py
repo.py
py
6,032
python
en
code
0
github-code
6
7869741779
# 本プログラムを Python で提出すると、比較的処理が遅くなるため実行時間制限オーバー (TLE) となります。 # PyPy3 で提出すると、正解 (AC) することができます。 # リュカの定理で ncr mod 3 を計算 def ncr(n, r): if n < 3 and r < 3: A = [ [ 1, 0, 0 ], [ 1, 1, 0 ], [ 1, 2, 1 ] ] return A[n][r] return ncr(n // 3, r // 3) * ncr(n % 3, r % 3) % 3 # 入力 N = int(input())...
E869120/math-algorithm-book
editorial/chap6-26_30/prob6-28.py
prob6-28.py
py
766
python
ja
code
897
github-code
6
30448991195
#!/usr/bin/env python # coding: utf-8 # In[ ]: import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import numpy as np # In[27]: class MultiHeadSelfAttention(layers.Layer): def __init__(self, embed_dim, num_heads=8): super(MultiHeadSelfAttention, self).__init__() ...
pdrsa/ECG_Reports_Classification
bert/BERT_classification.py
BERT_classification.py
py
6,057
python
en
code
1
github-code
6
4737844765
from pathlib import Path # Pathlib - Working with file paths p = Path('.') # Creates a path object in found OS (Windows Path) test = [x for x in p.iterdir() if x.is_dir()] print(p.resolve()) # Show file dir in your OS format (D:\Backup\Work\DevOps\Programming\Scripts\Python\fundamentals\Built In Modules\pathlib) ne...
danlhennessy/Learn
Python/fundamentals/Built_In_Modules/pathlib/main.py
main.py
py
716
python
en
code
0
github-code
6
42107956910
import pickle import numpy PATH = '../../data/' def get_all_instances_of_symbol(symbol): f = open(PATH + symbol.upper(), 'rb') return pickle.load(f) def plot(loss_history, train_acc_history, val_acc_history): plt.subplot(2, 1, 1) plt.plot(train_acc_history) plt.plot(val_acc_history) plt.title('accuracy vs time...
nishithbsk/ImaginedSpeech
scripts/ConvNet/util.py
util.py
py
550
python
en
code
7
github-code
6
7792745843
#!/usr/bin/env python3 """Resolve docker container's name into IPv4 address""" import docker from ipaddress import ip_address, IPv4Address, IPv6Address from threading import Thread from twisted.internet import reactor, defer from twisted.names import client, dns, server LISTEN_ADDRESS = "127.0.0.1" DNS_PORT = 53 cl...
dangoncalves/docker-dns
dockerDNS/dockerDNS.py
dockerDNS.py
py
9,886
python
en
code
3
github-code
6
811493816
# Unique Paths - https://leetcode.com/problems/unique-paths/ '''A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the d...
Saima-Chaity/Leetcode
Matrix/uniquePaths.py
uniquePaths.py
py
3,502
python
en
code
0
github-code
6
15999128955
# -*- coding: utf-8 -*- """ 无签名版本 """ import re import json from scrapy import Spider from scrapy.http import Request from douyin_app.docs.conf import HEADER class DouyinIdolVideoSpider(Spider): name = "idol_douyin_video" idol_url = '' video_list_url = 'https://api.amemv.com/aweme/v1/aweme/post/?user_id=...
iamxuwenjin/videos_download
douyin_app/spiders/douyin_idol_video_download.py
douyin_idol_video_download.py
py
2,271
python
en
code
6
github-code
6
17493585244
#this function gets the dynamic trajectory of a Car #inputs are time, position, height, time in, time out, velocity in, velocity out, and Car struct #outputs are time, Velocity, and position import math def trajectory(t,X,h,t_in,t_out,V_in,V_out,Car): V_top = Car["top_speed"] t_top = Car['t2top_speed'] ...
brandontran14/CarSimulation
trajectory.py
trajectory.py
py
2,155
python
en
code
0
github-code
6
43586733257
# đọc nọi dung của tệp # f = open("read.txt","r") # print(f.read()) # trả về 5 ký tự đầu tiên của tệp: f = open("read.txt","r") # print(f.read(5)) # # đọc dòng đầu tiên # print(f.readline()) # print(f.readline()) # for x in f: # print(x) # print(f.readline()) # f.close() f.write("Now the file has more content")...
Lengan0101/Python
tep.py
tep.py
py
450
python
vi
code
0
github-code
6
11415064866
""" Original multirc format: { data: [ { id: str, paragraph: { text: { }, questions: [ { question: str, sentences_used: [ in...
nli-for-qa/conversion
qa2nli/qa_readers/multirc.py
multirc.py
py
3,998
python
en
code
1
github-code
6
32410264814
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.core.validators class Migration(migrations.Migration): dependencies = [ ('app', '0016_auto_20150828_0735'), ] operations = [ migrations.AlterField( model_na...
jacyn/burst
webapp/app/migrations/0017_auto_20150828_0747.py
0017_auto_20150828_0747.py
py
609
python
en
code
0
github-code
6
69805130109
#"Fase de geração" import csv from builtins import any as b_any from ExtensoToInteiro import ExtensoToInteiro def ordena_dets_num_adverq(traducao): """ Ordena determinantes, numerais e adverbios de quantidade consoante a LGP. :param traducao: frase :return: """ indice = 0 while indice < len(traducao): val...
ineslacerda/PE2LGP-Translator
PE2LGP/Modulo_construcao_regras/geracao_fase.py
geracao_fase.py
py
13,124
python
pt
code
2
github-code
6
6827592670
def even(n): if n>10: i=0 sum=0 re=0 while i<n: re=n%10 sum=sum+re n=n//10 return even(sum) else: if n%2==0: print(n,"even") else: print(n,"odd") even(n=int(input("enter the number")))
Kaguinewme/function
write a program in C to find the sum of digits of a number using recursion.py
write a program in C to find the sum of digits of a number using recursion.py
py
308
python
en
code
0
github-code
6
4463507689
from django.shortcuts import render from django.views.generic import View from .models import * # Create your views here. class ProjectsList(View): def get(self,request): try: us = User.objects.get(username=request.user) except: us = None projects = Project.objects....
virasium/TM
taskmain/views.py
views.py
py
618
python
en
code
0
github-code
6
40749106105
from ReverseSequence import reverse currentdict=[] with open('1rosalind.txt') as f: for line in f: currentdict.append(line.strip()) '''create setS containing all non duplicate items of the strings and the reverse complements of the strings ''' seconddict = [] for i in currentdict: seconddic...
HanielDorton/Project_Rosalind
ConstructionaDeBruijnGraph/ConstructionaDeBruijnGraph.py
ConstructionaDeBruijnGraph.py
py
589
python
en
code
0
github-code
6
29961826770
from selenium import webdriver import json import traceback import urllib.request def parse_page(driver): script_clue = "q(\"talkPage.init\"," try: for script in driver.find_elements_by_tag_name("script"): content = script.get_attribute("innerHTML") if content.startswith(scrip...
ShadowTemplate/ted-downloader
ted.py
ted.py
py
1,781
python
en
code
0
github-code
6
32111244416
import os import cv2 import sys import math import time import numpy as np import matplotlib.pyplot as plt from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5 import uic # 이미지를 읽어서 pyqt로 보여주는 함수 def cvtPixmap(frame, img_size): frame = cv2.resize(frame, im...
HanNayeoniee/visual-fatigue-analysis
pupil_detection/utils.py
utils.py
py
11,187
python
en
code
1
github-code
6
35860329695
import os import subprocess import tkinter as tk from tkinter import filedialog, messagebox,ttk from tkinter import * def run_command(command): result = subprocess.run(command, shell=True, capture_output=True, text=True) return result.stdout.strip() def browse_directory(): directory_path = filedialog.ask...
adityaagg7/Tally-CodeBrewers-INT_WIN
OBSOLETE/tkt_scan_updated.py
tkt_scan_updated.py
py
5,333
python
en
code
0
github-code
6
20538433969
# https://practice.geeksforgeeks.org/problems/nearly-sorted-1587115620/1 """ Time complexity:- O(N logk) Space Complexity:- O(K) """ import heapq class Solution: def nearlySorted(self, arr, k): res = [] # Result array to store the nearly sorted elements minHeap = [] # Min heap to maintain the...
Amit258012/100daysofcode
Day58/nearly_sorted.py
nearly_sorted.py
py
760
python
en
code
0
github-code
6
2773267706
# Given a 2D board and a word, find if the word exists in the grid. # The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once. # Example: # board = # [ # ['A','B','C','E'], #...
queryor/algorithms
leetcode/79. Word Search.py
79. Word Search.py
py
1,405
python
en
code
0
github-code
6
35729296994
import klepto import shelve import pickle import numpy as np from scipy.sparse import * from pyspark.mllib.recommendation import ALS from pyspark.sql import SparkSession ############### Load Data ################## rating_matrix_csc = load_npz('netflix/sparse_matrix_100%.npz').tocsc() rating_matrix_val_csc = load...
clamli/Decision-tree-model-for-active-learning
Netflix-based/MF param train.py
MF param train.py
py
8,140
python
en
code
7
github-code
6
14540936446
"""Escea Fireplace UDP messaging module Implements simple UDP messages to Fireplace and receiving responses """ import asyncio import logging from asyncio import Lock from asyncio.base_events import BaseEventLoop from async_timeout import timeout from typing import Any, Dict # Pescea imports: from .message impor...
lazdavila/pescea
pescea/datagram.py
datagram.py
py
4,657
python
en
code
0
github-code
6
14200766996
import json import os import traceback from discord import AllowedMentions, Embed, Forbidden from discord.ext import commands class Core(commands.Cog): def __init__(self, bot): self.bot = bot self.db = self.bot.db async def push_link_json(self, guild) -> None: data = {} for i...
yutarou12/ChIn-RoleBot
cogs/Core.py
Core.py
py
1,875
python
en
code
0
github-code
6
1924258051
"""Regridding operator.""" # Standard library import dataclasses as dc import typing # Third-party import numpy as np import xarray as xr from rasterio import transform, warp from rasterio.crs import CRS Resampling: typing.TypeAlias = warp.Resampling # For more information: check https://epsg.io/<id> CRS_ALIASES = ...
MeteoSwiss-APN/icon_data_processing_incubator
src/idpi/operators/regrid.py
regrid.py
py
5,416
python
en
code
0
github-code
6
30168367656
# %% import numpy as np import matplotlib.pyplot as plt from scipy.stats import ks_2samp import seaborn as sns import pandas as pd import random from collections import defaultdict from scipy.stats import ks_2samp, wasserstein_distance from doubt import Boot from nobias import ExplanationShiftDetector random.seed(0) #...
cmougan/ExplanationShift
syntheticLime.py
syntheticLime.py
py
5,594
python
en
code
1
github-code
6
29792375641
#!/usr/bin/env python3 import sys import numpy as np from scipy.spatial.transform import Rotation as R from scipy.interpolate import interp1d import rospy import moveit_commander import actionlib from franka_gripper.msg import MoveGoal, MoveAction from geometry_msgs.msg import Point, Pose, PoseStamped from control_ms...
dwya222/end_effector_control
scripts/demo_interface.py
demo_interface.py
py
13,316
python
en
code
0
github-code
6
21375968156
from django.db import models # Create your models here. class Movie(models.Model): id = models.BigAutoField( primary_key=True ) name = models.CharField( max_length=250, verbose_name="Moive name" ) desc = models.TextField( verbose_name="Description" ) year = ...
adhilshaw/moviedemoapp
movieapp/models.py
models.py
py
558
python
en
code
0
github-code
6
71874843708
# Import necessary modules and libraries from dotenv import load_dotenv import os import base64 from requests import post, get import json # Load environment variables from .env file load_dotenv() # Import CLIENT_ID and CLIENT_SECRET from environment variables client_id = os.getenv("CLIENT_ID") client_s...
linnathoncode/SpotifyApiApp
main.py
main.py
py
3,588
python
en
code
0
github-code
6
13300580084
# -*- coding: utf-8 -*- """ Helper functions for classification and quantization Created on Mon Dec 5 14:50:27 2016 @author: brady """ import os import numpy as np from sklearn.tree import tree, _tree def quantize(data, precision): """ Turns floating point into fixed point data :param data: vector to q...
bradysalz/MinVAD
classifier/training_helpers.py
training_helpers.py
py
3,449
python
en
code
0
github-code
6
826135486
# -*- coding: utf-8 -*- """ Created on Sat May 7 17:36:23 2022 @author: ThinkPad """ from __future__ import print_function import argparse import os import numpy as np import random import torch import torch.nn.parallel import torch.optim as optim import torch.utils.data from PartialScan import PartialScans,unpickle ...
FreddieRao/TextCondRobotFetch
pointnet/train.py
train.py
py
6,147
python
en
code
2
github-code
6
21077671370
import os import tarfile #from api_mnode import about from log_setup import Logging, MLog from program_data import PDApi """ NetApp / SolidFire CPE mnode support utility """ # set up logging logmsg = Logging.logmsg() class UpdateMS(): def __init__(self, repo): current_version = repo.about["mnode_bun...
solidfire/mnode-support-util
update_ms.py
update_ms.py
py
2,042
python
en
code
0
github-code
6
34736461093
# -*- coding: utf-8 -*- import scrapy import re import json from video_scrapy.items import * import hashlib from video_scrapy.settings import my_defined_urls class YoutubeDlSpider(scrapy.Spider): name = 'video' youtube_dl_not_you_get = False handle_httpstatus_list = [404] def __init__(self, my_url=Non...
yllgl/my_video_scrapy
video_scrapy/spiders/video_spider.py
video_spider.py
py
19,315
python
en
code
0
github-code
6
41119941323
import numpy as np import funcs from utils import fs, unison_shuffled_copies # from matplotlib import pyplot as plt # import random # from utils import * # import scipy.io as sio # from copy import deepcopy LR = 2 LR_DECAY = .9999 MIN_LR = 0.000000001 DEBUG = False class Layer: def __init__(self, in_dim, out_dim):...
eladfeld/deepLearningFirstAssingnment
code/NN2.py
NN2.py
py
6,346
python
en
code
0
github-code
6
25961872136
# -*- coding: utf-8 -*- """ This Python file is been made by the project group Mattek5 C4-202 This is a test of how much packetloss the prediction of a sound file can have and still be intelligibly """ from __future__ import division import os import sys lib_path = '\\Scripts\\libs' data_path = '\\Lydfiler\\Sound' e...
AalauraaA/P5
Supplerende_materiale/Scripts/packetloss.py
packetloss.py
py
1,773
python
en
code
0
github-code
6
8466448273
#!usr/bin/env python # -*- coding: utf-8 -*- import itertools import alphabet from sequence_utils import get_reverse_complement from get_kmers import get_kmers_from_sequence import fasta_parser def iter_kmers(alphabet, k): """Generator function that yields every kmer (substring of length k) over an alphabet, ...
schlogl2017/PauloSSchlogl
get_palindromes.py
get_palindromes.py
py
5,625
python
en
code
0
github-code
6
14762866711
from tkinter import * import tkinter.font from gpiozero import LED import RPi.GPIO RPi.GPIO.setmode(RPi.GPIO.BCM) blue = LED(2) green = LED(3) red = LED(4) win = Tk() win.title("LED GUI Toggler") myFont = tkinter.font.Font(family = 'Helvetica', size = 12, weight = "bold") def ledToggleBlue(): if blue.is_lit: ...
chris-yl31/SIT210-Task5.2C-RPiGUI
GUI.py
GUI.py
py
1,525
python
en
code
0
github-code
6
16543286247
from nuitka.containers.OrderedDicts import OrderedDict from nuitka.Errors import NuitkaOptimizationError from nuitka.PythonVersions import python_version from nuitka.utils.InstanceCounters import ( counted_del, counted_init, isCountingInstances, ) from nuitka.Variables import LocalsDictVariable, LocalVariab...
Nuitka/Nuitka
nuitka/nodes/LocalsScopes.py
LocalsScopes.py
py
14,085
python
en
code
10,019
github-code
6
72532058109
import json import arrow import requests from monitor_release.models import RunningSidecar from monitor_release.settings import Settings def get_bearer_token(settings: Settings): headers = {"accept": "application/json", "Content-Type": "application/json"} payload = json.dumps( { "Username...
ITISFoundation/osparc-simcore
scripts/release/monitor/monitor_release/portainer_utils.py
portainer_utils.py
py
4,679
python
en
code
35
github-code
6
26929642562
import plotly.graph_objects as go import plotly.io as pio from PIL import Image # to render in jupyterlab #pio.renderers.default = "plotly_mimetype" # Create figure fig = go.Figure() pyLogo = Image.open(r'C:\Users\l.trouw\Documents\Pycharm\Lean_simulation\VSMvisualizationMatrasses.png') # Add trace fig.add_trace( ...
luuktrouw/Districon_lean_AdvancedAnalytics
Testfile.py
Testfile.py
py
665
python
en
code
0
github-code
6
14837403984
from django.urls import path from . import views urlpatterns = [ path('post/<int:comment_pk>/comment_edit/', views.comment_edit, name='comment_edit'), path('post/new/', views.post_new, name='post_new'), path('post/list', views.post_list, name='post_list'), path('post/<int:post_pk>/', views.post_detail...
meeeeeeeh/djangoblog
post/urls.py
urls.py
py
1,384
python
en
code
0
github-code
6
28585638952
from sklearn.model_selection import train_test_split import pandas as pd import tensorflow as tf import tensorflow_hub as hub from datetime import datetime import tensorflow_datasets as tfds import bert from bert import run_classifier from bert import optimization from bert import tokenization from bert import run_clas...
jdanene/patent-language-modeling
src/analysis/code/runBert.py
runBert.py
py
18,927
python
en
code
0
github-code
6
24199790207
class Solution: def nextGreaterElements(self, nums): """ Args: nums: list[int] Return: list[int] """ res = [-1 for _ in range(len(nums))] stack = [] for _ in range(2): for i in range(len(nums)): whil...
AiZhanghan/Leetcode
code/503. 下一个更大元素 II.py
503. 下一个更大元素 II.py
py
523
python
en
code
0
github-code
6
13240819097
# # A framework for messaging between programs # and visualising the signaling # import zmq import time import random import json import sys import protobuf_examples.example ctx = zmq.Context() class Stub: def __init__(self, name): self.name = name self.socket = ctx.socket(zmq.PUSH) timeout_m...
magnuswahlstrand/home-automation
stub_world/send_sequence.py
send_sequence.py
py
2,322
python
en
code
0
github-code
6
41656015394
""" Methods for doing logistic regression.""" import numpy as np from utils import sigmoid import math def logistic_predict(weights, data): """ Compute the probabilities predicted by the logistic classifier. Note: N is the number of examples and M is the number of features per example. In...
DaPraxis/Logistic_Regression-Neural_Networks
q2_materials/logistic.py
logistic.py
py
3,920
python
en
code
0
github-code
6
4699294372
import math from pprint import pprint import timeit #######PROCESSING############# class Library(object): def __init__(self, library_id, signup_time, books, books_per_day): self.library_id = library_id self.signup_time = signup_time self.books = books self.book_amount = len(self.bo...
zeyadkhaled/Hashcode-2020
solution.py
solution.py
py
4,999
python
en
code
2
github-code
6
37562209258
import os from modules.computation.Dataset import Dataset def _main(): # Define the default values for the options pathHome = os.path.expanduser('~') pathWork = os.path.join( pathHome, 'Desktop/ProyectoGDSA') pathImages = os.path.join(pathWork,'1_images') pathDatasets = os.path.join( pathWork...
aamcgdsa21/GDSA
Descriptor/tools/2_datasets.py
2_datasets.py
py
965
python
en
code
1
github-code
6
33425664451
# Q) not a triangle # you have n sticks and pick any 3 and it must not form a triangle # we know for any 2 sides a, b if we have a third side c # such that a + b < c then we have 1 possible answer import bisect n = int(input()) def bisect_right(li, target): n = len(li) low = 0 high = n while(low < h...
harasees-singh/Notes
Searching/Binary_Not_A_Triangle.py
Binary_Not_A_Triangle.py
py
757
python
en
code
1
github-code
6
16009044244
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Makes an organized git repo of a book folder """ from __future__ import print_function import codecs import os from os.path import abspath, dirname import jinja2 import sh from .parameters import GITHUB_ORG class NewFilesHandler(): """ NewFilesHandler - template...
mgotliboym/gitberg
gitenberg/make.py
make.py
py
2,764
python
en
code
null
github-code
6
73817284026
"""An ext to listen for message events and syncs them to the database.""" import discord from discord.ext import commands from sqlalchemy import update from metricity.bot import Bot from metricity.config import BotConfig from metricity.database import async_session from metricity.exts.event_listeners import _utils fr...
python-discord/metricity
metricity/exts/event_listeners/message_listeners.py
message_listeners.py
py
2,561
python
en
code
39
github-code
6
44426526976
import json from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal, connect_nodes_bi, connect_nodes, sync_blocks, disconnect_nodes_bi from test_framework.key import CECKey from test_framework.blocktools import create_block, create_coinbase from test_framework.script...
bitcoin-sv/bitcoin-sv
test/functional/bsv-block-ds-attack.py
bsv-block-ds-attack.py
py
9,229
python
en
code
597
github-code
6
71261714748
# -*- coding: utf-8 -*- __all__ = ('tianshou_imitation_policy',) from utils.vec_data import VecData from torch import nn import torch import gym import numpy as np from tianshou.data import Batch, to_torch class tianshou_imitation_policy(nn.Module): def __init__(self, network, lr, weight_decay, mod...
illusive-chase/ChineseStandardMahjong
learning/imitation.py
imitation.py
py
6,685
python
en
code
3
github-code
6
913555112
from coc import utils from datetime import datetime from discord.ext import commands, tasks class DatabaseBackground(commands.Cog): def __init__(self, bot): self.bot = bot self.update.start() def cog_unload(self): self.update.cancel() @commands.command(name="add_user") async ...
wpmjones/coc_sample_bot
cogs/database_bg.py
database_bg.py
py
1,440
python
en
code
14
github-code
6
33831413289
from typing import List def two_sum(lis: List[int], target: int): dici = {} for i, value in enumerate(lis): objetive = target - value if objetive in dici: return [dici[objetive], i] dici[value] = i return [] print(two_sum([1, 2, 3, 4, 5, 6], 7))
R0bertWell/interview_questions
reexercises/two_sum_target.py
two_sum_target.py
py
298
python
en
code
0
github-code
6
60098854
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import mv class HPPs_dispersion(): def __init__(self,filename): self.name = filename def ReadData(self): data_file_y = os.path.join(fr'./dispersion/y/n{self.name}.txt') data_y = pd.read_csv(data_file_y, sep...
foreseefy/HPPP
HPPs_dispersion.py
HPPs_dispersion.py
py
2,318
python
en
code
0
github-code
6