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 |
|---|---|---|---|---|---|---|
bank/src/base_app/serializers.py | yuramorozov01/bank_system | 0 | 12792651 | from base_app.models import BankSettings
from rest_framework import serializers
class BankSettingsDetailsSerializer(serializers.ModelSerializer):
'''Serializer for a bank settings.
This serializer provides detailed information about bank settings.
'''
class Meta:
model = BankSettings
... | 2.421875 | 2 |
tests/test_setups/test_setups_functions.py | openml/openml-python-contrib | 1 | 12792652 | <filename>tests/test_setups/test_setups_functions.py
import ConfigSpace
import openml
import openmlcontrib
import os
import pickle
from openmlcontrib.testing import TestBase
class TestSetupFunctions(TestBase):
def setUp(self):
self.live_server = "https://www.openml.org/api/v1/xml/"
self.test_ser... | 2.1875 | 2 |
test_data1E.py | jfs60/Group-147-PartIA-Flood-Warning-System | 0 | 12792653 | from floodsystem.geo import build_station_list
from floodsystem.geo import rivers_by_station_number
def test_rivers_by_station_number():
"""Tests to check that the outputs from funtion rivers_by_station_number are as expected"""
stations = build_station_list()
test = rivers_by_station_number(stations, 9)
... | 3.3125 | 3 |
flask_web/flask_app/deep_learning/machine_learning/ml_utils.py | Yakings/system_demo | 7 | 12792654 | <filename>flask_web/flask_app/deep_learning/machine_learning/ml_utils.py
import os
import numpy as np | 1.195313 | 1 |
src/Deque/palindrome_deque.py | shapovalovdev/AlgorythmsAndDataStructures | 0 | 12792655 | from src.Deque.deque_scratch import Deque
def is_palindrome(string_to_check):
string_to_check=string_to_check.strip()
if not string_to_check:
raise Exception("The string is empty")
deq=Deque()
for el in string_to_check:
deq.addTail(el)
front=deq.removeFront()
end=deq.remove... | 3.765625 | 4 |
experiments/series_1/experiment_2/experiment_setup.py | TomaszOdrzygozdz/gym-splendor | 1 | 12792656 | <reponame>TomaszOdrzygozdz/gym-splendor
TRAIN_DIR = '/net/archive/groups/plggluna/plgtodrzygozdz/lvl1/train_epochs_new_eval'
VALID_FILE = '/net/archive/groups/plggluna/plgtodrzygozdz/lvl1/valid_new/valid_eval.pickle'
| 1.085938 | 1 |
Geeks-For-Geeks/Practice/Array/Plus-One.py | HetDaftary/Competitive-Coding-Solutions | 0 | 12792657 | <filename>Geeks-For-Geeks/Practice/Array/Plus-One.py<gh_stars>0
#User function Template for python3
class Solution:
def increment(self, arr, N):
# code here
i = N - 1
arr[i] += 1
while i > 0 and arr[i] > 9:
arr[i] = 0
arr[i - 1] += 1
i -= 1
... | 3.578125 | 4 |
problemsets/Codeforces/Python/B705.py | juarezpaulino/coderemite | 0 | 12792658 | <reponame>juarezpaulino/coderemite
"""
*
* Author: <NAME>(coderemite)
* Email: <EMAIL>
*
"""
r=0
for x in map(int,[*open(0)][1].split()):
r=(r+x-1)%2
print([2,1][r]) | 3.078125 | 3 |
utils/misc.py | bbbbbbzhou/DuDoRNet | 35 | 12792659 | <filename>utils/misc.py
__all__ = ['read_dir', 'get_last_checkpoint', 'compute_metrics', 'get_aapm_minmax',
'convert_coefficient2hu', 'convert_hu2coefficient']
import os
import os.path as path
import scipy.io as sio
import numpy as np
from tqdm import tqdm
from skimage.measure import compare_ssim, compare_psnr
d... | 2.125 | 2 |
python/pyfgag/simu_compiler.py | FAIG2014/fpga-projects | 0 | 12792660 | <reponame>FAIG2014/fpga-projects
import os
import sys
import pyfgag.dependency_builder as deps
import subprocess
import pathlib
class SimuCompiler(object):
def __init__(self, build_dir=os.getcwd()):
self.current_folder = os.getcwd()
self.build_dir = build_dir
pathlib.Path(self.build_dir).... | 2.640625 | 3 |
7.36.0.dev0/ietf/__init__.py | kesara/ietf-datatracker | 0 | 12792661 | # Copyright The IETF Trust 2007-2020, All Rights Reserved
# -*- coding: utf-8 -*-
from . import checks # pyflakes:ignore
# Don't add patch number here:
__version__ = "7.36.0"
# set this to ".p1", ".p2", etc. after patching
__patch__ = ""
__date__ = "$Date: 2021-08-07 03:05:11 +1200 (... | 1.195313 | 1 |
generate_figures.py | max-liu-112/STGAN-WO | 45 | 12792662 |
import os
import pickle
import numpy as np
import PIL.Image
import dnnlib
import dnnlib.tflib as tflib
import config
from training import misc
synthesis_kwargs = dict(minibatch_size=8)
_Gs_cache = dict()
def load_Gs(url):
if url not in _Gs_cache:
with dnnlib.util.open_url(url, cache_dir=config.cache_dir... | 2.21875 | 2 |
hangover/python/main.py | jimjh/challenges | 0 | 12792663 | import sys
for line in sys.stdin:
if line == "0.00\n": break;
c = float(line.strip())
(curr_n, curr_len) = (0, 0.0)
while c > curr_len:
curr_n += 1
curr_len += 1.0/(1 + curr_n)
print curr_n, "card(s)"
| 3.4375 | 3 |
Ball Handle/imu.py | maxbot5/Ball-Handle-Software | 0 | 12792664 | # -*- coding: utf-8 -*-
import time
import numpy as np
from classes import Debug, KalmanFilter
import smbus
bus = smbus.SMBus(2) # bus = smbus.SMBus(0) fuer Revision 1
address = 0x68 # via i2cdetect
power_mgmt_1 = 0x6b
ACCEL_CONFIG = 0x1C # Reg 28
ACCEL_CONFIG2 = 0x1D # Reg 29
class Imu(Debug, KalmanFilter):
... | 2.5 | 2 |
doobi/doobi_pack/apps.py | bryanopew/doobi | 0 | 12792665 | <filename>doobi/doobi_pack/apps.py
from django.apps import AppConfig
class DoobiPackConfig(AppConfig):
name = 'doobi.doobi_pack'
| 1.28125 | 1 |
hivemind/mpi/worker.py | enj/hivemind | 1 | 12792666 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Represents a Worker node."""
from ..util import tags, MASTER
class Worker(object):
"""A Worker node runs Tasks that are provided by the Master node."""
def __init__(self, mpi, master=MASTER):
"""Construct a Worker with the global MPI object.
... | 2.921875 | 3 |
src/chitty/web/cli.py | zgoda/chitty-server | 0 | 12792667 | from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from dotenv import find_dotenv, load_dotenv
from werkzeug import run_simple
def parse_args() -> Namespace:
parser_kw = {'formatter_class': ArgumentDefaultsHelpFormatter}
parser = ArgumentParser(description='Chitty auxiliary web ser... | 2.515625 | 3 |
scripts/get_basin_data.py | jsadler2/preprocess_nwm_pgdl | 0 | 12792668 | <gh_stars>0
# coding: utf-8
import pandas as pd
import json
import ulmo
import hydrofunctions as hf
from hydrofunctions.exceptions import HydroNoDataError
from utils import get_sites_in_basin
def get_json_site_param(huc, param, file_name=None):
# get all the sites in the huc
sites_in_huc, data = get_sites_in_... | 2.765625 | 3 |
backend/youngun/youngun/apps/usermanager/migrations/0008_auto_20200710_1945.py | aakashbajaj/Youngun-Campaign-Tracking | 0 | 12792669 | <reponame>aakashbajaj/Youngun-Campaign-Tracking<filename>backend/youngun/youngun/apps/usermanager/migrations/0008_auto_20200710_1945.py
# Generated by Django 3.0.7 on 2020-07-10 19:45
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = ... | 1.40625 | 1 |
py_tdlib/constructors/user_profile_photo.py | Mr-TelegramBot/python-tdlib | 24 | 12792670 | <gh_stars>10-100
from ..factory import Type
class userProfilePhoto(Type):
id = None # type: "int64"
added_date = None # type: "int32"
sizes = None # type: "vector<photoSize>"
| 1.703125 | 2 |
Day 24/Core Team/python.py | ChetasShree/MarchCode | 9 | 12792671 | <gh_stars>1-10
arr = [ 5,3,5,2,41,4,3,1,4,4 ]
for i in range(10):
if (arr[i]!= -1):
for j in range (i+1, 10):
if (arr[i] == arr[j]):
arr[j] = -1
print(arr[i], end = ' ') | 3.359375 | 3 |
rssfly/extractor/pixiv_fanbox.py | lidavidm/rssfly | 1 | 12792672 | <reponame>lidavidm/rssfly
# Copyright 2021 <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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2.203125 | 2 |
datawinners/project/tests/form_model_generator.py | ICT4H/dcs-web | 1 | 12792673 | <filename>datawinners/project/tests/form_model_generator.py<gh_stars>1-10
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from mock import Mock
from mangrove.form_model.field import TextField, SelectField, DateField, GeoCodeField, UniqueIdField
from mangrove.form_model.form_model import FormModel
class FormModelGenerator(... | 2.484375 | 2 |
yahoo_panoptes/plugins/enrichment/generic/snmp/ciena/waveserver/plugin_enrichment_cienaws_light_metrics.py | mdrbh/panoptes | 86 | 12792674 | <filename>yahoo_panoptes/plugins/enrichment/generic/snmp/ciena/waveserver/plugin_enrichment_cienaws_light_metrics.py<gh_stars>10-100
"""
This module implements a Panoptes Plugin that can poll Ciena Waveserver devices for transceiver light level Metrics
"""
from cached_property import threaded_cached_property
from yah... | 1.953125 | 2 |
statssite/home/www-data/stats/frontpage/__init__.py | tigran-a/ACDCStats | 0 | 12792675 | <reponame>tigran-a/ACDCStats
#!/usr/bin/env python3
"""
(c) Copyright 2015 <NAME>, SnT, University of Luxembourg
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.apach... | 2.03125 | 2 |
authors/apps/articles/tests/test_highlight_text.py | andela/ah-django-unchained | 0 | 12792676 | import json
from django.urls import reverse
from rest_framework.views import status
from rest_framework.test import APITestCase, APIClient
class CommentsTestCase(APITestCase):
def setUp(self):
self.client = APIClient()
self.signup_url = reverse('authentication:auth-register')
self.create_a... | 2.453125 | 2 |
examples/38-benzene.py | hebrewsnabla/pyAutoMR | 5 | 12792677 | from pyscf import lib, scf
#from pyphf import guess, suscf
from automr import autocas, guess
lib.num_threads(8)
xyz = '''C -2.94294278 0.39039038 0.00000000
C -1.54778278 0.39039038 0.00000000
C -0.85024478 1.59814138 0.00000000
C -1... | 1.8125 | 2 |
silk/migrations/0008_fix_request_prof_file_null.py | pikhovkin/django-silk | 2 | 12792678 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2018-01-11 09:51
from __future__ import unicode_literals
from django.db import migrations, models
import silk.storage
class Migration(migrations.Migration):
dependencies = [
('silk', '0007_add_support_oracle'),
]
operations = [
migr... | 1.625 | 2 |
src/frobs_rl/templates/CustomRobotEnv.py | jmfajardod/gym_gazebo_sb3 | 67 | 12792679 | #!/bin/python3
from gym import spaces
from gym.envs.registration import register
from frobs_rl.envs import robot_BasicEnv
import rospy
#- Uncomment the library modules as neeeed
# from frobs_rl.common import ros_gazebo
# from frobs_rl.common import ros_controllers
# from frobs_rl.common import ros_node
# from frobs_r... | 2.421875 | 2 |
ib_async/order.py | ondergetekende/ib_async | 17 | 12792680 | <filename>ib_async/order.py
import enum
import typing # noqa
from ib_async.errors import UnsupportedFeature
from ib_async.event import Event
from ib_async import execution # noqa
from ib_async.instrument import Instrument # noqa
from ib_async.protocol import ProtocolInterface, Serializable, ProtocolVersion, Incomin... | 2.453125 | 2 |
Ago-Dic-2019/Ricardo_Romero_Medina/Practica1/Practica_3-5.py | Arbupa/DAS_Sistemas | 41 | 12792681 | <filename>Ago-Dic-2019/Ricardo_Romero_Medina/Practica1/Practica_3-5.py
invitados=['<NAME>','<NAME>','<NAME>','<NAME>','<NAME>']
message1="El invitado " + invitados[1].title() + " no asistira a la cena"
print(message1)
invitados[1]="<NAME>"
for i in range(len(invitados)):
message="Hola como estas " + invitados[... | 3.53125 | 4 |
models.py | hxf1228/dtcnn_elm_lnd | 8 | 12792682 | <reponame>hxf1228/dtcnn_elm_lnd
"""Deep Transfer Convolutional Neural Network (DTCNN)
Created on: 2019/12/31 22:01
@File: models.py
@Author:<NAME> (<EMAIL> & <EMAIL>)
@Copy Right: Copyright © 2019-2020 HUST. All Rights Reserved.
@Requirement: Python-3.7.4, TensorFlow-1.4, Kears-2.2.4
"""
import warnings
import kera... | 2.046875 | 2 |
autofit/example/analysis.py | rhayes777/AutoFit | 0 | 12792683 | from os import path
import os
import matplotlib.pyplot as plt
import numpy as np
import autofit as af
"""
The `analysis.py` module contains the dataset and log likelihood function which given a model instance (set up by
the non-linear search) fits the dataset and returns the log likelihood of that model.
""... | 3.15625 | 3 |
app/controllers/__init__.py | jattoabdul/vanhack-cms | 15 | 12792684 | <reponame>jattoabdul/vanhack-cms
'''The controllers package'''
from .base_controller import BaseController
| 1.085938 | 1 |
rnaseq_pipeline/utils.py | ppavlidis/rnaseq-pipeline | 0 | 12792685 | import logging
import uuid
import luigi
from luigi.task import flatten_output
from luigi.parameter import ParameterVisibility
logger = logging.getLogger('luigi-interface')
class IlluminaFastqHeader:
@classmethod
def parse(cls, s):
pieces = s.split(':')
if len(pieces) == 5:
device,... | 2.234375 | 2 |
python/target_selection/cartons/mwm_yso.py | sdss/target_selection | 3 | 12792686 | <reponame>sdss/target_selection
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>)
# @Date: 2020-06-10
# @Filename: mwm_yso.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
import peewee
from sdssdb.peewee.sdss5db.catalogdb import (MIPSGAL, AllWise, Catalog,
... | 1.90625 | 2 |
docker_compose_deploy/loonflow_shutongflow/setup_shutongflow.py | youjiajia/loonflow | 2 | 12792687 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
@author: children1987
"""
from utils import get_config_info, replace_in_file
def main():
cfg_file = '/opt/shutongFlow/apps/apps/settings.py'
# 修改数据库配置
replace_in_file(cfg_file, "'USER': 'shutongflow'", "'USER': 'root'")
config_info = get_config_... | 2.015625 | 2 |
docker/scripts/split_primers.py | OncoRNALab/CIRCprimerXL | 0 | 12792688 | <gh_stars>0
#!/usr/bin/python3
import argparse
parser = argparse.ArgumentParser(description='give arguments to main primer_xc script')
parser.add_argument('-i', nargs=1, required=True, help='input primer file')
args = parser.parse_args()
input_primers = args.i[0]
primer_in = open(input_primers)
primers = {}
circ_i... | 3.078125 | 3 |
src/pce/adaptive_pce.py | QianWanghhu/IES-FF | 0 | 12792689 |
import numpy as np
import pandas as pd
from veneer.pest_runtime import *
from veneer.manage import start,kill_all_now
import pyapprox as pya
from functools import partial
from pyapprox.adaptive_sparse_grid import max_level_admissibility_function
from pyapprox.adaptive_polynomial_chaos import variance_pce_refinement_... | 2.046875 | 2 |
app/models/base.py | xiaojieluo/flask_restapi_template | 0 | 12792690 | from datetime import datetime
from flask_sqlalchemy import SQLAlchemy as _SQLAlchemy, BaseQuery
from sqlalchemy import inspect, Column, Integer, SmallInteger, orm
from contextlib import contextmanager
from app.libs.error_code import NotFound
class SQLAlchemy(_SQLAlchemy):
@contextmanager
def auto_commit(self)... | 2.3125 | 2 |
PhaseBot/bot.py | Pythogon/PhaseBot | 6 | 12792691 | import os
import discord
import Cogs #type: ignore
import glo #type: ignore
from discord.ext import commands
class PhaseBot(commands.Bot):
""" The bot """
async def on_ready(self):
print("Discodo!") # Great, it's working
await bot.change_presence(activity = discord.Activity(name = f"my start... | 2.359375 | 2 |
usl_score/models/__init__.py | vitouphy/usl_dialogue_metric | 5 | 12792692 | name="models"
from .VUPScorer import *
from .NUPScorer import *
from .MLMScorer import *
from .distinct import *
from .composite import *
| 1.070313 | 1 |
rastro_python/setup.py | duncaneddy/rastro | 1 | 12792693 | <reponame>duncaneddy/rastro
#!/usr/bin/env python
from setuptools import setup
from setuptools_rust import RustExtension
from os import path
if __name__ == "__main__":
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_... | 1.351563 | 1 |
Its-Fair-Game-Day-JC.py | maleich/Its-Fair-Game-Day-JC | 0 | 12792694 | import random
import time
print("this game is blackjack. If you are wondering which focus day this is connected to, it isn't connected to any of them. ")
print()
print("I started making it, and I forgot it had to be related to a focus day, but it was too late to switch, so here it is ")
print()
print("how to play: your... | 3.6875 | 4 |
tests/cli/check_mode_test.py | twanh/note-system | 1 | 12792695 | <reponame>twanh/note-system
import os
from typing import List
from unittest.mock import Mock
from unittest.mock import patch
import pytest
from py.path import local as Path
from notesystem.modes.base_mode import ModeOptions
from notesystem.modes.check_mode.check_mode import CheckMode
from notesystem.modes.check_mode.... | 2.28125 | 2 |
inst/tdda/referencetest/referencetest.py | noamross/tdda | 4 | 12792696 | <filename>inst/tdda/referencetest/referencetest.py
# -*- coding: utf-8 -*-
"""
referencetest.py: refererence testing for test-driven data analysis.
Source repository: http://github.com/tdda/tdda
License: MIT
Copyright (c) Stochastic Solutions Limited 2016
"""
from __future__ import absolute_import
from __future__ ... | 2.546875 | 3 |
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/NV/texgen_reflection.py | JE-Chen/je_old_repo | 0 | 12792697 | <gh_stars>0
'''OpenGL extension NV.texgen_reflection
This module customises the behaviour of the
OpenGL.raw.GL.NV.texgen_reflection to provide a more
Python-friendly API
Overview (from the spec)
This extension provides two new texture coordinate generation modes
that are useful texture-based lighting a... | 1.351563 | 1 |
mlpractice/datasets/__init__.py | SYAN83/machine-learning-practice | 0 | 12792698 |
import pandas
import os
PATH_TO_DATASETS = './mlpractice/datasets/'
class DataSet(object):
def __init__(self, dir_name, extensions=['.csv'], path_to_datasets=PATH_TO_DATASETS):
data_dir = os.path.join(path_to_datasets, dir_name)
for file_name in os.listdir(data_dir):
name, ext = os... | 2.96875 | 3 |
meggie/actions/raw_resample/dialogs/resamplingDialogUi.py | Teekuningas/meggie | 4 | 12792699 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resamplingDialogUi.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_resamplingDialog(object):
def setupUi(self, resamplingDia... | 1.875 | 2 |
tests/st/ops/gpu/test_relu_op.py | GuoSuiming/mindspore | 3,200 | 12792700 | <reponame>GuoSuiming/mindspore<filename>tests/st/ops/gpu/test_relu_op.py
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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.or... | 2.171875 | 2 |
tests/project/app.py | Zadigo/Zah | 0 | 12792701 | from zah.router.app import Router
# from zah.store import Store
from zah.urls import render, render_page
from zah.core.servers import BaseServer, DevelopmentServer
from zah.shortcuts import get_default_server
app = BaseServer()
# app = get_default_server()
# app.use_component(Router)
# app.use_component(Store)
# def ... | 1.960938 | 2 |
decipher/parse_decipher.py | MRCIEU/mendelvar_standalone | 3 | 12792702 | <filename>decipher/parse_decipher.py
#!/usr/bin/env python
import csv, re, argparse
ap = argparse.ArgumentParser()
ap.add_argument('--delimit',required=True,type=str,help='Delimiter used in the file')
ap.add_argument('--input',required=True,type=str,help='Input file')
args = ap.parse_args()
hpo_re = r"HP\:\d+"
if a... | 3.421875 | 3 |
util/util.py | pkufergus/pingeci | 2 | 12792703 | <reponame>pkufergus/pingeci
# -*- coding: utf-8 -*-
import os
import logging
import logging.handlers
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
log = None
def get_log(name="main"):
global log
if log:
return log
log = logging.getLogger('log')
log.setLevel(logging.DEBUG)
# logG.se... | 2.234375 | 2 |
Utilities/Scripts/SlicerWizard/__version__.py | forfullstack/slicersources-src | 0 | 12792704 | __version_info__ = (
4,
11,
0,
"dev0"
)
__version__ = ".".join(map(str, __version_info__))
| 1.3125 | 1 |
tools/visualization/alpha_bind.py | happywu/mmaction2-CycleContrast | 0 | 12792705 | import argparse
import os.path as osp
import mmcv
def parse_args():
parser = argparse.ArgumentParser(
description='Process a checkpoint to be published')
parser.add_argument('img_dir', help='img config directory')
parser.add_argument('gt_dir', help='gt config directory')
parser.add_argument('... | 2.703125 | 3 |
codewars/8 kyu/is-the-string-uppercase.py | sirken/coding-practice | 0 | 12792706 | <reponame>sirken/coding-practice
from Test import Test, Test as test
'''
Is the string uppercase?
Task
Create a method is_uppercase() to see whether the string is ALL CAPS. For example:
is_uppercase("c") == False
is_uppercase("C") == True
is_uppercase("hello I AM DONALD") == False
is_uppercase("HELLO I AM DONALD") ==... | 4.5 | 4 |
plumeria/util/__init__.py | sk89q/plumeria | 18 | 12792707 | <gh_stars>10-100
MIME_TYPES = {
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.gif': 'image/gif',
'.txt': 'text/plain',
}
def to_mimetype(ext):
if ext.lower() in MIME_TYPES:
return MIME_TYPES[ext.lower()]
else:
return "application/octet-stream"
| 2.390625 | 2 |
netanalysis/tls/domain_ip_validator.py | Jigsaw-Code/net-analysis | 88 | 12792708 | <filename>netanalysis/tls/domain_ip_validator.py
# Copyright 2018 Jigsaw Operations LLC
#
# 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
#
#... | 2.34375 | 2 |
koku/reporting_common/migrations/0022_auto_20200505_1707.py | cgoodfred/koku | 2 | 12792709 | <filename>koku/reporting_common/migrations/0022_auto_20200505_1707.py
# Generated by Django 2.2.12 on 2020-05-05 17:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("reporting_common", "0021_delete_reportcolumnmap")]
operations = [
migrations.RunSQL(
... | 1.445313 | 1 |
cliente_chat.py | albertopeces2000/Chat | 0 | 12792710 | <gh_stars>0
import socket
import sys
cliente_chat = socket.socket()
cliente_chat.connect( ('192.168.1.45',8080) ) #Se conecta con el servidor_chat
repetir = True
while repetir:
try:
##################################################
msg = input('>>: ')
if msg == 'salir':
... | 3.109375 | 3 |
tests/test_mujoco_rl.py | HumanCompatibleAI/seals | 23 | 12792711 | <filename>tests/test_mujoco_rl.py
"""Test RL on MuJoCo adapted environments."""
from typing import Tuple
import gym
import pytest
import stable_baselines3
from stable_baselines3.common import evaluation
import seals # noqa: F401 Import required for env registration
def _eval_env(
env_name: str,
total_time... | 2.375 | 2 |
mundo 3/083.py | thiagofreitascarneiro/Curso-de-Python---Curso-em-Video | 1 | 12792712 | <reponame>thiagofreitascarneiro/Curso-de-Python---Curso-em-Video<gh_stars>1-10
valor = str(input('Digite uma expressão: '))
quant_Abrir = valor.count('(')
quant_Fechar = valor.count(')')
print(quant_Fechar)
print(quant_Abrir)
if quant_Fechar % 2 == 0 and quant_Abrir % 2 == 0:
print('Essa expressão está correta!')
e... | 3.71875 | 4 |
experiment/ConvNet.py | callous-youth/IAPTT-GM | 2 | 12792713 |
import torch.nn as nn
import logging
logger = logging.getLogger(__name__)
def conv3x3(in_channels, out_channels,activation=nn.ReLU(inplace=True)):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1), nn.MaxPool2d(2),
nn.BatchNorm2d(out_channels, momentum=1., affine=T... | 2.703125 | 3 |
audioengine/model/finetuning/wav2vec2/helper/wav2vec2_trainer.py | NiklasHoltmeyer/stt-audioengine | 0 | 12792714 | # Source: https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_Tune_XLSR_Wav2Vec2_on_Turkish_ASR_with_%F0%9F%A4%97_Transformers.ipynb#scrollTo=lbQf5GuZyQ4_
import collections
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Union
import numpy as np
import... | 2.734375 | 3 |
apps/app/urls.py | MiloshBogdanovic/Auri-Soft | 0 | 12792715 | <reponame>MiloshBogdanovic/Auri-Soft
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from django.urls import path, re_path
from apps.app import views
urlpatterns = [
# The home page
path('', views.index, name='home'),
# Matches any html file
path('bonus-faccata/', views.bon... | 1.90625 | 2 |
Curso_Guanabara/aula57.py | lucianojunnior17/Python | 1 | 12792716 | <filename>Curso_Guanabara/aula57.py<gh_stars>1-10
sexo = str(input('Informe seu sexo : ')).strip().upper()[0]
while sexo not in 'MmFf':
sexo = str(input('Dados invalidos Por favor digite novamente : ')).strip().upper()[0]
print('Sexo {} registrado com sucesso'.format(sexo))
| 3.65625 | 4 |
Source/Chapter5/Linear.py | irmoralesb/MLForDevsBook | 0 | 12792717 | from Chapter5.TransferFunction import TransferFunction
import numpy as np
class Linear(TransferFunction):
def getTransferFunction(x):
return x
def getTransferFunctionDerivative(x):
return np.ones(len(x))
| 3.0625 | 3 |
pillow_heif/__init__.py | bigcat88/pillow_heif | 20 | 12792718 | <gh_stars>10-100
from .constants import * # pylint: disable=unused-wildcard-import
from .reader import HeifFile, UndecodedHeifFile, check, read, open # pylint: disable=redefined-builtin,unused-import
from .writer import write # pylint: disable=unused-import
from .error import HeifError # pylint: disable=unused-impo... | 1.757813 | 2 |
notebooks/GTO/Transits/GJ436_GRISMR/PyNRC_2D_Spec_Gen.py | kammerje/pynrc | 1 | 12792719 | import numpy, sys, math, batman
import matplotlib.pyplot as plt
from scipy import interpolate
file = numpy.load('GJ436b_Trans_SED.npz')
SEDarray = file['SEDarray']
print(SEDarray.shape)
plt.imshow(SEDarray)
plt.show()
stellarwave, stellarspec = numpy.loadtxt('ODFNEW_GJ436.spec', unpack=True, skiprows=800)
stellarwave... | 1.9375 | 2 |
wagtailmenus/migrations/0010_auto_20160201_1558.py | pierremanceaux/wagtailmenus | 329 | 12792720 | <reponame>pierremanceaux/wagtailmenus
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailmenus', '0009_auto_20160201_0859'),
]
operations = [
migrations.RenameField(
... | 1.570313 | 2 |
envrun/utils.py | JanLikar/envrun | 1 | 12792721 | <reponame>JanLikar/envrun
import sys
def eprint(*args, **kwargs):
"""Print to stderr."""
print(*args, file=sys.stderr, **kwargs)
def bail(error: str):
"""Print message to stderr and exit with an error code."""
eprint(error)
sys.exit(1)
| 2.265625 | 2 |
test/integration/data_consistency_test.py | dineshsonachalam/dynofunc | 6 | 12792722 | <gh_stars>1-10
import json
import pytest
from functools import partial
from boto3 import client
from test.integration.fixtures import db
from dynofunc import (
create,
find,
add,
update,
delete,
query
)
def test_numbers_are_not_changed(db):
"""Asserts that numbers inserted into dynamo are... | 2.53125 | 3 |
src/zapv2/users.py | tnir/zap-api-python | 146 | 12792723 | # Zed Attack Proxy (ZAP) and its related class files.
#
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
#
# Copyright 2017 the ZAP development team
#
# 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... | 2.234375 | 2 |
webgrid/tests/test_testing.py | sourcery-ai-bot/webgrid | 9 | 12792724 | <reponame>sourcery-ai-bot/webgrid<filename>webgrid/tests/test_testing.py
import datetime as dt
from io import BytesIO
from unittest import mock
import pytest
import xlsxwriter
import xlwt
from webgrid import testing
from webgrid_ta.grids import RadioGrid, TemporalGrid
from webgrid_ta.model.entities import Person, db
... | 2.375 | 2 |
setup.py | jianlins/quicksect | 0 | 12792725 | from Cython.Build import cythonize
from setuptools.extension import Extension
from setuptools import setup, find_packages
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
include_dirs = [dir_path + "/src", dir_path]
macros = [("CYTHON_TRACE", "1")]
extensions = [Extension("quicksect", ["src/quicksect.py... | 1.578125 | 2 |
server/python_server/notes_app_server/server.py | jarmoj/notesapp-react-redux-boilerplate | 1 | 12792726 | """A simple server with a REST API for the Notes App frontend."""
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.escape
from tornado_cors import CorsMixin
import logging
import json
import os
import signal
import sys
PORT = 3456
DB_PATH = "db.json"
TEST_DB_PATH = "test/test_db.json"
d... | 2.765625 | 3 |
test/inserted_test.py | screamingskulls/sofi | 402 | 12792727 | from sofi.ui import Inserted
def test_basic():
assert(str(Inserted()) == "<ins></ins>")
def test_text():
assert(str(Inserted("text")) == "<ins>text</ins>")
def test_custom_class_ident_style_and_attrs():
assert(str(Inserted("text", cl='abclass', ident='123', style="font-size:0.9em;", attrs={"data-test": '... | 2.375 | 2 |
Unsupervised-Texture-Segmentation-Using-Gabor-Filter-master/_utils.py | yimingq/DC-Project | 10 | 12792728 |
import math
import sklearn.cluster as clstr
import cv2
import numpy as np
from PIL import Image, ImageOps, ImageDraw
import os, glob
import matplotlib.pyplot as pyplt
import scipy.cluster.vq as vq
import argparse
import glob
# We can specify these if need be.
brodatz = "D:\\ImageProcessing\\project\\OriginalBrodatz\\... | 2.578125 | 3 |
psc_kmed.py | suwangcompling/picking-apart-story-salads | 5 | 12792729 | # Copyright 2018 @<NAME>. 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 required by applicable law or agre... | 1.789063 | 2 |
assets/data_asset/mnist_index_files.py | natashadsilva/sample.edge-mnist-notebook | 0 | 12792730 | <reponame>natashadsilva/sample.edge-mnist-notebook
import numpy as np
from PIL import Image, ImageOps
import io
# Training and test data set files, all labeled
FN_TEST_LABELS = 'data/mnist/t10k-labels-idx1-ubyte'
FN_TEST_IMAGES = 'data/mnist/t10k-images-idx3-ubyte'
FN_TRAIN_LABELS = 'data/mnist/train-labels-idx1-ubyte... | 2.703125 | 3 |
info/reviews/db_utils.py | DennisKasper/info | 6 | 12792731 | <gh_stars>1-10
from aiopg.sa import SAConnection as SAConn
from aiopg.sa.result import RowProxy
from info.reviews.tables import review
async def select_review_by_id(conn: SAConn, pk: int) -> RowProxy:
cursor = await conn.execute(
review.select().where(review.c.id == pk)
)
item = await cursor.fetch... | 2.484375 | 2 |
botcommands/utils.py | pastorhudson/mtb-pykeybasebot | 0 | 12792732 | <reponame>pastorhudson/mtb-pykeybasebot
from crud import s
from models import Team, User
def get_team_user(team_name, username):
team = s.query(Team).filter_by(name=team_name).first()
user = s.query(User).filter_by(username=username).first()
return team, user
def get_team(team_name):
team = s.query... | 2.390625 | 2 |
website.py | 85599/power-napp | 2 | 12792733 | <reponame>85599/power-napp<filename>website.py
from flask import Flask, render_template, request, redirect, session
app = Flask(__name__)
@app.route('/',methods=['GET','POST'])
def website():
if request.method=="GET":
return render_template('index.html')
else:
return render_template('index.ht... | 2.328125 | 2 |
tests/test_script_pipeline.py | Forks-yugander-krishan-singh/jenkins-job-builder-pipeline | 0 | 12792734 | <filename>tests/test_script_pipeline.py
from base import assert_case
def test_script_pipeline():
assert_case('script_pipeline')
| 1.734375 | 2 |
data camp/Dictionarty_part_2.py | hamzashabbir11/dataStructures | 0 | 12792735 | <reponame>hamzashabbir11/dataStructures<filename>data camp/Dictionarty_part_2.py
europe = { 'spain': { 'capital':'madrid', 'population':46.77 },
'france': { 'capital':'paris', 'population':66.03 },
'germany': { 'capital':'berlin', 'population':80.62 },
'norway': { 'capital':'oslo', 'pop... | 2.859375 | 3 |
insights/components/openstack.py | lhuett/insights-core | 121 | 12792736 | """
IsOpenStackCompute
==================
The ``IsOpenStackCompute`` component uses ``PsAuxcww`` parser to determine
OpenStack Compute node. It checks if 'nova-compute' process exist, if not raises
``SkipComponent`` so that the dependent component will not fire. Can be added as
a dependency of a parser so that the par... | 2.46875 | 2 |
APITest/TestSourceAPI.py | josephramsay/LDSAPI | 0 | 12792737 | <reponame>josephramsay/LDSAPI
'''
Created on 17/12/2013
@author: jramsay
'''
#https://koordinates.com/services/api/v1/sources/1/
import unittest
import json
import os
from APIInterface.LDSAPI import SourceAPI
from .TestFileReader import FileReader
from .TestSuper import APITestCase
sources = (
("Alices' Mapin... | 1.4375 | 1 |
02_oop/01_classes_and_objects/03_initializing_with_optional_params.py | doanthanhnhan/learningPY | 1 | 12792738 | <filename>02_oop/01_classes_and_objects/03_initializing_with_optional_params.py
class Employee:
# defining the properties and assigning None to them
def __init__(self, ID=None, salary=0, department=None):
self.ID = ID
self.salary = salary
self.department = department
# creating an object of the Employ... | 4.15625 | 4 |
income_expense_tracker/dashboard/urls.py | gokul-sarath07/Nymblelabs-Expence-Tracker | 0 | 12792739 | <gh_stars>0
from django.urls import path
from . import views
"""Url pattern for dashboard view."""
urlpatterns = [
path('', views.index, name="home"),
]
| 1.460938 | 1 |
config/custom_components/motioneye/camera.py | azogue/hassio_config | 18 | 12792740 | <gh_stars>10-100
"""
Support for MotionEye Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.motioneye/
"""
import asyncio
import logging
from urllib.parse import urlparse
import re
import aiohttp
import async_timeout
import voluptuous as v... | 2.015625 | 2 |
Tesi/other/benchmarkChart.py | LucaCamerani/EcoFin-library | 9 | 12792741 | <reponame>LucaCamerani/EcoFin-library
"""
benchmarkChart.py
Created by <NAME> at 06/02/2021, University of Milano-Bicocca.
(<EMAIL>)
All rights reserved.
This file is part of the EcoFin-Library (https://github.com/LucaCamerani/EcoFin-Library),
and is released under the "BSD Open Source License".
"""
import matplotli... | 2 | 2 |
alipay/aop/api/domain/SceneConfigQueryDTO.py | antopen/alipay-sdk-python-all | 0 | 12792742 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class SceneConfigQueryDTO(object):
def __init__(self):
self._business_scene = None
self._group_id = None
self._isv_name = None
self._pid = None
self._school_id =... | 1.945313 | 2 |
src/wafec/fi/hypothesis/controllers/_route.py | wafec/wafec-fi-hypothesis | 0 | 12792743 | from . import app, api
from . import TestController, TestParameterController
from threading import Lock
TEST_PARAMETER_LOCK = Lock()
api.add_resource(TestController, '/api/tests')
api.add_resource(TestParameterController, '/api/parameters',
resource_class_kwargs ={'lock_obj': TEST_PARAMETER_LOCK})
| 2.03125 | 2 |
ape_console_extras.py | unparalleled-js/ape-demo-project | 0 | 12792744 | <gh_stars>0
import json
import click
from ape.logging import logger
def ape_init_extras(accounts, project, config, networks):
ecosystem = networks.provider.network.ecosystem.name
network = networks.provider.network.name
extras = {}
try:
if ecosystem in config.deployments:
ecosys... | 2.046875 | 2 |
calc_HI_rms.py | sjforeman/RadioFisher | 3 | 12792745 | #!/usr/bin/python
"""
Calculate signal power as a function of frequency.
"""
import numpy as np
import pylab as P
import scipy.integrate
import baofisher
import experiments
from experiments import cosmo
from units import *
import copy
nu21 = 1420. # Line frequency at z=0
# Pre-calculate cosmological qu... | 2.609375 | 3 |
analysis-master/tra_analysis/equation/parser/__init__.py | titanscout2022/red-alliance-analysis | 2 | 12792746 | # Titan Robotics Team 2022: Expression submodule
# Written by <NAME>
# Notes:
# this should be imported as a python module using 'from tra_analysis.Equation import parser'
# setup:
__version__ = "0.0.4-alpha"
__changelog__ = """changelog:
0.0.4-alpha:
- moved individual parsers to their own files
0.0.3-alpha:
... | 1.890625 | 2 |
tirelire-auth/tests/unit/test_handlers.py | AgRenaud/tirelire | 0 | 12792747 | <reponame>AgRenaud/tirelire
from unittest import TestCase
from typing import List
from app import bootstrap
from app.domain import commands, model
from app.service_layer import handlers
from app.service_layer.unit_of_work import UnitOfWork
from app.service_layer.auth_service import AuthService
class FakeRepository:... | 2.578125 | 3 |
venv/Lib/site-packages/txclib/wizard.py | star10919/drf | 2 | 12792748 | import os
from slugify import slugify
from txclib import messages
from txclib import utils
from txclib.api import Api
from txclib.project import Project
from txclib.log import logger
from six.moves import input
COLOR = "CYAN"
try:
import readline
readline.set_completer_delims(' \t\n;')
readline.parse_an... | 2.3125 | 2 |
Monopoly/Tiles.py | KGB33/Monopoly | 2 | 12792749 | <reponame>KGB33/Monopoly<gh_stars>1-10
from abc import ABC, abstractmethod
from UserEntity import Player, Bank, FreeParking
from InputValidation import get_yes_or_no_input
from random import randint
from Exceptions import TilesClassNotFoundError
class Location(ABC):
"""
Abstract Parent Class for all locations... | 3.6875 | 4 |
cli.py | GIScience/hot-tm-critical-numbers | 1 | 12792750 | <gh_stars>1-10
import click
import json
from critical_numbers import app
from critical_numbers.logic import api_requests, converter
@click.group()
def cli():
pass
@cli.command('serve')
def serve():
'''serves webapp to 127.0.0.1:5000'''
app.run()
@cli.command('getall')
def getall():
... | 2.4375 | 2 |