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 |
|---|---|---|---|---|---|---|
Unsupervised/pix2pixHD/extract_frames.py | Kebniss/AutoDetect | 1 | 1600 | <filename>Unsupervised/pix2pixHD/extract_frames.py
import os
import cv2
import argparse
from utils import *
from tqdm import tqdm
from glob import glob
from pathlib import Path
def _extract_frames(video_path, parent, start=0, sampling_f=1):
vidcap = cv2.VideoCapture(video_path)
success, image = success, image... | 3.171875 | 3 |
burp-filter-options/filter-options.py | parsiya/Parsia-Code | 21 | 1601 | <reponame>parsiya/Parsia-Code
# modified "example traffic redirector"
# https://raw.githubusercontent.com/PortSwigger/example-traffic-redirector/master/python/TrafficRedirector.py
# Idea: https://github.com/pajswigger/filter-options/blob/master/src/filter-options.kt
# Usage: Put both files in a directory and add fi... | 2.109375 | 2 |
AppServer/google/appengine/tools/devappserver2/login.py | loftwah/appscale | 790 | 1602 | <reponame>loftwah/appscale
#!/usr/bin/env python
#
# Copyright 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 r... | 2.0625 | 2 |
sdks/python/apache_beam/runners/portability/job_server.py | noah-goodrich/beam | 1 | 1603 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 1.6875 | 2 |
sympy/printing/pycode.py | tachycline/sympy | 0 | 1604 | from collections import defaultdict
from functools import wraps
from itertools import chain
from sympy.core import sympify
from .precedence import precedence
from .codeprinter import CodePrinter
_kw_py2and3 = {
'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
'else', 'except', 'finall... | 2.28125 | 2 |
arguments_setting.py | Projectoy/ml_framework | 0 | 1605 | <gh_stars>0
import argparse, os
class ArgumentManager:
def __init__(self, model_list):
self.model_list = model_list
self.args = self.get_input_arguments()
self.validate_arguments()
def get_input_arguments(self):
parser = argparse.ArgumentParser(description='Process some integer... | 2.921875 | 3 |
fileHandler.py | Omer-Sella/ldpc | 0 | 1606 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 28 12:10:11 2019
@author: Omer
"""
## File handler
## This file was initially intended purely to generate the matrices for the near earth code found in: https://public.ccsds.org/Pubs/131x1o2e2s.pdf
## The values from the above pdf were copied manually to a txt file, and ... | 2.390625 | 2 |
stage/configuration/test_amazon_s3_origin.py | Sentienz/datacollector-tests | 0 | 1607 | <gh_stars>0
import logging
import pytest
from streamsets.testframework.markers import aws, sdc_min_version
from streamsets.testframework.utils import get_random_string
logger = logging.getLogger(__name__)
S3_SANDBOX_PREFIX = 'sandbox'
LOG_FIELD_MAPPING = [{'fieldPath': '/date', 'group': 1},
{'fi... | 1.929688 | 2 |
model_building/svr_experiment_configuration.py | eubr-atmosphere/a-MLLibrary | 3 | 1608 | <gh_stars>1-10
"""
Copyright 2019 <NAME>
Copyright 2019 <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 ... | 2.359375 | 2 |
src/scs_host/sys/host_gpi.py | south-coast-science/scs_host_rpi | 0 | 1609 | <reponame>south-coast-science/scs_host_rpi<filename>src/scs_host/sys/host_gpi.py<gh_stars>0
"""
Created on 12 May 2017
@author: <NAME> (<EMAIL>)
"""
from scs_host.sys.host_gpio import HostGPIO
# --------------------------------------------------------------------------------------------------------------------
# n... | 1.882813 | 2 |
30-39/35. final_class/final_class.py | dcragusa/PythonMorsels | 1 | 1610 | <filename>30-39/35. final_class/final_class.py
class Unsubclassable:
def __init_subclass__(cls, **kwargs):
raise TypeError('Unacceptable base type')
def prevent_subclassing():
raise TypeError('Unacceptable base type')
def final_class(cls):
setattr(cls, '__init_subclass__', prevent_subclassing)
... | 2.8125 | 3 |
benchmark/AMS/HIGGSTES/TP.py | victor-estrade/SystGradDescent | 2 | 1611 | <gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
# Command line :
# python -m benchmark.VAR.GG.TP
import os
import logging
from config import SEED
from config import... | 1.84375 | 2 |
papermill/tests/test_adl.py | dmartinpro/papermill | 0 | 1612 | import unittest
from ..adl import ADL
import six
if six.PY3:
from unittest.mock import Mock, MagicMock
else:
from mock import Mock, MagicMock
class ADLTest(unittest.TestCase):
"""
Tests for `ADL`
"""
def setUp(self):
self.ls = Mock(return_value=["foo", "bar", "baz"])
self.fak... | 2.9375 | 3 |
users/views.py | AnvarKhan/django-python | 1 | 1613 | <reponame>AnvarKhan/django-python
from django.views.generic import CreateView
from django.urls import reverse_lazy
from .forms import CustomUserCreationForm
class SignUpView(CreateView):
form_class = CustomUserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html'
| 2.15625 | 2 |
st3/package_util/compat/typing.py | Thom1729/package_util | 18 | 1614 | <filename>st3/package_util/compat/typing.py
try:
from typing import * # noqa: F401, F403
except ImportError:
from .typing_stubs import * # type: ignore # noqa: F401, F403
| 1.304688 | 1 |
stanza/models/common/dropout.py | rasimuvaikas/stanza | 3,633 | 1615 | <reponame>rasimuvaikas/stanza
import torch
import torch.nn as nn
class WordDropout(nn.Module):
""" A word dropout layer that's designed for embedded inputs (e.g., any inputs to an LSTM layer).
Given a batch of embedded inputs, this layer randomly set some of them to be a replacement state.
Note that this l... | 2.875 | 3 |
Day01-15/code/Day15/pdf2.py | bdfd/Python_Zero2Hero_DS | 3 | 1616 | <gh_stars>1-10
"""
读取PDF文件
Version: 0.1
Author: BDFD
Date: 2018-03-26
"""
from PyPDF2 import PdfFileReader
with open('./res/Python课程大纲.pdf', 'rb') as f:
reader = PdfFileReader(f, strict=False)
print(reader.numPages)
if reader.isEncrypted:
reader.decrypt('')
current_page = reader.getPage(5)
... | 3 | 3 |
qt__pyqt__pyside__pyqode/qt__class_tree__parse_and_print__recursively__from__doc_qt_io/gui.py | DazEB2/SimplePyScripts | 0 | 1617 | <reponame>DazEB2/SimplePyScripts<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5 import QtWidgets as qtw
from PyQt5.QtTest import QTest
import time
import requests
from bs4 import BeautifulSoup
from console import get_inherited_children, ROOT_URL
class MainWindow(qtw.... | 2.4375 | 2 |
common/OpTestASM.py | kyle-ibm/op-test | 0 | 1618 | #!/usr/bin/env python3
# encoding=utf8
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: op-test-framework/common/OpTestASM.py $
#
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2017
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache ... | 1.640625 | 2 |
test/test_storage.py | jrabasco/PyPasser | 0 | 1619 | #!/usr/bin/python3.4
__author__ = "<NAME>"
import sys
import os
sys.path.append("..")
import unittest
from modules import storage
from modules.service import Service
from modules.database import Database
class TestStorage(unittest.TestCase):
def setUp(self):
self.service = Service()
self.databas... | 3.078125 | 3 |
virt/ansible-latest/lib/python2.7/site-packages/ansible/plugins/lookup/template.py | lakhlaifi/RedHat-Ansible | 1 | 1620 | <filename>virt/ansible-latest/lib/python2.7/site-packages/ansible/plugins/lookup/template.py
# Copyright: (c) 2012, <NAME> <<EMAIL>>
# Copyright: (c) 2012-17, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, ... | 2.546875 | 3 |
setup.py | ripiuk/fant_sizer | 0 | 1621 | from setuptools import setup, find_packages
from os.path import join, dirname
setup(
name="fant_sizer",
version="0.7",
author="<NAME>",
author_email="<EMAIL>",
description="fant_sizer command-line file-information",
url="https://github.com/ripiuk/fant_sizer",
key... | 1.445313 | 1 |
2018/Round 1A/A.py | elvisyjlin/google-code-jam | 0 | 1622 | def solve():
# Read input
R, C, H, V = map(int, input().split())
choco = []
for _ in range(R):
choco.append([0] * C)
choco_row, choco_col = [0]*R, [0]*C
num_choco = 0
for i in range(R):
row = input()
for j in range(C):
if row[j] == '@':
cho... | 3.09375 | 3 |
desktop/libs/liboozie/src/liboozie/submittion_tests.py | vinaymundada27/Hue | 1 | 1623 | <reponame>vinaymundada27/Hue
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version ... | 1.710938 | 2 |
Training/train_baseHD.py | Wenyuan-Vincent-Li/SSL_Seg_GAN | 1 | 1624 | <gh_stars>1-10
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
from Training import functions
from Training.imresize import imresize
import matplotlib.pyplot as plt
from Models.pix2pixHD_base import GANLoss, VGGLoss
from Models.pix2pixHD2 import mask2onehot
class Losses():
def __init__(se... | 2.359375 | 2 |
tests/python/unittest/test_tir_pass_inject_double_buffer.py | 0xreza/tvm | 0 | 1625 | <filename>tests/python/unittest/test_tir_pass_inject_double_buffer.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you ... | 2.125 | 2 |
read_sensor.py | shivupoojar/openfaas-pi | 1 | 1626 | import requests
from sense_hat import SenseHat
import smbus
import time
while True:
try:
pressure=0
sense = SenseHat()
pressure = sense.get_pressure()
data = {'pressure':pressure}
print(pressure)
#send http request to sense serverless function with pressure
#data
r=req... | 2.734375 | 3 |
trabantsim/prototypes/space_invaders.py | highfestiva/life | 9 | 1627 | #!/usr/bin/env python3
# Space Invadersishkebab.
from trabant import *
# ASCII geometries.
shipascii = r'''
/\
/XXXXXXXX\
v v
'''
invader = r'''
/XXXXXX\
/XXXXXXXX\
XXXXXXXXXX
XX XX XX
\XXXXXXXX/
/XX XX\
/X/ \/ \X\
X/ \X
'''
cam(distance=250)
gravity((0,0,0))
ship = create_ascii_object(... | 2.59375 | 3 |
model/backbone/xception.py | Shang-XH/BAFTT | 4 | 1628 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from model.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
def fixed_padding(inputs, kernel_size, dilation):
kernel_size_effective = kernel_size + (kernel_size - 1) * (dilation - 1)
... | 2.40625 | 2 |
Backend/autonomus/utils/mail.py | IrinaMBejan/Autonom | 2 | 1629 | <gh_stars>1-10
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail, Substitution
API_KEY = '<KEY>'
API_KEY_ID = '<KEY>'
ENCODING = "utf-8"
DEFAULT_MAIL="<EMAIL>"
def link(urlsafe):
return "https://develop-dot-autonomus.appspot.com/events/details?event_id=" + urlsafe
def send_newslett... | 2.53125 | 3 |
yellowbrick/features/pca.py | percygautam/yellowbrick | 1 | 1630 | <reponame>percygautam/yellowbrick
# -*- coding: utf-8 -*-
# yellowbrick.features.pca
# Decomposition based feature visualization with PCA.
#
# Author: <NAME>
# Author: <NAME>
# Author: <NAME>
# Created: Tue May 23 18:34:27 2017 -0400
#
# Copyright (C) 2017 The scikit-yb developers
# For license information, see ... | 2.421875 | 2 |
k2/python/host/k2host/properties.py | Jarvan-Wang/k2 | 144 | 1631 | <reponame>Jarvan-Wang/k2<filename>k2/python/host/k2host/properties.py
# Copyright (c) 2020 Xiaomi Corporation (author: <NAME>)
# See ../../../LICENSE for clarification regarding multiple authors
import torch
from torch.utils.dlpack import to_dlpack
from .fsa import Fsa
from _k2host import _is_valid
from _k2host im... | 1.773438 | 2 |
origamibot/core/teletypes/poll_option.py | cmd410/OrigamiBot | 4 | 1632 | from .base import TelegramStructure, Field
class PollOption(TelegramStructure):
text = Field()
voter_count = Field()
def __init__(self,
text: str,
voter_count: int
):
self.text = \
Field(text, [str])
self.voter_count = \
... | 2.3125 | 2 |
var/spack/repos/builtin/packages/r-viridislite/package.py | xiki-tempula/spack | 9 | 1633 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RViridislite(RPackage):
"""viridisLite: Default Color Maps from 'matplotlib' (Lite Version... | 1.429688 | 1 |
shiSock-0.2.0/test_two/PySock/server.py | AnanyaRamanA/shiSock | 0 | 1634 | <reponame>AnanyaRamanA/shiSock
from re import S
import select
import socket
import queue
import threading
import sys
import pickle
import base64
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.serializa... | 2.1875 | 2 |
server/www/packages/packages-windows/x86/ldap3/utils/asn1.py | zhoulhb/teleport | 640 | 1635 | """
"""
# Created on 2015.08.19
#
# Author: <NAME>
#
# Copyright 2015 - 2018 <NAME>
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version... | 1.789063 | 2 |
lib/utils/arg_scope.py | SimeonZhang/detectron2_tensorflow | 3 | 1636 | import copy
from contextlib import contextmanager
from functools import wraps
from collections import defaultdict
import tensorflow as tf
_ArgScopeStack = []
@contextmanager
def arg_scope(layers, **kwargs):
"""
Args:
layers (list or layer): layer or list of layers to apply the arguments.
Returns... | 2.765625 | 3 |
CORN-TEST/textfsm_parse.py | AnkitDeshwal89/NETMIKO | 0 | 1637 | <filename>CORN-TEST/textfsm_parse.py
import textfsm
import subprocess
import random
res = subprocess.run('ifconfig',stdout=subprocess.PIPE)
intstatus = res.stdout.decode('ascii')
with open("datafile","w+") as a:
a.write(intstatus)
a.close()
template_file= "ifconfig-template.template"
template = open(templ... | 2.40625 | 2 |
classes.py | jared-jorgenson/mini_game | 0 | 1638 | import pygame
class Player(pygame.sprite.Sprite):
death = [pygame.image.load('Images/death1.png'), pygame.image.load('Images/death2.png'),
pygame.image.load('Images/death3.png'),
pygame.image.load('Images/death4.png'), pygame.image.load('Images/death5.png'),
pygame.im... | 2.40625 | 2 |
installSynApps/data_model/install_config.py | NSLS-II/installSynApps | 0 | 1639 | """A file containing representations of install configurations.
The core Data representation for installSynApps. An InstallConfiguration object
is parsed from a configuration, and is then used throughout the build process.
InjectorFile objects are used for representing text that need to be injected
into configuration... | 2.859375 | 3 |
apps/accounts/views.py | tarvitz/icu | 1 | 1640 | <gh_stars>1-10
# Create your views here.
# -*- coding: utf-8 -*-
from apps.core.helpers import render_to, ajax_response, get_object_or_None
from apps.core.decorators import lock, login_required_json
from apps.accounts.models import Invite
from apps.accounts.decorators import check_invite
from apps.accounts.forms import... | 1.890625 | 2 |
plugins/modules/oci_blockstorage_volume_backup_policy_facts.py | LaudateCorpus1/oci-ansible-collection | 0 | 1641 | <reponame>LaudateCorpus1/oci-ansible-collection
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.tx... | 1.625 | 2 |
pi_control/server_stats/apps.py | mhozza/pi-control | 0 | 1642 | <reponame>mhozza/pi-control<gh_stars>0
from django.apps import AppConfig
class ServerStatsConfig(AppConfig):
name = "server_stats"
| 1.296875 | 1 |
testproject/testproject/settings.py | jackvz/mezzanine-cartridge-api | 1 | 1643 |
from __future__ import absolute_import, unicode_literals
import os
from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _
SECRET_KEY = <KEY>'
######################
# CARTRIDGE SETTINGS #
######################
# The following settings are already defined in cartridge.... | 1.984375 | 2 |
wordgen/data_gen.py | ishaanbakhle/wordgen.us | 0 | 1644 | <gh_stars>0
from wordgen import consts
import numpy as np
from sklearn import preprocessing
def fill_matrix(dataset):
assert type(dataset) == str
assert len(dataset) > 0, print("Dataset must be > 0")
matrix = []
for i in consts.rang:
matrix.append([])
for o in consts.rang:
... | 3.03125 | 3 |
arcade/gl/context.py | Cleptomania/arcade | 0 | 1645 | <filename>arcade/gl/context.py
from ctypes import c_int, c_char_p, cast, c_float
from collections import deque
import logging
import weakref
from typing import Any, Dict, List, Tuple, Union, Sequence, Set
import pyglet
from pyglet.window import Window
from pyglet import gl
from .buffer import Buffer
from .program imp... | 2.078125 | 2 |
api/app/models/bookings/exam.py | pixelater/queue-management | 0 | 1646 | <reponame>pixelater/queue-management
'''Copyright 2018 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ap... | 1.773438 | 2 |
leetcode/1672 Richest Customer Wealth.py | jaredliw/python-question-bank | 1 | 1647 | <filename>leetcode/1672 Richest Customer Wealth.py
class Solution(object):
def maximumWealth(self, accounts):
"""
:type accounts: List[List[int]]
:rtype: int
"""
# Runtime: 36 ms
# Memory: 13.5 MB
return max(map(sum, accounts))
| 3.109375 | 3 |
datatableview/tests/test_helpers.py | gregneagle/sal | 2 | 1648 | <filename>datatableview/tests/test_helpers.py
# -*- encoding: utf-8 -*-
from datetime import datetime
from functools import partial
from django import get_version
from datatableview import helpers
import six
from .testcase import DatatableViewTestCase
from .test_app.models import ExampleModel, RelatedM2MModel
if ... | 2.390625 | 2 |
discordbot.py | naari3/seibaribot | 0 | 1649 | <reponame>naari3/seibaribot
import traceback
from os import getenv
import discord
from discord import Message
from discord.ext import commands
from discord.ext.commands import Context
from asyncio import sleep
import asyncio
client = discord.Client()
# botの接頭辞を!にする
bot = commands.Bot(command_prefix='!')
# ギラティナのチャンネ... | 2.375 | 2 |
test/cpp/naming/utils/dns_server.py | arghyadip01/grpc | 9 | 1650 | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# 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.171875 | 2 |
colour/examples/models/examples_ictcp.py | BPearlstine/colour | 2 | 1651 | # -*- coding: utf-8 -*-
"""
Showcases *ICTCP* *colour encoding* computations.
"""
import numpy as np
import colour
from colour.utilities import message_box
message_box('"ICTCP" Colour Encoding Computations')
RGB = np.array([0.45620519, 0.03081071, 0.04091952])
message_box(('Converting from "ITU-R BT.2020" colourspa... | 3.09375 | 3 |
app/core/model/routine.py | MauricioAntonioMartinez/django-workout-tracker-api | 0 | 1652 | <reponame>MauricioAntonioMartinez/django-workout-tracker-api
import os
import uuid
from django.conf import settings # this is how we can retrive variables
# for the settings file
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager,
PermissionsMixin)
from ... | 2.28125 | 2 |
example_scripts/transect_tutorial.py | British-Oceanographic-Data-Centre/COAsT | 8 | 1653 | """
This is a demonstration script for using the Transect class in the COAsT
package. This object has strict data formatting requirements, which are
outlined in tranect.py.
Transect subsetting (a vertical slice of data between two coordinates): Creating them and performing some custom diagnostics with them.
---
In ... | 3.265625 | 3 |
diofant/logic/boolalg.py | skirpichev/diofant | 0 | 1654 | <gh_stars>0
"""
Boolean algebra module for Diofant.
"""
from collections import defaultdict
from itertools import combinations, product
from ..core import Atom, cacheit
from ..core.expr import Expr
from ..core.function import Application
from ..core.numbers import Number
from ..core.operations import LatticeOp
from .... | 2.953125 | 3 |
amazon/goods_review_thread.py | JoanLee0826/amazon | 5 | 1655 | <gh_stars>1-10
import pandas as pd
import requests
from lxml import etree
import re, time, random, datetime
from queue import Queue
import threading
class Review:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 \
(KHTML, like Gecko) Chrome/69.0.3497.81 ... | 2.796875 | 3 |
lumicks/pylake/population/tests/conftest.py | lumicks/pylake | 8 | 1656 | import pytest
import numpy as np
from pathlib import Path
def extract_param(data, n_states):
keys = ("initial_state_prob", "transition_prob", "means", "st_devs")
param = {"n_states": n_states}
for key in keys:
param[key] = data[f"{key}_{n_states}"]
return param
@pytest.fixture(scope="session... | 2.125 | 2 |
Concurrent/PipelineDecomposingTask.py | rafagarciac/ParallelProgrammingPython | 0 | 1657 | <reponame>rafagarciac/ParallelProgrammingPython
#!/usr/bin/env python
"""
Artesanal example Pipe without Pipe class.
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (c) 2018 <NAME>"
__license__ = "MIT"
from concurrent.futures import ProcessPoolExecutor
import time
import random
def wo... | 3.015625 | 3 |
src/digibujogens/__main__.py | roaet/digibujogens | 0 | 1658 | """ Main application entry point.
python -m digibujogens ...
"""
def main():
""" Execute the application.
"""
raise NotImplementedError
# Make the script executable.
if __name__ == "__main__":
raise SystemExit(main())
| 2.171875 | 2 |
lisa/target.py | mrkajetanp/lisa | 0 | 1659 | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, ARM Limited and contributors.
#
# 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
#
# ... | 1.640625 | 2 |
iota/commands/core/get_node_info.py | EasonC13/iota.py | 347 | 1660 | import filters as f
from iota import TransactionHash, Address
from iota.commands import FilterCommand, RequestFilter, ResponseFilter
from iota.filters import Trytes
__all__ = [
'GetNodeInfoCommand',
]
class GetNodeInfoCommand(FilterCommand):
"""
Executes `getNodeInfo` command.
See :py:meth:`iota.ap... | 2.34375 | 2 |
Aplicacion/Presentacion/views.py | Juandiegordp/TPI | 0 | 1661 | from Negocio import controller
import forms, functions
from flask import Flask, render_template, request, redirect, url_for, flash
def register(mysql, request):
registerForm= forms.RegisterForm(request.form)
if request.method == 'POST' and registerForm.validate():
return controller.registraUsuario(mysql... | 2.625 | 3 |
evalme/tests/test_old_format.py | heartexlabs/label-studio-evalme | 3 | 1662 | <filename>evalme/tests/test_old_format.py
from evalme.matcher import Matcher
def test_old_format_agreement_matrix():
m = Matcher(new_format=False)
m.load(r"./tests/test_data/test_old_format.json")
matrix = m.get_annotations_agreement()
assert matrix is not None
assert matrix > 0
def test_old_fo... | 2.546875 | 3 |
behave/runner.py | wombat70/behave | 13 | 1663 | # -*- coding: UTF-8 -*-
"""
This module provides Runner class to run behave feature files (or model elements).
"""
from __future__ import absolute_import, print_function, with_statement
import contextlib
import os.path
import sys
import warnings
import weakref
import six
from behave._types import ExceptionUtil
from... | 2.359375 | 2 |
01_P/P_2_1_1_02/main.py | genfifth/generative-design_Code-Package-Python-Mode | 1 | 1664 | add_library('pdf')
import random
from datetime import datetime
tileCount = 20
def setup():
global savePDF, actStrokeCap, actRandomSeed, colorLeft, colorRight, alphaLeft, alphaRight
savePDF = False
actStrokeCap = ROUND
actRandomSeed = 0
colorLeft = color(197, 0, 123)
colorRight = color(87, 35,... | 2.78125 | 3 |
core/dbt/contracts/graph/manifest.py | peiwangdb/dbt | 0 | 1665 | import enum
from dataclasses import dataclass, field
from itertools import chain, islice
from mashumaro import DataClassMessagePackMixin
from multiprocessing.synchronize import Lock
from typing import (
Dict, List, Optional, Union, Mapping, MutableMapping, Any, Set, Tuple,
TypeVar, Callable, Iterable, Generic, ... | 1.476563 | 1 |
openGaussBase/testcase/SQL/DCL/Alter_Default_Privileges/Opengauss_Function_Alter_Default_Privileges_Case0016.py | opengauss-mirror/Yat | 0 | 1666 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | 1.757813 | 2 |
Apps/phdigitalshadows/dsapi/service/infrastructure_service.py | ryanbsaunders/phantom-apps | 74 | 1667 | # File: infrastructure_service.py
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
from .ds_base_service import DSBaseService
from .ds_find_service import DSFindService
from ..model.infrastructure import Infrastructure
class InfrastructureService(DSFindService):
def __init__(se... | 2.03125 | 2 |
src/find_genes_by_location/find_genes_by_location.py | NCBI-Codeathons/Identify-antiphage-defense-systems-in-the-bacterial-pangenome | 3 | 1668 | import argparse
from collections import defaultdict
import csv
from dataclasses import dataclass, field
from enum import Enum, unique, auto
import os
import sys
import tempfile
import yaml
import zipfile
import gffutils
from google.protobuf import json_format
from ncbi.datasets.v1alpha1 import dataset_catalog_pb2
from... | 2.265625 | 2 |
web/backend/backend_django/apps/capacity/models.py | tOverney/ADA-Project | 0 | 1669 | <filename>web/backend/backend_django/apps/capacity/models.py
from django.db import models
from multigtfs.models import (
Block, Fare, FareRule, Feed, Frequency, Route, Service, ServiceDate, Shape,
ShapePoint, Stop, StopTime, Trip, Agency)
class Path(models.Model):
trip = models.ForeignKey(Trip)
stop ... | 2.203125 | 2 |
apps/interface/settings/config.py | rainydaygit/testtcloudserver | 349 | 1670 | try:
from public_config import *
except ImportError:
pass
PORT = 9028
SERVICE_NAME = 'interface'
| 1.226563 | 1 |
api/api/pokemon/views.py | farnswj1/PokemonAPI | 0 | 1671 | <filename>api/api/pokemon/views.py
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework.generics import (
ListAPIView,
RetrieveAPIView,
CreateAPIView,
UpdateAPIView,
DestroyAPIView
)
from .models import Pokemon
from .serializer... | 2.1875 | 2 |
plugins/action/normalize_gitlab_cfg.py | sma-de/ansible-collections-gitlab | 0 | 1672 | <gh_stars>0
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleOptionsError
from ansible.module_utils.six import iteritems, string_types
from ansible_collections.smabot.base.plugins.module_utils.plugins.config_normalizing.base import ConfigNorma... | 1.8125 | 2 |
microservices/validate/tools/dynamodb.py | clodonil/pipeline_aws_custom | 0 | 1673 | <filename>microservices/validate/tools/dynamodb.py
"""
Tools de integração com o Dynamodb
"""
import boto3
import botocore
import logging
import datetime
import json
import copy
import time
import os
class DyConnect:
def __init__(self, table, region):
self.table = table
self.region = region
d... | 2.25 | 2 |
scrapy_ddiy/spiders/GlidedSky/glided_sky_001.py | LZC6244/scrapy_ddiy | 9 | 1674 | # -*- coding: utf-8 -*-
from scrapy import Request
from scrapy_ddiy.utils.spiders.ddiy_base import DdiyBaseSpider
class GlidedSky001Spider(DdiyBaseSpider):
name = 'glided_sky_001'
description = 'GlidedSky 爬虫-基础1'
start_url = 'http://www.glidedsky.com/level/web/crawler-basic-1'
custom_settings = {
... | 2.703125 | 3 |
datasets/celeba/celeba_dataset.py | google/joint_vae | 35 | 1675 | #
# Copyright 2017 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 law or agreed to in writin... | 2.328125 | 2 |
jorldy/manager/log_manager.py | kan-s0/JORLDY | 0 | 1676 | <filename>jorldy/manager/log_manager.py
import os
import datetime, time
import imageio
from pygifsicle import optimize
from torch.utils.tensorboard import SummaryWriter
class LogManager:
def __init__(self, env, id, experiment=None):
self.id = id
now = datetime.datetime.now().strftime("%Y%m%d%H%M%... | 2.265625 | 2 |
lib/SeparateDriver/ASRDriverParts/UNIInterface.py | multi-service-fabric/element-manager | 0 | 1677 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
# Filename: ASRDriverParts/UNIInterface.py
'''
Parts Module for ASR driver UNI interface configuraton
'''
import GlobalModule
from EmCommonLog import decorater_log
from ASRDriverParts.InterfaceBase im... | 1.992188 | 2 |
tools/accuracy_checker/accuracy_checker/annotation_converters/mnist.py | AnthonyQuantum/open_model_zoo | 4 | 1678 | """
Copyright (c) 2019 Intel Corporation
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,... | 2.359375 | 2 |
Libraries/Python/wxGlade/v0.9,5/wxGlade-0.9.5-py3.6.egg/wxglade/bugdialog.py | davidbrownell/Common_EnvironmentEx | 0 | 1679 | <reponame>davidbrownell/Common_EnvironmentEx
"""\
Dialog to show details of internal errors.
@copyright: 2014-2016 <NAME>
@copyright: 2017 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import bugdialog_ui
import config
import log
import logging
import sys
import wx
class BugRepor... | 2.109375 | 2 |
core/views.py | Neelamegam2000/QRcode-for-license | 0 | 1680 | <filename>core/views.py
from django.shortcuts import render, redirect
from django.conf import settings
from django.core.files.storage import FileSystemStorage,default_storage
from django.core.mail import send_mail, EmailMessage
from core.models import Document
from core.forms import DocumentForm
from django.contrib i... | 2.21875 | 2 |
docassemble/MACourts/__init__.py | nonprofittechy/docassemble-MACourts | 2 | 1681 | <filename>docassemble/MACourts/__init__.py<gh_stars>1-10
__version__ = '0.0.58.2'
| 1.148438 | 1 |
main.py | Meat0Project/ChatBot | 4 | 1682 | '''
Made by - <NAME>
Purpose - Python mini project
Date - 18 october 2020
'''
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
form termcolor import cprint
import time
chatbot = ChatBot('Bot')
trainer = ChatterBotCorpusTrainer(chatbot)
trainer.train('chatterbot.corpus.english')
... | 2.9375 | 3 |
challenges/day14.py | Jeffreyo3/AdventOfCode2020 | 0 | 1683 | <reponame>Jeffreyo3/AdventOfCode2020
"""
--- Day 14: Docking Data ---
As your ferry approaches the sea port, the captain asks for your help again. The computer system that runs this port isn't compatible with the docking program on the ferry, so the docking parameters aren't being correctly initialized in the docking p... | 3.75 | 4 |
src/Dialogs/RegularPolygonDialog.py | Lovely-XPP/tkzgeom | 41 | 1684 | from PyQt5 import QtWidgets, uic
from Factory import Factory
from Dialogs.DialogMacros import turn_into_free_point, free_point_checkbox
from Fill.ListWidget import fill_listWidget_with_data, set_selected_id_in_listWidget
import Constant as c
class RegularPolygonDialog(QtWidgets.QDialog):
def __init__(self, scene... | 2.328125 | 2 |
tests/test_networks.py | UCY-LINC-LAB/5G-Slicer | 0 | 1685 | import unittest
from networks.QoS import QoS
from networks.connections.mathematical_connections import FunctionalDegradation
from networks.slicing import SliceConceptualGraph
from utils.location import Location
class TestBaseStationLinear(unittest.TestCase):
def setUp(self):
self.name = "network"
... | 2.9375 | 3 |
backend/api/management/commands/create_testdb.py | INSRapperswil/nornir-web | 2 | 1686 | """
Setup DB with example data for tests
"""
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User, Group
from django.core.management.base import BaseCommand
from api import models
class Command(BaseCommand):
help = 'Setup DB with example data for tests'
... | 2.421875 | 2 |
pyinfra/facts/util/distro.py | charles-l/pyinfra | 1 | 1687 | from __future__ import absolute_import, unicode_literals
import os
import distro
def get_distro_info(root_dir):
# We point _UNIXCONFDIR to root_dir
old_value = distro._UNIXCONFDIR
distro._UNIXCONFDIR = os.path.join(root_dir, 'etc')
obj = distro.LinuxDistribution(include_lsb=False, include_uname=Fal... | 2.15625 | 2 |
appium/webdriver/common/multi_action.py | salabogdan/python-client | 1 | 1688 | <reponame>salabogdan/python-client
#!/usr/bin/env python
# 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.421875 | 2 |
src/visu/visualizer.py | JonasFrey96/PLR2 | 0 | 1689 | import numpy as np
import sys
import os
from PIL import Image
from visu.helper_functions import save_image
from scipy.spatial.transform import Rotation as R
from helper import re_quat
import copy
import torch
import numpy as np
import k3d
class Visualizer():
def __init__(self, p_visu, writer=None):
if p_v... | 2.203125 | 2 |
leetCode_Q37_serializeTree.py | FreesiaLikesPomelo/-offer | 0 | 1690 | <reponame>FreesiaLikesPomelo/-offer
'''
面试题37. 序列化二叉树
请实现两个函数,分别用来序列化和反序列化二叉树。
示例:
你可以将以下二叉树:
1
/ \
2 3
/ \
4 5
序列化为 "[1,2,3,null,null,4,5]"
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# ... | 3.265625 | 3 |
ipuz/puzzlekinds/__init__.py | maiamcc/ipuz | 5 | 1691 | <gh_stars>1-10
from .acrostic import IPUZ_ACROSTIC_VALIDATORS
from .answer import IPUZ_ANSWER_VALIDATORS
from .block import IPUZ_BLOCK_VALIDATORS
from .crossword import IPUZ_CROSSWORD_VALIDATORS
from .fill import IPUZ_FILL_VALIDATORS
from .sudoku import IPUZ_SUDOKU_VALIDATORS
from .wordsearch import IPUZ_WORDSEARCH_VAL... | 2.15625 | 2 |
CTFd/api/v1/users.py | MrQubo/CTFd | 0 | 1692 | <filename>CTFd/api/v1/users.py
from flask import session, request, abort
from flask_restplus import Namespace, Resource
from CTFd.models import (
db,
Users,
Solves,
Awards,
Tracking,
Unlocks,
Submissions,
Notifications,
)
from CTFd.utils.decorators import authed_only, admins_only, rateli... | 2.265625 | 2 |
getting_started/pages.py | emilhe/dash-extensions-docs | 1 | 1693 | <filename>getting_started/pages.py
import dash_labs as dl
from dash_extensions.enrich import DashBlueprint, DashProxy, html, Output, Input
def page_name(i: int):
return f"page{i}"
def make_page(i: int):
page = DashBlueprint()
page.layout = html.Div([html.H2(f"Page {i}"), html.Button('Click me!', id='btn')... | 2.40625 | 2 |
zaqar/transport/wsgi/v2_0/homedoc.py | vkmc/zaqar-websocket | 1 | 1694 | # Copyright (c) 2013 Rackspace, 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 law or agreed to in w... | 1.65625 | 2 |
synapse/models/infotech.py | vertexproject/synapse | 216 | 1695 | import asyncio
import logging
import synapse.exc as s_exc
import synapse.lib.types as s_types
import synapse.lib.module as s_module
import synapse.lib.version as s_version
logger = logging.getLogger(__name__)
class Cpe23Str(s_types.Str):
'''
CPE 2.3 Formatted String
https://nvlpubs.nist.gov/nistpubs/Leg... | 2.3125 | 2 |
test/test.py | bciar/ppp-web | 2 | 1696 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unit tests."""
import os
import unittest
from copy import copy
from webui.app import create_app
class TestRoutes(unittest.TestCase):
"""Test routes."""
ignore_routes = ('/static/<path:filename>',)
ignore_end_patterns = ('>',)
def setUp(self):
... | 2.546875 | 3 |
tests/sources/test_clang_format.py | Justin-Fisher/webots | 1,561 | 1697 | #!/usr/bin/env python
# Copyright 1996-2021 Cyberbotics 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 required by applica... | 2.25 | 2 |
src/python/tests/core/system/shell_test.py | sanketsaurav/clusterfuzz | 1 | 1698 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.109375 | 2 |
Language Model/birnn/model.py | osamaqureshi/NLP-for-Urdu | 1 | 1699 | <filename>Language Model/birnn/model.py<gh_stars>1-10
import numpy as np
import tensorflow as tf
class Bidirectional(tf.keras.Model):
def __init__(self, units: int,
projection_units: int):
super(Bidirectional, self).__init__()
self.units = units
self.projection_units = pro... | 2.34375 | 2 |