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
32520478741
# -*- coding: utf-8 -*- """ Created on Mon Dec 24 13:13:32 2018 @author: Administrator """ import wget, time import os # 网络地址 DATA_URL = 'http://164.52.0.183:8000/file/findTrace/2018-12-24.txt' # DATA_URL = '/home/xxx/book/data.tar.gz' out_fname = '2018-12-24.txt' def download(DATA_URL): out_fname = '2018-12-...
Y1ran/Pensieve-A3C-Streaming-Adaptive-Bitrate-Model
final/download_data.py
download_data.py
py
2,603
python
en
code
6
github-code
36
42263303655
from django import template from all_products.queryutil import ShirtQuery register = template.Library() @register.filter def shirt_price(shirt): shirt_query = ShirtQuery(shirt) for size in shirt_query.sizes: stock = shirt_query.get_stock(size) if stock > 0: return shirt_query.get_price(size)
drivelous/ecmrc
shirts/templatetags/shirt_price.py
shirt_price.py
py
319
python
en
code
12
github-code
36
40243466051
import streamlit as st import cv2 import time import os import tempfile import matplotlib.pyplot as plt from src.utils.streamlit import factors from src.utils.onnx_process import load_model, load_label_map, video_predict from src.utils.video_process import video_stitch from src.utils.streamlit import save_uploaded_file...
teyang-lau/you-only-edit-once
streamlit_app_onnx.py
streamlit_app_onnx.py
py
5,602
python
en
code
6
github-code
36
18609514956
class Solution(object): def countSort(self, nums): nums.sort() last = None count = 0 count_dict = {} print(nums) for x in nums: if x == last: count += 1 else: if last: count_dict[last] = count...
luluxing3/LeetCode
lulu/substsII.py
substsII.py
py
1,031
python
en
code
1
github-code
36
24324519488
from pathlib import Path from typing import IO def sentencepiece_load(file): """Load a SentencePiece model""" from sentencepiece import SentencePieceProcessor spm = SentencePieceProcessor() spm.Load(str(file)) return spm # source: https://github.com/allenai/allennlp/blob/master/allennlp/common/f...
bheinzerling/bpemb
bpemb/util.py
util.py
py
3,501
python
en
code
1,146
github-code
36
33899004274
import json from copy import deepcopy import numpy as np import pandas as pd from CWiPy import settings from CWiPy.MembershipFunction import MembershipFunction from CWiPy.Modifier import dict_modifiers def get_synonyms(word): """ Args: word: Returns: list of objects containing term and...
akali/fuzzy
CWiPy/Syntax.py
Syntax.py
py
7,092
python
en
code
2
github-code
36
19019435985
def setup_grid(points: list) -> list: width = 0 depth = 0 coords = set() for coord in points: x = int(coord.split(',')[0]) y = int(coord.split(',')[1]) coords.add((x, y)) width = x if x > width else width depth = y if y > depth else depth grid = [[' ' for x ...
AG-Guardian/AdventOfCode2021
Day 13/part2.py
part2.py
py
1,626
python
en
code
0
github-code
36
29432294183
from pymongo import MongoClient client = MongoClient('localhost', 27017) database = client.mflix pipline = [ {'$unwind':'$cast'}, {'$group': { '_id':'$cast', 'count':{'$sum':1} }}, { '$sort':{'count':-1} }] actors = database.movies.aggregate(pipline) for...
RezaeiShervin/MaktabSharif89
Shervin_Rezaei_HW18_MaktabSharif89/Shervin_Rezaei_HW18_MaktabSharif89(7).py
Shervin_Rezaei_HW18_MaktabSharif89(7).py
py
355
python
en
code
1
github-code
36
73118977704
def tab_zam(file1, var): with open(file1, 'r', encoding="utf-8") as file: if var == "развернуть": x = file.read().replace("\t", " ") elif var == "свернуть": x = file.read().replace(" ", "\t") else: print("Некорректный ввод") return w...
IlyaOrlov/PythonCourse2.0_September23
Practice/ssharygina/ssharygina5.5.py
ssharygina5.5.py
py
596
python
ru
code
2
github-code
36
40399625928
#PE 7 primes = [] for x in range(2, 1000000): composite = 0 for i in range(2, int(x**.5)+1): if x%i == 0: composite = 1 else: continue if composite == 0: primes.append(x) print(primes[10000])
smailliwniloc/Project-Euler
PE0007.py
PE0007.py
py
252
python
en
code
0
github-code
36
3458501597
class Solution(object): def findContentChildren(self, g, s): """ :type g: List[int] :type s: List[int] :rtype: int """ g = sorted(g) s = sorted(s) res = 0 while g and s: if s[0] < g[0]: s.pop(0) else: ...
pi408637535/Algorithm
com/study/algorithm/daily/455. Assign Cookies.py
455. Assign Cookies.py
py
608
python
en
code
1
github-code
36
25759812026
#!/usr/bin/env python import os import json from twitter import Api # Custom import from datetime import datetime from datetime import date import time import re import sys def loadConfig(config_secret): # Go to http://apps.twitter.com and create an app. # The consumer key and secret will be generated for yo...
gunarto90/twitter-stream
stream.py
stream.py
py
11,136
python
en
code
1
github-code
36
19115581972
async def is_member(user, guild): if not (isinstance(user, str) or isinstance(user, int)): return await guild.fetch_member(int(user.id)) return await guild.fetch_member(int(user)) # raise TypeError("User must by specyfied by str or int (id)") TERMINAL_COLORS = { "H": "\033[95m", # header ...
cnuebred/pyelectron
src/utils.py
utils.py
py
1,027
python
en
code
1
github-code
36
40751652782
import random, math def generator( name="problem-n", cities = 2, smallAirplanes = 1, mediumAirplanes = 0, largeAirplanes = 0, trains = 1, railwayFactor = 0.5, smallTrucksPerCity = 1, mediumTrucksPerCity = 0, largeTrucksPerCity = 0, officesPerCity=1, ...
owodunni-lfischerstrom/tddc17-lab4
generator.py
generator.py
py
10,199
python
en
code
0
github-code
36
4292641099
from django.contrib.auth.models import User from django.test import TestCase from note.forms import NoteAddForm, NoteEditForm from note.models import Note class NoteFormsTestCase(TestCase): def setUp(self): # Arrange self.user = User.objects.create_user(username='test_user', password='test_pass')...
mehdirahman88/django_notes
note/tests/test_forms.py
test_forms.py
py
2,820
python
en
code
0
github-code
36
8711592711
import cx_Oracle class modulo(): codigoSeccion=0 ramo1="" ramo2="" ramo3="" ramo4="" def __init__(self,codSec) : self.codigoSeccion=codSec def crearModulo(): try: conexion=cx_Oracle.connect( user='escuela', passwo...
nmolina2733/Universidad
modulo.py
modulo.py
py
3,357
python
es
code
0
github-code
36
2180953342
from flask import Flask, jsonify, request import datetime import fetchNavigationData app = Flask(__name__) app.config['JSON_AS_ASCII'] = False @app.route('/api', methods=['GET']) def index(): first = request.args.get('first', '') second = request.args.get('second', '') json1 = fetchNavigationData.fetch_st...
5ym/smaen
back/module/app.py
app.py
py
1,208
python
en
code
0
github-code
36
932987117
from django.db.models.signals import post_save from django.dispatch import receiver from .models import Piece @receiver(post_save, sender=Piece) def save_base64_thumbnail(**kwargs): update_fields = kwargs["update_fields"] # Without this, the signal will be called in an infinite loop. if update_fields is ...
ChrisCrossCrash/chriskumm.com_django
art/signals.py
signals.py
py
569
python
en
code
0
github-code
36
28512545517
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE # Utility classes that can be used to generate parse tree patterns. These # utilities take a sample expression or statement, and return a parse tree...
psrc/urbansim
opus_core/variables/utils/parse_tree_pattern_generator.py
parse_tree_pattern_generator.py
py
1,935
python
en
code
4
github-code
36
13422218557
import colors ################################################################## #This is the module used for testing correctness. It performs # #safety, liveliness and fairness test on the list of values sent # #from the monitor. # ################################################################## def test...
NishanthMuruganandam/AsynchronousSystems
Correctness_Verif_Performance_Measure_DistAlgos/correctnessTester.py
correctnessTester.py
py
3,322
python
en
code
0
github-code
36
36570276493
import datetime import urllib import urllib.parse from mpcomp import http_core try: import simplejson from simplejson.decoder import JSONDecodeError except ImportError: JSONDecodeError = None try: # Try to import from django, should work on App Engine from django.utils import simplejson...
MicroPyramid/opensource-job-portal
mpcomp/gauth.py
gauth.py
py
10,945
python
en
code
336
github-code
36
17134241020
from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() spark.conf.set('spark.sql.parquet.compression.codec', 'snappy') spark.conf.set('hive.exec.dynamic.partition.mode', 'nonstrict') spark.conf.set('spark.streaming.stopGracefullyOnShutdown', 'true') spark.conf.set('hive.exec.max.dynamic.partiti...
ConMota/app_renta_indirecta_GS
Class_02_feat.py
Class_02_feat.py
py
3,937
python
es
code
0
github-code
36
39090962511
import socket import struct import textwrap import sys INTERFACE_NAME = 'enp0s3' def format_multi_line(string, size=80): if isinstance(string, bytes): string = ''.join(r'\x{:02x}'.format(byte) for byte in string) if size % 2: size -= 1 return '\n'.join([line for line in textwrap.wr...
frederon/packet-sniffer
sniffer.py
sniffer.py
py
6,225
python
en
code
0
github-code
36
33040671101
import io from typing import List, Set, Tuple from clvm import KEYWORD_FROM_ATOM, KEYWORD_TO_ATOM, SExp from clvm import run_program as default_run_program from clvm.casts import int_from_bytes from clvm.EvalError import EvalError from clvm.operators import OP_REWRITE, OPERATOR_LOOKUP from clvm.serialize import sexp_f...
snight1983/chia-rosechain
chia/types/blockchain_format/program.py
program.py
py
7,273
python
en
code
369
github-code
36
34347438133
"""Module for quad element with 4 nodes - type 3 in gmsh """ from diffuspy.element import Element import numpy as np class Quad4(Element): """Constructor of a 4-node quadrangle (TYPE 3) element """ def __init__(self, eid, model, material): super().__init__(eid, model) # Nodal coordinat...
nasseralkmim/diffuspy
diffuspy/elements/quad4.py
quad4.py
py
13,182
python
en
code
5
github-code
36
19358330260
import subprocess import numpy as np # Tamaño de las matrices n = 8 # Crear matrices aleatorias en Python entre 1 y 5 (con decimales) A = np.random.randint(1, 6, size=(n, n)) B = np.random.randint(1, 6, size=(n, n)) # girar la matriz 90 grados a la derecha # Ejecutar el programa en C # Asegúrate de que este sea el ...
nivalderramas/paralela
matrixMult/matrixComprobator.py
matrixComprobator.py
py
1,808
python
es
code
0
github-code
36
12371109221
n = int(input()) array = [] for i in range(n): array.append(int(input())) def merge_sort(array): def sort(low, high): if high - low < 2: return mid = (low + high) // 2 sort(low, mid) sort(mid, high) merge(low, mid, high) def merge(low, mid, high): ...
hwangstone1/Algorithm_repository
Algorithm_sorting/exercise_7.py
exercise_7.py
py
875
python
en
code
0
github-code
36
10513613017
from django.test import SimpleTestCase from website.forms import CreateUserForm, SignUpForm, FeedbackForm, PatientForm, DocumentationP, EventForm, MessageForm, RequestForm from website.models import Patient, SignUp, Feedback, Documentation, Event, Messages, Requests class TestForms(SimpleTestCase): def test_creat...
liorco15/HealthTourism
test_forms.py
test_forms.py
py
1,646
python
en
code
0
github-code
36
33989498564
from django.contrib.auth.models import User from django.shortcuts import render from profile_app.models import UserProfileInfo from video_app.models import Video from comment_app.models import Comment from django.http import JsonResponse from django.contrib.auth.decorators import login_required # Create your views her...
NathanA15/music-video
music_project/comment_app/views.py
views.py
py
1,008
python
en
code
0
github-code
36
18760528871
import numpy as np import itertools import cv2 def draw_epipolar_lines(img_left, img_right): height = np.shape(img_left)[0] divisions = 40.0 colors = [(255,0,0), (0,0,255), (0,255,0), (255,255,0), (255,255,255), (0,255,255)] color_generator = itertools.cycle(colors) step = int(np.floor(height/divis...
olaals/multivision-depr
multivision/oa_stereo_utils.py
oa_stereo_utils.py
py
2,439
python
en
code
0
github-code
36
38043839602
import xlrd #读取excel import xlwt #写入excel from datetime import date,datetime def read_excel(name): #打开文件 workbook = xlrd.open_workbook('../data/' + name + '.xlsx') #获取所有sheet # print(workbook.sheet_names()) #只有一张表 sheet_name = workbook.sheet_names()[0] #根据sheet索引或者名称获取sheet内容 sheet =...
MrLeedom/TSC_RL
CSP/preprocess/third.py
third.py
py
1,744
python
en
code
7
github-code
36
74470473064
""" Project Tasks that can be invoked using using the program "invoke" or "inv" """ import os from invoke import task # disable the check for unused-arguments to ignore unused ctx parameter in tasks # pylint: disable=unused-argument IS_WINDOWS = os.name == "nt" if IS_WINDOWS: # setting 'shell' is a work around f...
arecarn/dploy
tasks.py
tasks.py
py
2,421
python
en
code
68
github-code
36
33453047943
from __future__ import print_function import socket import sys import os import re import logging import datetime """ FTPClient object requires: - HOST (IP address or domain) - PORT (Integer value between 0-99999) - COMMANDS (List of Strings: LIST|PUT|GET followed by filename) CTRL+C to exit client """ EXAMPLE_INPU...
denBot/clientserver-ftp-sockets-demo
src/client.py
client.py
py
10,207
python
en
code
0
github-code
36
24390096374
from itertools import chain from . import builder from .. import options as opts, safe_str, shell from .common import Builder, choose_builder, SimpleBuildCommand from ..file_types import HeaderFile, SourceFile from ..iterutils import iterate from ..languages import known_langs from ..path import Path from ..versioning...
jimporter/bfg9000
bfg9000/tools/qt.py
qt.py
py
7,250
python
en
code
73
github-code
36
20857741707
#https://leetcode.com/problems/xor-operation-in-an-array/ class Solution: def xorOperation(self, n: int, start: int) -> int: ans=[] for i in range(1,n+1,1): ans.append(start+2*(i-1)) l=ans[0] ans=ans[1:] for x in ans: l=l^x return l
manu-karenite/Problem-Solving
Math/XOROperations.py
XOROperations.py
py
308
python
en
code
0
github-code
36
12610161351
#!/usr/bin/python import sys #input should be space-separated lines of #waterfall-like quantites #with time on the vertical axis #types on horizontal axis #bar heights as values linecnt = 0 while 1: line = sys.stdin.readline() if len(line) == 0: break colcnt = 0 for col in line.split(): print('%d %d %d' % (...
marcuswanner/randuino
hist2pm3d.py
hist2pm3d.py
py
387
python
en
code
3
github-code
36
73527120745
''' candidate generation: writes a pickle file of candidates ''' import sys import nltk import numpy as np from ncbi_normalization import load, sample from ncbi_normalization.parse_MEDIC_dictionary import concept_obj from normalize import dump_data, load_data, load_mentions from gensim.models import KeyedVectors ...
fshdnc/nor-bert
src/candidate_generation.py
candidate_generation.py
py
6,793
python
en
code
0
github-code
36
24759427933
#!/usr/bin/python3 def safe_print_list(my_list=[], x=0): ctr = 0 for index in range(0, x): try: print(f"{my_list[index]}", end="") ctr += 1 except IndexError: break print() return (ctr)
Riyo3350G/alx-higher_level_programming
0x05-python-exceptions/0-safe_print_list.py
0-safe_print_list.py
py
256
python
en
code
0
github-code
36
36955740049
import wttest from wtscenario import make_scenarios from wiredtiger import WT_NOTFOUND # test_prepare_hs05.py # Test that after aborting prepare transaction, correct update from the history store is restored. class test_prepare_hs05(wttest.WiredTigerTestCase): conn_config = 'cache_size=50MB' format_values = [...
mongodb/mongo
src/third_party/wiredtiger/test/suite/test_prepare_hs05.py
test_prepare_hs05.py
py
3,463
python
en
code
24,670
github-code
36
31965515598
#!/usr/bin/python # -*- coding: utf-8 -*- # vi: ts=4 sw=4 import pickle from ..Protocols import * from scipy.spatial.distance import cdist from sklearn.preprocessing import StandardScaler from sklearn.cluster import KMeans, MeanShift, estimate_bandwidth, AffinityPropagation, SpectralClustering # Clustering methods f...
CFN-softbio/SciAnalysis
SciAnalysis/ImAnalysis/Flakes/cluster.py
cluster.py
py
42,216
python
en
code
19
github-code
36
13347982564
import bge, json from bge.logic import globalDict from random import choice, random from pprint import pprint from ast import literal_eval as litev if not 'player_active' in globalDict.keys(): globalDict['player_active'] = False def init(cont): """ Initializes the character. """ own = cont.owner scene = own.sce...
BlenderCN-Org/upbge_random_city_generator
char.py
char.py
py
4,512
python
en
code
1
github-code
36
32281752161
import identity_server.logic.session.login_session.logged_in_state as lst import identity_server.logic.session.login_session.waiting_for_permission as wfp from mongodb.Application import Application from mongodb.ApplicationAccount import ApplicationAccount from django.http.response import HttpResponse import identity_...
aI-lab-glider/oauth2-server-implementation
identity_server/logic/session/login_session/initial_login_state.py
initial_login_state.py
py
2,766
python
en
code
0
github-code
36
32716485591
""" Image editing class for head to bot, time-trail, obstacle where there is only single agent """ import datetime import logging import rospy import cv2 from markov.log_handler.logger import Logger from markov.utils import get_racecar_idx from mp4_saving import utils from mp4_saving.constants import (RaceCarColorToRG...
aws-deepracer-community/deepracer-simapp
bundle/src/deepracer_simulation_environment/scripts/mp4_saving/single_agent_image_editing.py
single_agent_image_editing.py
py
13,347
python
en
code
79
github-code
36
42242738770
#!/usr/bin/env python import numpy import scipy.integrate from pylab import * datafile="../../../Mathematica/calculated_vals.tsv" tag,x,e,f = numpy.loadtxt("data.txt",unpack=True) tags=numpy.unique(tag) flimit = numpy.zeros(len(tags)) for i in range(0,len(tags)): itag=tags[i] inds = numpy.where(tag == itag)...
charlesblakemore/opt_lev_analysis
casimir/scuffCode/Comparison/byXi/plot_integrand.py
plot_integrand.py
py
773
python
en
code
1
github-code
36
33517632306
from manimlib.imports import * class Limite4_1 (ThreeDScene): def construct (self): titulo=TextMobject('''Existencia del Límite en Infinito\n de Funciones de $\\mathbb{R}^n$ $\\rightarrow$ $\\mathbb{R}$''').scale(1.5) text=TextMobject("Sea $f:\\mathbb{R}^{n}\\rightarrow\...
animathica/calcanim
Límite y continuidad en funciones multivariable/limite_infinito_Rn-R.py
limite_infinito_Rn-R.py
py
6,635
python
en
code
19
github-code
36
8721596981
from scipy.misc import comb def exp(p, n): total = 0.0 for k in range(n+1): total += comb(n, k, exact=False) * p**k * (1-p) ** (n-k) return total def main(): for p in [0.3, 0.75, 0.8, 1.0, 0.0, 0.5]: for n in range(1, 20): print('Checking n=%d, p=%f' % (n, p)) ...
JelteF/statistics
2/lab2_2_d.py
lab2_2_d.py
py
395
python
en
code
0
github-code
36
31618957679
import pickle import os import pprint def save_dict_to_file(output): global system_text global list_of_files file_ = f'{your_target_folder}/{list_of_files[i_file]}' filename, file_extension = os.path.splitext(file_) dict_data = {} for line_ in output.splitlines(): key, value = line_.spl...
dochaauch/Tools_for_buh
Bonus_help.py
Bonus_help.py
py
1,262
python
en
code
0
github-code
36
72219956265
# one can of paint covers 5m^2 of wall, given a random height and width of wall # calculate the minimum cans of paint to buy to fully cover the wall fully. # define a function to take in inputs for width, height # calculate the area of wall w*h, then calculate cans to buy rounded up to whole number # output the number ...
ElliotMonde/py_udemy
print_debug_comment/get_paint_cans.py
get_paint_cans.py
py
620
python
en
code
0
github-code
36
71685392105
from turtle import * def kwadrat(s,col): pd() fillcolor(col) begin_fill() for _ in range(4): fd(s) lt(90) end_fill() pu() def trojkat(s,n,col): x=position() fd(s) for i in range(n,0,-2): for j in range(i): kwadrat(s,col) fd(s) ...
chinski99/minilogia
2010/etap 3/kwadraty.py
kwadraty.py
py
1,051
python
en
code
0
github-code
36
37502622427
# https://school.programmers.co.kr/learn/courses/30/lessons/12981 def solution(n, words): check = set() check.add(words[0]) cnt = 2 for i in range(1, len(words)): st, ed = words[i - 1], words[i] if st[-1] != ed[0] or ed in check: return [cnt % n if cnt % n else n, cnt // n +...
junsgi/Algorithm
Implementation/영어 끝말잇기.py
영어 끝말잇기.py
py
399
python
en
code
0
github-code
36
39060387909
from numpy import arange,log,exp,r_ from matplotlib import pyplot as plt from scipy.special import gamma import Cua2008 from numpy import fft,sin,pi from numpy.random import normal duration=60 hf_dt=0.01 mean=0.0 std=1.0 num_samples = int(duration/hf_dt) t=arange(0,duration,hf_dt) noise = normal(mean, std, size=num_sa...
Ogweno/mylife
misc/windowing_test.py
windowing_test.py
py
1,076
python
en
code
0
github-code
36
10905562253
from pydantic import BaseModel class SourceURL(BaseModel): '''Source URL schema''' source_url: str class Config: orm_mode = True class URLInfo(SourceURL): '''URL Information schema''' short_url_key: str short_url: str
ScottyZA/backendend-challenge
url_shortener/schemas.py
schemas.py
py
255
python
en
code
0
github-code
36
72300794345
import sys from osgeo import gdal, osr class GDALUtilities: """ This class has the following capabilities 1. Get raster info 2. Read image band as an array 3. Reproject a raster """ def __init__(self, path): self.path = path def get_raster_info(self): self.datas...
manojappalla/RSGIS-Tutorials
gdal_tutorials/gdal_utilities.py
gdal_utilities.py
py
2,135
python
en
code
0
github-code
36
33654948642
import unittest from onnx import defs, helper from onnx.onnx_pb2 import NodeProto class TestRelu(unittest.TestCase): def test_relu(self): self.assertTrue(defs.has('Relu')) node_def = helper.make_node( 'Relu', ['X'], ['Y']) if __name__ == '__main__': unittest.main()
tianyaoZhang/myONNX
onnx/test/relu_test.py
relu_test.py
py
307
python
en
code
0
github-code
36
20530887810
#Annalisa Dattilio #This program will allow the user to enter their size/measurements and be able to find their perfect size across online clothing stores domestically and internationally mylist = list(("Nike", "Cotton On")) for x in range(len(mylist)): print(mylist[x]) #how to show only the sizes for store user s...
ADattilio88/SizeCalculator
integration sprint 1.py
integration sprint 1.py
py
7,563
python
en
code
0
github-code
36
38660134742
import logging import sys import click import requests from bs4 import BeautifulSoup from telegram.ext import CommandHandler, Filters, MessageHandler, Updater from tinydb import Query, TinyDB db = TinyDB("db.json") Job = Query() TELEGRAM_BOT_TOKEN = None class JobExistsException(Exception): pass def parse_re...
NiklasMM/ebk-bot
bot.py
bot.py
py
5,611
python
en
code
0
github-code
36
38083425705
#!/usr/bin/env python3 import os import sys import math import struct from migen import * from migen.genlib.resetsync import AsyncResetSynchronizer from litex.build.generic_platform import * from litex.build.xilinx import XilinxPlatform from litex.soc.cores.clock import * from litex.soc.integration.soc_core import *...
kamejoko80/linux-on-litex-vexriscv-legacy
soc_builder/soc_generator.py
soc_generator.py
py
10,332
python
en
code
0
github-code
36
23928535346
# This is the python implementation of minesweeper import random as rand from tkinter import * from functools import partial def create_graph(w, h): """ Function to create the graph for a board of n * n size """ graph = {} for i in range(h): for j in range(w): neighbors = [] ...
thalluricheritha/minesweeper
MineSweeperScript.py
MineSweeperScript.py
py
6,181
python
en
code
0
github-code
36
5881104834
import array import binascii import configparser import datetime import io import logging import os import signal import sys import time try: import serial except ImportError: pass ModulSerialMissing = True ################################################################################ # Constants BUILDVERSION ...
nasrudin2468/pye-motion
pye-motion.py
pye-motion.py
py
4,158
python
en
code
4
github-code
36
32624805079
from torch import nn import torch import numpy as np import os class Encoder(nn.Module): def __init__(self, latent_dims, qc_level): super(Encoder, self).__init__() dims = [] if qc_level == 1: dims = [17, 24, 8, latent_dims] elif qc_level == 2: dims = [22, 36, 12, latent_dims] elif qc...
chiyang/tmasque
tmasque/QualityEncoder.py
QualityEncoder.py
py
8,839
python
en
code
0
github-code
36
2223043714
def interleave_str(s1, s2, s3): # can s3 be formed by interleaving s1 and s2 ? n, m = len(s1), len(s2) if len(s3) != n + m: return False dp = [False for _ in range(m + 1)] for i in range(n + 1): for j in range(m + 1): if i == j ==0: dp[j] = True ...
arrws/leetcode
dynamic/interleave_str.py
interleave_str.py
py
661
python
en
code
0
github-code
36
22313884437
from django.core.management.base import BaseCommand from import_data.models import OuraMember, FitbitMember, GoogleFitMember from retrospective.tasks import ( update_fitbit_data, update_oura_data, update_googlefit_data, ) import time import requests class Command(BaseCommand): help = "Updates all data...
OpenHumans/quantified-flu
import_data/management/commands/update_data_imports.py
update_data_imports.py
py
1,148
python
en
code
24
github-code
36
25470793052
# Escrito por gilsilva20629@gmail.com _ gilberto.s@escolar.ifrn.edu.br ''' 3) Implemente um programa que leia uma palavra e verifique se a mesma é palíndromo. Um palíndromo é uma palavra que pode ser lida igualmente de trás pra frente e de frente pra trás. Exemplo: arara. ''' p = input('Digite uma palavra: ...
gilsilva20629/REDES-DE-COMPUTADORES
Gilberto_Silva_ead03.py
Gilberto_Silva_ead03.py
py
491
python
pt
code
0
github-code
36
13918851672
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 3 13:07:13 2018 @author: marcos """ import pandas as pd import csv import pickle as pkl import numpy as np import scipy.stats as sts from sklearn import preprocessing as prep # =====================================================================...
mhfribeiro/safra-meta
modules/preprocess/dmt.py
dmt.py
py
10,322
python
en
code
0
github-code
36
11514166585
from hashlib import sha1 from json import dump from os import makedirs apps = { 'apps': [ 'club.postdata.covid19cuba', 'com.codestrange.www.cuba_weather', 'com.cubanopensource.todo', ] } def main(): result = {} makedirs('api', exist_ok=True) with open(f'api/apps.json', mo...
leynier/cubaopenplay.github.io
app/main.py
main.py
py
725
python
en
code
3
github-code
36
31521216432
class Solution(object): def countDigitOne(self, n): """ :type n: int :rtype: int """ return self.c(n+1) def c(self, n): if n<=10: return int(n>1) head=int(str(n)[0]) tail=int(str(n)[1:] or 0) full=int('1'+'0'*(len(str(n...
szhu3210/LeetCode_Solutions
LC/233.py
233.py
py
511
python
en
code
3
github-code
36
18526754583
import logging import tqdm from multiprocessing import Pool from dsrt.config.defaults import DataConfig class Padder: def __init__(self, properties, parallel=True, config=DataConfig()): self.properties = properties self.config = config self.parallel = parallel self.max_ule...
sbarham/dsrt
dsrt/data/transform/Padder.py
Padder.py
py
2,765
python
en
code
1
github-code
36
22372717524
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import torch.utils import torch.nn.functional as F import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model_searc...
importZL/LFM
NAS/darts-lfm/train_search_lfm.py
train_search_lfm.py
py
15,995
python
en
code
0
github-code
36
7494741687
"""Train a model on Treebank""" import random import json import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_scheduler as sched import torch.utils.data as data import utils from collections import OrderedDict from tqdm import tqdm fr...
Vincent25-Li/Treebank
train.py
train.py
py
7,389
python
en
code
0
github-code
36
29055282773
import io import picamera import cv2 import numpy import serial import time import RPi.GPIO as gp ####### Servo Motor Contol ####### gp.setmode(gp.BOARD) gp.setup(11, gp.OUT) pwm=gp.PWM(11, 50) pwm.start(3) port = '/dev/ttyACM0' Face = 0 turn=1 while(turn): i=3 while(i): #Create a memory stream...
FarhatBuet14/Rescue-BOT
Codes/main.py
main.py
py
3,571
python
en
code
1
github-code
36
2811075086
from torch import optim from torch.distributions import Categorical import importlib class Model(): def __init__(self, config, modelParam, env): self.update_counter = 0 if modelParam['cuda']['use_cuda']: self.device = f"cuda:{modelParam['cuda']['device_idx']}" else: ...
ivartz/IN9400_exercises
week14/exercise/policy_learning/utils/model.py
model.py
py
1,937
python
en
code
1
github-code
36
74207456423
import argparse import logging log_debug = logging.getLogger("debugLog") _available_commands = ["list"] def get_parser(parent=None): # Anomaly commands conf_file_parser = argparse.ArgumentParser(add_help=False) conf_file_parser.add_argument('--config_file', '--config_path', help='Path to config file', ...
Ydjeen/openstack_anomaly_injection
openstack_anomaly_injection/anomaly_injection/node_control/config/argparser.py
argparser.py
py
2,668
python
en
code
0
github-code
36
20761353624
import math import numpy as np import statistics import random import time import matplotlib.pyplot as plt h = 40 limit_number_of_taken_values = 200 nb_of_initial_values = 100 nb_of_Dthet = 100 Dthets = [(i * 1 / nb_of_Dthet) for i in range(nb_of_Dthet)] # thet step for ARL function # sigs = [(0.5 + i/nb_of_sensor...
gwenmaudet/PhD_main
detection_step_signal/GLR.py
GLR.py
py
17,337
python
en
code
0
github-code
36
74361688425
from datetime import datetime import logging from django.contrib.auth import authenticate from django.core import serializers from django.http import HttpResponse, HttpResponseBadRequest from django.shortcuts import get_object_or_404 from django.views.decorators.csrf import csrf_exempt from django.contrib.auth import l...
lepilepi/eturtle
server/api/views.py
views.py
py
5,950
python
en
code
5
github-code
36
2515032447
import sys import seaborn as sns import pandas as pd import numpy as np import scipy.stats from collections import defaultdict from matplotlib import pyplot as plt from sklearn.metrics import r2_score, mean_absolute_error #plt.style.use('seaborn-whitegrid') #sns.set_theme() #Function for creating a dictionary from the...
thek71/epiScripts
calculateCorrelationDensity.py
calculateCorrelationDensity.py
py
3,000
python
en
code
0
github-code
36
25163328807
import operator import pandas as pd from easul.action import ResultStoreAction from easul.algorithm import StoredAlgorithm from easul.algorithm.factor import OperatorFactor from easul.data import DataSchema, DFDataInput from easul.step import VisualStep from easul.visual import Visual from easul.visual.element import...
rcfgroup/easul
easul/tests/example.py
example.py
py
21,533
python
en
code
1
github-code
36
496206437
import os import pytest from dagster_aws.emr import EmrJobRunner, emr_pyspark_resource from dagster_pyspark import pyspark_resource, pyspark_solid from moto import mock_emr from dagster import ( DagsterInvalidDefinitionError, ModeDefinition, RunConfig, execute_pipeline, pipeline, ) from dagster.se...
helloworld/continuous-dagster
deploy/dagster_modules/libraries/dagster-aws/dagster_aws_tests/emr_tests/test_pyspark.py
test_pyspark.py
py
5,158
python
en
code
2
github-code
36
24205678140
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Aug 26 13:21:56 2019 @author: nilose """ import matplotlib.pyplot as plt import numpy as np import pandas as pd import random from scipy import stats import scipy.integrate as integrate def gauss(x,mu,sigma): return (1/(np.sqrt(2*np.pi)*sigma))*...
NataliaDelCoco/FilamentAnalysis
KDE_RS_V2.py
KDE_RS_V2.py
py
9,660
python
en
code
0
github-code
36
19739909449
from vigilo.vigiconf.lib.confclasses.test import Test class NTPSync(Test): """Check if a host's time is synchronized with the NTP server (using NRPE)""" def add_test(self): self.add_external_sup_service("NTP sync", "check_nrpe_1arg!check_ntp_time") self.add_perfdata_handler("NTP sync", 'NTP-...
vigilo/vigiconf
src/vigilo/vigiconf/tests/all/NTPSync.py
NTPSync.py
py
462
python
en
code
3
github-code
36
20886565147
#!/usr/bin/env python """ Identifies groups of medium order (512, 1152, 1536, 1920, 2187, 6561, 15625, 16807, 78125, 161051) by connecting to devmirror.lmfdb.xyz and using the stored hashes there. Usage: Either provide an input file with hashes to identify, one per line, each of the form N.i ./identify.py -i INPUT_F...
roed314/FiniteGroups
Code/identify.py
identify.py
py
4,140
python
en
code
2
github-code
36
22283616647
#!/Users/tnt/Documents/虚拟环境/Django/bin/python3 # -*- encoding: utf-8 -*- # Time : 2021/05/27 08:04:03 # Theme : 循环链表 class Node(): def __init__(self, data): self.data = data self.next = next class CircularLinkedList(): def __init__(self): self.head = None def append(self,...
Createitv/BeatyPython
05-PythonAlgorithm/BasicDataStructure/linkedList/circular_linked_lists.py
circular_linked_lists.py
py
5,011
python
en
code
1
github-code
36
71107235304
# O(n^2) Time and O(1) Space best, average and worst. def swap(x,y,arr): arr[x], arr[y] = arr[y], arr[x] def selectionSort(array): currIdx = 0 while currIdx < len(array)-1: smallestIdx = currIdx for x in range(currIdx+1, len(array)): if arr[smallesIdx] > arr[x]: smallestIdx = x swap(currI...
BrianAKass/algo-practice
012 Seection Sort/Selection Sort.py
Selection Sort.py
py
371
python
en
code
1
github-code
36
21892894147
from django.urls import path from accounts import views app_name='accounts' urlpatterns=[ path('register',views.register,name='register'), path('login',views.login,name='login'), path('logout',views.logout,name='logout'), path('page1',views.page1,name='page1'), path('r^create_view/',views.create_vie...
amalarosebenny/farming
collegeproject/accounts/urls.py
urls.py
py
533
python
en
code
0
github-code
36
72164631784
# -*- encoding: utf-8 -*- # External imports import requests import json import datetime # ---------------------------------------- Ne pas mettre là # # Load settings # with open('settings.json', encoding="utf-8") as f: # settings = json.load(f) # # Get the original file # API_KEY = settings["API_KEY"] # TOKEN =...
Alban-Peyrat/Trello_API_interface
Trello_API_cards.py
Trello_API_cards.py
py
3,799
python
en
code
0
github-code
36
70387249063
from aplication.models import historical_record from aplication.dto.dto_record import dto_record import datetime as dt def register(_record:dto_record): historical = historical_record() historical.registration_date = dt.date.today() historical.registration_time = dt.datetime.now().strftime('%H:%M:%...
GustavoRosario/pass
pj/aplication/controles/record.py
record.py
py
414
python
en
code
0
github-code
36
22377866084
from django import forms from django.db import transaction from .models import CustomUser from django.contrib.auth.forms import UserCreationForm,UserChangeForm class CustomerSignUpForm(UserCreationForm): class Meta: model=CustomUser fields = ('username', 'name', 'email', 'number', 'address') @...
aditrisinha/Aagman
accounts/forms.py
forms.py
py
807
python
en
code
0
github-code
36
37402801837
from regression_tests import * class TestDetection_QB64(Test): settings = TestSettings( tool='fileinfo', input=files_in_dir('inputs'), args='--json' ) def test_detected_autoit(self): qb64_recognized = False self.assertTrue(self.fileinfo.succeeded) for tool ...
avast/retdec-regression-tests
tools/fileinfo/detection/compilers/qb64/test.py
test.py
py
504
python
en
code
11
github-code
36
36808295769
import copy from typing import Tuple, Union from numbers import Number import torchio as tio from torchio.transforms.augmentation import RandomTransform import torch import numpy as np class ReconstructMeanDWI(RandomTransform): def __init__( self, full_dwi_image_name: str = "full_dwi", ...
efirdc/Segmentation-Pipeline
segmentation_pipeline/transforms/reconstruct_mean_dwi.py
reconstruct_mean_dwi.py
py
6,434
python
en
code
1
github-code
36
13747681752
import re def grab_ip(file): ips = [] occurence = {} with open("/Users/rajekum/Documents/git/file.txt") as file: for ip in file: ip_data=re.findall(r'(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})',ip) for i in ip_data: ips.append(i) for ip...
rajekum/Test
bluestackdemo.py
bluestackdemo.py
py
649
python
en
code
0
github-code
36
26307003757
# from logger import get_logger from time import time import re class Flow: def __init__(self, logger, flow): self._name = None self.LOGGER = logger self._flow_config = flow self._last_run_timestamp = None self._name = str(flow['name']) self._params = tuple(flow['p...
ivanpavlina/DataScrapper
lib/flow.py
flow.py
py
6,396
python
en
code
0
github-code
36
2026891662
import argparse import torch from torch.autograd import Variable from network_prep import create_loaders, prep_model, create_classifier def get_input_args(): parser = argparse.ArgumentParser(description='Get NN arguments') parser.add_argument('data_dir', type=str, help='mandatory data directory') pars...
hikaruendo/udacity
ai programming with python1/train.py
train.py
py
6,086
python
en
code
0
github-code
36
28516429877
bins = [2, 3, 6, 10, 20, 50, 100] bins_str = [str(i) for i in bins] bin_pre = None bin_var = 'establishment.employment_lag1' lower_bound = ['(%s >= %s)' % (bin_var, bin) for bin in bins] upper_bound = ['(%s < %s)' % (bin_var, bin) for bin in bins[1:]] + [''] vars = [] for bin, l, u in zip(bins_str, lower_bound, upper_b...
psrc/urbansim
paris/establishment/aliases.py
aliases.py
py
1,062
python
en
code
4
github-code
36
39056592319
from numpy import array,zeros from matplotlib import pyplot as plt num='0016' path='/Users/dmelgar/Slip_inv/Amatrice_3Dfitsgeol_final1/output/inverse_models/models/_previous/' root1='bigkahuna_vrtest3win_vr' root2='.'+num+'.log' vr=array([1.6,1.8,2.0,2.2,2.4,2.6]) vr_static=zeros(len(vr)) vr_insar=zeros(len(vr)) vr_v...
Ogweno/mylife
amatrice/plot_vr_test.py
plot_vr_test.py
py
935
python
en
code
0
github-code
36
4489955191
""" Name : test_addmember.py Author : Tiffany Time : 2022/8/1 19:02 DESC: """ import time import yaml from faker import Faker from selenium import webdriver from selenium.common import StaleElementReferenceException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_condition...
TiffanyWang1108/web_camp
prepare/test_case/test_addmember.py
test_addmember.py
py
3,698
python
en
code
0
github-code
36
73818234985
import requests from bs4 import BeautifulSoup from database import DataBase from log import log from scrape import Scrape class Flipkart(Scrape): def formatData(self, soupText): """ This function extracts specific information from the `soupText` object and returns it in a formatted manner. ...
ujitkumar1/ramranger
src/flipkart_scrape.py
flipkart_scrape.py
py
3,338
python
en
code
0
github-code
36
35051050576
import torch import torchsl from torchsl._extensions import _has_ops from ._helpers import * __all__ = ['lpp'] # =========================================================== # Locality Preserving Projection # =========================================================== # noinspection DuplicatedCode def lpp(X): # ...
inspiros/pcmvda
torchsl/ops/subspace_learning/lpp.py
lpp.py
py
608
python
en
code
1
github-code
36
34773386089
from flask import Flask, render_template from bs4 import BeautifulSoup import requests, json def scrapCars(): source = requests.get('https://www.izmostock.com/car-stock-photos-by-brand').text soup = BeautifulSoup(source, 'lxml') my_table = soup.find('div', {'id': 'page-content'}) links = my_tab...
tech387-academy-python/PythonAppDemo
webscraper.py
webscraper.py
py
537
python
en
code
0
github-code
36
72284442024
import kth_native as nat import sys import time import asyncio import kth # def fetch_last_height_async(chain): # loop = asyncio.get_event_loop() # fut = loop.create_future() # nat.chain_fetch_last_height(chain, lambda err, h: fut.set_result((err, h))) # return fut def generic_async_1(func, *args): ...
k-nuth/py-api
kth/chain/chain.py
chain.py
py
14,093
python
en
code
0
github-code
36
37502388397
check = [0] * 10001 visit = [0] * 10001 check[1] = 1 for i in range(4, 10001, 2): check[i] = 1 for i in range(3, 10001, 2): swi = 0 if check[i]: continue for j in range(2, i): if i * i < j or i % j == 0: swi = 1 break if not swi: for j in range(i + i, 10001, i)...
junsgi/Algorithm
BackTracking/소-난다!.py
소-난다!.py
py
774
python
en
code
0
github-code
36
18252621901
from typing import List class Solution: def minStartValue1(self, nums: List[int]) -> int: n = len(nums) m = 100 left = 1 right = m * n + 1 while left < right: middle = (left + right) // 2 total = middle is_valid = True for num...
hujienan/Jet-Algorithm
leetcode/1413. Minimum Value to Get Positive Step by Step Sum/index.py
index.py
py
951
python
en
code
0
github-code
36