hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | 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 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | 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 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | 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 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7562cc02d0d3371653c49379ac8aefc247ea73b | 125,928 | py | Python | catboost/python-package/catboost/core.py | ProskuraPD/catboost | d4593d4fbc8b8da66ff2d8b838578eba819d9d0d | [
"Apache-2.0"
] | null | null | null | catboost/python-package/catboost/core.py | ProskuraPD/catboost | d4593d4fbc8b8da66ff2d8b838578eba819d9d0d | [
"Apache-2.0"
] | null | null | null | catboost/python-package/catboost/core.py | ProskuraPD/catboost | d4593d4fbc8b8da66ff2d8b838578eba819d9d0d | [
"Apache-2.0"
] | null | null | null | import sys
from copy import deepcopy
from six import iteritems, string_types, integer_types
import os
import imp
from collections import Iterable, Sequence, Mapping, MutableMapping
import warnings
import numpy as np
import ctypes
import platform
import tempfile
from enum import Enum
from operator import itemgetter
if ... | 42.4 | 180 | 0.647418 | import sys
from copy import deepcopy
from six import iteritems, string_types, integer_types
import os
import imp
from collections import Iterable, Sequence, Mapping, MutableMapping
import warnings
import numpy as np
import ctypes
import platform
import tempfile
from enum import Enum
from operator import itemgetter
if ... | true | true |
f7562e6282d137e43a57b3bb0fd225b46fb12aa0 | 2,539 | py | Python | Code/Data_Collection/APIs/Itjobs_api/itjobs_api.py | gilnribeiro/Work-Project | 15ad906ef5e757daed1df9c7547e5703ad496930 | [
"MIT"
] | 1 | 2022-01-31T11:31:04.000Z | 2022-01-31T11:31:04.000Z | Code/Data_Collection/APIs/Itjobs_api/itjobs_api.py | gilnribeiro/Work-Project | 15ad906ef5e757daed1df9c7547e5703ad496930 | [
"MIT"
] | null | null | null | Code/Data_Collection/APIs/Itjobs_api/itjobs_api.py | gilnribeiro/Work-Project | 15ad906ef5e757daed1df9c7547e5703ad496930 | [
"MIT"
] | null | null | null | import json
import os
from .config import API_KEY
import requests
from datetime import date
from w3lib.html import remove_tags
def save_data_to_json(file_name, data):
"""Save data to a json file creating it if it does not already exist
:parameter: file_name -> 'example' do not add the '.json'
:parameter:... | 30.590361 | 105 | 0.570303 | import json
import os
from .config import API_KEY
import requests
from datetime import date
from w3lib.html import remove_tags
def save_data_to_json(file_name, data):
if os.path.exists(file_name+'.json') == False:
with open(file_name+'.json', 'w', encoding='utf-8') as json_file:
... | true | true |
f7562f1fcd1e17c71bb61a1ba765f5cffb3a1dbc | 37,171 | py | Python | plantcv/plantcv/spectral_index/spectral_index.py | ygarrot/plantcv | e934a891e0d1bf8987ca6a9f982a4ac1f420bfe7 | [
"MIT"
] | 1 | 2022-03-12T05:46:03.000Z | 2022-03-12T05:46:03.000Z | plantcv/plantcv/spectral_index/spectral_index.py | YuanYu-Double/plantcv | 0e11c7f63d96a52487e01e3b67744aa8697eedb2 | [
"MIT"
] | null | null | null | plantcv/plantcv/spectral_index/spectral_index.py | YuanYu-Double/plantcv | 0e11c7f63d96a52487e01e3b67744aa8697eedb2 | [
"MIT"
] | null | null | null | # Extract one of the predefined indices from a hyperspectral datacube
import os
import numpy as np
import cv2
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import fatal_error
from plantcv.plantcv import Spectral_data
from plantcv.plantcv.transform import rescale
from... | 41.812148 | 115 | 0.672218 |
import os
import numpy as np
import cv2
from plantcv.plantcv import params
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import fatal_error
from plantcv.plantcv import Spectral_data
from plantcv.plantcv.transform import rescale
from plantcv.plantcv.hyperspectral import _find_closest
def ndvi(hsi, di... | true | true |
f7562f6dc837f9ba6a3ceb3e7c9c6a62076cf323 | 1,031 | py | Python | Django_learning_2/Django_05_Ajax/Django_05_Ajax/urls.py | hgzerowzh/Django | 2be08ad8e44065f3a0a884998d6120a415eddbb3 | [
"Apache-2.0"
] | null | null | null | Django_learning_2/Django_05_Ajax/Django_05_Ajax/urls.py | hgzerowzh/Django | 2be08ad8e44065f3a0a884998d6120a415eddbb3 | [
"Apache-2.0"
] | null | null | null | Django_learning_2/Django_05_Ajax/Django_05_Ajax/urls.py | hgzerowzh/Django | 2be08ad8e44065f3a0a884998d6120a415eddbb3 | [
"Apache-2.0"
] | null | null | null | """Django_05_Ajax URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Clas... | 27.131579 | 77 | 0.690592 | from django.contrib import admin
from django.urls import path
from django.conf.urls import url
from app01 import views
urlpatterns = [
url(r'^index.html$', views.index),
url(r'^ajax1.html$', views.ajax1),
url(r'^ajax2.html$', views.ajax2),
url(r'^upload.html$', views.upload),
url(r'^upl... | true | true |
f7562fbb0fd40e6f732b13273da04f190ed5f4bf | 626 | py | Python | bin/dynamodb_to_csv.py | istrategylabs/amweekly | befd03cc4ed9ea0dceb0bf24f339016faf6fb10a | [
"MIT"
] | 3 | 2016-09-29T17:14:51.000Z | 2020-05-12T20:38:27.000Z | bin/dynamodb_to_csv.py | istrategylabs/amweekly | befd03cc4ed9ea0dceb0bf24f339016faf6fb10a | [
"MIT"
] | 2 | 2017-08-04T19:53:45.000Z | 2018-03-07T14:10:36.000Z | bin/dynamodb_to_csv.py | istrategylabs/amweekly | befd03cc4ed9ea0dceb0bf24f339016faf6fb10a | [
"MIT"
] | 1 | 2019-12-17T16:11:28.000Z | 2019-12-17T16:11:28.000Z | import csv
import json
from datetime import datetime
"""Useful for converting DynamoDB exports to CSV"""
data = []
with open('data') as f:
for line in f:
data.append(json.loads(line))
with open('data.csv', 'w', encoding='utf8') as csvf:
w = csv.writer(csvf, quoting=csv.QUOTE_MINIMAL)
w.writerow(... | 28.454545 | 56 | 0.623003 | import csv
import json
from datetime import datetime
data = []
with open('data') as f:
for line in f:
data.append(json.loads(line))
with open('data.csv', 'w', encoding='utf8') as csvf:
w = csv.writer(csvf, quoting=csv.QUOTE_MINIMAL)
w.writerow(['id', 'created_at', 'user_name', 'url'])
for id... | true | true |
f75630cbc7b1eef703d5e902537d65487d1b7612 | 4,126 | py | Python | sim/pid.py | jmagine/rf-selection | ba9dcb5ca550916873ce68baa71da983f2dd4be5 | [
"MIT"
] | 1 | 2020-05-06T01:28:06.000Z | 2020-05-06T01:28:06.000Z | sim/pid.py | jmagine/multiuav-rf | ba9dcb5ca550916873ce68baa71da983f2dd4be5 | [
"MIT"
] | null | null | null | sim/pid.py | jmagine/multiuav-rf | ba9dcb5ca550916873ce68baa71da983f2dd4be5 | [
"MIT"
] | null | null | null | '''*-----------------------------------------------------------------------*---
Author: Jason Ma
Date : Oct 18 2018
TODO
File Name : pid.py
Description: TODO
---... | 25.469136 | 127 | 0.537082 |
import time
import matplotlib.animation as anim
import matplotlib.pyplot as plt
import threading
import math
import numpy as np
ORIGIN_X = 0.0
ORIGIN_Y = 0.0
C_R = 10
fig = plt.figure()
ax = fig.add_subplot(2,1,1)
ax2 = fig.add_subplot(2,1,2)
scat = ax.scatter([], [])
ax.set_xlim([-1 * C_R - 1, C_R + 1])
ax.set_yli... | true | true |
f756319f056e211d5b1fbc459b2a23eb1a227f56 | 6,493 | py | Python | stog/modules/initializers.py | sfillwo/stog | b02e2dbe8989078ccdc3df611d8b08b63d28fcae | [
"MIT"
] | 172 | 2019-11-19T05:52:36.000Z | 2022-03-26T04:58:24.000Z | stog/modules/initializers.py | sfillwo/stog | b02e2dbe8989078ccdc3df611d8b08b63d28fcae | [
"MIT"
] | 22 | 2019-07-13T09:11:57.000Z | 2021-11-17T05:30:36.000Z | stog/modules/initializers.py | banditelol/stog | b965c47c17472eea11ab63aab9aa738af7875f06 | [
"MIT"
] | 39 | 2019-06-26T11:37:51.000Z | 2022-03-07T13:30:26.000Z | """
Adopted from AllenNLP:
https://github.com/allenai/allennlp/blob/v0.6.1/allennlp/nn/initializers.py
An initializer is just a PyTorch function.
Here we implement a proxy class that allows us
to register them and supply any additional function arguments
(for example, the ``mean`` and ``std`` of a normal initializ... | 49.946154 | 152 | 0.708301 | import re
import math
from typing import Callable, List, Tuple, Type, Iterable
import itertools
import torch
import torch.nn.init
from stog.utils import logging
from stog.utils.checks import ConfigurationError
logger = logging.init_logger()
def uniform_unit_scaling(tensor: torch.Tensor, nonlinearity: str = "linea... | true | true |
f75632098576858b984cb783ccc623277954277e | 373,414 | py | Python | template_container_ferret/labels/slice_77.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_ferret/labels/slice_77.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | template_container_ferret/labels/slice_77.py | lkondratova/Brainplot | 3c8a88c1995dedeaa5cbd88ee71499c7cf9c571d | [
"MIT"
] | null | null | null | coordinates_BCBCBC = ((159, 111),
(162, 108), (163, 108), )
coordinates_993300 = ((222, 14),
(222, 16), (222, 17), (222, 18), (222, 19), (222, 20), (222, 21), (222, 22), (222, 23), (222, 24), (222, 25), (222, 26), (222, 27), (222, 28), (222, 29), (222, 30), (222, 31), (222, 32), (222, 34), (222, 42), (222, 44), (2... | 779.569937 | 865 | 0.481669 | coordinates_BCBCBC = ((159, 111),
(162, 108), (163, 108), )
coordinates_993300 = ((222, 14),
(222, 16), (222, 17), (222, 18), (222, 19), (222, 20), (222, 21), (222, 22), (222, 23), (222, 24), (222, 25), (222, 26), (222, 27), (222, 28), (222, 29), (222, 30), (222, 31), (222, 32), (222, 34), (222, 42), (222, 44), (2... | true | true |
f75632666d1fc43d67c7136f5ed03d3cd1a06ef3 | 1,559 | py | Python | example_mask.py | jamal919/pyIntertidalDEM | 1db667a9b52939a52c71d64e20200d66bfb03665 | [
"Apache-2.0"
] | 3 | 2019-12-08T14:41:50.000Z | 2020-06-17T11:04:01.000Z | example_mask.py | jamal919/pyIntertidalDEM | 1db667a9b52939a52c71d64e20200d66bfb03665 | [
"Apache-2.0"
] | 7 | 2021-06-30T13:24:16.000Z | 2022-03-10T11:55:24.000Z | example_mask.py | jamal919/pyIntertidalDEM | 1db667a9b52939a52c71d64e20200d66bfb03665 | [
"Apache-2.0"
] | 1 | 2019-10-10T19:45:26.000Z | 2019-10-10T19:45:26.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import gc
import time
import numpy as np
import matplotlib.pyplot as plt
from pyintdem.core import Band, RGB
from pyintdem.data import Sentinel2
# Directory Settings
input_dir='/run/media/khan/Backup KE Maxelev'
output_dir =... | 31.816327 | 84 | 0.617062 |
from __future__ import print_function
import os
import gc
import time
import numpy as np
import matplotlib.pyplot as plt
from pyintdem.core import Band, RGB
from pyintdem.data import Sentinel2
input_dir='/run/media/khan/Backup KE Maxelev'
output_dir = '/run/media/khan/Backup KE Maxelev/Analysis_v3'
data_dir = os.pat... | true | true |
f756327402bca1a56490b0590a0a33c7e9b31596 | 2,283 | py | Python | tests/tabular_output/test_terminaltables_adapter.py | tirkarthi/cli_helpers | 2ae90b0c579e604d53f6297255491e049d5029f6 | [
"BSD-3-Clause"
] | null | null | null | tests/tabular_output/test_terminaltables_adapter.py | tirkarthi/cli_helpers | 2ae90b0c579e604d53f6297255491e049d5029f6 | [
"BSD-3-Clause"
] | null | null | null | tests/tabular_output/test_terminaltables_adapter.py | tirkarthi/cli_helpers | 2ae90b0c579e604d53f6297255491e049d5029f6 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Test the terminaltables output adapter."""
from __future__ import unicode_literals
from textwrap import dedent
import pytest
from cli_helpers.compat import HAS_PYGMENTS
from cli_helpers.tabular_output import terminaltables_adapter
if HAS_PYGMENTS:
from pygments.style import Style
... | 32.614286 | 86 | 0.540955 |
from __future__ import unicode_literals
from textwrap import dedent
import pytest
from cli_helpers.compat import HAS_PYGMENTS
from cli_helpers.tabular_output import terminaltables_adapter
if HAS_PYGMENTS:
from pygments.style import Style
from pygments.token import Token
def test_terminal_tables_adapter():... | true | true |
f75633c5a9b3509ebc088b632551c61995e69559 | 2,818 | py | Python | quantitative_finance/L3/python/dje_test.py | heeran-xilinx/Vitis_Libraries | ab3f6969e397dc44705a7278fb0d480e905e72db | [
"Apache-2.0"
] | 1 | 2021-06-14T17:02:06.000Z | 2021-06-14T17:02:06.000Z | quantitative_finance/L3/python/dje_test.py | heeran-xilinx/Vitis_Libraries | ab3f6969e397dc44705a7278fb0d480e905e72db | [
"Apache-2.0"
] | null | null | null | quantitative_finance/L3/python/dje_test.py | heeran-xilinx/Vitis_Libraries | ab3f6969e397dc44705a7278fb0d480e905e72db | [
"Apache-2.0"
] | 1 | 2021-06-08T06:18:10.000Z | 2021-06-08T06:18:10.000Z | #!/usr/bin/env python3
# Ensure environmental variables i.e. paths are set to used the modules
from xf_fintech_python import DeviceManager, MCEuropeanDJE, OptionType
import array
# State test financial model
print("\nThe Dow Jones MCEuropean financial model\n========================================\n")
# Declaring V... | 44.03125 | 254 | 0.750532 |
from xf_fintech_python import DeviceManager, MCEuropeanDJE, OptionType
import array
print("\nThe Dow Jones MCEuropean financial model\n========================================\n")
deviceList = DeviceManager.getDeviceList("u250")
outputResults = []
lastruntime = 0
stockPriceList = [163.69, 117.38, 182.06, 347.82, 122... | true | true |
f75633d6d15ba85ae7c0cd0865f4bc33f738c7a0 | 481 | py | Python | assets/Poser/Reality/Runtime/Libraries/light/Reality/SingleIBLs/LineSingleV/Large/LineSingleV_Large_70.py | Red54/reality | 510d4f5fde2f4c5535482f1ea199f914102b8a2a | [
"BSD-3-Clause"
] | null | null | null | assets/Poser/Reality/Runtime/Libraries/light/Reality/SingleIBLs/LineSingleV/Large/LineSingleV_Large_70.py | Red54/reality | 510d4f5fde2f4c5535482f1ea199f914102b8a2a | [
"BSD-3-Clause"
] | null | null | null | assets/Poser/Reality/Runtime/Libraries/light/Reality/SingleIBLs/LineSingleV/Large/LineSingleV_Large_70.py | Red54/reality | 510d4f5fde2f4c5535482f1ea199f914102b8a2a | [
"BSD-3-Clause"
] | null | null | null | #
# Copyright (c) Pret-a-3D/Paolo Ciccone. All rights reserved.
# Modified by Fuzzy70/Lee Furssedonn with kind permission from Paolo Ciccone
#
from Reality_services import *
from Reality import *
# To customize this script all you need to do is to
# change the following variable
Re_sIBL_Map = ":Runtime:Text... | 32.066667 | 90 | 0.767152 |
from Reality_services import *
from Reality import *
Re_sIBL_Map = ":Runtime:Textures:Reality:SingleIBLs:LineSingleV:LineSingleV_Large_70.ibl"
Reality.Scene().setIBLImage(ReResolvePoserPath(Re_sIBL_Map).encode("utf8"))
| true | true |
f7563408c01bf0491d2ae9779ba8cbf803ededa9 | 12,691 | py | Python | bin/main.py | bferd/bing-desktop-wallpaper-changer-PepermintOS | 595eeea6ab4ff58ea757956ed642aa88c4b2bb83 | [
"MIT"
] | null | null | null | bin/main.py | bferd/bing-desktop-wallpaper-changer-PepermintOS | 595eeea6ab4ff58ea757956ed642aa88c4b2bb83 | [
"MIT"
] | null | null | null | bin/main.py | bferd/bing-desktop-wallpaper-changer-PepermintOS | 595eeea6ab4ff58ea757956ed642aa88c4b2bb83 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
import locale
import os
import re
import sys
import shutil
from PIL import Image
# setup done to /opt/bing-desktop-wallpaper-changer by BDWC Installer v3.3.1-release
path_to_Bing_Wallpapers="/opt/bing-desktop-wallpaper-changer"
# wait computer internet connection
os.system("... | 28.647856 | 112 | 0.589158 |
import locale
import os
import re
import sys
import shutil
from PIL import Image
path_to_Bing_Wallpapers="/opt/bing-desktop-wallpaper-changer"
os.system("sleep 10")
try: from urllib.request import urlopen
from urllib.request import urlretrieve
from configparser import ConfigParser
except ImportError: ... | true | true |
f75634ccc49a830308698fc6bea62d7f191eeab2 | 1,668 | py | Python | xero_python/accounting/models/report_with_rows.py | parasharrk/xero-python | e8416f3bd893520a343af014f5bb65acbf1f4f13 | [
"MIT"
] | null | null | null | xero_python/accounting/models/report_with_rows.py | parasharrk/xero-python | e8416f3bd893520a343af014f5bb65acbf1f4f13 | [
"MIT"
] | null | null | null | xero_python/accounting/models/report_with_rows.py | parasharrk/xero-python | e8416f3bd893520a343af014f5bb65acbf1f4f13 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Accounting API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
from xero_pytho... | 25.272727 | 124 | 0.622902 |
import re
from xero_python.models import BaseModel
class ReportWithRows(BaseModel):
openapi_types = {"reports": "list[ReportWithRow]"}
attribute_map = {"reports": "Reports"}
def __init__(self, reports=None):
self._reports = None
self.discriminator = None
if reports is no... | true | true |
f75634d856e8331069faa8f4d348f2ded3823467 | 17,929 | py | Python | tensorflow/python/ops/string_ops.py | datanonymous/TFandroid | 89927e863b1ad96184ab09188f62b7e391c896d9 | [
"Apache-2.0"
] | 6 | 2019-02-05T22:36:51.000Z | 2022-01-14T03:50:57.000Z | tensorflow/python/ops/string_ops.py | shekharpalit/tensorflow | 6aa83398ab03bfae822f36772757097bcb98b6ed | [
"Apache-2.0"
] | 1 | 2019-09-14T04:40:07.000Z | 2020-11-18T18:16:17.000Z | tensorflow/python/ops/string_ops.py | shekharpalit/tensorflow | 6aa83398ab03bfae822f36772757097bcb98b6ed | [
"Apache-2.0"
] | 8 | 2016-01-14T13:12:56.000Z | 2021-04-09T10:20:53.000Z | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 37.430063 | 89 | 0.703609 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.compat import compat
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
f... | true | true |
f756352060c474d7a123e36d9d7fc377ffb88fbb | 124,150 | py | Python | musicbot/bot.py | javifdeezg/musicdiscordapp | 3f64d7feb470c0d26b154d8a754c57943dc459b7 | [
"MIT"
] | null | null | null | musicbot/bot.py | javifdeezg/musicdiscordapp | 3f64d7feb470c0d26b154d8a754c57943dc459b7 | [
"MIT"
] | null | null | null | musicbot/bot.py | javifdeezg/musicdiscordapp | 3f64d7feb470c0d26b154d8a754c57943dc459b7 | [
"MIT"
] | null | null | null | import os
import sys
import time
import shlex
import shutil
import random
import inspect
import logging
import asyncio
import pathlib
import traceback
import math
import re
import aiohttp
import discord
import colorlog
from io import BytesIO, StringIO
from functools import wraps
from textwrap import dedent
from datet... | 43.018018 | 219 | 0.585832 | import os
import sys
import time
import shlex
import shutil
import random
import inspect
import logging
import asyncio
import pathlib
import traceback
import math
import re
import aiohttp
import discord
import colorlog
from io import BytesIO, StringIO
from functools import wraps
from textwrap import dedent
from datet... | true | true |
f7563656884f83256297a916c01cf434867d4e25 | 508 | py | Python | src/xrd/crypto/Qryptonight7.py | jack3343/xrd-core | 48a6d890d62485c627060b017eadf85602268caf | [
"MIT"
] | null | null | null | src/xrd/crypto/Qryptonight7.py | jack3343/xrd-core | 48a6d890d62485c627060b017eadf85602268caf | [
"MIT"
] | null | null | null | src/xrd/crypto/Qryptonight7.py | jack3343/xrd-core | 48a6d890d62485c627060b017eadf85602268caf | [
"MIT"
] | null | null | null | # coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import threading
from xrd.core.Singleton import Singleton
from pyqryptonight import pyqryptonight
class Qryptonight7(object, metaclass=Singleton):
def __init__(... | 26.736842 | 69 | 0.720472 | import threading
from xrd.core.Singleton import Singleton
from pyqryptonight import pyqryptonight
class Qryptonight7(object, metaclass=Singleton):
def __init__(self):
self.lock = threading.Lock()
self._qn = pyqryptonight.Qryptonight()
def hash(self, blob):
with self.lock:
... | true | true |
f756370ff38b779e9d5f94d06a038a158760e458 | 23,845 | py | Python | pypowervm/tests/utils/test_lpar_bldr.py | VedaAnnayappa/pypowervm | 266e5cb2f8725c63267b41b617ba5a1db2adadfa | [
"Apache-2.0"
] | null | null | null | pypowervm/tests/utils/test_lpar_bldr.py | VedaAnnayappa/pypowervm | 266e5cb2f8725c63267b41b617ba5a1db2adadfa | [
"Apache-2.0"
] | null | null | null | pypowervm/tests/utils/test_lpar_bldr.py | VedaAnnayappa/pypowervm | 266e5cb2f8725c63267b41b617ba5a1db2adadfa | [
"Apache-2.0"
] | null | null | null | # Copyright 2015, 2018 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 47.031558 | 79 | 0.636192 |
import uuid
import mock
import six
import testtools
from pypowervm.tests import test_fixtures as fx
from pypowervm.tests.test_utils import xml_sections
from pypowervm.utils import lpar_builder as lpar_bldr
import pypowervm.utils.uuid as pvm_uuid
from pypowervm.wrappers import base_partition as bp
from pypowervm.wrap... | true | true |
f756384c8e1466b04778991d3f8f2463685017d2 | 975 | py | Python | indico/modules/cephalopod/__init__.py | salevajo/indico | 6f9cbabc20d1641caea907099388ae2b04965cf8 | [
"MIT"
] | 1 | 2021-12-27T17:51:27.000Z | 2021-12-27T17:51:27.000Z | indico/modules/cephalopod/__init__.py | salevajo/indico | 6f9cbabc20d1641caea907099388ae2b04965cf8 | [
"MIT"
] | 5 | 2021-04-08T19:26:47.000Z | 2022-01-24T16:30:18.000Z | indico/modules/cephalopod/__init__.py | salevajo/indico | 6f9cbabc20d1641caea907099388ae2b04965cf8 | [
"MIT"
] | 2 | 2019-02-24T17:29:10.000Z | 2021-04-08T19:23:27.000Z | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import session
from indico.core import signals
from indico.core.logger import Logger
from indi... | 27.857143 | 113 | 0.744615 |
from flask import session
from indico.core import signals
from indico.core.logger import Logger
from indico.core.settings import SettingsProxy
from indico.util.i18n import _
from indico.web.flask.util import url_for
from indico.web.menu import SideMenuItem
__all__ = ('logger', 'cephalopod_settings')
logger = Logge... | true | true |
f75639d891b4b88505cbb675b4db4239614d5885 | 1,950 | py | Python | contrib/runners/mistral_v2/setup.py | machao19902/st2 | 6768a529af1b3c12109cbfeae19d3cf7fdb71bb7 | [
"Apache-2.0"
] | null | null | null | contrib/runners/mistral_v2/setup.py | machao19902/st2 | 6768a529af1b3c12109cbfeae19d3cf7fdb71bb7 | [
"Apache-2.0"
] | 1 | 2020-03-19T23:45:59.000Z | 2020-03-19T23:45:59.000Z | contrib/runners/mistral_v2/setup.py | machao19902/st2 | 6768a529af1b3c12109cbfeae19d3cf7fdb71bb7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Licensed to the StackStorm, Inc ('StackStorm') 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 "Licen... | 35.454545 | 81 | 0.73641 |
from __future__ import absolute_import
import os.path
from setuptools import setup
from setuptools import find_packages
from dist_utils import fetch_requirements
from dist_utils import apply_vagrant_workaround
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
REQUIREMENTS_FILE = os.path.join(BASE_DIR, 'requirem... | true | true |
f7563a61e072ed5f2619616195aa25d72a54a708 | 2,005 | py | Python | server/ExtensionPostHandler.py | fergalmoran/Chrome2Kindle | a85b823d23849711c0015e80e741d8458527d306 | [
"MIT"
] | 2 | 2016-03-10T08:48:51.000Z | 2018-06-27T00:15:48.000Z | server/ExtensionPostHandler.py | fergalmoran/Chrome2Kindle | a85b823d23849711c0015e80e741d8458527d306 | [
"MIT"
] | null | null | null | server/ExtensionPostHandler.py | fergalmoran/Chrome2Kindle | a85b823d23849711c0015e80e741d8458527d306 | [
"MIT"
] | null | null | null | from google.appengine.ext import webapp
from django.utils import simplejson
import logging, pdb, traceback
from PdfMaker import PdfMaker
from MailInterface import MailInterface
from HtmlParser import HtmlParser
from django.utils import simplejson
from model.Hits import SiteStats
class ExtensionPostHandler(webapp.Reque... | 39.313725 | 102 | 0.591521 | from google.appengine.ext import webapp
from django.utils import simplejson
import logging, pdb, traceback
from PdfMaker import PdfMaker
from MailInterface import MailInterface
from HtmlParser import HtmlParser
from django.utils import simplejson
from model.Hits import SiteStats
class ExtensionPostHandler(webapp.Reque... | false | true |
f7563a77cfe8f8ed57a93edf963a164235370e0c | 2,818 | py | Python | Bio/PopGen/SimCoal/Cache.py | zachcp/biopython | b31bbfee64da8b0fa9c63f29a26bc99b72c003de | [
"PostgreSQL"
] | 5 | 2016-03-09T03:41:23.000Z | 2022-01-24T12:34:44.000Z | Bio/PopGen/SimCoal/Cache.py | phillord/biopython | c8dfe46f192d6ccfac94b156cef024776545638e | [
"PostgreSQL"
] | null | null | null | Bio/PopGen/SimCoal/Cache.py | phillord/biopython | c8dfe46f192d6ccfac94b156cef024776545638e | [
"PostgreSQL"
] | 6 | 2016-10-24T11:27:13.000Z | 2020-02-26T16:35:01.000Z | # Copyright 2007 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved.
"""
This module allows to cache Simcoal2 results, and return on the fly
in case the calculation was done.
"""
import os
import tarfile
from .Controller import SimCoalController
class SimCoalCache(object):
def __init__(self, data_dir,... | 32.022727 | 77 | 0.587296 |
import os
import tarfile
from .Controller import SimCoalController
class SimCoalCache(object):
def __init__(self, data_dir, simcoal_dir):
self.dataDir = data_dir
self.cacheDir = os.sep.join([data_dir, 'SimCoal', 'cache'])
self.simcoalDir = simcoal_dir
def run_simcoal(self, par_file,... | true | true |
f7563a7b2c825604ac5e3c7398303973bb140d68 | 15,599 | py | Python | examples/mount_virtual_media.py | huiyudwmd/python-redfish-lenovo | 035f9606f2df6c939b0bae0002e3a4a3dff8895d | [
"Apache-2.0"
] | null | null | null | examples/mount_virtual_media.py | huiyudwmd/python-redfish-lenovo | 035f9606f2df6c939b0bae0002e3a4a3dff8895d | [
"Apache-2.0"
] | null | null | null | examples/mount_virtual_media.py | huiyudwmd/python-redfish-lenovo | 035f9606f2df6c939b0bae0002e3a4a3dff8895d | [
"Apache-2.0"
] | null | null | null | ###
#
# Lenovo Redfish examples - Insert vitual media
#
# Copyright Notice:
#
# Copyright 2019 Lenovo Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.or... | 51.82392 | 216 | 0.594269 |
import sys
import redfish
import json
import traceback
import lenovo_utils as utils
def mount_virtual_media(ip, login_account, login_password, fsprotocol, fsip, fsport, fsusername, fspassword, image, fsdir, inserted=True, writeprotocol=True):
result = {}
login_host = "https://" + ip
try:
... | true | true |
f7563b19f21846cdbf55ce9ef7a1cbca61f76cd5 | 3,998 | py | Python | runs/cylinder2dRe40/scripts/plot_pressure_coefficients.py | mesnardo/petibm-decoupledibpm | 675615a882cc8418b15a34e1100ccfb421f1d9d1 | [
"BSD-3-Clause"
] | null | null | null | runs/cylinder2dRe40/scripts/plot_pressure_coefficients.py | mesnardo/petibm-decoupledibpm | 675615a882cc8418b15a34e1100ccfb421f1d9d1 | [
"BSD-3-Clause"
] | null | null | null | runs/cylinder2dRe40/scripts/plot_pressure_coefficients.py | mesnardo/petibm-decoupledibpm | 675615a882cc8418b15a34e1100ccfb421f1d9d1 | [
"BSD-3-Clause"
] | null | null | null | """Plot the surface pressure coefficient at final time step."""
from matplotlib import pyplot
import numpy
import pathlib
import petibmpy
import rodney
def get_pressure(simudir, timestep):
name = 'p' # name of the field variable to load
datadir = simudir / 'output'
# Load the gridlines from file.
... | 33.596639 | 73 | 0.663582 |
from matplotlib import pyplot
import numpy
import pathlib
import petibmpy
import rodney
def get_pressure(simudir, timestep):
name = 'p' datadir = simudir / 'output'
filepath = datadir / 'grid.h5'
x, y = petibmpy.read_grid_hdf5(filepath, name)
filepath = datadir / f'{timestep:0>7}.h5'
... | true | true |
f7563b1bedd1179310a8d648d13c9c8388a9a5bf | 583 | py | Python | parcellearning/fn/ops.py | kristianeschenburg/parcellearning | 93811f7d11c1c5583d8f541c7629dbbaa1785304 | [
"BSD-3-Clause"
] | 6 | 2017-07-03T23:11:29.000Z | 2022-01-04T16:41:57.000Z | parcellearning/fn/ops.py | kristianeschenburg/parcellearning | 93811f7d11c1c5583d8f541c7629dbbaa1785304 | [
"BSD-3-Clause"
] | null | null | null | parcellearning/fn/ops.py | kristianeschenburg/parcellearning | 93811f7d11c1c5583d8f541c7629dbbaa1785304 | [
"BSD-3-Clause"
] | 1 | 2018-04-24T18:01:19.000Z | 2018-04-24T18:01:19.000Z | import torch
import dgl
def cosine(nodes):
"""
Compute the cosine distance between all pairs of nodes adjacent on a source node.
"""
# ```m``` is a matrix of N nodes x E edges x F features
# representing the messages incident on source nodes with E edges
m = nodes.mailbox['m']
N = m.shap... | 21.592593 | 85 | 0.571184 | import torch
import dgl
def cosine(nodes):
m = nodes.mailbox['m']
N = m.shape[1]
N = (N*(N-1))/2
if m.ndim > 3:
m = m.transpose(1,2)
e = torch.matmul(m, m.transpose(2, 3))
else:
e = torch.matmul(m, m.transpose(1,2))
e = torch.triu(e, diagonal=1).sum(-1).sum(... | true | true |
f7563b41f209bd1cdbc4f6fe13071e9969093e89 | 5,340 | py | Python | UnoCPI/settings.py | Goutham2591/mav-cpi | 3f7985d2a7bf57c08a1ff65bc14a8e60c3d0464b | [
"MIT"
] | null | null | null | UnoCPI/settings.py | Goutham2591/mav-cpi | 3f7985d2a7bf57c08a1ff65bc14a8e60c3d0464b | [
"MIT"
] | 7 | 2020-02-11T23:38:26.000Z | 2022-01-13T01:02:45.000Z | UnoCPI/settings.py | Goutham2591/mav-cpi | 3f7985d2a7bf57c08a1ff65bc14a8e60c3d0464b | [
"MIT"
] | null | null | null | """
Django settings for UnoCPI project.
Generated by 'django-admin startproject' using Django 2.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
from dj... | 26.176471 | 91 | 0.703371 |
import os
from django.contrib.messages import constants as messages
import dj_database_url
from django.urls import reverse_lazy
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = ')z8d*5_%@v!h@bl3-vl2gn@mwcd@6vlz061+b=o02jc5@2r1gg'
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PRO... | true | true |
f7563b8073a6ef1c297d38e03733e179c29d689f | 199,887 | py | Python | CloudStack/Client.py | lcosmin/cloudstack-python-client | 7bafbb4bb4a78834e712ce61437988eeac9b16b0 | [
"MIT"
] | 21 | 2015-01-15T10:37:45.000Z | 2019-06-03T09:34:36.000Z | CloudStack/Client.py | lcosmin/cloudstack-python-client | 7bafbb4bb4a78834e712ce61437988eeac9b16b0 | [
"MIT"
] | 1 | 2015-04-22T23:48:19.000Z | 2015-04-22T23:48:19.000Z | CloudStack/Client.py | lcosmin/cloudstack-python-client | 7bafbb4bb4a78834e712ce61437988eeac9b16b0 | [
"MIT"
] | 23 | 2015-01-27T05:34:57.000Z | 2020-07-27T00:42:20.000Z | from BaseClient import BaseClient
class Client(BaseClient):
def createNetworkOffering(self, args={}):
'''
Creates a network offering.
args - A dictionary. The following are options for keys:
displaytext - the display text of the network offering
guestiptype - guest ... | 38.722782 | 95 | 0.609124 | from BaseClient import BaseClient
class Client(BaseClient):
def createNetworkOffering(self, args={}):
if not 'displaytext' in args:
raise RuntimeError("Missing required argument 'displaytext'")
if not 'guestiptype' in args:
raise RuntimeError("Missing required argument 'gues... | true | true |
f7563c6ba352172c4260a046582f2e17a1cdfcc2 | 3,479 | py | Python | sdks/python/http_client/v1/polyaxon_sdk/models/v1_pipeline_kind.py | jjasonkal/polyaxon | 8454b29b2b971b965de8a7bf63afdd48f07d6d53 | [
"Apache-2.0"
] | null | null | null | sdks/python/http_client/v1/polyaxon_sdk/models/v1_pipeline_kind.py | jjasonkal/polyaxon | 8454b29b2b971b965de8a7bf63afdd48f07d6d53 | [
"Apache-2.0"
] | null | null | null | sdks/python/http_client/v1/polyaxon_sdk/models/v1_pipeline_kind.py | jjasonkal/polyaxon | 8454b29b2b971b965de8a7bf63afdd48f07d6d53 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 29.483051 | 85 | 0.598735 |
import pprint
import re
import six
from polyaxon_sdk.configuration import Configuration
class V1PipelineKind(object):
DAG = "dag"
PARALLEL = "parallel"
allowable_values = [DAG, PARALLEL]
openapi_types = {}
attribute_map = {}
def __init__(self, local_vars_configuration=None): ... | true | true |
f7563e3777786f2ea5a6388ca5e04d2e7f5e7f19 | 8,393 | py | Python | f115api.py | xxf1995/j_mag | ae2936b9e1a9bad56d138925e5ed673723e9f3db | [
"MIT"
] | null | null | null | f115api.py | xxf1995/j_mag | ae2936b9e1a9bad56d138925e5ed673723e9f3db | [
"MIT"
] | null | null | null | f115api.py | xxf1995/j_mag | ae2936b9e1a9bad56d138925e5ed673723e9f3db | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
import requests,ssl,json,time,os
import threading
import sys
import re
import os.path
import os
from pyquery import PyQuery as pq
QRImagePath = os.path.join(os.getcwd(), 'qrcode.jpg')
def getInfos():
global uid,uidTime,sign,session_id
url = 'http://passport.115.com'
p... | 27.69967 | 145 | 0.538425 | import requests,ssl,json,time,os
import threading
import sys
import re
import os.path
import os
from pyquery import PyQuery as pq
QRImagePath = os.path.join(os.getcwd(), 'qrcode.jpg')
def getInfos():
global uid,uidTime,sign,session_id
url = 'http://passport.115.com'
params = {
'ct': 'login',
... | false | true |
f7563e6d4a79f334bb77d62bbe3f62f76d1bd750 | 11,199 | py | Python | src/python/autotransform/scripts/commands/settings.py | nathro/AutoTransform | 04ef5458bc8401121e33370ceda6ef638e535e9a | [
"MIT"
] | 11 | 2022-01-02T00:50:24.000Z | 2022-02-22T00:30:09.000Z | src/python/autotransform/scripts/commands/settings.py | nathro/AutoTransform | 04ef5458bc8401121e33370ceda6ef638e535e9a | [
"MIT"
] | 6 | 2022-01-06T01:45:34.000Z | 2022-02-03T21:49:52.000Z | src/python/autotransform/scripts/commands/settings.py | nathro/AutoTransform | 04ef5458bc8401121e33370ceda6ef638e535e9a | [
"MIT"
] | null | null | null | # AutoTransform
# Large scale, component based code modification library
#
# Licensed under the MIT License <http://opensource.org/licenses/MIT>
# SPDX-License-Identifier: MIT
# Copyright (c) 2022-present Nathan Rockenbach <http://github.com/nathro>
# @black_format
"""The settings command is used to update AutoTransf... | 35.216981 | 100 | 0.657648 |
import json
import os
from argparse import ArgumentParser, Namespace
from typing import Dict, List
from autotransform.config.config import Config
from autotransform.config.default import DefaultConfigFetcher
from autotransform.schema.schema import AutoTransformSchema
from autotransform.util.component import Compone... | true | true |
f7563e6eee86d73dd1073658c63b913763d4c15f | 795 | py | Python | tests/test_data_utils/test_du_deep_image.py | jin530/pytorch-widedeep | 4ff1008ba6c62e64383267c924cfd3cf3cbc609c | [
"MIT"
] | null | null | null | tests/test_data_utils/test_du_deep_image.py | jin530/pytorch-widedeep | 4ff1008ba6c62e64383267c924cfd3cf3cbc609c | [
"MIT"
] | null | null | null | tests/test_data_utils/test_du_deep_image.py | jin530/pytorch-widedeep | 4ff1008ba6c62e64383267c924cfd3cf3cbc609c | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import os
from pytorch_widedeep.preprocessing import ImagePreprocessor
full_path = os.path.realpath(__file__)
path = os.path.split(full_path)[0]
df = pd.DataFrame({"galaxies": ["galaxy1.png", "galaxy2.png"]})
img_col = "galaxies"
imd_dir = os.path.join(path, "images")
processor... | 33.125 | 81 | 0.596226 | import numpy as np
import pandas as pd
import os
from pytorch_widedeep.preprocessing import ImagePreprocessor
full_path = os.path.realpath(__file__)
path = os.path.split(full_path)[0]
df = pd.DataFrame({"galaxies": ["galaxy1.png", "galaxy2.png"]})
img_col = "galaxies"
imd_dir = os.path.join(path, "images")
processor... | true | true |
f7563f2cbd5e6e7de7db2416da9236a4e05bc67a | 119 | py | Python | whereami_server/context_processors.py | martilidad/whereami_server | 35455632cae43dbce2a8be148c57c66946b0f413 | [
"MIT"
] | 1 | 2020-05-13T11:46:29.000Z | 2020-05-13T11:46:29.000Z | whereami_server/context_processors.py | martilidad/whereami_server | 35455632cae43dbce2a8be148c57c66946b0f413 | [
"MIT"
] | 40 | 2020-05-11T20:01:59.000Z | 2022-03-19T21:58:32.000Z | whereami_server/context_processors.py | martilidad/whereami_server | 35455632cae43dbce2a8be148c57c66946b0f413 | [
"MIT"
] | null | null | null | from whereami_server.version import GIT_SHA
def version(request):
return {
'version': GIT_SHA
} | 17 | 44 | 0.638655 | from whereami_server.version import GIT_SHA
def version(request):
return {
'version': GIT_SHA
} | true | true |
f7563f34ae7c1ec57ed0d60160f2041ec5509d0e | 7,527 | py | Python | src/oci/object_storage/models/work_request_resource.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/object_storage/models/work_request_resource.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/object_storage/models/work_request_resource.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 32.584416 | 245 | 0.650857 |
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class WorkRequestResource(object):
ACTION_TYPE_CREATED = "CREATED"
ACTION_TYPE_UPDATED = "UPDATED"
... | true | true |
f7563fa2a695f9616f7b0a106d3c2617a7ab5cc3 | 1,020 | py | Python | mesos_slave/tests/conftest.py | jstoja/integrations-core | 704fa31f7db642c6df9e0969b3b2778fc6144fa7 | [
"BSD-3-Clause"
] | null | null | null | mesos_slave/tests/conftest.py | jstoja/integrations-core | 704fa31f7db642c6df9e0969b3b2778fc6144fa7 | [
"BSD-3-Clause"
] | null | null | null | mesos_slave/tests/conftest.py | jstoja/integrations-core | 704fa31f7db642c6df9e0969b3b2778fc6144fa7 | [
"BSD-3-Clause"
] | 1 | 2019-12-23T13:35:17.000Z | 2019-12-23T13:35:17.000Z | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import os
import pytest
from datadog_checks.dev import docker_run
from datadog_checks.mesos_slave import MesosSlave
from . import common
from .utils import read_fixture
@pytest.fixture(scope='sess... | 22.173913 | 98 | 0.746078 | import json
import os
import pytest
from datadog_checks.dev import docker_run
from datadog_checks.mesos_slave import MesosSlave
from . import common
from .utils import read_fixture
@pytest.fixture(scope='session')
def dd_environment():
compose_file = os.path.join(common.HERE, 'compose', 'docker-compose.yml')
... | true | true |
f756404ab4ffae855c0dc8ddf914377a00deab3b | 2,504 | py | Python | ivy/functional/ivy/activations.py | AbdulRafay98/ivy | 308a5397e5be81534bf31eb2a1ed8ba3a3bc8b87 | [
"Apache-2.0"
] | null | null | null | ivy/functional/ivy/activations.py | AbdulRafay98/ivy | 308a5397e5be81534bf31eb2a1ed8ba3a3bc8b87 | [
"Apache-2.0"
] | null | null | null | ivy/functional/ivy/activations.py | AbdulRafay98/ivy | 308a5397e5be81534bf31eb2a1ed8ba3a3bc8b87 | [
"Apache-2.0"
] | null | null | null | """
Collection of Ivy activation functions.
"""
# global
from typing import Union
# local
import ivy
from ivy.framework_handler import current_framework as _cur_framework
# Extra #
# ------#
def relu(x: Union[ivy.Array, ivy.NativeArray])\
-> ivy.Array:
"""
Applies the rectified linear unit function... | 22.558559 | 115 | 0.645767 |
from typing import Union
import ivy
from ivy.framework_handler import current_framework as _cur_framework
def relu(x: Union[ivy.Array, ivy.NativeArray])\
-> ivy.Array:
return _cur_framework(x).relu(x)
def leaky_relu(x, alpha=0.2):
return _cur_framework(x).leaky_relu(x, alpha)
def gelu(x, approx... | true | true |
f756416b92cd16553488842fdf9f9993591ff223 | 5,295 | py | Python | src/starlingpy/StarlingClass.py | ethansimpson285/StarlingPy | 0afba0444b695c431227f4e28d6d3edde5b56af7 | [
"MIT"
] | null | null | null | src/starlingpy/StarlingClass.py | ethansimpson285/StarlingPy | 0afba0444b695c431227f4e28d6d3edde5b56af7 | [
"MIT"
] | null | null | null | src/starlingpy/StarlingClass.py | ethansimpson285/StarlingPy | 0afba0444b695c431227f4e28d6d3edde5b56af7 | [
"MIT"
] | null | null | null | from requests import get
import datetime
import pandas as pd
from starlingpy.StarlingAPIs import Account_APIs
BASE_PATH = "https://api.starlingbank.com/api/v2/"
class TransactionHistory:
"""
A history of transactions associated with the Starling account, between stipulated datetimes.
Requires the Sta... | 31.331361 | 161 | 0.654391 | from requests import get
import datetime
import pandas as pd
from starlingpy.StarlingAPIs import Account_APIs
BASE_PATH = "https://api.starlingbank.com/api/v2/"
class TransactionHistory:
def __init__(self,Account,**kwargs):
self.associated_Account = Account
output = Account.get_transact... | true | true |
f75642e4fe88122886e02dd215674ddd5b43d135 | 1,604 | py | Python | handlers/login.py | cstieg/Multi-User-Blog | bbc791910aed4fb3845f50c4fb267d7733290421 | [
"MIT"
] | null | null | null | handlers/login.py | cstieg/Multi-User-Blog | bbc791910aed4fb3845f50c4fb267d7733290421 | [
"MIT"
] | null | null | null | handlers/login.py | cstieg/Multi-User-Blog | bbc791910aed4fb3845f50c4fb267d7733290421 | [
"MIT"
] | null | null | null | import models, handlers
class Login(handlers.Handler):
"""Allows registered user to login"""
def get(self):
"""Renders login page"""
caller = handlers.sanitize(self.request.get('caller'))
self.render('login.html', caller=caller)
def post(self):
"""Accepts login info from lo... | 36.454545 | 89 | 0.662095 | import models, handlers
class Login(handlers.Handler):
def get(self):
caller = handlers.sanitize(self.request.get('caller'))
self.render('login.html', caller=caller)
def post(self):
caller = handlers.sanitize(self.request.get('caller'))
username = handlers.sanitize(self.request... | true | true |
f7564333907e8fb62bad663af8e21c83b5adda21 | 4,094 | py | Python | basset/basset_ios.py | team-supercharge/basset-ios | 8336eb2df0d03fe184c7fd14843c8facd471607d | [
"MIT"
] | null | null | null | basset/basset_ios.py | team-supercharge/basset-ios | 8336eb2df0d03fe184c7fd14843c8facd471607d | [
"MIT"
] | null | null | null | basset/basset_ios.py | team-supercharge/basset-ios | 8336eb2df0d03fe184c7fd14843c8facd471607d | [
"MIT"
] | null | null | null | import argparse
import logging
import sys
import time
import coloredlogs
from basset.helpers.configuration_manager import ConfigurationManager
from basset.helpers.converter import Converter
from basset.helpers.extractor import Extractor
from basset.helpers.merger import Merger
from basset.exceptions import *
class ... | 45.488889 | 129 | 0.643136 | import argparse
import logging
import sys
import time
import coloredlogs
from basset.helpers.configuration_manager import ConfigurationManager
from basset.helpers.converter import Converter
from basset.helpers.extractor import Extractor
from basset.helpers.merger import Merger
from basset.exceptions import *
class ... | true | true |
f7564399d394de5b1d15df22eca8eeb5a5c533b1 | 925 | py | Python | gpscraper/headers.py | alverelt/gpscraper | 9c0322d1b8f0c70786bd15512746650b6c4d9ded | [
"MIT"
] | 1 | 2021-06-09T05:15:49.000Z | 2021-06-09T05:15:49.000Z | gpscraper/headers.py | alverelt/gpscraper | 9c0322d1b8f0c70786bd15512746650b6c4d9ded | [
"MIT"
] | 1 | 2021-07-30T21:30:31.000Z | 2021-08-10T21:15:53.000Z | gpscraper/headers.py | alverelt/gpscraper | 9c0322d1b8f0c70786bd15512746650b6c4d9ded | [
"MIT"
] | null | null | null | GET = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3',
'Connection': 'keep-alive',
'Host': 'play.google.com',
'Upgrade-Insecure-Requests': '1',
'User-Age... | 38.541667 | 97 | 0.597838 | GET = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3',
'Connection': 'keep-alive',
'Host': 'play.google.com',
'Upgrade-Insecure-Requests': '1',
'User-Age... | true | true |
f75644498867f1aa945af30741f5576d625d5285 | 1,464 | py | Python | machine-learning-algorithms/reducao-rbm.py | RichardOkubo/DS-Scripts | adf3845802b52e8901d381ffff60f9c1276dabe1 | [
"MIT"
] | null | null | null | machine-learning-algorithms/reducao-rbm.py | RichardOkubo/DS-Scripts | adf3845802b52e8901d381ffff60f9c1276dabe1 | [
"MIT"
] | null | null | null | machine-learning-algorithms/reducao-rbm.py | RichardOkubo/DS-Scripts | adf3845802b52e8901d381ffff60f9c1276dabe1 | [
"MIT"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets, metrics
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.neural_network import BernoulliRBM
from sklearn.naive_bayes import GaussianNB
from sklearn.pipeline import Pipeline
b... | 36.6 | 146 | 0.804645 | import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets, metrics
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.neural_network import BernoulliRBM
from sklearn.naive_bayes import GaussianNB
from sklearn.pipeline import Pipeline
b... | true | true |
f75644643ee75a0d1d5c4ec9247bb491e659dac0 | 4,565 | py | Python | rllib/examples/remote_vector_env_with_custom_api.py | 77loopin/ray | 9322f6aab53f4ca5baf5a3573e1ffde12feae519 | [
"Apache-2.0"
] | 1 | 2022-01-10T07:41:17.000Z | 2022-01-10T07:41:17.000Z | rllib/examples/remote_vector_env_with_custom_api.py | 77loopin/ray | 9322f6aab53f4ca5baf5a3573e1ffde12feae519 | [
"Apache-2.0"
] | 61 | 2021-01-30T08:05:55.000Z | 2022-03-26T07:06:15.000Z | rllib/examples/remote_vector_env_with_custom_api.py | 77loopin/ray | 9322f6aab53f4ca5baf5a3573e1ffde12feae519 | [
"Apache-2.0"
] | 1 | 2021-05-19T03:08:37.000Z | 2021-05-19T03:08:37.000Z | """
This script demonstrates how one can specify custom env APIs in
combination with RLlib's `remote_worker_envs` setting, which
parallelizes individual sub-envs within a vector env by making each
one a ray Actor.
You can access your Env's API via a custom callback as shown below.
"""
import argparse
import gym
import... | 32.607143 | 77 | 0.667689 | import argparse
import gym
import os
import ray
from ray.rllib.agents.callbacks import DefaultCallbacks
from ray.rllib.env.apis.task_settable_env import TaskSettableEnv
from ray.rllib.utils.test_utils import check_learning_achieved
from ray import tune
parser = argparse.ArgumentParser()
parser.add_argument(
"--ru... | true | true |
f756448235c5fd3bf4bbe999eb650e4235627436 | 1,495 | py | Python | DevNetworkPython/main.py | ManikHossain08/Metrics-Extraction-from-GitHub-MSR_Python | b846c8ea6d37246af1c202466b60c15d06c5ba8b | [
"MIT"
] | 1 | 2020-06-13T22:30:17.000Z | 2020-06-13T22:30:17.000Z | DevNetworkPython/main.py | ManikHossain08/Metrics-Extraction-from-GitHub-MSR | b846c8ea6d37246af1c202466b60c15d06c5ba8b | [
"MIT"
] | null | null | null | DevNetworkPython/main.py | ManikHossain08/Metrics-Extraction-from-GitHub-MSR | b846c8ea6d37246af1c202466b60c15d06c5ba8b | [
"MIT"
] | null | null | null | import os
import shutil
import git
import yaml
from configuration import Configuration
from repoLoader import getRepo
from aliasWorker import replaceAliases
from commitAnalysis import commitAnalysis
from centralityAnalysis import centralityAnalysis
from tagAnalysis import tagAnalysis
def main():
tr... | 28.207547 | 70 | 0.640134 | import os
import shutil
import git
import yaml
from configuration import Configuration
from repoLoader import getRepo
from aliasWorker import replaceAliases
from commitAnalysis import commitAnalysis
from centralityAnalysis import centralityAnalysis
from tagAnalysis import tagAnalysis
def main():
tr... | true | true |
f75644838540a24c9f13202569c7db8aa1446291 | 72 | py | Python | BinaryTimeseries/__init__.py | jonathanschilling/BinaryTimeseries | e8d6009f36699e22e61100f86a059b49c3a659e6 | [
"Apache-2.0"
] | 1 | 2020-03-20T23:35:50.000Z | 2020-03-20T23:35:50.000Z | BinaryTimeseries/__init__.py | jonathanschilling/BinaryTimeseries | e8d6009f36699e22e61100f86a059b49c3a659e6 | [
"Apache-2.0"
] | 1 | 2021-03-29T14:33:07.000Z | 2021-03-29T14:33:07.000Z | BinaryTimeseries/__init__.py | jonathanschilling/BinaryTimeseries | e8d6009f36699e22e61100f86a059b49c3a659e6 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from .BinaryTimeseries import BinaryTimeseries
| 18 | 46 | 0.722222 |
from .BinaryTimeseries import BinaryTimeseries
| true | true |
f756448c30a48730332ed87853a205b18803d406 | 2,107 | py | Python | field.py | mrzl/Composition37XY | 92214b080666930c5643972cdbe9ddd856a64650 | [
"MIT"
] | 67 | 2015-12-27T09:22:39.000Z | 2022-01-23T14:26:11.000Z | field.py | mrzl/Composition37XY | 92214b080666930c5643972cdbe9ddd856a64650 | [
"MIT"
] | 4 | 2016-02-06T17:46:51.000Z | 2018-02-26T00:31:34.000Z | field.py | mrzl/Composition37XY | 92214b080666930c5643972cdbe9ddd856a64650 | [
"MIT"
] | 14 | 2015-12-25T12:52:08.000Z | 2020-03-16T20:52:44.000Z | from math import hypot, atan2, sin, cos, pi
import random
import time
import xy
class Model(object):
def __init__(self):
self.particles = []
def add(self, x, y, m=1.0):
self.particles.append((x, y, m))
def test(self, x, y):
dx = 0
dy = 0
for px, py, pm in self.partic... | 27.012821 | 64 | 0.478405 | from math import hypot, atan2, sin, cos, pi
import random
import time
import xy
class Model(object):
def __init__(self):
self.particles = []
def add(self, x, y, m=1.0):
self.particles.append((x, y, m))
def test(self, x, y):
dx = 0
dy = 0
for px, py, pm in self.partic... | false | true |
f75644b0294403ffc439f429a9b0b99e67870f84 | 767 | py | Python | mysite/polls/models.py | hxcshr/learnDjango | ac828fad46238effdb2a114c9428ffde815ed657 | [
"MIT"
] | 1 | 2017-02-24T05:09:09.000Z | 2017-02-24T05:09:09.000Z | mysite/polls/models.py | hxcshr/learnDjango | ac828fad46238effdb2a114c9428ffde815ed657 | [
"MIT"
] | null | null | null | mysite/polls/models.py | hxcshr/learnDjango | ac828fad46238effdb2a114c9428ffde815ed657 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils import timezone
import datetime
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.Da... | 29.5 | 75 | 0.758801 | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils import timezone
import datetime
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published... | true | true |
f75644bbf70df6487cbf21e5949060da9fdd1dde | 2,113 | py | Python | sympy/assumptions/tests/test_refine.py | smichr/sympy | eda86926d98ab6cb7ec73e3cb8ea78ac15bddea3 | [
"BSD-3-Clause"
] | 7 | 2015-01-14T06:55:33.000Z | 2018-08-11T14:43:52.000Z | sympy/assumptions/tests/test_refine.py | smichr/sympy | eda86926d98ab6cb7ec73e3cb8ea78ac15bddea3 | [
"BSD-3-Clause"
] | 1 | 2018-02-19T04:56:04.000Z | 2018-02-19T04:56:04.000Z | sympy/assumptions/tests/test_refine.py | smichr/sympy | eda86926d98ab6cb7ec73e3cb8ea78ac15bddea3 | [
"BSD-3-Clause"
] | 1 | 2016-04-24T14:39:22.000Z | 2016-04-24T14:39:22.000Z | from sympy import Abs, exp, Expr, I, pi, Q, Rational, refine, S, sqrt
from sympy.abc import x, y, z
def test_Abs():
assert refine(Abs(x), Q.positive(x)) == x
assert refine(1 + Abs(x), Q.positive(x)) == 1 + x
assert refine(Abs(x), Q.negative(x)) == -x
assert refine(1 + Abs(x), Q.negative(x)) == 1 - x
... | 32.015152 | 71 | 0.52248 | from sympy import Abs, exp, Expr, I, pi, Q, Rational, refine, S, sqrt
from sympy.abc import x, y, z
def test_Abs():
assert refine(Abs(x), Q.positive(x)) == x
assert refine(1 + Abs(x), Q.positive(x)) == 1 + x
assert refine(Abs(x), Q.negative(x)) == -x
assert refine(1 + Abs(x), Q.negative(x)) == 1 - x
... | true | true |
f75644f42e5e7b8ebfc686886ca128375bf22e0a | 1,383 | py | Python | test/jax/test_vjp_batched.py | mmezic/netket | a9da8f2703d26056eb04e541d37911ec2315830f | [
"Apache-2.0"
] | null | null | null | test/jax/test_vjp_batched.py | mmezic/netket | a9da8f2703d26056eb04e541d37911ec2315830f | [
"Apache-2.0"
] | 26 | 2021-08-06T15:27:57.000Z | 2022-03-30T16:55:18.000Z | test/jax/test_vjp_batched.py | VolodyaCO/netket | 629e885212d981d7748d155310abca4a1f9d5481 | [
"Apache-2.0"
] | null | null | null | import pytest
import jax
import netket as nk
import numpy as np
from functools import partial
@pytest.mark.parametrize("jit", [False, True])
@pytest.mark.parametrize("batch_size", [None, 16, 10000, 1000000])
@pytest.mark.parametrize("return_forward", [False, True])
@pytest.mark.parametrize("batch_argnums", [1, (1,)]... | 28.8125 | 86 | 0.658713 | import pytest
import jax
import netket as nk
import numpy as np
from functools import partial
@pytest.mark.parametrize("jit", [False, True])
@pytest.mark.parametrize("batch_size", [None, 16, 10000, 1000000])
@pytest.mark.parametrize("return_forward", [False, True])
@pytest.mark.parametrize("batch_argnums", [1, (1,)]... | true | true |
f75645616023a9d8aefc844ea75c42ba4234b137 | 23,650 | py | Python | tests/related_resource/tests.py | numan/django-tastypie | 834f728b07ab1a008b281b12a2cab2987f26c99d | [
"BSD-3-Clause"
] | 1 | 2015-05-20T16:20:43.000Z | 2015-05-20T16:20:43.000Z | tests/related_resource/tests.py | numan/django-tastypie | 834f728b07ab1a008b281b12a2cab2987f26c99d | [
"BSD-3-Clause"
] | 3 | 2016-10-25T12:00:28.000Z | 2022-02-10T10:04:24.000Z | tests/related_resource/tests.py | numan/django-tastypie | 834f728b07ab1a008b281b12a2cab2987f26c99d | [
"BSD-3-Clause"
] | null | null | null | import django
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
import json
from django.core.urlresolvers import reverse
from core.models import Note, MediaBit
from core.tests.resources import HttpRequest
from core.tests.mocks import MockRequest
from tastypie ... | 37.127159 | 291 | 0.609049 | import django
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
import json
from django.core.urlresolvers import reverse
from core.models import Note, MediaBit
from core.tests.resources import HttpRequest
from core.tests.mocks import MockRequest
from tastypie ... | true | true |
f756459b62e6067809593d5111b123aa20819815 | 81 | py | Python | dash_frontend/constants.py | jihoonkang0829/Discrimination_Prediction | 5d6493f15b72c12ee1ca926be877a2b5ee6769d6 | [
"MIT"
] | null | null | null | dash_frontend/constants.py | jihoonkang0829/Discrimination_Prediction | 5d6493f15b72c12ee1ca926be877a2b5ee6769d6 | [
"MIT"
] | null | null | null | dash_frontend/constants.py | jihoonkang0829/Discrimination_Prediction | 5d6493f15b72c12ee1ca926be877a2b5ee6769d6 | [
"MIT"
] | 1 | 2021-06-02T13:53:49.000Z | 2021-06-02T13:53:49.000Z | # import pathlib
from pathlib import Path
ASSETS_PATH = Path(Path.cwd(), 'data') | 20.25 | 38 | 0.740741 | from pathlib import Path
ASSETS_PATH = Path(Path.cwd(), 'data') | true | true |
f75646666a5e3415f86722bedf1d16cb270fbd32 | 356 | py | Python | 3rdParty/IronPython-2.7.3/Lib/distutils/__init__.py | JoeyJiao/peach | 661cb39034583a8cf1b02b56e6b409f2c7498e07 | [
"MIT"
] | 14 | 2016-04-11T15:37:33.000Z | 2021-08-13T11:32:42.000Z | 3rdParty/IronPython-2.7.3/Lib/distutils/__init__.py | JoeyJiao/peach | 661cb39034583a8cf1b02b56e6b409f2c7498e07 | [
"MIT"
] | 2 | 2019-07-01T12:39:41.000Z | 2020-11-09T11:40:54.000Z | 3rdParty/IronPython-2.7.3/Lib/distutils/__init__.py | JoeyJiao/peach | 661cb39034583a8cf1b02b56e6b409f2c7498e07 | [
"MIT"
] | 11 | 2016-07-01T02:21:06.000Z | 2020-11-23T08:29:22.000Z | """distutils
The main package for the Python Module Distribution Utilities. Normally
used from a setup script as
from distutils.core import setup
setup (...)
"""
__revision__ = "$Id$"
# Distutils version
#
# Updated automatically by the Python release process.
#
#--start constants--
__versi... | 17.8 | 73 | 0.674157 |
__revision__ = "$Id$"
__version__ = "2.7.1"
| true | true |
f756477178d52f54aa184ef8beef78bf25cdd435 | 1,306 | py | Python | coaffect/agents/emotional.py | aridyckovsky/coaffect | 12f33ee11a9fb51bbe100459d55c194417032c9b | [
"MIT"
] | null | null | null | coaffect/agents/emotional.py | aridyckovsky/coaffect | 12f33ee11a9fb51bbe100459d55c194417032c9b | [
"MIT"
] | null | null | null | coaffect/agents/emotional.py | aridyckovsky/coaffect | 12f33ee11a9fb51bbe100459d55c194417032c9b | [
"MIT"
] | null | null | null | """ Extend basic agent to an emotional agent.
"""
#: Dependencies
import numpy
import random
from .base import Agent
class EmotionalAgent(Agent):
""" Create emotional agent by extending and overriding base class Agent.
"""
def __init__(self, unique_id, experiment, memory=0):
""" Extended subcl... | 22.912281 | 77 | 0.580398 |
import numpy
import random
from .base import Agent
class EmotionalAgent(Agent):
def __init__(self, unique_id, experiment, memory=0):
super().__init__(unique_id, experiment)
if memory > 0:
self.memory = []
def perceive(self, situation):
try:
... | true | true |
f75647c354e6053fc185b95cbf907c8dacaec123 | 2,214 | py | Python | setup.py | c60evaporator/param_tuning_utility | 8518b76369dcc918172a87ab4c975ee3a12f7045 | [
"BSD-3-Clause"
] | null | null | null | setup.py | c60evaporator/param_tuning_utility | 8518b76369dcc918172a87ab4c975ee3a12f7045 | [
"BSD-3-Clause"
] | null | null | null | setup.py | c60evaporator/param_tuning_utility | 8518b76369dcc918172a87ab4c975ee3a12f7045 | [
"BSD-3-Clause"
] | null | null | null | # Author: Kenta Nakamura <c60evaporator@gmail.com>
# Copyright (c) 2020-2021 Kenta Nakamura
# License: BSD 3 clause
from setuptools import setup
import muscle_tuning
DESCRIPTION = "muscle-tuning: A hyperparameter tuning tool, easy to use even if your brain is made of muscle"
NAME = 'muscle-tuning'
AUTHOR = 'Kenta Nak... | 28.384615 | 109 | 0.664408 |
from setuptools import setup
import muscle_tuning
DESCRIPTION = "muscle-tuning: A hyperparameter tuning tool, easy to use even if your brain is made of muscle"
NAME = 'muscle-tuning'
AUTHOR = 'Kenta Nakamura'
AUTHOR_EMAIL = 'c60evaporator@gmail.com'
URL = 'https://github.com/c60evaporator/muscle-tuning'
LICENSE = 'BS... | true | true |
f75648c376e3cd9e886a2c4df92926b60a88871e | 1,042 | py | Python | estimagic/exceptions.py | vishalbelsare/estimagic | afae1be3a1566056d11962c495b67e64bc4a0822 | [
"BSD-3-Clause"
] | 83 | 2019-09-26T04:44:03.000Z | 2022-03-17T20:24:02.000Z | estimagic/exceptions.py | vishalbelsare/estimagic | afae1be3a1566056d11962c495b67e64bc4a0822 | [
"BSD-3-Clause"
] | 243 | 2019-06-25T18:15:53.000Z | 2022-03-26T09:17:44.000Z | estimagic/exceptions.py | vishalbelsare/estimagic | afae1be3a1566056d11962c495b67e64bc4a0822 | [
"BSD-3-Clause"
] | 23 | 2019-07-03T11:16:55.000Z | 2022-03-07T00:57:38.000Z | try:
from better_exceptions import format_exception
except ImportError:
from traceback import format_exception
import sys
class TableExistsError(Exception):
pass
class StopOptimizationError(Exception):
def __init__(self, message, current_status):
super().__init__(message)
self.messag... | 25.414634 | 88 | 0.712092 | try:
from better_exceptions import format_exception
except ImportError:
from traceback import format_exception
import sys
class TableExistsError(Exception):
pass
class StopOptimizationError(Exception):
def __init__(self, message, current_status):
super().__init__(message)
self.messag... | true | true |
f7564a482e188b766a9fb123cdadf4f4e74ee9cb | 297 | py | Python | neopo/script.py | justicefreed/neopo | 6b3049af1ab90834e6d6c695cd6047a336af0209 | [
"MIT"
] | 22 | 2020-05-26T17:30:20.000Z | 2022-01-31T00:03:09.000Z | neopo/script.py | justicefreed/neopo | 6b3049af1ab90834e6d6c695cd6047a336af0209 | [
"MIT"
] | 11 | 2020-05-26T23:11:52.000Z | 2022-03-09T21:08:25.000Z | neopo/script.py | justicefreed/neopo | 6b3049af1ab90834e6d6c695cd6047a336af0209 | [
"MIT"
] | 6 | 2020-05-26T22:54:11.000Z | 2021-09-16T21:37:34.000Z | # Frontend for neopo scripting interface
import sys
# Local imports
from .common import ProcessError
from .command import script_command
def main():
try:
script_command([None, *sys.argv])
except ProcessError as error:
print(error)
if __name__ == "__main__":
main()
| 17.470588 | 41 | 0.693603 |
import sys
from .common import ProcessError
from .command import script_command
def main():
try:
script_command([None, *sys.argv])
except ProcessError as error:
print(error)
if __name__ == "__main__":
main()
| true | true |
f7564a643de4bec2ea7e504fafa92d995a42a277 | 3,890 | py | Python | AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/NewGraph_CreatedSuccessfully.py | whywhywhyw/o3de | 8e09f66799d4c8f188d45861d821e8656a554cb1 | [
"Apache-2.0",
"MIT"
] | 1 | 2022-03-28T08:06:58.000Z | 2022-03-28T08:06:58.000Z | AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/NewGraph_CreatedSuccessfully.py | whywhywhyw/o3de | 8e09f66799d4c8f188d45861d821e8656a554cb1 | [
"Apache-2.0",
"MIT"
] | null | null | null | AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/NewGraph_CreatedSuccessfully.py | whywhywhyw/o3de | 8e09f66799d4c8f188d45861d821e8656a554cb1 | [
"Apache-2.0",
"MIT"
] | null | null | null | """
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
class Tests:
lc_tool_opened = (
"Landscape Canvas tool opened",
"Failed to open Landscape ... | 35.363636 | 113 | 0.731105 |
class Tests:
lc_tool_opened = (
"Landscape Canvas tool opened",
"Failed to open Landscape Canvas tool"
)
new_graph_created = (
"Successfully created new graph",
"Failed to create new graph"
)
graph_registered = (
"Graph registered with Landscape Canvas",
... | true | true |
f7564ad341dfa06b8cc417ee1d597ec715cabf15 | 1,719 | py | Python | tnn/calib/config.py | Savahi/tnn | 21cd0c0e1827b159ccfb8668495b25f3c9486c75 | [
"MIT"
] | null | null | null | tnn/calib/config.py | Savahi/tnn | 21cd0c0e1827b159ccfb8668495b25f3c9486c75 | [
"MIT"
] | null | null | null | tnn/calib/config.py | Savahi/tnn | 21cd0c0e1827b159ccfb8668495b25f3c9486c75 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from tnn.calcdata import CalcData
# количество бинов
CD = CalcData( 5 )
# длина истории
history_tail = 5
for i in range(history_tail):
# задаем индикаторы
CD.addLookBackOp( "rsi", i, 6 )
CD.addLookBackOp( "stochastic", i, 6 )
CD.addLookBackOp( "roc", i, 6 )
CD.addLookBackOp( "sma", i, 6... | 28.65 | 138 | 0.680047 | from tnn.calcdata import CalcData
CD = CalcData( 5 )
history_tail = 5
for i in range(history_tail):
CD.addLookBackOp( "rsi", i, 6 )
CD.addLookBackOp( "stochastic", i, 6 )
CD.addLookBackOp( "roc", i, 6 )
CD.addLookBackOp( "sma", i, 6 )
CD.addLookBackOp( "return", i, 6 )
CD.addLookBackOp( "vol", i, 6 )
CD.addL... | true | true |
f7564ae58a00ae117c887dd05fa282f8309afffc | 66,587 | py | Python | conda/resolve.py | sakibguy/conda | 892f9f6a196312765b515b0db53a5558566fe456 | [
"BSD-3-Clause"
] | null | null | null | conda/resolve.py | sakibguy/conda | 892f9f6a196312765b515b0db53a5558566fe456 | [
"BSD-3-Clause"
] | null | null | null | conda/resolve.py | sakibguy/conda | 892f9f6a196312765b515b0db53a5558566fe456 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import defaultdict, OrderedDict, deque
import copy
from logging import DEBUG, getLogger
from .auxlib.collection import ... | 45.420873 | 138 | 0.576764 | from __future__ import absolute_import, division, print_function, unicode_literals
from collections import defaultdict, OrderedDict, deque
import copy
from logging import DEBUG, getLogger
from .auxlib.collection import frozendict
from .auxlib.decorators import memoize, memoizemethod
from ._vendor.toolz import concat,... | true | true |
f7564b3de7689c5160bdf52de82702fcc3c7cf12 | 3,184 | py | Python | superset/commands/utils.py | 7vikpeculiar/superset | 800ced5e257d5d83d6dbe4ced0e7318ac40d026f | [
"Apache-2.0"
] | 2 | 2021-12-21T15:57:16.000Z | 2022-01-31T02:22:02.000Z | superset/commands/utils.py | 7vikpeculiar/superset | 800ced5e257d5d83d6dbe4ced0e7318ac40d026f | [
"Apache-2.0"
] | 10 | 2022-01-05T01:31:07.000Z | 2022-03-16T01:09:46.000Z | superset/commands/utils.py | 7vikpeculiar/superset | 800ced5e257d5d83d6dbe4ced0e7318ac40d026f | [
"Apache-2.0"
] | 2 | 2021-12-21T13:41:18.000Z | 2021-12-26T22:16:43.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.597701 | 85 | 0.73147 | from __future__ import annotations
from typing import List, Optional, TYPE_CHECKING
from flask_appbuilder.security.sqla.models import Role, User
from superset.commands.exceptions import (
DatasourceNotFoundValidationError,
OwnersNotFoundValidationError,
RolesNotFoundValidationError,
)
from superset.conne... | true | true |
f7564b48e1c0af3e5e5fddea32b1bef9e9f6cb4a | 15,213 | py | Python | bokeh/models/tests/test_annotations.py | aparamon/bokeh | cf6c97e35301adb15dd69eb24f4f8af5e75d64e1 | [
"BSD-3-Clause"
] | 1 | 2019-03-12T12:14:52.000Z | 2019-03-12T12:14:52.000Z | bokeh/models/tests/test_annotations.py | aparamon/bokeh | cf6c97e35301adb15dd69eb24f4f8af5e75d64e1 | [
"BSD-3-Clause"
] | null | null | null | bokeh/models/tests/test_annotations.py | aparamon/bokeh | cf6c97e35301adb15dd69eb24f4f8af5e75d64e1 | [
"BSD-3-Clause"
] | 3 | 2019-03-27T23:27:05.000Z | 2020-08-05T19:03:19.000Z | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | 31.302469 | 101 | 0.585486 |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
import mock
from datetime import datetime
from bokeh.core.properties import field, value
from bokeh.core.validation import check_integrity
from bokeh.models import (
ColumnDataSource, ArrowHead, BasicTic... | true | true |
f7564b4d8f9c1e83e2ad3ef42388503c07722101 | 265 | py | Python | symposion_project/apps/symposion/review/management/commands/calculate_results.py | mzdaniel/symposion | b2f557ca1be3bd61db2d902a31d57049fb6855c5 | [
"MIT"
] | 1 | 2015-06-30T14:11:31.000Z | 2015-06-30T14:11:31.000Z | symposion_project/apps/symposion/review/management/commands/calculate_results.py | mzdaniel/symposion | b2f557ca1be3bd61db2d902a31d57049fb6855c5 | [
"MIT"
] | null | null | null | symposion_project/apps/symposion/review/management/commands/calculate_results.py | mzdaniel/symposion | b2f557ca1be3bd61db2d902a31d57049fb6855c5 | [
"MIT"
] | null | null | null | from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group
from symposion.review.models import ProposalResult
class Command(BaseCommand):
def handle(self, *args, **options):
ProposalResult.full_calculate()
| 22.083333 | 51 | 0.766038 | from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group
from symposion.review.models import ProposalResult
class Command(BaseCommand):
def handle(self, *args, **options):
ProposalResult.full_calculate()
| true | true |
f7564bc65610669b82dad0557708df2776e29db0 | 697 | py | Python | QQBot/bot.py | Mashiro-Sorata/UESTC-ESE-night-check-bot | eff90677b7ad1f5972c0825acddf647668c004b8 | [
"MIT"
] | 1 | 2021-02-01T15:08:17.000Z | 2021-02-01T15:08:17.000Z | QQBot/bot.py | Mashiro-Sorata/UESTC-ESE-night-check-bot | eff90677b7ad1f5972c0825acddf647668c004b8 | [
"MIT"
] | null | null | null | QQBot/bot.py | Mashiro-Sorata/UESTC-ESE-night-check-bot | eff90677b7ad1f5972c0825acddf647668c004b8 | [
"MIT"
] | 1 | 2021-02-01T15:10:45.000Z | 2021-02-01T15:10:45.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import win32api
import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
nonebot.init()
app = nonebot.get_asgi()
driver = nonebot.get_driver()
driver.register_adapter("cqhttp", CQHTTPBot)
nonebot.load_builtin_plugins()
nonebot.load_plugins("qqbot/plugins")... | 22.483871 | 121 | 0.694405 |
import win32api
import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
nonebot.init()
app = nonebot.get_asgi()
driver = nonebot.get_driver()
driver.register_adapter("cqhttp", CQHTTPBot)
nonebot.load_builtin_plugins()
nonebot.load_plugins("qqbot/plugins")
async def send_hello(bot):
await bot.cal... | true | true |
f7564db5aa88f84b51645732cea43eb7b3a460c7 | 1,484 | bzl | Python | kotlin/rules/defs.bzl | buchgr/rules_kotlin | d99be44ed90e2ed6bcb488fd309ea7cb84406e66 | [
"Apache-2.0"
] | null | null | null | kotlin/rules/defs.bzl | buchgr/rules_kotlin | d99be44ed90e2ed6bcb488fd309ea7cb84406e66 | [
"Apache-2.0"
] | null | null | null | kotlin/rules/defs.bzl | buchgr/rules_kotlin | d99be44ed90e2ed6bcb488fd309ea7cb84406e66 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 39.052632 | 120 | 0.616577 |
REPO_ROOT = "io_bazel_rules_kotlin"
# The name of the Kotlin compiler workspace.
KOTLIN_REPO_ROOT = "com_github_jetbrains_kotlin"
########################################################################################################################
# Providers
######################################################... | true | true |
f7564e5af4d2c9b43d70e0e893f523d6d2d64007 | 127 | py | Python | accounts/accounts/services/__init__.py | cul-it/arxiv-accounts | 9d237ffc7de4ac7f3c94ad615252681792f53fb5 | [
"MIT"
] | 11 | 2018-12-29T17:55:16.000Z | 2021-11-05T12:26:29.000Z | accounts/accounts/services/__init__.py | Https-github-com-sulaeman51/arxiv-auth | 754fa083b0c8b43932f7393f5a4ab67d9f9f0444 | [
"MIT"
] | 24 | 2019-01-25T18:19:21.000Z | 2022-02-04T01:04:29.000Z | accounts/accounts/services/__init__.py | Https-github-com-sulaeman51/arxiv-auth | 754fa083b0c8b43932f7393f5a4ab67d9f9f0444 | [
"MIT"
] | 13 | 2019-01-10T22:01:43.000Z | 2021-12-30T11:39:48.000Z | """Provides modules for interacting with external services."""
from . import legacy, users
from .sessions import SessionStore
| 25.4 | 62 | 0.787402 |
from . import legacy, users
from .sessions import SessionStore
| true | true |
f7564e8e433051a9ad2900a0ff4768b76ec08ead | 25,220 | py | Python | sdk/python/tests/compiler/compiler_tests.py | red-firefly/pipelines | deed8a88cb5b6b62a65c67d79ce128bf83d3adfd | [
"Apache-2.0"
] | 1 | 2019-10-12T07:59:24.000Z | 2019-10-12T07:59:24.000Z | sdk/python/tests/compiler/compiler_tests.py | red-firefly/pipelines | deed8a88cb5b6b62a65c67d79ce128bf83d3adfd | [
"Apache-2.0"
] | null | null | null | sdk/python/tests/compiler/compiler_tests.py | red-firefly/pipelines | deed8a88cb5b6b62a65c67d79ce128bf83d3adfd | [
"Apache-2.0"
] | null | null | null | # Copyright 2018-2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | 35.027778 | 140 | 0.647264 |
import kfp
import kfp.compiler as compiler
import kfp.dsl as dsl
import os
import shutil
import subprocess
import sys
import zipfile
import tarfile
import tempfile
import unittest
import yaml
from kfp.dsl._component import component
from kfp.dsl import ContainerOp, pipeline
from kfp.dsl.types import Integer, Inconsis... | true | true |
f7564ec1d0a7e165bd5bb1e5c535c22c7bf1fa95 | 5,554 | py | Python | nova/tests/api/openstack/compute/plugins/v3/test_evacuate.py | bopopescu/plumgrid-nova | 87579b67ed9a2d62f04d3540d6fb817cc002cead | [
"Apache-2.0"
] | null | null | null | nova/tests/api/openstack/compute/plugins/v3/test_evacuate.py | bopopescu/plumgrid-nova | 87579b67ed9a2d62f04d3540d6fb817cc002cead | [
"Apache-2.0"
] | null | null | null | nova/tests/api/openstack/compute/plugins/v3/test_evacuate.py | bopopescu/plumgrid-nova | 87579b67ed9a2d62f04d3540d6fb817cc002cead | [
"Apache-2.0"
] | 1 | 2020-07-24T08:52:14.000Z | 2020-07-24T08:52:14.000Z | # Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 36.781457 | 78 | 0.611811 |
import uuid
from oslo.config import cfg
import webob
from nova.compute import api as compute_api
from nova.compute import vm_states
from nova import context
from nova import exception
from nova.openstack.common import jsonutils
from nova import test
from nova.tests.api.openstack import fakes
CONF = cfg.CONF
CONF.im... | true | true |
f7564f124bf262fc586f2b49ac95ff9d29d6764d | 1,062 | py | Python | tests/test_networks/test_brokers/test_publishers/test_abc.py | Clariteia/minos_microservice_networks | 77f239429653272c5cb3447311513143f8521ed9 | [
"MIT"
] | 7 | 2021-04-12T15:40:11.000Z | 2022-03-04T13:46:01.000Z | tests/test_networks/test_brokers/test_publishers/test_abc.py | Clariteia/minos_microservice_networks | 77f239429653272c5cb3447311513143f8521ed9 | [
"MIT"
] | 275 | 2021-04-03T09:23:40.000Z | 2022-01-28T11:56:25.000Z | tests/test_networks/test_brokers/test_publishers/test_abc.py | Clariteia/minos_microservice_networks | 77f239429653272c5cb3447311513143f8521ed9 | [
"MIT"
] | null | null | null | import unittest
import aiopg
from minos.common.testing import (
PostgresAsyncTestCase,
)
from minos.networks import (
BrokerPublisherSetup,
)
from tests.utils import (
BASE_PATH,
)
class TestBrokerSetup(PostgresAsyncTestCase):
CONFIG_FILE_PATH = BASE_PATH / "test_config.yml"
def setUp(self) -> ... | 24.697674 | 86 | 0.592279 | import unittest
import aiopg
from minos.common.testing import (
PostgresAsyncTestCase,
)
from minos.networks import (
BrokerPublisherSetup,
)
from tests.utils import (
BASE_PATH,
)
class TestBrokerSetup(PostgresAsyncTestCase):
CONFIG_FILE_PATH = BASE_PATH / "test_config.yml"
def setUp(self) -> ... | true | true |
f7564fd7fa0fc6d9686194fc3f0a1a1809a4cfe9 | 3,773 | py | Python | research/audioset/vggish/vggish_smoke_test.py | vincentcheny/models | afb1a59fc1bc792ac72d1a3e22e2469020529788 | [
"Apache-2.0"
] | 1 | 2019-09-11T09:41:11.000Z | 2019-09-11T09:41:11.000Z | research/audioset/vggish/vggish_smoke_test.py | vincentcheny/models | afb1a59fc1bc792ac72d1a3e22e2469020529788 | [
"Apache-2.0"
] | null | null | null | research/audioset/vggish/vggish_smoke_test.py | vincentcheny/models | afb1a59fc1bc792ac72d1a3e22e2469020529788 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 38.5 | 81 | 0.738404 |
from __future__ import print_function
import numpy as np
import tensorflow as tf
import vggish_input
import vggish_params
import vggish_postprocess
import vggish_slim
print('\nTesting your install of VGGish\n')
checkpoint_path = 'vggish_model.ckpt'
pca_params_path = 'vggish_pca_params.npz'
rel_e... | true | true |
f756501c7b64385bcc1a1a7cff3246e0bd397556 | 2,306 | py | Python | paper/spiders/scirob.py | lvliangxiong/scirob-paper-download | 4357ab84caafbffbd9a28579125ceba2339769f8 | [
"MIT"
] | 4 | 2021-01-22T07:28:33.000Z | 2022-01-21T00:55:30.000Z | paper/spiders/scirob.py | lvliangxiong/PaperDownload | 4357ab84caafbffbd9a28579125ceba2339769f8 | [
"MIT"
] | null | null | null | paper/spiders/scirob.py | lvliangxiong/PaperDownload | 4357ab84caafbffbd9a28579125ceba2339769f8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import scrapy
from paper.items import SciRobIssueItem
from scrapy.shell import inspect_response
class ScirobSpider(scrapy.Spider):
name = 'scirob'
base_url = "https://robotics.sciencemag.org/content/by/year/"
start_year = 2016
current_year = 2020
custom_settings = {
... | 39.084746 | 106 | 0.639202 | import scrapy
from paper.items import SciRobIssueItem
from scrapy.shell import inspect_response
class ScirobSpider(scrapy.Spider):
name = 'scirob'
base_url = "https://robotics.sciencemag.org/content/by/year/"
start_year = 2016
current_year = 2020
custom_settings = {
"DOWNLOAD_TIMEOUT": 30... | true | true |
f75651172bc9236622d8edeceab07f6893810f44 | 600 | py | Python | dream/server/helpers.py | icyblade/dream | 818e77f1c25e51f8cd966f7aa4eb1bcd4207b208 | [
"MIT"
] | null | null | null | dream/server/helpers.py | icyblade/dream | 818e77f1c25e51f8cd966f7aa4eb1bcd4207b208 | [
"MIT"
] | null | null | null | dream/server/helpers.py | icyblade/dream | 818e77f1c25e51f8cd966f7aa4eb1bcd4207b208 | [
"MIT"
] | null | null | null | import json
import logging
import traceback
def helper(function):
"""Decorator to mark helper functions.
Will do nothing to the original function.
"""
return function
def flask_method(function):
"""Decorator to handle errors."""
def generate_errcode(*args, **kwargs):
try:
... | 21.428571 | 45 | 0.581667 | import json
import logging
import traceback
def helper(function):
return function
def flask_method(function):
def generate_errcode(*args, **kwargs):
try:
return function(*args, **kwargs)
except Exception as e:
logging.error(str(e))
traceback.print_exc()
... | true | true |
f756511a13cbac9dbbed9a7b8c45e1e3ab70a2da | 2,201 | py | Python | tests/__init__.py | idjaw/netman | 58ba898de6e450a24b4f1721ce274ad3e12f9d33 | [
"Apache-2.0"
] | 1 | 2016-01-28T17:56:51.000Z | 2016-01-28T17:56:51.000Z | tests/__init__.py | idjaw/netman | 58ba898de6e450a24b4f1721ce274ad3e12f9d33 | [
"Apache-2.0"
] | 2 | 2021-12-13T20:55:50.000Z | 2022-03-29T22:07:13.000Z | tests/__init__.py | idjaw/netman | 58ba898de6e450a24b4f1721ce274ad3e12f9d33 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Internap.
#
# 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, so... | 31.442857 | 121 | 0.711495 | import logging
import warnings
from functools import wraps
from hamcrest.core.core.isequal import IsEqual
from netaddr import IPNetwork
from global_reactor import ThreadedReactor
from tests.adapters.model_list import available_models
from tests.adapters.shell.terminal_client_test import telnet_hook_to_reactor, ssh_ho... | true | true |
f756511fbda48cba78d43340e522be9cae1cd50b | 390 | py | Python | settings.py | josemauro/topology | ae7b792e8516c5c5ff5bfd01779bfa4e5a9b210b | [
"MIT"
] | null | null | null | settings.py | josemauro/topology | ae7b792e8516c5c5ff5bfd01779bfa4e5a9b210b | [
"MIT"
] | 72 | 2017-09-29T19:31:51.000Z | 2021-05-28T18:10:15.000Z | settings.py | josemauro/topology | ae7b792e8516c5c5ff5bfd01779bfa4e5a9b210b | [
"MIT"
] | 15 | 2017-10-03T18:35:24.000Z | 2021-06-01T12:16:33.000Z | """Settings for the Topology NApp."""
# Set this option to true if you need the topology with bi-directional links
# DISPLAY_FULL_DUPLEX_LINKS = True
# Time (in seconds) to wait before setting a link as up
LINK_UP_TIMER = 10
# Time (in seconds) to wait retrieve box from storehouse
BOX_RESTORE_TIMER = 0.1
# Time (in s... | 32.5 | 76 | 0.771795 |
LINK_UP_TIMER = 10
BOX_RESTORE_TIMER = 0.1
INTERFACE_RESTORE_TIMER = 2
| true | true |
f75651d29fdbe6436817a27c5158f87bcdef6736 | 263 | py | Python | lectures/05-python-intro/examples/if-else.py | mattmiller899/biosys-analytics | ab24a4c7206ed9a865e896daa57cee3c4e62df1f | [
"MIT"
] | 4 | 2019-01-10T17:12:37.000Z | 2019-03-01T18:25:07.000Z | lectures/05-python-intro/examples/if-else.py | mattmiller899/biosys-analytics | ab24a4c7206ed9a865e896daa57cee3c4e62df1f | [
"MIT"
] | null | null | null | lectures/05-python-intro/examples/if-else.py | mattmiller899/biosys-analytics | ab24a4c7206ed9a865e896daa57cee3c4e62df1f | [
"MIT"
] | 33 | 2019-01-05T17:03:47.000Z | 2019-11-11T20:48:24.000Z | #!/usr/bin/env python3
"""conditions"""
name = input('What is your name? ')
age = int(input('Hi, ' + name + '. What is your age? '))
if age < 0:
print("That isn't possible.")
elif age < 18:
print('You are a minor.')
else:
print('You are an adult.')
| 20.230769 | 56 | 0.585551 |
name = input('What is your name? ')
age = int(input('Hi, ' + name + '. What is your age? '))
if age < 0:
print("That isn't possible.")
elif age < 18:
print('You are a minor.')
else:
print('You are an adult.')
| true | true |
f756524122e0a885958dfdc6bdd08db962c10f5c | 3,009 | py | Python | edk2toolext/invocables/edk2_update.py | matthewfcarlson/edk2-pytool-extensions | 60a6b32a8a9e8deaed7fd197779a27a8bbf44c84 | [
"BSD-2-Clause-Patent"
] | null | null | null | edk2toolext/invocables/edk2_update.py | matthewfcarlson/edk2-pytool-extensions | 60a6b32a8a9e8deaed7fd197779a27a8bbf44c84 | [
"BSD-2-Clause-Patent"
] | null | null | null | edk2toolext/invocables/edk2_update.py | matthewfcarlson/edk2-pytool-extensions | 60a6b32a8a9e8deaed7fd197779a27a8bbf44c84 | [
"BSD-2-Clause-Patent"
] | null | null | null | # @file Edk2Update
# Updates external dependencies for project_scope in workspace_path
# as listed in Platform Config file.
##
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import logging
from edk2toolext import edk2_logging
from edk2toolext.environment import self_describing... | 30.704082 | 118 | 0.679628 | import logging
from edk2toolext import edk2_logging
from edk2toolext.environment import self_describing_environment
from edk2toolext.edk2_invocable import Edk2Invocable
class UpdateSettingsManager():
def GetActiveScopes(self):
raise NotImplementedError()
def GetWorkspaceRoot(self):
raise Not... | true | true |
f75652d2e66e2f4dffd62f36507c0911b2f53b66 | 36,875 | py | Python | pvrpm/core/simulation.py | FSEC-Photovoltaics/pvrpm-lcoe | dbe0bb30ffa1041ec004f84c57aac44f47bdf6d2 | [
"BSD-3-Clause"
] | 1 | 2022-03-29T16:03:26.000Z | 2022-03-29T16:03:26.000Z | pvrpm/core/simulation.py | FSEC-Photovoltaics/pvrpm-lcoe | dbe0bb30ffa1041ec004f84c57aac44f47bdf6d2 | [
"BSD-3-Clause"
] | 29 | 2022-02-05T17:27:07.000Z | 2022-03-06T23:53:50.000Z | pvrpm/core/simulation.py | FSEC-Photovoltaics/pvrpm-lcoe | dbe0bb30ffa1041ec004f84c57aac44f47bdf6d2 | [
"BSD-3-Clause"
] | 2 | 2022-01-13T23:35:19.000Z | 2022-03-21T15:46:05.000Z | import os
import time
import warnings
import multiprocessing as mp
from typing import List
import pandas as pd
import numpy as np
import scipy
import scipy.stats as stats
import matplotlib.pyplot as plt
from dateutil.relativedelta import relativedelta
from datetime import datetime
from tqdm import tqdm
from pvrpm.cor... | 39.396368 | 176 | 0.636502 | import os
import time
import warnings
import multiprocessing as mp
from typing import List
import pandas as pd
import numpy as np
import scipy
import scipy.stats as stats
import matplotlib.pyplot as plt
from dateutil.relativedelta import relativedelta
from datetime import datetime
from tqdm import tqdm
from pvrpm.cor... | true | true |
f756535e7e25a757810a33250dc4d8bd0eee3600 | 9,122 | py | Python | sdk/python/pulumi_azure_nextgen/network/v20200401/firewall_policy.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 31 | 2020-09-21T09:41:01.000Z | 2021-02-26T13:21:59.000Z | sdk/python/pulumi_azure_nextgen/network/v20200401/firewall_policy.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 231 | 2020-09-21T09:38:45.000Z | 2021-03-01T11:16:03.000Z | sdk/python/pulumi_azure_nextgen/network/v20200401/firewall_policy.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 4 | 2020-09-29T14:14:59.000Z | 2021-02-10T20:38:16.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 43.855769 | 950 | 0.66082 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['FirewallPolicy']
class FirewallPolicy(pulumi.CustomResource):
def __init__(__self__,
... | true | true |
f75653c5d77ebd935fdd5b4ed4eccf6177fc8988 | 1,545 | py | Python | dtf/migrations/0012_cascade_on_delete.py | siehr/django-testing-framework | 7e411227afff1a5463ebc73ae5cb2c537f0d4f69 | [
"MIT"
] | null | null | null | dtf/migrations/0012_cascade_on_delete.py | siehr/django-testing-framework | 7e411227afff1a5463ebc73ae5cb2c537f0d4f69 | [
"MIT"
] | 70 | 2021-03-06T14:36:42.000Z | 2022-03-30T10:00:54.000Z | dtf/migrations/0012_cascade_on_delete.py | siehr/django-testing-framework | 7e411227afff1a5463ebc73ae5cb2c537f0d4f69 | [
"MIT"
] | 1 | 2022-02-02T14:05:43.000Z | 2022-02-02T14:05:43.000Z | # Generated by Django 3.1b1 on 2020-12-10 17:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dtf', '0011_add_reference_sets_3'),
]
operations = [
migrations.AlterField(
model_name='project... | 38.625 | 149 | 0.642718 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dtf', '0011_add_reference_sets_3'),
]
operations = [
migrations.AlterField(
model_name='projectsubmissionproperty',
name='project',... | true | true |
f756547614baa76911fa56844a6a7f097293e037 | 50,185 | py | Python | tools/souffle_converter.py | gfour/differential-datalog | c092767ba2bcab30e5cfa968eb2278434a577186 | [
"MIT"
] | null | null | null | tools/souffle_converter.py | gfour/differential-datalog | c092767ba2bcab30e5cfa968eb2278434a577186 | [
"MIT"
] | null | null | null | tools/souffle_converter.py | gfour/differential-datalog | c092767ba2bcab30e5cfa968eb2278434a577186 | [
"MIT"
] | null | null | null | #! /usr/bin/env python2.7
"""This program converts Datalog programs written in the Souffle dialect to
Datalog programs written in the Differential Datalog dialect"""
# pylint: disable=invalid-name,missing-docstring,global-variable-not-assigned,line-too-long
import json
import gzip
import os
import argparse
import p... | 37.932729 | 101 | 0.574255 | """This program converts Datalog programs written in the Souffle dialect to
Datalog programs written in the Differential Datalog dialect"""
import json
import gzip
import os
import argparse
import parglare
skip_files = False skip_logic = False profile = False relationPrefix = "" parglareParser = None verb... | false | true |
f756560ea1a4dd795e8196db56402c4defc98945 | 200 | py | Python | yt_transcript/youtube_transcript_api/__main__.py | uxio-andrade/hackXLR8 | 4afab09638d37ddc2ba54b76b52097ba10b71770 | [
"MIT"
] | 773 | 2018-05-15T19:12:00.000Z | 2022-03-31T23:56:30.000Z | youtube_transcript_api/__main__.py | hbyyy/youtube-transcript-api | 361986e2211307ca796e6962b0aa4a892291f90a | [
"MIT"
] | 125 | 2018-07-14T18:50:25.000Z | 2022-03-30T15:36:34.000Z | youtube_transcript_api/__main__.py | hbyyy/youtube-transcript-api | 361986e2211307ca796e6962b0aa4a892291f90a | [
"MIT"
] | 145 | 2018-05-15T19:12:02.000Z | 2022-03-21T16:38:47.000Z | import sys
import logging
from ._cli import YouTubeTranscriptCli
def main():
logging.basicConfig()
print(YouTubeTranscriptCli(sys.argv[1:]).run())
if __name__ == '__main__':
main()
| 12.5 | 51 | 0.695 | import sys
import logging
from ._cli import YouTubeTranscriptCli
def main():
logging.basicConfig()
print(YouTubeTranscriptCli(sys.argv[1:]).run())
if __name__ == '__main__':
main()
| true | true |
f75656872fc86f50ad8c3000c9527d68ef327fde | 7,936 | py | Python | networkx/linalg/laplacianmatrix.py | tempcyc/networkx | cae83ba501c242567cb2454f97f851898276f06e | [
"BSD-3-Clause"
] | 1 | 2015-07-16T01:36:44.000Z | 2015-07-16T01:36:44.000Z | networkx/linalg/laplacianmatrix.py | tempcyc/networkx | cae83ba501c242567cb2454f97f851898276f06e | [
"BSD-3-Clause"
] | null | null | null | networkx/linalg/laplacianmatrix.py | tempcyc/networkx | cae83ba501c242567cb2454f97f851898276f06e | [
"BSD-3-Clause"
] | null | null | null | """Laplacian matrix of graphs.
"""
# Copyright (C) 2004-2013 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
from networkx.utils import not_implemented_for
__author__ = "\n".join(['Aric ... | 30.75969 | 99 | 0.602697 | import networkx as nx
from networkx.utils import not_implemented_for
__author__ = "\n".join(['Aric Hagberg <aric.hagberg@gmail.com>',
'Pieter Swart (swart@lanl.gov)',
'Dan Schult (dschult@colgate.edu)',
'Alejandro Weinstein <alejandro.weinstein@gma... | true | true |
f7565715ab3fa4b4efa564f2338a2fb47db3102e | 2,773 | py | Python | pvfit/common/constants.py | markcampanelli/pvfit | e526f3757279a3f8c41295aab94c1575ee9485fc | [
"MIT"
] | 4 | 2019-09-17T15:19:17.000Z | 2021-11-24T03:21:03.000Z | pvfit/common/constants.py | markcampanelli/pvfit | e526f3757279a3f8c41295aab94c1575ee9485fc | [
"MIT"
] | 3 | 2019-09-08T01:47:29.000Z | 2020-09-13T16:12:45.000Z | pvfit/common/constants.py | markcampanelli/pvfit | e526f3757279a3f8c41295aab94c1575ee9485fc | [
"MIT"
] | 2 | 2019-10-01T07:40:16.000Z | 2019-10-25T09:27:45.000Z | import inspect
import scipy.constants
from scipy.optimize import newton
from scipy.optimize.optimize import _minimize_scalar_bounded
# Some useful physical constants (CODATA 2018: https://physics.nist.gov/cuu/Constants/).
# elementary charge, 1.602176634e-19 C.
q_C = scipy.constants.value('elementary charge')
# Bol... | 35.551282 | 106 | 0.676524 | import inspect
import scipy.constants
from scipy.optimize import newton
from scipy.optimize.optimize import _minimize_scalar_bounded
q_C = scipy.constants.value('elementary charge')
k_B_J_per_K = scipy.constants.value('Boltzmann constant')
k_B_eV_per_K = scipy.constants.value('Boltzmann constant in eV/K')
c_m_per... | true | true |
f75658633130464ba40a8b257b649b26cf926f5c | 37,491 | py | Python | maigret/maigret.py | courgettes975/maigret | 2a9558ca46498dfd910537d91a35cda2891ea831 | [
"MIT"
] | 4 | 2021-03-12T07:59:59.000Z | 2022-02-18T16:45:45.000Z | maigret/maigret.py | courgettes975/maigret | 2a9558ca46498dfd910537d91a35cda2891ea831 | [
"MIT"
] | 5 | 2021-06-02T04:31:55.000Z | 2022-03-12T00:57:13.000Z | maigret/maigret.py | JRRMDSG/maigret | 2a9558ca46498dfd910537d91a35cda2891ea831 | [
"MIT"
] | 1 | 2021-03-14T16:32:02.000Z | 2021-03-14T16:32:02.000Z | """
Maigret main module
"""
import aiohttp
import asyncio
import csv
import http.cookiejar as cookielib
import json
import logging
import os
import platform
import re
import requests
import ssl
import sys
import tqdm.asyncio
import xmind
from aiohttp_socks import ProxyConnector
from argparse import ArgumentParser, Raw... | 39.298742 | 153 | 0.577018 |
import aiohttp
import asyncio
import csv
import http.cookiejar as cookielib
import json
import logging
import os
import platform
import re
import requests
import ssl
import sys
import tqdm.asyncio
import xmind
from aiohttp_socks import ProxyConnector
from argparse import ArgumentParser, RawDescriptionHelpFormatter
fro... | true | true |
f75658debc5b90a9455a8638ef6f3ba91b12faca | 7,122 | py | Python | Computational Nanoscience 2013 - Final project/Code/plot_data.py | simo-tuomisto/portfolio | 7f70bdfe027fcab75970e5f8a81036ca905c893b | [
"MIT"
] | null | null | null | Computational Nanoscience 2013 - Final project/Code/plot_data.py | simo-tuomisto/portfolio | 7f70bdfe027fcab75970e5f8a81036ca905c893b | [
"MIT"
] | null | null | null | Computational Nanoscience 2013 - Final project/Code/plot_data.py | simo-tuomisto/portfolio | 7f70bdfe027fcab75970e5f8a81036ca905c893b | [
"MIT"
] | null | null | null | import numpy as np
import matplotlib.pyplot as mpl
from matplotlib.ticker import NullFormatter
import sys
from glob import glob
import re
import os
if __name__=="__main__":
# Plot these ranges
plotranges = {
5.0 : [0.009 , 0.011],
10.0: [0.007 , 0.011],
15.0: [0.005 , 0.010],
20.0: [0.005 , 0.010],
25.0: [0.00... | 32.669725 | 113 | 0.660489 | import numpy as np
import matplotlib.pyplot as mpl
from matplotlib.ticker import NullFormatter
import sys
from glob import glob
import re
import os
if __name__=="__main__":
plotranges = {
5.0 : [0.009 , 0.011],
10.0: [0.007 , 0.011],
15.0: [0.005 , 0.010],
20.0: [0.005 , 0.010],
25.0: [0.005 , 0.010],
30.0: [... | true | true |
f756590ed3511c90265b127a49d8a1fbbff1981a | 1,256 | py | Python | backend/models/mixins.py | XiaoYang1127/flask-server-in-python | e4567552dc74fad7c2478348861ceb8ff64322fa | [
"Apache-2.0"
] | 1 | 2021-03-31T13:09:03.000Z | 2021-03-31T13:09:03.000Z | backend/models/mixins.py | XiaoYang1127/flask-server-in-python | e4567552dc74fad7c2478348861ceb8ff64322fa | [
"Apache-2.0"
] | null | null | null | backend/models/mixins.py | XiaoYang1127/flask-server-in-python | e4567552dc74fad7c2478348861ceb8ff64322fa | [
"Apache-2.0"
] | null | null | null | import datetime
import json
from sqlalchemy.event import listens_for
from backend.models.base import db, Column
class CTimestampMixin(object):
created_at = Column(db.DateTime(True), default=db.func.now())
updated_at = Column(db.DateTime(True), default=db.func.now())
def serialize_time(self, column):
... | 27.911111 | 65 | 0.670382 | import datetime
import json
from sqlalchemy.event import listens_for
from backend.models.base import db, Column
class CTimestampMixin(object):
created_at = Column(db.DateTime(True), default=db.func.now())
updated_at = Column(db.DateTime(True), default=db.func.now())
def serialize_time(self, column):
... | true | true |
f7565a10e7a504c2df0a90c852e5c2eace167e1b | 4,120 | py | Python | django_project/settings.py | gabrielquenu/django_blog_project | 998cc726923447079477fc9932008fc956e00032 | [
"MIT"
] | null | null | null | django_project/settings.py | gabrielquenu/django_blog_project | 998cc726923447079477fc9932008fc956e00032 | [
"MIT"
] | null | null | null | django_project/settings.py | gabrielquenu/django_blog_project | 998cc726923447079477fc9932008fc956e00032 | [
"MIT"
] | null | null | null | """
Django settings for django_project project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
from ... | 26.753247 | 91 | 0.71966 |
from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-z4c#9vcmvhp8%#-1t=h%zv8as10*+$(*0r3n(@w*a!zk*k8l=t'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'blog.apps.BlogConfig',
'users.apps.UsersConfig',
'cris... | true | true |
f7565c93e42de4bac89122bb8890760b18b05a4c | 7,002 | py | Python | project_src/app/forms.py | tsinghuariit/DMP | 03133fa8796e6318060f038edce2a8ef778754d9 | [
"Apache-2.0"
] | 3 | 2017-07-17T08:57:55.000Z | 2018-03-07T09:41:53.000Z | project_src/app/forms.py | KNIGHTTH0R/DMP-1 | 03133fa8796e6318060f038edce2a8ef778754d9 | [
"Apache-2.0"
] | null | null | null | project_src/app/forms.py | KNIGHTTH0R/DMP-1 | 03133fa8796e6318060f038edce2a8ef778754d9 | [
"Apache-2.0"
] | 4 | 2017-07-17T08:57:58.000Z | 2018-06-22T07:48:45.000Z | # coding=utf-8
from flask import flash
from flask_babel import gettext
from flask_wtf import Form
from wtforms import StringField, BooleanField, TextAreaField, PasswordField, \
validators
from flask_wtf.file import FileField, FileRequired
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.valid... | 43.222222 | 104 | 0.67595 | from flask import flash
from flask_babel import gettext
from flask_wtf import Form
from wtforms import StringField, BooleanField, TextAreaField, PasswordField, \
validators
from flask_wtf.file import FileField, FileRequired
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import Da... | true | true |
f7565c943ff4ba2b5e010fb243f52722c9ee12a8 | 5,204 | py | Python | CIM15/IEC61970/Informative/InfOperations/ChangeSet.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 58 | 2015-04-22T10:41:03.000Z | 2022-03-29T16:04:34.000Z | CIM15/IEC61970/Informative/InfOperations/ChangeSet.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 12 | 2015-08-26T03:57:23.000Z | 2020-12-11T20:14:42.000Z | CIM15/IEC61970/Informative/InfOperations/ChangeSet.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 35 | 2015-01-10T12:21:03.000Z | 2020-09-09T08:18:16.000Z | # Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | 39.424242 | 733 | 0.68063 |
from CIM15.IEC61970.Core.IdentifiedObject import IdentifiedObject
class ChangeSet(IdentifiedObject):
def __init__(self, NetworkDataSets=None, ChangeItems=None, status=None, Documents=None, *args, **kw_args):
self._NetworkDataSets = []
self.NetworkDataSets = [] if NetworkDataSets is None else Netw... | true | true |
f7565d68156890224cca1cec9bfdf8ff99f7e21f | 13,552 | py | Python | deepsnap/batch.py | Guangxuan-Xiao/deepsnap | b0b222c8093b6273c648c51585c9ebbb2f4112fa | [
"MIT"
] | null | null | null | deepsnap/batch.py | Guangxuan-Xiao/deepsnap | b0b222c8093b6273c648c51585c9ebbb2f4112fa | [
"MIT"
] | null | null | null | deepsnap/batch.py | Guangxuan-Xiao/deepsnap | b0b222c8093b6273c648c51585c9ebbb2f4112fa | [
"MIT"
] | null | null | null | import torch
from deepsnap.graph import Graph
from deepsnap.hetero_graph import HeteroGraph
from typing import (
Callable,
Dict,
List
)
class Batch(Graph):
r"""
A plain old python object modeling a batch of
:class:`deepsnap.graph.Graph` objects as one big (disconnected) graph,
with :class:... | 36.926431 | 79 | 0.540584 | import torch
from deepsnap.graph import Graph
from deepsnap.hetero_graph import HeteroGraph
from typing import (
Callable,
Dict,
List
)
class Batch(Graph):
def __init__(self, batch=None, **kwargs):
super(Batch, self).__init__(**kwargs)
self.batch = batch
self.__data_class__ = ... | true | true |
f7565d6f53546f8556204f62162542f27c1eb888 | 6,334 | py | Python | models_nonconvex_simple2/batch_nc.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | models_nonconvex_simple2/batch_nc.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | models_nonconvex_simple2/batch_nc.py | grossmann-group/pyomo-MINLP-benchmarking | 714f0a0dffd61675649a805683c0627af6b4929e | [
"MIT"
] | null | null | null | # MINLP written by GAMS Convert at 08/20/20 01:30:36
#
# Equation counts
# Total E G L N X C B
# 68 7 60 1 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | 32.152284 | 120 | 0.597727 |
from pyomo.environ import *
model = m = ConcreteModel()
m.x1 = Var(within=Reals,bounds=(1,4),initialize=1)
m.x2 = Var(within=Reals,bounds=(1,4),initialize=1)
m.x3 = Var(within=Reals,bounds=(1,4),initialize=1)
m.x4 = Var(within=Reals,bounds=(1,4),initialize=1)
m.x5 = Var(within=Reals,bounds=(1,4),initialize=1)
m.x6... | true | true |
f7565e66153f8c452f5a2f6f65064164698a22fd | 1,712 | py | Python | data_blocks/cuvinte_sablon.py | slevi123/bacalaureat | ed016d0ab04cda7d166c36c0ff4cee63acdd6449 | [
"MIT"
] | 1 | 2022-03-09T06:46:18.000Z | 2022-03-09T06:46:18.000Z | data_blocks/cuvinte_sablon.py | slevi123/bacalaureat | ed016d0ab04cda7d166c36c0ff4cee63acdd6449 | [
"MIT"
] | null | null | null | data_blocks/cuvinte_sablon.py | slevi123/bacalaureat | ed016d0ab04cda7d166c36c0ff4cee63acdd6449 | [
"MIT"
] | null | null | null | from models import Substantiv, Verb, StructAlt
cuvinte_din_enigma_otiliei = [
[Substantiv,
lambda cuvant:cuvant["singular"]["nume"],
"search_value",
[
{"singular": {"nume": "", "nev": ""}},
{"singular": {"nume": "", "nev": ""}},
{"singular": {"nume": "",... | 33.568627 | 53 | 0.317757 | from models import Substantiv, Verb, StructAlt
cuvinte_din_enigma_otiliei = [
[Substantiv,
lambda cuvant:cuvant["singular"]["nume"],
"search_value",
[
{"singular": {"nume": "", "nev": ""}},
{"singular": {"nume": "", "nev": ""}},
{"singular": {"nume": "",... | true | true |
f7565ea1f06e52213c7c98c983a81fa8b020ab60 | 4,930 | py | Python | face_module/mtcnn_pytorch/src/get_nets.py | furkanc/Yolov3-Face-Recognition | d3074490a6a7bf83925319ed521b557919d0af7e | [
"MIT"
] | 4 | 2019-05-27T06:01:50.000Z | 2021-05-13T00:52:32.000Z | face_module/mtcnn_pytorch/src/get_nets.py | furkanc/Yolov3-Face-Recognition | d3074490a6a7bf83925319ed521b557919d0af7e | [
"MIT"
] | 1 | 2019-11-08T07:28:41.000Z | 2019-11-08T07:44:06.000Z | face_module/mtcnn_pytorch/src/get_nets.py | furkanc/Yolov3-Face-Recognition | d3074490a6a7bf83925319ed521b557919d0af7e | [
"MIT"
] | 1 | 2019-05-19T05:35:19.000Z | 2019-05-19T05:35:19.000Z | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import numpy as np
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
"""
Arguments:
x: a float tensor with shape [batch... | 29 | 79 | 0.506085 | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import numpy as np
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
x = x.transpose(3, 2).contiguous()
return x.view(x.s... | true | true |
f756615778fe62058b5161629864358d5a0405c7 | 3,728 | py | Python | sudan-art/django-backend/sudan_art/views.py | osintalex/sudan-art | ad7b25fe02d45b62b67b1eb60930ae0cde0ffb9c | [
"CC-BY-4.0"
] | 1 | 2022-01-01T19:51:17.000Z | 2022-01-01T19:51:17.000Z | sudan-art/django-backend/sudan_art/views.py | osintalex/sudan-art | ad7b25fe02d45b62b67b1eb60930ae0cde0ffb9c | [
"CC-BY-4.0"
] | 10 | 2022-03-19T12:40:34.000Z | 2022-03-30T21:02:13.000Z | sudan-art/django-backend/sudan_art/views.py | osintalex/sudan-art | ad7b25fe02d45b62b67b1eb60930ae0cde0ffb9c | [
"CC-BY-4.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Application views.
"""
# pylint: disable=W0223,E1101,W1203
import logging
from django.core.exceptions import ValidationError
from rest_framework import fields, filters, generics, serializers, status
from rest_framework.decorators import api_view, parser_classes
from rest_framework.paginat... | 35.504762 | 85 | 0.70735 |
import logging
from django.core.exceptions import ValidationError
from rest_framework import fields, filters, generics, serializers, status
from rest_framework.decorators import api_view, parser_classes
from rest_framework.pagination import PageNumberPagination
from rest_framework.parsers import FormParser, MultiPar... | true | true |
f756615c00cbb335ecd24a2e36855b84220e055a | 338 | py | Python | autos/utils/hash.py | hans-t/autos | 4cb370187cb7a8104cedb1942a4c159033729677 | [
"MIT"
] | 1 | 2016-08-17T15:34:15.000Z | 2016-08-17T15:34:15.000Z | autos/utils/hash.py | hans-t/autos | 4cb370187cb7a8104cedb1942a4c159033729677 | [
"MIT"
] | 6 | 2016-08-17T15:34:55.000Z | 2021-04-30T20:38:05.000Z | autos/utils/hash.py | hans-t/autos | 4cb370187cb7a8104cedb1942a4c159033729677 | [
"MIT"
] | null | null | null | from hashlib import md5
from hashlib import sha1
def hash_str(string, hash_type='md5'):
byte = string.encode('UTF-8')
if hash_type == 'md5':
hasher = md5
elif hash_type == 'sha1':
hasher = sha1
else:
raise ValueError('Unknown hash type: {}'.format(hash_type))
return hasher(... | 24.142857 | 67 | 0.633136 | from hashlib import md5
from hashlib import sha1
def hash_str(string, hash_type='md5'):
byte = string.encode('UTF-8')
if hash_type == 'md5':
hasher = md5
elif hash_type == 'sha1':
hasher = sha1
else:
raise ValueError('Unknown hash type: {}'.format(hash_type))
return hasher(... | true | true |
f756622ffb2c3ae187fcbd69ad4a0a50abc817c6 | 519 | py | Python | mtw/fl_user/admin.py | subhasrim2001/medical-transcription-website | b8dd823384a9b9381497c319f379c84e6e2c8516 | [
"MIT"
] | null | null | null | mtw/fl_user/admin.py | subhasrim2001/medical-transcription-website | b8dd823384a9b9381497c319f379c84e6e2c8516 | [
"MIT"
] | null | null | null | mtw/fl_user/admin.py | subhasrim2001/medical-transcription-website | b8dd823384a9b9381497c319f379c84e6e2c8516 | [
"MIT"
] | null | null | null | from django.contrib import admin
from fl_user.models import Job_status
from django.contrib import admin
# Register your models here.
class CustomUserAdmin(admin.ModelAdmin):
list_display = ('Doctor_user','date_submitted','assign_first_level_user','is_asigned','transcription_completed', 'QA_passed')
search_fie... | 28.833333 | 129 | 0.747592 | from django.contrib import admin
from fl_user.models import Job_status
from django.contrib import admin
class CustomUserAdmin(admin.ModelAdmin):
list_display = ('Doctor_user','date_submitted','assign_first_level_user','is_asigned','transcription_completed', 'QA_passed')
search_fields = ('Doctor_user',)
re... | true | true |
f756624491bcf7a247efcc87bddc9fc039726bc6 | 12,190 | py | Python | test/integration/ggrc_basic_permissions/test_creator_program.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | null | null | null | test/integration/ggrc_basic_permissions/test_creator_program.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | 12 | 2015-01-08T14:50:19.000Z | 2017-11-29T19:37:53.000Z | test/integration/ggrc_basic_permissions/test_creator_program.py | Smotko/ggrc-core | b3abb58b24e7559960d71a94ba79c75539e7fe29 | [
"Apache-2.0"
] | 1 | 2015-01-08T13:25:09.000Z | 2015-01-08T13:25:09.000Z | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""
Test Creator role with Program scoped roles
"""
from integration.ggrc impor... | 32.768817 | 78 | 0.482034 |
from integration.ggrc import TestCase
from ggrc.models import all_models
from integration.ggrc.api_helper import Api
from integration.ggrc.generator import Generator
from integration.ggrc.generator import ObjectGenerator
from ggrc import db
class TestCreatorProgram(TestCase):
def setUp(self):
TestCase.setUp(... | true | true |
f75663421848f4519418ed560ae776bd29f8f546 | 6,827 | py | Python | yt/frontends/halo_catalog/io.py | Xarthisius/yt | 321643c3abff64a6f132d98d0747f3558f7552a3 | [
"BSD-3-Clause-Clear"
] | 1 | 2021-09-15T08:17:43.000Z | 2021-09-15T08:17:43.000Z | yt/frontends/halo_catalog/io.py | Xarthisius/yt | 321643c3abff64a6f132d98d0747f3558f7552a3 | [
"BSD-3-Clause-Clear"
] | 31 | 2017-04-19T21:07:18.000Z | 2017-04-20T01:08:43.000Z | yt/frontends/halo_catalog/io.py | stonnes/yt | aad3cfa3b4ebab7838352ab467275a27c26ff363 | [
"BSD-3-Clause-Clear"
] | 1 | 2021-04-21T07:01:51.000Z | 2021-04-21T07:01:51.000Z | from collections import defaultdict
import numpy as np
from yt.frontends.gadget_fof.io import IOHandlerGadgetFOFHaloHDF5
from yt.funcs import parse_h5_attr
from yt.units.yt_array import uvstack
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.on_demand_imports import _h5py as h5py
class IOHandler... | 40.636905 | 88 | 0.582833 | from collections import defaultdict
import numpy as np
from yt.frontends.gadget_fof.io import IOHandlerGadgetFOFHaloHDF5
from yt.funcs import parse_h5_attr
from yt.units.yt_array import uvstack
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.on_demand_imports import _h5py as h5py
class IOHandler... | true | true |
f7566610b35cb0c8c50196fcfd8ace0a1057279c | 1,450 | py | Python | samples/generated_samples/aiplatform_generated_aiplatform_v1_vizier_service_get_study_sync.py | sakagarwal/python-aiplatform | 62b4a1ea589235910c6e87f027899a29bf1bacb1 | [
"Apache-2.0"
] | 1 | 2022-03-30T05:23:29.000Z | 2022-03-30T05:23:29.000Z | samples/generated_samples/aiplatform_generated_aiplatform_v1_vizier_service_get_study_sync.py | sakagarwal/python-aiplatform | 62b4a1ea589235910c6e87f027899a29bf1bacb1 | [
"Apache-2.0"
] | null | null | null | samples/generated_samples/aiplatform_generated_aiplatform_v1_vizier_service_get_study_sync.py | sakagarwal/python-aiplatform | 62b4a1ea589235910c6e87f027899a29bf1bacb1 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 31.521739 | 85 | 0.75931 |
from google.cloud import aiplatform_v1
def sample_get_study():
client = aiplatform_v1.VizierServiceClient()
request = aiplatform_v1.GetStudyRequest(
name="name_value",
)
response = client.get_study(request=request)
print(response)
| true | true |
f756668fc5be73bda1e0c70f6cecf2ac45a6991a | 9,676 | py | Python | src/main.py | zdszero/SortVisualizer | 7288155ebb3cec602ad94a7674b50976967f7ea4 | [
"MIT"
] | 1 | 2020-05-26T15:49:12.000Z | 2020-05-26T15:49:12.000Z | src/main.py | ZDS1999/SortVisualizer | 7288155ebb3cec602ad94a7674b50976967f7ea4 | [
"MIT"
] | null | null | null | src/main.py | ZDS1999/SortVisualizer | 7288155ebb3cec602ad94a7674b50976967f7ea4 | [
"MIT"
] | null | null | null | from form import Ui_Widget
from algorithm import Sorter
from globals import dprint
import globals
from PySide2 import QtCore, QtWidgets, QtGui
import sys
import random
class Widget(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.ui = Ui_Widget()
self.ui.setupUi(self)
... | 37.072797 | 100 | 0.602832 | from form import Ui_Widget
from algorithm import Sorter
from globals import dprint
import globals
from PySide2 import QtCore, QtWidgets, QtGui
import sys
import random
class Widget(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.ui = Ui_Widget()
self.ui.setupUi(self)
... | true | true |
f75666d83d2608fb0d69e6fe358665f5352facc3 | 84 | py | Python | tests/patch/mdc/cls_c.py | accelazh/pyacc | ebe2ed801a0288f415a321ddfc3e28f01bf5f1e8 | [
"MIT"
] | null | null | null | tests/patch/mdc/cls_c.py | accelazh/pyacc | ebe2ed801a0288f415a321ddfc3e28f01bf5f1e8 | [
"MIT"
] | null | null | null | tests/patch/mdc/cls_c.py | accelazh/pyacc | ebe2ed801a0288f415a321ddfc3e28f01bf5f1e8 | [
"MIT"
] | null | null | null | def C(a, b, **kwargs):
print "C invoked: a=%s, b=%s, kwargs=%s" % (a, b, kwargs) | 42 | 61 | 0.52381 | def C(a, b, **kwargs):
print "C invoked: a=%s, b=%s, kwargs=%s" % (a, b, kwargs) | false | true |
f75666f559e419868dd42ff96006aa19ccee8c35 | 2,047 | py | Python | snownlp/classification/bayes.py | raxxarr/snownlp | ebd38b8e2eb31ef5007a73fcc595ed1ca3c73f7c | [
"MIT"
] | null | null | null | snownlp/classification/bayes.py | raxxarr/snownlp | ebd38b8e2eb31ef5007a73fcc595ed1ca3c73f7c | [
"MIT"
] | null | null | null | snownlp/classification/bayes.py | raxxarr/snownlp | ebd38b8e2eb31ef5007a73fcc595ed1ca3c73f7c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import gzip
import marshal
from math import log, exp
from ..utils.frequency import AddOneProb
class Bayes(object):
def __init__(self):
self.d = {}
self.total = 0
def save(self, fname, iszip=True):
d = {}
... | 26.934211 | 74 | 0.448461 | from __future__ import unicode_literals
import sys
import gzip
import marshal
from math import log, exp
from ..utils.frequency import AddOneProb
class Bayes(object):
def __init__(self):
self.d = {}
self.total = 0
def save(self, fname, iszip=True):
d = {}
d['total'] = self.t... | true | true |
f75667e9e0cd2f72b9b14ded8a8272cadd6bbaa9 | 1,591 | py | Python | eslearn/machine_learning/test/GCNNCourseCodes/metrics.py | dongmengshi/easylearn | df528aaa69c3cf61f5459a04671642eb49421dfb | [
"MIT"
] | 46 | 2020-03-27T01:19:18.000Z | 2022-02-11T09:17:00.000Z | eslearn/machine_learning/test/GCNNCourseCodes/metrics.py | dongmengshi/easylearn | df528aaa69c3cf61f5459a04671642eb49421dfb | [
"MIT"
] | null | null | null | eslearn/machine_learning/test/GCNNCourseCodes/metrics.py | dongmengshi/easylearn | df528aaa69c3cf61f5459a04671642eb49421dfb | [
"MIT"
] | 5 | 2020-03-29T23:41:17.000Z | 2020-10-05T12:40:12.000Z | import tensorflow as tf
def masked_softmax_cross_entropy(preds, labels, mask):
"""Softmax cross-entropy loss with masking."""
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(mask)
loss *= mask
return ... | 35.355556 | 83 | 0.719045 | import tensorflow as tf
def masked_softmax_cross_entropy(preds, labels, mask):
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(mask)
loss *= mask
return tf.reduce_mean(loss)
def sigmoid_cross_entropy(pre... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.