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 |
|---|---|---|---|---|---|---|
python/ray/train/__init__.py | jamesliu/ray | 33 | 1700 | <filename>python/ray/train/__init__.py
from ray.train.backend import BackendConfig
from ray.train.callbacks import TrainingCallback
from ray.train.checkpoint import CheckpointStrategy
from ray.train.session import (get_dataset_shard, local_rank, load_checkpoint,
report, save_checkpoint, w... | 1.945313 | 2 |
test/test_contact_in_group.py | anastas11a/python_training | 0 | 1701 | <gh_stars>0
from model.contact import Contact
from model.group import Group
import random
def test_add_contact_in_group(app, db):
app.open_home_page()
contact = db.get_contact_list()
if len(contact) == 0:
app.contact.create(Contact(firstname = "test firstname changed"))
group = db.get_group_lis... | 2.359375 | 2 |
byurak/accounts/admin.py | LikeLion-CAU-9th/Django-fancy-coder | 0 | 1702 | <reponame>LikeLion-CAU-9th/Django-fancy-coder
from django.contrib import admin
from accounts.models import User, Profile, UserFollow
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ['email', 'nickname']
list_display_links = ['email', 'nickname']
admin.site.register(Profile)
admin.... | 1.945313 | 2 |
viz_utils/eoa_viz.py | olmozavala/eoas-pyutils | 0 | 1703 | import os
from PIL import Image
import cv2
from os import listdir
from os.path import join
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.colors import LogNorm
from io_utils.io_common import create_folder
from viz_utils.constants import PlotMode, BackgroundType
import pylab
import numpy as np
import... | 2.109375 | 2 |
ade20kScripts/setup.py | fcendra/PSPnet18 | 1 | 1704 | from os import listdir
from os.path import isfile, join
from path import Path
import numpy as np
import cv2
# Dataset path
target_path = Path('target/')
annotation_images_path = Path('dataset/ade20k/annotations/training/').abspath()
dataset = [ f for f in listdir(annotation_images_path) if isfile(join(annotation_image... | 2.640625 | 3 |
src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/__init__.py | Mannan2812/azure-cli-extensions | 207 | 1705 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.09375 | 1 |
Core/managers/InputPeripherals.py | Scoppio/Rogue-EVE | 2 | 1706 | <reponame>Scoppio/Rogue-EVE
import logging
from models.GenericObjects import Vector2
logger = logging.getLogger('Rogue-EVE')
class MouseController(object):
"""
Mouse controller needs the map, get over it
"""
def __init__(self, map=None, object_pool=None):
self.mouse_coord = (0, 0)
sel... | 2.828125 | 3 |
the_unsync/thesync.py | vromanuk/async_techniques | 0 | 1707 | <gh_stars>0
from unsync import unsync
import asyncio
import datetime
import math
import aiohttp
import requests
def main():
t0 = datetime.datetime.now()
tasks = [
compute_some(),
compute_some(),
compute_some(),
download_some(),
download_some(),
download_some(),
... | 2.78125 | 3 |
sdk/python/pulumi_azure/desktopvirtualization/workspace.py | henriktao/pulumi-azure | 109 | 1708 | <filename>sdk/python/pulumi_azure/desktopvirtualization/workspace.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing im... | 1.984375 | 2 |
jupyanno/sheets.py | betatim/jupyanno | 23 | 1709 | <reponame>betatim/jupyanno
"""Code for reading and writing results to google sheets"""
from bs4 import BeautifulSoup
import requests
import warnings
import json
import pandas as pd
from six.moves.urllib.parse import urlparse, parse_qs
from six.moves.urllib.request import urlopen
_CELLSET_ID = "AIzaSyC8Zo-9EbXgHfqNzDxV... | 3.125 | 3 |
sorting/python/max_heap.py | zhou7rui/algorithm | 6 | 1710 | # -*- coding: utf-8 -*
'''
最大堆实现
98
/ \
96 84
/ \ / \
92 82 78 47
/ \ / \ / \ / \
... | 3.140625 | 3 |
ink2canvas/svg/Use.py | greipfrut/pdftohtml5canvas | 4 | 1711 | from ink2canvas.svg.AbstractShape import AbstractShape
class Use(AbstractShape):
def drawClone(self):
drawables = self.rootTree.getDrawable()
OriginName = self.getCloneId()
OriginObject = self.rootTree.searchElementById(OriginName,drawables)
OriginObject.runDraw()
de... | 2.8125 | 3 |
docs/source/tutorial/code/read_csv.py | HanSooLim/DIL-Project | 2 | 1712 | <filename>docs/source/tutorial/code/read_csv.py
import pandas
datas = pandas.read_csv("../../Sample/example_dataset.csv", index_col=0)
print(datas)
| 3.140625 | 3 |
app.py | rghose/lol3 | 0 | 1713 | <filename>app.py<gh_stars>0
from flask import *
app = Flask(__name__)
import botty
# ----------------------------------
@app.route("/", methods=['GET', 'POST'])
def hello():
if request.method == 'POST':
data = request.form["query"]
return render_template("index.html",data=data)
return ren... | 2.59375 | 3 |
config.py | metarom-quality/gooseberry | 0 | 1714 | <filename>config.py<gh_stars>0
#!/usr/bin/env python3
import os
DATABASE="/home/tomate/Warehouse/syte/meta.db"
XLSDIR = "/mnt/c/Users/Natacha/Documents/TempDocs/progen/Formula/"
temp = [i for i in next(os.walk(XLSDIR))[2] if i.endswith("xlsx") or i.endswith("xls")]
flist = {}
for i in temp:
name = i.split(" ")[... | 2.28125 | 2 |
setup.py | markostrajkov/range-requests-proxy | 1 | 1715 | <gh_stars>1-10
#!/usr/bin/env python
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
... | 1.992188 | 2 |
tests/pytorch_pfn_extras_tests/onnx/test_load_model.py | kmaehashi/pytorch-pfn-extras | 243 | 1716 | <reponame>kmaehashi/pytorch-pfn-extras<gh_stars>100-1000
import os
import pytest
import torch
import pytorch_pfn_extras.onnx as tou
from tests.pytorch_pfn_extras_tests.onnx.test_export_testcase import Net
@pytest.mark.filterwarnings("ignore:Named tensors .* experimental:UserWarning")
def test_onnx_load_model():
... | 1.992188 | 2 |
validate/v1/base.py | huzidabanzhang/Python | 4 | 1717 | <reponame>huzidabanzhang/Python<gh_stars>1-10
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
'''
@Description: 数据库验证器
@Author: Zpp
@Date: 2020-05-28 13:44:29
@LastEditors: Zpp
@LastEditTime: 2020-05-28 14:02:02
'''
params = {
# 验证字段
'fields': {
'type': {
'name': '导出类型',
'type': 'i... | 1.679688 | 2 |
example/speech_recognition/stt_layer_slice.py | axbaretto/mxnet | 92 | 1718 | import mxnet as mx
def slice_symbol_to_seq_symobls(net, seq_len, axis=1, squeeze_axis=True):
net = mx.sym.SliceChannel(data=net, num_outputs=seq_len, axis=axis, squeeze_axis=squeeze_axis)
hidden_all = []
for seq_index in range(seq_len):
hidden_all.append(net[seq_index])
net = hidden_all
re... | 2.359375 | 2 |
api/auth.py | fergalmoran/dss.api | 0 | 1719 | import datetime
import json
from calendar import timegm
from urllib.parse import parse_qsl
import requests
from allauth.socialaccount import models as aamodels
from requests_oauthlib import OAuth1
from rest_framework import parsers, renderers
from rest_framework import status
from rest_framework.authtoken.models impor... | 2.25 | 2 |
bcgs/disqus_objects.py | aeturnum/bcgs | 0 | 1720 | import requests
import aiohttp
from constants import API_KEY
class User(object):
def __init__(self, author_info):
# "author": {
# "about": "",
# "avatar": {
# "cache": "//a.disquscdn.com/1519942534/images/noavatar92.png",
# ... | 2.453125 | 2 |
nvdbgeotricks.py | LtGlahn/estimat_gulstripe | 0 | 1721 | <gh_stars>0
"""
En samling hjelpefunksjoner som bruker nvdbapiv3-funksjonene til å gjøre nyttige ting, f.eks. lagre geografiske datasett
Disse hjelpefunksjonene forutsetter fungerende installasjon av geopandas, shapely og en del andre ting som må
installeres separat. Noen av disse bibliotekene kunne historisk av og t... | 2.25 | 2 |
019_CountingSundays.py | joetache4/project-euler | 0 | 1722 | """
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twen... | 4 | 4 |
setup.py | aagaard/dbservice | 1 | 1723 | <filename>setup.py
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Setup for the dbservice
"""
from setuptools import setup, find_packages
setup(
name='dbservice',
version='0.9',
description="Database service for storing meter data",
author="<NAME>",
author_email='<EMAIL>',
url='https://... | 1.289063 | 1 |
venv/lib/python3.6/site-packages/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/facts.py | usegalaxy-no/usegalaxy | 1 | 1724 | #
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The arg spec for the junos facts module.
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class FactsArgs(object):
""" The... | 1.96875 | 2 |
server/dbcls/api/resources/authenticate.py | ripry/umakaviewer | 2 | 1725 | from flask_restful import Resource, reqparse
from firebase_admin import auth as firebase_auth
from dbcls.models import User
parser = reqparse.RequestParser()
parser.add_argument('token', type=str, required=True, nullable=False)
class Authenticate(Resource):
def post(self):
try:
args = parse... | 2.671875 | 3 |
GetJSONData_NLPParser.py | Feiyi-Ding/2021A | 0 | 1726 | <reponame>Feiyi-Ding/2021A
#Import required modules
import requests
import json
# Get json results for the required input
InputString = "kobe is a basketball player"
headers = {
'Content-type': 'application/json',
}
data = '{"text":InputString = '+ InputString + '}'
response = requests.post('htt... | 3.171875 | 3 |
language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py | Xtuden-com/language | 1,199 | 1727 | <filename>language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py<gh_stars>1000+
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain... | 2.40625 | 2 |
example_bots/any_to_any/__init__.py | budacom/trading-bots | 21 | 1728 | default_bot = 'example_bots.any_to_any.bot.AnyToAny'
| 1.179688 | 1 |
helpers.py | owenjones/CaBot | 3 | 1729 | from server import roles
def hasRole(member, roleID):
role = member.guild.get_role(roleID)
return role in member.roles
def gainedRole(before, after, roleID):
role = before.guild.get_role(roleID)
return (role not in before.roles) and (role in after.roles)
def isExplorer(ctx):
return hasRole(ctx... | 2.671875 | 3 |
databuilder/loader/file_system_neo4j_csv_loader.py | davcamer/amundsendatabuilder | 0 | 1730 | import csv
import logging
import os
import shutil
from csv import DictWriter # noqa: F401
from pyhocon import ConfigTree, ConfigFactory # noqa: F401
from typing import Dict, Any # noqa: F401
from databuilder.job.base_job import Job
from databuilder.loader.base_loader import Loader
from databuilder.models.neo4j_csv... | 2.3125 | 2 |
sample_program_04_02_knn.py | pepsinal/python_doe_kspub | 16 | 1731 | # -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import pandas as pd
from sklearn.neighbors import NearestNeighbors # k-NN
k_in_knn = 5 # k-NN における k
rate_of_training_samples_inside_ad = 0.96 # AD 内となるトレーニングデータの割合。AD のしきい値を決めるときに使用
dataset = pd.read_csv('resin.csv', index_col=0, header=0)
x_prediction ... | 3.09375 | 3 |
topology.py | destinysky/nsh_sfc | 2 | 1732 | #!/usr/bin/python
"""
"""
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSKernelSwitch,UserSwitch
#OVSLegacyKernelSwitch, UserSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.link import Link, TCLink
#conf_port=50000
conf_ip_1='10.0.0.254'... | 2.390625 | 2 |
lampara/lamp.py | gventuraagramonte/python | 0 | 1733 | <gh_stars>0
#Definicion de la clase
#antes de empezar una clase se declara de la siguiente manera
class Lamp:
_LAMPS = ['''
.
. | ,
\ ' /
` ,-. '
--- ( ) ---
\ /
_|=|_
|_____|
''',
'''
,-.
( )
\ /
_|=|_... | 3.609375 | 4 |
lib/galaxy/model/migrate/versions/0084_add_ldda_id_to_implicit_conversion_table.py | sneumann/galaxy | 1 | 1734 | """
Migration script to add 'ldda_id' column to the implicitly_converted_dataset_association table.
"""
from __future__ import print_function
import logging
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData
)
from galaxy.model.migrate.versions.util import (
add_column,
drop_colum... | 2.1875 | 2 |
ds.py | tobiichiorigami1/csp | 0 | 1735 | <gh_stars>0
votes_t_shape = [3, 0, 1, 2]
for i in range(6 - 4):
votes_t_shape += [i + 4]
print(votes_t_shape)
| 2.640625 | 3 |
scripts/adam/cc100_baselines.py | TimDettmers/sched | 1 | 1736 | <reponame>TimDettmers/sched<filename>scripts/adam/cc100_baselines.py
import numpy as np
import itertools
import gpuscheduler
import argparse
import os
import uuid
import hashlib
import glob
import math
from itertools import product
from torch.optim.lr_scheduler import OneCycleLR
from os.path import join
parser = argp... | 1.882813 | 2 |
boa3_test/test_sc/event_test/EventNep5Transfer.py | hal0x2328/neo3-boa | 25 | 1737 | <filename>boa3_test/test_sc/event_test/EventNep5Transfer.py
from boa3.builtin import public
from boa3.builtin.contract import Nep5TransferEvent
transfer = Nep5TransferEvent
@public
def Main(from_addr: bytes, to_addr: bytes, amount: int):
transfer(from_addr, to_addr, amount)
| 1.460938 | 1 |
abtest/views.py | SchuylerGoodman/topicalguide | 0 | 1738 | # The Topical Guide
# Copyright 2010-2011 Brigham Young University
#
# This file is part of the Topical Guide <http://nlp.cs.byu.edu/topic_browser>.
#
# The Topical Guide is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Soft... | 2.265625 | 2 |
neurodocker/reprozip/tests/test_merge.py | sulantha2006/neurodocker | 0 | 1739 | """Tests for merge.py."""
from __future__ import absolute_import, division, print_function
from glob import glob
import os
import tarfile
import tempfile
from neurodocker.docker import client
from neurodocker.reprozip.trace import ReproZipMinimizer
from neurodocker.reprozip.merge import merge_pack_files
def _creat... | 2.03125 | 2 |
build/step-3-kivy-almost-manylinux/scripts/redirect_html5.py | dolang/build-kivy-linux | 0 | 1740 | """
HTML5 contexts.
:author: <NAME>
:license: MIT
"""
import contextlib
import io
import sys
__all__ = ['create_document', 'tag', 'as_link']
class create_document(contextlib.redirect_stdout):
"""Redirect output to an HTML5 document specified by new_target.
A HTML document title can ... | 3.09375 | 3 |
lab/hw03-part-i_nov14.py | jzacsh/neuralnets-cmp464 | 1 | 1741 | <reponame>jzacsh/neuralnets-cmp464<gh_stars>1-10
"""
<NAME> solution to homework #3, Nov 14., Part I
"""
# Per homework instructions, following lead from matlab example by professor:
# http://comet.lehman.cuny.edu/schneider/Fall17/CMP464/Maple/PartialDerivatives1.pdf
import sys
import tensorflow as tf
import tempfile... | 2.359375 | 2 |
modules/experiments_bc/set_tp.py | GChrysostomou/tasc | 2 | 1742 | import torch
import torch.nn as nn
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.metrics import *
from sklearn.metrics import precision_recall_fscore_support as prfs
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
d... | 2.453125 | 2 |
helios/tasks.py | mattmurch/helios-server | 0 | 1743 | <filename>helios/tasks.py
"""
Celery queued tasks for Helios
2010-08-01
<EMAIL>
"""
import copy
from celery import shared_task
from celery.utils.log import get_logger
import signals
from models import CastVote, Election, Voter, VoterFile
from view_utils import render_template_raw
@shared_task
def cast_vote_verify_a... | 2.234375 | 2 |
tests/conftest.py | AlanRosenthal/virtual-dealer | 1 | 1744 | <reponame>AlanRosenthal/virtual-dealer<gh_stars>1-10
"""
pytest fixtures
"""
import unittest.mock as mock
import pytest
import virtual_dealer.api
@pytest.fixture(name="client")
def fixture_client():
"""
Client test fixture for testing flask APIs
"""
return virtual_dealer.api.app.test_client()
@pytes... | 2.421875 | 2 |
corehq/apps/fixtures/tests.py | dslowikowski/commcare-hq | 1 | 1745 | from xml.etree import ElementTree
from casexml.apps.case.tests.util import check_xml_line_by_line
from casexml.apps.case.xml import V2
from corehq.apps.fixtures import fixturegenerators
from corehq.apps.fixtures.models import FixtureDataItem, FixtureDataType, FixtureOwnership, FixtureTypeField, \
FixtureItemField, ... | 1.953125 | 2 |
readthedocs/search/signals.py | agarwalrounak/readthedocs.org | 10 | 1746 | # -*- coding: utf-8 -*-
"""We define custom Django signals to trigger before executing searches."""
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django_elasticsearch_dsl.apps import DEDConfig
from readthedocs.projects.models import HTMLFile, Project
from readthe... | 2.078125 | 2 |
src/falconpy/_endpoint/_filevantage.py | kra-ts/falconpy | 0 | 1747 | <reponame>kra-ts/falconpy
"""Internal API endpoint constant library.
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |... | 1.125 | 1 |
TimeWrapper_JE/venv/Lib/site-packages/pip/_internal/cli/progress_bars.py | JE-Chen/je_old_repo | 0 | 1748 | import itertools
import sys
from signal import SIGINT, default_int_handler, signal
from typing import Any, Dict, List
from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
from pip._vendor.progress.spinner import Spinner
from pip._internal.utils.compat import WINDOWS
from pip._internal.... | 2.09375 | 2 |
scripts/study_case/ID_5/matchzoo/auto/tuner/tune.py | kzbnb/numerical_bugs | 8 | 1749 | import typing
import numpy as np
import scripts.study_case.ID_5.matchzoo as mz
from scripts.study_case.ID_5.matchzoo.engine.base_metric import BaseMetric
from .tuner import Tuner
def tune(
params: 'mz.ParamTable',
optimizer: str = 'adam',
trainloader: mz.dataloader.DataLoader = None,
validloader: mz... | 2.765625 | 3 |
libs/gym/tests/wrappers/test_pixel_observation.py | maxgold/icml22 | 0 | 1750 | <reponame>maxgold/icml22
"""Tests for the pixel observation wrapper."""
from typing import Optional
import pytest
import numpy as np
import gym
from gym import spaces
from gym.wrappers.pixel_observation import PixelObservationWrapper, STATE_KEY
class FakeEnvironment(gym.Env):
def __init__(self):
self.ac... | 2.21875 | 2 |
real_plot_fft_stft_impl.py | MuAuan/Scipy-Swan | 0 | 1751 | <reponame>MuAuan/Scipy-Swan<filename>real_plot_fft_stft_impl.py<gh_stars>0
import pyaudio
import wave
from scipy.fftpack import fft, ifft
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import signal
from swan import pycwt
CHUNK = 1024
FORMAT = pyaudio.paInt16 # int16型
CHANNELS = 1 ... | 2.3125 | 2 |
tests/pydecompile-test/baselines/events_in_code_blocks.py | gengxf0505/pxt | 1 | 1752 | #/ <reference path="./testBlocks/mb.ts" />
def function_0():
basic.showNumber(7)
basic.forever(function_0) | 1.3125 | 1 |
PID/PDControl.py | l756302098/ros_practice | 0 | 1753 | <filename>PID/PDControl.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import random
import numpy as np
import matplotlib.pyplot as plt
class Robot(object):
def __init__(self, length=20.0):
"""
Creates robotand initializes location/orientation to 0, 0, 0.
"""
self.x = 0.0
self.y ... | 3.328125 | 3 |
torchvision/datasets/samplers/__init__.py | yoshitomo-matsubara/vision | 12,063 | 1754 | <gh_stars>1000+
from .clip_sampler import DistributedSampler, UniformClipSampler, RandomClipSampler
__all__ = ("DistributedSampler", "UniformClipSampler", "RandomClipSampler")
| 1.140625 | 1 |
Pyshare2019/02 - if + Nesteed if/Nesteed-IF.py | suhaili99/python-share | 4 | 1755 | name = input("masukkan nama pembeli = ")
alamat= input("Alamat = ")
NoTelp = input("No Telp = ")
print("\n")
print("=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============")
print("Pilih Jenis Mobil :")
print("\t 1.Daihatsu ")
print("\t 2.Honda ")
print("\t 3.Toyota ")
print("")
pilihan = int(input("Pil... | 3.875 | 4 |
oneflow/python/test/ops/test_l1loss.py | wanghongsheng01/framework_enflame | 2 | 1756 | <gh_stars>1-10
"""
Copyright 2020 The OneFlow 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.org/licenses/LICENSE-2.0
Unless required by applic... | 2.21875 | 2 |
tests/test_schema.py | Dog-Egg/dida | 0 | 1757 | import unittest
import datetime
from dida import schemas, triggers
from marshmallow import ValidationError
class TestTriggerSchema(unittest.TestCase):
def test_dump_trigger(self):
result = schemas.TriggerSchema().dump(triggers.IntervalTrigger())
print('IntervalTrigger dump:', result)
res... | 2.625 | 3 |
apps/content/views.py | Sunbird-Ed/evolve-api | 1 | 1758 | <filename>apps/content/views.py
from django.shortcuts import render
from rest_framework import status
from rest_framework.generics import (
ListAPIView,
ListCreateAPIView,
ListAPIView,
RetrieveUpdateAPIView,)
from rest_framework.response import Response
from rest_framework.permissions import IsAuthentic... | 1.578125 | 2 |
examples/given_data.py | GuoJingyao/cornac | 0 | 1759 | # -*- coding: utf-8 -*-
"""
Example to train and evaluate a model with given data
@author: <NAME> <<EMAIL>>
"""
from cornac.data import Reader
from cornac.eval_methods import BaseMethod
from cornac.models import MF
from cornac.metrics import MAE, RMSE
from cornac.utils import cache
# Download MovieLens 100K provide... | 3.28125 | 3 |
taming/data/ade20k.py | ZlodeiBaal/taming | 0 | 1760 | import os
import numpy as np
import cv2
import albumentations
from PIL import Image
from torch.utils.data import Dataset
from taming.data.sflckr import SegmentationBase # for examples included in repo
class Examples(SegmentationBase):
def __init__(self, size=256, random_crop=False, interpolation="bicubic"):
... | 2.40625 | 2 |
templates/federated_reporting/distributed_cleanup.py | olehermanse/masterfiles | 44 | 1761 | #!/usr/bin/env python3
"""
fr_distributed_cleanup.py - a script to remove hosts which have migrated to
other feeder hubs. To be run on Federated Reporting superhub
after each import of feeder data.
First, to setup, enable fr_distributed_cleanup by setting a class in augments (def.json).
This enables policy in cfe_inte... | 2.0625 | 2 |
Python/Fibonacci.py | kennethsequeira/Hello-world | 1 | 1762 | #Doesn't work.
import time
fibonacci = [1, 1]
n = int(input())
while len(fibonacci) < n:
fibonacci.append(fibonacci[-1] + fibonacci[-2])
for i in range(n):
print(fibonacci[i], end=' ')
| 3.75 | 4 |
setup.py | kreyoo/csgo-inv-shuffle | 0 | 1763 | <reponame>kreyoo/csgo-inv-shuffle
from setuptools import setup
setup(name="csgoinvshuffle")
| 1.125 | 1 |
py/_log/log.py | EnjoyLifeFund/py36pkgs | 2 | 1764 | <filename>py/_log/log.py
"""
basic logging functionality based on a producer/consumer scheme.
XXX implement this API: (maybe put it into slogger.py?)
log = Logger(
info=py.log.STDOUT,
debug=py.log.STDOUT,
command=None)
log.info("hell... | 2.953125 | 3 |
test/test_all_contacts.py | Sergggio/python_training | 0 | 1765 | import re
from model.contact import Contact
def test_all_contacts(app, db):
contacts_from_db = db.get_contact_list()
phone_list_from_db = db.phones_from_db()
#email_liset_from_db = db.emails_from_db()
phone_list = []
for phone in phone_list_from_db:
phone_list.append(merge_phones_like_on_h... | 2.625 | 3 |
samples/abp/test_graphics.py | jproudlo/PyModel | 61 | 1766 | <gh_stars>10-100
"""
ABP analyzer and graphics tests
"""
cases = [
('Run Pymodel Graphics to generate dot file from FSM model, no need use pma',
'pmg ABP'),
('Generate SVG file from dot',
'dotsvg ABP'),
# Now display ABP.dot in browser
('Run PyModel Analyzer to generate FSM from original F... | 2.046875 | 2 |
games/migrations/0002_auto_20201026_1221.py | IceArrow256/game-list | 3 | 1767 | <filename>games/migrations/0002_auto_20201026_1221.py
# Generated by Django 3.1.2 on 2020-10-26 12:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('games', '0001_initial'),
]
operations = [
migrations.... | 1.570313 | 2 |
build/lib.linux-x86_64-2.7_ucs4/mx/Misc/PackageTools.py | mkubux/egenix-mx-base | 0 | 1768 | """ PackageTools - A set of tools to aid working with packages.
Copyright (c) 1998-2000, <NAME>; mailto:<EMAIL>
Copyright (c) 2000-2015, eGenix.com Software GmbH; mailto:<EMAIL>
See the documentation for further information on copyrights,
or contact the author. All Rights Reserved.
"""
__version__ = '0... | 2.25 | 2 |
Lib/test/test_urllib.py | Kshitijkrishnadas/haribol | 4 | 1769 | <filename>Lib/test/test_urllib.py
"""Regression tests for what was in Python 2's "urllib" module"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
exce... | 2.84375 | 3 |
gapipy/resources/tour/transport.py | wmak/gapipy | 0 | 1770 | # Python 2 and 3
from __future__ import unicode_literals
from ...models import Address, SeasonalPriceBand
from ..base import Product
class Transport(Product):
_resource_name = 'transports'
_is_listable = False
_as_is_fields = [
'id', 'href', 'availability', 'name', 'product_line', 'sku', 'type... | 1.84375 | 2 |
modules/dare.py | VeNoM-hubs/nyx | 0 | 1771 | from discord.ext import commands
import json
import random
with open("assets/json/questions.json") as data:
data = json.load(data)
dares = data["dares"]
class Dare(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(aliases=["d"])
async def dare(self, ctx):... | 2.75 | 3 |
scripts/apic.py | nicmatth/APIC-EM-HelloWorldv3 | 0 | 1772 | <filename>scripts/apic.py
APIC_IP="sandboxapic.cisco.com"
APIC_PORT="443"
GROUP='group-xx'
| 1.3125 | 1 |
stella/test/external_func.py | squisher/stella | 11 | 1773 | <reponame>squisher/stella
# Copyright 2013-2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2.421875 | 2 |
szh_objects.py | ipqhjjybj/bitcoin_trend_strategy | 4 | 1774 | <gh_stars>1-10
# encoding: utf-8
import sys
from market_maker import OrderManager
from settings import *
import os
from pymongo import MongoClient, ASCENDING
from pymongo.errors import ConnectionFailure
from datetime import datetime , timedelta
import numpy as np
#################################################... | 2.03125 | 2 |
CodeAnalysis/SourceMeter_Interface/SourceMeter-8.2.0-x64-linux/Python/Tools/python/pylint/pyreverse/writer.py | ishtjot/susereumutep | 14,668 | 1775 | # -*- coding: utf-8 -*-
# Copyright (c) 2008-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:<EMAIL>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of t... | 1.96875 | 2 |
graphql-ml-serving/backend/mutations.py | philippe-heitzmann/python-apps | 13 | 1776 | import logging
from ariadne import MutationType, convert_kwargs_to_snake_case
from config import clients, messages, queue
mutation = MutationType()
@mutation.field("createMessage")
@convert_kwargs_to_snake_case
async def resolve_create_message(obj, info, content, client_id):
try:
message = {"content": co... | 2.171875 | 2 |
hc/api/transports.py | MaxwellDPS/healthchecks | 1 | 1777 | <reponame>MaxwellDPS/healthchecks
import os
from django.conf import settings
from django.template.loader import render_to_string
from django.utils import timezone
import json
import requests
from urllib.parse import quote, urlencode
from hc.accounts.models import Profile
from hc.lib import emails
from hc.lib.string i... | 2.046875 | 2 |
graviti/portex/builder.py | Graviti-AI/graviti-python-sdk | 12 | 1778 | <gh_stars>10-100
#!/usr/bin/env python3
#
# Copyright 2022 Graviti. Licensed under MIT License.
#
"""Portex type builder related classes."""
from hashlib import md5
from pathlib import Path
from shutil import rmtree
from subprocess import PIPE, CalledProcessError, run
from tempfile import gettempdir
from typing impor... | 2.125 | 2 |
dffml/operation/mapping.py | SGeetansh/dffml | 171 | 1779 | from typing import Dict, List, Any
from ..df.types import Definition
from ..df.base import op
from ..util.data import traverse_get
MAPPING = Definition(name="mapping", primitive="map")
MAPPING_TRAVERSE = Definition(name="mapping_traverse", primitive="List[str]")
MAPPING_KEY = Definition(name="key", primitive="str")
M... | 2.71875 | 3 |
anchore_engine/services/policy_engine/__init__.py | Vijay-P/anchore-engine | 0 | 1780 | import time
import sys
import pkg_resources
import os
import retrying
from sqlalchemy.exc import IntegrityError
# anchore modules
import anchore_engine.clients.services.common
import anchore_engine.subsys.servicestatus
import anchore_engine.subsys.metrics
from anchore_engine.subsys import logger
from anchore_engine.c... | 1.984375 | 2 |
juriscraper/oral_args/united_states/federal_appellate/scotus.py | EvandoBlanco/juriscraper | 228 | 1781 | <reponame>EvandoBlanco/juriscraper<filename>juriscraper/oral_args/united_states/federal_appellate/scotus.py<gh_stars>100-1000
"""Scraper for Supreme Court of U.S.
CourtID: scotus
Court Short Name: scotus
History:
- 2014-07-20 - Created by <NAME>, reviewed by MLR
- 2017-10-09 - Updated by MLR.
"""
from datetime impor... | 2.390625 | 2 |
code/main.py | pengzhansun/CF-CAR | 8 | 1782 | # -*- coding: utf-8 -*-
import argparse
import os
import shutil
import time
import numpy as np
import random
from collections import OrderedDict
import torch
import torch.backends.cudnn as cudnn
from callbacks import AverageMeter
from data_utils.causal_data_loader_frames import VideoFolder
from utils impo... | 1.96875 | 2 |
api/application/__init__.py | 114000/webapp-boilerplate | 0 | 1783 | # encoding: utf-8
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
import logging
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
app.config.from_object('config.current')
db = SQLAlchemy(app)
logger = logging.getLogger(__name__)
log... | 1.90625 | 2 |
Betsy/Betsy/modules/get_illumina_control.py | jefftc/changlab | 9 | 1784 | from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
import os
import shutil
from genomicode import filelib
... | 2.265625 | 2 |
src/backup/template/PositionalArgumentTemplate.py | ytyaru0/Python.TemplateFileMaker.20180314204216 | 0 | 1785 | <gh_stars>0
from string import Template
import re
class PositionalArgumentTemplate(Template):
# (?i): 大文字小文字を区別しないモードを開始する
# (?-i): 大文字小文字を区別しないモードを無効にする
idpattern_default = Template.idpattern # (?-i:[_a-zA-Z][_a-zA-Z0-9]*)
idpattern = '([0-9]+)'
def find_place_holders(self, template:str):
... | 2.796875 | 3 |
cla-backend/cla/tests/unit/test_company.py | kdhaigud/easycla | 0 | 1786 | <filename>cla-backend/cla/tests/unit/test_company.py<gh_stars>0
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT
import json
import os
import requests
import uuid
import hug
import pytest
from falcon import HTTP_200, HTTP_409
import cla
from cla import routes
... | 2.203125 | 2 |
py/WatchDialog.py | mathematicalmichael/SpringNodes | 51 | 1787 | <gh_stars>10-100
# Copyright(c) 2017, <NAME>
# @5devene, <EMAIL>
# www.badmonkeys.net
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Drawing import Point, Color, Font
from System.Windows.Forms import *
from cStringIO import StringIO
str_file = StringIO()
size1 = [3... | 2.40625 | 2 |
292-nim-game.py | mvj3/leetcode | 0 | 1788 | """
Question:
Nim Game My Submissions Question
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones.
Bot... | 3.734375 | 4 |
script_tests/maf_extract_ranges_indexed_tests.py | lldelisle/bx-python | 122 | 1789 | import unittest
import base
class Test(base.BaseScriptTest, unittest.TestCase):
command_line = "./scripts/maf_extract_ranges_indexed.py ./test_data/maf_tests/mm8_chr7_tiny.maf -c -m 5 -p mm8."
input_stdin = base.TestFile(filename="./test_data/maf_tests/dcking_ghp074.bed")
output_stdout = base.TestFile(fi... | 2.078125 | 2 |
qstklearn/1knn.py | elxavicio/QSTK | 339 | 1790 | <filename>qstklearn/1knn.py<gh_stars>100-1000
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Feb 20, 2011
@author: <NAME>
@organization: Georgia I... | 2.625 | 3 |
pyscf/nao/m_comp_coulomb_pack.py | robert-anderson/pyscf | 2 | 1791 | <filename>pyscf/nao/m_comp_coulomb_pack.py<gh_stars>1-10
# Copyright 2014-2018 The PySCF Developers. 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.ap... | 1.890625 | 2 |
nova/tests/unit/test_service_auth.py | panguan737/nova | 0 | 1792 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 1.789063 | 2 |
classification/model/build_gen.py | LittleWat/MCD_DA | 464 | 1793 | import svhn2mnist
import usps
import syn2gtrsb
import syndig2svhn
def Generator(source, target, pixelda=False):
if source == 'usps' or target == 'usps':
return usps.Feature()
elif source == 'svhn':
return svhn2mnist.Feature()
elif source == 'synth':
return syn2gtrsb.Feature()
def ... | 2.59375 | 3 |
deep_table/nn/models/loss/info_nce_loss.py | pfnet-research/deep-table | 48 | 1794 | <reponame>pfnet-research/deep-table<filename>deep_table/nn/models/loss/info_nce_loss.py
import torch
from torch import Tensor
from torch.nn.modules.loss import _Loss
class InfoNCELoss(_Loss):
"""Info NCE Loss. A type of contrastive loss function used for self-supervised learning.
References:
<NAME>, ... | 2.625 | 3 |
patroni/config.py | korkin25/patroni | 0 | 1795 | import json
import logging
import os
import shutil
import tempfile
import yaml
from collections import defaultdict
from copy import deepcopy
from patroni import PATRONI_ENV_PREFIX
from patroni.exceptions import ConfigParseError
from patroni.dcs import ClusterConfig
from patroni.postgresql.config import CaseInsensitive... | 2.25 | 2 |
src/Products/CMFCore/tests/test_DirectoryView.py | fdiary/Products.CMFCore | 3 | 1796 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | 1.914063 | 2 |
pycycle/elements/flight_conditions.py | eshendricks/pyCycle | 0 | 1797 | import openmdao.api as om
from pycycle.thermo.cea import species_data
from pycycle.constants import AIR_ELEMENTS
from pycycle.elements.ambient import Ambient
from pycycle.elements.flow_start import FlowStart
class FlightConditions(om.Group):
"""Determines total and static flow properties given an altitude and Ma... | 2.328125 | 2 |
server/cauth/views.py | mashaka/TravelHelper | 0 | 1798 | <reponame>mashaka/TravelHelper
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AdminPasswordChangeForm, PasswordChangeForm, UserCreationForm
from django.contrib.auth import update_session_auth_hash, login, authenticate
from django.cont... | 2.046875 | 2 |
samples/modules/tensorflow/magic_wand/train/data_split_person.py | lviala-zaack/zephyr | 6,224 | 1799 | # Lint as: python3
# coding=utf-8
# Copyright 2019 The TensorFlow 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.org/licenses/LICE... | 2.875 | 3 |