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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f719b1a74f416ee6980e89aaf0546a68140e9287 | 14,523 | py | Python | nova/virt/fake.py | bopopescu/nova-29 | 3b8957a5f9656884ecb14755516097c049a18f67 | [
"Apache-2.0"
] | null | null | null | nova/virt/fake.py | bopopescu/nova-29 | 3b8957a5f9656884ecb14755516097c049a18f67 | [
"Apache-2.0"
] | null | null | null | nova/virt/fake.py | bopopescu/nova-29 | 3b8957a5f9656884ecb14755516097c049a18f67 | [
"Apache-2.0"
] | 1 | 2020-07-24T07:27:49.000Z | 2020-07-24T07:27:49.000Z | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you m... | 32.783296 | 79 | 0.6111 |
"""
A fake (in-memory) hypervisor+api.
Allows nova testing w/o a hypervisor. This module also documents the
semantics of real hypervisor connections.
"""
from nova.compute import power_state
from nova.compute import task_states
from nova import db
from nova import exception
from nova.openstack.common import log a... | false | true |
f719b22b9c5885616b30cc4050c5cf2de4e5b710 | 1,553 | py | Python | services/storage/tests/helpers/utils_assert.py | colinRawlings/osparc-simcore | bf2f18d5bc1e574d5f4c238d08ad15156184c310 | [
"MIT"
] | 25 | 2018-04-13T12:44:12.000Z | 2022-03-12T15:01:17.000Z | services/storage/tests/helpers/utils_assert.py | colinRawlings/osparc-simcore | bf2f18d5bc1e574d5f4c238d08ad15156184c310 | [
"MIT"
] | 2,553 | 2018-01-18T17:11:55.000Z | 2022-03-31T16:26:40.000Z | services/storage/tests/helpers/utils_assert.py | mrnicegyu11/osparc-simcore | b6fa6c245dbfbc18cc74a387111a52de9b05d1f4 | [
"MIT"
] | 20 | 2018-01-18T19:45:33.000Z | 2022-03-29T07:08:47.000Z | from pprint import pformat
from aiohttp import web
from servicelib.aiohttp.rest_responses import unwrap_envelope
async def assert_status(
response: web.Response, expected_cls: web.HTTPException, expected_msg: str = None
):
data, error = unwrap_envelope(await response.json())
assert (
response.st... | 28.759259 | 100 | 0.701223 | from pprint import pformat
from aiohttp import web
from servicelib.aiohttp.rest_responses import unwrap_envelope
async def assert_status(
response: web.Response, expected_cls: web.HTTPException, expected_msg: str = None
):
data, error = unwrap_envelope(await response.json())
assert (
response.st... | true | true |
f719b29d98e47c2ec8027200215ed81276adcb8f | 11,098 | py | Python | core/externals/update-engine/externals/gdata-objectivec-client/Source/Tests/GDataTestHTTPServer.py | tuxera/macfuse_with_externals | 96df0e71824f37332c65a9465d55e9966e67be7d | [
"AML"
] | 1 | 2017-11-25T18:56:35.000Z | 2017-11-25T18:56:35.000Z | core/externals/update-engine/externals/gdata-objectivec-client/Source/Tests/GDataTestHTTPServer.py | tuxera/macfuse_with_externals | 96df0e71824f37332c65a9465d55e9966e67be7d | [
"AML"
] | null | null | null | core/externals/update-engine/externals/gdata-objectivec-client/Source/Tests/GDataTestHTTPServer.py | tuxera/macfuse_with_externals | 96df0e71824f37332c65a9465d55e9966e67be7d | [
"AML"
] | null | null | null | #!/usr/bin/python
#
# 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
# ... | 36.149837 | 80 | 0.656785 |
"""A simple server for testing the Objective-C GData Framework
This http server is for use by GDataServiceTest.m in testing
both authentication and object retrieval.
Requests to the path /accounts/ClientLogin are assumed to be
for login; other requests are for object retrieval
"""
import string
import cgi
import ti... | false | true |
f719b3cf4408be63834d8d778dce83c706005a42 | 2,919 | py | Python | python/src/ties/util/version.py | Noblis/ties-lib | e7c6165ebcd80e11b792fd4bcddf6ce634da0c60 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2020-04-10T19:02:27.000Z | 2020-04-10T19:02:27.000Z | python/src/ties/util/version.py | Noblis/ties-lib | e7c6165ebcd80e11b792fd4bcddf6ce634da0c60 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | python/src/ties/util/version.py | Noblis/ties-lib | e7c6165ebcd80e11b792fd4bcddf6ce634da0c60 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | ################################################################################
# Copyright 2019 Noblis, Inc #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); ... | 39.445946 | 84 | 0.528606 |
import argparse
from os.path import abspath, isfile
from pkg_resources import resource_filename
class VersionAction(argparse.Action):
def __init__(self, option_strings, dest, version=None, **kwargs):
kwargs['nargs'] = 0
self._version = version
super(VersionAction, self).__init__(option_s... | true | true |
f719b481bbf26bf74e10817f58f02d7b6a184525 | 905 | py | Python | packages/pyre/xml/ElementDescriptor.py | PyreFramework/pyre | 345c7449a3416eea1c1affa74fb32faff30a6aaa | [
"BSD-3-Clause"
] | null | null | null | packages/pyre/xml/ElementDescriptor.py | PyreFramework/pyre | 345c7449a3416eea1c1affa74fb32faff30a6aaa | [
"BSD-3-Clause"
] | null | null | null | packages/pyre/xml/ElementDescriptor.py | PyreFramework/pyre | 345c7449a3416eea1c1affa74fb32faff30a6aaa | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2022 all rights reserved
#
from .Descriptor import Descriptor
class ElementDescriptor(Descriptor):
"""
Descriptor class that gathers all the metadata about a document tag that was provided by
the user during the DTD declaration. It... | 25.857143 | 94 | 0.693923 |
from .Descriptor import Descriptor
class ElementDescriptor(Descriptor):
handler = None attributes = ()
def __init__(self, *, tag, handler, root=False):
super().__init__(name=tag)
self.handler = handler
self.root = root
return
| true | true |
f719b4bd078cf626a5dea79e89509d44970085fe | 1,812 | py | Python | pliers/tests/extractors/api/test_clarifai_extractors.py | adelavega/pliers | dee21102689c77a56b7da48bf9a0ac10c90be0eb | [
"BSD-3-Clause"
] | null | null | null | pliers/tests/extractors/api/test_clarifai_extractors.py | adelavega/pliers | dee21102689c77a56b7da48bf9a0ac10c90be0eb | [
"BSD-3-Clause"
] | null | null | null | pliers/tests/extractors/api/test_clarifai_extractors.py | adelavega/pliers | dee21102689c77a56b7da48bf9a0ac10c90be0eb | [
"BSD-3-Clause"
] | null | null | null | from os.path import join
from ...utils import get_test_data_path
from pliers.extractors import ClarifaiAPIExtractor
from pliers.stimuli import ImageStim
from pliers.extractors.base import merge_results
import numpy as np
import pytest
@pytest.mark.skipif("'CLARIFAI_API_KEY' not in os.environ")
def test_clarifai_api_e... | 38.553191 | 75 | 0.711921 | from os.path import join
from ...utils import get_test_data_path
from pliers.extractors import ClarifaiAPIExtractor
from pliers.stimuli import ImageStim
from pliers.extractors.base import merge_results
import numpy as np
import pytest
@pytest.mark.skipif("'CLARIFAI_API_KEY' not in os.environ")
def test_clarifai_api_e... | true | true |
f719b4dc7ae13b6947c48e17f17fc0bd12e5e231 | 23,805 | py | Python | src/opendr/perception/object_tracking_2d/fair_mot/object_tracking_2d_fair_mot_learner.py | makistsantekidis/opendr | 07dee3b59d3487b9c5a93d6946317178a02c9890 | [
"Apache-2.0"
] | 3 | 2021-06-24T01:54:25.000Z | 2021-12-12T16:21:24.000Z | src/opendr/perception/object_tracking_2d/fair_mot/object_tracking_2d_fair_mot_learner.py | makistsantekidis/opendr | 07dee3b59d3487b9c5a93d6946317178a02c9890 | [
"Apache-2.0"
] | 79 | 2021-06-23T10:40:10.000Z | 2021-12-16T07:59:42.000Z | src/opendr/perception/object_tracking_2d/fair_mot/object_tracking_2d_fair_mot_learner.py | makistsantekidis/opendr | 07dee3b59d3487b9c5a93d6946317178a02c9890 | [
"Apache-2.0"
] | 5 | 2021-07-04T07:38:50.000Z | 2021-12-12T16:18:47.000Z | # Copyright 2020-2021 OpenDR European Project
#
# 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 agree... | 34.650655 | 117 | 0.585003 |
import os
import json
import torch
import ntpath
import shutil
import numpy as np
import onnxruntime as ort
from torchvision.transforms import transforms as T
from opendr.engine.learners import Learner
from opendr.engine.datasets import DatasetIterator, ExternalDataset, MappedDatasetIterator
from opendr.perception.obj... | true | true |
f719b58aacd4b24349689985096bc6a158cb01c2 | 2,736 | py | Python | tests/crawler/media/test_bcc.py | allenyummy/GoodInfo | 94ab7421d1377450ac4cfdfd6e4667fa52b20d0c | [
"MIT"
] | 1 | 2022-01-17T14:06:27.000Z | 2022-01-17T14:06:27.000Z | tests/crawler/media/test_bcc.py | allenyummy/GoodInfo | 94ab7421d1377450ac4cfdfd6e4667fa52b20d0c | [
"MIT"
] | 9 | 2021-08-12T07:39:01.000Z | 2021-08-20T08:38:29.000Z | tests/crawler/media/test_bcc.py | allenyummy/GoodInfo | 94ab7421d1377450ac4cfdfd6e4667fa52b20d0c | [
"MIT"
] | 1 | 2022-02-21T15:45:13.000Z | 2022-02-21T15:45:13.000Z | # encoding=utf-8
# Author: Yu-Lun Chiang
# Description: Test NewsCrawler
import logging
import pytest
from collections import namedtuple
from src.crawler.media import bcc
from src.utils.struct import NewsStruct
logger = logging.getLogger(__name__)
TEST_DATA = namedtuple(
typename="TEST_DATA",
field_names=[
... | 36 | 652 | 0.69883 |
import logging
import pytest
from collections import namedtuple
from src.crawler.media import bcc
from src.utils.struct import NewsStruct
logger = logging.getLogger(__name__)
TEST_DATA = namedtuple(
typename="TEST_DATA",
field_names=[
"name",
"link",
"expected_output",
],
)
TEST... | true | true |
f719b5a93057ca90d71d3ce08000892efc53327a | 659 | py | Python | 2-hard/following-integer/main.py | mpillar/codeeval | ad1fc5aea277575dcce6ad5db230d7a2bfe41eed | [
"Unlicense"
] | 21 | 2015-02-09T18:41:15.000Z | 2021-07-31T02:43:28.000Z | 2-hard/following-integer/main.py | mpillar/codeeval | ad1fc5aea277575dcce6ad5db230d7a2bfe41eed | [
"Unlicense"
] | null | null | null | 2-hard/following-integer/main.py | mpillar/codeeval | ad1fc5aea277575dcce6ad5db230d7a2bfe41eed | [
"Unlicense"
] | 37 | 2015-01-06T06:20:17.000Z | 2021-06-21T18:22:13.000Z | import sys
def get_digits_ignore_zero(x):
digits = {}
for digit in str(x):
if digit == '0':
continue
if digit in digits:
digits[digit] += 1
else:
digits[digit] = 1
return digits
def following_integer(x):
original_digits = get_digits_ignore_ze... | 21.966667 | 47 | 0.576631 | import sys
def get_digits_ignore_zero(x):
digits = {}
for digit in str(x):
if digit == '0':
continue
if digit in digits:
digits[digit] += 1
else:
digits[digit] = 1
return digits
def following_integer(x):
original_digits = get_digits_ignore_ze... | true | true |
f719b60f710335528b05a8c8cbb30e8033fe17df | 13,939 | py | Python | tests/base_test_class.py | uncycler/django-DefectDojo | d7523e1dc34af47185830c13bfa7aedfc667dd60 | [
"BSD-3-Clause"
] | 3 | 2020-10-27T08:58:03.000Z | 2021-04-28T14:20:16.000Z | tests/base_test_class.py | uncycler/django-DefectDojo | d7523e1dc34af47185830c13bfa7aedfc667dd60 | [
"BSD-3-Clause"
] | 82 | 2020-11-06T22:34:05.000Z | 2021-08-10T16:30:48.000Z | tests/base_test_class.py | uncycler/django-DefectDojo | d7523e1dc34af47185830c13bfa7aedfc667dd60 | [
"BSD-3-Clause"
] | 2 | 2022-02-07T09:57:28.000Z | 2022-03-11T08:42:59.000Z | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoAlertPresentException
import... | 43.423676 | 222 | 0.65801 | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoAlertPresentException
import... | true | true |
f719b6cebef2b6af3c2533bfa679463c3243666f | 397 | py | Python | Code/Assignment/Assignment/asgi.py | vedez/SDEV2004 | b028c8454ddca9a1abeb95df95e7f189867dd346 | [
"MIT"
] | null | null | null | Code/Assignment/Assignment/asgi.py | vedez/SDEV2004 | b028c8454ddca9a1abeb95df95e7f189867dd346 | [
"MIT"
] | null | null | null | Code/Assignment/Assignment/asgi.py | vedez/SDEV2004 | b028c8454ddca9a1abeb95df95e7f189867dd346 | [
"MIT"
] | null | null | null | """
ASGI config for Assignment project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... | 23.352941 | 78 | 0.788413 |
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Assignment.settings')
application = get_asgi_application()
| true | true |
f719b6d868fa7d2ce1c38e9b3db6ae27ddd83ee7 | 1,459 | py | Python | python/vanitygen_onion.py | 5kyc0d3r/Junk | f95fc9beaaf5f234102e213bd977de51cafdcebe | [
"MIT"
] | null | null | null | python/vanitygen_onion.py | 5kyc0d3r/Junk | f95fc9beaaf5f234102e213bd977de51cafdcebe | [
"MIT"
] | null | null | null | python/vanitygen_onion.py | 5kyc0d3r/Junk | f95fc9beaaf5f234102e213bd977de51cafdcebe | [
"MIT"
] | null | null | null | #!/usr/bin/python
"""
MIT License
Copyright (c) 2017 5kyc0d3r
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, m... | 47.064516 | 103 | 0.797807 | true | true | |
f719b711c4580588d5faede2a699731e7e1104b7 | 73,903 | py | Python | src/sage/rings/derivation.py | sheerluck/sage | b5e572b7d231f70c139d9978d68add80c4ef353d | [
"BSL-1.0"
] | 1,742 | 2015-01-04T07:06:13.000Z | 2022-03-30T11:32:52.000Z | src/sage/rings/derivation.py | sheerluck/sage | b5e572b7d231f70c139d9978d68add80c4ef353d | [
"BSL-1.0"
] | 66 | 2015-03-19T19:17:24.000Z | 2022-03-16T11:59:30.000Z | src/sage/rings/derivation.py | sheerluck/sage | b5e572b7d231f70c139d9978d68add80c4ef353d | [
"BSL-1.0"
] | 495 | 2015-01-10T10:23:18.000Z | 2022-03-24T22:06:11.000Z | r"""
Derivations
Let `A` be a ring and `B` be an bimodule over `A`.
A derivation `d : A \to B` is an additive map that satisfies
the Leibniz rule
.. MATH::
d(xy) = x d(y) + d(x) y.
If `B` is an algebra over `A` and if we are given in addition a
ring homomorphism `\theta : A \to B`, a twisted derivation with res... | 31.663668 | 209 | 0.529153 |
from sage.structure.richcmp import op_EQ, op_NE
from sage.structure.unique_representation import UniqueRepresentation
from sage.sets.family import Family
from sage.modules.module import Module
from sage.structure.element import ModuleElement
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomia... | true | true |
f719b7c6bd2479d28d7a6679e56b280ca817a0bb | 1,669 | py | Python | py/orbit/py_linac/overlapping_fields/jparc_enge_func_factory.py | LeoRya/py-orbit | 340b14b6fd041ed8ec2cc25b0821b85742aabe0c | [
"MIT"
] | 17 | 2018-02-09T23:39:06.000Z | 2022-03-04T16:27:04.000Z | py/orbit/py_linac/overlapping_fields/jparc_enge_func_factory.py | LeoRya/py-orbit | 340b14b6fd041ed8ec2cc25b0821b85742aabe0c | [
"MIT"
] | 22 | 2017-05-31T19:40:14.000Z | 2021-09-24T22:07:47.000Z | py/orbit/py_linac/overlapping_fields/jparc_enge_func_factory.py | LeoRya/py-orbit | 340b14b6fd041ed8ec2cc25b0821b85742aabe0c | [
"MIT"
] | 37 | 2016-12-08T19:39:35.000Z | 2022-02-11T19:59:34.000Z | #!/usr/bin/env python
#--------------------------------------------------------------
# This is a Enge Function Factory specific for the J-PARC. Some
# Enge's function parameters are defined by the aperture and length,
# and others are defined by the field distribution formula from Trace3D
# documentation.
#---------... | 34.061224 | 74 | 0.688436 |
# and others are defined by the field distribution formula from Trace3D
# documentation.
#--------------------------------------------------------------
import math
import sys
import os
from overlapping_quad_fields_lib import PMQ_Trace3D_Function
from overlapping_quad_fields_lib import EngeFunction
from overlapping_... | true | true |
f719b9a65c9a3077b966cb0086383cf3d2d3c035 | 498 | py | Python | meiduo_mall/utils/secret.py | liusudo123/meiduo_project | 3bf92fff56bf47777795cf9078ff285eb004b81f | [
"MIT"
] | null | null | null | meiduo_mall/utils/secret.py | liusudo123/meiduo_project | 3bf92fff56bf47777795cf9078ff285eb004b81f | [
"MIT"
] | null | null | null | meiduo_mall/utils/secret.py | liusudo123/meiduo_project | 3bf92fff56bf47777795cf9078ff285eb004b81f | [
"MIT"
] | null | null | null | # 1.装包
# 2.导包
from django.conf import settings
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
# 3.实例化
# 4.加密解密
class SecretOauth(object):
# 加密
def dumps(self, data):
s = Serializer(secret_key=settings.SECRET_KEY, expires_in=3600)
result = s.dumps(data)
return re... | 21.652174 | 71 | 0.670683 |
from django.conf import settings
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
class SecretOauth(object):
def dumps(self, data):
s = Serializer(secret_key=settings.SECRET_KEY, expires_in=3600)
result = s.dumps(data)
return result.decode()
def loads(sel... | true | true |
f719b9b7e40ad20e1eac164cd3eb7a2cf77da67a | 3,848 | py | Python | Phys_Seg/run.py | pedrob37/Phys_Seg | 7adc65d7b228b3a5702acfa9e6d0494d6b4c2dee | [
"Apache-2.0"
] | 1 | 2021-09-27T09:58:56.000Z | 2021-09-27T09:58:56.000Z | Phys_Seg/run.py | pedrob37/Phys_Seg | 7adc65d7b228b3a5702acfa9e6d0494d6b4c2dee | [
"Apache-2.0"
] | null | null | null | Phys_Seg/run.py | pedrob37/Phys_Seg | 7adc65d7b228b3a5702acfa9e6d0494d6b4c2dee | [
"Apache-2.0"
] | null | null | null | import torch
import numpy as np
import SimpleITK as sitk
from Phys_Seg.data_loading import load_and_preprocess, save_segmentation_nifti, read_file, save_img
from Phys_Seg.predict_case import predict_phys_seg, physics_preprocessing, image_preprocessing
import importlib
from Phys_Seg.utils import postprocess_prediction, ... | 38.09901 | 114 | 0.64527 | import torch
import numpy as np
import SimpleITK as sitk
from Phys_Seg.data_loading import load_and_preprocess, save_segmentation_nifti, read_file, save_img
from Phys_Seg.predict_case import predict_phys_seg, physics_preprocessing, image_preprocessing
import importlib
from Phys_Seg.utils import postprocess_prediction, ... | true | true |
f719bb906e369e26b721b5b82e53ff4644582d3b | 3,541 | py | Python | lzo_indexer/indexer.py | krux/python-lzo-indexer | 21fdd821a38d9b941c02036b7f30a15891311a7d | [
"Apache-2.0"
] | 8 | 2015-09-12T17:11:00.000Z | 2021-04-22T01:35:26.000Z | lzo_indexer/indexer.py | krux/python-lzo-indexer | 21fdd821a38d9b941c02036b7f30a15891311a7d | [
"Apache-2.0"
] | null | null | null | lzo_indexer/indexer.py | krux/python-lzo-indexer | 21fdd821a38d9b941c02036b7f30a15891311a7d | [
"Apache-2.0"
] | 4 | 2015-06-18T01:04:19.000Z | 2018-09-28T16:33:54.000Z | import struct
from collections import namedtuple
from StringIO import StringIO
# Magic string expected at the start of the file to verify it's LZO
_LZO_MAGIC = bytearray("\x89LZO\x00\r\n\x1a\n")
_COMPRESSION_CHECKSUMS = (0x02, 0x200) # ADLER32 CRC32
_DECOMPRESSION_CHECKSUMS = (0x01, 0x100) # ADLER32 CRC32
def _pa... | 29.508333 | 79 | 0.680316 | import struct
from collections import namedtuple
from StringIO import StringIO
_LZO_MAGIC = bytearray("\x89LZO\x00\r\n\x1a\n")
_COMPRESSION_CHECKSUMS = (0x02, 0x200) # ADLER32 CRC32
_DECOMPRESSION_CHECKSUMS = (0x01, 0x100) # ADLER32 CRC32
def _parse_header(lzo_file):
if lzo_file.tell() != 0:
raise Ex... | true | true |
f719bbd224fa1f348d74df1adf6270da318609b3 | 1,028 | py | Python | reference/ddtrace/ext/aws.py | stschenk/opentelemetry-python-contrib | 28c1331e571d386baab74f5028e3268e4bfda4cd | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | reference/ddtrace/ext/aws.py | stschenk/opentelemetry-python-contrib | 28c1331e571d386baab74f5028e3268e4bfda4cd | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2020-12-12T17:59:41.000Z | 2020-12-12T18:54:03.000Z | reference/ddtrace/ext/aws.py | stschenk/opentelemetry-python-contrib | 28c1331e571d386baab74f5028e3268e4bfda4cd | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2020-10-22T04:16:33.000Z | 2020-10-22T04:16:33.000Z | from ..utils.formats import flatten_dict
DENYLIST_ENDPOINT = ['kms', 'sts']
DENYLIST_ENDPOINT_TAGS = {
's3': ['params.Body'],
}
def truncate_arg_value(value, max_len=1024):
"""Truncate values which are bytes and greater than `max_len`.
Useful for parameters like 'Body' in `put_object` operations.
""... | 25.7 | 74 | 0.622568 | from ..utils.formats import flatten_dict
DENYLIST_ENDPOINT = ['kms', 'sts']
DENYLIST_ENDPOINT_TAGS = {
's3': ['params.Body'],
}
def truncate_arg_value(value, max_len=1024):
if isinstance(value, bytes) and len(value) > max_len:
return b'...'
return value
def add_span_arg_tags(span, endpoint_na... | true | true |
f719bbfb410401300cb793e160dd34ffe11f0df1 | 426 | py | Python | list_comprehensions.py | rjayasin/list-comprehension | 6937f4f6dec8b1b8722c31356db32de18795de8b | [
"MIT"
] | null | null | null | list_comprehensions.py | rjayasin/list-comprehension | 6937f4f6dec8b1b8722c31356db32de18795de8b | [
"MIT"
] | null | null | null | list_comprehensions.py | rjayasin/list-comprehension | 6937f4f6dec8b1b8722c31356db32de18795de8b | [
"MIT"
] | null | null | null | import math
#compute primes using list difference
#from http://www.secnetix.de/olli/Python/list_comprehensions.hawk
noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)]
difference = [x for x in range(2, 50) if x not in noprimes]
# print(difference)
#my own version, a little more complicated
primes = [x for ... | 35.5 | 105 | 0.692488 | import math
noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)]
difference = [x for x in range(2, 50) if x not in noprimes]
primes = [x for x in range(1, 51) if not any([y for y in range(2, int(math.sqrt(x) + 1)) if x % y == 0])]
| true | true |
f719bcfdda7fd95388f3a3f5283d672ebcdb37cb | 5,859 | py | Python | apps/translations/tests/test_helpers.py | Joergen/olympia | eb84203469adbb6584e50d7bb6f9de7f20980dac | [
"BSD-3-Clause"
] | 1 | 2015-10-29T06:55:20.000Z | 2015-10-29T06:55:20.000Z | apps/translations/tests/test_helpers.py | magopian/olympia | 70cad15111a89e3d5c715cbade8925b12d1b98dc | [
"BSD-3-Clause"
] | null | null | null | apps/translations/tests/test_helpers.py | magopian/olympia | 70cad15111a89e3d5c715cbade8925b12d1b98dc | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
from django.utils import translation
import jingo
import pytest
from mock import Mock, patch
from nose.tools import eq_
import amo
import amo.tests
from addons.models import Addon
from translations import helpers
from translations.fields import save_signal
from translations.models imp... | 33.672414 | 79 | 0.635774 | from django.conf import settings
from django.utils import translation
import jingo
import pytest
from mock import Mock, patch
from nose.tools import eq_
import amo
import amo.tests
from addons.models import Addon
from translations import helpers
from translations.fields import save_signal
from translations.models imp... | true | true |
f719bd0e61d8fc8ee4756b2db46ad0dfa8dfa39d | 6,499 | py | Python | twisted/test/test_text.py | sxamit/twisted | 30f6966329c857c3631c60aeb420d84d7828e01e | [
"MIT",
"Unlicense"
] | 1 | 2017-08-07T14:52:02.000Z | 2017-08-07T14:52:02.000Z | Lib/site-packages/twisted/test/test_text.py | adzhou/Python27 | a7113b69d54a04cc780143241c2f1fe81939ad3a | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/twisted/test/test_text.py | adzhou/Python27 | a7113b69d54a04cc780143241c2f1fe81939ad3a | [
"bzip2-1.0.6"
] | 1 | 2018-11-07T12:52:07.000Z | 2018-11-07T12:52:07.000Z | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.text}.
"""
from cStringIO import StringIO
from twisted.trial import unittest
from twisted.python import text
sampleText = \
"""Every attempt to employ mathematical methods in the study of chemical
questions must ... | 26.744856 | 103 | 0.59086 |
from cStringIO import StringIO
from twisted.trial import unittest
from twisted.python import text
sampleText = \
"""Every attempt to employ mathematical methods in the study of chemical
questions must be considered profoundly irrational and contrary to the
spirit of chemistry ... If mathematical analysis should e... | true | true |
f719bed52604d78cd372c38b0ba41bc4f013d7b2 | 311 | py | Python | routes/show_bp.py | Silve1ra/fyyur | 580562cc592d587c9bed4f080b856664abb9f70d | [
"MIT"
] | 1 | 2021-09-17T11:56:38.000Z | 2021-09-17T11:56:38.000Z | routes/show_bp.py | Silve1ra/fyyur | 580562cc592d587c9bed4f080b856664abb9f70d | [
"MIT"
] | null | null | null | routes/show_bp.py | Silve1ra/fyyur | 580562cc592d587c9bed4f080b856664abb9f70d | [
"MIT"
] | null | null | null | from flask import Blueprint
from controllers.show import shows, create_shows, create_show_submission
show_bp = Blueprint('show_bp', __name__)
show_bp.route('/', methods=['GET'])(shows)
show_bp.route('/create', methods=['GET'])(create_shows)
show_bp.route('/create', methods=['POST'])(create_show_submission)
| 31.1 | 72 | 0.762058 | from flask import Blueprint
from controllers.show import shows, create_shows, create_show_submission
show_bp = Blueprint('show_bp', __name__)
show_bp.route('/', methods=['GET'])(shows)
show_bp.route('/create', methods=['GET'])(create_shows)
show_bp.route('/create', methods=['POST'])(create_show_submission)
| true | true |
f719bf0a49a2168cb3b4abfd826a62d6032ed825 | 7,399 | py | Python | nova/api/openstack/compute/plugins/v3/cloudpipe.py | zaina/nova | 181358c172d606b23c9cc14b58d677d911013c02 | [
"Apache-2.0"
] | null | null | null | nova/api/openstack/compute/plugins/v3/cloudpipe.py | zaina/nova | 181358c172d606b23c9cc14b58d677d911013c02 | [
"Apache-2.0"
] | null | null | null | nova/api/openstack/compute/plugins/v3/cloudpipe.py | zaina/nova | 181358c172d606b23c9cc14b58d677d911013c02 | [
"Apache-2.0"
] | null | null | null | # Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 37.368687 | 79 | 0.629274 |
from oslo_config import cfg
from oslo_utils import fileutils
from oslo_utils import timeutils
from webob import exc
from nova.api.openstack.compute.schemas.v3 import cloudpipe
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova.cloudpipe import pipe... | true | true |
f719bfc6c7c129776e3b9c9595c4c130931fdd2d | 15,240 | py | Python | tempest/api/compute/servers/test_create_server.py | xavpaice/tempest | 958bd694df27511e0346d799876fe49331b8145c | [
"Apache-2.0"
] | 3 | 2016-07-15T12:27:23.000Z | 2021-04-23T04:41:10.000Z | tempest/api/compute/servers/test_create_server.py | LIS/lis-tempest | 8e6403b2d6de81c5d18ed867b4977385c8278b75 | [
"Apache-2.0"
] | null | null | null | tempest/api/compute/servers/test_create_server.py | LIS/lis-tempest | 8e6403b2d6de81c5d18ed867b4977385c8278b75 | [
"Apache-2.0"
] | 12 | 2016-07-14T18:13:05.000Z | 2017-07-08T18:45:42.000Z | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 42.569832 | 79 | 0.639764 |
import netaddr
import testtools
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
from tempest.common import waiters
from tempest import config
from tempest import test
CONF = config.CONF
class ServersTestJSON(base.BaseV2ComputeTes... | true | true |
f719c1aa06398ac1ce2cbf746acc94255267f1b7 | 1,306 | py | Python | Rock Spock Paper Lizard Scissor.py | manavbabber/IIPP | 009bb0e74f7306d6880ed1dc3e748c604e76ad50 | [
"MIT"
] | null | null | null | Rock Spock Paper Lizard Scissor.py | manavbabber/IIPP | 009bb0e74f7306d6880ed1dc3e748c604e76ad50 | [
"MIT"
] | null | null | null | Rock Spock Paper Lizard Scissor.py | manavbabber/IIPP | 009bb0e74f7306d6880ed1dc3e748c604e76ad50 | [
"MIT"
] | null | null | null | import random
def name_to_number(name):
if(name=='rock'):
return 0
elif(name=='Spock'):
return 1
elif(name=='paper'):
return 2
elif(name=='lizard'):
return 3
elif(name=='scissors'):
return 4
else:
return name,"is an invalid name"
def ... | 27.208333 | 50 | 0.581164 | import random
def name_to_number(name):
if(name=='rock'):
return 0
elif(name=='Spock'):
return 1
elif(name=='paper'):
return 2
elif(name=='lizard'):
return 3
elif(name=='scissors'):
return 4
else:
return name,"is an invalid name"
def ... | false | true |
f719c272300d7b8fc3f56eac0566b018ef20c845 | 1,313 | py | Python | ooobuild/dyn/i18n/x_calendar4.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/dyn/i18n/x_calendar4.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/dyn/i18n/x_calendar4.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 35.486486 | 74 | 0.760091 | from typing import TYPE_CHECKING
from ooo.oenv.env_const import UNO_ENVIRONMENT, UNO_RUNTIME
_DYNAMIC = False
if (not TYPE_CHECKING) and UNO_RUNTIME and UNO_ENVIRONMENT:
_DYNAMIC = True
if not TYPE_CHECKING and _DYNAMIC:
from com.sun.star.i18n import XCalendar4 as XCalendar4
setattr(XCalendar4, '__ooo_ns__... | true | true |
f719c298d161b599d989c8e2337e4c83af090b4b | 1,483 | py | Python | test/test_binary.py | teristam/openephys-fileIO | 8089e7c4aff829c13a79656b8812a3d3e68eb1eb | [
"MIT"
] | 1 | 2020-08-16T21:52:10.000Z | 2020-08-16T21:52:10.000Z | test/test_binary.py | teristam/openephys-fileIO | 8089e7c4aff829c13a79656b8812a3d3e68eb1eb | [
"MIT"
] | null | null | null | test/test_binary.py | teristam/openephys-fileIO | 8089e7c4aff829c13a79656b8812a3d3e68eb1eb | [
"MIT"
] | null | null | null | import numpy as np
from openephys_fileIO.fileIO import *
from openephys_fileIO.Binary import *
def test_write_binary_data():
# Test writing of binary data
dataFolder = 'test/data'
# Read the data in original int16 format
data,headers = load_OpenEphysRecording4BinaryFile(dataFolder,
num_d... | 29.66 | 90 | 0.710722 | import numpy as np
from openephys_fileIO.fileIO import *
from openephys_fileIO.Binary import *
def test_write_binary_data():
dataFolder = 'test/data'
data,headers = load_OpenEphysRecording4BinaryFile(dataFolder,
num_data_channel=1,num_aux_channel=1, num_adc_channel=1)
print(headers)
... | true | true |
f719c2d3c90414ada7ec442b5268bf062e2a60e0 | 23,986 | py | Python | ckan/logic/__init__.py | robbi5/ckan | e89ca125dc68ddb9fe9bad68a401404146ba90c7 | [
"BSD-3-Clause"
] | 6 | 2015-11-09T00:44:51.000Z | 2019-11-21T14:56:01.000Z | ckan/logic/__init__.py | robbi5/ckan | e89ca125dc68ddb9fe9bad68a401404146ba90c7 | [
"BSD-3-Clause"
] | 39 | 2015-02-18T17:32:23.000Z | 2022-03-11T18:03:36.000Z | ckan/logic/__init__.py | robbi5/ckan | e89ca125dc68ddb9fe9bad68a401404146ba90c7 | [
"BSD-3-Clause"
] | 17 | 2015-03-13T18:05:05.000Z | 2020-11-06T13:55:32.000Z | # encoding: utf-8
import inspect
import functools
import logging
import re
import importlib
import inspect
from collections import defaultdict
from werkzeug.utils import import_string
import six
from six import string_types, text_type
import ckan.model as model
import ckan.authz as authz
import ckan.lib.navl.dictiz... | 33.688202 | 79 | 0.627741 |
import inspect
import functools
import logging
import re
import importlib
import inspect
from collections import defaultdict
from werkzeug.utils import import_string
import six
from six import string_types, text_type
import ckan.model as model
import ckan.authz as authz
import ckan.lib.navl.dictization_functions as... | true | true |
f719c3d21c3cbd95489d2ede11b990e85803833d | 79 | py | Python | Chapter03/circle_call.py | PacktPublishing/Secret-Recipes-of-the-Python-Ninja | 805d00c7a54927ba94c9077e9a580508ee3c5e56 | [
"MIT"
] | 13 | 2018-06-21T01:44:49.000Z | 2021-12-01T10:49:53.000Z | Chapter03/circle_call.py | PacktPublishing/Secret-Recipes-of-the-Python-Ninja | 805d00c7a54927ba94c9077e9a580508ee3c5e56 | [
"MIT"
] | null | null | null | Chapter03/circle_call.py | PacktPublishing/Secret-Recipes-of-the-Python-Ninja | 805d00c7a54927ba94c9077e9a580508ee3c5e56 | [
"MIT"
] | 6 | 2018-10-05T08:29:24.000Z | 2022-01-11T14:49:50.000Z | r = input("Input radius: ")
diameter, circumference, area = circle_measures(r)
| 26.333333 | 50 | 0.734177 | r = input("Input radius: ")
diameter, circumference, area = circle_measures(r)
| true | true |
f719c48b433034a6d2941656747bb299c65248d8 | 9,652 | py | Python | QLearning.py | FlowerForAlgernon/ai_tetris | 7ac0d3875ad9b31fb260f7567a218e0de340c4e4 | [
"Apache-2.0"
] | 1 | 2021-12-19T14:07:37.000Z | 2021-12-19T14:07:37.000Z | QLearning.py | FlowerForAlgernon/ai_tetris | 7ac0d3875ad9b31fb260f7567a218e0de340c4e4 | [
"Apache-2.0"
] | null | null | null | QLearning.py | FlowerForAlgernon/ai_tetris | 7ac0d3875ad9b31fb260f7567a218e0de340c4e4 | [
"Apache-2.0"
] | null | null | null | """
这份代码使用 Q learning 算法训练并运行俄罗斯方块游戏 ai。其中简化状态空间的方法可参考论文 Adapting Reinforcement Learning to Tetris
"""
import numpy as np
from game import *
sub_well = 4
base = 7
def getStateIndex(field_width, field_height, field_map):
"""
因为每一列有 7 种不同的情况,所以采用七进制数来作为状态索引
"""
temp = [0 for _ in range(field_width)]... | 38 | 214 | 0.585993 |
import numpy as np
from game import *
sub_well = 4
base = 7
def getStateIndex(field_width, field_height, field_map):
temp = [0 for _ in range(field_width)]
convert = {}
for i in range(-(base - 1)//2, (base - 1)//2 + 1):
convert[i] = i + (base - 1)//2
for x in range(field_width):
wh... | true | true |
f719c4a70ee2814bd930a3c19d9d0b1401f193f9 | 834 | py | Python | pyvat/result.py | Alex-Espressone/pyvat | 266559c9d8af2aee7ecea3aed52a517181a412c8 | [
"Apache-2.0"
] | 48 | 2015-07-22T12:02:20.000Z | 2022-02-07T16:54:13.000Z | pyvat/result.py | Alex-Espressone/pyvat | 266559c9d8af2aee7ecea3aed52a517181a412c8 | [
"Apache-2.0"
] | 34 | 2015-03-27T17:47:38.000Z | 2022-02-08T18:14:55.000Z | pyvat/result.py | Alex-Espressone/pyvat | 266559c9d8af2aee7ecea3aed52a517181a412c8 | [
"Apache-2.0"
] | 40 | 2015-04-08T14:03:06.000Z | 2022-02-09T12:29:04.000Z | class VatNumberCheckResult(object):
"""Result of a VAT number validation check.
:ivar is_valid:
Boolean value indicating if the checked VAT number was deemed to be
valid. ``True`` if the VAT number is valid or ``False`` if the VAT
number is positively invalid.
:ivar log_lines:
... | 36.26087 | 77 | 0.641487 | class VatNumberCheckResult(object):
def __init__(self,
is_valid=None,
log_lines=None,
business_name=None,
business_address=None):
self.is_valid = is_valid
self.log_lines = log_lines or []
self.business_name = business_name
... | true | true |
f719c4d93ac3ade1ce4c3daeee9db9db01e404b2 | 2,209 | py | Python | source code/Data Visualization.py | starkworld/Python-Course-work | 28715f079939129b442aedcd7edb2e0838886ba0 | [
"Apache-2.0"
] | null | null | null | source code/Data Visualization.py | starkworld/Python-Course-work | 28715f079939129b442aedcd7edb2e0838886ba0 | [
"Apache-2.0"
] | null | null | null | source code/Data Visualization.py | starkworld/Python-Course-work | 28715f079939129b442aedcd7edb2e0838886ba0 | [
"Apache-2.0"
] | null | null | null | """
Author : nkalyan🤠
implementing Python Scripts on reading and returning the name no of mails that sent each day in week
and plot/display them in bar graph
I wrote code In counting to count the number of emails sent by each distinct user. That code may be helpful for this assignment.
"""
import matplotlib.py... | 32.970149 | 132 | 0.557718 |
import matplotlib.pyplot as plt
from os import getcwd
def file_path():
file_name = input("Enter the file name:")
return file_name
def pop_values(filename):
file_name = filename
try: fp = open(file_name, "r")
except FileNotFoundError: ... | true | true |
f719c4fee092036cf2a37dc220d4280aca8e4828 | 665 | py | Python | full-problems/studentRecord.py | vikas-t/DS-Algo | ea654d1cad5374c824c52da9d3815a9546eb43fa | [
"Apache-2.0"
] | null | null | null | full-problems/studentRecord.py | vikas-t/DS-Algo | ea654d1cad5374c824c52da9d3815a9546eb43fa | [
"Apache-2.0"
] | null | null | null | full-problems/studentRecord.py | vikas-t/DS-Algo | ea654d1cad5374c824c52da9d3815a9546eb43fa | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/student-record/0
def sol(records, n):
mx = 0
res = []
for ni in range(0, n*4, 4):
am = sum(map(int, records[ni+1:ni+4]))//3
if am > mx:
# If we find a better average overwrite the result list
# with the ... | 33.25 | 67 | 0.557895 |
def sol(records, n):
mx = 0
res = []
for ni in range(0, n*4, 4):
am = sum(map(int, records[ni+1:ni+4]))//3
if am > mx:
mx = am
res = [(records[ni], am)]
elif am == mx:
res.append((records[ni], am))
for name,... | true | true |
f719c541df617120f9d4a9a665699e9251dae5ac | 1,425 | py | Python | angrmanagement/plugins/bughouse/data/component_tree.py | DennyDai/angr-management | 8a4ba5dafbf2f4d2ba558528a0d1ae099a199a04 | [
"BSD-2-Clause"
] | 474 | 2015-08-10T17:47:15.000Z | 2022-03-31T21:10:55.000Z | angrmanagement/plugins/bughouse/data/component_tree.py | DennyDai/angr-management | 8a4ba5dafbf2f4d2ba558528a0d1ae099a199a04 | [
"BSD-2-Clause"
] | 355 | 2015-08-17T09:35:53.000Z | 2022-03-31T21:29:52.000Z | angrmanagement/plugins/bughouse/data/component_tree.py | DennyDai/angr-management | 8a4ba5dafbf2f4d2ba558528a0d1ae099a199a04 | [
"BSD-2-Clause"
] | 95 | 2015-08-11T14:36:12.000Z | 2022-03-31T23:01:01.000Z | from typing import List, Optional
class ComponentFunction:
__slots__ = ('mapped_base', 'virtual_addr', 'symbol_name', )
def __init__(self, mapped_base: int, virtual_addr: int, symbol_name: Optional[str]=None):
self.mapped_base = mapped_base
self.virtual_addr = virtual_addr
self.symbo... | 32.386364 | 99 | 0.627368 | from typing import List, Optional
class ComponentFunction:
__slots__ = ('mapped_base', 'virtual_addr', 'symbol_name', )
def __init__(self, mapped_base: int, virtual_addr: int, symbol_name: Optional[str]=None):
self.mapped_base = mapped_base
self.virtual_addr = virtual_addr
self.symbo... | true | true |
f719c5dcecb268d37900df93c57ea65672756916 | 2,829 | py | Python | analysis/stats.py | jasonrute/puzzle_cube | 7e05a21acd26cb30e729ba6a95e14e16c76c1780 | [
"MIT"
] | 81 | 2018-06-17T17:02:24.000Z | 2021-11-05T07:16:12.000Z | analysis/stats.py | jasonrute/puzzle_cube | 7e05a21acd26cb30e729ba6a95e14e16c76c1780 | [
"MIT"
] | 1 | 2018-09-20T08:04:19.000Z | 2018-09-20T12:14:55.000Z | analysis/stats.py | jasonrute/puzzle_cube | 7e05a21acd26cb30e729ba6a95e14e16c76c1780 | [
"MIT"
] | 23 | 2018-02-20T21:19:49.000Z | 2022-03-05T18:05:10.000Z | """
Training Statics Tools
A class for loading statistics related to a particular rutraiining session.
"""
import numpy as np
#from scipy import stats
import pandas as pd
import os
def str_between(s, start, end):
return (s.split(start))[1].split(end)[0]
def is_stat_file_version(file_name, version):
return f... | 32.147727 | 102 | 0.655355 |
import numpy as np
import pandas as pd
import os
def str_between(s, start, end):
return (s.split(start))[1].split(end)[0]
def is_stat_file_version(file_name, version):
return file_name.startswith("stats_{}_gen".format(version)) and file_name.endswith(".h5")
class TrainingStates:
def __init__(self, versi... | true | true |
f719c6c53b95cb7f32858726c85cf496a8c0b670 | 1,192 | py | Python | lantz/drivers/thorlabs/pm100d.py | ZixiLi0520/lantz | a67120a65e6b66f394965ef0100529db7be3df0a | [
"BSD-3-Clause"
] | 6 | 2016-04-13T12:59:18.000Z | 2020-06-24T17:43:04.000Z | lantz/drivers/thorlabs/pm100d.py | awsch/lantz | 717f6962a471be7ceb61d1d8f6c6f381553df9c4 | [
"BSD-3-Clause"
] | null | null | null | lantz/drivers/thorlabs/pm100d.py | awsch/lantz | 717f6962a471be7ceb61d1d8f6c6f381553df9c4 | [
"BSD-3-Clause"
] | 6 | 2015-12-14T19:30:36.000Z | 2020-06-29T21:16:01.000Z | # -*- coding: utf-8 -*-
"""
To connect the power meter you'll need to use the "Power meter driver switcher" application to switch to the PM100D (Ni-Visa) drivers.
Then the resource name should show up when exceuting:
import visa
visa.ResourceManager().list_resources()
"""
from lantz.messagebased import MessageBasedD... | 27.090909 | 134 | 0.655201 |
from lantz.messagebased import MessageBasedDriver
from lantz import Feat
class PM100D(MessageBasedDriver):
DEFAULTS = {
'COMMON': {
'read_termination': '\n',
'write_termination': '\n',
},
}
@Feat(read_once=True)
def idn(self):
return self.query('*IDN?... | true | true |
f719c7438aaad15d2be4ec5a66891319541f52ff | 1,767 | py | Python | Scripts/reader/gpro_corpus.py | lasigeBioTM/ULISBOA-at-SemEval-2017 | 415dc3ebbd2365aa7620a9b4feb1218fa837d7d5 | [
"MIT"
] | 8 | 2018-05-10T10:27:18.000Z | 2021-08-30T02:55:54.000Z | Scripts/reader/gpro_corpus.py | lasigeBioTM/ULISBOA-at-SemEval-2017 | 415dc3ebbd2365aa7620a9b4feb1218fa837d7d5 | [
"MIT"
] | 4 | 2018-10-24T13:32:45.000Z | 2021-02-05T11:48:04.000Z | Scripts/reader/gpro_corpus.py | lasigeBioTM/ULISBOA-at-SemEval-2017 | 415dc3ebbd2365aa7620a9b4feb1218fa837d7d5 | [
"MIT"
] | 5 | 2020-07-22T06:13:56.000Z | 2020-11-18T14:48:39.000Z | import codecs
import logging
import pickle
from chemdner_corpus import ChemdnerCorpus
class GproCorpus(ChemdnerCorpus):
"""Chemdner GPRO corpus from BioCreative V"""
def __init__(self, corpusdir, **kwargs):
super(GproCorpus, self).__init__(corpusdir, **kwargs)
self.subtypes = ["NESTED", "IDEN... | 43.097561 | 91 | 0.57442 | import codecs
import logging
import pickle
from chemdner_corpus import ChemdnerCorpus
class GproCorpus(ChemdnerCorpus):
def __init__(self, corpusdir, **kwargs):
super(GproCorpus, self).__init__(corpusdir, **kwargs)
self.subtypes = ["NESTED", "IDENTIFIER", "FULL_NAME", "ABBREVIATION"]
def loa... | true | true |
f719c759c9af0450e25345c13d5b68b9e3d98654 | 788 | py | Python | model.py | OrBin/N-Gram-Language-Model | e196758083bbed386dd1a24733cb956c8a36aa79 | [
"MIT"
] | null | null | null | model.py | OrBin/N-Gram-Language-Model | e196758083bbed386dd1a24733cb956c8a36aa79 | [
"MIT"
] | null | null | null | model.py | OrBin/N-Gram-Language-Model | e196758083bbed386dd1a24733cb956c8a36aa79 | [
"MIT"
] | null | null | null | import utils
class Model:
def __init__(self, file_path):
with open(file_path, 'r', encoding="utf8") as model_file:
self.model_tree = {}
for line in model_file:
chars, minus_log_p = utils.parse_model_file_line(line)
n_1_gram = ''.join(chars[:-1])
last_char = chars[-1]
if n_1_gram not in self... | 28.142857 | 72 | 0.695431 | import utils
class Model:
def __init__(self, file_path):
with open(file_path, 'r', encoding="utf8") as model_file:
self.model_tree = {}
for line in model_file:
chars, minus_log_p = utils.parse_model_file_line(line)
n_1_gram = ''.join(chars[:-1])
last_char = chars[-1]
if n_1_gram not in self... | true | true |
f719c75eed3a13b4d4eda1dd71c9f05b6e0ba238 | 349 | py | Python | tools/PRESUBMIT.py | RiyoCoder/v8 | e073edfc7dc990cc5f71c4e51ac27b19be16fcb7 | [
"BSD-3-Clause"
] | 2 | 2020-08-27T09:36:44.000Z | 2020-09-23T14:01:12.000Z | tools/PRESUBMIT.py | RiyoCoder/v8 | e073edfc7dc990cc5f71c4e51ac27b19be16fcb7 | [
"BSD-3-Clause"
] | null | null | null | tools/PRESUBMIT.py | RiyoCoder/v8 | e073edfc7dc990cc5f71c4e51ac27b19be16fcb7 | [
"BSD-3-Clause"
] | 1 | 2019-10-08T06:20:30.000Z | 2019-10-08T06:20:30.000Z | # Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnCommit(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, 'unittests')
retu... | 38.777778 | 72 | 0.782235 |
def CheckChangeOnCommit(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, 'unittests')
return input_api.RunTests(tests)
| true | true |
f719c7a7aac77a98a8d3c8df7aaf015dd69b5b0b | 1,102 | py | Python | ch_06/std_from_mean_kde.py | ags-ds/Hands-On-Data-Analysis-with-Pandas-By-Ags | f4ae6e3c3ef3c9ed9b11185724e1ea70a2f63f14 | [
"MIT"
] | 260 | 2019-01-21T01:38:39.000Z | 2022-03-26T18:49:21.000Z | ch_06/std_from_mean_kde.py | ags-ds/Hands-On-Data-Analysis-with-Pandas-By-Ags | f4ae6e3c3ef3c9ed9b11185724e1ea70a2f63f14 | [
"MIT"
] | 8 | 2020-03-13T15:48:56.000Z | 2021-08-23T21:43:44.000Z | ch_06/std_from_mean_kde.py | ags-ds/Hands-On-Data-Analysis-with-Pandas-By-Ags | f4ae6e3c3ef3c9ed9b11185724e1ea70a2f63f14 | [
"MIT"
] | 665 | 2019-07-27T18:28:20.000Z | 2022-03-23T08:20:35.000Z | import itertools
def std_from_mean_kde(data):
"""
Plot the KDE of the pandas series along with vertical
reference lines for each standard deviation from the mean.
Parameters:
- data: pandas Series with numeric data
Returns:
Matplotlib Axes object.
"""
mean_mag, std... | 26.878049 | 62 | 0.520871 | import itertools
def std_from_mean_kde(data):
mean_mag, std_mean = data.mean(), data.std()
ax = data.plot(kind='kde')
ax.axvline(mean_mag, color='b', alpha=0.2, label='mean')
colors = ['green', 'orange', 'red']
multipliers = [1, 2, 3]
signs = ['-', '+']
for sign, (color, mult... | true | true |
f719c8336db951828b5e48810801b98858d489e2 | 1,559 | py | Python | ladder/urls.py | jzahedieh/django-tennis-ladder | 03a9fc9ec6d0830ac1d6648428eca11755eabb00 | [
"MIT"
] | 13 | 2015-04-30T21:07:20.000Z | 2021-01-08T13:52:14.000Z | ladder/urls.py | jzahedieh/django-tennis-ladder | 03a9fc9ec6d0830ac1d6648428eca11755eabb00 | [
"MIT"
] | 13 | 2015-04-05T22:48:14.000Z | 2021-12-12T17:29:16.000Z | ladder/urls.py | jzahedieh/django-tennis-ladder | 03a9fc9ec6d0830ac1d6648428eca11755eabb00 | [
"MIT"
] | 5 | 2016-10-12T16:24:09.000Z | 2019-11-26T10:16:44.000Z | from django.urls import re_path
from ladder import views
urlpatterns = [
re_path(r'^$', views.index, name='index'),
re_path(r'^list/$', views.list_rounds, name='list'),
re_path(r'^current/$', views.current_season_redirect, name='current'),
# ex: /2013/round/1/
re_path(r'^(?P<year>\d+)/round/(?P<se... | 55.678571 | 120 | 0.664529 | from django.urls import re_path
from ladder import views
urlpatterns = [
re_path(r'^$', views.index, name='index'),
re_path(r'^list/$', views.list_rounds, name='list'),
re_path(r'^current/$', views.current_season_redirect, name='current'),
re_path(r'^(?P<year>\d+)/round/(?P<season_round>\d+)/$', v... | true | true |
f719c848267dc37edb40ddf8031a05c5fa16b620 | 3,306 | py | Python | myFileClass.py | saewoonam/thorium_daq_uqd | 249ab89338591c833009711e2f7997dbe2898fbc | [
"MIT"
] | null | null | null | myFileClass.py | saewoonam/thorium_daq_uqd | 249ab89338591c833009711e2f7997dbe2898fbc | [
"MIT"
] | null | null | null | myFileClass.py | saewoonam/thorium_daq_uqd | 249ab89338591c833009711e2f7997dbe2898fbc | [
"MIT"
] | null | null | null | import sys
import sqlite3
import hashlib
import time
import logging
import os.path
logger = logging.getLogger(__name__)
logpath = os.path.dirname(__file__)
logpath = os.path.join(logpath, 'logs/')
fileHandler = logging.FileHandler(logpath + __name__ + '.log')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(... | 30.611111 | 119 | 0.575015 | import sys
import sqlite3
import hashlib
import time
import logging
import os.path
logger = logging.getLogger(__name__)
logpath = os.path.dirname(__file__)
logpath = os.path.join(logpath, 'logs/')
fileHandler = logging.FileHandler(logpath + __name__ + '.log')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(... | true | true |
f719c9d44f62e65378d7e3d7e79d5a07e67b6c18 | 1,925 | py | Python | tests/test_swf/models/test_generic_type.py | symroe/moto | 4e106995af6f2820273528fca8a4e9ee288690a5 | [
"Apache-2.0"
] | 5,460 | 2015-01-01T01:11:17.000Z | 2022-03-31T23:45:38.000Z | tests/test_swf/models/test_generic_type.py | symroe/moto | 4e106995af6f2820273528fca8a4e9ee288690a5 | [
"Apache-2.0"
] | 4,475 | 2015-01-05T19:37:30.000Z | 2022-03-31T13:55:12.000Z | tests/test_swf/models/test_generic_type.py | symroe/moto | 4e106995af6f2820273528fca8a4e9ee288690a5 | [
"Apache-2.0"
] | 1,831 | 2015-01-14T00:00:44.000Z | 2022-03-31T20:30:04.000Z | from moto.swf.models import GenericType
import sure # noqa # pylint: disable=unused-import
# Tests for GenericType (ActivityType, WorkflowType)
class FooType(GenericType):
@property
def kind(self):
return "foo"
@property
def _configuration_keys(self):
return ["justAnExampleTimeout"]
... | 32.627119 | 84 | 0.701299 | from moto.swf.models import GenericType
import sure
class FooType(GenericType):
@property
def kind(self):
return "foo"
@property
def _configuration_keys(self):
return ["justAnExampleTimeout"]
def test_type_short_dict_representation():
_type = FooType("test-foo", "v1.0")
_ty... | true | true |
f719ca25ac5cfde9937fa4a3c1d7f11e2bc44eb3 | 427 | py | Python | data/scripts/templates/object/mobile/shared_r2_space.py | obi-two/GameServer | 7d37024e2291a97d49522610cd8f1dbe5666afc2 | [
"MIT"
] | 20 | 2015-02-23T15:11:56.000Z | 2022-03-18T20:56:48.000Z | data/scripts/templates/object/mobile/shared_r2_space.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | null | null | null | data/scripts/templates/object/mobile/shared_r2_space.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | 20 | 2015-04-04T16:35:59.000Z | 2022-03-24T14:54:37.000Z | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_r2_space.iff"
result.attribute_template_id = 9
result.stfName... | 25.117647 | 54 | 0.71897 |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_r2_space.iff"
result.attribute_template_id = 9
result.stfName("droid_name","r2_base")
return result | true | true |
f719cc3064aeb246e474124454e307d2ac046ca9 | 4,087 | py | Python | tests/unit_tests/routes_test.py | schmidtbri/rest-model-service | 0d1705cb62e6a942f90150da3bcf51e3e1265a25 | [
"BSD-3-Clause"
] | 1 | 2021-11-10T19:48:35.000Z | 2021-11-10T19:48:35.000Z | tests/unit_tests/routes_test.py | schmidtbri/rest-model-service | 0d1705cb62e6a942f90150da3bcf51e3e1265a25 | [
"BSD-3-Clause"
] | 1 | 2022-03-15T12:36:46.000Z | 2022-03-15T12:36:46.000Z | tests/unit_tests/routes_test.py | schmidtbri/rest-model-service | 0d1705cb62e6a942f90150da3bcf51e3e1265a25 | [
"BSD-3-Clause"
] | null | null | null | import os
from pathlib import Path
import unittest
import json
from starlette.testclient import TestClient
from ml_base.utilities import ModelManager
os.chdir(Path(__file__).resolve().parent.parent.parent)
os.environ["REST_CONFIG"] = "examples/rest_config.yaml"
from rest_model_service.main import app, create_app
fro... | 29.402878 | 113 | 0.54025 | import os
from pathlib import Path
import unittest
import json
from starlette.testclient import TestClient
from ml_base.utilities import ModelManager
os.chdir(Path(__file__).resolve().parent.parent.parent)
os.environ["REST_CONFIG"] = "examples/rest_config.yaml"
from rest_model_service.main import app, create_app
fro... | true | true |
f719cd368c417026551c16e8dd7e7961bff48f66 | 7,466 | py | Python | inverted-index/src/test_inverted_index.py | Illumaria/made-python-2020 | 7ec219ff1a5116925027646810ca4b294b1080d9 | [
"MIT"
] | 2 | 2021-07-08T10:59:44.000Z | 2021-09-06T07:44:24.000Z | inverted-index/src/test_inverted_index.py | Illumaria/made-python | 7ec219ff1a5116925027646810ca4b294b1080d9 | [
"MIT"
] | null | null | null | inverted-index/src/test_inverted_index.py | Illumaria/made-python | 7ec219ff1a5116925027646810ca4b294b1080d9 | [
"MIT"
] | null | null | null | from argparse import Namespace
from textwrap import dedent
import pytest
from inverted_index import InvertedIndex
from inverted_index import build_inverted_index
from inverted_index import DEFAULT_INVERTED_INDEX_SAVE_PATH
from inverted_index import callback_query, process_queries
from inverted_index import callback_b... | 32.889868 | 94 | 0.721939 | from argparse import Namespace
from textwrap import dedent
import pytest
from inverted_index import InvertedIndex
from inverted_index import build_inverted_index
from inverted_index import DEFAULT_INVERTED_INDEX_SAVE_PATH
from inverted_index import callback_query, process_queries
from inverted_index import callback_b... | true | true |
f719ce9774a010e3d05576a84a6bbe9fff496778 | 3,460 | py | Python | purity_fb/purity_fb_1dot6/models/object_response.py | mabdelhafez/purity_fb_python_client | a9856875b3df43b4302a2e4addd1a6b71f51f5ce | [
"Apache-2.0"
] | null | null | null | purity_fb/purity_fb_1dot6/models/object_response.py | mabdelhafez/purity_fb_python_client | a9856875b3df43b4302a2e4addd1a6b71f51f5ce | [
"Apache-2.0"
] | null | null | null | purity_fb/purity_fb_1dot6/models/object_response.py | mabdelhafez/purity_fb_python_client | a9856875b3df43b4302a2e4addd1a6b71f51f5ce | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Pure Storage FlashBlade REST 1.6 Python SDK
Pure Storage FlashBlade REST 1.6 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.6
Contact: i... | 27.460317 | 204 | 0.578324 |
from pprint import pformat
from six import iteritems
import re
class ObjectResponse(object):
swagger_types = {
'pagination_info': 'PaginationInfo'
}
attribute_map = {
'pagination_info': 'pagination_info'
}
def __init__(self, pagination_info=None):
self._pagination_i... | true | true |
f719cf9df16d97ce0c0637dc8db52aa8046af0f1 | 6,350 | py | Python | deeppages/utils.py | ricardofalasca/deep-pages | d1b2a48f62c31e20d767df5c6345e07e4d05290d | [
"MIT"
] | null | null | null | deeppages/utils.py | ricardofalasca/deep-pages | d1b2a48f62c31e20d767df5c6345e07e4d05290d | [
"MIT"
] | null | null | null | deeppages/utils.py | ricardofalasca/deep-pages | d1b2a48f62c31e20d767df5c6345e07e4d05290d | [
"MIT"
] | null | null | null | from django.template import Template, Context
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from django.db.models import Q
from django.urls import reverse, NoReverseMatch
from django.core.exceptions import ObjectDoesNotExist
from .signals import page_found, page_not_found, page_... | 29.398148 | 79 | 0.649291 | from django.template import Template, Context
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from django.db.models import Q
from django.urls import reverse, NoReverseMatch
from django.core.exceptions import ObjectDoesNotExist
from .signals import page_found, page_not_found, page_... | true | true |
f719cfd1f03d71fd7a99b8b868b8442eb5dcb3c5 | 26,423 | py | Python | cabot_ui/src/cabot_ui/geojson.py | kufusha/cabot | 52a40a39a29f0bd79b6fdd8f961708e09fda9a51 | [
"MIT"
] | null | null | null | cabot_ui/src/cabot_ui/geojson.py | kufusha/cabot | 52a40a39a29f0bd79b6fdd8f961708e09fda9a51 | [
"MIT"
] | null | null | null | cabot_ui/src/cabot_ui/geojson.py | kufusha/cabot | 52a40a39a29f0bd79b6fdd8f961708e09fda9a51 | [
"MIT"
] | null | null | null | # Copyright (c) 2020 Carnegie Mellon University
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... | 32.027879 | 110 | 0.590357 |
import sys
import traceback
import copy
import math
import json
import scipy
import scipy.spatial
import numpy
import numpy.linalg
import rospy
import tf
import angles
import geometry_msgs.msg
from cabot_ui import geoutil, i18n
class Geometry(object):
@classmethod
def marshal(cls, dic):
if 'type'... | true | true |
f719cfe9dbb5d0f42f324f0f2d5937b2e5f17212 | 1,481 | py | Python | Code Bundle/Chapter02/tests/test_checks.py | ghanigreen/pytest_code | dbdcc322b3469c62ad328043060518edf2b2d83f | [
"MIT"
] | 46 | 2018-06-28T04:40:08.000Z | 2022-02-14T05:36:48.000Z | Code Bundle/Chapter02/tests/test_checks.py | ghanigreen/pytest_code | dbdcc322b3469c62ad328043060518edf2b2d83f | [
"MIT"
] | null | null | null | Code Bundle/Chapter02/tests/test_checks.py | ghanigreen/pytest_code | dbdcc322b3469c62ad328043060518edf2b2d83f | [
"MIT"
] | 22 | 2018-06-10T23:20:29.000Z | 2022-02-24T06:47:18.000Z | import pytest
class InvalidCharacterNameError(Exception):
pass
class InvalidClassNameError(Exception):
pass
class Character:
pass
VALID_CLASSES = ["sorcerer", "warrior"]
def create_character(name: str, class_name: str) -> Character:
"""
Creates a new character and inserts it into the datab... | 22.439394 | 65 | 0.694126 | import pytest
class InvalidCharacterNameError(Exception):
pass
class InvalidClassNameError(Exception):
pass
class Character:
pass
VALID_CLASSES = ["sorcerer", "warrior"]
def create_character(name: str, class_name: str) -> Character:
if not name:
raise InvalidCharacterNameError("charact... | true | true |
f719d091d9d47a5add06aa4cc9f22b144941b945 | 1,379 | py | Python | plantara/urls.py | plantara/plantara-backend | 3e3cf1f7aa83a124b7e1b616e44aa1f31333598e | [
"MIT"
] | null | null | null | plantara/urls.py | plantara/plantara-backend | 3e3cf1f7aa83a124b7e1b616e44aa1f31333598e | [
"MIT"
] | null | null | null | plantara/urls.py | plantara/plantara-backend | 3e3cf1f7aa83a124b7e1b616e44aa1f31333598e | [
"MIT"
] | null | null | null | """plantara URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... | 33.634146 | 77 | 0.730964 | from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from plantara.contrib.users.views import UserViewSet, ObtainAuthToken
from plantara.contrib.plants.views import PlantViewSet
router = DefaultRouter()
router.registe... | true | true |
f719d0cdcf3b09c0fae3b540dda5bf816f23f254 | 5,061 | py | Python | ipypublish/postprocessors/base.py | phelps-sg/ipypublish | c99ba56fbaeef033e3baeb3246143660ac7eb78e | [
"BSD-3-Clause"
] | null | null | null | ipypublish/postprocessors/base.py | phelps-sg/ipypublish | c99ba56fbaeef033e3baeb3246143660ac7eb78e | [
"BSD-3-Clause"
] | null | null | null | ipypublish/postprocessors/base.py | phelps-sg/ipypublish | c99ba56fbaeef033e3baeb3246143660ac7eb78e | [
"BSD-3-Clause"
] | 1 | 2021-02-09T01:12:10.000Z | 2021-02-09T01:12:10.000Z | import logging
from six import string_types
from traitlets import Bool
from traitlets.config.configurable import Configurable
from ipypublish.utils import handle_error, pathlib
try:
from shutil import which as exe_exists
except ImportError:
from distutils.spawn import find_executable as exe_exists # noqa: F... | 29.424419 | 86 | 0.601857 | import logging
from six import string_types
from traitlets import Bool
from traitlets.config.configurable import Configurable
from ipypublish.utils import handle_error, pathlib
try:
from shutil import which as exe_exists
except ImportError:
from distutils.spawn import find_executable as exe_exists
class I... | true | true |
f719d11806bbcb48ec4f51cc84eb95cd4e1c6804 | 2,201 | py | Python | glance/common/crypt.py | komawar/glance | e550cac697dd8c78e837c6884f599ac6ee2137ae | [
"Apache-2.0"
] | 1 | 2018-07-27T15:16:14.000Z | 2018-07-27T15:16:14.000Z | glance/common/crypt.py | komawar/glance | e550cac697dd8c78e837c6884f599ac6ee2137ae | [
"Apache-2.0"
] | null | null | null | glance/common/crypt.py | komawar/glance | e550cac697dd8c78e837c6884f599ac6ee2137ae | [
"Apache-2.0"
] | 1 | 2021-07-18T18:57:04.000Z | 2021-07-18T18:57:04.000Z | #!/usr/bin/env python
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | 32.367647 | 78 | 0.695593 |
import base64
from Crypto.Cipher import AES
from Crypto import Random
from Crypto.Random import random
def urlsafe_encrypt(key, plaintext, blocksize=16):
def pad(text):
pad_length = (blocksize - len(text) % blocksize)
sr = random.StrongRandom()
pad = ''.join(chr(sr.randint(1, 0xFF)) fo... | true | true |
f719d17e244fc2d7cacd2371cabf35fc5edcbac2 | 2,609 | py | Python | img-placeholder.py | fisker/img-placeholder | d4b42551b41a546553a47358b9bb616c6492b2da | [
"MIT"
] | 3 | 2017-01-17T05:40:10.000Z | 2022-01-17T02:42:35.000Z | img-placeholder.py | fisker/img-placeholder | d4b42551b41a546553a47358b9bb616c6492b2da | [
"MIT"
] | 1 | 2017-01-15T15:34:58.000Z | 2017-01-16T05:28:34.000Z | img-placeholder.py | fisker/img-placeholder | d4b42551b41a546553a47358b9bb616c6492b2da | [
"MIT"
] | 1 | 2017-01-14T12:00:55.000Z | 2017-01-14T12:00:55.000Z | import sublime
import sublime_plugin
import re
completions = []
def plugin_loaded():
init_settings()
def init_settings():
get_settings()
sublime.load_settings('img-placeholder.sublime-settings').add_on_change('get_settings', get_settings)
def get_settings():
settings = sublime.load_settings('img-pla... | 30.694118 | 132 | 0.576849 | import sublime
import sublime_plugin
import re
completions = []
def plugin_loaded():
init_settings()
def init_settings():
get_settings()
sublime.load_settings('img-placeholder.sublime-settings').add_on_change('get_settings', get_settings)
def get_settings():
settings = sublime.load_settings('img-pla... | true | true |
f719d17e359c308c58ea4e556083c454e5d757ed | 39,475 | py | Python | bockbuild/package.py | lewurm/bockbuild | dbe4185d21318a1c09d35c878b560176ac02c2b3 | [
"MIT"
] | null | null | null | bockbuild/package.py | lewurm/bockbuild | dbe4185d21318a1c09d35c878b560176ac02c2b3 | [
"MIT"
] | null | null | null | bockbuild/package.py | lewurm/bockbuild | dbe4185d21318a1c09d35c878b560176ac02c2b3 | [
"MIT"
] | null | null | null | import hashlib
import os
import sys
import shutil
import tempfile
import filecmp
import datetime
import stat
import time
import urllib
from util.util import *
import functools
# FancyURLopener is incorrectly documented; this working handler was
# copied from
# https://mail.python.org/pipermail/python-bugs-list/2006-F... | 37.417062 | 194 | 0.555263 | import hashlib
import os
import sys
import shutil
import tempfile
import filecmp
import datetime
import stat
import time
import urllib
from util.util import *
import functools
class MyUrlOpener(urllib.FancyURLopener):
def http_error_default(*args, **kwargs):
return urllib.URLopener.http_error_default(*ar... | false | true |
f719d3c75df148a6ceda79acf57bc0e57342d5f3 | 4,311 | py | Python | src/test.py | alexey-kaz/python-project | 661fe06e09846cd1c3c6d600973a6e3433096c1d | [
"MIT"
] | null | null | null | src/test.py | alexey-kaz/python-project | 661fe06e09846cd1c3c6d600973a6e3433096c1d | [
"MIT"
] | null | null | null | src/test.py | alexey-kaz/python-project | 661fe06e09846cd1c3c6d600973a6e3433096c1d | [
"MIT"
] | 3 | 2021-04-25T06:37:26.000Z | 2021-06-03T19:19:19.000Z | """Тест."""
import unittest
from recipes import form_answer
from database import delete_table_data
from parsing import NEWS, AFISHA, HOROSCOPE, WEATHER
class TestBot(unittest.TestCase):
"""Тест."""
def test_form_answer(self):
"""Тест."""
rec1 = {"name": "Булочки с изюмом",
"in... | 29.527397 | 89 | 0.567618 | import unittest
from recipes import form_answer
from database import delete_table_data
from parsing import NEWS, AFISHA, HOROSCOPE, WEATHER
class TestBot(unittest.TestCase):
def test_form_answer(self):
rec1 = {"name": "Булочки с изюмом",
"ingrs": ["Мука", "Яйцо куриное", "Изюм"],
... | true | true |
f719d4ecd4826b2aad60d635215f0987148b894f | 7,097 | py | Python | vendor/bundle/ruby/2.3.0/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.10/libxml2-2.9.10/python/setup.py | emsommers/futureDocs | 344524234d024a532716a8ad4162aad00a455e8b | [
"CC0-1.0"
] | null | null | null | vendor/bundle/ruby/2.3.0/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.10/libxml2-2.9.10/python/setup.py | emsommers/futureDocs | 344524234d024a532716a8ad4162aad00a455e8b | [
"CC0-1.0"
] | null | null | null | vendor/bundle/ruby/2.3.0/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.10/libxml2-2.9.10/python/setup.py | emsommers/futureDocs | 344524234d024a532716a8ad4162aad00a455e8b | [
"CC0-1.0"
] | null | null | null | #!/usr/bin/python -u
#
# Setup script for libxml2 and libxslt if found
#
import sys, os
from distutils.core import setup, Extension
# Below ROOT, we expect to find include, include/libxml2, lib and bin.
# On *nix, it is not needed (but should not harm),
# on Windows, it is set by configure.js.
ROOT = r'/Users/emsommer... | 29.205761 | 144 | 0.610117 | import sys, os
from distutils.core import setup, Extension
ROOT = r'/Users/emsommers/Documents/GitHub/futureDocs/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.10.10/ports/x86_64-apple-darwin17/libxml2/2.9.10'
with_threads = 1
WITHDLLS = 1 and sys.platform.startswith('win')
def missing(file):
if os.access(file, os.R_... | true | true |
f719d938c36fb80ad1c9ea86ac17254b9fc23390 | 50,482 | py | Python | pyGPs/Core/gp.py | Corentin-LF/pyGPs | b9d36777584cd53756bd4311c3c20ea52e945451 | [
"BSD-2-Clause"
] | null | null | null | pyGPs/Core/gp.py | Corentin-LF/pyGPs | b9d36777584cd53756bd4311c3c20ea52e945451 | [
"BSD-2-Clause"
] | null | null | null | pyGPs/Core/gp.py | Corentin-LF/pyGPs | b9d36777584cd53756bd4311c3c20ea52e945451 | [
"BSD-2-Clause"
] | null | null | null | from __future__ import division
from __future__ import absolute_import
from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
#================================================================================
# Marion Neumann [marion dot neumann at uni-bonn dot ... | 40.450321 | 156 | 0.563389 | from __future__ import division
from __future__ import absolute_import
from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
import itertools
import numpy as np
import matplotlib.pyplot as plt
from . import inf, mean, lik, cov, opt
from .tools import unique, ji... | true | true |
f719d9b90696ca91133528a980477a87a5e8550f | 3,619 | py | Python | tfx/components/example_gen/custom_executors/parquet_executor.py | NikeNano/tfx | 8f7756f223e3bd3bd5abe37fa287010509cdae75 | [
"Apache-2.0"
] | null | null | null | tfx/components/example_gen/custom_executors/parquet_executor.py | NikeNano/tfx | 8f7756f223e3bd3bd5abe37fa287010509cdae75 | [
"Apache-2.0"
] | null | null | null | tfx/components/example_gen/custom_executors/parquet_executor.py | NikeNano/tfx | 8f7756f223e3bd3bd5abe37fa287010509cdae75 | [
"Apache-2.0"
] | null | null | null | # Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... | 36.928571 | 87 | 0.762089 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from typing import Any, Dict, Text
from absl import logging
import apache_beam as beam
import tensorflow as tf
from tfx.components.example_gen import utils
from tfx.components.example_gen.base_examp... | true | true |
f719dc710e799dfa2967b8713a4d68b60594d1ec | 8,170 | py | Python | Tests/compat/sbs_builtin.py | dsonbill/IronPython3-NETCore | 8c76bdbec1754233f04b41ecd28e9bae2c862fd0 | [
"Apache-2.0"
] | 2 | 2019-09-21T22:22:30.000Z | 2020-05-09T12:45:51.000Z | Tests/compat/sbs_builtin.py | dsonbill/IronPython3-NETCore | 8c76bdbec1754233f04b41ecd28e9bae2c862fd0 | [
"Apache-2.0"
] | null | null | null | Tests/compat/sbs_builtin.py | dsonbill/IronPython3-NETCore | 8c76bdbec1754233f04b41ecd28e9bae2c862fd0 | [
"Apache-2.0"
] | null | null | null | #####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... | 35.991189 | 161 | 0.408813 |
from common import *
import testdata
import sys
def complex_case_repr(*args):
ret = "complex with "
for x in args:
ret += "'%s (%s)'" % (str(x), type(x))
return ret
class test_builtin(object):
def test_slice(self):
test_str = testdata.long_string
str_len = len(tes... | true | true |
f719dc95d1f1ad1b119e769f41c66e49e76fe5d2 | 695 | py | Python | abastece/migrations/0006_auto_20210531_1145.py | lembon/atizar | 579ef6212e9b2582beb86c5e14339b0615ec16ee | [
"Apache-2.0"
] | null | null | null | abastece/migrations/0006_auto_20210531_1145.py | lembon/atizar | 579ef6212e9b2582beb86c5e14339b0615ec16ee | [
"Apache-2.0"
] | null | null | null | abastece/migrations/0006_auto_20210531_1145.py | lembon/atizar | 579ef6212e9b2582beb86c5e14339b0615ec16ee | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.1.2 on 2021-05-31 14:45
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abastece', '0005_auto_20210528_1946'),
]
operations = [
migrations.AlterField(
model_name='pedido',
... | 26.730769 | 114 | 0.574101 |
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abastece', '0005_auto_20210528_1946'),
]
operations = [
migrations.AlterField(
model_name='pedido',
name='timestamp',
field=models.DateT... | true | true |
f719dd4e36211e0181b4b0387c2d5462aad335b3 | 1,305 | py | Python | lib/surface/meta/apis/collections/describe.py | bopopescu/Google-Cloud-SDK-1 | c4683bacb2f6192d8a816932e438a0493085469b | [
"Apache-2.0"
] | null | null | null | lib/surface/meta/apis/collections/describe.py | bopopescu/Google-Cloud-SDK-1 | c4683bacb2f6192d8a816932e438a0493085469b | [
"Apache-2.0"
] | null | null | null | lib/surface/meta/apis/collections/describe.py | bopopescu/Google-Cloud-SDK-1 | c4683bacb2f6192d8a816932e438a0493085469b | [
"Apache-2.0"
] | 1 | 2020-07-24T20:13:29.000Z | 2020-07-24T20:13:29.000Z | # Copyright 2015 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 by applicable law or ag... | 36.25 | 74 | 0.738697 |
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.meta.apis import flags
from googlecloudsdk.command_lib.util.apis import registry
class Describe(base.DescribeCommand):
@staticmethod
def Args(parser):
flags.API_VERSION_FLAG.AddToParser(parser)
parser.add_argument(
'collec... | true | true |
f719df2ec061fcd0ec591c84a3ef60c4759b669f | 3,398 | py | Python | tests/data_generation/animate_berlin_y_stretch.py | Algomorph/NeuralTracking | 6312be8e18828344c65e25a423c239efcd3428dd | [
"Apache-2.0"
] | 3 | 2021-04-18T04:23:08.000Z | 2022-02-01T08:37:51.000Z | tests/data_generation/animate_berlin_y_stretch.py | Algomorph/NeuralTracking | 6312be8e18828344c65e25a423c239efcd3428dd | [
"Apache-2.0"
] | 24 | 2021-05-28T21:59:11.000Z | 2022-02-03T16:09:41.000Z | tests/data_generation/animate_berlin_y_stretch.py | Algomorph/NeuralTracking | 6312be8e18828344c65e25a423c239efcd3428dd | [
"Apache-2.0"
] | 5 | 2021-03-10T02:56:16.000Z | 2021-12-14T06:04:50.000Z | import sys
import os
import shutil
import cv2
import open3d as o3d
import open3d.core as o3c
import numpy as np
from rendering.pytorch3d_renderer import PyTorch3DRenderer
from data import StandaloneFrameDataset
import data.presets as presets
import tsdf.default_voxel_grid
import data.camera
from settings import proce... | 43.564103 | 138 | 0.751619 | import sys
import os
import shutil
import cv2
import open3d as o3d
import open3d.core as o3c
import numpy as np
from rendering.pytorch3d_renderer import PyTorch3DRenderer
from data import StandaloneFrameDataset
import data.presets as presets
import tsdf.default_voxel_grid
import data.camera
from settings import proce... | true | true |
f719dfc68869c7b36d4086ce6861e839d17b9e4c | 338 | py | Python | src/utils.py | delbio/maze | cbc58ebb2c54f300f6413b770b57b0cab0750672 | [
"MIT"
] | null | null | null | src/utils.py | delbio/maze | cbc58ebb2c54f300f6413b770b57b0cab0750672 | [
"MIT"
] | null | null | null | src/utils.py | delbio/maze | cbc58ebb2c54f300f6413b770b57b0cab0750672 | [
"MIT"
] | null | null | null |
def rotate_counterclockwise(array_2d):
list_of_tuples = zip(*array_2d[::])
return [list(elem) for elem in list_of_tuples]
def rotate_clockwise(array_2d):
"""
Code copied by: https://stackoverflow.com/a/48444999/3753724
"""
list_of_tuples = zip(*array_2d[::-1])
return [list(elem) for elem i... | 28.166667 | 64 | 0.695266 |
def rotate_counterclockwise(array_2d):
list_of_tuples = zip(*array_2d[::])
return [list(elem) for elem in list_of_tuples]
def rotate_clockwise(array_2d):
list_of_tuples = zip(*array_2d[::-1])
return [list(elem) for elem in list_of_tuples]
| true | true |
f719e02577fb8babdf4f9190cb1e562309acb229 | 5,806 | py | Python | sdk/python/pulumi_alicloud/fc/get_triggers.py | pulumi/pulumi-alicloud | 9c34d84b4588a7c885c6bec1f03b5016e5a41683 | [
"ECL-2.0",
"Apache-2.0"
] | 42 | 2019-03-18T06:34:37.000Z | 2022-03-24T07:08:57.000Z | sdk/python/pulumi_alicloud/fc/get_triggers.py | pulumi/pulumi-alicloud | 9c34d84b4588a7c885c6bec1f03b5016e5a41683 | [
"ECL-2.0",
"Apache-2.0"
] | 152 | 2019-04-15T21:03:44.000Z | 2022-03-29T18:00:57.000Z | sdk/python/pulumi_alicloud/fc/get_triggers.py | pulumi/pulumi-alicloud | 9c34d84b4588a7c885c6bec1f03b5016e5a41683 | [
"ECL-2.0",
"Apache-2.0"
] | 3 | 2020-08-26T17:30:07.000Z | 2021-07-05T01:37:45.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 34.975904 | 147 | 0.650189 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
__all__ = [
'GetTriggersResult',
'AwaitableGetTriggersResult',
'get_triggers',
]
@pulumi.output_type
class GetTriggersResult:
def __... | true | true |
f719e0a27fcf5d467cb187747490a3e0cc93edc0 | 2,159 | py | Python | py-games/first_game/part1.py | martanunesdea/cpp-shop-management | ed9371e8b5d6c5b3bdc31385158c747ea538046d | [
"MIT"
] | null | null | null | py-games/first_game/part1.py | martanunesdea/cpp-shop-management | ed9371e8b5d6c5b3bdc31385158c747ea538046d | [
"MIT"
] | null | null | null | py-games/first_game/part1.py | martanunesdea/cpp-shop-management | ed9371e8b5d6c5b3bdc31385158c747ea538046d | [
"MIT"
] | 1 | 2021-01-18T21:14:31.000Z | 2021-01-18T21:14:31.000Z | import pygame, sys
from pygame.locals import *
import random
#### GAME SETUP ######
pygame.init()
FPS = 60
FramePerSec = pygame.time.Clock()
# Defining game constants
RED = (255, 0, 0)
WHITE = (255, 255, 255)
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 600
GAME_NAME = "Dodge The Enemy"
SCORE = 0
# Creating the main surfa... | 26.654321 | 95 | 0.610468 | import pygame, sys
from pygame.locals import *
import random
pygame.init()
FPS = 60
FramePerSec = pygame.time.Clock()
RED = (255, 0, 0)
WHITE = (255, 255, 255)
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 600
GAME_NAME = "Dodge The Enemy"
SCORE = 0
DISPLAYSURF = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
DISPLA... | true | true |
f719e0a51e64125bb5ced9ad77431d75f5d0af9c | 2,550 | py | Python | new_model/test_big.py | aliabid2243/deepgaze | 8c602db89a1d1d8a644b44a381ddb8a693375e08 | [
"MIT"
] | 2 | 2019-02-24T15:03:19.000Z | 2019-07-29T09:06:33.000Z | new_model/test_big.py | aliabid2243/deepgaze | 8c602db89a1d1d8a644b44a381ddb8a693375e08 | [
"MIT"
] | null | null | null | new_model/test_big.py | aliabid2243/deepgaze | 8c602db89a1d1d8a644b44a381ddb8a693375e08 | [
"MIT"
] | null | null | null | import os
from load_data import load_batch, load_data_names, load_batch_from_names, load_batch_from_names_random
from my_model import get_eye_tracker_model
import numpy as np
from keras.models import load_model
from keras.optimizers import SGD, adam
def generator(data, batch_size, img_cols, img_rows, img_ch):
whi... | 28.651685 | 130 | 0.65098 | import os
from load_data import load_batch, load_data_names, load_batch_from_names, load_batch_from_names_random
from my_model import get_eye_tracker_model
import numpy as np
from keras.models import load_model
from keras.optimizers import SGD, adam
def generator(data, batch_size, img_cols, img_rows, img_ch):
whi... | true | true |
f719e0c57fd4991be0a999dbdc1c3d13878ecbff | 9,695 | py | Python | src/collectors/diskspace/diskspace.py | smartattack/Diamond | 0559cb212559a852fce9a3cdb8643c1d129f41d4 | [
"MIT"
] | null | null | null | src/collectors/diskspace/diskspace.py | smartattack/Diamond | 0559cb212559a852fce9a3cdb8643c1d129f41d4 | [
"MIT"
] | 1 | 2022-02-22T08:46:21.000Z | 2022-02-22T12:56:05.000Z | src/collectors/diskspace/diskspace.py | hostedgraphite/Diamond | e70fe7d358897ef9082c8778fba288215788b3d5 | [
"MIT"
] | null | null | null | # coding=utf-8
"""
Uses /proc/mounts and os.statvfs() to get disk space usage
#### Dependencies
* /proc/mounts
#### Examples
# no exclude filters at all
exclude_filters =,
# exclude everything that begins /boot or /mnt
exclude_filters = ^/boot, ^/mnt
# exclude everything that includes the le... | 35.774908 | 79 | 0.513357 |
import diamond.collector
import diamond.convertor
import os
import re
try:
import psutil
except ImportError:
psutil = None
class DiskSpaceCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(DiskSpaceCollector, self).get_default_config_help()
c... | true | true |
f719e23150154f51fed830c34ef140c0f8e124fa | 1,831 | py | Python | backend/app/api/api_v1/endpoints/users.py | BartlomiejRasztabiga/Rentally | ba70199d329895a5295ceddd0ecc4c61928890dd | [
"MIT"
] | 2 | 2021-01-11T23:24:29.000Z | 2021-01-12T09:55:58.000Z | backend/app/api/api_v1/endpoints/users.py | BartlomiejRasztabiga/Rentally | ba70199d329895a5295ceddd0ecc4c61928890dd | [
"MIT"
] | null | null | null | backend/app/api/api_v1/endpoints/users.py | BartlomiejRasztabiga/Rentally | ba70199d329895a5295ceddd0ecc4c61928890dd | [
"MIT"
] | null | null | null | from typing import Any, List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app import models, schemas, services
from app.api import deps
router = APIRouter()
@router.get("/", response_model=List[schemas.User])
def read_users(
db: Session = Depends(deps.get_db),
... | 25.082192 | 79 | 0.666303 | from typing import Any, List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app import models, schemas, services
from app.api import deps
router = APIRouter()
@router.get("/", response_model=List[schemas.User])
def read_users(
db: Session = Depends(deps.get_db),
... | true | true |
f719e2f9ea943ab752ebf80ab241bf9d6a0bde56 | 273 | py | Python | urls.py | ActuallyZach/in_app_purchase_receipt_verifier | f342809bcc2a16a34de3cccf965f0821a5bd552b | [
"Apache-2.0"
] | 1 | 2021-12-10T09:59:17.000Z | 2021-12-10T09:59:17.000Z | urls.py | ActuallyZach/in_app_purchase_receipt_verifier | f342809bcc2a16a34de3cccf965f0821a5bd552b | [
"Apache-2.0"
] | null | null | null | urls.py | ActuallyZach/in_app_purchase_receipt_verifier | f342809bcc2a16a34de3cccf965f0821a5bd552b | [
"Apache-2.0"
] | null | null | null | from django.conf.urls import include, url
from django.http import HttpResponse
from app import views
urlpatterns = [
url(r'^verify', views.verify_receipt),
url('verify/scum', views.verify_receipt_scum),
url('verify/jellycuts', views.verify_receipt_jelly),
]
| 22.75 | 56 | 0.747253 | from django.conf.urls import include, url
from django.http import HttpResponse
from app import views
urlpatterns = [
url(r'^verify', views.verify_receipt),
url('verify/scum', views.verify_receipt_scum),
url('verify/jellycuts', views.verify_receipt_jelly),
]
| true | true |
f719e312e4286ce9cdd25018ce166a3a13eee31c | 6,014 | py | Python | nikola/plugins/compile/rest/post_list.py | pellenilsson/nikola | 67a944a40b35584525a1bb363b3abd85582704cb | [
"MIT"
] | 1 | 2015-11-06T01:07:29.000Z | 2015-11-06T01:07:29.000Z | nikola/plugins/compile/rest/post_list.py | pellenilsson/nikola | 67a944a40b35584525a1bb363b3abd85582704cb | [
"MIT"
] | null | null | null | nikola/plugins/compile/rest/post_list.py | pellenilsson/nikola | 67a944a40b35584525a1bb363b3abd85582704cb | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright © 2013-2014 Udo Spallek, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
#... | 33.977401 | 92 | 0.617559 |
from __future__ import unicode_literals
import uuid
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from nikola import utils
from nikola.plugin_categories import RestExtension
class Plugin(RestExtension):
name = "rest_post_list"
def set_site(self, site):
self.s... | true | true |
f719e34865d33ff09f68d04ec4e19add1ab00e5b | 5,344 | py | Python | analysis.py | edpolanco/air_cargo | 20ddf6c72dafed85b87486ca46a9c09656f31d90 | [
"MIT"
] | null | null | null | analysis.py | edpolanco/air_cargo | 20ddf6c72dafed85b87486ca46a9c09656f31d90 | [
"MIT"
] | null | null | null | analysis.py | edpolanco/air_cargo | 20ddf6c72dafed85b87486ca46a9c09656f31d90 | [
"MIT"
] | null | null | null | """Module for summarizing cargo planning testing results.
Ed Polanco
ed.polanco@outlook.com
"""
import pandas as pd
from collections import OrderedDict
import datetime
import time
from aimacode.search import Problem, Node
from timeit import default_timer as timer
from run_search import PrintableProblem, PROBL... | 36.60274 | 98 | 0.595434 | import pandas as pd
from collections import OrderedDict
import datetime
import time
from aimacode.search import Problem, Node
from timeit import default_timer as timer
from run_search import PrintableProblem, PROBLEMS
from aimacode.search import (breadth_first_search, astar_search,
breadth_first_tree_search, depth... | true | true |
f719e4fc1c2f57473dc26131829f497ab8dd2ff2 | 854 | py | Python | autogl/module/nas/estimator/one_shot.py | THUMNLab/AutoGL | 9dfcabcda41620a7d12d6322f0e52e68dd7dcec4 | [
"Apache-2.0"
] | 824 | 2020-11-30T14:38:07.000Z | 2022-03-19T10:14:04.000Z | autogl/module/nas/estimator/one_shot.py | MitchellTesla/AutoGL | 7b551961e90f5042d9b91d92c083f3f09dd9dbdd | [
"Apache-2.0"
] | 38 | 2020-12-21T12:32:57.000Z | 2022-01-31T02:32:05.000Z | autogl/module/nas/estimator/one_shot.py | MitchellTesla/AutoGL | 7b551961e90f5042d9b91d92c083f3f09dd9dbdd | [
"Apache-2.0"
] | 85 | 2020-12-21T05:16:09.000Z | 2022-03-28T08:44:22.000Z | import torch.nn as nn
import torch.nn.functional as F
from . import register_nas_estimator
from ..space import BaseSpace
from .base import BaseEstimator
@register_nas_estimator("oneshot")
class OneShotEstimator(BaseEstimator):
"""
One shot estimator.
Use model directly to get estimations.
"""
d... | 30.5 | 69 | 0.640515 | import torch.nn as nn
import torch.nn.functional as F
from . import register_nas_estimator
from ..space import BaseSpace
from .base import BaseEstimator
@register_nas_estimator("oneshot")
class OneShotEstimator(BaseEstimator):
def infer(self, model: BaseSpace, dataset, mask="train"):
device = next(model... | true | true |
f719e58172c6f8335918d776edd53b5bed9dae39 | 13,398 | py | Python | vissl/optimizers/optimizer_helper.py | tjdbsrud/vissl | 1cf1ee0c82c8a0d65544b82a6fc2f28c7d5eb175 | [
"MIT"
] | 3 | 2021-07-08T15:06:49.000Z | 2021-08-13T18:55:02.000Z | vissl/optimizers/optimizer_helper.py | pzharrington/vissl | b647c256447af7ea66655811849be1f642377db8 | [
"MIT"
] | 2 | 2021-07-25T15:46:07.000Z | 2021-08-11T10:08:53.000Z | vissl/optimizers/optimizer_helper.py | pzharrington/vissl | b647c256447af7ea66655811849be1f642377db8 | [
"MIT"
] | 2 | 2021-07-08T15:15:55.000Z | 2021-08-25T14:16:01.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import Any, List
import torch.nn as nn
from vissl.utils.misc import is_apex_available
_CONV_TYPES = (nn.Conv1d, n... | 40.847561 | 88 | 0.657785 |
import logging
from typing import Any, List
import torch.nn as nn
from vissl.utils.misc import is_apex_available
_CONV_TYPES = (nn.Conv1d, nn.Conv2d, nn.Conv3d)
_NORM_TYPES = (
nn.BatchNorm1d,
nn.BatchNorm2d,
nn.BatchNorm3d,
nn.SyncBatchNorm, nn.LayerNorm,
)
if is_apex_available():
impor... | true | true |
f719e5ce46b0b141781817964a94f8d39288893c | 6,959 | py | Python | src/ggrc_workflows/migrations/versions/20150707143127_44047daa31a9_add_non_adjusted_next_cycle_start_date.py | trevordonnelly/ggrc-core | 499cf0d3cce70737b080991b12c203ec22015cea | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2018-03-30T11:28:48.000Z | 2018-03-30T11:28:48.000Z | src/ggrc_workflows/migrations/versions/20150707143127_44047daa31a9_add_non_adjusted_next_cycle_start_date.py | trevordonnelly/ggrc-core | 499cf0d3cce70737b080991b12c203ec22015cea | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/ggrc_workflows/migrations/versions/20150707143127_44047daa31a9_add_non_adjusted_next_cycle_start_date.py | trevordonnelly/ggrc-core | 499cf0d3cce70737b080991b12c203ec22015cea | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Add non-adjusted next cycle start date
Revision ID: 44047daa31a9
Revises: 1431e7094e26
Create Date: 2015-07-07 14:31:27.780564
"""
# Workaround legacy code which blocks Workflow new attribute addition
... | 38.027322 | 80 | 0.601523 |
revision = '44047daa31a9'
down_revision = '4840f4760f4b'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('workflows',
sa.Column('non_adjusted_next_cycle_start_date',
sa.Date(), nullable=True))
return
workflows = db.session.q... | true | true |
f719e6b707f00ff2d2978971d22b48f62a159092 | 4,228 | py | Python | vise/analyzer/dielectric_function.py | kumagai-group/vise | 8adfe61ad8f31767ec562f02f271e2495f357cd4 | [
"MIT"
] | 16 | 2020-07-14T13:14:05.000Z | 2022-03-04T13:39:30.000Z | vise/analyzer/dielectric_function.py | kumagai-group/vise | 8adfe61ad8f31767ec562f02f271e2495f357cd4 | [
"MIT"
] | 10 | 2021-03-15T20:47:45.000Z | 2021-08-19T00:47:12.000Z | vise/analyzer/dielectric_function.py | kumagai-group/vise | 8adfe61ad8f31767ec562f02f271e2495f357cd4 | [
"MIT"
] | 6 | 2020-03-03T00:42:39.000Z | 2022-02-22T02:34:47.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from dataclasses import dataclass
from math import sqrt, pi
from typing import List
import numpy as np
from monty.json import MSONable
from tqdm import tqdm
from vise.util.mix_in import ToJsonFileMixIn
from scipy.constants i... | 37.087719 | 80 | 0.565989 | from dataclasses import dataclass
from math import sqrt, pi
from typing import List
import numpy as np
from monty.json import MSONable
from tqdm import tqdm
from vise.util.mix_in import ToJsonFileMixIn
from scipy.constants import physical_constants as pc
eV_to_inv_cm = pc["electron volt-inverse meter relationship"][0... | true | true |
f719e7006ad29396ce30e456e8d231c230206adc | 2,488 | py | Python | main.py | Kiny-Kiny/WordlistCreator | 3492f8176959beca23fa22877f2923c74ca6bf89 | [
"BSD-3-Clause"
] | 2 | 2021-10-31T15:38:55.000Z | 2021-12-12T06:20:20.000Z | main.py | Kiny-Kiny/WordlistCreator | 3492f8176959beca23fa22877f2923c74ca6bf89 | [
"BSD-3-Clause"
] | null | null | null | main.py | Kiny-Kiny/WordlistCreator | 3492f8176959beca23fa22877f2923c74ca6bf89 | [
"BSD-3-Clause"
] | null | null | null | # Recomendação : Use apenas se seu computador/celular for bom.
# Autor : Kiny
# Pix : (61) 9603-5417
# Github : https://github.com/Kiny-Kiny
# WhatsApp : http://wa.me/552179180533
# Telegram : @K_iny
# Instagram : @parziovanni
# Twitter : @KinyBruno
################################... | 27.043478 | 140 | 0.513264 | from itertools import product;
from sys import argv,stdout;
from time import sleep;
from os import system;
global R,B,C,G
R='\033[1;31m';
B='\033[1;34m';
C='\033[1;37m';
G='\033[1;32m';
def slow(msg):
for i in msg: stdout.write(i);sleep(0.007);stdout.flush();
def clear(): system('cls||clear');
logo=B+''' __ __ ... | true | true |
f719e8a05896b96ec0c6d21c07a0f99539976e6a | 3,839 | py | Python | apps/osis/tests/osisbasic__test.py | Jumpscale/jumpscale6_core | 0502ddc1abab3c37ed982c142d21ea3955d471d3 | [
"BSD-2-Clause"
] | 1 | 2015-10-26T10:38:13.000Z | 2015-10-26T10:38:13.000Z | apps/osis/tests/osisbasic__test.py | Jumpscale/jumpscale6_core | 0502ddc1abab3c37ed982c142d21ea3955d471d3 | [
"BSD-2-Clause"
] | null | null | null | apps/osis/tests/osisbasic__test.py | Jumpscale/jumpscale6_core | 0502ddc1abab3c37ed982c142d21ea3955d471d3 | [
"BSD-2-Clause"
] | null | null | null | import unittest
import re
import time
from JumpScale import j
try:
import ujson as json
except:
import json
import random
descr = """
basic functioning of osis (test set)
"""
organization = "jumpscale"
author = "incubaid"
license = "bsd"
version = "1.0"
category = "osis.basic.testset"
enable=True
priority=1
s... | 29.530769 | 93 | 0.616567 | import unittest
import re
import time
from JumpScale import j
try:
import ujson as json
except:
import json
import random
descr = """
basic functioning of osis (test set)
"""
organization = "jumpscale"
author = "incubaid"
license = "bsd"
version = "1.0"
category = "osis.basic.testset"
enable=True
priority=1
s... | false | true |
f719e947d81719e7404f7f12a8aca3b32f7370bb | 66 | py | Python | core/__init__.py | berendkleinhaneveld/Registrationshop | 0d6f3ee5324865cdcb419369139f37c39dfe9a1c | [
"MIT"
] | 25 | 2015-11-08T16:36:54.000Z | 2022-01-20T16:03:28.000Z | core/__init__.py | berendkleinhaneveld/Registrationshop | 0d6f3ee5324865cdcb419369139f37c39dfe9a1c | [
"MIT"
] | 2 | 2016-12-01T23:13:08.000Z | 2017-07-25T02:40:49.000Z | core/__init__.py | berendkleinhaneveld/Registrationshop | 0d6f3ee5324865cdcb419369139f37c39dfe9a1c | [
"MIT"
] | 10 | 2016-07-05T14:39:16.000Z | 2022-01-01T02:05:55.000Z | from AppVars import AppVars
from AppResources import AppResources
| 22 | 37 | 0.878788 | from AppVars import AppVars
from AppResources import AppResources
| true | true |
f719e96b6824efbbe4833272ec5ec4b37e319c12 | 2,894 | py | Python | test/functional/interface_bitcoin_cli.py | ComputerCraftr/pivx-gui | 79c13d9dcaf48dfb11400f0bc5733aaa7c83cee9 | [
"MIT"
] | null | null | null | test/functional/interface_bitcoin_cli.py | ComputerCraftr/pivx-gui | 79c13d9dcaf48dfb11400f0bc5733aaa7c83cee9 | [
"MIT"
] | null | null | null | test/functional/interface_bitcoin_cli.py | ComputerCraftr/pivx-gui | 79c13d9dcaf48dfb11400f0bc5733aaa7c83cee9 | [
"MIT"
] | 1 | 2021-01-23T04:15:52.000Z | 2021-01-23T04:15:52.000Z | #!/usr/bin/env python3
# Copyright (c) 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.
"""Test ysw-cli"""
from test_framework.test_framework import YieldSakingWalletTestFramework
from test_framework... | 49.050847 | 103 | 0.715619 | from test_framework.test_framework import YieldSakingWalletTestFramework
from test_framework.util import assert_equal, assert_raises_process_error, get_auth_cookie
import time
class TestBitcoinCli(YieldSakingWalletTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_no... | true | true |
f719ea3d7dd63575d0159399e9ac03475a0baa21 | 924 | py | Python | aldryn_google_chrome_frame/models.py | aldryn/aldryn-google-chrome-frame | a0deda5d7b4b60b1ca88b7c3b09685e86b598e2a | [
"BSD-3-Clause"
] | null | null | null | aldryn_google_chrome_frame/models.py | aldryn/aldryn-google-chrome-frame | a0deda5d7b4b60b1ca88b7c3b09685e86b598e2a | [
"BSD-3-Clause"
] | null | null | null | aldryn_google_chrome_frame/models.py | aldryn/aldryn-google-chrome-frame | a0deda5d7b4b60b1ca88b7c3b09685e86b598e2a | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from cmscloud.template_api import registry
from django.conf import settings
def get_meta_version(max_version):
max_version = int(max_version)
assert 6 <= max_version <= 9
if max_version == 9:
return '1'
else:
return 'IE%d' % (max_version, )
META_TAG = '<meta ht... | 36.96 | 109 | 0.712121 | from cmscloud.template_api import registry
from django.conf import settings
def get_meta_version(max_version):
max_version = int(max_version)
assert 6 <= max_version <= 9
if max_version == 9:
return '1'
else:
return 'IE%d' % (max_version, )
META_TAG = '<meta http-equiv="X-UA-Compatibl... | true | true |
f719ea5c0a903eafeb8163fd0cad4442d6c73370 | 520 | py | Python | torchtools/callbacks/__init__.py | Time1ess/torchtools | 1c48591188827f8a7403162728f86229203354c5 | [
"BSD-3-Clause"
] | 16 | 2017-08-15T14:01:13.000Z | 2020-12-21T11:23:31.000Z | torchtools/callbacks/__init__.py | Time1ess/torchtools | 1c48591188827f8a7403162728f86229203354c5 | [
"BSD-3-Clause"
] | null | null | null | torchtools/callbacks/__init__.py | Time1ess/torchtools | 1c48591188827f8a7403162728f86229203354c5 | [
"BSD-3-Clause"
] | 2 | 2017-12-28T14:09:09.000Z | 2020-07-14T14:29:30.000Z | # coding: UTF-8
from .callback import Hook, Callback
from .checkpoint import ModelCheckPoint
from .csvlogger import CSVLogger
from .early_stopping import EarlyStopping
from .lr_scheduler import (
LambdaLR, StepLR, MultiStepLR, ExponentialLR, ReduceLROnPlateau)
from .tensorboard_logger import TensorBoardLogger
__a... | 27.368421 | 78 | 0.75 | from .callback import Hook, Callback
from .checkpoint import ModelCheckPoint
from .csvlogger import CSVLogger
from .early_stopping import EarlyStopping
from .lr_scheduler import (
LambdaLR, StepLR, MultiStepLR, ExponentialLR, ReduceLROnPlateau)
from .tensorboard_logger import TensorBoardLogger
__all__ = [
'Ho... | true | true |
f719ea9ceaf6800cbd249182d3c34733fdae35f0 | 3,716 | py | Python | test.py | AlbertoSousaSantana/devopslav_full02 | 679bdca0f2fb886febeba37696f49143105894b6 | [
"MIT"
] | null | null | null | test.py | AlbertoSousaSantana/devopslav_full02 | 679bdca0f2fb886febeba37696f49143105894b6 | [
"MIT"
] | null | null | null | test.py | AlbertoSousaSantana/devopslav_full02 | 679bdca0f2fb886febeba37696f49143105894b6 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from app import app ... | 148.64 | 222 | 0.130786 | from app import app
import unittest ... | true | true |
f719eb4a68e5fddea525ab05f9a6de0a28ad334a | 10,408 | py | Python | retinanet/losses_vehicle.py | RobinCondat/pytorch-retinanet | 14a2085cd3785a667454898dc65f5324b1b9c6b8 | [
"Apache-2.0"
] | null | null | null | retinanet/losses_vehicle.py | RobinCondat/pytorch-retinanet | 14a2085cd3785a667454898dc65f5324b1b9c6b8 | [
"Apache-2.0"
] | null | null | null | retinanet/losses_vehicle.py | RobinCondat/pytorch-retinanet | 14a2085cd3785a667454898dc65f5324b1b9c6b8 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import torch
import torch.nn as nn
from retinanet.config_experiment_2 import INDEXES_MIX, VEHICLE_INDEXES
def calc_iou(a, b):
area = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1])
iw = torch.min(torch.unsqueeze(a[:, 2], dim=1), b[:, 2]) - torch.max(torch.unsqueeze(a[:, 0], 1), b[:, 0])
ih = ... | 42.831276 | 133 | 0.560146 | import numpy as np
import torch
import torch.nn as nn
from retinanet.config_experiment_2 import INDEXES_MIX, VEHICLE_INDEXES
def calc_iou(a, b):
area = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1])
iw = torch.min(torch.unsqueeze(a[:, 2], dim=1), b[:, 2]) - torch.max(torch.unsqueeze(a[:, 0], 1), b[:, 0])
ih = ... | true | true |
f719ee1200d97dbce407161a29de73e610926f93 | 1,780 | py | Python | kubernetes_asyncio/test/test_storage_v1alpha1_api.py | aK0nshin/kubernetes_asyncio | aef9edcc1f8671a5b1bba9f4684bde890176b19c | [
"Apache-2.0"
] | null | null | null | kubernetes_asyncio/test/test_storage_v1alpha1_api.py | aK0nshin/kubernetes_asyncio | aef9edcc1f8671a5b1bba9f4684bde890176b19c | [
"Apache-2.0"
] | null | null | null | kubernetes_asyncio/test/test_storage_v1alpha1_api.py | aK0nshin/kubernetes_asyncio | aef9edcc1f8671a5b1bba9f4684bde890176b19c | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | 21.707317 | 124 | 0.676404 |
from __future__ import absolute_import
import unittest
import kubernetes_asyncio.client
from kubernetes_asyncio.client.api.storage_v1alpha1_api import StorageV1alpha1Api from kubernetes_asyncio.client.rest import ApiException
class TestStorageV1alpha1Api(unittest.TestCase):
def setUp(self):
self.ap... | true | true |
f719ee2700b12c9c0e630bfb643af003a5b4013a | 7,162 | py | Python | clicktocall/app.py | Python-725/clicktocall-flask | 83268b7c90e487a70fc5ef0dcdbb3343d1dc783d | [
"MIT"
] | null | null | null | clicktocall/app.py | Python-725/clicktocall-flask | 83268b7c90e487a70fc5ef0dcdbb3343d1dc783d | [
"MIT"
] | null | null | null | clicktocall/app.py | Python-725/clicktocall-flask | 83268b7c90e487a70fc5ef0dcdbb3343d1dc783d | [
"MIT"
] | null | null | null | from flask import Flask
from flask import jsonify
from flask import render_template
from flask import request
import os, base64, uuid
from twilio.twiml.voice_response import VoiceResponse, Gather, Dial
from twilio.rest import Client
# Declare and configure application
app = Flask(__name__, static_url_path='/static')
... | 36.728205 | 132 | 0.655962 | from flask import Flask
from flask import jsonify
from flask import render_template
from flask import request
import os, base64, uuid
from twilio.twiml.voice_response import VoiceResponse, Gather, Dial
from twilio.rest import Client
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('local_settin... | true | true |
f719ee8eea12cfc3dea84e56aaeb16666fde914e | 133 | py | Python | twl/c2.py | xiaolinzi-xl/python_imooc | 07bde890e3ab0ddef4467b0c77ef33614339a657 | [
"Apache-2.0"
] | null | null | null | twl/c2.py | xiaolinzi-xl/python_imooc | 07bde890e3ab0ddef4467b0c77ef33614339a657 | [
"Apache-2.0"
] | null | null | null | twl/c2.py | xiaolinzi-xl/python_imooc | 07bde890e3ab0ddef4467b0c77ef33614339a657 | [
"Apache-2.0"
] | null | null | null |
list_x = [1,2,3,4,5,6,7,8]
def square(x):
return x*x
# for x in list_x:
# square(x)
r = map(square,list_x)
print(list(r)) | 12.090909 | 26 | 0.578947 |
list_x = [1,2,3,4,5,6,7,8]
def square(x):
return x*x
r = map(square,list_x)
print(list(r)) | true | true |
f719eeaa3c3602f09dba2e13bf498a6011b27cbe | 787 | py | Python | pyspark-utils/wordcounts.py | domvwt/uol-ds-tools | 62348b3e04a2f27ceaa19776fb3024eaaf21d593 | [
"MIT"
] | 4 | 2020-11-27T06:08:05.000Z | 2021-04-29T15:57:12.000Z | pyspark-utils/wordcounts.py | domvwt/uol-ds-tools | 62348b3e04a2f27ceaa19776fb3024eaaf21d593 | [
"MIT"
] | null | null | null | pyspark-utils/wordcounts.py | domvwt/uol-ds-tools | 62348b3e04a2f27ceaa19776fb3024eaaf21d593 | [
"MIT"
] | 2 | 2020-12-16T11:01:48.000Z | 2020-12-28T14:02:24.000Z | #! /opt/spark/bin/pyspark
import re
from pathlib import Path
INPUT_TXT = "~/uol-ds-tools/pyspark-utils/frankenstein.txt"
myfile = Path(INPUT_TXT).expanduser().absolute()
rdd_txt = sc.textFile(f"file:///{myfile}")
# Simple word counts splitting on whitespace
counts = (
rdd_txt.flatMap(lambda line: line.split())... | 21.27027 | 59 | 0.64676 | import re
from pathlib import Path
INPUT_TXT = "~/uol-ds-tools/pyspark-utils/frankenstein.txt"
myfile = Path(INPUT_TXT).expanduser().absolute()
rdd_txt = sc.textFile(f"file:///{myfile}")
counts = (
rdd_txt.flatMap(lambda line: line.split())
.map(lambda word: (word, 1))
.reduceByKey(lambda a, b: a + b)
... | true | true |
f719eeae51beeb20ebbfea489acc9d5269a4d2a2 | 397 | py | Python | simpleblog/asgi.py | itsmusa/simpleblog | fceef520684a8249e119c337898b945689515957 | [
"MIT"
] | null | null | null | simpleblog/asgi.py | itsmusa/simpleblog | fceef520684a8249e119c337898b945689515957 | [
"MIT"
] | null | null | null | simpleblog/asgi.py | itsmusa/simpleblog | fceef520684a8249e119c337898b945689515957 | [
"MIT"
] | null | null | null | """
ASGI config for simpleblog project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... | 23.352941 | 78 | 0.788413 |
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simpleblog.settings')
application = get_asgi_application()
| true | true |
f719ef2757a2269c2a99feca23fcebc07b42be06 | 2,215 | py | Python | src/myip.py | Fuhrmann/keypirinha-myip | 5a68e1061d6c597dfc21ab8cd86319c4d32efb07 | [
"MIT"
] | 13 | 2018-03-29T23:40:04.000Z | 2021-06-28T19:18:42.000Z | src/myip.py | Fuhrmann/keypirinha-myip | 5a68e1061d6c597dfc21ab8cd86319c4d32efb07 | [
"MIT"
] | null | null | null | src/myip.py | Fuhrmann/keypirinha-myip | 5a68e1061d6c597dfc21ab8cd86319c4d32efb07 | [
"MIT"
] | null | null | null | # Keypirinha launcher (keypirinha.com)
import socket
import keypirinha as kp
import keypirinha_net as kpnet
import keypirinha_util as kpu
class MyIP(kp.Plugin):
"""
Get your public and local IP directly from Keypirinha.
"""
ITEM_CAT = kp.ItemCategory.USER_BASE + 1
KEYWORD = 'ip'
def __init... | 31.197183 | 69 | 0.531377 |
import socket
import keypirinha as kp
import keypirinha_net as kpnet
import keypirinha_util as kpu
class MyIP(kp.Plugin):
ITEM_CAT = kp.ItemCategory.USER_BASE + 1
KEYWORD = 'ip'
def __init__(self):
super().__init__()
self._urlopener = kpnet.build_urllib_opener()
def on_suggest(sel... | true | true |
f719ef5038ede533d676debe6b7851092917855f | 6,254 | py | Python | src/main.py | PeterouZh/PyTorch-StudioGAN | faef6048d25dadee4fa31b2955f16f7d1ca8e1e2 | [
"MIT"
] | null | null | null | src/main.py | PeterouZh/PyTorch-StudioGAN | faef6048d25dadee4fa31b2955f16f7d1ca8e1e2 | [
"MIT"
] | null | null | null | src/main.py | PeterouZh/PyTorch-StudioGAN | faef6048d25dadee4fa31b2955f16f7d1ca8e1e2 | [
"MIT"
] | null | null | null | # PyTorch StudioGAN: https://github.com/POSTECH-CVLab/PyTorch-StudioGAN
# The MIT License (MIT)
# See license file or visit https://github.com/POSTECH-CVLab/PyTorch-StudioGAN for details
# src/main.py
import json
import os
import sys
import random
import warnings
from argparse import ArgumentParser
from utils.misc ... | 50.435484 | 138 | 0.714103 |
import json
import os
import sys
import random
import warnings
from argparse import ArgumentParser
from utils.misc import *
from utils.make_hdf5 import make_hdf5
from utils.log import make_run_name
from loader import prepare_train_eval
import torch
from torch.backends import cudnn
import torch.multiprocessing as m... | true | true |
f719f008f608295f63a3a4f7b4b174f389cd19b8 | 6,048 | py | Python | test/Scanner/source_scanner-dict.py | KastB/scons | b6f9defefba687bc1050605ebcf3d816af3c2808 | [
"MIT"
] | null | null | null | test/Scanner/source_scanner-dict.py | KastB/scons | b6f9defefba687bc1050605ebcf3d816af3c2808 | [
"MIT"
] | null | null | null | test/Scanner/source_scanner-dict.py | KastB/scons | b6f9defefba687bc1050605ebcf3d816af3c2808 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | 26.88 | 80 | 0.687335 |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
with open(sys.argv[1], 'w') as ofp:
for infile in sys.argv[2:]:
with open(infile, 'r') as ifp:
include_prefix = '... | true | true |
f719f0382623361ba7540988b5ee46b2739e8570 | 1,237 | py | Python | HW3/Add-command/cloudmesh_numpy/cloudmesh_numpy/plugins/cm_shell_numpy.py | futuresystems/465-git4hiroaki | bfd9068e0d074d7b6132844dc0f92780bf63bcb9 | [
"Apache-2.0"
] | null | null | null | HW3/Add-command/cloudmesh_numpy/cloudmesh_numpy/plugins/cm_shell_numpy.py | futuresystems/465-git4hiroaki | bfd9068e0d074d7b6132844dc0f92780bf63bcb9 | [
"Apache-2.0"
] | null | null | null | HW3/Add-command/cloudmesh_numpy/cloudmesh_numpy/plugins/cm_shell_numpy.py | futuresystems/465-git4hiroaki | bfd9068e0d074d7b6132844dc0f92780bf63bcb9 | [
"Apache-2.0"
] | null | null | null | from __future__ import print_function
import os
from cmd3.console import Console
from cmd3.shell import command
from cloudmesh_numpy.command_numpy import command_numpy
class cm_shell_numpy:
def activate_cm_shell_numpy(self):
self.register_command_topic('mycommands', 'numpy')
@command
def do_num... | 24.254902 | 75 | 0.579628 | from __future__ import print_function
import os
from cmd3.console import Console
from cmd3.shell import command
from cloudmesh_numpy.command_numpy import command_numpy
class cm_shell_numpy:
def activate_cm_shell_numpy(self):
self.register_command_topic('mycommands', 'numpy')
@command
def do_num... | true | true |
f719f0690f45a487b47db964c4e0e9f736b885dc | 20,953 | py | Python | anyex/bitbank.py | ttwishing/anyex | cfd1f2f04ab992b790add4843aafff91e5773cbf | [
"MIT"
] | null | null | null | anyex/bitbank.py | ttwishing/anyex | cfd1f2f04ab992b790add4843aafff91e5773cbf | [
"MIT"
] | null | null | null | anyex/bitbank.py | ttwishing/anyex | cfd1f2f04ab992b790add4843aafff91e5773cbf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/anyex/anyex/blob/master/CONTRIBUTING.md#how-to-contribute-code
from anyex.base.exchange import Exchange
from anyex.base.errors import ExchangeError
from anyex.base.errors import AuthenticationError
fr... | 41.906 | 143 | 0.509617 |
from anyex.base.exchange import Exchange
from anyex.base.errors import ExchangeError
from anyex.base.errors import AuthenticationError
from anyex.base.errors import PermissionDenied
from anyex.base.errors import InsufficientFunds
from anyex.base.errors import InvalidOrder
from anyex.base.errors import OrderNotFound
f... | true | true |
f719f0bd0810de624991f194db2d5e2731bca1d7 | 2,976 | py | Python | etcd/setup.py | dvanderveer/integrations-core | 41dd9950296455457c9b7342584153678503d5aa | [
"BSD-3-Clause"
] | null | null | null | etcd/setup.py | dvanderveer/integrations-core | 41dd9950296455457c9b7342584153678503d5aa | [
"BSD-3-Clause"
] | null | null | null | etcd/setup.py | dvanderveer/integrations-core | 41dd9950296455457c9b7342584153678503d5aa | [
"BSD-3-Clause"
] | null | null | null | # Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
import re
here = path.abspath(path.dirname(__file__))
# get the long description from the readme file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
l... | 29.176471 | 70 | 0.612231 | from setuptools import setup
from codecs import open
from os import path
import re
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
runtime_reqs = ['datadog_checks_base']
with open(path.join(here, 'requirements.txt'), encodin... | true | true |
f719f29ce078fb015c146ba0d7a5bb429d7c7c23 | 69 | py | Python | src/masonite/api/middleware/__init__.py | cercos/masonite | f7f220efa7fae833683e9f07ce13c3795a87d3b8 | [
"MIT"
] | 1,816 | 2018-02-14T01:59:51.000Z | 2022-03-31T17:09:20.000Z | src/masonite/api/middleware/__init__.py | cercos/masonite | f7f220efa7fae833683e9f07ce13c3795a87d3b8 | [
"MIT"
] | 340 | 2018-02-11T00:27:26.000Z | 2022-03-21T12:00:24.000Z | src/masonite/api/middleware/__init__.py | cercos/masonite | f7f220efa7fae833683e9f07ce13c3795a87d3b8 | [
"MIT"
] | 144 | 2018-03-18T00:08:16.000Z | 2022-02-26T01:51:58.000Z | from .JWTAuthenticationMiddleware import JWTAuthenticationMiddleware
| 34.5 | 68 | 0.927536 | from .JWTAuthenticationMiddleware import JWTAuthenticationMiddleware
| true | true |
f719f32c0de53ae35c0223c63678dbad415c2f11 | 22 | py | Python | __init__.py | andy-96/GFPGAN | 0ed1214760170cc27fdfd60da1f64a0699a28cf4 | [
"BSD-3-Clause"
] | null | null | null | __init__.py | andy-96/GFPGAN | 0ed1214760170cc27fdfd60da1f64a0699a28cf4 | [
"BSD-3-Clause"
] | null | null | null | __init__.py | andy-96/GFPGAN | 0ed1214760170cc27fdfd60da1f64a0699a28cf4 | [
"BSD-3-Clause"
] | null | null | null | from .gfpgan import *
| 11 | 21 | 0.727273 | from .gfpgan import *
| true | true |
f719f37af819374470555e086638c20bfd0d0001 | 1,250 | py | Python | leasing/viewsets/contact_additional_views.py | hkotkanen/mvj | a22d40869ef1b13924da428f3026d248acef81a7 | [
"MIT"
] | null | null | null | leasing/viewsets/contact_additional_views.py | hkotkanen/mvj | a22d40869ef1b13924da428f3026d248acef81a7 | [
"MIT"
] | null | null | null | leasing/viewsets/contact_additional_views.py | hkotkanen/mvj | a22d40869ef1b13924da428f3026d248acef81a7 | [
"MIT"
] | null | null | null | import re
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from rest_framework.views import APIView
from leasing.models import Contact
from leasing.permissions import PerMethodPermissi... | 33.783784 | 115 | 0.7056 | import re
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from rest_framework.views import APIView
from leasing.models import Contact
from leasing.permissions import PerMethodPermissi... | true | true |
f719f62e2d8ed7d50dbaff87b0c28e125875ad70 | 21,056 | py | Python | tensorflow/lite/python/convert.py | anigasan/tensorflow | 5b780b4983007661ca479bf4d7ed9a260d8ce43f | [
"Apache-2.0"
] | 1 | 2019-11-18T10:54:10.000Z | 2019-11-18T10:54:10.000Z | tensorflow/lite/python/convert.py | anigasan/tensorflow | 5b780b4983007661ca479bf4d7ed9a260d8ce43f | [
"Apache-2.0"
] | 1 | 2018-04-02T23:42:30.000Z | 2018-05-03T23:12:23.000Z | tensorflow/lite/python/convert.py | anigasan/tensorflow | 5b780b4983007661ca479bf4d7ed9a260d8ce43f | [
"Apache-2.0"
] | null | null | null | # Lint as: python2, python3
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 42.537374 | 80 | 0.714381 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import enum import os as _os
import platform as _platform
import subprocess as _subprocess
import tempfile as _tempfile
import six
from six.moves import map
from tensorflow.lite.python import lite_constants... | true | true |
f719f728d45f799dab957ca3faa6158730bf0f3b | 1,609 | py | Python | BDSP-Scripts/utils/pokeTwilio.py | leecbryant/BDSP-PythonBot | db77b08e023ce3942cfff3c6d3e9a32f0d63f3dc | [
"MIT"
] | 4 | 2022-03-28T21:00:00.000Z | 2022-03-29T00:03:20.000Z | BDSP-Scripts/utils/pokeTwilio.py | leecbryant/BDSP-PythonBot | db77b08e023ce3942cfff3c6d3e9a32f0d63f3dc | [
"MIT"
] | null | null | null | BDSP-Scripts/utils/pokeTwilio.py | leecbryant/BDSP-PythonBot | db77b08e023ce3942cfff3c6d3e9a32f0d63f3dc | [
"MIT"
] | 1 | 2022-03-30T05:12:46.000Z | 2022-03-30T05:12:46.000Z | import os
from twilio.rest import Client
#import twilioConfig from one folder up and inside Config_Files folder
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
try:
from Config_Files import twilioConfig
except ImportError:
from Config_Files import twilioConfig_default as... | 43.486486 | 190 | 0.709136 | import os
from twilio.rest import Client
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
try:
from Config_Files import twilioConfig
except ImportError:
from Config_Files import twilioConfig_default as twilioConfig
def found_shiny_text(found_pokemon = '', to_num = twili... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.