hexsha stringlengths 40 40 | size int64 3 1.03M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 972 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 972 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 972 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 3 1.03M | avg_line_length float64 1.13 941k | max_line_length int64 2 941k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
786057b639f3a0b5b3e99837cc5b24131f77a024 | 135 | py | Python | conan/tools/meson/__init__.py | Erlkoenig90/conan | da8de69618d75da5ac7d77e0eb7a38ee4d564eb9 | [
"MIT"
] | null | null | null | conan/tools/meson/__init__.py | Erlkoenig90/conan | da8de69618d75da5ac7d77e0eb7a38ee4d564eb9 | [
"MIT"
] | null | null | null | conan/tools/meson/__init__.py | Erlkoenig90/conan | da8de69618d75da5ac7d77e0eb7a38ee4d564eb9 | [
"MIT"
] | null | null | null | # noinspection PyUnresolvedReferences
from conan.tools.meson.toolchain import MesonToolchain
from conan.tools.meson.meson import Meson
| 33.75 | 54 | 0.866667 |
25e5b124b6b979be3bacc05f98eae96c6e33dd1c | 2,419 | py | Python | Software/src/liv/iotConnectors/devicehive/devicehive/utils.py | nadaol/Weather_Station | 5bfb31c2974227fcc8d912e3911f356d4e3fb187 | [
"MIT"
] | null | null | null | Software/src/liv/iotConnectors/devicehive/devicehive/utils.py | nadaol/Weather_Station | 5bfb31c2974227fcc8d912e3911f356d4e3fb187 | [
"MIT"
] | null | null | null | Software/src/liv/iotConnectors/devicehive/devicehive/utils.py | nadaol/Weather_Station | 5bfb31c2974227fcc8d912e3911f356d4e3fb187 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# vim:set et tabstop=4 shiftwidth=4 nu nowrap fileencoding=utf-8:
import json
from datetime import datetime
from urlparse import urlsplit, urljoin
from twisted.internet.protocol import Protocol
from twisted.internet.defer import Deferred, succeed, fail
from twisted.web.iweb import IBodyProducer... | 24.683673 | 90 | 0.628359 |
b0eeb3b14eb48e44ed155665a50a5a04284a9d78 | 478 | py | Python | leetcode-problems/0238_product_of_array_except_self.py | shikhalakra22/Algorithms | 5932b162214add40f4fd3ca217e16217a36823fe | [
"MIT"
] | null | null | null | leetcode-problems/0238_product_of_array_except_self.py | shikhalakra22/Algorithms | 5932b162214add40f4fd3ca217e16217a36823fe | [
"MIT"
] | null | null | null | leetcode-problems/0238_product_of_array_except_self.py | shikhalakra22/Algorithms | 5932b162214add40f4fd3ca217e16217a36823fe | [
"MIT"
] | null | null | null | class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
n = len(nums)
left = [0]*n
right = [0]*n
prod = [0]*n
left[0] = 1
right[n-1] = 1
for i in range(1, n):
left[i] = nums[i - 1] * left[i - 1]
for i in range(n-2, -1,... | 23.9 | 62 | 0.414226 |
e340e8a293a6f085cc11a83f60f04e733bb259a4 | 6,478 | py | Python | maestrowf/conductor.py | usnistgov/corr-maestrowf | 49d67a71a8c116754712048d51cf0bf65d6f7c42 | [
"MIT"
] | null | null | null | maestrowf/conductor.py | usnistgov/corr-maestrowf | 49d67a71a8c116754712048d51cf0bf65d6f7c42 | [
"MIT"
] | null | null | null | maestrowf/conductor.py | usnistgov/corr-maestrowf | 49d67a71a8c116754712048d51cf0bf65d6f7c42 | [
"MIT"
] | null | null | null | ###############################################################################
# Copyright (c) 2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by Francesco Di Natale, dinatale3@llnl.gov.
#
# LLNL-CODE-734340
# All rights reserved.
# This file is part ... | 37.883041 | 79 | 0.628435 |
f76809be6510d2224726358af250aea09c174ecb | 1,471 | py | Python | src/sendMail.py | smrnjeet222/CertificateGenerator | 7567e3fc2b46c529d76e68e1be12921d8582fc35 | [
"MIT"
] | null | null | null | src/sendMail.py | smrnjeet222/CertificateGenerator | 7567e3fc2b46c529d76e68e1be12921d8582fc35 | [
"MIT"
] | null | null | null | src/sendMail.py | smrnjeet222/CertificateGenerator | 7567e3fc2b46c529d76e68e1be12921d8582fc35 | [
"MIT"
] | 2 | 2020-07-26T17:03:02.000Z | 2021-05-02T20:09:42.000Z | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import src.config as con
FROM = con.MAIL
def sendMail(name, toaddr):
# instance of MIMEMultipart
filename = name.replace(" ", "_").lower()+'.pdf'... | 22.984375 | 76 | 0.665534 |
b842effa8e3dfe5899abe828cdf2d55f4e8a903f | 4,308 | py | Python | lib/h8s/service.py | enigmata/h8s-proto-py | 4fa8a14bb80f0ac0fedc11d401412c15d2d033d7 | [
"MIT"
] | null | null | null | lib/h8s/service.py | enigmata/h8s-proto-py | 4fa8a14bb80f0ac0fedc11d401412c15d2d033d7 | [
"MIT"
] | null | null | null | lib/h8s/service.py | enigmata/h8s-proto-py | 4fa8a14bb80f0ac0fedc11d401412c15d2d033d7 | [
"MIT"
] | null | null | null | import os
import importlib
import re
class Service():
"""
A Service class is the generic representation of a service, which is
responsible for carrying out required functions of the service, and
maintaining its own lifecycle.
The attributes of a Service:
Name: Since word uniquely i... | 43.959184 | 131 | 0.645311 |
4a479896f1d1459a4ff434d914f4af1881e24e9e | 1,390 | py | Python | dependencies/panda/Panda3D-1.10.0-x64/direct/interval/MopathInterval.py | CrankySupertoon01/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 3 | 2018-03-09T12:07:29.000Z | 2021-02-25T06:50:25.000Z | direct/src/interval/MopathInterval.py | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 1 | 2018-07-28T20:07:04.000Z | 2018-07-30T18:28:34.000Z | direct/src/interval/MopathInterval.py | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | """MopathInterval module: contains the MopathInterval class"""
__all__ = ['MopathInterval']
import LerpInterval
from panda3d.core import *
from panda3d.direct import *
from direct.directnotify.DirectNotifyGlobal import *
# import Mopath
class MopathInterval(LerpInterval.LerpFunctionInterval):
# Name counter
... | 28.367347 | 70 | 0.607194 |
cb92ced5c698a78273441d98397b8dbb18557e7e | 6,300 | py | Python | frappe/utils/redis_wrapper.py | vinhnguyent090/frappe | 636d9442e2ccf0cfac2d5aace427d8de05f63bd9 | [
"MIT"
] | 5 | 2017-09-12T15:56:31.000Z | 2022-03-09T13:50:21.000Z | frappe/utils/redis_wrapper.py | alexbow2008/frappe | ce592a40b4c5e80a9c6cbdc541105218bf98c966 | [
"MIT"
] | 7 | 2020-03-24T18:15:04.000Z | 2022-02-10T20:52:45.000Z | frappe/utils/redis_wrapper.py | alexbow2008/frappe | ce592a40b4c5e80a9c6cbdc541105218bf98c966 | [
"MIT"
] | 8 | 2019-04-21T07:49:50.000Z | 2021-12-24T20:20:38.000Z | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import redis, frappe, re
from six.moves import cPickle as pickle
from frappe.utils import cstr
from six import iteritems
class RedisWrapper(redis.Redis):
"""Redis client that w... | 26.923077 | 93 | 0.694921 |
92d092c059fea3857092e35472c3865c7ccc5572 | 8,767 | py | Python | graph.py | Goffayoh/py_graphpath | aed73eea19daa860ad365703fa2bfeaba5f0eefe | [
"CNRI-Python"
] | null | null | null | graph.py | Goffayoh/py_graphpath | aed73eea19daa860ad365703fa2bfeaba5f0eefe | [
"CNRI-Python"
] | null | null | null | graph.py | Goffayoh/py_graphpath | aed73eea19daa860ad365703fa2bfeaba5f0eefe | [
"CNRI-Python"
] | null | null | null | # coding: utf-8
import numpy as np
# Définition de la classe Graph contenant la structure d'un graphe ainsi que des différentes fonctions
# permettant les réalistions des deux algorithmes de rendez-vous.
class Graph:
# Structure du graphe
def __init__(self, data):
self.size = data["nbNoeuds"]
... | 47.389189 | 120 | 0.570549 |
e8addd2e5900990c979cf594c5b698b208713bd2 | 66,692 | py | Python | px.py | bedla/px | d6670f27babfc948bb03141d0e95ce26865ba461 | [
"MIT"
] | 1 | 2020-08-06T12:36:44.000Z | 2020-08-06T12:36:44.000Z | px.py | bedla/px | d6670f27babfc948bb03141d0e95ce26865ba461 | [
"MIT"
] | null | null | null | px.py | bedla/px | d6670f27babfc948bb03141d0e95ce26865ba461 | [
"MIT"
] | null | null | null | "Px is an HTTP proxy server to automatically authenticate through an NTLM proxy"
from __future__ import print_function
__version__ = "0.4.0"
import base64
import ctypes
import ctypes.wintypes
import multiprocessing
import os
import select
import signal
import socket
import sys
import threading
import time
import tra... | 34.430563 | 152 | 0.556783 |
3fdc2a647a3512bccff693996e87dcf02307d79b | 471 | py | Python | app/test_health.py | chrisguest75/banner_service | ea0475e4159a84913c4d5a67a054126e82f3e440 | [
"MIT"
] | 1 | 2021-02-23T21:59:26.000Z | 2021-02-23T21:59:26.000Z | app/test_health.py | chrisguest75/banner_service | ea0475e4159a84913c4d5a67a054126e82f3e440 | [
"MIT"
] | null | null | null | app/test_health.py | chrisguest75/banner_service | ea0475e4159a84913c4d5a67a054126e82f3e440 | [
"MIT"
] | null | null | null | import pytest
import connexion
flask_app = connexion.FlaskApp(__name__, specification_dir='./openapi')
flask_app.add_api('./swagger.yaml')
flask_app.testing = True
@pytest.fixture(scope='module')
def client():
with flask_app.app.test_client() as c:
yield c
def test_health(client):
""" Test health en... | 21.409091 | 71 | 0.696391 |
979aae0a1b9e6111bf28f4943a9c3915918dd782 | 7,867 | py | Python | preview_generator/utils.py | asweeney86/preview-generator | 354cbac1c131ebbb81cd9cfd9b4bc0c184d10103 | [
"MIT"
] | null | null | null | preview_generator/utils.py | asweeney86/preview-generator | 354cbac1c131ebbb81cd9cfd9b4bc0c184d10103 | [
"MIT"
] | null | null | null | preview_generator/utils.py | asweeney86/preview-generator | 354cbac1c131ebbb81cd9cfd9b4bc0c184d10103 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from datetime import date
from datetime import datetime
from json import JSONEncoder
import os
import shutil
from subprocess import check_call
import tempfile
import typing
from PyPDF2 import PdfFileReader
from wand.version import formats as wand_supported_format
from preview_generator.extensi... | 32.643154 | 104 | 0.638744 |
e7936cc0535ab5e6e8a86881a995a539784d9a35 | 6,230 | py | Python | homeassistant/components/sensor/openweathermap.py | gwendalg/home-assistant | fb94aaa5a1a1e125dafb681e50c18be45dfe1b19 | [
"MIT"
] | 1 | 2017-02-12T18:44:18.000Z | 2017-02-12T18:44:18.000Z | homeassistant/components/sensor/openweathermap.py | gwendalg/home-assistant | fb94aaa5a1a1e125dafb681e50c18be45dfe1b19 | [
"MIT"
] | null | null | null | homeassistant/components/sensor/openweathermap.py | gwendalg/home-assistant | fb94aaa5a1a1e125dafb681e50c18be45dfe1b19 | [
"MIT"
] | 1 | 2021-02-25T10:32:08.000Z | 2021-02-25T10:32:08.000Z | """
Support for the OpenWeatherMap (OWM) service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.openweathermap/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHE... | 33.494624 | 79 | 0.617496 |
a254617bd948f167093fcdf391f123345660ae35 | 1,247 | py | Python | jp.atcoder/abc060/arc073_b/8237346.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | 1 | 2022-02-09T03:06:25.000Z | 2022-02-09T03:06:25.000Z | jp.atcoder/abc060/arc073_b/8237346.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | 1 | 2022-02-05T22:53:18.000Z | 2022-02-09T01:29:30.000Z | jp.atcoder/abc060/arc073_b/8237346.py | kagemeka/atcoder-submissions | 91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e | [
"MIT"
] | null | null | null | n, W = [int(x) for x in input().split()]
wv = [[int(x) for x in input().split()] for _ in range(n)] # weight, value
min_w = wv[0][0]
for i in range(n):
wv[i].insert(0, wv[i][1] / wv[i][0])
wv.sort(reverse=1) # sort in order that high value per unit weight.
sw = [0] * n # camulative sum of weights
sw... | 27.711111 | 76 | 0.38733 |
dcc358e323d4da561d37ecaac25b7775ee87c28f | 148 | py | Python | docs_src/path_operation_advanced_configuration/tutorial003.py | Aryabhata-Rootspring/fastapi | f6237ad05a8468ac19c591181adad38d75372c46 | [
"MIT"
] | 53,007 | 2018-12-08T10:05:29.000Z | 2022-03-31T23:30:02.000Z | docs_src/path_operation_advanced_configuration/tutorial003.py | Aryabhata-Rootspring/fastapi | f6237ad05a8468ac19c591181adad38d75372c46 | [
"MIT"
] | 4,155 | 2019-01-05T05:07:49.000Z | 2022-03-31T21:25:38.000Z | docs_src/path_operation_advanced_configuration/tutorial003.py | Aryabhata-Rootspring/fastapi | f6237ad05a8468ac19c591181adad38d75372c46 | [
"MIT"
] | 4,092 | 2018-12-09T16:21:00.000Z | 2022-03-31T07:59:45.000Z | from fastapi import FastAPI
app = FastAPI()
@app.get("/items/", include_in_schema=False)
async def read_items():
return [{"item_id": "Foo"}]
| 16.444444 | 44 | 0.682432 |
b8cfe6e8a7df5a671babb7f0f2bfe2f2a2544940 | 13,392 | py | Python | tests/www/views/test_views_log.py | jayantsande25/airflow | d04aa135268b8e0230be3af6598a3b18e8614c3c | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 2 | 2021-07-30T17:22:53.000Z | 2021-08-03T13:51:15.000Z | tests/www/views/test_views_log.py | jayantsande25/airflow | d04aa135268b8e0230be3af6598a3b18e8614c3c | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | tests/www/views/test_views_log.py | jayantsande25/airflow | d04aa135268b8e0230be3af6598a3b18e8614c3c | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2021-08-28T09:47:31.000Z | 2021-08-28T09:47:31.000Z | #
# 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 License, Version 2.0 (the
# "License"); you may not... | 32.347826 | 108 | 0.671744 |
f847ae3ae08d4ce7b42ad8a1d6cfd2db782e029f | 1,259 | py | Python | models/difference.py | ChaokunChang/SVAS | 61af6eb39269edff8ea5147311628b3200c3a3d2 | [
"Apache-2.0"
] | null | null | null | models/difference.py | ChaokunChang/SVAS | 61af6eb39269edff8ea5147311628b3200c3a3d2 | [
"Apache-2.0"
] | null | null | null | models/difference.py | ChaokunChang/SVAS | 61af6eb39269edff8ea5147311628b3200c3a3d2 | [
"Apache-2.0"
] | null | null | null |
from numpy.core.numeric import Inf
import torch
class SimpleDiff():
def __init__(self, diff_thresh=30.0, delay=30) -> None:
self.diff_thresh = diff_thresh
self.delay = delay
def infer(self, frames, delay=None):
if delay is None:
delay = self.delay
num_frames = ... | 35.971429 | 94 | 0.570294 |
f7dbc2e9901dc1323049db23230fd23f2b3b5ede | 191 | py | Python | expense/admin.py | ShyamSundhar1411/Expense-Manager | 8ecc4196619f1666f43fa74f1140c72a1e14b800 | [
"MIT"
] | 1 | 2021-11-10T15:29:22.000Z | 2021-11-10T15:29:22.000Z | expense/admin.py | ShyamSundhar1411/Expense-Manager | 8ecc4196619f1666f43fa74f1140c72a1e14b800 | [
"MIT"
] | null | null | null | expense/admin.py | ShyamSundhar1411/Expense-Manager | 8ecc4196619f1666f43fa74f1140c72a1e14b800 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Expense,Budget,Profile
# Register your models here.
admin.site.register(Expense)
admin.site.register(Budget)
admin.site.register(Profile)
| 27.285714 | 42 | 0.82199 |
2c2c0776a9592d048b2a2656481cdaa527d11ec2 | 444 | py | Python | api/views.py | julianarchila/music_controller | 166936ff9b03fbf7dc0d27db923638ac284636bd | [
"MIT"
] | 1 | 2021-08-07T08:03:52.000Z | 2021-08-07T08:03:52.000Z | api/views.py | julianarchila/music_controller | 166936ff9b03fbf7dc0d27db923638ac284636bd | [
"MIT"
] | null | null | null | api/views.py | julianarchila/music_controller | 166936ff9b03fbf7dc0d27db923638ac284636bd | [
"MIT"
] | null | null | null | """ Api views. """
# Django REST Framework
from rest_framework.viewsets import GenericViewSet
from rest_framework import mixins
# Serializers
from api.serializers import RoomModelSerializer
# Models
from api.models import Room
class RoomViewSet(
mixins.CreateModelMixin,
mixins.ListModelMixin,
... | 21.142857 | 50 | 0.734234 |
77ae80a24d3a27b944e22b681f4072ec80a5295a | 169 | py | Python | src/domain/use_cases/divide.py | panda-coder/py-clean-flask | e7b8af5056178cd1dc6161f52a909f8043dc4b66 | [
"MIT"
] | null | null | null | src/domain/use_cases/divide.py | panda-coder/py-clean-flask | e7b8af5056178cd1dc6161f52a909f8043dc4b66 | [
"MIT"
] | null | null | null | src/domain/use_cases/divide.py | panda-coder/py-clean-flask | e7b8af5056178cd1dc6161f52a909f8043dc4b66 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from domain.dtos import DivideDTO
class Divide(ABC):
@abstractmethod
def calculate(self, params: DivideDTO):
pass
| 16.9 | 43 | 0.721893 |
e0c35b43e304e504503490a3a2636c90f41bacd4 | 2,851 | py | Python | MultiEsenNIC/pycocoevalcap/tokenizer/ptbtokenizer.py | CSnode/Global-Local-Captioning | 7eb420b1217391d03732e220d92e680f0aadb38e | [
"MIT"
] | null | null | null | MultiEsenNIC/pycocoevalcap/tokenizer/ptbtokenizer.py | CSnode/Global-Local-Captioning | 7eb420b1217391d03732e220d92e680f0aadb38e | [
"MIT"
] | null | null | null | MultiEsenNIC/pycocoevalcap/tokenizer/ptbtokenizer.py | CSnode/Global-Local-Captioning | 7eb420b1217391d03732e220d92e680f0aadb38e | [
"MIT"
] | null | null | null | #-*- coding:utf-8 -*-
#!/usr/bin/env python
#
# File Name : ptbtokenizer.py
#
# Description : Do the PTB Tokenization and remove punctuations.
#
# Creation Date : 29-12-2014
# Last Modified : Thu Mar 19 09:53:35 2015
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
import os
import sys
import ... | 40.728571 | 114 | 0.519467 |
99ce67861db52925fd7c7e46be30807ffb2a19d0 | 1,679 | py | Python | samples/carpedrestian/car_pedrestian_api/api/config.py | Risvil/CarPedrestianDetectorAPI | 19beb31c991304115279fef5f231d0408be37989 | [
"MIT"
] | null | null | null | samples/carpedrestian/car_pedrestian_api/api/config.py | Risvil/CarPedrestianDetectorAPI | 19beb31c991304115279fef5f231d0408be37989 | [
"MIT"
] | null | null | null | samples/carpedrestian/car_pedrestian_api/api/config.py | Risvil/CarPedrestianDetectorAPI | 19beb31c991304115279fef5f231d0408be37989 | [
"MIT"
] | null | null | null | import pathlib
import logging
from logging.handlers import TimedRotatingFileHandler
import os
import sys
PACKAGE_ROOT = pathlib.Path(__file__).resolve().parent.parent
FORMATTER = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s -"
"%(funcName)s:%(lineno)d - %(message)s"
)
LOG_DIR = PACKAGE_ROOT / '... | 23.319444 | 64 | 0.724241 |
66e619e99524835511454a826a9afa19c968806b | 109,839 | py | Python | devices/mikrotik/mikrotik_routeros.py | ericorain/netscud | b791ee25c2e60b10f7269c306c4b153914149b22 | [
"Apache-2.0"
] | null | null | null | devices/mikrotik/mikrotik_routeros.py | ericorain/netscud | b791ee25c2e60b10f7269c306c4b153914149b22 | [
"Apache-2.0"
] | null | null | null | devices/mikrotik/mikrotik_routeros.py | ericorain/netscud | b791ee25c2e60b10f7269c306c4b153914149b22 | [
"Apache-2.0"
] | null | null | null | # Python library import
from netscud.base_connection import NetworkDevice, log
import asyncio, asyncssh
# Declaration of constant values
# Max data to read in read function
MAX_BUFFER_DATA = 65535
class MikrotikRouterOS(NetworkDevice):
"""
Class for Mikrotik RouterOS devices
"""
def __init__(self, ... | 31.572003 | 708 | 0.532033 |
cd3e8ded2d7a9f19b9301172ece1f38fba4de2ca | 22,060 | py | Python | source/segment/nnmf_segment.py | lucori/NN-MitralSeg | d20a7348f309db5c86d3f53c3e13c3cfa98a64a6 | [
"MIT"
] | 2 | 2021-09-23T06:35:57.000Z | 2021-12-07T18:04:28.000Z | source/segment/nnmf_segment.py | lucori/NN-MitralSeg | d20a7348f309db5c86d3f53c3e13c3cfa98a64a6 | [
"MIT"
] | null | null | null | source/segment/nnmf_segment.py | lucori/NN-MitralSeg | d20a7348f309db5c86d3f53c3e13c3cfa98a64a6 | [
"MIT"
] | 1 | 2021-05-06T09:07:45.000Z | 2021-05-06T09:07:45.000Z | import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
import os
from segment.nnmf import NNMF
from evaluation import get_scores
from .pytorch_utils import load_dataset, EarlyStopping
from .segment_class import MitralSeg
from sklearn.decomposition import NMF
from utils import... | 48.590308 | 125 | 0.582185 |
f240604d68729dbbbab7bf9c7338ae8223c95211 | 891 | py | Python | challenges/print_level_order/test_print_level_order.py | seattlechem/data-structures-and-algorithms | 376e465c0a5529ea7c5c4e972a9852b6340251ff | [
"MIT"
] | null | null | null | challenges/print_level_order/test_print_level_order.py | seattlechem/data-structures-and-algorithms | 376e465c0a5529ea7c5c4e972a9852b6340251ff | [
"MIT"
] | null | null | null | challenges/print_level_order/test_print_level_order.py | seattlechem/data-structures-and-algorithms | 376e465c0a5529ea7c5c4e972a9852b6340251ff | [
"MIT"
] | null | null | null | """Print level order test."""
from .print_level_order import print_level_order
import pytest
def test_print_level_order_true(small_tree):
"""Confirm if true for level order print."""
result = print_level_order(small_tree)
assert result == '5 \n 9 3 \n '
def test_level_print_large_tree(large_tree):
"... | 29.7 | 64 | 0.690236 |
ab323493cebe8b6bd7431270a57b1a15b093040f | 11,369 | py | Python | bitstream/decoder/cb_translate.py | mfkiwl/NEM-Relay-CGRA | 1ad59b83b9a61ee56da43e5491a95d2f4e6c2ac4 | [
"BSD-3-Clause"
] | 2 | 2021-03-28T08:03:01.000Z | 2021-09-19T08:10:02.000Z | bitstream/decoder/cb_translate.py | mfkiwl/NEM-Relay-CGRA | 1ad59b83b9a61ee56da43e5491a95d2f4e6c2ac4 | [
"BSD-3-Clause"
] | null | null | null | bitstream/decoder/cb_translate.py | mfkiwl/NEM-Relay-CGRA | 1ad59b83b9a61ee56da43e5491a95d2f4e6c2ac4 | [
"BSD-3-Clause"
] | 2 | 2021-03-28T08:02:57.000Z | 2021-11-06T05:14:17.000Z | #!/usr/bin/python
import sys;
import re;
VERBOSE = False
TEST = False
# Test of pass by reference
# def modify(foo):
# foo["bar"] = 'baz'
#
# foo = {}
# modify(foo)
# print foo
# sys.exit(0)
def main():
if TEST:
VERBOSE = True
test_cbfix()
sys.exit(0)
# inputstream = sys.st... | 33.340176 | 86 | 0.53857 |
de579c3ca2ca0aa2feed1de6fa986e945e92028e | 489 | py | Python | easy/202.py | oneTaken/leetcode | f9357d839ac8fa6333b0d7eeb2028ba28a63764c | [
"Apache-2.0"
] | null | null | null | easy/202.py | oneTaken/leetcode | f9357d839ac8fa6333b0d7eeb2028ba28a63764c | [
"Apache-2.0"
] | null | null | null | easy/202.py | oneTaken/leetcode | f9357d839ac8fa6333b0d7eeb2028ba28a63764c | [
"Apache-2.0"
] | null | null | null | class Solution:
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
nums = dict()
square = lambda x: int(x) * int(x)
sum_str = lambda x: sum(list(map(square, x)))
flag = True
while n != 1:
print(n, nums.get(n))
if n... | 23.285714 | 53 | 0.400818 |
9886b6d2b7773026172cda2d30f08709afc7d734 | 191,401 | py | Python | test/test_cuda.py | stungkit/pytorch | 0f05e398705bf15406bce79f7ee57d3935ad2abd | [
"Intel"
] | null | null | null | test/test_cuda.py | stungkit/pytorch | 0f05e398705bf15406bce79f7ee57d3935ad2abd | [
"Intel"
] | 1 | 2022-01-10T18:39:28.000Z | 2022-01-10T19:15:57.000Z | test/test_cuda.py | stungkit/pytorch | 0f05e398705bf15406bce79f7ee57d3935ad2abd | [
"Intel"
] | 1 | 2022-03-26T14:42:50.000Z | 2022-03-26T14:42:50.000Z | # Owner(s): ["module: cuda"]
from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import contextlib
import ctypes
import gc
import io
import os
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cu... | 44.132119 | 126 | 0.594851 |
4132e126f06ee3e98fca3c32a13b83ac619d79c4 | 3,759 | py | Python | rbf.py | antoinebrl/practice-ML | b2c87987871db39255f87732e4ec4dee7179c9b7 | [
"MIT"
] | null | null | null | rbf.py | antoinebrl/practice-ML | b2c87987871db39255f87732e4ec4dee7179c9b7 | [
"MIT"
] | null | null | null | rbf.py | antoinebrl/practice-ML | b2c87987871db39255f87732e4ec4dee7179c9b7 | [
"MIT"
] | null | null | null | # Author : Antoine Broyelle
# Licence : MIT
# inspired by : KTH - DD2432 : Artificial Neural Networks and Other Learning Systems
# https://www.kth.se/student/kurser/kurs/DD2432?l=en
import numpy as np
from kmeans import Kmeans
from pcn import PCN
from utils.distances import euclidianDist
class RBF:
'''Radial Basi... | 37.217822 | 100 | 0.617717 |
1dcf333b31621bda63bfd85eff18831cf4f003de | 12,471 | py | Python | Assignment_01_Linear_Regression/linear_regression_pytorch.py | luwis93choi/ML2020_Class | eb6e0a5b69a68b5c45535cf9738ac697bd722557 | [
"MIT"
] | null | null | null | Assignment_01_Linear_Regression/linear_regression_pytorch.py | luwis93choi/ML2020_Class | eb6e0a5b69a68b5c45535cf9738ac697bd722557 | [
"MIT"
] | null | null | null | Assignment_01_Linear_Regression/linear_regression_pytorch.py | luwis93choi/ML2020_Class | eb6e0a5b69a68b5c45535cf9738ac697bd722557 | [
"MIT"
] | null | null | null | # Reference 01 (Anaconda Installation) : https://docs.anaconda.com/anaconda/install/linux/
# Reference 02 (Anaconda Package Control) : https://niceman.tistory.com/86
# Reference 03 (Anaconda Pytorch Setup) : https://pytorch.org/get-started/locally/
# Reference 04 (Pytorch Linear Regression) : https://greeksharifa.githu... | 59.385714 | 174 | 0.571085 |
1e4dd9269240652d35e1804e0494bc2365b608ec | 12,756 | py | Python | tests/logictest/logictest.py | ZeaLoVe/databend | 4ebc55c5ccff15ed510e93d8c63965f6aa1bd76c | [
"Apache-2.0"
] | null | null | null | tests/logictest/logictest.py | ZeaLoVe/databend | 4ebc55c5ccff15ed510e93d8c63965f6aa1bd76c | [
"Apache-2.0"
] | null | null | null | tests/logictest/logictest.py | ZeaLoVe/databend | 4ebc55c5ccff15ed510e93d8c63965f6aa1bd76c | [
"Apache-2.0"
] | null | null | null | import abc
import collections
import glob
import os
import re
import six
from hamcrest import assert_that, is_, none, is_not
from log import log
# statement is a statement in sql logic test
state_regex = r"^\s*statement\s+(?P<statement>((?P<ok>OK)|((?P<error>)ERROR\s*(?P<expectError>.*))|(?P<query>QUERY\s*((" \
... | 36.238636 | 122 | 0.556209 |
1a1498464540acb0973a2d201ac0501786cab89d | 4,839 | py | Python | cytoskeleton_analyser/fitting/__init__.py | vsukhor/cytoskeleton-analyser | 681a1f6ba1381a5fb293f2310fce5e97d400cfcb | [
"BSD-3-Clause"
] | null | null | null | cytoskeleton_analyser/fitting/__init__.py | vsukhor/cytoskeleton-analyser | 681a1f6ba1381a5fb293f2310fce5e97d400cfcb | [
"BSD-3-Clause"
] | null | null | null | cytoskeleton_analyser/fitting/__init__.py | vsukhor/cytoskeleton-analyser | 681a1f6ba1381a5fb293f2310fce5e97d400cfcb | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2021 Valerii Sukhorukov. 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 ... | 29.150602 | 79 | 0.659434 |
3e76c3c1638989385ac47a0eafeb7ca3ac7d2038 | 165 | py | Python | game/screen_upbar.py | SHI3DO/Andante | beb6fdf96ef86a10de9f802cef2d97dd81b3e688 | [
"MIT"
] | 2 | 2021-12-26T06:26:06.000Z | 2022-02-24T23:54:58.000Z | game/screen_upbar.py | SHI3DO/Andante | beb6fdf96ef86a10de9f802cef2d97dd81b3e688 | [
"MIT"
] | null | null | null | game/screen_upbar.py | SHI3DO/Andante | beb6fdf96ef86a10de9f802cef2d97dd81b3e688 | [
"MIT"
] | null | null | null | def draw(screen, pg, screenx, screeny):
upbar = pg.Surface((screenx, screeny/12))
upbar.set_alpha(100)
upbar.fill((0,0,0))
screen.blit(upbar, (0, 0)) | 33 | 45 | 0.636364 |
4fe894dcd36a55d56f87ab955dc416e20091575c | 4,927 | py | Python | tests/test_tile_stitcher.py | thiloSchlemmer/TileStitcher | c72d7944ebe55992a538cce22be8787a70d62530 | [
"MIT"
] | 6 | 2018-06-14T13:15:19.000Z | 2020-09-11T00:55:20.000Z | tests/test_tile_stitcher.py | thiloSchlemmer/TileStitcher | c72d7944ebe55992a538cce22be8787a70d62530 | [
"MIT"
] | null | null | null | tests/test_tile_stitcher.py | thiloSchlemmer/TileStitcher | c72d7944ebe55992a538cce22be8787a70d62530 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os
import platform
import unittest
from quantized_mesh_tile import TerrainTile
import tile_stitcher
def get_neighbours(z, x, y):
return {'west': (z, x - 1, y),
'north': (z, x, y + 1),
'south': (z, x, y - 1),
'east': (z, x + 1, y)}
def get_tmp_... | 30.226994 | 85 | 0.641567 |
d29a4ef48a1671181157b55fd83662e1f8c5616f | 12,146 | py | Python | config/settings/base.py | qingfulishang/models_test | b3c93bd644acbcbb1a0273c4a04907dc9430c941 | [
"BSD-3-Clause"
] | null | null | null | config/settings/base.py | qingfulishang/models_test | b3c93bd644acbcbb1a0273c4a04907dc9430c941 | [
"BSD-3-Clause"
] | null | null | null | config/settings/base.py | qingfulishang/models_test | b3c93bd644acbcbb1a0273c4a04907dc9430c941 | [
"BSD-3-Clause"
] | null | null | null | """
Base settings to build other settings files upon.
"""
import environ
ROOT_DIR = (
environ.Path(__file__) - 3
) # (models_test/config/settings/base.py - 3 = models_test/)
APPS_DIR = ROOT_DIR.path("models_test")
env = environ.Env()
READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=False)
if RE... | 42.320557 | 100 | 0.645974 |
c0480fa061a8094583f5115dd0186bf42bafcdf6 | 3,911 | py | Python | templates/stm32f030-cct6/osconfig.py | flyghost/OneOS-V2.1.0 | 6fedab0558c07fe679d63ba1eb8ee9992c044d86 | [
"Apache-2.0"
] | null | null | null | templates/stm32f030-cct6/osconfig.py | flyghost/OneOS-V2.1.0 | 6fedab0558c07fe679d63ba1eb8ee9992c044d86 | [
"Apache-2.0"
] | null | null | null | templates/stm32f030-cct6/osconfig.py | flyghost/OneOS-V2.1.0 | 6fedab0558c07fe679d63ba1eb8ee9992c044d86 | [
"Apache-2.0"
] | null | null | null | import os
# toolchains options
ARCH = 'arm'
CPU = 'cortex-m0'
CROSS_TOOL = 'gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('OS_CC'):
CROSS_TOOL = os.getenv('OS_CC')
if os.getenv('OS_ROOT'):
OS_ROOT = os.getenv('OS_ROOT')
# cross_tool provides the cross compiler
# COMPILER_PATH is th... | 27.159722 | 148 | 0.573766 |
ce83660d3da39af07faad3db38b211ba181a5bf2 | 1,828 | py | Python | justenough/transforms/dataloaders.py | DamLabResources/justenough | 3ee5887430598a9e1c042d64d2b9827ee879961a | [
"Apache-2.0"
] | null | null | null | justenough/transforms/dataloaders.py | DamLabResources/justenough | 3ee5887430598a9e1c042d64d2b9827ee879961a | [
"Apache-2.0"
] | null | null | null | justenough/transforms/dataloaders.py | DamLabResources/justenough | 3ee5887430598a9e1c042d64d2b9827ee879961a | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/12_transforms.dataloaders.ipynb (unless otherwise specified).
__all__ = ['HFBertDataLoaders']
# Cell
from fastai.text.all import *
from .sequence import *
# Cell
# export
class HFBertDataLoaders(DataLoaders):
@staticmethod
def from_df(frame, tokeni... | 28.123077 | 115 | 0.54814 |
dfea265646db1d93e04912f398cf29d1c32f5913 | 41 | py | Python | config.py | soybean217/opencv_python_cam_windows_demo | aab0a4cebc34760c437b32fb43c5e794fa181081 | [
"MIT"
] | null | null | null | config.py | soybean217/opencv_python_cam_windows_demo | aab0a4cebc34760c437b32fb43c5e794fa181081 | [
"MIT"
] | null | null | null | config.py | soybean217/opencv_python_cam_windows_demo | aab0a4cebc34760c437b32fb43c5e794fa181081 | [
"MIT"
] | null | null | null | GLOBAL_SETTINGS = {
"port": 11111,
}
| 10.25 | 19 | 0.585366 |
98b2b35d50f1390c40846d67d07850d93b383186 | 1,909 | py | Python | eds/openmtc-gevent/server/openmtc-cse/src/openmtc_cse/methoddomain/filtercriteria/__init__.py | piyush82/elastest-device-emulator-service | b4d6b393d6042c54a7b3dfb5f58cad5efd00f0e7 | [
"Apache-2.0"
] | null | null | null | eds/openmtc-gevent/server/openmtc-cse/src/openmtc_cse/methoddomain/filtercriteria/__init__.py | piyush82/elastest-device-emulator-service | b4d6b393d6042c54a7b3dfb5f58cad5efd00f0e7 | [
"Apache-2.0"
] | null | null | null | eds/openmtc-gevent/server/openmtc-cse/src/openmtc_cse/methoddomain/filtercriteria/__init__.py | piyush82/elastest-device-emulator-service | b4d6b393d6042c54a7b3dfb5f58cad5efd00f0e7 | [
"Apache-2.0"
] | null | null | null | from futile.logging import get_logger
from openmtc.model import ModelTypeError
from openmtc_cse.methoddomain.filtercriteria import filters
from openmtc_onem2m.exc import CSEBadRequest
from openmtc_onem2m.model import FilterCriteria
_logger = get_logger(__name__)
def check_match(resource, filter_criteria):
_logge... | 36.018868 | 79 | 0.631221 |
9514da467b512ec91d9dfb34a8a63b900fd85bf6 | 471 | py | Python | source/MatematicaFinanciera/valorPresente/valor_presente.py | AbelMurgas/Python-Aplicado | 0f01f54d64aae8b7689921741241be76383f3662 | [
"MIT"
] | null | null | null | source/MatematicaFinanciera/valorPresente/valor_presente.py | AbelMurgas/Python-Aplicado | 0f01f54d64aae8b7689921741241be76383f3662 | [
"MIT"
] | null | null | null | source/MatematicaFinanciera/valorPresente/valor_presente.py | AbelMurgas/Python-Aplicado | 0f01f54d64aae8b7689921741241be76383f3662 | [
"MIT"
] | null | null | null | class Valor_Presente:
def obtener_valor_presente(tiempo_anual: float, periodo: int, interes_porcentual: float, valor_futuro: float):
i = (interes_porcentual/100)/periodo
n = tiempo_anual*periodo
resultado = valor_futuro/(1+i)**n
return round(resultado, 2)
def obtener_valor_pres... | 39.25 | 114 | 0.713376 |
cbcb6bc1f37ce680cb8c2ea040f5197c5a328dd0 | 7,008 | py | Python | EndPoint/app/RDF/validator.py | osoc-es/data-quality-madrid | 500f540b5f57d5292f53eba4bac6f67947710ba7 | [
"Apache-2.0"
] | null | null | null | EndPoint/app/RDF/validator.py | osoc-es/data-quality-madrid | 500f540b5f57d5292f53eba4bac6f67947710ba7 | [
"Apache-2.0"
] | 19 | 2021-07-05T09:31:17.000Z | 2021-07-16T10:27:36.000Z | EndPoint/app/RDF/validator.py | osoc-es/data-quality-madrid | 500f540b5f57d5292f53eba4bac6f67947710ba7 | [
"Apache-2.0"
] | null | null | null | import csv
from datetime import datetime
import re
import time
def initializeProcess(csvFile:str):
start = time.time()
# Initialize the process
f = open(csvFile, "r",encoding="ISO8859-1")
lines = f.readlines()
delimiter = findDelimiter(lines[0:10])
rowCount = 0
dictErrs = {
"colu... | 33.056604 | 256 | 0.446062 |
fd70654cb9f8bcfaa789861fe7c0591c09e3395c | 109,919 | py | Python | BaseTools/Source/Python/Ecc/c.py | James992927108/uEFI_Edk2_Practice | 2cac7618dfee10bfa5104a2e167c85425fde0100 | [
"BSD-2-Clause"
] | 6 | 2020-01-10T05:16:15.000Z | 2022-01-06T17:41:58.000Z | BaseTools/Source/Python/Ecc/c.py | James992927108/uEFI_Edk2_Practice | 2cac7618dfee10bfa5104a2e167c85425fde0100 | [
"BSD-2-Clause"
] | null | null | null | BaseTools/Source/Python/Ecc/c.py | James992927108/uEFI_Edk2_Practice | 2cac7618dfee10bfa5104a2e167c85425fde0100 | [
"BSD-2-Clause"
] | 3 | 2018-04-21T07:59:33.000Z | 2018-04-23T02:06:01.000Z | ## @file
# This file is used to be the c coding style checking of ECC tool
#
# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. ... | 41.683352 | 296 | 0.579536 |
33177ac4524143e78942c60455a88dcbc6825e55 | 56,029 | py | Python | pandas/core/dtypes/common.py | JustinZhengBC/pandas | 99df7da9ef5b3b210f3045ee19279808368def28 | [
"BSD-3-Clause"
] | null | null | null | pandas/core/dtypes/common.py | JustinZhengBC/pandas | 99df7da9ef5b3b210f3045ee19279808368def28 | [
"BSD-3-Clause"
] | null | null | null | pandas/core/dtypes/common.py | JustinZhengBC/pandas | 99df7da9ef5b3b210f3045ee19279808368def28 | [
"BSD-3-Clause"
] | null | null | null | """ common type operations """
import numpy as np
from pandas._libs import algos, lib
from pandas._libs.interval import Interval
from pandas._libs.tslibs import Period, Timestamp, conversion
from pandas.compat import PY3, PY36, binary_type, string_types, text_type
from pandas.core.dtypes.dtypes import (
Categoric... | 26.54145 | 79 | 0.628371 |
913d591184ed35c8f057a5e413146803e58cdf4f | 560 | py | Python | scripts/study_case/ID_4/test/transforms/test_random_shear.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 8 | 2021-06-30T06:55:14.000Z | 2022-03-18T01:57:14.000Z | scripts/study_case/ID_4/test/transforms/test_random_shear.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 1 | 2021-06-30T03:08:15.000Z | 2021-06-30T03:08:15.000Z | scripts/study_case/ID_4/test/transforms/test_random_shear.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 2 | 2021-11-17T11:19:48.000Z | 2021-11-18T03:05:58.000Z | import torch
from scripts.study_case.ID_4.torch_geometric.transforms import RandomShear
from scripts.study_case.ID_4.torch_geometric.data import Data
def test_random_shear():
assert RandomShear(0.1).__repr__() == 'RandomShear(0.1)'
pos = torch.Tensor([[-1, -1], [-1, 1], [1, -1], [1, 1]])
data = Data(pos... | 28 | 74 | 0.655357 |
25aae02126e1c10a29c6d5e52e6c89d196c51688 | 10,054 | py | Python | rllib/examples/env/matrix_sequential_social_dilemma.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 22 | 2018-05-08T05:52:34.000Z | 2020-04-01T10:09:55.000Z | rllib/examples/env/matrix_sequential_social_dilemma.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 73 | 2021-09-25T07:11:39.000Z | 2022-03-26T07:10:59.000Z | rllib/examples/env/matrix_sequential_social_dilemma.py | mgelbart/ray | 4cec2286572e368a4bd64aae467751a384eff62d | [
"Apache-2.0"
] | 10 | 2018-04-27T10:50:59.000Z | 2020-02-24T02:41:43.000Z | ##########
# Contribution by the Center on Long-Term Risk:
# https://github.com/longtermrisk/marltoolbox
# Some parts are originally from:
# https://github.com/alshedivat/lola/tree/master/lola
##########
import logging
from abc import ABC
from collections import Iterable
from typing import Dict, Optional
import numpy... | 31.616352 | 88 | 0.652676 |
2ae4763cc17a1e280c7da2251df98f9372304681 | 4,491 | py | Python | starry_process/ops/base_op.py | arfon/starry_process | 72b2a540e7e4fdb2e6af61507efa1c9861d5c919 | [
"MIT"
] | 13 | 2020-04-14T17:47:28.000Z | 2022-03-16T15:19:48.000Z | starry_process/ops/base_op.py | arfon/starry_process | 72b2a540e7e4fdb2e6af61507efa1c9861d5c919 | [
"MIT"
] | 22 | 2020-09-23T20:33:22.000Z | 2022-02-07T17:38:09.000Z | starry_process/ops/base_op.py | arfon/starry_process | 72b2a540e7e4fdb2e6af61507efa1c9861d5c919 | [
"MIT"
] | 8 | 2020-04-14T17:47:44.000Z | 2022-02-06T16:39:47.000Z | # -*- coding: utf-8 -*-
from ..starry_process_version import __version__
from ..defaults import defaults
from ..compat import theano, tt, COp, Apply, floatX
import sys
import pkg_resources
# Allow C code caching even in dev mode?
try:
from .. import CACHE_DEV_C_CODE
except:
CACHE_DEV_C_CODE = False
__all__ = ... | 31.1875 | 79 | 0.531285 |
6f8ea7d7e0fe3f7ad67d9786d63a5216df23498b | 69 | py | Python | python/testData/editing/noBackslashOnEnterInMappingPattern.after.py | 06needhamt/intellij-community | 63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b | [
"Apache-2.0"
] | null | null | null | python/testData/editing/noBackslashOnEnterInMappingPattern.after.py | 06needhamt/intellij-community | 63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b | [
"Apache-2.0"
] | null | null | null | python/testData/editing/noBackslashOnEnterInMappingPattern.after.py | 06needhamt/intellij-community | 63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b | [
"Apache-2.0"
] | null | null | null | match x:
case {'foo': 1,
<caret>'bar': 2}
pass | 17.25 | 26 | 0.391304 |
2e212ba7238166c94ef356bff92e6d0a2a82f77f | 56,426 | py | Python | leo/commands/commanderOutlineCommands.py | gamtiq/leo-editor | 3f51986fea4c16ed0713699b088bc8a8abd738c3 | [
"MIT"
] | 1 | 2020-11-07T23:22:12.000Z | 2020-11-07T23:22:12.000Z | leo/commands/commanderOutlineCommands.py | gamtiq/leo-editor | 3f51986fea4c16ed0713699b088bc8a8abd738c3 | [
"MIT"
] | null | null | null | leo/commands/commanderOutlineCommands.py | gamtiq/leo-editor | 3f51986fea4c16ed0713699b088bc8a8abd738c3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20171124080430.1: * @file ../commands/commanderOutlineCommands.py
#@@first
"""Outline commands that used to be defined in leoCommands.py"""
import leo.core.leoGlobals as g
import xml.etree.ElementTree as ElementTree
import leo.core.leoNodes as leoNodes
import leo.co... | 34.114873 | 91 | 0.629816 |
98e9c33334ef004ee1dc5561ff2459a9fce4fa31 | 1,884 | py | Python | tools/download.py | dkratzert/FinalCif | 07ca23dbb4e7439b108a906521a118cdb876d97e | [
"Beerware"
] | 13 | 2020-01-14T16:23:48.000Z | 2022-02-16T18:02:08.000Z | tools/download.py | dkratzert/FinalCif | 07ca23dbb4e7439b108a906521a118cdb876d97e | [
"Beerware"
] | 24 | 2021-04-21T05:30:42.000Z | 2022-03-31T20:07:29.000Z | tools/download.py | dkratzert/FinalCif | 07ca23dbb4e7439b108a906521a118cdb876d97e | [
"Beerware"
] | 1 | 2021-08-09T16:48:33.000Z | 2021-08-09T16:48:33.000Z | import sys
import requests
from PyQt5.QtCore import QThread, pyqtSignal
from tools.version import VERSION
class MyDownloader(QThread):
progress = pyqtSignal(str)
failed = pyqtSignal(int)
finished = pyqtSignal(bytes)
def __init__(self, parent, url: str):
super().__init__(parent)
self... | 28.545455 | 81 | 0.654459 |
3680312fbb6ced5fd0870a2c981abc389f11dc15 | 257 | py | Python | BOJ9461.py | INYEONGKIM/BOJ | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | [
"MIT"
] | 2 | 2019-03-05T15:42:46.000Z | 2019-07-24T15:52:36.000Z | BOJ9461.py | INYEONGKIM/BOJ | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | [
"MIT"
] | null | null | null | BOJ9461.py | INYEONGKIM/BOJ | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | [
"MIT"
] | null | null | null | res=""
p=[1]*100
p[3]=2;p[4]=2;p[5]=3;p[6]=4;p[7]=5;p[8]=7;p[9]=9
for i in range(10, 100):
p[i] = p[i-1] + p[i-5]
for _ in range(int(__import__('sys').stdin.readline())):
res += f'{p[int(__import__("sys").stdin.readline())-1]}\n'
print(res.strip())
| 28.555556 | 62 | 0.552529 |
ed97cbd51cef903155f6a2f10eda555b0a620b5e | 176 | py | Python | tests/test_cipher_xs2428_mds.py | QMSS-G5072-2021/cipher_Shan_Kimberly | ec258e785048f43b95fdc2297ae269c4217ee462 | [
"MIT"
] | null | null | null | tests/test_cipher_xs2428_mds.py | QMSS-G5072-2021/cipher_Shan_Kimberly | ec258e785048f43b95fdc2297ae269c4217ee462 | [
"MIT"
] | null | null | null | tests/test_cipher_xs2428_mds.py | QMSS-G5072-2021/cipher_Shan_Kimberly | ec258e785048f43b95fdc2297ae269c4217ee462 | [
"MIT"
] | null | null | null | from cipher_xs2428_mds import cipher_xs2428_mds
def test_cipher():
expected = 'Bqqmf'
actual = cipher_xs2428_mds.cipher('Apple', 1, True)
assert actual == expected | 29.333333 | 55 | 0.738636 |
cff78eb03f96b757913b6202c1a90195680a6fc4 | 868 | py | Python | ML1-Supervised-Learning/ML1.1-Classification/cl5_overfitting_underfitting.py | ridhanf/machine-learning-datacamp | 2c2c0f5dfcf9df315488cdef8eabd1d4f9fbd0e8 | [
"MIT"
] | null | null | null | ML1-Supervised-Learning/ML1.1-Classification/cl5_overfitting_underfitting.py | ridhanf/machine-learning-datacamp | 2c2c0f5dfcf9df315488cdef8eabd1d4f9fbd0e8 | [
"MIT"
] | null | null | null | ML1-Supervised-Learning/ML1.1-Classification/cl5_overfitting_underfitting.py | ridhanf/machine-learning-datacamp | 2c2c0f5dfcf9df315488cdef8eabd1d4f9fbd0e8 | [
"MIT"
] | null | null | null | # Setup arrays to store train and test accuracies
neighbors = np.arange(1, 9)
train_accuracy = np.empty(len(neighbors))
test_accuracy = np.empty(len(neighbors))
# Loop over different values of k
for i, k in enumerate(neighbors):
# Setup a k-NN Classifier with k neighbors: knn
knn = KNeighborsClassifier(n_neigh... | 31 | 64 | 0.733871 |
def351d8b98d300e8b5a6f9280a5e56c9e9adbdc | 12,412 | py | Python | haystack/file_converter/pdf.py | SjSnowball/haystack | bb066c0a2c10253cf2bf7eb8cc829f1a0edde84d | [
"Apache-2.0"
] | 4,544 | 2019-11-14T11:57:49.000Z | 2022-03-31T17:41:18.000Z | haystack/file_converter/pdf.py | SjSnowball/haystack | bb066c0a2c10253cf2bf7eb8cc829f1a0edde84d | [
"Apache-2.0"
] | 1,679 | 2020-01-14T15:55:58.000Z | 2022-03-31T20:55:25.000Z | haystack/file_converter/pdf.py | SjSnowball/haystack | bb066c0a2c10253cf2bf7eb8cc829f1a0edde84d | [
"Apache-2.0"
] | 820 | 2019-11-27T13:01:42.000Z | 2022-03-31T12:54:34.000Z | import logging
import subprocess
from pathlib import Path
import tempfile
import os
from typing import List, Optional, Dict, Any
from pdf2image import convert_from_path, convert_from_bytes
from haystack.file_converter.base import BaseConverter
from haystack.file_converter.image import ImageToTextConverter
logger = ... | 52.151261 | 120 | 0.592008 |
305abee0bcd92aa93cc3c354d2952b0d6c9d3490 | 4,647 | py | Python | topi/python/topi/bifrost/depthwise_conv2d.py | robo-corg/incubator-tvm | 4ddfdb4b15d05a5bf85a984837967d004efee5dd | [
"Apache-2.0"
] | 3 | 2021-02-23T22:06:01.000Z | 2021-09-30T09:59:17.000Z | topi/python/topi/bifrost/depthwise_conv2d.py | robo-corg/incubator-tvm | 4ddfdb4b15d05a5bf85a984837967d004efee5dd | [
"Apache-2.0"
] | 4 | 2021-03-30T11:59:59.000Z | 2022-03-12T00:40:23.000Z | topi/python/topi/bifrost/depthwise_conv2d.py | robo-corg/incubator-tvm | 4ddfdb4b15d05a5bf85a984837967d004efee5dd | [
"Apache-2.0"
] | 3 | 2021-07-20T07:40:15.000Z | 2021-08-03T08:39:17.000Z | # 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 License, Version 2.0 (the
# "License"); you may not u... | 36.590551 | 89 | 0.594362 |
ea631f74beead1c09594c9d2aacf772853e8f8d6 | 2,566 | py | Python | customuser/forms.py | vitaliyharchenko/Stepee | 1daadc19e7538562a91fec01668e1d5791869af8 | [
"MIT"
] | null | null | null | customuser/forms.py | vitaliyharchenko/Stepee | 1daadc19e7538562a91fec01668e1d5791869af8 | [
"MIT"
] | null | null | null | customuser/forms.py | vitaliyharchenko/Stepee | 1daadc19e7538562a91fec01668e1d5791869af8 | [
"MIT"
] | null | null | null | # coding=utf-8
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from models import User
class UserCreationForm(forms.ModelForm):
error_messages = {
'duplicate_email': "A user with that email already exists.",
'p... | 32.481013 | 76 | 0.644193 |
62608e2f17267c6945fe7819bcca54f7fdfacc59 | 57,680 | py | Python | pandas/tests/io/formats/style/test_style.py | dorothykiz1/pandas | 6033ed4b3383d874ee4a8a461724c0b8c2ca968d | [
"BSD-3-Clause"
] | 1 | 2022-03-29T01:38:03.000Z | 2022-03-29T01:38:03.000Z | pandas/tests/io/formats/style/test_style.py | dorothykiz1/pandas | 6033ed4b3383d874ee4a8a461724c0b8c2ca968d | [
"BSD-3-Clause"
] | 1 | 2022-03-08T02:15:07.000Z | 2022-03-08T02:15:07.000Z | pandas/tests/io/formats/style/test_style.py | dorothykiz1/pandas | 6033ed4b3383d874ee4a8a461724c0b8c2ca968d | [
"BSD-3-Clause"
] | 1 | 2022-03-22T11:50:25.000Z | 2022-03-22T11:50:25.000Z | import copy
import re
from textwrap import dedent
import numpy as np
import pytest
from pandas import (
Categorical,
DataFrame,
IndexSlice,
MultiIndex,
Series,
option_context,
)
import pandas._testing as tm
jinja2 = pytest.importorskip("jinja2")
from pandas.io.formats.style import ( # isort:... | 36.879795 | 88 | 0.541609 |
016928020bd777ff5e6b1b0fa8fae3fe3fd4d165 | 9,032 | py | Python | robosuite/devices/spacemouse.py | ElieAljalbout/robosuite | 5092e805157ca7a255d3692f34a4d51599e72699 | [
"MIT"
] | null | null | null | robosuite/devices/spacemouse.py | ElieAljalbout/robosuite | 5092e805157ca7a255d3692f34a4d51599e72699 | [
"MIT"
] | null | null | null | robosuite/devices/spacemouse.py | ElieAljalbout/robosuite | 5092e805157ca7a255d3692f34a4d51599e72699 | [
"MIT"
] | null | null | null | """Driver class for SpaceMouse controller.
This class provides a driver support to SpaceMouse on macOS.
In particular, we assume you are using a SpaceMouse Wireless by default.
To set up a new SpaceMouse controller:
1. Download and install driver from https://www.3dconnexion.com/service/drivers.html
2. Instal... | 31.691228 | 99 | 0.580824 |
86c7e380cf0bfb30359cea5a8391517b944e4168 | 798 | py | Python | source/FAST/Examples/Python/stream_from_clarius_ultrasound_scanner.py | andreped/FAST | 361819190ea0ae5a2f068e7bd808a1c70af5a171 | [
"BSD-2-Clause"
] | null | null | null | source/FAST/Examples/Python/stream_from_clarius_ultrasound_scanner.py | andreped/FAST | 361819190ea0ae5a2f068e7bd808a1c70af5a171 | [
"BSD-2-Clause"
] | null | null | null | source/FAST/Examples/Python/stream_from_clarius_ultrasound_scanner.py | andreped/FAST | 361819190ea0ae5a2f068e7bd808a1c70af5a171 | [
"BSD-2-Clause"
] | null | null | null | ## @example stream_from_clarius_ultrasound_scanner.py
# This example will stream images from a clarius ultrasound scanner, apply a non-local-means filter
# and display it in real-time. Note: Do run this example you have to have:
# * A Clarius ultrasound probe running with the research cast API enabled.
# * Unfreeze the... | 38 | 99 | 0.769424 |
a80383a78d9daf42b5f9c8b91a96a2b29f3c09a0 | 81 | py | Python | 0/3/3004/3004.py | chr0m3/boj-codes | d71d0a22d0a3ae62c225f382442461275f56fe8f | [
"MIT"
] | 3 | 2017-07-08T16:29:06.000Z | 2020-07-20T00:17:45.000Z | 0/3/3004/3004.py | chr0m3/boj-codes | d71d0a22d0a3ae62c225f382442461275f56fe8f | [
"MIT"
] | null | null | null | 0/3/3004/3004.py | chr0m3/boj-codes | d71d0a22d0a3ae62c225f382442461275f56fe8f | [
"MIT"
] | 2 | 2017-11-20T14:06:06.000Z | 2020-07-20T00:17:47.000Z | import math
n = int(input()) - 1
print((2 + (n // 2)) * (1 + math.ceil(n / 2)))
| 16.2 | 46 | 0.481481 |
3bd2e3468710e0566903e1522adcec563f2b7035 | 22,509 | py | Python | spyne/server/twisted/http.py | florath/spyne-1 | 88d7b9b9020d5067b80927a30e229c3c5d64af85 | [
"BSD-3-Clause"
] | null | null | null | spyne/server/twisted/http.py | florath/spyne-1 | 88d7b9b9020d5067b80927a30e229c3c5d64af85 | [
"BSD-3-Clause"
] | null | null | null | spyne/server/twisted/http.py | florath/spyne-1 | 88d7b9b9020d5067b80927a30e229c3c5d64af85 | [
"BSD-3-Clause"
] | null | null | null |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... | 33.101471 | 85 | 0.613444 |
616dd0b2d21a5988d748bfc9eb80b60f013b6394 | 1,369 | py | Python | src/drivetools.py | jhanc97/backend | e747aa2d779b8856f37d0ca400164791ee45b61a | [
"MIT"
] | null | null | null | src/drivetools.py | jhanc97/backend | e747aa2d779b8856f37d0ca400164791ee45b61a | [
"MIT"
] | null | null | null | src/drivetools.py | jhanc97/backend | e747aa2d779b8856f37d0ca400164791ee45b61a | [
"MIT"
] | 1 | 2021-06-02T07:23:51.000Z | 2021-06-02T07:23:51.000Z | def driveIter(root, drive):
params = {
"pageToken": None,
"supportsAllDrives": True,
"includeItemsFromAllDrives": True,
"fields": "files(id,name,mimeType), incompleteSearch, nextPageToken",
"q": "'%s' in parents and trashed = false and (mimeType = 'application/vnd.google-apps... | 31.113636 | 133 | 0.577064 |
76ea90726c47ae425d358ce1a5376063f23c5cc3 | 6,886 | py | Python | tests/test_searchpath.py | nfwprod/diffjson | ad7ea15c42e25f16f610491e95da3d0b2e35d654 | [
"MIT"
] | 1 | 2021-02-13T08:24:52.000Z | 2021-02-13T08:24:52.000Z | tests/test_searchpath.py | nfwstg/diffjson | 52cb24e5629797b32c23e7971d36d111a6817121 | [
"MIT"
] | 3 | 2021-03-13T06:44:27.000Z | 2021-04-21T16:45:43.000Z | tests/test_searchpath.py | nfwstg/diffjson | 52cb24e5629797b32c23e7971d36d111a6817121 | [
"MIT"
] | 4 | 2021-03-13T06:39:30.000Z | 2021-04-24T04:52:36.000Z | import pytest
import yaml
import diffjson
class TestSearchpathClasses(object):
def test_init_NodenameRoot(self):
n = diffjson.NodenameRoot()
expected = '/'
assert str(n) == expected
def test_init_NodenameAsterisk(self):
n = diffjson.NodenameAsterisk()
expected = '*'
... | 32.027907 | 87 | 0.612257 |
45e18cfce83011f2251c5fb2bcd1403b35c6595b | 16,500 | py | Python | lightning_base.py | ksboy/ccks3 | c500af33b6b879751ea04ce5fab456b01db9868c | [
"Apache-2.0"
] | 1 | 2021-07-14T06:30:20.000Z | 2021-07-14T06:30:20.000Z | lightning_base.py | ksboy/ccks3 | c500af33b6b879751ea04ce5fab456b01db9868c | [
"Apache-2.0"
] | null | null | null | lightning_base.py | ksboy/ccks3 | c500af33b6b879751ea04ce5fab456b01db9868c | [
"Apache-2.0"
] | null | null | null | import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelForQuestionAnswering,
... | 38.732394 | 120 | 0.647697 |
4c8514cd2a30866d29e83ae612c6a0cf14d32abd | 5,759 | py | Python | config_dialog.py | shuming2/ONU_POWER_ANALYSIS | faa6603d3f5b7cd6e6d3dd9851e4d1b61bd7e8fd | [
"Apache-2.0"
] | null | null | null | config_dialog.py | shuming2/ONU_POWER_ANALYSIS | faa6603d3f5b7cd6e6d3dd9851e4d1b61bd7e8fd | [
"Apache-2.0"
] | 2 | 2018-08-16T04:26:39.000Z | 2018-08-18T12:33:37.000Z | config_dialog.py | shuming2/ONU_POWER_ANALYSIS | faa6603d3f5b7cd6e6d3dd9851e4d1b61bd7e8fd | [
"Apache-2.0"
] | null | null | null | import os
import re
import sys
import tkinter
from tkinter import ttk, Spinbox
class ConfigDialog(tkinter.Toplevel):
def __init__(self, parent):
super().__init__()
self.transient(parent)
self.grab_set()
self.geometry("+%d+%d" % (parent.winfo_rootx() + 50, parent.winfo_rooty() + 50)... | 42.977612 | 110 | 0.632054 |
feef4705641ebc11180c7fd6fd308efaa6aff874 | 64 | py | Python | Calc.py | danielwilson2017/Calculus-Project-Q2 | d41c2c79c30d8d42444af4980422f19b1484d2cb | [
"MIT"
] | null | null | null | Calc.py | danielwilson2017/Calculus-Project-Q2 | d41c2c79c30d8d42444af4980422f19b1484d2cb | [
"MIT"
] | null | null | null | Calc.py | danielwilson2017/Calculus-Project-Q2 | d41c2c79c30d8d42444af4980422f19b1484d2cb | [
"MIT"
] | null | null | null |
nox = int(input("What is the function in values of x"))
if nox | 21.333333 | 55 | 0.6875 |
d4719ccb2e4442b7738b0a6bfc737f37ae882c9b | 470 | py | Python | apps/core/views/viewsets/best_search.py | sparcs-kaist/new-ara-api | 63998da575cb148347708199fe1345c4e7ee3e1b | [
"MIT"
] | 19 | 2017-09-13T07:51:58.000Z | 2022-03-28T11:04:03.000Z | apps/core/views/viewsets/best_search.py | sparcs-kaist/new-ara-api | 63998da575cb148347708199fe1345c4e7ee3e1b | [
"MIT"
] | 147 | 2017-09-14T13:45:30.000Z | 2022-03-14T15:54:09.000Z | apps/core/views/viewsets/best_search.py | sparcs-kaist/new-ara-api | 63998da575cb148347708199fe1345c4e7ee3e1b | [
"MIT"
] | 5 | 2019-08-31T13:13:30.000Z | 2021-03-26T15:46:38.000Z | from rest_framework import viewsets, permissions
from ara.classes.viewset import ActionAPIViewSet
from apps.core.serializers.best_search import BestSearchSerializer
from apps.core.models import BestSearch
class BestSearchViewSet(viewsets.ReadOnlyModelViewSet, ActionAPIViewSet):
queryset = BestSearch.objects.all(... | 31.333333 | 73 | 0.8 |
f33b6b926d31d0e6838d7afca730fca5ae8b5668 | 679 | py | Python | picorss/src/infrastructure/models/meta.py | rok-povsic/picorss | 7c182953868e56389d5c080f3c0b75d7c0fafa74 | [
"MIT"
] | null | null | null | picorss/src/infrastructure/models/meta.py | rok-povsic/picorss | 7c182953868e56389d5c080f3c0b75d7c0fafa74 | [
"MIT"
] | null | null | null | picorss/src/infrastructure/models/meta.py | rok-povsic/picorss | 7c182953868e56389d5c080f3c0b75d7c0fafa74 | [
"MIT"
] | null | null | null | from sqlalchemy import schema
from sqlalchemy.ext import declarative
# Recommended naming convention used by Alembic, as various different database
# providers will autogenerate vastly different names making migrations more
# difficult. See: http://alembic.zzzcomputing.com/en/latest/naming.html
NAMING_CONVENTION = {
... | 39.941176 | 78 | 0.764359 |
76dbfbcc891c69b629d44dbf36122b9b7ed21dbb | 366 | py | Python | djlang/views.py | Joneswn/Baloti | c499666dd9e2553fac88130dea2b6e9df8278234 | [
"MIT"
] | 1 | 2022-02-24T17:30:53.000Z | 2022-02-24T17:30:53.000Z | djlang/views.py | Joneswn/Baloti | c499666dd9e2553fac88130dea2b6e9df8278234 | [
"MIT"
] | null | null | null | djlang/views.py | Joneswn/Baloti | c499666dd9e2553fac88130dea2b6e9df8278234 | [
"MIT"
] | 2 | 2021-10-06T11:52:41.000Z | 2022-01-20T11:07:27.000Z | import json
from django.http import HttpResponse
from django.urls import path
from .models import Text
def text_view(request):
data = list(Text.objects.order_by('id', 'key').distinct('id', 'key').values())
return HttpResponse(json.dumps(data, ensure_ascii=False), content_type='application/json')
urlpatter... | 21.529412 | 94 | 0.718579 |
88c77a5110793edeb73475372e23f5f19b694a29 | 1,997 | py | Python | django/utils/translation/trans_null.py | ericholscher/django | b9a90b371c90a987ed57f7a4a7cc1274c432b438 | [
"BSD-3-Clause"
] | 1 | 2015-11-08T11:42:08.000Z | 2015-11-08T11:42:08.000Z | django/utils/translation/trans_null.py | ericholscher/django | b9a90b371c90a987ed57f7a4a7cc1274c432b438 | [
"BSD-3-Clause"
] | null | null | null | django/utils/translation/trans_null.py | ericholscher/django | b9a90b371c90a987ed57f7a4a7cc1274c432b438 | [
"BSD-3-Clause"
] | null | null | null | # These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
from django.conf import settings
from django.utils.encoding import force_text
from django.ut... | 31.203125 | 77 | 0.755133 |
b80c82b923ed59f76053d23109369b83e38effe1 | 2,114 | py | Python | wizard/core/custom_logger.py | Wizard-collab/wizard_2 | a2cb23362e178a0205f6dd0b9b4328c329b5b142 | [
"MIT"
] | 1 | 2021-10-13T15:07:32.000Z | 2021-10-13T15:07:32.000Z | wizard/core/custom_logger.py | Wizard-collab/wizard_2 | a2cb23362e178a0205f6dd0b9b4328c329b5b142 | [
"MIT"
] | null | null | null | wizard/core/custom_logger.py | Wizard-collab/wizard_2 | a2cb23362e178a0205f6dd0b9b4328c329b5b142 | [
"MIT"
] | null | null | null | # coding: utf-8
# Author: Leo BRUNEL
# Contact: contact@leobrunel.com
# This file is part of Wizard
# MIT License
# Copyright (c) 2021 Leo brunel
# 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 So... | 38.436364 | 114 | 0.76017 |
f3b2c12f4c9acb5877fb1ddd88506f8d3b37d1c2 | 2,241 | py | Python | samba_edit/add_option.py | tosbaa/samba-liman | ddc76b8ab322a07a8d918a9c581440984939d7fe | [
"MIT"
] | 1 | 2020-07-03T06:04:36.000Z | 2020-07-03T06:04:36.000Z | samba_edit/add_option.py | tosbaa/samba-liman | ddc76b8ab322a07a8d918a9c581440984939d7fe | [
"MIT"
] | null | null | null | samba_edit/add_option.py | tosbaa/samba-liman | ddc76b8ab322a07a8d918a9c581440984939d7fe | [
"MIT"
] | null | null | null | import sys
import configparser
import os
import subprocess
SAMBA_CONFIG_PARSER = configparser.ConfigParser()
SAMBA_FILE_PATH = '../smb.conf'
SAMBA_CONFIG_PARSER.read(SAMBA_FILE_PATH)
SECTION_NAME = sys.argv[2]
OPTION_NAME = sys.argv[3]
VALUE = sys.argv[4]
def section_exist(section_name):
""" Takes section_name(st... | 28.0125 | 114 | 0.683623 |
f9a315bde2ba93a5c1aea438076f1fcd3a123828 | 2,512 | py | Python | src/models/user_serviceprovider.py | kumardeepak/user-mgmt | 43f37fd1bf0a21ae3d17126b21e0b906145ecaf6 | [
"MIT"
] | null | null | null | src/models/user_serviceprovider.py | kumardeepak/user-mgmt | 43f37fd1bf0a21ae3d17126b21e0b906145ecaf6 | [
"MIT"
] | null | null | null | src/models/user_serviceprovider.py | kumardeepak/user-mgmt | 43f37fd1bf0a21ae3d17126b21e0b906145ecaf6 | [
"MIT"
] | null | null | null | import json
from datetime import datetime
class UserServiceProvider:
def __init__(self, args, ignore_username=False):
if ignore_username == False:
self.username = args['username']
self.role = args['role']
self.first_name = args... | 43.310345 | 71 | 0.435111 |
4905650b3f0609f8b2ceb77a96da114c500071e1 | 624 | py | Python | manage.py | SoftwareDevTest/softwaredapi | 44feb67c7b3f7cdfa05d0e81aca5013e71b999b5 | [
"Apache-2.0"
] | 5 | 2019-12-10T05:20:59.000Z | 2019-12-10T09:59:34.000Z | manage.py | SoftwareDevTest/softwaredapi | 44feb67c7b3f7cdfa05d0e81aca5013e71b999b5 | [
"Apache-2.0"
] | 6 | 2020-02-12T02:30:31.000Z | 2021-06-09T18:46:58.000Z | manage.py | SoftwareDevTest/softwaredapi | 44feb67c7b3f7cdfa05d0e81aca5013e71b999b5 | [
"Apache-2.0"
] | 1 | 2019-12-10T05:21:02.000Z | 2019-12-10T05:21:02.000Z | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dapi.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportErr... | 28.363636 | 73 | 0.68109 |
bb0c46c27910ba2d06b5a99b2ca7480d34f23af4 | 8,493 | py | Python | h1/model/iso.py | hyperonecom/h1-client-python | 4ce355852ba3120ec1b8f509ab5894a5c08da730 | [
"MIT"
] | null | null | null | h1/model/iso.py | hyperonecom/h1-client-python | 4ce355852ba3120ec1b8f509ab5894a5c08da730 | [
"MIT"
] | null | null | null | h1/model/iso.py | hyperonecom/h1-client-python | 4ce355852ba3120ec1b8f509ab5894a5c08da730 | [
"MIT"
] | null | null | null | """
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from h1.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
... | 39.138249 | 110 | 0.554221 |
d6a52dc1101c14a2ba5c46cdf21a7dc4477789cc | 15,659 | py | Python | timeseriesql_matplotlib/__init__.py | mbeale/tiemseriesql-matplotlib | 5eb388fd1224790dfb69690e0be289a10f82c2e0 | [
"BSD-2-Clause"
] | 5 | 2020-01-28T18:56:08.000Z | 2020-05-25T22:30:08.000Z | timeseriesql_matplotlib/__init__.py | mbeale/tiemseriesql-matplotlib | 5eb388fd1224790dfb69690e0be289a10f82c2e0 | [
"BSD-2-Clause"
] | null | null | null | timeseriesql_matplotlib/__init__.py | mbeale/tiemseriesql-matplotlib | 5eb388fd1224790dfb69690e0be289a10f82c2e0 | [
"BSD-2-Clause"
] | null | null | null | import matplotlib.pyplot as plt
from matplotlib.dates import (
DayLocator,
HourLocator,
MonthLocator,
YearLocator,
MinuteLocator,
DateFormatter,
)
import numpy as np
import math
from timeseriesql.plot import Plot
DEFAULT_FIGURE_SIZE = (20, 10)
FIGURE_COUNTER = 1
def init_ax_if_none(func):
... | 30.524366 | 149 | 0.520723 |
6d45cb282714357f188f75097614850eca42e10a | 3,774 | py | Python | org-watch.py | NicholasTaylor/ticket-watch | 75db54ef060a4aa0d0944898865ba32b08e4d57c | [
"MIT"
] | null | null | null | org-watch.py | NicholasTaylor/ticket-watch | 75db54ef060a4aa0d0944898865ba32b08e4d57c | [
"MIT"
] | null | null | null | org-watch.py | NicholasTaylor/ticket-watch | 75db54ef060a4aa0d0944898865ba32b08e4d57c | [
"MIT"
] | null | null | null | import requests, functions, config, json
from classes import Event
def getOrgs():
from pathlib import Path
return json.loads(Path('orgs.json').read_text())
def getOrgStatus(org,latestPage,events):
page = latestPage
multipage = True if latestPage and latestPage > 1 else False
url = 'https://www.eve... | 38.907216 | 194 | 0.595919 |
1fc3f520fd7266f1340185f8a44a05e7a7f33dee | 1,714 | py | Python | tacker/sol_refactored/objects/v1/placement_constraint.py | h1r0mu/tacker | 8c69dda51fcfe215c4878a86b82018d2b96e5561 | [
"Apache-2.0"
] | 116 | 2015-10-18T02:57:08.000Z | 2022-03-15T04:09:18.000Z | tacker/sol_refactored/objects/v1/placement_constraint.py | h1r0mu/tacker | 8c69dda51fcfe215c4878a86b82018d2b96e5561 | [
"Apache-2.0"
] | 6 | 2016-11-07T22:15:54.000Z | 2021-05-09T06:13:08.000Z | tacker/sol_refactored/objects/v1/placement_constraint.py | h1r0mu/tacker | 8c69dda51fcfe215c4878a86b82018d2b96e5561 | [
"Apache-2.0"
] | 166 | 2015-10-20T15:31:52.000Z | 2021-11-12T08:39:49.000Z | # Copyright (C) 2021 Nippon Telegraph and Telephone Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICE... | 32.961538 | 78 | 0.627188 |
66946f3e174b00e1a68bd347aa535c685b1e8b8f | 6,939 | py | Python | examples/pwr_run/checkpointing/debug/k80_only/job48.py | boringlee24/keras_old | 1e1176c45c4952ba1b9b9e58e9cc4df027ab111d | [
"MIT"
] | null | null | null | examples/pwr_run/checkpointing/debug/k80_only/job48.py | boringlee24/keras_old | 1e1176c45c4952ba1b9b9e58e9cc4df027ab111d | [
"MIT"
] | null | null | null | examples/pwr_run/checkpointing/debug/k80_only/job48.py | boringlee24/keras_old | 1e1176c45c4952ba1b9b9e58e9cc4df027ab111d | [
"MIT"
] | null | null | null | """
#Trains a ResNet on the CIFAR10 dataset.
"""
from __future__ import print_function
import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, LearningRa... | 31.684932 | 118 | 0.702407 |
3f7020ba676457ca01fc3888aa5bf0a94acb05e0 | 3,450 | py | Python | lib/common.py | haribommi/vaapi-fits | cbf2a463bd3b2c9af5c45a1376b0bde2b703ed23 | [
"BSD-3-Clause"
] | null | null | null | lib/common.py | haribommi/vaapi-fits | cbf2a463bd3b2c9af5c45a1376b0bde2b703ed23 | [
"BSD-3-Clause"
] | null | null | null | lib/common.py | haribommi/vaapi-fits | cbf2a463bd3b2c9af5c45a1376b0bde2b703ed23 | [
"BSD-3-Clause"
] | null | null | null | ###
### Copyright (C) 2018-2019 Intel Corporation
###
### SPDX-License-Identifier: BSD-3-Clause
###
import os
import slash
import subprocess
import threading
import time
class memoize:
def __init__(self, function):
self.function = function
self.memoized = {}
def __call__(self, *args):
try:
retu... | 24.642857 | 95 | 0.666667 |
d75b375e44855e0f0428ce2891275fc67b0cdd33 | 2,654 | py | Python | tests/test_fits.py | dennisvang/imageio | 54e957a8d4c5faa90c6dd16ae3f64346a5ceafa4 | [
"BSD-2-Clause"
] | null | null | null | tests/test_fits.py | dennisvang/imageio | 54e957a8d4c5faa90c6dd16ae3f64346a5ceafa4 | [
"BSD-2-Clause"
] | null | null | null | tests/test_fits.py | dennisvang/imageio | 54e957a8d4c5faa90c6dd16ae3f64346a5ceafa4 | [
"BSD-2-Clause"
] | null | null | null | """ Test fits plugin functionality.
"""
import pytest
import imageio.v2 as iio
from imageio.core import Request
import numpy as np
from conftest import deprecated_test
fits = pytest.importorskip("astropy.io.fits", reason="astropy is not installed")
@deprecated_test
def setup_module():
# During this test, prete... | 26.54 | 80 | 0.653353 |
c2d465d84b58928e4efc3321e844c1e2b270b96e | 97 | py | Python | flow/__init__.py | nschloe/flow | ef45bdd4181d385b1b01042e9ce0b48e4cdc2318 | [
"MIT"
] | 6 | 2018-05-01T18:04:03.000Z | 2020-12-29T08:05:53.000Z | flow/__init__.py | nschloe/flow | ef45bdd4181d385b1b01042e9ce0b48e4cdc2318 | [
"MIT"
] | 1 | 2018-08-09T07:17:59.000Z | 2018-08-09T07:52:18.000Z | flow/__init__.py | nschloe/flow | ef45bdd4181d385b1b01042e9ce0b48e4cdc2318 | [
"MIT"
] | 4 | 2018-01-29T18:46:12.000Z | 2020-12-27T11:44:05.000Z | # -*- coding: utf-8 -*-
#
from . import message
from . import navier_stokes
from . import stokes
| 16.166667 | 27 | 0.680412 |
0f6bab726e1761e0c8a1e579432081ffda8e4fac | 5,047 | py | Python | tests/test_describe.py | andras-tim/sadisplay | 0f63a67b7a831fce812c662da8b7ca92407c7376 | [
"BSD-3-Clause"
] | 1 | 2021-11-06T17:13:58.000Z | 2021-11-06T17:13:58.000Z | tests/test_describe.py | andras-tim/sadisplay | 0f63a67b7a831fce812c662da8b7ca92407c7376 | [
"BSD-3-Clause"
] | null | null | null | tests/test_describe.py | andras-tim/sadisplay | 0f63a67b7a831fce812c662da8b7ca92407c7376 | [
"BSD-3-Clause"
] | 1 | 2021-11-06T17:13:48.000Z | 2021-11-06T17:13:48.000Z | # -*- coding: utf-8 -*-
from nose.tools import assert_equal
import sadisplay
import model
class TestDescribe(object):
def test_single_mapper(self):
objects, relations, inherits = sadisplay.describe([model.User])
assert len(objects) == 1
assert relations == []
assert inherits == ... | 27.429348 | 72 | 0.385377 |
3cce34f2a12d3d5b8569dbb303beaa191fb0fc7e | 271 | py | Python | venv/Lib/site-packages/mcipc/rcon/je/commands/spectate.py | Svesnav2/Discord-Bot-Minecraft-server-status | ee34948e741930567a3adb557197523f9d32ace1 | [
"Unlicense"
] | null | null | null | venv/Lib/site-packages/mcipc/rcon/je/commands/spectate.py | Svesnav2/Discord-Bot-Minecraft-server-status | ee34948e741930567a3adb557197523f9d32ace1 | [
"Unlicense"
] | null | null | null | venv/Lib/site-packages/mcipc/rcon/je/commands/spectate.py | Svesnav2/Discord-Bot-Minecraft-server-status | ee34948e741930567a3adb557197523f9d32ace1 | [
"Unlicense"
] | null | null | null | """Implementation of the spectate command."""
from mcipc.rcon.client import Client
__all__ = ['spectate']
def spectate(self: Client, target: str = None, player: str = None) -> str:
"""Start or stop spectating."""
return self.run('spectate', target, player)
| 20.846154 | 74 | 0.678967 |
394f33a8496008d2a0589e40471ec10911f80978 | 8,386 | py | Python | moe/optimal_learning/python/interfaces/expected_improvement_interface.py | misokg/Cornell-MOE | 1547d6b168b7fc70857d522baa0d5d45c41d3cdf | [
"Apache-2.0"
] | 218 | 2017-10-14T03:54:00.000Z | 2022-03-25T14:48:38.000Z | moe/optimal_learning/python/interfaces/expected_improvement_interface.py | Tracy3370/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | [
"Apache-2.0"
] | 45 | 2017-09-27T14:33:31.000Z | 2020-12-16T09:32:50.000Z | moe/optimal_learning/python/interfaces/expected_improvement_interface.py | Tracy3370/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | [
"Apache-2.0"
] | 63 | 2017-09-25T14:23:57.000Z | 2022-03-17T01:41:42.000Z | # -*- coding: utf-8 -*-
r"""Interface for computation of the Expected Improvement at points sampled from a GaussianProcess.
.. NOTE:: These comments were copied from the file comments in gpp_math.cpp.
See the package docs (:mod:`moe.optimal_learning.python.interfaces`) for the basics of expected improvement and the d... | 60.330935 | 156 | 0.72788 |
45349fefd8152498d09e20e2c45957e59446778f | 1,242 | py | Python | TCP/TCP_S.py | WilliamWuLH/Network_Basic_Programming | 284f8d3664340b0270271da5c50d5b8bb7ce8534 | [
"MIT"
] | 1 | 2020-11-29T14:56:22.000Z | 2020-11-29T14:56:22.000Z | TCP/TCP_S.py | WilliamWuLH/Network_Basic_Programming | 284f8d3664340b0270271da5c50d5b8bb7ce8534 | [
"MIT"
] | null | null | null | TCP/TCP_S.py | WilliamWuLH/Network_Basic_Programming | 284f8d3664340b0270271da5c50d5b8bb7ce8534 | [
"MIT"
] | null | null | null | import socket
import threading
import time
import sys
IP = '127.0.0.1'
PORT = 5050
SER_ADDR = IP,PORT
BUFFSIZE = 1024
def server_socket():
try:
sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sk.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sk.bind(SER_ADDR)
sk.list... | 24.84 | 79 | 0.605475 |
0df2781e7962d8d02dca4d1d2ed83132ca287e7e | 1,192 | py | Python | solutions/codeforces/1425Adp.py | forxhunter/ComputingIntro | 50fa2ac030748626c694ec5c884c5ac32f0b42a8 | [
"Apache-2.0"
] | 1 | 2021-01-02T04:31:34.000Z | 2021-01-02T04:31:34.000Z | solutions/codeforces/1425Adp.py | forxhunter/ComputingIntro | 50fa2ac030748626c694ec5c884c5ac32f0b42a8 | [
"Apache-2.0"
] | null | null | null | solutions/codeforces/1425Adp.py | forxhunter/ComputingIntro | 50fa2ac030748626c694ec5c884c5ac32f0b42a8 | [
"Apache-2.0"
] | null | null | null | '''
1425A. Arena of Greed
games, greedy, 1400
https://codeforces.com/problemset/problem/1425/A
'''
# get the input at once
t = int(input())
golds = []
for _ in range(t):
golds.append(int(input()))
# save the solved puzzle
dp = {}
# save the special case when n == 4
dp[4] = [3, 1]
def optimum(n):
left = n
g... | 21.285714 | 48 | 0.5 |
139da666ed14015ffb6dd0c13b72c5836ffcd054 | 5,866 | py | Python | hack/gen-content.py | berendt/fluxcd-website | fc8470f0e4cd4c9dfd8dd629257b69b999c7d885 | [
"Apache-2.0"
] | 6 | 2019-08-14T05:48:27.000Z | 2020-06-16T22:07:39.000Z | hack/gen-content.py | berendt/fluxcd-website | fc8470f0e4cd4c9dfd8dd629257b69b999c7d885 | [
"Apache-2.0"
] | 22 | 2019-08-15T06:22:15.000Z | 2020-10-30T15:15:37.000Z | hack/gen-content.py | berendt/fluxcd-website | fc8470f0e4cd4c9dfd8dd629257b69b999c7d885 | [
"Apache-2.0"
] | 10 | 2019-08-13T17:42:09.000Z | 2020-10-05T17:50:13.000Z | #!/usr/bin/env python3
# This was inspired by
# http://sigs.k8s.io/contributor-site/hack/gen-content.sh
# Check out
# external-sources/README.md for some instructions on how
# the file format works.
import csv
import os
import re
import shutil
import sys
import subprocess
import tempfile
# Workaround to make this w... | 32.230769 | 96 | 0.573645 |
ba6c89d444d8505bfe5837a9cb06454a2c8a0d73 | 557 | py | Python | Blips Server/alembic/versions/331f3604a692_altered_timelines.py | andrewapperley/Blips-Server | 136a68ca41cec682a727cf3df20d0d8b1fc35526 | [
"MIT"
] | null | null | null | Blips Server/alembic/versions/331f3604a692_altered_timelines.py | andrewapperley/Blips-Server | 136a68ca41cec682a727cf3df20d0d8b1fc35526 | [
"MIT"
] | null | null | null | Blips Server/alembic/versions/331f3604a692_altered_timelines.py | andrewapperley/Blips-Server | 136a68ca41cec682a727cf3df20d0d8b1fc35526 | [
"MIT"
] | null | null | null | """altered_timelines
Revision ID: 331f3604a692
Revises: 58972abd14d9
Create Date: 2014-06-04 23:07:22.652321
"""
# revision identifiers, used by Alembic.
revision = '331f3604a692'
down_revision = '58972abd14d9'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_column("notification_users", ... | 20.62963 | 68 | 0.736086 |
c52066be3cc8098d9be3c3c613baf4d682334e3c | 26,676 | py | Python | Lib/test/test_contextlib.py | Ricky-Wilson/Python | 9896d7a9901dabea4b3d555af471577a624d1b95 | [
"PSF-2.0"
] | 6 | 2016-03-15T19:07:14.000Z | 2018-08-15T13:11:03.000Z | Lib/test/test_contextlib.py | Ricky-Wilson/Python | 9896d7a9901dabea4b3d555af471577a624d1b95 | [
"PSF-2.0"
] | null | null | null | Lib/test/test_contextlib.py | Ricky-Wilson/Python | 9896d7a9901dabea4b3d555af471577a624d1b95 | [
"PSF-2.0"
] | 2 | 2016-08-24T14:29:14.000Z | 2021-12-29T19:27:06.000Z | """Unit tests for contextlib.py, and other context managers."""
import io
import sys
import tempfile
import unittest
from contextlib import * # Tests __all__
from test import support
try:
import threading
except ImportError:
threading = None
class ContextManagerTestCase(unittest.TestCase):
def test_con... | 31.569231 | 80 | 0.575611 |
bf24cd43748302e2843970cdd696ef350068adcd | 566 | py | Python | packages/server/build.py | arraypad/automuse | 09aa75375048c4175950eb91a32d114cbc22940a | [
"Unlicense"
] | 1 | 2021-03-13T17:22:36.000Z | 2021-03-13T17:22:36.000Z | packages/server/build.py | arraypad/automuse | 09aa75375048c4175950eb91a32d114cbc22940a | [
"Unlicense"
] | null | null | null | packages/server/build.py | arraypad/automuse | 09aa75375048c4175950eb91a32d114cbc22940a | [
"Unlicense"
] | 1 | 2021-02-22T17:08:17.000Z | 2021-02-22T17:08:17.000Z | #!/usr/bin/env python
import os
import glob
import json
from shutil import copyfile
def read(path):
with open(path, 'r') as f:
return f.read()
templates = {
os.path.splitext(os.path.basename(f))[0]: read(f) \
for f in glob.glob('../ui/example/*.js')
}
index = read('src/index.js').replace(
'templates = {}',
... | 19.517241 | 63 | 0.64311 |
8f1be471721acb22dda30cab8c39b00d21f8b5df | 21,298 | py | Python | printrun/stlplater.py | aurelianammon/flask-socketio-printer | addd318d1468891fdf46adb1f01f319ae33f2044 | [
"MIT"
] | null | null | null | printrun/stlplater.py | aurelianammon/flask-socketio-printer | addd318d1468891fdf46adb1f01f319ae33f2044 | [
"MIT"
] | null | null | null | printrun/stlplater.py | aurelianammon/flask-socketio-printer | addd318d1468891fdf46adb1f01f319ae33f2044 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# This file is part of the Printrun suite.
#
# Printrun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pri... | 40.957692 | 137 | 0.5416 |
133b42d22c9f7356dfd6b17ce9a10517755aed30 | 650 | py | Python | examples/16_inverse_design/inverse_spar_design.py | johnjasa/WISDEM | a4571e71cb5b9869c81790f8abb1bb7fba8fdb02 | [
"Apache-2.0"
] | null | null | null | examples/16_inverse_design/inverse_spar_design.py | johnjasa/WISDEM | a4571e71cb5b9869c81790f8abb1bb7fba8fdb02 | [
"Apache-2.0"
] | null | null | null | examples/16_inverse_design/inverse_spar_design.py | johnjasa/WISDEM | a4571e71cb5b9869c81790f8abb1bb7fba8fdb02 | [
"Apache-2.0"
] | null | null | null | import os
import sys
import time
from wisdem.commonse.mpi_tools import MPI
from wisdem.glue_code.runWISDEM import run_wisdem
## File management
run_dir = os.path.dirname(os.path.realpath(__file__)) + os.sep
wisdem_examples = os.path.dirname(os.path.dirname(run_dir))
fname_wt_input_oc3 = os.path.join(wisdem_examples, ... | 38.235294 | 118 | 0.818462 |
78916087743484625c09bb1a4f5249d6c4693fad | 13,366 | py | Python | tods/feature_analysis/StatisticalSkew.py | ZhuangweiKang/tods | fe3f55f8ccb306dd292c668e0f1154f1afdfa556 | [
"Apache-2.0"
] | 544 | 2020-09-21T06:02:33.000Z | 2022-03-27T07:16:32.000Z | tods/feature_analysis/StatisticalSkew.py | ZhuangweiKang/tods | fe3f55f8ccb306dd292c668e0f1154f1afdfa556 | [
"Apache-2.0"
] | 35 | 2020-09-21T06:33:13.000Z | 2022-03-11T14:20:21.000Z | tods/feature_analysis/StatisticalSkew.py | ZhuangweiKang/tods | fe3f55f8ccb306dd292c668e0f1154f1afdfa556 | [
"Apache-2.0"
] | 86 | 2020-09-21T16:44:33.000Z | 2022-03-11T18:20:22.000Z | import os
from typing import Any,Optional,List
import statsmodels.api as sm
import numpy as np
from d3m import container, utils as d3m_utils
from d3m import utils
from numpy import ndarray
from collections import OrderedDict
from scipy import sparse
import os
from scipy import stats
import numpy
import typing
import ... | 41.509317 | 221 | 0.654496 |
d07299313299db4ad90e7916c7f0d8c28fd5e6d0 | 21,702 | py | Python | salt/modules/boto_asg.py | bogdanr/salt | 4f198525873a1b7da3fbb9994dbb40d381494922 | [
"Apache-2.0"
] | null | null | null | salt/modules/boto_asg.py | bogdanr/salt | 4f198525873a1b7da3fbb9994dbb40d381494922 | [
"Apache-2.0"
] | null | null | null | salt/modules/boto_asg.py | bogdanr/salt | 4f198525873a1b7da3fbb9994dbb40d381494922 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon Autoscale Groups
.. versionadded:: 2014.7.0
:configuration: This module accepts explicit autoscale credentials but can also
utilize IAM roles assigned to the instance trough Instance Profiles.
Dynamic credentials are then automatically obtained from AWS... | 39.60219 | 190 | 0.646945 |
328e84854a1a976f05c957b09e55654232d32f6e | 3,547 | py | Python | rally/plugins/openstack/scenarios/neutron/security_groups.py | LorenzoBianconi/rally | 2bbd7ee590cca048fb4ad6a8eefc484989979ff8 | [
"Apache-2.0"
] | null | null | null | rally/plugins/openstack/scenarios/neutron/security_groups.py | LorenzoBianconi/rally | 2bbd7ee590cca048fb4ad6a8eefc484989979ff8 | [
"Apache-2.0"
] | 1 | 2020-07-14T11:29:31.000Z | 2020-07-14T11:29:31.000Z | rally/plugins/openstack/scenarios/neutron/security_groups.py | LorenzoBianconi/rally | 2bbd7ee590cca048fb4ad6a8eefc484989979ff8 | [
"Apache-2.0"
] | 1 | 2020-07-02T01:33:48.000Z | 2020-07-02T01:33:48.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 45.474359 | 79 | 0.673809 |
bd9e4a2d7f32035cf02a2267bfca2e54e4216f8a | 3,013 | py | Python | utils/utils.py | kashimmirza/TextBoxGan | ba7aeef92a0cce2c5a33d259beda038825a4bac4 | [
"MIT"
] | 1 | 2021-03-14T11:27:33.000Z | 2021-03-14T11:27:33.000Z | utils/utils.py | kashimmirza/TextBoxGan | ba7aeef92a0cce2c5a33d259beda038825a4bac4 | [
"MIT"
] | null | null | null | utils/utils.py | kashimmirza/TextBoxGan | ba7aeef92a0cce2c5a33d259beda038825a4bac4 | [
"MIT"
] | null | null | null | from typing import List
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from config import cfg
def mask_text_box(fake_images: tf.float32, input_words: tf.int32, char_width: int):
"""
Masks the text boxes outputted by the generator, in the cases where the length of t... | 29.539216 | 118 | 0.658148 |
47cb4a0a213c6dee725b3019e7e588ac1037c26e | 2,013 | py | Python | Shark_Training/pyimagesearch/nn/conv/simplenet.py | crpurcell/MQ_DPI_Release | 97444513e8b8d48ec91ff8a43b9dfaed0da029f9 | [
"MIT"
] | null | null | null | Shark_Training/pyimagesearch/nn/conv/simplenet.py | crpurcell/MQ_DPI_Release | 97444513e8b8d48ec91ff8a43b9dfaed0da029f9 | [
"MIT"
] | null | null | null | Shark_Training/pyimagesearch/nn/conv/simplenet.py | crpurcell/MQ_DPI_Release | 97444513e8b8d48ec91ff8a43b9dfaed0da029f9 | [
"MIT"
] | null | null | null | #=============================================================================#
# #
# MODIFIED: 05-Sep-2018 by C. Purcell #
# #
... | 36.6 | 79 | 0.486836 |
002bf02b27d5bfd97d1a7445458c50b7fe992004 | 8,360 | py | Python | src/ebay_rest/api/buy_marketing/configuration.py | gbm001/ebay_rest | 077d3478423ccd80ff35e0361821d6a11180bc54 | [
"MIT"
] | 3 | 2021-12-12T04:28:03.000Z | 2022-03-10T03:29:18.000Z | src/ebay_rest/api/buy_marketing/configuration.py | jdavv/ebay_rest | 20fc88c6aefdae9ab90f9c1330e79abddcd750cd | [
"MIT"
] | 33 | 2021-06-16T20:44:36.000Z | 2022-03-30T14:55:06.000Z | src/ebay_rest/api/buy_marketing/configuration.py | jdavv/ebay_rest | 20fc88c6aefdae9ab90f9c1330e79abddcd750cd | [
"MIT"
] | 7 | 2021-06-03T09:30:23.000Z | 2022-03-08T19:51:33.000Z | # coding: utf-8
"""
Buy Marketing API
The Marketing API retrieves eBay products based on a metric, such as Best Selling, as well as products that were also bought and also viewed. # noqa: E501
OpenAPI spec version: v1_beta.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""... | 32.913386 | 159 | 0.608732 |
54ce8f3f5566f3f8cb283172a78856bf280b04ad | 1,224 | py | Python | ml-agents/mlagents/trainers/tests/test_models.py | williamthegrey/ml-agents | c75eacbdc40f9afffaedfd79d861b83a88cf3b8d | [
"Apache-2.0"
] | 1 | 2020-07-06T14:15:33.000Z | 2020-07-06T14:15:33.000Z | ml-agents/mlagents/trainers/tests/test_models.py | williamthegrey/ml-agents | c75eacbdc40f9afffaedfd79d861b83a88cf3b8d | [
"Apache-2.0"
] | null | null | null | ml-agents/mlagents/trainers/tests/test_models.py | williamthegrey/ml-agents | c75eacbdc40f9afffaedfd79d861b83a88cf3b8d | [
"Apache-2.0"
] | 1 | 2020-12-10T09:53:30.000Z | 2020-12-10T09:53:30.000Z | import pytest
from mlagents.trainers.models import ModelUtils
from mlagents.tf_utils import tf
from mlagents_envs.base_env import BehaviorSpec, ActionType
def create_behavior_spec(num_visual, num_vector, vector_size):
behavior_spec = BehaviorSpec(
[(84, 84, 3)] * int(num_visual) + [(vector_size,)] * int(... | 33.081081 | 77 | 0.714869 |
ef2beccca2b40e133e227b3f37b4302cba51a0b9 | 1,467 | py | Python | DynamicProgramming/CommonPatternsContinued/paint_fence.py | mamoudmatook/Leetcode | 59fb1612ee648a9b99ff7cc779ada5656c01ecd2 | [
"MIT"
] | null | null | null | DynamicProgramming/CommonPatternsContinued/paint_fence.py | mamoudmatook/Leetcode | 59fb1612ee648a9b99ff7cc779ada5656c01ecd2 | [
"MIT"
] | null | null | null | DynamicProgramming/CommonPatternsContinued/paint_fence.py | mamoudmatook/Leetcode | 59fb1612ee648a9b99ff7cc779ada5656c01ecd2 | [
"MIT"
] | null | null | null | #
# Created on Sun Dec 26 2021
#
# The MIT License (MIT)
# Copyright (c) 2021 Maatuq
#
# 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 ri... | 41.914286 | 122 | 0.697342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.