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 |
|---|---|---|---|---|---|---|
socketio/asgi.py | zwerg44/python-socketio | 0 | 12788351 | import engineio
class ASGIApp(engineio.ASGIApp):
"""ASGI application middleware for Socket.IO.
This middleware dispatches traffic to an Socket.IO application. It can
also serve a list of static files to the client, or forward unrelated
HTTP traffic to another ASGI application.
:param socketio_se... | 2.8125 | 3 |
test/utils.py | f-dangel/backobs | 1 | 12788352 | import random
import numpy
import torch
from backobs.integration import extend as backobs_extend
from backobs.integration import (
extend_with_access_unreduced_loss as backobs_extend_with_access_unreduced_loss,
)
def set_deepobs_seed(seed=0):
"""Set all seeds used by DeepOBS."""
random.seed(seed)
nu... | 2.4375 | 2 |
usmart_sdk/usmart.py | UrbanTide/usmart-sdk-py | 0 | 12788353 | <reponame>UrbanTide/usmart-sdk-py<filename>usmart_sdk/usmart.py<gh_stars>0
"""
USMRT SDK
"""
import requests
class USMART:
auth = None
def __init__(self, auth=None):
if auth is not None:
if "keyId" not in auth:
raise Exception("Auth requires keyId")
if "keySec... | 2.546875 | 3 |
sparsePlane/sparseplane/data/planercnn_transforms.py | jinlinyi/SparsePlanes | 69 | 12788354 | import copy
import numpy as np
import os
import torch
import pickle
from detectron2.data import MetadataCatalog
from detectron2.data import detection_utils as utils
from detectron2.structures import (
BitMasks,
Boxes,
BoxMode,
Instances,
PolygonMasks,
polygons_to_bitmask,
)
import pycocotools.ma... | 2.46875 | 2 |
tests/test_models.py | ivoire/KissCache | 0 | 12788355 | <filename>tests/test_models.py<gh_stars>0
# -*- coding: utf-8 -*-
# vim: set ts=4
#
# Copyright 2019 Linaro Limited
#
# Author: <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: MIT
import pytest
import time
from kiss_cache.models import Resource
def test_resource_parse_ttl():
assert Resource.parse_ttl("1d") == 60 ... | 2.234375 | 2 |
screenpy/actions/see.py | perrygoy/screenpy | 39 | 12788356 | <reponame>perrygoy/screenpy<filename>screenpy/actions/see.py<gh_stars>10-100
"""
Make an assertion using a Question and a Resolution.
"""
from typing import Any, Union
from hamcrest import assert_that
from screenpy import Actor
from screenpy.pacing import beat
from screenpy.protocols import Answerable
from screenpy.... | 2.890625 | 3 |
src/files_sort_out/files_sort_out.py | AndriiOshtuk/files_sort_out | 0 | 12788357 | <gh_stars>0
import shelve
import shutil
import time
from pathlib import Path
import click
db_filename = "files_sort_out.db"
@click.group()
def cli() -> None:
"""File Sort a tool to organize images on a path.
To get started, run collect:
$ files_sort_out collect
To show collected image folders:
... | 3.03125 | 3 |
MatOp.py | ElliotHYLee/MyPyTorchAPI | 0 | 12788358 | <gh_stars>0
import torch
import torch.nn as nn
import numpy as np
class BatchScalar33MatMul(nn.Module):
def __init__(self):
super().__init__()
def forward(self, scalar, mat):
s = scalar.unsqueeze(2)
s = s.expand_as(mat)
return s*mat
class GetIdentity(nn.Module):
def __init... | 2.28125 | 2 |
test/unit/hsts_support_test.py | grauwoelfchen/pyramid_secure_response | 2 | 12788359 | <reponame>grauwoelfchen/pyramid_secure_response
import pytest
from pyramid_secure_response.hsts_support import tween
@pytest.fixture(autouse=True)
def setup():
import logging
from pyramid_secure_response.hsts_support import logger
logger.setLevel(logging.ERROR)
@pytest.mark.parametrize('max_age,include... | 1.945313 | 2 |
web/urls.py | odinje/yactff | 1 | 12788360 | <gh_stars>1-10
from django.urls import re_path, path
from django.contrib.auth import views as auth_views
from web import views
from django.conf import settings
from web.forms import LoginForm
LoginForm.signup_open = settings.SIGNUP_OPEN
urlpatterns = [
path("", views.page, name="index"),
path("challenges/", v... | 1.84375 | 2 |
desktop/core/ext-py/future-0.16.0/docs/futureext.py | kokosing/hue | 908 | 12788361 | # -*- coding: utf-8 -*-
"""
Python-Future Documentation Extensions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for automatically documenting filters and tests.
Based on the Jinja2 documentation extensions.
:copyright: Copyright 2008 by <NAME>.
:license: BSD.
"""
import collections
import o... | 2.140625 | 2 |
src/code/data_analysis.py | ekholabs/pandas_tutorial | 0 | 12788362 | <reponame>ekholabs/pandas_tutorial
"""
Organisation: ekholabs
Author: <EMAIL>
"""
import matplotlib.pyplot as plt
from utils import dataset as ds
'''
Let's start with loading out 'gapminder' dataset.
'''
DF = ds.load_gapminder()
'''
Let's now do somple simple statistical analysis on the data.
'''
... | 3.515625 | 4 |
footmark/ram/ram.py | konstantin-kornienko/footmark | 18 | 12788363 | """
Represents an VPC Security Group
"""
from footmark.ram.ramobject import TaggedRAMObject
class User(TaggedRAMObject):
def __init__(self, connection=None):
super(User, self).__init__(connection)
def __repr__(self):
return 'Ram:%s' % self.id
def __getattr__(self, name):
if name ... | 2.4375 | 2 |
core/structures/structures.py | Boooru/BooruViu | 1 | 12788364 | from time import time
class CallController:
def __init__(self, max_call_interval):
self._max_call_interval = max_call_interval
self._last_call = time()
def __call__(self, function):
def wrapped(*args, **kwargs):
now = time()
if now - self._last_call > self._m... | 3.46875 | 3 |
tachi_local/bakaupdates/utils.py | MisaghM/Tachi-Local-Details | 1 | 12788365 | import re
import urllib.parse
from typing import Union
_scheme_regex = re.compile(r"^(?:https?)?$", flags=re.IGNORECASE | re.ASCII)
_netloc_regex = re.compile(r"^(?:www\.)?mangaupdates\.com$", flags=re.IGNORECASE | re.ASCII)
_query_regex = re.compile(r"id=(\d+)(?:&|$)", flags=re.IGNORECASE | re.ASCII)
def get_id_fr... | 2.9375 | 3 |
timing_tests/time_vertex_search.py | vinay-swamy/TALON | 0 | 12788366 | <reponame>vinay-swamy/TALON
import timeit
import sqlite3
import sys
sys.path.append("..")
import talonQ as talon
def run_vertex_queries(location_dict, n):
""" Run vertex query n times"""
for i in range(0,n):
talon.search_for_vertex_at_pos("chr1", 1, location_dict)
def run_timetest(cursor, n):
fn =... | 2.78125 | 3 |
xml_stream/data_types.py | dfilipp/xml_stream | 8 | 12788367 | """Module containing the data types needed for the module to work"""
from typing import Iterable, List, Dict, Union, Any
from xml.etree.ElementTree import Element
from ._utils import get_unique_and_repeated_sub_elements, \
get_xml_element_attributes_as_dict, add_common_sub_elements
def group_elements_by_tag(elem... | 3.265625 | 3 |
aidapy/meta/__init__.py | drdavis/aidapy | 0 | 12788368 | from .meta import get_proc_gen
from .meta import get_dsids
from .meta import proc_gen_from_file
from .meta import sort_files_from_txt
from .meta import _dsid_table
from .meta import _systematic_trees
from .meta import _systematic_ud_prefixes
from .meta import _systematic_weights
from .meta import _systematic_singles
fr... | 1.09375 | 1 |
tests/unit/features/test_schemas.py | Flagsmith/flagsmith-engine | 4 | 12788369 | import pytest
from flag_engine.features.schemas import (
FeatureStateSchema,
MultivariateFeatureOptionSchema,
MultivariateFeatureStateValueSchema,
)
from flag_engine.utils.exceptions import InvalidPercentageAllocation
def test_can_load_multivariate_feature_option_dict_without_id_field():
Multivariate... | 2.125 | 2 |
src/models/base.py | thavlik/machine-learning-portfolio | 1 | 12788370 | import torch
from torch import nn, Tensor
from torch.nn import functional as F
from abc import abstractmethod
from typing import List, Callable, Union, Any, TypeVar, Tuple
from .util import reparameterize
class BaseVAE(nn.Module):
def __init__(self,
name: str,
latent_dim: int) ->... | 2.4375 | 2 |
Project Code/windows_connector.py | nsusas3/SU19CSE299S08G02NSU | 0 | 12788371 | import socket
host = "192.168.0.103"
port_windows = 7899
while True:
try:
socket_windows = socket.socket()
socket_windows.connect((host, port_windows))
temp = socket_windows.recv(1024).decode()
if temp:
print(temp)
continue
except Exception:
con... | 2.734375 | 3 |
app/main/atendendo.py | ATSTI/Flask-SocketIO-Chat | 0 | 12788372 | <filename>app/main/atendendo.py
#!/usr/bin/env python3
from flask import Flask, render_template
import sqlite3
from sistema_suporte import Conexao
app = Flask(__name__)
@app.route('/atendendo')
def lista_chamados(name=None):
c = Conexao()
chamadas = c.lista_chamadas
#movies = [dict(id=row[0], movie_name=... | 3.046875 | 3 |
cogs/commands/mod/modactions.py | DiscordGIR/GIRRewrite | 0 | 12788373 | from datetime import datetime, timedelta, timezone
import discord
import humanize
from apscheduler.jobstores.base import ConflictingIdError
from data.model import Case
from data.services import guild_service, user_service
from discord import app_commands
from discord.ext import commands
from discord.utils import escap... | 2.109375 | 2 |
src/__init__.py | cynth-s/Information_retrieval | 191 | 12788374 | <reponame>cynth-s/Information_retrieval
__author__ = '<NAME>'
__all__ = ['invdx', 'parse', 'query', 'rank']
| 1.15625 | 1 |
ccat/controller/strategy/TODO_sample_strategy.py | bhaveshrawal/Python | 3 | 12788375 | '''
------------------------------------------------------------------------
MOMENTUM.PY
------------------------------------------------------------------------
If extreme, overtraded or wix issue long, or short signals, trigger the
executor
'''
'''
---------------------------------------------------------------... | 1.804688 | 2 |
arrayqueues/shared_arrays.py | portugueslab/arrayqueues | 27 | 12788376 | from datetime import datetime
from multiprocessing import Array
from queue import Empty, Full
# except AttributeError:
# from multiprocessing import Queue
import numpy as np
# try:
from arrayqueues.portable_queue import PortableQueue # as Queue
class ArrayView:
def __init__(self, array, max_bytes, dtype, el_sh... | 2.8125 | 3 |
python/edl/utils/error_utils.py | WEARE0/edl | 90 | 12788377 | <reponame>WEARE0/edl<filename>python/edl/utils/error_utils.py<gh_stars>10-100
# Copyright (c) 2020 PaddlePaddle 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
#... | 2.265625 | 2 |
Hard/460.py | Hellofafar/Leetcode | 6 | 12788378 | # ------------------------------
# 460. LFU Cache
#
# Description:
# Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put.
# get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.... | 3.90625 | 4 |
weather/domain/objects.py | rerupp/weather | 1 | 12788379 | import sys
from calendar import monthrange
from contextlib import contextmanager
from csv import DictReader, DictWriter
from datetime import date, datetime, timedelta, MINYEAR
from enum import Enum
from gzip import GzipFile
from importlib.resources import open_binary as open_binary_package
from io import TextIOWrapper
... | 2.390625 | 2 |
jsb/plugs/core/user.py | NURDspace/jsonbot | 1 | 12788380 | # jsb/plugs/core/user.py
#
#
""" users related commands. """
## jsb imports
from jsb.utils.generic import getwho
from jsb.utils.exception import handle_exception
from jsb.utils.name import stripname
from jsb.lib.users import users
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imp... | 2.203125 | 2 |
app/modules/names/models.py | WildMeOrg/houston | 6 | 12788381 | # -*- coding: utf-8 -*-
"""
Names database models
A structure for holding a (user-provided) name for an Individual.
--------------------
"""
import uuid
from app.extensions import db, HoustonModel, Timestamp
import logging
import app.extensions.logging as AuditLog
log = logging.getLogger(__name__) # pylint: disable... | 2.703125 | 3 |
random-images/WallpaperGenerator/constants.py | dominicschaff/random | 0 | 12788382 | from __future__ import division
from math import radians as rad, cos, sin
from PIL import Image, ImageDraw
from random import randint
width,height = 1280,1280
def randColour(s=0,e=255):
return (randint(s,e),randint(s,e),randint(s,e))
def drange(start, stop, step):
r = start
while r < stop:
yield ... | 3.15625 | 3 |
tests/unit/test_typehinting.py | timothygebhard/hsr4hci | 1 | 12788383 | """
Tests for typehinting.py
"""
# -----------------------------------------------------------------------------
# IMPORTS
# -----------------------------------------------------------------------------
import pytest
from hsr4hci.typehinting import (
BaseLinearModel,
BaseLinearModelCV,
RegressorModel,
)
... | 2.484375 | 2 |
From_Colab/Test/Portfolio_UpDownZero.py | Jun-bitacademy/PyPortfolioOpt | 0 | 12788384 | '''
전략 : 하루의 주가를 놓고 보면 오른 경우가 42%, 내린 경우가 46%, 나머지 12%는 변동이 없다. 증명
알고리즘 : PyportfolioOpt 라이브러리 이용한 최적화
(max sharp, risk, return, fund remaining)
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import FinanceDataReader as fdr
import datetime
from pykrx import stock
import requests
from pypfop... | 2.828125 | 3 |
venv/lib/python3.6/site-packages/ansible_collections/fortinet/fortios/plugins/modules/fortios_json_generic.py | usegalaxy-no/usegalaxy | 1 | 12788385 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program 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 Lic... | 1.398438 | 1 |
poisson_1d.py | lujiarui/gan_pde | 1 | 12788386 | <reponame>lujiarui/gan_pde<gh_stars>1-10
"""[4.2.1] Poisson equation only admits weak solution
Implemented with Pytorch. (torch version >= 1.8.1)
* Variable interpretation:
- x: torch.Tensor, (Number of points, dimension)
-
"""
import sys, os
from copy import deepcopy
import random
from random import randint
import ... | 2.34375 | 2 |
problems/csp/real/Fillomino.py | xcsp3team/pycsp3 | 28 | 12788387 | <filename>problems/csp/real/Fillomino.py
"""
See https://en.wikipedia.org/wiki/Fillomino
Example of Execution:
python3 Fillomino.py -data=Fillomino-08.json
"""
from pycsp3 import *
puzzle = data
n, m = len(puzzle), len(puzzle[0])
preassigned = dict() # we collect pre-assigned starting squares for the first occur... | 3.359375 | 3 |
SequenceAnnotation/phate_fastaSequence.py | carolzhou/multiPhATE | 19 | 12788388 | <reponame>carolzhou/multiPhATE
#############################################################
# Module: phate_fastaSequence.py
#
# Programmer: <NAME>
#
# Module containing classes and methods for representing a multi-fasta sequence and associated methods
# Classes and methods:
# fasta
# queryNRsequence(gi,... | 2 | 2 |
dataset/acquisition/convert_annotated_video_directory.py | MannyKayy/PlayableVideoGeneration | 1 | 12788389 | <reponame>MannyKayy/PlayableVideoGeneration
import subprocess
import glob
import os
import pandas as pd
import cv2
import shutil
import multiprocessing as mp
from pathlib import Path
from PIL import Image
from dataset.video import Video
video_extension = "mp4"
frames_extension = "png"
root_directory = "tmp"
output_... | 2.75 | 3 |
android_appium_profiler/apps/amaze.py | qiangxu1996/android-appium-profiler | 0 | 12788390 | import time
import logging
import os
import adb
from .. import app_test
from ..dummy_driver import TouchAction
logger = logging.getLogger(__name__)
IMG_TO_MV = 'IMG_1555.jpg'
ANDROID_PIC_DIR = '/sdcard/Pictures'
ANDROID_DL_DIR = '/sdcard/Download'
class App(app_test.AppTest):
def __init__(self, **kwargs):
... | 2.171875 | 2 |
attic/concurrency/flags/getthreadpool.py | matteoshen/example-code | 5,651 | 12788391 | <reponame>matteoshen/example-code
from concurrent import futures
import sys
import requests
import countryflags as cf
import time
from getsequential import fetch
DEFAULT_NUM_THREADS = 100
GLOBAL_TIMEOUT = 300 # seconds
times = {}
def main(source, num_threads):
pool = futures.ThreadPoolExecutor(num_threads)
... | 2.875 | 3 |
FATERUI/common/camera/mindvision/CameraMindVision.py | LynnChan706/Fater | 4 | 12788392 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.11
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path impo... | 1.992188 | 2 |
backend/app/views.py | Yscorexm/ARGo | 0 | 12788393 | <gh_stars>0
from django.shortcuts import render
from django.db import connection
from django.http import JsonResponse, HttpResponse
from django.views.decorators.csrf import csrf_exempt
import json
import os, time
from django.conf import settings
from django.core.files.storage import FileSystemStorage
@csrf_exempt
de... | 2.0625 | 2 |
spinta/backends/mongo/commands/migrate.py | atviriduomenys/spinta | 2 | 12788394 | <filename>spinta/backends/mongo/commands/migrate.py
from spinta import commands
from spinta.components import Context
from spinta.manifests.components import Manifest
from spinta.backends.mongo.components import Mongo
@commands.migrate.register(Context, Manifest, Mongo)
def migrate(context: Context, manifest: Manifes... | 1.609375 | 2 |
vstb_launch.py | gabrik/vstb_launcher | 0 | 12788395 | #!/usr/bin/env python3
import libvirt
##
## vstb_launch.py
## EU INPUT
##
## Created by <NAME> on 28/10/2017
## Copyright (c) 2017 <NAME>. All rights reserved.
##
class VSTB(object):
'''
This class define, start, and then destroy and undefine the vSTB VMs
'''
def __init__(self, base_path, domain... | 2.453125 | 2 |
copulae/copula/summary.py | CrisDS81/copulae | 100 | 12788396 | <reponame>CrisDS81/copulae<filename>copulae/copula/summary.py
from abc import ABC, abstractmethod
from typing import Any, Dict
import numpy as np
import pandas as pd
class SummaryType(ABC):
def as_html(self):
return self._repr_html_()
@abstractmethod
def _repr_html_(self) -> str:
...
... | 3.125 | 3 |
deep_qa/testing/test_case.py | richarajpal/deep_qa | 459 | 12788397 | # pylint: disable=invalid-name,protected-access
from copy import deepcopy
from unittest import TestCase
import codecs
import gzip
import logging
import os
import shutil
from keras import backend as K
import numpy
from numpy.testing import assert_allclose
from deep_qa.common.checks import log_keras_version_info
from d... | 2.046875 | 2 |
week11/helloWorld.py | kmcooper/BMI8540 | 0 | 12788398 | <filename>week11/helloWorld.py
# This program prints out Hello World!
#/usr/bin/python3.7
# Prints out Hello World
# Thats it. Thats the code.
print("Hello world!")
| 2.75 | 3 |
src/larksuiteoapi/api/response/__init__.py | keeperlibofan/oapi-sdk-python | 50 | 12788399 | <reponame>keeperlibofan/oapi-sdk-python<gh_stars>10-100
# -*- coding: UTF-8 -*-
from .response import *
| 0.882813 | 1 |
cpmoptimize/recompiler.py | borzunov/cpmoptimize | 121 | 12788400 | <reponame>borzunov/cpmoptimize<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import byteplay
from matcode import *
class RecompilationError(Exception):
def __init__(self, message, state):
self.message = "Can't optimize loop: %s" % message
if state.lineno is not None:
... | 2.359375 | 2 |
bassist/bassist/scripts/common.py | Doveps/mono | 0 | 12788401 | # Copyright (c) 2015 <NAME>
# See the file LICENSE for copying permission.
# This object is intended to run from script bassist.py
import logging
import logging.config
import argparse
import ConfigParser
from ..parser import host as parser_host
from ..flavor import directory as flavor_directory
class Script(object):
... | 2.25 | 2 |
train.py | Nico-Adamo/CNNF | 0 | 12788402 | from __future__ import print_function
import os
import logging
import numpy as np
import random
import math
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
impor... | 2.140625 | 2 |
marcottievents/etl/exml/__init__.py | soccermetrics/marcotti-events | 22 | 12788403 | <reponame>soccermetrics/marcotti-events
from .base import BaseXML, FeedElement, FeedParser
| 1.015625 | 1 |
scripts/update_blueprint_versions.py | aws-samples/aws-enterprise-jumpstart | 2 | 12788404 | <filename>scripts/update_blueprint_versions.py
import os
import boto3
import yaml
from botocore.config import Config
boto3_config = Config(
retries={
'max_attempts': 10,
'mode': 'standard'
}
)
BLUEPRINTS_KEY = "blueprints"
artifacts_bucket_name = os.getenv("ARTIFACTS_BUCKET_NAME")
artifacts_bu... | 2.03125 | 2 |
bc/utils/misc.py | ikalevatykh/rlbc | 1 | 12788405 | import torch
import random
import socket
import os
import numpy as np
def get_device(device):
assert device in (
'cpu', 'cuda'), 'device {} should be in (cpu, cuda)'.format(device)
if socket.gethostname() == 'gemini' or not torch.cuda.is_available():
device = 'cpu'
else:
device = '... | 2.34375 | 2 |
tests/test_config.py | artur-shaik/wallabag-client | 16 | 12788406 | import os
import tempfile
import pathlib
import pytest
from wallabag.config import Configs, Options, Sections
from xdg.BaseDirectory import xdg_config_home as XDG_CONFIG_HOME
class TestConfigs():
configs = None
def teardown_method(self, method):
os.close(self.fd)
os.remove(self.path)
... | 2.34375 | 2 |
src/estructura-flask/apiflaskdemo/project/auth/__init__.py | PythonistaMX/py231 | 3 | 12788407 | <filename>src/estructura-flask/apiflaskdemo/project/auth/__init__.py
from functools import wraps
from flask import g, abort
def login_required(view):
@wraps(view)
def wrapped_view(*args, **kwargs):
if g.user is None:
return abort(403)
return view(*args,**kwargs)
return wrapped_... | 1.992188 | 2 |
src/models/DGV0/model_v0.py | ChihabEddine98/DeepGo | 8 | 12788408 | <gh_stars>1-10
# imports
import os
import tensorflow.nn as nn
from tensorflow.keras import Input,Model
from tensorflow.keras.utils import plot_model
from tensorflow.keras import layers, regularizers,activations
from tensorflow.keras.optimizers import SGD,Adam
from utils import configs , DotDict
# end imports
'''
... | 2.25 | 2 |
clickuz/migrations/0001_initial.py | aziz837/ClickUz | 39 | 12788409 | <reponame>aziz837/ClickUz
# Generated by Django 3.0.5 on 2020-04-26 15:04
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Transaction',
fields=[
... | 1.90625 | 2 |
clinicadl/clinicadl/tools/deep_learning/data.py | 921974496/AD-DL | 1 | 12788410 | import torch
import pandas as pd
import numpy as np
from os import path
from torch.utils.data import Dataset, sampler
from scipy.ndimage.filters import gaussian_filter
class MRIDataset(Dataset):
"""Dataset of MRI organized in a CAPS folder."""
def __init__(self, img_dir, data_file, preprocessing='linear', tr... | 2.84375 | 3 |
11/solution.py | Hegemege/advent-of-code-2021 | 0 | 12788411 | <gh_stars>0
class Octopus:
def __init__(self, energy):
self.flashed = False
self.energy = energy
self.neighbors = []
self.flashes = 0
def flash(self):
if self.flashed:
return
self.flashed = True
self.flashes += 1
for neighbor in self.n... | 3.03125 | 3 |
delayBlit.py | cshih2003/Game-FSE | 0 | 12788412 | <reponame>cshih2003/Game-FSE
from time import *
from pygame import *
from math import *
from random import *
from tkinter import *
width=1050
height=750
screen=display.set_mode((width,height))
aa=True
RED=(255,0,0)
GREEN=(0,255,0)
BLACK=(0,0,0)
pathCol=(128,128,128,255)
pathCol2=(129,128,124,255)
init()
map1=image.l... | 2.75 | 3 |
simple_qubitization.py | balopat/qsvt_experiments | 2 | 12788413 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.484375 | 2 |
plugins/site_screenshot.py | dytplay/darkvkbot | 0 | 12788414 | import aiohttp
from plugin_system import Plugin
plugin = Plugin("Скриншот любого сайта",
usage=["скрин [адрес сайта] - сделать скриншот сайта [адрес сайта]"])
# Желательно первой командой указывать основную (она будет в списке команд)
@plugin.on_command('скрин')
async def screen(msg, args):
if n... | 2.59375 | 3 |
tests/right_tests/applier_tests/test_curry.py | lycantropos/lz | 7 | 12788415 | import pytest
from hypothesis import given
from lz import right
from lz.functional import curry
from tests import strategies
from tests.hints import (FunctionCall,
PartitionedFunctionCall)
@given(strategies.partitioned_transparent_functions_calls)
def test_basic(partitioned_function_call: Pa... | 2.28125 | 2 |
app/app/tests.py | snmirdamadi/kitchen-recipe | 0 | 12788416 | from django.test import TestCase
from app.calc import add, subtract
class CalcTest(TestCase):
def test_and_numbers(self):
"""Test that numbers are added together"""
self.assertEqual(add(3,8), 11)
def test_subtract_numbers(self):
"""Test That numbers are subtracted"""
self.ass... | 2.9375 | 3 |
functions.py | karipov/learn-to-decimals | 0 | 12788417 | <filename>functions.py
import random, decimal
import operator
ops = {"+": operator.add, "-": operator.sub, "/": operator.truediv,
"*": operator.mul} # this is so that strings are converted to operators
score_counter = 0 # overall score of the user. Modified by counter(t_or_f)
answers_list = [] # data for sending i... | 4.125 | 4 |
xdp_ddos/xdp_ip_whitelist.py | Oliryc/monobpf | 0 | 12788418 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# xdp_ip_whitelist.py Drop packet coming from ips not in a whitelist
#
# Based on https://github.com/iovisor/bcc/blob/master/examples/networking/xdp/xdp_drop_count.py,
# Copyright (c) 2016 PLUMgrid
# Copyright (c) 2016 <NAME>
# Licensed under the Apache License, Version 2.0 (... | 2.21875 | 2 |
sockets/tcp_server.py | zhaoyu69/python3-learning | 1 | 12788419 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TCP
import socket
# Client
# # create
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#
# # connect
# s.connect(('www.sina.com.cn', 80))
#
# # AF_INET IPV4
# # AF_INET6 IPV6
# # SOCK_STREAM 使用面向流的TCP协议
# # connect 参数是tuple 包含ip和port
#
# # send
# s.send(b'GET / ... | 3.40625 | 3 |
test_client.py | jbilskie/BME547_final | 0 | 12788420 | <gh_stars>0
# test_client.py
# Authors: <NAME>
# Last Modified: 4/24/19
from user import User
import numpy as np
import pytest
from image import read_img_as_b64
good_img1 = read_img_as_b64("test_client/test1.jpg")
good_img2 = read_img_as_b64("test_client/test2.png")
good_img3 = read_img_as_b64("test_client/test3.tiff... | 2.15625 | 2 |
app/plugin.dbmc/resources/lib/accountsettings.py | TidalPaladin/Superliminal-resin | 0 | 12788421 | <filename>app/plugin.dbmc/resources/lib/accountsettings.py
#/*
# * Copyright (C) 2013 <NAME>
# *
# *
# * This Program 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 2, or (at your o... | 1.789063 | 2 |
InjectionLog/migrations/0001_initial.py | JKesslerPhD/FIPInjectionLogger | 1 | 12788422 | # Generated by Django 3.0.6 on 2020-05-25 00:02
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL)... | 1.765625 | 2 |
class14.py | itsforbasu/Python_class_files | 1 | 12788423 | def display(*args):
for x in args:
print(x)
display("Sam")
display((2,4,5,6))
display(23)
def sum( *args):
total=0
print(len(args))
for x in args:
total += x
return total
print(sum(23))
print(sum(23,34,12))
print(sum(23,34,12,45,65,89))
def average( *args):
total= count=0
... | 3.828125 | 4 |
morm/exceptions.py | neurobin/python-morm | 4 | 12788424 | <filename>morm/exceptions.py
"""Exceptions.
"""
__author__ = '<NAME> <<EMAIL>>'
__copyright__ = 'Copyright © <NAME> <https://github.com/neurobin/>'
__license__ = '[BSD](http://www.opensource.org/licenses/bsd-license.php)'
__version__ = '0.0.1'
class ItemDoesNotExistError(Exception): pass
class TransactionError(Excep... | 1.96875 | 2 |
gettingdata/PrintRegexLinesOfFile.py | arunma/Python_DataScience | 1 | 12788425 | <gh_stars>1-10
import sys,re
file_name=sys.argv[1]
with open (file_name, 'r') as f:
for line in f:
if re.match("^#", line):
print(line)
#python PrintRegexLinesOfFile.py RegexMatch.py | 2.9375 | 3 |
python/Array/152_maximum_product_subarray.py | Jan-zou/LeetCode | 0 | 12788426 | <filename>python/Array/152_maximum_product_subarray.py<gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description:
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,... | 4.125 | 4 |
benchmarks.py | xnupanic/scikit-perform | 0 | 12788427 | <reponame>xnupanic/scikit-perform
"""
Copyright 2021 <NAME>
This Source Code Form is subject to the terms of the BSD-2-Clause license.
If a copy of the BSD-2-Clause license was not distributed with this
file, You can obtain one at https://opensource.org/licenses/BSD-2-Clause.
"""
import lzma
import math
import hashl... | 1.898438 | 2 |
PowerPoint/Slide.py | Cow-Fu/PowerPointCat | 0 | 12788428 |
class Slide:
def getTitle(self):
return self.titles
def setTitle(self, titles):
self.self.titles = titles
def getContent(self):
return contentHolders
def setContent(self, content):
self.content = content
def getMarkup(self):
return self.markup
def se... | 2.875 | 3 |
desafio15.py | lucasmc64/Curso_de_Python_CeV | 1 | 12788429 | <reponame>lucasmc64/Curso_de_Python_CeV
print('{} DESAFIO 15 {}'.format('='*10, '='*10))
dias = int(input('Por quantos dias o carro foi alugado? '))
km = float(input('Quantos kilômetros foram rodados? '))
pdias = dias * 60
pkm = km * 0.15
print('O total a pagar é de R${:.2f}!'.format(pdias + pkm))
| 3.734375 | 4 |
src/apply_fixes/main.py | martis42/depend_on_what_you_use | 8 | 12788430 | import json
import subprocess
import sys
from argparse import ArgumentParser
from os import environ
from pathlib import Path
from typing import Any, List
# Bazel sets this environment for 'bazel run' to document the workspace root
WORKSPACE_ENV_VAR = "BUILD_WORKSPACE_DIRECTORY"
def cli():
parser = ArgumentParser... | 2.671875 | 3 |
day18/python/jamhocken/solution.py | jamhocken/aoc-2020 | 16 | 12788431 | import math
def process_input(file_contents):
lines_stripped = [line.strip() for line in file_contents]
lines_stripped = [line.replace(" ","") for line in lines_stripped]
return lines_stripped
def find_opening_par(input_string):
position = input_string.rfind(")")
counter = 1
while counter > ... | 3.59375 | 4 |
campaign/migrations/0011_merge_0010_alter_donor_id_0010_donor_display_name.py | Aleccc/gtcrew | 0 | 12788432 | <reponame>Aleccc/gtcrew
# Generated by Django 3.2.5 on 2021-07-24 16:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('campaign', '0010_alter_donor_id'),
('campaign', '0010_donor_display_name'),
]
operations = [
]
| 1.257813 | 1 |
findMissingNum.py | ezquire/python-challenges | 0 | 12788433 | def findMissing(arr, start, end):
ans = ""
if start > end:
return "None"
if start > arr[-1] or end < arr[0]:
ans += str(start) + " - " + str(end)
return ans
else:
i = 0
if start < arr[0]: # capture any range in the beginning
ans += str(start) + " - " +... | 3.640625 | 4 |
pyknp_eventgraph/base_phrase.py | ku-nlp/pyknp-eventgraph | 7 | 12788434 | import collections
from typing import TYPE_CHECKING, List, NoReturn, Optional, Tuple, Union
from pyknp import Morpheme, Tag
from pyknp_eventgraph.builder import Builder
from pyknp_eventgraph.component import Component
from pyknp_eventgraph.helper import PAS_ORDER, convert_katakana_to_hiragana, get_parallel_tags
from ... | 2.25 | 2 |
ape_fantom/ecosystem.py | ApeWorX/ape-fantom | 0 | 12788435 | from ape.api.config import PluginConfig
from ape.api.networks import LOCAL_NETWORK_NAME
from ape_ethereum.ecosystem import Ethereum, NetworkConfig
NETWORKS = {
# chain_id, network_id
"opera": (250, 250),
"testnet": (4002, 4002),
}
class FantomConfig(PluginConfig):
opera: NetworkConfig = NetworkConfig... | 2.234375 | 2 |
setup.py | arthexis/sigils | 1 | 12788436 | from setuptools import setup
from os import path
base_dir = path.abspath(path.dirname(__file__))
with open(path.join(base_dir, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='sigils',
version='0.0.5',
description='Extract, resolve and replace [SIGILS] embedded in text.'... | 1.296875 | 1 |
experiments/smk.py | magnusross/gpcm | 2 | 12788437 | import lab as B
from stheno import EQ, GP, Delta, Measure
from gpcm.experiment import run, setup
args, wd = setup("smk")
# Setup experiment.
n = 801 # Need to add the last point for the call to `linspace`.
noise = 1.0
t = B.linspace(-44, 44, n)
t_plot = B.linspace(0, 10, 500)
# Setup true model and GPCM models.
ke... | 1.96875 | 2 |
squiggler/hmm.py | JohnUrban/squiggler | 1 | 12788438 | import numpy as np
##from sklearn import hmm
from scipy.stats import norm
import nwalign as nw
from collections import defaultdict
import itertools
import time
from model_tools import get_stored_model, read_model_f5, read_model_tsv
onemers = [''.join(e) for e in itertools.product("ACGT")]
dimers = [''.join(e) for e in ... | 1.960938 | 2 |
apps/postgres.py | abiolarasheed/fabobjects | 0 | 12788439 | # coding: utf-8
from __future__ import unicode_literals
import getpass
import os
import sys
from fabric.api import hide
from fabric.api import settings
from apps.base import BaseApp
from fabobjects.utils import server_host_manager, random_password
PG_VERSION = "9.5"
GIS_VERSION = "2.2"
HBA_TEXT = (
"local al... | 1.90625 | 2 |
neural_transfer/config.py | deephdc/neural_transfer | 2 | 12788440 | # -*- coding: utf-8 -*-
"""
Module to define CONSTANTS used across the project
"""
import os
from webargs import fields, validate
from marshmallow import Schema, INCLUDE
# identify basedir for the package
BASE_DIR = os.path.dirname(os.path.normpath(os.path.dirname(__file__)))
# default location for input and outp... | 1.898438 | 2 |
rvpvp/isa/rvv/vmfxx_vf.py | ultrafive/riscv-pvp | 5 | 12788441 | from ...isa.inst import *
import numpy as np
class Vmfeq_vf(Inst):
name = 'vmfeq.vf'
def golden(self):
if 'vs2' in self:
result = np.unpackbits( self['orig'], bitorder='little' )
if 'vstart' in self:
vstart = self['vstart']
else:
v... | 2.5 | 2 |
venv/lib/python3.8/site-packages/jeepney/bindgen.py | Retraces/UkraineBot | 2 | 12788442 | /home/runner/.cache/pip/pool/ea/f2/c8/d53ffbac437df1f03c084b37a86dcb937cc9b32f0cd8412ff499c36c2d | 0.808594 | 1 |
rest_multi_factor/__init__.py | KENTIVO/rest-multi-factor | 0 | 12788443 | r"""
_____ ______ _____ _______
| __ \| ____|/ ____|__ __|
| |__) | |__ | (___ | |
| _ /| __| \___ \ | |
| | \ \| |____ ____) | | |
|_| \_\______|_____/ |_|
__ __ _ _ _ ______ _
| \/ | | | | (_) | ____| | |
| \ / |_ _| | |_ _ | |__ __ _ ___| |_ ___ _ ... | 1.640625 | 2 |
evosolve/operator/mutation/restricted_mixing.py | piotr-rarus/linkage-learning | 0 | 12788444 | from typing import List, Tuple
import numpy as np
from evobench.benchmark import Benchmark
# from evobench.linkage import DependencyStructureMatrix
from evobench.model import Population, Solution
from ..operator import Operator
class RestrictedMixing(Operator):
def __init__(self, benchmark: Benchmark):
... | 2.0625 | 2 |
src/SurveyDataViewer/settings/development.py | UCHIC/SurveyDataViewer | 10 | 12788445 | <filename>src/SurveyDataViewer/settings/development.py
__author__ = 'Juan'
from SurveyDataViewer.settings.base import *
DEBUG = True
TEMPLATE_DEBUG = True
STATIC_URL = '/static/'
SITE_URL = ''
MEDIA_ROOT = data["media_files_dir"]
MEDIA_URL = '/surveydata/' | 1.375 | 1 |
stack_it/utils/templatetags/node_mixin.py | Jufik/django_stack_it | 8 | 12788446 | import logging
from django.template import VariableDoesNotExist
from django import template
from stack_it.contents.abstracts import BaseContentMixin
from stack_it.models import Page, Template as TemplateModel
from django.db import transaction
from django.utils.safestring import mark_safe
# Get an instance of a logger
... | 2.046875 | 2 |
tests/test_masks.py | CyberZHG/keras-trans-mask | 17 | 12788447 | from unittest import TestCase
import os
import tempfile
import numpy as np
from keras_trans_mask.backend import keras
from keras_trans_mask import CreateMask, RemoveMask, RestoreMask
class TestMasks(TestCase):
def test_over_fit(self):
input_layer = keras.layers.Input(shape=(None,))
embed_layer ... | 2.421875 | 2 |
qian_dev/basic/group_fix.py | QianWanghhu/factor_fixing | 0 | 12788448 | import numpy as np
from scipy.stats import entropy
from bisect import bisect
from scipy import stats
from scipy.stats import median_absolute_deviation as mad
from sklearn.metrics import r2_score, mean_squared_error
from pyapprox.multivariate_polynomials import conditional_moments_of_polynomial_chaos_expansion as cond_m... | 2.25 | 2 |
scripts/sources/swedish/sls.py | AlexGustafsson/word-frequencies | 0 | 12788449 | http://fho.sls.fi/tidsperiod/1900-tal/
| 0.882813 | 1 |
app/admin/views/admin.py | erics1996/D5-Video | 1 | 12788450 | from .. import admin
from app import db, models
from flask import render_template, flash, request, redirect, url_for, session
from ..forms.admin_form import AdminForm
from ..forms.admin_form import AdminLoginForm
from werkzeug.security import generate_password_hash
from ...models import db
from .decorator import admin_... | 2.234375 | 2 |