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 |
|---|---|---|---|---|---|---|
imagersite/imager_images/views.py | famavott/django-imager | 0 | 12765451 | """Views for imager_images."""
from django.urls import reverse_lazy
from django.views.generic import CreateView, DetailView, ListView, TemplateView, UpdateView
from imager_images.forms import AlbumForm, PhotoForm
from imager_images.models import Album, Photo
class LibraryView(TemplateView):
"""View for library... | 2.703125 | 3 |
setup.py | xrmx/uwsgiit-py | 2 | 12765452 | from setuptools import setup, find_packages
import os
import uwsgiit
CLASSIFIERS = [
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :... | 1.375 | 1 |
130_html_to_csv/190_mkcsv_t_result_odds.py | takobouzu/BOAT_RACE_DB | 6 | 12765453 | <reponame>takobouzu/BOAT_RACE_DB<filename>130_html_to_csv/190_mkcsv_t_result_odds.py
'''
【システム】BOAT_RACE_DB2
【ファイル】180_mkcsv_t_result_odds.py
【機能仕様】レース結果HTMLファイルからレース結果オッズテーブル「t_result_odds」のインポートCSVファイルを作成する
【動作環境】macOS 11.1/Raspbian OS 10.4/python 3.9.1/sqlite3 3.32.3
【来 歴】2021.02.01 ver 1.00
'''
import re
import os... | 2.484375 | 2 |
self_supervised/tensorboard/embedding_projector.py | 36000/myow | 19 | 12765454 | import torch
import tensorflow as tf
import tensorboard as tb
# fix a bug with tensorboard
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile
def log_representation(net, inputs, metadata, writer, step, tag='representation', metadata_header=None,
inputs_are_images=False):
r"""
Computes re... | 2.640625 | 3 |
app/users/views.py | prapeller/phoneauth_api | 0 | 12765455 | <gh_stars>0
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import mixins, viewsets, generics
from rest_framework import status
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.renderers import JSONRenderer, Browsable... | 2.140625 | 2 |
tests/test_parametric_components/test_PortCutterRectangular.py | moatazharb/paramak | 1 | 12765456 |
import unittest
import paramak
class TestPortCutterRectangular(unittest.TestCase):
def test_creation(self):
"""Checks a PortCutterRectangular creation."""
test_component = paramak.PortCutterRectangular(
distance=3,
z_pos=0,
height=0.2,
width=0.4,... | 3.046875 | 3 |
scripts/common/css/uri/authority.py | appcelerator-archive/titanium_mobile_tooling | 2 | 12765457 | # -*- coding: utf-8 -*-
def userinfo( authority, otherwise='' ):
"""Extracts the user info (user:pass)."""
end = authority.find('@')
if -1 == end:
return otherwise
return authority[0:end]
def location( authority ):
"""Extracts the location (host:port)."""
end = authority.find('@')
... | 3.359375 | 3 |
editor/content_table_editor.py | LordKBX/EbookCollection | 1 | 12765458 | # This Python file uses the following encoding: utf-8
import os, sys
import traceback
from PyQt5.QtWidgets import *
import PyQt5.QtCore
import PyQt5.QtGui
import PyQt5.uic
from PyQt5.uic import *
from xml.dom import minidom
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
from common import lang
import ... | 2.28125 | 2 |
Rest Django Framework/myproject/webapp/admin.py | PaulMarcelo/Python | 0 | 12765459 | from django.contrib import admin
from . models import employees
admin.site.register(employees)
| 1.28125 | 1 |
Interview-Preparation/Facebook/Mock/OnSite-03-Design-Add-and-Search-Words-Data-Structures.py | shoaibur/SWE | 1 | 12765460 | <gh_stars>1-10
class TrieNode:
def __init__(self):
self.children = {}
self.isEnd = False
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode()
def addWord(self, word: str) -> None:
"""... | 3.84375 | 4 |
simplerepresentations/utils.py | adrienrenaud/simplerepresentations | 31 | 12765461 | <reponame>adrienrenaud/simplerepresentations
from multiprocessing import Pool
import torch
from tqdm.auto import tqdm
from torch.utils.data import TensorDataset
from simplerepresentations.input_features import InputFeatures
def examples_to_dataset(examples, tokenizer, max_seq_length, process_count, chunksize, verb... | 2.453125 | 2 |
logs/views.py | NGXTDN/webvirtcloud | 1 | 12765462 | import json
from django.http import HttpResponse
from admin.decorators import superuser_only
from instances.models import Instance
from logs.models import Logs
def addlogmsg(user, instance, message):
"""
:param user:
:param instance:
:param message:
:return:
"""
add_log_msg = Logs(user=u... | 2.15625 | 2 |
evaluation.py | LanceaKing/aasist | 36 | 12765463 | <filename>evaluation.py
import sys
import os
import numpy as np
def calculate_tDCF_EER(cm_scores_file,
asv_score_file,
output_file,
printout=True):
# Replace CM scores with your own scores or provide score file as the
# first argument.
... | 2.375 | 2 |
minecraft/migrations/0002_category_date.py | Tosmel2/Python_Django | 0 | 12765464 | <reponame>Tosmel2/Python_Django
# Generated by Django 4.0.1 on 2022-01-24 18:38
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('minecraft', '0001_initial'),
]
operations = [
migratio... | 1.929688 | 2 |
main/migrations/0004_delete_bugreport.py | josylad/RoomScout | 0 | 12765465 | <reponame>josylad/RoomScout<gh_stars>0
# Generated by Django 2.2.7 on 2019-12-11 19:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0003_bugreport'),
]
operations = [
migrations.DeleteModel(
name='BugReport',
),
... | 1.390625 | 1 |
src/mobot_client/tests/factories/__init__.py | mobilecoinofficial/mobot | 6 | 12765466 | # Copyright (c) 2021 MobileCoin. All rights reserved.
from decimal import Decimal
import factory
import pytz
from django.utils import timezone
from datetime import timedelta
from faker.factory import Factory
from faker.providers import date_time, internet, phone_number, lorem
Faker = Factory.create
fake = Faker()
fa... | 2.078125 | 2 |
speedex/adminzone/refgen.py | 97-63/Django-project | 0 | 12765467 | <gh_stars>0
import random#modeule generating random nos
def getref():
refno='sp'
for i in range(1,3):#here range(1,3) means for(i>=1;i<=3;i++)
n=random.randrange(1,5)
refno+=str(n)
n=random.randrange(0,7)
refno +=str(n)
n = random.randrange(3,9)
refno +=str(n)
... | 3.1875 | 3 |
loss/IQA/watson.py | milesgray/CALAE | 0 | 12765468 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..dct2d import Dct2d
EPS = 1e-10
def softmax(a, b, factor=1):
concat = torch.cat([a.unsqueeze(-1), b.unsqueeze(-1)], dim=-1)
softmax_factors = F.softmax(concat * factor, dim=-1)
return a * softmax_factors[:,:,:,:,0] + b * softmax_fact... | 2.6875 | 3 |
paper_example.py | PhysiCell-Tools/DAPT-example | 1 | 12765469 | import os, platform
import dapt
config = dapt.Config(path='config.json')
db = dapt.db.Delimited_file('parameters.csv', delimiter=',')
params = dapt.Param(db, config=config)
p = params.next_parameters()
while p is not None:
dapt.tools.create_XML(p, default_settings="PhysiCell_settings_default.xml", save_settings=... | 2.125 | 2 |
examples/ssd1306_pillow_openweather.py | coding-world/SSD1306-python | 0 | 12765470 | <gh_stars>0
import socket
import fcntl
import struct
import board
import digitalio
import requests
import time
import os.path
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306
from io import BytesIO
import cairosvg
# set pins and init oled
RESET_PIN = digitalio.DigitalInOut(board.D4)
i2c = board.I2C(... | 2.328125 | 2 |
main.py | Draichi/Bitcoin-Trader-RL | 0 | 12765471 | <gh_stars>0
import gym
from stable_baselines.common.policies import MlpPolicy
from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines import PPO2
from env.BitcoinTradingEnv import BitcoinTradingEnv
import pandas as pd
train_df = pd.read_csv('./datasets/bot_train_ETHBTC_700_hour.csv')
train_df ... | 2.0625 | 2 |
RecommenderModule/evaluation/evaluation_item_based.py | amir-rahim/BookClubSocialNetwork | 4 | 12765472 | <filename>RecommenderModule/evaluation/evaluation_item_based.py
from RecommenderModule.recommenders.item_based_recommender import ItemBasedRecommender
from RecommenderModule.evaluation.evaluator import Evaluator
"""This class evaluates item-based collaborative filtering recommenders with
different parameters, in o... | 2.765625 | 3 |
Predictions/Flinc_theory_inputs/inputs/MakeNofZForCosmosis_function.py | KiDS-WL/Cat_to_Obs_K1000_P1 | 7 | 12765473 | <reponame>KiDS-WL/Cat_to_Obs_K1000_P1
#NZDATA = T // This sentinel marks the extension as n(z) data
#EXTNAME = NAME // The name of this n(z) kernel.
#NBIN = 5 // Integer number of tomographic bins
#NZ = 100 // Integer number of histogram bins
#The extension must then contain thes... | 2.375 | 2 |
jsparse/weiboUserInfo/__init__.py | PyDee/Spiders | 6 | 12765474 | user_info = {
"ok": 1,
"data": {
"avatar_guide": [],
"isStarStyle": 0,
"userInfo": {
"id": 3112824195,
"screen_name": "琪琪琪咩Sickey",
"profile_image_url": "https:\/\/tvax3.sinaimg.cn\/crop.0.0.996.996.180\/b989ed83ly8gcdemg2y21j20ro0rotas.jpg?KID=imgbed,... | 1.515625 | 2 |
snake_OOP/score.py | M4rkopolo/turtle_OOP_inheritance | 0 | 12765475 | <reponame>M4rkopolo/turtle_OOP_inheritance
from turtle import Turtle
class Score(Turtle):
def __init__(self):
super().__init__()
self.score = 0
with open("hi score.txt", mode="r") as file: #reading the best score
self.hi_score = int(file.read())
self.color("white")
... | 3.875 | 4 |
pyravendb/tests/jvm_migrated_tests/test_crud.py | poissoncorp/ravendb-python-client | 0 | 12765476 | <reponame>poissoncorp/ravendb-python-client
from pyravendb.tests.test_base import TestBase, User
class TestCrud(TestBase):
def setUp(self):
super(TestCrud, self).setUp()
def test_update_property_from_null_to_object(self):
poc = Poc("jacek", None)
with self.store.open_session() as ses... | 2.203125 | 2 |
src/reader.py | epogrebnyak/data-rosstat-boo-light | 0 | 12765477 | <reponame>epogrebnyak/data-rosstat-boo-light
from itertools import islice
from collections import OrderedDict
import os
import pandas as pd
import settings
import streams
import row_parser
from inspect_columns import Columns
from logs import print_elapsed_time
COLUMNS = Columns.COLUMNS
VALID_ROW_WIDTH = len(COLUMNS)... | 2.625 | 3 |
wrench/endmodel/bert_model.py | Stranger469/ARS2 | 0 | 12765478 | <reponame>Stranger469/ARS2
import logging
from typing import Any, Optional, Union, Callable
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from tqdm.auto import trange
from transformers import AdamW, get_linear_schedule_with_warmup, AutoTokenizer
from ..backbone import B... | 1.960938 | 2 |
modules/2.79/bpy/types/WoodTexture.py | cmbasnett/fake-bpy-module | 0 | 12765479 | <reponame>cmbasnett/fake-bpy-module<filename>modules/2.79/bpy/types/WoodTexture.py
WoodTexture.users_object_modifier = None
| 0.941406 | 1 |
rdftools/tools/rdf2rdf.py | cosminbasca/rdftools | 4 | 12765480 | #
# author: <NAME>
#
# Copyright 2010 University of Zurich
#
# 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 applica... | 2.015625 | 2 |
c/tools/shaderdesc.py | gberthou/incremental-voronoi | 0 | 12765481 | <reponame>gberthou/incremental-voronoi
import sys
import re
import extractglsl
typevec = re.compile(r"([biud])?vec([234])")
typemat = re.compile(r"(d)?mat([234])x?([234])?")
typesampler = re.compile(r"([iu])?sampler(.+)")
STYPE_VERT = "vert"
STYPE_FRAG = "frag"
STYPE_GEO = "geo"
STYPE_TCS = "tcs"
STYPE_TES... | 2.171875 | 2 |
setup.py | apnarm/autodock-cron | 0 | 12765482 | <filename>setup.py
#!/usr/bin/env python
from setuptools import setup, find_packages
def parse_requirements(filename):
with open(filename, "r") as f:
for line in f:
if line and line[:2] not in ("#", "-e"):
yield line.strip()
setup(
name="autodock-cron",
version="0.0.... | 2.03125 | 2 |
books/templatetags/books.py | Nuurek/HomeLibrary | 0 | 12765483 | from django.template import Library
from django.forms.models import model_to_dict
from django.contrib.auth.models import User
from books.models import Book
from libraries.models import BookCopy, Lending, Reading
register = Library()
@register.inclusion_tag('books/tags/book_tag.html')
def render_book(book: Book):
... | 2.25 | 2 |
koocook_core/views/__init__.py | KooCook/koocook-dj | 1 | 12765484 | <filename>koocook_core/views/__init__.py
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from .comments import *
from .posts import *
from .recipes import *
from .handlers import *
from .ingredients import *
from .forms import RecipeForm
f... | 2.078125 | 2 |
tests/apps/courses/test_cms_toolbars.py | lunika/richie | 0 | 12765485 | <filename>tests/apps/courses/test_cms_toolbars.py
"""
Test suite of the toolbar extension for organization pages
"""
from django.test.utils import override_settings
from cms.api import create_page
from cms.test_utils.testcases import CMSTestCase
from cms.toolbar.items import Menu, ModalItem
from richie.apps.core.fact... | 1.9375 | 2 |
tests/test_subprocess_test_proxy.py | ustudio/nose_connection_report | 1 | 12765486 | <filename>tests/test_subprocess_test_proxy.py
import mock
import os
import os.path
from nose_connection_report import SubprocessTestProxy
import subprocess
import sys
import unittest
class TestSubprocessTestProxy(unittest.TestCase):
@mock.patch("subprocess.Popen")
def test_calls_test_inside_strace(self, moc... | 2.390625 | 2 |
mailpimp.py | kradalby/mailpimp | 0 | 12765487 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import configparser
import email
import logging
import logging.config
import os
import sys
from list import ListManager
from mailgun import MailGunSMTP
logger = logging.getLogger(__name__)
CONFIG_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)... | 2.296875 | 2 |
Chapter 04/4.01/model.py | ACsBlack/Tkinter-GUI-Application-Development-Blueprints-Second-Edition | 120 | 12765488 | <filename>Chapter 04/4.01/model.py<gh_stars>100-1000
"""
Code illustration: 4.01
@ Tkinter GUI Application Development Blueprints
"""
from configurations import *
class Model():
def __init__(self):
pass
| 1.539063 | 2 |
notifications_utils/letter_timings.py | alphagov-mirror/notifications-utils | 0 | 12765489 | <filename>notifications_utils/letter_timings.py
from collections import namedtuple
from datetime import datetime, time, timedelta
import pytz
from govuk_bank_holidays.bank_holidays import BankHolidays
from notifications_utils.countries.data import Postage
from notifications_utils.timezones import (
convert_utc_to... | 2.609375 | 3 |
AtC_Gra_Con_001-010/AGC001/B.py | yosho-18/AtCoder | 0 | 12765490 | n, x = map(int, input().split())
if (x > n // 2 and n % 2 == 0) or (x > (n + 1) // 2 and n % 2 == 1):
x = n - x
A = n - x
B = x
k = 0
m = -1
ans = n
while m != 0:
k = A // B
m = A % B
ans += B * k * 2
if m == 0:
ans -= B
A = B
B = m
print(ans) | 2.8125 | 3 |
simpleapi/message/formatter.py | ghuntley/simpleapi | 1 | 12765491 | # -*- coding: utf-8 -*-
import cPickle
from common import json
try:
import yaml
has_yaml = True
except ImportError:
has_yaml = False
from py2xml import PythonToXML
from sajson import SimpleAPIEncoder, SimpleAPIDecoder
__all__ = ('formatters', 'Formatter')
class FormattersSingleton(object):
"""This... | 2.515625 | 3 |
streammorphology/__init__.py | adrn/StreamMorphology | 0 | 12765492 | <reponame>adrn/StreamMorphology
import os
project_path = os.path.split(os.path.split(__file__)[0])[0]
del os
# Three orbits:
import numpy as np
from collections import OrderedDict
three_orbits = OrderedDict([
('near-resonant', np.array([17.0, 0.0, 26.060606060606062, 0.0, 0.12912205829404055, 0.0])), # resonant
... | 1.835938 | 2 |
amrlib/alignments/faa_aligner/faa_aligner.py | plandes/amrlib | 103 | 12765493 | <filename>amrlib/alignments/faa_aligner/faa_aligner.py
import os
import sys
import json
import subprocess
import logging
import tarfile
from .preprocess import preprocess_infer
from .postprocess import postprocess
from .get_alignments import GetAlignments
from ..penman_utils import to_graph_line
from ...defau... | 2.21875 | 2 |
day6/part2/lantern_fish_256.py | kreako/advent-of-code-2021 | 0 | 12765494 | from collections import defaultdict
class Fishes(object):
def __init__(self, ages):
self.ages = defaultdict(int)
for age in ages:
self.ages[age] += 1
def next_generation(self):
new_born = self.ages[0]
for i in range(8):
self.ages[i] = self.ages[i + 1]
... | 3.453125 | 3 |
examples/rkhs.py | gautam1858/autograd | 6,119 | 12765495 | <filename>examples/rkhs.py
"""
Inferring a function from a reproducing kernel Hilbert space (RKHS) by taking
gradients of eval with respect to the function-valued argument
"""
from __future__ import print_function
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.extend import primitive, def... | 3.046875 | 3 |
Scripts/core/native/animation/__init__.py | velocist/TS4CheatsInfo | 0 | 12765496 | # 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\Core\native\animation\__init__.py
# Compiled at: 2019-04-24 01:24:31
# Size of source mod 2**32: 13189 byte... | 1.90625 | 2 |
adventofcode/2020/10/b.py | nevivurn/cp | 0 | 12765497 | #!/usr/bin/env python3
import sys
nums = list(sorted([0] + [int(line.rstrip()) for line in sys.stdin]))
nums.append(nums[-1] + 3)
dp = [1]
while len(dp) < len(nums):
cur = len(dp)
i = cur-1
cum = 0
while i >= 0 and nums[cur]-nums[i] <= 3:
cum += dp[i]
i -= 1
dp.append(cum)
print... | 3.09375 | 3 |
usenester.py | ColorPenBoy/PythonClass | 0 | 12765498 | import colorpennester
print ("------------------我是分割线-------------------")
movies = ["The Holy Grail", 1975, "<NAME> & <NAME>", 91, ["<NAME>", ["<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>"]]]
# 调用函数
# 函数前面需要加上命名空间 -> 名字与包同名
colorpennester.printListMethod(movies,True,0)
| 3.3125 | 3 |
Chapter01/concurrent_image.py | ibiscum/Learning-Concurrency-in-Python | 0 | 12765499 | <filename>Chapter01/concurrent_image.py
""" Learning Concurrency in Python - Chapter 01 - concurrent image """
import threading
import urllib.request
import time
def download_image(image_path, file_name):
""" Download image. """
print("Downloading Image from ", image_path)
urllib.request.urlretrieve(imag... | 3.953125 | 4 |
phresh/backend/app/db/tasks.py | khayweee/docker-fastapi-postgres | 0 | 12765500 | <gh_stars>0
"""
To Establish database connection and handle
any additional configurations
"""
from fastapi import FastAPI
from databases import Database
from app.core.config import DATABASE_URL
import logging
import os
logger = logging.getLogger(__name__)
async def connect_to_db(app: FastAPI) -> None:
DB_URL = f"... | 2.703125 | 3 |
hive/utils/loggers.py | chandar-lab/RLHive | 81 | 12765501 | import abc
import copy
import os
from typing import List
import torch
import wandb
from hive.utils.registry import Registrable, registry
from hive.utils.schedule import ConstantSchedule, Schedule, get_schedule
from hive.utils.utils import Chomp, create_folder
class Logger(abc.ABC, Registrable):
"""Abstract clas... | 2.625 | 3 |
roomfinder_router/roomfinder_router/router.py | GuillaumeMorini/roomfinder | 14 | 12765502 | #!/usr/bin/env python2.7
import pika, os, sys, json, requests, datetime
import base64, urllib, unicodedata, re
import os, json, requests, sys, re, base64
try:
from BeautifulSoup import BeautifulSoup
from HTMLParser import HTMLParser
except ImportError:
from bs4 import BeautifulSoup
from html.parser ... | 2.703125 | 3 |
utilize.py | YangLi1221/CoRA | 9 | 12765503 | import tensorflow as tf
from functools import reduce
from operator import mul
def assert_rank(tensor, expected_rank, name=None):
"""Raises an exception if the tensor rank is not of the expected rank.
Args:
tensor: A tf.Tensor to check the rank of.
expected_rank: Python integer or list of integ... | 2.984375 | 3 |
caesar.py | milescarberry/simple_caesar_encryption_python | 0 | 12765504 | <filename>caesar.py
import string
alphabets_lower = string.ascii_lowercase
alphabets_upper = string.ascii_uppercase
plain_text = "hkpafh uhtiphy"
shift = len(alphabets_lower) - 7 # len(alphabets_lower) == 26
shift = shift % len(alphabets_lower)
alphabets_lower_shifted = alphabets_lower[shift::1] +... | 4.53125 | 5 |
xpxchain/models/mosaic/mosaic_id.py | Sharmelen/python-xpx-chain-sdk | 1 | 12765505 | """
mosaic_id
=========
Identifier for an asset.
License
-------
Copyright 2019 NEM
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.... | 2.1875 | 2 |
mmdet/models/anchor_heads/__init__.py | ziming-liu/ObjectDet | 0 | 12765506 | from .anchor_head import AnchorHead
from .fcos_head import FCOSHead
from .ga_retina_head import GARetinaHead
from .ga_rpn_head import GARPNHead
from .guided_anchor_head import FeatureAdaption, GuidedAnchorHead
from .retina_head import RetinaHead
from .rpn_head import RPNHead
from .ssd_head import SSDHead
from .... | 1.09375 | 1 |
tests/core/test_rtree.py | apatlpo/pangeo-pyinterp | 0 | 12765507 | <reponame>apatlpo/pangeo-pyinterp<gh_stars>0
# Copyright (c) 2019 CNES
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import pickle
import unittest
import netCDF4
try:
import matplotlib.pyplot
HAVE_PLT = True
except ImportEr... | 1.953125 | 2 |
src/scion/service/test/test_scion_cdipdata.py | scion-network/scion | 0 | 12765508 | <gh_stars>0
#!/usr/bin/env python
__author__ = '<NAME>'
from nose.plugins.attrib import attr
import gevent
import os
from pyon.util.int_test import IonIntegrationTestCase
from pyon.public import BadRequest, NotFound, IonObject, RT, PRED, OT, CFG, StreamSubscriber, log
from ion.agent.control import AgentControl, Str... | 1.617188 | 2 |
test/nmea_queue_test.py | quiet-oceans/libais | 161 | 12765509 | <filename>test/nmea_queue_test.py<gh_stars>100-1000
"""Tests for ais.nmea_queue."""
import contextlib
import unittest
import pytest
import six
from six.moves import StringIO
import ais
from ais import nmea
from ais import nmea_queue
BARE_NMEA = """
# pylint: disable=line-too-long
$GPZDA,203003.00,12,07,2009,00,00,*... | 1.820313 | 2 |
beers/migrations/0022_auto_20171117_1915.py | nvembar/onehundredbeers | 1 | 12765510 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-11-18 00:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('beers', '0021_auto_20171117_1846'),
]
operations = [
migrations.AddField(
... | 1.75 | 2 |
data_loader.py | hassancpu/Temporal-Action-Localization | 0 | 12765511 | <reponame>hassancpu/Temporal-Action-Localization
# coding: utf-8
import os
import json
import random
import numpy as np
import h5py
class Dataloader(object):
'''
Usage:
dataloader = Dataloader(config, 'train')
batch_data = dataloader.batch_data_iterator()
'''
def __init__(self, confi... | 2.21875 | 2 |
core/base/pydantic.py | cleiveliu/django-template | 0 | 12765512 | from pydantic import BaseModel, ValidationError, EmailStr, Field
| 1.328125 | 1 |
tools/handle_noise_wavs.py | BaiYuhaoSpiceeYJ/SEGAN_denoise | 0 | 12765513 | <reponame>BaiYuhaoSpiceeYJ/SEGAN_denoise
###将其中的MP3音频转为wav###
import glob
import os
import librosa
import time
noise_path = r'C:\Users\SpiceeYJ\Desktop\nn'
mp3_files = glob.glob(noise_path+ r'\*.mp3')
for mp3_file in mp3_files:
filename = (mp3_file.split('\\')[-1]).split('.')[0]
print(filename)
x='ffmpeg ... | 2.8125 | 3 |
python/common/dict.py | yudongjin/public | 0 | 12765514 | <gh_stars>0
#!/usr/bin/env python
#coding=utf-8
'''
File Name: dict.py
Author: dongjin.ydj
mail: <EMAIL>
Created Time: Thu 23 Jun 2016 11:36:31 AM CST
'''
'''
python dict.py
'''
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def dict_to_list(d, value_build_fun = lambda key, value : [key ,value]):
res = []... | 2.96875 | 3 |
run.py | helpsterTee/tes-mapper | 0 | 12765515 | import struct
import sys
import time
import json
import os
from PyQt5.QtCore import QDir, Qt
from PyQt5.QtGui import QBrush, QPen
from PyQt5.QtWidgets import (QAction, QApplication, QFileDialog, QLabel, QToolButton, QFileDialog,
QMainWindow, QMenu, QMessageBox, QScrollArea, QSizePolicy, QGridLayout, QLayout, QL... | 2.28125 | 2 |
tests/datasets/serializers/test_serializers.py | Faysalali534/wazimap-ng | 0 | 12765516 | <reponame>Faysalali534/wazimap-ng
import pytest
from wazimap_ng.datasets.serializers import MetaDataSerializer
from tests.datasets.factories import MetaDataFactory, LicenceFactory
@pytest.fixture
def licence():
return LicenceFactory(name="licence name", url="abc url")
@pytest.fixture
def metadata(licence):
r... | 2.625 | 3 |
backend/styleopt.py | mrzzy/Portfolio-I | 1 | 12765517 | #
# styleopt.py
# Artistic Style Transfer
# Optimisation method
# as defined in Gatys et. al
#
import os
import api
import numpy as np
import tensorflow as tf
import keras.backend as K
import matplotlib.pyplot as plt
import stylefn
from PIL import Image
from keras.models import Model, Sequential
from util import app... | 2.484375 | 2 |
Desafios/desafio019.py | sthe-eduarda/Curso-de-python | 0 | 12765518 | from random import randint
a = input('Nome do 1° aluno: ')
b = input('Nome do 2° aluno: ')
c = input('Nome do 3° aluno: ')
d = input('Nome do 4° aluno: ')
esc = randint(1, 4)
print('=' * 12)
print(f'Aluno 1: {a}')
print(f'Aluno 2: {b}')
print(f'Aludo 3: {c}')
print(f'Aludo 4: {d}')
print(f'Escolhido: aluno {esc}')
| 3.53125 | 4 |
FixedBGExamples/RealScalarBH/plotmom.py | KAClough/GRChombo-1 | 3 | 12765519 | # A simple python script to plot the GW
# signals over time, for a chosen mode
import numpy as np;
import matplotlib.pyplot as plt;
# output data for setup
M = 1.0
mu = 0.05
r = 300
symmetry = 4
# make the plot
fig = plt.figure()
# volume integral dataset out
data1 = np.loadtxt("VolumeIntegrals.dat")
timedata = data... | 2.265625 | 2 |
FLASH4.2.1_save/tools/python/flmake/lsruns.py | mtsafarzadeh/FLASHverES | 1 | 12765520 | <reponame>mtsafarzadeh/FLASHverES<gh_stars>1-10
import os
import json
# Relative imports needed
from .. import FLASH_SRC_DIR
from .setup_globals import gvars
from .utils import hash_list_to_dict, hash_dict_to_str
USAGE = ("Searches through local sub-directories\n"
"and lists those which contain flash runs\n"... | 2.484375 | 2 |
board.py | ravitejavalluri/departuresns | 0 | 12765521 | import os
import csv
import datetime
import jinja2
import webapp2
from webapp2_extras import json
from google.appengine.api import urlfetch
from google.appengine.api import memcache
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.auto... | 2.71875 | 3 |
app/utils/environment.py | RandyDeng/InterviewScheduler | 0 | 12765522 | import datetime
import os
# Environmental variables are stored inside a .env file for
# testing locally and on Heroku for staging and production.
# These variables contain extremely sensitive information regarding
# the project and should not be disclosed to anyone except
# the developers working on this project.
ENV... | 2.1875 | 2 |
demosys/effect_templates/cube_simple/dependencies.py | Contraz/demosys-py | 70 | 12765523 | <gh_stars>10-100
import os
from demosys.resources.meta import ProgramDescription
def local(path):
"""
Prepend the effect package name to a path so resources
can still be loaded when copied into a new effect package.
"""
return os.path.join(__name__.split('.')[-2], path)
effect_pack... | 1.703125 | 2 |
plot/plot_hyperopt.py | knowledgetechnologyuhh/goal_conditioned_RL_baselines | 15 | 12765524 | import os
import matplotlib.pyplot as plt
import numpy as np
import json
import seaborn as sns;
from collections import deque
sns.set()
import glob2
import argparse
from cycler import cycler
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.font_manager import Fon... | 2.40625 | 2 |
names.py | ruTESTER/pminer | 6 | 12765525 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import config
EN_NAMES = {
1: 'Bulbasaur', 2: 'Ivysaur', 3: 'Venusaur', 4: 'Charmander',
5: 'Charmeleon', 6: 'Charizard', 7: 'Squirtle', 8: 'Wartortle',
9: 'Blastoise', 10: 'Caterpie', 11: 'Metapod', 12: 'Butterfree',
13: 'Weedle', 14: 'Kakuna', 15: 'Beedrill', 16... | 1.375 | 1 |
InvenTree/users/test_migrations.py | onurtatli/InvenTree | 0 | 12765526 | <reponame>onurtatli/InvenTree
"""
Unit tests for the user model database migrations
"""
from django_test_migrations.contrib.unittest_case import MigratorTestCase
from InvenTree import helpers
class TestForwardMigrations(MigratorTestCase):
"""
Test entire schema migration sequence for the users app
"""
... | 2.34375 | 2 |
app/items.py | roddehugo/patents-scraper | 2 | 12765527 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy import Item, Field
class GooglePatentsItem(Item):
publication_number = Field()
title = Field()
filing_date = Field()
public... | 2.28125 | 2 |
neo/test/iotest/test_elphyio.py | Mario-Kart-Felix/python-neo | 199 | 12765528 | """
Tests of neo.io.elphyo
"""
import unittest
from neo.io import ElphyIO
from neo.test.iotest.common_io_test import BaseTestIO
class TestElphyIO(BaseTestIO, unittest.TestCase):
ioclass = ElphyIO
entities_to_download = [
'elphy'
]
entities_to_test = ['elphy/DATA1.DAT',
... | 2.671875 | 3 |
lstm/src/data/collect_paradigms.py | brightp-py/rnng-and-rts | 0 | 12765529 | <reponame>brightp-py/rnng-and-rts
# Copyright (c) 2018-present, Facebook, Inc.
# 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 argparse
from collections import defaultdict
from data import data_utils
parser = ar... | 2.03125 | 2 |
tests/settings/settings.py | caputomarcos/mongorest | 16 | 12765530 | # -*- encoding: UTF-8 -*-
from __future__ import absolute_import, unicode_literals
from os import environ
from mongorest.settings import settings
from mongorest.testcase import TestCase
class TestSettings(TestCase):
def test_settings_default_values(self):
environ.pop('MONGOREST_SETTINGS_MODULE', None)
... | 1.890625 | 2 |
RecSearch/DataInterfaces/Recommenders/hits.py | matthew-kimm/RecSearch | 0 | 12765531 | from RecSearch.DataInterfaces.Recommenders.Abstract import IMatrixRecommender
import pandas as pd
class IXHITSRecommend(IMatrixRecommender):
def iget_recommendation(self, who: dict, possible: pd.DataFrame, n_column: str, ir_column: str,
req_rating: float, xi: float, tol: float, max_ite... | 2.3125 | 2 |
codewof/programming/content/en/string-concatenation/solution.py | taskmaker1/codewof | 3 | 12765532 | <gh_stars>1-10
string_1 = input("String 1? ")
string_2 = input("String 2? ")
string_3 = input("String 3? ")
print(string_1 + string_2 + string_3)
| 3.453125 | 3 |
lang/py/cookbook/v2/source/cb2_15_5_sol_1.py | ch1huizong/learning | 0 | 12765533 | # give the base class a short, readable nickname
from SimpleXMLRPCServer import SimpleXMLRPCServer as BaseServer
class Server(BaseServer):
def __init__(self, host, port):
# accept separate hostname and portnumber and group them
BaseServer.__init__(self, (host, port))
def server_bind(self):
... | 3.015625 | 3 |
setup.py | nimnull/talkbot | 6 | 12765534 | <reponame>nimnull/talkbot<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
from talkbot import __version__
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'Environment :: Console',
... | 1.484375 | 1 |
metaflow/event_logger.py | RobBlumberg/metaflow | 2 | 12765535 | from .sidecar import SidecarSubProcess
from .sidecar_messages import Message, MessageTypes
class NullEventLogger(object):
def __init__(self, *args, **kwargs):
pass
def start(self):
pass
def log(self, payload):
pass
def terminate(self):
pass
class EventLogger(NullEv... | 2.296875 | 2 |
src/sagemaker_sklearn_extension/preprocessing/encoders.py | perunicic/sagemaker-scikit-learn-extension | 0 | 12765536 | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | 1.859375 | 2 |
proj03/proj03.py | dstingley22/project | 0 | 12765537 | # Name:
# Date:
"""
proj 03: Guessing Game
Generate a random number between 1 and 9 (including 1 and 9).
Ask the user to guess the number, then tell them whether they guessed too low, too high,
or exactly right. Keep the game going until the user types exit.
Keep track of how many guesses the user has taken, and ... | 4.25 | 4 |
rpi/distance.py | inafi/wearovision | 5 | 12765538 | <gh_stars>1-10
import serial
from redis import Redis
cli = Redis("localhost")
ser = serial.Serial('/dev/serial0', 9600)
while (True):
if(ser.in_waiting >0):
line = ser.readline()
print(line)
| 2.5 | 2 |
tests/backend/shellvars.py | edyan/python-anyconfig | 0 | 12765539 | <reponame>edyan/python-anyconfig
#
# Copyright (C) 2016 <NAME> <<EMAIL>>
# Copyright (C) 2017 Red Hat, Inc.
# License: MIT
#
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
# pylint: disable=ungrouped-imports
from __future__ import absolute_import
import anyconfig.backend.shellvars as TT
import... | 2.015625 | 2 |
DynamicProgramming/MaximumSumContiguousSubarray.py | tejasnikumbh/Algorithms | 8 | 12765540 | <filename>DynamicProgramming/MaximumSumContiguousSubarray.py
# Importing standard libraries
import sys
'''
Reads in an integer from stream passed in as the parameter. Simple
parsing function that can read from files as well as standard input
'''
def parseInt(stream):
return int(stream.readline().rstrip())
... | 4.03125 | 4 |
misc/audio/save_block.py | Wenhao-Yang/TwoWayRadio | 1 | 12765541 | <reponame>Wenhao-Yang/TwoWayRadio
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Mon Jul 13 23:11:42 2020
##################################################
from gnuradio import analog
from gnuradio import ... | 2.28125 | 2 |
pyFileMove/mvfiles.py | nmschorr/pyFileMove9 | 0 | 12765542 | '''
Created on Nov 22, 2015
@author: <NAME>
'''
## You need to create a file called "fileslist.py" in the the same directory as this file
## inside fileslist.py you need a line that contains the file types to move
## Put one line in the file the defines the list dirTypes like this:
## dirTypes = ["pdf", "cat", "ca... | 3.296875 | 3 |
openslides_backend/action/tag/__init__.py | reiterl/openslides-backend | 5 | 12765543 | from . import create_update_delete # noqa
| 0.957031 | 1 |
formly/views/design.py | coloradocarlos/formly | 34 | 12765544 | <gh_stars>10-100
from django.core.exceptions import PermissionDenied
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.views.decorators.http import require_POST
from formly.forms.design import (
Fiel... | 2.09375 | 2 |
experimental/registry-dtl/test_compo_service.py | nunet-io/ai-dsl | 7 | 12765545 | <gh_stars>1-10
import sys
import grpc
# import the generated classes
import service.proto_spec.compo_service_pb2_grpc as grpc_compo_grpc
import service.proto_spec.compo_service_pb2 as grpc_compo_pb2
from service import registry
if __name__ == "__main__":
# Call Compo Service
try:
# Ask endpoint and... | 2.4375 | 2 |
Python/self-dividing-numbers.py | sm2774us/leetcode_interview_prep_2021 | 0 | 12765546 | <filename>Python/self-dividing-numbers.py
# Time: O(nlogr) = O(n)
# Space: O(logr) = O(1)
class Solution(object):
def selfDividingNumbers(self, left, right):
"""
:type left: int
:type right: int
:rtype: List[int]
"""
def isDividingNumber(num):
n = num
... | 3.65625 | 4 |
star.py | eli173/star | 0 | 12765547 | <reponame>eli173/star
#80#############################################################################
import sqlite3
import json
from flask import Flask, request, session, g, redirect, \
url_for, abort, render_template, flash
from contextlib import closing
import bcrypt
import game
#cfg
DATABASE = 'db.db'
#
D... | 2.953125 | 3 |
chandra_models/xija/aca/aca_fit_script.py | jzuhone/chandra_models | 0 | 12765548 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import xija
import sys
from os.path import expanduser
home = expanduser("~")
addthispath = home + '/AXAFLIB/xijafit/'
sys.path.insert(0, addthispath)
import xijafit
stars = '*'*80
n = 0
newmodel = xijafit.XijaFit('aca_model_spec.json', start='2014:001'... | 1.992188 | 2 |
bmtrain/checkpointing.py | Achazwl/BMTrain | 19 | 12765549 | import torch
from typing import Callable, TypeVar
from functools import wraps
from . import debug
class ScopedDebugTensorList:
def __init__(self) -> None:
self._hidden_states = []
@property
def hidden_states(self):
return self._hidden_states
def _set_hidden_states(self, hidden_sta... | 2.171875 | 2 |
install-nagios-server/fix_nagios_cfg.py | raychorn/svn_jenkins_projects | 0 | 12765550 | <filename>install-nagios-server/fix_nagios_cfg.py
import re, os, sys
__re__ = re.compile("temp_path=(?P<temp_path>.*)", re.DOTALL | re.MULTILINE)
def find_nagios_cfg(top,target):
print 'DEBUG: top=%s, target=%s' % (top,target)
for folder,dirs,files in os.walk(top):
if (any([f == target for f in... | 2.578125 | 3 |