max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
basic/exercise1.py | jspw/Basic_Python | 6 | 12779251 | <gh_stars>1-10
print(" this is \\\\ double backslash \nthis is //\\//\\//\\//\\//\\ mountain \nhe is awesome\b y")
print("\\\"\\n\\t\\\'") | 2.234375 | 2 |
Exercicios/ex033_Maior e menor valores.py | GabrielMazzuchello/Curso-Em-Video | 2 | 12779252 | num1 = int(input('Primeiro valor: '))
num2 = int(input('Segundo valor: '))
num3 = int(input('Terceiro valor: '))
# Verificação do menor numero
menor = num3
if num2 < num3 and num2 < num1:
menor = num2
if num1 < num3 and num1 < num2:
menor = num1
# verificação do maior numero
maior = num3
if num2 > num1 and nu... | 4.15625 | 4 |
compare_one_sr_alpha_mask.py | lmmx/emoji-liif | 1 | 12779253 | <gh_stars>1-10
from pathlib import Path
import sqlite3
import pandas as pd
from tqdm import tqdm
from sys import stderr
from imageio import imread, imwrite
import numpy as np
from skimage import transform as tf
from matplotlib import pyplot as plt
from transform_utils import scale_pixel_box_coordinates, crop_image
SAV... | 2.359375 | 2 |
clusterpy/core/data/spatialLag.py | CentroGeo/clusterpy_python3 | 48 | 12779254 | <reponame>CentroGeo/clusterpy_python3
# encoding: latin1
"""spatial lag of a variable
"""
__author__ = "<NAME>, <NAME>"
__credits__ = "Copyright (c) 2010-11 <NAME>"
__license__ = "New BSD License"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "<EMAIL>"
__all__ = ['spatialLag']
import numpy
def spati... | 3.015625 | 3 |
AI Project/Movielens Experiment/kmeans_weighted_average.py | anshikam/CSCE-625 | 0 | 12779255 | # -*- coding: utf-8 -*-
"""
A program that carries out mini batch k-means clustering on Movielens datatset"""
from __future__ import print_function, division, absolute_import, unicode_literals
from decimal import *
#other stuff we need to import
import csv
import numpy as np
from sklearn.cluster import ... | 3.0625 | 3 |
example/sales/models.py | browniebroke/django-admin-lightweight-date-hierarchy | 91 | 12779256 | from django.db import models
class Sale(models.Model):
created = models.DateTimeField()
def __str__(self):
return f'[{self.id}] {self.created:%Y-%m-%d}'
class SaleWithDrilldown(Sale):
"""
We will use this model in the admin to illustrate the difference
between date hierarchy with and wi... | 2.328125 | 2 |
libs/gym/tests/spaces/test_spaces.py | maxgold/icml22 | 0 | 12779257 | import json # note: ujson fails this test due to float equality
import copy
import numpy as np
import pytest
from gym.spaces import Tuple, Box, Discrete, MultiDiscrete, MultiBinary, Dict
@pytest.mark.parametrize(
"space",
[
Discrete(3),
Discrete(5, start=-2),
Box(low=0.0, high=np.in... | 2.28125 | 2 |
tests/integration_tests/tests/agentless_tests/policies/__init__.py | yeshess/cloudify-manager | 0 | 12779258 | ########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 1.8125 | 2 |
Cours 3 - Language Models/solutions/ngrams.py | AntoineSimoulin/m2-data-sciences | 7 | 12779259 | def sentence_2_n_grams(sentences, n=3, start_token='<s>', end_token='</s>'):
ngrams = []
for s in sentences:
tokens = [start_token] + s + [end_token]
ngrams += zip(*[tokens[i:] for i in range(n)])
return Counter([" ".join(ngram) for ngram in ngrams]) | 3.28125 | 3 |
src/niweb/apps/noclook/migrations/0009_auto_20190902_0759.py | SUNET/ni | 0 | 12779260 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-09-02 07:59
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.deletion
from apps.noclook.models import DEFAULT_ROLEGROUP_NAME, DEFAULT_ROLE_KEY, DEFAULT_ROLES
def init_default_roles(Role):
# and then get ... | 1.929688 | 2 |
03a_sec-dsrg/DSRG.py | lyndonchan/wsss-analysis | 47 | 12779261 | import numpy as np
import tensorflow as tf
from lib.crf import crf_inference
from lib.CC_labeling_8 import CC_lab
def single_generate_seed_step(params):
"""Implemented seeded region growing
Parameters
----------
params : 3-tuple of numpy 4D arrays
(tag) : numpy 4D array (size: B x 1 x 1 x C),... | 2.375 | 2 |
asv_oggm_plugin.py | skachuck/oggm | 156 | 12779262 | <reponame>skachuck/oggm
import subprocess
import requests
import tempfile
import os
import logging
from asv.plugins.conda import _find_conda, Conda
from asv.console import log
from asv import util
logging.getLogger("requests").setLevel(logging.WARNING)
OGGM_CONDA_ENV_URL = ("https://raw.githubusercontent.com/OGGM/"
... | 2.3125 | 2 |
src/fleets/water_heater_fleet/load_config.py | GMLC-1-4-2/battery_interface | 1 | 12779263 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 13:46:46 2019
Description:
Last update:
Version: 1.0
Author: <NAME> (NREL)
"""
import pandas as pd
class LoadConfig(object):
def __init__(self, config_file):
self.config_file = config_file
def str_to_bool(self, s):
if s == 'Tru... | 2.84375 | 3 |
test/utils_fetch_pytest.py | LaraFerCue/jail_manager | 1 | 12779264 | import os
import shutil
from pathlib import PosixPath
from tempfile import TemporaryDirectory, mkdtemp
from urllib.error import URLError
import pytest
from jmanager.models.distribution import Architecture, Version, VersionType, Component
from jmanager.utils.fetch import HTTPFetcher
from test.globals import TEST_DISTR... | 2.203125 | 2 |
Source/GUI_1/SimulatorGUI.py | pranavjain110/CarHealthMonitor | 1 | 12779265 | <gh_stars>1-10
from tkinter import *
from tkinter import ttk
import sender
window = Tk()
window.iconbitmap(r'carsensors.ico')
window.title("Car Health Monitor")
window.minsize(800, 600)
window.maxsize(800, 600)
window.configure(bg='black')
temp = 40
press = 35
oil_time_days = 0
tire_dist_kms = 0... | 2.828125 | 3 |
code/kuantum-komputers/randomp python shit.py | SoftwareCornwall/m2m-teams-july-2019 | 0 | 12779266 | <gh_stars>0
users = ["will", "ok", "roberto", "nou"]
LoggedIn=False
while not LoggedIn:
user = input("Username>> ")
for i in range(len(users)-1):
if user == users[i]:
password = input("Password>> ")
if password == users[i+1]:
print("Correct login details")
... | 3.796875 | 4 |
python/132_Palindrome_Partition_II.py | liaison/LeetCode | 17 | 12779267 | <filename>python/132_Palindrome_Partition_II.py
class Solution:
def minCut(self, s: str) -> int:
# element indicates the minimal number of partitions
# we need to divide the corresponding substring
dp = [0] * (len(s)+1)
for right in range(1, len(s)+1):
... | 3.390625 | 3 |
model_trainer/tf_logger.py | NeverendingNotification/nnlibs | 0 | 12779268 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 30 12:07:19 2018
@author: nn
"""
from collections import OrderedDict
import os
import cv2
from . import tf_metrics
def get_logger(arc_type, logger_params):
if arc_type == "sl":
logger = SlLogger(**logger_params)
elif arc_type == "ae":
... | 2.03125 | 2 |
utils/fortran_utils.py | IAEA-NDS/FENDL-Code | 1 | 12779269 | <gh_stars>1-10
from fortranformat import FortranRecordReader, FortranRecordWriter
from .generic_utils import flatten, static_vars
@static_vars(frr_cache={})
def fort_read(fobj, formatstr, none_as=None, varnames=None, debug=False):
"""Read from a file or string using a format descriptor
Keyword arguments:
... | 2.8125 | 3 |
tests/test_auth.py | ported-pw/asgi-webdav | 0 | 12779270 | from base64 import b64encode
import pytest
from asgi_webdav.constants import DAVPath, DAVUser
from asgi_webdav.config import update_config_from_obj, get_config
from asgi_webdav.auth import DAVPassword, DAVPasswordType, DAVAuth
from asgi_webdav.request import DAVRequest
USERNAME = "username"
PASSWORD = "password"
HAS... | 2.203125 | 2 |
examples/basic_bot.py | nkpro2000sr/discord-reargparse | 1 | 12779271 | <filename>examples/basic_bot.py
import discord
from discord.ext import commands
from discord_reargparse import *
import random
import shlex
description = "An example bot to showcase the discord_reargparse module."
bot = commands.Bot(command_prefix='?', description=description)
@bot.event
async def on_ready():
pr... | 3.296875 | 3 |
code/wheel_examples.py | garyjames/building-skills-oo-design-book | 32 | 12779272 | <filename>code/wheel_examples.py
"""
Building Skills in Object-Oriented Design V4
Wheel Examples
"""
from typing import List, Any
import random
Bin = Any
class Wheel_RNG:
def __init__(self, bins: List[Bin], rng: random.Random=None) -> None:
self.bins = bins
self.rng = rng or random.Random()
... | 3.703125 | 4 |
evaluate.py | sYeaLumin/SketchGNN | 11 | 12779273 | import os
import ndjson
import json
import time
from options import TestOptions
from framework import SketchModel
from utils import load_data
from writer import Writer
import numpy as np
from evalTool import *
def run_eval(opt=None, model=None, loader=None, dataset='test', write_result=False):
if opt is None:
... | 2.125 | 2 |
tests/modeling/test_split_modeled_energy_trace.py | tsennott/eemeter | 0 | 12779274 | <reponame>tsennott/eemeter
import tempfile
from datetime import datetime
import pandas as pd
import numpy as np
from numpy.testing import assert_allclose
import pytest
import pytz
from eemeter.modeling.formatters import ModelDataFormatter
from eemeter.modeling.models.seasonal import SeasonalElasticNetCVModel
from eem... | 2.140625 | 2 |
AutoApiTest/apps.py | github-xiaoh/httpRunnerManager | 1 | 12779275 | <reponame>github-xiaoh/httpRunnerManager
from django.apps import AppConfig
class AutoapitestConfig(AppConfig):
name = 'AutoApiTest'
| 1.257813 | 1 |
2020/day6/1.py | darkterbear/advent-of-code-2015 | 0 | 12779276 | import re
file = open('./input', 'r')
lines = file.readlines()
lines = list(map(lambda line: line[:-1], lines))
sum = 0
exists = set()
for line in lines:
if len(line) == 0:
sum += len(exists)
exists = set()
else:
for c in line:
exists.add(c)
print(sum) | 3.609375 | 4 |
efficientdet/test_now.py | Rambledeng/automl | 0 | 12779277 | <reponame>Rambledeng/automl
import os
import sys
import tensorflow.compat.v1 as tf
import PIL
import os
import wget
def download(m):
if m not in os.listdir():
# !wget https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco/{m}.tar.gz
dl_url = 'https://storage.googleapis.com/cloud-tpu-checkpoi... | 2.625 | 3 |
application/response/LinearClassifier.py | librairy/explainable-qa | 1 | 12779278 | <reponame>librairy/explainable-qa
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 25 12:54:44 2021
@author: cbadenes
"""
import logging
import os
import pandas
import joblib
import spacy
from time import time
from scipy.sparse import csr_matrix
from sklearn.naive_bayes import GaussianNB
from sk... | 2.640625 | 3 |
bot/python/handlers/message_handlers.py | darrso/parse_channels | 0 | 12779279 | import sys
import time
import aiogram.types
from aiogram import types, Dispatcher, Bot
from aiogram.dispatcher import FSMContext
sys.path.append('bot')
from database.sess import get_users_by_link
from database.sess import create_new_user, check_on_off, switch_on_off, check_parse_channels, check_channel, \
add_chann... | 2.421875 | 2 |
art-generator/genius.py | GFX-Automated/GFX | 0 | 12779280 | <filename>art-generator/genius.py
#!/bin/bash/python3.8
import os
import lyricsgenius as genius
credentials = {
"id": "",
"secret": "",
"access_token": "",
}
os.environ["GENIUS_ACCESS_TOKEN"] = credentials["access_token"]
GENIUS_ACCESS_TOKEN
| 1.6875 | 2 |
CommandLineCalculator.py | CoderDuino/CommandLineCalculator | 0 | 12779281 | import time
def is_number(s):
try:
float(s)
return True
except ValueError:
pass
return False
def ValidateInput(equation):
if len(equation) != 3:
return False
if not (is_number(equation[0]) and is_number(equation[2])):
return False
if not equation[1] in... | 4 | 4 |
HW Tasks/hw6.py | bzhumakova/FirstProject | 2 | 12779282 | # Дан список обьектов спам-писем пришедших на почту. С помощью метода split найти слово
# которое повторяется в списке больше всего (напомню что split возвращает из строки – список).
# Найденное слово сохранить в переменную.
# Далее на вход подается единственная строка – нужно проверить спам это или нет
data = [
{... | 3.5625 | 4 |
00_Code/01_LeetCode/590_N-aryTreePostorderTraversal.py | KartikKannapur/Data_Structures_and_Algorithms_Python | 1 | 12779283 | """
Given an n-ary tree, return the postorder traversal of its nodes' values.
For example, given a 3-ary tree:
Return its postorder traversal as: [5,6,3,2,4,1].
"""
"""
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
... | 4.09375 | 4 |
losses.py | Liut2016/ecg-supcontrast | 2 | 12779284 | """
Author: <NAME> (<EMAIL>)
Date: May 07, 2020
"""
from __future__ import print_function
import torch
import torch.nn as nn
import numpy as np
from itertools import combinations
class SupConLoss(nn.Module):
"""Supervised Contrastive Learning: https://arxiv.org/pdf/2004.11362.pdf.
It also supports the unsuper... | 2.78125 | 3 |
tests/test_helper_node.py | GNaive/naive-rete | 54 | 12779285 | # -*- coding: utf-8 -*-
from rete import Has, Filter, Rule
from rete.common import WME, Bind
from rete.network import Network
def test_filter_compare():
net = Network()
c0 = Has('spu:1', 'price', '$x')
f0 = Filter('$x>100')
f1 = Filter('$x<200')
f2 = Filter('$x>200 and $x<400')
f3 = Filter('$x... | 2.078125 | 2 |
util/util.py | VMReyes/keypointgan | 11 | 12779286 | from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
import time
# Converts a Tensor into an image array (numpy)
# |imtype|: the desired type of the converted numpy array
def tensor2im(input_image, imtype=np.uint8):
if isinstance(input_image, torch.Tensor):
... | 2.71875 | 3 |
gradertools/isolation/isolate_simple.py | david58/gradertools | 0 | 12779287 | import subprocess
import shutil
import os
import time
from .interface import IsolateInterface
class IsolateSimple(IsolateInterface):
def isolate(self, files, command, parameters, envvariables, directories, allowmultiprocess, stdinfile, stdoutfile):
if os.path.isdir("/tmp/gradertools/isolation/"):
... | 2.390625 | 2 |
apps/common/api/exceptions.py | YC-Cheung/hattori | 1 | 12779288 | from rest_framework import status
class APIException(Exception):
"""
通用 API 异常
"""
def __init__(self, message='', code=4999, status_code=status.HTTP_400_BAD_REQUEST):
self.message = message
self.code = code
self.status_code = status_code
@property
def data(self):
... | 2.609375 | 3 |
main_tts.py | archity/rg_text_to_sound | 1 | 12779289 | import os, sys
sys.path.append( os.path.join(os.path.dirname(os.path.abspath(__file__)),'tts_websocketserver','src') )
from tts_websocketserver.tts_server import run
if __name__ == '__main__':
run() | 1.65625 | 2 |
libs/visualization/vis.py | FullStackD3vs/Detectron-PYTORCH | 37 | 12779290 | <reponame>FullStackD3vs/Detectron-PYTORCH<gh_stars>10-100
import cv2
import numpy as np
import PIL.ImageColor as ImageColor
STANDARD_COLORS = [
'AliceBlue', 'Chartreuse', 'Aqua', 'Aquamarine', 'Azure', 'Crimson',
'BlanchedAlmond', 'BlueViolet', 'BurlyWood', 'CadetBlue', 'AntiqueWhite',
'Chocolate', 'Misty... | 1.96875 | 2 |
tests/utils.py | rolandmueller/rita-dsl | 0 | 12779291 | import re
import pytest
import rita
def load_rules(rules_path):
with open(rules_path, "r") as f:
return f.read()
def spacy_engine(rules, **kwargs):
spacy = pytest.importorskip("spacy", minversion="2.1")
patterns = rita.compile_string(rules, **kwargs)
nlp = spacy.load("en")
ruler = spacy... | 2.265625 | 2 |
clash/fastest/fast-clash1.py | a93-git/codingame-solutions | 0 | 12779292 | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = int(input())
w = input()
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr)
for i in range(n):
print(w) | 3.578125 | 4 |
mlcomp/parallelm/components/external_component.py | lisapm/mlpiper | 7 | 12779293 | """
This file in intended to be used by external component that can use python (like R + reticulate).
This will be a single place needed to be imported (thus the short name) in order to get the api functions to
work with connected components, and possibly more in the future.
"""
from parallelm.common.singleton import ... | 1.804688 | 2 |
src/main-gui.py | FlingJLJ/ThrowawayNameGenerator | 0 | 12779294 | import generator
from tkinter import Tk
| 1.21875 | 1 |
sailenv/dynamics/uniform_movement_random_bounce.py | sailab-code/SAILenv | 0 | 12779295 | from dataclasses import dataclass
from sailenv import Vector3
from sailenv.dynamics import Dynamic
@dataclass
class UniformMovementRandomBounce(Dynamic):
start_direction: Vector3 = Vector3(0, 0, 1)
speed: float = 5
angular_speed: float = 2
seed: int = 42
@staticmethod
def get_type():
... | 2.921875 | 3 |
tests/unit/compress/CompressCssCompiler.py | wangjeaf/CSSCheckStyle | 21 | 12779296 | from helper import *
def doTest():
_no_space()
_has_space()
_just_prefix()
def _no_space():
msg = doCssCompress('@-css-compiler{selector-compile:no-combinator;rule-compile:all}html{width:100px;}')
equal(msg, 'html{width:100px}', '@css-compiler compressed')
def _has_space():
msg = doCssCompres... | 2.328125 | 2 |
features/bvp_features.py | anascacais/MLB-P5-P6 | 0 | 12779297 | <filename>features/bvp_features.py<gh_stars>0
# built-in
import json
import os
# third-party
import numpy as np
# local
from biosppy import utils
from biosppy import ppg
from biosppy import tools as st
from . import statistic_features, hrv_features
def bvp_features(signal=None, sampling_rate=1000.):
""" Comput... | 2.390625 | 2 |
main/views.py | ArighnaIITG/NoDues-Portal | 0 | 12779298 | <filename>main/views.py
from django.http import HttpResponse
from django.template import loader
from .models import *
from django.contrib.auth import authenticate, login
from django.contrib.auth import logout
from django.http import JsonResponse
from django.shortcuts import render, get_object_or_404, redirect, HttpResp... | 2.21875 | 2 |
pdpy/core.py | olihawkins/pdpy | 13 | 12779299 | # -*- coding: utf-8 -*-
"""Core download functions."""
# Imports ---------------------------------------------------------------------
import datetime
import json
import numpy as np
import pandas as pd
import requests
from . import constants
from . import errors
from . import settings
# Functions -----------------... | 3.40625 | 3 |
wavelet_product_edge_detector.py | ryagi97/wavelet-product-edge-detection | 0 | 12779300 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 14 09:10:29 2021
Author: <NAME>
Functions for implementing the edge detection scheme first proposed by Zhang and Bao [1].
Modified for use with pywt's SWT2 transform and employs double thresholding similar to canny to improve noise resilience and revovery of wea... | 3.078125 | 3 |
flaskr/blog.py | LSWarss/Flask-Blog-App | 1 | 12779301 | from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from werkzeug.exceptions import abort
from flask_login import login_required, current_user
from flaskr.models import Post, db, PostComment, User
from flaskr import csrf
blog = Blueprint('blog', __name__)
@blog.route('/')
def i... | 2.375 | 2 |
pyvmodule/tools/modules/amba/axi/axi2ram.py | tanhongze/pyvmodule | 0 | 12779302 | from pyvmodule.develope import *
from pyvmodule.tools.modules.sram.dual import SRamR,SRamW
from pyvmodule.tools.modules.fifo import Fifo
from .common import AxiComponent,update_data_burst_addr,compute_address
class Axi2RamR(SRamR):
class FifoAR(Fifo):
def update_data_araddr(self,field):
return u... | 2.46875 | 2 |
bankManage/backEndService/test.py | ShangziXue/A-simple-bank-system | 0 | 12779303 | <reponame>ShangziXue/A-simple-bank-system
from flask import Flask
from flask import request
from flask import jsonify
from flask import make_response
from flask_cors import *
import json
import time
app = Flask(__name__)
CORS(app, supports_credentials=True)
#=========================================================... | 2.984375 | 3 |
server01.py | maysrp/ESP32-monitor | 0 | 12779304 | <reponame>maysrp/ESP32-monitor<filename>server01.py
import psutil
import serial
import time
import requests
uid="1369152"
ser=serial.Serial("com3",115200,timeout=0.5)
url="http://api.bilibili.com/x/relation/stat?vmid="+uid
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHT... | 2.328125 | 2 |
ics/icalendar.py | tomschr/ics.py | 0 | 12779305 | from typing import Dict, Iterable, List, Optional, Union
import attr
from attr.validators import instance_of
from ics.component import Component
from ics.event import Event
from ics.grammar.parse import Container, calendar_string_to_containers
from ics.parsers.icalendar_parser import CalendarParser
from ics.serialize... | 2.390625 | 2 |
secret/tests/test_utils.py | MinisterioPublicoRJ/apilabcontas | 2 | 12779306 | from unittest import TestCase
from freezegun import freeze_time
from secret.utils import create_secret
class Utils(TestCase):
@freeze_time('2019-03-12 12:00:00')
def test_create_secret_key(self):
secret = create_secret()
self.assertEqual(secret, 'd3a4646728a9de9a74d8fc4c41966a42')
| 2.71875 | 3 |
tests/test_utils.py | cyan-at/cq-cam | 7 | 12779307 | import unittest
from typing import List
import cadquery as cq
from cq_cam.utils import utils
class ProjectFaceTest(unittest.TestCase):
def setUp(self):
pass
def test_face_with_hole(self):
# This should create a projected face that is 2x4 (XY)
box = (
cq.Workplane('XZ')
... | 2.671875 | 3 |
secretsharing/charset.py | ml31415/secret-sharing | 0 | 12779308 | <gh_stars>0
from six import integer_types
def int_to_charset(x, charset):
""" Turn a non-negative integer into a string.
"""
if not (isinstance(x, integer_types) and x >= 0):
raise ValueError("x must be a non-negative integer.")
if x == 0:
return charset[0]
output = ""
while x ... | 3.875 | 4 |
scripts/generate-database-data.py | Crown-Commercial-Service/digitalmarketplace-scripts | 1 | 12779309 | <filename>scripts/generate-database-data.py
#!/usr/bin/env python3
"""
N.B.: this is a work in progress with only few steps implemented.
The aim is to populate your local database with enough randomly generated data to run the DMp using the API.
Usage:
./scripts/generate-database-data.py
"""
import sys
from docopt im... | 2.640625 | 3 |
main.py | QIN2DIM/armour-email | 6 | 12779310 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Time : 2021/12/16 16:28
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description: SSPanel-Uim 邮箱验证案例
# ==============================================
# TODO [√]用于项目演示的运行实例,(也许)需要使用代理
# ==============================================
# - `anti_email` 表... | 1.804688 | 2 |
src/class_namespaces/__init__.py | mwchase/class-namespace | 1 | 12779311 | """Class Namespaces.
Class namespaces implemented using metaclasses and context managers.
Classes that contain namespaces need to have NamespaceableMeta as a metaclass.
Namespaces are context managers within a class definition. They can be
manipulated after they're defined.
"""
from . import namespaces
Namespaceabl... | 2.484375 | 2 |
utils/LSL_Tests/SendSphericalData.py | xfleckx/BeMoBI_Tools | 0 | 12779312 | <reponame>xfleckx/BeMoBI_Tools
import sys
sys.path.append('./pylsl') # help python find pylsl relative to this example program
from pylsl import StreamInfo, StreamOutlet
import random
import time
import math
#Send spherical coordinats
info = StreamInfo('RandomSpehricalData','3DCoord',3,100,'float32','myuid34234')
# ... | 2.53125 | 3 |
dockerfiles/examples/read-bytes-seed/scale-job.py | kaydoh/scale | 121 | 12779313 | <gh_stars>100-1000
import argparse
import datetime
import json
import logging
import sys
import os
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s',
level=logging.DEBUG, stream=sys.stdout)
def run_algorithm(bytes_total, input_file, out_dir):
"""Read the indicated number ... | 2.40625 | 2 |
phy/gui/tests/test_gui.py | m-beau/phy | 0 | 12779314 | # -*- coding: utf-8 -*-
"""Test gui."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
from pytest import raises
from ..qt import Qt, QApplication, QWidget, QMessageBox
from ..gui import (GUI, ... | 2.09375 | 2 |
elm/model/gconv_vae.py | jinxu06/gsubsampling | 12 | 12779315 | import os
import sys
from collections import OrderedDict
from absl import logging
import torch
import torch.nn.functional as F
import torch.optim as optim
import torchvision.transforms.functional as TF
import pytorch_lightning as pl
import e2cnn.gspaces
import e2cnn.nn
from .base import VariationalAutoEncoderModule
fro... | 2.015625 | 2 |
code/oldtmpcodes/biasplay.py | modichirag/21cmhod | 0 | 12779316 | <filename>code/oldtmpcodes/biasplay.py
import numpy as np
from pmesh.pm import ParticleMesh
from nbodykit.lab import BigFileCatalog, BigFileMesh, FFTPower
from nbodykit.source.mesh.field import FieldMesh
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
#
import sys
sys.path.append('./utils')
import tools, doho... | 1.773438 | 2 |
error404detector/crawlertest.py | hayj/404Detector | 0 | 12779317 | from webcrawler.crawler import *
def crawlingCallback(data, browser=None):
print(data)
crawler = Crawler\
(
["https://github.com/hayj/WebCrawler"],
crawlingCallback=crawlingCallback,
browsersDriverType=DRIVER_TYPE.chrome,
proxies=getAllProxies(),
browserCount=10,
stopCrawlerAfterSeconds=10... | 2.453125 | 2 |
ftprelayer/__init__.py | meteogrid/FTPRelayer | 0 | 12779318 | <reponame>meteogrid/FTPRelayer<filename>ftprelayer/__init__.py
import re
import sys
import datetime
import os
import logging
import shutil
from threading import Thread, Event
from fnmatch import fnmatchcase
import zipfile
from logging import Formatter
try:
import queue
from io import BytesIO
except ImportError:... | 1.867188 | 2 |
bayleef/utils.py | Kelvinrr/bayleef | 1 | 12779319 | <filename>bayleef/utils.py
import json
import os
import re
import subprocess
import sys
from datetime import datetime
from functools import partial, reduce
from glob import glob
from subprocess import PIPE, Popen
import yaml
import gdal
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pli... | 1.976563 | 2 |
graph-db/extractor/src/ncbi/taxonomy_LMDB_annotation.py | SBRG/lifelike | 8 | 12779320 | from ncbi.ncbi_taxonomy_parser import TaxonomyParser, Taxonomy
from common.database import *
from common.utils import get_data_dir
import os
# default strain for their species for organism searching
LMDB_SPECIES_MAPPING_STRAIN = ['367830','511145', '272563', '208964', '559292']
DATA_SOURCE = 'NCBI Taxonomy'
def write... | 2.21875 | 2 |
parse/parse_uniprot_header.py | Hua-CM/HuaSmallTools | 21 | 12779321 | # -*- coding: utf-8 -*-
# @Time : 2020/11/15 13:49
# @Author : <NAME>
# @FileName: parse_uniprot_header.py
# @Usage:
# @Note:
# @E-mail: <EMAIL>
import pandas as pd
import re
class UniprotParse:
def __init__(self, _input_fasta):
self.input = _input_fasta
self.output = None
def parse(self):
... | 3.015625 | 3 |
migrations/versions/da6f10c8ebf4_add_site_airtable.py | bwlynch/FbScraper | 10 | 12779322 | """add site airtable
Revision ID: da6f10c8ebf4
Revises: 9<PASSWORD>e<PASSWORD>
Create Date: 2019-11-29 07:48:18.074193
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "da6f10c8ebf4"
down_revision = "aaae4ae18288"
branch_labels = None
depends_on = None
def upg... | 1.773438 | 2 |
xrspatial/tests/test_curvature.py | brendancol/xarray-spatial | 0 | 12779323 | import pytest
import numpy as np
import xarray as xr
import dask.array as da
from xrspatial import curvature
from xrspatial.utils import doesnt_have_cuda
from xrspatial.tests.general_checks import general_output_checks
elevation = np.asarray([
[np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
... | 2.125 | 2 |
rfapi/auth.py | cestrada-rf/rfapi-python | 32 | 12779324 | # Copyright 2016 Recorded Future, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 2.328125 | 2 |
genoplot/genoplot.py | ddnewell/genoplot | 0 | 12779325 | <reponame>ddnewell/genoplot
# Copyright (c) 2016 by Welded Anvil Technologies (<NAME>). All Rights Reserved.
# This software is the confidential and proprietary information of
# Welded Anvil Technologies (<NAME>) ("Confidential Information").
# You shall not disclose such Confidential Information and shall use it
# onl... | 2.546875 | 3 |
examples/notebooks/test_notebooks.py | mjc87/SHTOOLS | 251 | 12779326 | #!/usr/bin/env python3
"""
This script will run all jupyter notebooks in order to test for errors.
"""
import sys
import os
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
if os.path.dirname(sys.argv[0]) != '':
os.chdir(os.path.dirname(sys.argv[0]))
notebooks = ('grids-and-coefficients.ipy... | 2.4375 | 2 |
test/testDenseFactorization.py | TtheBC01/pEigen | 0 | 12779327 | import unittest
import sys
sys.path.append('/pEigen/src/peigen')
import libpeigen as peigen
class DenseFactorizationTest(unittest.TestCase):
def setUp(self):
self.rows = 1000
self.cols = 1000
self.dense_matrix = peigen.denseMatrixDouble(self.rows, self.cols)
self.dense_matr... | 2.671875 | 3 |
tests/unit/asn/test_brcreateasncommand.py | ivcmartello/registrobrepp | 0 | 12779328 | <gh_stars>0
import pytest
from eppy.doc import EppResponse
from lxml import etree
from registrobrepp.asn.brcreateasncommand import BrEppCreateAsnCommand
from registrobrepp.asn.contactasn import ContactAsn
class TestBrCreateAsnCommand:
@pytest.fixture
def createasncommand(self):
number = 12345
... | 1.960938 | 2 |
main.py | FDMZ17/log4j-test | 0 | 12779329 | <reponame>FDMZ17/log4j-test<gh_stars>0
from flask import Flask
app = Flask(__name__)
@app.route("/exploit.java")
def exploit():
return open("exploit.java").read()
app.run(port=8080) | 1.953125 | 2 |
date_sorter/main.py | ImTheSquid/Image-Dupicate-Detector | 2 | 12779330 | <gh_stars>1-10
import os
import shutil
from datetime import datetime
from os.path import basename, join
from pathlib import Path
from PIL import Image, ExifTags
from PyQt5.QtCore import pyqtSignal, QThreadPool, Qt
from PyQt5.QtWidgets import QWidget, QGroupBox, QVBoxLayout, QProgressBar, QLabel, QHBoxLayout, QLineEdit... | 2.46875 | 2 |
forms/file_metadata_form.py | dvrpc/tmc-uploader | 0 | 12779331 | <gh_stars>0
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextField, IntegerField, FloatField
class UpdateMetadataForm(FlaskForm):
title = StringField("Title")
model_id = StringField("model ID")
lat = FloatField("lat")
lng = FloatField("lng")
legs = TextField("legs... | 2.4375 | 2 |
efb/terminal.py | dorpvom/efb | 0 | 12779332 | from typing import Optional
from prompt_toolkit import PromptSession
from prompt_toolkit import print_formatted_text as print_
from efb.validator import YesNoValidator
SESSION = PromptSession()
def make_decision(question: str, default: Optional[bool] = None) -> bool:
default_string = f'(default {"y" if default... | 3.0625 | 3 |
pynrc/psfs.py | kammerje/pynrc | 1 | 12779333 | <reponame>kammerje/pynrc
from __future__ import absolute_import, division, print_function, unicode_literals
# The six library is useful for Python 2 and 3 compatibility
import six, os
# Import libraries
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import datetime, time
import sys, platform
im... | 1.765625 | 2 |
madgrad/mirror_madgrad.py | haresh121/madgrad | 0 | 12779334 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.optim
import math
from typing import TYPE_CHECKING, Any, Callable, Optional
if TYPE_CHECKING:
fro... | 2.28125 | 2 |
src/video_popup.py | OdatNurd/OdatNurdTestPackage | 1 | 12779335 | import sublime
import sublime_plugin
###----------------------------------------------------------------------------
_video_popup = """
<body id="youtubeeditor-video-details">
<style>
body {{
font-family: system;
margin: 0.5rem 1rem;
width: 40em;
}}
h1... | 2.203125 | 2 |
tests/flow/pipeline/conftest.py | mpearmain/forml | 0 | 12779336 | <gh_stars>0
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | 1.84375 | 2 |
app_blog/controllers/article_controller.py | DubstepWar/flask-blog-test | 0 | 12779337 | <gh_stars>0
from flask import Blueprint, jsonify, request
from flask_jwt import jwt_required
from marshmallow import ValidationError
from app_blog.extensions import db
from app_blog.models import Article
from app_blog.models.article import article_schema, articles_schema
from app_blog.services.article_service import a... | 2.390625 | 2 |
src/networks/main.py | LukasKratochvila/Deep-SVDD-PyTorch | 0 | 12779338 | from .mnist_LeNet import MNIST_LeNet, MNIST_LeNet_Autoencoder
from .cifar10_LeNet import CIFAR10_LeNet, CIFAR10_LeNet_Autoencoder
from .cifar10_LeNet_elu import CIFAR10_LeNet_ELU, CIFAR10_LeNet_ELU_Autoencoder
from .my_LeNet import MY_LeNet, MY_LeNet_Autoencoder
from .my_LeNet_480x480 import MY_LeNet_480, MY_LeNet_480... | 2.546875 | 3 |
3.Object.Oriented.Programming/7.magicMethods.py | bhattvishal/programming-learning-python | 1 | 12779339 | class Book:
def __init__(self, title, price, author):
super().__init__()
self.title = title
self.price = price
self.author = author
# Magic Methods
# use __str__ to writtren the string representation
def __str__(self):
return f"{self.title} is writt... | 3.828125 | 4 |
test.py | Mirorrn/Spline-Lane-Detection | 1 | 12779340 |
import os
path = os.getcwd()
from cu__grid_cell.data_gen import data_gen
from cu__grid_cell.preparation import preparation
import numpy as np
from cu__grid_cell.Validation.validation_utils import plot_image, grid_based_eval_with_iou, plot_image3d, nms, concatenate_cells
import matplotlib.pyplot as plt
import cv2
d... | 2.171875 | 2 |
app/models/attribute.py | Maxcutex/personal_ecommerce | 0 | 12779341 | """module of attribute model class"""
from .base_model import BaseModel, db
class Attribute(BaseModel):
"""attribute Model class"""
__tablename__ = 'attribute'
attribute_id = db.Column(db.Integer(), primary_key=True)
name = db.Column(db.String(100), nullable=False)
def __str__(self):
ret... | 2.90625 | 3 |
db_logic.py | apie/seriesbot | 0 | 12779342 | <filename>db_logic.py
#!/usr/bin/env python3
import os
from pydblite import Base
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
show_db = Base(os.path.join(SCRIPT_DIR, 'show.db'))
show_db.create('show_id', 'name', 'latest_ep_id', mode="open")
ep_db = Base(os.path.join(SCRIPT_DIR, 'episode.db'))
ep_db.crea... | 2.328125 | 2 |
cloudkittyclient/v1/info_cli.py | NeCTAR-RC/python-cloudkittyclient | 19 | 12779343 | <reponame>NeCTAR-RC/python-cloudkittyclient
# -*- coding: utf-8 -*-
# Copyright 2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses... | 2.3125 | 2 |
account/exceptions.py | KimSoungRyoul/drf_unitteset_study_project | 0 | 12779344 | from rest_framework.exceptions import NotAuthenticated as DRFNotAuthenticated
class NotAuthentication(DRFNotAuthenticated):
default_detail = '인증 되지 않은 사용자입니다.'
| 1.890625 | 2 |
backend/api/resources/pedidos_resource.py | jklemm/menu-fullstack-challenge | 0 | 12779345 | import json
import falcon
from api.resources import BaseResource
from core.pedidos.exceptions import PedidoNotFoundException
from core.pedidos.gateway import PedidoGateway
class PedidosResource(BaseResource):
def on_get(self, req, resp, pedido_id=None):
pedido_gateway = PedidoGateway(self.db.session)
... | 2.234375 | 2 |
edge/wiotp/netspeed2wiotp/mqtt_pub.py | alexzinovyev-intensivate/examples | 34 | 12779346 | import time
import string
import json
import sys
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
from workload_config import * # Read configuration
import utils # Utilities file in this dir (utils.py)
def post_networkdata_single_wiotp(jsonpayload, event_id, heart_beat=False)... | 2.640625 | 3 |
myprodigy/urls.py | acdh-oeaw/nerdpool | 0 | 12779347 | # generated by appcreator
from django.conf.urls import url
from . import views, api_views
app_name = 'myprodigy'
urlpatterns = [
url(
r'^annotator/detail/(?P<pk>[0-9]+)$',
views.UserDetailView.as_view(),
name='user_detail'
),
url(
r'^nerdataset/$',
views.NerDataSetLi... | 1.929688 | 2 |
python/shared/research_pacs/shared/util.py | aws-samples/research-pacs-on-aws | 13 | 12779348 | <filename>python/shared/research_pacs/shared/util.py<gh_stars>10-100
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import json
import os
import re
import logging
import signal
from threading import Event
import boto3
import yaml
logger = logging.getLogger(__nam... | 2.28125 | 2 |
zerver/tests/test_management_commands.py | Frouk/zulip | 0 | 12779349 | <reponame>Frouk/zulip
# -*- coding: utf-8 -*-
import os
from mock import patch
from django.test import TestCase
from django.conf import settings
from django.core.management import call_command
class TestSendWebhookFixtureMessage(TestCase):
COMMAND_NAME = 'send_webhook_fixture_message'
def setUp(self):
... | 2.140625 | 2 |
Report2/Code/getDAWNData.py | cvanoort/USDrugUseAnalysis | 0 | 12779350 | import csv
import gc
# A small function for grabbing data from a list of dictionaries based on a shared key
def countKey(key,listDataDicts):
outDict = {}
for row in listDataDicts:
try:
outDict[row[key]] += 1
except KeyError:
outDict[row[key]] = 1
return outDict
al... | 2.953125 | 3 |