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 |
|---|---|---|---|---|---|---|
1094 EXPERIENCIAS.py | castrolimoeiro/Uri-exercise | 0 | 4100 | n = int(input())
coelho = rato = sapo = contador = 0
for i in range(0, n):
q, t = input().split(' ')
t = t.upper()
q = int(q)
if 1 <= q <= 15:
contador += q
if t == 'C':
coelho += q
elif t == 'R':
rato += q
elif t == 'S':
sapo += q
po... | 3.390625 | 3 |
gravur/common/amountinput.py | F483/gravur | 3 | 4101 | <gh_stars>1-10
# coding: utf-8
# Copyright (c) 2015 <NAME> <<EMAIL>>
# License: MIT (see LICENSE file)
from kivy.uix.boxlayout import BoxLayout
from gravur.common.labelbox import LabelBox # NOQA
from gravur.utils import load_widget
@load_widget
class AmountInput(BoxLayout):
pass
| 1.382813 | 1 |
tibanna/top.py | 4dn-dcic/tibanna | 62 | 4102 | <filename>tibanna/top.py<gh_stars>10-100
import datetime
class Top(object):
"""class TopSeries stores the information of a series of top commands
::
echo -n 'Timestamp: '; date +%F-%H:%M:%S
top -b -n1 [-i] [-c]
over short intervals to monitor the same set of processes over time.
An... | 2.84375 | 3 |
venv/Lib/site-packages/zmq/tests/test_draft.py | ajayiagbebaku/NFL-Model | 603 | 4103 | # -*- coding: utf8 -*-
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import os
import platform
import time
import pytest
import zmq
from zmq.tests import BaseZMQTestCase, skip_pypy
class TestDraftSockets(BaseZMQTestCase):
def setUp(self):
if not zmq.DRAFT_AP... | 2.203125 | 2 |
home/push/mipush/APIError.py | he0119/smart-home | 0 | 4104 | class APIError(Exception):
"""
raise APIError if receiving json message indicating failure.
"""
def __init__(self, error_code, error, request):
self.error_code = error_code
self.error = error
self.request = request
Exception.__init__(self, error)
def __str__(self):
... | 3.375 | 3 |
pythonlibs/mantis/templates/webapp/src/webapp/base.py | adoggie/Tibet.6 | 22 | 4105 | <filename>pythonlibs/mantis/templates/webapp/src/webapp/base.py
#coding:utf-8
class SystemDeviceType(object):
InnerBox = 1 # 主屏分离的室内主机
InnerScreen = 2 # 主屏分离的室内屏
OuterBox = 3 # 室外机
PropCallApp = 4 # 物业值守
PropSentryApp = 5 # 物业岗亭机
Others = 10
ValidatedList = (1,2,3,4... | 1.648438 | 2 |
base/site-packages/django_qbe/urls.py | edisonlz/fastor | 285 | 4106 | <filename>base/site-packages/django_qbe/urls.py
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from django_qbe.exports import formats
urlpatterns = patterns('django_qbe.views',
url(r'^$', 'qbe_form', name="qbe_form"),
url(r'^js/$', 'qbe_js', name="qbe_js"),
url(r'^results/bookm... | 1.742188 | 2 |
augment.py | docongminh/Text-Image-Augmentation-python | 217 | 4107 | # -*- coding:utf-8 -*-
# Author: RubanSeven
# import cv2
import numpy as np
# from transform import get_perspective_transform, warp_perspective
from warp_mls import WarpMLS
def distort(src, segment):
img_h, img_w = src.shape[:2]
cut = img_w // segment
thresh = cut // 3
# thresh = img_h... | 2.34375 | 2 |
Graph/print all paths from two vertices in a directed graph.py | ikaushikpal/DS-450-python | 3 | 4108 | from collections import defaultdict
class Graph:
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self, starting_vertex, end_vertex):
self.graph[starting_vertex].append(end_vertex)
def printAllPaths(self, starting_vertex, target_vertex):
visitedVertices = defaultdic... | 3.5625 | 4 |
tests/pipegeojson_test/test_pipegeojson.py | kamyarrasta/berrl | 1 | 4109 | # testing the output of pipegeojson against different input types
import berrl as bl
import itertools
# making line with csv file location
line1=bl.make_line('csvs/line_example.csv')
# making line with list
testlist=bl.read('csvs/line_example.csv')
line2=bl.make_line(testlist,list=True)
# testing each line geojson ... | 3.171875 | 3 |
tierpsy/debugging/catch_infinite_loop.py | mgh17/tierpsy-tracker | 9 | 4110 | <filename>tierpsy/debugging/catch_infinite_loop.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 8 16:19:07 2017
@author: ajaver
"""
import os
import cv2
import sys
import glob
import threading
from functools import partial
main_dir = '/Volumes/behavgenom_archive$/Celine/raw/'
fnames = glob.g... | 2.15625 | 2 |
devito/passes/iet/languages/C.py | guaacoelho/devito | 199 | 4111 | from devito.ir import Call
from devito.passes.iet.definitions import DataManager
from devito.passes.iet.langbase import LangBB
__all__ = ['CBB', 'CDataManager']
class CBB(LangBB):
mapper = {
'aligned': lambda i:
'__attribute__((aligned(%d)))' % i,
'host-alloc': lambda i, j, k:
... | 1.898438 | 2 |
tests/_test_image.py | Freakwill/ell | 0 | 4112 | #!/usr/bin/env python3
"""Test methods about image process
Make sure the existance of the images
"""
from ell import *
import numpy as np
_filter = Filter.from_name('db4')
def test_resize():
chennal=0
c = ImageRGB.open('src/lenna.jpg')
d=c.resize(minInd=(-100,-100), maxInd=(100,100))
d.to_image()
... | 2.46875 | 2 |
donkeycar/parts/pytorch/torch_data.py | adricl/donkeycar | 1,100 | 4113 | # PyTorch
import torch
from torch.utils.data import IterableDataset, DataLoader
from donkeycar.utils import train_test_split
from donkeycar.parts.tub_v2 import Tub
from torchvision import transforms
from typing import List, Any
from donkeycar.pipeline.types import TubRecord, TubDataset
from donkeycar.pipeline.sequence ... | 2.765625 | 3 |
lite/__init__.py | CleverInsight/sparx-lite | 0 | 4114 | import os
from tornado.template import Template
__SNIPPET__ = os.path.join(os.path.dirname(os.path.abspath(__file__)), '_snippet')
def T(name, **kw):
t = Template(open(os.path.join(__SNIPPET__, name + '.html'), 'rb').read())
return t.generate(**dict([('template_file', name)] + globals().items() + kw.items()))
| 2.5 | 2 |
homeassistant/components/sensor/hddtemp.py | mdonoughe/home-assistant | 2 | 4115 | """
Support for getting the disk temperature of a host.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.hddtemp/
"""
import logging
from datetime import timedelta
from telnetlib import Telnet
import voluptuous as vol
import homeassistant.helpers.... | 2.71875 | 3 |
boomer.py | JohnnySn0w/BabbleBot | 1 | 4116 | <reponame>JohnnySn0w/BabbleBot
import random
prefix = [
'Look at you! ',
'Bless ',
'Bless! ',
'I heard about that! ',
'Amen!',
'You and the kids doing alright?',
'Miss ya\'ll!'
]
suffix = [
'. Amen!',
'. God bless america',
'. God bless!',
' haha',
'. love ya!',
'. love ya\'ll!',
]
def add_pre_suf(sentence):
if ... | 3.171875 | 3 |
bot/views.py | eyobofficial/COVID-19-Mutual-Aid | 0 | 4117 | import telegram
from django.conf import settings
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.views.generic import View
from django.views.decorators.csrf import csrf_exempt
from braces.views import CsrfExemptMixin
from rest_framework.authentication import Bas... | 1.921875 | 2 |
code/counterfactual_generative_networks-main/imagenet/train_cgn.py | dummyxyz1/re_counterfactual_generative | 0 | 4118 | import os
from datetime import datetime
from os.path import join
import pathlib
from tqdm import tqdm
import argparse
import torch
from torch import nn, optim
from torch.autograd import Variable
import torchvision
from torchvision.transforms import Pad
from torchvision.utils import make_grid
import repackage
repackage... | 1.726563 | 2 |
portfolio/urls.py | ramza007/Ramza.io | 3 | 4119 | <reponame>ramza007/Ramza.io<gh_stars>1-10
from django.conf.urls import url
from django.urls import path, include,re_path
from . import views
from rest_framework.authtoken.views import obtain_auth_token
urlpatterns = [
path('', views.index, name='index'),
path('about', views.about, name='about'),
path('pr... | 1.984375 | 2 |
tests/resources/mlflow-test-plugin/mlflow_test_plugin/file_store.py | iPieter/kiwi | 0 | 4120 | <reponame>iPieter/kiwi
from six.moves import urllib
from kiwi.store.tracking.file_store import FileStore
class PluginFileStore(FileStore):
"""FileStore provided through entrypoints system"""
def __init__(self, store_uri=None, artifact_uri=None):
path = urllib.parse.urlparse(store_uri).path if store_... | 1.984375 | 2 |
tests/server/test_flask_api.py | YuhangCh/terracotta | 0 | 4121 | <filename>tests/server/test_flask_api.py
from io import BytesIO
import json
import urllib.parse
from collections import OrderedDict
from PIL import Image
import numpy as np
import pytest
@pytest.fixture(scope='module')
def flask_app():
from terracotta.server import create_app
return create_app()
@pytest.f... | 2.140625 | 2 |
url.py | matthieucan/shorturl | 1 | 4122 | <filename>url.py
def base_conv(n, input_base=10, output_base=10):
"""
Converts a number n from base input_base to base output_base.
The following symbols are used to represent numbers:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
n can be an int if input_base <= 10, and a stri... | 4.15625 | 4 |
src/qtt/qiskit/passes.py | codecrap/qtt | 0 | 4123 | import logging
from typing import Dict, List, Optional
import numpy as np
import qiskit
from qiskit.circuit import Barrier, Delay, Reset
from qiskit.circuit.library import (CRXGate, CRYGate, CRZGate, CZGate,
PhaseGate, RXGate, RYGate, RZGate, U1Gate,
... | 2.234375 | 2 |
IAFNNESTA.py | JonathanAlis/IAFNNESTA | 3 | 4124 | def help():
return '''
Isotropic-Anisotropic Filtering Norm Nesterov Algorithm
Solves the filtering norm minimization + quadratic term problem
Nesterov algorithm, with continuation:
argmin_x || iaFN(x) ||_1/2 subjected to ||b - Ax||_2^2 < delta
If no filter is provided, solves the L1.
Continuation is perf... | 3.40625 | 3 |
hypatia/util/__init__.py | pfw/hypatia | 0 | 4125 | <reponame>pfw/hypatia<gh_stars>0
import itertools
import BTrees
from persistent import Persistent
from ZODB.broken import Broken
from zope.interface import implementer
_marker = object()
from .. import exc
from ..interfaces import (
IResultSet,
STABLE,
)
@implementer(IResultSet)
class ResultSet(object):
... | 2.234375 | 2 |
backend/listings/migrations/0001_initial.py | relaxxpls/Music-Control | 0 | 4126 | <filename>backend/listings/migrations/0001_initial.py
# Generated by Django 3.2.3 on 2021-05-30 04:28
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('realtors', '0001_init... | 1.828125 | 2 |
examples/example_without_CommandSet/my_listeners.py | LeConstellationniste/DiscordFramework | 1 | 4127 | import asyncio
import discord
# Just with a function to add to the bot.
async def on_message(message):
if not message.author.bot:
await message.channel.send(f"{message.author.mention} a envoyé un message!")
# A Listener already created with the function
from discordEasy.objects import Listener
async def on_messa... | 2.796875 | 3 |
pianonet/serving/app.py | robgon-art/pianonet | 14 | 4128 | import os
import random
from flask import Flask, request, send_from_directory
from werkzeug.utils import secure_filename
from pianonet.core.pianoroll import Pianoroll
from pianonet.model_inspection.performance_from_pianoroll import get_performance_from_pianoroll
app = Flask(__name__)
base_path = "/app/"
# base_pat... | 2.59375 | 3 |
app.py | rafalbigaj/epidemic-model-visualization | 0 | 4129 | import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import logging
import json
import os
import pandas as pd
from datetime import datetime
from datetime import timedelta
fro... | 2.09375 | 2 |
src/sweetrpg_library_api/application/blueprints/systems/manager.py | paulyhedral/sweetrpg-library-api | 0 | 4130 | # -*- coding: utf-8 -*-
__author__ = "<NAME> <<EMAIL>>"
"""
"""
from flask_rest_jsonapi import ResourceList, ResourceDetail, ResourceRelationship
from sweetrpg_library_objects.api.system.schema import SystemAPISchema
from sweetrpg_api_core.data import APIData
from sweetrpg_library_objects.model.system import System
f... | 2.171875 | 2 |
tests/test_ordering.py | deepio-oc/pabot | 379 | 4131 | from robot import __version__ as ROBOT_VERSION
import sys
import tempfile
import textwrap
import unittest
import shutil
import subprocess
class PabotOrderingGroupTest(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.tmpdir)
def ... | 2.4375 | 2 |
setup.py | Commonists/pageview-api | 21 | 4132 | <reponame>Commonists/pageview-api<filename>setup.py
#!/usr/bin/python
# -*- coding: latin-1 -*-
"""Setup script."""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
import pageviewapi
version = pageviewapi.__version__
except ImportError:
version = 'Undef... | 1.453125 | 1 |
task1b.py | juby-gif/assignment1 | 0 | 4133 | <reponame>juby-gif/assignment1<gh_stars>0
#a2_t1b.py
#This program is to convert Celsius to Kelvin
def c_to_k(c):
k = c + 273.15 #Formula to convert Celsius to Kelvin
return k
def f_to_c(f):
fa = (f-32) * 5/9 #Formula to convert Fareheit to Celsius
return fa
c = 25.0
f = 100.0
k = c_to_k(c)
fa = f_to_... | 3.59375 | 4 |
TWLight/emails/views.py | jajodiaraghav/TWLight | 1 | 4134 | <filename>TWLight/emails/views.py
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse, reverse_lazy
from django.core.mail import BadHeaderError, send_mail
from django.http import Ht... | 2.125 | 2 |
frontend/config.py | lcbm/cs-data-ingestion | 0 | 4135 | <filename>frontend/config.py
"""Flask App configuration file."""
import logging
import os
import dotenv
import frontend.constants as constants
dotenv.load_dotenv(os.path.join(constants.BASEDIR, "frontend.env"))
class Base:
"""Configuration class used as base for all environments."""
DEBUG = False
TE... | 2.9375 | 3 |
tests/test_dsl.py | goodreferences/ElasticQuery | 0 | 4136 | <filename>tests/test_dsl.py<gh_stars>0
# ElasticQuery
# File: tests/test_dsl.py
# Desc: tests for ElasticQuery DSL objects (Filter, Query, Aggregate)
from os import path
from unittest import TestCase
from jsontest import JsonTest
from elasticquery import Query, Aggregate, Suggester
from elasticquery.exceptions impor... | 2.5 | 2 |
models/SelectionGAN/person_transfer/tool/rm_insnorm_running_vars.py | xianjian-xie/pose-generation | 445 | 4137 | import torch
ckp_path = './checkpoints/fashion_PATN/latest_net_netG.pth'
save_path = './checkpoints/fashion_PATN_v1.0/latest_net_netG.pth'
states_dict = torch.load(ckp_path)
states_dict_new = states_dict.copy()
for key in states_dict.keys():
if "running_var" in key or "running_mean" in key:
del states_dict_new[key]... | 2.015625 | 2 |
script/dummy/arm_control.py | amazon-picking-challenge/team_pfn | 7 | 4138 | <filename>script/dummy/arm_control.py
#!/usr/bin/python
# Copyright 2016 Preferred Networks, 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/LICEN... | 2.265625 | 2 |
cogs/events.py | rompdodger/RompDodger | 0 | 4139 | <gh_stars>0
import json
import discord
from utils.time import format_time
from utils import utilities
from discord.ext import commands
from discord import Embed
class Events(commands.Cog):
"""Event Handler for RompDodger"""
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_command... | 2.625 | 3 |
Task/Parallel-calculations/Python/parallel-calculations-2.py | LaudateCorpus1/RosettaCodeData | 1 | 4140 | import multiprocessing
# ========== #Python3 - concurrent
from math import floor, sqrt
numbers = [
112272537195293,
112582718962171,
112272537095293,
115280098190773,
115797840077099,
1099726829285419]
# numbers = [33, 44, 55, 275]
def lowest_factor(n, _start=3):
if n % 2 == 0:
re... | 3.421875 | 3 |
setup.py | clin366/airpollutionnowcast | 0 | 4141 | from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Project: Nowcasting the air pollution using online search log',
author='<NAME>(IR Lab)',
license='MIT',
)
| 1.078125 | 1 |
problems/p0048/s48.py | ahrarmonsur/euler | 1 | 4142 | """
Project Euler Problem 48
Self powers
Solved by <NAME>
The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.
Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
"""
def main():
max_digits = 1000
sum = 0
for i in range(1, max_digits+1):
sum += i**i
print str(sum)[-... | 3.5625 | 4 |
BigData/sparkTask/test.py | Rainstyd/rainsty | 1 | 4143 | <filename>BigData/sparkTask/test.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@author: rainsty
@file: test.py
@time: 2020-01-04 18:36:57
@description:
"""
import os
from pyspark.sql import SparkSession
os.environ['JAVA_HOME'] = '/root/jdk'
os.environ['SPARK_HOME'] = '/root/spark'
os.environ['PYTHON_HOME'] = ... | 2.546875 | 3 |
esercizi/areaSottesaCompareNumPy.py | gdv/python-alfabetizzazione | 0 | 4144 | <reponame>gdv/python-alfabetizzazione<filename>esercizi/areaSottesaCompareNumPy.py
import numpy as np
import timeit
def effe(x):
y = -x * (x - 1.0)
return y
numIntervalli = input('inserire il numero di intervalli in [0.0, 1.0] ')
deltaIntervallo = 1.0 / float(numIntervalli)
print "larghezza intervallo", de... | 2.609375 | 3 |
json_codegen/generators/python3_marshmallow/object_generator.py | expobrain/json-schema-codegen | 21 | 4145 | import ast
from json_codegen.generators.python3_marshmallow.utils import Annotations, class_name
class ObjectGenerator(object):
@staticmethod
def _get_property_name(node_assign):
name = node_assign.targets[0]
return name.id
@staticmethod
def _nesting_class(node_assign):
for n... | 2.625 | 3 |
testing/regrid/testEsmfGridToMeshRegridCsrv.py | xylar/cdat | 62 | 4146 | <filename>testing/regrid/testEsmfGridToMeshRegridCsrv.py
#!/usr/bin/env python
#
# $Id: ESMP_GridToMeshRegridCsrv.py,v 1.5 2012/04/23 23:00:14 rokuingh Exp $
#===============================================================================
# ESMP/examples/ESMP_GridToMeshRegrid.py
#===========================... | 2.34375 | 2 |
test/mock_module.py | ariffyasri/lale | 1 | 4147 | # Copyright 2019 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.15625 | 2 |
scripts/beautify.py | lukaschoebel/POTUSgen | 0 | 4148 | <gh_stars>0
import json
import re
import sys
def beautify(name):
''' Loading, filtering and saving the JSON tweet file to a newly generated .txt file
:type: name: String
:rtype: output: .txt
'''
filename = name + '.json'
output_name = name + "_filtered.txt"
with open(filename, "r", encod... | 3.421875 | 3 |
result2gaofentype/pkl2txt_ggm.py | G-Naughty/Fine-grained-OBB-Detection | 2 | 4149 | import BboxToolkit as bt
import pickle
import copy
import numpy as np
path1="/home/hnu1/GGM/OBBDetection/work_dir/oriented_obb_contrast_catbalance/dets.pkl"
path2="/home/hnu1/GGM/OBBDetection/data/FaIR1M/test/annfiles/ori_annfile.pkl"#
with open(path2,'rb') as f: #/home/disk/FAIR1M_1000_split/val/annfiles/ori_... | 2.078125 | 2 |
initializer_3d.py | HarperCallahan/taichi_ferrofluid | 0 | 4150 | import taichi as ti
import utils
from apic_extension import *
@ti.data_oriented
class Initializer3D: # tmp initializer
def __init__(self, res, x0, y0, z0, x1, y1, z1):
self.res = res
self.x0 = int(res * x0)
self.y0 = int(res * y0)
self.z0 = int(res * z0)
self.x1 = int(res * ... | 2.359375 | 2 |
copy_block_example.py | MilesCranmer/bifrost_paper | 0 | 4151 | <gh_stars>0
from copy import deepcopy
import bifrost as bf
from bifrost.pipeline import TransformBlock
from bifrost.ndarray import copy_array
class CopyBlock(TransformBlock):# $\tikzmark{block-start}$
"""Copy the input ring to output ring"""
def __init__(self, iring... | 2.109375 | 2 |
monasca_persister/conf/influxdb.py | zhangjianweibj/monasca-persister | 0 | 4152 | # (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# Copyright 2017 FUJITSU LIMITED
#
# 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... | 1.945313 | 2 |
test_print_json.py | huangsen365/boto3-docker | 0 | 4153 | import json
your_json = '["foo", {"bar":["baz", null, 1.0, 2]}]'
parsed = json.loads(your_json)
print(type(your_json))
print(type(parsed))
#print(json.dumps(parsed, indent=4, sort_keys=True)) | 3.15625 | 3 |
src/solutions/common/integrations/cirklo/api.py | goubertbrent/oca-backend | 0 | 4154 | <filename>src/solutions/common/integrations/cirklo/api.py
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | 1.382813 | 1 |
aplpy/tests/test_grid.py | nbrunett/aplpy | 0 | 4155 | import matplotlib
matplotlib.use('Agg')
import numpy as np
from astropy.tests.helper import pytest
from .. import FITSFigure
def test_grid_addremove():
data = np.zeros((16, 16))
f = FITSFigure(data)
f.add_grid()
f.remove_grid()
f.add_grid()
f.close()
def test_grid_showhide():
data = np... | 2 | 2 |
vz.py | ponyatov/vz | 0 | 4156 | import os, sys
class Object:
## @name constructor
def __init__(self, V):
self.value = V
self.nest = []
def box(self, that):
if isinstance(that, Object): return that
if isinstance(that, str): return S(that)
raise TypeError(['box', type(that), that])
## @name d... | 3.265625 | 3 |
src/server.py | FlakM/fastai_text_serving | 0 | 4157 | import asyncio
import logging
import aiohttp
import uvicorn
from fastai.vision import *
from starlette.applications import Starlette
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import JSONResponse
# put your url here here
model_file_url = 'https://www.dropbox.com/s/...?raw=1'
model_f... | 2.21875 | 2 |
tcpserver.py | justforbalance/CSnet | 0 | 4158 | from socket import *
serverPort = 12001
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('', serverPort))
serverSocket.listen(1)
print("the server is ready to receive")
while True:
connectionSocket,addr = serverSocket.accept()
sentence = connectionSocket.recv(1024).decode()
sentence = sentence... | 3.046875 | 3 |
src/geneflow/extend/local_workflow.py | jhphan/geneflow2 | 7 | 4159 | """This module contains the GeneFlow LocalWorkflow class."""
class LocalWorkflow:
"""
A class that represents the Local Workflow objects.
"""
def __init__(
self,
job,
config,
parsed_job_work_uri
):
"""
Instantiate LocalWorkflow class.... | 2.6875 | 3 |
S12/tensornet/engine/ops/lr_scheduler.py | abishek-raju/EVA4B2 | 4 | 4160 | from torch.optim.lr_scheduler import StepLR, ReduceLROnPlateau, OneCycleLR
def step_lr(optimizer, step_size, gamma=0.1, last_epoch=-1):
"""Create LR step scheduler.
Args:
optimizer (torch.optim): Model optimizer.
step_size (int): Frequency for changing learning rate.
gamma (float): Fa... | 2.625 | 3 |
armi/reactor/tests/test_zones.py | youngmit/armi | 0 | 4161 | # Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 1.828125 | 2 |
islam_fitz/survey/migrations/0005_auto_20210712_2132.py | OmarEhab177/Islam_fitz | 0 | 4162 | <filename>islam_fitz/survey/migrations/0005_auto_20210712_2132.py<gh_stars>0
# Generated by Django 3.1.12 on 2021-07-12 19:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('survey', '0004_lastpage_whatsapp_button'),
]
operations = [
mi... | 1.484375 | 1 |
Examples/WorkingWithOutlookMSGs/CreateAndSaveOutlookNote.py | Muzammil-khan/Aspose.Email-Python-Dotnet | 5 | 4163 | <filename>Examples/WorkingWithOutlookMSGs/CreateAndSaveOutlookNote.py<gh_stars>1-10
import aspose.email.mapi.msg as msg
from aspose.email.mapi import MapiNote, NoteSaveFormat, NoteColor
def run():
dataDir = "Data/"
#ExStart: CreateAndSaveOutlookNote
note3 = MapiNote()
note3.subject = "Blue color note"
note3.body... | 2.6875 | 3 |
nonebot/internal/adapter/template.py | mobyw/nonebot2 | 0 | 4164 | <gh_stars>0
import functools
from string import Formatter
from typing import (
TYPE_CHECKING,
Any,
Set,
Dict,
List,
Type,
Tuple,
Union,
Generic,
Mapping,
TypeVar,
Callable,
Optional,
Sequence,
cast,
overload,
)
if TYPE_CHECKING:
from .message import M... | 2.546875 | 3 |
Others/code_festival/code-festival-2015-final-open/a.py | KATO-Hiro/AtCoder | 2 | 4165 | <gh_stars>1-10
# -*- coding: utf-8 -*-
def main():
s, t, u = map(str, input().split())
if len(s) == 5 and len(t) == 7 and len(u) == 5:
print('valid')
else:
print('invalid')
if __name__ == '__main__':
main()
| 3.25 | 3 |
python_Project/Day_16-20/test_2.py | Zzz-ww/Python-prac | 0 | 4166 | <filename>python_Project/Day_16-20/test_2.py
"""
嵌套的列表的坑
"""
names = ['关羽', '张飞', '赵云', '马超', '黄忠']
courses = ['语文', '数学', '英语']
# 录入五个学生三门课程的成绩
scores = [[None] * len(courses) for _ in range(len(names))]
for row, name in enumerate(names):
for col, course in enumerate(courses):
scores[row][col] = float(in... | 3.671875 | 4 |
asr/dataloaders/am_dataloader.py | Z-yq/audioSamples.github.io | 1 | 4167 | <gh_stars>1-10
import logging
import random
import numpy as np
import pypinyin
import tensorflow as tf
from augmentations.augments import Augmentation
from utils.speech_featurizers import SpeechFeaturizer
from utils.text_featurizers import TextFeaturizer
logging.basicConfig(level=logging.INFO, format='%(asctime)s - ... | 2.1875 | 2 |
migrations/versions/2018_04_20_data_src_refactor.py | AlexKouzy/ethnicity-facts-and-figures-publisher | 0 | 4168 | """empty message
Revision ID: 2018_04_20_data_src_refactor
Revises: 2018_04_11_add_sandbox_topic
Create Date: 2018-04-20 13:03:32.478880
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
from sqlalchemy.dialects.postgresql import ARRAY
revision = '2018_04_20_data_src_refac... | 1.601563 | 2 |
lib/core/parse/cmdline.py | vikas-kundu/phonedict | 0 | 4169 | <reponame>vikas-kundu/phonedict<filename>lib/core/parse/cmdline.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# coded by <NAME> https://github.com/vikas-kundu
# -------------------------------------------
import sys
import getopt
import time
import config
from lib.core.parse import banner
from ... | 2.15625 | 2 |
mistral/tests/unit/utils/test_utils.py | shubhamdang/mistral | 205 | 4170 | # Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc.
# Copyright 2015 - Huawei Technologies Co. Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | 1.9375 | 2 |
shoutcast_api/shoutcast_request.py | scls19fr/shoutcast_api | 6 | 4171 | import xmltodict
import json
from .models import Tunein
from .utils import _init_session
from .Exceptions import APIException
base_url = 'http://api.shoutcast.com'
tunein_url = 'http://yp.shoutcast.com/{base}?id={id}'
tuneins = [Tunein('/sbin/tunein-station.pls'), Tunein('/sbin/tunein-station.m3u'), Tunein('/sbin/tun... | 2.21875 | 2 |
django_app_permissions/management/commands/resolve_app_groups.py | amp89/django-app-permissions | 2 | 4172 | from django.core.management.base import BaseCommand, no_translations
from django.contrib.auth.models import Group
from django.conf import settings
import sys
class Command(BaseCommand):
def handle(self, *args, **options):
sys.stdout.write("\nResolving app groups")
app_list = [app_name.lower... | 2 | 2 |
swift/common/db.py | sunzz679/swift-2.4.0--source-read | 0 | 4173 | # Copyright (c) 2010-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 law or agree... | 1.648438 | 2 |
xdl/utils/prop_limits.py | mcrav/xdl | 0 | 4174 | <reponame>mcrav/xdl<filename>xdl/utils/prop_limits.py
"""Prop limits are used to validate the input given to xdl elements. For
example, a volume property should be a positive number, optionally followed by
volume units. The prop limit is used to check that input supplied is valid for
that property.
"""
import re
from ... | 3.171875 | 3 |
dit/utils/bindargs.py | leoalfonso/dit | 1 | 4175 | """
Provides usable args and kwargs from inspect.getcallargs.
For Python 3.3 and above, this module is unnecessary and can be achieved using
features from PEP 362:
http://www.python.org/dev/peps/pep-0362/
For example, to override a parameter of some function:
>>> import inspect
>>> def func(a, b=1, c=2,... | 3.40625 | 3 |
tests/python/gaia-ui-tests/gaiatest/gaia_test.py | AmyYLee/gaia | 1 | 4176 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
import sys
import time
from marionette import MarionetteTestCase
from marionette.by import By
fro... | 1.992188 | 2 |
library/__mozilla__/pyjamas/DOM.py | certik/pyjamas | 0 | 4177 | <gh_stars>0
def buttonClick(button):
JS("""
var doc = button.ownerDocument;
if (doc != null) {
var evt = doc.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, null, 0, 0,
0, 0, 0, false, false, false, false, 0, null);
... | 2.015625 | 2 |
apps/vendors/migrations/0090_auto_20160610_2125.py | ExpoAshique/ProveBanking__s | 0 | 4178 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-10 21:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vendors', '0089_auto_20160602_2123'),
]
operations = [
migrations.AlterField... | 1.359375 | 1 |
graph/articulation_points.py | fujihiraryo/library | 0 | 4179 | <gh_stars>0
from depth_first_search import DFS
def articulation_points(graph):
n = len(graph)
dfs = DFS(graph)
order = [None] * n
for i, x in enumerate(dfs.preorder):
order[x] = i
lower = order[:]
for x in dfs.preorder[::-1]:
for y in graph[x]:
if y == dfs.parent[x]... | 2.953125 | 3 |
database.py | AndreAngelucci/popcorn_time_bot | 0 | 4180 | import pymongo
from conf import Configuracoes
class Mongo_Database:
""" Singleton com a conexao com o MongoDB """
_instancia = None
def __new__(cls, *args, **kwargs):
if not(cls._instancia):
cls._instancia = super(Mongo_Database, cls).__new__(cls, *args, **kwargs)
return cls._in... | 2.875 | 3 |
sensor_core/sleep.py | JorisHerbots/niip_iot_zombie_apocalypse | 0 | 4181 | <gh_stars>0
import machine
import pycom
import utime
from exceptions import Exceptions
class Sleep:
@property
def wakeReason(self):
return machine.wake_reason()[0]
@property
def wakePins(self):
return machine.wake_reason()[1]
@property
def powerOnWake(self):
... | 2.328125 | 2 |
pytorch_gleam/search/rerank_format.py | Supermaxman/pytorch-gleam | 0 | 4182 | <reponame>Supermaxman/pytorch-gleam<gh_stars>0
import torch
import argparse
from collections import defaultdict
import os
import json
def load_predictions(input_path):
pred_list = []
for file_name in os.listdir(input_path):
if file_name.endswith('.pt'):
preds = torch.load(os.path.join(input_path, file_name))
... | 2.28125 | 2 |
des036.py | LeonardoPereirajr/Curso_em_video_Python | 0 | 4183 | casa = int(input('Qual o valor da casa? '))
sal = int(input('Qual seu salario? '))
prazo = int(input('Quantos meses deseja pagar ? '))
parcela = casa/prazo
margem = sal* (30/100)
if parcela > margem:
print('Este negocio não foi aprovado, aumente o prazo .')
else:
print("Negocio aprovado pois a parcela é... | 3.84375 | 4 |
HackBitApp/migrations/0003_roadmap.py | SukhadaM/HackBit-Interview-Preparation-Portal | 0 | 4184 | # Generated by Django 3.1.7 on 2021-03-27 18:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('HackBitApp', '0002_company_photo'),
]
operations = [
migrations.CreateModel(
name='Roadmap',
fields=[
... | 1.734375 | 2 |
Other_Python/Kernel_Methods/matrix_operations.py | Romit-Maulik/Tutorials-Demos-Practice | 0 | 4185 | <reponame>Romit-Maulik/Tutorials-Demos-Practice<filename>Other_Python/Kernel_Methods/matrix_operations.py
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 14:36:48 2020
@author: matth
"""
import autograd.numpy as np
#%% Kernel operations
# Returns the norm of the pairwise difference
def norm_matrix(matrix_1, matrix... | 3.546875 | 4 |
cors/resources/cors-makeheader.py | meyerweb/wpt | 14,668 | 4186 | import json
from wptserve.utils import isomorphic_decode
def main(request, response):
origin = request.GET.first(b"origin", request.headers.get(b'origin') or b'none')
if b"check" in request.GET:
token = request.GET.first(b"token")
value = request.server.stash.take(token)
if value is n... | 2.265625 | 2 |
device_osc_grid.py | wlfyit/PiLightsLib | 0 | 4187 | <reponame>wlfyit/PiLightsLib
#!/usr/bin/env python3
from pythonosc import osc_bundle_builder
from pythonosc import osc_message_builder
from pythonosc import udp_client
from .device import DeviceObj
# OSC Grid Object
class OSCGrid(DeviceObj):
def __init__(self, name, width, height, ip, port, bri=1):
Devic... | 2.328125 | 2 |
main/models.py | StevenSume/EasyCMDB | 2 | 4188 | from .app import db
class Project(db.Model):
__tablename__ = 'projects'
id = db.Column(db.Integer,primary_key=True,autoincrement=True)
project_name = db.Column(db.String(64),unique=True,index=True)
def to_dict(self):
mydict = {
'id': self.id,
'project_name': self.projec... | 2.828125 | 3 |
test.py | iron-io/iron_cache_python | 3 | 4189 | <reponame>iron-io/iron_cache_python<gh_stars>1-10
from iron_cache import *
import unittest
import requests
class TestIronCache(unittest.TestCase):
def setUp(self):
self.cache = IronCache("test_cache")
def test_get(self):
self.cache.put("test_item", "testing")
item = self.cache.get("te... | 2.796875 | 3 |
lib_exec/StereoPipeline/libexec/asp_image_utils.py | sebasmurphy/iarpa | 20 | 4190 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# __BEGIN_LICENSE__
# Copyright (c) 2009-2013, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "Lic... | 2.59375 | 3 |
src/sv-pipeline/04_variant_resolution/scripts/merge_RdTest_genotypes.py | leipzig/gatk-sv | 76 | 4191 | #!/usr/bin/env python
import argparse
DELIMITER = "\t"
def merge(genotypes_filename, gq_filename, merged_filename):
with open(genotypes_filename, "r") as genotypes, open(gq_filename, "r") as gq, open(merged_filename, "w") as merged:
# Integrity check: do the files have same columns?
genotypes_... | 3.109375 | 3 |
esperanto_analyzer/web/__init__.py | fidelisrafael/esperanto-analyzer | 18 | 4192 | <gh_stars>10-100
from .api.server import run_app
| 1.085938 | 1 |
crawling/sns/main.py | CSID-DGU/2021-2-OSSP2-TwoRolless-2 | 0 | 4193 | import tweepy
import traceback
import time
import pymongo
from tweepy import OAuthHandler
from pymongo import MongoClient
from pymongo.cursor import CursorType
twitter_consumer_key = ""
twitter_consumer_secret = ""
twitter_access_token = ""
twitter_access_secret = ""
auth = OAuthHandler(twitter_consumer_key, twitter_... | 2.765625 | 3 |
demos/interactive-classifier/config.py | jepabe/Demo_earth2 | 1,909 | 4194 | #!/usr/bin/env python
"""Handles Earth Engine service account configuration."""
import ee
# The service account email address authorized by your Google contact.
# Set up a service account as described in the README.
EE_ACCOUNT = '<EMAIL>'
# The private key associated with your service account in Privacy Enhanced
# E... | 1.929688 | 2 |
PythonScripting/NumbersInPython.py | Neo-sunny/pythonProgs | 0 | 4195 | """
Demonstration of numbers in Python
"""
# Python has an integer type called int
print("int")
print("---")
print(0)
print(1)
print(-3)
print(70383028364830)
print("")
# Python has a real number type called float
print("float")
print("-----")
print(0.0)
print(7.35)
print(-43.2)
print("")
# Limited precision
print... | 4.21875 | 4 |
3DBeam/source/solving_strategies/strategies/linear_solver.py | JoZimmer/Beam-Models | 0 | 4196 | from source.solving_strategies.strategies.solver import Solver
class LinearSolver(Solver):
def __init__(self,
array_time, time_integration_scheme, dt,
comp_model,
initial_conditions,
force,
structure_model):
super().__ini... | 3.21875 | 3 |
payment/migrations/0002_auto_20171125_0022.py | Littledelma/mofadog | 0 | 4197 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-24 16:22
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('payment', '0001_initial'),... | 1.765625 | 2 |
src/sqlfluff/rules/L024.py | NathanHowell/sqlfluff | 3,024 | 4198 | <gh_stars>1000+
"""Implementation of Rule L024."""
from sqlfluff.core.rules.doc_decorators import document_fix_compatible
from sqlfluff.rules.L023 import Rule_L023
@document_fix_compatible
class Rule_L024(Rule_L023):
"""Single whitespace expected after USING in JOIN clause.
| **Anti-pattern**
.. code-... | 1.757813 | 2 |
projects/scocen/cmd_components_simple.py | mikeireland/chronostar | 4 | 4199 | <reponame>mikeireland/chronostar
"""
Plot CMDs for each component.
"""
import numpy as np
from astropy.table import Table
import matplotlib.pyplot as plt
import matplotlib.cm as cm
plt.ion()
# Pretty plots
from fig_settings import *
############################################
# Some things are the same for all the ... | 2.296875 | 2 |