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 |
|---|---|---|---|---|---|---|
nowcast/figures/research/tracer_thalweg_and_surface_hourly.py | SalishSeaCast/SalishSeaNowcast | 4 | 50200 | # Copyright 2013-2021 The Salish Sea MEOPAR contributors
# and The University of British Columbia
#
# 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
#
# https://www.apache.org/licenses/... | 1.40625 | 1 |
cru/cru.py | izhujiang/igsnrr | 0 | 50201 | <filename>cru/cru.py
from netCDF4 import Dataset
from datetime import date, timedelta
import numpy as np
def CalculateYearValues(srcPath, destPath, ele):
# read and caculate average
scr_root_grp = Dataset(srcPath)
src_val = scr_root_grp.variables[ele]
years = int(len(src_val) / 12);
rootgrp = Crea... | 2.609375 | 3 |
src/KnnV2.py | ClementLancien/machineLearning | 0 | 50202 | #!/usr/bin/env python 3.6
# -*- coding: utf-8 -*-
"""
Created on Saturdau Sep 16 16:58:58 2017
@author: Hans - Clément - Ali
"""
#----------Import_module-----------
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.model_selection impo... | 2.765625 | 3 |
filtering-and-analysis/Python/stack-usage.py | sola-st/WasmBench | 15 | 50203 | <filename>filtering-and-analysis/Python/stack-usage.py
#!/usr/bin/env python3
import json
from collections import Counter
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import figure_tools as ft
from print_distribution import print_distribution
print('Loading data...'... | 2.4375 | 2 |
venv/lib/python3.6/site-packages/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/snmp_server/snmp_server.py | usegalaxy-no/usegalaxy | 1 | 50204 | # -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
"""
The iosxr snmp_server fact class
It is in this file the configuration is collected ... | 1.953125 | 2 |
LaneFinder.py | eloso42/CarND-Advanced-Lane-Lines | 0 | 50205 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import cv2
import Line
# source and destination for perspective transform
src = np.float32([[200, 719], [588, 454], [692, 454], [1100, 719]])
dst = np.float32([[300, 719], [300, 0], [1000, 0], [1000, 719]])
"""
Finding Lanes
"""
class LaneFinder:
def __... | 2.921875 | 3 |
python-scripts/contours/Generalize-orienteering-contours.py | JiriVales/orienteering-tools | 5 | 50206 | <gh_stars>1-10
##Generalize orienteering contours=name
##maximumdistancebetweentheoriginalandthesimplifiedcurvedouglaspeuckeralgorithm=number4
##contours=vector
##min=string37
##generalizecontours=output vector
outputs_QGISFIELDCALCULATOR_1=processing.runalg('qgis:fieldcalculator', contours,'length',0,10.0,2.0,True,'ro... | 1.960938 | 2 |
Scripts/Games/FirstPersonWalker.py | SeboTime/Sebo-Dos | 1 | 50207 | <reponame>SeboTime/Sebo-Dos<gh_stars>1-10
import imp
from os import system
import platform
import os
print("")
if platform.system() == "Windows":
os.system("py Scripts/Games/FirstPersonWalker/Install.py")
else:
print("Your system doesn't support this game!") | 2.5 | 2 |
demixr/train.py | Marc-Demoustier/demixr | 4 | 50208 | <filename>demixr/train.py
from tqdm import tqdm
import argparse
import matplotlib as plt
import numpy as np
import metrics
import utils
from dataset import create_dataloaders
from pathlib import Path
import torch
from torchmetrics.functional import si_sdr
import torch.optim as optim
class Trainer:
def __init__(... | 2.46875 | 2 |
src/iteration.py | kylerlmy/pythonpractice | 0 | 50209 | <reponame>kylerlmy/pythonpractice
L=[1,2,3]
it=iter(L)
print("The Iteration:{}".format(it))
print("item is:{}".format(it.__next__()))
print("item is:{}".format(next(it)))
print("item is:{}".format(next(it)))
print("item is:{}".format(next(it)))
# 在代码段 for X in Y 中,Y必须是个迭代器或者可以通过使用 iter() 创建迭代器的一些对象
obj=(12,34)
fo... | 4.46875 | 4 |
fullstack/management/commands/bootstrap_from_api.py | TylerFisher/full-stack-react | 9 | 50210 | import csv
import os
import requests
import us
from datetime import datetime
from django.core.management.base import BaseCommand
from django.contrib.humanize.templatetags.humanize import ordinal
from fullstack.models import (
Body,
Division,
DivisionLevel,
Office,
Officeholder,
Party,
Perso... | 2.109375 | 2 |
tester.py | Edrig/CircuitPython_TB6612FNG | 0 | 50211 | <gh_stars>0
from time import sleep as delay
import fng
m1 = fng.Fng(board.ENA, board.IN1, board.IN2)
m1 = fng.Fng(board.ENB, board.IN3, board.IN4)
m1.write(0, 'cw')
m2.write(0, 'cw')
delay(1)
m1.write(300, 'cw')
delay(2)
m2.write(300, 'cw')
delay(2)
m1.write(0, 'cw')
m2.write(0, 'cw')
delay(1)
m1.write(300, 'ccw')
... | 1.921875 | 2 |
tests/test_file_list.py | mikegribov/filedjson | 0 | 50212 | <reponame>mikegribov/filedjson
import os
from ..xjson.file_list import FileList, F_FILE_NOT_FOUND
from ..xjson.exceptions.file_exceptions import FileNotFoundException, IsNotFileException
def test_file_caching():
file_list = FileList()
file_list.clear()
fn = os.path.join("examples", "single_file_... | 2.453125 | 2 |
configs/_base_/models/bisenetv1_r18.py | Jun-jieChen/real-time-segmentation | 1 | 50213 | <filename>configs/_base_/models/bisenetv1_r18.py
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
# norm_cfg = dict(type='BN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained='open-mmlab://resnet18_v1c',
backbone=dict(
type='BiseNetV1',
base_model='ResN... | 1.640625 | 2 |
backend/app/auth/__init__.py | bcbecker/Datta-Dashboard | 0 | 50214 | <filename>backend/app/auth/__init__.py
#For packaging
'''
Users api handles JWT auth for users
'''
| 1.078125 | 1 |
incidentreporter/ext/config.py | incident-reporter/incident-reporter | 0 | 50215 | <reponame>incident-reporter/incident-reporter
import datetime
from typing import Optional
import discord
from discord.ext import commands
from ..storage import Storage
from ..util import is_staff
class Config(commands.Cog):
@commands.command(help='Change the prefix of the bot.')
@commands.has_permissions(m... | 2.4375 | 2 |
app/__init__.py | Abdulrahmannaser/QRC_generator | 0 | 50216 | <filename>app/__init__.py
import logging
import os
from flask import Flask, request, current_app
from flask_sqlalchemy import SQLAlchemy
from config import Config
db = SQLAlchemy()
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(config_class)
db.init_app(app)
from ... | 2.265625 | 2 |
utils/audio_vary2.py | StuartIanNaylor/g-kws | 9 | 50217 | import sox
import numpy as np
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("--input", help="input file name")
args = parser.parse_args()
print(args.input)
np1 = np.arange(start=-1.0, stop=1.1, step=0.10)
np2 = np.arange(start=0.9, stop=1.11, step=0.01)
np3 = np.arange(start=0.9... | 2.390625 | 2 |
utils_timing.py | tingofurro/keep_it_simple | 23 | 50218 | <filename>utils_timing.py
import time
class TickTimer:
def __init__(self, start_key=None):
self.T = time.time()
self.time_map = {}
self.current_key = start_key
def tick(self, new_key):
lapse = time.time() - self.T
if self.current_key is not None:
if self.cur... | 3.265625 | 3 |
sound/disksnd.py | gbeckers/sound | 1 | 50219 | from darr.basedatadir import BaseDataDir, create_basedatadir
from darr.metadata import MetaData
from ._version import get_versions
#TODO: required keys for sndinfo
class DataDir(BaseDataDir):
_classid = 'DataDir'
_classdescr = 'object for IO for disk-persistent sounds'
_version = get_versions()['version'... | 2.546875 | 3 |
figures/__init__.py | dvordrova/jumping-circle | 0 | 50220 | <gh_stars>0
from .circle import Circle
from .rope import Rope
| 1.125 | 1 |
test/proc_harness_tests_automated.py | slugiot/slugiot-client | 4 | 50221 | ###########################################################
# SELENIUM TESTS FOR PROCEDURE HARNESS
# to run: rm server_log.txt and client_log.txt from client logs directory
# launch client and server with stderr redirected to client_log.txt and server_log.txt
# run proc_harness_tests_automated.py
#
# Fu... | 2.25 | 2 |
tests/test_ga.py | frederikgram/PYGA | 0 | 50222 | """ Overall test for the PYGA framework"""
from src.ga import GA
import numpy as np
TEST_CONFIGURATION = {
"generation_size": 100,
"iterate_evolution": True,
"max_fitness": 0.99,
"display_info": False,
}
def give_score(weights) -> float:
""" Higher weights give higher fitness """
return np.m... | 2.8125 | 3 |
pyspedas/mms/mms_orbit_plot.py | asherp/pyspedas | 0 | 50223 |
import os
import matplotlib.pyplot as plt
from pytplot import get_data
from . import mms_load_mec
def mms_orbit_plot(trange=['2015-10-16', '2015-10-17'], probes=[1, 2, 3, 4], data_rate='srvy', xrange=None, yrange=None, plane='xy', coord='gse'):
spacecraft_colors = [(0,0,0), (213/255,94/255,0), (0,158/255,115/255)... | 2.40625 | 2 |
temperature.py | krustea/surlejaune | 0 | 50224 | <reponame>krustea/surlejaune
# Imports
import os
import glob
import time
class TemperatureSensor:
def __init__(self):
os.system('modprobe w1-gpio') # Allume le module 1wire
os.system('modprobe w1-therm') # Allume le module Temperature
self.device_file = '/sys/bus/w1/devices/28-01131a446... | 3 | 3 |
DumpAlphaChan.py | pinaxe1/Auto-Annotation-with-a-Camera | 0 | 50225 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 9 13:15:44 2019
Source: https://stackoverflow.com/questions/38754957/how-does-one-extract-the-alpha-channel-from-an-image-using-pillow
@author: Charlie https://stackoverflow.com/users/145976/charlie
"""
from PIL import Image
# Open the image and con... | 3.421875 | 3 |
files/targets/ios_framework/config/config.py | uilianries/ezored | 0 | 50226 | def run(params={}):
return {
'project_name': 'Core',
'bitcode': True,
'min_version': '9.0',
'enable_arc': True,
'enable_visibility': True,
'conan_profile': 'ezored_ios_framework_profile',
'archs': [
{'arch': 'armv7', 'conan_arch': 'armv7', 'platfor... | 1.546875 | 2 |
ecomm/models.py | areebbeigh/greenspace-demo | 1 | 50227 | <gh_stars>1-10
from django.db import models
from django.contrib.auth.models import Group
from django.conf import settings
from django.core.exceptions import ValidationError
from users.models import CustomUser
class Product(models.Model):
is_cleaned = False
name = models.CharField(max_length=200, null=True)
... | 2.21875 | 2 |
cloudshell/recorder/rest/configuration.py | QualiSystems/cloudshell-recorder | 0 | 50228 | import os
from functools import lru_cache
import yaml
from cloudshell.recorder.rest.model import RestRequest, RestSession
class Configuration(object):
SESSION_KEY = 'Session'
RECORDS_KEY = 'Requests'
def __init__(self, config_path):
self._config_path = config_path
@property
@lru_cache(... | 2.265625 | 2 |
src/tests/keyboard_test.py | bobbyluig/6.A01 | 0 | 50229 | <filename>src/tests/keyboard_test.py
from util import logger
from agility import Agility
from config import Android
from tkinter import Tk, Frame
from threading import Thread
from math import pi
import time
# Obtain configuration.
arm = Android.arm
# Set up agility.
agility = Agility(arm)
agility.zero()
# Define c... | 2.90625 | 3 |
settings.py | 343max/led_lamp | 0 | 50230 | <gh_stars>0
import json
import os
from typing import Optional, Tuple
state_json = os.path.dirname(os.path.abspath(__file__)) + '/state.json'
def store_scene(scene_name: str, on: bool):
with open(state_json, 'w') as json_file:
json.dump({'scene_name': scene_name, 'on': on}, json_file)
def load_scene() -> Tu... | 2.859375 | 3 |
step32_elastic_file_storage/efs-with-lambda/Python/lambda/msg.py | fullstackwebdev/full-stack-serverless-cdk | 192 | 50231 | <filename>step32_elastic_file_storage/efs-with-lambda/Python/lambda/msg.py
from __future__ import print_function
import logging
import os
import json
msg_file_path = '/mnt/msg/content'
def handler(event, context):
# request = event['requestContext']
# http = request['http']
method = event['requestContext... | 2.265625 | 2 |
thesis/i2a_algorithm.py | Driesssens/ppo-a2c-thesis | 1 | 50232 | import numpy
import torch
from torch_rl.algos.base import BaseAlgo
class I2Algorithm(BaseAlgo):
def __init__(self, environment_class, n_processes=16, seed=1, acmodel=None, num_frames_per_proc=None, discount=0.99,
lr=7e-4, gae_lambda=0.95, entropy_coef=0.01, value_loss_coef=0.5, max_grad_norm=0.5... | 2.203125 | 2 |
cloudentries/fusioncompute/lifecycles/fc_rest_client/storage/volumes.py | CloudChef/CloudEntries | 0 | 50233 | # Copyright (c) 2021 Qianyun, Inc. All rights reserved.
from ..common import FusionComputeBase
from cloudify import ctx
class VolumesClient(FusionComputeBase):
IDENTIFIER = 'volumes'
def list(self, urn, limit=100, offset=0):
uri_prefix = '/'.join([self.urn2uri(urn), self.IDENTIFIER])
paginat... | 2.125 | 2 |
Simulador Drone 2D/Classes.py | ProjetoSD-2022/Projeto-01 | 0 | 50234 | import pygame
from pygame.locals import *
from sys import exit
from PIL import Image
from PID import execute_PID
import numpy as np
# Global Variables
larg = 1000.0
alt = 640.0
global position_, angle_, velocidade
position_ = 0
angle_ = 0
velocidade = 0
class Screen:
def __init__(self, larg, alt, bg_image):
pygam... | 2.984375 | 3 |
utils/matrix2heatmap.py | cns-iu/ccf-research | 1 | 50235 | import os
import math
import numpy as np
from skimage import transform, io
from PIL import Image
import os
Image.MAX_IMAGE_PIXELS = None
root_path = r'X:\test_image\output'
image_name = 'mask.tiff'
output_name = 'new_heatmap.tiff'
img_path = os.path.join(root_path, image_name)
output_path = os.path.join(root_path, ou... | 2.578125 | 3 |
tweets_setup.py | casmlab/analyze-tweets-from-tg | 2 | 50236 | <gh_stars>1-10
### SETUP ENVIRONMENT
from __future__ import division
import ast
import collections
from ConfigParser import SafeConfigParser
from datetime import datetime
import json
import logging
import mysql.connector as sql
from mysql.connector import errorcode
import os
import requests
from requests import HTTPEr... | 2.328125 | 2 |
debug.py | danieltodor/rpi-gpio-devices | 0 | 50237 | """ Write debug scripts here """
from src import *
| 1.234375 | 1 |
Ago-Dic-2021/suarez-villanueva-sergio-armando/Parcial1/Practica3/ImplementCalculator.py | checodroid/DAS_Sistemas | 41 | 50238 | from ClassCalculator import Calculator
class Main:
def get_input(self,message):
return input(message)
def menu(self):
t = True
while t:
m = "---Menu---\n"
m += "Escribe la abreviación adecuada\n"
m += "Suma: x mas y\nResta: x menos y\nMultip... | 3.65625 | 4 |
django/models/database_models/migrations/0007_auto_20191219_0354.py | djangojeng-e/TIL | 0 | 50239 | # Generated by Django 2.2.8 on 2019-12-19 03:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('database_models', '0006_ox'),
]
operations = [
migrations.AlterModelOptions(
name='ox',
options={'ordering': ['horn_length']... | 1.421875 | 1 |
Uncategorized-pages.py | Turkce-Vikipedi-Yazilim-Deposu/Uncategorized-pages | 0 | 50240 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import random
import re
import requests
import mavri
wiki = 'tr.wikipedia'
wikiS = 'trwiki'
xx = mavri.login(wiki, '<NAME>')
catNS = requests.get(
'https://' + wiki + '.org/w/api.php?format=json&utf8=&action=query&meta=siteinfo&siprop=namespaces').json()[
'quer... | 2.5625 | 3 |
nuclear_matter/stats_utils.py | buqeye/nuclear-matter-convergence | 2 | 50241 | import gsum as gm
import numpy as np
from numpy import ndarray
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import matplotlib.patches as mpatches
from matplotlib.patches import Ellipse
from matplotlib.legend_handler import HandlerPatch
from matplotlib.legend import Legend
from matplotlib.ticker ... | 1.929688 | 2 |
src/ipycbm/sources/rest_api.py | VP-GEO/cbm | 0 | 50242 | <reponame>VP-GEO/cbm<filename>src/ipycbm/sources/rest_api.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of CbM (https://github.com/ec-jrc/cbm).
# Author : <NAME>, <NAME>
# Credits : GTCAP Team
# Copyright : 2021 European Commission, Joint Research Centre
# License : 3-Clause B... | 2.203125 | 2 |
src/excision_mail/user.py | Excision-Mail/excision-cli | 1 | 50243 | import typing
from .UserManager import UserManager, UStat
from .utils import get_newpass
def user_add(user: str, **kwargs):
um = UserManager(**kwargs)
newpass = get_newpass()
um.user_add(user, newpass)
def user_delete(user: str, **kwargs):
um = UserManager(**kwargs)
um.user_delete(user)
def u... | 2.25 | 2 |
parsers/humbleparser.py | FilipDominec/gayplot | 6 | 50244 | #!/usr/bin/python3
#-*- coding: utf-8 -*-
"""
A simplistic attempt to parse simple procedural languages that control e.g. MOVPE apparatuses gas flow (not finished)
"""
import sys,re
time = 0
labels = {}
tableheader = [] ## TODO TODO efficient accumulation of data w/ possibility of new variables in the middle of EPI... | 2.53125 | 3 |
Back-End/src/Projects/migrations/0001_initial.py | steve-njuguna-k/Django-Angular-Projects-Manager | 1 | 50245 | <filename>Back-End/src/Projects/migrations/0001_initial.py
# Generated by Django 3.2.7 on 2021-09-13 14:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMode... | 1.757813 | 2 |
examples/discordpy/classes/bot.py | MaxOhn/twilight-dispatch | 26 | 50246 | import aio_pika
import asyncio
import config
import inspect
import logging
import orjson
import sys
import traceback
import zangy
from classes.misc import Status, Session
from classes.state import State
from discord import utils
from discord.ext import commands
from discord.ext.commands import DefaultHelpCommand, Cont... | 2.03125 | 2 |
build_dataset.py | Guitheg/SegSRGAN-remake | 0 | 50247 | <reponame>Guitheg/SegSRGAN-remake
from configparser import ConfigParser
from pkgutil import iter_modules
import sys
from model.mri_srgan import MRI_SRGAN
from dataset.dataset_manager import MRI_Dataset
from utils.files import get_and_create_dir, get_environment
from main import CONFIG_INI_FILEPATH
from os.path import n... | 2.1875 | 2 |
autodiff/array.py | ttpr0/simple-autodiff | 0 | 50248 | <filename>autodiff/array.py
from abc import abstractmethod
import numpy as np
class Array():
def __init__(self, value, dtype = 'float32', input:tuple = None, operation = None, track_grads:bool = True, name:str = None):
from autodiff.operations import Operation
self._value:np.ndarray = np.array(valu... | 3.15625 | 3 |
utail_base/utfile_hash.py | UnlimitTail/ut-base-py | 0 | 50249 | <reponame>UnlimitTail/ut-base-py
# -*- coding: utf-8 -*-
import hashlib
import logging
import os
log = logging.getLogger(__name__)
class UtFileHashFilter:
"""
필터링 되지않은 파일들은 default 그룹에 속합니다
"""
def __init__(self):
# _dic key : group name / value : filter string's list
self._dic = di... | 2.375 | 2 |
elro/device.py | dib0/elro_connects | 16 | 50250 | from enum import Enum
from abc import ABC, abstractmethod
import logging
import json
import trio
class DeviceType(Enum):
"""
The DeviceType defines which kind of Elro device this is
"""
CO_ALARM = "0000"
WATER_ALARM = "0004"
HEAT_ALARM = "0003"
FIRE_ALARM = "0005"
DOOR_WINDOW_SENSOR =... | 3.5625 | 4 |
accounts/test_forms.py | vmcggh18/bits_tracker | 0 | 50251 | <filename>accounts/test_forms.py
from django.test import TestCase
from .forms import UserLoginForm, UserRegistrationForm
from django import forms
from django.contrib.auth.models import User
class TestTrackerUserLoginForm(TestCase):
def test_can_create_an_item_with_just_a_username(self):
#instantiate this... | 2.78125 | 3 |
centrifuge/actions/preprocess/custom_stopwords.py | datadonK23/Engine | 15 | 50252 | #!/usr/bin/python
# encoding: utf-8
"""
custom_stopwords
Purpose: Collect custom stopwords lists
Author: datadonk23 (<EMAIL>)
Date: 2018-05-01
"""
arxiv_stopwords = ["arxiv",
"astro-ph", "astro-ph.co", "astro-ph.ep", "astro-ph.ga", "astro-ph.he", "astro-ph.im", "astro-ph.sr",
"co... | 1.5 | 2 |
problems/tests/test_fizz_buzz.py | mdu-alt/coding_challenges_python | 0 | 50253 | from problems.fizz_buzz import FizzBuzz
def test_fizz_buzz():
output = FizzBuzz.compute()
assert output == ['1', '2', 'fizz', '4', 'buzz', 'fizz', '7', '8', 'fizz', 'buzz', '11', 'fizz', '13', '14',
'fizzbuzz', '16', '17', 'fizz', '19', 'buzz', 'fizz', '22', '23', 'fizz', 'buzz', '26', ... | 2.671875 | 3 |
simple-chat-app-multiple-client-ui/multiple_chat_app.py | JustADot14/chat-app-collection | 0 | 50254 | # Start Date: 3/9/2021
# Last Updated: 3/9/2021
# Author: <NAME>
# App Name: Chat App (Multi Client)
# Version: GUI Version 1.0
# Type: Server, Client
# import multiple_chat_app_server as mcas
# import multiple_chat_app_client as mcac
import os, sys
import tkinter
from tkinter import Label, ttk
def requi... | 2.453125 | 2 |
dataset/sequence_dataset.py | RyanMokarian/Solar_Irradiance_Forecast_using_Conv3_LSTM_GRU_Attention | 4 | 50255 | <filename>dataset/sequence_dataset.py
import os
import datetime
import typing
import logging
from datetime import timedelta
import numpy as np
import tensorflow as tf
from utils import data
from utils import utils
DATASET_CACHE_PATH = 'dataset_cache'
logger = logging.getLogger('logger')
class SequenceDataset(tf.da... | 2.59375 | 3 |
src/environment_provider/logs/log_area.py | andjoe-axis/etos-environment-provider | 0 | 50256 | <reponame>andjoe-axis/etos-environment-provider
# Copyright 2020 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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 ... | 1.960938 | 2 |
commands/Cep.py | danielmunier/discord-bmo-bot | 2 | 50257 | from discord.ext import commands
import requests
class Cep(commands.Cog):
""" Talks with user """
def __init__(self, bot):
self.bot = bot
@commands.command(name = 'cep',help="Verifica os dados de um CEP Brasileiro")
async def consult_cep(self, ctx, cep):
#viacep.com.br/ws/cep/... | 2.75 | 3 |
wazimap_ng/datasets/migrations/0090_auto_20200507_0306.py | arghyaiitb/wazimap-ng | 11 | 50258 | <gh_stars>10-100
# Generated by Django 2.2.10 on 2020-05-07 03:06
import django.core.validators
from django.db import migrations, models
import wazimap_ng.datasets.models.upload
class Migration(migrations.Migration):
dependencies = [
('datasets', '0089_auto_20200509_2036'),
]
operations = [
... | 1.625 | 2 |
resolwe/flow/executors/prepare.py | plojyon/resolwe | 27 | 50259 | <gh_stars>10-100
""".. Ignore pydocstyle D400.
======================
Flow Executor Preparer
======================
Framework for the manager-resident executor preparation facilities.
.. autoclass:: resolwe.flow.executors.prepare.BaseFlowExecutorPreparer
:members:
"""
import logging
import os
from django.conf ... | 2.34375 | 2 |
elephant/ref.py | chuck1/elephant | 0 | 50260 | <filename>elephant/ref.py
import bson
import elephant.util
class DocRef:
@classmethod
async def decode(cls, h, args):
args = await h.decode(args)
return DocRef(*args)
def __init__(self, _id, ref=None):
if not isinstance(_id, bson.objectid.ObjectId): raise TypeError()
if not... | 2.375 | 2 |
ward_mapping/migrations/0002_auto_20190516_1329.py | Suraj1127/ward-mapping-application | 1 | 50261 | # Generated by Django 2.2 on 2019-05-16 07:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ward_mapping', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='map2011',
name='old_survey_ward_co... | 1.53125 | 2 |
CANN/ContinuumMechanics.py | Hillgaertner/CANN | 5 | 50262 | # Standard imports
import keras as k
import tensorflow as tf
import numpy as np
"""
NOTE:
All functions in this file are directly adopted from continuum mechanics fundamentals
and hence do not need further introduction. In order to not inflate this file
unnecessarily with comments (and sacrificing readability), we... | 2.703125 | 3 |
src/CIR-Net.py | CloudDataLab/CIR-Net | 9 | 50263 | <filename>src/CIR-Net.py
# -*- coding: utf-8 -*-
# @Time : 2019/11/24 11:01
# @Company : Cloud lab SCNU
# @Author : ChengchuangLin
# @Author : <EMAIL>
# @File : CIR-Net.py
# @Software: PyCharm
from keras.models import Sequential, Model
from keras.models import load_model
from keras.layers import Dense, Dropout... | 2.0625 | 2 |
009_Palindrome_Number.py | adwardlee/leetcode_solutions | 0 | 50264 | '''
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
Examp... | 4.21875 | 4 |
lesson7.py | code-mage/pythonTest | 0 | 50265 | <reponame>code-mage/pythonTest
#ignore this part, we will get to it later.
import os
script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in
rel_path = "Files/text1.txt"
abs_file_path = os.path.join(script_dir, rel_path)
#Ignore this too
file = open(abs_file_path,'w')
file.writelines(["Line1\n","Line... | 2.75 | 3 |
blog/forms.py | Zefarak/illidius_plan | 1 | 50266 | <reponame>Zefarak/illidius_plan
from django import forms
from .models import *
from PIL import Image
MAX_FILE_SIZE = 2*1024*1024
class PostCreate(forms.ModelForm):
title = forms.CharField(label="Τίτλος 'Αθρου", widget=forms.TextInput(attrs={'onkeyup':"myTitle()",}))
lead_content = forms.CharField(label='Πρώτ... | 2.125 | 2 |
fakesocial/bio.py | berfr/fakesocial | 3 | 50267 | <reponame>berfr/fakesocial
"""
"""
import csv
import logging
import random
import markovify
import names
world_cities_file = "data/world-cities_csv.csv"
job_titles_file = "data/job-titles.txt"
nasdaq_listings_file = "data/nasdaq-listed_csv.csv"
job_titles_model = None
def _gen_full_name_v2():
"""Real name wi... | 3.078125 | 3 |
main.py | duyvu1991/license-plate-detection- | 0 | 50268 | <reponame>duyvu1991/license-plate-detection-
from flask import Flask, render_template
from blueprints import *
app = Flask(__name__)
app.register_blueprint(home)
app.register_blueprint(upload_api)
if __name__ == '__main__':
app.run(debug = True, host='127.0.0.1', port=5001)
| 1.835938 | 2 |
file_repository_sdk/api/archive/get_difference_pb2.py | easyopsapis/easyops-api-python | 5 | 50269 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: get_difference.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... | 1.359375 | 1 |
PyNotion.py | stephanGarland/PyNotion | 9 | 50270 | import requests
import json
from string import Template
from models.user import User
from models.task import Task
from models.system import System
from models.threshold import Threshold
from models.user_preferences import UserPreferences
from models.alert_perferences import AlertPerferences
from models.base_station imp... | 2.3125 | 2 |
Recipes/lib/Lotame.py | Lotame/DataStream_Cookbook | 1 | 50271 | <reponame>Lotame/DataStream_Cookbook
#!/usr/bin/python
#
# Filename:
#
# Lotame.py
#
#
# Basic Usage:
#
# 1. import Lotame package:
# import Lotame
#
# 2. input the appropriate profile (DEFAULT_PROFILE), token, and access
# into the properties file (DEFAULT_PROPERTIES_FILENAME)
#
# 3... | 2.78125 | 3 |
src/extractor/csxextract/extractors/grobid.py | amm-kun/pdfmef | 25 | 50272 | from extraction.runnables import Extractor, RunnableError, ExtractorResult
import extractor.csxextract.interfaces as interfaces
import extractor.csxextract.config as config
import extractor.csxextract.filters as filters
import defusedxml.ElementTree as safeET
import xml.etree.ElementTree as ET
import xml.sax.saxutils a... | 2.40625 | 2 |
link_example/boyd_pipe.py | stoiver/anuga_drainage | 1 | 50273 | #------------------------------------------------------------------------------
# IMPORT NECESSARY MODULES
#------------------------------------------------------------------------------
print (' ABOUT to Start Simulation:- Importing Modules')
import anuga, anuga.parallel, numpy, time, os, glob
from anuga.operat... | 1.828125 | 2 |
script/jira-release.py | nmesar/jira-release | 3 | 50274 | #!/usr/bin/env python
import os
import requests
from datetime import datetime
jira_version_name = os.getenv('JIRA_VERSION_NAME')
jira_project = os.getenv('JIRA_PROJ')
auth_user = os.getenv('JIRA_AUTH_USER')
auth_password = os.getenv('JIRA_AUTH_PASSWORD')
if jira_version_name is None:
print("Version Name Variable ... | 2.828125 | 3 |
download_recordings/source/server_paths.py | PCH-Engineering/pch-cloud | 0 | 50275 | <gh_stars>0
import json
#import os
#fn= os.path.abspath(__file__ + "/../../")
#hostfile =os.path.join(fn,'config/hosts.json')
from pathlib import Path;
parent = Path(__file__).parents[1]
hostfile=parent.joinpath('config/hosts.json')
with open(hostfile) as f:
hosts = json.load(f)
def service_url(host, service):
... | 2.390625 | 2 |
Ephem/quasar.py | SDRAST/Astronomy | 0 | 50276 | import logging
import ephem
from . import Jnames, Bname_dict, cat_3C_dict, cal_dict, Bnames, EphemException
#from Astronomy.Ephem import EphemException
module_logger = logging.getLogger(__name__)
class Quasar(ephem.FixedBody):
"""
ephem.FixedBody() with "J" or "B" name
"""
def __init__(self,name):
"""
... | 2.390625 | 2 |
pertemuan_5/3_Table_Record_Search_with_Session/run.py | Muhammad-Yunus/Flask-Web-Development | 0 | 50277 | <gh_stars>0
from app import app
from app import db
import os
if __name__ == '__main__':
# if database file not exist, create it.
database_path = app.config['DATABASE_FILE']
if not os.path.exists(database_path):
with app.app_context():
db.create_all()
# invoke app to run
app.... | 2.390625 | 2 |
src/skiptracer/plugins/who_call_id/__init__.py | EdwardDantes/skiptracer | 912 | 50278 | """Whocallid.com search module"""
from __future__ import print_function
from __future__ import absolute_import
from ..base import PageGrabber
from ...colors.default_colors import DefaultBodyColors as bc
import re
import logging
try:
import __builtin__ as bi
except BaseException:
import builtins as bi
class Wh... | 2.625 | 3 |
app_video.py | theGASK/Cisco-Flask-API | 0 | 50279 | <filename>app_video.py
from flask import Flask
from flask_restful import Api, Resource, abort, reqparse
from flask_sqlalchemy import SQLAlchemy
#REMOVE DEBUG
app =Flask(__name__)
api = Api(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
db = SQLAlchemy(app)
class ConferenceModel(db.Model):
... | 2.8125 | 3 |
mcoc/mcoc.py | konamino/kreusadacogs | 0 | 50280 | from redbot.core import commands, checks, Config
from redbot.core.utils import menus
import asyncio
import discord
import random
import logging
from .mdtembed import Embed
from .crystal import FEATUREDS, BCB
log = logging.getLogger(name="red.demaratus.mcoc")
class Mcoc(commands.Cog):
"""Fun Games and Tools for M... | 2.3125 | 2 |
scripts/IFNode.py | hwaipy/InteractionFreeNode | 0 | 50281 | from interactionfreepy import IFBroker, IFWorker
from LibSync import LibSync
import sys
import threading
from datetime import datetime, timedelta
import time
from NTP import NTPSyncer
class IFNode:
def __init__(self):
self.inited = False
def init(self, serverRootURL,localRootPath):
if self.inited:raise Ru... | 2.28125 | 2 |
src/item.py | bussigaboran/the_island | 0 | 50282 | class Tile():
""" The smallest building block in a map """
def __init__(self):
self.tile = '.'
def get(self):
return self.tile
def set(self, item):
self.tile = item
| 3.515625 | 4 |
misc-modules/sparktk-ext/sparktk_ext.py | Bhanuprakash-ch/jupyter | 5 | 50283 | <filename>misc-modules/sparktk-ext/sparktk_ext.py<gh_stars>1-10
import errno
import json
import os
import subprocess
import time
from concurrent.futures import ProcessPoolExecutor as Pool
from notebook.base.handlers import IPythonHandler
STATUS_FILE = 'STATUS.log'
LOG_FILE = 'LOG.log'
APP_STATUS = {
'UPLOADED': ... | 2.171875 | 2 |
pets/models.py | Gornstats/HTMX-Django-Experiments | 0 | 50284 | from django.db import models
class Pet(models.Model):
pet_name = models.CharField(max_length=20)
def __str__(self):
return self.pet_name
| 2.28125 | 2 |
src/messages/__init__.py | chrishendra93/dinner_at_clemz | 0 | 50285 | <reponame>chrishendra93/dinner_at_clemz
from .all_messages import *
__all__ = [
'Eko', 'Emil', 'Marco', 'Ida', 'Karin', 'Rika', 'Zefa', 'Jason', 'Billy', 'Kafi', 'Indrik', 'Toto', 'Acang', 'Bena'
]
| 1.1875 | 1 |
superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py | m-ajay/superset | 18,621 | 50286 | # 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"); you may not u... | 1.742188 | 2 |
test_crop/crop_4_img.py | weixinran/captcha-recognition-master | 0 | 50287 | import os
from PIL import Image
import time
in_dir = 'images_1000'
out_dir = 'images_crop'
if not os.path.isdir(out_dir):
os.mkdir(out_dir)
img_list = os.listdir(in_dir)
for img_file in img_list:
print(img_file)
img_name = os.path.splitext(os.path.basename(img_file))[0]
img = Image.open(os.path.join(... | 2.75 | 3 |
Task2B.py | billiemoss/Project---30 | 0 | 50288 |
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.flood import stations_levels_over_threshold
def run():
# Build list of stations
stations = build_station_list()
# Update latest level data for all stations
update_water_levels(stations)
# Check which st... | 3.390625 | 3 |
python/generate-sample-images.py | swharden/Csharp-Image-Analysis | 1 | 50289 | """
Use a common library (skimage) as a source of truth for
experimental images to analyze
"""
import skimage
import pathlib
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
def saveImage(data: np.ndarray, name: str):
# save it to disk
repoRoot = pathlib.Path(__file__).parent.parent
... | 2.796875 | 3 |
main.py | Aarif1430/WFLOP_Genetic_Algorithm | 4 | 50290 | <filename>main.py
import numpy as np
from API.misc import generic_plot, generic_bar, plot_turbines
from GA_Optimizer.WindForm_GA import GAOptimizer
# GA properties
elite_rate = 0.2
cross_rate = 0.6
random_rate = 0.5
mutate_rate = 0.1
population_size = 50 # how many layouts in a population
iteration_times = 50 # how... | 2.890625 | 3 |
Intro/longestDigitPrefix.py | sumeyaali/Code_Challenges | 0 | 50291 | def longestDigitsPrefix(inputString):
# iterate through the string
arr = ''
for i in inputString:
if i.isdigit():
arr += i
else:
break
return arr | 3.828125 | 4 |
core/ocr/spaceocr.py | huihui7987/MillionHeroAssistant | 672 | 50292 | <filename>core/ocr/spaceocr.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import json
import requests
"""
ocr.space
"""
def get_text_from_image(image_data, api_key='<KEY>', overlay=False, language='chs'):
"""
CR.space API request with local file.
:param image_data: image's base64 encoding.
:par... | 3.1875 | 3 |
pf_py_common/py_object_copier.py | problemfighter/pf-py-common | 3 | 50293 | <filename>pf_py_common/py_object_copier.py
class PyObjectCopier:
pass
| 1.109375 | 1 |
testdata/stamp_info.bzl | mgred/rules_docker | 912 | 50294 | <gh_stars>100-1000
# Copyright 2017 The Bazel Authors. 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 requir... | 1.851563 | 2 |
classifier/loss.py | theovincent/birdClassification | 0 | 50295 | import torch
def cross_entropy_loss():
return torch.nn.CrossEntropyLoss(reduction="mean")
| 2.375 | 2 |
scripts/citadelgetter.py | fuzzysteve/FuzzMarket | 24 | 50296 | <reponame>fuzzysteve/FuzzMarket<gh_stars>10-100
import requests
from sqlalchemy import create_engine,MetaData,Table,Column,INTEGER,FLOAT,VARCHAR,BigInteger
import logging
logging.basicConfig(filename='logs/citadelfullloader.log',level=logging.WARN,format='%(asctime)s %(levelname)s %(message)s')
engine = create_engi... | 2.09375 | 2 |
pylib/monitor/haproxy/haproxy_cluster_monitor_group_test.py | xkmato/py77 | 0 | 50297 | """
Tests for HAProxyMonitor
run with nosetests
"""
__copyright__ = '2013, Room 77, Inc.'
__author__ = '<NAME> <<EMAIL>>'
from flexmock import flexmock
import unittest
from pylib.monitor.haproxy.haproxy_cluster_monitor_group import HAProxyClusterMonitorGroup
def mock_monitor(url, available):
"""
Create a mock ... | 2.34375 | 2 |
birgitta/recipe/debug/dataframe.py | telia-oss/birgitta | 8 | 50298 | <filename>birgitta/recipe/debug/dataframe.py
"""Debug functions for notebooks.
"""
def count(df, name=None):
"""Print the count of dataframe with title."""
if name:
print("Dataset: %s" % (name))
print("Count: %d" % (df.count()))
def show(df, name=None, num_rows=1):
"""Print title and show a ... | 2.875 | 3 |
examples/save_load_remove_spectrum_states.py | salvol/metalsf2 | 0 | 50299 | # For compatibility with Python2
from __future__ import print_function, division, absolute_import
#
import spekpy as sp
print("\n** Script to save, load and remove a new spectrum from disk **\n")
# Generate filtered spectrum
s=sp.Spek(kvp=120,th=12).filter('Al',2.5)
# Print summary of metrics
s.summarize(mode="full")... | 2.375 | 2 |