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 |
|---|---|---|---|---|---|---|
users/forms.py | amjadcp/bookingLine-grpA-miniProject | 0 | 43600 | <filename>users/forms.py
from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import *
class SignupForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email', 'password1', '<PASSWORD>')
def __init__(self, *a... | 2.484375 | 2 |
Web_Development_Python/RealPython/sql/11_sql.py | nitin-cherian/LifeLongLearning | 4 | 43601 | <gh_stars>1-10
# JOINing data from multiple tables
# import sqlite3 library
import sqlite3
with sqlite3.connect("new.db") as connection:
c = connection.cursor()
c.execute("""SELECT DISTINCT population.city, population.population, regions.region
FROM population,regions
WHE... | 3.71875 | 4 |
examples/ImageRecon/GEOmetrics/train.py | Tarkiyah/kaotlin | 2 | 43602 | # Copyright (c) 2019, NVIDIA CORPORATION. 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 applicabl... | 1.679688 | 2 |
tests/foofixtures.py | dannguyen/pgark | 1 | 43603 | import pytest
import responses
import json as jsonlib
from pathlib import Path
import pgark
import pgark.archivers.wayback as wb
FIXTURES_DIR = Path("tests/fixtures/_old")
@pytest.fixture
def success_urls():
target_url = "https://plainlanguage.gov/"
expected_url = wb.url_for_snapshot(target_url, "202009041... | 2.109375 | 2 |
alien.py | alaanlimaa/jogo_invasao_alienigena | 0 | 43604 | import pygame as pg
from pygame.sprite import Sprite
class Alien(Sprite):
"""Uma classe que representa um único alienígena da frota."""
def __init__(self, config, tela):
super(Alien, self).__init__()
self.tela = tela
self.config = config
# Carrega a imagem do alienígena e def... | 3.484375 | 3 |
core/settings.py | ZeroExistence/blog_moe_ph_api | 0 | 43605 | <filename>core/settings.py
"""
Django settings for core project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/set... | 1.804688 | 2 |
object_detection2/modeling/onestage_heads/fcos_outputsv2.py | vghost2008/wml | 6 | 43606 | <filename>object_detection2/modeling/onestage_heads/fcos_outputsv2.py
#coding=utf-8
import tensorflow as tf
import wml_tfutils as wmlt
import wnn
import functools
import tfop
import object_detection2.bboxes as odbox
from object_detection2.standard_names import *
import wmodule
from object_detection2.modeling.onestage_h... | 2.171875 | 2 |
db_controller.py | ejeiffe/Reference-Manager | 2 | 43607 | import sqlite3
class DbController:
"""Allows user to update and search reference database"""
def __init__(self, db_name):
self.db_name = db_name
#Default sql statement for displaying search results. Search terms may be concatenated to this string.
self.search_default_sql = """SEL... | 4 | 4 |
tests/test_schemas/full_put_schema.py | gavrie/swagger-conformance | 55 | 43608 | <reponame>gavrie/swagger-conformance
'''
A simple REST API exposing a swagger schema.
'''
import logging
import os.path
from flask import request
from flask_restplus import Resource, fields
from common import main, api
log = logging.getLogger(__name__)
example_ns = api.namespace('example', description="Example op... | 2.46875 | 2 |
ssu-calculus-methods/cubic_spline.py | Imperat/SSU-Information-Security-Course | 0 | 43609 | <gh_stars>0
from math import sin
ys = [sin(i) for i in range(1,3.14, 0.2)]
xs = range(1, 3.14, 0.2)
def h(k):
return xs[k] - xs[k-1]
def f_r(k):
return (ys[k] - ys[k-1]) / h(k)
lamba1 = (3 * f_r(2) - 3 * f_r(1)) / (2 * (h(1) + h(2)))
delta1 = - h(2) / (2 * (h(1) + h(2)))
deltas = [delta1]
la... | 2.875 | 3 |
src/pyams_thesaurus/zmi/term.py | Py-AMS/pyams-thesaurus | 0 | 43610 | #
# Copyright (c) 2015-2021 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | 1.484375 | 1 |
experiments/mol/configs.py | shyam196/egc | 18 | 43611 | import torch
import torch.nn.functional as F
from exptune.exptune import ExperimentSettings, Metric, TrialResources
from exptune.hyperparams import (
ChoiceHyperParam,
LogUniformHyperParam,
UniformHyperParam,
)
from exptune.search_strategies import GridSearchStrategy
from exptune.summaries.final_run_summari... | 1.484375 | 1 |
zou_2021/strain_energy.py | andrewtarzia/citable_data | 0 | 43612 | <reponame>andrewtarzia/citable_data
from os.path import exists
import json
import stk
from atools import (
get_organic_linkers, calculate_energy, read_gfnx2xtb_eyfile
)
def calculate_ligand_SE(
org_ligs,
sdict,
opt_mol_dir,
output_json,
):
"""
Calculate the strain energy of each ligand i... | 2.453125 | 2 |
openCV/ShowImage.py | MatveiAleksandrovich/Artificial-Intelligence | 0 | 43613 | import cv2
img = cv2.imread('assets/PersLogo_4.jpg', -1)
img = cv2.resize(img, (0, 0), fx=0.5, fy=0.5)
img = cv2.rotate(img, cv2.cv2.ROTATE_90_COUNTERCLOCKWISE)
cv2.imwrite('assets/new_img.jpg', img)
cv2.imshow('Image ', img)
cv2.waitKey(0)
cv2.destroyWindow()
| 2.828125 | 3 |
angr/procedures/posix/accept.py | Kyle-Kyle/angr | 6,132 | 43614 | import angr
######################################
# accept (but not really)
######################################
class accept(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, sockfd, addr, addrlen):
conc_addrlen = self.state.mem[addrlen].int.concrete
addr_data = self.stat... | 2.34375 | 2 |
common/evaluate.py | Ji-Xin/bovina | 6 | 43615 | <gh_stars>1-10
from common.evaluators.diff_token_evaluator import DiffTokenEvaluator
from common.evaluators.paired_token_evaluator import PairedTokenEvaluator
class EvaluatorFactory(object):
"""
Get the corresponding Evaluator class for a particular dataset.
"""
evaluator_map = {
'ApacheDiffTo... | 2.328125 | 2 |
cluster_scripts/gen_train_exp.py | LasseWolter/laughter-detection-icsi | 0 | 43616 | <filename>cluster_scripts/gen_train_exp.py
#!/usr/bin/env python3
"""Script for generating experiments.txt"""
import os
from lxml import etree
from dotenv import load_dotenv, find_dotenv
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
from config import ANALYSIS as cfg
load_doten... | 2.4375 | 2 |
nuts.py | rasmuse/subnational-p-budgets | 0 | 43617 | <gh_stars>0
import pandas as pd
import eust
import hierarchy
import settings
def get_nuts_candidates():
return (
eust.read_nuts_codes(settings.NUTS_VERSION, drop_extra_regio=True)
.loc[lambda d: d.nuts_level <= 2]
.loc[lambda d: ~d.index.isin(settings.EXCLUDED_NUTS)]
)
def get_nuts_a... | 2.359375 | 2 |
alembic/versions/d365c792c756_convert_two_streets_cache_to_single.py | shaysw/anyway | 1 | 43618 | """convert-two-streets-cache-to-single
Revision ID: d365c792c756
Revises: <KEY>
Create Date: 2021-12-30 16:57:22.196091
"""
# revision identifiers, used by Alembic.
revision = 'd365c792c756'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from typing imp... | 1.65625 | 2 |
cachefy.py | aspnetcs/RecurJac-and-CROWN | 54 | 43619 | #!/usr/bin/env python3
## cachefy.py
##
## Add or remove numba "cache" decorators
##
## Copyright (C) 2018, <NAME> <<EMAIL>> and contributors
##
## This program is licenced under the BSD 2-Clause License,
## contained in the LICENCE file in this directory.
## See CREDITS for a list of contributors.
##
import sys
imp... | 2.765625 | 3 |
visualization/visualizer/__init__.py | zhigangjiang/LGT-Net | 11 | 43620 | <filename>visualization/visualizer/__init__.py<gh_stars>10-100
"""
@Date: 2021/11/06
@description:
"""
| 0.902344 | 1 |
__init__.py | felipedeaquino/firstFm | 0 | 43621 | <reponame>felipedeaquino/firstFm
__version__ = '0.1.0'
from urllib.request import urlopen
import datetime
from datetime import timedelta
from bs4 import BeautifulSoup
inputUser = input('Qual nick do Last.fm tu quer o relatório? ') #inserir usuário
now = datetime.datetime.now().timestamp() #manda timestamp de agora
b... | 3.234375 | 3 |
ML/website-scraping-w-python-master/Chapter 3/downloader.py | praveenpmin/Python | 0 | 43622 | import requests
from bs4 import BeautifulSoup, SoupStrainer
from chapter_3.file_cache import FileCache
class Downloader:
def __init__(self, cache=None, parser='html.parser', hard_cache=True):
if not cache:
self.cache = FileCache('sainsbury_compressed', compressed=True)
else:
... | 2.8125 | 3 |
graph_display.py | viewfindercode/movie-revenue-graph | 0 | 43623 | <reponame>viewfindercode/movie-revenue-graph
import pandas as pd
from bokeh.io import show, curdoc
from bokeh.models import ColumnDataSource, HoverTool, Select, Axis, CustomJS
from bokeh.plotting import figure, output_file
from bokeh.layouts import column
df = pd.read_csv('path file to...HighestGrossingFilms.csv')
n... | 2.78125 | 3 |
backend/improvements/mine.py | aecobb53/civ_vi_city_planner | 2 | 43624 | <filename>backend/improvements/mine.py
from backend.common_tile import CommonTile
class Mine(CommonTile):
def __init__(self):
super().__init__()
self.production = 1
self.appeal = -1
self.acceptable_terrain = [
'deserth',
'grasslandh',
'plainsh',... | 2.625 | 3 |
my_robot_control/scripts/system/control_robot.py | Siffran/DAT295-KW2 | 0 | 43625 | import rospy
from std_msgs.msg import Float64
def set_wheel_velocity(velocity):
pub1 = rospy.Publisher('/my_robot/joint_wheel_1_controller/command', Float64, queue_size=10)
pub2 = rospy.Publisher('/my_robot/joint_wheel_2_controller/command', Float64, queue_size=10)
rate = rospy.Rate(2) # 2hz
rate.slee... | 2.3125 | 2 |
interceptor/migrations/0006_auto_20200514_0637.py | minrock/thaad | 0 | 43626 | # Generated by Django 3.0.5 on 2020-05-14 06:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('interceptor', '0005_auto_20200514_0617'),
]
operations = [
migrations.AddField(
model_name='int... | 1.53125 | 2 |
scripts/sample_data/discourse_1369.py | gmatteo/awesome-panel | 179 | 43627 | import panel as pn
def test_alert():
my_alert = pn.pane.Alert("foo", alert_type="primary")
my_button = pn.widgets.Button(name="Toggle")
def toggle(event):
if my_alert.alert_type == "primary":
my_alert.alert_type == "success"
else:
my_alert.alert_type = "... | 2.671875 | 3 |
pose/custom/gesture_model.py | Event0511/curling-reid | 3 | 43628 | <reponame>Event0511/curling-reid
import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms import ToTensor
class Model(nn.Module):
"""
定义了一个简单的三层全连接神经网络,每一层都是线性的
"""
def __init__(self, in_dim, n_hidden1, out_dim):
super().__i... | 2.8125 | 3 |
python/tests/test_integration_domains.py | cmaurini/dolfinx_mpc | 0 | 43629 | <filename>python/tests/test_integration_domains.py<gh_stars>0
# Copyright (C) 2020 <NAME>
#
# This file is part of DOLFINX_MPC
#
# SPDX-License-Identifier: MIT
import dolfinx.fem as fem
import dolfinx_mpc
import numpy as np
import pytest
import scipy.sparse.linalg
import ufl
from dolfinx.common import Timer, Timin... | 1.890625 | 2 |
technical_test/order_status/migrations/0004_alter_orderstatus_options.py | R3dward/technical_test_django_n_mysql | 0 | 43630 | # Generated by Django 3.2.4 on 2021-06-10 23:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('order_status', '0003_alter_orderstatus_bought_by'),
]
operations = [
migrations.AlterModelOptions(
name='orderstatus',
optio... | 1.492188 | 1 |
Python/Courses/Python-Tutorials.Zulkarnine-Mahmud/00.Fundamentals/02.01-Complicated-Logic.py | shihab4t/Books-Code | 0 | 43631 | <gh_stars>0
def complicated_logic(first, second):
print(f"You passed: {first}, {second}")
# return first + second * 12 - 4 * 12
number1 = 10
number2 = 3
result = complicated_logic(number1, number2)
print(result)
| 3.390625 | 3 |
src/migrations/versions/0930fdefb325_initial_migration.py | vishaltanwar96/Py-iTrack | 4 | 43632 | """initial migration
Revision ID: 0930fdefb325
Revises:
Create Date: 2020-09-27 21:13:23.088570
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0930fdefb325'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto g... | 1.914063 | 2 |
solutions/Powerful Integers/solution.py | nilax97/leetcode-solutions | 3 | 43633 | <gh_stars>1-10
class Solution:
def powerfulIntegers(self, x: int, y: int, bound: int) -> List[int]:
ans = set()
for i in range(bound):
if pow(x,i) > bound or (x==1 and i>0):
break
for j in range(bound):
if pow(y,j) > bound or (y==1 and j>0):
... | 3.09375 | 3 |
feincms/management/commands/rebuild_mptt.py | duointeractive/feincms | 0 | 43634 | # ------------------------------------------------------------------------
# coding=utf-8
# $Id$
# ------------------------------------------------------------------------
from django.core.management.base import NoArgsCommand
from django.db import transaction
from feincms.module.page.models import Page
class Command... | 1.96875 | 2 |
tests/unit/zen_service/test_zen_service.py | xhan97/zenml | 0 | 43635 | <filename>tests/unit/zen_service/test_zen_service.py
# Copyright (c) ZenML GmbH 2022. 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:
#
# https://www.apache.or... | 2.125 | 2 |
tests/test_q.py | gityoav/pyg-mongo | 0 | 43636 | from pyg_mongo import Q, q, mongo_table
import re
import pytest
regex = re.compile
def D(value):
if isinstance(value, dict):
return {x : D(y) for x, y in value.items()} ### this converts mdict to normal dict
elif isinstance(value, list):
return [D(y) for y in value]
else:
return val... | 2.53125 | 3 |
beer/cli/subcommands/shmm/mksphoneloop.py | bolajiy/beer | 46 | 43637 |
'create a subspace phone-loop model'
import argparse
import copy
import pickle
import sys
import torch
import yaml
import beer
# Create a view of the emissions (aka modelset) for each units.
def iterate_units(modelset, nunits, nstates):
for idx in range(nunits):
start, end = idx * nstates, (idx + 1) *... | 2.546875 | 3 |
RECIPE-GENERATOR/markov_nagerecht.py | maxwaelbers/CookingWithMarkov.py | 1 | 43638 | #!/usr/bin/env python
import markovify
with open("NAGERECHT.txt") as f:
text = f.read()
text_model = markovify.Text(text)
for i in range(8):
print(text_model.make_sentence())
| 3.34375 | 3 |
helper/parse.py | avgupta456/HackMIT-2019 | 3 | 43639 | import os
import sys
import numpy as np
from helper import abbrev
def repNum(str):
try:
return float(str)
except ValueError:
try: return float(str[1:])
except ValueError: return -1
def getItems(data):
totals = []
print_next = False
for item in data['Blocks']:
if i... | 3.015625 | 3 |
ims_soft/stock/utils.py | fouadsan/ims-soft | 0 | 43640 | from django.http import HttpResponse
from django.template.loader import get_template
from io import BytesIO
from xhtml2pdf import pisa
from tablib import Dataset
from .models import Barcode
def get_status(obj):
if int(obj.quantity) <= int(obj.reorder_level):
obj.status = 'low'
elif int(obj.quantity) >... | 2.1875 | 2 |
scripts/train_all.py | davek44/Glimmer-MG | 5 | 43641 | #!/usr/bin/env python
from optparse import OptionParser, SUPPRESS_HELP
import glob, os, time, subprocess, sys
################################################################################
# train_all.py
#
# Run train_gbk in parallel on the gbk files defined by the glob
##############################################... | 2.078125 | 2 |
cyder/cydhcp/workgroup/forms.py | drkitty/cyder | 6 | 43642 | <gh_stars>1-10
from django import forms
from cyder.base.eav.forms import get_eav_form
from cyder.cydhcp.workgroup.models import Workgroup, WorkgroupAV
class WorkgroupForm(forms.ModelForm):
class Meta:
model = Workgroup
WorkgroupAVForm = get_eav_form(WorkgroupAV, Workgroup)
| 1.585938 | 2 |
Main/migrations/0005_auto_20200809_0710.py | anshumanprajapatiap/django-ecommerce- | 3 | 43643 | # Generated by Django 3.1 on 2020-08-09 01:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Main', '0004_auto_20200809_0425'),
]
operations = [
migrations.AlterField(
model_name='address',
name='apartment_addre... | 1.609375 | 2 |
xrspatial/gpu_rtx/hillshade.py | DahnJ/xarray-spatial | 1 | 43644 | <reponame>DahnJ/xarray-spatial<filename>xrspatial/gpu_rtx/hillshade.py
# Only call functions in this file if has_rtx() returns True as this checks
# that the required dependent libraries are installed.
import cupy
import numba as nb
import numpy as np
from rtxpy import RTX
from scipy.spatial.transform import Rotation ... | 2.390625 | 2 |
Data Structures/Binary Search Tree/binary_search_tree.py | mishrakeshav/Competitive-Programming | 2 | 43645 | <filename>Data Structures/Binary Search Tree/binary_search_tree.py<gh_stars>1-10
class Node():
def __init__(self, val):
self.val = val
self.right = None
self.left = None
def insert(root, val):
if root is None:
return Node(val)
elif val < root.val:
root.left = insert... | 3.84375 | 4 |
pyoop/3/2.py | yc19890920/Learn | 1 | 43646 | class Fjs(object):
def __init__(self, name):
self.name = name
def hello(self):
print("said by : ", self.name)
def __getattr__(self, item):
print("访问了特性1:" + item)
return None
raise AttributeError
def __setattr__(self, key, value):
print("访问... | 3.609375 | 4 |
king_blog/settings.py | pythonyhd/django_blog | 2 | 43647 | <reponame>pythonyhd/django_blog
# -*- coding: utf-8 -*-
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
sys.path.insert(0, os.path.join(BASE_DIR, 'extra_apps'))
# SECURITY WARNING: keep the secret key used in production sec... | 1.90625 | 2 |
nfsops/configurations/restore.py | nfsops/nfsops | 0 | 43648 | '''
Restore configuration model.
'''
from typing import Any, Dict, Literal, Optional, Union
from pydantic import NonNegativeInt, validator
from .configuration import Configuration
class RestoreConfiguration(Configuration):
'''
Restore configuration model.
'''
#: Configuration type.
type: Liter... | 2.90625 | 3 |
DiceGame/PigGameCMD.py | rodri45l/examination2 | 0 | 43649 | <reponame>rodri45l/examination2
import cmd
from PIGClasses import Player as p
from PIGClasses import Dice as d
from PIGClasses import bcolors as LetCol
import shouldRoll as prob
import OopPigGame as game
GOAL = 100
DIVIDER = "===================================================================\
========================... | 3.640625 | 4 |
tests/conftest.py | chadwhitacre/confidant | 1,820 | 43650 | <filename>tests/conftest.py<gh_stars>1000+
import pytest
@pytest.fixture(autouse=True)
def encrypted_settings_mock(mocker):
mocker.patch('confidant.settings.encrypted_settings.secret_string', {})
mocker.patch(
'confidant.settings.encrypted_settings.decrypted_secrets',
{'SESSION_SECRET': 'TEST_... | 1.6875 | 2 |
vega/algorithms/nas/modnas/optim/model_optim/base.py | This-50m/vega | 724 | 43651 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | 2.59375 | 3 |
app/dtclasses.py | blurmcclure18/ExpenseTracker | 16 | 43652 | <gh_stars>10-100
from sqlalchemy import create_engine
from sqlalchemy import Column, String, Integer, func, Boolean, Float, desc, text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from contextlib import contextmanager
from datetime import datetime
from kivy.properties ... | 2.515625 | 3 |
model/main.py | sylvarant/learn-to-hash | 58 | 43653 | import torch
import torch.nn as nn
import argparse
from torch.utils.data import Dataset
import sys
'''
Block of net
'''
def net_block(n_in, n_out):
block = nn.Sequential(nn.Linear(n_in, n_out),
nn.BatchNorm1d(n_out),
nn.ReLU())
return block
class M... | 2.671875 | 3 |
tests/test_metrics.py | vzhong/wrangl | 9 | 43654 | <reponame>vzhong/wrangl
import unittest
from wrangl import metrics as M
class TestMetrics(unittest.TestCase):
def test_accuracy(self):
m = M.Accuracy()
self.assertTrue(m.single_forward('foo', 'foo'))
self.assertFalse(m.single_forward('foo', 'bar'))
self.assertDictEqual(dict(accura... | 2.75 | 3 |
adjutant_moc/tests/functional/base.py | CCI-MOC/adjutant-moc | 1 | 43655 | <reponame>CCI-MOC/adjutant-moc
# 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 writing, s... | 1.710938 | 2 |
projeto/create_model.py | lucasmmassa/VisaoComputacional_PLE | 0 | 43656 | import numpy as np
import cv2
import glob
import PIL.ExifTags
import PIL.Image
from tqdm import tqdm
import os
import matplotlib.pyplot as plt
from pyntcloud import PyntCloud
import open3d as o3d
def create_output(vertices, colors, filename):
colors = colors.reshape(-1,3)
vertices = np.hstack([vertices.reshape(-1,3)... | 2.203125 | 2 |
ginga/misc/plugins/ZoomBase.py | Rbeaty88/ginga | 1 | 43657 | #
# ZoomBase.py -- Zoom plugin base class for Ginga fits viewer
#
# <NAME> (<EMAIL>)
#
# Copyright (c) <NAME>. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import time
from ginga.misc import Bunch
from ginga import GingaPlugin
cl... | 1.898438 | 2 |
Aserver/app.py | GnuVill-HUFS/2018-Academic-Seminar | 0 | 43658 | <filename>Aserver/app.py
from flask import Flask,render_template, redirect, url_for
import requests, json, webbrowser
from flask import request
import os
from urllib.parse import urljoin
A_SERVER = 'http://192.168.1.4:3333'
B_SERVER = 'http://192.168.1.5:4444'
app = Flask(__name__, static_url_path='/static')... | 2.796875 | 3 |
Week3/exercise_4.py | jcelani82/PyClass_202101 | 0 | 43659 | import json
from pprint import pprint
filename = "readfile_4.json"
with open(filename) as f:
readdata = json.load(f)
new_dict = {}
for a_keys, a_values in readdata.items():
if a_keys == "ipV4Neighbors":
for nei_list in a_values:
for nei_keys, nei_values in nei_list.items():
... | 3.125 | 3 |
zazi/apps/loan/events.py | felixcheruiyot/zazi-core-banking | 0 | 43660 | <reponame>felixcheruiyot/zazi-core-banking
import logging
from decimal import Decimal as D
from django.utils import timezone
from zazi.core import json
from .enums import LoanTransactionType
from . import utils as api
#--------------
logger = logging.getLogger(__name__)
#--------------
def process_loan_transac... | 1.90625 | 2 |
vbb_backend/session/apps.py | jcelynott/backend-vbb-portal | 3 | 43661 | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SessionConfig(AppConfig):
name = "vbb_backend.session"
verbose_name = _("Session")
def ready(self):
try:
import vbb_backend.session.signals # noqa F401
except ImportError:
... | 1.40625 | 1 |
ef/config/components/fields/field.py | JacobMSD/ef_python | 0 | 43662 | __all__ = ["Field"]
from ef.config.component import ConfigComponent
class Field(ConfigComponent):
pass
| 1.351563 | 1 |
reportist/reportist.py | thozza/reportist | 0 | 43663 | <filename>reportist/reportist.py
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | 1.890625 | 2 |
lib/web.py | magnusstubman/mal00 | 3 | 43664 | import os
import ssl
import ipaddress
import hashlib
from ipaddress import *
import asyncio
import pyminizip
import base64
import datetime
from time import gmtime, strftime
from aiohttp import web
import urllib.parse
from shutil import copyfile
import sys
import pycdlib
from io import BytesIO
stage0UrlPrefix = '/doc... | 2.265625 | 2 |
Software_Engineering/ObjectOrientedProgramming/IdeFiles/5_exercise_upload_to_pypi/setup.py | surily/Udacity-Data-Science | 0 | 43665 | <reponame>surily/Udacity-Data-Science
from setuptools import setup
setup(name='gaussian_bionary_dist_prob',
version='0.1',
description='Gaussian and Binomial distributions',
packages=['gaussian_bionary_dist_prob'],
author = '<NAME>',
author_email = '<EMAIL>',
zip_safe=False)
| 1.109375 | 1 |
010-binarysearch.py | dasalgadoc/PythonNotes | 0 | 43666 | import random
def binary_search(data, target, low_index, high_index):
""" Binary Search recursiva """
if (low_index > high_index):
return False
mid_index = (low_index + high_index) // 2
if target == data[mid_index]:
return True
elif target < data[mid_index]:
return binary_... | 3.921875 | 4 |
hpotter/src/udp_thread.py | LarsenClose/dr.hpotter | 1 | 43667 | <gh_stars>1-10
''' Starts a BIND9 bindd and handles UDP traffic on port 53 '''
import socket
import threading
import time
import docker
from geolite2 import geolite2
from dns import query
from src.logger import logger
from src.listen_thread import ListenThread
from src import tables
from src import chain
from src.la... | 2.40625 | 2 |
shared/stow_user/mpv/.config/mpv/scripts/cutitout_shared/cutitout.py | 0xConnorRhodes/dotfiles | 1 | 43668 | <reponame>0xConnorRhodes/dotfiles<filename>shared/stow_user/mpv/.config/mpv/scripts/cutitout_shared/cutitout.py
"""
cutitout: automatically cut silence from videos
Copyright (C) 2020 <NAME>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General... | 2.34375 | 2 |
spectrocrunch/utils/classfactory.py | woutdenolf/spectrocrunch | 3 | 43669 | # -*- coding: utf-8 -*-
from collections import OrderedDict
from . import instance
import future.utils
# https://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/
#
# Instance creation:
# metaclass.__call__()
# instance = class.__new__(self,)
# class.__init__(instance,...)
# return in... | 2.90625 | 3 |
tests/OLD/mathops/test_concat.py | KonduitAI/ImportTests | 6 | 43670 | import tensorflow as tf
from tfoptests.persistor import TensorFlowPersistor
from tfoptests.test_graph import TestGraph
class ConcatTest(TestGraph):
def list_inputs(self):
return []
def test_concat_one():
concat_test = ConcatTest(seed=13)
arrs = []
for i in range(1, 5, 1):
arrs.append... | 2.5 | 2 |
data/process_data.py | Leadlegend/Commonsense-based-Question-Generation | 0 | 43671 | import sys
import json
sys.path.insert(0, '../')
import config
from data_utils import (make_conll_format, make_embedding, make_vocab,
make_vocab_from_squad, process_file, make_graph_vector)
def make_sent_dataset():
train_src_file = "./para-train.txt"
train_trg_file = "./tgt-train.txt... | 2.234375 | 2 |
meerschaum/Pipe/_data.py | bmeares/Meerschaum | 32 | 43672 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Functions for getting Pipe data
"""
from __future__ import annotations
from meerschaum.utils.typing import Optional, Dict, Any
def get_data(
self,
begin : Optional[datetime.datetime] = None,
end : Optional[datetime.datetime] ... | 2.8125 | 3 |
IoT_master/tools/person_detect.py | Janek3d/teleserver | 0 | 43673 | import argparse
from sys import platform
from tools.yolov3.models import * # set ONNX_EXPORT in models.py
from tools.yolov3.utils.datasets import *
from tools.yolov3.utils.utils import *
class detection:
"""
This class is used to detect people in the image and find
coordinates of bounding boxes of these ... | 2.375 | 2 |
excript/lista3/q5.py | victorers1/anotacoes_curso_python | 0 | 43674 | <filename>excript/lista3/q5.py
soma = 0
for i in range(0,101):
if(i%2==0):
soma+=i
print("A soma de todos os pares é:", soma) | 3.109375 | 3 |
plugins/myplugin/plugins/rtseconddemo.py | rjdp/Easynginedemoplugin | 1 | 43675 | <gh_stars>1-10
"""
Rtseconddemo plugin for Easyengine.
Created by: rajdeep <<EMAIL>>
License: MIT
URL: rtcamp.com
"""
from cement.core import handler
from cement.core.controller import CementBaseController, expose
class rteesitetestPluginController(CementBaseController):
class Meta:
# label uniquely i... | 2.328125 | 2 |
src/cells.py | lodo1995/LiMNet | 3 | 43676 | import torch
from typing import Tuple
class FastGRNN(torch.nn.Module):
def __init__(self, Fi, Fh):
super().__init__()
self.input_linear = torch.nn.Linear(Fi, Fh, bias = False)
self.state_linear = torch.nn.Linear(Fh, Fh, bias = False)
self.gate_bias = torch.nn.Parameter(torch.ones(1,... | 2.609375 | 3 |
core/views.py | uktrade/exceptional-review-procedure | 1 | 43677 | import datetime
from urllib.parse import quote, unquote
from directory_ch_client.client import ch_search_api_client
from directory_forms_api_client import actions
from directory_forms_api_client.helpers import FormSessionMixin, Sender
from formtools.wizard.views import NamedUrlSessionWizardView
from formtools.wizard.f... | 2.046875 | 2 |
src/RIOT/tests/od/tests/02-run.py | ARte-team/ARte | 2 | 43678 | <filename>src/RIOT/tests/od/tests/02-run.py
#!/usr/bin/env python3
# Copyright (C) 2017 Hamburg University of Applied Sciences
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testr... | 1.976563 | 2 |
pytoggl/api/projects_api.py | cloew/pytoggl | 0 | 43679 | <gh_stars>0
from .actions import AllFromWorkspaces, Get, WithName
from .api_for import api_for
from .model_api import ModelApi
from ..requests import RequestApis
from ..model import Project
@api_for(Project, RequestApis.Projects)
class ProjectsApi(ModelApi):
""" Represents the Toggl Projects API """
a... | 1.710938 | 2 |
app/routers/book_transaction.py | KamalDGRT/libms | 1 | 43680 | <gh_stars>1-10
from datetime import datetime
from fastapi import status, HTTPException, Response, Depends, APIRouter
from typing import List
from sqlalchemy.orm import Session
from ..database import get_db
from .. import models, schemas, oauth2
# Using hyphen by following this answer
# https://stackoverflow.com/a/184... | 2.59375 | 3 |
paddle/za/test/test2.py | hth945/pytest | 0 | 43681 | <reponame>hth945/pytest<filename>paddle/za/test/test2.py
# 导入图像读取第三方库
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import cv2
import numpy as np
from PIL import Image
import paddle
import paddle.fluid as fluid
from paddle.fluid.dygraph.nn import Linear
# 读取图像
img1 = cv2.imread('./work/example_0.png... | 2.359375 | 2 |
codev/core/log.py | baseclue/codev | 4 | 43682 | <reponame>baseclue/codev
import logging
LOGLEVELS = {
'info': logging.INFO,
'debug': logging.DEBUG,
}
actual_loglevel = 'info'
class LoglevelFilter(logging.Filter):
def __init__(self, loglevel):
self.loglevel = loglevel
super().__init__()
def filter(self, record):
if record... | 2.6875 | 3 |
solution/1978(소수 찾기).py | OMEGA-Y/Baekjoon-sol | 0 | 43683 | input()
num = set(map(int,input().split()))
prime = set([i for i in range(3,max(num)+1,2)])
for i in range(3,max(num)+1,2):
if i in prime:
prime -= set([i for i in range(i*2,max(num)+1,i)])
prime.add(2)
print(len(num.intersection(prime))) | 3.421875 | 3 |
src/modules/thesne.py | HanKruiger/tsnetwork | 11 | 43684 | # Copyright (c) 2016 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, s... | 1.421875 | 1 |
overlays/semantic_segmentation_overlay.py | mitmul/tfrecord-viewer | 0 | 43685 | import io
from PIL import Image, ImageDraw, ImageFont
import tensorflow as tf
import numpy as np
from matplotlib import cm
from matplotlib.colors import ListedColormap
import pdb
default_color = 'blue'
highlight_color = 'red'
class SemanticSegmentationOverlay:
def __init__(self, args):
self.segmap_key = arg... | 2.609375 | 3 |
pandas/io/tests/sas/test_sas7bdat.py | mcwitt/pandas | 0 | 43686 | <reponame>mcwitt/pandas<gh_stars>0
import pandas as pd
from pandas.compat import PY2
import pandas.util.testing as tm
import os
import io
import numpy as np
class TestSAS7BDAT(tm.TestCase):
def setUp(self):
self.dirpath = tm.get_data_path()
self.data = []
self.test_ix = [list(range(1, 16)... | 2.265625 | 2 |
PONG_GAME.py | espr3so/Python | 0 | 43687 | <filename>PONG_GAME.py<gh_stars>0
# Pong Game in Codeskulptor
import simpleguitk as simplegui
import random
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
LEFT = False
RIGHT = True
score1 = 0
score2 = 0
paddle1_pos = 0
pad... | 3.625 | 4 |
vmagent/learners/sac_learner.py | Nicola115/VMAgent | 47 | 43688 | import copy
import torch as th
from torch.optim import Adam
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
class SACLearner:
def __init__(self, mac, args):
self.args = args
self.mac = mac
self.params = list(mac.parameters())
self.learn_cnt= 0
sel... | 2.03125 | 2 |
scrape.py | riceissa/public-welfare-foundation | 0 | 43689 | <reponame>riceissa/public-welfare-foundation
#!/usr/bin/env python3
import requests
import sys
import csv
from bs4 import BeautifulSoup
def main():
fieldnames = ["location", "year", "grantee", "description", "amount", "term", "program"]
writer = csv.DictWriter(sys.stdout, fieldnames=fieldnames)
writer.wr... | 3.1875 | 3 |
executor/database/token_manage.py | Ganyuhao/executor | 0 | 43690 | <reponame>Ganyuhao/executor<gh_stars>0
# !/usr/bin/env python
# coding: utf-8
"""生成与验证token"""
import hashlib
import os
import time
import base64
class TokenManage:
"""Token类"""
def __init__(self, aging=259200):
"""token 默认有效期 72 小时"""
self.aging = aging
def generate_token(self, times):
... | 2.40625 | 2 |
pypy/module/__builtin__/test/test_compile.py | olliemath/pypy | 1 | 43691 | <reponame>olliemath/pypy<filename>pypy/module/__builtin__/test/test_compile.py
class TestOptimizeO:
"""Test interaction of -O flag and optimize parameter of compile."""
def setup_method(self, method):
space = self.space
self._w_flags = space.sys.get('flags')
# imitate -O
space.a... | 2.609375 | 3 |
sandbox/system_id.py | MrRubyRed/MBRL | 0 | 43692 | <filename>sandbox/system_id.py
"""
Demo of system identification on an inverted pendulum, using one step dynamics.
@author: <NAME>
@email: <EMAIL>
"""
import gym
import tensorflow as tf
from mbrl.dynamics.dynamics import Dynamics
import numpy as np
import pickle
# Make a gym environment.
env = gym.make("Pendulum-v0")... | 2.578125 | 3 |
test/__init__.py | pieter-hendriks/STL-monitoring | 0 | 43693 | """ STL Tool tests module """
from . import fullSystemTests, unitTests
| 0.847656 | 1 |
pre_cnmfe.py | lyprince/chendoscope-minipipe | 0 | 43694 | '''
Authors: <NAME> and <NAME>
Date: July 10, 2017
Pre-cnmf-e processing of videos in chunks:
- Downsampling
- Motion Correction
'''
from os import path, system
import pims
import av
import numpy as np
import math
from tqdm import tqdm
from skimage import img_as_uint
from motion import align_video
import skimage.io
i... | 3.078125 | 3 |
UpdatedImageProcessing/UpdatedImageProcessing/integrated_image_processing.py | liyu711/SUAS | 0 | 43695 | import os
import time
import json
from PIL import Image
from .TargetDetection import *
from .ShapeDetection import *
from .Classifiers import *
class IntegratedImageProcessing(object):
@staticmethod
def run_integrated_image_processing(target_map_path, image_save_path, json_save_path):
target_detected ... | 2.703125 | 3 |
nablapps/poll/apps.py | pettaroni/nablaweb | 0 | 43696 | """
App configs for poll app
"""
from django.apps import AppConfig
class PollConfig(AppConfig):
"""Default poll config"""
name = 'nablapps.poll'
verbose_name = 'Avstemninger'
| 1.351563 | 1 |
pytoolkit/datasets/voc_test.py | ak110/pytoolk | 26 | 43697 | import numpy as np
import pytest
import pytoolkit as tk
def test_load_voc_od_split(data_dir):
ds = tk.datasets.load_voc_od_split(data_dir / "od", split="train")
assert len(ds) == 3
assert tuple(ds.metadata["class_names"]) == ("~", "〇")
ann = ds.labels[0]
assert ann.path == (data_dir / "od" / "JP... | 2.234375 | 2 |
src/replay_buffer.py | LolloneS/DDPG-PyTorch | 2 | 43698 | <reponame>LolloneS/DDPG-PyTorch
import random
from typing import List
from src.transition import Transition
random.seed(42)
class ReplayBuffer:
def __init__(self, size: int, random: bool = False):
self.size = size
self.memory: List[Transition] = []
self.random = random
self.occup... | 3.171875 | 3 |
gunicorn.conf.py | nadjascha/FemaleAIAppInnovationEcosystem | 13 | 43699 | <reponame>nadjascha/FemaleAIAppInnovationEcosystem
wsgi_app = "app:app"
worker_class = "uvicorn.workers.UvicornWorker"
| 0.941406 | 1 |