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 |
|---|---|---|---|---|---|---|
tests/test_authentication.py | movermeyer/cellardoor | 0 | 4500 | import unittest
from mock import Mock
import base64
from cellardoor import errors
from cellardoor.authentication import *
from cellardoor.authentication.basic import BasicAuthIdentifier
class FooIdentifier(Identifier):
pass
class BarAuthenticator(Authenticator):
pass
class TestAuthentication(unittest.TestCase... | 2.859375 | 3 |
src/styleaug/__init__.py | somritabanerjee/speedplusbaseline | 69 | 4501 | <reponame>somritabanerjee/speedplusbaseline<filename>src/styleaug/__init__.py
from .styleAugmentor import StyleAugmentor | 1.140625 | 1 |
configs/classification/imagenet/mixups/convnext/convnext_tiny_smooth_mix_8xb256_accu2_ema_fp16.py | Westlake-AI/openmixup | 10 | 4502 | _base_ = [
'../../../_base_/datasets/imagenet/swin_sz224_4xbs256.py',
'../../../_base_/default_runtime.py',
]
# model settings
model = dict(
type='MixUpClassification',
pretrained=None,
alpha=0.2,
mix_mode="cutmix",
mix_args=dict(
attentivemix=dict(grid_size=32, top_k=None, beta=8),... | 1.398438 | 1 |
mcstasscript/interface/reader.py | PaNOSC-ViNYL/McStasScript | 3 | 4503 | import os
from mcstasscript.instr_reader.control import InstrumentReader
from mcstasscript.interface.instr import McStas_instr
class McStas_file:
"""
Reader of McStas files, can add to an existing McStasScript
instrument instance or create a corresponding McStasScript python
file.
Methods
---... | 3.125 | 3 |
src/regrtest.py | ucsd-progsys/csolve-bak | 0 | 4504 | <reponame>ucsd-progsys/csolve-bak<filename>src/regrtest.py
#!/usr/bin/python
# Copyright (c) 2009 The Regents of the University of California. All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and ... | 1.734375 | 2 |
country_capital_guesser.py | NathanMH/ComputerClub | 0 | 4505 | #! /usr/bin/env python3
#######################
"""####################
Index:
1. Imports and Readme
2. Functions
3. Main
4. Testing
####################"""
#######################
###################################################################
# 1. IMPORTS AND README
#############################... | 3.09375 | 3 |
data_analysis/audiocommons_ffont/scripts/rekordbox_xml_to_analysis_rhythm_rekordbox_file.py | aframires/freesound-loop-annotator | 18 | 4506 | # Need this to import from parent directory when running outside pycharm
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from ac_utils.general import save_to_json, load_from_json
import click
import xml.etree.ElementTree
from urllib import unquote
def find_c... | 2.375 | 2 |
inventree/part.py | SergeoLacruz/inventree-python | 0 | 4507 | <filename>inventree/part.py
# -*- coding: utf-8 -*-
import logging
import re
import inventree.base
import inventree.stock
import inventree.company
import inventree.build
logger = logging.getLogger('inventree')
class PartCategory(inventree.base.InventreeObject):
""" Class representing the PartCategory database... | 2.5625 | 3 |
tests/test_web_urldispatcher.py | avstarkov/aiohttp | 0 | 4508 | import functools
import os
import shutil
import tempfile
from unittest import mock
from unittest.mock import MagicMock
import pytest
from aiohttp import abc, web
from aiohttp.web_urldispatcher import SystemRoute
@pytest.fixture(scope='function')
def tmp_dir_path(request):
"""
Give a path for a temporary dir... | 2.5 | 2 |
R-GMM-VGAE/model_citeseer.py | nairouz/R-GAE | 26 | 4509 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Authors : <NAME> (<EMAIL>) & <NAME> (<EMAIL>)
# @Paper : Rethinking Graph Autoencoder Models for Attributed Graph Clustering
# @License : MIT License
import torch
import numpy as np
import torch.nn as nn
import scipy.sparse as sp
import torch.nn.functional as F
from t... | 2.1875 | 2 |
odoo-13.0/addons/stock_account/models/account_chart_template.py | VaibhavBhujade/Blockchain-ERP-interoperability | 0 | 4510 | <filename>odoo-13.0/addons/stock_account/models/account_chart_template.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, _
import logging
_logger = logging.getLogger(__name__)
class AccountChartTemplate(models.Model):
_inherit = "... | 2 | 2 |
lib/roi_data/loader.py | BarneyQiao/pcl.pytorch | 233 | 4511 | import math
import numpy as np
import numpy.random as npr
import torch
import torch.utils.data as data
import torch.utils.data.sampler as torch_sampler
from torch.utils.data.dataloader import default_collate
from torch._six import int_classes as _int_classes
from core.config import cfg
from roi_data.minibatch import ... | 1.921875 | 2 |
venv/Lib/site-packages/sklearn/linear_model/tests/test_least_angle.py | andywu113/fuhe_predict | 3 | 4512 | <reponame>andywu113/fuhe_predict<gh_stars>1-10
import warnings
from distutils.version import LooseVersion
import numpy as np
import pytest
from scipy import linalg
from sklearn.model_selection import train_test_split
from sklearn.utils.testing import assert_allclose
from sklearn.utils.testing import assert_array_alm... | 2.34375 | 2 |
parser.py | FeroxTL/pynginxconfig-new | 8 | 4513 | <filename>parser.py
#coding: utf8
import copy
import re
from blocks import Block, EmptyBlock, KeyValueOption, Comment, Location
def parse(s, parent_block):
config = copy.copy(s)
pos, brackets_level, param_start = 0, 0, 0
while pos < len(config):
if config[pos] == '#' and brackets_level == 0:
... | 2.984375 | 3 |
cocos2d/tools/jenkins-scripts/configs/cocos-2dx-develop-win32.py | triompha/EarthWarrior3D | 0 | 4514 | import os
import subprocess
import sys
print 'Build Config:'
print ' Host:win7 x86'
print ' Branch:develop'
print ' Target:win32'
print ' "%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2012.sln" /Build "Debug|Win32"'
if(os.path.exists('build/cocos2d-win32.vc2012.sln') == False):
node_... | 2.03125 | 2 |
iris_sdk/models/data/ord/rate_center_search_order.py | NumberAI/python-bandwidth-iris | 2 | 4515 | <filename>iris_sdk/models/data/ord/rate_center_search_order.py
#!/usr/bin/env python
from iris_sdk.models.base_resource import BaseData
from iris_sdk.models.maps.ord.rate_center_search_order import \
RateCenterSearchOrderMap
class RateCenterSearchOrder(RateCenterSearchOrderMap, BaseData):
pass | 1.5625 | 2 |
optimizer.py | thanusha22/CEC-1 | 0 | 4516 | <reponame>thanusha22/CEC-1
from pathlib import Path
import optimizers.PSO as pso
import optimizers.MVO as mvo
import optimizers.GWO as gwo
import optimizers.MFO as mfo
import optimizers.CS as cs
import optimizers.BAT as bat
import optimizers.WOA as woa
import optimizers.FFA as ffa
import optimizers.SSA as ssa
import o... | 1.921875 | 2 |
tests/fields/test_primitive_types.py | slawak/dataclasses-avroschema | 0 | 4517 | import dataclasses
import pytest
from dataclasses_avroschema import fields
from . import consts
@pytest.mark.parametrize("primitive_type", fields.PYTHON_INMUTABLE_TYPES)
def test_primitive_types(primitive_type):
name = "a_field"
field = fields.Field(name, primitive_type, dataclasses.MISSING)
avro_type ... | 2.53125 | 3 |
Bindings/Python/examples/Moco/examplePredictAndTrack.py | mcx/opensim-core | 532 | 4518 | <reponame>mcx/opensim-core
# -------------------------------------------------------------------------- #
# OpenSim Moco: examplePredictAndTrack.py #
# -------------------------------------------------------------------------- #
# Copyright (c) 2018 Stanford University and the Authors... | 1.867188 | 2 |
StorageSystem.py | aaronFritz2302/ZoomAuto | 0 | 4519 | <gh_stars>0
import sqlite3
from pandas import DataFrame
conn = sqlite3.connect('./data.db',check_same_thread=False)
class DataBase():
cursor = conn.cursor()
def __init__(self):
self.createTable()
def createTable(self):
'''
Creates A Table If it Doesnt E... | 3.75 | 4 |
pymapd/_parsers.py | mflaxman10/pymapd | 0 | 4520 | """
Utility methods for parsing data returned from MapD
"""
import datetime
from collections import namedtuple
from sqlalchemy import text
import mapd.ttypes as T
from ._utils import seconds_to_time
Description = namedtuple("Description", ["name", "type_code", "display_size",
... | 2.71875 | 3 |
featuretools/entityset/entity.py | rohit901/featuretools | 1 | 4521 | import logging
import warnings
import dask.dataframe as dd
import numpy as np
import pandas as pd
from featuretools import variable_types as vtypes
from featuretools.utils.entity_utils import (
col_is_datetime,
convert_all_variable_data,
convert_variable_data,
get_linked_vars,
infer_variable_types... | 2.890625 | 3 |
githubdl/url_helpers.py | wilvk/githubdl | 16 | 4522 | <gh_stars>10-100
import re
from urllib.parse import urlparse
import logging
def check_url_is_http(repo_url):
predicate = re.compile('^https?://.*$')
match = predicate.search(repo_url)
return False if match is None else True
def check_url_is_ssh(repo_url):
predicate = re.compile(r'^git\@.*\.git$')
... | 2.9375 | 3 |
RECOVERED_FILES/root/ez-segway/simulator/ez_lib/cen_scheduler.py | AlsikeE/Ez | 0 | 4523 | <reponame>AlsikeE/Ez
import itertools
from ez_lib import ez_flow_tool
from collections import defaultdict
from ez_scheduler import EzScheduler
from ez_lib.ez_ob import CenUpdateInfo, UpdateNext
from misc import constants, logger
from domain.message import *
from collections import deque
from misc import global_vars
im... | 1.929688 | 2 |
src/trackbar.py | clovadev/opencv-python | 0 | 4524 | <reponame>clovadev/opencv-python
import numpy as np
import cv2 as cv
def nothing(x):
pass
# Create a black image, a window
img = np.zeros((300, 512, 3), np.uint8)
cv.namedWindow('image')
# create trackbars for color change
cv.createTrackbar('R', 'image', 0, 255, nothing)
cv.createTrackbar('G', 'image', 0, 255,... | 3.28125 | 3 |
aoc_2015/src/day20.py | ambertests/adventofcode | 0 | 4525 | <reponame>ambertests/adventofcode
from functools import reduce
# https://stackoverflow.com/questions/6800193/what-is-the-most-efficient-way-of-finding-all-the-factors-of-a-number-in-python
def factors(n):
step = 2 if n%2 else 1
return set(reduce(list.__add__,
([i, n//i] for i in ran... | 3.703125 | 4 |
setup.py | jean/labels | 1 | 4526 | <reponame>jean/labels<gh_stars>1-10
import pathlib
import setuptools
def read(*args: str) -> str:
file_path = pathlib.Path(__file__).parent.joinpath(*args)
return file_path.read_text("utf-8")
setuptools.setup(
name="labels",
version="0.3.0.dev0",
author="<NAME>",
author_email="<EMAIL>",
... | 2.015625 | 2 |
colab/__init__.py | caseywstark/colab | 1 | 4527 | <gh_stars>1-10
# -*- coding: utf-8 -*-
__about__ = """
This project demonstrates a social networking site. It provides profiles,
friends, photos, blogs, tribes, wikis, tweets, bookmarks, swaps,
locations and user-to-user messaging.
In 0.5 this was called "complete_project".
"""
| 1.445313 | 1 |
src/ralph/ui/forms/util.py | quamilek/ralph | 0 | 4528 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from ralph.business.models import Venture, VentureRole
def all_ventures():
yield '', '---------'
for v in Venture.objects.filter(show_in... | 2.078125 | 2 |
tests/syntax/missing_in_with_for.py | matan-h/friendly | 287 | 4529 | <filename>tests/syntax/missing_in_with_for.py
for x range(4):
print(x)
| 1.726563 | 2 |
services/users/manage.py | eventprotocol/event-protocol-webapp | 0 | 4530 | """
manage.py for flask application
"""
import unittest
import coverage
import os
from flask.cli import FlaskGroup
from project import create_app, db
from project.api.models import User
# Code coverage
COV = coverage.Coverage(
branch=True,
include='project/*',
omit=[
'project/tests/*',
'p... | 2.6875 | 3 |
keras_transformer/keras_transformer/training/custom_callbacks/CustomCheckpointer.py | erelcan/keras-transformer | 3 | 4531 | <gh_stars>1-10
import os
from keras.callbacks import ModelCheckpoint
from keras_transformer.training.custom_callbacks.CustomCallbackABC import CustomCallbackABC
from keras_transformer.utils.io_utils import save_to_pickle
class CustomCheckpointer(ModelCheckpoint, CustomCallbackABC):
def __init__(self, workspace_p... | 2.15625 | 2 |
train_test_val.py | arashk7/Yolo5_Dataset_Generator | 0 | 4532 | import os
import shutil
input_dir = 'E:\Dataset\zhitang\Dataset_Zhitang_Yolo5'
output_dir = 'E:\Dataset\zhitang\Dataset_Zhitang_Yolo5\ZhitangYolo5'
in_img_dir = os.path.join(input_dir, 'Images')
in_label_dir = os.path.join(input_dir, 'Labels')
out_img_dir = os.path.join(output_dir, 'images')
out_label_dir = os.path.jo... | 2.515625 | 3 |
homeassistant/components/media_player/pjlink.py | dauden1184/home-assistant | 4 | 4533 | """
Support for controlling projector via the PJLink protocol.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.pjlink/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
PLATFORM_SCHEMA, SUPP... | 2.34375 | 2 |
leetcode/regex_matching.py | Kaushalya/algo_journal | 0 | 4534 | <reponame>Kaushalya/algo_journal
# Level: Hard
def isMatch(s: str, p: str) -> bool:
if not p:
return not s
n_s = len(s)
n_p = len(p)
j = 0
i = -1
while i < n_s-1:
i = i+ 1
if j >= n_p:
return False
if p[j] == '*':
while s[i]==s[i-1]:
... | 3.546875 | 4 |
tests/factories.py | luzik/waliki | 324 | 4535 | <reponame>luzik/waliki<filename>tests/factories.py
import factory
from django.contrib.auth.models import User, Group, Permission
from waliki.models import ACLRule, Page, Redirect
class UserFactory(factory.django.DjangoModelFactory):
username = factory.Sequence(lambda n: u'user{0}'.format(n))
password = factor... | 2.21875 | 2 |
nxt_editor/commands.py | dalteocraft/nxt_editor | 131 | 4536 | # Built-in
import copy
import logging
import time
# External
from Qt.QtWidgets import QUndoCommand
# Internal
from nxt_editor import colors
from nxt_editor import user_dir
from nxt import nxt_path
from nxt.nxt_layer import LAYERS, SAVE_KEY
from nxt.nxt_node import (INTERNAL_ATTRS, META_ATTRS, get_node_as_dict,
... | 2.25 | 2 |
mietrechtspraxis/mietrechtspraxis/doctype/arbitration_authority/arbitration_authority.py | libracore/mietrechtspraxis | 1 | 4537 | # -*- coding: utf-8 -*-
# Copyright (c) 2021, libracore AG and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import datetime
from PyPDF2 import PdfFileWriter
from frappe.utils.file_manager im... | 2.375 | 2 |
easysockets/client_socket.py | Matthias1590/EasySockets | 2 | 4538 | from .connection import Connection
import socket
class ClientSocket:
def __init__(self) -> None:
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def connect(self, host: str, port: int) -> Connection:
self.__socket.connect((host, port))
return Connection(self.__socke... | 3.0625 | 3 |
pxr/usd/usdGeom/testenv/testUsdGeomSchemata.py | yurivict/USD | 1 | 4539 | #!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | 1.960938 | 2 |
round_robin_generator/matchup_times.py | avadavat/round_robin_generator | 0 | 4540 | import pandas as pd
from datetime import timedelta
def generate_times(matchup_df: pd.DataFrame, tournament_start_time, game_duration, game_stagger):
time_df = pd.DataFrame(index=matchup_df.index, columns=matchup_df.columns)
if game_stagger == 0:
for round_num in range(time_df.shape[0]):
ro... | 2.984375 | 3 |
src/commands/locate_item.py | seisatsu/DennisMUD-ESP32 | 19 | 4541 | <reponame>seisatsu/DennisMUD-ESP32<filename>src/commands/locate_item.py
#######################
# <NAME> #
# locate_item.py #
# Copyright 2018-2020 #
# <NAME> #
#######################
# **********
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and ass... | 2.296875 | 2 |
modelling/scsb/models/monthly-comparisons.py | bcgov-c/wally | 0 | 4542 | <filename>modelling/scsb/models/monthly-comparisons.py
import json
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import RandomForestRegressor
from sklearn.tree import DecisionTreeRegressor
from xgboost import XGBRegressor
from catboost import... | 2.53125 | 3 |
src/week2-mlflow/AutoML/XGBoost-fake-news-automl.py | xzhnshng/databricks-zero-to-mlops | 0 | 4543 | # Databricks notebook source
# MAGIC %md
# MAGIC # XGBoost training
# MAGIC This is an auto-generated notebook. To reproduce these results, attach this notebook to the **10-3-ML-Cluster** cluster and rerun it.
# MAGIC - Compare trials in the [MLflow experiment](#mlflow/experiments/406583024052808/s?orderByKey=metrics.%... | 2.25 | 2 |
lucky_guess/__init__.py | mfinzi/lucky-guess-chemist | 0 | 4544 |
import importlib
import pkgutil
__all__ = []
for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
module = importlib.import_module('.'+module_name,package=__name__)
try:
globals().update({k: getattr(module, k) for k in module.__all__})
__all__ += module.__all__
except Att... | 2.09375 | 2 |
shuffling_algorithm.py | BaptisteLafoux/aztec_tiling | 0 | 4545 | <filename>shuffling_algorithm.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 30 22:04:48 2020
@author: baptistelafoux
"""
import domino
import numpy as np
import numpy.lib.arraysetops as aso
def spawn_block(x, y):
if np.random.rand() > 0.5:
d1 = domino.domino(np.array([x, ... | 3.078125 | 3 |
scripts/matrix_operations.py | h3ct0r/gas_mapping_example | 1 | 4546 | import numpy as np
def get_position_of_minimum(matrix):
return np.unravel_index(np.nanargmin(matrix), matrix.shape)
def get_position_of_maximum(matrix):
return np.unravel_index(np.nanargmax(matrix), matrix.shape)
def get_distance_matrix(cell_grid_x, cell_grid_y, x, y):
return np.sqrt((x - cell_grid_x)... | 2.984375 | 3 |
ShanghaiPower/build_up.py | biljiang/pyprojects | 0 | 4547 | <gh_stars>0
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize(["license_chk.py"]))
| 1.117188 | 1 |
quantum/plugins/nicira/extensions/nvp_qos.py | yamt/neutron | 0 | 4548 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Nicira, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... | 2.015625 | 2 |
easyneuron/math/__init__.py | TrendingTechnology/easyneuron | 1 | 4549 | <reponame>TrendingTechnology/easyneuron
"""easyneuron.math contains all of the maths tools that you'd ever need for your AI projects, when used alongside Numpy.
To suggest more to be added, please add an issue on the GitHub repo.
"""
from easyneuron.math.distance import euclidean_distance | 1.796875 | 2 |
tests/unit/concurrently/test_TaskPackageDropbox_put.py | shane-breeze/AlphaTwirl | 0 | 4550 | <reponame>shane-breeze/AlphaTwirl
# <NAME> <<EMAIL>>
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.concurrently import TaskPackageDropbox
##__________________________________________________________________||
@pytest.fixture()
def workingarea():
return mo... | 2.28125 | 2 |
networking_odl/tests/unit/dhcp/test_odl_dhcp_driver.py | gokarslan/networking-odl2 | 0 | 4551 | # Copyright (c) 2017 OpenStack Foundation
# 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 ... | 1.953125 | 2 |
users/migrations/0002_auto_20191113_1352.py | Dragonite/djangohat | 2 | 4552 | # Generated by Django 2.2.2 on 2019-11-13 13:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='users',
name='site_key',
fi... | 1.617188 | 2 |
premium/backend/src/baserow_premium/api/admin/dashboard/views.py | cjh0613/baserow | 839 | 4553 | <reponame>cjh0613/baserow
from datetime import timedelta
from django.contrib.auth import get_user_model
from drf_spectacular.utils import extend_schema
from rest_framework.response import Response
from rest_framework.permissions import IsAdminUser
from rest_framework.views import APIView
from baserow.api.decorators... | 2.390625 | 2 |
src/clientOld.py | dan3612812/socketChatRoom | 0 | 4554 | # -*- coding: UTF-8 -*-
import sys
import socket
import time
import threading
import select
HOST = '192.168.11.98'
PORT = int(sys.argv[1])
queue = []
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
queue.append(s)
print("add client to queue")
def socketRecv():
while True:
... | 3.015625 | 3 |
plugins/anomali_threatstream/komand_anomali_threatstream/actions/import_observable/schema.py | lukaszlaszuk/insightconnect-plugins | 46 | 4555 | # GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Import observable(s) into Anomali ThreatStream with approval"
class Input:
FILE = "file"
OBSERVABLE_SETTINGS = "observable_settings"
class Output:
RESULTS = "results"
class ImportObservableI... | 2.484375 | 2 |
trove/tests/unittests/quota/test_quota.py | citrix-openstack-build/trove | 0 | 4556 | # Copyright 2012 OpenStack Foundation
#
# 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 l... | 1.914063 | 2 |
analisador_sintatico/blueprints/api/parsers.py | viniciusandd/uri-analisador-sintatico | 0 | 4557 | from flask_restful import reqparse
def retornar_parser():
parser = reqparse.RequestParser()
parser.add_argument('sentenca', type=str, required=True)
return parser
| 2.25 | 2 |
demo_large_image.py | gunlyungyou/AerialDetection | 9 | 4558 | <reponame>gunlyungyou/AerialDetection<filename>demo_large_image.py<gh_stars>1-10
from mmdet.apis import init_detector, inference_detector, show_result, draw_poly_detections
import mmcv
from mmcv import Config
from mmdet.datasets import get_dataset
import cv2
import os
import numpy as np
from tqdm import tqdm
import DOT... | 2.046875 | 2 |
ImageSearcher/admin.py | carpensa/dicom-harpooner | 1 | 4559 | from django.contrib import admin
from dicoms.models import Subject
from dicoms.models import Session
from dicoms.models import Series
admin.site.register(Session)
admin.site.register(Subject)
admin.site.register(Series)
| 1.132813 | 1 |
src/djangoreactredux/wsgi.py | noscripter/django-react-redux-jwt-base | 4 | 4560 | <filename>src/djangoreactredux/wsgi.py
"""
WSGI config for django-react-redux-jwt-base project.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoreactredux.settings.dev")
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
application = get_wsgi_appli... | 1.296875 | 1 |
simple_settings/dynamic_settings/base.py | matthewh/simple-settings | 0 | 4561 | <gh_stars>0
# -*- coding: utf-8 -*-
import re
from copy import deepcopy
import jsonpickle
class BaseReader(object):
"""
Base class for dynamic readers
"""
_default_conf = {}
def __init__(self, conf):
self.conf = deepcopy(self._default_conf)
self.conf.update(conf)
self.key... | 2.765625 | 3 |
scripts/map_frame_to_utm_tf_publisher.py | coincar-sim/lanelet2_interface_ros | 7 | 4562 | #!/usr/bin/env python
#
# Copyright (c) 2018
# FZI Forschungszentrum Informatik, Karlsruhe, Germany (www.fzi.de)
# KIT, Institute of Measurement and Control, Karlsruhe, Germany (www.mrt.kit.edu)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted p... | 1.40625 | 1 |
lectures/05-python-intro/examples/argv.py | mattmiller899/biosys-analytics | 14 | 4563 | #!/usr/bin/env python3
import sys
print(sys.argv)
| 1.515625 | 2 |
tests/fixtures.py | easyas314159/cnftools | 0 | 4564 | <gh_stars>0
from itertools import chain
def make_comparable(*clauses):
return set((frozenset(c) for c in chain(*clauses)))
def count_clauses(*clauses):
total = 0
for subclauses in clauses:
total += len(subclauses)
return total
def unique_literals(*clauses):
literals = set()
for clause in chain(*clauses):
l... | 3.078125 | 3 |
applications/FluidDynamicsApplication/tests/sod_shock_tube_test.py | Rodrigo-Flo/Kratos | 0 | 4565 | # Import kratos core and applications
import KratosMultiphysics
import KratosMultiphysics.KratosUnittest as KratosUnittest
import KratosMultiphysics.kratos_utilities as KratosUtilities
from KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis import FluidDynamicsAnalysis
class SodShockTubeTest(KratosUni... | 1.929688 | 2 |
src/controllers/__init__.py | TonghanWang/NDQ | 63 | 4566 | from .basic_controller import BasicMAC
from .cate_broadcast_comm_controller import CateBCommMAC
from .cate_broadcast_comm_controller_full import CateBCommFMAC
from .cate_broadcast_comm_controller_not_IB import CateBCommNIBMAC
from .tar_comm_controller import TarCommMAC
from .cate_pruned_broadcast_comm_controller import... | 1.3125 | 1 |
main.py | 1999foxes/run-cmd-from-websocket | 0 | 4567 | import asyncio
import json
import logging
import websockets
logging.basicConfig()
async def counter(websocket, path):
try:
print("connect")
async for message in websocket:
print(message)
finally:
USERS.remove(websocket)
async def main():
async with websockets.serve(c... | 2.796875 | 3 |
3d_Vnet/3dvnet.py | GingerSpacetail/Brain-Tumor-Segmentation-and-Survival-Prediction-using-Deep-Neural-Networks | 100 | 4568 | <filename>3d_Vnet/3dvnet.py
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
import tensorflow as tf
import keras.backend as K
from keras.utils import to_categorical
from keras import metrics
from keras.models import Model, load_model
from keras.layers i... | 2.140625 | 2 |
vk/types/additional/active_offer.py | Inzilkin/vk.py | 24 | 4569 | from ..base import BaseModel
# returned from https://vk.com/dev/account.getActiveOffers
class ActiveOffer(BaseModel):
id: str = None
title: str = None
instruction: str = None
instruction_html: str = None
short_description: str = None
description: str = None
img: str = None
tag: str = ... | 1.703125 | 2 |
lib/networks/Resnet50_train.py | yangxue0827/TF_Deformable_Net | 193 | 4570 | <reponame>yangxue0827/TF_Deformable_Net
# --------------------------------------------------------
# TFFRCNN - Resnet50
# Copyright (c) 2016
# Licensed under The MIT License [see LICENSE for details]
# Written by miraclebiu
# --------------------------------------------------------
import tensorflow as tf
from .networ... | 2.34375 | 2 |
lib/aws_sso_lib/assignments.py | vdesjardins/aws-sso-util | 330 | 4571 | import re
import numbers
import collections
import logging
from collections.abc import Iterable
import itertools
import aws_error_utils
from .lookup import Ids, lookup_accounts_for_ou
from .format import format_account_id
LOGGER = logging.getLogger(__name__)
_Context = collections.namedtuple("_Context", [
"sess... | 2.21875 | 2 |
solutions/pic_search/webserver/src/service/theardpool.py | naetimus/bootcamp | 1 | 4572 | <reponame>naetimus/bootcamp<filename>solutions/pic_search/webserver/src/service/theardpool.py
import threading
from concurrent.futures import ThreadPoolExecutor
from service.train import do_train
def thread_runner(thread_num, func, *args):
executor = ThreadPoolExecutor(thread_num)
f = executor.submit(do_train... | 2.625 | 3 |
buildutil/main.py | TediCreations/buildutils | 0 | 4573 | #!/usr/bin/env python3
import os
import argparse
import subprocess
if __name__ == '__main__':
from version import __version__
from configParser import ConfigParser
else:
from .version import __version__
from .configParser import ConfigParser
def command(cmd):
"""Run a shell command"""
subprocess.call(cmd, sh... | 2.640625 | 3 |
python/get_links.py | quiddity-wp/mediawiki-api-demos | 63 | 4574 | <filename>python/get_links.py
#This file is auto-generated. See modules.json and autogenerator.py for details
#!/usr/bin/python3
"""
get_links.py
MediaWiki API Demos
Demo of `Links` module: Get all links on the given page(s)
MIT License
"""
import requests
S = requests.Session()
URL = "https://en... | 3.1875 | 3 |
gautools/submit_gaussian.py | thompcinnamon/QM-calc-scripts | 0 | 4575 | <reponame>thompcinnamon/QM-calc-scripts<filename>gautools/submit_gaussian.py<gh_stars>0
#! /usr/bin/env python3
########################################################################
# #
# This script was written by <NAME> in 2015. ... | 1.90625 | 2 |
experiments/recorder.py | WeiChengTseng/maddpg | 3 | 4576 | import json
import copy
import pdb
import numpy as np
import pickle
def listify_mat(matrix):
matrix = np.array(matrix).astype(str)
if len(matrix.shape) > 1:
matrix_list = []
for row in matrix:
try:
matrix_list.append(list(row))
except:
pd... | 2.65625 | 3 |
generate/dummy_data/mvp/gen_csv.py | ifekxp/data | 0 | 4577 | <reponame>ifekxp/data
from faker import Faker
import csv
# Reference: https://pypi.org/project/Faker/
output = open('data.CSV', 'w', newline='')
fake = Faker()
header = ['name', 'age', 'street', 'city', 'state', 'zip', 'lng', 'lat']
mywriter=csv.writer(output)
mywriter.writerow(header)
for r in rang... | 2.71875 | 3 |
subir/ingreso/migrations/0004_auto_20191003_1509.py | Brandon1625/subir | 0 | 4578 | # Generated by Django 2.2.4 on 2019-10-03 21:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ingreso', '0003_auto_20190907_2152'),
]
operations = [
migrations.AlterField(
model_name='detal... | 1.320313 | 1 |
pyscf/nao/test/test_0017_tddft_iter_nao.py | mfkasim1/pyscf | 3 | 4579 | from __future__ import print_function, division
import os,unittest
from pyscf.nao import tddft_iter
dname = os.path.dirname(os.path.abspath(__file__))
td = tddft_iter(label='water', cd=dname)
try:
from pyscf.lib import misc
libnao_gpu = misc.load_library("libnao_gpu")
td_gpu = tddft_iter(label='water', cd... | 2.328125 | 2 |
setup.py | dimasciput/osm2geojson | 0 | 4580 | import io
from os import path
from setuptools import setup
dirname = path.abspath(path.dirname(__file__))
with io.open(path.join(dirname, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
def parse_requirements(filename):
lines = (line.strip() for line in open(path.join(dirname, filename)))
... | 2.078125 | 2 |
Cap_11/ex11.6.py | gguilherme42/Livro-de-Python | 4 | 4581 | import sqlite3
from contextlib import closing
nome = input('Nome do produto: ').lower().capitalize()
with sqlite3.connect('precos.db') as conexao:
with closing(conexao.cursor()) as cursor:
cursor.execute('SELECT * FROM Precos WHERE nome_produto = ?', (nome,))
registro = cursor.fetchone()
... | 3.59375 | 4 |
jet20/backend/solver.py | JTJL/jet20 | 1 | 4582 | <filename>jet20/backend/solver.py<gh_stars>1-10
import torch
import time
import copy
from jet20.backend.constraints import *
from jet20.backend.obj import *
from jet20.backend.config import *
from jet20.backend.core import solve,OPTIMAL,SUB_OPTIMAL,USER_STOPPED
import logging
logger = logging.getLogger(__name__)
... | 2.15625 | 2 |
tests/test_transforms.py | mengfu188/mmdetection.bak | 2 | 4583 | import torch
from mmdet.datasets.pipelines.transforms import Pad
from mmdet.datasets.pipelines.transforms import FilterBox
import numpy as np
import cv2
def test_pad():
raw = dict(
img=np.zeros((200, 401, 3), dtype=np.uint8)
)
cv2.imshow('raw', raw['img'])
pad = Pad(square=True, pad_val=255)
... | 2.515625 | 3 |
dev/Tools/build/waf-1.7.13/lmbrwaflib/unit_test_lumberyard_modules.py | akulamartin/lumberyard | 8 | 4584 | #
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... | 1.984375 | 2 |
linprog_curvefit.py | drofp/linprog_curvefit | 0 | 4585 | #!/usr/bin/env python3
"""Curve fitting with linear programming.
Minimizes the sum of error for each fit point to find the optimal coefficients
for a given polynomial.
Overview:
Objective: Sum of errors
Subject to: Bounds on coefficients
Credit: "Curve Fitting with Linear Programming", <NAME> and <NAME>
"""... | 3.65625 | 4 |
build-script-helper.py | aciidb0mb3r/swift-stress-tester | 0 | 4586 | <filename>build-script-helper.py
#!/usr/bin/env python
"""
This source file is part of the Swift.org open source project
Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license informati... | 1.953125 | 2 |
tests/components/deconz/test_scene.py | pcaston/core | 1 | 4587 | <filename>tests/components/deconz/test_scene.py
"""deCONZ scene platform tests."""
from unittest.mock import patch
from openpeerpower.components.scene import DOMAIN as SCENE_DOMAIN, SERVICE_TURN_ON
from openpeerpower.const import ATTR_ENTITY_ID
from .test_gateway import (
DECONZ_WEB_REQUEST,
mock_deconz_put_... | 2.125 | 2 |
tensorhive/config.py | roscisz/TensorHive | 129 | 4588 | from pathlib import PosixPath
import configparser
from typing import Dict, Optional, Any, List
from inspect import cleandoc
import shutil
import tensorhive
import os
import logging
log = logging.getLogger(__name__)
class CONFIG_FILES:
# Where to copy files
# (TensorHive tries to load these by default)
con... | 2.234375 | 2 |
model.py | iz2late/baseline-seq2seq | 1 | 4589 | import random
from typing import Tuple
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch import Tensor
class Encoder(nn.Module):
def __init__(self, input_dim, emb_dim, enc_hid_dim, dec_hid_dim, dropout):
super().__init__()
self.input_dim = in... | 2.3125 | 2 |
ML/Pytorch/more_advanced/Seq2Seq/seq2seq.py | xuyannus/Machine-Learning-Collection | 3,094 | 4590 | <filename>ML/Pytorch/more_advanced/Seq2Seq/seq2seq.py<gh_stars>1000+
import torch
import torch.nn as nn
import torch.optim as optim
from torchtext.datasets import Multi30k
from torchtext.data import Field, BucketIterator
import numpy as np
import spacy
import random
from torch.utils.tensorboard import SummaryWriter # ... | 2.3125 | 2 |
gail_chatbot/light/sqil/light_sentence_imitate_mixin.py | eublefar/gail_chatbot | 0 | 4591 | from typing import Dict, Any, List
import string
from parlai.core.agents import Agent
from parlai.core.message import Message
from random import sample
import pathlib
path = pathlib.Path(__file__).parent.absolute()
class LightImitateMixin(Agent):
"""Abstract class that handles passing expert trajectories alo... | 2.484375 | 2 |
pytudes/_2021/educative/grokking_the_coding_interview/fast_and_slow_pointers/_1__linked_list_cycle__easy.py | TeoZosa/pytudes | 1 | 4592 | <reponame>TeoZosa/pytudes
"""https://www.educative.io/courses/grokking-the-coding-interview/N7rwVyAZl6D
Categories:
- Binary
- Bit Manipulation
- Blind 75
See Also:
- pytudes/_2021/leetcode/blind_75/linked_list/_141__linked_list_cycle__easy.py
"""
from pytudes._2021.utils.linked_list import (
Li... | 3.96875 | 4 |
httpd.py | whtt8888/TritonHTTPserver | 2 | 4593 | <filename>httpd.py
import sys
import os
import socket
import time
import threading
class MyServer:
def __init__(self, port, doc_root):
self.port = port
self.doc_root = doc_root
self.host = '127.0.0.1'
self.res_200 = "HTTP/1.1 200 OK\r\nServer: Myserver 1.0\r\n"
self.res_40... | 2.8125 | 3 |
metric/metric.py | riven314/ENetDepth_TimeAnlysis_Tmp | 0 | 4594 | <gh_stars>0
class Metric(object):
"""Base class for all metrics.
From: https://github.com/pytorch/tnt/blob/master/torchnet/meter/meter.py
"""
def reset(self):
pass
def add(self):
pass
def value(self):
pass
| 2.265625 | 2 |
pf_pweb_sourceman/task/git_repo_man.py | problemfighter/pf-pweb-sourceman | 0 | 4595 | from git import Repo
from pf_pweb_sourceman.common.console import console
from pf_py_file.pfpf_file_util import PFPFFileUtil
class GitRepoMan:
def get_repo_name_from_url(self, url: str):
if not url:
return None
last_slash_index = url.rfind("/")
last_suffix_index = url.rfind("... | 2.765625 | 3 |
tool/remote_info.py | shanmukmichael/Asset-Discovery-Tool | 0 | 4596 | <filename>tool/remote_info.py
import socket
import paramiko
import json
Hostname = '172.16.17.32'
Username = 'ec2-user'
key = 'G:/Projects/Python/Asset-Discovery-Tool/tool/s.pem'
def is_connected():
try:
# connect to the host -- tells us if the host is actually
# reachable
socket.create_c... | 2.75 | 3 |
hvac/api/secrets_engines/kv_v2.py | Famoco/hvac | 0 | 4597 | <filename>hvac/api/secrets_engines/kv_v2.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""KvV2 methods module."""
from hvac import exceptions, utils
from hvac.api.vault_api_base import VaultApiBase
DEFAULT_MOUNT_POINT = 'secret'
class KvV2(VaultApiBase):
"""KV Secrets Engine - Version 2 (API).
Reference:... | 2.53125 | 3 |
android/install-all.py | SaschaWillems/vulkan_slim | 28 | 4598 | # Install all examples to connected device(s)
import subprocess
import sys
answer = input("Install all vulkan examples to attached device, this may take some time! (Y/N)").lower() == 'y'
if answer:
BUILD_ARGUMENTS = ""
for arg in sys.argv[1:]:
if arg == "-validation":
BUILD_ARGUMENTS += "-v... | 2.59375 | 3 |
main.py | juangallostra/moonboard | 0 | 4599 | from generators.ahoughton import AhoughtonGenerator
from render_config import RendererConfig
from problem_renderer import ProblemRenderer
from moonboard import get_moonboard
from adapters.default import DefaultProblemAdapter
from adapters.crg import CRGProblemAdapter
from adapters.ahoughton import AhoughtonAdapter
impo... | 2.203125 | 2 |