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 |
|---|---|---|---|---|---|---|
GearBot/Util/Pages.py | JohnyTheCarrot/GearBot | 0 | 4600 | import discord
from Util import Utils, Emoji, Translator
page_handlers = dict()
known_messages = dict()
def on_ready(bot):
load_from_disc()
def register(type, init, update, sender_only=False):
page_handlers[type] = {
"init": init,
"update": update,
"sender_only": sender_only
}... | 2.1875 | 2 |
software/Opal/spud/diamond/build/lib.linux-x86_64-2.7/diamond/dialogs.py | msc-acse/acse-9-independent-research-project-Wade003 | 2 | 4601 | #!/usr/bin/env python
# This file is part of Diamond.
#
# Diamond is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... | 2.609375 | 3 |
src/mazes.py | tim-fi/pyxel_games | 2 | 4602 | from __future__ import annotations
from dataclasses import dataclass, field, InitVar
from typing import List, Tuple, Iterator, Iterable, Optional
from random import choice
import pyxel
# -------------------------------------------------------
# Types
# -------------------------------------------------------
Maze = T... | 2.703125 | 3 |
bobjiang/settings.py | bobjiangps/django-blog | 3 | 4603 | <reponame>bobjiangps/django-blog<filename>bobjiang/settings.py
"""
Django settings for bobjiang project.
Generated by 'django-admin startproject' using Django 2.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https... | 1.890625 | 2 |
Users/models.py | titusnjuguna/FreeDom | 1 | 4604 | from django.db import models
from django.contrib.auth.models import User
from PIL import Image
class Profile(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
image = models.ImageField(default='default.jpg',
upload_to='profile_pic/')
... | 2.46875 | 2 |
dvc/__init__.py | zjj2wry/dvc | 0 | 4605 | <reponame>zjj2wry/dvc<filename>dvc/__init__.py
"""
DVC
----
Make your data science projects reproducible and shareable.
"""
import os
import warnings
VERSION_BASE = '0.23.2'
__version__ = VERSION_BASE
PACKAGEPATH = os.path.abspath(os.path.dirname(__file__))
HOMEPATH = os.path.dirname(PACKAGEPATH)
VERSIONPATH = os.pa... | 2.078125 | 2 |
pkg_dir/src/utils/notion_utils.py | robperch/robase_datalysis | 2 | 4606 | ## MODULE WITH UTIL FUNCTIONS - NOTION
"----------------------------------------------------------------------------------------------------------------------"
####################################################### Imports ########################################################
"---------------------------------... | 2.015625 | 2 |
libpermian/issueanalyzer/test_baseissue.py | velezd/permian | 0 | 4607 | <filename>libpermian/issueanalyzer/test_baseissue.py
import unittest
import logging
import contextlib
from libpermian.settings import Settings
from .proxy import IssueAnalyzerProxy
from .base import BaseAnalyzer, BaseIssue
from .issueset import IssueSet
LOGGER = logging.getLogger('test')
class NewIssue(BaseIssue):
... | 2.390625 | 2 |
naplib/alignment/prosodylab_aligner/__main__.py | gavinmischler/naplib-python | 1 | 4608 | <filename>naplib/alignment/prosodylab_aligner/__main__.py
# Copyright (c) 2011-2014 <NAME> and <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
# withou... | 2.28125 | 2 |
init/build_statements.py | andgein/sis-2017-winter-olymp | 0 | 4609 | <reponame>andgein/sis-2017-winter-olymp<filename>init/build_statements.py
#!/usr/bin/env python3
import codecs
import os
import os.path
import shutil
import subprocess
import logging
import glob
import json
CONTEST_DIR = 'polygon-contest'
INIT_FILE = 'init.txt'
BUILD_DIR = 'build'
LANGUAGE = 'russian'
FILES_DIR = 'fi... | 2.078125 | 2 |
conanfile.py | mmurooka/mc_rtc_data | 1 | 4610 | # -*- coding: utf-8 -*-
#
from conans import python_requires
import conans.tools as tools
import os
base = python_requires("Eigen3ToPython/latest@multi-contact/dev")
class MCRTCDataConan(base.Eigen3ToPythonConan):
name = "mc_rtc_data"
version = "1.0.4"
description = "Environments/Robots description for m... | 1.757813 | 2 |
hyperion/migrations/0006_auto_20190218_2251.py | ExiaSR/hyperion | 3 | 4611 | <filename>hyperion/migrations/0006_auto_20190218_2251.py
# Generated by Django 2.1.5 on 2019-02-18 22:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hyperion', '0005_auto_20190212_2116'),
]
operations = [
... | 1.890625 | 2 |
pottan_ocr/utils.py | nithyadurai87/pottan-ocr-tamil | 5 | 4612 | import torch
import json
import numpy as np
from torch.autograd import Variable
import gzip
import yaml
from re import split
from matplotlib import pyplot
def showImg( im ):
pyplot.imshow( im )
pyplot.show()
def myOpen( fname, mode ):
return open( fname, mode, encoding="utf-8" )
def readFile( fname ):
... | 2.34375 | 2 |
pyvips/error.py | kleisauke/pyvips | 0 | 4613 | <gh_stars>0
# errors from libvips
import sys
import logging
from pyvips import ffi, vips_lib
logger = logging.getLogger(__name__)
_is_PY3 = sys.version_info[0] == 3
if _is_PY3:
text_type = str
else:
text_type = unicode
ffi.cdef('''
const char* vips_error_buffer (void);
void vips_error_clear (void)... | 2.46875 | 2 |
population_estimator/curses_io.py | cruzanta/population-estimator | 1 | 4614 | <filename>population_estimator/curses_io.py
#!/usr/bin/env python
"""
Module for painting output on and obtaining input from a text-based terminal
window using the curses library.
"""
import curses
import textwrap
def display_string(screen, a_string, output_line):
# Paints a string on a text-based terminal wind... | 3.875 | 4 |
tools/micropython-mockup/urandom.py | hwinther/lanot | 0 | 4615 | def randrange(n, y):
pass
| 0.902344 | 1 |
SAP/released_tr_email_sender/ui.py | botisko/personal_programs | 0 | 4616 | <gh_stars>0
import json
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
from tr_data import TRData, NO_DATA_MEETS_CRITERIA
from email_text import email_body_template
from helpers import send_email
RECIPIENT = <email_address>
EXCEPTION_FILE = "tr_number_exceptions.json"
class TrEmailSend... | 2.71875 | 3 |
AI-Practice-Tensorflow-Notes-master/opt/opt4_8_backward.py | foochane/Tensorflow-Learning | 2 | 4617 | #coding:utf-8
#0导入模块 ,生成模拟数据集
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import opt4_8_generateds
import opt4_8_forward
STEPS = 40000
BATCH_SIZE = 30
LEARNING_RATE_BASE = 0.001
LEARNING_RATE_DECAY = 0.999
REGULARIZER = 0.01
def backward():
x = tf.placeholder(tf.float32, shape=(None, ... | 3.109375 | 3 |
test/examples/integrated/codec/vip/vip_agent.py | rodrigomelo9/uvm-python | 140 | 4618 | <gh_stars>100-1000
#//
#// -------------------------------------------------------------
#// Copyright 2011 Synopsys, Inc.
#// Copyright 2019-2020 <NAME> (tpoikela)
#// All Rights Reserved Worldwide
#//
#// Licensed under the Apache License, Version 2.0 (the
#// "License"); you may not use this file ex... | 1.914063 | 2 |
tests/test_transliterate.py | abosoar/camel_tools | 1 | 4619 | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright 2018-2020 New York University A<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 ... | 2.078125 | 2 |
source/code/build-instance-scheduler-template.py | liangruibupt/aws-instance-scheduler | 0 | 4620 | ######################################################################################################################
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | 1.976563 | 2 |
src/parse.py | StanfordAHA/Configuration | 0 | 4621 | ###############################################################################
# file -- parse.py --
# Top contributors (to current version):
# <NAME>
# This file is part of the configuration finder for the Stanford AHA project.
# Copyright (c) 2021 by the authors listed in the file AUTHORS
# in the top-level ... | 1.851563 | 2 |
neyesem/main.py | omerfarukbaysal/neyesem | 0 | 4622 | <reponame>omerfarukbaysal/neyesem<gh_stars>0
from flask import Blueprint, render_template, redirect, url_for, request, flash, make_response
from werkzeug.security import generate_password_hash
from flask_login import login_required, current_user
from . import db
import datetime
from .models import Visitor, User
main =... | 2.71875 | 3 |
00-Aulas/Aula007_2.py | AmandaRH07/Python_Entra21 | 0 | 4623 | # Funções
cabecalho = "SISTEMA DE CADASTRO DE FUNCIONARIO\n\n\n"
rodape = "\n\n\n Obrigada pela preferencia"
def imprimir_tela(conteudo):
print(cabecalho)
#print(opcao_menu)
print(conteudo)
print(rodape)
def ler_opcoes():
opcao = int(input("Insira a opção: "))
return opcao
def carregar_o... | 3.578125 | 4 |
ast_version/src/binop.py | lucassa3/CCompiler | 1 | 4624 | <reponame>lucassa3/CCompiler<filename>ast_version/src/binop.py
from node import Node
class BinOp(Node):
def eval(self, st):
a = self.children[0].eval(st)
b = self.children[1].eval(st)
if self.value == "MINUS":
return a - b
elif self.value == "PLUS":
return a + b
elif self.value == "MULT":
... | 3.171875 | 3 |
aqt/installer.py | pylipp/aqtinstall | 0 | 4625 | #!/usr/bin/env python3
#
# Copyright (C) 2018 <NAME> <<EMAIL>>
# Copyright (C) 2019,2020 <NAME> <<EMAIL>>
# 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 withou... | 1.765625 | 2 |
lib/django-0.96/django/views/generic/list_detail.py | MiCHiLU/google_appengine_sdk | 790 | 4626 | from django.template import loader, RequestContext
from django.http import Http404, HttpResponse
from django.core.xheaders import populate_xheaders
from django.core.paginator import ObjectPaginator, InvalidPage
from django.core.exceptions import ObjectDoesNotExist
def object_list(request, queryset, paginate_by=None, p... | 2.3125 | 2 |
pax/_src/core/utility_modules.py | NTT123/pax | 11 | 4627 | """Utility Modules."""
from typing import Any, Callable, Dict, List, Optional, Sequence, TypeVar, Union
import jax
import jax.numpy as jnp
from .module import Module, parameters_method
T = TypeVar("T", bound=Module)
O = TypeVar("O")
class ParameterModule(Module):
"""A PAX module that registers attributes as ... | 3.109375 | 3 |
src/richie/apps/courses/lms/edx.py | kernicPanel/richie | 0 | 4628 | <reponame>kernicPanel/richie
"""
Backend to connect Open edX richie with an LMS
"""
import logging
import re
import requests
from requests.auth import AuthBase
from ..serializers import SyncCourseRunSerializer
from .base import BaseLMSBackend
logger = logging.getLogger(__name__)
def split_course_key(key):
"""S... | 2.5 | 2 |
BitTorrent-5.2.2/BTL/brpclib.py | jpabb7/p2pScrapper | 4 | 4629 | # by <NAME>
import xmlrpclib
from xmlrpclib2 import *
from BTL import brpc
old_PyCurlTransport = PyCurlTransport
class PyCurlTransport(old_PyCurlTransport):
def set_connection_params(self, h):
h.add_header('User-Agent', "brpclib.py/1.0")
h.add_header('Connection', "Keep-Alive")
h.add_head... | 2.53125 | 3 |
database_files/views.py | den-gts/django-database-files-3000 | 8 | 4630 | import base64
import mimetypes
import os
from django.conf import settings
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.views.decorators.cache import cache_control
from django.views.static import serve as django_serve
from database_files.models import File
... | 2.0625 | 2 |
NoiseFiltersPy/Injector.py | TVect/NoiseFiltersPy | 6 | 4631 | <reponame>TVect/NoiseFiltersPy<gh_stars>1-10
import numpy as np
import pandas as pd
from abc import ABC
class Injector(ABC):
"""Base class for the injectors of artificial noise.
Attributes
----------
rem_indx : :obj:`List`
Removed indexes (rows) from the dataset after the filtering.
para... | 3.0625 | 3 |
application/mod_user/forms.py | hackBCA/hackbcafour | 2 | 4632 | <filename>application/mod_user/forms.py
from wtforms import Form, TextField, PasswordField, SelectField, TextAreaField, BooleanField, validators, ValidationError, RadioField
import re
phone_regex = "(\+\d+-?)?((\(?\d{3}\)?)|(\d{3}))-?\d{3}-?\d{4}$"
gender_choices = [
("", "Gender"),
("male", "Male"),
("f... | 2.671875 | 3 |
src/app.py | gh640/coding-challenge | 0 | 4633 | # coding: utf-8
'''フロントコントローラを提供する
'''
from math import ceil
import os
from flask import json
from flask import Flask
from flask import request
from flask import send_from_directory
from flask import render_template
# from json_loader import load_locations
# from json_loader import prepare_locations
from models imp... | 2.515625 | 3 |
corkus/objects/dungeon.py | MrBartusek/corkus.py | 5 | 4634 | <filename>corkus/objects/dungeon.py
from __future__ import annotations
from .base import CorkusBase
from enum import Enum
class DungeonType(Enum):
REMOVED = "REMOVED"
"""Dungeons that were removed from the game in version ``1.14.1`` like ``Skeleton`` or ``Spider``"""
REMOVED_MINI = "REMOVED_MINI"
"""M... | 2.953125 | 3 |
src/brisk.py | chaoer/brisk-descriptor | 18 | 4635 | <filename>src/brisk.py
import pybrisk
class Brisk:
def __init__(self, thresh=60, octaves=4):
self.thresh = thresh
self.octaves = octaves
self.descriptor_extractor = pybrisk.create()
def __del__(self):
pybrisk.destroy(self.descriptor_extractor)
def detect(self, img):
... | 2.6875 | 3 |
hale_hub/outlet_interface.py | tantinlala/hale-hub | 0 | 4636 | import serial
import serial.tools.list_ports
from hale_hub.constants import STARTING_OUTLET_COMMAND, SERIAL_BAUD_RATE, SERIAL_TIMEOUT
from hale_hub.ifttt_logger import send_ifttt_log
class _Outlet:
def __init__(self, name):
self.state = 0
self.name = name
class _OutletInterface:
def __init__... | 2.421875 | 2 |
helix/core.py | carbonscott/helix | 0 | 4637 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
def remove_nan(xyzs): return xyzs[~np.isnan(xyzs).any(axis = 1)]
def measure_twocores(core_xyz_ref, core_xyz_tar):
''' Measure the following aspects of two helical cores.
- Interhelical distance vector between the centers.
- Inte... | 2.6875 | 3 |
matury/2011/6.py | bartekpacia/informatyka-frycz | 2 | 4638 | <reponame>bartekpacia/informatyka-frycz<gh_stars>1-10
from typing import List
with open("dane/liczby.txt") as f:
nums: List[int] = []
nums_9_chars: List[int] = []
for line in f:
sline = line.strip()
num = int(sline, 2)
if len(sline) == 9:
nums_9_chars.append(num)
... | 3.265625 | 3 |
Python/fibs.py | familug/FAMILUG | 5 | 4639 | def fib(n):
if n < 2:
return n
else:
return fib(n-1) + fib(n-2)
def fib_fast(n):
from math import sqrt
s5 = sqrt(5)
x = (1 + s5) ** n
y = (1 - s5) ** n
return int((x - y)/(s5 * 2**n))
def print_fib(n):
for i in range(n):
print fib(i),
print
for i i... | 3.75 | 4 |
src/model/ParseInput.py | slavi010/polyhash-2020 | 0 | 4640 | <filename>src/model/ParseInput.py
import os
from typing import List
from src.model.Etape import Etape
from src.model.Grille import Grille
from src.model.ItemCase import ItemCase
from src.model.PointMontage import PointMontage
from src.model.Robot import Robot
from src.model.Tache import Tache
class ParseInput:
"... | 3.015625 | 3 |
test.py | UnKafkaesque/Sentiment-Analysis | 0 | 4641 | <filename>test.py<gh_stars>0
import os
import sys
import time
import traceback
import project1_Copy as p1
import numpy as np
verbose = False
def green(s):
return '\033[1;32m%s\033[m' % s
def yellow(s):
return '\033[1;33m%s\033[m' % s
def red(s):
return '\033[1;31m%s\033[m' % s
def log(*m):
print(" ... | 2.453125 | 2 |
homework_1/tests/test_3.py | mag-id/epam_python_autumn_2020 | 0 | 4642 | """
Unit tests for module `homework_1.tasks.task_3`.
"""
from tempfile import NamedTemporaryFile
from typing import Tuple
import pytest
from homework_1.tasks.task_3 import find_maximum_and_minimum
@pytest.mark.parametrize(
["file_content", "expected_result"],
[
pytest.param(
"0\n",
... | 2.6875 | 3 |
app/admin/views/__init__.py | CAUCHY2932/Northern_Hemisphere | 0 | 4643 | # coding:utf-8
import app.admin.views.start
import app.admin.views.book
import app.admin.views.user
import app.admin.views.site
| 1.023438 | 1 |
test_mnist.py | aidiary/chainer-siamese | 0 | 4644 | <reponame>aidiary/chainer-siamese
import os
import chainer
import chainer.links as L
from net import SiameseNetwork
import numpy as np
import matplotlib.pyplot as plt
# 訓練済みモデルをロード
model = SiameseNetwork()
chainer.serializers.load_npz(os.path.join('result', 'model.npz'), model)
# テストデータをロード
_, test = chainer.datase... | 2.171875 | 2 |
TwoFeetTempoMove.py | b0nz0/TwisterTempo | 0 | 4645 | <reponame>b0nz0/TwisterTempo<gh_stars>0
from random import randrange, random
from time import time
import logging
from TwisterTempoGUI import TwisterTempoGUI
class TwoFeetTempoMove(object):
COLORS_ALPHA = {0: 'RED', 1: 'BLUE', 2: 'YELLOW', 3: 'GREEN'}
COLORS_RGB = {0: (255, 0, 0), 1: (0, 0, 255), 2: (255, 25... | 2.671875 | 3 |
plugins/panorama/panorama/__init__.py | mohnjahoney/website_source | 13 | 4646 | <filename>plugins/panorama/panorama/__init__.py
# -*- coding: utf-8 -*-
"""
Panorama is a Pelican plugin to generate statistics from blog posts
(number of posts per month, categories and so on) display them as beautiful charts.
Project location: https://github.com/romainx/panorama
"""
__version__ = "0.2.0"
__author_... | 1.460938 | 1 |
transitfeed/transfer.py | cclauss/transitfeed | 9 | 4647 | #!/usr/bin/python2.5
# Copyright (C) 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 2.25 | 2 |
social/urls.py | Kizito-Alberrt/insta-social | 0 | 4648 | from django.urls import path
from . import views
from . views import UserPostListView, PostDetailView, PostDeleteview, PostCreateView, PostUpdateView,CommentUpdateView, VideoCreateView, video_update
urlpatterns = [
path('',views.base, name='base'),
path('login',views.login, name='login'),
path('register',v... | 1.867188 | 2 |
vtkplotter_examples/other/dolfin/collisions.py | ismarou/vtkplotter-examples | 4 | 4649 | <reponame>ismarou/vtkplotter-examples<filename>vtkplotter_examples/other/dolfin/collisions.py<gh_stars>1-10
'''
compute_collision() will compute the collision of all the entities with
a Point while compute_first_collision() will always return its first entry.
Especially if a point is on an element edge this can be tric... | 2.75 | 3 |
alice_check_train/__main__.py | AsciiShell/Alice-Check-Train | 0 | 4650 | <reponame>AsciiShell/Alice-Check-Train
import datetime
import os
from alice_check_train.main import rasp_to_text
from alice_check_train.rasp_api import get_rasp, filter_rasp
def main():
key = os.getenv('RASP_KEY')
station_from = os.getenv('STATION_FROM')
station_to = os.getenv('STATION_TO')
date = da... | 2.609375 | 3 |
aws-KNN-RESTful.py | cakebytheoceanLuo/k-NN | 1 | 4651 | # https://medium.com/@kumon/how-to-realize-similarity-search-with-elasticsearch-3dd5641b9adb
# https://docs.aws.amazon.com/opensearch-service/latest/developerguide/knn.html
import sys
import requests
import h5py
import numpy as np
import json
import aiohttp
import asyncio
import time
import httpx
from requests.auth imp... | 2.328125 | 2 |
test/test_docker_images.py | bauerj/cibuildwheel | 0 | 4652 | <reponame>bauerj/cibuildwheel
import platform
import textwrap
import pytest
from . import test_projects, utils
dockcross_only_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
import os, sys
# check that we're running in the correct docker image as specified in the
... | 2.25 | 2 |
real_trade/MoveAverageTradePosition.py | taka-mochi/cryptocurrency-autotrading | 3 | 4653 | # coding: utf-8
import math
import dateutil
import dateutil.parser
import json
from ChartBars import Chart
from ChartUpdaterByCCWebsocket import ChartUpdaterByCoincheckWS
from Util import BitcoinUtil
def adjust_price_to_tick(price, tick):
return price - math.fmod(price, tick)
def adjust_amount_to_tick(amount, t... | 2.65625 | 3 |
test.py | sbcshop/PiRelay-8 | 2 | 4654 | <reponame>sbcshop/PiRelay-8<filename>test.py<gh_stars>1-10
from PiRelay8 import Relay
import time
r1 = Relay("RELAY1")
r2 = Relay("RELAY2")
r3 = Relay("RELAY3")
r4 = Relay("RELAY4")
r5 = Relay("RELAY5")
r6 = Relay("RELAY6")
r7 = Relay("RELAY7")
r8 = Relay("RELAY8")
r1.off()
r2.off()
r3.off()
r4.off()... | 1.84375 | 2 |
bot/cogs/clan.py | johnvictorfs/atlantisbot-rewrite | 0 | 4655 | <gh_stars>0
import rs3clans
import discord
from discord.ext import commands
from bot.bot_client import Bot
from bot.utils.tools import separator
from bot.utils.context import Context
class Clan(commands.Cog):
def __init__(self, bot: Bot):
self.bot = bot
@commands.cooldown(1, 5, comman... | 2.28125 | 2 |
otcextensions/tests/functional/osclient/vpc/v2/common.py | zsoltn/python-otcextensions | 10 | 4656 | <filename>otcextensions/tests/functional/osclient/vpc/v2/common.py
# 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 requi... | 1.921875 | 2 |
tests/test_nested_structures_inside_structure_values.py | Robinson04/StructNoSQL | 3 | 4657 | <reponame>Robinson04/StructNoSQL
import unittest
from typing import Set, Optional, Dict, List
from uuid import uuid4
from StructNoSQL import BaseField, MapModel, TableDataModel
from tests.components.playground_table_clients import PlaygroundDynamoDBBasicTable, TEST_ACCOUNT_ID
class TableModel(TableDataModel):
ac... | 2.5 | 2 |
test/cpython/test_base64.py | aisk/pyston | 1 | 4658 | import unittest
from test import test_support
import base64
class LegacyBase64TestCase(unittest.TestCase):
def test_encodestring(self):
eq = self.assertEqual
eq(base64.encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n")
eq(base64.encodestring("a"), "YQ==\n")
eq(base64.encod... | 3.078125 | 3 |
src/Path.py | gabbonj/Workbench | 2 | 4659 | import numpy as np
from ctypes import c_void_p
from .Shader import Shader
from .transforms import *
from OpenGL.GL import *
class Path:
# position=[x1, y1, z1, ..., xn, yn, zn] ; rotation = [[Rx1, Ry1, Rz1], ..., [Rxn, Ryn, Rzn]]
def __init__(self, position, rotation=None):
self.loadPath(position)
... | 2.390625 | 2 |
icfree/echo_instructor/args.py | brsynth/icfree-ml | 1 | 4660 | from argparse import (
ArgumentParser
)
from os import getcwd as os_getcwd
DEFAULT_OUTPUT_FOLDER = os_getcwd()
DEFAULT_SAMPLE_VOLUME = 10000
def build_args_parser(
program,
description):
parser = ArgumentParser(
program,
description,
)
parser = add_arguments(pars... | 2.890625 | 3 |
ex1_01.py | sitdh/59.com-prog | 1 | 4661 | import math
x = float(input())
prop_2 = -(x**2) / math.factorial(2)
prop_3 = (x**4) / math.factorial(4)
prop_4 = -(x**6) / math.factorial(6)
cos_x = float(1 + prop_2 + prop_3 + prop_4)
print(prop_2)
print(prop_3)
print(prop_4)
print(cos_x)
| 3.609375 | 4 |
test/datagateway_api/icat/filters/test_where_filter.py | MRichards99/datagateway-api | 2 | 4662 | <filename>test/datagateway_api/icat/filters/test_where_filter.py
import pytest
from datagateway_api.src.common.exceptions import BadRequestError, FilterError
from datagateway_api.src.datagateway_api.filter_order_handler import FilterOrderHandler
from datagateway_api.src.datagateway_api.icat.filters import PythonICATWh... | 2.265625 | 2 |
scrapy/spider/spider/items.py | huobingli/splider | 0 | 4663 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy.loader import ItemLoader
from scrapy.loader.processors import TakeFirst
# class SpiderItem(scrapy.Item):
# # define the fields for your... | 2.8125 | 3 |
codetools/contexts/multi_context.py | enthought/codetools | 29 | 4664 | #
# (C) Copyright 2013 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
""" Context holding multiple subcontexts.
"""
from __future__ import absolute_import
from itertools import chain
from collections import MutableMapping ... | 2.109375 | 2 |
line_counter/TestCodes/python_test.py | FMoller/coding-auxiliary-tools | 0 | 4665 | """A simple file to test the line_counter performance in python
This is a multiline doctest
"""
__author__ = "<NAME>"
__copyright__ = ""
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "1.0.1"
__maintainer__ = "<NAME>"
__email__ = ""
__status__ = ""
#import things
import math
#define things
def some_fun... | 2.984375 | 3 |
causal_attribution/data.py | VaniW/deconfounded-lexicon-induction | 25 | 4666 | """Data pipelines."""
from collections import defaultdict, OrderedDict
from tqdm import tqdm
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
import torch
def get_info(examples, vocab=None, max_seq_len=256):
"""Gathers info on and creats a featurized example generator for... | 2.78125 | 3 |
fopp/Chapter 12. Functions/get_num_digits.py | H2u-Hwng/EVC | 0 | 4667 | <reponame>H2u-Hwng/EVC
# Take number, and convert integer to string
# Calculate and return number of digits
def get_num_digits(num):
# Convert int to str
num_str = str(num)
# Calculate number of digits
digits = len(num_str)
return digits
# Define main function
def main():
#... | 4.15625 | 4 |
app/dialog/avatar_picture_dialog.py | tirinox/alphavatarbot | 1 | 4668 | <filename>app/dialog/avatar_picture_dialog.py<gh_stars>1-10
import asyncio
from contextlib import AsyncExitStack
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.dispatcher.storage import FSMContextProxy
from aiogram.types import Message, PhotoSize, ReplyKeyboardRemove, ContentTypes
from ai... | 2.140625 | 2 |
image_store_processing.py | olubiyiontheweb/digid_websearch_flask | 1 | 4669 | <reponame>olubiyiontheweb/digid_websearch_flask
from skimage.metrics import structural_similarity as ssim
from glob import glob
from PIL import Image
import numpy as np
import ntpath
import dhash
import cv2
from database_structure import database_migrations
IMAGE_FOLDER = "./image_store"
ALLOWED_EXTENSIONS = ['png', ... | 2.53125 | 3 |
cogs/jpserv.py | elthorito/Rai | 0 | 4670 | import discord
from discord.ext import commands
import os
import json
from datetime import date, datetime, timedelta
from .utils import helper_functions as hf
from copy import deepcopy
dir_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))).replace('\\', '/')
class Jpserv(commands.Cog):
"""Module... | 2.375 | 2 |
nehebn2.py | psifertex/nehebn2 | 0 | 4671 | <gh_stars>0
#!/usr/bin/env python3
from components import ProgramState
import binaryninja as binja
import argparse
import os.path
import curses
# TODO...impliment live-refreashing the settings.json during run (add the keybinding and check for it here in the global input loop)
# TODO...support multi-key presses? Not s... | 2.5625 | 3 |
keras/layers/pooling/base_pooling3d.py | itsraina/keras | 0 | 4672 | # Copyright 2015 The TensorFlow 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 required by applica... | 2.46875 | 2 |
main.py | lucastan96/video2bitmap | 1 | 4673 | <reponame>lucastan96/video2bitmap<gh_stars>1-10
import moviepy.editor as mpy
import moviepy.video.fx.all as vfx
import subprocess as sp
# Crop and resize video
clip = mpy.VideoFileClip("smoke.mp4")
(w, h) = clip.size
cropped_clip = vfx.crop(clip, width=(h/128)*64, height=h, x1=w/4*3-100, y1=0).resize((64, 128))
croppe... | 2.75 | 3 |
ghostwriter/rolodex/apps.py | bbhunter/Ghostwriter | 601 | 4674 | """This contains the configuration of the Rolodex application."""
# Django Imports
from django.apps import AppConfig
class RolodexConfig(AppConfig):
name = "ghostwriter.rolodex"
def ready(self):
try:
import ghostwriter.rolodex.signals # noqa F401 isort:skip
except ImportError:
... | 1.59375 | 2 |
boards/migrations/0024_boardpreferences_moderators.py | oscarsiles/jotlet | 0 | 4675 | <filename>boards/migrations/0024_boardpreferences_moderators.py
# Generated by Django 4.0.3 on 2022-03-01 14:42
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 1.539063 | 2 |
models/minimize_model.py | MichalBusta/OpenCitiesAIC | 7 | 4676 | <filename>models/minimize_model.py
'''
Created on Mar 22, 2020
@author: Michal.Busta at gmail.com
'''
#get rid of the optimizer state ...
import torch
MODEL_PATH = '/models/model-b2-2.pth'
state = torch.load(MODEL_PATH, map_location=lambda storage, loc: storage)
state_out = {
"state_dict": state["state_dict"],
}
... | 2.34375 | 2 |
setup.py | thomas-kloeber/braumeister | 6 | 4677 | import os
import re
from setuptools import setup
version = re.search(
'^__version__\s*=\s*"(.*)"',
open('braumeister/braumeister.py').read(),
re.M
).group(1)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="braumeister",
packages=["braumeiste... | 1.734375 | 2 |
modules/inference.py | rubelchowdhury20/wuton-with-densepose | 12 | 4678 | # standard library imports
import os
# third party imports
import numpy as np
from PIL import Image
import torch.nn as nn
from torchvision import transforms
# local imports
import config
from . import utils
from . import geometric_transformer
class GeoTransformationInfer(nn.Module):
def __init__(self, output_di... | 2.3125 | 2 |
imggen/fonts.py | p-lambda/unlabeled_outputs | 4 | 4679 | from pathlib import Path
import h5py
import numpy as np
from torchvision.datasets.vision import VisionDataset
from PIL import Image
import requests
import zipfile
from tqdm import tqdm
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests... | 2.453125 | 2 |
leetcode/47.py | windniw/just-for-fun | 1 | 4680 | """
link: https://leetcode.com/problems/permutations-ii
problem: 求全排列,nums中存在重复数
solution: 同46,加上排序即可
"""
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
if len(nums) == 1:
return [nums]
new_nums = nums.copy()
new_nums.sort()
... | 3.1875 | 3 |
adminmgr/media/code/A3/task3/T1_ocefXVJ.py | IamMayankThakur/test-bigdata | 9 | 4681 | import findspark
findspark.init()
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
def tmp(x):
y = (x.split(';')[7]).split(',')
return (y)
def forf(x):
for i in x:
yield (i,1)
def topprint(time,rdd):
re... | 2.625 | 3 |
courses/migrations/0003_alter_content_options_alter_module_options_and_more.py | antonnifo/E-Soma | 1 | 4682 | # Generated by Django 4.0.1 on 2022-01-20 13:10
import courses.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0002_video_text_image_file_content'),
]
operations = [
migrations.AlterModelOptions(
name='content',
... | 1.664063 | 2 |
pkg/maths/maths.py | prateekdegaons1991/experiment-loadtest | 8 | 4683 | #Atoi stands for ASCII to Integer Conversion
def atoi(string):
res = 0
# Iterate through all characters of
# input and update result
for i in range(len(string)):
res = res * 10 + (ord(string[i]) - ord('0'))
return res
#Adjustment contains rule of three for calculating an integer given an... | 3.90625 | 4 |
google_compute_engine/config_manager.py | redoxdrh/GCP-Flask | 2 | 4684 | #!/usr/bin/python
# Copyright 2016 Google Inc. 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 appli... | 2.5625 | 3 |
mscreen/autodocktools_prepare_py3k/mglutil/web/services/AppService_services.py | e-mayo/mscreen | 9 | 4685 | <reponame>e-mayo/mscreen
##################################################
# ./AppService_services.py
# generated by ZSI.wsdl2python
#
#
##################################################
from .AppService_services_types import *
from .AppService_services_types import \
nbcr_sdsc_edu_opal_types as ns1
import... | 2.03125 | 2 |
examples/pytorch/swin/checkpoint_quantization.py | hieuhoang/FasterTransformer | 0 | 4686 | # Copyright (c) 2020-2022, 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 ... | 1.554688 | 2 |
mars/deploy/kubernetes/core.py | tomzhang/mars-1 | 0 | 4687 | # -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding 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.org/licenses/LICENSE-2.0
#
# Unless require... | 1.90625 | 2 |
tests/tests_model/tests_bert_model.py | elangovana/gene_normalisation | 1 | 4688 | from unittest import TestCase
import torch
import transformers
from model.bert_model import BertModel
class TestBertModel(TestCase):
def test_forward(self):
# Bert Config
vocab_size = 10
sequence_len = 20
batch = 32
num_classes = 3
expected_shape = (batch, seque... | 2.96875 | 3 |
tests/renderer_test.py | tmcclintock/PyDonJuan | 2 | 4689 | import json
import os
import tempfile
from unittest import TestCase
import pytest
from donjuan import Dungeon, DungeonRandomizer, Renderer
class RendererTest(TestCase):
def setUp(self):
super().setUp()
self.TEMP_DIR = tempfile.mkdtemp()
def test_smoke(self):
r = Renderer()
a... | 2.5 | 2 |
src/foremast/validate.py | dnava013/foremast | 157 | 4690 | <gh_stars>100-1000
"""Spinnaker validate functions."""
import logging
from .consts import API_URL
from .utils.credentials import get_env_credential
LOG = logging.getLogger(__name__)
def validate_gate():
"""Check Gate connection."""
try:
credentials = get_env_credential()
LOG.debug('Found cre... | 2.71875 | 3 |
constellation_forms/migrations/0001_initial.py | ConstellationApps/Forms | 2 | 4691 | <filename>constellation_forms/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 00:56
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletio... | 1.625 | 2 |
src/webpy1/src/borough/dbsqli.py | ptphp/PyLib | 1 | 4692 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3 as sqlite
import os.path as osp
import sys
class Sqli(object):
conn = ''
cursor = ''
def __init__(self, dbname):
try:
self.conn = sqlite.connect(osp.abspath(dbname))
except Exception, what:
... | 3.5 | 4 |
losses/all_lost.py | Liudzz/loss-chapter | 2 | 4693 | """
easy way to use losses
"""
from center_loss import Centerloss
import torch.nn as nn
from FocalLoss import FocalLoss
def center_loss(pred,label,num_calss,feature):
loss = Centerloss(num_calss,feature)
return loss(pred,label)
def Focal_loss(pred,label,num_calss,alaph=None, gamma):
loss = Centerloss(num... | 2.734375 | 3 |
nova/tests/functional/test_metadata.py | Nexenta/nova | 1 | 4694 | # Copyright 2016 Rackspace Australia
# 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 requi... | 1.828125 | 2 |
openue/sequence_labeling/subject_labeling_data_manager.py | zxlzr/OpenUE | 8 | 4695 | import os
import sys
import json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../bert")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
import tokenization
from config import config
class Model_data_preparation(object):
def __init__(self, DATA_... | 2.46875 | 2 |
clarifai/rest/grpc/custom_converters/custom_message_to_dict.py | Taik/clarifai-python | 322 | 4696 | <reponame>Taik/clarifai-python
import typing # noqa
from google.protobuf import descriptor
from google.protobuf.json_format import _IsMapEntry, _Printer
from google.protobuf.message import Message # noqa
from clarifai.rest.grpc.proto.clarifai.api.utils import extensions_pb2
def protobuf_to_dict(object_protobuf, u... | 1.976563 | 2 |
__init__.py | mschrimpf/CapsNetKeras | 0 | 4697 | <gh_stars>0
from .capsulenet import *
| 1.140625 | 1 |
gate/mate_ksx3267v2.py | mrchoi87/IRSOSv4 | 0 | 4698 | <filename>gate/mate_ksx3267v2.py
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 JiNong, Inc.
# All right reserved.
#
import struct
import time
import socket
import select
import traceback
import hashlib
import json
from enum import IntEnum
from threading import Thread, Lock
from mate import Mat... | 1.976563 | 2 |
CircleciScripts/run_integrationtests.py | aimalygin/aws-sdk-ios | 17 | 4699 | <filename>CircleciScripts/run_integrationtests.py
import demjson
import sys
from subprocess import Popen, PIPE
import subprocess
import xml.etree.ElementTree as ET
import os
from datetime import datetime
from functions import runcommand
#from sets import Set
def getfailedcases(withBundle = True):
xmlfile='build/... | 2.140625 | 2 |