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
73177318695
""" Grid sampling (Only use for low dimensional spaces)""" import itertools import numpy as np from verifai.samplers.domain_sampler import (BoxSampler, DiscreteBoxSampler, DomainSampler, SplitSampler, IteratorSampler, TerminationException) from verifai.samplers.random_sampler import RandomSampler class GridSample...
BerkeleyLearnVerify/VerifAI
src/verifai/samplers/grid_sampler.py
grid_sampler.py
py
3,218
python
en
code
152
github-code
90
10725540847
# The critter classes (Fish & Bug) are designed to hold the pertinent information of each, created using data from # the ACNH API and context from the Timezone API. Each class takes two important parameters. The first is a dictionary # of all the information from the ACNH API. However, the dictionary structure is a bi...
milesled/acnh-app
critters.py
critters.py
py
3,387
python
en
code
0
github-code
90
28791933235
from OpenGL.GL import* from OpenGL.GLUT import* from OpenGL.GLU import* from tr2d import * import numpy as np import serial import os import sys import time ESCAPE = '\033' def InitGL(Width, Height): glClearColor(1.0, 1.0, 1.0, 1.0) glClearDepth(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LEQUAL)...
slzhffktm/GeometricTransformation
src/main.py
main.py
py
4,962
python
en
code
0
github-code
90
18689571069
import argparse import sys from random import uniform from flask import Flask, request, jsonify import pymysql import base64 from Crypto.Hash import SHA1 from Crypto.Protocol.KDF import PBKDF2 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad from config import DBGroups, SplitLength import Ea...
DDBMS/DBMS
app.py
app.py
py
3,783
python
en
code
0
github-code
90
41233159030
import os import python_speech_features as psf import scipy.io.wavfile as wav import numpy as np from utilities import * from scipy.spatial import distance from audiotsm.io.array import ArrayReader, ArrayWriter from audiotsm import wsola from dtw import dtw from collections import defaultdict # False corresponds to Mo...
p15zerv/Speaker-Verification-ASP
classification.py
classification.py
py
8,347
python
en
code
1
github-code
90
28209507968
def tower_of_hanoi(n, source, destination, auxiliary): if n == 1: # Bewegung der Scheibe 1 von der Quelle zum Ziel ausgeben print(f"Bewege Scheibe 1 von Quelle {source} zum Ziel {destination}") return # Bewege die obersten n-1 Scheiben von der Quelle zum Hilfsstift mit dem Zielstift ...
DeyvidTheWise/Logic-Course-Assignment
tower_of_hanoi_de.py
tower_of_hanoi_de.py
py
684
python
de
code
0
github-code
90
38229260165
#!/usr/bin/env python3 import json from pathlib import Path def main() -> None: folder = Path('.vscode') recommended = json.loads((folder / 'settings_recommended.json').read_text()) path = folder / 'settings.json' try: current = json.loads(path.read_text()) except Exception: curre...
fengbingchun/PyTorch_Test
src/pytorch/tools/vscode_settings.py
vscode_settings.py
py
480
python
en
code
14
github-code
90
18161906049
from collections import deque N, M = map(int, input().split()) graph = [[] for _ in range(N+1)] for i in range(M): a, b = map(int, input().split(' ')) graph[a].append(b) graph[b].append(a) dist = [-1] * (N+1) dist[0] = 0 disjoint_set = [] n_disj = 0 d = deque() for j in range(1,N+1): if dist[j] ...
Aasthaengg/IBMdataset
Python_codes/p02573/s029574862.py
s029574862.py
py
761
python
en
code
0
github-code
90
2244524913
__version__ = '0.1.0' import re def word_count(content): """ Counts the number of words in the specified string. Based on the regexes / logic from Countable.js: https://github.com/RadLikeWhoa/Countable (recommended to use this function for back-end validation, in conjunction with Countable.js...
Jaza/word-count
word_count.py
word_count.py
py
738
python
en
code
1
github-code
90
43333658906
#!/usr/bin/env python3 import sys import re ON, OFF, TOGGLE = 0, 1, 2 mapping = {'turn on': ON, 'turn off': OFF, 'toggle': TOGGLE} pat = r'(turn on|turn off|toggle) (\d+),(\d+) through (\d+),(\d+)' actions = [] for line in sys.stdin: action, xa, ya, xb, yb = re.match(pat, line).groups() actions.append((mapping...
taddeus/advent-of-code
2015/06_lights.py
06_lights.py
py
883
python
en
code
2
github-code
90
20183050916
solutions = [] state = [] def main(): n = 3 k = 2 init(n) solve(n, k) print_result() def init(n): for _ in range(n): state.append(-1) def solve(n, k): c = n - 1 while True: if c < 0: solutions.append([] + state) c += 1 elif c == n: ...
Arden-Zhu/PythonExercise
nested_loop_3.py
nested_loop_3.py
py
666
python
en
code
0
github-code
90
24267969332
from flask import Flask, render_template, request import peewee app = Flask(__name__) @app.route('/', methods=("GET","POST")) def form(): if request.method == "POST": make = request.form["x"] sasa = request.form["y"] wewe = request.form["z"] # model =request.form["model"] ...
bsakari/pyForm
app.py
app.py
py
615
python
en
code
0
github-code
90
1777129346
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from tempfile import mkdtemp HELPER_SETTINGS = dict( INSTALLED_APPS=[ 'djangocms_redirect', ], FILE_UPLOAD_TEMP_DIR=mkdtemp(), MIDDLEWARE_CLASSES=[ 'djangocms_redirec...
adamchainz/djangocms-redirect
cms_helper.py
cms_helper.py
py
760
python
en
code
null
github-code
90
31217772470
#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 dbname = 'TEST.db' # 1.データベースに接続 conn = sqlite3.connect(dbname) # 2.sqliteを操作するカーソルオブジェクトを作成 cur = conn.cursor() # 3.テーブルに人名データを登録する # 例では、personsテーブルのnameカラムに「Sato」「Suzuki」「Takahashi」というデータを登録 cur.execute('INSERT INTO persons(name) values("Sato")') cur....
RuoAndo/cit
DB/7/2.py
2.py
py
613
python
ja
code
0
github-code
90
43148369011
# Scrapy settings for freshdirect project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/topics/settings.html # # BOT_NAME = 'freshdirect' # BOT_VERSION = '1.0' SPIDER_MODULES = ['freshdirect.spiders'] NEW...
RasPat1/feed-us
freshdirect/freshdirect/settings.py
settings.py
py
523
python
en
code
0
github-code
90
8270267487
from typing import Optional import click from PyInquirer import prompt from sqlalchemy.orm import Session from flashcards_core.database import Deck from flashcards_cli.edit.cards import edit_cards def edit_decks(session: Session): """ Prompt for the Edit Collection menu. Lets the user select the deck th...
ebisu-flashcards/flashcards-cli
flashcards_cli/edit/decks.py
decks.py
py
4,537
python
en
code
5
github-code
90
17996559660
import requests def post_to_slack(item, webhook): payload = { "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": f"*<{item['link']}|{item['subject']}>*\n\n" + f":round_pushpin: Region ...
livioso/moritz-tutti-scrapy
tutti/utils.py
utils.py
py
701
python
en
code
6
github-code
90
27527159879
from dataclasses import dataclass import unittest import numpy as np import pandas as pd from pandas.testing import assert_frame_equal from valuefilter import value_filter, render, migrate_params from cjwmodule.testing.i18n import i18n_message @dataclass(frozen=True) class Column: name: str type: str class M...
CJWorkbench/valuefilter
test_valuefilter.py
test_valuefilter.py
py
4,213
python
en
code
0
github-code
90
4787029602
import json import sqlite3 import os from optparse import OptionParser from collections import namedtuple TweetData = namedtuple("TweetData", ('name', 'tweet_text', 'country_code', 'display_url', 'lang', 'created_at', 'location')) class TweetParseError(Exception): pass class TweetInsertError(Exception): ...
antipetrov/twitter_affinity
twitter_parse.py
twitter_parse.py
py
5,016
python
en
code
0
github-code
90
18167385579
def main(): S = input() count = 1 if 'R' in S: for i in range(len(S)-1): if S[i] == S[i+1] == 'R': count += 1 print(count) else: print(0) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02582/s807575500.py
s807575500.py
py
246
python
en
code
0
github-code
90
27834212616
#!/usr/bin/env python """ Smart docker-entrypoint """ import json import os from sys import argv from sys import exit import toml import yaml from jinja2 import Environment from jinja2 import FileSystemLoader from .config import Config from .config import envtobool from .configparser import ConfigParser from .con...
cmehay/pyentrypoint
pyentrypoint/entrypoint.py
entrypoint.py
py
4,716
python
en
code
14
github-code
90
19402361807
from django.urls import path, include from rest_framework import routers from .views import PostViewSet, CommentViewSet, GroupViewSet, FollowViewSet app_name = 'api' router = routers.DefaultRouter() router.register(r'posts', PostViewSet) router.register((r'posts/(?P<post_id>\d+)/comments'), CommentViewSet) router.regi...
iamTroyanskiy/api_final_yatube
yatube_api/api/urls.py
urls.py
py
490
python
en
code
0
github-code
90
40901990435
import pandas as pd import sys, os import seaborn as sns import numpy as np In=sys.argv[1] Out=sys.argv[2] #DictIn=open(sys.argv[3],'r') #dicC={} #for idx, lines in enumerate(DictIn): # info=lines.split() # scaffold=info[0][45:] # dicC[int(scaffold)]=idx+1 mgsort=pd.read_table(In,index_col=0) mgsort=mgsort.fillna(-1...
suestring7/HiC-Scaffolding-Project
Map/script/reindex.py
reindex.py
py
942
python
en
code
1
github-code
90
23832600901
from itertools import islice import json import multiprocessing as mp from os import listdir as ls, makedirs as mkdir from os.path import join as pjoin import re from sys import platform from time import time from masstodon.read.mzml import read_mzml from masstodon.plot.spectrum import plot_spectrum from masstodon.mas...
MatteoLacki/masstodon
masstodon/scripts/MSV000082051/fit.py
fit.py
py
6,733
python
en
code
3
github-code
90
18336581199
def gcd(a,b): while b:a,b=b,a%b return a def divisor(n): ass=[] for i in range(1,int(n**0.5)+1): if n%i==0: ass.append(i) if i!=n//i:ass.append(n//i) return ass def is_prime(n): if n==1:return True;return False for i in range(2,int(n**0.5)+1): if n%i==0:return False return True ans=0...
Aasthaengg/IBMdataset
Python_codes/p02900/s405150450.py
s405150450.py
py
412
python
en
code
0
github-code
90
73691721898
# def my_print(name): # print(f"10.00.2010: {name}") # # # my_print("Artur") # my_print("Artur") # my_print("Artur") # my_print("Artur") def check_string_length(content='empty'): """ Описание функции :param content: описание аргумента :return: строка """ if content == 'empty': retu...
petr-sed/python-first
lesson03/functions.py
functions.py
py
746
python
en
code
0
github-code
90
31928621117
#Uses python3 import sys import numpy as np def BelmanFord(adjacency_matrix, cost, origin_vertex, big_distance): n = len(adjacency_matrix) dist = [big_distance] * n prev = [-1] * n dist[origin_vertex] = 0 updated = False for _ in range(n): updated = False for v in range(n): ...
avdolgikh/Coursera_Algorithms
Tasks_execution/GraphAlgorithm/w4_negative_cycle.py
w4_negative_cycle.py
py
1,424
python
en
code
0
github-code
90
18152805779
n = int(input()) p=0 for i in range(n): x,y=map(int,input().split()) if x==y: p+=1 if p==3: print('Yes') exit() else: p=0 else: print('No')
Aasthaengg/IBMdataset
Python_codes/p02547/s789820421.py
s789820421.py
py
204
python
en
code
0
github-code
90
18333460799
import sys s=input() k=int(input()) s_2=s*2 pre="" ans=0 if s.count(s[0])==len(s): print((len(s)*k)//2) sys.exit() for i in range(len(s)): if pre==s[i]: ans+=1 pre="" else: pre=s[i] pre="" ans1=0 for i in range(len(s_2)): if pre==s_2[i]: ans1+=1 pre="" else: pre=s_2[i] if 2*ans<...
Aasthaengg/IBMdataset
Python_codes/p02891/s661893599.py
s661893599.py
py
377
python
en
code
0
github-code
90
12181643306
# -*- coding: utf-8 -*- """ Created on Sat Jun 19 19:00:48 2021 @author: Harshu """ from flask import Flask, render_template, request,jsonify, redirect import pickle import numpy as np app = Flask(__name__) # Load the saved model #loaded_model = pickle.load(open('Final_predictive_model/finalized_mod...
Harshu2032000/Loan-prediction-web-app
app1.py
app1.py
py
2,811
python
en
code
0
github-code
90
42502040096
#!/usr/bin/env python from Modules.Definitions import * class Tag(object): def __init__(self, POS=UNSET_POS, Frequency=0, PrevIndex=0, isBest=False): if isinstance(POS, int) and isinstance(Frequency, (float, int)) and isinstance(PrevIndex, int) and isinstance(isBest, bool): self.__POS = POS ...
Jason-Young-AI/ZenLA
Modules/Items.py
Items.py
py
22,497
python
en
code
1
github-code
90
18258988149
from collections import deque # 両端を扱うならdequeが速い # 内側を扱うならリストが速い S = input() q = deque() for s in list(S): q.append(s) Q = int(input()) direction = True for _ in range(Q): line = input() # TrueならFalseに、FalseならTrueに変える if line == "1": direction = not direction else: if (directio...
Aasthaengg/IBMdataset
Python_codes/p02756/s327074880.py
s327074880.py
py
704
python
en
code
0
github-code
90
12457362928
#%% import os import csv #set variables to create stores variable and lists total_rows_votes = 0 candidate_list = [] voters_list = [] #Path to open election Data csvpath = os.path.join('/Module_3/Starter_Code/Resources/election_data.csv') # Action to open CSV and read with open(csvpath) as cs...
HabibR101/python-challenge
PyPoll/Main.py
Main.py
py
2,475
python
en
code
0
github-code
90
18410887069
N = int(input()) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors n = make_divisors(N) answer = 0 for i in n[::-1]: if i =...
Aasthaengg/IBMdataset
Python_codes/p03050/s543704502.py
s543704502.py
py
447
python
en
code
0
github-code
90
29723681910
import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg N4 = np.linspace(0,1,9, endpoint=True)[1:-1:2] G4 = np.dstack(np.meshgrid(N4,N4)).reshape(len(N4)**2,2) N8 = np.linspace(0,1,17, endpoint=True)[1:-1:2] G8 = np.dstack(np.meshgrid(N8,N8)).reshape(len(N8)**2,2) offsets = { "1 sample" ...
rougier/python-opengl
code/ssaa-sdf.py
ssaa-sdf.py
py
2,522
python
en
code
592
github-code
90
18681646246
from sqlalchemy import * from migrate import * from migrate.changeset import schema pre_meta = MetaData() post_meta = MetaData() events = Table('events', pre_meta, Column('id', INTEGER, primary_key=True, nullable=False), Column('name', VARCHAR(length=64), nullable=False), Column('description', TEXT), ...
smolution/AtelierApp
AtelierApp/db_repository/versions/007_migration.py
007_migration.py
py
1,127
python
en
code
0
github-code
90
74491476137
import adivinhacao, forca def escolhe_jogo(): print('O que você quer jogar hoje?') print('\n[1] Jogo da Adivinhação [2] Jogo da Forca') jogo = int(input('\nQual sua opção? ')) if jogo == 1: adivinhacao.jogar() elif jogo == 2: forca.jogar() if __name__ == '__main__': ...
jonasnunes/catalogo_de_jogos
main.py
main.py
py
342
python
pt
code
0
github-code
90
1359547264
from typing import Union from iterm_pane_spliter.panes_parser.types import Corner, Coordinates def assert_pane_structure(pane_structure: list[list[Union[int, str]]]) -> None: assert len(pane_structure) > 0, 'paneStructure must not be empty' assert len(pane_structure[0]) > 0, 'paneStructure must not be empty' ...
rluvaton/iterm-pane-spliter
src/iterm_pane_spliter/panes_parser/validator.py
validator.py
py
3,232
python
en
code
0
github-code
90
15922171622
"""Module for utilizing A* on a 2D grid""" import math from A_Star.grid import Occupation neighbors = [(-1, 0), (0, -1), (0, 1), (1, 0)] def distance(a, b): return abs(a[0] - b[0]) + abs(a[1] - b[1]) def reconstruct_path(came_from, path, node): path.append(node) # if the path has hit a dead end (endless loop),...
AlexanderReaper7/Python-Lab
A_Star/a_star.py
a_star.py
py
2,361
python
en
code
0
github-code
90
14154343968
# Having all urls for this app organized here from django.urls import path from . import views urlpatterns = [ path('',views.product_list_create_view), path('<int:pk>/update',views.product_update_view, name='product-edit'), path('<int:pk>/delete',views.product_delete_view), path('<int:pk>/',views.pro...
NAGERI/django-rest-fw
backend/products/urls.py
urls.py
py
360
python
en
code
0
github-code
90
18057421069
import sys sys.setrecursionlimit(10 ** 6) INF = float("inf") MOD = 10 ** 9 + 7 def input(): return sys.stdin.readline().strip() def main(): S = input() K = int(input()) nums = [] a = ord("a") for s in S: nums.append(ord(s) - a) for i in range(len(S)): if nums[i] == 0: ...
Aasthaengg/IBMdataset
Python_codes/p03994/s644929872.py
s644929872.py
py
604
python
en
code
0
github-code
90
73820325417
class Solution: def shoppingOffers(self, price: List[int], special: List[List[int]], needs: List[int]) -> int: psize = len(price) queue = collections.deque() queue.append((0, needs)) result = sum([price[i] * needs[i] for i in range(len(price))]) while queue: total...
HarrrrryLi/LeetCode
638. Shopping Offers/Python 3/solution.py
solution.py
py
1,087
python
en
code
0
github-code
90
43602807004
"""Test the UniSAGE layer.""" import pytest import torch from topomodelx.nn.hypergraph.unisage_layer import UniSAGELayer class TestUniSAGELayer: """Tests for UniSAGE Layer.""" @pytest.fixture def uniSAGE_layer(self): """Fixture for uniSAGE layer.""" in_channels = 10 out_channels ...
LFesser97/simplicial_complex_neural_networks
test/nn/hypergraph/test_unisage_layer.py
test_unisage_layer.py
py
2,035
python
en
code
1
github-code
90
18026561389
def solve(): n = int(input()) a = [] b = [] for _ in range(n): x,y = map(int,input().split()) a.append(x) b.append(y) ans = 0 for i in range(n)[::-1]: if (a[i]+ans)%b[i]: ans+=b[i]-(a[i]+ans)%b[i] print(ans) if __name__=='__main__': solve()
Aasthaengg/IBMdataset
Python_codes/p03821/s445469844.py
s445469844.py
py
316
python
en
code
0
github-code
90
34872957920
import numpy as np import pytest from pandas import ( DatetimeIndex, IntervalIndex, NaT, Period, Series, Timestamp, ) import pandas._testing as tm class TestDropna: def test_dropna_empty(self): ser = Series([], dtype=object) assert len(ser.dropna()) == 0 return_va...
pandas-dev/pandas
pandas/tests/series/methods/test_dropna.py
test_dropna.py
py
3,577
python
en
code
40,398
github-code
90
21338951989
from PIL import Image, ImageOps import math # This code calculates the log with base 2 using the math function log: math.log(_____,2). # ignore_missing_imports = True def flappingToaster() -> None: """ Loads 4 flying toaster images from file and creates/saves an animated gif with the images as frames. """ ...
anhthach375/animatedgif
animator.py
animator.py
py
8,148
python
en
code
0
github-code
90
30754640631
import argparse import torch from torch import nn import numpy as np import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from model.modeling_drn.fcos import FCOSModule def apply_mask1d(attention, image_locs): batch_size, num_loc = attention.size() tmp1 = a...
stephen-nju/multimodalTask
model/modeling_drn/dense_regression_net.py
dense_regression_net.py
py
15,963
python
en
code
0
github-code
90
18342219439
class RollingHash(): def __init__(self,s): self.n=n=len(s) self.b=b=129 self.M=M=2**61-1 x,y=1,0 self.f=f=[x]*(n+1) self.h=h=[y]*(n+1) for i,c in enumerate(s.encode()): f[i+1]=x=x*b%M h[i+1]=y=(y*b+c)%M def get(self,l,r): re...
Aasthaengg/IBMdataset
Python_codes/p02913/s435435601.py
s435435601.py
py
756
python
en
code
0
github-code
90
24263619600
# !/usr/bin/env python # -*- coding: utf-8 -*- from operator import itemgetter import csv import networkx as nx import pylab import math import numpy as np #自定义网络 row=[int(math.floor(i*200)) for i in list(np.random.random_sample(500))] col=[int(math.floor(i*200)) for i in list(np.random.random_sample(500))] value=[int...
fuyunguagua/bot
botminer/util/netgraph.py
netgraph.py
py
3,005
python
en
code
1
github-code
90
12195101379
from __future__ import absolute_import, division,\ print_function, unicode_literals import random import unittest class BinaryHeap(object): def __init__(self, n, key=None, cmpr=None): self.size = n self.data = [None, ]*self.size self.top = 0 # max in the root self.cmpr...
shell909090/data_struct_py
binheap.py
binheap.py
py
1,895
python
en
code
0
github-code
90
37777975160
import sys import difflib from django.core.management.base import BaseCommand from django.db.models import Q, Count from astrobin.models import Gear from astrobin.utils import unique_items class Command(BaseCommand): help = "Rename makes." def handle(self, *args, **options): seen = [] all_m...
astrobin/astrobin
astrobin/management/commands/rename_makes.py
rename_makes.py
py
1,387
python
en
code
100
github-code
90
28294406906
from collections import deque from collections import defaultdict ENDS_HERE='#' class Trie: def __init__(self, words): self._trie = {} for word in words: self.insert(word) def insert(self, text): trie = self._trie for c in text: if c not in trie: trie[c] = {} trie = trie[c] trie[ENDS...
myhangshi/minus
games/ghost.py
ghost.py
py
1,070
python
en
code
0
github-code
90
25785392790
import mysql.connector import pandas as pd if __name__ == "__main__": #connect to sql sql_check = 1 if sql_check == 1: mydb = mysql.connector.connect( host="localhost", database="telecom", user="root", password="password" ) ...
DisHarmonious/Telecommunications-DW
set_database.py
set_database.py
py
1,816
python
en
code
0
github-code
90
18800789042
import bpy import bpy_extras from mathutils import Matrix import numpy as np import sys sys.path.append('.') import util import blender_camera_util import os from math import radians from PIL import Image ################################################### # convertion between blender coord system and shapenet object s...
ChrisWu1997/Multimodal-Shape-Completion
data/partnet_process/blender_render/blender_util.py
blender_util.py
py
34,432
python
en
code
93
github-code
90
71248176937
from collections import deque def citire(orientat=False, nume_fisier="biconex.in"): n = 0 la = [] with open(nume_fisier) as f: linie = f.readline() n, m = (int(z) for z in linie.split()) la = [[] for i in range(n + 1)] for linie in f: x, y = (int(z) for z in lini...
DanNimara/FundamentalAlgorithms-Graphs
Lab2/2.py
2.py
py
1,650
python
en
code
0
github-code
90
72840566057
from distutils.log import debug # va aidé à from flask import Flask,request,jsonify, render_template,redirect,url_for import sklearn import pickle import numpy as np from sklearn.ensemble import RandomForestRegressor app=Flask(__name__) # pour preparer l'environnement models=pickle.load(open('ModelDiab.pkl','rb'))# p...
mireinep/TP_labo
predictionDiabete.py
predictionDiabete.py
py
1,134
python
fr
code
0
github-code
90
42921540220
import json from rbac.common.logs import get_default_logger from rbac.providers.common.common import escape_user_input from rbac.server.api.proposals import compile_proposal_resource from rbac.server.api import utils from rbac.server.db import proposals_query from rbac.server.db.db_utils import create_connection LOGG...
MrE-Fog/sawtooth-next-directory
rbac/server/api/feed.py
feed.py
py
1,430
python
en
code
0
github-code
90
16509057065
import pickle import sys splitfile = "trainvaltest_ids.pkl" mainfile = pickle.load(open("callsedges.pkl","rb")) spliter = pickle.load(open(splitfile,"rb")) trainfid = spliter['trainfid'] valfid = spliter['valfid'] testfid = spliter['testfid'] train = dict((fid, mainfile[fid]) for fid in trainfid if fid in mainfi...
aakashba/callcon-public
builder/3_split.py
3_split.py
py
627
python
en
code
2
github-code
90
10249182122
from collections import Counter from time import perf_counter from random import randint """ This function runs a test on the 3 methods implemented below. The amount of data being processed can be adjusted with the first two variables declared in the function. """ def main(): # array size n = 100000...
Grant-Syt/python_practice
array_manipulation.py
array_manipulation.py
py
3,745
python
en
code
0
github-code
90
38471163949
import xml.etree.ElementTree as ET import xml.dom.minidom as DM import html import sys import time from SymbolTable import SymbolTable, SymbolKinds from VMWriter import VMWriter class CompilationEngine: def __init__(self, in_file: str, compile_out_name: str): self.tokens = [] self.token_pos = 0 ...
Steveguile/nand2tetris
projects/11/CompilationEngine.py
CompilationEngine.py
py
15,843
python
en
code
0
github-code
90
29742579236
# import torch # import torch.nn.functional as F # import torch.nn as nn # import torch.optim as optim # from torchtext import data # from torchtext import datasets # from torchtext.data import Dataset import torchvision from torchvision import transforms as transforms from torch.utils.data import Dataset, DataLoader,r...
ravenSanstete/data-hiding
dataset.py
dataset.py
py
16,366
python
en
code
0
github-code
90
12754376507
# This requests using form, This is the POST method for receive and handle the data, and the method GET for render the form in gui from flask import Flask, request app = Flask(__name__) #This route got also GET method for render the gui and POST method for handle the posted form @app.route('/form', methods = ['GET...
Locchuong96/backend
Flask/flask_request/app_form.py
app_form.py
py
961
python
en
code
3
github-code
90
29497412568
import numpy as np import pandas as pd import math from numpy import concatenate from matplotlib import pyplot from pandas import read_csv from pandas import DataFrame from pandas import concat from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import mean_squared_error from keras.models import Sequent...
Aaron9477/tiny_code
LSTM/car_sales_preduction/new/train_lstm3.py
train_lstm3.py
py
5,034
python
en
code
1
github-code
90
18024530437
"""Zadanie 3. Utwórz pustą listę zwierzeta. Następnie • Dodaj kilka nazw zwierząt do listy • Posortuj listę • Wyświetl pierwszy oraz trzy ostatnie elementy na liście • Wyświetl informację o liczbie zwierząt na liście""" zwierzeta=[] x = 5 for i in range(x): a = input("Podaj nazwę zwierzęcia: ") zwierzeta.appe...
Dahaka3122/WstepDoProgramowania
Lab4/Zad3.py
Zad3.py
py
445
python
pl
code
0
github-code
90
72222367016
import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from agent import Agent import gym from collections import deque plt.style.use('default') env = gym.make('CliffWalking-v0') agent = Agent(no_of_states=env.observation_space.n, no_of_actions=env.action_space.n, off_policy...
deadoralive023/Cliff_Walking
main.py
main.py
py
3,199
python
en
code
0
github-code
90
15779754948
import emoji from loguru import logger from src.bot import bot from src.constants import keyboards from src.filters import IsAdmin class Bot: def __init__(self, telegram_bot): self.bot = telegram_bot # add custom filters self.bot.add_custom_filter(IsAdmin()) # register handlers...
ali-m79/template_telegram_bot
src/run.py
run.py
py
1,795
python
en
code
0
github-code
90
5497162627
"""Functions shared by the EML utilities """ import argparse import io import logging import os import pathlib import pprint import shutil import subprocess import sys import lxml.etree block_set = set() log = logging.getLogger(__name__) # Max number of unique values we allow for the contents of an element before w...
PASTAplus/eml-utils
lib.py
lib.py
py
5,901
python
en
code
0
github-code
90
2167249359
import requests import sys import pandas as pd import numpy as np from matplotlib import pyplot as plt sys.stdout=open("output.out","w") Historical="http://data.fixer.io/api/" KEY="7f1a676a0f8bdc07c369f62c890679bc" X=[] Y=[] for i in range(2000,2021): year=i add=str(year)+"-09"+"-27" new_url=Historical+add print(n...
Kuldeep19842408/Currency-vs-time-Plotter
src.py
src.py
py
976
python
en
code
0
github-code
90
13018394625
from shiny import module, reactive, render from shiny.ui import output_text, tags from shiny_semantic.elements import button from shiny_semantic.modules import modal, modal_show from ._feature_layout import feature_section, feature_subsection @module.ui def ui(): return feature_section( "Modal", ...
Appsilon/py_shiny_semantic_examples
semantic-components/modules/modal_module.py
modal_module.py
py
3,475
python
en
code
1
github-code
90
15801872125
# -*- coding: utf-8 -*- """ 1582. Special Positions in a Binary Matrix Easy 147 6 Add to List Share Given a rows x cols matrix mat, where mat[i][j] is either 0 or 1, return the number of special positions in mat. A position (i,j) is called special if mat[i][j] == 1 and all other elements in row i and column j are ...
tjyiiuan/LeetCode
solutions/python3/problem1582.py
problem1582.py
py
1,011
python
en
code
0
github-code
90
9777302320
import colorsys from PyQt5.QtCore import pyqtSignal, QTimer from brickv.plugin_system.plugin_base import PluginBase from brickv.plugin_system.plugins.led_strip.ui_led_strip import Ui_LEDStrip from brickv.bindings.bricklet_led_strip import BrickletLEDStrip from brickv.async_call import async_call class LEDStrip(Plugi...
Tinkerforge/brickv
src/brickv/plugin_system/plugins/led_strip/led_strip.py
led_strip.py
py
24,061
python
en
code
18
github-code
90
40653057762
import torch import math from tqdm import tqdm import fasttext import sacrebleu import os import argparse class StyleTransfertMetric: def __init__(self, args, use_w_overlap, use_style_accuracy, use_ppl, style_classifier=None, lm=None, tokenizer=None, not_use_vector=False): self.use_w_over...
g-pichler/knife
text_experiments/fair_classification/metric.py
metric.py
py
11,036
python
en
code
13
github-code
90
33731149841
#!/usr/bin/env python3 """ @author: FATESAIKOU @date: 2020/06/12 @email: tsungfu.chiang@gmail.com @argv[1]: comic name(str) """ import requests import urllib import execjs import sys import json import re from bs4 import BeautifulSoup as Soup from pprint import pprint def doRequest(url): return requests.get(url...
KeepLearningFromSideProject/scheduler
src/crawler/real.py
real.py
py
3,505
python
en
code
1
github-code
90
12985487860
# token = 2019958870:AAFfhFkGhXcSCPAi9p8Zz4B2jCYNtshCXCo # id = 1758525870 # 1725010456 # "id" : "7552811101698946278" , "data" : "1" - 버튼 1 # "id" : "7552811102886748927" , "data" : "2" - 버튼 2 # "id" : "7552811100903521355" , "data" : "3" - 버튼 3 import telepot from telepot.loop import MessageLoop # 봇 구동 from te...
Hwangchanju/alarm
연습/07_텔레그램_버튼(x1).py
07_텔레그램_버튼(x1).py
py
3,122
python
en
code
0
github-code
90
1622327985
import os import jwt import uuid import hashlib from urllib.parse import urlencode import time import requests import pandas as pd from bs4 import BeautifulSoup from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters) import telegram import json #########################################...
dbstjr1500/IMAX_Ticketing_Bot
Upbit_bot_RSI.py
Upbit_bot_RSI.py
py
9,816
python
en
code
0
github-code
90
18405337599
from fractions import Fraction N,K=map(int,input().split()) case = [] number = [] count = 0 result_a = 0 for i in range(N): case.append(i+1) for j in range(N): while case[j] <= K-1: case[j] *= 2 count += 1 count = 2**count number.append(count*N) count = 0 for k in range(N): ...
Aasthaengg/IBMdataset
Python_codes/p03043/s697222468.py
s697222468.py
py
443
python
en
code
0
github-code
90
15473632876
from lxml import etree from copy import deepcopy import sys import argparse def convert_toc_lines(source_line, in_section): i = 0 for el_sub in source_line.getchildren(): el_section_1 = etree.XML('<section/>') el_section_1.set('title', el_sub.get('name')) el_section_1.set('ref', el_sub....
Kapeli/cppreference-doc
devhelp2qch.py
devhelp2qch.py
py
4,149
python
en
code
null
github-code
90
25040854591
def decrypt(message, key): if key < 2 or key > 25: #For invalid key exception print("Key Out Of Bound") decodedMessage = [] for letter in message: if letter==' ': #Whilte Space handling. decodedMessage.append(letter) ...
PriyanshuGaur/InformationSecurity
FrequencyAttack.py
FrequencyAttack.py
py
3,840
python
en
code
0
github-code
90
33682100457
# -*- coding: utf-8 -*- import re from django.core.exceptions import ValidationError from django.forms import ModelForm, FileField, TextInput from django.contrib.admin.widgets import FilteredSelectMultiple from vaas.adminext.widgets import SearchableSelect from vaas.manager.models import Probe, Director, Backend, Time...
allegro/vaas
vaas/vaas/manager/forms.py
forms.py
py
3,268
python
en
code
228
github-code
90
18026020699
#D N = int(input()) A = list(map(int,input().split())) A.sort() count = 0 old = -1 for a in A: if old != a: count+=1 old = a if count%2 == 1: print(count) else: print(count-1)
Aasthaengg/IBMdataset
Python_codes/p03816/s783506653.py
s783506653.py
py
208
python
en
code
0
github-code
90
31227948894
#!/usr/bin/python # Author: @BlankGodd_ from pyfiglet import Figlet from search import Search_Genius from interact import Interact from save import Save from web import Webpage import time, os import sys class Tool: """For using BLyrics as a script instead of a module""" def __init__(self): """Cons...
AgbaD/BLyrics
blyrics/tool.py
tool.py
py
12,883
python
en
code
5
github-code
90
8832205866
# Changing the name to CamelCase def format_fun(f_name, l_name): if f_name == "" or l_name == "": return "Please enter the full name" first_name = f_name[:1].upper() + f_name[1:len(f_name)].lower() last_name = l_name[:1].upper() + l_name[1:len(l_name)].lower() return(first_name + " " + last_nam...
lavcsss/Project-1
camel_case.py
camel_case.py
py
403
python
en
code
2
github-code
90
18068710999
a, b = map(int, input().split()) if a > 0 and b > 0: ans = "Positive" elif a < 0 and b < 0: if (abs(a-b) + 1) % 2 == 0: ans = "Positive" else: ans = "Negative" else: ans = "Zero" print(ans)
Aasthaengg/IBMdataset
Python_codes/p04033/s677573519.py
s677573519.py
py
203
python
en
code
0
github-code
90
70245792618
from django.contrib import admin from models import * class StunGenericAdmin(admin.ModelAdmin): """ Generic admin covering admin-wide """ def get_readonly_fields(self, request, obj=None): return [f.name for f in self.model._meta.fields] class StunMeasurementAdmin(StunGenericAdmin): ...
LACNIC/natmeter
stun/app/admin.py
admin.py
py
2,305
python
en
code
4
github-code
90
10565991494
from utils import * import sys import scipy.io as sio from matplotlib import pyplot as plt import pandas as pd import numpy as np from scipy.misc import imsave from ex2reg import Ex2Reg from scipy.optimize import minimize from mpl_toolkits.mplot3d import Axes3D class Ex4: def __init__(self): self.data = N...
AmadiL/machine-learning-coursera
ex4.py
ex4.py
py
10,530
python
en
code
0
github-code
90
37083710365
from thrift.Thrift import TException from thrift.protocol import TBinaryProtocol from thrift.transport import TTransport class Serializador: def serializar(self, ficha_thrift): try: transport = TTransport.TMemoryBuffer() protocol = TBinaryProtocol.TBinaryProtocol(transport) ...
inacioloy/integracao_esusab_serialize
thrift/gen-py/serializador.py
serializador.py
py
469
python
en
code
0
github-code
90
31144860096
"""Junior Data Analyst test task Part 2. Plotting""" import pandas as pd import plotly.express as px import plotly.graph_objects as go def multline(line): """Split keyword string with multiple words into two lines""" s_line = line.split() s_line.insert(len(s_line)//2, '<br>') return ' '.join(s_line...
boldyshev/hse-test
second_part.py
second_part.py
py
2,500
python
en
code
0
github-code
90
9148420751
from bokeh.io import output_file, show from bokeh.models.widgets import RadioButtonGroup, Div, Button, Slider from bokeh.models import CustomJS, TextInput from bokeh.models import CustomJS, Dropdown from bokeh.layouts import column, row, gridplot from bokeh.plotting import figure, curdoc import numpy as np import scipy...
mbu003/mjb003
sugwara.py
sugwara.py
py
4,373
python
en
code
0
github-code
90
36711443955
import os import sys import urllib.request,datetime, math, json import pandas as pd BASE_DIR = os.path.dirname(os.path.dirname(os.path.relpath("./"))) secret_file = os.path.join(BASE_DIR, '../python/secret.json') with open(secret_file) as f: secrets = json.loads(f.read()) def get_secret(setting, secrets=secrets...
Hitee8239/allnew
jbj/shopping_categori.py
shopping_categori.py
py
1,597
python
en
code
0
github-code
90
35932920216
import re import os import tempfile import time #import urllib.parse as urlparse from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.support import ui as webDriverUi from selenium.webdriver.support import expected_conditions as EC from s...
him2994/rahgav-new
project/script/processors/site_us.py
site_us.py
py
19,839
python
en
code
1
github-code
90
72817712297
import numpy as np import random def getData(numspoints,bias,variance): x = np.zeros(shape=(numspoints,2)) y = np.zeros(shape= numspoints) for i in range(0,numspoints): x[i][0] = 1 x[i][1] = i y[i] = (i + bias) + random.uniform(0,1) * variance return x,y def gr...
fairygxj/JD_data
LR.py
LR.py
py
888
python
en
code
0
github-code
90
10693126352
class StandardParameters(object): def __init__(self): # This class contains a list of all MODTRAN parameters, which are currently implemented into the program. # The requirements of MODTRAN concearning the definition of parameters need to be fulfilled, however # - all parameter...
TheStatement/MODTRAN-wrapper
modtran_wrapper_UT/Main/variable_libraries/variable_library_20161114.py
variable_library_20161114.py
py
5,088
python
en
code
6
github-code
90
21845449327
# -*- coding: utf-8 -*- # @Time : 2019/4/13 17:22 # @Author : Anyue # @FileName: predict.py # @Software: PyCharm from six.moves import cPickle as pickle import tensorflow as tf batch_size = 50 with open('data/source_map.pik', 'rb') as fin: source_int_to_letter, source_letter_to_int = pickle.load(fin) with op...
Anyueanne/CoupletGenerator
predict.py
predict.py
py
1,972
python
en
code
0
github-code
90
15573001473
__author__ = 'phaniteja' # Import the modules to perform operations on Image - PIL is used for operations from PIL import Image, ImageFilter def image_operations(user_operation): global edited_image # changing the user input to upper case for our operations operation = user_operation.upper() # op...
phaniteja1/PythonWorks
python_works/image_pil.py
image_pil.py
py
1,808
python
en
code
0
github-code
90
40571416338
import tkinter as tk # python 3 from tkinter import font as tkfont # python 3 #import Tkinter as tk # python 2 #import tkFont as tkfont # python 2 class SampleApp(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) self.title_font = tk...
kamisamaneko/drillingtools
GUI.py
GUI.py
py
6,225
python
en
code
1
github-code
90
23383244468
# num=float(input()) # if num >0: # print("Число положительное") # elif num==0: # print("Ноль") # else: # print('Число отрицательное') # num=3.4 # perprint = True # if num>0 or perprint: # print('нум положительное число') # elif perprint: # print('Печать запрещена') i=int(input()) if 100>=i>=-100: ...
Yacoolontac/itmo_tester
python_trening/task_9_if_elif_else.py
task_9_if_elif_else.py
py
430
python
ru
code
0
github-code
90
20253962087
all_vow = ['a', 'u', 'o', 'y', 'i'] vow = 'o a kak ushakov lil vo kashu kakao' def find_vow(vw, av): find_v = [ch for ch in vw if ch in av] result = len(find_v) print(f'quantity letters {find_v} vowels equal {result}') find_vow(vow, all_vow) print('///////////////////////////////////')
Bulgakoff/code_abbey
lesson01/num_vowels.py
num_vowels.py
py
308
python
en
code
0
github-code
90
26500276430
#! /usr/bin/env python # # 2020 January 13. Peter Schafran ps997@cornell.edu # # Usage: getReadsFromFastq.py AllReads.fastq ReadIDs.txt OutputReads.fastq # Files must be called in order! import sys from Bio import SeqIO if len(sys.argv) != 4: print('''ERROR: Incorrect number of files specified! Need three files in t...
pschafran/scripts
getReadsFromFastq.py
getReadsFromFastq.py
py
1,087
python
en
code
0
github-code
90
70974920937
from math import ceil import sys from utils import check_sys_arguments check_sys_arguments(3) def files_difference(file, file_): bits1 = "".join(format(b, "08b") for b in file) bits2 = "".join(format(b, "08b") for b in file_) length_difference = ceil(abs(len(bits1) - len(bits2)) / 4) r...
jsxgod/Python-coursework
kkd/lista7/comparator.py
comparator.py
py
819
python
en
code
0
github-code
90
17437357160
from __future__ import absolute_import from __future__ import division from __future__ import print_function import re import tensorflow.compat.v1 as tf from kfac.python.ops import curvature_matrix_vector_products as cmvp from kfac.python.ops import estimator as est from kfac.python.ops import fisher_factors as ff fr...
tensorflow/kfac
kfac/python/ops/optimizer.py
optimizer.py
py
60,348
python
en
code
194
github-code
90