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 |
|---|---|---|---|---|---|---|
Desafio022.py | MarcioRSanches/Estudos_Python | 0 | 12787851 | nomecompleto = str(input('Digite o seu nome completo: ')).strip()
print('Analisando seu nome....')
print('Seu nome em maiúsculas é {} '.format(nomecompleto.upper()))
print('Seu nome em minúsculas é {} '.format(nomecompleto.lower()))
print('Seu nome apenas com a primeira letra maiúscula é {}'.format(nomecompleto.capita... | 4.09375 | 4 |
configs/deepsvg/defaults_fonts.py | naoto0804/deepsvg | 573 | 12787852 | from .default_icons import *
class Config(Config):
def __init__(self, num_gpus=1):
super().__init__(num_gpus=num_gpus)
# Dataset
self.data_dir = "./dataset/fonts_tensor/"
self.meta_filepath = "./dataset/fonts_meta.csv"
| 1.984375 | 2 |
enqueue.py | alex-groshev/SpyPy | 0 | 12787853 | <reponame>alex-groshev/SpyPy<gh_stars>0
#!/usr/bin/env python
import sys
import pika
from bson.json_util import dumps
from confspy import ConfSpyPy
from dataspy import DataSpyPy
def main():
if len(sys.argv) < 2:
print 'Please, specify a number of records to enqueue and regular expression (opti... | 2.390625 | 2 |
urdf2optcontrol/__init__.py | abcamiletto/urdf2optcontrol | 0 | 12787854 | from urdf2optcontrol.optimizer import optimizer
| 1.171875 | 1 |
var/spack/repos/builtin/packages/py-pebble/package.py | lguyot/spack | 9 | 12787855 | # Copyright 2013-2020 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 PyPebble(PythonPackage):
"""Python API to manage threads and processes within an applicati... | 1.515625 | 2 |
example.py | BestPig/flask-rangerequest | 3 | 12787856 | <reponame>BestPig/flask-rangerequest<gh_stars>1-10
#!/usr/bin/env python3
from argparse import ArgumentParser
from datetime import datetime
from flask import Flask
from os import path
from flask_rangerequest import RangeRequest
def main() -> None:
args = arg_parser().parse_args()
app = create_app(args.file)... | 2.875 | 3 |
tenant_workspace/apps.py | smegurus/smegurus-django | 1 | 12787857 | <reponame>smegurus/smegurus-django
from django.apps import AppConfig
class TenantWorkspaceConfig(AppConfig):
name = 'tenant_workspace'
| 1.335938 | 1 |
python/plot_helpers.py | xandaschofield/text-duplication | 0 | 12787858 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
from collections import defaultdict
import os
import re
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
from pandas import DataFrame
import scipy.stats
import seaborn as sns
import lda_metrics
N_PROPS_LIST... | 2.375 | 2 |
askci/apps/base/views/errors.py | hpsee/askci | 3 | 12787859 | <filename>askci/apps/base/views/errors.py
"""
Copyright (C) 2019-2020 <NAME>.
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/.
"""
from django.shortcuts import render
def... | 1.804688 | 2 |
fakeitems.py | CPriya14/Catalog_Project | 1 | 12787860 | <gh_stars>1-10
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy_utils import database_exists, drop_database, create_database
from database_setup import Category, CategoryItem, User, Base
engine = create_engine('sqlite:///itemcatalog.db')
# Clear database
Base.metadata.dro... | 2.828125 | 3 |
umar.py | UMarda/CP19_025 | 1 | 12787861 | ##################################Question 4#####################################
a=input("Enter the paragraph : ")
b=" "
l=len(a)
for i in range(l):
if i==0: # capital first letter of para
b+=a[i].upper()
if a[i]=="." and i+1!=l: # after the full stop without give a space
b+="."
... | 3.609375 | 4 |
app/db/abstracts.py | lukecyx/fastlms | 0 | 12787862 | from abc import ABC
class CollectionManager(ABC)
| 1.398438 | 1 |
idact/detail/dask/dask_worker_deployment.py | intdata-bsc/idact | 5 | 12787863 | <gh_stars>1-10
"""This module contains the implementation of a Dask worker deployment."""
from contextlib import ExitStack
from idact.core.config import ClusterConfig
from idact.detail.deployment.cancel_on_exit import cancel_on_exit
from idact.detail.deployment.deserialize_generic_deployment import \
deserialize_... | 1.96875 | 2 |
bot/constants/messages.py | eyobofficial/Gebeya-Schedule-Bot | 3 | 12787864 | welcome_message = \
"""
👋🏼 Hi {}! You are currently enrolled to the {} track \
during the {}-time session.
*To checkout your class schedules:*
/today - get class schedules for today
/tomorrow - get class schedules for tomorrow
/week - get class schedules for 1 week starting from today
/month - get class schedules fo... | 1.78125 | 2 |
backend/flask-server/app.py | WatVis/EDAssistant | 0 | 12787865 | from flask import Flask
from flask import request, jsonify
import numpy as np
import torch
from flask_cors import CORS, cross_origin
import socket
import argparse
import random
import json
import re
from tokenize_code import tokenize_code
from serverHelpers import notebook_to_frontend
from gensim.models.doc2vec impo... | 2.328125 | 2 |
dbcArchives/2021/000_6-sds-3-x-dl/055_DLbyABr_04-ConvolutionalNetworks.py | r-e-x-a-g-o-n/scalable-data-science | 138 | 12787866 | <filename>dbcArchives/2021/000_6-sds-3-x-dl/055_DLbyABr_04-ConvolutionalNetworks.py<gh_stars>100-1000
# Databricks notebook source
# MAGIC %md
# MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html)
# MAGIC
# MAGIC This is a... | 2.484375 | 2 |
app/custom_topo.py | viniciusarcanjo/dvel | 1 | 12787867 | <filename>app/custom_topo.py
#!/usr/bin/python
"""
Containernet custom topology
"""
import copy
import re
import signal
import subprocess
import sys
import os
from mininet.net import Containernet
from mininet.node import RemoteController
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log impo... | 2.28125 | 2 |
timberAllocation/middleRepr.py | KOLANICH-research/timberAllocation | 0 | 12787868 | <filename>timberAllocation/middleRepr.py
import typing
import numpy as np
def getResultVector(initialLengths, finalLengths):
return np.array(tuple(initialLengths) + tuple(finalLengths))
def getMiddleStateMaxSize(initialLengths, finalLengths):
return len(initialLengths) + len(finalLengths) - 1
def vectorFactori... | 2.78125 | 3 |
intent_server/__init__.py | visdesignlab/intent-system | 3 | 12787869 | from flask import Flask
from .views import views
def create_app() -> Flask:
app = Flask(
__name__,
static_url_path='',
static_folder='../app/build',
)
app.register_blueprint(views)
return app
| 1.898438 | 2 |
gyoithon/migrations/0006_auto_20210506_1422.py | gyoisamurai/GyoiBoard | 3 | 12787870 | # Generated by Django 3.1.7 on 2021-05-06 05:22
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('gyoithon', '0005_auto_20210506_1358'),
]
operations = [
migrations.AlterField(
... | 1.710938 | 2 |
mydata_did/patched_protocols/issue_credential/v1_0/messages/credential_ack.py | decentralised-dataexchange/acapy-mydata-did-protocol | 1 | 12787871 | <reponame>decentralised-dataexchange/acapy-mydata-did-protocol
"""A credential ack message."""
from marshmallow import EXCLUDE
from aries_cloudagent.messaging.ack.message import Ack, AckSchema
from aries_cloudagent.messaging.decorators.base import BaseDecoratorSet
from ..message_types import CREDENTIAL_ACK, PROTOCO... | 1.820313 | 2 |
oldqa/qa/src/dedt_tests/Test_provenanceRewriter.py | KDahlgren/pyLDFI | 6 | 12787872 | <gh_stars>1-10
#!/usr/bin/env python
'''
Test_provenanceRewriter.py
Defines unit tests for provenanceRewriter.py from src/dedt/.
'''
#############
# IMPORTS #
#############
# standard python packages
import inspect, os, sqlite3, sys, unittest
from StringIO import StringIO
# --------------------------------------... | 2.25 | 2 |
scripts/codegen/__init__.py | cisco-ie/cisco-proto | 6 | 12787873 | """Copyright 2019 Cisco Systems
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
di... | 1.867188 | 2 |
models.py | bkotewall/oreilly-takehome | 0 | 12787874 | <reponame>bkotewall/oreilly-takehome<filename>models.py
from database import Base
from sqlalchemy import Column, Integer, String
from sqlalchemy.types import DateTime
from sqlalchemy.dialects.postgresql import ARRAY
class Book(Base):
"""
Books table
"""
__tablename__ = 'book'
id = Column(Integer, ... | 2.65625 | 3 |
api_visualcrossing.py | greggpatton/dash-simple-weather-clock | 0 | 12787875 | # https://www.visualcrossing.com/weather/weather-data-services?pln=plan_GqkYVnzyiNg93X#/timeline
# https://www.visualcrossing.com/weather-api
import requests
import json
# Convert degrees to compass direction
def deg_to_compass(num):
val = int((num / 22.5) + 0.5)
arr = [
"N",
"NNE",
"N... | 3.140625 | 3 |
lib/galaxy/webapps/galaxy/services/tools.py | thepineapplepirate/galaxy | 0 | 12787876 | <reponame>thepineapplepirate/galaxy
import logging
import shutil
import tempfile
from json import dumps
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from starlette.datastructures import UploadFile
from galaxy import (
exceptions,
util,
)
from galaxy.config import GalaxyAppConfi... | 1.953125 | 2 |
house/items.py | huajianmao/house | 0 | 12787877 | <reponame>huajianmao/house
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class LianJiaBriefItem(scrapy.Item):
name = scrapy.Filed()
url = scrapy.Filed()
lianJiaBianHao = scrapy.Filed()
... | 2.078125 | 2 |
MyApi/scrapingApp/api/serializer.py | Georgitanev/py_django_scrape | 0 | 12787878 | """ Serializer"""
from rest_framework import serializers
from scrapingApp.models import Parliament1
class ParliamentSerializer(serializers.ModelSerializer):
""" table columns """
class Meta:
""" table columns """
model = Parliament1
fields = [
"id",
"date_born... | 2.90625 | 3 |
src/iris/service/auth/service.py | iris-dni/iris-backend | 2 | 12787879 | <gh_stars>1-10
from pyramid import security
from lovely.pyrest.rest import RestService, rpcmethod_route, rpcmethod_view
from iris.service.rest.swagger import swagger_reduce_response
from iris.service.security.security import login_user, logout_user
from iris.service.content.user import SessionUser
from ..endpoint i... | 1.992188 | 2 |
recommend_service/recommend_service.py | MakingL/music_recommendation | 53 | 12787880 | <reponame>MakingL/music_recommendation
import os
from flask import Flask, request, json, Response, abort
from keras import backend as K
import dl_recommend.recommand as recommend_dl
from collaborative_filtering import cf_recommendation
from download_juno.download_juno import JunoDownload
app = Flask(__name__)
@ap... | 2.53125 | 3 |
tools/bitshares-account_balances.py | nomeycoin/extinction-event- | 0 | 12787881 | <gh_stars>0
import websocket #pip install websocket-client
websocket.enableTrace(False)
from ast import literal_eval as literal
def database_call(node, call):
while 1:
try:
call = call.replace("'",'"') # never use single quotes
ws = websocket.create_connection(node)
pr... | 2.875 | 3 |
B2G/gecko/testing/mozbase/mozrunner/mozrunner/runner.py | wilebeast/FireFox-OS | 3 | 12787882 | <gh_stars>1-10
#!/usr/bin/env python
# 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/.
__all__ = ['Runner', 'ThunderbirdRunner', 'FirefoxRunner', 'runners', 'CLI', 'cli'... | 2.1875 | 2 |
python/dungeon-game/dungeon.py | davejlin/treehouse | 0 | 12787883 | <reponame>davejlin/treehouse<gh_stars>0
import random
CELLS = [(0,0), (0,1), (0,2),
(1,0), (1,1), (1,2),
(2,0), (2,1), (2,2)]
player = (0,0)
door = (0,0)
dragon = (0,0)
def set_initial_positions():
while True:
player = random.choice(CELLS)
door = random.choice(CELLS)
dragon = random.choice(CELLS)
if ... | 3.84375 | 4 |
python3/shortest_path_in_binary_matrix.py | joshiaj7/CodingChallenges | 1 | 12787884 | <reponame>joshiaj7/CodingChallenges
import heapq
"""
Best Solution
BFS approach
Space : O(n)
Time : O(n**2)
"""
class Solution:
def shortestPathBinaryMatrix(self, grid: List[List[int]]) -> int:
max_row = len(grid) - 1
max_col = len(grid[0]) - 1
directions = [
(-1, -1), (-... | 3.453125 | 3 |
orch/commands/run_suite.py | freecraver/zimp-orchestrator | 0 | 12787885 | <reponame>freecraver/zimp-orchestrator
from cleo import Command
import logging
import glob
from experiment.config import Config
from experiment.experiment import Experiment
class RunSuite(Command):
"""
runs a whole experiment suite
suite
{config_folder=runs : Folder containing experiment config... | 2.3125 | 2 |
datameta/errors.py | ghga-de/datameta | 7 | 12787886 | # Copyright 2021 Universität Tübingen, DKFZ and EMBL for the German Human Genome-Phenome Archive (GHGA)
#
# 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... | 1.898438 | 2 |
Scripts/simulation/sickness/sickness_commands.py | velocist/TS4CheatsInfo | 0 | 12787887 | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\sickness\sickness_commands.py
# Compiled at: 2017-08-17 00:31:58
# Size of source mod 2**32: 2877 by... | 1.882813 | 2 |
Offline tasks/Offline_task_10/zad10.py | Szymon-Budziak/ASD_exercises_solutions | 7 | 12787888 | <gh_stars>1-10
class BSTNode:
def __init__(self, key):
self.key = key
self.left = None
self.right = None
self.parent = None
def find(root, key):
while root is not None:
if root.key == key:
return root
elif key < root.key:
root = root.left... | 3.625 | 4 |
sdk/python/pulumi_vault/approle/auth_backend_login.py | pulumi/pulumi-vault | 10 | 12787889 | <gh_stars>1-10
# 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 import Any, Mapping, Optional, Sequence, Union, overload... | 1.9375 | 2 |
src/cogs/arxivAPI.py | sdk2k01/S4DS-Bot | 3 | 12787890 | <gh_stars>1-10
import discord
import urllib, urllib.request
from xml.dom import minidom
from discord.ext import commands
class arxiv(commands.Cog):
def __init__(self, client):
self.client = client
#Gets the top search result from arXiv API and displays the paper along with related details (inclu... | 2.875 | 3 |
FATERUI/ui_settingdlg.py | LynnChan706/Fater | 4 | 12787891 | <reponame>LynnChan706/Fater
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'settingdlg.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_settingdlg(object):
def setupUi(self,... | 1.84375 | 2 |
_integration/python-pymysql/test.py | jfrabaute/go-mysql-server | 114 | 12787892 | # Copyright 2020-2021 Dolthub, 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 agreed to... | 2.65625 | 3 |
Members.py | Raffy27/DiscordTool | 17 | 12787893 | from selenium import webdriver
from time import sleep
import json
import Client
t = Client.get_servers_raw()
if t == None:
print('Failed to get the list of servers')
raise SystemExit
if len(t) == 0:
print('The list of servers is empty')
raise SystemExit
print(f'Added {len(t)} servers to the queue')
wi... | 2.84375 | 3 |
peer/entity/urls.py | enriquepablo/peer | 0 | 12787894 | # Copyright 2011 Terena. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the fol... | 1.265625 | 1 |
examples/wordcount_streaming.py | Prabhu19/pyspark-unittesting | 79 | 12787895 | <reponame>Prabhu19/pyspark-unittesting
""" wordcount example using the rdd api, we'll write a test for this """
from __future__ import print_function
from operator import add
def do_streaming_word_counts(lines):
""" count of words in a dstream of lines """
counts_stream = (lines.flatMap(lambda x: x.split())
... | 3.03125 | 3 |
atmPy/data_archives/__init__.py | wblumberg/atm-py | 5 | 12787896 | from . import arm | 1.101563 | 1 |
htx/__init__.py | gucharbon/pyheartex | 27 | 12787897 | from .htx import init_model_server
from .htx import _server as app
| 1.117188 | 1 |
examples/callbacks.py | craigh92/PyInquirer | 0 | 12787898 | <gh_stars>0
from PyInquirer import prompt
operations = [{
'type' : 'list',
'name' : 'operation1',
'message' : 'Choose operation',
'choices' : [
{
'name' : '<NAME>',
'callback' : lambda x: [print("Hello!")]
},
{
'name' : '<NAME>',
... | 2.71875 | 3 |
preprocessing/pre_process_utils.py | CyrusDobbs/mining-argument-relations-using-transformers | 0 | 12787899 | import json
# From Marseille
class CDCPArgumentationDoc:
def __init__(self, file_root, merge_consecutive_spans=True):
self.doc_id = int(file_root[-5:])
self._ann_path = file_root + ".ann.json"
with open(file_root + ".txt") as f:
self.raw_text = f.read()
# annotation... | 2.609375 | 3 |
tests/test___main__.py | oterrier/openapi-python-client | 172 | 12787900 | def test_main(mocker):
app = mocker.patch("openapi_python_client.cli.app")
# noinspection PyUnresolvedReferences
from openapi_python_client import __main__
app.assert_called_once()
| 1.585938 | 2 |
finicityapi/models/certified_institution.py | monarchmoney/finicity-python | 0 | 12787901 | <reponame>monarchmoney/finicity-python
# -*- coding: utf-8 -*-
import finicityapi.models.child_institution
class CertifiedInstitution(object):
"""Implementation of the 'Certified Institution' model.
TODO: type model description here.
Attributes:
name (string): Institution's name
... | 2.734375 | 3 |
slp_utils/utils.py | 66chenbiao/sleepace_verification_tool | 0 | 12787902 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
# @author : <NAME>
# @Email : <EMAIL>
# @Project : Python_Files
# @File : utils.py
# @Software: PyCharm
# @Time : 2021/5/20 下午7:42
"""
import os
import struct
import sys
import time
import traceback
from datetime import datetime
from pathlib import Path
import matplotlib ... | 2.671875 | 3 |
app/exo_currency/api/v1/views.py | jcazallasc/exo-investing | 0 | 12787903 | <filename>app/exo_currency/api/v1/views.py
from rest_framework import generics
from rest_framework.response import Response
from rest_framework.views import APIView
from exo_currency.api.v1.pagination import SmallSetPagination
from exo_currency.api.v1.serializers import (
CalculateAmountSerializer, CalculateTimeWe... | 1.953125 | 2 |
sqla_mixins.py | bboe/sqla_mixins | 3 | 12787904 | <reponame>bboe/sqla_mixins
import sys
from passlib.hash import pbkdf2_sha512
from sqlalchemy import Column, DateTime, String, Integer, Unicode, func
from sqlalchemy.ext.declarative import declared_attr, has_inherited_table
if sys.version_info < (3, 0):
builtins = __import__('__builtin__')
else:
import builtins... | 2.359375 | 2 |
python/test_gilded_rose.py | agooding-netizen/GildedRose-Refactoring-Kata | 0 | 12787905 | # -*- coding: utf-8 -*-
import unittest
from gilded_rose import Item, GildedRose
class GildedRoseTest(unittest.TestCase):
def test_concert_under_5(self):
items = [Item("Backstage passes to a TAFKAL80ETC concert", 2, 30)]
gilded_rose = GildedRose(items)
gilded_rose.update_quality()
... | 3.21875 | 3 |
roundup_docx2.py | pythonscriptkiddie/final_roundup | 0 | 12787906 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 23 13:45:44 2019
@author: thomassullivan
"""
import docx
from docx.enum.dml import MSO_THEME_COLOR_INDEX
from objects import Article
def add_hyperlink(paragraph, text, url):
# This gets access to the document.xml.rels file and gets a new relati... | 2.640625 | 3 |
3stage_random_topo/test_spectre_netlist.py | jason-sjy/DVAE_mix2 | 0 | 12787907 | <filename>3stage_random_topo/test_spectre_netlist.py
import os
import sys
import argparse
import logging
import time
import math
import traceback
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
from shutil import copy
import igraph
import torch
from torch import nn, optim
from util import *... | 2.25 | 2 |
tea_main/string-tools/dos2unix/main.py | lbyoo/mytoolbox | 0 | 12787908 | <gh_stars>0
import os
import sys
import user
config = user.config()
def run(path):
if os.path.isfile(path):
if path.endswith(config['suffix']):
with open(path, "r", encoding="utf-8") as f:
tmpfile = open(path+'.tmp', 'w+b')
for line in f:
... | 2.609375 | 3 |
loaders/mnist.py | ddomurad/simple_mlp | 0 | 12787909 | <filename>loaders/mnist.py
import matplotlib.pyplot as plt
import numpy as np
import os
import gzip
def get_network_constrains():
return (784, 10)
def plot(data):
img_size = int(len(data)**0.5)
plt.imshow(np.matrix(data).reshape(img_size, img_size), cmap='gray')
def _normalize(data):
data = data/np.l... | 2.703125 | 3 |
platypush/plugins/tcp.py | RichardChiang/platypush | 228 | 12787910 | import base64
import json
import socket
from typing import Optional, Union
from platypush.plugins import Plugin, action
class TcpPlugin(Plugin):
"""
Plugin for raw TCP communications.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._sockets = {}
def _connect(s... | 2.75 | 3 |
tinybrain.py | StefanKopieczek/tinybrain | 0 | 12787911 | <filename>tinybrain.py<gh_stars>0
import sys;p=sys.argv[1]
def w(c):s=sys.stdout;s.write(str(c)+' ');s.flush()
i=j=0;d=[0];a=abs;b=bool
while i<len(p):
s=0;x,y=p[i],d[j]
if x=='>':d+=[0];j+=1
elif x=='<':d=[0]+d
elif x in '+-':d[j]+=(-1,1)[x=='+']
elif x=='.':w(d[j])
elif x==',':d[j]=(input('>'))
elif x in '[]':... | 2.65625 | 3 |
src/course4/week2/tests/test_tsp.py | manoldonev/algo1-assignments | 0 | 12787912 | """Week2 Test Cases Traveling Salesman Problem"""
import math
from src.course4.week2.tsp import generate_complete_euclidean_distanace_graph, traveling_salesman_problem
def test_tsp1():
points = [(1, 1), (4, 1), (1, 4), (4, 4)]
result = traveling_salesman_problem(points)
assert result == 12
def test_ts... | 3.296875 | 3 |
lungmask/data_io.py | kwxu/lungmask | 0 | 12787913 | <reponame>kwxu/lungmask
import os
from utils import read_file_contents_list, convert_flat_2_3d, get_logger
import nibabel as nib
import numpy as np
import pickle
logger = get_logger('DataFolder')
class DataFolder:
def __init__(self, in_folder, data_file_list=None):
self._in_folder = in_folder
sel... | 2.40625 | 2 |
src/py/validation/validation.py | meetup/jira-onboarding | 5 | 12787914 | <gh_stars>1-10
from jira_instance.jira_instance import check_jira_server
import sys, traceback
## Run validation checks on a given configuration json object
def validate_config(config_json):
try:
assert "server" in config_json # config must have server specified
assert check_jira_server(config_json["server"]... | 2.6875 | 3 |
mbuild/lib/bulk_materials/__init__.py | daico007/mbuild | 101 | 12787915 | """mBuild bulk materials library."""
from mbuild.lib.bulk_materials.amorphous_silica_bulk import AmorphousSilicaBulk
| 1.257813 | 1 |
SKALA4 in phase0.py | ska-telescope/ska-rfi-monitoring-processing | 0 | 12787916 | <reponame>ska-telescope/ska-rfi-monitoring-processing<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 14:28:07 2019
Reads a TDD data file from LFAA PHASE 0 experiment
@author: f.divruno
"""
import os, os.path
import numpy as np
import matplotlib.pyplot as plt
from math import *
import matplotlib
import ... | 2.53125 | 3 |
cpc/asm/Instruction.py | U-Ar/Cpresto | 1 | 12787917 | from .Assembly import Assembly
class Instruction(Assembly):
def __init__(self,a1,a2=None,a3=None,a4=None,a5=False):
if isinstance(a3,list):
self.mnemonic = a1
self.suffix = a2
self.operands = a3
self.need_relocation = a4
else :
if a4 != No... | 3.28125 | 3 |
scripts/email_data_trigger.py | EdinburghGenomics/clarity_scripts | 2 | 12787918 | #!/usr/bin/env python
import platform
from EPPs.common import SendMailEPP
class DataReleaseTrigger(SendMailEPP):
"""Notifies the bioinformatics team to release data for a project."""
def _run(self):
if len(self.projects) > 1:
raise ValueError('More than one project present in step. Only o... | 2.421875 | 2 |
t_rex/loader.py | RoboCopGay/TextAnalizer | 0 | 12787919 | <filename>t_rex/loader.py
import re as REGEX
from yaml import safe_load as yaml
from .dictionary import *
from .file import *
class Config:
class Element:
named_keys = []
class Local:
def __init__ ( self, _local ):
self.keywords = {}
self.names = Non... | 2.71875 | 3 |
app/__init__.py | Brunoro811/api_dangels | 0 | 12787920 | <gh_stars>0
from flask import Flask
from environs import Env
from app import routes
from app.configs import database, migrations, cors
from app.default import default_types_users, default_client, default_types_sales
env = Env()
env.read_env()
def create_app():
app = Flask(__name__)
app.config["SQLALCHEMY_... | 2.078125 | 2 |
pretrained_mol_sim/molecule_optimization/simulation9/grammar/run_bo.py | allisontam/graph_coattention | 0 | 12787921 | <filename>pretrained_mol_sim/molecule_optimization/simulation9/grammar/run_bo.py
import pickle
import gzip
def decode_from_latent_space(latent_points, grammar_model):
decode_attempts = 500
decoded_molecules = []
for i in range(decode_attempts):
current_decoded_molecules = grammar_model.decode(lat... | 2.421875 | 2 |
pyFileFixity/replication_repair.py | hadi-f90/pyFileFixity | 0 | 12787922 | #!/usr/bin/env python
#
# Replication repair
# Copyright (C) 2015 <NAME>
#
# Licensed under the MIT License (MIT)
#
# 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, includ... | 1.59375 | 2 |
application.py | archman/unicorn-webapp | 1 | 12787923 | # -*- coding: utf-8 -*-
from app import app as application
if __name__ == '__main__':
application.run(host="0.0.0.0", debug=True)
| 1.382813 | 1 |
src/pykemon_battle/pokemon.py | icydux/pykemon_battle | 0 | 12787924 | from .utils.utilities import (
get_pokemon_info,
choose_best_moveset,
randomly_choose_moveset,
manually_choose_moveset,
choose_first_four_moves_for_now,
)
from .move import Move
class Pokemon:
"""
A pokemon is a class that represents a pokemon.
"""
def __init__(self, poke_id):
... | 3.03125 | 3 |
bf_bid.py | dssg/mlpolicylab_fall20_bills1_public | 0 | 12787925 | import pandas as pd
import psycopg2 as pg2
import yaml
import io
import ohio.ext.pandas
from sqlalchemy import create_engine
def open_db_connection(secrets_file="secrets.yaml", verbose=True):
"""
Opens connection to psql db
:return:
connection object
"""
try:
with open(secrets_... | 3.203125 | 3 |
xhale/_version.py | jupyter-xeus/xhale | 2 | 12787926 | <reponame>jupyter-xeus/xhale<gh_stars>1-10
#############################################################################
# Copyright (c) 2018, <NAME>, <NAME> and <NAME> #
# #
# Distributed under the terms of the BSD 3-Clause License. ... | 1.601563 | 2 |
recipes/Python/577236_ur1ca_commandline_client/recipe-577236.py | tdiprima/code | 2,023 | 12787927 | #!/usr/bin/env python
"""ur1.py -- command-line ur1.ca client.
ur1.ca is the URL shortening services provided by status.net. This script
makes it possible to access the service from the command line. This is done
by scraping the returned page and look for the shortened URL.
USAGE:
ur1.py LONGURL
RETURN STATUS:
... | 3.609375 | 4 |
app/config.py | okosioc/flask-seed | 3 | 12787928 | <reponame>okosioc/flask-seed
DOMAIN = 'flask-seed.com'
ENV = 'production'
DEBUG = False
SECRET_KEY = '<FIXME>'
CACHE_TYPE = "SimpleCache"
CACHE_DEFAULT_TIMEOUT = 300
CACHE_THRESHOLD = 10240
ACCEPT_LANGUAGES = ['en', 'zh']
BABEL_DEFAULT_LOCALE = 'en'
BABEL_DEFAULT_TIMEZONE = 'UTC'
DEBUG_LOG = 'logs/debug.log'
ERROR... | 1.578125 | 2 |
examples/using_parameters.py | danielk333/pyant | 1 | 12787929 | <gh_stars>1-10
'''
Using parameters
=================
'''
import matplotlib.pyplot as plt
import numpy as np
import pyant
beam = pyant.Airy(
azimuth=[0, 45.0, 0],
elevation=[89.0, 80.0, 60.0],
frequency=[930e6, 230e6],
I0=10**4.81,
radius=np.linspace(10,23.0,num=20),
)
k = np.array([0,0,1.0]).T
#... | 3.265625 | 3 |
Other/Python/DetectCapitals.py | siddharth952/Interview-Prep | 0 | 12787930 | <filename>Other/Python/DetectCapitals.py<gh_stars>0
def detectCapitals(word:str):
# Flag to keep track of the cases
c = 0
for i in word:
if i == i.upper():
c += 1
# If all words are small || If first cap and rest are small || All are caps
return c == len(word) or (c == 1 and ... | 3.671875 | 4 |
venv/venv/Scripts/django-admin.py | RawFlash/BabyShoesShop | 0 | 12787931 | <reponame>RawFlash/BabyShoesShop<gh_stars>0
#!c:\users\30026663\desktop\learn\c9b1~1\sayt1\sayt1\venv\venv\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 1.148438 | 1 |
recursividade_soma.py | fabiobarreto-data-science/Data-Science---Let-s-Code | 0 | 12787932 | <reponame>fabiobarreto-data-science/Data-Science---Let-s-Code
"""
Desenvolva um script que calcule a soma dos N primeiros números naturais. Utilize a recursividade para obter o resultado.
"""
def soma(n):
if n == 1:
return 1
else:
return n + soma(n - 1)
print(soma(3)) | 3.421875 | 3 |
data/mask_dataset.py | xiaonanQua/experiment | 0 | 12787933 | <gh_stars>0
import xml.etree.ElementTree as ET
import numpy as np
from PIL import Image
import glob
class MaskDataset:
def __init__(self):
# 根目录;数据路径;
self.root = '/home/team/xiaonan/dataset/mask/'
self.data_path = {
'sample': self.root,
'train': self.root,
... | 2.421875 | 2 |
reports/__init__.py | shawnclq/Adversarial-Threat-Detector | 29 | 12787934 | <filename>reports/__init__.py
# Module providing evasion attacks.
from reports.report_utility import ReportUtility
from reports.report_html import HtmlReport
from reports.report_ipynb import IpynbReport
| 1.382813 | 1 |
sebastian/create_toks_conll.py | Emrys-Hong/fastai_sequence_tagging | 23 | 12787935 | from fastai.text import *
import fire
BOS = 'xbos' # beginning-of-sentence tag
FLD = 'xfld' # data field tag
BOS_LABEL = '_bos_'
PAD = '_pad_'
re1 = re.compile(r' +')
def read_file(filepath):
assert os.path.exists(filepath)
sentences = []
labels = []
with open(filepath, encoding='utf-8') as f:
... | 2.828125 | 3 |
codecamp/products/models.py | karuvally/django_brushup | 0 | 12787936 | from django.db import models
from django.urls import reverse
# Create your models here.
class Product(models.Model):
title = models.CharField(max_length=120)
description = models.TextField(null=True)
price = models.DecimalField(decimal_places=2, max_digits=100)
summary = models.TextFiel... | 2.484375 | 2 |
scratch/shawn/trianglewave.py | sasgc6/pysmurf | 3 | 12787937 | import pysmurf
#S = pysmurf.SmurfControl(make_logfile=False,setup=False,epics_root='test_epics',cfg_file='/usr/local/controls/Applications/smurf/pysmurf/pysmurf/cfg_files/experiment_fp28_smurfsrv04.cfg')
import numpy as np
import time
Vrange=np.linspace(0,0.195/6.,100)+S.get_tes_bias_bipolar(3)
Vrange=[Vrange,Vrang... | 2.21875 | 2 |
main.py | stevillis/ParkingSpaceDetection | 1 | 12787938 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 03 11:19:25 2018
@author: Stévillis and Valdinilson
title: Smart Parking System
"""
import cv2
import numpy as np
import yaml
import time
import markpolygons
def draw_masks(parking_data):
"""
Draw masks in parking_data points.
:param parking... | 3.03125 | 3 |
create-results/utils.py | jphire/iothub-testbed | 0 | 12787939 | <filename>create-results/utils.py
import os
import numpy as np
import scipy as sp
import scipy.stats
import json
tags_map = {
'feed_fetched':'Fetching-feed',
'after_data_fetch':'Fetching-data',
'execution_end':'Executing-code',
'after_data_map':'Mapping-data',
'piece_response_latency':'Hub-latency'... | 2.3125 | 2 |
database/olympics.py | rossgk2/cs257 | 0 | 12787940 | <reponame>rossgk2/cs257
# Written by <NAME> and <NAME>
import psycopg2
import argparse
from config import password
from config import database
from config import user
(connection, cursor) = (None, None)
def main():
arguments = get_parsed_arguments()
# Update the connection and cursor.
(_connection, _cursor) = ... | 3.25 | 3 |
agent/setup.py | kuralabs/coral-dashboard | 0 | 12787941 | <reponame>kuralabs/coral-dashboard
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 KuraLabs S.R.L
#
# 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... | 1.726563 | 2 |
api_yamdb/reviews/management/commands/upload.py | LHLHLHE/api_yamdb | 0 | 12787942 | <reponame>LHLHLHE/api_yamdb
import csv
import os
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth import get_user_model
from reviews.models import (Category,
Genre,
GenreTitle,
... | 2.140625 | 2 |
petridish/app/directory.py | Bhaskers-Blu-Org2/petridishnn | 121 | 12787943 | <reponame>Bhaskers-Blu-Org2/petridishnn
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import glob
import re
from petridish.philly.container import is_philly
from petridish.app.multi_proc import has_stopped
"""
Dir structures
"""
def _updir(d, n=1):
for _ in range(n):
... | 1.84375 | 2 |
idioms_examples/zip/zip.py | jjmerchante/Pythonic-webserver | 3 | 12787944 | <reponame>jjmerchante/Pythonic-webserver<filename>idioms_examples/zip/zip.py
names = ["John", "Alexander", "Bob"]
marks = [5.5, 7, 10]
for name, mark in zip(names, marks):
print(name, mark)
# Jhon 5.5
# Alexander 7
# Bob 10
| 2.984375 | 3 |
MyFirstApps/Calculator/BlaCal-V-3-0-0/BlaCal-3-0-0.py | EnzoH8321/Minis | 0 | 12787945 | <reponame>EnzoH8321/Minis<gh_stars>0
# BlaCal Version 3.0.0
# Programmer BlackIQ
# Library
import math
from termcolor import colored
# Colorising with termcolor
welcome = colored('welcome to BlaCal calculator !', 'blue')
version = colored('verson 3.0.0', 'blue')
jobs = colored('these are the jobs that this program ca... | 3.4375 | 3 |
dash_mdc_neptune/themes/utils.py | noosenergy/dash-mdc-neptune | 0 | 12787946 | import base64
import pathlib
from typing import List, Tuple
STATIC_DIR = pathlib.Path(__file__).parent / "static"
def _get_img_uri(img_file: str) -> str:
img_path = STATIC_DIR / img_file
with img_path.open(mode="rb") as f:
img_data = f.read()
encoded = base64.b64encode(img_data).decode("ascii")
... | 2.875 | 3 |
plugins/fitter/minimizer.py | xraypy/_xraylarch_attic | 1 | 12787947 | <filename>plugins/fitter/minimizer.py
"""
minimizer for Larch, similar to lmfit-py.
Minimizer is a wrapper around scipy.leastsq, allowing a user to build
a fitting model as a function of general purpose fit parameters which
can be fixed or floated, bounded, or written as larch expressions.
The user sets up a model wi... | 3.125 | 3 |
app/core/migrations/0019_beneficiaire_date_creation.py | rach4you/secteur-app-api | 0 | 12787948 | # Generated by Django 3.0.7 on 2020-06-11 11:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0018_auto_20200609_1810'),
]
operations = [
migrations.AddField(
model_name='beneficiaire',
name='date_creat... | 1.539063 | 2 |
sites/build_index.py | diegosouza/hurl-dev | 0 | 12787949 | #!/usr/bin/env python3
import sys
import json
import re
from pathlib import Path
from typing import List, Optional, Any, Dict
from bs4 import BeautifulSoup, Tag
class Hit:
search: str
title: str
anchor: str
content: str
start: int
def __init__(self,
search: str,
... | 2.890625 | 3 |
LintCode/BFS/20191212_course_schedule_II.py | Fabriceli/MachingLearning | 0 | 12787950 | <reponame>Fabriceli/MachingLearning<filename>LintCode/BFS/20191212_course_schedule_II.py
# -*-coding:utf-8 -*-
# Reference:**********************************************
# @Time : 2019-12-14 13:54
# @Author : <NAME>
# @File : 20191212_course_schedule_II.py
# @User : liyihao
# @Software : PyCharm
# @Descri... | 3.28125 | 3 |