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 |
|---|---|---|---|---|---|---|
cashup/migrations/0002_auto_20170110_2035.py | remarkablerocket/cashup | 0 | 41500 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-10 20:35
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
def populate_new_fields(apps, schema_editor):
TillClosure = apps.get_model('cashup', 'TillClosure... | 1.851563 | 2 |
deeplab_segment.py | Prakadeeswaran05/Simple-Tf-ObjectDetection-SemanticSegmentation-ROS | 9 | 41501 | <gh_stars>1-10
import collections
import os
import io
import sys
import tarfile
import tempfile
import urllib
import rospy
from std_msgs.msg import Header
from sensor_msgs.msg import Image as ros_img
from notcv_bridge import *
from matplotlib import gridspec
from matplotlib import pyplot as plt
import numpy as np
from ... | 2.046875 | 2 |
tests/test_node_symlink.py | odidev/anytree | 700 | 41502 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from nose.tools import eq_
from anytree import AnyNode
from anytree import Node
from anytree import NodeMixin
from anytree import PostOrderIter
from anytree import PreOrderIter
from anytree import SymlinkNode
def test_symlink():
root = Node("root")
s0 = Node("sub0"... | 2.46875 | 2 |
python/akg/ops/array/tile.py | tianjiashuo/akg | 286 | 41503 | # Copyright 2020-2021 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 2.265625 | 2 |
changecsv.py | LinkedModernismProject/web_code | 1 | 41504 | import os
infile = open('20150309Workbookv3_ontology2.csv', 'r', encoding='utf-8')
firstLine = infile.readline()
firstLine.split(',')
tmp = ""
for x in firstLine:
if(x != '\"\"'):
tmp = x
elif(x == '\"\"'):
x = tmp
firstLine = ','.join(firstLine)
outfile = open('outcsv.csv','w')
outfile.write(f... | 2.5625 | 3 |
rcsb/db/tests-mysql/testSchemaDefLoaderDb.py | rcsb/py-rcsb_db | 5 | 41505 | ##
# File: SchemaDefLoaderDbTests.py
# Author: <NAME>
# Date: 29-Mar-2018
# Version: 0.001
#
# Updates:
# 20-Jun-2018 jdw updates for new schema generation and data preparation tools
#
##
"""
Tests for creating and loading rdbms database (mysql) using PDBx/mmCIF data files
and external schema definition.
"""... | 2.265625 | 2 |
gesund_projekt/goals/apps.py | asis2016/gesund-projekt | 0 | 41506 | <gh_stars>0
from django.apps import AppConfig
class GoalsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'goals'
def ready(self):
import goals.signals
| 1.515625 | 2 |
poop/hfdp/factory/challenge/pacific_calendar.py | cassiobotaro/poop | 37 | 41507 | <filename>poop/hfdp/factory/challenge/pacific_calendar.py
from poop.hfdp.factory.challenge.calendar import Calendar
from poop.hfdp.factory.challenge.zone_factory import ZoneFactory
class PacificCalendar(Calendar):
def __init__(self, zone_factory: ZoneFactory) -> None:
self._zone = zone_factory.create_zone... | 2.453125 | 2 |
test_bot/cogs/misc.py | Enegg/disnake | 290 | 41508 | <filename>test_bot/cogs/misc.py
import io
from base64 import b64decode
import disnake
from disnake.ext import commands
class Misc(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
def _get_file(self, description: str) -> disnake.File:
# just a white 100x100 png
dat... | 2.640625 | 3 |
tests/utils.py | canonical/microk8s-addons-repo-template | 0 | 41509 | <filename>tests/utils.py
import datetime
import time
import yaml
from subprocess import check_output, CalledProcessError
def run_until_success(cmd, timeout_insec=60, err_out=None):
"""
Run a command until it succeeds or times out.
Args:
cmd: Command to run
timeout_insec: Time out in second... | 2.71875 | 3 |
wireciendpoint/__init__.py | frawhst/gooncogs | 2 | 41510 | <filename>wireciendpoint/__init__.py<gh_stars>1-10
from redbot.core.bot import Red
from .wireciendpoint import WireCiEndpoint
async def setup(bot: Red):
bot.add_cog(WireCiEndpoint(bot))
| 1.53125 | 2 |
pinolo/tasks.py | piger/pinolo | 2 | 41511 | # -*- coding: utf-8 -*-
"""
pinolo.tasks
~~~~~~~~~~~~
A Task object is a `threading.Thread` instance that will be executed
without blocking the main thread.
This is useful to perform potentially blocking actions like fecthing
resources via HTTP.
:copyright: (c) 2013 <NAME>
:license: BS... | 3.21875 | 3 |
OBS_SYSTEM/StudentFileOperation.py | batux/File-Based-OBS-System | 4 | 41512 | <gh_stars>1-10
from FileWriter import FileWriter
from FileReader import FileReader
from Student import Student
from StudentRecorder import StudentRecorder
from SeekOffsetCalculator import SeekOffsetCalculator
from os import path
class StudentFileOperation(FileReader, FileWriter, SeekOffsetCalculator):
filePath = ... | 3.234375 | 3 |
References/Data.Analysis/TimeSeries/1-5-5.decomposition.py | royqh1979/python_libs_usage | 0 | 41513 | <gh_stars>0
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.seasonal import seasonal_decompose
CBE = pd.read_csv("data/cbe.dat",sep="\t")
CBE.index = pd.date_range(start="1958-01",periods=len(CBE),freq="M")
elec_ts = CBE["elec"]
beer_ts = CBE["beer"]
choc_ts = CBE["choc"]
m... | 2.828125 | 3 |
dnctest.py | nburn42/nburn42_deep_q | 4 | 41514 | <gh_stars>1-10
# Deep Q network
import gym
import numpy as np
import tensorflow as tf
import math
import random
import bisect
import nplot
# HYPERPARMETERS
H = 150
H2 = 150
batch_number = 500
gamma = 0.995
num_of_ticks_between_q_copies = 1000
explore_decay = 0.99999
min_explore = 0.05
max_steps = 499
max_episodes... | 2.1875 | 2 |
filter_rms_error.py | tonyroberts/project-tetra-display | 4 | 41515 | import numpy as np
import matplotlib.pyplot as plt
def filter_rms_error(filter_object,
to_filter_data_lambda,
desired_filter_data_lambda,
dt=0.01,
start_time=0.0,
end_time=10.0,
skip_initial=0... | 3.875 | 4 |
jd_spider.py | lemae/book-compare-price | 1 | 41516 | import requests
from lxml import etree
import urllib3
#京东爬虫
class JdSpider:
def __init__(self):
self.url_temp = "https://search.jd.com/Search?keyword={}"
self.headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safar... | 3.21875 | 3 |
sublime-plugin/poli/main.py | egnartsms/poli | 1 | 41517 | <filename>sublime-plugin/poli/main.py
from poli.command import *
from poli.module import *
from poli.repl import *
from poli.sublime import *
import sublime
import sublime_plugin
from contextlib import contextmanager
from poli import config
from poli.comm import comm
from poli.module import operation as op
from poli.... | 2.03125 | 2 |
imagenet/__init__.py | TrustworthyDL/LeBA | 19 | 41518 | #from .load_data import load_data, preprocess, load_new_images
from .get_model import get_model
| 1.070313 | 1 |
aiomatrix/dispatcher/storage/room_events/engines/__init__.py | Forden/aiomatrix | 2 | 41519 | <filename>aiomatrix/dispatcher/storage/room_events/engines/__init__.py<gh_stars>1-10
from .sqlite import SqliteEventStorageEngine
| 1.085938 | 1 |
unko.py | kentaroy47/deep_running | 0 | 41520 | <reponame>kentaroy47/deep_running<gh_stars>0
print("puripuri")
| 1.085938 | 1 |
Integral approximations visualizer.py | mateo713/visualizing-mathematics | 3 | 41521 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import patches
from matplotlib.legend_handler import HandlerTuple
from scipy.integrate import quad, simps
from math import * #lets the user enter complicated functions easily, eg: exp(3*sin(x**2))
import pyinputplus as pyip # makes taking inputs ... | 2.890625 | 3 |
01_Language/01_Functions/python/mail.py | cliff363825/TwentyFour | 3 | 41522 | # coding: utf-8
import smtplib
msg = "Line 1\nLine 2\nLine 3"
server = smtplib.SMTP('localhost')
server.sendmail('<EMAIL>', '<EMAIL>', msg)
server.quit()
| 2.1875 | 2 |
tests/test_basic.py | mikedh/pypocketing | 10 | 41523 | import os
import trimesh
import unittest
import pocketing
import numpy as np
def get_model(file_name):
"""
Load a model from the models directory by expanding paths out.
Parameters
------------
file_name : str
Name of file in `models`
Returns
------------
mesh : trimesh.Geomet... | 2.625 | 3 |
Python-For-Everyone-Horstmann/Chapter1-Introduction/P1.1.py | islayy/Books-solutions | 0 | 41524 | <gh_stars>0
# Write a program that prints a greeting of your choice, perhaps in a language other
#than English
print("Hey!")
| 2.078125 | 2 |
tests/test_config.py | DuXiao1997/lyrebird | 223 | 41525 | <gh_stars>100-1000
from lyrebird import config
from pathlib import Path
import json
import codecs
def test_create(tmpdir):
custom_config = {"myconf":"myval"}
conf_path = Path(tmpdir)/'conf.json'
with codecs.open(conf_path, 'w', 'utf-8') as f:
f.write(json.dumps(custom_config, indent=4, ensure_asci... | 2.40625 | 2 |
setup.py | swharden/webinspect | 3 | 41526 | <filename>setup.py<gh_stars>1-10
from distutils.core import setup
import webinspect
setup(
name='webinspect',
version=webinspect.__version__,
author='<NAME>',
author_email='<EMAIL>',
packages=['webinspect'],
url='https://github.com/swharden/webinspect',
license='MIT License',
... | 1.710938 | 2 |
Src/AlgorithmLimp.py | sanjeevmk/GLASS | 2 | 41527 | <reponame>sanjeevmk/GLASS<gh_stars>1-10
import torch
torch.manual_seed(10)
torch.cuda.manual_seed_all(10)
import header
import init
import sys
import train_limp
import randomSample
import latentSpaceExplore_VanillaHMC,latentSpaceExplore_NUTSHmc
config = sys.argv[1]
training_params,data_classes,network_params,misc_varia... | 2 | 2 |
scripts/ClusteringEvaluation/evaluator.py | chetanborse007/Patent2Vec | 0 | 41528 | # -*- coding: utf-8 -*-
"""
@File: evaluator.py
@Description: This is an application for evaluating clustering performance
on 20 newsgroup data.
@Author: <NAME>
@EMail: <EMAIL>
@Created_on: 04/05/2017
@python_version: 3.5
==============================================... | 2.203125 | 2 |
medgen/db/dataset.py | reece/medgen | 0 | 41529 | <filename>medgen/db/dataset.py<gh_stars>0
# -*- coding: utf-8 -*-
# from __future__ import absolute_import
from __future__ import unicode_literals, print_function
from pyrfc3339 import parse
import MySQLdb as mdb
import MySQLdb.cursors as cursors
import PySQLPool
from ..log import log, IS_DEBUG_ENABLED
DEFAULT_HOST ... | 2.21875 | 2 |
gui/backend/tests/websocket/sqleditor/mysql_reconnect.py | mike-lischke/mysql-shell-plugins | 11 | 41530 | # Copyright (c) 2022, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but no... | 1.648438 | 2 |
Windowing/Adding Timestamp/ParDo/task.py | EllaDing/beam-katas-python | 0 | 41531 | <reponame>EllaDing/beam-katas-python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Licens... | 2.0625 | 2 |
test/test_pdftables_api.py | amitkishore237/python-pdftables-api | 1 | 41532 | <reponame>amitkishore237/python-pdftables-api
# Copyright 2016 The Sensible Code Company
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 2.265625 | 2 |
scvi/external/__init__.py | njbernstein/scvi-tools | 398 | 41533 | <gh_stars>100-1000
from .cellassign import CellAssign
from .gimvi import GIMVI
from .solo import SOLO
from .stereoscope import RNAStereoscope, SpatialStereoscope
__all__ = ["SOLO", "GIMVI", "RNAStereoscope", "SpatialStereoscope", "CellAssign"]
| 1.242188 | 1 |
flask_tube/app.py | fengluo/flask-tube | 0 | 41534 | <filename>flask_tube/app.py
# -*- coding: utf-8 -*-
import os
import logging
import inspect
from logging.handlers import SMTPHandler, RotatingFileHandler
from werkzeug.utils import import_string, find_modules
from flask import Flask, Blueprint
class App(Flask):
"""Custom Flask Class."""
def __init__(
... | 2.390625 | 2 |
bin/bin_utils.py | minersoft/miner | 1 | 41535 | <reponame>minersoft/miner
#
# Copyright <NAME>, 2014
#
import sys
import os
_isWin32 = (sys.platform == "win32")
def isWin():
return _isWin32
def reopenFileInBinMode(fileobj):
if sys.platform == "win32":
import msvcrt
msvcrt.setmode(fileobj.fileno(), os.O_BINARY)
def copyS... | 2.484375 | 2 |
mysite/recipes/migrations/0031_merge_20161201_0145.py | Jason0705/ICanCook | 0 | 41536 | <filename>mysite/recipes/migrations/0031_merge_20161201_0145.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-01 01:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('recipes', '0030_auto_2016... | 1.09375 | 1 |
models/faster_rcnn.py | hamadichihaoui/pytorch_faster_rcnn | 0 | 41537 | <filename>models/faster_rcnn.py
# --------------------------------------------------------
# Written by <NAME> at 11:54 AM 5/7/2020
# --------------------------------------------------------
import torch
from torch import nn
from utils.config import opt
class FasterRCNN(nn.Module):
def __init__(self, feature_ext... | 2.1875 | 2 |
database/wowaccounts/models.py | DiegoLing33/prestij.xyz-api | 0 | 41538 | <gh_stars>0
# ██╗░░░░░██╗███╗░░██╗░██████╗░░░░██████╗░██╗░░░░░░█████╗░░█████╗░██╗░░██╗
# ██║░░░░░██║████╗░██║██╔════╝░░░░██╔══██╗██║░░░░░██╔══██╗██╔══██╗██║░██╔╝
# ██║░░░░░██║██╔██╗██║██║░░██╗░░░░██████╦╝██║░░░░░███████║██║░░╚═╝█████═╝░
# ██║░░░░░██║██║╚████║██║░░╚██╗░░░██╔══██╗██║░░░░░██╔══██║██║░░██╗██╔═██╗░
# █... | 2.390625 | 2 |
python全栈/day43/day43-6 类装饰器.py | Ringo-li/python_exercise_100 | 0 | 41539 | # 类装饰器,使用类装饰已有函数
class MyDecorator(object):
def __init__(self, func):
self.__func = func
# 实现__call__方法,让实例对象变为像函数一样的可调用对象
def __call__(self, *args, **kwds):
# 对已有函数进行封装
print("课已经讲完了")
self.__func()
@MyDecorator # MyDecorator => show = MyDecorator(show)
def show():
pri... | 3.84375 | 4 |
app/modules/folderCreator.py | KevinMidboe/seasonedShows | 2 | 41540 | <filename>app/modules/folderCreator.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: KevinMidboe
# @Date: 2017-03-05 13:52:45
# @Last Modified by: KevinMidboe
# @Last Modified time: 2017-03-05 17:14:25
import sqlite3, json, os, tweepy
from re import sub
dbPath = 'shows.db'
consumer_key, consumer_secr... | 2.125 | 2 |
competitive/AtCoder/ABC216/D_giveup.py | pn11/benkyokai | 0 | 41541 | import bisect
from collections import deque
from copy import deepcopy
from fractions import Fraction
from functools import reduce
import heapq as hq
import io
from itertools import combinations, permutations
import math
from math import factorial
import re
import sys
sys.setrecursionlimit(10000)
#from numba import nji... | 2.734375 | 3 |
network/signals.py | lavenderca/genomics-network | 3 | 41542 | # from django.core.cache import cache
from django.contrib.auth.models import User
from django.db.models.signals import post_delete, post_save, pre_delete
from django.dispatch import receiver
from . import tasks, models
from network.management.commands.update_dendrogram import \
call_update_dendrogram
from network.... | 1.890625 | 2 |
Chapter05/loading-complex-log-files-using-regex/01-apache-access-log-parser-python.py | PacktPublishing/Extending-Power-BI-with-Python-and-R | 25 | 41543 | <gh_stars>10-100
import pandas as pd
import re
with open('D:/<your-path>/Chapter05/loading-complex-log-files-using-regex/apache_logs.txt', 'r') as f:
access_log_lines = f.readlines()
# Define a regex for the information (variables) contained in each row of the log
regex_parts = [
r'(?P<hostName>\S+)', ... | 3.140625 | 3 |
tests/test_api.py | jianzhangbjz/operator-courier | 0 | 41544 | <reponame>jianzhangbjz/operator-courier<filename>tests/test_api.py
import pytest
import yaml
from operatorcourier import api
from operatorcourier.format import unformat_bundle
@pytest.mark.parametrize('directory,expected', [
("tests/test_files/bundles/api/bundle1",
"tests/test_files/bundles/api/bundle1/resul... | 2.4375 | 2 |
example/cat/urls.py | govindsinghr3/s3directmul | 1 | 41545 | <gh_stars>1-10
from django.conf.urls import patterns, url
from .views import MyView
urlpatterns = [
url('', MyView.as_view(), name='form'),
]
| 1.507813 | 2 |
nn_modules/attention.py | pabvald/instagram-caption-generator | 1 | 41546 | import torch
from torch import nn
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Attention(nn.Module):
"""
Attention Network.
"""
def __init__(self, encoder_dim, decoder_dim, attention_dim):
"""
:param encoder_dim: feature size of encoded images
:p... | 3.203125 | 3 |
Simulator.py | densikat/PyRobotSim | 0 | 41547 | <gh_stars>0
import Robot
import Table
from Commands import CommandFactory
def processcommand(command, robot, table):
command = CommandFactory.CommandFactory.getclass(command)
if command is not None:
if command.commandname is not None:
robot.executeinstruction(command, table)
def runinter... | 2.578125 | 3 |
reinforcement_learning/ch4/tflearn_test.py | xSakix/AI_playground | 1 | 41548 | import gym
import random
import numpy as np
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
from statistics import median, mean
from collections import Counter
LR = 1e-3
env = gym.make('CartPole-v0')
env.reset()
goal_steps = 500
score... | 2.828125 | 3 |
2021-08/demo001.py | zhouyuanmin/MyDemo | 0 | 41549 | <gh_stars>0
sql_1 = """INSERT INTO `pt_exam`.`user_order` (`id`, `exam_id`, `user_id`, `order_number`, `pre_pay_number`, `entry_fee`, `actual_pay_fee`, `status`, `pay_url`, `pay_time`, `create_time`) VALUES (NULL, {exam_id}, {user_id}, 'zsyl20210811103413909170a3{user_id}{exam_id}', NULL, 1, 1, 1, 'weixin://wxpay/bizpa... | 1.992188 | 2 |
tree_app/migrations/0001_initial.py | alexepc/sql-tree-perfomance | 2 | 41550 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import mptt.fields
import tree_app.ltreefield
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.RunSQL(
"""
CREATE EXTENSION ltree;
... | 1.75 | 2 |
application/core/factory/account_factory.py | yntonfon/dashboard-plus | 0 | 41551 | from application.core.entity.account import Account
from application.core.port.create_account_port import CreateAccountPort
class AccountFactory(CreateAccountPort):
def create_account(self, payload: dict) -> Account:
return Account(**payload)
| 2.359375 | 2 |
edb/common/binwrapper.py | aaronbrighton/edgedb | 7,302 | 41552 | <filename>edb/common/binwrapper.py
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2019-present MagicStack Inc. and the EdgeDB 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 a ... | 2.1875 | 2 |
tests/test_resource_library_parser.py | tervay/the-blue-alliance | 266 | 41553 | import unittest2
import json
from datafeeds.resource_library_parser import ResourceLibraryParser
class TestResourceLibraryParser(unittest2.TestCase):
def test_parse_hall_of_fame(self):
with open('test_data/hall_of_fame.html', 'r') as f:
teams, _ = ResourceLibraryParser.parse(f.read())
... | 3.109375 | 3 |
tests/test_blog.py | Mzazi25/blogposts | 0 | 41554 | <reponame>Mzazi25/blogposts
import unittest
from app .models import Blog
class BlogModelTest(unittest.TestCase):
'''
Test Class to test the behavior of the Blog Model
'''
def setUp(self):
'''
setup method that runs before every test
'''
self.new_blog = Blog(Blog= 'check... | 3.4375 | 3 |
app/annohub/lib/fileutils.py | inktrap/annohub | 0 | 41555 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from annohub import app
from annohub.lib import error as e
def try_unicode(this_string, errors='strict'):
u''' taken from <https://stackoverflow.com/a/9600161>
and changed so it turns input into unicode
Attention: Order of ENCODINGS_ALLOWED is important.
''... | 3.03125 | 3 |
instana/collector/helpers/google_cloud_run/instance_entity.py | rlopes-ki/python-sensor | 61 | 41556 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021
""" Module to assist in the data collection about the google cloud run service revision instance entity """
import os
from ....log import logger
from instana.collector.helpers.base import BaseHelper
from ....util import DictionaryOfStan
class Instance... | 1.851563 | 2 |
shortener/urls/views.py | theduckfliesagain/url-shortener | 0 | 41557 | from django.shortcuts import render, redirect, get_object_or_404
from .forms import UrlForm
from .models import Url
from django.contrib import messages
def index(req):
if(req.method == "POST"):
form = UrlForm(req.POST)
if form.is_valid():
url, created = Url.objects.get_or_create(long_... | 2.0625 | 2 |
src/simplegallery_bulkcreation/utils.py | hille721/simple-photo-gallery-bulkcreation | 0 | 41558 | <reponame>hille721/simple-photo-gallery-bulkcreation
""" some general helping functions """
import sys
if sys.version_info.major < 3:
sys.exit("Python 2 not supported!")
if sys.version_info.major == 3 and sys.version_info.minor < 18:
from distutils.dir_util import copy_tree
LEGACY_SUPPORT = True
else:
... | 2.609375 | 3 |
final_chal/starter.py | YaBoyWonder/Racecar | 1 | 41559 | <gh_stars>1-10
#!/usr/bin/env python
'''
Github: YaBoyWonder
License: https://github.com/YaBoyWonder/Racecar/blob/master/LICENSE
'''
import rospy
import numpy as np
import cv2
from cv_bridge import CvBridge
from std_msgs.msg import Bool
from sensor_msgs.msg import Image
from constants import STARTER_TOPIC, IMAGE_TO... | 2.53125 | 3 |
Built-In functions in Python.py | MYJOR/Software-Engineering-With-Python | 0 | 41560 | #built in functions
from math import *
#abs() function
number=-120
print(abs(number))
#len() function
name_1='sam'
name_2="JOSH"
print(len(name_1))
#upper()function
print(name_1.upper())
#lower() function
print(name_2.lower())
#replace function
print(name_1.replace(name_1,name_2))
#St... | 4.28125 | 4 |
digsby/src/gui/toolbox/toolbox.py | ifwe/digsby | 35 | 41561 | '''
GUI utilities.
'''
from __future__ import with_statement
from __future__ import division
import config
import functools
import wx, struct
from wx import GetTopLevelWindows, Point, Size
from logging import getLogger; log = getLogger('gui.util')
from traceback import print_exc
from PIL import Image, ImageDraw, ImageF... | 2.078125 | 2 |
s2_organisation_and_version_control/exercise2/src/models/model.py | victor-flindt/MLO_02476_assignment_repo | 0 | 41562 | <filename>s2_organisation_and_version_control/exercise2/src/models/model.py<gh_stars>0
from torch import nn
import torch.nn.functional as F
import torch
class MyAwesomeModel(nn.Module):
def __init__(self):
super(MyAwesomeModel,self).__init__()
self.conv1 = nn.Conv2d(in_channels=1,out_channels=6,kernel_size=5... | 2.765625 | 3 |
backend/users/views.py | hearot/pycon | 0 | 41563 | from django.shortcuts import render
def post_login_view(request):
user = request.user
return render(request, 'users/post-login.html', {
'user': user,
})
| 1.617188 | 2 |
print1.py | shubhamm033/googlepython | 0 | 41564 | <gh_stars>0
#!/usr/bin/python -tt
import sys
def repeat(name,age):
if name == 'Guido' or age ==2:
print 10
else:
print 101
def main():
repeat(sys.argv[1],sys.argv[2])
if __name__ == '__main__':
main() | 3.296875 | 3 |
esrt/old_models/tmp/losses.py | PTYin/ESRT | 18 | 41565 | # 3rd party import
import tensorflow as tf
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.framework import dtypes
# stdlib import
# module import
import model_utils
def UQP_nce_loss(model, user_idxs, query_word_idxs, product_idxs, word_idxs):
"""
Arg... | 2.171875 | 2 |
movie-data-scraper/scripts/title_item.py | srakhe/python-scripts | 0 | 41566 | <filename>movie-data-scraper/scripts/title_item.py
class TitleItem:
def __init__(self, title='', title_type='', genre='', directors='', actors='', run_time='', release_date='',
cover_url=''):
"""
:param title: String. The title of the movie/tv show.
:param title_type: Strin... | 3.359375 | 3 |
Lib/site-packages/guidata/tests/data.py | fochoao/cpython | 0 | 41567 | <reponame>fochoao/cpython
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# <NAME>
# Licensed under the terms of the CECILL License
# (see guidata/__init__.py for details)
"""Unit tests"""
SHOW = False # Do not show test in GUI-based test launcher
import unittest
from guidata.dataset.datatypes import DataSet
f... | 2.546875 | 3 |
spacebar/astro/bodies.py | brandon-sexton/spacebar | 0 | 41568 | class Earth:
"""
Class used to represent Earth. Values are defined using EGM96 geopotential
model. Constant naming convention is intentionally not used since the
values defined here may be updated in the future by introducing other
geopotential models
"""
mu = 3.986004415e5 #km^3/s^2
... | 2.703125 | 3 |
copy-since-prepare.py | ulikoehler/copy-since | 0 | 41569 | <filename>copy-since-prepare.py
#!/usr/bin/env python3
from datetime import datetime
import os
import argparse
def write_reference_timestamp_to_file(filename):
with open(filename, "w") as timestampfile:
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
timestampfile.write(now)
def set_file_access... | 2.96875 | 3 |
bgcArgoDMQC/fplt.py | ArgoCanada/bgcArgoDMQC | 3 | 41570 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
sns.set(style='ticks', context='paper', palette='colorblind')
try:
import cmocean.cm as cmo
cmocean_flag = True
except:
cmocean_flag = False
class pltClass:
def __init__(self):
self.__i... | 2.53125 | 3 |
scripts/dashboard.py | NCAR/jupyterhub-deploy | 1 | 41571 | <reponame>NCAR/jupyterhub-deploy
from invoke import task
from .common import _print_command, _prompt
@task
def install(c):
"""Install kubernetes-dashboard"""
command = (
'arkade install kubernetes-dashboard --wait '
'&& kubectl apply -f k8s/dashboard'
)
_print_command('Install kuberne... | 2.296875 | 2 |
examples/spline/plot_pspline_whittaker.py | derb12/pybaselines | 18 | 41572 | # -*- coding: utf-8 -*-
"""
P-spline versions of Whittaker functions
----------------------------------------
pybaselines contains penalized spline (P-spline) versions of all of the
Whittaker-smoothing-based algorithms implemented in pybaselines. The reason
for doing so was that P-splines offer additional user flexibi... | 2.78125 | 3 |
general/apero_diff/diff_fits.py | njcuk9999/apero-utils | 2 | 41573 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2021-07-08
@author: cook
"""
from astropy.io import fits
from astropy.table import Table
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
# ==================================================... | 2.609375 | 3 |
src/mlalgms/calcutils.py | sandeepbhojwani/foremast-brain | 0 | 41574 |
#import numpy as np
"""
#moving avg
#Parameters
array of ts value
#Returns moving avg
"""
#def moving_average(series, n):
# return np.average(series[-n:])
| 2.984375 | 3 |
PP4E-Examples-1.4/Examples/PP4E/Gui/Tour/Grid/temp.py | AngelLiang/PP4E | 0 | 41575 | """
FAILS-- can't grid and pack in same parent container (here, root window)
"""
from tkinter import *
from grid2 import gridbox, packbox
root = Tk()
frm = Frame(root)
frm.pack() # this works
gridbox(frm) # gridbox must have its own parent in which to grid
packbox(root)
Button(root, text='Quit', c... | 3.21875 | 3 |
noused/test3.py | jerry800416/3dbinpacking | 6 | 41576 | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Rectangle,Circle
import mpl_toolkits.mplot3d.art3d as art3d
fig = plt.figure()
# ax = fig.add_subplot(111, projection='3d')
ax = plt.axes(projection='3d')
x,y,z = 10,0,0
dx,dy,dz = 12,12,10
... | 2.75 | 3 |
boxuegu/boxuegu/apps/users/constants.py | 1111111111122222222223333333333/Django_boxuegu | 0 | 41577 | <filename>boxuegu/boxuegu/apps/users/constants.py
EMAIL_EXPIRES = 60 * 2
| 1.09375 | 1 |
atlas-aapt/external/libcxx/run-tests.py | MaTriXy/atlas | 8,865 | 41578 | #
# Copyright (C) 2015 The Android Open Source Project
#
# 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 la... | 2.078125 | 2 |
learning_python/ch24.py | ykyang/org.allnix.python | 0 | 41579 | import org.allnix.lp.util;
print(org.allnix.lp.util.read()) | 0.894531 | 1 |
model-optimizer/mo/front/kaldi/extractors/pooling_ext.py | undeadinu/dldt | 1 | 41580 | <gh_stars>1-10
"""
Copyright (c) 2018 Intel 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 a... | 1.632813 | 2 |
section4: methods and functions/2-arguments.py | rpotter12/learning-python | 2 | 41581 | <reponame>rpotter12/learning-python
# *args - arguments - it returns tuple
# **kwargs - keyword arguments - it returns dictionary
def myfunc(*args):
print(args)
myfunc(1,2,3,4,5,6,7,8,9,0)
def myfunc1(**kwargs):
print(kwargs)
if 'fruit' in kwargs:
print('my fruit of choice is {}'.format(kwargs[... | 4.25 | 4 |
zfused_maya/zfused_maya/node/core/referencefile.py | qinningfx/zfused_outsource | 2 | 41582 | # -*- coding: utf-8 -*-
# --author-- lanhua.zhou
""" reference文件操作集合 """
import os
import shutil
import logging
import maya.cmds as cmds
import maya.mel as mm
import pymel.core as pm
import zfused_maya.core.filefunc as filefunc
logger = logging.getLogger(__name__)
def publish_file(files, src, dst):
""" uploa... | 2.09375 | 2 |
sdb/passwords.py | gavinwahl/sdb | 1 | 41583 | import os
import ast
import sys
import math
import time
import string
import hashlib
import tempfile
import subprocess
from operator import itemgetter
from contextlib import contextmanager
from getpass import getpass
import random; random = random.SystemRandom()
import sdb.subprocess_compat as subprocess
from sdb.util... | 2.609375 | 3 |
models/utils/continual_model.py | loribonna/CSSL | 3 | 41584 | # Copyright 2021-present, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from torch.optim import SGD
import torch
import torchvision
from argparse import Namespa... | 2.46875 | 2 |
stressberry/cli.py | clach04/stressberry | 0 | 41585 | import argparse
import datetime
import sys
import threading
import time
import matplotlib.pyplot as plt
import numpy
import yaml
from .__about__ import __copyright__, __version__
from .main import (
cooldown,
measure_temp,
measure_core_frequency,
measure_ambient_temperature,
test,
)
def _get_ver... | 2.546875 | 3 |
Twitter_Topic_Tracker/knapsack.py | CASOS-IDeaS-CMU/What_to_track_on_Twitter_Streaming_API | 0 | 41586 | <reponame>CASOS-IDeaS-CMU/What_to_track_on_Twitter_Streaming_API
from queue import Queue
from functools import lru_cache
from queue import PriorityQueue
from collections import deque
import collections
import numpy as np
def knapsack(items, maxweight):
"""Solve the knapsack problem by finding the most valuable s... | 3.515625 | 4 |
rec/recommender/sknn.py | btwardow/dml4rec | 6 | 41587 | import random
import logging
from math import sqrt
from rec.dataset.dataset import Dataset
from rec.recommender.base import SessionAwareRecommender
from collections import defaultdict, Counter
import tqdm
class SessionKnnRecommender(SessionAwareRecommender):
def __init__(self, k=100, sample_size=1000, similarity... | 2.15625 | 2 |
pyaff4/rdfvalue.py | rmddcr/pyaff4 | 0 | 41588 | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 2.125 | 2 |
scripts/stopping/prepare_data.py | SBUNetSys/DeQA | 1 | 41589 | #!/usr/bin/env python3
import json
import argparse
import os
from collections import OrderedDict
from utils import normalize
from utils import exact_match_score, regex_match_score, get_rank
from utils import slugify, aggregate, aggregate_ans
from utils import Tokenizer
from multiprocessing import Pool as ProcessPool
#... | 2.09375 | 2 |
LittlePerformance/module/_tmp/test.py | TatsuyaOGth/PepperScript | 0 | 41590 | # -*- encoding: UTF-8 -*-
from naoqi import ALProxy
IP = '127.0.0.1'
PORT = 49340
motion_proxy = ALProxy("ALMotion",IP,PORT)
motion_proxy.openHand('LHand')
motion_proxy.openHand('RHand')
| 1.640625 | 2 |
lib/pyexcel/pyexcel/book.py | tinygg/QQ-Groups-Spider | 0 | 41591 | <reponame>tinygg/QQ-Groups-Spider<gh_stars>0
"""
pyexcel.readers
~~~~~~~~~~~~~~~~~~~
Uniform interface for describing a excel book
:copyright: (c) 2014-2015 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
from .iterators import SheetIterator
from .sheets... | 2.6875 | 3 |
opennre/tokenization/basic_tokenizer.py | WinterSoHot/OpenNRE | 3,284 | 41592 | # 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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 2.734375 | 3 |
test/test_db.py | ndrini/10Opportunities | 0 | 41593 | from usefull import read_db
def test_read_csv_db_simple():
'''
page msg parent choice end
1 1. Mi sembra che 0 False False
2 ...se ti trovassi 1 True False
'''
assert read_db('db_simple.csv')[0]['page'] == 1
assert read_db('db_simple.csv')[0]['msg'][-3:] == ... | 2.5625 | 3 |
tests/test_buffer.py | baverman/hisser | 9 | 41594 | <filename>tests/test_buffer.py
from math import isnan
from hisser.buffer import Buffer
def fnan(seq):
return [None if isnan(r) else r for r in seq]
def test_empty_buffer():
buf = Buffer(30, 10, 5, 3, 5000, 0.9, now=1000)
result = buf.flush(5)
assert result is None
def test_flush_max_points():
... | 2.578125 | 3 |
test.py | zhanghanduo/calc_new | 1 | 41595 | #!/usr/bin/env python3
import layers
import cv2
from os.path import join
import numpy as np
# import tensorflow as tf
import Augmentor
vw = 320
vh = 320
class Augment:
def __init__(self):
self.w = 2 * 640
self.h = 2 * 480
self.canvas = np.zeros((self.h, self.w, 3), dtype=np.uint8)
d... | 2.78125 | 3 |
supporting/errorcodes.py | jacbeekers/devops_supporting_tools | 0 | 41596 | # MIT License
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | 1.382813 | 1 |
dvm/dvm_plot.py | hangulu/dvm | 2 | 41597 | <gh_stars>1-10
"""
This module implements plotting tools for the Discrete Voter Model for
ecological inference.
"""
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np
from scipy import interpolate
import seaborn as sns
import tensorflow as tf
i... | 2.796875 | 3 |
TicTacToe/player.py | Eberhofer/TicTacToe | 0 | 41598 | """
player.py - the Player class
------------------------
"""
import TicTacToe.tictactoe as tictactoe
class Player:
""""
Defines a TicTacToe game with an AI opponent.
"""
def __init__(self):
self._winners = tictactoe.winners()
self._state = set()
def play_field(self, f... | 3.921875 | 4 |
src/pymodaq/daq_utils/parameter/pymodaq_ptypes/slide.py | LMSC-NTappy/PyMoDAQ | 0 | 41599 | from qtpy import QtWidgets, QtCore
from pyqtgraph.widgets.SpinBox import SpinBox
from pyqtgraph.parametertree.parameterTypes.basetypes import WidgetParameterItem
from pymodaq.daq_utils.daq_utils import scroll_log, scroll_linear
import numpy as np
class SliderSpinBox(QtWidgets.QWidget):
def __init__(self, *args, s... | 2.515625 | 3 |