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 |
|---|---|---|---|---|---|---|
instanotifier/fetcher/scripts/fetcher.py | chaudbak/instanotifier | 0 | 17700 | from instanotifier.fetcher import tests
def run():
# is executed when ran with 'manage.py runscript tests'
tests.test_rss_fetcher()
| 1.359375 | 1 |
clase_4/populate_alumnos.py | noctilukkas/python-programming | 0 | 17701 | import sqlite3
def main():
# se establece conexion con la BD y abro cursor
conn = sqlite3.connect("alumnos.db")
cursor = conn.cursor()
# creo una tupla de tuplas para agregar registros a la tabla
alumnos = (
(1, "Juan", "Granizado", 8, 25),
(2, "Esteban", "Quito", 2, 19),
... | 4 | 4 |
cap11/main.py | felipesch92/livroPython | 0 | 17702 | import sqlite3
con = sqlite3.connect('agenda.db')
cursor = con.cursor()
cursor.execute('''
create table if not exists agenda(
nome text,
telefone text)
''')
cursor.execute('''
insert into agenda(nome, telefone)
values(?, ?)
''', ("Tamara", "51-98175-05... | 3.015625 | 3 |
falconcv/data/scraper/flickr_scraper.py | haruiz/FalconCV | 16 | 17703 | import logging
import math
import re
import time
import dask
import numpy as np
import requests
import json
import xml.etree.ElementTree as ET
from falconcv.data.scraper.scraper import ImagesScraper
from falconcv.util import ImageUtil
logger = logging.getLogger(__name__)
FLICKR_ENDPOINT = "https://www.flickr.com/servic... | 2.390625 | 2 |
argparser.py | geoff-smith/MCplotscripts | 0 | 17704 | <reponame>geoff-smith/MCplotscripts
# argParser
# this class generates a RunParams object from the args passed to the script
from runparams import *
import os.path
import string
## handles args passed to the program
#
class ArgParser(object):
def parsePtCutString(self, ptCutString):
return map(float, string.... | 2.625 | 3 |
floppy/_surf-garbage.py | hillscott/windows | 0 | 17705 | # pip install -U pywinauto
from pywinauto.application import Application
import subprocess
import time
subprocess.run('SCHTASKS /DELETE /TN BuildTasks\\Sites /f')
app = Application(backend='uia')
app.start('C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe --force-renderer-accessibility ')
window = app.top_win... | 2.390625 | 2 |
sla/migrations/0005_slaprobe_workflow.py | prorevizor/noc | 84 | 17706 | # ----------------------------------------------------------------------
# Migrate SLAProbe to workflow
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
... | 1.71875 | 2 |
seqpos/lib/python2.7/site-packages/mercurial/dirstateguard.py | guanjue/seqpos | 0 | 17707 | <filename>seqpos/lib/python2.7/site-packages/mercurial/dirstateguard.py<gh_stars>0
# dirstateguard.py - class to allow restoring dirstate after failure
#
# Copyright 2005-2007 <NAME> <<EMAIL>>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later... | 2.265625 | 2 |
config.py | mF2C/UserManagement | 0 | 17708 | """
CONFIGURATION FILE
This is being developed for the MF2C Project: http://www.mf2c-project.eu/
Copyright: <NAME>, Atos Research and Innovation, 2017.
This code is licensed under an Apache 2.0 license. Please, refer to the LICENSE.TXT file for more information
Created on 18 oct. 2018
@author: <NAME> - ATOS
"""
#!... | 1.53125 | 2 |
api/base/views/__init__.py | simpsonw/atmosphere | 197 | 17709 | from .version import VersionViewSet, DeployVersionViewSet
__all__ = ["VersionViewSet", "DeployVersionViewSet"]
| 1.0625 | 1 |
amaranth/vendor/xilinx_spartan_3_6.py | psumesh/nmigen | 528 | 17710 | <reponame>psumesh/nmigen<filename>amaranth/vendor/xilinx_spartan_3_6.py
import warnings
from .xilinx import XilinxPlatform
__all__ = ["XilinxSpartan3APlatform", "XilinxSpartan6Platform"]
XilinxSpartan3APlatform = XilinxPlatform
XilinxSpartan6Platform = XilinxPlatform
# TODO(amaranth-0.4): remove
warnings.warn("i... | 1.078125 | 1 |
spatialtis/_plotting/api/community_map.py | Mr-Milk/SpatialTis | 10 | 17711 | from ast import literal_eval
from collections import Counter
from typing import Dict, Optional
from anndata import AnnData
from spatialtis.config import Config, analysis_list
from ...utils import doc
from ..base import graph_position_interactive, graph_position_static
from .utils import query_df
@doc
def community... | 2.515625 | 3 |
pynics/binparse/castep_bin_results.py | ThatPerson/pynics | 2 | 17712 | <filename>pynics/binparse/castep_bin_results.py
# Python 2-to-3 compatibility code
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
from pynics.binparse.forbinfile import RecordError
def cbin_result... | 2.40625 | 2 |
epi-poc-demo/node-b/node-b.py | onnovalkering/epif-poc | 0 | 17713 | <reponame>onnovalkering/epif-poc
import os
import socket
import threading
HEADER = 64
PORT = 5053
FW = "192.168.101.2"
ADDR = (FW, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(ADDR)
def handle_client(conn, addr):
print(f"[FIREWAL... | 2.75 | 3 |
sliding_window/equal_substring.py | sleebapaul/codeforces | 0 | 17714 | """
1208. Get Equal Substrings Within Budget
Straight forward. Asked the max len, so count the max each time.
"""
class Solution:
def equalSubstring(self, s: str, t: str, maxCost: int) -> int:
cost = 0
window_start = 0
result = 0
for window_end in range(... | 3.25 | 3 |
test/functional/esperanza_withdraw.py | frolosofsky/unit-e | 0 | 17715 | <gh_stars>0
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import UnitETestFramework
from test_framework.util import (
j... | 2.234375 | 2 |
test/geocoders/placefinder.py | gongso1st/geopy | 1 | 17716 | <gh_stars>1-10
import unittest
from geopy.compat import u
from geopy.point import Point
from geopy.geocoders import YahooPlaceFinder
from test.geocoders.util import GeocoderTestBase, env
class YahooPlaceFinderTestCaseUnitTest(GeocoderTestBase): # pylint: disable=R0904,C0111
def test_user_agent_custom(self):
... | 2.515625 | 3 |
inetdxmlrpc.py | Leonidas-from-XIV/sandbox | 0 | 17717 | <reponame>Leonidas-from-XIV/sandbox<gh_stars>0
#!/usr/bin/env python2.4
# -*- encoding: latin-1 -*-
"""A small XML-RPC Server running under control
of the internet superserver inetd.
Configuring:
Add this line to your inetd.conf
embedxmlrpc stream tcp nowait user /usr/sbin/tcpd inetdxmlrpc.py
Where user i... | 2.15625 | 2 |
examples/tensorflow/train/crnn_chinese/code_multi/tools/train_shadownet_multi.py | soar-zhengjian/uai-sdk | 38 | 17718 | """
Train shadow net script
"""
import argparse
import functools
import itertools
import os
import os.path as ops
import sys
import time
import numpy as np
import tensorflow as tf
import pprint
import shadownet
import six
from six.moves import xrange # pylint: disable=redefined-builtin
sys.path.append('/data/')
fr... | 2.03125 | 2 |
ovs/extensions/hypervisor/hypervisors/vmware.py | mflu/openvstorage_centos | 1 | 17719 | # Copyright 2014 CloudFounders NV
#
# 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 writ... | 2.03125 | 2 |
fake_switches/dell10g/command_processor/config_interface.py | idjaw/fake-switches | 0 | 17720 | <gh_stars>0
# Copyright 2015 Internap.
#
# 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... | 1.945313 | 2 |
setup.py | Spredzy/python-memsource | 0 | 17721 | <filename>setup.py
#!/usr/bin/env python
import setuptools
from memsource import version
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="memsource",
version=version.__version__,
author="<NAME>",
author_email="<EMAIL>",
description="P... | 1.289063 | 1 |
sktime/transformations/series/func_transform.py | marcio55afr/sktime | 2 | 17722 | <reponame>marcio55afr/sktime
#!/usr/bin/env python3 -u
# -*- coding: utf-8 -*-
"""Implements FunctionTransformer, a class to create custom transformers."""
__author__ = ["<NAME>"]
__all__ = ["FunctionTransformer"]
import numpy as np
from sktime.transformations.base import _SeriesToSeriesTransformer
from sktime.util... | 3.109375 | 3 |
regparser/tree/xml_parser/reg_text.py | cfpb/regulations-parser | 36 | 17723 | # vim: set encoding=utf-8
import re
from lxml import etree
import logging
from regparser import content
from regparser.tree.depth import heuristics, rules, markers as mtypes
from regparser.tree.depth.derive import derive_depths
from regparser.tree.struct import Node
from regparser.tree.paragraph import p_level_of
from... | 2.265625 | 2 |
setup.py | mark-dawn/stytra | 0 | 17724 | from distutils.core import setup
from setuptools import find_packages
setup(
name="stytra",
version="0.1",
author="<NAME>, <NAME> @portugueslab",
author_email="<EMAIL>",
license="MIT",
packages=find_packages(),
install_requires=[
"pyqtgraph>=0.10.0",
"numpy",
"numba... | 1.179688 | 1 |
checkTicTacToe/checkTicTacToe.py | nate-ar-williams/coding-questions | 0 | 17725 | #!/usr/bin/python3
# let board be 3x3 bool array
def isWin(board):
start = board[0][0]
win = False
next = [(0, 1), (1, 1), (1, 0)]
while(!win):
while
return win
def main():
pass
if __name__ == '__main__':
main()
| 3.65625 | 4 |
openerp/exceptions.py | ntiufalara/openerp7 | 3 | 17726 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | 1.820313 | 2 |
MainUi.py | james646-hs/Fgo_teamup | 18 | 17727 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainUi.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWin... | 1.8125 | 2 |
pyhutool/core/Io.py | kaysen820/PyHuTool | 0 | 17728 | class File:
@staticmethod
def tail(self, file_path, lines=10):
with open(file_path, 'rb') as f:
total_lines_wanted = lines
block_size = 1024
f.seek(0, 2)
block_end_byte = f.tell()
lines_to_go = total_lines_wanted
block_number = -1
... | 3.3125 | 3 |
utils/argparse.py | toytag/self-supervised-learning-for-semantic-segmentation | 0 | 17729 | <reponame>toytag/self-supervised-learning-for-semantic-segmentation
import argparse
class ArchParser(argparse.ArgumentParser):
def __init__(self, model_names, *args, **kwargs):
super().__init__(*args, **kwargs)
self.add_argument('-a', '--arch', metavar='ARCH', choices=model_names,
... | 2.734375 | 3 |
finicky/schema.py | yaaminu/yaval | 14 | 17730 | <gh_stars>10-100
from finicky.validators import ValidationException
def validate(schema, data, hook=None):
"""
Given an input named `data` validate it against `schema` returning errors encountered if any and the input data.
It's important to note that, validation continues even if an error is encountered.... | 3.875 | 4 |
tests/unique_test.py | yohplala/vaex | 0 | 17731 | from common import small_buffer
import pytest
import numpy as np
import pyarrow as pa
import vaex
def test_unique_arrow(df_factory):
ds = df_factory(x=vaex.string_column(['a', 'b', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'a']))
with small_buffer(ds, 2):
assert set(ds.unique(ds.x)) == {'a', 'b'}
v... | 2.34375 | 2 |
utils/utilsFreq.py | geobook2015/magPy | 1 | 17732 | # utility functions for frequency related stuff
import numpy as np
import numpy.fft as fft
import math
def getFrequencyArray(fs, samples):
# frequencies go from to nyquist
nyquist = fs/2
return np.linspace(0, nyquist, samples)
# use this function for all FFT calculations
# then if change FFT later (i.e. FFTW), j... | 3.078125 | 3 |
tools/extract_keywords.py | bitdotioinc/pglast | 0 | 17733 | # -*- coding: utf-8 -*-
# :Project: pglast -- Extract keywords from PostgreSQL header
# :Created: dom 06 ago 2017 23:34:53 CEST
# :Author: <NAME> <<EMAIL>>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017, 2018 Lele Gaifax
#
from collections import defaultdict
from os.path import... | 2.5625 | 3 |
tests/vi/test_indent_text_object.py | trishume/VintageousPlus | 6 | 17734 | <reponame>trishume/VintageousPlus
from collections import namedtuple
from sublime import Region as R
from VintageousPlus.tests import set_text
from VintageousPlus.tests import add_sel
from VintageousPlus.tests import ViewTest
from VintageousPlus.vi.text_objects import find_indent_text_object
test = namedtuple('simp... | 2.375 | 2 |
example_write_camera_frames_to_hdf5.py | mihsamusev/pytrl_demo | 0 | 17735 | import cv2
from imutils.paths import list_images
import imutils
import re
import datetime
from datasets.hdf5datasetwriter import HDF5DatasetWriter
import progressbar
def get_frame_number(impath):
return int(re.search(r"image data (\d+)", impath).group(1))
def get_timestamp(impath):
"assuming that the timestam... | 2.65625 | 3 |
touch.py | mendelmaker/dipn | 8 | 17736 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import time
import cv2
from real.camera import Camera
from robot import Robot
from subprocess import Popen, PIPE
def get_camera_to_robot_transformation(camera):
color_img, depth_img = camera.get_data()
cv2.imwrite("real/temp.jpg", color... | 2.59375 | 3 |
py/WB-Klein/5/5.4_cc.py | kassbohm/wb-snippets | 0 | 17737 | # Header starts here.
from sympy.physics.units import *
from sympy import *
# Rounding:
import decimal
from decimal import Decimal as DX
from copy import deepcopy
def iso_round(obj, pv, rounding=decimal.ROUND_HALF_EVEN):
import sympy
"""
Rounding acc. to DIN EN ISO 80000-1:2013-08
place value = Rundest... | 2.8125 | 3 |
ucc_csv_create.py | MasonDMitchell/HackNC-2019 | 0 | 17738 | #!/usr/bin/python3
import csv
ucc_dictionary_file_list = [
'./downloads/diary08/diary08/uccd08.txt',
'./downloads/diary09/diary09/uccd09.txt',
'./downloads/diary11/diary11/uccd11.txt',
'./downloads/diary10/diary10/uccd10.txt',
]
cleaned_ucc_dictionary = dict()
for dictionary in ucc_dictionary_file_l... | 2.734375 | 3 |
eventsourcing/system/ray.py | gerbyzation/eventsourcing | 0 | 17739 | <filename>eventsourcing/system/ray.py
import datetime
import os
import traceback
from inspect import ismethod
from queue import Empty, Queue
from threading import Event, Lock, Thread
from time import sleep
from typing import Dict, Optional, Tuple, Type
import ray
from eventsourcing.application.process import ProcessA... | 2.1875 | 2 |
authentik/stages/password/migrations/0007_app_password.py | BeryJu/passbook | 15 | 17740 | <reponame>BeryJu/passbook<gh_stars>10-100
# Generated by Django 3.2.6 on 2021-08-23 14:34
import django.contrib.postgres.fields
from django.apps.registry import Apps
from django.db import migrations, models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from authentik.stages.password import BACKEN... | 1.90625 | 2 |
article/tests/test_models.py | asb29/Redundant | 0 | 17741 | from django.test import TestCase
from django.contrib.auth.models import User
from article.models import Article, Category
class ArticleModelTestCase(TestCase):
def setUp(self):
self.category = Category.objects.create(name=u'Sports')
self.user = User.objects.create(username=u'test', password=u'<PA... | 2.546875 | 3 |
tests/test_import.py | GoodManWEN/typehints_checker | 0 | 17742 | import os , sys
sys.path.append(os.getcwd())
import pytest
from typehints_checker import *
@pytest.mark.asyncio
async def test_import():
... | 1.796875 | 2 |
models/FlagAttachment.py | jeffg2k/RootTheBox | 1 | 17743 | <reponame>jeffg2k/RootTheBox
# -*- coding: utf-8 -*-
"""
Created on Nov 24, 2014
@author: moloch
Copyright 2014 Root the Box
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
... | 1.867188 | 2 |
connman_dispatcher/detect.py | a-sk/connman-dispatcher | 4 | 17744 | import glib
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from pyee import EventEmitter
import logbook
logger = logbook.Logger('connman-dispatcher')
__all__ = ['detector']
def property_changed(_, message):
if message.get_member() == "PropertyChanged":
_, state = message.get_args_list()
... | 2.203125 | 2 |
integration/test/test_profile_overflow.py | avilcheslopez/geopm | 0 | 17745 | #!/usr/bin/env python3
#
# Copyright (c) 2015 - 2022, Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
"""
Runs an application with a large number of short regions and checks
that the controller successfully runs.
"""
import sys
import unittest
import os
import subprocess
import glob
import geopmpy.io
i... | 2.484375 | 2 |
Objects/optAlignRNA.py | MooersLab/jupyterlabpymolpysnipsplus | 0 | 17746 | # Description: OptiAlign.py by <NAME> modified for aligning multiple RNA structures.
# Source: Generated while helping Miranda Adams at U of Saint Louis.
"""
cmd.do('python')
cmd.do(' ##############################################################################')
cmd.do('#')
cmd.do('# @SUMMARY: -- QKabsch.py. A py... | 2.3125 | 2 |
2020/day11.py | asmeurer/advent-of-code | 0 | 17747 | <reponame>asmeurer/advent-of-code<filename>2020/day11.py
test_input = """
L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL
"""
test_input2 = """
.......#.
...#.....
.#.......
.........
..#L....#
....#....
.........
#........
...#.....
"""
test_input3 = """
... | 1.296875 | 1 |
final/runner_2.py | Pluriscient/sma2c-ipd | 0 | 17748 | <gh_stars>0
from SMA2CAgent import SMA2CAgent
from A2CAgent import A2CAgent
from RandomAgent import RandomAgent
# from .SMA2CAgent import SMA2CAgent
import gym
import numpy as np
from IPD_fixed import IPDEnv
import axelrod
import time
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
... | 2.234375 | 2 |
295-find-median-from-data-stream/295-find-median-from-data-stream.py | Dawit-Getachew/A2SV_Practice | 0 | 17749 | <gh_stars>0
import heapq as h
class MedianFinder:
def __init__(self):
self.rightHalf = []
self.leftHalf = []
def addNum(self, num: int) -> None:
if len(self.leftHalf) > len(self.rightHalf):
temp = h.heappush(self.leftHalf, -num)
temp2 = h.heappop(self.leftHalf)
... | 3.140625 | 3 |
mottak-arkiv-service/tests/routers/mappers/test_metadatafil.py | omBratteng/mottak | 4 | 17750 | <reponame>omBratteng/mottak
import pytest
from app.domain.models.Metadatafil import Metadatafil, MetadataType
from app.exceptions import InvalidContentType
from app.routers.mappers.metadafil import _get_file_content, metadatafil_mapper, _content_type2metadata_type
def test__content_type2metadata_type__success():
... | 2.515625 | 3 |
src/niweb/apps/noclook/templatetags/rack_tags.py | emjemj/ni | 0 | 17751 | from django import template
register = template.Library()
RACK_SIZE_PX = 20
MARGIN_HEIGHT = 2
def _rack_unit_to_height(units):
# for every unit over 1 add a 2 px margin
margin = (units - 1) * MARGIN_HEIGHT
return units * RACK_SIZE_PX + margin
def _equipment_spacer(units):
return {
'units': ... | 2.578125 | 3 |
Cryptography/Exp-1-Shamirs-Secret-Sharing/main.py | LuminolT/Cryptographic | 0 | 17752 | import numpy as np
import matplotlib.pyplot as plt
from shamir import *
from binascii import hexlify
# img = plt.imread('cat.png')
# plt.imshow(img)
# plt.show()
s = 'TEST_STRING'.encode()
print("Original secret:", hexlify(s))
l = Shamir.split(3, 5, '12345'.encode())
for idx, item in l:
print("Share {}: {}".fo... | 2.8125 | 3 |
P20-Stack Abstract Data Type/Stack - Reverse Stack.py | necrospiritus/Python-Working-Examples | 0 | 17753 | """Reverse stack is using a list where the top is at the beginning instead of at the end."""
class Reverse_Stack:
def __init__(self):
self.items = []
def is_empty(self): # test to see whether the stack is empty.
return self.items == []
def push(self, item): # adds a new item to the bas... | 4.28125 | 4 |
gerapy/cmd/server.py | awesome-archive/Gerapy | 1 | 17754 | from gerapy.server.manage import manage
import sys
def server():
# Call django cmd
manage()
| 1.296875 | 1 |
client/walt/client/term.py | dia38/walt-python-packages | 4 | 17755 | #!/usr/bin/env python
import sys, tty, termios, array, fcntl, curses
class TTYSettings(object):
def __init__(self):
self.tty_fd = sys.stdout.fileno()
# save
self.saved = termios.tcgetattr(self.tty_fd)
self.win_size = self.get_win_size()
self.rows, self.cols = self.win_size[0... | 2.296875 | 2 |
improver_tests/calibration/ensemble_calibration/test_CalibratedForecastDistributionParameters.py | cpelley/improver | 0 | 17756 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 1.296875 | 1 |
rendaz/tests/test_daztools.py | veselosky/rendaz | 0 | 17757 | "Test handling/parsing of various DAZ Studio files"
from pathlib import Path
from tempfile import NamedTemporaryFile
from django.apps import apps
from rendaz.daztools import (
DSONFile,
ProductMeta,
manifest_files,
supplement_product_name,
)
TEST_DIR = Path(__file__).parent
def test_read_dson_com... | 2.265625 | 2 |
src/core/models/graph2seq.py | talha1503/RL-based-Graph2Seq-for-NQG | 100 | 17758 | <gh_stars>10-100
import random
import string
from typing import Union, List
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..layers.common import EncoderRNN, DecoderRNN, dropout
from ..layers.attention import *
from ..layers.graphs import GraphNN
from ..utils.generic_utils import to_cuda, cre... | 2.265625 | 2 |
towhee/engine/pipeline.py | jeffoverflow/towhee | 0 | 17759 | <reponame>jeffoverflow/towhee
# Copyright 2021 Zilliz. 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... | 2.1875 | 2 |
portfolio/models.py | MrInternauta/Python-Django-Portafolio-web-administrable | 0 | 17760 | from django.db import models
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length = 200, verbose_name = "Titulo")
description = models.TextField(verbose_name="Descripcion")
image = models.ImageField(verbose_name="Imagen", upload_to = "projects")
link = mode... | 2.328125 | 2 |
src/notifications/tests.py | kullo/webconfig | 0 | 17761 | <reponame>kullo/webconfig
# Copyright 2015–2020 Kullo GmbH
#
# This source code is licensed under the 3-clause BSD license. See LICENSE.txt
# in the root directory of this source tree for details.
from django.test import TestCase
# Create your tests here.
| 0.902344 | 1 |
examples/cam.py | jtme/button-shim | 0 | 17762 | #!/usr/bin/env python
import signal
import buttonshim
print("""
Button SHIM: rainbow.py
Command on button press.
Press Ctrl+C to exit.
""")
import commands
@buttonshim.on_press(buttonshim.BUTTON_A)
def button_a(button, pressed):
buttonshim.set_pixel(0x94, 0x00, 0xd3)
s=commands.getstatusoutput("ra... | 2.8125 | 3 |
built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/algorithms/nas/sm_nas/mmdet_meta_cfgs/bbox_head/__init__.py | Huawei-Ascend/modelzoo | 12 | 17763 | <reponame>Huawei-Ascend/modelzoo
from .cascade_head import CascadeFCBBoxHead
from .convfc_bbox_head import SharedFCBBoxHead
__all__ = [
'CascadeFCBBoxHead',
'SharedFCBBoxHead']
| 1.21875 | 1 |
monzo/model/monzoaccount.py | elementechemlyn/pythonzo | 0 | 17764 | import datetime
from .monzobalance import MonzoBalance
from .monzopagination import MonzoPaging
from .monzotransaction import MonzoTransaction
class MonzoAccount(object):
def __init__(self,api,json_dict=None):
self.api = api
self.account_id = None
self.created = None
self.descripti... | 2.53125 | 3 |
learninghouse/api/errors/__init__.py | DerOetzi/learninghouse-core | 1 | 17765 | from typing import Dict, Optional
from fastapi import status, Request
from fastapi.responses import JSONResponse
from fastapi.exceptions import RequestValidationError
from learninghouse.models import LearningHouseErrorMessage
MIMETYPE_JSON = 'application/json'
class LearningHouseException(Exception):
STATUS_CO... | 2.78125 | 3 |
moda/dataprep/create_dataset.py | Patte1808/moda | 0 | 17766 | <reponame>Patte1808/moda
import pandas as pd
def get_windowed_ts(ranged_ts, window_size, with_actual=True):
"""
Creates a data frame where each row is a window of samples from the time series.
Each consecutive row is a shift of 1 cell from the previous row.
For example: [[1,2,3],[2,3,4],[3,4,5]]
... | 3.53125 | 4 |
test/test_ufunc.py | tuwien-cms/xprec | 6 | 17767 | <gh_stars>1-10
# Copyright (C) 2021 <NAME> and others
# SPDX-License-Identifier: MIT
import numpy as np
import xprec
def _compare_ufunc(ufunc, *args, ulps=1):
fx_d = ufunc(*args)
fx_q = ufunc(*(a.astype(xprec.ddouble) for a in args)).astype(float)
# Ensure relative accuracy of 2 ulps
np.testing.asser... | 1.828125 | 2 |
echolect/millstone/__init__.py | ryanvolz/echolect | 1 | 17768 | from .read_hdf5 import *
from .hdf5_api import * | 1 | 1 |
pyptoolz/transforms.py | embedio/pyplinez | 0 | 17769 | from pathlib import Path
from toolz import itertoolz, curried
import vaex
transform_path_to_posix = lambda path: path.as_posix()
def path_to_posix():
return curried.valmap(transform_path_to_posix)
transform_xlsx_to_vaex = lambda path: vaex.from_ascii(path, seperator="\t")
def xlsx_to_vaex():
return curr... | 2.609375 | 3 |
experiments/s3-image-resize/chalicelib/s3_helpers.py | llamapope/chalice-experiments | 0 | 17770 | <gh_stars>0
import PIL
from PIL import Image
from io import BytesIO
import re
def resize(s3_client, bucket, original_key, width, height, suffix):
obj = s3_client.get_object(Bucket=bucket, Key=original_key)
full_size_key = original_key.replace('__incoming/', '')
ext = re.sub(r'.+\.([^.]+)$', r'\1', full_si... | 2.4375 | 2 |
synapse/handlers/room_member_worker.py | lukaslihotzki/synapse | 9,945 | 17771 | # Copyright 2018-2021 The Matrix.org Foundation C.I.C.
#
# 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... | 1.554688 | 2 |
win/devkit/other/pymel/extras/completion/py/maya/app/edl/importExport.py | leegoonz/Maya-devkit | 10 | 17772 | <filename>win/devkit/other/pymel/extras/completion/py/maya/app/edl/importExport.py
import tempfile
import maya.OpenMaya as OpenMaya
import maya.OpenMayaRender as OpenMayaRender
import maya.OpenMayaMPx as OpenMayaMPx
import maya.cmds as cmds
import maya
import re
from maya.app.edl.fcp import *
class ImportExport(OpenM... | 2.34375 | 2 |
packages/mcni/python/mcni/instrument_simulator/__init__.py | mcvine/mcvine | 5 | 17773 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 2006-2010 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~... | 1.859375 | 2 |
todolist/wsgi.py | HangeZoe/django-todo-list | 0 | 17774 | <reponame>HangeZoe/django-todo-list<filename>todolist/wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todolist.settings')
application = get_wsgi_application()
| 1.335938 | 1 |
cern_search_rest_api/modules/cernsearch/cli.py | inveniosoftware-contrib/citadel-search | 6 | 17775 | <filename>cern_search_rest_api/modules/cernsearch/cli.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of CERN Search.
# Copyright (C) 2018-2021 CERN.
#
# Citadel Search is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
... | 2.015625 | 2 |
kasaya/core/backend/redisstore.py | AYAtechnologies/Kasaya-esb | 1 | 17776 | <gh_stars>1-10
__author__ = 'wektor'
from generic import GenericBackend
import redis
class RedisBackend(GenericBackend):
def __init__(self):
pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
self.store = redis.Redis(connection_pool=pool)
def get_typecode(self, value):
... | 2.59375 | 3 |
venv/lib/python3.6/site-packages/ansible_collections/amazon/aws/plugins/module_utils/rds.py | usegalaxy-no/usegalaxy | 22 | 17777 | <filename>venv/lib/python3.6/site-packages/ansible_collections/amazon/aws/plugins/module_utils/rds.py
# Copyright: (c) 2018, 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, print_function)
__metaclass__ = ty... | 1.609375 | 2 |
week06/lecture/examples/src6/2/uppercase0.py | uldash/CS50x | 0 | 17778 | <reponame>uldash/CS50x
# Uppercases string one character at a time
from cs50 import get_string
s = get_string("Before: ")
print("After: ", end="")
for c in s:
print(c.upper(), end="")
print()
| 3.453125 | 3 |
tests/test_kobo.py | Donearm/kobuddy | 75 | 17779 | from datetime import datetime
from pathlib import Path
import pytz
import kobuddy
def get_test_db():
# db = Path(__file__).absolute().parent.parent / 'KoboShelfes' / 'KoboReader.sqlite.0'
db = Path(__file__).absolute().parent / 'data' / 'kobo_notes' / 'input' / 'KoboReader.sqlite'
return db
# a bit meh, ... | 2.171875 | 2 |
tanks/views.py | BArdelean/djangostuff | 0 | 17780 | from django.shortcuts import render
from .models import Tank
from django.db import models
from django.http import HttpResponse
from django.views import View
# Create your views here.
# The view for the created model Tank
def tank_view(request):
queryset = Tank.objects.all()
context = {
'object': quer... | 2.234375 | 2 |
VQVAE/main.py | bipashasen/How2Sign-Blob | 0 | 17781 | import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import argparse
from tqdm import tqdm
import sys
import distributed as dist
import utils
from models.vqvae import VQVAE, VQVAE_Blob2Full
from models.discriminator import discriminator
visual_folder = '/home2/bipasha31/python_... | 2.15625 | 2 |
api/voters/tests/test_models.py | citizenlabsgr/voter-engagement | 6 | 17782 | # pylint: disable=unused-variable,unused-argument,expression-not-assigned
from django.forms.models import model_to_dict
import arrow
import pytest
from expecter import expect
from api.elections.models import Election
from .. import models
@pytest.fixture
def info():
return models.Identity(
first_name=... | 2.15625 | 2 |
leetcode/easy/strobogrammatic-number.py | vtemian/interviews-prep | 8 | 17783 | class Solution:
def isStrobogrammatic(self, num: str) -> bool:
strobogrammatic = {
'1': '1',
'0': '0',
'6': '9',
'9': '6',
'8': '8'
}
for idx, digit in enumerate(num):
if digit not in strobogrammatic or strobogrammatic[... | 3.625 | 4 |
app/main/helpers/direct_award_helpers.py | uk-gov-mirror/alphagov.digitalmarketplace-buyer-frontend | 4 | 17784 | <filename>app/main/helpers/direct_award_helpers.py
from operator import itemgetter
def is_direct_award_project_accessible(project, user_id):
return any([user['id'] == user_id for user in project['users']])
def get_direct_award_projects(data_api_client, user_id, return_type="all", sort_by_key=None, latest_first=... | 2.390625 | 2 |
403-Frog-Jump/solution.py | Tanych/CodeTracking | 0 | 17785 | <filename>403-Frog-Jump/solution.py<gh_stars>0
class Solution(object):
def dfs(self,stones,graph,curpos,lastjump):
if curpos==stones[-1]:
return True
# since the jump need based on lastjump
# only forward,get rid of the stay at the same pos
rstart=max(curpos+lastjump-1,cu... | 3.09375 | 3 |
daemon/api/endpoints/partial/pod.py | vishalbelsare/jina | 2 | 17786 | <reponame>vishalbelsare/jina
from typing import Optional, Dict, Any
from fastapi import APIRouter
from jina.helper import ArgNamespace
from jina.parsers import set_pod_parser
from ....excepts import PartialDaemon400Exception
from ....models import PodModel
from ....models.partial import PartialStoreItem
from ....store... | 2.234375 | 2 |
runehistory_api/app/config.py | RuneHistory/runehistory-api | 0 | 17787 | import yaml
class Config:
def __init__(self, path: str):
self.path = path
self.cfg = {}
self.parse()
def parse(self):
with open(self.path, 'r') as f:
self.cfg = yaml.load(f)
@property
def secret(self) -> str:
return self.cfg.get('secret')
@pro... | 2.828125 | 3 |
csv_filter/__init__.py | mooore-digital/csv_filter | 1 | 17788 | #!/usr/bin/env python3
import argparse
import csv
import logging
import os
import re
import sys
DELIMITER = ','
class CsvFilter:
def __init__(
self,
file=None,
deduplicate=False,
filter_query=None,
filter_inverse=False,
ignore_case=False,... | 3.015625 | 3 |
scientist/__init__.py | boxed/scientist | 0 | 17789 | <reponame>boxed/scientist
def check_candidate(a, candidate, callback_when_different, *args, **kwargs):
control_result = None
candidate_result = None
control_exception = None
candidate_exception = None
reason = None
try:
control_result = a(*args, **kwargs)
except BaseException as e:
... | 2.859375 | 3 |
bluebottle/impact/tests/test_api.py | terrameijar/bluebottle | 10 | 17790 | # coding=utf-8
from builtins import str
import json
from django.contrib.auth.models import Group, Permission
from django.urls import reverse
from rest_framework import status
from bluebottle.impact.models import ImpactGoal
from bluebottle.impact.tests.factories import (
ImpactTypeFactory, ImpactGoalFactory
)
from... | 2.140625 | 2 |
dotmotif/parsers/v2/test_v2_parser.py | aplbrain/dotmotif | 28 | 17791 | <filename>dotmotif/parsers/v2/test_v2_parser.py
from . import ParserV2
import dotmotif
import unittest
_THREE_CYCLE = """A -> B\nB -> C\nC -> A\n"""
_THREE_CYCLE_NEG = """A !> B\nB !> C\nC !> A\n"""
_THREE_CYCLE_INH = """A -| B\nB -| C\nC -| A\n"""
_THREE_CYCLE_NEG_INH = """A !| B\nB !| C\nC !| A\n"""
_ABC_TO_D = """... | 2.6875 | 3 |
examples/classification_mnist/main.py | yassersouri/fandak | 15 | 17792 | <gh_stars>10-100
from typing import List
import click
import torch
from fandak.utils import common_config
from fandak.utils import set_seed
from fandak.utils.config import update_config
from proj.config import get_config_defaults
from proj.datasets import MNISTClassification
from proj.evaluators import ValidationEval... | 2.21875 | 2 |
tests/test_problem_solving_algorithms_sorting.py | mxdzi/hackerrank | 0 | 17793 | from problem_solving.algorithms.sorting import *
def test_q1_big_sorting(capsys, monkeypatch):
inputs = ["6",
"31415926535897932384626433832795",
"1",
"3",
"10",
"3",
"5"]
monkeypatch.setattr('builtins.input', lambda: inputs.p... | 3.03125 | 3 |
runOtakuBot.py | Eagleheardt/otakuBot | 0 | 17794 | <reponame>Eagleheardt/otakuBot<filename>runOtakuBot.py
import sqlite3
from sqlite3 import Error
import os
import time
import datetime
import re
import random
import schedule
import cryptography
from apscheduler.schedulers.background import BackgroundScheduler
from slackclient import SlackClient
from crypto... | 2.375 | 2 |
ocr.py | tunc2112/uet-img-processing | 0 | 17795 | <gh_stars>0
from PIL import Image
import cv2
import pytesseract
import tesserocr
from pyocr import pyocr
from pyocr import builders
import sys
import os
def get_image_filename(img_id):
filename = "img_src/src{0:0>3}".format(img_id)
for ext in [".png", ".jpg", ".jpeg"]:
if os.path.exists(os.path.join(o... | 2.75 | 3 |
object_detection/det_heads/retinaNet_head/retinanet_head.py | no-name-xiaosheng/PaddleViT | 993 | 17796 | <reponame>no-name-xiaosheng/PaddleViT<gh_stars>100-1000
# Copyright (c) 2021 PPViT 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.or... | 2.59375 | 3 |
brp/formutils.py | chop-dbhi/biorepo-portal | 6 | 17797 | <reponame>chop-dbhi/biorepo-portal<filename>brp/formutils.py
from django import template
from django.forms import widgets
register = template.Library()
@register.inclusion_tag('formfield.html')
def formfield(field):
widget = field.field.widget
type_ = None
if isinstance(widget, widgets.Input):
typ... | 1.882813 | 2 |
learning/modules/visitation_softmax.py | esteng/guiding-multi-step | 0 | 17798 | <reponame>esteng/guiding-multi-step
import torch
import torch.nn as nn
import numpy as np
class VisitationSoftmax(nn.Module):
def __init__(self, log=False):
super(VisitationSoftmax, self).__init__()
self.log = log
self.logsoftmax = nn.LogSoftmax()
self.softmax = nn.Softmax(dim=1)
... | 2.3125 | 2 |
baekjoon/easy-math/17362-finger.py | honux77/algorithm | 2 | 17799 | <gh_stars>1-10
n = int(input()) % 8
if n == 0:
print(2)
elif n <= 5:
print(n)
else:
print(10 - n)
| 2.875 | 3 |