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 |
|---|---|---|---|---|---|---|
iblviewer/volume.py | nantille/iblviewer | 0 | 8600 | from dataclasses import dataclass, field
from typing import Mapping, List, Any
from datetime import datetime
import logging
import pandas as pd
import glob
import numpy as np
import logging
import os
from collections import OrderedDict
import nrrd
import vtk
import vedo
from vtk.util.numpy_support import numpy_to_vtk
... | 2.125 | 2 |
modeling/dataset.py | LaudateCorpus1/ml-cread | 18 | 8601 | <gh_stars>10-100
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2021 Apple Inc. All Rights Reserved.
#
'''
Dataset file
'''
import sys
import time
import json
import copy
from itertools import chain
from tqdm import tqdm, trange
import torch
from torch.utils.data import DataLoader, RandomSampler
S... | 2.015625 | 2 |
hy/lex/lexer.py | schuster-rainer/hy | 12 | 8602 | # Copyright (c) 2013 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, di... | 1.671875 | 2 |
week6/shuffle.py | solideveloper/afs-210 | 1 | 8603 | # Python provides a built-in method called random.shuffle that will shuffle the list data type. Do not use this.
# For this assignment, you are to create your own shuffle algorithm that will take as input a sorted list and randomly shuffle the items before returning the list. Try to make your algorithm as efficient a... | 4.6875 | 5 |
workbox/workbox/lib/helpers.py | pr3sto/workbox | 0 | 8604 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Template Helpers used in workbox"""
import logging
import socket
from datetime import datetime
from markupsafe import Markup
import psutil
import tg
log = logging.getLogger(__name__)
def current_year():
""" Return current year. """
now = datetime.now()
return now.... | 2.328125 | 2 |
tadataka/dataset/new_tsukuba.py | IshitaTakeshi/Tadataka | 54 | 8605 | <filename>tadataka/dataset/new_tsukuba.py
import csv
import os
from pathlib import Path
from xml.etree import ElementTree as ET
from tqdm import tqdm
from scipy.spatial.transform import Rotation
from skimage.io import imread
import numpy as np
from tadataka.camera import CameraModel, CameraParameters, FOV
from tadata... | 2.21875 | 2 |
krogon/maybe.py | enamrik/krogon | 1 | 8606 | from typing import Callable, TypeVar, Union, Tuple
from krogon.infix import Infix
A = TypeVar('A')
B = TypeVar('B')
E = TypeVar('E')
Maybe = Union[Tuple['just', A], Tuple['nothing']]
def just(value=None):
return "just", value
def nothing():
return "nothing", None
def from_value(value) -> Maybe[B]:
r... | 2.9375 | 3 |
Python (desafios)/desafio 009.py | EbersonDias/html-css | 0 | 8607 | <reponame>EbersonDias/html-css
# Desafio 009
# Faça um programa que leia um numero inteiro qualquer
# e mostre na tela a sua tabuada.
n = int(input('digite um numero. '))
r1 = n * 1
r2 = (n * 2)
r3 = (n * 3)
r4 = (n * 4)
r5 = (n * 5)
r6 = (n * 6)
r7 = (n * 7)
r8 = (n * 8)
r9 = (n * 9)
r10 = (n * 10)
print('A Tabuada d... | 4.15625 | 4 |
tools/__init__.py | supercatex/TelloEdu | 1 | 8608 | from tools.TelloEdu import TelloEdu
from tools.Controller import *
from tools.SocketObject import SocketClient | 1.164063 | 1 |
neutron/agent/ovsdb/native/helpers.py | congnt95/neutron | 1,080 | 8609 | # Copyright (c) 2015 Red Hat, 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 ... | 1.1875 | 1 |
conlo/serializer/json_serializer.py | kira607/config_loader | 0 | 8610 | import json
from .base_serializer import BaseSerializer
class JsonSerializer(BaseSerializer):
'''Json serializer.'''
def _serialize(self, data: dict, **kwargs) -> str:
return json.dumps(data)
def _deserialize(self, data: str, **kwargs) -> dict:
return json.loads(data)
| 2.765625 | 3 |
console_weather.py | AlBan52/API_weather | 0 | 8611 | <reponame>AlBan52/API_weather<filename>console_weather.py
import requests
locations = ['Лондон', 'Шереметьево', 'Череповец']
payload = {'mnTq': '', 'lang': 'ru'}
for location in locations:
response = requests.get(f'http://wttr.in/{location}', params=payload)
response.raise_for_status()
print(response.text... | 2.71875 | 3 |
migrations/versions/576712576c48_added_model_for_photo_comments.py | Torniojaws/vortech-backend | 0 | 8612 | <reponame>Torniojaws/vortech-backend
"""Added model for photo comments
Revision ID: 576712576c48
Revises: <PASSWORD>
Create Date: 2018-03-30 02:06:22.877079
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '576712576c48'
down_revision = '<PASSWORD>'... | 1.25 | 1 |
__init__.py | m3sserschmitt/basic-http | 0 | 8613 | <filename>__init__.py
import basic_http.session
basic_http.session.LIB_VERSION = 'v0.0.4-beta'
basic_http.session.DEFAULT_AGENT = 'basic-http version ' + basic_http.session.LIB_VERSION
| 1.320313 | 1 |
usaspending_api/etl/helpers.py | truthiswill/usaspending-api | 0 | 8614 | from datetime import datetime
import warnings
import logging
from django.db.models import Q, Case, Value, When
from django.core.cache import caches, CacheKeyWarning
import django.apps
from usaspending_api.references.models import Agency, Location, RefCountryCode
from usaspending_api.references.helpers import canonica... | 2.03125 | 2 |
{{cookiecutter.project_name}}/{{cookiecutter.app_name}}/extensions.py | DevAerial/flask-api-template | 0 | 8615 | <gh_stars>0
from flask_marshmallow import Marshmallow{% if cookiecutter.use_celery == 'yes'%}
from celery import Celery
celery = Celery(){% endif %}
ma = Marshmallow()
| 1.867188 | 2 |
code/mapplot.py | young-astronomer/vlpy | 0 | 8616 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 11:11:56 2020
This program is use to plot polarization map from vlbi fits image.
You should specify the input fits images by -i or --infile,
output file by -o or --output,
contour levs by -l or --levs
contour base by -c or --cmul
polarization... | 2.5625 | 3 |
umbrella/api/v1/router.py | pizhi/umbrella | 1 | 8617 | <gh_stars>1-10
# Copyright 2011 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
#
#... | 2 | 2 |
exemples/test_thomson_simu.py | butala/TomograPy | 7 | 8618 | <filename>exemples/test_thomson_simu.py
#!/usr/bin/env python
import time
import numpy as np
import tomograpy
import lo
# object
obj = tomograpy.centered_cubic_map(10, 64)
obj[:] = tomograpy.phantom.shepp_logan(obj.shape)
# data
radius = 200
a = tomograpy.fov(obj, radius)
data = tomograpy.centered_stack(a, 128, n_imag... | 2.46875 | 2 |
geopy/geocoders/google.py | ulope/geopy | 1 | 8619 | import logging
from urllib import urlencode
from urllib2 import urlopen
import simplejson
import xml
from xml.parsers.expat import ExpatError
from geopy.geocoders.base import Geocoder
from geopy import Point, Location, util
class Google(Geocoder):
"""Geocoder using the Google Maps API."""
def __init__(... | 3.1875 | 3 |
interactive_grabcut/repo/drag2draw.py | hiankun/py_sandbox | 0 | 8620 | <reponame>hiankun/py_sandbox
# source: https://www.youtube.com/watch?v=U0sVp1xLiyo
from tkinter import *
def paint(event):
color = 'red'
x1, y1 = (event.x-1), (event.y-1)
x2, y2 = (event.x+1), (event.y+1)
c.create_oval(x1,y1,x2,y2,fill=color,outline=color)
master = Tk()
c = Canvas(master, width=600,... | 3.25 | 3 |
migrations/20220114_03_Heqaz-insert-default-serverinfo.py | lin483/Funny-Nations | 126 | 8621 | <gh_stars>100-1000
"""
insert default serverInfo
"""
from yoyo import step
__depends__ = {'20220114_02_lHBKM-new-table-serverinfo'}
steps = [
step("INSERT INTO `serverInfo` (`onlineMinute`) VALUES (0);")
]
| 0.871094 | 1 |
neutronclient/osc/v2/vpnaas/ipsec_site_connection.py | slawqo/python-neutronclient | 120 | 8622 | <gh_stars>100-1000
# Copyright 2017 FUJITSU LIMITED
# 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.... | 1.328125 | 1 |
Arknights/flags.py | AlaricGilbert/ArknightsAutoHelper | 0 | 8623 | <gh_stars>0
TINY_WAIT = 1
SMALL_WAIT = 3
MEDIUM_WAIT = 5
BIG_WAIT = 10
SECURITY_WAIT = 15
BATTLE_FINISH_DETECT = 12
BATTLE_NONE_DETECT_TIME = 90
BATTLE_END_SIGNAL_MAX_EXECUTE_TIME = 15
# 关键动作的偏移
FLAGS_START_BATTLE_BIAS = (50, 25)
FLAGS_ENSURE_TEAM_INFO_BIAS = (25, 50)
# 正方形偏移
FLAGS_CLICK_BIAS_TINY = (3, 3)
FLAGS_CLI... | 1.085938 | 1 |
elasticsearch/client/shutdown.py | Conky5/elasticsearch-py | 4 | 8624 | <filename>elasticsearch/client/shutdown.py
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Versi... | 1.796875 | 2 |
sushichef.py | RechercheTech/sushi-chef-arvind-gupta-toys | 1 | 8625 | <reponame>RechercheTech/sushi-chef-arvind-gupta-toys
#!/usr/bin/env python
import os
import requests
import re
import shutil
from arvind import ArvindVideo, ArvindLanguage, YOUTUBE_CACHE_DIR
from bs4 import BeautifulSoup
from bs4.element import NavigableString
from ricecooker.chefs import SushiChef
from ricecooker.... | 1.96875 | 2 |
api/views/domain.py | lndba/apasa_backend | 1 | 8626 | from rest_framework.viewsets import ModelViewSet,GenericViewSet
from rest_framework.response import Response
from api.serializers.domain import *
from api.pagination.page import MyPageNumberPagination
from api.models import *
class MDomainListViewSet(ModelViewSet):
queryset = MasterDomainName.objects.all().order... | 2.140625 | 2 |
90-subsets-ii.py | yuenliou/leetcode | 0 | 8627 | #!/usr/local/bin/python3.7
# -*- coding: utf-8 -*-
from typing import List
class Solution:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
"""
题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/
"""
def backtrack(sta... | 3.859375 | 4 |
tools/output_tool.py | climberwb/bert-pli | 5 | 8628 | import json
from .accuracy_tool import gen_micro_macro_result
def null_output_function(data, config, *args, **params):
return ""
def basic_output_function(data, config, *args, **params):
which = config.get("output", "output_value").replace(" ", "").split(",")
temp = gen_micro_macro_result(da... | 2.328125 | 2 |
python/drydock_provisioner/ingester/plugins/deckhand.py | Vjrx/airship-drydock | 14 | 8629 | # Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | 1.914063 | 2 |
porting_tools/package_xml_porter.py | nreplogle/ros2-migration-tools | 92 | 8630 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "licens... | 2.234375 | 2 |
endpoints/api/permission_models_interface.py | giuseppe/quay | 2,027 | 8631 | <gh_stars>1000+
import sys
from abc import ABCMeta, abstractmethod
from collections import namedtuple
from six import add_metaclass
class SaveException(Exception):
def __init__(self, other):
self.traceback = sys.exc_info()
super(SaveException, self).__init__(str(other))
class DeleteException(Ex... | 3.0625 | 3 |
configs/mot/tracktor/tracktor_faster-rcnn_r50_fpn_4e_mot17-public.py | sht47/mmtracking | 12 | 8632 | <reponame>sht47/mmtracking<gh_stars>10-100
_base_ = ['./tracktor_faster-rcnn_r50_fpn_4e_mot17-public-half.py']
model = dict(
pretrains=dict(
detector= # noqa: E251
'https://download.openmmlab.com/mmtracking/mot/faster_rcnn/faster-rcnn_r50_fpn_4e_mot17-ffa52ae7.pth' # noqa: E501
))
data_root = ... | 1.695313 | 2 |
browserstack/first_sample_build.py | Shaimyst/scrive_test | 0 | 8633 | <reponame>Shaimyst/scrive_test
from threading import Thread
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.common.exceptions import TimeoutException
from selenium.webdriver... | 2.421875 | 2 |
sanitizers/mvj.py | suutari-ai/mvj | 1 | 8634 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
from random import choice
from string import digits
from faker import Faker
fake = Faker("fi_FI")
def sanitize_address(value):
return fake.address()
def sanitize_address_if_exist(value):
if value:
return sanitize_addres... | 3.078125 | 3 |
ISM_catalog_profile/scripts/ISM/ISM.py | rhmdnd/compliance-trestle-demos | 10 | 8635 | <reponame>rhmdnd/compliance-trestle-demos
#!/usr/bin/env python3
# # -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. 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... | 1.882813 | 2 |
logistics/permissions.py | geo2tag-logistics/main | 0 | 8636 | from rest_framework import permissions
def is_owner(user):
return user.groups.filter(name='OWNER').exists()
def is_driver(user):
return user.groups.filter(name='DRIVER').exists()
class IsOwnerPermission(permissions.BasePermission):
def has_permission(self, request, view):
return is_owner(reque... | 2.34375 | 2 |
src/python/reduce_fps_parallel.py | blancKaty/alignmentFralework_and_classif | 0 | 8637 | <filename>src/python/reduce_fps_parallel.py
import os
import shutil
import sys
import multiprocessing
import glob
def copy(source, dest):
shutil.copyfile(source, dest)
def main():
input_folder = sys.argv[1]
output_folder = sys.argv[2]
print 'input reduce fps : ' , sys.argv
fps = int(sys.argv[3]... | 3.234375 | 3 |
ansible/utils/module_docs_fragments/docker.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 1 | 8638 | <gh_stars>1-10
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in... | 1.523438 | 2 |
setup.py | cyberjunky/python-garminconnect-aio | 11 | 8639 | <reponame>cyberjunky/python-garminconnect-aio
#!/usr/bin/env python
from setuptools import setup
with open("README.md") as readme_file:
readme = readme_file.read()
setup(
author="<NAME>",
author_email="<EMAIL>",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Appr... | 1.859375 | 2 |
nova/tests/unit/virt/libvirt/fake_imagebackend.py | ChameleonCloud/nova | 1 | 8640 | # Copyright 2012 Grid Dynamics
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | 2.15625 | 2 |
tests/test_email_subscriptions.py | coolboi567/dnstwister | 0 | 8641 | <filename>tests/test_email_subscriptions.py
"""Tests of the email subscription mechanism."""
import binascii
import flask_webtest
import mock
import pytest
import webtest.app
import dnstwister
import dnstwister.tools
import patches
@mock.patch('dnstwister.views.www.email.emailer', patches.NoEmailer())
@... | 2.578125 | 3 |
ershoufang/crawler_v2.py | zlikun/python-crawler-lianjia | 2 | 8642 | """
第二版:多进程二手房信息爬虫
1. 将爬虫分解为下载任务和解析任务(可以继续分解,但在本案中意义不大)两部分,两部分各使用一个子进程,相互通过数据管道通信
2. 下载任务内部不使用队列,使用任务管道实现(在多进程:主进程、子进程、子进程内部进程池等场景下,队列并不好用)任务管理和通信
3. 解析任务从与下载任务间的管道中获取数据,解析并保存
问题:当目标被爬完后,怎样让爬虫停止?
"""
import csv
import datetime
import logging
import multiprocessing as mp
import re
import time
from collections import O... | 2.703125 | 3 |
desktop/core/ext-py/pyu2f-0.1.4/pyu2f/convenience/customauthenticator.py | yetsun/hue | 5,079 | 8643 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 2.046875 | 2 |
kive/portal/management/commands/graph_kive.py | dmacmillan/Kive | 1 | 8644 | import itertools
import os
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Generates class diagrams.'
def handle(self, *args, **options):
if 'django_extensions' not in settings.IN... | 2.109375 | 2 |
summary.py | rpls/openlane_summary | 0 | 8645 | <reponame>rpls/openlane_summary
#!/usr/bin/env python3
import argparse
import os
import glob
import csv
import sys
import re
from shutil import which
import datetime
def is_tool(name):
return which(name) is not None
def check_path(path):
paths = glob.glob(path)
if len(paths) == 0:
exit("file not ... | 2.6875 | 3 |
var/spack/repos/builtin/packages/py-cupy/package.py | player1537-forks/spack | 11 | 8646 | <filename>var/spack/repos/builtin/packages/py-cupy/package.py<gh_stars>10-100
# Copyright 2013-2022 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 PyCupy(PythonPac... | 1.5 | 2 |
simple_rest_client/decorators.py | cfytrok/python-simple-rest-client | 0 | 8647 | <filename>simple_rest_client/decorators.py
import logging
from functools import wraps
import status
from httpx import exceptions
from .exceptions import AuthError, ClientConnectionError, ClientError, NotFoundError, ServerError
logger = logging.getLogger(__name__)
def validate_response(response):
error_suffix =... | 2.4375 | 2 |
HPOBenchExperimentUtils/resource_manager/__init__.py | PhMueller/TrajectoryParser | 0 | 8648 | from HPOBenchExperimentUtils.resource_manager.file_resource_manager import FileBasedResourceManager
| 1.1875 | 1 |
tools/mirrors.bzl | kkiningh/slime | 0 | 8649 | <reponame>kkiningh/slime<filename>tools/mirrors.bzl<gh_stars>0
DEFAULT_MIRRORS = {
"bitbucket": [
"https://bitbucket.org/{repository}/get/{commit}.tar.gz",
],
"buildifier": [
"https://github.com/bazelbuild/buildtools/releases/download/{version}/{filename}",
],
"github": [
"ht... | 1.140625 | 1 |
201805_ChIP_ATAC/codes_old/read_txt.py | ScrippsPipkinLab/GenomeTracks | 0 | 8650 | <reponame>ScrippsPipkinLab/GenomeTracks
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 6 21:15:23 2017
@author: yolandatiao
"""
import csv
import glob
import os
from astropy.io import ascii # For using ascii table to open csv
from astropy.table import Table, Column # For using astropy table... | 1.9375 | 2 |
tests/test_vendcrawler.py | josetaas/vendcrawler | 0 | 8651 | <reponame>josetaas/vendcrawler
import unittest
from vendcrawler.scripts.vendcrawler import VendCrawler
class TestVendCrawlerMethods(unittest.TestCase):
def test_get_links(self):
links = VendCrawler('a', 'b', 'c').get_links(2)
self.assertEqual(links,
['https://sarahserver... | 3.078125 | 3 |
services/spotify-service.py | thk4711/mediamanager | 0 | 8652 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
import json
import os
import sys
import time
import urllib
import socket
import argparse
import requests
import lib.common as common
base_url = 'http://localhost:24879/player/'
#------------------------------------------------------------------------------#
# ... | 2.453125 | 2 |
Segment/models/other/fcn.py | YuHe0108/cvmodule | 0 | 8653 | # from tensorflow.keras import Model, Input
# from tensorflow.keras.applications import vgg16, resnet50
# from tensorflow.keras.layers import (Conv2D, Conv2DTranspose, Cropping2D, add, Dropout, Reshape, Activation)
# from tensorflow.keras import layers
# import tensorflow as tf
#
# """
# FCN-8特点:
# 1、不含全连接层... | 2.59375 | 3 |
tests/Python/test_all_configs_output.py | lopippo/IsoSpec | 27 | 8654 | <filename>tests/Python/test_all_configs_output.py
def binom(n, k):
"""Quickly adapted from https://stackoverflow.com/questions/26560726/python-binomial-coefficient"""
if k < 0 or k > n:
return 0
if k == 0 or k == n:
return 1
total_ways = 1
for i in range(min(k, n - k)):
total... | 3 | 3 |
tractseg/models/UNet_Pytorch_Regression.py | soichih/TractSeg | 0 | 8655 | # Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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.9375 | 2 |
platform/core/polyaxon/sidecar/sidecar/__main__.py | hackerwins/polyaxon | 0 | 8656 | import argparse
import time
from kubernetes.client.rest import ApiException
from polyaxon_client.client import PolyaxonClient
from polyaxon_k8s.manager import K8SManager
from sidecar import settings
from sidecar.monitor import is_pod_running
if __name__ == '__main__':
parser = argparse.ArgumentParser()
pars... | 2.03125 | 2 |
simple_robot_tests/src/test_odometry.py | plusangel/simple_robot | 1 | 8657 | #! /usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
class OdomTopicReader(object):
def __init__(self, topic_name = '/odom'):
self._topic_name = topic_name
self._sub = rospy.Subscriber(self._topic_name, Odometry, self.topic_callback)
self._odomdata = Odometry()
def to... | 2.53125 | 3 |
test/test_random.py | kevinintel/neural-compressor | 100 | 8658 | """Tests for quantization"""
import numpy as np
import unittest
import os
import shutil
import yaml
import tensorflow as tf
def build_fake_yaml():
fake_yaml = '''
model:
name: fake_yaml
framework: tensorflow
inputs: x
outputs: op_to_store
dev... | 2.578125 | 3 |
cirq/google/engine/engine_client_test.py | lilies/Cirq | 1 | 8659 | # Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 1.96875 | 2 |
google/ads/google_ads/v0/proto/services/media_file_service_pb2_grpc.py | jwygoda/google-ads-python | 0 | 8660 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v0.proto.resources import media_file_pb2 as google_dot_ads_dot_googleads__v0_dot_proto_dot_resources_dot_media__file__pb2
from google.ads.google_ads.v0.proto.services import media_file_service_pb2 as google_dot... | 1.875 | 2 |
docs/generate_example_images.py | KhaledSharif/kornia | 0 | 8661 | <reponame>KhaledSharif/kornia<gh_stars>0
import importlib
import math
import os
from pathlib import Path
from typing import Optional, Tuple
import cv2
import numpy as np
import requests
import torch
import kornia as K
def read_img_from_url(url: str, resize_to: Optional[Tuple[int, int]] = None) -> torch.Tensor:
... | 2.671875 | 3 |
forte/processors/data_augment/algorithms/embedding_similarity_replacement_op.py | Pushkar-Bhuse/forte | 0 | 8662 | <filename>forte/processors/data_augment/algorithms/embedding_similarity_replacement_op.py
# Copyright 2020 The Forte 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... | 2.1875 | 2 |
src/sentry/receivers/experiments.py | FelixSchwarz/sentry | 0 | 8663 | from __future__ import print_function, absolute_import
from sentry import analytics
from sentry.signals import join_request_created, join_request_link_viewed
@join_request_created.connect(weak=False)
def record_join_request_created(member, **kwargs):
analytics.record(
"join_request.created", member_id=me... | 2.078125 | 2 |
arturtamborskipl/urls.py | arturtamborski/arturtamborskipl | 1 | 8664 | from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import RedirectView
from django.views.generic import TemplateView
from django.contrib.sitemaps.views import sitemap
from django.conf import settings
from blog.sitemaps import ArticleSitemap
urlpatterns = [
url(r'^... | 1.804688 | 2 |
ion_functions/qc/qc_functions.py | steinermg/ion-functions | 10 | 8665 | #!/usr/bin/env python
"""
@package ion_functions.qc_functions
@file ion_functions/qc_functions.py
@author <NAME>
@brief Module containing QC functions ported from matlab samples in DPS documents
"""
from ion_functions.qc.qc_extensions import stuckvalues, spikevalues, gradientvalues, ntp_to_month
import time
import n... | 2.1875 | 2 |
datatest/__past__/api08.py | avshalomt2/datatest | 0 | 8666 | <reponame>avshalomt2/datatest<filename>datatest/__past__/api08.py
"""Backward compatibility for version 0.8 API."""
from __future__ import absolute_import
import inspect
import datatest
from datatest._compatibility import itertools
from datatest._compatibility.collections.abc import Sequence
from datatest._load.get_re... | 2.25 | 2 |
lib/reinteract/editor.py | jonkuhn/reinteract-jk | 1 | 8667 | # Copyright 2008 <NAME>
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import os
import gobject
import gtk
import pango
from ap... | 1.992188 | 2 |
python/scripts/compare_events.py | tvogels01/arthur-redshift-etl | 0 | 8668 | """
This script compares events from two ETLs to highlight differences in elapsed times or row counts.
* Pre-requisites
You need to have a list of events for each ETL. Arthur can provide this using the
"query_events" command.
For example:
```
arthur.py query_events -p development 37ACEC7440AB4620 -q > 37ACEC7440AB46... | 2.921875 | 3 |
harness/drifter.py | cmu-sei/augur-code | 0 | 8669 | # Augur: A Step Towards Realistic Drift Detection in Production MLSystems - Code
# Copyright 2022 Carnegie Mellon University.
#
# NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITH... | 1.164063 | 1 |
server/server-flask/app/docs/admin/survey/survey.py | DSM-DMS/Project-DMS-Web | 11 | 8670 | <gh_stars>10-100
SURVEY_POST = {
'tags': ['설문조사 관리'],
'description': '설문조사 등록',
'parameters': [
{
'name': 'Authorization',
'description': 'JWT Token',
'in': 'header',
'type': 'str',
'required': True
},
{
'name': ... | 1.640625 | 2 |
network/baselines_archive/resnet_3d101.py | xuyu0010/ARID_v1 | 5 | 8671 | <reponame>xuyu0010/ARID_v1
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
import logging
import os
try:
from . import initializer
from .utils import load_state
except:
import initializer
from utils import... | 2.171875 | 2 |
tests/ninety_nine_problems/test_miscellaneous_problems.py | gecBurton/inference_logic | 3 | 8672 | import pytest
from inference_logic import Rule, Variable, search
from inference_logic.data_structures import Assert, Assign
@pytest.mark.xfail
def test_90():
r"""
P90 (**) Eight queens problem
This is a classical problem in computer science. The objective is to
place eight queens on a chessboard so ... | 3.734375 | 4 |
airbus_cobot_gui/src/airbus_cobot_gui/diagnostics/diagnostics.py | ipa320/airbus_coop | 4 | 8673 | #!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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.929688 | 2 |
sanansaattaja/website/forms/comment_form.py | KEZKA/YL-WEB-PROJECT | 3 | 8674 | <gh_stars>1-10
from flask_wtf import FlaskForm
from wtforms import SubmitField, TextAreaField
from wtforms.validators import DataRequired
class CommentForm(FlaskForm):
text = TextAreaField("Text", validators=[DataRequired()])
submit = SubmitField('Publish')
| 2.421875 | 2 |
graphgallery/functional/dense/onehot.py | dongzizhu/GraphGallery | 1 | 8675 | <gh_stars>1-10
import numpy as np
from ..transform import DenseTransform
from ..decorators import multiple
from ..transform import Transform
__all__ = ['onehot', 'Onehot']
@Transform.register()
class Onehot(DenseTransform):
def __init__(self, depth=None):
super().__init__()
self.c... | 2.328125 | 2 |
models.py | Bileonaire/api-ridemyway | 0 | 8676 | """Handles data storage for Users, rides and requests
"""
# pylint: disable=E1101
import datetime
from flask import make_response, jsonify, current_app
from werkzeug.security import generate_password_hash
import psycopg2
import config
from databasesetup import db
class User():
"""Contains user columns and method... | 3.015625 | 3 |
lesson06/liqi/test.py | herrywen-nanj/51reboot | 0 | 8677 | <filename>lesson06/liqi/test.py<gh_stars>0
import configparser
'''
config = configparser.ConfigParser()
config.read('db.ini')
print(config.sections())
print(dict(config['mysqld'])['symbolic-links'])
'''
def ReadConfig(filename, section, key=None):
print(filename)
config = configparser.ConfigParser()
con... | 2.6875 | 3 |
core/forms.py | xUndero/noc | 1 | 8678 | # -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Forms wrapper
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ------------------------------------------------------------------... | 2.015625 | 2 |
ersteops/unit/views.py | Prescrypto/ErsteOps | 0 | 8679 | import json
from django.shortcuts import get_object_or_404
from django.core import serializers
from django.http import HttpResponse
from .models import Unit
from .utils import UNIT_LIST_FIELD
BAD_REQUEST = HttpResponse(json.dumps({'error': 'Bad Request'}), status=400, content_type='application/json')
def unit_json_li... | 2.234375 | 2 |
olamundo.py/exercicios_refeitos/ex029.py | gabrielviticov/exercicios-python | 0 | 8680 | '''
ex029: Escreva um programa que leia a velocidade de uma carro. Se ele ultrapassar 80 km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$ 7,00 por cada Km acima do limite.
'''
from colorise import set_color, reset_color
cor = {
'limpa':'\033[m',
'white':'\033[1;97m'
}
set_color(fg='... | 3.640625 | 4 |
fruit/mixin/drawable.py | felko/fruit | 4 | 8681 | #!/usr/bin/env python3.4
# coding: utf-8
class Drawable:
"""
Base class for drawable objects.
"""
def draw(self):
"""
Returns a Surface object.
"""
raise NotImplementedError(
"Method `draw` is not implemented for {}".format(type(self)))
| 2.921875 | 3 |
src/action/tests/test_logic.py | uts-cic/ontask_b | 3 | 8682 | <reponame>uts-cic/ontask_b
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
from django.conf import settings
from django.shortcuts import reverse
from django.core.management import call_command
import test
from dataops import pandas_db
from workflow.models import Workflow
c... | 2.140625 | 2 |
obniz/parts/Moving/StepperMotor/__init__.py | izm51/obniz-python-sdk | 11 | 8683 | from attrdict import AttrDefault
import asyncio
class StepperMotor:
def __init__(self):
self.keys = ['<KEY> 'common']
self.required_keys = ['a', 'b', 'aa', 'bb']
self._step_instructions = AttrDefault(bool,
{
'1': [[0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1,... | 2.453125 | 2 |
basic_assignment/39.py | 1212091/python-learning | 0 | 8684 | <reponame>1212091/python-learning
input_num = raw_input()
print(str(eval(input_num)))
| 3.609375 | 4 |
website/website/apps/entry/admin.py | SimonGreenhill/Language5 | 1 | 8685 | <filename>website/website/apps/entry/admin.py
from django.contrib import admin
from django.db.models import Count
from reversion.admin import VersionAdmin
from website.apps.lexicon.models import Lexicon
from website.apps.entry.models import Task, TaskLog, Wordlist, WordlistMember
from website.apps.core.admin import Tra... | 2.09375 | 2 |
src/modules/python.py | fest2bash/fest2bash | 0 | 8686 | <reponame>fest2bash/fest2bash<filename>src/modules/python.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import sys
sys.dont_write_bytecode = True
from pprint import pprint
from base import BaseFest2Bash
class Fest2Bash(BaseFest2Bash):
def __init__(self, manifest):
supe... | 2.125 | 2 |
opennem/utils/scrapyd.py | paulculmsee/opennem | 22 | 8687 | <reponame>paulculmsee/opennem
#!/usr/bin/env python
"""
Srapyd control methods
"""
import logging
from typing import Any, Dict, List
from urllib.parse import urljoin
from opennem.settings import settings
from opennem.utils.http import http
from opennem.utils.scrapy import get_spiders
logger = logging.getLogger("scra... | 2.265625 | 2 |
src/abaqus/Material/Elastic/Linear/Elastic.py | Haiiliin/PyAbaqus | 7 | 8688 | from abaqusConstants import *
from .FailStrain import FailStrain
from .FailStress import FailStress
class Elastic:
"""The Elastic object specifies elastic material properties.
Notes
-----
This object can be accessed by:
.. code-block:: python
import material
... | 2.78125 | 3 |
apps/pyscrabble/pyscrabble-hatchet/setup.py | UWSysLab/diamond | 19 | 8689 | <reponame>UWSysLab/diamond<filename>apps/pyscrabble/pyscrabble-hatchet/setup.py
# setup.py for pyscrabble
from distutils.core import setup
try:
import py2exe
HAS_PY2EXE = True
except ImportError:
HAS_PY2EXE = False
import glob
import os
import pkg_resources
import sys
from pyscrabble.constants im... | 1.960938 | 2 |
tutorials/W2D2_LinearSystems/solutions/W2D2_Tutorial1_Solution_437c0b24.py | liuxiaomiao123/NeuroMathAcademy | 2 | 8690 | def integrate_exponential(a, x0, dt, T):
"""Compute solution of the differential equation xdot=a*x with
initial condition x0 for a duration T. Use time step dt for numerical
solution.
Args:
a (scalar): parameter of xdot (xdot=a*x)
x0 (scalar): initial condition (x at time 0)
dt (scalar): timeste... | 4.0625 | 4 |
PyTemp/gis/shapefile_to_geojson.py | SwaggerKhan/PatrolGis | 0 | 8691 | <reponame>SwaggerKhan/PatrolGis
import json
import geojson
import geopandas as gpd
class SaveToGeoJSON:
__name_counter = 0
def file_name(self):
if self.__name_counter == 0:
self.__name_counter = 1
return "./out"+str(self.__name_counter)+".json"
elif self.__name_counter ... | 2.65625 | 3 |
ssbio/databases/pdbflex.py | JoshuaMeyers/ssbio | 76 | 8692 | import requests
import ssbio.utils
import os.path as op
# #### PDB stats
# Request flexibility data about one particular PDB.
#
# http://pdbflex.org/php/api/PDBStats.php?pdbID=1a50&chainID=A
#
# pdbID of structure you are interested in
# chainID of chain you are interested in
#
# [{"pdbID":"1a50",
# ... | 1.671875 | 2 |
api/insights/insights/infrastructure/mysql/read/modify_notes.py | manisharmagarg/qymatix | 0 | 8693 | <filename>api/insights/insights/infrastructure/mysql/read/modify_notes.py
"""
Modify Notes
"""
# pylint: disable=too-few-public-methods
from ...mysql.mysql_connection import MySqlConnection
from ...mysql.orm.autogen_entities import Task
class ModifyNotes(object):
"""
ModifyNotes responsible to update the rec... | 2.390625 | 2 |
desktop/core/ext-py/pyasn1-0.4.6/tests/type/test_namedval.py | yetsun/hue | 5,079 | 8694 | <filename>desktop/core/ext-py/pyasn1-0.4.6/tests/type/test_namedval.py<gh_stars>1000+
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
f... | 2.4375 | 2 |
setup.py | methane/pymemcache | 0 | 8695 | #!/usr/bin/env python
from setuptools import setup, find_packages
from pymemcache import __version__
setup(
name = 'pymemcache',
version = __version__,
author = '<NAME>',
author_email = '<EMAIL>',
packages = find_packages(),
tests_require = ['nose>=1.0'],
install_requires = ['six'],
d... | 1.226563 | 1 |
torch_geometric/read/ply.py | DL-85/pytorch_geometric | 2 | 8696 | import torch
from plyfile import PlyData
from torch_geometric.data import Data
def read_ply(path):
with open(path, 'rb') as f:
data = PlyData.read(f)
pos = ([torch.tensor(data['vertex'][axis]) for axis in ['x', 'y', 'z']])
pos = torch.stack(pos, dim=-1)
face = None
if 'face' in data:
... | 2.734375 | 3 |
ml-agents/mlagents/trainers/brain_conversion_utils.py | ranguera/ml-agents | 2 | 8697 | from mlagents.trainers.brain import BrainInfo, BrainParameters, CameraResolution
from mlagents.envs.base_env import BatchedStepResult, AgentGroupSpec
from mlagents.envs.exception import UnityEnvironmentException
import numpy as np
from typing import List
def step_result_to_brain_info(
step_result: BatchedStepResu... | 2.234375 | 2 |
mrdc_ws/src/mrdc_serial/setup.py | SoonerRobotics/MRDC22 | 0 | 8698 | <filename>mrdc_ws/src/mrdc_serial/setup.py
from setuptools import find_packages, setup
from glob import glob
import os
package_name = 'mrdc_serial'
setup(
name=package_name,
version='1.0.0',
packages=find_packages(),
data_files=[
('share/ament_index/resource_index/packages',
['resourc... | 1.59375 | 2 |
orders/views.py | DobromirZlatkov/anteya | 0 | 8699 | <filename>orders/views.py
from django.core.urlresolvers import reverse_lazy
from django.views import generic
from django.shortcuts import redirect, render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from . import forms
from . import models
from custommixins import mixins
... | 2.125 | 2 |