hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f73109e94e405161ed8aebf68ae23f9e76eb1142 | 26,888 | py | Python | lib/pybtex-0.19/pybtex/database/__init__.py | cabeen/bibfmt | a2607506f15249f8e0ee900db103d57afec7dec8 | [
"MIT"
] | 1 | 2021-02-20T19:53:48.000Z | 2021-02-20T19:53:48.000Z | lib/pybtex-0.19/pybtex/database/__init__.py | cabeen/bibfmt | a2607506f15249f8e0ee900db103d57afec7dec8 | [
"MIT"
] | null | null | null | lib/pybtex-0.19/pybtex/database/__init__.py | cabeen/bibfmt | a2607506f15249f8e0ee900db103d57afec7dec8 | [
"MIT"
] | null | null | null | # vim: fileencoding=utf-8
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Andrey Golovizin
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without... | 33.652065 | 129 | 0.576056 |
import re
from collections import Mapping
from pybtex.plugin import find_plugin
from pybtex.exceptions import PybtexError
from pybtex.utils import (
deprecated,
OrderedCaseInsensitiveDict, CaseInsensitiveDefaultDict, CaseInsensitiveSet
)
from pybtex.bibtex.utils import split_tex_string, scan_bibtex_string
fr... | true | true |
f7310a03ff8c470b1a97fb65773a13fadaa84311 | 17,145 | py | Python | cinder/tests/unit/attachments/test_attachments_api.py | helenwalsh/cinder | 307fccea4cc9c6496334b0fe137206cb48499bd5 | [
"Apache-2.0"
] | 1 | 2019-02-17T17:49:41.000Z | 2019-02-17T17:49:41.000Z | cinder/tests/unit/attachments/test_attachments_api.py | BelieveInFuture/cinder | fff95fa6a68a054488ee087b6e31f4f5e28209dc | [
"Apache-2.0"
] | 1 | 2020-12-22T20:40:20.000Z | 2020-12-23T18:34:42.000Z | cinder/tests/unit/attachments/test_attachments_api.py | BelieveInFuture/cinder | fff95fa6a68a054488ee087b6e31f4f5e28209dc | [
"Apache-2.0"
] | 3 | 2020-06-16T07:29:48.000Z | 2020-06-21T10:22:57.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 45.72 | 100 | 0.552289 |
from unittest import mock
from oslo_config import cfg
from oslo_policy import policy as oslo_policy
from cinder import context
from cinder import db
from cinder import exception
from cinder import objects
from cinder.policies import attachments as attachment_policy
from cinder.policies import base as base_policy
fro... | true | true |
f7310a6506b1291656e1d48a8acd6e1397f886e7 | 1,296 | py | Python | docs/scripts/build-go.py | xUndero/noc | 9fb34627721149fcf7064860bd63887e38849131 | [
"BSD-3-Clause"
] | 1 | 2019-09-20T09:36:48.000Z | 2019-09-20T09:36:48.000Z | docs/scripts/build-go.py | ewwwcha/noc | aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb | [
"BSD-3-Clause"
] | null | null | null | docs/scripts/build-go.py | ewwwcha/noc | aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Build go.html
# ----------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------... | 25.411765 | 72 | 0.45216 |
import sys
import os
from sphinx.util.inventory import InventoryFile
JS = """
function redirect(rmap) {
var href = window.location.href;
var label = href.split('#')[1];
var base = href.substr(0, href.indexOf("go.html"))
window.location = base + rmap[label];
}
"""
def process(path):
r = [
"<html>",
... | true | true |
f7310adaaf9f436b99dc44a44f9873149854a8c7 | 312 | py | Python | trabajos/ejercicio8.py | marilynmamani/marilyn-M.Q | 54090978b1f6e2f12b79b5dd39c59e9594226414 | [
"Apache-2.0"
] | null | null | null | trabajos/ejercicio8.py | marilynmamani/marilyn-M.Q | 54090978b1f6e2f12b79b5dd39c59e9594226414 | [
"Apache-2.0"
] | null | null | null | trabajos/ejercicio8.py | marilynmamani/marilyn-M.Q | 54090978b1f6e2f12b79b5dd39c59e9594226414 | [
"Apache-2.0"
] | null | null | null | def votoElecciones():
print("Como saber si puedes votar por tu edad")
mensaje =""
edadP=int(input("ingrese la edad que tiene:"))
if edadP>=18:
mensaje ="Usted esta apto para votar"
else:
mensaje ="Usted no cumple con la edadad minima y no esta apto para votar"
print(mensaje)
votoElecciones() | 31.2 | 77 | 0.701923 | def votoElecciones():
print("Como saber si puedes votar por tu edad")
mensaje =""
edadP=int(input("ingrese la edad que tiene:"))
if edadP>=18:
mensaje ="Usted esta apto para votar"
else:
mensaje ="Usted no cumple con la edadad minima y no esta apto para votar"
print(mensaje)
votoElecciones() | true | true |
f7310ade1292bec44ede20c2ba3965b6ae5472ce | 26,481 | py | Python | openstack_dashboard/test/unit/api/test_nova.py | NunoEdgarGFlowHub/horizon | 73a0bbd43ea78ac5337f7d00977ec5f32452067e | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/test/unit/api/test_nova.py | NunoEdgarGFlowHub/horizon | 73a0bbd43ea78ac5337f7d00977ec5f32452067e | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/test/unit/api/test_nova.py | NunoEdgarGFlowHub/horizon | 73a0bbd43ea78ac5337f7d00977ec5f32452067e | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")... | 40.99226 | 79 | 0.629848 |
from __future__ import absolute_import
from django.conf import settings
from django.test.utils import override_settings
import mock
from novaclient import api_versions
from novaclient import exceptions as nova_exceptions
from novaclient.v2 import flavor_access as nova_flavor_access
from novaclient.v2 import servers
... | true | true |
f7310b7ead9624ea504e64c406cc2aff15d3c26e | 475 | py | Python | File3.py | PRASAD-DANGARE/PYTHON | 36214f7dc3762d327e5a29e40752edeb098249c8 | [
"MIT"
] | 1 | 2021-06-07T07:55:28.000Z | 2021-06-07T07:55:28.000Z | File3.py | PRASAD-DANGARE/PYTHON | 36214f7dc3762d327e5a29e40752edeb098249c8 | [
"MIT"
] | null | null | null | File3.py | PRASAD-DANGARE/PYTHON | 36214f7dc3762d327e5a29e40752edeb098249c8 | [
"MIT"
] | null | null | null | '''
Function Name : main()
Description : How To Open File & Read The Data Using Open, Read
Function Date : 15 Mar 2021
Function Author : Prasad Dangare
Input : Int
Output : Int
'''
def main():
name = input("Enter the file name that you want to Read : ")
... | 21.590909 | 70 | 0.543158 |
def main():
name = input("Enter the file name that you want to Read : ")
fobj = open(name,"r")
print("Data from file is ")
print(fobj.read())
if __name__ == "__main__":
main()
| true | true |
f7310b85b49a3410f4d4de81bf967f2752594b51 | 2,260 | py | Python | src/recording_script_generator/app/sentence_splitting.py | stefantaubert/recording-script-generator | 01cdcd4b85ed7f245f4bb8535d870c04472746c9 | [
"MIT"
] | null | null | null | src/recording_script_generator/app/sentence_splitting.py | stefantaubert/recording-script-generator | 01cdcd4b85ed7f245f4bb8535d870c04472746c9 | [
"MIT"
] | null | null | null | src/recording_script_generator/app/sentence_splitting.py | stefantaubert/recording-script-generator | 01cdcd4b85ed7f245f4bb8535d870c04472746c9 | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import Optional
from recording_script_generator.app.helper import (
raise_error_if_directory_exists_and_not_overwrite,
raise_error_if_directory_not_exists)
from recording_script_generator.app.io import (load_reading_passages,
l... | 52.55814 | 276 | 0.684071 | from pathlib import Path
from typing import Optional
from recording_script_generator.app.helper import (
raise_error_if_directory_exists_and_not_overwrite,
raise_error_if_directory_not_exists)
from recording_script_generator.app.io import (load_reading_passages,
l... | true | true |
f7310bc599c78dfa6a7cf3aaae17e6e710d2caae | 4,872 | py | Python | teste/polls/tests.py | DarlanGabriel/djangoproject | e2260edcbcb8a8cdf2e4e60f46d3ab3fd6e035c3 | [
"Apache-2.0"
] | null | null | null | teste/polls/tests.py | DarlanGabriel/djangoproject | e2260edcbcb8a8cdf2e4e60f46d3ab3fd6e035c3 | [
"Apache-2.0"
] | null | null | null | teste/polls/tests.py | DarlanGabriel/djangoproject | e2260edcbcb8a8cdf2e4e60f46d3ab3fd6e035c3 | [
"Apache-2.0"
] | null | null | null | import datetime
from django.test import TestCase
from django.utils import timezone
from .models import Question
from django.urls import reverse
class QuestionModelTests(TestCase):
def test_was_published_recently_with_future_question(self):
"""
was_published_recently() returns False for question... | 37.19084 | 84 | 0.66564 | import datetime
from django.test import TestCase
from django.utils import timezone
from .models import Question
from django.urls import reverse
class QuestionModelTests(TestCase):
def test_was_published_recently_with_future_question(self):
"""
was_published_recently() returns False for question... | false | true |
f7310ca10c88fc71c44d09d18e1abc98736f1dc9 | 10,685 | py | Python | pokemon_data.py | aroxby/pk-stadium-decoder | 71f23bcc7035fcd763e69372387becc1b4744fd0 | [
"Unlicense"
] | null | null | null | pokemon_data.py | aroxby/pk-stadium-decoder | 71f23bcc7035fcd763e69372387becc1b4744fd0 | [
"Unlicense"
] | null | null | null | pokemon_data.py | aroxby/pk-stadium-decoder | 71f23bcc7035fcd763e69372387becc1b4744fd0 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3
from enum import Enum
class Type(Enum):
NORMAL = 0
FIGHTING = 1
FLYING = 2
POISON = 3
GROUND = 4
ROCK = 5
BIRD = 6
BUG = 7
GHOST = 8
FIRE = 20
WATER = 21
GRASS = 22
ELECTRIC = 23
PSYCHIC = 24
ICE = 25
DRAGON = 26
def __str__(s... | 27.753247 | 56 | 0.51839 | from enum import Enum
class Type(Enum):
NORMAL = 0
FIGHTING = 1
FLYING = 2
POISON = 3
GROUND = 4
ROCK = 5
BIRD = 6
BUG = 7
GHOST = 8
FIRE = 20
WATER = 21
GRASS = 22
ELECTRIC = 23
PSYCHIC = 24
ICE = 25
DRAGON = 26
def __str__(self):
MAPPING =... | true | true |
f7310cbb1ac1ab0317dcf30418fa49e6095d48e7 | 2,760 | py | Python | maps/ors.py | sackh/maps-cli | 64cc1877518c88bc9b885ebc22580b595bee6fcc | [
"MIT"
] | 5 | 2021-01-21T08:19:43.000Z | 2021-12-12T06:20:53.000Z | maps/ors.py | sackh/maps-cli | 64cc1877518c88bc9b885ebc22580b595bee6fcc | [
"MIT"
] | null | null | null | maps/ors.py | sackh/maps-cli | 64cc1877518c88bc9b885ebc22580b595bee6fcc | [
"MIT"
] | null | null | null | """This module defines all the ORS(https://openrouteservice.org/services/) commands."""
import os
import click
import openrouteservice as opnrs
import simplejson as json
from geojsonio import display as geo_display
from maps.exceptions import ApiKeyNotFoundError
from maps.utils import yield_subcommands
@click.group... | 34.074074 | 90 | 0.648913 | import os
import click
import openrouteservice as opnrs
import simplejson as json
from geojsonio import display as geo_display
from maps.exceptions import ApiKeyNotFoundError
from maps.utils import yield_subcommands
@click.group()
@click.pass_context
def ors(ctx):
ctx.obj = {}
@ors.command()
def show():
f... | true | true |
f7310d1859fb85e6d93daf01566a93a660d350f0 | 56 | py | Python | virtual/lib/python3.6/site-packages/imagekit/forms/__init__.py | kenmutuma001/galleria | 1bbb9fbd3ca8bf7a030dbcbcbd1674d392055d72 | [
"Unlicense"
] | 2 | 2019-04-15T10:28:42.000Z | 2019-04-26T21:48:17.000Z | virtual/lib/python3.6/site-packages/imagekit/forms/__init__.py | kenmutuma001/galleria | 1bbb9fbd3ca8bf7a030dbcbcbd1674d392055d72 | [
"Unlicense"
] | 12 | 2020-02-12T00:25:14.000Z | 2022-03-11T23:48:53.000Z | virtual/lib/python3.6/site-packages/imagekit/forms/__init__.py | kenmutuma001/galleria | 1bbb9fbd3ca8bf7a030dbcbcbd1674d392055d72 | [
"Unlicense"
] | 1 | 2021-05-24T10:19:13.000Z | 2021-05-24T10:19:13.000Z | # flake8: noqa
from .fields import ProcessedImageField
| 14 | 39 | 0.803571 |
from .fields import ProcessedImageField
| true | true |
f7310fabca6b6ef898997efb6b048ead96681b15 | 4,598 | py | Python | plastering/evaluator.py | MingzheWu418/plastering | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | [
"MIT"
] | 29 | 2018-09-19T01:16:27.000Z | 2022-03-29T14:35:36.000Z | plastering/evaluator.py | MingzheWu418/plastering | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | [
"MIT"
] | 14 | 2019-04-12T18:37:36.000Z | 2022-02-10T00:27:55.000Z | plastering/evaluator.py | MingzheWu418/plastering | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | [
"MIT"
] | 14 | 2019-03-05T23:44:11.000Z | 2022-03-18T07:29:31.000Z | from copy import deepcopy
from sklearn.metrics import f1_score
from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer
from sklearn.preprocessing import LabelEncoder
import numpy as np
import pdb
def binarize_labels(true_labels, pred_labels):
srcids = list(pred_labels.keys())
tot_labels = [list(l... | 38.966102 | 75 | 0.707916 | from copy import deepcopy
from sklearn.metrics import f1_score
from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer
from sklearn.preprocessing import LabelEncoder
import numpy as np
import pdb
def binarize_labels(true_labels, pred_labels):
srcids = list(pred_labels.keys())
tot_labels = [list(l... | true | true |
f7310fbb1474ae83999ab53c3f7d66fcd8c2abb3 | 136,240 | py | Python | Lib/test/test_codecs.py | nkhandare/python31all- | c6c792f2db5938def0261378acb5cf1de440ff43 | [
"bzip2-1.0.6"
] | 33 | 2021-07-25T14:23:35.000Z | 2022-03-31T00:17:30.000Z | Lib/test/test_codecs.py | nkhandare/python31all- | c6c792f2db5938def0261378acb5cf1de440ff43 | [
"bzip2-1.0.6"
] | 32 | 2019-04-26T12:29:36.000Z | 2022-03-08T14:24:30.000Z | Lib/test/test_codecs.py | val-verde/cpython | 17aa701d799d5e071d83205d877f722f1498a09f | [
"0BSD"
] | 3 | 2019-11-12T15:21:58.000Z | 2020-09-04T14:27:55.000Z | import codecs
import contextlib
import io
import locale
import sys
import unittest
import encodings
from unittest import mock
from test import support
from test.support import os_helper
from test.support import warnings_helper
try:
import _testcapi
except ImportError:
_testcapi = None
try:
import ctypes
... | 38.649645 | 113 | 0.543188 | import codecs
import contextlib
import io
import locale
import sys
import unittest
import encodings
from unittest import mock
from test import support
from test.support import os_helper
from test.support import warnings_helper
try:
import _testcapi
except ImportError:
_testcapi = None
try:
import ctypes
... | true | true |
f73110ecdff79d7c029c0dd0d895ef71ea68326b | 12,233 | py | Python | loopy/transform/instruction.py | benSepanski/loopy | 5db582d579eb65ce58b93e2c53feb1d48404cf2d | [
"MIT"
] | null | null | null | loopy/transform/instruction.py | benSepanski/loopy | 5db582d579eb65ce58b93e2c53feb1d48404cf2d | [
"MIT"
] | null | null | null | loopy/transform/instruction.py | benSepanski/loopy | 5db582d579eb65ce58b93e2c53feb1d48404cf2d | [
"MIT"
] | null | null | null | from __future__ import division, absolute_import
__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
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, incl... | 31.366667 | 83 | 0.666721 | from __future__ import division, absolute_import
__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
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, incl... | true | true |
f731121b0a99cb58789c4b1de9a36c3004b171ee | 442 | py | Python | Inventory/views.py | DivyaKarunakaran/Inventory | ac883f087a5204832349e0fe3ed3692bc3d413c2 | [
"bzip2-1.0.6"
] | null | null | null | Inventory/views.py | DivyaKarunakaran/Inventory | ac883f087a5204832349e0fe3ed3692bc3d413c2 | [
"bzip2-1.0.6"
] | null | null | null | Inventory/views.py | DivyaKarunakaran/Inventory | ac883f087a5204832349e0fe3ed3692bc3d413c2 | [
"bzip2-1.0.6"
] | null | null | null | from django.shortcuts import render
from django.http import Http404
from Inventory.models import Item
def index(request):
items=Item.objects.exclude(amount=0)
return render(request,'Inventory/index.html',{
'items':items,})
def item_detail(request, id):
try:
item=Item.objects.get(id=id)
except Item.DoesNotExis... | 24.555556 | 53 | 0.751131 | from django.shortcuts import render
from django.http import Http404
from Inventory.models import Item
def index(request):
items=Item.objects.exclude(amount=0)
return render(request,'Inventory/index.html',{
'items':items,})
def item_detail(request, id):
try:
item=Item.objects.get(id=id)
except Item.DoesNotExis... | true | true |
f731144c606f8f088d759bd0b3022acc7a14317e | 6,296 | py | Python | ckan/lib/formatters.py | okfde/ckankrzn | df4c1ed624f6751ac2a8f03527ff19e448d27dfb | [
"Apache-2.0"
] | 4 | 2017-06-12T15:18:30.000Z | 2019-10-11T15:12:43.000Z | ckan/lib/formatters.py | okfde/ckankrzn | df4c1ed624f6751ac2a8f03527ff19e448d27dfb | [
"Apache-2.0"
] | 64 | 2017-05-14T22:15:53.000Z | 2020-03-08T15:26:49.000Z | ckan/lib/formatters.py | okfde/ckankrzn | df4c1ed624f6751ac2a8f03527ff19e448d27dfb | [
"Apache-2.0"
] | 2 | 2018-09-08T08:02:25.000Z | 2020-04-24T13:02:06.000Z | # encoding: utf-8
import datetime
import pytz
from babel import numbers
import ckan.lib.i18n as i18n
from ckan.common import _, ungettext
##################################################
# #
# Month translations #
# ... | 30.563107 | 94 | 0.560038 |
import datetime
import pytz
from babel import numbers
import ckan.lib.i18n as i18n
from ckan.common import _, ungettext
def _month_jan():
return _('January')
def _month_feb():
return _('February')
def _month_mar():
return _('March')
def _month_apr():
return _('April')
def _month_may():
... | true | true |
f731159d8d119b22890a43bc26246da1964a17db | 3,103 | py | Python | alipay/aop/api/domain/AlipayOpenMiniAmpeTracerSyncModel.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/AlipayOpenMiniAmpeTracerSyncModel.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/AlipayOpenMiniAmpeTracerSyncModel.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenMiniAmpeTracerSyncModel(object):
def __init__(self):
self._device_id = None
self._product_id = None
self._spm_a = None
self._spm_b = None
self._s... | 26.75 | 71 | 0.548179 | import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenMiniAmpeTracerSyncModel(object):
def __init__(self):
self._device_id = None
self._product_id = None
self._spm_a = None
self._spm_b = None
self._spm_c = None
self._spm_d = None
@p... | true | true |
f7311738dee08b938940c7168a1cd11f92e41b95 | 338 | py | Python | cn/opencv/chapter01/01Read.py | Jasonandy/Python-X | 2f02b9a17bd5495dd1f8746b191f11ec2d7bccbe | [
"Apache-2.0"
] | null | null | null | cn/opencv/chapter01/01Read.py | Jasonandy/Python-X | 2f02b9a17bd5495dd1f8746b191f11ec2d7bccbe | [
"Apache-2.0"
] | null | null | null | cn/opencv/chapter01/01Read.py | Jasonandy/Python-X | 2f02b9a17bd5495dd1f8746b191f11ec2d7bccbe | [
"Apache-2.0"
] | 2 | 2019-06-18T05:53:26.000Z | 2019-06-19T03:26:02.000Z | """
read picture
"""
import cv2
def read_picture(path):
"""
读取图片
:return:
"""
img = cv2.imread(path)
cv2.namedWindow("OPEN_CV_READ_IMG")
cv2.imshow("OPEN_CV_READ_IMG", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
path = "../media/lena/lena.jpg"
r... | 15.363636 | 39 | 0.615385 | import cv2
def read_picture(path):
img = cv2.imread(path)
cv2.namedWindow("OPEN_CV_READ_IMG")
cv2.imshow("OPEN_CV_READ_IMG", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
path = "../media/lena/lena.jpg"
read_picture(path)
| true | true |
f73117825794ffc13c74bb610938ec6e7e2bbad0 | 1,828 | py | Python | pymenu/elements.py | feftio/pymenu | 846b916ce55548c53f43f3642d69e6c64fd9d774 | [
"MIT"
] | null | null | null | pymenu/elements.py | feftio/pymenu | 846b916ce55548c53f43f3642d69e6c64fd9d774 | [
"MIT"
] | null | null | null | pymenu/elements.py | feftio/pymenu | 846b916ce55548c53f43f3642d69e6c64fd9d774 | [
"MIT"
] | null | null | null | from __future__ import annotations
import typing as t
from abc import ABC, abstractmethod
from pymenu.listener import GroupListener, Listener, ListenerInterface
from pymenu.triggers import Trigger
from rich import print
class ElementInterface(ListenerInterface, ABC):
@abstractmethod
def render(self) -> None:
... | 26.882353 | 131 | 0.669037 | from __future__ import annotations
import typing as t
from abc import ABC, abstractmethod
from pymenu.listener import GroupListener, Listener, ListenerInterface
from pymenu.triggers import Trigger
from rich import print
class ElementInterface(ListenerInterface, ABC):
@abstractmethod
def render(self) -> None:
... | true | true |
f7311956fa5e3a221660dc56d6dcaaef28e32f55 | 1,662 | py | Python | tests/test_calculator.py | amard33p/minimal-pytest-project | 45844a70d8c8a6499a038a6eb99bf7b7b78ccdd8 | [
"Apache-2.0"
] | 2 | 2020-12-08T14:35:19.000Z | 2022-01-18T21:35:14.000Z | tests/test_calculator.py | amard33p/minimal-pytest-project | 45844a70d8c8a6499a038a6eb99bf7b7b78ccdd8 | [
"Apache-2.0"
] | null | null | null | tests/test_calculator.py | amard33p/minimal-pytest-project | 45844a70d8c8a6499a038a6eb99bf7b7b78ccdd8 | [
"Apache-2.0"
] | 1 | 2021-09-13T12:36:32.000Z | 2021-09-13T12:36:32.000Z | import pytest
import mymath.calculator
from mymath.calculator import add, div, filesum, fileconcat, approx_eq
# Simple tests
# ----------------------------------------------------
def test_add():
assert add(1, 2) == 3
def test_div():
assert div(4, 2) == 2
assert div(0, 2) == 0
# Catching excep... | 23.742857 | 80 | 0.493983 | import pytest
import mymath.calculator
from mymath.calculator import add, div, filesum, fileconcat, approx_eq
def test_add():
assert add(1, 2) == 3
def test_div():
assert div(4, 2) == 2
assert div(0, 2) == 0
def test_div_by_zero():
with pytest.raises(ValueError) as ex:
div(1, 0)
... | true | true |
f731198351b74c2e46960cec248a5589d6459d40 | 18,893 | py | Python | redis_in_action/redis_action_ch05.py | ftconan/python3 | eb63ba33960072f792ecce6db809866b38c402f8 | [
"MIT"
] | 1 | 2018-12-19T22:07:56.000Z | 2018-12-19T22:07:56.000Z | redis_in_action/redis_action_ch05.py | ftconan/python3 | eb63ba33960072f792ecce6db809866b38c402f8 | [
"MIT"
] | 12 | 2020-03-14T05:32:26.000Z | 2022-03-12T00:08:49.000Z | redis_in_action/redis_action_ch05.py | ftconan/python3 | eb63ba33960072f792ecce6db809866b38c402f8 | [
"MIT"
] | 1 | 2018-12-19T22:08:00.000Z | 2018-12-19T22:08:00.000Z | """
@author: magician
@file: redis_action_ch05.py
@date: 2021/11/22
"""
import bisect
import contextlib
import csv
import functools
import json
import logging
import random
import threading
import time
import unittest
import uuid
import redis
from datetime import datetime
QUIT = False
SAMPLE_COUNT = 100
config_... | 27.743025 | 97 | 0.568094 | import bisect
import contextlib
import csv
import functools
import json
import logging
import random
import threading
import time
import unittest
import uuid
import redis
from datetime import datetime
QUIT = False
SAMPLE_COUNT = 100
config_connection = None
SEVERITY = {
logging.DEBUG: 'debug',
logging.INFO... | true | true |
f7311bee17a55636231d33e9456da8fd2182c8c0 | 4,311 | py | Python | benchmark/startQiskit1590.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit1590.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit1590.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=5
# total number=50
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | 32.413534 | 82 | 0.617954 | import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as nx
def build_oracle(n: int, f) -> ... | true | true |
f7311d85c66f7c08923fda4bf9edb27d6e1b385e | 305 | py | Python | data/multilingual/Latn.VMW/Serif_12/pdf_to_json_test_Latn.VMW_Serif_12.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | 1 | 2021-09-19T19:47:35.000Z | 2021-09-19T19:47:35.000Z | data/multilingual/Latn.VMW/Serif_12/pdf_to_json_test_Latn.VMW_Serif_12.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | data/multilingual/Latn.VMW/Serif_12/pdf_to_json_test_Latn.VMW_Serif_12.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.VMW/Serif_12/udhr_Latn.VMW_Serif_12.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| 30.5 | 75 | 0.813115 | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.VMW/Serif_12/udhr_Latn.VMW_Serif_12.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| true | true |
f7311e1a59e2934d6f9c806d49f878f1efa58c9f | 475 | py | Python | bootcamp/articles/migrations/0008_auto_20180321_1336.py | ngaurav/j | 99dc01f153155b287f419b7af357e1f7d694466d | [
"MIT"
] | null | null | null | bootcamp/articles/migrations/0008_auto_20180321_1336.py | ngaurav/j | 99dc01f153155b287f419b7af357e1f7d694466d | [
"MIT"
] | null | null | null | bootcamp/articles/migrations/0008_auto_20180321_1336.py | ngaurav/j | 99dc01f153155b287f419b7af357e1f7d694466d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-21 13:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0007_auto_20180113_2139'),
]
operations = [
migrations.AlterFi... | 22.619048 | 73 | 0.623158 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0007_auto_20180113_2139'),
]
operations = [
migrations.AlterField(
model_name='article',
name='slug',
... | true | true |
f7311e2ccb16402f340b2a257b71cbb087285749 | 7,221 | py | Python | XLMMacroDeobfuscator/xls_wrapper.py | wmetcalf/XLMMacroDeobfuscator | 1a854d8effb4cf5d2e02f10bbb16d58c64c1ebe8 | [
"Apache-2.0"
] | null | null | null | XLMMacroDeobfuscator/xls_wrapper.py | wmetcalf/XLMMacroDeobfuscator | 1a854d8effb4cf5d2e02f10bbb16d58c64c1ebe8 | [
"Apache-2.0"
] | null | null | null | XLMMacroDeobfuscator/xls_wrapper.py | wmetcalf/XLMMacroDeobfuscator | 1a854d8effb4cf5d2e02f10bbb16d58c64c1ebe8 | [
"Apache-2.0"
] | null | null | null | from XLMMacroDeobfuscator.excel_wrapper import ExcelWrapper
from XLMMacroDeobfuscator.boundsheet import Boundsheet
from XLMMacroDeobfuscator.boundsheet import Cell
from win32com.client import Dispatch
import pywintypes
from enum import Enum
import os
import re
class XlCellType(Enum):
xlCellTypeFormulas = -4123
... | 36.654822 | 99 | 0.568481 | from XLMMacroDeobfuscator.excel_wrapper import ExcelWrapper
from XLMMacroDeobfuscator.boundsheet import Boundsheet
from XLMMacroDeobfuscator.boundsheet import Cell
from win32com.client import Dispatch
import pywintypes
from enum import Enum
import os
import re
class XlCellType(Enum):
xlCellTypeFormulas = -4123
... | true | true |
f7311e5292fc49af1408b0183fe1700dc5f1512b | 4,995 | py | Python | .tox/scenario/lib/python2.7/site-packages/futurist/tests/test_executors.py | bdrich/neutron-lbaas | b4711abfe0207c4fdd5d7fb7ecbf017e753abbfd | [
"Apache-2.0"
] | null | null | null | .tox/scenario/lib/python2.7/site-packages/futurist/tests/test_executors.py | bdrich/neutron-lbaas | b4711abfe0207c4fdd5d7fb7ecbf017e753abbfd | [
"Apache-2.0"
] | null | null | null | .tox/scenario/lib/python2.7/site-packages/futurist/tests/test_executors.py | bdrich/neutron-lbaas | b4711abfe0207c4fdd5d7fb7ecbf017e753abbfd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 35.678571 | 79 | 0.626226 |
import time
import testscenarios
from testtools import testcase
import futurist
from futurist.tests import base
def returns_one():
return 1
def blows_up():
raise RuntimeError("no worky")
def delayed(wait_secs):
time.sleep(wait_secs)
class TestExecutors(testscenarios.TestWithScenarios, base.Test... | true | true |
f7311e8c0c66339dabaf7cf0082947fc52f84663 | 16,658 | py | Python | Website/FlaskWebsite/env/Lib/site-packages/google/protobuf/internal/type_checkers.py | amirpaia/election-campaign-dynamics | b2b32c627cb79c7eb60e458511210308b7ff4035 | [
"CC0-1.0"
] | 6 | 2022-02-04T18:12:24.000Z | 2022-03-21T23:57:12.000Z | Website/FlaskWebsite/env/Lib/site-packages/google/protobuf/internal/type_checkers.py | amirpaia/election-campaign-dynamics | b2b32c627cb79c7eb60e458511210308b7ff4035 | [
"CC0-1.0"
] | null | null | null | Website/FlaskWebsite/env/Lib/site-packages/google/protobuf/internal/type_checkers.py | amirpaia/election-campaign-dynamics | b2b32c627cb79c7eb60e458511210308b7ff4035 | [
"CC0-1.0"
] | 1 | 2022-02-08T03:53:23.000Z | 2022-02-08T03:53:23.000Z | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | 40.530414 | 81 | 0.742466 | # Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# 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 abov... | true | true |
f7311f4832eeb38d5c97a3363066842f0f43dfd1 | 3,243 | py | Python | youtube_dl/extractor/libsyn.py | MOODesign/Youtube-videos-Download | 730c0d12a06f349907481570f1f2890251f7a181 | [
"Unlicense"
] | 24 | 2017-03-17T10:27:12.000Z | 2022-02-16T05:55:50.000Z | youtube_dl/extractor/libsyn.py | MOODesign/Youtube-videos-Download | 730c0d12a06f349907481570f1f2890251f7a181 | [
"Unlicense"
] | 7 | 2017-07-26T08:15:27.000Z | 2018-09-20T12:56:53.000Z | youtube_dl/extractor/libsyn.py | MOODesign/Youtube-videos-Download | 730c0d12a06f349907481570f1f2890251f7a181 | [
"Unlicense"
] | 3 | 2017-03-17T10:27:13.000Z | 2019-01-28T01:19:17.000Z | # coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
)
class LibsynIE(InfoExtractor):
_VALID_URL = r'(?P<mainurl>https?://html5-player\.libsyn\.com/embed/episode/id/(?P<id>[0-9]+))'
_TE... | 36.852273 | 185 | 0.573235 | from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
)
class LibsynIE(InfoExtractor):
_VALID_URL = r'(?P<mainurl>https?://html5-player\.libsyn\.com/embed/episode/id/(?P<id>[0-9]+))'
_TESTS = [{
... | true | true |
f7311facdc21a3212e9fa9d8178b074821aeaa20 | 1,401 | py | Python | mediagoblin/tools/request.py | stenwt/mediagoblin-quickstart-openshift | 4a728c4b3b988c59eb9a43ad1ae1ca5edf8bc3c2 | [
"CC0-1.0"
] | 1 | 2016-02-10T18:22:42.000Z | 2016-02-10T18:22:42.000Z | mediagoblin/tools/request.py | stenwt/mediagoblin-quickstart-openshift | 4a728c4b3b988c59eb9a43ad1ae1ca5edf8bc3c2 | [
"CC0-1.0"
] | 1 | 2016-04-19T13:03:17.000Z | 2016-04-19T13:03:17.000Z | mediagoblin/tools/request.py | stenwt/mediagoblin-quickstart-openshift | 4a728c4b3b988c59eb9a43ad1ae1ca5edf8bc3c2 | [
"CC0-1.0"
] | null | null | null | # GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# 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
# the Free Software Foundation, either versio... | 35.025 | 79 | 0.723769 |
import logging
from mediagoblin.db.models import User
_log = logging.getLogger(__name__)
def setup_user_in_request(request):
if not request.session.has_key('user_id'):
request.user = None
return
request.user = User.query.get(request.session['user_id'])
if not request.user:
... | true | true |
f731200874a2e61790ea940792017eb5feadab06 | 13,142 | py | Python | survol/lib_export_json.py | rchateauneu/survol | ba66d3ec453b2d9dd3a8dabc6d53f71aa9ba8c78 | [
"BSD-3-Clause"
] | 9 | 2017-10-05T23:36:23.000Z | 2021-08-09T15:40:03.000Z | survol/lib_export_json.py | rchateauneu/survol | ba66d3ec453b2d9dd3a8dabc6d53f71aa9ba8c78 | [
"BSD-3-Clause"
] | 21 | 2018-01-02T09:33:03.000Z | 2018-08-27T11:09:52.000Z | survol/lib_export_json.py | rchateauneu/survol | ba66d3ec453b2d9dd3a8dabc6d53f71aa9ba8c78 | [
"BSD-3-Clause"
] | 4 | 2018-06-23T09:05:45.000Z | 2021-01-22T15:36:50.000Z | import sys
import six
import os
import json
import logging
import lib_kbase
import lib_patterns
import lib_naming
import lib_util
from lib_properties import pc
import lib_exports
_node_json_number = 0
class NodeJson:
"""This models a node as it will be saved to Json."""
# TODO: This creates a useless layer... | 39.465465 | 139 | 0.666489 | import sys
import six
import os
import json
import logging
import lib_kbase
import lib_patterns
import lib_naming
import lib_util
from lib_properties import pc
import lib_exports
_node_json_number = 0
class NodeJson:
def __init__(self,rdf_node):
global _node_json_number
subj_str = str(rdf_n... | true | true |
f73121b08999df30d985f558b20f79d8fc680663 | 8,052 | py | Python | ietf/group/tests_js.py | hassanakbar4/ietfdb-git | b899ee18604e878fb4133ef38cfeb6af781ce116 | [
"BSD-3-Clause"
] | null | null | null | ietf/group/tests_js.py | hassanakbar4/ietfdb-git | b899ee18604e878fb4133ef38cfeb6af781ce116 | [
"BSD-3-Clause"
] | null | null | null | ietf/group/tests_js.py | hassanakbar4/ietfdb-git | b899ee18604e878fb4133ef38cfeb6af781ce116 | [
"BSD-3-Clause"
] | 1 | 2021-10-05T12:49:27.000Z | 2021-10-05T12:49:27.000Z | # Copyright The IETF Trust 2021, All Rights Reserved
# -*- coding: utf-8 -*-
import datetime
import debug # pyflakes:ignore
from ietf.doc.factories import WgDraftFactory
from ietf.group.factories import GroupFactory, RoleFactory, DatedGroupMilestoneFactory
from ietf.utils.jstest import Ietf... | 42.603175 | 98 | 0.656607 |
import datetime
import debug
from ietf.doc.factories import WgDraftFactory
from ietf.group.factories import GroupFactory, RoleFactory, DatedGroupMilestoneFactory
from ietf.utils.jstest import IetfSeleniumTestCase, ifSeleniumEnabled, selenium_enabled
if selenium_enabled():
from selenium... | true | true |
f73122345854561a45917cbc6b8d22293f08b06b | 1,681 | py | Python | src/pygetwindow/__init__.py | EMOholcicka/PyGetWindow | 55743692fadd5faca330f1d5f9aa1b4ade20d786 | [
"BSD-3-Clause"
] | 1 | 2018-12-18T15:15:21.000Z | 2018-12-18T15:15:21.000Z | src/pygetwindow/__init__.py | EMOholcicka/PyGetWindow | 55743692fadd5faca330f1d5f9aa1b4ade20d786 | [
"BSD-3-Clause"
] | 3 | 2019-01-17T01:55:16.000Z | 2019-02-21T16:27:35.000Z | src/pygetwindow/__init__.py | EMOholcicka/PyGetWindow | 55743692fadd5faca330f1d5f9aa1b4ade20d786 | [
"BSD-3-Clause"
] | 1 | 2019-01-16T21:51:08.000Z | 2019-01-16T21:51:08.000Z | # PyGetWindow
# A cross-platform module to find information about the windows on the screen.
"""
# Work in progress
# Useful info:
#https://stackoverflow.com/questions/373020/finding-the-current-active-window-in-mac-os-x-using-python
#https://stackoverflow.com/questions/7142342/get-window-position-size-with-python
... | 33.62 | 197 | 0.766805 |
__version__ = '0.0.4'
import sys
import collections
class PyGetWindowException(Exception):
pass
def pointInRect(x, y, left, top, width, height):
return left < x < left + width and top < y < top + height
if sys.platform == 'darwin':
raise NotImplementedError('PyGetWindow currently does not support m... | true | true |
f731233587b1356960a9308c19c84399ba7b1cad | 8,353 | py | Python | manuscript/migrations/0007_auto__add_field_title_num_volumes__add_field_title_editor__add_field_t.py | adamsc64/django-manuscript | 9d17a8a93ddaa789a269dc5683b78f2be84778c1 | [
"MIT"
] | 1 | 2015-06-18T07:21:51.000Z | 2015-06-18T07:21:51.000Z | manuscript/migrations/0007_auto__add_field_title_num_volumes__add_field_title_editor__add_field_t.py | adamsc64/django-manuscript | 9d17a8a93ddaa789a269dc5683b78f2be84778c1 | [
"MIT"
] | null | null | null | manuscript/migrations/0007_auto__add_field_title_num_volumes__add_field_title_editor__add_field_t.py | adamsc64/django-manuscript | 9d17a8a93ddaa789a269dc5683b78f2be84778c1 | [
"MIT"
] | 1 | 2021-11-23T09:21:31.000Z | 2021-11-23T09:21:31.000Z | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Title.num_volumes'
db.add_column('manuscript_title', 'num_volumes', self.gf('django.db.mod... | 64.253846 | 234 | 0.600024 | import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.add_column('manuscript_title', 'num_volumes', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), kee... | true | true |
f731236ba73b3b9e12b15dec7926dc5c3b69bd93 | 1,359 | py | Python | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython | 1c4956f49fa28bad1156d8243456f8f102eeb8cb | [
"MIT"
] | null | null | null | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython | 1c4956f49fa28bad1156d8243456f8f102eeb8cb | [
"MIT"
] | null | null | null | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython | 1c4956f49fa28bad1156d8243456f8f102eeb8cb | [
"MIT"
] | null | null | null | """Main library."""
from typing import Optional
# Import module
import jpype
# Enable Java imports
import jpype.imports
# Pull in types
from jpype.types import *
import importlib
class JavaLib:
ROBOT_LIBRARY_SCOPE = "GLOBAL"
"""General library documentation."""
def __init__(
self,
lib... | 27.18 | 114 | 0.656365 |
from typing import Optional
import jpype
import jpype.imports
from jpype.types import *
import importlib
class JavaLib:
ROBOT_LIBRARY_SCOPE = "GLOBAL"
def __init__(
self,
library: str,
classpath: Optional[str] = None):
if jpype.isJVMStarted():
print("JVM runnin... | true | true |
f7312400eaec87ffea3fdf898814764925b356f6 | 2,267 | py | Python | cogs/pin.py | kdrsrt/mecha | a32047fe6bdc776cad73d95a716c7bfa8f0516ed | [
"MIT"
] | null | null | null | cogs/pin.py | kdrsrt/mecha | a32047fe6bdc776cad73d95a716c7bfa8f0516ed | [
"MIT"
] | null | null | null | cogs/pin.py | kdrsrt/mecha | a32047fe6bdc776cad73d95a716c7bfa8f0516ed | [
"MIT"
] | null | null | null | from discord.ext.commands import Cog, command
from discord import Embed, File
from discord.ext import commands
import os, discord
class Pin(Cog):
def __init__(self, bot):
self.bot = bot
self.emoji = "📌"
@Cog.listener()
async def on_raw_reaction_add(self, payload):
if p... | 44.45098 | 87 | 0.539038 | from discord.ext.commands import Cog, command
from discord import Embed, File
from discord.ext import commands
import os, discord
class Pin(Cog):
def __init__(self, bot):
self.bot = bot
self.emoji = "📌"
@Cog.listener()
async def on_raw_reaction_add(self, payload):
if p... | true | true |
f731245784b2ec4ad02c78b9de42af4e227ee2c1 | 900 | py | Python | test/test_dist.py | bachew/mollusc | 9ae0eff4455b55314c2b3fe153c51403e2affa1c | [
"MIT"
] | null | null | null | test/test_dist.py | bachew/mollusc | 9ae0eff4455b55314c2b3fe153c51403e2affa1c | [
"MIT"
] | 3 | 2017-11-20T06:46:47.000Z | 2019-12-06T07:45:59.000Z | test/test_dist.py | bachew/mollusc | 9ae0eff4455b55314c2b3fe153c51403e2affa1c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from mollusc.dist import Twine
class TestTwine(object):
def test_register_command(self):
twine = Twine(username='registrar', password='reg1strar')
assert twine.get_command('register', 'package.whl', {'-c': 'test register'}) == [
'twine',
'register',
... | 33.333333 | 105 | 0.53 | from mollusc.dist import Twine
class TestTwine(object):
def test_register_command(self):
twine = Twine(username='registrar', password='reg1strar')
assert twine.get_command('register', 'package.whl', {'-c': 'test register'}) == [
'twine',
'register',
'--repositor... | true | true |
f731257080db5facc50d1cd0d6a59693883c2335 | 107 | py | Python | slack/forms.py | pandabearcoder/pythonph | f0a1b93cd3f6234f1eb2d8eae83a8ad8b6741006 | [
"MIT"
] | 23 | 2015-02-26T04:01:02.000Z | 2021-11-09T01:48:09.000Z | slack/forms.py | pandabearcoder/pythonph | f0a1b93cd3f6234f1eb2d8eae83a8ad8b6741006 | [
"MIT"
] | 32 | 2015-04-27T14:17:16.000Z | 2022-03-11T23:12:03.000Z | slack/forms.py | pandabearcoder/pythonph | f0a1b93cd3f6234f1eb2d8eae83a8ad8b6741006 | [
"MIT"
] | 27 | 2015-02-16T17:00:18.000Z | 2022-03-29T01:01:46.000Z | from django import forms
class SlackInviteForm(forms.Form):
email = forms.EmailField(label="Email")
| 15.285714 | 43 | 0.747664 | from django import forms
class SlackInviteForm(forms.Form):
email = forms.EmailField(label="Email")
| true | true |
f73126514631ade1b408efeff6b45a1afa8ead8e | 124 | py | Python | src/opencmiss/__init__.py | rchristie/opencmiss.argon | c5cf8f313e31fc2f9d647a64ce8694cbb4f9e9cf | [
"Apache-2.0"
] | null | null | null | src/opencmiss/__init__.py | rchristie/opencmiss.argon | c5cf8f313e31fc2f9d647a64ce8694cbb4f9e9cf | [
"Apache-2.0"
] | 2 | 2016-01-15T04:17:35.000Z | 2016-02-26T04:01:02.000Z | src/opencmiss/__init__.py | rchristie/opencmiss.argon | c5cf8f313e31fc2f9d647a64ce8694cbb4f9e9cf | [
"Apache-2.0"
] | 6 | 2015-11-29T20:57:16.000Z | 2021-06-08T04:02:26.000Z |
# OpenCMISS Python package initialisation file.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 24.8 | 47 | 0.830645 |
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| true | true |
f73126570233a0b7d7357c728250600918f9ec85 | 126 | py | Python | mscreen/autodocktools_prepare_py3k/bhtree/__init__.py | e-mayo/mscreen | a50f0b2f7104007c730baa51b4ec65c891008c47 | [
"MIT"
] | 9 | 2021-03-06T04:24:28.000Z | 2022-01-03T09:53:07.000Z | bhtree/__init__.py | e-mayo/autodocktools-prepare-py3k | 2dd2316837bcb7c19384294443b2855e5ccd3e01 | [
"BSD-3-Clause"
] | 3 | 2021-03-07T05:37:16.000Z | 2021-09-19T15:06:54.000Z | bhtree/__init__.py | e-mayo/autodocktools-prepare-py3k | 2dd2316837bcb7c19384294443b2855e5ccd3e01 | [
"BSD-3-Clause"
] | 4 | 2019-08-28T23:11:39.000Z | 2021-11-27T08:43:36.000Z | from .bhtreelib import *
__MGLTOOLSVersion__ = '1-4alpha3'
CRITICAL_DEPENDENCIES = ['mglutil']
NONCRITICAL_DEPENDENCIES = []
| 21 | 35 | 0.777778 | from .bhtreelib import *
__MGLTOOLSVersion__ = '1-4alpha3'
CRITICAL_DEPENDENCIES = ['mglutil']
NONCRITICAL_DEPENDENCIES = []
| true | true |
f73126e4c01e01f20bce82c5853d0aa6eb16c032 | 656 | py | Python | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition | 9332b0d3eac59782c0e8a72078ba97d67805d512 | [
"MIT"
] | 3 | 2020-06-11T12:38:28.000Z | 2020-11-01T13:26:47.000Z | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition | 9332b0d3eac59782c0e8a72078ba97d67805d512 | [
"MIT"
] | null | null | null | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition | 9332b0d3eac59782c0e8a72078ba97d67805d512 | [
"MIT"
] | null | null | null | import time
import datetime
import numpy as np
__start_time = time.time()
__end_time = time.time()
def calc_accuracy(predicted_labels, real_labels):
correct_qty = 0
for i in range(len(predicted_labels)):
if predicted_labels[i] == real_labels[i]:
correct_qty += 1
return correct_qty * 1... | 24.296296 | 95 | 0.696646 | import time
import datetime
import numpy as np
__start_time = time.time()
__end_time = time.time()
def calc_accuracy(predicted_labels, real_labels):
correct_qty = 0
for i in range(len(predicted_labels)):
if predicted_labels[i] == real_labels[i]:
correct_qty += 1
return correct_qty * 1... | true | true |
f73127413286956e4030d84fb610da04ec29aad6 | 8,529 | py | Python | saleor/discount/models.py | dnordio/saleor | 323963748e6a2702265ec6635b930a234abde4f5 | [
"BSD-3-Clause"
] | 1 | 2019-05-02T17:24:05.000Z | 2019-05-02T17:24:05.000Z | saleor/discount/models.py | valentine217/saleor | 323963748e6a2702265ec6635b930a234abde4f5 | [
"BSD-3-Clause"
] | null | null | null | saleor/discount/models.py | valentine217/saleor | 323963748e6a2702265ec6635b930a234abde4f5 | [
"BSD-3-Clause"
] | 1 | 2019-05-23T07:30:50.000Z | 2019-05-23T07:30:50.000Z | from datetime import date
from decimal import Decimal
from functools import partial
from django.conf import settings
from django.db import models
from django.db.models import F, Q
from django.utils.translation import pgettext, pgettext_lazy
from django_countries.fields import CountryField
from django_prices.models imp... | 39.486111 | 79 | 0.663735 | from datetime import date
from decimal import Decimal
from functools import partial
from django.conf import settings
from django.db import models
from django.db.models import F, Q
from django.utils.translation import pgettext, pgettext_lazy
from django_countries.fields import CountryField
from django_prices.models imp... | true | true |
f7312755a82193a6713ea6ec20053148ab734cac | 1,585 | py | Python | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog | f956ba0199ab3fd4226806a9c1e0b3b38092c3d4 | [
"MIT"
] | null | null | null | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog | f956ba0199ab3fd4226806a9c1e0b3b38092c3d4 | [
"MIT"
] | null | null | null | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog | f956ba0199ab3fd4226806a9c1e0b3b38092c3d4 | [
"MIT"
] | null | null | null | """Added notifications
Revision ID: f0793141fd6b
Revises: 9ecc68fdc92d
Create Date: 2020-05-02 17:17:31.252794
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f0793141fd6b"
down_revision = "9ecc68fdc92d"
branch_labels = None
depends_on = None
def upgrade():
... | 31.7 | 86 | 0.666877 | from alembic import op
import sqlalchemy as sa
revision = "f0793141fd6b"
down_revision = "9ecc68fdc92d"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"notification",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=128), nulla... | true | true |
f73127aea2857de2faadcfe865b063892f3787a7 | 1,823 | py | Python | elfsample.py | TheMindVirus/pico-uf22elf | ee5d95208851e6eba4b21675cae66fdf07176d0e | [
"MIT"
] | null | null | null | elfsample.py | TheMindVirus/pico-uf22elf | ee5d95208851e6eba4b21675cae66fdf07176d0e | [
"MIT"
] | null | null | null | elfsample.py | TheMindVirus/pico-uf22elf | ee5d95208851e6eba4b21675cae66fdf07176d0e | [
"MIT"
] | null | null | null | data = b""
data += b"\x7F\x45\x4C\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
data += b"\x02\x00\x28\x00\x01\x00\x00\x00\x60\x00\x00\x00\x40\x00\x00\x00"
data += b"\xB0\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x01\x00\x28\x00"
data += b"\x04\x00\x03\x00"
data += b"\x00" * (0x40 - len(data))
data += b"\x0... | 41.431818 | 86 | 0.668129 | data = b""
data += b"\x7F\x45\x4C\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
data += b"\x02\x00\x28\x00\x01\x00\x00\x00\x60\x00\x00\x00\x40\x00\x00\x00"
data += b"\xB0\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x01\x00\x28\x00"
data += b"\x04\x00\x03\x00"
data += b"\x00" * (0x40 - len(data))
data += b"\x0... | true | true |
f731283f2aec8441075c7506a401da140cdbead6 | 20,464 | py | Python | test/functional/test_framework/test_framework.py | AtomicLemon/bitcoinflex | fe02bd48be01e08a047ef8d5821eb247a0681306 | [
"MIT"
] | null | null | null | test/functional/test_framework/test_framework.py | AtomicLemon/bitcoinflex | fe02bd48be01e08a047ef8d5821eb247a0681306 | [
"MIT"
] | null | null | null | test/functional/test_framework/test_framework.py | AtomicLemon/bitcoinflex | fe02bd48be01e08a047ef8d5821eb247a0681306 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
from enum import Enum
import logging
import optparse
import os
import p... | 42.020534 | 310 | 0.622215 |
from enum import Enum
import logging
import optparse
import os
import pdb
import shutil
import sys
import tempfile
import time
from .authproxy import JSONRPCException
from . import coverage
from .test_node import TestNode
from .util import (
MAX_NODES,
PortSeed,
assert_equal,
check_json_precision,
... | true | true |
f731292a1a4cec34ff126f57ab5b89f88bdd9de5 | 2,733 | py | Python | test/test.py | QITI/Halftones | 8d0692b88711e858a93b90941abd6cb794a592a3 | [
"OLDAP-2.6",
"Python-2.0"
] | 4 | 2020-10-11T13:36:54.000Z | 2021-10-08T07:10:03.000Z | test/test.py | QITI/Halftones | 8d0692b88711e858a93b90941abd6cb794a592a3 | [
"OLDAP-2.6",
"Python-2.0"
] | null | null | null | test/test.py | QITI/Halftones | 8d0692b88711e858a93b90941abd6cb794a592a3 | [
"OLDAP-2.6",
"Python-2.0"
] | 2 | 2019-10-04T16:54:47.000Z | 2020-05-18T13:34:17.000Z | import halftones
from scipy.misc import *
gray = imread('lena1.jpg', True)
# halftones
jarvis = halftones.halftone.error_diffusion_jarvis(gray)
floyd_steinberg = halftones.halftone.error_diffusion_floyd_steinberg(gray)
stucki = halftones.halftone.error_diffusion_stucki(gray)
burkes = halftones.halftone.error_diffusio... | 52.557692 | 101 | 0.868277 | import halftones
from scipy.misc import *
gray = imread('lena1.jpg', True)
jarvis = halftones.halftone.error_diffusion_jarvis(gray)
floyd_steinberg = halftones.halftone.error_diffusion_floyd_steinberg(gray)
stucki = halftones.halftone.error_diffusion_stucki(gray)
burkes = halftones.halftone.error_diffusion_burkes(gra... | true | true |
f7312a9191b2633265f3e838996158b974786d78 | 4,679 | py | Python | desitrip/py/desitrip/scripts/process.py | EquinoxOmega0/timedomain | 092dcda58ed380cdb41f02c1c7af33ac19c52b63 | [
"MIT"
] | 4 | 2021-02-24T15:02:35.000Z | 2022-01-18T19:24:27.000Z | desitrip/py/desitrip/scripts/process.py | MatthewPortman/timedomain | b9c6c2e6804d7dde56311d9402769be545d505d0 | [
"MIT"
] | 35 | 2020-11-06T17:51:08.000Z | 2021-10-14T01:47:16.000Z | desitrip/py/desitrip/scripts/process.py | MatthewPortman/timedomain | b9c6c2e6804d7dde56311d9402769be545d505d0 | [
"MIT"
] | 10 | 2020-03-13T20:34:15.000Z | 2021-09-23T13:35:27.000Z | #!/usr/bin/env python
"""Apply the DESITrIP CNN classifier to observed spectra,
chosen by tile ID and date.
"""
from desispec.io import read_spectra, write_spectra
from desispec.spectra import Spectra
from desitarget.cmx.cmx_targetmask import cmx_mask
from desitrip.preproc import rebin_flux, rescale_flux
from astrop... | 34.404412 | 83 | 0.674717 |
from desispec.io import read_spectra, write_spectra
from desispec.spectra import Spectra
from desitarget.cmx.cmx_targetmask import cmx_mask
from desitrip.preproc import rebin_flux, rescale_flux
from astropy.io import fits
from astropy.table import Table, vstack, hstack
from glob import glob
from datetime import dat... | true | true |
f7312aa4fd65012229519ec351624dc9f6a06ed9 | 3,060 | py | Python | ethtx_ce/backend/processors/abi_processor/balances.py | daifoundation/ethtx_ce | 5aa0de0e33f6af569e840554b024116c9a21d54b | [
"Apache-2.0"
] | 1 | 2021-07-26T11:05:24.000Z | 2021-07-26T11:05:24.000Z | ethtx_ce/backend/processors/abi_processor/balances.py | daifoundation/ethtx_ce | 5aa0de0e33f6af569e840554b024116c9a21d54b | [
"Apache-2.0"
] | null | null | null | ethtx_ce/backend/processors/abi_processor/balances.py | daifoundation/ethtx_ce | 5aa0de0e33f6af569e840554b024116c9a21d54b | [
"Apache-2.0"
] | 1 | 2021-07-26T11:05:32.000Z | 2021-07-26T11:05:32.000Z | # Copyright 2021 DAI Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 39.230769 | 88 | 0.605556 |
from collections import defaultdict
from typing import List
from .abc import ABISubmoduleAbc
from ...models.decoded_model import DecodedTransfer, DecodedBalance, AddressInfo
ZERO_ADDRESS = "0x" + 40 * "0"
class ABIBalancesDecoder(ABISubmoduleAbc):
def decode(self, transfers: List[DecodedTransfer]) -> List:
... | true | true |
f7312b9e3d53282b3517fa0a599b4e1dc17e254b | 827 | py | Python | ehome/utils/response_code.py | gavinliu4011/eHome | 2fb06a40ba7092835bd0904145086868cb9d45ed | [
"Apache-2.0"
] | 4 | 2018-07-12T11:49:05.000Z | 2020-03-23T15:14:15.000Z | ehome/utils/response_code.py | gavinliu4011/eHome | 2fb06a40ba7092835bd0904145086868cb9d45ed | [
"Apache-2.0"
] | null | null | null | ehome/utils/response_code.py | gavinliu4011/eHome | 2fb06a40ba7092835bd0904145086868cb9d45ed | [
"Apache-2.0"
] | null | null | null | class RET:
OK = '0'
DBERR = '4001'
NODATA = '4002'
DATAEXIST = '4003'
DATAERR = '4004'
SESSIONERR = '4101'
LOGINERR = '4102'
PARAMERR = '4103'
USERERR = '4104'
ROLEERR = '4105'
PWDERR = '4106'
REQERR = '4201'
IPERR = '4202'
THIRDERR = '4301'
IOERR = '4302'
... | 20.675 | 30 | 0.553809 | class RET:
OK = '0'
DBERR = '4001'
NODATA = '4002'
DATAEXIST = '4003'
DATAERR = '4004'
SESSIONERR = '4101'
LOGINERR = '4102'
PARAMERR = '4103'
USERERR = '4104'
ROLEERR = '4105'
PWDERR = '4106'
REQERR = '4201'
IPERR = '4202'
THIRDERR = '4301'
IOERR = '4302'
... | true | true |
f7312e1e9ac00ea57e3041da27b8c0ce92fd33e4 | 3,146 | py | Python | manabi/apps/books/models.py | aehlke/manabi | 1dfdd4ecb9c1214b6a70268be0dcfeda9da8754b | [
"MIT"
] | 14 | 2015-10-03T07:34:28.000Z | 2021-09-20T07:10:29.000Z | manabi/apps/books/models.py | aehlke/manabi | 1dfdd4ecb9c1214b6a70268be0dcfeda9da8754b | [
"MIT"
] | 23 | 2019-10-25T08:47:23.000Z | 2022-01-30T02:00:45.000Z | manabi/apps/books/models.py | aehlke/manabi | 1dfdd4ecb9c1214b6a70268be0dcfeda9da8754b | [
"MIT"
] | 7 | 2016-10-04T08:10:36.000Z | 2021-09-20T07:10:33.000Z | from functools import wraps
from urllib.error import URLError
from django.db import models
from django.urls import reverse
#from amazonproduct import API as AmazonAPI
from manabi.apps.utils.slugs import slugify
from django.conf import settings
#TODO-OLD find different way.
#amazon_api = AmazonAPI(settings.AWS_KEY, ... | 28.862385 | 83 | 0.608392 | from functools import wraps
from urllib.error import URLError
from django.db import models
from django.urls import reverse
from manabi.apps.utils.slugs import slugify
from django.conf import settings
class DeckedTextbookManager(models.Manager):
def get_query_set(self):
return super(DeckedTextbookManag... | true | true |
f7312ef87c220e201a4ce0da73de12af13f9c8a5 | 17,506 | py | Python | packages/python/plotly/plotly/validators/_surface.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/_surface.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/_surface.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class SurfaceValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="surface", parent_name="", **kwargs):
super(SurfaceValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | 49.451977 | 72 | 0.542214 | import _plotly_utils.basevalidators
class SurfaceValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="surface", parent_name="", **kwargs):
super(SurfaceValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | true | true |
f7312fc89ccc2c815c810940a586f246776c1fe6 | 3,700 | py | Python | tests/test_mix_mpi.py | acamero/MIP-EGO | c566bce1e12baba6bbd63bab8ade7f2ac7d08bea | [
"MIT"
] | null | null | null | tests/test_mix_mpi.py | acamero/MIP-EGO | c566bce1e12baba6bbd63bab8ade7f2ac7d08bea | [
"MIT"
] | null | null | null | tests/test_mix_mpi.py | acamero/MIP-EGO | c566bce1e12baba6bbd63bab8ade7f2ac7d08bea | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 4 15:57:47 2017
@author: wangronin
"""
import pdb
import os
import pandas as pd
from mpi4py import MPI
import numpy as np
from deap import benchmarks
from mipego import mipego
from mipego.surrogate import RrandomForest, RandomForest
from mipego.S... | 31.623932 | 83 | 0.578649 | """
Created on Fri Aug 4 15:57:47 2017
@author: wangronin
"""
import pdb
import os
import pandas as pd
from mpi4py import MPI
import numpy as np
from deap import benchmarks
from mipego import mipego
from mipego.surrogate import RrandomForest, RandomForest
from mipego.SearchSpace import ContinuousSpace, NominalSpace... | false | true |
f731303f5f0120e8733ff5fb197045d0cce54435 | 34 | py | Python | env/lib/python3.9/site-packages/spline/__init__.py | AdnanKhan27/nicstestbed | d3136e23fda8bd09706eb55d9a8c44ff0ad90730 | [
"MIT"
] | 30 | 2017-12-05T11:12:06.000Z | 2021-11-06T18:27:58.000Z | env/lib/python3.9/site-packages/spline/__init__.py | AdnanKhan27/nicstestbed | d3136e23fda8bd09706eb55d9a8c44ff0ad90730 | [
"MIT"
] | 112 | 2017-10-15T12:13:38.000Z | 2021-01-12T22:29:58.000Z | env/lib/python3.9/site-packages/spline/__init__.py | AdnanKhan27/nicstestbed | d3136e23fda8bd09706eb55d9a8c44ff0ad90730 | [
"MIT"
] | 6 | 2018-08-12T17:01:52.000Z | 2021-08-17T06:05:24.000Z | """Package tool."""
VERSION = 0.1
| 11.333333 | 19 | 0.588235 | VERSION = 0.1
| true | true |
f73130757b4a0554d8ee6445c089aeb67d3e3931 | 4,942 | py | Python | tensor_rl/agents/bandits/LinUCBAgentClass.py | umd-huang-lab/reinforcement-learning-via-spectral-methods | c7bd04d7eea6869807ed70af76960dcc542b0a82 | [
"MIT"
] | null | null | null | tensor_rl/agents/bandits/LinUCBAgentClass.py | umd-huang-lab/reinforcement-learning-via-spectral-methods | c7bd04d7eea6869807ed70af76960dcc542b0a82 | [
"MIT"
] | null | null | null | tensor_rl/agents/bandits/LinUCBAgentClass.py | umd-huang-lab/reinforcement-learning-via-spectral-methods | c7bd04d7eea6869807ed70af76960dcc542b0a82 | [
"MIT"
] | null | null | null | '''
Basic LinUCB implementation.
'''
# Python imports.
import numpy as np
from collections import defaultdict
# Other imports.
from tensor_rl.agents.AgentClass import Agent
class LinUCBAgent(Agent):
'''
From:
Lihong Li, et al. "A Contextual-Bandit Approach to Personalized
News Article Recomme... | 32.300654 | 124 | 0.581951 |
import numpy as np
from collections import defaultdict
from tensor_rl.agents.AgentClass import Agent
class LinUCBAgent(Agent):
def __init__(self, actions, name="LinUCB", rand_init=True, context_size=1, alpha=1.5):
Agent.__init__(self, name, actions)
self.alpha = alpha
self.context_size =... | true | true |
f731324a891f6c3b18ab949c169e91cd701cd440 | 4,071 | py | Python | tests/ast_parser/analyzers/test_module_analyzer.py | FredHappyface/handsdown | 097cfd5addbed22ba8ab21d4657da24459b09667 | [
"MIT"
] | 47 | 2019-10-18T13:59:20.000Z | 2022-03-21T21:46:30.000Z | tests/ast_parser/analyzers/test_module_analyzer.py | FredHappyface/handsdown | 097cfd5addbed22ba8ab21d4657da24459b09667 | [
"MIT"
] | 15 | 2019-10-24T13:42:02.000Z | 2022-03-22T19:25:49.000Z | tests/ast_parser/analyzers/test_module_analyzer.py | FredHappyface/handsdown | 097cfd5addbed22ba8ab21d4657da24459b09667 | [
"MIT"
] | 7 | 2019-11-22T12:24:57.000Z | 2022-01-29T13:18:51.000Z | # pylint: disable=missing-docstring
import unittest
from unittest.mock import MagicMock
import handsdown.ast_parser.smart_ast as ast
from handsdown.ast_parser.analyzers.module_analyzer import ModuleAnalyzer
class TestModuleAnalyzer(unittest.TestCase):
def test_init(self):
analyzer = ModuleAnalyzer()
... | 37.348624 | 73 | 0.671825 | import unittest
from unittest.mock import MagicMock
import handsdown.ast_parser.smart_ast as ast
from handsdown.ast_parser.analyzers.module_analyzer import ModuleAnalyzer
class TestModuleAnalyzer(unittest.TestCase):
def test_init(self):
analyzer = ModuleAnalyzer()
self.assertEqual(analyzer.all_na... | true | true |
f73132b3321a9a9b53f0f68a1273c7a905986331 | 18,983 | py | Python | test/generic/pointers/test_pointer_tensor.py | harshkasyap/PySyft | 4575a50f38b78728dafe2615aad9145dae17b085 | [
"Apache-2.0"
] | null | null | null | test/generic/pointers/test_pointer_tensor.py | harshkasyap/PySyft | 4575a50f38b78728dafe2615aad9145dae17b085 | [
"Apache-2.0"
] | null | null | null | test/generic/pointers/test_pointer_tensor.py | harshkasyap/PySyft | 4575a50f38b78728dafe2615aad9145dae17b085 | [
"Apache-2.0"
] | null | null | null | import torch
import torch as th
import syft
from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
from syft.frameworks.torch.tensors.interpreters.precision import FixedPrecisionTensor
from syft.generic.pointers.pointer_tensor import PointerTensor
import pytest
def test_init(wor... | 26.661517 | 95 | 0.645788 | import torch
import torch as th
import syft
from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
from syft.frameworks.torch.tensors.interpreters.precision import FixedPrecisionTensor
from syft.generic.pointers.pointer_tensor import PointerTensor
import pytest
def test_init(wor... | true | true |
f73133716abf93447f9a681574d785a552cadd2f | 877 | py | Python | setup.py | jomido/jogger | d105a5d701c7958bb5ad072af4c23477e82cd363 | [
"MIT"
] | 6 | 2015-08-06T00:54:48.000Z | 2022-02-03T13:55:33.000Z | setup.py | jomido/jogger | d105a5d701c7958bb5ad072af4c23477e82cd363 | [
"MIT"
] | null | null | null | setup.py | jomido/jogger | d105a5d701c7958bb5ad072af4c23477e82cd363 | [
"MIT"
] | 1 | 2015-05-19T11:45:34.000Z | 2015-05-19T11:45:34.000Z | from setuptools import setup, find_packages
setup(
name='jogger',
version='0.1.1',
description='Navigate log files.',
long_description=(
open('README.md').read()
),
url='http://github.com/jomido/jogger/',
license='MIT',
author='Jonathan Dobson',
author_email='jon.m.dobson@gm... | 29.233333 | 54 | 0.586089 | from setuptools import setup, find_packages
setup(
name='jogger',
version='0.1.1',
description='Navigate log files.',
long_description=(
open('README.md').read()
),
url='http://github.com/jomido/jogger/',
license='MIT',
author='Jonathan Dobson',
author_email='jon.m.dobson@gm... | true | true |
f73134a89fd7d8c446480e1eb914cc01383bee8e | 4,859 | py | Python | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 2 | 2021-11-03T06:10:36.000Z | 2021-12-01T06:29:39.000Z | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 1 | 2021-12-18T20:01:22.000Z | 2021-12-18T20:01:22.000Z | # 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 may ... | 46.27619 | 191 | 0.686149 | from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.cor... | true | true |
f73134cfd4c3af902e244125da2780eb7d8fee85 | 16,270 | py | Python | libgoods/libgoods/noaa_coops.py | NOAA-ORR-ERD/GnomeTools | a9ff592bd9c7ed098f6081367aa35eae525c9774 | [
"Unlicense"
] | 2 | 2017-02-15T20:45:42.000Z | 2020-10-09T16:00:00.000Z | libgoods/libgoods/noaa_coops.py | NOAA-ORR-ERD/GnomeTools | a9ff592bd9c7ed098f6081367aa35eae525c9774 | [
"Unlicense"
] | 10 | 2015-06-25T23:42:11.000Z | 2021-06-22T16:19:19.000Z | libgoods/libgoods/noaa_coops.py | NOAA-ORR-ERD/GnomeTools | a9ff592bd9c7ed098f6081367aa35eae525c9774 | [
"Unlicense"
] | 15 | 2016-01-11T20:49:10.000Z | 2020-10-15T18:02:20.000Z | #!/usr/bin/env python
from __future__ import print_function
import datetime
try:
from urllib.request import urlopen, Request #py3
except ImportError:
from urllib2 import urlopen, Request #py2
import requests
from netCDF4 import Dataset
import os, glob
'''
Methods for generating ordered filelist for... | 42.041344 | 544 | 0.631776 | from __future__ import print_function
import datetime
try:
from urllib.request import urlopen, Request except ImportError:
from urllib2 import urlopen, Request
import requests
from netCDF4 import Dataset
import os, glob
# The node values were determined by plotting grid, they
# are not ... | true | true |
f73135263aa5d42f8ba22ba5ad4466b2c6a05dc0 | 2,549 | py | Python | python2/koans/about_modules.py | rameshugar/koans | 35f2407dac045040bfd54ebe9f95ce77fd8a1b23 | [
"MIT"
] | null | null | null | python2/koans/about_modules.py | rameshugar/koans | 35f2407dac045040bfd54ebe9f95ce77fd8a1b23 | [
"MIT"
] | null | null | null | python2/koans/about_modules.py | rameshugar/koans | 35f2407dac045040bfd54ebe9f95ce77fd8a1b23 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is very different to AboutModules in Ruby Koans
# Our AboutMultipleInheritance class is a little more comparable
#
from runner.koan import *
from another_local_module import *
from local_module_with_all_defined import *
class AboutModules(Koan):
def test_i... | 32.265823 | 83 | 0.673597 |
from runner.koan import *
from another_local_module import *
from local_module_with_all_defined import *
class AboutModules(Koan):
def test_importing_other_python_scripts_as_modules(self):
import local_module
duck = local_module.Duck()
self.assertEqual("Daffy", duck.name)
def tes... | true | true |
f7313861d3e6c67d85bfeb4b43faf3df2789455b | 8,380 | py | Python | data/torch_151_data/sampler.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | 1 | 2018-12-09T06:09:29.000Z | 2018-12-09T06:09:29.000Z | data/torch_151_data/sampler.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | data/torch_151_data/sampler.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | import torch
from torch._six import int_classes as _int_classes
class Sampler(object):
r"""Base class for all Samplers.
Every Sampler subclass has to provide an :meth:`__iter__` method, providing a
way to iterate over indices of dataset elements, and a :meth:`__len__` method
that returns the length o... | 39.342723 | 100 | 0.631742 | import torch
from torch._six import int_classes as _int_classes
class Sampler(object):
def __init__(self, data_source):
pass
def __iter__(self):
raise NotImplementedError
class Sequenti... | true | true |
f73138dea25be614ca8fc1cc6c899fbfc0321a36 | 6,537 | py | Python | car_client.py | wangbiao0327/car | 2632de357107beeb240b330f20ec5ac5fb568beb | [
"MIT"
] | 1 | 2018-12-18T10:58:34.000Z | 2018-12-18T10:58:34.000Z | car_client.py | wangbiao0327/car | 2632de357107beeb240b330f20ec5ac5fb568beb | [
"MIT"
] | null | null | null | car_client.py | wangbiao0327/car | 2632de357107beeb240b330f20ec5ac5fb568beb | [
"MIT"
] | null | null | null | """
此模块做停车管理系统的客户端
Author:Recall
Date: 2018-10-19
module: socket、multiprocessing、sys、os、time、signal
Email:
"""
from socket import *
from setting import *
from messageAff import user_message
from multiprocessing import Process
import sys,os,time,signal
class carClient(object):
def __init__(self):
self.so... | 28.176724 | 120 | 0.528224 |
from socket import *
from setting import *
from messageAff import user_message
from multiprocessing import Process
import sys,os,time,signal
class carClient(object):
def __init__(self):
self.sockfd = socket(AF_INET,SOCK_STREAM)
self.sockfd.connect(ADDR)
self.mes = user_message()
s... | true | true |
f73138feb9a7f803855bf63268835f5d0728508e | 4,019 | py | Python | ubicacion/migrations/0004_auto_20180426_1619.py | jlopez0591/SIGIA | e857e2273daa43ab64fa78df254275af2dbcc2a5 | [
"MIT"
] | null | null | null | ubicacion/migrations/0004_auto_20180426_1619.py | jlopez0591/SIGIA | e857e2273daa43ab64fa78df254275af2dbcc2a5 | [
"MIT"
] | 7 | 2020-02-12T00:42:15.000Z | 2022-03-11T23:23:48.000Z | ubicacion/migrations/0004_auto_20180426_1619.py | jlopez0591/SIGIA | e857e2273daa43ab64fa78df254275af2dbcc2a5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-04-26 21:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('ubicacion', '0003_auto_20180417_1603'),
]
operations =... | 34.646552 | 89 | 0.591689 | from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('ubicacion', '0003_auto_20180417_1603'),
]
operations = [
migrations.AddField(
model_name='carrera',
... | true | true |
f73139736d7eeb275bd78656e3b4701fb97eabe7 | 4,427 | py | Python | azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/usage_operations.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/usage_operations.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/usage_operations.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2019-06-17T22:18:23.000Z | 2019-06-17T22:18:23.000Z | # 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 ... | 40.990741 | 144 | 0.630901 |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class UsageOperations(object):
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializ... | true | true |
f7313beb6b36e0b6947bf44f357978b77188d33a | 4,841 | py | Python | radish/extensions/syslog_writer.py | tuxrosi/radish | b21fa751f8dfc4309451476151c810b44975babb | [
"MIT"
] | null | null | null | radish/extensions/syslog_writer.py | tuxrosi/radish | b21fa751f8dfc4309451476151c810b44975babb | [
"MIT"
] | null | null | null | radish/extensions/syslog_writer.py | tuxrosi/radish | b21fa751f8dfc4309451476151c810b44975babb | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
This module provides an extension to write all features, scenarios and steps to the syslog.
"""
from __future__ import unicode_literals
from radish.terrain import world
from radish.feature import Feature
from radish.hookregistry import before, after
from radish.extensionregistry impor... | 29.339394 | 95 | 0.567445 |
from __future__ import unicode_literals
from radish.terrain import world
from radish.feature import Feature
from radish.hookregistry import before, after
from radish.extensionregistry import extension
@extension
class SyslogWriter(object):
OPTIONS = [
("--syslog", "log all of your features, scenarios,... | true | true |
f7313bfac29687bff5e8a360d2fdc2e1ee3e5a5f | 1,447 | py | Python | setup_guide/migrations/0005_auto_20180327_1341.py | uktrade/invest | 15b84c511839b46e81608fca9762d2df3f6df16c | [
"MIT"
] | 1 | 2019-01-18T03:50:46.000Z | 2019-01-18T03:50:46.000Z | setup_guide/migrations/0005_auto_20180327_1341.py | uktrade/invest | 15b84c511839b46e81608fca9762d2df3f6df16c | [
"MIT"
] | 50 | 2018-01-24T18:04:08.000Z | 2019-01-03T03:30:30.000Z | setup_guide/migrations/0005_auto_20180327_1341.py | uktrade/invest | 15b84c511839b46e81608fca9762d2df3f6df16c | [
"MIT"
] | 2 | 2018-02-12T15:20:52.000Z | 2019-01-18T03:51:52.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-27 13:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('setup_guide', '0004_auto_20180322_1443'),
]
operations = [
migrations.RenameField(... | 28.372549 | 51 | 0.580511 | from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('setup_guide', '0004_auto_20180322_1443'),
]
operations = [
migrations.RenameField(
model_name='setupguidelandingpage',
old_name='hea... | true | true |
f7313c2994502b974b95d44f22df74068b470940 | 81,610 | py | Python | dask/array/routines.py | leogao2/dask | 4e5dfe7463028a39a90e026c7fb9220969093ab3 | [
"BSD-3-Clause"
] | null | null | null | dask/array/routines.py | leogao2/dask | 4e5dfe7463028a39a90e026c7fb9220969093ab3 | [
"BSD-3-Clause"
] | null | null | null | dask/array/routines.py | leogao2/dask | 4e5dfe7463028a39a90e026c7fb9220969093ab3 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import annotations
import math
import warnings
from collections.abc import Iterable
from functools import partial, reduce, wraps
from numbers import Integral, Real
import numpy as np
from tlz import concat, interleave, sliding_window
from dask.array import chunk
from dask.array.core import (
Arra... | 32.167915 | 112 | 0.609962 | from __future__ import annotations
import math
import warnings
from collections.abc import Iterable
from functools import partial, reduce, wraps
from numbers import Integral, Real
import numpy as np
from tlz import concat, interleave, sliding_window
from dask.array import chunk
from dask.array.core import (
Arra... | true | true |
f7313e3ab3e8fc56b748beb5452013bcc48f9018 | 1,982 | py | Python | lifegame.py | cuboktahedron/Rascon | 7f754434424c6a0b5f61c96c33c5d2c4acf04a4c | [
"MIT"
] | null | null | null | lifegame.py | cuboktahedron/Rascon | 7f754434424c6a0b5f61c96c33c5d2c4acf04a4c | [
"MIT"
] | null | null | null | lifegame.py | cuboktahedron/Rascon | 7f754434424c6a0b5f61c96c33c5d2c4acf04a4c | [
"MIT"
] | null | null | null | import copy
from datetime import datetime
class LifeGame:
def __init__(self, width, height):
self.__width = width
self.__height = height
self.__cells = [[False for x in range(0, width)] for y in range(0, height)]
self.__fps = 2
self._next_ts = datetime.now().timesta... | 30.492308 | 95 | 0.519173 | import copy
from datetime import datetime
class LifeGame:
def __init__(self, width, height):
self.__width = width
self.__height = height
self.__cells = [[False for x in range(0, width)] for y in range(0, height)]
self.__fps = 2
self._next_ts = datetime.now().timesta... | true | true |
f7313e94c331bb92c55fd8f8212ee3abca3087ee | 4,287 | py | Python | dockermon.py | CyberInt/dockermon | a8733b9395cb1b551971f17c31d7f4a8268bb969 | [
"MIT"
] | 10 | 2015-06-27T06:06:01.000Z | 2021-02-15T04:04:02.000Z | dockermon.py | CyberInt/dockermon | a8733b9395cb1b551971f17c31d7f4a8268bb969 | [
"MIT"
] | 2 | 2015-08-09T14:10:25.000Z | 2016-05-14T09:25:43.000Z | dockermon.py | CyberInt/dockermon | a8733b9395cb1b551971f17c31d7f4a8268bb969 | [
"MIT"
] | 7 | 2016-02-03T03:24:09.000Z | 2021-02-15T04:08:40.000Z | #!/usr/bin/env python
"""docker monitor using docker /events HTTP streaming API"""
from contextlib import closing
from functools import partial
from socket import socket, AF_UNIX
from subprocess import Popen, PIPE
from sys import stdout, version_info
import json
import shlex
if version_info[:2] < (3, 0):
from htt... | 28.203947 | 77 | 0.601586 |
from contextlib import closing
from functools import partial
from socket import socket, AF_UNIX
from subprocess import Popen, PIPE
from sys import stdout, version_info
import json
import shlex
if version_info[:2] < (3, 0):
from httplib import OK as HTTP_OK
from urlparse import urlparse
else:
from http.cli... | true | true |
f7313f100d4294fe5183c05e8c3ad109ceb0c790 | 16,944 | py | Python | pandas/tests/indexes/ranges/test_range.py | mujtahidalam/pandas | 526468c8fe6fc5157aaf2fce327c5ab2a3350f49 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2021-06-17T12:54:33.000Z | 2021-06-17T12:54:33.000Z | pandas/tests/indexes/ranges/test_range.py | mujtahidalam/pandas | 526468c8fe6fc5157aaf2fce327c5ab2a3350f49 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/tests/indexes/ranges/test_range.py | mujtahidalam/pandas | 526468c8fe6fc5157aaf2fce327c5ab2a3350f49 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | import numpy as np
import pytest
from pandas.core.dtypes.common import ensure_platform_int
import pandas as pd
from pandas import (
Float64Index,
Index,
Int64Index,
RangeIndex,
)
import pandas._testing as tm
from pandas.tests.indexes.test_numeric import Numeric
# aliases to make some tests easier to ... | 31.61194 | 86 | 0.578435 | import numpy as np
import pytest
from pandas.core.dtypes.common import ensure_platform_int
import pandas as pd
from pandas import (
Float64Index,
Index,
Int64Index,
RangeIndex,
)
import pandas._testing as tm
from pandas.tests.indexes.test_numeric import Numeric
RI = RangeIndex
I64 = Int64Index
F64 = ... | true | true |
f7313ff228df6f15c217111d85289fbb96c16a6e | 7,086 | py | Python | rpython/translator/backendopt/test/test_merge_if_blocks.py | nanjekyejoannah/pypy | e80079fe13c29eda7b2a6b4cd4557051f975a2d9 | [
"Apache-2.0",
"OpenSSL"
] | 381 | 2018-08-18T03:37:22.000Z | 2022-02-06T23:57:36.000Z | rpython/translator/backendopt/test/test_merge_if_blocks.py | nanjekyejoannah/pypy | e80079fe13c29eda7b2a6b4cd4557051f975a2d9 | [
"Apache-2.0",
"OpenSSL"
] | 16 | 2018-09-22T18:12:47.000Z | 2022-02-22T20:03:59.000Z | rpython/translator/backendopt/test/test_merge_if_blocks.py | nanjekyejoannah/pypy | e80079fe13c29eda7b2a6b4cd4557051f975a2d9 | [
"Apache-2.0",
"OpenSSL"
] | 55 | 2015-08-16T02:41:30.000Z | 2022-03-20T20:33:35.000Z | from rpython.translator.backendopt.merge_if_blocks import merge_if_blocks_once
from rpython.translator.backendopt.merge_if_blocks import merge_if_blocks
from rpython.translator.backendopt.all import backend_optimizations
from rpython.translator.translator import TranslationContext, graphof as tgraphof
from rpython.flow... | 27.788235 | 81 | 0.576348 | from rpython.translator.backendopt.merge_if_blocks import merge_if_blocks_once
from rpython.translator.backendopt.merge_if_blocks import merge_if_blocks
from rpython.translator.backendopt.all import backend_optimizations
from rpython.translator.translator import TranslationContext, graphof as tgraphof
from rpython.flow... | true | true |
f7313ffd9372f0396f475d8a1a68661916b500ec | 796 | py | Python | leetcode/Algorithms/107.BinaryTreeLevelOrderTraversalII/Solution.py | liupangzi/codekata | 079373707601198f79fb6215b876a4cbcab32ee9 | [
"MIT"
] | 58 | 2017-04-30T12:59:37.000Z | 2020-08-05T14:23:57.000Z | leetcode/Algorithms/107.BinaryTreeLevelOrderTraversalII/Solution.py | liupangzi/codekata | 079373707601198f79fb6215b876a4cbcab32ee9 | [
"MIT"
] | null | null | null | leetcode/Algorithms/107.BinaryTreeLevelOrderTraversalII/Solution.py | liupangzi/codekata | 079373707601198f79fb6215b876a4cbcab32ee9 | [
"MIT"
] | 6 | 2018-01-20T18:35:09.000Z | 2020-07-22T14:20:27.000Z | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def levelOrderBottom(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
... | 24.121212 | 54 | 0.520101 |
class Solution(object):
def levelOrderBottom(self, root):
if not root:
return []
result = [[]]
self.helper(result, root, 0)
result.reverse()
return result
def helper(self, result, root, level):
if len(result) == level:
result.append([roo... | true | true |
f7314057a11eff7d520a32457c96935f97b70271 | 24,185 | py | Python | backend/lib/sites/facebook.py | kavish-p/youtube-search-dashboard | 2810b0d098699f11086868f9d754e0cb6194d6ff | [
"MIT"
] | 1 | 2021-03-26T05:19:48.000Z | 2021-03-26T05:19:48.000Z | chat_downloader/sites/facebook.py | lbmaian/chat-replay-downloader | 0f1b1326eec9fb45031d7fd58e0a4a9dd2297d5d | [
"MIT"
] | null | null | null | chat_downloader/sites/facebook.py | lbmaian/chat-replay-downloader | 0f1b1326eec9fb45031d7fd58e0a4a9dd2297d5d | [
"MIT"
] | null | null | null | import json
from json.decoder import JSONDecodeError
import xml.etree.ElementTree as ET
import isodate
import re
from .common import (
Chat,
BaseChatDownloader,
Remapper as r
)
from requests.exceptions import RequestException
from ..utils import (
remove_prefixes,
multi_get,
try_get_first_val... | 31.697248 | 119 | 0.557081 | import json
from json.decoder import JSONDecodeError
import xml.etree.ElementTree as ET
import isodate
import re
from .common import (
Chat,
BaseChatDownloader,
Remapper as r
)
from requests.exceptions import RequestException
from ..utils import (
remove_prefixes,
multi_get,
try_get_first_val... | true | true |
f73140c2dd100d80311a5c5ccca1e3c3caf4075d | 3,746 | py | Python | postcode_validator_uk/rules.py | ioannavlahou/postcode-validator-uk | e43b2919a7d7e940ae072b24ab5d07587e8e3df8 | [
"MIT"
] | 4 | 2020-02-08T15:02:00.000Z | 2020-11-22T19:35:11.000Z | postcode_validator_uk/rules.py | ioannavlahou/postcode-validator-uk | e43b2919a7d7e940ae072b24ab5d07587e8e3df8 | [
"MIT"
] | 8 | 2021-06-23T12:36:40.000Z | 2021-12-21T11:26:27.000Z | postcode_validator_uk/rules.py | ioannavlahou/postcode-validator-uk | e43b2919a7d7e940ae072b24ab5d07587e8e3df8 | [
"MIT"
] | 2 | 2020-12-04T10:47:07.000Z | 2021-06-08T20:45:45.000Z | import re
from .exceptions import InvalidPostcode
class PostcodeRule:
attr_applied = None
applied_areas_regex = None
rule_regex = None
def __init__(self, postcode):
self.postcode = postcode
def validate(self):
postcode_attr_value = getattr(self.postcode, self.attr_applied, None)... | 32.017094 | 109 | 0.626535 | import re
from .exceptions import InvalidPostcode
class PostcodeRule:
attr_applied = None
applied_areas_regex = None
rule_regex = None
def __init__(self, postcode):
self.postcode = postcode
def validate(self):
postcode_attr_value = getattr(self.postcode, self.attr_applied, None)... | true | true |
f73140d48b7cc619133309d7e0b2c6781efb1c0a | 9,038 | py | Python | twentyfortyeight/strategy/nn/data.py | ggould256/twentyfortyeight | 7d2b88023077ba4c64b65617d493039c0a9998c3 | [
"MIT"
] | null | null | null | twentyfortyeight/strategy/nn/data.py | ggould256/twentyfortyeight | 7d2b88023077ba4c64b65617d493039c0a9998c3 | [
"MIT"
] | null | null | null | twentyfortyeight/strategy/nn/data.py | ggould256/twentyfortyeight | 7d2b88023077ba4c64b65617d493039c0a9998c3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""Classes and functions related to dataset generation for learning Q
functions. Datasets in this sense are mappings from board positions
(represented as flattened arrays of tile numbers) to score values.
"""
import argparse
import sys
import numpy as np
from game.common import *
from game.b... | 39.99115 | 80 | 0.610423 |
import argparse
import sys
import numpy as np
from game.common import *
from game.board import Board
from game.game import Game
EXAMPLE_WIDTH = Board.vector_width()
MAX_BATCH_SIZE = 4096
class Dataset(object):
def __init__(self):
self._num_examples = 0
self._example_batches = [np.zeros((0, E... | true | true |
f73142a10b36c905718b48cfe342e39d8d3f7c7d | 1,963 | py | Python | setup.py | Tibieson/pyueye | 67b316b69b49bc29151a11e61ce1ea70432513e9 | [
"BSD-3-Clause"
] | 4 | 2016-06-07T10:09:12.000Z | 2019-11-27T01:10:46.000Z | setup.py | Tibieson/pyueye | 67b316b69b49bc29151a11e61ce1ea70432513e9 | [
"BSD-3-Clause"
] | 1 | 2017-06-27T10:17:37.000Z | 2017-06-27T10:17:37.000Z | setup.py | Tibieson/pyueye | 67b316b69b49bc29151a11e61ce1ea70432513e9 | [
"BSD-3-Clause"
] | 3 | 2017-02-15T06:59:39.000Z | 2020-09-29T09:57:13.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, stat, commands
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
try:
from Cython.Distutils import build_ext
except:
print "You don't seem to have Cython installed. Please get a"
print... | 29.742424 | 94 | 0.629139 |
import sys, os, stat, commands
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
try:
from Cython.Distutils import build_ext
except:
print "You don't seem to have Cython installed. Please get a"
print "copy from www.cython.org and install it"
... | false | true |
f73142a29e58f8c444562a3781b8fbaa6e06ccc2 | 2,085 | py | Python | scout/server/blueprints/institutes/controllers.py | gmc-norr/scout | ea8eaaa079c63e4033af6216ec08da4a314f9b5c | [
"BSD-3-Clause"
] | null | null | null | scout/server/blueprints/institutes/controllers.py | gmc-norr/scout | ea8eaaa079c63e4033af6216ec08da4a314f9b5c | [
"BSD-3-Clause"
] | null | null | null | scout/server/blueprints/institutes/controllers.py | gmc-norr/scout | ea8eaaa079c63e4033af6216ec08da4a314f9b5c | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import logging
LOG = logging.getLogger(__name__)
def institute(store, institute_id):
""" Process institute data.
Args:
store(adapter.MongoAdapter)
institute_id(str)
Returns
data(dict): includes institute obj and specific settings
"""
institute_ob... | 27.8 | 76 | 0.664748 | import logging
LOG = logging.getLogger(__name__)
def institute(store, institute_id):
institute_obj = store.institute(institute_id)
users = store.users(institute_id)
data = {"institute": institute_obj, "users": users}
return data
def update_institute_settings(store, institute_obj, form):
sange... | true | true |
f731432c913f3ccfd7e302c02503a7537510ff9a | 2,720 | py | Python | pipenv/vendor/pythonfinder/models/windows.py | Enzime/pipenv | d4f710be4a39e09a82a5133b7b3a277ee9bfb13a | [
"MIT"
] | null | null | null | pipenv/vendor/pythonfinder/models/windows.py | Enzime/pipenv | d4f710be4a39e09a82a5133b7b3a277ee9bfb13a | [
"MIT"
] | null | null | null | pipenv/vendor/pythonfinder/models/windows.py | Enzime/pipenv | d4f710be4a39e09a82a5133b7b3a277ee9bfb13a | [
"MIT"
] | 1 | 2021-07-03T03:30:45.000Z | 2021-07-03T03:30:45.000Z | # -*- coding=utf-8 -*-
from __future__ import print_function, absolute_import
import attr
import operator
from collections import defaultdict
from . import BaseFinder
from .path import PathEntry
from .python import PythonVersion, VersionMap
from ..exceptions import InvalidPythonVersion
from ..utils import ensure_path
... | 31.627907 | 88 | 0.608088 | from __future__ import print_function, absolute_import
import attr
import operator
from collections import defaultdict
from . import BaseFinder
from .path import PathEntry
from .python import PythonVersion, VersionMap
from ..exceptions import InvalidPythonVersion
from ..utils import ensure_path
@attr.s
class WindowsF... | true | true |
f73143b9c73994a32651383e17bb04174dee2b85 | 915 | py | Python | python/test/test_volume.py | adriangonz/seldon-deploy-sdk | c5504838630a87053387cec57ec2e1e7251971e2 | [
"Apache-2.0"
] | 6 | 2021-02-18T14:37:54.000Z | 2022-01-13T13:27:43.000Z | python/test/test_volume.py | adriangonz/seldon-deploy-sdk | c5504838630a87053387cec57ec2e1e7251971e2 | [
"Apache-2.0"
] | 14 | 2021-01-04T16:32:03.000Z | 2021-12-13T17:53:59.000Z | python/test/test_volume.py | adriangonz/seldon-deploy-sdk | c5504838630a87053387cec57ec2e1e7251971e2 | [
"Apache-2.0"
] | 7 | 2021-03-17T09:05:55.000Z | 2022-01-05T10:39:56.000Z | # coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future... | 22.317073 | 122 | 0.700546 |
from __future__ import absolute_import
import unittest
import seldon_deploy_sdk
from seldon_deploy_sdk.models.volume import Volume from seldon_deploy_sdk.rest import ApiException
class TestVolume(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testVolume(sel... | true | true |
f73143ec8bc29c71a9b4d763b26b580bba6673cb | 3,254 | py | Python | logging/cloud-client/snippets.py | alexhaines123/googlecloudsqlexamples | 06d9254ec77955c02f18cd79a57cdfbd64dbf8ea | [
"Apache-2.0"
] | 2 | 2017-09-23T04:23:46.000Z | 2021-06-11T01:23:06.000Z | logging/cloud-client/snippets.py | ryanmats/python-docs-samples | 183a6186cd059c7ba24ef324614bc5fee08bff08 | [
"Apache-2.0"
] | null | null | null | logging/cloud-client/snippets.py | ryanmats/python-docs-samples | 183a6186cd059c7ba24ef324614bc5fee08bff08 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | 30.411215 | 77 | 0.69791 |
import argparse
from gcloud import logging
def write_entry(logger_name):
logging_client = logging.Client()
logger = logging_client.logger(logger_name)
logger.log_text('Hello, world!')
logger.log_text('Goodbye, world!', severity='ERROR')
logger.log_struct({
'name': '... | true | true |
f73146cc31c2e9c1cdcb0e154acdd7af261b22a1 | 10,702 | py | Python | backbone/model_audio.py | rtu715/NAS-Bench-360 | d075006848c664371855c34082b0a00cda62be67 | [
"MIT"
] | 10 | 2021-06-15T17:48:34.000Z | 2022-02-23T18:34:28.000Z | backbone/model_audio.py | rtu715/NAS-Bench-360 | d075006848c664371855c34082b0a00cda62be67 | [
"MIT"
] | 1 | 2021-11-12T15:12:38.000Z | 2021-11-12T19:38:00.000Z | backbone/model_audio.py | rtu715/NAS-Bench-360 | d075006848c664371855c34082b0a00cda62be67 | [
"MIT"
] | 1 | 2021-11-15T04:07:17.000Z | 2021-11-15T04:07:17.000Z | '''
Determined model def example:
https://github.com/determined-ai/determined/tree/master/examples/computer_vision/cifar10_pytorch
'''
import tempfile
from typing import Any, Dict, Sequence, Tuple, Union, cast
from functools import partial
import os
import boto3
import numpy as np
from sklearn.metrics import average_p... | 37.289199 | 167 | 0.594749 | import tempfile
from typing import Any, Dict, Sequence, Tuple, Union, cast
from functools import partial
import os
import boto3
import numpy as np
from sklearn.metrics import average_precision_score
import torch
from torch import nn
from determined.pytorch import DataLoader, PyTorchTrial, PyTorchTrialContext, LRSche... | true | true |
f73148848e36430282de1201af2441bcc49e6a9f | 43,486 | py | Python | utils/jsonrpc.py | wanghm92/graph-2-text | 050e56b059cb25e1223e54aeec180e8e8fba9637 | [
"MIT"
] | 149 | 2018-10-24T21:39:44.000Z | 2022-01-27T15:47:48.000Z | utils/jsonrpc.py | wanghm92/graph-2-text | 050e56b059cb25e1223e54aeec180e8e8fba9637 | [
"MIT"
] | 12 | 2018-12-09T01:06:52.000Z | 2021-02-19T10:48:40.000Z | utils/jsonrpc.py | wanghm92/graph-2-text | 050e56b059cb25e1223e54aeec180e8e8fba9637 | [
"MIT"
] | 32 | 2018-10-25T00:52:12.000Z | 2021-12-07T15:24:03.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
JSON-RPC (remote procedure call).
It consists of 3 (independent) parts:
- proxy/dispatcher
- data structure / serializer
- transport
It's intended for JSON-RPC, but since the above 3 parts are independent,
it could be used for other RPCs as well.
Current... | 40.339518 | 139 | 0.577128 |
"""
JSON-RPC (remote procedure call).
It consists of 3 (independent) parts:
- proxy/dispatcher
- data structure / serializer
- transport
It's intended for JSON-RPC, but since the above 3 parts are independent,
it could be used for other RPCs as well.
Currently, JSON-RPC 2.0(pre) and JSON-RPC 1.0 are imp... | false | true |
f731498360202437e8db6137f9cfaad521cd7f82 | 5,286 | py | Python | music_extractor.py | reeechart/ricommender | c5cdf1cb9db27b9fc4a2553aee2b705b9ad0b95a | [
"MIT"
] | null | null | null | music_extractor.py | reeechart/ricommender | c5cdf1cb9db27b9fc4a2553aee2b705b9ad0b95a | [
"MIT"
] | null | null | null | music_extractor.py | reeechart/ricommender | c5cdf1cb9db27b9fc4a2553aee2b705b9ad0b95a | [
"MIT"
] | null | null | null | import csv
import eyed3
import librosa
import numpy as np
import sys
def load_editorial_metadata(audiofile):
'''Loads an audio file and extract its editorial metadata
Args:
audiofile (string): audio file to be extracted.
Returns:
title (string): title of the mp3 file
artist (strin... | 30.034091 | 120 | 0.64756 | import csv
import eyed3
import librosa
import numpy as np
import sys
def load_editorial_metadata(audiofile):
audio = eyed3.load(audiofile)
return audio.tag.title, audio.tag.artist, audio.tag.album
def get_reformatted_music_file_directory(file):
splitted_dir = file.split('\\')
directory = '/'.join(sp... | true | true |
f73149a9f7e2ac7a2e62263f32e4418400e4b260 | 2,624 | py | Python | src/old_code/utils_old.py | basarane/model-based-rl | af7ba84c272054d1de0b8cf9cc91b571abe91c3d | [
"MIT"
] | null | null | null | src/old_code/utils_old.py | basarane/model-based-rl | af7ba84c272054d1de0b8cf9cc91b571abe91c3d | [
"MIT"
] | null | null | null | src/old_code/utils_old.py | basarane/model-based-rl | af7ba84c272054d1de0b8cf9cc91b571abe91c3d | [
"MIT"
] | null | null | null | import keras.backend as K
import numpy as np
from PIL import Image, ImageDraw
def get_activations(model, model_inputs, print_shape_only=False, layer_name=None):
print('----- activations -----')
activations = []
inp = model.input
model_multi_inputs_cond = True
if not isinstance(inp, list):
# only one input! let... | 32 | 156 | 0.726372 | import keras.backend as K
import numpy as np
from PIL import Image, ImageDraw
def get_activations(model, model_inputs, print_shape_only=False, layer_name=None):
print('----- activations -----')
activations = []
inp = model.input
model_multi_inputs_cond = True
if not isinstance(inp, list):
inp = [inp]
model... | true | true |
f73149c06418dfdcc2ccc576f2c8e8c48e6bdbd1 | 1,157 | py | Python | saleor/graphql/page/schema.py | acabezasg/urpi-master | 7c9cd0fbe6d89dad70652482712ca38b21ba6f84 | [
"BSD-3-Clause"
] | 1 | 2019-04-15T09:37:26.000Z | 2019-04-15T09:37:26.000Z | saleor/graphql/page/schema.py | acabezasg/urpi-master | 7c9cd0fbe6d89dad70652482712ca38b21ba6f84 | [
"BSD-3-Clause"
] | 5 | 2021-03-09T16:22:37.000Z | 2022-02-10T19:10:03.000Z | saleor/graphql/page/schema.py | acabezasg/urpi-master | 7c9cd0fbe6d89dad70652482712ca38b21ba6f84 | [
"BSD-3-Clause"
] | 1 | 2020-12-26T10:25:37.000Z | 2020-12-26T10:25:37.000Z | import graphene
from ..core.fields import PrefetchingConnectionField
from ..descriptions import DESCRIPTIONS
from ..translations.mutations import PageTranslate
from .bulk_mutations import PageBulkDelete
from .mutations import PageCreate, PageDelete, PageUpdate
from .resolvers import resolve_page, resolve_pages
from .t... | 34.029412 | 72 | 0.736387 | import graphene
from ..core.fields import PrefetchingConnectionField
from ..descriptions import DESCRIPTIONS
from ..translations.mutations import PageTranslate
from .bulk_mutations import PageBulkDelete
from .mutations import PageCreate, PageDelete, PageUpdate
from .resolvers import resolve_page, resolve_pages
from .t... | true | true |
f73149da213043c623eaf8c02ac1225d022f99d9 | 69,506 | py | Python | server/datasets/tcga/constants.py | imwangtongxue-com/digital_slide_archive | 3c08432bf3ca192d8948cbe22a263c2259c542d5 | [
"Apache-2.0"
] | null | null | null | server/datasets/tcga/constants.py | imwangtongxue-com/digital_slide_archive | 3c08432bf3ca192d8948cbe22a263c2259c542d5 | [
"Apache-2.0"
] | null | null | null | server/datasets/tcga/constants.py | imwangtongxue-com/digital_slide_archive | 3c08432bf3ca192d8948cbe22a263c2259c542d5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | 73.087277 | 131 | 0.609473 |
class TcgaCodes(object):
DISEASE_STUDIES = {
'LAML': 'Acute Myeloid Leukemia',
'ACC': 'Adrenocortical carcinoma',
'BLCA': 'Bladder Urothelial Carcinoma',
'LGG': 'Brain Lower Grade Glioma',
'BRCA': 'Breast invasive carcinoma',
'CESC': 'Cervical squamous ce... | true | true |
f7314a0e4e81b092e4ad4e0a58faca277e3f6357 | 482 | py | Python | measurements/read-ds18b20.py | jazik/raspberry-pi-cottage | c82885db7b265b96e7c1126a0f7af89602cd72d5 | [
"MIT"
] | null | null | null | measurements/read-ds18b20.py | jazik/raspberry-pi-cottage | c82885db7b265b96e7c1126a0f7af89602cd72d5 | [
"MIT"
] | null | null | null | measurements/read-ds18b20.py | jazik/raspberry-pi-cottage | c82885db7b265b96e7c1126a0f7af89602cd72d5 | [
"MIT"
] | null | null | null | #!/usr/bin/python
import sys
from w1thermsensor import W1ThermSensor
if len(sys.argv) == 2:
sensor_id = sys.argv[1]
else:
print('usage: sudo ' + sys.argv[0] + ' <sensor id>')
print('example: sudo ' + sys.argv[0] + ' 00000588806a - Read from an DS18B20 wiht id 00000588806a')
sys.exit(1)
sensor = W1The... | 28.352941 | 103 | 0.715768 |
import sys
from w1thermsensor import W1ThermSensor
if len(sys.argv) == 2:
sensor_id = sys.argv[1]
else:
print('usage: sudo ' + sys.argv[0] + ' <sensor id>')
print('example: sudo ' + sys.argv[0] + ' 00000588806a - Read from an DS18B20 wiht id 00000588806a')
sys.exit(1)
sensor = W1ThermSensor(W1ThermSe... | true | true |
f7314a6598cc9d802c8a25965be8b5c7206c8fd3 | 9,663 | py | Python | contrib/bitrpc/bitrpc.py | dev-x0/genesis-x | 7000c60241e5403b2201338cfcfa1a2c6b0453d0 | [
"MIT"
] | 15 | 2018-06-01T17:06:02.000Z | 2020-11-14T10:24:36.000Z | contrib/bitrpc/bitrpc.py | dev-x0/genesis-x | 7000c60241e5403b2201338cfcfa1a2c6b0453d0 | [
"MIT"
] | null | null | null | contrib/bitrpc/bitrpc.py | dev-x0/genesis-x | 7000c60241e5403b2201338cfcfa1a2c6b0453d0 | [
"MIT"
] | 15 | 2018-06-26T09:47:48.000Z | 2021-12-22T06:32:57.000Z | from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:6666")
e... | 28.588757 | 101 | 0.573424 | from jsonrpc import ServiceProxy
import sys
import string
import getpass
rpcuser = ""
rpcpass = ""
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:6666")
else:
access = ServiceProxy("http://"+rpcuser+":"+rpcpass+"@127.0.0.1:6666")
cmd = sys.argv[1].lower()
if cmd == "backupwallet":
try:
... | false | true |
f7314b6028b09e35ddb4a9b228cfb6aadcb1d26a | 939 | py | Python | dwi_ml/models/utils/fisher_von_mises.py | EmmaRenauld/dwi_ml | f2f776199dd886509d15520aa68099a8c870a233 | [
"MIT"
] | null | null | null | dwi_ml/models/utils/fisher_von_mises.py | EmmaRenauld/dwi_ml | f2f776199dd886509d15520aa68099a8c870a233 | [
"MIT"
] | null | null | null | dwi_ml/models/utils/fisher_von_mises.py | EmmaRenauld/dwi_ml | f2f776199dd886509d15520aa68099a8c870a233 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import numpy as np
import torch
"""
The complete formulas and explanations are available in our doc:
https://dwi-ml.readthedocs.io/en/latest/formulas.html
"""
def fisher_von_mises_log_prob_vector(mus, kappa, targets):
log_c = np.log(kappa) - np.log(2 * np.pi) - np.log(np.exp(kappa) -
... | 29.34375 | 78 | 0.644302 |
import numpy as np
import torch
def fisher_von_mises_log_prob_vector(mus, kappa, targets):
log_c = np.log(kappa) - np.log(2 * np.pi) - np.log(np.exp(kappa) -
np.exp(-kappa))
log_prob = log_c + (kappa * (mus * targets).sum(axis=-1))
return log_prob
... | true | true |
f7314ba8e10dd03e076c71b94e712ad4b4b62c44 | 664 | py | Python | docs/src/additional_responses/tutorial004.py | patrickmckenna/fastapi | 9c3c9b6e78768374868d690bc05918d58481e880 | [
"MIT"
] | 2 | 2020-11-01T00:04:05.000Z | 2021-07-21T06:32:20.000Z | docs/src/additional_responses/tutorial004.py | patrickmckenna/fastapi | 9c3c9b6e78768374868d690bc05918d58481e880 | [
"MIT"
] | 1 | 2019-11-02T22:03:59.000Z | 2019-11-02T22:03:59.000Z | docs/src/additional_responses/tutorial004.py | patrickmckenna/fastapi | 9c3c9b6e78768374868d690bc05918d58481e880 | [
"MIT"
] | 1 | 2020-12-19T18:01:20.000Z | 2020-12-19T18:01:20.000Z | from fastapi import FastAPI
from pydantic import BaseModel
from starlette.responses import FileResponse
class Item(BaseModel):
id: str
value: str
responses = {
404: {"description": "Item not found"},
302: {"description": "The item was moved"},
403: {"description": "Not enough privileges"},
}
a... | 21.419355 | 65 | 0.637048 | from fastapi import FastAPI
from pydantic import BaseModel
from starlette.responses import FileResponse
class Item(BaseModel):
id: str
value: str
responses = {
404: {"description": "Item not found"},
302: {"description": "The item was moved"},
403: {"description": "Not enough privileges"},
}
a... | true | true |
f7314be85e0d5c52d7bd7dba9f799e44ab8fed6b | 138 | py | Python | Fango/accounts/apps.py | Niemzok/fango | 37484a11e8bfffb0f6fe451b74501e0ad825b215 | [
"MIT"
] | null | null | null | Fango/accounts/apps.py | Niemzok/fango | 37484a11e8bfffb0f6fe451b74501e0ad825b215 | [
"MIT"
] | null | null | null | Fango/accounts/apps.py | Niemzok/fango | 37484a11e8bfffb0f6fe451b74501e0ad825b215 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'Fango.accounts'
| 17.25 | 39 | 0.797101 | from __future__ import unicode_literals
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'Fango.accounts'
| true | true |
f7314cf1f7f6c192548e293ee5dab1afb019d2fc | 13,083 | py | Python | examples/annotation.py | quattro/numpyro | b7b6e937297ea47c55760446134f84fc82936a9d | [
"Apache-2.0"
] | null | null | null | examples/annotation.py | quattro/numpyro | b7b6e937297ea47c55760446134f84fc82936a9d | [
"Apache-2.0"
] | null | null | null | examples/annotation.py | quattro/numpyro | b7b6e937297ea47c55760446134f84fc82936a9d | [
"Apache-2.0"
] | null | null | null | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
Example: Bayesian Models of Annotation
======================================
In this example, we run MCMC for various crowdsourced annotation models in [1].
All models have discrete latent variables. Under the hood, we enumerate... | 37.38 | 90 | 0.591072 |
import argparse
import os
import numpy as np
from jax import nn, random, vmap
import jax.numpy as jnp
import numpyro
from numpyro import handlers
from numpyro.contrib.indexing import Vindex
import numpyro.distributions as dist
from numpyro.infer import MCMC, NUTS, Predictive
from numpyro.infer.reparam import LocSc... | true | true |
f7314e8a496b92d9bd05e6902788e7b9a672b0dc | 11,218 | py | Python | plugins/sqlfluff-templater-dbt/test/templater_test.py | WittierDinosaur/sqlfluff | edc4a2c47cd4f0a5f53dbde36e50da19ec08dda7 | [
"MIT"
] | null | null | null | plugins/sqlfluff-templater-dbt/test/templater_test.py | WittierDinosaur/sqlfluff | edc4a2c47cd4f0a5f53dbde36e50da19ec08dda7 | [
"MIT"
] | null | null | null | plugins/sqlfluff-templater-dbt/test/templater_test.py | WittierDinosaur/sqlfluff | edc4a2c47cd4f0a5f53dbde36e50da19ec08dda7 | [
"MIT"
] | null | null | null | """Tests for the dbt templater."""
import glob
import os
import pytest
import logging
from pathlib import Path
from sqlfluff.core import FluffConfig, Lexer, Linter
from sqlfluff.core.errors import SQLTemplaterSkipFile
from test.fixtures.dbt.templater import ( # noqa: F401
DBT_FLUFF_CONFIG,
dbt_templater,
... | 35.5 | 115 | 0.639151 |
import glob
import os
import pytest
import logging
from pathlib import Path
from sqlfluff.core import FluffConfig, Lexer, Linter
from sqlfluff.core.errors import SQLTemplaterSkipFile
from test.fixtures.dbt.templater import ( DBT_FLUFF_CONFIG,
dbt_templater,
project_dir,
)
def test__templater_dbt_missin... | true | true |
f7314e8b65485bdd5e00c5546138536c89f6ad88 | 819 | py | Python | classy_config/_util.py | fisher60/classy-config | abc8016f9fef328b1410ede75833429b05e20e1a | [
"MIT"
] | 7 | 2022-01-04T20:24:53.000Z | 2022-02-21T19:31:57.000Z | classy_config/_util.py | fisher60/classy-config | abc8016f9fef328b1410ede75833429b05e20e1a | [
"MIT"
] | 13 | 2022-01-04T18:53:08.000Z | 2022-02-25T11:01:29.000Z | classy_config/_util.py | fisher60/classy-config | abc8016f9fef328b1410ede75833429b05e20e1a | [
"MIT"
] | 1 | 2022-02-14T22:06:11.000Z | 2022-02-14T22:06:11.000Z | from typing import Any, MutableMapping, Optional
def merge_dicts(a: MutableMapping[str, Any], b: MutableMapping[str, Any], path: Optional[list] = None) -> MutableMapping[str, Any]:
"""
Merge the keys and values of the two dicts.
:param a:
:param b:
:param path:
:return:
:raises ValueError... | 26.419355 | 131 | 0.566545 | from typing import Any, MutableMapping, Optional
def merge_dicts(a: MutableMapping[str, Any], b: MutableMapping[str, Any], path: Optional[list] = None) -> MutableMapping[str, Any]:
if path is None:
path = []
for key in b:
if key not in a:
a[key] = b[key]
continue
... | true | true |
f7314ef4fe1b0652cfdde116056e0cf2ca53f56b | 1,996 | py | Python | naoqi-sdk-2.5.5.5-linux64/doc/_downloads/vision_getandsaveimage.py | applejenny66/docker_pepper | 2469cc4db6585161a31ac44c8fcf2605d71318b1 | [
"MIT"
] | null | null | null | naoqi-sdk-2.5.5.5-linux64/doc/_downloads/vision_getandsaveimage.py | applejenny66/docker_pepper | 2469cc4db6585161a31ac44c8fcf2605d71318b1 | [
"MIT"
] | null | null | null | naoqi-sdk-2.5.5.5-linux64/doc/_downloads/vision_getandsaveimage.py | applejenny66/docker_pepper | 2469cc4db6585161a31ac44c8fcf2605d71318b1 | [
"MIT"
] | 1 | 2020-10-06T07:44:12.000Z | 2020-10-06T07:44:12.000Z | #! /usr/bin/env python
# -*- encoding: UTF-8 -*-
"""Example: Get an image. Display it and save it using PIL."""
import qi
import argparse
import sys
import time
import Image
def main(session):
"""
First get an image, then show it on the screen with PIL.
"""
# Get the service ALVideoDevice.
vide... | 27.342466 | 98 | 0.629259 |
"""Example: Get an image. Display it and save it using PIL."""
import qi
import argparse
import sys
import time
import Image
def main(session):
"""
First get an image, then show it on the screen with PIL.
"""
video_service = session.service("ALVideoDevice")
resolution = 2 colorSpace ... | false | true |
f7314f70d97443e5927a361c54120beae4e4b7f5 | 9,594 | py | Python | cinder/common/config.py | rackerlabs/cinder | 4295ff0a64f781c3546f6c6e0816dbb8100133cb | [
"Apache-2.0"
] | null | null | null | cinder/common/config.py | rackerlabs/cinder | 4295ff0a64f781c3546f6c6e0816dbb8100133cb | [
"Apache-2.0"
] | null | null | null | cinder/common/config.py | rackerlabs/cinder | 4295ff0a64f781c3546f6c6e0816dbb8100133cb | [
"Apache-2.0"
] | null | null | null | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
# Copyright 2013 NTT corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file exc... | 43.808219 | 79 | 0.595164 |
import socket
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import netutils
from cinder.i18n import _
CONF = cfg.CONF
logging.register_options(CONF)
core_opts = [
cfg.StrOpt('api_paste_config',
default="api-paste.ini",
help='File name for the pa... | true | true |
f7314f8b974c2b54dbcb6c11c5211b6c0d1d666e | 3,340 | py | Python | muranoclient/v1/services.py | mail2nsrajesh/python-muranoclient | 08411aa8d20993ac7c4a52b2aa0e73fb6fea4d40 | [
"Apache-2.0"
] | 27 | 2015-04-26T16:05:29.000Z | 2021-01-28T03:31:57.000Z | muranoclient/v1/services.py | mail2nsrajesh/python-muranoclient | 08411aa8d20993ac7c4a52b2aa0e73fb6fea4d40 | [
"Apache-2.0"
] | null | null | null | muranoclient/v1/services.py | mail2nsrajesh/python-muranoclient | 08411aa8d20993ac7c4a52b2aa0e73fb6fea4d40 | [
"Apache-2.0"
] | 14 | 2015-06-12T05:37:50.000Z | 2019-05-02T20:37:42.000Z | # Copyright (c) 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 32.745098 | 79 | 0.613473 |
import functools
import posixpath
from muranoclient.common import base
def normalize_path(f):
@functools.wraps(f)
def f_normalize_path(*args, **kwargs):
path = args[2] if len(args) >= 3 else kwargs['path']
if not posixpath.isabs(path):
raise ValueError("Parameter 'path' ... | true | true |
f7314fe04d0a36817a1cc7e4b30f2ff6ab6dfec8 | 871 | py | Python | conflowgen/tests/domain_models/distribution_model_seeder/test_container_weight_distribution_seeder.py | bbargstaedt/conflowgen | b5b5c0e2df8a605d23ef467aaa3e88aa463a34ee | [
"MIT"
] | 5 | 2022-02-16T11:44:42.000Z | 2022-02-24T20:02:17.000Z | conflowgen/tests/domain_models/distribution_model_seeder/test_container_weight_distribution_seeder.py | bbargstaedt/conflowgen | b5b5c0e2df8a605d23ef467aaa3e88aa463a34ee | [
"MIT"
] | 90 | 2021-12-08T14:05:44.000Z | 2022-03-24T08:53:31.000Z | conflowgen/tests/domain_models/distribution_model_seeder/test_container_weight_distribution_seeder.py | bbargstaedt/conflowgen | b5b5c0e2df8a605d23ef467aaa3e88aa463a34ee | [
"MIT"
] | 5 | 2021-12-07T16:05:15.000Z | 2022-02-16T08:24:07.000Z | """
Check if container weights can be properly seeded.
"""
import unittest
from conflowgen.domain_models.distribution_models.container_weight_distribution import ContainerWeightDistribution
from conflowgen.domain_models.distribution_seeders import container_weight_distribution_seeder
from conflowgen.tests.substitute_... | 32.259259 | 114 | 0.766935 |
import unittest
from conflowgen.domain_models.distribution_models.container_weight_distribution import ContainerWeightDistribution
from conflowgen.domain_models.distribution_seeders import container_weight_distribution_seeder
from conflowgen.tests.substitute_peewee_database import setup_sqlite_in_memory_db
class Te... | true | true |
f73150728d21634b3692b32fa17efb6464b8c3ef | 2,110 | py | Python | download_paper.py | xiangze/CSpaperTopicViewer | f98bfc3d8771b50448867b15b723ab6af8e6d321 | [
"WTFPL"
] | 1 | 2016-07-10T23:51:12.000Z | 2016-07-10T23:51:12.000Z | download_paper.py | xiangze/cvprpapers | f98bfc3d8771b50448867b15b723ab6af8e6d321 | [
"WTFPL"
] | null | null | null | download_paper.py | xiangze/cvprpapers | f98bfc3d8771b50448867b15b723ab6af8e6d321 | [
"WTFPL"
] | 1 | 2016-08-02T06:34:37.000Z | 2016-08-02T06:34:37.000Z | import httplib2
from bs4 import BeautifulSoup, SoupStrainer
import urllib.request, urllib.error
import os
import re
import sys
def get(url):
http = httplib2.Http(".cache", disable_ssl_certificate_validation=True)
status, response = http.request(url)
return response
def getlinks(url):
return Beautiful... | 27.402597 | 83 | 0.658768 | import httplib2
from bs4 import BeautifulSoup, SoupStrainer
import urllib.request, urllib.error
import os
import re
import sys
def get(url):
http = httplib2.Http(".cache", disable_ssl_certificate_validation=True)
status, response = http.request(url)
return response
def getlinks(url):
return Beautiful... | true | true |
f731507f3bd50184b1ccba6b19d2e6c5da0c828a | 2,096 | py | Python | 2018/picoCTF_2018/Cryptography/SpyFi/manual_soln_for_spyfi.py | solomonbstoner/solomonbston3r-ctf-diary | 2eb5439b157ca0c97db313c9762c6b5d8a714a85 | [
"Unlicense"
] | 14 | 2018-04-01T00:52:42.000Z | 2020-07-11T06:17:49.000Z | 2018/picoCTF_2018/Cryptography/SpyFi/manual_soln_for_spyfi.py | solomonbstoner/solomonbston3r-ctf-diary | 2eb5439b157ca0c97db313c9762c6b5d8a714a85 | [
"Unlicense"
] | 5 | 2018-04-03T00:40:58.000Z | 2021-06-02T13:37:43.000Z | 2018/picoCTF_2018/Cryptography/SpyFi/manual_soln_for_spyfi.py | solomonbstoner/solomonbston3r-ctf-diary | 2eb5439b157ca0c97db313c9762c6b5d8a714a85 | [
"Unlicense"
] | null | null | null | # This exploit script is my first. I have to manually change the paddings before and after the input to get the desired chosen plaintext. I created it to understand how desired chosen plaintext attack works. See automatic_soln_for_spyfi.py for the automatic solution.
from pwn import *
padding_before = "A" * 11
paddin... | 30.823529 | 267 | 0.756202 |
from pwn import *
padding_before = "A" * 11
padding_after = "A" * 11
cipher = ''
for char_to_test in range(33,127):
p = remote('2018shell2.picoctf.com', 34490)
p.clean()
p.recvuntil('report:')
str_to_test = "c00l3$t_5168610" + chr(char_to_test)
bruteforce_str = padding_before + str_to_test + padding_after
... | false | true |
f73150e76382b56bfc3f89148efd010e1fe93f98 | 1,332 | py | Python | utils/logquant_v1.py | listato/Logarithmic-Quantization-of-Parameters-in-Neural-Networks | dbc6a48ab5e0bf4361be459a45598523f2344371 | [
"MIT"
] | 1 | 2022-02-04T10:39:54.000Z | 2022-02-04T10:39:54.000Z | utils/logquant_v1.py | listato/Logarithmic-Quantization-of-Parameters-in-Neural-Networks | dbc6a48ab5e0bf4361be459a45598523f2344371 | [
"MIT"
] | null | null | null | utils/logquant_v1.py | listato/Logarithmic-Quantization-of-Parameters-in-Neural-Networks | dbc6a48ab5e0bf4361be459a45598523f2344371 | [
"MIT"
] | null | null | null | """
Author: CAI JINGYONG @ BeatCraft, Inc & Tokyo University of Agriculture and Technology
placeholder
input: numpy array
output: numpy array
"""
import numpy
class LogQuant:
def __init__(self,layer,bitwidth):
self.layer_data = layer
self.width = bitwidth
self.maxima = numpy.amax(layer)
... | 26.64 | 90 | 0.583333 | import numpy
class LogQuant:
def __init__(self,layer,bitwidth):
self.layer_data = layer
self.width = bitwidth
self.maxima = numpy.amax(layer)
self.minima = numpy.amin(layer)
self.fsr = self.maxima - self.minima
self.sign = numpy.sign(layer)
pass
def __cl... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.